graphql 17.0.0-rc.0 → 17.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/diagnostics.d.mts +67 -38
- package/diagnostics.d.ts +67 -38
- package/diagnostics.js +2 -1
- package/diagnostics.js.map +1 -1
- package/diagnostics.mjs +2 -1
- package/diagnostics.mjs.map +1 -1
- package/error/locatedError.d.mts +1 -3
- package/error/locatedError.d.ts +1 -3
- package/error/locatedError.js.map +1 -1
- package/error/locatedError.mjs.map +1 -1
- package/execution/Executor.d.mts +2 -2
- package/execution/Executor.d.ts +2 -2
- package/execution/Executor.js.map +1 -1
- package/execution/Executor.mjs.map +1 -1
- package/execution/execute.d.mts +65 -44
- package/execution/execute.d.ts +65 -44
- package/execution/execute.js +11 -2
- package/execution/execute.js.map +1 -1
- package/execution/execute.mjs +11 -2
- package/execution/execute.mjs.map +1 -1
- package/execution/values.d.mts +17 -17
- package/execution/values.d.ts +17 -17
- package/execution/values.js.map +1 -1
- package/execution/values.mjs.map +1 -1
- package/language/parser.d.mts +20 -30
- package/language/parser.d.ts +20 -30
- package/language/parser.js +3 -9
- package/language/parser.js.map +1 -1
- package/language/parser.mjs +3 -9
- package/language/parser.mjs.map +1 -1
- package/language/predicates.d.mts +5 -1
- package/language/predicates.d.ts +5 -1
- package/language/predicates.js.map +1 -1
- package/language/predicates.mjs.map +1 -1
- package/language/source.d.mts +4 -5
- package/language/source.d.ts +4 -5
- package/language/source.js.map +1 -1
- package/language/source.mjs.map +1 -1
- package/language/visitor.d.mts +10 -2
- package/language/visitor.d.ts +10 -2
- package/language/visitor.js.map +1 -1
- package/language/visitor.mjs.map +1 -1
- package/package.json +1 -4
- package/type/definition.d.mts +96 -64
- package/type/definition.d.ts +96 -64
- package/type/definition.js.map +1 -1
- package/type/definition.mjs.map +1 -1
- package/type/directives.d.mts +3 -3
- package/type/directives.d.ts +3 -3
- package/type/directives.js.map +1 -1
- package/type/directives.mjs.map +1 -1
- package/type/schema.d.mts +4 -8
- package/type/schema.d.ts +4 -8
- package/type/schema.js.map +1 -1
- package/type/schema.mjs.map +1 -1
- package/type/validate.js +101 -30
- package/type/validate.js.map +1 -1
- package/type/validate.mjs +101 -30
- package/type/validate.mjs.map +1 -1
- package/utilities/TypeInfo.d.mts +1 -1
- package/utilities/TypeInfo.d.ts +1 -1
- package/utilities/TypeInfo.js.map +1 -1
- package/utilities/TypeInfo.mjs.map +1 -1
- package/utilities/buildASTSchema.d.mts +0 -1
- package/utilities/buildASTSchema.d.ts +0 -1
- package/utilities/buildASTSchema.js +0 -1
- package/utilities/buildASTSchema.js.map +1 -1
- package/utilities/buildASTSchema.mjs +0 -1
- package/utilities/buildASTSchema.mjs.map +1 -1
- package/utilities/buildClientSchema.d.mts +5 -1
- package/utilities/buildClientSchema.d.ts +5 -1
- package/utilities/buildClientSchema.js.map +1 -1
- package/utilities/buildClientSchema.mjs.map +1 -1
- package/utilities/coerceInputValue.d.mts +7 -6
- package/utilities/coerceInputValue.d.ts +7 -6
- package/utilities/coerceInputValue.js.map +1 -1
- package/utilities/coerceInputValue.mjs.map +1 -1
- package/utilities/concatAST.d.mts +4 -1
- package/utilities/concatAST.d.ts +4 -1
- package/utilities/concatAST.js.map +1 -1
- package/utilities/concatAST.mjs.map +1 -1
- package/utilities/extendSchema.d.mts +3 -3
- package/utilities/extendSchema.d.ts +3 -3
- package/utilities/extendSchema.js +5 -1
- package/utilities/extendSchema.js.map +1 -1
- package/utilities/extendSchema.mjs +5 -1
- package/utilities/extendSchema.mjs.map +1 -1
- package/utilities/introspectionFromSchema.d.mts +6 -2
- package/utilities/introspectionFromSchema.d.ts +6 -2
- package/utilities/introspectionFromSchema.js.map +1 -1
- package/utilities/introspectionFromSchema.mjs.map +1 -1
- package/utilities/lexicographicSortSchema.d.mts +5 -1
- package/utilities/lexicographicSortSchema.d.ts +5 -1
- package/utilities/lexicographicSortSchema.js.map +1 -1
- package/utilities/lexicographicSortSchema.mjs.map +1 -1
- package/utilities/printSchema.d.mts +5 -1
- package/utilities/printSchema.d.ts +5 -1
- package/utilities/printSchema.js.map +1 -1
- package/utilities/printSchema.mjs.map +1 -1
- package/utilities/replaceVariables.d.mts +4 -8
- package/utilities/replaceVariables.d.ts +4 -8
- package/utilities/replaceVariables.js.map +1 -1
- package/utilities/replaceVariables.mjs.map +1 -1
- package/utilities/stripIgnoredCharacters.d.mts +2 -2
- package/utilities/stripIgnoredCharacters.d.ts +2 -2
- package/utilities/stripIgnoredCharacters.js.map +1 -1
- package/utilities/stripIgnoredCharacters.mjs.map +1 -1
- package/utilities/typeComparators.d.mts +1 -5
- package/utilities/typeComparators.d.ts +1 -5
- package/utilities/typeComparators.js.map +1 -1
- package/utilities/typeComparators.mjs.map +1 -1
- package/utilities/validateInputValue.d.mts +10 -8
- package/utilities/validateInputValue.d.ts +10 -8
- package/utilities/validateInputValue.js.map +1 -1
- package/utilities/validateInputValue.mjs.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.mts +4 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.ts +4 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs.map +1 -1
- package/validation/rules/ExecutableDefinitionsRule.d.mts +6 -2
- package/validation/rules/ExecutableDefinitionsRule.d.ts +6 -2
- package/validation/rules/ExecutableDefinitionsRule.js.map +1 -1
- package/validation/rules/ExecutableDefinitionsRule.mjs.map +1 -1
- package/validation/rules/FieldsOnCorrectTypeRule.d.mts +3 -1
- package/validation/rules/FieldsOnCorrectTypeRule.d.ts +3 -1
- package/validation/rules/FieldsOnCorrectTypeRule.js.map +1 -1
- package/validation/rules/FieldsOnCorrectTypeRule.mjs.map +1 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.d.mts +6 -2
- package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +6 -2
- package/validation/rules/FragmentsOnCompositeTypesRule.js.map +1 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.mjs.map +1 -1
- package/validation/rules/KnownArgumentNamesRule.d.mts +3 -1
- package/validation/rules/KnownArgumentNamesRule.d.ts +3 -1
- package/validation/rules/KnownArgumentNamesRule.js.map +1 -1
- package/validation/rules/KnownArgumentNamesRule.mjs.map +1 -1
- package/validation/rules/KnownDirectivesRule.js +2 -1
- package/validation/rules/KnownDirectivesRule.js.map +1 -1
- package/validation/rules/KnownDirectivesRule.mjs +2 -1
- package/validation/rules/KnownDirectivesRule.mjs.map +1 -1
- package/validation/rules/KnownFragmentNamesRule.d.mts +3 -1
- package/validation/rules/KnownFragmentNamesRule.d.ts +3 -1
- package/validation/rules/KnownFragmentNamesRule.js.map +1 -1
- package/validation/rules/KnownFragmentNamesRule.mjs.map +1 -1
- package/validation/rules/LoneAnonymousOperationRule.d.mts +6 -2
- package/validation/rules/LoneAnonymousOperationRule.d.ts +6 -2
- package/validation/rules/LoneAnonymousOperationRule.js.map +1 -1
- package/validation/rules/LoneAnonymousOperationRule.mjs.map +1 -1
- package/validation/rules/MaxIntrospectionDepthRule.d.mts +6 -2
- package/validation/rules/MaxIntrospectionDepthRule.d.ts +6 -2
- package/validation/rules/MaxIntrospectionDepthRule.js.map +1 -1
- package/validation/rules/MaxIntrospectionDepthRule.mjs.map +1 -1
- package/validation/rules/NoUndefinedVariablesRule.d.mts +3 -1
- package/validation/rules/NoUndefinedVariablesRule.d.ts +3 -1
- package/validation/rules/NoUndefinedVariablesRule.js.map +1 -1
- package/validation/rules/NoUndefinedVariablesRule.mjs.map +1 -1
- package/validation/rules/NoUnusedFragmentsRule.d.mts +3 -1
- package/validation/rules/NoUnusedFragmentsRule.d.ts +3 -1
- package/validation/rules/NoUnusedFragmentsRule.js.map +1 -1
- package/validation/rules/NoUnusedFragmentsRule.mjs.map +1 -1
- package/validation/rules/NoUnusedVariablesRule.d.mts +3 -1
- package/validation/rules/NoUnusedVariablesRule.d.ts +3 -1
- package/validation/rules/NoUnusedVariablesRule.js.map +1 -1
- package/validation/rules/NoUnusedVariablesRule.mjs.map +1 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.d.mts +6 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +6 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.map +1 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs.map +1 -1
- package/validation/rules/PossibleFragmentSpreadsRule.d.mts +6 -2
- package/validation/rules/PossibleFragmentSpreadsRule.d.ts +6 -2
- package/validation/rules/PossibleFragmentSpreadsRule.js.map +1 -1
- package/validation/rules/PossibleFragmentSpreadsRule.mjs.map +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.d.mts +6 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +6 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.js.map +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs.map +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.d.mts +6 -2
- package/validation/rules/SingleFieldSubscriptionsRule.d.ts +6 -2
- package/validation/rules/SingleFieldSubscriptionsRule.js.map +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.mjs.map +1 -1
- package/validation/rules/UniqueArgumentNamesRule.d.mts +3 -1
- package/validation/rules/UniqueArgumentNamesRule.d.ts +3 -1
- package/validation/rules/UniqueArgumentNamesRule.js.map +1 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.d.mts +6 -2
- package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +6 -2
- package/validation/rules/UniqueDirectivesPerLocationRule.js.map +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs.map +1 -1
- package/validation/rules/UniqueFragmentNamesRule.d.mts +3 -1
- package/validation/rules/UniqueFragmentNamesRule.d.ts +3 -1
- package/validation/rules/UniqueFragmentNamesRule.js.map +1 -1
- package/validation/rules/UniqueFragmentNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.d.mts +6 -2
- package/validation/rules/UniqueInputFieldNamesRule.d.ts +6 -2
- package/validation/rules/UniqueInputFieldNamesRule.js.map +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueOperationNamesRule.d.mts +3 -1
- package/validation/rules/UniqueOperationNamesRule.d.ts +3 -1
- package/validation/rules/UniqueOperationNamesRule.js.map +1 -1
- package/validation/rules/UniqueOperationNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueVariableNamesRule.d.mts +3 -1
- package/validation/rules/UniqueVariableNamesRule.d.ts +3 -1
- package/validation/rules/UniqueVariableNamesRule.js.map +1 -1
- package/validation/rules/UniqueVariableNamesRule.mjs.map +1 -1
- package/validation/rules/ValuesOfCorrectTypeRule.d.mts +3 -1
- package/validation/rules/ValuesOfCorrectTypeRule.d.ts +3 -1
- package/validation/rules/ValuesOfCorrectTypeRule.js.map +1 -1
- package/validation/rules/ValuesOfCorrectTypeRule.mjs.map +1 -1
- package/validation/rules/VariablesAreInputTypesRule.d.mts +6 -2
- package/validation/rules/VariablesAreInputTypesRule.d.ts +6 -2
- package/validation/rules/VariablesAreInputTypesRule.js.map +1 -1
- package/validation/rules/VariablesAreInputTypesRule.mjs.map +1 -1
- package/validation/rules/VariablesInAllowedPositionRule.d.mts +6 -2
- package/validation/rules/VariablesInAllowedPositionRule.d.ts +6 -2
- package/validation/rules/VariablesInAllowedPositionRule.js.map +1 -1
- package/validation/rules/VariablesInAllowedPositionRule.mjs.map +1 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.d.mts +3 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +3 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.js.map +1 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs.map +1 -1
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.mts +6 -2
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +6 -2
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.map +1 -1
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs.map +1 -1
- package/validation/validate.d.mts +3 -6
- package/validation/validate.d.ts +3 -6
- package/validation/validate.js.map +1 -1
- package/validation/validate.mjs.map +1 -1
- package/version.js +3 -3
- package/version.js.map +1 -1
- package/version.mjs +3 -3
- package/version.mjs.map +1 -1
package/execution/execute.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ export type RootSelectionSetExecutor = (validatedExecutionArgs: ValidatedSubscri
|
|
|
14
14
|
* are synchronous), or a Promise of an ExecutionResult that will eventually be
|
|
15
15
|
* resolved and never rejected.
|
|
16
16
|
*
|
|
17
|
-
* If the
|
|
18
|
-
*
|
|
17
|
+
* If the schema is invalid, an error will be thrown immediately. GraphQL
|
|
18
|
+
* request errors, including missing operations and variable coercion errors,
|
|
19
|
+
* are returned in an errors-only ExecutionResult.
|
|
19
20
|
*
|
|
20
21
|
* Field errors are collected into the response instead of rejecting the
|
|
21
22
|
* returned promise. Only the field that produced the error and its descendants
|
|
@@ -62,8 +63,9 @@ export declare function execute(args: ExecutionArgs): PromiseOrValue<ExecutionRe
|
|
|
62
63
|
* ExperimentalIncrementalExecutionResults object containing an `initialResult`
|
|
63
64
|
* and a stream of `subsequentResults`.
|
|
64
65
|
*
|
|
65
|
-
* If the
|
|
66
|
-
*
|
|
66
|
+
* If the schema is invalid, an error will be thrown immediately. GraphQL
|
|
67
|
+
* request errors, including missing operations and variable coercion errors,
|
|
68
|
+
* are returned in an errors-only ExecutionResult.
|
|
67
69
|
* @param args - Execution arguments for the GraphQL operation.
|
|
68
70
|
* @returns A single execution result or incremental execution results.
|
|
69
71
|
* @example
|
|
@@ -94,17 +96,18 @@ export declare function executeIgnoringIncremental(args: ExecutionArgs): Promise
|
|
|
94
96
|
/**
|
|
95
97
|
* Implements the "Executing operations" section of the spec.
|
|
96
98
|
*
|
|
97
|
-
* Returns a
|
|
98
|
-
*
|
|
99
|
+
* Returns either a synchronous ExecutionResult, or a Promise for an
|
|
100
|
+
* ExecutionResult, described by the "Response" section of the GraphQL
|
|
101
|
+
* specification.
|
|
99
102
|
*
|
|
100
|
-
* If errors are encountered while executing a GraphQL field, only that
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
103
|
+
* If errors are encountered while executing a GraphQL field, only that field
|
|
104
|
+
* and its descendants will be omitted, and sibling fields will still be
|
|
105
|
+
* executed. These field errors are collected into the returned result instead
|
|
106
|
+
* of being thrown or rejecting the returned promise.
|
|
104
107
|
*
|
|
105
|
-
* Errors from sub-fields of a NonNull type may propagate to the top level,
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
+
* Errors from sub-fields of a NonNull type may propagate to the top level, at
|
|
109
|
+
* which point we still collect the error and null the parent field, which in
|
|
110
|
+
* this case is the entire response.
|
|
108
111
|
* @param validatedExecutionArgs - Validated execution arguments.
|
|
109
112
|
* @returns Execution result for the operation root selection set.
|
|
110
113
|
* @example
|
|
@@ -112,7 +115,10 @@ export declare function executeIgnoringIncremental(args: ExecutionArgs): Promise
|
|
|
112
115
|
* import assert from 'node:assert';
|
|
113
116
|
* import { parse } from 'graphql/language';
|
|
114
117
|
* import { buildSchema } from 'graphql/utilities';
|
|
115
|
-
* import {
|
|
118
|
+
* import {
|
|
119
|
+
* executeRootSelectionSet,
|
|
120
|
+
* validateExecutionArgs,
|
|
121
|
+
* } from 'graphql/execution';
|
|
116
122
|
*
|
|
117
123
|
* const schema = buildSchema('type Query { greeting: String }');
|
|
118
124
|
* const validatedArgs = validateExecutionArgs({
|
|
@@ -185,6 +191,9 @@ export declare function executeRootSelectionSetIgnoringIncremental(validatedExec
|
|
|
185
191
|
export declare function executeSync(args: ExecutionArgs): ExecutionResult;
|
|
186
192
|
/**
|
|
187
193
|
* Executes a subscription operation once for a single source event.
|
|
194
|
+
*
|
|
195
|
+
* Field errors are collected into the returned result instead of being thrown
|
|
196
|
+
* or rejecting the returned promise.
|
|
188
197
|
* @param validatedExecutionArgs - Validated subscription execution arguments.
|
|
189
198
|
* @returns Execution result for the subscription event.
|
|
190
199
|
* @example
|
|
@@ -192,7 +201,10 @@ export declare function executeSync(args: ExecutionArgs): ExecutionResult;
|
|
|
192
201
|
* import assert from 'node:assert';
|
|
193
202
|
* import { parse } from 'graphql/language';
|
|
194
203
|
* import { buildSchema } from 'graphql/utilities';
|
|
195
|
-
* import {
|
|
204
|
+
* import {
|
|
205
|
+
* executeSubscriptionEvent,
|
|
206
|
+
* validateSubscriptionArgs,
|
|
207
|
+
* } from 'graphql/execution';
|
|
196
208
|
*
|
|
197
209
|
* const schema = buildSchema(`
|
|
198
210
|
* type Query {
|
|
@@ -219,21 +231,22 @@ export declare function executeSubscriptionEvent(validatedExecutionArgs: Validat
|
|
|
219
231
|
/**
|
|
220
232
|
* Implements the "Subscribe" algorithm described in the GraphQL specification.
|
|
221
233
|
*
|
|
222
|
-
* Returns
|
|
223
|
-
* or
|
|
224
|
-
*
|
|
225
|
-
* is not an async iterable.
|
|
234
|
+
* Returns either an AsyncGenerator (if successful), an ExecutionResult (error),
|
|
235
|
+
* or a Promise for one of those results. The call will throw immediately if
|
|
236
|
+
* the schema is invalid or the selected operation is not a subscription.
|
|
226
237
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* errors and no data
|
|
238
|
+
* GraphQL request errors, including missing operations and variable coercion
|
|
239
|
+
* errors, return or resolve to a GraphQL Response (ExecutionResult) with
|
|
240
|
+
* descriptive errors and no data.
|
|
230
241
|
*
|
|
231
242
|
* If the source stream could not be created due to faulty subscription resolver
|
|
232
|
-
* logic
|
|
233
|
-
*
|
|
243
|
+
* logic, a non-async-iterable resolver result, or a system error, the
|
|
244
|
+
* function will return or resolve to a single ExecutionResult containing
|
|
245
|
+
* `errors` and no `data`.
|
|
234
246
|
*
|
|
235
|
-
* If the operation succeeded, the
|
|
236
|
-
* yields a stream of ExecutionResults representing the
|
|
247
|
+
* If the operation succeeded, the function returns or resolves to an
|
|
248
|
+
* AsyncGenerator, which yields a stream of ExecutionResults representing the
|
|
249
|
+
* response stream.
|
|
237
250
|
*
|
|
238
251
|
* This function does not support incremental delivery (`@defer` and `@stream`).
|
|
239
252
|
* If an operation which would defer or stream data is executed with this
|
|
@@ -335,21 +348,20 @@ export declare function subscribe(args: ExecutionArgs): PromiseOrValue<AsyncGene
|
|
|
335
348
|
* GraphQL specification, resolving the subscription source event stream for a
|
|
336
349
|
* previously validated subscription request.
|
|
337
350
|
*
|
|
338
|
-
* Returns
|
|
339
|
-
* or
|
|
340
|
-
*
|
|
341
|
-
* async iterable.
|
|
351
|
+
* Returns either an AsyncIterable (if successful), an ExecutionResult (error),
|
|
352
|
+
* or a Promise for one of those results. The call will throw immediately if
|
|
353
|
+
* it is not passed validated execution arguments.
|
|
342
354
|
*
|
|
343
|
-
* If the
|
|
344
|
-
*
|
|
345
|
-
*
|
|
355
|
+
* If the validated arguments do not result in a compliant subscription, a
|
|
356
|
+
* GraphQL Response (ExecutionResult) with descriptive errors and no data will
|
|
357
|
+
* be returned.
|
|
346
358
|
*
|
|
347
359
|
* If the source stream could not be created due to faulty subscription
|
|
348
|
-
* resolver logic or
|
|
349
|
-
* ExecutionResult containing `errors` and no `data`.
|
|
360
|
+
* resolver logic or a system error, the function will return or
|
|
361
|
+
* resolve to a single ExecutionResult containing `errors` and no `data`.
|
|
350
362
|
*
|
|
351
|
-
* If the operation succeeded, the
|
|
352
|
-
* event stream returned by the resolver.
|
|
363
|
+
* If the operation succeeded, the function returns or resolves to the
|
|
364
|
+
* AsyncIterable for the event stream returned by the resolver.
|
|
353
365
|
*
|
|
354
366
|
* A Source Event Stream represents a sequence of events, each of which triggers
|
|
355
367
|
* a GraphQL execution for that event.
|
|
@@ -365,7 +377,10 @@ export declare function subscribe(args: ExecutionArgs): PromiseOrValue<AsyncGene
|
|
|
365
377
|
* import assert from 'node:assert';
|
|
366
378
|
* import { parse } from 'graphql/language';
|
|
367
379
|
* import { buildSchema } from 'graphql/utilities';
|
|
368
|
-
* import {
|
|
380
|
+
* import {
|
|
381
|
+
* createSourceEventStream,
|
|
382
|
+
* validateSubscriptionArgs,
|
|
383
|
+
* } from 'graphql/execution';
|
|
369
384
|
*
|
|
370
385
|
* async function* greetings() {
|
|
371
386
|
* yield { greeting: 'Hello' };
|
|
@@ -394,12 +409,11 @@ export declare function subscribe(args: ExecutionArgs): PromiseOrValue<AsyncGene
|
|
|
394
409
|
*/
|
|
395
410
|
export declare function createSourceEventStream(validatedExecutionArgs: ValidatedSubscriptionArgs): PromiseOrValue<AsyncIterable<unknown> | ExecutionResult>;
|
|
396
411
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* Throws a GraphQLError if a valid execution context cannot be created.
|
|
412
|
+
* Validates the arguments passed to execute, subscribe, and their lower-level
|
|
413
|
+
* helpers.
|
|
401
414
|
*
|
|
402
|
-
*
|
|
415
|
+
* Throws if the schema is invalid. GraphQL request errors, including variable
|
|
416
|
+
* coercion errors, are returned as a GraphQLError array.
|
|
403
417
|
* @param args - Execution arguments to validate.
|
|
404
418
|
* @returns Validated execution arguments, or validation errors.
|
|
405
419
|
* @example
|
|
@@ -454,6 +468,10 @@ export declare function createSourceEventStream(validatedExecutionArgs: Validate
|
|
|
454
468
|
export declare function validateExecutionArgs(args: ExecutionArgs): ReadonlyArray<GraphQLError> | ValidatedExecutionArgs;
|
|
455
469
|
/**
|
|
456
470
|
* Validates execution arguments for a subscription operation.
|
|
471
|
+
*
|
|
472
|
+
* Throws if the schema is invalid or the selected operation is not a
|
|
473
|
+
* subscription. GraphQL request errors, including variable coercion errors, are
|
|
474
|
+
* returned as a GraphQLError array.
|
|
457
475
|
* @param args - Execution arguments to validate.
|
|
458
476
|
* @returns Validated subscription execution arguments, or validation errors.
|
|
459
477
|
* @example
|
|
@@ -514,7 +532,10 @@ export declare const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown
|
|
|
514
532
|
* import assert from 'node:assert';
|
|
515
533
|
* import { parse } from 'graphql/language';
|
|
516
534
|
* import { buildSchema } from 'graphql/utilities';
|
|
517
|
-
* import {
|
|
535
|
+
* import {
|
|
536
|
+
* mapSourceToResponseEvent,
|
|
537
|
+
* validateSubscriptionArgs,
|
|
538
|
+
* } from 'graphql/execution';
|
|
518
539
|
*
|
|
519
540
|
* async function* events() {
|
|
520
541
|
* yield { greeting: 'Hello' };
|
package/execution/execute.js
CHANGED
|
@@ -164,6 +164,7 @@ function validateExecutionArgs(args) {
|
|
|
164
164
|
let operation;
|
|
165
165
|
const fragmentDefinitions = Object.create(null);
|
|
166
166
|
const fragments = Object.create(null);
|
|
167
|
+
const fragmentVariableSignatureErrors = [];
|
|
167
168
|
for (const definition of document.definitions) {
|
|
168
169
|
switch (definition.kind) {
|
|
169
170
|
case kinds_ts_1.Kind.OPERATION_DEFINITION:
|
|
@@ -183,11 +184,16 @@ function validateExecutionArgs(args) {
|
|
|
183
184
|
fragmentDefinitions[definition.name.value] = definition;
|
|
184
185
|
let variableSignatures;
|
|
185
186
|
if (definition.variableDefinitions) {
|
|
186
|
-
|
|
187
|
+
const signatures = Object.create(null);
|
|
187
188
|
for (const varDef of definition.variableDefinitions) {
|
|
188
189
|
const signature = (0, getVariableSignature_ts_1.getVariableSignature)(schema, varDef);
|
|
189
|
-
|
|
190
|
+
if (signature instanceof GraphQLError_ts_1.GraphQLError) {
|
|
191
|
+
fragmentVariableSignatureErrors.push(signature);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
signatures[signature.name] = signature;
|
|
190
195
|
}
|
|
196
|
+
variableSignatures = signatures;
|
|
191
197
|
}
|
|
192
198
|
fragments[definition.name.value] = { definition, variableSignatures };
|
|
193
199
|
break;
|
|
@@ -201,6 +207,9 @@ function validateExecutionArgs(args) {
|
|
|
201
207
|
}
|
|
202
208
|
return [new GraphQLError_ts_1.GraphQLError('Must provide an operation.')];
|
|
203
209
|
}
|
|
210
|
+
if (fragmentVariableSignatureErrors.length > 0) {
|
|
211
|
+
return fragmentVariableSignatureErrors;
|
|
212
|
+
}
|
|
204
213
|
const variableDefinitions = operation.variableDefinitions ?? [];
|
|
205
214
|
const hideSuggestions = args.hideSuggestions ?? false;
|
|
206
215
|
const coercionInput = rawVariableValues ?? {};
|
package/execution/execute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/execution/execute.ts"],"names":[],"mappings":";;;AAgHA,0BAOC;AAiFD,4EASC;AAkBD,gEASC;AAqDD,0DAMC;AA8BD,kFAMC;AAGD,gGAIC;AAyBD,kCASC;AAkCD,4DAMC;AAmHD,8BAWC;AAgGD,0DAqBC;AA4DD,sDAkIC;AAgCD,4DASC;AAkID,4DAwBC;AA9gCD,sDAAgD;AAChD,sEAAgE;AAChE,gEAA0D;AAC1D,0DAAmE;AAEnE,gDAA0D;AAG1D,0EAAoE;AACpE,8DAAwD;AACxD,8DAAwD;AAOxD,mDAA4C;AAC5C,6DAAkF;AAElF,yDAAgF;AAKhF,+CAAqD;AAErD,wEAAkE;AAGlE,sDAM2B;AAE3B,+DAAyD;AACzD,mEAA6D;AAE7D,yDAAmD;AACnD,uFAAiF;AAOjF,+CAAyC;AACzC,yFAAmF;AACnF,uEAAiE;AAEjE,iFAA2E;AAC3E,+DAAyD;AACzD,2CAAmE;AAEnE,MAAM,kCAAkC,GACtC,yLAAyL,CAAC;AAoD5L,SAAgB,OAAO,CAAC,IAAmB;IACzC,IAAI,CAAC,IAAA,4BAAW,EAAC,+BAAc,CAAC,EAAE,CAAC;QACjC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAA,2BAAU,EAAC,+BAAc,EAAE,6BAA6B,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAC1E,WAAW,CAAC,IAAI,CAAC,CAClB,CAAC;AACJ,CAAC;AAQD,SAAS,6BAA6B,CACp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;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAA,8BAAY,EAAC,KAAK,EAAE,UAAU,EAAE,IAAA,qBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAe;IACxC,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC5B,MAAM,MAAM,CAAC;IACf,CAAC;IAGD,IAAI,CAAC,IAAA,oCAAe,EAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,8BAAY,CACpB,iDAAiD;YAC/C,aAAa,IAAA,oBAAO,EAAC,MAAM,CAAC,GAAG,CAClC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,gBAAkC;IACjD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/** @category Execution */\n\nimport { inspect } from '../jsutils/inspect.ts';\nimport { isAsyncIterable } from '../jsutils/isAsyncIterable.ts';\nimport { isObjectLike } from '../jsutils/isObjectLike.ts';\nimport { isPromise, isPromiseLike } from '../jsutils/isPromise.ts';\nimport type { ObjMap } from '../jsutils/ObjMap.ts';\nimport { addPath, pathToArray } from '../jsutils/Path.ts';\nimport type { PromiseOrValue } from '../jsutils/PromiseOrValue.ts';\n\nimport { ensureGraphQLError } from '../error/ensureGraphQLError.ts';\nimport { GraphQLError } from '../error/GraphQLError.ts';\nimport { locatedError } from '../error/locatedError.ts';\n\nimport type {\n FieldNode,\n FragmentDefinitionNode,\n OperationDefinitionNode,\n} from '../language/ast.ts';\nimport { Kind } from '../language/kinds.ts';\nimport { isSubscriptionOperationDefinitionNode } from '../language/predicates.ts';\n\nimport { GraphQLDisableErrorPropagationDirective } from '../type/directives.ts';\nimport type {\n GraphQLFieldResolver,\n GraphQLTypeResolver,\n} from '../type/index.ts';\nimport { assertValidSchema } from '../type/index.ts';\n\nimport { getOperationAST } from '../utilities/getOperationAST.ts';\n\nimport type { GraphQLExecuteContext } from '../diagnostics.ts';\nimport {\n executeChannel,\n executeVariableCoercionChannel,\n shouldTrace,\n subscribeChannel,\n traceMixed,\n} from '../diagnostics.ts';\n\nimport { buildResolveInfo } from './buildResolveInfo.ts';\nimport { cancellablePromise } from './cancellablePromise.ts';\nimport type { FieldDetailsList, FragmentDetails } from './collectFields.ts';\nimport { collectFields } from './collectFields.ts';\nimport { createSharedExecutionContext } from './createSharedExecutionContext.ts';\nimport type {\n ExecutionArgs,\n ValidatedExecutionArgs,\n ValidatedSubscriptionArgs,\n} from './ExecutionArgs.ts';\nimport type { ExecutionResult } from './Executor.ts';\nimport { Executor } from './Executor.ts';\nimport { ExecutorThrowingOnIncremental } from './ExecutorThrowingOnIncremental.ts';\nimport { getVariableSignature } from './getVariableSignature.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './incremental/IncrementalExecutor.ts';\nimport { IncrementalExecutor } from './incremental/IncrementalExecutor.ts';\nimport { mapAsyncIterable } from './mapAsyncIterable.ts';\nimport { getArgumentValues, getVariableValues } from './values.ts';\n\nconst UNEXPECTED_EXPERIMENTAL_DIRECTIVES =\n 'The provided schema unexpectedly contains experimental directives (@defer or @stream). These directives may only be utilized if experimental execution features are explicitly enabled.';\n\n/** Function used to execute a validated root selection set for a subscription event. */\nexport type RootSelectionSetExecutor = (\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n) => PromiseOrValue<ExecutionResult>;\n\n/**\n * Implements the \"Executing requests\" section of the GraphQL specification.\n *\n * Returns either a synchronous ExecutionResult (if all encountered resolvers\n * are synchronous), or a Promise of an ExecutionResult that will eventually be\n * resolved and never rejected.\n *\n * If the arguments to this function do not result in a legal execution context,\n * a GraphQLError will be thrown immediately explaining the invalid input.\n *\n * Field errors are collected into the response instead of rejecting the\n * returned promise. Only the field that produced the error and its descendants\n * are omitted; sibling fields continue to execute. Errors from fields of\n * non-null type may propagate to the nearest nullable parent, which can be the\n * entire response data.\n *\n * This function does not support incremental delivery (`@defer` and `@stream`).\n * Use `experimentalExecuteIncrementally` to execute operations with\n * incremental delivery enabled.\n * @param args - The arguments used to perform the operation.\n * @returns A completed execution result, or a promise resolving to one when execution is asynchronous.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { execute } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * greeting(name: String!): String\n * }\n * `);\n *\n * const result = await execute({\n * schema,\n * document: parse('query ($name: String!) { greeting(name: $name) }'),\n * rootValue: {\n * greeting: ({ name }) => `Hello, ${name}!`,\n * },\n * variableValues: { name: 'Ada' },\n * });\n *\n * result; // => { data: { greeting: 'Hello, Ada!' } }\n * ```\n */\nexport function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {\n if (!shouldTrace(executeChannel)) {\n return executeImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n executeImpl(args),\n );\n}\n\n/**\n * Build a graphql:execute channel context from raw ExecutionArgs. Defers\n * resolution of the operation AST to a lazy getter so the cost of walking\n * the document is only paid if a subscriber reads it.\n * @internal\n */\nfunction buildOperationContextFromArgs(\n args: ExecutionArgs,\n): Omit<GraphQLExecuteContext, 'error' | 'result'> {\n let operation: OperationDefinitionNode | null | undefined;\n const resolveOperation = (): OperationDefinitionNode | null | undefined => {\n if (operation === undefined) {\n operation = getOperationAST(args.document, args.operationName);\n }\n return operation;\n };\n return {\n schema: args.schema,\n document: args.document,\n rawVariableValues: args.variableValues,\n get operationName() {\n return args.operationName ?? resolveOperation()?.name?.value;\n },\n get operationType() {\n return resolveOperation()?.operation;\n },\n };\n}\n\nfunction executeImpl(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {\n if (args.schema.getDirective('defer') || args.schema.getDirective('stream')) {\n throw new Error(UNEXPECTED_EXPERIMENTAL_DIRECTIVES);\n }\n\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return executeRootSelectionSet(validatedExecutionArgs);\n}\n\n/**\n * Implements the \"Executing requests\" section of the GraphQL specification,\n * including `@defer` and `@stream` as proposed in\n * https://github.com/graphql/graphql-spec/pull/742\n *\n * This function returns either a single ExecutionResult, or an\n * ExperimentalIncrementalExecutionResults object containing an `initialResult`\n * and a stream of `subsequentResults`.\n *\n * If the arguments to this function do not result in a legal execution context,\n * a GraphQLError will be thrown immediately explaining the invalid input.\n * @param args - Execution arguments for the GraphQL operation.\n * @returns A single execution result or incremental execution results.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { experimentalExecuteIncrementally } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n *\n * const result = await experimentalExecuteIncrementally({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n * @category Incremental Execution\n */\nexport function experimentalExecuteIncrementally(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n if (!shouldTrace(executeChannel)) {\n return experimentalExecuteIncrementallyImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n experimentalExecuteIncrementallyImpl(args),\n );\n}\n\nfunction experimentalExecuteIncrementallyImpl(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n // If a valid execution context cannot be created due to incorrect arguments,\n // a \"Response\" with only errors is returned.\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return experimentalExecuteRootSelectionSet(validatedExecutionArgs);\n}\n\n/** @internal */\nexport function executeIgnoringIncremental(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n if (!shouldTrace(executeChannel)) {\n return executeIgnoringIncrementalImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n executeIgnoringIncrementalImpl(args),\n );\n}\n\nfunction executeIgnoringIncrementalImpl(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n // If a valid execution context cannot be created due to incorrect arguments,\n // a \"Response\" with only errors is returned.\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return executeRootSelectionSetIgnoringIncremental(validatedExecutionArgs);\n}\n\n/**\n * Implements the \"Executing operations\" section of the spec.\n *\n * Returns a Promise that will eventually resolve to the data described by\n * The \"Response\" section of the GraphQL specification.\n *\n * If errors are encountered while executing a GraphQL field, only that\n * field and its descendants will be omitted, and sibling fields will still\n * be executed. An execution which encounters errors will still result in a\n * resolved Promise.\n *\n * Errors from sub-fields of a NonNull type may propagate to the top level,\n * at which point we still log the error and null the parent field, which\n * in this case is the entire response.\n * @param validatedExecutionArgs - Validated execution arguments.\n * @returns Execution result for the operation root selection set.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { executeRootSelectionSet, validateExecutionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await executeRootSelectionSet(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeRootSelectionSet(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult> {\n return new ExecutorThrowingOnIncremental(\n validatedExecutionArgs,\n ).executeRootSelectionSet();\n}\n\n/**\n * Executes the operation root selection set with incremental delivery enabled.\n * @param validatedExecutionArgs - Validated execution arguments.\n * @returns A single execution result or incremental execution results.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * experimentalExecuteRootSelectionSet,\n * validateExecutionArgs,\n * } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await experimentalExecuteRootSelectionSet(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n * @category Incremental Execution\n */\nexport function experimentalExecuteRootSelectionSet(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n return new IncrementalExecutor(\n validatedExecutionArgs,\n ).executeRootSelectionSet();\n}\n\n/** @internal */\nexport function executeRootSelectionSetIgnoringIncremental(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n return new Executor(validatedExecutionArgs).executeRootSelectionSet();\n}\n\n/**\n * Also implements the \"Executing requests\" section of the GraphQL specification.\n * However, it guarantees to complete synchronously (or throw an error) assuming\n * that all field resolvers are also synchronous.\n * @param args - The arguments used to perform the operation.\n * @returns Completed execution output for a synchronous operation.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { executeSync } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n *\n * const result = executeSync({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeSync(args: ExecutionArgs): ExecutionResult {\n const result = experimentalExecuteIncrementally(args);\n\n // Assert that the execution was synchronous.\n if (isPromise(result) || 'initialResult' in result) {\n throw new Error('GraphQL execution failed to complete synchronously.');\n }\n\n return result;\n}\n\n/**\n * Executes a subscription operation once for a single source event.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @returns Execution result for the subscription event.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { executeSubscriptionEvent, validateSubscriptionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await executeSubscriptionEvent(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeSubscriptionEvent(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n): PromiseOrValue<ExecutionResult> {\n return new ExecutorThrowingOnIncremental(\n validatedExecutionArgs,\n ).executeRootSelectionSet(false);\n}\n\n/**\n * Implements the \"Subscribe\" algorithm described in the GraphQL specification.\n *\n * Returns a Promise that resolves to either an AsyncIterator (if successful)\n * or an ExecutionResult (error). The promise will be rejected if the schema or\n * other arguments to this function are invalid, or if the resolved event stream\n * is not an async iterable.\n *\n * If the client-provided arguments to this function do not result in a\n * compliant subscription, a GraphQL Response (ExecutionResult) with descriptive\n * errors and no data will be returned.\n *\n * If the source stream could not be created due to faulty subscription resolver\n * logic or underlying systems, the promise will resolve to a single\n * ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the promise resolves to an AsyncIterator, which\n * yields a stream of ExecutionResults representing the response stream.\n *\n * This function does not support incremental delivery (`@defer` and `@stream`).\n * If an operation which would defer or stream data is executed with this\n * function, a field error will be raised at the location of the `@defer` or\n * `@stream` directive.\n *\n * Accepts an object with named arguments.\n * @param args - Execution arguments for the subscription operation.\n * @returns A response stream for a valid subscription, or an execution result containing errors.\n * @example\n * ```ts\n * // Use a same-named rootValue function to provide the source event stream.\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { subscribe } from 'graphql/execution';\n *\n * async function* greetings() {\n * yield { greeting: 'Hello' };\n * yield { greeting: 'Bonjour' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n *\n * const result = await subscribe({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: () => greetings() },\n * });\n *\n * assert('next' in result);\n *\n * const firstPayload = await result.next();\n * firstPayload.value; // => { data: { greeting: 'Hello' } }\n * ```\n * @example\n * ```ts\n * // This variant supplies events through a custom subscribeFieldResolver.\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { subscribe } from 'graphql/execution';\n *\n * async function* defaultGreetings() {\n * yield { greeting: 'Hello' };\n * }\n *\n * async function* frenchGreetings() {\n * yield { greeting: 'Bonjour' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting(locale: String): String\n * }\n * `);\n *\n * const result = await subscribe({\n * schema,\n * document: parse(\n * 'subscription Greeting($locale: String) { greeting(locale: $locale) }',\n * ),\n * rootValue: {\n * greeting: (args, contextValue) => {\n * const locale = args.locale ?? contextValue.defaultLocale;\n * return locale === 'fr' ? frenchGreetings() : defaultGreetings();\n * },\n * },\n * contextValue: { defaultLocale: 'fr' },\n * variableValues: { locale: 'fr' },\n * operationName: 'Greeting',\n * subscribeFieldResolver: (rootValue, args, contextValue, info) => {\n * args.locale; // => 'fr'\n * return rootValue[info.fieldName](args, contextValue);\n * },\n * });\n *\n * assert('next' in result);\n *\n * const firstPayload = await result.next();\n * firstPayload.value; // => { data: { greeting: 'Bonjour' } }\n * ```\n */\nexport function subscribe(\n args: ExecutionArgs,\n): PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n> {\n if (!shouldTrace(subscribeChannel)) {\n return subscribeImpl(args);\n }\n return traceMixed(subscribeChannel, buildOperationContextFromArgs(args), () =>\n subscribeImpl(args),\n );\n}\n\nfunction subscribeImpl(\n args: ExecutionArgs,\n): PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n> {\n // If a valid execution context cannot be created due to incorrect arguments,\n // a \"Response\" with only errors is returned.\n const validatedExecutionArgs = validateSubscriptionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n const resultOrStream = createSourceEventStream(validatedExecutionArgs);\n\n if (isPromise(resultOrStream)) {\n return resultOrStream.then((resolvedResultOrStream) =>\n isAsyncIterable(resolvedResultOrStream)\n ? mapSourceToResponseEvent(\n validatedExecutionArgs,\n resolvedResultOrStream,\n )\n : resolvedResultOrStream,\n );\n }\n\n return isAsyncIterable(resultOrStream)\n ? mapSourceToResponseEvent(validatedExecutionArgs, resultOrStream)\n : resultOrStream;\n}\n\n/**\n * Implements the \"CreateSourceEventStream\" algorithm described in the\n * GraphQL specification, resolving the subscription source event stream for a\n * previously validated subscription request.\n *\n * Returns a Promise that resolves to either an AsyncIterable (if successful)\n * or an ExecutionResult (error). The promise will be rejected if the validated\n * execution arguments are invalid, or if the resolved event stream is not an\n * async iterable.\n *\n * If the client-provided arguments to this function do not result in a\n * compliant subscription, a GraphQL Response (ExecutionResult) with\n * descriptive errors and no data will be returned.\n *\n * If the source stream could not be created due to faulty subscription\n * resolver logic or underlying systems, the promise will resolve to a single\n * ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the promise resolves to the AsyncIterable for the\n * event stream returned by the resolver.\n *\n * A Source Event Stream represents a sequence of events, each of which triggers\n * a GraphQL execution for that event.\n *\n * This may be useful when hosting the stateful subscription service in a\n * different process or machine than the stateless GraphQL execution engine,\n * or otherwise separating these two steps. For more on this, see the\n * \"Supporting Subscriptions at Scale\" information in the GraphQL specification.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @returns A source event stream, or an execution result containing errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { createSourceEventStream, validateSubscriptionArgs } from 'graphql/execution';\n *\n * async function* greetings() {\n * yield { greeting: 'Hello' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: () => greetings() },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const stream = await createSourceEventStream(validatedArgs);\n * Symbol.asyncIterator in stream; // => true\n * ```\n */\nexport function createSourceEventStream(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n): PromiseOrValue<AsyncIterable<unknown> | ExecutionResult> {\n if (!('operation' in validatedExecutionArgs)) {\n throw new GraphQLError(\n 'Passing ExecutionArgs to createSourceEventStream() was removed in graphql-js@17.0.0; call validateSubscriptionArgs() first and pass the result instead, or use subscribe() for the full subscription pipeline.',\n );\n }\n\n try {\n const eventStream = executeSubscription(validatedExecutionArgs);\n if (isPromise(eventStream)) {\n return eventStream.then(undefined, (error: unknown) => ({\n errors: [ensureGraphQLError(error)],\n }));\n }\n\n return eventStream;\n } catch (error) {\n return { errors: [ensureGraphQLError(error)] };\n }\n}\n\n/**\n * Constructs a ExecutionContext object from the arguments passed to\n * execute, which we will pass throughout the other execution methods.\n *\n * Throws a GraphQLError if a valid execution context cannot be created.\n *\n * TODO: consider no longer exporting this function\n * @param args - Execution arguments to validate.\n * @returns Validated execution arguments, or validation errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { validateExecutionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * interface Named {\n * name: String!\n * }\n *\n * type User implements Named {\n * name: String!\n * }\n *\n * type Query {\n * viewer: Named\n * }\n * `);\n * const abortController = new AbortController();\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('query Viewer { viewer { __typename name } }'),\n * rootValue: { viewer: { kind: 'user', name: 'Ada' } },\n * contextValue: { locale: 'en' },\n * operationName: 'Viewer',\n * fieldResolver: (source, _args, contextValue, info) => {\n * contextValue.locale; // => 'en'\n * return source[info.fieldName];\n * },\n * typeResolver: (value) => {\n * return value.kind === 'user' ? 'User' : undefined;\n * },\n * hideSuggestions: true,\n * abortSignal: abortController.signal,\n * enableEarlyExecution: true,\n * hooks: {\n * asyncWorkFinished: () => {},\n * },\n * options: { maxCoercionErrors: 1 },\n * });\n *\n * assert('operation' in validatedArgs);\n *\n * validatedArgs.operation.name?.value; // => 'Viewer'\n * validatedArgs.hideSuggestions; // => true\n * ```\n */\nexport function validateExecutionArgs(\n args: ExecutionArgs,\n): ReadonlyArray<GraphQLError> | ValidatedExecutionArgs {\n const {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues: rawVariableValues,\n operationName,\n fieldResolver,\n typeResolver,\n subscribeFieldResolver,\n abortSignal: externalAbortSignal,\n enableEarlyExecution,\n hooks,\n options,\n } = args;\n\n // If the schema used for execution is invalid, throw an error.\n assertValidSchema(schema);\n\n let operation: OperationDefinitionNode | undefined;\n const fragmentDefinitions: ObjMap<FragmentDefinitionNode> =\n Object.create(null);\n const fragments: ObjMap<FragmentDetails> = Object.create(null);\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n return [\n new GraphQLError(\n 'Must provide operation name if query contains multiple operations.',\n ),\n ];\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n case Kind.FRAGMENT_DEFINITION: {\n fragmentDefinitions[definition.name.value] = definition;\n let variableSignatures;\n if (definition.variableDefinitions) {\n variableSignatures = Object.create(null);\n for (const varDef of definition.variableDefinitions) {\n const signature = getVariableSignature(schema, varDef);\n variableSignatures[signature.name] = signature;\n }\n }\n fragments[definition.name.value] = { definition, variableSignatures };\n break;\n }\n default:\n // ignore non-executable definitions\n }\n }\n\n if (!operation) {\n if (operationName != null) {\n return [new GraphQLError(`Unknown operation named \"${operationName}\".`)];\n }\n return [new GraphQLError('Must provide an operation.')];\n }\n\n const variableDefinitions = operation.variableDefinitions ?? [];\n const hideSuggestions = args.hideSuggestions ?? false;\n\n const coercionInput = rawVariableValues ?? {};\n const coercionOptions = {\n maxErrors: options?.maxCoercionErrors ?? 50,\n hideSuggestions,\n };\n const coercionChannel = executeVariableCoercionChannel;\n const variableValuesOrErrors = shouldTrace(coercionChannel)\n ? traceMixed(\n coercionChannel,\n {\n schema,\n document,\n operation,\n rawVariableValues,\n operationName: operation.name?.value,\n operationType: operation.operation,\n },\n () =>\n getVariableValues(\n schema,\n variableDefinitions,\n coercionInput,\n coercionOptions,\n ),\n )\n : getVariableValues(\n schema,\n variableDefinitions,\n coercionInput,\n coercionOptions,\n );\n\n if (variableValuesOrErrors.errors) {\n return variableValuesOrErrors.errors;\n }\n\n const errorPropagation = !operation.directives?.find(\n (directive) =>\n directive.name.value === GraphQLDisableErrorPropagationDirective.name,\n );\n\n return {\n schema,\n document,\n fragmentDefinitions,\n fragments,\n rootValue,\n contextValue,\n operation,\n variableValues: variableValuesOrErrors.variableValues,\n fieldResolver: fieldResolver ?? defaultFieldResolver,\n typeResolver: typeResolver ?? defaultTypeResolver,\n subscribeFieldResolver: subscribeFieldResolver ?? defaultFieldResolver,\n hideSuggestions,\n errorPropagation,\n externalAbortSignal: externalAbortSignal ?? undefined,\n enableEarlyExecution: enableEarlyExecution === true,\n hooks: hooks ?? undefined,\n rawVariableValues,\n };\n}\n\n/**\n * Validates execution arguments for a subscription operation.\n * @param args - Execution arguments to validate.\n * @returns Validated subscription execution arguments, or validation errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { validateSubscriptionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * });\n *\n * assert('operation' in validatedArgs);\n *\n * validatedArgs.operation.operation; // => 'subscription'\n * ```\n */\nexport function validateSubscriptionArgs(\n args: ExecutionArgs,\n): ReadonlyArray<GraphQLError> | ValidatedSubscriptionArgs {\n const validatedExecutionArgs = validateExecutionArgs(args);\n if (!('schema' in validatedExecutionArgs)) {\n return validatedExecutionArgs;\n }\n assertSubscriptionExecutionArgs(validatedExecutionArgs);\n return validatedExecutionArgs;\n}\n\nfunction assertSubscriptionExecutionArgs(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): asserts validatedExecutionArgs is ValidatedSubscriptionArgs {\n if (\n !isSubscriptionOperationDefinitionNode(validatedExecutionArgs.operation)\n ) {\n throw new GraphQLError('Expected subscription operation.');\n }\n}\n\n/**\n * If a resolveType function is not given, then a default resolve behavior is\n * used which attempts two strategies:\n *\n * First, See if the provided value has a `__typename` field defined, if so, use\n * that value as name of the resolved type.\n *\n * Otherwise, test each possible type for the abstract type by calling\n * isTypeOf for the object being coerced, returning the first type that matches.\n */\nexport const defaultTypeResolver: GraphQLTypeResolver<unknown, unknown> =\n function (value, contextValue, info, abstractType) {\n // First, look for `__typename`.\n if (isObjectLike(value) && typeof value.__typename === 'string') {\n return value.__typename;\n }\n\n // Otherwise, test each possible type.\n const possibleTypes = info.schema.getPossibleTypes(abstractType);\n const promisedIsTypeOfResults: Array<PromiseLike<boolean>> = [];\n\n try {\n for (let i = 0; i < possibleTypes.length; i++) {\n const type = possibleTypes[i];\n\n if (type.isTypeOf) {\n const isTypeOfResult = type.isTypeOf(value, contextValue, info);\n\n if (isPromiseLike(isTypeOfResult)) {\n promisedIsTypeOfResults[i] = isTypeOfResult;\n } else if (isTypeOfResult) {\n if (promisedIsTypeOfResults.length) {\n info.getAsyncHelpers().track(promisedIsTypeOfResults);\n }\n return type.name;\n }\n }\n }\n } catch (error) {\n if (promisedIsTypeOfResults.length) {\n info.getAsyncHelpers().track(promisedIsTypeOfResults);\n }\n throw error;\n }\n\n if (promisedIsTypeOfResults.length) {\n return info\n .getAsyncHelpers()\n .promiseAll(promisedIsTypeOfResults)\n .then((isTypeOfResults) => {\n for (let i = 0; i < isTypeOfResults.length; i++) {\n if (isTypeOfResults[i]) {\n return possibleTypes[i].name;\n }\n }\n });\n }\n };\n\n/**\n * If a resolve function is not given, then a default resolve behavior is used\n * which takes the property of the source object of the same name as the field\n * and returns it as the result, or if it's a function, returns the result\n * of calling that function while passing along args and context value.\n */\nexport const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown> =\n function (source: any, args, contextValue, info) {\n // ensure source is a value for which property access is acceptable.\n if (isObjectLike(source) || typeof source === 'function') {\n const property = source[info.fieldName];\n if (typeof property === 'function') {\n return source[info.fieldName](args, contextValue, info);\n }\n return property;\n }\n };\n\n/**\n * Implements the \"MapSourceToResponseEvent\" algorithm described in the\n * GraphQL specification, mapping each event from a subscription source event\n * stream to an ExecutionResult in the response stream.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @param sourceEventStream - Source event stream returned by the subscription resolver.\n * @param rootSelectionSetExecutor - Function used to execute each source event.\n * @returns A response stream of execution results.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { mapSourceToResponseEvent, validateSubscriptionArgs } from 'graphql/execution';\n *\n * async function* events() {\n * yield { greeting: 'Hello' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const responseStream = mapSourceToResponseEvent(validatedArgs, events());\n * const firstPayload = await responseStream.next();\n *\n * firstPayload.value; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function mapSourceToResponseEvent(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n sourceEventStream: AsyncIterable<unknown>,\n rootSelectionSetExecutor: RootSelectionSetExecutor = executeSubscriptionEvent,\n): AsyncGenerator<ExecutionResult, void, void> {\n // For each payload yielded from a subscription, map it over the normal\n // GraphQL `execute` function, with `payload` as the rootValue.\n function mapFn(payload: unknown): PromiseOrValue<ExecutionResult> {\n const perEventExecutionArgs: ValidatedSubscriptionArgs = {\n ...validatedExecutionArgs,\n rootValue: payload,\n };\n return rootSelectionSetExecutor(perEventExecutionArgs);\n }\n\n const externalAbortSignal = validatedExecutionArgs.externalAbortSignal;\n if (externalAbortSignal) {\n const generator = mapAsyncIterable(sourceEventStream, mapFn);\n return {\n ...generator,\n next: () => cancellablePromise(generator.next(), externalAbortSignal),\n };\n }\n return mapAsyncIterable(sourceEventStream, mapFn);\n}\n\nfunction executeSubscription(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<AsyncIterable<unknown>> {\n const {\n schema,\n fragments,\n rootValue,\n contextValue,\n operation,\n variableValues,\n hideSuggestions,\n externalAbortSignal,\n } = validatedExecutionArgs;\n\n const rootType = schema.getSubscriptionType();\n if (rootType == null) {\n throw new GraphQLError(\n 'Schema is not configured to execute subscription operation.',\n { nodes: operation },\n );\n }\n\n const { groupedFieldSet } = collectFields(\n schema,\n fragments,\n variableValues,\n rootType,\n operation.selectionSet,\n hideSuggestions,\n );\n\n const firstRootField = groupedFieldSet.entries().next().value as [\n string,\n FieldDetailsList,\n ];\n const [responseName, fieldDetailsList] = firstRootField;\n const firstFieldDetails = fieldDetailsList[0];\n const firstNode = firstFieldDetails.node;\n const fieldName = firstNode.name.value;\n const fieldDef = schema.getField(rootType, fieldName);\n\n const fieldNodes = fieldDetailsList.map((fieldDetails) => fieldDetails.node);\n if (!fieldDef) {\n throw new GraphQLError(\n `The subscription field \"${fieldName}\" is not defined.`,\n { nodes: fieldNodes },\n );\n }\n\n const sharedExecutionContext =\n createSharedExecutionContext(externalAbortSignal);\n const path = addPath(undefined, responseName, rootType.name);\n const info = buildResolveInfo(\n validatedExecutionArgs,\n fieldDef,\n fieldNodes,\n rootType,\n path,\n sharedExecutionContext.getAbortSignal,\n sharedExecutionContext.getAsyncHelpers,\n );\n\n try {\n // Implements the \"ResolveFieldEventStream\" algorithm from GraphQL specification.\n // It differs from \"ResolveFieldValue\" due to providing a different `resolveFn`.\n\n // Build a JS object of arguments from the field.arguments AST, using the\n // variables scope to fulfill any variable references.\n const args = getArgumentValues(\n fieldDef,\n firstNode,\n variableValues,\n firstFieldDetails.fragmentVariableValues,\n hideSuggestions,\n );\n\n // Call the `subscribe()` resolver or the default resolver to produce an\n // AsyncIterable yielding raw payloads.\n const resolveFn =\n fieldDef.subscribe ?? validatedExecutionArgs.subscribeFieldResolver;\n\n // The resolve function's optional third argument is a context value that\n // is provided to every resolve function within an execution. It is commonly\n // used to represent an authenticated user, or request-specific caches.\n const result = resolveFn(rootValue, args, contextValue, info);\n\n if (isPromiseLike(result)) {\n const promisedResult = Promise.resolve(result);\n const promise = externalAbortSignal\n ? cancellablePromise(promisedResult, externalAbortSignal)\n : promisedResult;\n return promise\n .then(assertEventStream)\n .then(undefined, (error: unknown) => {\n throw locatedError(\n error,\n toNodes(fieldDetailsList),\n pathToArray(path),\n );\n });\n }\n return assertEventStream(result);\n } catch (error) {\n throw locatedError(error, fieldNodes, pathToArray(path));\n }\n}\n\nfunction assertEventStream(result: unknown): AsyncIterable<unknown> {\n if (result instanceof Error) {\n throw result;\n }\n\n // Assert field returned an event stream, otherwise yield an error.\n if (!isAsyncIterable(result)) {\n throw new GraphQLError(\n 'Subscription field must return Async Iterable. ' +\n `Received: ${inspect(result)}.`,\n );\n }\n\n return result;\n}\n\nfunction toNodes(fieldDetailsList: FieldDetailsList): ReadonlyArray<FieldNode> {\n return fieldDetailsList.map((fieldDetails) => fieldDetails.node);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/execution/execute.ts"],"names":[],"mappings":";;;AAkHA,0BAOC;AAkFD,4EASC;AAkBD,gEASC;AAyDD,0DAMC;AA8BD,kFAMC;AAGD,gGAIC;AAyBD,kCASC;AAwCD,4DAMC;AAoHD,8BAWC;AAkGD,0DAqBC;AA2DD,sDA6IC;AAoCD,4DASC;AAqID,4DAwBC;AA/iCD,sDAAgD;AAChD,sEAAgE;AAChE,gEAA0D;AAC1D,0DAAmE;AAEnE,gDAA0D;AAG1D,0EAAoE;AACpE,8DAAwD;AACxD,8DAAwD;AAOxD,mDAA4C;AAC5C,6DAAkF;AAElF,yDAAgF;AAKhF,+CAAqD;AAErD,wEAAkE;AAGlE,sDAM2B;AAE3B,+DAAyD;AACzD,mEAA6D;AAE7D,yDAAmD;AACnD,uFAAiF;AAOjF,+CAAyC;AACzC,yFAAmF;AAEnF,uEAAiE;AAEjE,iFAA2E;AAC3E,+DAAyD;AACzD,2CAAmE;AAEnE,MAAM,kCAAkC,GACtC,yLAAyL,CAAC;AAqD5L,SAAgB,OAAO,CAAC,IAAmB;IACzC,IAAI,CAAC,IAAA,4BAAW,EAAC,+BAAc,CAAC,EAAE,CAAC;QACjC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAA,2BAAU,EAAC,+BAAc,EAAE,6BAA6B,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAC1E,WAAW,CAAC,IAAI,CAAC,CAClB,CAAC;AACJ,CAAC;AAQD,SAAS,6BAA6B,CACpC,IAAmB;IAEnB,IAAI,SAAqD,CAAC;IAC1D,MAAM,gBAAgB,GAAG,GAA+C,EAAE;QACxE,IAAI,SAAS,KAAK,SAAS,EA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A,8BAAY,EAChB,KAAK,EACL,OAAO,CAAC,gBAAgB,CAAC,EACzB,IAAA,qBAAW,EAAC,IAAI,CAAC,CAClB,CAAC;YACJ,CAAC,CAAC,CAAC;QACP,CAAC;QACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAA,8BAAY,EAAC,KAAK,EAAE,UAAU,EAAE,IAAA,qBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAe;IACxC,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC5B,MAAM,MAAM,CAAC;IACf,CAAC;IAGD,IAAI,CAAC,IAAA,oCAAe,EAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,8BAAY,CACpB,iDAAiD;YAC/C,aAAa,IAAA,oBAAO,EAAC,MAAM,CAAC,GAAG,CAClC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,gBAAkC;IACjD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/** @category Execution */\n\nimport { inspect } from '../jsutils/inspect.ts';\nimport { isAsyncIterable } from '../jsutils/isAsyncIterable.ts';\nimport { isObjectLike } from '../jsutils/isObjectLike.ts';\nimport { isPromise, isPromiseLike } from '../jsutils/isPromise.ts';\nimport type { ObjMap } from '../jsutils/ObjMap.ts';\nimport { addPath, pathToArray } from '../jsutils/Path.ts';\nimport type { PromiseOrValue } from '../jsutils/PromiseOrValue.ts';\n\nimport { ensureGraphQLError } from '../error/ensureGraphQLError.ts';\nimport { GraphQLError } from '../error/GraphQLError.ts';\nimport { locatedError } from '../error/locatedError.ts';\n\nimport type {\n FieldNode,\n FragmentDefinitionNode,\n OperationDefinitionNode,\n} from '../language/ast.ts';\nimport { Kind } from '../language/kinds.ts';\nimport { isSubscriptionOperationDefinitionNode } from '../language/predicates.ts';\n\nimport { GraphQLDisableErrorPropagationDirective } from '../type/directives.ts';\nimport type {\n GraphQLFieldResolver,\n GraphQLTypeResolver,\n} from '../type/index.ts';\nimport { assertValidSchema } from '../type/index.ts';\n\nimport { getOperationAST } from '../utilities/getOperationAST.ts';\n\nimport type { GraphQLExecuteContext } from '../diagnostics.ts';\nimport {\n executeChannel,\n executeVariableCoercionChannel,\n shouldTrace,\n subscribeChannel,\n traceMixed,\n} from '../diagnostics.ts';\n\nimport { buildResolveInfo } from './buildResolveInfo.ts';\nimport { cancellablePromise } from './cancellablePromise.ts';\nimport type { FieldDetailsList, FragmentDetails } from './collectFields.ts';\nimport { collectFields } from './collectFields.ts';\nimport { createSharedExecutionContext } from './createSharedExecutionContext.ts';\nimport type {\n ExecutionArgs,\n ValidatedExecutionArgs,\n ValidatedSubscriptionArgs,\n} from './ExecutionArgs.ts';\nimport type { ExecutionResult } from './Executor.ts';\nimport { Executor } from './Executor.ts';\nimport { ExecutorThrowingOnIncremental } from './ExecutorThrowingOnIncremental.ts';\nimport type { GraphQLVariableSignature } from './getVariableSignature.ts';\nimport { getVariableSignature } from './getVariableSignature.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './incremental/IncrementalExecutor.ts';\nimport { IncrementalExecutor } from './incremental/IncrementalExecutor.ts';\nimport { mapAsyncIterable } from './mapAsyncIterable.ts';\nimport { getArgumentValues, getVariableValues } from './values.ts';\n\nconst UNEXPECTED_EXPERIMENTAL_DIRECTIVES =\n 'The provided schema unexpectedly contains experimental directives (@defer or @stream). These directives may only be utilized if experimental execution features are explicitly enabled.';\n\n/** Function used to execute a validated root selection set for a subscription event. */\nexport type RootSelectionSetExecutor = (\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n) => PromiseOrValue<ExecutionResult>;\n\n/**\n * Implements the \"Executing requests\" section of the GraphQL specification.\n *\n * Returns either a synchronous ExecutionResult (if all encountered resolvers\n * are synchronous), or a Promise of an ExecutionResult that will eventually be\n * resolved and never rejected.\n *\n * If the schema is invalid, an error will be thrown immediately. GraphQL\n * request errors, including missing operations and variable coercion errors,\n * are returned in an errors-only ExecutionResult.\n *\n * Field errors are collected into the response instead of rejecting the\n * returned promise. Only the field that produced the error and its descendants\n * are omitted; sibling fields continue to execute. Errors from fields of\n * non-null type may propagate to the nearest nullable parent, which can be the\n * entire response data.\n *\n * This function does not support incremental delivery (`@defer` and `@stream`).\n * Use `experimentalExecuteIncrementally` to execute operations with\n * incremental delivery enabled.\n * @param args - The arguments used to perform the operation.\n * @returns A completed execution result, or a promise resolving to one when execution is asynchronous.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { execute } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * greeting(name: String!): String\n * }\n * `);\n *\n * const result = await execute({\n * schema,\n * document: parse('query ($name: String!) { greeting(name: $name) }'),\n * rootValue: {\n * greeting: ({ name }) => `Hello, ${name}!`,\n * },\n * variableValues: { name: 'Ada' },\n * });\n *\n * result; // => { data: { greeting: 'Hello, Ada!' } }\n * ```\n */\nexport function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {\n if (!shouldTrace(executeChannel)) {\n return executeImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n executeImpl(args),\n );\n}\n\n/**\n * Build a graphql:execute channel context from raw ExecutionArgs. Defers\n * resolution of the operation AST to a lazy getter so the cost of walking\n * the document is only paid if a subscriber reads it.\n * @internal\n */\nfunction buildOperationContextFromArgs(\n args: ExecutionArgs,\n): Omit<GraphQLExecuteContext, 'error' | 'result'> {\n let operation: OperationDefinitionNode | null | undefined;\n const resolveOperation = (): OperationDefinitionNode | null | undefined => {\n if (operation === undefined) {\n operation = getOperationAST(args.document, args.operationName);\n }\n return operation;\n };\n return {\n schema: args.schema,\n document: args.document,\n rawVariableValues: args.variableValues,\n get operationName() {\n return args.operationName ?? resolveOperation()?.name?.value;\n },\n get operationType() {\n return resolveOperation()?.operation;\n },\n };\n}\n\nfunction executeImpl(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {\n if (args.schema.getDirective('defer') || args.schema.getDirective('stream')) {\n throw new Error(UNEXPECTED_EXPERIMENTAL_DIRECTIVES);\n }\n\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return executeRootSelectionSet(validatedExecutionArgs);\n}\n\n/**\n * Implements the \"Executing requests\" section of the GraphQL specification,\n * including `@defer` and `@stream` as proposed in\n * https://github.com/graphql/graphql-spec/pull/742\n *\n * This function returns either a single ExecutionResult, or an\n * ExperimentalIncrementalExecutionResults object containing an `initialResult`\n * and a stream of `subsequentResults`.\n *\n * If the schema is invalid, an error will be thrown immediately. GraphQL\n * request errors, including missing operations and variable coercion errors,\n * are returned in an errors-only ExecutionResult.\n * @param args - Execution arguments for the GraphQL operation.\n * @returns A single execution result or incremental execution results.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { experimentalExecuteIncrementally } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n *\n * const result = await experimentalExecuteIncrementally({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n * @category Incremental Execution\n */\nexport function experimentalExecuteIncrementally(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n if (!shouldTrace(executeChannel)) {\n return experimentalExecuteIncrementallyImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n experimentalExecuteIncrementallyImpl(args),\n );\n}\n\nfunction experimentalExecuteIncrementallyImpl(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n // If the request cannot produce valid execution arguments, return a\n // \"Response\" with only errors.\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return experimentalExecuteRootSelectionSet(validatedExecutionArgs);\n}\n\n/** @internal */\nexport function executeIgnoringIncremental(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n if (!shouldTrace(executeChannel)) {\n return executeIgnoringIncrementalImpl(args);\n }\n return traceMixed(executeChannel, buildOperationContextFromArgs(args), () =>\n executeIgnoringIncrementalImpl(args),\n );\n}\n\nfunction executeIgnoringIncrementalImpl(\n args: ExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n // If the request cannot produce valid execution arguments, return a\n // \"Response\" with only errors.\n const validatedExecutionArgs = validateExecutionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n return executeRootSelectionSetIgnoringIncremental(validatedExecutionArgs);\n}\n\n/**\n * Implements the \"Executing operations\" section of the spec.\n *\n * Returns either a synchronous ExecutionResult, or a Promise for an\n * ExecutionResult, described by the \"Response\" section of the GraphQL\n * specification.\n *\n * If errors are encountered while executing a GraphQL field, only that field\n * and its descendants will be omitted, and sibling fields will still be\n * executed. These field errors are collected into the returned result instead\n * of being thrown or rejecting the returned promise.\n *\n * Errors from sub-fields of a NonNull type may propagate to the top level, at\n * which point we still collect the error and null the parent field, which in\n * this case is the entire response.\n * @param validatedExecutionArgs - Validated execution arguments.\n * @returns Execution result for the operation root selection set.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * executeRootSelectionSet,\n * validateExecutionArgs,\n * } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await executeRootSelectionSet(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeRootSelectionSet(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult> {\n return new ExecutorThrowingOnIncremental(\n validatedExecutionArgs,\n ).executeRootSelectionSet();\n}\n\n/**\n * Executes the operation root selection set with incremental delivery enabled.\n * @param validatedExecutionArgs - Validated execution arguments.\n * @returns A single execution result or incremental execution results.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * experimentalExecuteRootSelectionSet,\n * validateExecutionArgs,\n * } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await experimentalExecuteRootSelectionSet(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n * @category Incremental Execution\n */\nexport function experimentalExecuteRootSelectionSet(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n return new IncrementalExecutor(\n validatedExecutionArgs,\n ).executeRootSelectionSet();\n}\n\n/** @internal */\nexport function executeRootSelectionSetIgnoringIncremental(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<ExecutionResult | ExperimentalIncrementalExecutionResults> {\n return new Executor(validatedExecutionArgs).executeRootSelectionSet();\n}\n\n/**\n * Also implements the \"Executing requests\" section of the GraphQL specification.\n * However, it guarantees to complete synchronously (or throw an error) assuming\n * that all field resolvers are also synchronous.\n * @param args - The arguments used to perform the operation.\n * @returns Completed execution output for a synchronous operation.\n * @example\n * ```ts\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { executeSync } from 'graphql/execution';\n *\n * const schema = buildSchema('type Query { greeting: String }');\n *\n * const result = executeSync({\n * schema,\n * document: parse('{ greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeSync(args: ExecutionArgs): ExecutionResult {\n const result = experimentalExecuteIncrementally(args);\n\n // Assert that the execution was synchronous.\n if (isPromise(result) || 'initialResult' in result) {\n throw new Error('GraphQL execution failed to complete synchronously.');\n }\n\n return result;\n}\n\n/**\n * Executes a subscription operation once for a single source event.\n *\n * Field errors are collected into the returned result instead of being thrown\n * or rejecting the returned promise.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @returns Execution result for the subscription event.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * executeSubscriptionEvent,\n * validateSubscriptionArgs,\n * } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: 'Hello' },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const result = await executeSubscriptionEvent(validatedArgs);\n * result; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function executeSubscriptionEvent(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n): PromiseOrValue<ExecutionResult> {\n return new ExecutorThrowingOnIncremental(\n validatedExecutionArgs,\n ).executeRootSelectionSet(false);\n}\n\n/**\n * Implements the \"Subscribe\" algorithm described in the GraphQL specification.\n *\n * Returns either an AsyncGenerator (if successful), an ExecutionResult (error),\n * or a Promise for one of those results. The call will throw immediately if\n * the schema is invalid or the selected operation is not a subscription.\n *\n * GraphQL request errors, including missing operations and variable coercion\n * errors, return or resolve to a GraphQL Response (ExecutionResult) with\n * descriptive errors and no data.\n *\n * If the source stream could not be created due to faulty subscription resolver\n * logic, a non-async-iterable resolver result, or a system error, the\n * function will return or resolve to a single ExecutionResult containing\n * `errors` and no `data`.\n *\n * If the operation succeeded, the function returns or resolves to an\n * AsyncGenerator, which yields a stream of ExecutionResults representing the\n * response stream.\n *\n * This function does not support incremental delivery (`@defer` and `@stream`).\n * If an operation which would defer or stream data is executed with this\n * function, a field error will be raised at the location of the `@defer` or\n * `@stream` directive.\n *\n * Accepts an object with named arguments.\n * @param args - Execution arguments for the subscription operation.\n * @returns A response stream for a valid subscription, or an execution result containing errors.\n * @example\n * ```ts\n * // Use a same-named rootValue function to provide the source event stream.\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { subscribe } from 'graphql/execution';\n *\n * async function* greetings() {\n * yield { greeting: 'Hello' };\n * yield { greeting: 'Bonjour' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n *\n * const result = await subscribe({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: () => greetings() },\n * });\n *\n * assert('next' in result);\n *\n * const firstPayload = await result.next();\n * firstPayload.value; // => { data: { greeting: 'Hello' } }\n * ```\n * @example\n * ```ts\n * // This variant supplies events through a custom subscribeFieldResolver.\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { subscribe } from 'graphql/execution';\n *\n * async function* defaultGreetings() {\n * yield { greeting: 'Hello' };\n * }\n *\n * async function* frenchGreetings() {\n * yield { greeting: 'Bonjour' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting(locale: String): String\n * }\n * `);\n *\n * const result = await subscribe({\n * schema,\n * document: parse(\n * 'subscription Greeting($locale: String) { greeting(locale: $locale) }',\n * ),\n * rootValue: {\n * greeting: (args, contextValue) => {\n * const locale = args.locale ?? contextValue.defaultLocale;\n * return locale === 'fr' ? frenchGreetings() : defaultGreetings();\n * },\n * },\n * contextValue: { defaultLocale: 'fr' },\n * variableValues: { locale: 'fr' },\n * operationName: 'Greeting',\n * subscribeFieldResolver: (rootValue, args, contextValue, info) => {\n * args.locale; // => 'fr'\n * return rootValue[info.fieldName](args, contextValue);\n * },\n * });\n *\n * assert('next' in result);\n *\n * const firstPayload = await result.next();\n * firstPayload.value; // => { data: { greeting: 'Bonjour' } }\n * ```\n */\nexport function subscribe(\n args: ExecutionArgs,\n): PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n> {\n if (!shouldTrace(subscribeChannel)) {\n return subscribeImpl(args);\n }\n return traceMixed(subscribeChannel, buildOperationContextFromArgs(args), () =>\n subscribeImpl(args),\n );\n}\n\nfunction subscribeImpl(\n args: ExecutionArgs,\n): PromiseOrValue<\n AsyncGenerator<ExecutionResult, void, void> | ExecutionResult\n> {\n // If the request cannot produce valid execution arguments, return a\n // \"Response\" with only errors.\n const validatedExecutionArgs = validateSubscriptionArgs(args);\n\n // Return early errors if execution context failed.\n if (!('schema' in validatedExecutionArgs)) {\n return { errors: validatedExecutionArgs };\n }\n\n const resultOrStream = createSourceEventStream(validatedExecutionArgs);\n\n if (isPromise(resultOrStream)) {\n return resultOrStream.then((resolvedResultOrStream) =>\n isAsyncIterable(resolvedResultOrStream)\n ? mapSourceToResponseEvent(\n validatedExecutionArgs,\n resolvedResultOrStream,\n )\n : resolvedResultOrStream,\n );\n }\n\n return isAsyncIterable(resultOrStream)\n ? mapSourceToResponseEvent(validatedExecutionArgs, resultOrStream)\n : resultOrStream;\n}\n\n/**\n * Implements the \"CreateSourceEventStream\" algorithm described in the\n * GraphQL specification, resolving the subscription source event stream for a\n * previously validated subscription request.\n *\n * Returns either an AsyncIterable (if successful), an ExecutionResult (error),\n * or a Promise for one of those results. The call will throw immediately if\n * it is not passed validated execution arguments.\n *\n * If the validated arguments do not result in a compliant subscription, a\n * GraphQL Response (ExecutionResult) with descriptive errors and no data will\n * be returned.\n *\n * If the source stream could not be created due to faulty subscription\n * resolver logic or a system error, the function will return or\n * resolve to a single ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the function returns or resolves to the\n * AsyncIterable for the event stream returned by the resolver.\n *\n * A Source Event Stream represents a sequence of events, each of which triggers\n * a GraphQL execution for that event.\n *\n * This may be useful when hosting the stateful subscription service in a\n * different process or machine than the stateless GraphQL execution engine,\n * or otherwise separating these two steps. For more on this, see the\n * \"Supporting Subscriptions at Scale\" information in the GraphQL specification.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @returns A source event stream, or an execution result containing errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * createSourceEventStream,\n * validateSubscriptionArgs,\n * } from 'graphql/execution';\n *\n * async function* greetings() {\n * yield { greeting: 'Hello' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * rootValue: { greeting: () => greetings() },\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const stream = await createSourceEventStream(validatedArgs);\n * Symbol.asyncIterator in stream; // => true\n * ```\n */\nexport function createSourceEventStream(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n): PromiseOrValue<AsyncIterable<unknown> | ExecutionResult> {\n if (!('operation' in validatedExecutionArgs)) {\n throw new GraphQLError(\n 'Passing ExecutionArgs to createSourceEventStream() was removed in graphql-js@17.0.0; call validateSubscriptionArgs() first and pass the result instead, or use subscribe() for the full subscription pipeline.',\n );\n }\n\n try {\n const eventStream = executeSubscription(validatedExecutionArgs);\n if (isPromise(eventStream)) {\n return eventStream.then(undefined, (error: unknown) => ({\n errors: [ensureGraphQLError(error)],\n }));\n }\n\n return eventStream;\n } catch (error) {\n return { errors: [ensureGraphQLError(error)] };\n }\n}\n\n/**\n * Validates the arguments passed to execute, subscribe, and their lower-level\n * helpers.\n *\n * Throws if the schema is invalid. GraphQL request errors, including variable\n * coercion errors, are returned as a GraphQLError array.\n * @param args - Execution arguments to validate.\n * @returns Validated execution arguments, or validation errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { validateExecutionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * interface Named {\n * name: String!\n * }\n *\n * type User implements Named {\n * name: String!\n * }\n *\n * type Query {\n * viewer: Named\n * }\n * `);\n * const abortController = new AbortController();\n * const validatedArgs = validateExecutionArgs({\n * schema,\n * document: parse('query Viewer { viewer { __typename name } }'),\n * rootValue: { viewer: { kind: 'user', name: 'Ada' } },\n * contextValue: { locale: 'en' },\n * operationName: 'Viewer',\n * fieldResolver: (source, _args, contextValue, info) => {\n * contextValue.locale; // => 'en'\n * return source[info.fieldName];\n * },\n * typeResolver: (value) => {\n * return value.kind === 'user' ? 'User' : undefined;\n * },\n * hideSuggestions: true,\n * abortSignal: abortController.signal,\n * enableEarlyExecution: true,\n * hooks: {\n * asyncWorkFinished: () => {},\n * },\n * options: { maxCoercionErrors: 1 },\n * });\n *\n * assert('operation' in validatedArgs);\n *\n * validatedArgs.operation.name?.value; // => 'Viewer'\n * validatedArgs.hideSuggestions; // => true\n * ```\n */\nexport function validateExecutionArgs(\n args: ExecutionArgs,\n): ReadonlyArray<GraphQLError> | ValidatedExecutionArgs {\n const {\n schema,\n document,\n rootValue,\n contextValue,\n variableValues: rawVariableValues,\n operationName,\n fieldResolver,\n typeResolver,\n subscribeFieldResolver,\n abortSignal: externalAbortSignal,\n enableEarlyExecution,\n hooks,\n options,\n } = args;\n\n // If the schema used for execution is invalid, throw an error.\n assertValidSchema(schema);\n\n let operation: OperationDefinitionNode | undefined;\n const fragmentDefinitions: ObjMap<FragmentDefinitionNode> =\n Object.create(null);\n const fragments: ObjMap<FragmentDetails> = Object.create(null);\n const fragmentVariableSignatureErrors: Array<GraphQLError> = [];\n for (const definition of document.definitions) {\n switch (definition.kind) {\n case Kind.OPERATION_DEFINITION:\n if (operationName == null) {\n if (operation !== undefined) {\n return [\n new GraphQLError(\n 'Must provide operation name if query contains multiple operations.',\n ),\n ];\n }\n operation = definition;\n } else if (definition.name?.value === operationName) {\n operation = definition;\n }\n break;\n case Kind.FRAGMENT_DEFINITION: {\n fragmentDefinitions[definition.name.value] = definition;\n let variableSignatures;\n if (definition.variableDefinitions) {\n const signatures: ObjMap<GraphQLVariableSignature> =\n Object.create(null);\n for (const varDef of definition.variableDefinitions) {\n const signature = getVariableSignature(schema, varDef);\n if (signature instanceof GraphQLError) {\n fragmentVariableSignatureErrors.push(signature);\n continue;\n }\n signatures[signature.name] = signature;\n }\n variableSignatures = signatures;\n }\n fragments[definition.name.value] = { definition, variableSignatures };\n break;\n }\n default:\n // ignore non-executable definitions\n }\n }\n\n if (!operation) {\n if (operationName != null) {\n return [new GraphQLError(`Unknown operation named \"${operationName}\".`)];\n }\n return [new GraphQLError('Must provide an operation.')];\n }\n\n if (fragmentVariableSignatureErrors.length > 0) {\n return fragmentVariableSignatureErrors;\n }\n\n const variableDefinitions = operation.variableDefinitions ?? [];\n const hideSuggestions = args.hideSuggestions ?? false;\n\n const coercionInput = rawVariableValues ?? {};\n const coercionOptions = {\n maxErrors: options?.maxCoercionErrors ?? 50,\n hideSuggestions,\n };\n const coercionChannel = executeVariableCoercionChannel;\n const variableValuesOrErrors = shouldTrace(coercionChannel)\n ? traceMixed(\n coercionChannel,\n {\n schema,\n document,\n operation,\n rawVariableValues,\n operationName: operation.name?.value,\n operationType: operation.operation,\n },\n () =>\n getVariableValues(\n schema,\n variableDefinitions,\n coercionInput,\n coercionOptions,\n ),\n )\n : getVariableValues(\n schema,\n variableDefinitions,\n coercionInput,\n coercionOptions,\n );\n\n if (variableValuesOrErrors.errors) {\n return variableValuesOrErrors.errors;\n }\n\n const errorPropagation = !operation.directives?.find(\n (directive) =>\n directive.name.value === GraphQLDisableErrorPropagationDirective.name,\n );\n\n return {\n schema,\n document,\n fragmentDefinitions,\n fragments,\n rootValue,\n contextValue,\n operation,\n variableValues: variableValuesOrErrors.variableValues,\n fieldResolver: fieldResolver ?? defaultFieldResolver,\n typeResolver: typeResolver ?? defaultTypeResolver,\n subscribeFieldResolver: subscribeFieldResolver ?? defaultFieldResolver,\n hideSuggestions,\n errorPropagation,\n externalAbortSignal: externalAbortSignal ?? undefined,\n enableEarlyExecution: enableEarlyExecution === true,\n hooks: hooks ?? undefined,\n rawVariableValues,\n };\n}\n\n/**\n * Validates execution arguments for a subscription operation.\n *\n * Throws if the schema is invalid or the selected operation is not a\n * subscription. GraphQL request errors, including variable coercion errors, are\n * returned as a GraphQLError array.\n * @param args - Execution arguments to validate.\n * @returns Validated subscription execution arguments, or validation errors.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import { validateSubscriptionArgs } from 'graphql/execution';\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * });\n *\n * assert('operation' in validatedArgs);\n *\n * validatedArgs.operation.operation; // => 'subscription'\n * ```\n */\nexport function validateSubscriptionArgs(\n args: ExecutionArgs,\n): ReadonlyArray<GraphQLError> | ValidatedSubscriptionArgs {\n const validatedExecutionArgs = validateExecutionArgs(args);\n if (!('schema' in validatedExecutionArgs)) {\n return validatedExecutionArgs;\n }\n assertSubscriptionExecutionArgs(validatedExecutionArgs);\n return validatedExecutionArgs;\n}\n\nfunction assertSubscriptionExecutionArgs(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): asserts validatedExecutionArgs is ValidatedSubscriptionArgs {\n if (\n !isSubscriptionOperationDefinitionNode(validatedExecutionArgs.operation)\n ) {\n throw new GraphQLError('Expected subscription operation.');\n }\n}\n\n/**\n * If a resolveType function is not given, then a default resolve behavior is\n * used which attempts two strategies:\n *\n * First, See if the provided value has a `__typename` field defined, if so, use\n * that value as name of the resolved type.\n *\n * Otherwise, test each possible type for the abstract type by calling\n * isTypeOf for the object being coerced, returning the first type that matches.\n */\nexport const defaultTypeResolver: GraphQLTypeResolver<unknown, unknown> =\n function (value, contextValue, info, abstractType) {\n // First, look for `__typename`.\n if (isObjectLike(value) && typeof value.__typename === 'string') {\n return value.__typename;\n }\n\n // Otherwise, test each possible type.\n const possibleTypes = info.schema.getPossibleTypes(abstractType);\n const promisedIsTypeOfResults: Array<PromiseLike<boolean>> = [];\n\n try {\n for (let i = 0; i < possibleTypes.length; i++) {\n const type = possibleTypes[i];\n\n if (type.isTypeOf) {\n const isTypeOfResult = type.isTypeOf(value, contextValue, info);\n\n if (isPromiseLike(isTypeOfResult)) {\n promisedIsTypeOfResults[i] = isTypeOfResult;\n } else if (isTypeOfResult) {\n if (promisedIsTypeOfResults.length) {\n info.getAsyncHelpers().track(promisedIsTypeOfResults);\n }\n return type.name;\n }\n }\n }\n } catch (error) {\n if (promisedIsTypeOfResults.length) {\n info.getAsyncHelpers().track(promisedIsTypeOfResults);\n }\n throw error;\n }\n\n if (promisedIsTypeOfResults.length) {\n return info\n .getAsyncHelpers()\n .promiseAll(promisedIsTypeOfResults)\n .then((isTypeOfResults) => {\n for (let i = 0; i < isTypeOfResults.length; i++) {\n if (isTypeOfResults[i]) {\n return possibleTypes[i].name;\n }\n }\n });\n }\n };\n\n/**\n * If a resolve function is not given, then a default resolve behavior is used\n * which takes the property of the source object of the same name as the field\n * and returns it as the result, or if it's a function, returns the result\n * of calling that function while passing along args and context value.\n */\nexport const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown> =\n function (source: any, args, contextValue, info) {\n // ensure source is a value for which property access is acceptable.\n if (isObjectLike(source) || typeof source === 'function') {\n const property = source[info.fieldName];\n if (typeof property === 'function') {\n return source[info.fieldName](args, contextValue, info);\n }\n return property;\n }\n };\n\n/**\n * Implements the \"MapSourceToResponseEvent\" algorithm described in the\n * GraphQL specification, mapping each event from a subscription source event\n * stream to an ExecutionResult in the response stream.\n * @param validatedExecutionArgs - Validated subscription execution arguments.\n * @param sourceEventStream - Source event stream returned by the subscription resolver.\n * @param rootSelectionSetExecutor - Function used to execute each source event.\n * @returns A response stream of execution results.\n * @example\n * ```ts\n * import assert from 'node:assert';\n * import { parse } from 'graphql/language';\n * import { buildSchema } from 'graphql/utilities';\n * import {\n * mapSourceToResponseEvent,\n * validateSubscriptionArgs,\n * } from 'graphql/execution';\n *\n * async function* events() {\n * yield { greeting: 'Hello' };\n * }\n *\n * const schema = buildSchema(`\n * type Query {\n * noop: String\n * }\n *\n * type Subscription {\n * greeting: String\n * }\n * `);\n * const validatedArgs = validateSubscriptionArgs({\n * schema,\n * document: parse('subscription { greeting }'),\n * });\n *\n * assert('schema' in validatedArgs);\n *\n * const responseStream = mapSourceToResponseEvent(validatedArgs, events());\n * const firstPayload = await responseStream.next();\n *\n * firstPayload.value; // => { data: { greeting: 'Hello' } }\n * ```\n */\nexport function mapSourceToResponseEvent(\n validatedExecutionArgs: ValidatedSubscriptionArgs,\n sourceEventStream: AsyncIterable<unknown>,\n rootSelectionSetExecutor: RootSelectionSetExecutor = executeSubscriptionEvent,\n): AsyncGenerator<ExecutionResult, void, void> {\n // For each payload yielded from a subscription, map it over the normal\n // GraphQL `execute` function, with `payload` as the rootValue.\n function mapFn(payload: unknown): PromiseOrValue<ExecutionResult> {\n const perEventExecutionArgs: ValidatedSubscriptionArgs = {\n ...validatedExecutionArgs,\n rootValue: payload,\n };\n return rootSelectionSetExecutor(perEventExecutionArgs);\n }\n\n const externalAbortSignal = validatedExecutionArgs.externalAbortSignal;\n if (externalAbortSignal) {\n const generator = mapAsyncIterable(sourceEventStream, mapFn);\n return {\n ...generator,\n next: () => cancellablePromise(generator.next(), externalAbortSignal),\n };\n }\n return mapAsyncIterable(sourceEventStream, mapFn);\n}\n\nfunction executeSubscription(\n validatedExecutionArgs: ValidatedExecutionArgs,\n): PromiseOrValue<AsyncIterable<unknown>> {\n const {\n schema,\n fragments,\n rootValue,\n contextValue,\n operation,\n variableValues,\n hideSuggestions,\n externalAbortSignal,\n } = validatedExecutionArgs;\n\n const rootType = schema.getSubscriptionType();\n if (rootType == null) {\n throw new GraphQLError(\n 'Schema is not configured to execute subscription operation.',\n { nodes: operation },\n );\n }\n\n const { groupedFieldSet } = collectFields(\n schema,\n fragments,\n variableValues,\n rootType,\n operation.selectionSet,\n hideSuggestions,\n );\n\n const firstRootField = groupedFieldSet.entries().next().value as [\n string,\n FieldDetailsList,\n ];\n const [responseName, fieldDetailsList] = firstRootField;\n const firstFieldDetails = fieldDetailsList[0];\n const firstNode = firstFieldDetails.node;\n const fieldName = firstNode.name.value;\n const fieldDef = schema.getField(rootType, fieldName);\n\n const fieldNodes = fieldDetailsList.map((fieldDetails) => fieldDetails.node);\n if (!fieldDef) {\n throw new GraphQLError(\n `The subscription field \"${fieldName}\" is not defined.`,\n { nodes: fieldNodes },\n );\n }\n\n const sharedExecutionContext =\n createSharedExecutionContext(externalAbortSignal);\n const path = addPath(undefined, responseName, rootType.name);\n const info = buildResolveInfo(\n validatedExecutionArgs,\n fieldDef,\n fieldNodes,\n rootType,\n path,\n sharedExecutionContext.getAbortSignal,\n sharedExecutionContext.getAsyncHelpers,\n );\n\n try {\n // Implements the \"ResolveFieldEventStream\" algorithm from GraphQL specification.\n // It differs from \"ResolveFieldValue\" due to providing a different `resolveFn`.\n\n // Build a JS object of arguments from the field.arguments AST, using the\n // variables scope to fulfill any variable references.\n const args = getArgumentValues(\n fieldDef,\n firstNode,\n variableValues,\n firstFieldDetails.fragmentVariableValues,\n hideSuggestions,\n );\n\n // Call the `subscribe()` resolver or the default resolver to produce an\n // AsyncIterable yielding raw payloads.\n const resolveFn =\n fieldDef.subscribe ?? validatedExecutionArgs.subscribeFieldResolver;\n\n // The resolve function's optional third argument is a context value that\n // is provided to every resolve function within an execution. It is commonly\n // used to represent an authenticated user, or request-specific caches.\n const result = resolveFn(rootValue, args, contextValue, info);\n\n if (isPromiseLike(result)) {\n const promisedResult = Promise.resolve(result);\n const promise = externalAbortSignal\n ? cancellablePromise(promisedResult, externalAbortSignal)\n : promisedResult;\n return promise\n .then(assertEventStream)\n .then(undefined, (error: unknown) => {\n throw locatedError(\n error,\n toNodes(fieldDetailsList),\n pathToArray(path),\n );\n });\n }\n return assertEventStream(result);\n } catch (error) {\n throw locatedError(error, fieldNodes, pathToArray(path));\n }\n}\n\nfunction assertEventStream(result: unknown): AsyncIterable<unknown> {\n if (result instanceof Error) {\n throw result;\n }\n\n // Assert field returned an event stream, otherwise yield an error.\n if (!isAsyncIterable(result)) {\n throw new GraphQLError(\n 'Subscription field must return Async Iterable. ' +\n `Received: ${inspect(result)}.`,\n );\n }\n\n return result;\n}\n\nfunction toNodes(fieldDetailsList: FieldDetailsList): ReadonlyArray<FieldNode> {\n return fieldDetailsList.map((fieldDetails) => fieldDetails.node);\n}\n"]}
|
package/execution/execute.mjs
CHANGED
|
@@ -148,6 +148,7 @@ export function validateExecutionArgs(args) {
|
|
|
148
148
|
let operation;
|
|
149
149
|
const fragmentDefinitions = Object.create(null);
|
|
150
150
|
const fragments = Object.create(null);
|
|
151
|
+
const fragmentVariableSignatureErrors = [];
|
|
151
152
|
for (const definition of document.definitions) {
|
|
152
153
|
switch (definition.kind) {
|
|
153
154
|
case Kind.OPERATION_DEFINITION:
|
|
@@ -167,11 +168,16 @@ export function validateExecutionArgs(args) {
|
|
|
167
168
|
fragmentDefinitions[definition.name.value] = definition;
|
|
168
169
|
let variableSignatures;
|
|
169
170
|
if (definition.variableDefinitions) {
|
|
170
|
-
|
|
171
|
+
const signatures = Object.create(null);
|
|
171
172
|
for (const varDef of definition.variableDefinitions) {
|
|
172
173
|
const signature = getVariableSignature(schema, varDef);
|
|
173
|
-
|
|
174
|
+
if (signature instanceof GraphQLError) {
|
|
175
|
+
fragmentVariableSignatureErrors.push(signature);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
signatures[signature.name] = signature;
|
|
174
179
|
}
|
|
180
|
+
variableSignatures = signatures;
|
|
175
181
|
}
|
|
176
182
|
fragments[definition.name.value] = { definition, variableSignatures };
|
|
177
183
|
break;
|
|
@@ -185,6 +191,9 @@ export function validateExecutionArgs(args) {
|
|
|
185
191
|
}
|
|
186
192
|
return [new GraphQLError('Must provide an operation.')];
|
|
187
193
|
}
|
|
194
|
+
if (fragmentVariableSignatureErrors.length > 0) {
|
|
195
|
+
return fragmentVariableSignatureErrors;
|
|
196
|
+
}
|
|
188
197
|
const variableDefinitions = operation.variableDefinitions ?? [];
|
|
189
198
|
const hideSuggestions = args.hideSuggestions ?? false;
|
|
190
199
|
const coercionInput = rawVariableValues ?? {};
|