@timardex/cluemart-server-shared 1.1.35 → 1.1.37

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.
@@ -151,11 +151,11 @@ function wrapConsoleMethod(name) {
151
151
  }
152
152
  };
153
153
  }
154
- (function(invariant3) {
155
- invariant3.debug = wrapConsoleMethod("debug");
156
- invariant3.log = wrapConsoleMethod("log");
157
- invariant3.warn = wrapConsoleMethod("warn");
158
- invariant3.error = wrapConsoleMethod("error");
154
+ (function(invariant2) {
155
+ invariant2.debug = wrapConsoleMethod("debug");
156
+ invariant2.log = wrapConsoleMethod("log");
157
+ invariant2.warn = wrapConsoleMethod("warn");
158
+ invariant2.error = wrapConsoleMethod("error");
159
159
  })(invariant || (invariant = {}));
160
160
  function setVerbosity(level) {
161
161
  var old = verbosityLevels[verbosityLevel];
@@ -163,2999 +163,8 @@ function setVerbosity(level) {
163
163
  return old;
164
164
  }
165
165
 
166
- // node_modules/graphql/jsutils/devAssert.mjs
167
- function devAssert(condition, message) {
168
- const booleanCondition = Boolean(condition);
169
- if (!booleanCondition) {
170
- throw new Error(message);
171
- }
172
- }
173
-
174
- // node_modules/graphql/jsutils/isObjectLike.mjs
175
- function isObjectLike(value) {
176
- return typeof value == "object" && value !== null;
177
- }
178
-
179
- // node_modules/graphql/jsutils/invariant.mjs
180
- function invariant2(condition, message) {
181
- const booleanCondition = Boolean(condition);
182
- if (!booleanCondition) {
183
- throw new Error(
184
- message != null ? message : "Unexpected invariant triggered."
185
- );
186
- }
187
- }
188
-
189
- // node_modules/graphql/language/location.mjs
190
- var LineRegExp = /\r\n|[\n\r]/g;
191
- function getLocation(source, position) {
192
- let lastLineStart = 0;
193
- let line = 1;
194
- for (const match of source.body.matchAll(LineRegExp)) {
195
- typeof match.index === "number" || invariant2(false);
196
- if (match.index >= position) {
197
- break;
198
- }
199
- lastLineStart = match.index + match[0].length;
200
- line += 1;
201
- }
202
- return {
203
- line,
204
- column: position + 1 - lastLineStart
205
- };
206
- }
207
-
208
- // node_modules/graphql/language/printLocation.mjs
209
- function printLocation(location) {
210
- return printSourceLocation(
211
- location.source,
212
- getLocation(location.source, location.start)
213
- );
214
- }
215
- function printSourceLocation(source, sourceLocation) {
216
- const firstLineColumnOffset = source.locationOffset.column - 1;
217
- const body = "".padStart(firstLineColumnOffset) + source.body;
218
- const lineIndex = sourceLocation.line - 1;
219
- const lineOffset = source.locationOffset.line - 1;
220
- const lineNum = sourceLocation.line + lineOffset;
221
- const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
222
- const columnNum = sourceLocation.column + columnOffset;
223
- const locationStr = `${source.name}:${lineNum}:${columnNum}
224
- `;
225
- const lines = body.split(/\r\n|[\n\r]/g);
226
- const locationLine = lines[lineIndex];
227
- if (locationLine.length > 120) {
228
- const subLineIndex = Math.floor(columnNum / 80);
229
- const subLineColumnNum = columnNum % 80;
230
- const subLines = [];
231
- for (let i = 0; i < locationLine.length; i += 80) {
232
- subLines.push(locationLine.slice(i, i + 80));
233
- }
234
- return locationStr + printPrefixedLines([
235
- [`${lineNum} |`, subLines[0]],
236
- ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]),
237
- ["|", "^".padStart(subLineColumnNum)],
238
- ["|", subLines[subLineIndex + 1]]
239
- ]);
240
- }
241
- return locationStr + printPrefixedLines([
242
- // Lines specified like this: ["prefix", "string"],
243
- [`${lineNum - 1} |`, lines[lineIndex - 1]],
244
- [`${lineNum} |`, locationLine],
245
- ["|", "^".padStart(columnNum)],
246
- [`${lineNum + 1} |`, lines[lineIndex + 1]]
247
- ]);
248
- }
249
- function printPrefixedLines(lines) {
250
- const existingLines = lines.filter(([_, line]) => line !== void 0);
251
- const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
252
- return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n");
253
- }
254
-
255
- // node_modules/graphql/error/GraphQLError.mjs
256
- function toNormalizedOptions(args) {
257
- const firstArg = args[0];
258
- if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
259
- return {
260
- nodes: firstArg,
261
- source: args[1],
262
- positions: args[2],
263
- path: args[3],
264
- originalError: args[4],
265
- extensions: args[5]
266
- };
267
- }
268
- return firstArg;
269
- }
270
- var GraphQLError = class _GraphQLError extends Error {
271
- /**
272
- * An array of `{ line, column }` locations within the source GraphQL document
273
- * which correspond to this error.
274
- *
275
- * Errors during validation often contain multiple locations, for example to
276
- * point out two things with the same name. Errors during execution include a
277
- * single location, the field which produced the error.
278
- *
279
- * Enumerable, and appears in the result of JSON.stringify().
280
- */
281
- /**
282
- * An array describing the JSON-path into the execution response which
283
- * corresponds to this error. Only included for errors during execution.
284
- *
285
- * Enumerable, and appears in the result of JSON.stringify().
286
- */
287
- /** An array of GraphQL AST Nodes corresponding to this error. */
288
- /**
289
- * The source GraphQL document for the first location of this error.
290
- *
291
- * Note that if this Error represents more than one node, the source may not
292
- * represent nodes after the first node.
293
- */
294
- /**
295
- * An array of character offsets within the source GraphQL document
296
- * which correspond to this error.
297
- */
298
- /** Original error that caused this GraphQLError, if one exists. */
299
- /** Extension fields to add to the formatted error. */
300
- /**
301
- * Creates a GraphQLError instance.
302
- * @param message - Human-readable error message.
303
- * @param options - Error metadata such as source locations, response path, original error, and extensions.
304
- * This positional-arguments constructor overload is deprecated. Use the
305
- * `GraphQLError(message, options)` overload instead.
306
- * @example
307
- * ```ts
308
- * // Create an error from AST nodes and response metadata.
309
- * import { parse } from 'graphql/language';
310
- * import { GraphQLError } from 'graphql/error';
311
- *
312
- * const document = parse('{ greeting }');
313
- * const fieldNode = document.definitions[0].selectionSet.selections[0];
314
- * const error = new GraphQLError('Cannot query this field.', {
315
- * nodes: fieldNode,
316
- * path: ['greeting'],
317
- * extensions: { code: 'FORBIDDEN' },
318
- * });
319
- *
320
- * error.message; // => 'Cannot query this field.'
321
- * error.locations; // => [{ line: 1, column: 3 }]
322
- * error.path; // => ['greeting']
323
- * error.extensions; // => { code: 'FORBIDDEN' }
324
- * ```
325
- * @example
326
- * ```ts
327
- * // This variant derives locations from source positions and preserves the original error.
328
- * import { Source } from 'graphql/language';
329
- * import { GraphQLError } from 'graphql/error';
330
- *
331
- * const source = new Source('{ greeting }');
332
- * const originalError = new Error('Database unavailable.');
333
- * const error = new GraphQLError('Resolver failed.', {
334
- * source,
335
- * positions: [2],
336
- * path: ['greeting'],
337
- * originalError,
338
- * });
339
- *
340
- * error.locations; // => [{ line: 1, column: 3 }]
341
- * error.path; // => ['greeting']
342
- * error.originalError; // => originalError
343
- * ```
344
- */
345
- /**
346
- * Creates a GraphQLError instance using the legacy positional constructor.
347
- * This deprecated overload will be removed in v17. Prefer the
348
- * `GraphQLErrorOptions` object overload, which keeps optional error metadata
349
- * in a single options bag.
350
- * @param message - Human-readable error message.
351
- * @param nodes - AST node or nodes associated with this error.
352
- * @param source - Source document used to derive error locations.
353
- * @param positions - Character offsets in the source document associated with
354
- * this error.
355
- * @param path - Response path where this error occurred during execution.
356
- * @param originalError - Original error that caused this GraphQLError, if one
357
- * exists.
358
- * @param extensions - Extension fields to include in the formatted error.
359
- * @example
360
- * ```ts
361
- * import { Source } from 'graphql/language';
362
- * import { GraphQLError } from 'graphql/error';
363
- *
364
- * const source = new Source('{ greeting }');
365
- * const originalError = new Error('Database unavailable.');
366
- * const error = new GraphQLError(
367
- * 'Resolver failed.',
368
- * undefined,
369
- * source,
370
- * [2],
371
- * ['greeting'],
372
- * originalError,
373
- * { code: 'INTERNAL' },
374
- * );
375
- *
376
- * error.locations; // => [{ line: 1, column: 3 }]
377
- * error.path; // => ['greeting']
378
- * error.originalError; // => originalError
379
- * error.extensions; // => { code: 'INTERNAL' }
380
- * ```
381
- * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
382
- */
383
- constructor(message, ...rawArgs) {
384
- var _this$nodes, _nodeLocations$, _ref;
385
- const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
386
- super(message);
387
- this.name = "GraphQLError";
388
- this.path = path !== null && path !== void 0 ? path : void 0;
389
- this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
390
- this.nodes = undefinedIfEmpty(
391
- Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
392
- );
393
- const nodeLocations = undefinedIfEmpty(
394
- (_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null)
395
- );
396
- this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source;
397
- this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start);
398
- this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => getLocation(loc.source, loc.start));
399
- const originalExtensions = isObjectLike(
400
- originalError === null || originalError === void 0 ? void 0 : originalError.extensions
401
- ) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0;
402
- this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null);
403
- Object.defineProperties(this, {
404
- message: {
405
- writable: true,
406
- enumerable: true
407
- },
408
- name: {
409
- enumerable: false
410
- },
411
- nodes: {
412
- enumerable: false
413
- },
414
- source: {
415
- enumerable: false
416
- },
417
- positions: {
418
- enumerable: false
419
- },
420
- originalError: {
421
- enumerable: false
422
- }
423
- });
424
- if (originalError !== null && originalError !== void 0 && originalError.stack) {
425
- Object.defineProperty(this, "stack", {
426
- value: originalError.stack,
427
- writable: true,
428
- configurable: true
429
- });
430
- } else if (Error.captureStackTrace) {
431
- Error.captureStackTrace(this, _GraphQLError);
432
- } else {
433
- Object.defineProperty(this, "stack", {
434
- value: Error().stack,
435
- writable: true,
436
- configurable: true
437
- });
438
- }
439
- }
440
- /**
441
- * Returns the value used by `Object.prototype.toString`.
442
- * @returns The built-in string tag for this object.
443
- */
444
- get [Symbol.toStringTag]() {
445
- return "GraphQLError";
446
- }
447
- /**
448
- * Returns this error as a human-readable message with source locations.
449
- * @returns The formatted error string.
450
- * @example
451
- * ```ts
452
- * import { Source } from 'graphql/language';
453
- * import { GraphQLError } from 'graphql/error';
454
- *
455
- * const error = new GraphQLError('Cannot query field "name".', {
456
- * source: new Source('{ name }'),
457
- * positions: [2],
458
- * });
459
- *
460
- * error.toString(); // => 'Cannot query field "name".\n\nGraphQL request:1:3\n1 | { name }\n | ^'
461
- * ```
462
- */
463
- toString() {
464
- let output = this.message;
465
- if (this.nodes) {
466
- for (const node of this.nodes) {
467
- if (node.loc) {
468
- output += "\n\n" + printLocation(node.loc);
469
- }
470
- }
471
- } else if (this.source && this.locations) {
472
- for (const location of this.locations) {
473
- output += "\n\n" + printSourceLocation(this.source, location);
474
- }
475
- }
476
- return output;
477
- }
478
- /**
479
- * Returns the JSON representation used when this object is serialized.
480
- * @returns The JSON-serializable representation.
481
- * @example
482
- * ```ts
483
- * import { GraphQLError } from 'graphql/error';
484
- *
485
- * const error = new GraphQLError('Resolver failed.', {
486
- * path: ['viewer', 'name'],
487
- * extensions: { code: 'INTERNAL' },
488
- * });
489
- *
490
- * error.toJSON(); // => { message: 'Resolver failed.', path: ['viewer', 'name'], extensions: { code: 'INTERNAL' } }
491
- * ```
492
- */
493
- toJSON() {
494
- const formattedError = {
495
- message: this.message
496
- };
497
- if (this.locations != null) {
498
- formattedError.locations = this.locations;
499
- }
500
- if (this.path != null) {
501
- formattedError.path = this.path;
502
- }
503
- if (this.extensions != null && Object.keys(this.extensions).length > 0) {
504
- formattedError.extensions = this.extensions;
505
- }
506
- return formattedError;
507
- }
508
- };
509
- function undefinedIfEmpty(array) {
510
- return array === void 0 || array.length === 0 ? void 0 : array;
511
- }
512
-
513
- // node_modules/graphql/error/syntaxError.mjs
514
- function syntaxError(source, position, description) {
515
- return new GraphQLError(`Syntax Error: ${description}`, {
516
- source,
517
- positions: [position]
518
- });
519
- }
520
-
521
- // node_modules/graphql/language/ast.mjs
522
- var Location = class {
523
- /** The character offset at which this Node begins. */
524
- /** The character offset at which this Node ends. */
525
- /** The Token at which this Node begins. */
526
- /** The Token at which this Node ends. */
527
- /** The Source document the AST represents. */
528
- /**
529
- * Creates a Location instance.
530
- * @param startToken - The start token.
531
- * @param endToken - The end token.
532
- * @param source - Source document used to derive error locations.
533
- * @example
534
- * ```ts
535
- * import { Location, Source, Token, TokenKind } from 'graphql/language';
536
- *
537
- * const source = new Source('{ hello }');
538
- * const startToken = new Token(TokenKind.BRACE_L, 0, 1, 1, 1);
539
- * const endToken = new Token(TokenKind.BRACE_R, 8, 9, 1, 9);
540
- * const location = new Location(startToken, endToken, source);
541
- *
542
- * location.start; // => 0
543
- * location.end; // => 9
544
- * location.source.body; // => '{ hello }'
545
- * ```
546
- */
547
- constructor(startToken, endToken, source) {
548
- this.start = startToken.start;
549
- this.end = endToken.end;
550
- this.startToken = startToken;
551
- this.endToken = endToken;
552
- this.source = source;
553
- }
554
- /**
555
- * Returns the value used by `Object.prototype.toString`.
556
- * @returns The built-in string tag for this object.
557
- */
558
- get [Symbol.toStringTag]() {
559
- return "Location";
560
- }
561
- /**
562
- * Returns a JSON representation of this location.
563
- * @returns The JSON-serializable representation.
564
- * @example
565
- * ```ts
566
- * import { parse } from 'graphql/language';
567
- *
568
- * const document = parse('{ hello }');
569
- * const location = document.loc?.toJSON();
570
- *
571
- * location; // => { start: 0, end: 9 }
572
- * ```
573
- */
574
- toJSON() {
575
- return {
576
- start: this.start,
577
- end: this.end
578
- };
579
- }
580
- };
581
- var Token = class {
582
- /** The kind of Token. */
583
- /** The character offset at which this Node begins. */
584
- /** The character offset at which this Node ends. */
585
- /** The 1-indexed line number on which this Token appears. */
586
- /** The 1-indexed column number at which this Token begins. */
587
- /**
588
- * For non-punctuation tokens, represents the interpreted value of the token.
589
- *
590
- * Note: is undefined for punctuation tokens, but typed as string for
591
- * convenience in the parser.
592
- */
593
- /**
594
- * Tokens exist as nodes in a double-linked-list amongst all tokens
595
- * including ignored tokens. <SOF> is always the first node and <EOF>
596
- * the last.
597
- */
598
- /** Next token in the token stream, including ignored tokens. */
599
- /**
600
- * Creates a Token instance.
601
- * @param kind - Token kind produced by lexical analysis.
602
- * @param start - Character offset where this token begins.
603
- * @param end - Character offset where this token ends.
604
- * @param line - One-indexed line number where this token begins.
605
- * @param column - One-indexed column number where this token begins.
606
- * @param value - Interpreted value for non-punctuation tokens.
607
- * @example
608
- * ```ts
609
- * import { Token, TokenKind } from 'graphql/language';
610
- *
611
- * const token = new Token(TokenKind.NAME, 2, 7, 1, 3, 'hello');
612
- *
613
- * token.kind; // => TokenKind.NAME
614
- * token.value; // => 'hello'
615
- * token.toJSON(); // => { kind: 'Name', value: 'hello', line: 1, column: 3 }
616
- * ```
617
- */
618
- constructor(kind, start, end, line, column, value) {
619
- this.kind = kind;
620
- this.start = start;
621
- this.end = end;
622
- this.line = line;
623
- this.column = column;
624
- this.value = value;
625
- this.prev = null;
626
- this.next = null;
627
- }
628
- /**
629
- * Returns the value used by `Object.prototype.toString`.
630
- * @returns The built-in string tag for this object.
631
- */
632
- get [Symbol.toStringTag]() {
633
- return "Token";
634
- }
635
- /**
636
- * Returns a JSON representation of this token.
637
- * @returns The JSON-serializable representation.
638
- * @example
639
- * ```ts
640
- * import { Lexer, Source } from 'graphql/language';
641
- *
642
- * const lexer = new Lexer(new Source('{ hello }'));
643
- * const token = lexer.advance().toJSON();
644
- *
645
- * token; // => { kind: '{', value: undefined, line: 1, column: 1 }
646
- * ```
647
- */
648
- toJSON() {
649
- return {
650
- kind: this.kind,
651
- value: this.value,
652
- line: this.line,
653
- column: this.column
654
- };
655
- }
656
- };
657
- var QueryDocumentKeys = {
658
- Name: [],
659
- Document: ["definitions"],
660
- OperationDefinition: [
661
- "description",
662
- "name",
663
- "variableDefinitions",
664
- "directives",
665
- "selectionSet"
666
- ],
667
- VariableDefinition: [
668
- "description",
669
- "variable",
670
- "type",
671
- "defaultValue",
672
- "directives"
673
- ],
674
- Variable: ["name"],
675
- SelectionSet: ["selections"],
676
- Field: ["alias", "name", "arguments", "directives", "selectionSet"],
677
- Argument: ["name", "value"],
678
- FragmentSpread: ["name", "directives"],
679
- InlineFragment: ["typeCondition", "directives", "selectionSet"],
680
- FragmentDefinition: [
681
- "description",
682
- "name",
683
- // Note: fragment variable definitions are deprecated and will removed in v17.0.0
684
- "variableDefinitions",
685
- "typeCondition",
686
- "directives",
687
- "selectionSet"
688
- ],
689
- IntValue: [],
690
- FloatValue: [],
691
- StringValue: [],
692
- BooleanValue: [],
693
- NullValue: [],
694
- EnumValue: [],
695
- ListValue: ["values"],
696
- ObjectValue: ["fields"],
697
- ObjectField: ["name", "value"],
698
- Directive: ["name", "arguments"],
699
- NamedType: ["name"],
700
- ListType: ["type"],
701
- NonNullType: ["type"],
702
- SchemaDefinition: ["description", "directives", "operationTypes"],
703
- OperationTypeDefinition: ["type"],
704
- ScalarTypeDefinition: ["description", "name", "directives"],
705
- ObjectTypeDefinition: [
706
- "description",
707
- "name",
708
- "interfaces",
709
- "directives",
710
- "fields"
711
- ],
712
- FieldDefinition: ["description", "name", "arguments", "type", "directives"],
713
- InputValueDefinition: [
714
- "description",
715
- "name",
716
- "type",
717
- "defaultValue",
718
- "directives"
719
- ],
720
- InterfaceTypeDefinition: [
721
- "description",
722
- "name",
723
- "interfaces",
724
- "directives",
725
- "fields"
726
- ],
727
- UnionTypeDefinition: ["description", "name", "directives", "types"],
728
- EnumTypeDefinition: ["description", "name", "directives", "values"],
729
- EnumValueDefinition: ["description", "name", "directives"],
730
- InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
731
- DirectiveDefinition: [
732
- "description",
733
- "name",
734
- "arguments",
735
- "directives",
736
- "locations"
737
- ],
738
- SchemaExtension: ["directives", "operationTypes"],
739
- DirectiveExtension: ["name", "directives"],
740
- ScalarTypeExtension: ["name", "directives"],
741
- ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
742
- InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
743
- UnionTypeExtension: ["name", "directives", "types"],
744
- EnumTypeExtension: ["name", "directives", "values"],
745
- InputObjectTypeExtension: ["name", "directives", "fields"],
746
- TypeCoordinate: ["name"],
747
- MemberCoordinate: ["name", "memberName"],
748
- ArgumentCoordinate: ["name", "fieldName", "argumentName"],
749
- DirectiveCoordinate: ["name"],
750
- DirectiveArgumentCoordinate: ["name", "argumentName"]
751
- };
752
- var kindValues = new Set(Object.keys(QueryDocumentKeys));
753
- var OperationTypeNode;
754
- (function(OperationTypeNode2) {
755
- OperationTypeNode2["QUERY"] = "query";
756
- OperationTypeNode2["MUTATION"] = "mutation";
757
- OperationTypeNode2["SUBSCRIPTION"] = "subscription";
758
- })(OperationTypeNode || (OperationTypeNode = {}));
759
-
760
- // node_modules/graphql/language/directiveLocation.mjs
761
- var DirectiveLocation;
762
- (function(DirectiveLocation2) {
763
- DirectiveLocation2["QUERY"] = "QUERY";
764
- DirectiveLocation2["MUTATION"] = "MUTATION";
765
- DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
766
- DirectiveLocation2["FIELD"] = "FIELD";
767
- DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
768
- DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
769
- DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
770
- DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
771
- DirectiveLocation2["SCHEMA"] = "SCHEMA";
772
- DirectiveLocation2["SCALAR"] = "SCALAR";
773
- DirectiveLocation2["OBJECT"] = "OBJECT";
774
- DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
775
- DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
776
- DirectiveLocation2["INTERFACE"] = "INTERFACE";
777
- DirectiveLocation2["UNION"] = "UNION";
778
- DirectiveLocation2["ENUM"] = "ENUM";
779
- DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
780
- DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
781
- DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
782
- DirectiveLocation2["DIRECTIVE_DEFINITION"] = "DIRECTIVE_DEFINITION";
783
- })(DirectiveLocation || (DirectiveLocation = {}));
784
-
785
- // node_modules/graphql/language/kinds.mjs
786
- var Kind;
787
- (function(Kind2) {
788
- Kind2["NAME"] = "Name";
789
- Kind2["DOCUMENT"] = "Document";
790
- Kind2["OPERATION_DEFINITION"] = "OperationDefinition";
791
- Kind2["VARIABLE_DEFINITION"] = "VariableDefinition";
792
- Kind2["SELECTION_SET"] = "SelectionSet";
793
- Kind2["FIELD"] = "Field";
794
- Kind2["ARGUMENT"] = "Argument";
795
- Kind2["FRAGMENT_SPREAD"] = "FragmentSpread";
796
- Kind2["INLINE_FRAGMENT"] = "InlineFragment";
797
- Kind2["FRAGMENT_DEFINITION"] = "FragmentDefinition";
798
- Kind2["VARIABLE"] = "Variable";
799
- Kind2["INT"] = "IntValue";
800
- Kind2["FLOAT"] = "FloatValue";
801
- Kind2["STRING"] = "StringValue";
802
- Kind2["BOOLEAN"] = "BooleanValue";
803
- Kind2["NULL"] = "NullValue";
804
- Kind2["ENUM"] = "EnumValue";
805
- Kind2["LIST"] = "ListValue";
806
- Kind2["OBJECT"] = "ObjectValue";
807
- Kind2["OBJECT_FIELD"] = "ObjectField";
808
- Kind2["DIRECTIVE"] = "Directive";
809
- Kind2["NAMED_TYPE"] = "NamedType";
810
- Kind2["LIST_TYPE"] = "ListType";
811
- Kind2["NON_NULL_TYPE"] = "NonNullType";
812
- Kind2["SCHEMA_DEFINITION"] = "SchemaDefinition";
813
- Kind2["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
814
- Kind2["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
815
- Kind2["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
816
- Kind2["FIELD_DEFINITION"] = "FieldDefinition";
817
- Kind2["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
818
- Kind2["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
819
- Kind2["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
820
- Kind2["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
821
- Kind2["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
822
- Kind2["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
823
- Kind2["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
824
- Kind2["SCHEMA_EXTENSION"] = "SchemaExtension";
825
- Kind2["DIRECTIVE_EXTENSION"] = "DirectiveExtension";
826
- Kind2["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
827
- Kind2["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
828
- Kind2["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
829
- Kind2["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
830
- Kind2["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
831
- Kind2["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
832
- Kind2["TYPE_COORDINATE"] = "TypeCoordinate";
833
- Kind2["MEMBER_COORDINATE"] = "MemberCoordinate";
834
- Kind2["ARGUMENT_COORDINATE"] = "ArgumentCoordinate";
835
- Kind2["DIRECTIVE_COORDINATE"] = "DirectiveCoordinate";
836
- Kind2["DIRECTIVE_ARGUMENT_COORDINATE"] = "DirectiveArgumentCoordinate";
837
- })(Kind || (Kind = {}));
838
-
839
- // node_modules/graphql/language/characterClasses.mjs
840
- function isWhiteSpace(code) {
841
- return code === 9 || code === 32;
842
- }
843
- function isDigit(code) {
844
- return code >= 48 && code <= 57;
845
- }
846
- function isLetter(code) {
847
- return code >= 97 && code <= 122 || // A-Z
848
- code >= 65 && code <= 90;
849
- }
850
- function isNameStart(code) {
851
- return isLetter(code) || code === 95;
852
- }
853
- function isNameContinue(code) {
854
- return isLetter(code) || isDigit(code) || code === 95;
855
- }
856
-
857
- // node_modules/graphql/language/blockString.mjs
858
- function dedentBlockStringLines(lines) {
859
- var _firstNonEmptyLine2;
860
- let commonIndent = Number.MAX_SAFE_INTEGER;
861
- let firstNonEmptyLine = null;
862
- let lastNonEmptyLine = -1;
863
- for (let i = 0; i < lines.length; ++i) {
864
- var _firstNonEmptyLine;
865
- const line = lines[i];
866
- const indent = leadingWhitespace(line);
867
- if (indent === line.length) {
868
- continue;
869
- }
870
- firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i;
871
- lastNonEmptyLine = i;
872
- if (i !== 0 && indent < commonIndent) {
873
- commonIndent = indent;
874
- }
875
- }
876
- return lines.map((line, i) => i === 0 ? line : line.slice(commonIndent)).slice(
877
- (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0,
878
- lastNonEmptyLine + 1
879
- );
880
- }
881
- function leadingWhitespace(str) {
882
- let i = 0;
883
- while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {
884
- ++i;
885
- }
886
- return i;
887
- }
888
-
889
- // node_modules/graphql/language/tokenKind.mjs
890
- var TokenKind;
891
- (function(TokenKind2) {
892
- TokenKind2["SOF"] = "<SOF>";
893
- TokenKind2["EOF"] = "<EOF>";
894
- TokenKind2["BANG"] = "!";
895
- TokenKind2["DOLLAR"] = "$";
896
- TokenKind2["AMP"] = "&";
897
- TokenKind2["PAREN_L"] = "(";
898
- TokenKind2["PAREN_R"] = ")";
899
- TokenKind2["DOT"] = ".";
900
- TokenKind2["SPREAD"] = "...";
901
- TokenKind2["COLON"] = ":";
902
- TokenKind2["EQUALS"] = "=";
903
- TokenKind2["AT"] = "@";
904
- TokenKind2["BRACKET_L"] = "[";
905
- TokenKind2["BRACKET_R"] = "]";
906
- TokenKind2["BRACE_L"] = "{";
907
- TokenKind2["PIPE"] = "|";
908
- TokenKind2["BRACE_R"] = "}";
909
- TokenKind2["NAME"] = "Name";
910
- TokenKind2["INT"] = "Int";
911
- TokenKind2["FLOAT"] = "Float";
912
- TokenKind2["STRING"] = "String";
913
- TokenKind2["BLOCK_STRING"] = "BlockString";
914
- TokenKind2["COMMENT"] = "Comment";
915
- })(TokenKind || (TokenKind = {}));
916
-
917
- // node_modules/graphql/language/lexer.mjs
918
- var Lexer = class {
919
- /** Source document used to derive error locations. */
920
- /** Most recent non-ignored token returned by the lexer. */
921
- /** Current non-ignored token at the lexer cursor. */
922
- /** The (1-indexed) line containing the current token. */
923
- /** Character offset where the current line starts. */
924
- /**
925
- * Creates a Lexer instance.
926
- * @param source - Source document used to derive error locations.
927
- * @example
928
- * ```ts
929
- * import { Lexer, Source, TokenKind } from 'graphql/language';
930
- *
931
- * const lexer = new Lexer(new Source('{ hello }'));
932
- *
933
- * lexer.token.kind; // => TokenKind.SOF
934
- * lexer.advance().kind; // => TokenKind.BRACE_L
935
- * lexer.advance().value; // => 'hello'
936
- * lexer.advance().kind; // => TokenKind.BRACE_R
937
- * ```
938
- */
939
- constructor(source) {
940
- const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);
941
- this.source = source;
942
- this.lastToken = startOfFileToken;
943
- this.token = startOfFileToken;
944
- this.line = 1;
945
- this.lineStart = 0;
946
- }
947
- /**
948
- * Returns the value used by `Object.prototype.toString`.
949
- * @returns The built-in string tag for this object.
950
- */
951
- get [Symbol.toStringTag]() {
952
- return "Lexer";
953
- }
954
- /**
955
- * Advances the token stream to the next non-ignored token.
956
- * @returns The next non-ignored token.
957
- * @example
958
- * ```ts
959
- * import { Lexer, Source } from 'graphql/language';
960
- *
961
- * const lexer = new Lexer(new Source('{ hello }'));
962
- * const token = lexer.advance();
963
- *
964
- * token.kind; // => '{'
965
- * lexer.token; // => token
966
- * ```
967
- */
968
- advance() {
969
- this.lastToken = this.token;
970
- const token = this.token = this.lookahead();
971
- return token;
972
- }
973
- /**
974
- * Looks ahead and returns the next non-ignored token, but does not change
975
- * the state of Lexer.
976
- * @returns The next non-ignored token without advancing the lexer.
977
- * @example
978
- * ```ts
979
- * import { Lexer, Source } from 'graphql/language';
980
- *
981
- * const lexer = new Lexer(new Source('{ hello }'));
982
- * const token = lexer.lookahead();
983
- *
984
- * token.kind; // => '{'
985
- * lexer.token.kind; // => '<SOF>'
986
- * ```
987
- */
988
- lookahead() {
989
- let token = this.token;
990
- if (token.kind !== TokenKind.EOF) {
991
- do {
992
- if (token.next) {
993
- token = token.next;
994
- } else {
995
- const nextToken = readNextToken(this, token.end);
996
- token.next = nextToken;
997
- nextToken.prev = token;
998
- token = nextToken;
999
- }
1000
- } while (token.kind === TokenKind.COMMENT);
1001
- }
1002
- return token;
1003
- }
1004
- };
1005
- function isPunctuatorTokenKind(kind) {
1006
- return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.DOT || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;
1007
- }
1008
- function isUnicodeScalarValue(code) {
1009
- return code >= 0 && code <= 55295 || code >= 57344 && code <= 1114111;
1010
- }
1011
- function isSupplementaryCodePoint(body, location) {
1012
- return isLeadingSurrogate(body.charCodeAt(location)) && isTrailingSurrogate(body.charCodeAt(location + 1));
1013
- }
1014
- function isLeadingSurrogate(code) {
1015
- return code >= 55296 && code <= 56319;
1016
- }
1017
- function isTrailingSurrogate(code) {
1018
- return code >= 56320 && code <= 57343;
1019
- }
1020
- function printCodePointAt(lexer, location) {
1021
- const code = lexer.source.body.codePointAt(location);
1022
- if (code === void 0) {
1023
- return TokenKind.EOF;
1024
- } else if (code >= 32 && code <= 126) {
1025
- const char = String.fromCodePoint(code);
1026
- return char === '"' ? `'"'` : `"${char}"`;
1027
- }
1028
- return "U+" + code.toString(16).toUpperCase().padStart(4, "0");
1029
- }
1030
- function createToken(lexer, kind, start, end, value) {
1031
- const line = lexer.line;
1032
- const col = 1 + start - lexer.lineStart;
1033
- return new Token(kind, start, end, line, col, value);
1034
- }
1035
- function readNextToken(lexer, start) {
1036
- const body = lexer.source.body;
1037
- const bodyLength = body.length;
1038
- let position = start;
1039
- while (position < bodyLength) {
1040
- const code = body.charCodeAt(position);
1041
- switch (code) {
1042
- // Ignored ::
1043
- // - UnicodeBOM
1044
- // - WhiteSpace
1045
- // - LineTerminator
1046
- // - Comment
1047
- // - Comma
1048
- //
1049
- // UnicodeBOM :: "Byte Order Mark (U+FEFF)"
1050
- //
1051
- // WhiteSpace ::
1052
- // - "Horizontal Tab (U+0009)"
1053
- // - "Space (U+0020)"
1054
- //
1055
- // Comma :: ,
1056
- case 65279:
1057
- // <BOM>
1058
- case 9:
1059
- // \t
1060
- case 32:
1061
- // <space>
1062
- case 44:
1063
- ++position;
1064
- continue;
1065
- // LineTerminator ::
1066
- // - "New Line (U+000A)"
1067
- // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
1068
- // - "Carriage Return (U+000D)" "New Line (U+000A)"
1069
- case 10:
1070
- ++position;
1071
- ++lexer.line;
1072
- lexer.lineStart = position;
1073
- continue;
1074
- case 13:
1075
- if (body.charCodeAt(position + 1) === 10) {
1076
- position += 2;
1077
- } else {
1078
- ++position;
1079
- }
1080
- ++lexer.line;
1081
- lexer.lineStart = position;
1082
- continue;
1083
- // Comment
1084
- case 35:
1085
- return readComment(lexer, position);
1086
- // Token ::
1087
- // - Punctuator
1088
- // - Name
1089
- // - IntValue
1090
- // - FloatValue
1091
- // - StringValue
1092
- //
1093
- // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
1094
- case 33:
1095
- return createToken(lexer, TokenKind.BANG, position, position + 1);
1096
- case 36:
1097
- return createToken(lexer, TokenKind.DOLLAR, position, position + 1);
1098
- case 38:
1099
- return createToken(lexer, TokenKind.AMP, position, position + 1);
1100
- case 40:
1101
- return createToken(lexer, TokenKind.PAREN_L, position, position + 1);
1102
- case 41:
1103
- return createToken(lexer, TokenKind.PAREN_R, position, position + 1);
1104
- case 46:
1105
- if (body.charCodeAt(position + 1) === 46 && body.charCodeAt(position + 2) === 46) {
1106
- return createToken(lexer, TokenKind.SPREAD, position, position + 3);
1107
- }
1108
- break;
1109
- case 58:
1110
- return createToken(lexer, TokenKind.COLON, position, position + 1);
1111
- case 61:
1112
- return createToken(lexer, TokenKind.EQUALS, position, position + 1);
1113
- case 64:
1114
- return createToken(lexer, TokenKind.AT, position, position + 1);
1115
- case 91:
1116
- return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);
1117
- case 93:
1118
- return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);
1119
- case 123:
1120
- return createToken(lexer, TokenKind.BRACE_L, position, position + 1);
1121
- case 124:
1122
- return createToken(lexer, TokenKind.PIPE, position, position + 1);
1123
- case 125:
1124
- return createToken(lexer, TokenKind.BRACE_R, position, position + 1);
1125
- // StringValue
1126
- case 34:
1127
- if (body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
1128
- return readBlockString(lexer, position);
1129
- }
1130
- return readString(lexer, position);
1131
- }
1132
- if (isDigit(code) || code === 45) {
1133
- return readNumber(lexer, position, code);
1134
- }
1135
- if (isNameStart(code)) {
1136
- return readName(lexer, position);
1137
- }
1138
- throw syntaxError(
1139
- lexer.source,
1140
- position,
1141
- code === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) ? `Unexpected character: ${printCodePointAt(lexer, position)}.` : `Invalid character: ${printCodePointAt(lexer, position)}.`
1142
- );
1143
- }
1144
- return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);
1145
- }
1146
- function readComment(lexer, start) {
1147
- const body = lexer.source.body;
1148
- const bodyLength = body.length;
1149
- let position = start + 1;
1150
- while (position < bodyLength) {
1151
- const code = body.charCodeAt(position);
1152
- if (code === 10 || code === 13) {
1153
- break;
1154
- }
1155
- if (isUnicodeScalarValue(code)) {
1156
- ++position;
1157
- } else if (isSupplementaryCodePoint(body, position)) {
1158
- position += 2;
1159
- } else {
1160
- break;
1161
- }
1162
- }
1163
- return createToken(
1164
- lexer,
1165
- TokenKind.COMMENT,
1166
- start,
1167
- position,
1168
- body.slice(start + 1, position)
1169
- );
1170
- }
1171
- function readNumber(lexer, start, firstCode) {
1172
- const body = lexer.source.body;
1173
- let position = start;
1174
- let code = firstCode;
1175
- let isFloat = false;
1176
- if (code === 45) {
1177
- code = body.charCodeAt(++position);
1178
- }
1179
- if (code === 48) {
1180
- code = body.charCodeAt(++position);
1181
- if (isDigit(code)) {
1182
- throw syntaxError(
1183
- lexer.source,
1184
- position,
1185
- `Invalid number, unexpected digit after 0: ${printCodePointAt(
1186
- lexer,
1187
- position
1188
- )}.`
1189
- );
1190
- }
1191
- } else {
1192
- position = readDigits(lexer, position, code);
1193
- code = body.charCodeAt(position);
1194
- }
1195
- if (code === 46) {
1196
- isFloat = true;
1197
- code = body.charCodeAt(++position);
1198
- position = readDigits(lexer, position, code);
1199
- code = body.charCodeAt(position);
1200
- }
1201
- if (code === 69 || code === 101) {
1202
- isFloat = true;
1203
- code = body.charCodeAt(++position);
1204
- if (code === 43 || code === 45) {
1205
- code = body.charCodeAt(++position);
1206
- }
1207
- position = readDigits(lexer, position, code);
1208
- code = body.charCodeAt(position);
1209
- }
1210
- if (code === 46 || isNameStart(code)) {
1211
- throw syntaxError(
1212
- lexer.source,
1213
- position,
1214
- `Invalid number, expected digit but got: ${printCodePointAt(
1215
- lexer,
1216
- position
1217
- )}.`
1218
- );
1219
- }
1220
- return createToken(
1221
- lexer,
1222
- isFloat ? TokenKind.FLOAT : TokenKind.INT,
1223
- start,
1224
- position,
1225
- body.slice(start, position)
1226
- );
1227
- }
1228
- function readDigits(lexer, start, firstCode) {
1229
- if (!isDigit(firstCode)) {
1230
- throw syntaxError(
1231
- lexer.source,
1232
- start,
1233
- `Invalid number, expected digit but got: ${printCodePointAt(
1234
- lexer,
1235
- start
1236
- )}.`
1237
- );
1238
- }
1239
- const body = lexer.source.body;
1240
- let position = start + 1;
1241
- while (isDigit(body.charCodeAt(position))) {
1242
- ++position;
1243
- }
1244
- return position;
1245
- }
1246
- function readString(lexer, start) {
1247
- const body = lexer.source.body;
1248
- const bodyLength = body.length;
1249
- let position = start + 1;
1250
- let chunkStart = position;
1251
- let value = "";
1252
- while (position < bodyLength) {
1253
- const code = body.charCodeAt(position);
1254
- if (code === 34) {
1255
- value += body.slice(chunkStart, position);
1256
- return createToken(lexer, TokenKind.STRING, start, position + 1, value);
1257
- }
1258
- if (code === 92) {
1259
- value += body.slice(chunkStart, position);
1260
- const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position);
1261
- value += escape.value;
1262
- position += escape.size;
1263
- chunkStart = position;
1264
- continue;
1265
- }
1266
- if (code === 10 || code === 13) {
1267
- break;
1268
- }
1269
- if (isUnicodeScalarValue(code)) {
1270
- ++position;
1271
- } else if (isSupplementaryCodePoint(body, position)) {
1272
- position += 2;
1273
- } else {
1274
- throw syntaxError(
1275
- lexer.source,
1276
- position,
1277
- `Invalid character within String: ${printCodePointAt(
1278
- lexer,
1279
- position
1280
- )}.`
1281
- );
1282
- }
1283
- }
1284
- throw syntaxError(lexer.source, position, "Unterminated string.");
1285
- }
1286
- function readEscapedUnicodeVariableWidth(lexer, position) {
1287
- const body = lexer.source.body;
1288
- let point = 0;
1289
- let size = 3;
1290
- while (size < 12) {
1291
- const code = body.charCodeAt(position + size++);
1292
- if (code === 125) {
1293
- if (size < 5 || !isUnicodeScalarValue(point)) {
1294
- break;
1295
- }
1296
- return {
1297
- value: String.fromCodePoint(point),
1298
- size
1299
- };
1300
- }
1301
- point = point << 4 | readHexDigit(code);
1302
- if (point < 0) {
1303
- break;
1304
- }
1305
- }
1306
- throw syntaxError(
1307
- lexer.source,
1308
- position,
1309
- `Invalid Unicode escape sequence: "${body.slice(
1310
- position,
1311
- position + size
1312
- )}".`
1313
- );
1314
- }
1315
- function readEscapedUnicodeFixedWidth(lexer, position) {
1316
- const body = lexer.source.body;
1317
- const code = read16BitHexCode(body, position + 2);
1318
- if (isUnicodeScalarValue(code)) {
1319
- return {
1320
- value: String.fromCodePoint(code),
1321
- size: 6
1322
- };
1323
- }
1324
- if (isLeadingSurrogate(code)) {
1325
- if (body.charCodeAt(position + 6) === 92 && body.charCodeAt(position + 7) === 117) {
1326
- const trailingCode = read16BitHexCode(body, position + 8);
1327
- if (isTrailingSurrogate(trailingCode)) {
1328
- return {
1329
- value: String.fromCodePoint(code, trailingCode),
1330
- size: 12
1331
- };
1332
- }
1333
- }
1334
- }
1335
- throw syntaxError(
1336
- lexer.source,
1337
- position,
1338
- `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`
1339
- );
1340
- }
1341
- function read16BitHexCode(body, position) {
1342
- return readHexDigit(body.charCodeAt(position)) << 12 | readHexDigit(body.charCodeAt(position + 1)) << 8 | readHexDigit(body.charCodeAt(position + 2)) << 4 | readHexDigit(body.charCodeAt(position + 3));
1343
- }
1344
- function readHexDigit(code) {
1345
- return code >= 48 && code <= 57 ? code - 48 : code >= 65 && code <= 70 ? code - 55 : code >= 97 && code <= 102 ? code - 87 : -1;
1346
- }
1347
- function readEscapedCharacter(lexer, position) {
1348
- const body = lexer.source.body;
1349
- const code = body.charCodeAt(position + 1);
1350
- switch (code) {
1351
- case 34:
1352
- return {
1353
- value: '"',
1354
- size: 2
1355
- };
1356
- case 92:
1357
- return {
1358
- value: "\\",
1359
- size: 2
1360
- };
1361
- case 47:
1362
- return {
1363
- value: "/",
1364
- size: 2
1365
- };
1366
- case 98:
1367
- return {
1368
- value: "\b",
1369
- size: 2
1370
- };
1371
- case 102:
1372
- return {
1373
- value: "\f",
1374
- size: 2
1375
- };
1376
- case 110:
1377
- return {
1378
- value: "\n",
1379
- size: 2
1380
- };
1381
- case 114:
1382
- return {
1383
- value: "\r",
1384
- size: 2
1385
- };
1386
- case 116:
1387
- return {
1388
- value: " ",
1389
- size: 2
1390
- };
1391
- }
1392
- throw syntaxError(
1393
- lexer.source,
1394
- position,
1395
- `Invalid character escape sequence: "${body.slice(
1396
- position,
1397
- position + 2
1398
- )}".`
1399
- );
1400
- }
1401
- function readBlockString(lexer, start) {
1402
- const body = lexer.source.body;
1403
- const bodyLength = body.length;
1404
- let lineStart = lexer.lineStart;
1405
- let position = start + 3;
1406
- let chunkStart = position;
1407
- let currentLine = "";
1408
- const blockLines = [];
1409
- while (position < bodyLength) {
1410
- const code = body.charCodeAt(position);
1411
- if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {
1412
- currentLine += body.slice(chunkStart, position);
1413
- blockLines.push(currentLine);
1414
- const token = createToken(
1415
- lexer,
1416
- TokenKind.BLOCK_STRING,
1417
- start,
1418
- position + 3,
1419
- // Return a string of the lines joined with U+000A.
1420
- dedentBlockStringLines(blockLines).join("\n")
1421
- );
1422
- lexer.line += blockLines.length - 1;
1423
- lexer.lineStart = lineStart;
1424
- return token;
1425
- }
1426
- if (code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {
1427
- currentLine += body.slice(chunkStart, position);
1428
- chunkStart = position + 1;
1429
- position += 4;
1430
- continue;
1431
- }
1432
- if (code === 10 || code === 13) {
1433
- currentLine += body.slice(chunkStart, position);
1434
- blockLines.push(currentLine);
1435
- if (code === 13 && body.charCodeAt(position + 1) === 10) {
1436
- position += 2;
1437
- } else {
1438
- ++position;
1439
- }
1440
- currentLine = "";
1441
- chunkStart = position;
1442
- lineStart = position;
1443
- continue;
1444
- }
1445
- if (isUnicodeScalarValue(code)) {
1446
- ++position;
1447
- } else if (isSupplementaryCodePoint(body, position)) {
1448
- position += 2;
1449
- } else {
1450
- throw syntaxError(
1451
- lexer.source,
1452
- position,
1453
- `Invalid character within String: ${printCodePointAt(
1454
- lexer,
1455
- position
1456
- )}.`
1457
- );
1458
- }
1459
- }
1460
- throw syntaxError(lexer.source, position, "Unterminated string.");
1461
- }
1462
- function readName(lexer, start) {
1463
- const body = lexer.source.body;
1464
- const bodyLength = body.length;
1465
- let position = start + 1;
1466
- while (position < bodyLength) {
1467
- const code = body.charCodeAt(position);
1468
- if (isNameContinue(code)) {
1469
- ++position;
1470
- } else {
1471
- break;
1472
- }
1473
- }
1474
- return createToken(
1475
- lexer,
1476
- TokenKind.NAME,
1477
- start,
1478
- position,
1479
- body.slice(start, position)
1480
- );
1481
- }
1482
-
1483
- // node_modules/graphql/jsutils/inspect.mjs
1484
- var MAX_ARRAY_LENGTH = 10;
1485
- var MAX_RECURSIVE_DEPTH = 2;
1486
- function inspect(value) {
1487
- return formatValue(value, []);
1488
- }
1489
- function formatValue(value, seenValues) {
1490
- switch (typeof value) {
1491
- case "string":
1492
- return JSON.stringify(value);
1493
- case "function":
1494
- return value.name ? `[function ${value.name}]` : "[function]";
1495
- case "object":
1496
- return formatObjectValue(value, seenValues);
1497
- default:
1498
- return String(value);
1499
- }
1500
- }
1501
- function formatObjectValue(value, previouslySeenValues) {
1502
- if (value === null) {
1503
- return "null";
1504
- }
1505
- if (previouslySeenValues.includes(value)) {
1506
- return "[Circular]";
1507
- }
1508
- const seenValues = [...previouslySeenValues, value];
1509
- if (isJSONable(value)) {
1510
- const jsonValue = value.toJSON();
1511
- if (jsonValue !== value) {
1512
- return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
1513
- }
1514
- } else if (Array.isArray(value)) {
1515
- return formatArray(value, seenValues);
1516
- }
1517
- return formatObject(value, seenValues);
1518
- }
1519
- function isJSONable(value) {
1520
- return typeof value.toJSON === "function";
1521
- }
1522
- function formatObject(object, seenValues) {
1523
- const entries = Object.entries(object);
1524
- if (entries.length === 0) {
1525
- return "{}";
1526
- }
1527
- if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1528
- return "[" + getObjectTag(object) + "]";
1529
- }
1530
- const properties = entries.map(
1531
- ([key, value]) => key + ": " + formatValue(value, seenValues)
1532
- );
1533
- return "{ " + properties.join(", ") + " }";
1534
- }
1535
- function formatArray(array, seenValues) {
1536
- if (array.length === 0) {
1537
- return "[]";
1538
- }
1539
- if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1540
- return "[Array]";
1541
- }
1542
- const len = Math.min(MAX_ARRAY_LENGTH, array.length);
1543
- const remaining = array.length - len;
1544
- const items = [];
1545
- for (let i = 0; i < len; ++i) {
1546
- items.push(formatValue(array[i], seenValues));
1547
- }
1548
- if (remaining === 1) {
1549
- items.push("... 1 more item");
1550
- } else if (remaining > 1) {
1551
- items.push(`... ${remaining} more items`);
1552
- }
1553
- return "[" + items.join(", ") + "]";
1554
- }
1555
- function getObjectTag(object) {
1556
- const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
1557
- if (tag === "Object" && typeof object.constructor === "function") {
1558
- const name = object.constructor.name;
1559
- if (typeof name === "string" && name !== "") {
1560
- return name;
1561
- }
1562
- }
1563
- return tag;
1564
- }
1565
-
1566
- // node_modules/graphql/jsutils/instanceOf.mjs
1567
- var isProduction = globalThis.process && // eslint-disable-next-line no-undef
1568
- process.env.NODE_ENV === "production";
1569
- var instanceOf = (
1570
- /* c8 ignore next 6 */
1571
- // FIXME: https://github.com/graphql/graphql-js/issues/2317
1572
- isProduction ? function instanceOf2(value, constructor) {
1573
- return value instanceof constructor;
1574
- } : function instanceOf3(value, constructor) {
1575
- if (value instanceof constructor) {
1576
- return true;
1577
- }
1578
- if (typeof value === "object" && value !== null) {
1579
- var _value$constructor;
1580
- const className = constructor.prototype[Symbol.toStringTag];
1581
- const valueClassName = (
1582
- // We still need to support constructor's name to detect conflicts with older versions of this library.
1583
- Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name
1584
- );
1585
- if (className === valueClassName) {
1586
- const stringifiedValue = inspect(value);
1587
- throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
1588
-
1589
- Ensure that there is only one instance of "graphql" in the node_modules
1590
- directory. If different versions of "graphql" are the dependencies of other
1591
- relied on modules, use "resolutions" to ensure only one version is installed.
1592
-
1593
- https://yarnpkg.com/en/docs/selective-version-resolutions
1594
-
1595
- Duplicate "graphql" modules cannot be used at the same time since different
1596
- versions may have different capabilities and behavior. The data from one
1597
- version used in the function from another could produce confusing and
1598
- spurious results.`);
1599
- }
1600
- }
1601
- return false;
1602
- }
1603
- );
1604
-
1605
- // node_modules/graphql/language/source.mjs
1606
- var Source = class {
1607
- /** The GraphQL source text. */
1608
- /** Name used in diagnostics for this source, such as a file path or request name. */
1609
- /** One-indexed line and column where this source begins. */
1610
- /**
1611
- * Creates a Source instance.
1612
- * @param body - The GraphQL source text.
1613
- * @param name - Name used in diagnostics for this source.
1614
- * @param locationOffset - One-indexed line and column where this source begins.
1615
- * @example
1616
- * ```ts
1617
- * import { Source } from 'graphql/language';
1618
- *
1619
- * const source = new Source(
1620
- * 'type Query { greeting: String }',
1621
- * 'schema.graphql',
1622
- * { line: 10, column: 1 },
1623
- * );
1624
- *
1625
- * source.body; // => 'type Query { greeting: String }'
1626
- * source.name; // => 'schema.graphql'
1627
- * source.locationOffset; // => { line: 10, column: 1 }
1628
- * ```
1629
- */
1630
- constructor(body, name = "GraphQL request", locationOffset = {
1631
- line: 1,
1632
- column: 1
1633
- }) {
1634
- typeof body === "string" || devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);
1635
- this.body = body;
1636
- this.name = name;
1637
- this.locationOffset = locationOffset;
1638
- this.locationOffset.line > 0 || devAssert(
1639
- false,
1640
- "line in locationOffset is 1-indexed and must be positive."
1641
- );
1642
- this.locationOffset.column > 0 || devAssert(
1643
- false,
1644
- "column in locationOffset is 1-indexed and must be positive."
1645
- );
1646
- }
1647
- /**
1648
- * Returns the value used by `Object.prototype.toString`.
1649
- * @returns The built-in string tag for this object.
1650
- */
1651
- get [Symbol.toStringTag]() {
1652
- return "Source";
1653
- }
1654
- };
1655
- function isSource(source) {
1656
- return instanceOf(source, Source);
1657
- }
1658
-
1659
- // node_modules/graphql/language/parser.mjs
1660
- function parse(source, options) {
1661
- const parser = new Parser(source, options);
1662
- const document = parser.parseDocument();
1663
- Object.defineProperty(document, "tokenCount", {
1664
- enumerable: false,
1665
- value: parser.tokenCount
1666
- });
1667
- return document;
1668
- }
1669
- var Parser = class {
1670
- constructor(source, options = {}) {
1671
- const { lexer, ..._options } = options;
1672
- if (lexer) {
1673
- this._lexer = lexer;
1674
- } else {
1675
- const sourceObj = isSource(source) ? source : new Source(source);
1676
- this._lexer = new Lexer(sourceObj);
1677
- }
1678
- this._options = _options;
1679
- this._tokenCounter = 0;
1680
- }
1681
- get tokenCount() {
1682
- return this._tokenCounter;
1683
- }
1684
- /**
1685
- * Converts a name lex token into a name parse node.
1686
- *
1687
- * @internal
1688
- */
1689
- parseName() {
1690
- const token = this.expectToken(TokenKind.NAME);
1691
- return this.node(token, {
1692
- kind: Kind.NAME,
1693
- value: token.value
1694
- });
1695
- }
1696
- // Implements the parsing rules in the Document section.
1697
- /**
1698
- * Document : Definition+
1699
- *
1700
- * @internal
1701
- */
1702
- parseDocument() {
1703
- return this.node(this._lexer.token, {
1704
- kind: Kind.DOCUMENT,
1705
- definitions: this.many(
1706
- TokenKind.SOF,
1707
- this.parseDefinition,
1708
- TokenKind.EOF
1709
- )
1710
- });
1711
- }
1712
- /**
1713
- * Definition :
1714
- * - ExecutableDefinition
1715
- * - TypeSystemDefinition
1716
- * - TypeSystemExtension
1717
- *
1718
- * ExecutableDefinition :
1719
- * - OperationDefinition
1720
- * - FragmentDefinition
1721
- *
1722
- * TypeSystemDefinition :
1723
- * - SchemaDefinition
1724
- * - TypeDefinition
1725
- * - DirectiveDefinition
1726
- *
1727
- * TypeDefinition :
1728
- * - ScalarTypeDefinition
1729
- * - ObjectTypeDefinition
1730
- * - InterfaceTypeDefinition
1731
- * - UnionTypeDefinition
1732
- * - EnumTypeDefinition
1733
- * - InputObjectTypeDefinition
1734
- *
1735
- * @internal
1736
- */
1737
- parseDefinition() {
1738
- if (this.peek(TokenKind.BRACE_L)) {
1739
- return this.parseOperationDefinition();
1740
- }
1741
- const hasDescription = this.peekDescription();
1742
- const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token;
1743
- if (hasDescription && keywordToken.kind === TokenKind.BRACE_L) {
1744
- throw syntaxError(
1745
- this._lexer.source,
1746
- this._lexer.token.start,
1747
- "Unexpected description, descriptions are not supported on shorthand queries."
1748
- );
1749
- }
1750
- if (keywordToken.kind === TokenKind.NAME) {
1751
- switch (keywordToken.value) {
1752
- case "schema":
1753
- return this.parseSchemaDefinition();
1754
- case "scalar":
1755
- return this.parseScalarTypeDefinition();
1756
- case "type":
1757
- return this.parseObjectTypeDefinition();
1758
- case "interface":
1759
- return this.parseInterfaceTypeDefinition();
1760
- case "union":
1761
- return this.parseUnionTypeDefinition();
1762
- case "enum":
1763
- return this.parseEnumTypeDefinition();
1764
- case "input":
1765
- return this.parseInputObjectTypeDefinition();
1766
- case "directive":
1767
- return this.parseDirectiveDefinition();
1768
- }
1769
- switch (keywordToken.value) {
1770
- case "query":
1771
- case "mutation":
1772
- case "subscription":
1773
- return this.parseOperationDefinition();
1774
- case "fragment":
1775
- return this.parseFragmentDefinition();
1776
- }
1777
- if (hasDescription) {
1778
- throw syntaxError(
1779
- this._lexer.source,
1780
- this._lexer.token.start,
1781
- "Unexpected description, only GraphQL definitions support descriptions."
1782
- );
1783
- }
1784
- switch (keywordToken.value) {
1785
- case "extend":
1786
- return this.parseTypeSystemExtension();
1787
- }
1788
- }
1789
- throw this.unexpected(keywordToken);
1790
- }
1791
- // Implements the parsing rules in the Operations section.
1792
- /**
1793
- * OperationDefinition :
1794
- * - SelectionSet
1795
- * - OperationType Name? VariableDefinitions? Directives? SelectionSet
1796
- *
1797
- * @internal
1798
- */
1799
- parseOperationDefinition() {
1800
- const start = this._lexer.token;
1801
- if (this.peek(TokenKind.BRACE_L)) {
1802
- return this.node(start, {
1803
- kind: Kind.OPERATION_DEFINITION,
1804
- operation: OperationTypeNode.QUERY,
1805
- description: void 0,
1806
- name: void 0,
1807
- variableDefinitions: [],
1808
- directives: [],
1809
- selectionSet: this.parseSelectionSet()
1810
- });
1811
- }
1812
- const description = this.parseDescription();
1813
- const operation = this.parseOperationType();
1814
- let name;
1815
- if (this.peek(TokenKind.NAME)) {
1816
- name = this.parseName();
1817
- }
1818
- return this.node(start, {
1819
- kind: Kind.OPERATION_DEFINITION,
1820
- operation,
1821
- description,
1822
- name,
1823
- variableDefinitions: this.parseVariableDefinitions(),
1824
- directives: this.parseDirectives(false),
1825
- selectionSet: this.parseSelectionSet()
1826
- });
1827
- }
1828
- /**
1829
- * OperationType : one of query mutation subscription
1830
- *
1831
- * @internal
1832
- */
1833
- parseOperationType() {
1834
- const operationToken = this.expectToken(TokenKind.NAME);
1835
- switch (operationToken.value) {
1836
- case "query":
1837
- return OperationTypeNode.QUERY;
1838
- case "mutation":
1839
- return OperationTypeNode.MUTATION;
1840
- case "subscription":
1841
- return OperationTypeNode.SUBSCRIPTION;
1842
- }
1843
- throw this.unexpected(operationToken);
1844
- }
1845
- /**
1846
- * VariableDefinitions : ( VariableDefinition+ )
1847
- *
1848
- * @internal
1849
- */
1850
- parseVariableDefinitions() {
1851
- return this.optionalMany(
1852
- TokenKind.PAREN_L,
1853
- this.parseVariableDefinition,
1854
- TokenKind.PAREN_R
1855
- );
1856
- }
1857
- /**
1858
- * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
1859
- *
1860
- * @internal
1861
- */
1862
- parseVariableDefinition() {
1863
- return this.node(this._lexer.token, {
1864
- kind: Kind.VARIABLE_DEFINITION,
1865
- description: this.parseDescription(),
1866
- variable: this.parseVariable(),
1867
- type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),
1868
- defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseConstValueLiteral() : void 0,
1869
- directives: this.parseConstDirectives()
1870
- });
1871
- }
1872
- /**
1873
- * Variable : $ Name
1874
- *
1875
- * @internal
1876
- */
1877
- parseVariable() {
1878
- const start = this._lexer.token;
1879
- this.expectToken(TokenKind.DOLLAR);
1880
- return this.node(start, {
1881
- kind: Kind.VARIABLE,
1882
- name: this.parseName()
1883
- });
1884
- }
1885
- /**
1886
- * ```
1887
- * SelectionSet : { Selection+ }
1888
- * ```
1889
- *
1890
- * @internal
1891
- */
1892
- parseSelectionSet() {
1893
- return this.node(this._lexer.token, {
1894
- kind: Kind.SELECTION_SET,
1895
- selections: this.many(
1896
- TokenKind.BRACE_L,
1897
- this.parseSelection,
1898
- TokenKind.BRACE_R
1899
- )
1900
- });
1901
- }
1902
- /**
1903
- * Selection :
1904
- * - Field
1905
- * - FragmentSpread
1906
- * - InlineFragment
1907
- *
1908
- * @internal
1909
- */
1910
- parseSelection() {
1911
- return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();
1912
- }
1913
- /**
1914
- * Field : Alias? Name Arguments? Directives? SelectionSet?
1915
- *
1916
- * Alias : Name :
1917
- *
1918
- * @internal
1919
- */
1920
- parseField() {
1921
- const start = this._lexer.token;
1922
- const nameOrAlias = this.parseName();
1923
- let alias;
1924
- let name;
1925
- if (this.expectOptionalToken(TokenKind.COLON)) {
1926
- alias = nameOrAlias;
1927
- name = this.parseName();
1928
- } else {
1929
- name = nameOrAlias;
1930
- }
1931
- return this.node(start, {
1932
- kind: Kind.FIELD,
1933
- alias,
1934
- name,
1935
- arguments: this.parseArguments(false),
1936
- directives: this.parseDirectives(false),
1937
- selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : void 0
1938
- });
1939
- }
1940
- /**
1941
- * Arguments[Const] : ( Argument[?Const]+ )
1942
- *
1943
- * @internal
1944
- */
1945
- parseArguments(isConst) {
1946
- const item = isConst ? this.parseConstArgument : this.parseArgument;
1947
- return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);
1948
- }
1949
- /**
1950
- * Argument[Const] : Name : Value[?Const]
1951
- *
1952
- * @internal
1953
- */
1954
- parseArgument(isConst = false) {
1955
- const start = this._lexer.token;
1956
- const name = this.parseName();
1957
- this.expectToken(TokenKind.COLON);
1958
- return this.node(start, {
1959
- kind: Kind.ARGUMENT,
1960
- name,
1961
- value: this.parseValueLiteral(isConst)
1962
- });
1963
- }
1964
- parseConstArgument() {
1965
- return this.parseArgument(true);
1966
- }
1967
- // Implements the parsing rules in the Fragments section.
1968
- /**
1969
- * Corresponds to both FragmentSpread and InlineFragment in the spec.
1970
- *
1971
- * FragmentSpread : ... FragmentName Directives?
1972
- *
1973
- * InlineFragment : ... TypeCondition? Directives? SelectionSet
1974
- *
1975
- * @internal
1976
- */
1977
- parseFragment() {
1978
- const start = this._lexer.token;
1979
- this.expectToken(TokenKind.SPREAD);
1980
- const hasTypeCondition = this.expectOptionalKeyword("on");
1981
- if (!hasTypeCondition && this.peek(TokenKind.NAME)) {
1982
- return this.node(start, {
1983
- kind: Kind.FRAGMENT_SPREAD,
1984
- name: this.parseFragmentName(),
1985
- directives: this.parseDirectives(false)
1986
- });
1987
- }
1988
- return this.node(start, {
1989
- kind: Kind.INLINE_FRAGMENT,
1990
- typeCondition: hasTypeCondition ? this.parseNamedType() : void 0,
1991
- directives: this.parseDirectives(false),
1992
- selectionSet: this.parseSelectionSet()
1993
- });
1994
- }
1995
- /**
1996
- * FragmentDefinition :
1997
- * - fragment FragmentName on TypeCondition Directives? SelectionSet
1998
- *
1999
- * TypeCondition : NamedType
2000
- *
2001
- * @internal
2002
- */
2003
- parseFragmentDefinition() {
2004
- const start = this._lexer.token;
2005
- const description = this.parseDescription();
2006
- this.expectKeyword("fragment");
2007
- if (this._options.allowLegacyFragmentVariables === true) {
2008
- return this.node(start, {
2009
- kind: Kind.FRAGMENT_DEFINITION,
2010
- description,
2011
- name: this.parseFragmentName(),
2012
- variableDefinitions: this.parseVariableDefinitions(),
2013
- typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
2014
- directives: this.parseDirectives(false),
2015
- selectionSet: this.parseSelectionSet()
2016
- });
2017
- }
2018
- return this.node(start, {
2019
- kind: Kind.FRAGMENT_DEFINITION,
2020
- description,
2021
- name: this.parseFragmentName(),
2022
- typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
2023
- directives: this.parseDirectives(false),
2024
- selectionSet: this.parseSelectionSet()
2025
- });
2026
- }
2027
- /**
2028
- * FragmentName : Name but not `on`
2029
- *
2030
- * @internal
2031
- */
2032
- parseFragmentName() {
2033
- if (this._lexer.token.value === "on") {
2034
- throw this.unexpected();
2035
- }
2036
- return this.parseName();
2037
- }
2038
- // Implements the parsing rules in the Values section.
2039
- /**
2040
- * Value[Const] :
2041
- * - [~Const] Variable
2042
- * - IntValue
2043
- * - FloatValue
2044
- * - StringValue
2045
- * - BooleanValue
2046
- * - NullValue
2047
- * - EnumValue
2048
- * - ListValue[?Const]
2049
- * - ObjectValue[?Const]
2050
- *
2051
- * BooleanValue : one of `true` `false`
2052
- *
2053
- * NullValue : `null`
2054
- *
2055
- * EnumValue : Name but not `true`, `false` or `null`
2056
- *
2057
- * @internal
2058
- */
2059
- parseValueLiteral(isConst) {
2060
- const token = this._lexer.token;
2061
- switch (token.kind) {
2062
- case TokenKind.BRACKET_L:
2063
- return this.parseList(isConst);
2064
- case TokenKind.BRACE_L:
2065
- return this.parseObject(isConst);
2066
- case TokenKind.INT:
2067
- this.advanceLexer();
2068
- return this.node(token, {
2069
- kind: Kind.INT,
2070
- value: token.value
2071
- });
2072
- case TokenKind.FLOAT:
2073
- this.advanceLexer();
2074
- return this.node(token, {
2075
- kind: Kind.FLOAT,
2076
- value: token.value
2077
- });
2078
- case TokenKind.STRING:
2079
- case TokenKind.BLOCK_STRING:
2080
- return this.parseStringLiteral();
2081
- case TokenKind.NAME:
2082
- this.advanceLexer();
2083
- switch (token.value) {
2084
- case "true":
2085
- return this.node(token, {
2086
- kind: Kind.BOOLEAN,
2087
- value: true
2088
- });
2089
- case "false":
2090
- return this.node(token, {
2091
- kind: Kind.BOOLEAN,
2092
- value: false
2093
- });
2094
- case "null":
2095
- return this.node(token, {
2096
- kind: Kind.NULL
2097
- });
2098
- default:
2099
- return this.node(token, {
2100
- kind: Kind.ENUM,
2101
- value: token.value
2102
- });
2103
- }
2104
- case TokenKind.DOLLAR:
2105
- if (isConst) {
2106
- this.expectToken(TokenKind.DOLLAR);
2107
- if (this._lexer.token.kind === TokenKind.NAME) {
2108
- const varName = this._lexer.token.value;
2109
- throw syntaxError(
2110
- this._lexer.source,
2111
- token.start,
2112
- `Unexpected variable "$${varName}" in constant value.`
2113
- );
2114
- } else {
2115
- throw this.unexpected(token);
2116
- }
2117
- }
2118
- return this.parseVariable();
2119
- default:
2120
- throw this.unexpected();
2121
- }
2122
- }
2123
- parseConstValueLiteral() {
2124
- return this.parseValueLiteral(true);
2125
- }
2126
- parseStringLiteral() {
2127
- const token = this._lexer.token;
2128
- this.advanceLexer();
2129
- return this.node(token, {
2130
- kind: Kind.STRING,
2131
- value: token.value,
2132
- block: token.kind === TokenKind.BLOCK_STRING
2133
- });
2134
- }
2135
- /**
2136
- * ListValue[Const] :
2137
- * - [ ]
2138
- * - [ Value[?Const]+ ]
2139
- *
2140
- * @internal
2141
- */
2142
- parseList(isConst) {
2143
- const item = () => this.parseValueLiteral(isConst);
2144
- return this.node(this._lexer.token, {
2145
- kind: Kind.LIST,
2146
- values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R)
2147
- });
2148
- }
2149
- /**
2150
- * ```
2151
- * ObjectValue[Const] :
2152
- * - { }
2153
- * - { ObjectField[?Const]+ }
2154
- * ```
2155
- *
2156
- * @internal
2157
- */
2158
- parseObject(isConst) {
2159
- const item = () => this.parseObjectField(isConst);
2160
- return this.node(this._lexer.token, {
2161
- kind: Kind.OBJECT,
2162
- fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R)
2163
- });
2164
- }
2165
- /**
2166
- * ObjectField[Const] : Name : Value[?Const]
2167
- *
2168
- * @internal
2169
- */
2170
- parseObjectField(isConst) {
2171
- const start = this._lexer.token;
2172
- const name = this.parseName();
2173
- this.expectToken(TokenKind.COLON);
2174
- return this.node(start, {
2175
- kind: Kind.OBJECT_FIELD,
2176
- name,
2177
- value: this.parseValueLiteral(isConst)
2178
- });
2179
- }
2180
- // Implements the parsing rules in the Directives section.
2181
- /**
2182
- * Directives[Const] : Directive[?Const]+
2183
- *
2184
- * @internal
2185
- */
2186
- parseDirectives(isConst) {
2187
- const directives = [];
2188
- while (this.peek(TokenKind.AT)) {
2189
- directives.push(this.parseDirective(isConst));
2190
- }
2191
- return directives;
2192
- }
2193
- parseConstDirectives() {
2194
- return this.parseDirectives(true);
2195
- }
2196
- /**
2197
- * ```
2198
- * Directive[Const] : @ Name Arguments[?Const]?
2199
- * ```
2200
- *
2201
- * @internal
2202
- */
2203
- parseDirective(isConst) {
2204
- const start = this._lexer.token;
2205
- this.expectToken(TokenKind.AT);
2206
- return this.node(start, {
2207
- kind: Kind.DIRECTIVE,
2208
- name: this.parseName(),
2209
- arguments: this.parseArguments(isConst)
2210
- });
2211
- }
2212
- // Implements the parsing rules in the Types section.
2213
- /**
2214
- * Type :
2215
- * - NamedType
2216
- * - ListType
2217
- * - NonNullType
2218
- *
2219
- * @internal
2220
- */
2221
- parseTypeReference() {
2222
- const start = this._lexer.token;
2223
- let type;
2224
- if (this.expectOptionalToken(TokenKind.BRACKET_L)) {
2225
- const innerType = this.parseTypeReference();
2226
- this.expectToken(TokenKind.BRACKET_R);
2227
- type = this.node(start, {
2228
- kind: Kind.LIST_TYPE,
2229
- type: innerType
2230
- });
2231
- } else {
2232
- type = this.parseNamedType();
2233
- }
2234
- if (this.expectOptionalToken(TokenKind.BANG)) {
2235
- return this.node(start, {
2236
- kind: Kind.NON_NULL_TYPE,
2237
- type
2238
- });
2239
- }
2240
- return type;
2241
- }
2242
- /**
2243
- * NamedType : Name
2244
- *
2245
- * @internal
2246
- */
2247
- parseNamedType() {
2248
- return this.node(this._lexer.token, {
2249
- kind: Kind.NAMED_TYPE,
2250
- name: this.parseName()
2251
- });
2252
- }
2253
- // Implements the parsing rules in the Type Definition section.
2254
- peekDescription() {
2255
- return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);
2256
- }
2257
- /**
2258
- * Description : StringValue
2259
- *
2260
- * @internal
2261
- */
2262
- parseDescription() {
2263
- if (this.peekDescription()) {
2264
- return this.parseStringLiteral();
2265
- }
2266
- }
2267
- /**
2268
- * ```
2269
- * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
2270
- * ```
2271
- *
2272
- * @internal
2273
- */
2274
- parseSchemaDefinition() {
2275
- const start = this._lexer.token;
2276
- const description = this.parseDescription();
2277
- this.expectKeyword("schema");
2278
- const directives = this.parseConstDirectives();
2279
- const operationTypes = this.many(
2280
- TokenKind.BRACE_L,
2281
- this.parseOperationTypeDefinition,
2282
- TokenKind.BRACE_R
2283
- );
2284
- return this.node(start, {
2285
- kind: Kind.SCHEMA_DEFINITION,
2286
- description,
2287
- directives,
2288
- operationTypes
2289
- });
2290
- }
2291
- /**
2292
- * OperationTypeDefinition : OperationType : NamedType
2293
- *
2294
- * @internal
2295
- */
2296
- parseOperationTypeDefinition() {
2297
- const start = this._lexer.token;
2298
- const operation = this.parseOperationType();
2299
- this.expectToken(TokenKind.COLON);
2300
- const type = this.parseNamedType();
2301
- return this.node(start, {
2302
- kind: Kind.OPERATION_TYPE_DEFINITION,
2303
- operation,
2304
- type
2305
- });
2306
- }
2307
- /**
2308
- * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
2309
- *
2310
- * @internal
2311
- */
2312
- parseScalarTypeDefinition() {
2313
- const start = this._lexer.token;
2314
- const description = this.parseDescription();
2315
- this.expectKeyword("scalar");
2316
- const name = this.parseName();
2317
- const directives = this.parseConstDirectives();
2318
- return this.node(start, {
2319
- kind: Kind.SCALAR_TYPE_DEFINITION,
2320
- description,
2321
- name,
2322
- directives
2323
- });
2324
- }
2325
- /**
2326
- * ObjectTypeDefinition :
2327
- * Description?
2328
- * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
2329
- *
2330
- * @internal
2331
- */
2332
- parseObjectTypeDefinition() {
2333
- const start = this._lexer.token;
2334
- const description = this.parseDescription();
2335
- this.expectKeyword("type");
2336
- const name = this.parseName();
2337
- const interfaces = this.parseImplementsInterfaces();
2338
- const directives = this.parseConstDirectives();
2339
- const fields = this.parseFieldsDefinition();
2340
- return this.node(start, {
2341
- kind: Kind.OBJECT_TYPE_DEFINITION,
2342
- description,
2343
- name,
2344
- interfaces,
2345
- directives,
2346
- fields
2347
- });
2348
- }
2349
- /**
2350
- * ImplementsInterfaces :
2351
- * - implements `&`? NamedType
2352
- * - ImplementsInterfaces & NamedType
2353
- *
2354
- * @internal
2355
- */
2356
- parseImplementsInterfaces() {
2357
- return this.expectOptionalKeyword("implements") ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) : [];
2358
- }
2359
- /**
2360
- * ```
2361
- * FieldsDefinition : { FieldDefinition+ }
2362
- * ```
2363
- *
2364
- * @internal
2365
- */
2366
- parseFieldsDefinition() {
2367
- return this.optionalMany(
2368
- TokenKind.BRACE_L,
2369
- this.parseFieldDefinition,
2370
- TokenKind.BRACE_R
2371
- );
2372
- }
2373
- /**
2374
- * FieldDefinition :
2375
- * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
2376
- *
2377
- * @internal
2378
- */
2379
- parseFieldDefinition() {
2380
- const start = this._lexer.token;
2381
- const description = this.parseDescription();
2382
- const name = this.parseName();
2383
- const args = this.parseArgumentDefs();
2384
- this.expectToken(TokenKind.COLON);
2385
- const type = this.parseTypeReference();
2386
- const directives = this.parseConstDirectives();
2387
- return this.node(start, {
2388
- kind: Kind.FIELD_DEFINITION,
2389
- description,
2390
- name,
2391
- arguments: args,
2392
- type,
2393
- directives
2394
- });
2395
- }
2396
- /**
2397
- * ArgumentsDefinition : ( InputValueDefinition+ )
2398
- *
2399
- * @internal
2400
- */
2401
- parseArgumentDefs() {
2402
- return this.optionalMany(
2403
- TokenKind.PAREN_L,
2404
- this.parseInputValueDef,
2405
- TokenKind.PAREN_R
2406
- );
2407
- }
2408
- /**
2409
- * InputValueDefinition :
2410
- * - Description? Name : Type DefaultValue? Directives[Const]?
2411
- *
2412
- * @internal
2413
- */
2414
- parseInputValueDef() {
2415
- const start = this._lexer.token;
2416
- const description = this.parseDescription();
2417
- const name = this.parseName();
2418
- this.expectToken(TokenKind.COLON);
2419
- const type = this.parseTypeReference();
2420
- let defaultValue;
2421
- if (this.expectOptionalToken(TokenKind.EQUALS)) {
2422
- defaultValue = this.parseConstValueLiteral();
2423
- }
2424
- const directives = this.parseConstDirectives();
2425
- return this.node(start, {
2426
- kind: Kind.INPUT_VALUE_DEFINITION,
2427
- description,
2428
- name,
2429
- type,
2430
- defaultValue,
2431
- directives
2432
- });
2433
- }
2434
- /**
2435
- * InterfaceTypeDefinition :
2436
- * - Description? interface Name Directives[Const]? FieldsDefinition?
2437
- *
2438
- * @internal
2439
- */
2440
- parseInterfaceTypeDefinition() {
2441
- const start = this._lexer.token;
2442
- const description = this.parseDescription();
2443
- this.expectKeyword("interface");
2444
- const name = this.parseName();
2445
- const interfaces = this.parseImplementsInterfaces();
2446
- const directives = this.parseConstDirectives();
2447
- const fields = this.parseFieldsDefinition();
2448
- return this.node(start, {
2449
- kind: Kind.INTERFACE_TYPE_DEFINITION,
2450
- description,
2451
- name,
2452
- interfaces,
2453
- directives,
2454
- fields
2455
- });
2456
- }
2457
- /**
2458
- * UnionTypeDefinition :
2459
- * - Description? union Name Directives[Const]? UnionMemberTypes?
2460
- *
2461
- * @internal
2462
- */
2463
- parseUnionTypeDefinition() {
2464
- const start = this._lexer.token;
2465
- const description = this.parseDescription();
2466
- this.expectKeyword("union");
2467
- const name = this.parseName();
2468
- const directives = this.parseConstDirectives();
2469
- const types = this.parseUnionMemberTypes();
2470
- return this.node(start, {
2471
- kind: Kind.UNION_TYPE_DEFINITION,
2472
- description,
2473
- name,
2474
- directives,
2475
- types
2476
- });
2477
- }
2478
- /**
2479
- * UnionMemberTypes :
2480
- * - = `|`? NamedType
2481
- * - UnionMemberTypes | NamedType
2482
- *
2483
- * @internal
2484
- */
2485
- parseUnionMemberTypes() {
2486
- return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];
2487
- }
2488
- /**
2489
- * EnumTypeDefinition :
2490
- * - Description? enum Name Directives[Const]? EnumValuesDefinition?
2491
- *
2492
- * @internal
2493
- */
2494
- parseEnumTypeDefinition() {
2495
- const start = this._lexer.token;
2496
- const description = this.parseDescription();
2497
- this.expectKeyword("enum");
2498
- const name = this.parseName();
2499
- const directives = this.parseConstDirectives();
2500
- const values = this.parseEnumValuesDefinition();
2501
- return this.node(start, {
2502
- kind: Kind.ENUM_TYPE_DEFINITION,
2503
- description,
2504
- name,
2505
- directives,
2506
- values
2507
- });
2508
- }
2509
- /**
2510
- * ```
2511
- * EnumValuesDefinition : { EnumValueDefinition+ }
2512
- * ```
2513
- *
2514
- * @internal
2515
- */
2516
- parseEnumValuesDefinition() {
2517
- return this.optionalMany(
2518
- TokenKind.BRACE_L,
2519
- this.parseEnumValueDefinition,
2520
- TokenKind.BRACE_R
2521
- );
2522
- }
2523
- /**
2524
- * EnumValueDefinition : Description? EnumValue Directives[Const]?
2525
- *
2526
- * @internal
2527
- */
2528
- parseEnumValueDefinition() {
2529
- const start = this._lexer.token;
2530
- const description = this.parseDescription();
2531
- const name = this.parseEnumValueName();
2532
- const directives = this.parseConstDirectives();
2533
- return this.node(start, {
2534
- kind: Kind.ENUM_VALUE_DEFINITION,
2535
- description,
2536
- name,
2537
- directives
2538
- });
2539
- }
2540
- /**
2541
- * EnumValue : Name but not `true`, `false` or `null`
2542
- *
2543
- * @internal
2544
- */
2545
- parseEnumValueName() {
2546
- if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") {
2547
- throw syntaxError(
2548
- this._lexer.source,
2549
- this._lexer.token.start,
2550
- `${getTokenDesc(
2551
- this._lexer.token
2552
- )} is reserved and cannot be used for an enum value.`
2553
- );
2554
- }
2555
- return this.parseName();
2556
- }
2557
- /**
2558
- * InputObjectTypeDefinition :
2559
- * - Description? input Name Directives[Const]? InputFieldsDefinition?
2560
- *
2561
- * @internal
2562
- */
2563
- parseInputObjectTypeDefinition() {
2564
- const start = this._lexer.token;
2565
- const description = this.parseDescription();
2566
- this.expectKeyword("input");
2567
- const name = this.parseName();
2568
- const directives = this.parseConstDirectives();
2569
- const fields = this.parseInputFieldsDefinition();
2570
- return this.node(start, {
2571
- kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
2572
- description,
2573
- name,
2574
- directives,
2575
- fields
2576
- });
2577
- }
2578
- /**
2579
- * ```
2580
- * InputFieldsDefinition : { InputValueDefinition+ }
2581
- * ```
2582
- *
2583
- * @internal
2584
- */
2585
- parseInputFieldsDefinition() {
2586
- return this.optionalMany(
2587
- TokenKind.BRACE_L,
2588
- this.parseInputValueDef,
2589
- TokenKind.BRACE_R
2590
- );
2591
- }
2592
- /**
2593
- * TypeSystemExtension :
2594
- * - SchemaExtension
2595
- * - TypeExtension
2596
- *
2597
- * TypeExtension :
2598
- * - ScalarTypeExtension
2599
- * - ObjectTypeExtension
2600
- * - InterfaceTypeExtension
2601
- * - UnionTypeExtension
2602
- * - EnumTypeExtension
2603
- * - InputObjectTypeDefinition
2604
- * - DirectiveDefinitionExtension
2605
- *
2606
- * @internal
2607
- */
2608
- parseTypeSystemExtension() {
2609
- const keywordToken = this._lexer.lookahead();
2610
- if (keywordToken.kind === TokenKind.NAME) {
2611
- switch (keywordToken.value) {
2612
- case "schema":
2613
- return this.parseSchemaExtension();
2614
- case "scalar":
2615
- return this.parseScalarTypeExtension();
2616
- case "type":
2617
- return this.parseObjectTypeExtension();
2618
- case "interface":
2619
- return this.parseInterfaceTypeExtension();
2620
- case "union":
2621
- return this.parseUnionTypeExtension();
2622
- case "enum":
2623
- return this.parseEnumTypeExtension();
2624
- case "input":
2625
- return this.parseInputObjectTypeExtension();
2626
- case "directive":
2627
- if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
2628
- return this.parseDirectiveDefinitionExtension();
2629
- }
2630
- break;
2631
- }
2632
- }
2633
- throw this.unexpected(keywordToken);
2634
- }
2635
- /**
2636
- * ```
2637
- * SchemaExtension :
2638
- * - extend schema Directives[Const]? { OperationTypeDefinition+ }
2639
- * - extend schema Directives[Const]
2640
- * ```
2641
- *
2642
- * @internal
2643
- */
2644
- parseSchemaExtension() {
2645
- const start = this._lexer.token;
2646
- this.expectKeyword("extend");
2647
- this.expectKeyword("schema");
2648
- const directives = this.parseConstDirectives();
2649
- const operationTypes = this.optionalMany(
2650
- TokenKind.BRACE_L,
2651
- this.parseOperationTypeDefinition,
2652
- TokenKind.BRACE_R
2653
- );
2654
- if (directives.length === 0 && operationTypes.length === 0) {
2655
- throw this.unexpected();
2656
- }
2657
- return this.node(start, {
2658
- kind: Kind.SCHEMA_EXTENSION,
2659
- directives,
2660
- operationTypes
2661
- });
2662
- }
2663
- /**
2664
- * ScalarTypeExtension :
2665
- * - extend scalar Name Directives[Const]
2666
- *
2667
- * @internal
2668
- */
2669
- parseScalarTypeExtension() {
2670
- const start = this._lexer.token;
2671
- this.expectKeyword("extend");
2672
- this.expectKeyword("scalar");
2673
- const name = this.parseName();
2674
- const directives = this.parseConstDirectives();
2675
- if (directives.length === 0) {
2676
- throw this.unexpected();
2677
- }
2678
- return this.node(start, {
2679
- kind: Kind.SCALAR_TYPE_EXTENSION,
2680
- name,
2681
- directives
2682
- });
2683
- }
2684
- /**
2685
- * ObjectTypeExtension :
2686
- * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2687
- * - extend type Name ImplementsInterfaces? Directives[Const]
2688
- * - extend type Name ImplementsInterfaces
2689
- *
2690
- * @internal
2691
- */
2692
- parseObjectTypeExtension() {
2693
- const start = this._lexer.token;
2694
- this.expectKeyword("extend");
2695
- this.expectKeyword("type");
2696
- const name = this.parseName();
2697
- const interfaces = this.parseImplementsInterfaces();
2698
- const directives = this.parseConstDirectives();
2699
- const fields = this.parseFieldsDefinition();
2700
- if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
2701
- throw this.unexpected();
2702
- }
2703
- return this.node(start, {
2704
- kind: Kind.OBJECT_TYPE_EXTENSION,
2705
- name,
2706
- interfaces,
2707
- directives,
2708
- fields
2709
- });
2710
- }
2711
- /**
2712
- * InterfaceTypeExtension :
2713
- * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2714
- * - extend interface Name ImplementsInterfaces? Directives[Const]
2715
- * - extend interface Name ImplementsInterfaces
2716
- *
2717
- * @internal
2718
- */
2719
- parseInterfaceTypeExtension() {
2720
- const start = this._lexer.token;
2721
- this.expectKeyword("extend");
2722
- this.expectKeyword("interface");
2723
- const name = this.parseName();
2724
- const interfaces = this.parseImplementsInterfaces();
2725
- const directives = this.parseConstDirectives();
2726
- const fields = this.parseFieldsDefinition();
2727
- if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {
2728
- throw this.unexpected();
2729
- }
2730
- return this.node(start, {
2731
- kind: Kind.INTERFACE_TYPE_EXTENSION,
2732
- name,
2733
- interfaces,
2734
- directives,
2735
- fields
2736
- });
2737
- }
2738
- /**
2739
- * UnionTypeExtension :
2740
- * - extend union Name Directives[Const]? UnionMemberTypes
2741
- * - extend union Name Directives[Const]
2742
- *
2743
- * @internal
2744
- */
2745
- parseUnionTypeExtension() {
2746
- const start = this._lexer.token;
2747
- this.expectKeyword("extend");
2748
- this.expectKeyword("union");
2749
- const name = this.parseName();
2750
- const directives = this.parseConstDirectives();
2751
- const types = this.parseUnionMemberTypes();
2752
- if (directives.length === 0 && types.length === 0) {
2753
- throw this.unexpected();
2754
- }
2755
- return this.node(start, {
2756
- kind: Kind.UNION_TYPE_EXTENSION,
2757
- name,
2758
- directives,
2759
- types
2760
- });
2761
- }
2762
- /**
2763
- * EnumTypeExtension :
2764
- * - extend enum Name Directives[Const]? EnumValuesDefinition
2765
- * - extend enum Name Directives[Const]
2766
- *
2767
- * @internal
2768
- */
2769
- parseEnumTypeExtension() {
2770
- const start = this._lexer.token;
2771
- this.expectKeyword("extend");
2772
- this.expectKeyword("enum");
2773
- const name = this.parseName();
2774
- const directives = this.parseConstDirectives();
2775
- const values = this.parseEnumValuesDefinition();
2776
- if (directives.length === 0 && values.length === 0) {
2777
- throw this.unexpected();
2778
- }
2779
- return this.node(start, {
2780
- kind: Kind.ENUM_TYPE_EXTENSION,
2781
- name,
2782
- directives,
2783
- values
2784
- });
2785
- }
2786
- /**
2787
- * InputObjectTypeExtension :
2788
- * - extend input Name Directives[Const]? InputFieldsDefinition
2789
- * - extend input Name Directives[Const]
2790
- *
2791
- * @internal
2792
- */
2793
- parseInputObjectTypeExtension() {
2794
- const start = this._lexer.token;
2795
- this.expectKeyword("extend");
2796
- this.expectKeyword("input");
2797
- const name = this.parseName();
2798
- const directives = this.parseConstDirectives();
2799
- const fields = this.parseInputFieldsDefinition();
2800
- if (directives.length === 0 && fields.length === 0) {
2801
- throw this.unexpected();
2802
- }
2803
- return this.node(start, {
2804
- kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
2805
- name,
2806
- directives,
2807
- fields
2808
- });
2809
- }
2810
- parseDirectiveDefinitionExtension() {
2811
- const start = this._lexer.token;
2812
- this.expectKeyword("extend");
2813
- this.expectKeyword("directive");
2814
- this.expectToken(TokenKind.AT);
2815
- const name = this.parseName();
2816
- const directives = this.parseConstDirectives();
2817
- if (directives.length === 0) {
2818
- throw this.unexpected();
2819
- }
2820
- return this.node(start, {
2821
- kind: Kind.DIRECTIVE_EXTENSION,
2822
- name,
2823
- directives
2824
- });
2825
- }
2826
- /**
2827
- * ```
2828
- * DirectiveDefinition :
2829
- * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
2830
- * ```
2831
- *
2832
- * @internal
2833
- */
2834
- parseDirectiveDefinition() {
2835
- const start = this._lexer.token;
2836
- const description = this.parseDescription();
2837
- this.expectKeyword("directive");
2838
- this.expectToken(TokenKind.AT);
2839
- const name = this.parseName();
2840
- const args = this.parseArgumentDefs();
2841
- const directives = this._options.experimentalDirectivesOnDirectiveDefinitions ? this.parseConstDirectives() : [];
2842
- const repeatable = this.expectOptionalKeyword("repeatable");
2843
- this.expectKeyword("on");
2844
- const locations = this.parseDirectiveLocations();
2845
- return this.node(start, {
2846
- kind: Kind.DIRECTIVE_DEFINITION,
2847
- description,
2848
- name,
2849
- arguments: args,
2850
- directives,
2851
- repeatable,
2852
- locations
2853
- });
2854
- }
2855
- /**
2856
- * DirectiveLocations :
2857
- * - `|`? DirectiveLocation
2858
- * - DirectiveLocations | DirectiveLocation
2859
- *
2860
- * @internal
2861
- */
2862
- parseDirectiveLocations() {
2863
- return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
2864
- }
2865
- /*
2866
- * DirectiveLocation :
2867
- * - ExecutableDirectiveLocation
2868
- * - TypeSystemDirectiveLocation
2869
- *
2870
- * ExecutableDirectiveLocation : one of
2871
- * `QUERY`
2872
- * `MUTATION`
2873
- * `SUBSCRIPTION`
2874
- * `FIELD`
2875
- * `FRAGMENT_DEFINITION`
2876
- * `FRAGMENT_SPREAD`
2877
- * `INLINE_FRAGMENT`
2878
- *
2879
- * TypeSystemDirectiveLocation : one of
2880
- * `SCHEMA`
2881
- * `SCALAR`
2882
- * `OBJECT`
2883
- * `FIELD_DEFINITION`
2884
- * `ARGUMENT_DEFINITION`
2885
- * `INTERFACE`
2886
- * `UNION`
2887
- * `ENUM`
2888
- * `ENUM_VALUE`
2889
- * `INPUT_OBJECT`
2890
- * `INPUT_FIELD_DEFINITION`
2891
- * `DIRECTIVE_DEFINITION`
2892
- */
2893
- parseDirectiveLocation() {
2894
- const start = this._lexer.token;
2895
- const name = this.parseName();
2896
- if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {
2897
- return name;
2898
- }
2899
- throw this.unexpected(start);
2900
- }
2901
- // Schema Coordinates
2902
- /**
2903
- * SchemaCoordinate :
2904
- * - Name
2905
- * - Name . Name
2906
- * - Name . Name ( Name : )
2907
- * - \@ Name
2908
- * - \@ Name ( Name : )
2909
- * @returns Parsed schema coordinate AST.
2910
- * @example
2911
- * ```ts
2912
- * import { Parser, Source } from 'graphql/language';
2913
- *
2914
- * const typeCoordinate = new Parser(new Source('User.name')).parseSchemaCoordinate();
2915
- * const directiveCoordinate = new Parser(new Source('@include(if:)')).parseSchemaCoordinate();
2916
- *
2917
- * typeCoordinate.name.value; // => 'User'
2918
- * typeCoordinate.memberName?.value; // => 'name'
2919
- * directiveCoordinate.name.value; // => 'deprecated'
2920
- * directiveCoordinate.argumentName?.value; // => 'reason'
2921
- * ```
2922
- */
2923
- parseSchemaCoordinate() {
2924
- const start = this._lexer.token;
2925
- const ofDirective = this.expectOptionalToken(TokenKind.AT);
2926
- const name = this.parseName();
2927
- let memberName;
2928
- if (!ofDirective && this.expectOptionalToken(TokenKind.DOT)) {
2929
- memberName = this.parseName();
2930
- }
2931
- let argumentName;
2932
- if ((ofDirective || memberName) && this.expectOptionalToken(TokenKind.PAREN_L)) {
2933
- argumentName = this.parseName();
2934
- this.expectToken(TokenKind.COLON);
2935
- this.expectToken(TokenKind.PAREN_R);
2936
- }
2937
- if (ofDirective) {
2938
- if (argumentName) {
2939
- return this.node(start, {
2940
- kind: Kind.DIRECTIVE_ARGUMENT_COORDINATE,
2941
- name,
2942
- argumentName
2943
- });
2944
- }
2945
- return this.node(start, {
2946
- kind: Kind.DIRECTIVE_COORDINATE,
2947
- name
2948
- });
2949
- } else if (memberName) {
2950
- if (argumentName) {
2951
- return this.node(start, {
2952
- kind: Kind.ARGUMENT_COORDINATE,
2953
- name,
2954
- fieldName: memberName,
2955
- argumentName
2956
- });
2957
- }
2958
- return this.node(start, {
2959
- kind: Kind.MEMBER_COORDINATE,
2960
- name,
2961
- memberName
2962
- });
2963
- }
2964
- return this.node(start, {
2965
- kind: Kind.TYPE_COORDINATE,
2966
- name
2967
- });
2968
- }
2969
- // Core parsing utility functions
2970
- /**
2971
- * Returns a node that, if configured to do so, sets a "loc" field as a
2972
- * location object, used to identify the place in the source that created a
2973
- * given parsed object.
2974
- *
2975
- * @internal
2976
- */
2977
- node(startToken, node) {
2978
- if (this._options.noLocation !== true) {
2979
- node.loc = new Location(
2980
- startToken,
2981
- this._lexer.lastToken,
2982
- this._lexer.source
2983
- );
2984
- }
2985
- return node;
2986
- }
2987
- /**
2988
- * Determines if the next token is of a given kind
2989
- *
2990
- * @internal
2991
- */
2992
- peek(kind) {
2993
- return this._lexer.token.kind === kind;
2994
- }
2995
- /**
2996
- * If the next token is of the given kind, return that token after advancing the lexer.
2997
- * Otherwise, do not change the parser state and throw an error.
2998
- *
2999
- * @internal
3000
- */
3001
- expectToken(kind) {
3002
- const token = this._lexer.token;
3003
- if (token.kind === kind) {
3004
- this.advanceLexer();
3005
- return token;
3006
- }
3007
- throw syntaxError(
3008
- this._lexer.source,
3009
- token.start,
3010
- `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
3011
- );
3012
- }
3013
- /**
3014
- * If the next token is of the given kind, return "true" after advancing the lexer.
3015
- * Otherwise, do not change the parser state and return "false".
3016
- *
3017
- * @internal
3018
- */
3019
- expectOptionalToken(kind) {
3020
- const token = this._lexer.token;
3021
- if (token.kind === kind) {
3022
- this.advanceLexer();
3023
- return true;
3024
- }
3025
- return false;
3026
- }
3027
- /**
3028
- * If the next token is a given keyword, advance the lexer.
3029
- * Otherwise, do not change the parser state and throw an error.
3030
- *
3031
- * @internal
3032
- */
3033
- expectKeyword(value) {
3034
- const token = this._lexer.token;
3035
- if (token.kind === TokenKind.NAME && token.value === value) {
3036
- this.advanceLexer();
3037
- } else {
3038
- throw syntaxError(
3039
- this._lexer.source,
3040
- token.start,
3041
- `Expected "${value}", found ${getTokenDesc(token)}.`
3042
- );
3043
- }
3044
- }
3045
- /**
3046
- * If the next token is a given keyword, return "true" after advancing the lexer.
3047
- * Otherwise, do not change the parser state and return "false".
3048
- *
3049
- * @internal
3050
- */
3051
- expectOptionalKeyword(value) {
3052
- const token = this._lexer.token;
3053
- if (token.kind === TokenKind.NAME && token.value === value) {
3054
- this.advanceLexer();
3055
- return true;
3056
- }
3057
- return false;
3058
- }
3059
- /**
3060
- * Helper function for creating an error when an unexpected lexed token is encountered.
3061
- *
3062
- * @internal
3063
- */
3064
- unexpected(atToken) {
3065
- const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
3066
- return syntaxError(
3067
- this._lexer.source,
3068
- token.start,
3069
- `Unexpected ${getTokenDesc(token)}.`
3070
- );
3071
- }
3072
- /**
3073
- * Returns a possibly empty list of parse nodes, determined by the parseFn.
3074
- * This list begins with a lex token of openKind and ends with a lex token of closeKind.
3075
- * Advances the parser to the next lex token after the closing token.
3076
- *
3077
- * @internal
3078
- */
3079
- any(openKind, parseFn, closeKind) {
3080
- this.expectToken(openKind);
3081
- const nodes = [];
3082
- while (!this.expectOptionalToken(closeKind)) {
3083
- nodes.push(parseFn.call(this));
3084
- }
3085
- return nodes;
3086
- }
3087
- /**
3088
- * Returns a list of parse nodes, determined by the parseFn.
3089
- * It can be empty only if open token is missing otherwise it will always return non-empty list
3090
- * that begins with a lex token of openKind and ends with a lex token of closeKind.
3091
- * Advances the parser to the next lex token after the closing token.
3092
- *
3093
- * @internal
3094
- */
3095
- optionalMany(openKind, parseFn, closeKind) {
3096
- if (this.expectOptionalToken(openKind)) {
3097
- const nodes = [];
3098
- do {
3099
- nodes.push(parseFn.call(this));
3100
- } while (!this.expectOptionalToken(closeKind));
3101
- return nodes;
3102
- }
3103
- return [];
3104
- }
3105
- /**
3106
- * Returns a non-empty list of parse nodes, determined by the parseFn.
3107
- * This list begins with a lex token of openKind and ends with a lex token of closeKind.
3108
- * Advances the parser to the next lex token after the closing token.
3109
- *
3110
- * @internal
3111
- */
3112
- many(openKind, parseFn, closeKind) {
3113
- this.expectToken(openKind);
3114
- const nodes = [];
3115
- do {
3116
- nodes.push(parseFn.call(this));
3117
- } while (!this.expectOptionalToken(closeKind));
3118
- return nodes;
3119
- }
3120
- /**
3121
- * Returns a non-empty list of parse nodes, determined by the parseFn.
3122
- * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
3123
- * Advances the parser to the next lex token after last item in the list.
3124
- *
3125
- * @internal
3126
- */
3127
- delimitedMany(delimiterKind, parseFn) {
3128
- this.expectOptionalToken(delimiterKind);
3129
- const nodes = [];
3130
- do {
3131
- nodes.push(parseFn.call(this));
3132
- } while (this.expectOptionalToken(delimiterKind));
3133
- return nodes;
3134
- }
3135
- advanceLexer() {
3136
- const { maxTokens } = this._options;
3137
- const token = this._lexer.advance();
3138
- if (token.kind !== TokenKind.EOF) {
3139
- ++this._tokenCounter;
3140
- if (maxTokens !== void 0 && this._tokenCounter > maxTokens) {
3141
- throw syntaxError(
3142
- this._lexer.source,
3143
- token.start,
3144
- `Document contains more that ${maxTokens} tokens. Parsing aborted.`
3145
- );
3146
- }
3147
- }
3148
- }
3149
- };
3150
- function getTokenDesc(token) {
3151
- const value = token.value;
3152
- return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : "");
3153
- }
3154
- function getTokenKindDesc(kind) {
3155
- return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
3156
- }
3157
-
3158
166
  // node_modules/graphql-tag/lib/index.js
167
+ var import_graphql = require("graphql");
3159
168
  var docCache = /* @__PURE__ */ new Map();
3160
169
  var fragmentSourceMap = /* @__PURE__ */ new Map();
3161
170
  var printFragmentWarnings = true;
@@ -3214,7 +223,7 @@ function stripLoc(doc) {
3214
223
  function parseDocument(source) {
3215
224
  var cacheKey = normalize(source);
3216
225
  if (!docCache.has(cacheKey)) {
3217
- var parsed = parse(source, {
226
+ var parsed = (0, import_graphql.parse)(source, {
3218
227
  experimentalFragmentVariables,
3219
228
  allowLegacyFragmentVariables: experimentalFragmentVariables,
3220
229
  experimentalFragmentArguments: experimentalFragmentVariables
@@ -3274,6 +283,7 @@ gql["default"] = gql;
3274
283
  setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
3275
284
 
3276
285
  // node_modules/@timardex/cluemart-shared/dist/index.mjs
286
+ var import_graphql2 = require("graphql");
3277
287
  var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus22) => {
3278
288
  EnumInviteStatus22["ACCEPTED"] = "Accepted";
3279
289
  EnumInviteStatus22["COMPLETED"] = "Completed";
@@ -4850,7 +1860,7 @@ var registerFields = [
4850
1860
  required: true
4851
1861
  },
4852
1862
  {
4853
- helperText: "Enter Nickname (optional)",
1863
+ helperText: "Used instead of your name on ClueMart. If blank, your email username is used.",
4854
1864
  keyboardType: "default",
4855
1865
  name: "nickName",
4856
1866
  placeholder: "Nickname",
@@ -4918,7 +1928,7 @@ var profileFields = [
4918
1928
  required: true
4919
1929
  },
4920
1930
  {
4921
- helperText: "Enter Nickname (optional)",
1931
+ helperText: "Used instead of your name on ClueMart. If blank, your email username is used.",
4922
1932
  keyboardType: "default",
4923
1933
  name: "nickName",
4924
1934
  placeholder: "Nickname",