diff --git a/.changeset/few-news-decide.md b/.changeset/few-news-decide.md new file mode 100644 index 00000000000..f09b96032b4 --- /dev/null +++ b/.changeset/few-news-decide.md @@ -0,0 +1,5 @@ +--- +'@graphql-tools/utils': minor +--- + +Support TypedDocumentNode in ExecutionRequest diff --git a/packages/batch-execute/tests/batchExecute.test.ts b/packages/batch-execute/tests/batchExecute.test.ts index 1fa8dfadd38..eb76a674cea 100644 --- a/packages/batch-execute/tests/batchExecute.test.ts +++ b/packages/batch-execute/tests/batchExecute.test.ts @@ -7,7 +7,7 @@ import { normalizedExecutor } from '@graphql-tools/executor'; describe('batch execution', () => { let executorCalls = 0; let executorDocument: string | undefined; - let executorVariables: Record | undefined; + let executorVariables: any | undefined; const schema = makeExecutableSchema({ typeDefs: /* GraphQL */ ` diff --git a/packages/utils/package.json b/packages/utils/package.json index 94c8e46886d..c894ddfb062 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -56,6 +56,7 @@ "graphql-scalars": "1.20.1" }, "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", "tslib": "^2.4.0" }, "publishConfig": { diff --git a/packages/utils/src/Interfaces.ts b/packages/utils/src/Interfaces.ts index 0dcc31838b5..c289f72f1fe 100644 --- a/packages/utils/src/Interfaces.ts +++ b/packages/utils/src/Interfaces.ts @@ -1,3 +1,4 @@ +import { TypedDocumentNode } from '@graphql-typed-document-node/core'; import { GraphQLSchema, GraphQLField, @@ -68,13 +69,14 @@ export interface ExecutionResult { } export interface ExecutionRequest< - TArgs extends Record = Record, + TVariables extends Record = any, TContext = any, TRootValue = any, - TExtensions = Record + TExtensions = Record, + TReturn = any > { - document: DocumentNode; - variables?: TArgs; + document: TypedDocumentNode; + variables?: TVariables; // TODO: Will be removed in next major operationType?: OperationTypeNode; operationName?: string; diff --git a/packages/utils/src/executor.ts b/packages/utils/src/executor.ts index 00c28f20ee0..01443578953 100644 --- a/packages/utils/src/executor.ts +++ b/packages/utils/src/executor.ts @@ -10,7 +10,7 @@ export type AsyncExecutor, TBaseExtensions = TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions >( - request: ExecutionRequest + request: ExecutionRequest ) => Promise>>; export type SyncExecutor, TBaseExtensions = Record> = < @@ -20,7 +20,7 @@ export type SyncExecutor, TBaseExtensions = R TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions >( - request: ExecutionRequest + request: ExecutionRequest ) => ExecutionResult; export type Executor, TBaseExtensions = Record> = < @@ -30,5 +30,5 @@ export type Executor, TBaseExtensions = Recor TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions >( - request: ExecutionRequest + request: ExecutionRequest ) => MaybePromise>>; diff --git a/patches/typedoc-plugin-markdown+3.13.6.patch b/patches/typedoc-plugin-markdown+3.14.0.patch similarity index 96% rename from patches/typedoc-plugin-markdown+3.13.6.patch rename to patches/typedoc-plugin-markdown+3.14.0.patch index 68733afbf05..0b0827e18db 100644 --- a/patches/typedoc-plugin-markdown+3.13.6.patch +++ b/patches/typedoc-plugin-markdown+3.14.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js -index c8529a5..4dadab7 100644 +index c8529a5..7f884c9 100644 --- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js +++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js @@ -20,9 +20,9 @@ function default_1(theme) { @@ -15,7 +15,7 @@ index c8529a5..4dadab7 100644 md.push(getType(this)); if (!(this.type instanceof typedoc_1.LiteralType) && diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js -index 24bbd50..70a032d 100644 +index 24bbd50..12e5c61 100644 --- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js +++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js @@ -19,7 +19,7 @@ function default_1(theme) { @@ -28,7 +28,7 @@ index 24bbd50..70a032d 100644 } return title.join(''); diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js -index 1d547e1..69766f8 100644 +index 38ade0b..77b86c1 100644 --- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js +++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js @@ -20,9 +20,9 @@ function default_1(theme) { @@ -44,7 +44,7 @@ index 1d547e1..69766f8 100644 md.push(`(${getParameters(this.parameters)})`); if (this.type && !((_b = this.parent) === null || _b === void 0 ? void 0 : _b.kindOf(typedoc_1.ReflectionKind.Constructor))) { diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js -index 14c33a7..cad815e 100644 +index 8569286..88fe68d 100644 --- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js +++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js @@ -90,7 +90,7 @@ function getDeclarationType(model) { @@ -68,7 +68,7 @@ index 14c33a7..cad815e 100644 : []; const params = fn.parameters ? fn.parameters.map((param) => { -@@ -128,9 +128,9 @@ function getReferenceType(model, emphasis) { +@@ -127,9 +127,9 @@ function getReferenceType(model, emphasis) { : `\`${model.name}\``); } if (model.typeArguments && model.typeArguments.length > 0) { @@ -81,7 +81,7 @@ index 14c33a7..cad815e 100644 return reflection.join(''); } diff --git a/node_modules/typedoc-plugin-markdown/dist/utils.js b/node_modules/typedoc-plugin-markdown/dist/utils.js -index 051d9c6..4dc54b5 100644 +index f254aed..5e1e3b1 100644 --- a/node_modules/typedoc-plugin-markdown/dist/utils.js +++ b/node_modules/typedoc-plugin-markdown/dist/utils.js @@ -11,7 +11,8 @@ function formatContents(contents) {