@ticketapp-dev/shop-sdk 1.0.47 → 1.0.49
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 +755 -699
- 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/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +42 -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
|
|
1
|
+
import { GraphQLClient as T } from "graphql-request";
|
|
2
2
|
import { DateTime as k } from "luxon";
|
|
3
|
-
var
|
|
4
|
-
const
|
|
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 || {}), ie = /* @__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))(ie || {}), re = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(re || {}), 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,
|
|
@@ -14,88 +16,89 @@ const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
14
16
|
PaymentMethodFeeType: re,
|
|
15
17
|
ProductStatus: ne,
|
|
16
18
|
ProductType: ie,
|
|
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(
|
|
25
|
+
return w = Object.assign || function(t) {
|
|
23
26
|
for (var n, i = 1, r = arguments.length; i < r; i++) {
|
|
24
27
|
n = arguments[i];
|
|
25
|
-
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (
|
|
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(
|
|
46
|
+
const Se = /\r\n|[\n\r]/g;
|
|
47
|
+
function z(e, t) {
|
|
45
48
|
let n = 0, i = 1;
|
|
46
|
-
for (const r of
|
|
47
|
-
if (typeof r.index == "number" ||
|
|
49
|
+
for (const r of e.body.matchAll(Se)) {
|
|
50
|
+
if (typeof r.index == "number" || be(!1), r.index >= t)
|
|
48
51
|
break;
|
|
49
52
|
n = r.index + r[0].length, i += 1;
|
|
50
53
|
}
|
|
51
54
|
return {
|
|
52
55
|
line: i,
|
|
53
|
-
column:
|
|
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 =
|
|
65
|
+
function he(e, t) {
|
|
66
|
+
const n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, l = t.line === 1 ? n : 0, h = t.column + l, E = `${e.name}:${o}:${h}
|
|
64
67
|
`, g = i.split(/\r\n|[\n\r]/g), d = g[r];
|
|
65
68
|
if (d.length > 120) {
|
|
66
|
-
const m = Math.floor(
|
|
69
|
+
const m = Math.floor(h / 80), y = h % 80, p = [];
|
|
67
70
|
for (let O = 0; O < d.length; O += 80)
|
|
68
|
-
|
|
71
|
+
p.push(d.slice(O, O + 80));
|
|
69
72
|
return E + Q([
|
|
70
|
-
[`${o} |`,
|
|
71
|
-
...
|
|
73
|
+
[`${o} |`, p[0]],
|
|
74
|
+
...p.slice(1, m + 1).map((O) => ["|", O]),
|
|
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
81
|
[`${o - 1} |`, g[r - 1]],
|
|
79
82
|
[`${o} |`, d],
|
|
80
|
-
["|", "^".padStart(
|
|
83
|
+
["|", "^".padStart(h)],
|
|
81
84
|
[`${o + 1} |`, g[r + 1]]
|
|
82
85
|
]);
|
|
83
86
|
}
|
|
84
|
-
function Q(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
+
function Q(e) {
|
|
88
|
+
const t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
89
|
+
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).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(
|
|
142
|
+
constructor(t, ...n) {
|
|
140
143
|
var i, r, s;
|
|
141
|
-
const { nodes: o, source: l, positions:
|
|
142
|
-
super(
|
|
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
|
-
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((
|
|
149
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((p) => p.loc).filter((p) => p != null)
|
|
147
150
|
);
|
|
148
|
-
this.source = l ?? (m == null || (r = m[0]) === null || r === void 0 ? void 0 : r.source), this.positions =
|
|
149
|
-
const y =
|
|
151
|
+
this.source = l ?? (m == null || (r = m[0]) === null || r === void 0 ? void 0 : r.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, i) {
|
|
235
|
+
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
|
|
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, i, r, s, o) {
|
|
275
|
+
this.kind = t, this.start = n, this.end = i, this.line = r, 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
|
|
406
|
+
function we(e) {
|
|
407
|
+
var t;
|
|
405
408
|
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
406
|
-
for (let o = 0; o <
|
|
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 && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && h < n && (n = h));
|
|
410
413
|
}
|
|
411
|
-
return
|
|
412
|
-
(
|
|
414
|
+
return e.map((o, l) => l === 0 ? o : o.slice(n)).slice(
|
|
415
|
+
(t = i) !== null && t !== void 0 ? t : 0,
|
|
413
416
|
r + 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,36 +457,36 @@ 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) {
|
|
@@ -492,13 +495,13 @@ function D(t, e) {
|
|
|
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, i, r) {
|
|
499
|
+
const s = e.line, o = 1 + n - e.lineStart;
|
|
500
|
+
return new pe(t, n, i, s, o, r);
|
|
498
501
|
}
|
|
499
|
-
function
|
|
500
|
-
const n =
|
|
501
|
-
let r =
|
|
502
|
+
function Ve(e, t) {
|
|
503
|
+
const n = e.source.body, i = n.length;
|
|
504
|
+
let r = t;
|
|
502
505
|
for (; r < i; ) {
|
|
503
506
|
const s = n.charCodeAt(r);
|
|
504
507
|
switch (s) {
|
|
@@ -530,14 +533,14 @@ function $e(t, e) {
|
|
|
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
|
-
++r, ++
|
|
536
|
+
++r, ++e.line, e.lineStart = r;
|
|
534
537
|
continue;
|
|
535
538
|
case 13:
|
|
536
|
-
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++
|
|
539
|
+
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
537
540
|
continue;
|
|
538
541
|
// Comment
|
|
539
542
|
case 35:
|
|
540
|
-
return
|
|
543
|
+
return Me(e, r);
|
|
541
544
|
// Token ::
|
|
542
545
|
// - Punctuator
|
|
543
546
|
// - Name
|
|
@@ -547,54 +550,54 @@ function $e(t, e) {
|
|
|
547
550
|
//
|
|
548
551
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
549
552
|
case 33:
|
|
550
|
-
return f(
|
|
553
|
+
return f(e, a.BANG, r, r + 1);
|
|
551
554
|
case 36:
|
|
552
|
-
return f(
|
|
555
|
+
return f(e, a.DOLLAR, r, r + 1);
|
|
553
556
|
case 38:
|
|
554
|
-
return f(
|
|
557
|
+
return f(e, a.AMP, r, r + 1);
|
|
555
558
|
case 40:
|
|
556
|
-
return f(
|
|
559
|
+
return f(e, a.PAREN_L, r, r + 1);
|
|
557
560
|
case 41:
|
|
558
|
-
return f(
|
|
561
|
+
return f(e, a.PAREN_R, r, r + 1);
|
|
559
562
|
case 46:
|
|
560
563
|
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
561
|
-
return f(
|
|
564
|
+
return f(e, a.SPREAD, r, r + 3);
|
|
562
565
|
break;
|
|
563
566
|
case 58:
|
|
564
|
-
return f(
|
|
567
|
+
return f(e, a.COLON, r, r + 1);
|
|
565
568
|
case 61:
|
|
566
|
-
return f(
|
|
569
|
+
return f(e, a.EQUALS, r, r + 1);
|
|
567
570
|
case 64:
|
|
568
|
-
return f(
|
|
571
|
+
return f(e, a.AT, r, r + 1);
|
|
569
572
|
case 91:
|
|
570
|
-
return f(
|
|
573
|
+
return f(e, a.BRACKET_L, r, r + 1);
|
|
571
574
|
case 93:
|
|
572
|
-
return f(
|
|
575
|
+
return f(e, a.BRACKET_R, r, r + 1);
|
|
573
576
|
case 123:
|
|
574
|
-
return f(
|
|
577
|
+
return f(e, a.BRACE_L, r, r + 1);
|
|
575
578
|
case 124:
|
|
576
|
-
return f(
|
|
579
|
+
return f(e, a.PIPE, r, r + 1);
|
|
577
580
|
case 125:
|
|
578
|
-
return f(
|
|
581
|
+
return f(e, a.BRACE_R, r, r + 1);
|
|
579
582
|
// StringValue
|
|
580
583
|
case 34:
|
|
581
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
584
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? He(e, r) : qe(e, r);
|
|
582
585
|
}
|
|
583
586
|
if (x(s) || s === 45)
|
|
584
|
-
return
|
|
585
|
-
if (
|
|
586
|
-
return
|
|
587
|
+
return ze(e, r, s);
|
|
588
|
+
if (me(s))
|
|
589
|
+
return Je(e, r);
|
|
587
590
|
throw I(
|
|
588
|
-
|
|
591
|
+
e.source,
|
|
589
592
|
r,
|
|
590
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || B(n, r) ? `Unexpected character: ${D(
|
|
593
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || B(n, r) ? `Unexpected character: ${D(e, r)}.` : `Invalid character: ${D(e, r)}.`
|
|
591
594
|
);
|
|
592
595
|
}
|
|
593
|
-
return f(
|
|
596
|
+
return f(e, a.EOF, i, i);
|
|
594
597
|
}
|
|
595
|
-
function
|
|
596
|
-
const n =
|
|
597
|
-
let r =
|
|
598
|
+
function Me(e, t) {
|
|
599
|
+
const n = e.source.body, i = n.length;
|
|
600
|
+
let r = t + 1;
|
|
598
601
|
for (; r < i; ) {
|
|
599
602
|
const s = n.charCodeAt(r);
|
|
600
603
|
if (s === 10 || s === 13)
|
|
@@ -607,72 +610,72 @@ function Be(t, e) {
|
|
|
607
610
|
break;
|
|
608
611
|
}
|
|
609
612
|
return f(
|
|
610
|
-
t,
|
|
611
|
-
a.COMMENT,
|
|
612
613
|
e,
|
|
614
|
+
a.COMMENT,
|
|
615
|
+
t,
|
|
613
616
|
r,
|
|
614
|
-
n.slice(
|
|
617
|
+
n.slice(t + 1, r)
|
|
615
618
|
);
|
|
616
619
|
}
|
|
617
|
-
function
|
|
618
|
-
const i =
|
|
619
|
-
let r =
|
|
620
|
+
function ze(e, t, n) {
|
|
621
|
+
const i = e.source.body;
|
|
622
|
+
let r = t, s = n, o = !1;
|
|
620
623
|
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
621
624
|
if (s = i.charCodeAt(++r), x(s))
|
|
622
625
|
throw I(
|
|
623
|
-
|
|
626
|
+
e.source,
|
|
624
627
|
r,
|
|
625
628
|
`Invalid number, unexpected digit after 0: ${D(
|
|
626
|
-
|
|
629
|
+
e,
|
|
627
630
|
r
|
|
628
631
|
)}.`
|
|
629
632
|
);
|
|
630
633
|
} else
|
|
631
|
-
r = M(
|
|
632
|
-
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(
|
|
634
|
+
r = M(e, r, s), s = i.charCodeAt(r);
|
|
635
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = M(e, r, s), s = i.charCodeAt(r)), s === 46 || me(s))
|
|
633
636
|
throw I(
|
|
634
|
-
|
|
637
|
+
e.source,
|
|
635
638
|
r,
|
|
636
639
|
`Invalid number, expected digit but got: ${D(
|
|
637
|
-
|
|
640
|
+
e,
|
|
638
641
|
r
|
|
639
642
|
)}.`
|
|
640
643
|
);
|
|
641
644
|
return f(
|
|
642
|
-
t,
|
|
643
|
-
o ? a.FLOAT : a.INT,
|
|
644
645
|
e,
|
|
646
|
+
o ? a.FLOAT : a.INT,
|
|
647
|
+
t,
|
|
645
648
|
r,
|
|
646
|
-
i.slice(
|
|
649
|
+
i.slice(t, r)
|
|
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 i =
|
|
660
|
-
let r =
|
|
662
|
+
const i = e.source.body;
|
|
663
|
+
let r = t + 1;
|
|
661
664
|
for (; x(i.charCodeAt(r)); )
|
|
662
665
|
++r;
|
|
663
666
|
return r;
|
|
664
667
|
}
|
|
665
|
-
function
|
|
666
|
-
const n =
|
|
667
|
-
let r =
|
|
668
|
+
function qe(e, t) {
|
|
669
|
+
const n = e.source.body, i = n.length;
|
|
670
|
+
let r = t + 1, s = r, o = "";
|
|
668
671
|
for (; r < i; ) {
|
|
669
672
|
const l = n.charCodeAt(r);
|
|
670
673
|
if (l === 34)
|
|
671
|
-
return o += n.slice(s, r), f(
|
|
674
|
+
return o += n.slice(s, r), f(e, a.STRING, t, r + 1, o);
|
|
672
675
|
if (l === 92) {
|
|
673
676
|
o += n.slice(s, r);
|
|
674
|
-
const
|
|
675
|
-
o +=
|
|
677
|
+
const h = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Ge(e, r) : je(e, r) : Ye(e, r);
|
|
678
|
+
o += h.value, r += h.size, s = r;
|
|
676
679
|
continue;
|
|
677
680
|
}
|
|
678
681
|
if (l === 10 || l === 13)
|
|
@@ -683,21 +686,21 @@ function Ue(t, e) {
|
|
|
683
686
|
r += 2;
|
|
684
687
|
else
|
|
685
688
|
throw I(
|
|
686
|
-
|
|
689
|
+
e.source,
|
|
687
690
|
r,
|
|
688
691
|
`Invalid character within String: ${D(
|
|
689
|
-
|
|
692
|
+
e,
|
|
690
693
|
r
|
|
691
694
|
)}.`
|
|
692
695
|
);
|
|
693
696
|
}
|
|
694
|
-
throw I(
|
|
697
|
+
throw I(e.source, r, "Unterminated string.");
|
|
695
698
|
}
|
|
696
|
-
function
|
|
697
|
-
const n =
|
|
699
|
+
function Ge(e, t) {
|
|
700
|
+
const n = e.source.body;
|
|
698
701
|
let i = 0, r = 3;
|
|
699
702
|
for (; r < 12; ) {
|
|
700
|
-
const s = n.charCodeAt(
|
|
703
|
+
const s = n.charCodeAt(t + r++);
|
|
701
704
|
if (s === 125) {
|
|
702
705
|
if (r < 5 || !P(i))
|
|
703
706
|
break;
|
|
@@ -710,44 +713,44 @@ function Me(t, e) {
|
|
|
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 + r
|
|
718
721
|
)}".`
|
|
719
722
|
);
|
|
720
723
|
}
|
|
721
|
-
function
|
|
722
|
-
const n =
|
|
724
|
+
function je(e, t) {
|
|
725
|
+
const n = e.source.body, i = W(n, t + 2);
|
|
723
726
|
if (P(i))
|
|
724
727
|
return {
|
|
725
728
|
value: String.fromCodePoint(i),
|
|
726
729
|
size: 6
|
|
727
730
|
};
|
|
728
|
-
if (
|
|
729
|
-
const r = W(n,
|
|
730
|
-
if (
|
|
731
|
+
if (fe(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
732
|
+
const r = W(n, t + 8);
|
|
733
|
+
if (Ie(r))
|
|
731
734
|
return {
|
|
732
735
|
value: String.fromCodePoint(i, r),
|
|
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 r =
|
|
805
|
-
const
|
|
805
|
+
function He(e, t) {
|
|
806
|
+
const n = e.source.body, i = n.length;
|
|
807
|
+
let r = e.lineStart, s = t + 3, o = s, l = "";
|
|
808
|
+
const h = [];
|
|
806
809
|
for (; s < i; ) {
|
|
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 = r, 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, r = s;
|
|
827
830
|
continue;
|
|
828
831
|
}
|
|
829
832
|
if (P(E))
|
|
@@ -832,109 +835,109 @@ 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 r =
|
|
848
|
+
function Je(e, t) {
|
|
849
|
+
const n = e.source.body, i = n.length;
|
|
850
|
+
let r = t + 1;
|
|
848
851
|
for (; r < i; ) {
|
|
849
852
|
const s = n.charCodeAt(r);
|
|
850
|
-
if (
|
|
853
|
+
if (Fe(s))
|
|
851
854
|
++r;
|
|
852
855
|
else
|
|
853
856
|
break;
|
|
854
857
|
}
|
|
855
858
|
return f(
|
|
856
|
-
t,
|
|
857
|
-
a.NAME,
|
|
858
859
|
e,
|
|
860
|
+
a.NAME,
|
|
861
|
+
t,
|
|
859
862
|
r,
|
|
860
|
-
n.slice(
|
|
863
|
+
n.slice(t, r)
|
|
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 i =
|
|
887
|
-
if (i !==
|
|
888
|
-
return typeof i == "string" ? i :
|
|
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
|
-
([r, s]) => r + ": " +
|
|
887
|
+
const n = [...t, e];
|
|
888
|
+
if (We(e)) {
|
|
889
|
+
const i = e.toJSON();
|
|
890
|
+
if (i !== e)
|
|
891
|
+
return typeof i == "string" ? i : U(i, 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
|
+
([r, s]) => r + ": " + 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), i = e.length - n, r = [];
|
|
908
911
|
for (let s = 0; s < n; ++s)
|
|
909
|
-
r.push(
|
|
912
|
+
r.push(U(e[s], t));
|
|
910
913
|
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.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
|
|
933
|
+
if (typeof t == "object" && t !== null) {
|
|
931
934
|
var i;
|
|
932
935
|
const r = 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] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
|
|
935
938
|
);
|
|
936
939
|
if (r === s) {
|
|
937
|
-
const o =
|
|
940
|
+
const o = ye(t);
|
|
938
941
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
939
942
|
|
|
940
943
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -952,15 +955,15 @@ spurious results.`);
|
|
|
952
955
|
return !1;
|
|
953
956
|
}
|
|
954
957
|
);
|
|
955
|
-
class
|
|
956
|
-
constructor(
|
|
958
|
+
class ke {
|
|
959
|
+
constructor(t, n = "GraphQL request", i = {
|
|
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 = i, 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,24 +972,24 @@ class Ie {
|
|
|
969
972
|
return "Source";
|
|
970
973
|
}
|
|
971
974
|
}
|
|
972
|
-
function
|
|
973
|
-
return
|
|
975
|
+
function it(e) {
|
|
976
|
+
return nt(e, ke);
|
|
974
977
|
}
|
|
975
|
-
function
|
|
976
|
-
const n = new
|
|
978
|
+
function rt(e, t) {
|
|
979
|
+
const n = new st(e, t), i = n.parseDocument();
|
|
977
980
|
return Object.defineProperty(i, "tokenCount", {
|
|
978
981
|
enumerable: !1,
|
|
979
982
|
value: n.tokenCount
|
|
980
983
|
}), i;
|
|
981
984
|
}
|
|
982
|
-
class
|
|
983
|
-
constructor(
|
|
985
|
+
class st {
|
|
986
|
+
constructor(t, n = {}) {
|
|
984
987
|
const { lexer: i, ...r } = n;
|
|
985
988
|
if (i)
|
|
986
989
|
this._lexer = i;
|
|
987
990
|
else {
|
|
988
|
-
const s =
|
|
989
|
-
this._lexer = new
|
|
991
|
+
const s = it(t) ? t : new ke(t);
|
|
992
|
+
this._lexer = new Be(s);
|
|
990
993
|
}
|
|
991
994
|
this._options = r, this._tokenCounter = 0;
|
|
992
995
|
}
|
|
@@ -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,11 +1098,11 @@ 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: [],
|
|
@@ -1108,7 +1111,7 @@ class nt {
|
|
|
1108
1111
|
});
|
|
1109
1112
|
const n = this.parseDescription(), i = this.parseOperationType();
|
|
1110
1113
|
let r;
|
|
1111
|
-
return this.peek(a.NAME) && (r = this.parseName()), this.node(
|
|
1114
|
+
return this.peek(a.NAME) && (r = this.parseName()), this.node(t, {
|
|
1112
1115
|
kind: c.OPERATION_DEFINITION,
|
|
1113
1116
|
operation: i,
|
|
1114
1117
|
description: n,
|
|
@@ -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,9 +1199,9 @@ class nt {
|
|
|
1196
1199
|
* Alias : Name :
|
|
1197
1200
|
*/
|
|
1198
1201
|
parseField() {
|
|
1199
|
-
const
|
|
1202
|
+
const t = this._lexer.token, n = this.parseName();
|
|
1200
1203
|
let i, r;
|
|
1201
|
-
return this.expectOptionalToken(a.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(
|
|
1204
|
+
return this.expectOptionalToken(a.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
|
|
1202
1205
|
kind: c.FIELD,
|
|
1203
1206
|
alias: i,
|
|
1204
1207
|
name: r,
|
|
@@ -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(
|
|
1223
|
+
parseArgument(t = !1) {
|
|
1221
1224
|
const n = this._lexer.token, i = this.parseName();
|
|
1222
1225
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1223
1226
|
kind: c.ARGUMENT,
|
|
1224
1227
|
name: i,
|
|
1225
|
-
value: this.parseValueLiteral(
|
|
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,7 +1349,7 @@ 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
1354
|
const i = this._lexer.token.value;
|
|
1352
1355
|
throw I(
|
|
@@ -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(
|
|
1407
|
+
parseObjectField(t) {
|
|
1405
1408
|
const n = this._lexer.token, i = this.parseName();
|
|
1406
1409
|
return this.expectToken(a.COLON), this.node(n, {
|
|
1407
1410
|
kind: c.OBJECT_FIELD,
|
|
1408
1411
|
name: i,
|
|
1409
|
-
value: this.parseValueLiteral(
|
|
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
1452
|
const i = this.parseTypeReference();
|
|
1450
|
-
this.expectToken(a.BRACKET_R), n = this.node(
|
|
1453
|
+
this.expectToken(a.BRACKET_R), n = this.node(t, {
|
|
1451
1454
|
kind: c.LIST_TYPE,
|
|
1452
1455
|
type: i
|
|
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,14 +1487,14 @@ 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
1492
|
const i = this.parseConstDirectives(), r = 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
1500
|
directives: i,
|
|
@@ -1502,10 +1505,10 @@ class nt {
|
|
|
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
1510
|
const i = this.parseNamedType();
|
|
1508
|
-
return this.node(
|
|
1511
|
+
return this.node(t, {
|
|
1509
1512
|
kind: c.OPERATION_TYPE_DEFINITION,
|
|
1510
1513
|
operation: n,
|
|
1511
1514
|
type: i
|
|
@@ -1515,10 +1518,10 @@ class nt {
|
|
|
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
1523
|
const i = this.parseName(), r = this.parseConstDirectives();
|
|
1521
|
-
return this.node(
|
|
1524
|
+
return this.node(t, {
|
|
1522
1525
|
kind: c.SCALAR_TYPE_DEFINITION,
|
|
1523
1526
|
description: n,
|
|
1524
1527
|
name: i,
|
|
@@ -1531,10 +1534,10 @@ 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
1539
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1537
|
-
return this.node(
|
|
1540
|
+
return this.node(t, {
|
|
1538
1541
|
kind: c.OBJECT_TYPE_DEFINITION,
|
|
1539
1542
|
description: n,
|
|
1540
1543
|
name: i,
|
|
@@ -1568,10 +1571,10 @@ 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(), i = this.parseName(), r = 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
1580
|
name: i,
|
|
@@ -1595,13 +1598,13 @@ 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(), i = this.parseName();
|
|
1599
1602
|
this.expectToken(a.COLON);
|
|
1600
1603
|
const r = 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
1610
|
name: i,
|
|
@@ -1615,10 +1618,10 @@ 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
1623
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1621
|
-
return this.node(
|
|
1624
|
+
return this.node(t, {
|
|
1622
1625
|
kind: c.INTERFACE_TYPE_DEFINITION,
|
|
1623
1626
|
description: n,
|
|
1624
1627
|
name: i,
|
|
@@ -1632,10 +1635,10 @@ 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
1640
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1638
|
-
return this.node(
|
|
1641
|
+
return this.node(t, {
|
|
1639
1642
|
kind: c.UNION_TYPE_DEFINITION,
|
|
1640
1643
|
description: n,
|
|
1641
1644
|
name: i,
|
|
@@ -1656,10 +1659,10 @@ 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
1664
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1662
|
-
return this.node(
|
|
1665
|
+
return this.node(t, {
|
|
1663
1666
|
kind: c.ENUM_TYPE_DEFINITION,
|
|
1664
1667
|
description: n,
|
|
1665
1668
|
name: i,
|
|
@@ -1683,8 +1686,8 @@ 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(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1690
|
+
return this.node(t, {
|
|
1688
1691
|
kind: c.ENUM_VALUE_DEFINITION,
|
|
1689
1692
|
description: n,
|
|
1690
1693
|
name: i,
|
|
@@ -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,10 +1713,10 @@ 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
1718
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1716
|
-
return this.node(
|
|
1719
|
+
return this.node(t, {
|
|
1717
1720
|
kind: c.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1718
1721
|
description: n,
|
|
1719
1722
|
name: i,
|
|
@@ -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,7 +1778,7 @@ 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
1783
|
const n = this.parseConstDirectives(), i = this.optionalMany(
|
|
1781
1784
|
a.BRACE_L,
|
|
@@ -1784,7 +1787,7 @@ class nt {
|
|
|
1784
1787
|
);
|
|
1785
1788
|
if (n.length === 0 && i.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
1793
|
operationTypes: i
|
|
@@ -1795,12 +1798,12 @@ 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
1803
|
const n = this.parseName(), i = this.parseConstDirectives();
|
|
1801
1804
|
if (i.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
1809
|
directives: i
|
|
@@ -1813,12 +1816,12 @@ 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
1821
|
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1819
1822
|
if (i.length === 0 && r.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
1827
|
interfaces: i,
|
|
@@ -1833,12 +1836,12 @@ 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
1841
|
const n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1839
1842
|
if (i.length === 0 && r.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
1847
|
interfaces: i,
|
|
@@ -1852,12 +1855,12 @@ 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
1860
|
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1858
1861
|
if (i.length === 0 && r.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
1866
|
directives: i,
|
|
@@ -1870,12 +1873,12 @@ 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
1878
|
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1876
1879
|
if (i.length === 0 && r.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
1884
|
directives: i,
|
|
@@ -1888,12 +1891,12 @@ 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
1896
|
const n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1894
1897
|
if (i.length === 0 && r.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
1902
|
directives: i,
|
|
@@ -1907,12 +1910,12 @@ 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
1915
|
const i = this.parseName(), r = 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
1921
|
name: i,
|
|
@@ -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,27 +1975,27 @@ class nt {
|
|
|
1972
1975
|
* - \@ Name ( Name : )
|
|
1973
1976
|
*/
|
|
1974
1977
|
parseSchemaCoordinate() {
|
|
1975
|
-
const
|
|
1978
|
+
const t = this._lexer.token, n = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1976
1979
|
let r;
|
|
1977
1980
|
!n && this.expectOptionalToken(a.DOT) && (r = this.parseName());
|
|
1978
1981
|
let s;
|
|
1979
|
-
return (n || r) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), n ? s ? this.node(
|
|
1982
|
+
return (n || r) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), n ? s ? this.node(t, {
|
|
1980
1983
|
kind: c.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1981
1984
|
name: i,
|
|
1982
1985
|
argumentName: s
|
|
1983
|
-
}) : this.node(
|
|
1986
|
+
}) : this.node(t, {
|
|
1984
1987
|
kind: c.DIRECTIVE_COORDINATE,
|
|
1985
1988
|
name: i
|
|
1986
|
-
}) : r ? s ? this.node(
|
|
1989
|
+
}) : r ? s ? this.node(t, {
|
|
1987
1990
|
kind: c.ARGUMENT_COORDINATE,
|
|
1988
1991
|
name: i,
|
|
1989
1992
|
fieldName: r,
|
|
1990
1993
|
argumentName: s
|
|
1991
|
-
}) : this.node(
|
|
1994
|
+
}) : this.node(t, {
|
|
1992
1995
|
kind: c.MEMBER_COORDINATE,
|
|
1993
1996
|
name: i,
|
|
1994
1997
|
memberName: r
|
|
1995
|
-
}) : this.node(
|
|
1998
|
+
}) : this.node(t, {
|
|
1996
1999
|
kind: c.TYPE_COORDINATE,
|
|
1997
2000
|
name: i
|
|
1998
2001
|
});
|
|
@@ -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 ${Oe(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,8 +2079,8 @@ 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(
|
|
2082
|
+
any(t, n, i) {
|
|
2083
|
+
this.expectToken(t);
|
|
2081
2084
|
const r = [];
|
|
2082
2085
|
for (; !this.expectOptionalToken(i); )
|
|
2083
2086
|
r.push(n.call(this));
|
|
@@ -2089,8 +2092,8 @@ 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(
|
|
2095
|
+
optionalMany(t, n, i) {
|
|
2096
|
+
if (this.expectOptionalToken(t)) {
|
|
2094
2097
|
const r = [];
|
|
2095
2098
|
do
|
|
2096
2099
|
r.push(n.call(this));
|
|
@@ -2104,8 +2107,8 @@ 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(
|
|
2110
|
+
many(t, n, i) {
|
|
2111
|
+
this.expectToken(t);
|
|
2109
2112
|
const r = [];
|
|
2110
2113
|
do
|
|
2111
2114
|
r.push(n.call(this));
|
|
@@ -2117,107 +2120,107 @@ class nt {
|
|
|
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(
|
|
2123
|
+
delimitedMany(t, n) {
|
|
2124
|
+
this.expectOptionalToken(t);
|
|
2122
2125
|
const i = [];
|
|
2123
2126
|
do
|
|
2124
2127
|
i.push(n.call(this));
|
|
2125
|
-
while (this.expectOptionalToken(
|
|
2128
|
+
while (this.expectOptionalToken(t));
|
|
2126
2129
|
return i;
|
|
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 Oe(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2141
2144
|
}
|
|
2142
|
-
function
|
|
2143
|
-
return
|
|
2145
|
+
function Oe(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
|
+
function ot(e) {
|
|
2156
|
+
var t = /* @__PURE__ */ new Set(), n = [];
|
|
2157
|
+
return e.definitions.forEach(function(i) {
|
|
2155
2158
|
if (i.kind === "FragmentDefinition") {
|
|
2156
|
-
var r = i.name.value, s =
|
|
2157
|
-
o && !o.has(s) ?
|
|
2159
|
+
var r = i.name.value, s = at(i.loc), o = G.get(r);
|
|
2160
|
+
o && !o.has(s) ? Ae && console.warn("Warning: fragment with name " + r + ` 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(r, o = /* @__PURE__ */ new Set()), o.add(s),
|
|
2162
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(r, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(i));
|
|
2160
2163
|
} else
|
|
2161
2164
|
n.push(i);
|
|
2162
|
-
}), w(w({},
|
|
2165
|
+
}), w(w({}, e), { definitions: n });
|
|
2163
2166
|
}
|
|
2164
|
-
function
|
|
2165
|
-
var
|
|
2166
|
-
|
|
2167
|
+
function ct(e) {
|
|
2168
|
+
var t = new Set(e.definitions);
|
|
2169
|
+
t.forEach(function(i) {
|
|
2167
2170
|
i.loc && delete i.loc, Object.keys(i).forEach(function(r) {
|
|
2168
2171
|
var s = i[r];
|
|
2169
|
-
s && typeof s == "object" &&
|
|
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 = rt(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 i =
|
|
2193
|
-
return
|
|
2194
|
-
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i +=
|
|
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 i = e[0];
|
|
2196
|
+
return t.forEach(function(r, s) {
|
|
2197
|
+
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i += e[s + 1];
|
|
2198
|
+
}), dt(i);
|
|
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
|
+
`, kt = u`
|
|
2391
2394
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2392
2395
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2393
2396
|
}
|
|
2394
|
-
`,
|
|
2397
|
+
`, Ot = 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, i) => e();
|
|
2408
|
+
function Nt(e, t = Tt) {
|
|
2406
2409
|
return {
|
|
2407
2410
|
findActiveOrderById(n, i, r) {
|
|
2408
|
-
return
|
|
2411
|
+
return t((s) => e.request({ document: gt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findActiveOrderById", "query", n);
|
|
2409
2412
|
},
|
|
2410
2413
|
findOrderById(n, i, r) {
|
|
2411
|
-
return
|
|
2414
|
+
return t((s) => e.request({ document: mt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findOrderById", "query", n);
|
|
2412
2415
|
},
|
|
2413
2416
|
addToOrder(n, i, r) {
|
|
2414
|
-
return
|
|
2417
|
+
return t((s) => e.request({ document: ft, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "addToOrder", "mutation", n);
|
|
2415
2418
|
},
|
|
2416
2419
|
removeFromOrder(n, i, r) {
|
|
2417
|
-
return
|
|
2420
|
+
return t((s) => e.request({ document: It, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "removeFromOrder", "mutation", n);
|
|
2418
2421
|
},
|
|
2419
2422
|
configurePackage(n, i, r) {
|
|
2420
|
-
return
|
|
2423
|
+
return t((s) => e.request({ document: Et, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configurePackage", "mutation", n);
|
|
2421
2424
|
},
|
|
2422
2425
|
reserveAdditionalPackageItem(n, i, r) {
|
|
2423
|
-
return
|
|
2426
|
+
return t((s) => e.request({ document: yt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "reserveAdditionalPackageItem", "mutation", n);
|
|
2424
2427
|
},
|
|
2425
2428
|
configureOrderDeliveryOption(n, i, r) {
|
|
2426
|
-
return
|
|
2429
|
+
return t((s) => e.request({ document: kt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "configureOrderDeliveryOption", "mutation", n);
|
|
2427
2430
|
},
|
|
2428
2431
|
createOrderCustomer(n, i, r) {
|
|
2429
|
-
return
|
|
2432
|
+
return t((s) => e.request({ document: Ot, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createOrderCustomer", "mutation", n);
|
|
2430
2433
|
},
|
|
2431
2434
|
deleteOrder(n, i, r) {
|
|
2432
|
-
return
|
|
2435
|
+
return t((s) => e.request({ document: At, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "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, i) {
|
|
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,
|
|
@@ -2465,15 +2468,15 @@ class At {
|
|
|
2465
2468
|
throw this.debugLog("Error adding product", r), this.handleError(r), r;
|
|
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,
|
|
@@ -2486,7 +2489,7 @@ class At {
|
|
|
2486
2489
|
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
2487
2490
|
}
|
|
2488
2491
|
}
|
|
2489
|
-
async configurePackage(
|
|
2492
|
+
async configurePackage(t, n, i) {
|
|
2490
2493
|
try {
|
|
2491
2494
|
const r = n.items.map((o) => ({
|
|
2492
2495
|
packageItemId: o.packageItemId,
|
|
@@ -2494,7 +2497,7 @@ class At {
|
|
|
2494
2497
|
}));
|
|
2495
2498
|
this.debugLog("Configuring package", {
|
|
2496
2499
|
packageId: n.id,
|
|
2497
|
-
orderId:
|
|
2500
|
+
orderId: t,
|
|
2498
2501
|
amount: n.amount,
|
|
2499
2502
|
items: r,
|
|
2500
2503
|
shopId: i
|
|
@@ -2503,7 +2506,7 @@ class At {
|
|
|
2503
2506
|
trackerId: this.config.trackerId,
|
|
2504
2507
|
shopId: i,
|
|
2505
2508
|
packageId: n.id,
|
|
2506
|
-
orderId:
|
|
2509
|
+
orderId: t,
|
|
2507
2510
|
amount: n.amount,
|
|
2508
2511
|
items: r
|
|
2509
2512
|
});
|
|
@@ -2512,11 +2515,11 @@ class At {
|
|
|
2512
2515
|
throw this.debugLog("Error configuring package", r), this.handleError(r), r;
|
|
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
2521
|
const i = await this.sdk.createOrderCustomer({
|
|
2519
|
-
orderId:
|
|
2522
|
+
orderId: t,
|
|
2520
2523
|
customer: n
|
|
2521
2524
|
});
|
|
2522
2525
|
this.debugLog("Customer set successfully", i);
|
|
@@ -2524,17 +2527,17 @@ class At {
|
|
|
2524
2527
|
throw this.debugLog("Failed to set customer", i), new Error(`Failed to set customer: ${i.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
2539
|
const i = await this.sdk.reserveAdditionalPackageItem({
|
|
2537
|
-
orderId:
|
|
2540
|
+
orderId: t,
|
|
2538
2541
|
eventId: n.eventId,
|
|
2539
2542
|
amount: n.amount,
|
|
2540
2543
|
packageId: n.packageId,
|
|
@@ -2546,12 +2549,12 @@ class At {
|
|
|
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 i = await this.sdk.findOrderById({ id:
|
|
2557
|
+
const i = await this.sdk.findOrderById({ id: t, reference: n });
|
|
2555
2558
|
return i.findOrder ? {
|
|
2556
2559
|
id: i.findOrder.id,
|
|
2557
2560
|
reference: i.findOrder.reference,
|
|
@@ -2576,17 +2579,17 @@ class At {
|
|
|
2576
2579
|
return this.debugLog("Error finding order", i), this.handleError(i), 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
2588
|
const i = n.findOrder;
|
|
2586
2589
|
this.debugLog("Order fetched successfully", i);
|
|
2587
2590
|
const r = i.items, s = r.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
2588
|
-
let m =
|
|
2589
|
-
return d.product.type === "PROMOTER" ? m =
|
|
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,
|
|
@@ -2605,41 +2608,41 @@ class At {
|
|
|
2605
2608
|
}), o = r.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, m) => {
|
|
2606
2609
|
const {
|
|
2607
2610
|
packageItem: y,
|
|
2608
|
-
event:
|
|
2611
|
+
event: p,
|
|
2609
2612
|
amount: O,
|
|
2610
|
-
price:
|
|
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
2622
|
amount: O,
|
|
2620
|
-
price:
|
|
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 = k.fromISO(p.startAt, {
|
|
2630
|
+
zone: p.timezone
|
|
2631
|
+
}), De = k.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
2647
|
const E = r.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime()), g = k.fromMillis(Math.min(...E));
|
|
2645
2648
|
return {
|
|
@@ -2656,18 +2659,18 @@ class At {
|
|
|
2656
2659
|
residence: i.mainBooker.residence,
|
|
2657
2660
|
extraInfo: i.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
2675
|
const i = n.graphQLErrors[0];
|
|
2673
2676
|
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
@@ -2678,7 +2681,7 @@ class At {
|
|
|
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,58 +2828,58 @@ const Tt = u`
|
|
|
2825
2828
|
showEndSalesAtTag
|
|
2826
2829
|
}
|
|
2827
2830
|
}
|
|
2828
|
-
`,
|
|
2829
|
-
function
|
|
2831
|
+
`, xt = (e, t, n, i) => e();
|
|
2832
|
+
function _t(e, t = xt) {
|
|
2830
2833
|
return {
|
|
2831
2834
|
EventOverviewPage(n, i, r) {
|
|
2832
|
-
return
|
|
2835
|
+
return t((s) => e.request({ document: vt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", n);
|
|
2833
2836
|
},
|
|
2834
2837
|
EventDetailPage(n, i, r) {
|
|
2835
|
-
return
|
|
2838
|
+
return t((s) => e.request({ document: Pt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", n);
|
|
2836
2839
|
},
|
|
2837
2840
|
FindPublicEventBySlug(n, i, r) {
|
|
2838
|
-
return
|
|
2841
|
+
return t((s) => e.request({ document: bt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "FindPublicEventBySlug", "query", n);
|
|
2839
2842
|
},
|
|
2840
2843
|
findProductsByEventId(n, i, r) {
|
|
2841
|
-
return
|
|
2844
|
+
return t((s) => e.request({ document: St, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "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
2868
|
const i = 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
2884
|
if (this.debugLog("Raw GraphQL response", i), i?.findAllPublicEventByOrganizationId?.data) {
|
|
2882
2885
|
const r = i.findAllPublicEventByOrganizationId.data.map((s) => ({
|
|
@@ -2915,10 +2918,10 @@ class St {
|
|
|
2915
2918
|
throw this.debugLog("Error fetching events", i), i;
|
|
2916
2919
|
}
|
|
2917
2920
|
}
|
|
2918
|
-
async getEvent(
|
|
2921
|
+
async getEvent(t) {
|
|
2919
2922
|
try {
|
|
2920
|
-
this.debugLog("Fetching single event", { eventId:
|
|
2921
|
-
const n = await this.sdk.EventDetailPage({ eventId:
|
|
2923
|
+
this.debugLog("Fetching single event", { eventId: t });
|
|
2924
|
+
const n = await this.sdk.EventDetailPage({ eventId: t });
|
|
2922
2925
|
if (this.debugLog("Raw GraphQL response", n), n?.findPublicEventById) {
|
|
2923
2926
|
const i = n.findPublicEventById, r = {
|
|
2924
2927
|
id: i.id,
|
|
@@ -2951,17 +2954,17 @@ class St {
|
|
|
2951
2954
|
};
|
|
2952
2955
|
return this.debugLog("Processed single event", r), r;
|
|
2953
2956
|
} else {
|
|
2954
|
-
this.debugLog("No event found for id",
|
|
2957
|
+
this.debugLog("No event found for id", t);
|
|
2955
2958
|
return;
|
|
2956
2959
|
}
|
|
2957
2960
|
} catch (n) {
|
|
2958
2961
|
throw this.debugLog("Error fetching single event", n), n;
|
|
2959
2962
|
}
|
|
2960
2963
|
}
|
|
2961
|
-
async getEventBySlug(
|
|
2964
|
+
async getEventBySlug(t, n) {
|
|
2962
2965
|
try {
|
|
2963
|
-
this.debugLog("Fetching single event by slug", { organizationId:
|
|
2964
|
-
const i = await this.sdk.FindPublicEventBySlug({ organizationId:
|
|
2966
|
+
this.debugLog("Fetching single event by slug", { organizationId: t, slug: n });
|
|
2967
|
+
const i = await this.sdk.FindPublicEventBySlug({ organizationId: t, slug: n });
|
|
2965
2968
|
if (this.debugLog("Raw GraphQL response", i), i?.findPublicEventBySlug) {
|
|
2966
2969
|
const r = i.findPublicEventBySlug, s = {
|
|
2967
2970
|
id: r.id,
|
|
@@ -2994,23 +2997,23 @@ class St {
|
|
|
2994
2997
|
};
|
|
2995
2998
|
return this.debugLog("Processed single event", s), s;
|
|
2996
2999
|
} else {
|
|
2997
|
-
this.debugLog("No event found for id by slug", { organizationId:
|
|
3000
|
+
this.debugLog("No event found for id by slug", { organizationId: t, slug: n });
|
|
2998
3001
|
return;
|
|
2999
3002
|
}
|
|
3000
3003
|
} catch (i) {
|
|
3001
3004
|
throw this.debugLog("Error fetching single event", i), i;
|
|
3002
3005
|
}
|
|
3003
3006
|
}
|
|
3004
|
-
async getProducts(
|
|
3007
|
+
async getProducts(t, n, i) {
|
|
3005
3008
|
try {
|
|
3006
3009
|
this.debugLog("Fetching products for event", {
|
|
3007
|
-
eventId:
|
|
3010
|
+
eventId: t,
|
|
3008
3011
|
promoCode: i,
|
|
3009
3012
|
trackerId: this.config.trackerId,
|
|
3010
3013
|
productTypes: n
|
|
3011
3014
|
});
|
|
3012
3015
|
const r = await this.sdk.findProductsByEventId({
|
|
3013
|
-
eventId:
|
|
3016
|
+
eventId: t,
|
|
3014
3017
|
promoCode: i,
|
|
3015
3018
|
trackerId: this.config.trackerId,
|
|
3016
3019
|
productTypes: n
|
|
@@ -3043,21 +3046,21 @@ class St {
|
|
|
3043
3046
|
seatsCategory: o.seatsCategory
|
|
3044
3047
|
}));
|
|
3045
3048
|
return this.debugLog("Products fetched", {
|
|
3046
|
-
eventId:
|
|
3049
|
+
eventId: t,
|
|
3047
3050
|
count: s.length,
|
|
3048
3051
|
types: s.map((o) => o.type)
|
|
3049
3052
|
}), s;
|
|
3050
3053
|
}
|
|
3051
3054
|
return;
|
|
3052
3055
|
} catch (r) {
|
|
3053
|
-
throw this.debugLog("Error fetching products", { eventId:
|
|
3056
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: r }), r;
|
|
3054
3057
|
}
|
|
3055
3058
|
}
|
|
3056
|
-
debugLog(
|
|
3057
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${
|
|
3059
|
+
debugLog(t, n) {
|
|
3060
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
|
|
3058
3061
|
}
|
|
3059
3062
|
}
|
|
3060
|
-
const
|
|
3063
|
+
const Lt = u`
|
|
3061
3064
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
3062
3065
|
findPaymentDetails(
|
|
3063
3066
|
orderId: $orderId
|
|
@@ -3087,36 +3090,36 @@ const xt = u`
|
|
|
3087
3090
|
protectionFee
|
|
3088
3091
|
}
|
|
3089
3092
|
}
|
|
3090
|
-
`,
|
|
3093
|
+
`, Rt = u`
|
|
3091
3094
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3092
3095
|
createDigitalOrderPayment(input: $input)
|
|
3093
3096
|
}
|
|
3094
|
-
`,
|
|
3095
|
-
function
|
|
3097
|
+
`, Ft = (e, t, n, i) => e();
|
|
3098
|
+
function wt(e, t = Ft) {
|
|
3096
3099
|
return {
|
|
3097
3100
|
findPaymentMethods(n, i, r) {
|
|
3098
|
-
return
|
|
3101
|
+
return t((s) => e.request({ document: Lt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", n);
|
|
3099
3102
|
},
|
|
3100
3103
|
createDigitalPayment(n, i, r) {
|
|
3101
|
-
return
|
|
3104
|
+
return t((s) => e.request({ document: Rt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", n);
|
|
3102
3105
|
}
|
|
3103
3106
|
};
|
|
3104
3107
|
}
|
|
3105
|
-
class
|
|
3108
|
+
class $t {
|
|
3106
3109
|
config;
|
|
3107
3110
|
sdk;
|
|
3108
|
-
constructor(
|
|
3109
|
-
this.config =
|
|
3111
|
+
constructor(t) {
|
|
3112
|
+
this.config = t, this.sdk = wt(new T(t.apiUrl));
|
|
3110
3113
|
}
|
|
3111
|
-
async getPaymentDetails(
|
|
3112
|
-
this.debugLog("Fetching payment methods",
|
|
3114
|
+
async getPaymentDetails(t) {
|
|
3115
|
+
this.debugLog("Fetching payment methods", t);
|
|
3113
3116
|
try {
|
|
3114
3117
|
const n = await this.sdk.findPaymentMethods({
|
|
3115
|
-
orderId:
|
|
3116
|
-
orderItemId:
|
|
3117
|
-
amountOfTickets:
|
|
3118
|
-
paymentMethodId:
|
|
3119
|
-
withTicketProtection:
|
|
3118
|
+
orderId: t.orderId,
|
|
3119
|
+
orderItemId: t.orderItemId,
|
|
3120
|
+
amountOfTickets: t.amountOfTickets,
|
|
3121
|
+
paymentMethodId: t.paymentMethodId,
|
|
3122
|
+
withTicketProtection: t.withTicketProtection
|
|
3120
3123
|
});
|
|
3121
3124
|
if (!n?.findPaymentDetails)
|
|
3122
3125
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
@@ -3153,22 +3156,22 @@ class Rt {
|
|
|
3153
3156
|
throw this.debugLog("Error fetching payment methods", n), n;
|
|
3154
3157
|
}
|
|
3155
3158
|
}
|
|
3156
|
-
async createPayment(
|
|
3157
|
-
this.debugLog("Creating payment",
|
|
3159
|
+
async createPayment(t) {
|
|
3160
|
+
this.debugLog("Creating payment", t);
|
|
3158
3161
|
try {
|
|
3159
3162
|
const n = {
|
|
3160
|
-
orderId:
|
|
3161
|
-
paymentMethodId:
|
|
3162
|
-
issuerId:
|
|
3163
|
-
redirectUrl:
|
|
3163
|
+
orderId: t.orderId,
|
|
3164
|
+
paymentMethodId: t.paymentMethodId,
|
|
3165
|
+
issuerId: t.issuerId,
|
|
3166
|
+
redirectUrl: t.redirectUrl,
|
|
3164
3167
|
// For payment links this input in used
|
|
3165
|
-
initiatedByUserId:
|
|
3166
|
-
initiatedByTeamId:
|
|
3167
|
-
amountOfTickets:
|
|
3168
|
-
orderItemId:
|
|
3169
|
-
withTicketProtection:
|
|
3168
|
+
initiatedByUserId: t.initiatedByUserId,
|
|
3169
|
+
initiatedByTeamId: t.initiatedByTeamId,
|
|
3170
|
+
amountOfTickets: t.amountOfTickets,
|
|
3171
|
+
orderItemId: t.orderItemId,
|
|
3172
|
+
withTicketProtection: t.withTicketProtection
|
|
3170
3173
|
};
|
|
3171
|
-
|
|
3174
|
+
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);
|
|
3172
3175
|
const i = await this.sdk.createDigitalPayment({
|
|
3173
3176
|
input: n
|
|
3174
3177
|
});
|
|
@@ -3180,11 +3183,11 @@ class Rt {
|
|
|
3180
3183
|
throw this.debugLog("Error creating payment", n), n;
|
|
3181
3184
|
}
|
|
3182
3185
|
}
|
|
3183
|
-
debugLog(
|
|
3184
|
-
this.config.debug && console.log(`[PaymentService] ${
|
|
3186
|
+
debugLog(t, n) {
|
|
3187
|
+
this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
|
|
3185
3188
|
}
|
|
3186
3189
|
}
|
|
3187
|
-
const
|
|
3190
|
+
const Bt = u`
|
|
3188
3191
|
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
3189
3192
|
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
3190
3193
|
data {
|
|
@@ -3209,7 +3212,7 @@ const Ft = u`
|
|
|
3209
3212
|
count
|
|
3210
3213
|
}
|
|
3211
3214
|
}
|
|
3212
|
-
`,
|
|
3215
|
+
`, Ut = u`
|
|
3213
3216
|
query findPublicPackageById($packageId: ID!) {
|
|
3214
3217
|
findPublicPackageById(id: $packageId) {
|
|
3215
3218
|
id
|
|
@@ -3235,7 +3238,7 @@ const Ft = u`
|
|
|
3235
3238
|
}
|
|
3236
3239
|
}
|
|
3237
3240
|
}
|
|
3238
|
-
`,
|
|
3241
|
+
`, Vt = u`
|
|
3239
3242
|
query findPublicPackageBySlug($organizationId: ID!, $slug: String!) {
|
|
3240
3243
|
findPublicPackageBySlug(organizationId: $organizationId, slug: $slug) {
|
|
3241
3244
|
id
|
|
@@ -3261,7 +3264,7 @@ const Ft = u`
|
|
|
3261
3264
|
}
|
|
3262
3265
|
}
|
|
3263
3266
|
}
|
|
3264
|
-
`,
|
|
3267
|
+
`, Mt = u`
|
|
3265
3268
|
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
3266
3269
|
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
3267
3270
|
data {
|
|
@@ -3296,43 +3299,43 @@ const Ft = u`
|
|
|
3296
3299
|
count
|
|
3297
3300
|
}
|
|
3298
3301
|
}
|
|
3299
|
-
`,
|
|
3300
|
-
function
|
|
3302
|
+
`, zt = (e, t, n, i) => e();
|
|
3303
|
+
function qt(e, t = zt) {
|
|
3301
3304
|
return {
|
|
3302
3305
|
findAllPublicPackagesByOrganizationId(n, i, r) {
|
|
3303
|
-
return
|
|
3306
|
+
return t((s) => e.request({ document: Bt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", n);
|
|
3304
3307
|
},
|
|
3305
3308
|
findPublicPackageById(n, i, r) {
|
|
3306
|
-
return
|
|
3309
|
+
return t((s) => e.request({ document: Ut, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", n);
|
|
3307
3310
|
},
|
|
3308
3311
|
findPublicPackageBySlug(n, i, r) {
|
|
3309
|
-
return
|
|
3312
|
+
return t((s) => e.request({ document: Vt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageBySlug", "query", n);
|
|
3310
3313
|
},
|
|
3311
3314
|
findPublicItemsByPackageId(n, i, r) {
|
|
3312
|
-
return
|
|
3315
|
+
return t((s) => e.request({ document: Mt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", n);
|
|
3313
3316
|
}
|
|
3314
3317
|
};
|
|
3315
3318
|
}
|
|
3316
|
-
class
|
|
3319
|
+
class Gt {
|
|
3317
3320
|
config;
|
|
3318
3321
|
sdk;
|
|
3319
|
-
constructor(
|
|
3320
|
-
this.config =
|
|
3322
|
+
constructor(t) {
|
|
3323
|
+
this.config = t, this.sdk = qt(new T(t.apiUrl));
|
|
3321
3324
|
}
|
|
3322
|
-
debugLog(
|
|
3323
|
-
this.config.debug && console.log(`[PackageService] ${
|
|
3325
|
+
debugLog(t, n) {
|
|
3326
|
+
this.config.debug && console.log(`[PackageService] ${t}`, n || "");
|
|
3324
3327
|
}
|
|
3325
|
-
async getPackages(
|
|
3328
|
+
async getPackages(t, n) {
|
|
3326
3329
|
try {
|
|
3327
3330
|
let i;
|
|
3328
|
-
|
|
3329
|
-
index:
|
|
3330
|
-
size:
|
|
3331
|
+
t.page && (i = {
|
|
3332
|
+
index: t.page.index ?? 0,
|
|
3333
|
+
size: t.page.size ?? 20
|
|
3331
3334
|
}), this.debugLog("Fetching public packages", {
|
|
3332
3335
|
organizationId: this.config.organizationId ?? n ?? "",
|
|
3333
3336
|
page: i,
|
|
3334
|
-
tab:
|
|
3335
|
-
statuses:
|
|
3337
|
+
tab: t.tab,
|
|
3338
|
+
statuses: t.statuses
|
|
3336
3339
|
});
|
|
3337
3340
|
const r = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
3338
3341
|
organizationId: this.config.organizationId ?? n ?? ""
|
|
@@ -3349,12 +3352,12 @@ class Mt {
|
|
|
3349
3352
|
throw this.debugLog("Error fetching public packages", i), i;
|
|
3350
3353
|
}
|
|
3351
3354
|
}
|
|
3352
|
-
async getPackage(
|
|
3355
|
+
async getPackage(t) {
|
|
3353
3356
|
try {
|
|
3354
3357
|
this.debugLog("Fetching public packages", {
|
|
3355
|
-
packageId:
|
|
3358
|
+
packageId: t
|
|
3356
3359
|
});
|
|
3357
|
-
const n = await this.sdk.findPublicPackageById({ packageId:
|
|
3360
|
+
const n = await this.sdk.findPublicPackageById({ packageId: t });
|
|
3358
3361
|
if (n?.findPublicPackageById) {
|
|
3359
3362
|
const i = n.findPublicPackageById;
|
|
3360
3363
|
return this.debugLog("Public package fetched"), i;
|
|
@@ -3364,13 +3367,13 @@ class Mt {
|
|
|
3364
3367
|
throw this.debugLog("Error fetching public packages", n), n;
|
|
3365
3368
|
}
|
|
3366
3369
|
}
|
|
3367
|
-
async getPackageBySlug(
|
|
3370
|
+
async getPackageBySlug(t, n) {
|
|
3368
3371
|
try {
|
|
3369
3372
|
this.debugLog("Fetching public packages by slug", {
|
|
3370
|
-
organizationId:
|
|
3373
|
+
organizationId: t,
|
|
3371
3374
|
slug: n
|
|
3372
3375
|
});
|
|
3373
|
-
const i = await this.sdk.findPublicPackageBySlug({ organizationId:
|
|
3376
|
+
const i = await this.sdk.findPublicPackageBySlug({ organizationId: t, slug: n });
|
|
3374
3377
|
if (i?.findPublicPackageBySlug) {
|
|
3375
3378
|
const r = i.findPublicPackageBySlug;
|
|
3376
3379
|
return this.debugLog("Public package fetched"), r;
|
|
@@ -3380,11 +3383,11 @@ class Mt {
|
|
|
3380
3383
|
throw this.debugLog("Error fetching public packages", i), i;
|
|
3381
3384
|
}
|
|
3382
3385
|
}
|
|
3383
|
-
async getPackageItems(
|
|
3386
|
+
async getPackageItems(t, n = [R.Regular, R.AdditionalEvent]) {
|
|
3384
3387
|
try {
|
|
3385
|
-
this.debugLog("Fetching public package items", { packageId:
|
|
3388
|
+
this.debugLog("Fetching public package items", { packageId: t, types: n });
|
|
3386
3389
|
const i = await this.sdk.findPublicItemsByPackageId({
|
|
3387
|
-
packageId:
|
|
3390
|
+
packageId: t,
|
|
3388
3391
|
types: n,
|
|
3389
3392
|
page: { index: 0, size: 100 }
|
|
3390
3393
|
});
|
|
@@ -3401,7 +3404,7 @@ class Mt {
|
|
|
3401
3404
|
}
|
|
3402
3405
|
}
|
|
3403
3406
|
}
|
|
3404
|
-
const
|
|
3407
|
+
const jt = u`
|
|
3405
3408
|
query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
|
|
3406
3409
|
findAllPublicLocationsByOrganizationId(id: $organizationId) {
|
|
3407
3410
|
data {
|
|
@@ -3421,27 +3424,27 @@ const zt = u`
|
|
|
3421
3424
|
count
|
|
3422
3425
|
}
|
|
3423
3426
|
}
|
|
3424
|
-
`,
|
|
3425
|
-
function
|
|
3427
|
+
`, Yt = (e, t, n, i) => e();
|
|
3428
|
+
function Ht(e, t = Yt) {
|
|
3426
3429
|
return {
|
|
3427
3430
|
findAllPublicCategoriesByOrganizationId(n, i, r) {
|
|
3428
|
-
return
|
|
3431
|
+
return t((s) => e.request({ document: jt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", n);
|
|
3429
3432
|
}
|
|
3430
3433
|
};
|
|
3431
3434
|
}
|
|
3432
|
-
class
|
|
3435
|
+
class Jt {
|
|
3433
3436
|
config;
|
|
3434
3437
|
sdk;
|
|
3435
|
-
constructor(
|
|
3436
|
-
this.config =
|
|
3438
|
+
constructor(t) {
|
|
3439
|
+
this.config = t, this.sdk = Ht(new T(t.apiUrl));
|
|
3437
3440
|
}
|
|
3438
|
-
debugLog(
|
|
3439
|
-
this.config.debug && console.log(`[CategoryService] ${
|
|
3441
|
+
debugLog(t, n) {
|
|
3442
|
+
this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
|
|
3440
3443
|
}
|
|
3441
|
-
async getCategories(
|
|
3444
|
+
async getCategories(t, n) {
|
|
3442
3445
|
try {
|
|
3443
3446
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
3444
|
-
const i = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId ?? n ?? "", dateRange:
|
|
3447
|
+
const i = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId ?? n ?? "", dateRange: t ?? null });
|
|
3445
3448
|
if (i?.findAllPublicHostingsByOrganizationId) {
|
|
3446
3449
|
const r = i.findAllPublicHostingsByOrganizationId, s = i.findAllPublicLocationsByOrganizationId;
|
|
3447
3450
|
return this.debugLog("Categories fetched", { count: r.count + s.count, dataLength: r.data.length + s.data.length }), [
|
|
@@ -3455,46 +3458,46 @@ class jt {
|
|
|
3455
3458
|
}
|
|
3456
3459
|
}
|
|
3457
3460
|
}
|
|
3458
|
-
const
|
|
3461
|
+
const Qt = u`
|
|
3459
3462
|
mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
|
|
3460
3463
|
createShopView(id: $id, trackerId: $trackerLinkId)
|
|
3461
3464
|
}
|
|
3462
|
-
`,
|
|
3465
|
+
`, Xt = u`
|
|
3463
3466
|
mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3464
3467
|
createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3465
3468
|
}
|
|
3466
|
-
`,
|
|
3469
|
+
`, Wt = u`
|
|
3467
3470
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3468
3471
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3469
3472
|
}
|
|
3470
|
-
`,
|
|
3471
|
-
function
|
|
3473
|
+
`, Zt = (e, t, n, i) => e();
|
|
3474
|
+
function Kt(e, t = Zt) {
|
|
3472
3475
|
return {
|
|
3473
3476
|
CreateShopView(n, i, r) {
|
|
3474
|
-
return
|
|
3477
|
+
return t((s) => e.request({ document: Qt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateShopView", "mutation", n);
|
|
3475
3478
|
},
|
|
3476
3479
|
CreateEventView(n, i, r) {
|
|
3477
|
-
return
|
|
3480
|
+
return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreateEventView", "mutation", n);
|
|
3478
3481
|
},
|
|
3479
3482
|
CreatePackageView(n, i, r) {
|
|
3480
|
-
return
|
|
3483
|
+
return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "CreatePackageView", "mutation", n);
|
|
3481
3484
|
}
|
|
3482
3485
|
};
|
|
3483
3486
|
}
|
|
3484
|
-
class
|
|
3487
|
+
class en {
|
|
3485
3488
|
config;
|
|
3486
3489
|
sdk;
|
|
3487
|
-
constructor(
|
|
3488
|
-
this.config =
|
|
3490
|
+
constructor(t) {
|
|
3491
|
+
this.config = t, this.sdk = Kt(new T(t.apiUrl));
|
|
3489
3492
|
}
|
|
3490
|
-
createMetric = async (
|
|
3493
|
+
createMetric = async (t, n, i) => {
|
|
3491
3494
|
switch (!n && !i && await this.sdk.CreateShopView({
|
|
3492
|
-
id:
|
|
3495
|
+
id: t,
|
|
3493
3496
|
trackerLinkId: this.config.trackerId
|
|
3494
3497
|
}), i) {
|
|
3495
3498
|
case F.Event:
|
|
3496
3499
|
await this.sdk.CreateEventView({
|
|
3497
|
-
id:
|
|
3500
|
+
id: t,
|
|
3498
3501
|
shopId: n,
|
|
3499
3502
|
trackerLinkId: this.config.trackerId
|
|
3500
3503
|
});
|
|
@@ -3502,7 +3505,7 @@ class Wt {
|
|
|
3502
3505
|
case F.Package:
|
|
3503
3506
|
await this.sdk.CreatePackageView(
|
|
3504
3507
|
{
|
|
3505
|
-
id:
|
|
3508
|
+
id: t,
|
|
3506
3509
|
shopId: n,
|
|
3507
3510
|
trackerLinkId: this.config.trackerId
|
|
3508
3511
|
}
|
|
@@ -3511,7 +3514,7 @@ class Wt {
|
|
|
3511
3514
|
}
|
|
3512
3515
|
};
|
|
3513
3516
|
}
|
|
3514
|
-
const
|
|
3517
|
+
const tn = u`
|
|
3515
3518
|
query getShopBySlug($slug: String!, $trackerLinkId: String) {
|
|
3516
3519
|
findShopBySlug(slug: $slug, promoterId: $trackerLinkId) {
|
|
3517
3520
|
id
|
|
@@ -3555,24 +3558,24 @@ const Zt = u`
|
|
|
3555
3558
|
blockedLanguages
|
|
3556
3559
|
}
|
|
3557
3560
|
}
|
|
3558
|
-
`,
|
|
3559
|
-
function
|
|
3561
|
+
`, nn = (e, t, n, i) => e();
|
|
3562
|
+
function rn(e, t = nn) {
|
|
3560
3563
|
return {
|
|
3561
3564
|
getShopBySlug(n, i, r) {
|
|
3562
|
-
return
|
|
3565
|
+
return t((s) => e.request({ document: tn, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "getShopBySlug", "query", n);
|
|
3563
3566
|
}
|
|
3564
3567
|
};
|
|
3565
3568
|
}
|
|
3566
|
-
class
|
|
3569
|
+
class sn {
|
|
3567
3570
|
config;
|
|
3568
3571
|
sdk;
|
|
3569
|
-
constructor(
|
|
3570
|
-
this.config =
|
|
3572
|
+
constructor(t) {
|
|
3573
|
+
this.config = t, this.sdk = rn(new T(t.apiUrl));
|
|
3571
3574
|
}
|
|
3572
|
-
async getShop(
|
|
3575
|
+
async getShop(t) {
|
|
3573
3576
|
try {
|
|
3574
|
-
this.debugLog("Fetching shop", { slug:
|
|
3575
|
-
const n = await this.sdk.getShopBySlug({ slug:
|
|
3577
|
+
this.debugLog("Fetching shop", { slug: t });
|
|
3578
|
+
const n = await this.sdk.getShopBySlug({ slug: t, trackerLinkId: this.config.trackerId });
|
|
3576
3579
|
if (this.debugLog("Raw GraphQL response", n), n?.findShopBySlug) {
|
|
3577
3580
|
const i = n.findShopBySlug;
|
|
3578
3581
|
return this.debugLog("Public Shop fetched"), i;
|
|
@@ -3582,12 +3585,61 @@ class tn {
|
|
|
3582
3585
|
throw this.debugLog("Error fetching single Shop", n), n;
|
|
3583
3586
|
}
|
|
3584
3587
|
}
|
|
3585
|
-
debugLog(
|
|
3586
|
-
this.config.debug && console.log(`[ShopService] ${
|
|
3588
|
+
debugLog(t, n) {
|
|
3589
|
+
this.config.debug && console.log(`[ShopService] ${t}`, n || "");
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
const an = u`
|
|
3593
|
+
query findAllCustomFieldsByOrderId($orderId: String!, $salesLocations: [SalesLocations!]) {
|
|
3594
|
+
findAllCustomFieldsByOrderId(orderId: $orderId, salesLocations: $salesLocations) {
|
|
3595
|
+
id
|
|
3596
|
+
label
|
|
3597
|
+
name
|
|
3598
|
+
type
|
|
3599
|
+
salesLocations
|
|
3600
|
+
typeOptions {
|
|
3601
|
+
key
|
|
3602
|
+
value
|
|
3603
|
+
}
|
|
3604
|
+
defaultValue
|
|
3605
|
+
mandatoryType
|
|
3606
|
+
placeholder
|
|
3607
|
+
required
|
|
3608
|
+
confirm
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
`, on = (e, t, n, i) => e();
|
|
3612
|
+
function cn(e, t = on) {
|
|
3613
|
+
return {
|
|
3614
|
+
findAllCustomFieldsByOrderId(n, i, r) {
|
|
3615
|
+
return t((s) => e.request({ document: an, variables: n, requestHeaders: { ...i, ...s }, signal: r }), "findAllCustomFieldsByOrderId", "query", n);
|
|
3616
|
+
}
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
class dn {
|
|
3620
|
+
config;
|
|
3621
|
+
sdk;
|
|
3622
|
+
constructor(t) {
|
|
3623
|
+
this.config = t, this.sdk = cn(new T(t.apiUrl));
|
|
3624
|
+
}
|
|
3625
|
+
async findByOrderId(t, n) {
|
|
3626
|
+
try {
|
|
3627
|
+
this.debugLog("Fetching custom fields for order", { orderId: t, salesLocations: n });
|
|
3628
|
+
const i = await this.sdk.findAllCustomFieldsByOrderId({
|
|
3629
|
+
orderId: t,
|
|
3630
|
+
salesLocations: n || null
|
|
3631
|
+
});
|
|
3632
|
+
return this.debugLog("Custom fields fetched successfully", i.findAllCustomFieldsByOrderId), i.findAllCustomFieldsByOrderId;
|
|
3633
|
+
} catch (i) {
|
|
3634
|
+
throw this.debugLog("Error fetching custom fields for order", i), i;
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
debugLog(t, n) {
|
|
3638
|
+
this.config.debug && console.log(`[CustomFieldService] ${t}`, n || "");
|
|
3587
3639
|
}
|
|
3588
3640
|
}
|
|
3589
|
-
const
|
|
3590
|
-
class
|
|
3641
|
+
const un = "https://api.ticketapp.com/graphql";
|
|
3642
|
+
class pn {
|
|
3591
3643
|
basket;
|
|
3592
3644
|
event;
|
|
3593
3645
|
payment;
|
|
@@ -3595,15 +3647,18 @@ class an {
|
|
|
3595
3647
|
category;
|
|
3596
3648
|
metric;
|
|
3597
3649
|
shop;
|
|
3650
|
+
customField;
|
|
3598
3651
|
// Attach selected public types to the SDK class
|
|
3599
|
-
static Types =
|
|
3600
|
-
constructor(
|
|
3601
|
-
const { organizationId: n, debug: i = !1, apiUrl: r =
|
|
3602
|
-
this.event = new
|
|
3652
|
+
static Types = ve;
|
|
3653
|
+
constructor(t) {
|
|
3654
|
+
const { organizationId: n, debug: i = !1, apiUrl: r = un } = t;
|
|
3655
|
+
this.event = new Ct({ organizationId: n, debug: i, apiUrl: r, trackerId: t.trackerId }), this.package = new Gt({ organizationId: n, debug: i, apiUrl: r }), this.category = new Jt({ organizationId: n, debug: i, apiUrl: r }), this.metric = new en({ apiUrl: r, trackerId: t.trackerId }), this.shop = new sn({ debug: i, apiUrl: r, trackerId: t.trackerId }), this.customField = new dn({ debug: i, apiUrl: r }), this.basket = new Dt({ debug: i, apiUrl: r, trackerId: t.trackerId }), this.payment = new $t({ debug: i, apiUrl: r });
|
|
3603
3656
|
}
|
|
3604
3657
|
}
|
|
3605
3658
|
export {
|
|
3606
|
-
|
|
3659
|
+
N as BasketOrderType,
|
|
3660
|
+
ue as CustomFieldMandatoryType,
|
|
3661
|
+
de as CustomFieldType,
|
|
3607
3662
|
ae as DiscountType,
|
|
3608
3663
|
ee as EventStatus,
|
|
3609
3664
|
F as MetricsType,
|
|
@@ -3614,8 +3669,9 @@ export {
|
|
|
3614
3669
|
re as PaymentMethodFeeType,
|
|
3615
3670
|
ne as ProductStatus,
|
|
3616
3671
|
ie as ProductType,
|
|
3672
|
+
le as SalesLocations,
|
|
3617
3673
|
oe as ShopTemplateType,
|
|
3618
3674
|
ce as ShopVariationType,
|
|
3619
3675
|
te as SortOrder,
|
|
3620
|
-
|
|
3676
|
+
pn as TicketappSDK
|
|
3621
3677
|
};
|