@ticketapp-dev/shop-sdk 1.0.47 → 1.0.50
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 +1133 -1076
- package/dist/sdk.d.ts +2 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/services/custom-field/custom-field.service.d.ts +13 -0
- package/dist/services/custom-field/custom-field.service.d.ts.map +1 -0
- package/dist/services/custom-field/custom-field.service.generated.d.ts +36 -0
- package/dist/services/custom-field/custom-field.service.generated.d.ts.map +1 -0
- package/dist/services/event/event.service.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +43 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { GraphQLClient as
|
|
2
|
-
import { DateTime as
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
import { GraphQLClient as T } from "graphql-request";
|
|
2
|
+
import { DateTime as O } from "luxon";
|
|
3
|
+
var N = /* @__PURE__ */ ((e) => (e.PACKAGE = "PACKAGE", e.PRODUCT = "PRODUCT", e.ADD_ONS = "ADD_ONS", e.DELIVERY = "DELIVERY", e.PICKUP = "PICKUP", e))(N || {}), R = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(R || {}), Z = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Concept = "CONCEPT", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Z || {}), K = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(K || {}), ee = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(ee || {}), te = /* @__PURE__ */ ((e) => (e.Asc = "ASC", e.Desc = "DESC", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.AllReserved = "ALL_RESERVED", e.Available = "AVAILABLE", e.SoldOut = "SOLD_OUT", e))(ne || {}), re = /* @__PURE__ */ ((e) => (e.Addon = "ADDON", e.Delivery = "DELIVERY", e.Door = "DOOR", e.Friend = "FRIEND", e.Guest = "GUEST", e.Pickup = "PICKUP", e.Promoter = "PROMOTER", e.Ticket = "TICKET", e))(re || {}), ie = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(ie || {}), se = /* @__PURE__ */ ((e) => (e.AddOn = "ADD_ON", e.DeliveryOption = "DELIVERY_OPTION", e.EntranceTicket = "ENTRANCE_TICKET", e))(se || {}), ae = /* @__PURE__ */ ((e) => (e.Fixed = "FIXED", e.Percentage = "PERCENTAGE", e))(ae || {}), oe = /* @__PURE__ */ ((e) => (e.Default = "DEFAULT", e.Transparent = "TRANSPARENT", e))(oe || {}), ce = /* @__PURE__ */ ((e) => (e.Calendar = "CALENDAR", e.Large = "LARGE", e.Small = "SMALL", e))(ce || {}), F = /* @__PURE__ */ ((e) => (e.Event = "EVENT", e.Package = "PACKAGE", e))(F || {}), de = /* @__PURE__ */ ((e) => (e.RADIO_BUTTON = "RADIO_BUTTON", e.DATE = "DATE", e.EMAIL = "EMAIL", e.NUMERIC = "NUMERIC", e.DROPDOWN = "DROPDOWN", e.TEXT = "TEXT", e.TEXT_AREA = "TEXT_AREA", e.TIME = "TIME", e.CHECKBOX = "CHECKBOX", e.PHONE_NUMBER = "PHONE_NUMBER", e))(de || {}), ue = /* @__PURE__ */ ((e) => (e.GENDER = "GENDER", e.FIRST_NAME = "FIRST_NAME", e.LAST_NAME = "LAST_NAME", e.EMAIL = "EMAIL", e.AGE = "AGE", e.RESIDENCE = "RESIDENCE", e.GOOGLE_PLACE = "GOOGLE_PLACE", e))(ue || {}), le = /* @__PURE__ */ ((e) => (e.ONLINE = "ONLINE", e.OFFLINE = "OFFLINE", e))(le || {});
|
|
4
|
+
const ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
5
|
__proto__: null,
|
|
6
|
-
BasketOrderType:
|
|
6
|
+
BasketOrderType: N,
|
|
7
|
+
CustomFieldMandatoryType: ue,
|
|
8
|
+
CustomFieldType: de,
|
|
7
9
|
DiscountType: ae,
|
|
8
10
|
EventStatus: ee,
|
|
9
11
|
MetricsType: F,
|
|
@@ -11,91 +13,92 @@ const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
11
13
|
PackageItemType: R,
|
|
12
14
|
PackageStatus: Z,
|
|
13
15
|
PackageTabType: K,
|
|
14
|
-
PaymentMethodFeeType:
|
|
16
|
+
PaymentMethodFeeType: ie,
|
|
15
17
|
ProductStatus: ne,
|
|
16
|
-
ProductType:
|
|
18
|
+
ProductType: re,
|
|
19
|
+
SalesLocations: le,
|
|
17
20
|
ShopTemplateType: oe,
|
|
18
21
|
ShopVariationType: ce,
|
|
19
22
|
SortOrder: te
|
|
20
23
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21
24
|
var w = function() {
|
|
22
|
-
return w = Object.assign || function(
|
|
23
|
-
for (var n,
|
|
24
|
-
n = arguments[
|
|
25
|
-
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (
|
|
25
|
+
return w = Object.assign || function(t) {
|
|
26
|
+
for (var n, r = 1, i = arguments.length; r < i; r++) {
|
|
27
|
+
n = arguments[r];
|
|
28
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
|
|
26
29
|
}
|
|
27
|
-
return
|
|
30
|
+
return t;
|
|
28
31
|
}, w.apply(this, arguments);
|
|
29
32
|
};
|
|
30
|
-
function
|
|
31
|
-
if (!!!
|
|
32
|
-
throw new Error(
|
|
33
|
+
function V(e, t) {
|
|
34
|
+
if (!!!e)
|
|
35
|
+
throw new Error(t);
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
return typeof
|
|
37
|
+
function Pe(e) {
|
|
38
|
+
return typeof e == "object" && e !== null;
|
|
36
39
|
}
|
|
37
|
-
function
|
|
38
|
-
if (!!!
|
|
40
|
+
function be(e, t) {
|
|
41
|
+
if (!!!e)
|
|
39
42
|
throw new Error(
|
|
40
43
|
"Unexpected invariant triggered."
|
|
41
44
|
);
|
|
42
45
|
}
|
|
43
|
-
const
|
|
44
|
-
function z(
|
|
45
|
-
let n = 0,
|
|
46
|
-
for (const
|
|
47
|
-
if (typeof
|
|
46
|
+
const Se = /\r\n|[\n\r]/g;
|
|
47
|
+
function z(e, t) {
|
|
48
|
+
let n = 0, r = 1;
|
|
49
|
+
for (const i of e.body.matchAll(Se)) {
|
|
50
|
+
if (typeof i.index == "number" || be(!1), i.index >= t)
|
|
48
51
|
break;
|
|
49
|
-
n =
|
|
52
|
+
n = i.index + i[0].length, r += 1;
|
|
50
53
|
}
|
|
51
54
|
return {
|
|
52
|
-
line:
|
|
53
|
-
column:
|
|
55
|
+
line: r,
|
|
56
|
+
column: t + 1 - n
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
|
-
function
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
z(
|
|
59
|
+
function xe(e) {
|
|
60
|
+
return he(
|
|
61
|
+
e.source,
|
|
62
|
+
z(e.source, e.start)
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
|
-
function
|
|
63
|
-
const n =
|
|
64
|
-
`, g =
|
|
65
|
+
function he(e, t) {
|
|
66
|
+
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, l = t.line === 1 ? n : 0, h = t.column + l, E = `${e.name}:${o}:${h}
|
|
67
|
+
`, g = r.split(/\r\n|[\n\r]/g), d = g[i];
|
|
65
68
|
if (d.length > 120) {
|
|
66
|
-
const m = Math.floor(
|
|
67
|
-
for (let
|
|
68
|
-
|
|
69
|
+
const m = Math.floor(h / 80), y = h % 80, p = [];
|
|
70
|
+
for (let k = 0; k < d.length; k += 80)
|
|
71
|
+
p.push(d.slice(k, k + 80));
|
|
69
72
|
return E + Q([
|
|
70
|
-
[`${o} |`,
|
|
71
|
-
...
|
|
73
|
+
[`${o} |`, p[0]],
|
|
74
|
+
...p.slice(1, m + 1).map((k) => ["|", k]),
|
|
72
75
|
["|", "^".padStart(y)],
|
|
73
|
-
["|",
|
|
76
|
+
["|", p[m + 1]]
|
|
74
77
|
]);
|
|
75
78
|
}
|
|
76
79
|
return E + Q([
|
|
77
80
|
// Lines specified like this: ["prefix", "string"],
|
|
78
|
-
[`${o - 1} |`, g[
|
|
81
|
+
[`${o - 1} |`, g[i - 1]],
|
|
79
82
|
[`${o} |`, d],
|
|
80
|
-
["|", "^".padStart(
|
|
81
|
-
[`${o + 1} |`, g[
|
|
83
|
+
["|", "^".padStart(h)],
|
|
84
|
+
[`${o + 1} |`, g[i + 1]]
|
|
82
85
|
]);
|
|
83
86
|
}
|
|
84
|
-
function Q(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
+
function Q(e) {
|
|
88
|
+
const t = e.filter(([r, i]) => i !== void 0), n = Math.max(...t.map(([r]) => r.length));
|
|
89
|
+
return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
|
|
87
90
|
`);
|
|
88
91
|
}
|
|
89
|
-
function
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
nodes:
|
|
93
|
-
source:
|
|
94
|
-
positions:
|
|
95
|
-
path:
|
|
96
|
-
originalError:
|
|
97
|
-
extensions:
|
|
98
|
-
} :
|
|
92
|
+
function _e(e) {
|
|
93
|
+
const t = e[0];
|
|
94
|
+
return t == null || "kind" in t || "length" in t ? {
|
|
95
|
+
nodes: t,
|
|
96
|
+
source: e[1],
|
|
97
|
+
positions: e[2],
|
|
98
|
+
path: e[3],
|
|
99
|
+
originalError: e[4],
|
|
100
|
+
extensions: e[5]
|
|
101
|
+
} : t;
|
|
99
102
|
}
|
|
100
103
|
class j extends Error {
|
|
101
104
|
/**
|
|
@@ -136,17 +139,17 @@ class j extends Error {
|
|
|
136
139
|
/**
|
|
137
140
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
138
141
|
*/
|
|
139
|
-
constructor(
|
|
140
|
-
var
|
|
141
|
-
const { nodes: o, source: l, positions:
|
|
142
|
-
super(
|
|
142
|
+
constructor(t, ...n) {
|
|
143
|
+
var r, i, s;
|
|
144
|
+
const { nodes: o, source: l, positions: h, path: E, originalError: g, extensions: d } = _e(n);
|
|
145
|
+
super(t), this.name = "GraphQLError", this.path = E ?? void 0, this.originalError = g ?? void 0, this.nodes = X(
|
|
143
146
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
144
147
|
);
|
|
145
148
|
const m = X(
|
|
146
|
-
(
|
|
149
|
+
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((p) => p.loc).filter((p) => p != null)
|
|
147
150
|
);
|
|
148
|
-
this.source = l ?? (m == null || (
|
|
149
|
-
const y =
|
|
151
|
+
this.source = l ?? (m == null || (i = m[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? m?.map((p) => p.start), this.locations = h && l ? h.map((p) => z(l, p)) : m?.map((p) => z(p.source, p.start));
|
|
152
|
+
const y = Pe(
|
|
150
153
|
g?.extensions
|
|
151
154
|
) ? g?.extensions : void 0;
|
|
152
155
|
this.extensions = (s = d ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
@@ -183,36 +186,36 @@ class j extends Error {
|
|
|
183
186
|
return "GraphQLError";
|
|
184
187
|
}
|
|
185
188
|
toString() {
|
|
186
|
-
let
|
|
189
|
+
let t = this.message;
|
|
187
190
|
if (this.nodes)
|
|
188
191
|
for (const n of this.nodes)
|
|
189
|
-
n.loc && (
|
|
192
|
+
n.loc && (t += `
|
|
190
193
|
|
|
191
|
-
` +
|
|
194
|
+
` + xe(n.loc));
|
|
192
195
|
else if (this.source && this.locations)
|
|
193
196
|
for (const n of this.locations)
|
|
194
|
-
|
|
197
|
+
t += `
|
|
195
198
|
|
|
196
|
-
` +
|
|
197
|
-
return
|
|
199
|
+
` + he(this.source, n);
|
|
200
|
+
return t;
|
|
198
201
|
}
|
|
199
202
|
toJSON() {
|
|
200
|
-
const
|
|
203
|
+
const t = {
|
|
201
204
|
message: this.message
|
|
202
205
|
};
|
|
203
|
-
return this.locations != null && (
|
|
206
|
+
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
|
-
function X(
|
|
207
|
-
return
|
|
209
|
+
function X(e) {
|
|
210
|
+
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
208
211
|
}
|
|
209
|
-
function I(
|
|
212
|
+
function I(e, t, n) {
|
|
210
213
|
return new j(`Syntax Error: ${n}`, {
|
|
211
|
-
source:
|
|
212
|
-
positions: [
|
|
214
|
+
source: e,
|
|
215
|
+
positions: [t]
|
|
213
216
|
});
|
|
214
217
|
}
|
|
215
|
-
class
|
|
218
|
+
class Ce {
|
|
216
219
|
/**
|
|
217
220
|
* The character offset at which this Node begins.
|
|
218
221
|
*/
|
|
@@ -228,8 +231,8 @@ class Se {
|
|
|
228
231
|
/**
|
|
229
232
|
* The Source document the AST represents.
|
|
230
233
|
*/
|
|
231
|
-
constructor(
|
|
232
|
-
this.start =
|
|
234
|
+
constructor(t, n, r) {
|
|
235
|
+
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = r;
|
|
233
236
|
}
|
|
234
237
|
get [Symbol.toStringTag]() {
|
|
235
238
|
return "Location";
|
|
@@ -241,7 +244,7 @@ class Se {
|
|
|
241
244
|
};
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
|
-
class
|
|
247
|
+
class pe {
|
|
245
248
|
/**
|
|
246
249
|
* The kind of Token.
|
|
247
250
|
*/
|
|
@@ -268,8 +271,8 @@ class ue {
|
|
|
268
271
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
269
272
|
* the last.
|
|
270
273
|
*/
|
|
271
|
-
constructor(
|
|
272
|
-
this.kind =
|
|
274
|
+
constructor(t, n, r, i, s, o) {
|
|
275
|
+
this.kind = t, this.start = n, this.end = r, this.line = i, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
273
276
|
}
|
|
274
277
|
get [Symbol.toStringTag]() {
|
|
275
278
|
return "Token";
|
|
@@ -283,7 +286,7 @@ class ue {
|
|
|
283
286
|
};
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
|
-
const
|
|
289
|
+
const Le = {
|
|
287
290
|
Name: [],
|
|
288
291
|
Document: ["definitions"],
|
|
289
292
|
OperationDefinition: [
|
|
@@ -371,59 +374,59 @@ const xe = {
|
|
|
371
374
|
DirectiveCoordinate: ["name"],
|
|
372
375
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
373
376
|
};
|
|
374
|
-
new Set(Object.keys(
|
|
375
|
-
var
|
|
376
|
-
(function(
|
|
377
|
-
|
|
378
|
-
})(
|
|
377
|
+
new Set(Object.keys(Le));
|
|
378
|
+
var v;
|
|
379
|
+
(function(e) {
|
|
380
|
+
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
381
|
+
})(v || (v = {}));
|
|
379
382
|
var q;
|
|
380
|
-
(function(
|
|
381
|
-
|
|
383
|
+
(function(e) {
|
|
384
|
+
e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
382
385
|
})(q || (q = {}));
|
|
383
386
|
var c;
|
|
384
|
-
(function(
|
|
385
|
-
|
|
387
|
+
(function(e) {
|
|
388
|
+
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e.TYPE_COORDINATE = "TypeCoordinate", e.MEMBER_COORDINATE = "MemberCoordinate", e.ARGUMENT_COORDINATE = "ArgumentCoordinate", e.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
386
389
|
})(c || (c = {}));
|
|
387
|
-
function
|
|
388
|
-
return
|
|
390
|
+
function Re(e) {
|
|
391
|
+
return e === 9 || e === 32;
|
|
389
392
|
}
|
|
390
|
-
function x(
|
|
391
|
-
return
|
|
393
|
+
function x(e) {
|
|
394
|
+
return e >= 48 && e <= 57;
|
|
392
395
|
}
|
|
393
|
-
function
|
|
394
|
-
return
|
|
395
|
-
|
|
396
|
+
function ge(e) {
|
|
397
|
+
return e >= 97 && e <= 122 || // A-Z
|
|
398
|
+
e >= 65 && e <= 90;
|
|
396
399
|
}
|
|
397
|
-
function
|
|
398
|
-
return
|
|
400
|
+
function me(e) {
|
|
401
|
+
return ge(e) || e === 95;
|
|
399
402
|
}
|
|
400
|
-
function
|
|
401
|
-
return
|
|
403
|
+
function Fe(e) {
|
|
404
|
+
return ge(e) || x(e) || e === 95;
|
|
402
405
|
}
|
|
403
|
-
function
|
|
404
|
-
var
|
|
405
|
-
let n = Number.MAX_SAFE_INTEGER,
|
|
406
|
-
for (let o = 0; o <
|
|
406
|
+
function we(e) {
|
|
407
|
+
var t;
|
|
408
|
+
let n = Number.MAX_SAFE_INTEGER, r = null, i = -1;
|
|
409
|
+
for (let o = 0; o < e.length; ++o) {
|
|
407
410
|
var s;
|
|
408
|
-
const l =
|
|
409
|
-
|
|
411
|
+
const l = e[o], h = $e(l);
|
|
412
|
+
h !== l.length && (r = (s = r) !== null && s !== void 0 ? s : o, i = o, o !== 0 && h < n && (n = h));
|
|
410
413
|
}
|
|
411
|
-
return
|
|
412
|
-
(
|
|
413
|
-
|
|
414
|
+
return e.map((o, l) => l === 0 ? o : o.slice(n)).slice(
|
|
415
|
+
(t = r) !== null && t !== void 0 ? t : 0,
|
|
416
|
+
i + 1
|
|
414
417
|
);
|
|
415
418
|
}
|
|
416
|
-
function
|
|
417
|
-
let
|
|
418
|
-
for (;
|
|
419
|
-
++
|
|
420
|
-
return
|
|
419
|
+
function $e(e) {
|
|
420
|
+
let t = 0;
|
|
421
|
+
for (; t < e.length && Re(e.charCodeAt(t)); )
|
|
422
|
+
++t;
|
|
423
|
+
return t;
|
|
421
424
|
}
|
|
422
425
|
var a;
|
|
423
|
-
(function(
|
|
424
|
-
|
|
426
|
+
(function(e) {
|
|
427
|
+
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.DOT = ".", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
425
428
|
})(a || (a = {}));
|
|
426
|
-
class
|
|
429
|
+
class Be {
|
|
427
430
|
/**
|
|
428
431
|
* The previously focused non-ignored token.
|
|
429
432
|
*/
|
|
@@ -436,9 +439,9 @@ class Fe {
|
|
|
436
439
|
/**
|
|
437
440
|
* The character offset at which the current line begins.
|
|
438
441
|
*/
|
|
439
|
-
constructor(
|
|
440
|
-
const n = new
|
|
441
|
-
this.source =
|
|
442
|
+
constructor(t) {
|
|
443
|
+
const n = new pe(a.SOF, 0, 0, 0, 0);
|
|
444
|
+
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
442
445
|
}
|
|
443
446
|
get [Symbol.toStringTag]() {
|
|
444
447
|
return "Lexer";
|
|
@@ -454,53 +457,53 @@ class Fe {
|
|
|
454
457
|
* the state of Lexer.
|
|
455
458
|
*/
|
|
456
459
|
lookahead() {
|
|
457
|
-
let
|
|
458
|
-
if (
|
|
460
|
+
let t = this.token;
|
|
461
|
+
if (t.kind !== a.EOF)
|
|
459
462
|
do
|
|
460
|
-
if (
|
|
461
|
-
|
|
463
|
+
if (t.next)
|
|
464
|
+
t = t.next;
|
|
462
465
|
else {
|
|
463
|
-
const n =
|
|
464
|
-
|
|
466
|
+
const n = Ve(this, t.end);
|
|
467
|
+
t.next = n, n.prev = t, t = n;
|
|
465
468
|
}
|
|
466
|
-
while (
|
|
467
|
-
return
|
|
469
|
+
while (t.kind === a.COMMENT);
|
|
470
|
+
return t;
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
473
|
+
function Ue(e) {
|
|
474
|
+
return e === a.BANG || e === a.DOLLAR || e === a.AMP || e === a.PAREN_L || e === a.PAREN_R || e === a.DOT || e === a.SPREAD || e === a.COLON || e === a.EQUALS || e === a.AT || e === a.BRACKET_L || e === a.BRACKET_R || e === a.BRACE_L || e === a.PIPE || e === a.BRACE_R;
|
|
472
475
|
}
|
|
473
|
-
function P(
|
|
474
|
-
return
|
|
476
|
+
function P(e) {
|
|
477
|
+
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
475
478
|
}
|
|
476
|
-
function B(
|
|
477
|
-
return
|
|
479
|
+
function B(e, t) {
|
|
480
|
+
return fe(e.charCodeAt(t)) && Ie(e.charCodeAt(t + 1));
|
|
478
481
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
482
|
+
function fe(e) {
|
|
483
|
+
return e >= 55296 && e <= 56319;
|
|
481
484
|
}
|
|
482
|
-
function
|
|
483
|
-
return
|
|
485
|
+
function Ie(e) {
|
|
486
|
+
return e >= 56320 && e <= 57343;
|
|
484
487
|
}
|
|
485
|
-
function D(
|
|
486
|
-
const n =
|
|
488
|
+
function D(e, t) {
|
|
489
|
+
const n = e.source.body.codePointAt(t);
|
|
487
490
|
if (n === void 0)
|
|
488
491
|
return a.EOF;
|
|
489
492
|
if (n >= 32 && n <= 126) {
|
|
490
|
-
const
|
|
491
|
-
return
|
|
493
|
+
const r = String.fromCodePoint(n);
|
|
494
|
+
return r === '"' ? `'"'` : `"${r}"`;
|
|
492
495
|
}
|
|
493
496
|
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
494
497
|
}
|
|
495
|
-
function f(
|
|
496
|
-
const s =
|
|
497
|
-
return new
|
|
498
|
+
function f(e, t, n, r, i) {
|
|
499
|
+
const s = e.line, o = 1 + n - e.lineStart;
|
|
500
|
+
return new pe(t, n, r, s, o, i);
|
|
498
501
|
}
|
|
499
|
-
function
|
|
500
|
-
const n =
|
|
501
|
-
let
|
|
502
|
-
for (;
|
|
503
|
-
const s = n.charCodeAt(
|
|
502
|
+
function Ve(e, t) {
|
|
503
|
+
const n = e.source.body, r = n.length;
|
|
504
|
+
let i = t;
|
|
505
|
+
for (; i < r; ) {
|
|
506
|
+
const s = n.charCodeAt(i);
|
|
504
507
|
switch (s) {
|
|
505
508
|
// Ignored ::
|
|
506
509
|
// - UnicodeBOM
|
|
@@ -523,21 +526,21 @@ function $e(t, e) {
|
|
|
523
526
|
case 32:
|
|
524
527
|
// <space>
|
|
525
528
|
case 44:
|
|
526
|
-
++
|
|
529
|
+
++i;
|
|
527
530
|
continue;
|
|
528
531
|
// LineTerminator ::
|
|
529
532
|
// - "New Line (U+000A)"
|
|
530
533
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
531
534
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
532
535
|
case 10:
|
|
533
|
-
++
|
|
536
|
+
++i, ++e.line, e.lineStart = i;
|
|
534
537
|
continue;
|
|
535
538
|
case 13:
|
|
536
|
-
n.charCodeAt(
|
|
539
|
+
n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++e.line, e.lineStart = i;
|
|
537
540
|
continue;
|
|
538
541
|
// Comment
|
|
539
542
|
case 35:
|
|
540
|
-
return
|
|
543
|
+
return Me(e, i);
|
|
541
544
|
// Token ::
|
|
542
545
|
// - Punctuator
|
|
543
546
|
// - Name
|
|
@@ -547,207 +550,207 @@ function $e(t, e) {
|
|
|
547
550
|
//
|
|
548
551
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
549
552
|
case 33:
|
|
550
|
-
return f(
|
|
553
|
+
return f(e, a.BANG, i, i + 1);
|
|
551
554
|
case 36:
|
|
552
|
-
return f(
|
|
555
|
+
return f(e, a.DOLLAR, i, i + 1);
|
|
553
556
|
case 38:
|
|
554
|
-
return f(
|
|
557
|
+
return f(e, a.AMP, i, i + 1);
|
|
555
558
|
case 40:
|
|
556
|
-
return f(
|
|
559
|
+
return f(e, a.PAREN_L, i, i + 1);
|
|
557
560
|
case 41:
|
|
558
|
-
return f(
|
|
561
|
+
return f(e, a.PAREN_R, i, i + 1);
|
|
559
562
|
case 46:
|
|
560
|
-
if (n.charCodeAt(
|
|
561
|
-
return f(
|
|
563
|
+
if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46)
|
|
564
|
+
return f(e, a.SPREAD, i, i + 3);
|
|
562
565
|
break;
|
|
563
566
|
case 58:
|
|
564
|
-
return f(
|
|
567
|
+
return f(e, a.COLON, i, i + 1);
|
|
565
568
|
case 61:
|
|
566
|
-
return f(
|
|
569
|
+
return f(e, a.EQUALS, i, i + 1);
|
|
567
570
|
case 64:
|
|
568
|
-
return f(
|
|
571
|
+
return f(e, a.AT, i, i + 1);
|
|
569
572
|
case 91:
|
|
570
|
-
return f(
|
|
573
|
+
return f(e, a.BRACKET_L, i, i + 1);
|
|
571
574
|
case 93:
|
|
572
|
-
return f(
|
|
575
|
+
return f(e, a.BRACKET_R, i, i + 1);
|
|
573
576
|
case 123:
|
|
574
|
-
return f(
|
|
577
|
+
return f(e, a.BRACE_L, i, i + 1);
|
|
575
578
|
case 124:
|
|
576
|
-
return f(
|
|
579
|
+
return f(e, a.PIPE, i, i + 1);
|
|
577
580
|
case 125:
|
|
578
|
-
return f(
|
|
581
|
+
return f(e, a.BRACE_R, i, i + 1);
|
|
579
582
|
// StringValue
|
|
580
583
|
case 34:
|
|
581
|
-
return n.charCodeAt(
|
|
584
|
+
return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? He(e, i) : qe(e, i);
|
|
582
585
|
}
|
|
583
586
|
if (x(s) || s === 45)
|
|
584
|
-
return
|
|
585
|
-
if (
|
|
586
|
-
return
|
|
587
|
+
return ze(e, i, s);
|
|
588
|
+
if (me(s))
|
|
589
|
+
return Je(e, i);
|
|
587
590
|
throw I(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || B(n,
|
|
591
|
+
e.source,
|
|
592
|
+
i,
|
|
593
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || B(n, i) ? `Unexpected character: ${D(e, i)}.` : `Invalid character: ${D(e, i)}.`
|
|
591
594
|
);
|
|
592
595
|
}
|
|
593
|
-
return f(
|
|
596
|
+
return f(e, a.EOF, r, r);
|
|
594
597
|
}
|
|
595
|
-
function
|
|
596
|
-
const n =
|
|
597
|
-
let
|
|
598
|
-
for (;
|
|
599
|
-
const s = n.charCodeAt(
|
|
598
|
+
function Me(e, t) {
|
|
599
|
+
const n = e.source.body, r = n.length;
|
|
600
|
+
let i = t + 1;
|
|
601
|
+
for (; i < r; ) {
|
|
602
|
+
const s = n.charCodeAt(i);
|
|
600
603
|
if (s === 10 || s === 13)
|
|
601
604
|
break;
|
|
602
605
|
if (P(s))
|
|
603
|
-
++
|
|
604
|
-
else if (B(n,
|
|
605
|
-
|
|
606
|
+
++i;
|
|
607
|
+
else if (B(n, i))
|
|
608
|
+
i += 2;
|
|
606
609
|
else
|
|
607
610
|
break;
|
|
608
611
|
}
|
|
609
612
|
return f(
|
|
610
|
-
t,
|
|
611
|
-
a.COMMENT,
|
|
612
613
|
e,
|
|
613
|
-
|
|
614
|
-
|
|
614
|
+
a.COMMENT,
|
|
615
|
+
t,
|
|
616
|
+
i,
|
|
617
|
+
n.slice(t + 1, i)
|
|
615
618
|
);
|
|
616
619
|
}
|
|
617
|
-
function
|
|
618
|
-
const
|
|
619
|
-
let
|
|
620
|
-
if (s === 45 && (s =
|
|
621
|
-
if (s =
|
|
620
|
+
function ze(e, t, n) {
|
|
621
|
+
const r = e.source.body;
|
|
622
|
+
let i = t, s = n, o = !1;
|
|
623
|
+
if (s === 45 && (s = r.charCodeAt(++i)), s === 48) {
|
|
624
|
+
if (s = r.charCodeAt(++i), x(s))
|
|
622
625
|
throw I(
|
|
623
|
-
|
|
624
|
-
|
|
626
|
+
e.source,
|
|
627
|
+
i,
|
|
625
628
|
`Invalid number, unexpected digit after 0: ${D(
|
|
626
|
-
|
|
627
|
-
|
|
629
|
+
e,
|
|
630
|
+
i
|
|
628
631
|
)}.`
|
|
629
632
|
);
|
|
630
633
|
} else
|
|
631
|
-
|
|
632
|
-
if (s === 46 && (o = !0, s =
|
|
634
|
+
i = M(e, i, s), s = r.charCodeAt(i);
|
|
635
|
+
if (s === 46 && (o = !0, s = r.charCodeAt(++i), i = M(e, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (o = !0, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = M(e, i, s), s = r.charCodeAt(i)), s === 46 || me(s))
|
|
633
636
|
throw I(
|
|
634
|
-
|
|
635
|
-
|
|
637
|
+
e.source,
|
|
638
|
+
i,
|
|
636
639
|
`Invalid number, expected digit but got: ${D(
|
|
637
|
-
|
|
638
|
-
|
|
640
|
+
e,
|
|
641
|
+
i
|
|
639
642
|
)}.`
|
|
640
643
|
);
|
|
641
644
|
return f(
|
|
642
|
-
t,
|
|
643
|
-
o ? a.FLOAT : a.INT,
|
|
644
645
|
e,
|
|
645
|
-
|
|
646
|
-
|
|
646
|
+
o ? a.FLOAT : a.INT,
|
|
647
|
+
t,
|
|
648
|
+
i,
|
|
649
|
+
r.slice(t, i)
|
|
647
650
|
);
|
|
648
651
|
}
|
|
649
|
-
function M(
|
|
652
|
+
function M(e, t, n) {
|
|
650
653
|
if (!x(n))
|
|
651
654
|
throw I(
|
|
652
|
-
|
|
653
|
-
|
|
655
|
+
e.source,
|
|
656
|
+
t,
|
|
654
657
|
`Invalid number, expected digit but got: ${D(
|
|
655
|
-
|
|
656
|
-
|
|
658
|
+
e,
|
|
659
|
+
t
|
|
657
660
|
)}.`
|
|
658
661
|
);
|
|
659
|
-
const
|
|
660
|
-
let
|
|
661
|
-
for (; x(
|
|
662
|
-
++
|
|
663
|
-
return
|
|
664
|
-
}
|
|
665
|
-
function
|
|
666
|
-
const n =
|
|
667
|
-
let
|
|
668
|
-
for (;
|
|
669
|
-
const l = n.charCodeAt(
|
|
662
|
+
const r = e.source.body;
|
|
663
|
+
let i = t + 1;
|
|
664
|
+
for (; x(r.charCodeAt(i)); )
|
|
665
|
+
++i;
|
|
666
|
+
return i;
|
|
667
|
+
}
|
|
668
|
+
function qe(e, t) {
|
|
669
|
+
const n = e.source.body, r = n.length;
|
|
670
|
+
let i = t + 1, s = i, o = "";
|
|
671
|
+
for (; i < r; ) {
|
|
672
|
+
const l = n.charCodeAt(i);
|
|
670
673
|
if (l === 34)
|
|
671
|
-
return o += n.slice(s,
|
|
674
|
+
return o += n.slice(s, i), f(e, a.STRING, t, i + 1, o);
|
|
672
675
|
if (l === 92) {
|
|
673
|
-
o += n.slice(s,
|
|
674
|
-
const
|
|
675
|
-
o +=
|
|
676
|
+
o += n.slice(s, i);
|
|
677
|
+
const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? Ge(e, i) : je(e, i) : Ye(e, i);
|
|
678
|
+
o += h.value, i += h.size, s = i;
|
|
676
679
|
continue;
|
|
677
680
|
}
|
|
678
681
|
if (l === 10 || l === 13)
|
|
679
682
|
break;
|
|
680
683
|
if (P(l))
|
|
681
|
-
++
|
|
682
|
-
else if (B(n,
|
|
683
|
-
|
|
684
|
+
++i;
|
|
685
|
+
else if (B(n, i))
|
|
686
|
+
i += 2;
|
|
684
687
|
else
|
|
685
688
|
throw I(
|
|
686
|
-
|
|
687
|
-
|
|
689
|
+
e.source,
|
|
690
|
+
i,
|
|
688
691
|
`Invalid character within String: ${D(
|
|
689
|
-
|
|
690
|
-
|
|
692
|
+
e,
|
|
693
|
+
i
|
|
691
694
|
)}.`
|
|
692
695
|
);
|
|
693
696
|
}
|
|
694
|
-
throw I(
|
|
697
|
+
throw I(e.source, i, "Unterminated string.");
|
|
695
698
|
}
|
|
696
|
-
function
|
|
697
|
-
const n =
|
|
698
|
-
let
|
|
699
|
-
for (;
|
|
700
|
-
const s = n.charCodeAt(
|
|
699
|
+
function Ge(e, t) {
|
|
700
|
+
const n = e.source.body;
|
|
701
|
+
let r = 0, i = 3;
|
|
702
|
+
for (; i < 12; ) {
|
|
703
|
+
const s = n.charCodeAt(t + i++);
|
|
701
704
|
if (s === 125) {
|
|
702
|
-
if (
|
|
705
|
+
if (i < 5 || !P(r))
|
|
703
706
|
break;
|
|
704
707
|
return {
|
|
705
|
-
value: String.fromCodePoint(
|
|
706
|
-
size:
|
|
708
|
+
value: String.fromCodePoint(r),
|
|
709
|
+
size: i
|
|
707
710
|
};
|
|
708
711
|
}
|
|
709
|
-
if (
|
|
712
|
+
if (r = r << 4 | S(s), r < 0)
|
|
710
713
|
break;
|
|
711
714
|
}
|
|
712
715
|
throw I(
|
|
713
|
-
|
|
714
|
-
|
|
716
|
+
e.source,
|
|
717
|
+
t,
|
|
715
718
|
`Invalid Unicode escape sequence: "${n.slice(
|
|
716
|
-
|
|
717
|
-
|
|
719
|
+
t,
|
|
720
|
+
t + i
|
|
718
721
|
)}".`
|
|
719
722
|
);
|
|
720
723
|
}
|
|
721
|
-
function
|
|
722
|
-
const n =
|
|
723
|
-
if (P(
|
|
724
|
+
function je(e, t) {
|
|
725
|
+
const n = e.source.body, r = W(n, t + 2);
|
|
726
|
+
if (P(r))
|
|
724
727
|
return {
|
|
725
|
-
value: String.fromCodePoint(
|
|
728
|
+
value: String.fromCodePoint(r),
|
|
726
729
|
size: 6
|
|
727
730
|
};
|
|
728
|
-
if (
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
731
|
+
if (fe(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
732
|
+
const i = W(n, t + 8);
|
|
733
|
+
if (Ie(i))
|
|
731
734
|
return {
|
|
732
|
-
value: String.fromCodePoint(
|
|
735
|
+
value: String.fromCodePoint(r, i),
|
|
733
736
|
size: 12
|
|
734
737
|
};
|
|
735
738
|
}
|
|
736
739
|
throw I(
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
`Invalid Unicode escape sequence: "${n.slice(
|
|
740
|
+
e.source,
|
|
741
|
+
t,
|
|
742
|
+
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
740
743
|
);
|
|
741
744
|
}
|
|
742
|
-
function W(
|
|
743
|
-
return S(
|
|
745
|
+
function W(e, t) {
|
|
746
|
+
return S(e.charCodeAt(t)) << 12 | S(e.charCodeAt(t + 1)) << 8 | S(e.charCodeAt(t + 2)) << 4 | S(e.charCodeAt(t + 3));
|
|
744
747
|
}
|
|
745
|
-
function S(
|
|
746
|
-
return
|
|
748
|
+
function S(e) {
|
|
749
|
+
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
747
750
|
}
|
|
748
|
-
function
|
|
749
|
-
const n =
|
|
750
|
-
switch (n.charCodeAt(
|
|
751
|
+
function Ye(e, t) {
|
|
752
|
+
const n = e.source.body;
|
|
753
|
+
switch (n.charCodeAt(t + 1)) {
|
|
751
754
|
case 34:
|
|
752
755
|
return {
|
|
753
756
|
value: '"',
|
|
@@ -791,39 +794,39 @@ function qe(t, e) {
|
|
|
791
794
|
};
|
|
792
795
|
}
|
|
793
796
|
throw I(
|
|
794
|
-
|
|
795
|
-
|
|
797
|
+
e.source,
|
|
798
|
+
t,
|
|
796
799
|
`Invalid character escape sequence: "${n.slice(
|
|
797
|
-
|
|
798
|
-
|
|
800
|
+
t,
|
|
801
|
+
t + 2
|
|
799
802
|
)}".`
|
|
800
803
|
);
|
|
801
804
|
}
|
|
802
|
-
function
|
|
803
|
-
const n =
|
|
804
|
-
let
|
|
805
|
-
const
|
|
806
|
-
for (; s <
|
|
805
|
+
function He(e, t) {
|
|
806
|
+
const n = e.source.body, r = n.length;
|
|
807
|
+
let i = e.lineStart, s = t + 3, o = s, l = "";
|
|
808
|
+
const h = [];
|
|
809
|
+
for (; s < r; ) {
|
|
807
810
|
const E = n.charCodeAt(s);
|
|
808
811
|
if (E === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
809
|
-
l += n.slice(o, s),
|
|
812
|
+
l += n.slice(o, s), h.push(l);
|
|
810
813
|
const g = f(
|
|
811
|
-
t,
|
|
812
|
-
a.BLOCK_STRING,
|
|
813
814
|
e,
|
|
815
|
+
a.BLOCK_STRING,
|
|
816
|
+
t,
|
|
814
817
|
s + 3,
|
|
815
818
|
// Return a string of the lines joined with U+000A.
|
|
816
|
-
|
|
819
|
+
we(h).join(`
|
|
817
820
|
`)
|
|
818
821
|
);
|
|
819
|
-
return
|
|
822
|
+
return e.line += h.length - 1, e.lineStart = i, g;
|
|
820
823
|
}
|
|
821
824
|
if (E === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
822
825
|
l += n.slice(o, s), o = s + 1, s += 4;
|
|
823
826
|
continue;
|
|
824
827
|
}
|
|
825
828
|
if (E === 10 || E === 13) {
|
|
826
|
-
l += n.slice(o, s),
|
|
829
|
+
l += n.slice(o, s), h.push(l), E === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, l = "", o = s, i = s;
|
|
827
830
|
continue;
|
|
828
831
|
}
|
|
829
832
|
if (P(E))
|
|
@@ -832,110 +835,110 @@ function Ge(t, e) {
|
|
|
832
835
|
s += 2;
|
|
833
836
|
else
|
|
834
837
|
throw I(
|
|
835
|
-
|
|
838
|
+
e.source,
|
|
836
839
|
s,
|
|
837
840
|
`Invalid character within String: ${D(
|
|
838
|
-
|
|
841
|
+
e,
|
|
839
842
|
s
|
|
840
843
|
)}.`
|
|
841
844
|
);
|
|
842
845
|
}
|
|
843
|
-
throw I(
|
|
846
|
+
throw I(e.source, s, "Unterminated string.");
|
|
844
847
|
}
|
|
845
|
-
function
|
|
846
|
-
const n =
|
|
847
|
-
let
|
|
848
|
-
for (;
|
|
849
|
-
const s = n.charCodeAt(
|
|
850
|
-
if (
|
|
851
|
-
++
|
|
848
|
+
function Je(e, t) {
|
|
849
|
+
const n = e.source.body, r = n.length;
|
|
850
|
+
let i = t + 1;
|
|
851
|
+
for (; i < r; ) {
|
|
852
|
+
const s = n.charCodeAt(i);
|
|
853
|
+
if (Fe(s))
|
|
854
|
+
++i;
|
|
852
855
|
else
|
|
853
856
|
break;
|
|
854
857
|
}
|
|
855
858
|
return f(
|
|
856
|
-
t,
|
|
857
|
-
a.NAME,
|
|
858
859
|
e,
|
|
859
|
-
|
|
860
|
-
|
|
860
|
+
a.NAME,
|
|
861
|
+
t,
|
|
862
|
+
i,
|
|
863
|
+
n.slice(t, i)
|
|
861
864
|
);
|
|
862
865
|
}
|
|
863
|
-
const
|
|
864
|
-
function
|
|
865
|
-
return
|
|
866
|
+
const Qe = 10, Ee = 2;
|
|
867
|
+
function ye(e) {
|
|
868
|
+
return U(e, []);
|
|
866
869
|
}
|
|
867
|
-
function
|
|
868
|
-
switch (typeof
|
|
870
|
+
function U(e, t) {
|
|
871
|
+
switch (typeof e) {
|
|
869
872
|
case "string":
|
|
870
|
-
return JSON.stringify(
|
|
873
|
+
return JSON.stringify(e);
|
|
871
874
|
case "function":
|
|
872
|
-
return
|
|
875
|
+
return e.name ? `[function ${e.name}]` : "[function]";
|
|
873
876
|
case "object":
|
|
874
|
-
return
|
|
877
|
+
return Xe(e, t);
|
|
875
878
|
default:
|
|
876
|
-
return String(
|
|
879
|
+
return String(e);
|
|
877
880
|
}
|
|
878
881
|
}
|
|
879
|
-
function
|
|
880
|
-
if (
|
|
882
|
+
function Xe(e, t) {
|
|
883
|
+
if (e === null)
|
|
881
884
|
return "null";
|
|
882
|
-
if (
|
|
885
|
+
if (t.includes(e))
|
|
883
886
|
return "[Circular]";
|
|
884
|
-
const n = [...
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
return typeof
|
|
889
|
-
} else if (Array.isArray(
|
|
890
|
-
return
|
|
891
|
-
return
|
|
892
|
-
}
|
|
893
|
-
function
|
|
894
|
-
return typeof
|
|
895
|
-
}
|
|
896
|
-
function
|
|
897
|
-
const n = Object.entries(
|
|
898
|
-
return n.length === 0 ? "{}" :
|
|
899
|
-
([
|
|
887
|
+
const n = [...t, e];
|
|
888
|
+
if (We(e)) {
|
|
889
|
+
const r = e.toJSON();
|
|
890
|
+
if (r !== e)
|
|
891
|
+
return typeof r == "string" ? r : U(r, n);
|
|
892
|
+
} else if (Array.isArray(e))
|
|
893
|
+
return Ke(e, n);
|
|
894
|
+
return Ze(e, n);
|
|
895
|
+
}
|
|
896
|
+
function We(e) {
|
|
897
|
+
return typeof e.toJSON == "function";
|
|
898
|
+
}
|
|
899
|
+
function Ze(e, t) {
|
|
900
|
+
const n = Object.entries(e);
|
|
901
|
+
return n.length === 0 ? "{}" : t.length > Ee ? "[" + et(e) + "]" : "{ " + n.map(
|
|
902
|
+
([i, s]) => i + ": " + U(s, t)
|
|
900
903
|
).join(", ") + " }";
|
|
901
904
|
}
|
|
902
|
-
function
|
|
903
|
-
if (
|
|
905
|
+
function Ke(e, t) {
|
|
906
|
+
if (e.length === 0)
|
|
904
907
|
return "[]";
|
|
905
|
-
if (
|
|
908
|
+
if (t.length > Ee)
|
|
906
909
|
return "[Array]";
|
|
907
|
-
const n = Math.min(
|
|
910
|
+
const n = Math.min(Qe, e.length), r = e.length - n, i = [];
|
|
908
911
|
for (let s = 0; s < n; ++s)
|
|
909
|
-
|
|
910
|
-
return
|
|
912
|
+
i.push(U(e[s], t));
|
|
913
|
+
return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
|
|
911
914
|
}
|
|
912
|
-
function
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
const n =
|
|
915
|
+
function et(e) {
|
|
916
|
+
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
917
|
+
if (t === "Object" && typeof e.constructor == "function") {
|
|
918
|
+
const n = e.constructor.name;
|
|
916
919
|
if (typeof n == "string" && n !== "")
|
|
917
920
|
return n;
|
|
918
921
|
}
|
|
919
|
-
return
|
|
922
|
+
return t;
|
|
920
923
|
}
|
|
921
|
-
const
|
|
922
|
-
process.env.NODE_ENV === "production",
|
|
924
|
+
const tt = globalThis.process && // eslint-disable-next-line no-undef
|
|
925
|
+
process.env.NODE_ENV === "production", nt = (
|
|
923
926
|
/* c8 ignore next 6 */
|
|
924
927
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
925
|
-
|
|
926
|
-
return
|
|
927
|
-
} : function(
|
|
928
|
-
if (
|
|
928
|
+
tt ? function(t, n) {
|
|
929
|
+
return t instanceof n;
|
|
930
|
+
} : function(t, n) {
|
|
931
|
+
if (t instanceof n)
|
|
929
932
|
return !0;
|
|
930
|
-
if (typeof
|
|
931
|
-
var
|
|
932
|
-
const
|
|
933
|
+
if (typeof t == "object" && t !== null) {
|
|
934
|
+
var r;
|
|
935
|
+
const i = n.prototype[Symbol.toStringTag], s = (
|
|
933
936
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
934
|
-
Symbol.toStringTag in
|
|
937
|
+
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (r = t.constructor) === null || r === void 0 ? void 0 : r.name
|
|
935
938
|
);
|
|
936
|
-
if (
|
|
937
|
-
const o =
|
|
938
|
-
throw new Error(`Cannot use ${
|
|
939
|
+
if (i === s) {
|
|
940
|
+
const o = ye(t);
|
|
941
|
+
throw new Error(`Cannot use ${i} "${o}" from another module or realm.
|
|
939
942
|
|
|
940
943
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
941
944
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -952,15 +955,15 @@ spurious results.`);
|
|
|
952
955
|
return !1;
|
|
953
956
|
}
|
|
954
957
|
);
|
|
955
|
-
class
|
|
956
|
-
constructor(
|
|
958
|
+
class Oe {
|
|
959
|
+
constructor(t, n = "GraphQL request", r = {
|
|
957
960
|
line: 1,
|
|
958
961
|
column: 1
|
|
959
962
|
}) {
|
|
960
|
-
typeof
|
|
963
|
+
typeof t == "string" || V(!1, `Body must be a string. Received: ${ye(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || V(
|
|
961
964
|
!1,
|
|
962
965
|
"line in locationOffset is 1-indexed and must be positive."
|
|
963
|
-
), this.locationOffset.column > 0 ||
|
|
966
|
+
), this.locationOffset.column > 0 || V(
|
|
964
967
|
!1,
|
|
965
968
|
"column in locationOffset is 1-indexed and must be positive."
|
|
966
969
|
);
|
|
@@ -969,26 +972,26 @@ class Ie {
|
|
|
969
972
|
return "Source";
|
|
970
973
|
}
|
|
971
974
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
975
|
+
function rt(e) {
|
|
976
|
+
return nt(e, Oe);
|
|
974
977
|
}
|
|
975
|
-
function
|
|
976
|
-
const n = new
|
|
977
|
-
return Object.defineProperty(
|
|
978
|
+
function it(e, t) {
|
|
979
|
+
const n = new st(e, t), r = n.parseDocument();
|
|
980
|
+
return Object.defineProperty(r, "tokenCount", {
|
|
978
981
|
enumerable: !1,
|
|
979
982
|
value: n.tokenCount
|
|
980
|
-
}),
|
|
983
|
+
}), r;
|
|
981
984
|
}
|
|
982
|
-
class
|
|
983
|
-
constructor(
|
|
984
|
-
const { lexer:
|
|
985
|
-
if (
|
|
986
|
-
this._lexer =
|
|
985
|
+
class st {
|
|
986
|
+
constructor(t, n = {}) {
|
|
987
|
+
const { lexer: r, ...i } = n;
|
|
988
|
+
if (r)
|
|
989
|
+
this._lexer = r;
|
|
987
990
|
else {
|
|
988
|
-
const s =
|
|
989
|
-
this._lexer = new
|
|
991
|
+
const s = rt(t) ? t : new Oe(t);
|
|
992
|
+
this._lexer = new Be(s);
|
|
990
993
|
}
|
|
991
|
-
this._options =
|
|
994
|
+
this._options = i, this._tokenCounter = 0;
|
|
992
995
|
}
|
|
993
996
|
get tokenCount() {
|
|
994
997
|
return this._tokenCounter;
|
|
@@ -997,10 +1000,10 @@ class nt {
|
|
|
997
1000
|
* Converts a name lex token into a name parse node.
|
|
998
1001
|
*/
|
|
999
1002
|
parseName() {
|
|
1000
|
-
const
|
|
1001
|
-
return this.node(
|
|
1003
|
+
const t = this.expectToken(a.NAME);
|
|
1004
|
+
return this.node(t, {
|
|
1002
1005
|
kind: c.NAME,
|
|
1003
|
-
value:
|
|
1006
|
+
value: t.value
|
|
1004
1007
|
});
|
|
1005
1008
|
}
|
|
1006
1009
|
// Implements the parsing rules in the Document section.
|
|
@@ -1043,8 +1046,8 @@ class nt {
|
|
|
1043
1046
|
parseDefinition() {
|
|
1044
1047
|
if (this.peek(a.BRACE_L))
|
|
1045
1048
|
return this.parseOperationDefinition();
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1049
|
+
const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1050
|
+
if (t && n.kind === a.BRACE_L)
|
|
1048
1051
|
throw I(
|
|
1049
1052
|
this._lexer.source,
|
|
1050
1053
|
this._lexer.token.start,
|
|
@@ -1077,7 +1080,7 @@ class nt {
|
|
|
1077
1080
|
case "fragment":
|
|
1078
1081
|
return this.parseFragmentDefinition();
|
|
1079
1082
|
}
|
|
1080
|
-
if (
|
|
1083
|
+
if (t)
|
|
1081
1084
|
throw I(
|
|
1082
1085
|
this._lexer.source,
|
|
1083
1086
|
this._lexer.token.start,
|
|
@@ -1095,24 +1098,24 @@ class nt {
|
|
|
1095
1098
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1096
1099
|
*/
|
|
1097
1100
|
parseOperationDefinition() {
|
|
1098
|
-
const
|
|
1101
|
+
const t = this._lexer.token;
|
|
1099
1102
|
if (this.peek(a.BRACE_L))
|
|
1100
|
-
return this.node(
|
|
1103
|
+
return this.node(t, {
|
|
1101
1104
|
kind: c.OPERATION_DEFINITION,
|
|
1102
|
-
operation:
|
|
1105
|
+
operation: v.QUERY,
|
|
1103
1106
|
description: void 0,
|
|
1104
1107
|
name: void 0,
|
|
1105
1108
|
variableDefinitions: [],
|
|
1106
1109
|
directives: [],
|
|
1107
1110
|
selectionSet: this.parseSelectionSet()
|
|
1108
1111
|
});
|
|
1109
|
-
const n = this.parseDescription(),
|
|
1110
|
-
let
|
|
1111
|
-
return this.peek(a.NAME) && (
|
|
1112
|
+
const n = this.parseDescription(), r = this.parseOperationType();
|
|
1113
|
+
let i;
|
|
1114
|
+
return this.peek(a.NAME) && (i = this.parseName()), this.node(t, {
|
|
1112
1115
|
kind: c.OPERATION_DEFINITION,
|
|
1113
|
-
operation:
|
|
1116
|
+
operation: r,
|
|
1114
1117
|
description: n,
|
|
1115
|
-
name:
|
|
1118
|
+
name: i,
|
|
1116
1119
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1117
1120
|
directives: this.parseDirectives(!1),
|
|
1118
1121
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1122,16 +1125,16 @@ class nt {
|
|
|
1122
1125
|
* OperationType : one of query mutation subscription
|
|
1123
1126
|
*/
|
|
1124
1127
|
parseOperationType() {
|
|
1125
|
-
const
|
|
1126
|
-
switch (
|
|
1128
|
+
const t = this.expectToken(a.NAME);
|
|
1129
|
+
switch (t.value) {
|
|
1127
1130
|
case "query":
|
|
1128
|
-
return
|
|
1131
|
+
return v.QUERY;
|
|
1129
1132
|
case "mutation":
|
|
1130
|
-
return
|
|
1133
|
+
return v.MUTATION;
|
|
1131
1134
|
case "subscription":
|
|
1132
|
-
return
|
|
1135
|
+
return v.SUBSCRIPTION;
|
|
1133
1136
|
}
|
|
1134
|
-
throw this.unexpected(
|
|
1137
|
+
throw this.unexpected(t);
|
|
1135
1138
|
}
|
|
1136
1139
|
/**
|
|
1137
1140
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
@@ -1160,8 +1163,8 @@ class nt {
|
|
|
1160
1163
|
* Variable : $ Name
|
|
1161
1164
|
*/
|
|
1162
1165
|
parseVariable() {
|
|
1163
|
-
const
|
|
1164
|
-
return this.expectToken(a.DOLLAR), this.node(
|
|
1166
|
+
const t = this._lexer.token;
|
|
1167
|
+
return this.expectToken(a.DOLLAR), this.node(t, {
|
|
1165
1168
|
kind: c.VARIABLE,
|
|
1166
1169
|
name: this.parseName()
|
|
1167
1170
|
});
|
|
@@ -1196,12 +1199,12 @@ class nt {
|
|
|
1196
1199
|
* Alias : Name :
|
|
1197
1200
|
*/
|
|
1198
1201
|
parseField() {
|
|
1199
|
-
const
|
|
1200
|
-
let
|
|
1201
|
-
return this.expectOptionalToken(a.COLON) ? (
|
|
1202
|
+
const t = this._lexer.token, n = this.parseName();
|
|
1203
|
+
let r, i;
|
|
1204
|
+
return this.expectOptionalToken(a.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(t, {
|
|
1202
1205
|
kind: c.FIELD,
|
|
1203
|
-
alias:
|
|
1204
|
-
name:
|
|
1206
|
+
alias: r,
|
|
1207
|
+
name: i,
|
|
1205
1208
|
arguments: this.parseArguments(!1),
|
|
1206
1209
|
directives: this.parseDirectives(!1),
|
|
1207
1210
|
selectionSet: this.peek(a.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
@@ -1210,19 +1213,19 @@ class nt {
|
|
|
1210
1213
|
/**
|
|
1211
1214
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1212
1215
|
*/
|
|
1213
|
-
parseArguments(
|
|
1214
|
-
const n =
|
|
1216
|
+
parseArguments(t) {
|
|
1217
|
+
const n = t ? this.parseConstArgument : this.parseArgument;
|
|
1215
1218
|
return this.optionalMany(a.PAREN_L, n, a.PAREN_R);
|
|
1216
1219
|
}
|
|
1217
1220
|
/**
|
|
1218
1221
|
* Argument[Const] : Name : Value[?Const]
|
|
1219
1222
|
*/
|
|
1220
|
-
parseArgument(
|
|
1221
|
-
const n = this._lexer.token,
|
|
1223
|
+
parseArgument(t = !1) {
|
|
1224
|
+
const n = this._lexer.token, r = this.parseName();
|
|
1222
1225
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1223
1226
|
kind: c.ARGUMENT,
|
|
1224
|
-
name:
|
|
1225
|
-
value: this.parseValueLiteral(
|
|
1227
|
+
name: r,
|
|
1228
|
+
value: this.parseValueLiteral(t)
|
|
1226
1229
|
});
|
|
1227
1230
|
}
|
|
1228
1231
|
parseConstArgument() {
|
|
@@ -1237,14 +1240,14 @@ class nt {
|
|
|
1237
1240
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1238
1241
|
*/
|
|
1239
1242
|
parseFragment() {
|
|
1240
|
-
const
|
|
1243
|
+
const t = this._lexer.token;
|
|
1241
1244
|
this.expectToken(a.SPREAD);
|
|
1242
1245
|
const n = this.expectOptionalKeyword("on");
|
|
1243
|
-
return !n && this.peek(a.NAME) ? this.node(
|
|
1246
|
+
return !n && this.peek(a.NAME) ? this.node(t, {
|
|
1244
1247
|
kind: c.FRAGMENT_SPREAD,
|
|
1245
1248
|
name: this.parseFragmentName(),
|
|
1246
1249
|
directives: this.parseDirectives(!1)
|
|
1247
|
-
}) : this.node(
|
|
1250
|
+
}) : this.node(t, {
|
|
1248
1251
|
kind: c.INLINE_FRAGMENT,
|
|
1249
1252
|
typeCondition: n ? this.parseNamedType() : void 0,
|
|
1250
1253
|
directives: this.parseDirectives(!1),
|
|
@@ -1258,8 +1261,8 @@ class nt {
|
|
|
1258
1261
|
* TypeCondition : NamedType
|
|
1259
1262
|
*/
|
|
1260
1263
|
parseFragmentDefinition() {
|
|
1261
|
-
const
|
|
1262
|
-
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(
|
|
1264
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1265
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
|
|
1263
1266
|
kind: c.FRAGMENT_DEFINITION,
|
|
1264
1267
|
description: n,
|
|
1265
1268
|
name: this.parseFragmentName(),
|
|
@@ -1267,7 +1270,7 @@ class nt {
|
|
|
1267
1270
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1268
1271
|
directives: this.parseDirectives(!1),
|
|
1269
1272
|
selectionSet: this.parseSelectionSet()
|
|
1270
|
-
}) : this.node(
|
|
1273
|
+
}) : this.node(t, {
|
|
1271
1274
|
kind: c.FRAGMENT_DEFINITION,
|
|
1272
1275
|
description: n,
|
|
1273
1276
|
name: this.parseFragmentName(),
|
|
@@ -1303,13 +1306,13 @@ class nt {
|
|
|
1303
1306
|
*
|
|
1304
1307
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1305
1308
|
*/
|
|
1306
|
-
parseValueLiteral(
|
|
1309
|
+
parseValueLiteral(t) {
|
|
1307
1310
|
const n = this._lexer.token;
|
|
1308
1311
|
switch (n.kind) {
|
|
1309
1312
|
case a.BRACKET_L:
|
|
1310
|
-
return this.parseList(
|
|
1313
|
+
return this.parseList(t);
|
|
1311
1314
|
case a.BRACE_L:
|
|
1312
|
-
return this.parseObject(
|
|
1315
|
+
return this.parseObject(t);
|
|
1313
1316
|
case a.INT:
|
|
1314
1317
|
return this.advanceLexer(), this.node(n, {
|
|
1315
1318
|
kind: c.INT,
|
|
@@ -1346,13 +1349,13 @@ class nt {
|
|
|
1346
1349
|
});
|
|
1347
1350
|
}
|
|
1348
1351
|
case a.DOLLAR:
|
|
1349
|
-
if (
|
|
1352
|
+
if (t)
|
|
1350
1353
|
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1351
|
-
const
|
|
1354
|
+
const r = this._lexer.token.value;
|
|
1352
1355
|
throw I(
|
|
1353
1356
|
this._lexer.source,
|
|
1354
1357
|
n.start,
|
|
1355
|
-
`Unexpected variable "$${
|
|
1358
|
+
`Unexpected variable "$${r}" in constant value.`
|
|
1356
1359
|
);
|
|
1357
1360
|
} else
|
|
1358
1361
|
throw this.unexpected(n);
|
|
@@ -1365,11 +1368,11 @@ class nt {
|
|
|
1365
1368
|
return this.parseValueLiteral(!0);
|
|
1366
1369
|
}
|
|
1367
1370
|
parseStringLiteral() {
|
|
1368
|
-
const
|
|
1369
|
-
return this.advanceLexer(), this.node(
|
|
1371
|
+
const t = this._lexer.token;
|
|
1372
|
+
return this.advanceLexer(), this.node(t, {
|
|
1370
1373
|
kind: c.STRING,
|
|
1371
|
-
value:
|
|
1372
|
-
block:
|
|
1374
|
+
value: t.value,
|
|
1375
|
+
block: t.kind === a.BLOCK_STRING
|
|
1373
1376
|
});
|
|
1374
1377
|
}
|
|
1375
1378
|
/**
|
|
@@ -1377,8 +1380,8 @@ class nt {
|
|
|
1377
1380
|
* - [ ]
|
|
1378
1381
|
* - [ Value[?Const]+ ]
|
|
1379
1382
|
*/
|
|
1380
|
-
parseList(
|
|
1381
|
-
const n = () => this.parseValueLiteral(
|
|
1383
|
+
parseList(t) {
|
|
1384
|
+
const n = () => this.parseValueLiteral(t);
|
|
1382
1385
|
return this.node(this._lexer.token, {
|
|
1383
1386
|
kind: c.LIST,
|
|
1384
1387
|
values: this.any(a.BRACKET_L, n, a.BRACKET_R)
|
|
@@ -1391,8 +1394,8 @@ class nt {
|
|
|
1391
1394
|
* - { ObjectField[?Const]+ }
|
|
1392
1395
|
* ```
|
|
1393
1396
|
*/
|
|
1394
|
-
parseObject(
|
|
1395
|
-
const n = () => this.parseObjectField(
|
|
1397
|
+
parseObject(t) {
|
|
1398
|
+
const n = () => this.parseObjectField(t);
|
|
1396
1399
|
return this.node(this._lexer.token, {
|
|
1397
1400
|
kind: c.OBJECT,
|
|
1398
1401
|
fields: this.any(a.BRACE_L, n, a.BRACE_R)
|
|
@@ -1401,22 +1404,22 @@ class nt {
|
|
|
1401
1404
|
/**
|
|
1402
1405
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1403
1406
|
*/
|
|
1404
|
-
parseObjectField(
|
|
1405
|
-
const n = this._lexer.token,
|
|
1407
|
+
parseObjectField(t) {
|
|
1408
|
+
const n = this._lexer.token, r = this.parseName();
|
|
1406
1409
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1407
1410
|
kind: c.OBJECT_FIELD,
|
|
1408
|
-
name:
|
|
1409
|
-
value: this.parseValueLiteral(
|
|
1411
|
+
name: r,
|
|
1412
|
+
value: this.parseValueLiteral(t)
|
|
1410
1413
|
});
|
|
1411
1414
|
}
|
|
1412
1415
|
// Implements the parsing rules in the Directives section.
|
|
1413
1416
|
/**
|
|
1414
1417
|
* Directives[Const] : Directive[?Const]+
|
|
1415
1418
|
*/
|
|
1416
|
-
parseDirectives(
|
|
1419
|
+
parseDirectives(t) {
|
|
1417
1420
|
const n = [];
|
|
1418
1421
|
for (; this.peek(a.AT); )
|
|
1419
|
-
n.push(this.parseDirective(
|
|
1422
|
+
n.push(this.parseDirective(t));
|
|
1420
1423
|
return n;
|
|
1421
1424
|
}
|
|
1422
1425
|
parseConstDirectives() {
|
|
@@ -1427,12 +1430,12 @@ class nt {
|
|
|
1427
1430
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1428
1431
|
* ```
|
|
1429
1432
|
*/
|
|
1430
|
-
parseDirective(
|
|
1433
|
+
parseDirective(t) {
|
|
1431
1434
|
const n = this._lexer.token;
|
|
1432
1435
|
return this.expectToken(a.AT), this.node(n, {
|
|
1433
1436
|
kind: c.DIRECTIVE,
|
|
1434
1437
|
name: this.parseName(),
|
|
1435
|
-
arguments: this.parseArguments(
|
|
1438
|
+
arguments: this.parseArguments(t)
|
|
1436
1439
|
});
|
|
1437
1440
|
}
|
|
1438
1441
|
// Implements the parsing rules in the Types section.
|
|
@@ -1443,17 +1446,17 @@ class nt {
|
|
|
1443
1446
|
* - NonNullType
|
|
1444
1447
|
*/
|
|
1445
1448
|
parseTypeReference() {
|
|
1446
|
-
const
|
|
1449
|
+
const t = this._lexer.token;
|
|
1447
1450
|
let n;
|
|
1448
1451
|
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1449
|
-
const
|
|
1450
|
-
this.expectToken(a.BRACKET_R), n = this.node(
|
|
1452
|
+
const r = this.parseTypeReference();
|
|
1453
|
+
this.expectToken(a.BRACKET_R), n = this.node(t, {
|
|
1451
1454
|
kind: c.LIST_TYPE,
|
|
1452
|
-
type:
|
|
1455
|
+
type: r
|
|
1453
1456
|
});
|
|
1454
1457
|
} else
|
|
1455
1458
|
n = this.parseNamedType();
|
|
1456
|
-
return this.expectOptionalToken(a.BANG) ? this.node(
|
|
1459
|
+
return this.expectOptionalToken(a.BANG) ? this.node(t, {
|
|
1457
1460
|
kind: c.NON_NULL_TYPE,
|
|
1458
1461
|
type: n
|
|
1459
1462
|
}) : n;
|
|
@@ -1484,45 +1487,45 @@ class nt {
|
|
|
1484
1487
|
* ```
|
|
1485
1488
|
*/
|
|
1486
1489
|
parseSchemaDefinition() {
|
|
1487
|
-
const
|
|
1490
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1488
1491
|
this.expectKeyword("schema");
|
|
1489
|
-
const
|
|
1492
|
+
const r = this.parseConstDirectives(), i = this.many(
|
|
1490
1493
|
a.BRACE_L,
|
|
1491
1494
|
this.parseOperationTypeDefinition,
|
|
1492
1495
|
a.BRACE_R
|
|
1493
1496
|
);
|
|
1494
|
-
return this.node(
|
|
1497
|
+
return this.node(t, {
|
|
1495
1498
|
kind: c.SCHEMA_DEFINITION,
|
|
1496
1499
|
description: n,
|
|
1497
|
-
directives:
|
|
1498
|
-
operationTypes:
|
|
1500
|
+
directives: r,
|
|
1501
|
+
operationTypes: i
|
|
1499
1502
|
});
|
|
1500
1503
|
}
|
|
1501
1504
|
/**
|
|
1502
1505
|
* OperationTypeDefinition : OperationType : NamedType
|
|
1503
1506
|
*/
|
|
1504
1507
|
parseOperationTypeDefinition() {
|
|
1505
|
-
const
|
|
1508
|
+
const t = this._lexer.token, n = this.parseOperationType();
|
|
1506
1509
|
this.expectToken(a.COLON);
|
|
1507
|
-
const
|
|
1508
|
-
return this.node(
|
|
1510
|
+
const r = this.parseNamedType();
|
|
1511
|
+
return this.node(t, {
|
|
1509
1512
|
kind: c.OPERATION_TYPE_DEFINITION,
|
|
1510
1513
|
operation: n,
|
|
1511
|
-
type:
|
|
1514
|
+
type: r
|
|
1512
1515
|
});
|
|
1513
1516
|
}
|
|
1514
1517
|
/**
|
|
1515
1518
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1516
1519
|
*/
|
|
1517
1520
|
parseScalarTypeDefinition() {
|
|
1518
|
-
const
|
|
1521
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1519
1522
|
this.expectKeyword("scalar");
|
|
1520
|
-
const
|
|
1521
|
-
return this.node(
|
|
1523
|
+
const r = this.parseName(), i = this.parseConstDirectives();
|
|
1524
|
+
return this.node(t, {
|
|
1522
1525
|
kind: c.SCALAR_TYPE_DEFINITION,
|
|
1523
1526
|
description: n,
|
|
1524
|
-
name:
|
|
1525
|
-
directives:
|
|
1527
|
+
name: r,
|
|
1528
|
+
directives: i
|
|
1526
1529
|
});
|
|
1527
1530
|
}
|
|
1528
1531
|
/**
|
|
@@ -1531,14 +1534,14 @@ class nt {
|
|
|
1531
1534
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1532
1535
|
*/
|
|
1533
1536
|
parseObjectTypeDefinition() {
|
|
1534
|
-
const
|
|
1537
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1535
1538
|
this.expectKeyword("type");
|
|
1536
|
-
const
|
|
1537
|
-
return this.node(
|
|
1539
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1540
|
+
return this.node(t, {
|
|
1538
1541
|
kind: c.OBJECT_TYPE_DEFINITION,
|
|
1539
1542
|
description: n,
|
|
1540
|
-
name:
|
|
1541
|
-
interfaces:
|
|
1543
|
+
name: r,
|
|
1544
|
+
interfaces: i,
|
|
1542
1545
|
directives: s,
|
|
1543
1546
|
fields: o
|
|
1544
1547
|
});
|
|
@@ -1568,14 +1571,14 @@ class nt {
|
|
|
1568
1571
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1569
1572
|
*/
|
|
1570
1573
|
parseFieldDefinition() {
|
|
1571
|
-
const
|
|
1574
|
+
const t = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs();
|
|
1572
1575
|
this.expectToken(a.COLON);
|
|
1573
1576
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1574
|
-
return this.node(
|
|
1577
|
+
return this.node(t, {
|
|
1575
1578
|
kind: c.FIELD_DEFINITION,
|
|
1576
1579
|
description: n,
|
|
1577
|
-
name:
|
|
1578
|
-
arguments:
|
|
1580
|
+
name: r,
|
|
1581
|
+
arguments: i,
|
|
1579
1582
|
type: s,
|
|
1580
1583
|
directives: o
|
|
1581
1584
|
});
|
|
@@ -1595,17 +1598,17 @@ class nt {
|
|
|
1595
1598
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1596
1599
|
*/
|
|
1597
1600
|
parseInputValueDef() {
|
|
1598
|
-
const
|
|
1601
|
+
const t = this._lexer.token, n = this.parseDescription(), r = this.parseName();
|
|
1599
1602
|
this.expectToken(a.COLON);
|
|
1600
|
-
const
|
|
1603
|
+
const i = this.parseTypeReference();
|
|
1601
1604
|
let s;
|
|
1602
1605
|
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1603
1606
|
const o = this.parseConstDirectives();
|
|
1604
|
-
return this.node(
|
|
1607
|
+
return this.node(t, {
|
|
1605
1608
|
kind: c.INPUT_VALUE_DEFINITION,
|
|
1606
1609
|
description: n,
|
|
1607
|
-
name:
|
|
1608
|
-
type:
|
|
1610
|
+
name: r,
|
|
1611
|
+
type: i,
|
|
1609
1612
|
defaultValue: s,
|
|
1610
1613
|
directives: o
|
|
1611
1614
|
});
|
|
@@ -1615,14 +1618,14 @@ class nt {
|
|
|
1615
1618
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1616
1619
|
*/
|
|
1617
1620
|
parseInterfaceTypeDefinition() {
|
|
1618
|
-
const
|
|
1621
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1619
1622
|
this.expectKeyword("interface");
|
|
1620
|
-
const
|
|
1621
|
-
return this.node(
|
|
1623
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1624
|
+
return this.node(t, {
|
|
1622
1625
|
kind: c.INTERFACE_TYPE_DEFINITION,
|
|
1623
1626
|
description: n,
|
|
1624
|
-
name:
|
|
1625
|
-
interfaces:
|
|
1627
|
+
name: r,
|
|
1628
|
+
interfaces: i,
|
|
1626
1629
|
directives: s,
|
|
1627
1630
|
fields: o
|
|
1628
1631
|
});
|
|
@@ -1632,14 +1635,14 @@ class nt {
|
|
|
1632
1635
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1633
1636
|
*/
|
|
1634
1637
|
parseUnionTypeDefinition() {
|
|
1635
|
-
const
|
|
1638
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1636
1639
|
this.expectKeyword("union");
|
|
1637
|
-
const
|
|
1638
|
-
return this.node(
|
|
1640
|
+
const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1641
|
+
return this.node(t, {
|
|
1639
1642
|
kind: c.UNION_TYPE_DEFINITION,
|
|
1640
1643
|
description: n,
|
|
1641
|
-
name:
|
|
1642
|
-
directives:
|
|
1644
|
+
name: r,
|
|
1645
|
+
directives: i,
|
|
1643
1646
|
types: s
|
|
1644
1647
|
});
|
|
1645
1648
|
}
|
|
@@ -1656,14 +1659,14 @@ class nt {
|
|
|
1656
1659
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1657
1660
|
*/
|
|
1658
1661
|
parseEnumTypeDefinition() {
|
|
1659
|
-
const
|
|
1662
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1660
1663
|
this.expectKeyword("enum");
|
|
1661
|
-
const
|
|
1662
|
-
return this.node(
|
|
1664
|
+
const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1665
|
+
return this.node(t, {
|
|
1663
1666
|
kind: c.ENUM_TYPE_DEFINITION,
|
|
1664
1667
|
description: n,
|
|
1665
|
-
name:
|
|
1666
|
-
directives:
|
|
1668
|
+
name: r,
|
|
1669
|
+
directives: i,
|
|
1667
1670
|
values: s
|
|
1668
1671
|
});
|
|
1669
1672
|
}
|
|
@@ -1683,12 +1686,12 @@ class nt {
|
|
|
1683
1686
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1684
1687
|
*/
|
|
1685
1688
|
parseEnumValueDefinition() {
|
|
1686
|
-
const
|
|
1687
|
-
return this.node(
|
|
1689
|
+
const t = this._lexer.token, n = this.parseDescription(), r = this.parseEnumValueName(), i = this.parseConstDirectives();
|
|
1690
|
+
return this.node(t, {
|
|
1688
1691
|
kind: c.ENUM_VALUE_DEFINITION,
|
|
1689
1692
|
description: n,
|
|
1690
|
-
name:
|
|
1691
|
-
directives:
|
|
1693
|
+
name: r,
|
|
1694
|
+
directives: i
|
|
1692
1695
|
});
|
|
1693
1696
|
}
|
|
1694
1697
|
/**
|
|
@@ -1699,7 +1702,7 @@ class nt {
|
|
|
1699
1702
|
throw I(
|
|
1700
1703
|
this._lexer.source,
|
|
1701
1704
|
this._lexer.token.start,
|
|
1702
|
-
`${
|
|
1705
|
+
`${C(
|
|
1703
1706
|
this._lexer.token
|
|
1704
1707
|
)} is reserved and cannot be used for an enum value.`
|
|
1705
1708
|
);
|
|
@@ -1710,14 +1713,14 @@ class nt {
|
|
|
1710
1713
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1711
1714
|
*/
|
|
1712
1715
|
parseInputObjectTypeDefinition() {
|
|
1713
|
-
const
|
|
1716
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1714
1717
|
this.expectKeyword("input");
|
|
1715
|
-
const
|
|
1716
|
-
return this.node(
|
|
1718
|
+
const r = this.parseName(), i = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1719
|
+
return this.node(t, {
|
|
1717
1720
|
kind: c.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1718
1721
|
description: n,
|
|
1719
|
-
name:
|
|
1720
|
-
directives:
|
|
1722
|
+
name: r,
|
|
1723
|
+
directives: i,
|
|
1721
1724
|
fields: s
|
|
1722
1725
|
});
|
|
1723
1726
|
}
|
|
@@ -1747,9 +1750,9 @@ class nt {
|
|
|
1747
1750
|
* - InputObjectTypeDefinition
|
|
1748
1751
|
*/
|
|
1749
1752
|
parseTypeSystemExtension() {
|
|
1750
|
-
const
|
|
1751
|
-
if (
|
|
1752
|
-
switch (
|
|
1753
|
+
const t = this._lexer.lookahead();
|
|
1754
|
+
if (t.kind === a.NAME)
|
|
1755
|
+
switch (t.value) {
|
|
1753
1756
|
case "schema":
|
|
1754
1757
|
return this.parseSchemaExtension();
|
|
1755
1758
|
case "scalar":
|
|
@@ -1765,7 +1768,7 @@ class nt {
|
|
|
1765
1768
|
case "input":
|
|
1766
1769
|
return this.parseInputObjectTypeExtension();
|
|
1767
1770
|
}
|
|
1768
|
-
throw this.unexpected(
|
|
1771
|
+
throw this.unexpected(t);
|
|
1769
1772
|
}
|
|
1770
1773
|
/**
|
|
1771
1774
|
* ```
|
|
@@ -1775,19 +1778,19 @@ class nt {
|
|
|
1775
1778
|
* ```
|
|
1776
1779
|
*/
|
|
1777
1780
|
parseSchemaExtension() {
|
|
1778
|
-
const
|
|
1781
|
+
const t = this._lexer.token;
|
|
1779
1782
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1780
|
-
const n = this.parseConstDirectives(),
|
|
1783
|
+
const n = this.parseConstDirectives(), r = this.optionalMany(
|
|
1781
1784
|
a.BRACE_L,
|
|
1782
1785
|
this.parseOperationTypeDefinition,
|
|
1783
1786
|
a.BRACE_R
|
|
1784
1787
|
);
|
|
1785
|
-
if (n.length === 0 &&
|
|
1788
|
+
if (n.length === 0 && r.length === 0)
|
|
1786
1789
|
throw this.unexpected();
|
|
1787
|
-
return this.node(
|
|
1790
|
+
return this.node(t, {
|
|
1788
1791
|
kind: c.SCHEMA_EXTENSION,
|
|
1789
1792
|
directives: n,
|
|
1790
|
-
operationTypes:
|
|
1793
|
+
operationTypes: r
|
|
1791
1794
|
});
|
|
1792
1795
|
}
|
|
1793
1796
|
/**
|
|
@@ -1795,15 +1798,15 @@ class nt {
|
|
|
1795
1798
|
* - extend scalar Name Directives[Const]
|
|
1796
1799
|
*/
|
|
1797
1800
|
parseScalarTypeExtension() {
|
|
1798
|
-
const
|
|
1801
|
+
const t = this._lexer.token;
|
|
1799
1802
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1800
|
-
const n = this.parseName(),
|
|
1801
|
-
if (
|
|
1803
|
+
const n = this.parseName(), r = this.parseConstDirectives();
|
|
1804
|
+
if (r.length === 0)
|
|
1802
1805
|
throw this.unexpected();
|
|
1803
|
-
return this.node(
|
|
1806
|
+
return this.node(t, {
|
|
1804
1807
|
kind: c.SCALAR_TYPE_EXTENSION,
|
|
1805
1808
|
name: n,
|
|
1806
|
-
directives:
|
|
1809
|
+
directives: r
|
|
1807
1810
|
});
|
|
1808
1811
|
}
|
|
1809
1812
|
/**
|
|
@@ -1813,16 +1816,16 @@ class nt {
|
|
|
1813
1816
|
* - extend type Name ImplementsInterfaces
|
|
1814
1817
|
*/
|
|
1815
1818
|
parseObjectTypeExtension() {
|
|
1816
|
-
const
|
|
1819
|
+
const t = this._lexer.token;
|
|
1817
1820
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1818
|
-
const n = this.parseName(),
|
|
1819
|
-
if (
|
|
1821
|
+
const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1822
|
+
if (r.length === 0 && i.length === 0 && s.length === 0)
|
|
1820
1823
|
throw this.unexpected();
|
|
1821
|
-
return this.node(
|
|
1824
|
+
return this.node(t, {
|
|
1822
1825
|
kind: c.OBJECT_TYPE_EXTENSION,
|
|
1823
1826
|
name: n,
|
|
1824
|
-
interfaces:
|
|
1825
|
-
directives:
|
|
1827
|
+
interfaces: r,
|
|
1828
|
+
directives: i,
|
|
1826
1829
|
fields: s
|
|
1827
1830
|
});
|
|
1828
1831
|
}
|
|
@@ -1833,16 +1836,16 @@ class nt {
|
|
|
1833
1836
|
* - extend interface Name ImplementsInterfaces
|
|
1834
1837
|
*/
|
|
1835
1838
|
parseInterfaceTypeExtension() {
|
|
1836
|
-
const
|
|
1839
|
+
const t = this._lexer.token;
|
|
1837
1840
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1838
|
-
const n = this.parseName(),
|
|
1839
|
-
if (
|
|
1841
|
+
const n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1842
|
+
if (r.length === 0 && i.length === 0 && s.length === 0)
|
|
1840
1843
|
throw this.unexpected();
|
|
1841
|
-
return this.node(
|
|
1844
|
+
return this.node(t, {
|
|
1842
1845
|
kind: c.INTERFACE_TYPE_EXTENSION,
|
|
1843
1846
|
name: n,
|
|
1844
|
-
interfaces:
|
|
1845
|
-
directives:
|
|
1847
|
+
interfaces: r,
|
|
1848
|
+
directives: i,
|
|
1846
1849
|
fields: s
|
|
1847
1850
|
});
|
|
1848
1851
|
}
|
|
@@ -1852,16 +1855,16 @@ class nt {
|
|
|
1852
1855
|
* - extend union Name Directives[Const]
|
|
1853
1856
|
*/
|
|
1854
1857
|
parseUnionTypeExtension() {
|
|
1855
|
-
const
|
|
1858
|
+
const t = this._lexer.token;
|
|
1856
1859
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1857
|
-
const n = this.parseName(),
|
|
1858
|
-
if (
|
|
1860
|
+
const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes();
|
|
1861
|
+
if (r.length === 0 && i.length === 0)
|
|
1859
1862
|
throw this.unexpected();
|
|
1860
|
-
return this.node(
|
|
1863
|
+
return this.node(t, {
|
|
1861
1864
|
kind: c.UNION_TYPE_EXTENSION,
|
|
1862
1865
|
name: n,
|
|
1863
|
-
directives:
|
|
1864
|
-
types:
|
|
1866
|
+
directives: r,
|
|
1867
|
+
types: i
|
|
1865
1868
|
});
|
|
1866
1869
|
}
|
|
1867
1870
|
/**
|
|
@@ -1870,16 +1873,16 @@ class nt {
|
|
|
1870
1873
|
* - extend enum Name Directives[Const]
|
|
1871
1874
|
*/
|
|
1872
1875
|
parseEnumTypeExtension() {
|
|
1873
|
-
const
|
|
1876
|
+
const t = this._lexer.token;
|
|
1874
1877
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1875
|
-
const n = this.parseName(),
|
|
1876
|
-
if (
|
|
1878
|
+
const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition();
|
|
1879
|
+
if (r.length === 0 && i.length === 0)
|
|
1877
1880
|
throw this.unexpected();
|
|
1878
|
-
return this.node(
|
|
1881
|
+
return this.node(t, {
|
|
1879
1882
|
kind: c.ENUM_TYPE_EXTENSION,
|
|
1880
1883
|
name: n,
|
|
1881
|
-
directives:
|
|
1882
|
-
values:
|
|
1884
|
+
directives: r,
|
|
1885
|
+
values: i
|
|
1883
1886
|
});
|
|
1884
1887
|
}
|
|
1885
1888
|
/**
|
|
@@ -1888,16 +1891,16 @@ class nt {
|
|
|
1888
1891
|
* - extend input Name Directives[Const]
|
|
1889
1892
|
*/
|
|
1890
1893
|
parseInputObjectTypeExtension() {
|
|
1891
|
-
const
|
|
1894
|
+
const t = this._lexer.token;
|
|
1892
1895
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1893
|
-
const n = this.parseName(),
|
|
1894
|
-
if (
|
|
1896
|
+
const n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition();
|
|
1897
|
+
if (r.length === 0 && i.length === 0)
|
|
1895
1898
|
throw this.unexpected();
|
|
1896
|
-
return this.node(
|
|
1899
|
+
return this.node(t, {
|
|
1897
1900
|
kind: c.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1898
1901
|
name: n,
|
|
1899
|
-
directives:
|
|
1900
|
-
fields:
|
|
1902
|
+
directives: r,
|
|
1903
|
+
fields: i
|
|
1901
1904
|
});
|
|
1902
1905
|
}
|
|
1903
1906
|
/**
|
|
@@ -1907,16 +1910,16 @@ class nt {
|
|
|
1907
1910
|
* ```
|
|
1908
1911
|
*/
|
|
1909
1912
|
parseDirectiveDefinition() {
|
|
1910
|
-
const
|
|
1913
|
+
const t = this._lexer.token, n = this.parseDescription();
|
|
1911
1914
|
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1912
|
-
const
|
|
1915
|
+
const r = this.parseName(), i = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1913
1916
|
this.expectKeyword("on");
|
|
1914
1917
|
const o = this.parseDirectiveLocations();
|
|
1915
|
-
return this.node(
|
|
1918
|
+
return this.node(t, {
|
|
1916
1919
|
kind: c.DIRECTIVE_DEFINITION,
|
|
1917
1920
|
description: n,
|
|
1918
|
-
name:
|
|
1919
|
-
arguments:
|
|
1921
|
+
name: r,
|
|
1922
|
+
arguments: i,
|
|
1920
1923
|
repeatable: s,
|
|
1921
1924
|
locations: o
|
|
1922
1925
|
});
|
|
@@ -1957,10 +1960,10 @@ class nt {
|
|
|
1957
1960
|
* `INPUT_FIELD_DEFINITION`
|
|
1958
1961
|
*/
|
|
1959
1962
|
parseDirectiveLocation() {
|
|
1960
|
-
const
|
|
1963
|
+
const t = this._lexer.token, n = this.parseName();
|
|
1961
1964
|
if (Object.prototype.hasOwnProperty.call(q, n.value))
|
|
1962
1965
|
return n;
|
|
1963
|
-
throw this.unexpected(
|
|
1966
|
+
throw this.unexpected(t);
|
|
1964
1967
|
}
|
|
1965
1968
|
// Schema Coordinates
|
|
1966
1969
|
/**
|
|
@@ -1972,29 +1975,29 @@ class nt {
|
|
|
1972
1975
|
* - \@ Name ( Name : )
|
|
1973
1976
|
*/
|
|
1974
1977
|
parseSchemaCoordinate() {
|
|
1975
|
-
const
|
|
1976
|
-
let
|
|
1977
|
-
!n && this.expectOptionalToken(a.DOT) && (
|
|
1978
|
+
const t = this._lexer.token, n = this.expectOptionalToken(a.AT), r = this.parseName();
|
|
1979
|
+
let i;
|
|
1980
|
+
!n && this.expectOptionalToken(a.DOT) && (i = this.parseName());
|
|
1978
1981
|
let s;
|
|
1979
|
-
return (n ||
|
|
1982
|
+
return (n || i) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), n ? s ? this.node(t, {
|
|
1980
1983
|
kind: c.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1981
|
-
name:
|
|
1984
|
+
name: r,
|
|
1982
1985
|
argumentName: s
|
|
1983
|
-
}) : this.node(
|
|
1986
|
+
}) : this.node(t, {
|
|
1984
1987
|
kind: c.DIRECTIVE_COORDINATE,
|
|
1985
|
-
name:
|
|
1986
|
-
}) :
|
|
1988
|
+
name: r
|
|
1989
|
+
}) : i ? s ? this.node(t, {
|
|
1987
1990
|
kind: c.ARGUMENT_COORDINATE,
|
|
1988
|
-
name:
|
|
1989
|
-
fieldName:
|
|
1991
|
+
name: r,
|
|
1992
|
+
fieldName: i,
|
|
1990
1993
|
argumentName: s
|
|
1991
|
-
}) : this.node(
|
|
1994
|
+
}) : this.node(t, {
|
|
1992
1995
|
kind: c.MEMBER_COORDINATE,
|
|
1993
|
-
name:
|
|
1994
|
-
memberName:
|
|
1995
|
-
}) : this.node(
|
|
1996
|
+
name: r,
|
|
1997
|
+
memberName: i
|
|
1998
|
+
}) : this.node(t, {
|
|
1996
1999
|
kind: c.TYPE_COORDINATE,
|
|
1997
|
-
name:
|
|
2000
|
+
name: r
|
|
1998
2001
|
});
|
|
1999
2002
|
}
|
|
2000
2003
|
// Core parsing utility functions
|
|
@@ -2003,9 +2006,9 @@ class nt {
|
|
|
2003
2006
|
* location object, used to identify the place in the source that created a
|
|
2004
2007
|
* given parsed object.
|
|
2005
2008
|
*/
|
|
2006
|
-
node(
|
|
2007
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
2008
|
-
|
|
2009
|
+
node(t, n) {
|
|
2010
|
+
return this._options.noLocation !== !0 && (n.loc = new Ce(
|
|
2011
|
+
t,
|
|
2009
2012
|
this._lexer.lastToken,
|
|
2010
2013
|
this._lexer.source
|
|
2011
2014
|
)), n;
|
|
@@ -2013,62 +2016,62 @@ class nt {
|
|
|
2013
2016
|
/**
|
|
2014
2017
|
* Determines if the next token is of a given kind
|
|
2015
2018
|
*/
|
|
2016
|
-
peek(
|
|
2017
|
-
return this._lexer.token.kind ===
|
|
2019
|
+
peek(t) {
|
|
2020
|
+
return this._lexer.token.kind === t;
|
|
2018
2021
|
}
|
|
2019
2022
|
/**
|
|
2020
2023
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2021
2024
|
* Otherwise, do not change the parser state and throw an error.
|
|
2022
2025
|
*/
|
|
2023
|
-
expectToken(
|
|
2026
|
+
expectToken(t) {
|
|
2024
2027
|
const n = this._lexer.token;
|
|
2025
|
-
if (n.kind ===
|
|
2028
|
+
if (n.kind === t)
|
|
2026
2029
|
return this.advanceLexer(), n;
|
|
2027
2030
|
throw I(
|
|
2028
2031
|
this._lexer.source,
|
|
2029
2032
|
n.start,
|
|
2030
|
-
`Expected ${
|
|
2033
|
+
`Expected ${ke(t)}, found ${C(n)}.`
|
|
2031
2034
|
);
|
|
2032
2035
|
}
|
|
2033
2036
|
/**
|
|
2034
2037
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2035
2038
|
* Otherwise, do not change the parser state and return "false".
|
|
2036
2039
|
*/
|
|
2037
|
-
expectOptionalToken(
|
|
2038
|
-
return this._lexer.token.kind ===
|
|
2040
|
+
expectOptionalToken(t) {
|
|
2041
|
+
return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
|
|
2039
2042
|
}
|
|
2040
2043
|
/**
|
|
2041
2044
|
* If the next token is a given keyword, advance the lexer.
|
|
2042
2045
|
* Otherwise, do not change the parser state and throw an error.
|
|
2043
2046
|
*/
|
|
2044
|
-
expectKeyword(
|
|
2047
|
+
expectKeyword(t) {
|
|
2045
2048
|
const n = this._lexer.token;
|
|
2046
|
-
if (n.kind === a.NAME && n.value ===
|
|
2049
|
+
if (n.kind === a.NAME && n.value === t)
|
|
2047
2050
|
this.advanceLexer();
|
|
2048
2051
|
else
|
|
2049
2052
|
throw I(
|
|
2050
2053
|
this._lexer.source,
|
|
2051
2054
|
n.start,
|
|
2052
|
-
`Expected "${
|
|
2055
|
+
`Expected "${t}", found ${C(n)}.`
|
|
2053
2056
|
);
|
|
2054
2057
|
}
|
|
2055
2058
|
/**
|
|
2056
2059
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2057
2060
|
* Otherwise, do not change the parser state and return "false".
|
|
2058
2061
|
*/
|
|
2059
|
-
expectOptionalKeyword(
|
|
2062
|
+
expectOptionalKeyword(t) {
|
|
2060
2063
|
const n = this._lexer.token;
|
|
2061
|
-
return n.kind === a.NAME && n.value ===
|
|
2064
|
+
return n.kind === a.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
|
|
2062
2065
|
}
|
|
2063
2066
|
/**
|
|
2064
2067
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2065
2068
|
*/
|
|
2066
|
-
unexpected(
|
|
2067
|
-
const n =
|
|
2069
|
+
unexpected(t) {
|
|
2070
|
+
const n = t ?? this._lexer.token;
|
|
2068
2071
|
return I(
|
|
2069
2072
|
this._lexer.source,
|
|
2070
2073
|
n.start,
|
|
2071
|
-
`Unexpected ${
|
|
2074
|
+
`Unexpected ${C(n)}.`
|
|
2072
2075
|
);
|
|
2073
2076
|
}
|
|
2074
2077
|
/**
|
|
@@ -2076,12 +2079,12 @@ class nt {
|
|
|
2076
2079
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2077
2080
|
* Advances the parser to the next lex token after the closing token.
|
|
2078
2081
|
*/
|
|
2079
|
-
any(
|
|
2080
|
-
this.expectToken(
|
|
2081
|
-
const
|
|
2082
|
-
for (; !this.expectOptionalToken(
|
|
2083
|
-
|
|
2084
|
-
return
|
|
2082
|
+
any(t, n, r) {
|
|
2083
|
+
this.expectToken(t);
|
|
2084
|
+
const i = [];
|
|
2085
|
+
for (; !this.expectOptionalToken(r); )
|
|
2086
|
+
i.push(n.call(this));
|
|
2087
|
+
return i;
|
|
2085
2088
|
}
|
|
2086
2089
|
/**
|
|
2087
2090
|
* Returns a list of parse nodes, determined by the parseFn.
|
|
@@ -2089,13 +2092,13 @@ class nt {
|
|
|
2089
2092
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2090
2093
|
* Advances the parser to the next lex token after the closing token.
|
|
2091
2094
|
*/
|
|
2092
|
-
optionalMany(
|
|
2093
|
-
if (this.expectOptionalToken(
|
|
2094
|
-
const
|
|
2095
|
+
optionalMany(t, n, r) {
|
|
2096
|
+
if (this.expectOptionalToken(t)) {
|
|
2097
|
+
const i = [];
|
|
2095
2098
|
do
|
|
2096
|
-
|
|
2097
|
-
while (!this.expectOptionalToken(
|
|
2098
|
-
return
|
|
2099
|
+
i.push(n.call(this));
|
|
2100
|
+
while (!this.expectOptionalToken(r));
|
|
2101
|
+
return i;
|
|
2099
2102
|
}
|
|
2100
2103
|
return [];
|
|
2101
2104
|
}
|
|
@@ -2104,120 +2107,120 @@ class nt {
|
|
|
2104
2107
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2105
2108
|
* Advances the parser to the next lex token after the closing token.
|
|
2106
2109
|
*/
|
|
2107
|
-
many(
|
|
2108
|
-
this.expectToken(
|
|
2109
|
-
const
|
|
2110
|
+
many(t, n, r) {
|
|
2111
|
+
this.expectToken(t);
|
|
2112
|
+
const i = [];
|
|
2110
2113
|
do
|
|
2111
|
-
|
|
2112
|
-
while (!this.expectOptionalToken(
|
|
2113
|
-
return
|
|
2114
|
+
i.push(n.call(this));
|
|
2115
|
+
while (!this.expectOptionalToken(r));
|
|
2116
|
+
return i;
|
|
2114
2117
|
}
|
|
2115
2118
|
/**
|
|
2116
2119
|
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2117
2120
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2118
2121
|
* Advances the parser to the next lex token after last item in the list.
|
|
2119
2122
|
*/
|
|
2120
|
-
delimitedMany(
|
|
2121
|
-
this.expectOptionalToken(
|
|
2122
|
-
const
|
|
2123
|
+
delimitedMany(t, n) {
|
|
2124
|
+
this.expectOptionalToken(t);
|
|
2125
|
+
const r = [];
|
|
2123
2126
|
do
|
|
2124
|
-
|
|
2125
|
-
while (this.expectOptionalToken(
|
|
2126
|
-
return
|
|
2127
|
+
r.push(n.call(this));
|
|
2128
|
+
while (this.expectOptionalToken(t));
|
|
2129
|
+
return r;
|
|
2127
2130
|
}
|
|
2128
2131
|
advanceLexer() {
|
|
2129
|
-
const { maxTokens:
|
|
2130
|
-
if (n.kind !== a.EOF && (++this._tokenCounter,
|
|
2132
|
+
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
2133
|
+
if (n.kind !== a.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
|
|
2131
2134
|
throw I(
|
|
2132
2135
|
this._lexer.source,
|
|
2133
2136
|
n.start,
|
|
2134
|
-
`Document contains more that ${
|
|
2137
|
+
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
2135
2138
|
);
|
|
2136
2139
|
}
|
|
2137
2140
|
}
|
|
2138
|
-
function
|
|
2139
|
-
const
|
|
2140
|
-
return
|
|
2141
|
+
function C(e) {
|
|
2142
|
+
const t = e.value;
|
|
2143
|
+
return ke(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2141
2144
|
}
|
|
2142
|
-
function
|
|
2143
|
-
return
|
|
2145
|
+
function ke(e) {
|
|
2146
|
+
return Ue(e) ? `"${e}"` : e;
|
|
2144
2147
|
}
|
|
2145
|
-
var L = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(),
|
|
2146
|
-
function
|
|
2147
|
-
return
|
|
2148
|
+
var L = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), Ae = !0, $ = !1;
|
|
2149
|
+
function Te(e) {
|
|
2150
|
+
return e.replace(/[\s,]+/g, " ").trim();
|
|
2148
2151
|
}
|
|
2149
|
-
function
|
|
2150
|
-
return
|
|
2152
|
+
function at(e) {
|
|
2153
|
+
return Te(e.source.body.substring(e.start, e.end));
|
|
2151
2154
|
}
|
|
2152
|
-
function
|
|
2153
|
-
var
|
|
2154
|
-
return
|
|
2155
|
-
if (
|
|
2156
|
-
var
|
|
2157
|
-
o && !o.has(s) ?
|
|
2155
|
+
function ot(e) {
|
|
2156
|
+
var t = /* @__PURE__ */ new Set(), n = [];
|
|
2157
|
+
return e.definitions.forEach(function(r) {
|
|
2158
|
+
if (r.kind === "FragmentDefinition") {
|
|
2159
|
+
var i = r.name.value, s = at(r.loc), o = G.get(i);
|
|
2160
|
+
o && !o.has(s) ? Ae && console.warn("Warning: fragment with name " + i + ` already exists.
|
|
2158
2161
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2159
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(
|
|
2162
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(i, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(r));
|
|
2160
2163
|
} else
|
|
2161
|
-
n.push(
|
|
2162
|
-
}), w(w({},
|
|
2163
|
-
}
|
|
2164
|
-
function
|
|
2165
|
-
var
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
var s = i
|
|
2169
|
-
s && typeof s == "object" &&
|
|
2164
|
+
n.push(r);
|
|
2165
|
+
}), w(w({}, e), { definitions: n });
|
|
2166
|
+
}
|
|
2167
|
+
function ct(e) {
|
|
2168
|
+
var t = new Set(e.definitions);
|
|
2169
|
+
t.forEach(function(r) {
|
|
2170
|
+
r.loc && delete r.loc, Object.keys(r).forEach(function(i) {
|
|
2171
|
+
var s = r[i];
|
|
2172
|
+
s && typeof s == "object" && t.add(s);
|
|
2170
2173
|
});
|
|
2171
2174
|
});
|
|
2172
|
-
var n =
|
|
2173
|
-
return n && (delete n.startToken, delete n.endToken),
|
|
2175
|
+
var n = e.loc;
|
|
2176
|
+
return n && (delete n.startToken, delete n.endToken), e;
|
|
2174
2177
|
}
|
|
2175
|
-
function
|
|
2176
|
-
var
|
|
2177
|
-
if (!L.has(
|
|
2178
|
-
var n =
|
|
2178
|
+
function dt(e) {
|
|
2179
|
+
var t = Te(e);
|
|
2180
|
+
if (!L.has(t)) {
|
|
2181
|
+
var n = it(e, {
|
|
2179
2182
|
experimentalFragmentVariables: $,
|
|
2180
2183
|
allowLegacyFragmentVariables: $
|
|
2181
2184
|
});
|
|
2182
2185
|
if (!n || n.kind !== "Document")
|
|
2183
2186
|
throw new Error("Not a valid GraphQL document.");
|
|
2184
|
-
L.set(
|
|
2187
|
+
L.set(t, ct(ot(n)));
|
|
2185
2188
|
}
|
|
2186
|
-
return L.get(
|
|
2189
|
+
return L.get(t);
|
|
2187
2190
|
}
|
|
2188
|
-
function u(
|
|
2189
|
-
for (var
|
|
2190
|
-
|
|
2191
|
-
typeof
|
|
2192
|
-
var
|
|
2193
|
-
return
|
|
2194
|
-
|
|
2195
|
-
}),
|
|
2191
|
+
function u(e) {
|
|
2192
|
+
for (var t = [], n = 1; n < arguments.length; n++)
|
|
2193
|
+
t[n - 1] = arguments[n];
|
|
2194
|
+
typeof e == "string" && (e = [e]);
|
|
2195
|
+
var r = e[0];
|
|
2196
|
+
return t.forEach(function(i, s) {
|
|
2197
|
+
i && i.kind === "Document" ? r += i.loc.source.body : r += i, r += e[s + 1];
|
|
2198
|
+
}), dt(r);
|
|
2196
2199
|
}
|
|
2197
|
-
function
|
|
2200
|
+
function ut() {
|
|
2198
2201
|
L.clear(), G.clear();
|
|
2199
2202
|
}
|
|
2200
|
-
function
|
|
2201
|
-
|
|
2203
|
+
function lt() {
|
|
2204
|
+
Ae = !1;
|
|
2202
2205
|
}
|
|
2203
|
-
function
|
|
2206
|
+
function ht() {
|
|
2204
2207
|
$ = !0;
|
|
2205
2208
|
}
|
|
2206
|
-
function
|
|
2209
|
+
function pt() {
|
|
2207
2210
|
$ = !1;
|
|
2208
2211
|
}
|
|
2209
2212
|
var b = {
|
|
2210
2213
|
gql: u,
|
|
2211
|
-
resetCaches:
|
|
2212
|
-
disableFragmentWarnings:
|
|
2213
|
-
enableExperimentalFragmentVariables:
|
|
2214
|
-
disableExperimentalFragmentVariables:
|
|
2214
|
+
resetCaches: ut,
|
|
2215
|
+
disableFragmentWarnings: lt,
|
|
2216
|
+
enableExperimentalFragmentVariables: ht,
|
|
2217
|
+
disableExperimentalFragmentVariables: pt
|
|
2215
2218
|
};
|
|
2216
|
-
(function(
|
|
2217
|
-
|
|
2219
|
+
(function(e) {
|
|
2220
|
+
e.gql = b.gql, e.resetCaches = b.resetCaches, e.disableFragmentWarnings = b.disableFragmentWarnings, e.enableExperimentalFragmentVariables = b.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = b.disableExperimentalFragmentVariables;
|
|
2218
2221
|
})(u || (u = {}));
|
|
2219
2222
|
u.default = u;
|
|
2220
|
-
const
|
|
2223
|
+
const gt = u`
|
|
2221
2224
|
query findActiveOrderById($id: String) {
|
|
2222
2225
|
findOrder(id: $id) {
|
|
2223
2226
|
id
|
|
@@ -2304,7 +2307,7 @@ const lt = u`
|
|
|
2304
2307
|
}
|
|
2305
2308
|
}
|
|
2306
2309
|
}
|
|
2307
|
-
`,
|
|
2310
|
+
`, mt = u`
|
|
2308
2311
|
query findOrderById($id: String, $reference: String) {
|
|
2309
2312
|
findOrder(id: $id, reference: $reference) {
|
|
2310
2313
|
id
|
|
@@ -2348,7 +2351,7 @@ const lt = u`
|
|
|
2348
2351
|
downloadCode
|
|
2349
2352
|
}
|
|
2350
2353
|
}
|
|
2351
|
-
`,
|
|
2354
|
+
`, ft = u`
|
|
2352
2355
|
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2353
2356
|
reserveProduct(
|
|
2354
2357
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
@@ -2358,7 +2361,7 @@ const lt = u`
|
|
|
2358
2361
|
amountReserved
|
|
2359
2362
|
}
|
|
2360
2363
|
}
|
|
2361
|
-
`,
|
|
2364
|
+
`, It = u`
|
|
2362
2365
|
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2363
2366
|
releaseProduct(
|
|
2364
2367
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
@@ -2367,7 +2370,7 @@ const lt = u`
|
|
|
2367
2370
|
amountReleased
|
|
2368
2371
|
}
|
|
2369
2372
|
}
|
|
2370
|
-
`,
|
|
2373
|
+
`, Et = u`
|
|
2371
2374
|
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
|
|
2372
2375
|
configurePackage(
|
|
2373
2376
|
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
@@ -2377,7 +2380,7 @@ const lt = u`
|
|
|
2377
2380
|
amountReserved
|
|
2378
2381
|
}
|
|
2379
2382
|
}
|
|
2380
|
-
`,
|
|
2383
|
+
`, yt = u`
|
|
2381
2384
|
mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
|
|
2382
2385
|
reserveAdditionalPackageItem(
|
|
2383
2386
|
input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
|
|
@@ -2387,69 +2390,69 @@ const lt = u`
|
|
|
2387
2390
|
amountReserved
|
|
2388
2391
|
}
|
|
2389
2392
|
}
|
|
2390
|
-
`,
|
|
2393
|
+
`, Ot = u`
|
|
2391
2394
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2392
2395
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2393
2396
|
}
|
|
2394
|
-
`,
|
|
2397
|
+
`, kt = u`
|
|
2395
2398
|
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2396
2399
|
createOrderCustomer(
|
|
2397
2400
|
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2398
2401
|
)
|
|
2399
2402
|
}
|
|
2400
|
-
`,
|
|
2403
|
+
`, At = u`
|
|
2401
2404
|
mutation deleteOrder($orderId: ID!) {
|
|
2402
2405
|
cancelOrder(id: $orderId)
|
|
2403
2406
|
}
|
|
2404
|
-
`,
|
|
2405
|
-
function
|
|
2407
|
+
`, Tt = (e, t, n, r) => e();
|
|
2408
|
+
function Nt(e, t = Tt) {
|
|
2406
2409
|
return {
|
|
2407
|
-
findActiveOrderById(n,
|
|
2408
|
-
return
|
|
2410
|
+
findActiveOrderById(n, r, i) {
|
|
2411
|
+
return t((s) => e.request({ document: gt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findActiveOrderById", "query", n);
|
|
2409
2412
|
},
|
|
2410
|
-
findOrderById(n,
|
|
2411
|
-
return
|
|
2413
|
+
findOrderById(n, r, i) {
|
|
2414
|
+
return t((s) => e.request({ document: mt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findOrderById", "query", n);
|
|
2412
2415
|
},
|
|
2413
|
-
addToOrder(n,
|
|
2414
|
-
return
|
|
2416
|
+
addToOrder(n, r, i) {
|
|
2417
|
+
return t((s) => e.request({ document: ft, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "addToOrder", "mutation", n);
|
|
2415
2418
|
},
|
|
2416
|
-
removeFromOrder(n,
|
|
2417
|
-
return
|
|
2419
|
+
removeFromOrder(n, r, i) {
|
|
2420
|
+
return t((s) => e.request({ document: It, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "removeFromOrder", "mutation", n);
|
|
2418
2421
|
},
|
|
2419
|
-
configurePackage(n,
|
|
2420
|
-
return
|
|
2422
|
+
configurePackage(n, r, i) {
|
|
2423
|
+
return t((s) => e.request({ document: Et, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configurePackage", "mutation", n);
|
|
2421
2424
|
},
|
|
2422
|
-
reserveAdditionalPackageItem(n,
|
|
2423
|
-
return
|
|
2425
|
+
reserveAdditionalPackageItem(n, r, i) {
|
|
2426
|
+
return t((s) => e.request({ document: yt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "reserveAdditionalPackageItem", "mutation", n);
|
|
2424
2427
|
},
|
|
2425
|
-
configureOrderDeliveryOption(n,
|
|
2426
|
-
return
|
|
2428
|
+
configureOrderDeliveryOption(n, r, i) {
|
|
2429
|
+
return t((s) => e.request({ document: Ot, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configureOrderDeliveryOption", "mutation", n);
|
|
2427
2430
|
},
|
|
2428
|
-
createOrderCustomer(n,
|
|
2429
|
-
return
|
|
2431
|
+
createOrderCustomer(n, r, i) {
|
|
2432
|
+
return t((s) => e.request({ document: kt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createOrderCustomer", "mutation", n);
|
|
2430
2433
|
},
|
|
2431
|
-
deleteOrder(n,
|
|
2432
|
-
return
|
|
2434
|
+
deleteOrder(n, r, i) {
|
|
2435
|
+
return t((s) => e.request({ document: At, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "deleteOrder", "mutation", n);
|
|
2433
2436
|
}
|
|
2434
2437
|
};
|
|
2435
2438
|
}
|
|
2436
|
-
class
|
|
2439
|
+
class Dt {
|
|
2437
2440
|
config;
|
|
2438
2441
|
sdk;
|
|
2439
|
-
constructor(
|
|
2440
|
-
this.config =
|
|
2442
|
+
constructor(t) {
|
|
2443
|
+
this.config = t, this.sdk = Nt(new T(t.apiUrl));
|
|
2441
2444
|
}
|
|
2442
2445
|
// Basket update functions
|
|
2443
|
-
async addProduct(
|
|
2446
|
+
async addProduct(t, n, r) {
|
|
2444
2447
|
try {
|
|
2445
2448
|
return this.debugLog("Adding product", {
|
|
2446
2449
|
productId: n.id,
|
|
2447
|
-
orderId:
|
|
2450
|
+
orderId: t,
|
|
2448
2451
|
amount: n.amount,
|
|
2449
2452
|
seat: n.seat
|
|
2450
2453
|
}), (await this.sdk.addToOrder({
|
|
2451
2454
|
productId: n.id,
|
|
2452
|
-
orderId:
|
|
2455
|
+
orderId: t,
|
|
2453
2456
|
additionalData: n.seat ? {
|
|
2454
2457
|
seat: {
|
|
2455
2458
|
seatId: n.seat.id,
|
|
@@ -2458,22 +2461,22 @@ class At {
|
|
|
2458
2461
|
}
|
|
2459
2462
|
} : null,
|
|
2460
2463
|
trackerId: this.config.trackerId,
|
|
2461
|
-
shopId:
|
|
2464
|
+
shopId: r,
|
|
2462
2465
|
amount: n.amount
|
|
2463
2466
|
})).reserveProduct;
|
|
2464
|
-
} catch (
|
|
2465
|
-
throw this.debugLog("Error adding product",
|
|
2467
|
+
} catch (i) {
|
|
2468
|
+
throw this.debugLog("Error adding product", i), this.handleError(i), i;
|
|
2466
2469
|
}
|
|
2467
2470
|
}
|
|
2468
|
-
async removeProduct(
|
|
2471
|
+
async removeProduct(t, n) {
|
|
2469
2472
|
try {
|
|
2470
2473
|
return this.debugLog("Removing product", {
|
|
2471
2474
|
productId: n.id,
|
|
2472
|
-
orderId:
|
|
2475
|
+
orderId: t,
|
|
2473
2476
|
amount: n.amount
|
|
2474
2477
|
}), (await this.sdk.removeFromOrder({
|
|
2475
2478
|
productId: n.id,
|
|
2476
|
-
orderId:
|
|
2479
|
+
orderId: t,
|
|
2477
2480
|
additionalData: n.seat ? {
|
|
2478
2481
|
seat: {
|
|
2479
2482
|
seatId: n.seat.id,
|
|
@@ -2482,111 +2485,111 @@ class At {
|
|
|
2482
2485
|
} : null,
|
|
2483
2486
|
amount: n.amount
|
|
2484
2487
|
})).releaseProduct ?? null;
|
|
2485
|
-
} catch (
|
|
2486
|
-
throw this.debugLog("Error removing product",
|
|
2488
|
+
} catch (r) {
|
|
2489
|
+
throw this.debugLog("Error removing product", r), this.handleError(r), r;
|
|
2487
2490
|
}
|
|
2488
2491
|
}
|
|
2489
|
-
async configurePackage(
|
|
2492
|
+
async configurePackage(t, n, r) {
|
|
2490
2493
|
try {
|
|
2491
|
-
const
|
|
2494
|
+
const i = n.items.map((o) => ({
|
|
2492
2495
|
packageItemId: o.packageItemId,
|
|
2493
2496
|
eventId: o.eventId
|
|
2494
2497
|
}));
|
|
2495
2498
|
this.debugLog("Configuring package", {
|
|
2496
2499
|
packageId: n.id,
|
|
2497
|
-
orderId:
|
|
2500
|
+
orderId: t,
|
|
2498
2501
|
amount: n.amount,
|
|
2499
|
-
items:
|
|
2500
|
-
shopId:
|
|
2502
|
+
items: i,
|
|
2503
|
+
shopId: r
|
|
2501
2504
|
});
|
|
2502
2505
|
const s = await this.sdk.configurePackage({
|
|
2503
2506
|
trackerId: this.config.trackerId,
|
|
2504
|
-
shopId:
|
|
2507
|
+
shopId: r,
|
|
2505
2508
|
packageId: n.id,
|
|
2506
|
-
orderId:
|
|
2509
|
+
orderId: t,
|
|
2507
2510
|
amount: n.amount,
|
|
2508
|
-
items:
|
|
2511
|
+
items: i
|
|
2509
2512
|
});
|
|
2510
2513
|
return this.debugLog("Configure package response"), s.configurePackage ?? null;
|
|
2511
|
-
} catch (
|
|
2512
|
-
throw this.debugLog("Error configuring package",
|
|
2514
|
+
} catch (i) {
|
|
2515
|
+
throw this.debugLog("Error configuring package", i), this.handleError(i), i;
|
|
2513
2516
|
}
|
|
2514
2517
|
}
|
|
2515
|
-
async configureCustomer(
|
|
2516
|
-
this.debugLog("Creating/replacing customer", { orderId:
|
|
2518
|
+
async configureCustomer(t, n) {
|
|
2519
|
+
this.debugLog("Creating/replacing customer", { orderId: t, email: n.email });
|
|
2517
2520
|
try {
|
|
2518
|
-
const
|
|
2519
|
-
orderId:
|
|
2521
|
+
const r = await this.sdk.createOrderCustomer({
|
|
2522
|
+
orderId: t,
|
|
2520
2523
|
customer: n
|
|
2521
2524
|
});
|
|
2522
|
-
this.debugLog("Customer set successfully",
|
|
2523
|
-
} catch (
|
|
2524
|
-
throw this.debugLog("Failed to set customer",
|
|
2525
|
+
this.debugLog("Customer set successfully", r);
|
|
2526
|
+
} catch (r) {
|
|
2527
|
+
throw this.debugLog("Failed to set customer", r), new Error(`Failed to set customer: ${r.message}`);
|
|
2525
2528
|
}
|
|
2526
2529
|
}
|
|
2527
|
-
async reserveAdditionalPackageItem(
|
|
2530
|
+
async reserveAdditionalPackageItem(t, n) {
|
|
2528
2531
|
try {
|
|
2529
2532
|
this.debugLog("reserve additional packageItem", {
|
|
2530
|
-
orderId:
|
|
2533
|
+
orderId: t,
|
|
2531
2534
|
eventId: n.eventId,
|
|
2532
2535
|
amount: n.amount,
|
|
2533
2536
|
packageId: n.packageId,
|
|
2534
2537
|
packageItemId: n.packageItemId
|
|
2535
2538
|
});
|
|
2536
|
-
const
|
|
2537
|
-
orderId:
|
|
2539
|
+
const r = await this.sdk.reserveAdditionalPackageItem({
|
|
2540
|
+
orderId: t,
|
|
2538
2541
|
eventId: n.eventId,
|
|
2539
2542
|
amount: n.amount,
|
|
2540
2543
|
packageId: n.packageId,
|
|
2541
2544
|
packageItemId: n.packageItemId
|
|
2542
2545
|
});
|
|
2543
|
-
return this.debugLog("reserve additional packageItem"),
|
|
2544
|
-
} catch (
|
|
2545
|
-
throw this.debugLog("Error configuring package",
|
|
2546
|
+
return this.debugLog("reserve additional packageItem"), r.reserveAdditionalPackageItem ?? null;
|
|
2547
|
+
} catch (r) {
|
|
2548
|
+
throw this.debugLog("Error configuring package", r), this.handleError(r), r;
|
|
2546
2549
|
}
|
|
2547
2550
|
}
|
|
2548
2551
|
// Cancel and clear order functions
|
|
2549
|
-
async cancelOrder(
|
|
2550
|
-
|
|
2552
|
+
async cancelOrder(t) {
|
|
2553
|
+
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.debugLog("Order cancelled successfully"));
|
|
2551
2554
|
}
|
|
2552
|
-
async findOrder(
|
|
2555
|
+
async findOrder(t, n) {
|
|
2553
2556
|
try {
|
|
2554
|
-
const
|
|
2555
|
-
return
|
|
2556
|
-
id:
|
|
2557
|
-
reference:
|
|
2558
|
-
currency:
|
|
2559
|
-
downloadCode:
|
|
2557
|
+
const r = await this.sdk.findOrderById({ id: t, reference: n });
|
|
2558
|
+
return r.findOrder ? {
|
|
2559
|
+
id: r.findOrder.id,
|
|
2560
|
+
reference: r.findOrder.reference,
|
|
2561
|
+
currency: r.findOrder.currency,
|
|
2562
|
+
downloadCode: r.findOrder.downloadCode,
|
|
2560
2563
|
organization: {
|
|
2561
|
-
name:
|
|
2562
|
-
paymentBanner:
|
|
2564
|
+
name: r.findOrder.organization.name,
|
|
2565
|
+
paymentBanner: r.findOrder.organization.name
|
|
2563
2566
|
},
|
|
2564
|
-
customer:
|
|
2565
|
-
firstName:
|
|
2566
|
-
lastName:
|
|
2567
|
-
email:
|
|
2568
|
-
age:
|
|
2569
|
-
gender:
|
|
2570
|
-
residence:
|
|
2571
|
-
extraInfo:
|
|
2567
|
+
customer: r.findOrder.mainBooker ? {
|
|
2568
|
+
firstName: r.findOrder.mainBooker.firstName,
|
|
2569
|
+
lastName: r.findOrder.mainBooker.lastName,
|
|
2570
|
+
email: r.findOrder.mainBooker.email,
|
|
2571
|
+
age: r.findOrder.mainBooker.age,
|
|
2572
|
+
gender: r.findOrder.mainBooker.gender,
|
|
2573
|
+
residence: r.findOrder.mainBooker.residence,
|
|
2574
|
+
extraInfo: r.findOrder.mainBooker.extraInfo
|
|
2572
2575
|
} : null,
|
|
2573
|
-
items:
|
|
2576
|
+
items: r.findOrder.items
|
|
2574
2577
|
} : null;
|
|
2575
|
-
} catch (
|
|
2576
|
-
return this.debugLog("Error finding order",
|
|
2578
|
+
} catch (r) {
|
|
2579
|
+
return this.debugLog("Error finding order", r), this.handleError(r), null;
|
|
2577
2580
|
}
|
|
2578
2581
|
}
|
|
2579
|
-
async findActiveOrder(
|
|
2580
|
-
this.debugLog("Fetching order from server", { orderId:
|
|
2582
|
+
async findActiveOrder(t) {
|
|
2583
|
+
this.debugLog("Fetching order from server", { orderId: t });
|
|
2581
2584
|
try {
|
|
2582
|
-
const n = await this.sdk.findActiveOrderById({ id:
|
|
2585
|
+
const n = await this.sdk.findActiveOrderById({ id: t });
|
|
2583
2586
|
if (!n?.findOrder)
|
|
2584
2587
|
return null;
|
|
2585
|
-
const
|
|
2586
|
-
this.debugLog("Order fetched successfully",
|
|
2587
|
-
const
|
|
2588
|
-
let m =
|
|
2589
|
-
return d.product.type === "PROMOTER" ? m =
|
|
2588
|
+
const r = n.findOrder;
|
|
2589
|
+
this.debugLog("Order fetched successfully", r);
|
|
2590
|
+
const i = r.items, s = i.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
2591
|
+
let m = N.PRODUCT;
|
|
2592
|
+
return d.product.type === "PROMOTER" ? m = N.ADD_ONS : d.product.type === "PICKUP" ? m = N.PICKUP : d.product.type === "DELIVERY" && (m = N.DELIVERY), {
|
|
2590
2593
|
id: d.product.id,
|
|
2591
2594
|
type: m,
|
|
2592
2595
|
name: d.product.name,
|
|
@@ -2602,83 +2605,83 @@ class At {
|
|
|
2602
2605
|
label: y.label
|
|
2603
2606
|
}))
|
|
2604
2607
|
};
|
|
2605
|
-
}), o =
|
|
2608
|
+
}), o = i.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, m) => {
|
|
2606
2609
|
const {
|
|
2607
2610
|
packageItem: y,
|
|
2608
|
-
event:
|
|
2609
|
-
amount:
|
|
2610
|
-
price:
|
|
2611
|
+
event: p,
|
|
2612
|
+
amount: k,
|
|
2613
|
+
price: _,
|
|
2611
2614
|
serviceFee: Y,
|
|
2612
2615
|
depositPrice: H,
|
|
2613
2616
|
originalPrice: J
|
|
2614
2617
|
} = m, A = y.package.id;
|
|
2615
|
-
d[A] ? (d[A].price +=
|
|
2618
|
+
d[A] ? (d[A].price += _ ?? 0, d[A].serviceFee += Y ?? 0, d[A].originalPrice += J ?? 0, d[A].depositPrice += H ?? _ ?? 0) : d[A] = {
|
|
2616
2619
|
id: A,
|
|
2617
|
-
type:
|
|
2620
|
+
type: N.PACKAGE,
|
|
2618
2621
|
name: y.package.name,
|
|
2619
|
-
amount:
|
|
2620
|
-
price:
|
|
2622
|
+
amount: k,
|
|
2623
|
+
price: _ ?? 0,
|
|
2621
2624
|
serviceFee: Y ?? 0,
|
|
2622
|
-
depositPrice: H ??
|
|
2625
|
+
depositPrice: H ?? _ ?? 0,
|
|
2623
2626
|
originalPrice: J ?? 0,
|
|
2624
2627
|
packageItems: []
|
|
2625
2628
|
};
|
|
2626
|
-
const
|
|
2627
|
-
zone:
|
|
2628
|
-
}),
|
|
2629
|
-
zone:
|
|
2629
|
+
const Ne = O.fromISO(p.startAt, {
|
|
2630
|
+
zone: p.timezone
|
|
2631
|
+
}), De = O.fromISO(p.endAt, {
|
|
2632
|
+
zone: p.timezone
|
|
2630
2633
|
});
|
|
2631
2634
|
return d[A].packageItems.push({
|
|
2632
2635
|
packageItemId: y.id,
|
|
2633
|
-
eventId:
|
|
2634
|
-
name:
|
|
2635
|
-
startAt:
|
|
2636
|
-
endAt:
|
|
2636
|
+
eventId: p.id,
|
|
2637
|
+
name: p.name,
|
|
2638
|
+
startAt: Ne.toJSDate().toISOString(),
|
|
2639
|
+
endAt: De.toJSDate().toISOString()
|
|
2637
2640
|
}), d;
|
|
2638
2641
|
}, {}), l = [
|
|
2639
2642
|
...s,
|
|
2640
2643
|
...Object.values(o)
|
|
2641
|
-
],
|
|
2642
|
-
if (
|
|
2644
|
+
], h = l.reduce((d, m) => d + (m.amount || 0), 0);
|
|
2645
|
+
if (h === 0)
|
|
2643
2646
|
return null;
|
|
2644
|
-
const E =
|
|
2647
|
+
const E = i.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime()), g = O.fromMillis(Math.min(...E));
|
|
2645
2648
|
return {
|
|
2646
|
-
id:
|
|
2647
|
-
currency:
|
|
2649
|
+
id: r.id,
|
|
2650
|
+
currency: r.currency,
|
|
2648
2651
|
expiredAt: g?.toJSDate().toISOString(),
|
|
2649
2652
|
items: l,
|
|
2650
|
-
customer:
|
|
2651
|
-
firstName:
|
|
2652
|
-
lastName:
|
|
2653
|
-
email:
|
|
2654
|
-
age:
|
|
2655
|
-
gender:
|
|
2656
|
-
residence:
|
|
2657
|
-
extraInfo:
|
|
2653
|
+
customer: r.mainBooker ? {
|
|
2654
|
+
firstName: r.mainBooker.firstName,
|
|
2655
|
+
lastName: r.mainBooker.lastName,
|
|
2656
|
+
email: r.mainBooker.email,
|
|
2657
|
+
age: r.mainBooker.age,
|
|
2658
|
+
gender: r.mainBooker.gender,
|
|
2659
|
+
residence: r.mainBooker.residence,
|
|
2660
|
+
extraInfo: r.mainBooker.extraInfo
|
|
2658
2661
|
} : null,
|
|
2659
|
-
count:
|
|
2662
|
+
count: h,
|
|
2660
2663
|
orderProtection: !1
|
|
2661
2664
|
};
|
|
2662
2665
|
} catch (n) {
|
|
2663
2666
|
throw this.debugLog("Error fetching order", n), n;
|
|
2664
2667
|
}
|
|
2665
2668
|
}
|
|
2666
|
-
debugLog(
|
|
2667
|
-
this.config.debug && console.log(`[BasketService] ${
|
|
2669
|
+
debugLog(t, n) {
|
|
2670
|
+
this.config.debug && console.log(`[BasketService] ${t}`, n || "");
|
|
2668
2671
|
}
|
|
2669
|
-
handleError(
|
|
2670
|
-
const n =
|
|
2672
|
+
handleError(t) {
|
|
2673
|
+
const n = t;
|
|
2671
2674
|
if (n.graphQLErrors && n.graphQLErrors.length > 0) {
|
|
2672
|
-
const
|
|
2673
|
-
|
|
2675
|
+
const r = n.graphQLErrors[0];
|
|
2676
|
+
r.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), r.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
2674
2677
|
}
|
|
2675
2678
|
if (n.response?.errors && n.response.errors.length > 0) {
|
|
2676
|
-
const
|
|
2677
|
-
console.error("GraphQL Error:",
|
|
2679
|
+
const r = n.response.errors[0];
|
|
2680
|
+
console.error("GraphQL Error:", r.message), r.extensions?.code && console.error("Error Code:", r.extensions.code);
|
|
2678
2681
|
}
|
|
2679
2682
|
}
|
|
2680
2683
|
}
|
|
2681
|
-
const
|
|
2684
|
+
const vt = u`
|
|
2682
2685
|
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $locationIds: [String!], $excludedEventIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
|
|
2683
2686
|
findAllPublicEventByOrganizationId(
|
|
2684
2687
|
id: $organizationId
|
|
@@ -2724,7 +2727,7 @@ const Tt = u`
|
|
|
2724
2727
|
count
|
|
2725
2728
|
}
|
|
2726
2729
|
}
|
|
2727
|
-
`,
|
|
2730
|
+
`, Pt = u`
|
|
2728
2731
|
query EventDetailPage($eventId: ID!) {
|
|
2729
2732
|
findPublicEventById(id: $eventId) {
|
|
2730
2733
|
id
|
|
@@ -2757,7 +2760,7 @@ const Tt = u`
|
|
|
2757
2760
|
seatsIoEventId
|
|
2758
2761
|
}
|
|
2759
2762
|
}
|
|
2760
|
-
`,
|
|
2763
|
+
`, bt = u`
|
|
2761
2764
|
query FindPublicEventBySlug($organizationId: ID!, $slug: String!) {
|
|
2762
2765
|
findPublicEventBySlug(organizationId: $organizationId, slug: $slug) {
|
|
2763
2766
|
id
|
|
@@ -2790,7 +2793,7 @@ const Tt = u`
|
|
|
2790
2793
|
seatsIoEventId
|
|
2791
2794
|
}
|
|
2792
2795
|
}
|
|
2793
|
-
`,
|
|
2796
|
+
`, St = u`
|
|
2794
2797
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
2795
2798
|
findPublicProductsByEventId(
|
|
2796
2799
|
eventId: $eventId
|
|
@@ -2825,69 +2828,69 @@ const Tt = u`
|
|
|
2825
2828
|
showEndSalesAtTag
|
|
2826
2829
|
}
|
|
2827
2830
|
}
|
|
2828
|
-
`,
|
|
2829
|
-
function
|
|
2831
|
+
`, xt = (e, t, n, r) => e();
|
|
2832
|
+
function _t(e, t = xt) {
|
|
2830
2833
|
return {
|
|
2831
|
-
EventOverviewPage(n,
|
|
2832
|
-
return
|
|
2834
|
+
EventOverviewPage(n, r, i) {
|
|
2835
|
+
return t((s) => e.request({ document: vt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventOverviewPage", "query", n);
|
|
2833
2836
|
},
|
|
2834
|
-
EventDetailPage(n,
|
|
2835
|
-
return
|
|
2837
|
+
EventDetailPage(n, r, i) {
|
|
2838
|
+
return t((s) => e.request({ document: Pt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventDetailPage", "query", n);
|
|
2836
2839
|
},
|
|
2837
|
-
FindPublicEventBySlug(n,
|
|
2838
|
-
return
|
|
2840
|
+
FindPublicEventBySlug(n, r, i) {
|
|
2841
|
+
return t((s) => e.request({ document: bt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "FindPublicEventBySlug", "query", n);
|
|
2839
2842
|
},
|
|
2840
|
-
findProductsByEventId(n,
|
|
2841
|
-
return
|
|
2843
|
+
findProductsByEventId(n, r, i) {
|
|
2844
|
+
return t((s) => e.request({ document: St, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findProductsByEventId", "query", n);
|
|
2842
2845
|
}
|
|
2843
2846
|
};
|
|
2844
2847
|
}
|
|
2845
|
-
class
|
|
2848
|
+
class Ct {
|
|
2846
2849
|
config;
|
|
2847
2850
|
sdk;
|
|
2848
|
-
constructor(
|
|
2849
|
-
this.config =
|
|
2851
|
+
constructor(t) {
|
|
2852
|
+
this.config = t, this.sdk = _t(new T(t.apiUrl));
|
|
2850
2853
|
}
|
|
2851
|
-
async getEvents(
|
|
2854
|
+
async getEvents(t, n) {
|
|
2852
2855
|
try {
|
|
2853
|
-
|
|
2854
|
-
index:
|
|
2855
|
-
size:
|
|
2856
|
+
t.page && (t.page = {
|
|
2857
|
+
index: t.page.index ?? 0,
|
|
2858
|
+
size: t.page.size ?? 20
|
|
2856
2859
|
}), this.debugLog("Fetching events with parameters", {
|
|
2857
2860
|
organizationId: this.config.organizationId ?? n ?? "",
|
|
2858
|
-
hostingIds:
|
|
2859
|
-
filterEventStatuses:
|
|
2860
|
-
dateRange:
|
|
2861
|
-
page:
|
|
2862
|
-
sorts:
|
|
2861
|
+
hostingIds: t.hostingIds,
|
|
2862
|
+
filterEventStatuses: t.statuses,
|
|
2863
|
+
dateRange: t.dateRange,
|
|
2864
|
+
page: t.page,
|
|
2865
|
+
sorts: t.sorts,
|
|
2863
2866
|
trackerId: this.config.trackerId
|
|
2864
2867
|
});
|
|
2865
|
-
const
|
|
2868
|
+
const r = await this.sdk.EventOverviewPage({
|
|
2866
2869
|
organizationId: this.config.organizationId ?? n ?? "",
|
|
2867
|
-
hostingIds:
|
|
2868
|
-
locationIds:
|
|
2869
|
-
excludedEventIds:
|
|
2870
|
-
filterEventStatuses:
|
|
2871
|
-
dateRange:
|
|
2872
|
-
from:
|
|
2873
|
-
till:
|
|
2870
|
+
hostingIds: t.hostingIds,
|
|
2871
|
+
locationIds: t.locationIds,
|
|
2872
|
+
excludedEventIds: t.excludedEventIds,
|
|
2873
|
+
filterEventStatuses: t.statuses,
|
|
2874
|
+
dateRange: t.dateRange && t.dateRange.from && t.dateRange.till ? {
|
|
2875
|
+
from: t.dateRange.from.toISO(),
|
|
2876
|
+
till: t.dateRange.till.toISO()
|
|
2874
2877
|
} : void 0,
|
|
2875
|
-
page:
|
|
2876
|
-
sorts:
|
|
2878
|
+
page: t.page,
|
|
2879
|
+
sorts: t.sorts,
|
|
2877
2880
|
trackerId: this.config.trackerId,
|
|
2878
|
-
searchTerm:
|
|
2879
|
-
priceRange:
|
|
2881
|
+
searchTerm: t.searchTerm,
|
|
2882
|
+
priceRange: t.priceRange
|
|
2880
2883
|
});
|
|
2881
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2882
|
-
const
|
|
2884
|
+
if (this.debugLog("Raw GraphQL response", r), r?.findAllPublicEventByOrganizationId?.data) {
|
|
2885
|
+
const i = r.findAllPublicEventByOrganizationId.data.map((s) => ({
|
|
2883
2886
|
id: s.id,
|
|
2884
2887
|
name: s.name,
|
|
2885
2888
|
icon: s.icon,
|
|
2886
2889
|
banner: s.banner,
|
|
2887
2890
|
description: s.description,
|
|
2888
2891
|
addonDescription: s.addonDescription,
|
|
2889
|
-
startAt:
|
|
2890
|
-
endAt:
|
|
2892
|
+
startAt: O.fromISO(s.startAt, { zone: s.timezone }).toJSDate().toISOString(),
|
|
2893
|
+
endAt: O.fromISO(s.endAt, { zone: s.timezone }).toJSDate().toISOString(),
|
|
2891
2894
|
timezone: s.timezone,
|
|
2892
2895
|
startSalesAt: null,
|
|
2893
2896
|
endSalesAt: null,
|
|
@@ -2905,73 +2908,29 @@ class St {
|
|
|
2905
2908
|
} : void 0,
|
|
2906
2909
|
infoDescription: s.infoDescription,
|
|
2907
2910
|
startingPrice: s.startingPrice,
|
|
2908
|
-
totalViews: s.totalViews
|
|
2909
|
-
seatsIoEventId: s.seatsIoEventId
|
|
2911
|
+
totalViews: s.totalViews
|
|
2910
2912
|
}));
|
|
2911
|
-
return this.debugLog("Processed events", { events:
|
|
2913
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, r.findAllPublicEventByOrganizationId.count ?? 0];
|
|
2912
2914
|
} else
|
|
2913
2915
|
return this.debugLog("No events found in response"), [[], 0];
|
|
2914
|
-
} catch (
|
|
2915
|
-
throw this.debugLog("Error fetching events",
|
|
2916
|
+
} catch (r) {
|
|
2917
|
+
throw this.debugLog("Error fetching events", r), r;
|
|
2916
2918
|
}
|
|
2917
2919
|
}
|
|
2918
|
-
async getEvent(
|
|
2920
|
+
async getEvent(t) {
|
|
2919
2921
|
try {
|
|
2920
|
-
this.debugLog("Fetching single event", { eventId:
|
|
2921
|
-
const n = await this.sdk.EventDetailPage({ eventId:
|
|
2922
|
+
this.debugLog("Fetching single event", { eventId: t });
|
|
2923
|
+
const n = await this.sdk.EventDetailPage({ eventId: t });
|
|
2922
2924
|
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
2923
|
-
const
|
|
2924
|
-
id: i.id,
|
|
2925
|
-
name: i.name,
|
|
2926
|
-
icon: i.icon,
|
|
2927
|
-
banner: i.banner,
|
|
2928
|
-
description: i.description,
|
|
2929
|
-
addonDescription: i.addonDescription,
|
|
2930
|
-
startAt: k.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2931
|
-
endAt: k.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2932
|
-
timezone: i.timezone,
|
|
2933
|
-
startSalesAt: i.startSalesAt,
|
|
2934
|
-
endSalesAt: i.endSalesAt,
|
|
2935
|
-
slug: i.slug ?? "ERROR",
|
|
2936
|
-
facebookPixelId: i.facebookPixelId,
|
|
2937
|
-
status: i.status,
|
|
2938
|
-
location: i.location ? {
|
|
2939
|
-
id: i.location.id,
|
|
2940
|
-
name: i.location.name,
|
|
2941
|
-
address: i.location.address
|
|
2942
|
-
} : void 0,
|
|
2943
|
-
hosting: i.hosting ? {
|
|
2944
|
-
id: i.hosting.id,
|
|
2945
|
-
name: i.hosting.name
|
|
2946
|
-
} : void 0,
|
|
2947
|
-
infoDescription: i.infoDescription,
|
|
2948
|
-
startingPrice: i.startingPrice,
|
|
2949
|
-
totalViews: i.totalViews,
|
|
2950
|
-
seatsIoEventId: i.seatsIoEventId
|
|
2951
|
-
};
|
|
2952
|
-
return this.debugLog("Processed single event", r), r;
|
|
2953
|
-
} else {
|
|
2954
|
-
this.debugLog("No event found for id", e);
|
|
2955
|
-
return;
|
|
2956
|
-
}
|
|
2957
|
-
} catch (n) {
|
|
2958
|
-
throw this.debugLog("Error fetching single event", n), n;
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
async getEventBySlug(e, n) {
|
|
2962
|
-
try {
|
|
2963
|
-
this.debugLog("Fetching single event by slug", { organizationId: e, slug: n });
|
|
2964
|
-
const i = await this.sdk.FindPublicEventBySlug({ organizationId: e, slug: n });
|
|
2965
|
-
if (this.debugLog("Raw GraphQL response", i), i?.findPublicEventBySlug) {
|
|
2966
|
-
const r = i.findPublicEventBySlug, s = {
|
|
2925
|
+
const r = n.findPublicEventById, i = {
|
|
2967
2926
|
id: r.id,
|
|
2968
2927
|
name: r.name,
|
|
2969
2928
|
icon: r.icon,
|
|
2970
2929
|
banner: r.banner,
|
|
2971
2930
|
description: r.description,
|
|
2972
2931
|
addonDescription: r.addonDescription,
|
|
2973
|
-
startAt:
|
|
2974
|
-
endAt:
|
|
2932
|
+
startAt: O.fromISO(r.startAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2933
|
+
endAt: O.fromISO(r.endAt, { zone: r.timezone }).toJSDate().toISOString(),
|
|
2975
2934
|
timezone: r.timezone,
|
|
2976
2935
|
startSalesAt: r.startSalesAt,
|
|
2977
2936
|
endSalesAt: r.endSalesAt,
|
|
@@ -2990,33 +2949,78 @@ class St {
|
|
|
2990
2949
|
infoDescription: r.infoDescription,
|
|
2991
2950
|
startingPrice: r.startingPrice,
|
|
2992
2951
|
totalViews: r.totalViews,
|
|
2993
|
-
seatsIoEventId: r.seatsIoEventId
|
|
2952
|
+
seatsIoEventId: r.seatsIoEventId,
|
|
2953
|
+
maxAmountOfTicketsPerOrder: r.maxAmountOfTicketsPerOrder
|
|
2954
|
+
};
|
|
2955
|
+
return this.debugLog("Processed single event", i), i;
|
|
2956
|
+
} else {
|
|
2957
|
+
this.debugLog("No event found for id", t);
|
|
2958
|
+
return;
|
|
2959
|
+
}
|
|
2960
|
+
} catch (n) {
|
|
2961
|
+
throw this.debugLog("Error fetching single event", n), n;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
async getEventBySlug(t, n) {
|
|
2965
|
+
try {
|
|
2966
|
+
this.debugLog("Fetching single event by slug", { organizationId: t, slug: n });
|
|
2967
|
+
const r = await this.sdk.FindPublicEventBySlug({ organizationId: t, slug: n });
|
|
2968
|
+
if (this.debugLog("Raw GraphQL response", r), r?.findPublicEventBySlug) {
|
|
2969
|
+
const i = r.findPublicEventBySlug, s = {
|
|
2970
|
+
id: i.id,
|
|
2971
|
+
name: i.name,
|
|
2972
|
+
icon: i.icon,
|
|
2973
|
+
banner: i.banner,
|
|
2974
|
+
description: i.description,
|
|
2975
|
+
addonDescription: i.addonDescription,
|
|
2976
|
+
startAt: O.fromISO(i.startAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2977
|
+
endAt: O.fromISO(i.endAt, { zone: i.timezone }).toJSDate().toISOString(),
|
|
2978
|
+
timezone: i.timezone,
|
|
2979
|
+
startSalesAt: i.startSalesAt,
|
|
2980
|
+
endSalesAt: i.endSalesAt,
|
|
2981
|
+
slug: i.slug ?? "ERROR",
|
|
2982
|
+
facebookPixelId: i.facebookPixelId,
|
|
2983
|
+
status: i.status,
|
|
2984
|
+
location: i.location ? {
|
|
2985
|
+
id: i.location.id,
|
|
2986
|
+
name: i.location.name,
|
|
2987
|
+
address: i.location.address
|
|
2988
|
+
} : void 0,
|
|
2989
|
+
hosting: i.hosting ? {
|
|
2990
|
+
id: i.hosting.id,
|
|
2991
|
+
name: i.hosting.name
|
|
2992
|
+
} : void 0,
|
|
2993
|
+
infoDescription: i.infoDescription,
|
|
2994
|
+
startingPrice: i.startingPrice,
|
|
2995
|
+
totalViews: i.totalViews,
|
|
2996
|
+
seatsIoEventId: i.seatsIoEventId,
|
|
2997
|
+
maxAmountOfTicketsPerOrder: i.maxAmountOfTicketsPerOrder
|
|
2994
2998
|
};
|
|
2995
2999
|
return this.debugLog("Processed single event", s), s;
|
|
2996
3000
|
} else {
|
|
2997
|
-
this.debugLog("No event found for id by slug", { organizationId:
|
|
3001
|
+
this.debugLog("No event found for id by slug", { organizationId: t, slug: n });
|
|
2998
3002
|
return;
|
|
2999
3003
|
}
|
|
3000
|
-
} catch (
|
|
3001
|
-
throw this.debugLog("Error fetching single event",
|
|
3004
|
+
} catch (r) {
|
|
3005
|
+
throw this.debugLog("Error fetching single event", r), r;
|
|
3002
3006
|
}
|
|
3003
3007
|
}
|
|
3004
|
-
async getProducts(
|
|
3008
|
+
async getProducts(t, n, r) {
|
|
3005
3009
|
try {
|
|
3006
3010
|
this.debugLog("Fetching products for event", {
|
|
3007
|
-
eventId:
|
|
3008
|
-
promoCode:
|
|
3011
|
+
eventId: t,
|
|
3012
|
+
promoCode: r,
|
|
3009
3013
|
trackerId: this.config.trackerId,
|
|
3010
3014
|
productTypes: n
|
|
3011
3015
|
});
|
|
3012
|
-
const
|
|
3013
|
-
eventId:
|
|
3014
|
-
promoCode:
|
|
3016
|
+
const i = await this.sdk.findProductsByEventId({
|
|
3017
|
+
eventId: t,
|
|
3018
|
+
promoCode: r,
|
|
3015
3019
|
trackerId: this.config.trackerId,
|
|
3016
3020
|
productTypes: n
|
|
3017
3021
|
});
|
|
3018
|
-
if (
|
|
3019
|
-
const s =
|
|
3022
|
+
if (i?.findPublicProductsByEventId) {
|
|
3023
|
+
const s = i.findPublicProductsByEventId.map((o) => ({
|
|
3020
3024
|
id: o.id,
|
|
3021
3025
|
name: o.name,
|
|
3022
3026
|
category: o.category ? {
|
|
@@ -3043,21 +3047,21 @@ class St {
|
|
|
3043
3047
|
seatsCategory: o.seatsCategory
|
|
3044
3048
|
}));
|
|
3045
3049
|
return this.debugLog("Products fetched", {
|
|
3046
|
-
eventId:
|
|
3050
|
+
eventId: t,
|
|
3047
3051
|
count: s.length,
|
|
3048
3052
|
types: s.map((o) => o.type)
|
|
3049
3053
|
}), s;
|
|
3050
3054
|
}
|
|
3051
3055
|
return;
|
|
3052
|
-
} catch (
|
|
3053
|
-
throw this.debugLog("Error fetching products", { eventId:
|
|
3056
|
+
} catch (i) {
|
|
3057
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: i }), i;
|
|
3054
3058
|
}
|
|
3055
3059
|
}
|
|
3056
|
-
debugLog(
|
|
3057
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${
|
|
3060
|
+
debugLog(t, n) {
|
|
3061
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
|
|
3058
3062
|
}
|
|
3059
3063
|
}
|
|
3060
|
-
const
|
|
3064
|
+
const Lt = u`
|
|
3061
3065
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
3062
3066
|
findPaymentDetails(
|
|
3063
3067
|
orderId: $orderId
|
|
@@ -3087,62 +3091,62 @@ const xt = u`
|
|
|
3087
3091
|
protectionFee
|
|
3088
3092
|
}
|
|
3089
3093
|
}
|
|
3090
|
-
`,
|
|
3094
|
+
`, Rt = u`
|
|
3091
3095
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3092
3096
|
createDigitalOrderPayment(input: $input)
|
|
3093
3097
|
}
|
|
3094
|
-
`,
|
|
3095
|
-
function
|
|
3098
|
+
`, Ft = (e, t, n, r) => e();
|
|
3099
|
+
function wt(e, t = Ft) {
|
|
3096
3100
|
return {
|
|
3097
|
-
findPaymentMethods(n,
|
|
3098
|
-
return
|
|
3101
|
+
findPaymentMethods(n, r, i) {
|
|
3102
|
+
return t((s) => e.request({ document: Lt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPaymentMethods", "query", n);
|
|
3099
3103
|
},
|
|
3100
|
-
createDigitalPayment(n,
|
|
3101
|
-
return
|
|
3104
|
+
createDigitalPayment(n, r, i) {
|
|
3105
|
+
return t((s) => e.request({ document: Rt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createDigitalPayment", "mutation", n);
|
|
3102
3106
|
}
|
|
3103
3107
|
};
|
|
3104
3108
|
}
|
|
3105
|
-
class
|
|
3109
|
+
class $t {
|
|
3106
3110
|
config;
|
|
3107
3111
|
sdk;
|
|
3108
|
-
constructor(
|
|
3109
|
-
this.config =
|
|
3112
|
+
constructor(t) {
|
|
3113
|
+
this.config = t, this.sdk = wt(new T(t.apiUrl));
|
|
3110
3114
|
}
|
|
3111
|
-
async getPaymentDetails(
|
|
3112
|
-
this.debugLog("Fetching payment methods",
|
|
3115
|
+
async getPaymentDetails(t) {
|
|
3116
|
+
this.debugLog("Fetching payment methods", t);
|
|
3113
3117
|
try {
|
|
3114
3118
|
const n = await this.sdk.findPaymentMethods({
|
|
3115
|
-
orderId:
|
|
3116
|
-
orderItemId:
|
|
3117
|
-
amountOfTickets:
|
|
3118
|
-
paymentMethodId:
|
|
3119
|
-
withTicketProtection:
|
|
3119
|
+
orderId: t.orderId,
|
|
3120
|
+
orderItemId: t.orderItemId,
|
|
3121
|
+
amountOfTickets: t.amountOfTickets,
|
|
3122
|
+
paymentMethodId: t.paymentMethodId,
|
|
3123
|
+
withTicketProtection: t.withTicketProtection
|
|
3120
3124
|
});
|
|
3121
3125
|
if (!n?.findPaymentDetails)
|
|
3122
3126
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
3123
|
-
const
|
|
3127
|
+
const r = n.findPaymentDetails;
|
|
3124
3128
|
return this.debugLog("Payment methods fetched successfully", {
|
|
3125
|
-
methodCount:
|
|
3126
|
-
transactionPrice:
|
|
3127
|
-
transactionDiscount:
|
|
3128
|
-
transactionFee:
|
|
3129
|
-
paymentSpesificTransactionFee:
|
|
3130
|
-
protectionFee:
|
|
3129
|
+
methodCount: r.methods?.length ?? 0,
|
|
3130
|
+
transactionPrice: r.transactionPrice,
|
|
3131
|
+
transactionDiscount: r.transactionDiscount,
|
|
3132
|
+
transactionFee: r.transactionFee,
|
|
3133
|
+
paymentSpesificTransactionFee: r.paymentSpesificTransactionFee,
|
|
3134
|
+
protectionFee: r.protectionFee
|
|
3131
3135
|
}), {
|
|
3132
|
-
transactionPrice:
|
|
3133
|
-
transactionDiscount:
|
|
3134
|
-
transactionFee:
|
|
3135
|
-
protectionFee:
|
|
3136
|
-
paymentSpesificTransactionFee:
|
|
3137
|
-
methods:
|
|
3138
|
-
id:
|
|
3139
|
-
name:
|
|
3140
|
-
image:
|
|
3141
|
-
fee:
|
|
3142
|
-
type:
|
|
3143
|
-
value:
|
|
3136
|
+
transactionPrice: r.transactionPrice,
|
|
3137
|
+
transactionDiscount: r.transactionPrice,
|
|
3138
|
+
transactionFee: r.transactionFee,
|
|
3139
|
+
protectionFee: r.protectionFee,
|
|
3140
|
+
paymentSpesificTransactionFee: r.paymentSpesificTransactionFee,
|
|
3141
|
+
methods: r.methods?.map((i) => ({
|
|
3142
|
+
id: i.id,
|
|
3143
|
+
name: i.name,
|
|
3144
|
+
image: i.image,
|
|
3145
|
+
fee: i.fee ? {
|
|
3146
|
+
type: i.fee.type,
|
|
3147
|
+
value: i.fee.value
|
|
3144
3148
|
} : null,
|
|
3145
|
-
issuers:
|
|
3149
|
+
issuers: i.issuers?.map((s) => ({
|
|
3146
3150
|
id: s.id,
|
|
3147
3151
|
name: s.name,
|
|
3148
3152
|
image: s.image
|
|
@@ -3153,38 +3157,38 @@ class Rt {
|
|
|
3153
3157
|
throw this.debugLog("Error fetching payment methods", n), n;
|
|
3154
3158
|
}
|
|
3155
3159
|
}
|
|
3156
|
-
async createPayment(
|
|
3157
|
-
this.debugLog("Creating payment",
|
|
3160
|
+
async createPayment(t) {
|
|
3161
|
+
this.debugLog("Creating payment", t);
|
|
3158
3162
|
try {
|
|
3159
3163
|
const n = {
|
|
3160
|
-
orderId:
|
|
3161
|
-
paymentMethodId:
|
|
3162
|
-
issuerId:
|
|
3163
|
-
redirectUrl:
|
|
3164
|
+
orderId: t.orderId,
|
|
3165
|
+
paymentMethodId: t.paymentMethodId,
|
|
3166
|
+
issuerId: t.issuerId,
|
|
3167
|
+
redirectUrl: t.redirectUrl,
|
|
3164
3168
|
// For payment links this input in used
|
|
3165
|
-
initiatedByUserId:
|
|
3166
|
-
initiatedByTeamId:
|
|
3167
|
-
amountOfTickets:
|
|
3168
|
-
orderItemId:
|
|
3169
|
-
withTicketProtection:
|
|
3169
|
+
initiatedByUserId: t.initiatedByUserId,
|
|
3170
|
+
initiatedByTeamId: t.initiatedByTeamId,
|
|
3171
|
+
amountOfTickets: t.amountOfTickets,
|
|
3172
|
+
orderItemId: t.orderItemId,
|
|
3173
|
+
withTicketProtection: t.withTicketProtection
|
|
3170
3174
|
};
|
|
3171
|
-
|
|
3172
|
-
const
|
|
3175
|
+
t.customer && (n.customer = t.customer), t.products && (n.products = t.products), t.description && (n.description = t.description), t.reference && (n.reference = t.reference), t.ipAddress && (n.ipAddress = t.ipAddress);
|
|
3176
|
+
const r = await this.sdk.createDigitalPayment({
|
|
3173
3177
|
input: n
|
|
3174
3178
|
});
|
|
3175
|
-
if (!
|
|
3179
|
+
if (!r?.createDigitalOrderPayment)
|
|
3176
3180
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
3177
|
-
const
|
|
3178
|
-
return this.debugLog("Payment created successfully", { paymentUrl:
|
|
3181
|
+
const i = r.createDigitalOrderPayment;
|
|
3182
|
+
return this.debugLog("Payment created successfully", { paymentUrl: i }), { paymentUrl: i };
|
|
3179
3183
|
} catch (n) {
|
|
3180
3184
|
throw this.debugLog("Error creating payment", n), n;
|
|
3181
3185
|
}
|
|
3182
3186
|
}
|
|
3183
|
-
debugLog(
|
|
3184
|
-
this.config.debug && console.log(`[PaymentService] ${
|
|
3187
|
+
debugLog(t, n) {
|
|
3188
|
+
this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
|
|
3185
3189
|
}
|
|
3186
3190
|
}
|
|
3187
|
-
const
|
|
3191
|
+
const Bt = u`
|
|
3188
3192
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
3189
3193
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
3190
3194
|
data {
|
|
@@ -3209,7 +3213,7 @@ const Ft = u`
|
|
|
3209
3213
|
count
|
|
3210
3214
|
}
|
|
3211
3215
|
}
|
|
3212
|
-
`,
|
|
3216
|
+
`, Ut = u`
|
|
3213
3217
|
query findPublicPackageById($packageId: ID!) {
|
|
3214
3218
|
findPublicPackageById(id: $packageId) {
|
|
3215
3219
|
id
|
|
@@ -3235,7 +3239,7 @@ const Ft = u`
|
|
|
3235
3239
|
}
|
|
3236
3240
|
}
|
|
3237
3241
|
}
|
|
3238
|
-
`,
|
|
3242
|
+
`, Vt = u`
|
|
3239
3243
|
query findPublicPackageBySlug($organizationId: ID!, $slug: String!) {
|
|
3240
3244
|
findPublicPackageBySlug(organizationId: $organizationId, slug: $slug) {
|
|
3241
3245
|
id
|
|
@@ -3261,7 +3265,7 @@ const Ft = u`
|
|
|
3261
3265
|
}
|
|
3262
3266
|
}
|
|
3263
3267
|
}
|
|
3264
|
-
`,
|
|
3268
|
+
`, Mt = u`
|
|
3265
3269
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
3266
3270
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
3267
3271
|
data {
|
|
@@ -3296,112 +3300,112 @@ const Ft = u`
|
|
|
3296
3300
|
count
|
|
3297
3301
|
}
|
|
3298
3302
|
}
|
|
3299
|
-
`,
|
|
3300
|
-
function
|
|
3303
|
+
`, zt = (e, t, n, r) => e();
|
|
3304
|
+
function qt(e, t = zt) {
|
|
3301
3305
|
return {
|
|
3302
|
-
findAllPublicPackagesByOrganizationId(n,
|
|
3303
|
-
return
|
|
3306
|
+
findAllPublicPackagesByOrganizationId(n, r, i) {
|
|
3307
|
+
return t((s) => e.request({ document: Bt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
3304
3308
|
},
|
|
3305
|
-
findPublicPackageById(n,
|
|
3306
|
-
return
|
|
3309
|
+
findPublicPackageById(n, r, i) {
|
|
3310
|
+
return t((s) => e.request({ document: Ut, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicPackageById", "query", n);
|
|
3307
3311
|
},
|
|
3308
|
-
findPublicPackageBySlug(n,
|
|
3309
|
-
return
|
|
3312
|
+
findPublicPackageBySlug(n, r, i) {
|
|
3313
|
+
return t((s) => e.request({ document: Vt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicPackageBySlug", "query", n);
|
|
3310
3314
|
},
|
|
3311
|
-
findPublicItemsByPackageId(n,
|
|
3312
|
-
return
|
|
3315
|
+
findPublicItemsByPackageId(n, r, i) {
|
|
3316
|
+
return t((s) => e.request({ document: Mt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicItemsByPackageId", "query", n);
|
|
3313
3317
|
}
|
|
3314
3318
|
};
|
|
3315
3319
|
}
|
|
3316
|
-
class
|
|
3320
|
+
class Gt {
|
|
3317
3321
|
config;
|
|
3318
3322
|
sdk;
|
|
3319
|
-
constructor(
|
|
3320
|
-
this.config =
|
|
3323
|
+
constructor(t) {
|
|
3324
|
+
this.config = t, this.sdk = qt(new T(t.apiUrl));
|
|
3321
3325
|
}
|
|
3322
|
-
debugLog(
|
|
3323
|
-
this.config.debug && console.log(`[PackageService] ${
|
|
3326
|
+
debugLog(t, n) {
|
|
3327
|
+
this.config.debug && console.log(`[PackageService] ${t}`, n || "");
|
|
3324
3328
|
}
|
|
3325
|
-
async getPackages(
|
|
3329
|
+
async getPackages(t, n) {
|
|
3326
3330
|
try {
|
|
3327
|
-
let
|
|
3328
|
-
|
|
3329
|
-
index:
|
|
3330
|
-
size:
|
|
3331
|
+
let r;
|
|
3332
|
+
t.page && (r = {
|
|
3333
|
+
index: t.page.index ?? 0,
|
|
3334
|
+
size: t.page.size ?? 20
|
|
3331
3335
|
}), this.debugLog("Fetching public packages", {
|
|
3332
3336
|
organizationId: this.config.organizationId ?? n ?? "",
|
|
3333
|
-
page:
|
|
3334
|
-
tab:
|
|
3335
|
-
statuses:
|
|
3337
|
+
page: r,
|
|
3338
|
+
tab: t.tab,
|
|
3339
|
+
statuses: t.statuses
|
|
3336
3340
|
});
|
|
3337
|
-
const
|
|
3341
|
+
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
3338
3342
|
organizationId: this.config.organizationId ?? n ?? ""
|
|
3339
3343
|
});
|
|
3340
|
-
if (
|
|
3341
|
-
const s =
|
|
3344
|
+
if (i?.findAllPublicPackagesByOrganizationId) {
|
|
3345
|
+
const s = i.findAllPublicPackagesByOrganizationId;
|
|
3342
3346
|
return this.debugLog("Public packages fetched", {
|
|
3343
3347
|
count: s.count,
|
|
3344
3348
|
dataLength: s.data.length
|
|
3345
3349
|
}), s.data;
|
|
3346
3350
|
}
|
|
3347
3351
|
return null;
|
|
3348
|
-
} catch (
|
|
3349
|
-
throw this.debugLog("Error fetching public packages",
|
|
3352
|
+
} catch (r) {
|
|
3353
|
+
throw this.debugLog("Error fetching public packages", r), r;
|
|
3350
3354
|
}
|
|
3351
3355
|
}
|
|
3352
|
-
async getPackage(
|
|
3356
|
+
async getPackage(t) {
|
|
3353
3357
|
try {
|
|
3354
3358
|
this.debugLog("Fetching public packages", {
|
|
3355
|
-
packageId:
|
|
3359
|
+
packageId: t
|
|
3356
3360
|
});
|
|
3357
|
-
const n = await this.sdk.findPublicPackageById({ packageId:
|
|
3361
|
+
const n = await this.sdk.findPublicPackageById({ packageId: t });
|
|
3358
3362
|
if (n?.findPublicPackageById) {
|
|
3359
|
-
const
|
|
3360
|
-
return this.debugLog("Public package fetched"),
|
|
3363
|
+
const r = n.findPublicPackageById;
|
|
3364
|
+
return this.debugLog("Public package fetched"), r;
|
|
3361
3365
|
}
|
|
3362
3366
|
return null;
|
|
3363
3367
|
} catch (n) {
|
|
3364
3368
|
throw this.debugLog("Error fetching public packages", n), n;
|
|
3365
3369
|
}
|
|
3366
3370
|
}
|
|
3367
|
-
async getPackageBySlug(
|
|
3371
|
+
async getPackageBySlug(t, n) {
|
|
3368
3372
|
try {
|
|
3369
3373
|
this.debugLog("Fetching public packages by slug", {
|
|
3370
|
-
organizationId:
|
|
3374
|
+
organizationId: t,
|
|
3371
3375
|
slug: n
|
|
3372
3376
|
});
|
|
3373
|
-
const
|
|
3374
|
-
if (
|
|
3375
|
-
const
|
|
3376
|
-
return this.debugLog("Public package fetched"),
|
|
3377
|
+
const r = await this.sdk.findPublicPackageBySlug({ organizationId: t, slug: n });
|
|
3378
|
+
if (r?.findPublicPackageBySlug) {
|
|
3379
|
+
const i = r.findPublicPackageBySlug;
|
|
3380
|
+
return this.debugLog("Public package fetched"), i;
|
|
3377
3381
|
}
|
|
3378
3382
|
return null;
|
|
3379
|
-
} catch (
|
|
3380
|
-
throw this.debugLog("Error fetching public packages",
|
|
3383
|
+
} catch (r) {
|
|
3384
|
+
throw this.debugLog("Error fetching public packages", r), r;
|
|
3381
3385
|
}
|
|
3382
3386
|
}
|
|
3383
|
-
async getPackageItems(
|
|
3387
|
+
async getPackageItems(t, n = [R.Regular, R.AdditionalEvent]) {
|
|
3384
3388
|
try {
|
|
3385
|
-
this.debugLog("Fetching public package items", { packageId:
|
|
3386
|
-
const
|
|
3387
|
-
packageId:
|
|
3389
|
+
this.debugLog("Fetching public package items", { packageId: t, types: n });
|
|
3390
|
+
const r = await this.sdk.findPublicItemsByPackageId({
|
|
3391
|
+
packageId: t,
|
|
3388
3392
|
types: n,
|
|
3389
3393
|
page: { index: 0, size: 100 }
|
|
3390
3394
|
});
|
|
3391
|
-
if (
|
|
3392
|
-
const
|
|
3395
|
+
if (r?.findPublicItemsByPackageId) {
|
|
3396
|
+
const i = r.findPublicItemsByPackageId;
|
|
3393
3397
|
return this.debugLog("Public package items fetched", {
|
|
3394
|
-
count:
|
|
3395
|
-
dataLength:
|
|
3396
|
-
}),
|
|
3398
|
+
count: i.count,
|
|
3399
|
+
dataLength: i.data.length
|
|
3400
|
+
}), i.data;
|
|
3397
3401
|
}
|
|
3398
3402
|
return null;
|
|
3399
|
-
} catch (
|
|
3400
|
-
throw this.debugLog("Error fetching public package items",
|
|
3403
|
+
} catch (r) {
|
|
3404
|
+
throw this.debugLog("Error fetching public package items", r), r;
|
|
3401
3405
|
}
|
|
3402
3406
|
}
|
|
3403
3407
|
}
|
|
3404
|
-
const
|
|
3408
|
+
const jt = u`
|
|
3405
3409
|
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
3406
3410
|
findAllPublicLocationsByOrganizationId(id: $organizationId) {
|
|
3407
3411
|
data {
|
|
@@ -3421,80 +3425,80 @@ const zt = u`
|
|
|
3421
3425
|
count
|
|
3422
3426
|
}
|
|
3423
3427
|
}
|
|
3424
|
-
`,
|
|
3425
|
-
function
|
|
3428
|
+
`, Yt = (e, t, n, r) => e();
|
|
3429
|
+
function Ht(e, t = Yt) {
|
|
3426
3430
|
return {
|
|
3427
|
-
findAllPublicCategoriesByOrganizationId(n,
|
|
3428
|
-
return
|
|
3431
|
+
findAllPublicCategoriesByOrganizationId(n, r, i) {
|
|
3432
|
+
return t((s) => e.request({ document: jt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
3429
3433
|
}
|
|
3430
3434
|
};
|
|
3431
3435
|
}
|
|
3432
|
-
class
|
|
3436
|
+
class Jt {
|
|
3433
3437
|
config;
|
|
3434
3438
|
sdk;
|
|
3435
|
-
constructor(
|
|
3436
|
-
this.config =
|
|
3439
|
+
constructor(t) {
|
|
3440
|
+
this.config = t, this.sdk = Ht(new T(t.apiUrl));
|
|
3437
3441
|
}
|
|
3438
|
-
debugLog(
|
|
3439
|
-
this.config.debug && console.log(`[CategoryService] ${
|
|
3442
|
+
debugLog(t, n) {
|
|
3443
|
+
this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
|
|
3440
3444
|
}
|
|
3441
|
-
async getCategories(
|
|
3445
|
+
async getCategories(t, n) {
|
|
3442
3446
|
try {
|
|
3443
3447
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
3444
|
-
const
|
|
3445
|
-
if (
|
|
3446
|
-
const
|
|
3447
|
-
return this.debugLog("Categories fetched", { count:
|
|
3448
|
-
...
|
|
3448
|
+
const r = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId ?? n ?? "", dateRange: t ?? null });
|
|
3449
|
+
if (r?.findAllPublicHostingsByOrganizationId) {
|
|
3450
|
+
const i = r.findAllPublicHostingsByOrganizationId, s = r.findAllPublicLocationsByOrganizationId;
|
|
3451
|
+
return this.debugLog("Categories fetched", { count: i.count + s.count, dataLength: i.data.length + s.data.length }), [
|
|
3452
|
+
...i.data.map((o) => ({ id: o.id, name: o.name, icon: o.icon, activeEvents: o.amountOfActiveEvents, type: "HOSTING" })),
|
|
3449
3453
|
...s.data.map((o) => ({ id: o.id, name: o.name, activeEvents: o.amountOfActiveEvents, type: "LOCATION" }))
|
|
3450
3454
|
];
|
|
3451
3455
|
}
|
|
3452
3456
|
return [];
|
|
3453
|
-
} catch (
|
|
3454
|
-
throw this.debugLog("Error fetching categories",
|
|
3457
|
+
} catch (r) {
|
|
3458
|
+
throw this.debugLog("Error fetching categories", r), r;
|
|
3455
3459
|
}
|
|
3456
3460
|
}
|
|
3457
3461
|
}
|
|
3458
|
-
const
|
|
3462
|
+
const Qt = u`
|
|
3459
3463
|
mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
|
|
3460
3464
|
createShopView(id: $id, trackerId: $trackerLinkId)
|
|
3461
3465
|
}
|
|
3462
|
-
`,
|
|
3466
|
+
`, Xt = u`
|
|
3463
3467
|
mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3464
3468
|
createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3465
3469
|
}
|
|
3466
|
-
`,
|
|
3470
|
+
`, Wt = u`
|
|
3467
3471
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3468
3472
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3469
3473
|
}
|
|
3470
|
-
`,
|
|
3471
|
-
function
|
|
3474
|
+
`, Zt = (e, t, n, r) => e();
|
|
3475
|
+
function Kt(e, t = Zt) {
|
|
3472
3476
|
return {
|
|
3473
|
-
CreateShopView(n,
|
|
3474
|
-
return
|
|
3477
|
+
CreateShopView(n, r, i) {
|
|
3478
|
+
return t((s) => e.request({ document: Qt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateShopView", "mutation", n);
|
|
3475
3479
|
},
|
|
3476
|
-
CreateEventView(n,
|
|
3477
|
-
return
|
|
3480
|
+
CreateEventView(n, r, i) {
|
|
3481
|
+
return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateEventView", "mutation", n);
|
|
3478
3482
|
},
|
|
3479
|
-
CreatePackageView(n,
|
|
3480
|
-
return
|
|
3483
|
+
CreatePackageView(n, r, i) {
|
|
3484
|
+
return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreatePackageView", "mutation", n);
|
|
3481
3485
|
}
|
|
3482
3486
|
};
|
|
3483
3487
|
}
|
|
3484
|
-
class
|
|
3488
|
+
class en {
|
|
3485
3489
|
config;
|
|
3486
3490
|
sdk;
|
|
3487
|
-
constructor(
|
|
3488
|
-
this.config =
|
|
3491
|
+
constructor(t) {
|
|
3492
|
+
this.config = t, this.sdk = Kt(new T(t.apiUrl));
|
|
3489
3493
|
}
|
|
3490
|
-
createMetric = async (
|
|
3491
|
-
switch (!n && !
|
|
3492
|
-
id:
|
|
3494
|
+
createMetric = async (t, n, r) => {
|
|
3495
|
+
switch (!n && !r && await this.sdk.CreateShopView({
|
|
3496
|
+
id: t,
|
|
3493
3497
|
trackerLinkId: this.config.trackerId
|
|
3494
|
-
}),
|
|
3498
|
+
}), r) {
|
|
3495
3499
|
case F.Event:
|
|
3496
3500
|
await this.sdk.CreateEventView({
|
|
3497
|
-
id:
|
|
3501
|
+
id: t,
|
|
3498
3502
|
shopId: n,
|
|
3499
3503
|
trackerLinkId: this.config.trackerId
|
|
3500
3504
|
});
|
|
@@ -3502,7 +3506,7 @@ class Wt {
|
|
|
3502
3506
|
case F.Package:
|
|
3503
3507
|
await this.sdk.CreatePackageView(
|
|
3504
3508
|
{
|
|
3505
|
-
id:
|
|
3509
|
+
id: t,
|
|
3506
3510
|
shopId: n,
|
|
3507
3511
|
trackerLinkId: this.config.trackerId
|
|
3508
3512
|
}
|
|
@@ -3511,7 +3515,7 @@ class Wt {
|
|
|
3511
3515
|
}
|
|
3512
3516
|
};
|
|
3513
3517
|
}
|
|
3514
|
-
const
|
|
3518
|
+
const tn = u`
|
|
3515
3519
|
query getShopBySlug($slug: String!, $trackerLinkId: String) {
|
|
3516
3520
|
findShopBySlug(slug: $slug, promoterId: $trackerLinkId) {
|
|
3517
3521
|
id
|
|
@@ -3555,39 +3559,88 @@ const Zt = u`
|
|
|
3555
3559
|
blockedLanguages
|
|
3556
3560
|
}
|
|
3557
3561
|
}
|
|
3558
|
-
`,
|
|
3559
|
-
function
|
|
3562
|
+
`, nn = (e, t, n, r) => e();
|
|
3563
|
+
function rn(e, t = nn) {
|
|
3560
3564
|
return {
|
|
3561
|
-
getShopBySlug(n,
|
|
3562
|
-
return
|
|
3565
|
+
getShopBySlug(n, r, i) {
|
|
3566
|
+
return t((s) => e.request({ document: tn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "getShopBySlug", "query", n);
|
|
3563
3567
|
}
|
|
3564
3568
|
};
|
|
3565
3569
|
}
|
|
3566
|
-
class
|
|
3570
|
+
class sn {
|
|
3567
3571
|
config;
|
|
3568
3572
|
sdk;
|
|
3569
|
-
constructor(
|
|
3570
|
-
this.config =
|
|
3573
|
+
constructor(t) {
|
|
3574
|
+
this.config = t, this.sdk = rn(new T(t.apiUrl));
|
|
3571
3575
|
}
|
|
3572
|
-
async getShop(
|
|
3576
|
+
async getShop(t) {
|
|
3573
3577
|
try {
|
|
3574
|
-
this.debugLog("Fetching shop", { slug:
|
|
3575
|
-
const n = await this.sdk.getShopBySlug({ slug:
|
|
3578
|
+
this.debugLog("Fetching shop", { slug: t });
|
|
3579
|
+
const n = await this.sdk.getShopBySlug({ slug: t, trackerLinkId: this.config.trackerId });
|
|
3576
3580
|
if (this.debugLog("Raw GraphQL response", n), n?.findShopBySlug) {
|
|
3577
|
-
const
|
|
3578
|
-
return this.debugLog("Public Shop fetched"),
|
|
3581
|
+
const r = n.findShopBySlug;
|
|
3582
|
+
return this.debugLog("Public Shop fetched"), r;
|
|
3579
3583
|
}
|
|
3580
3584
|
return null;
|
|
3581
3585
|
} catch (n) {
|
|
3582
3586
|
throw this.debugLog("Error fetching single Shop", n), n;
|
|
3583
3587
|
}
|
|
3584
3588
|
}
|
|
3585
|
-
debugLog(
|
|
3586
|
-
this.config.debug && console.log(`[ShopService] ${
|
|
3589
|
+
debugLog(t, n) {
|
|
3590
|
+
this.config.debug && console.log(`[ShopService] ${t}`, n || "");
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
const an = u`
|
|
3594
|
+
query findAllCustomFieldsByOrderId($orderId: String!, $salesLocations: [SalesLocations!]) {
|
|
3595
|
+
findAllCustomFieldsByOrderId(orderId: $orderId, salesLocations: $salesLocations) {
|
|
3596
|
+
id
|
|
3597
|
+
label
|
|
3598
|
+
name
|
|
3599
|
+
type
|
|
3600
|
+
salesLocations
|
|
3601
|
+
typeOptions {
|
|
3602
|
+
key
|
|
3603
|
+
value
|
|
3604
|
+
}
|
|
3605
|
+
defaultValue
|
|
3606
|
+
mandatoryType
|
|
3607
|
+
placeholder
|
|
3608
|
+
required
|
|
3609
|
+
confirm
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
`, on = (e, t, n, r) => e();
|
|
3613
|
+
function cn(e, t = on) {
|
|
3614
|
+
return {
|
|
3615
|
+
findAllCustomFieldsByOrderId(n, r, i) {
|
|
3616
|
+
return t((s) => e.request({ document: an, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllCustomFieldsByOrderId", "query", n);
|
|
3617
|
+
}
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
class dn {
|
|
3621
|
+
config;
|
|
3622
|
+
sdk;
|
|
3623
|
+
constructor(t) {
|
|
3624
|
+
this.config = t, this.sdk = cn(new T(t.apiUrl));
|
|
3625
|
+
}
|
|
3626
|
+
async findByOrderId(t, n) {
|
|
3627
|
+
try {
|
|
3628
|
+
this.debugLog("Fetching custom fields for order", { orderId: t, salesLocations: n });
|
|
3629
|
+
const r = await this.sdk.findAllCustomFieldsByOrderId({
|
|
3630
|
+
orderId: t,
|
|
3631
|
+
salesLocations: n || null
|
|
3632
|
+
});
|
|
3633
|
+
return this.debugLog("Custom fields fetched successfully", r.findAllCustomFieldsByOrderId), r.findAllCustomFieldsByOrderId;
|
|
3634
|
+
} catch (r) {
|
|
3635
|
+
throw this.debugLog("Error fetching custom fields for order", r), r;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
debugLog(t, n) {
|
|
3639
|
+
this.config.debug && console.log(`[CustomFieldService] ${t}`, n || "");
|
|
3587
3640
|
}
|
|
3588
3641
|
}
|
|
3589
|
-
const
|
|
3590
|
-
class
|
|
3642
|
+
const un = "https://api.ticketapp.com/graphql";
|
|
3643
|
+
class pn {
|
|
3591
3644
|
basket;
|
|
3592
3645
|
event;
|
|
3593
3646
|
payment;
|
|
@@ -3595,15 +3648,18 @@ class an {
|
|
|
3595
3648
|
category;
|
|
3596
3649
|
metric;
|
|
3597
3650
|
shop;
|
|
3651
|
+
customField;
|
|
3598
3652
|
// Attach selected public types to the SDK class
|
|
3599
|
-
static Types =
|
|
3600
|
-
constructor(
|
|
3601
|
-
const { organizationId: n, debug:
|
|
3602
|
-
this.event = new
|
|
3653
|
+
static Types = ve;
|
|
3654
|
+
constructor(t) {
|
|
3655
|
+
const { organizationId: n, debug: r = !1, apiUrl: i = un } = t;
|
|
3656
|
+
this.event = new Ct({ organizationId: n, debug: r, apiUrl: i, trackerId: t.trackerId }), this.package = new Gt({ organizationId: n, debug: r, apiUrl: i }), this.category = new Jt({ organizationId: n, debug: r, apiUrl: i }), this.metric = new en({ apiUrl: i, trackerId: t.trackerId }), this.shop = new sn({ debug: r, apiUrl: i, trackerId: t.trackerId }), this.customField = new dn({ debug: r, apiUrl: i }), this.basket = new Dt({ debug: r, apiUrl: i, trackerId: t.trackerId }), this.payment = new $t({ debug: r, apiUrl: i });
|
|
3603
3657
|
}
|
|
3604
3658
|
}
|
|
3605
3659
|
export {
|
|
3606
|
-
|
|
3660
|
+
N as BasketOrderType,
|
|
3661
|
+
ue as CustomFieldMandatoryType,
|
|
3662
|
+
de as CustomFieldType,
|
|
3607
3663
|
ae as DiscountType,
|
|
3608
3664
|
ee as EventStatus,
|
|
3609
3665
|
F as MetricsType,
|
|
@@ -3611,11 +3667,12 @@ export {
|
|
|
3611
3667
|
R as PackageItemType,
|
|
3612
3668
|
Z as PackageStatus,
|
|
3613
3669
|
K as PackageTabType,
|
|
3614
|
-
|
|
3670
|
+
ie as PaymentMethodFeeType,
|
|
3615
3671
|
ne as ProductStatus,
|
|
3616
|
-
|
|
3672
|
+
re as ProductType,
|
|
3673
|
+
le as SalesLocations,
|
|
3617
3674
|
oe as ShopTemplateType,
|
|
3618
3675
|
ce as ShopVariationType,
|
|
3619
3676
|
te as SortOrder,
|
|
3620
|
-
|
|
3677
|
+
pn as TicketappSDK
|
|
3621
3678
|
};
|