dorian 2.6.8 → 3.0.0
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.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/.npm-version +1 -1
- data/.rubocop.yml +25 -21
- data/.ruby-version +1 -1
- data/.tool-versions +2 -3
- data/Gemfile +0 -4
- data/Gemfile.lock +63 -116
- data/VERSION +1 -1
- data/dorian.gemspec +19 -19
- data/lib/dorian/bin.rb +82 -75
- data/package-lock.json +8 -8
- data/package.json +5 -5
- data/vendor/prettier/LICENSE +0 -4372
- data/vendor/prettier/README.md +14 -19
- data/vendor/prettier/THIRD-PARTY-NOTICES.md +6059 -0
- data/vendor/prettier/bin/prettier.cjs +27 -18
- data/vendor/prettier/doc.d.ts +11 -0
- data/vendor/prettier/doc.js +742 -776
- data/vendor/prettier/doc.mjs +743 -766
- data/vendor/prettier/index.cjs +266 -371
- data/vendor/prettier/index.d.ts +43 -16
- data/vendor/prettier/index.mjs +9615 -16721
- data/vendor/prettier/internal/experimental-cli-worker.mjs +2841 -0
- data/vendor/prettier/internal/experimental-cli.mjs +12790 -0
- data/vendor/prettier/internal/legacy-cli.mjs +6229 -0
- data/vendor/prettier/package.json +113 -108
- data/vendor/prettier/plugins/acorn.js +16 -6618
- data/vendor/prettier/plugins/acorn.mjs +16 -6456
- data/vendor/prettier/plugins/angular.js +4 -2435
- data/vendor/prettier/plugins/angular.mjs +4 -2375
- data/vendor/prettier/plugins/babel.d.ts +7 -7
- data/vendor/prettier/plugins/babel.js +15 -14271
- data/vendor/prettier/plugins/babel.mjs +15 -13986
- data/vendor/prettier/plugins/estree.d.ts +6 -1
- data/vendor/prettier/plugins/estree.js +43 -9486
- data/vendor/prettier/plugins/estree.mjs +43 -9278
- data/vendor/prettier/plugins/flow.js +19 -51476
- data/vendor/prettier/plugins/flow.mjs +19 -51218
- data/vendor/prettier/plugins/glimmer.d.ts +5 -1
- data/vendor/prettier/plugins/glimmer.js +30 -8527
- data/vendor/prettier/plugins/glimmer.mjs +30 -8414
- data/vendor/prettier/plugins/graphql.d.ts +5 -1
- data/vendor/prettier/plugins/graphql.js +15 -2408
- data/vendor/prettier/plugins/graphql.mjs +15 -2334
- data/vendor/prettier/plugins/html.d.ts +6 -1
- data/vendor/prettier/plugins/html.js +25 -8182
- data/vendor/prettier/plugins/html.mjs +25 -8077
- data/vendor/prettier/plugins/markdown.d.ts +5 -1
- data/vendor/prettier/plugins/markdown.js +57 -9063
- data/vendor/prettier/plugins/markdown.mjs +57 -8972
- data/vendor/prettier/plugins/meriyah.js +5 -5953
- data/vendor/prettier/plugins/meriyah.mjs +5 -5800
- data/vendor/prettier/plugins/postcss.d.ts +5 -1
- data/vendor/prettier/plugins/postcss.js +61 -9244
- data/vendor/prettier/plugins/postcss.mjs +61 -9046
- data/vendor/prettier/plugins/typescript.js +15 -38052
- data/vendor/prettier/plugins/typescript.mjs +15 -37726
- data/vendor/prettier/plugins/yaml.d.ts +5 -1
- data/vendor/prettier/plugins/yaml.js +157 -7423
- data/vendor/prettier/plugins/yaml.mjs +157 -7327
- data/vendor/prettier/standalone.d.ts +1 -1
- data/vendor/prettier/standalone.js +29 -3984
- data/vendor/prettier/standalone.mjs +29 -3938
- metadata +145 -40
- data/vendor/prettier/internal/cli.mjs +0 -4366
|
@@ -1,1555 +1,20 @@
|
|
|
1
|
-
(function (f) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
if (typeof exports == "object" && typeof module == "object")
|
|
7
|
-
module.exports = e();
|
|
8
|
-
else if (typeof define == "function" && define.amd) define(e);
|
|
9
|
-
else {
|
|
10
|
-
var t =
|
|
11
|
-
typeof globalThis < "u"
|
|
12
|
-
? globalThis
|
|
13
|
-
: typeof global < "u"
|
|
14
|
-
? global
|
|
15
|
-
: typeof self < "u"
|
|
16
|
-
? self
|
|
17
|
-
: this || {};
|
|
18
|
-
(t.prettierPlugins = t.prettierPlugins || {}),
|
|
19
|
-
(t.prettierPlugins.graphql = e());
|
|
20
|
-
}
|
|
21
|
-
})(function () {
|
|
22
|
-
"use strict";
|
|
23
|
-
var re = Object.defineProperty;
|
|
24
|
-
var tt = Object.getOwnPropertyDescriptor;
|
|
25
|
-
var nt = Object.getOwnPropertyNames;
|
|
26
|
-
var it = Object.prototype.hasOwnProperty;
|
|
27
|
-
var Ne = (e, t) => {
|
|
28
|
-
for (var n in t) re(e, n, { get: t[n], enumerable: !0 });
|
|
29
|
-
},
|
|
30
|
-
rt = (e, t, n, r) => {
|
|
31
|
-
if ((t && typeof t == "object") || typeof t == "function")
|
|
32
|
-
for (let i of nt(t))
|
|
33
|
-
!it.call(e, i) &&
|
|
34
|
-
i !== n &&
|
|
35
|
-
re(e, i, {
|
|
36
|
-
get: () => t[i],
|
|
37
|
-
enumerable: !(r = tt(t, i)) || r.enumerable,
|
|
38
|
-
});
|
|
39
|
-
return e;
|
|
40
|
-
};
|
|
41
|
-
var st = (e) => rt(re({}, "__esModule", { value: !0 }), e);
|
|
42
|
-
var ln = {};
|
|
43
|
-
Ne(ln, {
|
|
44
|
-
languages: () => Pe,
|
|
45
|
-
options: () => we,
|
|
46
|
-
parsers: () => Te,
|
|
47
|
-
printers: () => un,
|
|
48
|
-
});
|
|
49
|
-
var ot = (e, t, n, r) => {
|
|
50
|
-
if (!(e && t == null))
|
|
51
|
-
return t.replaceAll
|
|
52
|
-
? t.replaceAll(n, r)
|
|
53
|
-
: n.global
|
|
54
|
-
? t.replace(n, r)
|
|
55
|
-
: t.split(n).join(r);
|
|
56
|
-
},
|
|
57
|
-
Y = ot;
|
|
58
|
-
var se = "indent";
|
|
59
|
-
var oe = "group";
|
|
60
|
-
var ae = "if-break";
|
|
61
|
-
var P = "line";
|
|
62
|
-
var ce = "break-parent";
|
|
63
|
-
var xe = () => {},
|
|
64
|
-
b = xe,
|
|
65
|
-
ue = xe;
|
|
66
|
-
function x(e) {
|
|
67
|
-
return b(e), { type: se, contents: e };
|
|
68
|
-
}
|
|
69
|
-
function y(e, t = {}) {
|
|
70
|
-
return (
|
|
71
|
-
b(e),
|
|
72
|
-
ue(t.expandedStates, !0),
|
|
73
|
-
{
|
|
74
|
-
type: oe,
|
|
75
|
-
id: t.id,
|
|
76
|
-
contents: e,
|
|
77
|
-
break: !!t.shouldBreak,
|
|
78
|
-
expandedStates: t.expandedStates,
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
function O(e, t = "", n = {}) {
|
|
83
|
-
return (
|
|
84
|
-
b(e),
|
|
85
|
-
t !== "" && b(t),
|
|
86
|
-
{ type: ae, breakContents: e, flatContents: t, groupId: n.groupId }
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
var xt = { type: ce };
|
|
90
|
-
var _t = { type: P, hard: !0 };
|
|
91
|
-
var k = { type: P },
|
|
92
|
-
p = { type: P, soft: !0 },
|
|
93
|
-
f = [_t, xt];
|
|
94
|
-
function E(e, t) {
|
|
95
|
-
b(e), ue(t);
|
|
96
|
-
let n = [];
|
|
97
|
-
for (let r = 0; r < t.length; r++) r !== 0 && n.push(e), n.push(t[r]);
|
|
98
|
-
return n;
|
|
99
|
-
}
|
|
100
|
-
function j(e) {
|
|
101
|
-
return (t, n, r) => {
|
|
102
|
-
let i = !!(r != null && r.backwards);
|
|
103
|
-
if (n === !1) return !1;
|
|
104
|
-
let { length: s } = t,
|
|
105
|
-
a = n;
|
|
106
|
-
for (; a >= 0 && a < s; ) {
|
|
107
|
-
let u = t.charAt(a);
|
|
108
|
-
if (e instanceof RegExp) {
|
|
109
|
-
if (!e.test(u)) return a;
|
|
110
|
-
} else if (!e.includes(u)) return a;
|
|
111
|
-
i ? a-- : a++;
|
|
112
|
-
}
|
|
113
|
-
return a === -1 || a === s ? a : !1;
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
var vn = j(/\s/u),
|
|
117
|
-
G = j(" "),
|
|
118
|
-
_e = j(",; "),
|
|
119
|
-
ye = j(/[^\n\r]/u);
|
|
120
|
-
function yt(e, t, n) {
|
|
121
|
-
let r = !!(n != null && n.backwards);
|
|
122
|
-
if (t === !1) return !1;
|
|
123
|
-
let i = e.charAt(t);
|
|
124
|
-
if (r) {
|
|
125
|
-
if (
|
|
126
|
-
e.charAt(t - 1) === "\r" &&
|
|
127
|
-
i ===
|
|
128
|
-
`
|
|
129
|
-
`
|
|
130
|
-
)
|
|
131
|
-
return t - 2;
|
|
132
|
-
if (
|
|
133
|
-
i ===
|
|
134
|
-
`
|
|
135
|
-
` ||
|
|
136
|
-
i === "\r" ||
|
|
137
|
-
i === "\u2028" ||
|
|
138
|
-
i === "\u2029"
|
|
139
|
-
)
|
|
140
|
-
return t - 1;
|
|
141
|
-
} else {
|
|
142
|
-
if (
|
|
143
|
-
i === "\r" &&
|
|
144
|
-
e.charAt(t + 1) ===
|
|
145
|
-
`
|
|
146
|
-
`
|
|
147
|
-
)
|
|
148
|
-
return t + 2;
|
|
149
|
-
if (
|
|
150
|
-
i ===
|
|
151
|
-
`
|
|
152
|
-
` ||
|
|
153
|
-
i === "\r" ||
|
|
154
|
-
i === "\u2028" ||
|
|
155
|
-
i === "\u2029"
|
|
156
|
-
)
|
|
157
|
-
return t + 1;
|
|
158
|
-
}
|
|
159
|
-
return t;
|
|
160
|
-
}
|
|
161
|
-
var $ = yt;
|
|
162
|
-
function It(e, t, n = {}) {
|
|
163
|
-
let r = G(e, n.backwards ? t - 1 : t, n),
|
|
164
|
-
i = $(e, r, n);
|
|
165
|
-
return r !== i;
|
|
166
|
-
}
|
|
167
|
-
var Ie = It;
|
|
168
|
-
function Ot(e, t) {
|
|
169
|
-
if (t === !1) return !1;
|
|
170
|
-
if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
|
|
171
|
-
for (let n = t + 2; n < e.length; ++n)
|
|
172
|
-
if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
|
|
173
|
-
}
|
|
174
|
-
return t;
|
|
175
|
-
}
|
|
176
|
-
var Oe = Ot;
|
|
177
|
-
function Dt(e, t) {
|
|
178
|
-
return t === !1
|
|
179
|
-
? !1
|
|
180
|
-
: e.charAt(t) === "/" && e.charAt(t + 1) === "/"
|
|
181
|
-
? ye(e, t)
|
|
182
|
-
: t;
|
|
183
|
-
}
|
|
184
|
-
var De = Dt;
|
|
185
|
-
function At(e, t) {
|
|
186
|
-
let n = null,
|
|
187
|
-
r = t;
|
|
188
|
-
for (; r !== n; ) (n = r), (r = _e(e, r)), (r = Oe(e, r)), (r = G(e, r));
|
|
189
|
-
return (r = De(e, r)), (r = $(e, r)), r !== !1 && Ie(e, r);
|
|
190
|
-
}
|
|
191
|
-
var Ae = At;
|
|
192
|
-
function gt(e) {
|
|
193
|
-
return Array.isArray(e) && e.length > 0;
|
|
194
|
-
}
|
|
195
|
-
var le = gt;
|
|
196
|
-
var pe = class extends Error {
|
|
197
|
-
name = "UnexpectedNodeError";
|
|
198
|
-
constructor(t, n, r = "type") {
|
|
199
|
-
super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),
|
|
200
|
-
(this.node = t);
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
ge = pe;
|
|
204
|
-
var F = null;
|
|
205
|
-
function w(e) {
|
|
206
|
-
if (F !== null && typeof F.property) {
|
|
207
|
-
let t = F;
|
|
208
|
-
return (F = w.prototype = null), t;
|
|
209
|
-
}
|
|
210
|
-
return (F = w.prototype = e ?? Object.create(null)), new w();
|
|
211
|
-
}
|
|
212
|
-
var kt = 10;
|
|
213
|
-
for (let e = 0; e <= kt; e++) w();
|
|
214
|
-
function fe(e) {
|
|
215
|
-
return w(e);
|
|
216
|
-
}
|
|
217
|
-
function St(e, t = "type") {
|
|
218
|
-
fe(e);
|
|
219
|
-
function n(r) {
|
|
220
|
-
let i = r[t],
|
|
221
|
-
s = e[i];
|
|
222
|
-
if (!Array.isArray(s))
|
|
223
|
-
throw Object.assign(new Error(`Missing visitor keys for '${i}'.`), {
|
|
224
|
-
node: r,
|
|
225
|
-
});
|
|
226
|
-
return s;
|
|
227
|
-
}
|
|
228
|
-
return n;
|
|
229
|
-
}
|
|
230
|
-
var ke = St;
|
|
231
|
-
var J = class {
|
|
232
|
-
constructor(t, n, r) {
|
|
233
|
-
(this.start = t.start),
|
|
234
|
-
(this.end = n.end),
|
|
235
|
-
(this.startToken = t),
|
|
236
|
-
(this.endToken = n),
|
|
237
|
-
(this.source = r);
|
|
238
|
-
}
|
|
239
|
-
get [Symbol.toStringTag]() {
|
|
240
|
-
return "Location";
|
|
241
|
-
}
|
|
242
|
-
toJSON() {
|
|
243
|
-
return { start: this.start, end: this.end };
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
V = class {
|
|
247
|
-
constructor(t, n, r, i, s, a) {
|
|
248
|
-
(this.kind = t),
|
|
249
|
-
(this.start = n),
|
|
250
|
-
(this.end = r),
|
|
251
|
-
(this.line = i),
|
|
252
|
-
(this.column = s),
|
|
253
|
-
(this.value = a),
|
|
254
|
-
(this.prev = null),
|
|
255
|
-
(this.next = null);
|
|
256
|
-
}
|
|
257
|
-
get [Symbol.toStringTag]() {
|
|
258
|
-
return "Token";
|
|
259
|
-
}
|
|
260
|
-
toJSON() {
|
|
261
|
-
return {
|
|
262
|
-
kind: this.kind,
|
|
263
|
-
value: this.value,
|
|
264
|
-
line: this.line,
|
|
265
|
-
column: this.column,
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
X = {
|
|
270
|
-
Name: [],
|
|
271
|
-
Document: ["definitions"],
|
|
272
|
-
OperationDefinition: [
|
|
273
|
-
"name",
|
|
274
|
-
"variableDefinitions",
|
|
275
|
-
"directives",
|
|
276
|
-
"selectionSet",
|
|
277
|
-
],
|
|
278
|
-
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
279
|
-
Variable: ["name"],
|
|
280
|
-
SelectionSet: ["selections"],
|
|
281
|
-
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
282
|
-
Argument: ["name", "value"],
|
|
283
|
-
FragmentSpread: ["name", "directives"],
|
|
284
|
-
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
285
|
-
FragmentDefinition: [
|
|
286
|
-
"name",
|
|
287
|
-
"variableDefinitions",
|
|
288
|
-
"typeCondition",
|
|
289
|
-
"directives",
|
|
290
|
-
"selectionSet",
|
|
291
|
-
],
|
|
292
|
-
IntValue: [],
|
|
293
|
-
FloatValue: [],
|
|
294
|
-
StringValue: [],
|
|
295
|
-
BooleanValue: [],
|
|
296
|
-
NullValue: [],
|
|
297
|
-
EnumValue: [],
|
|
298
|
-
ListValue: ["values"],
|
|
299
|
-
ObjectValue: ["fields"],
|
|
300
|
-
ObjectField: ["name", "value"],
|
|
301
|
-
Directive: ["name", "arguments"],
|
|
302
|
-
NamedType: ["name"],
|
|
303
|
-
ListType: ["type"],
|
|
304
|
-
NonNullType: ["type"],
|
|
305
|
-
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
306
|
-
OperationTypeDefinition: ["type"],
|
|
307
|
-
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
308
|
-
ObjectTypeDefinition: [
|
|
309
|
-
"description",
|
|
310
|
-
"name",
|
|
311
|
-
"interfaces",
|
|
312
|
-
"directives",
|
|
313
|
-
"fields",
|
|
314
|
-
],
|
|
315
|
-
FieldDefinition: [
|
|
316
|
-
"description",
|
|
317
|
-
"name",
|
|
318
|
-
"arguments",
|
|
319
|
-
"type",
|
|
320
|
-
"directives",
|
|
321
|
-
],
|
|
322
|
-
InputValueDefinition: [
|
|
323
|
-
"description",
|
|
324
|
-
"name",
|
|
325
|
-
"type",
|
|
326
|
-
"defaultValue",
|
|
327
|
-
"directives",
|
|
328
|
-
],
|
|
329
|
-
InterfaceTypeDefinition: [
|
|
330
|
-
"description",
|
|
331
|
-
"name",
|
|
332
|
-
"interfaces",
|
|
333
|
-
"directives",
|
|
334
|
-
"fields",
|
|
335
|
-
],
|
|
336
|
-
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
337
|
-
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
338
|
-
EnumValueDefinition: ["description", "name", "directives"],
|
|
339
|
-
InputObjectTypeDefinition: [
|
|
340
|
-
"description",
|
|
341
|
-
"name",
|
|
342
|
-
"directives",
|
|
343
|
-
"fields",
|
|
344
|
-
],
|
|
345
|
-
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
346
|
-
SchemaExtension: ["directives", "operationTypes"],
|
|
347
|
-
ScalarTypeExtension: ["name", "directives"],
|
|
348
|
-
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
349
|
-
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
350
|
-
UnionTypeExtension: ["name", "directives", "types"],
|
|
351
|
-
EnumTypeExtension: ["name", "directives", "values"],
|
|
352
|
-
InputObjectTypeExtension: ["name", "directives", "fields"],
|
|
353
|
-
},
|
|
354
|
-
Hn = new Set(Object.keys(X));
|
|
355
|
-
var S;
|
|
356
|
-
(function (e) {
|
|
357
|
-
(e.QUERY = "query"),
|
|
358
|
-
(e.MUTATION = "mutation"),
|
|
359
|
-
(e.SUBSCRIPTION = "subscription");
|
|
360
|
-
})(S || (S = {}));
|
|
361
|
-
var Ct = ke(X, "kind"),
|
|
362
|
-
Se = Ct;
|
|
363
|
-
function q(e) {
|
|
364
|
-
return e.loc.start;
|
|
365
|
-
}
|
|
366
|
-
function Q(e) {
|
|
367
|
-
return e.loc.end;
|
|
368
|
-
}
|
|
369
|
-
function Ce(e) {
|
|
370
|
-
return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u.test(e);
|
|
371
|
-
}
|
|
372
|
-
function ve(e) {
|
|
373
|
-
return (
|
|
374
|
-
`# @format
|
|
1
|
+
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.graphql=e()}})(function(){"use strict";var ie=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ft=Object.prototype.hasOwnProperty;var me=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},ht=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of lt(t))!ft.call(e,r)&&r!==n&&ie(e,r,{get:()=>t[r],enumerable:!(i=pt(t,r))||i.enumerable});return e};var dt=e=>ht(ie({},"__esModule",{value:!0}),e);var cn={};me(cn,{languages:()=>je,options:()=>Xe,parsers:()=>de,printers:()=>an});var Ee=(e,t)=>(n,i,...r)=>n|1&&i==null?void 0:(t.call(i)??i[e]).apply(i,r);var mt=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},Et=Ee("replaceAll",function(){if(typeof this=="string")return mt}),U=Et;var Tt=()=>{},se=Tt;var Te="indent";var Ne="group";var xe="if-break";var G="line";var _e="break-parent";var S=se,Y=se;function x(e){return S(e),{type:Te,contents:e}}var ye={type:_e};function y(e,t={}){return S(e),Y(t.expandedStates,!0),{type:Ne,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function I(e,t="",n={}){return S(e),t!==""&&S(t),{type:xe,breakContents:e,flatContents:t,groupId:n.groupId}}function E(e,t){S(e),Y(t);let n=[];for(let i=0;i<t.length;i++)i!==0&&n.push(e),n.push(t[i]);return n}var k={type:G},l={type:G,soft:!0},Nt={type:G,hard:!0},f=[Nt,ye];function j(e){return(t,n,i)=>{let r=!!i?.backwards;if(n===!1)return!1;let{length:s}=t,a=n;for(;a>=0&&a<s;){let u=t.charAt(a);if(e instanceof RegExp){if(!e.test(u))return a}else if(!e.includes(u))return a;r?a--:a++}return a===-1||a===s?a:!1}}var Ln=j(/\s/u),$=j(" "),Ae=j(",; "),Oe=j(/[^\n\r]/u);var Ie=e=>e===`
|
|
2
|
+
`||e==="\r"||e==="\u2028"||e==="\u2029";function xt(e,t,n){let i=!!n?.backwards;if(t===!1)return!1;let r=e.charAt(t);if(i){if(e.charAt(t-1)==="\r"&&r===`
|
|
3
|
+
`)return t-2;if(Ie(r))return t-1}else{if(r==="\r"&&e.charAt(t+1)===`
|
|
4
|
+
`)return t+2;if(Ie(r))return t+1}return t}var X=xt;function _t(e,t,n={}){let i=$(e,n.backwards?t-1:t,n),r=X(e,i,n);return i!==r}var De=_t;function yt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var ge=yt;function At(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Oe(e,t):t}var Se=At;function Ot(e,t){let n=null,i=t;for(;i!==n;)n=i,i=Ae(e,i),i=ge(e,i),i=$(e,i);return i=Se(e,i),i=X(e,i),i!==!1&&De(e,i)}var ke=Ot;function It(e){return Array.isArray(e)&&e.length>0}var oe=It;var ae=class extends Error{name="UnexpectedNodeError";constructor(t,n,i="type"){super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`),this.node=t}},Ce=ae;var P=null;function w(e){if(P!==null&&typeof P.property){let t=P;return P=w.prototype=null,t}return P=w.prototype=e??Object.create(null),new w}var Dt=10;for(let e=0;e<=Dt;e++)w();function ce(e){return w(e)}function gt(e,t="type"){ce(e);function n(i){let r=i[t],s=e[r];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${r}'.`),{node:i});return s}return n}var Re=gt;var H=class{constructor(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},F=class{constructor(t,n,i,r,s,a){this.kind=t,this.start=n,this.end=i,this.line=r,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}},ue={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Zn=new Set(Object.keys(ue));var C;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(C||(C={}));var ve={...ue};for(let e of["ArgumentCoordinate","DirectiveArgumentCoordinate","DirectiveCoordinate","MemberCoordinate","TypeCoordinate"])delete ve[e];var be=ve;var St=Re(be,"kind"),Le=St;var J=e=>e.loc.start,q=e=>e.loc.end;var Pe="format",we=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u,Fe=/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;var Me=e=>Fe.test(e),Ve=e=>we.test(e),Be=e=>`# @${Pe}
|
|
375
5
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
let i = [n("description")];
|
|
383
|
-
return (
|
|
384
|
-
r.kind === "InputValueDefinition" && !r.description.block
|
|
385
|
-
? i.push(k)
|
|
386
|
-
: i.push(f),
|
|
387
|
-
i
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
var A = vt;
|
|
391
|
-
function bt(e, t, n) {
|
|
392
|
-
let { node: r } = e;
|
|
393
|
-
switch (r.kind) {
|
|
394
|
-
case "Document":
|
|
395
|
-
return [...E(f, g(e, t, n, "definitions")), f];
|
|
396
|
-
case "OperationDefinition": {
|
|
397
|
-
let i = t.originalText[q(r)] !== "{",
|
|
398
|
-
s = !!r.name;
|
|
399
|
-
return [
|
|
400
|
-
i ? r.operation : "",
|
|
401
|
-
i && s ? [" ", n("name")] : "",
|
|
402
|
-
i && !s && le(r.variableDefinitions) ? " " : "",
|
|
403
|
-
be(e, n),
|
|
404
|
-
_(e, n, r),
|
|
405
|
-
!i && !s ? "" : " ",
|
|
406
|
-
n("selectionSet"),
|
|
407
|
-
];
|
|
408
|
-
}
|
|
409
|
-
case "FragmentDefinition":
|
|
410
|
-
return [
|
|
411
|
-
"fragment ",
|
|
412
|
-
n("name"),
|
|
413
|
-
be(e, n),
|
|
414
|
-
" on ",
|
|
415
|
-
n("typeCondition"),
|
|
416
|
-
_(e, n, r),
|
|
417
|
-
" ",
|
|
418
|
-
n("selectionSet"),
|
|
419
|
-
];
|
|
420
|
-
case "SelectionSet":
|
|
421
|
-
return ["{", x([f, E(f, g(e, t, n, "selections"))]), f, "}"];
|
|
422
|
-
case "Field":
|
|
423
|
-
return y([
|
|
424
|
-
r.alias ? [n("alias"), ": "] : "",
|
|
425
|
-
n("name"),
|
|
426
|
-
r.arguments.length > 0
|
|
427
|
-
? y([
|
|
428
|
-
"(",
|
|
429
|
-
x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
|
|
430
|
-
p,
|
|
431
|
-
")",
|
|
432
|
-
])
|
|
433
|
-
: "",
|
|
434
|
-
_(e, n, r),
|
|
435
|
-
r.selectionSet ? " " : "",
|
|
436
|
-
n("selectionSet"),
|
|
437
|
-
]);
|
|
438
|
-
case "Name":
|
|
439
|
-
return r.value;
|
|
440
|
-
case "StringValue":
|
|
441
|
-
if (r.block) {
|
|
442
|
-
let i = Y(!1, r.value, '"""', String.raw`\"""`).split(`
|
|
443
|
-
`);
|
|
444
|
-
return (
|
|
445
|
-
i.length === 1 && (i[0] = i[0].trim()),
|
|
446
|
-
i.every((s) => s === "") && (i.length = 0),
|
|
447
|
-
E(f, ['"""', ...i, '"""'])
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
return [
|
|
451
|
-
'"',
|
|
452
|
-
Y(
|
|
453
|
-
!1,
|
|
454
|
-
Y(!1, r.value, /["\\]/gu, String.raw`\$&`),
|
|
455
|
-
`
|
|
456
|
-
`,
|
|
457
|
-
String.raw`\n`,
|
|
458
|
-
),
|
|
459
|
-
'"',
|
|
460
|
-
];
|
|
461
|
-
case "IntValue":
|
|
462
|
-
case "FloatValue":
|
|
463
|
-
case "EnumValue":
|
|
464
|
-
return r.value;
|
|
465
|
-
case "BooleanValue":
|
|
466
|
-
return r.value ? "true" : "false";
|
|
467
|
-
case "NullValue":
|
|
468
|
-
return "null";
|
|
469
|
-
case "Variable":
|
|
470
|
-
return ["$", n("name")];
|
|
471
|
-
case "ListValue":
|
|
472
|
-
return y([
|
|
473
|
-
"[",
|
|
474
|
-
x([p, E([O("", ", "), p], e.map(n, "values"))]),
|
|
475
|
-
p,
|
|
476
|
-
"]",
|
|
477
|
-
]);
|
|
478
|
-
case "ObjectValue": {
|
|
479
|
-
let i = t.bracketSpacing && r.fields.length > 0 ? " " : "";
|
|
480
|
-
return y([
|
|
481
|
-
"{",
|
|
482
|
-
i,
|
|
483
|
-
x([p, E([O("", ", "), p], e.map(n, "fields"))]),
|
|
484
|
-
p,
|
|
485
|
-
O("", i),
|
|
486
|
-
"}",
|
|
487
|
-
]);
|
|
488
|
-
}
|
|
489
|
-
case "ObjectField":
|
|
490
|
-
case "Argument":
|
|
491
|
-
return [n("name"), ": ", n("value")];
|
|
492
|
-
case "Directive":
|
|
493
|
-
return [
|
|
494
|
-
"@",
|
|
495
|
-
n("name"),
|
|
496
|
-
r.arguments.length > 0
|
|
497
|
-
? y([
|
|
498
|
-
"(",
|
|
499
|
-
x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
|
|
500
|
-
p,
|
|
501
|
-
")",
|
|
502
|
-
])
|
|
503
|
-
: "",
|
|
504
|
-
];
|
|
505
|
-
case "NamedType":
|
|
506
|
-
return n("name");
|
|
507
|
-
case "VariableDefinition":
|
|
508
|
-
return [
|
|
509
|
-
n("variable"),
|
|
510
|
-
": ",
|
|
511
|
-
n("type"),
|
|
512
|
-
r.defaultValue ? [" = ", n("defaultValue")] : "",
|
|
513
|
-
_(e, n, r),
|
|
514
|
-
];
|
|
515
|
-
case "ObjectTypeExtension":
|
|
516
|
-
case "ObjectTypeDefinition":
|
|
517
|
-
case "InputObjectTypeExtension":
|
|
518
|
-
case "InputObjectTypeDefinition":
|
|
519
|
-
case "InterfaceTypeExtension":
|
|
520
|
-
case "InterfaceTypeDefinition": {
|
|
521
|
-
let { kind: i } = r,
|
|
522
|
-
s = [];
|
|
523
|
-
return (
|
|
524
|
-
i.endsWith("TypeDefinition") ? s.push(A(e, t, n)) : s.push("extend "),
|
|
525
|
-
i.startsWith("ObjectType")
|
|
526
|
-
? s.push("type")
|
|
527
|
-
: i.startsWith("InputObjectType")
|
|
528
|
-
? s.push("input")
|
|
529
|
-
: s.push("interface"),
|
|
530
|
-
s.push(" ", n("name")),
|
|
531
|
-
!i.startsWith("InputObjectType") &&
|
|
532
|
-
r.interfaces.length > 0 &&
|
|
533
|
-
s.push(" implements ", ...Pt(e, t, n)),
|
|
534
|
-
s.push(_(e, n, r)),
|
|
535
|
-
r.fields.length > 0 &&
|
|
536
|
-
s.push([" {", x([f, E(f, g(e, t, n, "fields"))]), f, "}"]),
|
|
537
|
-
s
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
case "FieldDefinition":
|
|
541
|
-
return [
|
|
542
|
-
A(e, t, n),
|
|
543
|
-
n("name"),
|
|
544
|
-
r.arguments.length > 0
|
|
545
|
-
? y([
|
|
546
|
-
"(",
|
|
547
|
-
x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
|
|
548
|
-
p,
|
|
549
|
-
")",
|
|
550
|
-
])
|
|
551
|
-
: "",
|
|
552
|
-
": ",
|
|
553
|
-
n("type"),
|
|
554
|
-
_(e, n, r),
|
|
555
|
-
];
|
|
556
|
-
case "DirectiveDefinition":
|
|
557
|
-
return [
|
|
558
|
-
A(e, t, n),
|
|
559
|
-
"directive ",
|
|
560
|
-
"@",
|
|
561
|
-
n("name"),
|
|
562
|
-
r.arguments.length > 0
|
|
563
|
-
? y([
|
|
564
|
-
"(",
|
|
565
|
-
x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
|
|
566
|
-
p,
|
|
567
|
-
")",
|
|
568
|
-
])
|
|
569
|
-
: "",
|
|
570
|
-
r.repeatable ? " repeatable" : "",
|
|
571
|
-
" on ",
|
|
572
|
-
...E(" | ", e.map(n, "locations")),
|
|
573
|
-
];
|
|
574
|
-
case "EnumTypeExtension":
|
|
575
|
-
case "EnumTypeDefinition":
|
|
576
|
-
return [
|
|
577
|
-
A(e, t, n),
|
|
578
|
-
r.kind === "EnumTypeExtension" ? "extend " : "",
|
|
579
|
-
"enum ",
|
|
580
|
-
n("name"),
|
|
581
|
-
_(e, n, r),
|
|
582
|
-
r.values.length > 0
|
|
583
|
-
? [" {", x([f, E(f, g(e, t, n, "values"))]), f, "}"]
|
|
584
|
-
: "",
|
|
585
|
-
];
|
|
586
|
-
case "EnumValueDefinition":
|
|
587
|
-
return [A(e, t, n), n("name"), _(e, n, r)];
|
|
588
|
-
case "InputValueDefinition":
|
|
589
|
-
return [
|
|
590
|
-
A(e, t, n),
|
|
591
|
-
n("name"),
|
|
592
|
-
": ",
|
|
593
|
-
n("type"),
|
|
594
|
-
r.defaultValue ? [" = ", n("defaultValue")] : "",
|
|
595
|
-
_(e, n, r),
|
|
596
|
-
];
|
|
597
|
-
case "SchemaExtension":
|
|
598
|
-
return [
|
|
599
|
-
"extend schema",
|
|
600
|
-
_(e, n, r),
|
|
601
|
-
...(r.operationTypes.length > 0
|
|
602
|
-
? [" {", x([f, E(f, g(e, t, n, "operationTypes"))]), f, "}"]
|
|
603
|
-
: []),
|
|
604
|
-
];
|
|
605
|
-
case "SchemaDefinition":
|
|
606
|
-
return [
|
|
607
|
-
A(e, t, n),
|
|
608
|
-
"schema",
|
|
609
|
-
_(e, n, r),
|
|
610
|
-
" {",
|
|
611
|
-
r.operationTypes.length > 0
|
|
612
|
-
? x([f, E(f, g(e, t, n, "operationTypes"))])
|
|
613
|
-
: "",
|
|
614
|
-
f,
|
|
615
|
-
"}",
|
|
616
|
-
];
|
|
617
|
-
case "OperationTypeDefinition":
|
|
618
|
-
return [r.operation, ": ", n("type")];
|
|
619
|
-
case "FragmentSpread":
|
|
620
|
-
return ["...", n("name"), _(e, n, r)];
|
|
621
|
-
case "InlineFragment":
|
|
622
|
-
return [
|
|
623
|
-
"...",
|
|
624
|
-
r.typeCondition ? [" on ", n("typeCondition")] : "",
|
|
625
|
-
_(e, n, r),
|
|
626
|
-
" ",
|
|
627
|
-
n("selectionSet"),
|
|
628
|
-
];
|
|
629
|
-
case "UnionTypeExtension":
|
|
630
|
-
case "UnionTypeDefinition":
|
|
631
|
-
return y([
|
|
632
|
-
A(e, t, n),
|
|
633
|
-
y([
|
|
634
|
-
r.kind === "UnionTypeExtension" ? "extend " : "",
|
|
635
|
-
"union ",
|
|
636
|
-
n("name"),
|
|
637
|
-
_(e, n, r),
|
|
638
|
-
r.types.length > 0
|
|
639
|
-
? [
|
|
640
|
-
" =",
|
|
641
|
-
O("", " "),
|
|
642
|
-
x([O([k, "| "]), E([k, "| "], e.map(n, "types"))]),
|
|
643
|
-
]
|
|
644
|
-
: "",
|
|
645
|
-
]),
|
|
646
|
-
]);
|
|
647
|
-
case "ScalarTypeExtension":
|
|
648
|
-
case "ScalarTypeDefinition":
|
|
649
|
-
return [
|
|
650
|
-
A(e, t, n),
|
|
651
|
-
r.kind === "ScalarTypeExtension" ? "extend " : "",
|
|
652
|
-
"scalar ",
|
|
653
|
-
n("name"),
|
|
654
|
-
_(e, n, r),
|
|
655
|
-
];
|
|
656
|
-
case "NonNullType":
|
|
657
|
-
return [n("type"), "!"];
|
|
658
|
-
case "ListType":
|
|
659
|
-
return ["[", n("type"), "]"];
|
|
660
|
-
default:
|
|
661
|
-
throw new ge(r, "Graphql", "kind");
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
function _(e, t, n) {
|
|
665
|
-
if (n.directives.length === 0) return "";
|
|
666
|
-
let r = E(k, e.map(t, "directives"));
|
|
667
|
-
return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition"
|
|
668
|
-
? y([k, r])
|
|
669
|
-
: [" ", y(x([p, r]))];
|
|
670
|
-
}
|
|
671
|
-
function g(e, t, n, r) {
|
|
672
|
-
return e.map(({ isLast: i, node: s }) => {
|
|
673
|
-
let a = n();
|
|
674
|
-
return !i && Ae(t.originalText, Q(s)) ? [a, f] : a;
|
|
675
|
-
}, r);
|
|
676
|
-
}
|
|
677
|
-
function Lt(e) {
|
|
678
|
-
return e.kind !== "Comment";
|
|
679
|
-
}
|
|
680
|
-
function Rt(e) {
|
|
681
|
-
let t = e.node;
|
|
682
|
-
if (t.kind === "Comment") return "#" + t.value.trimEnd();
|
|
683
|
-
throw new Error("Not a comment: " + JSON.stringify(t));
|
|
684
|
-
}
|
|
685
|
-
function Pt(e, t, n) {
|
|
686
|
-
let { node: r } = e,
|
|
687
|
-
i = [],
|
|
688
|
-
{ interfaces: s } = r,
|
|
689
|
-
a = e.map(n, "interfaces");
|
|
690
|
-
for (let u = 0; u < s.length; u++) {
|
|
691
|
-
let l = s[u];
|
|
692
|
-
i.push(a[u]);
|
|
693
|
-
let T = s[u + 1];
|
|
694
|
-
if (T) {
|
|
695
|
-
let D = t.originalText.slice(l.loc.end, T.loc.start).includes("#");
|
|
696
|
-
i.push(" &", D ? k : " ");
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return i;
|
|
700
|
-
}
|
|
701
|
-
function be(e, t) {
|
|
702
|
-
let { node: n } = e;
|
|
703
|
-
return le(n.variableDefinitions)
|
|
704
|
-
? y([
|
|
705
|
-
"(",
|
|
706
|
-
x([p, E([O("", ", "), p], e.map(t, "variableDefinitions"))]),
|
|
707
|
-
p,
|
|
708
|
-
")",
|
|
709
|
-
])
|
|
710
|
-
: "";
|
|
711
|
-
}
|
|
712
|
-
function Le(e, t) {
|
|
713
|
-
e.kind === "StringValue" &&
|
|
714
|
-
e.block &&
|
|
715
|
-
!e.value.includes(`
|
|
716
|
-
`) &&
|
|
717
|
-
(t.value = e.value.trim());
|
|
718
|
-
}
|
|
719
|
-
Le.ignoredProperties = new Set(["loc", "comments"]);
|
|
720
|
-
function Ft(e) {
|
|
721
|
-
var n;
|
|
722
|
-
let { node: t } = e;
|
|
723
|
-
return (n = t == null ? void 0 : t.comments) == null
|
|
724
|
-
? void 0
|
|
725
|
-
: n.some((r) => r.value.trim() === "prettier-ignore");
|
|
726
|
-
}
|
|
727
|
-
var wt = {
|
|
728
|
-
print: bt,
|
|
729
|
-
massageAstNode: Le,
|
|
730
|
-
hasPrettierIgnore: Ft,
|
|
731
|
-
insertPragma: ve,
|
|
732
|
-
printComment: Rt,
|
|
733
|
-
canAttachComment: Lt,
|
|
734
|
-
getVisitorKeys: Se,
|
|
735
|
-
},
|
|
736
|
-
Re = wt;
|
|
737
|
-
var Pe = [
|
|
738
|
-
{
|
|
739
|
-
linguistLanguageId: 139,
|
|
740
|
-
name: "GraphQL",
|
|
741
|
-
type: "data",
|
|
742
|
-
color: "#e10098",
|
|
743
|
-
extensions: [".graphql", ".gql", ".graphqls"],
|
|
744
|
-
tmScope: "source.graphql",
|
|
745
|
-
aceMode: "text",
|
|
746
|
-
parsers: ["graphql"],
|
|
747
|
-
vscodeLanguageIds: ["graphql"],
|
|
748
|
-
},
|
|
749
|
-
];
|
|
750
|
-
var Fe = {
|
|
751
|
-
bracketSpacing: {
|
|
752
|
-
category: "Common",
|
|
753
|
-
type: "boolean",
|
|
754
|
-
default: !0,
|
|
755
|
-
description: "Print spaces between brackets.",
|
|
756
|
-
oppositeDescription: "Do not print spaces between brackets.",
|
|
757
|
-
},
|
|
758
|
-
singleQuote: {
|
|
759
|
-
category: "Common",
|
|
760
|
-
type: "boolean",
|
|
761
|
-
default: !1,
|
|
762
|
-
description: "Use single quotes instead of double quotes.",
|
|
763
|
-
},
|
|
764
|
-
proseWrap: {
|
|
765
|
-
category: "Common",
|
|
766
|
-
type: "choice",
|
|
767
|
-
default: "preserve",
|
|
768
|
-
description: "How to wrap prose.",
|
|
769
|
-
choices: [
|
|
770
|
-
{
|
|
771
|
-
value: "always",
|
|
772
|
-
description: "Wrap prose if it exceeds the print width.",
|
|
773
|
-
},
|
|
774
|
-
{ value: "never", description: "Do not wrap prose." },
|
|
775
|
-
{ value: "preserve", description: "Wrap prose as-is." },
|
|
776
|
-
],
|
|
777
|
-
},
|
|
778
|
-
bracketSameLine: {
|
|
779
|
-
category: "Common",
|
|
780
|
-
type: "boolean",
|
|
781
|
-
default: !1,
|
|
782
|
-
description:
|
|
783
|
-
"Put > of opening tags on the last line instead of on a new line.",
|
|
784
|
-
},
|
|
785
|
-
singleAttributePerLine: {
|
|
786
|
-
category: "Common",
|
|
787
|
-
type: "boolean",
|
|
788
|
-
default: !1,
|
|
789
|
-
description: "Enforce single attribute per line in HTML, Vue and JSX.",
|
|
790
|
-
},
|
|
791
|
-
};
|
|
792
|
-
var Vt = { bracketSpacing: Fe.bracketSpacing },
|
|
793
|
-
we = Vt;
|
|
794
|
-
var Te = {};
|
|
795
|
-
Ne(Te, { graphql: () => cn });
|
|
796
|
-
function Ve(e) {
|
|
797
|
-
return typeof e == "object" && e !== null;
|
|
798
|
-
}
|
|
799
|
-
function Be(e, t) {
|
|
800
|
-
if (!!!e) throw new Error(t ?? "Unexpected invariant triggered.");
|
|
801
|
-
}
|
|
802
|
-
var Bt = /\r\n|[\n\r]/g;
|
|
803
|
-
function B(e, t) {
|
|
804
|
-
let n = 0,
|
|
805
|
-
r = 1;
|
|
806
|
-
for (let i of e.body.matchAll(Bt)) {
|
|
807
|
-
if ((typeof i.index == "number" || Be(!1), i.index >= t)) break;
|
|
808
|
-
(n = i.index + i[0].length), (r += 1);
|
|
809
|
-
}
|
|
810
|
-
return { line: r, column: t + 1 - n };
|
|
811
|
-
}
|
|
812
|
-
function Me(e) {
|
|
813
|
-
return he(e.source, B(e.source, e.start));
|
|
814
|
-
}
|
|
815
|
-
function he(e, t) {
|
|
816
|
-
let n = e.locationOffset.column - 1,
|
|
817
|
-
r = "".padStart(n) + e.body,
|
|
818
|
-
i = t.line - 1,
|
|
819
|
-
s = e.locationOffset.line - 1,
|
|
820
|
-
a = t.line + s,
|
|
821
|
-
u = t.line === 1 ? n : 0,
|
|
822
|
-
l = t.column + u,
|
|
823
|
-
T = `${e.name}:${a}:${l}
|
|
824
|
-
`,
|
|
825
|
-
h = r.split(/\r\n|[\n\r]/g),
|
|
826
|
-
D = h[i];
|
|
827
|
-
if (D.length > 120) {
|
|
828
|
-
let I = Math.floor(l / 80),
|
|
829
|
-
ie = l % 80,
|
|
830
|
-
N = [];
|
|
831
|
-
for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
|
|
832
|
-
return (
|
|
833
|
-
T +
|
|
834
|
-
Ue([
|
|
835
|
-
[`${a} |`, N[0]],
|
|
836
|
-
...N.slice(1, I + 1).map((v) => ["|", v]),
|
|
837
|
-
["|", "^".padStart(ie)],
|
|
838
|
-
["|", N[I + 1]],
|
|
839
|
-
])
|
|
840
|
-
);
|
|
841
|
-
}
|
|
842
|
-
return (
|
|
843
|
-
T +
|
|
844
|
-
Ue([
|
|
845
|
-
[`${a - 1} |`, h[i - 1]],
|
|
846
|
-
[`${a} |`, D],
|
|
847
|
-
["|", "^".padStart(l)],
|
|
848
|
-
[`${a + 1} |`, h[i + 1]],
|
|
849
|
-
])
|
|
850
|
-
);
|
|
851
|
-
}
|
|
852
|
-
function Ue(e) {
|
|
853
|
-
let t = e.filter(([r, i]) => i !== void 0),
|
|
854
|
-
n = Math.max(...t.map(([r]) => r.length));
|
|
855
|
-
return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
|
|
856
|
-
`);
|
|
857
|
-
}
|
|
858
|
-
function Ut(e) {
|
|
859
|
-
let t = e[0];
|
|
860
|
-
return t == null || "kind" in t || "length" in t
|
|
861
|
-
? {
|
|
862
|
-
nodes: t,
|
|
863
|
-
source: e[1],
|
|
864
|
-
positions: e[2],
|
|
865
|
-
path: e[3],
|
|
866
|
-
originalError: e[4],
|
|
867
|
-
extensions: e[5],
|
|
868
|
-
}
|
|
869
|
-
: t;
|
|
870
|
-
}
|
|
871
|
-
var W = class e extends Error {
|
|
872
|
-
constructor(t, ...n) {
|
|
873
|
-
var r, i, s;
|
|
874
|
-
let {
|
|
875
|
-
nodes: a,
|
|
876
|
-
source: u,
|
|
877
|
-
positions: l,
|
|
878
|
-
path: T,
|
|
879
|
-
originalError: h,
|
|
880
|
-
extensions: D,
|
|
881
|
-
} = Ut(n);
|
|
882
|
-
super(t),
|
|
883
|
-
(this.name = "GraphQLError"),
|
|
884
|
-
(this.path = T ?? void 0),
|
|
885
|
-
(this.originalError = h ?? void 0),
|
|
886
|
-
(this.nodes = Ye(Array.isArray(a) ? a : a ? [a] : void 0));
|
|
887
|
-
let I = Ye(
|
|
888
|
-
(r = this.nodes) === null || r === void 0
|
|
889
|
-
? void 0
|
|
890
|
-
: r.map((N) => N.loc).filter((N) => N != null),
|
|
891
|
-
);
|
|
892
|
-
(this.source =
|
|
893
|
-
u ??
|
|
894
|
-
(I == null || (i = I[0]) === null || i === void 0 ? void 0 : i.source)),
|
|
895
|
-
(this.positions = l ?? (I == null ? void 0 : I.map((N) => N.start))),
|
|
896
|
-
(this.locations =
|
|
897
|
-
l && u
|
|
898
|
-
? l.map((N) => B(u, N))
|
|
899
|
-
: I == null
|
|
900
|
-
? void 0
|
|
901
|
-
: I.map((N) => B(N.source, N.start)));
|
|
902
|
-
let ie = Ve(h == null ? void 0 : h.extensions)
|
|
903
|
-
? h == null
|
|
904
|
-
? void 0
|
|
905
|
-
: h.extensions
|
|
906
|
-
: void 0;
|
|
907
|
-
(this.extensions =
|
|
908
|
-
(s = D ?? ie) !== null && s !== void 0 ? s : Object.create(null)),
|
|
909
|
-
Object.defineProperties(this, {
|
|
910
|
-
message: { writable: !0, enumerable: !0 },
|
|
911
|
-
name: { enumerable: !1 },
|
|
912
|
-
nodes: { enumerable: !1 },
|
|
913
|
-
source: { enumerable: !1 },
|
|
914
|
-
positions: { enumerable: !1 },
|
|
915
|
-
originalError: { enumerable: !1 },
|
|
916
|
-
}),
|
|
917
|
-
h != null && h.stack
|
|
918
|
-
? Object.defineProperty(this, "stack", {
|
|
919
|
-
value: h.stack,
|
|
920
|
-
writable: !0,
|
|
921
|
-
configurable: !0,
|
|
922
|
-
})
|
|
923
|
-
: Error.captureStackTrace
|
|
924
|
-
? Error.captureStackTrace(this, e)
|
|
925
|
-
: Object.defineProperty(this, "stack", {
|
|
926
|
-
value: Error().stack,
|
|
927
|
-
writable: !0,
|
|
928
|
-
configurable: !0,
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
get [Symbol.toStringTag]() {
|
|
932
|
-
return "GraphQLError";
|
|
933
|
-
}
|
|
934
|
-
toString() {
|
|
935
|
-
let t = this.message;
|
|
936
|
-
if (this.nodes)
|
|
937
|
-
for (let n of this.nodes)
|
|
938
|
-
n.loc &&
|
|
939
|
-
(t +=
|
|
940
|
-
`
|
|
6
|
+
${e}`;function kt(e,t,n){let{node:i}=e;if(!i.description)return"";let r=[n("description")];return i.kind==="InputValueDefinition"&&!i.description.block?r.push(k):r.push(f),r}var A=kt;function Ct(e,t,n){let{node:i}=e;switch(i.kind){case"Document":return[...E(f,g(e,t,n,"definitions")),f];case"OperationDefinition":{let r=t.originalText[J(i)]!=="{",s=!!i.name;return[A(e,t,n),r?i.operation:"",r&&s?[" ",n("name")]:"",r&&!s&&oe(i.variableDefinitions)?" ":"",Ue(e,n),_(e,n,i),!r&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return[A(e,t,n),"fragment ",n("name"),Ue(e,n)," on ",n("typeCondition"),_(e,n,i)," ",n("selectionSet")];case"SelectionSet":return["{",x([f,E(f,g(e,t,n,"selections"))]),f,"}"];case"Field":return y([i.alias?[n("alias"),": "]:"",n("name"),i.arguments.length>0?y(["(",x([l,E([I("",", "),l],g(e,t,n,"arguments"))]),l,")"]):"",_(e,n,i),i.selectionSet?" ":"",n("selectionSet")]);case"Name":return i.value;case"StringValue":if(i.block){let r=U(0,i.value,'"""','\\"""').split(`
|
|
7
|
+
`);return r.length===1&&(r[0]=r[0].trim()),r.every(s=>s==="")&&(r.length=0),E(f,['"""',...r,'"""'])}return['"',U(0,U(0,i.value,/["\\]/gu,"\\$&"),`
|
|
8
|
+
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return i.value;case"BooleanValue":return i.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":return y(["[",x([l,E([I("",", "),l],e.map(n,"values"))]),l,"]"]);case"ObjectValue":{let r=t.bracketSpacing&&i.fields.length>0?" ":"";return y(["{",r,x([l,E([I("",", "),l],e.map(n,"fields"))]),l,I("",r),"}"])}case"ObjectField":case"Argument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),i.arguments.length>0?y(["(",x([l,E([I("",", "),l],g(e,t,n,"arguments"))]),l,")"]):""];case"NamedType":return n("name");case"VariableDefinition":return[A(e,t,n),n("variable"),": ",n("type"),i.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,i)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:r}=i,s=[];return r.endsWith("TypeDefinition")?s.push(A(e,t,n)):s.push("extend "),r.startsWith("ObjectType")?s.push("type"):r.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!r.startsWith("InputObjectType")&&i.interfaces.length>0&&s.push(" implements ",...bt(e,t,n)),s.push(_(e,n,i)),i.fields.length>0&&s.push([" {",x([f,E(f,g(e,t,n,"fields"))]),f,"}"]),s}case"FieldDefinition":return[A(e,t,n),n("name"),i.arguments.length>0?y(["(",x([l,E([I("",", "),l],g(e,t,n,"arguments"))]),l,")"]):"",": ",n("type"),_(e,n,i)];case"DirectiveDefinition":return[A(e,t,n),"directive ","@",n("name"),i.arguments.length>0?y(["(",x([l,E([I("",", "),l],g(e,t,n,"arguments"))]),l,")"]):"",i.repeatable?" repeatable":""," on ",...E(" | ",e.map(n,"locations"))];case"EnumTypeExtension":case"EnumTypeDefinition":return[A(e,t,n),i.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),_(e,n,i),i.values.length>0?[" {",x([f,E(f,g(e,t,n,"values"))]),f,"}"]:""];case"EnumValueDefinition":return[A(e,t,n),n("name"),_(e,n,i)];case"InputValueDefinition":return[A(e,t,n),n("name"),": ",n("type"),i.defaultValue?[" = ",n("defaultValue")]:"",_(e,n,i)];case"SchemaExtension":return["extend schema",_(e,n,i),...i.operationTypes.length>0?[" {",x([f,E(f,g(e,t,n,"operationTypes"))]),f,"}"]:[]];case"SchemaDefinition":return[A(e,t,n),"schema",_(e,n,i)," {",i.operationTypes.length>0?x([f,E(f,g(e,t,n,"operationTypes"))]):"",f,"}"];case"OperationTypeDefinition":return[i.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),_(e,n,i)];case"InlineFragment":return["...",i.typeCondition?[" on ",n("typeCondition")]:"",_(e,n,i)," ",n("selectionSet")];case"UnionTypeExtension":case"UnionTypeDefinition":return y([A(e,t,n),y([i.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),_(e,n,i),i.types.length>0?[" =",I(""," "),x([I([k,"| "]),E([k,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[A(e,t,n),i.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),_(e,n,i)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Ce(i,"Graphql","kind")}}function _(e,t,n){if(n.directives.length===0)return"";let i=E(k,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?y([k,i]):[" ",y(x([l,i]))]}function g(e,t,n,i){return e.map(({isLast:r,node:s})=>{let a=n();return!r&&ke(t.originalText,q(s))?[a,f]:a},i)}function Rt(e){return e.kind!=="Comment"}function vt({node:e}){if(e.kind==="Comment")return"#"+e.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(e))}function bt(e,t,n){let{node:i}=e,r=[],{interfaces:s}=i,a=e.map(n,"interfaces");for(let u=0;u<s.length;u++){let p=s[u];r.push(a[u]);let T=s[u+1];if(T){let D=t.originalText.slice(p.loc.end,T.loc.start).includes("#");r.push(" &",D?k:" ")}}return r}function Ue(e,t){let{node:n}=e;return oe(n.variableDefinitions)?y(["(",x([l,E([I("",", "),l],e.map(t,"variableDefinitions"))]),l,")"]):""}function Ge(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
9
|
+
`)&&(t.value=e.value.trim())}Ge.ignoredProperties=new Set(["loc","comments"]);function Lt(e){let{node:t}=e;return t?.comments?.some(n=>n.value.trim()==="prettier-ignore")}var Pt={print:Ct,massageAstNode:Ge,hasPrettierIgnore:Lt,insertPragma:Be,printComment:vt,canAttachComment:Rt,getVisitorKeys:Le},Ye=Pt;var je=[{name:"GraphQL",type:"data",aceMode:"graphqlschema",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",parsers:["graphql"],vscodeLanguageIds:["graphql"],linguistLanguageId:139}];var $e={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var wt={bracketSpacing:$e.bracketSpacing},Xe=wt;var de={};me(de,{graphql:()=>on});function He(e){return typeof e=="object"&&e!==null}function Je(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}var Ft=/\r\n|[\n\r]/g;function M(e,t){let n=0,i=1;for(let r of e.body.matchAll(Ft)){if(typeof r.index=="number"||Je(!1),r.index>=t)break;n=r.index+r[0].length,i+=1}return{line:i,column:t+1-n}}function Qe(e){return pe(e.source,M(e.source,e.start))}function pe(e,t){let n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,s=e.locationOffset.line-1,a=t.line+s,u=t.line===1?n:0,p=t.column+u,T=`${e.name}:${a}:${p}
|
|
10
|
+
`,d=i.split(/\r\n|[\n\r]/g),D=d[r];if(D.length>120){let O=Math.floor(p/80),re=p%80,N=[];for(let v=0;v<D.length;v+=80)N.push(D.slice(v,v+80));return T+qe([[`${a} |`,N[0]],...N.slice(1,O+1).map(v=>["|",v]),["|","^".padStart(re)],["|",N[O+1]]])}return T+qe([[`${a-1} |`,d[r-1]],[`${a} |`,D],["|","^".padStart(p)],[`${a+1} |`,d[r+1]]])}function qe(e){let t=e.filter(([i,r])=>r!==void 0),n=Math.max(...t.map(([i])=>i.length));return t.map(([i,r])=>i.padStart(n)+(r?" "+r:"")).join(`
|
|
11
|
+
`)}function Mt(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var Q=class e extends Error{constructor(t,...n){var i,r,s;let{nodes:a,source:u,positions:p,path:T,originalError:d,extensions:D}=Mt(n);super(t),this.name="GraphQLError",this.path=T??void 0,this.originalError=d??void 0,this.nodes=We(Array.isArray(a)?a:a?[a]:void 0);let O=We((i=this.nodes)===null||i===void 0?void 0:i.map(N=>N.loc).filter(N=>N!=null));this.source=u??(O==null||(r=O[0])===null||r===void 0?void 0:r.source),this.positions=p??O?.map(N=>N.start),this.locations=p&&u?p.map(N=>M(u,N)):O?.map(N=>M(N.source,N.start));let re=He(d?.extensions)?d?.extensions:void 0;this.extensions=(s=D??re)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),d!=null&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
941
12
|
|
|
942
|
-
|
|
943
|
-
else if (this.source && this.locations)
|
|
944
|
-
for (let n of this.locations)
|
|
945
|
-
t +=
|
|
946
|
-
`
|
|
13
|
+
`+Qe(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
947
14
|
|
|
948
|
-
` +
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
toJSON() {
|
|
952
|
-
let t = { message: this.message };
|
|
953
|
-
return (
|
|
954
|
-
this.locations != null && (t.locations = this.locations),
|
|
955
|
-
this.path != null && (t.path = this.path),
|
|
956
|
-
this.extensions != null &&
|
|
957
|
-
Object.keys(this.extensions).length > 0 &&
|
|
958
|
-
(t.extensions = this.extensions),
|
|
959
|
-
t
|
|
960
|
-
);
|
|
961
|
-
}
|
|
962
|
-
};
|
|
963
|
-
function Ye(e) {
|
|
964
|
-
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
965
|
-
}
|
|
966
|
-
function d(e, t, n) {
|
|
967
|
-
return new W(`Syntax Error: ${n}`, { source: e, positions: [t] });
|
|
968
|
-
}
|
|
969
|
-
var H;
|
|
970
|
-
(function (e) {
|
|
971
|
-
(e.QUERY = "QUERY"),
|
|
972
|
-
(e.MUTATION = "MUTATION"),
|
|
973
|
-
(e.SUBSCRIPTION = "SUBSCRIPTION"),
|
|
974
|
-
(e.FIELD = "FIELD"),
|
|
975
|
-
(e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION"),
|
|
976
|
-
(e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD"),
|
|
977
|
-
(e.INLINE_FRAGMENT = "INLINE_FRAGMENT"),
|
|
978
|
-
(e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION"),
|
|
979
|
-
(e.SCHEMA = "SCHEMA"),
|
|
980
|
-
(e.SCALAR = "SCALAR"),
|
|
981
|
-
(e.OBJECT = "OBJECT"),
|
|
982
|
-
(e.FIELD_DEFINITION = "FIELD_DEFINITION"),
|
|
983
|
-
(e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION"),
|
|
984
|
-
(e.INTERFACE = "INTERFACE"),
|
|
985
|
-
(e.UNION = "UNION"),
|
|
986
|
-
(e.ENUM = "ENUM"),
|
|
987
|
-
(e.ENUM_VALUE = "ENUM_VALUE"),
|
|
988
|
-
(e.INPUT_OBJECT = "INPUT_OBJECT"),
|
|
989
|
-
(e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION");
|
|
990
|
-
})(H || (H = {}));
|
|
991
|
-
var c;
|
|
992
|
-
(function (e) {
|
|
993
|
-
(e.NAME = "Name"),
|
|
994
|
-
(e.DOCUMENT = "Document"),
|
|
995
|
-
(e.OPERATION_DEFINITION = "OperationDefinition"),
|
|
996
|
-
(e.VARIABLE_DEFINITION = "VariableDefinition"),
|
|
997
|
-
(e.SELECTION_SET = "SelectionSet"),
|
|
998
|
-
(e.FIELD = "Field"),
|
|
999
|
-
(e.ARGUMENT = "Argument"),
|
|
1000
|
-
(e.FRAGMENT_SPREAD = "FragmentSpread"),
|
|
1001
|
-
(e.INLINE_FRAGMENT = "InlineFragment"),
|
|
1002
|
-
(e.FRAGMENT_DEFINITION = "FragmentDefinition"),
|
|
1003
|
-
(e.VARIABLE = "Variable"),
|
|
1004
|
-
(e.INT = "IntValue"),
|
|
1005
|
-
(e.FLOAT = "FloatValue"),
|
|
1006
|
-
(e.STRING = "StringValue"),
|
|
1007
|
-
(e.BOOLEAN = "BooleanValue"),
|
|
1008
|
-
(e.NULL = "NullValue"),
|
|
1009
|
-
(e.ENUM = "EnumValue"),
|
|
1010
|
-
(e.LIST = "ListValue"),
|
|
1011
|
-
(e.OBJECT = "ObjectValue"),
|
|
1012
|
-
(e.OBJECT_FIELD = "ObjectField"),
|
|
1013
|
-
(e.DIRECTIVE = "Directive"),
|
|
1014
|
-
(e.NAMED_TYPE = "NamedType"),
|
|
1015
|
-
(e.LIST_TYPE = "ListType"),
|
|
1016
|
-
(e.NON_NULL_TYPE = "NonNullType"),
|
|
1017
|
-
(e.SCHEMA_DEFINITION = "SchemaDefinition"),
|
|
1018
|
-
(e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition"),
|
|
1019
|
-
(e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition"),
|
|
1020
|
-
(e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition"),
|
|
1021
|
-
(e.FIELD_DEFINITION = "FieldDefinition"),
|
|
1022
|
-
(e.INPUT_VALUE_DEFINITION = "InputValueDefinition"),
|
|
1023
|
-
(e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition"),
|
|
1024
|
-
(e.UNION_TYPE_DEFINITION = "UnionTypeDefinition"),
|
|
1025
|
-
(e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition"),
|
|
1026
|
-
(e.ENUM_VALUE_DEFINITION = "EnumValueDefinition"),
|
|
1027
|
-
(e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition"),
|
|
1028
|
-
(e.DIRECTIVE_DEFINITION = "DirectiveDefinition"),
|
|
1029
|
-
(e.SCHEMA_EXTENSION = "SchemaExtension"),
|
|
1030
|
-
(e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension"),
|
|
1031
|
-
(e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension"),
|
|
1032
|
-
(e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension"),
|
|
1033
|
-
(e.UNION_TYPE_EXTENSION = "UnionTypeExtension"),
|
|
1034
|
-
(e.ENUM_TYPE_EXTENSION = "EnumTypeExtension"),
|
|
1035
|
-
(e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension");
|
|
1036
|
-
})(c || (c = {}));
|
|
1037
|
-
function je(e) {
|
|
1038
|
-
return e === 9 || e === 32;
|
|
1039
|
-
}
|
|
1040
|
-
function L(e) {
|
|
1041
|
-
return e >= 48 && e <= 57;
|
|
1042
|
-
}
|
|
1043
|
-
function Ge(e) {
|
|
1044
|
-
return (e >= 97 && e <= 122) || (e >= 65 && e <= 90);
|
|
1045
|
-
}
|
|
1046
|
-
function de(e) {
|
|
1047
|
-
return Ge(e) || e === 95;
|
|
1048
|
-
}
|
|
1049
|
-
function $e(e) {
|
|
1050
|
-
return Ge(e) || L(e) || e === 95;
|
|
1051
|
-
}
|
|
1052
|
-
function Je(e) {
|
|
1053
|
-
var t;
|
|
1054
|
-
let n = Number.MAX_SAFE_INTEGER,
|
|
1055
|
-
r = null,
|
|
1056
|
-
i = -1;
|
|
1057
|
-
for (let a = 0; a < e.length; ++a) {
|
|
1058
|
-
var s;
|
|
1059
|
-
let u = e[a],
|
|
1060
|
-
l = Mt(u);
|
|
1061
|
-
l !== u.length &&
|
|
1062
|
-
((r = (s = r) !== null && s !== void 0 ? s : a),
|
|
1063
|
-
(i = a),
|
|
1064
|
-
a !== 0 && l < n && (n = l));
|
|
1065
|
-
}
|
|
1066
|
-
return e
|
|
1067
|
-
.map((a, u) => (u === 0 ? a : a.slice(n)))
|
|
1068
|
-
.slice((t = r) !== null && t !== void 0 ? t : 0, i + 1);
|
|
1069
|
-
}
|
|
1070
|
-
function Mt(e) {
|
|
1071
|
-
let t = 0;
|
|
1072
|
-
for (; t < e.length && je(e.charCodeAt(t)); ) ++t;
|
|
1073
|
-
return t;
|
|
1074
|
-
}
|
|
1075
|
-
var o;
|
|
1076
|
-
(function (e) {
|
|
1077
|
-
(e.SOF = "<SOF>"),
|
|
1078
|
-
(e.EOF = "<EOF>"),
|
|
1079
|
-
(e.BANG = "!"),
|
|
1080
|
-
(e.DOLLAR = "$"),
|
|
1081
|
-
(e.AMP = "&"),
|
|
1082
|
-
(e.PAREN_L = "("),
|
|
1083
|
-
(e.PAREN_R = ")"),
|
|
1084
|
-
(e.SPREAD = "..."),
|
|
1085
|
-
(e.COLON = ":"),
|
|
1086
|
-
(e.EQUALS = "="),
|
|
1087
|
-
(e.AT = "@"),
|
|
1088
|
-
(e.BRACKET_L = "["),
|
|
1089
|
-
(e.BRACKET_R = "]"),
|
|
1090
|
-
(e.BRACE_L = "{"),
|
|
1091
|
-
(e.PIPE = "|"),
|
|
1092
|
-
(e.BRACE_R = "}"),
|
|
1093
|
-
(e.NAME = "Name"),
|
|
1094
|
-
(e.INT = "Int"),
|
|
1095
|
-
(e.FLOAT = "Float"),
|
|
1096
|
-
(e.STRING = "String"),
|
|
1097
|
-
(e.BLOCK_STRING = "BlockString"),
|
|
1098
|
-
(e.COMMENT = "Comment");
|
|
1099
|
-
})(o || (o = {}));
|
|
1100
|
-
var z = class {
|
|
1101
|
-
constructor(t) {
|
|
1102
|
-
let n = new V(o.SOF, 0, 0, 0, 0);
|
|
1103
|
-
(this.source = t),
|
|
1104
|
-
(this.lastToken = n),
|
|
1105
|
-
(this.token = n),
|
|
1106
|
-
(this.line = 1),
|
|
1107
|
-
(this.lineStart = 0);
|
|
1108
|
-
}
|
|
1109
|
-
get [Symbol.toStringTag]() {
|
|
1110
|
-
return "Lexer";
|
|
1111
|
-
}
|
|
1112
|
-
advance() {
|
|
1113
|
-
return (this.lastToken = this.token), (this.token = this.lookahead());
|
|
1114
|
-
}
|
|
1115
|
-
lookahead() {
|
|
1116
|
-
let t = this.token;
|
|
1117
|
-
if (t.kind !== o.EOF)
|
|
1118
|
-
do
|
|
1119
|
-
if (t.next) t = t.next;
|
|
1120
|
-
else {
|
|
1121
|
-
let n = Yt(this, t.end);
|
|
1122
|
-
(t.next = n), (n.prev = t), (t = n);
|
|
1123
|
-
}
|
|
1124
|
-
while (t.kind === o.COMMENT);
|
|
1125
|
-
return t;
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
|
-
function qe(e) {
|
|
1129
|
-
return (
|
|
1130
|
-
e === o.BANG ||
|
|
1131
|
-
e === o.DOLLAR ||
|
|
1132
|
-
e === o.AMP ||
|
|
1133
|
-
e === o.PAREN_L ||
|
|
1134
|
-
e === o.PAREN_R ||
|
|
1135
|
-
e === o.SPREAD ||
|
|
1136
|
-
e === o.COLON ||
|
|
1137
|
-
e === o.EQUALS ||
|
|
1138
|
-
e === o.AT ||
|
|
1139
|
-
e === o.BRACKET_L ||
|
|
1140
|
-
e === o.BRACKET_R ||
|
|
1141
|
-
e === o.BRACE_L ||
|
|
1142
|
-
e === o.PIPE ||
|
|
1143
|
-
e === o.BRACE_R
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
function R(e) {
|
|
1147
|
-
return (e >= 0 && e <= 55295) || (e >= 57344 && e <= 1114111);
|
|
1148
|
-
}
|
|
1149
|
-
function K(e, t) {
|
|
1150
|
-
return Qe(e.charCodeAt(t)) && We(e.charCodeAt(t + 1));
|
|
1151
|
-
}
|
|
1152
|
-
function Qe(e) {
|
|
1153
|
-
return e >= 55296 && e <= 56319;
|
|
1154
|
-
}
|
|
1155
|
-
function We(e) {
|
|
1156
|
-
return e >= 56320 && e <= 57343;
|
|
1157
|
-
}
|
|
1158
|
-
function C(e, t) {
|
|
1159
|
-
let n = e.source.body.codePointAt(t);
|
|
1160
|
-
if (n === void 0) return o.EOF;
|
|
1161
|
-
if (n >= 32 && n <= 126) {
|
|
1162
|
-
let r = String.fromCodePoint(n);
|
|
1163
|
-
return r === '"' ? `'"'` : `"${r}"`;
|
|
1164
|
-
}
|
|
1165
|
-
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
1166
|
-
}
|
|
1167
|
-
function m(e, t, n, r, i) {
|
|
1168
|
-
let s = e.line,
|
|
1169
|
-
a = 1 + n - e.lineStart;
|
|
1170
|
-
return new V(t, n, r, s, a, i);
|
|
1171
|
-
}
|
|
1172
|
-
function Yt(e, t) {
|
|
1173
|
-
let n = e.source.body,
|
|
1174
|
-
r = n.length,
|
|
1175
|
-
i = t;
|
|
1176
|
-
for (; i < r; ) {
|
|
1177
|
-
let s = n.charCodeAt(i);
|
|
1178
|
-
switch (s) {
|
|
1179
|
-
case 65279:
|
|
1180
|
-
case 9:
|
|
1181
|
-
case 32:
|
|
1182
|
-
case 44:
|
|
1183
|
-
++i;
|
|
1184
|
-
continue;
|
|
1185
|
-
case 10:
|
|
1186
|
-
++i, ++e.line, (e.lineStart = i);
|
|
1187
|
-
continue;
|
|
1188
|
-
case 13:
|
|
1189
|
-
n.charCodeAt(i + 1) === 10 ? (i += 2) : ++i,
|
|
1190
|
-
++e.line,
|
|
1191
|
-
(e.lineStart = i);
|
|
1192
|
-
continue;
|
|
1193
|
-
case 35:
|
|
1194
|
-
return jt(e, i);
|
|
1195
|
-
case 33:
|
|
1196
|
-
return m(e, o.BANG, i, i + 1);
|
|
1197
|
-
case 36:
|
|
1198
|
-
return m(e, o.DOLLAR, i, i + 1);
|
|
1199
|
-
case 38:
|
|
1200
|
-
return m(e, o.AMP, i, i + 1);
|
|
1201
|
-
case 40:
|
|
1202
|
-
return m(e, o.PAREN_L, i, i + 1);
|
|
1203
|
-
case 41:
|
|
1204
|
-
return m(e, o.PAREN_R, i, i + 1);
|
|
1205
|
-
case 46:
|
|
1206
|
-
if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46)
|
|
1207
|
-
return m(e, o.SPREAD, i, i + 3);
|
|
1208
|
-
break;
|
|
1209
|
-
case 58:
|
|
1210
|
-
return m(e, o.COLON, i, i + 1);
|
|
1211
|
-
case 61:
|
|
1212
|
-
return m(e, o.EQUALS, i, i + 1);
|
|
1213
|
-
case 64:
|
|
1214
|
-
return m(e, o.AT, i, i + 1);
|
|
1215
|
-
case 91:
|
|
1216
|
-
return m(e, o.BRACKET_L, i, i + 1);
|
|
1217
|
-
case 93:
|
|
1218
|
-
return m(e, o.BRACKET_R, i, i + 1);
|
|
1219
|
-
case 123:
|
|
1220
|
-
return m(e, o.BRACE_L, i, i + 1);
|
|
1221
|
-
case 124:
|
|
1222
|
-
return m(e, o.PIPE, i, i + 1);
|
|
1223
|
-
case 125:
|
|
1224
|
-
return m(e, o.BRACE_R, i, i + 1);
|
|
1225
|
-
case 34:
|
|
1226
|
-
return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34
|
|
1227
|
-
? Qt(e, i)
|
|
1228
|
-
: $t(e, i);
|
|
1229
|
-
}
|
|
1230
|
-
if (L(s) || s === 45) return Gt(e, i, s);
|
|
1231
|
-
if (de(s)) return Wt(e, i);
|
|
1232
|
-
throw d(
|
|
1233
|
-
e.source,
|
|
1234
|
-
i,
|
|
1235
|
-
s === 39
|
|
1236
|
-
? `Unexpected single quote character ('), did you mean to use a double quote (")?`
|
|
1237
|
-
: R(s) || K(n, i)
|
|
1238
|
-
? `Unexpected character: ${C(e, i)}.`
|
|
1239
|
-
: `Invalid character: ${C(e, i)}.`,
|
|
1240
|
-
);
|
|
1241
|
-
}
|
|
1242
|
-
return m(e, o.EOF, r, r);
|
|
1243
|
-
}
|
|
1244
|
-
function jt(e, t) {
|
|
1245
|
-
let n = e.source.body,
|
|
1246
|
-
r = n.length,
|
|
1247
|
-
i = t + 1;
|
|
1248
|
-
for (; i < r; ) {
|
|
1249
|
-
let s = n.charCodeAt(i);
|
|
1250
|
-
if (s === 10 || s === 13) break;
|
|
1251
|
-
if (R(s)) ++i;
|
|
1252
|
-
else if (K(n, i)) i += 2;
|
|
1253
|
-
else break;
|
|
1254
|
-
}
|
|
1255
|
-
return m(e, o.COMMENT, t, i, n.slice(t + 1, i));
|
|
1256
|
-
}
|
|
1257
|
-
function Gt(e, t, n) {
|
|
1258
|
-
let r = e.source.body,
|
|
1259
|
-
i = t,
|
|
1260
|
-
s = n,
|
|
1261
|
-
a = !1;
|
|
1262
|
-
if ((s === 45 && (s = r.charCodeAt(++i)), s === 48)) {
|
|
1263
|
-
if (((s = r.charCodeAt(++i)), L(s)))
|
|
1264
|
-
throw d(
|
|
1265
|
-
e.source,
|
|
1266
|
-
i,
|
|
1267
|
-
`Invalid number, unexpected digit after 0: ${C(e, i)}.`,
|
|
1268
|
-
);
|
|
1269
|
-
} else (i = me(e, i, s)), (s = r.charCodeAt(i));
|
|
1270
|
-
if (
|
|
1271
|
-
(s === 46 &&
|
|
1272
|
-
((a = !0),
|
|
1273
|
-
(s = r.charCodeAt(++i)),
|
|
1274
|
-
(i = me(e, i, s)),
|
|
1275
|
-
(s = r.charCodeAt(i))),
|
|
1276
|
-
(s === 69 || s === 101) &&
|
|
1277
|
-
((a = !0),
|
|
1278
|
-
(s = r.charCodeAt(++i)),
|
|
1279
|
-
(s === 43 || s === 45) && (s = r.charCodeAt(++i)),
|
|
1280
|
-
(i = me(e, i, s)),
|
|
1281
|
-
(s = r.charCodeAt(i))),
|
|
1282
|
-
s === 46 || de(s))
|
|
1283
|
-
)
|
|
1284
|
-
throw d(
|
|
1285
|
-
e.source,
|
|
1286
|
-
i,
|
|
1287
|
-
`Invalid number, expected digit but got: ${C(e, i)}.`,
|
|
1288
|
-
);
|
|
1289
|
-
return m(e, a ? o.FLOAT : o.INT, t, i, r.slice(t, i));
|
|
1290
|
-
}
|
|
1291
|
-
function me(e, t, n) {
|
|
1292
|
-
if (!L(n))
|
|
1293
|
-
throw d(
|
|
1294
|
-
e.source,
|
|
1295
|
-
t,
|
|
1296
|
-
`Invalid number, expected digit but got: ${C(e, t)}.`,
|
|
1297
|
-
);
|
|
1298
|
-
let r = e.source.body,
|
|
1299
|
-
i = t + 1;
|
|
1300
|
-
for (; L(r.charCodeAt(i)); ) ++i;
|
|
1301
|
-
return i;
|
|
1302
|
-
}
|
|
1303
|
-
function $t(e, t) {
|
|
1304
|
-
let n = e.source.body,
|
|
1305
|
-
r = n.length,
|
|
1306
|
-
i = t + 1,
|
|
1307
|
-
s = i,
|
|
1308
|
-
a = "";
|
|
1309
|
-
for (; i < r; ) {
|
|
1310
|
-
let u = n.charCodeAt(i);
|
|
1311
|
-
if (u === 34) return (a += n.slice(s, i)), m(e, o.STRING, t, i + 1, a);
|
|
1312
|
-
if (u === 92) {
|
|
1313
|
-
a += n.slice(s, i);
|
|
1314
|
-
let l =
|
|
1315
|
-
n.charCodeAt(i + 1) === 117
|
|
1316
|
-
? n.charCodeAt(i + 2) === 123
|
|
1317
|
-
? Jt(e, i)
|
|
1318
|
-
: Xt(e, i)
|
|
1319
|
-
: qt(e, i);
|
|
1320
|
-
(a += l.value), (i += l.size), (s = i);
|
|
1321
|
-
continue;
|
|
1322
|
-
}
|
|
1323
|
-
if (u === 10 || u === 13) break;
|
|
1324
|
-
if (R(u)) ++i;
|
|
1325
|
-
else if (K(n, i)) i += 2;
|
|
1326
|
-
else throw d(e.source, i, `Invalid character within String: ${C(e, i)}.`);
|
|
1327
|
-
}
|
|
1328
|
-
throw d(e.source, i, "Unterminated string.");
|
|
1329
|
-
}
|
|
1330
|
-
function Jt(e, t) {
|
|
1331
|
-
let n = e.source.body,
|
|
1332
|
-
r = 0,
|
|
1333
|
-
i = 3;
|
|
1334
|
-
for (; i < 12; ) {
|
|
1335
|
-
let s = n.charCodeAt(t + i++);
|
|
1336
|
-
if (s === 125) {
|
|
1337
|
-
if (i < 5 || !R(r)) break;
|
|
1338
|
-
return { value: String.fromCodePoint(r), size: i };
|
|
1339
|
-
}
|
|
1340
|
-
if (((r = (r << 4) | U(s)), r < 0)) break;
|
|
1341
|
-
}
|
|
1342
|
-
throw d(
|
|
1343
|
-
e.source,
|
|
1344
|
-
t,
|
|
1345
|
-
`Invalid Unicode escape sequence: "${n.slice(t, t + i)}".`,
|
|
1346
|
-
);
|
|
1347
|
-
}
|
|
1348
|
-
function Xt(e, t) {
|
|
1349
|
-
let n = e.source.body,
|
|
1350
|
-
r = Xe(n, t + 2);
|
|
1351
|
-
if (R(r)) return { value: String.fromCodePoint(r), size: 6 };
|
|
1352
|
-
if (Qe(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
1353
|
-
let i = Xe(n, t + 8);
|
|
1354
|
-
if (We(i)) return { value: String.fromCodePoint(r, i), size: 12 };
|
|
1355
|
-
}
|
|
1356
|
-
throw d(
|
|
1357
|
-
e.source,
|
|
1358
|
-
t,
|
|
1359
|
-
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`,
|
|
1360
|
-
);
|
|
1361
|
-
}
|
|
1362
|
-
function Xe(e, t) {
|
|
1363
|
-
return (
|
|
1364
|
-
(U(e.charCodeAt(t)) << 12) |
|
|
1365
|
-
(U(e.charCodeAt(t + 1)) << 8) |
|
|
1366
|
-
(U(e.charCodeAt(t + 2)) << 4) |
|
|
1367
|
-
U(e.charCodeAt(t + 3))
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
function U(e) {
|
|
1371
|
-
return e >= 48 && e <= 57
|
|
1372
|
-
? e - 48
|
|
1373
|
-
: e >= 65 && e <= 70
|
|
1374
|
-
? e - 55
|
|
1375
|
-
: e >= 97 && e <= 102
|
|
1376
|
-
? e - 87
|
|
1377
|
-
: -1;
|
|
1378
|
-
}
|
|
1379
|
-
function qt(e, t) {
|
|
1380
|
-
let n = e.source.body;
|
|
1381
|
-
switch (n.charCodeAt(t + 1)) {
|
|
1382
|
-
case 34:
|
|
1383
|
-
return { value: '"', size: 2 };
|
|
1384
|
-
case 92:
|
|
1385
|
-
return { value: "\\", size: 2 };
|
|
1386
|
-
case 47:
|
|
1387
|
-
return { value: "/", size: 2 };
|
|
1388
|
-
case 98:
|
|
1389
|
-
return { value: "\b", size: 2 };
|
|
1390
|
-
case 102:
|
|
1391
|
-
return { value: "\f", size: 2 };
|
|
1392
|
-
case 110:
|
|
1393
|
-
return {
|
|
1394
|
-
value: `
|
|
1395
|
-
`,
|
|
1396
|
-
size: 2,
|
|
1397
|
-
};
|
|
1398
|
-
case 114:
|
|
1399
|
-
return { value: "\r", size: 2 };
|
|
1400
|
-
case 116:
|
|
1401
|
-
return { value: " ", size: 2 };
|
|
1402
|
-
}
|
|
1403
|
-
throw d(
|
|
1404
|
-
e.source,
|
|
1405
|
-
t,
|
|
1406
|
-
`Invalid character escape sequence: "${n.slice(t, t + 2)}".`,
|
|
1407
|
-
);
|
|
1408
|
-
}
|
|
1409
|
-
function Qt(e, t) {
|
|
1410
|
-
let n = e.source.body,
|
|
1411
|
-
r = n.length,
|
|
1412
|
-
i = e.lineStart,
|
|
1413
|
-
s = t + 3,
|
|
1414
|
-
a = s,
|
|
1415
|
-
u = "",
|
|
1416
|
-
l = [];
|
|
1417
|
-
for (; s < r; ) {
|
|
1418
|
-
let T = n.charCodeAt(s);
|
|
1419
|
-
if (
|
|
1420
|
-
T === 34 &&
|
|
1421
|
-
n.charCodeAt(s + 1) === 34 &&
|
|
1422
|
-
n.charCodeAt(s + 2) === 34
|
|
1423
|
-
) {
|
|
1424
|
-
(u += n.slice(a, s)), l.push(u);
|
|
1425
|
-
let h = m(
|
|
1426
|
-
e,
|
|
1427
|
-
o.BLOCK_STRING,
|
|
1428
|
-
t,
|
|
1429
|
-
s + 3,
|
|
1430
|
-
Je(l).join(`
|
|
1431
|
-
`),
|
|
1432
|
-
);
|
|
1433
|
-
return (e.line += l.length - 1), (e.lineStart = i), h;
|
|
1434
|
-
}
|
|
1435
|
-
if (
|
|
1436
|
-
T === 92 &&
|
|
1437
|
-
n.charCodeAt(s + 1) === 34 &&
|
|
1438
|
-
n.charCodeAt(s + 2) === 34 &&
|
|
1439
|
-
n.charCodeAt(s + 3) === 34
|
|
1440
|
-
) {
|
|
1441
|
-
(u += n.slice(a, s)), (a = s + 1), (s += 4);
|
|
1442
|
-
continue;
|
|
1443
|
-
}
|
|
1444
|
-
if (T === 10 || T === 13) {
|
|
1445
|
-
(u += n.slice(a, s)),
|
|
1446
|
-
l.push(u),
|
|
1447
|
-
T === 13 && n.charCodeAt(s + 1) === 10 ? (s += 2) : ++s,
|
|
1448
|
-
(u = ""),
|
|
1449
|
-
(a = s),
|
|
1450
|
-
(i = s);
|
|
1451
|
-
continue;
|
|
1452
|
-
}
|
|
1453
|
-
if (R(T)) ++s;
|
|
1454
|
-
else if (K(n, s)) s += 2;
|
|
1455
|
-
else throw d(e.source, s, `Invalid character within String: ${C(e, s)}.`);
|
|
1456
|
-
}
|
|
1457
|
-
throw d(e.source, s, "Unterminated string.");
|
|
1458
|
-
}
|
|
1459
|
-
function Wt(e, t) {
|
|
1460
|
-
let n = e.source.body,
|
|
1461
|
-
r = n.length,
|
|
1462
|
-
i = t + 1;
|
|
1463
|
-
for (; i < r; ) {
|
|
1464
|
-
let s = n.charCodeAt(i);
|
|
1465
|
-
if ($e(s)) ++i;
|
|
1466
|
-
else break;
|
|
1467
|
-
}
|
|
1468
|
-
return m(e, o.NAME, t, i, n.slice(t, i));
|
|
1469
|
-
}
|
|
1470
|
-
function Z(e, t) {
|
|
1471
|
-
if (!!!e) throw new Error(t);
|
|
1472
|
-
}
|
|
1473
|
-
function ee(e) {
|
|
1474
|
-
return te(e, []);
|
|
1475
|
-
}
|
|
1476
|
-
function te(e, t) {
|
|
1477
|
-
switch (typeof e) {
|
|
1478
|
-
case "string":
|
|
1479
|
-
return JSON.stringify(e);
|
|
1480
|
-
case "function":
|
|
1481
|
-
return e.name ? `[function ${e.name}]` : "[function]";
|
|
1482
|
-
case "object":
|
|
1483
|
-
return Ht(e, t);
|
|
1484
|
-
default:
|
|
1485
|
-
return String(e);
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
function Ht(e, t) {
|
|
1489
|
-
if (e === null) return "null";
|
|
1490
|
-
if (t.includes(e)) return "[Circular]";
|
|
1491
|
-
let n = [...t, e];
|
|
1492
|
-
if (zt(e)) {
|
|
1493
|
-
let r = e.toJSON();
|
|
1494
|
-
if (r !== e) return typeof r == "string" ? r : te(r, n);
|
|
1495
|
-
} else if (Array.isArray(e)) return Zt(e, n);
|
|
1496
|
-
return Kt(e, n);
|
|
1497
|
-
}
|
|
1498
|
-
function zt(e) {
|
|
1499
|
-
return typeof e.toJSON == "function";
|
|
1500
|
-
}
|
|
1501
|
-
function Kt(e, t) {
|
|
1502
|
-
let n = Object.entries(e);
|
|
1503
|
-
return n.length === 0
|
|
1504
|
-
? "{}"
|
|
1505
|
-
: t.length > 2
|
|
1506
|
-
? "[" + en(e) + "]"
|
|
1507
|
-
: "{ " + n.map(([i, s]) => i + ": " + te(s, t)).join(", ") + " }";
|
|
1508
|
-
}
|
|
1509
|
-
function Zt(e, t) {
|
|
1510
|
-
if (e.length === 0) return "[]";
|
|
1511
|
-
if (t.length > 2) return "[Array]";
|
|
1512
|
-
let n = Math.min(10, e.length),
|
|
1513
|
-
r = e.length - n,
|
|
1514
|
-
i = [];
|
|
1515
|
-
for (let s = 0; s < n; ++s) i.push(te(e[s], t));
|
|
1516
|
-
return (
|
|
1517
|
-
r === 1
|
|
1518
|
-
? i.push("... 1 more item")
|
|
1519
|
-
: r > 1 && i.push(`... ${r} more items`),
|
|
1520
|
-
"[" + i.join(", ") + "]"
|
|
1521
|
-
);
|
|
1522
|
-
}
|
|
1523
|
-
function en(e) {
|
|
1524
|
-
let t = Object.prototype.toString
|
|
1525
|
-
.call(e)
|
|
1526
|
-
.replace(/^\[object /, "")
|
|
1527
|
-
.replace(/]$/, "");
|
|
1528
|
-
if (t === "Object" && typeof e.constructor == "function") {
|
|
1529
|
-
let n = e.constructor.name;
|
|
1530
|
-
if (typeof n == "string" && n !== "") return n;
|
|
1531
|
-
}
|
|
1532
|
-
return t;
|
|
1533
|
-
}
|
|
1534
|
-
var tn = globalThis.process && !0,
|
|
1535
|
-
He = tn
|
|
1536
|
-
? function (t, n) {
|
|
1537
|
-
return t instanceof n;
|
|
1538
|
-
}
|
|
1539
|
-
: function (t, n) {
|
|
1540
|
-
if (t instanceof n) return !0;
|
|
1541
|
-
if (typeof t == "object" && t !== null) {
|
|
1542
|
-
var r;
|
|
1543
|
-
let i = n.prototype[Symbol.toStringTag],
|
|
1544
|
-
s =
|
|
1545
|
-
Symbol.toStringTag in t
|
|
1546
|
-
? t[Symbol.toStringTag]
|
|
1547
|
-
: (r = t.constructor) === null || r === void 0
|
|
1548
|
-
? void 0
|
|
1549
|
-
: r.name;
|
|
1550
|
-
if (i === s) {
|
|
1551
|
-
let a = ee(t);
|
|
1552
|
-
throw new Error(`Cannot use ${i} "${a}" from another module or realm.
|
|
15
|
+
`+pe(this.source,n);return t}toJSON(){let t={message:this.message};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}};function We(e){return e===void 0||e.length===0?void 0:e}function h(e,t,n){return new Q(`Syntax Error: ${n}`,{source:e,positions:[t]})}var W;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(W||(W={}));var c;(function(e){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",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(c||(c={}));function ze(e){return e===9||e===32}function b(e){return e>=48&&e<=57}function Ke(e){return e>=97&&e<=122||e>=65&&e<=90}function le(e){return Ke(e)||e===95}function Ze(e){return Ke(e)||b(e)||e===95}function et(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let a=0;a<e.length;++a){var s;let u=e[a],p=Vt(u);p!==u.length&&(i=(s=i)!==null&&s!==void 0?s:a,r=a,a!==0&&p<n&&(n=p))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=i)!==null&&t!==void 0?t:0,r+1)}function Vt(e){let t=0;for(;t<e.length&&ze(e.charCodeAt(t));)++t;return t}var o;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",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"})(o||(o={}));var z=class{constructor(t){let n=new F(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Bt(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function nt(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.DOT||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function L(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function K(e,t){return rt(e.charCodeAt(t))&&it(e.charCodeAt(t+1))}function rt(e){return e>=55296&&e<=56319}function it(e){return e>=56320&&e<=57343}function R(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let i=String.fromCodePoint(n);return i==='"'?`'"'`:`"${i}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function m(e,t,n,i,r){let s=e.line,a=1+n-e.lineStart;return new F(t,n,i,s,a,r)}function Bt(e,t){let n=e.source.body,i=n.length,r=t;for(;r<i;){let s=n.charCodeAt(r);switch(s){case 65279:case 9:case 32:case 44:++r;continue;case 10:++r,++e.line,e.lineStart=r;continue;case 13:n.charCodeAt(r+1)===10?r+=2:++r,++e.line,e.lineStart=r;continue;case 35:return Ut(e,r);case 33:return m(e,o.BANG,r,r+1);case 36:return m(e,o.DOLLAR,r,r+1);case 38:return m(e,o.AMP,r,r+1);case 40:return m(e,o.PAREN_L,r,r+1);case 41:return m(e,o.PAREN_R,r,r+1);case 46:if(n.charCodeAt(r+1)===46&&n.charCodeAt(r+2)===46)return m(e,o.SPREAD,r,r+3);break;case 58:return m(e,o.COLON,r,r+1);case 61:return m(e,o.EQUALS,r,r+1);case 64:return m(e,o.AT,r,r+1);case 91:return m(e,o.BRACKET_L,r,r+1);case 93:return m(e,o.BRACKET_R,r,r+1);case 123:return m(e,o.BRACE_L,r,r+1);case 124:return m(e,o.PIPE,r,r+1);case 125:return m(e,o.BRACE_R,r,r+1);case 34:return n.charCodeAt(r+1)===34&&n.charCodeAt(r+2)===34?Ht(e,r):Yt(e,r)}if(b(s)||s===45)return Gt(e,r,s);if(le(s))return Jt(e,r);throw h(e.source,r,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:L(s)||K(n,r)?`Unexpected character: ${R(e,r)}.`:`Invalid character: ${R(e,r)}.`)}return m(e,o.EOF,i,i)}function Ut(e,t){let n=e.source.body,i=n.length,r=t+1;for(;r<i;){let s=n.charCodeAt(r);if(s===10||s===13)break;if(L(s))++r;else if(K(n,r))r+=2;else break}return m(e,o.COMMENT,t,r,n.slice(t+1,r))}function Gt(e,t,n){let i=e.source.body,r=t,s=n,a=!1;if(s===45&&(s=i.charCodeAt(++r)),s===48){if(s=i.charCodeAt(++r),b(s))throw h(e.source,r,`Invalid number, unexpected digit after 0: ${R(e,r)}.`)}else r=fe(e,r,s),s=i.charCodeAt(r);if(s===46&&(a=!0,s=i.charCodeAt(++r),r=fe(e,r,s),s=i.charCodeAt(r)),(s===69||s===101)&&(a=!0,s=i.charCodeAt(++r),(s===43||s===45)&&(s=i.charCodeAt(++r)),r=fe(e,r,s),s=i.charCodeAt(r)),s===46||le(s))throw h(e.source,r,`Invalid number, expected digit but got: ${R(e,r)}.`);return m(e,a?o.FLOAT:o.INT,t,r,i.slice(t,r))}function fe(e,t,n){if(!b(n))throw h(e.source,t,`Invalid number, expected digit but got: ${R(e,t)}.`);let i=e.source.body,r=t+1;for(;b(i.charCodeAt(r));)++r;return r}function Yt(e,t){let n=e.source.body,i=n.length,r=t+1,s=r,a="";for(;r<i;){let u=n.charCodeAt(r);if(u===34)return a+=n.slice(s,r),m(e,o.STRING,t,r+1,a);if(u===92){a+=n.slice(s,r);let p=n.charCodeAt(r+1)===117?n.charCodeAt(r+2)===123?jt(e,r):$t(e,r):Xt(e,r);a+=p.value,r+=p.size,s=r;continue}if(u===10||u===13)break;if(L(u))++r;else if(K(n,r))r+=2;else throw h(e.source,r,`Invalid character within String: ${R(e,r)}.`)}throw h(e.source,r,"Unterminated string.")}function jt(e,t){let n=e.source.body,i=0,r=3;for(;r<12;){let s=n.charCodeAt(t+r++);if(s===125){if(r<5||!L(i))break;return{value:String.fromCodePoint(i),size:r}}if(i=i<<4|V(s),i<0)break}throw h(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+r)}".`)}function $t(e,t){let n=e.source.body,i=tt(n,t+2);if(L(i))return{value:String.fromCodePoint(i),size:6};if(rt(i)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let r=tt(n,t+8);if(it(r))return{value:String.fromCodePoint(i,r),size:12}}throw h(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function tt(e,t){return V(e.charCodeAt(t))<<12|V(e.charCodeAt(t+1))<<8|V(e.charCodeAt(t+2))<<4|V(e.charCodeAt(t+3))}function V(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Xt(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
|
|
16
|
+
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw h(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Ht(e,t){let n=e.source.body,i=n.length,r=e.lineStart,s=t+3,a=s,u="",p=[];for(;s<i;){let T=n.charCodeAt(s);if(T===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(a,s),p.push(u);let d=m(e,o.BLOCK_STRING,t,s+3,et(p).join(`
|
|
17
|
+
`));return e.line+=p.length-1,e.lineStart=r,d}if(T===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){u+=n.slice(a,s),a=s+1,s+=4;continue}if(T===10||T===13){u+=n.slice(a,s),p.push(u),T===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,r=s;continue}if(L(T))++s;else if(K(n,s))s+=2;else throw h(e.source,s,`Invalid character within String: ${R(e,s)}.`)}throw h(e.source,s,"Unterminated string.")}function Jt(e,t){let n=e.source.body,i=n.length,r=t+1;for(;r<i;){let s=n.charCodeAt(r);if(Ze(s))++r;else break}return m(e,o.NAME,t,r,n.slice(t,r))}function Z(e,t){if(!!!e)throw new Error(t)}function ee(e){return te(e,[])}function te(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return qt(e,t);default:return String(e)}}function qt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";let n=[...t,e];if(Qt(e)){let i=e.toJSON();if(i!==e)return typeof i=="string"?i:te(i,n)}else if(Array.isArray(e))return zt(e,n);return Wt(e,n)}function Qt(e){return typeof e.toJSON=="function"}function Wt(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+Kt(e)+"]":"{ "+n.map(([r,s])=>r+": "+te(s,t)).join(", ")+" }"}function zt(e,t){if(e.length===0)return"[]";if(t.length>2)return"[Array]";let n=Math.min(10,e.length),i=e.length-n,r=[];for(let s=0;s<n;++s)r.push(te(e[s],t));return i===1?r.push("... 1 more item"):i>1&&r.push(`... ${i} more items`),"["+r.join(", ")+"]"}function Kt(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var Zt=globalThis.process&&!0,st=Zt?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var i;let r=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(i=t.constructor)===null||i===void 0?void 0:i.name;if(r===s){let a=ee(t);throw new Error(`Cannot use ${r} "${a}" from another module or realm.
|
|
1553
18
|
|
|
1554
19
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
1555
20
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -1560,862 +25,4 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
1560
25
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
1561
26
|
versions may have different capabilities and behavior. The data from one
|
|
1562
27
|
version used in the function from another could produce confusing and
|
|
1563
|
-
spurious results.`);
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
return !1;
|
|
1567
|
-
};
|
|
1568
|
-
var M = class {
|
|
1569
|
-
constructor(t, n = "GraphQL request", r = { line: 1, column: 1 }) {
|
|
1570
|
-
typeof t == "string" ||
|
|
1571
|
-
Z(!1, `Body must be a string. Received: ${ee(t)}.`),
|
|
1572
|
-
(this.body = t),
|
|
1573
|
-
(this.name = n),
|
|
1574
|
-
(this.locationOffset = r),
|
|
1575
|
-
this.locationOffset.line > 0 ||
|
|
1576
|
-
Z(!1, "line in locationOffset is 1-indexed and must be positive."),
|
|
1577
|
-
this.locationOffset.column > 0 ||
|
|
1578
|
-
Z(!1, "column in locationOffset is 1-indexed and must be positive.");
|
|
1579
|
-
}
|
|
1580
|
-
get [Symbol.toStringTag]() {
|
|
1581
|
-
return "Source";
|
|
1582
|
-
}
|
|
1583
|
-
};
|
|
1584
|
-
function ze(e) {
|
|
1585
|
-
return He(e, M);
|
|
1586
|
-
}
|
|
1587
|
-
function Ke(e, t) {
|
|
1588
|
-
return new Ee(e, t).parseDocument();
|
|
1589
|
-
}
|
|
1590
|
-
var Ee = class {
|
|
1591
|
-
constructor(t, n = {}) {
|
|
1592
|
-
let r = ze(t) ? t : new M(t);
|
|
1593
|
-
(this._lexer = new z(r)), (this._options = n), (this._tokenCounter = 0);
|
|
1594
|
-
}
|
|
1595
|
-
parseName() {
|
|
1596
|
-
let t = this.expectToken(o.NAME);
|
|
1597
|
-
return this.node(t, { kind: c.NAME, value: t.value });
|
|
1598
|
-
}
|
|
1599
|
-
parseDocument() {
|
|
1600
|
-
return this.node(this._lexer.token, {
|
|
1601
|
-
kind: c.DOCUMENT,
|
|
1602
|
-
definitions: this.many(o.SOF, this.parseDefinition, o.EOF),
|
|
1603
|
-
});
|
|
1604
|
-
}
|
|
1605
|
-
parseDefinition() {
|
|
1606
|
-
if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
|
|
1607
|
-
let t = this.peekDescription(),
|
|
1608
|
-
n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1609
|
-
if (n.kind === o.NAME) {
|
|
1610
|
-
switch (n.value) {
|
|
1611
|
-
case "schema":
|
|
1612
|
-
return this.parseSchemaDefinition();
|
|
1613
|
-
case "scalar":
|
|
1614
|
-
return this.parseScalarTypeDefinition();
|
|
1615
|
-
case "type":
|
|
1616
|
-
return this.parseObjectTypeDefinition();
|
|
1617
|
-
case "interface":
|
|
1618
|
-
return this.parseInterfaceTypeDefinition();
|
|
1619
|
-
case "union":
|
|
1620
|
-
return this.parseUnionTypeDefinition();
|
|
1621
|
-
case "enum":
|
|
1622
|
-
return this.parseEnumTypeDefinition();
|
|
1623
|
-
case "input":
|
|
1624
|
-
return this.parseInputObjectTypeDefinition();
|
|
1625
|
-
case "directive":
|
|
1626
|
-
return this.parseDirectiveDefinition();
|
|
1627
|
-
}
|
|
1628
|
-
if (t)
|
|
1629
|
-
throw d(
|
|
1630
|
-
this._lexer.source,
|
|
1631
|
-
this._lexer.token.start,
|
|
1632
|
-
"Unexpected description, descriptions are supported only on type definitions.",
|
|
1633
|
-
);
|
|
1634
|
-
switch (n.value) {
|
|
1635
|
-
case "query":
|
|
1636
|
-
case "mutation":
|
|
1637
|
-
case "subscription":
|
|
1638
|
-
return this.parseOperationDefinition();
|
|
1639
|
-
case "fragment":
|
|
1640
|
-
return this.parseFragmentDefinition();
|
|
1641
|
-
case "extend":
|
|
1642
|
-
return this.parseTypeSystemExtension();
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
throw this.unexpected(n);
|
|
1646
|
-
}
|
|
1647
|
-
parseOperationDefinition() {
|
|
1648
|
-
let t = this._lexer.token;
|
|
1649
|
-
if (this.peek(o.BRACE_L))
|
|
1650
|
-
return this.node(t, {
|
|
1651
|
-
kind: c.OPERATION_DEFINITION,
|
|
1652
|
-
operation: S.QUERY,
|
|
1653
|
-
name: void 0,
|
|
1654
|
-
variableDefinitions: [],
|
|
1655
|
-
directives: [],
|
|
1656
|
-
selectionSet: this.parseSelectionSet(),
|
|
1657
|
-
});
|
|
1658
|
-
let n = this.parseOperationType(),
|
|
1659
|
-
r;
|
|
1660
|
-
return (
|
|
1661
|
-
this.peek(o.NAME) && (r = this.parseName()),
|
|
1662
|
-
this.node(t, {
|
|
1663
|
-
kind: c.OPERATION_DEFINITION,
|
|
1664
|
-
operation: n,
|
|
1665
|
-
name: r,
|
|
1666
|
-
variableDefinitions: this.parseVariableDefinitions(),
|
|
1667
|
-
directives: this.parseDirectives(!1),
|
|
1668
|
-
selectionSet: this.parseSelectionSet(),
|
|
1669
|
-
})
|
|
1670
|
-
);
|
|
1671
|
-
}
|
|
1672
|
-
parseOperationType() {
|
|
1673
|
-
let t = this.expectToken(o.NAME);
|
|
1674
|
-
switch (t.value) {
|
|
1675
|
-
case "query":
|
|
1676
|
-
return S.QUERY;
|
|
1677
|
-
case "mutation":
|
|
1678
|
-
return S.MUTATION;
|
|
1679
|
-
case "subscription":
|
|
1680
|
-
return S.SUBSCRIPTION;
|
|
1681
|
-
}
|
|
1682
|
-
throw this.unexpected(t);
|
|
1683
|
-
}
|
|
1684
|
-
parseVariableDefinitions() {
|
|
1685
|
-
return this.optionalMany(
|
|
1686
|
-
o.PAREN_L,
|
|
1687
|
-
this.parseVariableDefinition,
|
|
1688
|
-
o.PAREN_R,
|
|
1689
|
-
);
|
|
1690
|
-
}
|
|
1691
|
-
parseVariableDefinition() {
|
|
1692
|
-
return this.node(this._lexer.token, {
|
|
1693
|
-
kind: c.VARIABLE_DEFINITION,
|
|
1694
|
-
variable: this.parseVariable(),
|
|
1695
|
-
type: (this.expectToken(o.COLON), this.parseTypeReference()),
|
|
1696
|
-
defaultValue: this.expectOptionalToken(o.EQUALS)
|
|
1697
|
-
? this.parseConstValueLiteral()
|
|
1698
|
-
: void 0,
|
|
1699
|
-
directives: this.parseConstDirectives(),
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
parseVariable() {
|
|
1703
|
-
let t = this._lexer.token;
|
|
1704
|
-
return (
|
|
1705
|
-
this.expectToken(o.DOLLAR),
|
|
1706
|
-
this.node(t, { kind: c.VARIABLE, name: this.parseName() })
|
|
1707
|
-
);
|
|
1708
|
-
}
|
|
1709
|
-
parseSelectionSet() {
|
|
1710
|
-
return this.node(this._lexer.token, {
|
|
1711
|
-
kind: c.SELECTION_SET,
|
|
1712
|
-
selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R),
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
parseSelection() {
|
|
1716
|
-
return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
|
|
1717
|
-
}
|
|
1718
|
-
parseField() {
|
|
1719
|
-
let t = this._lexer.token,
|
|
1720
|
-
n = this.parseName(),
|
|
1721
|
-
r,
|
|
1722
|
-
i;
|
|
1723
|
-
return (
|
|
1724
|
-
this.expectOptionalToken(o.COLON)
|
|
1725
|
-
? ((r = n), (i = this.parseName()))
|
|
1726
|
-
: (i = n),
|
|
1727
|
-
this.node(t, {
|
|
1728
|
-
kind: c.FIELD,
|
|
1729
|
-
alias: r,
|
|
1730
|
-
name: i,
|
|
1731
|
-
arguments: this.parseArguments(!1),
|
|
1732
|
-
directives: this.parseDirectives(!1),
|
|
1733
|
-
selectionSet: this.peek(o.BRACE_L)
|
|
1734
|
-
? this.parseSelectionSet()
|
|
1735
|
-
: void 0,
|
|
1736
|
-
})
|
|
1737
|
-
);
|
|
1738
|
-
}
|
|
1739
|
-
parseArguments(t) {
|
|
1740
|
-
let n = t ? this.parseConstArgument : this.parseArgument;
|
|
1741
|
-
return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
|
|
1742
|
-
}
|
|
1743
|
-
parseArgument(t = !1) {
|
|
1744
|
-
let n = this._lexer.token,
|
|
1745
|
-
r = this.parseName();
|
|
1746
|
-
return (
|
|
1747
|
-
this.expectToken(o.COLON),
|
|
1748
|
-
this.node(n, {
|
|
1749
|
-
kind: c.ARGUMENT,
|
|
1750
|
-
name: r,
|
|
1751
|
-
value: this.parseValueLiteral(t),
|
|
1752
|
-
})
|
|
1753
|
-
);
|
|
1754
|
-
}
|
|
1755
|
-
parseConstArgument() {
|
|
1756
|
-
return this.parseArgument(!0);
|
|
1757
|
-
}
|
|
1758
|
-
parseFragment() {
|
|
1759
|
-
let t = this._lexer.token;
|
|
1760
|
-
this.expectToken(o.SPREAD);
|
|
1761
|
-
let n = this.expectOptionalKeyword("on");
|
|
1762
|
-
return !n && this.peek(o.NAME)
|
|
1763
|
-
? this.node(t, {
|
|
1764
|
-
kind: c.FRAGMENT_SPREAD,
|
|
1765
|
-
name: this.parseFragmentName(),
|
|
1766
|
-
directives: this.parseDirectives(!1),
|
|
1767
|
-
})
|
|
1768
|
-
: this.node(t, {
|
|
1769
|
-
kind: c.INLINE_FRAGMENT,
|
|
1770
|
-
typeCondition: n ? this.parseNamedType() : void 0,
|
|
1771
|
-
directives: this.parseDirectives(!1),
|
|
1772
|
-
selectionSet: this.parseSelectionSet(),
|
|
1773
|
-
});
|
|
1774
|
-
}
|
|
1775
|
-
parseFragmentDefinition() {
|
|
1776
|
-
let t = this._lexer.token;
|
|
1777
|
-
return (
|
|
1778
|
-
this.expectKeyword("fragment"),
|
|
1779
|
-
this._options.allowLegacyFragmentVariables === !0
|
|
1780
|
-
? this.node(t, {
|
|
1781
|
-
kind: c.FRAGMENT_DEFINITION,
|
|
1782
|
-
name: this.parseFragmentName(),
|
|
1783
|
-
variableDefinitions: this.parseVariableDefinitions(),
|
|
1784
|
-
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1785
|
-
directives: this.parseDirectives(!1),
|
|
1786
|
-
selectionSet: this.parseSelectionSet(),
|
|
1787
|
-
})
|
|
1788
|
-
: this.node(t, {
|
|
1789
|
-
kind: c.FRAGMENT_DEFINITION,
|
|
1790
|
-
name: this.parseFragmentName(),
|
|
1791
|
-
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1792
|
-
directives: this.parseDirectives(!1),
|
|
1793
|
-
selectionSet: this.parseSelectionSet(),
|
|
1794
|
-
})
|
|
1795
|
-
);
|
|
1796
|
-
}
|
|
1797
|
-
parseFragmentName() {
|
|
1798
|
-
if (this._lexer.token.value === "on") throw this.unexpected();
|
|
1799
|
-
return this.parseName();
|
|
1800
|
-
}
|
|
1801
|
-
parseValueLiteral(t) {
|
|
1802
|
-
let n = this._lexer.token;
|
|
1803
|
-
switch (n.kind) {
|
|
1804
|
-
case o.BRACKET_L:
|
|
1805
|
-
return this.parseList(t);
|
|
1806
|
-
case o.BRACE_L:
|
|
1807
|
-
return this.parseObject(t);
|
|
1808
|
-
case o.INT:
|
|
1809
|
-
return (
|
|
1810
|
-
this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value })
|
|
1811
|
-
);
|
|
1812
|
-
case o.FLOAT:
|
|
1813
|
-
return (
|
|
1814
|
-
this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value })
|
|
1815
|
-
);
|
|
1816
|
-
case o.STRING:
|
|
1817
|
-
case o.BLOCK_STRING:
|
|
1818
|
-
return this.parseStringLiteral();
|
|
1819
|
-
case o.NAME:
|
|
1820
|
-
switch ((this.advanceLexer(), n.value)) {
|
|
1821
|
-
case "true":
|
|
1822
|
-
return this.node(n, { kind: c.BOOLEAN, value: !0 });
|
|
1823
|
-
case "false":
|
|
1824
|
-
return this.node(n, { kind: c.BOOLEAN, value: !1 });
|
|
1825
|
-
case "null":
|
|
1826
|
-
return this.node(n, { kind: c.NULL });
|
|
1827
|
-
default:
|
|
1828
|
-
return this.node(n, { kind: c.ENUM, value: n.value });
|
|
1829
|
-
}
|
|
1830
|
-
case o.DOLLAR:
|
|
1831
|
-
if (t)
|
|
1832
|
-
if (
|
|
1833
|
-
(this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME)
|
|
1834
|
-
) {
|
|
1835
|
-
let r = this._lexer.token.value;
|
|
1836
|
-
throw d(
|
|
1837
|
-
this._lexer.source,
|
|
1838
|
-
n.start,
|
|
1839
|
-
`Unexpected variable "$${r}" in constant value.`,
|
|
1840
|
-
);
|
|
1841
|
-
} else throw this.unexpected(n);
|
|
1842
|
-
return this.parseVariable();
|
|
1843
|
-
default:
|
|
1844
|
-
throw this.unexpected();
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
parseConstValueLiteral() {
|
|
1848
|
-
return this.parseValueLiteral(!0);
|
|
1849
|
-
}
|
|
1850
|
-
parseStringLiteral() {
|
|
1851
|
-
let t = this._lexer.token;
|
|
1852
|
-
return (
|
|
1853
|
-
this.advanceLexer(),
|
|
1854
|
-
this.node(t, {
|
|
1855
|
-
kind: c.STRING,
|
|
1856
|
-
value: t.value,
|
|
1857
|
-
block: t.kind === o.BLOCK_STRING,
|
|
1858
|
-
})
|
|
1859
|
-
);
|
|
1860
|
-
}
|
|
1861
|
-
parseList(t) {
|
|
1862
|
-
let n = () => this.parseValueLiteral(t);
|
|
1863
|
-
return this.node(this._lexer.token, {
|
|
1864
|
-
kind: c.LIST,
|
|
1865
|
-
values: this.any(o.BRACKET_L, n, o.BRACKET_R),
|
|
1866
|
-
});
|
|
1867
|
-
}
|
|
1868
|
-
parseObject(t) {
|
|
1869
|
-
let n = () => this.parseObjectField(t);
|
|
1870
|
-
return this.node(this._lexer.token, {
|
|
1871
|
-
kind: c.OBJECT,
|
|
1872
|
-
fields: this.any(o.BRACE_L, n, o.BRACE_R),
|
|
1873
|
-
});
|
|
1874
|
-
}
|
|
1875
|
-
parseObjectField(t) {
|
|
1876
|
-
let n = this._lexer.token,
|
|
1877
|
-
r = this.parseName();
|
|
1878
|
-
return (
|
|
1879
|
-
this.expectToken(o.COLON),
|
|
1880
|
-
this.node(n, {
|
|
1881
|
-
kind: c.OBJECT_FIELD,
|
|
1882
|
-
name: r,
|
|
1883
|
-
value: this.parseValueLiteral(t),
|
|
1884
|
-
})
|
|
1885
|
-
);
|
|
1886
|
-
}
|
|
1887
|
-
parseDirectives(t) {
|
|
1888
|
-
let n = [];
|
|
1889
|
-
for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
|
|
1890
|
-
return n;
|
|
1891
|
-
}
|
|
1892
|
-
parseConstDirectives() {
|
|
1893
|
-
return this.parseDirectives(!0);
|
|
1894
|
-
}
|
|
1895
|
-
parseDirective(t) {
|
|
1896
|
-
let n = this._lexer.token;
|
|
1897
|
-
return (
|
|
1898
|
-
this.expectToken(o.AT),
|
|
1899
|
-
this.node(n, {
|
|
1900
|
-
kind: c.DIRECTIVE,
|
|
1901
|
-
name: this.parseName(),
|
|
1902
|
-
arguments: this.parseArguments(t),
|
|
1903
|
-
})
|
|
1904
|
-
);
|
|
1905
|
-
}
|
|
1906
|
-
parseTypeReference() {
|
|
1907
|
-
let t = this._lexer.token,
|
|
1908
|
-
n;
|
|
1909
|
-
if (this.expectOptionalToken(o.BRACKET_L)) {
|
|
1910
|
-
let r = this.parseTypeReference();
|
|
1911
|
-
this.expectToken(o.BRACKET_R),
|
|
1912
|
-
(n = this.node(t, { kind: c.LIST_TYPE, type: r }));
|
|
1913
|
-
} else n = this.parseNamedType();
|
|
1914
|
-
return this.expectOptionalToken(o.BANG)
|
|
1915
|
-
? this.node(t, { kind: c.NON_NULL_TYPE, type: n })
|
|
1916
|
-
: n;
|
|
1917
|
-
}
|
|
1918
|
-
parseNamedType() {
|
|
1919
|
-
return this.node(this._lexer.token, {
|
|
1920
|
-
kind: c.NAMED_TYPE,
|
|
1921
|
-
name: this.parseName(),
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
peekDescription() {
|
|
1925
|
-
return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
|
|
1926
|
-
}
|
|
1927
|
-
parseDescription() {
|
|
1928
|
-
if (this.peekDescription()) return this.parseStringLiteral();
|
|
1929
|
-
}
|
|
1930
|
-
parseSchemaDefinition() {
|
|
1931
|
-
let t = this._lexer.token,
|
|
1932
|
-
n = this.parseDescription();
|
|
1933
|
-
this.expectKeyword("schema");
|
|
1934
|
-
let r = this.parseConstDirectives(),
|
|
1935
|
-
i = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
|
|
1936
|
-
return this.node(t, {
|
|
1937
|
-
kind: c.SCHEMA_DEFINITION,
|
|
1938
|
-
description: n,
|
|
1939
|
-
directives: r,
|
|
1940
|
-
operationTypes: i,
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
parseOperationTypeDefinition() {
|
|
1944
|
-
let t = this._lexer.token,
|
|
1945
|
-
n = this.parseOperationType();
|
|
1946
|
-
this.expectToken(o.COLON);
|
|
1947
|
-
let r = this.parseNamedType();
|
|
1948
|
-
return this.node(t, {
|
|
1949
|
-
kind: c.OPERATION_TYPE_DEFINITION,
|
|
1950
|
-
operation: n,
|
|
1951
|
-
type: r,
|
|
1952
|
-
});
|
|
1953
|
-
}
|
|
1954
|
-
parseScalarTypeDefinition() {
|
|
1955
|
-
let t = this._lexer.token,
|
|
1956
|
-
n = this.parseDescription();
|
|
1957
|
-
this.expectKeyword("scalar");
|
|
1958
|
-
let r = this.parseName(),
|
|
1959
|
-
i = this.parseConstDirectives();
|
|
1960
|
-
return this.node(t, {
|
|
1961
|
-
kind: c.SCALAR_TYPE_DEFINITION,
|
|
1962
|
-
description: n,
|
|
1963
|
-
name: r,
|
|
1964
|
-
directives: i,
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
parseObjectTypeDefinition() {
|
|
1968
|
-
let t = this._lexer.token,
|
|
1969
|
-
n = this.parseDescription();
|
|
1970
|
-
this.expectKeyword("type");
|
|
1971
|
-
let r = this.parseName(),
|
|
1972
|
-
i = this.parseImplementsInterfaces(),
|
|
1973
|
-
s = this.parseConstDirectives(),
|
|
1974
|
-
a = this.parseFieldsDefinition();
|
|
1975
|
-
return this.node(t, {
|
|
1976
|
-
kind: c.OBJECT_TYPE_DEFINITION,
|
|
1977
|
-
description: n,
|
|
1978
|
-
name: r,
|
|
1979
|
-
interfaces: i,
|
|
1980
|
-
directives: s,
|
|
1981
|
-
fields: a,
|
|
1982
|
-
});
|
|
1983
|
-
}
|
|
1984
|
-
parseImplementsInterfaces() {
|
|
1985
|
-
return this.expectOptionalKeyword("implements")
|
|
1986
|
-
? this.delimitedMany(o.AMP, this.parseNamedType)
|
|
1987
|
-
: [];
|
|
1988
|
-
}
|
|
1989
|
-
parseFieldsDefinition() {
|
|
1990
|
-
return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
|
|
1991
|
-
}
|
|
1992
|
-
parseFieldDefinition() {
|
|
1993
|
-
let t = this._lexer.token,
|
|
1994
|
-
n = this.parseDescription(),
|
|
1995
|
-
r = this.parseName(),
|
|
1996
|
-
i = this.parseArgumentDefs();
|
|
1997
|
-
this.expectToken(o.COLON);
|
|
1998
|
-
let s = this.parseTypeReference(),
|
|
1999
|
-
a = this.parseConstDirectives();
|
|
2000
|
-
return this.node(t, {
|
|
2001
|
-
kind: c.FIELD_DEFINITION,
|
|
2002
|
-
description: n,
|
|
2003
|
-
name: r,
|
|
2004
|
-
arguments: i,
|
|
2005
|
-
type: s,
|
|
2006
|
-
directives: a,
|
|
2007
|
-
});
|
|
2008
|
-
}
|
|
2009
|
-
parseArgumentDefs() {
|
|
2010
|
-
return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
|
|
2011
|
-
}
|
|
2012
|
-
parseInputValueDef() {
|
|
2013
|
-
let t = this._lexer.token,
|
|
2014
|
-
n = this.parseDescription(),
|
|
2015
|
-
r = this.parseName();
|
|
2016
|
-
this.expectToken(o.COLON);
|
|
2017
|
-
let i = this.parseTypeReference(),
|
|
2018
|
-
s;
|
|
2019
|
-
this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
|
|
2020
|
-
let a = this.parseConstDirectives();
|
|
2021
|
-
return this.node(t, {
|
|
2022
|
-
kind: c.INPUT_VALUE_DEFINITION,
|
|
2023
|
-
description: n,
|
|
2024
|
-
name: r,
|
|
2025
|
-
type: i,
|
|
2026
|
-
defaultValue: s,
|
|
2027
|
-
directives: a,
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
parseInterfaceTypeDefinition() {
|
|
2031
|
-
let t = this._lexer.token,
|
|
2032
|
-
n = this.parseDescription();
|
|
2033
|
-
this.expectKeyword("interface");
|
|
2034
|
-
let r = this.parseName(),
|
|
2035
|
-
i = this.parseImplementsInterfaces(),
|
|
2036
|
-
s = this.parseConstDirectives(),
|
|
2037
|
-
a = this.parseFieldsDefinition();
|
|
2038
|
-
return this.node(t, {
|
|
2039
|
-
kind: c.INTERFACE_TYPE_DEFINITION,
|
|
2040
|
-
description: n,
|
|
2041
|
-
name: r,
|
|
2042
|
-
interfaces: i,
|
|
2043
|
-
directives: s,
|
|
2044
|
-
fields: a,
|
|
2045
|
-
});
|
|
2046
|
-
}
|
|
2047
|
-
parseUnionTypeDefinition() {
|
|
2048
|
-
let t = this._lexer.token,
|
|
2049
|
-
n = this.parseDescription();
|
|
2050
|
-
this.expectKeyword("union");
|
|
2051
|
-
let r = this.parseName(),
|
|
2052
|
-
i = this.parseConstDirectives(),
|
|
2053
|
-
s = this.parseUnionMemberTypes();
|
|
2054
|
-
return this.node(t, {
|
|
2055
|
-
kind: c.UNION_TYPE_DEFINITION,
|
|
2056
|
-
description: n,
|
|
2057
|
-
name: r,
|
|
2058
|
-
directives: i,
|
|
2059
|
-
types: s,
|
|
2060
|
-
});
|
|
2061
|
-
}
|
|
2062
|
-
parseUnionMemberTypes() {
|
|
2063
|
-
return this.expectOptionalToken(o.EQUALS)
|
|
2064
|
-
? this.delimitedMany(o.PIPE, this.parseNamedType)
|
|
2065
|
-
: [];
|
|
2066
|
-
}
|
|
2067
|
-
parseEnumTypeDefinition() {
|
|
2068
|
-
let t = this._lexer.token,
|
|
2069
|
-
n = this.parseDescription();
|
|
2070
|
-
this.expectKeyword("enum");
|
|
2071
|
-
let r = this.parseName(),
|
|
2072
|
-
i = this.parseConstDirectives(),
|
|
2073
|
-
s = this.parseEnumValuesDefinition();
|
|
2074
|
-
return this.node(t, {
|
|
2075
|
-
kind: c.ENUM_TYPE_DEFINITION,
|
|
2076
|
-
description: n,
|
|
2077
|
-
name: r,
|
|
2078
|
-
directives: i,
|
|
2079
|
-
values: s,
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
parseEnumValuesDefinition() {
|
|
2083
|
-
return this.optionalMany(
|
|
2084
|
-
o.BRACE_L,
|
|
2085
|
-
this.parseEnumValueDefinition,
|
|
2086
|
-
o.BRACE_R,
|
|
2087
|
-
);
|
|
2088
|
-
}
|
|
2089
|
-
parseEnumValueDefinition() {
|
|
2090
|
-
let t = this._lexer.token,
|
|
2091
|
-
n = this.parseDescription(),
|
|
2092
|
-
r = this.parseEnumValueName(),
|
|
2093
|
-
i = this.parseConstDirectives();
|
|
2094
|
-
return this.node(t, {
|
|
2095
|
-
kind: c.ENUM_VALUE_DEFINITION,
|
|
2096
|
-
description: n,
|
|
2097
|
-
name: r,
|
|
2098
|
-
directives: i,
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
parseEnumValueName() {
|
|
2102
|
-
if (
|
|
2103
|
-
this._lexer.token.value === "true" ||
|
|
2104
|
-
this._lexer.token.value === "false" ||
|
|
2105
|
-
this._lexer.token.value === "null"
|
|
2106
|
-
)
|
|
2107
|
-
throw d(
|
|
2108
|
-
this._lexer.source,
|
|
2109
|
-
this._lexer.token.start,
|
|
2110
|
-
`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`,
|
|
2111
|
-
);
|
|
2112
|
-
return this.parseName();
|
|
2113
|
-
}
|
|
2114
|
-
parseInputObjectTypeDefinition() {
|
|
2115
|
-
let t = this._lexer.token,
|
|
2116
|
-
n = this.parseDescription();
|
|
2117
|
-
this.expectKeyword("input");
|
|
2118
|
-
let r = this.parseName(),
|
|
2119
|
-
i = this.parseConstDirectives(),
|
|
2120
|
-
s = this.parseInputFieldsDefinition();
|
|
2121
|
-
return this.node(t, {
|
|
2122
|
-
kind: c.INPUT_OBJECT_TYPE_DEFINITION,
|
|
2123
|
-
description: n,
|
|
2124
|
-
name: r,
|
|
2125
|
-
directives: i,
|
|
2126
|
-
fields: s,
|
|
2127
|
-
});
|
|
2128
|
-
}
|
|
2129
|
-
parseInputFieldsDefinition() {
|
|
2130
|
-
return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
|
|
2131
|
-
}
|
|
2132
|
-
parseTypeSystemExtension() {
|
|
2133
|
-
let t = this._lexer.lookahead();
|
|
2134
|
-
if (t.kind === o.NAME)
|
|
2135
|
-
switch (t.value) {
|
|
2136
|
-
case "schema":
|
|
2137
|
-
return this.parseSchemaExtension();
|
|
2138
|
-
case "scalar":
|
|
2139
|
-
return this.parseScalarTypeExtension();
|
|
2140
|
-
case "type":
|
|
2141
|
-
return this.parseObjectTypeExtension();
|
|
2142
|
-
case "interface":
|
|
2143
|
-
return this.parseInterfaceTypeExtension();
|
|
2144
|
-
case "union":
|
|
2145
|
-
return this.parseUnionTypeExtension();
|
|
2146
|
-
case "enum":
|
|
2147
|
-
return this.parseEnumTypeExtension();
|
|
2148
|
-
case "input":
|
|
2149
|
-
return this.parseInputObjectTypeExtension();
|
|
2150
|
-
}
|
|
2151
|
-
throw this.unexpected(t);
|
|
2152
|
-
}
|
|
2153
|
-
parseSchemaExtension() {
|
|
2154
|
-
let t = this._lexer.token;
|
|
2155
|
-
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
2156
|
-
let n = this.parseConstDirectives(),
|
|
2157
|
-
r = this.optionalMany(
|
|
2158
|
-
o.BRACE_L,
|
|
2159
|
-
this.parseOperationTypeDefinition,
|
|
2160
|
-
o.BRACE_R,
|
|
2161
|
-
);
|
|
2162
|
-
if (n.length === 0 && r.length === 0) throw this.unexpected();
|
|
2163
|
-
return this.node(t, {
|
|
2164
|
-
kind: c.SCHEMA_EXTENSION,
|
|
2165
|
-
directives: n,
|
|
2166
|
-
operationTypes: r,
|
|
2167
|
-
});
|
|
2168
|
-
}
|
|
2169
|
-
parseScalarTypeExtension() {
|
|
2170
|
-
let t = this._lexer.token;
|
|
2171
|
-
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
2172
|
-
let n = this.parseName(),
|
|
2173
|
-
r = this.parseConstDirectives();
|
|
2174
|
-
if (r.length === 0) throw this.unexpected();
|
|
2175
|
-
return this.node(t, {
|
|
2176
|
-
kind: c.SCALAR_TYPE_EXTENSION,
|
|
2177
|
-
name: n,
|
|
2178
|
-
directives: r,
|
|
2179
|
-
});
|
|
2180
|
-
}
|
|
2181
|
-
parseObjectTypeExtension() {
|
|
2182
|
-
let t = this._lexer.token;
|
|
2183
|
-
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
2184
|
-
let n = this.parseName(),
|
|
2185
|
-
r = this.parseImplementsInterfaces(),
|
|
2186
|
-
i = this.parseConstDirectives(),
|
|
2187
|
-
s = this.parseFieldsDefinition();
|
|
2188
|
-
if (r.length === 0 && i.length === 0 && s.length === 0)
|
|
2189
|
-
throw this.unexpected();
|
|
2190
|
-
return this.node(t, {
|
|
2191
|
-
kind: c.OBJECT_TYPE_EXTENSION,
|
|
2192
|
-
name: n,
|
|
2193
|
-
interfaces: r,
|
|
2194
|
-
directives: i,
|
|
2195
|
-
fields: s,
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
parseInterfaceTypeExtension() {
|
|
2199
|
-
let t = this._lexer.token;
|
|
2200
|
-
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
2201
|
-
let n = this.parseName(),
|
|
2202
|
-
r = this.parseImplementsInterfaces(),
|
|
2203
|
-
i = this.parseConstDirectives(),
|
|
2204
|
-
s = this.parseFieldsDefinition();
|
|
2205
|
-
if (r.length === 0 && i.length === 0 && s.length === 0)
|
|
2206
|
-
throw this.unexpected();
|
|
2207
|
-
return this.node(t, {
|
|
2208
|
-
kind: c.INTERFACE_TYPE_EXTENSION,
|
|
2209
|
-
name: n,
|
|
2210
|
-
interfaces: r,
|
|
2211
|
-
directives: i,
|
|
2212
|
-
fields: s,
|
|
2213
|
-
});
|
|
2214
|
-
}
|
|
2215
|
-
parseUnionTypeExtension() {
|
|
2216
|
-
let t = this._lexer.token;
|
|
2217
|
-
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
2218
|
-
let n = this.parseName(),
|
|
2219
|
-
r = this.parseConstDirectives(),
|
|
2220
|
-
i = this.parseUnionMemberTypes();
|
|
2221
|
-
if (r.length === 0 && i.length === 0) throw this.unexpected();
|
|
2222
|
-
return this.node(t, {
|
|
2223
|
-
kind: c.UNION_TYPE_EXTENSION,
|
|
2224
|
-
name: n,
|
|
2225
|
-
directives: r,
|
|
2226
|
-
types: i,
|
|
2227
|
-
});
|
|
2228
|
-
}
|
|
2229
|
-
parseEnumTypeExtension() {
|
|
2230
|
-
let t = this._lexer.token;
|
|
2231
|
-
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
2232
|
-
let n = this.parseName(),
|
|
2233
|
-
r = this.parseConstDirectives(),
|
|
2234
|
-
i = this.parseEnumValuesDefinition();
|
|
2235
|
-
if (r.length === 0 && i.length === 0) throw this.unexpected();
|
|
2236
|
-
return this.node(t, {
|
|
2237
|
-
kind: c.ENUM_TYPE_EXTENSION,
|
|
2238
|
-
name: n,
|
|
2239
|
-
directives: r,
|
|
2240
|
-
values: i,
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
parseInputObjectTypeExtension() {
|
|
2244
|
-
let t = this._lexer.token;
|
|
2245
|
-
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
2246
|
-
let n = this.parseName(),
|
|
2247
|
-
r = this.parseConstDirectives(),
|
|
2248
|
-
i = this.parseInputFieldsDefinition();
|
|
2249
|
-
if (r.length === 0 && i.length === 0) throw this.unexpected();
|
|
2250
|
-
return this.node(t, {
|
|
2251
|
-
kind: c.INPUT_OBJECT_TYPE_EXTENSION,
|
|
2252
|
-
name: n,
|
|
2253
|
-
directives: r,
|
|
2254
|
-
fields: i,
|
|
2255
|
-
});
|
|
2256
|
-
}
|
|
2257
|
-
parseDirectiveDefinition() {
|
|
2258
|
-
let t = this._lexer.token,
|
|
2259
|
-
n = this.parseDescription();
|
|
2260
|
-
this.expectKeyword("directive"), this.expectToken(o.AT);
|
|
2261
|
-
let r = this.parseName(),
|
|
2262
|
-
i = this.parseArgumentDefs(),
|
|
2263
|
-
s = this.expectOptionalKeyword("repeatable");
|
|
2264
|
-
this.expectKeyword("on");
|
|
2265
|
-
let a = this.parseDirectiveLocations();
|
|
2266
|
-
return this.node(t, {
|
|
2267
|
-
kind: c.DIRECTIVE_DEFINITION,
|
|
2268
|
-
description: n,
|
|
2269
|
-
name: r,
|
|
2270
|
-
arguments: i,
|
|
2271
|
-
repeatable: s,
|
|
2272
|
-
locations: a,
|
|
2273
|
-
});
|
|
2274
|
-
}
|
|
2275
|
-
parseDirectiveLocations() {
|
|
2276
|
-
return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
|
|
2277
|
-
}
|
|
2278
|
-
parseDirectiveLocation() {
|
|
2279
|
-
let t = this._lexer.token,
|
|
2280
|
-
n = this.parseName();
|
|
2281
|
-
if (Object.prototype.hasOwnProperty.call(H, n.value)) return n;
|
|
2282
|
-
throw this.unexpected(t);
|
|
2283
|
-
}
|
|
2284
|
-
node(t, n) {
|
|
2285
|
-
return (
|
|
2286
|
-
this._options.noLocation !== !0 &&
|
|
2287
|
-
(n.loc = new J(t, this._lexer.lastToken, this._lexer.source)),
|
|
2288
|
-
n
|
|
2289
|
-
);
|
|
2290
|
-
}
|
|
2291
|
-
peek(t) {
|
|
2292
|
-
return this._lexer.token.kind === t;
|
|
2293
|
-
}
|
|
2294
|
-
expectToken(t) {
|
|
2295
|
-
let n = this._lexer.token;
|
|
2296
|
-
if (n.kind === t) return this.advanceLexer(), n;
|
|
2297
|
-
throw d(
|
|
2298
|
-
this._lexer.source,
|
|
2299
|
-
n.start,
|
|
2300
|
-
`Expected ${Ze(t)}, found ${ne(n)}.`,
|
|
2301
|
-
);
|
|
2302
|
-
}
|
|
2303
|
-
expectOptionalToken(t) {
|
|
2304
|
-
return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
|
|
2305
|
-
}
|
|
2306
|
-
expectKeyword(t) {
|
|
2307
|
-
let n = this._lexer.token;
|
|
2308
|
-
if (n.kind === o.NAME && n.value === t) this.advanceLexer();
|
|
2309
|
-
else
|
|
2310
|
-
throw d(
|
|
2311
|
-
this._lexer.source,
|
|
2312
|
-
n.start,
|
|
2313
|
-
`Expected "${t}", found ${ne(n)}.`,
|
|
2314
|
-
);
|
|
2315
|
-
}
|
|
2316
|
-
expectOptionalKeyword(t) {
|
|
2317
|
-
let n = this._lexer.token;
|
|
2318
|
-
return n.kind === o.NAME && n.value === t
|
|
2319
|
-
? (this.advanceLexer(), !0)
|
|
2320
|
-
: !1;
|
|
2321
|
-
}
|
|
2322
|
-
unexpected(t) {
|
|
2323
|
-
let n = t ?? this._lexer.token;
|
|
2324
|
-
return d(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
|
|
2325
|
-
}
|
|
2326
|
-
any(t, n, r) {
|
|
2327
|
-
this.expectToken(t);
|
|
2328
|
-
let i = [];
|
|
2329
|
-
for (; !this.expectOptionalToken(r); ) i.push(n.call(this));
|
|
2330
|
-
return i;
|
|
2331
|
-
}
|
|
2332
|
-
optionalMany(t, n, r) {
|
|
2333
|
-
if (this.expectOptionalToken(t)) {
|
|
2334
|
-
let i = [];
|
|
2335
|
-
do i.push(n.call(this));
|
|
2336
|
-
while (!this.expectOptionalToken(r));
|
|
2337
|
-
return i;
|
|
2338
|
-
}
|
|
2339
|
-
return [];
|
|
2340
|
-
}
|
|
2341
|
-
many(t, n, r) {
|
|
2342
|
-
this.expectToken(t);
|
|
2343
|
-
let i = [];
|
|
2344
|
-
do i.push(n.call(this));
|
|
2345
|
-
while (!this.expectOptionalToken(r));
|
|
2346
|
-
return i;
|
|
2347
|
-
}
|
|
2348
|
-
delimitedMany(t, n) {
|
|
2349
|
-
this.expectOptionalToken(t);
|
|
2350
|
-
let r = [];
|
|
2351
|
-
do r.push(n.call(this));
|
|
2352
|
-
while (this.expectOptionalToken(t));
|
|
2353
|
-
return r;
|
|
2354
|
-
}
|
|
2355
|
-
advanceLexer() {
|
|
2356
|
-
let { maxTokens: t } = this._options,
|
|
2357
|
-
n = this._lexer.advance();
|
|
2358
|
-
if (
|
|
2359
|
-
t !== void 0 &&
|
|
2360
|
-
n.kind !== o.EOF &&
|
|
2361
|
-
(++this._tokenCounter, this._tokenCounter > t)
|
|
2362
|
-
)
|
|
2363
|
-
throw d(
|
|
2364
|
-
this._lexer.source,
|
|
2365
|
-
n.start,
|
|
2366
|
-
`Document contains more that ${t} tokens. Parsing aborted.`,
|
|
2367
|
-
);
|
|
2368
|
-
}
|
|
2369
|
-
};
|
|
2370
|
-
function ne(e) {
|
|
2371
|
-
let t = e.value;
|
|
2372
|
-
return Ze(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2373
|
-
}
|
|
2374
|
-
function Ze(e) {
|
|
2375
|
-
return qe(e) ? `"${e}"` : e;
|
|
2376
|
-
}
|
|
2377
|
-
function nn(e, t) {
|
|
2378
|
-
let n = new SyntaxError(
|
|
2379
|
-
e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")",
|
|
2380
|
-
);
|
|
2381
|
-
return Object.assign(n, t);
|
|
2382
|
-
}
|
|
2383
|
-
var et = nn;
|
|
2384
|
-
function rn(e) {
|
|
2385
|
-
let t = [],
|
|
2386
|
-
{ startToken: n, endToken: r } = e.loc;
|
|
2387
|
-
for (let i = n; i !== r; i = i.next)
|
|
2388
|
-
i.kind === "Comment" &&
|
|
2389
|
-
t.push({ ...i, loc: { start: i.start, end: i.end } });
|
|
2390
|
-
return t;
|
|
2391
|
-
}
|
|
2392
|
-
var sn = { allowLegacyFragmentVariables: !0 };
|
|
2393
|
-
function on(e) {
|
|
2394
|
-
if ((e == null ? void 0 : e.name) === "GraphQLError") {
|
|
2395
|
-
let {
|
|
2396
|
-
message: t,
|
|
2397
|
-
locations: [n],
|
|
2398
|
-
} = e;
|
|
2399
|
-
return et(t, { loc: { start: n }, cause: e });
|
|
2400
|
-
}
|
|
2401
|
-
return e;
|
|
2402
|
-
}
|
|
2403
|
-
function an(e) {
|
|
2404
|
-
let t;
|
|
2405
|
-
try {
|
|
2406
|
-
t = Ke(e, sn);
|
|
2407
|
-
} catch (n) {
|
|
2408
|
-
throw on(n);
|
|
2409
|
-
}
|
|
2410
|
-
return (t.comments = rn(t)), t;
|
|
2411
|
-
}
|
|
2412
|
-
var cn = {
|
|
2413
|
-
parse: an,
|
|
2414
|
-
astFormat: "graphql",
|
|
2415
|
-
hasPragma: Ce,
|
|
2416
|
-
locStart: q,
|
|
2417
|
-
locEnd: Q,
|
|
2418
|
-
};
|
|
2419
|
-
var un = { graphql: Re };
|
|
2420
|
-
return st(ln);
|
|
2421
|
-
});
|
|
28
|
+
spurious results.`)}}return!1};var B=class{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Z(!1,`Body must be a string. Received: ${ee(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Z(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Z(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function ot(e){return st(e,B)}function at(e,t){let n=new he(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}var he=class{constructor(t,n={}){let{lexer:i,...r}=n;if(i)this._lexer=i;else{let s=ot(t)?t:new B(t);this._lexer=new z(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw h(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");switch(n.value){case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:C.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),i=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return C.QUERY;case"mutation":return C.MUTATION;case"subscription":return C.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),i,r;return this.expectOptionalToken(o.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:c.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let i=this._lexer.token.value;throw h(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,i=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let i=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let i=this.parseConstDirectives(),r=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let i=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(o.COLON);let r=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw h(this._lexer.source,this._lexer.token.start,`${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),i=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(W,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),i=this.parseName(),r;!n&&this.expectOptionalToken(o.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:c.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new H(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw h(this._lexer.source,n.start,`Expected ${ct(t)}, found ${ne(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw h(this._lexer.source,n.start,`Expected "${t}", found ${ne(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return h(this._lexer.source,n.start,`Unexpected ${ne(n)}.`)}any(t,n,i){this.expectToken(t);let r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);let r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);let i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw h(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function ne(e){let t=e.value;return ct(e.kind)+(t!=null?` "${t}"`:"")}function ct(e){return nt(e)?`"${e}"`:e}function en(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var ut=en;function tn(e){let t=[],{startToken:n,endToken:i}=e.loc;for(let r=n;r!==i;r=r.next)r.kind==="Comment"&&t.push({...r,loc:{start:r.start,end:r.end}});return t}var nn={allowLegacyFragmentVariables:!0};function rn(e){if(e?.name==="GraphQLError"){let{message:t,locations:[n]}=e;return ut(t,{loc:{start:n},cause:e})}return e}function sn(e){let t;try{t=at(e,nn)}catch(n){throw rn(n)}return t.comments=tn(t),t}var on={parse:sn,astFormat:"graphql",hasPragma:Me,hasIgnorePragma:Ve,locStart:J,locEnd:q};var an={graphql:Ye};return dt(cn);});
|