@builtbystack/sq-shopify-theme-sdk 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.doc.md +9 -0
- package/README.md +768 -0
- package/dist/sq-shopify-theme-sdk.d.ts +92 -4
- package/dist/sq-shopify-theme-sdk.js +857 -701
- package/dist/sq-shopify-theme-sdk.umd.js +136 -37
- package/package.json +7 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
var He = Object.defineProperty;
|
|
2
|
+
var Ye = (e, t, n) => t in e ? He(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Ae = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
function ze(e, t) {
|
|
5
5
|
for (var n = 0; n < t.length; n++) {
|
|
6
6
|
const r = t[n];
|
|
7
7
|
if (typeof r != "string" && !Array.isArray(r)) {
|
|
@@ -17,44 +17,44 @@ function Xe(e, t) {
|
|
|
17
17
|
}
|
|
18
18
|
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const ge = JSON, Qe = (e) => e.toUpperCase(), Je = (e) => {
|
|
21
21
|
const t = {};
|
|
22
22
|
return e.forEach((n, r) => {
|
|
23
23
|
t[r] = n;
|
|
24
24
|
}), t;
|
|
25
|
-
},
|
|
25
|
+
}, Xe = (e, t, n) => e.document ? e : {
|
|
26
26
|
document: e,
|
|
27
27
|
variables: t,
|
|
28
28
|
requestHeaders: n,
|
|
29
29
|
signal: void 0
|
|
30
|
-
},
|
|
30
|
+
}, We = (e, t, n) => e.query ? e : {
|
|
31
31
|
query: e,
|
|
32
32
|
variables: t,
|
|
33
33
|
requestHeaders: n,
|
|
34
34
|
signal: void 0
|
|
35
|
-
},
|
|
35
|
+
}, Ze = (e, t) => e.documents ? e : {
|
|
36
36
|
documents: e,
|
|
37
37
|
requestHeaders: t,
|
|
38
38
|
signal: void 0
|
|
39
39
|
};
|
|
40
|
-
function
|
|
40
|
+
function Z(e, t) {
|
|
41
41
|
if (!!!e)
|
|
42
42
|
throw new Error(t);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ke(e) {
|
|
45
45
|
return typeof e == "object" && e !== null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function et(e, t) {
|
|
48
48
|
if (!!!e)
|
|
49
49
|
throw new Error(
|
|
50
50
|
t ?? "Unexpected invariant triggered."
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const tt = /\r\n|[\n\r]/g;
|
|
54
54
|
function de(e, t) {
|
|
55
55
|
let n = 0, r = 1;
|
|
56
|
-
for (const i of e.body.matchAll(
|
|
57
|
-
if (typeof i.index == "number" ||
|
|
56
|
+
for (const i of e.body.matchAll(tt)) {
|
|
57
|
+
if (typeof i.index == "number" || et(!1), i.index >= t)
|
|
58
58
|
break;
|
|
59
59
|
n = i.index + i[0].length, r += 1;
|
|
60
60
|
}
|
|
@@ -63,40 +63,40 @@ function de(e, t) {
|
|
|
63
63
|
column: t + 1 - n
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function nt(e) {
|
|
67
|
+
return _e(
|
|
68
68
|
e.source,
|
|
69
69
|
de(e.source, e.start)
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1,
|
|
74
|
-
`,
|
|
72
|
+
function _e(e, t) {
|
|
73
|
+
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, p = t.column + u, d = `${e.name}:${a}:${p}
|
|
74
|
+
`, m = r.split(/\r\n|[\n\r]/g), E = m[i];
|
|
75
75
|
if (E.length > 120) {
|
|
76
|
-
const
|
|
77
|
-
for (let
|
|
78
|
-
|
|
79
|
-
return d +
|
|
80
|
-
[`${
|
|
81
|
-
...
|
|
82
|
-
["|", "^".padStart(
|
|
83
|
-
["|",
|
|
76
|
+
const g = Math.floor(p / 80), N = p % 80, y = [];
|
|
77
|
+
for (let C = 0; C < E.length; C += 80)
|
|
78
|
+
y.push(E.slice(C, C + 80));
|
|
79
|
+
return d + Ne([
|
|
80
|
+
[`${a} |`, y[0]],
|
|
81
|
+
...y.slice(1, g + 1).map((C) => ["|", C]),
|
|
82
|
+
["|", "^".padStart(N)],
|
|
83
|
+
["|", y[g + 1]]
|
|
84
84
|
]);
|
|
85
85
|
}
|
|
86
|
-
return d +
|
|
86
|
+
return d + Ne([
|
|
87
87
|
// Lines specified like this: ["prefix", "string"],
|
|
88
|
-
[`${
|
|
89
|
-
[`${
|
|
90
|
-
["|", "^".padStart(
|
|
91
|
-
[`${
|
|
88
|
+
[`${a - 1} |`, m[i - 1]],
|
|
89
|
+
[`${a} |`, E],
|
|
90
|
+
["|", "^".padStart(p)],
|
|
91
|
+
[`${a + 1} |`, m[i + 1]]
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ne(e) {
|
|
95
95
|
const t = e.filter(([r, i]) => i !== void 0), n = Math.max(...t.map(([r]) => r.length));
|
|
96
96
|
return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
|
|
97
97
|
`);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function it(e) {
|
|
100
100
|
const t = e[0];
|
|
101
101
|
return t == null || "kind" in t || "length" in t ? {
|
|
102
102
|
nodes: t,
|
|
@@ -107,7 +107,7 @@ function ot(e) {
|
|
|
107
107
|
extensions: e[5]
|
|
108
108
|
} : t;
|
|
109
109
|
}
|
|
110
|
-
class
|
|
110
|
+
class Te extends Error {
|
|
111
111
|
/**
|
|
112
112
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
113
113
|
* which correspond to this error.
|
|
@@ -148,18 +148,18 @@ class ve extends Error {
|
|
|
148
148
|
*/
|
|
149
149
|
constructor(t, ...n) {
|
|
150
150
|
var r, i, s;
|
|
151
|
-
const { nodes:
|
|
152
|
-
super(t), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError =
|
|
153
|
-
Array.isArray(
|
|
151
|
+
const { nodes: a, source: u, positions: p, path: d, originalError: m, extensions: E } = it(n);
|
|
152
|
+
super(t), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = m ?? void 0, this.nodes = Ce(
|
|
153
|
+
Array.isArray(a) ? a : a ? [a] : void 0
|
|
154
154
|
);
|
|
155
|
-
const
|
|
156
|
-
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((
|
|
155
|
+
const g = Ce(
|
|
156
|
+
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((y) => y.loc).filter((y) => y != null)
|
|
157
157
|
);
|
|
158
|
-
this.source = u ?? (
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
) ?
|
|
162
|
-
this.extensions = (s = E ??
|
|
158
|
+
this.source = u ?? (g == null || (i = g[0]) === null || i === void 0 ? void 0 : i.source), this.positions = p ?? (g == null ? void 0 : g.map((y) => y.start)), this.locations = p && u ? p.map((y) => de(u, y)) : g == null ? void 0 : g.map((y) => de(y.source, y.start));
|
|
159
|
+
const N = Ke(
|
|
160
|
+
m == null ? void 0 : m.extensions
|
|
161
|
+
) ? m == null ? void 0 : m.extensions : void 0;
|
|
162
|
+
this.extensions = (s = E ?? N) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
163
163
|
message: {
|
|
164
164
|
writable: !0,
|
|
165
165
|
enumerable: !0
|
|
@@ -179,11 +179,11 @@ class ve extends Error {
|
|
|
179
179
|
originalError: {
|
|
180
180
|
enumerable: !1
|
|
181
181
|
}
|
|
182
|
-
}),
|
|
183
|
-
value:
|
|
182
|
+
}), m != null && m.stack ? Object.defineProperty(this, "stack", {
|
|
183
|
+
value: m.stack,
|
|
184
184
|
writable: !0,
|
|
185
185
|
configurable: !0
|
|
186
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
186
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, Te) : Object.defineProperty(this, "stack", {
|
|
187
187
|
value: Error().stack,
|
|
188
188
|
writable: !0,
|
|
189
189
|
configurable: !0
|
|
@@ -198,12 +198,12 @@ class ve extends Error {
|
|
|
198
198
|
for (const n of this.nodes)
|
|
199
199
|
n.loc && (t += `
|
|
200
200
|
|
|
201
|
-
` +
|
|
201
|
+
` + nt(n.loc));
|
|
202
202
|
else if (this.source && this.locations)
|
|
203
203
|
for (const n of this.locations)
|
|
204
204
|
t += `
|
|
205
205
|
|
|
206
|
-
` +
|
|
206
|
+
` + _e(this.source, n);
|
|
207
207
|
return t;
|
|
208
208
|
}
|
|
209
209
|
toJSON() {
|
|
@@ -213,16 +213,16 @@ class ve extends Error {
|
|
|
213
213
|
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Ce(e) {
|
|
217
217
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return new
|
|
219
|
+
function b(e, t, n) {
|
|
220
|
+
return new Te(`Syntax Error: ${n}`, {
|
|
221
221
|
source: e,
|
|
222
222
|
positions: [t]
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
class
|
|
225
|
+
class rt {
|
|
226
226
|
/**
|
|
227
227
|
* The character offset at which this Node begins.
|
|
228
228
|
*/
|
|
@@ -251,7 +251,7 @@ class at {
|
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
class
|
|
254
|
+
class ke {
|
|
255
255
|
/**
|
|
256
256
|
* The kind of Token.
|
|
257
257
|
*/
|
|
@@ -278,8 +278,8 @@ class Re {
|
|
|
278
278
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
279
279
|
* the last.
|
|
280
280
|
*/
|
|
281
|
-
constructor(t, n, r, i, s,
|
|
282
|
-
this.kind = t, this.start = n, this.end = r, this.line = i, this.column = s, this.value =
|
|
281
|
+
constructor(t, n, r, i, s, a) {
|
|
282
|
+
this.kind = t, this.start = n, this.end = r, this.line = i, this.column = s, this.value = a, this.prev = null, this.next = null;
|
|
283
283
|
}
|
|
284
284
|
get [Symbol.toStringTag]() {
|
|
285
285
|
return "Token";
|
|
@@ -293,7 +293,7 @@ class Re {
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
const
|
|
296
|
+
const Re = {
|
|
297
297
|
Name: [],
|
|
298
298
|
Document: ["definitions"],
|
|
299
299
|
OperationDefinition: [
|
|
@@ -367,10 +367,10 @@ const Le = {
|
|
|
367
367
|
UnionTypeExtension: ["name", "directives", "types"],
|
|
368
368
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
369
369
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
370
|
-
},
|
|
371
|
-
function
|
|
370
|
+
}, st = new Set(Object.keys(Re));
|
|
371
|
+
function xe(e) {
|
|
372
372
|
const t = e == null ? void 0 : e.kind;
|
|
373
|
-
return typeof t == "string" &&
|
|
373
|
+
return typeof t == "string" && st.has(t);
|
|
374
374
|
}
|
|
375
375
|
var M;
|
|
376
376
|
(function(e) {
|
|
@@ -384,55 +384,55 @@ var f;
|
|
|
384
384
|
(function(e) {
|
|
385
385
|
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
386
386
|
})(f || (f = {}));
|
|
387
|
-
function
|
|
387
|
+
function me(e) {
|
|
388
388
|
return e === 9 || e === 32;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function Y(e) {
|
|
391
391
|
return e >= 48 && e <= 57;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function Se(e) {
|
|
394
394
|
return e >= 97 && e <= 122 || // A-Z
|
|
395
395
|
e >= 65 && e <= 90;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
return
|
|
397
|
+
function we(e) {
|
|
398
|
+
return Se(e) || e === 95;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
return
|
|
400
|
+
function ot(e) {
|
|
401
|
+
return Se(e) || Y(e) || e === 95;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function at(e) {
|
|
404
404
|
var t;
|
|
405
405
|
let n = Number.MAX_SAFE_INTEGER, r = null, i = -1;
|
|
406
|
-
for (let
|
|
406
|
+
for (let a = 0; a < e.length; ++a) {
|
|
407
407
|
var s;
|
|
408
|
-
const u = e[
|
|
409
|
-
|
|
408
|
+
const u = e[a], p = ct(u);
|
|
409
|
+
p !== u.length && (r = (s = r) !== null && s !== void 0 ? s : a, i = a, a !== 0 && p < n && (n = p));
|
|
410
410
|
}
|
|
411
|
-
return e.map((
|
|
411
|
+
return e.map((a, u) => u === 0 ? a : a.slice(n)).slice(
|
|
412
412
|
(t = r) !== null && t !== void 0 ? t : 0,
|
|
413
413
|
i + 1
|
|
414
414
|
);
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function ct(e) {
|
|
417
417
|
let t = 0;
|
|
418
|
-
for (; t < e.length &&
|
|
418
|
+
for (; t < e.length && me(e.charCodeAt(t)); )
|
|
419
419
|
++t;
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((
|
|
424
|
-
(!i || e.length > 70 || d || s ||
|
|
422
|
+
function ut(e, t) {
|
|
423
|
+
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((N) => N.length === 0 || me(N.charCodeAt(0))), a = n.endsWith('\\"""'), u = e.endsWith('"') && !a, p = e.endsWith("\\"), d = u || p, m = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
424
|
+
(!i || e.length > 70 || d || s || a);
|
|
425
425
|
let E = "";
|
|
426
|
-
const
|
|
427
|
-
return (
|
|
428
|
-
`), E += n, (
|
|
426
|
+
const g = i && me(e.charCodeAt(0));
|
|
427
|
+
return (m && !g || s) && (E += `
|
|
428
|
+
`), E += n, (m || d) && (E += `
|
|
429
429
|
`), '"""' + E + '"""';
|
|
430
430
|
}
|
|
431
|
-
var
|
|
431
|
+
var c;
|
|
432
432
|
(function(e) {
|
|
433
433
|
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
434
|
-
})(
|
|
435
|
-
class
|
|
434
|
+
})(c || (c = {}));
|
|
435
|
+
class lt {
|
|
436
436
|
/**
|
|
437
437
|
* The previously focused non-ignored token.
|
|
438
438
|
*/
|
|
@@ -446,7 +446,7 @@ class dt {
|
|
|
446
446
|
* The character offset at which the current line begins.
|
|
447
447
|
*/
|
|
448
448
|
constructor(t) {
|
|
449
|
-
const n = new
|
|
449
|
+
const n = new ke(c.SOF, 0, 0, 0, 0);
|
|
450
450
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
451
451
|
}
|
|
452
452
|
get [Symbol.toStringTag]() {
|
|
@@ -464,48 +464,48 @@ class dt {
|
|
|
464
464
|
*/
|
|
465
465
|
lookahead() {
|
|
466
466
|
let t = this.token;
|
|
467
|
-
if (t.kind !==
|
|
467
|
+
if (t.kind !== c.EOF)
|
|
468
468
|
do
|
|
469
469
|
if (t.next)
|
|
470
470
|
t = t.next;
|
|
471
471
|
else {
|
|
472
|
-
const n =
|
|
472
|
+
const n = pt(this, t.end);
|
|
473
473
|
t.next = n, n.prev = t, t = n;
|
|
474
474
|
}
|
|
475
|
-
while (t.kind ===
|
|
475
|
+
while (t.kind === c.COMMENT);
|
|
476
476
|
return t;
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
return e ===
|
|
479
|
+
function ht(e) {
|
|
480
|
+
return e === c.BANG || e === c.DOLLAR || e === c.AMP || e === c.PAREN_L || e === c.PAREN_R || e === c.SPREAD || e === c.COLON || e === c.EQUALS || e === c.AT || e === c.BRACKET_L || e === c.BRACKET_R || e === c.BRACE_L || e === c.PIPE || e === c.BRACE_R;
|
|
481
481
|
}
|
|
482
482
|
function V(e) {
|
|
483
483
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
485
|
+
function se(e, t) {
|
|
486
|
+
return Pe(e.charCodeAt(t)) && Le(e.charCodeAt(t + 1));
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function Pe(e) {
|
|
489
489
|
return e >= 55296 && e <= 56319;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Le(e) {
|
|
492
492
|
return e >= 56320 && e <= 57343;
|
|
493
493
|
}
|
|
494
494
|
function F(e, t) {
|
|
495
495
|
const n = e.source.body.codePointAt(t);
|
|
496
496
|
if (n === void 0)
|
|
497
|
-
return
|
|
497
|
+
return c.EOF;
|
|
498
498
|
if (n >= 32 && n <= 126) {
|
|
499
499
|
const r = String.fromCodePoint(n);
|
|
500
500
|
return r === '"' ? `'"'` : `"${r}"`;
|
|
501
501
|
}
|
|
502
502
|
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
503
503
|
}
|
|
504
|
-
function
|
|
505
|
-
const s = e.line,
|
|
506
|
-
return new
|
|
504
|
+
function x(e, t, n, r, i) {
|
|
505
|
+
const s = e.line, a = 1 + n - e.lineStart;
|
|
506
|
+
return new ke(t, n, r, s, a, i);
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function pt(e, t) {
|
|
509
509
|
const n = e.source.body, r = n.length;
|
|
510
510
|
let i = t;
|
|
511
511
|
for (; i < r; ) {
|
|
@@ -524,53 +524,53 @@ function yt(e, t) {
|
|
|
524
524
|
n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++e.line, e.lineStart = i;
|
|
525
525
|
continue;
|
|
526
526
|
case 35:
|
|
527
|
-
return
|
|
527
|
+
return dt(e, i);
|
|
528
528
|
case 33:
|
|
529
|
-
return
|
|
529
|
+
return x(e, c.BANG, i, i + 1);
|
|
530
530
|
case 36:
|
|
531
|
-
return
|
|
531
|
+
return x(e, c.DOLLAR, i, i + 1);
|
|
532
532
|
case 38:
|
|
533
|
-
return
|
|
533
|
+
return x(e, c.AMP, i, i + 1);
|
|
534
534
|
case 40:
|
|
535
|
-
return
|
|
535
|
+
return x(e, c.PAREN_L, i, i + 1);
|
|
536
536
|
case 41:
|
|
537
|
-
return
|
|
537
|
+
return x(e, c.PAREN_R, i, i + 1);
|
|
538
538
|
case 46:
|
|
539
539
|
if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46)
|
|
540
|
-
return
|
|
540
|
+
return x(e, c.SPREAD, i, i + 3);
|
|
541
541
|
break;
|
|
542
542
|
case 58:
|
|
543
|
-
return
|
|
543
|
+
return x(e, c.COLON, i, i + 1);
|
|
544
544
|
case 61:
|
|
545
|
-
return
|
|
545
|
+
return x(e, c.EQUALS, i, i + 1);
|
|
546
546
|
case 64:
|
|
547
|
-
return
|
|
547
|
+
return x(e, c.AT, i, i + 1);
|
|
548
548
|
case 91:
|
|
549
|
-
return
|
|
549
|
+
return x(e, c.BRACKET_L, i, i + 1);
|
|
550
550
|
case 93:
|
|
551
|
-
return
|
|
551
|
+
return x(e, c.BRACKET_R, i, i + 1);
|
|
552
552
|
case 123:
|
|
553
|
-
return
|
|
553
|
+
return x(e, c.BRACE_L, i, i + 1);
|
|
554
554
|
case 124:
|
|
555
|
-
return
|
|
555
|
+
return x(e, c.PIPE, i, i + 1);
|
|
556
556
|
case 125:
|
|
557
|
-
return
|
|
557
|
+
return x(e, c.BRACE_R, i, i + 1);
|
|
558
558
|
case 34:
|
|
559
|
-
return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ?
|
|
559
|
+
return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? Tt(e, i) : mt(e, i);
|
|
560
560
|
}
|
|
561
|
-
if (
|
|
562
|
-
return
|
|
563
|
-
if (
|
|
564
|
-
return
|
|
565
|
-
throw
|
|
561
|
+
if (Y(s) || s === 45)
|
|
562
|
+
return ft(e, i, s);
|
|
563
|
+
if (we(s))
|
|
564
|
+
return vt(e, i);
|
|
565
|
+
throw b(
|
|
566
566
|
e.source,
|
|
567
567
|
i,
|
|
568
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : V(s) ||
|
|
568
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : V(s) || se(n, i) ? `Unexpected character: ${F(e, i)}.` : `Invalid character: ${F(e, i)}.`
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
|
-
return
|
|
571
|
+
return x(e, c.EOF, r, r);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function dt(e, t) {
|
|
574
574
|
const n = e.source.body, r = n.length;
|
|
575
575
|
let i = t + 1;
|
|
576
576
|
for (; i < r; ) {
|
|
@@ -579,25 +579,25 @@ function mt(e, t) {
|
|
|
579
579
|
break;
|
|
580
580
|
if (V(s))
|
|
581
581
|
++i;
|
|
582
|
-
else if (
|
|
582
|
+
else if (se(n, i))
|
|
583
583
|
i += 2;
|
|
584
584
|
else
|
|
585
585
|
break;
|
|
586
586
|
}
|
|
587
|
-
return
|
|
587
|
+
return x(
|
|
588
588
|
e,
|
|
589
|
-
|
|
589
|
+
c.COMMENT,
|
|
590
590
|
t,
|
|
591
591
|
i,
|
|
592
592
|
n.slice(t + 1, i)
|
|
593
593
|
);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function ft(e, t, n) {
|
|
596
596
|
const r = e.source.body;
|
|
597
|
-
let i = t, s = n,
|
|
597
|
+
let i = t, s = n, a = !1;
|
|
598
598
|
if (s === 45 && (s = r.charCodeAt(++i)), s === 48) {
|
|
599
|
-
if (s = r.charCodeAt(++i),
|
|
600
|
-
throw
|
|
599
|
+
if (s = r.charCodeAt(++i), Y(s))
|
|
600
|
+
throw b(
|
|
601
601
|
e.source,
|
|
602
602
|
i,
|
|
603
603
|
`Invalid number, unexpected digit after 0: ${F(
|
|
@@ -607,8 +607,8 @@ function Et(e, t, n) {
|
|
|
607
607
|
);
|
|
608
608
|
} else
|
|
609
609
|
i = ue(e, i, s), s = r.charCodeAt(i);
|
|
610
|
-
if (s === 46 && (
|
|
611
|
-
throw
|
|
610
|
+
if (s === 46 && (a = !0, s = r.charCodeAt(++i), i = ue(e, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (a = !0, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = ue(e, i, s), s = r.charCodeAt(i)), s === 46 || we(s))
|
|
611
|
+
throw b(
|
|
612
612
|
e.source,
|
|
613
613
|
i,
|
|
614
614
|
`Invalid number, expected digit but got: ${F(
|
|
@@ -616,17 +616,17 @@ function Et(e, t, n) {
|
|
|
616
616
|
i
|
|
617
617
|
)}.`
|
|
618
618
|
);
|
|
619
|
-
return
|
|
619
|
+
return x(
|
|
620
620
|
e,
|
|
621
|
-
|
|
621
|
+
a ? c.FLOAT : c.INT,
|
|
622
622
|
t,
|
|
623
623
|
i,
|
|
624
624
|
r.slice(t, i)
|
|
625
625
|
);
|
|
626
626
|
}
|
|
627
627
|
function ue(e, t, n) {
|
|
628
|
-
if (!
|
|
629
|
-
throw
|
|
628
|
+
if (!Y(n))
|
|
629
|
+
throw b(
|
|
630
630
|
e.source,
|
|
631
631
|
t,
|
|
632
632
|
`Invalid number, expected digit but got: ${F(
|
|
@@ -636,31 +636,31 @@ function ue(e, t, n) {
|
|
|
636
636
|
);
|
|
637
637
|
const r = e.source.body;
|
|
638
638
|
let i = t + 1;
|
|
639
|
-
for (;
|
|
639
|
+
for (; Y(r.charCodeAt(i)); )
|
|
640
640
|
++i;
|
|
641
641
|
return i;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function mt(e, t) {
|
|
644
644
|
const n = e.source.body, r = n.length;
|
|
645
|
-
let i = t + 1, s = i,
|
|
645
|
+
let i = t + 1, s = i, a = "";
|
|
646
646
|
for (; i < r; ) {
|
|
647
647
|
const u = n.charCodeAt(i);
|
|
648
648
|
if (u === 34)
|
|
649
|
-
return
|
|
649
|
+
return a += n.slice(s, i), x(e, c.STRING, t, i + 1, a);
|
|
650
650
|
if (u === 92) {
|
|
651
|
-
|
|
652
|
-
const
|
|
653
|
-
|
|
651
|
+
a += n.slice(s, i);
|
|
652
|
+
const p = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? yt(e, i) : Et(e, i) : gt(e, i);
|
|
653
|
+
a += p.value, i += p.size, s = i;
|
|
654
654
|
continue;
|
|
655
655
|
}
|
|
656
656
|
if (u === 10 || u === 13)
|
|
657
657
|
break;
|
|
658
658
|
if (V(u))
|
|
659
659
|
++i;
|
|
660
|
-
else if (
|
|
660
|
+
else if (se(n, i))
|
|
661
661
|
i += 2;
|
|
662
662
|
else
|
|
663
|
-
throw
|
|
663
|
+
throw b(
|
|
664
664
|
e.source,
|
|
665
665
|
i,
|
|
666
666
|
`Invalid character within String: ${F(
|
|
@@ -669,9 +669,9 @@ function Tt(e, t) {
|
|
|
669
669
|
)}.`
|
|
670
670
|
);
|
|
671
671
|
}
|
|
672
|
-
throw
|
|
672
|
+
throw b(e.source, i, "Unterminated string.");
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function yt(e, t) {
|
|
675
675
|
const n = e.source.body;
|
|
676
676
|
let r = 0, i = 3;
|
|
677
677
|
for (; i < 12; ) {
|
|
@@ -684,10 +684,10 @@ function vt(e, t) {
|
|
|
684
684
|
size: i
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
|
-
if (r = r << 4 |
|
|
687
|
+
if (r = r << 4 | G(s), r < 0)
|
|
688
688
|
break;
|
|
689
689
|
}
|
|
690
|
-
throw
|
|
690
|
+
throw b(
|
|
691
691
|
e.source,
|
|
692
692
|
t,
|
|
693
693
|
`Invalid Unicode escape sequence: "${n.slice(
|
|
@@ -696,34 +696,34 @@ function vt(e, t) {
|
|
|
696
696
|
)}".`
|
|
697
697
|
);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
700
|
-
const n = e.source.body, r =
|
|
699
|
+
function Et(e, t) {
|
|
700
|
+
const n = e.source.body, r = be(n, t + 2);
|
|
701
701
|
if (V(r))
|
|
702
702
|
return {
|
|
703
703
|
value: String.fromCodePoint(r),
|
|
704
704
|
size: 6
|
|
705
705
|
};
|
|
706
|
-
if (
|
|
707
|
-
const i =
|
|
708
|
-
if (
|
|
706
|
+
if (Pe(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
707
|
+
const i = be(n, t + 8);
|
|
708
|
+
if (Le(i))
|
|
709
709
|
return {
|
|
710
710
|
value: String.fromCodePoint(r, i),
|
|
711
711
|
size: 12
|
|
712
712
|
};
|
|
713
713
|
}
|
|
714
|
-
throw
|
|
714
|
+
throw b(
|
|
715
715
|
e.source,
|
|
716
716
|
t,
|
|
717
717
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
718
718
|
);
|
|
719
719
|
}
|
|
720
|
-
function
|
|
721
|
-
return
|
|
720
|
+
function be(e, t) {
|
|
721
|
+
return G(e.charCodeAt(t)) << 12 | G(e.charCodeAt(t + 1)) << 8 | G(e.charCodeAt(t + 2)) << 4 | G(e.charCodeAt(t + 3));
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function G(e) {
|
|
724
724
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function gt(e, t) {
|
|
727
727
|
const n = e.source.body;
|
|
728
728
|
switch (n.charCodeAt(t + 1)) {
|
|
729
729
|
case 34:
|
|
@@ -768,7 +768,7 @@ function Nt(e, t) {
|
|
|
768
768
|
size: 2
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
|
-
throw
|
|
771
|
+
throw b(
|
|
772
772
|
e.source,
|
|
773
773
|
t,
|
|
774
774
|
`Invalid character escape sequence: "${n.slice(
|
|
@@ -777,39 +777,39 @@ function Nt(e, t) {
|
|
|
777
777
|
)}".`
|
|
778
778
|
);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Tt(e, t) {
|
|
781
781
|
const n = e.source.body, r = n.length;
|
|
782
|
-
let i = e.lineStart, s = t + 3,
|
|
783
|
-
const
|
|
782
|
+
let i = e.lineStart, s = t + 3, a = s, u = "";
|
|
783
|
+
const p = [];
|
|
784
784
|
for (; s < r; ) {
|
|
785
785
|
const d = n.charCodeAt(s);
|
|
786
786
|
if (d === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
787
|
-
u += n.slice(
|
|
788
|
-
const
|
|
787
|
+
u += n.slice(a, s), p.push(u);
|
|
788
|
+
const m = x(
|
|
789
789
|
e,
|
|
790
|
-
|
|
790
|
+
c.BLOCK_STRING,
|
|
791
791
|
t,
|
|
792
792
|
s + 3,
|
|
793
793
|
// Return a string of the lines joined with U+000A.
|
|
794
|
-
|
|
794
|
+
at(p).join(`
|
|
795
795
|
`)
|
|
796
796
|
);
|
|
797
|
-
return e.line +=
|
|
797
|
+
return e.line += p.length - 1, e.lineStart = i, m;
|
|
798
798
|
}
|
|
799
799
|
if (d === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
800
|
-
u += n.slice(
|
|
800
|
+
u += n.slice(a, s), a = s + 1, s += 4;
|
|
801
801
|
continue;
|
|
802
802
|
}
|
|
803
803
|
if (d === 10 || d === 13) {
|
|
804
|
-
u += n.slice(
|
|
804
|
+
u += n.slice(a, s), p.push(u), d === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, i = s;
|
|
805
805
|
continue;
|
|
806
806
|
}
|
|
807
807
|
if (V(d))
|
|
808
808
|
++s;
|
|
809
|
-
else if (
|
|
809
|
+
else if (se(n, s))
|
|
810
810
|
s += 2;
|
|
811
811
|
else
|
|
812
|
-
throw
|
|
812
|
+
throw b(
|
|
813
813
|
e.source,
|
|
814
814
|
s,
|
|
815
815
|
`Invalid character within String: ${F(
|
|
@@ -818,76 +818,76 @@ function At(e, t) {
|
|
|
818
818
|
)}.`
|
|
819
819
|
);
|
|
820
820
|
}
|
|
821
|
-
throw
|
|
821
|
+
throw b(e.source, s, "Unterminated string.");
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function vt(e, t) {
|
|
824
824
|
const n = e.source.body, r = n.length;
|
|
825
825
|
let i = t + 1;
|
|
826
826
|
for (; i < r; ) {
|
|
827
827
|
const s = n.charCodeAt(i);
|
|
828
|
-
if (
|
|
828
|
+
if (ot(s))
|
|
829
829
|
++i;
|
|
830
830
|
else
|
|
831
831
|
break;
|
|
832
832
|
}
|
|
833
|
-
return
|
|
833
|
+
return x(
|
|
834
834
|
e,
|
|
835
|
-
|
|
835
|
+
c.NAME,
|
|
836
836
|
t,
|
|
837
837
|
i,
|
|
838
838
|
n.slice(t, i)
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
|
-
const
|
|
842
|
-
function
|
|
843
|
-
return
|
|
841
|
+
const At = 10, Fe = 2;
|
|
842
|
+
function ve(e) {
|
|
843
|
+
return oe(e, []);
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function oe(e, t) {
|
|
846
846
|
switch (typeof e) {
|
|
847
847
|
case "string":
|
|
848
848
|
return JSON.stringify(e);
|
|
849
849
|
case "function":
|
|
850
850
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
851
851
|
case "object":
|
|
852
|
-
return
|
|
852
|
+
return Nt(e, t);
|
|
853
853
|
default:
|
|
854
854
|
return String(e);
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Nt(e, t) {
|
|
858
858
|
if (e === null)
|
|
859
859
|
return "null";
|
|
860
860
|
if (t.includes(e))
|
|
861
861
|
return "[Circular]";
|
|
862
862
|
const n = [...t, e];
|
|
863
|
-
if (
|
|
863
|
+
if (Ct(e)) {
|
|
864
864
|
const r = e.toJSON();
|
|
865
865
|
if (r !== e)
|
|
866
|
-
return typeof r == "string" ? r :
|
|
866
|
+
return typeof r == "string" ? r : oe(r, n);
|
|
867
867
|
} else if (Array.isArray(e))
|
|
868
|
-
return
|
|
869
|
-
return
|
|
868
|
+
return bt(e, n);
|
|
869
|
+
return xt(e, n);
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function Ct(e) {
|
|
872
872
|
return typeof e.toJSON == "function";
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function xt(e, t) {
|
|
875
875
|
const n = Object.entries(e);
|
|
876
|
-
return n.length === 0 ? "{}" : t.length >
|
|
877
|
-
([i, s]) => i + ": " +
|
|
876
|
+
return n.length === 0 ? "{}" : t.length > Fe ? "[" + It(e) + "]" : "{ " + n.map(
|
|
877
|
+
([i, s]) => i + ": " + oe(s, t)
|
|
878
878
|
).join(", ") + " }";
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function bt(e, t) {
|
|
881
881
|
if (e.length === 0)
|
|
882
882
|
return "[]";
|
|
883
|
-
if (t.length >
|
|
883
|
+
if (t.length > Fe)
|
|
884
884
|
return "[Array]";
|
|
885
|
-
const n = Math.min(
|
|
885
|
+
const n = Math.min(At, e.length), r = e.length - n, i = [];
|
|
886
886
|
for (let s = 0; s < n; ++s)
|
|
887
|
-
i.push(
|
|
887
|
+
i.push(oe(e[s], t));
|
|
888
888
|
return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function It(e) {
|
|
891
891
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
892
892
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
893
893
|
const n = e.constructor.name;
|
|
@@ -896,7 +896,7 @@ function Ct(e) {
|
|
|
896
896
|
}
|
|
897
897
|
return t;
|
|
898
898
|
}
|
|
899
|
-
const
|
|
899
|
+
const Ot = (
|
|
900
900
|
/* c8 ignore next 6 */
|
|
901
901
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
902
902
|
globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
|
|
@@ -911,8 +911,8 @@ const St = (
|
|
|
911
911
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (r = t.constructor) === null || r === void 0 ? void 0 : r.name
|
|
912
912
|
);
|
|
913
913
|
if (i === s) {
|
|
914
|
-
const
|
|
915
|
-
throw new Error(`Cannot use ${i} "${
|
|
914
|
+
const a = ve(t);
|
|
915
|
+
throw new Error(`Cannot use ${i} "${a}" from another module or realm.
|
|
916
916
|
|
|
917
917
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
918
918
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -929,15 +929,15 @@ spurious results.`);
|
|
|
929
929
|
return !1;
|
|
930
930
|
}
|
|
931
931
|
);
|
|
932
|
-
class
|
|
932
|
+
class Be {
|
|
933
933
|
constructor(t, n = "GraphQL request", r = {
|
|
934
934
|
line: 1,
|
|
935
935
|
column: 1
|
|
936
936
|
}) {
|
|
937
|
-
typeof t == "string" ||
|
|
937
|
+
typeof t == "string" || Z(!1, `Body must be a string. Received: ${ve(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || Z(
|
|
938
938
|
!1,
|
|
939
939
|
"line in locationOffset is 1-indexed and must be positive."
|
|
940
|
-
), this.locationOffset.column > 0 ||
|
|
940
|
+
), this.locationOffset.column > 0 || Z(
|
|
941
941
|
!1,
|
|
942
942
|
"column in locationOffset is 1-indexed and must be positive."
|
|
943
943
|
);
|
|
@@ -946,22 +946,22 @@ class Ve {
|
|
|
946
946
|
return "Source";
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
return
|
|
949
|
+
function Dt(e) {
|
|
950
|
+
return Ot(e, Be);
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
return new
|
|
952
|
+
function Ue(e, t) {
|
|
953
|
+
return new _t(e, t).parseDocument();
|
|
954
954
|
}
|
|
955
|
-
class
|
|
955
|
+
class _t {
|
|
956
956
|
constructor(t, n = {}) {
|
|
957
|
-
const r =
|
|
958
|
-
this._lexer = new
|
|
957
|
+
const r = Dt(t) ? t : new Be(t);
|
|
958
|
+
this._lexer = new lt(r), this._options = n, this._tokenCounter = 0;
|
|
959
959
|
}
|
|
960
960
|
/**
|
|
961
961
|
* Converts a name lex token into a name parse node.
|
|
962
962
|
*/
|
|
963
963
|
parseName() {
|
|
964
|
-
const t = this.expectToken(
|
|
964
|
+
const t = this.expectToken(c.NAME);
|
|
965
965
|
return this.node(t, {
|
|
966
966
|
kind: f.NAME,
|
|
967
967
|
value: t.value
|
|
@@ -975,9 +975,9 @@ class kt {
|
|
|
975
975
|
return this.node(this._lexer.token, {
|
|
976
976
|
kind: f.DOCUMENT,
|
|
977
977
|
definitions: this.many(
|
|
978
|
-
|
|
978
|
+
c.SOF,
|
|
979
979
|
this.parseDefinition,
|
|
980
|
-
|
|
980
|
+
c.EOF
|
|
981
981
|
)
|
|
982
982
|
});
|
|
983
983
|
}
|
|
@@ -1005,10 +1005,10 @@ class kt {
|
|
|
1005
1005
|
* - InputObjectTypeDefinition
|
|
1006
1006
|
*/
|
|
1007
1007
|
parseDefinition() {
|
|
1008
|
-
if (this.peek(
|
|
1008
|
+
if (this.peek(c.BRACE_L))
|
|
1009
1009
|
return this.parseOperationDefinition();
|
|
1010
1010
|
const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1011
|
-
if (n.kind ===
|
|
1011
|
+
if (n.kind === c.NAME) {
|
|
1012
1012
|
switch (n.value) {
|
|
1013
1013
|
case "schema":
|
|
1014
1014
|
return this.parseSchemaDefinition();
|
|
@@ -1028,7 +1028,7 @@ class kt {
|
|
|
1028
1028
|
return this.parseDirectiveDefinition();
|
|
1029
1029
|
}
|
|
1030
1030
|
if (t)
|
|
1031
|
-
throw
|
|
1031
|
+
throw b(
|
|
1032
1032
|
this._lexer.source,
|
|
1033
1033
|
this._lexer.token.start,
|
|
1034
1034
|
"Unexpected description, descriptions are supported only on type definitions."
|
|
@@ -1054,7 +1054,7 @@ class kt {
|
|
|
1054
1054
|
*/
|
|
1055
1055
|
parseOperationDefinition() {
|
|
1056
1056
|
const t = this._lexer.token;
|
|
1057
|
-
if (this.peek(
|
|
1057
|
+
if (this.peek(c.BRACE_L))
|
|
1058
1058
|
return this.node(t, {
|
|
1059
1059
|
kind: f.OPERATION_DEFINITION,
|
|
1060
1060
|
operation: M.QUERY,
|
|
@@ -1065,7 +1065,7 @@ class kt {
|
|
|
1065
1065
|
});
|
|
1066
1066
|
const n = this.parseOperationType();
|
|
1067
1067
|
let r;
|
|
1068
|
-
return this.peek(
|
|
1068
|
+
return this.peek(c.NAME) && (r = this.parseName()), this.node(t, {
|
|
1069
1069
|
kind: f.OPERATION_DEFINITION,
|
|
1070
1070
|
operation: n,
|
|
1071
1071
|
name: r,
|
|
@@ -1078,7 +1078,7 @@ class kt {
|
|
|
1078
1078
|
* OperationType : one of query mutation subscription
|
|
1079
1079
|
*/
|
|
1080
1080
|
parseOperationType() {
|
|
1081
|
-
const t = this.expectToken(
|
|
1081
|
+
const t = this.expectToken(c.NAME);
|
|
1082
1082
|
switch (t.value) {
|
|
1083
1083
|
case "query":
|
|
1084
1084
|
return M.QUERY;
|
|
@@ -1094,9 +1094,9 @@ class kt {
|
|
|
1094
1094
|
*/
|
|
1095
1095
|
parseVariableDefinitions() {
|
|
1096
1096
|
return this.optionalMany(
|
|
1097
|
-
|
|
1097
|
+
c.PAREN_L,
|
|
1098
1098
|
this.parseVariableDefinition,
|
|
1099
|
-
|
|
1099
|
+
c.PAREN_R
|
|
1100
1100
|
);
|
|
1101
1101
|
}
|
|
1102
1102
|
/**
|
|
@@ -1106,8 +1106,8 @@ class kt {
|
|
|
1106
1106
|
return this.node(this._lexer.token, {
|
|
1107
1107
|
kind: f.VARIABLE_DEFINITION,
|
|
1108
1108
|
variable: this.parseVariable(),
|
|
1109
|
-
type: (this.expectToken(
|
|
1110
|
-
defaultValue: this.expectOptionalToken(
|
|
1109
|
+
type: (this.expectToken(c.COLON), this.parseTypeReference()),
|
|
1110
|
+
defaultValue: this.expectOptionalToken(c.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
1111
1111
|
directives: this.parseConstDirectives()
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
@@ -1116,7 +1116,7 @@ class kt {
|
|
|
1116
1116
|
*/
|
|
1117
1117
|
parseVariable() {
|
|
1118
1118
|
const t = this._lexer.token;
|
|
1119
|
-
return this.expectToken(
|
|
1119
|
+
return this.expectToken(c.DOLLAR), this.node(t, {
|
|
1120
1120
|
kind: f.VARIABLE,
|
|
1121
1121
|
name: this.parseName()
|
|
1122
1122
|
});
|
|
@@ -1130,9 +1130,9 @@ class kt {
|
|
|
1130
1130
|
return this.node(this._lexer.token, {
|
|
1131
1131
|
kind: f.SELECTION_SET,
|
|
1132
1132
|
selections: this.many(
|
|
1133
|
-
|
|
1133
|
+
c.BRACE_L,
|
|
1134
1134
|
this.parseSelection,
|
|
1135
|
-
|
|
1135
|
+
c.BRACE_R
|
|
1136
1136
|
)
|
|
1137
1137
|
});
|
|
1138
1138
|
}
|
|
@@ -1143,7 +1143,7 @@ class kt {
|
|
|
1143
1143
|
* - InlineFragment
|
|
1144
1144
|
*/
|
|
1145
1145
|
parseSelection() {
|
|
1146
|
-
return this.peek(
|
|
1146
|
+
return this.peek(c.SPREAD) ? this.parseFragment() : this.parseField();
|
|
1147
1147
|
}
|
|
1148
1148
|
/**
|
|
1149
1149
|
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
@@ -1153,13 +1153,13 @@ class kt {
|
|
|
1153
1153
|
parseField() {
|
|
1154
1154
|
const t = this._lexer.token, n = this.parseName();
|
|
1155
1155
|
let r, i;
|
|
1156
|
-
return this.expectOptionalToken(
|
|
1156
|
+
return this.expectOptionalToken(c.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(t, {
|
|
1157
1157
|
kind: f.FIELD,
|
|
1158
1158
|
alias: r,
|
|
1159
1159
|
name: i,
|
|
1160
1160
|
arguments: this.parseArguments(!1),
|
|
1161
1161
|
directives: this.parseDirectives(!1),
|
|
1162
|
-
selectionSet: this.peek(
|
|
1162
|
+
selectionSet: this.peek(c.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
1163
1163
|
});
|
|
1164
1164
|
}
|
|
1165
1165
|
/**
|
|
@@ -1167,14 +1167,14 @@ class kt {
|
|
|
1167
1167
|
*/
|
|
1168
1168
|
parseArguments(t) {
|
|
1169
1169
|
const n = t ? this.parseConstArgument : this.parseArgument;
|
|
1170
|
-
return this.optionalMany(
|
|
1170
|
+
return this.optionalMany(c.PAREN_L, n, c.PAREN_R);
|
|
1171
1171
|
}
|
|
1172
1172
|
/**
|
|
1173
1173
|
* Argument[Const] : Name : Value[?Const]
|
|
1174
1174
|
*/
|
|
1175
1175
|
parseArgument(t = !1) {
|
|
1176
1176
|
const n = this._lexer.token, r = this.parseName();
|
|
1177
|
-
return this.expectToken(
|
|
1177
|
+
return this.expectToken(c.COLON), this.node(n, {
|
|
1178
1178
|
kind: f.ARGUMENT,
|
|
1179
1179
|
name: r,
|
|
1180
1180
|
value: this.parseValueLiteral(t)
|
|
@@ -1193,9 +1193,9 @@ class kt {
|
|
|
1193
1193
|
*/
|
|
1194
1194
|
parseFragment() {
|
|
1195
1195
|
const t = this._lexer.token;
|
|
1196
|
-
this.expectToken(
|
|
1196
|
+
this.expectToken(c.SPREAD);
|
|
1197
1197
|
const n = this.expectOptionalKeyword("on");
|
|
1198
|
-
return !n && this.peek(
|
|
1198
|
+
return !n && this.peek(c.NAME) ? this.node(t, {
|
|
1199
1199
|
kind: f.FRAGMENT_SPREAD,
|
|
1200
1200
|
name: this.parseFragmentName(),
|
|
1201
1201
|
directives: this.parseDirectives(!1)
|
|
@@ -1259,24 +1259,24 @@ class kt {
|
|
|
1259
1259
|
parseValueLiteral(t) {
|
|
1260
1260
|
const n = this._lexer.token;
|
|
1261
1261
|
switch (n.kind) {
|
|
1262
|
-
case
|
|
1262
|
+
case c.BRACKET_L:
|
|
1263
1263
|
return this.parseList(t);
|
|
1264
|
-
case
|
|
1264
|
+
case c.BRACE_L:
|
|
1265
1265
|
return this.parseObject(t);
|
|
1266
|
-
case
|
|
1266
|
+
case c.INT:
|
|
1267
1267
|
return this.advanceLexer(), this.node(n, {
|
|
1268
1268
|
kind: f.INT,
|
|
1269
1269
|
value: n.value
|
|
1270
1270
|
});
|
|
1271
|
-
case
|
|
1271
|
+
case c.FLOAT:
|
|
1272
1272
|
return this.advanceLexer(), this.node(n, {
|
|
1273
1273
|
kind: f.FLOAT,
|
|
1274
1274
|
value: n.value
|
|
1275
1275
|
});
|
|
1276
|
-
case
|
|
1277
|
-
case
|
|
1276
|
+
case c.STRING:
|
|
1277
|
+
case c.BLOCK_STRING:
|
|
1278
1278
|
return this.parseStringLiteral();
|
|
1279
|
-
case
|
|
1279
|
+
case c.NAME:
|
|
1280
1280
|
switch (this.advanceLexer(), n.value) {
|
|
1281
1281
|
case "true":
|
|
1282
1282
|
return this.node(n, {
|
|
@@ -1298,11 +1298,11 @@ class kt {
|
|
|
1298
1298
|
value: n.value
|
|
1299
1299
|
});
|
|
1300
1300
|
}
|
|
1301
|
-
case
|
|
1301
|
+
case c.DOLLAR:
|
|
1302
1302
|
if (t)
|
|
1303
|
-
if (this.expectToken(
|
|
1303
|
+
if (this.expectToken(c.DOLLAR), this._lexer.token.kind === c.NAME) {
|
|
1304
1304
|
const r = this._lexer.token.value;
|
|
1305
|
-
throw
|
|
1305
|
+
throw b(
|
|
1306
1306
|
this._lexer.source,
|
|
1307
1307
|
n.start,
|
|
1308
1308
|
`Unexpected variable "$${r}" in constant value.`
|
|
@@ -1322,7 +1322,7 @@ class kt {
|
|
|
1322
1322
|
return this.advanceLexer(), this.node(t, {
|
|
1323
1323
|
kind: f.STRING,
|
|
1324
1324
|
value: t.value,
|
|
1325
|
-
block: t.kind ===
|
|
1325
|
+
block: t.kind === c.BLOCK_STRING
|
|
1326
1326
|
});
|
|
1327
1327
|
}
|
|
1328
1328
|
/**
|
|
@@ -1334,7 +1334,7 @@ class kt {
|
|
|
1334
1334
|
const n = () => this.parseValueLiteral(t);
|
|
1335
1335
|
return this.node(this._lexer.token, {
|
|
1336
1336
|
kind: f.LIST,
|
|
1337
|
-
values: this.any(
|
|
1337
|
+
values: this.any(c.BRACKET_L, n, c.BRACKET_R)
|
|
1338
1338
|
});
|
|
1339
1339
|
}
|
|
1340
1340
|
/**
|
|
@@ -1348,7 +1348,7 @@ class kt {
|
|
|
1348
1348
|
const n = () => this.parseObjectField(t);
|
|
1349
1349
|
return this.node(this._lexer.token, {
|
|
1350
1350
|
kind: f.OBJECT,
|
|
1351
|
-
fields: this.any(
|
|
1351
|
+
fields: this.any(c.BRACE_L, n, c.BRACE_R)
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
1354
|
/**
|
|
@@ -1356,7 +1356,7 @@ class kt {
|
|
|
1356
1356
|
*/
|
|
1357
1357
|
parseObjectField(t) {
|
|
1358
1358
|
const n = this._lexer.token, r = this.parseName();
|
|
1359
|
-
return this.expectToken(
|
|
1359
|
+
return this.expectToken(c.COLON), this.node(n, {
|
|
1360
1360
|
kind: f.OBJECT_FIELD,
|
|
1361
1361
|
name: r,
|
|
1362
1362
|
value: this.parseValueLiteral(t)
|
|
@@ -1368,7 +1368,7 @@ class kt {
|
|
|
1368
1368
|
*/
|
|
1369
1369
|
parseDirectives(t) {
|
|
1370
1370
|
const n = [];
|
|
1371
|
-
for (; this.peek(
|
|
1371
|
+
for (; this.peek(c.AT); )
|
|
1372
1372
|
n.push(this.parseDirective(t));
|
|
1373
1373
|
return n;
|
|
1374
1374
|
}
|
|
@@ -1382,7 +1382,7 @@ class kt {
|
|
|
1382
1382
|
*/
|
|
1383
1383
|
parseDirective(t) {
|
|
1384
1384
|
const n = this._lexer.token;
|
|
1385
|
-
return this.expectToken(
|
|
1385
|
+
return this.expectToken(c.AT), this.node(n, {
|
|
1386
1386
|
kind: f.DIRECTIVE,
|
|
1387
1387
|
name: this.parseName(),
|
|
1388
1388
|
arguments: this.parseArguments(t)
|
|
@@ -1398,15 +1398,15 @@ class kt {
|
|
|
1398
1398
|
parseTypeReference() {
|
|
1399
1399
|
const t = this._lexer.token;
|
|
1400
1400
|
let n;
|
|
1401
|
-
if (this.expectOptionalToken(
|
|
1401
|
+
if (this.expectOptionalToken(c.BRACKET_L)) {
|
|
1402
1402
|
const r = this.parseTypeReference();
|
|
1403
|
-
this.expectToken(
|
|
1403
|
+
this.expectToken(c.BRACKET_R), n = this.node(t, {
|
|
1404
1404
|
kind: f.LIST_TYPE,
|
|
1405
1405
|
type: r
|
|
1406
1406
|
});
|
|
1407
1407
|
} else
|
|
1408
1408
|
n = this.parseNamedType();
|
|
1409
|
-
return this.expectOptionalToken(
|
|
1409
|
+
return this.expectOptionalToken(c.BANG) ? this.node(t, {
|
|
1410
1410
|
kind: f.NON_NULL_TYPE,
|
|
1411
1411
|
type: n
|
|
1412
1412
|
}) : n;
|
|
@@ -1422,7 +1422,7 @@ class kt {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
// Implements the parsing rules in the Type Definition section.
|
|
1424
1424
|
peekDescription() {
|
|
1425
|
-
return this.peek(
|
|
1425
|
+
return this.peek(c.STRING) || this.peek(c.BLOCK_STRING);
|
|
1426
1426
|
}
|
|
1427
1427
|
/**
|
|
1428
1428
|
* Description : StringValue
|
|
@@ -1440,9 +1440,9 @@ class kt {
|
|
|
1440
1440
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1441
1441
|
this.expectKeyword("schema");
|
|
1442
1442
|
const r = this.parseConstDirectives(), i = this.many(
|
|
1443
|
-
|
|
1443
|
+
c.BRACE_L,
|
|
1444
1444
|
this.parseOperationTypeDefinition,
|
|
1445
|
-
|
|
1445
|
+
c.BRACE_R
|
|
1446
1446
|
);
|
|
1447
1447
|
return this.node(t, {
|
|
1448
1448
|
kind: f.SCHEMA_DEFINITION,
|
|
@@ -1456,7 +1456,7 @@ class kt {
|
|
|
1456
1456
|
*/
|
|
1457
1457
|
parseOperationTypeDefinition() {
|
|
1458
1458
|
const t = this._lexer.token, n = this.parseOperationType();
|
|
1459
|
-
this.expectToken(
|
|
1459
|
+
this.expectToken(c.COLON);
|
|
1460
1460
|
const r = this.parseNamedType();
|
|
1461
1461
|
return this.node(t, {
|
|
1462
1462
|
kind: f.OPERATION_TYPE_DEFINITION,
|
|
@@ -1486,14 +1486,14 @@ class kt {
|
|
|
1486
1486
|
parseObjectTypeDefinition() {
|
|
1487
1487
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1488
1488
|
this.expectKeyword("type");
|
|
1489
|
-
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(),
|
|
1489
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
|
|
1490
1490
|
return this.node(t, {
|
|
1491
1491
|
kind: f.OBJECT_TYPE_DEFINITION,
|
|
1492
1492
|
description: n,
|
|
1493
1493
|
name: r,
|
|
1494
1494
|
interfaces: i,
|
|
1495
1495
|
directives: s,
|
|
1496
|
-
fields:
|
|
1496
|
+
fields: a
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
/**
|
|
@@ -1502,7 +1502,7 @@ class kt {
|
|
|
1502
1502
|
* - ImplementsInterfaces & NamedType
|
|
1503
1503
|
*/
|
|
1504
1504
|
parseImplementsInterfaces() {
|
|
1505
|
-
return this.expectOptionalKeyword("implements") ? this.delimitedMany(
|
|
1505
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(c.AMP, this.parseNamedType) : [];
|
|
1506
1506
|
}
|
|
1507
1507
|
/**
|
|
1508
1508
|
* ```
|
|
@@ -1511,9 +1511,9 @@ class kt {
|
|
|
1511
1511
|
*/
|
|
1512
1512
|
parseFieldsDefinition() {
|
|
1513
1513
|
return this.optionalMany(
|
|
1514
|
-
|
|
1514
|
+
c.BRACE_L,
|
|
1515
1515
|
this.parseFieldDefinition,
|
|
1516
|
-
|
|
1516
|
+
c.BRACE_R
|
|
1517
1517
|
);
|
|
1518
1518
|
}
|
|
1519
1519
|
/**
|
|
@@ -1522,15 +1522,15 @@ class kt {
|
|
|
1522
1522
|
*/
|
|
1523
1523
|
parseFieldDefinition() {
|
|
1524
1524
|
const t = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs();
|
|
1525
|
-
this.expectToken(
|
|
1526
|
-
const s = this.parseTypeReference(),
|
|
1525
|
+
this.expectToken(c.COLON);
|
|
1526
|
+
const s = this.parseTypeReference(), a = this.parseConstDirectives();
|
|
1527
1527
|
return this.node(t, {
|
|
1528
1528
|
kind: f.FIELD_DEFINITION,
|
|
1529
1529
|
description: n,
|
|
1530
1530
|
name: r,
|
|
1531
1531
|
arguments: i,
|
|
1532
1532
|
type: s,
|
|
1533
|
-
directives:
|
|
1533
|
+
directives: a
|
|
1534
1534
|
});
|
|
1535
1535
|
}
|
|
1536
1536
|
/**
|
|
@@ -1538,9 +1538,9 @@ class kt {
|
|
|
1538
1538
|
*/
|
|
1539
1539
|
parseArgumentDefs() {
|
|
1540
1540
|
return this.optionalMany(
|
|
1541
|
-
|
|
1541
|
+
c.PAREN_L,
|
|
1542
1542
|
this.parseInputValueDef,
|
|
1543
|
-
|
|
1543
|
+
c.PAREN_R
|
|
1544
1544
|
);
|
|
1545
1545
|
}
|
|
1546
1546
|
/**
|
|
@@ -1549,18 +1549,18 @@ class kt {
|
|
|
1549
1549
|
*/
|
|
1550
1550
|
parseInputValueDef() {
|
|
1551
1551
|
const t = this._lexer.token, n = this.parseDescription(), r = this.parseName();
|
|
1552
|
-
this.expectToken(
|
|
1552
|
+
this.expectToken(c.COLON);
|
|
1553
1553
|
const i = this.parseTypeReference();
|
|
1554
1554
|
let s;
|
|
1555
|
-
this.expectOptionalToken(
|
|
1556
|
-
const
|
|
1555
|
+
this.expectOptionalToken(c.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1556
|
+
const a = this.parseConstDirectives();
|
|
1557
1557
|
return this.node(t, {
|
|
1558
1558
|
kind: f.INPUT_VALUE_DEFINITION,
|
|
1559
1559
|
description: n,
|
|
1560
1560
|
name: r,
|
|
1561
1561
|
type: i,
|
|
1562
1562
|
defaultValue: s,
|
|
1563
|
-
directives:
|
|
1563
|
+
directives: a
|
|
1564
1564
|
});
|
|
1565
1565
|
}
|
|
1566
1566
|
/**
|
|
@@ -1570,14 +1570,14 @@ class kt {
|
|
|
1570
1570
|
parseInterfaceTypeDefinition() {
|
|
1571
1571
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1572
1572
|
this.expectKeyword("interface");
|
|
1573
|
-
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(),
|
|
1573
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
|
|
1574
1574
|
return this.node(t, {
|
|
1575
1575
|
kind: f.INTERFACE_TYPE_DEFINITION,
|
|
1576
1576
|
description: n,
|
|
1577
1577
|
name: r,
|
|
1578
1578
|
interfaces: i,
|
|
1579
1579
|
directives: s,
|
|
1580
|
-
fields:
|
|
1580
|
+
fields: a
|
|
1581
1581
|
});
|
|
1582
1582
|
}
|
|
1583
1583
|
/**
|
|
@@ -1602,7 +1602,7 @@ class kt {
|
|
|
1602
1602
|
* - UnionMemberTypes | NamedType
|
|
1603
1603
|
*/
|
|
1604
1604
|
parseUnionMemberTypes() {
|
|
1605
|
-
return this.expectOptionalToken(
|
|
1605
|
+
return this.expectOptionalToken(c.EQUALS) ? this.delimitedMany(c.PIPE, this.parseNamedType) : [];
|
|
1606
1606
|
}
|
|
1607
1607
|
/**
|
|
1608
1608
|
* EnumTypeDefinition :
|
|
@@ -1627,9 +1627,9 @@ class kt {
|
|
|
1627
1627
|
*/
|
|
1628
1628
|
parseEnumValuesDefinition() {
|
|
1629
1629
|
return this.optionalMany(
|
|
1630
|
-
|
|
1630
|
+
c.BRACE_L,
|
|
1631
1631
|
this.parseEnumValueDefinition,
|
|
1632
|
-
|
|
1632
|
+
c.BRACE_R
|
|
1633
1633
|
);
|
|
1634
1634
|
}
|
|
1635
1635
|
/**
|
|
@@ -1649,10 +1649,10 @@ class kt {
|
|
|
1649
1649
|
*/
|
|
1650
1650
|
parseEnumValueName() {
|
|
1651
1651
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
1652
|
-
throw
|
|
1652
|
+
throw b(
|
|
1653
1653
|
this._lexer.source,
|
|
1654
1654
|
this._lexer.token.start,
|
|
1655
|
-
`${
|
|
1655
|
+
`${W(
|
|
1656
1656
|
this._lexer.token
|
|
1657
1657
|
)} is reserved and cannot be used for an enum value.`
|
|
1658
1658
|
);
|
|
@@ -1681,9 +1681,9 @@ class kt {
|
|
|
1681
1681
|
*/
|
|
1682
1682
|
parseInputFieldsDefinition() {
|
|
1683
1683
|
return this.optionalMany(
|
|
1684
|
-
|
|
1684
|
+
c.BRACE_L,
|
|
1685
1685
|
this.parseInputValueDef,
|
|
1686
|
-
|
|
1686
|
+
c.BRACE_R
|
|
1687
1687
|
);
|
|
1688
1688
|
}
|
|
1689
1689
|
/**
|
|
@@ -1701,7 +1701,7 @@ class kt {
|
|
|
1701
1701
|
*/
|
|
1702
1702
|
parseTypeSystemExtension() {
|
|
1703
1703
|
const t = this._lexer.lookahead();
|
|
1704
|
-
if (t.kind ===
|
|
1704
|
+
if (t.kind === c.NAME)
|
|
1705
1705
|
switch (t.value) {
|
|
1706
1706
|
case "schema":
|
|
1707
1707
|
return this.parseSchemaExtension();
|
|
@@ -1731,9 +1731,9 @@ class kt {
|
|
|
1731
1731
|
const t = this._lexer.token;
|
|
1732
1732
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1733
1733
|
const n = this.parseConstDirectives(), r = this.optionalMany(
|
|
1734
|
-
|
|
1734
|
+
c.BRACE_L,
|
|
1735
1735
|
this.parseOperationTypeDefinition,
|
|
1736
|
-
|
|
1736
|
+
c.BRACE_R
|
|
1737
1737
|
);
|
|
1738
1738
|
if (n.length === 0 && r.length === 0)
|
|
1739
1739
|
throw this.unexpected();
|
|
@@ -1861,17 +1861,17 @@ class kt {
|
|
|
1861
1861
|
*/
|
|
1862
1862
|
parseDirectiveDefinition() {
|
|
1863
1863
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1864
|
-
this.expectKeyword("directive"), this.expectToken(
|
|
1864
|
+
this.expectKeyword("directive"), this.expectToken(c.AT);
|
|
1865
1865
|
const r = this.parseName(), i = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1866
1866
|
this.expectKeyword("on");
|
|
1867
|
-
const
|
|
1867
|
+
const a = this.parseDirectiveLocations();
|
|
1868
1868
|
return this.node(t, {
|
|
1869
1869
|
kind: f.DIRECTIVE_DEFINITION,
|
|
1870
1870
|
description: n,
|
|
1871
1871
|
name: r,
|
|
1872
1872
|
arguments: i,
|
|
1873
1873
|
repeatable: s,
|
|
1874
|
-
locations:
|
|
1874
|
+
locations: a
|
|
1875
1875
|
});
|
|
1876
1876
|
}
|
|
1877
1877
|
/**
|
|
@@ -1880,7 +1880,7 @@ class kt {
|
|
|
1880
1880
|
* - DirectiveLocations | DirectiveLocation
|
|
1881
1881
|
*/
|
|
1882
1882
|
parseDirectiveLocations() {
|
|
1883
|
-
return this.delimitedMany(
|
|
1883
|
+
return this.delimitedMany(c.PIPE, this.parseDirectiveLocation);
|
|
1884
1884
|
}
|
|
1885
1885
|
/*
|
|
1886
1886
|
* DirectiveLocation :
|
|
@@ -1922,7 +1922,7 @@ class kt {
|
|
|
1922
1922
|
* given parsed object.
|
|
1923
1923
|
*/
|
|
1924
1924
|
node(t, n) {
|
|
1925
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
1925
|
+
return this._options.noLocation !== !0 && (n.loc = new rt(
|
|
1926
1926
|
t,
|
|
1927
1927
|
this._lexer.lastToken,
|
|
1928
1928
|
this._lexer.source
|
|
@@ -1942,10 +1942,10 @@ class kt {
|
|
|
1942
1942
|
const n = this._lexer.token;
|
|
1943
1943
|
if (n.kind === t)
|
|
1944
1944
|
return this.advanceLexer(), n;
|
|
1945
|
-
throw
|
|
1945
|
+
throw b(
|
|
1946
1946
|
this._lexer.source,
|
|
1947
1947
|
n.start,
|
|
1948
|
-
`Expected ${
|
|
1948
|
+
`Expected ${Me(t)}, found ${W(n)}.`
|
|
1949
1949
|
);
|
|
1950
1950
|
}
|
|
1951
1951
|
/**
|
|
@@ -1961,13 +1961,13 @@ class kt {
|
|
|
1961
1961
|
*/
|
|
1962
1962
|
expectKeyword(t) {
|
|
1963
1963
|
const n = this._lexer.token;
|
|
1964
|
-
if (n.kind ===
|
|
1964
|
+
if (n.kind === c.NAME && n.value === t)
|
|
1965
1965
|
this.advanceLexer();
|
|
1966
1966
|
else
|
|
1967
|
-
throw
|
|
1967
|
+
throw b(
|
|
1968
1968
|
this._lexer.source,
|
|
1969
1969
|
n.start,
|
|
1970
|
-
`Expected "${t}", found ${
|
|
1970
|
+
`Expected "${t}", found ${W(n)}.`
|
|
1971
1971
|
);
|
|
1972
1972
|
}
|
|
1973
1973
|
/**
|
|
@@ -1976,17 +1976,17 @@ class kt {
|
|
|
1976
1976
|
*/
|
|
1977
1977
|
expectOptionalKeyword(t) {
|
|
1978
1978
|
const n = this._lexer.token;
|
|
1979
|
-
return n.kind ===
|
|
1979
|
+
return n.kind === c.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
|
|
1980
1980
|
}
|
|
1981
1981
|
/**
|
|
1982
1982
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
1983
1983
|
*/
|
|
1984
1984
|
unexpected(t) {
|
|
1985
1985
|
const n = t ?? this._lexer.token;
|
|
1986
|
-
return
|
|
1986
|
+
return b(
|
|
1987
1987
|
this._lexer.source,
|
|
1988
1988
|
n.start,
|
|
1989
|
-
`Unexpected ${
|
|
1989
|
+
`Unexpected ${W(n)}.`
|
|
1990
1990
|
);
|
|
1991
1991
|
}
|
|
1992
1992
|
/**
|
|
@@ -2045,29 +2045,29 @@ class kt {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
advanceLexer() {
|
|
2047
2047
|
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
2048
|
-
if (t !== void 0 && n.kind !==
|
|
2049
|
-
throw
|
|
2048
|
+
if (t !== void 0 && n.kind !== c.EOF && (++this._tokenCounter, this._tokenCounter > t))
|
|
2049
|
+
throw b(
|
|
2050
2050
|
this._lexer.source,
|
|
2051
2051
|
n.start,
|
|
2052
2052
|
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
2053
2053
|
);
|
|
2054
2054
|
}
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2056
|
+
function W(e) {
|
|
2057
2057
|
const t = e.value;
|
|
2058
|
-
return
|
|
2058
|
+
return Me(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2061
|
-
return
|
|
2060
|
+
function Me(e) {
|
|
2061
|
+
return ht(e) ? `"${e}"` : e;
|
|
2062
2062
|
}
|
|
2063
|
-
function
|
|
2064
|
-
return `"${e.replace(
|
|
2063
|
+
function kt(e) {
|
|
2064
|
+
return `"${e.replace(Rt, St)}"`;
|
|
2065
2065
|
}
|
|
2066
|
-
const
|
|
2067
|
-
function
|
|
2068
|
-
return
|
|
2066
|
+
const Rt = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
2067
|
+
function St(e) {
|
|
2068
|
+
return wt[e.charCodeAt(0)];
|
|
2069
2069
|
}
|
|
2070
|
-
const
|
|
2070
|
+
const wt = [
|
|
2071
2071
|
"\\u0000",
|
|
2072
2072
|
"\\u0001",
|
|
2073
2073
|
"\\u0002",
|
|
@@ -2233,75 +2233,75 @@ const Pt = [
|
|
|
2233
2233
|
"\\u009D",
|
|
2234
2234
|
"\\u009E",
|
|
2235
2235
|
"\\u009F"
|
|
2236
|
-
],
|
|
2237
|
-
function
|
|
2236
|
+
], Pt = Object.freeze({});
|
|
2237
|
+
function Lt(e, t, n = Re) {
|
|
2238
2238
|
const r = /* @__PURE__ */ new Map();
|
|
2239
|
-
for (const
|
|
2240
|
-
r.set(
|
|
2241
|
-
let i, s = Array.isArray(e),
|
|
2242
|
-
const
|
|
2239
|
+
for (const _ of Object.values(f))
|
|
2240
|
+
r.set(_, Ft(t, _));
|
|
2241
|
+
let i, s = Array.isArray(e), a = [e], u = -1, p = [], d = e, m, E;
|
|
2242
|
+
const g = [], N = [];
|
|
2243
2243
|
do {
|
|
2244
2244
|
u++;
|
|
2245
|
-
const
|
|
2246
|
-
if (
|
|
2247
|
-
if (
|
|
2245
|
+
const _ = u === a.length, z = _ && p.length !== 0;
|
|
2246
|
+
if (_) {
|
|
2247
|
+
if (m = N.length === 0 ? void 0 : g[g.length - 1], d = E, E = N.pop(), z)
|
|
2248
2248
|
if (s) {
|
|
2249
2249
|
d = d.slice();
|
|
2250
|
-
let
|
|
2251
|
-
for (const [
|
|
2252
|
-
const
|
|
2253
|
-
|
|
2250
|
+
let k = 0;
|
|
2251
|
+
for (const [B, Q] of p) {
|
|
2252
|
+
const J = B - k;
|
|
2253
|
+
Q === null ? (d.splice(J, 1), k++) : d[J] = Q;
|
|
2254
2254
|
}
|
|
2255
2255
|
} else {
|
|
2256
2256
|
d = Object.defineProperties(
|
|
2257
2257
|
{},
|
|
2258
2258
|
Object.getOwnPropertyDescriptors(d)
|
|
2259
2259
|
);
|
|
2260
|
-
for (const [
|
|
2261
|
-
d[
|
|
2260
|
+
for (const [k, B] of p)
|
|
2261
|
+
d[k] = B;
|
|
2262
2262
|
}
|
|
2263
|
-
u = i.index,
|
|
2263
|
+
u = i.index, a = i.keys, p = i.edits, s = i.inArray, i = i.prev;
|
|
2264
2264
|
} else if (E) {
|
|
2265
|
-
if (
|
|
2265
|
+
if (m = s ? u : a[u], d = E[m], d == null)
|
|
2266
2266
|
continue;
|
|
2267
|
-
|
|
2267
|
+
g.push(m);
|
|
2268
2268
|
}
|
|
2269
|
-
let
|
|
2269
|
+
let S;
|
|
2270
2270
|
if (!Array.isArray(d)) {
|
|
2271
|
-
var
|
|
2272
|
-
|
|
2273
|
-
const
|
|
2274
|
-
if (
|
|
2271
|
+
var y, C;
|
|
2272
|
+
xe(d) || Z(!1, `Invalid AST Node: ${ve(d)}.`);
|
|
2273
|
+
const k = _ ? (y = r.get(d.kind)) === null || y === void 0 ? void 0 : y.leave : (C = r.get(d.kind)) === null || C === void 0 ? void 0 : C.enter;
|
|
2274
|
+
if (S = k == null ? void 0 : k.call(t, d, m, E, g, N), S === Pt)
|
|
2275
2275
|
break;
|
|
2276
|
-
if (
|
|
2277
|
-
if (!
|
|
2278
|
-
|
|
2276
|
+
if (S === !1) {
|
|
2277
|
+
if (!_) {
|
|
2278
|
+
g.pop();
|
|
2279
2279
|
continue;
|
|
2280
2280
|
}
|
|
2281
|
-
} else if (
|
|
2282
|
-
if (
|
|
2283
|
-
d =
|
|
2281
|
+
} else if (S !== void 0 && (p.push([m, S]), !_))
|
|
2282
|
+
if (xe(S))
|
|
2283
|
+
d = S;
|
|
2284
2284
|
else {
|
|
2285
|
-
|
|
2285
|
+
g.pop();
|
|
2286
2286
|
continue;
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2290
|
-
|
|
2289
|
+
if (S === void 0 && z && p.push([m, d]), _)
|
|
2290
|
+
g.pop();
|
|
2291
2291
|
else {
|
|
2292
2292
|
var D;
|
|
2293
2293
|
i = {
|
|
2294
2294
|
inArray: s,
|
|
2295
2295
|
index: u,
|
|
2296
|
-
keys:
|
|
2297
|
-
edits:
|
|
2296
|
+
keys: a,
|
|
2297
|
+
edits: p,
|
|
2298
2298
|
prev: i
|
|
2299
|
-
}, s = Array.isArray(d),
|
|
2299
|
+
}, s = Array.isArray(d), a = s ? d : (D = n[d.kind]) !== null && D !== void 0 ? D : [], u = -1, p = [], E && N.push(E), E = d;
|
|
2300
2300
|
}
|
|
2301
2301
|
} while (i !== void 0);
|
|
2302
|
-
return
|
|
2302
|
+
return p.length !== 0 ? p[p.length - 1][1] : e;
|
|
2303
2303
|
}
|
|
2304
|
-
function
|
|
2304
|
+
function Ft(e, t) {
|
|
2305
2305
|
const n = e[t];
|
|
2306
2306
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
2307
2307
|
enter: n,
|
|
@@ -2311,10 +2311,10 @@ function Ut(e, t) {
|
|
|
2311
2311
|
leave: e.leave
|
|
2312
2312
|
};
|
|
2313
2313
|
}
|
|
2314
|
-
function
|
|
2315
|
-
return
|
|
2314
|
+
function Bt(e) {
|
|
2315
|
+
return Lt(e, Mt);
|
|
2316
2316
|
}
|
|
2317
|
-
const
|
|
2317
|
+
const Ut = 80, Mt = {
|
|
2318
2318
|
Name: {
|
|
2319
2319
|
leave: (e) => e.value
|
|
2320
2320
|
},
|
|
@@ -2323,17 +2323,17 @@ const qt = 80, jt = {
|
|
|
2323
2323
|
},
|
|
2324
2324
|
// Document
|
|
2325
2325
|
Document: {
|
|
2326
|
-
leave: (e) =>
|
|
2326
|
+
leave: (e) => h(e.definitions, `
|
|
2327
2327
|
|
|
2328
2328
|
`)
|
|
2329
2329
|
},
|
|
2330
2330
|
OperationDefinition: {
|
|
2331
2331
|
leave(e) {
|
|
2332
|
-
const t =
|
|
2332
|
+
const t = v("(", h(e.variableDefinitions, ", "), ")"), n = h(
|
|
2333
2333
|
[
|
|
2334
2334
|
e.operation,
|
|
2335
|
-
|
|
2336
|
-
|
|
2335
|
+
h([e.name, t]),
|
|
2336
|
+
h(e.directives, " ")
|
|
2337
2337
|
],
|
|
2338
2338
|
" "
|
|
2339
2339
|
);
|
|
@@ -2341,19 +2341,19 @@ const qt = 80, jt = {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
},
|
|
2343
2343
|
VariableDefinition: {
|
|
2344
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives: r }) => e + ": " + t +
|
|
2344
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: r }) => e + ": " + t + v(" = ", n) + v(" ", h(r, " "))
|
|
2345
2345
|
},
|
|
2346
2346
|
SelectionSet: {
|
|
2347
|
-
leave: ({ selections: e }) =>
|
|
2347
|
+
leave: ({ selections: e }) => R(e)
|
|
2348
2348
|
},
|
|
2349
2349
|
Field: {
|
|
2350
2350
|
leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
|
|
2351
|
-
const s =
|
|
2352
|
-
let
|
|
2353
|
-
return
|
|
2354
|
-
`,
|
|
2351
|
+
const s = v("", e, ": ") + t;
|
|
2352
|
+
let a = s + v("(", h(n, ", "), ")");
|
|
2353
|
+
return a.length > Ut && (a = s + v(`(
|
|
2354
|
+
`, K(h(n, `
|
|
2355
2355
|
`)), `
|
|
2356
|
-
)`)),
|
|
2356
|
+
)`)), h([a, h(r, " "), i], " ");
|
|
2357
2357
|
}
|
|
2358
2358
|
},
|
|
2359
2359
|
Argument: {
|
|
@@ -2361,14 +2361,14 @@ const qt = 80, jt = {
|
|
|
2361
2361
|
},
|
|
2362
2362
|
// Fragments
|
|
2363
2363
|
FragmentSpread: {
|
|
2364
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
2364
|
+
leave: ({ name: e, directives: t }) => "..." + e + v(" ", h(t, " "))
|
|
2365
2365
|
},
|
|
2366
2366
|
InlineFragment: {
|
|
2367
|
-
leave: ({ typeCondition: e, directives: t, selectionSet: n }) =>
|
|
2367
|
+
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => h(
|
|
2368
2368
|
[
|
|
2369
2369
|
"...",
|
|
2370
|
-
|
|
2371
|
-
|
|
2370
|
+
v("on ", e),
|
|
2371
|
+
h(t, " "),
|
|
2372
2372
|
n
|
|
2373
2373
|
],
|
|
2374
2374
|
" "
|
|
@@ -2377,7 +2377,7 @@ const qt = 80, jt = {
|
|
|
2377
2377
|
FragmentDefinition: {
|
|
2378
2378
|
leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: r, selectionSet: i }) => (
|
|
2379
2379
|
// or removed in the future.
|
|
2380
|
-
`fragment ${e}${
|
|
2380
|
+
`fragment ${e}${v("(", h(n, ", "), ")")} on ${t} ${v("", h(r, " "), " ")}` + i
|
|
2381
2381
|
)
|
|
2382
2382
|
},
|
|
2383
2383
|
// Value
|
|
@@ -2388,7 +2388,7 @@ const qt = 80, jt = {
|
|
|
2388
2388
|
leave: ({ value: e }) => e
|
|
2389
2389
|
},
|
|
2390
2390
|
StringValue: {
|
|
2391
|
-
leave: ({ value: e, block: t }) => t ?
|
|
2391
|
+
leave: ({ value: e, block: t }) => t ? ut(e) : kt(e)
|
|
2392
2392
|
},
|
|
2393
2393
|
BooleanValue: {
|
|
2394
2394
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -2400,17 +2400,17 @@ const qt = 80, jt = {
|
|
|
2400
2400
|
leave: ({ value: e }) => e
|
|
2401
2401
|
},
|
|
2402
2402
|
ListValue: {
|
|
2403
|
-
leave: ({ values: e }) => "[" +
|
|
2403
|
+
leave: ({ values: e }) => "[" + h(e, ", ") + "]"
|
|
2404
2404
|
},
|
|
2405
2405
|
ObjectValue: {
|
|
2406
|
-
leave: ({ fields: e }) => "{" +
|
|
2406
|
+
leave: ({ fields: e }) => "{" + h(e, ", ") + "}"
|
|
2407
2407
|
},
|
|
2408
2408
|
ObjectField: {
|
|
2409
2409
|
leave: ({ name: e, value: t }) => e + ": " + t
|
|
2410
2410
|
},
|
|
2411
2411
|
// Directive
|
|
2412
2412
|
Directive: {
|
|
2413
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
2413
|
+
leave: ({ name: e, arguments: t }) => "@" + e + v("(", h(t, ", "), ")")
|
|
2414
2414
|
},
|
|
2415
2415
|
// Type
|
|
2416
2416
|
NamedType: {
|
|
@@ -2424,156 +2424,156 @@ const qt = 80, jt = {
|
|
|
2424
2424
|
},
|
|
2425
2425
|
// Type System Definitions
|
|
2426
2426
|
SchemaDefinition: {
|
|
2427
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
2428
|
-
`) +
|
|
2427
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => v("", e, `
|
|
2428
|
+
`) + h(["schema", h(t, " "), R(n)], " ")
|
|
2429
2429
|
},
|
|
2430
2430
|
OperationTypeDefinition: {
|
|
2431
2431
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
2432
2432
|
},
|
|
2433
2433
|
ScalarTypeDefinition: {
|
|
2434
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2435
|
-
`) +
|
|
2434
|
+
leave: ({ description: e, name: t, directives: n }) => v("", e, `
|
|
2435
|
+
`) + h(["scalar", t, h(n, " ")], " ")
|
|
2436
2436
|
},
|
|
2437
2437
|
ObjectTypeDefinition: {
|
|
2438
|
-
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) =>
|
|
2439
|
-
`) +
|
|
2438
|
+
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) => v("", e, `
|
|
2439
|
+
`) + h(
|
|
2440
2440
|
[
|
|
2441
2441
|
"type",
|
|
2442
2442
|
t,
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2443
|
+
v("implements ", h(n, " & ")),
|
|
2444
|
+
h(r, " "),
|
|
2445
|
+
R(i)
|
|
2446
2446
|
],
|
|
2447
2447
|
" "
|
|
2448
2448
|
)
|
|
2449
2449
|
},
|
|
2450
2450
|
FieldDefinition: {
|
|
2451
|
-
leave: ({ description: e, name: t, arguments: n, type: r, directives: i }) =>
|
|
2452
|
-
`) + t + (
|
|
2453
|
-
`,
|
|
2451
|
+
leave: ({ description: e, name: t, arguments: n, type: r, directives: i }) => v("", e, `
|
|
2452
|
+
`) + t + (Ie(n) ? v(`(
|
|
2453
|
+
`, K(h(n, `
|
|
2454
2454
|
`)), `
|
|
2455
|
-
)`) :
|
|
2455
|
+
)`) : v("(", h(n, ", "), ")")) + ": " + r + v(" ", h(i, " "))
|
|
2456
2456
|
},
|
|
2457
2457
|
InputValueDefinition: {
|
|
2458
|
-
leave: ({ description: e, name: t, type: n, defaultValue: r, directives: i }) =>
|
|
2459
|
-
`) +
|
|
2460
|
-
[t + ": " + n,
|
|
2458
|
+
leave: ({ description: e, name: t, type: n, defaultValue: r, directives: i }) => v("", e, `
|
|
2459
|
+
`) + h(
|
|
2460
|
+
[t + ": " + n, v("= ", r), h(i, " ")],
|
|
2461
2461
|
" "
|
|
2462
2462
|
)
|
|
2463
2463
|
},
|
|
2464
2464
|
InterfaceTypeDefinition: {
|
|
2465
|
-
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) =>
|
|
2466
|
-
`) +
|
|
2465
|
+
leave: ({ description: e, name: t, interfaces: n, directives: r, fields: i }) => v("", e, `
|
|
2466
|
+
`) + h(
|
|
2467
2467
|
[
|
|
2468
2468
|
"interface",
|
|
2469
2469
|
t,
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2470
|
+
v("implements ", h(n, " & ")),
|
|
2471
|
+
h(r, " "),
|
|
2472
|
+
R(i)
|
|
2473
2473
|
],
|
|
2474
2474
|
" "
|
|
2475
2475
|
)
|
|
2476
2476
|
},
|
|
2477
2477
|
UnionTypeDefinition: {
|
|
2478
|
-
leave: ({ description: e, name: t, directives: n, types: r }) =>
|
|
2479
|
-
`) +
|
|
2480
|
-
["union", t,
|
|
2478
|
+
leave: ({ description: e, name: t, directives: n, types: r }) => v("", e, `
|
|
2479
|
+
`) + h(
|
|
2480
|
+
["union", t, h(n, " "), v("= ", h(r, " | "))],
|
|
2481
2481
|
" "
|
|
2482
2482
|
)
|
|
2483
2483
|
},
|
|
2484
2484
|
EnumTypeDefinition: {
|
|
2485
|
-
leave: ({ description: e, name: t, directives: n, values: r }) =>
|
|
2486
|
-
`) +
|
|
2485
|
+
leave: ({ description: e, name: t, directives: n, values: r }) => v("", e, `
|
|
2486
|
+
`) + h(["enum", t, h(n, " "), R(r)], " ")
|
|
2487
2487
|
},
|
|
2488
2488
|
EnumValueDefinition: {
|
|
2489
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2490
|
-
`) +
|
|
2489
|
+
leave: ({ description: e, name: t, directives: n }) => v("", e, `
|
|
2490
|
+
`) + h([t, h(n, " ")], " ")
|
|
2491
2491
|
},
|
|
2492
2492
|
InputObjectTypeDefinition: {
|
|
2493
|
-
leave: ({ description: e, name: t, directives: n, fields: r }) =>
|
|
2494
|
-
`) +
|
|
2493
|
+
leave: ({ description: e, name: t, directives: n, fields: r }) => v("", e, `
|
|
2494
|
+
`) + h(["input", t, h(n, " "), R(r)], " ")
|
|
2495
2495
|
},
|
|
2496
2496
|
DirectiveDefinition: {
|
|
2497
|
-
leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) =>
|
|
2498
|
-
`) + "directive @" + t + (
|
|
2499
|
-
`,
|
|
2497
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) => v("", e, `
|
|
2498
|
+
`) + "directive @" + t + (Ie(n) ? v(`(
|
|
2499
|
+
`, K(h(n, `
|
|
2500
2500
|
`)), `
|
|
2501
|
-
)`) :
|
|
2501
|
+
)`) : v("(", h(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + h(i, " | ")
|
|
2502
2502
|
},
|
|
2503
2503
|
SchemaExtension: {
|
|
2504
|
-
leave: ({ directives: e, operationTypes: t }) =>
|
|
2505
|
-
["extend schema",
|
|
2504
|
+
leave: ({ directives: e, operationTypes: t }) => h(
|
|
2505
|
+
["extend schema", h(e, " "), R(t)],
|
|
2506
2506
|
" "
|
|
2507
2507
|
)
|
|
2508
2508
|
},
|
|
2509
2509
|
ScalarTypeExtension: {
|
|
2510
|
-
leave: ({ name: e, directives: t }) =>
|
|
2510
|
+
leave: ({ name: e, directives: t }) => h(["extend scalar", e, h(t, " ")], " ")
|
|
2511
2511
|
},
|
|
2512
2512
|
ObjectTypeExtension: {
|
|
2513
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: r }) =>
|
|
2513
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: r }) => h(
|
|
2514
2514
|
[
|
|
2515
2515
|
"extend type",
|
|
2516
2516
|
e,
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2517
|
+
v("implements ", h(t, " & ")),
|
|
2518
|
+
h(n, " "),
|
|
2519
|
+
R(r)
|
|
2520
2520
|
],
|
|
2521
2521
|
" "
|
|
2522
2522
|
)
|
|
2523
2523
|
},
|
|
2524
2524
|
InterfaceTypeExtension: {
|
|
2525
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: r }) =>
|
|
2525
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: r }) => h(
|
|
2526
2526
|
[
|
|
2527
2527
|
"extend interface",
|
|
2528
2528
|
e,
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2529
|
+
v("implements ", h(t, " & ")),
|
|
2530
|
+
h(n, " "),
|
|
2531
|
+
R(r)
|
|
2532
2532
|
],
|
|
2533
2533
|
" "
|
|
2534
2534
|
)
|
|
2535
2535
|
},
|
|
2536
2536
|
UnionTypeExtension: {
|
|
2537
|
-
leave: ({ name: e, directives: t, types: n }) =>
|
|
2537
|
+
leave: ({ name: e, directives: t, types: n }) => h(
|
|
2538
2538
|
[
|
|
2539
2539
|
"extend union",
|
|
2540
2540
|
e,
|
|
2541
|
-
|
|
2542
|
-
|
|
2541
|
+
h(t, " "),
|
|
2542
|
+
v("= ", h(n, " | "))
|
|
2543
2543
|
],
|
|
2544
2544
|
" "
|
|
2545
2545
|
)
|
|
2546
2546
|
},
|
|
2547
2547
|
EnumTypeExtension: {
|
|
2548
|
-
leave: ({ name: e, directives: t, values: n }) =>
|
|
2548
|
+
leave: ({ name: e, directives: t, values: n }) => h(["extend enum", e, h(t, " "), R(n)], " ")
|
|
2549
2549
|
},
|
|
2550
2550
|
InputObjectTypeExtension: {
|
|
2551
|
-
leave: ({ name: e, directives: t, fields: n }) =>
|
|
2551
|
+
leave: ({ name: e, directives: t, fields: n }) => h(["extend input", e, h(t, " "), R(n)], " ")
|
|
2552
2552
|
}
|
|
2553
2553
|
};
|
|
2554
|
-
function
|
|
2554
|
+
function h(e, t = "") {
|
|
2555
2555
|
var n;
|
|
2556
2556
|
return (n = e == null ? void 0 : e.filter((r) => r).join(t)) !== null && n !== void 0 ? n : "";
|
|
2557
2557
|
}
|
|
2558
|
-
function
|
|
2559
|
-
return
|
|
2560
|
-
`,
|
|
2558
|
+
function R(e) {
|
|
2559
|
+
return v(`{
|
|
2560
|
+
`, K(h(e, `
|
|
2561
2561
|
`)), `
|
|
2562
2562
|
}`);
|
|
2563
2563
|
}
|
|
2564
|
-
function
|
|
2564
|
+
function v(e, t, n = "") {
|
|
2565
2565
|
return t != null && t !== "" ? e + t + n : "";
|
|
2566
2566
|
}
|
|
2567
|
-
function
|
|
2568
|
-
return
|
|
2567
|
+
function K(e) {
|
|
2568
|
+
return v(" ", e.replace(/\n/g, `
|
|
2569
2569
|
`));
|
|
2570
2570
|
}
|
|
2571
|
-
function
|
|
2571
|
+
function Ie(e) {
|
|
2572
2572
|
var t;
|
|
2573
2573
|
return (t = e == null ? void 0 : e.some((n) => n.includes(`
|
|
2574
2574
|
`))) !== null && t !== void 0 ? t : !1;
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const Oe = (e) => {
|
|
2577
2577
|
var r, i;
|
|
2578
2578
|
let t;
|
|
2579
2579
|
const n = e.definitions.filter((s) => s.kind === "OperationDefinition");
|
|
@@ -2582,42 +2582,42 @@ const _e = (e) => {
|
|
|
2582
2582
|
if (typeof e == "string") {
|
|
2583
2583
|
let n;
|
|
2584
2584
|
try {
|
|
2585
|
-
const r =
|
|
2586
|
-
n =
|
|
2585
|
+
const r = Ue(e);
|
|
2586
|
+
n = Oe(r);
|
|
2587
2587
|
} catch {
|
|
2588
2588
|
}
|
|
2589
2589
|
return { query: e, operationName: n };
|
|
2590
2590
|
}
|
|
2591
|
-
const t =
|
|
2592
|
-
return { query:
|
|
2591
|
+
const t = Oe(e);
|
|
2592
|
+
return { query: Bt(e), operationName: t };
|
|
2593
2593
|
};
|
|
2594
|
-
class
|
|
2594
|
+
class H extends Error {
|
|
2595
2595
|
constructor(t, n) {
|
|
2596
|
-
const r = `${
|
|
2596
|
+
const r = `${H.extractMessage(t)}: ${JSON.stringify({
|
|
2597
2597
|
response: t,
|
|
2598
2598
|
request: n
|
|
2599
2599
|
})}`;
|
|
2600
|
-
super(r), Object.setPrototypeOf(this,
|
|
2600
|
+
super(r), Object.setPrototypeOf(this, H.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, H);
|
|
2601
2601
|
}
|
|
2602
2602
|
static extractMessage(t) {
|
|
2603
2603
|
var n, r;
|
|
2604
2604
|
return ((r = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : r.message) ?? `GraphQL Error (Code: ${t.status})`;
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
|
-
var
|
|
2608
|
-
function
|
|
2607
|
+
var qt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2608
|
+
function Vt(e) {
|
|
2609
2609
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2610
2610
|
}
|
|
2611
|
-
var
|
|
2611
|
+
var ye = { exports: {} };
|
|
2612
2612
|
(function(e, t) {
|
|
2613
|
-
var n = typeof self < "u" ? self :
|
|
2613
|
+
var n = typeof self < "u" ? self : qt, r = function() {
|
|
2614
2614
|
function s() {
|
|
2615
2615
|
this.fetch = !1, this.DOMException = n.DOMException;
|
|
2616
2616
|
}
|
|
2617
2617
|
return s.prototype = n, new s();
|
|
2618
2618
|
}();
|
|
2619
2619
|
(function(s) {
|
|
2620
|
-
(function(
|
|
2620
|
+
(function(a) {
|
|
2621
2621
|
var u = {
|
|
2622
2622
|
searchParams: "URLSearchParams" in s,
|
|
2623
2623
|
iterable: "Symbol" in s && "iterator" in Symbol,
|
|
@@ -2631,7 +2631,7 @@ var me = { exports: {} };
|
|
|
2631
2631
|
formData: "FormData" in s,
|
|
2632
2632
|
arrayBuffer: "ArrayBuffer" in s
|
|
2633
2633
|
};
|
|
2634
|
-
function
|
|
2634
|
+
function p(o) {
|
|
2635
2635
|
return o && DataView.prototype.isPrototypeOf(o);
|
|
2636
2636
|
}
|
|
2637
2637
|
if (u.arrayBuffer)
|
|
@@ -2645,7 +2645,7 @@ var me = { exports: {} };
|
|
|
2645
2645
|
"[object Uint32Array]",
|
|
2646
2646
|
"[object Float32Array]",
|
|
2647
2647
|
"[object Float64Array]"
|
|
2648
|
-
],
|
|
2648
|
+
], m = ArrayBuffer.isView || function(o) {
|
|
2649
2649
|
return o && d.indexOf(Object.prototype.toString.call(o)) > -1;
|
|
2650
2650
|
};
|
|
2651
2651
|
function E(o) {
|
|
@@ -2653,98 +2653,98 @@ var me = { exports: {} };
|
|
|
2653
2653
|
throw new TypeError("Invalid character in header field name");
|
|
2654
2654
|
return o.toLowerCase();
|
|
2655
2655
|
}
|
|
2656
|
-
function
|
|
2656
|
+
function g(o) {
|
|
2657
2657
|
return typeof o != "string" && (o = String(o)), o;
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2659
|
+
function N(o) {
|
|
2660
2660
|
var l = {
|
|
2661
2661
|
next: function() {
|
|
2662
|
-
var
|
|
2663
|
-
return { done:
|
|
2662
|
+
var T = o.shift();
|
|
2663
|
+
return { done: T === void 0, value: T };
|
|
2664
2664
|
}
|
|
2665
2665
|
};
|
|
2666
2666
|
return u.iterable && (l[Symbol.iterator] = function() {
|
|
2667
2667
|
return l;
|
|
2668
2668
|
}), l;
|
|
2669
2669
|
}
|
|
2670
|
-
function
|
|
2671
|
-
this.map = {}, o instanceof
|
|
2672
|
-
this.append(
|
|
2670
|
+
function y(o) {
|
|
2671
|
+
this.map = {}, o instanceof y ? o.forEach(function(l, T) {
|
|
2672
|
+
this.append(T, l);
|
|
2673
2673
|
}, this) : Array.isArray(o) ? o.forEach(function(l) {
|
|
2674
2674
|
this.append(l[0], l[1]);
|
|
2675
2675
|
}, this) : o && Object.getOwnPropertyNames(o).forEach(function(l) {
|
|
2676
2676
|
this.append(l, o[l]);
|
|
2677
2677
|
}, this);
|
|
2678
2678
|
}
|
|
2679
|
-
|
|
2680
|
-
o = E(o), l =
|
|
2681
|
-
var
|
|
2682
|
-
this.map[o] =
|
|
2683
|
-
},
|
|
2679
|
+
y.prototype.append = function(o, l) {
|
|
2680
|
+
o = E(o), l = g(l);
|
|
2681
|
+
var T = this.map[o];
|
|
2682
|
+
this.map[o] = T ? T + ", " + l : l;
|
|
2683
|
+
}, y.prototype.delete = function(o) {
|
|
2684
2684
|
delete this.map[E(o)];
|
|
2685
|
-
},
|
|
2685
|
+
}, y.prototype.get = function(o) {
|
|
2686
2686
|
return o = E(o), this.has(o) ? this.map[o] : null;
|
|
2687
|
-
},
|
|
2687
|
+
}, y.prototype.has = function(o) {
|
|
2688
2688
|
return this.map.hasOwnProperty(E(o));
|
|
2689
|
-
},
|
|
2690
|
-
this.map[E(o)] =
|
|
2691
|
-
},
|
|
2692
|
-
for (var
|
|
2693
|
-
this.map.hasOwnProperty(
|
|
2694
|
-
},
|
|
2689
|
+
}, y.prototype.set = function(o, l) {
|
|
2690
|
+
this.map[E(o)] = g(l);
|
|
2691
|
+
}, y.prototype.forEach = function(o, l) {
|
|
2692
|
+
for (var T in this.map)
|
|
2693
|
+
this.map.hasOwnProperty(T) && o.call(l, this.map[T], T, this);
|
|
2694
|
+
}, y.prototype.keys = function() {
|
|
2695
2695
|
var o = [];
|
|
2696
|
-
return this.forEach(function(l,
|
|
2697
|
-
o.push(
|
|
2698
|
-
}),
|
|
2699
|
-
},
|
|
2696
|
+
return this.forEach(function(l, T) {
|
|
2697
|
+
o.push(T);
|
|
2698
|
+
}), N(o);
|
|
2699
|
+
}, y.prototype.values = function() {
|
|
2700
2700
|
var o = [];
|
|
2701
2701
|
return this.forEach(function(l) {
|
|
2702
2702
|
o.push(l);
|
|
2703
|
-
}),
|
|
2704
|
-
},
|
|
2703
|
+
}), N(o);
|
|
2704
|
+
}, y.prototype.entries = function() {
|
|
2705
2705
|
var o = [];
|
|
2706
|
-
return this.forEach(function(l,
|
|
2707
|
-
o.push([
|
|
2708
|
-
}),
|
|
2709
|
-
}, u.iterable && (
|
|
2710
|
-
function
|
|
2706
|
+
return this.forEach(function(l, T) {
|
|
2707
|
+
o.push([T, l]);
|
|
2708
|
+
}), N(o);
|
|
2709
|
+
}, u.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
|
|
2710
|
+
function C(o) {
|
|
2711
2711
|
if (o.bodyUsed)
|
|
2712
2712
|
return Promise.reject(new TypeError("Already read"));
|
|
2713
2713
|
o.bodyUsed = !0;
|
|
2714
2714
|
}
|
|
2715
2715
|
function D(o) {
|
|
2716
|
-
return new Promise(function(l,
|
|
2716
|
+
return new Promise(function(l, T) {
|
|
2717
2717
|
o.onload = function() {
|
|
2718
2718
|
l(o.result);
|
|
2719
2719
|
}, o.onerror = function() {
|
|
2720
|
-
|
|
2720
|
+
T(o.error);
|
|
2721
2721
|
};
|
|
2722
2722
|
});
|
|
2723
2723
|
}
|
|
2724
|
-
function
|
|
2725
|
-
var l = new FileReader(),
|
|
2726
|
-
return l.readAsArrayBuffer(o),
|
|
2727
|
-
}
|
|
2728
|
-
function Y(o) {
|
|
2729
|
-
var l = new FileReader(), v = D(l);
|
|
2730
|
-
return l.readAsText(o), v;
|
|
2724
|
+
function _(o) {
|
|
2725
|
+
var l = new FileReader(), T = D(l);
|
|
2726
|
+
return l.readAsArrayBuffer(o), T;
|
|
2731
2727
|
}
|
|
2732
|
-
function
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
return v.join("");
|
|
2728
|
+
function z(o) {
|
|
2729
|
+
var l = new FileReader(), T = D(l);
|
|
2730
|
+
return l.readAsText(o), T;
|
|
2736
2731
|
}
|
|
2737
2732
|
function S(o) {
|
|
2733
|
+
for (var l = new Uint8Array(o), T = new Array(l.length), O = 0; O < l.length; O++)
|
|
2734
|
+
T[O] = String.fromCharCode(l[O]);
|
|
2735
|
+
return T.join("");
|
|
2736
|
+
}
|
|
2737
|
+
function k(o) {
|
|
2738
2738
|
if (o.slice)
|
|
2739
2739
|
return o.slice(0);
|
|
2740
2740
|
var l = new Uint8Array(o.byteLength);
|
|
2741
2741
|
return l.set(new Uint8Array(o)), l.buffer;
|
|
2742
2742
|
}
|
|
2743
|
-
function
|
|
2743
|
+
function B() {
|
|
2744
2744
|
return this.bodyUsed = !1, this._initBody = function(o) {
|
|
2745
|
-
this._bodyInit = o, o ? typeof o == "string" ? this._bodyText = o : u.blob && Blob.prototype.isPrototypeOf(o) ? this._bodyBlob = o : u.formData && FormData.prototype.isPrototypeOf(o) ? this._bodyFormData = o : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) ? this._bodyText = o.toString() : u.arrayBuffer && u.blob &&
|
|
2745
|
+
this._bodyInit = o, o ? typeof o == "string" ? this._bodyText = o : u.blob && Blob.prototype.isPrototypeOf(o) ? this._bodyBlob = o : u.formData && FormData.prototype.isPrototypeOf(o) ? this._bodyFormData = o : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) ? this._bodyText = o.toString() : u.arrayBuffer && u.blob && p(o) ? (this._bodyArrayBuffer = k(o.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(o) || m(o)) ? this._bodyArrayBuffer = k(o) : this._bodyText = o = Object.prototype.toString.call(o) : this._bodyText = "", this.headers.get("content-type") || (typeof o == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
2746
2746
|
}, u.blob && (this.blob = function() {
|
|
2747
|
-
var o =
|
|
2747
|
+
var o = C(this);
|
|
2748
2748
|
if (o)
|
|
2749
2749
|
return o;
|
|
2750
2750
|
if (this._bodyBlob)
|
|
@@ -2755,141 +2755,141 @@ var me = { exports: {} };
|
|
|
2755
2755
|
throw new Error("could not read FormData body as blob");
|
|
2756
2756
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
2757
2757
|
}, this.arrayBuffer = function() {
|
|
2758
|
-
return this._bodyArrayBuffer ?
|
|
2758
|
+
return this._bodyArrayBuffer ? C(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(_);
|
|
2759
2759
|
}), this.text = function() {
|
|
2760
|
-
var o =
|
|
2760
|
+
var o = C(this);
|
|
2761
2761
|
if (o)
|
|
2762
2762
|
return o;
|
|
2763
2763
|
if (this._bodyBlob)
|
|
2764
|
-
return
|
|
2764
|
+
return z(this._bodyBlob);
|
|
2765
2765
|
if (this._bodyArrayBuffer)
|
|
2766
|
-
return Promise.resolve(
|
|
2766
|
+
return Promise.resolve(S(this._bodyArrayBuffer));
|
|
2767
2767
|
if (this._bodyFormData)
|
|
2768
2768
|
throw new Error("could not read FormData body as text");
|
|
2769
2769
|
return Promise.resolve(this._bodyText);
|
|
2770
2770
|
}, u.formData && (this.formData = function() {
|
|
2771
|
-
return this.text().then(
|
|
2771
|
+
return this.text().then(je);
|
|
2772
2772
|
}), this.json = function() {
|
|
2773
2773
|
return this.text().then(JSON.parse);
|
|
2774
2774
|
}, this;
|
|
2775
2775
|
}
|
|
2776
|
-
var
|
|
2777
|
-
function
|
|
2776
|
+
var Q = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
2777
|
+
function J(o) {
|
|
2778
2778
|
var l = o.toUpperCase();
|
|
2779
|
-
return
|
|
2779
|
+
return Q.indexOf(l) > -1 ? l : o;
|
|
2780
2780
|
}
|
|
2781
2781
|
function L(o, l) {
|
|
2782
2782
|
l = l || {};
|
|
2783
|
-
var
|
|
2783
|
+
var T = l.body;
|
|
2784
2784
|
if (o instanceof L) {
|
|
2785
2785
|
if (o.bodyUsed)
|
|
2786
2786
|
throw new TypeError("Already read");
|
|
2787
|
-
this.url = o.url, this.credentials = o.credentials, l.headers || (this.headers = new
|
|
2787
|
+
this.url = o.url, this.credentials = o.credentials, l.headers || (this.headers = new y(o.headers)), this.method = o.method, this.mode = o.mode, this.signal = o.signal, !T && o._bodyInit != null && (T = o._bodyInit, o.bodyUsed = !0);
|
|
2788
2788
|
} else
|
|
2789
2789
|
this.url = String(o);
|
|
2790
|
-
if (this.credentials = l.credentials || this.credentials || "same-origin", (l.headers || !this.headers) && (this.headers = new
|
|
2790
|
+
if (this.credentials = l.credentials || this.credentials || "same-origin", (l.headers || !this.headers) && (this.headers = new y(l.headers)), this.method = J(l.method || this.method || "GET"), this.mode = l.mode || this.mode || null, this.signal = l.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && T)
|
|
2791
2791
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
2792
|
-
this._initBody(
|
|
2792
|
+
this._initBody(T);
|
|
2793
2793
|
}
|
|
2794
2794
|
L.prototype.clone = function() {
|
|
2795
2795
|
return new L(this, { body: this._bodyInit });
|
|
2796
2796
|
};
|
|
2797
|
-
function
|
|
2797
|
+
function je(o) {
|
|
2798
2798
|
var l = new FormData();
|
|
2799
|
-
return o.trim().split("&").forEach(function(
|
|
2800
|
-
if (
|
|
2801
|
-
var
|
|
2802
|
-
l.append(decodeURIComponent(
|
|
2799
|
+
return o.trim().split("&").forEach(function(T) {
|
|
2800
|
+
if (T) {
|
|
2801
|
+
var O = T.split("="), I = O.shift().replace(/\+/g, " "), A = O.join("=").replace(/\+/g, " ");
|
|
2802
|
+
l.append(decodeURIComponent(I), decodeURIComponent(A));
|
|
2803
2803
|
}
|
|
2804
2804
|
}), l;
|
|
2805
2805
|
}
|
|
2806
|
-
function
|
|
2807
|
-
var l = new
|
|
2808
|
-
return
|
|
2809
|
-
var
|
|
2810
|
-
if (
|
|
2811
|
-
var
|
|
2812
|
-
l.append(
|
|
2806
|
+
function $e(o) {
|
|
2807
|
+
var l = new y(), T = o.replace(/\r?\n[\t ]+/g, " ");
|
|
2808
|
+
return T.split(/\r?\n/).forEach(function(O) {
|
|
2809
|
+
var I = O.split(":"), A = I.shift().trim();
|
|
2810
|
+
if (A) {
|
|
2811
|
+
var X = I.join(":").trim();
|
|
2812
|
+
l.append(A, X);
|
|
2813
2813
|
}
|
|
2814
2814
|
}), l;
|
|
2815
2815
|
}
|
|
2816
|
-
|
|
2817
|
-
function
|
|
2818
|
-
l || (l = {}), this.type = "default", this.status = l.status === void 0 ? 200 : l.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in l ? l.statusText : "OK", this.headers = new
|
|
2816
|
+
B.call(L.prototype);
|
|
2817
|
+
function w(o, l) {
|
|
2818
|
+
l || (l = {}), this.type = "default", this.status = l.status === void 0 ? 200 : l.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in l ? l.statusText : "OK", this.headers = new y(l.headers), this.url = l.url || "", this._initBody(o);
|
|
2819
2819
|
}
|
|
2820
|
-
|
|
2821
|
-
return new
|
|
2820
|
+
B.call(w.prototype), w.prototype.clone = function() {
|
|
2821
|
+
return new w(this._bodyInit, {
|
|
2822
2822
|
status: this.status,
|
|
2823
2823
|
statusText: this.statusText,
|
|
2824
|
-
headers: new
|
|
2824
|
+
headers: new y(this.headers),
|
|
2825
2825
|
url: this.url
|
|
2826
2826
|
});
|
|
2827
|
-
},
|
|
2828
|
-
var o = new
|
|
2827
|
+
}, w.error = function() {
|
|
2828
|
+
var o = new w(null, { status: 0, statusText: "" });
|
|
2829
2829
|
return o.type = "error", o;
|
|
2830
2830
|
};
|
|
2831
|
-
var
|
|
2832
|
-
|
|
2833
|
-
if (
|
|
2831
|
+
var Ge = [301, 302, 303, 307, 308];
|
|
2832
|
+
w.redirect = function(o, l) {
|
|
2833
|
+
if (Ge.indexOf(l) === -1)
|
|
2834
2834
|
throw new RangeError("Invalid status code");
|
|
2835
|
-
return new
|
|
2836
|
-
},
|
|
2835
|
+
return new w(null, { status: l, headers: { location: o } });
|
|
2836
|
+
}, a.DOMException = s.DOMException;
|
|
2837
2837
|
try {
|
|
2838
|
-
new
|
|
2838
|
+
new a.DOMException();
|
|
2839
2839
|
} catch {
|
|
2840
|
-
|
|
2841
|
-
this.message = l, this.name =
|
|
2842
|
-
var
|
|
2843
|
-
this.stack =
|
|
2844
|
-
},
|
|
2840
|
+
a.DOMException = function(l, T) {
|
|
2841
|
+
this.message = l, this.name = T;
|
|
2842
|
+
var O = Error(l);
|
|
2843
|
+
this.stack = O.stack;
|
|
2844
|
+
}, a.DOMException.prototype = Object.create(Error.prototype), a.DOMException.prototype.constructor = a.DOMException;
|
|
2845
2845
|
}
|
|
2846
2846
|
function ae(o, l) {
|
|
2847
|
-
return new Promise(function(
|
|
2848
|
-
var
|
|
2849
|
-
if (
|
|
2850
|
-
return
|
|
2851
|
-
var
|
|
2852
|
-
function
|
|
2853
|
-
|
|
2847
|
+
return new Promise(function(T, O) {
|
|
2848
|
+
var I = new L(o, l);
|
|
2849
|
+
if (I.signal && I.signal.aborted)
|
|
2850
|
+
return O(new a.DOMException("Aborted", "AbortError"));
|
|
2851
|
+
var A = new XMLHttpRequest();
|
|
2852
|
+
function X() {
|
|
2853
|
+
A.abort();
|
|
2854
2854
|
}
|
|
2855
|
-
|
|
2856
|
-
var
|
|
2857
|
-
status:
|
|
2858
|
-
statusText:
|
|
2859
|
-
headers:
|
|
2855
|
+
A.onload = function() {
|
|
2856
|
+
var j = {
|
|
2857
|
+
status: A.status,
|
|
2858
|
+
statusText: A.statusText,
|
|
2859
|
+
headers: $e(A.getAllResponseHeaders() || "")
|
|
2860
2860
|
};
|
|
2861
|
-
|
|
2862
|
-
var ce = "response" in
|
|
2863
|
-
|
|
2864
|
-
},
|
|
2865
|
-
|
|
2866
|
-
},
|
|
2867
|
-
|
|
2868
|
-
},
|
|
2869
|
-
|
|
2870
|
-
},
|
|
2871
|
-
|
|
2872
|
-
}),
|
|
2873
|
-
|
|
2874
|
-
}),
|
|
2861
|
+
j.url = "responseURL" in A ? A.responseURL : j.headers.get("X-Request-URL");
|
|
2862
|
+
var ce = "response" in A ? A.response : A.responseText;
|
|
2863
|
+
T(new w(ce, j));
|
|
2864
|
+
}, A.onerror = function() {
|
|
2865
|
+
O(new TypeError("Network request failed"));
|
|
2866
|
+
}, A.ontimeout = function() {
|
|
2867
|
+
O(new TypeError("Network request failed"));
|
|
2868
|
+
}, A.onabort = function() {
|
|
2869
|
+
O(new a.DOMException("Aborted", "AbortError"));
|
|
2870
|
+
}, A.open(I.method, I.url, !0), I.credentials === "include" ? A.withCredentials = !0 : I.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && u.blob && (A.responseType = "blob"), I.headers.forEach(function(j, ce) {
|
|
2871
|
+
A.setRequestHeader(ce, j);
|
|
2872
|
+
}), I.signal && (I.signal.addEventListener("abort", X), A.onreadystatechange = function() {
|
|
2873
|
+
A.readyState === 4 && I.signal.removeEventListener("abort", X);
|
|
2874
|
+
}), A.send(typeof I._bodyInit > "u" ? null : I._bodyInit);
|
|
2875
2875
|
});
|
|
2876
2876
|
}
|
|
2877
|
-
return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers =
|
|
2877
|
+
return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers = y, s.Request = L, s.Response = w), a.Headers = y, a.Request = L, a.Response = w, a.fetch = ae, Object.defineProperty(a, "__esModule", { value: !0 }), a;
|
|
2878
2878
|
})({});
|
|
2879
2879
|
})(r), r.fetch.ponyfill = !0, delete r.fetch.polyfill;
|
|
2880
2880
|
var i = r;
|
|
2881
2881
|
t = i.fetch, t.default = i.fetch, t.fetch = i.fetch, t.Headers = i.Headers, t.Request = i.Request, t.Response = i.Response, e.exports = t;
|
|
2882
|
-
})(
|
|
2883
|
-
var
|
|
2884
|
-
const
|
|
2882
|
+
})(ye, ye.exports);
|
|
2883
|
+
var ne = ye.exports;
|
|
2884
|
+
const ee = /* @__PURE__ */ Vt(ne), jt = /* @__PURE__ */ ze({
|
|
2885
2885
|
__proto__: null,
|
|
2886
|
-
default:
|
|
2887
|
-
}, [
|
|
2886
|
+
default: ee
|
|
2887
|
+
}, [ne]), U = (e) => {
|
|
2888
2888
|
let t = {};
|
|
2889
|
-
return e && (typeof Headers < "u" && e instanceof Headers ||
|
|
2889
|
+
return e && (typeof Headers < "u" && e instanceof Headers || jt && ne.Headers && e instanceof ne.Headers ? t = Je(e) : Array.isArray(e) ? e.forEach(([n, r]) => {
|
|
2890
2890
|
n && r !== void 0 && (t[n] = r);
|
|
2891
2891
|
}) : t = e), t;
|
|
2892
|
-
}, De = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(),
|
|
2892
|
+
}, De = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), $t = (e) => {
|
|
2893
2893
|
if (!Array.isArray(e.query)) {
|
|
2894
2894
|
const r = e, i = [`query=${encodeURIComponent(De(r.query))}`];
|
|
2895
2895
|
return e.variables && i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`), r.operationName && i.push(`operationName=${encodeURIComponent(r.operationName)}`), i.join("&");
|
|
@@ -2901,94 +2901,94 @@ const K = /* @__PURE__ */ Gt(te), Ht = /* @__PURE__ */ Xe({
|
|
|
2901
2901
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[s]) : void 0
|
|
2902
2902
|
}), r), []);
|
|
2903
2903
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
2904
|
-
},
|
|
2905
|
-
const { url: n, query: r, variables: i, operationName: s, fetch:
|
|
2906
|
-
let
|
|
2907
|
-
e === "POST" ? (E =
|
|
2904
|
+
}, Gt = (e) => async (t) => {
|
|
2905
|
+
const { url: n, query: r, variables: i, operationName: s, fetch: a, fetchOptions: u, middleware: p } = t, d = { ...t.headers };
|
|
2906
|
+
let m = "", E;
|
|
2907
|
+
e === "POST" ? (E = Yt(r, i, s, u.jsonSerializer), typeof E == "string" && (d["Content-Type"] = "application/json")) : m = $t({
|
|
2908
2908
|
query: r,
|
|
2909
2909
|
variables: i,
|
|
2910
2910
|
operationName: s,
|
|
2911
|
-
jsonSerializer: u.jsonSerializer ??
|
|
2911
|
+
jsonSerializer: u.jsonSerializer ?? ge
|
|
2912
2912
|
});
|
|
2913
|
-
const
|
|
2913
|
+
const g = {
|
|
2914
2914
|
method: e,
|
|
2915
2915
|
headers: d,
|
|
2916
2916
|
body: E,
|
|
2917
2917
|
...u
|
|
2918
2918
|
};
|
|
2919
|
-
let
|
|
2920
|
-
if (
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2919
|
+
let N = n, y = g;
|
|
2920
|
+
if (p) {
|
|
2921
|
+
const C = await Promise.resolve(p({ ...g, url: n, operationName: s, variables: i })), { url: D, ..._ } = C;
|
|
2922
|
+
N = D, y = _;
|
|
2923
2923
|
}
|
|
2924
|
-
return
|
|
2924
|
+
return m && (N = `${N}?${m}`), await a(N, y);
|
|
2925
2925
|
};
|
|
2926
|
-
class
|
|
2926
|
+
class Ht {
|
|
2927
2927
|
constructor(t, n = {}) {
|
|
2928
2928
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...r) => {
|
|
2929
|
-
const [i, s,
|
|
2930
|
-
u.signal !== void 0 && (
|
|
2931
|
-
const { operationName:
|
|
2929
|
+
const [i, s, a] = r, u = We(i, s, a), { headers: p, fetch: d = ee, method: m = "POST", requestMiddleware: E, responseMiddleware: g, ...N } = this.requestConfig, { url: y } = this;
|
|
2930
|
+
u.signal !== void 0 && (N.signal = u.signal);
|
|
2931
|
+
const { operationName: C } = le(u.query);
|
|
2932
2932
|
return he({
|
|
2933
|
-
url:
|
|
2933
|
+
url: y,
|
|
2934
2934
|
query: u.query,
|
|
2935
2935
|
variables: u.variables,
|
|
2936
2936
|
headers: {
|
|
2937
|
-
...
|
|
2938
|
-
...
|
|
2937
|
+
...U(pe(p)),
|
|
2938
|
+
...U(u.requestHeaders)
|
|
2939
2939
|
},
|
|
2940
|
-
operationName:
|
|
2940
|
+
operationName: C,
|
|
2941
2941
|
fetch: d,
|
|
2942
|
-
method:
|
|
2943
|
-
fetchOptions:
|
|
2942
|
+
method: m,
|
|
2943
|
+
fetchOptions: N,
|
|
2944
2944
|
middleware: E
|
|
2945
|
-
}).then((D) => (
|
|
2946
|
-
throw
|
|
2945
|
+
}).then((D) => (g && g(D), D)).catch((D) => {
|
|
2946
|
+
throw g && g(D), D;
|
|
2947
2947
|
});
|
|
2948
2948
|
};
|
|
2949
2949
|
}
|
|
2950
2950
|
async request(t, ...n) {
|
|
2951
|
-
const [r, i] = n, s =
|
|
2951
|
+
const [r, i] = n, s = Xe(t, r, i), { headers: a, fetch: u = ee, method: p = "POST", requestMiddleware: d, responseMiddleware: m, ...E } = this.requestConfig, { url: g } = this;
|
|
2952
2952
|
s.signal !== void 0 && (E.signal = s.signal);
|
|
2953
|
-
const { query:
|
|
2953
|
+
const { query: N, operationName: y } = le(s.document);
|
|
2954
2954
|
return he({
|
|
2955
|
-
url:
|
|
2956
|
-
query:
|
|
2955
|
+
url: g,
|
|
2956
|
+
query: N,
|
|
2957
2957
|
variables: s.variables,
|
|
2958
2958
|
headers: {
|
|
2959
|
-
...
|
|
2960
|
-
...
|
|
2959
|
+
...U(pe(a)),
|
|
2960
|
+
...U(s.requestHeaders)
|
|
2961
2961
|
},
|
|
2962
|
-
operationName:
|
|
2962
|
+
operationName: y,
|
|
2963
2963
|
fetch: u,
|
|
2964
|
-
method:
|
|
2964
|
+
method: p,
|
|
2965
2965
|
fetchOptions: E,
|
|
2966
2966
|
middleware: d
|
|
2967
|
-
}).then((
|
|
2968
|
-
throw
|
|
2967
|
+
}).then((C) => (m && m(C), C.data)).catch((C) => {
|
|
2968
|
+
throw m && m(C), C;
|
|
2969
2969
|
});
|
|
2970
2970
|
}
|
|
2971
2971
|
// prettier-ignore
|
|
2972
2972
|
batchRequests(t, n) {
|
|
2973
|
-
const r =
|
|
2973
|
+
const r = Ze(t, n), { headers: i, ...s } = this.requestConfig;
|
|
2974
2974
|
r.signal !== void 0 && (s.signal = r.signal);
|
|
2975
|
-
const
|
|
2975
|
+
const a = r.documents.map(({ document: p }) => le(p).query), u = r.documents.map(({ variables: p }) => p);
|
|
2976
2976
|
return he({
|
|
2977
2977
|
url: this.url,
|
|
2978
|
-
query:
|
|
2978
|
+
query: a,
|
|
2979
2979
|
// @ts-expect-error TODO reconcile batch variables into system.
|
|
2980
2980
|
variables: u,
|
|
2981
2981
|
headers: {
|
|
2982
|
-
...
|
|
2983
|
-
...
|
|
2982
|
+
...U(pe(i)),
|
|
2983
|
+
...U(r.requestHeaders)
|
|
2984
2984
|
},
|
|
2985
2985
|
operationName: void 0,
|
|
2986
|
-
fetch: this.requestConfig.fetch ??
|
|
2986
|
+
fetch: this.requestConfig.fetch ?? ee,
|
|
2987
2987
|
method: this.requestConfig.method || "POST",
|
|
2988
2988
|
fetchOptions: s,
|
|
2989
2989
|
middleware: this.requestConfig.requestMiddleware
|
|
2990
|
-
}).then((
|
|
2991
|
-
throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(
|
|
2990
|
+
}).then((p) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(p), p.data)).catch((p) => {
|
|
2991
|
+
throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(p), p;
|
|
2992
2992
|
});
|
|
2993
2993
|
}
|
|
2994
2994
|
setHeaders(t) {
|
|
@@ -3009,68 +3009,68 @@ class Qt {
|
|
|
3009
3009
|
}
|
|
3010
3010
|
}
|
|
3011
3011
|
const he = async (e) => {
|
|
3012
|
-
const { query: t, variables: n, fetchOptions: r } = e, i =
|
|
3013
|
-
if (
|
|
3014
|
-
const { errors:
|
|
3012
|
+
const { query: t, variables: n, fetchOptions: r } = e, i = Gt(Qe(e.method ?? "post")), s = Array.isArray(e.query), a = await i(e), u = await zt(a, r.jsonSerializer ?? ge), p = Array.isArray(u) ? !u.some(({ data: m }) => !m) : !!u.data, d = Array.isArray(u) || !u.errors || Array.isArray(u.errors) && !u.errors.length || r.errorPolicy === "all" || r.errorPolicy === "ignore";
|
|
3013
|
+
if (a.ok && d && p) {
|
|
3014
|
+
const { errors: m, ...E } = (Array.isArray(u), u), g = r.errorPolicy === "ignore" ? E : u;
|
|
3015
3015
|
return {
|
|
3016
|
-
...s ? { data:
|
|
3017
|
-
headers:
|
|
3018
|
-
status:
|
|
3016
|
+
...s ? { data: g } : g,
|
|
3017
|
+
headers: a.headers,
|
|
3018
|
+
status: a.status
|
|
3019
3019
|
};
|
|
3020
3020
|
} else {
|
|
3021
|
-
const
|
|
3021
|
+
const m = typeof u == "string" ? {
|
|
3022
3022
|
error: u
|
|
3023
3023
|
} : u;
|
|
3024
|
-
throw new
|
|
3024
|
+
throw new H(
|
|
3025
3025
|
// @ts-expect-error TODO
|
|
3026
|
-
{ ...
|
|
3026
|
+
{ ...m, status: a.status, headers: a.headers },
|
|
3027
3027
|
{ query: t, variables: n }
|
|
3028
3028
|
);
|
|
3029
3029
|
}
|
|
3030
|
-
},
|
|
3031
|
-
const i = r ??
|
|
3030
|
+
}, Yt = (e, t, n, r) => {
|
|
3031
|
+
const i = r ?? ge;
|
|
3032
3032
|
if (!Array.isArray(e))
|
|
3033
3033
|
return i.stringify({ query: e, variables: t, operationName: n });
|
|
3034
3034
|
if (typeof t < "u" && !Array.isArray(t))
|
|
3035
3035
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
3036
|
-
const s = e.reduce((
|
|
3036
|
+
const s = e.reduce((a, u, p) => (a.push({ query: u, variables: t ? t[p] : void 0 }), a), []);
|
|
3037
3037
|
return i.stringify(s);
|
|
3038
|
-
},
|
|
3038
|
+
}, zt = async (e, t) => {
|
|
3039
3039
|
let n;
|
|
3040
3040
|
return e.headers.forEach((r, i) => {
|
|
3041
3041
|
i.toLowerCase() === "content-type" && (n = r);
|
|
3042
3042
|
}), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? t.parse(await e.text()) : e.text();
|
|
3043
3043
|
}, pe = (e) => typeof e == "function" ? e() : e;
|
|
3044
|
-
var
|
|
3045
|
-
return
|
|
3044
|
+
var ie = function() {
|
|
3045
|
+
return ie = Object.assign || function(t) {
|
|
3046
3046
|
for (var n, r = 1, i = arguments.length; r < i; r++) {
|
|
3047
3047
|
n = arguments[r];
|
|
3048
3048
|
for (var s in n)
|
|
3049
3049
|
Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
3050
3050
|
}
|
|
3051
3051
|
return t;
|
|
3052
|
-
},
|
|
3052
|
+
}, ie.apply(this, arguments);
|
|
3053
3053
|
};
|
|
3054
|
-
var
|
|
3055
|
-
function
|
|
3054
|
+
var te = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map(), qe = !0, re = !1;
|
|
3055
|
+
function Ve(e) {
|
|
3056
3056
|
return e.replace(/[\s,]+/g, " ").trim();
|
|
3057
3057
|
}
|
|
3058
|
-
function
|
|
3059
|
-
return
|
|
3058
|
+
function Qt(e) {
|
|
3059
|
+
return Ve(e.source.body.substring(e.start, e.end));
|
|
3060
3060
|
}
|
|
3061
|
-
function
|
|
3061
|
+
function Jt(e) {
|
|
3062
3062
|
var t = /* @__PURE__ */ new Set(), n = [];
|
|
3063
3063
|
return e.definitions.forEach(function(r) {
|
|
3064
3064
|
if (r.kind === "FragmentDefinition") {
|
|
3065
|
-
var i = r.name.value, s =
|
|
3066
|
-
|
|
3065
|
+
var i = r.name.value, s = Qt(r.loc), a = Ee.get(i);
|
|
3066
|
+
a && !a.has(s) ? qe && console.warn("Warning: fragment with name " + i + ` already exists.
|
|
3067
3067
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
3068
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) :
|
|
3068
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : a || Ee.set(i, a = /* @__PURE__ */ new Set()), a.add(s), t.has(s) || (t.add(s), n.push(r));
|
|
3069
3069
|
} else
|
|
3070
3070
|
n.push(r);
|
|
3071
|
-
}),
|
|
3071
|
+
}), ie(ie({}, e), { definitions: n });
|
|
3072
3072
|
}
|
|
3073
|
-
function
|
|
3073
|
+
function Xt(e) {
|
|
3074
3074
|
var t = new Set(e.definitions);
|
|
3075
3075
|
t.forEach(function(r) {
|
|
3076
3076
|
r.loc && delete r.loc, Object.keys(r).forEach(function(i) {
|
|
@@ -3081,65 +3081,52 @@ function Kt(e) {
|
|
|
3081
3081
|
var n = e.loc;
|
|
3082
3082
|
return n && (delete n.startToken, delete n.endToken), e;
|
|
3083
3083
|
}
|
|
3084
|
-
function
|
|
3085
|
-
var t =
|
|
3086
|
-
if (!
|
|
3087
|
-
var n =
|
|
3088
|
-
experimentalFragmentVariables:
|
|
3089
|
-
allowLegacyFragmentVariables:
|
|
3084
|
+
function Wt(e) {
|
|
3085
|
+
var t = Ve(e);
|
|
3086
|
+
if (!te.has(t)) {
|
|
3087
|
+
var n = Ue(e, {
|
|
3088
|
+
experimentalFragmentVariables: re,
|
|
3089
|
+
allowLegacyFragmentVariables: re
|
|
3090
3090
|
});
|
|
3091
3091
|
if (!n || n.kind !== "Document")
|
|
3092
3092
|
throw new Error("Not a valid GraphQL document.");
|
|
3093
|
-
|
|
3093
|
+
te.set(t, Xt(Jt(n)));
|
|
3094
3094
|
}
|
|
3095
|
-
return
|
|
3095
|
+
return te.get(t);
|
|
3096
3096
|
}
|
|
3097
|
-
function
|
|
3097
|
+
function q(e) {
|
|
3098
3098
|
for (var t = [], n = 1; n < arguments.length; n++)
|
|
3099
3099
|
t[n - 1] = arguments[n];
|
|
3100
3100
|
typeof e == "string" && (e = [e]);
|
|
3101
3101
|
var r = e[0];
|
|
3102
3102
|
return t.forEach(function(i, s) {
|
|
3103
3103
|
i && i.kind === "Document" ? r += i.loc.source.body : r += i, r += e[s + 1];
|
|
3104
|
-
}),
|
|
3104
|
+
}), Wt(r);
|
|
3105
3105
|
}
|
|
3106
|
-
function
|
|
3107
|
-
|
|
3108
|
-
}
|
|
3109
|
-
function nn() {
|
|
3110
|
-
$e = !1;
|
|
3106
|
+
function Zt() {
|
|
3107
|
+
te.clear(), Ee.clear();
|
|
3111
3108
|
}
|
|
3112
|
-
function
|
|
3113
|
-
|
|
3109
|
+
function Kt() {
|
|
3110
|
+
qe = !1;
|
|
3114
3111
|
}
|
|
3115
|
-
function
|
|
3116
|
-
|
|
3112
|
+
function en() {
|
|
3113
|
+
re = !0;
|
|
3117
3114
|
}
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3115
|
+
function tn() {
|
|
3116
|
+
re = !1;
|
|
3117
|
+
}
|
|
3118
|
+
var $ = {
|
|
3119
|
+
gql: q,
|
|
3120
|
+
resetCaches: Zt,
|
|
3121
|
+
disableFragmentWarnings: Kt,
|
|
3122
|
+
enableExperimentalFragmentVariables: en,
|
|
3123
|
+
disableExperimentalFragmentVariables: tn
|
|
3124
3124
|
};
|
|
3125
3125
|
(function(e) {
|
|
3126
|
-
e.gql =
|
|
3127
|
-
})(
|
|
3128
|
-
|
|
3129
|
-
const
|
|
3130
|
-
var Ce;
|
|
3131
|
-
(function(e) {
|
|
3132
|
-
e.CreatedAt = "CREATED_AT";
|
|
3133
|
-
})(Ce || (Ce = {}));
|
|
3134
|
-
var Se;
|
|
3135
|
-
(function(e) {
|
|
3136
|
-
e.CreatedAt = "CREATED_AT";
|
|
3137
|
-
})(Se || (Se = {}));
|
|
3138
|
-
var we;
|
|
3139
|
-
(function(e) {
|
|
3140
|
-
e.Invalid = "INVALID", e.Public = "PUBLIC", e.TenantUser = "TENANT_USER";
|
|
3141
|
-
})(we || (we = {}));
|
|
3142
|
-
const on = oe`
|
|
3126
|
+
e.gql = $.gql, e.resetCaches = $.resetCaches, e.disableFragmentWarnings = $.disableFragmentWarnings, e.enableExperimentalFragmentVariables = $.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = $.disableExperimentalFragmentVariables;
|
|
3127
|
+
})(q || (q = {}));
|
|
3128
|
+
q.default = q;
|
|
3129
|
+
const P = q, nn = P`
|
|
3143
3130
|
query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
3144
3131
|
locationAvailabilities(
|
|
3145
3132
|
sku: $sku
|
|
@@ -3162,7 +3149,7 @@ const on = oe`
|
|
|
3162
3149
|
}
|
|
3163
3150
|
}
|
|
3164
3151
|
}
|
|
3165
|
-
`,
|
|
3152
|
+
`, rn = P`
|
|
3166
3153
|
query GetLocationAvailability($sku: String!, $locationID: ID!) {
|
|
3167
3154
|
locationAvailability(sku: $sku, locationID: $locationID) {
|
|
3168
3155
|
location {
|
|
@@ -3172,7 +3159,7 @@ const on = oe`
|
|
|
3172
3159
|
inventoryQuantity
|
|
3173
3160
|
}
|
|
3174
3161
|
}
|
|
3175
|
-
`,
|
|
3162
|
+
`, sn = P`
|
|
3176
3163
|
query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
|
|
3177
3164
|
purchasingCustomerMetafield(namespace: $namespace, key: $key) {
|
|
3178
3165
|
id
|
|
@@ -3181,34 +3168,145 @@ const on = oe`
|
|
|
3181
3168
|
value
|
|
3182
3169
|
}
|
|
3183
3170
|
}
|
|
3184
|
-
`,
|
|
3171
|
+
`, on = P`
|
|
3185
3172
|
query GetPoints {
|
|
3186
3173
|
purchasingCustomer {
|
|
3187
3174
|
pointsApproved
|
|
3188
3175
|
pointsPending
|
|
3189
3176
|
}
|
|
3190
3177
|
}
|
|
3191
|
-
`,
|
|
3192
|
-
|
|
3178
|
+
`, an = P`
|
|
3179
|
+
query GetLocations($first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
3180
|
+
locations(first: $first, after: $after, isReverse: $isReverse) {
|
|
3181
|
+
nodes {
|
|
3182
|
+
id
|
|
3183
|
+
name
|
|
3184
|
+
}
|
|
3185
|
+
pageInfo {
|
|
3186
|
+
startCursor
|
|
3187
|
+
endCursor
|
|
3188
|
+
hasNextPage
|
|
3189
|
+
hasPreviousPage
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
`, cn = P`
|
|
3194
|
+
query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
3195
|
+
purchasingCustomer {
|
|
3196
|
+
id
|
|
3197
|
+
discounts(first: $first, after: $after, isReverse: $isReverse) {
|
|
3198
|
+
nodes {
|
|
3199
|
+
id
|
|
3200
|
+
title
|
|
3201
|
+
description
|
|
3202
|
+
code
|
|
3203
|
+
createdAt
|
|
3204
|
+
updatedAt
|
|
3205
|
+
}
|
|
3206
|
+
pageInfo {
|
|
3207
|
+
startCursor
|
|
3208
|
+
endCursor
|
|
3209
|
+
hasNextPage
|
|
3210
|
+
hasPreviousPage
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
`, un = P`
|
|
3216
|
+
query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
|
|
3217
|
+
purchasingCustomer {
|
|
3218
|
+
id
|
|
3219
|
+
pointChangeActivities(
|
|
3220
|
+
first: $first
|
|
3221
|
+
after: $after
|
|
3222
|
+
isReverse: $isReverse
|
|
3223
|
+
sortKeys: $sortKeys
|
|
3224
|
+
) {
|
|
3225
|
+
nodes {
|
|
3226
|
+
id
|
|
3227
|
+
title
|
|
3228
|
+
pointChange {
|
|
3229
|
+
id
|
|
3230
|
+
delta
|
|
3231
|
+
availableAt
|
|
3232
|
+
expiresDate
|
|
3233
|
+
availableUntil
|
|
3234
|
+
pointChangeCreatedAt
|
|
3235
|
+
createdAt
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
pageInfo {
|
|
3239
|
+
startCursor
|
|
3240
|
+
endCursor
|
|
3241
|
+
hasNextPage
|
|
3242
|
+
hasPreviousPage
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
`, ln = P`
|
|
3248
|
+
query GetPurchasingCustomerRank {
|
|
3249
|
+
purchasingCustomer {
|
|
3250
|
+
currentCustomerRank {
|
|
3251
|
+
id
|
|
3252
|
+
name
|
|
3253
|
+
threshold
|
|
3254
|
+
higherRank {
|
|
3255
|
+
id
|
|
3256
|
+
name
|
|
3257
|
+
threshold
|
|
3258
|
+
}
|
|
3259
|
+
lowerRank {
|
|
3260
|
+
id
|
|
3261
|
+
name
|
|
3262
|
+
threshold
|
|
3263
|
+
}
|
|
3264
|
+
earnedPointToRankUp
|
|
3265
|
+
purchasePriceToRankUp
|
|
3266
|
+
calculationCondition {
|
|
3267
|
+
customerRankCalculationPeriod {
|
|
3268
|
+
start
|
|
3269
|
+
end
|
|
3270
|
+
}
|
|
3271
|
+
earnedPoint
|
|
3272
|
+
purchasePrice
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
`, hn = (e, t, n, r) => e();
|
|
3278
|
+
function pn(e, t = hn) {
|
|
3193
3279
|
return {
|
|
3194
3280
|
GetLocationAvailabilities(n, r) {
|
|
3195
|
-
return t((i) => e.request(
|
|
3281
|
+
return t((i) => e.request(nn, n, { ...r, ...i }), "GetLocationAvailabilities", "query", n);
|
|
3196
3282
|
},
|
|
3197
3283
|
GetLocationAvailability(n, r) {
|
|
3198
|
-
return t((i) => e.request(
|
|
3284
|
+
return t((i) => e.request(rn, n, { ...r, ...i }), "GetLocationAvailability", "query", n);
|
|
3199
3285
|
},
|
|
3200
3286
|
GetPurchasingCustomerMetafield(n, r) {
|
|
3201
|
-
return t((i) => e.request(
|
|
3287
|
+
return t((i) => e.request(sn, n, { ...r, ...i }), "GetPurchasingCustomerMetafield", "query", n);
|
|
3202
3288
|
},
|
|
3203
3289
|
GetPoints(n, r) {
|
|
3204
|
-
return t((i) => e.request(
|
|
3290
|
+
return t((i) => e.request(on, n, { ...r, ...i }), "GetPoints", "query", n);
|
|
3291
|
+
},
|
|
3292
|
+
GetLocations(n, r) {
|
|
3293
|
+
return t((i) => e.request(an, n, { ...r, ...i }), "GetLocations", "query", n);
|
|
3294
|
+
},
|
|
3295
|
+
GetPurchasingCustomerDiscounts(n, r) {
|
|
3296
|
+
return t((i) => e.request(cn, n, { ...r, ...i }), "GetPurchasingCustomerDiscounts", "query", n);
|
|
3297
|
+
},
|
|
3298
|
+
GetPurchasingCustomerPointChangeActivities(n, r) {
|
|
3299
|
+
return t((i) => e.request(un, n, { ...r, ...i }), "GetPurchasingCustomerPointChangeActivities", "query", n);
|
|
3300
|
+
},
|
|
3301
|
+
GetPurchasingCustomerRank(n, r) {
|
|
3302
|
+
return t((i) => e.request(ln, n, { ...r, ...i }), "GetPurchasingCustomerRank", "query", n);
|
|
3205
3303
|
}
|
|
3206
3304
|
};
|
|
3207
3305
|
}
|
|
3208
|
-
class
|
|
3306
|
+
class fn {
|
|
3209
3307
|
constructor(t) {
|
|
3210
|
-
|
|
3211
|
-
this.api =
|
|
3308
|
+
Ae(this, "api");
|
|
3309
|
+
this.api = pn(new Ht(`${t}/apps/sq-api`, {
|
|
3212
3310
|
headers: {
|
|
3213
3311
|
"X-SQ-CLIENT": "ShopifyAppProxy"
|
|
3214
3312
|
}
|
|
@@ -3225,11 +3323,11 @@ class dn {
|
|
|
3225
3323
|
async getLocationAvailabilities(t, n, r, i) {
|
|
3226
3324
|
const s = await this.api.GetLocationAvailabilities({ sku: t, first: n, after: r, isReverse: i });
|
|
3227
3325
|
return {
|
|
3228
|
-
nodes: s.locationAvailabilities.nodes.map((
|
|
3326
|
+
nodes: s.locationAvailabilities.nodes.map((a) => ({
|
|
3229
3327
|
location: {
|
|
3230
|
-
name:
|
|
3328
|
+
name: a.location.name
|
|
3231
3329
|
},
|
|
3232
|
-
inventoryQuantity:
|
|
3330
|
+
inventoryQuantity: a.inventoryQuantity
|
|
3233
3331
|
})) ?? [],
|
|
3234
3332
|
pageInfo: s.locationAvailabilities.pageInfo ?? null
|
|
3235
3333
|
};
|
|
@@ -3294,22 +3392,80 @@ class dn {
|
|
|
3294
3392
|
* @param {boolean} [isReverse] 並び順。デフォルトはfalse。
|
|
3295
3393
|
*/
|
|
3296
3394
|
async getPurchasingCustomerDiscounts(t, n, r) {
|
|
3297
|
-
var s, c, u;
|
|
3298
3395
|
const i = await this.api.GetPurchasingCustomerDiscounts({ first: t, after: n, isReverse: r });
|
|
3299
|
-
return {
|
|
3300
|
-
id:
|
|
3301
|
-
nodes:
|
|
3302
|
-
id:
|
|
3303
|
-
title:
|
|
3304
|
-
description:
|
|
3305
|
-
code:
|
|
3306
|
-
createdAt: new Date(
|
|
3307
|
-
updatedAt: new Date(
|
|
3308
|
-
}))
|
|
3309
|
-
pageInfo:
|
|
3310
|
-
};
|
|
3396
|
+
return i.purchasingCustomer ? {
|
|
3397
|
+
id: i.purchasingCustomer.id,
|
|
3398
|
+
nodes: i.purchasingCustomer.discounts.nodes.map((s) => ({
|
|
3399
|
+
id: s.id,
|
|
3400
|
+
title: s.title,
|
|
3401
|
+
description: s.description,
|
|
3402
|
+
code: s.code,
|
|
3403
|
+
createdAt: new Date(s.createdAt),
|
|
3404
|
+
updatedAt: new Date(s.updatedAt)
|
|
3405
|
+
})) ?? [],
|
|
3406
|
+
pageInfo: i.purchasingCustomer.discounts.pageInfo ?? null
|
|
3407
|
+
} : null;
|
|
3408
|
+
}
|
|
3409
|
+
/**
|
|
3410
|
+
* getPointChangeActivities は購入者のポイント変動履歴を返します。
|
|
3411
|
+
*
|
|
3412
|
+
* @param {number} [first] 取得してくる個数。デフォルトは250。
|
|
3413
|
+
* @param {string} [after] ページングの値。指定しない場合先頭から取得してくる。
|
|
3414
|
+
* @param {boolean} [isReverse] 並び順。デフォルトはfalse。
|
|
3415
|
+
* @param {PointChangeActivitySortKey} [sortKeys] ソートキー。CREATED_ATかPOINT_CHANGE_CREATED_ATを渡す。デフォルトはCREATED_AT。
|
|
3416
|
+
*/
|
|
3417
|
+
async getPointChangeActivities(t, n, r, i) {
|
|
3418
|
+
const s = await this.api.GetPurchasingCustomerPointChangeActivities({ first: t, after: n, isReverse: r, sortKeys: i });
|
|
3419
|
+
return s.purchasingCustomer ? {
|
|
3420
|
+
nodes: s.purchasingCustomer.pointChangeActivities.nodes.map((a) => ({
|
|
3421
|
+
id: a.id,
|
|
3422
|
+
title: a.title,
|
|
3423
|
+
pointChange: {
|
|
3424
|
+
id: a.pointChange.id,
|
|
3425
|
+
delta: a.pointChange.delta,
|
|
3426
|
+
availableAt: a.pointChange.availableAt ? new Date(a.pointChange.availableAt) : void 0,
|
|
3427
|
+
availableUntil: a.pointChange.availableUntil ? new Date(a.pointChange.availableUntil) : void 0,
|
|
3428
|
+
expiresDate: a.pointChange.expiresDate ? new Date(a.pointChange.expiresDate) : void 0,
|
|
3429
|
+
pointChangeCreatedAt: new Date(a.pointChange.pointChangeCreatedAt),
|
|
3430
|
+
createdAt: new Date(a.pointChange.createdAt)
|
|
3431
|
+
}
|
|
3432
|
+
})),
|
|
3433
|
+
pageInfo: s.purchasingCustomer.pointChangeActivities.pageInfo
|
|
3434
|
+
} : null;
|
|
3435
|
+
}
|
|
3436
|
+
/**
|
|
3437
|
+
* getPurchasingCustomerCurrentRank は購入者の現在のランク情報を返します。
|
|
3438
|
+
*/
|
|
3439
|
+
async getPurchasingCustomerCurrentRank() {
|
|
3440
|
+
var n;
|
|
3441
|
+
const t = await this.api.GetPurchasingCustomerRank();
|
|
3442
|
+
return (n = t.purchasingCustomer) != null && n.currentCustomerRank ? {
|
|
3443
|
+
id: t.purchasingCustomer.currentCustomerRank.id,
|
|
3444
|
+
name: t.purchasingCustomer.currentCustomerRank.name,
|
|
3445
|
+
calculationCondition: {
|
|
3446
|
+
customerRankCalculationPeriod: t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod ? {
|
|
3447
|
+
start: new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),
|
|
3448
|
+
end: new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)
|
|
3449
|
+
} : void 0,
|
|
3450
|
+
earnedPoint: t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,
|
|
3451
|
+
purchasePrice: t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice
|
|
3452
|
+
},
|
|
3453
|
+
earnedPointToRankUp: t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,
|
|
3454
|
+
higherRank: t.purchasingCustomer.currentCustomerRank.higherRank ? {
|
|
3455
|
+
id: t.purchasingCustomer.currentCustomerRank.higherRank.id,
|
|
3456
|
+
name: t.purchasingCustomer.currentCustomerRank.higherRank.name,
|
|
3457
|
+
threshold: t.purchasingCustomer.currentCustomerRank.higherRank.threshold
|
|
3458
|
+
} : void 0,
|
|
3459
|
+
lowerRank: t.purchasingCustomer.currentCustomerRank.lowerRank ? {
|
|
3460
|
+
id: t.purchasingCustomer.currentCustomerRank.lowerRank.id,
|
|
3461
|
+
name: t.purchasingCustomer.currentCustomerRank.lowerRank.name,
|
|
3462
|
+
threshold: t.purchasingCustomer.currentCustomerRank.lowerRank.threshold
|
|
3463
|
+
} : void 0,
|
|
3464
|
+
purchasePriceToRankUp: t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,
|
|
3465
|
+
threshold: t.purchasingCustomer.currentCustomerRank.threshold
|
|
3466
|
+
} : null;
|
|
3311
3467
|
}
|
|
3312
3468
|
}
|
|
3313
3469
|
export {
|
|
3314
|
-
|
|
3470
|
+
fn as SDK
|
|
3315
3471
|
};
|