@ticketapp-dev/shop-sdk 1.0.29 → 1.0.31
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 +1125 -1453
- package/dist/services/basket/basket.service.d.ts +9 -21
- 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 +4 -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 +85 -38
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/store/store.d.ts +0 -459
- 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 Xe = /* @__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
|
|
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,
|
|
69
|
+
...I.slice(1, m + 1).map((D) => ["|", D]),
|
|
71
70
|
["|", "^".padStart(y)],
|
|
72
|
-
["|", I[
|
|
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 tt(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
|
|
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 nt {
|
|
|
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 nt {
|
|
|
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 Fe {
|
|
|
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 Fe {
|
|
|
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 we = {
|
|
|
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
|
|
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 ct {
|
|
|
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 ct {
|
|
|
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 ut(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 ut(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 lt(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 gt(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 gt(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 Et(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 Tt(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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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,10 +1708,10 @@ class bt {
|
|
|
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(
|
|
1716
1715
|
this._lexer.token
|
|
1717
1716
|
)} is reserved and cannot be used for an enum value.`
|
|
1718
1717
|
);
|
|
@@ -1725,12 +1724,12 @@ class bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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,10 +2058,10 @@ class bt {
|
|
|
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
|
-
`Expected "${t}", found ${
|
|
2064
|
+
`Expected "${t}", found ${q(n)}.`
|
|
2066
2065
|
);
|
|
2067
2066
|
}
|
|
2068
2067
|
/**
|
|
@@ -2078,10 +2077,10 @@ class bt {
|
|
|
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
|
-
`Unexpected ${
|
|
2083
|
+
`Unexpected ${q(n)}.`
|
|
2085
2084
|
);
|
|
2086
2085
|
}
|
|
2087
2086
|
/**
|
|
@@ -2089,12 +2088,12 @@ class bt {
|
|
|
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 bt {
|
|
|
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 bt {
|
|
|
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,37 +2131,37 @@ class bt {
|
|
|
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.`
|
|
2148
2147
|
);
|
|
2149
2148
|
}
|
|
2150
2149
|
}
|
|
2151
|
-
function
|
|
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 Lt = [
|
|
|
2328
2327
|
"\\u009D",
|
|
2329
2328
|
"\\u009E",
|
|
2330
2329
|
"\\u009F"
|
|
2331
|
-
],
|
|
2332
|
-
function
|
|
2333
|
-
const
|
|
2334
|
-
for (const
|
|
2335
|
-
|
|
2336
|
-
let
|
|
2337
|
-
const
|
|
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;
|
|
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
|
-
|
|
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 (!
|
|
2370
|
-
|
|
2367
|
+
if (x === !1) {
|
|
2368
|
+
if (!k) {
|
|
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 (
|
|
2382
|
-
|
|
2380
|
+
if (x === void 0 && C && f.push([g, p]), k)
|
|
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 wt(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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Bt = 80, Vt = {
|
|
|
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 Qt = 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 Qt = 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 Qt = 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 Qt = 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 Qt = 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,641 +2924,284 @@ const Qt = 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
|
-
initialized: !0
|
|
2979
|
-
}, Ye = Qe({
|
|
2980
|
-
name: "basket",
|
|
2981
|
-
initialState: {
|
|
2982
|
-
...Ie,
|
|
2983
|
-
initialized: !1
|
|
2984
|
-
},
|
|
2985
|
-
reducers: {
|
|
2986
|
-
setInitialized: (e, t) => {
|
|
2987
|
-
e.initialized = t.payload;
|
|
2988
|
-
},
|
|
2989
|
-
setProcessing: (e, t) => {
|
|
2990
|
-
e.processing = t.payload;
|
|
2991
|
-
},
|
|
2992
|
-
setError: (e, t) => {
|
|
2993
|
-
e.error = t.payload;
|
|
2994
|
-
},
|
|
2995
|
-
setOrder: (e, t) => {
|
|
2996
|
-
e.order = t.payload;
|
|
2997
|
-
},
|
|
2998
|
-
initializeOrder: (e, t) => {
|
|
2999
|
-
e.order || (e.order = {
|
|
3000
|
-
id: t.payload.id,
|
|
3001
|
-
currency: t.payload.currency,
|
|
3002
|
-
items: [],
|
|
3003
|
-
expiredAt: t.payload.expiredAt
|
|
3004
|
-
});
|
|
3005
|
-
},
|
|
3006
|
-
addProduct: (e, t) => {
|
|
3007
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3008
|
-
if (!e.order)
|
|
3009
|
-
return;
|
|
3010
|
-
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);
|
|
3011
|
-
if (s >= 0)
|
|
3012
|
-
e.order.items[s].amount += r;
|
|
3013
|
-
else {
|
|
3014
|
-
const o = {
|
|
3015
|
-
id: n.id,
|
|
3016
|
-
type: "PRODUCT",
|
|
3017
|
-
name: n.name,
|
|
3018
|
-
amount: r,
|
|
3019
|
-
price: n.price,
|
|
3020
|
-
depositPrice: n.depositPrice,
|
|
3021
|
-
serviceFee: n.serviceFee,
|
|
3022
|
-
originalPrice: n.price,
|
|
3023
|
-
seats: n.seat ? [{ id: n.seat.id, label: n.seat.label }] : void 0
|
|
3024
|
-
};
|
|
3025
|
-
e.order.items.push(o);
|
|
3026
|
-
}
|
|
3027
|
-
e.order.expiredAt = i;
|
|
3028
|
-
},
|
|
3029
|
-
removeProduct: (e, t) => {
|
|
3030
|
-
if (!e.order) return;
|
|
3031
|
-
const { id: n, amountReleased: r, seatId: i } = t.payload, s = e.order.items.findIndex(
|
|
3032
|
-
(o) => o.type === "PRODUCT" && o.id === n
|
|
3033
|
-
);
|
|
3034
|
-
if (s !== -1) {
|
|
3035
|
-
const o = e.order.items[s];
|
|
3036
|
-
if (o.amount -= r, o.amount <= 0)
|
|
3037
|
-
e.order.items.splice(s, 1);
|
|
3038
|
-
else if (o.seats && i) {
|
|
3039
|
-
const u = o.seats.findIndex((h) => h.id === i);
|
|
3040
|
-
u !== -1 && o.seats.splice(u, 1);
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
e.order.items.length === 0 && (e.order = null);
|
|
3044
|
-
},
|
|
3045
|
-
configurePackage: (e, t) => {
|
|
3046
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3047
|
-
e.order || (e.order = {
|
|
3048
|
-
id: "",
|
|
3049
|
-
currency: n.currency,
|
|
3050
|
-
items: [],
|
|
3051
|
-
expiredAt: i
|
|
3052
|
-
});
|
|
3053
|
-
const s = e.order.items.find(
|
|
3054
|
-
(o) => o.type === "PACKAGE" && o.id === n.id
|
|
3055
|
-
);
|
|
3056
|
-
s ? (s.amount = r, s.packageItems = n.items) : e.order.items.push({
|
|
3057
|
-
id: n.id,
|
|
3058
|
-
type: "PACKAGE",
|
|
3059
|
-
name: n.name,
|
|
3060
|
-
amount: r,
|
|
3061
|
-
price: n.discountPrice ?? n.price,
|
|
3062
|
-
depositPrice: n.depositPrice,
|
|
3063
|
-
originalPrice: n.price,
|
|
3064
|
-
serviceFee: n.serviceFee,
|
|
3065
|
-
packageItems: n.items
|
|
3066
|
-
});
|
|
3067
|
-
},
|
|
3068
|
-
reserveAdditionalPackageItem: (e, t) => {
|
|
3069
|
-
const { input: n, amountReserved: r, expiredAt: i } = t.payload;
|
|
3070
|
-
e.order || (e.order = {
|
|
3071
|
-
id: "",
|
|
3072
|
-
currency: n.currency,
|
|
3073
|
-
items: [],
|
|
3074
|
-
expiredAt: i
|
|
3075
|
-
});
|
|
3076
|
-
const s = e.order.items.findIndex(
|
|
3077
|
-
(u) => u.id === n.packageItemId
|
|
3078
|
-
), o = e.order.items[s];
|
|
3079
|
-
o ? (o.amount = r, o.packageItems = [
|
|
3080
|
-
{
|
|
3081
|
-
packageItemId: n.packageItemId,
|
|
3082
|
-
eventId: n.eventId,
|
|
3083
|
-
name: n.name,
|
|
3084
|
-
startAt: n.startAt,
|
|
3085
|
-
endAt: n.endAt
|
|
3086
|
-
}
|
|
3087
|
-
], o.amount === 0 && e.order.items.splice(s, 1)) : e.order.items.push({
|
|
3088
|
-
id: n.packageItemId,
|
|
3089
|
-
type: _.ADD_ONS,
|
|
3090
|
-
name: n.name,
|
|
3091
|
-
amount: r,
|
|
3092
|
-
price: n.discountPrice ?? n.price,
|
|
3093
|
-
depositPrice: n.depositPrice,
|
|
3094
|
-
originalPrice: n.price,
|
|
3095
|
-
serviceFee: n.serviceFee,
|
|
3096
|
-
packageItems: [
|
|
3097
|
-
{
|
|
3098
|
-
packageItemId: n.packageItemId,
|
|
3099
|
-
eventId: n.eventId,
|
|
3100
|
-
name: n.name,
|
|
3101
|
-
startAt: n.startAt,
|
|
3102
|
-
endAt: n.endAt
|
|
3103
|
-
}
|
|
3104
|
-
]
|
|
3105
|
-
});
|
|
3106
|
-
},
|
|
3107
|
-
configureDelivery: (e, t) => {
|
|
3108
|
-
if (!e.order) return;
|
|
3109
|
-
const n = t.payload, r = e.order.items.findIndex(
|
|
3110
|
-
(i) => i.type === "DELIVERY"
|
|
3111
|
-
);
|
|
3112
|
-
if (n)
|
|
3113
|
-
if (r !== -1) {
|
|
3114
|
-
const i = e.order.items[r];
|
|
3115
|
-
i.id = n.id, i.name = n.name, i.price = n.price, i.serviceFee = n.serviceFee;
|
|
3116
|
-
} else
|
|
3117
|
-
e.order.items.push({
|
|
3118
|
-
id: n.id,
|
|
3119
|
-
type: "PRODUCT",
|
|
3120
|
-
name: n.name,
|
|
3121
|
-
amount: 1,
|
|
3122
|
-
price: n.price,
|
|
3123
|
-
originalPrice: n.price,
|
|
3124
|
-
serviceFee: n.serviceFee
|
|
3125
|
-
});
|
|
3126
|
-
else r !== -1 && e.order.items.splice(r, 1);
|
|
3127
|
-
},
|
|
3128
|
-
configureCustomer: (e, t) => {
|
|
3129
|
-
e.order && (e.order.customer = t.payload);
|
|
3130
|
-
},
|
|
3131
|
-
clearBasket: () => Ie
|
|
3132
|
-
}
|
|
3133
|
-
}), {
|
|
3134
|
-
setInitialized: on,
|
|
3135
|
-
setProcessing: C,
|
|
3136
|
-
initializeOrder: j,
|
|
3137
|
-
addProduct: Ee,
|
|
3138
|
-
removeProduct: an,
|
|
3139
|
-
configurePackage: ye,
|
|
3140
|
-
configureDelivery: cn,
|
|
3141
|
-
configureCustomer: ve,
|
|
3142
|
-
reserveAdditionalPackageItem: dn,
|
|
3143
|
-
clearBasket: ke
|
|
3144
|
-
} = Ye.actions;
|
|
3145
|
-
class un {
|
|
3146
|
-
orderIdKey = "ORDER_ID";
|
|
2973
|
+
class Jt {
|
|
3147
2974
|
config;
|
|
3148
2975
|
sdk;
|
|
3149
|
-
store;
|
|
3150
2976
|
constructor(t) {
|
|
3151
|
-
this.config = t, this.
|
|
3152
|
-
reducer: {
|
|
3153
|
-
basket: Ye.reducer
|
|
3154
|
-
}
|
|
3155
|
-
}), this.sdk = sn(new de(t.apiUrl)), this.restoreOrderFromSession().then(() => {
|
|
3156
|
-
this.debugLog("Restore order from session"), this.store.dispatch(on(!0));
|
|
3157
|
-
});
|
|
3158
|
-
}
|
|
3159
|
-
// Store functions
|
|
3160
|
-
subscribe(t) {
|
|
3161
|
-
return this.store.subscribe(t);
|
|
3162
|
-
}
|
|
3163
|
-
getProcessing() {
|
|
3164
|
-
return this.getState().processing;
|
|
3165
|
-
}
|
|
3166
|
-
getCurrentOrder() {
|
|
3167
|
-
const t = this.getState();
|
|
3168
|
-
if (!t.order)
|
|
3169
|
-
return null;
|
|
3170
|
-
const n = t.order.items.reduce((r, i) => r + (i.amount || 0), 0);
|
|
3171
|
-
return {
|
|
3172
|
-
...t.order,
|
|
3173
|
-
count: n
|
|
3174
|
-
};
|
|
3175
|
-
}
|
|
3176
|
-
getSelectedPackageEvent() {
|
|
3177
|
-
return this.getState().order?.items.flatMap((n) => n.packageItems?.map((r) => r.eventId) ?? []) ?? [];
|
|
2977
|
+
this.config = t, this.sdk = Qt(new oe(t.apiUrl));
|
|
3178
2978
|
}
|
|
3179
2979
|
// Basket update functions
|
|
3180
|
-
async addProduct(t) {
|
|
3181
|
-
this.store.dispatch(C(!0));
|
|
2980
|
+
async addProduct(t, n) {
|
|
3182
2981
|
try {
|
|
3183
|
-
const r = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3184
2982
|
this.debugLog("Adding product", {
|
|
3185
|
-
productId:
|
|
3186
|
-
orderId:
|
|
3187
|
-
amount:
|
|
3188
|
-
seat:
|
|
3189
|
-
})
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
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 ? {
|
|
3194
2991
|
seat: {
|
|
3195
|
-
seatId:
|
|
3196
|
-
seatLabel:
|
|
3197
|
-
holdToken:
|
|
2992
|
+
seatId: n.seat.id,
|
|
2993
|
+
seatLabel: n.seat.label,
|
|
2994
|
+
holdToken: n.seat.holdToken
|
|
3198
2995
|
}
|
|
3199
2996
|
} : null,
|
|
3200
2997
|
trackerId: this.config.trackerId,
|
|
3201
2998
|
shopId: this.config.shopId,
|
|
3202
|
-
amount:
|
|
2999
|
+
amount: n.amount
|
|
3203
3000
|
});
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
this.debugLog("Product added successfully", i.reserveProduct), sessionStorage.setItem(this.orderIdKey, r), this.store.dispatch(
|
|
3207
|
-
j({
|
|
3208
|
-
id: s,
|
|
3209
|
-
currency: t.currency,
|
|
3210
|
-
expiredAt: o
|
|
3211
|
-
})
|
|
3212
|
-
), this.store.dispatch(
|
|
3213
|
-
Ee({
|
|
3214
|
-
input: t,
|
|
3215
|
-
amountReserved: u,
|
|
3216
|
-
expiredAt: o
|
|
3217
|
-
})
|
|
3218
|
-
);
|
|
3219
|
-
}
|
|
3220
|
-
} catch (n) {
|
|
3221
|
-
throw this.debugLog("Error adding product", n), this.handleError(n), n;
|
|
3222
|
-
} finally {
|
|
3223
|
-
this.store.dispatch(C(!1));
|
|
3001
|
+
} catch (i) {
|
|
3002
|
+
throw this.debugLog("Error adding product", i), this.handleError(i), i;
|
|
3224
3003
|
}
|
|
3225
3004
|
}
|
|
3226
|
-
async removeProduct(t) {
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
amount: t.amount
|
|
3246
|
-
});
|
|
3247
|
-
if (i?.releaseProduct) {
|
|
3248
|
-
const { amountReleased: s } = i.releaseProduct;
|
|
3249
|
-
this.debugLog("Product removed successfully", i.releaseProduct), this.store.dispatch(
|
|
3250
|
-
an({
|
|
3251
|
-
id: t.id,
|
|
3252
|
-
amountReleased: s,
|
|
3253
|
-
seatId: t.seat?.id
|
|
3254
|
-
})
|
|
3255
|
-
);
|
|
3256
|
-
const o = this.getState();
|
|
3257
|
-
(!o.order || o.order.items.length === 0) && (this.debugLog("Basket is now empty, cancelling order and clearing session"), this.clearOrderFromSession());
|
|
3258
|
-
}
|
|
3259
|
-
} catch (i) {
|
|
3260
|
-
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
3261
|
-
} finally {
|
|
3262
|
-
this.store.dispatch(C(!1));
|
|
3263
|
-
}
|
|
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;
|
|
3264
3024
|
}
|
|
3265
3025
|
}
|
|
3266
|
-
async configurePackage(t) {
|
|
3267
|
-
this.store.dispatch(C(!0));
|
|
3026
|
+
async configurePackage(t, n) {
|
|
3268
3027
|
try {
|
|
3269
|
-
const
|
|
3270
|
-
packageItemId:
|
|
3271
|
-
eventId:
|
|
3028
|
+
const i = n.items.map((r) => ({
|
|
3029
|
+
packageItemId: r.packageItemId,
|
|
3030
|
+
eventId: r.eventId
|
|
3272
3031
|
}));
|
|
3273
3032
|
this.debugLog("Configuring package", {
|
|
3274
|
-
packageId:
|
|
3275
|
-
orderId:
|
|
3276
|
-
amount:
|
|
3033
|
+
packageId: n.id,
|
|
3034
|
+
orderId: t,
|
|
3035
|
+
amount: n.amount,
|
|
3277
3036
|
items: i,
|
|
3278
3037
|
shopId: this.config.shopId
|
|
3279
|
-
})
|
|
3280
|
-
const s = await this.sdk.configurePackage({
|
|
3038
|
+
}), await this.sdk.configurePackage({
|
|
3281
3039
|
trackerId: this.config.trackerId,
|
|
3282
3040
|
shopId: this.config.shopId,
|
|
3283
|
-
packageId:
|
|
3284
|
-
orderId:
|
|
3285
|
-
amount:
|
|
3041
|
+
packageId: n.id,
|
|
3042
|
+
orderId: t,
|
|
3043
|
+
amount: n.amount,
|
|
3286
3044
|
items: i
|
|
3287
|
-
});
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
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(
|
|
3291
|
-
j({
|
|
3292
|
-
id: o,
|
|
3293
|
-
currency: t.currency,
|
|
3294
|
-
expiredAt: u
|
|
3295
|
-
})
|
|
3296
|
-
), this.store.dispatch(
|
|
3297
|
-
ye({
|
|
3298
|
-
input: t,
|
|
3299
|
-
amountReserved: h,
|
|
3300
|
-
expiredAt: u
|
|
3301
|
-
})
|
|
3302
|
-
), null;
|
|
3303
|
-
} else
|
|
3304
|
-
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3305
|
-
} catch (n) {
|
|
3306
|
-
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3307
|
-
} finally {
|
|
3308
|
-
this.store.dispatch(C(!1));
|
|
3309
|
-
}
|
|
3310
|
-
}
|
|
3311
|
-
async configureDelivery(t) {
|
|
3312
|
-
this.store.dispatch(C(!0));
|
|
3313
|
-
try {
|
|
3314
|
-
this.store.dispatch(cn(t));
|
|
3315
|
-
} catch (n) {
|
|
3316
|
-
throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
|
|
3317
|
-
} finally {
|
|
3318
|
-
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 };
|
|
3319
3048
|
}
|
|
3049
|
+
return null;
|
|
3320
3050
|
}
|
|
3321
|
-
async configureCustomer(t) {
|
|
3322
|
-
|
|
3323
|
-
if (!r)
|
|
3324
|
-
throw new Error("No active order. Add items to basket first.");
|
|
3325
|
-
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 });
|
|
3326
3053
|
try {
|
|
3327
3054
|
const i = await this.sdk.createOrderCustomer({
|
|
3328
|
-
orderId:
|
|
3329
|
-
customer:
|
|
3055
|
+
orderId: t,
|
|
3056
|
+
customer: n
|
|
3330
3057
|
});
|
|
3331
|
-
this.debugLog("Customer set successfully", i)
|
|
3058
|
+
this.debugLog("Customer set successfully", i);
|
|
3332
3059
|
} catch (i) {
|
|
3333
3060
|
throw this.debugLog("Failed to set customer", i), new Error(`Failed to set customer: ${i.message}`);
|
|
3334
3061
|
}
|
|
3335
3062
|
}
|
|
3336
|
-
async reserveAdditionalPackageItem(t) {
|
|
3337
|
-
this.store.dispatch(C(!0));
|
|
3063
|
+
async reserveAdditionalPackageItem(t, n) {
|
|
3338
3064
|
try {
|
|
3339
|
-
const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3340
3065
|
this.debugLog("reserve additional packageItem", {
|
|
3341
|
-
orderId:
|
|
3342
|
-
eventId:
|
|
3343
|
-
amount:
|
|
3344
|
-
packageId:
|
|
3345
|
-
packageItemId:
|
|
3346
|
-
})
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
const { orderId: s, expiredAt: o, amountReserved: u } = i.reserveAdditionalPackageItem;
|
|
3356
|
-
return this.debugLog("Reserve configured successfully"), sessionStorage.setItem(this.orderIdKey, r), this.store.dispatch(
|
|
3357
|
-
j({
|
|
3358
|
-
id: s,
|
|
3359
|
-
currency: t.currency,
|
|
3360
|
-
expiredAt: o
|
|
3361
|
-
})
|
|
3362
|
-
), this.store.dispatch(
|
|
3363
|
-
dn({
|
|
3364
|
-
input: t,
|
|
3365
|
-
amountReserved: u,
|
|
3366
|
-
expiredAt: o
|
|
3367
|
-
})
|
|
3368
|
-
), null;
|
|
3369
|
-
} else
|
|
3370
|
-
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3371
|
-
} catch (n) {
|
|
3372
|
-
return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
|
|
3373
|
-
} finally {
|
|
3374
|
-
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 };
|
|
3375
3080
|
}
|
|
3081
|
+
return null;
|
|
3376
3082
|
}
|
|
3377
3083
|
// Cancel and clear order functions
|
|
3378
|
-
async cancelOrder() {
|
|
3379
|
-
|
|
3380
|
-
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
|
|
3381
|
-
}
|
|
3382
|
-
clearOrderFromSession() {
|
|
3383
|
-
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(ke());
|
|
3384
|
-
}
|
|
3385
|
-
// Private functions for fetching the current order from a session
|
|
3386
|
-
async restoreOrderFromSession() {
|
|
3387
|
-
const t = sessionStorage.getItem(this.orderIdKey);
|
|
3388
|
-
if (t) {
|
|
3389
|
-
this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
|
|
3390
|
-
try {
|
|
3391
|
-
await this.fetchOrder(t), this.debugLog("Order restored successfully"), this.store.dispatch(C(!1));
|
|
3392
|
-
} catch (n) {
|
|
3393
|
-
this.debugLog("Failed to restore order, clearing session", n), this.clearOrderFromSession();
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3084
|
+
async cancelOrder(t) {
|
|
3085
|
+
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.debugLog("Order cancelled successfully"));
|
|
3396
3086
|
}
|
|
3397
3087
|
async findOrder(t, n) {
|
|
3398
3088
|
try {
|
|
3399
|
-
return await this.sdk.findOrderById({ id: t, reference: n });
|
|
3400
|
-
} catch (
|
|
3401
|
-
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;
|
|
3402
3092
|
}
|
|
3403
3093
|
}
|
|
3404
|
-
async
|
|
3094
|
+
async findActiveOrder(t) {
|
|
3405
3095
|
this.debugLog("Fetching order from server", { orderId: t });
|
|
3406
3096
|
try {
|
|
3407
3097
|
const n = await this.sdk.findActiveOrderById({ id: t });
|
|
3408
|
-
if (!n?.findOrder)
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
const r =
|
|
3413
|
-
this.debugLog("Order fetched successfully", r);
|
|
3414
|
-
const i = r.items, s = i.filter((c) => c.product != null && c.amount > 0).map((c) => {
|
|
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) => {
|
|
3415
3103
|
let m = _.PRODUCT;
|
|
3416
|
-
return
|
|
3417
|
-
id:
|
|
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,
|
|
3418
3106
|
type: m,
|
|
3419
|
-
name:
|
|
3420
|
-
icon:
|
|
3421
|
-
description:
|
|
3422
|
-
amount:
|
|
3423
|
-
price:
|
|
3424
|
-
depositPrice:
|
|
3425
|
-
originalPrice:
|
|
3426
|
-
serviceFee:
|
|
3427
|
-
seats:
|
|
3428
|
-
id:
|
|
3429
|
-
label:
|
|
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
|
|
3430
3118
|
}))
|
|
3431
3119
|
};
|
|
3432
|
-
}), o =
|
|
3120
|
+
}), o = r.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, m) => {
|
|
3433
3121
|
const {
|
|
3434
|
-
packageItem:
|
|
3435
|
-
event:
|
|
3436
|
-
amount:
|
|
3437
|
-
price:
|
|
3438
|
-
serviceFee:
|
|
3439
|
-
depositPrice:
|
|
3440
|
-
originalPrice:
|
|
3441
|
-
} = m, A =
|
|
3442
|
-
|
|
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] = {
|
|
3443
3131
|
id: A,
|
|
3444
3132
|
type: _.PACKAGE,
|
|
3445
|
-
name:
|
|
3446
|
-
amount:
|
|
3447
|
-
price:
|
|
3448
|
-
serviceFee:
|
|
3449
|
-
depositPrice:
|
|
3450
|
-
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,
|
|
3451
3139
|
packageItems: []
|
|
3452
3140
|
};
|
|
3453
|
-
const
|
|
3454
|
-
zone:
|
|
3455
|
-
}),
|
|
3456
|
-
zone:
|
|
3141
|
+
const O = L.fromISO(I.startAt, {
|
|
3142
|
+
zone: I.timezone
|
|
3143
|
+
}), b = L.fromISO(I.endAt, {
|
|
3144
|
+
zone: I.timezone
|
|
3457
3145
|
});
|
|
3458
|
-
return
|
|
3459
|
-
packageItemId:
|
|
3460
|
-
eventId:
|
|
3461
|
-
name:
|
|
3462
|
-
startAt:
|
|
3463
|
-
endAt:
|
|
3464
|
-
}),
|
|
3465
|
-
}, {}),
|
|
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 = [
|
|
3466
3154
|
...s,
|
|
3467
3155
|
...Object.values(o)
|
|
3468
3156
|
];
|
|
3469
|
-
if (
|
|
3470
|
-
this.debugLog("All order items have zero or negative amounts, clearing session"),
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
currency: r.currency,
|
|
3492
|
-
price: c.originalPrice ?? 0,
|
|
3493
|
-
depositPrice: c.depositPrice,
|
|
3494
|
-
discountPrice: (c.price ?? 0) < (c.originalPrice ?? 0) ? c.price : void 0,
|
|
3495
|
-
serviceFee: c.serviceFee ?? 0,
|
|
3496
|
-
amount: c.amount,
|
|
3497
|
-
items: c.packageItems || []
|
|
3498
|
-
},
|
|
3499
|
-
amountReserved: c.amount,
|
|
3500
|
-
expiredAt: p.toJSDate().toISOString()
|
|
3501
|
-
})
|
|
3502
|
-
) : this.store.dispatch(
|
|
3503
|
-
Ee({
|
|
3504
|
-
input: {
|
|
3505
|
-
id: c.id,
|
|
3506
|
-
name: c.name,
|
|
3507
|
-
price: c.originalPrice ?? 0,
|
|
3508
|
-
depositPrice: c.depositPrice,
|
|
3509
|
-
discountPrice: (c.price ?? 0) < (c.originalPrice ?? 0) ? c.price : void 0,
|
|
3510
|
-
serviceFee: c.serviceFee,
|
|
3511
|
-
currency: r.currency,
|
|
3512
|
-
amount: c.amount
|
|
3513
|
-
},
|
|
3514
|
-
amountReserved: c.amount,
|
|
3515
|
-
expiredAt: p.toJSDate().toISOString()
|
|
3516
|
-
})
|
|
3517
|
-
);
|
|
3518
|
-
}), r.mainBooker && (this.debugLog("Order has customer (mainBooker)", r.mainBooker), this.store.dispatch(
|
|
3519
|
-
ve({
|
|
3520
|
-
firstName: r.mainBooker.firstName ?? void 0,
|
|
3521
|
-
lastName: r.mainBooker.lastName ?? void 0,
|
|
3522
|
-
email: r.mainBooker.email ?? void 0,
|
|
3523
|
-
age: r.mainBooker.age ?? void 0,
|
|
3524
|
-
gender: r.mainBooker.gender ?? void 0,
|
|
3525
|
-
residence: r.mainBooker.residence ?? void 0,
|
|
3526
|
-
extraInfo: r.mainBooker.extraInfo ?? void 0
|
|
3527
|
-
})
|
|
3528
|
-
)), 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
|
+
};
|
|
3529
3179
|
} catch (n) {
|
|
3530
3180
|
throw this.debugLog("Error fetching order", n), n;
|
|
3531
3181
|
}
|
|
3532
3182
|
}
|
|
3533
|
-
// Private helper functions
|
|
3534
|
-
generateOrderId() {
|
|
3535
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
3536
|
-
const n = Math.random() * 16 | 0;
|
|
3537
|
-
return (t === "x" ? n : n & 3 | 8).toString(16);
|
|
3538
|
-
});
|
|
3539
|
-
}
|
|
3540
3183
|
debugLog(t, n) {
|
|
3541
3184
|
this.config.debug && console.log(`[BasketService] ${t}`, n || "");
|
|
3542
3185
|
}
|
|
3543
3186
|
handleError(t) {
|
|
3544
3187
|
const n = t;
|
|
3545
3188
|
if (n.graphQLErrors && n.graphQLErrors.length > 0) {
|
|
3546
|
-
const
|
|
3547
|
-
|
|
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");
|
|
3548
3191
|
}
|
|
3549
3192
|
if (n.response?.errors && n.response.errors.length > 0) {
|
|
3550
|
-
const
|
|
3551
|
-
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);
|
|
3552
3195
|
}
|
|
3553
3196
|
}
|
|
3554
|
-
getState() {
|
|
3555
|
-
return this.store.getState().basket;
|
|
3556
|
-
}
|
|
3557
3197
|
}
|
|
3558
|
-
const
|
|
3559
|
-
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) {
|
|
3560
3200
|
findAllPublicEventByOrganizationId(
|
|
3561
3201
|
id: $organizationId
|
|
3562
3202
|
hostingIds: $hostingIds
|
|
3203
|
+
locationIds: $locationIds
|
|
3204
|
+
excludedEventIds: $excludedEventIds
|
|
3563
3205
|
trackerLinkId: $trackerId
|
|
3564
3206
|
filterEventStatuses: $filterEventStatuses
|
|
3565
3207
|
date: $dateRange
|
|
@@ -3589,11 +3231,12 @@ const ln = E`
|
|
|
3589
3231
|
}
|
|
3590
3232
|
infoDescription
|
|
3591
3233
|
startingPrice
|
|
3234
|
+
totalViews
|
|
3592
3235
|
}
|
|
3593
3236
|
count
|
|
3594
3237
|
}
|
|
3595
3238
|
}
|
|
3596
|
-
`,
|
|
3239
|
+
`, Wt = E`
|
|
3597
3240
|
query EventDetailPage($eventId: ID!) {
|
|
3598
3241
|
findPublicEventById(id: $eventId) {
|
|
3599
3242
|
id
|
|
@@ -3618,9 +3261,10 @@ const ln = E`
|
|
|
3618
3261
|
infoDescription
|
|
3619
3262
|
maxAmountOfTicketsPerOrder
|
|
3620
3263
|
startingPrice
|
|
3264
|
+
totalViews
|
|
3621
3265
|
}
|
|
3622
3266
|
}
|
|
3623
|
-
`,
|
|
3267
|
+
`, Zt = E`
|
|
3624
3268
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
3625
3269
|
findPublicProductsByEventId(
|
|
3626
3270
|
eventId: $eventId
|
|
@@ -3654,30 +3298,30 @@ const ln = E`
|
|
|
3654
3298
|
showEndSalesAtTag
|
|
3655
3299
|
}
|
|
3656
3300
|
}
|
|
3657
|
-
`,
|
|
3658
|
-
function
|
|
3301
|
+
`, Kt = (e, t, n, i) => e();
|
|
3302
|
+
function en(e, t = Kt) {
|
|
3659
3303
|
return {
|
|
3660
|
-
EventOverviewPage(n,
|
|
3661
|
-
return t((s) => e.request({ document:
|
|
3304
|
+
EventOverviewPage(n, i, r) {
|
|
3305
|
+
return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", n);
|
|
3662
3306
|
},
|
|
3663
|
-
EventDetailPage(n,
|
|
3664
|
-
return t((s) => e.request({ document:
|
|
3307
|
+
EventDetailPage(n, i, r) {
|
|
3308
|
+
return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", n);
|
|
3665
3309
|
},
|
|
3666
|
-
findProductsByEventId(n,
|
|
3667
|
-
return t((s) => e.request({ document:
|
|
3310
|
+
findProductsByEventId(n, i, r) {
|
|
3311
|
+
return t((s) => e.request({ document: Zt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findProductsByEventId", "query", n);
|
|
3668
3312
|
}
|
|
3669
3313
|
};
|
|
3670
3314
|
}
|
|
3671
|
-
function
|
|
3315
|
+
function tn(e) {
|
|
3672
3316
|
const t = /(query|mutation|subscription)\s+(\w+)/.exec(e);
|
|
3673
3317
|
if (!t) return { type: "unknown" };
|
|
3674
|
-
const n = t[1],
|
|
3675
|
-
return { type: n, name:
|
|
3318
|
+
const n = t[1], i = t[2];
|
|
3319
|
+
return { type: n, name: i };
|
|
3676
3320
|
}
|
|
3677
|
-
async function
|
|
3321
|
+
async function nn(e) {
|
|
3678
3322
|
if (typeof globalThis < "u" && globalThis.crypto?.subtle) {
|
|
3679
|
-
const n = new TextEncoder().encode(e),
|
|
3680
|
-
return Array.from(new Uint8Array(
|
|
3323
|
+
const n = new TextEncoder().encode(e), i = await globalThis.crypto.subtle.digest("SHA-256", n);
|
|
3324
|
+
return Array.from(new Uint8Array(i)).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
3681
3325
|
}
|
|
3682
3326
|
try {
|
|
3683
3327
|
const { createHash: t } = await import("./__vite-browser-external-l0sNRNKZ.js");
|
|
@@ -3686,82 +3330,82 @@ async function In(e) {
|
|
|
3686
3330
|
throw new Error("SHA-256 is not available in this environment");
|
|
3687
3331
|
}
|
|
3688
3332
|
}
|
|
3689
|
-
function
|
|
3333
|
+
function rn(e) {
|
|
3690
3334
|
const t = { "content-type": "application/json" };
|
|
3691
3335
|
if (e)
|
|
3692
|
-
for (const [n,
|
|
3693
|
-
typeof
|
|
3336
|
+
for (const [n, i] of Object.entries(e))
|
|
3337
|
+
typeof i < "u" && (t[n] = String(i));
|
|
3694
3338
|
return t;
|
|
3695
3339
|
}
|
|
3696
|
-
function
|
|
3340
|
+
function me(e, t) {
|
|
3697
3341
|
return e?.length ? e.some((n) => t.includes(n?.extensions?.code) || t.includes(n?.message)) : !1;
|
|
3698
3342
|
}
|
|
3699
|
-
function
|
|
3343
|
+
function ge(e, t, n, i, r) {
|
|
3700
3344
|
const s = new Error(e);
|
|
3701
|
-
return s.response = { data:
|
|
3345
|
+
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;
|
|
3702
3346
|
}
|
|
3703
|
-
function
|
|
3704
|
-
if (
|
|
3705
|
-
throw
|
|
3706
|
-
if (typeof
|
|
3707
|
-
throw
|
|
3708
|
-
return
|
|
3347
|
+
function ne(e, t, n, i, r) {
|
|
3348
|
+
if (r.json?.errors?.length)
|
|
3349
|
+
throw ge(`GraphQL request failed${e ? ` (${e})` : ""}`, t, n, i, r);
|
|
3350
|
+
if (typeof r.json?.data > "u")
|
|
3351
|
+
throw ge("GraphQL request failed: no data received", t, n, i, r);
|
|
3352
|
+
return r.json.data;
|
|
3709
3353
|
}
|
|
3710
|
-
class
|
|
3354
|
+
class Z extends oe {
|
|
3711
3355
|
async request(t, ...n) {
|
|
3712
|
-
let
|
|
3713
|
-
t && typeof t == "object" && "document" in t ? (
|
|
3714
|
-
const
|
|
3715
|
-
const
|
|
3716
|
-
let
|
|
3356
|
+
let i = t, r, s, o;
|
|
3357
|
+
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]);
|
|
3358
|
+
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) => {
|
|
3359
|
+
const b = await fetch(m, { method: "POST", headers: y, body: JSON.stringify(O), signal: o });
|
|
3360
|
+
let P = null;
|
|
3717
3361
|
try {
|
|
3718
|
-
|
|
3362
|
+
P = await b.json();
|
|
3719
3363
|
} catch {
|
|
3720
|
-
|
|
3364
|
+
P = null;
|
|
3721
3365
|
}
|
|
3722
|
-
return { status:
|
|
3723
|
-
},
|
|
3724
|
-
const
|
|
3725
|
-
for (const [
|
|
3726
|
-
typeof
|
|
3727
|
-
const
|
|
3728
|
-
let
|
|
3366
|
+
return { status: b.status, json: P };
|
|
3367
|
+
}, D = async (O) => {
|
|
3368
|
+
const b = new URLSearchParams();
|
|
3369
|
+
for (const [Ve, M] of Object.entries(O))
|
|
3370
|
+
typeof M > "u" || b.set(Ve, typeof M == "string" ? M : JSON.stringify(M));
|
|
3371
|
+
const P = m.includes("?") ? "&" : "?", $ = `${m}${P}${b.toString()}`, ue = await fetch($, { method: "GET", headers: y, signal: o });
|
|
3372
|
+
let K = null;
|
|
3729
3373
|
try {
|
|
3730
|
-
|
|
3374
|
+
K = await ue.json();
|
|
3731
3375
|
} catch {
|
|
3732
|
-
|
|
3376
|
+
K = null;
|
|
3733
3377
|
}
|
|
3734
|
-
return { status:
|
|
3735
|
-
},
|
|
3378
|
+
return { status: ue.status, json: K };
|
|
3379
|
+
}, N = {
|
|
3736
3380
|
operationName: p,
|
|
3737
|
-
variables:
|
|
3738
|
-
extensions: { persistedQuery: { version: 1, sha256Hash:
|
|
3739
|
-
},
|
|
3740
|
-
if (
|
|
3741
|
-
const
|
|
3742
|
-
return
|
|
3381
|
+
variables: d,
|
|
3382
|
+
extensions: { persistedQuery: { version: 1, sha256Hash: g } }
|
|
3383
|
+
}, k = async (O, b, P) => {
|
|
3384
|
+
if (me(O.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
|
|
3385
|
+
const $ = await b();
|
|
3386
|
+
return ne("APQ register", l, d, p, $);
|
|
3743
3387
|
}
|
|
3744
|
-
if (
|
|
3745
|
-
const
|
|
3746
|
-
return
|
|
3388
|
+
if (me(O.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
|
|
3389
|
+
const $ = await P();
|
|
3390
|
+
return ne("no APQ support", l, d, p, $);
|
|
3747
3391
|
}
|
|
3748
|
-
return
|
|
3392
|
+
return ne("", l, d, p, O);
|
|
3749
3393
|
};
|
|
3750
|
-
if (
|
|
3751
|
-
const
|
|
3752
|
-
return
|
|
3394
|
+
if (f === "query") {
|
|
3395
|
+
const O = await D(N);
|
|
3396
|
+
return k(O, () => I({ ...N, query: l }), () => I({ operationName: p, variables: d, query: l }));
|
|
3753
3397
|
}
|
|
3754
|
-
const
|
|
3755
|
-
return
|
|
3398
|
+
const C = await I(N);
|
|
3399
|
+
return k(C, () => I({ ...N, query: l }), () => I({ operationName: p, variables: d, query: l }));
|
|
3756
3400
|
}
|
|
3757
3401
|
}
|
|
3758
|
-
class
|
|
3402
|
+
class sn {
|
|
3759
3403
|
config;
|
|
3760
3404
|
sdk;
|
|
3761
3405
|
constructor(t) {
|
|
3762
|
-
this.config = t, this.sdk =
|
|
3406
|
+
this.config = t, this.sdk = en(new Z(t.apiUrl));
|
|
3763
3407
|
}
|
|
3764
|
-
async
|
|
3408
|
+
async getEvents(t = {}) {
|
|
3765
3409
|
try {
|
|
3766
3410
|
t.page && (t.page = {
|
|
3767
3411
|
index: t.page.index ?? 0,
|
|
@@ -3778,6 +3422,8 @@ class yn {
|
|
|
3778
3422
|
const n = await this.sdk.EventOverviewPage({
|
|
3779
3423
|
organizationId: this.config.organizationId,
|
|
3780
3424
|
hostingIds: t.hostingIds,
|
|
3425
|
+
locationIds: t.locationIds,
|
|
3426
|
+
excludedEventIds: t.excludedEventIds,
|
|
3781
3427
|
filterEventStatuses: t.statuses,
|
|
3782
3428
|
dateRange: t.dateRange && t.dateRange.from && t.dateRange.till ? {
|
|
3783
3429
|
from: t.dateRange.from.toISO(),
|
|
@@ -3790,65 +3436,67 @@ class yn {
|
|
|
3790
3436
|
priceRange: t.priceRange
|
|
3791
3437
|
});
|
|
3792
3438
|
if (this.debugLog("Raw GraphQL response", n), n?.findAllPublicEventByOrganizationId?.data) {
|
|
3793
|
-
const
|
|
3794
|
-
id:
|
|
3795
|
-
name:
|
|
3796
|
-
icon:
|
|
3797
|
-
banner:
|
|
3798
|
-
description:
|
|
3799
|
-
addonDescription:
|
|
3800
|
-
startAt:
|
|
3801
|
-
endAt:
|
|
3802
|
-
timezone:
|
|
3439
|
+
const i = n.findAllPublicEventByOrganizationId.data.map((r) => ({
|
|
3440
|
+
id: r.id,
|
|
3441
|
+
name: r.name,
|
|
3442
|
+
icon: r.icon,
|
|
3443
|
+
banner: r.banner,
|
|
3444
|
+
description: r.description,
|
|
3445
|
+
addonDescription: r.addonDescription,
|
|
3446
|
+
startAt: L.fromISO(r.startAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
3447
|
+
endAt: L.fromISO(r.endAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
3448
|
+
timezone: r.timezone,
|
|
3803
3449
|
startSalesAt: null,
|
|
3804
3450
|
endSalesAt: null,
|
|
3805
|
-
slug:
|
|
3451
|
+
slug: r.slug ?? "ERROR",
|
|
3806
3452
|
facebookPixelId: null,
|
|
3807
|
-
status:
|
|
3808
|
-
location:
|
|
3809
|
-
id:
|
|
3810
|
-
name:
|
|
3811
|
-
address:
|
|
3453
|
+
status: r.status,
|
|
3454
|
+
location: r.location ? {
|
|
3455
|
+
id: r.location.id,
|
|
3456
|
+
name: r.location.name,
|
|
3457
|
+
address: r.location.address
|
|
3812
3458
|
} : void 0,
|
|
3813
|
-
infoDescription:
|
|
3814
|
-
startingPrice:
|
|
3459
|
+
infoDescription: r.infoDescription,
|
|
3460
|
+
startingPrice: r.startingPrice,
|
|
3461
|
+
totalViews: r.totalViews
|
|
3815
3462
|
}));
|
|
3816
|
-
return this.debugLog("Processed events", { events:
|
|
3463
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, n.findAllPublicEventByOrganizationId.count ?? 0];
|
|
3817
3464
|
} else
|
|
3818
3465
|
return this.debugLog("No events found in response"), [[], 0];
|
|
3819
3466
|
} catch (n) {
|
|
3820
3467
|
throw this.debugLog("Error fetching events", n), n;
|
|
3821
3468
|
}
|
|
3822
3469
|
}
|
|
3823
|
-
async
|
|
3470
|
+
async getEvent(t) {
|
|
3824
3471
|
try {
|
|
3825
3472
|
this.debugLog("Fetching single event", { eventId: t });
|
|
3826
3473
|
const n = await this.sdk.EventDetailPage({ eventId: t });
|
|
3827
3474
|
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
3828
|
-
const
|
|
3829
|
-
id:
|
|
3830
|
-
name:
|
|
3831
|
-
icon:
|
|
3832
|
-
banner:
|
|
3833
|
-
description:
|
|
3834
|
-
addonDescription:
|
|
3835
|
-
startAt:
|
|
3836
|
-
endAt:
|
|
3837
|
-
timezone:
|
|
3838
|
-
startSalesAt:
|
|
3839
|
-
endSalesAt:
|
|
3840
|
-
slug:
|
|
3841
|
-
facebookPixelId:
|
|
3842
|
-
status:
|
|
3843
|
-
location:
|
|
3844
|
-
id:
|
|
3845
|
-
name:
|
|
3846
|
-
address:
|
|
3475
|
+
const i = n.findPublicEventById, r = {
|
|
3476
|
+
id: i.id,
|
|
3477
|
+
name: i.name,
|
|
3478
|
+
icon: i.icon,
|
|
3479
|
+
banner: i.banner,
|
|
3480
|
+
description: i.description,
|
|
3481
|
+
addonDescription: i.addonDescription,
|
|
3482
|
+
startAt: L.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3483
|
+
endAt: L.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
3484
|
+
timezone: i.timezone,
|
|
3485
|
+
startSalesAt: i.startSalesAt,
|
|
3486
|
+
endSalesAt: i.endSalesAt,
|
|
3487
|
+
slug: i.slug ?? "ERROR",
|
|
3488
|
+
facebookPixelId: i.facebookPixelId,
|
|
3489
|
+
status: i.status,
|
|
3490
|
+
location: i.location ? {
|
|
3491
|
+
id: i.location.id,
|
|
3492
|
+
name: i.location.name,
|
|
3493
|
+
address: i.location.address
|
|
3847
3494
|
} : void 0,
|
|
3848
|
-
infoDescription:
|
|
3849
|
-
startingPrice:
|
|
3495
|
+
infoDescription: i.infoDescription,
|
|
3496
|
+
startingPrice: i.startingPrice,
|
|
3497
|
+
totalViews: i.totalViews
|
|
3850
3498
|
};
|
|
3851
|
-
return this.debugLog("Processed single event",
|
|
3499
|
+
return this.debugLog("Processed single event", r), r;
|
|
3852
3500
|
} else {
|
|
3853
3501
|
this.debugLog("No event found for id", t);
|
|
3854
3502
|
return;
|
|
@@ -3857,22 +3505,22 @@ class yn {
|
|
|
3857
3505
|
throw this.debugLog("Error fetching single event", n), n;
|
|
3858
3506
|
}
|
|
3859
3507
|
}
|
|
3860
|
-
async
|
|
3508
|
+
async getProducts(t, n, i) {
|
|
3861
3509
|
try {
|
|
3862
3510
|
this.debugLog("Fetching products for event", {
|
|
3863
3511
|
eventId: t,
|
|
3864
|
-
promoCode:
|
|
3512
|
+
promoCode: i,
|
|
3865
3513
|
trackerId: this.config.trackerId,
|
|
3866
3514
|
productTypes: n
|
|
3867
3515
|
});
|
|
3868
|
-
const
|
|
3516
|
+
const r = await this.sdk.findProductsByEventId({
|
|
3869
3517
|
eventId: t,
|
|
3870
|
-
promoCode:
|
|
3518
|
+
promoCode: i,
|
|
3871
3519
|
trackerId: this.config.trackerId,
|
|
3872
3520
|
productTypes: n
|
|
3873
3521
|
});
|
|
3874
|
-
if (
|
|
3875
|
-
const s =
|
|
3522
|
+
if (r?.findPublicProductsByEventId) {
|
|
3523
|
+
const s = r.findPublicProductsByEventId.map((o) => ({
|
|
3876
3524
|
id: o.id,
|
|
3877
3525
|
name: o.name,
|
|
3878
3526
|
category: o.category ? {
|
|
@@ -3903,21 +3551,22 @@ class yn {
|
|
|
3903
3551
|
}), s;
|
|
3904
3552
|
}
|
|
3905
3553
|
return;
|
|
3906
|
-
} catch (
|
|
3907
|
-
throw this.debugLog("Error fetching products", { eventId: t, error:
|
|
3554
|
+
} catch (r) {
|
|
3555
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: r }), r;
|
|
3908
3556
|
}
|
|
3909
3557
|
}
|
|
3910
3558
|
debugLog(t, n) {
|
|
3911
3559
|
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
|
|
3912
3560
|
}
|
|
3913
3561
|
}
|
|
3914
|
-
const
|
|
3915
|
-
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
|
|
3562
|
+
const an = E`
|
|
3563
|
+
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
3916
3564
|
findPaymentDetails(
|
|
3917
3565
|
orderId: $orderId
|
|
3918
3566
|
orderItemId: $orderItemId
|
|
3919
3567
|
amountOfTickets: $amountOfTickets
|
|
3920
3568
|
paymentMethodId: $paymentMethodId
|
|
3569
|
+
withTicketProtection: $withTicketProtection
|
|
3921
3570
|
) {
|
|
3922
3571
|
methods {
|
|
3923
3572
|
id
|
|
@@ -3939,26 +3588,26 @@ const vn = E`
|
|
|
3939
3588
|
paymentSpesificTransactionFee
|
|
3940
3589
|
}
|
|
3941
3590
|
}
|
|
3942
|
-
`,
|
|
3591
|
+
`, on = E`
|
|
3943
3592
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3944
3593
|
createDigitalOrderPayment(input: $input)
|
|
3945
3594
|
}
|
|
3946
|
-
`,
|
|
3947
|
-
function
|
|
3595
|
+
`, cn = (e, t, n, i) => e();
|
|
3596
|
+
function dn(e, t = cn) {
|
|
3948
3597
|
return {
|
|
3949
|
-
findPaymentMethods(n,
|
|
3950
|
-
return t((s) => e.request({ document:
|
|
3598
|
+
findPaymentMethods(n, i, r) {
|
|
3599
|
+
return t((s) => e.request({ document: an, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", n);
|
|
3951
3600
|
},
|
|
3952
|
-
createDigitalPayment(n,
|
|
3953
|
-
return t((s) => e.request({ document:
|
|
3601
|
+
createDigitalPayment(n, i, r) {
|
|
3602
|
+
return t((s) => e.request({ document: on, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", n);
|
|
3954
3603
|
}
|
|
3955
3604
|
};
|
|
3956
3605
|
}
|
|
3957
|
-
class
|
|
3606
|
+
class un {
|
|
3958
3607
|
config;
|
|
3959
3608
|
sdk;
|
|
3960
3609
|
constructor(t) {
|
|
3961
|
-
this.config = t, this.sdk =
|
|
3610
|
+
this.config = t, this.sdk = dn(new oe(t.apiUrl));
|
|
3962
3611
|
}
|
|
3963
3612
|
async getPaymentDetails(t) {
|
|
3964
3613
|
this.debugLog("Fetching payment methods", t);
|
|
@@ -3967,31 +3616,32 @@ class Tn {
|
|
|
3967
3616
|
orderId: t.orderId,
|
|
3968
3617
|
orderItemId: t.orderItemId,
|
|
3969
3618
|
amountOfTickets: t.amountOfTickets,
|
|
3970
|
-
paymentMethodId: t.paymentMethodId
|
|
3619
|
+
paymentMethodId: t.paymentMethodId,
|
|
3620
|
+
withTicketProtection: t.withTicketProtection
|
|
3971
3621
|
});
|
|
3972
3622
|
if (!n?.findPaymentDetails)
|
|
3973
3623
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
3974
|
-
const
|
|
3624
|
+
const i = n.findPaymentDetails;
|
|
3975
3625
|
return this.debugLog("Payment methods fetched successfully", {
|
|
3976
|
-
methodCount:
|
|
3977
|
-
transactionPrice:
|
|
3978
|
-
transactionDiscount:
|
|
3979
|
-
transactionFee:
|
|
3980
|
-
paymentSpesificTransactionFee:
|
|
3626
|
+
methodCount: i.methods?.length ?? 0,
|
|
3627
|
+
transactionPrice: i.transactionPrice,
|
|
3628
|
+
transactionDiscount: i.transactionDiscount,
|
|
3629
|
+
transactionFee: i.transactionFee,
|
|
3630
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee
|
|
3981
3631
|
}), {
|
|
3982
|
-
transactionPrice:
|
|
3983
|
-
transactionDiscount:
|
|
3984
|
-
transactionFee:
|
|
3985
|
-
paymentSpesificTransactionFee:
|
|
3986
|
-
methods:
|
|
3987
|
-
id:
|
|
3988
|
-
name:
|
|
3989
|
-
image:
|
|
3990
|
-
fee:
|
|
3991
|
-
type:
|
|
3992
|
-
value:
|
|
3632
|
+
transactionPrice: i.transactionPrice,
|
|
3633
|
+
transactionDiscount: i.transactionPrice,
|
|
3634
|
+
transactionFee: i.transactionFee ?? null,
|
|
3635
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee ?? null,
|
|
3636
|
+
methods: i.methods?.map((r) => ({
|
|
3637
|
+
id: r.id,
|
|
3638
|
+
name: r.name,
|
|
3639
|
+
image: r.image,
|
|
3640
|
+
fee: r.fee ? {
|
|
3641
|
+
type: r.fee.type,
|
|
3642
|
+
value: r.fee.value
|
|
3993
3643
|
} : null,
|
|
3994
|
-
issuers:
|
|
3644
|
+
issuers: r.issuers?.map((s) => ({
|
|
3995
3645
|
id: s.id,
|
|
3996
3646
|
name: s.name,
|
|
3997
3647
|
image: s.image
|
|
@@ -4014,16 +3664,17 @@ class Tn {
|
|
|
4014
3664
|
initiatedByUserId: t.initiatedByUserId,
|
|
4015
3665
|
initiatedByTeamId: t.initiatedByTeamId,
|
|
4016
3666
|
amountOfTickets: t.amountOfTickets,
|
|
4017
|
-
orderItemId: t.orderItemId
|
|
3667
|
+
orderItemId: t.orderItemId,
|
|
3668
|
+
withTicketProtection: t.withTicketProtection
|
|
4018
3669
|
};
|
|
4019
3670
|
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);
|
|
4020
|
-
const
|
|
3671
|
+
const i = await this.sdk.createDigitalPayment({
|
|
4021
3672
|
input: n
|
|
4022
3673
|
});
|
|
4023
|
-
if (!
|
|
3674
|
+
if (!i?.createDigitalOrderPayment)
|
|
4024
3675
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
4025
|
-
const
|
|
4026
|
-
return this.debugLog("Payment created successfully", { paymentUrl:
|
|
3676
|
+
const r = i.createDigitalOrderPayment;
|
|
3677
|
+
return this.debugLog("Payment created successfully", { paymentUrl: r }), { paymentUrl: r };
|
|
4027
3678
|
} catch (n) {
|
|
4028
3679
|
throw this.debugLog("Error creating payment", n), n;
|
|
4029
3680
|
}
|
|
@@ -4032,7 +3683,7 @@ class Tn {
|
|
|
4032
3683
|
this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
|
|
4033
3684
|
}
|
|
4034
3685
|
}
|
|
4035
|
-
const
|
|
3686
|
+
const ln = E`
|
|
4036
3687
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
4037
3688
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
4038
3689
|
data {
|
|
@@ -4057,7 +3708,7 @@ const Dn = E`
|
|
|
4057
3708
|
count
|
|
4058
3709
|
}
|
|
4059
3710
|
}
|
|
4060
|
-
`,
|
|
3711
|
+
`, pn = E`
|
|
4061
3712
|
query findPublicPackageById($packageId: ID!) {
|
|
4062
3713
|
findPublicPackageById(id: $packageId) {
|
|
4063
3714
|
id
|
|
@@ -4083,7 +3734,7 @@ const Dn = E`
|
|
|
4083
3734
|
}
|
|
4084
3735
|
}
|
|
4085
3736
|
}
|
|
4086
|
-
`,
|
|
3737
|
+
`, hn = E`
|
|
4087
3738
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
4088
3739
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
4089
3740
|
data {
|
|
@@ -4118,25 +3769,25 @@ const Dn = E`
|
|
|
4118
3769
|
count
|
|
4119
3770
|
}
|
|
4120
3771
|
}
|
|
4121
|
-
`,
|
|
4122
|
-
function
|
|
3772
|
+
`, fn = (e, t, n, i) => e();
|
|
3773
|
+
function mn(e, t = fn) {
|
|
4123
3774
|
return {
|
|
4124
|
-
findAllPublicPackagesByOrganizationId(n,
|
|
4125
|
-
return t((s) => e.request({ document:
|
|
3775
|
+
findAllPublicPackagesByOrganizationId(n, i, r) {
|
|
3776
|
+
return t((s) => e.request({ document: ln, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
4126
3777
|
},
|
|
4127
|
-
findPublicPackageById(n,
|
|
4128
|
-
return t((s) => e.request({ document:
|
|
3778
|
+
findPublicPackageById(n, i, r) {
|
|
3779
|
+
return t((s) => e.request({ document: pn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", n);
|
|
4129
3780
|
},
|
|
4130
|
-
findPublicItemsByPackageId(n,
|
|
4131
|
-
return t((s) => e.request({ document:
|
|
3781
|
+
findPublicItemsByPackageId(n, i, r) {
|
|
3782
|
+
return t((s) => e.request({ document: hn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", n);
|
|
4132
3783
|
}
|
|
4133
3784
|
};
|
|
4134
3785
|
}
|
|
4135
|
-
class
|
|
3786
|
+
class gn {
|
|
4136
3787
|
config;
|
|
4137
3788
|
sdk;
|
|
4138
3789
|
constructor(t) {
|
|
4139
|
-
this.config = t, this.sdk =
|
|
3790
|
+
this.config = t, this.sdk = mn(new Z(t.apiUrl));
|
|
4140
3791
|
}
|
|
4141
3792
|
debugLog(t, n) {
|
|
4142
3793
|
this.config.debug && console.log(`[PackageService] ${t}`, n || "");
|
|
@@ -4153,15 +3804,15 @@ class Sn {
|
|
|
4153
3804
|
tab: t.tab,
|
|
4154
3805
|
statuses: t.statuses
|
|
4155
3806
|
});
|
|
4156
|
-
const
|
|
3807
|
+
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
4157
3808
|
organizationId: this.config.organizationId
|
|
4158
3809
|
});
|
|
4159
|
-
if (
|
|
4160
|
-
const
|
|
3810
|
+
if (i?.findAllPublicPackagesByOrganizationId) {
|
|
3811
|
+
const r = i.findAllPublicPackagesByOrganizationId;
|
|
4161
3812
|
return this.debugLog("Public packages fetched", {
|
|
4162
|
-
count:
|
|
4163
|
-
dataLength:
|
|
4164
|
-
}),
|
|
3813
|
+
count: r.count,
|
|
3814
|
+
dataLength: r.data.length
|
|
3815
|
+
}), r.data;
|
|
4165
3816
|
}
|
|
4166
3817
|
return null;
|
|
4167
3818
|
} catch (n) {
|
|
@@ -4175,37 +3826,45 @@ class Sn {
|
|
|
4175
3826
|
});
|
|
4176
3827
|
const n = await this.sdk.findPublicPackageById({ packageId: t });
|
|
4177
3828
|
if (n?.findPublicPackageById) {
|
|
4178
|
-
const
|
|
4179
|
-
return this.debugLog("Public package fetched"),
|
|
3829
|
+
const i = n.findPublicPackageById;
|
|
3830
|
+
return this.debugLog("Public package fetched"), i;
|
|
4180
3831
|
}
|
|
4181
3832
|
return null;
|
|
4182
3833
|
} catch (n) {
|
|
4183
3834
|
throw this.debugLog("Error fetching public packages", n), n;
|
|
4184
3835
|
}
|
|
4185
3836
|
}
|
|
4186
|
-
async getPackageItems(t, n = [
|
|
3837
|
+
async getPackageItems(t, n = [H.Regular, H.AdditionalEvent]) {
|
|
4187
3838
|
try {
|
|
4188
3839
|
this.debugLog("Fetching public package items", { packageId: t, types: n });
|
|
4189
|
-
const
|
|
3840
|
+
const i = await this.sdk.findPublicItemsByPackageId({
|
|
4190
3841
|
packageId: t,
|
|
4191
3842
|
types: n,
|
|
4192
3843
|
page: { index: 0, size: 100 }
|
|
4193
3844
|
});
|
|
4194
|
-
if (
|
|
4195
|
-
const
|
|
3845
|
+
if (i?.findPublicItemsByPackageId) {
|
|
3846
|
+
const r = i.findPublicItemsByPackageId;
|
|
4196
3847
|
return this.debugLog("Public package items fetched", {
|
|
4197
|
-
count:
|
|
4198
|
-
dataLength:
|
|
4199
|
-
}),
|
|
3848
|
+
count: r.count,
|
|
3849
|
+
dataLength: r.data.length
|
|
3850
|
+
}), r.data;
|
|
4200
3851
|
}
|
|
4201
3852
|
return null;
|
|
4202
|
-
} catch (
|
|
4203
|
-
throw this.debugLog("Error fetching public package items",
|
|
3853
|
+
} catch (i) {
|
|
3854
|
+
throw this.debugLog("Error fetching public package items", i), i;
|
|
4204
3855
|
}
|
|
4205
3856
|
}
|
|
4206
3857
|
}
|
|
4207
|
-
const
|
|
3858
|
+
const In = E`
|
|
4208
3859
|
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
3860
|
+
findAllPublicLocationsByOrganizationId(id: $organizationId) {
|
|
3861
|
+
data {
|
|
3862
|
+
id
|
|
3863
|
+
name
|
|
3864
|
+
amountOfActiveEvents(input: $dateRange)
|
|
3865
|
+
}
|
|
3866
|
+
count
|
|
3867
|
+
}
|
|
4209
3868
|
findAllPublicHostingsByOrganizationId(id: $organizationId) {
|
|
4210
3869
|
data {
|
|
4211
3870
|
id
|
|
@@ -4216,7 +3875,7 @@ const Cn = E`
|
|
|
4216
3875
|
count
|
|
4217
3876
|
}
|
|
4218
3877
|
}
|
|
4219
|
-
`,
|
|
3878
|
+
`, En = E`
|
|
4220
3879
|
query findPublicCategoryById($hostingId: ID!, $dateRange: DateRangeInput) {
|
|
4221
3880
|
findPublicHostingById(id: $hostingId) {
|
|
4222
3881
|
id
|
|
@@ -4224,23 +3883,28 @@ const Cn = E`
|
|
|
4224
3883
|
icon
|
|
4225
3884
|
amountOfActiveEvents(input: $dateRange)
|
|
4226
3885
|
}
|
|
3886
|
+
findPublicLocationById(id: $hostingId) {
|
|
3887
|
+
id
|
|
3888
|
+
name
|
|
3889
|
+
amountOfActiveEvents(input: $dateRange)
|
|
3890
|
+
}
|
|
4227
3891
|
}
|
|
4228
|
-
`,
|
|
4229
|
-
function
|
|
3892
|
+
`, yn = (e, t, n, i) => e();
|
|
3893
|
+
function vn(e, t = yn) {
|
|
4230
3894
|
return {
|
|
4231
|
-
findAllPublicCategoriesByOrganizationId(n,
|
|
4232
|
-
return t((s) => e.request({ document:
|
|
3895
|
+
findAllPublicCategoriesByOrganizationId(n, i, r) {
|
|
3896
|
+
return t((s) => e.request({ document: In, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
4233
3897
|
},
|
|
4234
|
-
findPublicCategoryById(n,
|
|
4235
|
-
return t((s) => e.request({ document:
|
|
3898
|
+
findPublicCategoryById(n, i, r) {
|
|
3899
|
+
return t((s) => e.request({ document: En, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicCategoryById", "query", n);
|
|
4236
3900
|
}
|
|
4237
3901
|
};
|
|
4238
3902
|
}
|
|
4239
|
-
class
|
|
3903
|
+
class Tn {
|
|
4240
3904
|
config;
|
|
4241
3905
|
sdk;
|
|
4242
3906
|
constructor(t) {
|
|
4243
|
-
this.config = t, this.sdk =
|
|
3907
|
+
this.config = t, this.sdk = vn(new Z(t.apiUrl));
|
|
4244
3908
|
}
|
|
4245
3909
|
debugLog(t, n) {
|
|
4246
3910
|
this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
|
|
@@ -4250,73 +3914,81 @@ class Fn {
|
|
|
4250
3914
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
4251
3915
|
const n = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId, dateRange: t });
|
|
4252
3916
|
if (n?.findAllPublicHostingsByOrganizationId) {
|
|
4253
|
-
const r = n.
|
|
4254
|
-
return this.debugLog("Categories fetched", { count: r.count, dataLength:
|
|
3917
|
+
const i = n.findAllPublicHostingsByOrganizationId, r = n.findAllPublicLocationsByOrganizationId;
|
|
3918
|
+
return this.debugLog("Categories fetched", { count: i.count + r.count, dataLength: i.data.length + r.data.length }), [
|
|
3919
|
+
...i.data.map((s) => ({ id: s.id, name: s.name, icon: s.icon, activeEvents: s.amountOfActiveEvents, type: "HOSTING" })),
|
|
3920
|
+
...r.data.map((s) => ({ id: s.id, name: s.name, activeEvents: s.amountOfActiveEvents, type: "LOCATION" }))
|
|
3921
|
+
];
|
|
4255
3922
|
}
|
|
4256
3923
|
return [];
|
|
4257
3924
|
} catch (n) {
|
|
4258
3925
|
throw this.debugLog("Error fetching categories", n), n;
|
|
4259
3926
|
}
|
|
4260
3927
|
}
|
|
4261
|
-
async getCategory(t) {
|
|
3928
|
+
async getCategory(t, n) {
|
|
4262
3929
|
try {
|
|
4263
3930
|
this.debugLog("Fetching category", { categoryId: t });
|
|
4264
|
-
const
|
|
4265
|
-
if (n
|
|
4266
|
-
|
|
4267
|
-
|
|
3931
|
+
const i = await this.sdk.findPublicCategoryById({ hostingId: t });
|
|
3932
|
+
if (n === "HOSTING") {
|
|
3933
|
+
if (i?.findPublicHostingById) {
|
|
3934
|
+
const r = i.findPublicHostingById;
|
|
3935
|
+
return this.debugLog("Category fetched", r), { id: r.id, name: r.name, icon: r.icon, activeEvents: r.amountOfActiveEvents, type: n };
|
|
3936
|
+
}
|
|
3937
|
+
} else if (i?.findPublicLocationById) {
|
|
3938
|
+
const r = i.findPublicLocationById;
|
|
3939
|
+
return this.debugLog("Category fetched", r), { id: r.id, name: r.name, activeEvents: r.amountOfActiveEvents, type: n };
|
|
4268
3940
|
}
|
|
4269
3941
|
return null;
|
|
4270
|
-
} catch (
|
|
4271
|
-
throw this.debugLog("Error fetching category",
|
|
3942
|
+
} catch (i) {
|
|
3943
|
+
throw this.debugLog("Error fetching category", i), i;
|
|
4272
3944
|
}
|
|
4273
3945
|
}
|
|
4274
3946
|
}
|
|
4275
|
-
const
|
|
3947
|
+
const An = E`
|
|
4276
3948
|
mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
|
|
4277
3949
|
createShopView(id: $id, trackerId: $trackerLinkId)
|
|
4278
3950
|
}
|
|
4279
|
-
`,
|
|
3951
|
+
`, kn = E`
|
|
4280
3952
|
mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
4281
3953
|
createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
4282
3954
|
}
|
|
4283
|
-
`,
|
|
3955
|
+
`, On = E`
|
|
4284
3956
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
4285
3957
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
4286
3958
|
}
|
|
4287
|
-
`,
|
|
4288
|
-
function
|
|
3959
|
+
`, Dn = (e, t, n, i) => e();
|
|
3960
|
+
function Nn(e, t = Dn) {
|
|
4289
3961
|
return {
|
|
4290
|
-
CreateShopView(n,
|
|
4291
|
-
return t((s) => e.request({ document:
|
|
3962
|
+
CreateShopView(n, i, r) {
|
|
3963
|
+
return t((s) => e.request({ document: An, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateShopView", "mutation", n);
|
|
4292
3964
|
},
|
|
4293
|
-
CreateEventView(n,
|
|
4294
|
-
return t((s) => e.request({ document:
|
|
3965
|
+
CreateEventView(n, i, r) {
|
|
3966
|
+
return t((s) => e.request({ document: kn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateEventView", "mutation", n);
|
|
4295
3967
|
},
|
|
4296
|
-
CreatePackageView(n,
|
|
4297
|
-
return t((s) => e.request({ document:
|
|
3968
|
+
CreatePackageView(n, i, r) {
|
|
3969
|
+
return t((s) => e.request({ document: On, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreatePackageView", "mutation", n);
|
|
4298
3970
|
}
|
|
4299
3971
|
};
|
|
4300
3972
|
}
|
|
4301
|
-
class
|
|
3973
|
+
class bn {
|
|
4302
3974
|
config;
|
|
4303
3975
|
sdk;
|
|
4304
3976
|
constructor(t) {
|
|
4305
|
-
this.config = t, this.sdk =
|
|
3977
|
+
this.config = t, this.sdk = Nn(new Z(t.apiUrl));
|
|
4306
3978
|
}
|
|
4307
|
-
createMetric = async (t, n,
|
|
4308
|
-
switch (!n && !
|
|
3979
|
+
createMetric = async (t, n, i) => {
|
|
3980
|
+
switch (!n && !i && await this.sdk.CreateShopView({
|
|
4309
3981
|
id: t,
|
|
4310
3982
|
trackerLinkId: this.config.trackerId
|
|
4311
|
-
}),
|
|
4312
|
-
case
|
|
3983
|
+
}), i) {
|
|
3984
|
+
case Y.Event:
|
|
4313
3985
|
await this.sdk.CreateEventView({
|
|
4314
3986
|
id: t,
|
|
4315
3987
|
shopId: n,
|
|
4316
3988
|
trackerLinkId: this.config.trackerId
|
|
4317
3989
|
});
|
|
4318
3990
|
break;
|
|
4319
|
-
case
|
|
3991
|
+
case Y.Package:
|
|
4320
3992
|
await this.sdk.CreatePackageView(
|
|
4321
3993
|
{
|
|
4322
3994
|
id: t,
|
|
@@ -4328,8 +4000,8 @@ class Mn {
|
|
|
4328
4000
|
}
|
|
4329
4001
|
};
|
|
4330
4002
|
}
|
|
4331
|
-
const
|
|
4332
|
-
class
|
|
4003
|
+
const xn = "https://api.ticketapp.com/graphql", Ie = "TIC_TRACKER_ID";
|
|
4004
|
+
class Cn {
|
|
4333
4005
|
basket;
|
|
4334
4006
|
event;
|
|
4335
4007
|
payment;
|
|
@@ -4337,10 +4009,10 @@ class Yn {
|
|
|
4337
4009
|
category;
|
|
4338
4010
|
metric;
|
|
4339
4011
|
// Attach selected public types to the SDK class
|
|
4340
|
-
static Types =
|
|
4012
|
+
static Types = Ue;
|
|
4341
4013
|
constructor(t) {
|
|
4342
|
-
const { organizationId: n, debug:
|
|
4343
|
-
this.basket = new
|
|
4014
|
+
const { organizationId: n, debug: i = !1, apiUrl: r = xn } = t, s = this.getOrInitTrackerId();
|
|
4015
|
+
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 });
|
|
4344
4016
|
}
|
|
4345
4017
|
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
4346
4018
|
// Persist to session when found via config or URL for subsequent page loads
|
|
@@ -4353,13 +4025,13 @@ class Yn {
|
|
|
4353
4025
|
} catch {
|
|
4354
4026
|
}
|
|
4355
4027
|
try {
|
|
4356
|
-
t = window.sessionStorage?.getItem(
|
|
4028
|
+
t = window.sessionStorage?.getItem(Ie) ?? null;
|
|
4357
4029
|
} catch {
|
|
4358
4030
|
}
|
|
4359
4031
|
}
|
|
4360
4032
|
if (n && n.trim().length > 0) {
|
|
4361
4033
|
try {
|
|
4362
|
-
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(
|
|
4034
|
+
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Ie, n);
|
|
4363
4035
|
} catch {
|
|
4364
4036
|
}
|
|
4365
4037
|
return n;
|
|
@@ -4367,8 +4039,8 @@ class Yn {
|
|
|
4367
4039
|
if (t && t.trim().length > 0) {
|
|
4368
4040
|
try {
|
|
4369
4041
|
if (typeof window < "u") {
|
|
4370
|
-
const
|
|
4371
|
-
|
|
4042
|
+
const i = new URL(window.location.href);
|
|
4043
|
+
i.searchParams.get("trackerId") || (i.searchParams.set("trackerId", t), window.history.replaceState({}, "", i.toString()));
|
|
4372
4044
|
}
|
|
4373
4045
|
} catch {
|
|
4374
4046
|
}
|
|
@@ -4382,16 +4054,16 @@ class Yn {
|
|
|
4382
4054
|
}
|
|
4383
4055
|
export {
|
|
4384
4056
|
_ as BasketOrderType,
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4057
|
+
Ne as DiscountType,
|
|
4058
|
+
ve as EventStatus,
|
|
4059
|
+
Y as MetricsType,
|
|
4060
|
+
De as OrderItemType,
|
|
4061
|
+
H as PackageItemType,
|
|
4062
|
+
Ee as PackageStatus,
|
|
4063
|
+
ye as PackageTabType,
|
|
4064
|
+
Oe as PaymentMethodFeeType,
|
|
4065
|
+
Ae as ProductStatus,
|
|
4066
|
+
ke as ProductType,
|
|
4067
|
+
Te as SortOrder,
|
|
4068
|
+
Cn as TicketappSDK
|
|
4397
4069
|
};
|