graphql 15.1.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +10 -12
- package/error/GraphQLError.js +5 -5
- package/error/GraphQLError.js.flow +5 -5
- package/error/GraphQLError.mjs +1 -1
- package/error/formatError.js +1 -1
- package/error/formatError.js.flow +2 -3
- package/error/index.js +4 -4
- package/error/index.js.flow +0 -1
- package/error/locatedError.d.ts +2 -2
- package/error/locatedError.js +10 -5
- package/error/locatedError.js.flow +11 -5
- package/error/locatedError.mjs +6 -4
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.js.flow +1 -2
- package/execution/execute.d.ts +24 -16
- package/execution/execute.js +123 -105
- package/execution/execute.js.flow +169 -153
- package/execution/execute.mjs +101 -82
- package/execution/index.d.ts +2 -0
- package/execution/index.js +9 -3
- package/execution/index.js.flow +12 -3
- package/execution/index.mjs +1 -1
- package/execution/values.js +11 -11
- package/execution/values.js.flow +10 -14
- package/graphql.js +5 -5
- package/graphql.js.flow +9 -9
- package/index.d.ts +19 -1
- package/index.js +27 -9
- package/index.js.flow +10 -3
- package/index.mjs +4 -3
- package/jsutils/ObjMap.js.flow +0 -1
- package/jsutils/Path.d.ts +6 -1
- package/jsutils/Path.js +3 -2
- package/jsutils/Path.js.flow +3 -2
- package/jsutils/Path.mjs +3 -2
- package/jsutils/PromiseOrValue.js.flow +0 -1
- package/jsutils/defineInspect.js +2 -2
- package/jsutils/defineInspect.js.flow +0 -1
- package/jsutils/devAssert.js.flow +0 -1
- package/jsutils/didYouMean.js.flow +0 -1
- package/jsutils/identityFunc.js.flow +0 -1
- package/jsutils/inspect.js +1 -2
- package/jsutils/inspect.js.flow +10 -8
- package/jsutils/inspect.mjs +1 -1
- package/jsutils/instanceOf.js.flow +2 -3
- package/jsutils/invariant.js.flow +0 -1
- package/jsutils/isAsyncIterable.js +19 -0
- package/jsutils/isAsyncIterable.js.flow +18 -0
- package/jsutils/isAsyncIterable.mjs +16 -0
- package/jsutils/isCollection.js +1 -1
- package/jsutils/isCollection.js.flow +0 -1
- package/jsutils/isObjectLike.js.flow +0 -1
- package/jsutils/isPromise.js.flow +0 -1
- package/jsutils/keyMap.js.flow +1 -2
- package/jsutils/keyValMap.js.flow +1 -2
- package/jsutils/mapValue.js +1 -1
- package/jsutils/mapValue.js.flow +1 -2
- package/jsutils/memoize3.js +2 -5
- package/jsutils/memoize3.js.flow +2 -5
- package/jsutils/memoize3.mjs +2 -5
- package/jsutils/nodejsCustomInspectSymbol.js.flow +0 -1
- package/jsutils/printPathArray.js.flow +0 -1
- package/jsutils/promiseForObject.js.flow +1 -2
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.js.flow +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/suggestionList.js.flow +1 -2
- package/jsutils/toObjMap.js +1 -1
- package/jsutils/toObjMap.js.flow +5 -6
- package/language/ast.js +1 -1
- package/language/ast.js.flow +2 -3
- package/language/blockString.d.ts +1 -1
- package/language/blockString.js +53 -32
- package/language/blockString.js.flow +49 -34
- package/language/blockString.mjs +54 -33
- package/language/directiveLocation.js.flow +0 -1
- package/language/experimentalOnlineParser/grammar.d.ts +1006 -0
- package/language/experimentalOnlineParser/grammar.js +987 -0
- package/language/experimentalOnlineParser/grammar.js.flow +1000 -0
- package/language/experimentalOnlineParser/grammar.mjs +980 -0
- package/language/experimentalOnlineParser/index.d.ts +6 -0
- package/language/experimentalOnlineParser/index.js +31 -0
- package/language/experimentalOnlineParser/index.js.flow +7 -0
- package/language/experimentalOnlineParser/index.mjs +1 -0
- package/language/experimentalOnlineParser/onlineParser.d.ts +125 -0
- package/language/experimentalOnlineParser/onlineParser.js +604 -0
- package/language/experimentalOnlineParser/onlineParser.js.flow +723 -0
- package/language/experimentalOnlineParser/onlineParser.mjs +587 -0
- package/language/index.js +12 -12
- package/language/index.js.flow +0 -1
- package/language/kinds.js.flow +0 -1
- package/language/lexer.js +242 -183
- package/language/lexer.js.flow +191 -186
- package/language/lexer.mjs +239 -180
- package/language/location.js.flow +1 -2
- package/language/parser.js +73 -68
- package/language/parser.js.flow +112 -106
- package/language/parser.mjs +66 -62
- package/language/predicates.js +1 -1
- package/language/predicates.js.flow +1 -2
- package/language/printLocation.js +1 -1
- package/language/printLocation.js.flow +4 -4
- package/language/printer.js +20 -13
- package/language/printer.js.flow +27 -25
- package/language/printer.mjs +18 -11
- package/language/source.d.ts +12 -6
- package/language/source.js +25 -9
- package/language/source.js.flow +25 -8
- package/language/source.mjs +19 -7
- package/language/tokenKind.js.flow +0 -1
- package/language/visitor.d.ts +3 -3
- package/language/visitor.js +5 -5
- package/language/visitor.js.flow +5 -5
- package/language/visitor.mjs +3 -3
- package/package.json +1 -1
- package/polyfills/arrayFrom.js +2 -2
- package/polyfills/arrayFrom.js.flow +1 -2
- package/polyfills/arrayFrom.mjs +1 -1
- package/polyfills/find.js +1 -1
- package/polyfills/find.js.flow +1 -2
- package/polyfills/find.mjs +1 -1
- package/polyfills/isFinite.js +1 -1
- package/polyfills/isFinite.js.flow +1 -2
- package/polyfills/isFinite.mjs +1 -1
- package/polyfills/isInteger.js +1 -1
- package/polyfills/isInteger.js.flow +1 -2
- package/polyfills/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +1 -1
- package/polyfills/objectEntries.js.flow +2 -3
- package/polyfills/objectEntries.mjs +1 -1
- package/polyfills/objectValues.js +1 -1
- package/polyfills/objectValues.js.flow +2 -3
- package/polyfills/objectValues.mjs +1 -1
- package/polyfills/symbols.js +3 -5
- package/polyfills/symbols.js.flow +9 -6
- package/polyfills/symbols.mjs +3 -5
- package/subscription/index.js +1 -1
- package/subscription/index.js.flow +0 -1
- package/subscription/mapAsyncIterator.js +2 -2
- package/subscription/mapAsyncIterator.js.flow +9 -10
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +61 -73
- package/subscription/subscribe.js.flow +74 -88
- package/subscription/subscribe.mjs +53 -65
- package/type/definition.d.ts +181 -31
- package/type/definition.js +37 -32
- package/type/definition.js.flow +66 -51
- package/type/definition.mjs +20 -18
- package/type/directives.d.ts +17 -3
- package/type/directives.js +17 -16
- package/type/directives.js.flow +20 -21
- package/type/directives.mjs +6 -5
- package/type/index.d.ts +12 -0
- package/type/index.js +6 -6
- package/type/index.js.flow +0 -1
- package/type/introspection.js +86 -68
- package/type/introspection.js.flow +85 -54
- package/type/introspection.mjs +79 -61
- package/type/scalars.js +9 -9
- package/type/scalars.js.flow +3 -3
- package/type/scalars.mjs +1 -1
- package/type/schema.d.ts +17 -4
- package/type/schema.js +13 -13
- package/type/schema.js.flow +18 -16
- package/type/schema.mjs +1 -1
- package/type/validate.js +52 -19
- package/type/validate.js.flow +67 -18
- package/type/validate.mjs +44 -10
- package/utilities/TypeInfo.js +7 -7
- package/utilities/TypeInfo.js.flow +16 -18
- package/utilities/TypeInfo.mjs +1 -1
- package/utilities/assertValidName.js +2 -2
- package/utilities/assertValidName.js.flow +0 -1
- package/utilities/astFromValue.js +10 -10
- package/utilities/astFromValue.js.flow +2 -3
- package/utilities/buildASTSchema.js +17 -27
- package/utilities/buildASTSchema.js.flow +11 -28
- package/utilities/buildASTSchema.mjs +11 -21
- package/utilities/buildClientSchema.js +14 -14
- package/utilities/buildClientSchema.js.flow +41 -29
- package/utilities/buildClientSchema.mjs +5 -5
- package/utilities/coerceInputValue.js +14 -14
- package/utilities/coerceInputValue.js.flow +7 -6
- package/utilities/coerceInputValue.mjs +2 -2
- package/utilities/concatAST.js +9 -8
- package/utilities/concatAST.js.flow +9 -9
- package/utilities/concatAST.mjs +9 -6
- package/utilities/extendSchema.js +26 -19
- package/utilities/extendSchema.js.flow +58 -45
- package/utilities/extendSchema.mjs +9 -2
- package/utilities/findBreakingChanges.js +9 -9
- package/utilities/findBreakingChanges.js.flow +12 -11
- package/utilities/findDeprecatedUsages.d.ts +9 -1
- package/utilities/findDeprecatedUsages.js +11 -27
- package/utilities/findDeprecatedUsages.js.flow +15 -44
- package/utilities/findDeprecatedUsages.mjs +11 -25
- package/utilities/getIntrospectionQuery.js.flow +2 -3
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.js.flow +1 -5
- package/utilities/getOperationAST.mjs +1 -1
- package/utilities/getOperationRootType.js +1 -1
- package/utilities/getOperationRootType.js.flow +5 -6
- package/utilities/index.d.ts +4 -1
- package/utilities/index.js +22 -22
- package/utilities/index.js.flow +1 -2
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +6 -8
- package/utilities/introspectionFromSchema.js.flow +10 -10
- package/utilities/introspectionFromSchema.mjs +3 -4
- package/utilities/lexicographicSortSchema.js +10 -8
- package/utilities/lexicographicSortSchema.js.flow +19 -12
- package/utilities/lexicographicSortSchema.mjs +3 -1
- package/utilities/printSchema.js +15 -16
- package/utilities/printSchema.js.flow +34 -25
- package/utilities/printSchema.mjs +6 -7
- package/utilities/separateOperations.js +2 -2
- package/utilities/separateOperations.js.flow +2 -6
- package/utilities/separateOperations.mjs +1 -1
- package/utilities/stripIgnoredCharacters.js +6 -16
- package/utilities/stripIgnoredCharacters.js.flow +4 -13
- package/utilities/stripIgnoredCharacters.mjs +3 -10
- package/utilities/typeComparators.js +1 -1
- package/utilities/typeComparators.js.flow +2 -4
- package/utilities/typeFromAST.js +6 -6
- package/utilities/typeFromAST.js.flow +11 -14
- package/utilities/typeFromAST.mjs +2 -2
- package/utilities/typedQueryDocumentNode.d.ts +20 -0
- package/utilities/valueFromAST.js +6 -6
- package/utilities/valueFromAST.js.flow +7 -5
- package/utilities/valueFromASTUntyped.js +4 -4
- package/utilities/valueFromASTUntyped.js.flow +2 -3
- package/validation/ValidationContext.d.ts +3 -0
- package/validation/ValidationContext.js +7 -3
- package/validation/ValidationContext.js.flow +28 -22
- package/validation/ValidationContext.mjs +4 -0
- package/validation/index.d.ts +4 -0
- package/validation/index.js +52 -36
- package/validation/index.js.flow +4 -1
- package/validation/index.mjs +4 -1
- package/validation/rules/ExecutableDefinitions.js +1 -1
- package/validation/rules/ExecutableDefinitions.js.flow +0 -1
- package/validation/rules/ExecutableDefinitionsRule.js +3 -3
- package/validation/rules/ExecutableDefinitionsRule.js.flow +2 -3
- package/validation/rules/FieldsOnCorrectTypeRule.js +5 -5
- package/validation/rules/FieldsOnCorrectTypeRule.js.flow +9 -8
- package/validation/rules/FragmentsOnCompositeTypesRule.js +4 -4
- package/validation/rules/FragmentsOnCompositeTypesRule.js.flow +2 -3
- package/validation/rules/KnownArgumentNamesRule.js +5 -5
- package/validation/rules/KnownArgumentNamesRule.js.flow +5 -5
- package/validation/rules/KnownDirectivesRule.js +6 -6
- package/validation/rules/KnownDirectivesRule.js.flow +10 -11
- package/validation/rules/KnownFragmentNamesRule.js +1 -1
- package/validation/rules/KnownFragmentNamesRule.js.flow +3 -3
- package/validation/rules/KnownTypeNamesRule.js +12 -10
- package/validation/rules/KnownTypeNamesRule.js.flow +14 -11
- package/validation/rules/KnownTypeNamesRule.mjs +6 -5
- package/validation/rules/LoneAnonymousOperationRule.js +2 -2
- package/validation/rules/LoneAnonymousOperationRule.js.flow +2 -3
- package/validation/rules/LoneSchemaDefinition.js +1 -1
- package/validation/rules/LoneSchemaDefinition.js.flow +0 -1
- package/validation/rules/LoneSchemaDefinitionRule.js +1 -1
- package/validation/rules/LoneSchemaDefinitionRule.js.flow +2 -3
- package/validation/rules/NoFragmentCyclesRule.js +1 -1
- package/validation/rules/NoFragmentCyclesRule.js.flow +4 -5
- package/validation/rules/NoUndefinedVariablesRule.js +1 -1
- package/validation/rules/NoUndefinedVariablesRule.js.flow +3 -3
- package/validation/rules/NoUnusedFragmentsRule.js +1 -1
- package/validation/rules/NoUnusedFragmentsRule.js.flow +3 -3
- package/validation/rules/NoUnusedVariablesRule.js +1 -1
- package/validation/rules/NoUnusedVariablesRule.js.flow +3 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +20 -20
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +29 -27
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +12 -12
- package/validation/rules/PossibleFragmentSpreadsRule.js +5 -5
- package/validation/rules/PossibleFragmentSpreadsRule.js.flow +7 -4
- package/validation/rules/PossibleTypeExtensions.js +1 -1
- package/validation/rules/PossibleTypeExtensions.js.flow +0 -1
- package/validation/rules/PossibleTypeExtensionsRule.js +8 -8
- package/validation/rules/PossibleTypeExtensionsRule.js.flow +8 -6
- package/validation/rules/ProvidedRequiredArgumentsRule.js +7 -7
- package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +7 -6
- package/validation/rules/ScalarLeafsRule.js +3 -3
- package/validation/rules/ScalarLeafsRule.js.flow +3 -4
- package/validation/rules/SingleFieldSubscriptionsRule.js +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.js.flow +3 -4
- package/validation/rules/UniqueArgumentNamesRule.js +1 -1
- package/validation/rules/UniqueArgumentNamesRule.js.flow +2 -3
- package/validation/rules/UniqueDirectiveNames.js +1 -1
- package/validation/rules/UniqueDirectiveNames.js.flow +0 -1
- package/validation/rules/UniqueDirectiveNamesRule.js +1 -1
- package/validation/rules/UniqueDirectiveNamesRule.js.flow +2 -3
- package/validation/rules/UniqueDirectivesPerLocationRule.js +4 -4
- package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +4 -5
- package/validation/rules/UniqueEnumValueNames.js +1 -1
- package/validation/rules/UniqueEnumValueNames.js.flow +0 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +2 -2
- package/validation/rules/UniqueEnumValueNamesRule.js.flow +11 -4
- package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +0 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -3
- package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +17 -6
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js +1 -1
- package/validation/rules/UniqueFragmentNamesRule.js.flow +3 -3
- package/validation/rules/UniqueInputFieldNamesRule.js +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.js.flow +3 -3
- package/validation/rules/UniqueOperationNamesRule.js +1 -1
- package/validation/rules/UniqueOperationNamesRule.js.flow +3 -3
- package/validation/rules/UniqueOperationTypes.js +1 -1
- package/validation/rules/UniqueOperationTypes.js.flow +0 -1
- package/validation/rules/UniqueOperationTypesRule.js +1 -1
- package/validation/rules/UniqueOperationTypesRule.js.flow +10 -4
- package/validation/rules/UniqueTypeNames.js +1 -1
- package/validation/rules/UniqueTypeNames.js.flow +0 -1
- package/validation/rules/UniqueTypeNamesRule.js +1 -1
- package/validation/rules/UniqueTypeNamesRule.js.flow +3 -4
- package/validation/rules/UniqueVariableNamesRule.js +1 -1
- package/validation/rules/UniqueVariableNamesRule.js.flow +3 -4
- package/validation/rules/ValuesOfCorrectTypeRule.js +8 -8
- package/validation/rules/ValuesOfCorrectTypeRule.js.flow +3 -4
- package/validation/rules/VariablesAreInputTypesRule.js +4 -4
- package/validation/rules/VariablesAreInputTypesRule.js.flow +3 -4
- package/validation/rules/VariablesInAllowedPositionRule.js +6 -6
- package/validation/rules/VariablesInAllowedPositionRule.js.flow +6 -6
- package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +14 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.js +79 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.js.flow +94 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs +68 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +16 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +34 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +38 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +25 -0
- package/validation/specifiedRules.js +33 -33
- package/validation/specifiedRules.js.flow +0 -1
- package/validation/validate.js +7 -7
- package/validation/validate.js.flow +4 -9
- package/version.js +2 -2
- package/version.js.flow +2 -3
- package/version.mjs +2 -2
- package/polyfills/flatMap.js +0 -30
- package/polyfills/flatMap.js.flow +0 -28
- package/polyfills/flatMap.mjs +0 -23
package/type/definition.js.flow
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
// @flow strict
|
|
2
|
-
|
|
3
|
-
// FIXME
|
|
4
|
-
/* eslint-disable import/no-cycle */
|
|
5
|
-
|
|
6
2
|
import objectEntries from '../polyfills/objectEntries';
|
|
7
3
|
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols';
|
|
8
4
|
|
|
5
|
+
import type { Path } from '../jsutils/Path';
|
|
6
|
+
import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
|
|
7
|
+
import type {
|
|
8
|
+
ObjMap,
|
|
9
|
+
ReadOnlyObjMap,
|
|
10
|
+
ReadOnlyObjMapLike,
|
|
11
|
+
} from '../jsutils/ObjMap';
|
|
9
12
|
import inspect from '../jsutils/inspect';
|
|
10
13
|
import keyMap from '../jsutils/keyMap';
|
|
11
14
|
import mapValue from '../jsutils/mapValue';
|
|
12
15
|
import toObjMap from '../jsutils/toObjMap';
|
|
13
|
-
import { type Path } from '../jsutils/Path';
|
|
14
16
|
import devAssert from '../jsutils/devAssert';
|
|
15
17
|
import keyValMap from '../jsutils/keyValMap';
|
|
16
18
|
import instanceOf from '../jsutils/instanceOf';
|
|
@@ -19,42 +21,36 @@ import isObjectLike from '../jsutils/isObjectLike';
|
|
|
19
21
|
import identityFunc from '../jsutils/identityFunc';
|
|
20
22
|
import defineInspect from '../jsutils/defineInspect';
|
|
21
23
|
import suggestionList from '../jsutils/suggestionList';
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
type ObjMap,
|
|
25
|
-
type ReadOnlyObjMap,
|
|
26
|
-
type ReadOnlyObjMapLike,
|
|
27
|
-
} from '../jsutils/ObjMap';
|
|
24
|
+
|
|
25
|
+
import { GraphQLError } from '../error/GraphQLError';
|
|
28
26
|
|
|
29
27
|
import { Kind } from '../language/kinds';
|
|
30
28
|
import { print } from '../language/printer';
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
import type {
|
|
30
|
+
ScalarTypeDefinitionNode,
|
|
31
|
+
ObjectTypeDefinitionNode,
|
|
32
|
+
FieldDefinitionNode,
|
|
33
|
+
InputValueDefinitionNode,
|
|
34
|
+
InterfaceTypeDefinitionNode,
|
|
35
|
+
UnionTypeDefinitionNode,
|
|
36
|
+
EnumTypeDefinitionNode,
|
|
37
|
+
EnumValueDefinitionNode,
|
|
38
|
+
InputObjectTypeDefinitionNode,
|
|
39
|
+
ScalarTypeExtensionNode,
|
|
40
|
+
ObjectTypeExtensionNode,
|
|
41
|
+
InterfaceTypeExtensionNode,
|
|
42
|
+
UnionTypeExtensionNode,
|
|
43
|
+
EnumTypeExtensionNode,
|
|
44
|
+
InputObjectTypeExtensionNode,
|
|
45
|
+
OperationDefinitionNode,
|
|
46
|
+
FieldNode,
|
|
47
|
+
FragmentDefinitionNode,
|
|
48
|
+
ValueNode,
|
|
51
49
|
} from '../language/ast';
|
|
52
50
|
|
|
53
|
-
import { GraphQLError } from '../error/GraphQLError';
|
|
54
|
-
|
|
55
51
|
import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped';
|
|
56
52
|
|
|
57
|
-
import {
|
|
53
|
+
import type { GraphQLSchema } from './schema';
|
|
58
54
|
|
|
59
55
|
// Predicates & Assertions
|
|
60
56
|
|
|
@@ -344,8 +340,8 @@ export function assertAbstractType(type: mixed): GraphQLAbstractType {
|
|
|
344
340
|
* const PersonType = new GraphQLObjectType({
|
|
345
341
|
* name: 'Person',
|
|
346
342
|
* fields: () => ({
|
|
347
|
-
* parents: { type: GraphQLList(PersonType) },
|
|
348
|
-
* children: { type: GraphQLList(PersonType) },
|
|
343
|
+
* parents: { type: new GraphQLList(PersonType) },
|
|
344
|
+
* children: { type: new GraphQLList(PersonType) },
|
|
349
345
|
* })
|
|
350
346
|
* })
|
|
351
347
|
*
|
|
@@ -361,6 +357,7 @@ declare class GraphQLList<+T: GraphQLType> {
|
|
|
361
357
|
*/
|
|
362
358
|
|
|
363
359
|
export function GraphQLList(ofType) {
|
|
360
|
+
// istanbul ignore else (to be removed in v16.0.0)
|
|
364
361
|
if (this instanceof GraphQLList) {
|
|
365
362
|
this.ofType = assertType(ofType);
|
|
366
363
|
} else {
|
|
@@ -400,7 +397,7 @@ defineInspect(GraphQLList);
|
|
|
400
397
|
* const RowType = new GraphQLObjectType({
|
|
401
398
|
* name: 'Row',
|
|
402
399
|
* fields: () => ({
|
|
403
|
-
* id: { type: GraphQLNonNull(GraphQLString) },
|
|
400
|
+
* id: { type: new GraphQLNonNull(GraphQLString) },
|
|
404
401
|
* })
|
|
405
402
|
* })
|
|
406
403
|
*
|
|
@@ -417,6 +414,7 @@ declare class GraphQLNonNull<+T: GraphQLNullableType> {
|
|
|
417
414
|
*/
|
|
418
415
|
|
|
419
416
|
export function GraphQLNonNull(ofType) {
|
|
417
|
+
// istanbul ignore else (to be removed in v16.0.0)
|
|
420
418
|
if (this instanceof GraphQLNonNull) {
|
|
421
419
|
this.ofType = assertNullableType(ofType);
|
|
422
420
|
} else {
|
|
@@ -543,7 +541,7 @@ export function getNamedType(type) {
|
|
|
543
541
|
export type Thunk<+T> = (() => T) | T;
|
|
544
542
|
|
|
545
543
|
function resolveThunk<+T>(thunk: Thunk<T>): T {
|
|
546
|
-
// $FlowFixMe
|
|
544
|
+
// $FlowFixMe[incompatible-use]
|
|
547
545
|
return typeof thunk === 'function' ? thunk() : thunk;
|
|
548
546
|
}
|
|
549
547
|
|
|
@@ -594,7 +592,8 @@ export class GraphQLScalarType {
|
|
|
594
592
|
this.serialize = config.serialize ?? identityFunc;
|
|
595
593
|
this.parseValue = parseValue;
|
|
596
594
|
this.parseLiteral =
|
|
597
|
-
config.parseLiteral ??
|
|
595
|
+
config.parseLiteral ??
|
|
596
|
+
((node, variables) => parseValue(valueFromASTUntyped(node, variables)));
|
|
598
597
|
this.extensions = config.extensions && toObjMap(config.extensions);
|
|
599
598
|
this.astNode = config.astNode;
|
|
600
599
|
this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
|
|
@@ -651,7 +650,7 @@ export class GraphQLScalarType {
|
|
|
651
650
|
return this.toString();
|
|
652
651
|
}
|
|
653
652
|
|
|
654
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
653
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
655
654
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
656
655
|
return 'GraphQLScalarType';
|
|
657
656
|
}
|
|
@@ -795,7 +794,7 @@ export class GraphQLObjectType {
|
|
|
795
794
|
return this.toString();
|
|
796
795
|
}
|
|
797
796
|
|
|
798
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
797
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
799
798
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
800
799
|
return 'GraphQLObjectType';
|
|
801
800
|
}
|
|
@@ -856,6 +855,7 @@ function defineFieldMap<TSource, TContext>(
|
|
|
856
855
|
description: argConfig.description,
|
|
857
856
|
type: argConfig.type,
|
|
858
857
|
defaultValue: argConfig.defaultValue,
|
|
858
|
+
deprecationReason: argConfig.deprecationReason,
|
|
859
859
|
extensions: argConfig.extensions && toObjMap(argConfig.extensions),
|
|
860
860
|
astNode: argConfig.astNode,
|
|
861
861
|
}));
|
|
@@ -875,11 +875,13 @@ function defineFieldMap<TSource, TContext>(
|
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
-
function isPlainObj(obj) {
|
|
878
|
+
function isPlainObj(obj: mixed): boolean {
|
|
879
879
|
return isObjectLike(obj) && !Array.isArray(obj);
|
|
880
880
|
}
|
|
881
881
|
|
|
882
|
-
function fieldsToFieldsConfig(
|
|
882
|
+
function fieldsToFieldsConfig(
|
|
883
|
+
fields: GraphQLFieldMap<mixed, mixed>,
|
|
884
|
+
): GraphQLFieldConfigMap<mixed, mixed> {
|
|
883
885
|
return mapValue(fields, (field) => ({
|
|
884
886
|
description: field.description,
|
|
885
887
|
type: field.type,
|
|
@@ -905,6 +907,7 @@ export function argsToArgsConfig(
|
|
|
905
907
|
description: arg.description,
|
|
906
908
|
type: arg.type,
|
|
907
909
|
defaultValue: arg.defaultValue,
|
|
910
|
+
deprecationReason: arg.deprecationReason,
|
|
908
911
|
extensions: arg.extensions,
|
|
909
912
|
astNode: arg.astNode,
|
|
910
913
|
}),
|
|
@@ -922,6 +925,9 @@ export type GraphQLObjectTypeConfig<TSource, TContext> = {|
|
|
|
922
925
|
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
|
|
923
926
|
|};
|
|
924
927
|
|
|
928
|
+
/**
|
|
929
|
+
* Note: returning GraphQLObjectType is deprecated and will be removed in v16.0.0
|
|
930
|
+
*/
|
|
925
931
|
export type GraphQLTypeResolver<TSource, TContext> = (
|
|
926
932
|
value: TSource,
|
|
927
933
|
context: TContext,
|
|
@@ -981,6 +987,7 @@ export type GraphQLArgumentConfig = {|
|
|
|
981
987
|
type: GraphQLInputType,
|
|
982
988
|
defaultValue?: mixed,
|
|
983
989
|
extensions?: ?ReadOnlyObjMapLike<mixed>,
|
|
990
|
+
deprecationReason?: ?string,
|
|
984
991
|
astNode?: ?InputValueDefinitionNode,
|
|
985
992
|
|};
|
|
986
993
|
|
|
@@ -999,10 +1006,12 @@ export type GraphQLField<
|
|
|
999
1006
|
args: Array<GraphQLArgument>,
|
|
1000
1007
|
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>,
|
|
1001
1008
|
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>,
|
|
1002
|
-
isDeprecated: boolean,
|
|
1003
1009
|
deprecationReason: ?string,
|
|
1004
1010
|
extensions: ?ReadOnlyObjMap<mixed>,
|
|
1005
1011
|
astNode: ?FieldDefinitionNode,
|
|
1012
|
+
|
|
1013
|
+
// @deprecated and will be removed in v16
|
|
1014
|
+
isDeprecated: boolean,
|
|
1006
1015
|
|};
|
|
1007
1016
|
|
|
1008
1017
|
export type GraphQLArgument = {|
|
|
@@ -1010,6 +1019,7 @@ export type GraphQLArgument = {|
|
|
|
1010
1019
|
description: ?string,
|
|
1011
1020
|
type: GraphQLInputType,
|
|
1012
1021
|
defaultValue: mixed,
|
|
1022
|
+
deprecationReason: ?string,
|
|
1013
1023
|
extensions: ?ReadOnlyObjMap<mixed>,
|
|
1014
1024
|
astNode: ?InputValueDefinitionNode,
|
|
1015
1025
|
|};
|
|
@@ -1110,7 +1120,7 @@ export class GraphQLInterfaceType {
|
|
|
1110
1120
|
return this.toString();
|
|
1111
1121
|
}
|
|
1112
1122
|
|
|
1113
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
1123
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
1114
1124
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
1115
1125
|
return 'GraphQLInterfaceType';
|
|
1116
1126
|
}
|
|
@@ -1217,7 +1227,7 @@ export class GraphQLUnionType {
|
|
|
1217
1227
|
return this.toString();
|
|
1218
1228
|
}
|
|
1219
1229
|
|
|
1220
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
1230
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
1221
1231
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
1222
1232
|
return 'GraphQLUnionType';
|
|
1223
1233
|
}
|
|
@@ -1395,7 +1405,7 @@ export class GraphQLEnumType /* <T> */ {
|
|
|
1395
1405
|
return this.toString();
|
|
1396
1406
|
}
|
|
1397
1407
|
|
|
1398
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
1408
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
1399
1409
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
1400
1410
|
return 'GraphQLEnumType';
|
|
1401
1411
|
}
|
|
@@ -1467,10 +1477,12 @@ export type GraphQLEnumValue /* <T> */ = {|
|
|
|
1467
1477
|
name: string,
|
|
1468
1478
|
description: ?string,
|
|
1469
1479
|
value: any /* T */,
|
|
1470
|
-
isDeprecated: boolean,
|
|
1471
1480
|
deprecationReason: ?string,
|
|
1472
1481
|
extensions: ?ReadOnlyObjMap<mixed>,
|
|
1473
1482
|
astNode: ?EnumValueDefinitionNode,
|
|
1483
|
+
|
|
1484
|
+
// @deprecated and will be removed in v16
|
|
1485
|
+
isDeprecated: boolean,
|
|
1474
1486
|
|};
|
|
1475
1487
|
|
|
1476
1488
|
/**
|
|
@@ -1486,8 +1498,8 @@ export type GraphQLEnumValue /* <T> */ = {|
|
|
|
1486
1498
|
* const GeoPoint = new GraphQLInputObjectType({
|
|
1487
1499
|
* name: 'GeoPoint',
|
|
1488
1500
|
* fields: {
|
|
1489
|
-
* lat: { type: GraphQLNonNull(GraphQLFloat) },
|
|
1490
|
-
* lon: { type: GraphQLNonNull(GraphQLFloat) },
|
|
1501
|
+
* lat: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
1502
|
+
* lon: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
1491
1503
|
* alt: { type: GraphQLFloat, defaultValue: 0 },
|
|
1492
1504
|
* }
|
|
1493
1505
|
* });
|
|
@@ -1552,7 +1564,7 @@ export class GraphQLInputObjectType {
|
|
|
1552
1564
|
return this.toString();
|
|
1553
1565
|
}
|
|
1554
1566
|
|
|
1555
|
-
// $FlowFixMe Flow doesn't support computed properties yet
|
|
1567
|
+
// $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
1556
1568
|
get [SYMBOL_TO_STRING_TAG]() {
|
|
1557
1569
|
return 'GraphQLInputObjectType';
|
|
1558
1570
|
}
|
|
@@ -1580,6 +1592,7 @@ function defineInputFieldMap(
|
|
|
1580
1592
|
description: fieldConfig.description,
|
|
1581
1593
|
type: fieldConfig.type,
|
|
1582
1594
|
defaultValue: fieldConfig.defaultValue,
|
|
1595
|
+
deprecationReason: fieldConfig.deprecationReason,
|
|
1583
1596
|
extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
|
|
1584
1597
|
astNode: fieldConfig.astNode,
|
|
1585
1598
|
};
|
|
@@ -1599,6 +1612,7 @@ export type GraphQLInputFieldConfig = {|
|
|
|
1599
1612
|
description?: ?string,
|
|
1600
1613
|
type: GraphQLInputType,
|
|
1601
1614
|
defaultValue?: mixed,
|
|
1615
|
+
deprecationReason?: ?string,
|
|
1602
1616
|
extensions?: ?ReadOnlyObjMapLike<mixed>,
|
|
1603
1617
|
astNode?: ?InputValueDefinitionNode,
|
|
1604
1618
|
|};
|
|
@@ -1610,6 +1624,7 @@ export type GraphQLInputField = {|
|
|
|
1610
1624
|
description: ?string,
|
|
1611
1625
|
type: GraphQLInputType,
|
|
1612
1626
|
defaultValue: mixed,
|
|
1627
|
+
deprecationReason: ?string,
|
|
1613
1628
|
extensions: ?ReadOnlyObjMap<mixed>,
|
|
1614
1629
|
astNode: ?InputValueDefinitionNode,
|
|
1615
1630
|
|};
|
package/type/definition.mjs
CHANGED
|
@@ -2,9 +2,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
2
2
|
|
|
3
3
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4
4
|
|
|
5
|
-
// FIXME
|
|
6
|
-
|
|
7
|
-
/* eslint-disable import/no-cycle */
|
|
8
5
|
import objectEntries from "../polyfills/objectEntries.mjs";
|
|
9
6
|
import { SYMBOL_TO_STRING_TAG } from "../polyfills/symbols.mjs";
|
|
10
7
|
import inspect from "../jsutils/inspect.mjs";
|
|
@@ -19,9 +16,9 @@ import isObjectLike from "../jsutils/isObjectLike.mjs";
|
|
|
19
16
|
import identityFunc from "../jsutils/identityFunc.mjs";
|
|
20
17
|
import defineInspect from "../jsutils/defineInspect.mjs";
|
|
21
18
|
import suggestionList from "../jsutils/suggestionList.mjs";
|
|
19
|
+
import { GraphQLError } from "../error/GraphQLError.mjs";
|
|
22
20
|
import { Kind } from "../language/kinds.mjs";
|
|
23
21
|
import { print } from "../language/printer.mjs";
|
|
24
|
-
import { GraphQLError } from "../error/GraphQLError.mjs";
|
|
25
22
|
import { valueFromASTUntyped } from "../utilities/valueFromASTUntyped.mjs";
|
|
26
23
|
export function isType(type) {
|
|
27
24
|
return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type);
|
|
@@ -207,8 +204,8 @@ export function assertAbstractType(type) {
|
|
|
207
204
|
* const PersonType = new GraphQLObjectType({
|
|
208
205
|
* name: 'Person',
|
|
209
206
|
* fields: () => ({
|
|
210
|
-
* parents: { type: GraphQLList(PersonType) },
|
|
211
|
-
* children: { type: GraphQLList(PersonType) },
|
|
207
|
+
* parents: { type: new GraphQLList(PersonType) },
|
|
208
|
+
* children: { type: new GraphQLList(PersonType) },
|
|
212
209
|
* })
|
|
213
210
|
* })
|
|
214
211
|
*
|
|
@@ -225,6 +222,7 @@ declare class GraphQLList<+T: GraphQLType> {
|
|
|
225
222
|
*/
|
|
226
223
|
|
|
227
224
|
export function GraphQLList(ofType) {
|
|
225
|
+
// istanbul ignore else (to be removed in v16.0.0)
|
|
228
226
|
if (this instanceof GraphQLList) {
|
|
229
227
|
this.ofType = assertType(ofType);
|
|
230
228
|
} else {
|
|
@@ -261,7 +259,7 @@ defineInspect(GraphQLList);
|
|
|
261
259
|
* const RowType = new GraphQLObjectType({
|
|
262
260
|
* name: 'Row',
|
|
263
261
|
* fields: () => ({
|
|
264
|
-
* id: { type: GraphQLNonNull(GraphQLString) },
|
|
262
|
+
* id: { type: new GraphQLNonNull(GraphQLString) },
|
|
265
263
|
* })
|
|
266
264
|
* })
|
|
267
265
|
*
|
|
@@ -279,6 +277,7 @@ declare class GraphQLNonNull<+T: GraphQLNullableType> {
|
|
|
279
277
|
*/
|
|
280
278
|
|
|
281
279
|
export function GraphQLNonNull(ofType) {
|
|
280
|
+
// istanbul ignore else (to be removed in v16.0.0)
|
|
282
281
|
if (this instanceof GraphQLNonNull) {
|
|
283
282
|
this.ofType = assertNullableType(ofType);
|
|
284
283
|
} else {
|
|
@@ -371,7 +370,7 @@ export function getNamedType(type) {
|
|
|
371
370
|
*/
|
|
372
371
|
|
|
373
372
|
function resolveThunk(thunk) {
|
|
374
|
-
// $FlowFixMe
|
|
373
|
+
// $FlowFixMe[incompatible-use]
|
|
375
374
|
return typeof thunk === 'function' ? thunk() : thunk;
|
|
376
375
|
}
|
|
377
376
|
|
|
@@ -414,8 +413,8 @@ export var GraphQLScalarType = /*#__PURE__*/function () {
|
|
|
414
413
|
this.specifiedByUrl = config.specifiedByUrl;
|
|
415
414
|
this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : identityFunc;
|
|
416
415
|
this.parseValue = parseValue;
|
|
417
|
-
this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node) {
|
|
418
|
-
return parseValue(valueFromASTUntyped(node));
|
|
416
|
+
this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node, variables) {
|
|
417
|
+
return parseValue(valueFromASTUntyped(node, variables));
|
|
419
418
|
};
|
|
420
419
|
this.extensions = config.extensions && toObjMap(config.extensions);
|
|
421
420
|
this.astNode = config.astNode;
|
|
@@ -453,7 +452,7 @@ export var GraphQLScalarType = /*#__PURE__*/function () {
|
|
|
453
452
|
|
|
454
453
|
_proto.toJSON = function toJSON() {
|
|
455
454
|
return this.toString();
|
|
456
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
455
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
457
456
|
;
|
|
458
457
|
|
|
459
458
|
_createClass(GraphQLScalarType, [{
|
|
@@ -556,7 +555,7 @@ export var GraphQLObjectType = /*#__PURE__*/function () {
|
|
|
556
555
|
|
|
557
556
|
_proto2.toJSON = function toJSON() {
|
|
558
557
|
return this.toString();
|
|
559
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
558
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
560
559
|
;
|
|
561
560
|
|
|
562
561
|
_createClass(GraphQLObjectType, [{
|
|
@@ -598,6 +597,7 @@ function defineFieldMap(config) {
|
|
|
598
597
|
description: argConfig.description,
|
|
599
598
|
type: argConfig.type,
|
|
600
599
|
defaultValue: argConfig.defaultValue,
|
|
600
|
+
deprecationReason: argConfig.deprecationReason,
|
|
601
601
|
extensions: argConfig.extensions && toObjMap(argConfig.extensions),
|
|
602
602
|
astNode: argConfig.astNode
|
|
603
603
|
};
|
|
@@ -648,6 +648,7 @@ export function argsToArgsConfig(args) {
|
|
|
648
648
|
description: arg.description,
|
|
649
649
|
type: arg.type,
|
|
650
650
|
defaultValue: arg.defaultValue,
|
|
651
|
+
deprecationReason: arg.deprecationReason,
|
|
651
652
|
extensions: arg.extensions,
|
|
652
653
|
astNode: arg.astNode
|
|
653
654
|
};
|
|
@@ -728,7 +729,7 @@ export var GraphQLInterfaceType = /*#__PURE__*/function () {
|
|
|
728
729
|
|
|
729
730
|
_proto3.toJSON = function toJSON() {
|
|
730
731
|
return this.toString();
|
|
731
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
732
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
732
733
|
;
|
|
733
734
|
|
|
734
735
|
_createClass(GraphQLInterfaceType, [{
|
|
@@ -809,7 +810,7 @@ export var GraphQLUnionType = /*#__PURE__*/function () {
|
|
|
809
810
|
|
|
810
811
|
_proto4.toJSON = function toJSON() {
|
|
811
812
|
return this.toString();
|
|
812
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
813
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
813
814
|
;
|
|
814
815
|
|
|
815
816
|
_createClass(GraphQLUnionType, [{
|
|
@@ -957,7 +958,7 @@ export var GraphQLEnumType
|
|
|
957
958
|
|
|
958
959
|
_proto5.toJSON = function toJSON() {
|
|
959
960
|
return this.toString();
|
|
960
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
961
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
961
962
|
;
|
|
962
963
|
|
|
963
964
|
_createClass(GraphQLEnumType, [{
|
|
@@ -1012,8 +1013,8 @@ function defineEnumValues(typeName, valueMap) {
|
|
|
1012
1013
|
* const GeoPoint = new GraphQLInputObjectType({
|
|
1013
1014
|
* name: 'GeoPoint',
|
|
1014
1015
|
* fields: {
|
|
1015
|
-
* lat: { type: GraphQLNonNull(GraphQLFloat) },
|
|
1016
|
-
* lon: { type: GraphQLNonNull(GraphQLFloat) },
|
|
1016
|
+
* lat: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
1017
|
+
* lon: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
1017
1018
|
* alt: { type: GraphQLFloat, defaultValue: 0 },
|
|
1018
1019
|
* }
|
|
1019
1020
|
* });
|
|
@@ -1068,7 +1069,7 @@ export var GraphQLInputObjectType = /*#__PURE__*/function () {
|
|
|
1068
1069
|
|
|
1069
1070
|
_proto6.toJSON = function toJSON() {
|
|
1070
1071
|
return this.toString();
|
|
1071
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
1072
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
1072
1073
|
;
|
|
1073
1074
|
|
|
1074
1075
|
_createClass(GraphQLInputObjectType, [{
|
|
@@ -1093,6 +1094,7 @@ function defineInputFieldMap(config) {
|
|
|
1093
1094
|
description: fieldConfig.description,
|
|
1094
1095
|
type: fieldConfig.type,
|
|
1095
1096
|
defaultValue: fieldConfig.defaultValue,
|
|
1097
|
+
deprecationReason: fieldConfig.deprecationReason,
|
|
1096
1098
|
extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
|
|
1097
1099
|
astNode: fieldConfig.astNode
|
|
1098
1100
|
};
|
package/type/directives.d.ts
CHANGED
|
@@ -13,6 +13,20 @@ import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition';
|
|
|
13
13
|
*/
|
|
14
14
|
export function isDirective(directive: any): directive is GraphQLDirective;
|
|
15
15
|
export function assertDirective(directive: any): GraphQLDirective;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Custom extensions
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Use a unique identifier name for your extension, for example the name of
|
|
22
|
+
* your library or project. Do not use a shortened identifier as this increases
|
|
23
|
+
* the risk of conflicts. We recommend you add at most one extension field,
|
|
24
|
+
* an object which can contain all the values you need.
|
|
25
|
+
*/
|
|
26
|
+
export interface GraphQLDirectiveExtensions {
|
|
27
|
+
[attributeName: string]: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
/**
|
|
17
31
|
* Directives are used by the GraphQL runtime as a way of modifying execution
|
|
18
32
|
* behavior. Type system creators will usually not create these directly.
|
|
@@ -23,7 +37,7 @@ export class GraphQLDirective {
|
|
|
23
37
|
locations: Array<DirectiveLocationEnum>;
|
|
24
38
|
isRepeatable: boolean;
|
|
25
39
|
args: Array<GraphQLArgument>;
|
|
26
|
-
extensions: Maybe<Readonly<
|
|
40
|
+
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
|
|
27
41
|
astNode: Maybe<DirectiveDefinitionNode>;
|
|
28
42
|
|
|
29
43
|
constructor(config: Readonly<GraphQLDirectiveConfig>);
|
|
@@ -31,7 +45,7 @@ export class GraphQLDirective {
|
|
|
31
45
|
toConfig(): GraphQLDirectiveConfig & {
|
|
32
46
|
args: GraphQLFieldConfigArgumentMap;
|
|
33
47
|
isRepeatable: boolean;
|
|
34
|
-
extensions: Maybe<Readonly<
|
|
48
|
+
extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
|
|
35
49
|
};
|
|
36
50
|
|
|
37
51
|
toString(): string;
|
|
@@ -45,7 +59,7 @@ export interface GraphQLDirectiveConfig {
|
|
|
45
59
|
locations: Array<DirectiveLocationEnum>;
|
|
46
60
|
args?: Maybe<GraphQLFieldConfigArgumentMap>;
|
|
47
61
|
isRepeatable?: Maybe<boolean>;
|
|
48
|
-
extensions?: Maybe<Readonly<
|
|
62
|
+
extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
|
|
49
63
|
astNode?: Maybe<DirectiveDefinitionNode>;
|
|
50
64
|
}
|
|
51
65
|
|
package/type/directives.js
CHANGED
|
@@ -8,27 +8,27 @@ exports.assertDirective = assertDirective;
|
|
|
8
8
|
exports.isSpecifiedDirective = isSpecifiedDirective;
|
|
9
9
|
exports.specifiedDirectives = exports.GraphQLSpecifiedByDirective = exports.GraphQLDeprecatedDirective = exports.DEFAULT_DEPRECATION_REASON = exports.GraphQLSkipDirective = exports.GraphQLIncludeDirective = exports.GraphQLDirective = void 0;
|
|
10
10
|
|
|
11
|
-
var _objectEntries = _interopRequireDefault(require("../polyfills/objectEntries"));
|
|
11
|
+
var _objectEntries = _interopRequireDefault(require("../polyfills/objectEntries.js"));
|
|
12
12
|
|
|
13
|
-
var _symbols = require("../polyfills/symbols");
|
|
13
|
+
var _symbols = require("../polyfills/symbols.js");
|
|
14
14
|
|
|
15
|
-
var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
|
|
15
|
+
var _inspect = _interopRequireDefault(require("../jsutils/inspect.js"));
|
|
16
16
|
|
|
17
|
-
var _toObjMap = _interopRequireDefault(require("../jsutils/toObjMap"));
|
|
17
|
+
var _toObjMap = _interopRequireDefault(require("../jsutils/toObjMap.js"));
|
|
18
18
|
|
|
19
|
-
var _devAssert = _interopRequireDefault(require("../jsutils/devAssert"));
|
|
19
|
+
var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js"));
|
|
20
20
|
|
|
21
|
-
var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf"));
|
|
21
|
+
var _instanceOf = _interopRequireDefault(require("../jsutils/instanceOf.js"));
|
|
22
22
|
|
|
23
|
-
var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike"));
|
|
23
|
+
var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js"));
|
|
24
24
|
|
|
25
|
-
var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect"));
|
|
25
|
+
var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect.js"));
|
|
26
26
|
|
|
27
|
-
var _directiveLocation = require("../language/directiveLocation");
|
|
27
|
+
var _directiveLocation = require("../language/directiveLocation.js");
|
|
28
28
|
|
|
29
|
-
var _scalars = require("./scalars");
|
|
29
|
+
var _scalars = require("./scalars.js");
|
|
30
30
|
|
|
31
|
-
var _definition = require("./definition");
|
|
31
|
+
var _definition = require("./definition.js");
|
|
32
32
|
|
|
33
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
34
|
|
|
@@ -76,6 +76,7 @@ var GraphQLDirective = /*#__PURE__*/function () {
|
|
|
76
76
|
description: argConfig.description,
|
|
77
77
|
type: argConfig.type,
|
|
78
78
|
defaultValue: argConfig.defaultValue,
|
|
79
|
+
deprecationReason: argConfig.deprecationReason,
|
|
79
80
|
extensions: argConfig.extensions && (0, _toObjMap.default)(argConfig.extensions),
|
|
80
81
|
astNode: argConfig.astNode
|
|
81
82
|
};
|
|
@@ -102,7 +103,7 @@ var GraphQLDirective = /*#__PURE__*/function () {
|
|
|
102
103
|
|
|
103
104
|
_proto.toJSON = function toJSON() {
|
|
104
105
|
return this.toString();
|
|
105
|
-
} // $FlowFixMe Flow doesn't support computed properties yet
|
|
106
|
+
} // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet
|
|
106
107
|
;
|
|
107
108
|
|
|
108
109
|
_createClass(GraphQLDirective, [{
|
|
@@ -128,7 +129,7 @@ var GraphQLIncludeDirective = new GraphQLDirective({
|
|
|
128
129
|
locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT],
|
|
129
130
|
args: {
|
|
130
131
|
if: {
|
|
131
|
-
type:
|
|
132
|
+
type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),
|
|
132
133
|
description: 'Included when true.'
|
|
133
134
|
}
|
|
134
135
|
}
|
|
@@ -144,7 +145,7 @@ var GraphQLSkipDirective = new GraphQLDirective({
|
|
|
144
145
|
locations: [_directiveLocation.DirectiveLocation.FIELD, _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT],
|
|
145
146
|
args: {
|
|
146
147
|
if: {
|
|
147
|
-
type:
|
|
148
|
+
type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),
|
|
148
149
|
description: 'Skipped when true.'
|
|
149
150
|
}
|
|
150
151
|
}
|
|
@@ -163,7 +164,7 @@ exports.DEFAULT_DEPRECATION_REASON = DEFAULT_DEPRECATION_REASON;
|
|
|
163
164
|
var GraphQLDeprecatedDirective = new GraphQLDirective({
|
|
164
165
|
name: 'deprecated',
|
|
165
166
|
description: 'Marks an element of a GraphQL schema as no longer supported.',
|
|
166
|
-
locations: [_directiveLocation.DirectiveLocation.FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ENUM_VALUE],
|
|
167
|
+
locations: [_directiveLocation.DirectiveLocation.FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, _directiveLocation.DirectiveLocation.ENUM_VALUE],
|
|
167
168
|
args: {
|
|
168
169
|
reason: {
|
|
169
170
|
type: _scalars.GraphQLString,
|
|
@@ -183,7 +184,7 @@ var GraphQLSpecifiedByDirective = new GraphQLDirective({
|
|
|
183
184
|
locations: [_directiveLocation.DirectiveLocation.SCALAR],
|
|
184
185
|
args: {
|
|
185
186
|
url: {
|
|
186
|
-
type:
|
|
187
|
+
type: new _definition.GraphQLNonNull(_scalars.GraphQLString),
|
|
187
188
|
description: 'The URL that specifies the behaviour of this scalar.'
|
|
188
189
|
}
|
|
189
190
|
}
|