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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _error = require('../error');
|
|
8
|
+
|
|
9
|
+
var _visitor = require('../language/visitor');
|
|
10
|
+
|
|
11
|
+
var _kinds = require('../language/kinds');
|
|
12
|
+
|
|
13
|
+
var _schema = require('../type/schema');
|
|
14
|
+
|
|
15
|
+
var _TypeInfo = require('../utilities/TypeInfo');
|
|
16
|
+
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /**
|
|
18
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*
|
|
23
|
+
* strict
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An instance of this class is passed as the "this" context to all validators,
|
|
28
|
+
* allowing access to commonly useful contextual information from within a
|
|
29
|
+
* validation rule.
|
|
30
|
+
*/
|
|
31
|
+
var ValidationContext = function () {
|
|
32
|
+
function ValidationContext(schema, ast, typeInfo) {
|
|
33
|
+
_classCallCheck(this, ValidationContext);
|
|
34
|
+
|
|
35
|
+
this._schema = schema;
|
|
36
|
+
this._ast = ast;
|
|
37
|
+
this._typeInfo = typeInfo;
|
|
38
|
+
this._errors = [];
|
|
39
|
+
this._fragmentSpreads = new Map();
|
|
40
|
+
this._recursivelyReferencedFragments = new Map();
|
|
41
|
+
this._variableUsages = new Map();
|
|
42
|
+
this._recursiveVariableUsages = new Map();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ValidationContext.prototype.reportError = function reportError(error) {
|
|
46
|
+
this._errors.push(error);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
ValidationContext.prototype.getErrors = function getErrors() {
|
|
50
|
+
return this._errors;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
ValidationContext.prototype.getSchema = function getSchema() {
|
|
54
|
+
return this._schema;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
ValidationContext.prototype.getDocument = function getDocument() {
|
|
58
|
+
return this._ast;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
ValidationContext.prototype.getFragment = function getFragment(name) {
|
|
62
|
+
var fragments = this._fragments;
|
|
63
|
+
if (!fragments) {
|
|
64
|
+
this._fragments = fragments = this.getDocument().definitions.reduce(function (frags, statement) {
|
|
65
|
+
if (statement.kind === _kinds.Kind.FRAGMENT_DEFINITION) {
|
|
66
|
+
frags[statement.name.value] = statement;
|
|
67
|
+
}
|
|
68
|
+
return frags;
|
|
69
|
+
}, Object.create(null));
|
|
70
|
+
}
|
|
71
|
+
return fragments[name];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
ValidationContext.prototype.getFragmentSpreads = function getFragmentSpreads(node) {
|
|
75
|
+
var spreads = this._fragmentSpreads.get(node);
|
|
76
|
+
if (!spreads) {
|
|
77
|
+
spreads = [];
|
|
78
|
+
var setsToVisit = [node];
|
|
79
|
+
while (setsToVisit.length !== 0) {
|
|
80
|
+
var set = setsToVisit.pop();
|
|
81
|
+
for (var i = 0; i < set.selections.length; i++) {
|
|
82
|
+
var selection = set.selections[i];
|
|
83
|
+
if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) {
|
|
84
|
+
spreads.push(selection);
|
|
85
|
+
} else if (selection.selectionSet) {
|
|
86
|
+
setsToVisit.push(selection.selectionSet);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
this._fragmentSpreads.set(node, spreads);
|
|
91
|
+
}
|
|
92
|
+
return spreads;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
ValidationContext.prototype.getRecursivelyReferencedFragments = function getRecursivelyReferencedFragments(operation) {
|
|
96
|
+
var fragments = this._recursivelyReferencedFragments.get(operation);
|
|
97
|
+
if (!fragments) {
|
|
98
|
+
fragments = [];
|
|
99
|
+
var collectedNames = Object.create(null);
|
|
100
|
+
var nodesToVisit = [operation.selectionSet];
|
|
101
|
+
while (nodesToVisit.length !== 0) {
|
|
102
|
+
var _node = nodesToVisit.pop();
|
|
103
|
+
var spreads = this.getFragmentSpreads(_node);
|
|
104
|
+
for (var i = 0; i < spreads.length; i++) {
|
|
105
|
+
var fragName = spreads[i].name.value;
|
|
106
|
+
if (collectedNames[fragName] !== true) {
|
|
107
|
+
collectedNames[fragName] = true;
|
|
108
|
+
var fragment = this.getFragment(fragName);
|
|
109
|
+
if (fragment) {
|
|
110
|
+
fragments.push(fragment);
|
|
111
|
+
nodesToVisit.push(fragment.selectionSet);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this._recursivelyReferencedFragments.set(operation, fragments);
|
|
117
|
+
}
|
|
118
|
+
return fragments;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
ValidationContext.prototype.getVariableUsages = function getVariableUsages(node) {
|
|
122
|
+
var usages = this._variableUsages.get(node);
|
|
123
|
+
if (!usages) {
|
|
124
|
+
var newUsages = [];
|
|
125
|
+
var typeInfo = new _TypeInfo.TypeInfo(this._schema);
|
|
126
|
+
(0, _visitor.visit)(node, (0, _visitor.visitWithTypeInfo)(typeInfo, {
|
|
127
|
+
VariableDefinition: function VariableDefinition() {
|
|
128
|
+
return false;
|
|
129
|
+
},
|
|
130
|
+
Variable: function Variable(variable) {
|
|
131
|
+
newUsages.push({ node: variable, type: typeInfo.getInputType() });
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
usages = newUsages;
|
|
135
|
+
this._variableUsages.set(node, usages);
|
|
136
|
+
}
|
|
137
|
+
return usages;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
ValidationContext.prototype.getRecursiveVariableUsages = function getRecursiveVariableUsages(operation) {
|
|
141
|
+
var usages = this._recursiveVariableUsages.get(operation);
|
|
142
|
+
if (!usages) {
|
|
143
|
+
usages = this.getVariableUsages(operation);
|
|
144
|
+
var fragments = this.getRecursivelyReferencedFragments(operation);
|
|
145
|
+
for (var i = 0; i < fragments.length; i++) {
|
|
146
|
+
Array.prototype.push.apply(usages, this.getVariableUsages(fragments[i]));
|
|
147
|
+
}
|
|
148
|
+
this._recursiveVariableUsages.set(operation, usages);
|
|
149
|
+
}
|
|
150
|
+
return usages;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
ValidationContext.prototype.getType = function getType() {
|
|
154
|
+
return this._typeInfo.getType();
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
ValidationContext.prototype.getParentType = function getParentType() {
|
|
158
|
+
return this._typeInfo.getParentType();
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
ValidationContext.prototype.getInputType = function getInputType() {
|
|
162
|
+
return this._typeInfo.getInputType();
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
ValidationContext.prototype.getParentInputType = function getParentInputType() {
|
|
166
|
+
return this._typeInfo.getParentInputType();
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
ValidationContext.prototype.getFieldDef = function getFieldDef() {
|
|
170
|
+
return this._typeInfo.getFieldDef();
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
ValidationContext.prototype.getDirective = function getDirective() {
|
|
174
|
+
return this._typeInfo.getDirective();
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
ValidationContext.prototype.getArgument = function getArgument() {
|
|
178
|
+
return this._typeInfo.getArgument();
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return ValidationContext;
|
|
182
|
+
}();
|
|
183
|
+
|
|
184
|
+
exports.default = ValidationContext;
|
|
@@ -4,14 +4,13 @@
|
|
|
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
|
-
import invariant from '../jsutils/invariant';
|
|
11
10
|
import type { ObjMap } from '../jsutils/ObjMap';
|
|
12
11
|
import { GraphQLError } from '../error';
|
|
13
|
-
import { visit,
|
|
14
|
-
import
|
|
12
|
+
import { visit, visitWithTypeInfo } from '../language/visitor';
|
|
13
|
+
import { Kind } from '../language/kinds';
|
|
15
14
|
import type {
|
|
16
15
|
DocumentNode,
|
|
17
16
|
OperationDefinitionNode,
|
|
@@ -20,7 +19,6 @@ import type {
|
|
|
20
19
|
FragmentSpreadNode,
|
|
21
20
|
FragmentDefinitionNode,
|
|
22
21
|
} from '../language/ast';
|
|
23
|
-
import type { ASTVisitor } from '../language/visitor';
|
|
24
22
|
import { GraphQLSchema } from '../type/schema';
|
|
25
23
|
import type {
|
|
26
24
|
GraphQLInputType,
|
|
@@ -30,61 +28,7 @@ import type {
|
|
|
30
28
|
GraphQLArgument,
|
|
31
29
|
} from '../type/definition';
|
|
32
30
|
import type { GraphQLDirective } from '../type/directives';
|
|
33
|
-
import { assertValidSchema } from '../type/validate';
|
|
34
31
|
import { TypeInfo } from '../utilities/TypeInfo';
|
|
35
|
-
import { specifiedRules } from './specifiedRules';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Implements the "Validation" section of the spec.
|
|
39
|
-
*
|
|
40
|
-
* Validation runs synchronously, returning an array of encountered errors, or
|
|
41
|
-
* an empty array if no errors were encountered and the document is valid.
|
|
42
|
-
*
|
|
43
|
-
* A list of specific validation rules may be provided. If not provided, the
|
|
44
|
-
* default list of rules defined by the GraphQL specification will be used.
|
|
45
|
-
*
|
|
46
|
-
* Each validation rules is a function which returns a visitor
|
|
47
|
-
* (see the language/visitor API). Visitor methods are expected to return
|
|
48
|
-
* GraphQLErrors, or Arrays of GraphQLErrors when invalid.
|
|
49
|
-
*
|
|
50
|
-
* Optionally a custom TypeInfo instance may be provided. If not provided, one
|
|
51
|
-
* will be created from the provided schema.
|
|
52
|
-
*/
|
|
53
|
-
export function validate(
|
|
54
|
-
schema: GraphQLSchema,
|
|
55
|
-
ast: DocumentNode,
|
|
56
|
-
rules?: $ReadOnlyArray<any>,
|
|
57
|
-
typeInfo?: TypeInfo,
|
|
58
|
-
): $ReadOnlyArray<GraphQLError> {
|
|
59
|
-
invariant(ast, 'Must provide document');
|
|
60
|
-
// If the schema used for validation is invalid, throw an error.
|
|
61
|
-
assertValidSchema(schema);
|
|
62
|
-
return visitUsingRules(
|
|
63
|
-
schema,
|
|
64
|
-
typeInfo || new TypeInfo(schema),
|
|
65
|
-
ast,
|
|
66
|
-
rules || specifiedRules,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* This uses a specialized visitor which runs multiple visitors in parallel,
|
|
72
|
-
* while maintaining the visitor skip and break API.
|
|
73
|
-
*
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
function visitUsingRules(
|
|
77
|
-
schema: GraphQLSchema,
|
|
78
|
-
typeInfo: TypeInfo,
|
|
79
|
-
documentAST: DocumentNode,
|
|
80
|
-
rules: $ReadOnlyArray<(ValidationContext) => ASTVisitor>,
|
|
81
|
-
): $ReadOnlyArray<GraphQLError> {
|
|
82
|
-
const context = new ValidationContext(schema, documentAST, typeInfo);
|
|
83
|
-
const visitors = rules.map(rule => rule(context));
|
|
84
|
-
// Visit the whole document with each instance of all provided rules.
|
|
85
|
-
visit(documentAST, visitWithTypeInfo(typeInfo, visitInParallel(visitors)));
|
|
86
|
-
return context.getErrors();
|
|
87
|
-
}
|
|
88
32
|
|
|
89
33
|
type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
|
|
90
34
|
type VariableUsage = { node: VariableNode, type: ?GraphQLInputType };
|
|
@@ -94,7 +38,7 @@ type VariableUsage = { node: VariableNode, type: ?GraphQLInputType };
|
|
|
94
38
|
* allowing access to commonly useful contextual information from within a
|
|
95
39
|
* validation rule.
|
|
96
40
|
*/
|
|
97
|
-
export class ValidationContext {
|
|
41
|
+
export default class ValidationContext {
|
|
98
42
|
_schema: GraphQLSchema;
|
|
99
43
|
_ast: DocumentNode;
|
|
100
44
|
_typeInfo: TypeInfo;
|
|
@@ -1,71 +1,27 @@
|
|
|
1
1
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import { GraphQLError } from '../error';
|
|
15
|
-
import { visit, visitInParallel, visitWithTypeInfo } from '../language/visitor';
|
|
16
|
-
import * as Kind from '../language/kinds';
|
|
3
|
+
import { GraphQLError } from '../error'; /**
|
|
4
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* strict
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { visit, visitWithTypeInfo } from '../language/visitor';
|
|
13
|
+
import { Kind } from '../language/kinds';
|
|
17
14
|
|
|
18
15
|
import { GraphQLSchema } from '../type/schema';
|
|
19
16
|
|
|
20
|
-
import { assertValidSchema } from '../type/validate';
|
|
21
17
|
import { TypeInfo } from '../utilities/TypeInfo';
|
|
22
|
-
import { specifiedRules } from './specifiedRules';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Implements the "Validation" section of the spec.
|
|
26
|
-
*
|
|
27
|
-
* Validation runs synchronously, returning an array of encountered errors, or
|
|
28
|
-
* an empty array if no errors were encountered and the document is valid.
|
|
29
|
-
*
|
|
30
|
-
* A list of specific validation rules may be provided. If not provided, the
|
|
31
|
-
* default list of rules defined by the GraphQL specification will be used.
|
|
32
|
-
*
|
|
33
|
-
* Each validation rules is a function which returns a visitor
|
|
34
|
-
* (see the language/visitor API). Visitor methods are expected to return
|
|
35
|
-
* GraphQLErrors, or Arrays of GraphQLErrors when invalid.
|
|
36
|
-
*
|
|
37
|
-
* Optionally a custom TypeInfo instance may be provided. If not provided, one
|
|
38
|
-
* will be created from the provided schema.
|
|
39
|
-
*/
|
|
40
|
-
export function validate(schema, ast, rules, typeInfo) {
|
|
41
|
-
!ast ? invariant(0, 'Must provide document') : void 0;
|
|
42
|
-
// If the schema used for validation is invalid, throw an error.
|
|
43
|
-
assertValidSchema(schema);
|
|
44
|
-
return visitUsingRules(schema, typeInfo || new TypeInfo(schema), ast, rules || specifiedRules);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* This uses a specialized visitor which runs multiple visitors in parallel,
|
|
49
|
-
* while maintaining the visitor skip and break API.
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
function visitUsingRules(schema, typeInfo, documentAST, rules) {
|
|
54
|
-
var context = new ValidationContext(schema, documentAST, typeInfo);
|
|
55
|
-
var visitors = rules.map(function (rule) {
|
|
56
|
-
return rule(context);
|
|
57
|
-
});
|
|
58
|
-
// Visit the whole document with each instance of all provided rules.
|
|
59
|
-
visit(documentAST, visitWithTypeInfo(typeInfo, visitInParallel(visitors)));
|
|
60
|
-
return context.getErrors();
|
|
61
|
-
}
|
|
62
18
|
|
|
63
19
|
/**
|
|
64
20
|
* An instance of this class is passed as the "this" context to all validators,
|
|
65
21
|
* allowing access to commonly useful contextual information from within a
|
|
66
22
|
* validation rule.
|
|
67
23
|
*/
|
|
68
|
-
|
|
24
|
+
var ValidationContext = function () {
|
|
69
25
|
function ValidationContext(schema, ast, typeInfo) {
|
|
70
26
|
_classCallCheck(this, ValidationContext);
|
|
71
27
|
|
|
@@ -216,4 +172,6 @@ export var ValidationContext = function () {
|
|
|
216
172
|
};
|
|
217
173
|
|
|
218
174
|
return ValidationContext;
|
|
219
|
-
}();
|
|
175
|
+
}();
|
|
176
|
+
|
|
177
|
+
export default ValidationContext;
|
package/validation/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.VariablesInAllowedPositionRule = exports.VariablesDefaultValueAllowedRule = exports.VariablesAreInputTypesRule = exports.ValuesOfCorrectTypeRule = exports.UniqueVariableNamesRule = exports.UniqueOperationNamesRule = exports.UniqueInputFieldNamesRule = exports.UniqueFragmentNamesRule = exports.UniqueDirectivesPerLocationRule = exports.UniqueArgumentNamesRule = exports.SingleFieldSubscriptionsRule = exports.ScalarLeafsRule = exports.ProvidedNonNullArgumentsRule = exports.PossibleFragmentSpreadsRule = exports.OverlappingFieldsCanBeMergedRule = exports.NoUnusedVariablesRule = exports.NoUnusedFragmentsRule = exports.NoUndefinedVariablesRule = exports.NoFragmentCyclesRule = exports.LoneAnonymousOperationRule = exports.KnownTypeNamesRule = exports.KnownFragmentNamesRule = exports.KnownDirectivesRule = exports.KnownArgumentNamesRule = exports.FragmentsOnCompositeTypesRule = exports.FieldsOnCorrectTypeRule = exports.specifiedRules = exports.ValidationContext = exports.validate = undefined;
|
|
6
7
|
|
|
7
8
|
var _validate = require('./validate');
|
|
8
9
|
|
|
@@ -12,12 +13,6 @@ Object.defineProperty(exports, 'validate', {
|
|
|
12
13
|
return _validate.validate;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
|
-
Object.defineProperty(exports, 'ValidationContext', {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function get() {
|
|
18
|
-
return _validate.ValidationContext;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
16
|
|
|
22
17
|
var _specifiedRules = require('./specifiedRules');
|
|
23
18
|
|
|
@@ -260,4 +255,14 @@ Object.defineProperty(exports, 'VariablesInAllowedPositionRule', {
|
|
|
260
255
|
get: function get() {
|
|
261
256
|
return _VariablesInAllowedPosition.VariablesInAllowedPosition;
|
|
262
257
|
}
|
|
263
|
-
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
var _ValidationContext = require('./ValidationContext');
|
|
261
|
+
|
|
262
|
+
var _ValidationContext2 = _interopRequireDefault(_ValidationContext);
|
|
263
|
+
|
|
264
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
265
|
+
|
|
266
|
+
exports.ValidationContext = _ValidationContext2.default;
|
|
267
|
+
|
|
268
|
+
// https://github.com/tc39/proposal-export-default-from
|
package/validation/index.js.flow
CHANGED
|
@@ -4,10 +4,14 @@
|
|
|
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
|
-
export { validate
|
|
10
|
+
export { validate } from './validate';
|
|
11
|
+
|
|
12
|
+
// https://github.com/tc39/proposal-export-default-from
|
|
13
|
+
import ValidationContext from './ValidationContext';
|
|
14
|
+
export { ValidationContext };
|
|
11
15
|
|
|
12
16
|
export { specifiedRules } from './specifiedRules';
|
|
13
17
|
|
|
@@ -4,10 +4,14 @@
|
|
|
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
|
-
export { validate
|
|
10
|
+
export { validate } from './validate';
|
|
11
|
+
|
|
12
|
+
// https://github.com/tc39/proposal-export-default-from
|
|
13
|
+
import ValidationContext from './ValidationContext';
|
|
14
|
+
export { ValidationContext };
|
|
11
15
|
|
|
12
16
|
export { specifiedRules } from './specifiedRules';
|
|
13
17
|
|
|
@@ -26,15 +26,15 @@ function nonExecutableDefinitionMessage(defName) {
|
|
|
26
26
|
* This source code is licensed under the MIT license found in the
|
|
27
27
|
* LICENSE file in the root directory of this source tree.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* strict
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
function ExecutableDefinitions(context) {
|
|
33
33
|
return {
|
|
34
34
|
Document: function Document(node) {
|
|
35
35
|
node.definitions.forEach(function (definition) {
|
|
36
|
-
if (definition.kind !== _kinds.OPERATION_DEFINITION && definition.kind !== _kinds.FRAGMENT_DEFINITION) {
|
|
37
|
-
context.reportError(new _error.GraphQLError(nonExecutableDefinitionMessage(definition.kind === _kinds.SCHEMA_DEFINITION ? 'schema' : definition.name.value), [definition]));
|
|
36
|
+
if (definition.kind !== _kinds.Kind.OPERATION_DEFINITION && definition.kind !== _kinds.Kind.FRAGMENT_DEFINITION) {
|
|
37
|
+
context.reportError(new _error.GraphQLError(nonExecutableDefinitionMessage(definition.kind === _kinds.Kind.SCHEMA_DEFINITION ? 'schema' : definition.name.value), [definition]));
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
return false;
|
|
@@ -4,16 +4,12 @@
|
|
|
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
|
-
import type
|
|
10
|
+
import type ValidationContext from '../ValidationContext';
|
|
11
11
|
import { GraphQLError } from '../../error';
|
|
12
|
-
import {
|
|
13
|
-
FRAGMENT_DEFINITION,
|
|
14
|
-
OPERATION_DEFINITION,
|
|
15
|
-
SCHEMA_DEFINITION,
|
|
16
|
-
} from '../../language/kinds';
|
|
12
|
+
import { Kind } from '../../language/kinds';
|
|
17
13
|
import type { ASTVisitor } from '../../language/visitor';
|
|
18
14
|
|
|
19
15
|
export function nonExecutableDefinitionMessage(defName: string): string {
|
|
@@ -31,13 +27,13 @@ export function ExecutableDefinitions(context: ValidationContext): ASTVisitor {
|
|
|
31
27
|
Document(node) {
|
|
32
28
|
node.definitions.forEach(definition => {
|
|
33
29
|
if (
|
|
34
|
-
definition.kind !== OPERATION_DEFINITION &&
|
|
35
|
-
definition.kind !== FRAGMENT_DEFINITION
|
|
30
|
+
definition.kind !== Kind.OPERATION_DEFINITION &&
|
|
31
|
+
definition.kind !== Kind.FRAGMENT_DEFINITION
|
|
36
32
|
) {
|
|
37
33
|
context.reportError(
|
|
38
34
|
new GraphQLError(
|
|
39
35
|
nonExecutableDefinitionMessage(
|
|
40
|
-
definition.kind === SCHEMA_DEFINITION
|
|
36
|
+
definition.kind === Kind.SCHEMA_DEFINITION
|
|
41
37
|
? 'schema'
|
|
42
38
|
: definition.name.value,
|
|
43
39
|
),
|
|
@@ -5,10 +5,10 @@ import { GraphQLError } from '../../error'; /**
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { Kind } from '../../language/kinds';
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
export function nonExecutableDefinitionMessage(defName) {
|
|
@@ -25,8 +25,8 @@ export function ExecutableDefinitions(context) {
|
|
|
25
25
|
return {
|
|
26
26
|
Document: function Document(node) {
|
|
27
27
|
node.definitions.forEach(function (definition) {
|
|
28
|
-
if (definition.kind !== OPERATION_DEFINITION && definition.kind !== FRAGMENT_DEFINITION) {
|
|
29
|
-
context.reportError(new GraphQLError(nonExecutableDefinitionMessage(definition.kind === SCHEMA_DEFINITION ? 'schema' : definition.name.value), [definition]));
|
|
28
|
+
if (definition.kind !== Kind.OPERATION_DEFINITION && definition.kind !== Kind.FRAGMENT_DEFINITION) {
|
|
29
|
+
context.reportError(new GraphQLError(nonExecutableDefinitionMessage(definition.kind === Kind.SCHEMA_DEFINITION ? 'schema' : definition.name.value), [definition]));
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
return false;
|
|
@@ -43,7 +43,7 @@ function undefinedFieldMessage(fieldName, type, suggestedTypeNames, suggestedFie
|
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
46
|
+
* strict
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
function FieldsOnCorrectType(context) {
|
|
@@ -4,10 +4,10 @@
|
|
|
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
|
-
import type
|
|
10
|
+
import type ValidationContext from '../ValidationContext';
|
|
11
11
|
import { GraphQLError } from '../../error';
|
|
12
12
|
import suggestionList from '../../jsutils/suggestionList';
|
|
13
13
|
import quotedOrList from '../../jsutils/quotedOrList';
|
|
@@ -23,7 +23,7 @@ function inlineFragmentOnNonCompositeErrorMessage(type) {
|
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
26
|
+
* strict
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
function fragmentOnNonCompositeErrorMessage(fragName, type) {
|
|
@@ -4,10 +4,10 @@
|
|
|
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
|
-
import type
|
|
10
|
+
import type ValidationContext from '../ValidationContext';
|
|
11
11
|
import { GraphQLError } from '../../error';
|
|
12
12
|
import { print } from '../../language/printer';
|
|
13
13
|
import type { ASTVisitor } from '../../language/visitor';
|
|
@@ -33,7 +33,7 @@ function unknownArgMessage(argName, fieldName, typeName, suggestedArgs) {
|
|
|
33
33
|
* This source code is licensed under the MIT license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* strict
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
function unknownDirectiveArgMessage(argName, directiveName, suggestedArgs) {
|
|
@@ -56,7 +56,7 @@ function KnownArgumentNames(context) {
|
|
|
56
56
|
var argDef = context.getArgument();
|
|
57
57
|
if (!argDef) {
|
|
58
58
|
var argumentOf = ancestors[ancestors.length - 1];
|
|
59
|
-
if (argumentOf.kind === _kinds.FIELD) {
|
|
59
|
+
if (argumentOf.kind === _kinds.Kind.FIELD) {
|
|
60
60
|
var fieldDef = context.getFieldDef();
|
|
61
61
|
var parentType = context.getParentType();
|
|
62
62
|
if (fieldDef && parentType) {
|
|
@@ -64,7 +64,7 @@ function KnownArgumentNames(context) {
|
|
|
64
64
|
return arg.name;
|
|
65
65
|
}))), [node]));
|
|
66
66
|
}
|
|
67
|
-
} else if (argumentOf.kind === _kinds.DIRECTIVE) {
|
|
67
|
+
} else if (argumentOf.kind === _kinds.Kind.DIRECTIVE) {
|
|
68
68
|
var directive = context.getDirective();
|
|
69
69
|
if (directive) {
|
|
70
70
|
context.reportError(new _error.GraphQLError(unknownDirectiveArgMessage(node.name.value, directive.name, (0, _suggestionList2.default)(node.name.value, directive.args.map(function (arg) {
|
|
@@ -4,15 +4,15 @@
|
|
|
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
|
-
import type
|
|
10
|
+
import type ValidationContext from '../ValidationContext';
|
|
11
11
|
import { GraphQLError } from '../../error';
|
|
12
12
|
import type { ASTVisitor } from '../../language/visitor';
|
|
13
13
|
import suggestionList from '../../jsutils/suggestionList';
|
|
14
14
|
import quotedOrList from '../../jsutils/quotedOrList';
|
|
15
|
-
import {
|
|
15
|
+
import { Kind } from '../../language/kinds';
|
|
16
16
|
|
|
17
17
|
export function unknownArgMessage(
|
|
18
18
|
argName: string,
|
|
@@ -34,9 +34,7 @@ export function unknownDirectiveArgMessage(
|
|
|
34
34
|
directiveName: string,
|
|
35
35
|
suggestedArgs: Array<string>,
|
|
36
36
|
): string {
|
|
37
|
-
let message = `Unknown argument "${argName}" on directive "@${
|
|
38
|
-
directiveName
|
|
39
|
-
}".`;
|
|
37
|
+
let message = `Unknown argument "${argName}" on directive "@${directiveName}".`;
|
|
40
38
|
if (suggestedArgs.length) {
|
|
41
39
|
message += ` Did you mean ${quotedOrList(suggestedArgs)}?`;
|
|
42
40
|
}
|
|
@@ -55,7 +53,7 @@ export function KnownArgumentNames(context: ValidationContext): ASTVisitor {
|
|
|
55
53
|
const argDef = context.getArgument();
|
|
56
54
|
if (!argDef) {
|
|
57
55
|
const argumentOf = ancestors[ancestors.length - 1];
|
|
58
|
-
if (argumentOf.kind === FIELD) {
|
|
56
|
+
if (argumentOf.kind === Kind.FIELD) {
|
|
59
57
|
const fieldDef = context.getFieldDef();
|
|
60
58
|
const parentType = context.getParentType();
|
|
61
59
|
if (fieldDef && parentType) {
|
|
@@ -74,7 +72,7 @@ export function KnownArgumentNames(context: ValidationContext): ASTVisitor {
|
|
|
74
72
|
),
|
|
75
73
|
);
|
|
76
74
|
}
|
|
77
|
-
} else if (argumentOf.kind === DIRECTIVE) {
|
|
75
|
+
} else if (argumentOf.kind === Kind.DIRECTIVE) {
|
|
78
76
|
const directive = context.getDirective();
|
|
79
77
|
if (directive) {
|
|
80
78
|
context.reportError(
|