@ticketapp-dev/shop-sdk 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__vite-browser-external-l0sNRNKZ.js +1 -0
- package/dist/index.js +2005 -1362
- package/dist/services/category/category.service.d.ts +2 -2
- package/dist/services/category/category.service.d.ts.map +1 -1
- package/dist/services/category/category.service.generated.d.ts +4 -0
- package/dist/services/category/category.service.generated.d.ts.map +1 -1
- package/dist/services/event/event.service.d.ts +5 -0
- package/dist/services/event/event.service.d.ts.map +1 -1
- package/dist/services/event/event.service.generated.d.ts +3 -0
- package/dist/services/event/event.service.generated.d.ts.map +1 -1
- package/dist/services/package/package.service.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/persisted-query/persisted-query-client.d.ts +5 -0
- package/dist/utils/persisted-query/persisted-query-client.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { GraphQLClient as
|
|
2
|
-
import { createSlice as
|
|
3
|
-
import { DateTime as
|
|
4
|
-
var
|
|
5
|
-
return
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
for (var s in
|
|
1
|
+
import { GraphQLClient as ae } from "graphql-request";
|
|
2
|
+
import { createSlice as Xe, configureStore as Ke } from "@reduxjs/toolkit";
|
|
3
|
+
import { DateTime as x } from "luxon";
|
|
4
|
+
var Q = function() {
|
|
5
|
+
return Q = Object.assign || function(t) {
|
|
6
|
+
for (var n, i = 1, r = arguments.length; i < r; i++) {
|
|
7
|
+
n = arguments[i];
|
|
8
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
9
9
|
}
|
|
10
|
-
return
|
|
11
|
-
},
|
|
10
|
+
return t;
|
|
11
|
+
}, Q.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
if (!!!
|
|
15
|
-
throw new Error(
|
|
13
|
+
function G(e, t) {
|
|
14
|
+
if (!!!e)
|
|
15
|
+
throw new Error(t);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
17
|
+
function We(e) {
|
|
18
|
+
return typeof e == "object" && e !== null;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if (!!!
|
|
20
|
+
function Ze(e, t) {
|
|
21
|
+
if (!!!e)
|
|
22
22
|
throw new Error(
|
|
23
23
|
"Unexpected invariant triggered."
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
for (const
|
|
30
|
-
if (typeof
|
|
26
|
+
const et = /\r\n|[\n\r]/g;
|
|
27
|
+
function re(e, t) {
|
|
28
|
+
let n = 0, i = 1;
|
|
29
|
+
for (const r of e.body.matchAll(et)) {
|
|
30
|
+
if (typeof r.index == "number" || Ze(!1), r.index >= t)
|
|
31
31
|
break;
|
|
32
|
-
|
|
32
|
+
n = r.index + r[0].length, i += 1;
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
line: i,
|
|
36
|
-
column:
|
|
36
|
+
column: t + 1 - n
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
function tt(e) {
|
|
40
|
+
return ke(
|
|
41
|
+
e.source,
|
|
42
|
+
re(e.source, e.start)
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
`, c = i.split(/\r\n|[\n\r]/g),
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
for (let
|
|
51
|
-
I.push(
|
|
52
|
-
return
|
|
45
|
+
function ke(e, t) {
|
|
46
|
+
const n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, u = t.line === 1 ? n : 0, h = t.column + u, p = `${e.name}:${o}:${h}
|
|
47
|
+
`, c = i.split(/\r\n|[\n\r]/g), m = c[r];
|
|
48
|
+
if (m.length > 120) {
|
|
49
|
+
const g = Math.floor(h / 80), y = h % 80, I = [];
|
|
50
|
+
for (let O = 0; O < m.length; O += 80)
|
|
51
|
+
I.push(m.slice(O, O + 80));
|
|
52
|
+
return p + pe([
|
|
53
53
|
[`${o} |`, I[0]],
|
|
54
|
-
...I.slice(1,
|
|
55
|
-
["|", "^".padStart(
|
|
56
|
-
["|", I[
|
|
54
|
+
...I.slice(1, g + 1).map((O) => ["|", O]),
|
|
55
|
+
["|", "^".padStart(y)],
|
|
56
|
+
["|", I[g + 1]]
|
|
57
57
|
]);
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return p + pe([
|
|
60
60
|
// Lines specified like this: ["prefix", "string"],
|
|
61
|
-
[`${o - 1} |`, c[
|
|
62
|
-
[`${o} |`,
|
|
63
|
-
["|", "^".padStart(
|
|
64
|
-
[`${o + 1} |`, c[
|
|
61
|
+
[`${o - 1} |`, c[r - 1]],
|
|
62
|
+
[`${o} |`, m],
|
|
63
|
+
["|", "^".padStart(h)],
|
|
64
|
+
[`${o + 1} |`, c[r + 1]]
|
|
65
65
|
]);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
return
|
|
67
|
+
function pe(e) {
|
|
68
|
+
const t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
69
|
+
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
70
70
|
`);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
return
|
|
75
|
-
nodes:
|
|
76
|
-
source:
|
|
77
|
-
positions:
|
|
78
|
-
path:
|
|
79
|
-
originalError:
|
|
80
|
-
extensions:
|
|
81
|
-
} :
|
|
72
|
+
function nt(e) {
|
|
73
|
+
const t = e[0];
|
|
74
|
+
return t == null || "kind" in t || "length" in t ? {
|
|
75
|
+
nodes: t,
|
|
76
|
+
source: e[1],
|
|
77
|
+
positions: e[2],
|
|
78
|
+
path: e[3],
|
|
79
|
+
originalError: e[4],
|
|
80
|
+
extensions: e[5]
|
|
81
|
+
} : t;
|
|
82
82
|
}
|
|
83
|
-
class
|
|
83
|
+
class ce extends Error {
|
|
84
84
|
/**
|
|
85
85
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
86
86
|
* which correspond to this error.
|
|
@@ -119,20 +119,20 @@ class j extends Error {
|
|
|
119
119
|
/**
|
|
120
120
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
121
121
|
*/
|
|
122
|
-
constructor(
|
|
123
|
-
var i,
|
|
124
|
-
const { nodes: o, source: u, positions:
|
|
125
|
-
super(
|
|
122
|
+
constructor(t, ...n) {
|
|
123
|
+
var i, r, s;
|
|
124
|
+
const { nodes: o, source: u, positions: h, path: p, originalError: c, extensions: m } = nt(n);
|
|
125
|
+
super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError = c ?? void 0, this.nodes = he(
|
|
126
126
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
127
127
|
);
|
|
128
|
-
const
|
|
128
|
+
const g = he(
|
|
129
129
|
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((I) => I.loc).filter((I) => I != null)
|
|
130
130
|
);
|
|
131
|
-
this.source = u ?? (
|
|
132
|
-
const
|
|
131
|
+
this.source = u ?? (g == null || (r = g[0]) === null || r === void 0 ? void 0 : r.source), this.positions = h ?? g?.map((I) => I.start), this.locations = h && u ? h.map((I) => re(u, I)) : g?.map((I) => re(I.source, I.start));
|
|
132
|
+
const y = We(
|
|
133
133
|
c?.extensions
|
|
134
134
|
) ? c?.extensions : void 0;
|
|
135
|
-
this.extensions = (s =
|
|
135
|
+
this.extensions = (s = m ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
136
136
|
message: {
|
|
137
137
|
writable: !0,
|
|
138
138
|
enumerable: !0
|
|
@@ -156,7 +156,7 @@ class j extends Error {
|
|
|
156
156
|
value: c.stack,
|
|
157
157
|
writable: !0,
|
|
158
158
|
configurable: !0
|
|
159
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
159
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, ce) : Object.defineProperty(this, "stack", {
|
|
160
160
|
value: Error().stack,
|
|
161
161
|
writable: !0,
|
|
162
162
|
configurable: !0
|
|
@@ -166,36 +166,36 @@ class j extends Error {
|
|
|
166
166
|
return "GraphQLError";
|
|
167
167
|
}
|
|
168
168
|
toString() {
|
|
169
|
-
let
|
|
169
|
+
let t = this.message;
|
|
170
170
|
if (this.nodes)
|
|
171
|
-
for (const
|
|
172
|
-
|
|
171
|
+
for (const n of this.nodes)
|
|
172
|
+
n.loc && (t += `
|
|
173
173
|
|
|
174
|
-
` +
|
|
174
|
+
` + tt(n.loc));
|
|
175
175
|
else if (this.source && this.locations)
|
|
176
|
-
for (const
|
|
177
|
-
|
|
176
|
+
for (const n of this.locations)
|
|
177
|
+
t += `
|
|
178
178
|
|
|
179
|
-
` +
|
|
180
|
-
return
|
|
179
|
+
` + ke(this.source, n);
|
|
180
|
+
return t;
|
|
181
181
|
}
|
|
182
182
|
toJSON() {
|
|
183
|
-
const
|
|
183
|
+
const t = {
|
|
184
184
|
message: this.message
|
|
185
185
|
};
|
|
186
|
-
return this.locations != null && (
|
|
186
|
+
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;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
189
|
+
function he(e) {
|
|
190
|
+
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return new
|
|
194
|
-
source:
|
|
195
|
-
positions: [
|
|
192
|
+
function A(e, t, n) {
|
|
193
|
+
return new ce(`Syntax Error: ${n}`, {
|
|
194
|
+
source: e,
|
|
195
|
+
positions: [t]
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
class
|
|
198
|
+
class rt {
|
|
199
199
|
/**
|
|
200
200
|
* The character offset at which this Node begins.
|
|
201
201
|
*/
|
|
@@ -211,8 +211,8 @@ class $e {
|
|
|
211
211
|
/**
|
|
212
212
|
* The Source document the AST represents.
|
|
213
213
|
*/
|
|
214
|
-
constructor(
|
|
215
|
-
this.start =
|
|
214
|
+
constructor(t, n, i) {
|
|
215
|
+
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
|
|
216
216
|
}
|
|
217
217
|
get [Symbol.toStringTag]() {
|
|
218
218
|
return "Location";
|
|
@@ -224,7 +224,7 @@ class $e {
|
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
class
|
|
227
|
+
class De {
|
|
228
228
|
/**
|
|
229
229
|
* The kind of Token.
|
|
230
230
|
*/
|
|
@@ -251,8 +251,8 @@ class se {
|
|
|
251
251
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
252
252
|
* the last.
|
|
253
253
|
*/
|
|
254
|
-
constructor(
|
|
255
|
-
this.kind =
|
|
254
|
+
constructor(t, n, i, r, s, o) {
|
|
255
|
+
this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
256
256
|
}
|
|
257
257
|
get [Symbol.toStringTag]() {
|
|
258
258
|
return "Token";
|
|
@@ -266,7 +266,7 @@ class se {
|
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const xe = {
|
|
270
270
|
Name: [],
|
|
271
271
|
Document: ["definitions"],
|
|
272
272
|
OperationDefinition: [
|
|
@@ -353,60 +353,74 @@ const Ue = {
|
|
|
353
353
|
ArgumentCoordinate: ["name", "fieldName", "argumentName"],
|
|
354
354
|
DirectiveCoordinate: ["name"],
|
|
355
355
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
function
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
function
|
|
374
|
-
return
|
|
375
|
-
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
function
|
|
384
|
-
return
|
|
385
|
-
}
|
|
386
|
-
function
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
356
|
+
}, it = new Set(Object.keys(xe));
|
|
357
|
+
function fe(e) {
|
|
358
|
+
const t = e?.kind;
|
|
359
|
+
return typeof t == "string" && it.has(t);
|
|
360
|
+
}
|
|
361
|
+
var w;
|
|
362
|
+
(function(e) {
|
|
363
|
+
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
364
|
+
})(w || (w = {}));
|
|
365
|
+
var ie;
|
|
366
|
+
(function(e) {
|
|
367
|
+
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";
|
|
368
|
+
})(ie || (ie = {}));
|
|
369
|
+
var l;
|
|
370
|
+
(function(e) {
|
|
371
|
+
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";
|
|
372
|
+
})(l || (l = {}));
|
|
373
|
+
function se(e) {
|
|
374
|
+
return e === 9 || e === 32;
|
|
375
|
+
}
|
|
376
|
+
function M(e) {
|
|
377
|
+
return e >= 48 && e <= 57;
|
|
378
|
+
}
|
|
379
|
+
function Ne(e) {
|
|
380
|
+
return e >= 97 && e <= 122 || // A-Z
|
|
381
|
+
e >= 65 && e <= 90;
|
|
382
|
+
}
|
|
383
|
+
function be(e) {
|
|
384
|
+
return Ne(e) || e === 95;
|
|
385
|
+
}
|
|
386
|
+
function st(e) {
|
|
387
|
+
return Ne(e) || M(e) || e === 95;
|
|
388
|
+
}
|
|
389
|
+
function ot(e) {
|
|
390
|
+
var t;
|
|
391
|
+
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
392
|
+
for (let o = 0; o < e.length; ++o) {
|
|
390
393
|
var s;
|
|
391
|
-
const u =
|
|
392
|
-
|
|
394
|
+
const u = e[o], h = at(u);
|
|
395
|
+
h !== u.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && h < n && (n = h));
|
|
393
396
|
}
|
|
394
|
-
return
|
|
395
|
-
(
|
|
396
|
-
|
|
397
|
+
return e.map((o, u) => u === 0 ? o : o.slice(n)).slice(
|
|
398
|
+
(t = i) !== null && t !== void 0 ? t : 0,
|
|
399
|
+
r + 1
|
|
397
400
|
);
|
|
398
401
|
}
|
|
399
|
-
function
|
|
400
|
-
let
|
|
401
|
-
for (;
|
|
402
|
-
++
|
|
403
|
-
return
|
|
402
|
+
function at(e) {
|
|
403
|
+
let t = 0;
|
|
404
|
+
for (; t < e.length && se(e.charCodeAt(t)); )
|
|
405
|
+
++t;
|
|
406
|
+
return t;
|
|
407
|
+
}
|
|
408
|
+
function ct(e, t) {
|
|
409
|
+
const n = e.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), r = i.length === 1, s = i.length > 1 && i.slice(1).every((y) => y.length === 0 || se(y.charCodeAt(0))), o = n.endsWith('\\"""'), u = e.endsWith('"') && !o, h = e.endsWith("\\"), p = u || h, c = (
|
|
410
|
+
// add leading and trailing new lines only if it improves readability
|
|
411
|
+
!r || e.length > 70 || p || s || o
|
|
412
|
+
);
|
|
413
|
+
let m = "";
|
|
414
|
+
const g = r && se(e.charCodeAt(0));
|
|
415
|
+
return (c && !g || s) && (m += `
|
|
416
|
+
`), m += n, (c || p) && (m += `
|
|
417
|
+
`), '"""' + m + '"""';
|
|
404
418
|
}
|
|
405
419
|
var a;
|
|
406
|
-
(function(
|
|
407
|
-
|
|
420
|
+
(function(e) {
|
|
421
|
+
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";
|
|
408
422
|
})(a || (a = {}));
|
|
409
|
-
class
|
|
423
|
+
class dt {
|
|
410
424
|
/**
|
|
411
425
|
* The previously focused non-ignored token.
|
|
412
426
|
*/
|
|
@@ -419,9 +433,9 @@ class Ge {
|
|
|
419
433
|
/**
|
|
420
434
|
* The character offset at which the current line begins.
|
|
421
435
|
*/
|
|
422
|
-
constructor(
|
|
423
|
-
const
|
|
424
|
-
this.source =
|
|
436
|
+
constructor(t) {
|
|
437
|
+
const n = new De(a.SOF, 0, 0, 0, 0);
|
|
438
|
+
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
425
439
|
}
|
|
426
440
|
get [Symbol.toStringTag]() {
|
|
427
441
|
return "Lexer";
|
|
@@ -437,53 +451,53 @@ class Ge {
|
|
|
437
451
|
* the state of Lexer.
|
|
438
452
|
*/
|
|
439
453
|
lookahead() {
|
|
440
|
-
let
|
|
441
|
-
if (
|
|
454
|
+
let t = this.token;
|
|
455
|
+
if (t.kind !== a.EOF)
|
|
442
456
|
do
|
|
443
|
-
if (
|
|
444
|
-
|
|
457
|
+
if (t.next)
|
|
458
|
+
t = t.next;
|
|
445
459
|
else {
|
|
446
|
-
const
|
|
447
|
-
|
|
460
|
+
const n = lt(this, t.end);
|
|
461
|
+
t.next = n, n.prev = t, t = n;
|
|
448
462
|
}
|
|
449
|
-
while (
|
|
450
|
-
return
|
|
463
|
+
while (t.kind === a.COMMENT);
|
|
464
|
+
return t;
|
|
451
465
|
}
|
|
452
466
|
}
|
|
453
|
-
function
|
|
454
|
-
return
|
|
467
|
+
function ut(e) {
|
|
468
|
+
return e === a.BANG || e === a.DOLLAR || e === a.AMP || e === a.PAREN_L || e === a.PAREN_R || e === a.DOT || e === a.SPREAD || e === a.COLON || e === a.EQUALS || e === a.AT || e === a.BRACKET_L || e === a.BRACKET_R || e === a.BRACE_L || e === a.PIPE || e === a.BRACE_R;
|
|
455
469
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
470
|
+
function $(e) {
|
|
471
|
+
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
458
472
|
}
|
|
459
|
-
function
|
|
460
|
-
return
|
|
473
|
+
function K(e, t) {
|
|
474
|
+
return Pe(e.charCodeAt(t)) && Se(e.charCodeAt(t + 1));
|
|
461
475
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
476
|
+
function Pe(e) {
|
|
477
|
+
return e >= 55296 && e <= 56319;
|
|
464
478
|
}
|
|
465
|
-
function
|
|
466
|
-
return
|
|
479
|
+
function Se(e) {
|
|
480
|
+
return e >= 56320 && e <= 57343;
|
|
467
481
|
}
|
|
468
|
-
function
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
482
|
+
function F(e, t) {
|
|
483
|
+
const n = e.source.body.codePointAt(t);
|
|
484
|
+
if (n === void 0)
|
|
471
485
|
return a.EOF;
|
|
472
|
-
if (
|
|
473
|
-
const i = String.fromCodePoint(
|
|
486
|
+
if (n >= 32 && n <= 126) {
|
|
487
|
+
const i = String.fromCodePoint(n);
|
|
474
488
|
return i === '"' ? `'"'` : `"${i}"`;
|
|
475
489
|
}
|
|
476
|
-
return "U+" +
|
|
490
|
+
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
477
491
|
}
|
|
478
|
-
function
|
|
479
|
-
const s =
|
|
480
|
-
return new
|
|
492
|
+
function v(e, t, n, i, r) {
|
|
493
|
+
const s = e.line, o = 1 + n - e.lineStart;
|
|
494
|
+
return new De(t, n, i, s, o, r);
|
|
481
495
|
}
|
|
482
|
-
function
|
|
483
|
-
const
|
|
484
|
-
let
|
|
485
|
-
for (;
|
|
486
|
-
const s =
|
|
496
|
+
function lt(e, t) {
|
|
497
|
+
const n = e.source.body, i = n.length;
|
|
498
|
+
let r = t;
|
|
499
|
+
for (; r < i; ) {
|
|
500
|
+
const s = n.charCodeAt(r);
|
|
487
501
|
switch (s) {
|
|
488
502
|
// Ignored ::
|
|
489
503
|
// - UnicodeBOM
|
|
@@ -506,21 +520,21 @@ function Ye(r, e) {
|
|
|
506
520
|
case 32:
|
|
507
521
|
// <space>
|
|
508
522
|
case 44:
|
|
509
|
-
++
|
|
523
|
+
++r;
|
|
510
524
|
continue;
|
|
511
525
|
// LineTerminator ::
|
|
512
526
|
// - "New Line (U+000A)"
|
|
513
527
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
514
528
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
515
529
|
case 10:
|
|
516
|
-
++
|
|
530
|
+
++r, ++e.line, e.lineStart = r;
|
|
517
531
|
continue;
|
|
518
532
|
case 13:
|
|
519
|
-
|
|
533
|
+
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
520
534
|
continue;
|
|
521
535
|
// Comment
|
|
522
536
|
case 35:
|
|
523
|
-
return
|
|
537
|
+
return pt(e, r);
|
|
524
538
|
// Token ::
|
|
525
539
|
// - Punctuator
|
|
526
540
|
// - Name
|
|
@@ -530,207 +544,207 @@ function Ye(r, e) {
|
|
|
530
544
|
//
|
|
531
545
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
532
546
|
case 33:
|
|
533
|
-
return
|
|
547
|
+
return v(e, a.BANG, r, r + 1);
|
|
534
548
|
case 36:
|
|
535
|
-
return
|
|
549
|
+
return v(e, a.DOLLAR, r, r + 1);
|
|
536
550
|
case 38:
|
|
537
|
-
return
|
|
551
|
+
return v(e, a.AMP, r, r + 1);
|
|
538
552
|
case 40:
|
|
539
|
-
return
|
|
553
|
+
return v(e, a.PAREN_L, r, r + 1);
|
|
540
554
|
case 41:
|
|
541
|
-
return
|
|
555
|
+
return v(e, a.PAREN_R, r, r + 1);
|
|
542
556
|
case 46:
|
|
543
|
-
if (
|
|
544
|
-
return
|
|
557
|
+
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
558
|
+
return v(e, a.SPREAD, r, r + 3);
|
|
545
559
|
break;
|
|
546
560
|
case 58:
|
|
547
|
-
return
|
|
561
|
+
return v(e, a.COLON, r, r + 1);
|
|
548
562
|
case 61:
|
|
549
|
-
return
|
|
563
|
+
return v(e, a.EQUALS, r, r + 1);
|
|
550
564
|
case 64:
|
|
551
|
-
return
|
|
565
|
+
return v(e, a.AT, r, r + 1);
|
|
552
566
|
case 91:
|
|
553
|
-
return
|
|
567
|
+
return v(e, a.BRACKET_L, r, r + 1);
|
|
554
568
|
case 93:
|
|
555
|
-
return
|
|
569
|
+
return v(e, a.BRACKET_R, r, r + 1);
|
|
556
570
|
case 123:
|
|
557
|
-
return
|
|
571
|
+
return v(e, a.BRACE_L, r, r + 1);
|
|
558
572
|
case 124:
|
|
559
|
-
return
|
|
573
|
+
return v(e, a.PIPE, r, r + 1);
|
|
560
574
|
case 125:
|
|
561
|
-
return
|
|
575
|
+
return v(e, a.BRACE_R, r, r + 1);
|
|
562
576
|
// StringValue
|
|
563
577
|
case 34:
|
|
564
|
-
return
|
|
578
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Et(e, r) : ft(e, r);
|
|
565
579
|
}
|
|
566
|
-
if (
|
|
567
|
-
return
|
|
568
|
-
if (
|
|
569
|
-
return
|
|
570
|
-
throw
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
580
|
+
if (M(s) || s === 45)
|
|
581
|
+
return ht(e, r, s);
|
|
582
|
+
if (be(s))
|
|
583
|
+
return yt(e, r);
|
|
584
|
+
throw A(
|
|
585
|
+
e.source,
|
|
586
|
+
r,
|
|
587
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : $(s) || K(n, r) ? `Unexpected character: ${F(e, r)}.` : `Invalid character: ${F(e, r)}.`
|
|
574
588
|
);
|
|
575
589
|
}
|
|
576
|
-
return
|
|
590
|
+
return v(e, a.EOF, i, i);
|
|
577
591
|
}
|
|
578
|
-
function
|
|
579
|
-
const
|
|
580
|
-
let
|
|
581
|
-
for (;
|
|
582
|
-
const s =
|
|
592
|
+
function pt(e, t) {
|
|
593
|
+
const n = e.source.body, i = n.length;
|
|
594
|
+
let r = t + 1;
|
|
595
|
+
for (; r < i; ) {
|
|
596
|
+
const s = n.charCodeAt(r);
|
|
583
597
|
if (s === 10 || s === 13)
|
|
584
598
|
break;
|
|
585
|
-
if (
|
|
586
|
-
++
|
|
587
|
-
else if (
|
|
588
|
-
|
|
599
|
+
if ($(s))
|
|
600
|
+
++r;
|
|
601
|
+
else if (K(n, r))
|
|
602
|
+
r += 2;
|
|
589
603
|
else
|
|
590
604
|
break;
|
|
591
605
|
}
|
|
592
|
-
return
|
|
593
|
-
r,
|
|
594
|
-
a.COMMENT,
|
|
606
|
+
return v(
|
|
595
607
|
e,
|
|
596
|
-
|
|
597
|
-
t
|
|
608
|
+
a.COMMENT,
|
|
609
|
+
t,
|
|
610
|
+
r,
|
|
611
|
+
n.slice(t + 1, r)
|
|
598
612
|
);
|
|
599
613
|
}
|
|
600
|
-
function
|
|
601
|
-
const i =
|
|
602
|
-
let
|
|
603
|
-
if (s === 45 && (s = i.charCodeAt(++
|
|
604
|
-
if (s = i.charCodeAt(++
|
|
605
|
-
throw
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
`Invalid number, unexpected digit after 0: ${
|
|
609
|
-
|
|
610
|
-
|
|
614
|
+
function ht(e, t, n) {
|
|
615
|
+
const i = e.source.body;
|
|
616
|
+
let r = t, s = n, o = !1;
|
|
617
|
+
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
618
|
+
if (s = i.charCodeAt(++r), M(s))
|
|
619
|
+
throw A(
|
|
620
|
+
e.source,
|
|
621
|
+
r,
|
|
622
|
+
`Invalid number, unexpected digit after 0: ${F(
|
|
623
|
+
e,
|
|
624
|
+
r
|
|
611
625
|
)}.`
|
|
612
626
|
);
|
|
613
627
|
} else
|
|
614
|
-
|
|
615
|
-
if (s === 46 && (o = !0, s = i.charCodeAt(++
|
|
616
|
-
throw
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
`Invalid number, expected digit but got: ${
|
|
620
|
-
|
|
621
|
-
|
|
628
|
+
r = ee(e, r, s), s = i.charCodeAt(r);
|
|
629
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = ee(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = ee(e, r, s), s = i.charCodeAt(r)), s === 46 || be(s))
|
|
630
|
+
throw A(
|
|
631
|
+
e.source,
|
|
632
|
+
r,
|
|
633
|
+
`Invalid number, expected digit but got: ${F(
|
|
634
|
+
e,
|
|
635
|
+
r
|
|
622
636
|
)}.`
|
|
623
637
|
);
|
|
624
|
-
return
|
|
625
|
-
r,
|
|
626
|
-
o ? a.FLOAT : a.INT,
|
|
638
|
+
return v(
|
|
627
639
|
e,
|
|
628
|
-
|
|
629
|
-
|
|
640
|
+
o ? a.FLOAT : a.INT,
|
|
641
|
+
t,
|
|
642
|
+
r,
|
|
643
|
+
i.slice(t, r)
|
|
630
644
|
);
|
|
631
645
|
}
|
|
632
|
-
function
|
|
633
|
-
if (!
|
|
634
|
-
throw
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
`Invalid number, expected digit but got: ${
|
|
638
|
-
|
|
639
|
-
|
|
646
|
+
function ee(e, t, n) {
|
|
647
|
+
if (!M(n))
|
|
648
|
+
throw A(
|
|
649
|
+
e.source,
|
|
650
|
+
t,
|
|
651
|
+
`Invalid number, expected digit but got: ${F(
|
|
652
|
+
e,
|
|
653
|
+
t
|
|
640
654
|
)}.`
|
|
641
655
|
);
|
|
642
|
-
const i =
|
|
643
|
-
let
|
|
644
|
-
for (;
|
|
645
|
-
++
|
|
646
|
-
return
|
|
647
|
-
}
|
|
648
|
-
function
|
|
649
|
-
const
|
|
650
|
-
let
|
|
651
|
-
for (;
|
|
652
|
-
const u =
|
|
656
|
+
const i = e.source.body;
|
|
657
|
+
let r = t + 1;
|
|
658
|
+
for (; M(i.charCodeAt(r)); )
|
|
659
|
+
++r;
|
|
660
|
+
return r;
|
|
661
|
+
}
|
|
662
|
+
function ft(e, t) {
|
|
663
|
+
const n = e.source.body, i = n.length;
|
|
664
|
+
let r = t + 1, s = r, o = "";
|
|
665
|
+
for (; r < i; ) {
|
|
666
|
+
const u = n.charCodeAt(r);
|
|
653
667
|
if (u === 34)
|
|
654
|
-
return o +=
|
|
668
|
+
return o += n.slice(s, r), v(e, a.STRING, t, r + 1, o);
|
|
655
669
|
if (u === 92) {
|
|
656
|
-
o +=
|
|
657
|
-
const
|
|
658
|
-
o +=
|
|
670
|
+
o += n.slice(s, r);
|
|
671
|
+
const h = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? mt(e, r) : gt(e, r) : It(e, r);
|
|
672
|
+
o += h.value, r += h.size, s = r;
|
|
659
673
|
continue;
|
|
660
674
|
}
|
|
661
675
|
if (u === 10 || u === 13)
|
|
662
676
|
break;
|
|
663
|
-
if (
|
|
664
|
-
++
|
|
665
|
-
else if (
|
|
666
|
-
|
|
677
|
+
if ($(u))
|
|
678
|
+
++r;
|
|
679
|
+
else if (K(n, r))
|
|
680
|
+
r += 2;
|
|
667
681
|
else
|
|
668
|
-
throw
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
`Invalid character within String: ${
|
|
672
|
-
|
|
673
|
-
|
|
682
|
+
throw A(
|
|
683
|
+
e.source,
|
|
684
|
+
r,
|
|
685
|
+
`Invalid character within String: ${F(
|
|
686
|
+
e,
|
|
687
|
+
r
|
|
674
688
|
)}.`
|
|
675
689
|
);
|
|
676
690
|
}
|
|
677
|
-
throw
|
|
691
|
+
throw A(e.source, r, "Unterminated string.");
|
|
678
692
|
}
|
|
679
|
-
function
|
|
680
|
-
const
|
|
681
|
-
let i = 0,
|
|
682
|
-
for (;
|
|
683
|
-
const s =
|
|
693
|
+
function mt(e, t) {
|
|
694
|
+
const n = e.source.body;
|
|
695
|
+
let i = 0, r = 3;
|
|
696
|
+
for (; r < 12; ) {
|
|
697
|
+
const s = n.charCodeAt(t + r++);
|
|
684
698
|
if (s === 125) {
|
|
685
|
-
if (
|
|
699
|
+
if (r < 5 || !$(i))
|
|
686
700
|
break;
|
|
687
701
|
return {
|
|
688
702
|
value: String.fromCodePoint(i),
|
|
689
|
-
size:
|
|
703
|
+
size: r
|
|
690
704
|
};
|
|
691
705
|
}
|
|
692
|
-
if (i = i << 4 |
|
|
706
|
+
if (i = i << 4 | V(s), i < 0)
|
|
693
707
|
break;
|
|
694
708
|
}
|
|
695
|
-
throw
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
`Invalid Unicode escape sequence: "${
|
|
699
|
-
|
|
700
|
-
|
|
709
|
+
throw A(
|
|
710
|
+
e.source,
|
|
711
|
+
t,
|
|
712
|
+
`Invalid Unicode escape sequence: "${n.slice(
|
|
713
|
+
t,
|
|
714
|
+
t + r
|
|
701
715
|
)}".`
|
|
702
716
|
);
|
|
703
717
|
}
|
|
704
|
-
function
|
|
705
|
-
const
|
|
706
|
-
if (
|
|
718
|
+
function gt(e, t) {
|
|
719
|
+
const n = e.source.body, i = me(n, t + 2);
|
|
720
|
+
if ($(i))
|
|
707
721
|
return {
|
|
708
722
|
value: String.fromCodePoint(i),
|
|
709
723
|
size: 6
|
|
710
724
|
};
|
|
711
|
-
if (
|
|
712
|
-
const
|
|
713
|
-
if (
|
|
725
|
+
if (Pe(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
726
|
+
const r = me(n, t + 8);
|
|
727
|
+
if (Se(r))
|
|
714
728
|
return {
|
|
715
|
-
value: String.fromCodePoint(i,
|
|
729
|
+
value: String.fromCodePoint(i, r),
|
|
716
730
|
size: 12
|
|
717
731
|
};
|
|
718
732
|
}
|
|
719
|
-
throw
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
`Invalid Unicode escape sequence: "${
|
|
733
|
+
throw A(
|
|
734
|
+
e.source,
|
|
735
|
+
t,
|
|
736
|
+
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
723
737
|
);
|
|
724
738
|
}
|
|
725
|
-
function
|
|
726
|
-
return
|
|
739
|
+
function me(e, t) {
|
|
740
|
+
return V(e.charCodeAt(t)) << 12 | V(e.charCodeAt(t + 1)) << 8 | V(e.charCodeAt(t + 2)) << 4 | V(e.charCodeAt(t + 3));
|
|
727
741
|
}
|
|
728
|
-
function
|
|
729
|
-
return
|
|
742
|
+
function V(e) {
|
|
743
|
+
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
730
744
|
}
|
|
731
|
-
function
|
|
732
|
-
const
|
|
733
|
-
switch (
|
|
745
|
+
function It(e, t) {
|
|
746
|
+
const n = e.source.body;
|
|
747
|
+
switch (n.charCodeAt(t + 1)) {
|
|
734
748
|
case 34:
|
|
735
749
|
return {
|
|
736
750
|
value: '"',
|
|
@@ -773,152 +787,152 @@ function We(r, e) {
|
|
|
773
787
|
size: 2
|
|
774
788
|
};
|
|
775
789
|
}
|
|
776
|
-
throw
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
`Invalid character escape sequence: "${
|
|
780
|
-
|
|
781
|
-
|
|
790
|
+
throw A(
|
|
791
|
+
e.source,
|
|
792
|
+
t,
|
|
793
|
+
`Invalid character escape sequence: "${n.slice(
|
|
794
|
+
t,
|
|
795
|
+
t + 2
|
|
782
796
|
)}".`
|
|
783
797
|
);
|
|
784
798
|
}
|
|
785
|
-
function
|
|
786
|
-
const
|
|
787
|
-
let
|
|
788
|
-
const
|
|
799
|
+
function Et(e, t) {
|
|
800
|
+
const n = e.source.body, i = n.length;
|
|
801
|
+
let r = e.lineStart, s = t + 3, o = s, u = "";
|
|
802
|
+
const h = [];
|
|
789
803
|
for (; s < i; ) {
|
|
790
|
-
const
|
|
791
|
-
if (
|
|
792
|
-
u +=
|
|
793
|
-
const c =
|
|
794
|
-
r,
|
|
795
|
-
a.BLOCK_STRING,
|
|
804
|
+
const p = n.charCodeAt(s);
|
|
805
|
+
if (p === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
806
|
+
u += n.slice(o, s), h.push(u);
|
|
807
|
+
const c = v(
|
|
796
808
|
e,
|
|
809
|
+
a.BLOCK_STRING,
|
|
810
|
+
t,
|
|
797
811
|
s + 3,
|
|
798
812
|
// Return a string of the lines joined with U+000A.
|
|
799
|
-
|
|
813
|
+
ot(h).join(`
|
|
800
814
|
`)
|
|
801
815
|
);
|
|
802
|
-
return
|
|
816
|
+
return e.line += h.length - 1, e.lineStart = r, c;
|
|
803
817
|
}
|
|
804
|
-
if (
|
|
805
|
-
u +=
|
|
818
|
+
if (p === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
819
|
+
u += n.slice(o, s), o = s + 1, s += 4;
|
|
806
820
|
continue;
|
|
807
821
|
}
|
|
808
|
-
if (
|
|
809
|
-
u +=
|
|
822
|
+
if (p === 10 || p === 13) {
|
|
823
|
+
u += n.slice(o, s), h.push(u), p === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", o = s, r = s;
|
|
810
824
|
continue;
|
|
811
825
|
}
|
|
812
|
-
if (
|
|
826
|
+
if ($(p))
|
|
813
827
|
++s;
|
|
814
|
-
else if (
|
|
828
|
+
else if (K(n, s))
|
|
815
829
|
s += 2;
|
|
816
830
|
else
|
|
817
|
-
throw
|
|
818
|
-
|
|
831
|
+
throw A(
|
|
832
|
+
e.source,
|
|
819
833
|
s,
|
|
820
|
-
`Invalid character within String: ${
|
|
821
|
-
|
|
834
|
+
`Invalid character within String: ${F(
|
|
835
|
+
e,
|
|
822
836
|
s
|
|
823
837
|
)}.`
|
|
824
838
|
);
|
|
825
839
|
}
|
|
826
|
-
throw
|
|
840
|
+
throw A(e.source, s, "Unterminated string.");
|
|
827
841
|
}
|
|
828
|
-
function
|
|
829
|
-
const
|
|
830
|
-
let
|
|
831
|
-
for (;
|
|
832
|
-
const s =
|
|
833
|
-
if (
|
|
834
|
-
++
|
|
842
|
+
function yt(e, t) {
|
|
843
|
+
const n = e.source.body, i = n.length;
|
|
844
|
+
let r = t + 1;
|
|
845
|
+
for (; r < i; ) {
|
|
846
|
+
const s = n.charCodeAt(r);
|
|
847
|
+
if (st(s))
|
|
848
|
+
++r;
|
|
835
849
|
else
|
|
836
850
|
break;
|
|
837
851
|
}
|
|
838
|
-
return
|
|
839
|
-
r,
|
|
840
|
-
a.NAME,
|
|
852
|
+
return v(
|
|
841
853
|
e,
|
|
842
|
-
|
|
843
|
-
t
|
|
854
|
+
a.NAME,
|
|
855
|
+
t,
|
|
856
|
+
r,
|
|
857
|
+
n.slice(t, r)
|
|
844
858
|
);
|
|
845
859
|
}
|
|
846
|
-
const
|
|
847
|
-
function
|
|
848
|
-
return
|
|
860
|
+
const vt = 10, Ce = 2;
|
|
861
|
+
function de(e) {
|
|
862
|
+
return W(e, []);
|
|
849
863
|
}
|
|
850
|
-
function
|
|
851
|
-
switch (typeof
|
|
864
|
+
function W(e, t) {
|
|
865
|
+
switch (typeof e) {
|
|
852
866
|
case "string":
|
|
853
|
-
return JSON.stringify(
|
|
867
|
+
return JSON.stringify(e);
|
|
854
868
|
case "function":
|
|
855
|
-
return
|
|
869
|
+
return e.name ? `[function ${e.name}]` : "[function]";
|
|
856
870
|
case "object":
|
|
857
|
-
return
|
|
871
|
+
return At(e, t);
|
|
858
872
|
default:
|
|
859
|
-
return String(
|
|
873
|
+
return String(e);
|
|
860
874
|
}
|
|
861
875
|
}
|
|
862
|
-
function
|
|
863
|
-
if (
|
|
876
|
+
function At(e, t) {
|
|
877
|
+
if (e === null)
|
|
864
878
|
return "null";
|
|
865
|
-
if (
|
|
879
|
+
if (t.includes(e))
|
|
866
880
|
return "[Circular]";
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
869
|
-
const i =
|
|
870
|
-
if (i !==
|
|
871
|
-
return typeof i == "string" ? i :
|
|
872
|
-
} else if (Array.isArray(
|
|
873
|
-
return
|
|
874
|
-
return
|
|
875
|
-
}
|
|
876
|
-
function
|
|
877
|
-
return typeof
|
|
878
|
-
}
|
|
879
|
-
function
|
|
880
|
-
const
|
|
881
|
-
return
|
|
882
|
-
([
|
|
881
|
+
const n = [...t, e];
|
|
882
|
+
if (Tt(e)) {
|
|
883
|
+
const i = e.toJSON();
|
|
884
|
+
if (i !== e)
|
|
885
|
+
return typeof i == "string" ? i : W(i, n);
|
|
886
|
+
} else if (Array.isArray(e))
|
|
887
|
+
return kt(e, n);
|
|
888
|
+
return Ot(e, n);
|
|
889
|
+
}
|
|
890
|
+
function Tt(e) {
|
|
891
|
+
return typeof e.toJSON == "function";
|
|
892
|
+
}
|
|
893
|
+
function Ot(e, t) {
|
|
894
|
+
const n = Object.entries(e);
|
|
895
|
+
return n.length === 0 ? "{}" : t.length > Ce ? "[" + Dt(e) + "]" : "{ " + n.map(
|
|
896
|
+
([r, s]) => r + ": " + W(s, t)
|
|
883
897
|
).join(", ") + " }";
|
|
884
898
|
}
|
|
885
|
-
function
|
|
886
|
-
if (
|
|
899
|
+
function kt(e, t) {
|
|
900
|
+
if (e.length === 0)
|
|
887
901
|
return "[]";
|
|
888
|
-
if (
|
|
902
|
+
if (t.length > Ce)
|
|
889
903
|
return "[Array]";
|
|
890
|
-
const
|
|
891
|
-
for (let s = 0; s <
|
|
892
|
-
|
|
893
|
-
return i === 1 ?
|
|
894
|
-
}
|
|
895
|
-
function
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
const
|
|
899
|
-
if (typeof
|
|
900
|
-
return
|
|
901
|
-
}
|
|
902
|
-
return
|
|
903
|
-
}
|
|
904
|
-
const
|
|
905
|
-
process.env.NODE_ENV === "production",
|
|
904
|
+
const n = Math.min(vt, e.length), i = e.length - n, r = [];
|
|
905
|
+
for (let s = 0; s < n; ++s)
|
|
906
|
+
r.push(W(e[s], t));
|
|
907
|
+
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
908
|
+
}
|
|
909
|
+
function Dt(e) {
|
|
910
|
+
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
911
|
+
if (t === "Object" && typeof e.constructor == "function") {
|
|
912
|
+
const n = e.constructor.name;
|
|
913
|
+
if (typeof n == "string" && n !== "")
|
|
914
|
+
return n;
|
|
915
|
+
}
|
|
916
|
+
return t;
|
|
917
|
+
}
|
|
918
|
+
const xt = globalThis.process && // eslint-disable-next-line no-undef
|
|
919
|
+
process.env.NODE_ENV === "production", Nt = (
|
|
906
920
|
/* c8 ignore next 6 */
|
|
907
921
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
908
|
-
|
|
909
|
-
return
|
|
910
|
-
} : function(
|
|
911
|
-
if (
|
|
922
|
+
xt ? function(t, n) {
|
|
923
|
+
return t instanceof n;
|
|
924
|
+
} : function(t, n) {
|
|
925
|
+
if (t instanceof n)
|
|
912
926
|
return !0;
|
|
913
|
-
if (typeof
|
|
927
|
+
if (typeof t == "object" && t !== null) {
|
|
914
928
|
var i;
|
|
915
|
-
const
|
|
929
|
+
const r = n.prototype[Symbol.toStringTag], s = (
|
|
916
930
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
917
|
-
Symbol.toStringTag in
|
|
931
|
+
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
|
|
918
932
|
);
|
|
919
|
-
if (
|
|
920
|
-
const o =
|
|
921
|
-
throw new Error(`Cannot use ${
|
|
933
|
+
if (r === s) {
|
|
934
|
+
const o = de(t);
|
|
935
|
+
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
922
936
|
|
|
923
937
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
924
938
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -935,15 +949,15 @@ spurious results.`);
|
|
|
935
949
|
return !1;
|
|
936
950
|
}
|
|
937
951
|
);
|
|
938
|
-
class
|
|
939
|
-
constructor(
|
|
952
|
+
class _e {
|
|
953
|
+
constructor(t, n = "GraphQL request", i = {
|
|
940
954
|
line: 1,
|
|
941
955
|
column: 1
|
|
942
956
|
}) {
|
|
943
|
-
typeof
|
|
957
|
+
typeof t == "string" || G(!1, `Body must be a string. Received: ${de(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || G(
|
|
944
958
|
!1,
|
|
945
959
|
"line in locationOffset is 1-indexed and must be positive."
|
|
946
|
-
), this.locationOffset.column > 0 ||
|
|
960
|
+
), this.locationOffset.column > 0 || G(
|
|
947
961
|
!1,
|
|
948
962
|
"column in locationOffset is 1-indexed and must be positive."
|
|
949
963
|
);
|
|
@@ -952,26 +966,26 @@ class pe {
|
|
|
952
966
|
return "Source";
|
|
953
967
|
}
|
|
954
968
|
}
|
|
955
|
-
function
|
|
956
|
-
return
|
|
969
|
+
function bt(e) {
|
|
970
|
+
return Nt(e, _e);
|
|
957
971
|
}
|
|
958
|
-
function
|
|
959
|
-
const
|
|
972
|
+
function Pt(e, t) {
|
|
973
|
+
const n = new St(e, t), i = n.parseDocument();
|
|
960
974
|
return Object.defineProperty(i, "tokenCount", {
|
|
961
975
|
enumerable: !1,
|
|
962
|
-
value:
|
|
976
|
+
value: n.tokenCount
|
|
963
977
|
}), i;
|
|
964
978
|
}
|
|
965
|
-
class
|
|
966
|
-
constructor(
|
|
967
|
-
const { lexer: i, ...
|
|
979
|
+
class St {
|
|
980
|
+
constructor(t, n = {}) {
|
|
981
|
+
const { lexer: i, ...r } = n;
|
|
968
982
|
if (i)
|
|
969
983
|
this._lexer = i;
|
|
970
984
|
else {
|
|
971
|
-
const s =
|
|
972
|
-
this._lexer = new
|
|
985
|
+
const s = bt(t) ? t : new _e(t);
|
|
986
|
+
this._lexer = new dt(s);
|
|
973
987
|
}
|
|
974
|
-
this._options =
|
|
988
|
+
this._options = r, this._tokenCounter = 0;
|
|
975
989
|
}
|
|
976
990
|
get tokenCount() {
|
|
977
991
|
return this._tokenCounter;
|
|
@@ -980,10 +994,10 @@ class lt {
|
|
|
980
994
|
* Converts a name lex token into a name parse node.
|
|
981
995
|
*/
|
|
982
996
|
parseName() {
|
|
983
|
-
const
|
|
984
|
-
return this.node(
|
|
985
|
-
kind:
|
|
986
|
-
value:
|
|
997
|
+
const t = this.expectToken(a.NAME);
|
|
998
|
+
return this.node(t, {
|
|
999
|
+
kind: l.NAME,
|
|
1000
|
+
value: t.value
|
|
987
1001
|
});
|
|
988
1002
|
}
|
|
989
1003
|
// Implements the parsing rules in the Document section.
|
|
@@ -992,7 +1006,7 @@ class lt {
|
|
|
992
1006
|
*/
|
|
993
1007
|
parseDocument() {
|
|
994
1008
|
return this.node(this._lexer.token, {
|
|
995
|
-
kind:
|
|
1009
|
+
kind: l.DOCUMENT,
|
|
996
1010
|
definitions: this.many(
|
|
997
1011
|
a.SOF,
|
|
998
1012
|
this.parseDefinition,
|
|
@@ -1026,15 +1040,15 @@ class lt {
|
|
|
1026
1040
|
parseDefinition() {
|
|
1027
1041
|
if (this.peek(a.BRACE_L))
|
|
1028
1042
|
return this.parseOperationDefinition();
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1031
|
-
throw
|
|
1043
|
+
const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1044
|
+
if (t && n.kind === a.BRACE_L)
|
|
1045
|
+
throw A(
|
|
1032
1046
|
this._lexer.source,
|
|
1033
1047
|
this._lexer.token.start,
|
|
1034
1048
|
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
1035
1049
|
);
|
|
1036
|
-
if (
|
|
1037
|
-
switch (
|
|
1050
|
+
if (n.kind === a.NAME) {
|
|
1051
|
+
switch (n.value) {
|
|
1038
1052
|
case "schema":
|
|
1039
1053
|
return this.parseSchemaDefinition();
|
|
1040
1054
|
case "scalar":
|
|
@@ -1052,7 +1066,7 @@ class lt {
|
|
|
1052
1066
|
case "directive":
|
|
1053
1067
|
return this.parseDirectiveDefinition();
|
|
1054
1068
|
}
|
|
1055
|
-
switch (
|
|
1069
|
+
switch (n.value) {
|
|
1056
1070
|
case "query":
|
|
1057
1071
|
case "mutation":
|
|
1058
1072
|
case "subscription":
|
|
@@ -1060,16 +1074,16 @@ class lt {
|
|
|
1060
1074
|
case "fragment":
|
|
1061
1075
|
return this.parseFragmentDefinition();
|
|
1062
1076
|
}
|
|
1063
|
-
if (
|
|
1064
|
-
throw
|
|
1077
|
+
if (t)
|
|
1078
|
+
throw A(
|
|
1065
1079
|
this._lexer.source,
|
|
1066
1080
|
this._lexer.token.start,
|
|
1067
1081
|
"Unexpected description, only GraphQL definitions support descriptions."
|
|
1068
1082
|
);
|
|
1069
|
-
if (
|
|
1083
|
+
if (n.value === "extend")
|
|
1070
1084
|
return this.parseTypeSystemExtension();
|
|
1071
1085
|
}
|
|
1072
|
-
throw this.unexpected(
|
|
1086
|
+
throw this.unexpected(n);
|
|
1073
1087
|
}
|
|
1074
1088
|
// Implements the parsing rules in the Operations section.
|
|
1075
1089
|
/**
|
|
@@ -1078,24 +1092,24 @@ class lt {
|
|
|
1078
1092
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1079
1093
|
*/
|
|
1080
1094
|
parseOperationDefinition() {
|
|
1081
|
-
const
|
|
1095
|
+
const t = this._lexer.token;
|
|
1082
1096
|
if (this.peek(a.BRACE_L))
|
|
1083
|
-
return this.node(
|
|
1084
|
-
kind:
|
|
1085
|
-
operation:
|
|
1097
|
+
return this.node(t, {
|
|
1098
|
+
kind: l.OPERATION_DEFINITION,
|
|
1099
|
+
operation: w.QUERY,
|
|
1086
1100
|
description: void 0,
|
|
1087
1101
|
name: void 0,
|
|
1088
1102
|
variableDefinitions: [],
|
|
1089
1103
|
directives: [],
|
|
1090
1104
|
selectionSet: this.parseSelectionSet()
|
|
1091
1105
|
});
|
|
1092
|
-
const
|
|
1093
|
-
let
|
|
1094
|
-
return this.peek(a.NAME) && (
|
|
1095
|
-
kind:
|
|
1106
|
+
const n = this.parseDescription(), i = this.parseOperationType();
|
|
1107
|
+
let r;
|
|
1108
|
+
return this.peek(a.NAME) && (r = this.parseName()), this.node(t, {
|
|
1109
|
+
kind: l.OPERATION_DEFINITION,
|
|
1096
1110
|
operation: i,
|
|
1097
|
-
description:
|
|
1098
|
-
name:
|
|
1111
|
+
description: n,
|
|
1112
|
+
name: r,
|
|
1099
1113
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1100
1114
|
directives: this.parseDirectives(!1),
|
|
1101
1115
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1105,16 +1119,16 @@ class lt {
|
|
|
1105
1119
|
* OperationType : one of query mutation subscription
|
|
1106
1120
|
*/
|
|
1107
1121
|
parseOperationType() {
|
|
1108
|
-
const
|
|
1109
|
-
switch (
|
|
1122
|
+
const t = this.expectToken(a.NAME);
|
|
1123
|
+
switch (t.value) {
|
|
1110
1124
|
case "query":
|
|
1111
|
-
return
|
|
1125
|
+
return w.QUERY;
|
|
1112
1126
|
case "mutation":
|
|
1113
|
-
return
|
|
1127
|
+
return w.MUTATION;
|
|
1114
1128
|
case "subscription":
|
|
1115
|
-
return
|
|
1129
|
+
return w.SUBSCRIPTION;
|
|
1116
1130
|
}
|
|
1117
|
-
throw this.unexpected(
|
|
1131
|
+
throw this.unexpected(t);
|
|
1118
1132
|
}
|
|
1119
1133
|
/**
|
|
1120
1134
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
@@ -1131,7 +1145,7 @@ class lt {
|
|
|
1131
1145
|
*/
|
|
1132
1146
|
parseVariableDefinition() {
|
|
1133
1147
|
return this.node(this._lexer.token, {
|
|
1134
|
-
kind:
|
|
1148
|
+
kind: l.VARIABLE_DEFINITION,
|
|
1135
1149
|
description: this.parseDescription(),
|
|
1136
1150
|
variable: this.parseVariable(),
|
|
1137
1151
|
type: (this.expectToken(a.COLON), this.parseTypeReference()),
|
|
@@ -1143,9 +1157,9 @@ class lt {
|
|
|
1143
1157
|
* Variable : $ Name
|
|
1144
1158
|
*/
|
|
1145
1159
|
parseVariable() {
|
|
1146
|
-
const
|
|
1147
|
-
return this.expectToken(a.DOLLAR), this.node(
|
|
1148
|
-
kind:
|
|
1160
|
+
const t = this._lexer.token;
|
|
1161
|
+
return this.expectToken(a.DOLLAR), this.node(t, {
|
|
1162
|
+
kind: l.VARIABLE,
|
|
1149
1163
|
name: this.parseName()
|
|
1150
1164
|
});
|
|
1151
1165
|
}
|
|
@@ -1156,7 +1170,7 @@ class lt {
|
|
|
1156
1170
|
*/
|
|
1157
1171
|
parseSelectionSet() {
|
|
1158
1172
|
return this.node(this._lexer.token, {
|
|
1159
|
-
kind:
|
|
1173
|
+
kind: l.SELECTION_SET,
|
|
1160
1174
|
selections: this.many(
|
|
1161
1175
|
a.BRACE_L,
|
|
1162
1176
|
this.parseSelection,
|
|
@@ -1179,12 +1193,12 @@ class lt {
|
|
|
1179
1193
|
* Alias : Name :
|
|
1180
1194
|
*/
|
|
1181
1195
|
parseField() {
|
|
1182
|
-
const
|
|
1183
|
-
let i,
|
|
1184
|
-
return this.expectOptionalToken(a.COLON) ? (i =
|
|
1185
|
-
kind:
|
|
1196
|
+
const t = this._lexer.token, n = this.parseName();
|
|
1197
|
+
let i, r;
|
|
1198
|
+
return this.expectOptionalToken(a.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
|
|
1199
|
+
kind: l.FIELD,
|
|
1186
1200
|
alias: i,
|
|
1187
|
-
name:
|
|
1201
|
+
name: r,
|
|
1188
1202
|
arguments: this.parseArguments(!1),
|
|
1189
1203
|
directives: this.parseDirectives(!1),
|
|
1190
1204
|
selectionSet: this.peek(a.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
@@ -1193,19 +1207,19 @@ class lt {
|
|
|
1193
1207
|
/**
|
|
1194
1208
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1195
1209
|
*/
|
|
1196
|
-
parseArguments(
|
|
1197
|
-
const
|
|
1198
|
-
return this.optionalMany(a.PAREN_L,
|
|
1210
|
+
parseArguments(t) {
|
|
1211
|
+
const n = t ? this.parseConstArgument : this.parseArgument;
|
|
1212
|
+
return this.optionalMany(a.PAREN_L, n, a.PAREN_R);
|
|
1199
1213
|
}
|
|
1200
1214
|
/**
|
|
1201
1215
|
* Argument[Const] : Name : Value[?Const]
|
|
1202
1216
|
*/
|
|
1203
|
-
parseArgument(
|
|
1204
|
-
const
|
|
1205
|
-
return this.expectToken(a.COLON), this.node(
|
|
1206
|
-
kind:
|
|
1217
|
+
parseArgument(t = !1) {
|
|
1218
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1219
|
+
return this.expectToken(a.COLON), this.node(n, {
|
|
1220
|
+
kind: l.ARGUMENT,
|
|
1207
1221
|
name: i,
|
|
1208
|
-
value: this.parseValueLiteral(
|
|
1222
|
+
value: this.parseValueLiteral(t)
|
|
1209
1223
|
});
|
|
1210
1224
|
}
|
|
1211
1225
|
parseConstArgument() {
|
|
@@ -1220,16 +1234,16 @@ class lt {
|
|
|
1220
1234
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1221
1235
|
*/
|
|
1222
1236
|
parseFragment() {
|
|
1223
|
-
const
|
|
1237
|
+
const t = this._lexer.token;
|
|
1224
1238
|
this.expectToken(a.SPREAD);
|
|
1225
|
-
const
|
|
1226
|
-
return !
|
|
1227
|
-
kind:
|
|
1239
|
+
const n = this.expectOptionalKeyword("on");
|
|
1240
|
+
return !n && this.peek(a.NAME) ? this.node(t, {
|
|
1241
|
+
kind: l.FRAGMENT_SPREAD,
|
|
1228
1242
|
name: this.parseFragmentName(),
|
|
1229
1243
|
directives: this.parseDirectives(!1)
|
|
1230
|
-
}) : this.node(
|
|
1231
|
-
kind:
|
|
1232
|
-
typeCondition:
|
|
1244
|
+
}) : this.node(t, {
|
|
1245
|
+
kind: l.INLINE_FRAGMENT,
|
|
1246
|
+
typeCondition: n ? this.parseNamedType() : void 0,
|
|
1233
1247
|
directives: this.parseDirectives(!1),
|
|
1234
1248
|
selectionSet: this.parseSelectionSet()
|
|
1235
1249
|
});
|
|
@@ -1241,18 +1255,18 @@ class lt {
|
|
|
1241
1255
|
* TypeCondition : NamedType
|
|
1242
1256
|
*/
|
|
1243
1257
|
parseFragmentDefinition() {
|
|
1244
|
-
const
|
|
1245
|
-
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(
|
|
1246
|
-
kind:
|
|
1247
|
-
description:
|
|
1258
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1259
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
|
|
1260
|
+
kind: l.FRAGMENT_DEFINITION,
|
|
1261
|
+
description: n,
|
|
1248
1262
|
name: this.parseFragmentName(),
|
|
1249
1263
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1250
1264
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1251
1265
|
directives: this.parseDirectives(!1),
|
|
1252
1266
|
selectionSet: this.parseSelectionSet()
|
|
1253
|
-
}) : this.node(
|
|
1254
|
-
kind:
|
|
1255
|
-
description:
|
|
1267
|
+
}) : this.node(t, {
|
|
1268
|
+
kind: l.FRAGMENT_DEFINITION,
|
|
1269
|
+
description: n,
|
|
1256
1270
|
name: this.parseFragmentName(),
|
|
1257
1271
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1258
1272
|
directives: this.parseDirectives(!1),
|
|
@@ -1286,59 +1300,59 @@ class lt {
|
|
|
1286
1300
|
*
|
|
1287
1301
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1288
1302
|
*/
|
|
1289
|
-
parseValueLiteral(
|
|
1290
|
-
const
|
|
1291
|
-
switch (
|
|
1303
|
+
parseValueLiteral(t) {
|
|
1304
|
+
const n = this._lexer.token;
|
|
1305
|
+
switch (n.kind) {
|
|
1292
1306
|
case a.BRACKET_L:
|
|
1293
|
-
return this.parseList(
|
|
1307
|
+
return this.parseList(t);
|
|
1294
1308
|
case a.BRACE_L:
|
|
1295
|
-
return this.parseObject(
|
|
1309
|
+
return this.parseObject(t);
|
|
1296
1310
|
case a.INT:
|
|
1297
|
-
return this.advanceLexer(), this.node(
|
|
1298
|
-
kind:
|
|
1299
|
-
value:
|
|
1311
|
+
return this.advanceLexer(), this.node(n, {
|
|
1312
|
+
kind: l.INT,
|
|
1313
|
+
value: n.value
|
|
1300
1314
|
});
|
|
1301
1315
|
case a.FLOAT:
|
|
1302
|
-
return this.advanceLexer(), this.node(
|
|
1303
|
-
kind:
|
|
1304
|
-
value:
|
|
1316
|
+
return this.advanceLexer(), this.node(n, {
|
|
1317
|
+
kind: l.FLOAT,
|
|
1318
|
+
value: n.value
|
|
1305
1319
|
});
|
|
1306
1320
|
case a.STRING:
|
|
1307
1321
|
case a.BLOCK_STRING:
|
|
1308
1322
|
return this.parseStringLiteral();
|
|
1309
1323
|
case a.NAME:
|
|
1310
|
-
switch (this.advanceLexer(),
|
|
1324
|
+
switch (this.advanceLexer(), n.value) {
|
|
1311
1325
|
case "true":
|
|
1312
|
-
return this.node(
|
|
1313
|
-
kind:
|
|
1326
|
+
return this.node(n, {
|
|
1327
|
+
kind: l.BOOLEAN,
|
|
1314
1328
|
value: !0
|
|
1315
1329
|
});
|
|
1316
1330
|
case "false":
|
|
1317
|
-
return this.node(
|
|
1318
|
-
kind:
|
|
1331
|
+
return this.node(n, {
|
|
1332
|
+
kind: l.BOOLEAN,
|
|
1319
1333
|
value: !1
|
|
1320
1334
|
});
|
|
1321
1335
|
case "null":
|
|
1322
|
-
return this.node(
|
|
1323
|
-
kind:
|
|
1336
|
+
return this.node(n, {
|
|
1337
|
+
kind: l.NULL
|
|
1324
1338
|
});
|
|
1325
1339
|
default:
|
|
1326
|
-
return this.node(
|
|
1327
|
-
kind:
|
|
1328
|
-
value:
|
|
1340
|
+
return this.node(n, {
|
|
1341
|
+
kind: l.ENUM,
|
|
1342
|
+
value: n.value
|
|
1329
1343
|
});
|
|
1330
1344
|
}
|
|
1331
1345
|
case a.DOLLAR:
|
|
1332
|
-
if (
|
|
1346
|
+
if (t)
|
|
1333
1347
|
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1334
1348
|
const i = this._lexer.token.value;
|
|
1335
|
-
throw
|
|
1349
|
+
throw A(
|
|
1336
1350
|
this._lexer.source,
|
|
1337
|
-
|
|
1351
|
+
n.start,
|
|
1338
1352
|
`Unexpected variable "$${i}" in constant value.`
|
|
1339
1353
|
);
|
|
1340
1354
|
} else
|
|
1341
|
-
throw this.unexpected(
|
|
1355
|
+
throw this.unexpected(n);
|
|
1342
1356
|
return this.parseVariable();
|
|
1343
1357
|
default:
|
|
1344
1358
|
throw this.unexpected();
|
|
@@ -1348,11 +1362,11 @@ class lt {
|
|
|
1348
1362
|
return this.parseValueLiteral(!0);
|
|
1349
1363
|
}
|
|
1350
1364
|
parseStringLiteral() {
|
|
1351
|
-
const
|
|
1352
|
-
return this.advanceLexer(), this.node(
|
|
1353
|
-
kind:
|
|
1354
|
-
value:
|
|
1355
|
-
block:
|
|
1365
|
+
const t = this._lexer.token;
|
|
1366
|
+
return this.advanceLexer(), this.node(t, {
|
|
1367
|
+
kind: l.STRING,
|
|
1368
|
+
value: t.value,
|
|
1369
|
+
block: t.kind === a.BLOCK_STRING
|
|
1356
1370
|
});
|
|
1357
1371
|
}
|
|
1358
1372
|
/**
|
|
@@ -1360,11 +1374,11 @@ class lt {
|
|
|
1360
1374
|
* - [ ]
|
|
1361
1375
|
* - [ Value[?Const]+ ]
|
|
1362
1376
|
*/
|
|
1363
|
-
parseList(
|
|
1364
|
-
const
|
|
1377
|
+
parseList(t) {
|
|
1378
|
+
const n = () => this.parseValueLiteral(t);
|
|
1365
1379
|
return this.node(this._lexer.token, {
|
|
1366
|
-
kind:
|
|
1367
|
-
values: this.any(a.BRACKET_L,
|
|
1380
|
+
kind: l.LIST,
|
|
1381
|
+
values: this.any(a.BRACKET_L, n, a.BRACKET_R)
|
|
1368
1382
|
});
|
|
1369
1383
|
}
|
|
1370
1384
|
/**
|
|
@@ -1374,33 +1388,33 @@ class lt {
|
|
|
1374
1388
|
* - { ObjectField[?Const]+ }
|
|
1375
1389
|
* ```
|
|
1376
1390
|
*/
|
|
1377
|
-
parseObject(
|
|
1378
|
-
const
|
|
1391
|
+
parseObject(t) {
|
|
1392
|
+
const n = () => this.parseObjectField(t);
|
|
1379
1393
|
return this.node(this._lexer.token, {
|
|
1380
|
-
kind:
|
|
1381
|
-
fields: this.any(a.BRACE_L,
|
|
1394
|
+
kind: l.OBJECT,
|
|
1395
|
+
fields: this.any(a.BRACE_L, n, a.BRACE_R)
|
|
1382
1396
|
});
|
|
1383
1397
|
}
|
|
1384
1398
|
/**
|
|
1385
1399
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1386
1400
|
*/
|
|
1387
|
-
parseObjectField(
|
|
1388
|
-
const
|
|
1389
|
-
return this.expectToken(a.COLON), this.node(
|
|
1390
|
-
kind:
|
|
1401
|
+
parseObjectField(t) {
|
|
1402
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1403
|
+
return this.expectToken(a.COLON), this.node(n, {
|
|
1404
|
+
kind: l.OBJECT_FIELD,
|
|
1391
1405
|
name: i,
|
|
1392
|
-
value: this.parseValueLiteral(
|
|
1406
|
+
value: this.parseValueLiteral(t)
|
|
1393
1407
|
});
|
|
1394
1408
|
}
|
|
1395
1409
|
// Implements the parsing rules in the Directives section.
|
|
1396
1410
|
/**
|
|
1397
1411
|
* Directives[Const] : Directive[?Const]+
|
|
1398
1412
|
*/
|
|
1399
|
-
parseDirectives(
|
|
1400
|
-
const
|
|
1413
|
+
parseDirectives(t) {
|
|
1414
|
+
const n = [];
|
|
1401
1415
|
for (; this.peek(a.AT); )
|
|
1402
|
-
|
|
1403
|
-
return
|
|
1416
|
+
n.push(this.parseDirective(t));
|
|
1417
|
+
return n;
|
|
1404
1418
|
}
|
|
1405
1419
|
parseConstDirectives() {
|
|
1406
1420
|
return this.parseDirectives(!0);
|
|
@@ -1410,12 +1424,12 @@ class lt {
|
|
|
1410
1424
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1411
1425
|
* ```
|
|
1412
1426
|
*/
|
|
1413
|
-
parseDirective(
|
|
1414
|
-
const
|
|
1415
|
-
return this.expectToken(a.AT), this.node(
|
|
1416
|
-
kind:
|
|
1427
|
+
parseDirective(t) {
|
|
1428
|
+
const n = this._lexer.token;
|
|
1429
|
+
return this.expectToken(a.AT), this.node(n, {
|
|
1430
|
+
kind: l.DIRECTIVE,
|
|
1417
1431
|
name: this.parseName(),
|
|
1418
|
-
arguments: this.parseArguments(
|
|
1432
|
+
arguments: this.parseArguments(t)
|
|
1419
1433
|
});
|
|
1420
1434
|
}
|
|
1421
1435
|
// Implements the parsing rules in the Types section.
|
|
@@ -1426,27 +1440,27 @@ class lt {
|
|
|
1426
1440
|
* - NonNullType
|
|
1427
1441
|
*/
|
|
1428
1442
|
parseTypeReference() {
|
|
1429
|
-
const
|
|
1430
|
-
let
|
|
1443
|
+
const t = this._lexer.token;
|
|
1444
|
+
let n;
|
|
1431
1445
|
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1432
1446
|
const i = this.parseTypeReference();
|
|
1433
|
-
this.expectToken(a.BRACKET_R),
|
|
1434
|
-
kind:
|
|
1447
|
+
this.expectToken(a.BRACKET_R), n = this.node(t, {
|
|
1448
|
+
kind: l.LIST_TYPE,
|
|
1435
1449
|
type: i
|
|
1436
1450
|
});
|
|
1437
1451
|
} else
|
|
1438
|
-
|
|
1439
|
-
return this.expectOptionalToken(a.BANG) ? this.node(
|
|
1440
|
-
kind:
|
|
1441
|
-
type:
|
|
1442
|
-
}) :
|
|
1452
|
+
n = this.parseNamedType();
|
|
1453
|
+
return this.expectOptionalToken(a.BANG) ? this.node(t, {
|
|
1454
|
+
kind: l.NON_NULL_TYPE,
|
|
1455
|
+
type: n
|
|
1456
|
+
}) : n;
|
|
1443
1457
|
}
|
|
1444
1458
|
/**
|
|
1445
1459
|
* NamedType : Name
|
|
1446
1460
|
*/
|
|
1447
1461
|
parseNamedType() {
|
|
1448
1462
|
return this.node(this._lexer.token, {
|
|
1449
|
-
kind:
|
|
1463
|
+
kind: l.NAMED_TYPE,
|
|
1450
1464
|
name: this.parseName()
|
|
1451
1465
|
});
|
|
1452
1466
|
}
|
|
@@ -1467,30 +1481,30 @@ class lt {
|
|
|
1467
1481
|
* ```
|
|
1468
1482
|
*/
|
|
1469
1483
|
parseSchemaDefinition() {
|
|
1470
|
-
const
|
|
1484
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1471
1485
|
this.expectKeyword("schema");
|
|
1472
|
-
const i = this.parseConstDirectives(),
|
|
1486
|
+
const i = this.parseConstDirectives(), r = this.many(
|
|
1473
1487
|
a.BRACE_L,
|
|
1474
1488
|
this.parseOperationTypeDefinition,
|
|
1475
1489
|
a.BRACE_R
|
|
1476
1490
|
);
|
|
1477
|
-
return this.node(
|
|
1478
|
-
kind:
|
|
1479
|
-
description:
|
|
1491
|
+
return this.node(t, {
|
|
1492
|
+
kind: l.SCHEMA_DEFINITION,
|
|
1493
|
+
description: n,
|
|
1480
1494
|
directives: i,
|
|
1481
|
-
operationTypes:
|
|
1495
|
+
operationTypes: r
|
|
1482
1496
|
});
|
|
1483
1497
|
}
|
|
1484
1498
|
/**
|
|
1485
1499
|
* OperationTypeDefinition : OperationType : NamedType
|
|
1486
1500
|
*/
|
|
1487
1501
|
parseOperationTypeDefinition() {
|
|
1488
|
-
const
|
|
1502
|
+
const t = this._lexer.token, n = this.parseOperationType();
|
|
1489
1503
|
this.expectToken(a.COLON);
|
|
1490
1504
|
const i = this.parseNamedType();
|
|
1491
|
-
return this.node(
|
|
1492
|
-
kind:
|
|
1493
|
-
operation:
|
|
1505
|
+
return this.node(t, {
|
|
1506
|
+
kind: l.OPERATION_TYPE_DEFINITION,
|
|
1507
|
+
operation: n,
|
|
1494
1508
|
type: i
|
|
1495
1509
|
});
|
|
1496
1510
|
}
|
|
@@ -1498,14 +1512,14 @@ class lt {
|
|
|
1498
1512
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1499
1513
|
*/
|
|
1500
1514
|
parseScalarTypeDefinition() {
|
|
1501
|
-
const
|
|
1515
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1502
1516
|
this.expectKeyword("scalar");
|
|
1503
|
-
const i = this.parseName(),
|
|
1504
|
-
return this.node(
|
|
1505
|
-
kind:
|
|
1506
|
-
description:
|
|
1517
|
+
const i = this.parseName(), r = this.parseConstDirectives();
|
|
1518
|
+
return this.node(t, {
|
|
1519
|
+
kind: l.SCALAR_TYPE_DEFINITION,
|
|
1520
|
+
description: n,
|
|
1507
1521
|
name: i,
|
|
1508
|
-
directives:
|
|
1522
|
+
directives: r
|
|
1509
1523
|
});
|
|
1510
1524
|
}
|
|
1511
1525
|
/**
|
|
@@ -1514,14 +1528,14 @@ class lt {
|
|
|
1514
1528
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1515
1529
|
*/
|
|
1516
1530
|
parseObjectTypeDefinition() {
|
|
1517
|
-
const
|
|
1531
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1518
1532
|
this.expectKeyword("type");
|
|
1519
|
-
const i = this.parseName(),
|
|
1520
|
-
return this.node(
|
|
1521
|
-
kind:
|
|
1522
|
-
description:
|
|
1533
|
+
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1534
|
+
return this.node(t, {
|
|
1535
|
+
kind: l.OBJECT_TYPE_DEFINITION,
|
|
1536
|
+
description: n,
|
|
1523
1537
|
name: i,
|
|
1524
|
-
interfaces:
|
|
1538
|
+
interfaces: r,
|
|
1525
1539
|
directives: s,
|
|
1526
1540
|
fields: o
|
|
1527
1541
|
});
|
|
@@ -1551,14 +1565,14 @@ class lt {
|
|
|
1551
1565
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1552
1566
|
*/
|
|
1553
1567
|
parseFieldDefinition() {
|
|
1554
|
-
const
|
|
1568
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
1555
1569
|
this.expectToken(a.COLON);
|
|
1556
1570
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1557
|
-
return this.node(
|
|
1558
|
-
kind:
|
|
1559
|
-
description:
|
|
1571
|
+
return this.node(t, {
|
|
1572
|
+
kind: l.FIELD_DEFINITION,
|
|
1573
|
+
description: n,
|
|
1560
1574
|
name: i,
|
|
1561
|
-
arguments:
|
|
1575
|
+
arguments: r,
|
|
1562
1576
|
type: s,
|
|
1563
1577
|
directives: o
|
|
1564
1578
|
});
|
|
@@ -1578,17 +1592,17 @@ class lt {
|
|
|
1578
1592
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1579
1593
|
*/
|
|
1580
1594
|
parseInputValueDef() {
|
|
1581
|
-
const
|
|
1595
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
|
|
1582
1596
|
this.expectToken(a.COLON);
|
|
1583
|
-
const
|
|
1597
|
+
const r = this.parseTypeReference();
|
|
1584
1598
|
let s;
|
|
1585
1599
|
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1586
1600
|
const o = this.parseConstDirectives();
|
|
1587
|
-
return this.node(
|
|
1588
|
-
kind:
|
|
1589
|
-
description:
|
|
1601
|
+
return this.node(t, {
|
|
1602
|
+
kind: l.INPUT_VALUE_DEFINITION,
|
|
1603
|
+
description: n,
|
|
1590
1604
|
name: i,
|
|
1591
|
-
type:
|
|
1605
|
+
type: r,
|
|
1592
1606
|
defaultValue: s,
|
|
1593
1607
|
directives: o
|
|
1594
1608
|
});
|
|
@@ -1598,14 +1612,14 @@ class lt {
|
|
|
1598
1612
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1599
1613
|
*/
|
|
1600
1614
|
parseInterfaceTypeDefinition() {
|
|
1601
|
-
const
|
|
1615
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1602
1616
|
this.expectKeyword("interface");
|
|
1603
|
-
const i = this.parseName(),
|
|
1604
|
-
return this.node(
|
|
1605
|
-
kind:
|
|
1606
|
-
description:
|
|
1617
|
+
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1618
|
+
return this.node(t, {
|
|
1619
|
+
kind: l.INTERFACE_TYPE_DEFINITION,
|
|
1620
|
+
description: n,
|
|
1607
1621
|
name: i,
|
|
1608
|
-
interfaces:
|
|
1622
|
+
interfaces: r,
|
|
1609
1623
|
directives: s,
|
|
1610
1624
|
fields: o
|
|
1611
1625
|
});
|
|
@@ -1615,14 +1629,14 @@ class lt {
|
|
|
1615
1629
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1616
1630
|
*/
|
|
1617
1631
|
parseUnionTypeDefinition() {
|
|
1618
|
-
const
|
|
1632
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1619
1633
|
this.expectKeyword("union");
|
|
1620
|
-
const i = this.parseName(),
|
|
1621
|
-
return this.node(
|
|
1622
|
-
kind:
|
|
1623
|
-
description:
|
|
1634
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1635
|
+
return this.node(t, {
|
|
1636
|
+
kind: l.UNION_TYPE_DEFINITION,
|
|
1637
|
+
description: n,
|
|
1624
1638
|
name: i,
|
|
1625
|
-
directives:
|
|
1639
|
+
directives: r,
|
|
1626
1640
|
types: s
|
|
1627
1641
|
});
|
|
1628
1642
|
}
|
|
@@ -1639,14 +1653,14 @@ class lt {
|
|
|
1639
1653
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1640
1654
|
*/
|
|
1641
1655
|
parseEnumTypeDefinition() {
|
|
1642
|
-
const
|
|
1656
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1643
1657
|
this.expectKeyword("enum");
|
|
1644
|
-
const i = this.parseName(),
|
|
1645
|
-
return this.node(
|
|
1646
|
-
kind:
|
|
1647
|
-
description:
|
|
1658
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1659
|
+
return this.node(t, {
|
|
1660
|
+
kind: l.ENUM_TYPE_DEFINITION,
|
|
1661
|
+
description: n,
|
|
1648
1662
|
name: i,
|
|
1649
|
-
directives:
|
|
1663
|
+
directives: r,
|
|
1650
1664
|
values: s
|
|
1651
1665
|
});
|
|
1652
1666
|
}
|
|
@@ -1666,12 +1680,12 @@ class lt {
|
|
|
1666
1680
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1667
1681
|
*/
|
|
1668
1682
|
parseEnumValueDefinition() {
|
|
1669
|
-
const
|
|
1670
|
-
return this.node(
|
|
1671
|
-
kind:
|
|
1672
|
-
description:
|
|
1683
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1684
|
+
return this.node(t, {
|
|
1685
|
+
kind: l.ENUM_VALUE_DEFINITION,
|
|
1686
|
+
description: n,
|
|
1673
1687
|
name: i,
|
|
1674
|
-
directives:
|
|
1688
|
+
directives: r
|
|
1675
1689
|
});
|
|
1676
1690
|
}
|
|
1677
1691
|
/**
|
|
@@ -1679,10 +1693,10 @@ class lt {
|
|
|
1679
1693
|
*/
|
|
1680
1694
|
parseEnumValueName() {
|
|
1681
1695
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
1682
|
-
throw
|
|
1696
|
+
throw A(
|
|
1683
1697
|
this._lexer.source,
|
|
1684
1698
|
this._lexer.token.start,
|
|
1685
|
-
`${
|
|
1699
|
+
`${z(
|
|
1686
1700
|
this._lexer.token
|
|
1687
1701
|
)} is reserved and cannot be used for an enum value.`
|
|
1688
1702
|
);
|
|
@@ -1693,14 +1707,14 @@ class lt {
|
|
|
1693
1707
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1694
1708
|
*/
|
|
1695
1709
|
parseInputObjectTypeDefinition() {
|
|
1696
|
-
const
|
|
1710
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1697
1711
|
this.expectKeyword("input");
|
|
1698
|
-
const i = this.parseName(),
|
|
1699
|
-
return this.node(
|
|
1700
|
-
kind:
|
|
1701
|
-
description:
|
|
1712
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1713
|
+
return this.node(t, {
|
|
1714
|
+
kind: l.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1715
|
+
description: n,
|
|
1702
1716
|
name: i,
|
|
1703
|
-
directives:
|
|
1717
|
+
directives: r,
|
|
1704
1718
|
fields: s
|
|
1705
1719
|
});
|
|
1706
1720
|
}
|
|
@@ -1730,9 +1744,9 @@ class lt {
|
|
|
1730
1744
|
* - InputObjectTypeDefinition
|
|
1731
1745
|
*/
|
|
1732
1746
|
parseTypeSystemExtension() {
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
switch (
|
|
1747
|
+
const t = this._lexer.lookahead();
|
|
1748
|
+
if (t.kind === a.NAME)
|
|
1749
|
+
switch (t.value) {
|
|
1736
1750
|
case "schema":
|
|
1737
1751
|
return this.parseSchemaExtension();
|
|
1738
1752
|
case "scalar":
|
|
@@ -1748,7 +1762,7 @@ class lt {
|
|
|
1748
1762
|
case "input":
|
|
1749
1763
|
return this.parseInputObjectTypeExtension();
|
|
1750
1764
|
}
|
|
1751
|
-
throw this.unexpected(
|
|
1765
|
+
throw this.unexpected(t);
|
|
1752
1766
|
}
|
|
1753
1767
|
/**
|
|
1754
1768
|
* ```
|
|
@@ -1758,18 +1772,18 @@ class lt {
|
|
|
1758
1772
|
* ```
|
|
1759
1773
|
*/
|
|
1760
1774
|
parseSchemaExtension() {
|
|
1761
|
-
const
|
|
1775
|
+
const t = this._lexer.token;
|
|
1762
1776
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1763
|
-
const
|
|
1777
|
+
const n = this.parseConstDirectives(), i = this.optionalMany(
|
|
1764
1778
|
a.BRACE_L,
|
|
1765
1779
|
this.parseOperationTypeDefinition,
|
|
1766
1780
|
a.BRACE_R
|
|
1767
1781
|
);
|
|
1768
|
-
if (
|
|
1782
|
+
if (n.length === 0 && i.length === 0)
|
|
1769
1783
|
throw this.unexpected();
|
|
1770
|
-
return this.node(
|
|
1771
|
-
kind:
|
|
1772
|
-
directives:
|
|
1784
|
+
return this.node(t, {
|
|
1785
|
+
kind: l.SCHEMA_EXTENSION,
|
|
1786
|
+
directives: n,
|
|
1773
1787
|
operationTypes: i
|
|
1774
1788
|
});
|
|
1775
1789
|
}
|
|
@@ -1778,14 +1792,14 @@ class lt {
|
|
|
1778
1792
|
* - extend scalar Name Directives[Const]
|
|
1779
1793
|
*/
|
|
1780
1794
|
parseScalarTypeExtension() {
|
|
1781
|
-
const
|
|
1795
|
+
const t = this._lexer.token;
|
|
1782
1796
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1783
|
-
const
|
|
1797
|
+
const n = this.parseName(), i = this.parseConstDirectives();
|
|
1784
1798
|
if (i.length === 0)
|
|
1785
1799
|
throw this.unexpected();
|
|
1786
|
-
return this.node(
|
|
1787
|
-
kind:
|
|
1788
|
-
name:
|
|
1800
|
+
return this.node(t, {
|
|
1801
|
+
kind: l.SCALAR_TYPE_EXTENSION,
|
|
1802
|
+
name: n,
|
|
1789
1803
|
directives: i
|
|
1790
1804
|
});
|
|
1791
1805
|
}
|
|
@@ -1796,16 +1810,16 @@ class lt {
|
|
|
1796
1810
|
* - extend type Name ImplementsInterfaces
|
|
1797
1811
|
*/
|
|
1798
1812
|
parseObjectTypeExtension() {
|
|
1799
|
-
const
|
|
1813
|
+
const t = this._lexer.token;
|
|
1800
1814
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1801
|
-
const
|
|
1802
|
-
if (i.length === 0 &&
|
|
1815
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1816
|
+
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1803
1817
|
throw this.unexpected();
|
|
1804
|
-
return this.node(
|
|
1805
|
-
kind:
|
|
1806
|
-
name:
|
|
1818
|
+
return this.node(t, {
|
|
1819
|
+
kind: l.OBJECT_TYPE_EXTENSION,
|
|
1820
|
+
name: n,
|
|
1807
1821
|
interfaces: i,
|
|
1808
|
-
directives:
|
|
1822
|
+
directives: r,
|
|
1809
1823
|
fields: s
|
|
1810
1824
|
});
|
|
1811
1825
|
}
|
|
@@ -1816,16 +1830,16 @@ class lt {
|
|
|
1816
1830
|
* - extend interface Name ImplementsInterfaces
|
|
1817
1831
|
*/
|
|
1818
1832
|
parseInterfaceTypeExtension() {
|
|
1819
|
-
const
|
|
1833
|
+
const t = this._lexer.token;
|
|
1820
1834
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1821
|
-
const
|
|
1822
|
-
if (i.length === 0 &&
|
|
1835
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1836
|
+
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1823
1837
|
throw this.unexpected();
|
|
1824
|
-
return this.node(
|
|
1825
|
-
kind:
|
|
1826
|
-
name:
|
|
1838
|
+
return this.node(t, {
|
|
1839
|
+
kind: l.INTERFACE_TYPE_EXTENSION,
|
|
1840
|
+
name: n,
|
|
1827
1841
|
interfaces: i,
|
|
1828
|
-
directives:
|
|
1842
|
+
directives: r,
|
|
1829
1843
|
fields: s
|
|
1830
1844
|
});
|
|
1831
1845
|
}
|
|
@@ -1835,16 +1849,16 @@ class lt {
|
|
|
1835
1849
|
* - extend union Name Directives[Const]
|
|
1836
1850
|
*/
|
|
1837
1851
|
parseUnionTypeExtension() {
|
|
1838
|
-
const
|
|
1852
|
+
const t = this._lexer.token;
|
|
1839
1853
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1840
|
-
const
|
|
1841
|
-
if (i.length === 0 &&
|
|
1854
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1855
|
+
if (i.length === 0 && r.length === 0)
|
|
1842
1856
|
throw this.unexpected();
|
|
1843
|
-
return this.node(
|
|
1844
|
-
kind:
|
|
1845
|
-
name:
|
|
1857
|
+
return this.node(t, {
|
|
1858
|
+
kind: l.UNION_TYPE_EXTENSION,
|
|
1859
|
+
name: n,
|
|
1846
1860
|
directives: i,
|
|
1847
|
-
types:
|
|
1861
|
+
types: r
|
|
1848
1862
|
});
|
|
1849
1863
|
}
|
|
1850
1864
|
/**
|
|
@@ -1853,16 +1867,16 @@ class lt {
|
|
|
1853
1867
|
* - extend enum Name Directives[Const]
|
|
1854
1868
|
*/
|
|
1855
1869
|
parseEnumTypeExtension() {
|
|
1856
|
-
const
|
|
1870
|
+
const t = this._lexer.token;
|
|
1857
1871
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1858
|
-
const
|
|
1859
|
-
if (i.length === 0 &&
|
|
1872
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1873
|
+
if (i.length === 0 && r.length === 0)
|
|
1860
1874
|
throw this.unexpected();
|
|
1861
|
-
return this.node(
|
|
1862
|
-
kind:
|
|
1863
|
-
name:
|
|
1875
|
+
return this.node(t, {
|
|
1876
|
+
kind: l.ENUM_TYPE_EXTENSION,
|
|
1877
|
+
name: n,
|
|
1864
1878
|
directives: i,
|
|
1865
|
-
values:
|
|
1879
|
+
values: r
|
|
1866
1880
|
});
|
|
1867
1881
|
}
|
|
1868
1882
|
/**
|
|
@@ -1871,16 +1885,16 @@ class lt {
|
|
|
1871
1885
|
* - extend input Name Directives[Const]
|
|
1872
1886
|
*/
|
|
1873
1887
|
parseInputObjectTypeExtension() {
|
|
1874
|
-
const
|
|
1888
|
+
const t = this._lexer.token;
|
|
1875
1889
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1876
|
-
const
|
|
1877
|
-
if (i.length === 0 &&
|
|
1890
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1891
|
+
if (i.length === 0 && r.length === 0)
|
|
1878
1892
|
throw this.unexpected();
|
|
1879
|
-
return this.node(
|
|
1880
|
-
kind:
|
|
1881
|
-
name:
|
|
1893
|
+
return this.node(t, {
|
|
1894
|
+
kind: l.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1895
|
+
name: n,
|
|
1882
1896
|
directives: i,
|
|
1883
|
-
fields:
|
|
1897
|
+
fields: r
|
|
1884
1898
|
});
|
|
1885
1899
|
}
|
|
1886
1900
|
/**
|
|
@@ -1890,16 +1904,16 @@ class lt {
|
|
|
1890
1904
|
* ```
|
|
1891
1905
|
*/
|
|
1892
1906
|
parseDirectiveDefinition() {
|
|
1893
|
-
const
|
|
1907
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1894
1908
|
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1895
|
-
const i = this.parseName(),
|
|
1909
|
+
const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1896
1910
|
this.expectKeyword("on");
|
|
1897
1911
|
const o = this.parseDirectiveLocations();
|
|
1898
|
-
return this.node(
|
|
1899
|
-
kind:
|
|
1900
|
-
description:
|
|
1912
|
+
return this.node(t, {
|
|
1913
|
+
kind: l.DIRECTIVE_DEFINITION,
|
|
1914
|
+
description: n,
|
|
1901
1915
|
name: i,
|
|
1902
|
-
arguments:
|
|
1916
|
+
arguments: r,
|
|
1903
1917
|
repeatable: s,
|
|
1904
1918
|
locations: o
|
|
1905
1919
|
});
|
|
@@ -1940,10 +1954,10 @@ class lt {
|
|
|
1940
1954
|
* `INPUT_FIELD_DEFINITION`
|
|
1941
1955
|
*/
|
|
1942
1956
|
parseDirectiveLocation() {
|
|
1943
|
-
const
|
|
1944
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1945
|
-
return
|
|
1946
|
-
throw this.unexpected(
|
|
1957
|
+
const t = this._lexer.token, n = this.parseName();
|
|
1958
|
+
if (Object.prototype.hasOwnProperty.call(ie, n.value))
|
|
1959
|
+
return n;
|
|
1960
|
+
throw this.unexpected(t);
|
|
1947
1961
|
}
|
|
1948
1962
|
// Schema Coordinates
|
|
1949
1963
|
/**
|
|
@@ -1955,28 +1969,28 @@ class lt {
|
|
|
1955
1969
|
* - \@ Name ( Name : )
|
|
1956
1970
|
*/
|
|
1957
1971
|
parseSchemaCoordinate() {
|
|
1958
|
-
const
|
|
1959
|
-
let
|
|
1960
|
-
!
|
|
1972
|
+
const t = this._lexer.token, n = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1973
|
+
let r;
|
|
1974
|
+
!n && this.expectOptionalToken(a.DOT) && (r = this.parseName());
|
|
1961
1975
|
let s;
|
|
1962
|
-
return (
|
|
1963
|
-
kind:
|
|
1976
|
+
return (n || r) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), n ? s ? this.node(t, {
|
|
1977
|
+
kind: l.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1964
1978
|
name: i,
|
|
1965
1979
|
argumentName: s
|
|
1966
|
-
}) : this.node(
|
|
1967
|
-
kind:
|
|
1980
|
+
}) : this.node(t, {
|
|
1981
|
+
kind: l.DIRECTIVE_COORDINATE,
|
|
1968
1982
|
name: i
|
|
1969
|
-
}) :
|
|
1970
|
-
kind:
|
|
1983
|
+
}) : r ? s ? this.node(t, {
|
|
1984
|
+
kind: l.ARGUMENT_COORDINATE,
|
|
1971
1985
|
name: i,
|
|
1972
|
-
fieldName:
|
|
1986
|
+
fieldName: r,
|
|
1973
1987
|
argumentName: s
|
|
1974
|
-
}) : this.node(
|
|
1975
|
-
kind:
|
|
1988
|
+
}) : this.node(t, {
|
|
1989
|
+
kind: l.MEMBER_COORDINATE,
|
|
1976
1990
|
name: i,
|
|
1977
|
-
memberName:
|
|
1978
|
-
}) : this.node(
|
|
1979
|
-
kind:
|
|
1991
|
+
memberName: r
|
|
1992
|
+
}) : this.node(t, {
|
|
1993
|
+
kind: l.TYPE_COORDINATE,
|
|
1980
1994
|
name: i
|
|
1981
1995
|
});
|
|
1982
1996
|
}
|
|
@@ -1986,72 +2000,72 @@ class lt {
|
|
|
1986
2000
|
* location object, used to identify the place in the source that created a
|
|
1987
2001
|
* given parsed object.
|
|
1988
2002
|
*/
|
|
1989
|
-
node(
|
|
1990
|
-
return this._options.noLocation !== !0 && (
|
|
1991
|
-
|
|
2003
|
+
node(t, n) {
|
|
2004
|
+
return this._options.noLocation !== !0 && (n.loc = new rt(
|
|
2005
|
+
t,
|
|
1992
2006
|
this._lexer.lastToken,
|
|
1993
2007
|
this._lexer.source
|
|
1994
|
-
)),
|
|
2008
|
+
)), n;
|
|
1995
2009
|
}
|
|
1996
2010
|
/**
|
|
1997
2011
|
* Determines if the next token is of a given kind
|
|
1998
2012
|
*/
|
|
1999
|
-
peek(
|
|
2000
|
-
return this._lexer.token.kind ===
|
|
2013
|
+
peek(t) {
|
|
2014
|
+
return this._lexer.token.kind === t;
|
|
2001
2015
|
}
|
|
2002
2016
|
/**
|
|
2003
2017
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2004
2018
|
* Otherwise, do not change the parser state and throw an error.
|
|
2005
2019
|
*/
|
|
2006
|
-
expectToken(
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
2009
|
-
return this.advanceLexer(),
|
|
2010
|
-
throw
|
|
2020
|
+
expectToken(t) {
|
|
2021
|
+
const n = this._lexer.token;
|
|
2022
|
+
if (n.kind === t)
|
|
2023
|
+
return this.advanceLexer(), n;
|
|
2024
|
+
throw A(
|
|
2011
2025
|
this._lexer.source,
|
|
2012
|
-
|
|
2013
|
-
`Expected ${
|
|
2026
|
+
n.start,
|
|
2027
|
+
`Expected ${Le(t)}, found ${z(n)}.`
|
|
2014
2028
|
);
|
|
2015
2029
|
}
|
|
2016
2030
|
/**
|
|
2017
2031
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2018
2032
|
* Otherwise, do not change the parser state and return "false".
|
|
2019
2033
|
*/
|
|
2020
|
-
expectOptionalToken(
|
|
2021
|
-
return this._lexer.token.kind ===
|
|
2034
|
+
expectOptionalToken(t) {
|
|
2035
|
+
return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
|
|
2022
2036
|
}
|
|
2023
2037
|
/**
|
|
2024
2038
|
* If the next token is a given keyword, advance the lexer.
|
|
2025
2039
|
* Otherwise, do not change the parser state and throw an error.
|
|
2026
2040
|
*/
|
|
2027
|
-
expectKeyword(
|
|
2028
|
-
const
|
|
2029
|
-
if (
|
|
2041
|
+
expectKeyword(t) {
|
|
2042
|
+
const n = this._lexer.token;
|
|
2043
|
+
if (n.kind === a.NAME && n.value === t)
|
|
2030
2044
|
this.advanceLexer();
|
|
2031
2045
|
else
|
|
2032
|
-
throw
|
|
2046
|
+
throw A(
|
|
2033
2047
|
this._lexer.source,
|
|
2034
|
-
|
|
2035
|
-
`Expected "${
|
|
2048
|
+
n.start,
|
|
2049
|
+
`Expected "${t}", found ${z(n)}.`
|
|
2036
2050
|
);
|
|
2037
2051
|
}
|
|
2038
2052
|
/**
|
|
2039
2053
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2040
2054
|
* Otherwise, do not change the parser state and return "false".
|
|
2041
2055
|
*/
|
|
2042
|
-
expectOptionalKeyword(
|
|
2043
|
-
const
|
|
2044
|
-
return
|
|
2056
|
+
expectOptionalKeyword(t) {
|
|
2057
|
+
const n = this._lexer.token;
|
|
2058
|
+
return n.kind === a.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
|
|
2045
2059
|
}
|
|
2046
2060
|
/**
|
|
2047
2061
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2048
2062
|
*/
|
|
2049
|
-
unexpected(
|
|
2050
|
-
const
|
|
2051
|
-
return
|
|
2063
|
+
unexpected(t) {
|
|
2064
|
+
const n = t ?? this._lexer.token;
|
|
2065
|
+
return A(
|
|
2052
2066
|
this._lexer.source,
|
|
2053
|
-
|
|
2054
|
-
`Unexpected ${
|
|
2067
|
+
n.start,
|
|
2068
|
+
`Unexpected ${z(n)}.`
|
|
2055
2069
|
);
|
|
2056
2070
|
}
|
|
2057
2071
|
/**
|
|
@@ -2059,12 +2073,12 @@ class lt {
|
|
|
2059
2073
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2060
2074
|
* Advances the parser to the next lex token after the closing token.
|
|
2061
2075
|
*/
|
|
2062
|
-
any(
|
|
2063
|
-
this.expectToken(
|
|
2064
|
-
const
|
|
2076
|
+
any(t, n, i) {
|
|
2077
|
+
this.expectToken(t);
|
|
2078
|
+
const r = [];
|
|
2065
2079
|
for (; !this.expectOptionalToken(i); )
|
|
2066
|
-
|
|
2067
|
-
return
|
|
2080
|
+
r.push(n.call(this));
|
|
2081
|
+
return r;
|
|
2068
2082
|
}
|
|
2069
2083
|
/**
|
|
2070
2084
|
* Returns a list of parse nodes, determined by the parseFn.
|
|
@@ -2072,13 +2086,13 @@ class lt {
|
|
|
2072
2086
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2073
2087
|
* Advances the parser to the next lex token after the closing token.
|
|
2074
2088
|
*/
|
|
2075
|
-
optionalMany(
|
|
2076
|
-
if (this.expectOptionalToken(
|
|
2077
|
-
const
|
|
2089
|
+
optionalMany(t, n, i) {
|
|
2090
|
+
if (this.expectOptionalToken(t)) {
|
|
2091
|
+
const r = [];
|
|
2078
2092
|
do
|
|
2079
|
-
|
|
2093
|
+
r.push(n.call(this));
|
|
2080
2094
|
while (!this.expectOptionalToken(i));
|
|
2081
|
-
return
|
|
2095
|
+
return r;
|
|
2082
2096
|
}
|
|
2083
2097
|
return [];
|
|
2084
2098
|
}
|
|
@@ -2087,121 +2101,659 @@ class lt {
|
|
|
2087
2101
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2088
2102
|
* Advances the parser to the next lex token after the closing token.
|
|
2089
2103
|
*/
|
|
2090
|
-
many(
|
|
2091
|
-
this.expectToken(
|
|
2092
|
-
const
|
|
2104
|
+
many(t, n, i) {
|
|
2105
|
+
this.expectToken(t);
|
|
2106
|
+
const r = [];
|
|
2093
2107
|
do
|
|
2094
|
-
|
|
2108
|
+
r.push(n.call(this));
|
|
2095
2109
|
while (!this.expectOptionalToken(i));
|
|
2096
|
-
return
|
|
2110
|
+
return r;
|
|
2097
2111
|
}
|
|
2098
2112
|
/**
|
|
2099
2113
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2100
2114
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2101
2115
|
* Advances the parser to the next lex token after last item in the list.
|
|
2102
2116
|
*/
|
|
2103
|
-
delimitedMany(
|
|
2104
|
-
this.expectOptionalToken(
|
|
2117
|
+
delimitedMany(t, n) {
|
|
2118
|
+
this.expectOptionalToken(t);
|
|
2105
2119
|
const i = [];
|
|
2106
2120
|
do
|
|
2107
|
-
i.push(
|
|
2108
|
-
while (this.expectOptionalToken(
|
|
2121
|
+
i.push(n.call(this));
|
|
2122
|
+
while (this.expectOptionalToken(t));
|
|
2109
2123
|
return i;
|
|
2110
2124
|
}
|
|
2111
2125
|
advanceLexer() {
|
|
2112
|
-
const { maxTokens:
|
|
2113
|
-
if (
|
|
2114
|
-
throw
|
|
2126
|
+
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
2127
|
+
if (n.kind !== a.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
|
|
2128
|
+
throw A(
|
|
2115
2129
|
this._lexer.source,
|
|
2116
|
-
|
|
2117
|
-
`Document contains more that ${
|
|
2130
|
+
n.start,
|
|
2131
|
+
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
2118
2132
|
);
|
|
2119
2133
|
}
|
|
2120
2134
|
}
|
|
2121
|
-
function
|
|
2122
|
-
const
|
|
2123
|
-
return
|
|
2135
|
+
function z(e) {
|
|
2136
|
+
const t = e.value;
|
|
2137
|
+
return Le(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2124
2138
|
}
|
|
2125
|
-
function
|
|
2126
|
-
return
|
|
2139
|
+
function Le(e) {
|
|
2140
|
+
return ut(e) ? `"${e}"` : e;
|
|
2127
2141
|
}
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
return r.replace(/[\s,]+/g, " ").trim();
|
|
2142
|
+
function Ct(e) {
|
|
2143
|
+
return `"${e.replace(_t, Lt)}"`;
|
|
2131
2144
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2145
|
+
const _t = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
2146
|
+
function Lt(e) {
|
|
2147
|
+
return Rt[e.charCodeAt(0)];
|
|
2134
2148
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2149
|
+
const Rt = [
|
|
2150
|
+
"\\u0000",
|
|
2151
|
+
"\\u0001",
|
|
2152
|
+
"\\u0002",
|
|
2153
|
+
"\\u0003",
|
|
2154
|
+
"\\u0004",
|
|
2155
|
+
"\\u0005",
|
|
2156
|
+
"\\u0006",
|
|
2157
|
+
"\\u0007",
|
|
2158
|
+
"\\b",
|
|
2159
|
+
"\\t",
|
|
2160
|
+
"\\n",
|
|
2161
|
+
"\\u000B",
|
|
2162
|
+
"\\f",
|
|
2163
|
+
"\\r",
|
|
2164
|
+
"\\u000E",
|
|
2165
|
+
"\\u000F",
|
|
2166
|
+
"\\u0010",
|
|
2167
|
+
"\\u0011",
|
|
2168
|
+
"\\u0012",
|
|
2169
|
+
"\\u0013",
|
|
2170
|
+
"\\u0014",
|
|
2171
|
+
"\\u0015",
|
|
2172
|
+
"\\u0016",
|
|
2173
|
+
"\\u0017",
|
|
2174
|
+
"\\u0018",
|
|
2175
|
+
"\\u0019",
|
|
2176
|
+
"\\u001A",
|
|
2177
|
+
"\\u001B",
|
|
2178
|
+
"\\u001C",
|
|
2179
|
+
"\\u001D",
|
|
2180
|
+
"\\u001E",
|
|
2181
|
+
"\\u001F",
|
|
2182
|
+
"",
|
|
2183
|
+
"",
|
|
2184
|
+
'\\"',
|
|
2185
|
+
"",
|
|
2186
|
+
"",
|
|
2187
|
+
"",
|
|
2188
|
+
"",
|
|
2189
|
+
"",
|
|
2190
|
+
"",
|
|
2191
|
+
"",
|
|
2192
|
+
"",
|
|
2193
|
+
"",
|
|
2194
|
+
"",
|
|
2195
|
+
"",
|
|
2196
|
+
"",
|
|
2197
|
+
"",
|
|
2198
|
+
// 2F
|
|
2199
|
+
"",
|
|
2200
|
+
"",
|
|
2201
|
+
"",
|
|
2202
|
+
"",
|
|
2203
|
+
"",
|
|
2204
|
+
"",
|
|
2205
|
+
"",
|
|
2206
|
+
"",
|
|
2207
|
+
"",
|
|
2208
|
+
"",
|
|
2209
|
+
"",
|
|
2210
|
+
"",
|
|
2211
|
+
"",
|
|
2212
|
+
"",
|
|
2213
|
+
"",
|
|
2214
|
+
"",
|
|
2215
|
+
// 3F
|
|
2216
|
+
"",
|
|
2217
|
+
"",
|
|
2218
|
+
"",
|
|
2219
|
+
"",
|
|
2220
|
+
"",
|
|
2221
|
+
"",
|
|
2222
|
+
"",
|
|
2223
|
+
"",
|
|
2224
|
+
"",
|
|
2225
|
+
"",
|
|
2226
|
+
"",
|
|
2227
|
+
"",
|
|
2228
|
+
"",
|
|
2229
|
+
"",
|
|
2230
|
+
"",
|
|
2231
|
+
"",
|
|
2232
|
+
// 4F
|
|
2233
|
+
"",
|
|
2234
|
+
"",
|
|
2235
|
+
"",
|
|
2236
|
+
"",
|
|
2237
|
+
"",
|
|
2238
|
+
"",
|
|
2239
|
+
"",
|
|
2240
|
+
"",
|
|
2241
|
+
"",
|
|
2242
|
+
"",
|
|
2243
|
+
"",
|
|
2244
|
+
"",
|
|
2245
|
+
"\\\\",
|
|
2246
|
+
"",
|
|
2247
|
+
"",
|
|
2248
|
+
"",
|
|
2249
|
+
// 5F
|
|
2250
|
+
"",
|
|
2251
|
+
"",
|
|
2252
|
+
"",
|
|
2253
|
+
"",
|
|
2254
|
+
"",
|
|
2255
|
+
"",
|
|
2256
|
+
"",
|
|
2257
|
+
"",
|
|
2258
|
+
"",
|
|
2259
|
+
"",
|
|
2260
|
+
"",
|
|
2261
|
+
"",
|
|
2262
|
+
"",
|
|
2263
|
+
"",
|
|
2264
|
+
"",
|
|
2265
|
+
"",
|
|
2266
|
+
// 6F
|
|
2267
|
+
"",
|
|
2268
|
+
"",
|
|
2269
|
+
"",
|
|
2270
|
+
"",
|
|
2271
|
+
"",
|
|
2272
|
+
"",
|
|
2273
|
+
"",
|
|
2274
|
+
"",
|
|
2275
|
+
"",
|
|
2276
|
+
"",
|
|
2277
|
+
"",
|
|
2278
|
+
"",
|
|
2279
|
+
"",
|
|
2280
|
+
"",
|
|
2281
|
+
"",
|
|
2282
|
+
"\\u007F",
|
|
2283
|
+
"\\u0080",
|
|
2284
|
+
"\\u0081",
|
|
2285
|
+
"\\u0082",
|
|
2286
|
+
"\\u0083",
|
|
2287
|
+
"\\u0084",
|
|
2288
|
+
"\\u0085",
|
|
2289
|
+
"\\u0086",
|
|
2290
|
+
"\\u0087",
|
|
2291
|
+
"\\u0088",
|
|
2292
|
+
"\\u0089",
|
|
2293
|
+
"\\u008A",
|
|
2294
|
+
"\\u008B",
|
|
2295
|
+
"\\u008C",
|
|
2296
|
+
"\\u008D",
|
|
2297
|
+
"\\u008E",
|
|
2298
|
+
"\\u008F",
|
|
2299
|
+
"\\u0090",
|
|
2300
|
+
"\\u0091",
|
|
2301
|
+
"\\u0092",
|
|
2302
|
+
"\\u0093",
|
|
2303
|
+
"\\u0094",
|
|
2304
|
+
"\\u0095",
|
|
2305
|
+
"\\u0096",
|
|
2306
|
+
"\\u0097",
|
|
2307
|
+
"\\u0098",
|
|
2308
|
+
"\\u0099",
|
|
2309
|
+
"\\u009A",
|
|
2310
|
+
"\\u009B",
|
|
2311
|
+
"\\u009C",
|
|
2312
|
+
"\\u009D",
|
|
2313
|
+
"\\u009E",
|
|
2314
|
+
"\\u009F"
|
|
2315
|
+
], Ft = Object.freeze({});
|
|
2316
|
+
function wt(e, t, n = xe) {
|
|
2317
|
+
const i = /* @__PURE__ */ new Map();
|
|
2318
|
+
for (const k of Object.values(l))
|
|
2319
|
+
i.set(k, $t(t, k));
|
|
2320
|
+
let r, s = Array.isArray(e), o = [e], u = -1, h = [], p = e, c, m;
|
|
2321
|
+
const g = [], y = [];
|
|
2322
|
+
do {
|
|
2323
|
+
u++;
|
|
2324
|
+
const k = u === o.length, R = k && h.length !== 0;
|
|
2325
|
+
if (k) {
|
|
2326
|
+
if (c = y.length === 0 ? void 0 : g[g.length - 1], p = m, m = y.pop(), R)
|
|
2327
|
+
if (s) {
|
|
2328
|
+
p = p.slice();
|
|
2329
|
+
let b = 0;
|
|
2330
|
+
for (const [D, P] of h) {
|
|
2331
|
+
const S = D - b;
|
|
2332
|
+
P === null ? (p.splice(S, 1), b++) : p[S] = P;
|
|
2333
|
+
}
|
|
2334
|
+
} else {
|
|
2335
|
+
p = { ...p };
|
|
2336
|
+
for (const [b, D] of h)
|
|
2337
|
+
p[b] = D;
|
|
2338
|
+
}
|
|
2339
|
+
u = r.index, o = r.keys, h = r.edits, s = r.inArray, r = r.prev;
|
|
2340
|
+
} else if (m) {
|
|
2341
|
+
if (c = s ? u : o[u], p = m[c], p == null)
|
|
2342
|
+
continue;
|
|
2343
|
+
g.push(c);
|
|
2344
|
+
}
|
|
2345
|
+
let T;
|
|
2346
|
+
if (!Array.isArray(p)) {
|
|
2347
|
+
var I, O;
|
|
2348
|
+
fe(p) || G(!1, `Invalid AST Node: ${de(p)}.`);
|
|
2349
|
+
const b = k ? (I = i.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (O = i.get(p.kind)) === null || O === void 0 ? void 0 : O.enter;
|
|
2350
|
+
if (T = b?.call(t, p, c, m, g, y), T === Ft)
|
|
2351
|
+
break;
|
|
2352
|
+
if (T === !1) {
|
|
2353
|
+
if (!k) {
|
|
2354
|
+
g.pop();
|
|
2355
|
+
continue;
|
|
2356
|
+
}
|
|
2357
|
+
} else if (T !== void 0 && (h.push([c, T]), !k))
|
|
2358
|
+
if (fe(T))
|
|
2359
|
+
p = T;
|
|
2360
|
+
else {
|
|
2361
|
+
g.pop();
|
|
2362
|
+
continue;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
if (T === void 0 && R && h.push([c, p]), k)
|
|
2366
|
+
g.pop();
|
|
2367
|
+
else {
|
|
2368
|
+
var N;
|
|
2369
|
+
r = {
|
|
2370
|
+
inArray: s,
|
|
2371
|
+
index: u,
|
|
2372
|
+
keys: o,
|
|
2373
|
+
edits: h,
|
|
2374
|
+
prev: r
|
|
2375
|
+
}, s = Array.isArray(p), o = s ? p : (N = n[p.kind]) !== null && N !== void 0 ? N : [], u = -1, h = [], m && y.push(m), m = p;
|
|
2376
|
+
}
|
|
2377
|
+
} while (r !== void 0);
|
|
2378
|
+
return h.length !== 0 ? h[h.length - 1][1] : e;
|
|
2379
|
+
}
|
|
2380
|
+
function $t(e, t) {
|
|
2381
|
+
const n = e[t];
|
|
2382
|
+
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
2383
|
+
enter: n,
|
|
2384
|
+
leave: void 0
|
|
2385
|
+
} : {
|
|
2386
|
+
enter: e.enter,
|
|
2387
|
+
leave: e.leave
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
function Bt(e) {
|
|
2391
|
+
return wt(e, Vt);
|
|
2392
|
+
}
|
|
2393
|
+
const Ut = 80, Vt = {
|
|
2394
|
+
Name: {
|
|
2395
|
+
leave: (e) => e.value
|
|
2396
|
+
},
|
|
2397
|
+
Variable: {
|
|
2398
|
+
leave: (e) => "$" + e.name
|
|
2399
|
+
},
|
|
2400
|
+
// Document
|
|
2401
|
+
Document: {
|
|
2402
|
+
leave: (e) => d(e.definitions, `
|
|
2403
|
+
|
|
2404
|
+
`)
|
|
2405
|
+
},
|
|
2406
|
+
OperationDefinition: {
|
|
2407
|
+
leave(e) {
|
|
2408
|
+
const t = te(e.variableDefinitions) ? f(`(
|
|
2409
|
+
`, d(e.variableDefinitions, `
|
|
2410
|
+
`), `
|
|
2411
|
+
)`) : f("(", d(e.variableDefinitions, ", "), ")"), n = f("", e.description, `
|
|
2412
|
+
`) + d(
|
|
2413
|
+
[
|
|
2414
|
+
e.operation,
|
|
2415
|
+
d([e.name, t]),
|
|
2416
|
+
d(e.directives, " ")
|
|
2417
|
+
],
|
|
2418
|
+
" "
|
|
2419
|
+
);
|
|
2420
|
+
return (n === "query" ? "" : n + " ") + e.selectionSet;
|
|
2421
|
+
}
|
|
2422
|
+
},
|
|
2423
|
+
VariableDefinition: {
|
|
2424
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => f("", r, `
|
|
2425
|
+
`) + e + ": " + t + f(" = ", n) + f(" ", d(i, " "))
|
|
2426
|
+
},
|
|
2427
|
+
SelectionSet: {
|
|
2428
|
+
leave: ({ selections: e }) => C(e)
|
|
2429
|
+
},
|
|
2430
|
+
Field: {
|
|
2431
|
+
leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
|
|
2432
|
+
const s = f("", e, ": ") + t;
|
|
2433
|
+
let o = s + f("(", d(n, ", "), ")");
|
|
2434
|
+
return o.length > Ut && (o = s + f(`(
|
|
2435
|
+
`, Y(d(n, `
|
|
2436
|
+
`)), `
|
|
2437
|
+
)`)), d([o, d(i, " "), r], " ");
|
|
2438
|
+
}
|
|
2439
|
+
},
|
|
2440
|
+
Argument: {
|
|
2441
|
+
leave: ({ name: e, value: t }) => e + ": " + t
|
|
2442
|
+
},
|
|
2443
|
+
// Fragments
|
|
2444
|
+
FragmentSpread: {
|
|
2445
|
+
leave: ({ name: e, directives: t }) => "..." + e + f(" ", d(t, " "))
|
|
2446
|
+
},
|
|
2447
|
+
InlineFragment: {
|
|
2448
|
+
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => d(
|
|
2449
|
+
[
|
|
2450
|
+
"...",
|
|
2451
|
+
f("on ", e),
|
|
2452
|
+
d(t, " "),
|
|
2453
|
+
n
|
|
2454
|
+
],
|
|
2455
|
+
" "
|
|
2456
|
+
)
|
|
2457
|
+
},
|
|
2458
|
+
FragmentDefinition: {
|
|
2459
|
+
leave: ({
|
|
2460
|
+
name: e,
|
|
2461
|
+
typeCondition: t,
|
|
2462
|
+
variableDefinitions: n,
|
|
2463
|
+
directives: i,
|
|
2464
|
+
selectionSet: r,
|
|
2465
|
+
description: s
|
|
2466
|
+
}) => f("", s, `
|
|
2467
|
+
`) + // Note: fragment variable definitions are experimental and may be changed
|
|
2468
|
+
// or removed in the future.
|
|
2469
|
+
`fragment ${e}${f("(", d(n, ", "), ")")} on ${t} ${f("", d(i, " "), " ")}` + r
|
|
2470
|
+
},
|
|
2471
|
+
// Value
|
|
2472
|
+
IntValue: {
|
|
2473
|
+
leave: ({ value: e }) => e
|
|
2474
|
+
},
|
|
2475
|
+
FloatValue: {
|
|
2476
|
+
leave: ({ value: e }) => e
|
|
2477
|
+
},
|
|
2478
|
+
StringValue: {
|
|
2479
|
+
leave: ({ value: e, block: t }) => t ? ct(e) : Ct(e)
|
|
2480
|
+
},
|
|
2481
|
+
BooleanValue: {
|
|
2482
|
+
leave: ({ value: e }) => e ? "true" : "false"
|
|
2483
|
+
},
|
|
2484
|
+
NullValue: {
|
|
2485
|
+
leave: () => "null"
|
|
2486
|
+
},
|
|
2487
|
+
EnumValue: {
|
|
2488
|
+
leave: ({ value: e }) => e
|
|
2489
|
+
},
|
|
2490
|
+
ListValue: {
|
|
2491
|
+
leave: ({ values: e }) => "[" + d(e, ", ") + "]"
|
|
2492
|
+
},
|
|
2493
|
+
ObjectValue: {
|
|
2494
|
+
leave: ({ fields: e }) => "{" + d(e, ", ") + "}"
|
|
2495
|
+
},
|
|
2496
|
+
ObjectField: {
|
|
2497
|
+
leave: ({ name: e, value: t }) => e + ": " + t
|
|
2498
|
+
},
|
|
2499
|
+
// Directive
|
|
2500
|
+
Directive: {
|
|
2501
|
+
leave: ({ name: e, arguments: t }) => "@" + e + f("(", d(t, ", "), ")")
|
|
2502
|
+
},
|
|
2503
|
+
// Type
|
|
2504
|
+
NamedType: {
|
|
2505
|
+
leave: ({ name: e }) => e
|
|
2506
|
+
},
|
|
2507
|
+
ListType: {
|
|
2508
|
+
leave: ({ type: e }) => "[" + e + "]"
|
|
2509
|
+
},
|
|
2510
|
+
NonNullType: {
|
|
2511
|
+
leave: ({ type: e }) => e + "!"
|
|
2512
|
+
},
|
|
2513
|
+
// Type System Definitions
|
|
2514
|
+
SchemaDefinition: {
|
|
2515
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => f("", e, `
|
|
2516
|
+
`) + d(["schema", d(t, " "), C(n)], " ")
|
|
2517
|
+
},
|
|
2518
|
+
OperationTypeDefinition: {
|
|
2519
|
+
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
2520
|
+
},
|
|
2521
|
+
ScalarTypeDefinition: {
|
|
2522
|
+
leave: ({ description: e, name: t, directives: n }) => f("", e, `
|
|
2523
|
+
`) + d(["scalar", t, d(n, " ")], " ")
|
|
2524
|
+
},
|
|
2525
|
+
ObjectTypeDefinition: {
|
|
2526
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => f("", e, `
|
|
2527
|
+
`) + d(
|
|
2528
|
+
[
|
|
2529
|
+
"type",
|
|
2530
|
+
t,
|
|
2531
|
+
f("implements ", d(n, " & ")),
|
|
2532
|
+
d(i, " "),
|
|
2533
|
+
C(r)
|
|
2534
|
+
],
|
|
2535
|
+
" "
|
|
2536
|
+
)
|
|
2537
|
+
},
|
|
2538
|
+
FieldDefinition: {
|
|
2539
|
+
leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => f("", e, `
|
|
2540
|
+
`) + t + (te(n) ? f(`(
|
|
2541
|
+
`, Y(d(n, `
|
|
2542
|
+
`)), `
|
|
2543
|
+
)`) : f("(", d(n, ", "), ")")) + ": " + i + f(" ", d(r, " "))
|
|
2544
|
+
},
|
|
2545
|
+
InputValueDefinition: {
|
|
2546
|
+
leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => f("", e, `
|
|
2547
|
+
`) + d(
|
|
2548
|
+
[t + ": " + n, f("= ", i), d(r, " ")],
|
|
2549
|
+
" "
|
|
2550
|
+
)
|
|
2551
|
+
},
|
|
2552
|
+
InterfaceTypeDefinition: {
|
|
2553
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => f("", e, `
|
|
2554
|
+
`) + d(
|
|
2555
|
+
[
|
|
2556
|
+
"interface",
|
|
2557
|
+
t,
|
|
2558
|
+
f("implements ", d(n, " & ")),
|
|
2559
|
+
d(i, " "),
|
|
2560
|
+
C(r)
|
|
2561
|
+
],
|
|
2562
|
+
" "
|
|
2563
|
+
)
|
|
2564
|
+
},
|
|
2565
|
+
UnionTypeDefinition: {
|
|
2566
|
+
leave: ({ description: e, name: t, directives: n, types: i }) => f("", e, `
|
|
2567
|
+
`) + d(
|
|
2568
|
+
["union", t, d(n, " "), f("= ", d(i, " | "))],
|
|
2569
|
+
" "
|
|
2570
|
+
)
|
|
2571
|
+
},
|
|
2572
|
+
EnumTypeDefinition: {
|
|
2573
|
+
leave: ({ description: e, name: t, directives: n, values: i }) => f("", e, `
|
|
2574
|
+
`) + d(["enum", t, d(n, " "), C(i)], " ")
|
|
2575
|
+
},
|
|
2576
|
+
EnumValueDefinition: {
|
|
2577
|
+
leave: ({ description: e, name: t, directives: n }) => f("", e, `
|
|
2578
|
+
`) + d([t, d(n, " ")], " ")
|
|
2579
|
+
},
|
|
2580
|
+
InputObjectTypeDefinition: {
|
|
2581
|
+
leave: ({ description: e, name: t, directives: n, fields: i }) => f("", e, `
|
|
2582
|
+
`) + d(["input", t, d(n, " "), C(i)], " ")
|
|
2583
|
+
},
|
|
2584
|
+
DirectiveDefinition: {
|
|
2585
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => f("", e, `
|
|
2586
|
+
`) + "directive @" + t + (te(n) ? f(`(
|
|
2587
|
+
`, Y(d(n, `
|
|
2588
|
+
`)), `
|
|
2589
|
+
)`) : f("(", d(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + d(r, " | ")
|
|
2590
|
+
},
|
|
2591
|
+
SchemaExtension: {
|
|
2592
|
+
leave: ({ directives: e, operationTypes: t }) => d(
|
|
2593
|
+
["extend schema", d(e, " "), C(t)],
|
|
2594
|
+
" "
|
|
2595
|
+
)
|
|
2596
|
+
},
|
|
2597
|
+
ScalarTypeExtension: {
|
|
2598
|
+
leave: ({ name: e, directives: t }) => d(["extend scalar", e, d(t, " ")], " ")
|
|
2599
|
+
},
|
|
2600
|
+
ObjectTypeExtension: {
|
|
2601
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => d(
|
|
2602
|
+
[
|
|
2603
|
+
"extend type",
|
|
2604
|
+
e,
|
|
2605
|
+
f("implements ", d(t, " & ")),
|
|
2606
|
+
d(n, " "),
|
|
2607
|
+
C(i)
|
|
2608
|
+
],
|
|
2609
|
+
" "
|
|
2610
|
+
)
|
|
2611
|
+
},
|
|
2612
|
+
InterfaceTypeExtension: {
|
|
2613
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => d(
|
|
2614
|
+
[
|
|
2615
|
+
"extend interface",
|
|
2616
|
+
e,
|
|
2617
|
+
f("implements ", d(t, " & ")),
|
|
2618
|
+
d(n, " "),
|
|
2619
|
+
C(i)
|
|
2620
|
+
],
|
|
2621
|
+
" "
|
|
2622
|
+
)
|
|
2623
|
+
},
|
|
2624
|
+
UnionTypeExtension: {
|
|
2625
|
+
leave: ({ name: e, directives: t, types: n }) => d(
|
|
2626
|
+
[
|
|
2627
|
+
"extend union",
|
|
2628
|
+
e,
|
|
2629
|
+
d(t, " "),
|
|
2630
|
+
f("= ", d(n, " | "))
|
|
2631
|
+
],
|
|
2632
|
+
" "
|
|
2633
|
+
)
|
|
2634
|
+
},
|
|
2635
|
+
EnumTypeExtension: {
|
|
2636
|
+
leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "), C(n)], " ")
|
|
2637
|
+
},
|
|
2638
|
+
InputObjectTypeExtension: {
|
|
2639
|
+
leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "), C(n)], " ")
|
|
2640
|
+
},
|
|
2641
|
+
// Schema Coordinates
|
|
2642
|
+
TypeCoordinate: {
|
|
2643
|
+
leave: ({ name: e }) => e
|
|
2644
|
+
},
|
|
2645
|
+
MemberCoordinate: {
|
|
2646
|
+
leave: ({ name: e, memberName: t }) => d([e, f(".", t)])
|
|
2647
|
+
},
|
|
2648
|
+
ArgumentCoordinate: {
|
|
2649
|
+
leave: ({ name: e, fieldName: t, argumentName: n }) => d([e, f(".", t), f("(", n, ":)")])
|
|
2650
|
+
},
|
|
2651
|
+
DirectiveCoordinate: {
|
|
2652
|
+
leave: ({ name: e }) => d(["@", e])
|
|
2653
|
+
},
|
|
2654
|
+
DirectiveArgumentCoordinate: {
|
|
2655
|
+
leave: ({ name: e, argumentName: t }) => d(["@", e, f("(", t, ":)")])
|
|
2656
|
+
}
|
|
2657
|
+
};
|
|
2658
|
+
function d(e, t = "") {
|
|
2659
|
+
var n;
|
|
2660
|
+
return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
|
|
2661
|
+
}
|
|
2662
|
+
function C(e) {
|
|
2663
|
+
return f(`{
|
|
2664
|
+
`, Y(d(e, `
|
|
2665
|
+
`)), `
|
|
2666
|
+
}`);
|
|
2667
|
+
}
|
|
2668
|
+
function f(e, t, n = "") {
|
|
2669
|
+
return t != null && t !== "" ? e + t + n : "";
|
|
2670
|
+
}
|
|
2671
|
+
function Y(e) {
|
|
2672
|
+
return f(" ", e.replace(/\n/g, `
|
|
2673
|
+
`));
|
|
2674
|
+
}
|
|
2675
|
+
function te(e) {
|
|
2676
|
+
var t;
|
|
2677
|
+
return (t = e?.some((n) => n.includes(`
|
|
2678
|
+
`))) !== null && t !== void 0 ? t : !1;
|
|
2679
|
+
}
|
|
2680
|
+
var H = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map(), Re = !0, J = !1;
|
|
2681
|
+
function Fe(e) {
|
|
2682
|
+
return e.replace(/[\s,]+/g, " ").trim();
|
|
2683
|
+
}
|
|
2684
|
+
function Mt(e) {
|
|
2685
|
+
return Fe(e.source.body.substring(e.start, e.end));
|
|
2686
|
+
}
|
|
2687
|
+
function qt(e) {
|
|
2688
|
+
var t = /* @__PURE__ */ new Set(), n = [];
|
|
2689
|
+
return e.definitions.forEach(function(i) {
|
|
2138
2690
|
if (i.kind === "FragmentDefinition") {
|
|
2139
|
-
var
|
|
2140
|
-
o && !o.has(s) ?
|
|
2691
|
+
var r = i.name.value, s = Mt(i.loc), o = oe.get(r);
|
|
2692
|
+
o && !o.has(s) ? Re && console.warn("Warning: fragment with name " + r + ` already exists.
|
|
2141
2693
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2142
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o ||
|
|
2694
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || oe.set(r, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(i));
|
|
2143
2695
|
} else
|
|
2144
|
-
|
|
2145
|
-
}),
|
|
2146
|
-
}
|
|
2147
|
-
function
|
|
2148
|
-
var
|
|
2149
|
-
|
|
2150
|
-
i.loc && delete i.loc, Object.keys(i).forEach(function(
|
|
2151
|
-
var s = i[
|
|
2152
|
-
s && typeof s == "object" &&
|
|
2696
|
+
n.push(i);
|
|
2697
|
+
}), Q(Q({}, e), { definitions: n });
|
|
2698
|
+
}
|
|
2699
|
+
function zt(e) {
|
|
2700
|
+
var t = new Set(e.definitions);
|
|
2701
|
+
t.forEach(function(i) {
|
|
2702
|
+
i.loc && delete i.loc, Object.keys(i).forEach(function(r) {
|
|
2703
|
+
var s = i[r];
|
|
2704
|
+
s && typeof s == "object" && t.add(s);
|
|
2153
2705
|
});
|
|
2154
2706
|
});
|
|
2155
|
-
var
|
|
2156
|
-
return
|
|
2157
|
-
}
|
|
2158
|
-
function
|
|
2159
|
-
var
|
|
2160
|
-
if (!
|
|
2161
|
-
var
|
|
2162
|
-
experimentalFragmentVariables:
|
|
2163
|
-
allowLegacyFragmentVariables:
|
|
2707
|
+
var n = e.loc;
|
|
2708
|
+
return n && (delete n.startToken, delete n.endToken), e;
|
|
2709
|
+
}
|
|
2710
|
+
function jt(e) {
|
|
2711
|
+
var t = Fe(e);
|
|
2712
|
+
if (!H.has(t)) {
|
|
2713
|
+
var n = Pt(e, {
|
|
2714
|
+
experimentalFragmentVariables: J,
|
|
2715
|
+
allowLegacyFragmentVariables: J
|
|
2164
2716
|
});
|
|
2165
|
-
if (!
|
|
2717
|
+
if (!n || n.kind !== "Document")
|
|
2166
2718
|
throw new Error("Not a valid GraphQL document.");
|
|
2167
|
-
|
|
2719
|
+
H.set(t, zt(qt(n)));
|
|
2168
2720
|
}
|
|
2169
|
-
return
|
|
2721
|
+
return H.get(t);
|
|
2170
2722
|
}
|
|
2171
|
-
function
|
|
2172
|
-
for (var
|
|
2173
|
-
|
|
2174
|
-
typeof
|
|
2175
|
-
var i =
|
|
2176
|
-
return
|
|
2177
|
-
|
|
2178
|
-
}),
|
|
2723
|
+
function E(e) {
|
|
2724
|
+
for (var t = [], n = 1; n < arguments.length; n++)
|
|
2725
|
+
t[n - 1] = arguments[n];
|
|
2726
|
+
typeof e == "string" && (e = [e]);
|
|
2727
|
+
var i = e[0];
|
|
2728
|
+
return t.forEach(function(r, s) {
|
|
2729
|
+
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i += e[s + 1];
|
|
2730
|
+
}), jt(i);
|
|
2179
2731
|
}
|
|
2180
|
-
function
|
|
2181
|
-
|
|
2732
|
+
function Gt() {
|
|
2733
|
+
H.clear(), oe.clear();
|
|
2182
2734
|
}
|
|
2183
|
-
function
|
|
2184
|
-
|
|
2735
|
+
function Yt() {
|
|
2736
|
+
Re = !1;
|
|
2185
2737
|
}
|
|
2186
|
-
function
|
|
2187
|
-
|
|
2738
|
+
function Ht() {
|
|
2739
|
+
J = !0;
|
|
2188
2740
|
}
|
|
2189
|
-
function
|
|
2190
|
-
|
|
2741
|
+
function Qt() {
|
|
2742
|
+
J = !1;
|
|
2191
2743
|
}
|
|
2192
|
-
var
|
|
2193
|
-
gql:
|
|
2194
|
-
resetCaches:
|
|
2195
|
-
disableFragmentWarnings:
|
|
2196
|
-
enableExperimentalFragmentVariables:
|
|
2197
|
-
disableExperimentalFragmentVariables:
|
|
2744
|
+
var U = {
|
|
2745
|
+
gql: E,
|
|
2746
|
+
resetCaches: Gt,
|
|
2747
|
+
disableFragmentWarnings: Yt,
|
|
2748
|
+
enableExperimentalFragmentVariables: Ht,
|
|
2749
|
+
disableExperimentalFragmentVariables: Qt
|
|
2198
2750
|
};
|
|
2199
|
-
(function(
|
|
2200
|
-
|
|
2201
|
-
})(
|
|
2202
|
-
|
|
2203
|
-
const
|
|
2204
|
-
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!]) {
|
|
2751
|
+
(function(e) {
|
|
2752
|
+
e.gql = U.gql, e.resetCaches = U.resetCaches, e.disableFragmentWarnings = U.disableFragmentWarnings, e.enableExperimentalFragmentVariables = U.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = U.disableExperimentalFragmentVariables;
|
|
2753
|
+
})(E || (E = {}));
|
|
2754
|
+
E.default = E;
|
|
2755
|
+
const Jt = E`
|
|
2756
|
+
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
|
|
2205
2757
|
findAllPublicEventByOrganizationId(
|
|
2206
2758
|
id: $organizationId
|
|
2207
2759
|
hostingIds: $hostingIds
|
|
@@ -2210,6 +2762,8 @@ const At = p`
|
|
|
2210
2762
|
date: $dateRange
|
|
2211
2763
|
page: $page
|
|
2212
2764
|
sorts: $sorts
|
|
2765
|
+
searchTerm: $searchTerm
|
|
2766
|
+
priceRange: $priceRange
|
|
2213
2767
|
) {
|
|
2214
2768
|
data {
|
|
2215
2769
|
id
|
|
@@ -2231,11 +2785,12 @@ const At = p`
|
|
|
2231
2785
|
address
|
|
2232
2786
|
}
|
|
2233
2787
|
infoDescription
|
|
2788
|
+
startingPrice
|
|
2234
2789
|
}
|
|
2235
2790
|
count
|
|
2236
2791
|
}
|
|
2237
2792
|
}
|
|
2238
|
-
`,
|
|
2793
|
+
`, Xt = E`
|
|
2239
2794
|
query EventDetailPage($eventId: ID!) {
|
|
2240
2795
|
findPublicEventById(id: $eventId) {
|
|
2241
2796
|
id
|
|
@@ -2261,7 +2816,7 @@ const At = p`
|
|
|
2261
2816
|
maxAmountOfTicketsPerOrder
|
|
2262
2817
|
}
|
|
2263
2818
|
}
|
|
2264
|
-
`,
|
|
2819
|
+
`, Kt = E`
|
|
2265
2820
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
2266
2821
|
findPublicProductsByEventId(
|
|
2267
2822
|
eventId: $eventId
|
|
@@ -2295,96 +2850,186 @@ const At = p`
|
|
|
2295
2850
|
showEndSalesAtTag
|
|
2296
2851
|
}
|
|
2297
2852
|
}
|
|
2298
|
-
`,
|
|
2299
|
-
function
|
|
2853
|
+
`, Wt = (e, t, n, i) => e();
|
|
2854
|
+
function Zt(e, t = Wt) {
|
|
2300
2855
|
return {
|
|
2301
|
-
EventOverviewPage(
|
|
2302
|
-
return
|
|
2856
|
+
EventOverviewPage(n, i, r) {
|
|
2857
|
+
return t((s) => e.request({ document: Jt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", n);
|
|
2303
2858
|
},
|
|
2304
|
-
EventDetailPage(
|
|
2305
|
-
return
|
|
2859
|
+
EventDetailPage(n, i, r) {
|
|
2860
|
+
return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", n);
|
|
2306
2861
|
},
|
|
2307
|
-
findProductsByEventId(
|
|
2308
|
-
return
|
|
2862
|
+
findProductsByEventId(n, i, r) {
|
|
2863
|
+
return t((s) => e.request({ document: Kt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findProductsByEventId", "query", n);
|
|
2309
2864
|
}
|
|
2310
2865
|
};
|
|
2311
2866
|
}
|
|
2312
|
-
|
|
2867
|
+
function en(e) {
|
|
2868
|
+
const t = /(query|mutation|subscription)\s+(\w+)/.exec(e);
|
|
2869
|
+
if (!t) return { type: "unknown" };
|
|
2870
|
+
const n = t[1], i = t[2];
|
|
2871
|
+
return { type: n, name: i };
|
|
2872
|
+
}
|
|
2873
|
+
async function tn(e) {
|
|
2874
|
+
if (typeof globalThis < "u" && globalThis.crypto?.subtle) {
|
|
2875
|
+
const n = new TextEncoder().encode(e), i = await globalThis.crypto.subtle.digest("SHA-256", n);
|
|
2876
|
+
return Array.from(new Uint8Array(i)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
2877
|
+
}
|
|
2878
|
+
try {
|
|
2879
|
+
const { createHash: t } = await import("./__vite-browser-external-l0sNRNKZ.js");
|
|
2880
|
+
return t("sha256").update(e).digest("hex");
|
|
2881
|
+
} catch {
|
|
2882
|
+
throw new Error("SHA-256 is not available in this environment");
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
function nn(e) {
|
|
2886
|
+
const t = { "content-type": "application/json" };
|
|
2887
|
+
if (e)
|
|
2888
|
+
for (const [n, i] of Object.entries(e))
|
|
2889
|
+
typeof i < "u" && (t[n] = String(i));
|
|
2890
|
+
return t;
|
|
2891
|
+
}
|
|
2892
|
+
function ge(e, t) {
|
|
2893
|
+
return e?.length ? e.some((n) => t.includes(n?.extensions?.code) || t.includes(n?.message)) : !1;
|
|
2894
|
+
}
|
|
2895
|
+
function Ie(e, t, n, i, r) {
|
|
2896
|
+
const s = new Error(e);
|
|
2897
|
+
return s.response = { data: r.json?.data, errors: r.json?.errors, status: r.status }, s.request = { query: t, variables: n, operationName: i }, s.graphQLErrors = r.json?.errors, s;
|
|
2898
|
+
}
|
|
2899
|
+
function ne(e, t, n, i, r) {
|
|
2900
|
+
if (r.json?.errors?.length)
|
|
2901
|
+
throw Ie(`GraphQL request failed${e ? ` (${e})` : ""}`, t, n, i, r);
|
|
2902
|
+
if (typeof r.json?.data > "u")
|
|
2903
|
+
throw Ie("GraphQL request failed: no data received", t, n, i, r);
|
|
2904
|
+
return r.json.data;
|
|
2905
|
+
}
|
|
2906
|
+
class ue extends ae {
|
|
2907
|
+
async request(t, ...n) {
|
|
2908
|
+
let i = t, r, s, o;
|
|
2909
|
+
t && typeof t == "object" && "document" in t ? (i = t.document, r = t.variables, s = t.requestHeaders, o = t.signal) : (r = n[0], s = n[1]);
|
|
2910
|
+
const u = typeof i == "string" ? i : Bt(i), { type: h, name: p } = en(u), c = await tn(u), m = r ?? {}, g = this.url ?? this.endpoint ?? "", y = nn(s), I = async (D) => {
|
|
2911
|
+
const P = await fetch(g, { method: "POST", headers: y, body: JSON.stringify(D), signal: o });
|
|
2912
|
+
let S = null;
|
|
2913
|
+
try {
|
|
2914
|
+
S = await P.json();
|
|
2915
|
+
} catch {
|
|
2916
|
+
S = null;
|
|
2917
|
+
}
|
|
2918
|
+
return { status: P.status, json: S };
|
|
2919
|
+
}, O = async (D) => {
|
|
2920
|
+
const P = new URLSearchParams();
|
|
2921
|
+
for (const [Je, q] of Object.entries(D))
|
|
2922
|
+
typeof q > "u" || P.set(Je, typeof q == "string" ? q : JSON.stringify(q));
|
|
2923
|
+
const S = g.includes("?") ? "&" : "?", B = `${g}${S}${P.toString()}`, le = await fetch(B, { method: "GET", headers: y, signal: o });
|
|
2924
|
+
let Z = null;
|
|
2925
|
+
try {
|
|
2926
|
+
Z = await le.json();
|
|
2927
|
+
} catch {
|
|
2928
|
+
Z = null;
|
|
2929
|
+
}
|
|
2930
|
+
return { status: le.status, json: Z };
|
|
2931
|
+
}, N = {
|
|
2932
|
+
operationName: p,
|
|
2933
|
+
variables: m,
|
|
2934
|
+
extensions: { persistedQuery: { version: 1, sha256Hash: c } }
|
|
2935
|
+
}, k = async (D, P, S) => {
|
|
2936
|
+
if (ge(D.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
|
|
2937
|
+
const B = await P();
|
|
2938
|
+
return ne("APQ register", u, m, p, B);
|
|
2939
|
+
}
|
|
2940
|
+
if (ge(D.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
|
|
2941
|
+
const B = await S();
|
|
2942
|
+
return ne("no APQ support", u, m, p, B);
|
|
2943
|
+
}
|
|
2944
|
+
return ne("", u, m, p, D);
|
|
2945
|
+
};
|
|
2946
|
+
if (h === "query") {
|
|
2947
|
+
const D = await O(N);
|
|
2948
|
+
return k(D, () => I({ ...N, query: u }), () => I({ operationName: p, variables: m, query: u }));
|
|
2949
|
+
}
|
|
2950
|
+
const R = await I(N);
|
|
2951
|
+
return k(R, () => I({ ...N, query: u }), () => I({ operationName: p, variables: m, query: u }));
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
class we {
|
|
2313
2955
|
config;
|
|
2314
2956
|
sdk;
|
|
2315
|
-
constructor(
|
|
2316
|
-
this.config =
|
|
2957
|
+
constructor(t) {
|
|
2958
|
+
this.config = t, this.sdk = Zt(new ue(t.apiUrl));
|
|
2317
2959
|
}
|
|
2318
|
-
async fetchEvents(
|
|
2960
|
+
async fetchEvents(t = {}) {
|
|
2319
2961
|
try {
|
|
2320
|
-
|
|
2321
|
-
index:
|
|
2322
|
-
size:
|
|
2962
|
+
t.page && (t.page = {
|
|
2963
|
+
index: t.page.index ?? 0,
|
|
2964
|
+
size: t.page.size ?? 20
|
|
2323
2965
|
}), this.debugLog("Fetching events with parameters", {
|
|
2324
2966
|
organizationId: this.config.organizationId,
|
|
2325
|
-
hostingIds:
|
|
2326
|
-
filterEventStatuses:
|
|
2327
|
-
dateRange:
|
|
2328
|
-
page:
|
|
2329
|
-
sorts:
|
|
2967
|
+
hostingIds: t.hostingIds,
|
|
2968
|
+
filterEventStatuses: t.statuses,
|
|
2969
|
+
dateRange: t.dateRange,
|
|
2970
|
+
page: t.page,
|
|
2971
|
+
sorts: t.sorts,
|
|
2330
2972
|
trackerId: this.config.trackerId
|
|
2331
2973
|
});
|
|
2332
|
-
const
|
|
2974
|
+
const n = await this.sdk.EventOverviewPage({
|
|
2333
2975
|
organizationId: this.config.organizationId,
|
|
2334
|
-
hostingIds:
|
|
2335
|
-
filterEventStatuses:
|
|
2336
|
-
dateRange:
|
|
2337
|
-
from:
|
|
2338
|
-
till:
|
|
2976
|
+
hostingIds: t.hostingIds,
|
|
2977
|
+
filterEventStatuses: t.statuses,
|
|
2978
|
+
dateRange: t.dateRange && t.dateRange.from && t.dateRange.till ? {
|
|
2979
|
+
from: t.dateRange.from.toISO(),
|
|
2980
|
+
till: t.dateRange.till.toISO()
|
|
2339
2981
|
} : void 0,
|
|
2340
|
-
page:
|
|
2341
|
-
sorts:
|
|
2342
|
-
trackerId: this.config.trackerId
|
|
2982
|
+
page: t.page,
|
|
2983
|
+
sorts: t.sorts,
|
|
2984
|
+
trackerId: this.config.trackerId,
|
|
2985
|
+
searchTerm: t.searchTerm,
|
|
2986
|
+
priceRange: t.priceRange
|
|
2343
2987
|
});
|
|
2344
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2345
|
-
const i =
|
|
2346
|
-
id:
|
|
2347
|
-
name:
|
|
2348
|
-
icon:
|
|
2349
|
-
banner:
|
|
2350
|
-
description:
|
|
2351
|
-
addonDescription:
|
|
2352
|
-
startAt:
|
|
2353
|
-
endAt:
|
|
2354
|
-
timezone:
|
|
2988
|
+
if (this.debugLog("Raw GraphQL response", n), n?.findAllPublicEventByOrganizationId?.data) {
|
|
2989
|
+
const i = n.findAllPublicEventByOrganizationId.data.map((r) => ({
|
|
2990
|
+
id: r.id,
|
|
2991
|
+
name: r.name,
|
|
2992
|
+
icon: r.icon,
|
|
2993
|
+
banner: r.banner,
|
|
2994
|
+
description: r.description,
|
|
2995
|
+
addonDescription: r.addonDescription,
|
|
2996
|
+
startAt: x.fromISO(r.startAt, { zone: r.timezone }),
|
|
2997
|
+
endAt: x.fromISO(r.endAt, { zone: r.timezone }),
|
|
2998
|
+
timezone: r.timezone,
|
|
2355
2999
|
startSalesAt: null,
|
|
2356
3000
|
endSalesAt: null,
|
|
2357
|
-
slug:
|
|
3001
|
+
slug: r.slug ?? "ERROR",
|
|
2358
3002
|
facebookPixelId: null,
|
|
2359
|
-
status:
|
|
2360
|
-
location:
|
|
2361
|
-
id:
|
|
2362
|
-
name:
|
|
2363
|
-
address:
|
|
3003
|
+
status: r.status,
|
|
3004
|
+
location: r.location ? {
|
|
3005
|
+
id: r.location.id,
|
|
3006
|
+
name: r.location.name,
|
|
3007
|
+
address: r.location.address
|
|
2364
3008
|
} : void 0,
|
|
2365
|
-
infoDescription:
|
|
3009
|
+
infoDescription: r.infoDescription,
|
|
3010
|
+
startingPrice: r.startingPrice
|
|
2366
3011
|
}));
|
|
2367
|
-
return this.debugLog("Processed events", { events: i, count: i.length }), [i,
|
|
3012
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, n.findAllPublicEventByOrganizationId.count ?? 0];
|
|
2368
3013
|
} else
|
|
2369
3014
|
return this.debugLog("No events found in response"), [[], 0];
|
|
2370
|
-
} catch (
|
|
2371
|
-
throw this.debugLog("Error fetching events",
|
|
3015
|
+
} catch (n) {
|
|
3016
|
+
throw this.debugLog("Error fetching events", n), n;
|
|
2372
3017
|
}
|
|
2373
3018
|
}
|
|
2374
|
-
async fetchEvent(
|
|
3019
|
+
async fetchEvent(t) {
|
|
2375
3020
|
try {
|
|
2376
|
-
this.debugLog("Fetching single event", { eventId:
|
|
2377
|
-
const
|
|
2378
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2379
|
-
const i =
|
|
3021
|
+
this.debugLog("Fetching single event", { eventId: t });
|
|
3022
|
+
const n = await this.sdk.EventDetailPage({ eventId: t });
|
|
3023
|
+
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
3024
|
+
const i = n.findPublicEventById, r = {
|
|
2380
3025
|
id: i.id,
|
|
2381
3026
|
name: i.name,
|
|
2382
3027
|
icon: i.icon,
|
|
2383
3028
|
banner: i.banner,
|
|
2384
3029
|
description: i.description,
|
|
2385
3030
|
addonDescription: i.addonDescription,
|
|
2386
|
-
startAt:
|
|
2387
|
-
endAt:
|
|
3031
|
+
startAt: x.fromISO(i.startAt, { zone: i.timezone }),
|
|
3032
|
+
endAt: x.fromISO(i.endAt, { zone: i.timezone }),
|
|
2388
3033
|
timezone: i.timezone,
|
|
2389
3034
|
startSalesAt: i.startSalesAt,
|
|
2390
3035
|
endSalesAt: i.endSalesAt,
|
|
@@ -2398,31 +3043,31 @@ class fe {
|
|
|
2398
3043
|
} : void 0,
|
|
2399
3044
|
infoDescription: i.infoDescription
|
|
2400
3045
|
};
|
|
2401
|
-
return this.debugLog("Processed single event",
|
|
3046
|
+
return this.debugLog("Processed single event", r), r;
|
|
2402
3047
|
} else {
|
|
2403
|
-
this.debugLog("No event found for id",
|
|
3048
|
+
this.debugLog("No event found for id", t);
|
|
2404
3049
|
return;
|
|
2405
3050
|
}
|
|
2406
|
-
} catch (
|
|
2407
|
-
throw this.debugLog("Error fetching single event",
|
|
3051
|
+
} catch (n) {
|
|
3052
|
+
throw this.debugLog("Error fetching single event", n), n;
|
|
2408
3053
|
}
|
|
2409
3054
|
}
|
|
2410
|
-
async fetchProducts(
|
|
3055
|
+
async fetchProducts(t, n, i) {
|
|
2411
3056
|
try {
|
|
2412
3057
|
this.debugLog("Fetching products for event", {
|
|
2413
|
-
eventId:
|
|
3058
|
+
eventId: t,
|
|
2414
3059
|
promoCode: i,
|
|
2415
3060
|
trackerId: this.config.trackerId,
|
|
2416
|
-
productTypes:
|
|
3061
|
+
productTypes: n
|
|
2417
3062
|
});
|
|
2418
|
-
const
|
|
2419
|
-
eventId:
|
|
3063
|
+
const r = await this.sdk.findProductsByEventId({
|
|
3064
|
+
eventId: t,
|
|
2420
3065
|
promoCode: i,
|
|
2421
3066
|
trackerId: this.config.trackerId,
|
|
2422
|
-
productTypes:
|
|
3067
|
+
productTypes: n
|
|
2423
3068
|
});
|
|
2424
|
-
if (
|
|
2425
|
-
const s =
|
|
3069
|
+
if (r?.findPublicProductsByEventId) {
|
|
3070
|
+
const s = r.findPublicProductsByEventId.map((o) => ({
|
|
2426
3071
|
id: o.id,
|
|
2427
3072
|
name: o.name,
|
|
2428
3073
|
category: o.category ? {
|
|
@@ -2447,21 +3092,21 @@ class fe {
|
|
|
2447
3092
|
type: o.type
|
|
2448
3093
|
}));
|
|
2449
3094
|
return this.debugLog("Products fetched", {
|
|
2450
|
-
eventId:
|
|
3095
|
+
eventId: t,
|
|
2451
3096
|
count: s.length,
|
|
2452
3097
|
types: s.map((o) => o.type)
|
|
2453
3098
|
}), s;
|
|
2454
3099
|
}
|
|
2455
3100
|
return;
|
|
2456
|
-
} catch (
|
|
2457
|
-
throw this.debugLog("Error fetching products", { eventId:
|
|
3101
|
+
} catch (r) {
|
|
3102
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: r }), r;
|
|
2458
3103
|
}
|
|
2459
3104
|
}
|
|
2460
|
-
debugLog(
|
|
2461
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${
|
|
3105
|
+
debugLog(t, n) {
|
|
3106
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
|
|
2462
3107
|
}
|
|
2463
3108
|
}
|
|
2464
|
-
const
|
|
3109
|
+
const rn = E`
|
|
2465
3110
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
|
|
2466
3111
|
findPaymentDetails(
|
|
2467
3112
|
orderId: $orderId
|
|
@@ -2489,39 +3134,39 @@ const Nt = p`
|
|
|
2489
3134
|
paymentSpesificTransactionFee
|
|
2490
3135
|
}
|
|
2491
3136
|
}
|
|
2492
|
-
`,
|
|
3137
|
+
`, sn = E`
|
|
2493
3138
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
2494
3139
|
createDigitalOrderPayment(input: $input)
|
|
2495
3140
|
}
|
|
2496
|
-
`,
|
|
2497
|
-
function
|
|
3141
|
+
`, on = (e, t, n, i) => e();
|
|
3142
|
+
function an(e, t = on) {
|
|
2498
3143
|
return {
|
|
2499
|
-
findPaymentMethods(
|
|
2500
|
-
return
|
|
3144
|
+
findPaymentMethods(n, i, r) {
|
|
3145
|
+
return t((s) => e.request({ document: rn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", n);
|
|
2501
3146
|
},
|
|
2502
|
-
createDigitalPayment(
|
|
2503
|
-
return
|
|
3147
|
+
createDigitalPayment(n, i, r) {
|
|
3148
|
+
return t((s) => e.request({ document: sn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", n);
|
|
2504
3149
|
}
|
|
2505
3150
|
};
|
|
2506
3151
|
}
|
|
2507
|
-
class
|
|
3152
|
+
class $e {
|
|
2508
3153
|
config;
|
|
2509
3154
|
sdk;
|
|
2510
|
-
constructor(
|
|
2511
|
-
this.config =
|
|
3155
|
+
constructor(t) {
|
|
3156
|
+
this.config = t, this.sdk = an(new ae(t.apiUrl));
|
|
2512
3157
|
}
|
|
2513
|
-
async getPaymentDetails(
|
|
2514
|
-
this.debugLog("Fetching payment methods",
|
|
3158
|
+
async getPaymentDetails(t) {
|
|
3159
|
+
this.debugLog("Fetching payment methods", t);
|
|
2515
3160
|
try {
|
|
2516
|
-
const
|
|
2517
|
-
orderId:
|
|
2518
|
-
orderItemId:
|
|
2519
|
-
amountOfTickets:
|
|
2520
|
-
paymentMethodId:
|
|
3161
|
+
const n = await this.sdk.findPaymentMethods({
|
|
3162
|
+
orderId: t.orderId,
|
|
3163
|
+
orderItemId: t.orderItemId,
|
|
3164
|
+
amountOfTickets: t.amountOfTickets,
|
|
3165
|
+
paymentMethodId: t.paymentMethodId
|
|
2521
3166
|
});
|
|
2522
|
-
if (!
|
|
3167
|
+
if (!n?.findPaymentDetails)
|
|
2523
3168
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
2524
|
-
const i =
|
|
3169
|
+
const i = n.findPaymentDetails;
|
|
2525
3170
|
return this.debugLog("Payment methods fetched successfully", {
|
|
2526
3171
|
methodCount: i.methods?.length ?? 0,
|
|
2527
3172
|
transactionPrice: i.transactionPrice,
|
|
@@ -2533,56 +3178,56 @@ class Ie {
|
|
|
2533
3178
|
transactionDiscount: i.transactionPrice,
|
|
2534
3179
|
transactionFee: i.transactionFee ?? null,
|
|
2535
3180
|
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee ?? null,
|
|
2536
|
-
methods: i.methods?.map((
|
|
2537
|
-
id:
|
|
2538
|
-
name:
|
|
2539
|
-
image:
|
|
2540
|
-
fee:
|
|
2541
|
-
type:
|
|
2542
|
-
value:
|
|
3181
|
+
methods: i.methods?.map((r) => ({
|
|
3182
|
+
id: r.id,
|
|
3183
|
+
name: r.name,
|
|
3184
|
+
image: r.image,
|
|
3185
|
+
fee: r.fee ? {
|
|
3186
|
+
type: r.fee.type,
|
|
3187
|
+
value: r.fee.value
|
|
2543
3188
|
} : null,
|
|
2544
|
-
issuers:
|
|
3189
|
+
issuers: r.issuers?.map((s) => ({
|
|
2545
3190
|
id: s.id,
|
|
2546
3191
|
name: s.name,
|
|
2547
3192
|
image: s.image
|
|
2548
3193
|
})) ?? null
|
|
2549
3194
|
})) ?? null
|
|
2550
3195
|
};
|
|
2551
|
-
} catch (
|
|
2552
|
-
throw this.debugLog("Error fetching payment methods",
|
|
3196
|
+
} catch (n) {
|
|
3197
|
+
throw this.debugLog("Error fetching payment methods", n), n;
|
|
2553
3198
|
}
|
|
2554
3199
|
}
|
|
2555
|
-
async createPayment(
|
|
2556
|
-
this.debugLog("Creating payment",
|
|
3200
|
+
async createPayment(t) {
|
|
3201
|
+
this.debugLog("Creating payment", t);
|
|
2557
3202
|
try {
|
|
2558
|
-
const
|
|
2559
|
-
orderId:
|
|
2560
|
-
paymentMethodId:
|
|
2561
|
-
issuerId:
|
|
2562
|
-
redirectUrl:
|
|
3203
|
+
const n = {
|
|
3204
|
+
orderId: t.orderId,
|
|
3205
|
+
paymentMethodId: t.paymentMethodId,
|
|
3206
|
+
issuerId: t.issuerId,
|
|
3207
|
+
redirectUrl: t.redirectUrl,
|
|
2563
3208
|
// For payment links this input in used
|
|
2564
|
-
initiatedByUserId:
|
|
2565
|
-
initiatedByTeamId:
|
|
2566
|
-
amountOfTickets:
|
|
2567
|
-
orderItemId:
|
|
3209
|
+
initiatedByUserId: t.initiatedByUserId,
|
|
3210
|
+
initiatedByTeamId: t.initiatedByTeamId,
|
|
3211
|
+
amountOfTickets: t.amountOfTickets,
|
|
3212
|
+
orderItemId: t.orderItemId
|
|
2568
3213
|
};
|
|
2569
|
-
|
|
3214
|
+
t.customer && (n.customer = t.customer), t.products && (n.products = t.products), t.description && (n.description = t.description), t.reference && (n.reference = t.reference), t.ipAddress && (n.ipAddress = t.ipAddress);
|
|
2570
3215
|
const i = await this.sdk.createDigitalPayment({
|
|
2571
|
-
input:
|
|
3216
|
+
input: n
|
|
2572
3217
|
});
|
|
2573
3218
|
if (!i?.createDigitalOrderPayment)
|
|
2574
3219
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
2575
|
-
const
|
|
2576
|
-
return this.debugLog("Payment created successfully", { paymentUrl:
|
|
2577
|
-
} catch (
|
|
2578
|
-
throw this.debugLog("Error creating payment",
|
|
3220
|
+
const r = i.createDigitalOrderPayment;
|
|
3221
|
+
return this.debugLog("Payment created successfully", { paymentUrl: r }), { paymentUrl: r };
|
|
3222
|
+
} catch (n) {
|
|
3223
|
+
throw this.debugLog("Error creating payment", n), n;
|
|
2579
3224
|
}
|
|
2580
3225
|
}
|
|
2581
|
-
debugLog(
|
|
2582
|
-
this.config.debug && console.log(`[PaymentService] ${
|
|
3226
|
+
debugLog(t, n) {
|
|
3227
|
+
this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
|
|
2583
3228
|
}
|
|
2584
3229
|
}
|
|
2585
|
-
const
|
|
3230
|
+
const cn = E`
|
|
2586
3231
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
2587
3232
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
2588
3233
|
data {
|
|
@@ -2607,7 +3252,7 @@ const Pt = p`
|
|
|
2607
3252
|
count
|
|
2608
3253
|
}
|
|
2609
3254
|
}
|
|
2610
|
-
`,
|
|
3255
|
+
`, dn = E`
|
|
2611
3256
|
query findPublicPackageById($packageId: ID!) {
|
|
2612
3257
|
findPublicPackageById(id: $packageId) {
|
|
2613
3258
|
id
|
|
@@ -2633,7 +3278,7 @@ const Pt = p`
|
|
|
2633
3278
|
}
|
|
2634
3279
|
}
|
|
2635
3280
|
}
|
|
2636
|
-
`,
|
|
3281
|
+
`, un = E`
|
|
2637
3282
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
2638
3283
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
2639
3284
|
data {
|
|
@@ -2668,87 +3313,85 @@ const Pt = p`
|
|
|
2668
3313
|
count
|
|
2669
3314
|
}
|
|
2670
3315
|
}
|
|
2671
|
-
`,
|
|
2672
|
-
function
|
|
3316
|
+
`, ln = (e, t, n, i) => e();
|
|
3317
|
+
function pn(e, t = ln) {
|
|
2673
3318
|
return {
|
|
2674
|
-
findAllPublicPackagesByOrganizationId(
|
|
2675
|
-
return
|
|
3319
|
+
findAllPublicPackagesByOrganizationId(n, i, r) {
|
|
3320
|
+
return t((s) => e.request({ document: cn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
2676
3321
|
},
|
|
2677
|
-
findPublicPackageById(
|
|
2678
|
-
return
|
|
3322
|
+
findPublicPackageById(n, i, r) {
|
|
3323
|
+
return t((s) => e.request({ document: dn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", n);
|
|
2679
3324
|
},
|
|
2680
|
-
findPublicItemsByPackageId(
|
|
2681
|
-
return
|
|
3325
|
+
findPublicItemsByPackageId(n, i, r) {
|
|
3326
|
+
return t((s) => e.request({ document: un, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", n);
|
|
2682
3327
|
}
|
|
2683
3328
|
};
|
|
2684
3329
|
}
|
|
2685
|
-
class
|
|
3330
|
+
class Be {
|
|
2686
3331
|
config;
|
|
2687
3332
|
sdk;
|
|
2688
|
-
constructor(
|
|
2689
|
-
|
|
2690
|
-
throw new Error("organizationId is required for public package queries");
|
|
2691
|
-
this.config = e, this.sdk = Lt(new C(e.apiUrl));
|
|
3333
|
+
constructor(t) {
|
|
3334
|
+
this.config = t, this.sdk = pn(new ue(t.apiUrl));
|
|
2692
3335
|
}
|
|
2693
|
-
debugLog(
|
|
2694
|
-
this.config.debug && console.log(`[PackageService] ${
|
|
3336
|
+
debugLog(t, n) {
|
|
3337
|
+
this.config.debug && console.log(`[PackageService] ${t}`, n || "");
|
|
2695
3338
|
}
|
|
2696
|
-
async getPackages(
|
|
3339
|
+
async getPackages(t = {}) {
|
|
2697
3340
|
try {
|
|
2698
|
-
let
|
|
2699
|
-
|
|
2700
|
-
index:
|
|
2701
|
-
size:
|
|
3341
|
+
let n;
|
|
3342
|
+
t.page && (n = {
|
|
3343
|
+
index: t.page.index ?? 0,
|
|
3344
|
+
size: t.page.size ?? 20
|
|
2702
3345
|
}), this.debugLog("Fetching public packages", {
|
|
2703
3346
|
organizationId: this.config.organizationId,
|
|
2704
|
-
page:
|
|
2705
|
-
tab:
|
|
2706
|
-
statuses:
|
|
3347
|
+
page: n,
|
|
3348
|
+
tab: t.tab,
|
|
3349
|
+
statuses: t.statuses
|
|
2707
3350
|
});
|
|
2708
3351
|
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
2709
3352
|
organizationId: this.config.organizationId
|
|
2710
3353
|
});
|
|
2711
3354
|
if (i?.findAllPublicPackagesByOrganizationId) {
|
|
2712
|
-
const
|
|
3355
|
+
const r = i.findAllPublicPackagesByOrganizationId;
|
|
2713
3356
|
return this.debugLog("Public packages fetched", {
|
|
2714
|
-
count:
|
|
2715
|
-
dataLength:
|
|
2716
|
-
}),
|
|
3357
|
+
count: r.count,
|
|
3358
|
+
dataLength: r.data.length
|
|
3359
|
+
}), r;
|
|
2717
3360
|
}
|
|
2718
3361
|
return null;
|
|
2719
|
-
} catch (
|
|
2720
|
-
throw this.debugLog("Error fetching public packages",
|
|
3362
|
+
} catch (n) {
|
|
3363
|
+
throw this.debugLog("Error fetching public packages", n), n;
|
|
2721
3364
|
}
|
|
2722
3365
|
}
|
|
2723
|
-
async getPackage(
|
|
3366
|
+
async getPackage(t) {
|
|
2724
3367
|
try {
|
|
2725
3368
|
this.debugLog("Fetching public packages", {
|
|
2726
|
-
packageId:
|
|
3369
|
+
packageId: t
|
|
2727
3370
|
});
|
|
2728
|
-
const
|
|
2729
|
-
if (
|
|
2730
|
-
const i =
|
|
3371
|
+
const n = await this.sdk.findPublicPackageById({ packageId: t });
|
|
3372
|
+
if (n?.findPublicPackageById) {
|
|
3373
|
+
const i = n.findPublicPackageById;
|
|
2731
3374
|
return this.debugLog("Public package fetched"), i;
|
|
2732
3375
|
}
|
|
2733
3376
|
return null;
|
|
2734
|
-
} catch (
|
|
2735
|
-
throw this.debugLog("Error fetching public packages",
|
|
3377
|
+
} catch (n) {
|
|
3378
|
+
throw this.debugLog("Error fetching public packages", n), n;
|
|
2736
3379
|
}
|
|
2737
3380
|
}
|
|
2738
|
-
async getPackageItems(
|
|
3381
|
+
async getPackageItems(t, n = [X.Regular, X.AdditionalEvent]) {
|
|
2739
3382
|
try {
|
|
2740
|
-
this.debugLog("Fetching public package items", { packageId:
|
|
3383
|
+
this.debugLog("Fetching public package items", { packageId: t, types: n });
|
|
2741
3384
|
const i = await this.sdk.findPublicItemsByPackageId({
|
|
2742
|
-
packageId:
|
|
2743
|
-
types:
|
|
3385
|
+
packageId: t,
|
|
3386
|
+
types: n,
|
|
2744
3387
|
page: { index: 0, size: 100 }
|
|
2745
3388
|
});
|
|
2746
3389
|
if (i?.findPublicItemsByPackageId) {
|
|
2747
|
-
const
|
|
3390
|
+
const r = i.findPublicItemsByPackageId;
|
|
2748
3391
|
return this.debugLog("Public package items fetched", {
|
|
2749
|
-
count:
|
|
2750
|
-
dataLength:
|
|
2751
|
-
}),
|
|
3392
|
+
count: r.count,
|
|
3393
|
+
dataLength: r.data.length
|
|
3394
|
+
}), r;
|
|
2752
3395
|
}
|
|
2753
3396
|
return null;
|
|
2754
3397
|
} catch (i) {
|
|
@@ -2756,92 +3399,92 @@ class Ee {
|
|
|
2756
3399
|
}
|
|
2757
3400
|
}
|
|
2758
3401
|
}
|
|
2759
|
-
const
|
|
2760
|
-
query findAllPublicCategoriesByOrganizationId($organizationId: ID
|
|
3402
|
+
const hn = E`
|
|
3403
|
+
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
2761
3404
|
findAllPublicHostingsByOrganizationId(id: $organizationId) {
|
|
2762
3405
|
data {
|
|
2763
3406
|
id
|
|
2764
3407
|
name
|
|
2765
3408
|
icon
|
|
3409
|
+
amountOfActiveEvents(input: $dateRange)
|
|
2766
3410
|
}
|
|
2767
3411
|
count
|
|
2768
3412
|
}
|
|
2769
3413
|
}
|
|
2770
|
-
`,
|
|
2771
|
-
query findPublicCategoryById($hostingId: ID
|
|
3414
|
+
`, fn = E`
|
|
3415
|
+
query findPublicCategoryById($hostingId: ID!, $dateRange: DateRangeInput) {
|
|
2772
3416
|
findPublicHostingById(id: $hostingId) {
|
|
2773
3417
|
id
|
|
2774
3418
|
name
|
|
2775
3419
|
icon
|
|
3420
|
+
amountOfActiveEvents(input: $dateRange)
|
|
2776
3421
|
}
|
|
2777
3422
|
}
|
|
2778
|
-
`,
|
|
2779
|
-
function
|
|
3423
|
+
`, mn = (e, t, n, i) => e();
|
|
3424
|
+
function gn(e, t = mn) {
|
|
2780
3425
|
return {
|
|
2781
|
-
findAllPublicCategoriesByOrganizationId(
|
|
2782
|
-
return
|
|
3426
|
+
findAllPublicCategoriesByOrganizationId(n, i, r) {
|
|
3427
|
+
return t((s) => e.request({ document: hn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
2783
3428
|
},
|
|
2784
|
-
findPublicCategoryById(
|
|
2785
|
-
return
|
|
3429
|
+
findPublicCategoryById(n, i, r) {
|
|
3430
|
+
return t((s) => e.request({ document: fn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicCategoryById", "query", n);
|
|
2786
3431
|
}
|
|
2787
3432
|
};
|
|
2788
3433
|
}
|
|
2789
|
-
class
|
|
3434
|
+
class Ue {
|
|
2790
3435
|
config;
|
|
2791
3436
|
sdk;
|
|
2792
|
-
constructor(
|
|
2793
|
-
|
|
2794
|
-
throw new Error("organizationId is required for category queries");
|
|
2795
|
-
this.config = e, this.sdk = Bt(new C(e.apiUrl));
|
|
3437
|
+
constructor(t) {
|
|
3438
|
+
this.config = t, this.sdk = gn(new ue(t.apiUrl));
|
|
2796
3439
|
}
|
|
2797
|
-
debugLog(
|
|
2798
|
-
this.config.debug && console.log(`[CategoryService] ${
|
|
3440
|
+
debugLog(t, n) {
|
|
3441
|
+
this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
|
|
2799
3442
|
}
|
|
2800
|
-
async getCategories() {
|
|
3443
|
+
async getCategories(t) {
|
|
2801
3444
|
try {
|
|
2802
3445
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
2803
|
-
const
|
|
2804
|
-
if (
|
|
2805
|
-
const
|
|
2806
|
-
return this.debugLog("Categories fetched", { count:
|
|
3446
|
+
const n = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId, dateRange: t });
|
|
3447
|
+
if (n?.findAllPublicHostingsByOrganizationId) {
|
|
3448
|
+
const i = n.findAllPublicHostingsByOrganizationId;
|
|
3449
|
+
return this.debugLog("Categories fetched", { count: i.count, dataLength: i.data.length }), i.data.map((r) => ({ id: r.id, name: r.name, icon: r.icon, activeEvents: r.amountOfActiveEvents }));
|
|
2807
3450
|
}
|
|
2808
3451
|
return [];
|
|
2809
|
-
} catch (
|
|
2810
|
-
throw this.debugLog("Error fetching categories",
|
|
3452
|
+
} catch (n) {
|
|
3453
|
+
throw this.debugLog("Error fetching categories", n), n;
|
|
2811
3454
|
}
|
|
2812
3455
|
}
|
|
2813
|
-
async getCategory(
|
|
3456
|
+
async getCategory(t) {
|
|
2814
3457
|
try {
|
|
2815
|
-
this.debugLog("Fetching category", { categoryId:
|
|
2816
|
-
const
|
|
2817
|
-
if (
|
|
2818
|
-
const i =
|
|
2819
|
-
return this.debugLog("Category fetched", i), { id: i.id, name: i.name, icon: i.icon };
|
|
3458
|
+
this.debugLog("Fetching category", { categoryId: t });
|
|
3459
|
+
const n = await this.sdk.findPublicCategoryById({ hostingId: t });
|
|
3460
|
+
if (n?.findPublicHostingById) {
|
|
3461
|
+
const i = n.findPublicHostingById;
|
|
3462
|
+
return this.debugLog("Category fetched", i), { id: i.id, name: i.name, icon: i.icon, activeEvents: i.amountOfActiveEvents };
|
|
2820
3463
|
}
|
|
2821
3464
|
return null;
|
|
2822
|
-
} catch (
|
|
2823
|
-
throw this.debugLog("Error fetching category",
|
|
3465
|
+
} catch (n) {
|
|
3466
|
+
throw this.debugLog("Error fetching category", n), n;
|
|
2824
3467
|
}
|
|
2825
3468
|
}
|
|
2826
3469
|
}
|
|
2827
|
-
var
|
|
2828
|
-
const
|
|
3470
|
+
var L = /* @__PURE__ */ ((e) => (e.PACKAGE = "PACKAGE", e.PRODUCT = "PRODUCT", e.ADD_ONS = "ADD_ONS", e.DELIVERY = "DELIVERY", e.PICKUP = "PICKUP", e))(L || {}), X = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(X || {}), Ve = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Concept = "CONCEPT", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Ve || {}), Me = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(Me || {}), qe = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(qe || {}), ze = /* @__PURE__ */ ((e) => (e.Asc = "ASC", e.Desc = "DESC", e))(ze || {}), je = /* @__PURE__ */ ((e) => (e.AllReserved = "ALL_RESERVED", e.Available = "AVAILABLE", e.SoldOut = "SOLD_OUT", e))(je || {}), Ge = /* @__PURE__ */ ((e) => (e.Addon = "ADDON", e.Delivery = "DELIVERY", e.Door = "DOOR", e.Friend = "FRIEND", e.Guest = "GUEST", e.Pickup = "PICKUP", e.Promoter = "PROMOTER", e.Ticket = "TICKET", e))(Ge || {}), Ye = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(Ye || {});
|
|
3471
|
+
const In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2829
3472
|
__proto__: null,
|
|
2830
|
-
BasketOrderType:
|
|
2831
|
-
BasketService:
|
|
2832
|
-
CategoryService:
|
|
2833
|
-
EventService:
|
|
2834
|
-
EventStatus:
|
|
2835
|
-
PackageItemType:
|
|
2836
|
-
PackageService:
|
|
2837
|
-
PackageStatus:
|
|
2838
|
-
PackageTabType:
|
|
2839
|
-
PaymentMethodFeeType:
|
|
2840
|
-
PaymentService:
|
|
2841
|
-
ProductStatus:
|
|
2842
|
-
ProductType:
|
|
2843
|
-
SortOrder:
|
|
2844
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3473
|
+
BasketOrderType: L,
|
|
3474
|
+
BasketService: Qe,
|
|
3475
|
+
CategoryService: Ue,
|
|
3476
|
+
EventService: we,
|
|
3477
|
+
EventStatus: qe,
|
|
3478
|
+
PackageItemType: X,
|
|
3479
|
+
PackageService: Be,
|
|
3480
|
+
PackageStatus: Ve,
|
|
3481
|
+
PackageTabType: Me,
|
|
3482
|
+
PaymentMethodFeeType: Ye,
|
|
3483
|
+
PaymentService: $e,
|
|
3484
|
+
ProductStatus: je,
|
|
3485
|
+
ProductType: Ge,
|
|
3486
|
+
SortOrder: ze
|
|
3487
|
+
}, Symbol.toStringTag, { value: "Module" })), En = E`
|
|
2845
3488
|
query findActiveOrderById($id: String) {
|
|
2846
3489
|
findOrder(id: $id) {
|
|
2847
3490
|
id
|
|
@@ -2915,7 +3558,7 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2915
3558
|
}
|
|
2916
3559
|
}
|
|
2917
3560
|
}
|
|
2918
|
-
`,
|
|
3561
|
+
`, yn = E`
|
|
2919
3562
|
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2920
3563
|
reserveProduct(
|
|
2921
3564
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
@@ -2925,7 +3568,7 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2925
3568
|
amountReserved
|
|
2926
3569
|
}
|
|
2927
3570
|
}
|
|
2928
|
-
`,
|
|
3571
|
+
`, vn = E`
|
|
2929
3572
|
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2930
3573
|
releaseProduct(
|
|
2931
3574
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
@@ -2934,7 +3577,7 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2934
3577
|
amountReleased
|
|
2935
3578
|
}
|
|
2936
3579
|
}
|
|
2937
|
-
`,
|
|
3580
|
+
`, An = E`
|
|
2938
3581
|
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
|
|
2939
3582
|
configurePackage(
|
|
2940
3583
|
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
@@ -2944,7 +3587,7 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2944
3587
|
amountReserved
|
|
2945
3588
|
}
|
|
2946
3589
|
}
|
|
2947
|
-
`,
|
|
3590
|
+
`, Tn = E`
|
|
2948
3591
|
mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
|
|
2949
3592
|
reserveAdditionalPackageItem(
|
|
2950
3593
|
input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
|
|
@@ -2954,476 +3597,476 @@ const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2954
3597
|
amountReserved
|
|
2955
3598
|
}
|
|
2956
3599
|
}
|
|
2957
|
-
`,
|
|
3600
|
+
`, On = E`
|
|
2958
3601
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2959
3602
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2960
3603
|
}
|
|
2961
|
-
`,
|
|
3604
|
+
`, kn = E`
|
|
2962
3605
|
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2963
3606
|
createOrderCustomer(
|
|
2964
3607
|
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2965
3608
|
)
|
|
2966
3609
|
}
|
|
2967
|
-
`,
|
|
3610
|
+
`, Dn = E`
|
|
2968
3611
|
mutation deleteOrder($orderId: ID!) {
|
|
2969
3612
|
cancelOrder(id: $orderId)
|
|
2970
3613
|
}
|
|
2971
|
-
`,
|
|
2972
|
-
function
|
|
3614
|
+
`, xn = (e, t, n, i) => e();
|
|
3615
|
+
function Nn(e, t = xn) {
|
|
2973
3616
|
return {
|
|
2974
|
-
findActiveOrderById(
|
|
2975
|
-
return
|
|
3617
|
+
findActiveOrderById(n, i, r) {
|
|
3618
|
+
return t((s) => e.request({ document: En, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findActiveOrderById", "query", n);
|
|
2976
3619
|
},
|
|
2977
|
-
addToOrder(
|
|
2978
|
-
return
|
|
3620
|
+
addToOrder(n, i, r) {
|
|
3621
|
+
return t((s) => e.request({ document: yn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "addToOrder", "mutation", n);
|
|
2979
3622
|
},
|
|
2980
|
-
removeFromOrder(
|
|
2981
|
-
return
|
|
3623
|
+
removeFromOrder(n, i, r) {
|
|
3624
|
+
return t((s) => e.request({ document: vn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "removeFromOrder", "mutation", n);
|
|
2982
3625
|
},
|
|
2983
|
-
configurePackage(
|
|
2984
|
-
return
|
|
3626
|
+
configurePackage(n, i, r) {
|
|
3627
|
+
return t((s) => e.request({ document: An, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configurePackage", "mutation", n);
|
|
2985
3628
|
},
|
|
2986
|
-
reserveAdditionalPackageItem(
|
|
2987
|
-
return
|
|
3629
|
+
reserveAdditionalPackageItem(n, i, r) {
|
|
3630
|
+
return t((s) => e.request({ document: Tn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "reserveAdditionalPackageItem", "mutation", n);
|
|
2988
3631
|
},
|
|
2989
|
-
configureOrderDeliveryOption(
|
|
2990
|
-
return
|
|
3632
|
+
configureOrderDeliveryOption(n, i, r) {
|
|
3633
|
+
return t((s) => e.request({ document: On, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configureOrderDeliveryOption", "mutation", n);
|
|
2991
3634
|
},
|
|
2992
|
-
createOrderCustomer(
|
|
2993
|
-
return
|
|
3635
|
+
createOrderCustomer(n, i, r) {
|
|
3636
|
+
return t((s) => e.request({ document: kn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createOrderCustomer", "mutation", n);
|
|
2994
3637
|
},
|
|
2995
|
-
deleteOrder(
|
|
2996
|
-
return
|
|
3638
|
+
deleteOrder(n, i, r) {
|
|
3639
|
+
return t((s) => e.request({ document: Dn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "deleteOrder", "mutation", n);
|
|
2997
3640
|
}
|
|
2998
3641
|
};
|
|
2999
3642
|
}
|
|
3000
|
-
const
|
|
3643
|
+
const Ee = {
|
|
3001
3644
|
order: null,
|
|
3002
3645
|
processing: !1,
|
|
3003
3646
|
error: null
|
|
3004
|
-
},
|
|
3647
|
+
}, He = Xe({
|
|
3005
3648
|
name: "basket",
|
|
3006
|
-
initialState:
|
|
3649
|
+
initialState: Ee,
|
|
3007
3650
|
reducers: {
|
|
3008
|
-
setProcessing: (
|
|
3009
|
-
|
|
3651
|
+
setProcessing: (e, t) => {
|
|
3652
|
+
e.processing = t.payload;
|
|
3010
3653
|
},
|
|
3011
|
-
setError: (
|
|
3012
|
-
|
|
3654
|
+
setError: (e, t) => {
|
|
3655
|
+
e.error = t.payload;
|
|
3013
3656
|
},
|
|
3014
|
-
setOrder: (
|
|
3015
|
-
|
|
3657
|
+
setOrder: (e, t) => {
|
|
3658
|
+
e.order = t.payload;
|
|
3016
3659
|
},
|
|
3017
|
-
initializeOrder: (
|
|
3018
|
-
|
|
3019
|
-
id:
|
|
3020
|
-
currency:
|
|
3660
|
+
initializeOrder: (e, t) => {
|
|
3661
|
+
e.order || (e.order = {
|
|
3662
|
+
id: t.payload.id,
|
|
3663
|
+
currency: t.payload.currency,
|
|
3021
3664
|
items: [],
|
|
3022
|
-
expiredAt:
|
|
3665
|
+
expiredAt: t.payload.expiredAt
|
|
3023
3666
|
});
|
|
3024
3667
|
},
|
|
3025
|
-
addProduct: (
|
|
3026
|
-
const { input:
|
|
3027
|
-
if (!
|
|
3668
|
+
addProduct: (e, t) => {
|
|
3669
|
+
const { input: n, amountReserved: i, expiredAt: r } = t.payload;
|
|
3670
|
+
if (!e.order)
|
|
3028
3671
|
return;
|
|
3029
|
-
const s =
|
|
3672
|
+
const s = e.order.items.findIndex((o) => n.seat ? o.id === n.id && o.seats?.some((u) => u.id === n.seat?.id) : o.id === n.id);
|
|
3030
3673
|
if (s >= 0)
|
|
3031
|
-
|
|
3674
|
+
e.order.items[s].amount += i;
|
|
3032
3675
|
else {
|
|
3033
3676
|
const o = {
|
|
3034
|
-
id:
|
|
3677
|
+
id: n.id,
|
|
3035
3678
|
type: "PRODUCT",
|
|
3036
|
-
name:
|
|
3679
|
+
name: n.name,
|
|
3037
3680
|
amount: i,
|
|
3038
|
-
price:
|
|
3039
|
-
depositPrice:
|
|
3040
|
-
serviceFee:
|
|
3041
|
-
originalPrice:
|
|
3042
|
-
seats:
|
|
3681
|
+
price: n.price,
|
|
3682
|
+
depositPrice: n.depositPrice,
|
|
3683
|
+
serviceFee: n.serviceFee,
|
|
3684
|
+
originalPrice: n.price,
|
|
3685
|
+
seats: n.seat ? [{ id: n.seat.id, label: n.seat.label }] : void 0
|
|
3043
3686
|
};
|
|
3044
|
-
|
|
3687
|
+
e.order.items.push(o);
|
|
3045
3688
|
}
|
|
3046
|
-
|
|
3689
|
+
e.order.expiredAt = r;
|
|
3047
3690
|
},
|
|
3048
|
-
removeProduct: (
|
|
3049
|
-
if (!
|
|
3050
|
-
const { id:
|
|
3051
|
-
(o) => o.type === "PRODUCT" && o.id ===
|
|
3691
|
+
removeProduct: (e, t) => {
|
|
3692
|
+
if (!e.order) return;
|
|
3693
|
+
const { id: n, amountReleased: i, seatId: r } = t.payload, s = e.order.items.findIndex(
|
|
3694
|
+
(o) => o.type === "PRODUCT" && o.id === n
|
|
3052
3695
|
);
|
|
3053
3696
|
if (s !== -1) {
|
|
3054
|
-
const o =
|
|
3697
|
+
const o = e.order.items[s];
|
|
3055
3698
|
if (o.amount -= i, o.amount <= 0)
|
|
3056
|
-
|
|
3057
|
-
else if (o.seats &&
|
|
3058
|
-
const u = o.seats.findIndex((
|
|
3699
|
+
e.order.items.splice(s, 1);
|
|
3700
|
+
else if (o.seats && r) {
|
|
3701
|
+
const u = o.seats.findIndex((h) => h.id === r);
|
|
3059
3702
|
u !== -1 && o.seats.splice(u, 1);
|
|
3060
3703
|
}
|
|
3061
3704
|
}
|
|
3062
|
-
|
|
3705
|
+
e.order.items.length === 0 && (e.order = null);
|
|
3063
3706
|
},
|
|
3064
|
-
configurePackage: (
|
|
3065
|
-
const { input:
|
|
3066
|
-
|
|
3707
|
+
configurePackage: (e, t) => {
|
|
3708
|
+
const { input: n, amountReserved: i, expiredAt: r } = t.payload;
|
|
3709
|
+
e.order || (e.order = {
|
|
3067
3710
|
id: "",
|
|
3068
|
-
currency:
|
|
3711
|
+
currency: n.currency,
|
|
3069
3712
|
items: [],
|
|
3070
|
-
expiredAt:
|
|
3713
|
+
expiredAt: r
|
|
3071
3714
|
});
|
|
3072
|
-
const s =
|
|
3073
|
-
(o) => o.type === "PACKAGE" && o.id ===
|
|
3715
|
+
const s = e.order.items.find(
|
|
3716
|
+
(o) => o.type === "PACKAGE" && o.id === n.id
|
|
3074
3717
|
);
|
|
3075
|
-
s ? (s.amount = i, s.packageItems =
|
|
3076
|
-
id:
|
|
3718
|
+
s ? (s.amount = i, s.packageItems = n.items) : e.order.items.push({
|
|
3719
|
+
id: n.id,
|
|
3077
3720
|
type: "PACKAGE",
|
|
3078
|
-
name:
|
|
3721
|
+
name: n.name,
|
|
3079
3722
|
amount: i,
|
|
3080
|
-
price:
|
|
3081
|
-
depositPrice:
|
|
3082
|
-
originalPrice:
|
|
3083
|
-
serviceFee:
|
|
3084
|
-
packageItems:
|
|
3723
|
+
price: n.discountPrice ?? n.price,
|
|
3724
|
+
depositPrice: n.depositPrice,
|
|
3725
|
+
originalPrice: n.price,
|
|
3726
|
+
serviceFee: n.serviceFee,
|
|
3727
|
+
packageItems: n.items
|
|
3085
3728
|
});
|
|
3086
3729
|
},
|
|
3087
|
-
reserveAdditionalPackageItem: (
|
|
3088
|
-
const { input:
|
|
3089
|
-
|
|
3730
|
+
reserveAdditionalPackageItem: (e, t) => {
|
|
3731
|
+
const { input: n, amountReserved: i, expiredAt: r } = t.payload;
|
|
3732
|
+
e.order || (e.order = {
|
|
3090
3733
|
id: "",
|
|
3091
|
-
currency:
|
|
3734
|
+
currency: n.currency,
|
|
3092
3735
|
items: [],
|
|
3093
|
-
expiredAt:
|
|
3736
|
+
expiredAt: r
|
|
3094
3737
|
});
|
|
3095
|
-
const s =
|
|
3096
|
-
(u) => u.id ===
|
|
3097
|
-
), o =
|
|
3738
|
+
const s = e.order.items.findIndex(
|
|
3739
|
+
(u) => u.id === n.packageItemId
|
|
3740
|
+
), o = e.order.items[s];
|
|
3098
3741
|
o ? (o.amount = i, o.packageItems = [
|
|
3099
3742
|
{
|
|
3100
|
-
packageItemId:
|
|
3101
|
-
eventId:
|
|
3102
|
-
name:
|
|
3103
|
-
startAt:
|
|
3104
|
-
endAt:
|
|
3743
|
+
packageItemId: n.packageItemId,
|
|
3744
|
+
eventId: n.eventId,
|
|
3745
|
+
name: n.name,
|
|
3746
|
+
startAt: n.startAt,
|
|
3747
|
+
endAt: n.endAt
|
|
3105
3748
|
}
|
|
3106
|
-
], o.amount === 0 &&
|
|
3107
|
-
id:
|
|
3108
|
-
type:
|
|
3109
|
-
name:
|
|
3749
|
+
], o.amount === 0 && e.order.items.splice(s, 1)) : e.order.items.push({
|
|
3750
|
+
id: n.packageItemId,
|
|
3751
|
+
type: L.ADD_ONS,
|
|
3752
|
+
name: n.name,
|
|
3110
3753
|
amount: i,
|
|
3111
|
-
price:
|
|
3112
|
-
depositPrice:
|
|
3113
|
-
originalPrice:
|
|
3114
|
-
serviceFee:
|
|
3754
|
+
price: n.discountPrice ?? n.price,
|
|
3755
|
+
depositPrice: n.depositPrice,
|
|
3756
|
+
originalPrice: n.price,
|
|
3757
|
+
serviceFee: n.serviceFee,
|
|
3115
3758
|
packageItems: [
|
|
3116
3759
|
{
|
|
3117
|
-
packageItemId:
|
|
3118
|
-
eventId:
|
|
3119
|
-
name:
|
|
3120
|
-
startAt:
|
|
3121
|
-
endAt:
|
|
3760
|
+
packageItemId: n.packageItemId,
|
|
3761
|
+
eventId: n.eventId,
|
|
3762
|
+
name: n.name,
|
|
3763
|
+
startAt: n.startAt,
|
|
3764
|
+
endAt: n.endAt
|
|
3122
3765
|
}
|
|
3123
3766
|
]
|
|
3124
3767
|
});
|
|
3125
3768
|
},
|
|
3126
|
-
configureDelivery: (
|
|
3127
|
-
if (!
|
|
3128
|
-
const
|
|
3129
|
-
(
|
|
3769
|
+
configureDelivery: (e, t) => {
|
|
3770
|
+
if (!e.order) return;
|
|
3771
|
+
const n = t.payload, i = e.order.items.findIndex(
|
|
3772
|
+
(r) => r.type === "DELIVERY"
|
|
3130
3773
|
);
|
|
3131
|
-
if (
|
|
3774
|
+
if (n)
|
|
3132
3775
|
if (i !== -1) {
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3776
|
+
const r = e.order.items[i];
|
|
3777
|
+
r.id = n.id, r.name = n.name, r.price = n.price, r.serviceFee = n.serviceFee;
|
|
3135
3778
|
} else
|
|
3136
|
-
|
|
3137
|
-
id:
|
|
3779
|
+
e.order.items.push({
|
|
3780
|
+
id: n.id,
|
|
3138
3781
|
type: "PRODUCT",
|
|
3139
|
-
name:
|
|
3782
|
+
name: n.name,
|
|
3140
3783
|
amount: 1,
|
|
3141
|
-
price:
|
|
3142
|
-
originalPrice:
|
|
3143
|
-
serviceFee:
|
|
3784
|
+
price: n.price,
|
|
3785
|
+
originalPrice: n.price,
|
|
3786
|
+
serviceFee: n.serviceFee
|
|
3144
3787
|
});
|
|
3145
|
-
else i !== -1 &&
|
|
3788
|
+
else i !== -1 && e.order.items.splice(i, 1);
|
|
3146
3789
|
},
|
|
3147
|
-
configureCustomer: (
|
|
3148
|
-
|
|
3790
|
+
configureCustomer: (e, t) => {
|
|
3791
|
+
e.order && (e.order.customer = t.payload);
|
|
3149
3792
|
},
|
|
3150
|
-
clearBasket: () =>
|
|
3793
|
+
clearBasket: () => Ee
|
|
3151
3794
|
}
|
|
3152
3795
|
}), {
|
|
3153
|
-
setProcessing:
|
|
3154
|
-
initializeOrder:
|
|
3155
|
-
addProduct:
|
|
3156
|
-
removeProduct:
|
|
3157
|
-
configurePackage:
|
|
3158
|
-
configureDelivery:
|
|
3159
|
-
configureCustomer:
|
|
3160
|
-
reserveAdditionalPackageItem:
|
|
3161
|
-
clearBasket:
|
|
3162
|
-
} =
|
|
3163
|
-
class
|
|
3796
|
+
setProcessing: _,
|
|
3797
|
+
initializeOrder: j,
|
|
3798
|
+
addProduct: ye,
|
|
3799
|
+
removeProduct: bn,
|
|
3800
|
+
configurePackage: ve,
|
|
3801
|
+
configureDelivery: Pn,
|
|
3802
|
+
configureCustomer: Ae,
|
|
3803
|
+
reserveAdditionalPackageItem: Sn,
|
|
3804
|
+
clearBasket: Te
|
|
3805
|
+
} = He.actions;
|
|
3806
|
+
class Qe {
|
|
3164
3807
|
orderIdKey = "ORDER_ID";
|
|
3165
3808
|
config;
|
|
3166
3809
|
sdk;
|
|
3167
3810
|
store;
|
|
3168
|
-
constructor(
|
|
3169
|
-
this.config =
|
|
3811
|
+
constructor(t) {
|
|
3812
|
+
this.config = t, this.store = Ke({
|
|
3170
3813
|
reducer: {
|
|
3171
|
-
basket:
|
|
3814
|
+
basket: He.reducer
|
|
3172
3815
|
}
|
|
3173
|
-
}), this.sdk =
|
|
3816
|
+
}), this.sdk = Nn(new ae(t.apiUrl)), this.restoreOrderFromSession().then(() => {
|
|
3174
3817
|
this.debugLog("Restore order from session");
|
|
3175
3818
|
});
|
|
3176
3819
|
}
|
|
3177
3820
|
// Store functions
|
|
3178
|
-
subscribe(
|
|
3179
|
-
return this.store.subscribe(
|
|
3821
|
+
subscribe(t) {
|
|
3822
|
+
return this.store.subscribe(t);
|
|
3180
3823
|
}
|
|
3181
3824
|
getCurrentOrder() {
|
|
3182
|
-
const
|
|
3183
|
-
if (!
|
|
3825
|
+
const t = this.getState();
|
|
3826
|
+
if (!t.order)
|
|
3184
3827
|
return null;
|
|
3185
|
-
const
|
|
3828
|
+
const n = t.order.items.reduce((i, r) => i + (r.amount || 0), 0);
|
|
3186
3829
|
return {
|
|
3187
|
-
...
|
|
3188
|
-
count:
|
|
3830
|
+
...t.order,
|
|
3831
|
+
count: n
|
|
3189
3832
|
};
|
|
3190
3833
|
}
|
|
3191
3834
|
getSelectedPackageEvent() {
|
|
3192
|
-
return this.getState().order?.items.flatMap((
|
|
3835
|
+
return this.getState().order?.items.flatMap((n) => n.packageItems?.map((i) => i.eventId) ?? []) ?? [];
|
|
3193
3836
|
}
|
|
3194
3837
|
// Basket update functions
|
|
3195
|
-
async addProduct(
|
|
3196
|
-
this.store.dispatch(
|
|
3838
|
+
async addProduct(t) {
|
|
3839
|
+
this.store.dispatch(_(!0));
|
|
3197
3840
|
try {
|
|
3198
3841
|
const i = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3199
3842
|
this.debugLog("Adding product", {
|
|
3200
|
-
productId:
|
|
3843
|
+
productId: t.id,
|
|
3201
3844
|
orderId: i,
|
|
3202
|
-
amount:
|
|
3203
|
-
seat:
|
|
3845
|
+
amount: t.amount,
|
|
3846
|
+
seat: t.seat
|
|
3204
3847
|
});
|
|
3205
|
-
const
|
|
3206
|
-
productId:
|
|
3848
|
+
const r = await this.sdk.addToOrder({
|
|
3849
|
+
productId: t.id,
|
|
3207
3850
|
orderId: i,
|
|
3208
|
-
additionalData:
|
|
3851
|
+
additionalData: t.seat ? {
|
|
3209
3852
|
seat: {
|
|
3210
|
-
seatId:
|
|
3211
|
-
seatLabel:
|
|
3212
|
-
holdToken:
|
|
3853
|
+
seatId: t.seat.id,
|
|
3854
|
+
seatLabel: t.seat.label,
|
|
3855
|
+
holdToken: t.seat.holdToken
|
|
3213
3856
|
}
|
|
3214
3857
|
} : null,
|
|
3215
3858
|
trackerId: this.config.trackerId,
|
|
3216
3859
|
shopId: this.config.shopId,
|
|
3217
|
-
amount:
|
|
3860
|
+
amount: t.amount
|
|
3218
3861
|
});
|
|
3219
|
-
if (
|
|
3220
|
-
const { orderId: s, expiredAt: o, amountReserved: u } =
|
|
3221
|
-
this.debugLog("Product added successfully",
|
|
3222
|
-
|
|
3862
|
+
if (r?.reserveProduct) {
|
|
3863
|
+
const { orderId: s, expiredAt: o, amountReserved: u } = r.reserveProduct;
|
|
3864
|
+
this.debugLog("Product added successfully", r.reserveProduct), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3865
|
+
j({
|
|
3223
3866
|
id: s,
|
|
3224
|
-
currency:
|
|
3225
|
-
expiredAt: o ?
|
|
3867
|
+
currency: t.currency,
|
|
3868
|
+
expiredAt: o ? x.fromISO(o) : void 0
|
|
3226
3869
|
})
|
|
3227
3870
|
), this.store.dispatch(
|
|
3228
|
-
|
|
3229
|
-
input:
|
|
3871
|
+
ye({
|
|
3872
|
+
input: t,
|
|
3230
3873
|
amountReserved: u,
|
|
3231
|
-
expiredAt: o ?
|
|
3874
|
+
expiredAt: o ? x.fromISO(o) : void 0
|
|
3232
3875
|
})
|
|
3233
3876
|
);
|
|
3234
3877
|
}
|
|
3235
|
-
} catch (
|
|
3236
|
-
throw this.debugLog("Error adding product",
|
|
3878
|
+
} catch (n) {
|
|
3879
|
+
throw this.debugLog("Error adding product", n), this.handleError(n), n;
|
|
3237
3880
|
} finally {
|
|
3238
|
-
this.store.dispatch(
|
|
3881
|
+
this.store.dispatch(_(!1));
|
|
3239
3882
|
}
|
|
3240
3883
|
}
|
|
3241
|
-
async removeProduct(
|
|
3884
|
+
async removeProduct(t) {
|
|
3242
3885
|
const i = this.getState().order;
|
|
3243
3886
|
if (i) {
|
|
3244
|
-
this.store.dispatch(
|
|
3887
|
+
this.store.dispatch(_(!0));
|
|
3245
3888
|
try {
|
|
3246
3889
|
this.debugLog("Removing product", {
|
|
3247
|
-
productId:
|
|
3890
|
+
productId: t.id,
|
|
3248
3891
|
orderId: i.id,
|
|
3249
|
-
amount:
|
|
3892
|
+
amount: t.amount
|
|
3250
3893
|
});
|
|
3251
|
-
const
|
|
3252
|
-
productId:
|
|
3894
|
+
const r = await this.sdk.removeFromOrder({
|
|
3895
|
+
productId: t.id,
|
|
3253
3896
|
orderId: i.id,
|
|
3254
|
-
additionalData:
|
|
3897
|
+
additionalData: t.seat ? {
|
|
3255
3898
|
seat: {
|
|
3256
|
-
seatId:
|
|
3257
|
-
seatLabel:
|
|
3899
|
+
seatId: t.seat.id,
|
|
3900
|
+
seatLabel: t.seat.label
|
|
3258
3901
|
}
|
|
3259
3902
|
} : null,
|
|
3260
|
-
amount:
|
|
3903
|
+
amount: t.amount
|
|
3261
3904
|
});
|
|
3262
|
-
if (
|
|
3263
|
-
const { amountReleased: s } =
|
|
3264
|
-
this.debugLog("Product removed successfully",
|
|
3265
|
-
|
|
3266
|
-
id:
|
|
3905
|
+
if (r?.releaseProduct) {
|
|
3906
|
+
const { amountReleased: s } = r.releaseProduct;
|
|
3907
|
+
this.debugLog("Product removed successfully", r.releaseProduct), this.store.dispatch(
|
|
3908
|
+
bn({
|
|
3909
|
+
id: t.id,
|
|
3267
3910
|
amountReleased: s,
|
|
3268
|
-
seatId:
|
|
3911
|
+
seatId: t.seat?.id
|
|
3269
3912
|
})
|
|
3270
3913
|
);
|
|
3271
3914
|
const o = this.getState();
|
|
3272
3915
|
(!o.order || o.order.items.length === 0) && (this.debugLog("Basket is now empty, cancelling order and clearing session"), await this.cancelOrder());
|
|
3273
3916
|
}
|
|
3274
|
-
} catch (
|
|
3275
|
-
throw this.debugLog("Error removing product",
|
|
3917
|
+
} catch (r) {
|
|
3918
|
+
throw this.debugLog("Error removing product", r), this.handleError(r), r;
|
|
3276
3919
|
} finally {
|
|
3277
|
-
this.store.dispatch(
|
|
3920
|
+
this.store.dispatch(_(!1));
|
|
3278
3921
|
}
|
|
3279
3922
|
}
|
|
3280
3923
|
}
|
|
3281
|
-
async configurePackage(
|
|
3282
|
-
this.store.dispatch(
|
|
3924
|
+
async configurePackage(t) {
|
|
3925
|
+
this.store.dispatch(_(!0));
|
|
3283
3926
|
try {
|
|
3284
|
-
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(),
|
|
3927
|
+
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(), r = t.items.map((o) => ({
|
|
3285
3928
|
packageItemId: o.packageItemId,
|
|
3286
3929
|
eventId: o.eventId
|
|
3287
3930
|
}));
|
|
3288
3931
|
this.debugLog("Configuring package", {
|
|
3289
|
-
packageId:
|
|
3932
|
+
packageId: t.id,
|
|
3290
3933
|
orderId: i,
|
|
3291
|
-
amount:
|
|
3292
|
-
items:
|
|
3934
|
+
amount: t.amount,
|
|
3935
|
+
items: r,
|
|
3293
3936
|
shopId: this.config.shopId
|
|
3294
3937
|
});
|
|
3295
3938
|
const s = await this.sdk.configurePackage({
|
|
3296
3939
|
trackerId: this.config.trackerId,
|
|
3297
3940
|
shopId: this.config.shopId,
|
|
3298
|
-
packageId:
|
|
3941
|
+
packageId: t.id,
|
|
3299
3942
|
orderId: i,
|
|
3300
|
-
amount:
|
|
3301
|
-
items:
|
|
3943
|
+
amount: t.amount,
|
|
3944
|
+
items: r
|
|
3302
3945
|
});
|
|
3303
3946
|
if (this.debugLog("Configure package response", s), s?.configurePackage && s.configurePackage.amountReserved > 0) {
|
|
3304
|
-
const { orderId: o, expiredAt: u, amountReserved:
|
|
3947
|
+
const { orderId: o, expiredAt: u, amountReserved: h } = s.configurePackage;
|
|
3305
3948
|
return this.debugLog("Package configured successfully"), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3306
|
-
|
|
3949
|
+
j({
|
|
3307
3950
|
id: o,
|
|
3308
|
-
currency:
|
|
3309
|
-
expiredAt: u ?
|
|
3951
|
+
currency: t.currency,
|
|
3952
|
+
expiredAt: u ? x.fromISO(u) : void 0
|
|
3310
3953
|
})
|
|
3311
3954
|
), this.store.dispatch(
|
|
3312
|
-
|
|
3313
|
-
input:
|
|
3314
|
-
amountReserved:
|
|
3315
|
-
expiredAt: u ?
|
|
3955
|
+
ve({
|
|
3956
|
+
input: t,
|
|
3957
|
+
amountReserved: h,
|
|
3958
|
+
expiredAt: u ? x.fromISO(u) : void 0
|
|
3316
3959
|
})
|
|
3317
3960
|
), null;
|
|
3318
3961
|
} else
|
|
3319
3962
|
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3320
|
-
} catch (
|
|
3321
|
-
return this.debugLog("Error configuring package",
|
|
3963
|
+
} catch (n) {
|
|
3964
|
+
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3322
3965
|
} finally {
|
|
3323
|
-
this.store.dispatch(
|
|
3966
|
+
this.store.dispatch(_(!1));
|
|
3324
3967
|
}
|
|
3325
3968
|
}
|
|
3326
|
-
async configureDelivery(
|
|
3327
|
-
this.store.dispatch(
|
|
3969
|
+
async configureDelivery(t) {
|
|
3970
|
+
this.store.dispatch(_(!0));
|
|
3328
3971
|
try {
|
|
3329
|
-
this.store.dispatch(
|
|
3330
|
-
} catch (
|
|
3331
|
-
throw this.debugLog("Error setting delivery",
|
|
3972
|
+
this.store.dispatch(Pn(t));
|
|
3973
|
+
} catch (n) {
|
|
3974
|
+
throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
|
|
3332
3975
|
} finally {
|
|
3333
|
-
this.store.dispatch(
|
|
3976
|
+
this.store.dispatch(_(!1));
|
|
3334
3977
|
}
|
|
3335
3978
|
}
|
|
3336
|
-
async configureCustomer(
|
|
3979
|
+
async configureCustomer(t) {
|
|
3337
3980
|
const i = this.getState().order;
|
|
3338
3981
|
if (!i)
|
|
3339
3982
|
throw new Error("No active order. Add items to basket first.");
|
|
3340
|
-
this.debugLog("Creating/replacing customer", { orderId: i.id, email:
|
|
3983
|
+
this.debugLog("Creating/replacing customer", { orderId: i.id, email: t.email });
|
|
3341
3984
|
try {
|
|
3342
|
-
const
|
|
3985
|
+
const r = await this.sdk.createOrderCustomer({
|
|
3343
3986
|
orderId: i.id,
|
|
3344
|
-
customer:
|
|
3987
|
+
customer: t
|
|
3345
3988
|
});
|
|
3346
|
-
this.debugLog("Customer set successfully",
|
|
3347
|
-
} catch (
|
|
3348
|
-
throw this.debugLog("Failed to set customer",
|
|
3989
|
+
this.debugLog("Customer set successfully", r), this.store.dispatch(Ae(t));
|
|
3990
|
+
} catch (r) {
|
|
3991
|
+
throw this.debugLog("Failed to set customer", r), new Error(`Failed to set customer: ${r.message}`);
|
|
3349
3992
|
}
|
|
3350
3993
|
}
|
|
3351
|
-
async reserveAdditionalPackageItem(
|
|
3352
|
-
this.store.dispatch(
|
|
3994
|
+
async reserveAdditionalPackageItem(t) {
|
|
3995
|
+
this.store.dispatch(_(!0));
|
|
3353
3996
|
try {
|
|
3354
3997
|
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3355
3998
|
this.debugLog("reserve additional packageItem", {
|
|
3356
3999
|
orderId: i,
|
|
3357
|
-
eventId:
|
|
3358
|
-
amount:
|
|
3359
|
-
packageId:
|
|
3360
|
-
packageItemId:
|
|
4000
|
+
eventId: t.eventId,
|
|
4001
|
+
amount: t.amount,
|
|
4002
|
+
packageId: t.packageId,
|
|
4003
|
+
packageItemId: t.packageItemId
|
|
3361
4004
|
});
|
|
3362
|
-
const
|
|
4005
|
+
const r = await this.sdk.reserveAdditionalPackageItem({
|
|
3363
4006
|
orderId: i,
|
|
3364
|
-
eventId:
|
|
3365
|
-
amount:
|
|
3366
|
-
packageId:
|
|
3367
|
-
packageItemId:
|
|
4007
|
+
eventId: t.eventId,
|
|
4008
|
+
amount: t.amount,
|
|
4009
|
+
packageId: t.packageId,
|
|
4010
|
+
packageItemId: t.packageItemId
|
|
3368
4011
|
});
|
|
3369
|
-
if (this.debugLog("reserve additional packageItem",
|
|
3370
|
-
const { orderId: s, expiredAt: o, amountReserved: u } =
|
|
4012
|
+
if (this.debugLog("reserve additional packageItem", r), r?.reserveAdditionalPackageItem && r.reserveAdditionalPackageItem.amountReserved > 0) {
|
|
4013
|
+
const { orderId: s, expiredAt: o, amountReserved: u } = r.reserveAdditionalPackageItem;
|
|
3371
4014
|
return this.debugLog("Reserve configured successfully"), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3372
|
-
|
|
4015
|
+
j({
|
|
3373
4016
|
id: s,
|
|
3374
|
-
currency:
|
|
3375
|
-
expiredAt: o ?
|
|
4017
|
+
currency: t.currency,
|
|
4018
|
+
expiredAt: o ? x.fromISO(o) : void 0
|
|
3376
4019
|
})
|
|
3377
4020
|
), this.store.dispatch(
|
|
3378
|
-
|
|
3379
|
-
input:
|
|
4021
|
+
Sn({
|
|
4022
|
+
input: t,
|
|
3380
4023
|
amountReserved: u,
|
|
3381
|
-
expiredAt: o ?
|
|
4024
|
+
expiredAt: o ? x.fromISO(o) : void 0
|
|
3382
4025
|
})
|
|
3383
4026
|
), null;
|
|
3384
4027
|
} else
|
|
3385
4028
|
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3386
|
-
} catch (
|
|
3387
|
-
return this.debugLog("Error configuring package",
|
|
4029
|
+
} catch (n) {
|
|
4030
|
+
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3388
4031
|
} finally {
|
|
3389
|
-
this.store.dispatch(
|
|
4032
|
+
this.store.dispatch(_(!1));
|
|
3390
4033
|
}
|
|
3391
4034
|
}
|
|
3392
4035
|
// Cancel and clear order functions
|
|
3393
4036
|
async cancelOrder() {
|
|
3394
|
-
const
|
|
3395
|
-
|
|
4037
|
+
const t = sessionStorage.getItem(this.orderIdKey);
|
|
4038
|
+
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
|
|
3396
4039
|
}
|
|
3397
4040
|
clearOrderFromSession() {
|
|
3398
|
-
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(
|
|
4041
|
+
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(Te());
|
|
3399
4042
|
}
|
|
3400
4043
|
// Private functions for fetching the current order from a session
|
|
3401
4044
|
async restoreOrderFromSession() {
|
|
3402
|
-
const
|
|
3403
|
-
if (
|
|
3404
|
-
this.debugLog("Found existing order ID in session, restoring...", { orderId:
|
|
4045
|
+
const t = sessionStorage.getItem(this.orderIdKey);
|
|
4046
|
+
if (t) {
|
|
4047
|
+
this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
|
|
3405
4048
|
try {
|
|
3406
|
-
await this.fetchOrder(
|
|
3407
|
-
} catch (
|
|
3408
|
-
this.debugLog("Failed to restore order, clearing session",
|
|
4049
|
+
await this.fetchOrder(t), this.debugLog("Order restored successfully");
|
|
4050
|
+
} catch (n) {
|
|
4051
|
+
this.debugLog("Failed to restore order, clearing session", n), this.clearOrderFromSession();
|
|
3409
4052
|
}
|
|
3410
4053
|
}
|
|
3411
4054
|
}
|
|
3412
|
-
async fetchOrder(
|
|
3413
|
-
this.debugLog("Fetching order from server", { orderId:
|
|
4055
|
+
async fetchOrder(t) {
|
|
4056
|
+
this.debugLog("Fetching order from server", { orderId: t });
|
|
3414
4057
|
try {
|
|
3415
|
-
const
|
|
3416
|
-
if (!
|
|
4058
|
+
const n = await this.sdk.findActiveOrderById({ id: t });
|
|
4059
|
+
if (!n?.findOrder) {
|
|
3417
4060
|
this.debugLog("Order not found"), this.clearOrderFromSession();
|
|
3418
4061
|
return;
|
|
3419
4062
|
}
|
|
3420
|
-
const i =
|
|
4063
|
+
const i = n.findOrder;
|
|
3421
4064
|
this.debugLog("Order fetched successfully", i);
|
|
3422
|
-
const
|
|
3423
|
-
let
|
|
3424
|
-
return c.product.type === "PROMOTER" ?
|
|
4065
|
+
const r = i.items, s = r.filter((c) => c.product != null && c.amount > 0).map((c) => {
|
|
4066
|
+
let m = L.PRODUCT;
|
|
4067
|
+
return c.product.type === "PROMOTER" ? m = L.ADD_ONS : c.product.type === "PICKUP" ? m = L.PICKUP : c.product.type === "DELIVERY" && (m = L.DELIVERY), {
|
|
3425
4068
|
id: c.product.id,
|
|
3426
|
-
type:
|
|
4069
|
+
type: m,
|
|
3427
4070
|
name: c.product.name,
|
|
3428
4071
|
icon: c.product.icon,
|
|
3429
4072
|
description: c.product.description,
|
|
@@ -3432,43 +4075,43 @@ class be {
|
|
|
3432
4075
|
depositPrice: c.depositPrice ?? 0,
|
|
3433
4076
|
originalPrice: c.originalPrice ?? 0,
|
|
3434
4077
|
serviceFee: c.serviceFee ?? 0,
|
|
3435
|
-
seats: c.seats?.map((
|
|
3436
|
-
id:
|
|
3437
|
-
label:
|
|
4078
|
+
seats: c.seats?.map((g) => ({
|
|
4079
|
+
id: g.id,
|
|
4080
|
+
label: g.label
|
|
3438
4081
|
}))
|
|
3439
4082
|
};
|
|
3440
|
-
}), o =
|
|
4083
|
+
}), o = r.filter((c) => c.packageItem != null && c.amount > 0).reduce((c, m) => {
|
|
3441
4084
|
const {
|
|
3442
|
-
packageItem:
|
|
3443
|
-
event:
|
|
4085
|
+
packageItem: g,
|
|
4086
|
+
event: y,
|
|
3444
4087
|
amount: I,
|
|
3445
|
-
price:
|
|
3446
|
-
serviceFee:
|
|
3447
|
-
depositPrice:
|
|
3448
|
-
originalPrice:
|
|
3449
|
-
} =
|
|
3450
|
-
c[
|
|
3451
|
-
id:
|
|
3452
|
-
type:
|
|
3453
|
-
name:
|
|
4088
|
+
price: O,
|
|
4089
|
+
serviceFee: N,
|
|
4090
|
+
depositPrice: k,
|
|
4091
|
+
originalPrice: R
|
|
4092
|
+
} = m, T = g.package.id;
|
|
4093
|
+
c[T] ? (c[T].price += O ?? 0, c[T].serviceFee += N ?? 0, c[T].originalPrice += R ?? 0, c[T].depositPrice += k ?? O ?? 0) : c[T] = {
|
|
4094
|
+
id: T,
|
|
4095
|
+
type: L.PACKAGE,
|
|
4096
|
+
name: g.package.name,
|
|
3454
4097
|
amount: I,
|
|
3455
|
-
price:
|
|
3456
|
-
serviceFee:
|
|
3457
|
-
depositPrice:
|
|
3458
|
-
originalPrice:
|
|
4098
|
+
price: O ?? 0,
|
|
4099
|
+
serviceFee: N ?? 0,
|
|
4100
|
+
depositPrice: k ?? O ?? 0,
|
|
4101
|
+
originalPrice: R ?? 0,
|
|
3459
4102
|
packageItems: []
|
|
3460
4103
|
};
|
|
3461
|
-
const
|
|
3462
|
-
zone:
|
|
3463
|
-
}),
|
|
3464
|
-
zone:
|
|
4104
|
+
const b = x.fromISO(y.startAt, {
|
|
4105
|
+
zone: y.timezone
|
|
4106
|
+
}), D = x.fromISO(y.endAt, {
|
|
4107
|
+
zone: y.timezone
|
|
3465
4108
|
});
|
|
3466
|
-
return c[
|
|
3467
|
-
packageItemId:
|
|
3468
|
-
eventId:
|
|
3469
|
-
name:
|
|
3470
|
-
startAt:
|
|
3471
|
-
endAt:
|
|
4109
|
+
return c[T].packageItems.push({
|
|
4110
|
+
packageItemId: g.id,
|
|
4111
|
+
eventId: y.id,
|
|
4112
|
+
name: y.name,
|
|
4113
|
+
startAt: b,
|
|
4114
|
+
endAt: D
|
|
3472
4115
|
}), c;
|
|
3473
4116
|
}, {}), u = [
|
|
3474
4117
|
...s,
|
|
@@ -3478,21 +4121,21 @@ class be {
|
|
|
3478
4121
|
this.debugLog("All order items have zero or negative amounts, clearing session"), this.clearOrderFromSession();
|
|
3479
4122
|
return;
|
|
3480
4123
|
}
|
|
3481
|
-
const
|
|
3482
|
-
if (
|
|
4124
|
+
const h = r.filter((c) => c.amount > 0).map((c) => new Date(c.expiredAt).getTime());
|
|
4125
|
+
if (h.length === 0) {
|
|
3483
4126
|
this.debugLog("No valid items with expiration times, clearing session"), this.clearOrderFromSession();
|
|
3484
4127
|
return;
|
|
3485
4128
|
}
|
|
3486
|
-
const
|
|
3487
|
-
this.store.dispatch(
|
|
3488
|
-
|
|
4129
|
+
const p = x.fromMillis(Math.min(...h));
|
|
4130
|
+
this.store.dispatch(Te()), this.store.dispatch(
|
|
4131
|
+
j({
|
|
3489
4132
|
id: i.id,
|
|
3490
4133
|
currency: i.currency,
|
|
3491
|
-
expiredAt:
|
|
4134
|
+
expiredAt: p
|
|
3492
4135
|
})
|
|
3493
4136
|
), u.forEach((c) => {
|
|
3494
|
-
c.type ===
|
|
3495
|
-
|
|
4137
|
+
c.type === L.PACKAGE ? this.store.dispatch(
|
|
4138
|
+
ve({
|
|
3496
4139
|
input: {
|
|
3497
4140
|
id: c.id,
|
|
3498
4141
|
name: c.name,
|
|
@@ -3504,10 +4147,10 @@ class be {
|
|
|
3504
4147
|
items: c.packageItems || []
|
|
3505
4148
|
},
|
|
3506
4149
|
amountReserved: c.amount,
|
|
3507
|
-
expiredAt:
|
|
4150
|
+
expiredAt: p
|
|
3508
4151
|
})
|
|
3509
4152
|
) : this.store.dispatch(
|
|
3510
|
-
|
|
4153
|
+
ye({
|
|
3511
4154
|
input: {
|
|
3512
4155
|
id: c.id,
|
|
3513
4156
|
name: c.name,
|
|
@@ -3518,39 +4161,39 @@ class be {
|
|
|
3518
4161
|
amount: c.amount
|
|
3519
4162
|
},
|
|
3520
4163
|
amountReserved: c.amount,
|
|
3521
|
-
expiredAt:
|
|
4164
|
+
expiredAt: p
|
|
3522
4165
|
})
|
|
3523
4166
|
);
|
|
3524
4167
|
}), i.mainBooker && (this.debugLog("Order has customer (mainBooker)", i.mainBooker), this.store.dispatch(
|
|
3525
|
-
|
|
4168
|
+
Ae({
|
|
3526
4169
|
firstName: i.mainBooker.firstName ?? void 0,
|
|
3527
4170
|
lastName: i.mainBooker.lastName ?? void 0,
|
|
3528
4171
|
email: i.mainBooker.email ?? void 0,
|
|
3529
4172
|
age: i.mainBooker.age ?? void 0
|
|
3530
4173
|
})
|
|
3531
4174
|
)), this.debugLog("Order state fully synced", this.getState());
|
|
3532
|
-
} catch (
|
|
3533
|
-
throw this.debugLog("Error fetching order",
|
|
4175
|
+
} catch (n) {
|
|
4176
|
+
throw this.debugLog("Error fetching order", n), n;
|
|
3534
4177
|
}
|
|
3535
4178
|
}
|
|
3536
4179
|
// Private helper functions
|
|
3537
4180
|
generateOrderId() {
|
|
3538
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
3539
|
-
const
|
|
3540
|
-
return (
|
|
4181
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
4182
|
+
const n = Math.random() * 16 | 0;
|
|
4183
|
+
return (t === "x" ? n : n & 3 | 8).toString(16);
|
|
3541
4184
|
});
|
|
3542
4185
|
}
|
|
3543
|
-
debugLog(
|
|
3544
|
-
this.config.debug && console.log(`[BasketService] ${
|
|
4186
|
+
debugLog(t, n) {
|
|
4187
|
+
this.config.debug && console.log(`[BasketService] ${t}`, n || "");
|
|
3545
4188
|
}
|
|
3546
|
-
handleError(
|
|
3547
|
-
const
|
|
3548
|
-
if (
|
|
3549
|
-
const i =
|
|
4189
|
+
handleError(t) {
|
|
4190
|
+
const n = t;
|
|
4191
|
+
if (n.graphQLErrors && n.graphQLErrors.length > 0) {
|
|
4192
|
+
const i = n.graphQLErrors[0];
|
|
3550
4193
|
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
3551
4194
|
}
|
|
3552
|
-
if (
|
|
3553
|
-
const i =
|
|
4195
|
+
if (n.response?.errors && n.response.errors.length > 0) {
|
|
4196
|
+
const i = n.response.errors[0];
|
|
3554
4197
|
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
3555
4198
|
}
|
|
3556
4199
|
}
|
|
@@ -3558,61 +4201,61 @@ class be {
|
|
|
3558
4201
|
return this.store.getState().basket;
|
|
3559
4202
|
}
|
|
3560
4203
|
}
|
|
3561
|
-
const
|
|
3562
|
-
class
|
|
4204
|
+
const Cn = "https://api.ticketapp.com/graphql", Oe = "TIC_TRACKER_ID";
|
|
4205
|
+
class Fn {
|
|
3563
4206
|
basket;
|
|
3564
4207
|
event;
|
|
3565
4208
|
payment;
|
|
3566
4209
|
package;
|
|
3567
4210
|
category;
|
|
3568
4211
|
// Attach selected public types to the SDK class
|
|
3569
|
-
static Types =
|
|
3570
|
-
constructor(
|
|
3571
|
-
const { organizationId:
|
|
3572
|
-
this.basket = new
|
|
4212
|
+
static Types = In;
|
|
4213
|
+
constructor(t) {
|
|
4214
|
+
const { organizationId: n, debug: i = !1, apiUrl: r = Cn } = t, s = this.getOrInitTrackerId();
|
|
4215
|
+
this.basket = new Qe({ debug: i, apiUrl: r, shopId: t.shopId, trackerId: s }), this.event = new we({ organizationId: n, debug: i, apiUrl: r, trackerId: s }), this.payment = new $e({ debug: i, apiUrl: r }), this.package = new Be({ organizationId: n, debug: i, apiUrl: r }), this.category = new Ue({ organizationId: n, debug: i, apiUrl: r });
|
|
3573
4216
|
}
|
|
3574
4217
|
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
3575
4218
|
// Persist to session when found via config or URL for subsequent page loads
|
|
3576
4219
|
getOrInitTrackerId() {
|
|
3577
4220
|
try {
|
|
3578
|
-
let
|
|
4221
|
+
let t = null, n = null;
|
|
3579
4222
|
if (typeof window < "u") {
|
|
3580
4223
|
try {
|
|
3581
|
-
|
|
4224
|
+
n = new URL(window.location.href).searchParams.get("trackerId");
|
|
3582
4225
|
} catch {
|
|
3583
4226
|
}
|
|
3584
4227
|
try {
|
|
3585
|
-
|
|
4228
|
+
t = window.sessionStorage?.getItem(Oe) ?? null;
|
|
3586
4229
|
} catch {
|
|
3587
4230
|
}
|
|
3588
4231
|
}
|
|
3589
|
-
if (
|
|
4232
|
+
if (n && n.trim().length > 0) {
|
|
3590
4233
|
try {
|
|
3591
|
-
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(
|
|
4234
|
+
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Oe, n);
|
|
3592
4235
|
} catch {
|
|
3593
4236
|
}
|
|
3594
|
-
return
|
|
4237
|
+
return n;
|
|
3595
4238
|
}
|
|
3596
|
-
return
|
|
4239
|
+
return t && t.trim().length > 0 ? t : void 0;
|
|
3597
4240
|
} catch {
|
|
3598
4241
|
return;
|
|
3599
4242
|
}
|
|
3600
4243
|
}
|
|
3601
4244
|
}
|
|
3602
4245
|
export {
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
4246
|
+
L as BasketOrderType,
|
|
4247
|
+
Qe as BasketService,
|
|
4248
|
+
Ue as CategoryService,
|
|
4249
|
+
we as EventService,
|
|
4250
|
+
qe as EventStatus,
|
|
4251
|
+
X as PackageItemType,
|
|
4252
|
+
Be as PackageService,
|
|
4253
|
+
Ve as PackageStatus,
|
|
4254
|
+
Me as PackageTabType,
|
|
4255
|
+
Ye as PaymentMethodFeeType,
|
|
4256
|
+
$e as PaymentService,
|
|
4257
|
+
je as ProductStatus,
|
|
4258
|
+
Ge as ProductType,
|
|
4259
|
+
ze as SortOrder,
|
|
4260
|
+
Fn as TicketappSDK
|
|
3618
4261
|
};
|