@bcrumbs.net/bc-api 0.0.19 → 0.0.21

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.
package/index.esm.js CHANGED
@@ -1,4 +1,3 @@
1
- import { parse as parse$1 } from 'graphql';
2
1
  import { InMemoryCache, ApolloClient, from, useQuery, createHttpLink, useMutation, useLazyQuery } from '@apollo/client';
3
2
  import { onError } from '@apollo/client/link/error';
4
3
  import { setContext } from '@apollo/client/link/context';
@@ -6,8 +5,6 @@ import { RestLink } from 'apollo-link-rest';
6
5
  import withApollo from 'next-with-apollo';
7
6
  import decode from 'jwt-decode';
8
7
  import { isAfter } from 'date-fns';
9
- import { InMemoryCache as InMemoryCache$1 } from 'apollo-cache-inmemory';
10
- import { createHttpLink as createHttpLink$1 } from 'apollo-link-http';
11
8
  import Stream from 'stream';
12
9
  import http from 'http';
13
10
  import Url from 'url';
@@ -49,6 +46,3310 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
49
46
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
50
47
  };
51
48
 
49
+ function devAssert(condition, message) {
50
+ const booleanCondition = Boolean(condition);
51
+
52
+ if (!booleanCondition) {
53
+ throw new Error(message);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Return true if `value` is object-like. A value is object-like if it's not
59
+ * `null` and has a `typeof` result of "object".
60
+ */
61
+ function isObjectLike(value) {
62
+ return typeof value == 'object' && value !== null;
63
+ }
64
+
65
+ function invariant(condition, message) {
66
+ const booleanCondition = Boolean(condition);
67
+
68
+ if (!booleanCondition) {
69
+ throw new Error(
70
+ message != null ? message : 'Unexpected invariant triggered.',
71
+ );
72
+ }
73
+ }
74
+
75
+ const LineRegExp = /\r\n|[\n\r]/g;
76
+ /**
77
+ * Represents a location in a Source.
78
+ */
79
+
80
+ /**
81
+ * Takes a Source and a UTF-8 character offset, and returns the corresponding
82
+ * line and column as a SourceLocation.
83
+ */
84
+ function getLocation(source, position) {
85
+ let lastLineStart = 0;
86
+ let line = 1;
87
+
88
+ for (const match of source.body.matchAll(LineRegExp)) {
89
+ typeof match.index === 'number' || invariant(false);
90
+
91
+ if (match.index >= position) {
92
+ break;
93
+ }
94
+
95
+ lastLineStart = match.index + match[0].length;
96
+ line += 1;
97
+ }
98
+
99
+ return {
100
+ line,
101
+ column: position + 1 - lastLineStart,
102
+ };
103
+ }
104
+
105
+ /**
106
+ * Render a helpful description of the location in the GraphQL Source document.
107
+ */
108
+ function printLocation(location) {
109
+ return printSourceLocation(
110
+ location.source,
111
+ getLocation(location.source, location.start),
112
+ );
113
+ }
114
+ /**
115
+ * Render a helpful description of the location in the GraphQL Source document.
116
+ */
117
+
118
+ function printSourceLocation(source, sourceLocation) {
119
+ const firstLineColumnOffset = source.locationOffset.column - 1;
120
+ const body = ''.padStart(firstLineColumnOffset) + source.body;
121
+ const lineIndex = sourceLocation.line - 1;
122
+ const lineOffset = source.locationOffset.line - 1;
123
+ const lineNum = sourceLocation.line + lineOffset;
124
+ const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
125
+ const columnNum = sourceLocation.column + columnOffset;
126
+ const locationStr = `${source.name}:${lineNum}:${columnNum}\n`;
127
+ const lines = body.split(/\r\n|[\n\r]/g);
128
+ const locationLine = lines[lineIndex]; // Special case for minified documents
129
+
130
+ if (locationLine.length > 120) {
131
+ const subLineIndex = Math.floor(columnNum / 80);
132
+ const subLineColumnNum = columnNum % 80;
133
+ const subLines = [];
134
+
135
+ for (let i = 0; i < locationLine.length; i += 80) {
136
+ subLines.push(locationLine.slice(i, i + 80));
137
+ }
138
+
139
+ return (
140
+ locationStr +
141
+ printPrefixedLines([
142
+ [`${lineNum} |`, subLines[0]],
143
+ ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),
144
+ ['|', '^'.padStart(subLineColumnNum)],
145
+ ['|', subLines[subLineIndex + 1]],
146
+ ])
147
+ );
148
+ }
149
+
150
+ return (
151
+ locationStr +
152
+ printPrefixedLines([
153
+ // Lines specified like this: ["prefix", "string"],
154
+ [`${lineNum - 1} |`, lines[lineIndex - 1]],
155
+ [`${lineNum} |`, locationLine],
156
+ ['|', '^'.padStart(columnNum)],
157
+ [`${lineNum + 1} |`, lines[lineIndex + 1]],
158
+ ])
159
+ );
160
+ }
161
+
162
+ function printPrefixedLines(lines) {
163
+ const existingLines = lines.filter(([_, line]) => line !== undefined);
164
+ const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
165
+ return existingLines
166
+ .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))
167
+ .join('\n');
168
+ }
169
+
170
+ function toNormalizedOptions(args) {
171
+ const firstArg = args[0];
172
+
173
+ if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {
174
+ return {
175
+ nodes: firstArg,
176
+ source: args[1],
177
+ positions: args[2],
178
+ path: args[3],
179
+ originalError: args[4],
180
+ extensions: args[5],
181
+ };
182
+ }
183
+
184
+ return firstArg;
185
+ }
186
+ /**
187
+ * A GraphQLError describes an Error found during the parse, validate, or
188
+ * execute phases of performing a GraphQL operation. In addition to a message
189
+ * and stack trace, it also includes information about the locations in a
190
+ * GraphQL document and/or execution result that correspond to the Error.
191
+ */
192
+
193
+ 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
+ /**
206
+ * An array describing the JSON-path into the execution response which
207
+ * corresponds to this error. Only included for errors during execution.
208
+ *
209
+ * Enumerable, and appears in the result of JSON.stringify().
210
+ */
211
+
212
+ /**
213
+ * An array of GraphQL AST Nodes corresponding to this error.
214
+ */
215
+
216
+ /**
217
+ * The source GraphQL document for the first location of this error.
218
+ *
219
+ * Note that if this Error represents more than one node, the source may not
220
+ * represent nodes after the first node.
221
+ */
222
+
223
+ /**
224
+ * An array of character offsets within the source GraphQL document
225
+ * which correspond to this error.
226
+ */
227
+
228
+ /**
229
+ * The original error thrown from a field resolver during execution.
230
+ */
231
+
232
+ /**
233
+ * Extension fields to add to the formatted error.
234
+ */
235
+
236
+ /**
237
+ * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
238
+ */
239
+ constructor(message, ...rawArgs) {
240
+ var _this$nodes, _nodeLocations$, _ref;
241
+
242
+ const { nodes, source, positions, path, originalError, extensions } =
243
+ toNormalizedOptions(rawArgs);
244
+ super(message);
245
+ this.name = 'GraphQLError';
246
+ this.path = path !== null && path !== void 0 ? path : undefined;
247
+ this.originalError =
248
+ originalError !== null && originalError !== void 0
249
+ ? originalError
250
+ : undefined; // Compute list of blame nodes.
251
+
252
+ this.nodes = undefinedIfEmpty(
253
+ Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,
254
+ );
255
+ const nodeLocations = undefinedIfEmpty(
256
+ (_this$nodes = this.nodes) === null || _this$nodes === void 0
257
+ ? void 0
258
+ : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),
259
+ ); // Compute locations in the source for the given nodes/positions.
260
+
261
+ this.source =
262
+ source !== null && source !== void 0
263
+ ? source
264
+ : nodeLocations === null || nodeLocations === void 0
265
+ ? void 0
266
+ : (_nodeLocations$ = nodeLocations[0]) === null ||
267
+ _nodeLocations$ === void 0
268
+ ? void 0
269
+ : _nodeLocations$.source;
270
+ this.positions =
271
+ positions !== null && positions !== void 0
272
+ ? positions
273
+ : nodeLocations === null || nodeLocations === void 0
274
+ ? void 0
275
+ : nodeLocations.map((loc) => loc.start);
276
+ this.locations =
277
+ positions && source
278
+ ? positions.map((pos) => getLocation(source, pos))
279
+ : nodeLocations === null || nodeLocations === void 0
280
+ ? void 0
281
+ : nodeLocations.map((loc) => getLocation(loc.source, loc.start));
282
+ const originalExtensions = isObjectLike(
283
+ originalError === null || originalError === void 0
284
+ ? void 0
285
+ : originalError.extensions,
286
+ )
287
+ ? originalError === null || originalError === void 0
288
+ ? void 0
289
+ : originalError.extensions
290
+ : undefined;
291
+ this.extensions =
292
+ (_ref =
293
+ extensions !== null && extensions !== void 0
294
+ ? extensions
295
+ : originalExtensions) !== null && _ref !== void 0
296
+ ? _ref
297
+ : Object.create(null); // Only properties prescribed by the spec should be enumerable.
298
+ // Keep the rest as non-enumerable.
299
+
300
+ Object.defineProperties(this, {
301
+ message: {
302
+ writable: true,
303
+ enumerable: true,
304
+ },
305
+ name: {
306
+ enumerable: false,
307
+ },
308
+ nodes: {
309
+ enumerable: false,
310
+ },
311
+ source: {
312
+ enumerable: false,
313
+ },
314
+ positions: {
315
+ enumerable: false,
316
+ },
317
+ originalError: {
318
+ enumerable: false,
319
+ },
320
+ }); // Include (non-enumerable) stack trace.
321
+
322
+ /* c8 ignore start */
323
+ // FIXME: https://github.com/graphql/graphql-js/issues/2317
324
+
325
+ if (
326
+ originalError !== null &&
327
+ originalError !== void 0 &&
328
+ originalError.stack
329
+ ) {
330
+ Object.defineProperty(this, 'stack', {
331
+ value: originalError.stack,
332
+ writable: true,
333
+ configurable: true,
334
+ });
335
+ } else if (Error.captureStackTrace) {
336
+ Error.captureStackTrace(this, GraphQLError);
337
+ } else {
338
+ Object.defineProperty(this, 'stack', {
339
+ value: Error().stack,
340
+ writable: true,
341
+ configurable: true,
342
+ });
343
+ }
344
+ /* c8 ignore stop */
345
+ }
346
+
347
+ get [Symbol.toStringTag]() {
348
+ return 'GraphQLError';
349
+ }
350
+
351
+ toString() {
352
+ let output = this.message;
353
+
354
+ if (this.nodes) {
355
+ for (const node of this.nodes) {
356
+ if (node.loc) {
357
+ output += '\n\n' + printLocation(node.loc);
358
+ }
359
+ }
360
+ } else if (this.source && this.locations) {
361
+ for (const location of this.locations) {
362
+ output += '\n\n' + printSourceLocation(this.source, location);
363
+ }
364
+ }
365
+
366
+ return output;
367
+ }
368
+
369
+ toJSON() {
370
+ const formattedError = {
371
+ message: this.message,
372
+ };
373
+
374
+ if (this.locations != null) {
375
+ formattedError.locations = this.locations;
376
+ }
377
+
378
+ if (this.path != null) {
379
+ formattedError.path = this.path;
380
+ }
381
+
382
+ if (this.extensions != null && Object.keys(this.extensions).length > 0) {
383
+ formattedError.extensions = this.extensions;
384
+ }
385
+
386
+ return formattedError;
387
+ }
388
+ }
389
+
390
+ function undefinedIfEmpty(array) {
391
+ return array === undefined || array.length === 0 ? undefined : array;
392
+ }
393
+
394
+ /**
395
+ * Produces a GraphQLError representing a syntax error, containing useful
396
+ * descriptive information about the syntax error's position in the source.
397
+ */
398
+
399
+ function syntaxError(source, position, description) {
400
+ return new GraphQLError(`Syntax Error: ${description}`, {
401
+ source,
402
+ positions: [position],
403
+ });
404
+ }
405
+
406
+ /**
407
+ * Contains a range of UTF-8 character offsets and token references that
408
+ * identify the region of the source from which the AST derived.
409
+ */
410
+ class Location {
411
+ /**
412
+ * The character offset at which this Node begins.
413
+ */
414
+
415
+ /**
416
+ * The character offset at which this Node ends.
417
+ */
418
+
419
+ /**
420
+ * The Token at which this Node begins.
421
+ */
422
+
423
+ /**
424
+ * The Token at which this Node ends.
425
+ */
426
+
427
+ /**
428
+ * The Source document the AST represents.
429
+ */
430
+ constructor(startToken, endToken, source) {
431
+ this.start = startToken.start;
432
+ this.end = endToken.end;
433
+ this.startToken = startToken;
434
+ this.endToken = endToken;
435
+ this.source = source;
436
+ }
437
+
438
+ get [Symbol.toStringTag]() {
439
+ return 'Location';
440
+ }
441
+
442
+ toJSON() {
443
+ return {
444
+ start: this.start,
445
+ end: this.end,
446
+ };
447
+ }
448
+ }
449
+ /**
450
+ * Represents a range of characters represented by a lexical token
451
+ * within a Source.
452
+ */
453
+
454
+ class Token {
455
+ /**
456
+ * The kind of Token.
457
+ */
458
+
459
+ /**
460
+ * The character offset at which this Node begins.
461
+ */
462
+
463
+ /**
464
+ * The character offset at which this Node ends.
465
+ */
466
+
467
+ /**
468
+ * The 1-indexed line number on which this Token appears.
469
+ */
470
+
471
+ /**
472
+ * The 1-indexed column number at which this Token begins.
473
+ */
474
+
475
+ /**
476
+ * For non-punctuation tokens, represents the interpreted value of the token.
477
+ *
478
+ * Note: is undefined for punctuation tokens, but typed as string for
479
+ * convenience in the parser.
480
+ */
481
+
482
+ /**
483
+ * Tokens exist as nodes in a double-linked-list amongst all tokens
484
+ * including ignored tokens. <SOF> is always the first node and <EOF>
485
+ * the last.
486
+ */
487
+ constructor(kind, start, end, line, column, value) {
488
+ this.kind = kind;
489
+ this.start = start;
490
+ this.end = end;
491
+ this.line = line;
492
+ this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
493
+
494
+ this.value = value;
495
+ this.prev = null;
496
+ this.next = null;
497
+ }
498
+
499
+ get [Symbol.toStringTag]() {
500
+ return 'Token';
501
+ }
502
+
503
+ toJSON() {
504
+ return {
505
+ kind: this.kind,
506
+ value: this.value,
507
+ line: this.line,
508
+ column: this.column,
509
+ };
510
+ }
511
+ }
512
+ /** Name */
513
+
514
+ var OperationTypeNode;
515
+
516
+ (function (OperationTypeNode) {
517
+ OperationTypeNode['QUERY'] = 'query';
518
+ OperationTypeNode['MUTATION'] = 'mutation';
519
+ OperationTypeNode['SUBSCRIPTION'] = 'subscription';
520
+ })(OperationTypeNode || (OperationTypeNode = {}));
521
+
522
+ /**
523
+ * The set of allowed directive location values.
524
+ */
525
+ var DirectiveLocation;
526
+
527
+ (function (DirectiveLocation) {
528
+ DirectiveLocation['QUERY'] = 'QUERY';
529
+ DirectiveLocation['MUTATION'] = 'MUTATION';
530
+ DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION';
531
+ DirectiveLocation['FIELD'] = 'FIELD';
532
+ DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION';
533
+ DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD';
534
+ DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT';
535
+ DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION';
536
+ DirectiveLocation['SCHEMA'] = 'SCHEMA';
537
+ DirectiveLocation['SCALAR'] = 'SCALAR';
538
+ DirectiveLocation['OBJECT'] = 'OBJECT';
539
+ DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION';
540
+ DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION';
541
+ DirectiveLocation['INTERFACE'] = 'INTERFACE';
542
+ DirectiveLocation['UNION'] = 'UNION';
543
+ DirectiveLocation['ENUM'] = 'ENUM';
544
+ DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';
545
+ DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
546
+ DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
547
+ })(DirectiveLocation || (DirectiveLocation = {}));
548
+ /**
549
+ * The enum type representing the directive location values.
550
+ *
551
+ * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
552
+ */
553
+
554
+ /**
555
+ * The set of allowed kind values for AST nodes.
556
+ */
557
+ var Kind;
558
+
559
+ (function (Kind) {
560
+ Kind['NAME'] = 'Name';
561
+ Kind['DOCUMENT'] = 'Document';
562
+ Kind['OPERATION_DEFINITION'] = 'OperationDefinition';
563
+ Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';
564
+ Kind['SELECTION_SET'] = 'SelectionSet';
565
+ Kind['FIELD'] = 'Field';
566
+ Kind['ARGUMENT'] = 'Argument';
567
+ Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';
568
+ Kind['INLINE_FRAGMENT'] = 'InlineFragment';
569
+ Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';
570
+ Kind['VARIABLE'] = 'Variable';
571
+ Kind['INT'] = 'IntValue';
572
+ Kind['FLOAT'] = 'FloatValue';
573
+ Kind['STRING'] = 'StringValue';
574
+ Kind['BOOLEAN'] = 'BooleanValue';
575
+ Kind['NULL'] = 'NullValue';
576
+ Kind['ENUM'] = 'EnumValue';
577
+ Kind['LIST'] = 'ListValue';
578
+ Kind['OBJECT'] = 'ObjectValue';
579
+ Kind['OBJECT_FIELD'] = 'ObjectField';
580
+ Kind['DIRECTIVE'] = 'Directive';
581
+ Kind['NAMED_TYPE'] = 'NamedType';
582
+ Kind['LIST_TYPE'] = 'ListType';
583
+ Kind['NON_NULL_TYPE'] = 'NonNullType';
584
+ Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';
585
+ Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';
586
+ Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';
587
+ Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';
588
+ Kind['FIELD_DEFINITION'] = 'FieldDefinition';
589
+ Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';
590
+ Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';
591
+ Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';
592
+ Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';
593
+ Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';
594
+ Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';
595
+ Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';
596
+ Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';
597
+ Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';
598
+ Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';
599
+ Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';
600
+ Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';
601
+ Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
602
+ Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
603
+ })(Kind || (Kind = {}));
604
+ /**
605
+ * The enum type representing the possible kind values of AST nodes.
606
+ *
607
+ * @deprecated Please use `Kind`. Will be remove in v17.
608
+ */
609
+
610
+ /**
611
+ * ```
612
+ * WhiteSpace ::
613
+ * - "Horizontal Tab (U+0009)"
614
+ * - "Space (U+0020)"
615
+ * ```
616
+ * @internal
617
+ */
618
+ function isWhiteSpace(code) {
619
+ return code === 0x0009 || code === 0x0020;
620
+ }
621
+ /**
622
+ * ```
623
+ * Digit :: one of
624
+ * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
625
+ * ```
626
+ * @internal
627
+ */
628
+
629
+ function isDigit(code) {
630
+ return code >= 0x0030 && code <= 0x0039;
631
+ }
632
+ /**
633
+ * ```
634
+ * Letter :: one of
635
+ * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`
636
+ * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`
637
+ * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`
638
+ * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
639
+ * ```
640
+ * @internal
641
+ */
642
+
643
+ function isLetter(code) {
644
+ return (
645
+ (code >= 0x0061 && code <= 0x007a) || // A-Z
646
+ (code >= 0x0041 && code <= 0x005a) // a-z
647
+ );
648
+ }
649
+ /**
650
+ * ```
651
+ * NameStart ::
652
+ * - Letter
653
+ * - `_`
654
+ * ```
655
+ * @internal
656
+ */
657
+
658
+ function isNameStart(code) {
659
+ return isLetter(code) || code === 0x005f;
660
+ }
661
+ /**
662
+ * ```
663
+ * NameContinue ::
664
+ * - Letter
665
+ * - Digit
666
+ * - `_`
667
+ * ```
668
+ * @internal
669
+ */
670
+
671
+ function isNameContinue(code) {
672
+ return isLetter(code) || isDigit(code) || code === 0x005f;
673
+ }
674
+
675
+ /**
676
+ * Produces the value of a block string from its parsed raw value, similar to
677
+ * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.
678
+ *
679
+ * This implements the GraphQL spec's BlockStringValue() static algorithm.
680
+ *
681
+ * @internal
682
+ */
683
+
684
+ function dedentBlockStringLines(lines) {
685
+ var _firstNonEmptyLine2;
686
+
687
+ let commonIndent = Number.MAX_SAFE_INTEGER;
688
+ let firstNonEmptyLine = null;
689
+ let lastNonEmptyLine = -1;
690
+
691
+ for (let i = 0; i < lines.length; ++i) {
692
+ var _firstNonEmptyLine;
693
+
694
+ const line = lines[i];
695
+ const indent = leadingWhitespace(line);
696
+
697
+ if (indent === line.length) {
698
+ continue; // skip empty lines
699
+ }
700
+
701
+ firstNonEmptyLine =
702
+ (_firstNonEmptyLine = firstNonEmptyLine) !== null &&
703
+ _firstNonEmptyLine !== void 0
704
+ ? _firstNonEmptyLine
705
+ : i;
706
+ lastNonEmptyLine = i;
707
+
708
+ if (i !== 0 && indent < commonIndent) {
709
+ commonIndent = indent;
710
+ }
711
+ }
712
+
713
+ return lines // Remove common indentation from all lines but first.
714
+ .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.
715
+ .slice(
716
+ (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&
717
+ _firstNonEmptyLine2 !== void 0
718
+ ? _firstNonEmptyLine2
719
+ : 0,
720
+ lastNonEmptyLine + 1,
721
+ );
722
+ }
723
+
724
+ function leadingWhitespace(str) {
725
+ let i = 0;
726
+
727
+ while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {
728
+ ++i;
729
+ }
730
+
731
+ return i;
732
+ }
733
+
734
+ /**
735
+ * An exported enum describing the different kinds of tokens that the
736
+ * lexer emits.
737
+ */
738
+ var TokenKind;
739
+
740
+ (function (TokenKind) {
741
+ TokenKind['SOF'] = '<SOF>';
742
+ TokenKind['EOF'] = '<EOF>';
743
+ TokenKind['BANG'] = '!';
744
+ TokenKind['DOLLAR'] = '$';
745
+ TokenKind['AMP'] = '&';
746
+ TokenKind['PAREN_L'] = '(';
747
+ TokenKind['PAREN_R'] = ')';
748
+ TokenKind['SPREAD'] = '...';
749
+ TokenKind['COLON'] = ':';
750
+ TokenKind['EQUALS'] = '=';
751
+ TokenKind['AT'] = '@';
752
+ TokenKind['BRACKET_L'] = '[';
753
+ TokenKind['BRACKET_R'] = ']';
754
+ TokenKind['BRACE_L'] = '{';
755
+ TokenKind['PIPE'] = '|';
756
+ TokenKind['BRACE_R'] = '}';
757
+ TokenKind['NAME'] = 'Name';
758
+ TokenKind['INT'] = 'Int';
759
+ TokenKind['FLOAT'] = 'Float';
760
+ TokenKind['STRING'] = 'String';
761
+ TokenKind['BLOCK_STRING'] = 'BlockString';
762
+ TokenKind['COMMENT'] = 'Comment';
763
+ })(TokenKind || (TokenKind = {}));
764
+ /**
765
+ * The enum type representing the token kinds values.
766
+ *
767
+ * @deprecated Please use `TokenKind`. Will be remove in v17.
768
+ */
769
+
770
+ /**
771
+ * Given a Source object, creates a Lexer for that source.
772
+ * A Lexer is a stateful stream generator in that every time
773
+ * it is advanced, it returns the next token in the Source. Assuming the
774
+ * source lexes, the final Token emitted by the lexer will be of kind
775
+ * EOF, after which the lexer will repeatedly return the same EOF token
776
+ * whenever called.
777
+ */
778
+
779
+ class Lexer {
780
+ /**
781
+ * The previously focused non-ignored token.
782
+ */
783
+
784
+ /**
785
+ * The currently focused non-ignored token.
786
+ */
787
+
788
+ /**
789
+ * The (1-indexed) line containing the current token.
790
+ */
791
+
792
+ /**
793
+ * The character offset at which the current line begins.
794
+ */
795
+ constructor(source) {
796
+ const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);
797
+ this.source = source;
798
+ this.lastToken = startOfFileToken;
799
+ this.token = startOfFileToken;
800
+ this.line = 1;
801
+ this.lineStart = 0;
802
+ }
803
+
804
+ get [Symbol.toStringTag]() {
805
+ return 'Lexer';
806
+ }
807
+ /**
808
+ * Advances the token stream to the next non-ignored token.
809
+ */
810
+
811
+ advance() {
812
+ this.lastToken = this.token;
813
+ const token = (this.token = this.lookahead());
814
+ return token;
815
+ }
816
+ /**
817
+ * Looks ahead and returns the next non-ignored token, but does not change
818
+ * the state of Lexer.
819
+ */
820
+
821
+ lookahead() {
822
+ let token = this.token;
823
+
824
+ if (token.kind !== TokenKind.EOF) {
825
+ do {
826
+ if (token.next) {
827
+ token = token.next;
828
+ } else {
829
+ // Read the next token and form a link in the token linked-list.
830
+ const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing.
831
+
832
+ token.next = nextToken; // @ts-expect-error prev is only mutable during parsing.
833
+
834
+ nextToken.prev = token;
835
+ token = nextToken;
836
+ }
837
+ } while (token.kind === TokenKind.COMMENT);
838
+ }
839
+
840
+ return token;
841
+ }
842
+ }
843
+ /**
844
+ * @internal
845
+ */
846
+
847
+ function isPunctuatorTokenKind(kind) {
848
+ return (
849
+ kind === TokenKind.BANG ||
850
+ kind === TokenKind.DOLLAR ||
851
+ kind === TokenKind.AMP ||
852
+ kind === TokenKind.PAREN_L ||
853
+ kind === TokenKind.PAREN_R ||
854
+ kind === TokenKind.SPREAD ||
855
+ kind === TokenKind.COLON ||
856
+ kind === TokenKind.EQUALS ||
857
+ kind === TokenKind.AT ||
858
+ kind === TokenKind.BRACKET_L ||
859
+ kind === TokenKind.BRACKET_R ||
860
+ kind === TokenKind.BRACE_L ||
861
+ kind === TokenKind.PIPE ||
862
+ kind === TokenKind.BRACE_R
863
+ );
864
+ }
865
+ /**
866
+ * A Unicode scalar value is any Unicode code point except surrogate code
867
+ * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and
868
+ * 0xE000 to 0x10FFFF.
869
+ *
870
+ * SourceCharacter ::
871
+ * - "Any Unicode scalar value"
872
+ */
873
+
874
+ function isUnicodeScalarValue(code) {
875
+ return (
876
+ (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff)
877
+ );
878
+ }
879
+ /**
880
+ * The GraphQL specification defines source text as a sequence of unicode scalar
881
+ * values (which Unicode defines to exclude surrogate code points). However
882
+ * JavaScript defines strings as a sequence of UTF-16 code units which may
883
+ * include surrogates. A surrogate pair is a valid source character as it
884
+ * encodes a supplementary code point (above U+FFFF), but unpaired surrogate
885
+ * code points are not valid source characters.
886
+ */
887
+
888
+ function isSupplementaryCodePoint(body, location) {
889
+ return (
890
+ isLeadingSurrogate(body.charCodeAt(location)) &&
891
+ isTrailingSurrogate(body.charCodeAt(location + 1))
892
+ );
893
+ }
894
+
895
+ function isLeadingSurrogate(code) {
896
+ return code >= 0xd800 && code <= 0xdbff;
897
+ }
898
+
899
+ function isTrailingSurrogate(code) {
900
+ return code >= 0xdc00 && code <= 0xdfff;
901
+ }
902
+ /**
903
+ * Prints the code point (or end of file reference) at a given location in a
904
+ * source for use in error messages.
905
+ *
906
+ * Printable ASCII is printed quoted, while other points are printed in Unicode
907
+ * code point form (ie. U+1234).
908
+ */
909
+
910
+ function printCodePointAt(lexer, location) {
911
+ const code = lexer.source.body.codePointAt(location);
912
+
913
+ if (code === undefined) {
914
+ return TokenKind.EOF;
915
+ } else if (code >= 0x0020 && code <= 0x007e) {
916
+ // Printable ASCII
917
+ const char = String.fromCodePoint(code);
918
+ return char === '"' ? "'\"'" : `"${char}"`;
919
+ } // Unicode code point
920
+
921
+ return 'U+' + code.toString(16).toUpperCase().padStart(4, '0');
922
+ }
923
+ /**
924
+ * Create a token with line and column location information.
925
+ */
926
+
927
+ function createToken(lexer, kind, start, end, value) {
928
+ const line = lexer.line;
929
+ const col = 1 + start - lexer.lineStart;
930
+ return new Token(kind, start, end, line, col, value);
931
+ }
932
+ /**
933
+ * Gets the next token from the source starting at the given position.
934
+ *
935
+ * This skips over whitespace until it finds the next lexable token, then lexes
936
+ * punctuators immediately or calls the appropriate helper function for more
937
+ * complicated tokens.
938
+ */
939
+
940
+ function readNextToken(lexer, start) {
941
+ const body = lexer.source.body;
942
+ const bodyLength = body.length;
943
+ let position = start;
944
+
945
+ while (position < bodyLength) {
946
+ const code = body.charCodeAt(position); // SourceCharacter
947
+
948
+ switch (code) {
949
+ // Ignored ::
950
+ // - UnicodeBOM
951
+ // - WhiteSpace
952
+ // - LineTerminator
953
+ // - Comment
954
+ // - Comma
955
+ //
956
+ // UnicodeBOM :: "Byte Order Mark (U+FEFF)"
957
+ //
958
+ // WhiteSpace ::
959
+ // - "Horizontal Tab (U+0009)"
960
+ // - "Space (U+0020)"
961
+ //
962
+ // Comma :: ,
963
+ case 0xfeff: // <BOM>
964
+
965
+ case 0x0009: // \t
966
+
967
+ case 0x0020: // <space>
968
+
969
+ case 0x002c:
970
+ // ,
971
+ ++position;
972
+ continue;
973
+ // LineTerminator ::
974
+ // - "New Line (U+000A)"
975
+ // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
976
+ // - "Carriage Return (U+000D)" "New Line (U+000A)"
977
+
978
+ case 0x000a:
979
+ // \n
980
+ ++position;
981
+ ++lexer.line;
982
+ lexer.lineStart = position;
983
+ continue;
984
+
985
+ case 0x000d:
986
+ // \r
987
+ if (body.charCodeAt(position + 1) === 0x000a) {
988
+ position += 2;
989
+ } else {
990
+ ++position;
991
+ }
992
+
993
+ ++lexer.line;
994
+ lexer.lineStart = position;
995
+ continue;
996
+ // Comment
997
+
998
+ case 0x0023:
999
+ // #
1000
+ return readComment(lexer, position);
1001
+ // Token ::
1002
+ // - Punctuator
1003
+ // - Name
1004
+ // - IntValue
1005
+ // - FloatValue
1006
+ // - StringValue
1007
+ //
1008
+ // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
1009
+
1010
+ case 0x0021:
1011
+ // !
1012
+ return createToken(lexer, TokenKind.BANG, position, position + 1);
1013
+
1014
+ case 0x0024:
1015
+ // $
1016
+ return createToken(lexer, TokenKind.DOLLAR, position, position + 1);
1017
+
1018
+ case 0x0026:
1019
+ // &
1020
+ return createToken(lexer, TokenKind.AMP, position, position + 1);
1021
+
1022
+ case 0x0028:
1023
+ // (
1024
+ return createToken(lexer, TokenKind.PAREN_L, position, position + 1);
1025
+
1026
+ case 0x0029:
1027
+ // )
1028
+ return createToken(lexer, TokenKind.PAREN_R, position, position + 1);
1029
+
1030
+ case 0x002e:
1031
+ // .
1032
+ if (
1033
+ body.charCodeAt(position + 1) === 0x002e &&
1034
+ body.charCodeAt(position + 2) === 0x002e
1035
+ ) {
1036
+ return createToken(lexer, TokenKind.SPREAD, position, position + 3);
1037
+ }
1038
+
1039
+ break;
1040
+
1041
+ case 0x003a:
1042
+ // :
1043
+ return createToken(lexer, TokenKind.COLON, position, position + 1);
1044
+
1045
+ case 0x003d:
1046
+ // =
1047
+ return createToken(lexer, TokenKind.EQUALS, position, position + 1);
1048
+
1049
+ case 0x0040:
1050
+ // @
1051
+ return createToken(lexer, TokenKind.AT, position, position + 1);
1052
+
1053
+ case 0x005b:
1054
+ // [
1055
+ return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);
1056
+
1057
+ case 0x005d:
1058
+ // ]
1059
+ return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);
1060
+
1061
+ case 0x007b:
1062
+ // {
1063
+ return createToken(lexer, TokenKind.BRACE_L, position, position + 1);
1064
+
1065
+ case 0x007c:
1066
+ // |
1067
+ return createToken(lexer, TokenKind.PIPE, position, position + 1);
1068
+
1069
+ case 0x007d:
1070
+ // }
1071
+ return createToken(lexer, TokenKind.BRACE_R, position, position + 1);
1072
+ // StringValue
1073
+
1074
+ case 0x0022:
1075
+ // "
1076
+ if (
1077
+ body.charCodeAt(position + 1) === 0x0022 &&
1078
+ body.charCodeAt(position + 2) === 0x0022
1079
+ ) {
1080
+ return readBlockString(lexer, position);
1081
+ }
1082
+
1083
+ return readString(lexer, position);
1084
+ } // IntValue | FloatValue (Digit | -)
1085
+
1086
+ if (isDigit(code) || code === 0x002d) {
1087
+ return readNumber(lexer, position, code);
1088
+ } // Name
1089
+
1090
+ if (isNameStart(code)) {
1091
+ return readName(lexer, position);
1092
+ }
1093
+
1094
+ throw syntaxError(
1095
+ lexer.source,
1096
+ position,
1097
+ code === 0x0027
1098
+ ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?'
1099
+ : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position)
1100
+ ? `Unexpected character: ${printCodePointAt(lexer, position)}.`
1101
+ : `Invalid character: ${printCodePointAt(lexer, position)}.`,
1102
+ );
1103
+ }
1104
+
1105
+ return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);
1106
+ }
1107
+ /**
1108
+ * Reads a comment token from the source file.
1109
+ *
1110
+ * ```
1111
+ * Comment :: # CommentChar* [lookahead != CommentChar]
1112
+ *
1113
+ * CommentChar :: SourceCharacter but not LineTerminator
1114
+ * ```
1115
+ */
1116
+
1117
+ function readComment(lexer, start) {
1118
+ const body = lexer.source.body;
1119
+ const bodyLength = body.length;
1120
+ let position = start + 1;
1121
+
1122
+ while (position < bodyLength) {
1123
+ const code = body.charCodeAt(position); // LineTerminator (\n | \r)
1124
+
1125
+ if (code === 0x000a || code === 0x000d) {
1126
+ break;
1127
+ } // SourceCharacter
1128
+
1129
+ if (isUnicodeScalarValue(code)) {
1130
+ ++position;
1131
+ } else if (isSupplementaryCodePoint(body, position)) {
1132
+ position += 2;
1133
+ } else {
1134
+ break;
1135
+ }
1136
+ }
1137
+
1138
+ return createToken(
1139
+ lexer,
1140
+ TokenKind.COMMENT,
1141
+ start,
1142
+ position,
1143
+ body.slice(start + 1, position),
1144
+ );
1145
+ }
1146
+ /**
1147
+ * Reads a number token from the source file, either a FloatValue or an IntValue
1148
+ * depending on whether a FractionalPart or ExponentPart is encountered.
1149
+ *
1150
+ * ```
1151
+ * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}]
1152
+ *
1153
+ * IntegerPart ::
1154
+ * - NegativeSign? 0
1155
+ * - NegativeSign? NonZeroDigit Digit*
1156
+ *
1157
+ * NegativeSign :: -
1158
+ *
1159
+ * NonZeroDigit :: Digit but not `0`
1160
+ *
1161
+ * FloatValue ::
1162
+ * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}]
1163
+ * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}]
1164
+ * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}]
1165
+ *
1166
+ * FractionalPart :: . Digit+
1167
+ *
1168
+ * ExponentPart :: ExponentIndicator Sign? Digit+
1169
+ *
1170
+ * ExponentIndicator :: one of `e` `E`
1171
+ *
1172
+ * Sign :: one of + -
1173
+ * ```
1174
+ */
1175
+
1176
+ function readNumber(lexer, start, firstCode) {
1177
+ const body = lexer.source.body;
1178
+ let position = start;
1179
+ let code = firstCode;
1180
+ let isFloat = false; // NegativeSign (-)
1181
+
1182
+ if (code === 0x002d) {
1183
+ code = body.charCodeAt(++position);
1184
+ } // Zero (0)
1185
+
1186
+ if (code === 0x0030) {
1187
+ code = body.charCodeAt(++position);
1188
+
1189
+ if (isDigit(code)) {
1190
+ throw syntaxError(
1191
+ lexer.source,
1192
+ position,
1193
+ `Invalid number, unexpected digit after 0: ${printCodePointAt(
1194
+ lexer,
1195
+ position,
1196
+ )}.`,
1197
+ );
1198
+ }
1199
+ } else {
1200
+ position = readDigits(lexer, position, code);
1201
+ code = body.charCodeAt(position);
1202
+ } // Full stop (.)
1203
+
1204
+ if (code === 0x002e) {
1205
+ isFloat = true;
1206
+ code = body.charCodeAt(++position);
1207
+ position = readDigits(lexer, position, code);
1208
+ code = body.charCodeAt(position);
1209
+ } // E e
1210
+
1211
+ if (code === 0x0045 || code === 0x0065) {
1212
+ isFloat = true;
1213
+ code = body.charCodeAt(++position); // + -
1214
+
1215
+ if (code === 0x002b || code === 0x002d) {
1216
+ code = body.charCodeAt(++position);
1217
+ }
1218
+
1219
+ position = readDigits(lexer, position, code);
1220
+ code = body.charCodeAt(position);
1221
+ } // Numbers cannot be followed by . or NameStart
1222
+
1223
+ if (code === 0x002e || isNameStart(code)) {
1224
+ throw syntaxError(
1225
+ lexer.source,
1226
+ position,
1227
+ `Invalid number, expected digit but got: ${printCodePointAt(
1228
+ lexer,
1229
+ position,
1230
+ )}.`,
1231
+ );
1232
+ }
1233
+
1234
+ return createToken(
1235
+ lexer,
1236
+ isFloat ? TokenKind.FLOAT : TokenKind.INT,
1237
+ start,
1238
+ position,
1239
+ body.slice(start, position),
1240
+ );
1241
+ }
1242
+ /**
1243
+ * Returns the new position in the source after reading one or more digits.
1244
+ */
1245
+
1246
+ function readDigits(lexer, start, firstCode) {
1247
+ if (!isDigit(firstCode)) {
1248
+ throw syntaxError(
1249
+ lexer.source,
1250
+ start,
1251
+ `Invalid number, expected digit but got: ${printCodePointAt(
1252
+ lexer,
1253
+ start,
1254
+ )}.`,
1255
+ );
1256
+ }
1257
+
1258
+ const body = lexer.source.body;
1259
+ let position = start + 1; // +1 to skip first firstCode
1260
+
1261
+ while (isDigit(body.charCodeAt(position))) {
1262
+ ++position;
1263
+ }
1264
+
1265
+ return position;
1266
+ }
1267
+ /**
1268
+ * Reads a single-quote string token from the source file.
1269
+ *
1270
+ * ```
1271
+ * StringValue ::
1272
+ * - `""` [lookahead != `"`]
1273
+ * - `"` StringCharacter+ `"`
1274
+ *
1275
+ * StringCharacter ::
1276
+ * - SourceCharacter but not `"` or `\` or LineTerminator
1277
+ * - `\u` EscapedUnicode
1278
+ * - `\` EscapedCharacter
1279
+ *
1280
+ * EscapedUnicode ::
1281
+ * - `{` HexDigit+ `}`
1282
+ * - HexDigit HexDigit HexDigit HexDigit
1283
+ *
1284
+ * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t`
1285
+ * ```
1286
+ */
1287
+
1288
+ function readString(lexer, start) {
1289
+ const body = lexer.source.body;
1290
+ const bodyLength = body.length;
1291
+ let position = start + 1;
1292
+ let chunkStart = position;
1293
+ let value = '';
1294
+
1295
+ while (position < bodyLength) {
1296
+ const code = body.charCodeAt(position); // Closing Quote (")
1297
+
1298
+ if (code === 0x0022) {
1299
+ value += body.slice(chunkStart, position);
1300
+ return createToken(lexer, TokenKind.STRING, start, position + 1, value);
1301
+ } // Escape Sequence (\)
1302
+
1303
+ if (code === 0x005c) {
1304
+ value += body.slice(chunkStart, position);
1305
+ const escape =
1306
+ body.charCodeAt(position + 1) === 0x0075 // u
1307
+ ? body.charCodeAt(position + 2) === 0x007b // {
1308
+ ? readEscapedUnicodeVariableWidth(lexer, position)
1309
+ : readEscapedUnicodeFixedWidth(lexer, position)
1310
+ : readEscapedCharacter(lexer, position);
1311
+ value += escape.value;
1312
+ position += escape.size;
1313
+ chunkStart = position;
1314
+ continue;
1315
+ } // LineTerminator (\n | \r)
1316
+
1317
+ if (code === 0x000a || code === 0x000d) {
1318
+ break;
1319
+ } // SourceCharacter
1320
+
1321
+ if (isUnicodeScalarValue(code)) {
1322
+ ++position;
1323
+ } else if (isSupplementaryCodePoint(body, position)) {
1324
+ position += 2;
1325
+ } else {
1326
+ throw syntaxError(
1327
+ lexer.source,
1328
+ position,
1329
+ `Invalid character within String: ${printCodePointAt(
1330
+ lexer,
1331
+ position,
1332
+ )}.`,
1333
+ );
1334
+ }
1335
+ }
1336
+
1337
+ throw syntaxError(lexer.source, position, 'Unterminated string.');
1338
+ } // The string value and lexed size of an escape sequence.
1339
+
1340
+ function readEscapedUnicodeVariableWidth(lexer, position) {
1341
+ const body = lexer.source.body;
1342
+ let point = 0;
1343
+ let size = 3; // Cannot be larger than 12 chars (\u{00000000}).
1344
+
1345
+ while (size < 12) {
1346
+ const code = body.charCodeAt(position + size++); // Closing Brace (})
1347
+
1348
+ if (code === 0x007d) {
1349
+ // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value.
1350
+ if (size < 5 || !isUnicodeScalarValue(point)) {
1351
+ break;
1352
+ }
1353
+
1354
+ return {
1355
+ value: String.fromCodePoint(point),
1356
+ size,
1357
+ };
1358
+ } // Append this hex digit to the code point.
1359
+
1360
+ point = (point << 4) | readHexDigit(code);
1361
+
1362
+ if (point < 0) {
1363
+ break;
1364
+ }
1365
+ }
1366
+
1367
+ throw syntaxError(
1368
+ lexer.source,
1369
+ position,
1370
+ `Invalid Unicode escape sequence: "${body.slice(
1371
+ position,
1372
+ position + size,
1373
+ )}".`,
1374
+ );
1375
+ }
1376
+
1377
+ function readEscapedUnicodeFixedWidth(lexer, position) {
1378
+ const body = lexer.source.body;
1379
+ const code = read16BitHexCode(body, position + 2);
1380
+
1381
+ if (isUnicodeScalarValue(code)) {
1382
+ return {
1383
+ value: String.fromCodePoint(code),
1384
+ size: 6,
1385
+ };
1386
+ } // GraphQL allows JSON-style surrogate pair escape sequences, but only when
1387
+ // a valid pair is formed.
1388
+
1389
+ if (isLeadingSurrogate(code)) {
1390
+ // \u
1391
+ if (
1392
+ body.charCodeAt(position + 6) === 0x005c &&
1393
+ body.charCodeAt(position + 7) === 0x0075
1394
+ ) {
1395
+ const trailingCode = read16BitHexCode(body, position + 8);
1396
+
1397
+ if (isTrailingSurrogate(trailingCode)) {
1398
+ // JavaScript defines strings as a sequence of UTF-16 code units and
1399
+ // encodes Unicode code points above U+FFFF using a surrogate pair of
1400
+ // code units. Since this is a surrogate pair escape sequence, just
1401
+ // include both codes into the JavaScript string value. Had JavaScript
1402
+ // not been internally based on UTF-16, then this surrogate pair would
1403
+ // be decoded to retrieve the supplementary code point.
1404
+ return {
1405
+ value: String.fromCodePoint(code, trailingCode),
1406
+ size: 12,
1407
+ };
1408
+ }
1409
+ }
1410
+ }
1411
+
1412
+ throw syntaxError(
1413
+ lexer.source,
1414
+ position,
1415
+ `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`,
1416
+ );
1417
+ }
1418
+ /**
1419
+ * Reads four hexadecimal characters and returns the positive integer that 16bit
1420
+ * hexadecimal string represents. For example, "000f" will return 15, and "dead"
1421
+ * will return 57005.
1422
+ *
1423
+ * Returns a negative number if any char was not a valid hexadecimal digit.
1424
+ */
1425
+
1426
+ function read16BitHexCode(body, position) {
1427
+ // readHexDigit() returns -1 on error. ORing a negative value with any other
1428
+ // value always produces a negative value.
1429
+ return (
1430
+ (readHexDigit(body.charCodeAt(position)) << 12) |
1431
+ (readHexDigit(body.charCodeAt(position + 1)) << 8) |
1432
+ (readHexDigit(body.charCodeAt(position + 2)) << 4) |
1433
+ readHexDigit(body.charCodeAt(position + 3))
1434
+ );
1435
+ }
1436
+ /**
1437
+ * Reads a hexadecimal character and returns its positive integer value (0-15).
1438
+ *
1439
+ * '0' becomes 0, '9' becomes 9
1440
+ * 'A' becomes 10, 'F' becomes 15
1441
+ * 'a' becomes 10, 'f' becomes 15
1442
+ *
1443
+ * Returns -1 if the provided character code was not a valid hexadecimal digit.
1444
+ *
1445
+ * HexDigit :: one of
1446
+ * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
1447
+ * - `A` `B` `C` `D` `E` `F`
1448
+ * - `a` `b` `c` `d` `e` `f`
1449
+ */
1450
+
1451
+ function readHexDigit(code) {
1452
+ return code >= 0x0030 && code <= 0x0039 // 0-9
1453
+ ? code - 0x0030
1454
+ : code >= 0x0041 && code <= 0x0046 // A-F
1455
+ ? code - 0x0037
1456
+ : code >= 0x0061 && code <= 0x0066 // a-f
1457
+ ? code - 0x0057
1458
+ : -1;
1459
+ }
1460
+ /**
1461
+ * | Escaped Character | Code Point | Character Name |
1462
+ * | ----------------- | ---------- | ---------------------------- |
1463
+ * | `"` | U+0022 | double quote |
1464
+ * | `\` | U+005C | reverse solidus (back slash) |
1465
+ * | `/` | U+002F | solidus (forward slash) |
1466
+ * | `b` | U+0008 | backspace |
1467
+ * | `f` | U+000C | form feed |
1468
+ * | `n` | U+000A | line feed (new line) |
1469
+ * | `r` | U+000D | carriage return |
1470
+ * | `t` | U+0009 | horizontal tab |
1471
+ */
1472
+
1473
+ function readEscapedCharacter(lexer, position) {
1474
+ const body = lexer.source.body;
1475
+ const code = body.charCodeAt(position + 1);
1476
+
1477
+ switch (code) {
1478
+ case 0x0022:
1479
+ // "
1480
+ return {
1481
+ value: '\u0022',
1482
+ size: 2,
1483
+ };
1484
+
1485
+ case 0x005c:
1486
+ // \
1487
+ return {
1488
+ value: '\u005c',
1489
+ size: 2,
1490
+ };
1491
+
1492
+ case 0x002f:
1493
+ // /
1494
+ return {
1495
+ value: '\u002f',
1496
+ size: 2,
1497
+ };
1498
+
1499
+ case 0x0062:
1500
+ // b
1501
+ return {
1502
+ value: '\u0008',
1503
+ size: 2,
1504
+ };
1505
+
1506
+ case 0x0066:
1507
+ // f
1508
+ return {
1509
+ value: '\u000c',
1510
+ size: 2,
1511
+ };
1512
+
1513
+ case 0x006e:
1514
+ // n
1515
+ return {
1516
+ value: '\u000a',
1517
+ size: 2,
1518
+ };
1519
+
1520
+ case 0x0072:
1521
+ // r
1522
+ return {
1523
+ value: '\u000d',
1524
+ size: 2,
1525
+ };
1526
+
1527
+ case 0x0074:
1528
+ // t
1529
+ return {
1530
+ value: '\u0009',
1531
+ size: 2,
1532
+ };
1533
+ }
1534
+
1535
+ throw syntaxError(
1536
+ lexer.source,
1537
+ position,
1538
+ `Invalid character escape sequence: "${body.slice(
1539
+ position,
1540
+ position + 2,
1541
+ )}".`,
1542
+ );
1543
+ }
1544
+ /**
1545
+ * Reads a block string token from the source file.
1546
+ *
1547
+ * ```
1548
+ * StringValue ::
1549
+ * - `"""` BlockStringCharacter* `"""`
1550
+ *
1551
+ * BlockStringCharacter ::
1552
+ * - SourceCharacter but not `"""` or `\"""`
1553
+ * - `\"""`
1554
+ * ```
1555
+ */
1556
+
1557
+ function readBlockString(lexer, start) {
1558
+ const body = lexer.source.body;
1559
+ const bodyLength = body.length;
1560
+ let lineStart = lexer.lineStart;
1561
+ let position = start + 3;
1562
+ let chunkStart = position;
1563
+ let currentLine = '';
1564
+ const blockLines = [];
1565
+
1566
+ while (position < bodyLength) {
1567
+ const code = body.charCodeAt(position); // Closing Triple-Quote (""")
1568
+
1569
+ if (
1570
+ code === 0x0022 &&
1571
+ body.charCodeAt(position + 1) === 0x0022 &&
1572
+ body.charCodeAt(position + 2) === 0x0022
1573
+ ) {
1574
+ currentLine += body.slice(chunkStart, position);
1575
+ blockLines.push(currentLine);
1576
+ const token = createToken(
1577
+ lexer,
1578
+ TokenKind.BLOCK_STRING,
1579
+ start,
1580
+ position + 3, // Return a string of the lines joined with U+000A.
1581
+ dedentBlockStringLines(blockLines).join('\n'),
1582
+ );
1583
+ lexer.line += blockLines.length - 1;
1584
+ lexer.lineStart = lineStart;
1585
+ return token;
1586
+ } // Escaped Triple-Quote (\""")
1587
+
1588
+ if (
1589
+ code === 0x005c &&
1590
+ body.charCodeAt(position + 1) === 0x0022 &&
1591
+ body.charCodeAt(position + 2) === 0x0022 &&
1592
+ body.charCodeAt(position + 3) === 0x0022
1593
+ ) {
1594
+ currentLine += body.slice(chunkStart, position);
1595
+ chunkStart = position + 1; // skip only slash
1596
+
1597
+ position += 4;
1598
+ continue;
1599
+ } // LineTerminator
1600
+
1601
+ if (code === 0x000a || code === 0x000d) {
1602
+ currentLine += body.slice(chunkStart, position);
1603
+ blockLines.push(currentLine);
1604
+
1605
+ if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) {
1606
+ position += 2;
1607
+ } else {
1608
+ ++position;
1609
+ }
1610
+
1611
+ currentLine = '';
1612
+ chunkStart = position;
1613
+ lineStart = position;
1614
+ continue;
1615
+ } // SourceCharacter
1616
+
1617
+ if (isUnicodeScalarValue(code)) {
1618
+ ++position;
1619
+ } else if (isSupplementaryCodePoint(body, position)) {
1620
+ position += 2;
1621
+ } else {
1622
+ throw syntaxError(
1623
+ lexer.source,
1624
+ position,
1625
+ `Invalid character within String: ${printCodePointAt(
1626
+ lexer,
1627
+ position,
1628
+ )}.`,
1629
+ );
1630
+ }
1631
+ }
1632
+
1633
+ throw syntaxError(lexer.source, position, 'Unterminated string.');
1634
+ }
1635
+ /**
1636
+ * Reads an alphanumeric + underscore name from the source.
1637
+ *
1638
+ * ```
1639
+ * Name ::
1640
+ * - NameStart NameContinue* [lookahead != NameContinue]
1641
+ * ```
1642
+ */
1643
+
1644
+ function readName(lexer, start) {
1645
+ const body = lexer.source.body;
1646
+ const bodyLength = body.length;
1647
+ let position = start + 1;
1648
+
1649
+ while (position < bodyLength) {
1650
+ const code = body.charCodeAt(position);
1651
+
1652
+ if (isNameContinue(code)) {
1653
+ ++position;
1654
+ } else {
1655
+ break;
1656
+ }
1657
+ }
1658
+
1659
+ return createToken(
1660
+ lexer,
1661
+ TokenKind.NAME,
1662
+ start,
1663
+ position,
1664
+ body.slice(start, position),
1665
+ );
1666
+ }
1667
+
1668
+ const MAX_ARRAY_LENGTH = 10;
1669
+ const MAX_RECURSIVE_DEPTH = 2;
1670
+ /**
1671
+ * Used to print values in error messages.
1672
+ */
1673
+
1674
+ function inspect(value) {
1675
+ return formatValue(value, []);
1676
+ }
1677
+
1678
+ function formatValue(value, seenValues) {
1679
+ switch (typeof value) {
1680
+ case 'string':
1681
+ return JSON.stringify(value);
1682
+
1683
+ case 'function':
1684
+ return value.name ? `[function ${value.name}]` : '[function]';
1685
+
1686
+ case 'object':
1687
+ return formatObjectValue(value, seenValues);
1688
+
1689
+ default:
1690
+ return String(value);
1691
+ }
1692
+ }
1693
+
1694
+ function formatObjectValue(value, previouslySeenValues) {
1695
+ if (value === null) {
1696
+ return 'null';
1697
+ }
1698
+
1699
+ if (previouslySeenValues.includes(value)) {
1700
+ return '[Circular]';
1701
+ }
1702
+
1703
+ const seenValues = [...previouslySeenValues, value];
1704
+
1705
+ if (isJSONable(value)) {
1706
+ const jsonValue = value.toJSON(); // check for infinite recursion
1707
+
1708
+ if (jsonValue !== value) {
1709
+ return typeof jsonValue === 'string'
1710
+ ? jsonValue
1711
+ : formatValue(jsonValue, seenValues);
1712
+ }
1713
+ } else if (Array.isArray(value)) {
1714
+ return formatArray(value, seenValues);
1715
+ }
1716
+
1717
+ return formatObject(value, seenValues);
1718
+ }
1719
+
1720
+ function isJSONable(value) {
1721
+ return typeof value.toJSON === 'function';
1722
+ }
1723
+
1724
+ function formatObject(object, seenValues) {
1725
+ const entries = Object.entries(object);
1726
+
1727
+ if (entries.length === 0) {
1728
+ return '{}';
1729
+ }
1730
+
1731
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1732
+ return '[' + getObjectTag(object) + ']';
1733
+ }
1734
+
1735
+ const properties = entries.map(
1736
+ ([key, value]) => key + ': ' + formatValue(value, seenValues),
1737
+ );
1738
+ return '{ ' + properties.join(', ') + ' }';
1739
+ }
1740
+
1741
+ function formatArray(array, seenValues) {
1742
+ if (array.length === 0) {
1743
+ return '[]';
1744
+ }
1745
+
1746
+ if (seenValues.length > MAX_RECURSIVE_DEPTH) {
1747
+ return '[Array]';
1748
+ }
1749
+
1750
+ const len = Math.min(MAX_ARRAY_LENGTH, array.length);
1751
+ const remaining = array.length - len;
1752
+ const items = [];
1753
+
1754
+ for (let i = 0; i < len; ++i) {
1755
+ items.push(formatValue(array[i], seenValues));
1756
+ }
1757
+
1758
+ if (remaining === 1) {
1759
+ items.push('... 1 more item');
1760
+ } else if (remaining > 1) {
1761
+ items.push(`... ${remaining} more items`);
1762
+ }
1763
+
1764
+ return '[' + items.join(', ') + ']';
1765
+ }
1766
+
1767
+ function getObjectTag(object) {
1768
+ const tag = Object.prototype.toString
1769
+ .call(object)
1770
+ .replace(/^\[object /, '')
1771
+ .replace(/]$/, '');
1772
+
1773
+ if (tag === 'Object' && typeof object.constructor === 'function') {
1774
+ const name = object.constructor.name;
1775
+
1776
+ if (typeof name === 'string' && name !== '') {
1777
+ return name;
1778
+ }
1779
+ }
1780
+
1781
+ return tag;
1782
+ }
1783
+
1784
+ /**
1785
+ * A replacement for instanceof which includes an error warning when multi-realm
1786
+ * constructors are detected.
1787
+ * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
1788
+ * See: https://webpack.js.org/guides/production/
1789
+ */
1790
+
1791
+ const instanceOf =
1792
+ /* c8 ignore next 6 */
1793
+ // FIXME: https://github.com/graphql/graphql-js/issues/2317
1794
+ globalThis.process && globalThis.process.env.NODE_ENV === 'production'
1795
+ ? function instanceOf(value, constructor) {
1796
+ return value instanceof constructor;
1797
+ }
1798
+ : function instanceOf(value, constructor) {
1799
+ if (value instanceof constructor) {
1800
+ return true;
1801
+ }
1802
+
1803
+ if (typeof value === 'object' && value !== null) {
1804
+ var _value$constructor;
1805
+
1806
+ // Prefer Symbol.toStringTag since it is immune to minification.
1807
+ const className = constructor.prototype[Symbol.toStringTag];
1808
+ const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.
1809
+ Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009
1810
+ ? value[Symbol.toStringTag]
1811
+ : (_value$constructor = value.constructor) === null ||
1812
+ _value$constructor === void 0
1813
+ ? void 0
1814
+ : _value$constructor.name;
1815
+
1816
+ if (className === valueClassName) {
1817
+ const stringifiedValue = inspect(value);
1818
+ throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
1819
+
1820
+ Ensure that there is only one instance of "graphql" in the node_modules
1821
+ directory. If different versions of "graphql" are the dependencies of other
1822
+ relied on modules, use "resolutions" to ensure only one version is installed.
1823
+
1824
+ https://yarnpkg.com/en/docs/selective-version-resolutions
1825
+
1826
+ Duplicate "graphql" modules cannot be used at the same time since different
1827
+ versions may have different capabilities and behavior. The data from one
1828
+ version used in the function from another could produce confusing and
1829
+ spurious results.`);
1830
+ }
1831
+ }
1832
+
1833
+ return false;
1834
+ };
1835
+
1836
+ /**
1837
+ * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are
1838
+ * optional, but they are useful for clients who store GraphQL documents in source files.
1839
+ * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might
1840
+ * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`.
1841
+ * The `line` and `column` properties in `locationOffset` are 1-indexed.
1842
+ */
1843
+ class Source {
1844
+ constructor(
1845
+ body,
1846
+ name = 'GraphQL request',
1847
+ locationOffset = {
1848
+ line: 1,
1849
+ column: 1,
1850
+ },
1851
+ ) {
1852
+ typeof body === 'string' ||
1853
+ devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);
1854
+ this.body = body;
1855
+ this.name = name;
1856
+ this.locationOffset = locationOffset;
1857
+ this.locationOffset.line > 0 ||
1858
+ devAssert(
1859
+ false,
1860
+ 'line in locationOffset is 1-indexed and must be positive.',
1861
+ );
1862
+ this.locationOffset.column > 0 ||
1863
+ devAssert(
1864
+ false,
1865
+ 'column in locationOffset is 1-indexed and must be positive.',
1866
+ );
1867
+ }
1868
+
1869
+ get [Symbol.toStringTag]() {
1870
+ return 'Source';
1871
+ }
1872
+ }
1873
+ /**
1874
+ * Test if the given value is a Source object.
1875
+ *
1876
+ * @internal
1877
+ */
1878
+
1879
+ function isSource(source) {
1880
+ return instanceOf(source, Source);
1881
+ }
1882
+
1883
+ /**
1884
+ * Configuration options to control parser behavior
1885
+ */
1886
+
1887
+ /**
1888
+ * Given a GraphQL source, parses it into a Document.
1889
+ * Throws GraphQLError if a syntax error is encountered.
1890
+ */
1891
+ function parse$1(source, options) {
1892
+ const parser = new Parser(source, options);
1893
+ return parser.parseDocument();
1894
+ }
1895
+ /**
1896
+ * This class is exported only to assist people in implementing their own parsers
1897
+ * without duplicating too much code and should be used only as last resort for cases
1898
+ * such as experimental syntax or if certain features could not be contributed upstream.
1899
+ *
1900
+ * It is still part of the internal API and is versioned, so any changes to it are never
1901
+ * considered breaking changes. If you still need to support multiple versions of the
1902
+ * library, please use the `versionInfo` variable for version detection.
1903
+ *
1904
+ * @internal
1905
+ */
1906
+
1907
+ class Parser {
1908
+ constructor(source, options = {}) {
1909
+ const sourceObj = isSource(source) ? source : new Source(source);
1910
+ this._lexer = new Lexer(sourceObj);
1911
+ this._options = options;
1912
+ this._tokenCounter = 0;
1913
+ }
1914
+ /**
1915
+ * Converts a name lex token into a name parse node.
1916
+ */
1917
+
1918
+ parseName() {
1919
+ const token = this.expectToken(TokenKind.NAME);
1920
+ return this.node(token, {
1921
+ kind: Kind.NAME,
1922
+ value: token.value,
1923
+ });
1924
+ } // Implements the parsing rules in the Document section.
1925
+
1926
+ /**
1927
+ * Document : Definition+
1928
+ */
1929
+
1930
+ parseDocument() {
1931
+ return this.node(this._lexer.token, {
1932
+ kind: Kind.DOCUMENT,
1933
+ definitions: this.many(
1934
+ TokenKind.SOF,
1935
+ this.parseDefinition,
1936
+ TokenKind.EOF,
1937
+ ),
1938
+ });
1939
+ }
1940
+ /**
1941
+ * Definition :
1942
+ * - ExecutableDefinition
1943
+ * - TypeSystemDefinition
1944
+ * - TypeSystemExtension
1945
+ *
1946
+ * ExecutableDefinition :
1947
+ * - OperationDefinition
1948
+ * - FragmentDefinition
1949
+ *
1950
+ * TypeSystemDefinition :
1951
+ * - SchemaDefinition
1952
+ * - TypeDefinition
1953
+ * - DirectiveDefinition
1954
+ *
1955
+ * TypeDefinition :
1956
+ * - ScalarTypeDefinition
1957
+ * - ObjectTypeDefinition
1958
+ * - InterfaceTypeDefinition
1959
+ * - UnionTypeDefinition
1960
+ * - EnumTypeDefinition
1961
+ * - InputObjectTypeDefinition
1962
+ */
1963
+
1964
+ parseDefinition() {
1965
+ if (this.peek(TokenKind.BRACE_L)) {
1966
+ return this.parseOperationDefinition();
1967
+ } // Many definitions begin with a description and require a lookahead.
1968
+
1969
+ const hasDescription = this.peekDescription();
1970
+ const keywordToken = hasDescription
1971
+ ? this._lexer.lookahead()
1972
+ : this._lexer.token;
1973
+
1974
+ if (keywordToken.kind === TokenKind.NAME) {
1975
+ switch (keywordToken.value) {
1976
+ case 'schema':
1977
+ return this.parseSchemaDefinition();
1978
+
1979
+ case 'scalar':
1980
+ return this.parseScalarTypeDefinition();
1981
+
1982
+ case 'type':
1983
+ return this.parseObjectTypeDefinition();
1984
+
1985
+ case 'interface':
1986
+ return this.parseInterfaceTypeDefinition();
1987
+
1988
+ case 'union':
1989
+ return this.parseUnionTypeDefinition();
1990
+
1991
+ case 'enum':
1992
+ return this.parseEnumTypeDefinition();
1993
+
1994
+ case 'input':
1995
+ return this.parseInputObjectTypeDefinition();
1996
+
1997
+ case 'directive':
1998
+ return this.parseDirectiveDefinition();
1999
+ }
2000
+
2001
+ if (hasDescription) {
2002
+ throw syntaxError(
2003
+ this._lexer.source,
2004
+ this._lexer.token.start,
2005
+ 'Unexpected description, descriptions are supported only on type definitions.',
2006
+ );
2007
+ }
2008
+
2009
+ switch (keywordToken.value) {
2010
+ case 'query':
2011
+ case 'mutation':
2012
+ case 'subscription':
2013
+ return this.parseOperationDefinition();
2014
+
2015
+ case 'fragment':
2016
+ return this.parseFragmentDefinition();
2017
+
2018
+ case 'extend':
2019
+ return this.parseTypeSystemExtension();
2020
+ }
2021
+ }
2022
+
2023
+ throw this.unexpected(keywordToken);
2024
+ } // Implements the parsing rules in the Operations section.
2025
+
2026
+ /**
2027
+ * OperationDefinition :
2028
+ * - SelectionSet
2029
+ * - OperationType Name? VariableDefinitions? Directives? SelectionSet
2030
+ */
2031
+
2032
+ parseOperationDefinition() {
2033
+ const start = this._lexer.token;
2034
+
2035
+ if (this.peek(TokenKind.BRACE_L)) {
2036
+ return this.node(start, {
2037
+ kind: Kind.OPERATION_DEFINITION,
2038
+ operation: OperationTypeNode.QUERY,
2039
+ name: undefined,
2040
+ variableDefinitions: [],
2041
+ directives: [],
2042
+ selectionSet: this.parseSelectionSet(),
2043
+ });
2044
+ }
2045
+
2046
+ const operation = this.parseOperationType();
2047
+ let name;
2048
+
2049
+ if (this.peek(TokenKind.NAME)) {
2050
+ name = this.parseName();
2051
+ }
2052
+
2053
+ return this.node(start, {
2054
+ kind: Kind.OPERATION_DEFINITION,
2055
+ operation,
2056
+ name,
2057
+ variableDefinitions: this.parseVariableDefinitions(),
2058
+ directives: this.parseDirectives(false),
2059
+ selectionSet: this.parseSelectionSet(),
2060
+ });
2061
+ }
2062
+ /**
2063
+ * OperationType : one of query mutation subscription
2064
+ */
2065
+
2066
+ parseOperationType() {
2067
+ const operationToken = this.expectToken(TokenKind.NAME);
2068
+
2069
+ switch (operationToken.value) {
2070
+ case 'query':
2071
+ return OperationTypeNode.QUERY;
2072
+
2073
+ case 'mutation':
2074
+ return OperationTypeNode.MUTATION;
2075
+
2076
+ case 'subscription':
2077
+ return OperationTypeNode.SUBSCRIPTION;
2078
+ }
2079
+
2080
+ throw this.unexpected(operationToken);
2081
+ }
2082
+ /**
2083
+ * VariableDefinitions : ( VariableDefinition+ )
2084
+ */
2085
+
2086
+ parseVariableDefinitions() {
2087
+ return this.optionalMany(
2088
+ TokenKind.PAREN_L,
2089
+ this.parseVariableDefinition,
2090
+ TokenKind.PAREN_R,
2091
+ );
2092
+ }
2093
+ /**
2094
+ * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
2095
+ */
2096
+
2097
+ parseVariableDefinition() {
2098
+ return this.node(this._lexer.token, {
2099
+ kind: Kind.VARIABLE_DEFINITION,
2100
+ variable: this.parseVariable(),
2101
+ type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),
2102
+ defaultValue: this.expectOptionalToken(TokenKind.EQUALS)
2103
+ ? this.parseConstValueLiteral()
2104
+ : undefined,
2105
+ directives: this.parseConstDirectives(),
2106
+ });
2107
+ }
2108
+ /**
2109
+ * Variable : $ Name
2110
+ */
2111
+
2112
+ parseVariable() {
2113
+ const start = this._lexer.token;
2114
+ this.expectToken(TokenKind.DOLLAR);
2115
+ return this.node(start, {
2116
+ kind: Kind.VARIABLE,
2117
+ name: this.parseName(),
2118
+ });
2119
+ }
2120
+ /**
2121
+ * ```
2122
+ * SelectionSet : { Selection+ }
2123
+ * ```
2124
+ */
2125
+
2126
+ parseSelectionSet() {
2127
+ return this.node(this._lexer.token, {
2128
+ kind: Kind.SELECTION_SET,
2129
+ selections: this.many(
2130
+ TokenKind.BRACE_L,
2131
+ this.parseSelection,
2132
+ TokenKind.BRACE_R,
2133
+ ),
2134
+ });
2135
+ }
2136
+ /**
2137
+ * Selection :
2138
+ * - Field
2139
+ * - FragmentSpread
2140
+ * - InlineFragment
2141
+ */
2142
+
2143
+ parseSelection() {
2144
+ return this.peek(TokenKind.SPREAD)
2145
+ ? this.parseFragment()
2146
+ : this.parseField();
2147
+ }
2148
+ /**
2149
+ * Field : Alias? Name Arguments? Directives? SelectionSet?
2150
+ *
2151
+ * Alias : Name :
2152
+ */
2153
+
2154
+ parseField() {
2155
+ const start = this._lexer.token;
2156
+ const nameOrAlias = this.parseName();
2157
+ let alias;
2158
+ let name;
2159
+
2160
+ if (this.expectOptionalToken(TokenKind.COLON)) {
2161
+ alias = nameOrAlias;
2162
+ name = this.parseName();
2163
+ } else {
2164
+ name = nameOrAlias;
2165
+ }
2166
+
2167
+ return this.node(start, {
2168
+ kind: Kind.FIELD,
2169
+ alias,
2170
+ name,
2171
+ arguments: this.parseArguments(false),
2172
+ directives: this.parseDirectives(false),
2173
+ selectionSet: this.peek(TokenKind.BRACE_L)
2174
+ ? this.parseSelectionSet()
2175
+ : undefined,
2176
+ });
2177
+ }
2178
+ /**
2179
+ * Arguments[Const] : ( Argument[?Const]+ )
2180
+ */
2181
+
2182
+ parseArguments(isConst) {
2183
+ const item = isConst ? this.parseConstArgument : this.parseArgument;
2184
+ return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);
2185
+ }
2186
+ /**
2187
+ * Argument[Const] : Name : Value[?Const]
2188
+ */
2189
+
2190
+ parseArgument(isConst = false) {
2191
+ const start = this._lexer.token;
2192
+ const name = this.parseName();
2193
+ this.expectToken(TokenKind.COLON);
2194
+ return this.node(start, {
2195
+ kind: Kind.ARGUMENT,
2196
+ name,
2197
+ value: this.parseValueLiteral(isConst),
2198
+ });
2199
+ }
2200
+
2201
+ parseConstArgument() {
2202
+ return this.parseArgument(true);
2203
+ } // Implements the parsing rules in the Fragments section.
2204
+
2205
+ /**
2206
+ * Corresponds to both FragmentSpread and InlineFragment in the spec.
2207
+ *
2208
+ * FragmentSpread : ... FragmentName Directives?
2209
+ *
2210
+ * InlineFragment : ... TypeCondition? Directives? SelectionSet
2211
+ */
2212
+
2213
+ parseFragment() {
2214
+ const start = this._lexer.token;
2215
+ this.expectToken(TokenKind.SPREAD);
2216
+ const hasTypeCondition = this.expectOptionalKeyword('on');
2217
+
2218
+ if (!hasTypeCondition && this.peek(TokenKind.NAME)) {
2219
+ return this.node(start, {
2220
+ kind: Kind.FRAGMENT_SPREAD,
2221
+ name: this.parseFragmentName(),
2222
+ directives: this.parseDirectives(false),
2223
+ });
2224
+ }
2225
+
2226
+ return this.node(start, {
2227
+ kind: Kind.INLINE_FRAGMENT,
2228
+ typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,
2229
+ directives: this.parseDirectives(false),
2230
+ selectionSet: this.parseSelectionSet(),
2231
+ });
2232
+ }
2233
+ /**
2234
+ * FragmentDefinition :
2235
+ * - fragment FragmentName on TypeCondition Directives? SelectionSet
2236
+ *
2237
+ * TypeCondition : NamedType
2238
+ */
2239
+
2240
+ parseFragmentDefinition() {
2241
+ const start = this._lexer.token;
2242
+ this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
2243
+ // the grammar of FragmentDefinition:
2244
+ // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
2245
+
2246
+ if (this._options.allowLegacyFragmentVariables === true) {
2247
+ return this.node(start, {
2248
+ kind: Kind.FRAGMENT_DEFINITION,
2249
+ name: this.parseFragmentName(),
2250
+ variableDefinitions: this.parseVariableDefinitions(),
2251
+ typeCondition: (this.expectKeyword('on'), this.parseNamedType()),
2252
+ directives: this.parseDirectives(false),
2253
+ selectionSet: this.parseSelectionSet(),
2254
+ });
2255
+ }
2256
+
2257
+ return this.node(start, {
2258
+ kind: Kind.FRAGMENT_DEFINITION,
2259
+ name: this.parseFragmentName(),
2260
+ typeCondition: (this.expectKeyword('on'), this.parseNamedType()),
2261
+ directives: this.parseDirectives(false),
2262
+ selectionSet: this.parseSelectionSet(),
2263
+ });
2264
+ }
2265
+ /**
2266
+ * FragmentName : Name but not `on`
2267
+ */
2268
+
2269
+ parseFragmentName() {
2270
+ if (this._lexer.token.value === 'on') {
2271
+ throw this.unexpected();
2272
+ }
2273
+
2274
+ return this.parseName();
2275
+ } // Implements the parsing rules in the Values section.
2276
+
2277
+ /**
2278
+ * Value[Const] :
2279
+ * - [~Const] Variable
2280
+ * - IntValue
2281
+ * - FloatValue
2282
+ * - StringValue
2283
+ * - BooleanValue
2284
+ * - NullValue
2285
+ * - EnumValue
2286
+ * - ListValue[?Const]
2287
+ * - ObjectValue[?Const]
2288
+ *
2289
+ * BooleanValue : one of `true` `false`
2290
+ *
2291
+ * NullValue : `null`
2292
+ *
2293
+ * EnumValue : Name but not `true`, `false` or `null`
2294
+ */
2295
+
2296
+ parseValueLiteral(isConst) {
2297
+ const token = this._lexer.token;
2298
+
2299
+ switch (token.kind) {
2300
+ case TokenKind.BRACKET_L:
2301
+ return this.parseList(isConst);
2302
+
2303
+ case TokenKind.BRACE_L:
2304
+ return this.parseObject(isConst);
2305
+
2306
+ case TokenKind.INT:
2307
+ this.advanceLexer();
2308
+ return this.node(token, {
2309
+ kind: Kind.INT,
2310
+ value: token.value,
2311
+ });
2312
+
2313
+ case TokenKind.FLOAT:
2314
+ this.advanceLexer();
2315
+ return this.node(token, {
2316
+ kind: Kind.FLOAT,
2317
+ value: token.value,
2318
+ });
2319
+
2320
+ case TokenKind.STRING:
2321
+ case TokenKind.BLOCK_STRING:
2322
+ return this.parseStringLiteral();
2323
+
2324
+ case TokenKind.NAME:
2325
+ this.advanceLexer();
2326
+
2327
+ switch (token.value) {
2328
+ case 'true':
2329
+ return this.node(token, {
2330
+ kind: Kind.BOOLEAN,
2331
+ value: true,
2332
+ });
2333
+
2334
+ case 'false':
2335
+ return this.node(token, {
2336
+ kind: Kind.BOOLEAN,
2337
+ value: false,
2338
+ });
2339
+
2340
+ case 'null':
2341
+ return this.node(token, {
2342
+ kind: Kind.NULL,
2343
+ });
2344
+
2345
+ default:
2346
+ return this.node(token, {
2347
+ kind: Kind.ENUM,
2348
+ value: token.value,
2349
+ });
2350
+ }
2351
+
2352
+ case TokenKind.DOLLAR:
2353
+ if (isConst) {
2354
+ this.expectToken(TokenKind.DOLLAR);
2355
+
2356
+ if (this._lexer.token.kind === TokenKind.NAME) {
2357
+ const varName = this._lexer.token.value;
2358
+ throw syntaxError(
2359
+ this._lexer.source,
2360
+ token.start,
2361
+ `Unexpected variable "$${varName}" in constant value.`,
2362
+ );
2363
+ } else {
2364
+ throw this.unexpected(token);
2365
+ }
2366
+ }
2367
+
2368
+ return this.parseVariable();
2369
+
2370
+ default:
2371
+ throw this.unexpected();
2372
+ }
2373
+ }
2374
+
2375
+ parseConstValueLiteral() {
2376
+ return this.parseValueLiteral(true);
2377
+ }
2378
+
2379
+ parseStringLiteral() {
2380
+ const token = this._lexer.token;
2381
+ this.advanceLexer();
2382
+ return this.node(token, {
2383
+ kind: Kind.STRING,
2384
+ value: token.value,
2385
+ block: token.kind === TokenKind.BLOCK_STRING,
2386
+ });
2387
+ }
2388
+ /**
2389
+ * ListValue[Const] :
2390
+ * - [ ]
2391
+ * - [ Value[?Const]+ ]
2392
+ */
2393
+
2394
+ parseList(isConst) {
2395
+ const item = () => this.parseValueLiteral(isConst);
2396
+
2397
+ return this.node(this._lexer.token, {
2398
+ kind: Kind.LIST,
2399
+ values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),
2400
+ });
2401
+ }
2402
+ /**
2403
+ * ```
2404
+ * ObjectValue[Const] :
2405
+ * - { }
2406
+ * - { ObjectField[?Const]+ }
2407
+ * ```
2408
+ */
2409
+
2410
+ parseObject(isConst) {
2411
+ const item = () => this.parseObjectField(isConst);
2412
+
2413
+ return this.node(this._lexer.token, {
2414
+ kind: Kind.OBJECT,
2415
+ fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),
2416
+ });
2417
+ }
2418
+ /**
2419
+ * ObjectField[Const] : Name : Value[?Const]
2420
+ */
2421
+
2422
+ parseObjectField(isConst) {
2423
+ const start = this._lexer.token;
2424
+ const name = this.parseName();
2425
+ this.expectToken(TokenKind.COLON);
2426
+ return this.node(start, {
2427
+ kind: Kind.OBJECT_FIELD,
2428
+ name,
2429
+ value: this.parseValueLiteral(isConst),
2430
+ });
2431
+ } // Implements the parsing rules in the Directives section.
2432
+
2433
+ /**
2434
+ * Directives[Const] : Directive[?Const]+
2435
+ */
2436
+
2437
+ parseDirectives(isConst) {
2438
+ const directives = [];
2439
+
2440
+ while (this.peek(TokenKind.AT)) {
2441
+ directives.push(this.parseDirective(isConst));
2442
+ }
2443
+
2444
+ return directives;
2445
+ }
2446
+
2447
+ parseConstDirectives() {
2448
+ return this.parseDirectives(true);
2449
+ }
2450
+ /**
2451
+ * ```
2452
+ * Directive[Const] : @ Name Arguments[?Const]?
2453
+ * ```
2454
+ */
2455
+
2456
+ parseDirective(isConst) {
2457
+ const start = this._lexer.token;
2458
+ this.expectToken(TokenKind.AT);
2459
+ return this.node(start, {
2460
+ kind: Kind.DIRECTIVE,
2461
+ name: this.parseName(),
2462
+ arguments: this.parseArguments(isConst),
2463
+ });
2464
+ } // Implements the parsing rules in the Types section.
2465
+
2466
+ /**
2467
+ * Type :
2468
+ * - NamedType
2469
+ * - ListType
2470
+ * - NonNullType
2471
+ */
2472
+
2473
+ parseTypeReference() {
2474
+ const start = this._lexer.token;
2475
+ let type;
2476
+
2477
+ if (this.expectOptionalToken(TokenKind.BRACKET_L)) {
2478
+ const innerType = this.parseTypeReference();
2479
+ this.expectToken(TokenKind.BRACKET_R);
2480
+ type = this.node(start, {
2481
+ kind: Kind.LIST_TYPE,
2482
+ type: innerType,
2483
+ });
2484
+ } else {
2485
+ type = this.parseNamedType();
2486
+ }
2487
+
2488
+ if (this.expectOptionalToken(TokenKind.BANG)) {
2489
+ return this.node(start, {
2490
+ kind: Kind.NON_NULL_TYPE,
2491
+ type,
2492
+ });
2493
+ }
2494
+
2495
+ return type;
2496
+ }
2497
+ /**
2498
+ * NamedType : Name
2499
+ */
2500
+
2501
+ parseNamedType() {
2502
+ return this.node(this._lexer.token, {
2503
+ kind: Kind.NAMED_TYPE,
2504
+ name: this.parseName(),
2505
+ });
2506
+ } // Implements the parsing rules in the Type Definition section.
2507
+
2508
+ peekDescription() {
2509
+ return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);
2510
+ }
2511
+ /**
2512
+ * Description : StringValue
2513
+ */
2514
+
2515
+ parseDescription() {
2516
+ if (this.peekDescription()) {
2517
+ return this.parseStringLiteral();
2518
+ }
2519
+ }
2520
+ /**
2521
+ * ```
2522
+ * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
2523
+ * ```
2524
+ */
2525
+
2526
+ parseSchemaDefinition() {
2527
+ const start = this._lexer.token;
2528
+ const description = this.parseDescription();
2529
+ this.expectKeyword('schema');
2530
+ const directives = this.parseConstDirectives();
2531
+ const operationTypes = this.many(
2532
+ TokenKind.BRACE_L,
2533
+ this.parseOperationTypeDefinition,
2534
+ TokenKind.BRACE_R,
2535
+ );
2536
+ return this.node(start, {
2537
+ kind: Kind.SCHEMA_DEFINITION,
2538
+ description,
2539
+ directives,
2540
+ operationTypes,
2541
+ });
2542
+ }
2543
+ /**
2544
+ * OperationTypeDefinition : OperationType : NamedType
2545
+ */
2546
+
2547
+ parseOperationTypeDefinition() {
2548
+ const start = this._lexer.token;
2549
+ const operation = this.parseOperationType();
2550
+ this.expectToken(TokenKind.COLON);
2551
+ const type = this.parseNamedType();
2552
+ return this.node(start, {
2553
+ kind: Kind.OPERATION_TYPE_DEFINITION,
2554
+ operation,
2555
+ type,
2556
+ });
2557
+ }
2558
+ /**
2559
+ * ScalarTypeDefinition : Description? scalar Name Directives[Const]?
2560
+ */
2561
+
2562
+ parseScalarTypeDefinition() {
2563
+ const start = this._lexer.token;
2564
+ const description = this.parseDescription();
2565
+ this.expectKeyword('scalar');
2566
+ const name = this.parseName();
2567
+ const directives = this.parseConstDirectives();
2568
+ return this.node(start, {
2569
+ kind: Kind.SCALAR_TYPE_DEFINITION,
2570
+ description,
2571
+ name,
2572
+ directives,
2573
+ });
2574
+ }
2575
+ /**
2576
+ * ObjectTypeDefinition :
2577
+ * Description?
2578
+ * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
2579
+ */
2580
+
2581
+ parseObjectTypeDefinition() {
2582
+ const start = this._lexer.token;
2583
+ const description = this.parseDescription();
2584
+ this.expectKeyword('type');
2585
+ const name = this.parseName();
2586
+ const interfaces = this.parseImplementsInterfaces();
2587
+ const directives = this.parseConstDirectives();
2588
+ const fields = this.parseFieldsDefinition();
2589
+ return this.node(start, {
2590
+ kind: Kind.OBJECT_TYPE_DEFINITION,
2591
+ description,
2592
+ name,
2593
+ interfaces,
2594
+ directives,
2595
+ fields,
2596
+ });
2597
+ }
2598
+ /**
2599
+ * ImplementsInterfaces :
2600
+ * - implements `&`? NamedType
2601
+ * - ImplementsInterfaces & NamedType
2602
+ */
2603
+
2604
+ parseImplementsInterfaces() {
2605
+ return this.expectOptionalKeyword('implements')
2606
+ ? this.delimitedMany(TokenKind.AMP, this.parseNamedType)
2607
+ : [];
2608
+ }
2609
+ /**
2610
+ * ```
2611
+ * FieldsDefinition : { FieldDefinition+ }
2612
+ * ```
2613
+ */
2614
+
2615
+ parseFieldsDefinition() {
2616
+ return this.optionalMany(
2617
+ TokenKind.BRACE_L,
2618
+ this.parseFieldDefinition,
2619
+ TokenKind.BRACE_R,
2620
+ );
2621
+ }
2622
+ /**
2623
+ * FieldDefinition :
2624
+ * - Description? Name ArgumentsDefinition? : Type Directives[Const]?
2625
+ */
2626
+
2627
+ parseFieldDefinition() {
2628
+ const start = this._lexer.token;
2629
+ const description = this.parseDescription();
2630
+ const name = this.parseName();
2631
+ const args = this.parseArgumentDefs();
2632
+ this.expectToken(TokenKind.COLON);
2633
+ const type = this.parseTypeReference();
2634
+ const directives = this.parseConstDirectives();
2635
+ return this.node(start, {
2636
+ kind: Kind.FIELD_DEFINITION,
2637
+ description,
2638
+ name,
2639
+ arguments: args,
2640
+ type,
2641
+ directives,
2642
+ });
2643
+ }
2644
+ /**
2645
+ * ArgumentsDefinition : ( InputValueDefinition+ )
2646
+ */
2647
+
2648
+ parseArgumentDefs() {
2649
+ return this.optionalMany(
2650
+ TokenKind.PAREN_L,
2651
+ this.parseInputValueDef,
2652
+ TokenKind.PAREN_R,
2653
+ );
2654
+ }
2655
+ /**
2656
+ * InputValueDefinition :
2657
+ * - Description? Name : Type DefaultValue? Directives[Const]?
2658
+ */
2659
+
2660
+ parseInputValueDef() {
2661
+ const start = this._lexer.token;
2662
+ const description = this.parseDescription();
2663
+ const name = this.parseName();
2664
+ this.expectToken(TokenKind.COLON);
2665
+ const type = this.parseTypeReference();
2666
+ let defaultValue;
2667
+
2668
+ if (this.expectOptionalToken(TokenKind.EQUALS)) {
2669
+ defaultValue = this.parseConstValueLiteral();
2670
+ }
2671
+
2672
+ const directives = this.parseConstDirectives();
2673
+ return this.node(start, {
2674
+ kind: Kind.INPUT_VALUE_DEFINITION,
2675
+ description,
2676
+ name,
2677
+ type,
2678
+ defaultValue,
2679
+ directives,
2680
+ });
2681
+ }
2682
+ /**
2683
+ * InterfaceTypeDefinition :
2684
+ * - Description? interface Name Directives[Const]? FieldsDefinition?
2685
+ */
2686
+
2687
+ parseInterfaceTypeDefinition() {
2688
+ const start = this._lexer.token;
2689
+ const description = this.parseDescription();
2690
+ this.expectKeyword('interface');
2691
+ const name = this.parseName();
2692
+ const interfaces = this.parseImplementsInterfaces();
2693
+ const directives = this.parseConstDirectives();
2694
+ const fields = this.parseFieldsDefinition();
2695
+ return this.node(start, {
2696
+ kind: Kind.INTERFACE_TYPE_DEFINITION,
2697
+ description,
2698
+ name,
2699
+ interfaces,
2700
+ directives,
2701
+ fields,
2702
+ });
2703
+ }
2704
+ /**
2705
+ * UnionTypeDefinition :
2706
+ * - Description? union Name Directives[Const]? UnionMemberTypes?
2707
+ */
2708
+
2709
+ parseUnionTypeDefinition() {
2710
+ const start = this._lexer.token;
2711
+ const description = this.parseDescription();
2712
+ this.expectKeyword('union');
2713
+ const name = this.parseName();
2714
+ const directives = this.parseConstDirectives();
2715
+ const types = this.parseUnionMemberTypes();
2716
+ return this.node(start, {
2717
+ kind: Kind.UNION_TYPE_DEFINITION,
2718
+ description,
2719
+ name,
2720
+ directives,
2721
+ types,
2722
+ });
2723
+ }
2724
+ /**
2725
+ * UnionMemberTypes :
2726
+ * - = `|`? NamedType
2727
+ * - UnionMemberTypes | NamedType
2728
+ */
2729
+
2730
+ parseUnionMemberTypes() {
2731
+ return this.expectOptionalToken(TokenKind.EQUALS)
2732
+ ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType)
2733
+ : [];
2734
+ }
2735
+ /**
2736
+ * EnumTypeDefinition :
2737
+ * - Description? enum Name Directives[Const]? EnumValuesDefinition?
2738
+ */
2739
+
2740
+ parseEnumTypeDefinition() {
2741
+ const start = this._lexer.token;
2742
+ const description = this.parseDescription();
2743
+ this.expectKeyword('enum');
2744
+ const name = this.parseName();
2745
+ const directives = this.parseConstDirectives();
2746
+ const values = this.parseEnumValuesDefinition();
2747
+ return this.node(start, {
2748
+ kind: Kind.ENUM_TYPE_DEFINITION,
2749
+ description,
2750
+ name,
2751
+ directives,
2752
+ values,
2753
+ });
2754
+ }
2755
+ /**
2756
+ * ```
2757
+ * EnumValuesDefinition : { EnumValueDefinition+ }
2758
+ * ```
2759
+ */
2760
+
2761
+ parseEnumValuesDefinition() {
2762
+ return this.optionalMany(
2763
+ TokenKind.BRACE_L,
2764
+ this.parseEnumValueDefinition,
2765
+ TokenKind.BRACE_R,
2766
+ );
2767
+ }
2768
+ /**
2769
+ * EnumValueDefinition : Description? EnumValue Directives[Const]?
2770
+ */
2771
+
2772
+ parseEnumValueDefinition() {
2773
+ const start = this._lexer.token;
2774
+ const description = this.parseDescription();
2775
+ const name = this.parseEnumValueName();
2776
+ const directives = this.parseConstDirectives();
2777
+ return this.node(start, {
2778
+ kind: Kind.ENUM_VALUE_DEFINITION,
2779
+ description,
2780
+ name,
2781
+ directives,
2782
+ });
2783
+ }
2784
+ /**
2785
+ * EnumValue : Name but not `true`, `false` or `null`
2786
+ */
2787
+
2788
+ parseEnumValueName() {
2789
+ if (
2790
+ this._lexer.token.value === 'true' ||
2791
+ this._lexer.token.value === 'false' ||
2792
+ this._lexer.token.value === 'null'
2793
+ ) {
2794
+ throw syntaxError(
2795
+ this._lexer.source,
2796
+ this._lexer.token.start,
2797
+ `${getTokenDesc(
2798
+ this._lexer.token,
2799
+ )} is reserved and cannot be used for an enum value.`,
2800
+ );
2801
+ }
2802
+
2803
+ return this.parseName();
2804
+ }
2805
+ /**
2806
+ * InputObjectTypeDefinition :
2807
+ * - Description? input Name Directives[Const]? InputFieldsDefinition?
2808
+ */
2809
+
2810
+ parseInputObjectTypeDefinition() {
2811
+ const start = this._lexer.token;
2812
+ const description = this.parseDescription();
2813
+ this.expectKeyword('input');
2814
+ const name = this.parseName();
2815
+ const directives = this.parseConstDirectives();
2816
+ const fields = this.parseInputFieldsDefinition();
2817
+ return this.node(start, {
2818
+ kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
2819
+ description,
2820
+ name,
2821
+ directives,
2822
+ fields,
2823
+ });
2824
+ }
2825
+ /**
2826
+ * ```
2827
+ * InputFieldsDefinition : { InputValueDefinition+ }
2828
+ * ```
2829
+ */
2830
+
2831
+ parseInputFieldsDefinition() {
2832
+ return this.optionalMany(
2833
+ TokenKind.BRACE_L,
2834
+ this.parseInputValueDef,
2835
+ TokenKind.BRACE_R,
2836
+ );
2837
+ }
2838
+ /**
2839
+ * TypeSystemExtension :
2840
+ * - SchemaExtension
2841
+ * - TypeExtension
2842
+ *
2843
+ * TypeExtension :
2844
+ * - ScalarTypeExtension
2845
+ * - ObjectTypeExtension
2846
+ * - InterfaceTypeExtension
2847
+ * - UnionTypeExtension
2848
+ * - EnumTypeExtension
2849
+ * - InputObjectTypeDefinition
2850
+ */
2851
+
2852
+ parseTypeSystemExtension() {
2853
+ const keywordToken = this._lexer.lookahead();
2854
+
2855
+ if (keywordToken.kind === TokenKind.NAME) {
2856
+ switch (keywordToken.value) {
2857
+ case 'schema':
2858
+ return this.parseSchemaExtension();
2859
+
2860
+ case 'scalar':
2861
+ return this.parseScalarTypeExtension();
2862
+
2863
+ case 'type':
2864
+ return this.parseObjectTypeExtension();
2865
+
2866
+ case 'interface':
2867
+ return this.parseInterfaceTypeExtension();
2868
+
2869
+ case 'union':
2870
+ return this.parseUnionTypeExtension();
2871
+
2872
+ case 'enum':
2873
+ return this.parseEnumTypeExtension();
2874
+
2875
+ case 'input':
2876
+ return this.parseInputObjectTypeExtension();
2877
+ }
2878
+ }
2879
+
2880
+ throw this.unexpected(keywordToken);
2881
+ }
2882
+ /**
2883
+ * ```
2884
+ * SchemaExtension :
2885
+ * - extend schema Directives[Const]? { OperationTypeDefinition+ }
2886
+ * - extend schema Directives[Const]
2887
+ * ```
2888
+ */
2889
+
2890
+ parseSchemaExtension() {
2891
+ const start = this._lexer.token;
2892
+ this.expectKeyword('extend');
2893
+ this.expectKeyword('schema');
2894
+ const directives = this.parseConstDirectives();
2895
+ const operationTypes = this.optionalMany(
2896
+ TokenKind.BRACE_L,
2897
+ this.parseOperationTypeDefinition,
2898
+ TokenKind.BRACE_R,
2899
+ );
2900
+
2901
+ if (directives.length === 0 && operationTypes.length === 0) {
2902
+ throw this.unexpected();
2903
+ }
2904
+
2905
+ return this.node(start, {
2906
+ kind: Kind.SCHEMA_EXTENSION,
2907
+ directives,
2908
+ operationTypes,
2909
+ });
2910
+ }
2911
+ /**
2912
+ * ScalarTypeExtension :
2913
+ * - extend scalar Name Directives[Const]
2914
+ */
2915
+
2916
+ parseScalarTypeExtension() {
2917
+ const start = this._lexer.token;
2918
+ this.expectKeyword('extend');
2919
+ this.expectKeyword('scalar');
2920
+ const name = this.parseName();
2921
+ const directives = this.parseConstDirectives();
2922
+
2923
+ if (directives.length === 0) {
2924
+ throw this.unexpected();
2925
+ }
2926
+
2927
+ return this.node(start, {
2928
+ kind: Kind.SCALAR_TYPE_EXTENSION,
2929
+ name,
2930
+ directives,
2931
+ });
2932
+ }
2933
+ /**
2934
+ * ObjectTypeExtension :
2935
+ * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2936
+ * - extend type Name ImplementsInterfaces? Directives[Const]
2937
+ * - extend type Name ImplementsInterfaces
2938
+ */
2939
+
2940
+ parseObjectTypeExtension() {
2941
+ const start = this._lexer.token;
2942
+ this.expectKeyword('extend');
2943
+ this.expectKeyword('type');
2944
+ const name = this.parseName();
2945
+ const interfaces = this.parseImplementsInterfaces();
2946
+ const directives = this.parseConstDirectives();
2947
+ const fields = this.parseFieldsDefinition();
2948
+
2949
+ if (
2950
+ interfaces.length === 0 &&
2951
+ directives.length === 0 &&
2952
+ fields.length === 0
2953
+ ) {
2954
+ throw this.unexpected();
2955
+ }
2956
+
2957
+ return this.node(start, {
2958
+ kind: Kind.OBJECT_TYPE_EXTENSION,
2959
+ name,
2960
+ interfaces,
2961
+ directives,
2962
+ fields,
2963
+ });
2964
+ }
2965
+ /**
2966
+ * InterfaceTypeExtension :
2967
+ * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
2968
+ * - extend interface Name ImplementsInterfaces? Directives[Const]
2969
+ * - extend interface Name ImplementsInterfaces
2970
+ */
2971
+
2972
+ parseInterfaceTypeExtension() {
2973
+ const start = this._lexer.token;
2974
+ this.expectKeyword('extend');
2975
+ this.expectKeyword('interface');
2976
+ const name = this.parseName();
2977
+ const interfaces = this.parseImplementsInterfaces();
2978
+ const directives = this.parseConstDirectives();
2979
+ const fields = this.parseFieldsDefinition();
2980
+
2981
+ if (
2982
+ interfaces.length === 0 &&
2983
+ directives.length === 0 &&
2984
+ fields.length === 0
2985
+ ) {
2986
+ throw this.unexpected();
2987
+ }
2988
+
2989
+ return this.node(start, {
2990
+ kind: Kind.INTERFACE_TYPE_EXTENSION,
2991
+ name,
2992
+ interfaces,
2993
+ directives,
2994
+ fields,
2995
+ });
2996
+ }
2997
+ /**
2998
+ * UnionTypeExtension :
2999
+ * - extend union Name Directives[Const]? UnionMemberTypes
3000
+ * - extend union Name Directives[Const]
3001
+ */
3002
+
3003
+ parseUnionTypeExtension() {
3004
+ const start = this._lexer.token;
3005
+ this.expectKeyword('extend');
3006
+ this.expectKeyword('union');
3007
+ const name = this.parseName();
3008
+ const directives = this.parseConstDirectives();
3009
+ const types = this.parseUnionMemberTypes();
3010
+
3011
+ if (directives.length === 0 && types.length === 0) {
3012
+ throw this.unexpected();
3013
+ }
3014
+
3015
+ return this.node(start, {
3016
+ kind: Kind.UNION_TYPE_EXTENSION,
3017
+ name,
3018
+ directives,
3019
+ types,
3020
+ });
3021
+ }
3022
+ /**
3023
+ * EnumTypeExtension :
3024
+ * - extend enum Name Directives[Const]? EnumValuesDefinition
3025
+ * - extend enum Name Directives[Const]
3026
+ */
3027
+
3028
+ parseEnumTypeExtension() {
3029
+ const start = this._lexer.token;
3030
+ this.expectKeyword('extend');
3031
+ this.expectKeyword('enum');
3032
+ const name = this.parseName();
3033
+ const directives = this.parseConstDirectives();
3034
+ const values = this.parseEnumValuesDefinition();
3035
+
3036
+ if (directives.length === 0 && values.length === 0) {
3037
+ throw this.unexpected();
3038
+ }
3039
+
3040
+ return this.node(start, {
3041
+ kind: Kind.ENUM_TYPE_EXTENSION,
3042
+ name,
3043
+ directives,
3044
+ values,
3045
+ });
3046
+ }
3047
+ /**
3048
+ * InputObjectTypeExtension :
3049
+ * - extend input Name Directives[Const]? InputFieldsDefinition
3050
+ * - extend input Name Directives[Const]
3051
+ */
3052
+
3053
+ parseInputObjectTypeExtension() {
3054
+ const start = this._lexer.token;
3055
+ this.expectKeyword('extend');
3056
+ this.expectKeyword('input');
3057
+ const name = this.parseName();
3058
+ const directives = this.parseConstDirectives();
3059
+ const fields = this.parseInputFieldsDefinition();
3060
+
3061
+ if (directives.length === 0 && fields.length === 0) {
3062
+ throw this.unexpected();
3063
+ }
3064
+
3065
+ return this.node(start, {
3066
+ kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,
3067
+ name,
3068
+ directives,
3069
+ fields,
3070
+ });
3071
+ }
3072
+ /**
3073
+ * ```
3074
+ * DirectiveDefinition :
3075
+ * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
3076
+ * ```
3077
+ */
3078
+
3079
+ parseDirectiveDefinition() {
3080
+ const start = this._lexer.token;
3081
+ const description = this.parseDescription();
3082
+ this.expectKeyword('directive');
3083
+ this.expectToken(TokenKind.AT);
3084
+ const name = this.parseName();
3085
+ const args = this.parseArgumentDefs();
3086
+ const repeatable = this.expectOptionalKeyword('repeatable');
3087
+ this.expectKeyword('on');
3088
+ const locations = this.parseDirectiveLocations();
3089
+ return this.node(start, {
3090
+ kind: Kind.DIRECTIVE_DEFINITION,
3091
+ description,
3092
+ name,
3093
+ arguments: args,
3094
+ repeatable,
3095
+ locations,
3096
+ });
3097
+ }
3098
+ /**
3099
+ * DirectiveLocations :
3100
+ * - `|`? DirectiveLocation
3101
+ * - DirectiveLocations | DirectiveLocation
3102
+ */
3103
+
3104
+ parseDirectiveLocations() {
3105
+ return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);
3106
+ }
3107
+ /*
3108
+ * DirectiveLocation :
3109
+ * - ExecutableDirectiveLocation
3110
+ * - TypeSystemDirectiveLocation
3111
+ *
3112
+ * ExecutableDirectiveLocation : one of
3113
+ * `QUERY`
3114
+ * `MUTATION`
3115
+ * `SUBSCRIPTION`
3116
+ * `FIELD`
3117
+ * `FRAGMENT_DEFINITION`
3118
+ * `FRAGMENT_SPREAD`
3119
+ * `INLINE_FRAGMENT`
3120
+ *
3121
+ * TypeSystemDirectiveLocation : one of
3122
+ * `SCHEMA`
3123
+ * `SCALAR`
3124
+ * `OBJECT`
3125
+ * `FIELD_DEFINITION`
3126
+ * `ARGUMENT_DEFINITION`
3127
+ * `INTERFACE`
3128
+ * `UNION`
3129
+ * `ENUM`
3130
+ * `ENUM_VALUE`
3131
+ * `INPUT_OBJECT`
3132
+ * `INPUT_FIELD_DEFINITION`
3133
+ */
3134
+
3135
+ parseDirectiveLocation() {
3136
+ const start = this._lexer.token;
3137
+ const name = this.parseName();
3138
+
3139
+ if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {
3140
+ return name;
3141
+ }
3142
+
3143
+ throw this.unexpected(start);
3144
+ } // Core parsing utility functions
3145
+
3146
+ /**
3147
+ * Returns a node that, if configured to do so, sets a "loc" field as a
3148
+ * location object, used to identify the place in the source that created a
3149
+ * given parsed object.
3150
+ */
3151
+
3152
+ node(startToken, node) {
3153
+ if (this._options.noLocation !== true) {
3154
+ node.loc = new Location(
3155
+ startToken,
3156
+ this._lexer.lastToken,
3157
+ this._lexer.source,
3158
+ );
3159
+ }
3160
+
3161
+ return node;
3162
+ }
3163
+ /**
3164
+ * Determines if the next token is of a given kind
3165
+ */
3166
+
3167
+ peek(kind) {
3168
+ return this._lexer.token.kind === kind;
3169
+ }
3170
+ /**
3171
+ * If the next token is of the given kind, return that token after advancing the lexer.
3172
+ * Otherwise, do not change the parser state and throw an error.
3173
+ */
3174
+
3175
+ expectToken(kind) {
3176
+ const token = this._lexer.token;
3177
+
3178
+ if (token.kind === kind) {
3179
+ this.advanceLexer();
3180
+ return token;
3181
+ }
3182
+
3183
+ throw syntaxError(
3184
+ this._lexer.source,
3185
+ token.start,
3186
+ `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,
3187
+ );
3188
+ }
3189
+ /**
3190
+ * If the next token is of the given kind, return "true" after advancing the lexer.
3191
+ * Otherwise, do not change the parser state and return "false".
3192
+ */
3193
+
3194
+ expectOptionalToken(kind) {
3195
+ const token = this._lexer.token;
3196
+
3197
+ if (token.kind === kind) {
3198
+ this.advanceLexer();
3199
+ return true;
3200
+ }
3201
+
3202
+ return false;
3203
+ }
3204
+ /**
3205
+ * If the next token is a given keyword, advance the lexer.
3206
+ * Otherwise, do not change the parser state and throw an error.
3207
+ */
3208
+
3209
+ expectKeyword(value) {
3210
+ const token = this._lexer.token;
3211
+
3212
+ if (token.kind === TokenKind.NAME && token.value === value) {
3213
+ this.advanceLexer();
3214
+ } else {
3215
+ throw syntaxError(
3216
+ this._lexer.source,
3217
+ token.start,
3218
+ `Expected "${value}", found ${getTokenDesc(token)}.`,
3219
+ );
3220
+ }
3221
+ }
3222
+ /**
3223
+ * If the next token is a given keyword, return "true" after advancing the lexer.
3224
+ * Otherwise, do not change the parser state and return "false".
3225
+ */
3226
+
3227
+ expectOptionalKeyword(value) {
3228
+ const token = this._lexer.token;
3229
+
3230
+ if (token.kind === TokenKind.NAME && token.value === value) {
3231
+ this.advanceLexer();
3232
+ return true;
3233
+ }
3234
+
3235
+ return false;
3236
+ }
3237
+ /**
3238
+ * Helper function for creating an error when an unexpected lexed token is encountered.
3239
+ */
3240
+
3241
+ unexpected(atToken) {
3242
+ const token =
3243
+ atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;
3244
+ return syntaxError(
3245
+ this._lexer.source,
3246
+ token.start,
3247
+ `Unexpected ${getTokenDesc(token)}.`,
3248
+ );
3249
+ }
3250
+ /**
3251
+ * Returns a possibly empty list of parse nodes, determined by the parseFn.
3252
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
3253
+ * Advances the parser to the next lex token after the closing token.
3254
+ */
3255
+
3256
+ any(openKind, parseFn, closeKind) {
3257
+ this.expectToken(openKind);
3258
+ const nodes = [];
3259
+
3260
+ while (!this.expectOptionalToken(closeKind)) {
3261
+ nodes.push(parseFn.call(this));
3262
+ }
3263
+
3264
+ return nodes;
3265
+ }
3266
+ /**
3267
+ * Returns a list of parse nodes, determined by the parseFn.
3268
+ * It can be empty only if open token is missing otherwise it will always return non-empty list
3269
+ * that begins with a lex token of openKind and ends with a lex token of closeKind.
3270
+ * Advances the parser to the next lex token after the closing token.
3271
+ */
3272
+
3273
+ optionalMany(openKind, parseFn, closeKind) {
3274
+ if (this.expectOptionalToken(openKind)) {
3275
+ const nodes = [];
3276
+
3277
+ do {
3278
+ nodes.push(parseFn.call(this));
3279
+ } while (!this.expectOptionalToken(closeKind));
3280
+
3281
+ return nodes;
3282
+ }
3283
+
3284
+ return [];
3285
+ }
3286
+ /**
3287
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
3288
+ * This list begins with a lex token of openKind and ends with a lex token of closeKind.
3289
+ * Advances the parser to the next lex token after the closing token.
3290
+ */
3291
+
3292
+ many(openKind, parseFn, closeKind) {
3293
+ this.expectToken(openKind);
3294
+ const nodes = [];
3295
+
3296
+ do {
3297
+ nodes.push(parseFn.call(this));
3298
+ } while (!this.expectOptionalToken(closeKind));
3299
+
3300
+ return nodes;
3301
+ }
3302
+ /**
3303
+ * Returns a non-empty list of parse nodes, determined by the parseFn.
3304
+ * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
3305
+ * Advances the parser to the next lex token after last item in the list.
3306
+ */
3307
+
3308
+ delimitedMany(delimiterKind, parseFn) {
3309
+ this.expectOptionalToken(delimiterKind);
3310
+ const nodes = [];
3311
+
3312
+ do {
3313
+ nodes.push(parseFn.call(this));
3314
+ } while (this.expectOptionalToken(delimiterKind));
3315
+
3316
+ return nodes;
3317
+ }
3318
+
3319
+ advanceLexer() {
3320
+ const { maxTokens } = this._options;
3321
+
3322
+ const token = this._lexer.advance();
3323
+
3324
+ if (maxTokens !== undefined && token.kind !== TokenKind.EOF) {
3325
+ ++this._tokenCounter;
3326
+
3327
+ if (this._tokenCounter > maxTokens) {
3328
+ throw syntaxError(
3329
+ this._lexer.source,
3330
+ token.start,
3331
+ `Document contains more that ${maxTokens} tokens. Parsing aborted.`,
3332
+ );
3333
+ }
3334
+ }
3335
+ }
3336
+ }
3337
+ /**
3338
+ * A helper function to describe a token as a string for debugging.
3339
+ */
3340
+
3341
+ function getTokenDesc(token) {
3342
+ const value = token.value;
3343
+ return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : '');
3344
+ }
3345
+ /**
3346
+ * A helper function to describe a token kind as a string for debugging.
3347
+ */
3348
+
3349
+ function getTokenKindDesc(kind) {
3350
+ return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind;
3351
+ }
3352
+
52
3353
  var docCache = new Map();
53
3354
  var fragmentSourceMap = new Map();
54
3355
  var printFragmentWarnings = true;
@@ -3179,7 +6480,7 @@ function initBackendsLocations() {
3179
6480
  case 'local':
3180
6481
  dBackend = 'https://localhost:44322';
3181
6482
  frontend = 'http://localhost:4200';
3182
- apiBackend = 'https://api.bcrumbs.net';
6483
+ apiBackend = 'http://localhost:6085/';
3183
6484
  apiV2Backend = 'https://apiv2-dev.bcrumbs.net';
3184
6485
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
3185
6486
  break;
@@ -3248,8 +6549,11 @@ const {
3248
6549
  } = appConfig.dconfig;
3249
6550
  async function getUserToken() {
3250
6551
  return new Promise(resolve => {
3251
- const storedToken = window && window.localStorage.getItem('token');
3252
- resolve(storedToken);
6552
+ if (window) {
6553
+ const storedToken = window && window.localStorage.getItem('token');
6554
+ resolve(storedToken);
6555
+ }
6556
+ resolve(undefined);
3253
6557
  });
3254
6558
  }
3255
6559
  async function getUserContext() {
@@ -4074,6 +7378,14 @@ const showcasePagesQueryOptions = {
4074
7378
  };
4075
7379
  }
4076
7380
  };
7381
+ const useShowcasePagesQuery = parentId => useQuery(showcasePagesQuery, {
7382
+ fetchPolicy: 'cache-first',
7383
+ client: dqueryClient,
7384
+ variables: {
7385
+ companyId: auth.getContext(),
7386
+ parentId: parentId
7387
+ }
7388
+ });
4077
7389
  const showcaseSectionsQuery = gql$1(_t4$5 || (_t4$5 = _$5`
4078
7390
  query ($companyId: Int!, $parentId: Int!) {
4079
7391
  pageResoruces(companyId: $companyId, parentId: $parentId) {
@@ -87079,16 +90391,14 @@ var isomorphicUnfetch = commonjsGlobal.fetch = commonjsGlobal.fetch || (
87079
90391
  const GRAPHQL_URL = 'https://query.bcrumbs.net/graphql';
87080
90392
  // const GRAPHQL_URL = 'https://localhost:44322/graphql';
87081
90393
 
87082
- const link = createHttpLink$1({
90394
+ const link = createHttpLink({
87083
90395
  fetch: isomorphicUnfetch,
87084
90396
  // Switches between unfetch & node-fetch for client & server.
87085
90397
  uri: GRAPHQL_URL
87086
90398
  });
87087
90399
  const showcaseClient = new ApolloClient({
87088
- // @ts-expect-error TypeScript is complaining
87089
90400
  link: link,
87090
- // @ts-expect-error TypeScript is complaining
87091
- cache: new InMemoryCache$1()
90401
+ cache: new InMemoryCache()
87092
90402
  // rehydrate the cache using the initial data passed from the server:
87093
90403
  // .restore(initialState || {}),
87094
90404
  });
@@ -87098,7 +90408,7 @@ const showcaseClient = new ApolloClient({
87098
90408
  const withShowcaseClient = withApollo(({
87099
90409
  initialState
87100
90410
  }) =>
87101
- // @ts-expect-error TypeScript is complaining
90411
+ // @ts-expect-error will be fixed later
87102
90412
  showcaseClient);
87103
90413
 
87104
90414
  var wellKnownSymbol$5 = wellKnownSymbol$i;
@@ -87769,4 +91079,4 @@ if (typeof window !== 'undefined') {
87769
91079
  window.global = window;
87770
91080
  }
87771
91081
 
87772
- export { CreateCheckoutSessionUri, CreatePortalSessionUri, HttpStatusCode, HttpStatusCodeName, LOCAL_STORAGE_I18N_STRING, LangService, Languages, ModelFieldsTypes, ModelUtilities, StringsUtils, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, auth, companyUsersQuery, contentInstancesQuery, createCompany, createCompanyOptions, createContentInstanceMutation, createContentInstanceMutationOptions, createContentMutation, createContentMutationOptions, createFileMutation, createFolderMutation, dconfigClient, deleteFileMutation, deleteFolderMutation, dqueryClient, filesQuery, foldersTreeQuery, forgetPassword, forgetPasswordOptions, frontend, inviteUser, inviteUserOptions, login, loginOptions, querySectionThumb, queryUsage, registeUsage, register, registerOptions, removeContentMutation, removeDomain, removeDomainOptions, removeUserFromCompany, removeUserFromCompanyOptions, resetPassword, resetPasswordOptions, showcaseClient, showcaseConfig, showcaseConfigById, showcaseConfigurationQuery, showcaseConfigurationQueryOptions, showcaseContentsQuery, showcaseDomainsQuery, showcaseDomainsQueryOptions, showcasePagesQuery, showcasePagesQueryOptions, showcaseSectionQuery, showcaseSectionsQuery, showcaseSectionsQueryOptions, showcaseTemplateSectionsThumbsMap, showcaseTemplatesQuery, showcaseTemplatesQueryOptions, subscriptionConfigurationQuery, subscriptionConfigurationQueryOptions, tokenClient, updateCompany, updateCompanyOptions, updateContentInstanceFieldValuesMutation, updateContentInstanceFieldValuesMutationOptions, updateContentsOrderingMutation, updateContentsOrderingMutationOptions, updateTemplateSectionThumb, updateUserPassword, updateUserPasswordOptions, updateUserProfile, updateUserProfileOptions, useContentInstancesQuery, useCreateContentInstanceMutation, useCreateContentMutation, useCreateFileMutation, useCreateFolderMutation, useDeleteContentMutation, useDeleteFileMutation, useDeleteFolderMutation, useDomainsQuery, useFilesQuery, useFoldersTreeQuery, useModelChildrenQuery, useModelsQuery, useQuerySectionThumb, useQueryUsage, useRegisterUsage, useShowcaseConfig, useShowcaseConfigById, useShowcaseConfigurationQuery, useShowcaseContentsQuery, useShowcaseSectionQuery, useShowcaseTemplate, useShowcaseTemplateOptions, useShowcaseTemplateProgress, useShowcaseTemplateProgressQuery, useTemplateSectionsThumbsMap, useUpdateContentInstanceFieldValuesMutation, useUpdateContentsOrderingMutation, useUserCompaniesQuery, userCompaniesQuery, userCompaniesQueryOptions, userInfoQuery, userInfoQueryOptions, viewTypeChildrenQuery, viewTypeChildrenQueryOptions, viewTypesQuery, viewTypesQueryOptions, withDQueryClient, withShowcaseClient };
91082
+ export { CreateCheckoutSessionUri, CreatePortalSessionUri, HttpStatusCode, HttpStatusCodeName, LOCAL_STORAGE_I18N_STRING, LangService, Languages, ModelFieldsTypes, ModelUtilities, StringsUtils, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, auth, companyUsersQuery, contentInstancesQuery, createCompany, createCompanyOptions, createContentInstanceMutation, createContentInstanceMutationOptions, createContentMutation, createContentMutationOptions, createFileMutation, createFolderMutation, dconfigClient, deleteFileMutation, deleteFolderMutation, dqueryClient, filesQuery, foldersTreeQuery, forgetPassword, forgetPasswordOptions, frontend, inviteUser, inviteUserOptions, login, loginOptions, querySectionThumb, queryUsage, registeUsage, register, registerOptions, removeContentMutation, removeDomain, removeDomainOptions, removeUserFromCompany, removeUserFromCompanyOptions, resetPassword, resetPasswordOptions, showcaseClient, showcaseConfig, showcaseConfigById, showcaseConfigurationQuery, showcaseConfigurationQueryOptions, showcaseContentsQuery, showcaseDomainsQuery, showcaseDomainsQueryOptions, showcasePagesQuery, showcasePagesQueryOptions, showcaseSectionQuery, showcaseSectionsQuery, showcaseSectionsQueryOptions, showcaseTemplateSectionsThumbsMap, showcaseTemplatesQuery, showcaseTemplatesQueryOptions, subscriptionConfigurationQuery, subscriptionConfigurationQueryOptions, tokenClient, updateCompany, updateCompanyOptions, updateContentInstanceFieldValuesMutation, updateContentInstanceFieldValuesMutationOptions, updateContentsOrderingMutation, updateContentsOrderingMutationOptions, updateTemplateSectionThumb, updateUserPassword, updateUserPasswordOptions, updateUserProfile, updateUserProfileOptions, useContentInstancesQuery, useCreateContentInstanceMutation, useCreateContentMutation, useCreateFileMutation, useCreateFolderMutation, useDeleteContentMutation, useDeleteFileMutation, useDeleteFolderMutation, useDomainsQuery, useFilesQuery, useFoldersTreeQuery, useModelChildrenQuery, useModelsQuery, useQuerySectionThumb, useQueryUsage, useRegisterUsage, useShowcaseConfig, useShowcaseConfigById, useShowcaseConfigurationQuery, useShowcaseContentsQuery, useShowcasePagesQuery, useShowcaseSectionQuery, useShowcaseTemplate, useShowcaseTemplateOptions, useShowcaseTemplateProgress, useShowcaseTemplateProgressQuery, useTemplateSectionsThumbsMap, useUpdateContentInstanceFieldValuesMutation, useUpdateContentsOrderingMutation, useUserCompaniesQuery, userCompaniesQuery, userCompaniesQueryOptions, userInfoQuery, userInfoQueryOptions, viewTypeChildrenQuery, viewTypeChildrenQueryOptions, viewTypesQuery, viewTypesQueryOptions, withDQueryClient, withShowcaseClient };