graphql 15.0.0-alpha.1 → 15.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 +33 -4
- package/error/GraphQLError.d.ts +1 -1
- package/error/GraphQLError.js +228 -115
- package/error/GraphQLError.js.flow +138 -138
- package/error/GraphQLError.mjs +223 -117
- package/error/formatError.d.ts +1 -0
- package/error/formatError.js +3 -1
- package/error/formatError.js.flow +1 -1
- package/error/formatError.mjs +4 -2
- package/error/index.mjs +4 -4
- package/error/locatedError.d.ts +5 -2
- package/error/locatedError.js +4 -2
- package/error/locatedError.js.flow +7 -7
- package/error/locatedError.mjs +5 -3
- package/error/syntaxError.d.ts +1 -0
- package/error/syntaxError.mjs +1 -1
- package/execution/execute.d.ts +18 -25
- package/execution/execute.js +27 -21
- package/execution/execute.js.flow +35 -34
- package/execution/execute.mjs +44 -37
- package/execution/index.mjs +3 -3
- package/execution/values.d.ts +2 -6
- package/execution/values.js +8 -3
- package/execution/values.js.flow +21 -13
- package/execution/values.mjs +19 -14
- package/graphql.d.ts +7 -14
- package/graphql.js.flow +1 -1
- package/graphql.mjs +5 -5
- package/index.d.ts +21 -12
- package/index.js +239 -191
- package/index.js.flow +24 -15
- package/index.mjs +12 -11
- package/jsutils/Path.js.flow +4 -1
- package/jsutils/dedent.js +3 -1
- package/jsutils/dedent.js.flow +4 -1
- package/jsutils/dedent.mjs +3 -1
- package/jsutils/defineToJSON.js +1 -0
- package/jsutils/defineToJSON.js.flow +2 -0
- package/jsutils/defineToJSON.mjs +2 -1
- package/jsutils/devAssert.js +1 -0
- package/jsutils/devAssert.js.flow +1 -0
- package/jsutils/devAssert.mjs +1 -0
- package/jsutils/didYouMean.js.flow +1 -1
- package/jsutils/inspect.js +1 -1
- package/jsutils/inspect.js.flow +1 -1
- package/jsutils/inspect.mjs +2 -2
- package/jsutils/instanceOf.js +3 -1
- package/jsutils/instanceOf.js.flow +2 -1
- package/jsutils/instanceOf.mjs +3 -1
- package/jsutils/invariant.js +2 -1
- package/jsutils/invariant.js.flow +2 -1
- package/jsutils/invariant.mjs +2 -1
- package/jsutils/isCollection.js +47 -0
- package/jsutils/isCollection.js.flow +39 -0
- package/jsutils/isCollection.mjs +40 -0
- package/jsutils/isObjectLike.js +1 -1
- package/jsutils/isObjectLike.mjs +1 -1
- package/jsutils/isPromise.js +1 -1
- package/jsutils/isPromise.js.flow +1 -1
- package/jsutils/isPromise.mjs +1 -1
- package/jsutils/mapValue.mjs +1 -1
- package/jsutils/nodejsCustomInspectSymbol.js +2 -0
- package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -0
- package/jsutils/nodejsCustomInspectSymbol.mjs +1 -0
- package/jsutils/printPathArray.js.flow +1 -1
- package/jsutils/promiseForObject.js.flow +2 -2
- package/jsutils/promiseReduce.js.flow +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/suggestionList.js +85 -33
- package/jsutils/suggestionList.js.flow +93 -40
- package/jsutils/suggestionList.mjs +85 -33
- package/jsutils/toObjMap.js.flow +1 -0
- package/jsutils/toObjMap.mjs +1 -1
- package/language/ast.d.ts +20 -2
- package/language/ast.js +117 -0
- package/language/ast.js.flow +154 -149
- package/language/ast.mjs +103 -0
- package/language/blockString.d.ts +1 -1
- package/language/index.d.ts +0 -1
- package/language/index.js +0 -6
- package/language/index.js.flow +1 -7
- package/language/index.mjs +11 -11
- package/language/lexer.d.ts +1 -2
- package/language/lexer.js +28 -55
- package/language/lexer.js.flow +25 -59
- package/language/lexer.mjs +30 -54
- package/language/parser.d.ts +1 -2
- package/language/parser.js +51 -52
- package/language/parser.js.flow +33 -48
- package/language/parser.mjs +61 -59
- package/language/predicates.mjs +1 -1
- package/language/printLocation.d.ts +3 -3
- package/language/printLocation.js +10 -10
- package/language/printLocation.js.flow +14 -13
- package/language/printLocation.mjs +10 -10
- package/language/printer.js +11 -7
- package/language/printer.js.flow +10 -9
- package/language/printer.mjs +13 -9
- package/language/source.js +29 -13
- package/language/source.js.flow +16 -9
- package/language/source.mjs +29 -13
- package/language/visitor.d.ts +3 -12
- package/language/visitor.js +11 -55
- package/language/visitor.js.flow +8 -49
- package/language/visitor.mjs +14 -53
- package/package.json +4 -9
- package/polyfills/arrayFrom.js +58 -0
- package/polyfills/arrayFrom.js.flow +59 -0
- package/polyfills/arrayFrom.mjs +50 -0
- package/polyfills/find.js.flow +2 -2
- package/polyfills/flatMap.js +0 -1
- package/polyfills/flatMap.js.flow +3 -4
- package/polyfills/flatMap.mjs +0 -1
- package/polyfills/isFinite.js.flow +1 -1
- package/polyfills/isInteger.js.flow +1 -1
- package/polyfills/objectEntries.js.flow +1 -1
- package/polyfills/objectValues.js.flow +1 -1
- package/polyfills/symbols.js +22 -0
- package/polyfills/symbols.js.flow +17 -0
- package/polyfills/symbols.mjs +13 -0
- package/subscription/index.mjs +1 -1
- package/subscription/mapAsyncIterator.d.ts +1 -1
- package/subscription/mapAsyncIterator.js +6 -5
- package/subscription/mapAsyncIterator.js.flow +12 -12
- package/subscription/mapAsyncIterator.mjs +6 -5
- package/subscription/subscribe.d.ts +7 -14
- package/subscription/subscribe.js +31 -6
- package/subscription/subscribe.js.flow +23 -10
- package/subscription/subscribe.mjs +35 -11
- package/tsutils/Maybe.d.ts +2 -0
- package/type/definition.d.ts +40 -64
- package/type/definition.js +179 -83
- package/type/definition.js.flow +179 -95
- package/type/definition.mjs +191 -96
- package/type/directives.d.ts +10 -5
- package/type/directives.js +22 -12
- package/type/directives.js.flow +10 -7
- package/type/directives.mjs +31 -21
- package/type/index.mjs +6 -6
- package/type/introspection.d.ts +3 -3
- package/type/introspection.js +86 -51
- package/type/introspection.js.flow +63 -40
- package/type/introspection.mjs +94 -59
- package/type/scalars.js +95 -89
- package/type/scalars.js.flow +106 -95
- package/type/scalars.mjs +103 -97
- package/type/schema.d.ts +24 -6
- package/type/schema.js +159 -134
- package/type/schema.js.flow +158 -153
- package/type/schema.mjs +167 -143
- package/type/validate.d.ts +1 -0
- package/type/validate.js +34 -65
- package/type/validate.js.flow +24 -56
- package/type/validate.mjs +44 -76
- package/utilities/TypeInfo.d.ts +12 -2
- package/utilities/TypeInfo.js +66 -12
- package/utilities/TypeInfo.js.flow +56 -11
- package/utilities/TypeInfo.mjs +68 -17
- package/utilities/assertValidName.d.ts +1 -5
- package/utilities/assertValidName.js +4 -4
- package/utilities/assertValidName.js.flow +2 -8
- package/utilities/assertValidName.mjs +6 -6
- package/utilities/astFromValue.js +22 -18
- package/utilities/astFromValue.js.flow +14 -13
- package/utilities/astFromValue.mjs +26 -22
- package/utilities/buildASTSchema.d.ts +2 -63
- package/utilities/buildASTSchema.js +38 -394
- package/utilities/buildASTSchema.js.flow +45 -410
- package/utilities/buildASTSchema.mjs +44 -383
- package/utilities/buildClientSchema.d.ts +2 -3
- package/utilities/buildClientSchema.js +61 -55
- package/utilities/buildClientSchema.js.flow +77 -86
- package/utilities/buildClientSchema.mjs +73 -67
- package/utilities/coerceInputValue.js +17 -33
- package/utilities/coerceInputValue.js.flow +11 -42
- package/utilities/coerceInputValue.mjs +25 -42
- package/utilities/concatAST.js.flow +1 -1
- package/utilities/concatAST.mjs +1 -1
- package/utilities/extendSchema.d.ts +31 -2
- package/utilities/extendSchema.js +489 -164
- package/utilities/extendSchema.js.flow +481 -176
- package/utilities/extendSchema.mjs +493 -174
- package/utilities/findBreakingChanges.d.ts +1 -2
- package/utilities/findBreakingChanges.js +9 -1
- package/utilities/findBreakingChanges.js.flow +14 -8
- package/utilities/findBreakingChanges.mjs +18 -10
- package/utilities/findDeprecatedUsages.d.ts +1 -1
- package/utilities/findDeprecatedUsages.js +7 -15
- package/utilities/findDeprecatedUsages.js.flow +20 -26
- package/utilities/findDeprecatedUsages.mjs +10 -18
- package/utilities/getIntrospectionQuery.d.ts +7 -3
- package/utilities/getIntrospectionQuery.js +16 -2
- package/utilities/getIntrospectionQuery.js.flow +54 -38
- package/utilities/getIntrospectionQuery.mjs +16 -2
- package/utilities/getOperationAST.js +3 -1
- package/utilities/getOperationAST.js.flow +1 -1
- package/utilities/getOperationAST.mjs +4 -2
- package/utilities/getOperationRootType.mjs +1 -1
- package/utilities/index.d.ts +8 -6
- package/utilities/index.js +14 -8
- package/utilities/index.js.flow +8 -9
- package/utilities/index.mjs +24 -24
- package/utilities/introspectionFromSchema.d.ts +1 -0
- package/utilities/introspectionFromSchema.js +16 -2
- package/utilities/introspectionFromSchema.js.flow +8 -2
- package/utilities/introspectionFromSchema.mjs +21 -7
- package/utilities/lexicographicSortSchema.d.ts +2 -0
- package/utilities/lexicographicSortSchema.js +19 -6
- package/utilities/lexicographicSortSchema.js.flow +24 -14
- package/utilities/lexicographicSortSchema.mjs +27 -14
- package/utilities/{schemaPrinter.d.ts → printSchema.d.ts} +1 -1
- package/utilities/{schemaPrinter.js → printSchema.js} +32 -65
- package/utilities/{schemaPrinter.js.flow → printSchema.js.flow} +34 -58
- package/utilities/{schemaPrinter.mjs → printSchema.mjs} +41 -73
- package/utilities/separateOperations.js +21 -23
- package/utilities/separateOperations.js.flow +13 -19
- package/utilities/separateOperations.mjs +21 -24
- package/utilities/stripIgnoredCharacters.js +1 -1
- package/utilities/stripIgnoredCharacters.js.flow +1 -1
- package/utilities/stripIgnoredCharacters.mjs +6 -6
- package/utilities/typeComparators.js.flow +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.mjs +4 -4
- package/utilities/valueFromAST.js +21 -37
- package/utilities/valueFromAST.js.flow +22 -35
- package/utilities/valueFromAST.mjs +27 -42
- package/utilities/valueFromASTUntyped.js +1 -6
- package/utilities/valueFromASTUntyped.js.flow +7 -10
- package/utilities/valueFromASTUntyped.mjs +5 -9
- package/validation/ValidationContext.js +20 -10
- package/validation/ValidationContext.js.flow +5 -5
- package/validation/ValidationContext.mjs +22 -12
- package/validation/index.d.ts +37 -71
- package/validation/index.js +114 -50
- package/validation/index.js.flow +37 -71
- package/validation/index.mjs +38 -28
- package/validation/rules/ExecutableDefinitions.d.ts +6 -10
- package/validation/rules/ExecutableDefinitions.js +7 -29
- package/validation/rules/ExecutableDefinitions.js.flow +6 -36
- package/validation/rules/ExecutableDefinitions.mjs +6 -24
- package/validation/rules/ExecutableDefinitionsRule.d.ts +12 -0
- package/validation/rules/ExecutableDefinitionsRule.js +35 -0
- package/validation/rules/ExecutableDefinitionsRule.js.flow +40 -0
- package/validation/rules/ExecutableDefinitionsRule.mjs +26 -0
- package/validation/rules/{FieldsOnCorrectType.d.ts → FieldsOnCorrectTypeRule.d.ts} +1 -1
- package/validation/rules/FieldsOnCorrectTypeRule.js +130 -0
- package/validation/rules/{FieldsOnCorrectType.js.flow → FieldsOnCorrectTypeRule.js.flow} +61 -40
- package/validation/rules/FieldsOnCorrectTypeRule.mjs +116 -0
- package/validation/rules/{FragmentsOnCompositeTypes.d.ts → FragmentsOnCompositeTypesRule.d.ts} +1 -1
- package/validation/rules/{FragmentsOnCompositeTypes.js → FragmentsOnCompositeTypesRule.js} +2 -2
- package/validation/rules/{FragmentsOnCompositeTypes.js.flow → FragmentsOnCompositeTypesRule.js.flow} +1 -1
- package/validation/rules/{FragmentsOnCompositeTypes.mjs → FragmentsOnCompositeTypesRule.mjs} +5 -5
- package/validation/rules/{KnownArgumentNames.d.ts → KnownArgumentNamesRule.d.ts} +2 -2
- package/validation/rules/{KnownArgumentNames.js → KnownArgumentNamesRule.js} +12 -8
- package/validation/rules/{KnownArgumentNames.js.flow → KnownArgumentNamesRule.js.flow} +9 -8
- package/validation/rules/{KnownArgumentNames.mjs → KnownArgumentNamesRule.mjs} +15 -11
- package/validation/rules/{KnownDirectives.d.ts → KnownDirectivesRule.d.ts} +1 -1
- package/validation/rules/KnownDirectivesRule.js +151 -0
- package/validation/rules/KnownDirectivesRule.js.flow +139 -0
- package/validation/rules/KnownDirectivesRule.mjs +137 -0
- package/validation/rules/{KnownFragmentNames.d.ts → KnownFragmentNamesRule.d.ts} +1 -1
- package/validation/rules/{KnownFragmentNames.js → KnownFragmentNamesRule.js} +2 -2
- package/validation/rules/{KnownFragmentNames.js.flow → KnownFragmentNamesRule.js.flow} +1 -1
- package/validation/rules/{KnownFragmentNames.mjs → KnownFragmentNamesRule.mjs} +2 -2
- package/validation/rules/{KnownTypeNames.d.ts → KnownTypeNamesRule.d.ts} +1 -1
- package/validation/rules/{KnownTypeNames.js → KnownTypeNamesRule.js} +5 -3
- package/validation/rules/{KnownTypeNames.js.flow → KnownTypeNamesRule.js.flow} +3 -3
- package/validation/rules/{KnownTypeNames.mjs → KnownTypeNamesRule.mjs} +9 -7
- package/validation/rules/{LoneAnonymousOperation.d.ts → LoneAnonymousOperationRule.d.ts} +1 -1
- package/validation/rules/{LoneAnonymousOperation.js → LoneAnonymousOperationRule.js} +2 -2
- package/validation/rules/{LoneAnonymousOperation.js.flow → LoneAnonymousOperationRule.js.flow} +2 -2
- package/validation/rules/{LoneAnonymousOperation.mjs → LoneAnonymousOperationRule.mjs} +3 -3
- package/validation/rules/LoneSchemaDefinition.d.ts +6 -7
- package/validation/rules/LoneSchemaDefinition.js +7 -27
- package/validation/rules/LoneSchemaDefinition.js.flow +6 -41
- package/validation/rules/LoneSchemaDefinition.mjs +6 -24
- package/validation/rules/LoneSchemaDefinitionRule.d.ts +11 -0
- package/validation/rules/LoneSchemaDefinitionRule.js +35 -0
- package/validation/rules/LoneSchemaDefinitionRule.js.flow +44 -0
- package/validation/rules/LoneSchemaDefinitionRule.mjs +28 -0
- package/validation/rules/{NoFragmentCycles.d.ts → NoFragmentCyclesRule.d.ts} +1 -1
- package/validation/rules/{NoFragmentCycles.js → NoFragmentCyclesRule.js} +2 -2
- package/validation/rules/{NoFragmentCycles.js.flow → NoFragmentCyclesRule.js.flow} +4 -2
- package/validation/rules/{NoFragmentCycles.mjs → NoFragmentCyclesRule.mjs} +2 -2
- package/validation/rules/{NoUndefinedVariables.d.ts → NoUndefinedVariablesRule.d.ts} +3 -1
- package/validation/rules/{NoUndefinedVariables.js → NoUndefinedVariablesRule.js} +2 -2
- package/validation/rules/{NoUndefinedVariables.js.flow → NoUndefinedVariablesRule.js.flow} +3 -1
- package/validation/rules/{NoUndefinedVariables.mjs → NoUndefinedVariablesRule.mjs} +2 -2
- package/validation/rules/{NoUnusedFragments.d.ts → NoUnusedFragmentsRule.d.ts} +1 -1
- package/validation/rules/{NoUnusedFragments.js → NoUnusedFragmentsRule.js} +2 -2
- package/validation/rules/{NoUnusedFragments.js.flow → NoUnusedFragmentsRule.js.flow} +3 -1
- package/validation/rules/{NoUnusedFragments.mjs → NoUnusedFragmentsRule.mjs} +2 -2
- package/validation/rules/{NoUnusedVariables.d.ts → NoUnusedVariablesRule.d.ts} +1 -1
- package/validation/rules/{NoUnusedVariables.js → NoUnusedVariablesRule.js} +2 -2
- package/validation/rules/{NoUnusedVariables.js.flow → NoUnusedVariablesRule.js.flow} +1 -1
- package/validation/rules/{NoUnusedVariables.mjs → NoUnusedVariablesRule.mjs} +2 -2
- package/validation/rules/{OverlappingFieldsCanBeMerged.d.ts → OverlappingFieldsCanBeMergedRule.d.ts} +1 -1
- package/validation/rules/{OverlappingFieldsCanBeMerged.js → OverlappingFieldsCanBeMergedRule.js} +27 -32
- package/validation/rules/{OverlappingFieldsCanBeMerged.js.flow → OverlappingFieldsCanBeMergedRule.js.flow} +16 -27
- package/validation/rules/{OverlappingFieldsCanBeMerged.mjs → OverlappingFieldsCanBeMergedRule.mjs} +34 -39
- package/validation/rules/{PossibleFragmentSpreads.d.ts → PossibleFragmentSpreadsRule.d.ts} +3 -1
- package/validation/rules/{PossibleFragmentSpreads.js → PossibleFragmentSpreadsRule.js} +2 -2
- package/validation/rules/{PossibleFragmentSpreads.js.flow → PossibleFragmentSpreadsRule.js.flow} +1 -1
- package/validation/rules/{PossibleFragmentSpreads.mjs → PossibleFragmentSpreadsRule.mjs} +6 -6
- package/validation/rules/PossibleTypeExtensions.d.ts +6 -9
- package/validation/rules/PossibleTypeExtensions.js +6 -116
- package/validation/rules/PossibleTypeExtensions.js.flow +6 -127
- package/validation/rules/PossibleTypeExtensions.mjs +6 -106
- package/validation/rules/PossibleTypeExtensionsRule.d.ts +11 -0
- package/validation/rules/PossibleTypeExtensionsRule.js +143 -0
- package/validation/rules/PossibleTypeExtensionsRule.js.flow +142 -0
- package/validation/rules/PossibleTypeExtensionsRule.mjs +126 -0
- package/validation/rules/{ProvidedRequiredArguments.d.ts → ProvidedRequiredArgumentsRule.d.ts} +2 -2
- package/validation/rules/{ProvidedRequiredArguments.js → ProvidedRequiredArgumentsRule.js} +22 -21
- package/validation/rules/{ProvidedRequiredArguments.js.flow → ProvidedRequiredArgumentsRule.js.flow} +15 -26
- package/validation/rules/{ProvidedRequiredArguments.mjs → ProvidedRequiredArgumentsRule.mjs} +28 -22
- package/validation/rules/{ScalarLeafs.d.ts → ScalarLeafsRule.d.ts} +1 -1
- package/validation/rules/{ScalarLeafs.js → ScalarLeafsRule.js} +2 -13
- package/validation/rules/{ScalarLeafs.js.flow → ScalarLeafsRule.js.flow} +1 -15
- package/validation/rules/{ScalarLeafs.mjs → ScalarLeafsRule.mjs} +5 -11
- package/validation/rules/{SingleFieldSubscriptions.d.ts → SingleFieldSubscriptionsRule.d.ts} +1 -2
- package/validation/rules/{SingleFieldSubscriptions.js → SingleFieldSubscriptionsRule.js} +2 -2
- package/validation/rules/{SingleFieldSubscriptions.js.flow → SingleFieldSubscriptionsRule.js.flow} +1 -1
- package/validation/rules/{SingleFieldSubscriptions.mjs → SingleFieldSubscriptionsRule.mjs} +2 -2
- package/validation/rules/{UniqueArgumentNames.d.ts → UniqueArgumentNamesRule.d.ts} +3 -1
- package/validation/rules/{UniqueArgumentNames.js → UniqueArgumentNamesRule.js} +2 -8
- package/validation/rules/{UniqueArgumentNames.js.flow → UniqueArgumentNamesRule.js.flow} +3 -5
- package/validation/rules/{UniqueArgumentNames.mjs → UniqueArgumentNamesRule.mjs} +3 -6
- package/validation/rules/UniqueDirectiveNames.d.ts +6 -7
- package/validation/rules/UniqueDirectiveNames.js +7 -41
- package/validation/rules/UniqueDirectiveNames.js.flow +6 -51
- package/validation/rules/UniqueDirectiveNames.mjs +6 -33
- package/validation/rules/UniqueDirectiveNamesRule.d.ts +11 -0
- package/validation/rules/UniqueDirectiveNamesRule.js +36 -0
- package/validation/rules/UniqueDirectiveNamesRule.js.flow +47 -0
- package/validation/rules/UniqueDirectiveNamesRule.mjs +29 -0
- package/validation/rules/{UniqueDirectivesPerLocation.d.ts → UniqueDirectivesPerLocationRule.d.ts} +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.js +82 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +91 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs +72 -0
- package/validation/rules/UniqueEnumValueNames.d.ts +6 -7
- package/validation/rules/UniqueEnumValueNames.js +7 -47
- package/validation/rules/UniqueEnumValueNames.js.flow +6 -58
- package/validation/rules/UniqueEnumValueNames.mjs +6 -43
- package/validation/rules/UniqueEnumValueNamesRule.d.ts +11 -0
- package/validation/rules/UniqueEnumValueNamesRule.js +56 -0
- package/validation/rules/UniqueEnumValueNamesRule.js.flow +62 -0
- package/validation/rules/UniqueEnumValueNamesRule.mjs +48 -0
- package/validation/rules/UniqueFieldDefinitionNames.d.ts +6 -9
- package/validation/rules/UniqueFieldDefinitionNames.js +6 -57
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +6 -72
- package/validation/rules/UniqueFieldDefinitionNames.mjs +6 -54
- package/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +11 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +67 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +76 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +59 -0
- package/validation/rules/{UniqueFragmentNames.d.ts → UniqueFragmentNamesRule.d.ts} +3 -1
- package/validation/rules/{UniqueFragmentNames.js → UniqueFragmentNamesRule.js} +2 -2
- package/validation/rules/{UniqueFragmentNames.js.flow → UniqueFragmentNamesRule.js.flow} +3 -1
- package/validation/rules/{UniqueFragmentNames.mjs → UniqueFragmentNamesRule.mjs} +2 -2
- package/validation/rules/{UniqueInputFieldNames.d.ts → UniqueInputFieldNamesRule.d.ts} +1 -1
- package/validation/rules/{UniqueInputFieldNames.js → UniqueInputFieldNamesRule.js} +2 -2
- package/validation/rules/{UniqueInputFieldNames.js.flow → UniqueInputFieldNamesRule.js.flow} +1 -1
- package/validation/rules/{UniqueInputFieldNames.mjs → UniqueInputFieldNamesRule.mjs} +2 -2
- package/validation/rules/{UniqueOperationNames.d.ts → UniqueOperationNamesRule.d.ts} +3 -1
- package/validation/rules/{UniqueOperationNames.js → UniqueOperationNamesRule.js} +2 -2
- package/validation/rules/{UniqueOperationNames.js.flow → UniqueOperationNamesRule.js.flow} +1 -1
- package/validation/rules/{UniqueOperationNames.mjs → UniqueOperationNamesRule.mjs} +2 -2
- package/validation/rules/UniqueOperationTypes.d.ts +6 -7
- package/validation/rules/UniqueOperationTypes.js +7 -41
- package/validation/rules/UniqueOperationTypes.js.flow +6 -55
- package/validation/rules/UniqueOperationTypes.mjs +6 -38
- package/validation/rules/UniqueOperationTypesRule.d.ts +11 -0
- package/validation/rules/UniqueOperationTypesRule.js +50 -0
- package/validation/rules/UniqueOperationTypesRule.js.flow +60 -0
- package/validation/rules/UniqueOperationTypesRule.mjs +43 -0
- package/validation/rules/UniqueTypeNames.d.ts +6 -7
- package/validation/rules/UniqueTypeNames.js +7 -37
- package/validation/rules/UniqueTypeNames.js.flow +6 -50
- package/validation/rules/UniqueTypeNames.mjs +6 -34
- package/validation/rules/UniqueTypeNamesRule.d.ts +9 -0
- package/validation/rules/UniqueTypeNamesRule.js +43 -0
- package/validation/rules/UniqueTypeNamesRule.js.flow +54 -0
- package/validation/rules/UniqueTypeNamesRule.mjs +36 -0
- package/validation/rules/{UniqueVariableNames.d.ts → UniqueVariableNamesRule.d.ts} +3 -1
- package/validation/rules/{UniqueVariableNames.js → UniqueVariableNamesRule.js} +2 -2
- package/validation/rules/{UniqueVariableNames.js.flow → UniqueVariableNamesRule.js.flow} +3 -1
- package/validation/rules/{UniqueVariableNames.mjs → UniqueVariableNamesRule.mjs} +2 -2
- package/validation/rules/{ValuesOfCorrectType.d.ts → ValuesOfCorrectTypeRule.d.ts} +1 -1
- package/validation/rules/{ValuesOfCorrectType.js → ValuesOfCorrectTypeRule.js} +6 -22
- package/validation/rules/{ValuesOfCorrectType.js.flow → ValuesOfCorrectTypeRule.js.flow} +14 -31
- package/validation/rules/{ValuesOfCorrectType.mjs → ValuesOfCorrectTypeRule.mjs} +13 -27
- package/validation/rules/{VariablesAreInputTypes.d.ts → VariablesAreInputTypesRule.d.ts} +3 -1
- package/validation/rules/{VariablesAreInputTypes.js → VariablesAreInputTypesRule.js} +2 -2
- package/validation/rules/{VariablesAreInputTypes.js.flow → VariablesAreInputTypesRule.js.flow} +3 -1
- package/validation/rules/{VariablesAreInputTypes.mjs → VariablesAreInputTypesRule.mjs} +5 -5
- package/validation/rules/{VariablesInAllowedPosition.d.ts → VariablesInAllowedPositionRule.d.ts} +1 -1
- package/validation/rules/{VariablesInAllowedPosition.js → VariablesInAllowedPositionRule.js} +2 -2
- package/validation/rules/{VariablesInAllowedPosition.js.flow → VariablesInAllowedPositionRule.js.flow} +1 -1
- package/validation/rules/{VariablesInAllowedPosition.mjs → VariablesInAllowedPositionRule.mjs} +7 -7
- package/validation/specifiedRules.d.ts +0 -86
- package/validation/specifiedRules.js +38 -37
- package/validation/specifiedRules.js.flow +79 -78
- package/validation/specifiedRules.mjs +36 -35
- package/validation/validate.d.ts +7 -2
- package/validation/validate.js +6 -5
- package/validation/validate.js.flow +11 -12
- package/validation/validate.mjs +12 -11
- package/version.js +2 -2
- package/version.js.flow +2 -2
- package/version.mjs +2 -2
- package/jsutils/defineToStringTag.js +0 -29
- package/jsutils/defineToStringTag.js.flow +0 -24
- package/jsutils/defineToStringTag.mjs +0 -22
- package/jsutils/isInvalid.js +0 -13
- package/jsutils/isInvalid.js.flow +0 -8
- package/jsutils/isInvalid.mjs +0 -6
- package/jsutils/isNullish.js +0 -13
- package/jsutils/isNullish.js.flow +0 -8
- package/jsutils/isNullish.mjs +0 -6
- package/subscription/asyncIteratorReject.d.ts +0 -6
- package/subscription/asyncIteratorReject.js +0 -45
- package/subscription/asyncIteratorReject.js.flow +0 -34
- package/subscription/asyncIteratorReject.mjs +0 -38
- package/validation/rules/FieldsOnCorrectType.js +0 -106
- package/validation/rules/FieldsOnCorrectType.mjs +0 -93
- package/validation/rules/KnownDirectives.js +0 -138
- package/validation/rules/KnownDirectives.js.flow +0 -124
- package/validation/rules/KnownDirectives.mjs +0 -128
- package/validation/rules/UniqueDirectivesPerLocation.js +0 -67
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +0 -71
- package/validation/rules/UniqueDirectivesPerLocation.mjs +0 -58
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Then, serve the result of a query against that type schema.
|
|
|
74
74
|
```js
|
|
75
75
|
var query = '{ hello }';
|
|
76
76
|
|
|
77
|
-
graphql(schema, query).then(result => {
|
|
77
|
+
graphql(schema, query).then((result) => {
|
|
78
78
|
// Prints
|
|
79
79
|
// {
|
|
80
80
|
// data: { hello: "world" }
|
|
@@ -88,13 +88,13 @@ first ensure the query is syntactically and semantically valid before executing
|
|
|
88
88
|
it, reporting errors otherwise.
|
|
89
89
|
|
|
90
90
|
```js
|
|
91
|
-
var query = '{
|
|
91
|
+
var query = '{ BoyHowdy }';
|
|
92
92
|
|
|
93
|
-
graphql(schema, query).then(result => {
|
|
93
|
+
graphql(schema, query).then((result) => {
|
|
94
94
|
// Prints
|
|
95
95
|
// {
|
|
96
96
|
// errors: [
|
|
97
|
-
// { message: 'Cannot query field
|
|
97
|
+
// { message: 'Cannot query field BoyHowdy on RootQueryType',
|
|
98
98
|
// locations: [ { line: 1, column: 3 } ] }
|
|
99
99
|
// ]
|
|
100
100
|
// }
|
|
@@ -102,6 +102,8 @@ graphql(schema, query).then(result => {
|
|
|
102
102
|
});
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server it will disable some checks that can be useful during development but will significantly improve performance.
|
|
106
|
+
|
|
105
107
|
### Want to ride the bleeding edge?
|
|
106
108
|
|
|
107
109
|
The `npm` branch in this repository is automatically maintained to be the last
|
|
@@ -138,3 +140,30 @@ Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/r
|
|
|
138
140
|
### License
|
|
139
141
|
|
|
140
142
|
GraphQL.js is [MIT-licensed](https://github.com/graphql/graphql-js/blob/master/LICENSE).
|
|
143
|
+
|
|
144
|
+
### Credits
|
|
145
|
+
|
|
146
|
+
The `*.d.ts` files in this project are based on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/54712a7e28090c5b1253b746d1878003c954f3ff/types/graphql) definitions written by:
|
|
147
|
+
|
|
148
|
+
<!--- spell-checker:disable -->
|
|
149
|
+
|
|
150
|
+
- TonyYang https://github.com/TonyPythoneer
|
|
151
|
+
- Caleb Meredith https://github.com/calebmer
|
|
152
|
+
- Dominic Watson https://github.com/intellix
|
|
153
|
+
- Firede https://github.com/firede
|
|
154
|
+
- Kepennar https://github.com/kepennar
|
|
155
|
+
- Mikhail Novikov https://github.com/freiksenet
|
|
156
|
+
- Ivan Goncharov https://github.com/IvanGoncharov
|
|
157
|
+
- Hagai Cohen https://github.com/DxCx
|
|
158
|
+
- Ricardo Portugal https://github.com/rportugal
|
|
159
|
+
- Tim Griesser https://github.com/tgriesser
|
|
160
|
+
- Dylan Stewart https://github.com/dyst5422
|
|
161
|
+
- Alessio Dionisi https://github.com/adnsio
|
|
162
|
+
- Divyendu Singh https://github.com/divyenduz
|
|
163
|
+
- Brad Zacher https://github.com/bradzacher
|
|
164
|
+
- Curtis Layne https://github.com/clayne11
|
|
165
|
+
- Jonathan Cardoso https://github.com/JCMais
|
|
166
|
+
- Pavel Lang https://github.com/langpavel
|
|
167
|
+
- Mark Caudill https://github.com/mc0
|
|
168
|
+
- Martijn Walraven https://github.com/martijnwalraven
|
|
169
|
+
- Jed Mao https://github.com/jedmao
|
package/error/GraphQLError.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Maybe from '../tsutils/Maybe';
|
|
|
2
2
|
|
|
3
3
|
import { ASTNode } from '../language/ast';
|
|
4
4
|
import { Source } from '../language/source';
|
|
5
|
-
import { SourceLocation
|
|
5
|
+
import { SourceLocation } from '../language/location';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A GraphQLError describes an Error found during the parse, validate, or
|
package/error/GraphQLError.js
CHANGED
|
@@ -3,157 +3,270 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.GraphQLError = GraphQLError;
|
|
7
6
|
exports.printError = printError;
|
|
7
|
+
exports.GraphQLError = void 0;
|
|
8
8
|
|
|
9
9
|
var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike"));
|
|
10
10
|
|
|
11
|
+
var _symbols = require("../polyfills/symbols");
|
|
12
|
+
|
|
11
13
|
var _location = require("../language/location");
|
|
12
14
|
|
|
13
15
|
var _printLocation = require("../language/printLocation");
|
|
14
16
|
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
|
|
17
|
-
function
|
|
18
|
-
message, nodes, source, positions, path, originalError, extensions) {
|
|
19
|
-
// Compute list of blame nodes.
|
|
20
|
-
var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.
|
|
19
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
21
20
|
|
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
var node = _nodes[0];
|
|
27
|
-
_source = node && node.loc && node.loc.source;
|
|
28
|
-
}
|
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
_positions = _nodes.reduce(function (list, node) {
|
|
34
|
-
if (node.loc) {
|
|
35
|
-
list.push(node.loc.start);
|
|
36
|
-
}
|
|
29
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
}, []);
|
|
40
|
-
}
|
|
31
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
_positions = undefined;
|
|
44
|
-
}
|
|
33
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
34
|
|
|
46
|
-
|
|
35
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
38
|
+
|
|
39
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
40
|
+
|
|
41
|
+
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
42
|
+
|
|
43
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
44
|
+
|
|
45
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A GraphQLError describes an Error found during the parse, validate, or
|
|
49
|
+
* execute phases of performing a GraphQL operation. In addition to a message
|
|
50
|
+
* and stack trace, it also includes information about the locations in a
|
|
51
|
+
* GraphQL document and/or execution result that correspond to the Error.
|
|
52
|
+
*/
|
|
53
|
+
var GraphQLError = /*#__PURE__*/function (_Error) {
|
|
54
|
+
_inherits(GraphQLError, _Error);
|
|
55
|
+
|
|
56
|
+
var _super = _createSuper(GraphQLError);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A message describing the Error for debugging purposes.
|
|
60
|
+
*
|
|
61
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
62
|
+
*
|
|
63
|
+
* Note: should be treated as readonly, despite invariant usage.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* An array of { line, column } locations within the source GraphQL document
|
|
68
|
+
* which correspond to this error.
|
|
69
|
+
*
|
|
70
|
+
* Errors during validation often contain multiple locations, for example to
|
|
71
|
+
* point out two things with the same name. Errors during execution include a
|
|
72
|
+
* single location, the field which produced the error.
|
|
73
|
+
*
|
|
74
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An array describing the JSON-path into the execution response which
|
|
79
|
+
* corresponds to this error. Only included for errors during execution.
|
|
80
|
+
*
|
|
81
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* An array of GraphQL AST Nodes corresponding to this error.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The source GraphQL document for the first location of this error.
|
|
90
|
+
*
|
|
91
|
+
* Note that if this Error represents more than one node, the source may not
|
|
92
|
+
* represent nodes after the first node.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* An array of character offsets within the source GraphQL document
|
|
97
|
+
* which correspond to this error.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The original error thrown from a field resolver during execution.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Extension fields to add to the formatted error.
|
|
106
|
+
*/
|
|
107
|
+
function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
|
|
108
|
+
var _locations2, _source2, _positions2, _extensions2;
|
|
109
|
+
|
|
110
|
+
var _this;
|
|
111
|
+
|
|
112
|
+
_classCallCheck(this, GraphQLError);
|
|
113
|
+
|
|
114
|
+
_this = _super.call(this, message); // Compute list of blame nodes.
|
|
115
|
+
|
|
116
|
+
var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.
|
|
57
117
|
|
|
58
|
-
return list;
|
|
59
|
-
}, []);
|
|
60
|
-
}
|
|
61
118
|
|
|
62
|
-
|
|
119
|
+
var _source = source;
|
|
63
120
|
|
|
64
|
-
|
|
65
|
-
|
|
121
|
+
if (!_source && _nodes) {
|
|
122
|
+
var _nodes$0$loc;
|
|
66
123
|
|
|
67
|
-
|
|
68
|
-
_extensions = originalExtensions;
|
|
124
|
+
_source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source;
|
|
69
125
|
}
|
|
70
|
-
}
|
|
71
126
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
var _positions = positions;
|
|
128
|
+
|
|
129
|
+
if (!_positions && _nodes) {
|
|
130
|
+
_positions = _nodes.reduce(function (list, node) {
|
|
131
|
+
if (node.loc) {
|
|
132
|
+
list.push(node.loc.start);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return list;
|
|
136
|
+
}, []);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (_positions && _positions.length === 0) {
|
|
140
|
+
_positions = undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var _locations;
|
|
144
|
+
|
|
145
|
+
if (positions && source) {
|
|
146
|
+
_locations = positions.map(function (pos) {
|
|
147
|
+
return (0, _location.getLocation)(source, pos);
|
|
148
|
+
});
|
|
149
|
+
} else if (_nodes) {
|
|
150
|
+
_locations = _nodes.reduce(function (list, node) {
|
|
151
|
+
if (node.loc) {
|
|
152
|
+
list.push((0, _location.getLocation)(node.loc.source, node.loc.start));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return list;
|
|
156
|
+
}, []);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var _extensions = extensions;
|
|
160
|
+
|
|
161
|
+
if (_extensions == null && originalError != null) {
|
|
162
|
+
var originalExtensions = originalError.extensions;
|
|
163
|
+
|
|
164
|
+
if ((0, _isObjectLike.default)(originalExtensions)) {
|
|
165
|
+
_extensions = originalExtensions;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Object.defineProperties(_assertThisInitialized(_this), {
|
|
170
|
+
name: {
|
|
171
|
+
value: 'GraphQLError'
|
|
172
|
+
},
|
|
173
|
+
message: {
|
|
174
|
+
value: message,
|
|
175
|
+
// By being enumerable, JSON.stringify will include `message` in the
|
|
176
|
+
// resulting output. This ensures that the simplest possible GraphQL
|
|
177
|
+
// service adheres to the spec.
|
|
178
|
+
enumerable: true,
|
|
179
|
+
writable: true
|
|
180
|
+
},
|
|
181
|
+
locations: {
|
|
182
|
+
// Coercing falsy values to undefined ensures they will not be included
|
|
183
|
+
// in JSON.stringify() when not provided.
|
|
184
|
+
value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined,
|
|
185
|
+
// By being enumerable, JSON.stringify will include `locations` in the
|
|
186
|
+
// resulting output. This ensures that the simplest possible GraphQL
|
|
187
|
+
// service adheres to the spec.
|
|
188
|
+
enumerable: _locations != null
|
|
189
|
+
},
|
|
190
|
+
path: {
|
|
191
|
+
// Coercing falsy values to undefined ensures they will not be included
|
|
192
|
+
// in JSON.stringify() when not provided.
|
|
193
|
+
value: path !== null && path !== void 0 ? path : undefined,
|
|
194
|
+
// By being enumerable, JSON.stringify will include `path` in the
|
|
195
|
+
// resulting output. This ensures that the simplest possible GraphQL
|
|
196
|
+
// service adheres to the spec.
|
|
197
|
+
enumerable: path != null
|
|
198
|
+
},
|
|
199
|
+
nodes: {
|
|
200
|
+
value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined
|
|
201
|
+
},
|
|
202
|
+
source: {
|
|
203
|
+
value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined
|
|
204
|
+
},
|
|
205
|
+
positions: {
|
|
206
|
+
value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined
|
|
207
|
+
},
|
|
208
|
+
originalError: {
|
|
209
|
+
value: originalError
|
|
210
|
+
},
|
|
211
|
+
extensions: {
|
|
212
|
+
// Coercing falsy values to undefined ensures they will not be included
|
|
213
|
+
// in JSON.stringify() when not provided.
|
|
214
|
+
value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined,
|
|
215
|
+
// By being enumerable, JSON.stringify will include `path` in the
|
|
216
|
+
// resulting output. This ensures that the simplest possible GraphQL
|
|
217
|
+
// service adheres to the spec.
|
|
218
|
+
enumerable: _extensions != null
|
|
219
|
+
}
|
|
220
|
+
}); // Include (non-enumerable) stack trace.
|
|
221
|
+
|
|
222
|
+
if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) {
|
|
223
|
+
Object.defineProperty(_assertThisInitialized(_this), 'stack', {
|
|
224
|
+
value: originalError.stack,
|
|
225
|
+
writable: true,
|
|
226
|
+
configurable: true
|
|
227
|
+
});
|
|
228
|
+
return _possibleConstructorReturn(_this);
|
|
229
|
+
}
|
|
230
|
+
/* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
if (Error.captureStackTrace) {
|
|
234
|
+
Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError);
|
|
235
|
+
} else {
|
|
236
|
+
Object.defineProperty(_assertThisInitialized(_this), 'stack', {
|
|
237
|
+
value: Error().stack,
|
|
238
|
+
writable: true,
|
|
239
|
+
configurable: true
|
|
240
|
+
});
|
|
119
241
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (originalError && originalError.stack) {
|
|
123
|
-
Object.defineProperty(this, 'stack', {
|
|
124
|
-
value: originalError.stack,
|
|
125
|
-
writable: true,
|
|
126
|
-
configurable: true
|
|
127
|
-
});
|
|
128
|
-
} else if (Error.captureStackTrace) {
|
|
129
|
-
Error.captureStackTrace(this, GraphQLError);
|
|
130
|
-
} else {
|
|
131
|
-
Object.defineProperty(this, 'stack', {
|
|
132
|
-
value: Error().stack,
|
|
133
|
-
writable: true,
|
|
134
|
-
configurable: true
|
|
135
|
-
});
|
|
242
|
+
|
|
243
|
+
return _this;
|
|
136
244
|
}
|
|
137
|
-
}
|
|
138
245
|
|
|
139
|
-
GraphQLError
|
|
140
|
-
|
|
141
|
-
value: GraphQLError
|
|
142
|
-
},
|
|
143
|
-
name: {
|
|
144
|
-
value: 'GraphQLError'
|
|
145
|
-
},
|
|
146
|
-
toString: {
|
|
246
|
+
_createClass(GraphQLError, [{
|
|
247
|
+
key: "toString",
|
|
147
248
|
value: function toString() {
|
|
148
249
|
return printError(this);
|
|
250
|
+
} // FIXME: workaround to not break chai comparisons, should be remove in v16
|
|
251
|
+
// $FlowFixMe Flow doesn't support computed properties yet
|
|
252
|
+
|
|
253
|
+
}, {
|
|
254
|
+
key: _symbols.SYMBOL_TO_STRING_TAG,
|
|
255
|
+
get: function get() {
|
|
256
|
+
return 'Object';
|
|
149
257
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
258
|
+
}]);
|
|
259
|
+
|
|
260
|
+
return GraphQLError;
|
|
261
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
152
262
|
/**
|
|
153
263
|
* Prints a GraphQLError to a string, representing useful location information
|
|
154
264
|
* about the error's position in the source.
|
|
155
265
|
*/
|
|
156
266
|
|
|
267
|
+
|
|
268
|
+
exports.GraphQLError = GraphQLError;
|
|
269
|
+
|
|
157
270
|
function printError(error) {
|
|
158
271
|
var output = error.message;
|
|
159
272
|
|