@ticketapp-dev/shop-sdk 1.0.43 → 1.0.45
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 +982 -832
- package/dist/sdk.d.ts +4 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/services/basket/basket.service.d.ts +2 -3
- package/dist/services/basket/basket.service.d.ts.map +1 -1
- package/dist/services/category/category.service.d.ts +2 -2
- package/dist/services/category/category.service.d.ts.map +1 -1
- package/dist/services/event/event.service.d.ts +3 -2
- package/dist/services/event/event.service.d.ts.map +1 -1
- package/dist/services/event/event.service.generated.d.ts +41 -0
- package/dist/services/event/event.service.generated.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/package/package.service.d.ts +3 -2
- package/dist/services/package/package.service.d.ts.map +1 -1
- package/dist/services/package/package.service.generated.d.ts +34 -0
- package/dist/services/package/package.service.generated.d.ts.map +1 -1
- package/dist/services/shop/shop.service.d.ts +14 -0
- package/dist/services/shop/shop.service.d.ts.map +1 -0
- package/dist/services/shop/shop.service.generated.d.ts +63 -0
- package/dist/services/shop/shop.service.generated.d.ts.map +1 -0
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,98 +1,100 @@
|
|
|
1
|
-
import { GraphQLClient as
|
|
2
|
-
import { DateTime as
|
|
3
|
-
var T = /* @__PURE__ */ ((
|
|
1
|
+
import { GraphQLClient as N } from "graphql-request";
|
|
2
|
+
import { DateTime as k } from "luxon";
|
|
3
|
+
var T = /* @__PURE__ */ ((t) => (t.PACKAGE = "PACKAGE", t.PRODUCT = "PRODUCT", t.ADD_ONS = "ADD_ONS", t.DELIVERY = "DELIVERY", t.PICKUP = "PICKUP", t))(T || {}), R = /* @__PURE__ */ ((t) => (t.AdditionalEvent = "ADDITIONAL_EVENT", t.Addon = "ADDON", t.Regular = "REGULAR", t))(R || {}), Z = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Concept = "CONCEPT", t.Paused = "PAUSED", t.SoldOut = "SOLD_OUT", t))(Z || {}), K = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Inactive = "INACTIVE", t))(K || {}), ee = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Inactive = "INACTIVE", t.Paused = "PAUSED", t.SoldOut = "SOLD_OUT", t))(ee || {}), te = /* @__PURE__ */ ((t) => (t.Asc = "ASC", t.Desc = "DESC", t))(te || {}), ne = /* @__PURE__ */ ((t) => (t.AllReserved = "ALL_RESERVED", t.Available = "AVAILABLE", t.SoldOut = "SOLD_OUT", t))(ne || {}), ie = /* @__PURE__ */ ((t) => (t.Addon = "ADDON", t.Delivery = "DELIVERY", t.Door = "DOOR", t.Friend = "FRIEND", t.Guest = "GUEST", t.Pickup = "PICKUP", t.Promoter = "PROMOTER", t.Ticket = "TICKET", t))(ie || {}), re = /* @__PURE__ */ ((t) => (t.FIXED = "FIXED", t.PERCENTAGE = "PERCENTAGE", t))(re || {}), se = /* @__PURE__ */ ((t) => (t.AddOn = "ADD_ON", t.DeliveryOption = "DELIVERY_OPTION", t.EntranceTicket = "ENTRANCE_TICKET", t))(se || {}), ae = /* @__PURE__ */ ((t) => (t.Fixed = "FIXED", t.Percentage = "PERCENTAGE", t))(ae || {}), oe = /* @__PURE__ */ ((t) => (t.Default = "DEFAULT", t.Transparent = "TRANSPARENT", t))(oe || {}), ce = /* @__PURE__ */ ((t) => (t.Calendar = "CALENDAR", t.Large = "LARGE", t.Small = "SMALL", t))(ce || {}), F = /* @__PURE__ */ ((t) => (t.Event = "EVENT", t.Package = "PACKAGE", t))(F || {});
|
|
4
4
|
const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
5
|
__proto__: null,
|
|
6
6
|
BasketOrderType: T,
|
|
7
|
-
DiscountType:
|
|
8
|
-
EventStatus:
|
|
9
|
-
MetricsType:
|
|
10
|
-
OrderItemType:
|
|
7
|
+
DiscountType: ae,
|
|
8
|
+
EventStatus: ee,
|
|
9
|
+
MetricsType: F,
|
|
10
|
+
OrderItemType: se,
|
|
11
11
|
PackageItemType: R,
|
|
12
|
-
PackageStatus:
|
|
13
|
-
PackageTabType:
|
|
14
|
-
PaymentMethodFeeType:
|
|
15
|
-
ProductStatus:
|
|
16
|
-
ProductType:
|
|
17
|
-
|
|
12
|
+
PackageStatus: Z,
|
|
13
|
+
PackageTabType: K,
|
|
14
|
+
PaymentMethodFeeType: re,
|
|
15
|
+
ProductStatus: ne,
|
|
16
|
+
ProductType: ie,
|
|
17
|
+
ShopTemplateType: oe,
|
|
18
|
+
ShopVariationType: ce,
|
|
19
|
+
SortOrder: te
|
|
18
20
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19
|
-
var
|
|
20
|
-
return
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
for (var s in
|
|
21
|
+
var w = function() {
|
|
22
|
+
return w = Object.assign || function(e) {
|
|
23
|
+
for (var n, i = 1, r = arguments.length; i < r; i++) {
|
|
24
|
+
n = arguments[i];
|
|
25
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
|
|
24
26
|
}
|
|
25
27
|
return e;
|
|
26
|
-
},
|
|
28
|
+
}, w.apply(this, arguments);
|
|
27
29
|
};
|
|
28
|
-
function U(
|
|
29
|
-
if (!!!
|
|
30
|
+
function U(t, e) {
|
|
31
|
+
if (!!!t)
|
|
30
32
|
throw new Error(e);
|
|
31
33
|
}
|
|
32
|
-
function
|
|
33
|
-
return typeof
|
|
34
|
+
function De(t) {
|
|
35
|
+
return typeof t == "object" && t !== null;
|
|
34
36
|
}
|
|
35
|
-
function Ne(
|
|
36
|
-
if (!!!
|
|
37
|
+
function Ne(t, e) {
|
|
38
|
+
if (!!!t)
|
|
37
39
|
throw new Error(
|
|
38
40
|
"Unexpected invariant triggered."
|
|
39
41
|
);
|
|
40
42
|
}
|
|
41
|
-
const
|
|
42
|
-
function z(
|
|
43
|
-
let
|
|
44
|
-
for (const r of
|
|
43
|
+
const ve = /\r\n|[\n\r]/g;
|
|
44
|
+
function z(t, e) {
|
|
45
|
+
let n = 0, i = 1;
|
|
46
|
+
for (const r of t.body.matchAll(ve)) {
|
|
45
47
|
if (typeof r.index == "number" || Ne(!1), r.index >= e)
|
|
46
48
|
break;
|
|
47
|
-
|
|
49
|
+
n = r.index + r[0].length, i += 1;
|
|
48
50
|
}
|
|
49
51
|
return {
|
|
50
52
|
line: i,
|
|
51
|
-
column: e + 1 -
|
|
53
|
+
column: e + 1 - n
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
z(
|
|
56
|
+
function be(t) {
|
|
57
|
+
return de(
|
|
58
|
+
t.source,
|
|
59
|
+
z(t.source, t.start)
|
|
58
60
|
);
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
`,
|
|
62
|
+
function de(t, e) {
|
|
63
|
+
const n = t.locationOffset.column - 1, i = "".padStart(n) + t.body, r = e.line - 1, s = t.locationOffset.line - 1, o = e.line + s, l = e.line === 1 ? n : 0, p = e.column + l, E = `${t.name}:${o}:${p}
|
|
64
|
+
`, g = i.split(/\r\n|[\n\r]/g), d = g[r];
|
|
63
65
|
if (d.length > 120) {
|
|
64
|
-
const
|
|
66
|
+
const m = Math.floor(p / 80), y = p % 80, h = [];
|
|
65
67
|
for (let O = 0; O < d.length; O += 80)
|
|
66
|
-
|
|
68
|
+
h.push(d.slice(O, O + 80));
|
|
67
69
|
return E + Q([
|
|
68
|
-
[`${o} |`,
|
|
69
|
-
...
|
|
70
|
+
[`${o} |`, h[0]],
|
|
71
|
+
...h.slice(1, m + 1).map((O) => ["|", O]),
|
|
70
72
|
["|", "^".padStart(y)],
|
|
71
|
-
["|",
|
|
73
|
+
["|", h[m + 1]]
|
|
72
74
|
]);
|
|
73
75
|
}
|
|
74
76
|
return E + Q([
|
|
75
77
|
// Lines specified like this: ["prefix", "string"],
|
|
76
|
-
[`${o - 1} |`,
|
|
78
|
+
[`${o - 1} |`, g[r - 1]],
|
|
77
79
|
[`${o} |`, d],
|
|
78
|
-
["|", "^".padStart(
|
|
79
|
-
[`${o + 1} |`,
|
|
80
|
+
["|", "^".padStart(p)],
|
|
81
|
+
[`${o + 1} |`, g[r + 1]]
|
|
80
82
|
]);
|
|
81
83
|
}
|
|
82
|
-
function Q(
|
|
83
|
-
const e =
|
|
84
|
-
return e.map(([i, r]) => i.padStart(
|
|
84
|
+
function Q(t) {
|
|
85
|
+
const e = t.filter(([i, r]) => r !== void 0), n = Math.max(...e.map(([i]) => i.length));
|
|
86
|
+
return e.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
85
87
|
`);
|
|
86
88
|
}
|
|
87
|
-
function
|
|
88
|
-
const e =
|
|
89
|
+
function Pe(t) {
|
|
90
|
+
const e = t[0];
|
|
89
91
|
return e == null || "kind" in e || "length" in e ? {
|
|
90
92
|
nodes: e,
|
|
91
|
-
source:
|
|
92
|
-
positions:
|
|
93
|
-
path:
|
|
94
|
-
originalError:
|
|
95
|
-
extensions:
|
|
93
|
+
source: t[1],
|
|
94
|
+
positions: t[2],
|
|
95
|
+
path: t[3],
|
|
96
|
+
originalError: t[4],
|
|
97
|
+
extensions: t[5]
|
|
96
98
|
} : e;
|
|
97
99
|
}
|
|
98
100
|
class j extends Error {
|
|
@@ -134,19 +136,19 @@ class j extends Error {
|
|
|
134
136
|
/**
|
|
135
137
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
136
138
|
*/
|
|
137
|
-
constructor(e, ...
|
|
139
|
+
constructor(e, ...n) {
|
|
138
140
|
var i, r, s;
|
|
139
|
-
const { nodes: o, source:
|
|
140
|
-
super(e), this.name = "GraphQLError", this.path = E ?? void 0, this.originalError =
|
|
141
|
+
const { nodes: o, source: l, positions: p, path: E, originalError: g, extensions: d } = Pe(n);
|
|
142
|
+
super(e), this.name = "GraphQLError", this.path = E ?? void 0, this.originalError = g ?? void 0, this.nodes = X(
|
|
141
143
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
142
144
|
);
|
|
143
|
-
const
|
|
144
|
-
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((
|
|
145
|
+
const m = X(
|
|
146
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((h) => h.loc).filter((h) => h != null)
|
|
145
147
|
);
|
|
146
|
-
this.source =
|
|
147
|
-
const y =
|
|
148
|
-
|
|
149
|
-
) ?
|
|
148
|
+
this.source = l ?? (m == null || (r = m[0]) === null || r === void 0 ? void 0 : r.source), this.positions = p ?? m?.map((h) => h.start), this.locations = p && l ? p.map((h) => z(l, h)) : m?.map((h) => z(h.source, h.start));
|
|
149
|
+
const y = De(
|
|
150
|
+
g?.extensions
|
|
151
|
+
) ? g?.extensions : void 0;
|
|
150
152
|
this.extensions = (s = d ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
151
153
|
message: {
|
|
152
154
|
writable: !0,
|
|
@@ -167,8 +169,8 @@ class j extends Error {
|
|
|
167
169
|
originalError: {
|
|
168
170
|
enumerable: !1
|
|
169
171
|
}
|
|
170
|
-
}),
|
|
171
|
-
value:
|
|
172
|
+
}), g != null && g.stack ? Object.defineProperty(this, "stack", {
|
|
173
|
+
value: g.stack,
|
|
172
174
|
writable: !0,
|
|
173
175
|
configurable: !0
|
|
174
176
|
}) : Error.captureStackTrace ? Error.captureStackTrace(this, j) : Object.defineProperty(this, "stack", {
|
|
@@ -183,15 +185,15 @@ class j extends Error {
|
|
|
183
185
|
toString() {
|
|
184
186
|
let e = this.message;
|
|
185
187
|
if (this.nodes)
|
|
186
|
-
for (const
|
|
187
|
-
|
|
188
|
+
for (const n of this.nodes)
|
|
189
|
+
n.loc && (e += `
|
|
188
190
|
|
|
189
|
-
` +
|
|
191
|
+
` + be(n.loc));
|
|
190
192
|
else if (this.source && this.locations)
|
|
191
|
-
for (const
|
|
193
|
+
for (const n of this.locations)
|
|
192
194
|
e += `
|
|
193
195
|
|
|
194
|
-
` +
|
|
196
|
+
` + de(this.source, n);
|
|
195
197
|
return e;
|
|
196
198
|
}
|
|
197
199
|
toJSON() {
|
|
@@ -201,16 +203,16 @@ class j extends Error {
|
|
|
201
203
|
return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e;
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
|
-
function X(
|
|
205
|
-
return
|
|
206
|
+
function X(t) {
|
|
207
|
+
return t === void 0 || t.length === 0 ? void 0 : t;
|
|
206
208
|
}
|
|
207
|
-
function I(
|
|
208
|
-
return new j(`Syntax Error: ${
|
|
209
|
-
source:
|
|
209
|
+
function I(t, e, n) {
|
|
210
|
+
return new j(`Syntax Error: ${n}`, {
|
|
211
|
+
source: t,
|
|
210
212
|
positions: [e]
|
|
211
213
|
});
|
|
212
214
|
}
|
|
213
|
-
class
|
|
215
|
+
class Se {
|
|
214
216
|
/**
|
|
215
217
|
* The character offset at which this Node begins.
|
|
216
218
|
*/
|
|
@@ -226,8 +228,8 @@ class Pe {
|
|
|
226
228
|
/**
|
|
227
229
|
* The Source document the AST represents.
|
|
228
230
|
*/
|
|
229
|
-
constructor(e,
|
|
230
|
-
this.start = e.start, this.end =
|
|
231
|
+
constructor(e, n, i) {
|
|
232
|
+
this.start = e.start, this.end = n.end, this.startToken = e, this.endToken = n, this.source = i;
|
|
231
233
|
}
|
|
232
234
|
get [Symbol.toStringTag]() {
|
|
233
235
|
return "Location";
|
|
@@ -239,7 +241,7 @@ class Pe {
|
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
|
-
class
|
|
244
|
+
class ue {
|
|
243
245
|
/**
|
|
244
246
|
* The kind of Token.
|
|
245
247
|
*/
|
|
@@ -266,8 +268,8 @@ class de {
|
|
|
266
268
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
267
269
|
* the last.
|
|
268
270
|
*/
|
|
269
|
-
constructor(e,
|
|
270
|
-
this.kind = e, this.start =
|
|
271
|
+
constructor(e, n, i, r, s, o) {
|
|
272
|
+
this.kind = e, this.start = n, this.end = i, this.line = r, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
271
273
|
}
|
|
272
274
|
get [Symbol.toStringTag]() {
|
|
273
275
|
return "Token";
|
|
@@ -281,7 +283,7 @@ class de {
|
|
|
281
283
|
};
|
|
282
284
|
}
|
|
283
285
|
}
|
|
284
|
-
const
|
|
286
|
+
const xe = {
|
|
285
287
|
Name: [],
|
|
286
288
|
Document: ["definitions"],
|
|
287
289
|
OperationDefinition: [
|
|
@@ -369,59 +371,59 @@ const be = {
|
|
|
369
371
|
DirectiveCoordinate: ["name"],
|
|
370
372
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
371
373
|
};
|
|
372
|
-
new Set(Object.keys(
|
|
373
|
-
var
|
|
374
|
-
(function(
|
|
375
|
-
|
|
376
|
-
})(
|
|
374
|
+
new Set(Object.keys(xe));
|
|
375
|
+
var v;
|
|
376
|
+
(function(t) {
|
|
377
|
+
t.QUERY = "query", t.MUTATION = "mutation", t.SUBSCRIPTION = "subscription";
|
|
378
|
+
})(v || (v = {}));
|
|
377
379
|
var q;
|
|
378
|
-
(function(
|
|
379
|
-
|
|
380
|
+
(function(t) {
|
|
381
|
+
t.QUERY = "QUERY", t.MUTATION = "MUTATION", t.SUBSCRIPTION = "SUBSCRIPTION", t.FIELD = "FIELD", t.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", t.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", t.INLINE_FRAGMENT = "INLINE_FRAGMENT", t.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", t.SCHEMA = "SCHEMA", t.SCALAR = "SCALAR", t.OBJECT = "OBJECT", t.FIELD_DEFINITION = "FIELD_DEFINITION", t.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", t.INTERFACE = "INTERFACE", t.UNION = "UNION", t.ENUM = "ENUM", t.ENUM_VALUE = "ENUM_VALUE", t.INPUT_OBJECT = "INPUT_OBJECT", t.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
380
382
|
})(q || (q = {}));
|
|
381
383
|
var c;
|
|
382
|
-
(function(
|
|
383
|
-
|
|
384
|
+
(function(t) {
|
|
385
|
+
t.NAME = "Name", t.DOCUMENT = "Document", t.OPERATION_DEFINITION = "OperationDefinition", t.VARIABLE_DEFINITION = "VariableDefinition", t.SELECTION_SET = "SelectionSet", t.FIELD = "Field", t.ARGUMENT = "Argument", t.FRAGMENT_SPREAD = "FragmentSpread", t.INLINE_FRAGMENT = "InlineFragment", t.FRAGMENT_DEFINITION = "FragmentDefinition", t.VARIABLE = "Variable", t.INT = "IntValue", t.FLOAT = "FloatValue", t.STRING = "StringValue", t.BOOLEAN = "BooleanValue", t.NULL = "NullValue", t.ENUM = "EnumValue", t.LIST = "ListValue", t.OBJECT = "ObjectValue", t.OBJECT_FIELD = "ObjectField", t.DIRECTIVE = "Directive", t.NAMED_TYPE = "NamedType", t.LIST_TYPE = "ListType", t.NON_NULL_TYPE = "NonNullType", t.SCHEMA_DEFINITION = "SchemaDefinition", t.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", t.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", t.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", t.FIELD_DEFINITION = "FieldDefinition", t.INPUT_VALUE_DEFINITION = "InputValueDefinition", t.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", t.UNION_TYPE_DEFINITION = "UnionTypeDefinition", t.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", t.ENUM_VALUE_DEFINITION = "EnumValueDefinition", t.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", t.DIRECTIVE_DEFINITION = "DirectiveDefinition", t.SCHEMA_EXTENSION = "SchemaExtension", t.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", t.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", t.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", t.UNION_TYPE_EXTENSION = "UnionTypeExtension", t.ENUM_TYPE_EXTENSION = "EnumTypeExtension", t.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", t.TYPE_COORDINATE = "TypeCoordinate", t.MEMBER_COORDINATE = "MemberCoordinate", t.ARGUMENT_COORDINATE = "ArgumentCoordinate", t.DIRECTIVE_COORDINATE = "DirectiveCoordinate", t.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
384
386
|
})(c || (c = {}));
|
|
385
|
-
function
|
|
386
|
-
return
|
|
387
|
+
function Ce(t) {
|
|
388
|
+
return t === 9 || t === 32;
|
|
387
389
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
390
|
+
function x(t) {
|
|
391
|
+
return t >= 48 && t <= 57;
|
|
390
392
|
}
|
|
391
|
-
function
|
|
392
|
-
return
|
|
393
|
-
|
|
393
|
+
function le(t) {
|
|
394
|
+
return t >= 97 && t <= 122 || // A-Z
|
|
395
|
+
t >= 65 && t <= 90;
|
|
394
396
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
397
|
+
function pe(t) {
|
|
398
|
+
return le(t) || t === 95;
|
|
397
399
|
}
|
|
398
|
-
function
|
|
399
|
-
return
|
|
400
|
+
function _e(t) {
|
|
401
|
+
return le(t) || x(t) || t === 95;
|
|
400
402
|
}
|
|
401
|
-
function
|
|
403
|
+
function Le(t) {
|
|
402
404
|
var e;
|
|
403
|
-
let
|
|
404
|
-
for (let o = 0; o <
|
|
405
|
+
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
406
|
+
for (let o = 0; o < t.length; ++o) {
|
|
405
407
|
var s;
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
+
const l = t[o], p = Re(l);
|
|
409
|
+
p !== l.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && p < n && (n = p));
|
|
408
410
|
}
|
|
409
|
-
return
|
|
411
|
+
return t.map((o, l) => l === 0 ? o : o.slice(n)).slice(
|
|
410
412
|
(e = i) !== null && e !== void 0 ? e : 0,
|
|
411
413
|
r + 1
|
|
412
414
|
);
|
|
413
415
|
}
|
|
414
|
-
function
|
|
416
|
+
function Re(t) {
|
|
415
417
|
let e = 0;
|
|
416
|
-
for (; e <
|
|
418
|
+
for (; e < t.length && Ce(t.charCodeAt(e)); )
|
|
417
419
|
++e;
|
|
418
420
|
return e;
|
|
419
421
|
}
|
|
420
422
|
var a;
|
|
421
|
-
(function(
|
|
422
|
-
|
|
423
|
+
(function(t) {
|
|
424
|
+
t.SOF = "<SOF>", t.EOF = "<EOF>", t.BANG = "!", t.DOLLAR = "$", t.AMP = "&", t.PAREN_L = "(", t.PAREN_R = ")", t.DOT = ".", t.SPREAD = "...", t.COLON = ":", t.EQUALS = "=", t.AT = "@", t.BRACKET_L = "[", t.BRACKET_R = "]", t.BRACE_L = "{", t.PIPE = "|", t.BRACE_R = "}", t.NAME = "Name", t.INT = "Int", t.FLOAT = "Float", t.STRING = "String", t.BLOCK_STRING = "BlockString", t.COMMENT = "Comment";
|
|
423
425
|
})(a || (a = {}));
|
|
424
|
-
class
|
|
426
|
+
class Fe {
|
|
425
427
|
/**
|
|
426
428
|
* The previously focused non-ignored token.
|
|
427
429
|
*/
|
|
@@ -435,8 +437,8 @@ class Re {
|
|
|
435
437
|
* The character offset at which the current line begins.
|
|
436
438
|
*/
|
|
437
439
|
constructor(e) {
|
|
438
|
-
const
|
|
439
|
-
this.source = e, this.lastToken =
|
|
440
|
+
const n = new ue(a.SOF, 0, 0, 0, 0);
|
|
441
|
+
this.source = e, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
440
442
|
}
|
|
441
443
|
get [Symbol.toStringTag]() {
|
|
442
444
|
return "Lexer";
|
|
@@ -458,47 +460,47 @@ class Re {
|
|
|
458
460
|
if (e.next)
|
|
459
461
|
e = e.next;
|
|
460
462
|
else {
|
|
461
|
-
const
|
|
462
|
-
e.next =
|
|
463
|
+
const n = $e(this, e.end);
|
|
464
|
+
e.next = n, n.prev = e, e = n;
|
|
463
465
|
}
|
|
464
466
|
while (e.kind === a.COMMENT);
|
|
465
467
|
return e;
|
|
466
468
|
}
|
|
467
469
|
}
|
|
468
|
-
function we(
|
|
469
|
-
return
|
|
470
|
+
function we(t) {
|
|
471
|
+
return t === a.BANG || t === a.DOLLAR || t === a.AMP || t === a.PAREN_L || t === a.PAREN_R || t === a.DOT || t === a.SPREAD || t === a.COLON || t === a.EQUALS || t === a.AT || t === a.BRACKET_L || t === a.BRACKET_R || t === a.BRACE_L || t === a.PIPE || t === a.BRACE_R;
|
|
470
472
|
}
|
|
471
|
-
function
|
|
472
|
-
return
|
|
473
|
+
function b(t) {
|
|
474
|
+
return t >= 0 && t <= 55295 || t >= 57344 && t <= 1114111;
|
|
473
475
|
}
|
|
474
|
-
function B(
|
|
475
|
-
return he(
|
|
476
|
+
function B(t, e) {
|
|
477
|
+
return he(t.charCodeAt(e)) && ge(t.charCodeAt(e + 1));
|
|
476
478
|
}
|
|
477
|
-
function he(
|
|
478
|
-
return
|
|
479
|
+
function he(t) {
|
|
480
|
+
return t >= 55296 && t <= 56319;
|
|
479
481
|
}
|
|
480
|
-
function
|
|
481
|
-
return
|
|
482
|
+
function ge(t) {
|
|
483
|
+
return t >= 56320 && t <= 57343;
|
|
482
484
|
}
|
|
483
|
-
function
|
|
484
|
-
const
|
|
485
|
-
if (
|
|
485
|
+
function D(t, e) {
|
|
486
|
+
const n = t.source.body.codePointAt(e);
|
|
487
|
+
if (n === void 0)
|
|
486
488
|
return a.EOF;
|
|
487
|
-
if (
|
|
488
|
-
const i = String.fromCodePoint(
|
|
489
|
+
if (n >= 32 && n <= 126) {
|
|
490
|
+
const i = String.fromCodePoint(n);
|
|
489
491
|
return i === '"' ? `'"'` : `"${i}"`;
|
|
490
492
|
}
|
|
491
|
-
return "U+" +
|
|
493
|
+
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
492
494
|
}
|
|
493
|
-
function
|
|
494
|
-
const s =
|
|
495
|
-
return new
|
|
495
|
+
function f(t, e, n, i, r) {
|
|
496
|
+
const s = t.line, o = 1 + n - t.lineStart;
|
|
497
|
+
return new ue(e, n, i, s, o, r);
|
|
496
498
|
}
|
|
497
|
-
function
|
|
498
|
-
const
|
|
499
|
+
function $e(t, e) {
|
|
500
|
+
const n = t.source.body, i = n.length;
|
|
499
501
|
let r = e;
|
|
500
502
|
for (; r < i; ) {
|
|
501
|
-
const s =
|
|
503
|
+
const s = n.charCodeAt(r);
|
|
502
504
|
switch (s) {
|
|
503
505
|
// Ignored ::
|
|
504
506
|
// - UnicodeBOM
|
|
@@ -528,14 +530,14 @@ function Fe(n, e) {
|
|
|
528
530
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
529
531
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
530
532
|
case 10:
|
|
531
|
-
++r, ++
|
|
533
|
+
++r, ++t.line, t.lineStart = r;
|
|
532
534
|
continue;
|
|
533
535
|
case 13:
|
|
534
|
-
|
|
536
|
+
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++t.line, t.lineStart = r;
|
|
535
537
|
continue;
|
|
536
538
|
// Comment
|
|
537
539
|
case 35:
|
|
538
|
-
return
|
|
540
|
+
return Be(t, r);
|
|
539
541
|
// Token ::
|
|
540
542
|
// - Punctuator
|
|
541
543
|
// - Name
|
|
@@ -545,207 +547,207 @@ function Fe(n, e) {
|
|
|
545
547
|
//
|
|
546
548
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
547
549
|
case 33:
|
|
548
|
-
return
|
|
550
|
+
return f(t, a.BANG, r, r + 1);
|
|
549
551
|
case 36:
|
|
550
|
-
return
|
|
552
|
+
return f(t, a.DOLLAR, r, r + 1);
|
|
551
553
|
case 38:
|
|
552
|
-
return
|
|
554
|
+
return f(t, a.AMP, r, r + 1);
|
|
553
555
|
case 40:
|
|
554
|
-
return
|
|
556
|
+
return f(t, a.PAREN_L, r, r + 1);
|
|
555
557
|
case 41:
|
|
556
|
-
return
|
|
558
|
+
return f(t, a.PAREN_R, r, r + 1);
|
|
557
559
|
case 46:
|
|
558
|
-
if (
|
|
559
|
-
return
|
|
560
|
+
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
561
|
+
return f(t, a.SPREAD, r, r + 3);
|
|
560
562
|
break;
|
|
561
563
|
case 58:
|
|
562
|
-
return
|
|
564
|
+
return f(t, a.COLON, r, r + 1);
|
|
563
565
|
case 61:
|
|
564
|
-
return
|
|
566
|
+
return f(t, a.EQUALS, r, r + 1);
|
|
565
567
|
case 64:
|
|
566
|
-
return
|
|
568
|
+
return f(t, a.AT, r, r + 1);
|
|
567
569
|
case 91:
|
|
568
|
-
return
|
|
570
|
+
return f(t, a.BRACKET_L, r, r + 1);
|
|
569
571
|
case 93:
|
|
570
|
-
return
|
|
572
|
+
return f(t, a.BRACKET_R, r, r + 1);
|
|
571
573
|
case 123:
|
|
572
|
-
return
|
|
574
|
+
return f(t, a.BRACE_L, r, r + 1);
|
|
573
575
|
case 124:
|
|
574
|
-
return
|
|
576
|
+
return f(t, a.PIPE, r, r + 1);
|
|
575
577
|
case 125:
|
|
576
|
-
return
|
|
578
|
+
return f(t, a.BRACE_R, r, r + 1);
|
|
577
579
|
// StringValue
|
|
578
580
|
case 34:
|
|
579
|
-
return
|
|
581
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Ge(t, r) : Ue(t, r);
|
|
580
582
|
}
|
|
581
|
-
if (
|
|
582
|
-
return
|
|
583
|
-
if (
|
|
584
|
-
return
|
|
583
|
+
if (x(s) || s === 45)
|
|
584
|
+
return Ve(t, r, s);
|
|
585
|
+
if (pe(s))
|
|
586
|
+
return je(t, r);
|
|
585
587
|
throw I(
|
|
586
|
-
|
|
588
|
+
t.source,
|
|
587
589
|
r,
|
|
588
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
590
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : b(s) || B(n, r) ? `Unexpected character: ${D(t, r)}.` : `Invalid character: ${D(t, r)}.`
|
|
589
591
|
);
|
|
590
592
|
}
|
|
591
|
-
return
|
|
593
|
+
return f(t, a.EOF, i, i);
|
|
592
594
|
}
|
|
593
|
-
function
|
|
594
|
-
const
|
|
595
|
+
function Be(t, e) {
|
|
596
|
+
const n = t.source.body, i = n.length;
|
|
595
597
|
let r = e + 1;
|
|
596
598
|
for (; r < i; ) {
|
|
597
|
-
const s =
|
|
599
|
+
const s = n.charCodeAt(r);
|
|
598
600
|
if (s === 10 || s === 13)
|
|
599
601
|
break;
|
|
600
|
-
if (
|
|
602
|
+
if (b(s))
|
|
601
603
|
++r;
|
|
602
|
-
else if (B(
|
|
604
|
+
else if (B(n, r))
|
|
603
605
|
r += 2;
|
|
604
606
|
else
|
|
605
607
|
break;
|
|
606
608
|
}
|
|
607
|
-
return
|
|
608
|
-
|
|
609
|
+
return f(
|
|
610
|
+
t,
|
|
609
611
|
a.COMMENT,
|
|
610
612
|
e,
|
|
611
613
|
r,
|
|
612
|
-
|
|
614
|
+
n.slice(e + 1, r)
|
|
613
615
|
);
|
|
614
616
|
}
|
|
615
|
-
function
|
|
616
|
-
const i =
|
|
617
|
-
let r = e, s =
|
|
617
|
+
function Ve(t, e, n) {
|
|
618
|
+
const i = t.source.body;
|
|
619
|
+
let r = e, s = n, o = !1;
|
|
618
620
|
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
619
|
-
if (s = i.charCodeAt(++r),
|
|
621
|
+
if (s = i.charCodeAt(++r), x(s))
|
|
620
622
|
throw I(
|
|
621
|
-
|
|
623
|
+
t.source,
|
|
622
624
|
r,
|
|
623
|
-
`Invalid number, unexpected digit after 0: ${
|
|
624
|
-
|
|
625
|
+
`Invalid number, unexpected digit after 0: ${D(
|
|
626
|
+
t,
|
|
625
627
|
r
|
|
626
628
|
)}.`
|
|
627
629
|
);
|
|
628
630
|
} else
|
|
629
|
-
r = M(
|
|
630
|
-
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(
|
|
631
|
+
r = M(t, r, s), s = i.charCodeAt(r);
|
|
632
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(t, 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 = M(t, r, s), s = i.charCodeAt(r)), s === 46 || pe(s))
|
|
631
633
|
throw I(
|
|
632
|
-
|
|
634
|
+
t.source,
|
|
633
635
|
r,
|
|
634
|
-
`Invalid number, expected digit but got: ${
|
|
635
|
-
|
|
636
|
+
`Invalid number, expected digit but got: ${D(
|
|
637
|
+
t,
|
|
636
638
|
r
|
|
637
639
|
)}.`
|
|
638
640
|
);
|
|
639
|
-
return
|
|
640
|
-
|
|
641
|
+
return f(
|
|
642
|
+
t,
|
|
641
643
|
o ? a.FLOAT : a.INT,
|
|
642
644
|
e,
|
|
643
645
|
r,
|
|
644
646
|
i.slice(e, r)
|
|
645
647
|
);
|
|
646
648
|
}
|
|
647
|
-
function M(
|
|
648
|
-
if (!
|
|
649
|
+
function M(t, e, n) {
|
|
650
|
+
if (!x(n))
|
|
649
651
|
throw I(
|
|
650
|
-
|
|
652
|
+
t.source,
|
|
651
653
|
e,
|
|
652
|
-
`Invalid number, expected digit but got: ${
|
|
653
|
-
|
|
654
|
+
`Invalid number, expected digit but got: ${D(
|
|
655
|
+
t,
|
|
654
656
|
e
|
|
655
657
|
)}.`
|
|
656
658
|
);
|
|
657
|
-
const i =
|
|
659
|
+
const i = t.source.body;
|
|
658
660
|
let r = e + 1;
|
|
659
|
-
for (;
|
|
661
|
+
for (; x(i.charCodeAt(r)); )
|
|
660
662
|
++r;
|
|
661
663
|
return r;
|
|
662
664
|
}
|
|
663
|
-
function
|
|
664
|
-
const
|
|
665
|
+
function Ue(t, e) {
|
|
666
|
+
const n = t.source.body, i = n.length;
|
|
665
667
|
let r = e + 1, s = r, o = "";
|
|
666
668
|
for (; r < i; ) {
|
|
667
|
-
const
|
|
668
|
-
if (
|
|
669
|
-
return o +=
|
|
670
|
-
if (
|
|
671
|
-
o +=
|
|
672
|
-
const
|
|
673
|
-
o +=
|
|
669
|
+
const l = n.charCodeAt(r);
|
|
670
|
+
if (l === 34)
|
|
671
|
+
return o += n.slice(s, r), f(t, a.STRING, e, r + 1, o);
|
|
672
|
+
if (l === 92) {
|
|
673
|
+
o += n.slice(s, r);
|
|
674
|
+
const p = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Me(t, r) : ze(t, r) : qe(t, r);
|
|
675
|
+
o += p.value, r += p.size, s = r;
|
|
674
676
|
continue;
|
|
675
677
|
}
|
|
676
|
-
if (
|
|
678
|
+
if (l === 10 || l === 13)
|
|
677
679
|
break;
|
|
678
|
-
if (
|
|
680
|
+
if (b(l))
|
|
679
681
|
++r;
|
|
680
|
-
else if (B(
|
|
682
|
+
else if (B(n, r))
|
|
681
683
|
r += 2;
|
|
682
684
|
else
|
|
683
685
|
throw I(
|
|
684
|
-
|
|
686
|
+
t.source,
|
|
685
687
|
r,
|
|
686
|
-
`Invalid character within String: ${
|
|
687
|
-
|
|
688
|
+
`Invalid character within String: ${D(
|
|
689
|
+
t,
|
|
688
690
|
r
|
|
689
691
|
)}.`
|
|
690
692
|
);
|
|
691
693
|
}
|
|
692
|
-
throw I(
|
|
694
|
+
throw I(t.source, r, "Unterminated string.");
|
|
693
695
|
}
|
|
694
|
-
function
|
|
695
|
-
const
|
|
696
|
+
function Me(t, e) {
|
|
697
|
+
const n = t.source.body;
|
|
696
698
|
let i = 0, r = 3;
|
|
697
699
|
for (; r < 12; ) {
|
|
698
|
-
const s =
|
|
700
|
+
const s = n.charCodeAt(e + r++);
|
|
699
701
|
if (s === 125) {
|
|
700
|
-
if (r < 5 || !
|
|
702
|
+
if (r < 5 || !b(i))
|
|
701
703
|
break;
|
|
702
704
|
return {
|
|
703
705
|
value: String.fromCodePoint(i),
|
|
704
706
|
size: r
|
|
705
707
|
};
|
|
706
708
|
}
|
|
707
|
-
if (i = i << 4 |
|
|
709
|
+
if (i = i << 4 | S(s), i < 0)
|
|
708
710
|
break;
|
|
709
711
|
}
|
|
710
712
|
throw I(
|
|
711
|
-
|
|
713
|
+
t.source,
|
|
712
714
|
e,
|
|
713
|
-
`Invalid Unicode escape sequence: "${
|
|
715
|
+
`Invalid Unicode escape sequence: "${n.slice(
|
|
714
716
|
e,
|
|
715
717
|
e + r
|
|
716
718
|
)}".`
|
|
717
719
|
);
|
|
718
720
|
}
|
|
719
|
-
function
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
721
|
+
function ze(t, e) {
|
|
722
|
+
const n = t.source.body, i = W(n, e + 2);
|
|
723
|
+
if (b(i))
|
|
722
724
|
return {
|
|
723
725
|
value: String.fromCodePoint(i),
|
|
724
726
|
size: 6
|
|
725
727
|
};
|
|
726
|
-
if (he(i) &&
|
|
727
|
-
const r = W(
|
|
728
|
-
if (
|
|
728
|
+
if (he(i) && n.charCodeAt(e + 6) === 92 && n.charCodeAt(e + 7) === 117) {
|
|
729
|
+
const r = W(n, e + 8);
|
|
730
|
+
if (ge(r))
|
|
729
731
|
return {
|
|
730
732
|
value: String.fromCodePoint(i, r),
|
|
731
733
|
size: 12
|
|
732
734
|
};
|
|
733
735
|
}
|
|
734
736
|
throw I(
|
|
735
|
-
|
|
737
|
+
t.source,
|
|
736
738
|
e,
|
|
737
|
-
`Invalid Unicode escape sequence: "${
|
|
739
|
+
`Invalid Unicode escape sequence: "${n.slice(e, e + 6)}".`
|
|
738
740
|
);
|
|
739
741
|
}
|
|
740
|
-
function W(
|
|
741
|
-
return
|
|
742
|
+
function W(t, e) {
|
|
743
|
+
return S(t.charCodeAt(e)) << 12 | S(t.charCodeAt(e + 1)) << 8 | S(t.charCodeAt(e + 2)) << 4 | S(t.charCodeAt(e + 3));
|
|
742
744
|
}
|
|
743
|
-
function
|
|
744
|
-
return
|
|
745
|
+
function S(t) {
|
|
746
|
+
return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 70 ? t - 55 : t >= 97 && t <= 102 ? t - 87 : -1;
|
|
745
747
|
}
|
|
746
|
-
function
|
|
747
|
-
const
|
|
748
|
-
switch (
|
|
748
|
+
function qe(t, e) {
|
|
749
|
+
const n = t.source.body;
|
|
750
|
+
switch (n.charCodeAt(e + 1)) {
|
|
749
751
|
case 34:
|
|
750
752
|
return {
|
|
751
753
|
value: '"',
|
|
@@ -789,145 +791,145 @@ function ze(n, e) {
|
|
|
789
791
|
};
|
|
790
792
|
}
|
|
791
793
|
throw I(
|
|
792
|
-
|
|
794
|
+
t.source,
|
|
793
795
|
e,
|
|
794
|
-
`Invalid character escape sequence: "${
|
|
796
|
+
`Invalid character escape sequence: "${n.slice(
|
|
795
797
|
e,
|
|
796
798
|
e + 2
|
|
797
799
|
)}".`
|
|
798
800
|
);
|
|
799
801
|
}
|
|
800
|
-
function
|
|
801
|
-
const
|
|
802
|
-
let r =
|
|
803
|
-
const
|
|
802
|
+
function Ge(t, e) {
|
|
803
|
+
const n = t.source.body, i = n.length;
|
|
804
|
+
let r = t.lineStart, s = e + 3, o = s, l = "";
|
|
805
|
+
const p = [];
|
|
804
806
|
for (; s < i; ) {
|
|
805
|
-
const E =
|
|
806
|
-
if (E === 34 &&
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
|
|
807
|
+
const E = n.charCodeAt(s);
|
|
808
|
+
if (E === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
809
|
+
l += n.slice(o, s), p.push(l);
|
|
810
|
+
const g = f(
|
|
811
|
+
t,
|
|
810
812
|
a.BLOCK_STRING,
|
|
811
813
|
e,
|
|
812
814
|
s + 3,
|
|
813
815
|
// Return a string of the lines joined with U+000A.
|
|
814
|
-
|
|
816
|
+
Le(p).join(`
|
|
815
817
|
`)
|
|
816
818
|
);
|
|
817
|
-
return
|
|
819
|
+
return t.line += p.length - 1, t.lineStart = r, g;
|
|
818
820
|
}
|
|
819
|
-
if (E === 92 &&
|
|
820
|
-
|
|
821
|
+
if (E === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
822
|
+
l += n.slice(o, s), o = s + 1, s += 4;
|
|
821
823
|
continue;
|
|
822
824
|
}
|
|
823
825
|
if (E === 10 || E === 13) {
|
|
824
|
-
|
|
826
|
+
l += n.slice(o, s), p.push(l), E === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, l = "", o = s, r = s;
|
|
825
827
|
continue;
|
|
826
828
|
}
|
|
827
|
-
if (
|
|
829
|
+
if (b(E))
|
|
828
830
|
++s;
|
|
829
|
-
else if (B(
|
|
831
|
+
else if (B(n, s))
|
|
830
832
|
s += 2;
|
|
831
833
|
else
|
|
832
834
|
throw I(
|
|
833
|
-
|
|
835
|
+
t.source,
|
|
834
836
|
s,
|
|
835
|
-
`Invalid character within String: ${
|
|
836
|
-
|
|
837
|
+
`Invalid character within String: ${D(
|
|
838
|
+
t,
|
|
837
839
|
s
|
|
838
840
|
)}.`
|
|
839
841
|
);
|
|
840
842
|
}
|
|
841
|
-
throw I(
|
|
843
|
+
throw I(t.source, s, "Unterminated string.");
|
|
842
844
|
}
|
|
843
|
-
function
|
|
844
|
-
const
|
|
845
|
+
function je(t, e) {
|
|
846
|
+
const n = t.source.body, i = n.length;
|
|
845
847
|
let r = e + 1;
|
|
846
848
|
for (; r < i; ) {
|
|
847
|
-
const s =
|
|
848
|
-
if (
|
|
849
|
+
const s = n.charCodeAt(r);
|
|
850
|
+
if (_e(s))
|
|
849
851
|
++r;
|
|
850
852
|
else
|
|
851
853
|
break;
|
|
852
854
|
}
|
|
853
|
-
return
|
|
854
|
-
|
|
855
|
+
return f(
|
|
856
|
+
t,
|
|
855
857
|
a.NAME,
|
|
856
858
|
e,
|
|
857
859
|
r,
|
|
858
|
-
|
|
860
|
+
n.slice(e, r)
|
|
859
861
|
);
|
|
860
862
|
}
|
|
861
|
-
const
|
|
862
|
-
function fe(
|
|
863
|
-
return V(
|
|
863
|
+
const Ye = 10, me = 2;
|
|
864
|
+
function fe(t) {
|
|
865
|
+
return V(t, []);
|
|
864
866
|
}
|
|
865
|
-
function V(
|
|
866
|
-
switch (typeof
|
|
867
|
+
function V(t, e) {
|
|
868
|
+
switch (typeof t) {
|
|
867
869
|
case "string":
|
|
868
|
-
return JSON.stringify(
|
|
870
|
+
return JSON.stringify(t);
|
|
869
871
|
case "function":
|
|
870
|
-
return
|
|
872
|
+
return t.name ? `[function ${t.name}]` : "[function]";
|
|
871
873
|
case "object":
|
|
872
|
-
return
|
|
874
|
+
return He(t, e);
|
|
873
875
|
default:
|
|
874
|
-
return String(
|
|
876
|
+
return String(t);
|
|
875
877
|
}
|
|
876
878
|
}
|
|
877
|
-
function
|
|
878
|
-
if (
|
|
879
|
+
function He(t, e) {
|
|
880
|
+
if (t === null)
|
|
879
881
|
return "null";
|
|
880
|
-
if (e.includes(
|
|
882
|
+
if (e.includes(t))
|
|
881
883
|
return "[Circular]";
|
|
882
|
-
const
|
|
883
|
-
if (
|
|
884
|
-
const i =
|
|
885
|
-
if (i !==
|
|
886
|
-
return typeof i == "string" ? i : V(i,
|
|
887
|
-
} else if (Array.isArray(
|
|
888
|
-
return
|
|
889
|
-
return
|
|
890
|
-
}
|
|
891
|
-
function
|
|
892
|
-
return typeof
|
|
893
|
-
}
|
|
894
|
-
function
|
|
895
|
-
const
|
|
896
|
-
return
|
|
884
|
+
const n = [...e, t];
|
|
885
|
+
if (Je(t)) {
|
|
886
|
+
const i = t.toJSON();
|
|
887
|
+
if (i !== t)
|
|
888
|
+
return typeof i == "string" ? i : V(i, n);
|
|
889
|
+
} else if (Array.isArray(t))
|
|
890
|
+
return Xe(t, n);
|
|
891
|
+
return Qe(t, n);
|
|
892
|
+
}
|
|
893
|
+
function Je(t) {
|
|
894
|
+
return typeof t.toJSON == "function";
|
|
895
|
+
}
|
|
896
|
+
function Qe(t, e) {
|
|
897
|
+
const n = Object.entries(t);
|
|
898
|
+
return n.length === 0 ? "{}" : e.length > me ? "[" + We(t) + "]" : "{ " + n.map(
|
|
897
899
|
([r, s]) => r + ": " + V(s, e)
|
|
898
900
|
).join(", ") + " }";
|
|
899
901
|
}
|
|
900
|
-
function
|
|
901
|
-
if (
|
|
902
|
+
function Xe(t, e) {
|
|
903
|
+
if (t.length === 0)
|
|
902
904
|
return "[]";
|
|
903
905
|
if (e.length > me)
|
|
904
906
|
return "[Array]";
|
|
905
|
-
const
|
|
906
|
-
for (let s = 0; s <
|
|
907
|
-
r.push(V(
|
|
907
|
+
const n = Math.min(Ye, t.length), i = t.length - n, r = [];
|
|
908
|
+
for (let s = 0; s < n; ++s)
|
|
909
|
+
r.push(V(t[s], e));
|
|
908
910
|
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
909
911
|
}
|
|
910
|
-
function
|
|
911
|
-
const e = Object.prototype.toString.call(
|
|
912
|
-
if (e === "Object" && typeof
|
|
913
|
-
const
|
|
914
|
-
if (typeof
|
|
915
|
-
return
|
|
912
|
+
function We(t) {
|
|
913
|
+
const e = Object.prototype.toString.call(t).replace(/^\[object /, "").replace(/]$/, "");
|
|
914
|
+
if (e === "Object" && typeof t.constructor == "function") {
|
|
915
|
+
const n = t.constructor.name;
|
|
916
|
+
if (typeof n == "string" && n !== "")
|
|
917
|
+
return n;
|
|
916
918
|
}
|
|
917
919
|
return e;
|
|
918
920
|
}
|
|
919
|
-
const
|
|
920
|
-
process.env.NODE_ENV === "production",
|
|
921
|
+
const Ze = globalThis.process && // eslint-disable-next-line no-undef
|
|
922
|
+
process.env.NODE_ENV === "production", Ke = (
|
|
921
923
|
/* c8 ignore next 6 */
|
|
922
924
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
923
|
-
|
|
924
|
-
return e instanceof
|
|
925
|
-
} : function(e,
|
|
926
|
-
if (e instanceof
|
|
925
|
+
Ze ? function(e, n) {
|
|
926
|
+
return e instanceof n;
|
|
927
|
+
} : function(e, n) {
|
|
928
|
+
if (e instanceof n)
|
|
927
929
|
return !0;
|
|
928
930
|
if (typeof e == "object" && e !== null) {
|
|
929
931
|
var i;
|
|
930
|
-
const r =
|
|
932
|
+
const r = n.prototype[Symbol.toStringTag], s = (
|
|
931
933
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
932
934
|
Symbol.toStringTag in e ? e[Symbol.toStringTag] : (i = e.constructor) === null || i === void 0 ? void 0 : i.name
|
|
933
935
|
);
|
|
@@ -950,12 +952,12 @@ spurious results.`);
|
|
|
950
952
|
return !1;
|
|
951
953
|
}
|
|
952
954
|
);
|
|
953
|
-
class
|
|
954
|
-
constructor(e,
|
|
955
|
+
class Ie {
|
|
956
|
+
constructor(e, n = "GraphQL request", i = {
|
|
955
957
|
line: 1,
|
|
956
958
|
column: 1
|
|
957
959
|
}) {
|
|
958
|
-
typeof e == "string" || U(!1, `Body must be a string. Received: ${fe(e)}.`), this.body = e, this.name =
|
|
960
|
+
typeof e == "string" || U(!1, `Body must be a string. Received: ${fe(e)}.`), this.body = e, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || U(
|
|
959
961
|
!1,
|
|
960
962
|
"line in locationOffset is 1-indexed and must be positive."
|
|
961
963
|
), this.locationOffset.column > 0 || U(
|
|
@@ -967,24 +969,24 @@ class ge {
|
|
|
967
969
|
return "Source";
|
|
968
970
|
}
|
|
969
971
|
}
|
|
970
|
-
function
|
|
971
|
-
return
|
|
972
|
+
function et(t) {
|
|
973
|
+
return Ke(t, Ie);
|
|
972
974
|
}
|
|
973
|
-
function
|
|
974
|
-
const
|
|
975
|
+
function tt(t, e) {
|
|
976
|
+
const n = new nt(t, e), i = n.parseDocument();
|
|
975
977
|
return Object.defineProperty(i, "tokenCount", {
|
|
976
978
|
enumerable: !1,
|
|
977
|
-
value:
|
|
979
|
+
value: n.tokenCount
|
|
978
980
|
}), i;
|
|
979
981
|
}
|
|
980
|
-
class
|
|
981
|
-
constructor(e,
|
|
982
|
-
const { lexer: i, ...r } =
|
|
982
|
+
class nt {
|
|
983
|
+
constructor(e, n = {}) {
|
|
984
|
+
const { lexer: i, ...r } = n;
|
|
983
985
|
if (i)
|
|
984
986
|
this._lexer = i;
|
|
985
987
|
else {
|
|
986
|
-
const s =
|
|
987
|
-
this._lexer = new
|
|
988
|
+
const s = et(e) ? e : new Ie(e);
|
|
989
|
+
this._lexer = new Fe(s);
|
|
988
990
|
}
|
|
989
991
|
this._options = r, this._tokenCounter = 0;
|
|
990
992
|
}
|
|
@@ -1041,15 +1043,15 @@ class tt {
|
|
|
1041
1043
|
parseDefinition() {
|
|
1042
1044
|
if (this.peek(a.BRACE_L))
|
|
1043
1045
|
return this.parseOperationDefinition();
|
|
1044
|
-
const e = this.peekDescription(),
|
|
1045
|
-
if (e &&
|
|
1046
|
+
const e = this.peekDescription(), n = e ? this._lexer.lookahead() : this._lexer.token;
|
|
1047
|
+
if (e && n.kind === a.BRACE_L)
|
|
1046
1048
|
throw I(
|
|
1047
1049
|
this._lexer.source,
|
|
1048
1050
|
this._lexer.token.start,
|
|
1049
1051
|
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
1050
1052
|
);
|
|
1051
|
-
if (
|
|
1052
|
-
switch (
|
|
1053
|
+
if (n.kind === a.NAME) {
|
|
1054
|
+
switch (n.value) {
|
|
1053
1055
|
case "schema":
|
|
1054
1056
|
return this.parseSchemaDefinition();
|
|
1055
1057
|
case "scalar":
|
|
@@ -1067,7 +1069,7 @@ class tt {
|
|
|
1067
1069
|
case "directive":
|
|
1068
1070
|
return this.parseDirectiveDefinition();
|
|
1069
1071
|
}
|
|
1070
|
-
switch (
|
|
1072
|
+
switch (n.value) {
|
|
1071
1073
|
case "query":
|
|
1072
1074
|
case "mutation":
|
|
1073
1075
|
case "subscription":
|
|
@@ -1081,10 +1083,10 @@ class tt {
|
|
|
1081
1083
|
this._lexer.token.start,
|
|
1082
1084
|
"Unexpected description, only GraphQL definitions support descriptions."
|
|
1083
1085
|
);
|
|
1084
|
-
if (
|
|
1086
|
+
if (n.value === "extend")
|
|
1085
1087
|
return this.parseTypeSystemExtension();
|
|
1086
1088
|
}
|
|
1087
|
-
throw this.unexpected(
|
|
1089
|
+
throw this.unexpected(n);
|
|
1088
1090
|
}
|
|
1089
1091
|
// Implements the parsing rules in the Operations section.
|
|
1090
1092
|
/**
|
|
@@ -1097,19 +1099,19 @@ class tt {
|
|
|
1097
1099
|
if (this.peek(a.BRACE_L))
|
|
1098
1100
|
return this.node(e, {
|
|
1099
1101
|
kind: c.OPERATION_DEFINITION,
|
|
1100
|
-
operation:
|
|
1102
|
+
operation: v.QUERY,
|
|
1101
1103
|
description: void 0,
|
|
1102
1104
|
name: void 0,
|
|
1103
1105
|
variableDefinitions: [],
|
|
1104
1106
|
directives: [],
|
|
1105
1107
|
selectionSet: this.parseSelectionSet()
|
|
1106
1108
|
});
|
|
1107
|
-
const
|
|
1109
|
+
const n = this.parseDescription(), i = this.parseOperationType();
|
|
1108
1110
|
let r;
|
|
1109
1111
|
return this.peek(a.NAME) && (r = this.parseName()), this.node(e, {
|
|
1110
1112
|
kind: c.OPERATION_DEFINITION,
|
|
1111
1113
|
operation: i,
|
|
1112
|
-
description:
|
|
1114
|
+
description: n,
|
|
1113
1115
|
name: r,
|
|
1114
1116
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1115
1117
|
directives: this.parseDirectives(!1),
|
|
@@ -1123,11 +1125,11 @@ class tt {
|
|
|
1123
1125
|
const e = this.expectToken(a.NAME);
|
|
1124
1126
|
switch (e.value) {
|
|
1125
1127
|
case "query":
|
|
1126
|
-
return
|
|
1128
|
+
return v.QUERY;
|
|
1127
1129
|
case "mutation":
|
|
1128
|
-
return
|
|
1130
|
+
return v.MUTATION;
|
|
1129
1131
|
case "subscription":
|
|
1130
|
-
return
|
|
1132
|
+
return v.SUBSCRIPTION;
|
|
1131
1133
|
}
|
|
1132
1134
|
throw this.unexpected(e);
|
|
1133
1135
|
}
|
|
@@ -1194,9 +1196,9 @@ class tt {
|
|
|
1194
1196
|
* Alias : Name :
|
|
1195
1197
|
*/
|
|
1196
1198
|
parseField() {
|
|
1197
|
-
const e = this._lexer.token,
|
|
1199
|
+
const e = this._lexer.token, n = this.parseName();
|
|
1198
1200
|
let i, r;
|
|
1199
|
-
return this.expectOptionalToken(a.COLON) ? (i =
|
|
1201
|
+
return this.expectOptionalToken(a.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(e, {
|
|
1200
1202
|
kind: c.FIELD,
|
|
1201
1203
|
alias: i,
|
|
1202
1204
|
name: r,
|
|
@@ -1209,15 +1211,15 @@ class tt {
|
|
|
1209
1211
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1210
1212
|
*/
|
|
1211
1213
|
parseArguments(e) {
|
|
1212
|
-
const
|
|
1213
|
-
return this.optionalMany(a.PAREN_L,
|
|
1214
|
+
const n = e ? this.parseConstArgument : this.parseArgument;
|
|
1215
|
+
return this.optionalMany(a.PAREN_L, n, a.PAREN_R);
|
|
1214
1216
|
}
|
|
1215
1217
|
/**
|
|
1216
1218
|
* Argument[Const] : Name : Value[?Const]
|
|
1217
1219
|
*/
|
|
1218
1220
|
parseArgument(e = !1) {
|
|
1219
|
-
const
|
|
1220
|
-
return this.expectToken(a.COLON), this.node(
|
|
1221
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1222
|
+
return this.expectToken(a.COLON), this.node(n, {
|
|
1221
1223
|
kind: c.ARGUMENT,
|
|
1222
1224
|
name: i,
|
|
1223
1225
|
value: this.parseValueLiteral(e)
|
|
@@ -1237,14 +1239,14 @@ class tt {
|
|
|
1237
1239
|
parseFragment() {
|
|
1238
1240
|
const e = this._lexer.token;
|
|
1239
1241
|
this.expectToken(a.SPREAD);
|
|
1240
|
-
const
|
|
1241
|
-
return !
|
|
1242
|
+
const n = this.expectOptionalKeyword("on");
|
|
1243
|
+
return !n && this.peek(a.NAME) ? this.node(e, {
|
|
1242
1244
|
kind: c.FRAGMENT_SPREAD,
|
|
1243
1245
|
name: this.parseFragmentName(),
|
|
1244
1246
|
directives: this.parseDirectives(!1)
|
|
1245
1247
|
}) : this.node(e, {
|
|
1246
1248
|
kind: c.INLINE_FRAGMENT,
|
|
1247
|
-
typeCondition:
|
|
1249
|
+
typeCondition: n ? this.parseNamedType() : void 0,
|
|
1248
1250
|
directives: this.parseDirectives(!1),
|
|
1249
1251
|
selectionSet: this.parseSelectionSet()
|
|
1250
1252
|
});
|
|
@@ -1256,10 +1258,10 @@ class tt {
|
|
|
1256
1258
|
* TypeCondition : NamedType
|
|
1257
1259
|
*/
|
|
1258
1260
|
parseFragmentDefinition() {
|
|
1259
|
-
const e = this._lexer.token,
|
|
1261
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1260
1262
|
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, {
|
|
1261
1263
|
kind: c.FRAGMENT_DEFINITION,
|
|
1262
|
-
description:
|
|
1264
|
+
description: n,
|
|
1263
1265
|
name: this.parseFragmentName(),
|
|
1264
1266
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1265
1267
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
@@ -1267,7 +1269,7 @@ class tt {
|
|
|
1267
1269
|
selectionSet: this.parseSelectionSet()
|
|
1268
1270
|
}) : this.node(e, {
|
|
1269
1271
|
kind: c.FRAGMENT_DEFINITION,
|
|
1270
|
-
description:
|
|
1272
|
+
description: n,
|
|
1271
1273
|
name: this.parseFragmentName(),
|
|
1272
1274
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1273
1275
|
directives: this.parseDirectives(!1),
|
|
@@ -1302,45 +1304,45 @@ class tt {
|
|
|
1302
1304
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1303
1305
|
*/
|
|
1304
1306
|
parseValueLiteral(e) {
|
|
1305
|
-
const
|
|
1306
|
-
switch (
|
|
1307
|
+
const n = this._lexer.token;
|
|
1308
|
+
switch (n.kind) {
|
|
1307
1309
|
case a.BRACKET_L:
|
|
1308
1310
|
return this.parseList(e);
|
|
1309
1311
|
case a.BRACE_L:
|
|
1310
1312
|
return this.parseObject(e);
|
|
1311
1313
|
case a.INT:
|
|
1312
|
-
return this.advanceLexer(), this.node(
|
|
1314
|
+
return this.advanceLexer(), this.node(n, {
|
|
1313
1315
|
kind: c.INT,
|
|
1314
|
-
value:
|
|
1316
|
+
value: n.value
|
|
1315
1317
|
});
|
|
1316
1318
|
case a.FLOAT:
|
|
1317
|
-
return this.advanceLexer(), this.node(
|
|
1319
|
+
return this.advanceLexer(), this.node(n, {
|
|
1318
1320
|
kind: c.FLOAT,
|
|
1319
|
-
value:
|
|
1321
|
+
value: n.value
|
|
1320
1322
|
});
|
|
1321
1323
|
case a.STRING:
|
|
1322
1324
|
case a.BLOCK_STRING:
|
|
1323
1325
|
return this.parseStringLiteral();
|
|
1324
1326
|
case a.NAME:
|
|
1325
|
-
switch (this.advanceLexer(),
|
|
1327
|
+
switch (this.advanceLexer(), n.value) {
|
|
1326
1328
|
case "true":
|
|
1327
|
-
return this.node(
|
|
1329
|
+
return this.node(n, {
|
|
1328
1330
|
kind: c.BOOLEAN,
|
|
1329
1331
|
value: !0
|
|
1330
1332
|
});
|
|
1331
1333
|
case "false":
|
|
1332
|
-
return this.node(
|
|
1334
|
+
return this.node(n, {
|
|
1333
1335
|
kind: c.BOOLEAN,
|
|
1334
1336
|
value: !1
|
|
1335
1337
|
});
|
|
1336
1338
|
case "null":
|
|
1337
|
-
return this.node(
|
|
1339
|
+
return this.node(n, {
|
|
1338
1340
|
kind: c.NULL
|
|
1339
1341
|
});
|
|
1340
1342
|
default:
|
|
1341
|
-
return this.node(
|
|
1343
|
+
return this.node(n, {
|
|
1342
1344
|
kind: c.ENUM,
|
|
1343
|
-
value:
|
|
1345
|
+
value: n.value
|
|
1344
1346
|
});
|
|
1345
1347
|
}
|
|
1346
1348
|
case a.DOLLAR:
|
|
@@ -1349,11 +1351,11 @@ class tt {
|
|
|
1349
1351
|
const i = this._lexer.token.value;
|
|
1350
1352
|
throw I(
|
|
1351
1353
|
this._lexer.source,
|
|
1352
|
-
|
|
1354
|
+
n.start,
|
|
1353
1355
|
`Unexpected variable "$${i}" in constant value.`
|
|
1354
1356
|
);
|
|
1355
1357
|
} else
|
|
1356
|
-
throw this.unexpected(
|
|
1358
|
+
throw this.unexpected(n);
|
|
1357
1359
|
return this.parseVariable();
|
|
1358
1360
|
default:
|
|
1359
1361
|
throw this.unexpected();
|
|
@@ -1376,10 +1378,10 @@ class tt {
|
|
|
1376
1378
|
* - [ Value[?Const]+ ]
|
|
1377
1379
|
*/
|
|
1378
1380
|
parseList(e) {
|
|
1379
|
-
const
|
|
1381
|
+
const n = () => this.parseValueLiteral(e);
|
|
1380
1382
|
return this.node(this._lexer.token, {
|
|
1381
1383
|
kind: c.LIST,
|
|
1382
|
-
values: this.any(a.BRACKET_L,
|
|
1384
|
+
values: this.any(a.BRACKET_L, n, a.BRACKET_R)
|
|
1383
1385
|
});
|
|
1384
1386
|
}
|
|
1385
1387
|
/**
|
|
@@ -1390,18 +1392,18 @@ class tt {
|
|
|
1390
1392
|
* ```
|
|
1391
1393
|
*/
|
|
1392
1394
|
parseObject(e) {
|
|
1393
|
-
const
|
|
1395
|
+
const n = () => this.parseObjectField(e);
|
|
1394
1396
|
return this.node(this._lexer.token, {
|
|
1395
1397
|
kind: c.OBJECT,
|
|
1396
|
-
fields: this.any(a.BRACE_L,
|
|
1398
|
+
fields: this.any(a.BRACE_L, n, a.BRACE_R)
|
|
1397
1399
|
});
|
|
1398
1400
|
}
|
|
1399
1401
|
/**
|
|
1400
1402
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1401
1403
|
*/
|
|
1402
1404
|
parseObjectField(e) {
|
|
1403
|
-
const
|
|
1404
|
-
return this.expectToken(a.COLON), this.node(
|
|
1405
|
+
const n = this._lexer.token, i = this.parseName();
|
|
1406
|
+
return this.expectToken(a.COLON), this.node(n, {
|
|
1405
1407
|
kind: c.OBJECT_FIELD,
|
|
1406
1408
|
name: i,
|
|
1407
1409
|
value: this.parseValueLiteral(e)
|
|
@@ -1412,10 +1414,10 @@ class tt {
|
|
|
1412
1414
|
* Directives[Const] : Directive[?Const]+
|
|
1413
1415
|
*/
|
|
1414
1416
|
parseDirectives(e) {
|
|
1415
|
-
const
|
|
1417
|
+
const n = [];
|
|
1416
1418
|
for (; this.peek(a.AT); )
|
|
1417
|
-
|
|
1418
|
-
return
|
|
1419
|
+
n.push(this.parseDirective(e));
|
|
1420
|
+
return n;
|
|
1419
1421
|
}
|
|
1420
1422
|
parseConstDirectives() {
|
|
1421
1423
|
return this.parseDirectives(!0);
|
|
@@ -1426,8 +1428,8 @@ class tt {
|
|
|
1426
1428
|
* ```
|
|
1427
1429
|
*/
|
|
1428
1430
|
parseDirective(e) {
|
|
1429
|
-
const
|
|
1430
|
-
return this.expectToken(a.AT), this.node(
|
|
1431
|
+
const n = this._lexer.token;
|
|
1432
|
+
return this.expectToken(a.AT), this.node(n, {
|
|
1431
1433
|
kind: c.DIRECTIVE,
|
|
1432
1434
|
name: this.parseName(),
|
|
1433
1435
|
arguments: this.parseArguments(e)
|
|
@@ -1442,19 +1444,19 @@ class tt {
|
|
|
1442
1444
|
*/
|
|
1443
1445
|
parseTypeReference() {
|
|
1444
1446
|
const e = this._lexer.token;
|
|
1445
|
-
let
|
|
1447
|
+
let n;
|
|
1446
1448
|
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1447
1449
|
const i = this.parseTypeReference();
|
|
1448
|
-
this.expectToken(a.BRACKET_R),
|
|
1450
|
+
this.expectToken(a.BRACKET_R), n = this.node(e, {
|
|
1449
1451
|
kind: c.LIST_TYPE,
|
|
1450
1452
|
type: i
|
|
1451
1453
|
});
|
|
1452
1454
|
} else
|
|
1453
|
-
|
|
1455
|
+
n = this.parseNamedType();
|
|
1454
1456
|
return this.expectOptionalToken(a.BANG) ? this.node(e, {
|
|
1455
1457
|
kind: c.NON_NULL_TYPE,
|
|
1456
|
-
type:
|
|
1457
|
-
}) :
|
|
1458
|
+
type: n
|
|
1459
|
+
}) : n;
|
|
1458
1460
|
}
|
|
1459
1461
|
/**
|
|
1460
1462
|
* NamedType : Name
|
|
@@ -1482,7 +1484,7 @@ class tt {
|
|
|
1482
1484
|
* ```
|
|
1483
1485
|
*/
|
|
1484
1486
|
parseSchemaDefinition() {
|
|
1485
|
-
const e = this._lexer.token,
|
|
1487
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1486
1488
|
this.expectKeyword("schema");
|
|
1487
1489
|
const i = this.parseConstDirectives(), r = this.many(
|
|
1488
1490
|
a.BRACE_L,
|
|
@@ -1491,7 +1493,7 @@ class tt {
|
|
|
1491
1493
|
);
|
|
1492
1494
|
return this.node(e, {
|
|
1493
1495
|
kind: c.SCHEMA_DEFINITION,
|
|
1494
|
-
description:
|
|
1496
|
+
description: n,
|
|
1495
1497
|
directives: i,
|
|
1496
1498
|
operationTypes: r
|
|
1497
1499
|
});
|
|
@@ -1500,12 +1502,12 @@ class tt {
|
|
|
1500
1502
|
* OperationTypeDefinition : OperationType : NamedType
|
|
1501
1503
|
*/
|
|
1502
1504
|
parseOperationTypeDefinition() {
|
|
1503
|
-
const e = this._lexer.token,
|
|
1505
|
+
const e = this._lexer.token, n = this.parseOperationType();
|
|
1504
1506
|
this.expectToken(a.COLON);
|
|
1505
1507
|
const i = this.parseNamedType();
|
|
1506
1508
|
return this.node(e, {
|
|
1507
1509
|
kind: c.OPERATION_TYPE_DEFINITION,
|
|
1508
|
-
operation:
|
|
1510
|
+
operation: n,
|
|
1509
1511
|
type: i
|
|
1510
1512
|
});
|
|
1511
1513
|
}
|
|
@@ -1513,12 +1515,12 @@ class tt {
|
|
|
1513
1515
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1514
1516
|
*/
|
|
1515
1517
|
parseScalarTypeDefinition() {
|
|
1516
|
-
const e = this._lexer.token,
|
|
1518
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1517
1519
|
this.expectKeyword("scalar");
|
|
1518
1520
|
const i = this.parseName(), r = this.parseConstDirectives();
|
|
1519
1521
|
return this.node(e, {
|
|
1520
1522
|
kind: c.SCALAR_TYPE_DEFINITION,
|
|
1521
|
-
description:
|
|
1523
|
+
description: n,
|
|
1522
1524
|
name: i,
|
|
1523
1525
|
directives: r
|
|
1524
1526
|
});
|
|
@@ -1529,12 +1531,12 @@ class tt {
|
|
|
1529
1531
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1530
1532
|
*/
|
|
1531
1533
|
parseObjectTypeDefinition() {
|
|
1532
|
-
const e = this._lexer.token,
|
|
1534
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1533
1535
|
this.expectKeyword("type");
|
|
1534
1536
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1535
1537
|
return this.node(e, {
|
|
1536
1538
|
kind: c.OBJECT_TYPE_DEFINITION,
|
|
1537
|
-
description:
|
|
1539
|
+
description: n,
|
|
1538
1540
|
name: i,
|
|
1539
1541
|
interfaces: r,
|
|
1540
1542
|
directives: s,
|
|
@@ -1566,12 +1568,12 @@ class tt {
|
|
|
1566
1568
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1567
1569
|
*/
|
|
1568
1570
|
parseFieldDefinition() {
|
|
1569
|
-
const e = this._lexer.token,
|
|
1571
|
+
const e = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
1570
1572
|
this.expectToken(a.COLON);
|
|
1571
1573
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1572
1574
|
return this.node(e, {
|
|
1573
1575
|
kind: c.FIELD_DEFINITION,
|
|
1574
|
-
description:
|
|
1576
|
+
description: n,
|
|
1575
1577
|
name: i,
|
|
1576
1578
|
arguments: r,
|
|
1577
1579
|
type: s,
|
|
@@ -1593,7 +1595,7 @@ class tt {
|
|
|
1593
1595
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1594
1596
|
*/
|
|
1595
1597
|
parseInputValueDef() {
|
|
1596
|
-
const e = this._lexer.token,
|
|
1598
|
+
const e = this._lexer.token, n = this.parseDescription(), i = this.parseName();
|
|
1597
1599
|
this.expectToken(a.COLON);
|
|
1598
1600
|
const r = this.parseTypeReference();
|
|
1599
1601
|
let s;
|
|
@@ -1601,7 +1603,7 @@ class tt {
|
|
|
1601
1603
|
const o = this.parseConstDirectives();
|
|
1602
1604
|
return this.node(e, {
|
|
1603
1605
|
kind: c.INPUT_VALUE_DEFINITION,
|
|
1604
|
-
description:
|
|
1606
|
+
description: n,
|
|
1605
1607
|
name: i,
|
|
1606
1608
|
type: r,
|
|
1607
1609
|
defaultValue: s,
|
|
@@ -1613,12 +1615,12 @@ class tt {
|
|
|
1613
1615
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1614
1616
|
*/
|
|
1615
1617
|
parseInterfaceTypeDefinition() {
|
|
1616
|
-
const e = this._lexer.token,
|
|
1618
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1617
1619
|
this.expectKeyword("interface");
|
|
1618
1620
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1619
1621
|
return this.node(e, {
|
|
1620
1622
|
kind: c.INTERFACE_TYPE_DEFINITION,
|
|
1621
|
-
description:
|
|
1623
|
+
description: n,
|
|
1622
1624
|
name: i,
|
|
1623
1625
|
interfaces: r,
|
|
1624
1626
|
directives: s,
|
|
@@ -1630,12 +1632,12 @@ class tt {
|
|
|
1630
1632
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1631
1633
|
*/
|
|
1632
1634
|
parseUnionTypeDefinition() {
|
|
1633
|
-
const e = this._lexer.token,
|
|
1635
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1634
1636
|
this.expectKeyword("union");
|
|
1635
1637
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1636
1638
|
return this.node(e, {
|
|
1637
1639
|
kind: c.UNION_TYPE_DEFINITION,
|
|
1638
|
-
description:
|
|
1640
|
+
description: n,
|
|
1639
1641
|
name: i,
|
|
1640
1642
|
directives: r,
|
|
1641
1643
|
types: s
|
|
@@ -1654,12 +1656,12 @@ class tt {
|
|
|
1654
1656
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1655
1657
|
*/
|
|
1656
1658
|
parseEnumTypeDefinition() {
|
|
1657
|
-
const e = this._lexer.token,
|
|
1659
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1658
1660
|
this.expectKeyword("enum");
|
|
1659
1661
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1660
1662
|
return this.node(e, {
|
|
1661
1663
|
kind: c.ENUM_TYPE_DEFINITION,
|
|
1662
|
-
description:
|
|
1664
|
+
description: n,
|
|
1663
1665
|
name: i,
|
|
1664
1666
|
directives: r,
|
|
1665
1667
|
values: s
|
|
@@ -1681,10 +1683,10 @@ class tt {
|
|
|
1681
1683
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1682
1684
|
*/
|
|
1683
1685
|
parseEnumValueDefinition() {
|
|
1684
|
-
const e = this._lexer.token,
|
|
1686
|
+
const e = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1685
1687
|
return this.node(e, {
|
|
1686
1688
|
kind: c.ENUM_VALUE_DEFINITION,
|
|
1687
|
-
description:
|
|
1689
|
+
description: n,
|
|
1688
1690
|
name: i,
|
|
1689
1691
|
directives: r
|
|
1690
1692
|
});
|
|
@@ -1708,12 +1710,12 @@ class tt {
|
|
|
1708
1710
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1709
1711
|
*/
|
|
1710
1712
|
parseInputObjectTypeDefinition() {
|
|
1711
|
-
const e = this._lexer.token,
|
|
1713
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1712
1714
|
this.expectKeyword("input");
|
|
1713
1715
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1714
1716
|
return this.node(e, {
|
|
1715
1717
|
kind: c.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1716
|
-
description:
|
|
1718
|
+
description: n,
|
|
1717
1719
|
name: i,
|
|
1718
1720
|
directives: r,
|
|
1719
1721
|
fields: s
|
|
@@ -1775,16 +1777,16 @@ class tt {
|
|
|
1775
1777
|
parseSchemaExtension() {
|
|
1776
1778
|
const e = this._lexer.token;
|
|
1777
1779
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1778
|
-
const
|
|
1780
|
+
const n = this.parseConstDirectives(), i = this.optionalMany(
|
|
1779
1781
|
a.BRACE_L,
|
|
1780
1782
|
this.parseOperationTypeDefinition,
|
|
1781
1783
|
a.BRACE_R
|
|
1782
1784
|
);
|
|
1783
|
-
if (
|
|
1785
|
+
if (n.length === 0 && i.length === 0)
|
|
1784
1786
|
throw this.unexpected();
|
|
1785
1787
|
return this.node(e, {
|
|
1786
1788
|
kind: c.SCHEMA_EXTENSION,
|
|
1787
|
-
directives:
|
|
1789
|
+
directives: n,
|
|
1788
1790
|
operationTypes: i
|
|
1789
1791
|
});
|
|
1790
1792
|
}
|
|
@@ -1795,12 +1797,12 @@ class tt {
|
|
|
1795
1797
|
parseScalarTypeExtension() {
|
|
1796
1798
|
const e = this._lexer.token;
|
|
1797
1799
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1798
|
-
const
|
|
1800
|
+
const n = this.parseName(), i = this.parseConstDirectives();
|
|
1799
1801
|
if (i.length === 0)
|
|
1800
1802
|
throw this.unexpected();
|
|
1801
1803
|
return this.node(e, {
|
|
1802
1804
|
kind: c.SCALAR_TYPE_EXTENSION,
|
|
1803
|
-
name:
|
|
1805
|
+
name: n,
|
|
1804
1806
|
directives: i
|
|
1805
1807
|
});
|
|
1806
1808
|
}
|
|
@@ -1813,12 +1815,12 @@ class tt {
|
|
|
1813
1815
|
parseObjectTypeExtension() {
|
|
1814
1816
|
const e = this._lexer.token;
|
|
1815
1817
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1816
|
-
const
|
|
1818
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1817
1819
|
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1818
1820
|
throw this.unexpected();
|
|
1819
1821
|
return this.node(e, {
|
|
1820
1822
|
kind: c.OBJECT_TYPE_EXTENSION,
|
|
1821
|
-
name:
|
|
1823
|
+
name: n,
|
|
1822
1824
|
interfaces: i,
|
|
1823
1825
|
directives: r,
|
|
1824
1826
|
fields: s
|
|
@@ -1833,12 +1835,12 @@ class tt {
|
|
|
1833
1835
|
parseInterfaceTypeExtension() {
|
|
1834
1836
|
const e = this._lexer.token;
|
|
1835
1837
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1836
|
-
const
|
|
1838
|
+
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1837
1839
|
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1838
1840
|
throw this.unexpected();
|
|
1839
1841
|
return this.node(e, {
|
|
1840
1842
|
kind: c.INTERFACE_TYPE_EXTENSION,
|
|
1841
|
-
name:
|
|
1843
|
+
name: n,
|
|
1842
1844
|
interfaces: i,
|
|
1843
1845
|
directives: r,
|
|
1844
1846
|
fields: s
|
|
@@ -1852,12 +1854,12 @@ class tt {
|
|
|
1852
1854
|
parseUnionTypeExtension() {
|
|
1853
1855
|
const e = this._lexer.token;
|
|
1854
1856
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1855
|
-
const
|
|
1857
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1856
1858
|
if (i.length === 0 && r.length === 0)
|
|
1857
1859
|
throw this.unexpected();
|
|
1858
1860
|
return this.node(e, {
|
|
1859
1861
|
kind: c.UNION_TYPE_EXTENSION,
|
|
1860
|
-
name:
|
|
1862
|
+
name: n,
|
|
1861
1863
|
directives: i,
|
|
1862
1864
|
types: r
|
|
1863
1865
|
});
|
|
@@ -1870,12 +1872,12 @@ class tt {
|
|
|
1870
1872
|
parseEnumTypeExtension() {
|
|
1871
1873
|
const e = this._lexer.token;
|
|
1872
1874
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1873
|
-
const
|
|
1875
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1874
1876
|
if (i.length === 0 && r.length === 0)
|
|
1875
1877
|
throw this.unexpected();
|
|
1876
1878
|
return this.node(e, {
|
|
1877
1879
|
kind: c.ENUM_TYPE_EXTENSION,
|
|
1878
|
-
name:
|
|
1880
|
+
name: n,
|
|
1879
1881
|
directives: i,
|
|
1880
1882
|
values: r
|
|
1881
1883
|
});
|
|
@@ -1888,12 +1890,12 @@ class tt {
|
|
|
1888
1890
|
parseInputObjectTypeExtension() {
|
|
1889
1891
|
const e = this._lexer.token;
|
|
1890
1892
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1891
|
-
const
|
|
1893
|
+
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1892
1894
|
if (i.length === 0 && r.length === 0)
|
|
1893
1895
|
throw this.unexpected();
|
|
1894
1896
|
return this.node(e, {
|
|
1895
1897
|
kind: c.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1896
|
-
name:
|
|
1898
|
+
name: n,
|
|
1897
1899
|
directives: i,
|
|
1898
1900
|
fields: r
|
|
1899
1901
|
});
|
|
@@ -1905,14 +1907,14 @@ class tt {
|
|
|
1905
1907
|
* ```
|
|
1906
1908
|
*/
|
|
1907
1909
|
parseDirectiveDefinition() {
|
|
1908
|
-
const e = this._lexer.token,
|
|
1910
|
+
const e = this._lexer.token, n = this.parseDescription();
|
|
1909
1911
|
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1910
1912
|
const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1911
1913
|
this.expectKeyword("on");
|
|
1912
1914
|
const o = this.parseDirectiveLocations();
|
|
1913
1915
|
return this.node(e, {
|
|
1914
1916
|
kind: c.DIRECTIVE_DEFINITION,
|
|
1915
|
-
description:
|
|
1917
|
+
description: n,
|
|
1916
1918
|
name: i,
|
|
1917
1919
|
arguments: r,
|
|
1918
1920
|
repeatable: s,
|
|
@@ -1955,9 +1957,9 @@ class tt {
|
|
|
1955
1957
|
* `INPUT_FIELD_DEFINITION`
|
|
1956
1958
|
*/
|
|
1957
1959
|
parseDirectiveLocation() {
|
|
1958
|
-
const e = this._lexer.token,
|
|
1959
|
-
if (Object.prototype.hasOwnProperty.call(q,
|
|
1960
|
-
return
|
|
1960
|
+
const e = this._lexer.token, n = this.parseName();
|
|
1961
|
+
if (Object.prototype.hasOwnProperty.call(q, n.value))
|
|
1962
|
+
return n;
|
|
1961
1963
|
throw this.unexpected(e);
|
|
1962
1964
|
}
|
|
1963
1965
|
// Schema Coordinates
|
|
@@ -1970,11 +1972,11 @@ class tt {
|
|
|
1970
1972
|
* - \@ Name ( Name : )
|
|
1971
1973
|
*/
|
|
1972
1974
|
parseSchemaCoordinate() {
|
|
1973
|
-
const e = this._lexer.token,
|
|
1975
|
+
const e = this._lexer.token, n = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1974
1976
|
let r;
|
|
1975
|
-
!
|
|
1977
|
+
!n && this.expectOptionalToken(a.DOT) && (r = this.parseName());
|
|
1976
1978
|
let s;
|
|
1977
|
-
return (
|
|
1979
|
+
return (n || r) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), n ? s ? this.node(e, {
|
|
1978
1980
|
kind: c.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1979
1981
|
name: i,
|
|
1980
1982
|
argumentName: s
|
|
@@ -2001,12 +2003,12 @@ class tt {
|
|
|
2001
2003
|
* location object, used to identify the place in the source that created a
|
|
2002
2004
|
* given parsed object.
|
|
2003
2005
|
*/
|
|
2004
|
-
node(e,
|
|
2005
|
-
return this._options.noLocation !== !0 && (
|
|
2006
|
+
node(e, n) {
|
|
2007
|
+
return this._options.noLocation !== !0 && (n.loc = new Se(
|
|
2006
2008
|
e,
|
|
2007
2009
|
this._lexer.lastToken,
|
|
2008
2010
|
this._lexer.source
|
|
2009
|
-
)),
|
|
2011
|
+
)), n;
|
|
2010
2012
|
}
|
|
2011
2013
|
/**
|
|
2012
2014
|
* Determines if the next token is of a given kind
|
|
@@ -2019,13 +2021,13 @@ class tt {
|
|
|
2019
2021
|
* Otherwise, do not change the parser state and throw an error.
|
|
2020
2022
|
*/
|
|
2021
2023
|
expectToken(e) {
|
|
2022
|
-
const
|
|
2023
|
-
if (
|
|
2024
|
-
return this.advanceLexer(),
|
|
2024
|
+
const n = this._lexer.token;
|
|
2025
|
+
if (n.kind === e)
|
|
2026
|
+
return this.advanceLexer(), n;
|
|
2025
2027
|
throw I(
|
|
2026
2028
|
this._lexer.source,
|
|
2027
|
-
|
|
2028
|
-
`Expected ${
|
|
2029
|
+
n.start,
|
|
2030
|
+
`Expected ${Ee(e)}, found ${_(n)}.`
|
|
2029
2031
|
);
|
|
2030
2032
|
}
|
|
2031
2033
|
/**
|
|
@@ -2040,14 +2042,14 @@ class tt {
|
|
|
2040
2042
|
* Otherwise, do not change the parser state and throw an error.
|
|
2041
2043
|
*/
|
|
2042
2044
|
expectKeyword(e) {
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2045
|
+
const n = this._lexer.token;
|
|
2046
|
+
if (n.kind === a.NAME && n.value === e)
|
|
2045
2047
|
this.advanceLexer();
|
|
2046
2048
|
else
|
|
2047
2049
|
throw I(
|
|
2048
2050
|
this._lexer.source,
|
|
2049
|
-
|
|
2050
|
-
`Expected "${e}", found ${_(
|
|
2051
|
+
n.start,
|
|
2052
|
+
`Expected "${e}", found ${_(n)}.`
|
|
2051
2053
|
);
|
|
2052
2054
|
}
|
|
2053
2055
|
/**
|
|
@@ -2055,18 +2057,18 @@ class tt {
|
|
|
2055
2057
|
* Otherwise, do not change the parser state and return "false".
|
|
2056
2058
|
*/
|
|
2057
2059
|
expectOptionalKeyword(e) {
|
|
2058
|
-
const
|
|
2059
|
-
return
|
|
2060
|
+
const n = this._lexer.token;
|
|
2061
|
+
return n.kind === a.NAME && n.value === e ? (this.advanceLexer(), !0) : !1;
|
|
2060
2062
|
}
|
|
2061
2063
|
/**
|
|
2062
2064
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2063
2065
|
*/
|
|
2064
2066
|
unexpected(e) {
|
|
2065
|
-
const
|
|
2067
|
+
const n = e ?? this._lexer.token;
|
|
2066
2068
|
return I(
|
|
2067
2069
|
this._lexer.source,
|
|
2068
|
-
|
|
2069
|
-
`Unexpected ${_(
|
|
2070
|
+
n.start,
|
|
2071
|
+
`Unexpected ${_(n)}.`
|
|
2070
2072
|
);
|
|
2071
2073
|
}
|
|
2072
2074
|
/**
|
|
@@ -2074,11 +2076,11 @@ class tt {
|
|
|
2074
2076
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2075
2077
|
* Advances the parser to the next lex token after the closing token.
|
|
2076
2078
|
*/
|
|
2077
|
-
any(e,
|
|
2079
|
+
any(e, n, i) {
|
|
2078
2080
|
this.expectToken(e);
|
|
2079
2081
|
const r = [];
|
|
2080
2082
|
for (; !this.expectOptionalToken(i); )
|
|
2081
|
-
r.push(
|
|
2083
|
+
r.push(n.call(this));
|
|
2082
2084
|
return r;
|
|
2083
2085
|
}
|
|
2084
2086
|
/**
|
|
@@ -2087,11 +2089,11 @@ class tt {
|
|
|
2087
2089
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2088
2090
|
* Advances the parser to the next lex token after the closing token.
|
|
2089
2091
|
*/
|
|
2090
|
-
optionalMany(e,
|
|
2092
|
+
optionalMany(e, n, i) {
|
|
2091
2093
|
if (this.expectOptionalToken(e)) {
|
|
2092
2094
|
const r = [];
|
|
2093
2095
|
do
|
|
2094
|
-
r.push(
|
|
2096
|
+
r.push(n.call(this));
|
|
2095
2097
|
while (!this.expectOptionalToken(i));
|
|
2096
2098
|
return r;
|
|
2097
2099
|
}
|
|
@@ -2102,11 +2104,11 @@ class tt {
|
|
|
2102
2104
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2103
2105
|
* Advances the parser to the next lex token after the closing token.
|
|
2104
2106
|
*/
|
|
2105
|
-
many(e,
|
|
2107
|
+
many(e, n, i) {
|
|
2106
2108
|
this.expectToken(e);
|
|
2107
2109
|
const r = [];
|
|
2108
2110
|
do
|
|
2109
|
-
r.push(
|
|
2111
|
+
r.push(n.call(this));
|
|
2110
2112
|
while (!this.expectOptionalToken(i));
|
|
2111
2113
|
return r;
|
|
2112
2114
|
}
|
|
@@ -2115,107 +2117,107 @@ class tt {
|
|
|
2115
2117
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2116
2118
|
* Advances the parser to the next lex token after last item in the list.
|
|
2117
2119
|
*/
|
|
2118
|
-
delimitedMany(e,
|
|
2120
|
+
delimitedMany(e, n) {
|
|
2119
2121
|
this.expectOptionalToken(e);
|
|
2120
2122
|
const i = [];
|
|
2121
2123
|
do
|
|
2122
|
-
i.push(
|
|
2124
|
+
i.push(n.call(this));
|
|
2123
2125
|
while (this.expectOptionalToken(e));
|
|
2124
2126
|
return i;
|
|
2125
2127
|
}
|
|
2126
2128
|
advanceLexer() {
|
|
2127
|
-
const { maxTokens: e } = this._options,
|
|
2128
|
-
if (
|
|
2129
|
+
const { maxTokens: e } = this._options, n = this._lexer.advance();
|
|
2130
|
+
if (n.kind !== a.EOF && (++this._tokenCounter, e !== void 0 && this._tokenCounter > e))
|
|
2129
2131
|
throw I(
|
|
2130
2132
|
this._lexer.source,
|
|
2131
|
-
|
|
2133
|
+
n.start,
|
|
2132
2134
|
`Document contains more that ${e} tokens. Parsing aborted.`
|
|
2133
2135
|
);
|
|
2134
2136
|
}
|
|
2135
2137
|
}
|
|
2136
|
-
function _(
|
|
2137
|
-
const e =
|
|
2138
|
-
return
|
|
2138
|
+
function _(t) {
|
|
2139
|
+
const e = t.value;
|
|
2140
|
+
return Ee(t.kind) + (e != null ? ` "${e}"` : "");
|
|
2139
2141
|
}
|
|
2140
|
-
function
|
|
2141
|
-
return we(
|
|
2142
|
+
function Ee(t) {
|
|
2143
|
+
return we(t) ? `"${t}"` : t;
|
|
2142
2144
|
}
|
|
2143
|
-
var L = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(),
|
|
2144
|
-
function
|
|
2145
|
-
return
|
|
2145
|
+
var L = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), ye = !0, $ = !1;
|
|
2146
|
+
function ke(t) {
|
|
2147
|
+
return t.replace(/[\s,]+/g, " ").trim();
|
|
2146
2148
|
}
|
|
2147
|
-
function
|
|
2148
|
-
return
|
|
2149
|
+
function it(t) {
|
|
2150
|
+
return ke(t.source.body.substring(t.start, t.end));
|
|
2149
2151
|
}
|
|
2150
|
-
function
|
|
2151
|
-
var e = /* @__PURE__ */ new Set(),
|
|
2152
|
-
return
|
|
2152
|
+
function rt(t) {
|
|
2153
|
+
var e = /* @__PURE__ */ new Set(), n = [];
|
|
2154
|
+
return t.definitions.forEach(function(i) {
|
|
2153
2155
|
if (i.kind === "FragmentDefinition") {
|
|
2154
|
-
var r = i.name.value, s =
|
|
2155
|
-
o && !o.has(s) ?
|
|
2156
|
+
var r = i.name.value, s = it(i.loc), o = G.get(r);
|
|
2157
|
+
o && !o.has(s) ? ye && console.warn("Warning: fragment with name " + r + ` already exists.
|
|
2156
2158
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2157
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(r, o = /* @__PURE__ */ new Set()), o.add(s), e.has(s) || (e.add(s),
|
|
2159
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(r, o = /* @__PURE__ */ new Set()), o.add(s), e.has(s) || (e.add(s), n.push(i));
|
|
2158
2160
|
} else
|
|
2159
|
-
|
|
2160
|
-
}),
|
|
2161
|
+
n.push(i);
|
|
2162
|
+
}), w(w({}, t), { definitions: n });
|
|
2161
2163
|
}
|
|
2162
|
-
function
|
|
2163
|
-
var e = new Set(
|
|
2164
|
+
function st(t) {
|
|
2165
|
+
var e = new Set(t.definitions);
|
|
2164
2166
|
e.forEach(function(i) {
|
|
2165
2167
|
i.loc && delete i.loc, Object.keys(i).forEach(function(r) {
|
|
2166
2168
|
var s = i[r];
|
|
2167
2169
|
s && typeof s == "object" && e.add(s);
|
|
2168
2170
|
});
|
|
2169
2171
|
});
|
|
2170
|
-
var
|
|
2171
|
-
return
|
|
2172
|
+
var n = t.loc;
|
|
2173
|
+
return n && (delete n.startToken, delete n.endToken), t;
|
|
2172
2174
|
}
|
|
2173
|
-
function
|
|
2174
|
-
var e =
|
|
2175
|
+
function at(t) {
|
|
2176
|
+
var e = ke(t);
|
|
2175
2177
|
if (!L.has(e)) {
|
|
2176
|
-
var
|
|
2178
|
+
var n = tt(t, {
|
|
2177
2179
|
experimentalFragmentVariables: $,
|
|
2178
2180
|
allowLegacyFragmentVariables: $
|
|
2179
2181
|
});
|
|
2180
|
-
if (!
|
|
2182
|
+
if (!n || n.kind !== "Document")
|
|
2181
2183
|
throw new Error("Not a valid GraphQL document.");
|
|
2182
|
-
L.set(e, rt(
|
|
2184
|
+
L.set(e, st(rt(n)));
|
|
2183
2185
|
}
|
|
2184
2186
|
return L.get(e);
|
|
2185
2187
|
}
|
|
2186
|
-
function
|
|
2187
|
-
for (var e = [],
|
|
2188
|
-
e[
|
|
2189
|
-
typeof
|
|
2190
|
-
var i =
|
|
2188
|
+
function u(t) {
|
|
2189
|
+
for (var e = [], n = 1; n < arguments.length; n++)
|
|
2190
|
+
e[n - 1] = arguments[n];
|
|
2191
|
+
typeof t == "string" && (t = [t]);
|
|
2192
|
+
var i = t[0];
|
|
2191
2193
|
return e.forEach(function(r, s) {
|
|
2192
|
-
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i +=
|
|
2193
|
-
}),
|
|
2194
|
-
}
|
|
2195
|
-
function at() {
|
|
2196
|
-
L.clear(), G.clear();
|
|
2194
|
+
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i += t[s + 1];
|
|
2195
|
+
}), at(i);
|
|
2197
2196
|
}
|
|
2198
2197
|
function ot() {
|
|
2199
|
-
|
|
2198
|
+
L.clear(), G.clear();
|
|
2200
2199
|
}
|
|
2201
2200
|
function ct() {
|
|
2202
|
-
|
|
2201
|
+
ye = !1;
|
|
2203
2202
|
}
|
|
2204
2203
|
function dt() {
|
|
2204
|
+
$ = !0;
|
|
2205
|
+
}
|
|
2206
|
+
function ut() {
|
|
2205
2207
|
$ = !1;
|
|
2206
2208
|
}
|
|
2207
2209
|
var P = {
|
|
2208
|
-
gql:
|
|
2209
|
-
resetCaches:
|
|
2210
|
-
disableFragmentWarnings:
|
|
2211
|
-
enableExperimentalFragmentVariables:
|
|
2212
|
-
disableExperimentalFragmentVariables:
|
|
2210
|
+
gql: u,
|
|
2211
|
+
resetCaches: ot,
|
|
2212
|
+
disableFragmentWarnings: ct,
|
|
2213
|
+
enableExperimentalFragmentVariables: dt,
|
|
2214
|
+
disableExperimentalFragmentVariables: ut
|
|
2213
2215
|
};
|
|
2214
|
-
(function(
|
|
2215
|
-
|
|
2216
|
-
})(
|
|
2217
|
-
|
|
2218
|
-
const
|
|
2216
|
+
(function(t) {
|
|
2217
|
+
t.gql = P.gql, t.resetCaches = P.resetCaches, t.disableFragmentWarnings = P.disableFragmentWarnings, t.enableExperimentalFragmentVariables = P.enableExperimentalFragmentVariables, t.disableExperimentalFragmentVariables = P.disableExperimentalFragmentVariables;
|
|
2218
|
+
})(u || (u = {}));
|
|
2219
|
+
u.default = u;
|
|
2220
|
+
const lt = u`
|
|
2219
2221
|
query findActiveOrderById($id: String) {
|
|
2220
2222
|
findOrder(id: $id) {
|
|
2221
2223
|
id
|
|
@@ -2302,7 +2304,7 @@ const ut = l`
|
|
|
2302
2304
|
}
|
|
2303
2305
|
}
|
|
2304
2306
|
}
|
|
2305
|
-
`,
|
|
2307
|
+
`, pt = u`
|
|
2306
2308
|
query findOrderById($id: String, $reference: String) {
|
|
2307
2309
|
findOrder(id: $id, reference: $reference) {
|
|
2308
2310
|
id
|
|
@@ -2346,7 +2348,7 @@ const ut = l`
|
|
|
2346
2348
|
downloadCode
|
|
2347
2349
|
}
|
|
2348
2350
|
}
|
|
2349
|
-
`, ht =
|
|
2351
|
+
`, ht = u`
|
|
2350
2352
|
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2351
2353
|
reserveProduct(
|
|
2352
2354
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
@@ -2356,7 +2358,7 @@ const ut = l`
|
|
|
2356
2358
|
amountReserved
|
|
2357
2359
|
}
|
|
2358
2360
|
}
|
|
2359
|
-
`,
|
|
2361
|
+
`, gt = u`
|
|
2360
2362
|
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2361
2363
|
releaseProduct(
|
|
2362
2364
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
@@ -2365,7 +2367,7 @@ const ut = l`
|
|
|
2365
2367
|
amountReleased
|
|
2366
2368
|
}
|
|
2367
2369
|
}
|
|
2368
|
-
`, mt =
|
|
2370
|
+
`, mt = u`
|
|
2369
2371
|
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
|
|
2370
2372
|
configurePackage(
|
|
2371
2373
|
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
@@ -2375,7 +2377,7 @@ const ut = l`
|
|
|
2375
2377
|
amountReserved
|
|
2376
2378
|
}
|
|
2377
2379
|
}
|
|
2378
|
-
`, ft =
|
|
2380
|
+
`, ft = u`
|
|
2379
2381
|
mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
|
|
2380
2382
|
reserveAdditionalPackageItem(
|
|
2381
2383
|
input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
|
|
@@ -2385,158 +2387,158 @@ const ut = l`
|
|
|
2385
2387
|
amountReserved
|
|
2386
2388
|
}
|
|
2387
2389
|
}
|
|
2388
|
-
`,
|
|
2390
|
+
`, It = u`
|
|
2389
2391
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2390
2392
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2391
2393
|
}
|
|
2392
|
-
`,
|
|
2394
|
+
`, Et = u`
|
|
2393
2395
|
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2394
2396
|
createOrderCustomer(
|
|
2395
2397
|
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2396
2398
|
)
|
|
2397
2399
|
}
|
|
2398
|
-
`,
|
|
2400
|
+
`, yt = u`
|
|
2399
2401
|
mutation deleteOrder($orderId: ID!) {
|
|
2400
2402
|
cancelOrder(id: $orderId)
|
|
2401
2403
|
}
|
|
2402
|
-
`,
|
|
2403
|
-
function Ot(
|
|
2404
|
+
`, kt = (t, e, n, i) => t();
|
|
2405
|
+
function Ot(t, e = kt) {
|
|
2404
2406
|
return {
|
|
2405
|
-
findActiveOrderById(
|
|
2406
|
-
return e((s) =>
|
|
2407
|
+
findActiveOrderById(n, i, r) {
|
|
2408
|
+
return e((s) => t.request({ document: lt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findActiveOrderById", "query", n);
|
|
2407
2409
|
},
|
|
2408
|
-
findOrderById(
|
|
2409
|
-
return e((s) =>
|
|
2410
|
+
findOrderById(n, i, r) {
|
|
2411
|
+
return e((s) => t.request({ document: pt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findOrderById", "query", n);
|
|
2410
2412
|
},
|
|
2411
|
-
addToOrder(
|
|
2412
|
-
return e((s) =>
|
|
2413
|
+
addToOrder(n, i, r) {
|
|
2414
|
+
return e((s) => t.request({ document: ht, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "addToOrder", "mutation", n);
|
|
2413
2415
|
},
|
|
2414
|
-
removeFromOrder(
|
|
2415
|
-
return e((s) =>
|
|
2416
|
+
removeFromOrder(n, i, r) {
|
|
2417
|
+
return e((s) => t.request({ document: gt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "removeFromOrder", "mutation", n);
|
|
2416
2418
|
},
|
|
2417
|
-
configurePackage(
|
|
2418
|
-
return e((s) =>
|
|
2419
|
+
configurePackage(n, i, r) {
|
|
2420
|
+
return e((s) => t.request({ document: mt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configurePackage", "mutation", n);
|
|
2419
2421
|
},
|
|
2420
|
-
reserveAdditionalPackageItem(
|
|
2421
|
-
return e((s) =>
|
|
2422
|
+
reserveAdditionalPackageItem(n, i, r) {
|
|
2423
|
+
return e((s) => t.request({ document: ft, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "reserveAdditionalPackageItem", "mutation", n);
|
|
2422
2424
|
},
|
|
2423
|
-
configureOrderDeliveryOption(
|
|
2424
|
-
return e((s) =>
|
|
2425
|
+
configureOrderDeliveryOption(n, i, r) {
|
|
2426
|
+
return e((s) => t.request({ document: It, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configureOrderDeliveryOption", "mutation", n);
|
|
2425
2427
|
},
|
|
2426
|
-
createOrderCustomer(
|
|
2427
|
-
return e((s) =>
|
|
2428
|
+
createOrderCustomer(n, i, r) {
|
|
2429
|
+
return e((s) => t.request({ document: Et, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createOrderCustomer", "mutation", n);
|
|
2428
2430
|
},
|
|
2429
|
-
deleteOrder(
|
|
2430
|
-
return e((s) =>
|
|
2431
|
+
deleteOrder(n, i, r) {
|
|
2432
|
+
return e((s) => t.request({ document: yt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "deleteOrder", "mutation", n);
|
|
2431
2433
|
}
|
|
2432
2434
|
};
|
|
2433
2435
|
}
|
|
2434
|
-
class
|
|
2436
|
+
class At {
|
|
2435
2437
|
config;
|
|
2436
2438
|
sdk;
|
|
2437
2439
|
constructor(e) {
|
|
2438
|
-
this.config = e, this.sdk = Ot(new
|
|
2440
|
+
this.config = e, this.sdk = Ot(new N(e.apiUrl));
|
|
2439
2441
|
}
|
|
2440
2442
|
// Basket update functions
|
|
2441
|
-
async addProduct(e,
|
|
2443
|
+
async addProduct(e, n, i) {
|
|
2442
2444
|
try {
|
|
2443
2445
|
return this.debugLog("Adding product", {
|
|
2444
|
-
productId:
|
|
2446
|
+
productId: n.id,
|
|
2445
2447
|
orderId: e,
|
|
2446
|
-
amount:
|
|
2447
|
-
seat:
|
|
2448
|
+
amount: n.amount,
|
|
2449
|
+
seat: n.seat
|
|
2448
2450
|
}), (await this.sdk.addToOrder({
|
|
2449
|
-
productId:
|
|
2451
|
+
productId: n.id,
|
|
2450
2452
|
orderId: e,
|
|
2451
|
-
additionalData:
|
|
2453
|
+
additionalData: n.seat ? {
|
|
2452
2454
|
seat: {
|
|
2453
|
-
seatId:
|
|
2454
|
-
seatLabel:
|
|
2455
|
-
holdToken:
|
|
2455
|
+
seatId: n.seat.id,
|
|
2456
|
+
seatLabel: n.seat.label,
|
|
2457
|
+
holdToken: n.seat.holdToken
|
|
2456
2458
|
}
|
|
2457
2459
|
} : null,
|
|
2458
2460
|
trackerId: this.config.trackerId,
|
|
2459
|
-
shopId:
|
|
2460
|
-
amount:
|
|
2461
|
+
shopId: i,
|
|
2462
|
+
amount: n.amount
|
|
2461
2463
|
})).reserveProduct;
|
|
2462
|
-
} catch (
|
|
2463
|
-
throw this.debugLog("Error adding product",
|
|
2464
|
+
} catch (r) {
|
|
2465
|
+
throw this.debugLog("Error adding product", r), this.handleError(r), r;
|
|
2464
2466
|
}
|
|
2465
2467
|
}
|
|
2466
|
-
async removeProduct(e,
|
|
2468
|
+
async removeProduct(e, n) {
|
|
2467
2469
|
try {
|
|
2468
2470
|
return this.debugLog("Removing product", {
|
|
2469
|
-
productId:
|
|
2471
|
+
productId: n.id,
|
|
2470
2472
|
orderId: e,
|
|
2471
|
-
amount:
|
|
2473
|
+
amount: n.amount
|
|
2472
2474
|
}), (await this.sdk.removeFromOrder({
|
|
2473
|
-
productId:
|
|
2475
|
+
productId: n.id,
|
|
2474
2476
|
orderId: e,
|
|
2475
|
-
additionalData:
|
|
2477
|
+
additionalData: n.seat ? {
|
|
2476
2478
|
seat: {
|
|
2477
|
-
seatId:
|
|
2478
|
-
seatLabel:
|
|
2479
|
+
seatId: n.seat.id,
|
|
2480
|
+
seatLabel: n.seat.label
|
|
2479
2481
|
}
|
|
2480
2482
|
} : null,
|
|
2481
|
-
amount:
|
|
2483
|
+
amount: n.amount
|
|
2482
2484
|
})).releaseProduct ?? null;
|
|
2483
2485
|
} catch (i) {
|
|
2484
2486
|
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
2485
2487
|
}
|
|
2486
2488
|
}
|
|
2487
|
-
async configurePackage(e,
|
|
2489
|
+
async configurePackage(e, n, i) {
|
|
2488
2490
|
try {
|
|
2489
|
-
const
|
|
2490
|
-
packageItemId:
|
|
2491
|
-
eventId:
|
|
2491
|
+
const r = n.items.map((o) => ({
|
|
2492
|
+
packageItemId: o.packageItemId,
|
|
2493
|
+
eventId: o.eventId
|
|
2492
2494
|
}));
|
|
2493
2495
|
this.debugLog("Configuring package", {
|
|
2494
|
-
packageId:
|
|
2496
|
+
packageId: n.id,
|
|
2495
2497
|
orderId: e,
|
|
2496
|
-
amount:
|
|
2497
|
-
items:
|
|
2498
|
-
shopId:
|
|
2498
|
+
amount: n.amount,
|
|
2499
|
+
items: r,
|
|
2500
|
+
shopId: i
|
|
2499
2501
|
});
|
|
2500
|
-
const
|
|
2502
|
+
const s = await this.sdk.configurePackage({
|
|
2501
2503
|
trackerId: this.config.trackerId,
|
|
2502
|
-
shopId:
|
|
2503
|
-
packageId:
|
|
2504
|
+
shopId: i,
|
|
2505
|
+
packageId: n.id,
|
|
2504
2506
|
orderId: e,
|
|
2505
|
-
amount:
|
|
2506
|
-
items:
|
|
2507
|
+
amount: n.amount,
|
|
2508
|
+
items: r
|
|
2507
2509
|
});
|
|
2508
|
-
return this.debugLog("Configure package response"),
|
|
2509
|
-
} catch (
|
|
2510
|
-
throw this.debugLog("Error configuring package",
|
|
2510
|
+
return this.debugLog("Configure package response"), s.configurePackage ?? null;
|
|
2511
|
+
} catch (r) {
|
|
2512
|
+
throw this.debugLog("Error configuring package", r), this.handleError(r), r;
|
|
2511
2513
|
}
|
|
2512
2514
|
}
|
|
2513
|
-
async configureCustomer(e,
|
|
2514
|
-
this.debugLog("Creating/replacing customer", { orderId: e, email:
|
|
2515
|
+
async configureCustomer(e, n) {
|
|
2516
|
+
this.debugLog("Creating/replacing customer", { orderId: e, email: n.email });
|
|
2515
2517
|
try {
|
|
2516
2518
|
const i = await this.sdk.createOrderCustomer({
|
|
2517
2519
|
orderId: e,
|
|
2518
|
-
customer:
|
|
2520
|
+
customer: n
|
|
2519
2521
|
});
|
|
2520
2522
|
this.debugLog("Customer set successfully", i);
|
|
2521
2523
|
} catch (i) {
|
|
2522
2524
|
throw this.debugLog("Failed to set customer", i), new Error(`Failed to set customer: ${i.message}`);
|
|
2523
2525
|
}
|
|
2524
2526
|
}
|
|
2525
|
-
async reserveAdditionalPackageItem(e,
|
|
2527
|
+
async reserveAdditionalPackageItem(e, n) {
|
|
2526
2528
|
try {
|
|
2527
2529
|
this.debugLog("reserve additional packageItem", {
|
|
2528
2530
|
orderId: e,
|
|
2529
|
-
eventId:
|
|
2530
|
-
amount:
|
|
2531
|
-
packageId:
|
|
2532
|
-
packageItemId:
|
|
2531
|
+
eventId: n.eventId,
|
|
2532
|
+
amount: n.amount,
|
|
2533
|
+
packageId: n.packageId,
|
|
2534
|
+
packageItemId: n.packageItemId
|
|
2533
2535
|
});
|
|
2534
2536
|
const i = await this.sdk.reserveAdditionalPackageItem({
|
|
2535
2537
|
orderId: e,
|
|
2536
|
-
eventId:
|
|
2537
|
-
amount:
|
|
2538
|
-
packageId:
|
|
2539
|
-
packageItemId:
|
|
2538
|
+
eventId: n.eventId,
|
|
2539
|
+
amount: n.amount,
|
|
2540
|
+
packageId: n.packageId,
|
|
2541
|
+
packageItemId: n.packageItemId
|
|
2540
2542
|
});
|
|
2541
2543
|
return this.debugLog("reserve additional packageItem"), i.reserveAdditionalPackageItem ?? null;
|
|
2542
2544
|
} catch (i) {
|
|
@@ -2547,9 +2549,9 @@ class kt {
|
|
|
2547
2549
|
async cancelOrder(e) {
|
|
2548
2550
|
e && (this.debugLog("Cancelling order", { orderId: e }), await this.sdk.deleteOrder({ orderId: e }), this.debugLog("Order cancelled successfully"));
|
|
2549
2551
|
}
|
|
2550
|
-
async findOrder(e,
|
|
2552
|
+
async findOrder(e, n) {
|
|
2551
2553
|
try {
|
|
2552
|
-
const i = await this.sdk.findOrderById({ id: e, reference:
|
|
2554
|
+
const i = await this.sdk.findOrderById({ id: e, reference: n });
|
|
2553
2555
|
return i.findOrder ? {
|
|
2554
2556
|
id: i.findOrder.id,
|
|
2555
2557
|
reference: i.findOrder.reference,
|
|
@@ -2577,16 +2579,16 @@ class kt {
|
|
|
2577
2579
|
async findActiveOrder(e) {
|
|
2578
2580
|
this.debugLog("Fetching order from server", { orderId: e });
|
|
2579
2581
|
try {
|
|
2580
|
-
const
|
|
2581
|
-
if (!
|
|
2582
|
+
const n = await this.sdk.findActiveOrderById({ id: e });
|
|
2583
|
+
if (!n?.findOrder)
|
|
2582
2584
|
return null;
|
|
2583
|
-
const i =
|
|
2585
|
+
const i = n.findOrder;
|
|
2584
2586
|
this.debugLog("Order fetched successfully", i);
|
|
2585
2587
|
const r = i.items, s = r.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
2586
|
-
let
|
|
2587
|
-
return d.product.type === "PROMOTER" ?
|
|
2588
|
+
let m = T.PRODUCT;
|
|
2589
|
+
return d.product.type === "PROMOTER" ? m = T.ADD_ONS : d.product.type === "PICKUP" ? m = T.PICKUP : d.product.type === "DELIVERY" && (m = T.DELIVERY), {
|
|
2588
2590
|
id: d.product.id,
|
|
2589
|
-
type:
|
|
2591
|
+
type: m,
|
|
2590
2592
|
name: d.product.name,
|
|
2591
2593
|
icon: d.product.icon,
|
|
2592
2594
|
description: d.product.description,
|
|
@@ -2600,18 +2602,18 @@ class kt {
|
|
|
2600
2602
|
label: y.label
|
|
2601
2603
|
}))
|
|
2602
2604
|
};
|
|
2603
|
-
}), o = r.filter((d) => d.packageItem != null && d.amount > 0).reduce((d,
|
|
2605
|
+
}), o = r.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, m) => {
|
|
2604
2606
|
const {
|
|
2605
2607
|
packageItem: y,
|
|
2606
|
-
event:
|
|
2608
|
+
event: h,
|
|
2607
2609
|
amount: O,
|
|
2608
2610
|
price: C,
|
|
2609
2611
|
serviceFee: Y,
|
|
2610
2612
|
depositPrice: H,
|
|
2611
2613
|
originalPrice: J
|
|
2612
|
-
} =
|
|
2613
|
-
d[
|
|
2614
|
-
id:
|
|
2614
|
+
} = m, A = y.package.id;
|
|
2615
|
+
d[A] ? (d[A].price += C ?? 0, d[A].serviceFee += Y ?? 0, d[A].originalPrice += J ?? 0, d[A].depositPrice += H ?? C ?? 0) : d[A] = {
|
|
2616
|
+
id: A,
|
|
2615
2617
|
type: T.PACKAGE,
|
|
2616
2618
|
name: y.package.name,
|
|
2617
2619
|
amount: O,
|
|
@@ -2621,30 +2623,30 @@ class kt {
|
|
|
2621
2623
|
originalPrice: J ?? 0,
|
|
2622
2624
|
packageItems: []
|
|
2623
2625
|
};
|
|
2624
|
-
const Oe =
|
|
2625
|
-
zone:
|
|
2626
|
-
}),
|
|
2627
|
-
zone:
|
|
2626
|
+
const Oe = k.fromISO(h.startAt, {
|
|
2627
|
+
zone: h.timezone
|
|
2628
|
+
}), Ae = k.fromISO(h.endAt, {
|
|
2629
|
+
zone: h.timezone
|
|
2628
2630
|
});
|
|
2629
|
-
return d[
|
|
2631
|
+
return d[A].packageItems.push({
|
|
2630
2632
|
packageItemId: y.id,
|
|
2631
|
-
eventId:
|
|
2632
|
-
name:
|
|
2633
|
+
eventId: h.id,
|
|
2634
|
+
name: h.name,
|
|
2633
2635
|
startAt: Oe.toJSDate().toISOString(),
|
|
2634
|
-
endAt:
|
|
2636
|
+
endAt: Ae.toJSDate().toISOString()
|
|
2635
2637
|
}), d;
|
|
2636
|
-
}, {}),
|
|
2638
|
+
}, {}), l = [
|
|
2637
2639
|
...s,
|
|
2638
2640
|
...Object.values(o)
|
|
2639
|
-
],
|
|
2640
|
-
if (
|
|
2641
|
+
], p = l.reduce((d, m) => d + (m.amount || 0), 0);
|
|
2642
|
+
if (p === 0)
|
|
2641
2643
|
return null;
|
|
2642
|
-
const E = r.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime()),
|
|
2644
|
+
const E = r.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime()), g = k.fromMillis(Math.min(...E));
|
|
2643
2645
|
return {
|
|
2644
2646
|
id: i.id,
|
|
2645
2647
|
currency: i.currency,
|
|
2646
|
-
expiredAt:
|
|
2647
|
-
items:
|
|
2648
|
+
expiredAt: g?.toJSDate().toISOString(),
|
|
2649
|
+
items: l,
|
|
2648
2650
|
customer: i.mainBooker ? {
|
|
2649
2651
|
firstName: i.mainBooker.firstName,
|
|
2650
2652
|
lastName: i.mainBooker.lastName,
|
|
@@ -2654,29 +2656,29 @@ class kt {
|
|
|
2654
2656
|
residence: i.mainBooker.residence,
|
|
2655
2657
|
extraInfo: i.mainBooker.extraInfo
|
|
2656
2658
|
} : null,
|
|
2657
|
-
count:
|
|
2659
|
+
count: p,
|
|
2658
2660
|
orderProtection: !1
|
|
2659
2661
|
};
|
|
2660
|
-
} catch (
|
|
2661
|
-
throw this.debugLog("Error fetching order",
|
|
2662
|
+
} catch (n) {
|
|
2663
|
+
throw this.debugLog("Error fetching order", n), n;
|
|
2662
2664
|
}
|
|
2663
2665
|
}
|
|
2664
|
-
debugLog(e,
|
|
2665
|
-
this.config.debug && console.log(`[BasketService] ${e}`,
|
|
2666
|
+
debugLog(e, n) {
|
|
2667
|
+
this.config.debug && console.log(`[BasketService] ${e}`, n || "");
|
|
2666
2668
|
}
|
|
2667
2669
|
handleError(e) {
|
|
2668
|
-
const
|
|
2669
|
-
if (
|
|
2670
|
-
const i =
|
|
2670
|
+
const n = e;
|
|
2671
|
+
if (n.graphQLErrors && n.graphQLErrors.length > 0) {
|
|
2672
|
+
const i = n.graphQLErrors[0];
|
|
2671
2673
|
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
2672
2674
|
}
|
|
2673
|
-
if (
|
|
2674
|
-
const i =
|
|
2675
|
+
if (n.response?.errors && n.response.errors.length > 0) {
|
|
2676
|
+
const i = n.response.errors[0];
|
|
2675
2677
|
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
2676
2678
|
}
|
|
2677
2679
|
}
|
|
2678
2680
|
}
|
|
2679
|
-
const Tt =
|
|
2681
|
+
const Tt = u`
|
|
2680
2682
|
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $locationIds: [String!], $excludedEventIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
|
|
2681
2683
|
findAllPublicEventByOrganizationId(
|
|
2682
2684
|
id: $organizationId
|
|
@@ -2721,7 +2723,7 @@ const Tt = l`
|
|
|
2721
2723
|
count
|
|
2722
2724
|
}
|
|
2723
2725
|
}
|
|
2724
|
-
`,
|
|
2726
|
+
`, Dt = u`
|
|
2725
2727
|
query EventDetailPage($eventId: ID!) {
|
|
2726
2728
|
findPublicEventById(id: $eventId) {
|
|
2727
2729
|
id
|
|
@@ -2753,7 +2755,39 @@ const Tt = l`
|
|
|
2753
2755
|
totalViews
|
|
2754
2756
|
}
|
|
2755
2757
|
}
|
|
2756
|
-
`, Nt =
|
|
2758
|
+
`, Nt = u`
|
|
2759
|
+
query FindPublicEventBySlug($organizationId: ID!, $slug: String!) {
|
|
2760
|
+
findPublicEventBySlug(organizationId: $organizationId, slug: $slug) {
|
|
2761
|
+
id
|
|
2762
|
+
name
|
|
2763
|
+
icon
|
|
2764
|
+
banner
|
|
2765
|
+
description
|
|
2766
|
+
addonDescription
|
|
2767
|
+
startAt
|
|
2768
|
+
endAt
|
|
2769
|
+
startSalesAt
|
|
2770
|
+
endSalesAt
|
|
2771
|
+
facebookPixelId
|
|
2772
|
+
timezone
|
|
2773
|
+
slug
|
|
2774
|
+
status
|
|
2775
|
+
location {
|
|
2776
|
+
id
|
|
2777
|
+
name
|
|
2778
|
+
address
|
|
2779
|
+
}
|
|
2780
|
+
hosting {
|
|
2781
|
+
id
|
|
2782
|
+
name
|
|
2783
|
+
}
|
|
2784
|
+
infoDescription
|
|
2785
|
+
maxAmountOfTicketsPerOrder
|
|
2786
|
+
startingPrice
|
|
2787
|
+
totalViews
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
`, vt = u`
|
|
2757
2791
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
2758
2792
|
findPublicProductsByEventId(
|
|
2759
2793
|
eventId: $eventId
|
|
@@ -2787,57 +2821,45 @@ const Tt = l`
|
|
|
2787
2821
|
showEndSalesAtTag
|
|
2788
2822
|
}
|
|
2789
2823
|
}
|
|
2790
|
-
`,
|
|
2791
|
-
function
|
|
2824
|
+
`, bt = (t, e, n, i) => t();
|
|
2825
|
+
function Pt(t, e = bt) {
|
|
2792
2826
|
return {
|
|
2793
|
-
EventOverviewPage(
|
|
2794
|
-
return e((s) =>
|
|
2827
|
+
EventOverviewPage(n, i, r) {
|
|
2828
|
+
return e((s) => t.request({ document: Tt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", n);
|
|
2829
|
+
},
|
|
2830
|
+
EventDetailPage(n, i, r) {
|
|
2831
|
+
return e((s) => t.request({ document: Dt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", n);
|
|
2795
2832
|
},
|
|
2796
|
-
|
|
2797
|
-
return e((s) =>
|
|
2833
|
+
FindPublicEventBySlug(n, i, r) {
|
|
2834
|
+
return e((s) => t.request({ document: Nt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "FindPublicEventBySlug", "query", n);
|
|
2798
2835
|
},
|
|
2799
|
-
findProductsByEventId(
|
|
2800
|
-
return e((s) =>
|
|
2836
|
+
findProductsByEventId(n, i, r) {
|
|
2837
|
+
return e((s) => t.request({ document: vt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findProductsByEventId", "query", n);
|
|
2801
2838
|
}
|
|
2802
2839
|
};
|
|
2803
2840
|
}
|
|
2804
|
-
class
|
|
2841
|
+
class St {
|
|
2805
2842
|
config;
|
|
2806
2843
|
sdk;
|
|
2807
2844
|
constructor(e) {
|
|
2808
|
-
this.config = e, this.sdk =
|
|
2845
|
+
this.config = e, this.sdk = Pt(new N(e.apiUrl));
|
|
2809
2846
|
}
|
|
2810
|
-
async getEvents(e
|
|
2847
|
+
async getEvents(e, n) {
|
|
2811
2848
|
try {
|
|
2812
2849
|
e.page && (e.page = {
|
|
2813
2850
|
index: e.page.index ?? 0,
|
|
2814
2851
|
size: e.page.size ?? 20
|
|
2815
2852
|
}), this.debugLog("Fetching events with parameters", {
|
|
2816
|
-
organizationId: this.config.organizationId,
|
|
2853
|
+
organizationId: this.config.organizationId ?? n ?? "",
|
|
2817
2854
|
hostingIds: e.hostingIds,
|
|
2818
2855
|
filterEventStatuses: e.statuses,
|
|
2819
2856
|
dateRange: e.dateRange,
|
|
2820
2857
|
page: e.page,
|
|
2821
2858
|
sorts: e.sorts,
|
|
2822
2859
|
trackerId: this.config.trackerId
|
|
2823
|
-
}), console.log({
|
|
2824
|
-
organizationId: this.config.organizationId,
|
|
2825
|
-
hostingIds: e.hostingIds,
|
|
2826
|
-
locationIds: e.locationIds,
|
|
2827
|
-
excludedEventIds: e.excludedEventIds,
|
|
2828
|
-
filterEventStatuses: e.statuses,
|
|
2829
|
-
dateRange: e.dateRange && e.dateRange.from && e.dateRange.till ? {
|
|
2830
|
-
from: e.dateRange.from.toISO(),
|
|
2831
|
-
till: e.dateRange.till.toISO()
|
|
2832
|
-
} : void 0,
|
|
2833
|
-
page: e.page,
|
|
2834
|
-
sorts: e.sorts,
|
|
2835
|
-
trackerId: this.config.trackerId,
|
|
2836
|
-
searchTerm: e.searchTerm,
|
|
2837
|
-
priceRange: e.priceRange
|
|
2838
2860
|
});
|
|
2839
|
-
const
|
|
2840
|
-
organizationId: this.config.organizationId,
|
|
2861
|
+
const i = await this.sdk.EventOverviewPage({
|
|
2862
|
+
organizationId: this.config.organizationId ?? n ?? "",
|
|
2841
2863
|
hostingIds: e.hostingIds,
|
|
2842
2864
|
locationIds: e.locationIds,
|
|
2843
2865
|
excludedEventIds: e.excludedEventIds,
|
|
@@ -2852,56 +2874,56 @@ class xt {
|
|
|
2852
2874
|
searchTerm: e.searchTerm,
|
|
2853
2875
|
priceRange: e.priceRange
|
|
2854
2876
|
});
|
|
2855
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2856
|
-
const
|
|
2857
|
-
id:
|
|
2858
|
-
name:
|
|
2859
|
-
icon:
|
|
2860
|
-
banner:
|
|
2861
|
-
description:
|
|
2862
|
-
addonDescription:
|
|
2863
|
-
startAt:
|
|
2864
|
-
endAt:
|
|
2865
|
-
timezone:
|
|
2877
|
+
if (this.debugLog("Raw GraphQL response", i), i?.findAllPublicEventByOrganizationId?.data) {
|
|
2878
|
+
const r = i.findAllPublicEventByOrganizationId.data.map((s) => ({
|
|
2879
|
+
id: s.id,
|
|
2880
|
+
name: s.name,
|
|
2881
|
+
icon: s.icon,
|
|
2882
|
+
banner: s.banner,
|
|
2883
|
+
description: s.description,
|
|
2884
|
+
addonDescription: s.addonDescription,
|
|
2885
|
+
startAt: k.fromISO(s.startAt, { zone: s.timezone }).toJSDate().toISOString(),
|
|
2886
|
+
endAt: k.fromISO(s.endAt, { zone: s.timezone }).toJSDate().toISOString(),
|
|
2887
|
+
timezone: s.timezone,
|
|
2866
2888
|
startSalesAt: null,
|
|
2867
2889
|
endSalesAt: null,
|
|
2868
|
-
slug:
|
|
2890
|
+
slug: s.slug ?? "ERROR",
|
|
2869
2891
|
facebookPixelId: null,
|
|
2870
|
-
status:
|
|
2871
|
-
location:
|
|
2872
|
-
id:
|
|
2873
|
-
name:
|
|
2874
|
-
address:
|
|
2892
|
+
status: s.status,
|
|
2893
|
+
location: s.location ? {
|
|
2894
|
+
id: s.location.id,
|
|
2895
|
+
name: s.location.name,
|
|
2896
|
+
address: s.location.address
|
|
2875
2897
|
} : void 0,
|
|
2876
|
-
hosting:
|
|
2877
|
-
id:
|
|
2878
|
-
name:
|
|
2898
|
+
hosting: s.hosting ? {
|
|
2899
|
+
id: s.hosting.id,
|
|
2900
|
+
name: s.hosting.name
|
|
2879
2901
|
} : void 0,
|
|
2880
|
-
infoDescription:
|
|
2881
|
-
startingPrice:
|
|
2882
|
-
totalViews:
|
|
2902
|
+
infoDescription: s.infoDescription,
|
|
2903
|
+
startingPrice: s.startingPrice,
|
|
2904
|
+
totalViews: s.totalViews
|
|
2883
2905
|
}));
|
|
2884
|
-
return this.debugLog("Processed events", { events:
|
|
2906
|
+
return this.debugLog("Processed events", { events: r, count: r.length }), [r, i.findAllPublicEventByOrganizationId.count ?? 0];
|
|
2885
2907
|
} else
|
|
2886
2908
|
return this.debugLog("No events found in response"), [[], 0];
|
|
2887
|
-
} catch (
|
|
2888
|
-
throw this.debugLog("Error fetching events",
|
|
2909
|
+
} catch (i) {
|
|
2910
|
+
throw this.debugLog("Error fetching events", i), i;
|
|
2889
2911
|
}
|
|
2890
2912
|
}
|
|
2891
2913
|
async getEvent(e) {
|
|
2892
2914
|
try {
|
|
2893
2915
|
this.debugLog("Fetching single event", { eventId: e });
|
|
2894
|
-
const
|
|
2895
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2896
|
-
const i =
|
|
2916
|
+
const n = await this.sdk.EventDetailPage({ eventId: e });
|
|
2917
|
+
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
2918
|
+
const i = n.findPublicEventById, r = {
|
|
2897
2919
|
id: i.id,
|
|
2898
2920
|
name: i.name,
|
|
2899
2921
|
icon: i.icon,
|
|
2900
2922
|
banner: i.banner,
|
|
2901
2923
|
description: i.description,
|
|
2902
2924
|
addonDescription: i.addonDescription,
|
|
2903
|
-
startAt:
|
|
2904
|
-
endAt:
|
|
2925
|
+
startAt: k.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2926
|
+
endAt: k.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2905
2927
|
timezone: i.timezone,
|
|
2906
2928
|
startSalesAt: i.startSalesAt,
|
|
2907
2929
|
endSalesAt: i.endSalesAt,
|
|
@@ -2926,23 +2948,65 @@ class xt {
|
|
|
2926
2948
|
this.debugLog("No event found for id", e);
|
|
2927
2949
|
return;
|
|
2928
2950
|
}
|
|
2929
|
-
} catch (
|
|
2930
|
-
throw this.debugLog("Error fetching single event",
|
|
2951
|
+
} catch (n) {
|
|
2952
|
+
throw this.debugLog("Error fetching single event", n), n;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
async getEventBySlug(e, n) {
|
|
2956
|
+
try {
|
|
2957
|
+
this.debugLog("Fetching single event by slug", { organizationId: e, slug: n });
|
|
2958
|
+
const i = await this.sdk.FindPublicEventBySlug({ organizationId: e, slug: n });
|
|
2959
|
+
if (this.debugLog("Raw GraphQL response", i), i?.findPublicEventBySlug) {
|
|
2960
|
+
const r = i.findPublicEventBySlug, s = {
|
|
2961
|
+
id: r.id,
|
|
2962
|
+
name: r.name,
|
|
2963
|
+
icon: r.icon,
|
|
2964
|
+
banner: r.banner,
|
|
2965
|
+
description: r.description,
|
|
2966
|
+
addonDescription: r.addonDescription,
|
|
2967
|
+
startAt: k.fromISO(r.startAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2968
|
+
endAt: k.fromISO(r.endAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2969
|
+
timezone: r.timezone,
|
|
2970
|
+
startSalesAt: r.startSalesAt,
|
|
2971
|
+
endSalesAt: r.endSalesAt,
|
|
2972
|
+
slug: r.slug ?? "ERROR",
|
|
2973
|
+
facebookPixelId: r.facebookPixelId,
|
|
2974
|
+
status: r.status,
|
|
2975
|
+
location: r.location ? {
|
|
2976
|
+
id: r.location.id,
|
|
2977
|
+
name: r.location.name,
|
|
2978
|
+
address: r.location.address
|
|
2979
|
+
} : void 0,
|
|
2980
|
+
hosting: r.hosting ? {
|
|
2981
|
+
id: r.hosting.id,
|
|
2982
|
+
name: r.hosting.name
|
|
2983
|
+
} : void 0,
|
|
2984
|
+
infoDescription: r.infoDescription,
|
|
2985
|
+
startingPrice: r.startingPrice,
|
|
2986
|
+
totalViews: r.totalViews
|
|
2987
|
+
};
|
|
2988
|
+
return this.debugLog("Processed single event", s), s;
|
|
2989
|
+
} else {
|
|
2990
|
+
this.debugLog("No event found for id by slug", { organizationId: e, slug: n });
|
|
2991
|
+
return;
|
|
2992
|
+
}
|
|
2993
|
+
} catch (i) {
|
|
2994
|
+
throw this.debugLog("Error fetching single event", i), i;
|
|
2931
2995
|
}
|
|
2932
2996
|
}
|
|
2933
|
-
async getProducts(e,
|
|
2997
|
+
async getProducts(e, n, i) {
|
|
2934
2998
|
try {
|
|
2935
2999
|
this.debugLog("Fetching products for event", {
|
|
2936
3000
|
eventId: e,
|
|
2937
3001
|
promoCode: i,
|
|
2938
3002
|
trackerId: this.config.trackerId,
|
|
2939
|
-
productTypes:
|
|
3003
|
+
productTypes: n
|
|
2940
3004
|
});
|
|
2941
3005
|
const r = await this.sdk.findProductsByEventId({
|
|
2942
3006
|
eventId: e,
|
|
2943
3007
|
promoCode: i,
|
|
2944
3008
|
trackerId: this.config.trackerId,
|
|
2945
|
-
productTypes:
|
|
3009
|
+
productTypes: n
|
|
2946
3010
|
});
|
|
2947
3011
|
if (r?.findPublicProductsByEventId) {
|
|
2948
3012
|
const s = r.findPublicProductsByEventId.map((o) => ({
|
|
@@ -2980,11 +3044,11 @@ class xt {
|
|
|
2980
3044
|
throw this.debugLog("Error fetching products", { eventId: e, error: r }), r;
|
|
2981
3045
|
}
|
|
2982
3046
|
}
|
|
2983
|
-
debugLog(e,
|
|
2984
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${e}`,
|
|
3047
|
+
debugLog(e, n) {
|
|
3048
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${e}`, n || "");
|
|
2985
3049
|
}
|
|
2986
3050
|
}
|
|
2987
|
-
const
|
|
3051
|
+
const xt = u`
|
|
2988
3052
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
2989
3053
|
findPaymentDetails(
|
|
2990
3054
|
orderId: $orderId
|
|
@@ -3014,40 +3078,40 @@ const Pt = l`
|
|
|
3014
3078
|
protectionFee
|
|
3015
3079
|
}
|
|
3016
3080
|
}
|
|
3017
|
-
`,
|
|
3081
|
+
`, Ct = u`
|
|
3018
3082
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3019
3083
|
createDigitalOrderPayment(input: $input)
|
|
3020
3084
|
}
|
|
3021
|
-
`,
|
|
3022
|
-
function
|
|
3085
|
+
`, _t = (t, e, n, i) => t();
|
|
3086
|
+
function Lt(t, e = _t) {
|
|
3023
3087
|
return {
|
|
3024
|
-
findPaymentMethods(
|
|
3025
|
-
return e((s) =>
|
|
3088
|
+
findPaymentMethods(n, i, r) {
|
|
3089
|
+
return e((s) => t.request({ document: xt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", n);
|
|
3026
3090
|
},
|
|
3027
|
-
createDigitalPayment(
|
|
3028
|
-
return e((s) =>
|
|
3091
|
+
createDigitalPayment(n, i, r) {
|
|
3092
|
+
return e((s) => t.request({ document: Ct, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", n);
|
|
3029
3093
|
}
|
|
3030
3094
|
};
|
|
3031
3095
|
}
|
|
3032
|
-
class
|
|
3096
|
+
class Rt {
|
|
3033
3097
|
config;
|
|
3034
3098
|
sdk;
|
|
3035
3099
|
constructor(e) {
|
|
3036
|
-
this.config = e, this.sdk =
|
|
3100
|
+
this.config = e, this.sdk = Lt(new N(e.apiUrl));
|
|
3037
3101
|
}
|
|
3038
3102
|
async getPaymentDetails(e) {
|
|
3039
3103
|
this.debugLog("Fetching payment methods", e);
|
|
3040
3104
|
try {
|
|
3041
|
-
const
|
|
3105
|
+
const n = await this.sdk.findPaymentMethods({
|
|
3042
3106
|
orderId: e.orderId,
|
|
3043
3107
|
orderItemId: e.orderItemId,
|
|
3044
3108
|
amountOfTickets: e.amountOfTickets,
|
|
3045
3109
|
paymentMethodId: e.paymentMethodId,
|
|
3046
3110
|
withTicketProtection: e.withTicketProtection
|
|
3047
3111
|
});
|
|
3048
|
-
if (!
|
|
3112
|
+
if (!n?.findPaymentDetails)
|
|
3049
3113
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
3050
|
-
const i =
|
|
3114
|
+
const i = n.findPaymentDetails;
|
|
3051
3115
|
return this.debugLog("Payment methods fetched successfully", {
|
|
3052
3116
|
methodCount: i.methods?.length ?? 0,
|
|
3053
3117
|
transactionPrice: i.transactionPrice,
|
|
@@ -3076,14 +3140,14 @@ class _t {
|
|
|
3076
3140
|
})) ?? null
|
|
3077
3141
|
})) ?? null
|
|
3078
3142
|
};
|
|
3079
|
-
} catch (
|
|
3080
|
-
throw this.debugLog("Error fetching payment methods",
|
|
3143
|
+
} catch (n) {
|
|
3144
|
+
throw this.debugLog("Error fetching payment methods", n), n;
|
|
3081
3145
|
}
|
|
3082
3146
|
}
|
|
3083
3147
|
async createPayment(e) {
|
|
3084
3148
|
this.debugLog("Creating payment", e);
|
|
3085
3149
|
try {
|
|
3086
|
-
const
|
|
3150
|
+
const n = {
|
|
3087
3151
|
orderId: e.orderId,
|
|
3088
3152
|
paymentMethodId: e.paymentMethodId,
|
|
3089
3153
|
issuerId: e.issuerId,
|
|
@@ -3095,23 +3159,23 @@ class _t {
|
|
|
3095
3159
|
orderItemId: e.orderItemId,
|
|
3096
3160
|
withTicketProtection: e.withTicketProtection
|
|
3097
3161
|
};
|
|
3098
|
-
e.customer && (
|
|
3162
|
+
e.customer && (n.customer = e.customer), e.products && (n.products = e.products), e.description && (n.description = e.description), e.reference && (n.reference = e.reference), e.ipAddress && (n.ipAddress = e.ipAddress);
|
|
3099
3163
|
const i = await this.sdk.createDigitalPayment({
|
|
3100
|
-
input:
|
|
3164
|
+
input: n
|
|
3101
3165
|
});
|
|
3102
3166
|
if (!i?.createDigitalOrderPayment)
|
|
3103
3167
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
3104
3168
|
const r = i.createDigitalOrderPayment;
|
|
3105
3169
|
return this.debugLog("Payment created successfully", { paymentUrl: r }), { paymentUrl: r };
|
|
3106
|
-
} catch (
|
|
3107
|
-
throw this.debugLog("Error creating payment",
|
|
3170
|
+
} catch (n) {
|
|
3171
|
+
throw this.debugLog("Error creating payment", n), n;
|
|
3108
3172
|
}
|
|
3109
3173
|
}
|
|
3110
|
-
debugLog(e,
|
|
3111
|
-
this.config.debug && console.log(`[PaymentService] ${e}`,
|
|
3174
|
+
debugLog(e, n) {
|
|
3175
|
+
this.config.debug && console.log(`[PaymentService] ${e}`, n || "");
|
|
3112
3176
|
}
|
|
3113
3177
|
}
|
|
3114
|
-
const
|
|
3178
|
+
const Ft = u`
|
|
3115
3179
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
3116
3180
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
3117
3181
|
data {
|
|
@@ -3136,7 +3200,7 @@ const Lt = l`
|
|
|
3136
3200
|
count
|
|
3137
3201
|
}
|
|
3138
3202
|
}
|
|
3139
|
-
`,
|
|
3203
|
+
`, wt = u`
|
|
3140
3204
|
query findPublicPackageById($packageId: ID!) {
|
|
3141
3205
|
findPublicPackageById(id: $packageId) {
|
|
3142
3206
|
id
|
|
@@ -3162,7 +3226,33 @@ const Lt = l`
|
|
|
3162
3226
|
}
|
|
3163
3227
|
}
|
|
3164
3228
|
}
|
|
3165
|
-
`,
|
|
3229
|
+
`, $t = u`
|
|
3230
|
+
query findPublicPackageBySlug($organizationId: ID!, $slug: String!) {
|
|
3231
|
+
findPublicPackageBySlug(organizationId: $organizationId, slug: $slug) {
|
|
3232
|
+
id
|
|
3233
|
+
slug
|
|
3234
|
+
status
|
|
3235
|
+
name
|
|
3236
|
+
description
|
|
3237
|
+
shortTitle
|
|
3238
|
+
shortDescription
|
|
3239
|
+
startAvailabilityAt
|
|
3240
|
+
endAvailabilityAt
|
|
3241
|
+
maxAmountOfPersonsPerOrder
|
|
3242
|
+
icon
|
|
3243
|
+
banner
|
|
3244
|
+
currency
|
|
3245
|
+
amountOfEvents
|
|
3246
|
+
amountOfAddons
|
|
3247
|
+
prices {
|
|
3248
|
+
price
|
|
3249
|
+
deposit
|
|
3250
|
+
discount
|
|
3251
|
+
serviceFee
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
`, Bt = u`
|
|
3166
3256
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
3167
3257
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
3168
3258
|
data {
|
|
@@ -3197,54 +3287,57 @@ const Lt = l`
|
|
|
3197
3287
|
count
|
|
3198
3288
|
}
|
|
3199
3289
|
}
|
|
3200
|
-
`,
|
|
3201
|
-
function
|
|
3290
|
+
`, Vt = (t, e, n, i) => t();
|
|
3291
|
+
function Ut(t, e = Vt) {
|
|
3202
3292
|
return {
|
|
3203
|
-
findAllPublicPackagesByOrganizationId(
|
|
3204
|
-
return e((s) =>
|
|
3293
|
+
findAllPublicPackagesByOrganizationId(n, i, r) {
|
|
3294
|
+
return e((s) => t.request({ document: Ft, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
3295
|
+
},
|
|
3296
|
+
findPublicPackageById(n, i, r) {
|
|
3297
|
+
return e((s) => t.request({ document: wt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", n);
|
|
3205
3298
|
},
|
|
3206
|
-
|
|
3207
|
-
return e((s) =>
|
|
3299
|
+
findPublicPackageBySlug(n, i, r) {
|
|
3300
|
+
return e((s) => t.request({ document: $t, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageBySlug", "query", n);
|
|
3208
3301
|
},
|
|
3209
|
-
findPublicItemsByPackageId(
|
|
3210
|
-
return e((s) =>
|
|
3302
|
+
findPublicItemsByPackageId(n, i, r) {
|
|
3303
|
+
return e((s) => t.request({ document: Bt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", n);
|
|
3211
3304
|
}
|
|
3212
3305
|
};
|
|
3213
3306
|
}
|
|
3214
|
-
class
|
|
3307
|
+
class Mt {
|
|
3215
3308
|
config;
|
|
3216
3309
|
sdk;
|
|
3217
3310
|
constructor(e) {
|
|
3218
|
-
this.config = e, this.sdk =
|
|
3311
|
+
this.config = e, this.sdk = Ut(new N(e.apiUrl));
|
|
3219
3312
|
}
|
|
3220
|
-
debugLog(e,
|
|
3221
|
-
this.config.debug && console.log(`[PackageService] ${e}`,
|
|
3313
|
+
debugLog(e, n) {
|
|
3314
|
+
this.config.debug && console.log(`[PackageService] ${e}`, n || "");
|
|
3222
3315
|
}
|
|
3223
|
-
async getPackages(e
|
|
3316
|
+
async getPackages(e, n) {
|
|
3224
3317
|
try {
|
|
3225
|
-
let
|
|
3226
|
-
e.page && (
|
|
3318
|
+
let i;
|
|
3319
|
+
e.page && (i = {
|
|
3227
3320
|
index: e.page.index ?? 0,
|
|
3228
3321
|
size: e.page.size ?? 20
|
|
3229
3322
|
}), this.debugLog("Fetching public packages", {
|
|
3230
|
-
organizationId: this.config.organizationId,
|
|
3231
|
-
page:
|
|
3323
|
+
organizationId: this.config.organizationId ?? n ?? "",
|
|
3324
|
+
page: i,
|
|
3232
3325
|
tab: e.tab,
|
|
3233
3326
|
statuses: e.statuses
|
|
3234
3327
|
});
|
|
3235
|
-
const
|
|
3236
|
-
organizationId: this.config.organizationId
|
|
3328
|
+
const r = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
3329
|
+
organizationId: this.config.organizationId ?? n ?? ""
|
|
3237
3330
|
});
|
|
3238
|
-
if (
|
|
3239
|
-
const
|
|
3331
|
+
if (r?.findAllPublicPackagesByOrganizationId) {
|
|
3332
|
+
const s = r.findAllPublicPackagesByOrganizationId;
|
|
3240
3333
|
return this.debugLog("Public packages fetched", {
|
|
3241
|
-
count:
|
|
3242
|
-
dataLength:
|
|
3243
|
-
}),
|
|
3334
|
+
count: s.count,
|
|
3335
|
+
dataLength: s.data.length
|
|
3336
|
+
}), s.data;
|
|
3244
3337
|
}
|
|
3245
3338
|
return null;
|
|
3246
|
-
} catch (
|
|
3247
|
-
throw this.debugLog("Error fetching public packages",
|
|
3339
|
+
} catch (i) {
|
|
3340
|
+
throw this.debugLog("Error fetching public packages", i), i;
|
|
3248
3341
|
}
|
|
3249
3342
|
}
|
|
3250
3343
|
async getPackage(e) {
|
|
@@ -3252,22 +3345,38 @@ class Bt {
|
|
|
3252
3345
|
this.debugLog("Fetching public packages", {
|
|
3253
3346
|
packageId: e
|
|
3254
3347
|
});
|
|
3255
|
-
const
|
|
3256
|
-
if (
|
|
3257
|
-
const i =
|
|
3348
|
+
const n = await this.sdk.findPublicPackageById({ packageId: e });
|
|
3349
|
+
if (n?.findPublicPackageById) {
|
|
3350
|
+
const i = n.findPublicPackageById;
|
|
3258
3351
|
return this.debugLog("Public package fetched"), i;
|
|
3259
3352
|
}
|
|
3260
3353
|
return null;
|
|
3261
|
-
} catch (
|
|
3262
|
-
throw this.debugLog("Error fetching public packages",
|
|
3354
|
+
} catch (n) {
|
|
3355
|
+
throw this.debugLog("Error fetching public packages", n), n;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
async getPackageBySlug(e, n) {
|
|
3359
|
+
try {
|
|
3360
|
+
this.debugLog("Fetching public packages by slug", {
|
|
3361
|
+
organizationId: e,
|
|
3362
|
+
slug: n
|
|
3363
|
+
});
|
|
3364
|
+
const i = await this.sdk.findPublicPackageBySlug({ organizationId: e, slug: n });
|
|
3365
|
+
if (i?.findPublicPackageBySlug) {
|
|
3366
|
+
const r = i.findPublicPackageBySlug;
|
|
3367
|
+
return this.debugLog("Public package fetched"), r;
|
|
3368
|
+
}
|
|
3369
|
+
return null;
|
|
3370
|
+
} catch (i) {
|
|
3371
|
+
throw this.debugLog("Error fetching public packages", i), i;
|
|
3263
3372
|
}
|
|
3264
3373
|
}
|
|
3265
|
-
async getPackageItems(e,
|
|
3374
|
+
async getPackageItems(e, n = [R.Regular, R.AdditionalEvent]) {
|
|
3266
3375
|
try {
|
|
3267
|
-
this.debugLog("Fetching public package items", { packageId: e, types:
|
|
3376
|
+
this.debugLog("Fetching public package items", { packageId: e, types: n });
|
|
3268
3377
|
const i = await this.sdk.findPublicItemsByPackageId({
|
|
3269
3378
|
packageId: e,
|
|
3270
|
-
types:
|
|
3379
|
+
types: n,
|
|
3271
3380
|
page: { index: 0, size: 100 }
|
|
3272
3381
|
});
|
|
3273
3382
|
if (i?.findPublicItemsByPackageId) {
|
|
@@ -3283,7 +3392,7 @@ class Bt {
|
|
|
3283
3392
|
}
|
|
3284
3393
|
}
|
|
3285
3394
|
}
|
|
3286
|
-
const
|
|
3395
|
+
const zt = u`
|
|
3287
3396
|
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
3288
3397
|
findAllPublicLocationsByOrganizationId(id: $organizationId) {
|
|
3289
3398
|
data {
|
|
@@ -3303,89 +3412,89 @@ const Vt = l`
|
|
|
3303
3412
|
count
|
|
3304
3413
|
}
|
|
3305
3414
|
}
|
|
3306
|
-
`,
|
|
3307
|
-
function
|
|
3415
|
+
`, qt = (t, e, n, i) => t();
|
|
3416
|
+
function Gt(t, e = qt) {
|
|
3308
3417
|
return {
|
|
3309
|
-
findAllPublicCategoriesByOrganizationId(
|
|
3310
|
-
return e((s) =>
|
|
3418
|
+
findAllPublicCategoriesByOrganizationId(n, i, r) {
|
|
3419
|
+
return e((s) => t.request({ document: zt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
3311
3420
|
}
|
|
3312
3421
|
};
|
|
3313
3422
|
}
|
|
3314
|
-
class
|
|
3423
|
+
class jt {
|
|
3315
3424
|
config;
|
|
3316
3425
|
sdk;
|
|
3317
3426
|
constructor(e) {
|
|
3318
|
-
this.config = e, this.sdk =
|
|
3427
|
+
this.config = e, this.sdk = Gt(new N(e.apiUrl));
|
|
3319
3428
|
}
|
|
3320
|
-
debugLog(e,
|
|
3321
|
-
this.config.debug && console.log(`[CategoryService] ${e}`,
|
|
3429
|
+
debugLog(e, n) {
|
|
3430
|
+
this.config.debug && console.log(`[CategoryService] ${e}`, n || "");
|
|
3322
3431
|
}
|
|
3323
|
-
async getCategories(e) {
|
|
3432
|
+
async getCategories(e, n) {
|
|
3324
3433
|
try {
|
|
3325
3434
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
3326
|
-
const
|
|
3327
|
-
if (
|
|
3328
|
-
const
|
|
3329
|
-
return this.debugLog("Categories fetched", { count:
|
|
3330
|
-
...
|
|
3331
|
-
...
|
|
3435
|
+
const i = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId ?? n ?? "", dateRange: e ?? null });
|
|
3436
|
+
if (i?.findAllPublicHostingsByOrganizationId) {
|
|
3437
|
+
const r = i.findAllPublicHostingsByOrganizationId, s = i.findAllPublicLocationsByOrganizationId;
|
|
3438
|
+
return this.debugLog("Categories fetched", { count: r.count + s.count, dataLength: r.data.length + s.data.length }), [
|
|
3439
|
+
...r.data.map((o) => ({ id: o.id, name: o.name, icon: o.icon, activeEvents: o.amountOfActiveEvents, type: "HOSTING" })),
|
|
3440
|
+
...s.data.map((o) => ({ id: o.id, name: o.name, activeEvents: o.amountOfActiveEvents, type: "LOCATION" }))
|
|
3332
3441
|
];
|
|
3333
3442
|
}
|
|
3334
3443
|
return [];
|
|
3335
|
-
} catch (
|
|
3336
|
-
throw this.debugLog("Error fetching categories",
|
|
3444
|
+
} catch (i) {
|
|
3445
|
+
throw this.debugLog("Error fetching categories", i), i;
|
|
3337
3446
|
}
|
|
3338
3447
|
}
|
|
3339
3448
|
}
|
|
3340
|
-
const
|
|
3449
|
+
const Yt = u`
|
|
3341
3450
|
mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
|
|
3342
3451
|
createShopView(id: $id, trackerId: $trackerLinkId)
|
|
3343
3452
|
}
|
|
3344
|
-
`,
|
|
3453
|
+
`, Ht = u`
|
|
3345
3454
|
mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3346
3455
|
createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3347
3456
|
}
|
|
3348
|
-
`,
|
|
3457
|
+
`, Jt = u`
|
|
3349
3458
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3350
3459
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3351
3460
|
}
|
|
3352
|
-
`,
|
|
3353
|
-
function
|
|
3461
|
+
`, Qt = (t, e, n, i) => t();
|
|
3462
|
+
function Xt(t, e = Qt) {
|
|
3354
3463
|
return {
|
|
3355
|
-
CreateShopView(
|
|
3356
|
-
return e((s) =>
|
|
3464
|
+
CreateShopView(n, i, r) {
|
|
3465
|
+
return e((s) => t.request({ document: Yt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateShopView", "mutation", n);
|
|
3357
3466
|
},
|
|
3358
|
-
CreateEventView(
|
|
3359
|
-
return e((s) =>
|
|
3467
|
+
CreateEventView(n, i, r) {
|
|
3468
|
+
return e((s) => t.request({ document: Ht, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateEventView", "mutation", n);
|
|
3360
3469
|
},
|
|
3361
|
-
CreatePackageView(
|
|
3362
|
-
return e((s) =>
|
|
3470
|
+
CreatePackageView(n, i, r) {
|
|
3471
|
+
return e((s) => t.request({ document: Jt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreatePackageView", "mutation", n);
|
|
3363
3472
|
}
|
|
3364
3473
|
};
|
|
3365
3474
|
}
|
|
3366
|
-
class
|
|
3475
|
+
class Wt {
|
|
3367
3476
|
config;
|
|
3368
3477
|
sdk;
|
|
3369
3478
|
constructor(e) {
|
|
3370
|
-
this.config = e, this.sdk =
|
|
3479
|
+
this.config = e, this.sdk = Xt(new N(e.apiUrl));
|
|
3371
3480
|
}
|
|
3372
|
-
createMetric = async (e,
|
|
3373
|
-
switch (!
|
|
3481
|
+
createMetric = async (e, n, i) => {
|
|
3482
|
+
switch (!n && !i && await this.sdk.CreateShopView({
|
|
3374
3483
|
id: e,
|
|
3375
3484
|
trackerLinkId: this.config.trackerId
|
|
3376
3485
|
}), i) {
|
|
3377
|
-
case
|
|
3486
|
+
case F.Event:
|
|
3378
3487
|
await this.sdk.CreateEventView({
|
|
3379
3488
|
id: e,
|
|
3380
|
-
shopId:
|
|
3489
|
+
shopId: n,
|
|
3381
3490
|
trackerLinkId: this.config.trackerId
|
|
3382
3491
|
});
|
|
3383
3492
|
break;
|
|
3384
|
-
case
|
|
3493
|
+
case F.Package:
|
|
3385
3494
|
await this.sdk.CreatePackageView(
|
|
3386
3495
|
{
|
|
3387
3496
|
id: e,
|
|
3388
|
-
shopId:
|
|
3497
|
+
shopId: n,
|
|
3389
3498
|
trackerLinkId: this.config.trackerId
|
|
3390
3499
|
}
|
|
3391
3500
|
);
|
|
@@ -3393,70 +3502,111 @@ class Jt {
|
|
|
3393
3502
|
}
|
|
3394
3503
|
};
|
|
3395
3504
|
}
|
|
3396
|
-
const
|
|
3397
|
-
|
|
3505
|
+
const Zt = u`
|
|
3506
|
+
query getShopBySlug($slug: String!, $trackerLinkId: String) {
|
|
3507
|
+
findShopBySlug(slug: $slug, promoterId: $trackerLinkId) {
|
|
3508
|
+
id
|
|
3509
|
+
name
|
|
3510
|
+
description
|
|
3511
|
+
filteredLocationIds
|
|
3512
|
+
filteredHostingIds
|
|
3513
|
+
slug
|
|
3514
|
+
enablePromoCode
|
|
3515
|
+
enableDoorTickets
|
|
3516
|
+
removeServiceFee
|
|
3517
|
+
organization {
|
|
3518
|
+
id
|
|
3519
|
+
name
|
|
3520
|
+
logo
|
|
3521
|
+
socials {
|
|
3522
|
+
key
|
|
3523
|
+
value
|
|
3524
|
+
}
|
|
3525
|
+
billing_address_name
|
|
3526
|
+
terms_and_conditions
|
|
3527
|
+
facebook_pixel
|
|
3528
|
+
google_tag
|
|
3529
|
+
seatsIoWorkspaceId
|
|
3530
|
+
}
|
|
3531
|
+
template(trackerId: $trackerLinkId) {
|
|
3532
|
+
type
|
|
3533
|
+
variation
|
|
3534
|
+
backgroundColor
|
|
3535
|
+
primaryColor
|
|
3536
|
+
secondaryColor
|
|
3537
|
+
textColor
|
|
3538
|
+
slogan
|
|
3539
|
+
title
|
|
3540
|
+
notes
|
|
3541
|
+
description
|
|
3542
|
+
banner
|
|
3543
|
+
autoSelectFirstEvent
|
|
3544
|
+
useDarkTheme
|
|
3545
|
+
}
|
|
3546
|
+
blockedLanguages
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
`, Kt = (t, e, n, i) => t();
|
|
3550
|
+
function en(t, e = Kt) {
|
|
3551
|
+
return {
|
|
3552
|
+
getShopBySlug(n, i, r) {
|
|
3553
|
+
return e((s) => t.request({ document: Zt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "getShopBySlug", "query", n);
|
|
3554
|
+
}
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
class tn {
|
|
3558
|
+
config;
|
|
3559
|
+
sdk;
|
|
3560
|
+
constructor(e) {
|
|
3561
|
+
this.config = e, this.sdk = en(new N(e.apiUrl));
|
|
3562
|
+
}
|
|
3563
|
+
async getShop(e) {
|
|
3564
|
+
try {
|
|
3565
|
+
this.debugLog("Fetching shop", { slug: e });
|
|
3566
|
+
const n = await this.sdk.getShopBySlug({ slug: e, trackerLinkId: this.config.trackerId });
|
|
3567
|
+
if (this.debugLog("Raw GraphQL response", n), n?.findShopBySlug) {
|
|
3568
|
+
const i = n.findShopBySlug;
|
|
3569
|
+
return this.debugLog("Public Shop fetched"), i;
|
|
3570
|
+
}
|
|
3571
|
+
return null;
|
|
3572
|
+
} catch (n) {
|
|
3573
|
+
throw this.debugLog("Error fetching single Shop", n), n;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
debugLog(e, n) {
|
|
3577
|
+
this.config.debug && console.log(`[ShopService] ${e}`, n || "");
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
const nn = "https://api.ticketapp.com/graphql";
|
|
3581
|
+
class an {
|
|
3398
3582
|
basket;
|
|
3399
3583
|
event;
|
|
3400
3584
|
payment;
|
|
3401
3585
|
package;
|
|
3402
3586
|
category;
|
|
3403
3587
|
metric;
|
|
3588
|
+
shop;
|
|
3404
3589
|
// Attach selected public types to the SDK class
|
|
3405
3590
|
static Types = Te;
|
|
3406
3591
|
constructor(e) {
|
|
3407
|
-
const { organizationId:
|
|
3408
|
-
this.
|
|
3409
|
-
}
|
|
3410
|
-
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
3411
|
-
// Persist to session when found via config or URL for subsequent page loads
|
|
3412
|
-
getOrInitTrackerId() {
|
|
3413
|
-
try {
|
|
3414
|
-
let e = null, t = null;
|
|
3415
|
-
if (typeof window < "u") {
|
|
3416
|
-
try {
|
|
3417
|
-
t = new URL(window.location.href).searchParams.get("trackerId");
|
|
3418
|
-
} catch {
|
|
3419
|
-
}
|
|
3420
|
-
try {
|
|
3421
|
-
e = window.sessionStorage?.getItem(Z) ?? null;
|
|
3422
|
-
} catch {
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
if (t && t.trim().length > 0) {
|
|
3426
|
-
try {
|
|
3427
|
-
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Z, t);
|
|
3428
|
-
} catch {
|
|
3429
|
-
}
|
|
3430
|
-
return t;
|
|
3431
|
-
}
|
|
3432
|
-
if (e && e.trim().length > 0) {
|
|
3433
|
-
try {
|
|
3434
|
-
if (typeof window < "u") {
|
|
3435
|
-
const i = new URL(window.location.href);
|
|
3436
|
-
i.searchParams.get("trackerId") || (i.searchParams.set("trackerId", e), window.history.replaceState({}, "", i.toString()));
|
|
3437
|
-
}
|
|
3438
|
-
} catch {
|
|
3439
|
-
}
|
|
3440
|
-
return e;
|
|
3441
|
-
}
|
|
3442
|
-
return;
|
|
3443
|
-
} catch {
|
|
3444
|
-
return;
|
|
3445
|
-
}
|
|
3592
|
+
const { organizationId: n, debug: i = !1, apiUrl: r = nn } = e;
|
|
3593
|
+
this.event = new St({ organizationId: n, debug: i, apiUrl: r, trackerId: e.trackerId }), this.package = new Mt({ organizationId: n, debug: i, apiUrl: r }), this.category = new jt({ organizationId: n, debug: i, apiUrl: r }), this.metric = new Wt({ apiUrl: r, trackerId: e.trackerId }), this.shop = new tn({ debug: i, apiUrl: r, trackerId: e.trackerId }), this.basket = new At({ debug: i, apiUrl: r, trackerId: e.trackerId }), this.payment = new Rt({ debug: i, apiUrl: r });
|
|
3446
3594
|
}
|
|
3447
3595
|
}
|
|
3448
3596
|
export {
|
|
3449
3597
|
T as BasketOrderType,
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3598
|
+
ae as DiscountType,
|
|
3599
|
+
ee as EventStatus,
|
|
3600
|
+
F as MetricsType,
|
|
3601
|
+
se as OrderItemType,
|
|
3454
3602
|
R as PackageItemType,
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3603
|
+
Z as PackageStatus,
|
|
3604
|
+
K as PackageTabType,
|
|
3605
|
+
re as PaymentMethodFeeType,
|
|
3606
|
+
ne as ProductStatus,
|
|
3607
|
+
ie as ProductType,
|
|
3608
|
+
oe as ShopTemplateType,
|
|
3609
|
+
ce as ShopVariationType,
|
|
3610
|
+
te as SortOrder,
|
|
3611
|
+
an as TicketappSDK
|
|
3462
3612
|
};
|