@ticketapp-dev/shop-sdk 1.0.30 → 1.0.32
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/index.js +1134 -1460
- package/dist/services/basket/basket.service.d.ts +9 -24
- package/dist/services/basket/basket.service.d.ts.map +1 -1
- package/dist/services/category/category.service.d.ts +1 -1
- package/dist/services/category/category.service.d.ts.map +1 -1
- package/dist/services/category/category.service.generated.d.ts +16 -0
- package/dist/services/category/category.service.generated.d.ts.map +1 -1
- package/dist/services/event/event.service.d.ts +4 -23
- package/dist/services/event/event.service.d.ts.map +1 -1
- package/dist/services/event/event.service.generated.d.ts +14 -0
- package/dist/services/event/event.service.generated.d.ts.map +1 -1
- package/dist/services/package/package.service.d.ts +1 -9
- package/dist/services/package/package.service.d.ts.map +1 -1
- package/dist/services/payment/payment.service.d.ts.map +1 -1
- package/dist/services/payment/payment.service.generated.d.ts +1 -0
- package/dist/services/payment/payment.service.generated.d.ts.map +1 -1
- package/dist/types/index.d.ts +89 -38
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/store/store.d.ts +0 -454
- package/dist/store/store.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,91 +1,90 @@
|
|
|
1
|
-
import { GraphQLClient as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1
|
+
import { GraphQLClient as oe } from "graphql-request";
|
|
2
|
+
import { DateTime as L } from "luxon";
|
|
3
|
+
var _ = /* @__PURE__ */ ((e) => (e.PACKAGE = "PACKAGE", e.PRODUCT = "PRODUCT", e.ADD_ONS = "ADD_ONS", e.DELIVERY = "DELIVERY", e.PICKUP = "PICKUP", e))(_ || {}), H = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(H || {}), Ee = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Concept = "CONCEPT", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Ee || {}), ye = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(ye || {}), ve = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(ve || {}), Te = /* @__PURE__ */ ((e) => (e.Asc = "ASC", e.Desc = "DESC", e))(Te || {}), Ae = /* @__PURE__ */ ((e) => (e.AllReserved = "ALL_RESERVED", e.Available = "AVAILABLE", e.SoldOut = "SOLD_OUT", e))(Ae || {}), ke = /* @__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))(ke || {}), Oe = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(Oe || {}), De = /* @__PURE__ */ ((e) => (e.AddOn = "ADD_ON", e.DeliveryOption = "DELIVERY_OPTION", e.EntranceTicket = "ENTRANCE_TICKET", e))(De || {}), Ne = /* @__PURE__ */ ((e) => (e.Fixed = "FIXED", e.Percentage = "PERCENTAGE", e))(Ne || {}), Y = /* @__PURE__ */ ((e) => (e.Event = "EVENT", e.Package = "PACKAGE", e))(Y || {});
|
|
4
|
+
const Ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6
5
|
__proto__: null,
|
|
7
6
|
BasketOrderType: _,
|
|
8
|
-
DiscountType:
|
|
9
|
-
EventStatus:
|
|
10
|
-
MetricsType:
|
|
11
|
-
OrderItemType:
|
|
12
|
-
PackageItemType:
|
|
13
|
-
PackageStatus:
|
|
14
|
-
PackageTabType:
|
|
15
|
-
PaymentMethodFeeType:
|
|
16
|
-
ProductStatus:
|
|
17
|
-
ProductType:
|
|
18
|
-
SortOrder:
|
|
7
|
+
DiscountType: Ne,
|
|
8
|
+
EventStatus: ve,
|
|
9
|
+
MetricsType: Y,
|
|
10
|
+
OrderItemType: De,
|
|
11
|
+
PackageItemType: H,
|
|
12
|
+
PackageStatus: Ee,
|
|
13
|
+
PackageTabType: ye,
|
|
14
|
+
PaymentMethodFeeType: Oe,
|
|
15
|
+
ProductStatus: Ae,
|
|
16
|
+
ProductType: ke,
|
|
17
|
+
SortOrder: Te
|
|
19
18
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
20
|
-
var
|
|
21
|
-
return
|
|
22
|
-
for (var n,
|
|
23
|
-
n = arguments[
|
|
19
|
+
var Q = function() {
|
|
20
|
+
return Q = Object.assign || function(t) {
|
|
21
|
+
for (var n, i = 1, r = arguments.length; i < r; i++) {
|
|
22
|
+
n = arguments[i];
|
|
24
23
|
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
25
24
|
}
|
|
26
25
|
return t;
|
|
27
|
-
},
|
|
26
|
+
}, Q.apply(this, arguments);
|
|
28
27
|
};
|
|
29
|
-
function
|
|
28
|
+
function z(e, t) {
|
|
30
29
|
if (!!!e)
|
|
31
30
|
throw new Error(t);
|
|
32
31
|
}
|
|
33
|
-
function
|
|
32
|
+
function Me(e) {
|
|
34
33
|
return typeof e == "object" && e !== null;
|
|
35
34
|
}
|
|
36
|
-
function
|
|
35
|
+
function qe(e, t) {
|
|
37
36
|
if (!!!e)
|
|
38
37
|
throw new Error(
|
|
39
38
|
"Unexpected invariant triggered."
|
|
40
39
|
);
|
|
41
40
|
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
44
|
-
let n = 0,
|
|
45
|
-
for (const
|
|
46
|
-
if (typeof
|
|
41
|
+
const ze = /\r\n|[\n\r]/g;
|
|
42
|
+
function ie(e, t) {
|
|
43
|
+
let n = 0, i = 1;
|
|
44
|
+
for (const r of e.body.matchAll(ze)) {
|
|
45
|
+
if (typeof r.index == "number" || qe(!1), r.index >= t)
|
|
47
46
|
break;
|
|
48
|
-
n =
|
|
47
|
+
n = r.index + r[0].length, i += 1;
|
|
49
48
|
}
|
|
50
49
|
return {
|
|
51
|
-
line:
|
|
50
|
+
line: i,
|
|
52
51
|
column: t + 1 - n
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
54
|
+
function je(e) {
|
|
55
|
+
return be(
|
|
57
56
|
e.source,
|
|
58
|
-
|
|
57
|
+
ie(e.source, e.start)
|
|
59
58
|
);
|
|
60
59
|
}
|
|
61
|
-
function
|
|
62
|
-
const n = e.locationOffset.column - 1,
|
|
63
|
-
`,
|
|
64
|
-
if (
|
|
65
|
-
const m = Math.floor(
|
|
66
|
-
for (let
|
|
67
|
-
I.push(
|
|
68
|
-
return p +
|
|
60
|
+
function be(e, t) {
|
|
61
|
+
const n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, l = t.line === 1 ? n : 0, f = t.column + l, p = `${e.name}:${o}:${f}
|
|
62
|
+
`, g = i.split(/\r\n|[\n\r]/g), d = g[r];
|
|
63
|
+
if (d.length > 120) {
|
|
64
|
+
const m = Math.floor(f / 80), y = f % 80, I = [];
|
|
65
|
+
for (let D = 0; D < d.length; D += 80)
|
|
66
|
+
I.push(d.slice(D, D + 80));
|
|
67
|
+
return p + le([
|
|
69
68
|
[`${o} |`, I[0]],
|
|
70
|
-
...I.slice(1, m + 1).map((
|
|
69
|
+
...I.slice(1, m + 1).map((D) => ["|", D]),
|
|
71
70
|
["|", "^".padStart(y)],
|
|
72
71
|
["|", I[m + 1]]
|
|
73
72
|
]);
|
|
74
73
|
}
|
|
75
|
-
return p +
|
|
74
|
+
return p + le([
|
|
76
75
|
// Lines specified like this: ["prefix", "string"],
|
|
77
|
-
[`${o - 1} |`,
|
|
78
|
-
[`${o} |`,
|
|
79
|
-
["|", "^".padStart(
|
|
80
|
-
[`${o + 1} |`,
|
|
76
|
+
[`${o - 1} |`, g[r - 1]],
|
|
77
|
+
[`${o} |`, d],
|
|
78
|
+
["|", "^".padStart(f)],
|
|
79
|
+
[`${o + 1} |`, g[r + 1]]
|
|
81
80
|
]);
|
|
82
81
|
}
|
|
83
|
-
function
|
|
84
|
-
const t = e.filter(([
|
|
85
|
-
return t.map(([
|
|
82
|
+
function le(e) {
|
|
83
|
+
const t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
84
|
+
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
86
85
|
`);
|
|
87
86
|
}
|
|
88
|
-
function
|
|
87
|
+
function Ge(e) {
|
|
89
88
|
const t = e[0];
|
|
90
89
|
return t == null || "kind" in t || "length" in t ? {
|
|
91
90
|
nodes: t,
|
|
@@ -96,7 +95,7 @@ function nt(e) {
|
|
|
96
95
|
extensions: e[5]
|
|
97
96
|
} : t;
|
|
98
97
|
}
|
|
99
|
-
class
|
|
98
|
+
class ce extends Error {
|
|
100
99
|
/**
|
|
101
100
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
102
101
|
* which correspond to this error.
|
|
@@ -136,19 +135,19 @@ class ue extends Error {
|
|
|
136
135
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
137
136
|
*/
|
|
138
137
|
constructor(t, ...n) {
|
|
139
|
-
var
|
|
140
|
-
const { nodes: o, source:
|
|
141
|
-
super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError =
|
|
138
|
+
var i, r, s;
|
|
139
|
+
const { nodes: o, source: l, positions: f, path: p, originalError: g, extensions: d } = Ge(n);
|
|
140
|
+
super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError = g ?? void 0, this.nodes = pe(
|
|
142
141
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
143
142
|
);
|
|
144
|
-
const m =
|
|
145
|
-
(
|
|
143
|
+
const m = pe(
|
|
144
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((I) => I.loc).filter((I) => I != null)
|
|
146
145
|
);
|
|
147
|
-
this.source =
|
|
148
|
-
const y =
|
|
149
|
-
|
|
150
|
-
) ?
|
|
151
|
-
this.extensions = (s =
|
|
146
|
+
this.source = l ?? (m == null || (r = m[0]) === null || r === void 0 ? void 0 : r.source), this.positions = f ?? m?.map((I) => I.start), this.locations = f && l ? f.map((I) => ie(l, I)) : m?.map((I) => ie(I.source, I.start));
|
|
147
|
+
const y = Me(
|
|
148
|
+
g?.extensions
|
|
149
|
+
) ? g?.extensions : void 0;
|
|
150
|
+
this.extensions = (s = d ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
152
151
|
message: {
|
|
153
152
|
writable: !0,
|
|
154
153
|
enumerable: !0
|
|
@@ -168,11 +167,11 @@ class ue extends Error {
|
|
|
168
167
|
originalError: {
|
|
169
168
|
enumerable: !1
|
|
170
169
|
}
|
|
171
|
-
}),
|
|
172
|
-
value:
|
|
170
|
+
}), g != null && g.stack ? Object.defineProperty(this, "stack", {
|
|
171
|
+
value: g.stack,
|
|
173
172
|
writable: !0,
|
|
174
173
|
configurable: !0
|
|
175
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
174
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, ce) : Object.defineProperty(this, "stack", {
|
|
176
175
|
value: Error().stack,
|
|
177
176
|
writable: !0,
|
|
178
177
|
configurable: !0
|
|
@@ -187,12 +186,12 @@ class ue extends Error {
|
|
|
187
186
|
for (const n of this.nodes)
|
|
188
187
|
n.loc && (t += `
|
|
189
188
|
|
|
190
|
-
` +
|
|
189
|
+
` + je(n.loc));
|
|
191
190
|
else if (this.source && this.locations)
|
|
192
191
|
for (const n of this.locations)
|
|
193
192
|
t += `
|
|
194
193
|
|
|
195
|
-
` +
|
|
194
|
+
` + be(this.source, n);
|
|
196
195
|
return t;
|
|
197
196
|
}
|
|
198
197
|
toJSON() {
|
|
@@ -202,16 +201,16 @@ class ue extends Error {
|
|
|
202
201
|
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;
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
|
-
function
|
|
204
|
+
function pe(e) {
|
|
206
205
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
207
206
|
}
|
|
208
|
-
function
|
|
209
|
-
return new
|
|
207
|
+
function T(e, t, n) {
|
|
208
|
+
return new ce(`Syntax Error: ${n}`, {
|
|
210
209
|
source: e,
|
|
211
210
|
positions: [t]
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
|
-
class
|
|
213
|
+
class He {
|
|
215
214
|
/**
|
|
216
215
|
* The character offset at which this Node begins.
|
|
217
216
|
*/
|
|
@@ -227,8 +226,8 @@ class rt {
|
|
|
227
226
|
/**
|
|
228
227
|
* The Source document the AST represents.
|
|
229
228
|
*/
|
|
230
|
-
constructor(t, n,
|
|
231
|
-
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source =
|
|
229
|
+
constructor(t, n, i) {
|
|
230
|
+
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
|
|
232
231
|
}
|
|
233
232
|
get [Symbol.toStringTag]() {
|
|
234
233
|
return "Location";
|
|
@@ -240,7 +239,7 @@ class rt {
|
|
|
240
239
|
};
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
|
-
class
|
|
242
|
+
class xe {
|
|
244
243
|
/**
|
|
245
244
|
* The kind of Token.
|
|
246
245
|
*/
|
|
@@ -267,8 +266,8 @@ class we {
|
|
|
267
266
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
268
267
|
* the last.
|
|
269
268
|
*/
|
|
270
|
-
constructor(t, n,
|
|
271
|
-
this.kind = t, this.start = n, this.end =
|
|
269
|
+
constructor(t, n, i, r, s, o) {
|
|
270
|
+
this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
272
271
|
}
|
|
273
272
|
get [Symbol.toStringTag]() {
|
|
274
273
|
return "Token";
|
|
@@ -282,7 +281,7 @@ class we {
|
|
|
282
281
|
};
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
|
-
const
|
|
284
|
+
const Pe = {
|
|
286
285
|
Name: [],
|
|
287
286
|
Document: ["definitions"],
|
|
288
287
|
OperationDefinition: [
|
|
@@ -369,74 +368,74 @@ const $e = {
|
|
|
369
368
|
ArgumentCoordinate: ["name", "fieldName", "argumentName"],
|
|
370
369
|
DirectiveCoordinate: ["name"],
|
|
371
370
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
372
|
-
},
|
|
373
|
-
function
|
|
371
|
+
}, Ye = new Set(Object.keys(Pe));
|
|
372
|
+
function he(e) {
|
|
374
373
|
const t = e?.kind;
|
|
375
|
-
return typeof t == "string" &&
|
|
374
|
+
return typeof t == "string" && Ye.has(t);
|
|
376
375
|
}
|
|
377
376
|
var w;
|
|
378
377
|
(function(e) {
|
|
379
378
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
380
379
|
})(w || (w = {}));
|
|
381
|
-
var
|
|
380
|
+
var re;
|
|
382
381
|
(function(e) {
|
|
383
382
|
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";
|
|
384
|
-
})(
|
|
385
|
-
var
|
|
383
|
+
})(re || (re = {}));
|
|
384
|
+
var u;
|
|
386
385
|
(function(e) {
|
|
387
386
|
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";
|
|
388
|
-
})(
|
|
389
|
-
function
|
|
387
|
+
})(u || (u = {}));
|
|
388
|
+
function se(e) {
|
|
390
389
|
return e === 9 || e === 32;
|
|
391
390
|
}
|
|
392
|
-
function
|
|
391
|
+
function U(e) {
|
|
393
392
|
return e >= 48 && e <= 57;
|
|
394
393
|
}
|
|
395
|
-
function
|
|
394
|
+
function Se(e) {
|
|
396
395
|
return e >= 97 && e <= 122 || // A-Z
|
|
397
396
|
e >= 65 && e <= 90;
|
|
398
397
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
398
|
+
function Ce(e) {
|
|
399
|
+
return Se(e) || e === 95;
|
|
401
400
|
}
|
|
402
|
-
function
|
|
403
|
-
return
|
|
401
|
+
function Qe(e) {
|
|
402
|
+
return Se(e) || U(e) || e === 95;
|
|
404
403
|
}
|
|
405
|
-
function
|
|
404
|
+
function Je(e) {
|
|
406
405
|
var t;
|
|
407
|
-
let n = Number.MAX_SAFE_INTEGER,
|
|
406
|
+
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
408
407
|
for (let o = 0; o < e.length; ++o) {
|
|
409
408
|
var s;
|
|
410
|
-
const
|
|
411
|
-
|
|
409
|
+
const l = e[o], f = Xe(l);
|
|
410
|
+
f !== l.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && f < n && (n = f));
|
|
412
411
|
}
|
|
413
|
-
return e.map((o,
|
|
414
|
-
(t =
|
|
415
|
-
|
|
412
|
+
return e.map((o, l) => l === 0 ? o : o.slice(n)).slice(
|
|
413
|
+
(t = i) !== null && t !== void 0 ? t : 0,
|
|
414
|
+
r + 1
|
|
416
415
|
);
|
|
417
416
|
}
|
|
418
|
-
function
|
|
417
|
+
function Xe(e) {
|
|
419
418
|
let t = 0;
|
|
420
|
-
for (; t < e.length &&
|
|
419
|
+
for (; t < e.length && se(e.charCodeAt(t)); )
|
|
421
420
|
++t;
|
|
422
421
|
return t;
|
|
423
422
|
}
|
|
424
|
-
function
|
|
425
|
-
const n = e.replace(/"""/g, '\\"""'),
|
|
423
|
+
function We(e, t) {
|
|
424
|
+
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('\\"""'), l = e.endsWith('"') && !o, f = e.endsWith("\\"), p = l || f, g = (
|
|
426
425
|
// add leading and trailing new lines only if it improves readability
|
|
427
|
-
!
|
|
426
|
+
!r || e.length > 70 || p || s || o
|
|
428
427
|
);
|
|
429
|
-
let
|
|
430
|
-
const m =
|
|
431
|
-
return (
|
|
432
|
-
`),
|
|
433
|
-
`), '"""' +
|
|
428
|
+
let d = "";
|
|
429
|
+
const m = r && se(e.charCodeAt(0));
|
|
430
|
+
return (g && !m || s) && (d += `
|
|
431
|
+
`), d += n, (g || p) && (d += `
|
|
432
|
+
`), '"""' + d + '"""';
|
|
434
433
|
}
|
|
435
434
|
var a;
|
|
436
435
|
(function(e) {
|
|
437
436
|
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";
|
|
438
437
|
})(a || (a = {}));
|
|
439
|
-
class
|
|
438
|
+
class Ze {
|
|
440
439
|
/**
|
|
441
440
|
* The previously focused non-ignored token.
|
|
442
441
|
*/
|
|
@@ -450,7 +449,7 @@ class dt {
|
|
|
450
449
|
* The character offset at which the current line begins.
|
|
451
450
|
*/
|
|
452
451
|
constructor(t) {
|
|
453
|
-
const n = new
|
|
452
|
+
const n = new xe(a.SOF, 0, 0, 0, 0);
|
|
454
453
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
455
454
|
}
|
|
456
455
|
get [Symbol.toStringTag]() {
|
|
@@ -473,47 +472,47 @@ class dt {
|
|
|
473
472
|
if (t.next)
|
|
474
473
|
t = t.next;
|
|
475
474
|
else {
|
|
476
|
-
const n =
|
|
475
|
+
const n = et(this, t.end);
|
|
477
476
|
t.next = n, n.prev = t, t = n;
|
|
478
477
|
}
|
|
479
478
|
while (t.kind === a.COMMENT);
|
|
480
479
|
return t;
|
|
481
480
|
}
|
|
482
481
|
}
|
|
483
|
-
function
|
|
482
|
+
function Ke(e) {
|
|
484
483
|
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;
|
|
485
484
|
}
|
|
486
|
-
function
|
|
485
|
+
function F(e) {
|
|
487
486
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
488
487
|
}
|
|
489
|
-
function
|
|
490
|
-
return
|
|
488
|
+
function X(e, t) {
|
|
489
|
+
return _e(e.charCodeAt(t)) && Le(e.charCodeAt(t + 1));
|
|
491
490
|
}
|
|
492
|
-
function
|
|
491
|
+
function _e(e) {
|
|
493
492
|
return e >= 55296 && e <= 56319;
|
|
494
493
|
}
|
|
495
|
-
function
|
|
494
|
+
function Le(e) {
|
|
496
495
|
return e >= 56320 && e <= 57343;
|
|
497
496
|
}
|
|
498
|
-
function
|
|
497
|
+
function R(e, t) {
|
|
499
498
|
const n = e.source.body.codePointAt(t);
|
|
500
499
|
if (n === void 0)
|
|
501
500
|
return a.EOF;
|
|
502
501
|
if (n >= 32 && n <= 126) {
|
|
503
|
-
const
|
|
504
|
-
return
|
|
502
|
+
const i = String.fromCodePoint(n);
|
|
503
|
+
return i === '"' ? `'"'` : `"${i}"`;
|
|
505
504
|
}
|
|
506
505
|
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
507
506
|
}
|
|
508
|
-
function v(e, t, n,
|
|
507
|
+
function v(e, t, n, i, r) {
|
|
509
508
|
const s = e.line, o = 1 + n - e.lineStart;
|
|
510
|
-
return new
|
|
509
|
+
return new xe(t, n, i, s, o, r);
|
|
511
510
|
}
|
|
512
|
-
function
|
|
513
|
-
const n = e.source.body,
|
|
514
|
-
let
|
|
515
|
-
for (;
|
|
516
|
-
const s = n.charCodeAt(
|
|
511
|
+
function et(e, t) {
|
|
512
|
+
const n = e.source.body, i = n.length;
|
|
513
|
+
let r = t;
|
|
514
|
+
for (; r < i; ) {
|
|
515
|
+
const s = n.charCodeAt(r);
|
|
517
516
|
switch (s) {
|
|
518
517
|
// Ignored ::
|
|
519
518
|
// - UnicodeBOM
|
|
@@ -536,21 +535,21 @@ function lt(e, t) {
|
|
|
536
535
|
case 32:
|
|
537
536
|
// <space>
|
|
538
537
|
case 44:
|
|
539
|
-
++
|
|
538
|
+
++r;
|
|
540
539
|
continue;
|
|
541
540
|
// LineTerminator ::
|
|
542
541
|
// - "New Line (U+000A)"
|
|
543
542
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
544
543
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
545
544
|
case 10:
|
|
546
|
-
++
|
|
545
|
+
++r, ++e.line, e.lineStart = r;
|
|
547
546
|
continue;
|
|
548
547
|
case 13:
|
|
549
|
-
n.charCodeAt(
|
|
548
|
+
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
550
549
|
continue;
|
|
551
550
|
// Comment
|
|
552
551
|
case 35:
|
|
553
|
-
return
|
|
552
|
+
return tt(e, r);
|
|
554
553
|
// Token ::
|
|
555
554
|
// - Punctuator
|
|
556
555
|
// - Name
|
|
@@ -560,62 +559,62 @@ function lt(e, t) {
|
|
|
560
559
|
//
|
|
561
560
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
562
561
|
case 33:
|
|
563
|
-
return v(e, a.BANG,
|
|
562
|
+
return v(e, a.BANG, r, r + 1);
|
|
564
563
|
case 36:
|
|
565
|
-
return v(e, a.DOLLAR,
|
|
564
|
+
return v(e, a.DOLLAR, r, r + 1);
|
|
566
565
|
case 38:
|
|
567
|
-
return v(e, a.AMP,
|
|
566
|
+
return v(e, a.AMP, r, r + 1);
|
|
568
567
|
case 40:
|
|
569
|
-
return v(e, a.PAREN_L,
|
|
568
|
+
return v(e, a.PAREN_L, r, r + 1);
|
|
570
569
|
case 41:
|
|
571
|
-
return v(e, a.PAREN_R,
|
|
570
|
+
return v(e, a.PAREN_R, r, r + 1);
|
|
572
571
|
case 46:
|
|
573
|
-
if (n.charCodeAt(
|
|
574
|
-
return v(e, a.SPREAD,
|
|
572
|
+
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
573
|
+
return v(e, a.SPREAD, r, r + 3);
|
|
575
574
|
break;
|
|
576
575
|
case 58:
|
|
577
|
-
return v(e, a.COLON,
|
|
576
|
+
return v(e, a.COLON, r, r + 1);
|
|
578
577
|
case 61:
|
|
579
|
-
return v(e, a.EQUALS,
|
|
578
|
+
return v(e, a.EQUALS, r, r + 1);
|
|
580
579
|
case 64:
|
|
581
|
-
return v(e, a.AT,
|
|
580
|
+
return v(e, a.AT, r, r + 1);
|
|
582
581
|
case 91:
|
|
583
|
-
return v(e, a.BRACKET_L,
|
|
582
|
+
return v(e, a.BRACKET_L, r, r + 1);
|
|
584
583
|
case 93:
|
|
585
|
-
return v(e, a.BRACKET_R,
|
|
584
|
+
return v(e, a.BRACKET_R, r, r + 1);
|
|
586
585
|
case 123:
|
|
587
|
-
return v(e, a.BRACE_L,
|
|
586
|
+
return v(e, a.BRACE_L, r, r + 1);
|
|
588
587
|
case 124:
|
|
589
|
-
return v(e, a.PIPE,
|
|
588
|
+
return v(e, a.PIPE, r, r + 1);
|
|
590
589
|
case 125:
|
|
591
|
-
return v(e, a.BRACE_R,
|
|
590
|
+
return v(e, a.BRACE_R, r, r + 1);
|
|
592
591
|
// StringValue
|
|
593
592
|
case 34:
|
|
594
|
-
return n.charCodeAt(
|
|
593
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? ot(e, r) : it(e, r);
|
|
595
594
|
}
|
|
596
|
-
if (
|
|
597
|
-
return
|
|
598
|
-
if (
|
|
599
|
-
return
|
|
600
|
-
throw
|
|
595
|
+
if (U(s) || s === 45)
|
|
596
|
+
return nt(e, r, s);
|
|
597
|
+
if (Ce(s))
|
|
598
|
+
return ct(e, r);
|
|
599
|
+
throw T(
|
|
601
600
|
e.source,
|
|
602
|
-
|
|
603
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
601
|
+
r,
|
|
602
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : F(s) || X(n, r) ? `Unexpected character: ${R(e, r)}.` : `Invalid character: ${R(e, r)}.`
|
|
604
603
|
);
|
|
605
604
|
}
|
|
606
|
-
return v(e, a.EOF,
|
|
605
|
+
return v(e, a.EOF, i, i);
|
|
607
606
|
}
|
|
608
|
-
function
|
|
609
|
-
const n = e.source.body,
|
|
610
|
-
let
|
|
611
|
-
for (;
|
|
612
|
-
const s = n.charCodeAt(
|
|
607
|
+
function tt(e, t) {
|
|
608
|
+
const n = e.source.body, i = n.length;
|
|
609
|
+
let r = t + 1;
|
|
610
|
+
for (; r < i; ) {
|
|
611
|
+
const s = n.charCodeAt(r);
|
|
613
612
|
if (s === 10 || s === 13)
|
|
614
613
|
break;
|
|
615
|
-
if (
|
|
616
|
-
++
|
|
617
|
-
else if (
|
|
618
|
-
|
|
614
|
+
if (F(s))
|
|
615
|
+
++r;
|
|
616
|
+
else if (X(n, r))
|
|
617
|
+
r += 2;
|
|
619
618
|
else
|
|
620
619
|
break;
|
|
621
620
|
}
|
|
@@ -623,142 +622,142 @@ function pt(e, t) {
|
|
|
623
622
|
e,
|
|
624
623
|
a.COMMENT,
|
|
625
624
|
t,
|
|
626
|
-
|
|
627
|
-
n.slice(t + 1,
|
|
625
|
+
r,
|
|
626
|
+
n.slice(t + 1, r)
|
|
628
627
|
);
|
|
629
628
|
}
|
|
630
|
-
function
|
|
631
|
-
const
|
|
632
|
-
let
|
|
633
|
-
if (s === 45 && (s =
|
|
634
|
-
if (s =
|
|
635
|
-
throw
|
|
629
|
+
function nt(e, t, n) {
|
|
630
|
+
const i = e.source.body;
|
|
631
|
+
let r = t, s = n, o = !1;
|
|
632
|
+
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
633
|
+
if (s = i.charCodeAt(++r), U(s))
|
|
634
|
+
throw T(
|
|
636
635
|
e.source,
|
|
637
|
-
|
|
638
|
-
`Invalid number, unexpected digit after 0: ${
|
|
636
|
+
r,
|
|
637
|
+
`Invalid number, unexpected digit after 0: ${R(
|
|
639
638
|
e,
|
|
640
|
-
|
|
639
|
+
r
|
|
641
640
|
)}.`
|
|
642
641
|
);
|
|
643
642
|
} else
|
|
644
|
-
|
|
645
|
-
if (s === 46 && (o = !0, s =
|
|
646
|
-
throw
|
|
643
|
+
r = ee(e, r, s), s = i.charCodeAt(r);
|
|
644
|
+
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 || Ce(s))
|
|
645
|
+
throw T(
|
|
647
646
|
e.source,
|
|
648
|
-
|
|
649
|
-
`Invalid number, expected digit but got: ${
|
|
647
|
+
r,
|
|
648
|
+
`Invalid number, expected digit but got: ${R(
|
|
650
649
|
e,
|
|
651
|
-
|
|
650
|
+
r
|
|
652
651
|
)}.`
|
|
653
652
|
);
|
|
654
653
|
return v(
|
|
655
654
|
e,
|
|
656
655
|
o ? a.FLOAT : a.INT,
|
|
657
656
|
t,
|
|
658
|
-
|
|
659
|
-
|
|
657
|
+
r,
|
|
658
|
+
i.slice(t, r)
|
|
660
659
|
);
|
|
661
660
|
}
|
|
662
|
-
function
|
|
663
|
-
if (!
|
|
664
|
-
throw
|
|
661
|
+
function ee(e, t, n) {
|
|
662
|
+
if (!U(n))
|
|
663
|
+
throw T(
|
|
665
664
|
e.source,
|
|
666
665
|
t,
|
|
667
|
-
`Invalid number, expected digit but got: ${
|
|
666
|
+
`Invalid number, expected digit but got: ${R(
|
|
668
667
|
e,
|
|
669
668
|
t
|
|
670
669
|
)}.`
|
|
671
670
|
);
|
|
672
|
-
const
|
|
673
|
-
let
|
|
674
|
-
for (;
|
|
675
|
-
++
|
|
676
|
-
return
|
|
677
|
-
}
|
|
678
|
-
function
|
|
679
|
-
const n = e.source.body,
|
|
680
|
-
let
|
|
681
|
-
for (;
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
return o += n.slice(s,
|
|
685
|
-
if (
|
|
686
|
-
o += n.slice(s,
|
|
687
|
-
const
|
|
688
|
-
o +=
|
|
671
|
+
const i = e.source.body;
|
|
672
|
+
let r = t + 1;
|
|
673
|
+
for (; U(i.charCodeAt(r)); )
|
|
674
|
+
++r;
|
|
675
|
+
return r;
|
|
676
|
+
}
|
|
677
|
+
function it(e, t) {
|
|
678
|
+
const n = e.source.body, i = n.length;
|
|
679
|
+
let r = t + 1, s = r, o = "";
|
|
680
|
+
for (; r < i; ) {
|
|
681
|
+
const l = n.charCodeAt(r);
|
|
682
|
+
if (l === 34)
|
|
683
|
+
return o += n.slice(s, r), v(e, a.STRING, t, r + 1, o);
|
|
684
|
+
if (l === 92) {
|
|
685
|
+
o += n.slice(s, r);
|
|
686
|
+
const f = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? rt(e, r) : st(e, r) : at(e, r);
|
|
687
|
+
o += f.value, r += f.size, s = r;
|
|
689
688
|
continue;
|
|
690
689
|
}
|
|
691
|
-
if (
|
|
690
|
+
if (l === 10 || l === 13)
|
|
692
691
|
break;
|
|
693
|
-
if (
|
|
694
|
-
++
|
|
695
|
-
else if (
|
|
696
|
-
|
|
692
|
+
if (F(l))
|
|
693
|
+
++r;
|
|
694
|
+
else if (X(n, r))
|
|
695
|
+
r += 2;
|
|
697
696
|
else
|
|
698
|
-
throw
|
|
697
|
+
throw T(
|
|
699
698
|
e.source,
|
|
700
|
-
|
|
701
|
-
`Invalid character within String: ${
|
|
699
|
+
r,
|
|
700
|
+
`Invalid character within String: ${R(
|
|
702
701
|
e,
|
|
703
|
-
|
|
702
|
+
r
|
|
704
703
|
)}.`
|
|
705
704
|
);
|
|
706
705
|
}
|
|
707
|
-
throw
|
|
706
|
+
throw T(e.source, r, "Unterminated string.");
|
|
708
707
|
}
|
|
709
|
-
function
|
|
708
|
+
function rt(e, t) {
|
|
710
709
|
const n = e.source.body;
|
|
711
|
-
let
|
|
712
|
-
for (;
|
|
713
|
-
const s = n.charCodeAt(t +
|
|
710
|
+
let i = 0, r = 3;
|
|
711
|
+
for (; r < 12; ) {
|
|
712
|
+
const s = n.charCodeAt(t + r++);
|
|
714
713
|
if (s === 125) {
|
|
715
|
-
if (
|
|
714
|
+
if (r < 5 || !F(i))
|
|
716
715
|
break;
|
|
717
716
|
return {
|
|
718
|
-
value: String.fromCodePoint(
|
|
719
|
-
size:
|
|
717
|
+
value: String.fromCodePoint(i),
|
|
718
|
+
size: r
|
|
720
719
|
};
|
|
721
720
|
}
|
|
722
|
-
if (
|
|
721
|
+
if (i = i << 4 | V(s), i < 0)
|
|
723
722
|
break;
|
|
724
723
|
}
|
|
725
|
-
throw
|
|
724
|
+
throw T(
|
|
726
725
|
e.source,
|
|
727
726
|
t,
|
|
728
727
|
`Invalid Unicode escape sequence: "${n.slice(
|
|
729
728
|
t,
|
|
730
|
-
t +
|
|
729
|
+
t + r
|
|
731
730
|
)}".`
|
|
732
731
|
);
|
|
733
732
|
}
|
|
734
|
-
function
|
|
735
|
-
const n = e.source.body,
|
|
736
|
-
if (
|
|
733
|
+
function st(e, t) {
|
|
734
|
+
const n = e.source.body, i = fe(n, t + 2);
|
|
735
|
+
if (F(i))
|
|
737
736
|
return {
|
|
738
|
-
value: String.fromCodePoint(
|
|
737
|
+
value: String.fromCodePoint(i),
|
|
739
738
|
size: 6
|
|
740
739
|
};
|
|
741
|
-
if (
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
740
|
+
if (_e(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
741
|
+
const r = fe(n, t + 8);
|
|
742
|
+
if (Le(r))
|
|
744
743
|
return {
|
|
745
|
-
value: String.fromCodePoint(
|
|
744
|
+
value: String.fromCodePoint(i, r),
|
|
746
745
|
size: 12
|
|
747
746
|
};
|
|
748
747
|
}
|
|
749
|
-
throw
|
|
748
|
+
throw T(
|
|
750
749
|
e.source,
|
|
751
750
|
t,
|
|
752
751
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
753
752
|
);
|
|
754
753
|
}
|
|
755
|
-
function
|
|
756
|
-
return
|
|
754
|
+
function fe(e, t) {
|
|
755
|
+
return V(e.charCodeAt(t)) << 12 | V(e.charCodeAt(t + 1)) << 8 | V(e.charCodeAt(t + 2)) << 4 | V(e.charCodeAt(t + 3));
|
|
757
756
|
}
|
|
758
|
-
function
|
|
757
|
+
function V(e) {
|
|
759
758
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
760
759
|
}
|
|
761
|
-
function
|
|
760
|
+
function at(e, t) {
|
|
762
761
|
const n = e.source.body;
|
|
763
762
|
switch (n.charCodeAt(t + 1)) {
|
|
764
763
|
case 34:
|
|
@@ -803,7 +802,7 @@ function It(e, t) {
|
|
|
803
802
|
size: 2
|
|
804
803
|
};
|
|
805
804
|
}
|
|
806
|
-
throw
|
|
805
|
+
throw T(
|
|
807
806
|
e.source,
|
|
808
807
|
t,
|
|
809
808
|
`Invalid character escape sequence: "${n.slice(
|
|
@@ -812,56 +811,56 @@ function It(e, t) {
|
|
|
812
811
|
)}".`
|
|
813
812
|
);
|
|
814
813
|
}
|
|
815
|
-
function
|
|
816
|
-
const n = e.source.body,
|
|
817
|
-
let
|
|
818
|
-
const
|
|
819
|
-
for (; s <
|
|
814
|
+
function ot(e, t) {
|
|
815
|
+
const n = e.source.body, i = n.length;
|
|
816
|
+
let r = e.lineStart, s = t + 3, o = s, l = "";
|
|
817
|
+
const f = [];
|
|
818
|
+
for (; s < i; ) {
|
|
820
819
|
const p = n.charCodeAt(s);
|
|
821
820
|
if (p === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
822
|
-
|
|
823
|
-
const
|
|
821
|
+
l += n.slice(o, s), f.push(l);
|
|
822
|
+
const g = v(
|
|
824
823
|
e,
|
|
825
824
|
a.BLOCK_STRING,
|
|
826
825
|
t,
|
|
827
826
|
s + 3,
|
|
828
827
|
// Return a string of the lines joined with U+000A.
|
|
829
|
-
|
|
828
|
+
Je(f).join(`
|
|
830
829
|
`)
|
|
831
830
|
);
|
|
832
|
-
return e.line +=
|
|
831
|
+
return e.line += f.length - 1, e.lineStart = r, g;
|
|
833
832
|
}
|
|
834
833
|
if (p === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
835
|
-
|
|
834
|
+
l += n.slice(o, s), o = s + 1, s += 4;
|
|
836
835
|
continue;
|
|
837
836
|
}
|
|
838
837
|
if (p === 10 || p === 13) {
|
|
839
|
-
|
|
838
|
+
l += n.slice(o, s), f.push(l), p === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, l = "", o = s, r = s;
|
|
840
839
|
continue;
|
|
841
840
|
}
|
|
842
|
-
if (
|
|
841
|
+
if (F(p))
|
|
843
842
|
++s;
|
|
844
|
-
else if (
|
|
843
|
+
else if (X(n, s))
|
|
845
844
|
s += 2;
|
|
846
845
|
else
|
|
847
|
-
throw
|
|
846
|
+
throw T(
|
|
848
847
|
e.source,
|
|
849
848
|
s,
|
|
850
|
-
`Invalid character within String: ${
|
|
849
|
+
`Invalid character within String: ${R(
|
|
851
850
|
e,
|
|
852
851
|
s
|
|
853
852
|
)}.`
|
|
854
853
|
);
|
|
855
854
|
}
|
|
856
|
-
throw
|
|
855
|
+
throw T(e.source, s, "Unterminated string.");
|
|
857
856
|
}
|
|
858
|
-
function
|
|
859
|
-
const n = e.source.body,
|
|
860
|
-
let
|
|
861
|
-
for (;
|
|
862
|
-
const s = n.charCodeAt(
|
|
863
|
-
if (
|
|
864
|
-
++
|
|
857
|
+
function ct(e, t) {
|
|
858
|
+
const n = e.source.body, i = n.length;
|
|
859
|
+
let r = t + 1;
|
|
860
|
+
for (; r < i; ) {
|
|
861
|
+
const s = n.charCodeAt(r);
|
|
862
|
+
if (Qe(s))
|
|
863
|
+
++r;
|
|
865
864
|
else
|
|
866
865
|
break;
|
|
867
866
|
}
|
|
@@ -869,60 +868,60 @@ function yt(e, t) {
|
|
|
869
868
|
e,
|
|
870
869
|
a.NAME,
|
|
871
870
|
t,
|
|
872
|
-
|
|
873
|
-
n.slice(t,
|
|
871
|
+
r,
|
|
872
|
+
n.slice(t, r)
|
|
874
873
|
);
|
|
875
874
|
}
|
|
876
|
-
const
|
|
877
|
-
function
|
|
878
|
-
return
|
|
875
|
+
const dt = 10, Re = 2;
|
|
876
|
+
function de(e) {
|
|
877
|
+
return W(e, []);
|
|
879
878
|
}
|
|
880
|
-
function
|
|
879
|
+
function W(e, t) {
|
|
881
880
|
switch (typeof e) {
|
|
882
881
|
case "string":
|
|
883
882
|
return JSON.stringify(e);
|
|
884
883
|
case "function":
|
|
885
884
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
886
885
|
case "object":
|
|
887
|
-
return
|
|
886
|
+
return ut(e, t);
|
|
888
887
|
default:
|
|
889
888
|
return String(e);
|
|
890
889
|
}
|
|
891
890
|
}
|
|
892
|
-
function
|
|
891
|
+
function ut(e, t) {
|
|
893
892
|
if (e === null)
|
|
894
893
|
return "null";
|
|
895
894
|
if (t.includes(e))
|
|
896
895
|
return "[Circular]";
|
|
897
896
|
const n = [...t, e];
|
|
898
|
-
if (
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
return typeof
|
|
897
|
+
if (lt(e)) {
|
|
898
|
+
const i = e.toJSON();
|
|
899
|
+
if (i !== e)
|
|
900
|
+
return typeof i == "string" ? i : W(i, n);
|
|
902
901
|
} else if (Array.isArray(e))
|
|
903
|
-
return
|
|
904
|
-
return
|
|
902
|
+
return ht(e, n);
|
|
903
|
+
return pt(e, n);
|
|
905
904
|
}
|
|
906
|
-
function
|
|
905
|
+
function lt(e) {
|
|
907
906
|
return typeof e.toJSON == "function";
|
|
908
907
|
}
|
|
909
|
-
function
|
|
908
|
+
function pt(e, t) {
|
|
910
909
|
const n = Object.entries(e);
|
|
911
|
-
return n.length === 0 ? "{}" : t.length >
|
|
912
|
-
([
|
|
910
|
+
return n.length === 0 ? "{}" : t.length > Re ? "[" + ft(e) + "]" : "{ " + n.map(
|
|
911
|
+
([r, s]) => r + ": " + W(s, t)
|
|
913
912
|
).join(", ") + " }";
|
|
914
913
|
}
|
|
915
|
-
function
|
|
914
|
+
function ht(e, t) {
|
|
916
915
|
if (e.length === 0)
|
|
917
916
|
return "[]";
|
|
918
|
-
if (t.length >
|
|
917
|
+
if (t.length > Re)
|
|
919
918
|
return "[Array]";
|
|
920
|
-
const n = Math.min(
|
|
919
|
+
const n = Math.min(dt, e.length), i = e.length - n, r = [];
|
|
921
920
|
for (let s = 0; s < n; ++s)
|
|
922
|
-
|
|
923
|
-
return
|
|
921
|
+
r.push(W(e[s], t));
|
|
922
|
+
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
924
923
|
}
|
|
925
|
-
function
|
|
924
|
+
function ft(e) {
|
|
926
925
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
927
926
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
928
927
|
const n = e.constructor.name;
|
|
@@ -931,24 +930,24 @@ function Dt(e) {
|
|
|
931
930
|
}
|
|
932
931
|
return t;
|
|
933
932
|
}
|
|
934
|
-
const
|
|
935
|
-
process.env.NODE_ENV === "production",
|
|
933
|
+
const mt = globalThis.process && // eslint-disable-next-line no-undef
|
|
934
|
+
process.env.NODE_ENV === "production", gt = (
|
|
936
935
|
/* c8 ignore next 6 */
|
|
937
936
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
938
|
-
|
|
937
|
+
mt ? function(t, n) {
|
|
939
938
|
return t instanceof n;
|
|
940
939
|
} : function(t, n) {
|
|
941
940
|
if (t instanceof n)
|
|
942
941
|
return !0;
|
|
943
942
|
if (typeof t == "object" && t !== null) {
|
|
944
|
-
var
|
|
945
|
-
const
|
|
943
|
+
var i;
|
|
944
|
+
const r = n.prototype[Symbol.toStringTag], s = (
|
|
946
945
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
947
|
-
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (
|
|
946
|
+
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
|
|
948
947
|
);
|
|
949
|
-
if (
|
|
950
|
-
const o =
|
|
951
|
-
throw new Error(`Cannot use ${
|
|
948
|
+
if (r === s) {
|
|
949
|
+
const o = de(t);
|
|
950
|
+
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
952
951
|
|
|
953
952
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
954
953
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -965,15 +964,15 @@ spurious results.`);
|
|
|
965
964
|
return !1;
|
|
966
965
|
}
|
|
967
966
|
);
|
|
968
|
-
class
|
|
969
|
-
constructor(t, n = "GraphQL request",
|
|
967
|
+
class we {
|
|
968
|
+
constructor(t, n = "GraphQL request", i = {
|
|
970
969
|
line: 1,
|
|
971
970
|
column: 1
|
|
972
971
|
}) {
|
|
973
|
-
typeof t == "string" ||
|
|
972
|
+
typeof t == "string" || z(!1, `Body must be a string. Received: ${de(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || z(
|
|
974
973
|
!1,
|
|
975
974
|
"line in locationOffset is 1-indexed and must be positive."
|
|
976
|
-
), this.locationOffset.column > 0 ||
|
|
975
|
+
), this.locationOffset.column > 0 || z(
|
|
977
976
|
!1,
|
|
978
977
|
"column in locationOffset is 1-indexed and must be positive."
|
|
979
978
|
);
|
|
@@ -982,26 +981,26 @@ class qe {
|
|
|
982
981
|
return "Source";
|
|
983
982
|
}
|
|
984
983
|
}
|
|
985
|
-
function
|
|
986
|
-
return
|
|
984
|
+
function It(e) {
|
|
985
|
+
return gt(e, we);
|
|
987
986
|
}
|
|
988
|
-
function
|
|
989
|
-
const n = new
|
|
990
|
-
return Object.defineProperty(
|
|
987
|
+
function Et(e, t) {
|
|
988
|
+
const n = new yt(e, t), i = n.parseDocument();
|
|
989
|
+
return Object.defineProperty(i, "tokenCount", {
|
|
991
990
|
enumerable: !1,
|
|
992
991
|
value: n.tokenCount
|
|
993
|
-
}),
|
|
992
|
+
}), i;
|
|
994
993
|
}
|
|
995
|
-
class
|
|
994
|
+
class yt {
|
|
996
995
|
constructor(t, n = {}) {
|
|
997
|
-
const { lexer:
|
|
998
|
-
if (
|
|
999
|
-
this._lexer =
|
|
996
|
+
const { lexer: i, ...r } = n;
|
|
997
|
+
if (i)
|
|
998
|
+
this._lexer = i;
|
|
1000
999
|
else {
|
|
1001
|
-
const s =
|
|
1002
|
-
this._lexer = new
|
|
1000
|
+
const s = It(t) ? t : new we(t);
|
|
1001
|
+
this._lexer = new Ze(s);
|
|
1003
1002
|
}
|
|
1004
|
-
this._options =
|
|
1003
|
+
this._options = r, this._tokenCounter = 0;
|
|
1005
1004
|
}
|
|
1006
1005
|
get tokenCount() {
|
|
1007
1006
|
return this._tokenCounter;
|
|
@@ -1012,7 +1011,7 @@ class St {
|
|
|
1012
1011
|
parseName() {
|
|
1013
1012
|
const t = this.expectToken(a.NAME);
|
|
1014
1013
|
return this.node(t, {
|
|
1015
|
-
kind:
|
|
1014
|
+
kind: u.NAME,
|
|
1016
1015
|
value: t.value
|
|
1017
1016
|
});
|
|
1018
1017
|
}
|
|
@@ -1022,7 +1021,7 @@ class St {
|
|
|
1022
1021
|
*/
|
|
1023
1022
|
parseDocument() {
|
|
1024
1023
|
return this.node(this._lexer.token, {
|
|
1025
|
-
kind:
|
|
1024
|
+
kind: u.DOCUMENT,
|
|
1026
1025
|
definitions: this.many(
|
|
1027
1026
|
a.SOF,
|
|
1028
1027
|
this.parseDefinition,
|
|
@@ -1058,7 +1057,7 @@ class St {
|
|
|
1058
1057
|
return this.parseOperationDefinition();
|
|
1059
1058
|
const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1060
1059
|
if (t && n.kind === a.BRACE_L)
|
|
1061
|
-
throw
|
|
1060
|
+
throw T(
|
|
1062
1061
|
this._lexer.source,
|
|
1063
1062
|
this._lexer.token.start,
|
|
1064
1063
|
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
@@ -1091,7 +1090,7 @@ class St {
|
|
|
1091
1090
|
return this.parseFragmentDefinition();
|
|
1092
1091
|
}
|
|
1093
1092
|
if (t)
|
|
1094
|
-
throw
|
|
1093
|
+
throw T(
|
|
1095
1094
|
this._lexer.source,
|
|
1096
1095
|
this._lexer.token.start,
|
|
1097
1096
|
"Unexpected description, only GraphQL definitions support descriptions."
|
|
@@ -1111,7 +1110,7 @@ class St {
|
|
|
1111
1110
|
const t = this._lexer.token;
|
|
1112
1111
|
if (this.peek(a.BRACE_L))
|
|
1113
1112
|
return this.node(t, {
|
|
1114
|
-
kind:
|
|
1113
|
+
kind: u.OPERATION_DEFINITION,
|
|
1115
1114
|
operation: w.QUERY,
|
|
1116
1115
|
description: void 0,
|
|
1117
1116
|
name: void 0,
|
|
@@ -1119,13 +1118,13 @@ class St {
|
|
|
1119
1118
|
directives: [],
|
|
1120
1119
|
selectionSet: this.parseSelectionSet()
|
|
1121
1120
|
});
|
|
1122
|
-
const n = this.parseDescription(),
|
|
1123
|
-
let
|
|
1124
|
-
return this.peek(a.NAME) && (
|
|
1125
|
-
kind:
|
|
1126
|
-
operation:
|
|
1121
|
+
const n = this.parseDescription(), i = this.parseOperationType();
|
|
1122
|
+
let r;
|
|
1123
|
+
return this.peek(a.NAME) && (r = this.parseName()), this.node(t, {
|
|
1124
|
+
kind: u.OPERATION_DEFINITION,
|
|
1125
|
+
operation: i,
|
|
1127
1126
|
description: n,
|
|
1128
|
-
name:
|
|
1127
|
+
name: r,
|
|
1129
1128
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1130
1129
|
directives: this.parseDirectives(!1),
|
|
1131
1130
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1161,7 +1160,7 @@ class St {
|
|
|
1161
1160
|
*/
|
|
1162
1161
|
parseVariableDefinition() {
|
|
1163
1162
|
return this.node(this._lexer.token, {
|
|
1164
|
-
kind:
|
|
1163
|
+
kind: u.VARIABLE_DEFINITION,
|
|
1165
1164
|
description: this.parseDescription(),
|
|
1166
1165
|
variable: this.parseVariable(),
|
|
1167
1166
|
type: (this.expectToken(a.COLON), this.parseTypeReference()),
|
|
@@ -1175,7 +1174,7 @@ class St {
|
|
|
1175
1174
|
parseVariable() {
|
|
1176
1175
|
const t = this._lexer.token;
|
|
1177
1176
|
return this.expectToken(a.DOLLAR), this.node(t, {
|
|
1178
|
-
kind:
|
|
1177
|
+
kind: u.VARIABLE,
|
|
1179
1178
|
name: this.parseName()
|
|
1180
1179
|
});
|
|
1181
1180
|
}
|
|
@@ -1186,7 +1185,7 @@ class St {
|
|
|
1186
1185
|
*/
|
|
1187
1186
|
parseSelectionSet() {
|
|
1188
1187
|
return this.node(this._lexer.token, {
|
|
1189
|
-
kind:
|
|
1188
|
+
kind: u.SELECTION_SET,
|
|
1190
1189
|
selections: this.many(
|
|
1191
1190
|
a.BRACE_L,
|
|
1192
1191
|
this.parseSelection,
|
|
@@ -1210,11 +1209,11 @@ class St {
|
|
|
1210
1209
|
*/
|
|
1211
1210
|
parseField() {
|
|
1212
1211
|
const t = this._lexer.token, n = this.parseName();
|
|
1213
|
-
let
|
|
1214
|
-
return this.expectOptionalToken(a.COLON) ? (
|
|
1215
|
-
kind:
|
|
1216
|
-
alias:
|
|
1217
|
-
name:
|
|
1212
|
+
let i, r;
|
|
1213
|
+
return this.expectOptionalToken(a.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
|
|
1214
|
+
kind: u.FIELD,
|
|
1215
|
+
alias: i,
|
|
1216
|
+
name: r,
|
|
1218
1217
|
arguments: this.parseArguments(!1),
|
|
1219
1218
|
directives: this.parseDirectives(!1),
|
|
1220
1219
|
selectionSet: this.peek(a.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
@@ -1231,10 +1230,10 @@ class St {
|
|
|
1231
1230
|
* Argument[Const] : Name : Value[?Const]
|
|
1232
1231
|
*/
|
|
1233
1232
|
parseArgument(t = !1) {
|
|
1234
|
-
const n = this._lexer.token,
|
|
1233
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1235
1234
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1236
|
-
kind:
|
|
1237
|
-
name:
|
|
1235
|
+
kind: u.ARGUMENT,
|
|
1236
|
+
name: i,
|
|
1238
1237
|
value: this.parseValueLiteral(t)
|
|
1239
1238
|
});
|
|
1240
1239
|
}
|
|
@@ -1254,11 +1253,11 @@ class St {
|
|
|
1254
1253
|
this.expectToken(a.SPREAD);
|
|
1255
1254
|
const n = this.expectOptionalKeyword("on");
|
|
1256
1255
|
return !n && this.peek(a.NAME) ? this.node(t, {
|
|
1257
|
-
kind:
|
|
1256
|
+
kind: u.FRAGMENT_SPREAD,
|
|
1258
1257
|
name: this.parseFragmentName(),
|
|
1259
1258
|
directives: this.parseDirectives(!1)
|
|
1260
1259
|
}) : this.node(t, {
|
|
1261
|
-
kind:
|
|
1260
|
+
kind: u.INLINE_FRAGMENT,
|
|
1262
1261
|
typeCondition: n ? this.parseNamedType() : void 0,
|
|
1263
1262
|
directives: this.parseDirectives(!1),
|
|
1264
1263
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1273,7 +1272,7 @@ class St {
|
|
|
1273
1272
|
parseFragmentDefinition() {
|
|
1274
1273
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1275
1274
|
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
|
|
1276
|
-
kind:
|
|
1275
|
+
kind: u.FRAGMENT_DEFINITION,
|
|
1277
1276
|
description: n,
|
|
1278
1277
|
name: this.parseFragmentName(),
|
|
1279
1278
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
@@ -1281,7 +1280,7 @@ class St {
|
|
|
1281
1280
|
directives: this.parseDirectives(!1),
|
|
1282
1281
|
selectionSet: this.parseSelectionSet()
|
|
1283
1282
|
}) : this.node(t, {
|
|
1284
|
-
kind:
|
|
1283
|
+
kind: u.FRAGMENT_DEFINITION,
|
|
1285
1284
|
description: n,
|
|
1286
1285
|
name: this.parseFragmentName(),
|
|
1287
1286
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
@@ -1325,12 +1324,12 @@ class St {
|
|
|
1325
1324
|
return this.parseObject(t);
|
|
1326
1325
|
case a.INT:
|
|
1327
1326
|
return this.advanceLexer(), this.node(n, {
|
|
1328
|
-
kind:
|
|
1327
|
+
kind: u.INT,
|
|
1329
1328
|
value: n.value
|
|
1330
1329
|
});
|
|
1331
1330
|
case a.FLOAT:
|
|
1332
1331
|
return this.advanceLexer(), this.node(n, {
|
|
1333
|
-
kind:
|
|
1332
|
+
kind: u.FLOAT,
|
|
1334
1333
|
value: n.value
|
|
1335
1334
|
});
|
|
1336
1335
|
case a.STRING:
|
|
@@ -1340,32 +1339,32 @@ class St {
|
|
|
1340
1339
|
switch (this.advanceLexer(), n.value) {
|
|
1341
1340
|
case "true":
|
|
1342
1341
|
return this.node(n, {
|
|
1343
|
-
kind:
|
|
1342
|
+
kind: u.BOOLEAN,
|
|
1344
1343
|
value: !0
|
|
1345
1344
|
});
|
|
1346
1345
|
case "false":
|
|
1347
1346
|
return this.node(n, {
|
|
1348
|
-
kind:
|
|
1347
|
+
kind: u.BOOLEAN,
|
|
1349
1348
|
value: !1
|
|
1350
1349
|
});
|
|
1351
1350
|
case "null":
|
|
1352
1351
|
return this.node(n, {
|
|
1353
|
-
kind:
|
|
1352
|
+
kind: u.NULL
|
|
1354
1353
|
});
|
|
1355
1354
|
default:
|
|
1356
1355
|
return this.node(n, {
|
|
1357
|
-
kind:
|
|
1356
|
+
kind: u.ENUM,
|
|
1358
1357
|
value: n.value
|
|
1359
1358
|
});
|
|
1360
1359
|
}
|
|
1361
1360
|
case a.DOLLAR:
|
|
1362
1361
|
if (t)
|
|
1363
1362
|
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1364
|
-
const
|
|
1365
|
-
throw
|
|
1363
|
+
const i = this._lexer.token.value;
|
|
1364
|
+
throw T(
|
|
1366
1365
|
this._lexer.source,
|
|
1367
1366
|
n.start,
|
|
1368
|
-
`Unexpected variable "$${
|
|
1367
|
+
`Unexpected variable "$${i}" in constant value.`
|
|
1369
1368
|
);
|
|
1370
1369
|
} else
|
|
1371
1370
|
throw this.unexpected(n);
|
|
@@ -1380,7 +1379,7 @@ class St {
|
|
|
1380
1379
|
parseStringLiteral() {
|
|
1381
1380
|
const t = this._lexer.token;
|
|
1382
1381
|
return this.advanceLexer(), this.node(t, {
|
|
1383
|
-
kind:
|
|
1382
|
+
kind: u.STRING,
|
|
1384
1383
|
value: t.value,
|
|
1385
1384
|
block: t.kind === a.BLOCK_STRING
|
|
1386
1385
|
});
|
|
@@ -1393,7 +1392,7 @@ class St {
|
|
|
1393
1392
|
parseList(t) {
|
|
1394
1393
|
const n = () => this.parseValueLiteral(t);
|
|
1395
1394
|
return this.node(this._lexer.token, {
|
|
1396
|
-
kind:
|
|
1395
|
+
kind: u.LIST,
|
|
1397
1396
|
values: this.any(a.BRACKET_L, n, a.BRACKET_R)
|
|
1398
1397
|
});
|
|
1399
1398
|
}
|
|
@@ -1407,7 +1406,7 @@ class St {
|
|
|
1407
1406
|
parseObject(t) {
|
|
1408
1407
|
const n = () => this.parseObjectField(t);
|
|
1409
1408
|
return this.node(this._lexer.token, {
|
|
1410
|
-
kind:
|
|
1409
|
+
kind: u.OBJECT,
|
|
1411
1410
|
fields: this.any(a.BRACE_L, n, a.BRACE_R)
|
|
1412
1411
|
});
|
|
1413
1412
|
}
|
|
@@ -1415,10 +1414,10 @@ class St {
|
|
|
1415
1414
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1416
1415
|
*/
|
|
1417
1416
|
parseObjectField(t) {
|
|
1418
|
-
const n = this._lexer.token,
|
|
1417
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1419
1418
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1420
|
-
kind:
|
|
1421
|
-
name:
|
|
1419
|
+
kind: u.OBJECT_FIELD,
|
|
1420
|
+
name: i,
|
|
1422
1421
|
value: this.parseValueLiteral(t)
|
|
1423
1422
|
});
|
|
1424
1423
|
}
|
|
@@ -1443,7 +1442,7 @@ class St {
|
|
|
1443
1442
|
parseDirective(t) {
|
|
1444
1443
|
const n = this._lexer.token;
|
|
1445
1444
|
return this.expectToken(a.AT), this.node(n, {
|
|
1446
|
-
kind:
|
|
1445
|
+
kind: u.DIRECTIVE,
|
|
1447
1446
|
name: this.parseName(),
|
|
1448
1447
|
arguments: this.parseArguments(t)
|
|
1449
1448
|
});
|
|
@@ -1459,15 +1458,15 @@ class St {
|
|
|
1459
1458
|
const t = this._lexer.token;
|
|
1460
1459
|
let n;
|
|
1461
1460
|
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1462
|
-
const
|
|
1461
|
+
const i = this.parseTypeReference();
|
|
1463
1462
|
this.expectToken(a.BRACKET_R), n = this.node(t, {
|
|
1464
|
-
kind:
|
|
1465
|
-
type:
|
|
1463
|
+
kind: u.LIST_TYPE,
|
|
1464
|
+
type: i
|
|
1466
1465
|
});
|
|
1467
1466
|
} else
|
|
1468
1467
|
n = this.parseNamedType();
|
|
1469
1468
|
return this.expectOptionalToken(a.BANG) ? this.node(t, {
|
|
1470
|
-
kind:
|
|
1469
|
+
kind: u.NON_NULL_TYPE,
|
|
1471
1470
|
type: n
|
|
1472
1471
|
}) : n;
|
|
1473
1472
|
}
|
|
@@ -1476,7 +1475,7 @@ class St {
|
|
|
1476
1475
|
*/
|
|
1477
1476
|
parseNamedType() {
|
|
1478
1477
|
return this.node(this._lexer.token, {
|
|
1479
|
-
kind:
|
|
1478
|
+
kind: u.NAMED_TYPE,
|
|
1480
1479
|
name: this.parseName()
|
|
1481
1480
|
});
|
|
1482
1481
|
}
|
|
@@ -1499,16 +1498,16 @@ class St {
|
|
|
1499
1498
|
parseSchemaDefinition() {
|
|
1500
1499
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1501
1500
|
this.expectKeyword("schema");
|
|
1502
|
-
const
|
|
1501
|
+
const i = this.parseConstDirectives(), r = this.many(
|
|
1503
1502
|
a.BRACE_L,
|
|
1504
1503
|
this.parseOperationTypeDefinition,
|
|
1505
1504
|
a.BRACE_R
|
|
1506
1505
|
);
|
|
1507
1506
|
return this.node(t, {
|
|
1508
|
-
kind:
|
|
1507
|
+
kind: u.SCHEMA_DEFINITION,
|
|
1509
1508
|
description: n,
|
|
1510
|
-
directives:
|
|
1511
|
-
operationTypes:
|
|
1509
|
+
directives: i,
|
|
1510
|
+
operationTypes: r
|
|
1512
1511
|
});
|
|
1513
1512
|
}
|
|
1514
1513
|
/**
|
|
@@ -1517,11 +1516,11 @@ class St {
|
|
|
1517
1516
|
parseOperationTypeDefinition() {
|
|
1518
1517
|
const t = this._lexer.token, n = this.parseOperationType();
|
|
1519
1518
|
this.expectToken(a.COLON);
|
|
1520
|
-
const
|
|
1519
|
+
const i = this.parseNamedType();
|
|
1521
1520
|
return this.node(t, {
|
|
1522
|
-
kind:
|
|
1521
|
+
kind: u.OPERATION_TYPE_DEFINITION,
|
|
1523
1522
|
operation: n,
|
|
1524
|
-
type:
|
|
1523
|
+
type: i
|
|
1525
1524
|
});
|
|
1526
1525
|
}
|
|
1527
1526
|
/**
|
|
@@ -1530,12 +1529,12 @@ class St {
|
|
|
1530
1529
|
parseScalarTypeDefinition() {
|
|
1531
1530
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1532
1531
|
this.expectKeyword("scalar");
|
|
1533
|
-
const
|
|
1532
|
+
const i = this.parseName(), r = this.parseConstDirectives();
|
|
1534
1533
|
return this.node(t, {
|
|
1535
|
-
kind:
|
|
1534
|
+
kind: u.SCALAR_TYPE_DEFINITION,
|
|
1536
1535
|
description: n,
|
|
1537
|
-
name:
|
|
1538
|
-
directives:
|
|
1536
|
+
name: i,
|
|
1537
|
+
directives: r
|
|
1539
1538
|
});
|
|
1540
1539
|
}
|
|
1541
1540
|
/**
|
|
@@ -1546,12 +1545,12 @@ class St {
|
|
|
1546
1545
|
parseObjectTypeDefinition() {
|
|
1547
1546
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1548
1547
|
this.expectKeyword("type");
|
|
1549
|
-
const
|
|
1548
|
+
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1550
1549
|
return this.node(t, {
|
|
1551
|
-
kind:
|
|
1550
|
+
kind: u.OBJECT_TYPE_DEFINITION,
|
|
1552
1551
|
description: n,
|
|
1553
|
-
name:
|
|
1554
|
-
interfaces:
|
|
1552
|
+
name: i,
|
|
1553
|
+
interfaces: r,
|
|
1555
1554
|
directives: s,
|
|
1556
1555
|
fields: o
|
|
1557
1556
|
});
|
|
@@ -1581,14 +1580,14 @@ class St {
|
|
|
1581
1580
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1582
1581
|
*/
|
|
1583
1582
|
parseFieldDefinition() {
|
|
1584
|
-
const t = this._lexer.token, n = this.parseDescription(),
|
|
1583
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
1585
1584
|
this.expectToken(a.COLON);
|
|
1586
1585
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1587
1586
|
return this.node(t, {
|
|
1588
|
-
kind:
|
|
1587
|
+
kind: u.FIELD_DEFINITION,
|
|
1589
1588
|
description: n,
|
|
1590
|
-
name:
|
|
1591
|
-
arguments:
|
|
1589
|
+
name: i,
|
|
1590
|
+
arguments: r,
|
|
1592
1591
|
type: s,
|
|
1593
1592
|
directives: o
|
|
1594
1593
|
});
|
|
@@ -1608,17 +1607,17 @@ class St {
|
|
|
1608
1607
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1609
1608
|
*/
|
|
1610
1609
|
parseInputValueDef() {
|
|
1611
|
-
const t = this._lexer.token, n = this.parseDescription(),
|
|
1610
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
|
|
1612
1611
|
this.expectToken(a.COLON);
|
|
1613
|
-
const
|
|
1612
|
+
const r = this.parseTypeReference();
|
|
1614
1613
|
let s;
|
|
1615
1614
|
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1616
1615
|
const o = this.parseConstDirectives();
|
|
1617
1616
|
return this.node(t, {
|
|
1618
|
-
kind:
|
|
1617
|
+
kind: u.INPUT_VALUE_DEFINITION,
|
|
1619
1618
|
description: n,
|
|
1620
|
-
name:
|
|
1621
|
-
type:
|
|
1619
|
+
name: i,
|
|
1620
|
+
type: r,
|
|
1622
1621
|
defaultValue: s,
|
|
1623
1622
|
directives: o
|
|
1624
1623
|
});
|
|
@@ -1630,12 +1629,12 @@ class St {
|
|
|
1630
1629
|
parseInterfaceTypeDefinition() {
|
|
1631
1630
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1632
1631
|
this.expectKeyword("interface");
|
|
1633
|
-
const
|
|
1632
|
+
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1634
1633
|
return this.node(t, {
|
|
1635
|
-
kind:
|
|
1634
|
+
kind: u.INTERFACE_TYPE_DEFINITION,
|
|
1636
1635
|
description: n,
|
|
1637
|
-
name:
|
|
1638
|
-
interfaces:
|
|
1636
|
+
name: i,
|
|
1637
|
+
interfaces: r,
|
|
1639
1638
|
directives: s,
|
|
1640
1639
|
fields: o
|
|
1641
1640
|
});
|
|
@@ -1647,12 +1646,12 @@ class St {
|
|
|
1647
1646
|
parseUnionTypeDefinition() {
|
|
1648
1647
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1649
1648
|
this.expectKeyword("union");
|
|
1650
|
-
const
|
|
1649
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1651
1650
|
return this.node(t, {
|
|
1652
|
-
kind:
|
|
1651
|
+
kind: u.UNION_TYPE_DEFINITION,
|
|
1653
1652
|
description: n,
|
|
1654
|
-
name:
|
|
1655
|
-
directives:
|
|
1653
|
+
name: i,
|
|
1654
|
+
directives: r,
|
|
1656
1655
|
types: s
|
|
1657
1656
|
});
|
|
1658
1657
|
}
|
|
@@ -1671,12 +1670,12 @@ class St {
|
|
|
1671
1670
|
parseEnumTypeDefinition() {
|
|
1672
1671
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1673
1672
|
this.expectKeyword("enum");
|
|
1674
|
-
const
|
|
1673
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1675
1674
|
return this.node(t, {
|
|
1676
|
-
kind:
|
|
1675
|
+
kind: u.ENUM_TYPE_DEFINITION,
|
|
1677
1676
|
description: n,
|
|
1678
|
-
name:
|
|
1679
|
-
directives:
|
|
1677
|
+
name: i,
|
|
1678
|
+
directives: r,
|
|
1680
1679
|
values: s
|
|
1681
1680
|
});
|
|
1682
1681
|
}
|
|
@@ -1696,12 +1695,12 @@ class St {
|
|
|
1696
1695
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1697
1696
|
*/
|
|
1698
1697
|
parseEnumValueDefinition() {
|
|
1699
|
-
const t = this._lexer.token, n = this.parseDescription(),
|
|
1698
|
+
const t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1700
1699
|
return this.node(t, {
|
|
1701
|
-
kind:
|
|
1700
|
+
kind: u.ENUM_VALUE_DEFINITION,
|
|
1702
1701
|
description: n,
|
|
1703
|
-
name:
|
|
1704
|
-
directives:
|
|
1702
|
+
name: i,
|
|
1703
|
+
directives: r
|
|
1705
1704
|
});
|
|
1706
1705
|
}
|
|
1707
1706
|
/**
|
|
@@ -1709,7 +1708,7 @@ class St {
|
|
|
1709
1708
|
*/
|
|
1710
1709
|
parseEnumValueName() {
|
|
1711
1710
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
1712
|
-
throw
|
|
1711
|
+
throw T(
|
|
1713
1712
|
this._lexer.source,
|
|
1714
1713
|
this._lexer.token.start,
|
|
1715
1714
|
`${q(
|
|
@@ -1725,12 +1724,12 @@ class St {
|
|
|
1725
1724
|
parseInputObjectTypeDefinition() {
|
|
1726
1725
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1727
1726
|
this.expectKeyword("input");
|
|
1728
|
-
const
|
|
1727
|
+
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1729
1728
|
return this.node(t, {
|
|
1730
|
-
kind:
|
|
1729
|
+
kind: u.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1731
1730
|
description: n,
|
|
1732
|
-
name:
|
|
1733
|
-
directives:
|
|
1731
|
+
name: i,
|
|
1732
|
+
directives: r,
|
|
1734
1733
|
fields: s
|
|
1735
1734
|
});
|
|
1736
1735
|
}
|
|
@@ -1790,17 +1789,17 @@ class St {
|
|
|
1790
1789
|
parseSchemaExtension() {
|
|
1791
1790
|
const t = this._lexer.token;
|
|
1792
1791
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1793
|
-
const n = this.parseConstDirectives(),
|
|
1792
|
+
const n = this.parseConstDirectives(), i = this.optionalMany(
|
|
1794
1793
|
a.BRACE_L,
|
|
1795
1794
|
this.parseOperationTypeDefinition,
|
|
1796
1795
|
a.BRACE_R
|
|
1797
1796
|
);
|
|
1798
|
-
if (n.length === 0 &&
|
|
1797
|
+
if (n.length === 0 && i.length === 0)
|
|
1799
1798
|
throw this.unexpected();
|
|
1800
1799
|
return this.node(t, {
|
|
1801
|
-
kind:
|
|
1800
|
+
kind: u.SCHEMA_EXTENSION,
|
|
1802
1801
|
directives: n,
|
|
1803
|
-
operationTypes:
|
|
1802
|
+
operationTypes: i
|
|
1804
1803
|
});
|
|
1805
1804
|
}
|
|
1806
1805
|
/**
|
|
@@ -1810,13 +1809,13 @@ class St {
|
|
|
1810
1809
|
parseScalarTypeExtension() {
|
|
1811
1810
|
const t = this._lexer.token;
|
|
1812
1811
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1813
|
-
const n = this.parseName(),
|
|
1814
|
-
if (
|
|
1812
|
+
const n = this.parseName(), i = this.parseConstDirectives();
|
|
1813
|
+
if (i.length === 0)
|
|
1815
1814
|
throw this.unexpected();
|
|
1816
1815
|
return this.node(t, {
|
|
1817
|
-
kind:
|
|
1816
|
+
kind: u.SCALAR_TYPE_EXTENSION,
|
|
1818
1817
|
name: n,
|
|
1819
|
-
directives:
|
|
1818
|
+
directives: i
|
|
1820
1819
|
});
|
|
1821
1820
|
}
|
|
1822
1821
|
/**
|
|
@@ -1828,14 +1827,14 @@ class St {
|
|
|
1828
1827
|
parseObjectTypeExtension() {
|
|
1829
1828
|
const t = this._lexer.token;
|
|
1830
1829
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1831
|
-
const n = this.parseName(),
|
|
1832
|
-
if (
|
|
1830
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1831
|
+
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1833
1832
|
throw this.unexpected();
|
|
1834
1833
|
return this.node(t, {
|
|
1835
|
-
kind:
|
|
1834
|
+
kind: u.OBJECT_TYPE_EXTENSION,
|
|
1836
1835
|
name: n,
|
|
1837
|
-
interfaces:
|
|
1838
|
-
directives:
|
|
1836
|
+
interfaces: i,
|
|
1837
|
+
directives: r,
|
|
1839
1838
|
fields: s
|
|
1840
1839
|
});
|
|
1841
1840
|
}
|
|
@@ -1848,14 +1847,14 @@ class St {
|
|
|
1848
1847
|
parseInterfaceTypeExtension() {
|
|
1849
1848
|
const t = this._lexer.token;
|
|
1850
1849
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1851
|
-
const n = this.parseName(),
|
|
1852
|
-
if (
|
|
1850
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1851
|
+
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1853
1852
|
throw this.unexpected();
|
|
1854
1853
|
return this.node(t, {
|
|
1855
|
-
kind:
|
|
1854
|
+
kind: u.INTERFACE_TYPE_EXTENSION,
|
|
1856
1855
|
name: n,
|
|
1857
|
-
interfaces:
|
|
1858
|
-
directives:
|
|
1856
|
+
interfaces: i,
|
|
1857
|
+
directives: r,
|
|
1859
1858
|
fields: s
|
|
1860
1859
|
});
|
|
1861
1860
|
}
|
|
@@ -1867,14 +1866,14 @@ class St {
|
|
|
1867
1866
|
parseUnionTypeExtension() {
|
|
1868
1867
|
const t = this._lexer.token;
|
|
1869
1868
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1870
|
-
const n = this.parseName(),
|
|
1871
|
-
if (
|
|
1869
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1870
|
+
if (i.length === 0 && r.length === 0)
|
|
1872
1871
|
throw this.unexpected();
|
|
1873
1872
|
return this.node(t, {
|
|
1874
|
-
kind:
|
|
1873
|
+
kind: u.UNION_TYPE_EXTENSION,
|
|
1875
1874
|
name: n,
|
|
1876
|
-
directives:
|
|
1877
|
-
types:
|
|
1875
|
+
directives: i,
|
|
1876
|
+
types: r
|
|
1878
1877
|
});
|
|
1879
1878
|
}
|
|
1880
1879
|
/**
|
|
@@ -1885,14 +1884,14 @@ class St {
|
|
|
1885
1884
|
parseEnumTypeExtension() {
|
|
1886
1885
|
const t = this._lexer.token;
|
|
1887
1886
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1888
|
-
const n = this.parseName(),
|
|
1889
|
-
if (
|
|
1887
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1888
|
+
if (i.length === 0 && r.length === 0)
|
|
1890
1889
|
throw this.unexpected();
|
|
1891
1890
|
return this.node(t, {
|
|
1892
|
-
kind:
|
|
1891
|
+
kind: u.ENUM_TYPE_EXTENSION,
|
|
1893
1892
|
name: n,
|
|
1894
|
-
directives:
|
|
1895
|
-
values:
|
|
1893
|
+
directives: i,
|
|
1894
|
+
values: r
|
|
1896
1895
|
});
|
|
1897
1896
|
}
|
|
1898
1897
|
/**
|
|
@@ -1903,14 +1902,14 @@ class St {
|
|
|
1903
1902
|
parseInputObjectTypeExtension() {
|
|
1904
1903
|
const t = this._lexer.token;
|
|
1905
1904
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1906
|
-
const n = this.parseName(),
|
|
1907
|
-
if (
|
|
1905
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1906
|
+
if (i.length === 0 && r.length === 0)
|
|
1908
1907
|
throw this.unexpected();
|
|
1909
1908
|
return this.node(t, {
|
|
1910
|
-
kind:
|
|
1909
|
+
kind: u.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1911
1910
|
name: n,
|
|
1912
|
-
directives:
|
|
1913
|
-
fields:
|
|
1911
|
+
directives: i,
|
|
1912
|
+
fields: r
|
|
1914
1913
|
});
|
|
1915
1914
|
}
|
|
1916
1915
|
/**
|
|
@@ -1922,14 +1921,14 @@ class St {
|
|
|
1922
1921
|
parseDirectiveDefinition() {
|
|
1923
1922
|
const t = this._lexer.token, n = this.parseDescription();
|
|
1924
1923
|
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1925
|
-
const
|
|
1924
|
+
const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1926
1925
|
this.expectKeyword("on");
|
|
1927
1926
|
const o = this.parseDirectiveLocations();
|
|
1928
1927
|
return this.node(t, {
|
|
1929
|
-
kind:
|
|
1928
|
+
kind: u.DIRECTIVE_DEFINITION,
|
|
1930
1929
|
description: n,
|
|
1931
|
-
name:
|
|
1932
|
-
arguments:
|
|
1930
|
+
name: i,
|
|
1931
|
+
arguments: r,
|
|
1933
1932
|
repeatable: s,
|
|
1934
1933
|
locations: o
|
|
1935
1934
|
});
|
|
@@ -1971,7 +1970,7 @@ class St {
|
|
|
1971
1970
|
*/
|
|
1972
1971
|
parseDirectiveLocation() {
|
|
1973
1972
|
const t = this._lexer.token, n = this.parseName();
|
|
1974
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1973
|
+
if (Object.prototype.hasOwnProperty.call(re, n.value))
|
|
1975
1974
|
return n;
|
|
1976
1975
|
throw this.unexpected(t);
|
|
1977
1976
|
}
|
|
@@ -1985,29 +1984,29 @@ class St {
|
|
|
1985
1984
|
* - \@ Name ( Name : )
|
|
1986
1985
|
*/
|
|
1987
1986
|
parseSchemaCoordinate() {
|
|
1988
|
-
const t = this._lexer.token, n = this.expectOptionalToken(a.AT),
|
|
1989
|
-
let
|
|
1990
|
-
!n && this.expectOptionalToken(a.DOT) && (
|
|
1987
|
+
const t = this._lexer.token, n = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1988
|
+
let r;
|
|
1989
|
+
!n && this.expectOptionalToken(a.DOT) && (r = this.parseName());
|
|
1991
1990
|
let s;
|
|
1992
|
-
return (n ||
|
|
1993
|
-
kind:
|
|
1994
|
-
name:
|
|
1991
|
+
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, {
|
|
1992
|
+
kind: u.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1993
|
+
name: i,
|
|
1995
1994
|
argumentName: s
|
|
1996
1995
|
}) : this.node(t, {
|
|
1997
|
-
kind:
|
|
1998
|
-
name:
|
|
1999
|
-
}) :
|
|
2000
|
-
kind:
|
|
2001
|
-
name:
|
|
2002
|
-
fieldName:
|
|
1996
|
+
kind: u.DIRECTIVE_COORDINATE,
|
|
1997
|
+
name: i
|
|
1998
|
+
}) : r ? s ? this.node(t, {
|
|
1999
|
+
kind: u.ARGUMENT_COORDINATE,
|
|
2000
|
+
name: i,
|
|
2001
|
+
fieldName: r,
|
|
2003
2002
|
argumentName: s
|
|
2004
2003
|
}) : this.node(t, {
|
|
2005
|
-
kind:
|
|
2006
|
-
name:
|
|
2007
|
-
memberName:
|
|
2004
|
+
kind: u.MEMBER_COORDINATE,
|
|
2005
|
+
name: i,
|
|
2006
|
+
memberName: r
|
|
2008
2007
|
}) : this.node(t, {
|
|
2009
|
-
kind:
|
|
2010
|
-
name:
|
|
2008
|
+
kind: u.TYPE_COORDINATE,
|
|
2009
|
+
name: i
|
|
2011
2010
|
});
|
|
2012
2011
|
}
|
|
2013
2012
|
// Core parsing utility functions
|
|
@@ -2017,7 +2016,7 @@ class St {
|
|
|
2017
2016
|
* given parsed object.
|
|
2018
2017
|
*/
|
|
2019
2018
|
node(t, n) {
|
|
2020
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
2019
|
+
return this._options.noLocation !== !0 && (n.loc = new He(
|
|
2021
2020
|
t,
|
|
2022
2021
|
this._lexer.lastToken,
|
|
2023
2022
|
this._lexer.source
|
|
@@ -2037,10 +2036,10 @@ class St {
|
|
|
2037
2036
|
const n = this._lexer.token;
|
|
2038
2037
|
if (n.kind === t)
|
|
2039
2038
|
return this.advanceLexer(), n;
|
|
2040
|
-
throw
|
|
2039
|
+
throw T(
|
|
2041
2040
|
this._lexer.source,
|
|
2042
2041
|
n.start,
|
|
2043
|
-
`Expected ${
|
|
2042
|
+
`Expected ${Fe(t)}, found ${q(n)}.`
|
|
2044
2043
|
);
|
|
2045
2044
|
}
|
|
2046
2045
|
/**
|
|
@@ -2059,7 +2058,7 @@ class St {
|
|
|
2059
2058
|
if (n.kind === a.NAME && n.value === t)
|
|
2060
2059
|
this.advanceLexer();
|
|
2061
2060
|
else
|
|
2062
|
-
throw
|
|
2061
|
+
throw T(
|
|
2063
2062
|
this._lexer.source,
|
|
2064
2063
|
n.start,
|
|
2065
2064
|
`Expected "${t}", found ${q(n)}.`
|
|
@@ -2078,7 +2077,7 @@ class St {
|
|
|
2078
2077
|
*/
|
|
2079
2078
|
unexpected(t) {
|
|
2080
2079
|
const n = t ?? this._lexer.token;
|
|
2081
|
-
return
|
|
2080
|
+
return T(
|
|
2082
2081
|
this._lexer.source,
|
|
2083
2082
|
n.start,
|
|
2084
2083
|
`Unexpected ${q(n)}.`
|
|
@@ -2089,12 +2088,12 @@ class St {
|
|
|
2089
2088
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2090
2089
|
* Advances the parser to the next lex token after the closing token.
|
|
2091
2090
|
*/
|
|
2092
|
-
any(t, n,
|
|
2091
|
+
any(t, n, i) {
|
|
2093
2092
|
this.expectToken(t);
|
|
2094
|
-
const
|
|
2095
|
-
for (; !this.expectOptionalToken(
|
|
2096
|
-
|
|
2097
|
-
return
|
|
2093
|
+
const r = [];
|
|
2094
|
+
for (; !this.expectOptionalToken(i); )
|
|
2095
|
+
r.push(n.call(this));
|
|
2096
|
+
return r;
|
|
2098
2097
|
}
|
|
2099
2098
|
/**
|
|
2100
2099
|
* Returns a list of parse nodes, determined by the parseFn.
|
|
@@ -2102,13 +2101,13 @@ class St {
|
|
|
2102
2101
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2103
2102
|
* Advances the parser to the next lex token after the closing token.
|
|
2104
2103
|
*/
|
|
2105
|
-
optionalMany(t, n,
|
|
2104
|
+
optionalMany(t, n, i) {
|
|
2106
2105
|
if (this.expectOptionalToken(t)) {
|
|
2107
|
-
const
|
|
2106
|
+
const r = [];
|
|
2108
2107
|
do
|
|
2109
|
-
|
|
2110
|
-
while (!this.expectOptionalToken(
|
|
2111
|
-
return
|
|
2108
|
+
r.push(n.call(this));
|
|
2109
|
+
while (!this.expectOptionalToken(i));
|
|
2110
|
+
return r;
|
|
2112
2111
|
}
|
|
2113
2112
|
return [];
|
|
2114
2113
|
}
|
|
@@ -2117,13 +2116,13 @@ class St {
|
|
|
2117
2116
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2118
2117
|
* Advances the parser to the next lex token after the closing token.
|
|
2119
2118
|
*/
|
|
2120
|
-
many(t, n,
|
|
2119
|
+
many(t, n, i) {
|
|
2121
2120
|
this.expectToken(t);
|
|
2122
|
-
const
|
|
2121
|
+
const r = [];
|
|
2123
2122
|
do
|
|
2124
|
-
|
|
2125
|
-
while (!this.expectOptionalToken(
|
|
2126
|
-
return
|
|
2123
|
+
r.push(n.call(this));
|
|
2124
|
+
while (!this.expectOptionalToken(i));
|
|
2125
|
+
return r;
|
|
2127
2126
|
}
|
|
2128
2127
|
/**
|
|
2129
2128
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
@@ -2132,16 +2131,16 @@ class St {
|
|
|
2132
2131
|
*/
|
|
2133
2132
|
delimitedMany(t, n) {
|
|
2134
2133
|
this.expectOptionalToken(t);
|
|
2135
|
-
const
|
|
2134
|
+
const i = [];
|
|
2136
2135
|
do
|
|
2137
|
-
|
|
2136
|
+
i.push(n.call(this));
|
|
2138
2137
|
while (this.expectOptionalToken(t));
|
|
2139
|
-
return
|
|
2138
|
+
return i;
|
|
2140
2139
|
}
|
|
2141
2140
|
advanceLexer() {
|
|
2142
2141
|
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
2143
2142
|
if (n.kind !== a.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
|
|
2144
|
-
throw
|
|
2143
|
+
throw T(
|
|
2145
2144
|
this._lexer.source,
|
|
2146
2145
|
n.start,
|
|
2147
2146
|
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
@@ -2150,19 +2149,19 @@ class St {
|
|
|
2150
2149
|
}
|
|
2151
2150
|
function q(e) {
|
|
2152
2151
|
const t = e.value;
|
|
2153
|
-
return
|
|
2152
|
+
return Fe(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2154
2153
|
}
|
|
2155
|
-
function
|
|
2156
|
-
return
|
|
2154
|
+
function Fe(e) {
|
|
2155
|
+
return Ke(e) ? `"${e}"` : e;
|
|
2157
2156
|
}
|
|
2158
|
-
function
|
|
2159
|
-
return `"${e.replace(
|
|
2157
|
+
function vt(e) {
|
|
2158
|
+
return `"${e.replace(Tt, At)}"`;
|
|
2160
2159
|
}
|
|
2161
|
-
const
|
|
2162
|
-
function
|
|
2163
|
-
return
|
|
2160
|
+
const Tt = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
2161
|
+
function At(e) {
|
|
2162
|
+
return kt[e.charCodeAt(0)];
|
|
2164
2163
|
}
|
|
2165
|
-
const
|
|
2164
|
+
const kt = [
|
|
2166
2165
|
"\\u0000",
|
|
2167
2166
|
"\\u0001",
|
|
2168
2167
|
"\\u0002",
|
|
@@ -2328,72 +2327,72 @@ const Rt = [
|
|
|
2328
2327
|
"\\u009D",
|
|
2329
2328
|
"\\u009E",
|
|
2330
2329
|
"\\u009F"
|
|
2331
|
-
],
|
|
2332
|
-
function
|
|
2333
|
-
const
|
|
2334
|
-
for (const
|
|
2335
|
-
|
|
2336
|
-
let
|
|
2330
|
+
], Ot = Object.freeze({});
|
|
2331
|
+
function Dt(e, t, n = Pe) {
|
|
2332
|
+
const i = /* @__PURE__ */ new Map();
|
|
2333
|
+
for (const k of Object.values(u))
|
|
2334
|
+
i.set(k, Nt(t, k));
|
|
2335
|
+
let r, s = Array.isArray(e), o = [e], l = -1, f = [], p = e, g, d;
|
|
2337
2336
|
const m = [], y = [];
|
|
2338
2337
|
do {
|
|
2339
|
-
|
|
2340
|
-
const
|
|
2341
|
-
if (
|
|
2342
|
-
if (
|
|
2338
|
+
l++;
|
|
2339
|
+
const k = l === o.length, C = k && f.length !== 0;
|
|
2340
|
+
if (k) {
|
|
2341
|
+
if (g = y.length === 0 ? void 0 : m[m.length - 1], p = d, d = y.pop(), C)
|
|
2343
2342
|
if (s) {
|
|
2344
2343
|
p = p.slice();
|
|
2345
|
-
let
|
|
2346
|
-
for (const [
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2344
|
+
let A = 0;
|
|
2345
|
+
for (const [O, b] of f) {
|
|
2346
|
+
const P = O - A;
|
|
2347
|
+
b === null ? (p.splice(P, 1), A++) : p[P] = b;
|
|
2349
2348
|
}
|
|
2350
2349
|
} else {
|
|
2351
2350
|
p = { ...p };
|
|
2352
|
-
for (const [
|
|
2353
|
-
p[
|
|
2351
|
+
for (const [A, O] of f)
|
|
2352
|
+
p[A] = O;
|
|
2354
2353
|
}
|
|
2355
|
-
|
|
2356
|
-
} else if (
|
|
2357
|
-
if (
|
|
2354
|
+
l = r.index, o = r.keys, f = r.edits, s = r.inArray, r = r.prev;
|
|
2355
|
+
} else if (d) {
|
|
2356
|
+
if (g = s ? l : o[l], p = d[g], p == null)
|
|
2358
2357
|
continue;
|
|
2359
|
-
m.push(
|
|
2358
|
+
m.push(g);
|
|
2360
2359
|
}
|
|
2361
|
-
let
|
|
2360
|
+
let x;
|
|
2362
2361
|
if (!Array.isArray(p)) {
|
|
2363
|
-
var I,
|
|
2364
|
-
|
|
2365
|
-
const
|
|
2366
|
-
if (
|
|
2362
|
+
var I, D;
|
|
2363
|
+
he(p) || z(!1, `Invalid AST Node: ${de(p)}.`);
|
|
2364
|
+
const A = k ? (I = i.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (D = i.get(p.kind)) === null || D === void 0 ? void 0 : D.enter;
|
|
2365
|
+
if (x = A?.call(t, p, g, d, m, y), x === Ot)
|
|
2367
2366
|
break;
|
|
2368
|
-
if (
|
|
2369
|
-
if (!
|
|
2367
|
+
if (x === !1) {
|
|
2368
|
+
if (!k) {
|
|
2370
2369
|
m.pop();
|
|
2371
2370
|
continue;
|
|
2372
2371
|
}
|
|
2373
|
-
} else if (
|
|
2374
|
-
if (
|
|
2375
|
-
p =
|
|
2372
|
+
} else if (x !== void 0 && (f.push([g, x]), !k))
|
|
2373
|
+
if (he(x))
|
|
2374
|
+
p = x;
|
|
2376
2375
|
else {
|
|
2377
2376
|
m.pop();
|
|
2378
2377
|
continue;
|
|
2379
2378
|
}
|
|
2380
2379
|
}
|
|
2381
|
-
if (
|
|
2380
|
+
if (x === void 0 && C && f.push([g, p]), k)
|
|
2382
2381
|
m.pop();
|
|
2383
2382
|
else {
|
|
2384
|
-
var
|
|
2385
|
-
|
|
2383
|
+
var N;
|
|
2384
|
+
r = {
|
|
2386
2385
|
inArray: s,
|
|
2387
|
-
index:
|
|
2386
|
+
index: l,
|
|
2388
2387
|
keys: o,
|
|
2389
|
-
edits:
|
|
2390
|
-
prev:
|
|
2391
|
-
}, s = Array.isArray(p), o = s ? p : (
|
|
2388
|
+
edits: f,
|
|
2389
|
+
prev: r
|
|
2390
|
+
}, s = Array.isArray(p), o = s ? p : (N = n[p.kind]) !== null && N !== void 0 ? N : [], l = -1, f = [], d && y.push(d), d = p;
|
|
2392
2391
|
}
|
|
2393
|
-
} while (
|
|
2394
|
-
return
|
|
2392
|
+
} while (r !== void 0);
|
|
2393
|
+
return f.length !== 0 ? f[f.length - 1][1] : e;
|
|
2395
2394
|
}
|
|
2396
|
-
function
|
|
2395
|
+
function Nt(e, t) {
|
|
2397
2396
|
const n = e[t];
|
|
2398
2397
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
2399
2398
|
enter: n,
|
|
@@ -2403,10 +2402,10 @@ function $t(e, t) {
|
|
|
2403
2402
|
leave: e.leave
|
|
2404
2403
|
};
|
|
2405
2404
|
}
|
|
2406
|
-
function
|
|
2407
|
-
return
|
|
2405
|
+
function bt(e) {
|
|
2406
|
+
return Dt(e, Pt);
|
|
2408
2407
|
}
|
|
2409
|
-
const
|
|
2408
|
+
const xt = 80, Pt = {
|
|
2410
2409
|
Name: {
|
|
2411
2410
|
leave: (e) => e.value
|
|
2412
2411
|
},
|
|
@@ -2415,21 +2414,21 @@ const Vt = 80, Ut = {
|
|
|
2415
2414
|
},
|
|
2416
2415
|
// Document
|
|
2417
2416
|
Document: {
|
|
2418
|
-
leave: (e) =>
|
|
2417
|
+
leave: (e) => c(e.definitions, `
|
|
2419
2418
|
|
|
2420
2419
|
`)
|
|
2421
2420
|
},
|
|
2422
2421
|
OperationDefinition: {
|
|
2423
2422
|
leave(e) {
|
|
2424
|
-
const t =
|
|
2425
|
-
`,
|
|
2423
|
+
const t = te(e.variableDefinitions) ? h(`(
|
|
2424
|
+
`, c(e.variableDefinitions, `
|
|
2426
2425
|
`), `
|
|
2427
|
-
)`) :
|
|
2428
|
-
`) +
|
|
2426
|
+
)`) : h("(", c(e.variableDefinitions, ", "), ")"), n = h("", e.description, `
|
|
2427
|
+
`) + c(
|
|
2429
2428
|
[
|
|
2430
2429
|
e.operation,
|
|
2431
|
-
|
|
2432
|
-
|
|
2430
|
+
c([e.name, t]),
|
|
2431
|
+
c(e.directives, " ")
|
|
2433
2432
|
],
|
|
2434
2433
|
" "
|
|
2435
2434
|
);
|
|
@@ -2437,20 +2436,20 @@ const Vt = 80, Ut = {
|
|
|
2437
2436
|
}
|
|
2438
2437
|
},
|
|
2439
2438
|
VariableDefinition: {
|
|
2440
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives:
|
|
2441
|
-
`) + e + ": " + t +
|
|
2439
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => h("", r, `
|
|
2440
|
+
`) + e + ": " + t + h(" = ", n) + h(" ", c(i, " "))
|
|
2442
2441
|
},
|
|
2443
2442
|
SelectionSet: {
|
|
2444
2443
|
leave: ({ selections: e }) => S(e)
|
|
2445
2444
|
},
|
|
2446
2445
|
Field: {
|
|
2447
|
-
leave({ alias: e, name: t, arguments: n, directives:
|
|
2448
|
-
const s =
|
|
2449
|
-
let o = s +
|
|
2450
|
-
return o.length >
|
|
2451
|
-
`,
|
|
2446
|
+
leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
|
|
2447
|
+
const s = h("", e, ": ") + t;
|
|
2448
|
+
let o = s + h("(", c(n, ", "), ")");
|
|
2449
|
+
return o.length > xt && (o = s + h(`(
|
|
2450
|
+
`, j(c(n, `
|
|
2452
2451
|
`)), `
|
|
2453
|
-
)`)),
|
|
2452
|
+
)`)), c([o, c(i, " "), r], " ");
|
|
2454
2453
|
}
|
|
2455
2454
|
},
|
|
2456
2455
|
Argument: {
|
|
@@ -2458,14 +2457,14 @@ const Vt = 80, Ut = {
|
|
|
2458
2457
|
},
|
|
2459
2458
|
// Fragments
|
|
2460
2459
|
FragmentSpread: {
|
|
2461
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
2460
|
+
leave: ({ name: e, directives: t }) => "..." + e + h(" ", c(t, " "))
|
|
2462
2461
|
},
|
|
2463
2462
|
InlineFragment: {
|
|
2464
|
-
leave: ({ typeCondition: e, directives: t, selectionSet: n }) =>
|
|
2463
|
+
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => c(
|
|
2465
2464
|
[
|
|
2466
2465
|
"...",
|
|
2467
|
-
|
|
2468
|
-
|
|
2466
|
+
h("on ", e),
|
|
2467
|
+
c(t, " "),
|
|
2469
2468
|
n
|
|
2470
2469
|
],
|
|
2471
2470
|
" "
|
|
@@ -2476,13 +2475,13 @@ const Vt = 80, Ut = {
|
|
|
2476
2475
|
name: e,
|
|
2477
2476
|
typeCondition: t,
|
|
2478
2477
|
variableDefinitions: n,
|
|
2479
|
-
directives:
|
|
2480
|
-
selectionSet:
|
|
2478
|
+
directives: i,
|
|
2479
|
+
selectionSet: r,
|
|
2481
2480
|
description: s
|
|
2482
|
-
}) =>
|
|
2481
|
+
}) => h("", s, `
|
|
2483
2482
|
`) + // Note: fragment variable definitions are experimental and may be changed
|
|
2484
2483
|
// or removed in the future.
|
|
2485
|
-
`fragment ${e}${
|
|
2484
|
+
`fragment ${e}${h("(", c(n, ", "), ")")} on ${t} ${h("", c(i, " "), " ")}` + r
|
|
2486
2485
|
},
|
|
2487
2486
|
// Value
|
|
2488
2487
|
IntValue: {
|
|
@@ -2492,7 +2491,7 @@ const Vt = 80, Ut = {
|
|
|
2492
2491
|
leave: ({ value: e }) => e
|
|
2493
2492
|
},
|
|
2494
2493
|
StringValue: {
|
|
2495
|
-
leave: ({ value: e, block: t }) => t ?
|
|
2494
|
+
leave: ({ value: e, block: t }) => t ? We(e) : vt(e)
|
|
2496
2495
|
},
|
|
2497
2496
|
BooleanValue: {
|
|
2498
2497
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -2504,17 +2503,17 @@ const Vt = 80, Ut = {
|
|
|
2504
2503
|
leave: ({ value: e }) => e
|
|
2505
2504
|
},
|
|
2506
2505
|
ListValue: {
|
|
2507
|
-
leave: ({ values: e }) => "[" +
|
|
2506
|
+
leave: ({ values: e }) => "[" + c(e, ", ") + "]"
|
|
2508
2507
|
},
|
|
2509
2508
|
ObjectValue: {
|
|
2510
|
-
leave: ({ fields: e }) => "{" +
|
|
2509
|
+
leave: ({ fields: e }) => "{" + c(e, ", ") + "}"
|
|
2511
2510
|
},
|
|
2512
2511
|
ObjectField: {
|
|
2513
2512
|
leave: ({ name: e, value: t }) => e + ": " + t
|
|
2514
2513
|
},
|
|
2515
2514
|
// Directive
|
|
2516
2515
|
Directive: {
|
|
2517
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
2516
|
+
leave: ({ name: e, arguments: t }) => "@" + e + h("(", c(t, ", "), ")")
|
|
2518
2517
|
},
|
|
2519
2518
|
// Type
|
|
2520
2519
|
NamedType: {
|
|
@@ -2528,247 +2527,247 @@ const Vt = 80, Ut = {
|
|
|
2528
2527
|
},
|
|
2529
2528
|
// Type System Definitions
|
|
2530
2529
|
SchemaDefinition: {
|
|
2531
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
2532
|
-
`) +
|
|
2530
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => h("", e, `
|
|
2531
|
+
`) + c(["schema", c(t, " "), S(n)], " ")
|
|
2533
2532
|
},
|
|
2534
2533
|
OperationTypeDefinition: {
|
|
2535
2534
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
2536
2535
|
},
|
|
2537
2536
|
ScalarTypeDefinition: {
|
|
2538
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2539
|
-
`) +
|
|
2537
|
+
leave: ({ description: e, name: t, directives: n }) => h("", e, `
|
|
2538
|
+
`) + c(["scalar", t, c(n, " ")], " ")
|
|
2540
2539
|
},
|
|
2541
2540
|
ObjectTypeDefinition: {
|
|
2542
|
-
leave: ({ description: e, name: t, interfaces: n, directives:
|
|
2543
|
-
`) +
|
|
2541
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => h("", e, `
|
|
2542
|
+
`) + c(
|
|
2544
2543
|
[
|
|
2545
2544
|
"type",
|
|
2546
2545
|
t,
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
S(
|
|
2546
|
+
h("implements ", c(n, " & ")),
|
|
2547
|
+
c(i, " "),
|
|
2548
|
+
S(r)
|
|
2550
2549
|
],
|
|
2551
2550
|
" "
|
|
2552
2551
|
)
|
|
2553
2552
|
},
|
|
2554
2553
|
FieldDefinition: {
|
|
2555
|
-
leave: ({ description: e, name: t, arguments: n, type:
|
|
2556
|
-
`) + t + (
|
|
2557
|
-
`,
|
|
2554
|
+
leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => h("", e, `
|
|
2555
|
+
`) + t + (te(n) ? h(`(
|
|
2556
|
+
`, j(c(n, `
|
|
2558
2557
|
`)), `
|
|
2559
|
-
)`) :
|
|
2558
|
+
)`) : h("(", c(n, ", "), ")")) + ": " + i + h(" ", c(r, " "))
|
|
2560
2559
|
},
|
|
2561
2560
|
InputValueDefinition: {
|
|
2562
|
-
leave: ({ description: e, name: t, type: n, defaultValue:
|
|
2563
|
-
`) +
|
|
2564
|
-
[t + ": " + n,
|
|
2561
|
+
leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => h("", e, `
|
|
2562
|
+
`) + c(
|
|
2563
|
+
[t + ": " + n, h("= ", i), c(r, " ")],
|
|
2565
2564
|
" "
|
|
2566
2565
|
)
|
|
2567
2566
|
},
|
|
2568
2567
|
InterfaceTypeDefinition: {
|
|
2569
|
-
leave: ({ description: e, name: t, interfaces: n, directives:
|
|
2570
|
-
`) +
|
|
2568
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => h("", e, `
|
|
2569
|
+
`) + c(
|
|
2571
2570
|
[
|
|
2572
2571
|
"interface",
|
|
2573
2572
|
t,
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
S(
|
|
2573
|
+
h("implements ", c(n, " & ")),
|
|
2574
|
+
c(i, " "),
|
|
2575
|
+
S(r)
|
|
2577
2576
|
],
|
|
2578
2577
|
" "
|
|
2579
2578
|
)
|
|
2580
2579
|
},
|
|
2581
2580
|
UnionTypeDefinition: {
|
|
2582
|
-
leave: ({ description: e, name: t, directives: n, types:
|
|
2583
|
-
`) +
|
|
2584
|
-
["union", t,
|
|
2581
|
+
leave: ({ description: e, name: t, directives: n, types: i }) => h("", e, `
|
|
2582
|
+
`) + c(
|
|
2583
|
+
["union", t, c(n, " "), h("= ", c(i, " | "))],
|
|
2585
2584
|
" "
|
|
2586
2585
|
)
|
|
2587
2586
|
},
|
|
2588
2587
|
EnumTypeDefinition: {
|
|
2589
|
-
leave: ({ description: e, name: t, directives: n, values:
|
|
2590
|
-
`) +
|
|
2588
|
+
leave: ({ description: e, name: t, directives: n, values: i }) => h("", e, `
|
|
2589
|
+
`) + c(["enum", t, c(n, " "), S(i)], " ")
|
|
2591
2590
|
},
|
|
2592
2591
|
EnumValueDefinition: {
|
|
2593
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
2594
|
-
`) +
|
|
2592
|
+
leave: ({ description: e, name: t, directives: n }) => h("", e, `
|
|
2593
|
+
`) + c([t, c(n, " ")], " ")
|
|
2595
2594
|
},
|
|
2596
2595
|
InputObjectTypeDefinition: {
|
|
2597
|
-
leave: ({ description: e, name: t, directives: n, fields:
|
|
2598
|
-
`) +
|
|
2596
|
+
leave: ({ description: e, name: t, directives: n, fields: i }) => h("", e, `
|
|
2597
|
+
`) + c(["input", t, c(n, " "), S(i)], " ")
|
|
2599
2598
|
},
|
|
2600
2599
|
DirectiveDefinition: {
|
|
2601
|
-
leave: ({ description: e, name: t, arguments: n, repeatable:
|
|
2602
|
-
`) + "directive @" + t + (
|
|
2603
|
-
`,
|
|
2600
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => h("", e, `
|
|
2601
|
+
`) + "directive @" + t + (te(n) ? h(`(
|
|
2602
|
+
`, j(c(n, `
|
|
2604
2603
|
`)), `
|
|
2605
|
-
)`) :
|
|
2604
|
+
)`) : h("(", c(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + c(r, " | ")
|
|
2606
2605
|
},
|
|
2607
2606
|
SchemaExtension: {
|
|
2608
|
-
leave: ({ directives: e, operationTypes: t }) =>
|
|
2609
|
-
["extend schema",
|
|
2607
|
+
leave: ({ directives: e, operationTypes: t }) => c(
|
|
2608
|
+
["extend schema", c(e, " "), S(t)],
|
|
2610
2609
|
" "
|
|
2611
2610
|
)
|
|
2612
2611
|
},
|
|
2613
2612
|
ScalarTypeExtension: {
|
|
2614
|
-
leave: ({ name: e, directives: t }) =>
|
|
2613
|
+
leave: ({ name: e, directives: t }) => c(["extend scalar", e, c(t, " ")], " ")
|
|
2615
2614
|
},
|
|
2616
2615
|
ObjectTypeExtension: {
|
|
2617
|
-
leave: ({ name: e, interfaces: t, directives: n, fields:
|
|
2616
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => c(
|
|
2618
2617
|
[
|
|
2619
2618
|
"extend type",
|
|
2620
2619
|
e,
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
S(
|
|
2620
|
+
h("implements ", c(t, " & ")),
|
|
2621
|
+
c(n, " "),
|
|
2622
|
+
S(i)
|
|
2624
2623
|
],
|
|
2625
2624
|
" "
|
|
2626
2625
|
)
|
|
2627
2626
|
},
|
|
2628
2627
|
InterfaceTypeExtension: {
|
|
2629
|
-
leave: ({ name: e, interfaces: t, directives: n, fields:
|
|
2628
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => c(
|
|
2630
2629
|
[
|
|
2631
2630
|
"extend interface",
|
|
2632
2631
|
e,
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
S(
|
|
2632
|
+
h("implements ", c(t, " & ")),
|
|
2633
|
+
c(n, " "),
|
|
2634
|
+
S(i)
|
|
2636
2635
|
],
|
|
2637
2636
|
" "
|
|
2638
2637
|
)
|
|
2639
2638
|
},
|
|
2640
2639
|
UnionTypeExtension: {
|
|
2641
|
-
leave: ({ name: e, directives: t, types: n }) =>
|
|
2640
|
+
leave: ({ name: e, directives: t, types: n }) => c(
|
|
2642
2641
|
[
|
|
2643
2642
|
"extend union",
|
|
2644
2643
|
e,
|
|
2645
|
-
|
|
2646
|
-
|
|
2644
|
+
c(t, " "),
|
|
2645
|
+
h("= ", c(n, " | "))
|
|
2647
2646
|
],
|
|
2648
2647
|
" "
|
|
2649
2648
|
)
|
|
2650
2649
|
},
|
|
2651
2650
|
EnumTypeExtension: {
|
|
2652
|
-
leave: ({ name: e, directives: t, values: n }) =>
|
|
2651
|
+
leave: ({ name: e, directives: t, values: n }) => c(["extend enum", e, c(t, " "), S(n)], " ")
|
|
2653
2652
|
},
|
|
2654
2653
|
InputObjectTypeExtension: {
|
|
2655
|
-
leave: ({ name: e, directives: t, fields: n }) =>
|
|
2654
|
+
leave: ({ name: e, directives: t, fields: n }) => c(["extend input", e, c(t, " "), S(n)], " ")
|
|
2656
2655
|
},
|
|
2657
2656
|
// Schema Coordinates
|
|
2658
2657
|
TypeCoordinate: {
|
|
2659
2658
|
leave: ({ name: e }) => e
|
|
2660
2659
|
},
|
|
2661
2660
|
MemberCoordinate: {
|
|
2662
|
-
leave: ({ name: e, memberName: t }) =>
|
|
2661
|
+
leave: ({ name: e, memberName: t }) => c([e, h(".", t)])
|
|
2663
2662
|
},
|
|
2664
2663
|
ArgumentCoordinate: {
|
|
2665
|
-
leave: ({ name: e, fieldName: t, argumentName: n }) =>
|
|
2664
|
+
leave: ({ name: e, fieldName: t, argumentName: n }) => c([e, h(".", t), h("(", n, ":)")])
|
|
2666
2665
|
},
|
|
2667
2666
|
DirectiveCoordinate: {
|
|
2668
|
-
leave: ({ name: e }) =>
|
|
2667
|
+
leave: ({ name: e }) => c(["@", e])
|
|
2669
2668
|
},
|
|
2670
2669
|
DirectiveArgumentCoordinate: {
|
|
2671
|
-
leave: ({ name: e, argumentName: t }) =>
|
|
2670
|
+
leave: ({ name: e, argumentName: t }) => c(["@", e, h("(", t, ":)")])
|
|
2672
2671
|
}
|
|
2673
2672
|
};
|
|
2674
|
-
function
|
|
2673
|
+
function c(e, t = "") {
|
|
2675
2674
|
var n;
|
|
2676
|
-
return (n = e?.filter((
|
|
2675
|
+
return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
|
|
2677
2676
|
}
|
|
2678
2677
|
function S(e) {
|
|
2679
|
-
return
|
|
2680
|
-
`,
|
|
2678
|
+
return h(`{
|
|
2679
|
+
`, j(c(e, `
|
|
2681
2680
|
`)), `
|
|
2682
2681
|
}`);
|
|
2683
2682
|
}
|
|
2684
|
-
function
|
|
2683
|
+
function h(e, t, n = "") {
|
|
2685
2684
|
return t != null && t !== "" ? e + t + n : "";
|
|
2686
2685
|
}
|
|
2687
|
-
function
|
|
2688
|
-
return
|
|
2686
|
+
function j(e) {
|
|
2687
|
+
return h(" ", e.replace(/\n/g, `
|
|
2689
2688
|
`));
|
|
2690
2689
|
}
|
|
2691
|
-
function
|
|
2690
|
+
function te(e) {
|
|
2692
2691
|
var t;
|
|
2693
2692
|
return (t = e?.some((n) => n.includes(`
|
|
2694
2693
|
`))) !== null && t !== void 0 ? t : !1;
|
|
2695
2694
|
}
|
|
2696
|
-
var
|
|
2697
|
-
function
|
|
2695
|
+
var G = /* @__PURE__ */ new Map(), ae = /* @__PURE__ */ new Map(), $e = !0, J = !1;
|
|
2696
|
+
function Be(e) {
|
|
2698
2697
|
return e.replace(/[\s,]+/g, " ").trim();
|
|
2699
2698
|
}
|
|
2700
|
-
function
|
|
2701
|
-
return
|
|
2699
|
+
function St(e) {
|
|
2700
|
+
return Be(e.source.body.substring(e.start, e.end));
|
|
2702
2701
|
}
|
|
2703
|
-
function
|
|
2702
|
+
function Ct(e) {
|
|
2704
2703
|
var t = /* @__PURE__ */ new Set(), n = [];
|
|
2705
|
-
return e.definitions.forEach(function(
|
|
2706
|
-
if (
|
|
2707
|
-
var
|
|
2708
|
-
o && !o.has(s) ?
|
|
2704
|
+
return e.definitions.forEach(function(i) {
|
|
2705
|
+
if (i.kind === "FragmentDefinition") {
|
|
2706
|
+
var r = i.name.value, s = St(i.loc), o = ae.get(r);
|
|
2707
|
+
o && !o.has(s) ? $e && console.warn("Warning: fragment with name " + r + ` already exists.
|
|
2709
2708
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2710
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o ||
|
|
2709
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || ae.set(r, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(i));
|
|
2711
2710
|
} else
|
|
2712
|
-
n.push(
|
|
2713
|
-
}),
|
|
2711
|
+
n.push(i);
|
|
2712
|
+
}), Q(Q({}, e), { definitions: n });
|
|
2714
2713
|
}
|
|
2715
|
-
function
|
|
2714
|
+
function _t(e) {
|
|
2716
2715
|
var t = new Set(e.definitions);
|
|
2717
|
-
t.forEach(function(
|
|
2718
|
-
|
|
2719
|
-
var s = r
|
|
2716
|
+
t.forEach(function(i) {
|
|
2717
|
+
i.loc && delete i.loc, Object.keys(i).forEach(function(r) {
|
|
2718
|
+
var s = i[r];
|
|
2720
2719
|
s && typeof s == "object" && t.add(s);
|
|
2721
2720
|
});
|
|
2722
2721
|
});
|
|
2723
2722
|
var n = e.loc;
|
|
2724
2723
|
return n && (delete n.startToken, delete n.endToken), e;
|
|
2725
2724
|
}
|
|
2726
|
-
function
|
|
2727
|
-
var t =
|
|
2728
|
-
if (!
|
|
2729
|
-
var n =
|
|
2730
|
-
experimentalFragmentVariables:
|
|
2731
|
-
allowLegacyFragmentVariables:
|
|
2725
|
+
function Lt(e) {
|
|
2726
|
+
var t = Be(e);
|
|
2727
|
+
if (!G.has(t)) {
|
|
2728
|
+
var n = Et(e, {
|
|
2729
|
+
experimentalFragmentVariables: J,
|
|
2730
|
+
allowLegacyFragmentVariables: J
|
|
2732
2731
|
});
|
|
2733
2732
|
if (!n || n.kind !== "Document")
|
|
2734
2733
|
throw new Error("Not a valid GraphQL document.");
|
|
2735
|
-
|
|
2734
|
+
G.set(t, _t(Ct(n)));
|
|
2736
2735
|
}
|
|
2737
|
-
return
|
|
2736
|
+
return G.get(t);
|
|
2738
2737
|
}
|
|
2739
2738
|
function E(e) {
|
|
2740
2739
|
for (var t = [], n = 1; n < arguments.length; n++)
|
|
2741
2740
|
t[n - 1] = arguments[n];
|
|
2742
2741
|
typeof e == "string" && (e = [e]);
|
|
2743
|
-
var
|
|
2744
|
-
return t.forEach(function(
|
|
2745
|
-
|
|
2746
|
-
}),
|
|
2742
|
+
var i = e[0];
|
|
2743
|
+
return t.forEach(function(r, s) {
|
|
2744
|
+
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i += e[s + 1];
|
|
2745
|
+
}), Lt(i);
|
|
2747
2746
|
}
|
|
2748
|
-
function
|
|
2749
|
-
|
|
2747
|
+
function Rt() {
|
|
2748
|
+
G.clear(), ae.clear();
|
|
2750
2749
|
}
|
|
2751
|
-
function
|
|
2752
|
-
|
|
2750
|
+
function wt() {
|
|
2751
|
+
$e = !1;
|
|
2753
2752
|
}
|
|
2754
|
-
function
|
|
2755
|
-
|
|
2753
|
+
function Ft() {
|
|
2754
|
+
J = !0;
|
|
2756
2755
|
}
|
|
2757
|
-
function
|
|
2758
|
-
|
|
2756
|
+
function $t() {
|
|
2757
|
+
J = !1;
|
|
2759
2758
|
}
|
|
2760
|
-
var
|
|
2759
|
+
var B = {
|
|
2761
2760
|
gql: E,
|
|
2762
|
-
resetCaches:
|
|
2763
|
-
disableFragmentWarnings:
|
|
2764
|
-
enableExperimentalFragmentVariables:
|
|
2765
|
-
disableExperimentalFragmentVariables:
|
|
2761
|
+
resetCaches: Rt,
|
|
2762
|
+
disableFragmentWarnings: wt,
|
|
2763
|
+
enableExperimentalFragmentVariables: Ft,
|
|
2764
|
+
disableExperimentalFragmentVariables: $t
|
|
2766
2765
|
};
|
|
2767
2766
|
(function(e) {
|
|
2768
|
-
e.gql =
|
|
2767
|
+
e.gql = B.gql, e.resetCaches = B.resetCaches, e.disableFragmentWarnings = B.disableFragmentWarnings, e.enableExperimentalFragmentVariables = B.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = B.disableExperimentalFragmentVariables;
|
|
2769
2768
|
})(E || (E = {}));
|
|
2770
2769
|
E.default = E;
|
|
2771
|
-
const
|
|
2770
|
+
const Bt = E`
|
|
2772
2771
|
query findActiveOrderById($id: String) {
|
|
2773
2772
|
findOrder(id: $id) {
|
|
2774
2773
|
id
|
|
@@ -2855,7 +2854,7 @@ const Jt = E`
|
|
|
2855
2854
|
}
|
|
2856
2855
|
}
|
|
2857
2856
|
}
|
|
2858
|
-
`,
|
|
2857
|
+
`, Vt = E`
|
|
2859
2858
|
query findOrderById($id: String, $reference: String) {
|
|
2860
2859
|
findOrder(id: $id, reference: $reference) {
|
|
2861
2860
|
id
|
|
@@ -2886,7 +2885,7 @@ const Jt = E`
|
|
|
2886
2885
|
downloadCode
|
|
2887
2886
|
}
|
|
2888
2887
|
}
|
|
2889
|
-
`,
|
|
2888
|
+
`, Ut = E`
|
|
2890
2889
|
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2891
2890
|
reserveProduct(
|
|
2892
2891
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
@@ -2896,7 +2895,7 @@ const Jt = E`
|
|
|
2896
2895
|
amountReserved
|
|
2897
2896
|
}
|
|
2898
2897
|
}
|
|
2899
|
-
`,
|
|
2898
|
+
`, Mt = E`
|
|
2900
2899
|
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2901
2900
|
releaseProduct(
|
|
2902
2901
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
@@ -2905,7 +2904,7 @@ const Jt = E`
|
|
|
2905
2904
|
amountReleased
|
|
2906
2905
|
}
|
|
2907
2906
|
}
|
|
2908
|
-
`,
|
|
2907
|
+
`, qt = E`
|
|
2909
2908
|
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
|
|
2910
2909
|
configurePackage(
|
|
2911
2910
|
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
@@ -2915,7 +2914,7 @@ const Jt = E`
|
|
|
2915
2914
|
amountReserved
|
|
2916
2915
|
}
|
|
2917
2916
|
}
|
|
2918
|
-
`,
|
|
2917
|
+
`, zt = E`
|
|
2919
2918
|
mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
|
|
2920
2919
|
reserveAdditionalPackageItem(
|
|
2921
2920
|
input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
|
|
@@ -2925,655 +2924,284 @@ const Jt = E`
|
|
|
2925
2924
|
amountReserved
|
|
2926
2925
|
}
|
|
2927
2926
|
}
|
|
2928
|
-
`,
|
|
2927
|
+
`, jt = E`
|
|
2929
2928
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2930
2929
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2931
2930
|
}
|
|
2932
|
-
`,
|
|
2931
|
+
`, Gt = E`
|
|
2933
2932
|
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2934
2933
|
createOrderCustomer(
|
|
2935
2934
|
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2936
2935
|
)
|
|
2937
2936
|
}
|
|
2938
|
-
`,
|
|
2937
|
+
`, Ht = E`
|
|
2939
2938
|
mutation deleteOrder($orderId: ID!) {
|
|
2940
2939
|
cancelOrder(id: $orderId)
|
|
2941
2940
|
}
|
|
2942
|
-
`,
|
|
2943
|
-
function
|
|
2941
|
+
`, Yt = (e, t, n, i) => e();
|
|
2942
|
+
function Qt(e, t = Yt) {
|
|
2944
2943
|
return {
|
|
2945
|
-
findActiveOrderById(n,
|
|
2946
|
-
return t((s) => e.request({ document:
|
|
2944
|
+
findActiveOrderById(n, i, r) {
|
|
2945
|
+
return t((s) => e.request({ document: Bt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findActiveOrderById", "query", n);
|
|
2947
2946
|
},
|
|
2948
|
-
findOrderById(n,
|
|
2949
|
-
return t((s) => e.request({ document:
|
|
2947
|
+
findOrderById(n, i, r) {
|
|
2948
|
+
return t((s) => e.request({ document: Vt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findOrderById", "query", n);
|
|
2950
2949
|
},
|
|
2951
|
-
addToOrder(n,
|
|
2952
|
-
return t((s) => e.request({ document:
|
|
2950
|
+
addToOrder(n, i, r) {
|
|
2951
|
+
return t((s) => e.request({ document: Ut, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "addToOrder", "mutation", n);
|
|
2953
2952
|
},
|
|
2954
|
-
removeFromOrder(n,
|
|
2955
|
-
return t((s) => e.request({ document:
|
|
2953
|
+
removeFromOrder(n, i, r) {
|
|
2954
|
+
return t((s) => e.request({ document: Mt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "removeFromOrder", "mutation", n);
|
|
2956
2955
|
},
|
|
2957
|
-
configurePackage(n,
|
|
2958
|
-
return t((s) => e.request({ document:
|
|
2956
|
+
configurePackage(n, i, r) {
|
|
2957
|
+
return t((s) => e.request({ document: qt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configurePackage", "mutation", n);
|
|
2959
2958
|
},
|
|
2960
|
-
reserveAdditionalPackageItem(n,
|
|
2961
|
-
return t((s) => e.request({ document:
|
|
2959
|
+
reserveAdditionalPackageItem(n, i, r) {
|
|
2960
|
+
return t((s) => e.request({ document: zt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "reserveAdditionalPackageItem", "mutation", n);
|
|
2962
2961
|
},
|
|
2963
|
-
configureOrderDeliveryOption(n,
|
|
2964
|
-
return t((s) => e.request({ document:
|
|
2962
|
+
configureOrderDeliveryOption(n, i, r) {
|
|
2963
|
+
return t((s) => e.request({ document: jt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configureOrderDeliveryOption", "mutation", n);
|
|
2965
2964
|
},
|
|
2966
|
-
createOrderCustomer(n,
|
|
2967
|
-
return t((s) => e.request({ document:
|
|
2965
|
+
createOrderCustomer(n, i, r) {
|
|
2966
|
+
return t((s) => e.request({ document: Gt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createOrderCustomer", "mutation", n);
|
|
2968
2967
|
},
|
|
2969
|
-
deleteOrder(n,
|
|
2970
|
-
return t((s) => e.request({ document:
|
|
2968
|
+
deleteOrder(n, i, r) {
|
|
2969
|
+
return t((s) => e.request({ document: Ht, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "deleteOrder", "mutation", n);
|
|
2971
2970
|
}
|
|
2972
2971
|
};
|
|
2973
2972
|
}
|
|
2974
|
-
|
|
2975
|
-
order: null,
|
|
2976
|
-
processing: !1,
|
|
2977
|
-
error: null,
|
|
2978
|
-
// start uninitialized by default
|
|
2979
|
-
initialized: !1
|
|
2980
|
-
}, He = Je({
|
|
2981
|
-
name: "basket",
|
|
2982
|
-
initialState: Ie,
|
|
2983
|
-
reducers: {
|
|
2984
|
-
setInitialized: (e, t) => {
|
|
2985
|
-
e.initialized = t.payload;
|
|
2986
|
-
},
|
|
2987
|
-
setProcessing: (e, t) => {
|
|
2988
|
-
e.processing = t.payload;
|
|
2989
|
-
},
|
|
2990
|
-
setError: (e, t) => {
|
|
2991
|
-
e.error = t.payload;
|
|
2992
|
-
},
|
|
2993
|
-
setOrder: (e, t) => {
|
|
2994
|
-
e.order = t.payload;
|
|
2995
|
-
},
|
|
2996
|
-
initializeOrder: (e, t) => {
|
|
2997
|
-
e.order || (e.order = {
|
|
2998
|
-
id: t.payload.id,
|
|
2999
|
-
currency: t.payload.currency,
|
|
3000
|
-
items: [],
|
|
3001
|
-
expiredAt: t.payload.expiredAt
|
|
3002
|
-
});
|
|
3003
|
-
},
|
|
3004
|
-
addProduct: (e, t) => {
|
|
3005
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3006
|
-
if (!e.order)
|
|
3007
|
-
return;
|
|
3008
|
-
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);
|
|
3009
|
-
if (s >= 0)
|
|
3010
|
-
e.order.items[s].amount += r;
|
|
3011
|
-
else {
|
|
3012
|
-
const o = {
|
|
3013
|
-
id: n.id,
|
|
3014
|
-
type: "PRODUCT",
|
|
3015
|
-
name: n.name,
|
|
3016
|
-
amount: r,
|
|
3017
|
-
price: n.price,
|
|
3018
|
-
depositPrice: n.depositPrice,
|
|
3019
|
-
serviceFee: n.serviceFee,
|
|
3020
|
-
originalPrice: n.price,
|
|
3021
|
-
seats: n.seat ? [{ id: n.seat.id, label: n.seat.label }] : void 0
|
|
3022
|
-
};
|
|
3023
|
-
e.order.items.push(o);
|
|
3024
|
-
}
|
|
3025
|
-
e.order.expiredAt = i;
|
|
3026
|
-
},
|
|
3027
|
-
removeProduct: (e, t) => {
|
|
3028
|
-
if (!e.order) return;
|
|
3029
|
-
const { id: n, amountReleased: r, seatId: i } = t.payload, s = e.order.items.findIndex(
|
|
3030
|
-
(o) => o.type === "PRODUCT" && o.id === n
|
|
3031
|
-
);
|
|
3032
|
-
if (s !== -1) {
|
|
3033
|
-
const o = e.order.items[s];
|
|
3034
|
-
if (o.amount -= r, o.amount <= 0)
|
|
3035
|
-
e.order.items.splice(s, 1);
|
|
3036
|
-
else if (o.seats && i) {
|
|
3037
|
-
const u = o.seats.findIndex((h) => h.id === i);
|
|
3038
|
-
u !== -1 && o.seats.splice(u, 1);
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
e.order.items.length === 0 && (e.order = null);
|
|
3042
|
-
},
|
|
3043
|
-
configurePackage: (e, t) => {
|
|
3044
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3045
|
-
e.order || (e.order = {
|
|
3046
|
-
id: "",
|
|
3047
|
-
currency: n.currency,
|
|
3048
|
-
items: [],
|
|
3049
|
-
expiredAt: i
|
|
3050
|
-
});
|
|
3051
|
-
const s = e.order.items.find(
|
|
3052
|
-
(o) => o.type === "PACKAGE" && o.id === n.id
|
|
3053
|
-
);
|
|
3054
|
-
s ? (s.amount = r, s.packageItems = n.items) : e.order.items.push({
|
|
3055
|
-
id: n.id,
|
|
3056
|
-
type: "PACKAGE",
|
|
3057
|
-
name: n.name,
|
|
3058
|
-
amount: r,
|
|
3059
|
-
price: n.discountPrice ?? n.price,
|
|
3060
|
-
depositPrice: n.depositPrice,
|
|
3061
|
-
originalPrice: n.price,
|
|
3062
|
-
serviceFee: n.serviceFee,
|
|
3063
|
-
packageItems: n.items
|
|
3064
|
-
});
|
|
3065
|
-
},
|
|
3066
|
-
reserveAdditionalPackageItem: (e, t) => {
|
|
3067
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3068
|
-
e.order || (e.order = {
|
|
3069
|
-
id: "",
|
|
3070
|
-
currency: n.currency,
|
|
3071
|
-
items: [],
|
|
3072
|
-
expiredAt: i
|
|
3073
|
-
});
|
|
3074
|
-
const s = e.order.items.findIndex(
|
|
3075
|
-
(u) => u.id === n.packageItemId
|
|
3076
|
-
), o = e.order.items[s];
|
|
3077
|
-
o ? (o.amount = r, o.packageItems = [
|
|
3078
|
-
{
|
|
3079
|
-
packageItemId: n.packageItemId,
|
|
3080
|
-
eventId: n.eventId,
|
|
3081
|
-
name: n.name,
|
|
3082
|
-
startAt: n.startAt,
|
|
3083
|
-
endAt: n.endAt
|
|
3084
|
-
}
|
|
3085
|
-
], o.amount === 0 && e.order.items.splice(s, 1)) : e.order.items.push({
|
|
3086
|
-
id: n.packageItemId,
|
|
3087
|
-
type: _.ADD_ONS,
|
|
3088
|
-
name: n.name,
|
|
3089
|
-
amount: r,
|
|
3090
|
-
price: n.discountPrice ?? n.price,
|
|
3091
|
-
depositPrice: n.depositPrice,
|
|
3092
|
-
originalPrice: n.price,
|
|
3093
|
-
serviceFee: n.serviceFee,
|
|
3094
|
-
packageItems: [
|
|
3095
|
-
{
|
|
3096
|
-
packageItemId: n.packageItemId,
|
|
3097
|
-
eventId: n.eventId,
|
|
3098
|
-
name: n.name,
|
|
3099
|
-
startAt: n.startAt,
|
|
3100
|
-
endAt: n.endAt
|
|
3101
|
-
}
|
|
3102
|
-
]
|
|
3103
|
-
});
|
|
3104
|
-
},
|
|
3105
|
-
configureDelivery: (e, t) => {
|
|
3106
|
-
if (!e.order) return;
|
|
3107
|
-
const n = t.payload, r = e.order.items.findIndex(
|
|
3108
|
-
(i) => i.type === "DELIVERY"
|
|
3109
|
-
);
|
|
3110
|
-
if (n)
|
|
3111
|
-
if (r !== -1) {
|
|
3112
|
-
const i = e.order.items[r];
|
|
3113
|
-
i.id = n.id, i.name = n.name, i.price = n.price, i.serviceFee = n.serviceFee;
|
|
3114
|
-
} else
|
|
3115
|
-
e.order.items.push({
|
|
3116
|
-
id: n.id,
|
|
3117
|
-
type: "PRODUCT",
|
|
3118
|
-
name: n.name,
|
|
3119
|
-
amount: 1,
|
|
3120
|
-
price: n.price,
|
|
3121
|
-
originalPrice: n.price,
|
|
3122
|
-
serviceFee: n.serviceFee
|
|
3123
|
-
});
|
|
3124
|
-
else r !== -1 && e.order.items.splice(r, 1);
|
|
3125
|
-
},
|
|
3126
|
-
configureCustomer: (e, t) => {
|
|
3127
|
-
e.order && (e.order.customer = t.payload);
|
|
3128
|
-
},
|
|
3129
|
-
clearBasket: () => ({ ...Ie })
|
|
3130
|
-
}
|
|
3131
|
-
}), {
|
|
3132
|
-
setInitialized: Ee,
|
|
3133
|
-
setProcessing: C,
|
|
3134
|
-
initializeOrder: j,
|
|
3135
|
-
addProduct: ye,
|
|
3136
|
-
removeProduct: an,
|
|
3137
|
-
configurePackage: ve,
|
|
3138
|
-
configureDelivery: cn,
|
|
3139
|
-
configureCustomer: ke,
|
|
3140
|
-
reserveAdditionalPackageItem: dn,
|
|
3141
|
-
clearBasket: Ae
|
|
3142
|
-
} = He.actions;
|
|
3143
|
-
class un {
|
|
3144
|
-
orderIdKey = "ORDER_ID";
|
|
2973
|
+
class Jt {
|
|
3145
2974
|
config;
|
|
3146
2975
|
sdk;
|
|
3147
|
-
store;
|
|
3148
|
-
// Promise-based signal consumers can await to know initialization finished
|
|
3149
|
-
_resolveInitialized;
|
|
3150
|
-
initialized;
|
|
3151
2976
|
constructor(t) {
|
|
3152
|
-
this.config = t, this.
|
|
3153
|
-
reducer: {
|
|
3154
|
-
basket: He.reducer
|
|
3155
|
-
}
|
|
3156
|
-
}), this.initialized = new Promise((n) => {
|
|
3157
|
-
this._resolveInitialized = n;
|
|
3158
|
-
}), this.sdk = on(new de(t.apiUrl)), this.restoreOrderFromSession().then(() => {
|
|
3159
|
-
this.debugLog("Restore order from session"), this.store.dispatch(Ee(!0)), this._resolveInitialized?.();
|
|
3160
|
-
}).catch((n) => {
|
|
3161
|
-
this.debugLog("Restore order failed", n), this.store.dispatch(Ee(!0)), this._resolveInitialized?.();
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3164
|
-
// Convenience helper so consumers can `await basketService.waitUntilInitialized()`
|
|
3165
|
-
waitUntilInitialized() {
|
|
3166
|
-
return this.initialized;
|
|
3167
|
-
}
|
|
3168
|
-
// Store functions
|
|
3169
|
-
subscribe(t) {
|
|
3170
|
-
const n = this.store.subscribe(t);
|
|
3171
|
-
try {
|
|
3172
|
-
this.getState().initialized && setTimeout(() => t(), 0);
|
|
3173
|
-
} catch {
|
|
3174
|
-
}
|
|
3175
|
-
return n;
|
|
3176
|
-
}
|
|
3177
|
-
getProcessing() {
|
|
3178
|
-
return this.getState().processing;
|
|
3179
|
-
}
|
|
3180
|
-
getCurrentOrder() {
|
|
3181
|
-
const t = this.getState();
|
|
3182
|
-
if (!t.order)
|
|
3183
|
-
return null;
|
|
3184
|
-
const n = t.order.items.reduce((r, i) => r + (i.amount || 0), 0);
|
|
3185
|
-
return {
|
|
3186
|
-
...t.order,
|
|
3187
|
-
count: n
|
|
3188
|
-
};
|
|
3189
|
-
}
|
|
3190
|
-
getSelectedPackageEvent() {
|
|
3191
|
-
return this.getState().order?.items.flatMap((n) => n.packageItems?.map((r) => r.eventId) ?? []) ?? [];
|
|
2977
|
+
this.config = t, this.sdk = Qt(new oe(t.apiUrl));
|
|
3192
2978
|
}
|
|
3193
2979
|
// Basket update functions
|
|
3194
|
-
async addProduct(t) {
|
|
3195
|
-
this.store.dispatch(C(!0));
|
|
2980
|
+
async addProduct(t, n) {
|
|
3196
2981
|
try {
|
|
3197
|
-
const r = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3198
2982
|
this.debugLog("Adding product", {
|
|
3199
|
-
productId:
|
|
3200
|
-
orderId:
|
|
3201
|
-
amount:
|
|
3202
|
-
seat:
|
|
3203
|
-
})
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
additionalData: t.seat ? {
|
|
2983
|
+
productId: n.id,
|
|
2984
|
+
orderId: t,
|
|
2985
|
+
amount: n.amount,
|
|
2986
|
+
seat: n.seat
|
|
2987
|
+
}), await this.sdk.addToOrder({
|
|
2988
|
+
productId: n.id,
|
|
2989
|
+
orderId: t,
|
|
2990
|
+
additionalData: n.seat ? {
|
|
3208
2991
|
seat: {
|
|
3209
|
-
seatId:
|
|
3210
|
-
seatLabel:
|
|
3211
|
-
holdToken:
|
|
2992
|
+
seatId: n.seat.id,
|
|
2993
|
+
seatLabel: n.seat.label,
|
|
2994
|
+
holdToken: n.seat.holdToken
|
|
3212
2995
|
}
|
|
3213
2996
|
} : null,
|
|
3214
2997
|
trackerId: this.config.trackerId,
|
|
3215
2998
|
shopId: this.config.shopId,
|
|
3216
|
-
amount:
|
|
2999
|
+
amount: n.amount
|
|
3217
3000
|
});
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
this.debugLog("Product added successfully", i.reserveProduct), sessionStorage.setItem(this.orderIdKey, r), this.store.dispatch(
|
|
3221
|
-
j({
|
|
3222
|
-
id: s,
|
|
3223
|
-
currency: t.currency,
|
|
3224
|
-
expiredAt: o
|
|
3225
|
-
})
|
|
3226
|
-
), this.store.dispatch(
|
|
3227
|
-
ye({
|
|
3228
|
-
input: t,
|
|
3229
|
-
amountReserved: u,
|
|
3230
|
-
expiredAt: o
|
|
3231
|
-
})
|
|
3232
|
-
);
|
|
3233
|
-
}
|
|
3234
|
-
} catch (n) {
|
|
3235
|
-
throw this.debugLog("Error adding product", n), this.handleError(n), n;
|
|
3236
|
-
} finally {
|
|
3237
|
-
this.store.dispatch(C(!1));
|
|
3001
|
+
} catch (i) {
|
|
3002
|
+
throw this.debugLog("Error adding product", i), this.handleError(i), i;
|
|
3238
3003
|
}
|
|
3239
3004
|
}
|
|
3240
|
-
async removeProduct(t) {
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
amount: t.amount
|
|
3260
|
-
});
|
|
3261
|
-
if (i?.releaseProduct) {
|
|
3262
|
-
const { amountReleased: s } = i.releaseProduct;
|
|
3263
|
-
this.debugLog("Product removed successfully", i.releaseProduct), this.store.dispatch(
|
|
3264
|
-
an({
|
|
3265
|
-
id: t.id,
|
|
3266
|
-
amountReleased: s,
|
|
3267
|
-
seatId: t.seat?.id
|
|
3268
|
-
})
|
|
3269
|
-
);
|
|
3270
|
-
const o = this.getState();
|
|
3271
|
-
(!o.order || o.order.items.length === 0) && (this.debugLog("Basket is now empty, cancelling order and clearing session"), this.clearOrderFromSession());
|
|
3272
|
-
}
|
|
3273
|
-
} catch (i) {
|
|
3274
|
-
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
3275
|
-
} finally {
|
|
3276
|
-
this.store.dispatch(C(!1));
|
|
3277
|
-
}
|
|
3005
|
+
async removeProduct(t, n) {
|
|
3006
|
+
try {
|
|
3007
|
+
this.debugLog("Removing product", {
|
|
3008
|
+
productId: n.id,
|
|
3009
|
+
orderId: t,
|
|
3010
|
+
amount: n.amount
|
|
3011
|
+
}), await this.sdk.removeFromOrder({
|
|
3012
|
+
productId: n.id,
|
|
3013
|
+
orderId: t,
|
|
3014
|
+
additionalData: n.seat ? {
|
|
3015
|
+
seat: {
|
|
3016
|
+
seatId: n.seat.id,
|
|
3017
|
+
seatLabel: n.seat.label
|
|
3018
|
+
}
|
|
3019
|
+
} : null,
|
|
3020
|
+
amount: n.amount
|
|
3021
|
+
});
|
|
3022
|
+
} catch (i) {
|
|
3023
|
+
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
3278
3024
|
}
|
|
3279
3025
|
}
|
|
3280
|
-
async configurePackage(t) {
|
|
3281
|
-
this.store.dispatch(C(!0));
|
|
3026
|
+
async configurePackage(t, n) {
|
|
3282
3027
|
try {
|
|
3283
|
-
const
|
|
3284
|
-
packageItemId:
|
|
3285
|
-
eventId:
|
|
3028
|
+
const i = n.items.map((r) => ({
|
|
3029
|
+
packageItemId: r.packageItemId,
|
|
3030
|
+
eventId: r.eventId
|
|
3286
3031
|
}));
|
|
3287
3032
|
this.debugLog("Configuring package", {
|
|
3288
|
-
packageId:
|
|
3289
|
-
orderId:
|
|
3290
|
-
amount:
|
|
3033
|
+
packageId: n.id,
|
|
3034
|
+
orderId: t,
|
|
3035
|
+
amount: n.amount,
|
|
3291
3036
|
items: i,
|
|
3292
3037
|
shopId: this.config.shopId
|
|
3293
|
-
})
|
|
3294
|
-
const s = await this.sdk.configurePackage({
|
|
3038
|
+
}), await this.sdk.configurePackage({
|
|
3295
3039
|
trackerId: this.config.trackerId,
|
|
3296
3040
|
shopId: this.config.shopId,
|
|
3297
|
-
packageId:
|
|
3298
|
-
orderId:
|
|
3299
|
-
amount:
|
|
3041
|
+
packageId: n.id,
|
|
3042
|
+
orderId: t,
|
|
3043
|
+
amount: n.amount,
|
|
3300
3044
|
items: i
|
|
3301
|
-
});
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
return h === 0 && (this.debugLog("Basket is now empty, cancelling order and clearing session"), this.clearOrderFromSession()), this.debugLog("Package configured successfully"), sessionStorage.setItem(this.orderIdKey, r), this.store.dispatch(
|
|
3305
|
-
j({
|
|
3306
|
-
id: o,
|
|
3307
|
-
currency: t.currency,
|
|
3308
|
-
expiredAt: u
|
|
3309
|
-
})
|
|
3310
|
-
), this.store.dispatch(
|
|
3311
|
-
ve({
|
|
3312
|
-
input: t,
|
|
3313
|
-
amountReserved: h,
|
|
3314
|
-
expiredAt: u
|
|
3315
|
-
})
|
|
3316
|
-
), null;
|
|
3317
|
-
} else
|
|
3318
|
-
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3319
|
-
} catch (n) {
|
|
3320
|
-
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3321
|
-
} finally {
|
|
3322
|
-
this.store.dispatch(C(!1));
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
async configureDelivery(t) {
|
|
3326
|
-
this.store.dispatch(C(!0));
|
|
3327
|
-
try {
|
|
3328
|
-
this.store.dispatch(cn(t));
|
|
3329
|
-
} catch (n) {
|
|
3330
|
-
throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
|
|
3331
|
-
} finally {
|
|
3332
|
-
this.store.dispatch(C(!1));
|
|
3045
|
+
}), this.debugLog("Configure package response");
|
|
3046
|
+
} catch (i) {
|
|
3047
|
+
return this.debugLog("Error configuring package", i), this.handleError(i), { error: i };
|
|
3333
3048
|
}
|
|
3049
|
+
return null;
|
|
3334
3050
|
}
|
|
3335
|
-
async configureCustomer(t) {
|
|
3336
|
-
|
|
3337
|
-
if (!r)
|
|
3338
|
-
throw new Error("No active order. Add items to basket first.");
|
|
3339
|
-
this.debugLog("Creating/replacing customer", { orderId: r.id, email: t.email });
|
|
3051
|
+
async configureCustomer(t, n) {
|
|
3052
|
+
this.debugLog("Creating/replacing customer", { orderId: t, email: n.email });
|
|
3340
3053
|
try {
|
|
3341
3054
|
const i = await this.sdk.createOrderCustomer({
|
|
3342
|
-
orderId:
|
|
3343
|
-
customer:
|
|
3055
|
+
orderId: t,
|
|
3056
|
+
customer: n
|
|
3344
3057
|
});
|
|
3345
|
-
this.debugLog("Customer set successfully", i)
|
|
3058
|
+
this.debugLog("Customer set successfully", i);
|
|
3346
3059
|
} catch (i) {
|
|
3347
3060
|
throw this.debugLog("Failed to set customer", i), new Error(`Failed to set customer: ${i.message}`);
|
|
3348
3061
|
}
|
|
3349
3062
|
}
|
|
3350
|
-
async reserveAdditionalPackageItem(t) {
|
|
3351
|
-
this.store.dispatch(C(!0));
|
|
3063
|
+
async reserveAdditionalPackageItem(t, n) {
|
|
3352
3064
|
try {
|
|
3353
|
-
const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3354
3065
|
this.debugLog("reserve additional packageItem", {
|
|
3355
|
-
orderId:
|
|
3356
|
-
eventId:
|
|
3357
|
-
amount:
|
|
3358
|
-
packageId:
|
|
3359
|
-
packageItemId:
|
|
3360
|
-
})
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
const { orderId: s, expiredAt: o, amountReserved: u } = i.reserveAdditionalPackageItem;
|
|
3370
|
-
return this.debugLog("Reserve configured successfully"), sessionStorage.setItem(this.orderIdKey, r), this.store.dispatch(
|
|
3371
|
-
j({
|
|
3372
|
-
id: s,
|
|
3373
|
-
currency: t.currency,
|
|
3374
|
-
expiredAt: o
|
|
3375
|
-
})
|
|
3376
|
-
), this.store.dispatch(
|
|
3377
|
-
dn({
|
|
3378
|
-
input: t,
|
|
3379
|
-
amountReserved: u,
|
|
3380
|
-
expiredAt: o
|
|
3381
|
-
})
|
|
3382
|
-
), null;
|
|
3383
|
-
} else
|
|
3384
|
-
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3385
|
-
} catch (n) {
|
|
3386
|
-
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3387
|
-
} finally {
|
|
3388
|
-
this.store.dispatch(C(!1));
|
|
3066
|
+
orderId: t,
|
|
3067
|
+
eventId: n.eventId,
|
|
3068
|
+
amount: n.amount,
|
|
3069
|
+
packageId: n.packageId,
|
|
3070
|
+
packageItemId: n.packageItemId
|
|
3071
|
+
}), await this.sdk.reserveAdditionalPackageItem({
|
|
3072
|
+
orderId: t,
|
|
3073
|
+
eventId: n.eventId,
|
|
3074
|
+
amount: n.amount,
|
|
3075
|
+
packageId: n.packageId,
|
|
3076
|
+
packageItemId: n.packageItemId
|
|
3077
|
+
}), this.debugLog("reserve additional packageItem");
|
|
3078
|
+
} catch (i) {
|
|
3079
|
+
return this.debugLog("Error configuring package", i), this.handleError(i), { error: i };
|
|
3389
3080
|
}
|
|
3081
|
+
return null;
|
|
3390
3082
|
}
|
|
3391
3083
|
// Cancel and clear order functions
|
|
3392
|
-
async cancelOrder() {
|
|
3393
|
-
|
|
3394
|
-
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
|
|
3395
|
-
}
|
|
3396
|
-
clearOrderFromSession() {
|
|
3397
|
-
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(Ae());
|
|
3398
|
-
}
|
|
3399
|
-
// Private functions for fetching the current order from a session
|
|
3400
|
-
async restoreOrderFromSession() {
|
|
3401
|
-
const t = sessionStorage.getItem(this.orderIdKey);
|
|
3402
|
-
if (t) {
|
|
3403
|
-
this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
|
|
3404
|
-
try {
|
|
3405
|
-
await this.fetchOrder(t), this.debugLog("Order restored successfully"), this.store.dispatch(C(!1));
|
|
3406
|
-
} catch (n) {
|
|
3407
|
-
this.debugLog("Failed to restore order, clearing session", n), this.clearOrderFromSession();
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3084
|
+
async cancelOrder(t) {
|
|
3085
|
+
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.debugLog("Order cancelled successfully"));
|
|
3410
3086
|
}
|
|
3411
3087
|
async findOrder(t, n) {
|
|
3412
3088
|
try {
|
|
3413
|
-
return await this.sdk.findOrderById({ id: t, reference: n });
|
|
3414
|
-
} catch (
|
|
3415
|
-
return this.debugLog("Error finding order",
|
|
3089
|
+
return (await this.sdk.findOrderById({ id: t, reference: n })).findOrder ?? null;
|
|
3090
|
+
} catch (i) {
|
|
3091
|
+
return this.debugLog("Error finding order", i), this.handleError(i), null;
|
|
3416
3092
|
}
|
|
3417
3093
|
}
|
|
3418
|
-
async
|
|
3094
|
+
async findActiveOrder(t) {
|
|
3419
3095
|
this.debugLog("Fetching order from server", { orderId: t });
|
|
3420
3096
|
try {
|
|
3421
3097
|
const n = await this.sdk.findActiveOrderById({ id: t });
|
|
3422
|
-
if (!n?.findOrder)
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
const r =
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
id: m.id,
|
|
3443
|
-
label: m.label
|
|
3098
|
+
if (!n?.findOrder)
|
|
3099
|
+
return null;
|
|
3100
|
+
const i = n.findOrder;
|
|
3101
|
+
this.debugLog("Order fetched successfully", i);
|
|
3102
|
+
const r = i.items, s = r.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
3103
|
+
let m = _.PRODUCT;
|
|
3104
|
+
return d.product.type === "PROMOTER" ? m = _.ADD_ONS : d.product.type === "PICKUP" ? m = _.PICKUP : d.product.type === "DELIVERY" && (m = _.DELIVERY), {
|
|
3105
|
+
id: d.product.id,
|
|
3106
|
+
type: m,
|
|
3107
|
+
name: d.product.name,
|
|
3108
|
+
icon: d.product.icon,
|
|
3109
|
+
description: d.product.description,
|
|
3110
|
+
amount: d.amount,
|
|
3111
|
+
price: d.price ?? 0,
|
|
3112
|
+
depositPrice: d.depositPrice ?? 0,
|
|
3113
|
+
originalPrice: d.originalPrice ?? 0,
|
|
3114
|
+
serviceFee: d.serviceFee ?? 0,
|
|
3115
|
+
seats: d.seats?.map((y) => ({
|
|
3116
|
+
id: y.seatsIoId,
|
|
3117
|
+
label: y.label
|
|
3444
3118
|
}))
|
|
3445
3119
|
};
|
|
3446
|
-
}), o =
|
|
3120
|
+
}), o = r.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, m) => {
|
|
3447
3121
|
const {
|
|
3448
|
-
packageItem:
|
|
3449
|
-
event:
|
|
3450
|
-
amount:
|
|
3451
|
-
price:
|
|
3452
|
-
serviceFee:
|
|
3453
|
-
depositPrice:
|
|
3454
|
-
originalPrice:
|
|
3455
|
-
} =
|
|
3456
|
-
|
|
3122
|
+
packageItem: y,
|
|
3123
|
+
event: I,
|
|
3124
|
+
amount: D,
|
|
3125
|
+
price: N,
|
|
3126
|
+
serviceFee: k,
|
|
3127
|
+
depositPrice: C,
|
|
3128
|
+
originalPrice: x
|
|
3129
|
+
} = m, A = y.package.id;
|
|
3130
|
+
d[A] ? (d[A].price += N ?? 0, d[A].serviceFee += k ?? 0, d[A].originalPrice += x ?? 0, d[A].depositPrice += C ?? N ?? 0) : d[A] = {
|
|
3457
3131
|
id: A,
|
|
3458
3132
|
type: _.PACKAGE,
|
|
3459
|
-
name:
|
|
3460
|
-
amount:
|
|
3461
|
-
price:
|
|
3462
|
-
serviceFee:
|
|
3463
|
-
depositPrice:
|
|
3464
|
-
originalPrice:
|
|
3133
|
+
name: y.package.name,
|
|
3134
|
+
amount: D,
|
|
3135
|
+
price: N ?? 0,
|
|
3136
|
+
serviceFee: k ?? 0,
|
|
3137
|
+
depositPrice: C ?? N ?? 0,
|
|
3138
|
+
originalPrice: x ?? 0,
|
|
3465
3139
|
packageItems: []
|
|
3466
3140
|
};
|
|
3467
|
-
const
|
|
3468
|
-
zone:
|
|
3469
|
-
}),
|
|
3470
|
-
zone:
|
|
3141
|
+
const O = L.fromISO(I.startAt, {
|
|
3142
|
+
zone: I.timezone
|
|
3143
|
+
}), b = L.fromISO(I.endAt, {
|
|
3144
|
+
zone: I.timezone
|
|
3471
3145
|
});
|
|
3472
|
-
return
|
|
3473
|
-
packageItemId:
|
|
3474
|
-
eventId:
|
|
3475
|
-
name:
|
|
3476
|
-
startAt:
|
|
3477
|
-
endAt:
|
|
3478
|
-
}),
|
|
3479
|
-
}, {}),
|
|
3146
|
+
return d[A].packageItems.push({
|
|
3147
|
+
packageItemId: y.id,
|
|
3148
|
+
eventId: I.id,
|
|
3149
|
+
name: I.name,
|
|
3150
|
+
startAt: O.toJSDate().toISOString(),
|
|
3151
|
+
endAt: b.toJSDate().toISOString()
|
|
3152
|
+
}), d;
|
|
3153
|
+
}, {}), l = [
|
|
3480
3154
|
...s,
|
|
3481
3155
|
...Object.values(o)
|
|
3482
3156
|
];
|
|
3483
|
-
if (
|
|
3484
|
-
this.debugLog("All order items have zero or negative amounts, clearing session"),
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
currency: r.currency,
|
|
3506
|
-
price: c.originalPrice ?? 0,
|
|
3507
|
-
depositPrice: c.depositPrice,
|
|
3508
|
-
discountPrice: (c.price ?? 0) < (c.originalPrice ?? 0) ? c.price : void 0,
|
|
3509
|
-
serviceFee: c.serviceFee ?? 0,
|
|
3510
|
-
amount: c.amount,
|
|
3511
|
-
items: c.packageItems || []
|
|
3512
|
-
},
|
|
3513
|
-
amountReserved: c.amount,
|
|
3514
|
-
expiredAt: p.toJSDate().toISOString()
|
|
3515
|
-
})
|
|
3516
|
-
) : this.store.dispatch(
|
|
3517
|
-
ye({
|
|
3518
|
-
input: {
|
|
3519
|
-
id: c.id,
|
|
3520
|
-
name: c.name,
|
|
3521
|
-
price: c.originalPrice ?? 0,
|
|
3522
|
-
depositPrice: c.depositPrice,
|
|
3523
|
-
discountPrice: (c.price ?? 0) < (c.originalPrice ?? 0) ? c.price : void 0,
|
|
3524
|
-
serviceFee: c.serviceFee,
|
|
3525
|
-
currency: r.currency,
|
|
3526
|
-
amount: c.amount
|
|
3527
|
-
},
|
|
3528
|
-
amountReserved: c.amount,
|
|
3529
|
-
expiredAt: p.toJSDate().toISOString()
|
|
3530
|
-
})
|
|
3531
|
-
);
|
|
3532
|
-
}), r.mainBooker && (this.debugLog("Order has customer (mainBooker)", r.mainBooker), this.store.dispatch(
|
|
3533
|
-
ke({
|
|
3534
|
-
firstName: r.mainBooker.firstName ?? void 0,
|
|
3535
|
-
lastName: r.mainBooker.lastName ?? void 0,
|
|
3536
|
-
email: r.mainBooker.email ?? void 0,
|
|
3537
|
-
age: r.mainBooker.age ?? void 0,
|
|
3538
|
-
gender: r.mainBooker.gender ?? void 0,
|
|
3539
|
-
residence: r.mainBooker.residence ?? void 0,
|
|
3540
|
-
extraInfo: r.mainBooker.extraInfo ?? void 0
|
|
3541
|
-
})
|
|
3542
|
-
)), this.debugLog("Order state fully synced", this.getState());
|
|
3157
|
+
if (l.length === 0)
|
|
3158
|
+
return this.debugLog("All order items have zero or negative amounts, clearing session"), null;
|
|
3159
|
+
const f = r.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime());
|
|
3160
|
+
if (f.length === 0)
|
|
3161
|
+
return this.debugLog("No valid items with expiration times, clearing session"), null;
|
|
3162
|
+
const p = L.fromMillis(Math.min(...f)), g = l.reduce((d, m) => d + (m.amount || 0), 0);
|
|
3163
|
+
return {
|
|
3164
|
+
id: i.id,
|
|
3165
|
+
currency: i.currency,
|
|
3166
|
+
expiredAt: p.toJSDate().toISOString(),
|
|
3167
|
+
items: l,
|
|
3168
|
+
customer: i.mainBooker ? {
|
|
3169
|
+
firstName: i.mainBooker.firstName ?? void 0,
|
|
3170
|
+
lastName: i.mainBooker.lastName ?? void 0,
|
|
3171
|
+
email: i.mainBooker.email ?? void 0,
|
|
3172
|
+
age: i.mainBooker.age ?? void 0,
|
|
3173
|
+
gender: i.mainBooker.gender ?? void 0,
|
|
3174
|
+
residence: i.mainBooker.residence ?? void 0,
|
|
3175
|
+
extraInfo: i.mainBooker.extraInfo ?? void 0
|
|
3176
|
+
} : null,
|
|
3177
|
+
count: g
|
|
3178
|
+
};
|
|
3543
3179
|
} catch (n) {
|
|
3544
3180
|
throw this.debugLog("Error fetching order", n), n;
|
|
3545
3181
|
}
|
|
3546
3182
|
}
|
|
3547
|
-
// Private helper functions
|
|
3548
|
-
generateOrderId() {
|
|
3549
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
3550
|
-
const n = Math.random() * 16 | 0;
|
|
3551
|
-
return (t === "x" ? n : n & 3 | 8).toString(16);
|
|
3552
|
-
});
|
|
3553
|
-
}
|
|
3554
3183
|
debugLog(t, n) {
|
|
3555
3184
|
this.config.debug && console.log(`[BasketService] ${t}`, n || "");
|
|
3556
3185
|
}
|
|
3557
3186
|
handleError(t) {
|
|
3558
3187
|
const n = t;
|
|
3559
3188
|
if (n.graphQLErrors && n.graphQLErrors.length > 0) {
|
|
3560
|
-
const
|
|
3561
|
-
|
|
3189
|
+
const i = n.graphQLErrors[0];
|
|
3190
|
+
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
3562
3191
|
}
|
|
3563
3192
|
if (n.response?.errors && n.response.errors.length > 0) {
|
|
3564
|
-
const
|
|
3565
|
-
console.error("GraphQL Error:",
|
|
3193
|
+
const i = n.response.errors[0];
|
|
3194
|
+
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
3566
3195
|
}
|
|
3567
3196
|
}
|
|
3568
|
-
getState() {
|
|
3569
|
-
return this.store.getState().basket;
|
|
3570
|
-
}
|
|
3571
3197
|
}
|
|
3572
|
-
const
|
|
3573
|
-
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
|
|
3198
|
+
const Xt = E`
|
|
3199
|
+
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $locationIds: [String!], $excludedEventIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
|
|
3574
3200
|
findAllPublicEventByOrganizationId(
|
|
3575
3201
|
id: $organizationId
|
|
3576
3202
|
hostingIds: $hostingIds
|
|
3203
|
+
locationIds: $locationIds
|
|
3204
|
+
excludedEventIds: $excludedEventIds
|
|
3577
3205
|
trackerLinkId: $trackerId
|
|
3578
3206
|
filterEventStatuses: $filterEventStatuses
|
|
3579
3207
|
date: $dateRange
|
|
@@ -3601,13 +3229,18 @@ const ln = E`
|
|
|
3601
3229
|
name
|
|
3602
3230
|
address
|
|
3603
3231
|
}
|
|
3232
|
+
hosting {
|
|
3233
|
+
id
|
|
3234
|
+
name
|
|
3235
|
+
}
|
|
3604
3236
|
infoDescription
|
|
3605
3237
|
startingPrice
|
|
3238
|
+
totalViews
|
|
3606
3239
|
}
|
|
3607
3240
|
count
|
|
3608
3241
|
}
|
|
3609
3242
|
}
|
|
3610
|
-
`,
|
|
3243
|
+
`, Wt = E`
|
|
3611
3244
|
query EventDetailPage($eventId: ID!) {
|
|
3612
3245
|
findPublicEventById(id: $eventId) {
|
|
3613
3246
|
id
|
|
@@ -3629,12 +3262,17 @@ const ln = E`
|
|
|
3629
3262
|
name
|
|
3630
3263
|
address
|
|
3631
3264
|
}
|
|
3265
|
+
hosting {
|
|
3266
|
+
id
|
|
3267
|
+
name
|
|
3268
|
+
}
|
|
3632
3269
|
infoDescription
|
|
3633
3270
|
maxAmountOfTicketsPerOrder
|
|
3634
3271
|
startingPrice
|
|
3272
|
+
totalViews
|
|
3635
3273
|
}
|
|
3636
3274
|
}
|
|
3637
|
-
`,
|
|
3275
|
+
`, Zt = E`
|
|
3638
3276
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
3639
3277
|
findPublicProductsByEventId(
|
|
3640
3278
|
eventId: $eventId
|
|
@@ -3668,30 +3306,30 @@ const ln = E`
|
|
|
3668
3306
|
showEndSalesAtTag
|
|
3669
3307
|
}
|
|
3670
3308
|
}
|
|
3671
|
-
`,
|
|
3672
|
-
function
|
|
3309
|
+
`, Kt = (e, t, n, i) => e();
|
|
3310
|
+
function en(e, t = Kt) {
|
|
3673
3311
|
return {
|
|
3674
|
-
EventOverviewPage(n,
|
|
3675
|
-
return t((s) => e.request({ document:
|
|
3312
|
+
EventOverviewPage(n, i, r) {
|
|
3313
|
+
return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", n);
|
|
3676
3314
|
},
|
|
3677
|
-
EventDetailPage(n,
|
|
3678
|
-
return t((s) => e.request({ document:
|
|
3315
|
+
EventDetailPage(n, i, r) {
|
|
3316
|
+
return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", n);
|
|
3679
3317
|
},
|
|
3680
|
-
findProductsByEventId(n,
|
|
3681
|
-
return t((s) => e.request({ document:
|
|
3318
|
+
findProductsByEventId(n, i, r) {
|
|
3319
|
+
return t((s) => e.request({ document: Zt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findProductsByEventId", "query", n);
|
|
3682
3320
|
}
|
|
3683
3321
|
};
|
|
3684
3322
|
}
|
|
3685
|
-
function
|
|
3323
|
+
function tn(e) {
|
|
3686
3324
|
const t = /(query|mutation|subscription)\s+(\w+)/.exec(e);
|
|
3687
3325
|
if (!t) return { type: "unknown" };
|
|
3688
|
-
const n = t[1],
|
|
3689
|
-
return { type: n, name:
|
|
3326
|
+
const n = t[1], i = t[2];
|
|
3327
|
+
return { type: n, name: i };
|
|
3690
3328
|
}
|
|
3691
|
-
async function
|
|
3329
|
+
async function nn(e) {
|
|
3692
3330
|
if (typeof globalThis < "u" && globalThis.crypto?.subtle) {
|
|
3693
|
-
const n = new TextEncoder().encode(e),
|
|
3694
|
-
return Array.from(new Uint8Array(
|
|
3331
|
+
const n = new TextEncoder().encode(e), i = await globalThis.crypto.subtle.digest("SHA-256", n);
|
|
3332
|
+
return Array.from(new Uint8Array(i)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
3695
3333
|
}
|
|
3696
3334
|
try {
|
|
3697
3335
|
const { createHash: t } = await import("./__vite-browser-external-l0sNRNKZ.js");
|
|
@@ -3700,82 +3338,82 @@ async function In(e) {
|
|
|
3700
3338
|
throw new Error("SHA-256 is not available in this environment");
|
|
3701
3339
|
}
|
|
3702
3340
|
}
|
|
3703
|
-
function
|
|
3341
|
+
function rn(e) {
|
|
3704
3342
|
const t = { "content-type": "application/json" };
|
|
3705
3343
|
if (e)
|
|
3706
|
-
for (const [n,
|
|
3707
|
-
typeof
|
|
3344
|
+
for (const [n, i] of Object.entries(e))
|
|
3345
|
+
typeof i < "u" && (t[n] = String(i));
|
|
3708
3346
|
return t;
|
|
3709
3347
|
}
|
|
3710
|
-
function
|
|
3348
|
+
function me(e, t) {
|
|
3711
3349
|
return e?.length ? e.some((n) => t.includes(n?.extensions?.code) || t.includes(n?.message)) : !1;
|
|
3712
3350
|
}
|
|
3713
|
-
function
|
|
3351
|
+
function ge(e, t, n, i, r) {
|
|
3714
3352
|
const s = new Error(e);
|
|
3715
|
-
return s.response = { data:
|
|
3353
|
+
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;
|
|
3716
3354
|
}
|
|
3717
|
-
function
|
|
3718
|
-
if (
|
|
3719
|
-
throw
|
|
3720
|
-
if (typeof
|
|
3721
|
-
throw
|
|
3722
|
-
return
|
|
3355
|
+
function ne(e, t, n, i, r) {
|
|
3356
|
+
if (r.json?.errors?.length)
|
|
3357
|
+
throw ge(`GraphQL request failed${e ? ` (${e})` : ""}`, t, n, i, r);
|
|
3358
|
+
if (typeof r.json?.data > "u")
|
|
3359
|
+
throw ge("GraphQL request failed: no data received", t, n, i, r);
|
|
3360
|
+
return r.json.data;
|
|
3723
3361
|
}
|
|
3724
|
-
class
|
|
3362
|
+
class Z extends oe {
|
|
3725
3363
|
async request(t, ...n) {
|
|
3726
|
-
let
|
|
3727
|
-
t && typeof t == "object" && "document" in t ? (
|
|
3728
|
-
const
|
|
3729
|
-
const
|
|
3730
|
-
let
|
|
3364
|
+
let i = t, r, s, o;
|
|
3365
|
+
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]);
|
|
3366
|
+
const l = typeof i == "string" ? i : bt(i), { type: f, name: p } = tn(l), g = await nn(l), d = r ?? {}, m = this.url ?? this.endpoint ?? "", y = rn(s), I = async (O) => {
|
|
3367
|
+
const b = await fetch(m, { method: "POST", headers: y, body: JSON.stringify(O), signal: o });
|
|
3368
|
+
let P = null;
|
|
3731
3369
|
try {
|
|
3732
|
-
|
|
3370
|
+
P = await b.json();
|
|
3733
3371
|
} catch {
|
|
3734
|
-
|
|
3372
|
+
P = null;
|
|
3735
3373
|
}
|
|
3736
|
-
return { status:
|
|
3737
|
-
},
|
|
3738
|
-
const
|
|
3739
|
-
for (const [
|
|
3740
|
-
typeof
|
|
3741
|
-
const
|
|
3742
|
-
let
|
|
3374
|
+
return { status: b.status, json: P };
|
|
3375
|
+
}, D = async (O) => {
|
|
3376
|
+
const b = new URLSearchParams();
|
|
3377
|
+
for (const [Ve, M] of Object.entries(O))
|
|
3378
|
+
typeof M > "u" || b.set(Ve, typeof M == "string" ? M : JSON.stringify(M));
|
|
3379
|
+
const P = m.includes("?") ? "&" : "?", $ = `${m}${P}${b.toString()}`, ue = await fetch($, { method: "GET", headers: y, signal: o });
|
|
3380
|
+
let K = null;
|
|
3743
3381
|
try {
|
|
3744
|
-
|
|
3382
|
+
K = await ue.json();
|
|
3745
3383
|
} catch {
|
|
3746
|
-
|
|
3384
|
+
K = null;
|
|
3747
3385
|
}
|
|
3748
|
-
return { status:
|
|
3749
|
-
},
|
|
3386
|
+
return { status: ue.status, json: K };
|
|
3387
|
+
}, N = {
|
|
3750
3388
|
operationName: p,
|
|
3751
|
-
variables:
|
|
3752
|
-
extensions: { persistedQuery: { version: 1, sha256Hash:
|
|
3753
|
-
},
|
|
3754
|
-
if (
|
|
3755
|
-
const
|
|
3756
|
-
return
|
|
3389
|
+
variables: d,
|
|
3390
|
+
extensions: { persistedQuery: { version: 1, sha256Hash: g } }
|
|
3391
|
+
}, k = async (O, b, P) => {
|
|
3392
|
+
if (me(O.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
|
|
3393
|
+
const $ = await b();
|
|
3394
|
+
return ne("APQ register", l, d, p, $);
|
|
3757
3395
|
}
|
|
3758
|
-
if (
|
|
3759
|
-
const
|
|
3760
|
-
return
|
|
3396
|
+
if (me(O.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
|
|
3397
|
+
const $ = await P();
|
|
3398
|
+
return ne("no APQ support", l, d, p, $);
|
|
3761
3399
|
}
|
|
3762
|
-
return
|
|
3400
|
+
return ne("", l, d, p, O);
|
|
3763
3401
|
};
|
|
3764
|
-
if (
|
|
3765
|
-
const
|
|
3766
|
-
return
|
|
3402
|
+
if (f === "query") {
|
|
3403
|
+
const O = await D(N);
|
|
3404
|
+
return k(O, () => I({ ...N, query: l }), () => I({ operationName: p, variables: d, query: l }));
|
|
3767
3405
|
}
|
|
3768
|
-
const
|
|
3769
|
-
return
|
|
3406
|
+
const C = await I(N);
|
|
3407
|
+
return k(C, () => I({ ...N, query: l }), () => I({ operationName: p, variables: d, query: l }));
|
|
3770
3408
|
}
|
|
3771
3409
|
}
|
|
3772
|
-
class
|
|
3410
|
+
class sn {
|
|
3773
3411
|
config;
|
|
3774
3412
|
sdk;
|
|
3775
3413
|
constructor(t) {
|
|
3776
|
-
this.config = t, this.sdk =
|
|
3414
|
+
this.config = t, this.sdk = en(new Z(t.apiUrl));
|
|
3777
3415
|
}
|
|
3778
|
-
async
|
|
3416
|
+
async getEvents(t = {}) {
|
|
3779
3417
|
try {
|
|
3780
3418
|
t.page && (t.page = {
|
|
3781
3419
|
index: t.page.index ?? 0,
|
|
@@ -3792,6 +3430,8 @@ class yn {
|
|
|
3792
3430
|
const n = await this.sdk.EventOverviewPage({
|
|
3793
3431
|
organizationId: this.config.organizationId,
|
|
3794
3432
|
hostingIds: t.hostingIds,
|
|
3433
|
+
locationIds: t.locationIds,
|
|
3434
|
+
excludedEventIds: t.excludedEventIds,
|
|
3795
3435
|
filterEventStatuses: t.statuses,
|
|
3796
3436
|
dateRange: t.dateRange && t.dateRange.from && t.dateRange.till ? {
|
|
3797
3437
|
from: t.dateRange.from.toISO(),
|
|
@@ -3804,65 +3444,75 @@ class yn {
|
|
|
3804
3444
|
priceRange: t.priceRange
|
|
3805
3445
|
});
|
|
3806
3446
|
if (this.debugLog("Raw GraphQL response", n), n?.findAllPublicEventByOrganizationId?.data) {
|
|
3807
|
-
const
|
|
3808
|
-
id:
|
|
3809
|
-
name:
|
|
3810
|
-
icon:
|
|
3811
|
-
banner:
|
|
3812
|
-
description:
|
|
3813
|
-
addonDescription:
|
|
3814
|
-
startAt:
|
|
3815
|
-
endAt:
|
|
3816
|
-
timezone:
|
|
3447
|
+
const i = n.findAllPublicEventByOrganizationId.data.map((r) => ({
|
|
3448
|
+
id: r.id,
|
|
3449
|
+
name: r.name,
|
|
3450
|
+
icon: r.icon,
|
|
3451
|
+
banner: r.banner,
|
|
3452
|
+
description: r.description,
|
|
3453
|
+
addonDescription: r.addonDescription,
|
|
3454
|
+
startAt: L.fromISO(r.startAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
3455
|
+
endAt: L.fromISO(r.endAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
3456
|
+
timezone: r.timezone,
|
|
3817
3457
|
startSalesAt: null,
|
|
3818
3458
|
endSalesAt: null,
|
|
3819
|
-
slug:
|
|
3459
|
+
slug: r.slug ?? "ERROR",
|
|
3820
3460
|
facebookPixelId: null,
|
|
3821
|
-
status:
|
|
3822
|
-
location:
|
|
3823
|
-
id:
|
|
3824
|
-
name:
|
|
3825
|
-
address:
|
|
3461
|
+
status: r.status,
|
|
3462
|
+
location: r.location ? {
|
|
3463
|
+
id: r.location.id,
|
|
3464
|
+
name: r.location.name,
|
|
3465
|
+
address: r.location.address
|
|
3826
3466
|
} : void 0,
|
|
3827
|
-
|
|
3828
|
-
|
|
3467
|
+
hosting: r.hosting ? {
|
|
3468
|
+
id: r.hosting.id,
|
|
3469
|
+
name: r.hosting.name
|
|
3470
|
+
} : void 0,
|
|
3471
|
+
infoDescription: r.infoDescription,
|
|
3472
|
+
startingPrice: r.startingPrice,
|
|
3473
|
+
totalViews: r.totalViews
|
|
3829
3474
|
}));
|
|
3830
|
-
return this.debugLog("Processed events", { events:
|
|
3475
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, n.findAllPublicEventByOrganizationId.count ?? 0];
|
|
3831
3476
|
} else
|
|
3832
3477
|
return this.debugLog("No events found in response"), [[], 0];
|
|
3833
3478
|
} catch (n) {
|
|
3834
3479
|
throw this.debugLog("Error fetching events", n), n;
|
|
3835
3480
|
}
|
|
3836
3481
|
}
|
|
3837
|
-
async
|
|
3482
|
+
async getEvent(t) {
|
|
3838
3483
|
try {
|
|
3839
3484
|
this.debugLog("Fetching single event", { eventId: t });
|
|
3840
3485
|
const n = await this.sdk.EventDetailPage({ eventId: t });
|
|
3841
3486
|
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
3842
|
-
const
|
|
3843
|
-
id:
|
|
3844
|
-
name:
|
|
3845
|
-
icon:
|
|
3846
|
-
banner:
|
|
3847
|
-
description:
|
|
3848
|
-
addonDescription:
|
|
3849
|
-
startAt:
|
|
3850
|
-
endAt:
|
|
3851
|
-
timezone:
|
|
3852
|
-
startSalesAt:
|
|
3853
|
-
endSalesAt:
|
|
3854
|
-
slug:
|
|
3855
|
-
facebookPixelId:
|
|
3856
|
-
status:
|
|
3857
|
-
location:
|
|
3858
|
-
id:
|
|
3859
|
-
name:
|
|
3860
|
-
address:
|
|
3487
|
+
const i = n.findPublicEventById, r = {
|
|
3488
|
+
id: i.id,
|
|
3489
|
+
name: i.name,
|
|
3490
|
+
icon: i.icon,
|
|
3491
|
+
banner: i.banner,
|
|
3492
|
+
description: i.description,
|
|
3493
|
+
addonDescription: i.addonDescription,
|
|
3494
|
+
startAt: L.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3495
|
+
endAt: L.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3496
|
+
timezone: i.timezone,
|
|
3497
|
+
startSalesAt: i.startSalesAt,
|
|
3498
|
+
endSalesAt: i.endSalesAt,
|
|
3499
|
+
slug: i.slug ?? "ERROR",
|
|
3500
|
+
facebookPixelId: i.facebookPixelId,
|
|
3501
|
+
status: i.status,
|
|
3502
|
+
location: i.location ? {
|
|
3503
|
+
id: i.location.id,
|
|
3504
|
+
name: i.location.name,
|
|
3505
|
+
address: i.location.address
|
|
3861
3506
|
} : void 0,
|
|
3862
|
-
|
|
3863
|
-
|
|
3507
|
+
hosting: i.hosting ? {
|
|
3508
|
+
id: i.hosting.id,
|
|
3509
|
+
name: i.hosting.name
|
|
3510
|
+
} : void 0,
|
|
3511
|
+
infoDescription: i.infoDescription,
|
|
3512
|
+
startingPrice: i.startingPrice,
|
|
3513
|
+
totalViews: i.totalViews
|
|
3864
3514
|
};
|
|
3865
|
-
return this.debugLog("Processed single event",
|
|
3515
|
+
return this.debugLog("Processed single event", r), r;
|
|
3866
3516
|
} else {
|
|
3867
3517
|
this.debugLog("No event found for id", t);
|
|
3868
3518
|
return;
|
|
@@ -3871,22 +3521,22 @@ class yn {
|
|
|
3871
3521
|
throw this.debugLog("Error fetching single event", n), n;
|
|
3872
3522
|
}
|
|
3873
3523
|
}
|
|
3874
|
-
async
|
|
3524
|
+
async getProducts(t, n, i) {
|
|
3875
3525
|
try {
|
|
3876
3526
|
this.debugLog("Fetching products for event", {
|
|
3877
3527
|
eventId: t,
|
|
3878
|
-
promoCode:
|
|
3528
|
+
promoCode: i,
|
|
3879
3529
|
trackerId: this.config.trackerId,
|
|
3880
3530
|
productTypes: n
|
|
3881
3531
|
});
|
|
3882
|
-
const
|
|
3532
|
+
const r = await this.sdk.findProductsByEventId({
|
|
3883
3533
|
eventId: t,
|
|
3884
|
-
promoCode:
|
|
3534
|
+
promoCode: i,
|
|
3885
3535
|
trackerId: this.config.trackerId,
|
|
3886
3536
|
productTypes: n
|
|
3887
3537
|
});
|
|
3888
|
-
if (
|
|
3889
|
-
const s =
|
|
3538
|
+
if (r?.findPublicProductsByEventId) {
|
|
3539
|
+
const s = r.findPublicProductsByEventId.map((o) => ({
|
|
3890
3540
|
id: o.id,
|
|
3891
3541
|
name: o.name,
|
|
3892
3542
|
category: o.category ? {
|
|
@@ -3917,21 +3567,22 @@ class yn {
|
|
|
3917
3567
|
}), s;
|
|
3918
3568
|
}
|
|
3919
3569
|
return;
|
|
3920
|
-
} catch (
|
|
3921
|
-
throw this.debugLog("Error fetching products", { eventId: t, error:
|
|
3570
|
+
} catch (r) {
|
|
3571
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: r }), r;
|
|
3922
3572
|
}
|
|
3923
3573
|
}
|
|
3924
3574
|
debugLog(t, n) {
|
|
3925
3575
|
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
|
|
3926
3576
|
}
|
|
3927
3577
|
}
|
|
3928
|
-
const
|
|
3929
|
-
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
|
|
3578
|
+
const an = E`
|
|
3579
|
+
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
3930
3580
|
findPaymentDetails(
|
|
3931
3581
|
orderId: $orderId
|
|
3932
3582
|
orderItemId: $orderItemId
|
|
3933
3583
|
amountOfTickets: $amountOfTickets
|
|
3934
3584
|
paymentMethodId: $paymentMethodId
|
|
3585
|
+
withTicketProtection: $withTicketProtection
|
|
3935
3586
|
) {
|
|
3936
3587
|
methods {
|
|
3937
3588
|
id
|
|
@@ -3953,26 +3604,26 @@ const vn = E`
|
|
|
3953
3604
|
paymentSpesificTransactionFee
|
|
3954
3605
|
}
|
|
3955
3606
|
}
|
|
3956
|
-
`,
|
|
3607
|
+
`, on = E`
|
|
3957
3608
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3958
3609
|
createDigitalOrderPayment(input: $input)
|
|
3959
3610
|
}
|
|
3960
|
-
`,
|
|
3961
|
-
function
|
|
3611
|
+
`, cn = (e, t, n, i) => e();
|
|
3612
|
+
function dn(e, t = cn) {
|
|
3962
3613
|
return {
|
|
3963
|
-
findPaymentMethods(n,
|
|
3964
|
-
return t((s) => e.request({ document:
|
|
3614
|
+
findPaymentMethods(n, i, r) {
|
|
3615
|
+
return t((s) => e.request({ document: an, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", n);
|
|
3965
3616
|
},
|
|
3966
|
-
createDigitalPayment(n,
|
|
3967
|
-
return t((s) => e.request({ document:
|
|
3617
|
+
createDigitalPayment(n, i, r) {
|
|
3618
|
+
return t((s) => e.request({ document: on, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", n);
|
|
3968
3619
|
}
|
|
3969
3620
|
};
|
|
3970
3621
|
}
|
|
3971
|
-
class
|
|
3622
|
+
class un {
|
|
3972
3623
|
config;
|
|
3973
3624
|
sdk;
|
|
3974
3625
|
constructor(t) {
|
|
3975
|
-
this.config = t, this.sdk =
|
|
3626
|
+
this.config = t, this.sdk = dn(new oe(t.apiUrl));
|
|
3976
3627
|
}
|
|
3977
3628
|
async getPaymentDetails(t) {
|
|
3978
3629
|
this.debugLog("Fetching payment methods", t);
|
|
@@ -3981,31 +3632,32 @@ class Tn {
|
|
|
3981
3632
|
orderId: t.orderId,
|
|
3982
3633
|
orderItemId: t.orderItemId,
|
|
3983
3634
|
amountOfTickets: t.amountOfTickets,
|
|
3984
|
-
paymentMethodId: t.paymentMethodId
|
|
3635
|
+
paymentMethodId: t.paymentMethodId,
|
|
3636
|
+
withTicketProtection: t.withTicketProtection
|
|
3985
3637
|
});
|
|
3986
3638
|
if (!n?.findPaymentDetails)
|
|
3987
3639
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
3988
|
-
const
|
|
3640
|
+
const i = n.findPaymentDetails;
|
|
3989
3641
|
return this.debugLog("Payment methods fetched successfully", {
|
|
3990
|
-
methodCount:
|
|
3991
|
-
transactionPrice:
|
|
3992
|
-
transactionDiscount:
|
|
3993
|
-
transactionFee:
|
|
3994
|
-
paymentSpesificTransactionFee:
|
|
3642
|
+
methodCount: i.methods?.length ?? 0,
|
|
3643
|
+
transactionPrice: i.transactionPrice,
|
|
3644
|
+
transactionDiscount: i.transactionDiscount,
|
|
3645
|
+
transactionFee: i.transactionFee,
|
|
3646
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee
|
|
3995
3647
|
}), {
|
|
3996
|
-
transactionPrice:
|
|
3997
|
-
transactionDiscount:
|
|
3998
|
-
transactionFee:
|
|
3999
|
-
paymentSpesificTransactionFee:
|
|
4000
|
-
methods:
|
|
4001
|
-
id:
|
|
4002
|
-
name:
|
|
4003
|
-
image:
|
|
4004
|
-
fee:
|
|
4005
|
-
type:
|
|
4006
|
-
value:
|
|
3648
|
+
transactionPrice: i.transactionPrice,
|
|
3649
|
+
transactionDiscount: i.transactionPrice,
|
|
3650
|
+
transactionFee: i.transactionFee ?? null,
|
|
3651
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee ?? null,
|
|
3652
|
+
methods: i.methods?.map((r) => ({
|
|
3653
|
+
id: r.id,
|
|
3654
|
+
name: r.name,
|
|
3655
|
+
image: r.image,
|
|
3656
|
+
fee: r.fee ? {
|
|
3657
|
+
type: r.fee.type,
|
|
3658
|
+
value: r.fee.value
|
|
4007
3659
|
} : null,
|
|
4008
|
-
issuers:
|
|
3660
|
+
issuers: r.issuers?.map((s) => ({
|
|
4009
3661
|
id: s.id,
|
|
4010
3662
|
name: s.name,
|
|
4011
3663
|
image: s.image
|
|
@@ -4028,16 +3680,17 @@ class Tn {
|
|
|
4028
3680
|
initiatedByUserId: t.initiatedByUserId,
|
|
4029
3681
|
initiatedByTeamId: t.initiatedByTeamId,
|
|
4030
3682
|
amountOfTickets: t.amountOfTickets,
|
|
4031
|
-
orderItemId: t.orderItemId
|
|
3683
|
+
orderItemId: t.orderItemId,
|
|
3684
|
+
withTicketProtection: t.withTicketProtection
|
|
4032
3685
|
};
|
|
4033
3686
|
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);
|
|
4034
|
-
const
|
|
3687
|
+
const i = await this.sdk.createDigitalPayment({
|
|
4035
3688
|
input: n
|
|
4036
3689
|
});
|
|
4037
|
-
if (!
|
|
3690
|
+
if (!i?.createDigitalOrderPayment)
|
|
4038
3691
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
4039
|
-
const
|
|
4040
|
-
return this.debugLog("Payment created successfully", { paymentUrl:
|
|
3692
|
+
const r = i.createDigitalOrderPayment;
|
|
3693
|
+
return this.debugLog("Payment created successfully", { paymentUrl: r }), { paymentUrl: r };
|
|
4041
3694
|
} catch (n) {
|
|
4042
3695
|
throw this.debugLog("Error creating payment", n), n;
|
|
4043
3696
|
}
|
|
@@ -4046,7 +3699,7 @@ class Tn {
|
|
|
4046
3699
|
this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
|
|
4047
3700
|
}
|
|
4048
3701
|
}
|
|
4049
|
-
const
|
|
3702
|
+
const ln = E`
|
|
4050
3703
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
4051
3704
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
4052
3705
|
data {
|
|
@@ -4071,7 +3724,7 @@ const Dn = E`
|
|
|
4071
3724
|
count
|
|
4072
3725
|
}
|
|
4073
3726
|
}
|
|
4074
|
-
`,
|
|
3727
|
+
`, pn = E`
|
|
4075
3728
|
query findPublicPackageById($packageId: ID!) {
|
|
4076
3729
|
findPublicPackageById(id: $packageId) {
|
|
4077
3730
|
id
|
|
@@ -4097,7 +3750,7 @@ const Dn = E`
|
|
|
4097
3750
|
}
|
|
4098
3751
|
}
|
|
4099
3752
|
}
|
|
4100
|
-
`,
|
|
3753
|
+
`, hn = E`
|
|
4101
3754
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
4102
3755
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
4103
3756
|
data {
|
|
@@ -4132,25 +3785,25 @@ const Dn = E`
|
|
|
4132
3785
|
count
|
|
4133
3786
|
}
|
|
4134
3787
|
}
|
|
4135
|
-
`,
|
|
4136
|
-
function
|
|
3788
|
+
`, fn = (e, t, n, i) => e();
|
|
3789
|
+
function mn(e, t = fn) {
|
|
4137
3790
|
return {
|
|
4138
|
-
findAllPublicPackagesByOrganizationId(n,
|
|
4139
|
-
return t((s) => e.request({ document:
|
|
3791
|
+
findAllPublicPackagesByOrganizationId(n, i, r) {
|
|
3792
|
+
return t((s) => e.request({ document: ln, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
4140
3793
|
},
|
|
4141
|
-
findPublicPackageById(n,
|
|
4142
|
-
return t((s) => e.request({ document:
|
|
3794
|
+
findPublicPackageById(n, i, r) {
|
|
3795
|
+
return t((s) => e.request({ document: pn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", n);
|
|
4143
3796
|
},
|
|
4144
|
-
findPublicItemsByPackageId(n,
|
|
4145
|
-
return t((s) => e.request({ document:
|
|
3797
|
+
findPublicItemsByPackageId(n, i, r) {
|
|
3798
|
+
return t((s) => e.request({ document: hn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", n);
|
|
4146
3799
|
}
|
|
4147
3800
|
};
|
|
4148
3801
|
}
|
|
4149
|
-
class
|
|
3802
|
+
class gn {
|
|
4150
3803
|
config;
|
|
4151
3804
|
sdk;
|
|
4152
3805
|
constructor(t) {
|
|
4153
|
-
this.config = t, this.sdk =
|
|
3806
|
+
this.config = t, this.sdk = mn(new Z(t.apiUrl));
|
|
4154
3807
|
}
|
|
4155
3808
|
debugLog(t, n) {
|
|
4156
3809
|
this.config.debug && console.log(`[PackageService] ${t}`, n || "");
|
|
@@ -4167,15 +3820,15 @@ class Sn {
|
|
|
4167
3820
|
tab: t.tab,
|
|
4168
3821
|
statuses: t.statuses
|
|
4169
3822
|
});
|
|
4170
|
-
const
|
|
3823
|
+
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
4171
3824
|
organizationId: this.config.organizationId
|
|
4172
3825
|
});
|
|
4173
|
-
if (
|
|
4174
|
-
const
|
|
3826
|
+
if (i?.findAllPublicPackagesByOrganizationId) {
|
|
3827
|
+
const r = i.findAllPublicPackagesByOrganizationId;
|
|
4175
3828
|
return this.debugLog("Public packages fetched", {
|
|
4176
|
-
count:
|
|
4177
|
-
dataLength:
|
|
4178
|
-
}),
|
|
3829
|
+
count: r.count,
|
|
3830
|
+
dataLength: r.data.length
|
|
3831
|
+
}), r.data;
|
|
4179
3832
|
}
|
|
4180
3833
|
return null;
|
|
4181
3834
|
} catch (n) {
|
|
@@ -4189,37 +3842,45 @@ class Sn {
|
|
|
4189
3842
|
});
|
|
4190
3843
|
const n = await this.sdk.findPublicPackageById({ packageId: t });
|
|
4191
3844
|
if (n?.findPublicPackageById) {
|
|
4192
|
-
const
|
|
4193
|
-
return this.debugLog("Public package fetched"),
|
|
3845
|
+
const i = n.findPublicPackageById;
|
|
3846
|
+
return this.debugLog("Public package fetched"), i;
|
|
4194
3847
|
}
|
|
4195
3848
|
return null;
|
|
4196
3849
|
} catch (n) {
|
|
4197
3850
|
throw this.debugLog("Error fetching public packages", n), n;
|
|
4198
3851
|
}
|
|
4199
3852
|
}
|
|
4200
|
-
async getPackageItems(t, n = [
|
|
3853
|
+
async getPackageItems(t, n = [H.Regular, H.AdditionalEvent]) {
|
|
4201
3854
|
try {
|
|
4202
3855
|
this.debugLog("Fetching public package items", { packageId: t, types: n });
|
|
4203
|
-
const
|
|
3856
|
+
const i = await this.sdk.findPublicItemsByPackageId({
|
|
4204
3857
|
packageId: t,
|
|
4205
3858
|
types: n,
|
|
4206
3859
|
page: { index: 0, size: 100 }
|
|
4207
3860
|
});
|
|
4208
|
-
if (
|
|
4209
|
-
const
|
|
3861
|
+
if (i?.findPublicItemsByPackageId) {
|
|
3862
|
+
const r = i.findPublicItemsByPackageId;
|
|
4210
3863
|
return this.debugLog("Public package items fetched", {
|
|
4211
|
-
count:
|
|
4212
|
-
dataLength:
|
|
4213
|
-
}),
|
|
3864
|
+
count: r.count,
|
|
3865
|
+
dataLength: r.data.length
|
|
3866
|
+
}), r.data;
|
|
4214
3867
|
}
|
|
4215
3868
|
return null;
|
|
4216
|
-
} catch (
|
|
4217
|
-
throw this.debugLog("Error fetching public package items",
|
|
3869
|
+
} catch (i) {
|
|
3870
|
+
throw this.debugLog("Error fetching public package items", i), i;
|
|
4218
3871
|
}
|
|
4219
3872
|
}
|
|
4220
3873
|
}
|
|
4221
|
-
const
|
|
3874
|
+
const In = E`
|
|
4222
3875
|
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
3876
|
+
findAllPublicLocationsByOrganizationId(id: $organizationId) {
|
|
3877
|
+
data {
|
|
3878
|
+
id
|
|
3879
|
+
name
|
|
3880
|
+
amountOfActiveEvents(input: $dateRange)
|
|
3881
|
+
}
|
|
3882
|
+
count
|
|
3883
|
+
}
|
|
4223
3884
|
findAllPublicHostingsByOrganizationId(id: $organizationId) {
|
|
4224
3885
|
data {
|
|
4225
3886
|
id
|
|
@@ -4230,7 +3891,7 @@ const Cn = E`
|
|
|
4230
3891
|
count
|
|
4231
3892
|
}
|
|
4232
3893
|
}
|
|
4233
|
-
`,
|
|
3894
|
+
`, En = E`
|
|
4234
3895
|
query findPublicCategoryById($hostingId: ID!, $dateRange: DateRangeInput) {
|
|
4235
3896
|
findPublicHostingById(id: $hostingId) {
|
|
4236
3897
|
id
|
|
@@ -4238,23 +3899,28 @@ const Cn = E`
|
|
|
4238
3899
|
icon
|
|
4239
3900
|
amountOfActiveEvents(input: $dateRange)
|
|
4240
3901
|
}
|
|
3902
|
+
findPublicLocationById(id: $hostingId) {
|
|
3903
|
+
id
|
|
3904
|
+
name
|
|
3905
|
+
amountOfActiveEvents(input: $dateRange)
|
|
3906
|
+
}
|
|
4241
3907
|
}
|
|
4242
|
-
`,
|
|
4243
|
-
function
|
|
3908
|
+
`, yn = (e, t, n, i) => e();
|
|
3909
|
+
function vn(e, t = yn) {
|
|
4244
3910
|
return {
|
|
4245
|
-
findAllPublicCategoriesByOrganizationId(n,
|
|
4246
|
-
return t((s) => e.request({ document:
|
|
3911
|
+
findAllPublicCategoriesByOrganizationId(n, i, r) {
|
|
3912
|
+
return t((s) => e.request({ document: In, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
4247
3913
|
},
|
|
4248
|
-
findPublicCategoryById(n,
|
|
4249
|
-
return t((s) => e.request({ document:
|
|
3914
|
+
findPublicCategoryById(n, i, r) {
|
|
3915
|
+
return t((s) => e.request({ document: En, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicCategoryById", "query", n);
|
|
4250
3916
|
}
|
|
4251
3917
|
};
|
|
4252
3918
|
}
|
|
4253
|
-
class
|
|
3919
|
+
class Tn {
|
|
4254
3920
|
config;
|
|
4255
3921
|
sdk;
|
|
4256
3922
|
constructor(t) {
|
|
4257
|
-
this.config = t, this.sdk =
|
|
3923
|
+
this.config = t, this.sdk = vn(new Z(t.apiUrl));
|
|
4258
3924
|
}
|
|
4259
3925
|
debugLog(t, n) {
|
|
4260
3926
|
this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
|
|
@@ -4264,73 +3930,81 @@ class Fn {
|
|
|
4264
3930
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
4265
3931
|
const n = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId, dateRange: t });
|
|
4266
3932
|
if (n?.findAllPublicHostingsByOrganizationId) {
|
|
4267
|
-
const r = n.
|
|
4268
|
-
return this.debugLog("Categories fetched", { count: r.count, dataLength:
|
|
3933
|
+
const i = n.findAllPublicHostingsByOrganizationId, r = n.findAllPublicLocationsByOrganizationId;
|
|
3934
|
+
return this.debugLog("Categories fetched", { count: i.count + r.count, dataLength: i.data.length + r.data.length }), [
|
|
3935
|
+
...i.data.map((s) => ({ id: s.id, name: s.name, icon: s.icon, activeEvents: s.amountOfActiveEvents, type: "HOSTING" })),
|
|
3936
|
+
...r.data.map((s) => ({ id: s.id, name: s.name, activeEvents: s.amountOfActiveEvents, type: "LOCATION" }))
|
|
3937
|
+
];
|
|
4269
3938
|
}
|
|
4270
3939
|
return [];
|
|
4271
3940
|
} catch (n) {
|
|
4272
3941
|
throw this.debugLog("Error fetching categories", n), n;
|
|
4273
3942
|
}
|
|
4274
3943
|
}
|
|
4275
|
-
async getCategory(t) {
|
|
3944
|
+
async getCategory(t, n) {
|
|
4276
3945
|
try {
|
|
4277
3946
|
this.debugLog("Fetching category", { categoryId: t });
|
|
4278
|
-
const
|
|
4279
|
-
if (n
|
|
4280
|
-
|
|
4281
|
-
|
|
3947
|
+
const i = await this.sdk.findPublicCategoryById({ hostingId: t });
|
|
3948
|
+
if (n === "HOSTING") {
|
|
3949
|
+
if (i?.findPublicHostingById) {
|
|
3950
|
+
const r = i.findPublicHostingById;
|
|
3951
|
+
return this.debugLog("Category fetched", r), { id: r.id, name: r.name, icon: r.icon, activeEvents: r.amountOfActiveEvents, type: n };
|
|
3952
|
+
}
|
|
3953
|
+
} else if (i?.findPublicLocationById) {
|
|
3954
|
+
const r = i.findPublicLocationById;
|
|
3955
|
+
return this.debugLog("Category fetched", r), { id: r.id, name: r.name, activeEvents: r.amountOfActiveEvents, type: n };
|
|
4282
3956
|
}
|
|
4283
3957
|
return null;
|
|
4284
|
-
} catch (
|
|
4285
|
-
throw this.debugLog("Error fetching category",
|
|
3958
|
+
} catch (i) {
|
|
3959
|
+
throw this.debugLog("Error fetching category", i), i;
|
|
4286
3960
|
}
|
|
4287
3961
|
}
|
|
4288
3962
|
}
|
|
4289
|
-
const
|
|
3963
|
+
const An = E`
|
|
4290
3964
|
mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
|
|
4291
3965
|
createShopView(id: $id, trackerId: $trackerLinkId)
|
|
4292
3966
|
}
|
|
4293
|
-
`,
|
|
3967
|
+
`, kn = E`
|
|
4294
3968
|
mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
4295
3969
|
createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
4296
3970
|
}
|
|
4297
|
-
`,
|
|
3971
|
+
`, On = E`
|
|
4298
3972
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
4299
3973
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
4300
3974
|
}
|
|
4301
|
-
`,
|
|
4302
|
-
function
|
|
3975
|
+
`, Dn = (e, t, n, i) => e();
|
|
3976
|
+
function Nn(e, t = Dn) {
|
|
4303
3977
|
return {
|
|
4304
|
-
CreateShopView(n,
|
|
4305
|
-
return t((s) => e.request({ document:
|
|
3978
|
+
CreateShopView(n, i, r) {
|
|
3979
|
+
return t((s) => e.request({ document: An, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateShopView", "mutation", n);
|
|
4306
3980
|
},
|
|
4307
|
-
CreateEventView(n,
|
|
4308
|
-
return t((s) => e.request({ document:
|
|
3981
|
+
CreateEventView(n, i, r) {
|
|
3982
|
+
return t((s) => e.request({ document: kn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateEventView", "mutation", n);
|
|
4309
3983
|
},
|
|
4310
|
-
CreatePackageView(n,
|
|
4311
|
-
return t((s) => e.request({ document:
|
|
3984
|
+
CreatePackageView(n, i, r) {
|
|
3985
|
+
return t((s) => e.request({ document: On, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreatePackageView", "mutation", n);
|
|
4312
3986
|
}
|
|
4313
3987
|
};
|
|
4314
3988
|
}
|
|
4315
|
-
class
|
|
3989
|
+
class bn {
|
|
4316
3990
|
config;
|
|
4317
3991
|
sdk;
|
|
4318
3992
|
constructor(t) {
|
|
4319
|
-
this.config = t, this.sdk =
|
|
3993
|
+
this.config = t, this.sdk = Nn(new Z(t.apiUrl));
|
|
4320
3994
|
}
|
|
4321
|
-
createMetric = async (t, n,
|
|
4322
|
-
switch (!n && !
|
|
3995
|
+
createMetric = async (t, n, i) => {
|
|
3996
|
+
switch (!n && !i && await this.sdk.CreateShopView({
|
|
4323
3997
|
id: t,
|
|
4324
3998
|
trackerLinkId: this.config.trackerId
|
|
4325
|
-
}),
|
|
4326
|
-
case
|
|
3999
|
+
}), i) {
|
|
4000
|
+
case Y.Event:
|
|
4327
4001
|
await this.sdk.CreateEventView({
|
|
4328
4002
|
id: t,
|
|
4329
4003
|
shopId: n,
|
|
4330
4004
|
trackerLinkId: this.config.trackerId
|
|
4331
4005
|
});
|
|
4332
4006
|
break;
|
|
4333
|
-
case
|
|
4007
|
+
case Y.Package:
|
|
4334
4008
|
await this.sdk.CreatePackageView(
|
|
4335
4009
|
{
|
|
4336
4010
|
id: t,
|
|
@@ -4342,8 +4016,8 @@ class Mn {
|
|
|
4342
4016
|
}
|
|
4343
4017
|
};
|
|
4344
4018
|
}
|
|
4345
|
-
const
|
|
4346
|
-
class
|
|
4019
|
+
const xn = "https://api.ticketapp.com/graphql", Ie = "TIC_TRACKER_ID";
|
|
4020
|
+
class Cn {
|
|
4347
4021
|
basket;
|
|
4348
4022
|
event;
|
|
4349
4023
|
payment;
|
|
@@ -4351,10 +4025,10 @@ class Yn {
|
|
|
4351
4025
|
category;
|
|
4352
4026
|
metric;
|
|
4353
4027
|
// Attach selected public types to the SDK class
|
|
4354
|
-
static Types =
|
|
4028
|
+
static Types = Ue;
|
|
4355
4029
|
constructor(t) {
|
|
4356
|
-
const { organizationId: n, debug:
|
|
4357
|
-
this.basket = new
|
|
4030
|
+
const { organizationId: n, debug: i = !1, apiUrl: r = xn } = t, s = this.getOrInitTrackerId();
|
|
4031
|
+
this.basket = new Jt({ debug: i, apiUrl: r, shopId: t.shopId, trackerId: s }), this.event = new sn({ organizationId: n, debug: i, apiUrl: r, trackerId: s }), this.payment = new un({ debug: i, apiUrl: r }), this.package = new gn({ organizationId: n, debug: i, apiUrl: r }), this.category = new Tn({ organizationId: n, debug: i, apiUrl: r }), this.metric = new bn({ apiUrl: r, trackerId: s });
|
|
4358
4032
|
}
|
|
4359
4033
|
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
4360
4034
|
// Persist to session when found via config or URL for subsequent page loads
|
|
@@ -4367,13 +4041,13 @@ class Yn {
|
|
|
4367
4041
|
} catch {
|
|
4368
4042
|
}
|
|
4369
4043
|
try {
|
|
4370
|
-
t = window.sessionStorage?.getItem(
|
|
4044
|
+
t = window.sessionStorage?.getItem(Ie) ?? null;
|
|
4371
4045
|
} catch {
|
|
4372
4046
|
}
|
|
4373
4047
|
}
|
|
4374
4048
|
if (n && n.trim().length > 0) {
|
|
4375
4049
|
try {
|
|
4376
|
-
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(
|
|
4050
|
+
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Ie, n);
|
|
4377
4051
|
} catch {
|
|
4378
4052
|
}
|
|
4379
4053
|
return n;
|
|
@@ -4381,8 +4055,8 @@ class Yn {
|
|
|
4381
4055
|
if (t && t.trim().length > 0) {
|
|
4382
4056
|
try {
|
|
4383
4057
|
if (typeof window < "u") {
|
|
4384
|
-
const
|
|
4385
|
-
|
|
4058
|
+
const i = new URL(window.location.href);
|
|
4059
|
+
i.searchParams.get("trackerId") || (i.searchParams.set("trackerId", t), window.history.replaceState({}, "", i.toString()));
|
|
4386
4060
|
}
|
|
4387
4061
|
} catch {
|
|
4388
4062
|
}
|
|
@@ -4396,16 +4070,16 @@ class Yn {
|
|
|
4396
4070
|
}
|
|
4397
4071
|
export {
|
|
4398
4072
|
_ as BasketOrderType,
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4073
|
+
Ne as DiscountType,
|
|
4074
|
+
ve as EventStatus,
|
|
4075
|
+
Y as MetricsType,
|
|
4076
|
+
De as OrderItemType,
|
|
4077
|
+
H as PackageItemType,
|
|
4078
|
+
Ee as PackageStatus,
|
|
4079
|
+
ye as PackageTabType,
|
|
4080
|
+
Oe as PaymentMethodFeeType,
|
|
4081
|
+
Ae as ProductStatus,
|
|
4082
|
+
ke as ProductType,
|
|
4083
|
+
Te as SortOrder,
|
|
4084
|
+
Cn as TicketappSDK
|
|
4411
4085
|
};
|