graphql 0.12.3 → 0.13.2
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/error/GraphQLError.js +2 -3
- package/error/GraphQLError.js.flow +3 -4
- package/{module/error/GraphQLError.js → error/GraphQLError.mjs} +2 -3
- package/error/formatError.js +1 -1
- package/error/formatError.js.flow +1 -1
- package/{module/error/formatError.js → error/formatError.mjs} +1 -1
- package/error/index.js.flow +1 -1
- package/{module/error/index.js → error/index.mjs} +1 -1
- package/error/locatedError.js +2 -1
- package/error/locatedError.js.flow +2 -1
- package/{module/error/locatedError.js → error/locatedError.mjs} +2 -1
- package/error/printError.js +1 -1
- package/error/printError.js.flow +1 -1
- package/{module/error/printError.js → error/printError.mjs} +1 -1
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.js.flow +1 -1
- package/{module/error/syntaxError.js → error/syntaxError.mjs} +1 -1
- package/execution/execute.js +70 -90
- package/execution/execute.js.flow +83 -106
- package/{module/execution/execute.js → execution/execute.mjs} +53 -81
- package/execution/index.js.flow +1 -1
- package/{module/execution/index.js → execution/index.mjs} +1 -1
- package/execution/values.js +2 -6
- package/execution/values.js.flow +6 -7
- package/{module/execution/values.js → execution/values.mjs} +2 -2
- package/graphql.js +1 -1
- package/graphql.js.flow +3 -2
- package/{module/graphql.js → graphql.mjs} +1 -1
- package/index.js +24 -6
- package/index.js.flow +16 -2
- package/{module/index.js → index.mjs} +10 -2
- package/jsutils/MaybePromise.js +1 -0
- package/{module/jsutils/ObjMap.js.flow → jsutils/MaybePromise.js.flow} +2 -2
- package/{module/jsutils/ObjMap.js → jsutils/MaybePromise.mjs} +0 -0
- package/jsutils/ObjMap.js.flow +1 -1
- package/{module/language/ast.js → jsutils/ObjMap.mjs} +0 -0
- package/jsutils/dedent.js +23 -18
- package/jsutils/dedent.js.flow +21 -20
- package/jsutils/dedent.mjs +50 -0
- package/jsutils/find.js +1 -1
- package/jsutils/find.js.flow +1 -1
- package/{module/jsutils/find.js → jsutils/find.mjs} +1 -1
- package/jsutils/instanceOf.js +17 -16
- package/jsutils/instanceOf.js.flow +21 -15
- package/jsutils/instanceOf.mjs +31 -0
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.js.flow +1 -1
- package/{module/jsutils/invariant.js → jsutils/invariant.mjs} +1 -1
- package/jsutils/isInvalid.js +1 -1
- package/jsutils/isInvalid.js.flow +1 -1
- package/{module/jsutils/isInvalid.js → jsutils/isInvalid.mjs} +1 -1
- package/jsutils/isNullish.js +1 -1
- package/jsutils/isNullish.js.flow +1 -1
- package/{module/jsutils/isNullish.js → jsutils/isNullish.mjs} +1 -1
- package/jsutils/isPromise.js +24 -0
- package/jsutils/isPromise.js.flow +20 -0
- package/jsutils/isPromise.mjs +18 -0
- package/jsutils/keyMap.js +1 -1
- package/jsutils/keyMap.js.flow +1 -1
- package/{module/jsutils/keyMap.js → jsutils/keyMap.mjs} +1 -1
- package/jsutils/keyValMap.js +1 -1
- package/jsutils/keyValMap.js.flow +1 -1
- package/{module/jsutils/keyValMap.js → jsutils/keyValMap.mjs} +1 -1
- package/jsutils/memoize3.js +48 -0
- package/jsutils/memoize3.js.flow +44 -0
- package/jsutils/memoize3.mjs +42 -0
- package/jsutils/objectValues.js +24 -0
- package/jsutils/objectValues.js.flow +18 -0
- package/jsutils/objectValues.mjs +19 -0
- package/jsutils/orList.js +1 -1
- package/jsutils/orList.js.flow +1 -1
- package/{module/jsutils/orList.js → jsutils/orList.mjs} +1 -1
- package/jsutils/promiseForObject.js +34 -0
- package/jsutils/promiseForObject.js.flow +30 -0
- package/jsutils/promiseForObject.mjs +28 -0
- package/jsutils/promiseReduce.js +34 -0
- package/jsutils/promiseReduce.js.flow +32 -0
- package/jsutils/promiseReduce.mjs +26 -0
- package/jsutils/quotedOrList.js +1 -1
- package/jsutils/quotedOrList.js.flow +1 -1
- package/{module/jsutils/quotedOrList.js → jsutils/quotedOrList.mjs} +1 -1
- package/jsutils/suggestionList.js +1 -1
- package/jsutils/suggestionList.js.flow +1 -1
- package/{module/jsutils/suggestionList.js → jsutils/suggestionList.mjs} +1 -1
- package/language/ast.js.flow +3 -30
- package/language/ast.mjs +0 -0
- package/language/blockStringValue.js +1 -1
- package/language/blockStringValue.js.flow +1 -1
- package/{module/language/blockStringValue.js → language/blockStringValue.mjs} +1 -1
- package/language/directiveLocation.js +3 -3
- package/language/directiveLocation.js.flow +4 -4
- package/{module/language/directiveLocation.js → language/directiveLocation.mjs} +3 -3
- package/language/index.js +10 -10
- package/language/index.js.flow +5 -4
- package/{module/language/index.js → language/index.mjs} +3 -3
- package/language/kinds.js +70 -71
- package/language/kinds.js.flow +71 -71
- package/language/kinds.mjs +79 -0
- package/language/lexer.js +73 -87
- package/language/lexer.js.flow +87 -93
- package/{module/language/lexer.js → language/lexer.mjs} +73 -87
- package/language/location.js +1 -1
- package/language/location.js.flow +1 -1
- package/{module/language/location.js → language/location.mjs} +1 -1
- package/language/parser.js +68 -58
- package/language/parser.js.flow +104 -110
- package/{module/language/parser.js → language/parser.mjs} +69 -59
- package/language/printer.js +52 -55
- package/language/printer.js.flow +74 -120
- package/{module/language/printer.js → language/printer.mjs} +52 -55
- package/language/source.js +1 -1
- package/language/source.js.flow +1 -1
- package/{module/language/source.js → language/source.mjs} +1 -1
- package/language/visitor.js +1 -1
- package/language/visitor.js.flow +1 -1
- package/{module/language/visitor.js → language/visitor.mjs} +1 -1
- package/package.json +4 -9
- package/subscription/asyncIteratorReject.js +1 -1
- package/subscription/asyncIteratorReject.js.flow +1 -1
- package/{module/subscription/asyncIteratorReject.js → subscription/asyncIteratorReject.mjs} +1 -1
- package/subscription/index.js.flow +1 -1
- package/{module/subscription/index.js → subscription/index.mjs} +1 -1
- package/subscription/mapAsyncIterator.js +3 -1
- package/subscription/mapAsyncIterator.js.flow +7 -4
- package/{module/subscription/mapAsyncIterator.js → subscription/mapAsyncIterator.mjs} +4 -1
- package/subscription/subscribe.js +1 -1
- package/subscription/subscribe.js.flow +1 -1
- package/{module/subscription/subscribe.js → subscription/subscribe.mjs} +1 -1
- package/type/definition.js +76 -10
- package/type/definition.js.flow +105 -13
- package/{module/type/definition.js → type/definition.mjs} +72 -4
- package/type/directives.js +4 -4
- package/type/directives.js.flow +3 -3
- package/{module/type/directives.js → type/directives.mjs} +8 -8
- package/type/index.js +2 -5
- package/type/index.js.flow +6 -5
- package/{module/type/index.js → type/index.mjs} +3 -5
- package/type/introspection.js +34 -41
- package/type/introspection.js.flow +7 -10
- package/{module/type/introspection.js → type/introspection.mjs} +6 -15
- package/type/scalars.js +6 -10
- package/type/scalars.js.flow +2 -2
- package/{module/type/scalars.js → type/scalars.mjs} +2 -2
- package/type/schema.js +39 -15
- package/type/schema.js.flow +73 -22
- package/{module/type/schema.js → type/schema.mjs} +37 -16
- package/type/validate.js +33 -30
- package/type/validate.js.flow +40 -37
- package/{module/type/validate.js → type/validate.mjs} +30 -30
- package/utilities/TypeInfo.js +23 -27
- package/utilities/TypeInfo.js.flow +2 -2
- package/{module/utilities/TypeInfo.js → utilities/TypeInfo.mjs} +2 -2
- package/utilities/assertValidName.js +2 -6
- package/utilities/assertValidName.js.flow +2 -10
- package/{module/utilities/assertValidName.js → utilities/assertValidName.mjs} +2 -6
- package/utilities/astFromValue.js +37 -37
- package/utilities/astFromValue.js.flow +36 -44
- package/{module/utilities/astFromValue.js → utilities/astFromValue.mjs} +26 -25
- package/utilities/buildASTSchema.js +65 -82
- package/utilities/buildASTSchema.js.flow +52 -59
- package/{module/utilities/buildASTSchema.js → utilities/buildASTSchema.mjs} +48 -62
- package/utilities/buildClientSchema.js +12 -15
- package/utilities/buildClientSchema.js.flow +7 -11
- package/{module/utilities/buildClientSchema.js → utilities/buildClientSchema.mjs} +4 -5
- package/utilities/coerceValue.js +1 -1
- package/utilities/coerceValue.js.flow +1 -1
- package/{module/utilities/coerceValue.js → utilities/coerceValue.mjs} +1 -1
- package/utilities/concatAST.js +1 -1
- package/utilities/concatAST.js.flow +1 -1
- package/{module/utilities/concatAST.js → utilities/concatAST.mjs} +1 -1
- package/utilities/extendSchema.js +91 -77
- package/utilities/extendSchema.js.flow +93 -68
- package/{module/utilities/extendSchema.js → utilities/extendSchema.mjs} +65 -52
- package/utilities/findBreakingChanges.js +1 -1
- package/utilities/findBreakingChanges.js.flow +1 -1
- package/{module/utilities/findBreakingChanges.js → utilities/findBreakingChanges.mjs} +1 -1
- package/utilities/findDeprecatedUsages.js +1 -1
- package/utilities/findDeprecatedUsages.js.flow +1 -1
- package/{module/utilities/findDeprecatedUsages.js → utilities/findDeprecatedUsages.mjs} +1 -1
- package/utilities/getOperationAST.js +2 -2
- package/utilities/getOperationAST.js.flow +3 -3
- package/{module/utilities/getOperationAST.js → utilities/getOperationAST.mjs} +3 -3
- package/utilities/index.js +30 -0
- package/utilities/index.js.flow +10 -3
- package/{module/utilities/index.js → utilities/index.mjs} +10 -3
- package/utilities/introspectionFromSchema.js +43 -0
- package/utilities/introspectionFromSchema.js.flow +37 -0
- package/utilities/introspectionFromSchema.mjs +31 -0
- package/utilities/introspectionQuery.js +1 -1
- package/utilities/introspectionQuery.js.flow +1 -1
- package/{module/utilities/introspectionQuery.js → utilities/introspectionQuery.mjs} +1 -1
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.js.flow +1 -1
- package/{module/utilities/isValidJSValue.js → utilities/isValidJSValue.mjs} +1 -1
- package/utilities/isValidLiteralValue.js +8 -4
- package/utilities/isValidLiteralValue.js.flow +4 -4
- package/{module/utilities/isValidLiteralValue.js → utilities/isValidLiteralValue.mjs} +4 -4
- package/utilities/lexicographicSortSchema.js +243 -0
- package/utilities/lexicographicSortSchema.js.flow +198 -0
- package/utilities/lexicographicSortSchema.mjs +225 -0
- package/utilities/schemaPrinter.js +31 -29
- package/utilities/schemaPrinter.js.flow +28 -15
- package/{module/utilities/schemaPrinter.js → utilities/schemaPrinter.mjs} +21 -20
- package/utilities/separateOperations.js +1 -1
- package/utilities/separateOperations.js.flow +1 -1
- package/{module/utilities/separateOperations.js → utilities/separateOperations.mjs} +1 -1
- package/utilities/typeComparators.js +7 -10
- package/utilities/typeComparators.js.flow +7 -10
- package/{module/utilities/typeComparators.js → utilities/typeComparators.mjs} +7 -10
- package/utilities/typeFromAST.js +7 -11
- package/utilities/typeFromAST.js.flow +3 -3
- package/{module/utilities/typeFromAST.js → utilities/typeFromAST.mjs} +3 -3
- package/utilities/valueFromAST.js +26 -28
- package/utilities/valueFromAST.js.flow +14 -23
- package/{module/utilities/valueFromAST.js → utilities/valueFromAST.mjs} +9 -10
- package/utilities/valueFromASTUntyped.js +17 -22
- package/utilities/valueFromASTUntyped.js.flow +6 -7
- package/{module/utilities/valueFromASTUntyped.js → utilities/valueFromASTUntyped.mjs} +6 -7
- package/validation/ValidationContext.js +184 -0
- package/{module/validation/validate.js.flow → validation/ValidationContext.js.flow} +4 -60
- package/{module/validation/validate.js → validation/ValidationContext.mjs} +15 -57
- package/validation/index.js +12 -7
- package/validation/index.js.flow +6 -2
- package/{module/validation/index.js → validation/index.mjs} +6 -2
- package/validation/rules/ExecutableDefinitions.js +3 -3
- package/validation/rules/ExecutableDefinitions.js.flow +6 -10
- package/{module/validation/rules/ExecutableDefinitions.js → validation/rules/ExecutableDefinitions.mjs} +4 -4
- package/validation/rules/FieldsOnCorrectType.js +1 -1
- package/validation/rules/FieldsOnCorrectType.js.flow +2 -2
- package/{module/validation/rules/FieldsOnCorrectType.js → validation/rules/FieldsOnCorrectType.mjs} +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.js.flow +2 -2
- package/{module/validation/rules/FragmentsOnCompositeTypes.js → validation/rules/FragmentsOnCompositeTypes.mjs} +1 -1
- package/validation/rules/KnownArgumentNames.js +3 -3
- package/validation/rules/KnownArgumentNames.js.flow +6 -8
- package/{module/validation/rules/KnownArgumentNames.js → validation/rules/KnownArgumentNames.mjs} +4 -4
- package/validation/rules/KnownDirectives.js +23 -27
- package/validation/rules/KnownDirectives.js.flow +3 -3
- package/{module/validation/rules/KnownDirectives.js → validation/rules/KnownDirectives.mjs} +2 -2
- package/validation/rules/KnownFragmentNames.js +1 -1
- package/validation/rules/KnownFragmentNames.js.flow +2 -2
- package/{module/validation/rules/KnownFragmentNames.js → validation/rules/KnownFragmentNames.mjs} +1 -1
- package/validation/rules/KnownTypeNames.js +1 -1
- package/validation/rules/KnownTypeNames.js.flow +2 -2
- package/{module/validation/rules/KnownTypeNames.js → validation/rules/KnownTypeNames.mjs} +1 -1
- package/validation/rules/LoneAnonymousOperation.js +2 -2
- package/validation/rules/LoneAnonymousOperation.js.flow +4 -4
- package/{module/validation/rules/LoneAnonymousOperation.js → validation/rules/LoneAnonymousOperation.mjs} +3 -3
- package/validation/rules/NoFragmentCycles.js +1 -1
- package/validation/rules/NoFragmentCycles.js.flow +2 -2
- package/{module/validation/rules/NoFragmentCycles.js → validation/rules/NoFragmentCycles.mjs} +1 -1
- package/validation/rules/NoUndefinedVariables.js +1 -1
- package/validation/rules/NoUndefinedVariables.js.flow +2 -2
- package/{module/validation/rules/NoUndefinedVariables.js → validation/rules/NoUndefinedVariables.mjs} +1 -1
- package/validation/rules/NoUnusedFragments.js +1 -1
- package/validation/rules/NoUnusedFragments.js.flow +2 -2
- package/{module/validation/rules/NoUnusedFragments.js → validation/rules/NoUnusedFragments.mjs} +1 -1
- package/validation/rules/NoUnusedVariables.js +1 -1
- package/validation/rules/NoUnusedVariables.js.flow +2 -2
- package/{module/validation/rules/NoUnusedVariables.js → validation/rules/NoUnusedVariables.mjs} +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.js +4 -8
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +3 -3
- package/{module/validation/rules/OverlappingFieldsCanBeMerged.js → validation/rules/OverlappingFieldsCanBeMerged.mjs} +2 -2
- package/validation/rules/PossibleFragmentSpreads.js +1 -1
- package/validation/rules/PossibleFragmentSpreads.js.flow +2 -2
- package/{module/validation/rules/PossibleFragmentSpreads.js → validation/rules/PossibleFragmentSpreads.mjs} +1 -1
- package/validation/rules/ProvidedNonNullArguments.js +1 -1
- package/validation/rules/ProvidedNonNullArguments.js.flow +2 -2
- package/{module/validation/rules/ProvidedNonNullArguments.js → validation/rules/ProvidedNonNullArguments.mjs} +1 -1
- package/validation/rules/ScalarLeafs.js +1 -1
- package/validation/rules/ScalarLeafs.js.flow +2 -2
- package/{module/validation/rules/ScalarLeafs.js → validation/rules/ScalarLeafs.mjs} +1 -1
- package/validation/rules/SingleFieldSubscriptions.js +1 -1
- package/validation/rules/SingleFieldSubscriptions.js.flow +2 -2
- package/{module/validation/rules/SingleFieldSubscriptions.js → validation/rules/SingleFieldSubscriptions.mjs} +1 -1
- package/validation/rules/UniqueArgumentNames.js +1 -1
- package/validation/rules/UniqueArgumentNames.js.flow +2 -2
- package/{module/validation/rules/UniqueArgumentNames.js → validation/rules/UniqueArgumentNames.mjs} +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.js +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +2 -2
- package/{module/validation/rules/UniqueDirectivesPerLocation.js → validation/rules/UniqueDirectivesPerLocation.mjs} +1 -1
- package/validation/rules/UniqueFragmentNames.js +1 -1
- package/validation/rules/UniqueFragmentNames.js.flow +2 -2
- package/{module/validation/rules/UniqueFragmentNames.js → validation/rules/UniqueFragmentNames.mjs} +1 -1
- package/validation/rules/UniqueInputFieldNames.js +1 -1
- package/validation/rules/UniqueInputFieldNames.js.flow +2 -2
- package/{module/validation/rules/UniqueInputFieldNames.js → validation/rules/UniqueInputFieldNames.mjs} +1 -1
- package/validation/rules/UniqueOperationNames.js +1 -1
- package/validation/rules/UniqueOperationNames.js.flow +2 -2
- package/{module/validation/rules/UniqueOperationNames.js → validation/rules/UniqueOperationNames.mjs} +1 -1
- package/validation/rules/UniqueVariableNames.js +1 -1
- package/validation/rules/UniqueVariableNames.js.flow +2 -2
- package/{module/validation/rules/UniqueVariableNames.js → validation/rules/UniqueVariableNames.mjs} +1 -1
- package/validation/rules/ValuesOfCorrectType.js +1 -1
- package/validation/rules/ValuesOfCorrectType.js.flow +2 -2
- package/{module/validation/rules/ValuesOfCorrectType.js → validation/rules/ValuesOfCorrectType.mjs} +1 -1
- package/validation/rules/VariablesAreInputTypes.js +1 -1
- package/validation/rules/VariablesAreInputTypes.js.flow +2 -2
- package/{module/validation/rules/VariablesAreInputTypes.js → validation/rules/VariablesAreInputTypes.mjs} +1 -1
- package/validation/rules/VariablesDefaultValueAllowed.js +1 -1
- package/validation/rules/VariablesDefaultValueAllowed.js.flow +2 -2
- package/{module/validation/rules/VariablesDefaultValueAllowed.js → validation/rules/VariablesDefaultValueAllowed.mjs} +1 -1
- package/validation/rules/VariablesInAllowedPosition.js +9 -11
- package/validation/rules/VariablesInAllowedPosition.js.flow +3 -4
- package/{module/validation/rules/VariablesInAllowedPosition.js → validation/rules/VariablesInAllowedPosition.mjs} +2 -3
- package/validation/specifiedRules.js +1 -1
- package/validation/specifiedRules.js.flow +2 -2
- package/{module/validation/specifiedRules.js → validation/specifiedRules.mjs} +1 -1
- package/validation/validate.js +14 -175
- package/validation/validate.js.flow +3 -209
- package/validation/validate.mjs +57 -0
- package/module/error/GraphQLError.js.flow +0 -209
- package/module/error/formatError.js.flow +0 -34
- package/module/error/index.js.flow +0 -16
- package/module/error/locatedError.js.flow +0 -37
- package/module/error/printError.js.flow +0 -82
- package/module/error/syntaxError.js.flow +0 -25
- package/module/execution/execute.js.flow +0 -1375
- package/module/execution/index.js.flow +0 -13
- package/module/execution/values.js.flow +0 -206
- package/module/graphql.js.flow +0 -202
- package/module/index.js.flow +0 -389
- package/module/jsutils/dedent.js +0 -45
- package/module/jsutils/dedent.js.flow +0 -49
- package/module/jsutils/find.js.flow +0 -19
- package/module/jsutils/instanceOf.js +0 -27
- package/module/jsutils/instanceOf.js.flow +0 -44
- package/module/jsutils/invariant.js.flow +0 -15
- package/module/jsutils/isInvalid.js.flow +0 -15
- package/module/jsutils/isNullish.js.flow +0 -15
- package/module/jsutils/keyMap.js.flow +0 -43
- package/module/jsutils/keyValMap.js.flow +0 -38
- package/module/jsutils/orList.js.flow +0 -24
- package/module/jsutils/quotedOrList.js.flow +0 -17
- package/module/jsutils/suggestionList.js.flow +0 -94
- package/module/language/ast.js.flow +0 -594
- package/module/language/blockStringValue.js.flow +0 -64
- package/module/language/directiveLocation.js.flow +0 -39
- package/module/language/index.js.flow +0 -84
- package/module/language/kinds.js +0 -80
- package/module/language/kinds.js.flow +0 -80
- package/module/language/lexer.js.flow +0 -762
- package/module/language/location.js.flow +0 -34
- package/module/language/parser.js.flow +0 -1537
- package/module/language/printer.js.flow +0 -311
- package/module/language/source.js.flow +0 -43
- package/module/language/visitor.js.flow +0 -476
- package/module/subscription/asyncIteratorReject.js.flow +0 -41
- package/module/subscription/index.js.flow +0 -10
- package/module/subscription/mapAsyncIterator.js.flow +0 -78
- package/module/subscription/subscribe.js.flow +0 -288
- package/module/type/definition.js.flow +0 -1225
- package/module/type/directives.js.flow +0 -168
- package/module/type/index.js.flow +0 -156
- package/module/type/introspection.js.flow +0 -482
- package/module/type/scalars.js.flow +0 -158
- package/module/type/schema.js.flow +0 -271
- package/module/type/validate.js.flow +0 -723
- package/module/type/wrappers.js +0 -80
- package/module/type/wrappers.js.flow +0 -91
- package/module/utilities/TypeInfo.js.flow +0 -296
- package/module/utilities/assertValidName.js.flow +0 -56
- package/module/utilities/astFromValue.js.flow +0 -159
- package/module/utilities/buildASTSchema.js.flow +0 -518
- package/module/utilities/buildClientSchema.js.flow +0 -418
- package/module/utilities/coerceValue.js.flow +0 -257
- package/module/utilities/concatAST.js.flow +0 -29
- package/module/utilities/extendSchema.js.flow +0 -374
- package/module/utilities/findBreakingChanges.js.flow +0 -851
- package/module/utilities/findDeprecatedUsages.js.flow +0 -68
- package/module/utilities/getOperationAST.js.flow +0 -40
- package/module/utilities/index.js.flow +0 -111
- package/module/utilities/introspectionQuery.js.flow +0 -271
- package/module/utilities/isValidJSValue.js.flow +0 -22
- package/module/utilities/isValidLiteralValue.js.flow +0 -36
- package/module/utilities/schemaPrinter.js.flow +0 -402
- package/module/utilities/separateOperations.js.flow +0 -100
- package/module/utilities/typeComparators.js.flow +0 -135
- package/module/utilities/typeFromAST.js.flow +0 -56
- package/module/utilities/valueFromAST.js.flow +0 -184
- package/module/utilities/valueFromASTUntyped.js.flow +0 -64
- package/module/validation/index.js.flow +0 -138
- package/module/validation/rules/ExecutableDefinitions.js.flow +0 -52
- package/module/validation/rules/FieldsOnCorrectType.js.flow +0 -144
- package/module/validation/rules/FragmentsOnCompositeTypes.js.flow +0 -74
- package/module/validation/rules/KnownArgumentNames.js.flow +0 -98
- package/module/validation/rules/KnownDirectives.js.flow +0 -116
- package/module/validation/rules/KnownFragmentNames.js.flow +0 -36
- package/module/validation/rules/KnownTypeNames.js.flow +0 -59
- package/module/validation/rules/LoneAnonymousOperation.js.flow +0 -41
- package/module/validation/rules/NoFragmentCycles.js.flow +0 -85
- package/module/validation/rules/NoUndefinedVariables.js.flow +0 -57
- package/module/validation/rules/NoUnusedFragments.js.flow +0 -59
- package/module/validation/rules/NoUnusedVariables.js.flow +0 -62
- package/module/validation/rules/OverlappingFieldsCanBeMerged.js.flow +0 -847
- package/module/validation/rules/PossibleFragmentSpreads.js.flow +0 -94
- package/module/validation/rules/ProvidedNonNullArguments.js.flow +0 -105
- package/module/validation/rules/ScalarLeafs.js.flow +0 -69
- package/module/validation/rules/SingleFieldSubscriptions.js.flow +0 -44
- package/module/validation/rules/UniqueArgumentNames.js.flow +0 -48
- package/module/validation/rules/UniqueDirectivesPerLocation.js.flow +0 -57
- package/module/validation/rules/UniqueFragmentNames.js.flow +0 -42
- package/module/validation/rules/UniqueInputFieldNames.js.flow +0 -53
- package/module/validation/rules/UniqueOperationNames.js.flow +0 -44
- package/module/validation/rules/UniqueVariableNames.js.flow +0 -44
- package/module/validation/rules/ValuesOfCorrectType.js.flow +0 -218
- package/module/validation/rules/VariablesAreInputTypes.js.flow +0 -48
- package/module/validation/rules/VariablesDefaultValueAllowed.js.flow +0 -55
- package/module/validation/rules/VariablesInAllowedPosition.js.flow +0 -83
- package/module/validation/specifiedRules.js.flow +0 -127
- package/type/wrappers.js +0 -89
- package/type/wrappers.js.flow +0 -91
package/error/GraphQLError.js
CHANGED
|
@@ -21,7 +21,7 @@ var _location = require('../language/location');
|
|
|
21
21
|
* This source code is licensed under the MIT license found in the
|
|
22
22
|
* LICENSE file in the root directory of this source tree.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* strict
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
function GraphQLError( // eslint-disable-line no-redeclare
|
|
@@ -51,9 +51,8 @@ message, nodes, source, positions, path, originalError, extensions) {
|
|
|
51
51
|
|
|
52
52
|
var _locations = void 0;
|
|
53
53
|
if (positions && source) {
|
|
54
|
-
var providedSource = source;
|
|
55
54
|
_locations = positions.map(function (pos) {
|
|
56
|
-
return (0, _location.getLocation)(
|
|
55
|
+
return (0, _location.getLocation)(source, pos);
|
|
57
56
|
});
|
|
58
57
|
} else if (_nodes) {
|
|
59
58
|
_locations = _nodes.reduce(function (list, node) {
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
* @flow
|
|
7
|
+
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { printError } from './printError';
|
|
@@ -84,7 +84,7 @@ declare class GraphQLError extends Error {
|
|
|
84
84
|
+originalError: ?Error;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Extension fields to add to the formatted error.
|
|
88
88
|
*/
|
|
89
89
|
+extensions: ?{ [key: string]: mixed };
|
|
90
90
|
}
|
|
@@ -125,8 +125,7 @@ export function GraphQLError( // eslint-disable-line no-redeclare
|
|
|
125
125
|
|
|
126
126
|
let _locations;
|
|
127
127
|
if (positions && source) {
|
|
128
|
-
|
|
129
|
-
_locations = positions.map(pos => getLocation(providedSource, pos));
|
|
128
|
+
_locations = positions.map(pos => getLocation(source, pos));
|
|
130
129
|
} else if (_nodes) {
|
|
131
130
|
_locations = _nodes.reduce((list, node) => {
|
|
132
131
|
if (node.loc) {
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
+
* strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { printError } from './printError';
|
|
@@ -45,9 +45,8 @@ message, nodes, source, positions, path, originalError, extensions) {
|
|
|
45
45
|
|
|
46
46
|
var _locations = void 0;
|
|
47
47
|
if (positions && source) {
|
|
48
|
-
var providedSource = source;
|
|
49
48
|
_locations = positions.map(function (pos) {
|
|
50
|
-
return getLocation(
|
|
49
|
+
return getLocation(source, pos);
|
|
51
50
|
});
|
|
52
51
|
} else if (_nodes) {
|
|
53
52
|
_locations = _nodes.reduce(function (list, node) {
|
package/error/formatError.js
CHANGED
|
@@ -10,7 +10,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* strict
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
exports.formatError = formatError;
|
|
@@ -6,7 +6,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* strict
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import invariant from '../jsutils/invariant';
|
package/error/index.js.flow
CHANGED
package/error/locatedError.js
CHANGED
|
@@ -15,6 +15,7 @@ var _GraphQLError = require('./GraphQLError');
|
|
|
15
15
|
function locatedError(originalError, nodes, path) {
|
|
16
16
|
// Note: this uses a brand-check to support GraphQL errors originating from
|
|
17
17
|
// other contexts.
|
|
18
|
+
// $FlowFixMe(>=0.68.0)
|
|
18
19
|
if (originalError && Array.isArray(originalError.path)) {
|
|
19
20
|
return originalError;
|
|
20
21
|
}
|
|
@@ -26,5 +27,5 @@ function locatedError(originalError, nodes, path) {
|
|
|
26
27
|
* This source code is licensed under the MIT license found in the
|
|
27
28
|
* LICENSE file in the root directory of this source tree.
|
|
28
29
|
*
|
|
29
|
-
*
|
|
30
|
+
* strict
|
|
30
31
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
* @flow
|
|
7
|
+
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { GraphQLError } from './GraphQLError';
|
|
@@ -22,6 +22,7 @@ export function locatedError(
|
|
|
22
22
|
): GraphQLError {
|
|
23
23
|
// Note: this uses a brand-check to support GraphQL errors originating from
|
|
24
24
|
// other contexts.
|
|
25
|
+
// $FlowFixMe(>=0.68.0)
|
|
25
26
|
if (originalError && Array.isArray(originalError.path)) {
|
|
26
27
|
return (originalError: any);
|
|
27
28
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
+
* strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { GraphQLError } from './GraphQLError';
|
|
@@ -18,6 +18,7 @@ import { GraphQLError } from './GraphQLError';
|
|
|
18
18
|
export function locatedError(originalError, nodes, path) {
|
|
19
19
|
// Note: this uses a brand-check to support GraphQL errors originating from
|
|
20
20
|
// other contexts.
|
|
21
|
+
// $FlowFixMe(>=0.68.0)
|
|
21
22
|
if (originalError && Array.isArray(originalError.path)) {
|
|
22
23
|
return originalError;
|
|
23
24
|
}
|
package/error/printError.js
CHANGED
package/error/printError.js.flow
CHANGED
package/error/syntaxError.js
CHANGED
|
@@ -17,7 +17,7 @@ var _GraphQLError = require('./GraphQLError');
|
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* strict
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
function syntaxError(source, position, description) {
|
|
@@ -11,7 +11,7 @@ import { GraphQLError } from './GraphQLError';
|
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* strict
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export function syntaxError(source, position, description) {
|
package/execution/execute.js
CHANGED
|
@@ -11,7 +11,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* strict
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
exports.execute = execute;
|
|
@@ -41,12 +41,26 @@ var _isNullish = require('../jsutils/isNullish');
|
|
|
41
41
|
|
|
42
42
|
var _isNullish2 = _interopRequireDefault(_isNullish);
|
|
43
43
|
|
|
44
|
+
var _isPromise = require('../jsutils/isPromise');
|
|
45
|
+
|
|
46
|
+
var _isPromise2 = _interopRequireDefault(_isPromise);
|
|
47
|
+
|
|
48
|
+
var _memoize = require('../jsutils/memoize3');
|
|
49
|
+
|
|
50
|
+
var _memoize2 = _interopRequireDefault(_memoize);
|
|
51
|
+
|
|
52
|
+
var _promiseForObject = require('../jsutils/promiseForObject');
|
|
53
|
+
|
|
54
|
+
var _promiseForObject2 = _interopRequireDefault(_promiseForObject);
|
|
55
|
+
|
|
56
|
+
var _promiseReduce = require('../jsutils/promiseReduce');
|
|
57
|
+
|
|
58
|
+
var _promiseReduce2 = _interopRequireDefault(_promiseReduce);
|
|
59
|
+
|
|
44
60
|
var _typeFromAST = require('../utilities/typeFromAST');
|
|
45
61
|
|
|
46
62
|
var _kinds = require('../language/kinds');
|
|
47
63
|
|
|
48
|
-
var Kind = _interopRequireWildcard(_kinds);
|
|
49
|
-
|
|
50
64
|
var _values = require('./values');
|
|
51
65
|
|
|
52
66
|
var _definition = require('../type/definition');
|
|
@@ -59,8 +73,6 @@ var _directives = require('../type/directives');
|
|
|
59
73
|
|
|
60
74
|
var _validate = require('../type/validate');
|
|
61
75
|
|
|
62
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
63
|
-
|
|
64
76
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
65
77
|
|
|
66
78
|
/**
|
|
@@ -148,9 +160,8 @@ function executeImpl(schema, document, rootValue, contextValue, variableValues,
|
|
|
148
160
|
* response defined by the "Response" section of the GraphQL specification.
|
|
149
161
|
*/
|
|
150
162
|
function buildResponse(context, data) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return promise.then(function (resolved) {
|
|
163
|
+
if ((0, _isPromise2.default)(data)) {
|
|
164
|
+
return data.then(function (resolved) {
|
|
154
165
|
return buildResponse(context, resolved);
|
|
155
166
|
});
|
|
156
167
|
}
|
|
@@ -207,14 +218,14 @@ function buildExecutionContext(schema, document, rootValue, contextValue, rawVar
|
|
|
207
218
|
for (var i = 0; i < document.definitions.length; i++) {
|
|
208
219
|
var definition = document.definitions[i];
|
|
209
220
|
switch (definition.kind) {
|
|
210
|
-
case Kind.OPERATION_DEFINITION:
|
|
221
|
+
case _kinds.Kind.OPERATION_DEFINITION:
|
|
211
222
|
if (!operationName && operation) {
|
|
212
223
|
hasMultipleAssumedOperations = true;
|
|
213
224
|
} else if (!operationName || definition.name && definition.name.value === operationName) {
|
|
214
225
|
operation = definition;
|
|
215
226
|
}
|
|
216
227
|
break;
|
|
217
|
-
case Kind.FRAGMENT_DEFINITION:
|
|
228
|
+
case _kinds.Kind.FRAGMENT_DEFINITION:
|
|
218
229
|
fragments[definition.name.value] = definition;
|
|
219
230
|
break;
|
|
220
231
|
}
|
|
@@ -276,9 +287,8 @@ function executeOperation(exeContext, operation, rootValue) {
|
|
|
276
287
|
// Similar to completeValueCatchingError.
|
|
277
288
|
try {
|
|
278
289
|
var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields);
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return promise.then(undefined, function (error) {
|
|
290
|
+
if ((0, _isPromise2.default)(result)) {
|
|
291
|
+
return result.then(undefined, function (error) {
|
|
282
292
|
exeContext.errors.push(error);
|
|
283
293
|
return Promise.resolve(null);
|
|
284
294
|
});
|
|
@@ -323,25 +333,22 @@ function getOperationRootType(schema, operation) {
|
|
|
323
333
|
* for "write" mode.
|
|
324
334
|
*/
|
|
325
335
|
function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) {
|
|
326
|
-
return Object.keys(fields)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (result === undefined) {
|
|
332
|
-
return results;
|
|
333
|
-
}
|
|
334
|
-
var promise = getPromise(result);
|
|
335
|
-
if (promise) {
|
|
336
|
-
return promise.then(function (resolvedResult) {
|
|
337
|
-
results[responseName] = resolvedResult;
|
|
338
|
-
return results;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
results[responseName] = result;
|
|
336
|
+
return (0, _promiseReduce2.default)(Object.keys(fields), function (results, responseName) {
|
|
337
|
+
var fieldNodes = fields[responseName];
|
|
338
|
+
var fieldPath = addPath(path, responseName);
|
|
339
|
+
var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath);
|
|
340
|
+
if (result === undefined) {
|
|
342
341
|
return results;
|
|
343
|
-
}
|
|
344
|
-
|
|
342
|
+
}
|
|
343
|
+
if ((0, _isPromise2.default)(result)) {
|
|
344
|
+
return result.then(function (resolvedResult) {
|
|
345
|
+
results[responseName] = resolvedResult;
|
|
346
|
+
return results;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
results[responseName] = result;
|
|
350
|
+
return results;
|
|
351
|
+
}, Object.create(null));
|
|
345
352
|
}
|
|
346
353
|
|
|
347
354
|
/**
|
|
@@ -359,7 +366,7 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
|
|
|
359
366
|
return results;
|
|
360
367
|
}
|
|
361
368
|
results[responseName] = result;
|
|
362
|
-
if (
|
|
369
|
+
if (!containsPromise && (0, _isPromise2.default)(result)) {
|
|
363
370
|
containsPromise = true;
|
|
364
371
|
}
|
|
365
372
|
return results;
|
|
@@ -374,7 +381,7 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
|
|
|
374
381
|
// of resolving that field, which is possibly a promise. Return
|
|
375
382
|
// a promise that will return this same map, but with any
|
|
376
383
|
// promises replaced with the values they resolved to.
|
|
377
|
-
return
|
|
384
|
+
return (0, _promiseForObject2.default)(finalResults);
|
|
378
385
|
}
|
|
379
386
|
|
|
380
387
|
/**
|
|
@@ -389,7 +396,7 @@ function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFra
|
|
|
389
396
|
for (var i = 0; i < selectionSet.selections.length; i++) {
|
|
390
397
|
var selection = selectionSet.selections[i];
|
|
391
398
|
switch (selection.kind) {
|
|
392
|
-
case Kind.FIELD:
|
|
399
|
+
case _kinds.Kind.FIELD:
|
|
393
400
|
if (!shouldIncludeNode(exeContext, selection)) {
|
|
394
401
|
continue;
|
|
395
402
|
}
|
|
@@ -399,13 +406,13 @@ function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFra
|
|
|
399
406
|
}
|
|
400
407
|
fields[name].push(selection);
|
|
401
408
|
break;
|
|
402
|
-
case Kind.INLINE_FRAGMENT:
|
|
409
|
+
case _kinds.Kind.INLINE_FRAGMENT:
|
|
403
410
|
if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
|
|
404
411
|
continue;
|
|
405
412
|
}
|
|
406
413
|
collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
|
|
407
414
|
break;
|
|
408
|
-
case Kind.FRAGMENT_SPREAD:
|
|
415
|
+
case _kinds.Kind.FRAGMENT_SPREAD:
|
|
409
416
|
var fragName = selection.name.value;
|
|
410
417
|
if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
|
|
411
418
|
continue;
|
|
@@ -457,26 +464,6 @@ function doesFragmentConditionMatch(exeContext, fragment, type) {
|
|
|
457
464
|
return false;
|
|
458
465
|
}
|
|
459
466
|
|
|
460
|
-
/**
|
|
461
|
-
* This function transforms a JS object `ObjMap<Promise<T>>` into
|
|
462
|
-
* a `Promise<ObjMap<T>>`
|
|
463
|
-
*
|
|
464
|
-
* This is akin to bluebird's `Promise.props`, but implemented only using
|
|
465
|
-
* `Promise.all` so it will work with any implementation of ES6 promises.
|
|
466
|
-
*/
|
|
467
|
-
function promiseForObject(object) {
|
|
468
|
-
var keys = Object.keys(object);
|
|
469
|
-
var valuesAndPromises = keys.map(function (name) {
|
|
470
|
-
return object[name];
|
|
471
|
-
});
|
|
472
|
-
return Promise.all(valuesAndPromises).then(function (values) {
|
|
473
|
-
return values.reduce(function (resolvedObject, value, i) {
|
|
474
|
-
resolvedObject[keys[i]] = value;
|
|
475
|
-
return resolvedObject;
|
|
476
|
-
}, Object.create(null));
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
467
|
/**
|
|
481
468
|
* Implements the logic to compute the key of a given field's entry
|
|
482
469
|
*/
|
|
@@ -542,8 +529,7 @@ function resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, s
|
|
|
542
529
|
var context = exeContext.contextValue;
|
|
543
530
|
|
|
544
531
|
var result = resolveFn(source, args, context, info);
|
|
545
|
-
|
|
546
|
-
return promise ? promise.then(undefined, asErrorInstance) : result;
|
|
532
|
+
return (0, _isPromise2.default)(result) ? result.then(undefined, asErrorInstance) : result;
|
|
547
533
|
} catch (error) {
|
|
548
534
|
return asErrorInstance(error);
|
|
549
535
|
}
|
|
@@ -568,13 +554,12 @@ function completeValueCatchingError(exeContext, returnType, fieldNodes, info, pa
|
|
|
568
554
|
// a null value for this field if one is encountered.
|
|
569
555
|
try {
|
|
570
556
|
var completed = completeValueWithLocatedError(exeContext, returnType, fieldNodes, info, path, result);
|
|
571
|
-
|
|
572
|
-
if (promise) {
|
|
557
|
+
if ((0, _isPromise2.default)(completed)) {
|
|
573
558
|
// If `completeValueWithLocatedError` returned a rejected promise, log
|
|
574
559
|
// the rejection error and resolve to null.
|
|
575
560
|
// Note: we don't rely on a `catch` method, but we do expect "thenable"
|
|
576
561
|
// to take a second callback for the error case.
|
|
577
|
-
return
|
|
562
|
+
return completed.then(undefined, function (error) {
|
|
578
563
|
exeContext.errors.push(error);
|
|
579
564
|
return Promise.resolve(null);
|
|
580
565
|
});
|
|
@@ -593,9 +578,8 @@ function completeValueCatchingError(exeContext, returnType, fieldNodes, info, pa
|
|
|
593
578
|
function completeValueWithLocatedError(exeContext, returnType, fieldNodes, info, path, result) {
|
|
594
579
|
try {
|
|
595
580
|
var completed = completeValue(exeContext, returnType, fieldNodes, info, path, result);
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
return promise.then(undefined, function (error) {
|
|
581
|
+
if ((0, _isPromise2.default)(completed)) {
|
|
582
|
+
return completed.then(undefined, function (error) {
|
|
599
583
|
return Promise.reject((0, _error.locatedError)(asErrorInstance(error), fieldNodes, responsePathAsArray(path)));
|
|
600
584
|
});
|
|
601
585
|
}
|
|
@@ -628,9 +612,8 @@ function completeValueWithLocatedError(exeContext, returnType, fieldNodes, info,
|
|
|
628
612
|
*/
|
|
629
613
|
function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
630
614
|
// If result is a Promise, apply-lift over completeValue.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
return promise.then(function (resolved) {
|
|
615
|
+
if ((0, _isPromise2.default)(result)) {
|
|
616
|
+
return result.then(function (resolved) {
|
|
634
617
|
return completeValue(exeContext, returnType, fieldNodes, info, path, resolved);
|
|
635
618
|
});
|
|
636
619
|
}
|
|
@@ -700,7 +683,7 @@ function completeListValue(exeContext, returnType, fieldNodes, info, path, resul
|
|
|
700
683
|
var fieldPath = addPath(path, index);
|
|
701
684
|
var completedItem = completeValueCatchingError(exeContext, itemType, fieldNodes, info, fieldPath, item);
|
|
702
685
|
|
|
703
|
-
if (!containsPromise &&
|
|
686
|
+
if (!containsPromise && (0, _isPromise2.default)(completedItem)) {
|
|
704
687
|
containsPromise = true;
|
|
705
688
|
}
|
|
706
689
|
completedResults.push(completedItem);
|
|
@@ -729,9 +712,8 @@ function completeLeafValue(returnType, result) {
|
|
|
729
712
|
function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) {
|
|
730
713
|
var runtimeType = returnType.resolveType ? returnType.resolveType(result, exeContext.contextValue, info) : defaultResolveTypeFn(result, exeContext.contextValue, info, returnType);
|
|
731
714
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return promise.then(function (resolvedRuntimeType) {
|
|
715
|
+
if ((0, _isPromise2.default)(runtimeType)) {
|
|
716
|
+
return runtimeType.then(function (resolvedRuntimeType) {
|
|
735
717
|
return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result);
|
|
736
718
|
});
|
|
737
719
|
}
|
|
@@ -763,10 +745,9 @@ function completeObjectValue(exeContext, returnType, fieldNodes, info, path, res
|
|
|
763
745
|
if (returnType.isTypeOf) {
|
|
764
746
|
var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
|
|
765
747
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
if (!isTypeOfResult) {
|
|
748
|
+
if ((0, _isPromise2.default)(isTypeOf)) {
|
|
749
|
+
return isTypeOf.then(function (resolvedIsTypeOf) {
|
|
750
|
+
if (!resolvedIsTypeOf) {
|
|
770
751
|
throw invalidReturnTypeError(returnType, result, fieldNodes);
|
|
771
752
|
}
|
|
772
753
|
return collectAndExecuteSubfields(exeContext, returnType, fieldNodes, info, path, result);
|
|
@@ -787,6 +768,17 @@ function invalidReturnTypeError(returnType, result, fieldNodes) {
|
|
|
787
768
|
|
|
788
769
|
function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, info, path, result) {
|
|
789
770
|
// Collect sub-fields to execute to complete this value.
|
|
771
|
+
var subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes);
|
|
772
|
+
return executeFields(exeContext, returnType, result, path, subFieldNodes);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* A memoized collection of relevant subfields in the context of the return
|
|
777
|
+
* type. Memoizing ensures the subfields are not repeatedly calculated, which
|
|
778
|
+
* saves overhead when resolving lists of values.
|
|
779
|
+
*/
|
|
780
|
+
var collectSubfields = (0, _memoize2.default)(_collectSubfields);
|
|
781
|
+
function _collectSubfields(exeContext, returnType, fieldNodes) {
|
|
790
782
|
var subFieldNodes = Object.create(null);
|
|
791
783
|
var visitedFragmentNames = Object.create(null);
|
|
792
784
|
for (var i = 0; i < fieldNodes.length; i++) {
|
|
@@ -795,8 +787,7 @@ function collectAndExecuteSubfields(exeContext, returnType, fieldNodes, info, pa
|
|
|
795
787
|
subFieldNodes = collectFields(exeContext, returnType, selectionSet, subFieldNodes, visitedFragmentNames);
|
|
796
788
|
}
|
|
797
789
|
}
|
|
798
|
-
|
|
799
|
-
return executeFields(exeContext, returnType, result, path, subFieldNodes);
|
|
790
|
+
return subFieldNodes;
|
|
800
791
|
}
|
|
801
792
|
|
|
802
793
|
/**
|
|
@@ -825,9 +816,8 @@ function defaultResolveTypeFn(value, context, info, abstractType) {
|
|
|
825
816
|
if (type.isTypeOf) {
|
|
826
817
|
var isTypeOfResult = type.isTypeOf(value, context, info);
|
|
827
818
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
promisedIsTypeOfResults[i] = promise;
|
|
819
|
+
if ((0, _isPromise2.default)(isTypeOfResult)) {
|
|
820
|
+
promisedIsTypeOfResults[i] = isTypeOfResult;
|
|
831
821
|
} else if (isTypeOfResult) {
|
|
832
822
|
return type;
|
|
833
823
|
}
|
|
@@ -862,16 +852,6 @@ var defaultFieldResolver = exports.defaultFieldResolver = function defaultFieldR
|
|
|
862
852
|
}
|
|
863
853
|
};
|
|
864
854
|
|
|
865
|
-
/**
|
|
866
|
-
* Only returns the value if it acts like a Promise, i.e. has a "then" function,
|
|
867
|
-
* otherwise returns void.
|
|
868
|
-
*/
|
|
869
|
-
function getPromise(value) {
|
|
870
|
-
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null && typeof value.then === 'function') {
|
|
871
|
-
return value;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
855
|
/**
|
|
876
856
|
* This method looks up the field on the given type defintion.
|
|
877
857
|
* It has special casing for the two introspection fields, __schema
|