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