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,225 @@
|
|
|
1
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
+
|
|
3
|
+
import keyValMap from '../jsutils/keyValMap'; /**
|
|
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 objectValues from '../jsutils/objectValues';
|
|
13
|
+
import { GraphQLSchema } from '../type/schema';
|
|
14
|
+
import { GraphQLDirective } from '../type/directives';
|
|
15
|
+
|
|
16
|
+
import { GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, isListType, isNonNullType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType } from '../type/definition';
|
|
17
|
+
import { isSpecifiedScalarType } from '../type/scalars';
|
|
18
|
+
import { isIntrospectionType } from '../type/introspection';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Sort GraphQLSchema.
|
|
22
|
+
*/
|
|
23
|
+
export function lexicographicSortSchema(schema) {
|
|
24
|
+
var cache = Object.create(null);
|
|
25
|
+
|
|
26
|
+
var sortMaybeType = function sortMaybeType(maybeType) {
|
|
27
|
+
return maybeType && sortNamedType(maybeType);
|
|
28
|
+
};
|
|
29
|
+
return new GraphQLSchema({
|
|
30
|
+
types: sortTypes(objectValues(schema.getTypeMap())),
|
|
31
|
+
directives: sortByName(schema.getDirectives()).map(sortDirective),
|
|
32
|
+
query: sortMaybeType(schema.getQueryType()),
|
|
33
|
+
mutation: sortMaybeType(schema.getMutationType()),
|
|
34
|
+
subscription: sortMaybeType(schema.getSubscriptionType()),
|
|
35
|
+
astNode: schema.astNode
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function sortDirective(directive) {
|
|
39
|
+
return new GraphQLDirective({
|
|
40
|
+
name: directive.name,
|
|
41
|
+
description: directive.description,
|
|
42
|
+
locations: sortBy(directive.locations, function (x) {
|
|
43
|
+
return x;
|
|
44
|
+
}),
|
|
45
|
+
args: sortArgs(directive.args),
|
|
46
|
+
astNode: directive.astNode
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function sortArgs(args) {
|
|
51
|
+
return keyValMap(sortByName(args), function (arg) {
|
|
52
|
+
return arg.name;
|
|
53
|
+
}, function (arg) {
|
|
54
|
+
return _extends({}, arg, {
|
|
55
|
+
type: sortType(arg.type)
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function sortFields(fieldsMap) {
|
|
61
|
+
return sortObjMap(fieldsMap, function (field) {
|
|
62
|
+
return {
|
|
63
|
+
type: sortType(field.type),
|
|
64
|
+
args: sortArgs(field.args),
|
|
65
|
+
resolve: field.resolve,
|
|
66
|
+
subscribe: field.subscribe,
|
|
67
|
+
deprecationReason: field.deprecationReason,
|
|
68
|
+
description: field.description,
|
|
69
|
+
astNode: field.astNode
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function sortInputFields(fieldsMap) {
|
|
75
|
+
return sortObjMap(fieldsMap, function (field) {
|
|
76
|
+
return {
|
|
77
|
+
type: sortType(field.type),
|
|
78
|
+
defaultValue: field.defaultValue,
|
|
79
|
+
description: field.description,
|
|
80
|
+
astNode: field.astNode
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function sortType(type) {
|
|
86
|
+
if (isListType(type)) {
|
|
87
|
+
return new GraphQLList(sortType(type.ofType));
|
|
88
|
+
} else if (isNonNullType(type)) {
|
|
89
|
+
return new GraphQLNonNull(sortType(type.ofType));
|
|
90
|
+
}
|
|
91
|
+
return sortNamedType(type);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function sortTypes(arr) {
|
|
95
|
+
return sortByName(arr).map(sortNamedType);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function sortNamedType(type) {
|
|
99
|
+
if (isSpecifiedScalarType(type) || isIntrospectionType(type)) {
|
|
100
|
+
return type;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var sortedType = cache[type.name];
|
|
104
|
+
if (!sortedType) {
|
|
105
|
+
sortedType = sortNamedTypeImpl(type);
|
|
106
|
+
cache[type.name] = sortedType;
|
|
107
|
+
}
|
|
108
|
+
return sortedType;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function sortNamedTypeImpl(type) {
|
|
112
|
+
if (isScalarType(type)) {
|
|
113
|
+
return type;
|
|
114
|
+
} else if (isObjectType(type)) {
|
|
115
|
+
return new GraphQLObjectType({
|
|
116
|
+
name: type.name,
|
|
117
|
+
interfaces: function interfaces() {
|
|
118
|
+
return sortTypes(type.getInterfaces());
|
|
119
|
+
},
|
|
120
|
+
fields: function fields() {
|
|
121
|
+
return sortFields(type.getFields());
|
|
122
|
+
},
|
|
123
|
+
isTypeOf: type.isTypeOf,
|
|
124
|
+
description: type.description,
|
|
125
|
+
astNode: type.astNode,
|
|
126
|
+
extensionASTNodes: type.extensionASTNodes
|
|
127
|
+
});
|
|
128
|
+
} else if (isInterfaceType(type)) {
|
|
129
|
+
return new GraphQLInterfaceType({
|
|
130
|
+
name: type.name,
|
|
131
|
+
fields: function fields() {
|
|
132
|
+
return sortFields(type.getFields());
|
|
133
|
+
},
|
|
134
|
+
resolveType: type.resolveType,
|
|
135
|
+
description: type.description,
|
|
136
|
+
astNode: type.astNode,
|
|
137
|
+
extensionASTNodes: type.extensionASTNodes
|
|
138
|
+
});
|
|
139
|
+
} else if (isUnionType(type)) {
|
|
140
|
+
return new GraphQLUnionType({
|
|
141
|
+
name: type.name,
|
|
142
|
+
types: function types() {
|
|
143
|
+
return sortTypes(type.getTypes());
|
|
144
|
+
},
|
|
145
|
+
resolveType: type.resolveType,
|
|
146
|
+
description: type.description,
|
|
147
|
+
astNode: type.astNode
|
|
148
|
+
});
|
|
149
|
+
} else if (isEnumType(type)) {
|
|
150
|
+
return new GraphQLEnumType({
|
|
151
|
+
name: type.name,
|
|
152
|
+
values: keyValMap(sortByName(type.getValues()), function (val) {
|
|
153
|
+
return val.name;
|
|
154
|
+
}, function (val) {
|
|
155
|
+
return {
|
|
156
|
+
value: val.value,
|
|
157
|
+
deprecationReason: val.deprecationReason,
|
|
158
|
+
description: val.description,
|
|
159
|
+
astNode: val.astNode
|
|
160
|
+
};
|
|
161
|
+
}),
|
|
162
|
+
description: type.description,
|
|
163
|
+
astNode: type.astNode
|
|
164
|
+
});
|
|
165
|
+
} else if (isInputObjectType(type)) {
|
|
166
|
+
return new GraphQLInputObjectType({
|
|
167
|
+
name: type.name,
|
|
168
|
+
fields: function fields() {
|
|
169
|
+
return sortInputFields(type.getFields());
|
|
170
|
+
},
|
|
171
|
+
description: type.description,
|
|
172
|
+
astNode: type.astNode
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
throw new Error('Unknown type: "' + type + '"');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function sortObjMap(map, sortValueFn) {
|
|
180
|
+
var sortedMap = Object.create(null);
|
|
181
|
+
var sortedKeys = sortBy(Object.keys(map), function (x) {
|
|
182
|
+
return x;
|
|
183
|
+
});
|
|
184
|
+
var _iteratorNormalCompletion = true;
|
|
185
|
+
var _didIteratorError = false;
|
|
186
|
+
var _iteratorError = undefined;
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
for (var _iterator = sortedKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
190
|
+
var key = _step.value;
|
|
191
|
+
|
|
192
|
+
var value = map[key];
|
|
193
|
+
sortedMap[key] = sortValueFn ? sortValueFn(value) : value;
|
|
194
|
+
}
|
|
195
|
+
} catch (err) {
|
|
196
|
+
_didIteratorError = true;
|
|
197
|
+
_iteratorError = err;
|
|
198
|
+
} finally {
|
|
199
|
+
try {
|
|
200
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
201
|
+
_iterator.return();
|
|
202
|
+
}
|
|
203
|
+
} finally {
|
|
204
|
+
if (_didIteratorError) {
|
|
205
|
+
throw _iteratorError;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return sortedMap;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function sortByName(array) {
|
|
214
|
+
return sortBy(array, function (obj) {
|
|
215
|
+
return obj.name;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function sortBy(array, mapToKey) {
|
|
220
|
+
return array.slice().sort(function (obj1, obj2) {
|
|
221
|
+
var key1 = mapToKey(obj1);
|
|
222
|
+
var key2 = mapToKey(obj2);
|
|
223
|
+
return key1.localeCompare(key2);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
@@ -15,6 +15,10 @@ var _isInvalid = require('../jsutils/isInvalid');
|
|
|
15
15
|
|
|
16
16
|
var _isInvalid2 = _interopRequireDefault(_isInvalid);
|
|
17
17
|
|
|
18
|
+
var _objectValues = require('../jsutils/objectValues');
|
|
19
|
+
|
|
20
|
+
var _objectValues2 = _interopRequireDefault(_objectValues);
|
|
21
|
+
|
|
18
22
|
var _astFromValue = require('../utilities/astFromValue');
|
|
19
23
|
|
|
20
24
|
var _printer = require('../language/printer');
|
|
@@ -36,20 +40,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
36
40
|
* Provide true to use preceding comments as the description.
|
|
37
41
|
*
|
|
38
42
|
*/
|
|
39
|
-
/**
|
|
40
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
41
|
-
*
|
|
42
|
-
* This source code is licensed under the MIT license found in the
|
|
43
|
-
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
43
|
function printSchema(schema, options) {
|
|
49
44
|
return printFilteredSchema(schema, function (n) {
|
|
50
45
|
return !(0, _directives.isSpecifiedDirective)(n);
|
|
51
46
|
}, isDefinedType, options);
|
|
52
|
-
}
|
|
47
|
+
} /**
|
|
48
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*
|
|
53
|
+
* strict
|
|
54
|
+
*/
|
|
53
55
|
|
|
54
56
|
function printIntrospectionSchema(schema, options) {
|
|
55
57
|
return printFilteredSchema(schema, _directives.isSpecifiedDirective, _introspection.isIntrospectionType, options);
|
|
@@ -62,10 +64,8 @@ function isDefinedType(type) {
|
|
|
62
64
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
63
65
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
64
66
|
var typeMap = schema.getTypeMap();
|
|
65
|
-
var types =
|
|
66
|
-
return
|
|
67
|
-
}).map(function (typeName) {
|
|
68
|
-
return typeMap[typeName];
|
|
67
|
+
var types = (0, _objectValues2.default)(typeMap).sort(function (type1, type2) {
|
|
68
|
+
return type1.name.localeCompare(type2.name);
|
|
69
69
|
}).filter(typeFilter);
|
|
70
70
|
|
|
71
71
|
return [printSchemaDefinition(schema)].concat(directives.map(function (directive) {
|
|
@@ -157,7 +157,7 @@ function printObject(type, options) {
|
|
|
157
157
|
var interfaces = type.getInterfaces();
|
|
158
158
|
var implementedInterfaces = interfaces.length ? ' implements ' + interfaces.map(function (i) {
|
|
159
159
|
return i.name;
|
|
160
|
-
}).join('
|
|
160
|
+
}).join(' & ') : '';
|
|
161
161
|
return printDescription(options, type) + ('type ' + type.name + implementedInterfaces + ' {\n') + printFields(options, type) + '\n' + '}';
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -180,20 +180,14 @@ function printEnumValues(values, options) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function printInputObject(type, options) {
|
|
183
|
-
var
|
|
184
|
-
var fields = Object.keys(fieldMap).map(function (fieldName) {
|
|
185
|
-
return fieldMap[fieldName];
|
|
186
|
-
});
|
|
183
|
+
var fields = (0, _objectValues2.default)(type.getFields());
|
|
187
184
|
return printDescription(options, type) + ('input ' + type.name + ' {\n') + fields.map(function (f, i) {
|
|
188
185
|
return printDescription(options, f, ' ', !i) + ' ' + printInputValue(f);
|
|
189
186
|
}).join('\n') + '\n' + '}';
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
function printFields(options, type) {
|
|
193
|
-
var
|
|
194
|
-
var fields = Object.keys(fieldMap).map(function (fieldName) {
|
|
195
|
-
return fieldMap[fieldName];
|
|
196
|
-
});
|
|
190
|
+
var fields = (0, _objectValues2.default)(type.getFields());
|
|
197
191
|
return fields.map(function (f, i) {
|
|
198
192
|
return printDescription(options, f, ' ', !i) + ' ' + f.name + printArgs(options, f.args, ' ') + ': ' + String(f.type) + printDeprecated(f);
|
|
199
193
|
}).join('\n');
|
|
@@ -254,15 +248,23 @@ function printDescription(options, def) {
|
|
|
254
248
|
return printDescriptionWithComments(lines, indentation, firstInBlock);
|
|
255
249
|
}
|
|
256
250
|
|
|
257
|
-
var description = indentation && !firstInBlock ? '\n' : '';
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
251
|
+
var description = indentation && !firstInBlock ? '\n' + indentation + '"""' : indentation + '"""';
|
|
252
|
+
|
|
253
|
+
// In some circumstances, a single line can be used for the description.
|
|
254
|
+
if (lines.length === 1 && lines[0].length < 70 && lines[0][lines[0].length - 1] !== '"') {
|
|
255
|
+
return description + escapeQuote(lines[0]) + '"""\n';
|
|
261
256
|
}
|
|
262
257
|
|
|
263
|
-
|
|
258
|
+
// Format a multi-line block quote to account for leading space.
|
|
259
|
+
var hasLeadingSpace = lines[0][0] === ' ' || lines[0][0] === '\t';
|
|
260
|
+
if (!hasLeadingSpace) {
|
|
261
|
+
description += '\n';
|
|
262
|
+
}
|
|
264
263
|
for (var i = 0; i < lines.length; i++) {
|
|
265
|
-
|
|
264
|
+
if (i !== 0 || !hasLeadingSpace) {
|
|
265
|
+
description += indentation;
|
|
266
|
+
}
|
|
267
|
+
description += escapeQuote(lines[i]) + '\n';
|
|
266
268
|
}
|
|
267
269
|
description += indentation + '"""\n';
|
|
268
270
|
return description;
|
|
@@ -4,11 +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
10
|
import isNullish from '../jsutils/isNullish';
|
|
11
11
|
import isInvalid from '../jsutils/isInvalid';
|
|
12
|
+
import objectValues from '../jsutils/objectValues';
|
|
12
13
|
import { astFromValue } from '../utilities/astFromValue';
|
|
13
14
|
import { print } from '../language/printer';
|
|
14
15
|
import type { GraphQLSchema } from '../type/schema';
|
|
@@ -79,9 +80,8 @@ function printFilteredSchema(
|
|
|
79
80
|
): string {
|
|
80
81
|
const directives = schema.getDirectives().filter(directiveFilter);
|
|
81
82
|
const typeMap = schema.getTypeMap();
|
|
82
|
-
const types =
|
|
83
|
-
.sort((
|
|
84
|
-
.map(typeName => typeMap[typeName])
|
|
83
|
+
const types = objectValues(typeMap)
|
|
84
|
+
.sort((type1, type2) => type1.name.localeCompare(type2.name))
|
|
85
85
|
.filter(typeFilter);
|
|
86
86
|
|
|
87
87
|
return (
|
|
@@ -176,7 +176,7 @@ function printScalar(type: GraphQLScalarType, options): string {
|
|
|
176
176
|
function printObject(type: GraphQLObjectType, options): string {
|
|
177
177
|
const interfaces = type.getInterfaces();
|
|
178
178
|
const implementedInterfaces = interfaces.length
|
|
179
|
-
? ' implements ' + interfaces.map(i => i.name).join('
|
|
179
|
+
? ' implements ' + interfaces.map(i => i.name).join(' & ')
|
|
180
180
|
: '';
|
|
181
181
|
return (
|
|
182
182
|
printDescription(options, type) +
|
|
@@ -227,8 +227,7 @@ function printEnumValues(values, options): string {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function printInputObject(type: GraphQLInputObjectType, options): string {
|
|
230
|
-
const
|
|
231
|
-
const fields = Object.keys(fieldMap).map(fieldName => fieldMap[fieldName]);
|
|
230
|
+
const fields = objectValues(type.getFields());
|
|
232
231
|
return (
|
|
233
232
|
printDescription(options, type) +
|
|
234
233
|
`input ${type.name} {\n` +
|
|
@@ -244,8 +243,7 @@ function printInputObject(type: GraphQLInputObjectType, options): string {
|
|
|
244
243
|
}
|
|
245
244
|
|
|
246
245
|
function printFields(options, type) {
|
|
247
|
-
const
|
|
248
|
-
const fields = Object.keys(fieldMap).map(fieldName => fieldMap[fieldName]);
|
|
246
|
+
const fields = objectValues(type.getFields());
|
|
249
247
|
return fields
|
|
250
248
|
.map(
|
|
251
249
|
(f, i) =>
|
|
@@ -338,15 +336,30 @@ function printDescription(
|
|
|
338
336
|
return printDescriptionWithComments(lines, indentation, firstInBlock);
|
|
339
337
|
}
|
|
340
338
|
|
|
341
|
-
let description =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
339
|
+
let description =
|
|
340
|
+
indentation && !firstInBlock
|
|
341
|
+
? '\n' + indentation + '"""'
|
|
342
|
+
: indentation + '"""';
|
|
343
|
+
|
|
344
|
+
// In some circumstances, a single line can be used for the description.
|
|
345
|
+
if (
|
|
346
|
+
lines.length === 1 &&
|
|
347
|
+
lines[0].length < 70 &&
|
|
348
|
+
lines[0][lines[0].length - 1] !== '"'
|
|
349
|
+
) {
|
|
350
|
+
return description + escapeQuote(lines[0]) + '"""\n';
|
|
345
351
|
}
|
|
346
352
|
|
|
347
|
-
|
|
353
|
+
// Format a multi-line block quote to account for leading space.
|
|
354
|
+
const hasLeadingSpace = lines[0][0] === ' ' || lines[0][0] === '\t';
|
|
355
|
+
if (!hasLeadingSpace) {
|
|
356
|
+
description += '\n';
|
|
357
|
+
}
|
|
348
358
|
for (let i = 0; i < lines.length; i++) {
|
|
349
|
-
|
|
359
|
+
if (i !== 0 || !hasLeadingSpace) {
|
|
360
|
+
description += indentation;
|
|
361
|
+
}
|
|
362
|
+
description += escapeQuote(lines[i]) + '\n';
|
|
350
363
|
}
|
|
351
364
|
description += indentation + '"""\n';
|
|
352
365
|
return description;
|
|
@@ -4,11 +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
|
-
*
|
|
7
|
+
* strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import isNullish from '../jsutils/isNullish';
|
|
11
11
|
import isInvalid from '../jsutils/isInvalid';
|
|
12
|
+
import objectValues from '../jsutils/objectValues';
|
|
12
13
|
import { astFromValue } from '../utilities/astFromValue';
|
|
13
14
|
import { print } from '../language/printer';
|
|
14
15
|
|
|
@@ -42,10 +43,8 @@ function isDefinedType(type) {
|
|
|
42
43
|
function printFilteredSchema(schema, directiveFilter, typeFilter, options) {
|
|
43
44
|
var directives = schema.getDirectives().filter(directiveFilter);
|
|
44
45
|
var typeMap = schema.getTypeMap();
|
|
45
|
-
var types =
|
|
46
|
-
return
|
|
47
|
-
}).map(function (typeName) {
|
|
48
|
-
return typeMap[typeName];
|
|
46
|
+
var types = objectValues(typeMap).sort(function (type1, type2) {
|
|
47
|
+
return type1.name.localeCompare(type2.name);
|
|
49
48
|
}).filter(typeFilter);
|
|
50
49
|
|
|
51
50
|
return [printSchemaDefinition(schema)].concat(directives.map(function (directive) {
|
|
@@ -137,7 +136,7 @@ function printObject(type, options) {
|
|
|
137
136
|
var interfaces = type.getInterfaces();
|
|
138
137
|
var implementedInterfaces = interfaces.length ? ' implements ' + interfaces.map(function (i) {
|
|
139
138
|
return i.name;
|
|
140
|
-
}).join('
|
|
139
|
+
}).join(' & ') : '';
|
|
141
140
|
return printDescription(options, type) + ('type ' + type.name + implementedInterfaces + ' {\n') + printFields(options, type) + '\n' + '}';
|
|
142
141
|
}
|
|
143
142
|
|
|
@@ -160,20 +159,14 @@ function printEnumValues(values, options) {
|
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
function printInputObject(type, options) {
|
|
163
|
-
var
|
|
164
|
-
var fields = Object.keys(fieldMap).map(function (fieldName) {
|
|
165
|
-
return fieldMap[fieldName];
|
|
166
|
-
});
|
|
162
|
+
var fields = objectValues(type.getFields());
|
|
167
163
|
return printDescription(options, type) + ('input ' + type.name + ' {\n') + fields.map(function (f, i) {
|
|
168
164
|
return printDescription(options, f, ' ', !i) + ' ' + printInputValue(f);
|
|
169
165
|
}).join('\n') + '\n' + '}';
|
|
170
166
|
}
|
|
171
167
|
|
|
172
168
|
function printFields(options, type) {
|
|
173
|
-
var
|
|
174
|
-
var fields = Object.keys(fieldMap).map(function (fieldName) {
|
|
175
|
-
return fieldMap[fieldName];
|
|
176
|
-
});
|
|
169
|
+
var fields = objectValues(type.getFields());
|
|
177
170
|
return fields.map(function (f, i) {
|
|
178
171
|
return printDescription(options, f, ' ', !i) + ' ' + f.name + printArgs(options, f.args, ' ') + ': ' + String(f.type) + printDeprecated(f);
|
|
179
172
|
}).join('\n');
|
|
@@ -234,15 +227,23 @@ function printDescription(options, def) {
|
|
|
234
227
|
return printDescriptionWithComments(lines, indentation, firstInBlock);
|
|
235
228
|
}
|
|
236
229
|
|
|
237
|
-
var description = indentation && !firstInBlock ? '\n' : '';
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
var description = indentation && !firstInBlock ? '\n' + indentation + '"""' : indentation + '"""';
|
|
231
|
+
|
|
232
|
+
// In some circumstances, a single line can be used for the description.
|
|
233
|
+
if (lines.length === 1 && lines[0].length < 70 && lines[0][lines[0].length - 1] !== '"') {
|
|
234
|
+
return description + escapeQuote(lines[0]) + '"""\n';
|
|
241
235
|
}
|
|
242
236
|
|
|
243
|
-
|
|
237
|
+
// Format a multi-line block quote to account for leading space.
|
|
238
|
+
var hasLeadingSpace = lines[0][0] === ' ' || lines[0][0] === '\t';
|
|
239
|
+
if (!hasLeadingSpace) {
|
|
240
|
+
description += '\n';
|
|
241
|
+
}
|
|
244
242
|
for (var i = 0; i < lines.length; i++) {
|
|
245
|
-
|
|
243
|
+
if (i !== 0 || !hasLeadingSpace) {
|
|
244
|
+
description += indentation;
|
|
245
|
+
}
|
|
246
|
+
description += escapeQuote(lines[i]) + '\n';
|
|
246
247
|
}
|
|
247
248
|
description += indentation + '"""\n';
|
|
248
249
|
return description;
|
|
@@ -70,7 +70,7 @@ function separateOperations(documentAST) {
|
|
|
70
70
|
* This source code is licensed under the MIT license found in the
|
|
71
71
|
* LICENSE file in the root directory of this source tree.
|
|
72
72
|
*
|
|
73
|
-
*
|
|
73
|
+
* strict
|
|
74
74
|
*/
|
|
75
75
|
|
|
76
76
|
// Provides the empty string for anonymous operations.
|
|
@@ -42,7 +42,7 @@ function isEqualType(typeA, typeB) {
|
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
44
|
*
|
|
45
|
-
*
|
|
45
|
+
* strict
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
function isTypeSubTypeOf(schema, maybeSubType, superType) {
|
|
@@ -95,29 +95,26 @@ function isTypeSubTypeOf(schema, maybeSubType, superType) {
|
|
|
95
95
|
* This function is commutative.
|
|
96
96
|
*/
|
|
97
97
|
function doTypesOverlap(schema, typeA, typeB) {
|
|
98
|
-
// So flow is aware this is constant
|
|
99
|
-
var _typeB = typeB;
|
|
100
|
-
|
|
101
98
|
// Equivalent types overlap
|
|
102
|
-
if (typeA ===
|
|
99
|
+
if (typeA === typeB) {
|
|
103
100
|
return true;
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
if ((0, _definition.isAbstractType)(typeA)) {
|
|
107
|
-
if ((0, _definition.isAbstractType)(
|
|
104
|
+
if ((0, _definition.isAbstractType)(typeB)) {
|
|
108
105
|
// If both types are abstract, then determine if there is any intersection
|
|
109
106
|
// between possible concrete types of each.
|
|
110
107
|
return schema.getPossibleTypes(typeA).some(function (type) {
|
|
111
|
-
return schema.isPossibleType(
|
|
108
|
+
return schema.isPossibleType(typeB, type);
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
// Determine if the latter type is a possible concrete type of the former.
|
|
115
|
-
return schema.isPossibleType(typeA,
|
|
112
|
+
return schema.isPossibleType(typeA, typeB);
|
|
116
113
|
}
|
|
117
114
|
|
|
118
|
-
if ((0, _definition.isAbstractType)(
|
|
115
|
+
if ((0, _definition.isAbstractType)(typeB)) {
|
|
119
116
|
// Determine if the former type is a possible concrete type of the latter.
|
|
120
|
-
return schema.isPossibleType(
|
|
117
|
+
return schema.isPossibleType(typeB, typeA);
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
// Otherwise the types do not overlap.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @flow
|
|
7
|
+
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -105,29 +105,26 @@ export function doTypesOverlap(
|
|
|
105
105
|
typeA: GraphQLCompositeType,
|
|
106
106
|
typeB: GraphQLCompositeType,
|
|
107
107
|
): boolean {
|
|
108
|
-
// So flow is aware this is constant
|
|
109
|
-
const _typeB = typeB;
|
|
110
|
-
|
|
111
108
|
// Equivalent types overlap
|
|
112
|
-
if (typeA ===
|
|
109
|
+
if (typeA === typeB) {
|
|
113
110
|
return true;
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
if (isAbstractType(typeA)) {
|
|
117
|
-
if (isAbstractType(
|
|
114
|
+
if (isAbstractType(typeB)) {
|
|
118
115
|
// If both types are abstract, then determine if there is any intersection
|
|
119
116
|
// between possible concrete types of each.
|
|
120
117
|
return schema
|
|
121
118
|
.getPossibleTypes(typeA)
|
|
122
|
-
.some(type => schema.isPossibleType(
|
|
119
|
+
.some(type => schema.isPossibleType(typeB, type));
|
|
123
120
|
}
|
|
124
121
|
// Determine if the latter type is a possible concrete type of the former.
|
|
125
|
-
return schema.isPossibleType(typeA,
|
|
122
|
+
return schema.isPossibleType(typeA, typeB);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
if (isAbstractType(
|
|
125
|
+
if (isAbstractType(typeB)) {
|
|
129
126
|
// Determine if the former type is a possible concrete type of the latter.
|
|
130
|
-
return schema.isPossibleType(
|
|
127
|
+
return schema.isPossibleType(typeB, typeA);
|
|
131
128
|
}
|
|
132
129
|
|
|
133
130
|
// Otherwise the types do not overlap.
|