Skip to content

Commit

Permalink
lighthouse version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissm79 committed Apr 9, 2018
1 parent cd323b5 commit f54a550
Show file tree
Hide file tree
Showing 244 changed files with 8,248 additions and 9,824 deletions.
5 changes: 5 additions & 0 deletions assets/node.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Node global interface
interface Node @interface(resolver: "Nuwave\\Lighthouse\\Support\\Http\\GraphQL\\Interfaces\\NodeInterface@resolve") {
# Global identifier that can be used to resolve any Node implementation.
_id: ID!
}
51 changes: 51 additions & 0 deletions assets/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
type PageInfo {
# When paginating forwards, are there more items?
hasNextPage: Boolean!

# When paginating backwards, are there more items?
hasPreviousPage: Boolean!

# When paginating backwards, the cursor to continue.
startCursor: String

# When paginating forwards, the cursor to continue.
endCursor: String

# Total number of node in connection.
total: Int

# Count of nodes in current request.
count: Int

# Current page of request.
currentPage: Int

# Last page in connection.
lastPage: Int
}

type PaginatorInfo {
# Total count of available items in the page.
count: Int!

# Current pagination page.
currentPage: Int!

# Index of first item in the current page.
firstItem: Int!

# If collection has more pages.
hasMorePages: Boolean!

# Index of last item in the current page.
lastItem: Int!

# Last page number of the collection.
lastPage: Int!

# Number of items per page in the collection.
perPage: Int!

# Total items available in the collection.
total: Int!
}
39 changes: 22 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@
"source": "https://github.com/nuwave/lighthouse"
},
"require": {
"php": ">=5.5.9",
"illuminate/console": "^5.2 || ^5.3",
"illuminate/contracts": "^5.2 || ^5.3",
"illuminate/database": "^5.2 || ^5.3",
"illuminate/http": "^5.2 || ^5.3",
"illuminate/pagination": "^5.2 || ^5.3",
"illuminate/routing": "^5.2 || ^5.3",
"illuminate/support": "^5.2 || ^5.3",
"webonyx/graphql-php": "^0.9"
"illuminate/contracts": "^5.4",
"illuminate/http": "^5.4",
"illuminate/pagination": "^5.4",
"illuminate/routing": "^5.4",
"illuminate/support": "^5.4",
"opis/closure": "^3.0",
"webonyx/graphql-php": "^0.11.5"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.10",
"illuminate/validation": "^5.4",
"orchestra/testbench": "^3.6",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
Expand All @@ -36,22 +40,23 @@
"src/Support/helpers.php"
]
},
"require-dev": {
"doctrine/dbal": "^2.5",
"friendsofphp/php-cs-fixer": "~1",
"orchestra/database": "^3.2 || ^3.3",
"orchestra/testbench": "^3.2 || ^3.3",
"phpunit/phpunit": "~4.8 || ~5.0"
},
"autoload-dev": {
"psr-4": {
"Nuwave\\Lighthouse\\Tests\\": "tests/"
"Tests\\": "tests/"
}
},
"scripts": {
"test" : "vendor/bin/phpunit --colors=always",
"test:ci": "composer test -- --verbose --coverage-text --coverage-clover=coverage.xml"
},
"extra": {
"laravel": {
"providers": ["Nuwave\\Lighthouse\\Providers\\LighthouseServiceProvider"],
"aliases": {
"graphql": "Nuwave\\Lighthouse\\GraphQL"
}
}
},
"config": {
"sort-packages": true
}
Expand Down
75 changes: 49 additions & 26 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Directive registry
|--------------------------------------------------------------------------
|
| This package allows you to create your own server-side directives. Change
| these values to register the directory that will hold all of your
| custom directives.
|
*/
'directives' => [__DIR__.'/../app/Http/GraphQL/Directives'],

/*
|--------------------------------------------------------------------------
| Namespace registry
Expand All @@ -12,43 +24,54 @@
|
*/
'namespaces' => [
'mutations' => 'App\\Http\\GraphQL\\Mutations',
'queries' => 'App\\Http\\GraphQL\\Queries',
'types' => 'App\\Http\\GraphQL\\Types',
'fields' => 'App\\Http\\GraphQL\\Fields',
'connections' => 'App\\Http\\GraphQL\\Connections',
'dataloaders' => 'App\\Http\\GraphQL\\DataLoaders',
'models' => 'App\\Models',
'mutations' => 'App\\Http\\GraphQL\\Mutations',
'queries' => 'App\\Http\\GraphQL\\Queries',
'scalars' => 'App\\Http\\GraphQL\\Scalars',
],

'cache' => storage_path('lighthouse/cache'),
'controller' => 'Nuwave\Lighthouse\Support\Http\Controllers\LaravelController@query',
'pagination_macro' => 'toConnection',
'route' => [],
'model_path' => 'App\\Models',
'camel_case' => false,
/*
|--------------------------------------------------------------------------
| GraphQL Controller
|--------------------------------------------------------------------------
|
| Specify which controller (and method) you want to handle GraphQL requests.
|
*/
'controller' => 'Nuwave\Lighthouse\Support\Http\Controllers\GraphQLController@query',

'globalId' => [
'encode' => null,
'decodeId' => null,
'decodeType' => null,
],
/*
|--------------------------------------------------------------------------
| Schema Cache
|--------------------------------------------------------------------------
|
| Specify where the GraphQL schema should be cached.
|
*/
'cache' => null,

/*
|--------------------------------------------------------------------------
| Schema declaration
| Global ID
|--------------------------------------------------------------------------
|
| This is a path that points to where your Relay schema is located
| relative to the app path. You should define your entire Relay
| schema in this file. Declare any Relay queries, mutations,
| and types here instead of laravel-graphql config file.
| When creating a GraphQL type that is Relay compliant, provide a named field
| for the Node identifier.
|
*/
'global_id_field' => '_id',

/*
|--------------------------------------------------------------------------
| Schema declaration
|--------------------------------------------------------------------------
|
| This is a path that points to where your GraphQL schema is located
| relative to the app path. You should define your entire GraphQL
| schema in this file (additional files may be imported).
|
*/
'schema' => [
'output' => storage_path('lighthouse/schema.json'),
'register' => function () {
//
},
'register' => base_path('routes/graphql/schema.graphql'),
],
];
Loading

0 comments on commit f54a550

Please sign in to comment.