graphql 16.13.2 → 16.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/error/GraphQLError.d.ts +151 -15
  2. package/error/GraphQLError.js +143 -12
  3. package/error/GraphQLError.mjs +143 -12
  4. package/error/index.d.ts +6 -0
  5. package/error/index.mjs +6 -0
  6. package/error/locatedError.d.ts +20 -0
  7. package/error/locatedError.js +21 -0
  8. package/error/locatedError.mjs +20 -0
  9. package/error/syntaxError.d.ts +15 -0
  10. package/error/syntaxError.js +16 -0
  11. package/error/syntaxError.mjs +15 -0
  12. package/execution/collectFields.js +6 -0
  13. package/execution/collectFields.mjs +6 -0
  14. package/execution/execute.d.ts +211 -12
  15. package/execution/execute.js +214 -23
  16. package/execution/execute.mjs +213 -23
  17. package/execution/index.d.ts +6 -0
  18. package/execution/index.mjs +6 -0
  19. package/execution/mapAsyncIterator.d.ts +2 -0
  20. package/execution/mapAsyncIterator.js +2 -0
  21. package/execution/mapAsyncIterator.mjs +2 -0
  22. package/execution/subscribe.d.ts +195 -5
  23. package/execution/subscribe.js +154 -11
  24. package/execution/subscribe.mjs +153 -11
  25. package/execution/values.d.ts +167 -10
  26. package/execution/values.js +149 -5
  27. package/execution/values.mjs +148 -5
  28. package/graphql.d.ts +163 -41
  29. package/graphql.js +126 -4
  30. package/graphql.mjs +131 -41
  31. package/index.d.ts +12 -17
  32. package/index.mjs +13 -19
  33. package/jsutils/Maybe.d.ts +5 -1
  34. package/jsutils/ObjMap.d.ts +4 -0
  35. package/jsutils/Path.d.ts +30 -0
  36. package/jsutils/Path.js +29 -0
  37. package/jsutils/Path.mjs +29 -0
  38. package/jsutils/PromiseOrValue.d.ts +1 -0
  39. package/jsutils/devAssert.d.ts +1 -0
  40. package/jsutils/devAssert.js +1 -0
  41. package/jsutils/devAssert.mjs +1 -0
  42. package/jsutils/didYouMean.d.ts +4 -1
  43. package/jsutils/didYouMean.js +4 -1
  44. package/jsutils/didYouMean.mjs +4 -1
  45. package/jsutils/groupBy.d.ts +2 -0
  46. package/jsutils/groupBy.js +2 -0
  47. package/jsutils/groupBy.mjs +2 -0
  48. package/jsutils/identityFunc.d.ts +2 -0
  49. package/jsutils/identityFunc.js +2 -0
  50. package/jsutils/identityFunc.mjs +2 -0
  51. package/jsutils/inspect.d.ts +2 -0
  52. package/jsutils/inspect.js +2 -0
  53. package/jsutils/inspect.mjs +2 -0
  54. package/jsutils/instanceOf.d.ts +2 -0
  55. package/jsutils/instanceOf.js +2 -0
  56. package/jsutils/instanceOf.mjs +2 -0
  57. package/jsutils/invariant.d.ts +1 -0
  58. package/jsutils/invariant.js +1 -0
  59. package/jsutils/invariant.mjs +1 -0
  60. package/jsutils/isAsyncIterable.d.ts +2 -0
  61. package/jsutils/isAsyncIterable.js +2 -0
  62. package/jsutils/isAsyncIterable.mjs +2 -0
  63. package/jsutils/isIterableObject.d.ts +6 -5
  64. package/jsutils/isIterableObject.js +6 -5
  65. package/jsutils/isIterableObject.mjs +6 -5
  66. package/jsutils/isObjectLike.d.ts +2 -0
  67. package/jsutils/isObjectLike.js +2 -0
  68. package/jsutils/isObjectLike.mjs +2 -0
  69. package/jsutils/isPromise.d.ts +2 -0
  70. package/jsutils/isPromise.js +2 -0
  71. package/jsutils/isPromise.mjs +2 -0
  72. package/jsutils/keyMap.d.ts +7 -14
  73. package/jsutils/keyMap.js +7 -14
  74. package/jsutils/keyMap.mjs +7 -14
  75. package/jsutils/keyValMap.d.ts +9 -6
  76. package/jsutils/keyValMap.js +9 -6
  77. package/jsutils/keyValMap.mjs +9 -6
  78. package/jsutils/mapValue.d.ts +2 -0
  79. package/jsutils/mapValue.js +2 -0
  80. package/jsutils/mapValue.mjs +2 -0
  81. package/jsutils/memoize3.d.ts +2 -0
  82. package/jsutils/memoize3.js +2 -0
  83. package/jsutils/memoize3.mjs +2 -0
  84. package/jsutils/naturalCompare.d.ts +2 -0
  85. package/jsutils/naturalCompare.js +2 -0
  86. package/jsutils/naturalCompare.mjs +2 -0
  87. package/jsutils/printPathArray.d.ts +2 -0
  88. package/jsutils/printPathArray.js +2 -0
  89. package/jsutils/printPathArray.mjs +2 -0
  90. package/jsutils/promiseForObject.d.ts +2 -0
  91. package/jsutils/promiseForObject.js +2 -0
  92. package/jsutils/promiseForObject.mjs +2 -0
  93. package/jsutils/promiseReduce.d.ts +2 -0
  94. package/jsutils/promiseReduce.js +2 -0
  95. package/jsutils/promiseReduce.mjs +2 -0
  96. package/jsutils/suggestionList.d.ts +2 -0
  97. package/jsutils/suggestionList.js +4 -0
  98. package/jsutils/suggestionList.mjs +4 -0
  99. package/jsutils/toError.d.ts +2 -0
  100. package/jsutils/toError.js +2 -0
  101. package/jsutils/toError.mjs +2 -0
  102. package/jsutils/toObjMap.d.ts +1 -0
  103. package/jsutils/toObjMap.js +1 -0
  104. package/jsutils/toObjMap.mjs +1 -0
  105. package/language/ast.d.ts +422 -55
  106. package/language/ast.js +103 -39
  107. package/language/ast.mjs +103 -39
  108. package/language/blockString.d.ts +1 -3
  109. package/language/blockString.js +1 -3
  110. package/language/blockString.mjs +1 -3
  111. package/language/directiveLocation.d.ts +29 -8
  112. package/language/directiveLocation.js +10 -6
  113. package/language/directiveLocation.mjs +10 -6
  114. package/language/index.d.ts +7 -0
  115. package/language/index.mjs +6 -0
  116. package/language/kinds.d.ts +58 -18
  117. package/language/kinds.js +10 -6
  118. package/language/kinds.mjs +10 -6
  119. package/language/lexer.d.ts +47 -14
  120. package/language/lexer.js +71 -13
  121. package/language/lexer.mjs +70 -13
  122. package/language/location.d.ts +16 -3
  123. package/language/location.js +14 -3
  124. package/language/location.mjs +14 -3
  125. package/language/parser.d.ts +248 -11
  126. package/language/parser.js +257 -0
  127. package/language/parser.mjs +257 -3
  128. package/language/predicates.d.ts +169 -0
  129. package/language/predicates.js +173 -1
  130. package/language/predicates.mjs +185 -1
  131. package/language/printLocation.d.ts +28 -0
  132. package/language/printLocation.js +29 -0
  133. package/language/printLocation.mjs +28 -0
  134. package/language/printString.d.ts +2 -0
  135. package/language/printString.js +5 -1
  136. package/language/printString.mjs +5 -1
  137. package/language/printer.d.ts +12 -0
  138. package/language/printer.js +32 -1
  139. package/language/printer.mjs +31 -1
  140. package/language/schemaCoordinateLexer.d.ts +8 -6
  141. package/language/schemaCoordinateLexer.js +10 -6
  142. package/language/schemaCoordinateLexer.mjs +10 -6
  143. package/language/source.d.ts +28 -0
  144. package/language/source.js +32 -0
  145. package/language/source.mjs +31 -0
  146. package/language/tokenKind.d.ts +30 -3
  147. package/language/tokenKind.js +8 -3
  148. package/language/tokenKind.mjs +8 -3
  149. package/language/visitor.d.ts +200 -72
  150. package/language/visitor.js +122 -50
  151. package/language/visitor.mjs +122 -54
  152. package/package.json +1 -1
  153. package/subscription/index.d.ts +9 -3
  154. package/subscription/index.mjs +9 -3
  155. package/type/assertName.d.ts +18 -1
  156. package/type/assertName.js +19 -1
  157. package/type/assertName.mjs +18 -1
  158. package/type/definition.d.ts +2540 -79
  159. package/type/definition.js +2214 -61
  160. package/type/definition.mjs +2241 -60
  161. package/type/directives.d.ts +202 -19
  162. package/type/directives.js +206 -20
  163. package/type/directives.mjs +206 -20
  164. package/type/index.d.ts +6 -0
  165. package/type/index.mjs +6 -0
  166. package/type/introspection.d.ts +36 -0
  167. package/type/introspection.js +57 -1
  168. package/type/introspection.mjs +65 -1
  169. package/type/scalars.d.ts +29 -2
  170. package/type/scalars.js +37 -2
  171. package/type/scalars.mjs +36 -2
  172. package/type/schema.d.ts +490 -28
  173. package/type/schema.js +484 -26
  174. package/type/schema.mjs +484 -26
  175. package/type/validate.d.ts +31 -0
  176. package/type/validate.js +32 -0
  177. package/type/validate.mjs +31 -0
  178. package/utilities/TypeInfo.d.ts +441 -1
  179. package/utilities/TypeInfo.js +444 -1
  180. package/utilities/TypeInfo.mjs +443 -1
  181. package/utilities/assertValidName.d.ts +27 -2
  182. package/utilities/assertValidName.js +28 -2
  183. package/utilities/assertValidName.mjs +27 -2
  184. package/utilities/astFromValue.d.ts +33 -3
  185. package/utilities/astFromValue.js +36 -3
  186. package/utilities/astFromValue.mjs +35 -3
  187. package/utilities/buildASTSchema.d.ts +65 -6
  188. package/utilities/buildASTSchema.js +69 -6
  189. package/utilities/buildASTSchema.mjs +69 -6
  190. package/utilities/buildClientSchema.d.ts +15 -0
  191. package/utilities/buildClientSchema.js +17 -0
  192. package/utilities/buildClientSchema.mjs +16 -0
  193. package/utilities/coerceInputValue.d.ts +46 -0
  194. package/utilities/coerceInputValue.js +47 -0
  195. package/utilities/coerceInputValue.mjs +46 -0
  196. package/utilities/concatAST.d.ts +12 -0
  197. package/utilities/concatAST.js +13 -0
  198. package/utilities/concatAST.mjs +12 -0
  199. package/utilities/extendSchema.d.ts +56 -3
  200. package/utilities/extendSchema.js +121 -6
  201. package/utilities/extendSchema.mjs +120 -6
  202. package/utilities/findBreakingChanges.d.ts +95 -0
  203. package/utilities/findBreakingChanges.js +68 -0
  204. package/utilities/findBreakingChanges.mjs +70 -0
  205. package/utilities/getIntrospectionQuery.d.ts +148 -0
  206. package/utilities/getIntrospectionQuery.js +72 -38
  207. package/utilities/getIntrospectionQuery.mjs +72 -38
  208. package/utilities/getOperationAST.d.ts +15 -0
  209. package/utilities/getOperationAST.js +16 -0
  210. package/utilities/getOperationAST.mjs +15 -0
  211. package/utilities/getOperationRootType.d.ts +18 -1
  212. package/utilities/getOperationRootType.js +19 -1
  213. package/utilities/getOperationRootType.mjs +18 -1
  214. package/utilities/index.d.ts +7 -0
  215. package/utilities/index.mjs +7 -0
  216. package/utilities/introspectionFromSchema.d.ts +54 -0
  217. package/utilities/introspectionFromSchema.js +56 -0
  218. package/utilities/introspectionFromSchema.mjs +55 -0
  219. package/utilities/lexicographicSortSchema.d.ts +35 -0
  220. package/utilities/lexicographicSortSchema.js +36 -0
  221. package/utilities/lexicographicSortSchema.mjs +35 -0
  222. package/utilities/printSchema.d.ts +63 -0
  223. package/utilities/printSchema.js +67 -0
  224. package/utilities/printSchema.mjs +68 -0
  225. package/utilities/resolveSchemaCoordinate.d.ts +62 -0
  226. package/utilities/resolveSchemaCoordinate.js +64 -0
  227. package/utilities/resolveSchemaCoordinate.mjs +63 -0
  228. package/utilities/separateOperations.d.ts +30 -0
  229. package/utilities/separateOperations.js +31 -0
  230. package/utilities/separateOperations.mjs +30 -0
  231. package/utilities/stripIgnoredCharacters.d.ts +13 -6
  232. package/utilities/stripIgnoredCharacters.js +16 -6
  233. package/utilities/stripIgnoredCharacters.mjs +15 -6
  234. package/utilities/typeComparators.d.ts +84 -0
  235. package/utilities/typeComparators.js +85 -0
  236. package/utilities/typeComparators.mjs +84 -0
  237. package/utilities/typeFromAST.d.ts +86 -0
  238. package/utilities/typeFromAST.js +3 -0
  239. package/utilities/typeFromAST.mjs +3 -0
  240. package/utilities/typedQueryDocumentNode.d.ts +4 -0
  241. package/utilities/valueFromAST.d.ts +38 -0
  242. package/utilities/valueFromAST.js +51 -2
  243. package/utilities/valueFromAST.mjs +50 -2
  244. package/utilities/valueFromASTUntyped.d.ts +15 -2
  245. package/utilities/valueFromASTUntyped.js +16 -2
  246. package/utilities/valueFromASTUntyped.mjs +15 -2
  247. package/validation/ValidationContext.d.ts +399 -0
  248. package/validation/ValidationContext.js +400 -0
  249. package/validation/ValidationContext.mjs +401 -0
  250. package/validation/index.d.ts +6 -0
  251. package/validation/index.mjs +6 -0
  252. package/validation/rules/ExecutableDefinitionsRule.d.ts +28 -0
  253. package/validation/rules/ExecutableDefinitionsRule.js +29 -0
  254. package/validation/rules/ExecutableDefinitionsRule.mjs +28 -0
  255. package/validation/rules/FieldsOnCorrectTypeRule.d.ts +28 -0
  256. package/validation/rules/FieldsOnCorrectTypeRule.js +33 -0
  257. package/validation/rules/FieldsOnCorrectTypeRule.mjs +32 -0
  258. package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +28 -0
  259. package/validation/rules/FragmentsOnCompositeTypesRule.js +29 -0
  260. package/validation/rules/FragmentsOnCompositeTypesRule.mjs +28 -0
  261. package/validation/rules/KnownArgumentNamesRule.d.ts +29 -3
  262. package/validation/rules/KnownArgumentNamesRule.js +30 -3
  263. package/validation/rules/KnownArgumentNamesRule.mjs +29 -3
  264. package/validation/rules/KnownDirectivesRule.d.ts +28 -0
  265. package/validation/rules/KnownDirectivesRule.js +33 -0
  266. package/validation/rules/KnownDirectivesRule.mjs +32 -0
  267. package/validation/rules/KnownFragmentNamesRule.d.ts +28 -0
  268. package/validation/rules/KnownFragmentNamesRule.js +29 -0
  269. package/validation/rules/KnownFragmentNamesRule.mjs +28 -0
  270. package/validation/rules/KnownTypeNamesRule.d.ts +28 -0
  271. package/validation/rules/KnownTypeNamesRule.js +29 -0
  272. package/validation/rules/KnownTypeNamesRule.mjs +28 -0
  273. package/validation/rules/LoneAnonymousOperationRule.d.ts +28 -0
  274. package/validation/rules/LoneAnonymousOperationRule.js +29 -0
  275. package/validation/rules/LoneAnonymousOperationRule.mjs +28 -0
  276. package/validation/rules/LoneSchemaDefinitionRule.d.ts +21 -0
  277. package/validation/rules/LoneSchemaDefinitionRule.js +22 -0
  278. package/validation/rules/LoneSchemaDefinitionRule.mjs +21 -0
  279. package/validation/rules/MaxIntrospectionDepthRule.d.ts +31 -0
  280. package/validation/rules/MaxIntrospectionDepthRule.js +33 -0
  281. package/validation/rules/MaxIntrospectionDepthRule.mjs +34 -0
  282. package/validation/rules/NoFragmentCyclesRule.d.ts +28 -0
  283. package/validation/rules/NoFragmentCyclesRule.js +29 -0
  284. package/validation/rules/NoFragmentCyclesRule.mjs +28 -0
  285. package/validation/rules/NoUndefinedVariablesRule.d.ts +28 -0
  286. package/validation/rules/NoUndefinedVariablesRule.js +29 -0
  287. package/validation/rules/NoUndefinedVariablesRule.mjs +28 -0
  288. package/validation/rules/NoUnusedFragmentsRule.d.ts +28 -0
  289. package/validation/rules/NoUnusedFragmentsRule.js +29 -0
  290. package/validation/rules/NoUnusedFragmentsRule.mjs +28 -0
  291. package/validation/rules/NoUnusedVariablesRule.d.ts +29 -0
  292. package/validation/rules/NoUnusedVariablesRule.js +30 -0
  293. package/validation/rules/NoUnusedVariablesRule.mjs +29 -0
  294. package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +33 -0
  295. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +45 -6
  296. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +45 -6
  297. package/validation/rules/PossibleFragmentSpreadsRule.d.ts +36 -0
  298. package/validation/rules/PossibleFragmentSpreadsRule.js +37 -0
  299. package/validation/rules/PossibleFragmentSpreadsRule.mjs +36 -0
  300. package/validation/rules/PossibleTypeExtensionsRule.d.ts +21 -0
  301. package/validation/rules/PossibleTypeExtensionsRule.js +22 -0
  302. package/validation/rules/PossibleTypeExtensionsRule.mjs +21 -0
  303. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +29 -3
  304. package/validation/rules/ProvidedRequiredArgumentsRule.js +30 -3
  305. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +29 -3
  306. package/validation/rules/ScalarLeafsRule.d.ts +28 -0
  307. package/validation/rules/ScalarLeafsRule.js +29 -0
  308. package/validation/rules/ScalarLeafsRule.mjs +28 -0
  309. package/validation/rules/SingleFieldSubscriptionsRule.d.ts +33 -0
  310. package/validation/rules/SingleFieldSubscriptionsRule.js +34 -0
  311. package/validation/rules/SingleFieldSubscriptionsRule.mjs +33 -0
  312. package/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts +21 -0
  313. package/validation/rules/UniqueArgumentDefinitionNamesRule.js +22 -0
  314. package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +21 -0
  315. package/validation/rules/UniqueArgumentNamesRule.d.ts +28 -0
  316. package/validation/rules/UniqueArgumentNamesRule.js +29 -0
  317. package/validation/rules/UniqueArgumentNamesRule.mjs +28 -0
  318. package/validation/rules/UniqueDirectiveNamesRule.d.ts +21 -0
  319. package/validation/rules/UniqueDirectiveNamesRule.js +22 -0
  320. package/validation/rules/UniqueDirectiveNamesRule.mjs +21 -0
  321. package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +28 -0
  322. package/validation/rules/UniqueDirectivesPerLocationRule.js +41 -0
  323. package/validation/rules/UniqueDirectivesPerLocationRule.mjs +40 -0
  324. package/validation/rules/UniqueEnumValueNamesRule.d.ts +21 -0
  325. package/validation/rules/UniqueEnumValueNamesRule.js +22 -0
  326. package/validation/rules/UniqueEnumValueNamesRule.mjs +21 -0
  327. package/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +21 -0
  328. package/validation/rules/UniqueFieldDefinitionNamesRule.js +22 -0
  329. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +21 -0
  330. package/validation/rules/UniqueFragmentNamesRule.d.ts +28 -0
  331. package/validation/rules/UniqueFragmentNamesRule.js +29 -0
  332. package/validation/rules/UniqueFragmentNamesRule.mjs +28 -0
  333. package/validation/rules/UniqueInputFieldNamesRule.d.ts +32 -0
  334. package/validation/rules/UniqueInputFieldNamesRule.js +33 -0
  335. package/validation/rules/UniqueInputFieldNamesRule.mjs +32 -0
  336. package/validation/rules/UniqueOperationNamesRule.d.ts +28 -0
  337. package/validation/rules/UniqueOperationNamesRule.js +29 -0
  338. package/validation/rules/UniqueOperationNamesRule.mjs +28 -0
  339. package/validation/rules/UniqueOperationTypesRule.d.ts +21 -0
  340. package/validation/rules/UniqueOperationTypesRule.js +22 -0
  341. package/validation/rules/UniqueOperationTypesRule.mjs +21 -0
  342. package/validation/rules/UniqueTypeNamesRule.d.ts +21 -0
  343. package/validation/rules/UniqueTypeNamesRule.js +22 -0
  344. package/validation/rules/UniqueTypeNamesRule.mjs +21 -0
  345. package/validation/rules/UniqueVariableNamesRule.d.ts +28 -0
  346. package/validation/rules/UniqueVariableNamesRule.js +29 -0
  347. package/validation/rules/UniqueVariableNamesRule.mjs +28 -0
  348. package/validation/rules/ValuesOfCorrectTypeRule.d.ts +28 -0
  349. package/validation/rules/ValuesOfCorrectTypeRule.js +31 -0
  350. package/validation/rules/ValuesOfCorrectTypeRule.mjs +30 -0
  351. package/validation/rules/VariablesAreInputTypesRule.d.ts +32 -0
  352. package/validation/rules/VariablesAreInputTypesRule.js +33 -0
  353. package/validation/rules/VariablesAreInputTypesRule.mjs +32 -0
  354. package/validation/rules/VariablesInAllowedPositionRule.d.ts +28 -0
  355. package/validation/rules/VariablesInAllowedPositionRule.js +35 -1
  356. package/validation/rules/VariablesInAllowedPositionRule.mjs +34 -1
  357. package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +41 -0
  358. package/validation/rules/custom/NoDeprecatedCustomRule.js +42 -0
  359. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +41 -0
  360. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +28 -0
  361. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +29 -0
  362. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +28 -0
  363. package/validation/specifiedRules.d.ts +2 -3
  364. package/validation/specifiedRules.js +2 -3
  365. package/validation/specifiedRules.mjs +2 -3
  366. package/validation/validate.d.ts +70 -9
  367. package/validation/validate.js +63 -7
  368. package/validation/validate.mjs +63 -7
  369. package/version.d.ts +3 -6
  370. package/version.js +7 -9
  371. package/version.mjs +6 -9
@@ -1,3 +1,4 @@
1
+ /** @category Parsing */
1
2
  import { syntaxError } from '../error/syntaxError.mjs';
2
3
  import { Location, OperationTypeNode } from './ast.mjs';
3
4
  import { DirectiveLocation } from './directiveLocation.mjs';
@@ -6,13 +7,44 @@ import { isPunctuatorTokenKind, Lexer } from './lexer.mjs';
6
7
  import { SchemaCoordinateLexer } from './schemaCoordinateLexer.mjs';
7
8
  import { isSource, Source } from './source.mjs';
8
9
  import { TokenKind } from './tokenKind.mjs';
9
- /**
10
- * Configuration options to control parser behavior
11
- */
10
+ /** Configuration options to control parser behavior */
12
11
 
13
12
  /**
14
13
  * Given a GraphQL source, parses it into a Document.
15
14
  * Throws GraphQLError if a syntax error is encountered.
15
+ * @param source - A GraphQL source string or source object.
16
+ * @param options - Optional parser configuration.
17
+ * @returns The parsed GraphQL document AST.
18
+ * @example
19
+ * ```ts
20
+ * // Parse a GraphQL document with the default parser options.
21
+ * import { parse } from 'graphql/language';
22
+ *
23
+ * const document = parse('{ hero { name } }');
24
+ *
25
+ * document.kind; // => 'Document'
26
+ * ```
27
+ * @example
28
+ * ```ts
29
+ * // This variant enables parser options and provides an explicit lexer.
30
+ * import { Lexer, Source, parse } from 'graphql/language';
31
+ *
32
+ * const document = parse('fragment A($var: Boolean) on Query { field }', {
33
+ * allowLegacyFragmentVariables: true,
34
+ * maxTokens: 20,
35
+ * noLocation: true,
36
+ * });
37
+ * const directiveDocument = parse('directive @foo @bar on FIELD', {
38
+ * experimentalDirectivesOnDirectiveDefinitions: true,
39
+ * });
40
+ * const source = new Source('{ hero }');
41
+ * const lexerDocument = parse(source, { lexer: new Lexer(source) });
42
+ *
43
+ * document.definitions[0].kind; // => 'FragmentDefinition'
44
+ * document.loc; // => undefined
45
+ * directiveDocument.definitions[0].kind; // => 'DirectiveDefinition'
46
+ * lexerDocument.definitions[0].kind; // => 'OperationDefinition'
47
+ * ```
16
48
  */
17
49
  export function parse(source, options) {
18
50
  const parser = new Parser(source, options);
@@ -32,6 +64,17 @@ export function parse(source, options) {
32
64
  * in isolation of complete GraphQL documents.
33
65
  *
34
66
  * Consider providing the results to the utility function: valueFromAST().
67
+ * @param source - A GraphQL source string or source object containing a value.
68
+ * @param options - Optional parser configuration.
69
+ * @returns The parsed GraphQL value AST.
70
+ * @example
71
+ * ```ts
72
+ * import { parseValue } from 'graphql/language';
73
+ *
74
+ * const value = parseValue('[42]');
75
+ *
76
+ * value.kind; // => 'ListValue'
77
+ * ```
35
78
  */
36
79
 
37
80
  export function parseValue(source, options) {
@@ -44,6 +87,18 @@ export function parseValue(source, options) {
44
87
  /**
45
88
  * Similar to parseValue(), but raises a parse error if it encounters a
46
89
  * variable. The return type will be a constant value.
90
+ * @param source - A GraphQL source string or source object containing a constant value.
91
+ * @param options - Optional parser configuration.
92
+ * @returns The parsed GraphQL constant value AST.
93
+ * @example
94
+ * ```ts
95
+ * import { parseConstValue } from 'graphql/language';
96
+ *
97
+ * const value = parseConstValue('{ enabled: true }');
98
+ *
99
+ * value.kind; // => 'ObjectValue'
100
+ * parseConstValue('$variable'); // throws an error
101
+ * ```
47
102
  */
48
103
 
49
104
  export function parseConstValue(source, options) {
@@ -62,6 +117,17 @@ export function parseConstValue(source, options) {
62
117
  * in isolation of complete GraphQL documents.
63
118
  *
64
119
  * Consider providing the results to the utility function: typeFromAST().
120
+ * @param source - A GraphQL source string or source object containing a type reference.
121
+ * @param options - Optional parser configuration.
122
+ * @returns The parsed GraphQL type AST.
123
+ * @example
124
+ * ```ts
125
+ * import { parseType } from 'graphql/language';
126
+ *
127
+ * const type = parseType('[String!]');
128
+ *
129
+ * type.kind; // => 'ListType'
130
+ * ```
65
131
  */
66
132
 
67
133
  export function parseType(source, options) {
@@ -79,6 +145,16 @@ export function parseType(source, options) {
79
145
  * Consider providing the results to the utility function:
80
146
  * resolveASTSchemaCoordinate(). Or calling resolveSchemaCoordinate() directly
81
147
  * with an unparsed source.
148
+ * @param source - A GraphQL source string or source object containing a schema coordinate.
149
+ * @returns The parsed GraphQL schema coordinate AST.
150
+ * @example
151
+ * ```ts
152
+ * import { parseSchemaCoordinate } from 'graphql/language';
153
+ *
154
+ * const coordinate = parseSchemaCoordinate('Query.hero');
155
+ *
156
+ * coordinate.kind; // => 'MemberCoordinate'
157
+ * ```
82
158
  */
83
159
 
84
160
  export function parseSchemaCoordinate(source) {
@@ -124,6 +200,8 @@ export class Parser {
124
200
  }
125
201
  /**
126
202
  * Converts a name lex token into a name parse node.
203
+ *
204
+ * @internal
127
205
  */
128
206
 
129
207
  parseName() {
@@ -136,6 +214,8 @@ export class Parser {
136
214
 
137
215
  /**
138
216
  * Document : Definition+
217
+ *
218
+ * @internal
139
219
  */
140
220
 
141
221
  parseDocument() {
@@ -170,6 +250,8 @@ export class Parser {
170
250
  * - UnionTypeDefinition
171
251
  * - EnumTypeDefinition
172
252
  * - InputObjectTypeDefinition
253
+ *
254
+ * @internal
173
255
  */
174
256
 
175
257
  parseDefinition() {
@@ -248,6 +330,8 @@ export class Parser {
248
330
  * OperationDefinition :
249
331
  * - SelectionSet
250
332
  * - OperationType Name? VariableDefinitions? Directives? SelectionSet
333
+ *
334
+ * @internal
251
335
  */
252
336
 
253
337
  parseOperationDefinition() {
@@ -285,6 +369,8 @@ export class Parser {
285
369
  }
286
370
  /**
287
371
  * OperationType : one of query mutation subscription
372
+ *
373
+ * @internal
288
374
  */
289
375
 
290
376
  parseOperationType() {
@@ -305,6 +391,8 @@ export class Parser {
305
391
  }
306
392
  /**
307
393
  * VariableDefinitions : ( VariableDefinition+ )
394
+ *
395
+ * @internal
308
396
  */
309
397
 
310
398
  parseVariableDefinitions() {
@@ -316,6 +404,8 @@ export class Parser {
316
404
  }
317
405
  /**
318
406
  * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
407
+ *
408
+ * @internal
319
409
  */
320
410
 
321
411
  parseVariableDefinition() {
@@ -332,6 +422,8 @@ export class Parser {
332
422
  }
333
423
  /**
334
424
  * Variable : $ Name
425
+ *
426
+ * @internal
335
427
  */
336
428
 
337
429
  parseVariable() {
@@ -346,6 +438,8 @@ export class Parser {
346
438
  * ```
347
439
  * SelectionSet : { Selection+ }
348
440
  * ```
441
+ *
442
+ * @internal
349
443
  */
350
444
 
351
445
  parseSelectionSet() {
@@ -363,6 +457,8 @@ export class Parser {
363
457
  * - Field
364
458
  * - FragmentSpread
365
459
  * - InlineFragment
460
+ *
461
+ * @internal
366
462
  */
367
463
 
368
464
  parseSelection() {
@@ -374,6 +470,8 @@ export class Parser {
374
470
  * Field : Alias? Name Arguments? Directives? SelectionSet?
375
471
  *
376
472
  * Alias : Name :
473
+ *
474
+ * @internal
377
475
  */
378
476
 
379
477
  parseField() {
@@ -402,6 +500,8 @@ export class Parser {
402
500
  }
403
501
  /**
404
502
  * Arguments[Const] : ( Argument[?Const]+ )
503
+ *
504
+ * @internal
405
505
  */
406
506
 
407
507
  parseArguments(isConst) {
@@ -410,6 +510,8 @@ export class Parser {
410
510
  }
411
511
  /**
412
512
  * Argument[Const] : Name : Value[?Const]
513
+ *
514
+ * @internal
413
515
  */
414
516
 
415
517
  parseArgument(isConst = false) {
@@ -433,6 +535,8 @@ export class Parser {
433
535
  * FragmentSpread : ... FragmentName Directives?
434
536
  *
435
537
  * InlineFragment : ... TypeCondition? Directives? SelectionSet
538
+ *
539
+ * @internal
436
540
  */
437
541
 
438
542
  parseFragment() {
@@ -460,6 +564,8 @@ export class Parser {
460
564
  * - fragment FragmentName on TypeCondition Directives? SelectionSet
461
565
  *
462
566
  * TypeCondition : NamedType
567
+ *
568
+ * @internal
463
569
  */
464
570
 
465
571
  parseFragmentDefinition() {
@@ -492,6 +598,8 @@ export class Parser {
492
598
  }
493
599
  /**
494
600
  * FragmentName : Name but not `on`
601
+ *
602
+ * @internal
495
603
  */
496
604
 
497
605
  parseFragmentName() {
@@ -519,6 +627,8 @@ export class Parser {
519
627
  * NullValue : `null`
520
628
  *
521
629
  * EnumValue : Name but not `true`, `false` or `null`
630
+ *
631
+ * @internal
522
632
  */
523
633
 
524
634
  parseValueLiteral(isConst) {
@@ -617,6 +727,8 @@ export class Parser {
617
727
  * ListValue[Const] :
618
728
  * - [ ]
619
729
  * - [ Value[?Const]+ ]
730
+ *
731
+ * @internal
620
732
  */
621
733
 
622
734
  parseList(isConst) {
@@ -633,6 +745,8 @@ export class Parser {
633
745
  * - { }
634
746
  * - { ObjectField[?Const]+ }
635
747
  * ```
748
+ *
749
+ * @internal
636
750
  */
637
751
 
638
752
  parseObject(isConst) {
@@ -645,6 +759,8 @@ export class Parser {
645
759
  }
646
760
  /**
647
761
  * ObjectField[Const] : Name : Value[?Const]
762
+ *
763
+ * @internal
648
764
  */
649
765
 
650
766
  parseObjectField(isConst) {
@@ -660,6 +776,8 @@ export class Parser {
660
776
 
661
777
  /**
662
778
  * Directives[Const] : Directive[?Const]+
779
+ *
780
+ * @internal
663
781
  */
664
782
 
665
783
  parseDirectives(isConst) {
@@ -679,6 +797,8 @@ export class Parser {
679
797
  * ```
680
798
  * Directive[Const] : @ Name Arguments[?Const]?
681
799
  * ```
800
+ *
801
+ * @internal
682
802
  */
683
803
 
684
804
  parseDirective(isConst) {
@@ -696,6 +816,8 @@ export class Parser {
696
816
  * - NamedType
697
817
  * - ListType
698
818
  * - NonNullType
819
+ *
820
+ * @internal
699
821
  */
700
822
 
701
823
  parseTypeReference() {
@@ -724,6 +846,8 @@ export class Parser {
724
846
  }
725
847
  /**
726
848
  * NamedType : Name
849
+ *
850
+ * @internal
727
851
  */
728
852
 
729
853
  parseNamedType() {
@@ -738,6 +862,8 @@ export class Parser {
738
862
  }
739
863
  /**
740
864
  * Description : StringValue
865
+ *
866
+ * @internal
741
867
  */
742
868
 
743
869
  parseDescription() {
@@ -749,6 +875,8 @@ export class Parser {
749
875
  * ```
750
876
  * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
751
877
  * ```
878
+ *
879
+ * @internal
752
880
  */
753
881
 
754
882
  parseSchemaDefinition() {
@@ -770,6 +898,8 @@ export class Parser {
770
898
  }
771
899
  /**
772
900
  * OperationTypeDefinition : OperationType : NamedType
901
+ *
902
+ * @internal
773
903
  */
774
904
 
775
905
  parseOperationTypeDefinition() {
@@ -785,6 +915,8 @@ export class Parser {
785
915
  }
786
916
  /**
787
917
  * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
918
+ *
919
+ * @internal
788
920
  */
789
921
 
790
922
  parseScalarTypeDefinition() {
@@ -804,6 +936,8 @@ export class Parser {
804
936
  * ObjectTypeDefinition :
805
937
  * Description?
806
938
  * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
939
+ *
940
+ * @internal
807
941
  */
808
942
 
809
943
  parseObjectTypeDefinition() {
@@ -827,6 +961,8 @@ export class Parser {
827
961
  * ImplementsInterfaces :
828
962
  * - implements `&`? NamedType
829
963
  * - ImplementsInterfaces & NamedType
964
+ *
965
+ * @internal
830
966
  */
831
967
 
832
968
  parseImplementsInterfaces() {
@@ -838,6 +974,8 @@ export class Parser {
838
974
  * ```
839
975
  * FieldsDefinition : { FieldDefinition+ }
840
976
  * ```
977
+ *
978
+ * @internal
841
979
  */
842
980
 
843
981
  parseFieldsDefinition() {
@@ -850,6 +988,8 @@ export class Parser {
850
988
  /**
851
989
  * FieldDefinition :
852
990
  * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
991
+ *
992
+ * @internal
853
993
  */
854
994
 
855
995
  parseFieldDefinition() {
@@ -871,6 +1011,8 @@ export class Parser {
871
1011
  }
872
1012
  /**
873
1013
  * ArgumentsDefinition : ( InputValueDefinition+ )
1014
+ *
1015
+ * @internal
874
1016
  */
875
1017
 
876
1018
  parseArgumentDefs() {
@@ -883,6 +1025,8 @@ export class Parser {
883
1025
  /**
884
1026
  * InputValueDefinition :
885
1027
  * - Description? Name : Type DefaultValue? Directives[Const]?
1028
+ *
1029
+ * @internal
886
1030
  */
887
1031
 
888
1032
  parseInputValueDef() {
@@ -910,6 +1054,8 @@ export class Parser {
910
1054
  /**
911
1055
  * InterfaceTypeDefinition :
912
1056
  * - Description? interface Name Directives[Const]? FieldsDefinition?
1057
+ *
1058
+ * @internal
913
1059
  */
914
1060
 
915
1061
  parseInterfaceTypeDefinition() {
@@ -932,6 +1078,8 @@ export class Parser {
932
1078
  /**
933
1079
  * UnionTypeDefinition :
934
1080
  * - Description? union Name Directives[Const]? UnionMemberTypes?
1081
+ *
1082
+ * @internal
935
1083
  */
936
1084
 
937
1085
  parseUnionTypeDefinition() {
@@ -953,6 +1101,8 @@ export class Parser {
953
1101
  * UnionMemberTypes :
954
1102
  * - = `|`? NamedType
955
1103
  * - UnionMemberTypes | NamedType
1104
+ *
1105
+ * @internal
956
1106
  */
957
1107
 
958
1108
  parseUnionMemberTypes() {
@@ -963,6 +1113,8 @@ export class Parser {
963
1113
  /**
964
1114
  * EnumTypeDefinition :
965
1115
  * - Description? enum Name Directives[Const]? EnumValuesDefinition?
1116
+ *
1117
+ * @internal
966
1118
  */
967
1119
 
968
1120
  parseEnumTypeDefinition() {
@@ -984,6 +1136,8 @@ export class Parser {
984
1136
  * ```
985
1137
  * EnumValuesDefinition : { EnumValueDefinition+ }
986
1138
  * ```
1139
+ *
1140
+ * @internal
987
1141
  */
988
1142
 
989
1143
  parseEnumValuesDefinition() {
@@ -995,6 +1149,8 @@ export class Parser {
995
1149
  }
996
1150
  /**
997
1151
  * EnumValueDefinition : Description? EnumValue Directives[Const]?
1152
+ *
1153
+ * @internal
998
1154
  */
999
1155
 
1000
1156
  parseEnumValueDefinition() {
@@ -1011,6 +1167,8 @@ export class Parser {
1011
1167
  }
1012
1168
  /**
1013
1169
  * EnumValue : Name but not `true`, `false` or `null`
1170
+ *
1171
+ * @internal
1014
1172
  */
1015
1173
 
1016
1174
  parseEnumValueName() {
@@ -1033,6 +1191,8 @@ export class Parser {
1033
1191
  /**
1034
1192
  * InputObjectTypeDefinition :
1035
1193
  * - Description? input Name Directives[Const]? InputFieldsDefinition?
1194
+ *
1195
+ * @internal
1036
1196
  */
1037
1197
 
1038
1198
  parseInputObjectTypeDefinition() {
@@ -1054,6 +1214,8 @@ export class Parser {
1054
1214
  * ```
1055
1215
  * InputFieldsDefinition : { InputValueDefinition+ }
1056
1216
  * ```
1217
+ *
1218
+ * @internal
1057
1219
  */
1058
1220
 
1059
1221
  parseInputFieldsDefinition() {
@@ -1075,6 +1237,9 @@ export class Parser {
1075
1237
  * - UnionTypeExtension
1076
1238
  * - EnumTypeExtension
1077
1239
  * - InputObjectTypeDefinition
1240
+ * - DirectiveDefinitionExtension
1241
+ *
1242
+ * @internal
1078
1243
  */
1079
1244
 
1080
1245
  parseTypeSystemExtension() {
@@ -1102,6 +1267,13 @@ export class Parser {
1102
1267
 
1103
1268
  case 'input':
1104
1269
  return this.parseInputObjectTypeExtension();
1270
+
1271
+ case 'directive':
1272
+ if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
1273
+ return this.parseDirectiveDefinitionExtension();
1274
+ }
1275
+
1276
+ break;
1105
1277
  }
1106
1278
  }
1107
1279
 
@@ -1113,6 +1285,8 @@ export class Parser {
1113
1285
  * - extend schema Directives[Const]? { OperationTypeDefinition+ }
1114
1286
  * - extend schema Directives[Const]
1115
1287
  * ```
1288
+ *
1289
+ * @internal
1116
1290
  */
1117
1291
 
1118
1292
  parseSchemaExtension() {
@@ -1139,6 +1313,8 @@ export class Parser {
1139
1313
  /**
1140
1314
  * ScalarTypeExtension :
1141
1315
  * - extend scalar Name Directives[Const]
1316
+ *
1317
+ * @internal
1142
1318
  */
1143
1319
 
1144
1320
  parseScalarTypeExtension() {
@@ -1163,6 +1339,8 @@ export class Parser {
1163
1339
  * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1164
1340
  * - extend type Name ImplementsInterfaces? Directives[Const]
1165
1341
  * - extend type Name ImplementsInterfaces
1342
+ *
1343
+ * @internal
1166
1344
  */
1167
1345
 
1168
1346
  parseObjectTypeExtension() {
@@ -1195,6 +1373,8 @@ export class Parser {
1195
1373
  * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1196
1374
  * - extend interface Name ImplementsInterfaces? Directives[Const]
1197
1375
  * - extend interface Name ImplementsInterfaces
1376
+ *
1377
+ * @internal
1198
1378
  */
1199
1379
 
1200
1380
  parseInterfaceTypeExtension() {
@@ -1226,6 +1406,8 @@ export class Parser {
1226
1406
  * UnionTypeExtension :
1227
1407
  * - extend union Name Directives[Const]? UnionMemberTypes
1228
1408
  * - extend union Name Directives[Const]
1409
+ *
1410
+ * @internal
1229
1411
  */
1230
1412
 
1231
1413
  parseUnionTypeExtension() {
@@ -1251,6 +1433,8 @@ export class Parser {
1251
1433
  * EnumTypeExtension :
1252
1434
  * - extend enum Name Directives[Const]? EnumValuesDefinition
1253
1435
  * - extend enum Name Directives[Const]
1436
+ *
1437
+ * @internal
1254
1438
  */
1255
1439
 
1256
1440
  parseEnumTypeExtension() {
@@ -1276,6 +1460,8 @@ export class Parser {
1276
1460
  * InputObjectTypeExtension :
1277
1461
  * - extend input Name Directives[Const]? InputFieldsDefinition
1278
1462
  * - extend input Name Directives[Const]
1463
+ *
1464
+ * @internal
1279
1465
  */
1280
1466
 
1281
1467
  parseInputObjectTypeExtension() {
@@ -1297,11 +1483,32 @@ export class Parser {
1297
1483
  fields,
1298
1484
  });
1299
1485
  }
1486
+
1487
+ parseDirectiveDefinitionExtension() {
1488
+ const start = this._lexer.token;
1489
+ this.expectKeyword('extend');
1490
+ this.expectKeyword('directive');
1491
+ this.expectToken(TokenKind.AT);
1492
+ const name = this.parseName();
1493
+ const directives = this.parseConstDirectives();
1494
+
1495
+ if (directives.length === 0) {
1496
+ throw this.unexpected();
1497
+ }
1498
+
1499
+ return this.node(start, {
1500
+ kind: Kind.DIRECTIVE_EXTENSION,
1501
+ name,
1502
+ directives,
1503
+ });
1504
+ }
1300
1505
  /**
1301
1506
  * ```
1302
1507
  * DirectiveDefinition :
1303
1508
  * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
1304
1509
  * ```
1510
+ *
1511
+ * @internal
1305
1512
  */
1306
1513
 
1307
1514
  parseDirectiveDefinition() {
@@ -1311,6 +1518,10 @@ export class Parser {
1311
1518
  this.expectToken(TokenKind.AT);
1312
1519
  const name = this.parseName();
1313
1520
  const args = this.parseArgumentDefs();
1521
+ const directives = this._options
1522
+ .experimentalDirectivesOnDirectiveDefinitions
1523
+ ? this.parseConstDirectives()
1524
+ : [];
1314
1525
  const repeatable = this.expectOptionalKeyword('repeatable');
1315
1526
  this.expectKeyword('on');
1316
1527
  const locations = this.parseDirectiveLocations();
@@ -1319,6 +1530,7 @@ export class Parser {
1319
1530
  description,
1320
1531
  name,
1321
1532
  arguments: args,
1533
+ directives,
1322
1534
  repeatable,
1323
1535
  locations,
1324
1536
  });
@@ -1327,6 +1539,8 @@ export class Parser {
1327
1539
  * DirectiveLocations :
1328
1540
  * - `|`? DirectiveLocation
1329
1541
  * - DirectiveLocations | DirectiveLocation
1542
+ *
1543
+ * @internal
1330
1544
  */
1331
1545
 
1332
1546
  parseDirectiveLocations() {
@@ -1358,6 +1572,7 @@ export class Parser {
1358
1572
  * `ENUM_VALUE`
1359
1573
  * `INPUT_OBJECT`
1360
1574
  * `INPUT_FIELD_DEFINITION`
1575
+ * `DIRECTIVE_DEFINITION`
1361
1576
  */
1362
1577
 
1363
1578
  parseDirectiveLocation() {
@@ -1378,6 +1593,19 @@ export class Parser {
1378
1593
  * - Name . Name ( Name : )
1379
1594
  * - \@ Name
1380
1595
  * - \@ Name ( Name : )
1596
+ * @returns Parsed schema coordinate AST.
1597
+ * @example
1598
+ * ```ts
1599
+ * import { Parser, Source } from 'graphql/language';
1600
+ *
1601
+ * const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
1602
+ * const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
1603
+ *
1604
+ * typeCoordinate.name.value; // => 'User'
1605
+ * typeCoordinate.memberName?.value; // => 'name'
1606
+ * directiveCoordinate.name.value; // => 'deprecated'
1607
+ * directiveCoordinate.argumentName?.value; // => 'reason'
1608
+ * ```
1381
1609
  */
1382
1610
 
1383
1611
  parseSchemaCoordinate() {
@@ -1441,6 +1669,8 @@ export class Parser {
1441
1669
  * Returns a node that, if configured to do so, sets a "loc" field as a
1442
1670
  * location object, used to identify the place in the source that created a
1443
1671
  * given parsed object.
1672
+ *
1673
+ * @internal
1444
1674
  */
1445
1675
 
1446
1676
  node(startToken, node) {
@@ -1456,6 +1686,8 @@ export class Parser {
1456
1686
  }
1457
1687
  /**
1458
1688
  * Determines if the next token is of a given kind
1689
+ *
1690
+ * @internal
1459
1691
  */
1460
1692
 
1461
1693
  peek(kind) {
@@ -1464,6 +1696,8 @@ export class Parser {
1464
1696
  /**
1465
1697
  * If the next token is of the given kind, return that token after advancing the lexer.
1466
1698
  * Otherwise, do not change the parser state and throw an error.
1699
+ *
1700
+ * @internal
1467
1701
  */
1468
1702
 
1469
1703
  expectToken(kind) {
@@ -1483,6 +1717,8 @@ export class Parser {
1483
1717
  /**
1484
1718
  * If the next token is of the given kind, return "true" after advancing the lexer.
1485
1719
  * Otherwise, do not change the parser state and return "false".
1720
+ *
1721
+ * @internal
1486
1722
  */
1487
1723
 
1488
1724
  expectOptionalToken(kind) {
@@ -1498,6 +1734,8 @@ export class Parser {
1498
1734
  /**
1499
1735
  * If the next token is a given keyword, advance the lexer.
1500
1736
  * Otherwise, do not change the parser state and throw an error.
1737
+ *
1738
+ * @internal
1501
1739
  */
1502
1740
 
1503
1741
  expectKeyword(value) {
@@ -1516,6 +1754,8 @@ export class Parser {
1516
1754
  /**
1517
1755
  * If the next token is a given keyword, return "true" after advancing the lexer.
1518
1756
  * Otherwise, do not change the parser state and return "false".
1757
+ *
1758
+ * @internal
1519
1759
  */
1520
1760
 
1521
1761
  expectOptionalKeyword(value) {
@@ -1530,6 +1770,8 @@ export class Parser {
1530
1770
  }
1531
1771
  /**
1532
1772
  * Helper function for creating an error when an unexpected lexed token is encountered.
1773
+ *
1774
+ * @internal
1533
1775
  */
1534
1776
 
1535
1777
  unexpected(atToken) {
@@ -1545,6 +1787,8 @@ export class Parser {
1545
1787
  * Returns a possibly empty list of parse nodes, determined by the parseFn.
1546
1788
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
1547
1789
  * Advances the parser to the next lex token after the closing token.
1790
+ *
1791
+ * @internal
1548
1792
  */
1549
1793
 
1550
1794
  any(openKind, parseFn, closeKind) {
@@ -1562,6 +1806,8 @@ export class Parser {
1562
1806
  * It can be empty only if open token is missing otherwise it will always return non-empty list
1563
1807
  * that begins with a lex token of openKind and ends with a lex token of closeKind.
1564
1808
  * Advances the parser to the next lex token after the closing token.
1809
+ *
1810
+ * @internal
1565
1811
  */
1566
1812
 
1567
1813
  optionalMany(openKind, parseFn, closeKind) {
@@ -1581,6 +1827,8 @@ export class Parser {
1581
1827
  * Returns a non-empty list of parse nodes, determined by the parseFn.
1582
1828
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
1583
1829
  * Advances the parser to the next lex token after the closing token.
1830
+ *
1831
+ * @internal
1584
1832
  */
1585
1833
 
1586
1834
  many(openKind, parseFn, closeKind) {
@@ -1597,6 +1845,8 @@ export class Parser {
1597
1845
  * Returns a non-empty list of parse nodes, determined by the parseFn.
1598
1846
  * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
1599
1847
  * Advances the parser to the next lex token after last item in the list.
1848
+ *
1849
+ * @internal
1600
1850
  */
1601
1851
 
1602
1852
  delimitedMany(delimiterKind, parseFn) {
@@ -1630,6 +1880,8 @@ export class Parser {
1630
1880
  }
1631
1881
  /**
1632
1882
  * A helper function to describe a token as a string for debugging.
1883
+ *
1884
+ * @internal
1633
1885
  */
1634
1886
 
1635
1887
  function getTokenDesc(token) {
@@ -1638,6 +1890,8 @@ function getTokenDesc(token) {
1638
1890
  }
1639
1891
  /**
1640
1892
  * A helper function to describe a token kind as a string for debugging.
1893
+ *
1894
+ * @internal
1641
1895
  */
1642
1896
 
1643
1897
  function getTokenKindDesc(kind) {