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
@@ -26,9 +26,44 @@ var _source = require('./source.js');
26
26
 
27
27
  var _tokenKind = require('./tokenKind.js');
28
28
 
29
+ /** @category Parsing */
30
+
29
31
  /**
30
32
  * Given a GraphQL source, parses it into a Document.
31
33
  * Throws GraphQLError if a syntax error is encountered.
34
+ * @param source - A GraphQL source string or source object.
35
+ * @param options - Optional parser configuration.
36
+ * @returns The parsed GraphQL document AST.
37
+ * @example
38
+ * ```ts
39
+ * // Parse a GraphQL document with the default parser options.
40
+ * import { parse } from 'graphql/language';
41
+ *
42
+ * const document = parse('{ hero { name } }');
43
+ *
44
+ * document.kind; // => 'Document'
45
+ * ```
46
+ * @example
47
+ * ```ts
48
+ * // This variant enables parser options and provides an explicit lexer.
49
+ * import { Lexer, Source, parse } from 'graphql/language';
50
+ *
51
+ * const document = parse('fragment A($var: Boolean) on Query { field }', {
52
+ * allowLegacyFragmentVariables: true,
53
+ * maxTokens: 20,
54
+ * noLocation: true,
55
+ * });
56
+ * const directiveDocument = parse('directive @foo @bar on FIELD', {
57
+ * experimentalDirectivesOnDirectiveDefinitions: true,
58
+ * });
59
+ * const source = new Source('{ hero }');
60
+ * const lexerDocument = parse(source, { lexer: new Lexer(source) });
61
+ *
62
+ * document.definitions[0].kind; // => 'FragmentDefinition'
63
+ * document.loc; // => undefined
64
+ * directiveDocument.definitions[0].kind; // => 'DirectiveDefinition'
65
+ * lexerDocument.definitions[0].kind; // => 'OperationDefinition'
66
+ * ```
32
67
  */
33
68
  function parse(source, options) {
34
69
  const parser = new Parser(source, options);
@@ -48,6 +83,17 @@ function parse(source, options) {
48
83
  * in isolation of complete GraphQL documents.
49
84
  *
50
85
  * Consider providing the results to the utility function: valueFromAST().
86
+ * @param source - A GraphQL source string or source object containing a value.
87
+ * @param options - Optional parser configuration.
88
+ * @returns The parsed GraphQL value AST.
89
+ * @example
90
+ * ```ts
91
+ * import { parseValue } from 'graphql/language';
92
+ *
93
+ * const value = parseValue('[42]');
94
+ *
95
+ * value.kind; // => 'ListValue'
96
+ * ```
51
97
  */
52
98
 
53
99
  function parseValue(source, options) {
@@ -60,6 +106,18 @@ function parseValue(source, options) {
60
106
  /**
61
107
  * Similar to parseValue(), but raises a parse error if it encounters a
62
108
  * variable. The return type will be a constant value.
109
+ * @param source - A GraphQL source string or source object containing a constant value.
110
+ * @param options - Optional parser configuration.
111
+ * @returns The parsed GraphQL constant value AST.
112
+ * @example
113
+ * ```ts
114
+ * import { parseConstValue } from 'graphql/language';
115
+ *
116
+ * const value = parseConstValue('{ enabled: true }');
117
+ *
118
+ * value.kind; // => 'ObjectValue'
119
+ * parseConstValue('$variable'); // throws an error
120
+ * ```
63
121
  */
64
122
 
65
123
  function parseConstValue(source, options) {
@@ -78,6 +136,17 @@ function parseConstValue(source, options) {
78
136
  * in isolation of complete GraphQL documents.
79
137
  *
80
138
  * Consider providing the results to the utility function: typeFromAST().
139
+ * @param source - A GraphQL source string or source object containing a type reference.
140
+ * @param options - Optional parser configuration.
141
+ * @returns The parsed GraphQL type AST.
142
+ * @example
143
+ * ```ts
144
+ * import { parseType } from 'graphql/language';
145
+ *
146
+ * const type = parseType('[String!]');
147
+ *
148
+ * type.kind; // => 'ListType'
149
+ * ```
81
150
  */
82
151
 
83
152
  function parseType(source, options) {
@@ -95,6 +164,16 @@ function parseType(source, options) {
95
164
  * Consider providing the results to the utility function:
96
165
  * resolveASTSchemaCoordinate(). Or calling resolveSchemaCoordinate() directly
97
166
  * with an unparsed source.
167
+ * @param source - A GraphQL source string or source object containing a schema coordinate.
168
+ * @returns The parsed GraphQL schema coordinate AST.
169
+ * @example
170
+ * ```ts
171
+ * import { parseSchemaCoordinate } from 'graphql/language';
172
+ *
173
+ * const coordinate = parseSchemaCoordinate('Query.hero');
174
+ *
175
+ * coordinate.kind; // => 'MemberCoordinate'
176
+ * ```
98
177
  */
99
178
 
100
179
  function parseSchemaCoordinate(source) {
@@ -144,6 +223,8 @@ class Parser {
144
223
  }
145
224
  /**
146
225
  * Converts a name lex token into a name parse node.
226
+ *
227
+ * @internal
147
228
  */
148
229
 
149
230
  parseName() {
@@ -156,6 +237,8 @@ class Parser {
156
237
 
157
238
  /**
158
239
  * Document : Definition+
240
+ *
241
+ * @internal
159
242
  */
160
243
 
161
244
  parseDocument() {
@@ -190,6 +273,8 @@ class Parser {
190
273
  * - UnionTypeDefinition
191
274
  * - EnumTypeDefinition
192
275
  * - InputObjectTypeDefinition
276
+ *
277
+ * @internal
193
278
  */
194
279
 
195
280
  parseDefinition() {
@@ -268,6 +353,8 @@ class Parser {
268
353
  * OperationDefinition :
269
354
  * - SelectionSet
270
355
  * - OperationType Name? VariableDefinitions? Directives? SelectionSet
356
+ *
357
+ * @internal
271
358
  */
272
359
 
273
360
  parseOperationDefinition() {
@@ -305,6 +392,8 @@ class Parser {
305
392
  }
306
393
  /**
307
394
  * OperationType : one of query mutation subscription
395
+ *
396
+ * @internal
308
397
  */
309
398
 
310
399
  parseOperationType() {
@@ -325,6 +414,8 @@ class Parser {
325
414
  }
326
415
  /**
327
416
  * VariableDefinitions : ( VariableDefinition+ )
417
+ *
418
+ * @internal
328
419
  */
329
420
 
330
421
  parseVariableDefinitions() {
@@ -336,6 +427,8 @@ class Parser {
336
427
  }
337
428
  /**
338
429
  * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
430
+ *
431
+ * @internal
339
432
  */
340
433
 
341
434
  parseVariableDefinition() {
@@ -354,6 +447,8 @@ class Parser {
354
447
  }
355
448
  /**
356
449
  * Variable : $ Name
450
+ *
451
+ * @internal
357
452
  */
358
453
 
359
454
  parseVariable() {
@@ -368,6 +463,8 @@ class Parser {
368
463
  * ```
369
464
  * SelectionSet : { Selection+ }
370
465
  * ```
466
+ *
467
+ * @internal
371
468
  */
372
469
 
373
470
  parseSelectionSet() {
@@ -385,6 +482,8 @@ class Parser {
385
482
  * - Field
386
483
  * - FragmentSpread
387
484
  * - InlineFragment
485
+ *
486
+ * @internal
388
487
  */
389
488
 
390
489
  parseSelection() {
@@ -396,6 +495,8 @@ class Parser {
396
495
  * Field : Alias? Name Arguments? Directives? SelectionSet?
397
496
  *
398
497
  * Alias : Name :
498
+ *
499
+ * @internal
399
500
  */
400
501
 
401
502
  parseField() {
@@ -424,6 +525,8 @@ class Parser {
424
525
  }
425
526
  /**
426
527
  * Arguments[Const] : ( Argument[?Const]+ )
528
+ *
529
+ * @internal
427
530
  */
428
531
 
429
532
  parseArguments(isConst) {
@@ -436,6 +539,8 @@ class Parser {
436
539
  }
437
540
  /**
438
541
  * Argument[Const] : Name : Value[?Const]
542
+ *
543
+ * @internal
439
544
  */
440
545
 
441
546
  parseArgument(isConst = false) {
@@ -459,6 +564,8 @@ class Parser {
459
564
  * FragmentSpread : ... FragmentName Directives?
460
565
  *
461
566
  * InlineFragment : ... TypeCondition? Directives? SelectionSet
567
+ *
568
+ * @internal
462
569
  */
463
570
 
464
571
  parseFragment() {
@@ -486,6 +593,8 @@ class Parser {
486
593
  * - fragment FragmentName on TypeCondition Directives? SelectionSet
487
594
  *
488
595
  * TypeCondition : NamedType
596
+ *
597
+ * @internal
489
598
  */
490
599
 
491
600
  parseFragmentDefinition() {
@@ -518,6 +627,8 @@ class Parser {
518
627
  }
519
628
  /**
520
629
  * FragmentName : Name but not `on`
630
+ *
631
+ * @internal
521
632
  */
522
633
 
523
634
  parseFragmentName() {
@@ -545,6 +656,8 @@ class Parser {
545
656
  * NullValue : `null`
546
657
  *
547
658
  * EnumValue : Name but not `true`, `false` or `null`
659
+ *
660
+ * @internal
548
661
  */
549
662
 
550
663
  parseValueLiteral(isConst) {
@@ -643,6 +756,8 @@ class Parser {
643
756
  * ListValue[Const] :
644
757
  * - [ ]
645
758
  * - [ Value[?Const]+ ]
759
+ *
760
+ * @internal
646
761
  */
647
762
 
648
763
  parseList(isConst) {
@@ -663,6 +778,8 @@ class Parser {
663
778
  * - { }
664
779
  * - { ObjectField[?Const]+ }
665
780
  * ```
781
+ *
782
+ * @internal
666
783
  */
667
784
 
668
785
  parseObject(isConst) {
@@ -679,6 +796,8 @@ class Parser {
679
796
  }
680
797
  /**
681
798
  * ObjectField[Const] : Name : Value[?Const]
799
+ *
800
+ * @internal
682
801
  */
683
802
 
684
803
  parseObjectField(isConst) {
@@ -694,6 +813,8 @@ class Parser {
694
813
 
695
814
  /**
696
815
  * Directives[Const] : Directive[?Const]+
816
+ *
817
+ * @internal
697
818
  */
698
819
 
699
820
  parseDirectives(isConst) {
@@ -713,6 +834,8 @@ class Parser {
713
834
  * ```
714
835
  * Directive[Const] : @ Name Arguments[?Const]?
715
836
  * ```
837
+ *
838
+ * @internal
716
839
  */
717
840
 
718
841
  parseDirective(isConst) {
@@ -730,6 +853,8 @@ class Parser {
730
853
  * - NamedType
731
854
  * - ListType
732
855
  * - NonNullType
856
+ *
857
+ * @internal
733
858
  */
734
859
 
735
860
  parseTypeReference() {
@@ -758,6 +883,8 @@ class Parser {
758
883
  }
759
884
  /**
760
885
  * NamedType : Name
886
+ *
887
+ * @internal
761
888
  */
762
889
 
763
890
  parseNamedType() {
@@ -775,6 +902,8 @@ class Parser {
775
902
  }
776
903
  /**
777
904
  * Description : StringValue
905
+ *
906
+ * @internal
778
907
  */
779
908
 
780
909
  parseDescription() {
@@ -786,6 +915,8 @@ class Parser {
786
915
  * ```
787
916
  * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
788
917
  * ```
918
+ *
919
+ * @internal
789
920
  */
790
921
 
791
922
  parseSchemaDefinition() {
@@ -807,6 +938,8 @@ class Parser {
807
938
  }
808
939
  /**
809
940
  * OperationTypeDefinition : OperationType : NamedType
941
+ *
942
+ * @internal
810
943
  */
811
944
 
812
945
  parseOperationTypeDefinition() {
@@ -822,6 +955,8 @@ class Parser {
822
955
  }
823
956
  /**
824
957
  * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
958
+ *
959
+ * @internal
825
960
  */
826
961
 
827
962
  parseScalarTypeDefinition() {
@@ -841,6 +976,8 @@ class Parser {
841
976
  * ObjectTypeDefinition :
842
977
  * Description?
843
978
  * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
979
+ *
980
+ * @internal
844
981
  */
845
982
 
846
983
  parseObjectTypeDefinition() {
@@ -864,6 +1001,8 @@ class Parser {
864
1001
  * ImplementsInterfaces :
865
1002
  * - implements `&`? NamedType
866
1003
  * - ImplementsInterfaces & NamedType
1004
+ *
1005
+ * @internal
867
1006
  */
868
1007
 
869
1008
  parseImplementsInterfaces() {
@@ -875,6 +1014,8 @@ class Parser {
875
1014
  * ```
876
1015
  * FieldsDefinition : { FieldDefinition+ }
877
1016
  * ```
1017
+ *
1018
+ * @internal
878
1019
  */
879
1020
 
880
1021
  parseFieldsDefinition() {
@@ -887,6 +1028,8 @@ class Parser {
887
1028
  /**
888
1029
  * FieldDefinition :
889
1030
  * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
1031
+ *
1032
+ * @internal
890
1033
  */
891
1034
 
892
1035
  parseFieldDefinition() {
@@ -908,6 +1051,8 @@ class Parser {
908
1051
  }
909
1052
  /**
910
1053
  * ArgumentsDefinition : ( InputValueDefinition+ )
1054
+ *
1055
+ * @internal
911
1056
  */
912
1057
 
913
1058
  parseArgumentDefs() {
@@ -920,6 +1065,8 @@ class Parser {
920
1065
  /**
921
1066
  * InputValueDefinition :
922
1067
  * - Description? Name : Type DefaultValue? Directives[Const]?
1068
+ *
1069
+ * @internal
923
1070
  */
924
1071
 
925
1072
  parseInputValueDef() {
@@ -947,6 +1094,8 @@ class Parser {
947
1094
  /**
948
1095
  * InterfaceTypeDefinition :
949
1096
  * - Description? interface Name Directives[Const]? FieldsDefinition?
1097
+ *
1098
+ * @internal
950
1099
  */
951
1100
 
952
1101
  parseInterfaceTypeDefinition() {
@@ -969,6 +1118,8 @@ class Parser {
969
1118
  /**
970
1119
  * UnionTypeDefinition :
971
1120
  * - Description? union Name Directives[Const]? UnionMemberTypes?
1121
+ *
1122
+ * @internal
972
1123
  */
973
1124
 
974
1125
  parseUnionTypeDefinition() {
@@ -990,6 +1141,8 @@ class Parser {
990
1141
  * UnionMemberTypes :
991
1142
  * - = `|`? NamedType
992
1143
  * - UnionMemberTypes | NamedType
1144
+ *
1145
+ * @internal
993
1146
  */
994
1147
 
995
1148
  parseUnionMemberTypes() {
@@ -1000,6 +1153,8 @@ class Parser {
1000
1153
  /**
1001
1154
  * EnumTypeDefinition :
1002
1155
  * - Description? enum Name Directives[Const]? EnumValuesDefinition?
1156
+ *
1157
+ * @internal
1003
1158
  */
1004
1159
 
1005
1160
  parseEnumTypeDefinition() {
@@ -1021,6 +1176,8 @@ class Parser {
1021
1176
  * ```
1022
1177
  * EnumValuesDefinition : { EnumValueDefinition+ }
1023
1178
  * ```
1179
+ *
1180
+ * @internal
1024
1181
  */
1025
1182
 
1026
1183
  parseEnumValuesDefinition() {
@@ -1032,6 +1189,8 @@ class Parser {
1032
1189
  }
1033
1190
  /**
1034
1191
  * EnumValueDefinition : Description? EnumValue Directives[Const]?
1192
+ *
1193
+ * @internal
1035
1194
  */
1036
1195
 
1037
1196
  parseEnumValueDefinition() {
@@ -1048,6 +1207,8 @@ class Parser {
1048
1207
  }
1049
1208
  /**
1050
1209
  * EnumValue : Name but not `true`, `false` or `null`
1210
+ *
1211
+ * @internal
1051
1212
  */
1052
1213
 
1053
1214
  parseEnumValueName() {
@@ -1070,6 +1231,8 @@ class Parser {
1070
1231
  /**
1071
1232
  * InputObjectTypeDefinition :
1072
1233
  * - Description? input Name Directives[Const]? InputFieldsDefinition?
1234
+ *
1235
+ * @internal
1073
1236
  */
1074
1237
 
1075
1238
  parseInputObjectTypeDefinition() {
@@ -1091,6 +1254,8 @@ class Parser {
1091
1254
  * ```
1092
1255
  * InputFieldsDefinition : { InputValueDefinition+ }
1093
1256
  * ```
1257
+ *
1258
+ * @internal
1094
1259
  */
1095
1260
 
1096
1261
  parseInputFieldsDefinition() {
@@ -1112,6 +1277,9 @@ class Parser {
1112
1277
  * - UnionTypeExtension
1113
1278
  * - EnumTypeExtension
1114
1279
  * - InputObjectTypeDefinition
1280
+ * - DirectiveDefinitionExtension
1281
+ *
1282
+ * @internal
1115
1283
  */
1116
1284
 
1117
1285
  parseTypeSystemExtension() {
@@ -1139,6 +1307,13 @@ class Parser {
1139
1307
 
1140
1308
  case 'input':
1141
1309
  return this.parseInputObjectTypeExtension();
1310
+
1311
+ case 'directive':
1312
+ if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
1313
+ return this.parseDirectiveDefinitionExtension();
1314
+ }
1315
+
1316
+ break;
1142
1317
  }
1143
1318
  }
1144
1319
 
@@ -1150,6 +1325,8 @@ class Parser {
1150
1325
  * - extend schema Directives[Const]? { OperationTypeDefinition+ }
1151
1326
  * - extend schema Directives[Const]
1152
1327
  * ```
1328
+ *
1329
+ * @internal
1153
1330
  */
1154
1331
 
1155
1332
  parseSchemaExtension() {
@@ -1176,6 +1353,8 @@ class Parser {
1176
1353
  /**
1177
1354
  * ScalarTypeExtension :
1178
1355
  * - extend scalar Name Directives[Const]
1356
+ *
1357
+ * @internal
1179
1358
  */
1180
1359
 
1181
1360
  parseScalarTypeExtension() {
@@ -1200,6 +1379,8 @@ class Parser {
1200
1379
  * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1201
1380
  * - extend type Name ImplementsInterfaces? Directives[Const]
1202
1381
  * - extend type Name ImplementsInterfaces
1382
+ *
1383
+ * @internal
1203
1384
  */
1204
1385
 
1205
1386
  parseObjectTypeExtension() {
@@ -1232,6 +1413,8 @@ class Parser {
1232
1413
  * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1233
1414
  * - extend interface Name ImplementsInterfaces? Directives[Const]
1234
1415
  * - extend interface Name ImplementsInterfaces
1416
+ *
1417
+ * @internal
1235
1418
  */
1236
1419
 
1237
1420
  parseInterfaceTypeExtension() {
@@ -1263,6 +1446,8 @@ class Parser {
1263
1446
  * UnionTypeExtension :
1264
1447
  * - extend union Name Directives[Const]? UnionMemberTypes
1265
1448
  * - extend union Name Directives[Const]
1449
+ *
1450
+ * @internal
1266
1451
  */
1267
1452
 
1268
1453
  parseUnionTypeExtension() {
@@ -1288,6 +1473,8 @@ class Parser {
1288
1473
  * EnumTypeExtension :
1289
1474
  * - extend enum Name Directives[Const]? EnumValuesDefinition
1290
1475
  * - extend enum Name Directives[Const]
1476
+ *
1477
+ * @internal
1291
1478
  */
1292
1479
 
1293
1480
  parseEnumTypeExtension() {
@@ -1313,6 +1500,8 @@ class Parser {
1313
1500
  * InputObjectTypeExtension :
1314
1501
  * - extend input Name Directives[Const]? InputFieldsDefinition
1315
1502
  * - extend input Name Directives[Const]
1503
+ *
1504
+ * @internal
1316
1505
  */
1317
1506
 
1318
1507
  parseInputObjectTypeExtension() {
@@ -1334,11 +1523,32 @@ class Parser {
1334
1523
  fields,
1335
1524
  });
1336
1525
  }
1526
+
1527
+ parseDirectiveDefinitionExtension() {
1528
+ const start = this._lexer.token;
1529
+ this.expectKeyword('extend');
1530
+ this.expectKeyword('directive');
1531
+ this.expectToken(_tokenKind.TokenKind.AT);
1532
+ const name = this.parseName();
1533
+ const directives = this.parseConstDirectives();
1534
+
1535
+ if (directives.length === 0) {
1536
+ throw this.unexpected();
1537
+ }
1538
+
1539
+ return this.node(start, {
1540
+ kind: _kinds.Kind.DIRECTIVE_EXTENSION,
1541
+ name,
1542
+ directives,
1543
+ });
1544
+ }
1337
1545
  /**
1338
1546
  * ```
1339
1547
  * DirectiveDefinition :
1340
1548
  * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
1341
1549
  * ```
1550
+ *
1551
+ * @internal
1342
1552
  */
1343
1553
 
1344
1554
  parseDirectiveDefinition() {
@@ -1348,6 +1558,10 @@ class Parser {
1348
1558
  this.expectToken(_tokenKind.TokenKind.AT);
1349
1559
  const name = this.parseName();
1350
1560
  const args = this.parseArgumentDefs();
1561
+ const directives = this._options
1562
+ .experimentalDirectivesOnDirectiveDefinitions
1563
+ ? this.parseConstDirectives()
1564
+ : [];
1351
1565
  const repeatable = this.expectOptionalKeyword('repeatable');
1352
1566
  this.expectKeyword('on');
1353
1567
  const locations = this.parseDirectiveLocations();
@@ -1356,6 +1570,7 @@ class Parser {
1356
1570
  description,
1357
1571
  name,
1358
1572
  arguments: args,
1573
+ directives,
1359
1574
  repeatable,
1360
1575
  locations,
1361
1576
  });
@@ -1364,6 +1579,8 @@ class Parser {
1364
1579
  * DirectiveLocations :
1365
1580
  * - `|`? DirectiveLocation
1366
1581
  * - DirectiveLocations | DirectiveLocation
1582
+ *
1583
+ * @internal
1367
1584
  */
1368
1585
 
1369
1586
  parseDirectiveLocations() {
@@ -1398,6 +1615,7 @@ class Parser {
1398
1615
  * `ENUM_VALUE`
1399
1616
  * `INPUT_OBJECT`
1400
1617
  * `INPUT_FIELD_DEFINITION`
1618
+ * `DIRECTIVE_DEFINITION`
1401
1619
  */
1402
1620
 
1403
1621
  parseDirectiveLocation() {
@@ -1423,6 +1641,19 @@ class Parser {
1423
1641
  * - Name . Name ( Name : )
1424
1642
  * - \@ Name
1425
1643
  * - \@ Name ( Name : )
1644
+ * @returns Parsed schema coordinate AST.
1645
+ * @example
1646
+ * ```ts
1647
+ * import { Parser, Source } from 'graphql/language';
1648
+ *
1649
+ * const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
1650
+ * const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
1651
+ *
1652
+ * typeCoordinate.name.value; // => 'User'
1653
+ * typeCoordinate.memberName?.value; // => 'name'
1654
+ * directiveCoordinate.name.value; // => 'deprecated'
1655
+ * directiveCoordinate.argumentName?.value; // => 'reason'
1656
+ * ```
1426
1657
  */
1427
1658
 
1428
1659
  parseSchemaCoordinate() {
@@ -1486,6 +1717,8 @@ class Parser {
1486
1717
  * Returns a node that, if configured to do so, sets a "loc" field as a
1487
1718
  * location object, used to identify the place in the source that created a
1488
1719
  * given parsed object.
1720
+ *
1721
+ * @internal
1489
1722
  */
1490
1723
 
1491
1724
  node(startToken, node) {
@@ -1501,6 +1734,8 @@ class Parser {
1501
1734
  }
1502
1735
  /**
1503
1736
  * Determines if the next token is of a given kind
1737
+ *
1738
+ * @internal
1504
1739
  */
1505
1740
 
1506
1741
  peek(kind) {
@@ -1509,6 +1744,8 @@ class Parser {
1509
1744
  /**
1510
1745
  * If the next token is of the given kind, return that token after advancing the lexer.
1511
1746
  * Otherwise, do not change the parser state and throw an error.
1747
+ *
1748
+ * @internal
1512
1749
  */
1513
1750
 
1514
1751
  expectToken(kind) {
@@ -1528,6 +1765,8 @@ class Parser {
1528
1765
  /**
1529
1766
  * If the next token is of the given kind, return "true" after advancing the lexer.
1530
1767
  * Otherwise, do not change the parser state and return "false".
1768
+ *
1769
+ * @internal
1531
1770
  */
1532
1771
 
1533
1772
  expectOptionalToken(kind) {
@@ -1543,6 +1782,8 @@ class Parser {
1543
1782
  /**
1544
1783
  * If the next token is a given keyword, advance the lexer.
1545
1784
  * Otherwise, do not change the parser state and throw an error.
1785
+ *
1786
+ * @internal
1546
1787
  */
1547
1788
 
1548
1789
  expectKeyword(value) {
@@ -1561,6 +1802,8 @@ class Parser {
1561
1802
  /**
1562
1803
  * If the next token is a given keyword, return "true" after advancing the lexer.
1563
1804
  * Otherwise, do not change the parser state and return "false".
1805
+ *
1806
+ * @internal
1564
1807
  */
1565
1808
 
1566
1809
  expectOptionalKeyword(value) {
@@ -1575,6 +1818,8 @@ class Parser {
1575
1818
  }
1576
1819
  /**
1577
1820
  * Helper function for creating an error when an unexpected lexed token is encountered.
1821
+ *
1822
+ * @internal
1578
1823
  */
1579
1824
 
1580
1825
  unexpected(atToken) {
@@ -1590,6 +1835,8 @@ class Parser {
1590
1835
  * Returns a possibly empty list of parse nodes, determined by the parseFn.
1591
1836
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
1592
1837
  * Advances the parser to the next lex token after the closing token.
1838
+ *
1839
+ * @internal
1593
1840
  */
1594
1841
 
1595
1842
  any(openKind, parseFn, closeKind) {
@@ -1607,6 +1854,8 @@ class Parser {
1607
1854
  * It can be empty only if open token is missing otherwise it will always return non-empty list
1608
1855
  * that begins with a lex token of openKind and ends with a lex token of closeKind.
1609
1856
  * Advances the parser to the next lex token after the closing token.
1857
+ *
1858
+ * @internal
1610
1859
  */
1611
1860
 
1612
1861
  optionalMany(openKind, parseFn, closeKind) {
@@ -1626,6 +1875,8 @@ class Parser {
1626
1875
  * Returns a non-empty list of parse nodes, determined by the parseFn.
1627
1876
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
1628
1877
  * Advances the parser to the next lex token after the closing token.
1878
+ *
1879
+ * @internal
1629
1880
  */
1630
1881
 
1631
1882
  many(openKind, parseFn, closeKind) {
@@ -1642,6 +1893,8 @@ class Parser {
1642
1893
  * Returns a non-empty list of parse nodes, determined by the parseFn.
1643
1894
  * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
1644
1895
  * Advances the parser to the next lex token after last item in the list.
1896
+ *
1897
+ * @internal
1645
1898
  */
1646
1899
 
1647
1900
  delimitedMany(delimiterKind, parseFn) {
@@ -1675,6 +1928,8 @@ class Parser {
1675
1928
  }
1676
1929
  /**
1677
1930
  * A helper function to describe a token as a string for debugging.
1931
+ *
1932
+ * @internal
1678
1933
  */
1679
1934
 
1680
1935
  exports.Parser = Parser;
@@ -1685,6 +1940,8 @@ function getTokenDesc(token) {
1685
1940
  }
1686
1941
  /**
1687
1942
  * A helper function to describe a token kind as a string for debugging.
1943
+ *
1944
+ * @internal
1688
1945
  */
1689
1946
 
1690
1947
  function getTokenKindDesc(kind) {