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