-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pulls/master/ extendsive refactor (#393)
* First cut * Apply to queries, fix inheritance bugs * Tests passing * Initial fixes for decoupled * Numerous updates to union/interface generation to support Gatsby * Getting there * Back to schema generation in gatsby * Broke up Inheritance into separate services * Unit tests for new inheritance * Tests passing * Rename to SchemaConfigProvider * Linting * Add inheritance check for field mapping * Use correct event name, no dot syntax * Use unions on single results, e.g. has_one * NEW: Refactor to use interface queries (non-breaking) * Get tests passing * Allow type eager loading for types that don't appear in queries * Simplify exists() check so it doesn't create a new schema every time * Ensure method exists * MINOR: firstResult typed to SS_List for non-dataobject cases * Remove API change to SchemaUpdater * Linting * Fix method return type * Fix Enum overwriting local variable and breaking enumerated arrays * Add base resolver, allow native field to resolve * Change inheritance to apply on models, instead of updateSchema * Fix tests * Linting * Ensure inheritance follows versioned, include bespoke types in query collector, add hiddenAncestor * Cache query collection for performance Co-authored-by: Aaron Carlino <[email protected]>
- Loading branch information
Aaron Carlino
and
Aaron Carlino
committed
Jun 30, 2021
1 parent
841c4e2
commit 1190b40
Showing
75 changed files
with
2,674 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
|
||
namespace SilverStripe\GraphQL\QueryHandler; | ||
|
||
use SilverStripe\Core\Injector\Injectable; | ||
use SilverStripe\GraphQL\Config\Configuration; | ||
use SilverStripe\GraphQL\Schema\Interfaces\ContextProvider; | ||
|
||
/** | ||
* Provides an arbitrary state container that can be passed through | ||
* the resolver chain. It is empty by default and derives | ||
* no state from the actual schema | ||
*/ | ||
class QueryStateProvider implements ContextProvider | ||
{ | ||
use Injectable; | ||
|
||
const KEY = 'queryState'; | ||
|
||
/** | ||
* @var Configuration | ||
*/ | ||
private $queryState; | ||
|
||
/** | ||
* QueryStateProvider constructor. | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->queryState = new Configuration(); | ||
} | ||
|
||
/** | ||
* @param array $context | ||
* @return mixed|null | ||
*/ | ||
public static function get(array $context): Configuration | ||
{ | ||
return $context[self::KEY] ?? new Configuration(); | ||
} | ||
|
||
/** | ||
* @return array[] | ||
*/ | ||
public function provideContext(): array | ||
{ | ||
return [ | ||
self::KEY => $this->queryState, | ||
]; | ||
} | ||
} |
Oops, something went wrong.