@drzl/validation-core 3.0.0 → 3.2.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.
@@ -1,1260 +0,0 @@
1
- import {
2
- __publicField
3
- } from "./chunk-MKBO26DX.js";
4
-
5
- // ../../node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/graphql.mjs
6
- var Et = Object.defineProperty;
7
- var xe = (e2, t) => {
8
- for (var n in t) Et(e2, n, { get: t[n], enumerable: true });
9
- };
10
- var Ne = {};
11
- xe(Ne, { languages: () => Qe, options: () => Ke, parsers: () => _e, printers: () => pn });
12
- var Tt = (e2, t, n, i) => {
13
- if (!(e2 && t == null)) return t.replaceAll ? t.replaceAll(n, i) : n.global ? t.replace(n, i) : t.split(n).join(i);
14
- };
15
- var G = Tt;
16
- var j = "indent";
17
- var $ = "group";
18
- var w = "if-break";
19
- var S = "line";
20
- var X = "break-parent";
21
- var Re = () => {
22
- };
23
- var L = Re;
24
- var le = Re;
25
- function N(e2) {
26
- return L(e2), { type: j, contents: e2 };
27
- }
28
- function y(e2, t = {}) {
29
- return L(e2), le(t.expandedStates, true), { type: $, id: t.id, contents: e2, break: !!t.shouldBreak, expandedStates: t.expandedStates };
30
- }
31
- function I(e2, t = "", n = {}) {
32
- return L(e2), t !== "" && L(t), { type: w, breakContents: e2, flatContents: t, groupId: n.groupId };
33
- }
34
- var yt = { type: X };
35
- var Ot = { type: S, hard: true };
36
- var k = { type: S };
37
- var p = { type: S, soft: true };
38
- var f = [Ot, yt];
39
- function E(e2, t) {
40
- L(e2), le(t);
41
- let n = [];
42
- for (let i = 0; i < t.length; i++) i !== 0 && n.push(e2), n.push(t[i]);
43
- return n;
44
- }
45
- function H(e2) {
46
- return (t, n, i) => {
47
- let r = !!(i != null && i.backwards);
48
- if (n === false) return false;
49
- let { length: s } = t, a = n;
50
- for (; a >= 0 && a < s; ) {
51
- let u = t.charAt(a);
52
- if (e2 instanceof RegExp) {
53
- if (!e2.test(u)) return a;
54
- } else if (!e2.includes(u)) return a;
55
- r ? a-- : a++;
56
- }
57
- return a === -1 || a === s ? a : false;
58
- };
59
- }
60
- var Qn = H(/\s/u);
61
- var J = H(" ");
62
- var ve = H(",; ");
63
- var Le = H(/[^\n\r]/u);
64
- function It(e2, t, n) {
65
- let i = !!(n != null && n.backwards);
66
- if (t === false) return false;
67
- let r = e2.charAt(t);
68
- if (i) {
69
- if (e2.charAt(t - 1) === "\r" && r === `
70
- `) return t - 2;
71
- if (r === `
72
- ` || r === "\r" || r === "\u2028" || r === "\u2029") return t - 1;
73
- } else {
74
- if (r === "\r" && e2.charAt(t + 1) === `
75
- `) return t + 2;
76
- if (r === `
77
- ` || r === "\r" || r === "\u2028" || r === "\u2029") return t + 1;
78
- }
79
- return t;
80
- }
81
- var q = It;
82
- function At(e2, t, n = {}) {
83
- let i = J(e2, n.backwards ? t - 1 : t, n), r = q(e2, i, n);
84
- return i !== r;
85
- }
86
- var be = At;
87
- function Dt(e2, t) {
88
- if (t === false) return false;
89
- if (e2.charAt(t) === "/" && e2.charAt(t + 1) === "*") {
90
- for (let n = t + 2; n < e2.length; ++n) if (e2.charAt(n) === "*" && e2.charAt(n + 1) === "/") return n + 2;
91
- }
92
- return t;
93
- }
94
- var Pe = Dt;
95
- function gt(e2, t) {
96
- return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ? Le(e2, t) : t;
97
- }
98
- var we = gt;
99
- function kt(e2, t) {
100
- let n = null, i = t;
101
- for (; i !== n; ) n = i, i = ve(e2, i), i = Pe(e2, i), i = J(e2, i);
102
- return i = we(e2, i), i = q(e2, i), i !== false && be(e2, i);
103
- }
104
- var Fe = kt;
105
- function St(e2) {
106
- return Array.isArray(e2) && e2.length > 0;
107
- }
108
- var pe = St;
109
- var fe = class extends Error {
110
- constructor(t, n, i = "type") {
111
- super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`);
112
- __publicField(this, "name", "UnexpectedNodeError");
113
- this.node = t;
114
- }
115
- };
116
- var Be = fe;
117
- var F = null;
118
- function B(e2) {
119
- if (F !== null && typeof F.property) {
120
- let t = F;
121
- return F = B.prototype = null, t;
122
- }
123
- return F = B.prototype = e2 ?? /* @__PURE__ */ Object.create(null), new B();
124
- }
125
- var Ct = 10;
126
- for (let e2 = 0; e2 <= Ct; e2++) B();
127
- function he(e2) {
128
- return B(e2);
129
- }
130
- function Rt(e2, t = "type") {
131
- he(e2);
132
- function n(i) {
133
- let r = i[t], s = e2[r];
134
- if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${r}'.`), { node: i });
135
- return s;
136
- }
137
- return n;
138
- }
139
- var Ue = Rt;
140
- var Q = class {
141
- constructor(t, n, i) {
142
- this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
143
- }
144
- get [Symbol.toStringTag]() {
145
- return "Location";
146
- }
147
- toJSON() {
148
- return { start: this.start, end: this.end };
149
- }
150
- };
151
- var U = class {
152
- constructor(t, n, i, r, s, a) {
153
- this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = a, this.prev = null, this.next = null;
154
- }
155
- get [Symbol.toStringTag]() {
156
- return "Token";
157
- }
158
- toJSON() {
159
- return { kind: this.kind, value: this.value, line: this.line, column: this.column };
160
- }
161
- };
162
- var W = { Name: [], Document: ["definitions"], OperationDefinition: ["name", "variableDefinitions", "directives", "selectionSet"], VariableDefinition: ["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: ["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"] };
163
- var mr = new Set(Object.keys(W));
164
- var C;
165
- (function(e2) {
166
- e2.QUERY = "query", e2.MUTATION = "mutation", e2.SUBSCRIPTION = "subscription";
167
- })(C || (C = {}));
168
- var vt = Ue(W, "kind");
169
- var Me = vt;
170
- function K(e2) {
171
- return e2.loc.start;
172
- }
173
- function z(e2) {
174
- return e2.loc.end;
175
- }
176
- var Ve = "format";
177
- var Ye = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u;
178
- var Ge = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;
179
- function je(e2) {
180
- return Ge.test(e2);
181
- }
182
- function $e(e2) {
183
- return Ye.test(e2);
184
- }
185
- function Xe(e2) {
186
- return `# @${Ve}
187
-
188
- ${e2}`;
189
- }
190
- function Lt(e2, t, n) {
191
- let { node: i } = e2;
192
- if (!i.description) return "";
193
- let r = [n("description")];
194
- return i.kind === "InputValueDefinition" && !i.description.block ? r.push(k) : r.push(f), r;
195
- }
196
- var D = Lt;
197
- function bt(e2, t, n) {
198
- let { node: i } = e2;
199
- switch (i.kind) {
200
- case "Document":
201
- return [...E(f, g(e2, t, n, "definitions")), f];
202
- case "OperationDefinition": {
203
- let r = t.originalText[K(i)] !== "{", s = !!i.name;
204
- return [r ? i.operation : "", r && s ? [" ", n("name")] : "", r && !s && pe(i.variableDefinitions) ? " " : "", He(e2, n), x(e2, n, i), !r && !s ? "" : " ", n("selectionSet")];
205
- }
206
- case "FragmentDefinition":
207
- return ["fragment ", n("name"), He(e2, n), " on ", n("typeCondition"), x(e2, n, i), " ", n("selectionSet")];
208
- case "SelectionSet":
209
- return ["{", N([f, E(f, g(e2, t, n, "selections"))]), f, "}"];
210
- case "Field":
211
- return y([i.alias ? [n("alias"), ": "] : "", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", x(e2, n, i), i.selectionSet ? " " : "", n("selectionSet")]);
212
- case "Name":
213
- return i.value;
214
- case "StringValue":
215
- if (i.block) {
216
- let r = G(false, i.value, '"""', String.raw`\"""`).split(`
217
- `);
218
- return r.length === 1 && (r[0] = r[0].trim()), r.every((s) => s === "") && (r.length = 0), E(f, ['"""', ...r, '"""']);
219
- }
220
- return ['"', G(false, G(false, i.value, /["\\]/gu, String.raw`\$&`), `
221
- `, String.raw`\n`), '"'];
222
- case "IntValue":
223
- case "FloatValue":
224
- case "EnumValue":
225
- return i.value;
226
- case "BooleanValue":
227
- return i.value ? "true" : "false";
228
- case "NullValue":
229
- return "null";
230
- case "Variable":
231
- return ["$", n("name")];
232
- case "ListValue":
233
- return y(["[", N([p, E([I("", ", "), p], e2.map(n, "values"))]), p, "]"]);
234
- case "ObjectValue": {
235
- let r = t.bracketSpacing && i.fields.length > 0 ? " " : "";
236
- return y(["{", r, N([p, E([I("", ", "), p], e2.map(n, "fields"))]), p, I("", r), "}"]);
237
- }
238
- case "ObjectField":
239
- case "Argument":
240
- return [n("name"), ": ", n("value")];
241
- case "Directive":
242
- return ["@", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : ""];
243
- case "NamedType":
244
- return n("name");
245
- case "VariableDefinition":
246
- return [n("variable"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", x(e2, n, i)];
247
- case "ObjectTypeExtension":
248
- case "ObjectTypeDefinition":
249
- case "InputObjectTypeExtension":
250
- case "InputObjectTypeDefinition":
251
- case "InterfaceTypeExtension":
252
- case "InterfaceTypeDefinition": {
253
- let { kind: r } = i, s = [];
254
- return r.endsWith("TypeDefinition") ? s.push(D(e2, 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 ", ...Ft(e2, t, n)), s.push(x(e2, n, i)), i.fields.length > 0 && s.push([" {", N([f, E(f, g(e2, t, n, "fields"))]), f, "}"]), s;
255
- }
256
- case "FieldDefinition":
257
- return [D(e2, t, n), n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", ": ", n("type"), x(e2, n, i)];
258
- case "DirectiveDefinition":
259
- return [D(e2, t, n), "directive ", "@", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", i.repeatable ? " repeatable" : "", " on ", ...E(" | ", e2.map(n, "locations"))];
260
- case "EnumTypeExtension":
261
- case "EnumTypeDefinition":
262
- return [D(e2, t, n), i.kind === "EnumTypeExtension" ? "extend " : "", "enum ", n("name"), x(e2, n, i), i.values.length > 0 ? [" {", N([f, E(f, g(e2, t, n, "values"))]), f, "}"] : ""];
263
- case "EnumValueDefinition":
264
- return [D(e2, t, n), n("name"), x(e2, n, i)];
265
- case "InputValueDefinition":
266
- return [D(e2, t, n), n("name"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", x(e2, n, i)];
267
- case "SchemaExtension":
268
- return ["extend schema", x(e2, n, i), ...i.operationTypes.length > 0 ? [" {", N([f, E(f, g(e2, t, n, "operationTypes"))]), f, "}"] : []];
269
- case "SchemaDefinition":
270
- return [D(e2, t, n), "schema", x(e2, n, i), " {", i.operationTypes.length > 0 ? N([f, E(f, g(e2, t, n, "operationTypes"))]) : "", f, "}"];
271
- case "OperationTypeDefinition":
272
- return [i.operation, ": ", n("type")];
273
- case "FragmentSpread":
274
- return ["...", n("name"), x(e2, n, i)];
275
- case "InlineFragment":
276
- return ["...", i.typeCondition ? [" on ", n("typeCondition")] : "", x(e2, n, i), " ", n("selectionSet")];
277
- case "UnionTypeExtension":
278
- case "UnionTypeDefinition":
279
- return y([D(e2, t, n), y([i.kind === "UnionTypeExtension" ? "extend " : "", "union ", n("name"), x(e2, n, i), i.types.length > 0 ? [" =", I("", " "), N([I([k, "| "]), E([k, "| "], e2.map(n, "types"))])] : ""])]);
280
- case "ScalarTypeExtension":
281
- case "ScalarTypeDefinition":
282
- return [D(e2, t, n), i.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", n("name"), x(e2, n, i)];
283
- case "NonNullType":
284
- return [n("type"), "!"];
285
- case "ListType":
286
- return ["[", n("type"), "]"];
287
- default:
288
- throw new Be(i, "Graphql", "kind");
289
- }
290
- }
291
- function x(e2, t, n) {
292
- if (n.directives.length === 0) return "";
293
- let i = E(k, e2.map(t, "directives"));
294
- return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(N([p, i]))];
295
- }
296
- function g(e2, t, n, i) {
297
- return e2.map(({ isLast: r, node: s }) => {
298
- let a = n();
299
- return !r && Fe(t.originalText, z(s)) ? [a, f] : a;
300
- }, i);
301
- }
302
- function Pt(e2) {
303
- return e2.kind !== "Comment";
304
- }
305
- function wt(e2) {
306
- let t = e2.node;
307
- if (t.kind === "Comment") return "#" + t.value.trimEnd();
308
- throw new Error("Not a comment: " + JSON.stringify(t));
309
- }
310
- function Ft(e2, t, n) {
311
- let { node: i } = e2, r = [], { interfaces: s } = i, a = e2.map(n, "interfaces");
312
- for (let u = 0; u < s.length; u++) {
313
- let l = s[u];
314
- r.push(a[u]);
315
- let T = s[u + 1];
316
- if (T) {
317
- let A = t.originalText.slice(l.loc.end, T.loc.start).includes("#");
318
- r.push(" &", A ? k : " ");
319
- }
320
- }
321
- return r;
322
- }
323
- function He(e2, t) {
324
- let { node: n } = e2;
325
- return pe(n.variableDefinitions) ? y(["(", N([p, E([I("", ", "), p], e2.map(t, "variableDefinitions"))]), p, ")"]) : "";
326
- }
327
- function Je(e2, t) {
328
- e2.kind === "StringValue" && e2.block && !e2.value.includes(`
329
- `) && (t.value = e2.value.trim());
330
- }
331
- Je.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
332
- function Bt(e2) {
333
- var n;
334
- let { node: t } = e2;
335
- return (n = t == null ? void 0 : t.comments) == null ? void 0 : n.some((i) => i.value.trim() === "prettier-ignore");
336
- }
337
- var Ut = { print: bt, massageAstNode: Je, hasPrettierIgnore: Bt, insertPragma: Xe, printComment: wt, canAttachComment: Pt, getVisitorKeys: Me };
338
- var qe = Ut;
339
- var Qe = [{ name: "GraphQL", type: "data", extensions: [".graphql", ".gql", ".graphqls"], tmScope: "source.graphql", aceMode: "text", parsers: ["graphql"], vscodeLanguageIds: ["graphql"], linguistLanguageId: 139 }];
340
- var We = { bracketSpacing: { category: "Common", type: "boolean", default: true, 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: false, 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: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
341
- var Mt = { bracketSpacing: We.bracketSpacing };
342
- var Ke = Mt;
343
- var _e = {};
344
- xe(_e, { graphql: () => ln });
345
- function ze(e2) {
346
- return typeof e2 == "object" && e2 !== null;
347
- }
348
- function Ze(e2, t) {
349
- if (!!!e2) throw new Error(t ?? "Unexpected invariant triggered.");
350
- }
351
- var Vt = /\r\n|[\n\r]/g;
352
- function M(e2, t) {
353
- let n = 0, i = 1;
354
- for (let r of e2.body.matchAll(Vt)) {
355
- if (typeof r.index == "number" || Ze(false), r.index >= t) break;
356
- n = r.index + r[0].length, i += 1;
357
- }
358
- return { line: i, column: t + 1 - n };
359
- }
360
- function tt(e2) {
361
- return de(e2.source, M(e2.source, e2.start));
362
- }
363
- function de(e2, t) {
364
- let n = e2.locationOffset.column - 1, i = "".padStart(n) + e2.body, r = t.line - 1, s = e2.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, l = t.column + u, T = `${e2.name}:${a}:${l}
365
- `, h = i.split(/\r\n|[\n\r]/g), A = h[r];
366
- if (A.length > 120) {
367
- let O = Math.floor(l / 80), ae = l % 80, _ = [];
368
- for (let v = 0; v < A.length; v += 80) _.push(A.slice(v, v + 80));
369
- return T + et([[`${a} |`, _[0]], ..._.slice(1, O + 1).map((v) => ["|", v]), ["|", "^".padStart(ae)], ["|", _[O + 1]]]);
370
- }
371
- return T + et([[`${a - 1} |`, h[r - 1]], [`${a} |`, A], ["|", "^".padStart(l)], [`${a + 1} |`, h[r + 1]]]);
372
- }
373
- function et(e2) {
374
- let t = e2.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
375
- return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
376
- `);
377
- }
378
- function Yt(e2) {
379
- let t = e2[0];
380
- return t == null || "kind" in t || "length" in t ? { nodes: t, source: e2[1], positions: e2[2], path: e2[3], originalError: e2[4], extensions: e2[5] } : t;
381
- }
382
- var Z = class e extends Error {
383
- constructor(t, ...n) {
384
- var i, r, s;
385
- let { nodes: a, source: u, positions: l, path: T, originalError: h, extensions: A } = Yt(n);
386
- super(t), this.name = "GraphQLError", this.path = T ?? void 0, this.originalError = h ?? void 0, this.nodes = nt(Array.isArray(a) ? a : a ? [a] : void 0);
387
- let O = nt((i = this.nodes) === null || i === void 0 ? void 0 : i.map((_) => _.loc).filter((_) => _ != null));
388
- this.source = u ?? (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source), this.positions = l ?? (O == null ? void 0 : O.map((_) => _.start)), this.locations = l && u ? l.map((_) => M(u, _)) : O == null ? void 0 : O.map((_) => M(_.source, _.start));
389
- let ae = ze(h == null ? void 0 : h.extensions) ? h == null ? void 0 : h.extensions : void 0;
390
- this.extensions = (s = A ?? ae) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: true, enumerable: true }, name: { enumerable: false }, nodes: { enumerable: false }, source: { enumerable: false }, positions: { enumerable: false }, originalError: { enumerable: false } }), h != null && h.stack ? Object.defineProperty(this, "stack", { value: h.stack, writable: true, configurable: true }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true });
391
- }
392
- get [Symbol.toStringTag]() {
393
- return "GraphQLError";
394
- }
395
- toString() {
396
- let t = this.message;
397
- if (this.nodes) for (let n of this.nodes) n.loc && (t += `
398
-
399
- ` + tt(n.loc));
400
- else if (this.source && this.locations) for (let n of this.locations) t += `
401
-
402
- ` + de(this.source, n);
403
- return t;
404
- }
405
- toJSON() {
406
- let t = { message: this.message };
407
- 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;
408
- }
409
- };
410
- function nt(e2) {
411
- return e2 === void 0 || e2.length === 0 ? void 0 : e2;
412
- }
413
- function d(e2, t, n) {
414
- return new Z(`Syntax Error: ${n}`, { source: e2, positions: [t] });
415
- }
416
- var ee;
417
- (function(e2) {
418
- e2.QUERY = "QUERY", e2.MUTATION = "MUTATION", e2.SUBSCRIPTION = "SUBSCRIPTION", e2.FIELD = "FIELD", e2.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e2.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e2.INLINE_FRAGMENT = "INLINE_FRAGMENT", e2.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e2.SCHEMA = "SCHEMA", e2.SCALAR = "SCALAR", e2.OBJECT = "OBJECT", e2.FIELD_DEFINITION = "FIELD_DEFINITION", e2.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e2.INTERFACE = "INTERFACE", e2.UNION = "UNION", e2.ENUM = "ENUM", e2.ENUM_VALUE = "ENUM_VALUE", e2.INPUT_OBJECT = "INPUT_OBJECT", e2.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
419
- })(ee || (ee = {}));
420
- var c;
421
- (function(e2) {
422
- e2.NAME = "Name", e2.DOCUMENT = "Document", e2.OPERATION_DEFINITION = "OperationDefinition", e2.VARIABLE_DEFINITION = "VariableDefinition", e2.SELECTION_SET = "SelectionSet", e2.FIELD = "Field", e2.ARGUMENT = "Argument", e2.FRAGMENT_SPREAD = "FragmentSpread", e2.INLINE_FRAGMENT = "InlineFragment", e2.FRAGMENT_DEFINITION = "FragmentDefinition", e2.VARIABLE = "Variable", e2.INT = "IntValue", e2.FLOAT = "FloatValue", e2.STRING = "StringValue", e2.BOOLEAN = "BooleanValue", e2.NULL = "NullValue", e2.ENUM = "EnumValue", e2.LIST = "ListValue", e2.OBJECT = "ObjectValue", e2.OBJECT_FIELD = "ObjectField", e2.DIRECTIVE = "Directive", e2.NAMED_TYPE = "NamedType", e2.LIST_TYPE = "ListType", e2.NON_NULL_TYPE = "NonNullType", e2.SCHEMA_DEFINITION = "SchemaDefinition", e2.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e2.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e2.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e2.FIELD_DEFINITION = "FieldDefinition", e2.INPUT_VALUE_DEFINITION = "InputValueDefinition", e2.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e2.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e2.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e2.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e2.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e2.DIRECTIVE_DEFINITION = "DirectiveDefinition", e2.SCHEMA_EXTENSION = "SchemaExtension", e2.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e2.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e2.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e2.UNION_TYPE_EXTENSION = "UnionTypeExtension", e2.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e2.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
423
- })(c || (c = {}));
424
- function rt(e2) {
425
- return e2 === 9 || e2 === 32;
426
- }
427
- function b(e2) {
428
- return e2 >= 48 && e2 <= 57;
429
- }
430
- function it(e2) {
431
- return e2 >= 97 && e2 <= 122 || e2 >= 65 && e2 <= 90;
432
- }
433
- function me(e2) {
434
- return it(e2) || e2 === 95;
435
- }
436
- function st(e2) {
437
- return it(e2) || b(e2) || e2 === 95;
438
- }
439
- function ot(e2) {
440
- var t;
441
- let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
442
- for (let a = 0; a < e2.length; ++a) {
443
- var s;
444
- let u = e2[a], l = Gt(u);
445
- l !== u.length && (i = (s = i) !== null && s !== void 0 ? s : a, r = a, a !== 0 && l < n && (n = l));
446
- }
447
- return e2.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = i) !== null && t !== void 0 ? t : 0, r + 1);
448
- }
449
- function Gt(e2) {
450
- let t = 0;
451
- for (; t < e2.length && rt(e2.charCodeAt(t)); ) ++t;
452
- return t;
453
- }
454
- var o;
455
- (function(e2) {
456
- e2.SOF = "<SOF>", e2.EOF = "<EOF>", e2.BANG = "!", e2.DOLLAR = "$", e2.AMP = "&", e2.PAREN_L = "(", e2.PAREN_R = ")", e2.SPREAD = "...", e2.COLON = ":", e2.EQUALS = "=", e2.AT = "@", e2.BRACKET_L = "[", e2.BRACKET_R = "]", e2.BRACE_L = "{", e2.PIPE = "|", e2.BRACE_R = "}", e2.NAME = "Name", e2.INT = "Int", e2.FLOAT = "Float", e2.STRING = "String", e2.BLOCK_STRING = "BlockString", e2.COMMENT = "Comment";
457
- })(o || (o = {}));
458
- var te = class {
459
- constructor(t) {
460
- let n = new U(o.SOF, 0, 0, 0, 0);
461
- this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
462
- }
463
- get [Symbol.toStringTag]() {
464
- return "Lexer";
465
- }
466
- advance() {
467
- return this.lastToken = this.token, this.token = this.lookahead();
468
- }
469
- lookahead() {
470
- let t = this.token;
471
- if (t.kind !== o.EOF) do
472
- if (t.next) t = t.next;
473
- else {
474
- let n = jt(this, t.end);
475
- t.next = n, n.prev = t, t = n;
476
- }
477
- while (t.kind === o.COMMENT);
478
- return t;
479
- }
480
- };
481
- function ct(e2) {
482
- return e2 === o.BANG || e2 === o.DOLLAR || e2 === o.AMP || e2 === o.PAREN_L || e2 === o.PAREN_R || e2 === o.SPREAD || e2 === o.COLON || e2 === o.EQUALS || e2 === o.AT || e2 === o.BRACKET_L || e2 === o.BRACKET_R || e2 === o.BRACE_L || e2 === o.PIPE || e2 === o.BRACE_R;
483
- }
484
- function P(e2) {
485
- return e2 >= 0 && e2 <= 55295 || e2 >= 57344 && e2 <= 1114111;
486
- }
487
- function ne(e2, t) {
488
- return ut(e2.charCodeAt(t)) && lt(e2.charCodeAt(t + 1));
489
- }
490
- function ut(e2) {
491
- return e2 >= 55296 && e2 <= 56319;
492
- }
493
- function lt(e2) {
494
- return e2 >= 56320 && e2 <= 57343;
495
- }
496
- function R(e2, t) {
497
- let n = e2.source.body.codePointAt(t);
498
- if (n === void 0) return o.EOF;
499
- if (n >= 32 && n <= 126) {
500
- let i = String.fromCodePoint(n);
501
- return i === '"' ? `'"'` : `"${i}"`;
502
- }
503
- return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
504
- }
505
- function m(e2, t, n, i, r) {
506
- let s = e2.line, a = 1 + n - e2.lineStart;
507
- return new U(t, n, i, s, a, r);
508
- }
509
- function jt(e2, t) {
510
- let n = e2.source.body, i = n.length, r = t;
511
- for (; r < i; ) {
512
- let s = n.charCodeAt(r);
513
- switch (s) {
514
- case 65279:
515
- case 9:
516
- case 32:
517
- case 44:
518
- ++r;
519
- continue;
520
- case 10:
521
- ++r, ++e2.line, e2.lineStart = r;
522
- continue;
523
- case 13:
524
- n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e2.line, e2.lineStart = r;
525
- continue;
526
- case 35:
527
- return $t(e2, r);
528
- case 33:
529
- return m(e2, o.BANG, r, r + 1);
530
- case 36:
531
- return m(e2, o.DOLLAR, r, r + 1);
532
- case 38:
533
- return m(e2, o.AMP, r, r + 1);
534
- case 40:
535
- return m(e2, o.PAREN_L, r, r + 1);
536
- case 41:
537
- return m(e2, o.PAREN_R, r, r + 1);
538
- case 46:
539
- if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46) return m(e2, o.SPREAD, r, r + 3);
540
- break;
541
- case 58:
542
- return m(e2, o.COLON, r, r + 1);
543
- case 61:
544
- return m(e2, o.EQUALS, r, r + 1);
545
- case 64:
546
- return m(e2, o.AT, r, r + 1);
547
- case 91:
548
- return m(e2, o.BRACKET_L, r, r + 1);
549
- case 93:
550
- return m(e2, o.BRACKET_R, r, r + 1);
551
- case 123:
552
- return m(e2, o.BRACE_L, r, r + 1);
553
- case 124:
554
- return m(e2, o.PIPE, r, r + 1);
555
- case 125:
556
- return m(e2, o.BRACE_R, r, r + 1);
557
- case 34:
558
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Wt(e2, r) : Ht(e2, r);
559
- }
560
- if (b(s) || s === 45) return Xt(e2, r, s);
561
- if (me(s)) return Kt(e2, r);
562
- throw d(e2.source, r, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || ne(n, r) ? `Unexpected character: ${R(e2, r)}.` : `Invalid character: ${R(e2, r)}.`);
563
- }
564
- return m(e2, o.EOF, i, i);
565
- }
566
- function $t(e2, t) {
567
- let n = e2.source.body, i = n.length, r = t + 1;
568
- for (; r < i; ) {
569
- let s = n.charCodeAt(r);
570
- if (s === 10 || s === 13) break;
571
- if (P(s)) ++r;
572
- else if (ne(n, r)) r += 2;
573
- else break;
574
- }
575
- return m(e2, o.COMMENT, t, r, n.slice(t + 1, r));
576
- }
577
- function Xt(e2, t, n) {
578
- let i = e2.source.body, r = t, s = n, a = false;
579
- if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
580
- if (s = i.charCodeAt(++r), b(s)) throw d(e2.source, r, `Invalid number, unexpected digit after 0: ${R(e2, r)}.`);
581
- } else r = Ee(e2, r, s), s = i.charCodeAt(r);
582
- if (s === 46 && (a = true, s = i.charCodeAt(++r), r = Ee(e2, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (a = true, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = Ee(e2, r, s), s = i.charCodeAt(r)), s === 46 || me(s)) throw d(e2.source, r, `Invalid number, expected digit but got: ${R(e2, r)}.`);
583
- return m(e2, a ? o.FLOAT : o.INT, t, r, i.slice(t, r));
584
- }
585
- function Ee(e2, t, n) {
586
- if (!b(n)) throw d(e2.source, t, `Invalid number, expected digit but got: ${R(e2, t)}.`);
587
- let i = e2.source.body, r = t + 1;
588
- for (; b(i.charCodeAt(r)); ) ++r;
589
- return r;
590
- }
591
- function Ht(e2, t) {
592
- let n = e2.source.body, i = n.length, r = t + 1, s = r, a = "";
593
- for (; r < i; ) {
594
- let u = n.charCodeAt(r);
595
- if (u === 34) return a += n.slice(s, r), m(e2, o.STRING, t, r + 1, a);
596
- if (u === 92) {
597
- a += n.slice(s, r);
598
- let l = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Jt(e2, r) : qt(e2, r) : Qt(e2, r);
599
- a += l.value, r += l.size, s = r;
600
- continue;
601
- }
602
- if (u === 10 || u === 13) break;
603
- if (P(u)) ++r;
604
- else if (ne(n, r)) r += 2;
605
- else throw d(e2.source, r, `Invalid character within String: ${R(e2, r)}.`);
606
- }
607
- throw d(e2.source, r, "Unterminated string.");
608
- }
609
- function Jt(e2, t) {
610
- let n = e2.source.body, i = 0, r = 3;
611
- for (; r < 12; ) {
612
- let s = n.charCodeAt(t + r++);
613
- if (s === 125) {
614
- if (r < 5 || !P(i)) break;
615
- return { value: String.fromCodePoint(i), size: r };
616
- }
617
- if (i = i << 4 | V(s), i < 0) break;
618
- }
619
- throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + r)}".`);
620
- }
621
- function qt(e2, t) {
622
- let n = e2.source.body, i = at(n, t + 2);
623
- if (P(i)) return { value: String.fromCodePoint(i), size: 6 };
624
- if (ut(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
625
- let r = at(n, t + 8);
626
- if (lt(r)) return { value: String.fromCodePoint(i, r), size: 12 };
627
- }
628
- throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
629
- }
630
- function at(e2, t) {
631
- return V(e2.charCodeAt(t)) << 12 | V(e2.charCodeAt(t + 1)) << 8 | V(e2.charCodeAt(t + 2)) << 4 | V(e2.charCodeAt(t + 3));
632
- }
633
- function V(e2) {
634
- return e2 >= 48 && e2 <= 57 ? e2 - 48 : e2 >= 65 && e2 <= 70 ? e2 - 55 : e2 >= 97 && e2 <= 102 ? e2 - 87 : -1;
635
- }
636
- function Qt(e2, t) {
637
- let n = e2.source.body;
638
- switch (n.charCodeAt(t + 1)) {
639
- case 34:
640
- return { value: '"', size: 2 };
641
- case 92:
642
- return { value: "\\", size: 2 };
643
- case 47:
644
- return { value: "/", size: 2 };
645
- case 98:
646
- return { value: "\b", size: 2 };
647
- case 102:
648
- return { value: "\f", size: 2 };
649
- case 110:
650
- return { value: `
651
- `, size: 2 };
652
- case 114:
653
- return { value: "\r", size: 2 };
654
- case 116:
655
- return { value: " ", size: 2 };
656
- }
657
- throw d(e2.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
658
- }
659
- function Wt(e2, t) {
660
- let n = e2.source.body, i = n.length, r = e2.lineStart, s = t + 3, a = s, u = "", l = [];
661
- for (; s < i; ) {
662
- let T = n.charCodeAt(s);
663
- if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
664
- u += n.slice(a, s), l.push(u);
665
- let h = m(e2, o.BLOCK_STRING, t, s + 3, ot(l).join(`
666
- `));
667
- return e2.line += l.length - 1, e2.lineStart = r, h;
668
- }
669
- if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
670
- u += n.slice(a, s), a = s + 1, s += 4;
671
- continue;
672
- }
673
- if (T === 10 || T === 13) {
674
- u += n.slice(a, s), l.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, r = s;
675
- continue;
676
- }
677
- if (P(T)) ++s;
678
- else if (ne(n, s)) s += 2;
679
- else throw d(e2.source, s, `Invalid character within String: ${R(e2, s)}.`);
680
- }
681
- throw d(e2.source, s, "Unterminated string.");
682
- }
683
- function Kt(e2, t) {
684
- let n = e2.source.body, i = n.length, r = t + 1;
685
- for (; r < i; ) {
686
- let s = n.charCodeAt(r);
687
- if (st(s)) ++r;
688
- else break;
689
- }
690
- return m(e2, o.NAME, t, r, n.slice(t, r));
691
- }
692
- function re(e2, t) {
693
- if (!!!e2) throw new Error(t);
694
- }
695
- function ie(e2) {
696
- return se(e2, []);
697
- }
698
- function se(e2, t) {
699
- switch (typeof e2) {
700
- case "string":
701
- return JSON.stringify(e2);
702
- case "function":
703
- return e2.name ? `[function ${e2.name}]` : "[function]";
704
- case "object":
705
- return zt(e2, t);
706
- default:
707
- return String(e2);
708
- }
709
- }
710
- function zt(e2, t) {
711
- if (e2 === null) return "null";
712
- if (t.includes(e2)) return "[Circular]";
713
- let n = [...t, e2];
714
- if (Zt(e2)) {
715
- let i = e2.toJSON();
716
- if (i !== e2) return typeof i == "string" ? i : se(i, n);
717
- } else if (Array.isArray(e2)) return tn(e2, n);
718
- return en(e2, n);
719
- }
720
- function Zt(e2) {
721
- return typeof e2.toJSON == "function";
722
- }
723
- function en(e2, t) {
724
- let n = Object.entries(e2);
725
- return n.length === 0 ? "{}" : t.length > 2 ? "[" + nn(e2) + "]" : "{ " + n.map(([r, s]) => r + ": " + se(s, t)).join(", ") + " }";
726
- }
727
- function tn(e2, t) {
728
- if (e2.length === 0) return "[]";
729
- if (t.length > 2) return "[Array]";
730
- let n = Math.min(10, e2.length), i = e2.length - n, r = [];
731
- for (let s = 0; s < n; ++s) r.push(se(e2[s], t));
732
- return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
733
- }
734
- function nn(e2) {
735
- let t = Object.prototype.toString.call(e2).replace(/^\[object /, "").replace(/]$/, "");
736
- if (t === "Object" && typeof e2.constructor == "function") {
737
- let n = e2.constructor.name;
738
- if (typeof n == "string" && n !== "") return n;
739
- }
740
- return t;
741
- }
742
- var rn = globalThis.process && true;
743
- var pt = rn ? function(t, n) {
744
- return t instanceof n;
745
- } : function(t, n) {
746
- if (t instanceof n) return true;
747
- if (typeof t == "object" && t !== null) {
748
- var i;
749
- 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;
750
- if (r === s) {
751
- let a = ie(t);
752
- throw new Error(`Cannot use ${r} "${a}" from another module or realm.
753
-
754
- Ensure that there is only one instance of "graphql" in the node_modules
755
- directory. If different versions of "graphql" are the dependencies of other
756
- relied on modules, use "resolutions" to ensure only one version is installed.
757
-
758
- https://yarnpkg.com/en/docs/selective-version-resolutions
759
-
760
- Duplicate "graphql" modules cannot be used at the same time since different
761
- versions may have different capabilities and behavior. The data from one
762
- version used in the function from another could produce confusing and
763
- spurious results.`);
764
- }
765
- }
766
- return false;
767
- };
768
- var Y = class {
769
- constructor(t, n = "GraphQL request", i = { line: 1, column: 1 }) {
770
- typeof t == "string" || re(false, `Body must be a string. Received: ${ie(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || re(false, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || re(false, "column in locationOffset is 1-indexed and must be positive.");
771
- }
772
- get [Symbol.toStringTag]() {
773
- return "Source";
774
- }
775
- };
776
- function ft(e2) {
777
- return pt(e2, Y);
778
- }
779
- function ht(e2, t) {
780
- let n = new Te(e2, t), i = n.parseDocument();
781
- return Object.defineProperty(i, "tokenCount", { enumerable: false, value: n.tokenCount }), i;
782
- }
783
- var Te = class {
784
- constructor(t, n = {}) {
785
- let i = ft(t) ? t : new Y(t);
786
- this._lexer = new te(i), this._options = n, this._tokenCounter = 0;
787
- }
788
- get tokenCount() {
789
- return this._tokenCounter;
790
- }
791
- parseName() {
792
- let t = this.expectToken(o.NAME);
793
- return this.node(t, { kind: c.NAME, value: t.value });
794
- }
795
- parseDocument() {
796
- return this.node(this._lexer.token, { kind: c.DOCUMENT, definitions: this.many(o.SOF, this.parseDefinition, o.EOF) });
797
- }
798
- parseDefinition() {
799
- if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
800
- let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
801
- if (n.kind === o.NAME) {
802
- switch (n.value) {
803
- case "schema":
804
- return this.parseSchemaDefinition();
805
- case "scalar":
806
- return this.parseScalarTypeDefinition();
807
- case "type":
808
- return this.parseObjectTypeDefinition();
809
- case "interface":
810
- return this.parseInterfaceTypeDefinition();
811
- case "union":
812
- return this.parseUnionTypeDefinition();
813
- case "enum":
814
- return this.parseEnumTypeDefinition();
815
- case "input":
816
- return this.parseInputObjectTypeDefinition();
817
- case "directive":
818
- return this.parseDirectiveDefinition();
819
- }
820
- if (t) throw d(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions.");
821
- switch (n.value) {
822
- case "query":
823
- case "mutation":
824
- case "subscription":
825
- return this.parseOperationDefinition();
826
- case "fragment":
827
- return this.parseFragmentDefinition();
828
- case "extend":
829
- return this.parseTypeSystemExtension();
830
- }
831
- }
832
- throw this.unexpected(n);
833
- }
834
- parseOperationDefinition() {
835
- let t = this._lexer.token;
836
- if (this.peek(o.BRACE_L)) return this.node(t, { kind: c.OPERATION_DEFINITION, operation: C.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() });
837
- let n = this.parseOperationType(), i;
838
- return this.peek(o.NAME) && (i = this.parseName()), this.node(t, { kind: c.OPERATION_DEFINITION, operation: n, name: i, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
839
- }
840
- parseOperationType() {
841
- let t = this.expectToken(o.NAME);
842
- switch (t.value) {
843
- case "query":
844
- return C.QUERY;
845
- case "mutation":
846
- return C.MUTATION;
847
- case "subscription":
848
- return C.SUBSCRIPTION;
849
- }
850
- throw this.unexpected(t);
851
- }
852
- parseVariableDefinitions() {
853
- return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
854
- }
855
- parseVariableDefinition() {
856
- return this.node(this._lexer.token, { kind: c.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(o.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() });
857
- }
858
- parseVariable() {
859
- let t = this._lexer.token;
860
- return this.expectToken(o.DOLLAR), this.node(t, { kind: c.VARIABLE, name: this.parseName() });
861
- }
862
- parseSelectionSet() {
863
- return this.node(this._lexer.token, { kind: c.SELECTION_SET, selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R) });
864
- }
865
- parseSelection() {
866
- return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
867
- }
868
- parseField() {
869
- let t = this._lexer.token, n = this.parseName(), i, r;
870
- 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(false), directives: this.parseDirectives(false), selectionSet: this.peek(o.BRACE_L) ? this.parseSelectionSet() : void 0 });
871
- }
872
- parseArguments(t) {
873
- let n = t ? this.parseConstArgument : this.parseArgument;
874
- return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
875
- }
876
- parseArgument(t = false) {
877
- let n = this._lexer.token, i = this.parseName();
878
- return this.expectToken(o.COLON), this.node(n, { kind: c.ARGUMENT, name: i, value: this.parseValueLiteral(t) });
879
- }
880
- parseConstArgument() {
881
- return this.parseArgument(true);
882
- }
883
- parseFragment() {
884
- let t = this._lexer.token;
885
- this.expectToken(o.SPREAD);
886
- let n = this.expectOptionalKeyword("on");
887
- return !n && this.peek(o.NAME) ? this.node(t, { kind: c.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false) }) : this.node(t, { kind: c.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
888
- }
889
- parseFragmentDefinition() {
890
- let t = this._lexer.token;
891
- return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === true ? this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() }) : this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
892
- }
893
- parseFragmentName() {
894
- if (this._lexer.token.value === "on") throw this.unexpected();
895
- return this.parseName();
896
- }
897
- parseValueLiteral(t) {
898
- let n = this._lexer.token;
899
- switch (n.kind) {
900
- case o.BRACKET_L:
901
- return this.parseList(t);
902
- case o.BRACE_L:
903
- return this.parseObject(t);
904
- case o.INT:
905
- return this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value });
906
- case o.FLOAT:
907
- return this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value });
908
- case o.STRING:
909
- case o.BLOCK_STRING:
910
- return this.parseStringLiteral();
911
- case o.NAME:
912
- switch (this.advanceLexer(), n.value) {
913
- case "true":
914
- return this.node(n, { kind: c.BOOLEAN, value: true });
915
- case "false":
916
- return this.node(n, { kind: c.BOOLEAN, value: false });
917
- case "null":
918
- return this.node(n, { kind: c.NULL });
919
- default:
920
- return this.node(n, { kind: c.ENUM, value: n.value });
921
- }
922
- case o.DOLLAR:
923
- if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
924
- let i = this._lexer.token.value;
925
- throw d(this._lexer.source, n.start, `Unexpected variable "$${i}" in constant value.`);
926
- } else throw this.unexpected(n);
927
- return this.parseVariable();
928
- default:
929
- throw this.unexpected();
930
- }
931
- }
932
- parseConstValueLiteral() {
933
- return this.parseValueLiteral(true);
934
- }
935
- parseStringLiteral() {
936
- let t = this._lexer.token;
937
- return this.advanceLexer(), this.node(t, { kind: c.STRING, value: t.value, block: t.kind === o.BLOCK_STRING });
938
- }
939
- parseList(t) {
940
- let n = () => this.parseValueLiteral(t);
941
- return this.node(this._lexer.token, { kind: c.LIST, values: this.any(o.BRACKET_L, n, o.BRACKET_R) });
942
- }
943
- parseObject(t) {
944
- let n = () => this.parseObjectField(t);
945
- return this.node(this._lexer.token, { kind: c.OBJECT, fields: this.any(o.BRACE_L, n, o.BRACE_R) });
946
- }
947
- parseObjectField(t) {
948
- let n = this._lexer.token, i = this.parseName();
949
- return this.expectToken(o.COLON), this.node(n, { kind: c.OBJECT_FIELD, name: i, value: this.parseValueLiteral(t) });
950
- }
951
- parseDirectives(t) {
952
- let n = [];
953
- for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
954
- return n;
955
- }
956
- parseConstDirectives() {
957
- return this.parseDirectives(true);
958
- }
959
- parseDirective(t) {
960
- let n = this._lexer.token;
961
- return this.expectToken(o.AT), this.node(n, { kind: c.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(t) });
962
- }
963
- parseTypeReference() {
964
- let t = this._lexer.token, n;
965
- if (this.expectOptionalToken(o.BRACKET_L)) {
966
- let i = this.parseTypeReference();
967
- this.expectToken(o.BRACKET_R), n = this.node(t, { kind: c.LIST_TYPE, type: i });
968
- } else n = this.parseNamedType();
969
- return this.expectOptionalToken(o.BANG) ? this.node(t, { kind: c.NON_NULL_TYPE, type: n }) : n;
970
- }
971
- parseNamedType() {
972
- return this.node(this._lexer.token, { kind: c.NAMED_TYPE, name: this.parseName() });
973
- }
974
- peekDescription() {
975
- return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
976
- }
977
- parseDescription() {
978
- if (this.peekDescription()) return this.parseStringLiteral();
979
- }
980
- parseSchemaDefinition() {
981
- let t = this._lexer.token, n = this.parseDescription();
982
- this.expectKeyword("schema");
983
- let i = this.parseConstDirectives(), r = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
984
- return this.node(t, { kind: c.SCHEMA_DEFINITION, description: n, directives: i, operationTypes: r });
985
- }
986
- parseOperationTypeDefinition() {
987
- let t = this._lexer.token, n = this.parseOperationType();
988
- this.expectToken(o.COLON);
989
- let i = this.parseNamedType();
990
- return this.node(t, { kind: c.OPERATION_TYPE_DEFINITION, operation: n, type: i });
991
- }
992
- parseScalarTypeDefinition() {
993
- let t = this._lexer.token, n = this.parseDescription();
994
- this.expectKeyword("scalar");
995
- let i = this.parseName(), r = this.parseConstDirectives();
996
- return this.node(t, { kind: c.SCALAR_TYPE_DEFINITION, description: n, name: i, directives: r });
997
- }
998
- parseObjectTypeDefinition() {
999
- let t = this._lexer.token, n = this.parseDescription();
1000
- this.expectKeyword("type");
1001
- let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1002
- return this.node(t, { kind: c.OBJECT_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
1003
- }
1004
- parseImplementsInterfaces() {
1005
- return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
1006
- }
1007
- parseFieldsDefinition() {
1008
- return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
1009
- }
1010
- parseFieldDefinition() {
1011
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
1012
- this.expectToken(o.COLON);
1013
- let s = this.parseTypeReference(), a = this.parseConstDirectives();
1014
- return this.node(t, { kind: c.FIELD_DEFINITION, description: n, name: i, arguments: r, type: s, directives: a });
1015
- }
1016
- parseArgumentDefs() {
1017
- return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
1018
- }
1019
- parseInputValueDef() {
1020
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
1021
- this.expectToken(o.COLON);
1022
- let r = this.parseTypeReference(), s;
1023
- this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
1024
- let a = this.parseConstDirectives();
1025
- return this.node(t, { kind: c.INPUT_VALUE_DEFINITION, description: n, name: i, type: r, defaultValue: s, directives: a });
1026
- }
1027
- parseInterfaceTypeDefinition() {
1028
- let t = this._lexer.token, n = this.parseDescription();
1029
- this.expectKeyword("interface");
1030
- let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1031
- return this.node(t, { kind: c.INTERFACE_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
1032
- }
1033
- parseUnionTypeDefinition() {
1034
- let t = this._lexer.token, n = this.parseDescription();
1035
- this.expectKeyword("union");
1036
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
1037
- return this.node(t, { kind: c.UNION_TYPE_DEFINITION, description: n, name: i, directives: r, types: s });
1038
- }
1039
- parseUnionMemberTypes() {
1040
- return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
1041
- }
1042
- parseEnumTypeDefinition() {
1043
- let t = this._lexer.token, n = this.parseDescription();
1044
- this.expectKeyword("enum");
1045
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
1046
- return this.node(t, { kind: c.ENUM_TYPE_DEFINITION, description: n, name: i, directives: r, values: s });
1047
- }
1048
- parseEnumValuesDefinition() {
1049
- return this.optionalMany(o.BRACE_L, this.parseEnumValueDefinition, o.BRACE_R);
1050
- }
1051
- parseEnumValueDefinition() {
1052
- let t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
1053
- return this.node(t, { kind: c.ENUM_VALUE_DEFINITION, description: n, name: i, directives: r });
1054
- }
1055
- parseEnumValueName() {
1056
- if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw d(this._lexer.source, this._lexer.token.start, `${oe(this._lexer.token)} is reserved and cannot be used for an enum value.`);
1057
- return this.parseName();
1058
- }
1059
- parseInputObjectTypeDefinition() {
1060
- let t = this._lexer.token, n = this.parseDescription();
1061
- this.expectKeyword("input");
1062
- let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
1063
- return this.node(t, { kind: c.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: i, directives: r, fields: s });
1064
- }
1065
- parseInputFieldsDefinition() {
1066
- return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
1067
- }
1068
- parseTypeSystemExtension() {
1069
- let t = this._lexer.lookahead();
1070
- if (t.kind === o.NAME) switch (t.value) {
1071
- case "schema":
1072
- return this.parseSchemaExtension();
1073
- case "scalar":
1074
- return this.parseScalarTypeExtension();
1075
- case "type":
1076
- return this.parseObjectTypeExtension();
1077
- case "interface":
1078
- return this.parseInterfaceTypeExtension();
1079
- case "union":
1080
- return this.parseUnionTypeExtension();
1081
- case "enum":
1082
- return this.parseEnumTypeExtension();
1083
- case "input":
1084
- return this.parseInputObjectTypeExtension();
1085
- }
1086
- throw this.unexpected(t);
1087
- }
1088
- parseSchemaExtension() {
1089
- let t = this._lexer.token;
1090
- this.expectKeyword("extend"), this.expectKeyword("schema");
1091
- let n = this.parseConstDirectives(), i = this.optionalMany(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1092
- if (n.length === 0 && i.length === 0) throw this.unexpected();
1093
- return this.node(t, { kind: c.SCHEMA_EXTENSION, directives: n, operationTypes: i });
1094
- }
1095
- parseScalarTypeExtension() {
1096
- let t = this._lexer.token;
1097
- this.expectKeyword("extend"), this.expectKeyword("scalar");
1098
- let n = this.parseName(), i = this.parseConstDirectives();
1099
- if (i.length === 0) throw this.unexpected();
1100
- return this.node(t, { kind: c.SCALAR_TYPE_EXTENSION, name: n, directives: i });
1101
- }
1102
- parseObjectTypeExtension() {
1103
- let t = this._lexer.token;
1104
- this.expectKeyword("extend"), this.expectKeyword("type");
1105
- let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1106
- if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1107
- return this.node(t, { kind: c.OBJECT_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
1108
- }
1109
- parseInterfaceTypeExtension() {
1110
- let t = this._lexer.token;
1111
- this.expectKeyword("extend"), this.expectKeyword("interface");
1112
- let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1113
- if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1114
- return this.node(t, { kind: c.INTERFACE_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
1115
- }
1116
- parseUnionTypeExtension() {
1117
- let t = this._lexer.token;
1118
- this.expectKeyword("extend"), this.expectKeyword("union");
1119
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
1120
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1121
- return this.node(t, { kind: c.UNION_TYPE_EXTENSION, name: n, directives: i, types: r });
1122
- }
1123
- parseEnumTypeExtension() {
1124
- let t = this._lexer.token;
1125
- this.expectKeyword("extend"), this.expectKeyword("enum");
1126
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
1127
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1128
- return this.node(t, { kind: c.ENUM_TYPE_EXTENSION, name: n, directives: i, values: r });
1129
- }
1130
- parseInputObjectTypeExtension() {
1131
- let t = this._lexer.token;
1132
- this.expectKeyword("extend"), this.expectKeyword("input");
1133
- let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
1134
- if (i.length === 0 && r.length === 0) throw this.unexpected();
1135
- return this.node(t, { kind: c.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: i, fields: r });
1136
- }
1137
- parseDirectiveDefinition() {
1138
- let t = this._lexer.token, n = this.parseDescription();
1139
- this.expectKeyword("directive"), this.expectToken(o.AT);
1140
- let i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
1141
- this.expectKeyword("on");
1142
- let a = this.parseDirectiveLocations();
1143
- return this.node(t, { kind: c.DIRECTIVE_DEFINITION, description: n, name: i, arguments: r, repeatable: s, locations: a });
1144
- }
1145
- parseDirectiveLocations() {
1146
- return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
1147
- }
1148
- parseDirectiveLocation() {
1149
- let t = this._lexer.token, n = this.parseName();
1150
- if (Object.prototype.hasOwnProperty.call(ee, n.value)) return n;
1151
- throw this.unexpected(t);
1152
- }
1153
- node(t, n) {
1154
- return this._options.noLocation !== true && (n.loc = new Q(t, this._lexer.lastToken, this._lexer.source)), n;
1155
- }
1156
- peek(t) {
1157
- return this._lexer.token.kind === t;
1158
- }
1159
- expectToken(t) {
1160
- let n = this._lexer.token;
1161
- if (n.kind === t) return this.advanceLexer(), n;
1162
- throw d(this._lexer.source, n.start, `Expected ${dt(t)}, found ${oe(n)}.`);
1163
- }
1164
- expectOptionalToken(t) {
1165
- return this._lexer.token.kind === t ? (this.advanceLexer(), true) : false;
1166
- }
1167
- expectKeyword(t) {
1168
- let n = this._lexer.token;
1169
- if (n.kind === o.NAME && n.value === t) this.advanceLexer();
1170
- else throw d(this._lexer.source, n.start, `Expected "${t}", found ${oe(n)}.`);
1171
- }
1172
- expectOptionalKeyword(t) {
1173
- let n = this._lexer.token;
1174
- return n.kind === o.NAME && n.value === t ? (this.advanceLexer(), true) : false;
1175
- }
1176
- unexpected(t) {
1177
- let n = t ?? this._lexer.token;
1178
- return d(this._lexer.source, n.start, `Unexpected ${oe(n)}.`);
1179
- }
1180
- any(t, n, i) {
1181
- this.expectToken(t);
1182
- let r = [];
1183
- for (; !this.expectOptionalToken(i); ) r.push(n.call(this));
1184
- return r;
1185
- }
1186
- optionalMany(t, n, i) {
1187
- if (this.expectOptionalToken(t)) {
1188
- let r = [];
1189
- do
1190
- r.push(n.call(this));
1191
- while (!this.expectOptionalToken(i));
1192
- return r;
1193
- }
1194
- return [];
1195
- }
1196
- many(t, n, i) {
1197
- this.expectToken(t);
1198
- let r = [];
1199
- do
1200
- r.push(n.call(this));
1201
- while (!this.expectOptionalToken(i));
1202
- return r;
1203
- }
1204
- delimitedMany(t, n) {
1205
- this.expectOptionalToken(t);
1206
- let i = [];
1207
- do
1208
- i.push(n.call(this));
1209
- while (this.expectOptionalToken(t));
1210
- return i;
1211
- }
1212
- advanceLexer() {
1213
- let { maxTokens: t } = this._options, n = this._lexer.advance();
1214
- if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw d(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
1215
- }
1216
- };
1217
- function oe(e2) {
1218
- let t = e2.value;
1219
- return dt(e2.kind) + (t != null ? ` "${t}"` : "");
1220
- }
1221
- function dt(e2) {
1222
- return ct(e2) ? `"${e2}"` : e2;
1223
- }
1224
- function sn(e2, t) {
1225
- let n = new SyntaxError(e2 + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
1226
- return Object.assign(n, t);
1227
- }
1228
- var mt = sn;
1229
- function on(e2) {
1230
- let t = [], { startToken: n, endToken: i } = e2.loc;
1231
- for (let r = n; r !== i; r = r.next) r.kind === "Comment" && t.push({ ...r, loc: { start: r.start, end: r.end } });
1232
- return t;
1233
- }
1234
- var an = { allowLegacyFragmentVariables: true };
1235
- function cn(e2) {
1236
- if ((e2 == null ? void 0 : e2.name) === "GraphQLError") {
1237
- let { message: t, locations: [n] } = e2;
1238
- return mt(t, { loc: { start: n }, cause: e2 });
1239
- }
1240
- return e2;
1241
- }
1242
- function un(e2) {
1243
- let t;
1244
- try {
1245
- t = ht(e2, an);
1246
- } catch (n) {
1247
- throw cn(n);
1248
- }
1249
- return t.comments = on(t), t;
1250
- }
1251
- var ln = { parse: un, astFormat: "graphql", hasPragma: je, hasIgnorePragma: $e, locStart: K, locEnd: z };
1252
- var pn = { graphql: qe };
1253
- var Ui = Ne;
1254
- export {
1255
- Ui as default,
1256
- Qe as languages,
1257
- Ke as options,
1258
- _e as parsers,
1259
- pn as printers
1260
- };