graphql 17.0.0-beta.2 → 17.0.0
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/__dev__/diagnostics.d.mts +1 -0
- package/__dev__/diagnostics.d.ts +1 -0
- package/__dev__/diagnostics.js +3 -0
- package/__dev__/diagnostics.mjs +3 -0
- package/diagnostics.d.mts +307 -0
- package/diagnostics.d.ts +307 -0
- package/diagnostics.js +75 -0
- package/diagnostics.js.map +1 -0
- package/diagnostics.mjs +70 -0
- package/diagnostics.mjs.map +1 -0
- package/error/GraphQLError.d.mts +3 -1
- package/error/GraphQLError.d.ts +3 -1
- package/error/GraphQLError.js +3 -3
- package/error/GraphQLError.js.map +1 -1
- package/error/GraphQLError.mjs +3 -3
- package/error/GraphQLError.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/ExecutionArgs.d.mts +6 -0
- package/execution/ExecutionArgs.d.ts +6 -0
- package/execution/ExecutionArgs.js.map +1 -1
- package/execution/ExecutionArgs.mjs.map +1 -1
- package/execution/Executor.d.mts +19 -1
- package/execution/Executor.d.ts +19 -1
- package/execution/Executor.js +49 -4
- package/execution/Executor.js.map +1 -1
- package/execution/Executor.mjs +49 -4
- 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 +73 -4
- package/execution/execute.js.map +1 -1
- package/execution/execute.mjs +73 -4
- 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/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/language/parser.d.mts +20 -30
- package/language/parser.d.ts +20 -30
- package/language/parser.js +9 -9
- package/language/parser.js.map +1 -1
- package/language/parser.mjs +9 -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 +2 -2
- 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 +70 -17
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs +70 -17
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.mts +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.ts +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js +90 -21
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs +91 -22
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.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 +6 -0
- package/validation/validate.js.map +1 -1
- package/validation/validate.mjs +6 -0
- package/validation/validate.mjs.map +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
- package/version.mjs +2 -2
- package/version.mjs.map +1 -1
package/execution/execute.d.mts
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.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
|
@@ -26,6 +26,8 @@ const kinds_ts_1 = require("../language/kinds.js");
|
|
|
26
26
|
const predicates_ts_1 = require("../language/predicates.js");
|
|
27
27
|
const directives_ts_1 = require("../type/directives.js");
|
|
28
28
|
const index_ts_1 = require("../type/index.js");
|
|
29
|
+
const getOperationAST_ts_1 = require("../utilities/getOperationAST.js");
|
|
30
|
+
const diagnostics_ts_1 = require("../diagnostics.js");
|
|
29
31
|
const buildResolveInfo_ts_1 = require("./buildResolveInfo.js");
|
|
30
32
|
const cancellablePromise_ts_1 = require("./cancellablePromise.js");
|
|
31
33
|
const collectFields_ts_1 = require("./collectFields.js");
|
|
@@ -38,6 +40,32 @@ const mapAsyncIterable_ts_1 = require("./mapAsyncIterable.js");
|
|
|
38
40
|
const values_ts_1 = require("./values.js");
|
|
39
41
|
const UNEXPECTED_EXPERIMENTAL_DIRECTIVES = 'The provided schema unexpectedly contains experimental directives (@defer or @stream). These directives may only be utilized if experimental execution features are explicitly enabled.';
|
|
40
42
|
function execute(args) {
|
|
43
|
+
if (!(0, diagnostics_ts_1.shouldTrace)(diagnostics_ts_1.executeChannel)) {
|
|
44
|
+
return executeImpl(args);
|
|
45
|
+
}
|
|
46
|
+
return (0, diagnostics_ts_1.traceMixed)(diagnostics_ts_1.executeChannel, buildOperationContextFromArgs(args), () => executeImpl(args));
|
|
47
|
+
}
|
|
48
|
+
function buildOperationContextFromArgs(args) {
|
|
49
|
+
let operation;
|
|
50
|
+
const resolveOperation = () => {
|
|
51
|
+
if (operation === undefined) {
|
|
52
|
+
operation = (0, getOperationAST_ts_1.getOperationAST)(args.document, args.operationName);
|
|
53
|
+
}
|
|
54
|
+
return operation;
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
schema: args.schema,
|
|
58
|
+
document: args.document,
|
|
59
|
+
rawVariableValues: args.variableValues,
|
|
60
|
+
get operationName() {
|
|
61
|
+
return args.operationName ?? resolveOperation()?.name?.value;
|
|
62
|
+
},
|
|
63
|
+
get operationType() {
|
|
64
|
+
return resolveOperation()?.operation;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function executeImpl(args) {
|
|
41
69
|
if (args.schema.getDirective('defer') || args.schema.getDirective('stream')) {
|
|
42
70
|
throw new Error(UNEXPECTED_EXPERIMENTAL_DIRECTIVES);
|
|
43
71
|
}
|
|
@@ -48,6 +76,12 @@ function execute(args) {
|
|
|
48
76
|
return executeRootSelectionSet(validatedExecutionArgs);
|
|
49
77
|
}
|
|
50
78
|
function experimentalExecuteIncrementally(args) {
|
|
79
|
+
if (!(0, diagnostics_ts_1.shouldTrace)(diagnostics_ts_1.executeChannel)) {
|
|
80
|
+
return experimentalExecuteIncrementallyImpl(args);
|
|
81
|
+
}
|
|
82
|
+
return (0, diagnostics_ts_1.traceMixed)(diagnostics_ts_1.executeChannel, buildOperationContextFromArgs(args), () => experimentalExecuteIncrementallyImpl(args));
|
|
83
|
+
}
|
|
84
|
+
function experimentalExecuteIncrementallyImpl(args) {
|
|
51
85
|
const validatedExecutionArgs = validateExecutionArgs(args);
|
|
52
86
|
if (!('schema' in validatedExecutionArgs)) {
|
|
53
87
|
return { errors: validatedExecutionArgs };
|
|
@@ -55,6 +89,12 @@ function experimentalExecuteIncrementally(args) {
|
|
|
55
89
|
return experimentalExecuteRootSelectionSet(validatedExecutionArgs);
|
|
56
90
|
}
|
|
57
91
|
function executeIgnoringIncremental(args) {
|
|
92
|
+
if (!(0, diagnostics_ts_1.shouldTrace)(diagnostics_ts_1.executeChannel)) {
|
|
93
|
+
return executeIgnoringIncrementalImpl(args);
|
|
94
|
+
}
|
|
95
|
+
return (0, diagnostics_ts_1.traceMixed)(diagnostics_ts_1.executeChannel, buildOperationContextFromArgs(args), () => executeIgnoringIncrementalImpl(args));
|
|
96
|
+
}
|
|
97
|
+
function executeIgnoringIncrementalImpl(args) {
|
|
58
98
|
const validatedExecutionArgs = validateExecutionArgs(args);
|
|
59
99
|
if (!('schema' in validatedExecutionArgs)) {
|
|
60
100
|
return { errors: validatedExecutionArgs };
|
|
@@ -81,6 +121,12 @@ function executeSubscriptionEvent(validatedExecutionArgs) {
|
|
|
81
121
|
return new ExecutorThrowingOnIncremental_ts_1.ExecutorThrowingOnIncremental(validatedExecutionArgs).executeRootSelectionSet(false);
|
|
82
122
|
}
|
|
83
123
|
function subscribe(args) {
|
|
124
|
+
if (!(0, diagnostics_ts_1.shouldTrace)(diagnostics_ts_1.subscribeChannel)) {
|
|
125
|
+
return subscribeImpl(args);
|
|
126
|
+
}
|
|
127
|
+
return (0, diagnostics_ts_1.traceMixed)(diagnostics_ts_1.subscribeChannel, buildOperationContextFromArgs(args), () => subscribeImpl(args));
|
|
128
|
+
}
|
|
129
|
+
function subscribeImpl(args) {
|
|
84
130
|
const validatedExecutionArgs = validateSubscriptionArgs(args);
|
|
85
131
|
if (!('schema' in validatedExecutionArgs)) {
|
|
86
132
|
return { errors: validatedExecutionArgs };
|
|
@@ -118,6 +164,7 @@ function validateExecutionArgs(args) {
|
|
|
118
164
|
let operation;
|
|
119
165
|
const fragmentDefinitions = Object.create(null);
|
|
120
166
|
const fragments = Object.create(null);
|
|
167
|
+
const fragmentVariableSignatureErrors = [];
|
|
121
168
|
for (const definition of document.definitions) {
|
|
122
169
|
switch (definition.kind) {
|
|
123
170
|
case kinds_ts_1.Kind.OPERATION_DEFINITION:
|
|
@@ -137,11 +184,16 @@ function validateExecutionArgs(args) {
|
|
|
137
184
|
fragmentDefinitions[definition.name.value] = definition;
|
|
138
185
|
let variableSignatures;
|
|
139
186
|
if (definition.variableDefinitions) {
|
|
140
|
-
|
|
187
|
+
const signatures = Object.create(null);
|
|
141
188
|
for (const varDef of definition.variableDefinitions) {
|
|
142
189
|
const signature = (0, getVariableSignature_ts_1.getVariableSignature)(schema, varDef);
|
|
143
|
-
|
|
190
|
+
if (signature instanceof GraphQLError_ts_1.GraphQLError) {
|
|
191
|
+
fragmentVariableSignatureErrors.push(signature);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
signatures[signature.name] = signature;
|
|
144
195
|
}
|
|
196
|
+
variableSignatures = signatures;
|
|
145
197
|
}
|
|
146
198
|
fragments[definition.name.value] = { definition, variableSignatures };
|
|
147
199
|
break;
|
|
@@ -155,18 +207,34 @@ function validateExecutionArgs(args) {
|
|
|
155
207
|
}
|
|
156
208
|
return [new GraphQLError_ts_1.GraphQLError('Must provide an operation.')];
|
|
157
209
|
}
|
|
210
|
+
if (fragmentVariableSignatureErrors.length > 0) {
|
|
211
|
+
return fragmentVariableSignatureErrors;
|
|
212
|
+
}
|
|
158
213
|
const variableDefinitions = operation.variableDefinitions ?? [];
|
|
159
214
|
const hideSuggestions = args.hideSuggestions ?? false;
|
|
160
|
-
const
|
|
215
|
+
const coercionInput = rawVariableValues ?? {};
|
|
216
|
+
const coercionOptions = {
|
|
161
217
|
maxErrors: options?.maxCoercionErrors ?? 50,
|
|
162
218
|
hideSuggestions,
|
|
163
|
-
}
|
|
219
|
+
};
|
|
220
|
+
const coercionChannel = diagnostics_ts_1.executeVariableCoercionChannel;
|
|
221
|
+
const variableValuesOrErrors = (0, diagnostics_ts_1.shouldTrace)(coercionChannel)
|
|
222
|
+
? (0, diagnostics_ts_1.traceMixed)(coercionChannel, {
|
|
223
|
+
schema,
|
|
224
|
+
document,
|
|
225
|
+
operation,
|
|
226
|
+
rawVariableValues,
|
|
227
|
+
operationName: operation.name?.value,
|
|
228
|
+
operationType: operation.operation,
|
|
229
|
+
}, () => (0, values_ts_1.getVariableValues)(schema, variableDefinitions, coercionInput, coercionOptions))
|
|
230
|
+
: (0, values_ts_1.getVariableValues)(schema, variableDefinitions, coercionInput, coercionOptions);
|
|
164
231
|
if (variableValuesOrErrors.errors) {
|
|
165
232
|
return variableValuesOrErrors.errors;
|
|
166
233
|
}
|
|
167
234
|
const errorPropagation = !operation.directives?.find((directive) => directive.name.value === directives_ts_1.GraphQLDisableErrorPropagationDirective.name);
|
|
168
235
|
return {
|
|
169
236
|
schema,
|
|
237
|
+
document,
|
|
170
238
|
fragmentDefinitions,
|
|
171
239
|
fragments,
|
|
172
240
|
rootValue,
|
|
@@ -181,6 +249,7 @@ function validateExecutionArgs(args) {
|
|
|
181
249
|
externalAbortSignal: externalAbortSignal ?? undefined,
|
|
182
250
|
enableEarlyExecution: enableEarlyExecution === true,
|
|
183
251
|
hooks: hooks ?? undefined,
|
|
252
|
+
rawVariableValues,
|
|
184
253
|
};
|
|
185
254
|
}
|
|
186
255
|
function validateSubscriptionArgs(args) {
|