graphql 17.0.0-beta.0 → 17.0.0-beta.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/__dev__/execution/buildResolveInfo.d.mts +1 -0
- package/__dev__/execution/buildResolveInfo.d.ts +1 -0
- package/__dev__/execution/buildResolveInfo.js +3 -0
- package/__dev__/execution/buildResolveInfo.mjs +3 -0
- package/devMode.js +2 -2
- package/devMode.js.map +1 -1
- package/devMode.mjs.map +1 -1
- package/error/GraphQLError.d.mts +4 -4
- package/error/GraphQLError.d.ts +4 -4
- package/error/GraphQLError.js +10 -11
- package/error/GraphQLError.js.map +1 -1
- package/error/GraphQLError.mjs +2 -3
- package/error/GraphQLError.mjs.map +1 -1
- package/error/ensureGraphQLError.d.mts +1 -1
- package/error/ensureGraphQLError.d.ts +1 -1
- package/error/ensureGraphQLError.js +5 -5
- package/error/ensureGraphQLError.js.map +1 -1
- package/error/ensureGraphQLError.mjs.map +1 -1
- package/error/index.d.mts +4 -4
- package/error/index.d.ts +4 -4
- package/error/index.js +6 -6
- package/error/index.js.map +1 -1
- package/error/index.mjs.map +1 -1
- package/error/locatedError.d.mts +3 -3
- package/error/locatedError.d.ts +3 -3
- package/error/locatedError.js +4 -4
- package/error/locatedError.js.map +1 -1
- package/error/locatedError.mjs.map +1 -1
- package/error/syntaxError.d.mts +2 -2
- package/error/syntaxError.d.ts +2 -2
- package/error/syntaxError.js +2 -2
- package/error/syntaxError.js.map +1 -1
- package/error/syntaxError.mjs.map +1 -1
- package/execution/AbortedGraphQLExecutionError.d.mts +1 -1
- package/execution/AbortedGraphQLExecutionError.d.ts +1 -1
- package/execution/AbortedGraphQLExecutionError.js.map +1 -1
- package/execution/AbortedGraphQLExecutionError.mjs.map +1 -1
- package/execution/AsyncWorkTracker.js +2 -2
- package/execution/AsyncWorkTracker.js.map +1 -1
- package/execution/AsyncWorkTracker.mjs.map +1 -1
- package/execution/Executor.d.mts +16 -17
- package/execution/Executor.d.ts +16 -17
- package/execution/Executor.js +83 -85
- package/execution/Executor.js.map +1 -1
- package/execution/Executor.mjs +3 -5
- package/execution/Executor.mjs.map +1 -1
- package/execution/ExecutorThrowingOnIncremental.d.mts +6 -6
- package/execution/ExecutorThrowingOnIncremental.d.ts +6 -6
- package/execution/ExecutorThrowingOnIncremental.js +11 -11
- package/execution/ExecutorThrowingOnIncremental.js.map +1 -1
- package/execution/ExecutorThrowingOnIncremental.mjs.map +1 -1
- package/execution/buildResolveInfo.d.mts +14 -0
- package/execution/buildResolveInfo.d.ts +14 -0
- package/execution/buildResolveInfo.js +24 -0
- package/execution/buildResolveInfo.js.map +1 -0
- package/execution/buildResolveInfo.mjs +21 -0
- package/execution/buildResolveInfo.mjs.map +1 -0
- package/execution/cancellablePromise.js +2 -2
- package/execution/cancellablePromise.js.map +1 -1
- package/execution/cancellablePromise.mjs.map +1 -1
- package/execution/collectFields.d.mts +6 -6
- package/execution/collectFields.d.ts +6 -6
- package/execution/collectFields.js +19 -19
- package/execution/collectFields.js.map +1 -1
- package/execution/collectFields.mjs.map +1 -1
- package/execution/collectIteratorPromises.js +2 -2
- package/execution/collectIteratorPromises.js.map +1 -1
- package/execution/collectIteratorPromises.mjs.map +1 -1
- package/execution/createSharedExecutionContext.d.mts +2 -2
- package/execution/createSharedExecutionContext.d.ts +2 -2
- package/execution/createSharedExecutionContext.js +2 -2
- package/execution/createSharedExecutionContext.js.map +1 -1
- package/execution/createSharedExecutionContext.mjs.map +1 -1
- package/execution/execute.d.mts +14 -14
- package/execution/execute.d.ts +14 -14
- package/execution/execute.js +78 -98
- package/execution/execute.js.map +1 -1
- package/execution/execute.mjs +17 -37
- package/execution/execute.mjs.map +1 -1
- package/execution/getStreamUsage.d.mts +2 -2
- package/execution/getStreamUsage.d.ts +2 -2
- package/execution/getStreamUsage.js +9 -9
- package/execution/getStreamUsage.js.map +1 -1
- package/execution/getStreamUsage.mjs.map +1 -1
- package/execution/getVariableSignature.d.mts +3 -3
- package/execution/getVariableSignature.d.ts +3 -3
- package/execution/getVariableSignature.js +8 -8
- package/execution/getVariableSignature.js.map +1 -1
- package/execution/getVariableSignature.mjs.map +1 -1
- package/execution/hooks.d.mts +2 -2
- package/execution/hooks.d.ts +2 -2
- package/execution/hooks.js.map +1 -1
- package/execution/hooks.mjs.map +1 -1
- package/execution/incremental/Computation.d.mts +1 -1
- package/execution/incremental/Computation.d.ts +1 -1
- package/execution/incremental/Computation.js +2 -2
- package/execution/incremental/Computation.js.map +1 -1
- package/execution/incremental/Computation.mjs.map +1 -1
- package/execution/incremental/IncrementalExecutor.d.mts +14 -14
- package/execution/incremental/IncrementalExecutor.d.ts +14 -14
- package/execution/incremental/IncrementalExecutor.js +48 -48
- package/execution/incremental/IncrementalExecutor.js.map +1 -1
- package/execution/incremental/IncrementalExecutor.mjs +3 -3
- package/execution/incremental/IncrementalExecutor.mjs.map +1 -1
- package/execution/incremental/IncrementalPublisher.d.mts +3 -3
- package/execution/incremental/IncrementalPublisher.d.ts +3 -3
- package/execution/incremental/IncrementalPublisher.js +13 -14
- package/execution/incremental/IncrementalPublisher.js.map +1 -1
- package/execution/incremental/IncrementalPublisher.mjs +1 -2
- package/execution/incremental/IncrementalPublisher.mjs.map +1 -1
- package/execution/incremental/Queue.d.mts +1 -1
- package/execution/incremental/Queue.d.ts +1 -1
- package/execution/incremental/Queue.js +26 -22
- package/execution/incremental/Queue.js.map +1 -1
- package/execution/incremental/Queue.mjs +10 -6
- package/execution/incremental/Queue.mjs.map +1 -1
- package/execution/incremental/WorkQueue.d.mts +2 -2
- package/execution/incremental/WorkQueue.d.ts +2 -2
- package/execution/incremental/WorkQueue.js +7 -7
- package/execution/incremental/WorkQueue.js.map +1 -1
- package/execution/incremental/WorkQueue.mjs.map +1 -1
- package/execution/incremental/buildExecutionPlan.d.mts +1 -1
- package/execution/incremental/buildExecutionPlan.d.ts +1 -1
- package/execution/incremental/buildExecutionPlan.js +4 -4
- package/execution/incremental/buildExecutionPlan.js.map +1 -1
- package/execution/incremental/buildExecutionPlan.mjs.map +1 -1
- package/execution/index.d.mts +8 -8
- package/execution/index.d.ts +8 -8
- package/execution/index.js +23 -22
- package/execution/index.js.map +1 -1
- package/execution/index.mjs +1 -1
- package/execution/index.mjs.map +1 -1
- package/execution/mapAsyncIterable.d.mts +1 -1
- package/execution/mapAsyncIterable.d.ts +1 -1
- package/execution/mapAsyncIterable.js +4 -4
- package/execution/mapAsyncIterable.js.map +1 -1
- package/execution/mapAsyncIterable.mjs.map +1 -1
- package/execution/returnIteratorCatchingErrors.js +1 -1
- package/execution/returnIteratorCatchingErrors.js.map +1 -1
- package/execution/returnIteratorCatchingErrors.mjs +1 -1
- package/execution/returnIteratorCatchingErrors.mjs.map +1 -1
- package/execution/values.d.mts +9 -9
- package/execution/values.d.ts +9 -9
- package/execution/values.js +34 -34
- package/execution/values.js.map +1 -1
- package/execution/values.mjs +2 -2
- package/execution/values.mjs.map +1 -1
- package/execution/withConcurrentAbruptClose.d.mts +1 -1
- package/execution/withConcurrentAbruptClose.d.ts +1 -1
- package/execution/withConcurrentAbruptClose.js +4 -4
- package/execution/withConcurrentAbruptClose.js.map +1 -1
- package/execution/withConcurrentAbruptClose.mjs +2 -2
- package/execution/withConcurrentAbruptClose.mjs.map +1 -1
- package/graphql.d.mts +7 -7
- package/graphql.d.ts +7 -7
- package/graphql.js +11 -11
- package/graphql.js.map +1 -1
- package/graphql.mjs.map +1 -1
- package/harness.d.mts +4 -4
- package/harness.d.ts +4 -4
- package/harness.js +7 -7
- package/harness.js.map +1 -1
- package/harness.mjs.map +1 -1
- package/index.d.mts +20 -20
- package/index.d.ts +20 -20
- package/index.js +253 -252
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/jsutils/Path.d.mts +1 -1
- package/jsutils/Path.d.ts +1 -1
- package/jsutils/Path.js.map +1 -1
- package/jsutils/Path.mjs.map +1 -1
- package/jsutils/didYouMean.js +2 -2
- package/jsutils/didYouMean.js.map +1 -1
- package/jsutils/didYouMean.mjs.map +1 -1
- package/jsutils/formatList.js +2 -2
- package/jsutils/formatList.js.map +1 -1
- package/jsutils/formatList.mjs.map +1 -1
- package/jsutils/getBySet.js +2 -2
- package/jsutils/getBySet.js.map +1 -1
- package/jsutils/getBySet.mjs.map +1 -1
- package/jsutils/groupBy.js +2 -2
- package/jsutils/groupBy.js.map +1 -1
- package/jsutils/groupBy.mjs.map +1 -1
- package/jsutils/instanceOf.js +2 -2
- package/jsutils/instanceOf.js.map +1 -1
- package/jsutils/instanceOf.mjs.map +1 -1
- package/jsutils/keyMap.d.mts +1 -1
- package/jsutils/keyMap.d.ts +1 -1
- package/jsutils/keyMap.js.map +1 -1
- package/jsutils/keyMap.mjs.map +1 -1
- package/jsutils/keyValMap.d.mts +1 -1
- package/jsutils/keyValMap.d.ts +1 -1
- package/jsutils/keyValMap.js.map +1 -1
- package/jsutils/keyValMap.mjs.map +1 -1
- package/jsutils/mapValue.d.mts +1 -1
- package/jsutils/mapValue.d.ts +1 -1
- package/jsutils/mapValue.js.map +1 -1
- package/jsutils/mapValue.mjs.map +1 -1
- package/jsutils/promiseForObject.d.mts +2 -2
- package/jsutils/promiseForObject.d.ts +2 -2
- package/jsutils/promiseForObject.js.map +1 -1
- package/jsutils/promiseForObject.mjs.map +1 -1
- package/jsutils/promiseReduce.d.mts +1 -1
- package/jsutils/promiseReduce.d.ts +1 -1
- package/jsutils/promiseReduce.js +2 -2
- package/jsutils/promiseReduce.js.map +1 -1
- package/jsutils/promiseReduce.mjs.map +1 -1
- package/jsutils/promiseWithResolvers.d.mts +1 -1
- package/jsutils/promiseWithResolvers.d.ts +1 -1
- package/jsutils/promiseWithResolvers.js.map +1 -1
- package/jsutils/promiseWithResolvers.mjs.map +1 -1
- package/jsutils/suggestionList.js +2 -2
- package/jsutils/suggestionList.js.map +1 -1
- package/jsutils/suggestionList.mjs.map +1 -1
- package/jsutils/toError.js +2 -2
- package/jsutils/toError.js.map +1 -1
- package/jsutils/toError.mjs.map +1 -1
- package/jsutils/toObjMap.d.mts +2 -2
- package/jsutils/toObjMap.d.ts +2 -2
- package/jsutils/toObjMap.js.map +1 -1
- package/jsutils/toObjMap.mjs.map +1 -1
- package/language/KindTypeMap.d.mts +1 -1
- package/language/KindTypeMap.d.ts +1 -1
- package/language/KindTypeMap.js.map +1 -1
- package/language/KindTypeMap.mjs.map +1 -1
- package/language/ast.d.mts +12 -5
- package/language/ast.d.ts +12 -5
- package/language/ast.js +8 -1
- package/language/ast.js.map +1 -1
- package/language/ast.mjs +8 -1
- package/language/ast.mjs.map +1 -1
- package/language/blockString.js +4 -4
- package/language/blockString.js.map +1 -1
- package/language/blockString.mjs.map +1 -1
- package/language/directiveLocation.d.mts +2 -1
- package/language/directiveLocation.d.ts +2 -1
- package/language/directiveLocation.js +2 -1
- package/language/directiveLocation.js.map +1 -1
- package/language/directiveLocation.mjs +2 -1
- package/language/directiveLocation.mjs.map +1 -1
- package/language/index.d.mts +16 -16
- package/language/index.d.ts +16 -16
- package/language/index.js +45 -45
- package/language/index.js.map +1 -1
- package/language/index.mjs.map +1 -1
- package/language/kinds.d.mts +2 -2
- package/language/kinds.d.ts +2 -2
- package/language/kinds.js.map +1 -1
- package/language/kinds.mjs.map +1 -1
- package/language/kinds_.d.mts +2 -0
- package/language/kinds_.d.ts +2 -0
- package/language/kinds_.js +2 -1
- package/language/kinds_.js.map +1 -1
- package/language/kinds_.mjs +1 -0
- package/language/kinds_.mjs.map +1 -1
- package/language/lexer.d.mts +3 -3
- package/language/lexer.d.ts +3 -3
- package/language/lexer.js +67 -67
- package/language/lexer.js.map +1 -1
- package/language/lexer.mjs.map +1 -1
- package/language/location.d.mts +1 -1
- package/language/location.d.ts +1 -1
- package/language/location.js +2 -2
- package/language/location.js.map +1 -1
- package/language/location.mjs.map +1 -1
- package/language/parser.d.mts +20 -7
- package/language/parser.d.ts +20 -7
- package/language/parser.js +185 -155
- package/language/parser.js.map +1 -1
- package/language/parser.mjs +30 -0
- package/language/parser.mjs.map +1 -1
- package/language/predicates.d.mts +1 -1
- package/language/predicates.d.ts +1 -1
- package/language/predicates.js +45 -43
- package/language/predicates.js.map +1 -1
- package/language/predicates.mjs +3 -1
- package/language/predicates.mjs.map +1 -1
- package/language/printLocation.d.mts +3 -3
- package/language/printLocation.d.ts +3 -3
- package/language/printLocation.js +2 -2
- package/language/printLocation.js.map +1 -1
- package/language/printLocation.mjs.map +1 -1
- package/language/printer.d.mts +1 -1
- package/language/printer.d.ts +1 -1
- package/language/printer.js +10 -6
- package/language/printer.js.map +1 -1
- package/language/printer.mjs +5 -1
- package/language/printer.mjs.map +1 -1
- package/language/schemaCoordinateLexer.d.mts +3 -3
- package/language/schemaCoordinateLexer.d.ts +3 -3
- package/language/schemaCoordinateLexer.js +16 -16
- package/language/schemaCoordinateLexer.js.map +1 -1
- package/language/schemaCoordinateLexer.mjs.map +1 -1
- package/language/source.js +5 -5
- package/language/source.js.map +1 -1
- package/language/source.mjs.map +1 -1
- package/language/visitor.d.mts +2 -2
- package/language/visitor.d.ts +2 -2
- package/language/visitor.js +10 -10
- package/language/visitor.js.map +1 -1
- package/language/visitor.mjs.map +1 -1
- package/package.json +2 -2
- package/type/assertName.js +8 -8
- package/type/assertName.js.map +1 -1
- package/type/assertName.mjs.map +1 -1
- package/type/definition.d.mts +9 -9
- package/type/definition.d.ts +9 -9
- package/type/definition.js +94 -94
- package/type/definition.js.map +1 -1
- package/type/definition.mjs.map +1 -1
- package/type/directives.d.mts +11 -6
- package/type/directives.d.ts +11 -6
- package/type/directives.js +51 -46
- package/type/directives.js.map +1 -1
- package/type/directives.mjs +5 -0
- package/type/directives.mjs.map +1 -1
- package/type/index.d.mts +12 -12
- package/type/index.d.ts +12 -12
- package/type/index.js +106 -106
- package/type/index.js.map +1 -1
- package/type/index.mjs.map +1 -1
- package/type/introspection.d.mts +2 -2
- package/type/introspection.d.ts +2 -2
- package/type/introspection.js +123 -103
- package/type/introspection.js.map +1 -1
- package/type/introspection.mjs +25 -5
- package/type/introspection.mjs.map +1 -1
- package/type/scalars.d.mts +2 -2
- package/type/scalars.d.ts +2 -2
- package/type/scalars.js +61 -61
- package/type/scalars.js.map +1 -1
- package/type/scalars.mjs.map +1 -1
- package/type/schema.d.mts +7 -7
- package/type/schema.d.ts +7 -7
- package/type/schema.js +32 -32
- package/type/schema.js.map +1 -1
- package/type/schema.mjs.map +1 -1
- package/type/validate.d.mts +4 -4
- package/type/validate.d.ts +4 -4
- package/type/validate.js +83 -83
- package/type/validate.js.map +1 -1
- package/type/validate.mjs +1 -1
- package/type/validate.mjs.map +1 -1
- package/utilities/TypeInfo.d.mts +6 -6
- package/utilities/TypeInfo.d.ts +6 -6
- package/utilities/TypeInfo.js +61 -61
- package/utilities/TypeInfo.js.map +1 -1
- package/utilities/TypeInfo.mjs +1 -1
- package/utilities/TypeInfo.mjs.map +1 -1
- package/utilities/astFromValue.d.mts +3 -3
- package/utilities/astFromValue.d.ts +3 -3
- package/utilities/astFromValue.js +31 -33
- package/utilities/astFromValue.js.map +1 -1
- package/utilities/astFromValue.mjs +1 -3
- package/utilities/astFromValue.mjs.map +1 -1
- package/utilities/buildASTSchema.d.mts +5 -5
- package/utilities/buildASTSchema.d.ts +5 -5
- package/utilities/buildASTSchema.js +11 -10
- package/utilities/buildASTSchema.js.map +1 -1
- package/utilities/buildASTSchema.mjs +1 -0
- package/utilities/buildASTSchema.mjs.map +1 -1
- package/utilities/buildClientSchema.d.mts +3 -3
- package/utilities/buildClientSchema.d.ts +3 -3
- package/utilities/buildClientSchema.js +53 -52
- package/utilities/buildClientSchema.js.map +1 -1
- package/utilities/buildClientSchema.mjs +1 -0
- package/utilities/buildClientSchema.mjs.map +1 -1
- package/utilities/coerceInputValue.d.mts +5 -5
- package/utilities/coerceInputValue.d.ts +5 -5
- package/utilities/coerceInputValue.js +31 -31
- package/utilities/coerceInputValue.js.map +1 -1
- package/utilities/coerceInputValue.mjs.map +1 -1
- package/utilities/concatAST.d.mts +1 -1
- package/utilities/concatAST.d.ts +1 -1
- package/utilities/concatAST.js +2 -2
- package/utilities/concatAST.js.map +1 -1
- package/utilities/concatAST.mjs.map +1 -1
- package/utilities/extendSchema.d.mts +3 -3
- package/utilities/extendSchema.d.ts +3 -3
- package/utilities/extendSchema.js +92 -66
- package/utilities/extendSchema.js.map +1 -1
- package/utilities/extendSchema.mjs +27 -1
- package/utilities/extendSchema.mjs.map +1 -1
- package/utilities/findSchemaChanges.d.mts +1 -1
- package/utilities/findSchemaChanges.d.ts +1 -1
- package/utilities/findSchemaChanges.js +42 -44
- package/utilities/findSchemaChanges.js.map +1 -1
- package/utilities/findSchemaChanges.mjs +1 -3
- package/utilities/findSchemaChanges.mjs.map +1 -1
- package/utilities/getDefaultValueAST.d.mts +2 -2
- package/utilities/getDefaultValueAST.d.ts +2 -2
- package/utilities/getDefaultValueAST.js +9 -7
- package/utilities/getDefaultValueAST.js.map +1 -1
- package/utilities/getDefaultValueAST.mjs +2 -0
- package/utilities/getDefaultValueAST.mjs.map +1 -1
- package/utilities/getIntrospectionQuery.d.mts +19 -3
- package/utilities/getIntrospectionQuery.d.ts +19 -3
- package/utilities/getIntrospectionQuery.js +22 -38
- package/utilities/getIntrospectionQuery.js.map +1 -1
- package/utilities/getIntrospectionQuery.mjs +22 -38
- package/utilities/getIntrospectionQuery.mjs.map +1 -1
- package/utilities/getOperationAST.d.mts +2 -2
- package/utilities/getOperationAST.d.ts +2 -2
- package/utilities/getOperationAST.js +2 -2
- package/utilities/getOperationAST.js.map +1 -1
- package/utilities/getOperationAST.mjs.map +1 -1
- package/utilities/index.d.mts +28 -28
- package/utilities/index.d.ts +28 -28
- package/utilities/index.js +61 -61
- package/utilities/index.js.map +1 -1
- package/utilities/index.mjs.map +1 -1
- package/utilities/introspectionFromSchema.d.mts +2 -2
- package/utilities/introspectionFromSchema.d.ts +2 -2
- package/utilities/introspectionFromSchema.js +8 -7
- package/utilities/introspectionFromSchema.js.map +1 -1
- package/utilities/introspectionFromSchema.mjs +1 -0
- package/utilities/introspectionFromSchema.mjs.map +1 -1
- package/utilities/lexicographicSortSchema.d.mts +1 -1
- package/utilities/lexicographicSortSchema.d.ts +1 -1
- package/utilities/lexicographicSortSchema.js +14 -14
- package/utilities/lexicographicSortSchema.js.map +1 -1
- package/utilities/lexicographicSortSchema.mjs.map +1 -1
- package/utilities/mapSchemaConfig.d.mts +3 -3
- package/utilities/mapSchemaConfig.d.ts +3 -3
- package/utilities/mapSchemaConfig.js +29 -31
- package/utilities/mapSchemaConfig.js.map +1 -1
- package/utilities/mapSchemaConfig.mjs +1 -3
- package/utilities/mapSchemaConfig.mjs.map +1 -1
- package/utilities/printSchema.d.mts +3 -3
- package/utilities/printSchema.d.ts +3 -3
- package/utilities/printSchema.js +31 -32
- package/utilities/printSchema.js.map +1 -1
- package/utilities/printSchema.mjs +2 -3
- package/utilities/printSchema.mjs.map +1 -1
- package/utilities/replaceVariables.d.mts +4 -4
- package/utilities/replaceVariables.d.ts +4 -4
- package/utilities/replaceVariables.js +9 -9
- package/utilities/replaceVariables.js.map +1 -1
- package/utilities/replaceVariables.mjs.map +1 -1
- package/utilities/resolveSchemaCoordinate.d.mts +5 -5
- package/utilities/resolveSchemaCoordinate.d.ts +5 -5
- package/utilities/resolveSchemaCoordinate.js +23 -23
- package/utilities/resolveSchemaCoordinate.js.map +1 -1
- package/utilities/resolveSchemaCoordinate.mjs.map +1 -1
- package/utilities/separateOperations.d.mts +2 -2
- package/utilities/separateOperations.d.ts +2 -2
- package/utilities/separateOperations.js +7 -7
- package/utilities/separateOperations.js.map +1 -1
- package/utilities/separateOperations.mjs.map +1 -1
- package/utilities/sortValueNode.d.mts +1 -1
- package/utilities/sortValueNode.d.ts +1 -1
- package/utilities/sortValueNode.js +12 -12
- package/utilities/sortValueNode.js.map +1 -1
- package/utilities/sortValueNode.mjs.map +1 -1
- package/utilities/stripIgnoredCharacters.d.mts +1 -1
- package/utilities/stripIgnoredCharacters.d.ts +1 -1
- package/utilities/stripIgnoredCharacters.js +11 -11
- package/utilities/stripIgnoredCharacters.js.map +1 -1
- package/utilities/stripIgnoredCharacters.mjs.map +1 -1
- package/utilities/typeComparators.d.mts +2 -2
- package/utilities/typeComparators.d.ts +2 -2
- package/utilities/typeComparators.js +14 -14
- package/utilities/typeComparators.js.map +1 -1
- package/utilities/typeComparators.mjs.map +1 -1
- package/utilities/typeFromAST.d.mts +4 -4
- package/utilities/typeFromAST.d.ts +4 -4
- package/utilities/typeFromAST.js +7 -7
- package/utilities/typeFromAST.js.map +1 -1
- package/utilities/typeFromAST.mjs.map +1 -1
- package/utilities/typedQueryDocumentNode.d.mts +1 -1
- package/utilities/typedQueryDocumentNode.d.ts +1 -1
- package/utilities/typedQueryDocumentNode.js.map +1 -1
- package/utilities/typedQueryDocumentNode.mjs.map +1 -1
- package/utilities/validateInputValue.d.mts +6 -6
- package/utilities/validateInputValue.d.ts +6 -6
- package/utilities/validateInputValue.js +60 -60
- package/utilities/validateInputValue.js.map +1 -1
- package/utilities/validateInputValue.mjs.map +1 -1
- package/utilities/valueFromAST.d.mts +4 -4
- package/utilities/valueFromAST.d.ts +4 -4
- package/utilities/valueFromAST.js +20 -22
- package/utilities/valueFromAST.js.map +1 -1
- package/utilities/valueFromAST.mjs +1 -3
- package/utilities/valueFromAST.mjs.map +1 -1
- package/utilities/valueFromASTUntyped.d.mts +3 -3
- package/utilities/valueFromASTUntyped.d.ts +3 -3
- package/utilities/valueFromASTUntyped.js +12 -12
- package/utilities/valueFromASTUntyped.js.map +1 -1
- package/utilities/valueFromASTUntyped.mjs.map +1 -1
- package/utilities/valueToLiteral.d.mts +2 -2
- package/utilities/valueToLiteral.d.ts +2 -2
- package/utilities/valueToLiteral.js +30 -30
- package/utilities/valueToLiteral.js.map +1 -1
- package/utilities/valueToLiteral.mjs.map +1 -1
- package/validation/ValidationContext.d.mts +9 -9
- package/validation/ValidationContext.d.ts +9 -9
- package/validation/ValidationContext.js +8 -8
- package/validation/ValidationContext.js.map +1 -1
- package/validation/ValidationContext.mjs.map +1 -1
- package/validation/index.d.mts +46 -46
- package/validation/index.d.ts +46 -46
- package/validation/index.js +91 -91
- package/validation/index.js.map +1 -1
- package/validation/index.mjs.map +1 -1
- package/validation/rules/DeferStreamDirectiveLabelRule.d.mts +2 -2
- package/validation/rules/DeferStreamDirectiveLabelRule.d.ts +2 -2
- package/validation/rules/DeferStreamDirectiveLabelRule.js +9 -9
- package/validation/rules/DeferStreamDirectiveLabelRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveLabelRule.mjs.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.mts +2 -2
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.ts +2 -2
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js +8 -8
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.mts +2 -2
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.ts +2 -2
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js +14 -14
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js.map +1 -1
- package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs.map +1 -1
- package/validation/rules/ExecutableDefinitionsRule.d.mts +2 -2
- package/validation/rules/ExecutableDefinitionsRule.d.ts +2 -2
- package/validation/rules/ExecutableDefinitionsRule.js +7 -7
- package/validation/rules/ExecutableDefinitionsRule.js.map +1 -1
- package/validation/rules/ExecutableDefinitionsRule.mjs.map +1 -1
- package/validation/rules/FieldsOnCorrectTypeRule.d.mts +2 -2
- package/validation/rules/FieldsOnCorrectTypeRule.d.ts +2 -2
- package/validation/rules/FieldsOnCorrectTypeRule.js +14 -14
- package/validation/rules/FieldsOnCorrectTypeRule.js.map +1 -1
- package/validation/rules/FieldsOnCorrectTypeRule.mjs.map +1 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.d.mts +2 -2
- package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +2 -2
- package/validation/rules/FragmentsOnCompositeTypesRule.js +12 -12
- package/validation/rules/FragmentsOnCompositeTypesRule.js.map +1 -1
- package/validation/rules/FragmentsOnCompositeTypesRule.mjs.map +1 -1
- package/validation/rules/KnownArgumentNamesRule.d.mts +2 -2
- package/validation/rules/KnownArgumentNamesRule.d.ts +2 -2
- package/validation/rules/KnownArgumentNamesRule.js +16 -16
- package/validation/rules/KnownArgumentNamesRule.js.map +1 -1
- package/validation/rules/KnownArgumentNamesRule.mjs.map +1 -1
- package/validation/rules/KnownDirectivesRule.d.mts +2 -2
- package/validation/rules/KnownDirectivesRule.d.ts +2 -2
- package/validation/rules/KnownDirectivesRule.js +67 -64
- package/validation/rules/KnownDirectivesRule.js.map +1 -1
- package/validation/rules/KnownDirectivesRule.mjs +4 -1
- package/validation/rules/KnownDirectivesRule.mjs.map +1 -1
- package/validation/rules/KnownFragmentNamesRule.d.mts +2 -2
- package/validation/rules/KnownFragmentNamesRule.d.ts +2 -2
- package/validation/rules/KnownFragmentNamesRule.js +2 -2
- package/validation/rules/KnownFragmentNamesRule.js.map +1 -1
- package/validation/rules/KnownFragmentNamesRule.mjs.map +1 -1
- package/validation/rules/KnownOperationTypesRule.d.mts +2 -2
- package/validation/rules/KnownOperationTypesRule.d.ts +2 -2
- package/validation/rules/KnownOperationTypesRule.js +2 -2
- package/validation/rules/KnownOperationTypesRule.js.map +1 -1
- package/validation/rules/KnownOperationTypesRule.mjs.map +1 -1
- package/validation/rules/KnownTypeNamesRule.d.mts +2 -2
- package/validation/rules/KnownTypeNamesRule.d.ts +2 -2
- package/validation/rules/KnownTypeNamesRule.js +11 -11
- package/validation/rules/KnownTypeNamesRule.js.map +1 -1
- package/validation/rules/KnownTypeNamesRule.mjs.map +1 -1
- package/validation/rules/LoneAnonymousOperationRule.d.mts +2 -2
- package/validation/rules/LoneAnonymousOperationRule.d.ts +2 -2
- package/validation/rules/LoneAnonymousOperationRule.js +4 -4
- package/validation/rules/LoneAnonymousOperationRule.js.map +1 -1
- package/validation/rules/LoneAnonymousOperationRule.mjs.map +1 -1
- package/validation/rules/LoneSchemaDefinitionRule.d.mts +2 -2
- package/validation/rules/LoneSchemaDefinitionRule.d.ts +2 -2
- package/validation/rules/LoneSchemaDefinitionRule.js +3 -3
- package/validation/rules/LoneSchemaDefinitionRule.js.map +1 -1
- package/validation/rules/LoneSchemaDefinitionRule.mjs.map +1 -1
- package/validation/rules/MaxIntrospectionDepthRule.d.mts +2 -2
- package/validation/rules/MaxIntrospectionDepthRule.d.ts +2 -2
- package/validation/rules/MaxIntrospectionDepthRule.js +5 -5
- package/validation/rules/MaxIntrospectionDepthRule.js.map +1 -1
- package/validation/rules/MaxIntrospectionDepthRule.mjs.map +1 -1
- package/validation/rules/NoFragmentCyclesRule.d.mts +2 -2
- package/validation/rules/NoFragmentCyclesRule.d.ts +2 -2
- package/validation/rules/NoFragmentCyclesRule.js +2 -2
- package/validation/rules/NoFragmentCyclesRule.js.map +1 -1
- package/validation/rules/NoFragmentCyclesRule.mjs.map +1 -1
- package/validation/rules/NoUndefinedVariablesRule.d.mts +2 -2
- package/validation/rules/NoUndefinedVariablesRule.d.ts +2 -2
- package/validation/rules/NoUndefinedVariablesRule.js +2 -2
- package/validation/rules/NoUndefinedVariablesRule.js.map +1 -1
- package/validation/rules/NoUndefinedVariablesRule.mjs.map +1 -1
- package/validation/rules/NoUnusedFragmentsRule.d.mts +2 -2
- package/validation/rules/NoUnusedFragmentsRule.d.ts +2 -2
- package/validation/rules/NoUnusedFragmentsRule.js +2 -2
- package/validation/rules/NoUnusedFragmentsRule.js.map +1 -1
- package/validation/rules/NoUnusedFragmentsRule.mjs.map +1 -1
- package/validation/rules/NoUnusedVariablesRule.d.mts +2 -2
- package/validation/rules/NoUnusedVariablesRule.d.ts +2 -2
- package/validation/rules/NoUnusedVariablesRule.js +3 -3
- package/validation/rules/NoUnusedVariablesRule.js.map +1 -1
- package/validation/rules/NoUnusedVariablesRule.mjs.map +1 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.d.mts +2 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +2 -2
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +31 -31
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js.map +1 -1
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs.map +1 -1
- package/validation/rules/PossibleFragmentSpreadsRule.d.mts +2 -2
- package/validation/rules/PossibleFragmentSpreadsRule.d.ts +2 -2
- package/validation/rules/PossibleFragmentSpreadsRule.js +17 -17
- package/validation/rules/PossibleFragmentSpreadsRule.js.map +1 -1
- package/validation/rules/PossibleFragmentSpreadsRule.mjs.map +1 -1
- package/validation/rules/PossibleTypeExtensionsRule.d.mts +2 -2
- package/validation/rules/PossibleTypeExtensionsRule.d.ts +2 -2
- package/validation/rules/PossibleTypeExtensionsRule.js +40 -42
- package/validation/rules/PossibleTypeExtensionsRule.js.map +1 -1
- package/validation/rules/PossibleTypeExtensionsRule.mjs +2 -4
- package/validation/rules/PossibleTypeExtensionsRule.mjs.map +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.d.mts +2 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +2 -2
- package/validation/rules/ProvidedRequiredArgumentsRule.js +20 -20
- package/validation/rules/ProvidedRequiredArgumentsRule.js.map +1 -1
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs.map +1 -1
- package/validation/rules/ScalarLeafsRule.d.mts +2 -2
- package/validation/rules/ScalarLeafsRule.d.ts +2 -2
- package/validation/rules/ScalarLeafsRule.js +10 -10
- package/validation/rules/ScalarLeafsRule.js.map +1 -1
- package/validation/rules/ScalarLeafsRule.mjs.map +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.d.mts +2 -2
- package/validation/rules/SingleFieldSubscriptionsRule.d.ts +2 -2
- package/validation/rules/SingleFieldSubscriptionsRule.js +8 -8
- package/validation/rules/SingleFieldSubscriptionsRule.js.map +1 -1
- package/validation/rules/SingleFieldSubscriptionsRule.mjs.map +1 -1
- package/validation/rules/StreamDirectiveOnListFieldRule.d.mts +2 -2
- package/validation/rules/StreamDirectiveOnListFieldRule.d.ts +2 -2
- package/validation/rules/StreamDirectiveOnListFieldRule.js +7 -7
- package/validation/rules/StreamDirectiveOnListFieldRule.js.map +1 -1
- package/validation/rules/StreamDirectiveOnListFieldRule.mjs.map +1 -1
- package/validation/rules/UniqueArgumentDefinitionNamesRule.d.mts +2 -2
- package/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts +2 -2
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +4 -4
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js.map +1 -1
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueArgumentNamesRule.d.mts +2 -2
- package/validation/rules/UniqueArgumentNamesRule.d.ts +2 -2
- package/validation/rules/UniqueArgumentNamesRule.js +4 -4
- package/validation/rules/UniqueArgumentNamesRule.js.map +1 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueDirectiveNamesRule.d.mts +2 -2
- package/validation/rules/UniqueDirectiveNamesRule.d.ts +2 -2
- package/validation/rules/UniqueDirectiveNamesRule.js +3 -3
- package/validation/rules/UniqueDirectiveNamesRule.js.map +1 -1
- package/validation/rules/UniqueDirectiveNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.d.mts +2 -2
- package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +2 -2
- package/validation/rules/UniqueDirectivesPerLocationRule.js +20 -10
- package/validation/rules/UniqueDirectivesPerLocationRule.js.map +1 -1
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs +10 -0
- package/validation/rules/UniqueDirectivesPerLocationRule.mjs.map +1 -1
- package/validation/rules/UniqueEnumValueNamesRule.d.mts +2 -2
- package/validation/rules/UniqueEnumValueNamesRule.d.ts +2 -2
- package/validation/rules/UniqueEnumValueNamesRule.js +5 -5
- package/validation/rules/UniqueEnumValueNamesRule.js.map +1 -1
- package/validation/rules/UniqueEnumValueNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.d.mts +2 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +2 -2
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +5 -5
- package/validation/rules/UniqueFieldDefinitionNamesRule.js.map +1 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueFragmentNamesRule.d.mts +2 -2
- package/validation/rules/UniqueFragmentNamesRule.d.ts +2 -2
- package/validation/rules/UniqueFragmentNamesRule.js +2 -2
- package/validation/rules/UniqueFragmentNamesRule.js.map +1 -1
- package/validation/rules/UniqueFragmentNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.d.mts +2 -2
- package/validation/rules/UniqueInputFieldNamesRule.d.ts +2 -2
- package/validation/rules/UniqueInputFieldNamesRule.js +4 -4
- package/validation/rules/UniqueInputFieldNamesRule.js.map +1 -1
- package/validation/rules/UniqueInputFieldNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueOperationNamesRule.d.mts +2 -2
- package/validation/rules/UniqueOperationNamesRule.d.ts +2 -2
- package/validation/rules/UniqueOperationNamesRule.js +2 -2
- package/validation/rules/UniqueOperationNamesRule.js.map +1 -1
- package/validation/rules/UniqueOperationNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueOperationTypesRule.d.mts +2 -2
- package/validation/rules/UniqueOperationTypesRule.d.ts +2 -2
- package/validation/rules/UniqueOperationTypesRule.js +3 -3
- package/validation/rules/UniqueOperationTypesRule.js.map +1 -1
- package/validation/rules/UniqueOperationTypesRule.mjs.map +1 -1
- package/validation/rules/UniqueTypeNamesRule.d.mts +2 -2
- package/validation/rules/UniqueTypeNamesRule.d.ts +2 -2
- package/validation/rules/UniqueTypeNamesRule.js +3 -3
- package/validation/rules/UniqueTypeNamesRule.js.map +1 -1
- package/validation/rules/UniqueTypeNamesRule.mjs.map +1 -1
- package/validation/rules/UniqueVariableNamesRule.d.mts +2 -2
- package/validation/rules/UniqueVariableNamesRule.d.ts +2 -2
- package/validation/rules/UniqueVariableNamesRule.js +4 -4
- package/validation/rules/UniqueVariableNamesRule.js.map +1 -1
- package/validation/rules/UniqueVariableNamesRule.mjs.map +1 -1
- package/validation/rules/ValuesOfCorrectTypeRule.d.mts +2 -2
- package/validation/rules/ValuesOfCorrectTypeRule.d.ts +2 -2
- package/validation/rules/ValuesOfCorrectTypeRule.js +2 -2
- package/validation/rules/ValuesOfCorrectTypeRule.js.map +1 -1
- package/validation/rules/ValuesOfCorrectTypeRule.mjs.map +1 -1
- package/validation/rules/VariablesAreInputTypesRule.d.mts +2 -2
- package/validation/rules/VariablesAreInputTypesRule.d.ts +2 -2
- package/validation/rules/VariablesAreInputTypesRule.js +8 -8
- package/validation/rules/VariablesAreInputTypesRule.js.map +1 -1
- package/validation/rules/VariablesAreInputTypesRule.mjs.map +1 -1
- package/validation/rules/VariablesInAllowedPositionRule.d.mts +2 -2
- package/validation/rules/VariablesInAllowedPositionRule.d.ts +2 -2
- package/validation/rules/VariablesInAllowedPositionRule.js +14 -14
- package/validation/rules/VariablesInAllowedPositionRule.js.map +1 -1
- package/validation/rules/VariablesInAllowedPositionRule.mjs.map +1 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.d.mts +2 -2
- package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +2 -2
- package/validation/rules/custom/NoDeprecatedCustomRule.js +8 -8
- package/validation/rules/custom/NoDeprecatedCustomRule.js.map +1 -1
- package/validation/rules/custom/NoDeprecatedCustomRule.mjs.map +1 -1
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.mts +2 -2
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +2 -2
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +6 -6
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.map +1 -1
- package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs.map +1 -1
- package/validation/specifiedRules.d.mts +1 -1
- package/validation/specifiedRules.d.ts +1 -1
- package/validation/specifiedRules.js +87 -87
- package/validation/specifiedRules.js.map +1 -1
- package/validation/specifiedRules.mjs.map +1 -1
- package/validation/validate.d.mts +5 -5
- package/validation/validate.d.ts +5 -5
- package/validation/validate.js +19 -19
- package/validation/validate.js.map +1 -1
- package/validation/validate.mjs.map +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
- package/version.mjs +2 -2
- package/version.mjs.map +1 -1
package/language/parser.js
CHANGED
|
@@ -6,14 +6,14 @@ exports.parseValue = parseValue;
|
|
|
6
6
|
exports.parseConstValue = parseConstValue;
|
|
7
7
|
exports.parseType = parseType;
|
|
8
8
|
exports.parseSchemaCoordinate = parseSchemaCoordinate;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
9
|
+
const syntaxError_ts_1 = require("../error/syntaxError.js");
|
|
10
|
+
const ast_ts_1 = require("./ast.js");
|
|
11
|
+
const directiveLocation_ts_1 = require("./directiveLocation.js");
|
|
12
|
+
const kinds_ts_1 = require("./kinds.js");
|
|
13
|
+
const lexer_ts_1 = require("./lexer.js");
|
|
14
|
+
const schemaCoordinateLexer_ts_1 = require("./schemaCoordinateLexer.js");
|
|
15
|
+
const source_ts_1 = require("./source.js");
|
|
16
|
+
const tokenKind_ts_1 = require("./tokenKind.js");
|
|
17
17
|
/**
|
|
18
18
|
* Given a GraphQL source, parses it into a Document.
|
|
19
19
|
* Throws GraphQLError if a syntax error is encountered.
|
|
@@ -37,9 +37,9 @@ function parse(source, options) {
|
|
|
37
37
|
*/
|
|
38
38
|
function parseValue(source, options) {
|
|
39
39
|
const parser = new Parser(source, options);
|
|
40
|
-
parser.expectToken(
|
|
40
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.SOF);
|
|
41
41
|
const value = parser.parseValueLiteral(false);
|
|
42
|
-
parser.expectToken(
|
|
42
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.EOF);
|
|
43
43
|
return value;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -48,9 +48,9 @@ function parseValue(source, options) {
|
|
|
48
48
|
*/
|
|
49
49
|
function parseConstValue(source, options) {
|
|
50
50
|
const parser = new Parser(source, options);
|
|
51
|
-
parser.expectToken(
|
|
51
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.SOF);
|
|
52
52
|
const value = parser.parseConstValueLiteral();
|
|
53
|
-
parser.expectToken(
|
|
53
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.EOF);
|
|
54
54
|
return value;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -65,9 +65,9 @@ function parseConstValue(source, options) {
|
|
|
65
65
|
*/
|
|
66
66
|
function parseType(source, options) {
|
|
67
67
|
const parser = new Parser(source, options);
|
|
68
|
-
parser.expectToken(
|
|
68
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.SOF);
|
|
69
69
|
const type = parser.parseTypeReference();
|
|
70
|
-
parser.expectToken(
|
|
70
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.EOF);
|
|
71
71
|
return type;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
@@ -80,12 +80,12 @@ function parseType(source, options) {
|
|
|
80
80
|
* with an unparsed source.
|
|
81
81
|
*/
|
|
82
82
|
function parseSchemaCoordinate(source) {
|
|
83
|
-
const sourceObj = (0,
|
|
84
|
-
const lexer = new
|
|
83
|
+
const sourceObj = (0, source_ts_1.isSource)(source) ? source : new source_ts_1.Source(source);
|
|
84
|
+
const lexer = new schemaCoordinateLexer_ts_1.SchemaCoordinateLexer(sourceObj);
|
|
85
85
|
const parser = new Parser(source, { lexer });
|
|
86
|
-
parser.expectToken(
|
|
86
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.SOF);
|
|
87
87
|
const coordinate = parser.parseSchemaCoordinate();
|
|
88
|
-
parser.expectToken(
|
|
88
|
+
parser.expectToken(tokenKind_ts_1.TokenKind.EOF);
|
|
89
89
|
return coordinate;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -106,8 +106,8 @@ class Parser {
|
|
|
106
106
|
this._lexer = lexer;
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
const sourceObj = (0,
|
|
110
|
-
this._lexer = new
|
|
109
|
+
const sourceObj = (0, source_ts_1.isSource)(source) ? source : new source_ts_1.Source(source);
|
|
110
|
+
this._lexer = new lexer_ts_1.Lexer(sourceObj);
|
|
111
111
|
}
|
|
112
112
|
this._options = _options;
|
|
113
113
|
this._tokenCounter = 0;
|
|
@@ -119,9 +119,9 @@ class Parser {
|
|
|
119
119
|
* Converts a name lex token into a name parse node.
|
|
120
120
|
*/
|
|
121
121
|
parseName() {
|
|
122
|
-
const token = this.expectToken(
|
|
122
|
+
const token = this.expectToken(tokenKind_ts_1.TokenKind.NAME);
|
|
123
123
|
return this.node(token, {
|
|
124
|
-
kind:
|
|
124
|
+
kind: kinds_ts_1.Kind.NAME,
|
|
125
125
|
value: token.value,
|
|
126
126
|
});
|
|
127
127
|
}
|
|
@@ -131,8 +131,8 @@ class Parser {
|
|
|
131
131
|
*/
|
|
132
132
|
parseDocument() {
|
|
133
133
|
return this.node(this._lexer.token, {
|
|
134
|
-
kind:
|
|
135
|
-
definitions: this.many(
|
|
134
|
+
kind: kinds_ts_1.Kind.DOCUMENT,
|
|
135
|
+
definitions: this.many(tokenKind_ts_1.TokenKind.SOF, this.parseDefinition, tokenKind_ts_1.TokenKind.EOF),
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
@@ -159,7 +159,7 @@ class Parser {
|
|
|
159
159
|
* - InputObjectTypeDefinition
|
|
160
160
|
*/
|
|
161
161
|
parseDefinition() {
|
|
162
|
-
if (this.peek(
|
|
162
|
+
if (this.peek(tokenKind_ts_1.TokenKind.BRACE_L)) {
|
|
163
163
|
return this.parseOperationDefinition();
|
|
164
164
|
}
|
|
165
165
|
// Many definitions begin with a description and require a lookahead.
|
|
@@ -167,10 +167,10 @@ class Parser {
|
|
|
167
167
|
const keywordToken = hasDescription
|
|
168
168
|
? this._lexer.lookahead()
|
|
169
169
|
: this._lexer.token;
|
|
170
|
-
if (hasDescription && keywordToken.kind ===
|
|
171
|
-
throw (0,
|
|
170
|
+
if (hasDescription && keywordToken.kind === tokenKind_ts_1.TokenKind.BRACE_L) {
|
|
171
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, this._lexer.token.start, 'Unexpected description, descriptions are not supported on shorthand queries.');
|
|
172
172
|
}
|
|
173
|
-
if (keywordToken.kind ===
|
|
173
|
+
if (keywordToken.kind === tokenKind_ts_1.TokenKind.NAME) {
|
|
174
174
|
switch (keywordToken.value) {
|
|
175
175
|
case 'schema':
|
|
176
176
|
return this.parseSchemaDefinition();
|
|
@@ -198,7 +198,7 @@ class Parser {
|
|
|
198
198
|
return this.parseFragmentDefinition();
|
|
199
199
|
}
|
|
200
200
|
if (hasDescription) {
|
|
201
|
-
throw (0,
|
|
201
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, this._lexer.token.start, 'Unexpected description, only GraphQL definitions support descriptions.');
|
|
202
202
|
}
|
|
203
203
|
switch (keywordToken.value) {
|
|
204
204
|
case 'extend':
|
|
@@ -215,10 +215,10 @@ class Parser {
|
|
|
215
215
|
*/
|
|
216
216
|
parseOperationDefinition() {
|
|
217
217
|
const start = this._lexer.token;
|
|
218
|
-
if (this.peek(
|
|
218
|
+
if (this.peek(tokenKind_ts_1.TokenKind.BRACE_L)) {
|
|
219
219
|
return this.node(start, {
|
|
220
|
-
kind:
|
|
221
|
-
operation:
|
|
220
|
+
kind: kinds_ts_1.Kind.OPERATION_DEFINITION,
|
|
221
|
+
operation: ast_ts_1.OperationTypeNode.QUERY,
|
|
222
222
|
description: undefined,
|
|
223
223
|
name: undefined,
|
|
224
224
|
variableDefinitions: undefined,
|
|
@@ -229,11 +229,11 @@ class Parser {
|
|
|
229
229
|
const description = this.parseDescription();
|
|
230
230
|
const operation = this.parseOperationType();
|
|
231
231
|
let name;
|
|
232
|
-
if (this.peek(
|
|
232
|
+
if (this.peek(tokenKind_ts_1.TokenKind.NAME)) {
|
|
233
233
|
name = this.parseName();
|
|
234
234
|
}
|
|
235
235
|
return this.node(start, {
|
|
236
|
-
kind:
|
|
236
|
+
kind: kinds_ts_1.Kind.OPERATION_DEFINITION,
|
|
237
237
|
operation,
|
|
238
238
|
description,
|
|
239
239
|
name,
|
|
@@ -246,14 +246,14 @@ class Parser {
|
|
|
246
246
|
* OperationType : one of query mutation subscription
|
|
247
247
|
*/
|
|
248
248
|
parseOperationType() {
|
|
249
|
-
const operationToken = this.expectToken(
|
|
249
|
+
const operationToken = this.expectToken(tokenKind_ts_1.TokenKind.NAME);
|
|
250
250
|
switch (operationToken.value) {
|
|
251
251
|
case 'query':
|
|
252
|
-
return
|
|
252
|
+
return ast_ts_1.OperationTypeNode.QUERY;
|
|
253
253
|
case 'mutation':
|
|
254
|
-
return
|
|
254
|
+
return ast_ts_1.OperationTypeNode.MUTATION;
|
|
255
255
|
case 'subscription':
|
|
256
|
-
return
|
|
256
|
+
return ast_ts_1.OperationTypeNode.SUBSCRIPTION;
|
|
257
257
|
}
|
|
258
258
|
throw this.unexpected(operationToken);
|
|
259
259
|
}
|
|
@@ -261,18 +261,18 @@ class Parser {
|
|
|
261
261
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
262
262
|
*/
|
|
263
263
|
parseVariableDefinitions() {
|
|
264
|
-
return this.optionalMany(
|
|
264
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.PAREN_L, this.parseVariableDefinition, tokenKind_ts_1.TokenKind.PAREN_R);
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
|
|
268
268
|
*/
|
|
269
269
|
parseVariableDefinition() {
|
|
270
270
|
return this.node(this._lexer.token, {
|
|
271
|
-
kind:
|
|
271
|
+
kind: kinds_ts_1.Kind.VARIABLE_DEFINITION,
|
|
272
272
|
description: this.parseDescription(),
|
|
273
273
|
variable: this.parseVariable(),
|
|
274
|
-
type: (this.expectToken(
|
|
275
|
-
defaultValue: this.expectOptionalToken(
|
|
274
|
+
type: (this.expectToken(tokenKind_ts_1.TokenKind.COLON), this.parseTypeReference()),
|
|
275
|
+
defaultValue: this.expectOptionalToken(tokenKind_ts_1.TokenKind.EQUALS)
|
|
276
276
|
? this.parseConstValueLiteral()
|
|
277
277
|
: undefined,
|
|
278
278
|
directives: this.parseConstDirectives(),
|
|
@@ -283,9 +283,9 @@ class Parser {
|
|
|
283
283
|
*/
|
|
284
284
|
parseVariable() {
|
|
285
285
|
const start = this._lexer.token;
|
|
286
|
-
this.expectToken(
|
|
286
|
+
this.expectToken(tokenKind_ts_1.TokenKind.DOLLAR);
|
|
287
287
|
return this.node(start, {
|
|
288
|
-
kind:
|
|
288
|
+
kind: kinds_ts_1.Kind.VARIABLE,
|
|
289
289
|
name: this.parseName(),
|
|
290
290
|
});
|
|
291
291
|
}
|
|
@@ -296,8 +296,8 @@ class Parser {
|
|
|
296
296
|
*/
|
|
297
297
|
parseSelectionSet() {
|
|
298
298
|
return this.node(this._lexer.token, {
|
|
299
|
-
kind:
|
|
300
|
-
selections: this.many(
|
|
299
|
+
kind: kinds_ts_1.Kind.SELECTION_SET,
|
|
300
|
+
selections: this.many(tokenKind_ts_1.TokenKind.BRACE_L, this.parseSelection, tokenKind_ts_1.TokenKind.BRACE_R),
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
/**
|
|
@@ -307,7 +307,7 @@ class Parser {
|
|
|
307
307
|
* - InlineFragment
|
|
308
308
|
*/
|
|
309
309
|
parseSelection() {
|
|
310
|
-
return this.peek(
|
|
310
|
+
return this.peek(tokenKind_ts_1.TokenKind.SPREAD)
|
|
311
311
|
? this.parseFragment()
|
|
312
312
|
: this.parseField();
|
|
313
313
|
}
|
|
@@ -321,7 +321,7 @@ class Parser {
|
|
|
321
321
|
const nameOrAlias = this.parseName();
|
|
322
322
|
let alias;
|
|
323
323
|
let name;
|
|
324
|
-
if (this.expectOptionalToken(
|
|
324
|
+
if (this.expectOptionalToken(tokenKind_ts_1.TokenKind.COLON)) {
|
|
325
325
|
alias = nameOrAlias;
|
|
326
326
|
name = this.parseName();
|
|
327
327
|
}
|
|
@@ -329,31 +329,31 @@ class Parser {
|
|
|
329
329
|
name = nameOrAlias;
|
|
330
330
|
}
|
|
331
331
|
return this.node(start, {
|
|
332
|
-
kind:
|
|
332
|
+
kind: kinds_ts_1.Kind.FIELD,
|
|
333
333
|
alias,
|
|
334
334
|
name,
|
|
335
335
|
arguments: this.parseArguments(false),
|
|
336
336
|
directives: this.parseDirectives(false),
|
|
337
|
-
selectionSet: this.peek(
|
|
337
|
+
selectionSet: this.peek(tokenKind_ts_1.TokenKind.BRACE_L)
|
|
338
338
|
? this.parseSelectionSet()
|
|
339
339
|
: undefined,
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
parseArguments(isConst) {
|
|
343
343
|
const item = isConst ? this.parseConstArgument : this.parseArgument;
|
|
344
|
-
return this.optionalMany(
|
|
344
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.PAREN_L, item, tokenKind_ts_1.TokenKind.PAREN_R);
|
|
345
345
|
}
|
|
346
346
|
/* experimental */
|
|
347
347
|
parseFragmentArguments() {
|
|
348
348
|
const item = this.parseFragmentArgument;
|
|
349
|
-
return this.optionalMany(
|
|
349
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.PAREN_L, item, tokenKind_ts_1.TokenKind.PAREN_R);
|
|
350
350
|
}
|
|
351
351
|
parseArgument(isConst = false) {
|
|
352
352
|
const start = this._lexer.token;
|
|
353
353
|
const name = this.parseName();
|
|
354
|
-
this.expectToken(
|
|
354
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
355
355
|
return this.node(start, {
|
|
356
|
-
kind:
|
|
356
|
+
kind: kinds_ts_1.Kind.ARGUMENT,
|
|
357
357
|
name,
|
|
358
358
|
value: this.parseValueLiteral(isConst),
|
|
359
359
|
});
|
|
@@ -365,9 +365,9 @@ class Parser {
|
|
|
365
365
|
parseFragmentArgument() {
|
|
366
366
|
const start = this._lexer.token;
|
|
367
367
|
const name = this.parseName();
|
|
368
|
-
this.expectToken(
|
|
368
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
369
369
|
return this.node(start, {
|
|
370
|
-
kind:
|
|
370
|
+
kind: kinds_ts_1.Kind.FRAGMENT_ARGUMENT,
|
|
371
371
|
name,
|
|
372
372
|
value: this.parseValueLiteral(false),
|
|
373
373
|
});
|
|
@@ -382,27 +382,27 @@ class Parser {
|
|
|
382
382
|
*/
|
|
383
383
|
parseFragment() {
|
|
384
384
|
const start = this._lexer.token;
|
|
385
|
-
this.expectToken(
|
|
385
|
+
this.expectToken(tokenKind_ts_1.TokenKind.SPREAD);
|
|
386
386
|
const hasTypeCondition = this.expectOptionalKeyword('on');
|
|
387
|
-
if (!hasTypeCondition && this.peek(
|
|
387
|
+
if (!hasTypeCondition && this.peek(tokenKind_ts_1.TokenKind.NAME)) {
|
|
388
388
|
const name = this.parseFragmentName();
|
|
389
|
-
if (this.peek(
|
|
389
|
+
if (this.peek(tokenKind_ts_1.TokenKind.PAREN_L) &&
|
|
390
390
|
this._options.experimentalFragmentArguments) {
|
|
391
391
|
return this.node(start, {
|
|
392
|
-
kind:
|
|
392
|
+
kind: kinds_ts_1.Kind.FRAGMENT_SPREAD,
|
|
393
393
|
name,
|
|
394
394
|
arguments: this.parseFragmentArguments(),
|
|
395
395
|
directives: this.parseDirectives(false),
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
return this.node(start, {
|
|
399
|
-
kind:
|
|
399
|
+
kind: kinds_ts_1.Kind.FRAGMENT_SPREAD,
|
|
400
400
|
name,
|
|
401
401
|
directives: this.parseDirectives(false),
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
return this.node(start, {
|
|
405
|
-
kind:
|
|
405
|
+
kind: kinds_ts_1.Kind.INLINE_FRAGMENT,
|
|
406
406
|
typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,
|
|
407
407
|
directives: this.parseDirectives(false),
|
|
408
408
|
selectionSet: this.parseSelectionSet(),
|
|
@@ -420,7 +420,7 @@ class Parser {
|
|
|
420
420
|
this.expectKeyword('fragment');
|
|
421
421
|
if (this._options.experimentalFragmentArguments === true) {
|
|
422
422
|
return this.node(start, {
|
|
423
|
-
kind:
|
|
423
|
+
kind: kinds_ts_1.Kind.FRAGMENT_DEFINITION,
|
|
424
424
|
description,
|
|
425
425
|
name: this.parseFragmentName(),
|
|
426
426
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
@@ -430,7 +430,7 @@ class Parser {
|
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
return this.node(start, {
|
|
433
|
-
kind:
|
|
433
|
+
kind: kinds_ts_1.Kind.FRAGMENT_DEFINITION,
|
|
434
434
|
description,
|
|
435
435
|
name: this.parseFragmentName(),
|
|
436
436
|
typeCondition: (this.expectKeyword('on'), this.parseNamedType()),
|
|
@@ -450,52 +450,52 @@ class Parser {
|
|
|
450
450
|
parseValueLiteral(isConst) {
|
|
451
451
|
const token = this._lexer.token;
|
|
452
452
|
switch (token.kind) {
|
|
453
|
-
case
|
|
453
|
+
case tokenKind_ts_1.TokenKind.BRACKET_L:
|
|
454
454
|
return this.parseList(isConst);
|
|
455
|
-
case
|
|
455
|
+
case tokenKind_ts_1.TokenKind.BRACE_L:
|
|
456
456
|
return this.parseObject(isConst);
|
|
457
|
-
case
|
|
457
|
+
case tokenKind_ts_1.TokenKind.INT:
|
|
458
458
|
this.advanceLexer();
|
|
459
459
|
return this.node(token, {
|
|
460
|
-
kind:
|
|
460
|
+
kind: kinds_ts_1.Kind.INT,
|
|
461
461
|
value: token.value,
|
|
462
462
|
});
|
|
463
|
-
case
|
|
463
|
+
case tokenKind_ts_1.TokenKind.FLOAT:
|
|
464
464
|
this.advanceLexer();
|
|
465
465
|
return this.node(token, {
|
|
466
|
-
kind:
|
|
466
|
+
kind: kinds_ts_1.Kind.FLOAT,
|
|
467
467
|
value: token.value,
|
|
468
468
|
});
|
|
469
|
-
case
|
|
470
|
-
case
|
|
469
|
+
case tokenKind_ts_1.TokenKind.STRING:
|
|
470
|
+
case tokenKind_ts_1.TokenKind.BLOCK_STRING:
|
|
471
471
|
return this.parseStringLiteral();
|
|
472
|
-
case
|
|
472
|
+
case tokenKind_ts_1.TokenKind.NAME:
|
|
473
473
|
this.advanceLexer();
|
|
474
474
|
switch (token.value) {
|
|
475
475
|
case 'true':
|
|
476
476
|
return this.node(token, {
|
|
477
|
-
kind:
|
|
477
|
+
kind: kinds_ts_1.Kind.BOOLEAN,
|
|
478
478
|
value: true,
|
|
479
479
|
});
|
|
480
480
|
case 'false':
|
|
481
481
|
return this.node(token, {
|
|
482
|
-
kind:
|
|
482
|
+
kind: kinds_ts_1.Kind.BOOLEAN,
|
|
483
483
|
value: false,
|
|
484
484
|
});
|
|
485
485
|
case 'null':
|
|
486
|
-
return this.node(token, { kind:
|
|
486
|
+
return this.node(token, { kind: kinds_ts_1.Kind.NULL });
|
|
487
487
|
default:
|
|
488
488
|
return this.node(token, {
|
|
489
|
-
kind:
|
|
489
|
+
kind: kinds_ts_1.Kind.ENUM,
|
|
490
490
|
value: token.value,
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
case
|
|
493
|
+
case tokenKind_ts_1.TokenKind.DOLLAR:
|
|
494
494
|
if (isConst) {
|
|
495
|
-
this.expectToken(
|
|
496
|
-
if (this._lexer.token.kind ===
|
|
495
|
+
this.expectToken(tokenKind_ts_1.TokenKind.DOLLAR);
|
|
496
|
+
if (this._lexer.token.kind === tokenKind_ts_1.TokenKind.NAME) {
|
|
497
497
|
const varName = this._lexer.token.value;
|
|
498
|
-
throw (0,
|
|
498
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, token.start, `Unexpected variable "$${varName}" in constant value.`);
|
|
499
499
|
}
|
|
500
500
|
else {
|
|
501
501
|
throw this.unexpected(token);
|
|
@@ -513,38 +513,38 @@ class Parser {
|
|
|
513
513
|
const token = this._lexer.token;
|
|
514
514
|
this.advanceLexer();
|
|
515
515
|
return this.node(token, {
|
|
516
|
-
kind:
|
|
516
|
+
kind: kinds_ts_1.Kind.STRING,
|
|
517
517
|
value: token.value,
|
|
518
|
-
block: token.kind ===
|
|
518
|
+
block: token.kind === tokenKind_ts_1.TokenKind.BLOCK_STRING,
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
parseList(isConst) {
|
|
522
522
|
const item = () => this.parseValueLiteral(isConst);
|
|
523
523
|
return this.node(this._lexer.token, {
|
|
524
|
-
kind:
|
|
525
|
-
values: this.any(
|
|
524
|
+
kind: kinds_ts_1.Kind.LIST,
|
|
525
|
+
values: this.any(tokenKind_ts_1.TokenKind.BRACKET_L, item, tokenKind_ts_1.TokenKind.BRACKET_R),
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
parseObject(isConst) {
|
|
529
529
|
const item = () => this.parseObjectField(isConst);
|
|
530
530
|
return this.node(this._lexer.token, {
|
|
531
|
-
kind:
|
|
532
|
-
fields: this.any(
|
|
531
|
+
kind: kinds_ts_1.Kind.OBJECT,
|
|
532
|
+
fields: this.any(tokenKind_ts_1.TokenKind.BRACE_L, item, tokenKind_ts_1.TokenKind.BRACE_R),
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
535
|
parseObjectField(isConst) {
|
|
536
536
|
const start = this._lexer.token;
|
|
537
537
|
const name = this.parseName();
|
|
538
|
-
this.expectToken(
|
|
538
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
539
539
|
return this.node(start, {
|
|
540
|
-
kind:
|
|
540
|
+
kind: kinds_ts_1.Kind.OBJECT_FIELD,
|
|
541
541
|
name,
|
|
542
542
|
value: this.parseValueLiteral(isConst),
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
545
|
parseDirectives(isConst) {
|
|
546
546
|
const directives = [];
|
|
547
|
-
while (this.peek(
|
|
547
|
+
while (this.peek(tokenKind_ts_1.TokenKind.AT)) {
|
|
548
548
|
directives.push(this.parseDirective(isConst));
|
|
549
549
|
}
|
|
550
550
|
if (directives.length) {
|
|
@@ -557,9 +557,9 @@ class Parser {
|
|
|
557
557
|
}
|
|
558
558
|
parseDirective(isConst) {
|
|
559
559
|
const start = this._lexer.token;
|
|
560
|
-
this.expectToken(
|
|
560
|
+
this.expectToken(tokenKind_ts_1.TokenKind.AT);
|
|
561
561
|
return this.node(start, {
|
|
562
|
-
kind:
|
|
562
|
+
kind: kinds_ts_1.Kind.DIRECTIVE,
|
|
563
563
|
name: this.parseName(),
|
|
564
564
|
arguments: this.parseArguments(isConst),
|
|
565
565
|
});
|
|
@@ -574,20 +574,20 @@ class Parser {
|
|
|
574
574
|
parseTypeReference() {
|
|
575
575
|
const start = this._lexer.token;
|
|
576
576
|
let type;
|
|
577
|
-
if (this.expectOptionalToken(
|
|
577
|
+
if (this.expectOptionalToken(tokenKind_ts_1.TokenKind.BRACKET_L)) {
|
|
578
578
|
const innerType = this.parseTypeReference();
|
|
579
|
-
this.expectToken(
|
|
579
|
+
this.expectToken(tokenKind_ts_1.TokenKind.BRACKET_R);
|
|
580
580
|
type = this.node(start, {
|
|
581
|
-
kind:
|
|
581
|
+
kind: kinds_ts_1.Kind.LIST_TYPE,
|
|
582
582
|
type: innerType,
|
|
583
583
|
});
|
|
584
584
|
}
|
|
585
585
|
else {
|
|
586
586
|
type = this.parseNamedType();
|
|
587
587
|
}
|
|
588
|
-
if (this.expectOptionalToken(
|
|
588
|
+
if (this.expectOptionalToken(tokenKind_ts_1.TokenKind.BANG)) {
|
|
589
589
|
return this.node(start, {
|
|
590
|
-
kind:
|
|
590
|
+
kind: kinds_ts_1.Kind.NON_NULL_TYPE,
|
|
591
591
|
type,
|
|
592
592
|
});
|
|
593
593
|
}
|
|
@@ -598,13 +598,13 @@ class Parser {
|
|
|
598
598
|
*/
|
|
599
599
|
parseNamedType() {
|
|
600
600
|
return this.node(this._lexer.token, {
|
|
601
|
-
kind:
|
|
601
|
+
kind: kinds_ts_1.Kind.NAMED_TYPE,
|
|
602
602
|
name: this.parseName(),
|
|
603
603
|
});
|
|
604
604
|
}
|
|
605
605
|
// Implements the parsing rules in the Type Definition section.
|
|
606
606
|
peekDescription() {
|
|
607
|
-
return this.peek(
|
|
607
|
+
return this.peek(tokenKind_ts_1.TokenKind.STRING) || this.peek(tokenKind_ts_1.TokenKind.BLOCK_STRING);
|
|
608
608
|
}
|
|
609
609
|
/**
|
|
610
610
|
* Description : StringValue
|
|
@@ -624,9 +624,9 @@ class Parser {
|
|
|
624
624
|
const description = this.parseDescription();
|
|
625
625
|
this.expectKeyword('schema');
|
|
626
626
|
const directives = this.parseConstDirectives();
|
|
627
|
-
const operationTypes = this.many(
|
|
627
|
+
const operationTypes = this.many(tokenKind_ts_1.TokenKind.BRACE_L, this.parseOperationTypeDefinition, tokenKind_ts_1.TokenKind.BRACE_R);
|
|
628
628
|
return this.node(start, {
|
|
629
|
-
kind:
|
|
629
|
+
kind: kinds_ts_1.Kind.SCHEMA_DEFINITION,
|
|
630
630
|
description,
|
|
631
631
|
directives,
|
|
632
632
|
operationTypes,
|
|
@@ -638,10 +638,10 @@ class Parser {
|
|
|
638
638
|
parseOperationTypeDefinition() {
|
|
639
639
|
const start = this._lexer.token;
|
|
640
640
|
const operation = this.parseOperationType();
|
|
641
|
-
this.expectToken(
|
|
641
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
642
642
|
const type = this.parseNamedType();
|
|
643
643
|
return this.node(start, {
|
|
644
|
-
kind:
|
|
644
|
+
kind: kinds_ts_1.Kind.OPERATION_TYPE_DEFINITION,
|
|
645
645
|
operation,
|
|
646
646
|
type,
|
|
647
647
|
});
|
|
@@ -656,7 +656,7 @@ class Parser {
|
|
|
656
656
|
const name = this.parseName();
|
|
657
657
|
const directives = this.parseConstDirectives();
|
|
658
658
|
return this.node(start, {
|
|
659
|
-
kind:
|
|
659
|
+
kind: kinds_ts_1.Kind.SCALAR_TYPE_DEFINITION,
|
|
660
660
|
description,
|
|
661
661
|
name,
|
|
662
662
|
directives,
|
|
@@ -676,7 +676,7 @@ class Parser {
|
|
|
676
676
|
const directives = this.parseConstDirectives();
|
|
677
677
|
const fields = this.parseFieldsDefinition();
|
|
678
678
|
return this.node(start, {
|
|
679
|
-
kind:
|
|
679
|
+
kind: kinds_ts_1.Kind.OBJECT_TYPE_DEFINITION,
|
|
680
680
|
description,
|
|
681
681
|
name,
|
|
682
682
|
interfaces,
|
|
@@ -691,7 +691,7 @@ class Parser {
|
|
|
691
691
|
*/
|
|
692
692
|
parseImplementsInterfaces() {
|
|
693
693
|
return this.expectOptionalKeyword('implements')
|
|
694
|
-
? this.delimitedMany(
|
|
694
|
+
? this.delimitedMany(tokenKind_ts_1.TokenKind.AMP, this.parseNamedType)
|
|
695
695
|
: undefined;
|
|
696
696
|
}
|
|
697
697
|
/**
|
|
@@ -700,7 +700,7 @@ class Parser {
|
|
|
700
700
|
* ```
|
|
701
701
|
*/
|
|
702
702
|
parseFieldsDefinition() {
|
|
703
|
-
return this.optionalMany(
|
|
703
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.BRACE_L, this.parseFieldDefinition, tokenKind_ts_1.TokenKind.BRACE_R);
|
|
704
704
|
}
|
|
705
705
|
/**
|
|
706
706
|
* FieldDefinition :
|
|
@@ -711,11 +711,11 @@ class Parser {
|
|
|
711
711
|
const description = this.parseDescription();
|
|
712
712
|
const name = this.parseName();
|
|
713
713
|
const args = this.parseArgumentDefs();
|
|
714
|
-
this.expectToken(
|
|
714
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
715
715
|
const type = this.parseTypeReference();
|
|
716
716
|
const directives = this.parseConstDirectives();
|
|
717
717
|
return this.node(start, {
|
|
718
|
-
kind:
|
|
718
|
+
kind: kinds_ts_1.Kind.FIELD_DEFINITION,
|
|
719
719
|
description,
|
|
720
720
|
name,
|
|
721
721
|
arguments: args,
|
|
@@ -727,7 +727,7 @@ class Parser {
|
|
|
727
727
|
* ArgumentsDefinition : ( InputValueDefinition+ )
|
|
728
728
|
*/
|
|
729
729
|
parseArgumentDefs() {
|
|
730
|
-
return this.optionalMany(
|
|
730
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.PAREN_L, this.parseInputValueDef, tokenKind_ts_1.TokenKind.PAREN_R);
|
|
731
731
|
}
|
|
732
732
|
/**
|
|
733
733
|
* InputValueDefinition :
|
|
@@ -737,15 +737,15 @@ class Parser {
|
|
|
737
737
|
const start = this._lexer.token;
|
|
738
738
|
const description = this.parseDescription();
|
|
739
739
|
const name = this.parseName();
|
|
740
|
-
this.expectToken(
|
|
740
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
741
741
|
const type = this.parseTypeReference();
|
|
742
742
|
let defaultValue;
|
|
743
|
-
if (this.expectOptionalToken(
|
|
743
|
+
if (this.expectOptionalToken(tokenKind_ts_1.TokenKind.EQUALS)) {
|
|
744
744
|
defaultValue = this.parseConstValueLiteral();
|
|
745
745
|
}
|
|
746
746
|
const directives = this.parseConstDirectives();
|
|
747
747
|
return this.node(start, {
|
|
748
|
-
kind:
|
|
748
|
+
kind: kinds_ts_1.Kind.INPUT_VALUE_DEFINITION,
|
|
749
749
|
description,
|
|
750
750
|
name,
|
|
751
751
|
type,
|
|
@@ -766,7 +766,7 @@ class Parser {
|
|
|
766
766
|
const directives = this.parseConstDirectives();
|
|
767
767
|
const fields = this.parseFieldsDefinition();
|
|
768
768
|
return this.node(start, {
|
|
769
|
-
kind:
|
|
769
|
+
kind: kinds_ts_1.Kind.INTERFACE_TYPE_DEFINITION,
|
|
770
770
|
description,
|
|
771
771
|
name,
|
|
772
772
|
interfaces,
|
|
@@ -786,7 +786,7 @@ class Parser {
|
|
|
786
786
|
const directives = this.parseConstDirectives();
|
|
787
787
|
const types = this.parseUnionMemberTypes();
|
|
788
788
|
return this.node(start, {
|
|
789
|
-
kind:
|
|
789
|
+
kind: kinds_ts_1.Kind.UNION_TYPE_DEFINITION,
|
|
790
790
|
description,
|
|
791
791
|
name,
|
|
792
792
|
directives,
|
|
@@ -799,8 +799,8 @@ class Parser {
|
|
|
799
799
|
* - UnionMemberTypes | NamedType
|
|
800
800
|
*/
|
|
801
801
|
parseUnionMemberTypes() {
|
|
802
|
-
return this.expectOptionalToken(
|
|
803
|
-
? this.delimitedMany(
|
|
802
|
+
return this.expectOptionalToken(tokenKind_ts_1.TokenKind.EQUALS)
|
|
803
|
+
? this.delimitedMany(tokenKind_ts_1.TokenKind.PIPE, this.parseNamedType)
|
|
804
804
|
: undefined;
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
@@ -815,7 +815,7 @@ class Parser {
|
|
|
815
815
|
const directives = this.parseConstDirectives();
|
|
816
816
|
const values = this.parseEnumValuesDefinition();
|
|
817
817
|
return this.node(start, {
|
|
818
|
-
kind:
|
|
818
|
+
kind: kinds_ts_1.Kind.ENUM_TYPE_DEFINITION,
|
|
819
819
|
description,
|
|
820
820
|
name,
|
|
821
821
|
directives,
|
|
@@ -828,7 +828,7 @@ class Parser {
|
|
|
828
828
|
* ```
|
|
829
829
|
*/
|
|
830
830
|
parseEnumValuesDefinition() {
|
|
831
|
-
return this.optionalMany(
|
|
831
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.BRACE_L, this.parseEnumValueDefinition, tokenKind_ts_1.TokenKind.BRACE_R);
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
834
834
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
@@ -839,7 +839,7 @@ class Parser {
|
|
|
839
839
|
const name = this.parseEnumValueName();
|
|
840
840
|
const directives = this.parseConstDirectives();
|
|
841
841
|
return this.node(start, {
|
|
842
|
-
kind:
|
|
842
|
+
kind: kinds_ts_1.Kind.ENUM_VALUE_DEFINITION,
|
|
843
843
|
description,
|
|
844
844
|
name,
|
|
845
845
|
directives,
|
|
@@ -852,7 +852,7 @@ class Parser {
|
|
|
852
852
|
if (this._lexer.token.value === 'true' ||
|
|
853
853
|
this._lexer.token.value === 'false' ||
|
|
854
854
|
this._lexer.token.value === 'null') {
|
|
855
|
-
throw (0,
|
|
855
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, this._lexer.token.start, `${getTokenDesc(this._lexer.token)} is reserved and cannot be used for an enum value.`);
|
|
856
856
|
}
|
|
857
857
|
return this.parseName();
|
|
858
858
|
}
|
|
@@ -868,7 +868,7 @@ class Parser {
|
|
|
868
868
|
const directives = this.parseConstDirectives();
|
|
869
869
|
const fields = this.parseInputFieldsDefinition();
|
|
870
870
|
return this.node(start, {
|
|
871
|
-
kind:
|
|
871
|
+
kind: kinds_ts_1.Kind.INPUT_OBJECT_TYPE_DEFINITION,
|
|
872
872
|
description,
|
|
873
873
|
name,
|
|
874
874
|
directives,
|
|
@@ -881,7 +881,7 @@ class Parser {
|
|
|
881
881
|
* ```
|
|
882
882
|
*/
|
|
883
883
|
parseInputFieldsDefinition() {
|
|
884
|
-
return this.optionalMany(
|
|
884
|
+
return this.optionalMany(tokenKind_ts_1.TokenKind.BRACE_L, this.parseInputValueDef, tokenKind_ts_1.TokenKind.BRACE_R);
|
|
885
885
|
}
|
|
886
886
|
/**
|
|
887
887
|
* TypeSystemExtension :
|
|
@@ -895,10 +895,11 @@ class Parser {
|
|
|
895
895
|
* - UnionTypeExtension
|
|
896
896
|
* - EnumTypeExtension
|
|
897
897
|
* - InputObjectTypeDefinition
|
|
898
|
+
* - DirectiveDefinitionExtension
|
|
898
899
|
*/
|
|
899
900
|
parseTypeSystemExtension() {
|
|
900
901
|
const keywordToken = this._lexer.lookahead();
|
|
901
|
-
if (keywordToken.kind ===
|
|
902
|
+
if (keywordToken.kind === tokenKind_ts_1.TokenKind.NAME) {
|
|
902
903
|
switch (keywordToken.value) {
|
|
903
904
|
case 'schema':
|
|
904
905
|
return this.parseSchemaExtension();
|
|
@@ -914,6 +915,11 @@ class Parser {
|
|
|
914
915
|
return this.parseEnumTypeExtension();
|
|
915
916
|
case 'input':
|
|
916
917
|
return this.parseInputObjectTypeExtension();
|
|
918
|
+
case 'directive':
|
|
919
|
+
if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
|
|
920
|
+
return this.parseDirectiveDefinitionExtension();
|
|
921
|
+
}
|
|
922
|
+
break;
|
|
917
923
|
}
|
|
918
924
|
}
|
|
919
925
|
throw this.unexpected(keywordToken);
|
|
@@ -930,12 +936,12 @@ class Parser {
|
|
|
930
936
|
this.expectKeyword('extend');
|
|
931
937
|
this.expectKeyword('schema');
|
|
932
938
|
const directives = this.parseConstDirectives();
|
|
933
|
-
const operationTypes = this.optionalMany(
|
|
939
|
+
const operationTypes = this.optionalMany(tokenKind_ts_1.TokenKind.BRACE_L, this.parseOperationTypeDefinition, tokenKind_ts_1.TokenKind.BRACE_R);
|
|
934
940
|
if (directives === undefined && operationTypes === undefined) {
|
|
935
941
|
throw this.unexpected();
|
|
936
942
|
}
|
|
937
943
|
return this.node(start, {
|
|
938
|
-
kind:
|
|
944
|
+
kind: kinds_ts_1.Kind.SCHEMA_EXTENSION,
|
|
939
945
|
directives,
|
|
940
946
|
operationTypes,
|
|
941
947
|
});
|
|
@@ -954,7 +960,7 @@ class Parser {
|
|
|
954
960
|
throw this.unexpected();
|
|
955
961
|
}
|
|
956
962
|
return this.node(start, {
|
|
957
|
-
kind:
|
|
963
|
+
kind: kinds_ts_1.Kind.SCALAR_TYPE_EXTENSION,
|
|
958
964
|
name,
|
|
959
965
|
directives,
|
|
960
966
|
});
|
|
@@ -979,7 +985,7 @@ class Parser {
|
|
|
979
985
|
throw this.unexpected();
|
|
980
986
|
}
|
|
981
987
|
return this.node(start, {
|
|
982
|
-
kind:
|
|
988
|
+
kind: kinds_ts_1.Kind.OBJECT_TYPE_EXTENSION,
|
|
983
989
|
name,
|
|
984
990
|
interfaces,
|
|
985
991
|
directives,
|
|
@@ -1006,7 +1012,7 @@ class Parser {
|
|
|
1006
1012
|
throw this.unexpected();
|
|
1007
1013
|
}
|
|
1008
1014
|
return this.node(start, {
|
|
1009
|
-
kind:
|
|
1015
|
+
kind: kinds_ts_1.Kind.INTERFACE_TYPE_EXTENSION,
|
|
1010
1016
|
name,
|
|
1011
1017
|
interfaces,
|
|
1012
1018
|
directives,
|
|
@@ -1029,7 +1035,7 @@ class Parser {
|
|
|
1029
1035
|
throw this.unexpected();
|
|
1030
1036
|
}
|
|
1031
1037
|
return this.node(start, {
|
|
1032
|
-
kind:
|
|
1038
|
+
kind: kinds_ts_1.Kind.UNION_TYPE_EXTENSION,
|
|
1033
1039
|
name,
|
|
1034
1040
|
directives,
|
|
1035
1041
|
types,
|
|
@@ -1051,7 +1057,7 @@ class Parser {
|
|
|
1051
1057
|
throw this.unexpected();
|
|
1052
1058
|
}
|
|
1053
1059
|
return this.node(start, {
|
|
1054
|
-
kind:
|
|
1060
|
+
kind: kinds_ts_1.Kind.ENUM_TYPE_EXTENSION,
|
|
1055
1061
|
name,
|
|
1056
1062
|
directives,
|
|
1057
1063
|
values,
|
|
@@ -1073,12 +1079,28 @@ class Parser {
|
|
|
1073
1079
|
throw this.unexpected();
|
|
1074
1080
|
}
|
|
1075
1081
|
return this.node(start, {
|
|
1076
|
-
kind:
|
|
1082
|
+
kind: kinds_ts_1.Kind.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1077
1083
|
name,
|
|
1078
1084
|
directives,
|
|
1079
1085
|
fields,
|
|
1080
1086
|
});
|
|
1081
1087
|
}
|
|
1088
|
+
parseDirectiveDefinitionExtension() {
|
|
1089
|
+
const start = this._lexer.token;
|
|
1090
|
+
this.expectKeyword('extend');
|
|
1091
|
+
this.expectKeyword('directive');
|
|
1092
|
+
this.expectToken(tokenKind_ts_1.TokenKind.AT);
|
|
1093
|
+
const name = this.parseName();
|
|
1094
|
+
const directives = this.parseConstDirectives();
|
|
1095
|
+
if (directives === undefined) {
|
|
1096
|
+
throw this.unexpected();
|
|
1097
|
+
}
|
|
1098
|
+
return this.node(start, {
|
|
1099
|
+
kind: kinds_ts_1.Kind.DIRECTIVE_EXTENSION,
|
|
1100
|
+
name,
|
|
1101
|
+
directives,
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1082
1104
|
/**
|
|
1083
1105
|
* ```
|
|
1084
1106
|
* DirectiveDefinition :
|
|
@@ -1089,17 +1111,22 @@ class Parser {
|
|
|
1089
1111
|
const start = this._lexer.token;
|
|
1090
1112
|
const description = this.parseDescription();
|
|
1091
1113
|
this.expectKeyword('directive');
|
|
1092
|
-
this.expectToken(
|
|
1114
|
+
this.expectToken(tokenKind_ts_1.TokenKind.AT);
|
|
1093
1115
|
const name = this.parseName();
|
|
1094
1116
|
const args = this.parseArgumentDefs();
|
|
1117
|
+
const directives = this._options
|
|
1118
|
+
.experimentalDirectivesOnDirectiveDefinitions
|
|
1119
|
+
? this.parseConstDirectives()
|
|
1120
|
+
: undefined;
|
|
1095
1121
|
const repeatable = this.expectOptionalKeyword('repeatable');
|
|
1096
1122
|
this.expectKeyword('on');
|
|
1097
1123
|
const locations = this.parseDirectiveLocations();
|
|
1098
1124
|
return this.node(start, {
|
|
1099
|
-
kind:
|
|
1125
|
+
kind: kinds_ts_1.Kind.DIRECTIVE_DEFINITION,
|
|
1100
1126
|
description,
|
|
1101
1127
|
name,
|
|
1102
1128
|
arguments: args,
|
|
1129
|
+
directives,
|
|
1103
1130
|
repeatable,
|
|
1104
1131
|
locations,
|
|
1105
1132
|
});
|
|
@@ -1110,7 +1137,7 @@ class Parser {
|
|
|
1110
1137
|
* - DirectiveLocations | DirectiveLocation
|
|
1111
1138
|
*/
|
|
1112
1139
|
parseDirectiveLocations() {
|
|
1113
|
-
return this.delimitedMany(
|
|
1140
|
+
return this.delimitedMany(tokenKind_ts_1.TokenKind.PIPE, this.parseDirectiveLocation);
|
|
1114
1141
|
}
|
|
1115
1142
|
/*
|
|
1116
1143
|
* DirectiveLocation :
|
|
@@ -1125,6 +1152,8 @@ class Parser {
|
|
|
1125
1152
|
* `FRAGMENT_DEFINITION`
|
|
1126
1153
|
* `FRAGMENT_SPREAD`
|
|
1127
1154
|
* `INLINE_FRAGMENT`
|
|
1155
|
+
* `VARIABLE_DEFINITION`
|
|
1156
|
+
* `FRAGMENT_VARIABLE_DEFINITION`
|
|
1128
1157
|
*
|
|
1129
1158
|
* TypeSystemDirectiveLocation : one of
|
|
1130
1159
|
* `SCHEMA`
|
|
@@ -1138,11 +1167,12 @@ class Parser {
|
|
|
1138
1167
|
* `ENUM_VALUE`
|
|
1139
1168
|
* `INPUT_OBJECT`
|
|
1140
1169
|
* `INPUT_FIELD_DEFINITION`
|
|
1170
|
+
* `DIRECTIVE_DEFINITION`
|
|
1141
1171
|
*/
|
|
1142
1172
|
parseDirectiveLocation() {
|
|
1143
1173
|
const start = this._lexer.token;
|
|
1144
1174
|
const name = this.parseName();
|
|
1145
|
-
if (Object.hasOwn(
|
|
1175
|
+
if (Object.hasOwn(directiveLocation_ts_1.DirectiveLocation, name.value)) {
|
|
1146
1176
|
return name;
|
|
1147
1177
|
}
|
|
1148
1178
|
throw this.unexpected(start);
|
|
@@ -1158,49 +1188,49 @@ class Parser {
|
|
|
1158
1188
|
*/
|
|
1159
1189
|
parseSchemaCoordinate() {
|
|
1160
1190
|
const start = this._lexer.token;
|
|
1161
|
-
const ofDirective = this.expectOptionalToken(
|
|
1191
|
+
const ofDirective = this.expectOptionalToken(tokenKind_ts_1.TokenKind.AT);
|
|
1162
1192
|
const name = this.parseName();
|
|
1163
1193
|
let memberName;
|
|
1164
|
-
if (!ofDirective && this.expectOptionalToken(
|
|
1194
|
+
if (!ofDirective && this.expectOptionalToken(tokenKind_ts_1.TokenKind.DOT)) {
|
|
1165
1195
|
memberName = this.parseName();
|
|
1166
1196
|
}
|
|
1167
1197
|
let argumentName;
|
|
1168
1198
|
if ((ofDirective || memberName) &&
|
|
1169
|
-
this.expectOptionalToken(
|
|
1199
|
+
this.expectOptionalToken(tokenKind_ts_1.TokenKind.PAREN_L)) {
|
|
1170
1200
|
argumentName = this.parseName();
|
|
1171
|
-
this.expectToken(
|
|
1172
|
-
this.expectToken(
|
|
1201
|
+
this.expectToken(tokenKind_ts_1.TokenKind.COLON);
|
|
1202
|
+
this.expectToken(tokenKind_ts_1.TokenKind.PAREN_R);
|
|
1173
1203
|
}
|
|
1174
1204
|
if (ofDirective) {
|
|
1175
1205
|
if (argumentName) {
|
|
1176
1206
|
return this.node(start, {
|
|
1177
|
-
kind:
|
|
1207
|
+
kind: kinds_ts_1.Kind.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1178
1208
|
name,
|
|
1179
1209
|
argumentName,
|
|
1180
1210
|
});
|
|
1181
1211
|
}
|
|
1182
1212
|
return this.node(start, {
|
|
1183
|
-
kind:
|
|
1213
|
+
kind: kinds_ts_1.Kind.DIRECTIVE_COORDINATE,
|
|
1184
1214
|
name,
|
|
1185
1215
|
});
|
|
1186
1216
|
}
|
|
1187
1217
|
else if (memberName) {
|
|
1188
1218
|
if (argumentName) {
|
|
1189
1219
|
return this.node(start, {
|
|
1190
|
-
kind:
|
|
1220
|
+
kind: kinds_ts_1.Kind.ARGUMENT_COORDINATE,
|
|
1191
1221
|
name,
|
|
1192
1222
|
fieldName: memberName,
|
|
1193
1223
|
argumentName,
|
|
1194
1224
|
});
|
|
1195
1225
|
}
|
|
1196
1226
|
return this.node(start, {
|
|
1197
|
-
kind:
|
|
1227
|
+
kind: kinds_ts_1.Kind.MEMBER_COORDINATE,
|
|
1198
1228
|
name,
|
|
1199
1229
|
memberName,
|
|
1200
1230
|
});
|
|
1201
1231
|
}
|
|
1202
1232
|
return this.node(start, {
|
|
1203
|
-
kind:
|
|
1233
|
+
kind: kinds_ts_1.Kind.TYPE_COORDINATE,
|
|
1204
1234
|
name,
|
|
1205
1235
|
});
|
|
1206
1236
|
}
|
|
@@ -1212,7 +1242,7 @@ class Parser {
|
|
|
1212
1242
|
*/
|
|
1213
1243
|
node(startToken, node) {
|
|
1214
1244
|
if (this._options.noLocation !== true) {
|
|
1215
|
-
node.loc = new
|
|
1245
|
+
node.loc = new ast_ts_1.Location(startToken, this._lexer.lastToken, this._lexer.source);
|
|
1216
1246
|
}
|
|
1217
1247
|
return node;
|
|
1218
1248
|
}
|
|
@@ -1232,7 +1262,7 @@ class Parser {
|
|
|
1232
1262
|
this.advanceLexer();
|
|
1233
1263
|
return token;
|
|
1234
1264
|
}
|
|
1235
|
-
throw (0,
|
|
1265
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, token.start, `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`);
|
|
1236
1266
|
}
|
|
1237
1267
|
/**
|
|
1238
1268
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
@@ -1252,11 +1282,11 @@ class Parser {
|
|
|
1252
1282
|
*/
|
|
1253
1283
|
expectKeyword(value) {
|
|
1254
1284
|
const token = this._lexer.token;
|
|
1255
|
-
if (token.kind ===
|
|
1285
|
+
if (token.kind === tokenKind_ts_1.TokenKind.NAME && token.value === value) {
|
|
1256
1286
|
this.advanceLexer();
|
|
1257
1287
|
}
|
|
1258
1288
|
else {
|
|
1259
|
-
throw (0,
|
|
1289
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, token.start, `Expected "${value}", found ${getTokenDesc(token)}.`);
|
|
1260
1290
|
}
|
|
1261
1291
|
}
|
|
1262
1292
|
/**
|
|
@@ -1265,7 +1295,7 @@ class Parser {
|
|
|
1265
1295
|
*/
|
|
1266
1296
|
expectOptionalKeyword(value) {
|
|
1267
1297
|
const token = this._lexer.token;
|
|
1268
|
-
if (token.kind ===
|
|
1298
|
+
if (token.kind === tokenKind_ts_1.TokenKind.NAME && token.value === value) {
|
|
1269
1299
|
this.advanceLexer();
|
|
1270
1300
|
return true;
|
|
1271
1301
|
}
|
|
@@ -1276,7 +1306,7 @@ class Parser {
|
|
|
1276
1306
|
*/
|
|
1277
1307
|
unexpected(atToken) {
|
|
1278
1308
|
const token = atToken ?? this._lexer.token;
|
|
1279
|
-
return (0,
|
|
1309
|
+
return (0, syntaxError_ts_1.syntaxError)(this._lexer.source, token.start, `Unexpected ${getTokenDesc(token)}.`);
|
|
1280
1310
|
}
|
|
1281
1311
|
/**
|
|
1282
1312
|
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
@@ -1336,10 +1366,10 @@ class Parser {
|
|
|
1336
1366
|
advanceLexer() {
|
|
1337
1367
|
const { maxTokens } = this._options;
|
|
1338
1368
|
const token = this._lexer.advance();
|
|
1339
|
-
if (token.kind !==
|
|
1369
|
+
if (token.kind !== tokenKind_ts_1.TokenKind.EOF) {
|
|
1340
1370
|
++this._tokenCounter;
|
|
1341
1371
|
if (maxTokens !== undefined && this._tokenCounter > maxTokens) {
|
|
1342
|
-
throw (0,
|
|
1372
|
+
throw (0, syntaxError_ts_1.syntaxError)(this._lexer.source, token.start, `Document contains more than ${maxTokens} tokens. Parsing aborted.`);
|
|
1343
1373
|
}
|
|
1344
1374
|
}
|
|
1345
1375
|
}
|
|
@@ -1356,6 +1386,6 @@ function getTokenDesc(token) {
|
|
|
1356
1386
|
* A helper function to describe a token kind as a string for debugging.
|
|
1357
1387
|
*/
|
|
1358
1388
|
function getTokenKindDesc(kind) {
|
|
1359
|
-
return (0,
|
|
1389
|
+
return (0, lexer_ts_1.isPunctuatorTokenKind)(kind) ? `"${kind}"` : kind;
|
|
1360
1390
|
}
|
|
1361
1391
|
//# sourceMappingURL=parser.js.map
|