graphql 16.13.2 → 16.14.1
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.d.ts +151 -15
- package/error/GraphQLError.js +143 -12
- package/error/GraphQLError.mjs +143 -12
- package/error/index.d.ts +6 -0
- package/error/index.mjs +6 -0
- package/error/locatedError.d.ts +20 -0
- package/error/locatedError.js +21 -0
- package/error/locatedError.mjs +20 -0
- package/error/syntaxError.d.ts +15 -0
- package/error/syntaxError.js +16 -0
- package/error/syntaxError.mjs +15 -0
- package/execution/collectFields.js +6 -0
- package/execution/collectFields.mjs +6 -0
- package/execution/execute.d.ts +211 -12
- package/execution/execute.js +214 -23
- package/execution/execute.mjs +213 -23
- package/execution/index.d.ts +6 -0
- package/execution/index.mjs +6 -0
- package/execution/mapAsyncIterator.d.ts +2 -0
- package/execution/mapAsyncIterator.js +2 -0
- package/execution/mapAsyncIterator.mjs +2 -0
- package/execution/subscribe.d.ts +195 -5
- package/execution/subscribe.js +154 -11
- package/execution/subscribe.mjs +153 -11
- package/execution/values.d.ts +167 -10
- package/execution/values.js +149 -5
- package/execution/values.mjs +148 -5
- package/graphql.d.ts +163 -41
- package/graphql.js +126 -4
- package/graphql.mjs +131 -41
- package/index.d.ts +12 -17
- package/index.mjs +13 -19
- package/jsutils/Maybe.d.ts +5 -1
- package/jsutils/ObjMap.d.ts +4 -0
- package/jsutils/Path.d.ts +30 -0
- package/jsutils/Path.js +29 -0
- package/jsutils/Path.mjs +29 -0
- package/jsutils/PromiseOrValue.d.ts +1 -0
- package/jsutils/devAssert.d.ts +1 -0
- package/jsutils/devAssert.js +1 -0
- package/jsutils/devAssert.mjs +1 -0
- package/jsutils/didYouMean.d.ts +4 -1
- package/jsutils/didYouMean.js +4 -1
- package/jsutils/didYouMean.mjs +4 -1
- package/jsutils/groupBy.d.ts +2 -0
- package/jsutils/groupBy.js +2 -0
- package/jsutils/groupBy.mjs +2 -0
- package/jsutils/identityFunc.d.ts +2 -0
- package/jsutils/identityFunc.js +2 -0
- package/jsutils/identityFunc.mjs +2 -0
- package/jsutils/inspect.d.ts +2 -0
- package/jsutils/inspect.js +2 -0
- package/jsutils/inspect.mjs +2 -0
- package/jsutils/instanceOf.d.ts +2 -0
- package/jsutils/instanceOf.js +2 -0
- package/jsutils/instanceOf.mjs +2 -0
- package/jsutils/invariant.d.ts +1 -0
- package/jsutils/invariant.js +1 -0
- package/jsutils/invariant.mjs +1 -0
- package/jsutils/isAsyncIterable.d.ts +2 -0
- package/jsutils/isAsyncIterable.js +2 -0
- package/jsutils/isAsyncIterable.mjs +2 -0
- package/jsutils/isIterableObject.d.ts +6 -5
- package/jsutils/isIterableObject.js +6 -5
- package/jsutils/isIterableObject.mjs +6 -5
- package/jsutils/isObjectLike.d.ts +2 -0
- package/jsutils/isObjectLike.js +2 -0
- package/jsutils/isObjectLike.mjs +2 -0
- package/jsutils/isPromise.d.ts +2 -0
- package/jsutils/isPromise.js +2 -0
- package/jsutils/isPromise.mjs +2 -0
- package/jsutils/keyMap.d.ts +7 -14
- package/jsutils/keyMap.js +7 -14
- package/jsutils/keyMap.mjs +7 -14
- package/jsutils/keyValMap.d.ts +9 -6
- package/jsutils/keyValMap.js +9 -6
- package/jsutils/keyValMap.mjs +9 -6
- package/jsutils/mapValue.d.ts +2 -0
- package/jsutils/mapValue.js +2 -0
- package/jsutils/mapValue.mjs +2 -0
- package/jsutils/memoize3.d.ts +2 -0
- package/jsutils/memoize3.js +2 -0
- package/jsutils/memoize3.mjs +2 -0
- package/jsutils/naturalCompare.d.ts +2 -0
- package/jsutils/naturalCompare.js +2 -0
- package/jsutils/naturalCompare.mjs +2 -0
- package/jsutils/printPathArray.d.ts +2 -0
- package/jsutils/printPathArray.js +2 -0
- package/jsutils/printPathArray.mjs +2 -0
- package/jsutils/promiseForObject.d.ts +2 -0
- package/jsutils/promiseForObject.js +2 -0
- package/jsutils/promiseForObject.mjs +2 -0
- package/jsutils/promiseReduce.d.ts +2 -0
- package/jsutils/promiseReduce.js +2 -0
- package/jsutils/promiseReduce.mjs +2 -0
- package/jsutils/suggestionList.d.ts +2 -0
- package/jsutils/suggestionList.js +4 -0
- package/jsutils/suggestionList.mjs +4 -0
- package/jsutils/toError.d.ts +2 -0
- package/jsutils/toError.js +2 -0
- package/jsutils/toError.mjs +2 -0
- package/jsutils/toObjMap.d.ts +1 -0
- package/jsutils/toObjMap.js +1 -0
- package/jsutils/toObjMap.mjs +1 -0
- package/language/ast.d.ts +422 -55
- package/language/ast.js +103 -39
- package/language/ast.mjs +103 -39
- package/language/blockString.d.ts +1 -3
- package/language/blockString.js +1 -3
- package/language/blockString.mjs +1 -3
- package/language/directiveLocation.d.ts +29 -8
- package/language/directiveLocation.js +10 -6
- package/language/directiveLocation.mjs +10 -6
- package/language/index.d.ts +7 -0
- package/language/index.mjs +6 -0
- package/language/kinds.d.ts +58 -18
- package/language/kinds.js +10 -6
- package/language/kinds.mjs +10 -6
- package/language/lexer.d.ts +47 -14
- package/language/lexer.js +71 -13
- package/language/lexer.mjs +70 -13
- package/language/location.d.ts +16 -3
- package/language/location.js +14 -3
- package/language/location.mjs +14 -3
- package/language/parser.d.ts +248 -11
- package/language/parser.js +257 -0
- package/language/parser.mjs +257 -3
- package/language/predicates.d.ts +169 -0
- package/language/predicates.js +173 -1
- package/language/predicates.mjs +185 -1
- package/language/printLocation.d.ts +28 -0
- package/language/printLocation.js +29 -0
- package/language/printLocation.mjs +28 -0
- package/language/printString.d.ts +2 -0
- package/language/printString.js +5 -1
- package/language/printString.mjs +5 -1
- package/language/printer.d.ts +12 -0
- package/language/printer.js +32 -1
- package/language/printer.mjs +31 -1
- package/language/schemaCoordinateLexer.d.ts +8 -6
- package/language/schemaCoordinateLexer.js +10 -6
- package/language/schemaCoordinateLexer.mjs +10 -6
- package/language/source.d.ts +28 -0
- package/language/source.js +32 -0
- package/language/source.mjs +31 -0
- package/language/tokenKind.d.ts +30 -3
- package/language/tokenKind.js +8 -3
- package/language/tokenKind.mjs +8 -3
- package/language/visitor.d.ts +200 -72
- package/language/visitor.js +122 -50
- package/language/visitor.mjs +122 -54
- package/package.json +1 -1
- package/subscription/index.d.ts +9 -3
- package/subscription/index.mjs +9 -3
- package/type/assertName.d.ts +18 -1
- package/type/assertName.js +19 -1
- package/type/assertName.mjs +18 -1
- package/type/definition.d.ts +2540 -79
- package/type/definition.js +2214 -61
- package/type/definition.mjs +2241 -60
- package/type/directives.d.ts +202 -19
- package/type/directives.js +206 -20
- package/type/directives.mjs +206 -20
- package/type/index.d.ts +6 -0
- package/type/index.mjs +6 -0
- package/type/introspection.d.ts +36 -0
- package/type/introspection.js +57 -1
- package/type/introspection.mjs +65 -1
- package/type/scalars.d.ts +29 -2
- package/type/scalars.js +37 -2
- package/type/scalars.mjs +36 -2
- package/type/schema.d.ts +490 -28
- package/type/schema.js +484 -26
- package/type/schema.mjs +484 -26
- package/type/validate.d.ts +31 -0
- package/type/validate.js +32 -0
- package/type/validate.mjs +31 -0
- package/utilities/TypeInfo.d.ts +441 -1
- package/utilities/TypeInfo.js +444 -1
- package/utilities/TypeInfo.mjs +443 -1
- package/utilities/assertValidName.d.ts +27 -2
- package/utilities/assertValidName.js +28 -2
- package/utilities/assertValidName.mjs +27 -2
- package/utilities/astFromValue.d.ts +33 -3
- package/utilities/astFromValue.js +36 -3
- package/utilities/astFromValue.mjs +35 -3
- package/utilities/buildASTSchema.d.ts +65 -6
- package/utilities/buildASTSchema.js +69 -6
- package/utilities/buildASTSchema.mjs +69 -6
- package/utilities/buildClientSchema.d.ts +15 -0
- package/utilities/buildClientSchema.js +17 -0
- package/utilities/buildClientSchema.mjs +16 -0
- package/utilities/coerceInputValue.d.ts +46 -0
- package/utilities/coerceInputValue.js +47 -0
- package/utilities/coerceInputValue.mjs +46 -0
- package/utilities/concatAST.d.ts +12 -0
- package/utilities/concatAST.js +13 -0
- package/utilities/concatAST.mjs +12 -0
- package/utilities/extendSchema.d.ts +56 -3
- package/utilities/extendSchema.js +121 -6
- package/utilities/extendSchema.mjs +120 -6
- package/utilities/findBreakingChanges.d.ts +95 -0
- package/utilities/findBreakingChanges.js +68 -0
- package/utilities/findBreakingChanges.mjs +70 -0
- package/utilities/getIntrospectionQuery.d.ts +148 -0
- package/utilities/getIntrospectionQuery.js +72 -38
- package/utilities/getIntrospectionQuery.mjs +72 -38
- package/utilities/getOperationAST.d.ts +15 -0
- package/utilities/getOperationAST.js +16 -0
- package/utilities/getOperationAST.mjs +15 -0
- package/utilities/getOperationRootType.d.ts +18 -1
- package/utilities/getOperationRootType.js +19 -1
- package/utilities/getOperationRootType.mjs +18 -1
- package/utilities/index.d.ts +7 -0
- package/utilities/index.mjs +7 -0
- package/utilities/introspectionFromSchema.d.ts +54 -0
- package/utilities/introspectionFromSchema.js +56 -0
- package/utilities/introspectionFromSchema.mjs +55 -0
- package/utilities/lexicographicSortSchema.d.ts +35 -0
- package/utilities/lexicographicSortSchema.js +36 -0
- package/utilities/lexicographicSortSchema.mjs +35 -0
- package/utilities/printSchema.d.ts +63 -0
- package/utilities/printSchema.js +67 -0
- package/utilities/printSchema.mjs +68 -0
- package/utilities/resolveSchemaCoordinate.d.ts +62 -0
- package/utilities/resolveSchemaCoordinate.js +64 -0
- package/utilities/resolveSchemaCoordinate.mjs +63 -0
- package/utilities/separateOperations.d.ts +30 -0
- package/utilities/separateOperations.js +31 -0
- package/utilities/separateOperations.mjs +30 -0
- package/utilities/stripIgnoredCharacters.d.ts +13 -6
- package/utilities/stripIgnoredCharacters.js +16 -6
- package/utilities/stripIgnoredCharacters.mjs +15 -6
- package/utilities/typeComparators.d.ts +84 -0
- package/utilities/typeComparators.js +85 -0
- package/utilities/typeComparators.mjs +84 -0
- package/utilities/typeFromAST.d.ts +86 -0
- package/utilities/typeFromAST.js +3 -0
- package/utilities/typeFromAST.mjs +3 -0
- package/utilities/typedQueryDocumentNode.d.ts +4 -0
- package/utilities/valueFromAST.d.ts +38 -0
- package/utilities/valueFromAST.js +51 -2
- package/utilities/valueFromAST.mjs +50 -2
- package/utilities/valueFromASTUntyped.d.ts +15 -2
- package/utilities/valueFromASTUntyped.js +16 -2
- package/utilities/valueFromASTUntyped.mjs +15 -2
- package/validation/ValidationContext.d.ts +399 -0
- package/validation/ValidationContext.js +400 -0
- package/validation/ValidationContext.mjs +401 -0
- package/validation/index.d.ts +6 -0
- package/validation/index.mjs +6 -0
- package/validation/rules/ExecutableDefinitionsRule.d.ts +28 -0
- package/validation/rules/ExecutableDefinitionsRule.js +29 -0
- package/validation/rules/ExecutableDefinitionsRule.mjs +28 -0
- package/validation/rules/FieldsOnCorrectTypeRule.d.ts +28 -0
- package/validation/rules/FieldsOnCorrectTypeRule.js +33 -0
- package/validation/rules/FieldsOnCorrectTypeRule.mjs +32 -0
- package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +28 -0
- package/validation/rules/FragmentsOnCompositeTypesRule.js +29 -0
- package/validation/rules/FragmentsOnCompositeTypesRule.mjs +28 -0
- package/validation/rules/KnownArgumentNamesRule.d.ts +29 -3
- package/validation/rules/KnownArgumentNamesRule.js +30 -3
- package/validation/rules/KnownArgumentNamesRule.mjs +29 -3
- package/validation/rules/KnownDirectivesRule.d.ts +28 -0
- package/validation/rules/KnownDirectivesRule.js +33 -0
- package/validation/rules/KnownDirectivesRule.mjs +32 -0
- package/validation/rules/KnownFragmentNamesRule.d.ts +28 -0
- package/validation/rules/KnownFragmentNamesRule.js +29 -0
- package/validation/rules/KnownFragmentNamesRule.mjs +28 -0
- package/validation/rules/KnownTypeNamesRule.d.ts +28 -0
- package/validation/rules/KnownTypeNamesRule.js +29 -0
- package/validation/rules/KnownTypeNamesRule.mjs +28 -0
- package/validation/rules/LoneAnonymousOperationRule.d.ts +28 -0
- package/validation/rules/LoneAnonymousOperationRule.js +29 -0
- package/validation/rules/LoneAnonymousOperationRule.mjs +28 -0
- package/validation/rules/LoneSchemaDefinitionRule.d.ts +21 -0
- package/validation/rules/LoneSchemaDefinitionRule.js +22 -0
- package/validation/rules/LoneSchemaDefinitionRule.mjs +21 -0
- package/validation/rules/MaxIntrospectionDepthRule.d.ts +31 -0
- package/validation/rules/MaxIntrospectionDepthRule.js +33 -0
- package/validation/rules/MaxIntrospectionDepthRule.mjs +34 -0
- package/validation/rules/NoFragmentCyclesRule.d.ts +28 -0
- package/validation/rules/NoFragmentCyclesRule.js +29 -0
- package/validation/rules/NoFragmentCyclesRule.mjs +28 -0
- package/validation/rules/NoUndefinedVariablesRule.d.ts +28 -0
- package/validation/rules/NoUndefinedVariablesRule.js +29 -0
- package/validation/rules/NoUndefinedVariablesRule.mjs +28 -0
- package/validation/rules/NoUnusedFragmentsRule.d.ts +28 -0
- package/validation/rules/NoUnusedFragmentsRule.js +29 -0
- package/validation/rules/NoUnusedFragmentsRule.mjs +28 -0
- package/validation/rules/NoUnusedVariablesRule.d.ts +29 -0
- package/validation/rules/NoUnusedVariablesRule.js +30 -0
- package/validation/rules/NoUnusedVariablesRule.mjs +29 -0
- package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +33 -0
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +45 -6
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +45 -6
- package/validation/rules/PossibleFragmentSpreadsRule.d.ts +36 -0
- package/validation/rules/PossibleFragmentSpreadsRule.js +37 -0
- package/validation/rules/PossibleFragmentSpreadsRule.mjs +36 -0
- package/validation/rules/PossibleTypeExtensionsRule.d.ts +21 -0
- package/validation/rules/PossibleTypeExtensionsRule.js +22 -0
- package/validation/rules/PossibleTypeExtensionsRule.mjs +21 -0
- package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +29 -3
- package/validation/rules/ProvidedRequiredArgumentsRule.js +30 -3
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +29 -3
- package/validation/rules/ScalarLeafsRule.d.ts +28 -0
- package/validation/rules/ScalarLeafsRule.js +29 -0
- package/validation/rules/ScalarLeafsRule.mjs +28 -0
- package/validation/rules/SingleFieldSubscriptionsRule.d.ts +33 -0
- package/validation/rules/SingleFieldSubscriptionsRule.js +34 -0
- package/validation/rules/SingleFieldSubscriptionsRule.mjs +33 -0
- package/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts +21 -0
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +22 -0
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +21 -0
- package/validation/rules/UniqueArgumentNamesRule.d.ts +28 -0
- package/validation/rules/UniqueArgumentNamesRule.js +29 -0
- package/validation/rules/UniqueArgumentNamesRule.mjs +28 -0
- package/validation/rules/UniqueDirectiveNamesRule.d.ts +21 -0
- package/validation/rules/UniqueDirectiveNamesRule.js +22 -0
- package/validation/rules/UniqueDirectiveNamesRule.mjs +21 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +28 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.js +41 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs +40 -0
- package/validation/rules/UniqueEnumValueNamesRule.d.ts +21 -0
- package/validation/rules/UniqueEnumValueNamesRule.js +22 -0
- package/validation/rules/UniqueEnumValueNamesRule.mjs +21 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +21 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +22 -0
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +21 -0
- package/validation/rules/UniqueFragmentNamesRule.d.ts +28 -0
- package/validation/rules/UniqueFragmentNamesRule.js +29 -0
- package/validation/rules/UniqueFragmentNamesRule.mjs +28 -0
- package/validation/rules/UniqueInputFieldNamesRule.d.ts +32 -0
- package/validation/rules/UniqueInputFieldNamesRule.js +33 -0
- package/validation/rules/UniqueInputFieldNamesRule.mjs +32 -0
- package/validation/rules/UniqueOperationNamesRule.d.ts +28 -0
- package/validation/rules/UniqueOperationNamesRule.js +29 -0
- package/validation/rules/UniqueOperationNamesRule.mjs +28 -0
- package/validation/rules/UniqueOperationTypesRule.d.ts +21 -0
- package/validation/rules/UniqueOperationTypesRule.js +22 -0
- package/validation/rules/UniqueOperationTypesRule.mjs +21 -0
- package/validation/rules/UniqueTypeNamesRule.d.ts +21 -0
- package/validation/rules/UniqueTypeNamesRule.js +22 -0
- package/validation/rules/UniqueTypeNamesRule.mjs +21 -0
- package/validation/rules/UniqueVariableNamesRule.d.ts +28 -0
- package/validation/rules/UniqueVariableNamesRule.js +29 -0
- package/validation/rules/UniqueVariableNamesRule.mjs +28 -0
- package/validation/rules/ValuesOfCorrectTypeRule.d.ts +28 -0
- package/validation/rules/ValuesOfCorrectTypeRule.js +31 -0
- package/validation/rules/ValuesOfCorrectTypeRule.mjs +30 -0
- package/validation/rules/VariablesAreInputTypesRule.d.ts +32 -0
- package/validation/rules/VariablesAreInputTypesRule.js +33 -0
- package/validation/rules/VariablesAreInputTypesRule.mjs +32 -0
- package/validation/rules/VariablesInAllowedPositionRule.d.ts +28 -0
- package/validation/rules/VariablesInAllowedPositionRule.js +35 -1
- package/validation/rules/VariablesInAllowedPositionRule.mjs +34 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +41 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.js +42 -0
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs +41 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +28 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +29 -0
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +28 -0
- package/validation/specifiedRules.d.ts +2 -3
- package/validation/specifiedRules.js +2 -3
- package/validation/specifiedRules.mjs +2 -3
- package/validation/validate.d.ts +70 -9
- package/validation/validate.js +63 -7
- package/validation/validate.mjs +63 -7
- package/version.d.ts +3 -6
- package/version.js +7 -9
- package/version.mjs +6 -9
package/language/parser.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @category Parsing */
|
|
1
2
|
import type { Maybe } from '../jsutils/Maybe';
|
|
2
3
|
import type { GraphQLError } from '../error/GraphQLError';
|
|
3
4
|
import type {
|
|
@@ -10,6 +11,7 @@ import type {
|
|
|
10
11
|
ConstValueNode,
|
|
11
12
|
DefinitionNode,
|
|
12
13
|
DirectiveDefinitionNode,
|
|
14
|
+
DirectiveExtensionNode,
|
|
13
15
|
DirectiveNode,
|
|
14
16
|
DocumentNode,
|
|
15
17
|
EnumTypeDefinitionNode,
|
|
@@ -55,9 +57,7 @@ import { Location, OperationTypeNode } from './ast';
|
|
|
55
57
|
import type { LexerInterface } from './lexer';
|
|
56
58
|
import { Source } from './source';
|
|
57
59
|
import { TokenKind } from './tokenKind';
|
|
58
|
-
/**
|
|
59
|
-
* Configuration options to control parser behavior
|
|
60
|
-
*/
|
|
60
|
+
/** Configuration options to control parser behavior */
|
|
61
61
|
export interface ParseOptions {
|
|
62
62
|
/**
|
|
63
63
|
* By default, the parser creates AST nodes that know the location
|
|
@@ -74,30 +74,80 @@ export interface ParseOptions {
|
|
|
74
74
|
*/
|
|
75
75
|
maxTokens?: number | undefined;
|
|
76
76
|
/**
|
|
77
|
+
* Deprecated option that allows legacy fragment variable definitions to be
|
|
78
|
+
* parsed. This legacy fragment variable syntax will be removed in v17. Move
|
|
79
|
+
* variable definitions to operations for spec-compliant documents; if you
|
|
80
|
+
* need variables or arguments scoped to fragments, v17 has a more complete
|
|
81
|
+
* experimental fragment-arguments feature.
|
|
82
|
+
* @example
|
|
83
|
+
* The syntax is identical to normal, query-defined variables.
|
|
84
|
+
*
|
|
85
|
+
* ```graphql
|
|
86
|
+
* fragment A($var: Boolean = false) on T {
|
|
87
|
+
* ...
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
77
90
|
* @deprecated will be removed in the v17.0.0
|
|
78
91
|
*
|
|
79
92
|
* If enabled, the parser will understand and parse variable definitions
|
|
80
93
|
* contained in a fragment definition. They'll be represented in the
|
|
81
94
|
* `variableDefinitions` field of the FragmentDefinitionNode.
|
|
95
|
+
*/
|
|
96
|
+
allowLegacyFragmentVariables?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* EXPERIMENTAL:
|
|
82
99
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
100
|
+
* If enabled, the parser will parse directives on directive definitions.
|
|
101
|
+
* This syntax is not part of the GraphQL specification and may change.
|
|
102
|
+
* @example
|
|
85
103
|
* ```graphql
|
|
86
|
-
*
|
|
87
|
-
* ...
|
|
88
|
-
* }
|
|
104
|
+
* directive @foo @bar on FIELD
|
|
89
105
|
* ```
|
|
90
106
|
*/
|
|
91
|
-
|
|
107
|
+
experimentalDirectivesOnDirectiveDefinitions?: boolean;
|
|
92
108
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
109
|
+
* Internal parser hook for GraphQL.js entry points that need to parse a
|
|
110
|
+
* restricted grammar with an alternate lexer.
|
|
111
|
+
* @internal
|
|
95
112
|
*/
|
|
96
113
|
lexer?: LexerInterface | undefined;
|
|
97
114
|
}
|
|
98
115
|
/**
|
|
99
116
|
* Given a GraphQL source, parses it into a Document.
|
|
100
117
|
* Throws GraphQLError if a syntax error is encountered.
|
|
118
|
+
* @param source - A GraphQL source string or source object.
|
|
119
|
+
* @param options - Optional parser configuration.
|
|
120
|
+
* @returns The parsed GraphQL document AST.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* // Parse a GraphQL document with the default parser options.
|
|
124
|
+
* import { parse } from 'graphql/language';
|
|
125
|
+
*
|
|
126
|
+
* const document = parse('{ hero { name } }');
|
|
127
|
+
*
|
|
128
|
+
* document.kind; // => 'Document'
|
|
129
|
+
* ```
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* // This variant enables parser options and provides an explicit lexer.
|
|
133
|
+
* import { Lexer, Source, parse } from 'graphql/language';
|
|
134
|
+
*
|
|
135
|
+
* const document = parse('fragment A($var: Boolean) on Query { field }', {
|
|
136
|
+
* allowLegacyFragmentVariables: true,
|
|
137
|
+
* maxTokens: 20,
|
|
138
|
+
* noLocation: true,
|
|
139
|
+
* });
|
|
140
|
+
* const directiveDocument = parse('directive @foo @bar on FIELD', {
|
|
141
|
+
* experimentalDirectivesOnDirectiveDefinitions: true,
|
|
142
|
+
* });
|
|
143
|
+
* const source = new Source('{ hero }');
|
|
144
|
+
* const lexerDocument = parse(source, { lexer: new Lexer(source) });
|
|
145
|
+
*
|
|
146
|
+
* document.definitions[0].kind; // => 'FragmentDefinition'
|
|
147
|
+
* document.loc; // => undefined
|
|
148
|
+
* directiveDocument.definitions[0].kind; // => 'DirectiveDefinition'
|
|
149
|
+
* lexerDocument.definitions[0].kind; // => 'OperationDefinition'
|
|
150
|
+
* ```
|
|
101
151
|
*/
|
|
102
152
|
export declare function parse(
|
|
103
153
|
source: string | Source,
|
|
@@ -112,6 +162,17 @@ export declare function parse(
|
|
|
112
162
|
* in isolation of complete GraphQL documents.
|
|
113
163
|
*
|
|
114
164
|
* Consider providing the results to the utility function: valueFromAST().
|
|
165
|
+
* @param source - A GraphQL source string or source object containing a value.
|
|
166
|
+
* @param options - Optional parser configuration.
|
|
167
|
+
* @returns The parsed GraphQL value AST.
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { parseValue } from 'graphql/language';
|
|
171
|
+
*
|
|
172
|
+
* const value = parseValue('[42]');
|
|
173
|
+
*
|
|
174
|
+
* value.kind; // => 'ListValue'
|
|
175
|
+
* ```
|
|
115
176
|
*/
|
|
116
177
|
export declare function parseValue(
|
|
117
178
|
source: string | Source,
|
|
@@ -120,6 +181,18 @@ export declare function parseValue(
|
|
|
120
181
|
/**
|
|
121
182
|
* Similar to parseValue(), but raises a parse error if it encounters a
|
|
122
183
|
* variable. The return type will be a constant value.
|
|
184
|
+
* @param source - A GraphQL source string or source object containing a constant value.
|
|
185
|
+
* @param options - Optional parser configuration.
|
|
186
|
+
* @returns The parsed GraphQL constant value AST.
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { parseConstValue } from 'graphql/language';
|
|
190
|
+
*
|
|
191
|
+
* const value = parseConstValue('{ enabled: true }');
|
|
192
|
+
*
|
|
193
|
+
* value.kind; // => 'ObjectValue'
|
|
194
|
+
* parseConstValue('$variable'); // throws an error
|
|
195
|
+
* ```
|
|
123
196
|
*/
|
|
124
197
|
export declare function parseConstValue(
|
|
125
198
|
source: string | Source,
|
|
@@ -134,6 +207,17 @@ export declare function parseConstValue(
|
|
|
134
207
|
* in isolation of complete GraphQL documents.
|
|
135
208
|
*
|
|
136
209
|
* Consider providing the results to the utility function: typeFromAST().
|
|
210
|
+
* @param source - A GraphQL source string or source object containing a type reference.
|
|
211
|
+
* @param options - Optional parser configuration.
|
|
212
|
+
* @returns The parsed GraphQL type AST.
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* import { parseType } from 'graphql/language';
|
|
216
|
+
*
|
|
217
|
+
* const type = parseType('[String!]');
|
|
218
|
+
*
|
|
219
|
+
* type.kind; // => 'ListType'
|
|
220
|
+
* ```
|
|
137
221
|
*/
|
|
138
222
|
export declare function parseType(
|
|
139
223
|
source: string | Source,
|
|
@@ -147,6 +231,16 @@ export declare function parseType(
|
|
|
147
231
|
* Consider providing the results to the utility function:
|
|
148
232
|
* resolveASTSchemaCoordinate(). Or calling resolveSchemaCoordinate() directly
|
|
149
233
|
* with an unparsed source.
|
|
234
|
+
* @param source - A GraphQL source string or source object containing a schema coordinate.
|
|
235
|
+
* @returns The parsed GraphQL schema coordinate AST.
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* import { parseSchemaCoordinate } from 'graphql/language';
|
|
239
|
+
*
|
|
240
|
+
* const coordinate = parseSchemaCoordinate('Query.hero');
|
|
241
|
+
*
|
|
242
|
+
* coordinate.kind; // => 'MemberCoordinate'
|
|
243
|
+
* ```
|
|
150
244
|
*/
|
|
151
245
|
export declare function parseSchemaCoordinate(
|
|
152
246
|
source: string | Source,
|
|
@@ -170,10 +264,14 @@ export declare class Parser {
|
|
|
170
264
|
get tokenCount(): number;
|
|
171
265
|
/**
|
|
172
266
|
* Converts a name lex token into a name parse node.
|
|
267
|
+
*
|
|
268
|
+
* @internal
|
|
173
269
|
*/
|
|
174
270
|
parseName(): NameNode;
|
|
175
271
|
/**
|
|
176
272
|
* Document : Definition+
|
|
273
|
+
*
|
|
274
|
+
* @internal
|
|
177
275
|
*/
|
|
178
276
|
parseDocument(): DocumentNode;
|
|
179
277
|
/**
|
|
@@ -198,34 +296,48 @@ export declare class Parser {
|
|
|
198
296
|
* - UnionTypeDefinition
|
|
199
297
|
* - EnumTypeDefinition
|
|
200
298
|
* - InputObjectTypeDefinition
|
|
299
|
+
*
|
|
300
|
+
* @internal
|
|
201
301
|
*/
|
|
202
302
|
parseDefinition(): DefinitionNode;
|
|
203
303
|
/**
|
|
204
304
|
* OperationDefinition :
|
|
205
305
|
* - SelectionSet
|
|
206
306
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
307
|
+
*
|
|
308
|
+
* @internal
|
|
207
309
|
*/
|
|
208
310
|
parseOperationDefinition(): OperationDefinitionNode;
|
|
209
311
|
/**
|
|
210
312
|
* OperationType : one of query mutation subscription
|
|
313
|
+
*
|
|
314
|
+
* @internal
|
|
211
315
|
*/
|
|
212
316
|
parseOperationType(): OperationTypeNode;
|
|
213
317
|
/**
|
|
214
318
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
319
|
+
*
|
|
320
|
+
* @internal
|
|
215
321
|
*/
|
|
216
322
|
parseVariableDefinitions(): Array<VariableDefinitionNode>;
|
|
217
323
|
/**
|
|
218
324
|
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
|
|
325
|
+
*
|
|
326
|
+
* @internal
|
|
219
327
|
*/
|
|
220
328
|
parseVariableDefinition(): VariableDefinitionNode;
|
|
221
329
|
/**
|
|
222
330
|
* Variable : $ Name
|
|
331
|
+
*
|
|
332
|
+
* @internal
|
|
223
333
|
*/
|
|
224
334
|
parseVariable(): VariableNode;
|
|
225
335
|
/**
|
|
226
336
|
* ```
|
|
227
337
|
* SelectionSet : { Selection+ }
|
|
228
338
|
* ```
|
|
339
|
+
*
|
|
340
|
+
* @internal
|
|
229
341
|
*/
|
|
230
342
|
parseSelectionSet(): SelectionSetNode;
|
|
231
343
|
/**
|
|
@@ -233,21 +345,29 @@ export declare class Parser {
|
|
|
233
345
|
* - Field
|
|
234
346
|
* - FragmentSpread
|
|
235
347
|
* - InlineFragment
|
|
348
|
+
*
|
|
349
|
+
* @internal
|
|
236
350
|
*/
|
|
237
351
|
parseSelection(): SelectionNode;
|
|
238
352
|
/**
|
|
239
353
|
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
240
354
|
*
|
|
241
355
|
* Alias : Name :
|
|
356
|
+
*
|
|
357
|
+
* @internal
|
|
242
358
|
*/
|
|
243
359
|
parseField(): FieldNode;
|
|
244
360
|
/**
|
|
245
361
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
362
|
+
*
|
|
363
|
+
* @internal
|
|
246
364
|
*/
|
|
247
365
|
parseArguments(isConst: true): Array<ConstArgumentNode>;
|
|
248
366
|
parseArguments(isConst: boolean): Array<ArgumentNode>;
|
|
249
367
|
/**
|
|
250
368
|
* Argument[Const] : Name : Value[?Const]
|
|
369
|
+
*
|
|
370
|
+
* @internal
|
|
251
371
|
*/
|
|
252
372
|
parseArgument(isConst: true): ConstArgumentNode;
|
|
253
373
|
parseArgument(isConst?: boolean): ArgumentNode;
|
|
@@ -258,6 +378,8 @@ export declare class Parser {
|
|
|
258
378
|
* FragmentSpread : ... FragmentName Directives?
|
|
259
379
|
*
|
|
260
380
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
381
|
+
*
|
|
382
|
+
* @internal
|
|
261
383
|
*/
|
|
262
384
|
parseFragment(): FragmentSpreadNode | InlineFragmentNode;
|
|
263
385
|
/**
|
|
@@ -265,10 +387,14 @@ export declare class Parser {
|
|
|
265
387
|
* - fragment FragmentName on TypeCondition Directives? SelectionSet
|
|
266
388
|
*
|
|
267
389
|
* TypeCondition : NamedType
|
|
390
|
+
*
|
|
391
|
+
* @internal
|
|
268
392
|
*/
|
|
269
393
|
parseFragmentDefinition(): FragmentDefinitionNode;
|
|
270
394
|
/**
|
|
271
395
|
* FragmentName : Name but not `on`
|
|
396
|
+
*
|
|
397
|
+
* @internal
|
|
272
398
|
*/
|
|
273
399
|
parseFragmentName(): NameNode;
|
|
274
400
|
/**
|
|
@@ -288,6 +414,8 @@ export declare class Parser {
|
|
|
288
414
|
* NullValue : `null`
|
|
289
415
|
*
|
|
290
416
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
417
|
+
*
|
|
418
|
+
* @internal
|
|
291
419
|
*/
|
|
292
420
|
parseValueLiteral(isConst: true): ConstValueNode;
|
|
293
421
|
parseValueLiteral(isConst: boolean): ValueNode;
|
|
@@ -297,6 +425,8 @@ export declare class Parser {
|
|
|
297
425
|
* ListValue[Const] :
|
|
298
426
|
* - [ ]
|
|
299
427
|
* - [ Value[?Const]+ ]
|
|
428
|
+
*
|
|
429
|
+
* @internal
|
|
300
430
|
*/
|
|
301
431
|
parseList(isConst: true): ConstListValueNode;
|
|
302
432
|
parseList(isConst: boolean): ListValueNode;
|
|
@@ -306,16 +436,22 @@ export declare class Parser {
|
|
|
306
436
|
* - { }
|
|
307
437
|
* - { ObjectField[?Const]+ }
|
|
308
438
|
* ```
|
|
439
|
+
*
|
|
440
|
+
* @internal
|
|
309
441
|
*/
|
|
310
442
|
parseObject(isConst: true): ConstObjectValueNode;
|
|
311
443
|
parseObject(isConst: boolean): ObjectValueNode;
|
|
312
444
|
/**
|
|
313
445
|
* ObjectField[Const] : Name : Value[?Const]
|
|
446
|
+
*
|
|
447
|
+
* @internal
|
|
314
448
|
*/
|
|
315
449
|
parseObjectField(isConst: true): ConstObjectFieldNode;
|
|
316
450
|
parseObjectField(isConst: boolean): ObjectFieldNode;
|
|
317
451
|
/**
|
|
318
452
|
* Directives[Const] : Directive[?Const]+
|
|
453
|
+
*
|
|
454
|
+
* @internal
|
|
319
455
|
*/
|
|
320
456
|
parseDirectives(isConst: true): Array<ConstDirectiveNode>;
|
|
321
457
|
parseDirectives(isConst: boolean): Array<DirectiveNode>;
|
|
@@ -324,6 +460,8 @@ export declare class Parser {
|
|
|
324
460
|
* ```
|
|
325
461
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
326
462
|
* ```
|
|
463
|
+
*
|
|
464
|
+
* @internal
|
|
327
465
|
*/
|
|
328
466
|
parseDirective(isConst: true): ConstDirectiveNode;
|
|
329
467
|
parseDirective(isConst: boolean): DirectiveNode;
|
|
@@ -332,107 +470,149 @@ export declare class Parser {
|
|
|
332
470
|
* - NamedType
|
|
333
471
|
* - ListType
|
|
334
472
|
* - NonNullType
|
|
473
|
+
*
|
|
474
|
+
* @internal
|
|
335
475
|
*/
|
|
336
476
|
parseTypeReference(): TypeNode;
|
|
337
477
|
/**
|
|
338
478
|
* NamedType : Name
|
|
479
|
+
*
|
|
480
|
+
* @internal
|
|
339
481
|
*/
|
|
340
482
|
parseNamedType(): NamedTypeNode;
|
|
341
483
|
peekDescription(): boolean;
|
|
342
484
|
/**
|
|
343
485
|
* Description : StringValue
|
|
486
|
+
*
|
|
487
|
+
* @internal
|
|
344
488
|
*/
|
|
345
489
|
parseDescription(): undefined | StringValueNode;
|
|
346
490
|
/**
|
|
347
491
|
* ```
|
|
348
492
|
* SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
|
|
349
493
|
* ```
|
|
494
|
+
*
|
|
495
|
+
* @internal
|
|
350
496
|
*/
|
|
351
497
|
parseSchemaDefinition(): SchemaDefinitionNode;
|
|
352
498
|
/**
|
|
353
499
|
* OperationTypeDefinition : OperationType : NamedType
|
|
500
|
+
*
|
|
501
|
+
* @internal
|
|
354
502
|
*/
|
|
355
503
|
parseOperationTypeDefinition(): OperationTypeDefinitionNode;
|
|
356
504
|
/**
|
|
357
505
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
506
|
+
*
|
|
507
|
+
* @internal
|
|
358
508
|
*/
|
|
359
509
|
parseScalarTypeDefinition(): ScalarTypeDefinitionNode;
|
|
360
510
|
/**
|
|
361
511
|
* ObjectTypeDefinition :
|
|
362
512
|
* Description?
|
|
363
513
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
514
|
+
*
|
|
515
|
+
* @internal
|
|
364
516
|
*/
|
|
365
517
|
parseObjectTypeDefinition(): ObjectTypeDefinitionNode;
|
|
366
518
|
/**
|
|
367
519
|
* ImplementsInterfaces :
|
|
368
520
|
* - implements `&`? NamedType
|
|
369
521
|
* - ImplementsInterfaces & NamedType
|
|
522
|
+
*
|
|
523
|
+
* @internal
|
|
370
524
|
*/
|
|
371
525
|
parseImplementsInterfaces(): Array<NamedTypeNode>;
|
|
372
526
|
/**
|
|
373
527
|
* ```
|
|
374
528
|
* FieldsDefinition : { FieldDefinition+ }
|
|
375
529
|
* ```
|
|
530
|
+
*
|
|
531
|
+
* @internal
|
|
376
532
|
*/
|
|
377
533
|
parseFieldsDefinition(): Array<FieldDefinitionNode>;
|
|
378
534
|
/**
|
|
379
535
|
* FieldDefinition :
|
|
380
536
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
537
|
+
*
|
|
538
|
+
* @internal
|
|
381
539
|
*/
|
|
382
540
|
parseFieldDefinition(): FieldDefinitionNode;
|
|
383
541
|
/**
|
|
384
542
|
* ArgumentsDefinition : ( InputValueDefinition+ )
|
|
543
|
+
*
|
|
544
|
+
* @internal
|
|
385
545
|
*/
|
|
386
546
|
parseArgumentDefs(): Array<InputValueDefinitionNode>;
|
|
387
547
|
/**
|
|
388
548
|
* InputValueDefinition :
|
|
389
549
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
550
|
+
*
|
|
551
|
+
* @internal
|
|
390
552
|
*/
|
|
391
553
|
parseInputValueDef(): InputValueDefinitionNode;
|
|
392
554
|
/**
|
|
393
555
|
* InterfaceTypeDefinition :
|
|
394
556
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
557
|
+
*
|
|
558
|
+
* @internal
|
|
395
559
|
*/
|
|
396
560
|
parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode;
|
|
397
561
|
/**
|
|
398
562
|
* UnionTypeDefinition :
|
|
399
563
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
564
|
+
*
|
|
565
|
+
* @internal
|
|
400
566
|
*/
|
|
401
567
|
parseUnionTypeDefinition(): UnionTypeDefinitionNode;
|
|
402
568
|
/**
|
|
403
569
|
* UnionMemberTypes :
|
|
404
570
|
* - = `|`? NamedType
|
|
405
571
|
* - UnionMemberTypes | NamedType
|
|
572
|
+
*
|
|
573
|
+
* @internal
|
|
406
574
|
*/
|
|
407
575
|
parseUnionMemberTypes(): Array<NamedTypeNode>;
|
|
408
576
|
/**
|
|
409
577
|
* EnumTypeDefinition :
|
|
410
578
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
579
|
+
*
|
|
580
|
+
* @internal
|
|
411
581
|
*/
|
|
412
582
|
parseEnumTypeDefinition(): EnumTypeDefinitionNode;
|
|
413
583
|
/**
|
|
414
584
|
* ```
|
|
415
585
|
* EnumValuesDefinition : { EnumValueDefinition+ }
|
|
416
586
|
* ```
|
|
587
|
+
*
|
|
588
|
+
* @internal
|
|
417
589
|
*/
|
|
418
590
|
parseEnumValuesDefinition(): Array<EnumValueDefinitionNode>;
|
|
419
591
|
/**
|
|
420
592
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
593
|
+
*
|
|
594
|
+
* @internal
|
|
421
595
|
*/
|
|
422
596
|
parseEnumValueDefinition(): EnumValueDefinitionNode;
|
|
423
597
|
/**
|
|
424
598
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
599
|
+
*
|
|
600
|
+
* @internal
|
|
425
601
|
*/
|
|
426
602
|
parseEnumValueName(): NameNode;
|
|
427
603
|
/**
|
|
428
604
|
* InputObjectTypeDefinition :
|
|
429
605
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
606
|
+
*
|
|
607
|
+
* @internal
|
|
430
608
|
*/
|
|
431
609
|
parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode;
|
|
432
610
|
/**
|
|
433
611
|
* ```
|
|
434
612
|
* InputFieldsDefinition : { InputValueDefinition+ }
|
|
435
613
|
* ```
|
|
614
|
+
*
|
|
615
|
+
* @internal
|
|
436
616
|
*/
|
|
437
617
|
parseInputFieldsDefinition(): Array<InputValueDefinitionNode>;
|
|
438
618
|
/**
|
|
@@ -447,6 +627,9 @@ export declare class Parser {
|
|
|
447
627
|
* - UnionTypeExtension
|
|
448
628
|
* - EnumTypeExtension
|
|
449
629
|
* - InputObjectTypeDefinition
|
|
630
|
+
* - DirectiveDefinitionExtension
|
|
631
|
+
*
|
|
632
|
+
* @internal
|
|
450
633
|
*/
|
|
451
634
|
parseTypeSystemExtension(): TypeSystemExtensionNode;
|
|
452
635
|
/**
|
|
@@ -455,11 +638,15 @@ export declare class Parser {
|
|
|
455
638
|
* - extend schema Directives[Const]? { OperationTypeDefinition+ }
|
|
456
639
|
* - extend schema Directives[Const]
|
|
457
640
|
* ```
|
|
641
|
+
*
|
|
642
|
+
* @internal
|
|
458
643
|
*/
|
|
459
644
|
parseSchemaExtension(): SchemaExtensionNode;
|
|
460
645
|
/**
|
|
461
646
|
* ScalarTypeExtension :
|
|
462
647
|
* - extend scalar Name Directives[Const]
|
|
648
|
+
*
|
|
649
|
+
* @internal
|
|
463
650
|
*/
|
|
464
651
|
parseScalarTypeExtension(): ScalarTypeExtensionNode;
|
|
465
652
|
/**
|
|
@@ -467,6 +654,8 @@ export declare class Parser {
|
|
|
467
654
|
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
468
655
|
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
469
656
|
* - extend type Name ImplementsInterfaces
|
|
657
|
+
*
|
|
658
|
+
* @internal
|
|
470
659
|
*/
|
|
471
660
|
parseObjectTypeExtension(): ObjectTypeExtensionNode;
|
|
472
661
|
/**
|
|
@@ -474,37 +663,50 @@ export declare class Parser {
|
|
|
474
663
|
* - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
475
664
|
* - extend interface Name ImplementsInterfaces? Directives[Const]
|
|
476
665
|
* - extend interface Name ImplementsInterfaces
|
|
666
|
+
*
|
|
667
|
+
* @internal
|
|
477
668
|
*/
|
|
478
669
|
parseInterfaceTypeExtension(): InterfaceTypeExtensionNode;
|
|
479
670
|
/**
|
|
480
671
|
* UnionTypeExtension :
|
|
481
672
|
* - extend union Name Directives[Const]? UnionMemberTypes
|
|
482
673
|
* - extend union Name Directives[Const]
|
|
674
|
+
*
|
|
675
|
+
* @internal
|
|
483
676
|
*/
|
|
484
677
|
parseUnionTypeExtension(): UnionTypeExtensionNode;
|
|
485
678
|
/**
|
|
486
679
|
* EnumTypeExtension :
|
|
487
680
|
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
488
681
|
* - extend enum Name Directives[Const]
|
|
682
|
+
*
|
|
683
|
+
* @internal
|
|
489
684
|
*/
|
|
490
685
|
parseEnumTypeExtension(): EnumTypeExtensionNode;
|
|
491
686
|
/**
|
|
492
687
|
* InputObjectTypeExtension :
|
|
493
688
|
* - extend input Name Directives[Const]? InputFieldsDefinition
|
|
494
689
|
* - extend input Name Directives[Const]
|
|
690
|
+
*
|
|
691
|
+
* @internal
|
|
495
692
|
*/
|
|
496
693
|
parseInputObjectTypeExtension(): InputObjectTypeExtensionNode;
|
|
694
|
+
parseDirectiveDefinitionExtension(): DirectiveExtensionNode;
|
|
497
695
|
/**
|
|
498
696
|
* ```
|
|
499
697
|
* DirectiveDefinition :
|
|
500
698
|
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
501
699
|
* ```
|
|
700
|
+
*
|
|
701
|
+
* @internal
|
|
502
702
|
*/
|
|
503
703
|
parseDirectiveDefinition(): DirectiveDefinitionNode;
|
|
504
704
|
/**
|
|
505
705
|
* DirectiveLocations :
|
|
506
706
|
* - `|`? DirectiveLocation
|
|
507
707
|
* - DirectiveLocations | DirectiveLocation
|
|
708
|
+
*
|
|
709
|
+
* @internal
|
|
508
710
|
*/
|
|
509
711
|
parseDirectiveLocations(): Array<NameNode>;
|
|
510
712
|
parseDirectiveLocation(): NameNode;
|
|
@@ -515,12 +717,27 @@ export declare class Parser {
|
|
|
515
717
|
* - Name . Name ( Name : )
|
|
516
718
|
* - \@ Name
|
|
517
719
|
* - \@ Name ( Name : )
|
|
720
|
+
* @returns Parsed schema coordinate AST.
|
|
721
|
+
* @example
|
|
722
|
+
* ```ts
|
|
723
|
+
* import { Parser, Source } from 'graphql/language';
|
|
724
|
+
*
|
|
725
|
+
* const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
|
|
726
|
+
* const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
|
|
727
|
+
*
|
|
728
|
+
* typeCoordinate.name.value; // => 'User'
|
|
729
|
+
* typeCoordinate.memberName?.value; // => 'name'
|
|
730
|
+
* directiveCoordinate.name.value; // => 'deprecated'
|
|
731
|
+
* directiveCoordinate.argumentName?.value; // => 'reason'
|
|
732
|
+
* ```
|
|
518
733
|
*/
|
|
519
734
|
parseSchemaCoordinate(): SchemaCoordinateNode;
|
|
520
735
|
/**
|
|
521
736
|
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
522
737
|
* location object, used to identify the place in the source that created a
|
|
523
738
|
* given parsed object.
|
|
739
|
+
*
|
|
740
|
+
* @internal
|
|
524
741
|
*/
|
|
525
742
|
node<
|
|
526
743
|
T extends {
|
|
@@ -529,36 +746,50 @@ export declare class Parser {
|
|
|
529
746
|
>(startToken: Token, node: T): T;
|
|
530
747
|
/**
|
|
531
748
|
* Determines if the next token is of a given kind
|
|
749
|
+
*
|
|
750
|
+
* @internal
|
|
532
751
|
*/
|
|
533
752
|
peek(kind: TokenKind): boolean;
|
|
534
753
|
/**
|
|
535
754
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
536
755
|
* Otherwise, do not change the parser state and throw an error.
|
|
756
|
+
*
|
|
757
|
+
* @internal
|
|
537
758
|
*/
|
|
538
759
|
expectToken(kind: TokenKind): Token;
|
|
539
760
|
/**
|
|
540
761
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
541
762
|
* Otherwise, do not change the parser state and return "false".
|
|
763
|
+
*
|
|
764
|
+
* @internal
|
|
542
765
|
*/
|
|
543
766
|
expectOptionalToken(kind: TokenKind): boolean;
|
|
544
767
|
/**
|
|
545
768
|
* If the next token is a given keyword, advance the lexer.
|
|
546
769
|
* Otherwise, do not change the parser state and throw an error.
|
|
770
|
+
*
|
|
771
|
+
* @internal
|
|
547
772
|
*/
|
|
548
773
|
expectKeyword(value: string): void;
|
|
549
774
|
/**
|
|
550
775
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
551
776
|
* Otherwise, do not change the parser state and return "false".
|
|
777
|
+
*
|
|
778
|
+
* @internal
|
|
552
779
|
*/
|
|
553
780
|
expectOptionalKeyword(value: string): boolean;
|
|
554
781
|
/**
|
|
555
782
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
783
|
+
*
|
|
784
|
+
* @internal
|
|
556
785
|
*/
|
|
557
786
|
unexpected(atToken?: Maybe<Token>): GraphQLError;
|
|
558
787
|
/**
|
|
559
788
|
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
560
789
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
561
790
|
* Advances the parser to the next lex token after the closing token.
|
|
791
|
+
*
|
|
792
|
+
* @internal
|
|
562
793
|
*/
|
|
563
794
|
any<T>(openKind: TokenKind, parseFn: () => T, closeKind: TokenKind): Array<T>;
|
|
564
795
|
/**
|
|
@@ -566,6 +797,8 @@ export declare class Parser {
|
|
|
566
797
|
* It can be empty only if open token is missing otherwise it will always return non-empty list
|
|
567
798
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
568
799
|
* Advances the parser to the next lex token after the closing token.
|
|
800
|
+
*
|
|
801
|
+
* @internal
|
|
569
802
|
*/
|
|
570
803
|
optionalMany<T>(
|
|
571
804
|
openKind: TokenKind,
|
|
@@ -576,6 +809,8 @@ export declare class Parser {
|
|
|
576
809
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
577
810
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
578
811
|
* Advances the parser to the next lex token after the closing token.
|
|
812
|
+
*
|
|
813
|
+
* @internal
|
|
579
814
|
*/
|
|
580
815
|
many<T>(
|
|
581
816
|
openKind: TokenKind,
|
|
@@ -586,6 +821,8 @@ export declare class Parser {
|
|
|
586
821
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
587
822
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
588
823
|
* Advances the parser to the next lex token after last item in the list.
|
|
824
|
+
*
|
|
825
|
+
* @internal
|
|
589
826
|
*/
|
|
590
827
|
delimitedMany<T>(delimiterKind: TokenKind, parseFn: () => T): Array<T>;
|
|
591
828
|
advanceLexer(): void;
|