-
-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidate Request and ExecutionParams types (#3180)
* consolidate Request and ExecutionParams - also affixes rootValue to Request - when delegating with delegateToSchema, rootValue can be set multiple ways: * when using a custom executor, the custom executor can utilize a rootValue in whichever custom way it specifies. * when using the default executor (execute/subscribe from graphql-js): -- rootValue can be passed to delegateToSchema via a named option -- rootValue can be included within a subschemaConfig -- otherwise, rootValue is inferred from the originating schema - when using wrapSchema/stitchSchemas, a subschemaConfig can specify the createProxyingResolver function which can pass whatever rootValue it wants to delegateToSchema as above. * add changeset * test
- Loading branch information
Showing
24 changed files
with
156 additions
and
147 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
'@graphql-tools/batch-delegate': major | ||
'@graphql-tools/batch-execute': major | ||
'@graphql-tools/delegate': major | ||
'@graphql-tools/links': major | ||
'@graphql-tools/url-loader': major | ||
'@graphql-tools/stitch': major | ||
'@graphql-tools/utils': major | ||
'@graphql-tools/wrap': major | ||
--- | ||
|
||
refactor: ExecutionParams type replaced by Request type | ||
|
||
rootValue property is now a part of the Request type. | ||
|
||
When delegating with delegateToSchema, rootValue can be set multiple ways: | ||
|
||
- when using a custom executor, the custom executor can utilize a rootValue in whichever custom way it specifies. | ||
- when using the default executor (execute/subscribe from graphql-js): | ||
-- rootValue can be passed to delegateToSchema via a named option | ||
-- rootValue can be included within a subschemaConfig | ||
-- otherwise, rootValue is inferred from the originating schema | ||
|
||
When using wrapSchema/stitchSchemas, a subschemaConfig can specify the createProxyingResolver function which can pass whatever rootValue it wants to delegateToSchema as above. |
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import DataLoader from 'dataloader'; | ||
|
||
import { ExecutionParams, Executor } from '@graphql-tools/utils'; | ||
import { Request, Executor } from '@graphql-tools/utils'; | ||
import { createBatchingExecutor } from './createBatchingExecutor'; | ||
import { memoize2of4 } from './memoize'; | ||
|
||
export const getBatchingExecutor = memoize2of4(function ( | ||
_context: Record<string, any>, | ||
executor: Executor, | ||
dataLoaderOptions?: DataLoader.Options<any, any, any> | undefined, | ||
extensionsReducer?: | ||
| undefined | ||
| ((mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>) | ||
extensionsReducer?: undefined | ((mergedExtensions: Record<string, any>, request: Request) => Record<string, any>) | ||
): Executor { | ||
return createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer); | ||
}); |
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
Oops, something went wrong.