@stonecrop/casl-middleware 0.16.2 → 0.16.3

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.
@@ -118,6 +118,29 @@ spurious results.`);
118
118
  }
119
119
  );
120
120
  class W {
121
+ /** The GraphQL source text. */
122
+ /** Name used in diagnostics for this source, such as a file path or request name. */
123
+ /** One-indexed line and column where this source begins. */
124
+ /**
125
+ * Creates a Source instance.
126
+ * @param body - The GraphQL source text.
127
+ * @param name - Name used in diagnostics for this source.
128
+ * @param locationOffset - One-indexed line and column where this source begins.
129
+ * @example
130
+ * ```ts
131
+ * import { Source } from 'graphql/language';
132
+ *
133
+ * const source = new Source(
134
+ * 'type Query { greeting: String }',
135
+ * 'schema.graphql',
136
+ * { line: 10, column: 1 },
137
+ * );
138
+ *
139
+ * source.body; // => 'type Query { greeting: String }'
140
+ * source.name; // => 'schema.graphql'
141
+ * source.locationOffset; // => { line: 10, column: 1 }
142
+ * ```
143
+ */
121
144
  constructor(t, n = "GraphQL request", s = {
122
145
  line: 1,
123
146
  column: 1
@@ -130,6 +153,10 @@ class W {
130
153
  "column in locationOffset is 1-indexed and must be positive."
131
154
  );
132
155
  }
156
+ /**
157
+ * Returns the value used by `Object.prototype.toString`.
158
+ * @returns The built-in string tag for this object.
159
+ */
133
160
  get [Symbol.toStringTag]() {
134
161
  return "Source";
135
162
  }
@@ -228,9 +255,7 @@ class B extends Error {
228
255
  *
229
256
  * Enumerable, and appears in the result of JSON.stringify().
230
257
  */
231
- /**
232
- * An array of GraphQL AST Nodes corresponding to this error.
233
- */
258
+ /** An array of GraphQL AST Nodes corresponding to this error. */
234
259
  /**
235
260
  * The source GraphQL document for the first location of this error.
236
261
  *
@@ -241,13 +266,89 @@ class B extends Error {
241
266
  * An array of character offsets within the source GraphQL document
242
267
  * which correspond to this error.
243
268
  */
244
- /**
245
- * The original error thrown from a field resolver during execution.
246
- */
247
- /**
248
- * Extension fields to add to the formatted error.
269
+ /** Original error that caused this GraphQLError, if one exists. */
270
+ /** Extension fields to add to the formatted error. */
271
+ /**
272
+ * Creates a GraphQLError instance.
273
+ * @param message - Human-readable error message.
274
+ * @param options - Error metadata such as source locations, response path, original error, and extensions.
275
+ * This positional-arguments constructor overload is deprecated. Use the
276
+ * `GraphQLError(message, options)` overload instead.
277
+ * @example
278
+ * ```ts
279
+ * // Create an error from AST nodes and response metadata.
280
+ * import { parse } from 'graphql/language';
281
+ * import { GraphQLError } from 'graphql/error';
282
+ *
283
+ * const document = parse('{ greeting }');
284
+ * const fieldNode = document.definitions[0].selectionSet.selections[0];
285
+ * const error = new GraphQLError('Cannot query this field.', {
286
+ * nodes: fieldNode,
287
+ * path: ['greeting'],
288
+ * extensions: { code: 'FORBIDDEN' },
289
+ * });
290
+ *
291
+ * error.message; // => 'Cannot query this field.'
292
+ * error.locations; // => [{ line: 1, column: 3 }]
293
+ * error.path; // => ['greeting']
294
+ * error.extensions; // => { code: 'FORBIDDEN' }
295
+ * ```
296
+ * @example
297
+ * ```ts
298
+ * // This variant derives locations from source positions and preserves the original error.
299
+ * import { Source } from 'graphql/language';
300
+ * import { GraphQLError } from 'graphql/error';
301
+ *
302
+ * const source = new Source('{ greeting }');
303
+ * const originalError = new Error('Database unavailable.');
304
+ * const error = new GraphQLError('Resolver failed.', {
305
+ * source,
306
+ * positions: [2],
307
+ * path: ['greeting'],
308
+ * originalError,
309
+ * });
310
+ *
311
+ * error.locations; // => [{ line: 1, column: 3 }]
312
+ * error.path; // => ['greeting']
313
+ * error.originalError; // => originalError
314
+ * ```
249
315
  */
250
316
  /**
317
+ * Creates a GraphQLError instance using the legacy positional constructor.
318
+ * This deprecated overload will be removed in v17. Prefer the
319
+ * `GraphQLErrorOptions` object overload, which keeps optional error metadata
320
+ * in a single options bag.
321
+ * @param message - Human-readable error message.
322
+ * @param nodes - AST node or nodes associated with this error.
323
+ * @param source - Source document used to derive error locations.
324
+ * @param positions - Character offsets in the source document associated with
325
+ * this error.
326
+ * @param path - Response path where this error occurred during execution.
327
+ * @param originalError - Original error that caused this GraphQLError, if one
328
+ * exists.
329
+ * @param extensions - Extension fields to include in the formatted error.
330
+ * @example
331
+ * ```ts
332
+ * import { Source } from 'graphql/language';
333
+ * import { GraphQLError } from 'graphql/error';
334
+ *
335
+ * const source = new Source('{ greeting }');
336
+ * const originalError = new Error('Database unavailable.');
337
+ * const error = new GraphQLError(
338
+ * 'Resolver failed.',
339
+ * undefined,
340
+ * source,
341
+ * [2],
342
+ * ['greeting'],
343
+ * originalError,
344
+ * { code: 'INTERNAL' },
345
+ * );
346
+ *
347
+ * error.locations; // => [{ line: 1, column: 3 }]
348
+ * error.path; // => ['greeting']
349
+ * error.originalError; // => originalError
350
+ * error.extensions; // => { code: 'INTERNAL' }
351
+ * ```
251
352
  * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
252
353
  */
253
354
  constructor(t, ...n) {
@@ -293,9 +394,29 @@ class B extends Error {
293
394
  configurable: !0
294
395
  });
295
396
  }
397
+ /**
398
+ * Returns the value used by `Object.prototype.toString`.
399
+ * @returns The built-in string tag for this object.
400
+ */
296
401
  get [Symbol.toStringTag]() {
297
402
  return "GraphQLError";
298
403
  }
404
+ /**
405
+ * Returns this error as a human-readable message with source locations.
406
+ * @returns The formatted error string.
407
+ * @example
408
+ * ```ts
409
+ * import { Source } from 'graphql/language';
410
+ * import { GraphQLError } from 'graphql/error';
411
+ *
412
+ * const error = new GraphQLError('Cannot query field "name".', {
413
+ * source: new Source('{ name }'),
414
+ * positions: [2],
415
+ * });
416
+ *
417
+ * error.toString(); // => 'Cannot query field "name".\n\nGraphQL request:1:3\n1 | { name }\n | ^'
418
+ * ```
419
+ */
299
420
  toString() {
300
421
  let t = this.message;
301
422
  if (this.nodes)
@@ -310,6 +431,21 @@ class B extends Error {
310
431
  ` + Z(this.source, n);
311
432
  return t;
312
433
  }
434
+ /**
435
+ * Returns the JSON representation used when this object is serialized.
436
+ * @returns The JSON-serializable representation.
437
+ * @example
438
+ * ```ts
439
+ * import { GraphQLError } from 'graphql/error';
440
+ *
441
+ * const error = new GraphQLError('Resolver failed.', {
442
+ * path: ['viewer', 'name'],
443
+ * extensions: { code: 'INTERNAL' },
444
+ * });
445
+ *
446
+ * error.toJSON(); // => { message: 'Resolver failed.', path: ['viewer', 'name'], extensions: { code: 'INTERNAL' } }
447
+ * ```
448
+ */
313
449
  toJSON() {
314
450
  const t = {
315
451
  message: this.message
@@ -327,27 +463,53 @@ function T(e, t, n) {
327
463
  });
328
464
  }
329
465
  class Se {
330
- /**
331
- * The character offset at which this Node begins.
332
- */
333
- /**
334
- * The character offset at which this Node ends.
335
- */
336
- /**
337
- * The Token at which this Node begins.
338
- */
339
- /**
340
- * The Token at which this Node ends.
341
- */
342
- /**
343
- * The Source document the AST represents.
466
+ /** The character offset at which this Node begins. */
467
+ /** The character offset at which this Node ends. */
468
+ /** The Token at which this Node begins. */
469
+ /** The Token at which this Node ends. */
470
+ /** The Source document the AST represents. */
471
+ /**
472
+ * Creates a Location instance.
473
+ * @param startToken - The start token.
474
+ * @param endToken - The end token.
475
+ * @param source - Source document used to derive error locations.
476
+ * @example
477
+ * ```ts
478
+ * import { Location, Source, Token, TokenKind } from 'graphql/language';
479
+ *
480
+ * const source = new Source('{ hello }');
481
+ * const startToken = new Token(TokenKind.BRACE_L, 0, 1, 1, 1);
482
+ * const endToken = new Token(TokenKind.BRACE_R, 8, 9, 1, 9);
483
+ * const location = new Location(startToken, endToken, source);
484
+ *
485
+ * location.start; // => 0
486
+ * location.end; // => 9
487
+ * location.source.body; // => '{ hello }'
488
+ * ```
344
489
  */
345
490
  constructor(t, n, s) {
346
491
  this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = s;
347
492
  }
493
+ /**
494
+ * Returns the value used by `Object.prototype.toString`.
495
+ * @returns The built-in string tag for this object.
496
+ */
348
497
  get [Symbol.toStringTag]() {
349
498
  return "Location";
350
499
  }
500
+ /**
501
+ * Returns a JSON representation of this location.
502
+ * @returns The JSON-serializable representation.
503
+ * @example
504
+ * ```ts
505
+ * import { parse } from 'graphql/language';
506
+ *
507
+ * const document = parse('{ hello }');
508
+ * const location = document.loc?.toJSON();
509
+ *
510
+ * location; // => { start: 0, end: 9 }
511
+ * ```
512
+ */
351
513
  toJSON() {
352
514
  return {
353
515
  start: this.start,
@@ -356,21 +518,11 @@ class Se {
356
518
  }
357
519
  }
358
520
  class K {
359
- /**
360
- * The kind of Token.
361
- */
362
- /**
363
- * The character offset at which this Node begins.
364
- */
365
- /**
366
- * The character offset at which this Node ends.
367
- */
368
- /**
369
- * The 1-indexed line number on which this Token appears.
370
- */
371
- /**
372
- * The 1-indexed column number at which this Token begins.
373
- */
521
+ /** The kind of Token. */
522
+ /** The character offset at which this Node begins. */
523
+ /** The character offset at which this Node ends. */
524
+ /** The 1-indexed line number on which this Token appears. */
525
+ /** The 1-indexed column number at which this Token begins. */
374
526
  /**
375
527
  * For non-punctuation tokens, represents the interpreted value of the token.
376
528
  *
@@ -382,12 +534,49 @@ class K {
382
534
  * including ignored tokens. <SOF> is always the first node and <EOF>
383
535
  * the last.
384
536
  */
537
+ /** Next token in the token stream, including ignored tokens. */
538
+ /**
539
+ * Creates a Token instance.
540
+ * @param kind - Token kind produced by lexical analysis.
541
+ * @param start - Character offset where this token begins.
542
+ * @param end - Character offset where this token ends.
543
+ * @param line - One-indexed line number where this token begins.
544
+ * @param column - One-indexed column number where this token begins.
545
+ * @param value - Interpreted value for non-punctuation tokens.
546
+ * @example
547
+ * ```ts
548
+ * import { Token, TokenKind } from 'graphql/language';
549
+ *
550
+ * const token = new Token(TokenKind.NAME, 2, 7, 1, 3, 'hello');
551
+ *
552
+ * token.kind; // => TokenKind.NAME
553
+ * token.value; // => 'hello'
554
+ * token.toJSON(); // => { kind: 'Name', value: 'hello', line: 1, column: 3 }
555
+ * ```
556
+ */
385
557
  constructor(t, n, s, i, r, a) {
386
558
  this.kind = t, this.start = n, this.end = s, this.line = i, this.column = r, this.value = a, this.prev = null, this.next = null;
387
559
  }
560
+ /**
561
+ * Returns the value used by `Object.prototype.toString`.
562
+ * @returns The built-in string tag for this object.
563
+ */
388
564
  get [Symbol.toStringTag]() {
389
565
  return "Token";
390
566
  }
567
+ /**
568
+ * Returns a JSON representation of this token.
569
+ * @returns The JSON-serializable representation.
570
+ * @example
571
+ * ```ts
572
+ * import { Lexer, Source } from 'graphql/language';
573
+ *
574
+ * const lexer = new Lexer(new Source('{ hello }'));
575
+ * const token = lexer.advance().toJSON();
576
+ *
577
+ * token; // => { kind: '{', value: undefined, line: 1, column: 1 }
578
+ * ```
579
+ */
391
580
  toJSON() {
392
581
  return {
393
582
  kind: this.kind,
@@ -536,27 +725,50 @@ function Fe(e) {
536
725
  return t;
537
726
  }
538
727
  class we {
539
- /**
540
- * The previously focused non-ignored token.
541
- */
542
- /**
543
- * The currently focused non-ignored token.
544
- */
545
- /**
546
- * The (1-indexed) line containing the current token.
547
- */
548
- /**
549
- * The character offset at which the current line begins.
728
+ /** Source document used to derive error locations. */
729
+ /** Most recent non-ignored token returned by the lexer. */
730
+ /** Current non-ignored token at the lexer cursor. */
731
+ /** The (1-indexed) line containing the current token. */
732
+ /** Character offset where the current line starts. */
733
+ /**
734
+ * Creates a Lexer instance.
735
+ * @param source - Source document used to derive error locations.
736
+ * @example
737
+ * ```ts
738
+ * import { Lexer, Source, TokenKind } from 'graphql/language';
739
+ *
740
+ * const lexer = new Lexer(new Source('{ hello }'));
741
+ *
742
+ * lexer.token.kind; // => TokenKind.SOF
743
+ * lexer.advance().kind; // => TokenKind.BRACE_L
744
+ * lexer.advance().value; // => 'hello'
745
+ * lexer.advance().kind; // => TokenKind.BRACE_R
746
+ * ```
550
747
  */
551
748
  constructor(t) {
552
749
  const n = new K(o.SOF, 0, 0, 0, 0);
553
750
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
554
751
  }
752
+ /**
753
+ * Returns the value used by `Object.prototype.toString`.
754
+ * @returns The built-in string tag for this object.
755
+ */
555
756
  get [Symbol.toStringTag]() {
556
757
  return "Lexer";
557
758
  }
558
759
  /**
559
760
  * Advances the token stream to the next non-ignored token.
761
+ * @returns The next non-ignored token.
762
+ * @example
763
+ * ```ts
764
+ * import { Lexer, Source } from 'graphql/language';
765
+ *
766
+ * const lexer = new Lexer(new Source('{ hello }'));
767
+ * const token = lexer.advance();
768
+ *
769
+ * token.kind; // => '{'
770
+ * lexer.token; // => token
771
+ * ```
560
772
  */
561
773
  advance() {
562
774
  return this.lastToken = this.token, this.token = this.lookahead();
@@ -564,6 +776,17 @@ class we {
564
776
  /**
565
777
  * Looks ahead and returns the next non-ignored token, but does not change
566
778
  * the state of Lexer.
779
+ * @returns The next non-ignored token without advancing the lexer.
780
+ * @example
781
+ * ```ts
782
+ * import { Lexer, Source } from 'graphql/language';
783
+ *
784
+ * const lexer = new Lexer(new Source('{ hello }'));
785
+ * const token = lexer.lookahead();
786
+ *
787
+ * token.kind; // => '{'
788
+ * lexer.token.kind; // => '<SOF>'
789
+ * ```
567
790
  */
568
791
  lookahead() {
569
792
  let t = this.token;
@@ -999,6 +1222,8 @@ class Xe {
999
1222
  }
1000
1223
  /**
1001
1224
  * Converts a name lex token into a name parse node.
1225
+ *
1226
+ * @internal
1002
1227
  */
1003
1228
  parseName() {
1004
1229
  const t = this.expectToken(o.NAME);
@@ -1010,6 +1235,8 @@ class Xe {
1010
1235
  // Implements the parsing rules in the Document section.
1011
1236
  /**
1012
1237
  * Document : Definition+
1238
+ *
1239
+ * @internal
1013
1240
  */
1014
1241
  parseDocument() {
1015
1242
  return this.node(this._lexer.token, {
@@ -1043,6 +1270,8 @@ class Xe {
1043
1270
  * - UnionTypeDefinition
1044
1271
  * - EnumTypeDefinition
1045
1272
  * - InputObjectTypeDefinition
1273
+ *
1274
+ * @internal
1046
1275
  */
1047
1276
  parseDefinition() {
1048
1277
  if (this.peek(o.BRACE_L))
@@ -1097,6 +1326,8 @@ class Xe {
1097
1326
  * OperationDefinition :
1098
1327
  * - SelectionSet
1099
1328
  * - OperationType Name? VariableDefinitions? Directives? SelectionSet
1329
+ *
1330
+ * @internal
1100
1331
  */
1101
1332
  parseOperationDefinition() {
1102
1333
  const t = this._lexer.token;
@@ -1124,6 +1355,8 @@ class Xe {
1124
1355
  }
1125
1356
  /**
1126
1357
  * OperationType : one of query mutation subscription
1358
+ *
1359
+ * @internal
1127
1360
  */
1128
1361
  parseOperationType() {
1129
1362
  const t = this.expectToken(o.NAME);
@@ -1139,6 +1372,8 @@ class Xe {
1139
1372
  }
1140
1373
  /**
1141
1374
  * VariableDefinitions : ( VariableDefinition+ )
1375
+ *
1376
+ * @internal
1142
1377
  */
1143
1378
  parseVariableDefinitions() {
1144
1379
  return this.optionalMany(
@@ -1149,6 +1384,8 @@ class Xe {
1149
1384
  }
1150
1385
  /**
1151
1386
  * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
1387
+ *
1388
+ * @internal
1152
1389
  */
1153
1390
  parseVariableDefinition() {
1154
1391
  return this.node(this._lexer.token, {
@@ -1162,6 +1399,8 @@ class Xe {
1162
1399
  }
1163
1400
  /**
1164
1401
  * Variable : $ Name
1402
+ *
1403
+ * @internal
1165
1404
  */
1166
1405
  parseVariable() {
1167
1406
  const t = this._lexer.token;
@@ -1174,6 +1413,8 @@ class Xe {
1174
1413
  * ```
1175
1414
  * SelectionSet : { Selection+ }
1176
1415
  * ```
1416
+ *
1417
+ * @internal
1177
1418
  */
1178
1419
  parseSelectionSet() {
1179
1420
  return this.node(this._lexer.token, {
@@ -1190,6 +1431,8 @@ class Xe {
1190
1431
  * - Field
1191
1432
  * - FragmentSpread
1192
1433
  * - InlineFragment
1434
+ *
1435
+ * @internal
1193
1436
  */
1194
1437
  parseSelection() {
1195
1438
  return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
@@ -1198,6 +1441,8 @@ class Xe {
1198
1441
  * Field : Alias? Name Arguments? Directives? SelectionSet?
1199
1442
  *
1200
1443
  * Alias : Name :
1444
+ *
1445
+ * @internal
1201
1446
  */
1202
1447
  parseField() {
1203
1448
  const t = this._lexer.token, n = this.parseName();
@@ -1213,6 +1458,8 @@ class Xe {
1213
1458
  }
1214
1459
  /**
1215
1460
  * Arguments[Const] : ( Argument[?Const]+ )
1461
+ *
1462
+ * @internal
1216
1463
  */
1217
1464
  parseArguments(t) {
1218
1465
  const n = t ? this.parseConstArgument : this.parseArgument;
@@ -1220,6 +1467,8 @@ class Xe {
1220
1467
  }
1221
1468
  /**
1222
1469
  * Argument[Const] : Name : Value[?Const]
1470
+ *
1471
+ * @internal
1223
1472
  */
1224
1473
  parseArgument(t = !1) {
1225
1474
  const n = this._lexer.token, s = this.parseName();
@@ -1239,6 +1488,8 @@ class Xe {
1239
1488
  * FragmentSpread : ... FragmentName Directives?
1240
1489
  *
1241
1490
  * InlineFragment : ... TypeCondition? Directives? SelectionSet
1491
+ *
1492
+ * @internal
1242
1493
  */
1243
1494
  parseFragment() {
1244
1495
  const t = this._lexer.token;
@@ -1260,6 +1511,8 @@ class Xe {
1260
1511
  * - fragment FragmentName on TypeCondition Directives? SelectionSet
1261
1512
  *
1262
1513
  * TypeCondition : NamedType
1514
+ *
1515
+ * @internal
1263
1516
  */
1264
1517
  parseFragmentDefinition() {
1265
1518
  const t = this._lexer.token, n = this.parseDescription();
@@ -1282,6 +1535,8 @@ class Xe {
1282
1535
  }
1283
1536
  /**
1284
1537
  * FragmentName : Name but not `on`
1538
+ *
1539
+ * @internal
1285
1540
  */
1286
1541
  parseFragmentName() {
1287
1542
  if (this._lexer.token.value === "on")
@@ -1306,6 +1561,8 @@ class Xe {
1306
1561
  * NullValue : `null`
1307
1562
  *
1308
1563
  * EnumValue : Name but not `true`, `false` or `null`
1564
+ *
1565
+ * @internal
1309
1566
  */
1310
1567
  parseValueLiteral(t) {
1311
1568
  const n = this._lexer.token;
@@ -1380,6 +1637,8 @@ class Xe {
1380
1637
  * ListValue[Const] :
1381
1638
  * - [ ]
1382
1639
  * - [ Value[?Const]+ ]
1640
+ *
1641
+ * @internal
1383
1642
  */
1384
1643
  parseList(t) {
1385
1644
  const n = () => this.parseValueLiteral(t);
@@ -1394,6 +1653,8 @@ class Xe {
1394
1653
  * - { }
1395
1654
  * - { ObjectField[?Const]+ }
1396
1655
  * ```
1656
+ *
1657
+ * @internal
1397
1658
  */
1398
1659
  parseObject(t) {
1399
1660
  const n = () => this.parseObjectField(t);
@@ -1404,6 +1665,8 @@ class Xe {
1404
1665
  }
1405
1666
  /**
1406
1667
  * ObjectField[Const] : Name : Value[?Const]
1668
+ *
1669
+ * @internal
1407
1670
  */
1408
1671
  parseObjectField(t) {
1409
1672
  const n = this._lexer.token, s = this.parseName();
@@ -1416,6 +1679,8 @@ class Xe {
1416
1679
  // Implements the parsing rules in the Directives section.
1417
1680
  /**
1418
1681
  * Directives[Const] : Directive[?Const]+
1682
+ *
1683
+ * @internal
1419
1684
  */
1420
1685
  parseDirectives(t) {
1421
1686
  const n = [];
@@ -1430,6 +1695,8 @@ class Xe {
1430
1695
  * ```
1431
1696
  * Directive[Const] : @ Name Arguments[?Const]?
1432
1697
  * ```
1698
+ *
1699
+ * @internal
1433
1700
  */
1434
1701
  parseDirective(t) {
1435
1702
  const n = this._lexer.token;
@@ -1445,6 +1712,8 @@ class Xe {
1445
1712
  * - NamedType
1446
1713
  * - ListType
1447
1714
  * - NonNullType
1715
+ *
1716
+ * @internal
1448
1717
  */
1449
1718
  parseTypeReference() {
1450
1719
  const t = this._lexer.token;
@@ -1464,6 +1733,8 @@ class Xe {
1464
1733
  }
1465
1734
  /**
1466
1735
  * NamedType : Name
1736
+ *
1737
+ * @internal
1467
1738
  */
1468
1739
  parseNamedType() {
1469
1740
  return this.node(this._lexer.token, {
@@ -1477,6 +1748,8 @@ class Xe {
1477
1748
  }
1478
1749
  /**
1479
1750
  * Description : StringValue
1751
+ *
1752
+ * @internal
1480
1753
  */
1481
1754
  parseDescription() {
1482
1755
  if (this.peekDescription())
@@ -1486,6 +1759,8 @@ class Xe {
1486
1759
  * ```
1487
1760
  * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
1488
1761
  * ```
1762
+ *
1763
+ * @internal
1489
1764
  */
1490
1765
  parseSchemaDefinition() {
1491
1766
  const t = this._lexer.token, n = this.parseDescription();
@@ -1504,6 +1779,8 @@ class Xe {
1504
1779
  }
1505
1780
  /**
1506
1781
  * OperationTypeDefinition : OperationType : NamedType
1782
+ *
1783
+ * @internal
1507
1784
  */
1508
1785
  parseOperationTypeDefinition() {
1509
1786
  const t = this._lexer.token, n = this.parseOperationType();
@@ -1517,6 +1794,8 @@ class Xe {
1517
1794
  }
1518
1795
  /**
1519
1796
  * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
1797
+ *
1798
+ * @internal
1520
1799
  */
1521
1800
  parseScalarTypeDefinition() {
1522
1801
  const t = this._lexer.token, n = this.parseDescription();
@@ -1533,6 +1812,8 @@ class Xe {
1533
1812
  * ObjectTypeDefinition :
1534
1813
  * Description?
1535
1814
  * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
1815
+ *
1816
+ * @internal
1536
1817
  */
1537
1818
  parseObjectTypeDefinition() {
1538
1819
  const t = this._lexer.token, n = this.parseDescription();
@@ -1551,6 +1832,8 @@ class Xe {
1551
1832
  * ImplementsInterfaces :
1552
1833
  * - implements `&`? NamedType
1553
1834
  * - ImplementsInterfaces & NamedType
1835
+ *
1836
+ * @internal
1554
1837
  */
1555
1838
  parseImplementsInterfaces() {
1556
1839
  return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
@@ -1559,6 +1842,8 @@ class Xe {
1559
1842
  * ```
1560
1843
  * FieldsDefinition : { FieldDefinition+ }
1561
1844
  * ```
1845
+ *
1846
+ * @internal
1562
1847
  */
1563
1848
  parseFieldsDefinition() {
1564
1849
  return this.optionalMany(
@@ -1570,6 +1855,8 @@ class Xe {
1570
1855
  /**
1571
1856
  * FieldDefinition :
1572
1857
  * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
1858
+ *
1859
+ * @internal
1573
1860
  */
1574
1861
  parseFieldDefinition() {
1575
1862
  const t = this._lexer.token, n = this.parseDescription(), s = this.parseName(), i = this.parseArgumentDefs();
@@ -1586,6 +1873,8 @@ class Xe {
1586
1873
  }
1587
1874
  /**
1588
1875
  * ArgumentsDefinition : ( InputValueDefinition+ )
1876
+ *
1877
+ * @internal
1589
1878
  */
1590
1879
  parseArgumentDefs() {
1591
1880
  return this.optionalMany(
@@ -1597,6 +1886,8 @@ class Xe {
1597
1886
  /**
1598
1887
  * InputValueDefinition :
1599
1888
  * - Description? Name : Type DefaultValue? Directives[Const]?
1889
+ *
1890
+ * @internal
1600
1891
  */
1601
1892
  parseInputValueDef() {
1602
1893
  const t = this._lexer.token, n = this.parseDescription(), s = this.parseName();
@@ -1617,6 +1908,8 @@ class Xe {
1617
1908
  /**
1618
1909
  * InterfaceTypeDefinition :
1619
1910
  * - Description? interface Name Directives[Const]? FieldsDefinition?
1911
+ *
1912
+ * @internal
1620
1913
  */
1621
1914
  parseInterfaceTypeDefinition() {
1622
1915
  const t = this._lexer.token, n = this.parseDescription();
@@ -1634,6 +1927,8 @@ class Xe {
1634
1927
  /**
1635
1928
  * UnionTypeDefinition :
1636
1929
  * - Description? union Name Directives[Const]? UnionMemberTypes?
1930
+ *
1931
+ * @internal
1637
1932
  */
1638
1933
  parseUnionTypeDefinition() {
1639
1934
  const t = this._lexer.token, n = this.parseDescription();
@@ -1651,6 +1946,8 @@ class Xe {
1651
1946
  * UnionMemberTypes :
1652
1947
  * - = `|`? NamedType
1653
1948
  * - UnionMemberTypes | NamedType
1949
+ *
1950
+ * @internal
1654
1951
  */
1655
1952
  parseUnionMemberTypes() {
1656
1953
  return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
@@ -1658,6 +1955,8 @@ class Xe {
1658
1955
  /**
1659
1956
  * EnumTypeDefinition :
1660
1957
  * - Description? enum Name Directives[Const]? EnumValuesDefinition?
1958
+ *
1959
+ * @internal
1661
1960
  */
1662
1961
  parseEnumTypeDefinition() {
1663
1962
  const t = this._lexer.token, n = this.parseDescription();
@@ -1675,6 +1974,8 @@ class Xe {
1675
1974
  * ```
1676
1975
  * EnumValuesDefinition : { EnumValueDefinition+ }
1677
1976
  * ```
1977
+ *
1978
+ * @internal
1678
1979
  */
1679
1980
  parseEnumValuesDefinition() {
1680
1981
  return this.optionalMany(
@@ -1685,6 +1986,8 @@ class Xe {
1685
1986
  }
1686
1987
  /**
1687
1988
  * EnumValueDefinition : Description? EnumValue Directives[Const]?
1989
+ *
1990
+ * @internal
1688
1991
  */
1689
1992
  parseEnumValueDefinition() {
1690
1993
  const t = this._lexer.token, n = this.parseDescription(), s = this.parseEnumValueName(), i = this.parseConstDirectives();
@@ -1697,6 +2000,8 @@ class Xe {
1697
2000
  }
1698
2001
  /**
1699
2002
  * EnumValue : Name but not `true`, `false` or `null`
2003
+ *
2004
+ * @internal
1700
2005
  */
1701
2006
  parseEnumValueName() {
1702
2007
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
@@ -1712,6 +2017,8 @@ class Xe {
1712
2017
  /**
1713
2018
  * InputObjectTypeDefinition :
1714
2019
  * - Description? input Name Directives[Const]? InputFieldsDefinition?
2020
+ *
2021
+ * @internal
1715
2022
  */
1716
2023
  parseInputObjectTypeDefinition() {
1717
2024
  const t = this._lexer.token, n = this.parseDescription();
@@ -1729,6 +2036,8 @@ class Xe {
1729
2036
  * ```
1730
2037
  * InputFieldsDefinition : { InputValueDefinition+ }
1731
2038
  * ```
2039
+ *
2040
+ * @internal
1732
2041
  */
1733
2042
  parseInputFieldsDefinition() {
1734
2043
  return this.optionalMany(
@@ -1750,6 +2059,8 @@ class Xe {
1750
2059
  * - EnumTypeExtension
1751
2060
  * - InputObjectTypeDefinition
1752
2061
  * - DirectiveDefinitionExtension
2062
+ *
2063
+ * @internal
1753
2064
  */
1754
2065
  parseTypeSystemExtension() {
1755
2066
  const t = this._lexer.lookahead();
@@ -1782,6 +2093,8 @@ class Xe {
1782
2093
  * - extend schema Directives[Const]? { OperationTypeDefinition+ }
1783
2094
  * - extend schema Directives[Const]
1784
2095
  * ```
2096
+ *
2097
+ * @internal
1785
2098
  */
1786
2099
  parseSchemaExtension() {
1787
2100
  const t = this._lexer.token;
@@ -1802,6 +2115,8 @@ class Xe {
1802
2115
  /**
1803
2116
  * ScalarTypeExtension :
1804
2117
  * - extend scalar Name Directives[Const]
2118
+ *
2119
+ * @internal
1805
2120
  */
1806
2121
  parseScalarTypeExtension() {
1807
2122
  const t = this._lexer.token;
@@ -1820,6 +2135,8 @@ class Xe {
1820
2135
  * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1821
2136
  * - extend type Name ImplementsInterfaces? Directives[Const]
1822
2137
  * - extend type Name ImplementsInterfaces
2138
+ *
2139
+ * @internal
1823
2140
  */
1824
2141
  parseObjectTypeExtension() {
1825
2142
  const t = this._lexer.token;
@@ -1840,6 +2157,8 @@ class Xe {
1840
2157
  * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
1841
2158
  * - extend interface Name ImplementsInterfaces? Directives[Const]
1842
2159
  * - extend interface Name ImplementsInterfaces
2160
+ *
2161
+ * @internal
1843
2162
  */
1844
2163
  parseInterfaceTypeExtension() {
1845
2164
  const t = this._lexer.token;
@@ -1859,6 +2178,8 @@ class Xe {
1859
2178
  * UnionTypeExtension :
1860
2179
  * - extend union Name Directives[Const]? UnionMemberTypes
1861
2180
  * - extend union Name Directives[Const]
2181
+ *
2182
+ * @internal
1862
2183
  */
1863
2184
  parseUnionTypeExtension() {
1864
2185
  const t = this._lexer.token;
@@ -1877,6 +2198,8 @@ class Xe {
1877
2198
  * EnumTypeExtension :
1878
2199
  * - extend enum Name Directives[Const]? EnumValuesDefinition
1879
2200
  * - extend enum Name Directives[Const]
2201
+ *
2202
+ * @internal
1880
2203
  */
1881
2204
  parseEnumTypeExtension() {
1882
2205
  const t = this._lexer.token;
@@ -1895,6 +2218,8 @@ class Xe {
1895
2218
  * InputObjectTypeExtension :
1896
2219
  * - extend input Name Directives[Const]? InputFieldsDefinition
1897
2220
  * - extend input Name Directives[Const]
2221
+ *
2222
+ * @internal
1898
2223
  */
1899
2224
  parseInputObjectTypeExtension() {
1900
2225
  const t = this._lexer.token;
@@ -1926,6 +2251,8 @@ class Xe {
1926
2251
  * DirectiveDefinition :
1927
2252
  * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
1928
2253
  * ```
2254
+ *
2255
+ * @internal
1929
2256
  */
1930
2257
  parseDirectiveDefinition() {
1931
2258
  const t = this._lexer.token, n = this.parseDescription();
@@ -1947,6 +2274,8 @@ class Xe {
1947
2274
  * DirectiveLocations :
1948
2275
  * - `|`? DirectiveLocation
1949
2276
  * - DirectiveLocations | DirectiveLocation
2277
+ *
2278
+ * @internal
1950
2279
  */
1951
2280
  parseDirectiveLocations() {
1952
2281
  return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
@@ -1993,6 +2322,19 @@ class Xe {
1993
2322
  * - Name . Name ( Name : )
1994
2323
  * - \@ Name
1995
2324
  * - \@ Name ( Name : )
2325
+ * @returns Parsed schema coordinate AST.
2326
+ * @example
2327
+ * ```ts
2328
+ * import { Parser, Source } from 'graphql/language';
2329
+ *
2330
+ * const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
2331
+ * const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
2332
+ *
2333
+ * typeCoordinate.name.value; // => 'User'
2334
+ * typeCoordinate.memberName?.value; // => 'name'
2335
+ * directiveCoordinate.name.value; // => 'deprecated'
2336
+ * directiveCoordinate.argumentName?.value; // => 'reason'
2337
+ * ```
1996
2338
  */
1997
2339
  parseSchemaCoordinate() {
1998
2340
  const t = this._lexer.token, n = this.expectOptionalToken(o.AT), s = this.parseName();
@@ -2025,6 +2367,8 @@ class Xe {
2025
2367
  * Returns a node that, if configured to do so, sets a "loc" field as a
2026
2368
  * location object, used to identify the place in the source that created a
2027
2369
  * given parsed object.
2370
+ *
2371
+ * @internal
2028
2372
  */
2029
2373
  node(t, n) {
2030
2374
  return this._options.noLocation !== !0 && (n.loc = new Se(
@@ -2035,6 +2379,8 @@ class Xe {
2035
2379
  }
2036
2380
  /**
2037
2381
  * Determines if the next token is of a given kind
2382
+ *
2383
+ * @internal
2038
2384
  */
2039
2385
  peek(t) {
2040
2386
  return this._lexer.token.kind === t;
@@ -2042,6 +2388,8 @@ class Xe {
2042
2388
  /**
2043
2389
  * If the next token is of the given kind, return that token after advancing the lexer.
2044
2390
  * Otherwise, do not change the parser state and throw an error.
2391
+ *
2392
+ * @internal
2045
2393
  */
2046
2394
  expectToken(t) {
2047
2395
  const n = this._lexer.token;
@@ -2056,6 +2404,8 @@ class Xe {
2056
2404
  /**
2057
2405
  * If the next token is of the given kind, return "true" after advancing the lexer.
2058
2406
  * Otherwise, do not change the parser state and return "false".
2407
+ *
2408
+ * @internal
2059
2409
  */
2060
2410
  expectOptionalToken(t) {
2061
2411
  return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
@@ -2063,6 +2413,8 @@ class Xe {
2063
2413
  /**
2064
2414
  * If the next token is a given keyword, advance the lexer.
2065
2415
  * Otherwise, do not change the parser state and throw an error.
2416
+ *
2417
+ * @internal
2066
2418
  */
2067
2419
  expectKeyword(t) {
2068
2420
  const n = this._lexer.token;
@@ -2078,6 +2430,8 @@ class Xe {
2078
2430
  /**
2079
2431
  * If the next token is a given keyword, return "true" after advancing the lexer.
2080
2432
  * Otherwise, do not change the parser state and return "false".
2433
+ *
2434
+ * @internal
2081
2435
  */
2082
2436
  expectOptionalKeyword(t) {
2083
2437
  const n = this._lexer.token;
@@ -2085,6 +2439,8 @@ class Xe {
2085
2439
  }
2086
2440
  /**
2087
2441
  * Helper function for creating an error when an unexpected lexed token is encountered.
2442
+ *
2443
+ * @internal
2088
2444
  */
2089
2445
  unexpected(t) {
2090
2446
  const n = t ?? this._lexer.token;
@@ -2098,6 +2454,8 @@ class Xe {
2098
2454
  * Returns a possibly empty list of parse nodes, determined by the parseFn.
2099
2455
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
2100
2456
  * Advances the parser to the next lex token after the closing token.
2457
+ *
2458
+ * @internal
2101
2459
  */
2102
2460
  any(t, n, s) {
2103
2461
  this.expectToken(t);
@@ -2111,6 +2469,8 @@ class Xe {
2111
2469
  * It can be empty only if open token is missing otherwise it will always return non-empty list
2112
2470
  * that begins with a lex token of openKind and ends with a lex token of closeKind.
2113
2471
  * Advances the parser to the next lex token after the closing token.
2472
+ *
2473
+ * @internal
2114
2474
  */
2115
2475
  optionalMany(t, n, s) {
2116
2476
  if (this.expectOptionalToken(t)) {
@@ -2126,6 +2486,8 @@ class Xe {
2126
2486
  * Returns a non-empty list of parse nodes, determined by the parseFn.
2127
2487
  * This list begins with a lex token of openKind and ends with a lex token of closeKind.
2128
2488
  * Advances the parser to the next lex token after the closing token.
2489
+ *
2490
+ * @internal
2129
2491
  */
2130
2492
  many(t, n, s) {
2131
2493
  this.expectToken(t);
@@ -2139,6 +2501,8 @@ class Xe {
2139
2501
  * Returns a non-empty list of parse nodes, determined by the parseFn.
2140
2502
  * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
2141
2503
  * Advances the parser to the next lex token after last item in the list.
2504
+ *
2505
+ * @internal
2142
2506
  */
2143
2507
  delimitedMany(t, n) {
2144
2508
  this.expectOptionalToken(t);