graphql 14.1.1 → 14.3.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/LICENSE +1 -1
- package/README.md +1 -1
- package/error/GraphQLError.js +12 -10
- package/error/GraphQLError.js.flow +11 -6
- package/error/GraphQLError.mjs +20 -3
- package/error/formatError.js +2 -2
- package/error/formatError.js.flow +3 -3
- package/error/formatError.mjs +2 -2
- package/error/index.js +1 -1
- package/error/index.js.flow +5 -2
- package/error/index.mjs +2 -2
- package/error/locatedError.js +2 -2
- package/error/locatedError.js.flow +2 -2
- package/error/locatedError.mjs +2 -2
- package/error/printError.js +2 -2
- package/error/printError.js.flow +4 -5
- package/error/printError.mjs +2 -2
- package/error/syntaxError.js +2 -2
- package/error/syntaxError.js.flow +2 -2
- package/error/syntaxError.mjs +2 -2
- package/execution/execute.js +52 -37
- package/execution/execute.js.flow +66 -51
- package/execution/execute.mjs +50 -38
- package/execution/index.js +7 -1
- package/execution/index.js.flow +9 -4
- package/execution/index.mjs +3 -3
- package/execution/values.js +11 -11
- package/execution/values.js.flow +23 -19
- package/execution/values.mjs +11 -11
- package/graphql.js +13 -9
- package/graphql.js.flow +28 -10
- package/graphql.mjs +10 -9
- package/index.js +83 -53
- package/index.js.flow +60 -47
- package/index.mjs +26 -23
- package/jsutils/ObjMap.js +1 -1
- package/jsutils/ObjMap.js.flow +1 -1
- package/jsutils/ObjMap.mjs +1 -0
- package/jsutils/PromiseOrValue.js +1 -0
- package/jsutils/{MaybePromise.js.flow → PromiseOrValue.js.flow} +2 -2
- package/jsutils/PromiseOrValue.mjs +1 -0
- package/jsutils/dedent.js +2 -2
- package/jsutils/dedent.js.flow +1 -1
- package/jsutils/dedent.mjs +2 -2
- package/jsutils/defineToJSON.js +2 -2
- package/jsutils/defineToJSON.js.flow +1 -1
- package/jsutils/defineToJSON.mjs +2 -2
- package/jsutils/defineToStringTag.js +2 -2
- package/jsutils/defineToStringTag.js.flow +1 -1
- package/jsutils/defineToStringTag.mjs +2 -2
- package/jsutils/inspect.js +94 -19
- package/jsutils/inspect.js.flow +98 -20
- package/jsutils/inspect.mjs +94 -20
- package/jsutils/instanceOf.js +2 -2
- package/jsutils/instanceOf.js.flow +1 -1
- package/jsutils/instanceOf.mjs +2 -2
- package/jsutils/invariant.js +5 -3
- package/jsutils/invariant.js.flow +3 -2
- package/jsutils/invariant.mjs +5 -3
- package/jsutils/isInvalid.js +2 -2
- package/jsutils/isInvalid.js.flow +1 -1
- package/jsutils/isInvalid.mjs +2 -2
- package/jsutils/isNullish.js +2 -2
- package/jsutils/isNullish.js.flow +1 -1
- package/jsutils/isNullish.mjs +2 -2
- package/jsutils/isPromise.js +2 -2
- package/jsutils/isPromise.js.flow +1 -1
- package/jsutils/isPromise.mjs +2 -2
- package/jsutils/keyMap.js +4 -3
- package/jsutils/keyMap.js.flow +6 -6
- package/jsutils/keyMap.mjs +4 -3
- package/jsutils/keyValMap.js +4 -3
- package/jsutils/keyValMap.js.flow +6 -6
- package/jsutils/keyValMap.mjs +4 -3
- package/jsutils/mapValue.js +2 -2
- package/jsutils/mapValue.js.flow +2 -2
- package/jsutils/mapValue.mjs +2 -2
- package/jsutils/memoize3.js +3 -3
- package/jsutils/memoize3.js.flow +2 -2
- package/jsutils/memoize3.mjs +3 -3
- package/jsutils/nodejsCustomInspectSymbol.js +2 -2
- package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
- package/jsutils/nodejsCustomInspectSymbol.mjs +2 -2
- package/jsutils/orList.js +2 -2
- package/jsutils/orList.js.flow +1 -1
- package/jsutils/orList.mjs +2 -2
- package/jsutils/promiseForObject.js +2 -2
- package/jsutils/promiseForObject.js.flow +2 -2
- package/jsutils/promiseForObject.mjs +2 -2
- package/jsutils/promiseReduce.js +2 -2
- package/jsutils/promiseReduce.js.flow +5 -5
- package/jsutils/promiseReduce.mjs +2 -2
- package/jsutils/quotedOrList.js +2 -2
- package/jsutils/quotedOrList.js.flow +1 -1
- package/jsutils/quotedOrList.mjs +2 -2
- package/jsutils/suggestionList.js +2 -2
- package/jsutils/suggestionList.js.flow +1 -1
- package/jsutils/suggestionList.mjs +2 -2
- package/language/ast.js +1 -1
- package/language/ast.js.flow +3 -3
- package/language/ast.mjs +1 -0
- package/language/blockString.js +114 -0
- package/language/blockString.js.flow +102 -0
- package/language/blockString.mjs +104 -0
- package/language/directiveLocation.js +2 -2
- package/language/directiveLocation.js.flow +1 -1
- package/language/directiveLocation.mjs +2 -2
- package/language/index.js +9 -9
- package/language/index.js.flow +10 -5
- package/language/index.mjs +3 -3
- package/language/kinds.js +2 -2
- package/language/kinds.js.flow +1 -1
- package/language/kinds.mjs +2 -2
- package/language/lexer.js +52 -44
- package/language/lexer.js.flow +65 -54
- package/language/lexer.mjs +49 -43
- package/language/location.js +2 -2
- package/language/location.js.flow +2 -2
- package/language/location.mjs +2 -2
- package/language/parser.js +75 -67
- package/language/parser.js.flow +138 -127
- package/language/parser.mjs +76 -68
- package/language/predicates.js +2 -2
- package/language/predicates.js.flow +2 -2
- package/language/predicates.mjs +2 -2
- package/language/printer.js +6 -14
- package/language/printer.js.flow +8 -17
- package/language/printer.mjs +5 -14
- package/language/source.js +2 -2
- package/language/source.js.flow +1 -1
- package/language/source.mjs +2 -2
- package/language/visitor.js +4 -6
- package/language/visitor.js.flow +3 -3
- package/language/visitor.mjs +4 -6
- package/package.json +1 -1
- package/polyfills/find.js +2 -2
- package/polyfills/find.js.flow +1 -1
- package/polyfills/find.mjs +2 -2
- package/polyfills/flatMap.js +38 -0
- package/polyfills/flatMap.js.flow +34 -0
- package/polyfills/flatMap.mjs +30 -0
- package/polyfills/isFinite.js +2 -2
- package/polyfills/isFinite.js.flow +1 -1
- package/polyfills/isFinite.mjs +2 -2
- package/polyfills/isInteger.js +2 -2
- package/polyfills/isInteger.js.flow +1 -1
- package/polyfills/isInteger.mjs +2 -2
- package/polyfills/objectEntries.js +2 -2
- package/polyfills/objectEntries.js.flow +2 -2
- package/polyfills/objectEntries.mjs +2 -2
- package/polyfills/objectValues.js +2 -2
- package/polyfills/objectValues.js.flow +2 -2
- package/polyfills/objectValues.mjs +2 -2
- package/subscription/asyncIteratorReject.js +1 -1
- package/subscription/asyncIteratorReject.js.flow +1 -1
- package/subscription/asyncIteratorReject.mjs +2 -2
- package/subscription/index.js +1 -1
- package/subscription/index.js.flow +1 -1
- package/subscription/index.mjs +2 -2
- package/subscription/mapAsyncIterator.js +1 -1
- package/subscription/mapAsyncIterator.js.flow +5 -5
- package/subscription/mapAsyncIterator.mjs +2 -2
- package/subscription/subscribe.js +2 -2
- package/subscription/subscribe.js.flow +6 -6
- package/subscription/subscribe.mjs +2 -2
- package/type/definition.js +138 -22
- package/type/definition.js.flow +184 -36
- package/type/definition.mjs +136 -23
- package/type/directives.js +14 -3
- package/type/directives.js.flow +24 -11
- package/type/directives.mjs +16 -5
- package/type/index.js +7 -7
- package/type/index.js.flow +8 -4
- package/type/index.mjs +10 -6
- package/type/introspection.js +14 -9
- package/type/introspection.js.flow +12 -18
- package/type/introspection.mjs +14 -9
- package/type/scalars.js +5 -4
- package/type/scalars.js.flow +4 -10
- package/type/scalars.mjs +7 -6
- package/type/schema.js +55 -3
- package/type/schema.js.flow +73 -17
- package/type/schema.mjs +56 -4
- package/type/validate.js +19 -47
- package/type/validate.js.flow +17 -29
- package/type/validate.mjs +18 -47
- package/utilities/TypeInfo.js +93 -73
- package/utilities/TypeInfo.js.flow +30 -23
- package/utilities/TypeInfo.mjs +93 -73
- package/utilities/assertValidName.js +2 -2
- package/utilities/assertValidName.js.flow +2 -2
- package/utilities/assertValidName.mjs +2 -2
- package/utilities/astFromValue.js +5 -4
- package/utilities/astFromValue.js.flow +8 -7
- package/utilities/astFromValue.mjs +7 -6
- package/utilities/buildASTSchema.js +63 -62
- package/utilities/buildASTSchema.js.flow +92 -108
- package/utilities/buildASTSchema.mjs +61 -62
- package/utilities/buildClientSchema.js +38 -45
- package/utilities/buildClientSchema.js.flow +66 -79
- package/utilities/buildClientSchema.mjs +37 -44
- package/utilities/coerceValue.js +6 -7
- package/utilities/coerceValue.js.flow +5 -4
- package/utilities/coerceValue.mjs +7 -8
- package/utilities/concatAST.js +9 -13
- package/utilities/concatAST.js.flow +4 -10
- package/utilities/concatAST.mjs +6 -13
- package/utilities/extendSchema.js +219 -511
- package/utilities/extendSchema.js.flow +195 -304
- package/utilities/extendSchema.mjs +218 -512
- package/utilities/findBreakingChanges.js +54 -95
- package/utilities/findBreakingChanges.js.flow +49 -47
- package/utilities/findBreakingChanges.mjs +80 -95
- package/utilities/findDeprecatedUsages.js +4 -4
- package/utilities/findDeprecatedUsages.js.flow +5 -5
- package/utilities/findDeprecatedUsages.mjs +4 -4
- package/utilities/getOperationAST.js +2 -2
- package/utilities/getOperationAST.js.flow +5 -2
- package/utilities/getOperationAST.mjs +2 -2
- package/utilities/getOperationRootType.js +24 -24
- package/utilities/getOperationRootType.js.flow +40 -35
- package/utilities/getOperationRootType.mjs +24 -24
- package/utilities/index.js +9 -1
- package/utilities/index.js.flow +13 -6
- package/utilities/index.mjs +13 -8
- package/utilities/introspectionFromSchema.js +6 -4
- package/utilities/introspectionFromSchema.js.flow +8 -7
- package/utilities/introspectionFromSchema.mjs +6 -5
- package/utilities/introspectionQuery.js +2 -2
- package/utilities/introspectionQuery.js.flow +2 -2
- package/utilities/introspectionQuery.mjs +2 -2
- package/utilities/isValidJSValue.js +4 -2
- package/utilities/isValidJSValue.js.flow +3 -2
- package/utilities/isValidJSValue.mjs +4 -2
- package/utilities/isValidLiteralValue.js +2 -2
- package/utilities/isValidLiteralValue.js.flow +4 -4
- package/utilities/isValidLiteralValue.mjs +2 -2
- package/utilities/lexicographicSortSchema.js +84 -123
- package/utilities/lexicographicSortSchema.js.flow +68 -96
- package/utilities/lexicographicSortSchema.mjs +84 -123
- package/utilities/schemaPrinter.js +47 -73
- package/utilities/schemaPrinter.js.flow +69 -120
- package/utilities/schemaPrinter.mjs +45 -72
- package/utilities/separateOperations.js +8 -12
- package/utilities/separateOperations.js.flow +6 -3
- package/utilities/separateOperations.mjs +8 -12
- package/utilities/stripIgnoredCharacters.js +140 -0
- package/utilities/stripIgnoredCharacters.js.flow +129 -0
- package/utilities/stripIgnoredCharacters.mjs +127 -0
- package/utilities/typeComparators.js +2 -2
- package/utilities/typeComparators.js.flow +4 -3
- package/utilities/typeComparators.mjs +2 -2
- package/utilities/typeFromAST.js +9 -4
- package/utilities/typeFromAST.js.flow +15 -9
- package/utilities/typeFromAST.mjs +6 -4
- package/utilities/valueFromAST.js +7 -4
- package/utilities/valueFromAST.js.flow +7 -5
- package/utilities/valueFromAST.mjs +6 -4
- package/utilities/valueFromASTUntyped.js +11 -6
- package/utilities/valueFromASTUntyped.js.flow +9 -5
- package/utilities/valueFromASTUntyped.mjs +10 -6
- package/validation/ValidationContext.js +1 -1
- package/validation/ValidationContext.js.flow +19 -20
- package/validation/ValidationContext.mjs +2 -2
- package/validation/index.js +1 -1
- package/validation/index.js.flow +2 -1
- package/validation/index.mjs +3 -2
- package/validation/rules/ExecutableDefinitions.js +3 -3
- package/validation/rules/ExecutableDefinitions.js.flow +4 -4
- package/validation/rules/ExecutableDefinitions.mjs +3 -3
- package/validation/rules/FieldsOnCorrectType.js +3 -3
- package/validation/rules/FieldsOnCorrectType.js.flow +7 -7
- package/validation/rules/FieldsOnCorrectType.mjs +3 -3
- package/validation/rules/FragmentsOnCompositeTypes.js +4 -4
- package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -5
- package/validation/rules/FragmentsOnCompositeTypes.mjs +4 -4
- package/validation/rules/KnownArgumentNames.js +1 -1
- package/validation/rules/KnownArgumentNames.js.flow +5 -5
- package/validation/rules/KnownArgumentNames.mjs +2 -2
- package/validation/rules/KnownDirectives.js +8 -6
- package/validation/rules/KnownDirectives.js.flow +11 -9
- package/validation/rules/KnownDirectives.mjs +8 -6
- package/validation/rules/KnownFragmentNames.js +3 -3
- package/validation/rules/KnownFragmentNames.js.flow +4 -4
- package/validation/rules/KnownFragmentNames.mjs +3 -3
- package/validation/rules/KnownTypeNames.js +2 -2
- package/validation/rules/KnownTypeNames.js.flow +6 -6
- package/validation/rules/KnownTypeNames.mjs +2 -2
- package/validation/rules/LoneAnonymousOperation.js +3 -3
- package/validation/rules/LoneAnonymousOperation.js.flow +4 -4
- package/validation/rules/LoneAnonymousOperation.mjs +3 -3
- package/validation/rules/LoneSchemaDefinition.js +2 -2
- package/validation/rules/LoneSchemaDefinition.js.flow +3 -3
- package/validation/rules/LoneSchemaDefinition.mjs +2 -2
- package/validation/rules/NoFragmentCycles.js +2 -2
- package/validation/rules/NoFragmentCycles.js.flow +4 -4
- package/validation/rules/NoFragmentCycles.mjs +2 -2
- package/validation/rules/NoUndefinedVariables.js +2 -2
- package/validation/rules/NoUndefinedVariables.js.flow +3 -3
- package/validation/rules/NoUndefinedVariables.mjs +2 -2
- package/validation/rules/NoUnusedFragments.js +7 -7
- package/validation/rules/NoUnusedFragments.js.flow +4 -4
- package/validation/rules/NoUnusedFragments.mjs +7 -7
- package/validation/rules/NoUnusedVariables.js +5 -5
- package/validation/rules/NoUnusedVariables.js.flow +6 -5
- package/validation/rules/NoUnusedVariables.mjs +5 -5
- package/validation/rules/OverlappingFieldsCanBeMerged.js +26 -23
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -17
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +26 -23
- package/validation/rules/PossibleFragmentSpreads.js +4 -4
- package/validation/rules/PossibleFragmentSpreads.js.flow +5 -5
- package/validation/rules/PossibleFragmentSpreads.mjs +4 -4
- package/validation/rules/PossibleTypeExtensions.js +3 -3
- package/validation/rules/PossibleTypeExtensions.js.flow +5 -5
- package/validation/rules/PossibleTypeExtensions.mjs +4 -4
- package/validation/rules/ProvidedRequiredArguments.js +6 -8
- package/validation/rules/ProvidedRequiredArguments.js.flow +8 -8
- package/validation/rules/ProvidedRequiredArguments.mjs +7 -9
- package/validation/rules/ScalarLeafs.js +4 -4
- package/validation/rules/ScalarLeafs.js.flow +6 -6
- package/validation/rules/ScalarLeafs.mjs +4 -4
- package/validation/rules/SingleFieldSubscriptions.js +2 -2
- package/validation/rules/SingleFieldSubscriptions.js.flow +4 -4
- package/validation/rules/SingleFieldSubscriptions.mjs +2 -2
- package/validation/rules/UniqueArgumentNames.js +2 -2
- package/validation/rules/UniqueArgumentNames.js.flow +3 -3
- package/validation/rules/UniqueArgumentNames.mjs +2 -2
- package/validation/rules/UniqueDirectiveNames.js +2 -2
- package/validation/rules/UniqueDirectiveNames.js.flow +3 -3
- package/validation/rules/UniqueDirectiveNames.mjs +2 -2
- package/validation/rules/UniqueDirectivesPerLocation.js +3 -2
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +4 -4
- package/validation/rules/UniqueDirectivesPerLocation.mjs +3 -2
- package/validation/rules/UniqueEnumValueNames.js +4 -8
- package/validation/rules/UniqueEnumValueNames.js.flow +6 -8
- package/validation/rules/UniqueEnumValueNames.mjs +4 -8
- package/validation/rules/UniqueFieldDefinitionNames.js +4 -8
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +6 -8
- package/validation/rules/UniqueFieldDefinitionNames.mjs +4 -8
- package/validation/rules/UniqueFragmentNames.js +2 -2
- package/validation/rules/UniqueFragmentNames.js.flow +3 -3
- package/validation/rules/UniqueFragmentNames.mjs +2 -2
- package/validation/rules/UniqueInputFieldNames.js +2 -4
- package/validation/rules/UniqueInputFieldNames.js.flow +3 -4
- package/validation/rules/UniqueInputFieldNames.mjs +2 -4
- package/validation/rules/UniqueOperationNames.js +2 -2
- package/validation/rules/UniqueOperationNames.js.flow +3 -3
- package/validation/rules/UniqueOperationNames.mjs +2 -2
- package/validation/rules/UniqueOperationTypes.js +2 -2
- package/validation/rules/UniqueOperationTypes.js.flow +3 -3
- package/validation/rules/UniqueOperationTypes.mjs +2 -2
- package/validation/rules/UniqueTypeNames.js +2 -2
- package/validation/rules/UniqueTypeNames.js.flow +4 -4
- package/validation/rules/UniqueTypeNames.mjs +2 -2
- package/validation/rules/UniqueVariableNames.js +2 -2
- package/validation/rules/UniqueVariableNames.js.flow +4 -4
- package/validation/rules/UniqueVariableNames.mjs +2 -2
- package/validation/rules/ValuesOfCorrectType.js +2 -2
- package/validation/rules/ValuesOfCorrectType.js.flow +5 -5
- package/validation/rules/ValuesOfCorrectType.mjs +2 -2
- package/validation/rules/VariablesAreInputTypes.js +3 -3
- package/validation/rules/VariablesAreInputTypes.js.flow +5 -5
- package/validation/rules/VariablesAreInputTypes.mjs +3 -3
- package/validation/rules/VariablesInAllowedPosition.js +3 -3
- package/validation/rules/VariablesInAllowedPosition.js.flow +7 -8
- package/validation/rules/VariablesInAllowedPosition.mjs +3 -3
- package/validation/specifiedRules.js +2 -2
- package/validation/specifiedRules.js.flow +13 -6
- package/validation/specifiedRules.mjs +7 -7
- package/validation/validate.js +2 -2
- package/validation/validate.js.flow +10 -6
- package/validation/validate.mjs +2 -2
- package/jsutils/MaybePromise.js +0 -1
- package/jsutils/MaybePromise.mjs +0 -0
- package/language/blockStringValue.js +0 -73
- package/language/blockStringValue.js.flow +0 -64
- package/language/blockStringValue.mjs +0 -66
package/execution/values.js.flow
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -17,15 +17,18 @@ import { typeFromAST } from '../utilities/typeFromAST';
|
|
|
17
17
|
import { valueFromAST } from '../utilities/valueFromAST';
|
|
18
18
|
import { Kind } from '../language/kinds';
|
|
19
19
|
import { print } from '../language/printer';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
import {
|
|
21
|
+
type GraphQLField,
|
|
22
|
+
isInputType,
|
|
23
|
+
isNonNullType,
|
|
24
|
+
} from '../type/definition';
|
|
25
|
+
import { type GraphQLDirective } from '../type/directives';
|
|
26
|
+
import { type ObjMap } from '../jsutils/ObjMap';
|
|
27
|
+
import { type GraphQLSchema } from '../type/schema';
|
|
28
|
+
import {
|
|
29
|
+
type FieldNode,
|
|
30
|
+
type DirectiveNode,
|
|
31
|
+
type VariableDefinitionNode,
|
|
29
32
|
} from '../language/ast';
|
|
30
33
|
|
|
31
34
|
type CoercedVariableValues = {|
|
|
@@ -62,7 +65,7 @@ export function getVariableValues(
|
|
|
62
65
|
`"${print(
|
|
63
66
|
varDefNode.type,
|
|
64
67
|
)}" which cannot be used as an input type.`,
|
|
65
|
-
|
|
68
|
+
varDefNode.type,
|
|
66
69
|
),
|
|
67
70
|
);
|
|
68
71
|
} else {
|
|
@@ -82,7 +85,7 @@ export function getVariableValues(
|
|
|
82
85
|
`"${inspect(varType)}" must not be null.`
|
|
83
86
|
: `Variable "$${varName}" of required type ` +
|
|
84
87
|
`"${inspect(varType)}" was not provided.`,
|
|
85
|
-
|
|
88
|
+
varDefNode,
|
|
86
89
|
),
|
|
87
90
|
);
|
|
88
91
|
} else if (hasValue) {
|
|
@@ -143,11 +146,12 @@ export function getArgumentValues(
|
|
|
143
146
|
let isNull;
|
|
144
147
|
if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
145
148
|
const variableName = argumentNode.value.name.value;
|
|
146
|
-
hasValue =
|
|
147
|
-
|
|
149
|
+
hasValue =
|
|
150
|
+
variableValues != null && hasOwnProperty(variableValues, variableName);
|
|
151
|
+
isNull = variableValues != null && variableValues[variableName] === null;
|
|
148
152
|
} else {
|
|
149
153
|
hasValue = argumentNode != null;
|
|
150
|
-
isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
|
|
154
|
+
isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
if (!hasValue && argDef.defaultValue !== undefined) {
|
|
@@ -161,7 +165,7 @@ export function getArgumentValues(
|
|
|
161
165
|
throw new GraphQLError(
|
|
162
166
|
`Argument "${name}" of non-null type "${inspect(argType)}" ` +
|
|
163
167
|
'must not be null.',
|
|
164
|
-
|
|
168
|
+
argumentNode.value,
|
|
165
169
|
);
|
|
166
170
|
} else if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
167
171
|
const variableName = argumentNode.value.name.value;
|
|
@@ -169,13 +173,13 @@ export function getArgumentValues(
|
|
|
169
173
|
`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
170
174
|
`was provided the variable "$${variableName}" ` +
|
|
171
175
|
'which was not provided a runtime value.',
|
|
172
|
-
|
|
176
|
+
argumentNode.value,
|
|
173
177
|
);
|
|
174
178
|
} else {
|
|
175
179
|
throw new GraphQLError(
|
|
176
180
|
`Argument "${name}" of required type "${inspect(argType)}" ` +
|
|
177
181
|
'was not provided.',
|
|
178
|
-
|
|
182
|
+
node,
|
|
179
183
|
);
|
|
180
184
|
}
|
|
181
185
|
} else if (hasValue) {
|
|
@@ -199,7 +203,7 @@ export function getArgumentValues(
|
|
|
199
203
|
// continue with an invalid argument value.
|
|
200
204
|
throw new GraphQLError(
|
|
201
205
|
`Argument "${name}" has invalid value ${print(valueNode)}.`,
|
|
202
|
-
|
|
206
|
+
argumentNode.value,
|
|
203
207
|
);
|
|
204
208
|
}
|
|
205
209
|
coercedValues[name] = coercedValue;
|
package/execution/values.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -39,7 +39,7 @@ export function getVariableValues(schema, varDefNodes, inputs) {
|
|
|
39
39
|
if (!isInputType(varType)) {
|
|
40
40
|
// Must use input types for variables. This should be caught during
|
|
41
41
|
// validation, however is checked again here for safety.
|
|
42
|
-
errors.push(new GraphQLError("Variable \"$".concat(varName, "\" expected value of type ") + "\"".concat(print(varDefNode.type), "\" which cannot be used as an input type."),
|
|
42
|
+
errors.push(new GraphQLError("Variable \"$".concat(varName, "\" expected value of type ") + "\"".concat(print(varDefNode.type), "\" which cannot be used as an input type."), varDefNode.type));
|
|
43
43
|
} else {
|
|
44
44
|
var hasValue = hasOwnProperty(inputs, varName);
|
|
45
45
|
var value = hasValue ? inputs[varName] : undefined;
|
|
@@ -51,7 +51,7 @@ export function getVariableValues(schema, varDefNodes, inputs) {
|
|
|
51
51
|
} else if ((!hasValue || value === null) && isNonNullType(varType)) {
|
|
52
52
|
// If no value or a nullish value was provided to a variable with a
|
|
53
53
|
// non-null type (required), produce an error.
|
|
54
|
-
errors.push(new GraphQLError(hasValue ? "Variable \"$".concat(varName, "\" of non-null type ") + "\"".concat(inspect(varType), "\" must not be null.") : "Variable \"$".concat(varName, "\" of required type ") + "\"".concat(inspect(varType), "\" was not provided."),
|
|
54
|
+
errors.push(new GraphQLError(hasValue ? "Variable \"$".concat(varName, "\" of non-null type ") + "\"".concat(inspect(varType), "\" must not be null.") : "Variable \"$".concat(varName, "\" of required type ") + "\"".concat(inspect(varType), "\" was not provided."), varDefNode));
|
|
55
55
|
} else if (hasValue) {
|
|
56
56
|
if (value === null) {
|
|
57
57
|
// If the explicit value `null` was provided, an entry in the coerced
|
|
@@ -137,11 +137,11 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
137
137
|
|
|
138
138
|
if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
139
139
|
var variableName = argumentNode.value.name.value;
|
|
140
|
-
hasValue = variableValues && hasOwnProperty(variableValues, variableName);
|
|
141
|
-
isNull = variableValues && variableValues[variableName] === null;
|
|
140
|
+
hasValue = variableValues != null && hasOwnProperty(variableValues, variableName);
|
|
141
|
+
isNull = variableValues != null && variableValues[variableName] === null;
|
|
142
142
|
} else {
|
|
143
143
|
hasValue = argumentNode != null;
|
|
144
|
-
isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
|
|
144
|
+
isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (!hasValue && argDef.defaultValue !== undefined) {
|
|
@@ -152,12 +152,12 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
152
152
|
// If no argument or a null value was provided to an argument with a
|
|
153
153
|
// non-null type (required), produce a field error.
|
|
154
154
|
if (isNull) {
|
|
155
|
-
throw new GraphQLError("Argument \"".concat(name, "\" of non-null type \"").concat(inspect(argType), "\" ") + 'must not be null.',
|
|
155
|
+
throw new GraphQLError("Argument \"".concat(name, "\" of non-null type \"").concat(inspect(argType), "\" ") + 'must not be null.', argumentNode.value);
|
|
156
156
|
} else if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
|
|
157
157
|
var _variableName = argumentNode.value.name.value;
|
|
158
|
-
throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + "was provided the variable \"$".concat(_variableName, "\" ") + 'which was not provided a runtime value.',
|
|
158
|
+
throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + "was provided the variable \"$".concat(_variableName, "\" ") + 'which was not provided a runtime value.', argumentNode.value);
|
|
159
159
|
} else {
|
|
160
|
-
throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + 'was not provided.',
|
|
160
|
+
throw new GraphQLError("Argument \"".concat(name, "\" of required type \"").concat(inspect(argType), "\" ") + 'was not provided.', node);
|
|
161
161
|
}
|
|
162
162
|
} else if (hasValue) {
|
|
163
163
|
if (argumentNode.value.kind === Kind.NULL) {
|
|
@@ -179,7 +179,7 @@ export function getArgumentValues(def, node, variableValues) {
|
|
|
179
179
|
// Note: ValuesOfCorrectType validation should catch this before
|
|
180
180
|
// execution. This is a runtime check to ensure execution does not
|
|
181
181
|
// continue with an invalid argument value.
|
|
182
|
-
throw new GraphQLError("Argument \"".concat(name, "\" has invalid value ").concat(print(valueNode), "."),
|
|
182
|
+
throw new GraphQLError("Argument \"".concat(name, "\" has invalid value ").concat(print(valueNode), "."), argumentNode.value);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
coercedValues[name] = coercedValue;
|
|
@@ -213,4 +213,4 @@ export function getDirectiveValues(directiveDef, node, variableValues) {
|
|
|
213
213
|
|
|
214
214
|
function hasOwnProperty(obj, prop) {
|
|
215
215
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
216
|
-
}
|
|
216
|
+
}
|
package/graphql.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.graphql = graphql;
|
|
7
7
|
exports.graphqlSync = graphqlSync;
|
|
8
8
|
|
|
9
|
+
var _isPromise = _interopRequireDefault(require("./jsutils/isPromise"));
|
|
10
|
+
|
|
9
11
|
var _validate = require("./type/validate");
|
|
10
12
|
|
|
11
13
|
var _parser = require("./language/parser");
|
|
@@ -14,22 +16,24 @@ var _validate2 = require("./validation/validate");
|
|
|
14
16
|
|
|
15
17
|
var _execute = require("./execution/execute");
|
|
16
18
|
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
17
21
|
/**
|
|
18
|
-
* Copyright (c)
|
|
22
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
23
|
*
|
|
20
24
|
* This source code is licensed under the MIT license found in the
|
|
21
25
|
* LICENSE file in the root directory of this source tree.
|
|
22
26
|
*
|
|
23
27
|
*
|
|
24
28
|
*/
|
|
25
|
-
function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
29
|
+
function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
26
30
|
var _arguments = arguments;
|
|
27
31
|
|
|
28
32
|
/* eslint-enable no-redeclare */
|
|
29
33
|
// Always return a Promise for a consistent API.
|
|
30
34
|
return new Promise(function (resolve) {
|
|
31
35
|
return resolve( // Extract arguments from object args if provided.
|
|
32
|
-
_arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver));
|
|
36
|
+
_arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver));
|
|
33
37
|
});
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
@@ -40,19 +44,19 @@ function graphql(argsOrSchema, source, rootValue, contextValue, variableValues,
|
|
|
40
44
|
*/
|
|
41
45
|
|
|
42
46
|
|
|
43
|
-
function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
47
|
+
function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
44
48
|
/* eslint-enable no-redeclare */
|
|
45
49
|
// Extract arguments from object args if provided.
|
|
46
|
-
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver); // Assert that the execution was synchronous.
|
|
50
|
+
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
|
|
47
51
|
|
|
48
|
-
if (
|
|
52
|
+
if ((0, _isPromise.default)(result)) {
|
|
49
53
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
return result;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
function graphqlImpl(schema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
59
|
+
function graphqlImpl(schema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
56
60
|
// Validate Schema
|
|
57
61
|
var schemaValidationErrors = (0, _validate.validateSchema)(schema);
|
|
58
62
|
|
|
@@ -83,5 +87,5 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
|
|
|
83
87
|
} // Execute
|
|
84
88
|
|
|
85
89
|
|
|
86
|
-
return (0, _execute.execute)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver);
|
|
87
|
-
}
|
|
90
|
+
return (0, _execute.execute)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
|
|
91
|
+
}
|
package/graphql.js.flow
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import isPromise from './jsutils/isPromise';
|
|
10
11
|
import { validateSchema } from './type/validate';
|
|
11
12
|
import { parse } from './language/parser';
|
|
12
13
|
import { validate } from './validation/validate';
|
|
13
|
-
import { execute } from './execution/execute';
|
|
14
|
-
import type
|
|
15
|
-
import type
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
import { type ExecutionResult, execute } from './execution/execute';
|
|
15
|
+
import { type ObjMap } from './jsutils/ObjMap';
|
|
16
|
+
import { type Source } from './language/source';
|
|
17
|
+
import {
|
|
18
|
+
type GraphQLFieldResolver,
|
|
19
|
+
type GraphQLTypeResolver,
|
|
20
|
+
} from './type/definition';
|
|
21
|
+
import { type GraphQLSchema } from './type/schema';
|
|
22
|
+
import { type PromiseOrValue } from './jsutils/PromiseOrValue';
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* This is the primary entry point function for fulfilling GraphQL operations
|
|
@@ -52,6 +55,10 @@ import type { MaybePromise } from './jsutils/MaybePromise';
|
|
|
52
55
|
* A resolver function to use when one is not provided by the schema.
|
|
53
56
|
* If not provided, the default field resolver is used (which looks for a
|
|
54
57
|
* value or method on the source value with the field's name).
|
|
58
|
+
* typeResolver:
|
|
59
|
+
* A type resolver function to use when none is provided by the schema.
|
|
60
|
+
* If not provided, the default type resolver is used (which looks for a
|
|
61
|
+
* `__typename` field or alternatively calls the `isTypeOf` method).
|
|
55
62
|
*/
|
|
56
63
|
export type GraphQLArgs = {|
|
|
57
64
|
schema: GraphQLSchema,
|
|
@@ -61,6 +68,7 @@ export type GraphQLArgs = {|
|
|
|
61
68
|
variableValues?: ?ObjMap<mixed>,
|
|
62
69
|
operationName?: ?string,
|
|
63
70
|
fieldResolver?: ?GraphQLFieldResolver<any, any>,
|
|
71
|
+
typeResolver?: ?GraphQLTypeResolver<any, any>,
|
|
64
72
|
|};
|
|
65
73
|
declare function graphql(GraphQLArgs, ..._: []): Promise<ExecutionResult>;
|
|
66
74
|
/* eslint-disable no-redeclare */
|
|
@@ -72,6 +80,7 @@ declare function graphql(
|
|
|
72
80
|
variableValues?: ?ObjMap<mixed>,
|
|
73
81
|
operationName?: ?string,
|
|
74
82
|
fieldResolver?: ?GraphQLFieldResolver<any, any>,
|
|
83
|
+
typeResolver?: ?GraphQLTypeResolver<any, any>,
|
|
75
84
|
): Promise<ExecutionResult>;
|
|
76
85
|
export function graphql(
|
|
77
86
|
argsOrSchema,
|
|
@@ -81,6 +90,7 @@ export function graphql(
|
|
|
81
90
|
variableValues,
|
|
82
91
|
operationName,
|
|
83
92
|
fieldResolver,
|
|
93
|
+
typeResolver,
|
|
84
94
|
) {
|
|
85
95
|
/* eslint-enable no-redeclare */
|
|
86
96
|
// Always return a Promise for a consistent API.
|
|
@@ -96,6 +106,7 @@ export function graphql(
|
|
|
96
106
|
argsOrSchema.variableValues,
|
|
97
107
|
argsOrSchema.operationName,
|
|
98
108
|
argsOrSchema.fieldResolver,
|
|
109
|
+
argsOrSchema.typeResolver,
|
|
99
110
|
)
|
|
100
111
|
: graphqlImpl(
|
|
101
112
|
argsOrSchema,
|
|
@@ -105,6 +116,7 @@ export function graphql(
|
|
|
105
116
|
variableValues,
|
|
106
117
|
operationName,
|
|
107
118
|
fieldResolver,
|
|
119
|
+
typeResolver,
|
|
108
120
|
),
|
|
109
121
|
),
|
|
110
122
|
);
|
|
@@ -126,6 +138,7 @@ declare function graphqlSync(
|
|
|
126
138
|
variableValues?: ?ObjMap<mixed>,
|
|
127
139
|
operationName?: ?string,
|
|
128
140
|
fieldResolver?: ?GraphQLFieldResolver<any, any>,
|
|
141
|
+
typeResolver?: ?GraphQLTypeResolver<any, any>,
|
|
129
142
|
): ExecutionResult;
|
|
130
143
|
export function graphqlSync(
|
|
131
144
|
argsOrSchema,
|
|
@@ -135,6 +148,7 @@ export function graphqlSync(
|
|
|
135
148
|
variableValues,
|
|
136
149
|
operationName,
|
|
137
150
|
fieldResolver,
|
|
151
|
+
typeResolver,
|
|
138
152
|
) {
|
|
139
153
|
/* eslint-enable no-redeclare */
|
|
140
154
|
// Extract arguments from object args if provided.
|
|
@@ -148,6 +162,7 @@ export function graphqlSync(
|
|
|
148
162
|
argsOrSchema.variableValues,
|
|
149
163
|
argsOrSchema.operationName,
|
|
150
164
|
argsOrSchema.fieldResolver,
|
|
165
|
+
argsOrSchema.typeResolver,
|
|
151
166
|
)
|
|
152
167
|
: graphqlImpl(
|
|
153
168
|
argsOrSchema,
|
|
@@ -157,10 +172,11 @@ export function graphqlSync(
|
|
|
157
172
|
variableValues,
|
|
158
173
|
operationName,
|
|
159
174
|
fieldResolver,
|
|
175
|
+
typeResolver,
|
|
160
176
|
);
|
|
161
177
|
|
|
162
178
|
// Assert that the execution was synchronous.
|
|
163
|
-
if (result
|
|
179
|
+
if (isPromise(result)) {
|
|
164
180
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
165
181
|
}
|
|
166
182
|
|
|
@@ -175,7 +191,8 @@ function graphqlImpl(
|
|
|
175
191
|
variableValues,
|
|
176
192
|
operationName,
|
|
177
193
|
fieldResolver,
|
|
178
|
-
|
|
194
|
+
typeResolver,
|
|
195
|
+
): PromiseOrValue<ExecutionResult> {
|
|
179
196
|
// Validate Schema
|
|
180
197
|
const schemaValidationErrors = validateSchema(schema);
|
|
181
198
|
if (schemaValidationErrors.length > 0) {
|
|
@@ -205,5 +222,6 @@ function graphqlImpl(
|
|
|
205
222
|
variableValues,
|
|
206
223
|
operationName,
|
|
207
224
|
fieldResolver,
|
|
225
|
+
typeResolver,
|
|
208
226
|
);
|
|
209
227
|
}
|
package/graphql.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
+
import isPromise from './jsutils/isPromise';
|
|
9
10
|
import { validateSchema } from './type/validate';
|
|
10
11
|
import { parse } from './language/parser';
|
|
11
12
|
import { validate } from './validation/validate';
|
|
12
13
|
import { execute } from './execution/execute';
|
|
13
|
-
export function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
14
|
+
export function graphql(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
14
15
|
var _arguments = arguments;
|
|
15
16
|
|
|
16
17
|
/* eslint-enable no-redeclare */
|
|
17
18
|
// Always return a Promise for a consistent API.
|
|
18
19
|
return new Promise(function (resolve) {
|
|
19
20
|
return resolve( // Extract arguments from object args if provided.
|
|
20
|
-
_arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver));
|
|
21
|
+
_arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver));
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -27,19 +28,19 @@ export function graphql(argsOrSchema, source, rootValue, contextValue, variableV
|
|
|
27
28
|
* that all field resolvers are also synchronous.
|
|
28
29
|
*/
|
|
29
30
|
|
|
30
|
-
export function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
31
|
+
export function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
31
32
|
/* eslint-enable no-redeclare */
|
|
32
33
|
// Extract arguments from object args if provided.
|
|
33
|
-
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver); // Assert that the execution was synchronous.
|
|
34
|
+
var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
|
|
34
35
|
|
|
35
|
-
if (result
|
|
36
|
+
if (isPromise(result)) {
|
|
36
37
|
throw new Error('GraphQL execution failed to complete synchronously.');
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
return result;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
function graphqlImpl(schema, source, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
43
|
+
function graphqlImpl(schema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
|
|
43
44
|
// Validate Schema
|
|
44
45
|
var schemaValidationErrors = validateSchema(schema);
|
|
45
46
|
|
|
@@ -70,5 +71,5 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
|
|
|
70
71
|
} // Execute
|
|
71
72
|
|
|
72
73
|
|
|
73
|
-
return execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver);
|
|
74
|
-
}
|
|
74
|
+
return execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
|
|
75
|
+
}
|