Skip to content

Commit a94217e

Browse files
committed
feat(executor): support TypedDocumentNode
1 parent 10cbbf5 commit a94217e

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

.changeset/few-news-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/utils': minor
3+
---
4+
5+
Support TypedDocumentNode in ExecutionRequest

packages/batch-execute/tests/batchExecute.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { normalizedExecutor } from '@graphql-tools/executor';
77
describe('batch execution', () => {
88
let executorCalls = 0;
99
let executorDocument: string | undefined;
10-
let executorVariables: Record<string, any> | undefined;
10+
let executorVariables: any | undefined;
1111

1212
const schema = makeExecutableSchema({
1313
typeDefs: /* GraphQL */ `

packages/utils/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"graphql-scalars": "1.20.1"
5757
},
5858
"dependencies": {
59+
"@graphql-typed-document-node/core": "^3.1.1",
5960
"tslib": "^2.4.0"
6061
},
6162
"publishConfig": {

packages/utils/src/Interfaces.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
12
import {
23
GraphQLSchema,
34
GraphQLField,
@@ -68,13 +69,14 @@ export interface ExecutionResult<TData = any, TExtensions = any> {
6869
}
6970

7071
export interface ExecutionRequest<
71-
TArgs extends Record<string, any> = Record<string, any>,
72+
TVariables extends Record<string, any> = any,
7273
TContext = any,
7374
TRootValue = any,
74-
TExtensions = Record<string, any>
75+
TExtensions = Record<string, any>,
76+
TReturn = any
7577
> {
76-
document: DocumentNode;
77-
variables?: TArgs;
78+
document: TypedDocumentNode<TReturn, TVariables>;
79+
variables?: TVariables;
7880
// TODO: Will be removed in next major
7981
operationType?: OperationTypeNode;
8082
operationName?: string;

packages/utils/src/executor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions =
1010
TRoot = any,
1111
TExtensions extends TBaseExtensions = TBaseExtensions
1212
>(
13-
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>
13+
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>
1414
) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
1515

1616
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <
@@ -20,7 +20,7 @@ export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = R
2020
TRoot = any,
2121
TExtensions extends TBaseExtensions = TBaseExtensions
2222
>(
23-
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>
23+
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>
2424
) => ExecutionResult<TReturn>;
2525

2626
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <
@@ -30,5 +30,5 @@ export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Recor
3030
TRoot = any,
3131
TExtensions extends TBaseExtensions = TBaseExtensions
3232
>(
33-
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>
33+
request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>
3434
) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;

patches/typedoc-plugin-markdown+3.13.6.patch renamed to patches/typedoc-plugin-markdown+3.14.0.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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
2-
index c8529a5..4dadab7 100644
2+
index c8529a5..7f884c9 100644
33
--- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js
44
+++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js
55
@@ -20,9 +20,9 @@ function default_1(theme) {
@@ -15,7 +15,7 @@ index c8529a5..4dadab7 100644
1515
md.push(getType(this));
1616
if (!(this.type instanceof typedoc_1.LiteralType) &&
1717
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
18-
index 24bbd50..70a032d 100644
18+
index 24bbd50..12e5c61 100644
1919
--- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js
2020
+++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/reflection-title.js
2121
@@ -19,7 +19,7 @@ function default_1(theme) {
@@ -28,7 +28,7 @@ index 24bbd50..70a032d 100644
2828
}
2929
return title.join('');
3030
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
31-
index 1d547e1..69766f8 100644
31+
index 38ade0b..77b86c1 100644
3232
--- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js
3333
+++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/signature-title.js
3434
@@ -20,9 +20,9 @@ function default_1(theme) {
@@ -44,7 +44,7 @@ index 1d547e1..69766f8 100644
4444
md.push(`(${getParameters(this.parameters)})`);
4545
if (this.type && !((_b = this.parent) === null || _b === void 0 ? void 0 : _b.kindOf(typedoc_1.ReflectionKind.Constructor))) {
4646
diff --git a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js
47-
index 14c33a7..cad815e 100644
47+
index 8569286..88fe68d 100644
4848
--- a/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js
4949
+++ b/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js
5050
@@ -90,7 +90,7 @@ function getDeclarationType(model) {
@@ -68,7 +68,7 @@ index 14c33a7..cad815e 100644
6868
: [];
6969
const params = fn.parameters
7070
? fn.parameters.map((param) => {
71-
@@ -128,9 +128,9 @@ function getReferenceType(model, emphasis) {
71+
@@ -127,9 +127,9 @@ function getReferenceType(model, emphasis) {
7272
: `\`${model.name}\``);
7373
}
7474
if (model.typeArguments && model.typeArguments.length > 0) {
@@ -81,7 +81,7 @@ index 14c33a7..cad815e 100644
8181
return reflection.join('');
8282
}
8383
diff --git a/node_modules/typedoc-plugin-markdown/dist/utils.js b/node_modules/typedoc-plugin-markdown/dist/utils.js
84-
index 051d9c6..4dc54b5 100644
84+
index f254aed..5e1e3b1 100644
8585
--- a/node_modules/typedoc-plugin-markdown/dist/utils.js
8686
+++ b/node_modules/typedoc-plugin-markdown/dist/utils.js
8787
@@ -11,7 +11,8 @@ function formatContents(contents) {

0 commit comments

Comments
 (0)