@galaxy-stack/orbit-graphql-federation 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +47 -0
  2. package/dist/index.js +493 -3101
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -106,3143 +106,535 @@ function ReferenceResolver() {
106
106
  }
107
107
  // src/schema/federation-schema-builder.ts
108
108
  import"reflect-metadata";
109
- // ../../node_modules/graphql/jsutils/devAssert.mjs
110
- function devAssert(condition, message) {
111
- const booleanCondition = Boolean(condition);
112
- if (!booleanCondition) {
113
- throw new Error(message);
114
- }
115
- }
116
-
117
- // ../../node_modules/graphql/jsutils/inspect.mjs
118
- var MAX_ARRAY_LENGTH = 10;
119
- var MAX_RECURSIVE_DEPTH = 2;
120
- function inspect(value) {
121
- return formatValue(value, []);
122
- }
123
- function formatValue(value, seenValues) {
124
- switch (typeof value) {
125
- case "string":
126
- return JSON.stringify(value);
127
- case "function":
128
- return value.name ? `[function ${value.name}]` : "[function]";
129
- case "object":
130
- return formatObjectValue(value, seenValues);
131
- default:
132
- return String(value);
133
- }
134
- }
135
- function formatObjectValue(value, previouslySeenValues) {
136
- if (value === null) {
137
- return "null";
138
- }
139
- if (previouslySeenValues.includes(value)) {
140
- return "[Circular]";
141
- }
142
- const seenValues = [...previouslySeenValues, value];
143
- if (isJSONable(value)) {
144
- const jsonValue = value.toJSON();
145
- if (jsonValue !== value) {
146
- return typeof jsonValue === "string" ? jsonValue : formatValue(jsonValue, seenValues);
147
- }
148
- } else if (Array.isArray(value)) {
149
- return formatArray(value, seenValues);
150
- }
151
- return formatObject(value, seenValues);
152
- }
153
- function isJSONable(value) {
154
- return typeof value.toJSON === "function";
155
- }
156
- function formatObject(object, seenValues) {
157
- const entries = Object.entries(object);
158
- if (entries.length === 0) {
159
- return "{}";
160
- }
161
- if (seenValues.length > MAX_RECURSIVE_DEPTH) {
162
- return "[" + getObjectTag(object) + "]";
163
- }
164
- const properties = entries.map(([key, value]) => key + ": " + formatValue(value, seenValues));
165
- return "{ " + properties.join(", ") + " }";
166
- }
167
- function formatArray(array, seenValues) {
168
- if (array.length === 0) {
169
- return "[]";
170
- }
171
- if (seenValues.length > MAX_RECURSIVE_DEPTH) {
172
- return "[Array]";
173
- }
174
- const len = Math.min(MAX_ARRAY_LENGTH, array.length);
175
- const remaining = array.length - len;
176
- const items = [];
177
- for (let i = 0;i < len; ++i) {
178
- items.push(formatValue(array[i], seenValues));
179
- }
180
- if (remaining === 1) {
181
- items.push("... 1 more item");
182
- } else if (remaining > 1) {
183
- items.push(`... ${remaining} more items`);
184
- }
185
- return "[" + items.join(", ") + "]";
186
- }
187
- function getObjectTag(object) {
188
- const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
189
- if (tag === "Object" && typeof object.constructor === "function") {
190
- const name = object.constructor.name;
191
- if (typeof name === "string" && name !== "") {
192
- return name;
193
- }
194
- }
195
- return tag;
196
- }
197
-
198
- // ../../node_modules/graphql/jsutils/instanceOf.mjs
199
- var isProduction = globalThis.process && false;
200
- var instanceOf = isProduction ? function instanceOf(value, constructor) {
201
- return value instanceof constructor;
202
- } : function instanceOf(value, constructor) {
203
- if (value instanceof constructor) {
204
- return true;
205
- }
206
- if (typeof value === "object" && value !== null) {
207
- var _value$constructor;
208
- const className = constructor.prototype[Symbol.toStringTag];
209
- const valueClassName = Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === undefined ? undefined : _value$constructor.name;
210
- if (className === valueClassName) {
211
- const stringifiedValue = inspect(value);
212
- throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm.
213
-
214
- Ensure that there is only one instance of "graphql" in the node_modules
215
- directory. If different versions of "graphql" are the dependencies of other
216
- relied on modules, use "resolutions" to ensure only one version is installed.
217
-
218
- https://yarnpkg.com/en/docs/selective-version-resolutions
219
-
220
- Duplicate "graphql" modules cannot be used at the same time since different
221
- versions may have different capabilities and behavior. The data from one
222
- version used in the function from another could produce confusing and
223
- spurious results.`);
224
- }
225
- }
226
- return false;
227
- };
228
-
229
- // ../../node_modules/graphql/jsutils/isObjectLike.mjs
230
- function isObjectLike(value) {
231
- return typeof value == "object" && value !== null;
232
- }
233
-
234
- // ../../node_modules/graphql/jsutils/toObjMap.mjs
235
- function toObjMap(obj) {
236
- if (obj == null) {
237
- return Object.create(null);
238
- }
239
- if (Object.getPrototypeOf(obj) === null) {
240
- return obj;
241
- }
242
- const map = Object.create(null);
243
- for (const [key, value] of Object.entries(obj)) {
244
- map[key] = value;
245
- }
246
- return map;
247
- }
248
-
249
- // ../../node_modules/graphql/language/ast.mjs
250
- var QueryDocumentKeys = {
251
- Name: [],
252
- Document: ["definitions"],
253
- OperationDefinition: [
254
- "description",
255
- "name",
256
- "variableDefinitions",
257
- "directives",
258
- "selectionSet"
259
- ],
260
- VariableDefinition: [
261
- "description",
262
- "variable",
263
- "type",
264
- "defaultValue",
265
- "directives"
266
- ],
267
- Variable: ["name"],
268
- SelectionSet: ["selections"],
269
- Field: ["alias", "name", "arguments", "directives", "selectionSet"],
270
- Argument: ["name", "value"],
271
- FragmentSpread: ["name", "directives"],
272
- InlineFragment: ["typeCondition", "directives", "selectionSet"],
273
- FragmentDefinition: [
274
- "description",
275
- "name",
276
- "variableDefinitions",
277
- "typeCondition",
278
- "directives",
279
- "selectionSet"
280
- ],
281
- IntValue: [],
282
- FloatValue: [],
283
- StringValue: [],
284
- BooleanValue: [],
285
- NullValue: [],
286
- EnumValue: [],
287
- ListValue: ["values"],
288
- ObjectValue: ["fields"],
289
- ObjectField: ["name", "value"],
290
- Directive: ["name", "arguments"],
291
- NamedType: ["name"],
292
- ListType: ["type"],
293
- NonNullType: ["type"],
294
- SchemaDefinition: ["description", "directives", "operationTypes"],
295
- OperationTypeDefinition: ["type"],
296
- ScalarTypeDefinition: ["description", "name", "directives"],
297
- ObjectTypeDefinition: [
298
- "description",
299
- "name",
300
- "interfaces",
301
- "directives",
302
- "fields"
303
- ],
304
- FieldDefinition: ["description", "name", "arguments", "type", "directives"],
305
- InputValueDefinition: [
306
- "description",
307
- "name",
308
- "type",
309
- "defaultValue",
310
- "directives"
311
- ],
312
- InterfaceTypeDefinition: [
313
- "description",
314
- "name",
315
- "interfaces",
316
- "directives",
317
- "fields"
318
- ],
319
- UnionTypeDefinition: ["description", "name", "directives", "types"],
320
- EnumTypeDefinition: ["description", "name", "directives", "values"],
321
- EnumValueDefinition: ["description", "name", "directives"],
322
- InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
323
- DirectiveDefinition: ["description", "name", "arguments", "locations"],
324
- SchemaExtension: ["directives", "operationTypes"],
325
- ScalarTypeExtension: ["name", "directives"],
326
- ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
327
- InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
328
- UnionTypeExtension: ["name", "directives", "types"],
329
- EnumTypeExtension: ["name", "directives", "values"],
330
- InputObjectTypeExtension: ["name", "directives", "fields"],
331
- TypeCoordinate: ["name"],
332
- MemberCoordinate: ["name", "memberName"],
333
- ArgumentCoordinate: ["name", "fieldName", "argumentName"],
334
- DirectiveCoordinate: ["name"],
335
- DirectiveArgumentCoordinate: ["name", "argumentName"]
336
- };
337
- var kindValues = new Set(Object.keys(QueryDocumentKeys));
338
- function isNode(maybeNode) {
339
- const maybeKind = maybeNode === null || maybeNode === undefined ? undefined : maybeNode.kind;
340
- return typeof maybeKind === "string" && kindValues.has(maybeKind);
341
- }
342
- var OperationTypeNode;
343
- (function(OperationTypeNode) {
344
- OperationTypeNode["QUERY"] = "query";
345
- OperationTypeNode["MUTATION"] = "mutation";
346
- OperationTypeNode["SUBSCRIPTION"] = "subscription";
347
- })(OperationTypeNode || (OperationTypeNode = {}));
348
-
349
- // ../../node_modules/graphql/jsutils/didYouMean.mjs
350
- var MAX_SUGGESTIONS = 5;
351
- function didYouMean(firstArg, secondArg) {
352
- const [subMessage, suggestionsArg] = secondArg ? [firstArg, secondArg] : [undefined, firstArg];
353
- let message = " Did you mean ";
354
- if (subMessage) {
355
- message += subMessage + " ";
356
- }
357
- const suggestions = suggestionsArg.map((x) => `"${x}"`);
358
- switch (suggestions.length) {
359
- case 0:
360
- return "";
361
- case 1:
362
- return message + suggestions[0] + "?";
363
- case 2:
364
- return message + suggestions[0] + " or " + suggestions[1] + "?";
365
- }
366
- const selected = suggestions.slice(0, MAX_SUGGESTIONS);
367
- const lastItem = selected.pop();
368
- return message + selected.join(", ") + ", or " + lastItem + "?";
369
- }
370
-
371
- // ../../node_modules/graphql/jsutils/identityFunc.mjs
372
- function identityFunc(x) {
373
- return x;
374
- }
375
-
376
- // ../../node_modules/graphql/jsutils/keyMap.mjs
377
- function keyMap(list, keyFn) {
378
- const result = Object.create(null);
379
- for (const item of list) {
380
- result[keyFn(item)] = item;
381
- }
382
- return result;
383
- }
384
-
385
- // ../../node_modules/graphql/jsutils/keyValMap.mjs
386
- function keyValMap(list, keyFn, valFn) {
387
- const result = Object.create(null);
388
- for (const item of list) {
389
- result[keyFn(item)] = valFn(item);
390
- }
391
- return result;
392
- }
393
-
394
- // ../../node_modules/graphql/jsutils/mapValue.mjs
395
- function mapValue(map, fn) {
396
- const result = Object.create(null);
397
- for (const key of Object.keys(map)) {
398
- result[key] = fn(map[key], key);
399
- }
400
- return result;
401
- }
402
-
403
- // ../../node_modules/graphql/jsutils/naturalCompare.mjs
404
- function naturalCompare(aStr, bStr) {
405
- let aIndex = 0;
406
- let bIndex = 0;
407
- while (aIndex < aStr.length && bIndex < bStr.length) {
408
- let aChar = aStr.charCodeAt(aIndex);
409
- let bChar = bStr.charCodeAt(bIndex);
410
- if (isDigit(aChar) && isDigit(bChar)) {
411
- let aNum = 0;
412
- do {
413
- ++aIndex;
414
- aNum = aNum * 10 + aChar - DIGIT_0;
415
- aChar = aStr.charCodeAt(aIndex);
416
- } while (isDigit(aChar) && aNum > 0);
417
- let bNum = 0;
418
- do {
419
- ++bIndex;
420
- bNum = bNum * 10 + bChar - DIGIT_0;
421
- bChar = bStr.charCodeAt(bIndex);
422
- } while (isDigit(bChar) && bNum > 0);
423
- if (aNum < bNum) {
424
- return -1;
425
- }
426
- if (aNum > bNum) {
427
- return 1;
428
- }
429
- } else {
430
- if (aChar < bChar) {
431
- return -1;
432
- }
433
- if (aChar > bChar) {
434
- return 1;
435
- }
436
- ++aIndex;
437
- ++bIndex;
438
- }
439
- }
440
- return aStr.length - bStr.length;
441
- }
442
- var DIGIT_0 = 48;
443
- var DIGIT_9 = 57;
444
- function isDigit(code) {
445
- return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
446
- }
447
-
448
- // ../../node_modules/graphql/jsutils/suggestionList.mjs
449
- function suggestionList(input, options) {
450
- const optionsByDistance = Object.create(null);
451
- const lexicalDistance = new LexicalDistance(input);
452
- const threshold = Math.floor(input.length * 0.4) + 1;
453
- for (const option of options) {
454
- const distance = lexicalDistance.measure(option, threshold);
455
- if (distance !== undefined) {
456
- optionsByDistance[option] = distance;
457
- }
458
- }
459
- return Object.keys(optionsByDistance).sort((a, b) => {
460
- const distanceDiff = optionsByDistance[a] - optionsByDistance[b];
461
- return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b);
462
- });
463
- }
464
-
465
- class LexicalDistance {
466
- constructor(input) {
467
- this._input = input;
468
- this._inputLowerCase = input.toLowerCase();
469
- this._inputArray = stringToArray(this._inputLowerCase);
470
- this._rows = [
471
- new Array(input.length + 1).fill(0),
472
- new Array(input.length + 1).fill(0),
473
- new Array(input.length + 1).fill(0)
474
- ];
475
- }
476
- measure(option, threshold) {
477
- if (this._input === option) {
478
- return 0;
479
- }
480
- const optionLowerCase = option.toLowerCase();
481
- if (this._inputLowerCase === optionLowerCase) {
482
- return 1;
483
- }
484
- let a = stringToArray(optionLowerCase);
485
- let b = this._inputArray;
486
- if (a.length < b.length) {
487
- const tmp = a;
488
- a = b;
489
- b = tmp;
490
- }
491
- const aLength = a.length;
492
- const bLength = b.length;
493
- if (aLength - bLength > threshold) {
494
- return;
495
- }
496
- const rows = this._rows;
497
- for (let j = 0;j <= bLength; j++) {
498
- rows[0][j] = j;
499
- }
500
- for (let i = 1;i <= aLength; i++) {
501
- const upRow = rows[(i - 1) % 3];
502
- const currentRow = rows[i % 3];
503
- let smallestCell = currentRow[0] = i;
504
- for (let j = 1;j <= bLength; j++) {
505
- const cost = a[i - 1] === b[j - 1] ? 0 : 1;
506
- let currentCell = Math.min(upRow[j] + 1, currentRow[j - 1] + 1, upRow[j - 1] + cost);
507
- if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
508
- const doubleDiagonalCell = rows[(i - 2) % 3][j - 2];
509
- currentCell = Math.min(currentCell, doubleDiagonalCell + 1);
510
- }
511
- if (currentCell < smallestCell) {
512
- smallestCell = currentCell;
513
- }
514
- currentRow[j] = currentCell;
515
- }
516
- if (smallestCell > threshold) {
517
- return;
518
- }
519
- }
520
- const distance = rows[aLength % 3][bLength];
521
- return distance <= threshold ? distance : undefined;
522
- }
523
- }
524
- function stringToArray(str) {
525
- const strLength = str.length;
526
- const array = new Array(strLength);
527
- for (let i = 0;i < strLength; ++i) {
528
- array[i] = str.charCodeAt(i);
529
- }
530
- return array;
531
- }
532
-
533
- // ../../node_modules/graphql/jsutils/invariant.mjs
534
- function invariant(condition, message) {
535
- const booleanCondition = Boolean(condition);
536
- if (!booleanCondition) {
537
- throw new Error(message != null ? message : "Unexpected invariant triggered.");
538
- }
539
- }
540
-
541
- // ../../node_modules/graphql/language/location.mjs
542
- var LineRegExp = /\r\n|[\n\r]/g;
543
- function getLocation(source, position) {
544
- let lastLineStart = 0;
545
- let line = 1;
546
- for (const match of source.body.matchAll(LineRegExp)) {
547
- typeof match.index === "number" || invariant(false);
548
- if (match.index >= position) {
549
- break;
550
- }
551
- lastLineStart = match.index + match[0].length;
552
- line += 1;
553
- }
554
- return {
555
- line,
556
- column: position + 1 - lastLineStart
557
- };
558
- }
559
-
560
- // ../../node_modules/graphql/language/printLocation.mjs
561
- function printLocation(location) {
562
- return printSourceLocation(location.source, getLocation(location.source, location.start));
563
- }
564
- function printSourceLocation(source, sourceLocation) {
565
- const firstLineColumnOffset = source.locationOffset.column - 1;
566
- const body = "".padStart(firstLineColumnOffset) + source.body;
567
- const lineIndex = sourceLocation.line - 1;
568
- const lineOffset = source.locationOffset.line - 1;
569
- const lineNum = sourceLocation.line + lineOffset;
570
- const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
571
- const columnNum = sourceLocation.column + columnOffset;
572
- const locationStr = `${source.name}:${lineNum}:${columnNum}
573
- `;
574
- const lines = body.split(/\r\n|[\n\r]/g);
575
- const locationLine = lines[lineIndex];
576
- if (locationLine.length > 120) {
577
- const subLineIndex = Math.floor(columnNum / 80);
578
- const subLineColumnNum = columnNum % 80;
579
- const subLines = [];
580
- for (let i = 0;i < locationLine.length; i += 80) {
581
- subLines.push(locationLine.slice(i, i + 80));
582
- }
583
- return locationStr + printPrefixedLines([
584
- [`${lineNum} |`, subLines[0]],
585
- ...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]),
586
- ["|", "^".padStart(subLineColumnNum)],
587
- ["|", subLines[subLineIndex + 1]]
588
- ]);
589
- }
590
- return locationStr + printPrefixedLines([
591
- [`${lineNum - 1} |`, lines[lineIndex - 1]],
592
- [`${lineNum} |`, locationLine],
593
- ["|", "^".padStart(columnNum)],
594
- [`${lineNum + 1} |`, lines[lineIndex + 1]]
595
- ]);
596
- }
597
- function printPrefixedLines(lines) {
598
- const existingLines = lines.filter(([_, line]) => line !== undefined);
599
- const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
600
- return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join(`
601
- `);
602
- }
603
-
604
- // ../../node_modules/graphql/error/GraphQLError.mjs
605
- function toNormalizedOptions(args) {
606
- const firstArg = args[0];
607
- if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
608
- return {
609
- nodes: firstArg,
610
- source: args[1],
611
- positions: args[2],
612
- path: args[3],
613
- originalError: args[4],
614
- extensions: args[5]
615
- };
616
- }
617
- return firstArg;
618
- }
619
-
620
- class GraphQLError extends Error {
621
- constructor(message, ...rawArgs) {
622
- var _this$nodes, _nodeLocations$, _ref;
623
- const { nodes, source, positions, path, originalError, extensions } = toNormalizedOptions(rawArgs);
624
- super(message);
625
- this.name = "GraphQLError";
626
- this.path = path !== null && path !== undefined ? path : undefined;
627
- this.originalError = originalError !== null && originalError !== undefined ? originalError : undefined;
628
- this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);
629
- const nodeLocations = undefinedIfEmpty((_this$nodes = this.nodes) === null || _this$nodes === undefined ? undefined : _this$nodes.map((node) => node.loc).filter((loc) => loc != null));
630
- this.source = source !== null && source !== undefined ? source : nodeLocations === null || nodeLocations === undefined ? undefined : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === undefined ? undefined : _nodeLocations$.source;
631
- this.positions = positions !== null && positions !== undefined ? positions : nodeLocations === null || nodeLocations === undefined ? undefined : nodeLocations.map((loc) => loc.start);
632
- this.locations = positions && source ? positions.map((pos) => getLocation(source, pos)) : nodeLocations === null || nodeLocations === undefined ? undefined : nodeLocations.map((loc) => getLocation(loc.source, loc.start));
633
- const originalExtensions = isObjectLike(originalError === null || originalError === undefined ? undefined : originalError.extensions) ? originalError === null || originalError === undefined ? undefined : originalError.extensions : undefined;
634
- this.extensions = (_ref = extensions !== null && extensions !== undefined ? extensions : originalExtensions) !== null && _ref !== undefined ? _ref : Object.create(null);
635
- Object.defineProperties(this, {
636
- message: {
637
- writable: true,
638
- enumerable: true
639
- },
640
- name: {
641
- enumerable: false
642
- },
643
- nodes: {
644
- enumerable: false
645
- },
646
- source: {
647
- enumerable: false
648
- },
649
- positions: {
650
- enumerable: false
651
- },
652
- originalError: {
653
- enumerable: false
654
- }
655
- });
656
- if (originalError !== null && originalError !== undefined && originalError.stack) {
657
- Object.defineProperty(this, "stack", {
658
- value: originalError.stack,
659
- writable: true,
660
- configurable: true
661
- });
662
- } else if (Error.captureStackTrace) {
663
- Error.captureStackTrace(this, GraphQLError);
664
- } else {
665
- Object.defineProperty(this, "stack", {
666
- value: Error().stack,
667
- writable: true,
668
- configurable: true
669
- });
670
- }
671
- }
672
- get [Symbol.toStringTag]() {
673
- return "GraphQLError";
674
- }
675
- toString() {
676
- let output = this.message;
677
- if (this.nodes) {
678
- for (const node of this.nodes) {
679
- if (node.loc) {
680
- output += `
681
-
682
- ` + printLocation(node.loc);
683
- }
684
- }
685
- } else if (this.source && this.locations) {
686
- for (const location of this.locations) {
687
- output += `
688
-
689
- ` + printSourceLocation(this.source, location);
690
- }
691
- }
692
- return output;
693
- }
694
- toJSON() {
695
- const formattedError = {
696
- message: this.message
697
- };
698
- if (this.locations != null) {
699
- formattedError.locations = this.locations;
700
- }
701
- if (this.path != null) {
702
- formattedError.path = this.path;
703
- }
704
- if (this.extensions != null && Object.keys(this.extensions).length > 0) {
705
- formattedError.extensions = this.extensions;
706
- }
707
- return formattedError;
708
- }
709
- }
710
- function undefinedIfEmpty(array) {
711
- return array === undefined || array.length === 0 ? undefined : array;
712
- }
713
-
714
- // ../../node_modules/graphql/language/kinds.mjs
715
- var Kind;
716
- (function(Kind) {
717
- Kind["NAME"] = "Name";
718
- Kind["DOCUMENT"] = "Document";
719
- Kind["OPERATION_DEFINITION"] = "OperationDefinition";
720
- Kind["VARIABLE_DEFINITION"] = "VariableDefinition";
721
- Kind["SELECTION_SET"] = "SelectionSet";
722
- Kind["FIELD"] = "Field";
723
- Kind["ARGUMENT"] = "Argument";
724
- Kind["FRAGMENT_SPREAD"] = "FragmentSpread";
725
- Kind["INLINE_FRAGMENT"] = "InlineFragment";
726
- Kind["FRAGMENT_DEFINITION"] = "FragmentDefinition";
727
- Kind["VARIABLE"] = "Variable";
728
- Kind["INT"] = "IntValue";
729
- Kind["FLOAT"] = "FloatValue";
730
- Kind["STRING"] = "StringValue";
731
- Kind["BOOLEAN"] = "BooleanValue";
732
- Kind["NULL"] = "NullValue";
733
- Kind["ENUM"] = "EnumValue";
734
- Kind["LIST"] = "ListValue";
735
- Kind["OBJECT"] = "ObjectValue";
736
- Kind["OBJECT_FIELD"] = "ObjectField";
737
- Kind["DIRECTIVE"] = "Directive";
738
- Kind["NAMED_TYPE"] = "NamedType";
739
- Kind["LIST_TYPE"] = "ListType";
740
- Kind["NON_NULL_TYPE"] = "NonNullType";
741
- Kind["SCHEMA_DEFINITION"] = "SchemaDefinition";
742
- Kind["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
743
- Kind["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
744
- Kind["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
745
- Kind["FIELD_DEFINITION"] = "FieldDefinition";
746
- Kind["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
747
- Kind["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
748
- Kind["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
749
- Kind["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
750
- Kind["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
751
- Kind["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
752
- Kind["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
753
- Kind["SCHEMA_EXTENSION"] = "SchemaExtension";
754
- Kind["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
755
- Kind["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
756
- Kind["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
757
- Kind["UNION_TYPE_EXTENSION"] = "UnionTypeExtension";
758
- Kind["ENUM_TYPE_EXTENSION"] = "EnumTypeExtension";
759
- Kind["INPUT_OBJECT_TYPE_EXTENSION"] = "InputObjectTypeExtension";
760
- Kind["TYPE_COORDINATE"] = "TypeCoordinate";
761
- Kind["MEMBER_COORDINATE"] = "MemberCoordinate";
762
- Kind["ARGUMENT_COORDINATE"] = "ArgumentCoordinate";
763
- Kind["DIRECTIVE_COORDINATE"] = "DirectiveCoordinate";
764
- Kind["DIRECTIVE_ARGUMENT_COORDINATE"] = "DirectiveArgumentCoordinate";
765
- })(Kind || (Kind = {}));
766
-
767
- // ../../node_modules/graphql/language/characterClasses.mjs
768
- function isWhiteSpace(code) {
769
- return code === 9 || code === 32;
770
- }
771
- function isDigit2(code) {
772
- return code >= 48 && code <= 57;
773
- }
774
- function isLetter(code) {
775
- return code >= 97 && code <= 122 || code >= 65 && code <= 90;
776
- }
777
- function isNameStart(code) {
778
- return isLetter(code) || code === 95;
779
- }
780
- function isNameContinue(code) {
781
- return isLetter(code) || isDigit2(code) || code === 95;
782
- }
783
-
784
- // ../../node_modules/graphql/language/blockString.mjs
785
- function isPrintableAsBlockString(value) {
786
- if (value === "") {
787
- return true;
788
- }
789
- let isEmptyLine = true;
790
- let hasIndent = false;
791
- let hasCommonIndent = true;
792
- let seenNonEmptyLine = false;
793
- for (let i = 0;i < value.length; ++i) {
794
- switch (value.codePointAt(i)) {
795
- case 0:
796
- case 1:
797
- case 2:
798
- case 3:
799
- case 4:
800
- case 5:
801
- case 6:
802
- case 7:
803
- case 8:
804
- case 11:
805
- case 12:
806
- case 14:
807
- case 15:
808
- return false;
809
- case 13:
810
- return false;
811
- case 10:
812
- if (isEmptyLine && !seenNonEmptyLine) {
813
- return false;
814
- }
815
- seenNonEmptyLine = true;
816
- isEmptyLine = true;
817
- hasIndent = false;
818
- break;
819
- case 9:
820
- case 32:
821
- hasIndent || (hasIndent = isEmptyLine);
822
- break;
823
- default:
824
- hasCommonIndent && (hasCommonIndent = hasIndent);
825
- isEmptyLine = false;
826
- }
827
- }
828
- if (isEmptyLine) {
829
- return false;
830
- }
831
- if (hasCommonIndent && seenNonEmptyLine) {
832
- return false;
833
- }
834
- return true;
835
- }
836
- function printBlockString(value, options) {
837
- const escapedValue = value.replace(/"""/g, '\\"""');
838
- const lines = escapedValue.split(/\r\n|[\n\r]/g);
839
- const isSingleLine = lines.length === 1;
840
- const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0)));
841
- const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""');
842
- const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes;
843
- const hasTrailingSlash = value.endsWith("\\");
844
- const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;
845
- const printAsMultipleLines = !(options !== null && options !== undefined && options.minimize) && (!isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes);
846
- let result = "";
847
- const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));
848
- if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) {
849
- result += `
850
- `;
851
- }
852
- result += escapedValue;
853
- if (printAsMultipleLines || forceTrailingNewline) {
854
- result += `
855
- `;
856
- }
857
- return '"""' + result + '"""';
858
- }
859
-
860
- // ../../node_modules/graphql/language/printString.mjs
861
- function printString(str) {
862
- return `"${str.replace(escapedRegExp, escapedReplacer)}"`;
863
- }
864
- var escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
865
- function escapedReplacer(str) {
866
- return escapeSequences[str.charCodeAt(0)];
867
- }
868
- var escapeSequences = [
869
- "\\u0000",
870
- "\\u0001",
871
- "\\u0002",
872
- "\\u0003",
873
- "\\u0004",
874
- "\\u0005",
875
- "\\u0006",
876
- "\\u0007",
877
- "\\b",
878
- "\\t",
879
- "\\n",
880
- "\\u000B",
881
- "\\f",
882
- "\\r",
883
- "\\u000E",
884
- "\\u000F",
885
- "\\u0010",
886
- "\\u0011",
887
- "\\u0012",
888
- "\\u0013",
889
- "\\u0014",
890
- "\\u0015",
891
- "\\u0016",
892
- "\\u0017",
893
- "\\u0018",
894
- "\\u0019",
895
- "\\u001A",
896
- "\\u001B",
897
- "\\u001C",
898
- "\\u001D",
899
- "\\u001E",
900
- "\\u001F",
901
- "",
902
- "",
903
- "\\\"",
904
- "",
905
- "",
906
- "",
907
- "",
908
- "",
909
- "",
910
- "",
911
- "",
912
- "",
913
- "",
914
- "",
915
- "",
916
- "",
917
- "",
918
- "",
919
- "",
920
- "",
921
- "",
922
- "",
923
- "",
924
- "",
925
- "",
926
- "",
927
- "",
928
- "",
929
- "",
930
- "",
931
- "",
932
- "",
933
- "",
934
- "",
935
- "",
936
- "",
937
- "",
938
- "",
939
- "",
940
- "",
941
- "",
942
- "",
943
- "",
944
- "",
945
- "",
946
- "",
947
- "",
948
- "",
949
- "",
950
- "",
951
- "",
952
- "",
953
- "",
954
- "",
955
- "",
956
- "",
957
- "",
958
- "",
959
- "",
960
- "",
961
- "\\\\",
962
- "",
963
- "",
964
- "",
965
- "",
966
- "",
967
- "",
968
- "",
969
- "",
970
- "",
971
- "",
972
- "",
973
- "",
974
- "",
975
- "",
976
- "",
977
- "",
978
- "",
979
- "",
980
- "",
981
- "",
982
- "",
983
- "",
984
- "",
985
- "",
986
- "",
987
- "",
988
- "",
989
- "",
990
- "",
991
- "",
992
- "",
993
- "",
994
- "",
995
- "",
996
- "\\u007F",
997
- "\\u0080",
998
- "\\u0081",
999
- "\\u0082",
1000
- "\\u0083",
1001
- "\\u0084",
1002
- "\\u0085",
1003
- "\\u0086",
1004
- "\\u0087",
1005
- "\\u0088",
1006
- "\\u0089",
1007
- "\\u008A",
1008
- "\\u008B",
1009
- "\\u008C",
1010
- "\\u008D",
1011
- "\\u008E",
1012
- "\\u008F",
1013
- "\\u0090",
1014
- "\\u0091",
1015
- "\\u0092",
1016
- "\\u0093",
1017
- "\\u0094",
1018
- "\\u0095",
1019
- "\\u0096",
1020
- "\\u0097",
1021
- "\\u0098",
1022
- "\\u0099",
1023
- "\\u009A",
1024
- "\\u009B",
1025
- "\\u009C",
1026
- "\\u009D",
1027
- "\\u009E",
1028
- "\\u009F"
1029
- ];
1030
-
1031
- // ../../node_modules/graphql/language/visitor.mjs
1032
- var BREAK = Object.freeze({});
1033
- function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
1034
- const enterLeaveMap = new Map;
1035
- for (const kind of Object.values(Kind)) {
1036
- enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
1037
- }
1038
- let stack = undefined;
1039
- let inArray = Array.isArray(root);
1040
- let keys = [root];
1041
- let index = -1;
1042
- let edits = [];
1043
- let node = root;
1044
- let key = undefined;
1045
- let parent = undefined;
1046
- const path = [];
1047
- const ancestors = [];
1048
- do {
1049
- index++;
1050
- const isLeaving = index === keys.length;
1051
- const isEdited = isLeaving && edits.length !== 0;
1052
- if (isLeaving) {
1053
- key = ancestors.length === 0 ? undefined : path[path.length - 1];
1054
- node = parent;
1055
- parent = ancestors.pop();
1056
- if (isEdited) {
1057
- if (inArray) {
1058
- node = node.slice();
1059
- let editOffset = 0;
1060
- for (const [editKey, editValue] of edits) {
1061
- const arrayKey = editKey - editOffset;
1062
- if (editValue === null) {
1063
- node.splice(arrayKey, 1);
1064
- editOffset++;
1065
- } else {
1066
- node[arrayKey] = editValue;
1067
- }
1068
- }
1069
- } else {
1070
- node = { ...node };
1071
- for (const [editKey, editValue] of edits) {
1072
- node[editKey] = editValue;
1073
- }
1074
- }
1075
- }
1076
- index = stack.index;
1077
- keys = stack.keys;
1078
- edits = stack.edits;
1079
- inArray = stack.inArray;
1080
- stack = stack.prev;
1081
- } else if (parent) {
1082
- key = inArray ? index : keys[index];
1083
- node = parent[key];
1084
- if (node === null || node === undefined) {
1085
- continue;
1086
- }
1087
- path.push(key);
1088
- }
1089
- let result;
1090
- if (!Array.isArray(node)) {
1091
- var _enterLeaveMap$get, _enterLeaveMap$get2;
1092
- isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);
1093
- const visitFn = isLeaving ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get === undefined ? undefined : _enterLeaveMap$get.leave : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || _enterLeaveMap$get2 === undefined ? undefined : _enterLeaveMap$get2.enter;
1094
- result = visitFn === null || visitFn === undefined ? undefined : visitFn.call(visitor, node, key, parent, path, ancestors);
1095
- if (result === BREAK) {
1096
- break;
1097
- }
1098
- if (result === false) {
1099
- if (!isLeaving) {
1100
- path.pop();
1101
- continue;
1102
- }
1103
- } else if (result !== undefined) {
1104
- edits.push([key, result]);
1105
- if (!isLeaving) {
1106
- if (isNode(result)) {
1107
- node = result;
1108
- } else {
1109
- path.pop();
1110
- continue;
1111
- }
1112
- }
1113
- }
1114
- }
1115
- if (result === undefined && isEdited) {
1116
- edits.push([key, node]);
1117
- }
1118
- if (isLeaving) {
1119
- path.pop();
1120
- } else {
1121
- var _node$kind;
1122
- stack = {
1123
- inArray,
1124
- index,
1125
- keys,
1126
- edits,
1127
- prev: stack
1128
- };
1129
- inArray = Array.isArray(node);
1130
- keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== undefined ? _node$kind : [];
1131
- index = -1;
1132
- edits = [];
1133
- if (parent) {
1134
- ancestors.push(parent);
1135
- }
1136
- parent = node;
1137
- }
1138
- } while (stack !== undefined);
1139
- if (edits.length !== 0) {
1140
- return edits[edits.length - 1][1];
1141
- }
1142
- return root;
1143
- }
1144
- function getEnterLeaveForKind(visitor, kind) {
1145
- const kindVisitor = visitor[kind];
1146
- if (typeof kindVisitor === "object") {
1147
- return kindVisitor;
1148
- } else if (typeof kindVisitor === "function") {
1149
- return {
1150
- enter: kindVisitor,
1151
- leave: undefined
1152
- };
1153
- }
1154
- return {
1155
- enter: visitor.enter,
1156
- leave: visitor.leave
1157
- };
1158
- }
1159
-
1160
- // ../../node_modules/graphql/language/printer.mjs
1161
- function print(ast) {
1162
- return visit(ast, printDocASTReducer);
1163
- }
1164
- var MAX_LINE_LENGTH = 80;
1165
- var printDocASTReducer = {
1166
- Name: {
1167
- leave: (node) => node.value
1168
- },
1169
- Variable: {
1170
- leave: (node) => "$" + node.name
1171
- },
1172
- Document: {
1173
- leave: (node) => join(node.definitions, `
1174
-
1175
- `)
1176
- },
1177
- OperationDefinition: {
1178
- leave(node) {
1179
- const varDefs = hasMultilineItems(node.variableDefinitions) ? wrap(`(
1180
- `, join(node.variableDefinitions, `
1181
- `), `
1182
- )`) : wrap("(", join(node.variableDefinitions, ", "), ")");
1183
- const prefix = wrap("", node.description, `
1184
- `) + join([
1185
- node.operation,
1186
- join([node.name, varDefs]),
1187
- join(node.directives, " ")
1188
- ], " ");
1189
- return (prefix === "query" ? "" : prefix + " ") + node.selectionSet;
1190
- }
1191
- },
1192
- VariableDefinition: {
1193
- leave: ({ variable, type, defaultValue, directives, description }) => wrap("", description, `
1194
- `) + variable + ": " + type + wrap(" = ", defaultValue) + wrap(" ", join(directives, " "))
1195
- },
1196
- SelectionSet: {
1197
- leave: ({ selections }) => block(selections)
1198
- },
1199
- Field: {
1200
- leave({ alias, name, arguments: args, directives, selectionSet }) {
1201
- const prefix = wrap("", alias, ": ") + name;
1202
- let argsLine = prefix + wrap("(", join(args, ", "), ")");
1203
- if (argsLine.length > MAX_LINE_LENGTH) {
1204
- argsLine = prefix + wrap(`(
1205
- `, indent(join(args, `
1206
- `)), `
1207
- )`);
1208
- }
1209
- return join([argsLine, join(directives, " "), selectionSet], " ");
1210
- }
1211
- },
1212
- Argument: {
1213
- leave: ({ name, value }) => name + ": " + value
1214
- },
1215
- FragmentSpread: {
1216
- leave: ({ name, directives }) => "..." + name + wrap(" ", join(directives, " "))
1217
- },
1218
- InlineFragment: {
1219
- leave: ({ typeCondition, directives, selectionSet }) => join([
1220
- "...",
1221
- wrap("on ", typeCondition),
1222
- join(directives, " "),
1223
- selectionSet
1224
- ], " ")
1225
- },
1226
- FragmentDefinition: {
1227
- leave: ({
1228
- name,
1229
- typeCondition,
1230
- variableDefinitions,
1231
- directives,
1232
- selectionSet,
1233
- description
1234
- }) => wrap("", description, `
1235
- `) + `fragment ${name}${wrap("(", join(variableDefinitions, ", "), ")")} ` + `on ${typeCondition} ${wrap("", join(directives, " "), " ")}` + selectionSet
1236
- },
1237
- IntValue: {
1238
- leave: ({ value }) => value
1239
- },
1240
- FloatValue: {
1241
- leave: ({ value }) => value
1242
- },
1243
- StringValue: {
1244
- leave: ({ value, block: isBlockString }) => isBlockString ? printBlockString(value) : printString(value)
1245
- },
1246
- BooleanValue: {
1247
- leave: ({ value }) => value ? "true" : "false"
1248
- },
1249
- NullValue: {
1250
- leave: () => "null"
1251
- },
1252
- EnumValue: {
1253
- leave: ({ value }) => value
1254
- },
1255
- ListValue: {
1256
- leave: ({ values }) => "[" + join(values, ", ") + "]"
1257
- },
1258
- ObjectValue: {
1259
- leave: ({ fields }) => "{" + join(fields, ", ") + "}"
1260
- },
1261
- ObjectField: {
1262
- leave: ({ name, value }) => name + ": " + value
1263
- },
1264
- Directive: {
1265
- leave: ({ name, arguments: args }) => "@" + name + wrap("(", join(args, ", "), ")")
1266
- },
1267
- NamedType: {
1268
- leave: ({ name }) => name
1269
- },
1270
- ListType: {
1271
- leave: ({ type }) => "[" + type + "]"
1272
- },
1273
- NonNullType: {
1274
- leave: ({ type }) => type + "!"
1275
- },
1276
- SchemaDefinition: {
1277
- leave: ({ description, directives, operationTypes }) => wrap("", description, `
1278
- `) + join(["schema", join(directives, " "), block(operationTypes)], " ")
1279
- },
1280
- OperationTypeDefinition: {
1281
- leave: ({ operation, type }) => operation + ": " + type
1282
- },
1283
- ScalarTypeDefinition: {
1284
- leave: ({ description, name, directives }) => wrap("", description, `
1285
- `) + join(["scalar", name, join(directives, " ")], " ")
1286
- },
1287
- ObjectTypeDefinition: {
1288
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, `
1289
- `) + join([
1290
- "type",
1291
- name,
1292
- wrap("implements ", join(interfaces, " & ")),
1293
- join(directives, " "),
1294
- block(fields)
1295
- ], " ")
1296
- },
1297
- FieldDefinition: {
1298
- leave: ({ description, name, arguments: args, type, directives }) => wrap("", description, `
1299
- `) + name + (hasMultilineItems(args) ? wrap(`(
1300
- `, indent(join(args, `
1301
- `)), `
1302
- )`) : wrap("(", join(args, ", "), ")")) + ": " + type + wrap(" ", join(directives, " "))
1303
- },
1304
- InputValueDefinition: {
1305
- leave: ({ description, name, type, defaultValue, directives }) => wrap("", description, `
1306
- `) + join([name + ": " + type, wrap("= ", defaultValue), join(directives, " ")], " ")
1307
- },
1308
- InterfaceTypeDefinition: {
1309
- leave: ({ description, name, interfaces, directives, fields }) => wrap("", description, `
1310
- `) + join([
1311
- "interface",
1312
- name,
1313
- wrap("implements ", join(interfaces, " & ")),
1314
- join(directives, " "),
1315
- block(fields)
1316
- ], " ")
1317
- },
1318
- UnionTypeDefinition: {
1319
- leave: ({ description, name, directives, types }) => wrap("", description, `
1320
- `) + join(["union", name, join(directives, " "), wrap("= ", join(types, " | "))], " ")
1321
- },
1322
- EnumTypeDefinition: {
1323
- leave: ({ description, name, directives, values }) => wrap("", description, `
1324
- `) + join(["enum", name, join(directives, " "), block(values)], " ")
1325
- },
1326
- EnumValueDefinition: {
1327
- leave: ({ description, name, directives }) => wrap("", description, `
1328
- `) + join([name, join(directives, " ")], " ")
1329
- },
1330
- InputObjectTypeDefinition: {
1331
- leave: ({ description, name, directives, fields }) => wrap("", description, `
1332
- `) + join(["input", name, join(directives, " "), block(fields)], " ")
1333
- },
1334
- DirectiveDefinition: {
1335
- leave: ({ description, name, arguments: args, repeatable, locations }) => wrap("", description, `
1336
- `) + "directive @" + name + (hasMultilineItems(args) ? wrap(`(
1337
- `, indent(join(args, `
1338
- `)), `
1339
- )`) : wrap("(", join(args, ", "), ")")) + (repeatable ? " repeatable" : "") + " on " + join(locations, " | ")
1340
- },
1341
- SchemaExtension: {
1342
- leave: ({ directives, operationTypes }) => join(["extend schema", join(directives, " "), block(operationTypes)], " ")
1343
- },
1344
- ScalarTypeExtension: {
1345
- leave: ({ name, directives }) => join(["extend scalar", name, join(directives, " ")], " ")
1346
- },
1347
- ObjectTypeExtension: {
1348
- leave: ({ name, interfaces, directives, fields }) => join([
1349
- "extend type",
1350
- name,
1351
- wrap("implements ", join(interfaces, " & ")),
1352
- join(directives, " "),
1353
- block(fields)
1354
- ], " ")
1355
- },
1356
- InterfaceTypeExtension: {
1357
- leave: ({ name, interfaces, directives, fields }) => join([
1358
- "extend interface",
1359
- name,
1360
- wrap("implements ", join(interfaces, " & ")),
1361
- join(directives, " "),
1362
- block(fields)
1363
- ], " ")
1364
- },
1365
- UnionTypeExtension: {
1366
- leave: ({ name, directives, types }) => join([
1367
- "extend union",
1368
- name,
1369
- join(directives, " "),
1370
- wrap("= ", join(types, " | "))
1371
- ], " ")
1372
- },
1373
- EnumTypeExtension: {
1374
- leave: ({ name, directives, values }) => join(["extend enum", name, join(directives, " "), block(values)], " ")
1375
- },
1376
- InputObjectTypeExtension: {
1377
- leave: ({ name, directives, fields }) => join(["extend input", name, join(directives, " "), block(fields)], " ")
1378
- },
1379
- TypeCoordinate: {
1380
- leave: ({ name }) => name
1381
- },
1382
- MemberCoordinate: {
1383
- leave: ({ name, memberName }) => join([name, wrap(".", memberName)])
1384
- },
1385
- ArgumentCoordinate: {
1386
- leave: ({ name, fieldName, argumentName }) => join([name, wrap(".", fieldName), wrap("(", argumentName, ":)")])
1387
- },
1388
- DirectiveCoordinate: {
1389
- leave: ({ name }) => join(["@", name])
1390
- },
1391
- DirectiveArgumentCoordinate: {
1392
- leave: ({ name, argumentName }) => join(["@", name, wrap("(", argumentName, ":)")])
1393
- }
1394
- };
1395
- function join(maybeArray, separator = "") {
1396
- var _maybeArray$filter$jo;
1397
- return (_maybeArray$filter$jo = maybeArray === null || maybeArray === undefined ? undefined : maybeArray.filter((x) => x).join(separator)) !== null && _maybeArray$filter$jo !== undefined ? _maybeArray$filter$jo : "";
1398
- }
1399
- function block(array) {
1400
- return wrap(`{
1401
- `, indent(join(array, `
1402
- `)), `
1403
- }`);
1404
- }
1405
- function wrap(start, maybeString, end = "") {
1406
- return maybeString != null && maybeString !== "" ? start + maybeString + end : "";
1407
- }
1408
- function indent(str) {
1409
- return wrap(" ", str.replace(/\n/g, `
1410
- `));
1411
- }
1412
- function hasMultilineItems(maybeArray) {
1413
- var _maybeArray$some;
1414
- return (_maybeArray$some = maybeArray === null || maybeArray === undefined ? undefined : maybeArray.some((str) => str.includes(`
1415
- `))) !== null && _maybeArray$some !== undefined ? _maybeArray$some : false;
1416
- }
1417
-
1418
- // ../../node_modules/graphql/utilities/valueFromASTUntyped.mjs
1419
- function valueFromASTUntyped(valueNode, variables) {
1420
- switch (valueNode.kind) {
1421
- case Kind.NULL:
1422
- return null;
1423
- case Kind.INT:
1424
- return parseInt(valueNode.value, 10);
1425
- case Kind.FLOAT:
1426
- return parseFloat(valueNode.value);
1427
- case Kind.STRING:
1428
- case Kind.ENUM:
1429
- case Kind.BOOLEAN:
1430
- return valueNode.value;
1431
- case Kind.LIST:
1432
- return valueNode.values.map((node) => valueFromASTUntyped(node, variables));
1433
- case Kind.OBJECT:
1434
- return keyValMap(valueNode.fields, (field) => field.name.value, (field) => valueFromASTUntyped(field.value, variables));
1435
- case Kind.VARIABLE:
1436
- return variables === null || variables === undefined ? undefined : variables[valueNode.name.value];
1437
- }
1438
- }
1439
-
1440
- // ../../node_modules/graphql/type/assertName.mjs
1441
- function assertName(name) {
1442
- name != null || devAssert(false, "Must provide name.");
1443
- typeof name === "string" || devAssert(false, "Expected name to be a string.");
1444
- if (name.length === 0) {
1445
- throw new GraphQLError("Expected name to be a non-empty string.");
1446
- }
1447
- for (let i = 1;i < name.length; ++i) {
1448
- if (!isNameContinue(name.charCodeAt(i))) {
1449
- throw new GraphQLError(`Names must only contain [_a-zA-Z0-9] but "${name}" does not.`);
1450
- }
1451
- }
1452
- if (!isNameStart(name.charCodeAt(0))) {
1453
- throw new GraphQLError(`Names must start with [_a-zA-Z] but "${name}" does not.`);
1454
- }
1455
- return name;
1456
- }
1457
- function assertEnumValueName(name) {
1458
- if (name === "true" || name === "false" || name === "null") {
1459
- throw new GraphQLError(`Enum values cannot be named: ${name}`);
1460
- }
1461
- return assertName(name);
1462
- }
1463
-
1464
- // ../../node_modules/graphql/type/definition.mjs
1465
- function isType(type) {
1466
- return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type) || isListType(type) || isNonNullType(type);
1467
- }
1468
- function isScalarType(type) {
1469
- return instanceOf(type, GraphQLScalarType);
1470
- }
1471
- function isObjectType(type) {
1472
- return instanceOf(type, GraphQLObjectType);
1473
- }
1474
- function isInterfaceType(type) {
1475
- return instanceOf(type, GraphQLInterfaceType);
1476
- }
1477
- function isUnionType(type) {
1478
- return instanceOf(type, GraphQLUnionType);
1479
- }
1480
- function isEnumType(type) {
1481
- return instanceOf(type, GraphQLEnumType);
1482
- }
1483
- function isInputObjectType(type) {
1484
- return instanceOf(type, GraphQLInputObjectType);
1485
- }
1486
- function isListType(type) {
1487
- return instanceOf(type, GraphQLList);
1488
- }
1489
- function isNonNullType(type) {
1490
- return instanceOf(type, GraphQLNonNull);
1491
- }
1492
- function isLeafType(type) {
1493
- return isScalarType(type) || isEnumType(type);
1494
- }
1495
- function isAbstractType(type) {
1496
- return isInterfaceType(type) || isUnionType(type);
1497
- }
1498
- class GraphQLList {
1499
- constructor(ofType) {
1500
- isType(ofType) || devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`);
1501
- this.ofType = ofType;
1502
- }
1503
- get [Symbol.toStringTag]() {
1504
- return "GraphQLList";
1505
- }
1506
- toString() {
1507
- return "[" + String(this.ofType) + "]";
1508
- }
1509
- toJSON() {
1510
- return this.toString();
1511
- }
1512
- }
1513
-
1514
- class GraphQLNonNull {
1515
- constructor(ofType) {
1516
- isNullableType(ofType) || devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL nullable type.`);
1517
- this.ofType = ofType;
1518
- }
1519
- get [Symbol.toStringTag]() {
1520
- return "GraphQLNonNull";
1521
- }
1522
- toString() {
1523
- return String(this.ofType) + "!";
1524
- }
1525
- toJSON() {
1526
- return this.toString();
1527
- }
1528
- }
1529
- function isWrappingType(type) {
1530
- return isListType(type) || isNonNullType(type);
1531
- }
1532
- function isNullableType(type) {
1533
- return isType(type) && !isNonNullType(type);
1534
- }
1535
- function getNamedType(type) {
1536
- if (type) {
1537
- let unwrappedType = type;
1538
- while (isWrappingType(unwrappedType)) {
1539
- unwrappedType = unwrappedType.ofType;
1540
- }
1541
- return unwrappedType;
1542
- }
1543
- }
1544
- function resolveReadonlyArrayThunk(thunk) {
1545
- return typeof thunk === "function" ? thunk() : thunk;
1546
- }
1547
- function resolveObjMapThunk(thunk) {
1548
- return typeof thunk === "function" ? thunk() : thunk;
1549
- }
1550
-
1551
- class GraphQLScalarType {
1552
- constructor(config) {
1553
- var _config$parseValue, _config$serialize, _config$parseLiteral, _config$extensionASTN;
1554
- const parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== undefined ? _config$parseValue : identityFunc;
1555
- this.name = assertName(config.name);
1556
- this.description = config.description;
1557
- this.specifiedByURL = config.specifiedByURL;
1558
- this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== undefined ? _config$serialize : identityFunc;
1559
- this.parseValue = parseValue;
1560
- this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== undefined ? _config$parseLiteral : (node, variables) => parseValue(valueFromASTUntyped(node, variables));
1561
- this.extensions = toObjMap(config.extensions);
1562
- this.astNode = config.astNode;
1563
- this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== undefined ? _config$extensionASTN : [];
1564
- config.specifiedByURL == null || typeof config.specifiedByURL === "string" || devAssert(false, `${this.name} must provide "specifiedByURL" as a string, ` + `but got: ${inspect(config.specifiedByURL)}.`);
1565
- config.serialize == null || typeof config.serialize === "function" || devAssert(false, `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`);
1566
- if (config.parseLiteral) {
1567
- typeof config.parseValue === "function" && typeof config.parseLiteral === "function" || devAssert(false, `${this.name} must provide both "parseValue" and "parseLiteral" functions.`);
1568
- }
1569
- }
1570
- get [Symbol.toStringTag]() {
1571
- return "GraphQLScalarType";
1572
- }
1573
- toConfig() {
1574
- return {
1575
- name: this.name,
1576
- description: this.description,
1577
- specifiedByURL: this.specifiedByURL,
1578
- serialize: this.serialize,
1579
- parseValue: this.parseValue,
1580
- parseLiteral: this.parseLiteral,
1581
- extensions: this.extensions,
1582
- astNode: this.astNode,
1583
- extensionASTNodes: this.extensionASTNodes
1584
- };
1585
- }
1586
- toString() {
1587
- return this.name;
1588
- }
1589
- toJSON() {
1590
- return this.toString();
1591
- }
1592
- }
1593
-
1594
- class GraphQLObjectType {
1595
- constructor(config) {
1596
- var _config$extensionASTN2;
1597
- this.name = assertName(config.name);
1598
- this.description = config.description;
1599
- this.isTypeOf = config.isTypeOf;
1600
- this.extensions = toObjMap(config.extensions);
1601
- this.astNode = config.astNode;
1602
- this.extensionASTNodes = (_config$extensionASTN2 = config.extensionASTNodes) !== null && _config$extensionASTN2 !== undefined ? _config$extensionASTN2 : [];
1603
- this._fields = () => defineFieldMap(config);
1604
- this._interfaces = () => defineInterfaces(config);
1605
- config.isTypeOf == null || typeof config.isTypeOf === "function" || devAssert(false, `${this.name} must provide "isTypeOf" as a function, ` + `but got: ${inspect(config.isTypeOf)}.`);
1606
- }
1607
- get [Symbol.toStringTag]() {
1608
- return "GraphQLObjectType";
1609
- }
1610
- getFields() {
1611
- if (typeof this._fields === "function") {
1612
- this._fields = this._fields();
1613
- }
1614
- return this._fields;
1615
- }
1616
- getInterfaces() {
1617
- if (typeof this._interfaces === "function") {
1618
- this._interfaces = this._interfaces();
1619
- }
1620
- return this._interfaces;
1621
- }
1622
- toConfig() {
1623
- return {
1624
- name: this.name,
1625
- description: this.description,
1626
- interfaces: this.getInterfaces(),
1627
- fields: fieldsToFieldsConfig(this.getFields()),
1628
- isTypeOf: this.isTypeOf,
1629
- extensions: this.extensions,
1630
- astNode: this.astNode,
1631
- extensionASTNodes: this.extensionASTNodes
1632
- };
1633
- }
1634
- toString() {
1635
- return this.name;
1636
- }
1637
- toJSON() {
1638
- return this.toString();
1639
- }
1640
- }
1641
- function defineInterfaces(config) {
1642
- var _config$interfaces;
1643
- const interfaces = resolveReadonlyArrayThunk((_config$interfaces = config.interfaces) !== null && _config$interfaces !== undefined ? _config$interfaces : []);
1644
- Array.isArray(interfaces) || devAssert(false, `${config.name} interfaces must be an Array or a function which returns an Array.`);
1645
- return interfaces;
1646
- }
1647
- function defineFieldMap(config) {
1648
- const fieldMap = resolveObjMapThunk(config.fields);
1649
- isPlainObj(fieldMap) || devAssert(false, `${config.name} fields must be an object with field names as keys or a function which returns such an object.`);
1650
- return mapValue(fieldMap, (fieldConfig, fieldName) => {
1651
- var _fieldConfig$args;
1652
- isPlainObj(fieldConfig) || devAssert(false, `${config.name}.${fieldName} field config must be an object.`);
1653
- fieldConfig.resolve == null || typeof fieldConfig.resolve === "function" || devAssert(false, `${config.name}.${fieldName} field resolver must be a function if ` + `provided, but got: ${inspect(fieldConfig.resolve)}.`);
1654
- const argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== undefined ? _fieldConfig$args : {};
1655
- isPlainObj(argsConfig) || devAssert(false, `${config.name}.${fieldName} args must be an object with argument names as keys.`);
1656
- return {
1657
- name: assertName(fieldName),
1658
- description: fieldConfig.description,
1659
- type: fieldConfig.type,
1660
- args: defineArguments(argsConfig),
1661
- resolve: fieldConfig.resolve,
1662
- subscribe: fieldConfig.subscribe,
1663
- deprecationReason: fieldConfig.deprecationReason,
1664
- extensions: toObjMap(fieldConfig.extensions),
1665
- astNode: fieldConfig.astNode
1666
- };
1667
- });
1668
- }
1669
- function defineArguments(config) {
1670
- return Object.entries(config).map(([argName, argConfig]) => ({
1671
- name: assertName(argName),
1672
- description: argConfig.description,
1673
- type: argConfig.type,
1674
- defaultValue: argConfig.defaultValue,
1675
- deprecationReason: argConfig.deprecationReason,
1676
- extensions: toObjMap(argConfig.extensions),
1677
- astNode: argConfig.astNode
1678
- }));
1679
- }
1680
- function isPlainObj(obj) {
1681
- return isObjectLike(obj) && !Array.isArray(obj);
1682
- }
1683
- function fieldsToFieldsConfig(fields) {
1684
- return mapValue(fields, (field) => ({
1685
- description: field.description,
1686
- type: field.type,
1687
- args: argsToArgsConfig(field.args),
1688
- resolve: field.resolve,
1689
- subscribe: field.subscribe,
1690
- deprecationReason: field.deprecationReason,
1691
- extensions: field.extensions,
1692
- astNode: field.astNode
1693
- }));
1694
- }
1695
- function argsToArgsConfig(args) {
1696
- return keyValMap(args, (arg) => arg.name, (arg) => ({
1697
- description: arg.description,
1698
- type: arg.type,
1699
- defaultValue: arg.defaultValue,
1700
- deprecationReason: arg.deprecationReason,
1701
- extensions: arg.extensions,
1702
- astNode: arg.astNode
1703
- }));
1704
- }
1705
- class GraphQLInterfaceType {
1706
- constructor(config) {
1707
- var _config$extensionASTN3;
1708
- this.name = assertName(config.name);
1709
- this.description = config.description;
1710
- this.resolveType = config.resolveType;
1711
- this.extensions = toObjMap(config.extensions);
1712
- this.astNode = config.astNode;
1713
- this.extensionASTNodes = (_config$extensionASTN3 = config.extensionASTNodes) !== null && _config$extensionASTN3 !== undefined ? _config$extensionASTN3 : [];
1714
- this._fields = defineFieldMap.bind(undefined, config);
1715
- this._interfaces = defineInterfaces.bind(undefined, config);
1716
- config.resolveType == null || typeof config.resolveType === "function" || devAssert(false, `${this.name} must provide "resolveType" as a function, ` + `but got: ${inspect(config.resolveType)}.`);
1717
- }
1718
- get [Symbol.toStringTag]() {
1719
- return "GraphQLInterfaceType";
1720
- }
1721
- getFields() {
1722
- if (typeof this._fields === "function") {
1723
- this._fields = this._fields();
1724
- }
1725
- return this._fields;
1726
- }
1727
- getInterfaces() {
1728
- if (typeof this._interfaces === "function") {
1729
- this._interfaces = this._interfaces();
1730
- }
1731
- return this._interfaces;
1732
- }
1733
- toConfig() {
1734
- return {
1735
- name: this.name,
1736
- description: this.description,
1737
- interfaces: this.getInterfaces(),
1738
- fields: fieldsToFieldsConfig(this.getFields()),
1739
- resolveType: this.resolveType,
1740
- extensions: this.extensions,
1741
- astNode: this.astNode,
1742
- extensionASTNodes: this.extensionASTNodes
1743
- };
1744
- }
1745
- toString() {
1746
- return this.name;
1747
- }
1748
- toJSON() {
1749
- return this.toString();
1750
- }
1751
- }
1752
-
1753
- class GraphQLUnionType {
1754
- constructor(config) {
1755
- var _config$extensionASTN4;
1756
- this.name = assertName(config.name);
1757
- this.description = config.description;
1758
- this.resolveType = config.resolveType;
1759
- this.extensions = toObjMap(config.extensions);
1760
- this.astNode = config.astNode;
1761
- this.extensionASTNodes = (_config$extensionASTN4 = config.extensionASTNodes) !== null && _config$extensionASTN4 !== undefined ? _config$extensionASTN4 : [];
1762
- this._types = defineTypes.bind(undefined, config);
1763
- config.resolveType == null || typeof config.resolveType === "function" || devAssert(false, `${this.name} must provide "resolveType" as a function, ` + `but got: ${inspect(config.resolveType)}.`);
1764
- }
1765
- get [Symbol.toStringTag]() {
1766
- return "GraphQLUnionType";
1767
- }
1768
- getTypes() {
1769
- if (typeof this._types === "function") {
1770
- this._types = this._types();
1771
- }
1772
- return this._types;
1773
- }
1774
- toConfig() {
1775
- return {
1776
- name: this.name,
1777
- description: this.description,
1778
- types: this.getTypes(),
1779
- resolveType: this.resolveType,
1780
- extensions: this.extensions,
1781
- astNode: this.astNode,
1782
- extensionASTNodes: this.extensionASTNodes
1783
- };
1784
- }
1785
- toString() {
1786
- return this.name;
1787
- }
1788
- toJSON() {
1789
- return this.toString();
1790
- }
1791
- }
1792
- function defineTypes(config) {
1793
- const types = resolveReadonlyArrayThunk(config.types);
1794
- Array.isArray(types) || devAssert(false, `Must provide Array of types or a function which returns such an array for Union ${config.name}.`);
1795
- return types;
1796
- }
1797
-
1798
- class GraphQLEnumType {
1799
- constructor(config) {
1800
- var _config$extensionASTN5;
1801
- this.name = assertName(config.name);
1802
- this.description = config.description;
1803
- this.extensions = toObjMap(config.extensions);
1804
- this.astNode = config.astNode;
1805
- this.extensionASTNodes = (_config$extensionASTN5 = config.extensionASTNodes) !== null && _config$extensionASTN5 !== undefined ? _config$extensionASTN5 : [];
1806
- this._values = typeof config.values === "function" ? config.values : defineEnumValues(this.name, config.values);
1807
- this._valueLookup = null;
1808
- this._nameLookup = null;
1809
- }
1810
- get [Symbol.toStringTag]() {
1811
- return "GraphQLEnumType";
1812
- }
1813
- getValues() {
1814
- if (typeof this._values === "function") {
1815
- this._values = defineEnumValues(this.name, this._values());
1816
- }
1817
- return this._values;
1818
- }
1819
- getValue(name) {
1820
- if (this._nameLookup === null) {
1821
- this._nameLookup = keyMap(this.getValues(), (value) => value.name);
1822
- }
1823
- return this._nameLookup[name];
1824
- }
1825
- serialize(outputValue) {
1826
- if (this._valueLookup === null) {
1827
- this._valueLookup = new Map(this.getValues().map((enumValue) => [enumValue.value, enumValue]));
1828
- }
1829
- const enumValue = this._valueLookup.get(outputValue);
1830
- if (enumValue === undefined) {
1831
- throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`);
1832
- }
1833
- return enumValue.name;
1834
- }
1835
- parseValue(inputValue) {
1836
- if (typeof inputValue !== "string") {
1837
- const valueStr = inspect(inputValue);
1838
- throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr));
1839
- }
1840
- const enumValue = this.getValue(inputValue);
1841
- if (enumValue == null) {
1842
- throw new GraphQLError(`Value "${inputValue}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, inputValue));
1843
- }
1844
- return enumValue.value;
1845
- }
1846
- parseLiteral(valueNode, _variables) {
1847
- if (valueNode.kind !== Kind.ENUM) {
1848
- const valueStr = print(valueNode);
1849
- throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr), {
1850
- nodes: valueNode
1851
- });
1852
- }
1853
- const enumValue = this.getValue(valueNode.value);
1854
- if (enumValue == null) {
1855
- const valueStr = print(valueNode);
1856
- throw new GraphQLError(`Value "${valueStr}" does not exist in "${this.name}" enum.` + didYouMeanEnumValue(this, valueStr), {
1857
- nodes: valueNode
1858
- });
1859
- }
1860
- return enumValue.value;
1861
- }
1862
- toConfig() {
1863
- const values = keyValMap(this.getValues(), (value) => value.name, (value) => ({
1864
- description: value.description,
1865
- value: value.value,
1866
- deprecationReason: value.deprecationReason,
1867
- extensions: value.extensions,
1868
- astNode: value.astNode
1869
- }));
1870
- return {
1871
- name: this.name,
1872
- description: this.description,
1873
- values,
1874
- extensions: this.extensions,
1875
- astNode: this.astNode,
1876
- extensionASTNodes: this.extensionASTNodes
1877
- };
1878
- }
1879
- toString() {
1880
- return this.name;
1881
- }
1882
- toJSON() {
1883
- return this.toString();
1884
- }
1885
- }
1886
- function didYouMeanEnumValue(enumType, unknownValueStr) {
1887
- const allNames = enumType.getValues().map((value) => value.name);
1888
- const suggestedValues = suggestionList(unknownValueStr, allNames);
1889
- return didYouMean("the enum value", suggestedValues);
1890
- }
1891
- function defineEnumValues(typeName, valueMap) {
1892
- isPlainObj(valueMap) || devAssert(false, `${typeName} values must be an object with value names as keys.`);
1893
- return Object.entries(valueMap).map(([valueName, valueConfig]) => {
1894
- isPlainObj(valueConfig) || devAssert(false, `${typeName}.${valueName} must refer to an object with a "value" key ` + `representing an internal value but got: ${inspect(valueConfig)}.`);
1895
- return {
1896
- name: assertEnumValueName(valueName),
1897
- description: valueConfig.description,
1898
- value: valueConfig.value !== undefined ? valueConfig.value : valueName,
1899
- deprecationReason: valueConfig.deprecationReason,
1900
- extensions: toObjMap(valueConfig.extensions),
1901
- astNode: valueConfig.astNode
1902
- };
1903
- });
1904
- }
1905
-
1906
- class GraphQLInputObjectType {
1907
- constructor(config) {
1908
- var _config$extensionASTN6, _config$isOneOf;
1909
- this.name = assertName(config.name);
1910
- this.description = config.description;
1911
- this.extensions = toObjMap(config.extensions);
1912
- this.astNode = config.astNode;
1913
- this.extensionASTNodes = (_config$extensionASTN6 = config.extensionASTNodes) !== null && _config$extensionASTN6 !== undefined ? _config$extensionASTN6 : [];
1914
- this.isOneOf = (_config$isOneOf = config.isOneOf) !== null && _config$isOneOf !== undefined ? _config$isOneOf : false;
1915
- this._fields = defineInputFieldMap.bind(undefined, config);
1916
- }
1917
- get [Symbol.toStringTag]() {
1918
- return "GraphQLInputObjectType";
1919
- }
1920
- getFields() {
1921
- if (typeof this._fields === "function") {
1922
- this._fields = this._fields();
1923
- }
1924
- return this._fields;
1925
- }
1926
- toConfig() {
1927
- const fields = mapValue(this.getFields(), (field) => ({
1928
- description: field.description,
1929
- type: field.type,
1930
- defaultValue: field.defaultValue,
1931
- deprecationReason: field.deprecationReason,
1932
- extensions: field.extensions,
1933
- astNode: field.astNode
1934
- }));
1935
- return {
1936
- name: this.name,
1937
- description: this.description,
1938
- fields,
1939
- extensions: this.extensions,
1940
- astNode: this.astNode,
1941
- extensionASTNodes: this.extensionASTNodes,
1942
- isOneOf: this.isOneOf
109
+ import {
110
+ GraphQLSchema as GraphQLSchema4,
111
+ GraphQLObjectType as GraphQLObjectType2,
112
+ GraphQLString as GraphQLString2,
113
+ GraphQLNonNull as GraphQLNonNull2,
114
+ GraphQLList as GraphQLList2,
115
+ GraphQLUnionType,
116
+ printSchema
117
+ } from "graphql";
118
+
119
+ // ../graphql/src/decorators/type.decorators.ts
120
+ import"reflect-metadata";
121
+ var OBJECT_TYPE_METADATA = "graphql:objectType";
122
+ var INPUT_TYPE_METADATA = "graphql:inputType";
123
+ var FIELD_METADATA = "graphql:field";
124
+ // ../graphql/src/decorators/resolver.decorators.ts
125
+ import"reflect-metadata";
126
+ var QUERY_METADATA = "graphql:query";
127
+ var MUTATION_METADATA = "graphql:mutation";
128
+ var SUBSCRIPTION_METADATA = "graphql:subscription";
129
+ // ../graphql/src/decorators/param.decorators.ts
130
+ import"reflect-metadata";
131
+ function createParamDecorator(type) {
132
+ return (options) => {
133
+ return (target, propertyKey, parameterIndex) => {
134
+ const metadataKey = `graphql:params:${String(propertyKey)}`;
135
+ const existingParams = Reflect.getMetadata(metadataKey, target.constructor) || [];
136
+ existingParams.push({
137
+ index: parameterIndex,
138
+ type,
139
+ options
140
+ });
141
+ Reflect.defineMetadata(metadataKey, existingParams, target.constructor);
1943
142
  };
1944
- }
1945
- toString() {
1946
- return this.name;
1947
- }
1948
- toJSON() {
1949
- return this.toString();
1950
- }
143
+ };
1951
144
  }
1952
- function defineInputFieldMap(config) {
1953
- const fieldMap = resolveObjMapThunk(config.fields);
1954
- isPlainObj(fieldMap) || devAssert(false, `${config.name} fields must be an object with field names as keys or a function which returns such an object.`);
1955
- return mapValue(fieldMap, (fieldConfig, fieldName) => {
1956
- !("resolve" in fieldConfig) || devAssert(false, `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`);
1957
- return {
1958
- name: assertName(fieldName),
1959
- description: fieldConfig.description,
1960
- type: fieldConfig.type,
1961
- defaultValue: fieldConfig.defaultValue,
1962
- deprecationReason: fieldConfig.deprecationReason,
1963
- extensions: toObjMap(fieldConfig.extensions),
1964
- astNode: fieldConfig.astNode
1965
- };
1966
- });
145
+ var Context = createParamDecorator("context");
146
+ var Root = createParamDecorator("root");
147
+ var Parent = createParamDecorator("parent");
148
+ var Info = createParamDecorator("info");
149
+ function getParamsMetadata(target, methodName) {
150
+ return Reflect.getMetadata(`graphql:params:${methodName}`, target) || [];
1967
151
  }
1968
-
1969
- // ../../node_modules/graphql/language/directiveLocation.mjs
1970
- var DirectiveLocation;
1971
- (function(DirectiveLocation) {
1972
- DirectiveLocation["QUERY"] = "QUERY";
1973
- DirectiveLocation["MUTATION"] = "MUTATION";
1974
- DirectiveLocation["SUBSCRIPTION"] = "SUBSCRIPTION";
1975
- DirectiveLocation["FIELD"] = "FIELD";
1976
- DirectiveLocation["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
1977
- DirectiveLocation["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
1978
- DirectiveLocation["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
1979
- DirectiveLocation["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
1980
- DirectiveLocation["SCHEMA"] = "SCHEMA";
1981
- DirectiveLocation["SCALAR"] = "SCALAR";
1982
- DirectiveLocation["OBJECT"] = "OBJECT";
1983
- DirectiveLocation["FIELD_DEFINITION"] = "FIELD_DEFINITION";
1984
- DirectiveLocation["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
1985
- DirectiveLocation["INTERFACE"] = "INTERFACE";
1986
- DirectiveLocation["UNION"] = "UNION";
1987
- DirectiveLocation["ENUM"] = "ENUM";
1988
- DirectiveLocation["ENUM_VALUE"] = "ENUM_VALUE";
1989
- DirectiveLocation["INPUT_OBJECT"] = "INPUT_OBJECT";
1990
- DirectiveLocation["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
1991
- })(DirectiveLocation || (DirectiveLocation = {}));
1992
-
1993
- // ../../node_modules/graphql/type/scalars.mjs
1994
- var GRAPHQL_MAX_INT = 2147483647;
1995
- var GRAPHQL_MIN_INT = -2147483648;
1996
- var GraphQLInt = new GraphQLScalarType({
1997
- name: "Int",
1998
- description: "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",
1999
- serialize(outputValue) {
2000
- const coercedValue = serializeObject(outputValue);
2001
- if (typeof coercedValue === "boolean") {
2002
- return coercedValue ? 1 : 0;
2003
- }
2004
- let num = coercedValue;
2005
- if (typeof coercedValue === "string" && coercedValue !== "") {
2006
- num = Number(coercedValue);
2007
- }
2008
- if (typeof num !== "number" || !Number.isInteger(num)) {
2009
- throw new GraphQLError(`Int cannot represent non-integer value: ${inspect(coercedValue)}`);
2010
- }
2011
- if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
2012
- throw new GraphQLError("Int cannot represent non 32-bit signed integer value: " + inspect(coercedValue));
2013
- }
2014
- return num;
2015
- },
2016
- parseValue(inputValue) {
2017
- if (typeof inputValue !== "number" || !Number.isInteger(inputValue)) {
2018
- throw new GraphQLError(`Int cannot represent non-integer value: ${inspect(inputValue)}`);
2019
- }
2020
- if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) {
2021
- throw new GraphQLError(`Int cannot represent non 32-bit signed integer value: ${inputValue}`);
2022
- }
2023
- return inputValue;
2024
- },
2025
- parseLiteral(valueNode) {
2026
- if (valueNode.kind !== Kind.INT) {
2027
- throw new GraphQLError(`Int cannot represent non-integer value: ${print(valueNode)}`, {
2028
- nodes: valueNode
2029
- });
2030
- }
2031
- const num = parseInt(valueNode.value, 10);
2032
- if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
2033
- throw new GraphQLError(`Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, {
2034
- nodes: valueNode
2035
- });
2036
- }
2037
- return num;
2038
- }
2039
- });
2040
- var GraphQLFloat = new GraphQLScalarType({
2041
- name: "Float",
2042
- description: "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",
2043
- serialize(outputValue) {
2044
- const coercedValue = serializeObject(outputValue);
2045
- if (typeof coercedValue === "boolean") {
2046
- return coercedValue ? 1 : 0;
2047
- }
2048
- let num = coercedValue;
2049
- if (typeof coercedValue === "string" && coercedValue !== "") {
2050
- num = Number(coercedValue);
2051
- }
2052
- if (typeof num !== "number" || !Number.isFinite(num)) {
2053
- throw new GraphQLError(`Float cannot represent non numeric value: ${inspect(coercedValue)}`);
2054
- }
2055
- return num;
2056
- },
2057
- parseValue(inputValue) {
2058
- if (typeof inputValue !== "number" || !Number.isFinite(inputValue)) {
2059
- throw new GraphQLError(`Float cannot represent non numeric value: ${inspect(inputValue)}`);
2060
- }
2061
- return inputValue;
2062
- },
2063
- parseLiteral(valueNode) {
2064
- if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) {
2065
- throw new GraphQLError(`Float cannot represent non numeric value: ${print(valueNode)}`, valueNode);
2066
- }
2067
- return parseFloat(valueNode.value);
2068
- }
2069
- });
2070
- var GraphQLString = new GraphQLScalarType({
2071
- name: "String",
2072
- description: "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",
2073
- serialize(outputValue) {
2074
- const coercedValue = serializeObject(outputValue);
2075
- if (typeof coercedValue === "string") {
2076
- return coercedValue;
2077
- }
2078
- if (typeof coercedValue === "boolean") {
2079
- return coercedValue ? "true" : "false";
2080
- }
2081
- if (typeof coercedValue === "number" && Number.isFinite(coercedValue)) {
2082
- return coercedValue.toString();
2083
- }
2084
- throw new GraphQLError(`String cannot represent value: ${inspect(outputValue)}`);
2085
- },
2086
- parseValue(inputValue) {
2087
- if (typeof inputValue !== "string") {
2088
- throw new GraphQLError(`String cannot represent a non string value: ${inspect(inputValue)}`);
2089
- }
2090
- return inputValue;
2091
- },
2092
- parseLiteral(valueNode) {
2093
- if (valueNode.kind !== Kind.STRING) {
2094
- throw new GraphQLError(`String cannot represent a non string value: ${print(valueNode)}`, {
2095
- nodes: valueNode
2096
- });
2097
- }
2098
- return valueNode.value;
2099
- }
2100
- });
2101
- var GraphQLBoolean = new GraphQLScalarType({
2102
- name: "Boolean",
2103
- description: "The `Boolean` scalar type represents `true` or `false`.",
2104
- serialize(outputValue) {
2105
- const coercedValue = serializeObject(outputValue);
2106
- if (typeof coercedValue === "boolean") {
2107
- return coercedValue;
2108
- }
2109
- if (Number.isFinite(coercedValue)) {
2110
- return coercedValue !== 0;
2111
- }
2112
- throw new GraphQLError(`Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`);
2113
- },
2114
- parseValue(inputValue) {
2115
- if (typeof inputValue !== "boolean") {
2116
- throw new GraphQLError(`Boolean cannot represent a non boolean value: ${inspect(inputValue)}`);
2117
- }
2118
- return inputValue;
2119
- },
2120
- parseLiteral(valueNode) {
2121
- if (valueNode.kind !== Kind.BOOLEAN) {
2122
- throw new GraphQLError(`Boolean cannot represent a non boolean value: ${print(valueNode)}`, {
2123
- nodes: valueNode
2124
- });
2125
- }
2126
- return valueNode.value;
2127
- }
2128
- });
2129
- var GraphQLID = new GraphQLScalarType({
2130
- name: "ID",
2131
- description: 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',
2132
- serialize(outputValue) {
2133
- const coercedValue = serializeObject(outputValue);
2134
- if (typeof coercedValue === "string") {
2135
- return coercedValue;
2136
- }
2137
- if (Number.isInteger(coercedValue)) {
2138
- return String(coercedValue);
2139
- }
2140
- throw new GraphQLError(`ID cannot represent value: ${inspect(outputValue)}`);
2141
- },
2142
- parseValue(inputValue) {
2143
- if (typeof inputValue === "string") {
2144
- return inputValue;
2145
- }
2146
- if (typeof inputValue === "number" && Number.isInteger(inputValue)) {
2147
- return inputValue.toString();
2148
- }
2149
- throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`);
2150
- },
2151
- parseLiteral(valueNode) {
2152
- if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) {
2153
- throw new GraphQLError("ID cannot represent a non-string and non-integer value: " + print(valueNode), {
2154
- nodes: valueNode
2155
- });
2156
- }
2157
- return valueNode.value;
2158
- }
2159
- });
2160
- var specifiedScalarTypes = Object.freeze([
152
+ // ../graphql/src/schema/schema-builder.ts
153
+ import"reflect-metadata";
154
+ import {
155
+ GraphQLSchema,
156
+ GraphQLObjectType,
157
+ GraphQLInputObjectType,
2161
158
  GraphQLString,
2162
159
  GraphQLInt,
2163
160
  GraphQLFloat,
2164
161
  GraphQLBoolean,
2165
- GraphQLID
2166
- ]);
2167
- function isSpecifiedScalarType(type) {
2168
- return specifiedScalarTypes.some(({ name }) => type.name === name);
2169
- }
2170
- function serializeObject(outputValue) {
2171
- if (isObjectLike(outputValue)) {
2172
- if (typeof outputValue.valueOf === "function") {
2173
- const valueOfResult = outputValue.valueOf();
2174
- if (!isObjectLike(valueOfResult)) {
2175
- return valueOfResult;
2176
- }
2177
- }
2178
- if (typeof outputValue.toJSON === "function") {
2179
- return outputValue.toJSON();
2180
- }
2181
- }
2182
- return outputValue;
2183
- }
162
+ GraphQLID,
163
+ GraphQLList,
164
+ GraphQLNonNull
165
+ } from "graphql";
2184
166
 
2185
- // ../../node_modules/graphql/type/directives.mjs
2186
- function isDirective(directive) {
2187
- return instanceOf(directive, GraphQLDirective);
2188
- }
2189
- class GraphQLDirective {
2190
- constructor(config) {
2191
- var _config$isRepeatable, _config$args;
2192
- this.name = assertName(config.name);
2193
- this.description = config.description;
2194
- this.locations = config.locations;
2195
- this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== undefined ? _config$isRepeatable : false;
2196
- this.extensions = toObjMap(config.extensions);
2197
- this.astNode = config.astNode;
2198
- Array.isArray(config.locations) || devAssert(false, `@${config.name} locations must be an Array.`);
2199
- const args = (_config$args = config.args) !== null && _config$args !== undefined ? _config$args : {};
2200
- isObjectLike(args) && !Array.isArray(args) || devAssert(false, `@${config.name} args must be an object with argument names as keys.`);
2201
- this.args = defineArguments(args);
2202
- }
2203
- get [Symbol.toStringTag]() {
2204
- return "GraphQLDirective";
2205
- }
2206
- toConfig() {
2207
- return {
2208
- name: this.name,
2209
- description: this.description,
2210
- locations: this.locations,
2211
- args: argsToArgsConfig(this.args),
2212
- isRepeatable: this.isRepeatable,
2213
- extensions: this.extensions,
2214
- astNode: this.astNode
2215
- };
2216
- }
2217
- toString() {
2218
- return "@" + this.name;
2219
- }
2220
- toJSON() {
2221
- return this.toString();
2222
- }
2223
- }
2224
- var GraphQLIncludeDirective = new GraphQLDirective({
2225
- name: "include",
2226
- description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
2227
- locations: [
2228
- DirectiveLocation.FIELD,
2229
- DirectiveLocation.FRAGMENT_SPREAD,
2230
- DirectiveLocation.INLINE_FRAGMENT
2231
- ],
2232
- args: {
2233
- if: {
2234
- type: new GraphQLNonNull(GraphQLBoolean),
2235
- description: "Included when true."
2236
- }
2237
- }
2238
- });
2239
- var GraphQLSkipDirective = new GraphQLDirective({
2240
- name: "skip",
2241
- description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
2242
- locations: [
2243
- DirectiveLocation.FIELD,
2244
- DirectiveLocation.FRAGMENT_SPREAD,
2245
- DirectiveLocation.INLINE_FRAGMENT
2246
- ],
2247
- args: {
2248
- if: {
2249
- type: new GraphQLNonNull(GraphQLBoolean),
2250
- description: "Skipped when true."
2251
- }
2252
- }
2253
- });
2254
- var DEFAULT_DEPRECATION_REASON = "No longer supported";
2255
- var GraphQLDeprecatedDirective = new GraphQLDirective({
2256
- name: "deprecated",
2257
- description: "Marks an element of a GraphQL schema as no longer supported.",
2258
- locations: [
2259
- DirectiveLocation.FIELD_DEFINITION,
2260
- DirectiveLocation.ARGUMENT_DEFINITION,
2261
- DirectiveLocation.INPUT_FIELD_DEFINITION,
2262
- DirectiveLocation.ENUM_VALUE
2263
- ],
2264
- args: {
2265
- reason: {
2266
- type: GraphQLString,
2267
- description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
2268
- defaultValue: DEFAULT_DEPRECATION_REASON
167
+ // ../graphql/src/dataloader/context.ts
168
+ import"reflect-metadata";
169
+ var DATALOADER_METADATA = "graphql:dataloader";
170
+ class DataLoaderContext {
171
+ loaders = new Map;
172
+ factories = new Map;
173
+ registerLoader(name, factory) {
174
+ this.factories.set(name, factory);
175
+ }
176
+ getLoader(name) {
177
+ if (!this.loaders.has(name)) {
178
+ const factory = this.factories.get(name);
179
+ if (!factory) {
180
+ throw new Error(`DataLoader "${name}" not registered`);
181
+ }
182
+ this.loaders.set(name, factory());
183
+ }
184
+ return this.loaders.get(name);
185
+ }
186
+ clearAll() {
187
+ for (const loader of this.loaders.values()) {
188
+ loader.clearAll();
189
+ }
190
+ this.loaders.clear();
191
+ }
192
+ }
193
+
194
+ // ../graphql/src/schema/schema-builder.ts
195
+ class SchemaBuilder {
196
+ objectTypes = new Map;
197
+ inputTypes = new Map;
198
+ resolvers = [];
199
+ addResolver(resolver) {
200
+ this.resolvers.push(resolver);
201
+ }
202
+ build() {
203
+ const queryFields = {};
204
+ const mutationFields = {};
205
+ const subscriptionFields = {};
206
+ for (const resolver of this.resolvers) {
207
+ const resolverClass = resolver.constructor;
208
+ const queries = Reflect.getMetadata(QUERY_METADATA, resolverClass) || [];
209
+ const mutations = Reflect.getMetadata(MUTATION_METADATA, resolverClass) || [];
210
+ const subscriptions = Reflect.getMetadata(SUBSCRIPTION_METADATA, resolverClass) || [];
211
+ for (const query of queries) {
212
+ const fieldName = query.options.name || query.methodName;
213
+ queryFields[fieldName] = this.buildFieldConfig(resolver, query);
214
+ }
215
+ for (const mutation of mutations) {
216
+ const fieldName = mutation.options.name || mutation.methodName;
217
+ mutationFields[fieldName] = this.buildFieldConfig(resolver, mutation);
218
+ }
219
+ for (const subscription of subscriptions) {
220
+ const fieldName = subscription.options.name || subscription.methodName;
221
+ subscriptionFields[fieldName] = this.buildSubscriptionConfig(resolver, subscription);
222
+ }
223
+ }
224
+ const schemaConfig = {};
225
+ if (Object.keys(queryFields).length > 0) {
226
+ schemaConfig.query = new GraphQLObjectType({
227
+ name: "Query",
228
+ fields: queryFields
229
+ });
2269
230
  }
2270
- }
2271
- });
2272
- var GraphQLSpecifiedByDirective = new GraphQLDirective({
2273
- name: "specifiedBy",
2274
- description: "Exposes a URL that specifies the behavior of this scalar.",
2275
- locations: [DirectiveLocation.SCALAR],
2276
- args: {
2277
- url: {
2278
- type: new GraphQLNonNull(GraphQLString),
2279
- description: "The URL that specifies the behavior of this scalar."
231
+ if (Object.keys(mutationFields).length > 0) {
232
+ schemaConfig.mutation = new GraphQLObjectType({
233
+ name: "Mutation",
234
+ fields: mutationFields
235
+ });
2280
236
  }
2281
- }
2282
- });
2283
- var GraphQLOneOfDirective = new GraphQLDirective({
2284
- name: "oneOf",
2285
- description: "Indicates exactly one field must be supplied and this field must not be `null`.",
2286
- locations: [DirectiveLocation.INPUT_OBJECT],
2287
- args: {}
2288
- });
2289
- var specifiedDirectives = Object.freeze([
2290
- GraphQLIncludeDirective,
2291
- GraphQLSkipDirective,
2292
- GraphQLDeprecatedDirective,
2293
- GraphQLSpecifiedByDirective,
2294
- GraphQLOneOfDirective
2295
- ]);
2296
- function isSpecifiedDirective(directive) {
2297
- return specifiedDirectives.some(({ name }) => name === directive.name);
2298
- }
2299
-
2300
- // ../../node_modules/graphql/jsutils/isIterableObject.mjs
2301
- function isIterableObject(maybeIterable) {
2302
- return typeof maybeIterable === "object" && typeof (maybeIterable === null || maybeIterable === undefined ? undefined : maybeIterable[Symbol.iterator]) === "function";
2303
- }
2304
-
2305
- // ../../node_modules/graphql/utilities/astFromValue.mjs
2306
- function astFromValue(value, type) {
2307
- if (isNonNullType(type)) {
2308
- const astValue = astFromValue(value, type.ofType);
2309
- if ((astValue === null || astValue === undefined ? undefined : astValue.kind) === Kind.NULL) {
2310
- return null;
237
+ if (Object.keys(subscriptionFields).length > 0) {
238
+ schemaConfig.subscription = new GraphQLObjectType({
239
+ name: "Subscription",
240
+ fields: subscriptionFields
241
+ });
2311
242
  }
2312
- return astValue;
243
+ return new GraphQLSchema(schemaConfig);
2313
244
  }
2314
- if (value === null) {
245
+ buildFieldConfig(resolver, metadata) {
246
+ const returnType = this.getReturnType(metadata);
2315
247
  return {
2316
- kind: Kind.NULL
2317
- };
2318
- }
2319
- if (value === undefined) {
2320
- return null;
2321
- }
2322
- if (isListType(type)) {
2323
- const itemType = type.ofType;
2324
- if (isIterableObject(value)) {
2325
- const valuesNodes = [];
2326
- for (const item of value) {
2327
- const itemNode = astFromValue(item, itemType);
2328
- if (itemNode != null) {
2329
- valuesNodes.push(itemNode);
2330
- }
2331
- }
2332
- return {
2333
- kind: Kind.LIST,
2334
- values: valuesNodes
2335
- };
2336
- }
2337
- return astFromValue(value, itemType);
2338
- }
2339
- if (isInputObjectType(type)) {
2340
- if (!isObjectLike(value)) {
2341
- return null;
2342
- }
2343
- const fieldNodes = [];
2344
- for (const field of Object.values(type.getFields())) {
2345
- const fieldValue = astFromValue(value[field.name], field.type);
2346
- if (fieldValue) {
2347
- fieldNodes.push({
2348
- kind: Kind.OBJECT_FIELD,
2349
- name: {
2350
- kind: Kind.NAME,
2351
- value: field.name
2352
- },
2353
- value: fieldValue
248
+ type: returnType,
249
+ description: metadata.options.description,
250
+ deprecationReason: metadata.options.deprecationReason,
251
+ args: this.buildArgs(resolver.constructor, metadata.methodName),
252
+ resolve: async (root, args, context, info) => {
253
+ const params = this.resolveParams(resolver.constructor, metadata.methodName, {
254
+ root,
255
+ args,
256
+ context,
257
+ info
2354
258
  });
259
+ return resolver[metadata.methodName](...params);
2355
260
  }
2356
- }
261
+ };
262
+ }
263
+ buildSubscriptionConfig(resolver, metadata) {
264
+ const returnType = this.getReturnType(metadata);
265
+ const options = metadata.options;
2357
266
  return {
2358
- kind: Kind.OBJECT,
2359
- fields: fieldNodes
267
+ type: returnType,
268
+ description: metadata.options.description,
269
+ args: this.buildArgs(resolver.constructor, metadata.methodName),
270
+ subscribe: async (root, args, context, info) => {
271
+ const params = this.resolveParams(resolver.constructor, metadata.methodName, {
272
+ root,
273
+ args,
274
+ context,
275
+ info
276
+ });
277
+ return resolver[metadata.methodName](...params);
278
+ },
279
+ resolve: options.resolve || ((payload) => payload)
2360
280
  };
2361
281
  }
2362
- if (isLeafType(type)) {
2363
- const serialized = type.serialize(value);
2364
- if (serialized == null) {
2365
- return null;
2366
- }
2367
- if (typeof serialized === "boolean") {
2368
- return {
2369
- kind: Kind.BOOLEAN,
2370
- value: serialized
2371
- };
2372
- }
2373
- if (typeof serialized === "number" && Number.isFinite(serialized)) {
2374
- const stringNum = String(serialized);
2375
- return integerStringRegExp.test(stringNum) ? {
2376
- kind: Kind.INT,
2377
- value: stringNum
2378
- } : {
2379
- kind: Kind.FLOAT,
2380
- value: stringNum
2381
- };
2382
- }
2383
- if (typeof serialized === "string") {
2384
- if (isEnumType(type)) {
2385
- return {
2386
- kind: Kind.ENUM,
2387
- value: serialized
2388
- };
282
+ getReturnType(metadata) {
283
+ if (metadata.typeFn) {
284
+ return this.convertToGraphQLType(metadata.typeFn());
285
+ }
286
+ return GraphQLString;
287
+ }
288
+ buildArgs(resolverClass, methodName) {
289
+ const paramsMetadata = getParamsMetadata(resolverClass, methodName);
290
+ const args = {};
291
+ for (const param of paramsMetadata) {
292
+ if (param.type === "args" && param.options) {
293
+ const options = typeof param.options === "string" ? { name: param.options } : param.options;
294
+ if (options.name) {
295
+ args[options.name] = {
296
+ type: options.type ? this.convertToGraphQLInputType(options.type()) : GraphQLString,
297
+ description: options.description,
298
+ defaultValue: options.defaultValue
299
+ };
300
+ }
301
+ }
302
+ }
303
+ return args;
304
+ }
305
+ resolveParams(resolverClass, methodName, ctx) {
306
+ const paramsMetadata = getParamsMetadata(resolverClass, methodName);
307
+ const paramTypes = Reflect.getMetadata("design:paramtypes", resolverClass.prototype, methodName) || [];
308
+ const params = new Array(paramTypes.length).fill(undefined);
309
+ const loaderMetadata = Reflect.getMetadata(DATALOADER_METADATA, resolverClass.prototype, methodName) || new Map;
310
+ for (const param of paramsMetadata) {
311
+ switch (param.type) {
312
+ case "args":
313
+ if (param.options) {
314
+ const name = typeof param.options === "string" ? param.options : param.options.name;
315
+ params[param.index] = name ? ctx.args[name] : ctx.args;
316
+ } else {
317
+ params[param.index] = ctx.args;
318
+ }
319
+ break;
320
+ case "context":
321
+ if (typeof param.options === "string") {
322
+ params[param.index] = ctx.context[param.options];
323
+ } else {
324
+ params[param.index] = ctx.context;
325
+ }
326
+ break;
327
+ case "root":
328
+ case "parent":
329
+ params[param.index] = ctx.root;
330
+ break;
331
+ case "info":
332
+ params[param.index] = ctx.info;
333
+ break;
334
+ }
335
+ }
336
+ for (const [index, loaderName] of loaderMetadata) {
337
+ const loaderContext = ctx.context?.loaders;
338
+ if (loaderContext) {
339
+ params[index] = loaderContext.getLoader(loaderName);
340
+ }
341
+ }
342
+ return params;
343
+ }
344
+ convertToGraphQLType(type) {
345
+ if (type === String)
346
+ return GraphQLString;
347
+ if (type === Number)
348
+ return GraphQLFloat;
349
+ if (type === Boolean)
350
+ return GraphQLBoolean;
351
+ if (type === "ID" || type?.name === "ID")
352
+ return GraphQLID;
353
+ if (type === "Int")
354
+ return GraphQLInt;
355
+ if (type === "Float")
356
+ return GraphQLFloat;
357
+ if (Array.isArray(type)) {
358
+ return new GraphQLList(this.convertToGraphQLType(type[0]));
359
+ }
360
+ if (this.objectTypes.has(type)) {
361
+ return this.objectTypes.get(type);
362
+ }
363
+ const objectTypeMeta = Reflect.getMetadata(OBJECT_TYPE_METADATA, type);
364
+ if (objectTypeMeta) {
365
+ return this.buildObjectType(type);
366
+ }
367
+ return GraphQLString;
368
+ }
369
+ convertToGraphQLInputType(type) {
370
+ if (type === String)
371
+ return GraphQLString;
372
+ if (type === Number)
373
+ return GraphQLFloat;
374
+ if (type === Boolean)
375
+ return GraphQLBoolean;
376
+ if (type === "ID" || type?.name === "ID")
377
+ return GraphQLID;
378
+ if (type === "Int")
379
+ return GraphQLInt;
380
+ if (type === "Float")
381
+ return GraphQLFloat;
382
+ if (Array.isArray(type)) {
383
+ return new GraphQLList(this.convertToGraphQLInputType(type[0]));
384
+ }
385
+ if (this.inputTypes.has(type)) {
386
+ return this.inputTypes.get(type);
387
+ }
388
+ const inputTypeMeta = Reflect.getMetadata(INPUT_TYPE_METADATA, type);
389
+ if (inputTypeMeta) {
390
+ return this.buildInputType(type);
391
+ }
392
+ return GraphQLString;
393
+ }
394
+ buildObjectType(type) {
395
+ if (this.objectTypes.has(type)) {
396
+ return this.objectTypes.get(type);
397
+ }
398
+ const metadata = Reflect.getMetadata(OBJECT_TYPE_METADATA, type);
399
+ const fields = Reflect.getMetadata(FIELD_METADATA, type) || [];
400
+ const objectType = new GraphQLObjectType({
401
+ name: metadata.name,
402
+ description: metadata.description,
403
+ fields: () => {
404
+ const graphqlFields = {};
405
+ for (const field of fields) {
406
+ const fieldType = field.typeFn ? this.convertToGraphQLType(field.typeFn()) : GraphQLString;
407
+ graphqlFields[field.name || field.propertyKey] = {
408
+ type: field.nullable ? fieldType : new GraphQLNonNull(fieldType),
409
+ description: field.description,
410
+ deprecationReason: field.deprecationReason,
411
+ resolve: (parent) => parent[field.propertyKey]
412
+ };
413
+ }
414
+ return graphqlFields;
2389
415
  }
2390
- if (type === GraphQLID && integerStringRegExp.test(serialized)) {
2391
- return {
2392
- kind: Kind.INT,
2393
- value: serialized
2394
- };
416
+ });
417
+ this.objectTypes.set(type, objectType);
418
+ return objectType;
419
+ }
420
+ buildInputType(type) {
421
+ if (this.inputTypes.has(type)) {
422
+ return this.inputTypes.get(type);
423
+ }
424
+ const metadata = Reflect.getMetadata(INPUT_TYPE_METADATA, type);
425
+ const fields = Reflect.getMetadata(FIELD_METADATA, type) || [];
426
+ const inputType = new GraphQLInputObjectType({
427
+ name: metadata.name,
428
+ description: metadata.description,
429
+ fields: () => {
430
+ const graphqlFields = {};
431
+ for (const field of fields) {
432
+ const fieldType = field.typeFn ? this.convertToGraphQLInputType(field.typeFn()) : GraphQLString;
433
+ graphqlFields[field.name || field.propertyKey] = {
434
+ type: field.nullable ? fieldType : new GraphQLNonNull(fieldType),
435
+ description: field.description,
436
+ defaultValue: field.defaultValue
437
+ };
438
+ }
439
+ return graphqlFields;
2395
440
  }
2396
- return {
2397
- kind: Kind.STRING,
2398
- value: serialized
2399
- };
2400
- }
2401
- throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`);
441
+ });
442
+ this.inputTypes.set(type, inputType);
443
+ return inputType;
2402
444
  }
2403
- invariant(false, "Unexpected input type: " + inspect(type));
2404
445
  }
2405
- var integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
2406
-
2407
- // ../../node_modules/graphql/type/introspection.mjs
2408
- var __Schema = new GraphQLObjectType({
2409
- name: "__Schema",
2410
- description: "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",
2411
- fields: () => ({
2412
- description: {
2413
- type: GraphQLString,
2414
- resolve: (schema) => schema.description
2415
- },
2416
- types: {
2417
- description: "A list of all types supported by this server.",
2418
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))),
2419
- resolve(schema) {
2420
- return Object.values(schema.getTypeMap());
2421
- }
2422
- },
2423
- queryType: {
2424
- description: "The type that query operations will be rooted at.",
2425
- type: new GraphQLNonNull(__Type),
2426
- resolve: (schema) => schema.getQueryType()
2427
- },
2428
- mutationType: {
2429
- description: "If this server supports mutation, the type that mutation operations will be rooted at.",
2430
- type: __Type,
2431
- resolve: (schema) => schema.getMutationType()
2432
- },
2433
- subscriptionType: {
2434
- description: "If this server support subscription, the type that subscription operations will be rooted at.",
2435
- type: __Type,
2436
- resolve: (schema) => schema.getSubscriptionType()
2437
- },
2438
- directives: {
2439
- description: "A list of all directives supported by this server.",
2440
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Directive))),
2441
- resolve: (schema) => schema.getDirectives()
2442
- }
2443
- })
2444
- });
2445
- var __Directive = new GraphQLObjectType({
2446
- name: "__Directive",
2447
- description: `A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
2448
-
2449
- In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,
2450
- fields: () => ({
2451
- name: {
2452
- type: new GraphQLNonNull(GraphQLString),
2453
- resolve: (directive) => directive.name
2454
- },
2455
- description: {
2456
- type: GraphQLString,
2457
- resolve: (directive) => directive.description
2458
- },
2459
- isRepeatable: {
2460
- type: new GraphQLNonNull(GraphQLBoolean),
2461
- resolve: (directive) => directive.isRepeatable
2462
- },
2463
- locations: {
2464
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__DirectiveLocation))),
2465
- resolve: (directive) => directive.locations
2466
- },
2467
- args: {
2468
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
2469
- args: {
2470
- includeDeprecated: {
2471
- type: GraphQLBoolean,
2472
- defaultValue: false
446
+ // ../graphql/src/module/graphql.module.ts
447
+ import"reflect-metadata";
448
+ import { parse, validate, execute } from "graphql";
449
+ var GRAPHQL_OPTIONS = Symbol("GRAPHQL_OPTIONS");
450
+ var GRAPHQL_SCHEMA = Symbol("GRAPHQL_SCHEMA");
451
+
452
+ class GraphQLModule {
453
+ static schemaBuilder = new SchemaBuilder;
454
+ static forRoot(options = {}) {
455
+ const resolvers = options.resolvers || [];
456
+ return {
457
+ module: GraphQLModule,
458
+ global: true,
459
+ providers: [
460
+ {
461
+ provide: GRAPHQL_OPTIONS,
462
+ useValue: {
463
+ path: "/graphql",
464
+ playground: true,
465
+ introspection: true,
466
+ ...options
467
+ }
468
+ },
469
+ {
470
+ provide: GRAPHQL_SCHEMA,
471
+ useFactory: () => {
472
+ for (const resolver of resolvers) {
473
+ const instance = new resolver;
474
+ this.schemaBuilder.addResolver(instance);
475
+ }
476
+ return this.schemaBuilder.build();
477
+ }
478
+ },
479
+ {
480
+ provide: "GraphQLHandler",
481
+ useFactory: (schema, opts) => {
482
+ return new GraphQLHandler(schema, opts);
483
+ },
484
+ inject: [GRAPHQL_SCHEMA, GRAPHQL_OPTIONS]
2473
485
  }
2474
- },
2475
- resolve(field, { includeDeprecated }) {
2476
- return includeDeprecated ? field.args : field.args.filter((arg) => arg.deprecationReason == null);
2477
- }
2478
- }
2479
- })
2480
- });
2481
- var __DirectiveLocation = new GraphQLEnumType({
2482
- name: "__DirectiveLocation",
2483
- description: "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",
2484
- values: {
2485
- QUERY: {
2486
- value: DirectiveLocation.QUERY,
2487
- description: "Location adjacent to a query operation."
2488
- },
2489
- MUTATION: {
2490
- value: DirectiveLocation.MUTATION,
2491
- description: "Location adjacent to a mutation operation."
2492
- },
2493
- SUBSCRIPTION: {
2494
- value: DirectiveLocation.SUBSCRIPTION,
2495
- description: "Location adjacent to a subscription operation."
2496
- },
2497
- FIELD: {
2498
- value: DirectiveLocation.FIELD,
2499
- description: "Location adjacent to a field."
2500
- },
2501
- FRAGMENT_DEFINITION: {
2502
- value: DirectiveLocation.FRAGMENT_DEFINITION,
2503
- description: "Location adjacent to a fragment definition."
2504
- },
2505
- FRAGMENT_SPREAD: {
2506
- value: DirectiveLocation.FRAGMENT_SPREAD,
2507
- description: "Location adjacent to a fragment spread."
2508
- },
2509
- INLINE_FRAGMENT: {
2510
- value: DirectiveLocation.INLINE_FRAGMENT,
2511
- description: "Location adjacent to an inline fragment."
2512
- },
2513
- VARIABLE_DEFINITION: {
2514
- value: DirectiveLocation.VARIABLE_DEFINITION,
2515
- description: "Location adjacent to a variable definition."
2516
- },
2517
- SCHEMA: {
2518
- value: DirectiveLocation.SCHEMA,
2519
- description: "Location adjacent to a schema definition."
2520
- },
2521
- SCALAR: {
2522
- value: DirectiveLocation.SCALAR,
2523
- description: "Location adjacent to a scalar definition."
2524
- },
2525
- OBJECT: {
2526
- value: DirectiveLocation.OBJECT,
2527
- description: "Location adjacent to an object type definition."
2528
- },
2529
- FIELD_DEFINITION: {
2530
- value: DirectiveLocation.FIELD_DEFINITION,
2531
- description: "Location adjacent to a field definition."
2532
- },
2533
- ARGUMENT_DEFINITION: {
2534
- value: DirectiveLocation.ARGUMENT_DEFINITION,
2535
- description: "Location adjacent to an argument definition."
2536
- },
2537
- INTERFACE: {
2538
- value: DirectiveLocation.INTERFACE,
2539
- description: "Location adjacent to an interface definition."
2540
- },
2541
- UNION: {
2542
- value: DirectiveLocation.UNION,
2543
- description: "Location adjacent to a union definition."
2544
- },
2545
- ENUM: {
2546
- value: DirectiveLocation.ENUM,
2547
- description: "Location adjacent to an enum definition."
2548
- },
2549
- ENUM_VALUE: {
2550
- value: DirectiveLocation.ENUM_VALUE,
2551
- description: "Location adjacent to an enum value definition."
2552
- },
2553
- INPUT_OBJECT: {
2554
- value: DirectiveLocation.INPUT_OBJECT,
2555
- description: "Location adjacent to an input object type definition."
2556
- },
2557
- INPUT_FIELD_DEFINITION: {
2558
- value: DirectiveLocation.INPUT_FIELD_DEFINITION,
2559
- description: "Location adjacent to an input object field definition."
2560
- }
486
+ ],
487
+ exports: [GRAPHQL_SCHEMA, GRAPHQL_OPTIONS, "GraphQLHandler"]
488
+ };
2561
489
  }
2562
- });
2563
- var __Type = new GraphQLObjectType({
2564
- name: "__Type",
2565
- description: "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",
2566
- fields: () => ({
2567
- kind: {
2568
- type: new GraphQLNonNull(__TypeKind),
2569
- resolve(type) {
2570
- if (isScalarType(type)) {
2571
- return TypeKind.SCALAR;
2572
- }
2573
- if (isObjectType(type)) {
2574
- return TypeKind.OBJECT;
2575
- }
2576
- if (isInterfaceType(type)) {
2577
- return TypeKind.INTERFACE;
2578
- }
2579
- if (isUnionType(type)) {
2580
- return TypeKind.UNION;
2581
- }
2582
- if (isEnumType(type)) {
2583
- return TypeKind.ENUM;
2584
- }
2585
- if (isInputObjectType(type)) {
2586
- return TypeKind.INPUT_OBJECT;
2587
- }
2588
- if (isListType(type)) {
2589
- return TypeKind.LIST;
2590
- }
2591
- if (isNonNullType(type)) {
2592
- return TypeKind.NON_NULL;
2593
- }
2594
- invariant(false, `Unexpected type: "${inspect(type)}".`);
2595
- }
2596
- },
2597
- name: {
2598
- type: GraphQLString,
2599
- resolve: (type) => ("name" in type) ? type.name : undefined
2600
- },
2601
- description: {
2602
- type: GraphQLString,
2603
- resolve: (type) => ("description" in type) ? type.description : undefined
2604
- },
2605
- specifiedByURL: {
2606
- type: GraphQLString,
2607
- resolve: (obj) => ("specifiedByURL" in obj) ? obj.specifiedByURL : undefined
2608
- },
2609
- fields: {
2610
- type: new GraphQLList(new GraphQLNonNull(__Field)),
2611
- args: {
2612
- includeDeprecated: {
2613
- type: GraphQLBoolean,
2614
- defaultValue: false
2615
- }
2616
- },
2617
- resolve(type, { includeDeprecated }) {
2618
- if (isObjectType(type) || isInterfaceType(type)) {
2619
- const fields = Object.values(type.getFields());
2620
- return includeDeprecated ? fields : fields.filter((field) => field.deprecationReason == null);
2621
- }
2622
- }
2623
- },
2624
- interfaces: {
2625
- type: new GraphQLList(new GraphQLNonNull(__Type)),
2626
- resolve(type) {
2627
- if (isObjectType(type) || isInterfaceType(type)) {
2628
- return type.getInterfaces();
2629
- }
2630
- }
2631
- },
2632
- possibleTypes: {
2633
- type: new GraphQLList(new GraphQLNonNull(__Type)),
2634
- resolve(type, _args, _context, { schema }) {
2635
- if (isAbstractType(type)) {
2636
- return schema.getPossibleTypes(type);
2637
- }
2638
- }
2639
- },
2640
- enumValues: {
2641
- type: new GraphQLList(new GraphQLNonNull(__EnumValue)),
2642
- args: {
2643
- includeDeprecated: {
2644
- type: GraphQLBoolean,
2645
- defaultValue: false
2646
- }
2647
- },
2648
- resolve(type, { includeDeprecated }) {
2649
- if (isEnumType(type)) {
2650
- const values = type.getValues();
2651
- return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null);
2652
- }
2653
- }
2654
- },
2655
- inputFields: {
2656
- type: new GraphQLList(new GraphQLNonNull(__InputValue)),
2657
- args: {
2658
- includeDeprecated: {
2659
- type: GraphQLBoolean,
2660
- defaultValue: false
2661
- }
2662
- },
2663
- resolve(type, { includeDeprecated }) {
2664
- if (isInputObjectType(type)) {
2665
- const values = Object.values(type.getFields());
2666
- return includeDeprecated ? values : values.filter((field) => field.deprecationReason == null);
2667
- }
2668
- }
2669
- },
2670
- ofType: {
2671
- type: __Type,
2672
- resolve: (type) => ("ofType" in type) ? type.ofType : undefined
2673
- },
2674
- isOneOf: {
2675
- type: GraphQLBoolean,
2676
- resolve: (type) => {
2677
- if (isInputObjectType(type)) {
2678
- return type.isOneOf;
2679
- }
2680
- }
2681
- }
2682
- })
2683
- });
2684
- var __Field = new GraphQLObjectType({
2685
- name: "__Field",
2686
- description: "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",
2687
- fields: () => ({
2688
- name: {
2689
- type: new GraphQLNonNull(GraphQLString),
2690
- resolve: (field) => field.name
2691
- },
2692
- description: {
2693
- type: GraphQLString,
2694
- resolve: (field) => field.description
2695
- },
2696
- args: {
2697
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__InputValue))),
2698
- args: {
2699
- includeDeprecated: {
2700
- type: GraphQLBoolean,
2701
- defaultValue: false
490
+ static forRootAsync(options) {
491
+ return {
492
+ module: GraphQLModule,
493
+ global: true,
494
+ imports: options.imports || [],
495
+ providers: [
496
+ {
497
+ provide: GRAPHQL_OPTIONS,
498
+ useFactory: options.useFactory,
499
+ inject: options.inject || []
500
+ },
501
+ {
502
+ provide: GRAPHQL_SCHEMA,
503
+ useFactory: (opts) => {
504
+ const resolvers = opts.resolvers || [];
505
+ for (const resolver of resolvers) {
506
+ const instance = new resolver;
507
+ this.schemaBuilder.addResolver(instance);
508
+ }
509
+ return this.schemaBuilder.build();
510
+ },
511
+ inject: [GRAPHQL_OPTIONS]
512
+ },
513
+ {
514
+ provide: "GraphQLHandler",
515
+ useFactory: (schema, opts) => {
516
+ return new GraphQLHandler(schema, opts);
517
+ },
518
+ inject: [GRAPHQL_SCHEMA, GRAPHQL_OPTIONS]
2702
519
  }
2703
- },
2704
- resolve(field, { includeDeprecated }) {
2705
- return includeDeprecated ? field.args : field.args.filter((arg) => arg.deprecationReason == null);
2706
- }
2707
- },
2708
- type: {
2709
- type: new GraphQLNonNull(__Type),
2710
- resolve: (field) => field.type
2711
- },
2712
- isDeprecated: {
2713
- type: new GraphQLNonNull(GraphQLBoolean),
2714
- resolve: (field) => field.deprecationReason != null
2715
- },
2716
- deprecationReason: {
2717
- type: GraphQLString,
2718
- resolve: (field) => field.deprecationReason
2719
- }
2720
- })
2721
- });
2722
- var __InputValue = new GraphQLObjectType({
2723
- name: "__InputValue",
2724
- description: "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",
2725
- fields: () => ({
2726
- name: {
2727
- type: new GraphQLNonNull(GraphQLString),
2728
- resolve: (inputValue) => inputValue.name
2729
- },
2730
- description: {
2731
- type: GraphQLString,
2732
- resolve: (inputValue) => inputValue.description
2733
- },
2734
- type: {
2735
- type: new GraphQLNonNull(__Type),
2736
- resolve: (inputValue) => inputValue.type
2737
- },
2738
- defaultValue: {
2739
- type: GraphQLString,
2740
- description: "A GraphQL-formatted string representing the default value for this input value.",
2741
- resolve(inputValue) {
2742
- const { type, defaultValue } = inputValue;
2743
- const valueAST = astFromValue(defaultValue, type);
2744
- return valueAST ? print(valueAST) : null;
2745
- }
2746
- },
2747
- isDeprecated: {
2748
- type: new GraphQLNonNull(GraphQLBoolean),
2749
- resolve: (field) => field.deprecationReason != null
2750
- },
2751
- deprecationReason: {
2752
- type: GraphQLString,
2753
- resolve: (obj) => obj.deprecationReason
2754
- }
2755
- })
2756
- });
2757
- var __EnumValue = new GraphQLObjectType({
2758
- name: "__EnumValue",
2759
- description: "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",
2760
- fields: () => ({
2761
- name: {
2762
- type: new GraphQLNonNull(GraphQLString),
2763
- resolve: (enumValue) => enumValue.name
2764
- },
2765
- description: {
2766
- type: GraphQLString,
2767
- resolve: (enumValue) => enumValue.description
2768
- },
2769
- isDeprecated: {
2770
- type: new GraphQLNonNull(GraphQLBoolean),
2771
- resolve: (enumValue) => enumValue.deprecationReason != null
2772
- },
2773
- deprecationReason: {
2774
- type: GraphQLString,
2775
- resolve: (enumValue) => enumValue.deprecationReason
2776
- }
2777
- })
2778
- });
2779
- var TypeKind;
2780
- (function(TypeKind) {
2781
- TypeKind["SCALAR"] = "SCALAR";
2782
- TypeKind["OBJECT"] = "OBJECT";
2783
- TypeKind["INTERFACE"] = "INTERFACE";
2784
- TypeKind["UNION"] = "UNION";
2785
- TypeKind["ENUM"] = "ENUM";
2786
- TypeKind["INPUT_OBJECT"] = "INPUT_OBJECT";
2787
- TypeKind["LIST"] = "LIST";
2788
- TypeKind["NON_NULL"] = "NON_NULL";
2789
- })(TypeKind || (TypeKind = {}));
2790
- var __TypeKind = new GraphQLEnumType({
2791
- name: "__TypeKind",
2792
- description: "An enum describing what kind of type a given `__Type` is.",
2793
- values: {
2794
- SCALAR: {
2795
- value: TypeKind.SCALAR,
2796
- description: "Indicates this type is a scalar."
2797
- },
2798
- OBJECT: {
2799
- value: TypeKind.OBJECT,
2800
- description: "Indicates this type is an object. `fields` and `interfaces` are valid fields."
2801
- },
2802
- INTERFACE: {
2803
- value: TypeKind.INTERFACE,
2804
- description: "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."
2805
- },
2806
- UNION: {
2807
- value: TypeKind.UNION,
2808
- description: "Indicates this type is a union. `possibleTypes` is a valid field."
2809
- },
2810
- ENUM: {
2811
- value: TypeKind.ENUM,
2812
- description: "Indicates this type is an enum. `enumValues` is a valid field."
2813
- },
2814
- INPUT_OBJECT: {
2815
- value: TypeKind.INPUT_OBJECT,
2816
- description: "Indicates this type is an input object. `inputFields` is a valid field."
2817
- },
2818
- LIST: {
2819
- value: TypeKind.LIST,
2820
- description: "Indicates this type is a list. `ofType` is a valid field."
2821
- },
2822
- NON_NULL: {
2823
- value: TypeKind.NON_NULL,
2824
- description: "Indicates this type is a non-null. `ofType` is a valid field."
2825
- }
520
+ ],
521
+ exports: [GRAPHQL_SCHEMA, GRAPHQL_OPTIONS, "GraphQLHandler"]
522
+ };
2826
523
  }
2827
- });
2828
- var SchemaMetaFieldDef = {
2829
- name: "__schema",
2830
- type: new GraphQLNonNull(__Schema),
2831
- description: "Access the current type schema of this server.",
2832
- args: [],
2833
- resolve: (_source, _args, _context, { schema }) => schema,
2834
- deprecationReason: undefined,
2835
- extensions: Object.create(null),
2836
- astNode: undefined
2837
- };
2838
- var TypeMetaFieldDef = {
2839
- name: "__type",
2840
- type: __Type,
2841
- description: "Request the type information of a single type.",
2842
- args: [
2843
- {
2844
- name: "name",
2845
- description: undefined,
2846
- type: new GraphQLNonNull(GraphQLString),
2847
- defaultValue: undefined,
2848
- deprecationReason: undefined,
2849
- extensions: Object.create(null),
2850
- astNode: undefined
2851
- }
2852
- ],
2853
- resolve: (_source, { name }, _context, { schema }) => schema.getType(name),
2854
- deprecationReason: undefined,
2855
- extensions: Object.create(null),
2856
- astNode: undefined
2857
- };
2858
- var TypeNameMetaFieldDef = {
2859
- name: "__typename",
2860
- type: new GraphQLNonNull(GraphQLString),
2861
- description: "The name of the current Object type at runtime.",
2862
- args: [],
2863
- resolve: (_source, _args, _context, { parentType }) => parentType.name,
2864
- deprecationReason: undefined,
2865
- extensions: Object.create(null),
2866
- astNode: undefined
2867
- };
2868
- var introspectionTypes = Object.freeze([
2869
- __Schema,
2870
- __Directive,
2871
- __DirectiveLocation,
2872
- __Type,
2873
- __Field,
2874
- __InputValue,
2875
- __EnumValue,
2876
- __TypeKind
2877
- ]);
2878
- function isIntrospectionType(type) {
2879
- return introspectionTypes.some(({ name }) => type.name === name);
2880
524
  }
2881
525
 
2882
- // ../../node_modules/graphql/type/schema.mjs
2883
- class GraphQLSchema {
2884
- constructor(config) {
2885
- var _config$extensionASTN, _config$directives;
2886
- this.__validationErrors = config.assumeValid === true ? [] : undefined;
2887
- isObjectLike(config) || devAssert(false, "Must provide configuration object.");
2888
- !config.types || Array.isArray(config.types) || devAssert(false, `"types" must be Array if provided but got: ${inspect(config.types)}.`);
2889
- !config.directives || Array.isArray(config.directives) || devAssert(false, '"directives" must be Array if provided but got: ' + `${inspect(config.directives)}.`);
2890
- this.description = config.description;
2891
- this.extensions = toObjMap(config.extensions);
2892
- this.astNode = config.astNode;
2893
- this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== undefined ? _config$extensionASTN : [];
2894
- this._queryType = config.query;
2895
- this._mutationType = config.mutation;
2896
- this._subscriptionType = config.subscription;
2897
- this._directives = (_config$directives = config.directives) !== null && _config$directives !== undefined ? _config$directives : specifiedDirectives;
2898
- const allReferencedTypes = new Set(config.types);
2899
- if (config.types != null) {
2900
- for (const type of config.types) {
2901
- allReferencedTypes.delete(type);
2902
- collectReferencedTypes(type, allReferencedTypes);
2903
- }
2904
- }
2905
- if (this._queryType != null) {
2906
- collectReferencedTypes(this._queryType, allReferencedTypes);
526
+ class GraphQLHandler {
527
+ schema;
528
+ options;
529
+ constructor(schema, options) {
530
+ this.schema = schema;
531
+ this.options = options;
532
+ }
533
+ createLoaderContext() {
534
+ const ctx = new DataLoaderContext;
535
+ const loaders = this.options.loaders || {};
536
+ for (const [name, factory] of Object.entries(loaders)) {
537
+ ctx.registerLoader(name, factory);
2907
538
  }
2908
- if (this._mutationType != null) {
2909
- collectReferencedTypes(this._mutationType, allReferencedTypes);
539
+ return ctx;
540
+ }
541
+ async handle(request) {
542
+ const url = new URL(request.url);
543
+ const path = this.options.path || "/graphql";
544
+ if (url.pathname !== path) {
545
+ return new Response("Not Found", { status: 404 });
2910
546
  }
2911
- if (this._subscriptionType != null) {
2912
- collectReferencedTypes(this._subscriptionType, allReferencedTypes);
547
+ if (request.method === "GET" && this.options.playground) {
548
+ return this.servePlayground();
2913
549
  }
2914
- for (const directive of this._directives) {
2915
- if (isDirective(directive)) {
2916
- for (const arg of directive.args) {
2917
- collectReferencedTypes(arg.type, allReferencedTypes);
2918
- }
2919
- }
550
+ if (request.method !== "POST") {
551
+ return new Response("Method Not Allowed", { status: 405 });
2920
552
  }
2921
- collectReferencedTypes(__Schema, allReferencedTypes);
2922
- this._typeMap = Object.create(null);
2923
- this._subTypeMap = Object.create(null);
2924
- this._implementationsMap = Object.create(null);
2925
- for (const namedType of allReferencedTypes) {
2926
- if (namedType == null) {
2927
- continue;
2928
- }
2929
- const typeName = namedType.name;
2930
- typeName || devAssert(false, "One of the provided types for building the Schema is missing a name.");
2931
- if (this._typeMap[typeName] !== undefined) {
2932
- throw new Error(`Schema must contain uniquely named types but contains multiple types named "${typeName}".`);
553
+ try {
554
+ const body = await request.json();
555
+ const { query, variables, operationName } = body;
556
+ const loaderContext = this.createLoaderContext();
557
+ const userContext = this.options.context ? await this.options.context({ request }) : {};
558
+ const context = {
559
+ request,
560
+ loaders: loaderContext,
561
+ ...userContext
562
+ };
563
+ const document = parse(query);
564
+ const validationErrors = validate(this.schema, document);
565
+ if (validationErrors.length > 0) {
566
+ return new Response(JSON.stringify({
567
+ errors: validationErrors.map((e) => this.formatError(e))
568
+ }), {
569
+ status: 400,
570
+ headers: { "Content-Type": "application/json" }
571
+ });
2933
572
  }
2934
- this._typeMap[typeName] = namedType;
2935
- if (isInterfaceType(namedType)) {
2936
- for (const iface of namedType.getInterfaces()) {
2937
- if (isInterfaceType(iface)) {
2938
- let implementations = this._implementationsMap[iface.name];
2939
- if (implementations === undefined) {
2940
- implementations = this._implementationsMap[iface.name] = {
2941
- objects: [],
2942
- interfaces: []
2943
- };
2944
- }
2945
- implementations.interfaces.push(namedType);
2946
- }
2947
- }
2948
- } else if (isObjectType(namedType)) {
2949
- for (const iface of namedType.getInterfaces()) {
2950
- if (isInterfaceType(iface)) {
2951
- let implementations = this._implementationsMap[iface.name];
2952
- if (implementations === undefined) {
2953
- implementations = this._implementationsMap[iface.name] = {
2954
- objects: [],
2955
- interfaces: []
2956
- };
2957
- }
2958
- implementations.objects.push(namedType);
2959
- }
2960
- }
573
+ const result = await execute({
574
+ schema: this.schema,
575
+ document,
576
+ contextValue: context,
577
+ variableValues: variables,
578
+ operationName
579
+ });
580
+ if (result.errors) {
581
+ result.errors = result.errors.map((e) => this.formatError(e));
2961
582
  }
583
+ return new Response(JSON.stringify(result), {
584
+ headers: { "Content-Type": "application/json" }
585
+ });
586
+ } catch (error) {
587
+ return new Response(JSON.stringify({
588
+ errors: [this.formatError(error)]
589
+ }), {
590
+ status: 500,
591
+ headers: { "Content-Type": "application/json" }
592
+ });
2962
593
  }
2963
594
  }
2964
- get [Symbol.toStringTag]() {
2965
- return "GraphQLSchema";
2966
- }
2967
- getQueryType() {
2968
- return this._queryType;
2969
- }
2970
- getMutationType() {
2971
- return this._mutationType;
2972
- }
2973
- getSubscriptionType() {
2974
- return this._subscriptionType;
2975
- }
2976
- getRootType(operation) {
2977
- switch (operation) {
2978
- case OperationTypeNode.QUERY:
2979
- return this.getQueryType();
2980
- case OperationTypeNode.MUTATION:
2981
- return this.getMutationType();
2982
- case OperationTypeNode.SUBSCRIPTION:
2983
- return this.getSubscriptionType();
2984
- }
2985
- }
2986
- getTypeMap() {
2987
- return this._typeMap;
2988
- }
2989
- getType(name) {
2990
- return this.getTypeMap()[name];
2991
- }
2992
- getPossibleTypes(abstractType) {
2993
- return isUnionType(abstractType) ? abstractType.getTypes() : this.getImplementations(abstractType).objects;
2994
- }
2995
- getImplementations(interfaceType) {
2996
- const implementations = this._implementationsMap[interfaceType.name];
2997
- return implementations !== null && implementations !== undefined ? implementations : {
2998
- objects: [],
2999
- interfaces: []
3000
- };
3001
- }
3002
- isSubType(abstractType, maybeSubType) {
3003
- let map = this._subTypeMap[abstractType.name];
3004
- if (map === undefined) {
3005
- map = Object.create(null);
3006
- if (isUnionType(abstractType)) {
3007
- for (const type of abstractType.getTypes()) {
3008
- map[type.name] = true;
3009
- }
3010
- } else {
3011
- const implementations = this.getImplementations(abstractType);
3012
- for (const type of implementations.objects) {
3013
- map[type.name] = true;
3014
- }
3015
- for (const type of implementations.interfaces) {
3016
- map[type.name] = true;
3017
- }
3018
- }
3019
- this._subTypeMap[abstractType.name] = map;
595
+ formatError(error) {
596
+ if (this.options.formatError) {
597
+ return this.options.formatError(error);
3020
598
  }
3021
- return map[maybeSubType.name] !== undefined;
3022
- }
3023
- getDirectives() {
3024
- return this._directives;
3025
- }
3026
- getDirective(name) {
3027
- return this.getDirectives().find((directive) => directive.name === name);
3028
- }
3029
- toConfig() {
3030
599
  return {
3031
- description: this.description,
3032
- query: this.getQueryType(),
3033
- mutation: this.getMutationType(),
3034
- subscription: this.getSubscriptionType(),
3035
- types: Object.values(this.getTypeMap()),
3036
- directives: this.getDirectives(),
3037
- extensions: this.extensions,
3038
- astNode: this.astNode,
3039
- extensionASTNodes: this.extensionASTNodes,
3040
- assumeValid: this.__validationErrors !== undefined
600
+ message: error.message,
601
+ locations: error.locations,
602
+ path: error.path
3041
603
  };
3042
604
  }
3043
- }
3044
- function collectReferencedTypes(type, typeSet) {
3045
- const namedType = getNamedType(type);
3046
- if (!typeSet.has(namedType)) {
3047
- typeSet.add(namedType);
3048
- if (isUnionType(namedType)) {
3049
- for (const memberType of namedType.getTypes()) {
3050
- collectReferencedTypes(memberType, typeSet);
3051
- }
3052
- } else if (isObjectType(namedType) || isInterfaceType(namedType)) {
3053
- for (const interfaceType of namedType.getInterfaces()) {
3054
- collectReferencedTypes(interfaceType, typeSet);
3055
- }
3056
- for (const field of Object.values(namedType.getFields())) {
3057
- collectReferencedTypes(field.type, typeSet);
3058
- for (const arg of field.args) {
3059
- collectReferencedTypes(arg.type, typeSet);
3060
- }
3061
- }
3062
- } else if (isInputObjectType(namedType)) {
3063
- for (const field of Object.values(namedType.getFields())) {
3064
- collectReferencedTypes(field.type, typeSet);
3065
- }
3066
- }
3067
- }
3068
- return typeSet;
3069
- }
3070
- // ../../node_modules/graphql/utilities/printSchema.mjs
3071
- function printSchema(schema) {
3072
- return printFilteredSchema(schema, (n) => !isSpecifiedDirective(n), isDefinedType);
3073
- }
3074
- function isDefinedType(type) {
3075
- return !isSpecifiedScalarType(type) && !isIntrospectionType(type);
3076
- }
3077
- function printFilteredSchema(schema, directiveFilter, typeFilter) {
3078
- const directives = schema.getDirectives().filter(directiveFilter);
3079
- const types = Object.values(schema.getTypeMap()).filter(typeFilter);
3080
- return [
3081
- printSchemaDefinition(schema),
3082
- ...directives.map((directive) => printDirective(directive)),
3083
- ...types.map((type) => printType(type))
3084
- ].filter(Boolean).join(`
3085
-
3086
- `);
3087
- }
3088
- function printSchemaDefinition(schema) {
3089
- if (schema.description == null && isSchemaOfCommonNames(schema)) {
3090
- return;
3091
- }
3092
- const operationTypes = [];
3093
- const queryType = schema.getQueryType();
3094
- if (queryType) {
3095
- operationTypes.push(` query: ${queryType.name}`);
3096
- }
3097
- const mutationType = schema.getMutationType();
3098
- if (mutationType) {
3099
- operationTypes.push(` mutation: ${mutationType.name}`);
3100
- }
3101
- const subscriptionType = schema.getSubscriptionType();
3102
- if (subscriptionType) {
3103
- operationTypes.push(` subscription: ${subscriptionType.name}`);
3104
- }
3105
- return printDescription(schema) + `schema {
3106
- ${operationTypes.join(`
3107
- `)}
3108
- }`;
3109
- }
3110
- function isSchemaOfCommonNames(schema) {
3111
- const queryType = schema.getQueryType();
3112
- if (queryType && queryType.name !== "Query") {
3113
- return false;
3114
- }
3115
- const mutationType = schema.getMutationType();
3116
- if (mutationType && mutationType.name !== "Mutation") {
3117
- return false;
3118
- }
3119
- const subscriptionType = schema.getSubscriptionType();
3120
- if (subscriptionType && subscriptionType.name !== "Subscription") {
3121
- return false;
3122
- }
3123
- return true;
3124
- }
3125
- function printType(type) {
3126
- if (isScalarType(type)) {
3127
- return printScalar(type);
3128
- }
3129
- if (isObjectType(type)) {
3130
- return printObject(type);
3131
- }
3132
- if (isInterfaceType(type)) {
3133
- return printInterface(type);
3134
- }
3135
- if (isUnionType(type)) {
3136
- return printUnion(type);
3137
- }
3138
- if (isEnumType(type)) {
3139
- return printEnum(type);
3140
- }
3141
- if (isInputObjectType(type)) {
3142
- return printInputObject(type);
3143
- }
3144
- invariant(false, "Unexpected type: " + inspect(type));
3145
- }
3146
- function printScalar(type) {
3147
- return printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type);
3148
- }
3149
- function printImplementedInterfaces(type) {
3150
- const interfaces = type.getInterfaces();
3151
- return interfaces.length ? " implements " + interfaces.map((i) => i.name).join(" & ") : "";
3152
- }
3153
- function printObject(type) {
3154
- return printDescription(type) + `type ${type.name}` + printImplementedInterfaces(type) + printFields(type);
3155
- }
3156
- function printInterface(type) {
3157
- return printDescription(type) + `interface ${type.name}` + printImplementedInterfaces(type) + printFields(type);
3158
- }
3159
- function printUnion(type) {
3160
- const types = type.getTypes();
3161
- const possibleTypes = types.length ? " = " + types.join(" | ") : "";
3162
- return printDescription(type) + "union " + type.name + possibleTypes;
3163
- }
3164
- function printEnum(type) {
3165
- const values = type.getValues().map((value, i) => printDescription(value, " ", !i) + " " + value.name + printDeprecated(value.deprecationReason));
3166
- return printDescription(type) + `enum ${type.name}` + printBlock(values);
3167
- }
3168
- function printInputObject(type) {
3169
- const fields = Object.values(type.getFields()).map((f, i) => printDescription(f, " ", !i) + " " + printInputValue(f));
3170
- return printDescription(type) + `input ${type.name}` + (type.isOneOf ? " @oneOf" : "") + printBlock(fields);
3171
- }
3172
- function printFields(type) {
3173
- const fields = Object.values(type.getFields()).map((f, i) => printDescription(f, " ", !i) + " " + f.name + printArgs(f.args, " ") + ": " + String(f.type) + printDeprecated(f.deprecationReason));
3174
- return printBlock(fields);
3175
- }
3176
- function printBlock(items) {
3177
- return items.length !== 0 ? ` {
3178
- ` + items.join(`
3179
- `) + `
3180
- }` : "";
3181
- }
3182
- function printArgs(args, indentation = "") {
3183
- if (args.length === 0) {
3184
- return "";
3185
- }
3186
- if (args.every((arg) => !arg.description)) {
3187
- return "(" + args.map(printInputValue).join(", ") + ")";
3188
- }
3189
- return `(
3190
- ` + args.map((arg, i) => printDescription(arg, " " + indentation, !i) + " " + indentation + printInputValue(arg)).join(`
3191
- `) + `
3192
- ` + indentation + ")";
3193
- }
3194
- function printInputValue(arg) {
3195
- const defaultAST = astFromValue(arg.defaultValue, arg.type);
3196
- let argDecl = arg.name + ": " + String(arg.type);
3197
- if (defaultAST) {
3198
- argDecl += ` = ${print(defaultAST)}`;
3199
- }
3200
- return argDecl + printDeprecated(arg.deprecationReason);
3201
- }
3202
- function printDirective(directive) {
3203
- return printDescription(directive) + "directive @" + directive.name + printArgs(directive.args) + (directive.isRepeatable ? " repeatable" : "") + " on " + directive.locations.join(" | ");
3204
- }
3205
- function printDeprecated(reason) {
3206
- if (reason == null) {
3207
- return "";
3208
- }
3209
- if (reason !== DEFAULT_DEPRECATION_REASON) {
3210
- const astValue = print({
3211
- kind: Kind.STRING,
3212
- value: reason
605
+ servePlayground() {
606
+ const html = `
607
+ <!DOCTYPE html>
608
+ <html>
609
+ <head>
610
+ <title>GraphQL Playground</title>
611
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphiql@3/graphiql.min.css" />
612
+ </head>
613
+ <body style="margin: 0;">
614
+ <div id="graphiql" style="height: 100vh;"></div>
615
+ <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
616
+ <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
617
+ <script crossorigin src="https://cdn.jsdelivr.net/npm/graphiql@3/graphiql.min.js"></script>
618
+ <script>
619
+ const fetcher = GraphiQL.createFetcher({ url: '${this.options.path || "/graphql"}' });
620
+ ReactDOM.createRoot(document.getElementById('graphiql')).render(
621
+ React.createElement(GraphiQL, { fetcher })
622
+ );
623
+ </script>
624
+ </body>
625
+ </html>`;
626
+ return new Response(html, {
627
+ headers: { "Content-Type": "text/html" }
3213
628
  });
3214
- return ` @deprecated(reason: ${astValue})`;
3215
- }
3216
- return " @deprecated";
3217
- }
3218
- function printSpecifiedByURL(scalar) {
3219
- if (scalar.specifiedByURL == null) {
3220
- return "";
3221
- }
3222
- const astValue = print({
3223
- kind: Kind.STRING,
3224
- value: scalar.specifiedByURL
3225
- });
3226
- return ` @specifiedBy(url: ${astValue})`;
3227
- }
3228
- function printDescription(def, indentation = "", firstInBlock = true) {
3229
- const { description } = def;
3230
- if (description == null) {
3231
- return "";
3232
629
  }
3233
- const blockString = print({
3234
- kind: Kind.STRING,
3235
- value: description,
3236
- block: isPrintableAsBlockString(description)
3237
- });
3238
- const prefix = indentation && !firstInBlock ? `
3239
- ` + indentation : indentation;
3240
- return prefix + blockString.replace(/\n/g, `
3241
- ` + indentation) + `
3242
- `;
3243
630
  }
631
+ // ../graphql/src/subscriptions/websocket-server.ts
632
+ import { parse as parse2, validate as validate2, subscribe } from "graphql";
633
+ // ../graphql/src/scalars.ts
634
+ var ID = Symbol("ID");
635
+ var Int = Symbol("Int");
636
+ var Float = Symbol("Float");
3244
637
  // src/schema/federation-schema-builder.ts
3245
- import { SchemaBuilder } from "@galaxy-stack/orbit-graphql";
3246
638
  class FederationSchemaBuilder extends SchemaBuilder {
3247
639
  entityTypes = new Map;
3248
640
  referenceResolvers = new Map;
@@ -3254,13 +646,13 @@ class FederationSchemaBuilder extends SchemaBuilder {
3254
646
  const queryType = schema.getQueryType();
3255
647
  const mutationType = schema.getMutationType();
3256
648
  const subscriptionType = schema.getSubscriptionType();
3257
- const _Any = GraphQLString;
649
+ const _Any = GraphQLString2;
3258
650
  let federatedSchemaRef;
3259
- const _Service = new GraphQLObjectType({
651
+ const _Service = new GraphQLObjectType2({
3260
652
  name: "_Service",
3261
653
  fields: {
3262
654
  sdl: {
3263
- type: GraphQLString,
655
+ type: GraphQLString2,
3264
656
  resolve: () => this.generateFederatedSDL(federatedSchemaRef ?? schema)
3265
657
  }
3266
658
  }
@@ -3290,15 +682,15 @@ class FederationSchemaBuilder extends SchemaBuilder {
3290
682
  }
3291
683
  }
3292
684
  federatedQueryFields["_service"] = {
3293
- type: new GraphQLNonNull(_Service),
685
+ type: new GraphQLNonNull2(_Service),
3294
686
  resolve: () => ({})
3295
687
  };
3296
688
  if (_Entity && entities.length > 0) {
3297
689
  federatedQueryFields["_entities"] = {
3298
- type: new GraphQLNonNull(new GraphQLList(_Entity)),
690
+ type: new GraphQLNonNull2(new GraphQLList2(_Entity)),
3299
691
  args: {
3300
692
  representations: {
3301
- type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString)))
693
+ type: new GraphQLNonNull2(new GraphQLList2(new GraphQLNonNull2(GraphQLString2)))
3302
694
  }
3303
695
  },
3304
696
  resolve: async (_, { representations }) => {
@@ -3318,11 +710,11 @@ class FederationSchemaBuilder extends SchemaBuilder {
3318
710
  }
3319
711
  };
3320
712
  }
3321
- const federatedQuery = new GraphQLObjectType({
713
+ const federatedQuery = new GraphQLObjectType2({
3322
714
  name: "Query",
3323
715
  fields: federatedQueryFields
3324
716
  });
3325
- federatedSchemaRef = new GraphQLSchema({
717
+ federatedSchemaRef = new GraphQLSchema4({
3326
718
  query: federatedQuery,
3327
719
  mutation: mutationType || undefined,
3328
720
  subscription: subscriptionType || undefined