@ticketapp-dev/shop-sdk 1.0.43 → 1.0.44
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 +806 -821
- package/dist/services/event/event.service.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLClient as v } from "graphql-request";
|
|
2
2
|
import { DateTime as A } from "luxon";
|
|
3
|
-
var T = /* @__PURE__ */ ((
|
|
3
|
+
var T = /* @__PURE__ */ ((t) => (t.PACKAGE = "PACKAGE", t.PRODUCT = "PRODUCT", t.ADD_ONS = "ADD_ONS", t.DELIVERY = "DELIVERY", t.PICKUP = "PICKUP", t))(T || {}), R = /* @__PURE__ */ ((t) => (t.AdditionalEvent = "ADDITIONAL_EVENT", t.Addon = "ADDON", t.Regular = "REGULAR", t))(R || {}), K = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Concept = "CONCEPT", t.Paused = "PAUSED", t.SoldOut = "SOLD_OUT", t))(K || {}), ee = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Inactive = "INACTIVE", t))(ee || {}), te = /* @__PURE__ */ ((t) => (t.Active = "ACTIVE", t.Inactive = "INACTIVE", t.Paused = "PAUSED", t.SoldOut = "SOLD_OUT", t))(te || {}), ne = /* @__PURE__ */ ((t) => (t.Asc = "ASC", t.Desc = "DESC", t))(ne || {}), ie = /* @__PURE__ */ ((t) => (t.AllReserved = "ALL_RESERVED", t.Available = "AVAILABLE", t.SoldOut = "SOLD_OUT", t))(ie || {}), re = /* @__PURE__ */ ((t) => (t.Addon = "ADDON", t.Delivery = "DELIVERY", t.Door = "DOOR", t.Friend = "FRIEND", t.Guest = "GUEST", t.Pickup = "PICKUP", t.Promoter = "PROMOTER", t.Ticket = "TICKET", t))(re || {}), se = /* @__PURE__ */ ((t) => (t.FIXED = "FIXED", t.PERCENTAGE = "PERCENTAGE", t))(se || {}), ae = /* @__PURE__ */ ((t) => (t.AddOn = "ADD_ON", t.DeliveryOption = "DELIVERY_OPTION", t.EntranceTicket = "ENTRANCE_TICKET", t))(ae || {}), oe = /* @__PURE__ */ ((t) => (t.Fixed = "FIXED", t.Percentage = "PERCENTAGE", t))(oe || {}), w = /* @__PURE__ */ ((t) => (t.Event = "EVENT", t.Package = "PACKAGE", t))(w || {});
|
|
4
4
|
const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
5
|
__proto__: null,
|
|
6
6
|
BasketOrderType: T,
|
|
@@ -17,48 +17,48 @@ const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
17
17
|
SortOrder: ne
|
|
18
18
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19
19
|
var F = function() {
|
|
20
|
-
return F = Object.assign || function(
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
for (var s in
|
|
20
|
+
return F = Object.assign || function(n) {
|
|
21
|
+
for (var e, i = 1, r = arguments.length; i < r; i++) {
|
|
22
|
+
e = arguments[i];
|
|
23
|
+
for (var s in e) Object.prototype.hasOwnProperty.call(e, s) && (n[s] = e[s]);
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return n;
|
|
26
26
|
}, F.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
-
function U(
|
|
29
|
-
if (!!!
|
|
30
|
-
throw new Error(
|
|
28
|
+
function U(t, n) {
|
|
29
|
+
if (!!!t)
|
|
30
|
+
throw new Error(n);
|
|
31
31
|
}
|
|
32
|
-
function Ae(
|
|
33
|
-
return typeof
|
|
32
|
+
function Ae(t) {
|
|
33
|
+
return typeof t == "object" && t !== null;
|
|
34
34
|
}
|
|
35
|
-
function Ne(
|
|
36
|
-
if (!!!
|
|
35
|
+
function Ne(t, n) {
|
|
36
|
+
if (!!!t)
|
|
37
37
|
throw new Error(
|
|
38
38
|
"Unexpected invariant triggered."
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
const De = /\r\n|[\n\r]/g;
|
|
42
|
-
function z(
|
|
43
|
-
let
|
|
44
|
-
for (const r of
|
|
45
|
-
if (typeof r.index == "number" || Ne(!1), r.index >=
|
|
42
|
+
function z(t, n) {
|
|
43
|
+
let e = 0, i = 1;
|
|
44
|
+
for (const r of t.body.matchAll(De)) {
|
|
45
|
+
if (typeof r.index == "number" || Ne(!1), r.index >= n)
|
|
46
46
|
break;
|
|
47
|
-
|
|
47
|
+
e = r.index + r[0].length, i += 1;
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
50
|
line: i,
|
|
51
|
-
column:
|
|
51
|
+
column: n + 1 - e
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function ve(
|
|
54
|
+
function ve(t) {
|
|
55
55
|
return ce(
|
|
56
|
-
|
|
57
|
-
z(
|
|
56
|
+
t.source,
|
|
57
|
+
z(t.source, t.start)
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
function ce(
|
|
61
|
-
const
|
|
60
|
+
function ce(t, n) {
|
|
61
|
+
const e = t.locationOffset.column - 1, i = "".padStart(e) + t.body, r = n.line - 1, s = t.locationOffset.line - 1, o = n.line + s, u = n.line === 1 ? e : 0, h = n.column + u, E = `${t.name}:${o}:${h}
|
|
62
62
|
`, m = i.split(/\r\n|[\n\r]/g), d = m[r];
|
|
63
63
|
if (d.length > 120) {
|
|
64
64
|
const f = Math.floor(h / 80), y = h % 80, p = [];
|
|
@@ -79,21 +79,21 @@ function ce(n, e) {
|
|
|
79
79
|
[`${o + 1} |`, m[r + 1]]
|
|
80
80
|
]);
|
|
81
81
|
}
|
|
82
|
-
function Q(
|
|
83
|
-
const
|
|
84
|
-
return
|
|
82
|
+
function Q(t) {
|
|
83
|
+
const n = t.filter(([i, r]) => r !== void 0), e = Math.max(...n.map(([i]) => i.length));
|
|
84
|
+
return n.map(([i, r]) => i.padStart(e) + (r ? " " + r : "")).join(`
|
|
85
85
|
`);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
nodes:
|
|
91
|
-
source:
|
|
92
|
-
positions:
|
|
93
|
-
path:
|
|
94
|
-
originalError:
|
|
95
|
-
extensions:
|
|
96
|
-
} :
|
|
87
|
+
function Pe(t) {
|
|
88
|
+
const n = t[0];
|
|
89
|
+
return n == null || "kind" in n || "length" in n ? {
|
|
90
|
+
nodes: n,
|
|
91
|
+
source: t[1],
|
|
92
|
+
positions: t[2],
|
|
93
|
+
path: t[3],
|
|
94
|
+
originalError: t[4],
|
|
95
|
+
extensions: t[5]
|
|
96
|
+
} : n;
|
|
97
97
|
}
|
|
98
98
|
class j extends Error {
|
|
99
99
|
/**
|
|
@@ -134,10 +134,10 @@ class j extends Error {
|
|
|
134
134
|
/**
|
|
135
135
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
136
136
|
*/
|
|
137
|
-
constructor(
|
|
137
|
+
constructor(n, ...e) {
|
|
138
138
|
var i, r, s;
|
|
139
|
-
const { nodes: o, source: u, positions: h, path: E, originalError: m, extensions: d } =
|
|
140
|
-
super(
|
|
139
|
+
const { nodes: o, source: u, positions: h, path: E, originalError: m, extensions: d } = Pe(e);
|
|
140
|
+
super(n), this.name = "GraphQLError", this.path = E ?? void 0, this.originalError = m ?? void 0, this.nodes = X(
|
|
141
141
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
142
142
|
);
|
|
143
143
|
const f = X(
|
|
@@ -181,36 +181,36 @@ class j extends Error {
|
|
|
181
181
|
return "GraphQLError";
|
|
182
182
|
}
|
|
183
183
|
toString() {
|
|
184
|
-
let
|
|
184
|
+
let n = this.message;
|
|
185
185
|
if (this.nodes)
|
|
186
|
-
for (const
|
|
187
|
-
|
|
186
|
+
for (const e of this.nodes)
|
|
187
|
+
e.loc && (n += `
|
|
188
188
|
|
|
189
|
-
` + ve(
|
|
189
|
+
` + ve(e.loc));
|
|
190
190
|
else if (this.source && this.locations)
|
|
191
|
-
for (const
|
|
192
|
-
|
|
191
|
+
for (const e of this.locations)
|
|
192
|
+
n += `
|
|
193
193
|
|
|
194
|
-
` + ce(this.source,
|
|
195
|
-
return
|
|
194
|
+
` + ce(this.source, e);
|
|
195
|
+
return n;
|
|
196
196
|
}
|
|
197
197
|
toJSON() {
|
|
198
|
-
const
|
|
198
|
+
const n = {
|
|
199
199
|
message: this.message
|
|
200
200
|
};
|
|
201
|
-
return this.locations != null && (
|
|
201
|
+
return this.locations != null && (n.locations = this.locations), this.path != null && (n.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (n.extensions = this.extensions), n;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
function X(
|
|
205
|
-
return
|
|
204
|
+
function X(t) {
|
|
205
|
+
return t === void 0 || t.length === 0 ? void 0 : t;
|
|
206
206
|
}
|
|
207
|
-
function I(n, e
|
|
208
|
-
return new j(`Syntax Error: ${
|
|
209
|
-
source:
|
|
210
|
-
positions: [
|
|
207
|
+
function I(t, n, e) {
|
|
208
|
+
return new j(`Syntax Error: ${e}`, {
|
|
209
|
+
source: t,
|
|
210
|
+
positions: [n]
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
class
|
|
213
|
+
class xe {
|
|
214
214
|
/**
|
|
215
215
|
* The character offset at which this Node begins.
|
|
216
216
|
*/
|
|
@@ -226,8 +226,8 @@ class Pe {
|
|
|
226
226
|
/**
|
|
227
227
|
* The Source document the AST represents.
|
|
228
228
|
*/
|
|
229
|
-
constructor(
|
|
230
|
-
this.start =
|
|
229
|
+
constructor(n, e, i) {
|
|
230
|
+
this.start = n.start, this.end = e.end, this.startToken = n, this.endToken = e, this.source = i;
|
|
231
231
|
}
|
|
232
232
|
get [Symbol.toStringTag]() {
|
|
233
233
|
return "Location";
|
|
@@ -266,8 +266,8 @@ class de {
|
|
|
266
266
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
267
267
|
* the last.
|
|
268
268
|
*/
|
|
269
|
-
constructor(
|
|
270
|
-
this.kind =
|
|
269
|
+
constructor(n, e, i, r, s, o) {
|
|
270
|
+
this.kind = n, this.start = e, this.end = i, this.line = r, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
271
271
|
}
|
|
272
272
|
get [Symbol.toStringTag]() {
|
|
273
273
|
return "Token";
|
|
@@ -371,55 +371,55 @@ const be = {
|
|
|
371
371
|
};
|
|
372
372
|
new Set(Object.keys(be));
|
|
373
373
|
var D;
|
|
374
|
-
(function(
|
|
375
|
-
|
|
374
|
+
(function(t) {
|
|
375
|
+
t.QUERY = "query", t.MUTATION = "mutation", t.SUBSCRIPTION = "subscription";
|
|
376
376
|
})(D || (D = {}));
|
|
377
377
|
var q;
|
|
378
|
-
(function(
|
|
379
|
-
|
|
378
|
+
(function(t) {
|
|
379
|
+
t.QUERY = "QUERY", t.MUTATION = "MUTATION", t.SUBSCRIPTION = "SUBSCRIPTION", t.FIELD = "FIELD", t.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", t.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", t.INLINE_FRAGMENT = "INLINE_FRAGMENT", t.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", t.SCHEMA = "SCHEMA", t.SCALAR = "SCALAR", t.OBJECT = "OBJECT", t.FIELD_DEFINITION = "FIELD_DEFINITION", t.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", t.INTERFACE = "INTERFACE", t.UNION = "UNION", t.ENUM = "ENUM", t.ENUM_VALUE = "ENUM_VALUE", t.INPUT_OBJECT = "INPUT_OBJECT", t.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
380
380
|
})(q || (q = {}));
|
|
381
381
|
var c;
|
|
382
|
-
(function(
|
|
383
|
-
|
|
382
|
+
(function(t) {
|
|
383
|
+
t.NAME = "Name", t.DOCUMENT = "Document", t.OPERATION_DEFINITION = "OperationDefinition", t.VARIABLE_DEFINITION = "VariableDefinition", t.SELECTION_SET = "SelectionSet", t.FIELD = "Field", t.ARGUMENT = "Argument", t.FRAGMENT_SPREAD = "FragmentSpread", t.INLINE_FRAGMENT = "InlineFragment", t.FRAGMENT_DEFINITION = "FragmentDefinition", t.VARIABLE = "Variable", t.INT = "IntValue", t.FLOAT = "FloatValue", t.STRING = "StringValue", t.BOOLEAN = "BooleanValue", t.NULL = "NullValue", t.ENUM = "EnumValue", t.LIST = "ListValue", t.OBJECT = "ObjectValue", t.OBJECT_FIELD = "ObjectField", t.DIRECTIVE = "Directive", t.NAMED_TYPE = "NamedType", t.LIST_TYPE = "ListType", t.NON_NULL_TYPE = "NonNullType", t.SCHEMA_DEFINITION = "SchemaDefinition", t.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", t.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", t.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", t.FIELD_DEFINITION = "FieldDefinition", t.INPUT_VALUE_DEFINITION = "InputValueDefinition", t.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", t.UNION_TYPE_DEFINITION = "UnionTypeDefinition", t.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", t.ENUM_VALUE_DEFINITION = "EnumValueDefinition", t.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", t.DIRECTIVE_DEFINITION = "DirectiveDefinition", t.SCHEMA_EXTENSION = "SchemaExtension", t.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", t.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", t.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", t.UNION_TYPE_EXTENSION = "UnionTypeExtension", t.ENUM_TYPE_EXTENSION = "EnumTypeExtension", t.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", t.TYPE_COORDINATE = "TypeCoordinate", t.MEMBER_COORDINATE = "MemberCoordinate", t.ARGUMENT_COORDINATE = "ArgumentCoordinate", t.DIRECTIVE_COORDINATE = "DirectiveCoordinate", t.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
384
384
|
})(c || (c = {}));
|
|
385
|
-
function Se(
|
|
386
|
-
return
|
|
385
|
+
function Se(t) {
|
|
386
|
+
return t === 9 || t === 32;
|
|
387
387
|
}
|
|
388
|
-
function S(
|
|
389
|
-
return
|
|
388
|
+
function S(t) {
|
|
389
|
+
return t >= 48 && t <= 57;
|
|
390
390
|
}
|
|
391
|
-
function ue(
|
|
392
|
-
return
|
|
393
|
-
|
|
391
|
+
function ue(t) {
|
|
392
|
+
return t >= 97 && t <= 122 || // A-Z
|
|
393
|
+
t >= 65 && t <= 90;
|
|
394
394
|
}
|
|
395
|
-
function le(
|
|
396
|
-
return ue(
|
|
395
|
+
function le(t) {
|
|
396
|
+
return ue(t) || t === 95;
|
|
397
397
|
}
|
|
398
|
-
function Ce(
|
|
399
|
-
return ue(
|
|
398
|
+
function Ce(t) {
|
|
399
|
+
return ue(t) || S(t) || t === 95;
|
|
400
400
|
}
|
|
401
|
-
function _e(
|
|
402
|
-
var
|
|
403
|
-
let
|
|
404
|
-
for (let o = 0; o <
|
|
401
|
+
function _e(t) {
|
|
402
|
+
var n;
|
|
403
|
+
let e = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
404
|
+
for (let o = 0; o < t.length; ++o) {
|
|
405
405
|
var s;
|
|
406
|
-
const u =
|
|
407
|
-
h !== u.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && h <
|
|
406
|
+
const u = t[o], h = Le(u);
|
|
407
|
+
h !== u.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && h < e && (e = h));
|
|
408
408
|
}
|
|
409
|
-
return
|
|
410
|
-
(
|
|
409
|
+
return t.map((o, u) => u === 0 ? o : o.slice(e)).slice(
|
|
410
|
+
(n = i) !== null && n !== void 0 ? n : 0,
|
|
411
411
|
r + 1
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
|
-
function Le(
|
|
415
|
-
let
|
|
416
|
-
for (;
|
|
417
|
-
++
|
|
418
|
-
return
|
|
414
|
+
function Le(t) {
|
|
415
|
+
let n = 0;
|
|
416
|
+
for (; n < t.length && Se(t.charCodeAt(n)); )
|
|
417
|
+
++n;
|
|
418
|
+
return n;
|
|
419
419
|
}
|
|
420
420
|
var a;
|
|
421
|
-
(function(
|
|
422
|
-
|
|
421
|
+
(function(t) {
|
|
422
|
+
t.SOF = "<SOF>", t.EOF = "<EOF>", t.BANG = "!", t.DOLLAR = "$", t.AMP = "&", t.PAREN_L = "(", t.PAREN_R = ")", t.DOT = ".", t.SPREAD = "...", t.COLON = ":", t.EQUALS = "=", t.AT = "@", t.BRACKET_L = "[", t.BRACKET_R = "]", t.BRACE_L = "{", t.PIPE = "|", t.BRACE_R = "}", t.NAME = "Name", t.INT = "Int", t.FLOAT = "Float", t.STRING = "String", t.BLOCK_STRING = "BlockString", t.COMMENT = "Comment";
|
|
423
423
|
})(a || (a = {}));
|
|
424
424
|
class Re {
|
|
425
425
|
/**
|
|
@@ -434,9 +434,9 @@ class Re {
|
|
|
434
434
|
/**
|
|
435
435
|
* The character offset at which the current line begins.
|
|
436
436
|
*/
|
|
437
|
-
constructor(
|
|
438
|
-
const
|
|
439
|
-
this.source =
|
|
437
|
+
constructor(n) {
|
|
438
|
+
const e = new de(a.SOF, 0, 0, 0, 0);
|
|
439
|
+
this.source = n, this.lastToken = e, this.token = e, this.line = 1, this.lineStart = 0;
|
|
440
440
|
}
|
|
441
441
|
get [Symbol.toStringTag]() {
|
|
442
442
|
return "Lexer";
|
|
@@ -452,53 +452,53 @@ class Re {
|
|
|
452
452
|
* the state of Lexer.
|
|
453
453
|
*/
|
|
454
454
|
lookahead() {
|
|
455
|
-
let
|
|
456
|
-
if (
|
|
455
|
+
let n = this.token;
|
|
456
|
+
if (n.kind !== a.EOF)
|
|
457
457
|
do
|
|
458
|
-
if (
|
|
459
|
-
|
|
458
|
+
if (n.next)
|
|
459
|
+
n = n.next;
|
|
460
460
|
else {
|
|
461
|
-
const
|
|
462
|
-
|
|
461
|
+
const e = Fe(this, n.end);
|
|
462
|
+
n.next = e, e.prev = n, n = e;
|
|
463
463
|
}
|
|
464
|
-
while (
|
|
465
|
-
return
|
|
464
|
+
while (n.kind === a.COMMENT);
|
|
465
|
+
return n;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
function we(
|
|
469
|
-
return
|
|
468
|
+
function we(t) {
|
|
469
|
+
return t === a.BANG || t === a.DOLLAR || t === a.AMP || t === a.PAREN_L || t === a.PAREN_R || t === a.DOT || t === a.SPREAD || t === a.COLON || t === a.EQUALS || t === a.AT || t === a.BRACKET_L || t === a.BRACKET_R || t === a.BRACE_L || t === a.PIPE || t === a.BRACE_R;
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
return
|
|
471
|
+
function P(t) {
|
|
472
|
+
return t >= 0 && t <= 55295 || t >= 57344 && t <= 1114111;
|
|
473
473
|
}
|
|
474
|
-
function B(
|
|
475
|
-
return he(
|
|
474
|
+
function B(t, n) {
|
|
475
|
+
return he(t.charCodeAt(n)) && pe(t.charCodeAt(n + 1));
|
|
476
476
|
}
|
|
477
|
-
function he(
|
|
478
|
-
return
|
|
477
|
+
function he(t) {
|
|
478
|
+
return t >= 55296 && t <= 56319;
|
|
479
479
|
}
|
|
480
|
-
function pe(
|
|
481
|
-
return
|
|
480
|
+
function pe(t) {
|
|
481
|
+
return t >= 56320 && t <= 57343;
|
|
482
482
|
}
|
|
483
|
-
function N(
|
|
484
|
-
const
|
|
485
|
-
if (
|
|
483
|
+
function N(t, n) {
|
|
484
|
+
const e = t.source.body.codePointAt(n);
|
|
485
|
+
if (e === void 0)
|
|
486
486
|
return a.EOF;
|
|
487
|
-
if (
|
|
488
|
-
const i = String.fromCodePoint(
|
|
487
|
+
if (e >= 32 && e <= 126) {
|
|
488
|
+
const i = String.fromCodePoint(e);
|
|
489
489
|
return i === '"' ? `'"'` : `"${i}"`;
|
|
490
490
|
}
|
|
491
|
-
return "U+" +
|
|
491
|
+
return "U+" + e.toString(16).toUpperCase().padStart(4, "0");
|
|
492
492
|
}
|
|
493
|
-
function g(n, e,
|
|
494
|
-
const s =
|
|
495
|
-
return new de(
|
|
493
|
+
function g(t, n, e, i, r) {
|
|
494
|
+
const s = t.line, o = 1 + e - t.lineStart;
|
|
495
|
+
return new de(n, e, i, s, o, r);
|
|
496
496
|
}
|
|
497
|
-
function Fe(
|
|
498
|
-
const
|
|
499
|
-
let r =
|
|
497
|
+
function Fe(t, n) {
|
|
498
|
+
const e = t.source.body, i = e.length;
|
|
499
|
+
let r = n;
|
|
500
500
|
for (; r < i; ) {
|
|
501
|
-
const s =
|
|
501
|
+
const s = e.charCodeAt(r);
|
|
502
502
|
switch (s) {
|
|
503
503
|
// Ignored ::
|
|
504
504
|
// - UnicodeBOM
|
|
@@ -528,14 +528,14 @@ function Fe(n, e) {
|
|
|
528
528
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
529
529
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
530
530
|
case 10:
|
|
531
|
-
++r, ++
|
|
531
|
+
++r, ++t.line, t.lineStart = r;
|
|
532
532
|
continue;
|
|
533
533
|
case 13:
|
|
534
|
-
|
|
534
|
+
e.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++t.line, t.lineStart = r;
|
|
535
535
|
continue;
|
|
536
536
|
// Comment
|
|
537
537
|
case 35:
|
|
538
|
-
return $e(
|
|
538
|
+
return $e(t, r);
|
|
539
539
|
// Token ::
|
|
540
540
|
// - Punctuator
|
|
541
541
|
// - Name
|
|
@@ -545,159 +545,159 @@ function Fe(n, e) {
|
|
|
545
545
|
//
|
|
546
546
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
547
547
|
case 33:
|
|
548
|
-
return g(
|
|
548
|
+
return g(t, a.BANG, r, r + 1);
|
|
549
549
|
case 36:
|
|
550
|
-
return g(
|
|
550
|
+
return g(t, a.DOLLAR, r, r + 1);
|
|
551
551
|
case 38:
|
|
552
|
-
return g(
|
|
552
|
+
return g(t, a.AMP, r, r + 1);
|
|
553
553
|
case 40:
|
|
554
|
-
return g(
|
|
554
|
+
return g(t, a.PAREN_L, r, r + 1);
|
|
555
555
|
case 41:
|
|
556
|
-
return g(
|
|
556
|
+
return g(t, a.PAREN_R, r, r + 1);
|
|
557
557
|
case 46:
|
|
558
|
-
if (
|
|
559
|
-
return g(
|
|
558
|
+
if (e.charCodeAt(r + 1) === 46 && e.charCodeAt(r + 2) === 46)
|
|
559
|
+
return g(t, a.SPREAD, r, r + 3);
|
|
560
560
|
break;
|
|
561
561
|
case 58:
|
|
562
|
-
return g(
|
|
562
|
+
return g(t, a.COLON, r, r + 1);
|
|
563
563
|
case 61:
|
|
564
|
-
return g(
|
|
564
|
+
return g(t, a.EQUALS, r, r + 1);
|
|
565
565
|
case 64:
|
|
566
|
-
return g(
|
|
566
|
+
return g(t, a.AT, r, r + 1);
|
|
567
567
|
case 91:
|
|
568
|
-
return g(
|
|
568
|
+
return g(t, a.BRACKET_L, r, r + 1);
|
|
569
569
|
case 93:
|
|
570
|
-
return g(
|
|
570
|
+
return g(t, a.BRACKET_R, r, r + 1);
|
|
571
571
|
case 123:
|
|
572
|
-
return g(
|
|
572
|
+
return g(t, a.BRACE_L, r, r + 1);
|
|
573
573
|
case 124:
|
|
574
|
-
return g(
|
|
574
|
+
return g(t, a.PIPE, r, r + 1);
|
|
575
575
|
case 125:
|
|
576
|
-
return g(
|
|
576
|
+
return g(t, a.BRACE_R, r, r + 1);
|
|
577
577
|
// StringValue
|
|
578
578
|
case 34:
|
|
579
|
-
return
|
|
579
|
+
return e.charCodeAt(r + 1) === 34 && e.charCodeAt(r + 2) === 34 ? qe(t, r) : Ve(t, r);
|
|
580
580
|
}
|
|
581
581
|
if (S(s) || s === 45)
|
|
582
|
-
return Be(
|
|
582
|
+
return Be(t, r, s);
|
|
583
583
|
if (le(s))
|
|
584
|
-
return Ge(
|
|
584
|
+
return Ge(t, r);
|
|
585
585
|
throw I(
|
|
586
|
-
|
|
586
|
+
t.source,
|
|
587
587
|
r,
|
|
588
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
588
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || B(e, r) ? `Unexpected character: ${N(t, r)}.` : `Invalid character: ${N(t, r)}.`
|
|
589
589
|
);
|
|
590
590
|
}
|
|
591
|
-
return g(
|
|
591
|
+
return g(t, a.EOF, i, i);
|
|
592
592
|
}
|
|
593
|
-
function $e(
|
|
594
|
-
const
|
|
595
|
-
let r =
|
|
593
|
+
function $e(t, n) {
|
|
594
|
+
const e = t.source.body, i = e.length;
|
|
595
|
+
let r = n + 1;
|
|
596
596
|
for (; r < i; ) {
|
|
597
|
-
const s =
|
|
597
|
+
const s = e.charCodeAt(r);
|
|
598
598
|
if (s === 10 || s === 13)
|
|
599
599
|
break;
|
|
600
|
-
if (
|
|
600
|
+
if (P(s))
|
|
601
601
|
++r;
|
|
602
|
-
else if (B(
|
|
602
|
+
else if (B(e, r))
|
|
603
603
|
r += 2;
|
|
604
604
|
else
|
|
605
605
|
break;
|
|
606
606
|
}
|
|
607
607
|
return g(
|
|
608
|
-
|
|
608
|
+
t,
|
|
609
609
|
a.COMMENT,
|
|
610
|
-
|
|
610
|
+
n,
|
|
611
611
|
r,
|
|
612
|
-
|
|
612
|
+
e.slice(n + 1, r)
|
|
613
613
|
);
|
|
614
614
|
}
|
|
615
|
-
function Be(n, e
|
|
616
|
-
const i =
|
|
617
|
-
let r =
|
|
615
|
+
function Be(t, n, e) {
|
|
616
|
+
const i = t.source.body;
|
|
617
|
+
let r = n, s = e, o = !1;
|
|
618
618
|
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
619
619
|
if (s = i.charCodeAt(++r), S(s))
|
|
620
620
|
throw I(
|
|
621
|
-
|
|
621
|
+
t.source,
|
|
622
622
|
r,
|
|
623
623
|
`Invalid number, unexpected digit after 0: ${N(
|
|
624
|
-
|
|
624
|
+
t,
|
|
625
625
|
r
|
|
626
626
|
)}.`
|
|
627
627
|
);
|
|
628
628
|
} else
|
|
629
|
-
r = M(
|
|
630
|
-
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(
|
|
629
|
+
r = M(t, r, s), s = i.charCodeAt(r);
|
|
630
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = M(t, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = M(t, r, s), s = i.charCodeAt(r)), s === 46 || le(s))
|
|
631
631
|
throw I(
|
|
632
|
-
|
|
632
|
+
t.source,
|
|
633
633
|
r,
|
|
634
634
|
`Invalid number, expected digit but got: ${N(
|
|
635
|
-
|
|
635
|
+
t,
|
|
636
636
|
r
|
|
637
637
|
)}.`
|
|
638
638
|
);
|
|
639
639
|
return g(
|
|
640
|
-
|
|
640
|
+
t,
|
|
641
641
|
o ? a.FLOAT : a.INT,
|
|
642
|
-
|
|
642
|
+
n,
|
|
643
643
|
r,
|
|
644
|
-
i.slice(
|
|
644
|
+
i.slice(n, r)
|
|
645
645
|
);
|
|
646
646
|
}
|
|
647
|
-
function M(n, e
|
|
648
|
-
if (!S(
|
|
647
|
+
function M(t, n, e) {
|
|
648
|
+
if (!S(e))
|
|
649
649
|
throw I(
|
|
650
|
-
|
|
651
|
-
|
|
650
|
+
t.source,
|
|
651
|
+
n,
|
|
652
652
|
`Invalid number, expected digit but got: ${N(
|
|
653
|
-
|
|
654
|
-
|
|
653
|
+
t,
|
|
654
|
+
n
|
|
655
655
|
)}.`
|
|
656
656
|
);
|
|
657
|
-
const i =
|
|
658
|
-
let r =
|
|
657
|
+
const i = t.source.body;
|
|
658
|
+
let r = n + 1;
|
|
659
659
|
for (; S(i.charCodeAt(r)); )
|
|
660
660
|
++r;
|
|
661
661
|
return r;
|
|
662
662
|
}
|
|
663
|
-
function Ve(
|
|
664
|
-
const
|
|
665
|
-
let r =
|
|
663
|
+
function Ve(t, n) {
|
|
664
|
+
const e = t.source.body, i = e.length;
|
|
665
|
+
let r = n + 1, s = r, o = "";
|
|
666
666
|
for (; r < i; ) {
|
|
667
|
-
const u =
|
|
667
|
+
const u = e.charCodeAt(r);
|
|
668
668
|
if (u === 34)
|
|
669
|
-
return o +=
|
|
669
|
+
return o += e.slice(s, r), g(t, a.STRING, n, r + 1, o);
|
|
670
670
|
if (u === 92) {
|
|
671
|
-
o +=
|
|
672
|
-
const h =
|
|
671
|
+
o += e.slice(s, r);
|
|
672
|
+
const h = e.charCodeAt(r + 1) === 117 ? e.charCodeAt(r + 2) === 123 ? Ue(t, r) : Me(t, r) : ze(t, r);
|
|
673
673
|
o += h.value, r += h.size, s = r;
|
|
674
674
|
continue;
|
|
675
675
|
}
|
|
676
676
|
if (u === 10 || u === 13)
|
|
677
677
|
break;
|
|
678
|
-
if (
|
|
678
|
+
if (P(u))
|
|
679
679
|
++r;
|
|
680
|
-
else if (B(
|
|
680
|
+
else if (B(e, r))
|
|
681
681
|
r += 2;
|
|
682
682
|
else
|
|
683
683
|
throw I(
|
|
684
|
-
|
|
684
|
+
t.source,
|
|
685
685
|
r,
|
|
686
686
|
`Invalid character within String: ${N(
|
|
687
|
-
|
|
687
|
+
t,
|
|
688
688
|
r
|
|
689
689
|
)}.`
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
|
-
throw I(
|
|
692
|
+
throw I(t.source, r, "Unterminated string.");
|
|
693
693
|
}
|
|
694
|
-
function Ue(
|
|
695
|
-
const
|
|
694
|
+
function Ue(t, n) {
|
|
695
|
+
const e = t.source.body;
|
|
696
696
|
let i = 0, r = 3;
|
|
697
697
|
for (; r < 12; ) {
|
|
698
|
-
const s =
|
|
698
|
+
const s = e.charCodeAt(n + r++);
|
|
699
699
|
if (s === 125) {
|
|
700
|
-
if (r < 5 || !
|
|
700
|
+
if (r < 5 || !P(i))
|
|
701
701
|
break;
|
|
702
702
|
return {
|
|
703
703
|
value: String.fromCodePoint(i),
|
|
@@ -708,23 +708,23 @@ function Ue(n, e) {
|
|
|
708
708
|
break;
|
|
709
709
|
}
|
|
710
710
|
throw I(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
`Invalid Unicode escape sequence: "${
|
|
714
|
-
|
|
715
|
-
|
|
711
|
+
t.source,
|
|
712
|
+
n,
|
|
713
|
+
`Invalid Unicode escape sequence: "${e.slice(
|
|
714
|
+
n,
|
|
715
|
+
n + r
|
|
716
716
|
)}".`
|
|
717
717
|
);
|
|
718
718
|
}
|
|
719
|
-
function Me(
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
719
|
+
function Me(t, n) {
|
|
720
|
+
const e = t.source.body, i = W(e, n + 2);
|
|
721
|
+
if (P(i))
|
|
722
722
|
return {
|
|
723
723
|
value: String.fromCodePoint(i),
|
|
724
724
|
size: 6
|
|
725
725
|
};
|
|
726
|
-
if (he(i) &&
|
|
727
|
-
const r = W(
|
|
726
|
+
if (he(i) && e.charCodeAt(n + 6) === 92 && e.charCodeAt(n + 7) === 117) {
|
|
727
|
+
const r = W(e, n + 8);
|
|
728
728
|
if (pe(r))
|
|
729
729
|
return {
|
|
730
730
|
value: String.fromCodePoint(i, r),
|
|
@@ -732,20 +732,20 @@ function Me(n, e) {
|
|
|
732
732
|
};
|
|
733
733
|
}
|
|
734
734
|
throw I(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
`Invalid Unicode escape sequence: "${
|
|
735
|
+
t.source,
|
|
736
|
+
n,
|
|
737
|
+
`Invalid Unicode escape sequence: "${e.slice(n, n + 6)}".`
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
|
-
function W(
|
|
741
|
-
return b(
|
|
740
|
+
function W(t, n) {
|
|
741
|
+
return b(t.charCodeAt(n)) << 12 | b(t.charCodeAt(n + 1)) << 8 | b(t.charCodeAt(n + 2)) << 4 | b(t.charCodeAt(n + 3));
|
|
742
742
|
}
|
|
743
|
-
function b(
|
|
744
|
-
return
|
|
743
|
+
function b(t) {
|
|
744
|
+
return t >= 48 && t <= 57 ? t - 48 : t >= 65 && t <= 70 ? t - 55 : t >= 97 && t <= 102 ? t - 87 : -1;
|
|
745
745
|
}
|
|
746
|
-
function ze(
|
|
747
|
-
const
|
|
748
|
-
switch (
|
|
746
|
+
function ze(t, n) {
|
|
747
|
+
const e = t.source.body;
|
|
748
|
+
switch (e.charCodeAt(n + 1)) {
|
|
749
749
|
case 34:
|
|
750
750
|
return {
|
|
751
751
|
value: '"',
|
|
@@ -789,150 +789,150 @@ function ze(n, e) {
|
|
|
789
789
|
};
|
|
790
790
|
}
|
|
791
791
|
throw I(
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
`Invalid character escape sequence: "${
|
|
795
|
-
|
|
796
|
-
|
|
792
|
+
t.source,
|
|
793
|
+
n,
|
|
794
|
+
`Invalid character escape sequence: "${e.slice(
|
|
795
|
+
n,
|
|
796
|
+
n + 2
|
|
797
797
|
)}".`
|
|
798
798
|
);
|
|
799
799
|
}
|
|
800
|
-
function qe(
|
|
801
|
-
const
|
|
802
|
-
let r =
|
|
800
|
+
function qe(t, n) {
|
|
801
|
+
const e = t.source.body, i = e.length;
|
|
802
|
+
let r = t.lineStart, s = n + 3, o = s, u = "";
|
|
803
803
|
const h = [];
|
|
804
804
|
for (; s < i; ) {
|
|
805
|
-
const E =
|
|
806
|
-
if (E === 34 &&
|
|
807
|
-
u +=
|
|
805
|
+
const E = e.charCodeAt(s);
|
|
806
|
+
if (E === 34 && e.charCodeAt(s + 1) === 34 && e.charCodeAt(s + 2) === 34) {
|
|
807
|
+
u += e.slice(o, s), h.push(u);
|
|
808
808
|
const m = g(
|
|
809
|
-
|
|
809
|
+
t,
|
|
810
810
|
a.BLOCK_STRING,
|
|
811
|
-
|
|
811
|
+
n,
|
|
812
812
|
s + 3,
|
|
813
813
|
// Return a string of the lines joined with U+000A.
|
|
814
814
|
_e(h).join(`
|
|
815
815
|
`)
|
|
816
816
|
);
|
|
817
|
-
return
|
|
817
|
+
return t.line += h.length - 1, t.lineStart = r, m;
|
|
818
818
|
}
|
|
819
|
-
if (E === 92 &&
|
|
820
|
-
u +=
|
|
819
|
+
if (E === 92 && e.charCodeAt(s + 1) === 34 && e.charCodeAt(s + 2) === 34 && e.charCodeAt(s + 3) === 34) {
|
|
820
|
+
u += e.slice(o, s), o = s + 1, s += 4;
|
|
821
821
|
continue;
|
|
822
822
|
}
|
|
823
823
|
if (E === 10 || E === 13) {
|
|
824
|
-
u +=
|
|
824
|
+
u += e.slice(o, s), h.push(u), E === 13 && e.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", o = s, r = s;
|
|
825
825
|
continue;
|
|
826
826
|
}
|
|
827
|
-
if (
|
|
827
|
+
if (P(E))
|
|
828
828
|
++s;
|
|
829
|
-
else if (B(
|
|
829
|
+
else if (B(e, s))
|
|
830
830
|
s += 2;
|
|
831
831
|
else
|
|
832
832
|
throw I(
|
|
833
|
-
|
|
833
|
+
t.source,
|
|
834
834
|
s,
|
|
835
835
|
`Invalid character within String: ${N(
|
|
836
|
-
|
|
836
|
+
t,
|
|
837
837
|
s
|
|
838
838
|
)}.`
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
|
-
throw I(
|
|
841
|
+
throw I(t.source, s, "Unterminated string.");
|
|
842
842
|
}
|
|
843
|
-
function Ge(
|
|
844
|
-
const
|
|
845
|
-
let r =
|
|
843
|
+
function Ge(t, n) {
|
|
844
|
+
const e = t.source.body, i = e.length;
|
|
845
|
+
let r = n + 1;
|
|
846
846
|
for (; r < i; ) {
|
|
847
|
-
const s =
|
|
847
|
+
const s = e.charCodeAt(r);
|
|
848
848
|
if (Ce(s))
|
|
849
849
|
++r;
|
|
850
850
|
else
|
|
851
851
|
break;
|
|
852
852
|
}
|
|
853
853
|
return g(
|
|
854
|
-
|
|
854
|
+
t,
|
|
855
855
|
a.NAME,
|
|
856
|
-
|
|
856
|
+
n,
|
|
857
857
|
r,
|
|
858
|
-
|
|
858
|
+
e.slice(n, r)
|
|
859
859
|
);
|
|
860
860
|
}
|
|
861
861
|
const je = 10, me = 2;
|
|
862
|
-
function fe(
|
|
863
|
-
return V(
|
|
862
|
+
function fe(t) {
|
|
863
|
+
return V(t, []);
|
|
864
864
|
}
|
|
865
|
-
function V(
|
|
866
|
-
switch (typeof
|
|
865
|
+
function V(t, n) {
|
|
866
|
+
switch (typeof t) {
|
|
867
867
|
case "string":
|
|
868
|
-
return JSON.stringify(
|
|
868
|
+
return JSON.stringify(t);
|
|
869
869
|
case "function":
|
|
870
|
-
return
|
|
870
|
+
return t.name ? `[function ${t.name}]` : "[function]";
|
|
871
871
|
case "object":
|
|
872
|
-
return Ye(
|
|
872
|
+
return Ye(t, n);
|
|
873
873
|
default:
|
|
874
|
-
return String(
|
|
874
|
+
return String(t);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
function Ye(
|
|
878
|
-
if (
|
|
877
|
+
function Ye(t, n) {
|
|
878
|
+
if (t === null)
|
|
879
879
|
return "null";
|
|
880
|
-
if (
|
|
880
|
+
if (n.includes(t))
|
|
881
881
|
return "[Circular]";
|
|
882
|
-
const
|
|
883
|
-
if (He(
|
|
884
|
-
const i =
|
|
885
|
-
if (i !==
|
|
886
|
-
return typeof i == "string" ? i : V(i,
|
|
887
|
-
} else if (Array.isArray(
|
|
888
|
-
return Qe(
|
|
889
|
-
return Je(
|
|
890
|
-
}
|
|
891
|
-
function He(
|
|
892
|
-
return typeof
|
|
893
|
-
}
|
|
894
|
-
function Je(
|
|
895
|
-
const
|
|
896
|
-
return
|
|
897
|
-
([r, s]) => r + ": " + V(s,
|
|
882
|
+
const e = [...n, t];
|
|
883
|
+
if (He(t)) {
|
|
884
|
+
const i = t.toJSON();
|
|
885
|
+
if (i !== t)
|
|
886
|
+
return typeof i == "string" ? i : V(i, e);
|
|
887
|
+
} else if (Array.isArray(t))
|
|
888
|
+
return Qe(t, e);
|
|
889
|
+
return Je(t, e);
|
|
890
|
+
}
|
|
891
|
+
function He(t) {
|
|
892
|
+
return typeof t.toJSON == "function";
|
|
893
|
+
}
|
|
894
|
+
function Je(t, n) {
|
|
895
|
+
const e = Object.entries(t);
|
|
896
|
+
return e.length === 0 ? "{}" : n.length > me ? "[" + Xe(t) + "]" : "{ " + e.map(
|
|
897
|
+
([r, s]) => r + ": " + V(s, n)
|
|
898
898
|
).join(", ") + " }";
|
|
899
899
|
}
|
|
900
|
-
function Qe(
|
|
901
|
-
if (
|
|
900
|
+
function Qe(t, n) {
|
|
901
|
+
if (t.length === 0)
|
|
902
902
|
return "[]";
|
|
903
|
-
if (
|
|
903
|
+
if (n.length > me)
|
|
904
904
|
return "[Array]";
|
|
905
|
-
const
|
|
906
|
-
for (let s = 0; s <
|
|
907
|
-
r.push(V(
|
|
905
|
+
const e = Math.min(je, t.length), i = t.length - e, r = [];
|
|
906
|
+
for (let s = 0; s < e; ++s)
|
|
907
|
+
r.push(V(t[s], n));
|
|
908
908
|
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
909
909
|
}
|
|
910
|
-
function Xe(
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
if (typeof
|
|
915
|
-
return
|
|
910
|
+
function Xe(t) {
|
|
911
|
+
const n = Object.prototype.toString.call(t).replace(/^\[object /, "").replace(/]$/, "");
|
|
912
|
+
if (n === "Object" && typeof t.constructor == "function") {
|
|
913
|
+
const e = t.constructor.name;
|
|
914
|
+
if (typeof e == "string" && e !== "")
|
|
915
|
+
return e;
|
|
916
916
|
}
|
|
917
|
-
return
|
|
917
|
+
return n;
|
|
918
918
|
}
|
|
919
919
|
const We = globalThis.process && // eslint-disable-next-line no-undef
|
|
920
920
|
process.env.NODE_ENV === "production", Ze = (
|
|
921
921
|
/* c8 ignore next 6 */
|
|
922
922
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
923
|
-
We ? function(
|
|
924
|
-
return
|
|
925
|
-
} : function(
|
|
926
|
-
if (
|
|
923
|
+
We ? function(n, e) {
|
|
924
|
+
return n instanceof e;
|
|
925
|
+
} : function(n, e) {
|
|
926
|
+
if (n instanceof e)
|
|
927
927
|
return !0;
|
|
928
|
-
if (typeof
|
|
928
|
+
if (typeof n == "object" && n !== null) {
|
|
929
929
|
var i;
|
|
930
|
-
const r =
|
|
930
|
+
const r = e.prototype[Symbol.toStringTag], s = (
|
|
931
931
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
932
|
-
Symbol.toStringTag in
|
|
932
|
+
Symbol.toStringTag in n ? n[Symbol.toStringTag] : (i = n.constructor) === null || i === void 0 ? void 0 : i.name
|
|
933
933
|
);
|
|
934
934
|
if (r === s) {
|
|
935
|
-
const o = fe(
|
|
935
|
+
const o = fe(n);
|
|
936
936
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
937
937
|
|
|
938
938
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -951,11 +951,11 @@ spurious results.`);
|
|
|
951
951
|
}
|
|
952
952
|
);
|
|
953
953
|
class ge {
|
|
954
|
-
constructor(
|
|
954
|
+
constructor(n, e = "GraphQL request", i = {
|
|
955
955
|
line: 1,
|
|
956
956
|
column: 1
|
|
957
957
|
}) {
|
|
958
|
-
typeof
|
|
958
|
+
typeof n == "string" || U(!1, `Body must be a string. Received: ${fe(n)}.`), this.body = n, this.name = e, this.locationOffset = i, this.locationOffset.line > 0 || U(
|
|
959
959
|
!1,
|
|
960
960
|
"line in locationOffset is 1-indexed and must be positive."
|
|
961
961
|
), this.locationOffset.column > 0 || U(
|
|
@@ -967,23 +967,23 @@ class ge {
|
|
|
967
967
|
return "Source";
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
function Ke(
|
|
971
|
-
return Ze(
|
|
970
|
+
function Ke(t) {
|
|
971
|
+
return Ze(t, ge);
|
|
972
972
|
}
|
|
973
|
-
function et(
|
|
974
|
-
const
|
|
973
|
+
function et(t, n) {
|
|
974
|
+
const e = new tt(t, n), i = e.parseDocument();
|
|
975
975
|
return Object.defineProperty(i, "tokenCount", {
|
|
976
976
|
enumerable: !1,
|
|
977
|
-
value:
|
|
977
|
+
value: e.tokenCount
|
|
978
978
|
}), i;
|
|
979
979
|
}
|
|
980
980
|
class tt {
|
|
981
|
-
constructor(
|
|
982
|
-
const { lexer: i, ...r } =
|
|
981
|
+
constructor(n, e = {}) {
|
|
982
|
+
const { lexer: i, ...r } = e;
|
|
983
983
|
if (i)
|
|
984
984
|
this._lexer = i;
|
|
985
985
|
else {
|
|
986
|
-
const s = Ke(
|
|
986
|
+
const s = Ke(n) ? n : new ge(n);
|
|
987
987
|
this._lexer = new Re(s);
|
|
988
988
|
}
|
|
989
989
|
this._options = r, this._tokenCounter = 0;
|
|
@@ -995,10 +995,10 @@ class tt {
|
|
|
995
995
|
* Converts a name lex token into a name parse node.
|
|
996
996
|
*/
|
|
997
997
|
parseName() {
|
|
998
|
-
const
|
|
999
|
-
return this.node(
|
|
998
|
+
const n = this.expectToken(a.NAME);
|
|
999
|
+
return this.node(n, {
|
|
1000
1000
|
kind: c.NAME,
|
|
1001
|
-
value:
|
|
1001
|
+
value: n.value
|
|
1002
1002
|
});
|
|
1003
1003
|
}
|
|
1004
1004
|
// Implements the parsing rules in the Document section.
|
|
@@ -1041,15 +1041,15 @@ class tt {
|
|
|
1041
1041
|
parseDefinition() {
|
|
1042
1042
|
if (this.peek(a.BRACE_L))
|
|
1043
1043
|
return this.parseOperationDefinition();
|
|
1044
|
-
const
|
|
1045
|
-
if (
|
|
1044
|
+
const n = this.peekDescription(), e = n ? this._lexer.lookahead() : this._lexer.token;
|
|
1045
|
+
if (n && e.kind === a.BRACE_L)
|
|
1046
1046
|
throw I(
|
|
1047
1047
|
this._lexer.source,
|
|
1048
1048
|
this._lexer.token.start,
|
|
1049
1049
|
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
1050
1050
|
);
|
|
1051
|
-
if (
|
|
1052
|
-
switch (
|
|
1051
|
+
if (e.kind === a.NAME) {
|
|
1052
|
+
switch (e.value) {
|
|
1053
1053
|
case "schema":
|
|
1054
1054
|
return this.parseSchemaDefinition();
|
|
1055
1055
|
case "scalar":
|
|
@@ -1067,7 +1067,7 @@ class tt {
|
|
|
1067
1067
|
case "directive":
|
|
1068
1068
|
return this.parseDirectiveDefinition();
|
|
1069
1069
|
}
|
|
1070
|
-
switch (
|
|
1070
|
+
switch (e.value) {
|
|
1071
1071
|
case "query":
|
|
1072
1072
|
case "mutation":
|
|
1073
1073
|
case "subscription":
|
|
@@ -1075,16 +1075,16 @@ class tt {
|
|
|
1075
1075
|
case "fragment":
|
|
1076
1076
|
return this.parseFragmentDefinition();
|
|
1077
1077
|
}
|
|
1078
|
-
if (
|
|
1078
|
+
if (n)
|
|
1079
1079
|
throw I(
|
|
1080
1080
|
this._lexer.source,
|
|
1081
1081
|
this._lexer.token.start,
|
|
1082
1082
|
"Unexpected description, only GraphQL definitions support descriptions."
|
|
1083
1083
|
);
|
|
1084
|
-
if (
|
|
1084
|
+
if (e.value === "extend")
|
|
1085
1085
|
return this.parseTypeSystemExtension();
|
|
1086
1086
|
}
|
|
1087
|
-
throw this.unexpected(
|
|
1087
|
+
throw this.unexpected(e);
|
|
1088
1088
|
}
|
|
1089
1089
|
// Implements the parsing rules in the Operations section.
|
|
1090
1090
|
/**
|
|
@@ -1093,9 +1093,9 @@ class tt {
|
|
|
1093
1093
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1094
1094
|
*/
|
|
1095
1095
|
parseOperationDefinition() {
|
|
1096
|
-
const
|
|
1096
|
+
const n = this._lexer.token;
|
|
1097
1097
|
if (this.peek(a.BRACE_L))
|
|
1098
|
-
return this.node(
|
|
1098
|
+
return this.node(n, {
|
|
1099
1099
|
kind: c.OPERATION_DEFINITION,
|
|
1100
1100
|
operation: D.QUERY,
|
|
1101
1101
|
description: void 0,
|
|
@@ -1104,12 +1104,12 @@ class tt {
|
|
|
1104
1104
|
directives: [],
|
|
1105
1105
|
selectionSet: this.parseSelectionSet()
|
|
1106
1106
|
});
|
|
1107
|
-
const
|
|
1107
|
+
const e = this.parseDescription(), i = this.parseOperationType();
|
|
1108
1108
|
let r;
|
|
1109
|
-
return this.peek(a.NAME) && (r = this.parseName()), this.node(
|
|
1109
|
+
return this.peek(a.NAME) && (r = this.parseName()), this.node(n, {
|
|
1110
1110
|
kind: c.OPERATION_DEFINITION,
|
|
1111
1111
|
operation: i,
|
|
1112
|
-
description:
|
|
1112
|
+
description: e,
|
|
1113
1113
|
name: r,
|
|
1114
1114
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1115
1115
|
directives: this.parseDirectives(!1),
|
|
@@ -1120,8 +1120,8 @@ class tt {
|
|
|
1120
1120
|
* OperationType : one of query mutation subscription
|
|
1121
1121
|
*/
|
|
1122
1122
|
parseOperationType() {
|
|
1123
|
-
const
|
|
1124
|
-
switch (
|
|
1123
|
+
const n = this.expectToken(a.NAME);
|
|
1124
|
+
switch (n.value) {
|
|
1125
1125
|
case "query":
|
|
1126
1126
|
return D.QUERY;
|
|
1127
1127
|
case "mutation":
|
|
@@ -1129,7 +1129,7 @@ class tt {
|
|
|
1129
1129
|
case "subscription":
|
|
1130
1130
|
return D.SUBSCRIPTION;
|
|
1131
1131
|
}
|
|
1132
|
-
throw this.unexpected(
|
|
1132
|
+
throw this.unexpected(n);
|
|
1133
1133
|
}
|
|
1134
1134
|
/**
|
|
1135
1135
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
@@ -1158,8 +1158,8 @@ class tt {
|
|
|
1158
1158
|
* Variable : $ Name
|
|
1159
1159
|
*/
|
|
1160
1160
|
parseVariable() {
|
|
1161
|
-
const
|
|
1162
|
-
return this.expectToken(a.DOLLAR), this.node(
|
|
1161
|
+
const n = this._lexer.token;
|
|
1162
|
+
return this.expectToken(a.DOLLAR), this.node(n, {
|
|
1163
1163
|
kind: c.VARIABLE,
|
|
1164
1164
|
name: this.parseName()
|
|
1165
1165
|
});
|
|
@@ -1194,9 +1194,9 @@ class tt {
|
|
|
1194
1194
|
* Alias : Name :
|
|
1195
1195
|
*/
|
|
1196
1196
|
parseField() {
|
|
1197
|
-
const
|
|
1197
|
+
const n = this._lexer.token, e = this.parseName();
|
|
1198
1198
|
let i, r;
|
|
1199
|
-
return this.expectOptionalToken(a.COLON) ? (i =
|
|
1199
|
+
return this.expectOptionalToken(a.COLON) ? (i = e, r = this.parseName()) : r = e, this.node(n, {
|
|
1200
1200
|
kind: c.FIELD,
|
|
1201
1201
|
alias: i,
|
|
1202
1202
|
name: r,
|
|
@@ -1208,19 +1208,19 @@ class tt {
|
|
|
1208
1208
|
/**
|
|
1209
1209
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1210
1210
|
*/
|
|
1211
|
-
parseArguments(
|
|
1212
|
-
const
|
|
1213
|
-
return this.optionalMany(a.PAREN_L,
|
|
1211
|
+
parseArguments(n) {
|
|
1212
|
+
const e = n ? this.parseConstArgument : this.parseArgument;
|
|
1213
|
+
return this.optionalMany(a.PAREN_L, e, a.PAREN_R);
|
|
1214
1214
|
}
|
|
1215
1215
|
/**
|
|
1216
1216
|
* Argument[Const] : Name : Value[?Const]
|
|
1217
1217
|
*/
|
|
1218
|
-
parseArgument(
|
|
1219
|
-
const
|
|
1220
|
-
return this.expectToken(a.COLON), this.node(
|
|
1218
|
+
parseArgument(n = !1) {
|
|
1219
|
+
const e = this._lexer.token, i = this.parseName();
|
|
1220
|
+
return this.expectToken(a.COLON), this.node(e, {
|
|
1221
1221
|
kind: c.ARGUMENT,
|
|
1222
1222
|
name: i,
|
|
1223
|
-
value: this.parseValueLiteral(
|
|
1223
|
+
value: this.parseValueLiteral(n)
|
|
1224
1224
|
});
|
|
1225
1225
|
}
|
|
1226
1226
|
parseConstArgument() {
|
|
@@ -1235,16 +1235,16 @@ class tt {
|
|
|
1235
1235
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1236
1236
|
*/
|
|
1237
1237
|
parseFragment() {
|
|
1238
|
-
const
|
|
1238
|
+
const n = this._lexer.token;
|
|
1239
1239
|
this.expectToken(a.SPREAD);
|
|
1240
|
-
const
|
|
1241
|
-
return !
|
|
1240
|
+
const e = this.expectOptionalKeyword("on");
|
|
1241
|
+
return !e && this.peek(a.NAME) ? this.node(n, {
|
|
1242
1242
|
kind: c.FRAGMENT_SPREAD,
|
|
1243
1243
|
name: this.parseFragmentName(),
|
|
1244
1244
|
directives: this.parseDirectives(!1)
|
|
1245
|
-
}) : this.node(
|
|
1245
|
+
}) : this.node(n, {
|
|
1246
1246
|
kind: c.INLINE_FRAGMENT,
|
|
1247
|
-
typeCondition:
|
|
1247
|
+
typeCondition: e ? this.parseNamedType() : void 0,
|
|
1248
1248
|
directives: this.parseDirectives(!1),
|
|
1249
1249
|
selectionSet: this.parseSelectionSet()
|
|
1250
1250
|
});
|
|
@@ -1256,18 +1256,18 @@ class tt {
|
|
|
1256
1256
|
* TypeCondition : NamedType
|
|
1257
1257
|
*/
|
|
1258
1258
|
parseFragmentDefinition() {
|
|
1259
|
-
const
|
|
1260
|
-
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(
|
|
1259
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1260
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(n, {
|
|
1261
1261
|
kind: c.FRAGMENT_DEFINITION,
|
|
1262
|
-
description:
|
|
1262
|
+
description: e,
|
|
1263
1263
|
name: this.parseFragmentName(),
|
|
1264
1264
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1265
1265
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1266
1266
|
directives: this.parseDirectives(!1),
|
|
1267
1267
|
selectionSet: this.parseSelectionSet()
|
|
1268
|
-
}) : this.node(
|
|
1268
|
+
}) : this.node(n, {
|
|
1269
1269
|
kind: c.FRAGMENT_DEFINITION,
|
|
1270
|
-
description:
|
|
1270
|
+
description: e,
|
|
1271
1271
|
name: this.parseFragmentName(),
|
|
1272
1272
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1273
1273
|
directives: this.parseDirectives(!1),
|
|
@@ -1301,59 +1301,59 @@ class tt {
|
|
|
1301
1301
|
*
|
|
1302
1302
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1303
1303
|
*/
|
|
1304
|
-
parseValueLiteral(
|
|
1305
|
-
const
|
|
1306
|
-
switch (
|
|
1304
|
+
parseValueLiteral(n) {
|
|
1305
|
+
const e = this._lexer.token;
|
|
1306
|
+
switch (e.kind) {
|
|
1307
1307
|
case a.BRACKET_L:
|
|
1308
|
-
return this.parseList(
|
|
1308
|
+
return this.parseList(n);
|
|
1309
1309
|
case a.BRACE_L:
|
|
1310
|
-
return this.parseObject(
|
|
1310
|
+
return this.parseObject(n);
|
|
1311
1311
|
case a.INT:
|
|
1312
|
-
return this.advanceLexer(), this.node(
|
|
1312
|
+
return this.advanceLexer(), this.node(e, {
|
|
1313
1313
|
kind: c.INT,
|
|
1314
|
-
value:
|
|
1314
|
+
value: e.value
|
|
1315
1315
|
});
|
|
1316
1316
|
case a.FLOAT:
|
|
1317
|
-
return this.advanceLexer(), this.node(
|
|
1317
|
+
return this.advanceLexer(), this.node(e, {
|
|
1318
1318
|
kind: c.FLOAT,
|
|
1319
|
-
value:
|
|
1319
|
+
value: e.value
|
|
1320
1320
|
});
|
|
1321
1321
|
case a.STRING:
|
|
1322
1322
|
case a.BLOCK_STRING:
|
|
1323
1323
|
return this.parseStringLiteral();
|
|
1324
1324
|
case a.NAME:
|
|
1325
|
-
switch (this.advanceLexer(),
|
|
1325
|
+
switch (this.advanceLexer(), e.value) {
|
|
1326
1326
|
case "true":
|
|
1327
|
-
return this.node(
|
|
1327
|
+
return this.node(e, {
|
|
1328
1328
|
kind: c.BOOLEAN,
|
|
1329
1329
|
value: !0
|
|
1330
1330
|
});
|
|
1331
1331
|
case "false":
|
|
1332
|
-
return this.node(
|
|
1332
|
+
return this.node(e, {
|
|
1333
1333
|
kind: c.BOOLEAN,
|
|
1334
1334
|
value: !1
|
|
1335
1335
|
});
|
|
1336
1336
|
case "null":
|
|
1337
|
-
return this.node(
|
|
1337
|
+
return this.node(e, {
|
|
1338
1338
|
kind: c.NULL
|
|
1339
1339
|
});
|
|
1340
1340
|
default:
|
|
1341
|
-
return this.node(
|
|
1341
|
+
return this.node(e, {
|
|
1342
1342
|
kind: c.ENUM,
|
|
1343
|
-
value:
|
|
1343
|
+
value: e.value
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
case a.DOLLAR:
|
|
1347
|
-
if (
|
|
1347
|
+
if (n)
|
|
1348
1348
|
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1349
1349
|
const i = this._lexer.token.value;
|
|
1350
1350
|
throw I(
|
|
1351
1351
|
this._lexer.source,
|
|
1352
|
-
|
|
1352
|
+
e.start,
|
|
1353
1353
|
`Unexpected variable "$${i}" in constant value.`
|
|
1354
1354
|
);
|
|
1355
1355
|
} else
|
|
1356
|
-
throw this.unexpected(
|
|
1356
|
+
throw this.unexpected(e);
|
|
1357
1357
|
return this.parseVariable();
|
|
1358
1358
|
default:
|
|
1359
1359
|
throw this.unexpected();
|
|
@@ -1363,11 +1363,11 @@ class tt {
|
|
|
1363
1363
|
return this.parseValueLiteral(!0);
|
|
1364
1364
|
}
|
|
1365
1365
|
parseStringLiteral() {
|
|
1366
|
-
const
|
|
1367
|
-
return this.advanceLexer(), this.node(
|
|
1366
|
+
const n = this._lexer.token;
|
|
1367
|
+
return this.advanceLexer(), this.node(n, {
|
|
1368
1368
|
kind: c.STRING,
|
|
1369
|
-
value:
|
|
1370
|
-
block:
|
|
1369
|
+
value: n.value,
|
|
1370
|
+
block: n.kind === a.BLOCK_STRING
|
|
1371
1371
|
});
|
|
1372
1372
|
}
|
|
1373
1373
|
/**
|
|
@@ -1375,11 +1375,11 @@ class tt {
|
|
|
1375
1375
|
* - [ ]
|
|
1376
1376
|
* - [ Value[?Const]+ ]
|
|
1377
1377
|
*/
|
|
1378
|
-
parseList(
|
|
1379
|
-
const
|
|
1378
|
+
parseList(n) {
|
|
1379
|
+
const e = () => this.parseValueLiteral(n);
|
|
1380
1380
|
return this.node(this._lexer.token, {
|
|
1381
1381
|
kind: c.LIST,
|
|
1382
|
-
values: this.any(a.BRACKET_L,
|
|
1382
|
+
values: this.any(a.BRACKET_L, e, a.BRACKET_R)
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
1385
|
/**
|
|
@@ -1389,33 +1389,33 @@ class tt {
|
|
|
1389
1389
|
* - { ObjectField[?Const]+ }
|
|
1390
1390
|
* ```
|
|
1391
1391
|
*/
|
|
1392
|
-
parseObject(
|
|
1393
|
-
const
|
|
1392
|
+
parseObject(n) {
|
|
1393
|
+
const e = () => this.parseObjectField(n);
|
|
1394
1394
|
return this.node(this._lexer.token, {
|
|
1395
1395
|
kind: c.OBJECT,
|
|
1396
|
-
fields: this.any(a.BRACE_L,
|
|
1396
|
+
fields: this.any(a.BRACE_L, e, a.BRACE_R)
|
|
1397
1397
|
});
|
|
1398
1398
|
}
|
|
1399
1399
|
/**
|
|
1400
1400
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1401
1401
|
*/
|
|
1402
|
-
parseObjectField(
|
|
1403
|
-
const
|
|
1404
|
-
return this.expectToken(a.COLON), this.node(
|
|
1402
|
+
parseObjectField(n) {
|
|
1403
|
+
const e = this._lexer.token, i = this.parseName();
|
|
1404
|
+
return this.expectToken(a.COLON), this.node(e, {
|
|
1405
1405
|
kind: c.OBJECT_FIELD,
|
|
1406
1406
|
name: i,
|
|
1407
|
-
value: this.parseValueLiteral(
|
|
1407
|
+
value: this.parseValueLiteral(n)
|
|
1408
1408
|
});
|
|
1409
1409
|
}
|
|
1410
1410
|
// Implements the parsing rules in the Directives section.
|
|
1411
1411
|
/**
|
|
1412
1412
|
* Directives[Const] : Directive[?Const]+
|
|
1413
1413
|
*/
|
|
1414
|
-
parseDirectives(
|
|
1415
|
-
const
|
|
1414
|
+
parseDirectives(n) {
|
|
1415
|
+
const e = [];
|
|
1416
1416
|
for (; this.peek(a.AT); )
|
|
1417
|
-
|
|
1418
|
-
return
|
|
1417
|
+
e.push(this.parseDirective(n));
|
|
1418
|
+
return e;
|
|
1419
1419
|
}
|
|
1420
1420
|
parseConstDirectives() {
|
|
1421
1421
|
return this.parseDirectives(!0);
|
|
@@ -1425,12 +1425,12 @@ class tt {
|
|
|
1425
1425
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1426
1426
|
* ```
|
|
1427
1427
|
*/
|
|
1428
|
-
parseDirective(
|
|
1429
|
-
const
|
|
1430
|
-
return this.expectToken(a.AT), this.node(
|
|
1428
|
+
parseDirective(n) {
|
|
1429
|
+
const e = this._lexer.token;
|
|
1430
|
+
return this.expectToken(a.AT), this.node(e, {
|
|
1431
1431
|
kind: c.DIRECTIVE,
|
|
1432
1432
|
name: this.parseName(),
|
|
1433
|
-
arguments: this.parseArguments(
|
|
1433
|
+
arguments: this.parseArguments(n)
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
1436
|
// Implements the parsing rules in the Types section.
|
|
@@ -1441,20 +1441,20 @@ class tt {
|
|
|
1441
1441
|
* - NonNullType
|
|
1442
1442
|
*/
|
|
1443
1443
|
parseTypeReference() {
|
|
1444
|
-
const
|
|
1445
|
-
let
|
|
1444
|
+
const n = this._lexer.token;
|
|
1445
|
+
let e;
|
|
1446
1446
|
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1447
1447
|
const i = this.parseTypeReference();
|
|
1448
|
-
this.expectToken(a.BRACKET_R),
|
|
1448
|
+
this.expectToken(a.BRACKET_R), e = this.node(n, {
|
|
1449
1449
|
kind: c.LIST_TYPE,
|
|
1450
1450
|
type: i
|
|
1451
1451
|
});
|
|
1452
1452
|
} else
|
|
1453
|
-
|
|
1454
|
-
return this.expectOptionalToken(a.BANG) ? this.node(
|
|
1453
|
+
e = this.parseNamedType();
|
|
1454
|
+
return this.expectOptionalToken(a.BANG) ? this.node(n, {
|
|
1455
1455
|
kind: c.NON_NULL_TYPE,
|
|
1456
|
-
type:
|
|
1457
|
-
}) :
|
|
1456
|
+
type: e
|
|
1457
|
+
}) : e;
|
|
1458
1458
|
}
|
|
1459
1459
|
/**
|
|
1460
1460
|
* NamedType : Name
|
|
@@ -1482,16 +1482,16 @@ class tt {
|
|
|
1482
1482
|
* ```
|
|
1483
1483
|
*/
|
|
1484
1484
|
parseSchemaDefinition() {
|
|
1485
|
-
const
|
|
1485
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1486
1486
|
this.expectKeyword("schema");
|
|
1487
1487
|
const i = this.parseConstDirectives(), r = this.many(
|
|
1488
1488
|
a.BRACE_L,
|
|
1489
1489
|
this.parseOperationTypeDefinition,
|
|
1490
1490
|
a.BRACE_R
|
|
1491
1491
|
);
|
|
1492
|
-
return this.node(
|
|
1492
|
+
return this.node(n, {
|
|
1493
1493
|
kind: c.SCHEMA_DEFINITION,
|
|
1494
|
-
description:
|
|
1494
|
+
description: e,
|
|
1495
1495
|
directives: i,
|
|
1496
1496
|
operationTypes: r
|
|
1497
1497
|
});
|
|
@@ -1500,12 +1500,12 @@ class tt {
|
|
|
1500
1500
|
* OperationTypeDefinition : OperationType : NamedType
|
|
1501
1501
|
*/
|
|
1502
1502
|
parseOperationTypeDefinition() {
|
|
1503
|
-
const
|
|
1503
|
+
const n = this._lexer.token, e = this.parseOperationType();
|
|
1504
1504
|
this.expectToken(a.COLON);
|
|
1505
1505
|
const i = this.parseNamedType();
|
|
1506
|
-
return this.node(
|
|
1506
|
+
return this.node(n, {
|
|
1507
1507
|
kind: c.OPERATION_TYPE_DEFINITION,
|
|
1508
|
-
operation:
|
|
1508
|
+
operation: e,
|
|
1509
1509
|
type: i
|
|
1510
1510
|
});
|
|
1511
1511
|
}
|
|
@@ -1513,12 +1513,12 @@ class tt {
|
|
|
1513
1513
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1514
1514
|
*/
|
|
1515
1515
|
parseScalarTypeDefinition() {
|
|
1516
|
-
const
|
|
1516
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1517
1517
|
this.expectKeyword("scalar");
|
|
1518
1518
|
const i = this.parseName(), r = this.parseConstDirectives();
|
|
1519
|
-
return this.node(
|
|
1519
|
+
return this.node(n, {
|
|
1520
1520
|
kind: c.SCALAR_TYPE_DEFINITION,
|
|
1521
|
-
description:
|
|
1521
|
+
description: e,
|
|
1522
1522
|
name: i,
|
|
1523
1523
|
directives: r
|
|
1524
1524
|
});
|
|
@@ -1529,12 +1529,12 @@ class tt {
|
|
|
1529
1529
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1530
1530
|
*/
|
|
1531
1531
|
parseObjectTypeDefinition() {
|
|
1532
|
-
const
|
|
1532
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1533
1533
|
this.expectKeyword("type");
|
|
1534
1534
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1535
|
-
return this.node(
|
|
1535
|
+
return this.node(n, {
|
|
1536
1536
|
kind: c.OBJECT_TYPE_DEFINITION,
|
|
1537
|
-
description:
|
|
1537
|
+
description: e,
|
|
1538
1538
|
name: i,
|
|
1539
1539
|
interfaces: r,
|
|
1540
1540
|
directives: s,
|
|
@@ -1566,12 +1566,12 @@ class tt {
|
|
|
1566
1566
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1567
1567
|
*/
|
|
1568
1568
|
parseFieldDefinition() {
|
|
1569
|
-
const
|
|
1569
|
+
const n = this._lexer.token, e = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
1570
1570
|
this.expectToken(a.COLON);
|
|
1571
1571
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1572
|
-
return this.node(
|
|
1572
|
+
return this.node(n, {
|
|
1573
1573
|
kind: c.FIELD_DEFINITION,
|
|
1574
|
-
description:
|
|
1574
|
+
description: e,
|
|
1575
1575
|
name: i,
|
|
1576
1576
|
arguments: r,
|
|
1577
1577
|
type: s,
|
|
@@ -1593,15 +1593,15 @@ class tt {
|
|
|
1593
1593
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1594
1594
|
*/
|
|
1595
1595
|
parseInputValueDef() {
|
|
1596
|
-
const
|
|
1596
|
+
const n = this._lexer.token, e = this.parseDescription(), i = this.parseName();
|
|
1597
1597
|
this.expectToken(a.COLON);
|
|
1598
1598
|
const r = this.parseTypeReference();
|
|
1599
1599
|
let s;
|
|
1600
1600
|
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1601
1601
|
const o = this.parseConstDirectives();
|
|
1602
|
-
return this.node(
|
|
1602
|
+
return this.node(n, {
|
|
1603
1603
|
kind: c.INPUT_VALUE_DEFINITION,
|
|
1604
|
-
description:
|
|
1604
|
+
description: e,
|
|
1605
1605
|
name: i,
|
|
1606
1606
|
type: r,
|
|
1607
1607
|
defaultValue: s,
|
|
@@ -1613,12 +1613,12 @@ class tt {
|
|
|
1613
1613
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1614
1614
|
*/
|
|
1615
1615
|
parseInterfaceTypeDefinition() {
|
|
1616
|
-
const
|
|
1616
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1617
1617
|
this.expectKeyword("interface");
|
|
1618
1618
|
const i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1619
|
-
return this.node(
|
|
1619
|
+
return this.node(n, {
|
|
1620
1620
|
kind: c.INTERFACE_TYPE_DEFINITION,
|
|
1621
|
-
description:
|
|
1621
|
+
description: e,
|
|
1622
1622
|
name: i,
|
|
1623
1623
|
interfaces: r,
|
|
1624
1624
|
directives: s,
|
|
@@ -1630,12 +1630,12 @@ class tt {
|
|
|
1630
1630
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1631
1631
|
*/
|
|
1632
1632
|
parseUnionTypeDefinition() {
|
|
1633
|
-
const
|
|
1633
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1634
1634
|
this.expectKeyword("union");
|
|
1635
1635
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1636
|
-
return this.node(
|
|
1636
|
+
return this.node(n, {
|
|
1637
1637
|
kind: c.UNION_TYPE_DEFINITION,
|
|
1638
|
-
description:
|
|
1638
|
+
description: e,
|
|
1639
1639
|
name: i,
|
|
1640
1640
|
directives: r,
|
|
1641
1641
|
types: s
|
|
@@ -1654,12 +1654,12 @@ class tt {
|
|
|
1654
1654
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1655
1655
|
*/
|
|
1656
1656
|
parseEnumTypeDefinition() {
|
|
1657
|
-
const
|
|
1657
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1658
1658
|
this.expectKeyword("enum");
|
|
1659
1659
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1660
|
-
return this.node(
|
|
1660
|
+
return this.node(n, {
|
|
1661
1661
|
kind: c.ENUM_TYPE_DEFINITION,
|
|
1662
|
-
description:
|
|
1662
|
+
description: e,
|
|
1663
1663
|
name: i,
|
|
1664
1664
|
directives: r,
|
|
1665
1665
|
values: s
|
|
@@ -1681,10 +1681,10 @@ class tt {
|
|
|
1681
1681
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1682
1682
|
*/
|
|
1683
1683
|
parseEnumValueDefinition() {
|
|
1684
|
-
const
|
|
1685
|
-
return this.node(
|
|
1684
|
+
const n = this._lexer.token, e = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1685
|
+
return this.node(n, {
|
|
1686
1686
|
kind: c.ENUM_VALUE_DEFINITION,
|
|
1687
|
-
description:
|
|
1687
|
+
description: e,
|
|
1688
1688
|
name: i,
|
|
1689
1689
|
directives: r
|
|
1690
1690
|
});
|
|
@@ -1708,12 +1708,12 @@ class tt {
|
|
|
1708
1708
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1709
1709
|
*/
|
|
1710
1710
|
parseInputObjectTypeDefinition() {
|
|
1711
|
-
const
|
|
1711
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1712
1712
|
this.expectKeyword("input");
|
|
1713
1713
|
const i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1714
|
-
return this.node(
|
|
1714
|
+
return this.node(n, {
|
|
1715
1715
|
kind: c.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1716
|
-
description:
|
|
1716
|
+
description: e,
|
|
1717
1717
|
name: i,
|
|
1718
1718
|
directives: r,
|
|
1719
1719
|
fields: s
|
|
@@ -1745,9 +1745,9 @@ class tt {
|
|
|
1745
1745
|
* - InputObjectTypeDefinition
|
|
1746
1746
|
*/
|
|
1747
1747
|
parseTypeSystemExtension() {
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1750
|
-
switch (
|
|
1748
|
+
const n = this._lexer.lookahead();
|
|
1749
|
+
if (n.kind === a.NAME)
|
|
1750
|
+
switch (n.value) {
|
|
1751
1751
|
case "schema":
|
|
1752
1752
|
return this.parseSchemaExtension();
|
|
1753
1753
|
case "scalar":
|
|
@@ -1763,7 +1763,7 @@ class tt {
|
|
|
1763
1763
|
case "input":
|
|
1764
1764
|
return this.parseInputObjectTypeExtension();
|
|
1765
1765
|
}
|
|
1766
|
-
throw this.unexpected(
|
|
1766
|
+
throw this.unexpected(n);
|
|
1767
1767
|
}
|
|
1768
1768
|
/**
|
|
1769
1769
|
* ```
|
|
@@ -1773,18 +1773,18 @@ class tt {
|
|
|
1773
1773
|
* ```
|
|
1774
1774
|
*/
|
|
1775
1775
|
parseSchemaExtension() {
|
|
1776
|
-
const
|
|
1776
|
+
const n = this._lexer.token;
|
|
1777
1777
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1778
|
-
const
|
|
1778
|
+
const e = this.parseConstDirectives(), i = this.optionalMany(
|
|
1779
1779
|
a.BRACE_L,
|
|
1780
1780
|
this.parseOperationTypeDefinition,
|
|
1781
1781
|
a.BRACE_R
|
|
1782
1782
|
);
|
|
1783
|
-
if (
|
|
1783
|
+
if (e.length === 0 && i.length === 0)
|
|
1784
1784
|
throw this.unexpected();
|
|
1785
|
-
return this.node(
|
|
1785
|
+
return this.node(n, {
|
|
1786
1786
|
kind: c.SCHEMA_EXTENSION,
|
|
1787
|
-
directives:
|
|
1787
|
+
directives: e,
|
|
1788
1788
|
operationTypes: i
|
|
1789
1789
|
});
|
|
1790
1790
|
}
|
|
@@ -1793,14 +1793,14 @@ class tt {
|
|
|
1793
1793
|
* - extend scalar Name Directives[Const]
|
|
1794
1794
|
*/
|
|
1795
1795
|
parseScalarTypeExtension() {
|
|
1796
|
-
const
|
|
1796
|
+
const n = this._lexer.token;
|
|
1797
1797
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1798
|
-
const
|
|
1798
|
+
const e = this.parseName(), i = this.parseConstDirectives();
|
|
1799
1799
|
if (i.length === 0)
|
|
1800
1800
|
throw this.unexpected();
|
|
1801
|
-
return this.node(
|
|
1801
|
+
return this.node(n, {
|
|
1802
1802
|
kind: c.SCALAR_TYPE_EXTENSION,
|
|
1803
|
-
name:
|
|
1803
|
+
name: e,
|
|
1804
1804
|
directives: i
|
|
1805
1805
|
});
|
|
1806
1806
|
}
|
|
@@ -1811,14 +1811,14 @@ class tt {
|
|
|
1811
1811
|
* - extend type Name ImplementsInterfaces
|
|
1812
1812
|
*/
|
|
1813
1813
|
parseObjectTypeExtension() {
|
|
1814
|
-
const
|
|
1814
|
+
const n = this._lexer.token;
|
|
1815
1815
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1816
|
-
const
|
|
1816
|
+
const e = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1817
1817
|
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1818
1818
|
throw this.unexpected();
|
|
1819
|
-
return this.node(
|
|
1819
|
+
return this.node(n, {
|
|
1820
1820
|
kind: c.OBJECT_TYPE_EXTENSION,
|
|
1821
|
-
name:
|
|
1821
|
+
name: e,
|
|
1822
1822
|
interfaces: i,
|
|
1823
1823
|
directives: r,
|
|
1824
1824
|
fields: s
|
|
@@ -1831,14 +1831,14 @@ class tt {
|
|
|
1831
1831
|
* - extend interface Name ImplementsInterfaces
|
|
1832
1832
|
*/
|
|
1833
1833
|
parseInterfaceTypeExtension() {
|
|
1834
|
-
const
|
|
1834
|
+
const n = this._lexer.token;
|
|
1835
1835
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1836
|
-
const
|
|
1836
|
+
const e = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1837
1837
|
if (i.length === 0 && r.length === 0 && s.length === 0)
|
|
1838
1838
|
throw this.unexpected();
|
|
1839
|
-
return this.node(
|
|
1839
|
+
return this.node(n, {
|
|
1840
1840
|
kind: c.INTERFACE_TYPE_EXTENSION,
|
|
1841
|
-
name:
|
|
1841
|
+
name: e,
|
|
1842
1842
|
interfaces: i,
|
|
1843
1843
|
directives: r,
|
|
1844
1844
|
fields: s
|
|
@@ -1850,14 +1850,14 @@ class tt {
|
|
|
1850
1850
|
* - extend union Name Directives[Const]
|
|
1851
1851
|
*/
|
|
1852
1852
|
parseUnionTypeExtension() {
|
|
1853
|
-
const
|
|
1853
|
+
const n = this._lexer.token;
|
|
1854
1854
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1855
|
-
const
|
|
1855
|
+
const e = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1856
1856
|
if (i.length === 0 && r.length === 0)
|
|
1857
1857
|
throw this.unexpected();
|
|
1858
|
-
return this.node(
|
|
1858
|
+
return this.node(n, {
|
|
1859
1859
|
kind: c.UNION_TYPE_EXTENSION,
|
|
1860
|
-
name:
|
|
1860
|
+
name: e,
|
|
1861
1861
|
directives: i,
|
|
1862
1862
|
types: r
|
|
1863
1863
|
});
|
|
@@ -1868,14 +1868,14 @@ class tt {
|
|
|
1868
1868
|
* - extend enum Name Directives[Const]
|
|
1869
1869
|
*/
|
|
1870
1870
|
parseEnumTypeExtension() {
|
|
1871
|
-
const
|
|
1871
|
+
const n = this._lexer.token;
|
|
1872
1872
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1873
|
-
const
|
|
1873
|
+
const e = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1874
1874
|
if (i.length === 0 && r.length === 0)
|
|
1875
1875
|
throw this.unexpected();
|
|
1876
|
-
return this.node(
|
|
1876
|
+
return this.node(n, {
|
|
1877
1877
|
kind: c.ENUM_TYPE_EXTENSION,
|
|
1878
|
-
name:
|
|
1878
|
+
name: e,
|
|
1879
1879
|
directives: i,
|
|
1880
1880
|
values: r
|
|
1881
1881
|
});
|
|
@@ -1886,14 +1886,14 @@ class tt {
|
|
|
1886
1886
|
* - extend input Name Directives[Const]
|
|
1887
1887
|
*/
|
|
1888
1888
|
parseInputObjectTypeExtension() {
|
|
1889
|
-
const
|
|
1889
|
+
const n = this._lexer.token;
|
|
1890
1890
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1891
|
-
const
|
|
1891
|
+
const e = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1892
1892
|
if (i.length === 0 && r.length === 0)
|
|
1893
1893
|
throw this.unexpected();
|
|
1894
|
-
return this.node(
|
|
1894
|
+
return this.node(n, {
|
|
1895
1895
|
kind: c.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1896
|
-
name:
|
|
1896
|
+
name: e,
|
|
1897
1897
|
directives: i,
|
|
1898
1898
|
fields: r
|
|
1899
1899
|
});
|
|
@@ -1905,14 +1905,14 @@ class tt {
|
|
|
1905
1905
|
* ```
|
|
1906
1906
|
*/
|
|
1907
1907
|
parseDirectiveDefinition() {
|
|
1908
|
-
const
|
|
1908
|
+
const n = this._lexer.token, e = this.parseDescription();
|
|
1909
1909
|
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1910
1910
|
const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1911
1911
|
this.expectKeyword("on");
|
|
1912
1912
|
const o = this.parseDirectiveLocations();
|
|
1913
|
-
return this.node(
|
|
1913
|
+
return this.node(n, {
|
|
1914
1914
|
kind: c.DIRECTIVE_DEFINITION,
|
|
1915
|
-
description:
|
|
1915
|
+
description: e,
|
|
1916
1916
|
name: i,
|
|
1917
1917
|
arguments: r,
|
|
1918
1918
|
repeatable: s,
|
|
@@ -1955,10 +1955,10 @@ class tt {
|
|
|
1955
1955
|
* `INPUT_FIELD_DEFINITION`
|
|
1956
1956
|
*/
|
|
1957
1957
|
parseDirectiveLocation() {
|
|
1958
|
-
const
|
|
1959
|
-
if (Object.prototype.hasOwnProperty.call(q,
|
|
1960
|
-
return
|
|
1961
|
-
throw this.unexpected(
|
|
1958
|
+
const n = this._lexer.token, e = this.parseName();
|
|
1959
|
+
if (Object.prototype.hasOwnProperty.call(q, e.value))
|
|
1960
|
+
return e;
|
|
1961
|
+
throw this.unexpected(n);
|
|
1962
1962
|
}
|
|
1963
1963
|
// Schema Coordinates
|
|
1964
1964
|
/**
|
|
@@ -1970,27 +1970,27 @@ class tt {
|
|
|
1970
1970
|
* - \@ Name ( Name : )
|
|
1971
1971
|
*/
|
|
1972
1972
|
parseSchemaCoordinate() {
|
|
1973
|
-
const
|
|
1973
|
+
const n = this._lexer.token, e = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1974
1974
|
let r;
|
|
1975
|
-
!
|
|
1975
|
+
!e && this.expectOptionalToken(a.DOT) && (r = this.parseName());
|
|
1976
1976
|
let s;
|
|
1977
|
-
return (
|
|
1977
|
+
return (e || r) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), e ? s ? this.node(n, {
|
|
1978
1978
|
kind: c.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1979
1979
|
name: i,
|
|
1980
1980
|
argumentName: s
|
|
1981
|
-
}) : this.node(
|
|
1981
|
+
}) : this.node(n, {
|
|
1982
1982
|
kind: c.DIRECTIVE_COORDINATE,
|
|
1983
1983
|
name: i
|
|
1984
|
-
}) : r ? s ? this.node(
|
|
1984
|
+
}) : r ? s ? this.node(n, {
|
|
1985
1985
|
kind: c.ARGUMENT_COORDINATE,
|
|
1986
1986
|
name: i,
|
|
1987
1987
|
fieldName: r,
|
|
1988
1988
|
argumentName: s
|
|
1989
|
-
}) : this.node(
|
|
1989
|
+
}) : this.node(n, {
|
|
1990
1990
|
kind: c.MEMBER_COORDINATE,
|
|
1991
1991
|
name: i,
|
|
1992
1992
|
memberName: r
|
|
1993
|
-
}) : this.node(
|
|
1993
|
+
}) : this.node(n, {
|
|
1994
1994
|
kind: c.TYPE_COORDINATE,
|
|
1995
1995
|
name: i
|
|
1996
1996
|
});
|
|
@@ -2001,72 +2001,72 @@ class tt {
|
|
|
2001
2001
|
* location object, used to identify the place in the source that created a
|
|
2002
2002
|
* given parsed object.
|
|
2003
2003
|
*/
|
|
2004
|
-
node(
|
|
2005
|
-
return this._options.noLocation !== !0 && (
|
|
2006
|
-
|
|
2004
|
+
node(n, e) {
|
|
2005
|
+
return this._options.noLocation !== !0 && (e.loc = new xe(
|
|
2006
|
+
n,
|
|
2007
2007
|
this._lexer.lastToken,
|
|
2008
2008
|
this._lexer.source
|
|
2009
|
-
)),
|
|
2009
|
+
)), e;
|
|
2010
2010
|
}
|
|
2011
2011
|
/**
|
|
2012
2012
|
* Determines if the next token is of a given kind
|
|
2013
2013
|
*/
|
|
2014
|
-
peek(
|
|
2015
|
-
return this._lexer.token.kind ===
|
|
2014
|
+
peek(n) {
|
|
2015
|
+
return this._lexer.token.kind === n;
|
|
2016
2016
|
}
|
|
2017
2017
|
/**
|
|
2018
2018
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2019
2019
|
* Otherwise, do not change the parser state and throw an error.
|
|
2020
2020
|
*/
|
|
2021
|
-
expectToken(
|
|
2022
|
-
const
|
|
2023
|
-
if (
|
|
2024
|
-
return this.advanceLexer(),
|
|
2021
|
+
expectToken(n) {
|
|
2022
|
+
const e = this._lexer.token;
|
|
2023
|
+
if (e.kind === n)
|
|
2024
|
+
return this.advanceLexer(), e;
|
|
2025
2025
|
throw I(
|
|
2026
2026
|
this._lexer.source,
|
|
2027
|
-
|
|
2028
|
-
`Expected ${Ie(
|
|
2027
|
+
e.start,
|
|
2028
|
+
`Expected ${Ie(n)}, found ${_(e)}.`
|
|
2029
2029
|
);
|
|
2030
2030
|
}
|
|
2031
2031
|
/**
|
|
2032
2032
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2033
2033
|
* Otherwise, do not change the parser state and return "false".
|
|
2034
2034
|
*/
|
|
2035
|
-
expectOptionalToken(
|
|
2036
|
-
return this._lexer.token.kind ===
|
|
2035
|
+
expectOptionalToken(n) {
|
|
2036
|
+
return this._lexer.token.kind === n ? (this.advanceLexer(), !0) : !1;
|
|
2037
2037
|
}
|
|
2038
2038
|
/**
|
|
2039
2039
|
* If the next token is a given keyword, advance the lexer.
|
|
2040
2040
|
* Otherwise, do not change the parser state and throw an error.
|
|
2041
2041
|
*/
|
|
2042
|
-
expectKeyword(
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2042
|
+
expectKeyword(n) {
|
|
2043
|
+
const e = this._lexer.token;
|
|
2044
|
+
if (e.kind === a.NAME && e.value === n)
|
|
2045
2045
|
this.advanceLexer();
|
|
2046
2046
|
else
|
|
2047
2047
|
throw I(
|
|
2048
2048
|
this._lexer.source,
|
|
2049
|
-
|
|
2050
|
-
`Expected "${
|
|
2049
|
+
e.start,
|
|
2050
|
+
`Expected "${n}", found ${_(e)}.`
|
|
2051
2051
|
);
|
|
2052
2052
|
}
|
|
2053
2053
|
/**
|
|
2054
2054
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2055
2055
|
* Otherwise, do not change the parser state and return "false".
|
|
2056
2056
|
*/
|
|
2057
|
-
expectOptionalKeyword(
|
|
2058
|
-
const
|
|
2059
|
-
return
|
|
2057
|
+
expectOptionalKeyword(n) {
|
|
2058
|
+
const e = this._lexer.token;
|
|
2059
|
+
return e.kind === a.NAME && e.value === n ? (this.advanceLexer(), !0) : !1;
|
|
2060
2060
|
}
|
|
2061
2061
|
/**
|
|
2062
2062
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2063
2063
|
*/
|
|
2064
|
-
unexpected(
|
|
2065
|
-
const
|
|
2064
|
+
unexpected(n) {
|
|
2065
|
+
const e = n ?? this._lexer.token;
|
|
2066
2066
|
return I(
|
|
2067
2067
|
this._lexer.source,
|
|
2068
|
-
|
|
2069
|
-
`Unexpected ${_(
|
|
2068
|
+
e.start,
|
|
2069
|
+
`Unexpected ${_(e)}.`
|
|
2070
2070
|
);
|
|
2071
2071
|
}
|
|
2072
2072
|
/**
|
|
@@ -2074,11 +2074,11 @@ class tt {
|
|
|
2074
2074
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2075
2075
|
* Advances the parser to the next lex token after the closing token.
|
|
2076
2076
|
*/
|
|
2077
|
-
any(
|
|
2078
|
-
this.expectToken(
|
|
2077
|
+
any(n, e, i) {
|
|
2078
|
+
this.expectToken(n);
|
|
2079
2079
|
const r = [];
|
|
2080
2080
|
for (; !this.expectOptionalToken(i); )
|
|
2081
|
-
r.push(
|
|
2081
|
+
r.push(e.call(this));
|
|
2082
2082
|
return r;
|
|
2083
2083
|
}
|
|
2084
2084
|
/**
|
|
@@ -2087,11 +2087,11 @@ class tt {
|
|
|
2087
2087
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2088
2088
|
* Advances the parser to the next lex token after the closing token.
|
|
2089
2089
|
*/
|
|
2090
|
-
optionalMany(
|
|
2091
|
-
if (this.expectOptionalToken(
|
|
2090
|
+
optionalMany(n, e, i) {
|
|
2091
|
+
if (this.expectOptionalToken(n)) {
|
|
2092
2092
|
const r = [];
|
|
2093
2093
|
do
|
|
2094
|
-
r.push(
|
|
2094
|
+
r.push(e.call(this));
|
|
2095
2095
|
while (!this.expectOptionalToken(i));
|
|
2096
2096
|
return r;
|
|
2097
2097
|
}
|
|
@@ -2102,11 +2102,11 @@ class tt {
|
|
|
2102
2102
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2103
2103
|
* Advances the parser to the next lex token after the closing token.
|
|
2104
2104
|
*/
|
|
2105
|
-
many(
|
|
2106
|
-
this.expectToken(
|
|
2105
|
+
many(n, e, i) {
|
|
2106
|
+
this.expectToken(n);
|
|
2107
2107
|
const r = [];
|
|
2108
2108
|
do
|
|
2109
|
-
r.push(
|
|
2109
|
+
r.push(e.call(this));
|
|
2110
2110
|
while (!this.expectOptionalToken(i));
|
|
2111
2111
|
return r;
|
|
2112
2112
|
}
|
|
@@ -2115,81 +2115,81 @@ class tt {
|
|
|
2115
2115
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2116
2116
|
* Advances the parser to the next lex token after last item in the list.
|
|
2117
2117
|
*/
|
|
2118
|
-
delimitedMany(
|
|
2119
|
-
this.expectOptionalToken(
|
|
2118
|
+
delimitedMany(n, e) {
|
|
2119
|
+
this.expectOptionalToken(n);
|
|
2120
2120
|
const i = [];
|
|
2121
2121
|
do
|
|
2122
|
-
i.push(
|
|
2123
|
-
while (this.expectOptionalToken(
|
|
2122
|
+
i.push(e.call(this));
|
|
2123
|
+
while (this.expectOptionalToken(n));
|
|
2124
2124
|
return i;
|
|
2125
2125
|
}
|
|
2126
2126
|
advanceLexer() {
|
|
2127
|
-
const { maxTokens:
|
|
2128
|
-
if (
|
|
2127
|
+
const { maxTokens: n } = this._options, e = this._lexer.advance();
|
|
2128
|
+
if (e.kind !== a.EOF && (++this._tokenCounter, n !== void 0 && this._tokenCounter > n))
|
|
2129
2129
|
throw I(
|
|
2130
2130
|
this._lexer.source,
|
|
2131
|
-
|
|
2132
|
-
`Document contains more that ${
|
|
2131
|
+
e.start,
|
|
2132
|
+
`Document contains more that ${n} tokens. Parsing aborted.`
|
|
2133
2133
|
);
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
|
-
function _(
|
|
2137
|
-
const
|
|
2138
|
-
return Ie(
|
|
2136
|
+
function _(t) {
|
|
2137
|
+
const n = t.value;
|
|
2138
|
+
return Ie(t.kind) + (n != null ? ` "${n}"` : "");
|
|
2139
2139
|
}
|
|
2140
|
-
function Ie(
|
|
2141
|
-
return we(
|
|
2140
|
+
function Ie(t) {
|
|
2141
|
+
return we(t) ? `"${t}"` : t;
|
|
2142
2142
|
}
|
|
2143
2143
|
var L = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), Ee = !0, $ = !1;
|
|
2144
|
-
function ye(
|
|
2145
|
-
return
|
|
2144
|
+
function ye(t) {
|
|
2145
|
+
return t.replace(/[\s,]+/g, " ").trim();
|
|
2146
2146
|
}
|
|
2147
|
-
function nt(
|
|
2148
|
-
return ye(
|
|
2147
|
+
function nt(t) {
|
|
2148
|
+
return ye(t.source.body.substring(t.start, t.end));
|
|
2149
2149
|
}
|
|
2150
|
-
function it(
|
|
2151
|
-
var
|
|
2152
|
-
return
|
|
2150
|
+
function it(t) {
|
|
2151
|
+
var n = /* @__PURE__ */ new Set(), e = [];
|
|
2152
|
+
return t.definitions.forEach(function(i) {
|
|
2153
2153
|
if (i.kind === "FragmentDefinition") {
|
|
2154
2154
|
var r = i.name.value, s = nt(i.loc), o = G.get(r);
|
|
2155
2155
|
o && !o.has(s) ? Ee && console.warn("Warning: fragment with name " + r + ` already exists.
|
|
2156
2156
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2157
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(r, o = /* @__PURE__ */ new Set()), o.add(s),
|
|
2157
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(r, o = /* @__PURE__ */ new Set()), o.add(s), n.has(s) || (n.add(s), e.push(i));
|
|
2158
2158
|
} else
|
|
2159
|
-
|
|
2160
|
-
}), F(F({},
|
|
2159
|
+
e.push(i);
|
|
2160
|
+
}), F(F({}, t), { definitions: e });
|
|
2161
2161
|
}
|
|
2162
|
-
function rt(
|
|
2163
|
-
var
|
|
2164
|
-
|
|
2162
|
+
function rt(t) {
|
|
2163
|
+
var n = new Set(t.definitions);
|
|
2164
|
+
n.forEach(function(i) {
|
|
2165
2165
|
i.loc && delete i.loc, Object.keys(i).forEach(function(r) {
|
|
2166
2166
|
var s = i[r];
|
|
2167
|
-
s && typeof s == "object" &&
|
|
2167
|
+
s && typeof s == "object" && n.add(s);
|
|
2168
2168
|
});
|
|
2169
2169
|
});
|
|
2170
|
-
var
|
|
2171
|
-
return
|
|
2170
|
+
var e = t.loc;
|
|
2171
|
+
return e && (delete e.startToken, delete e.endToken), t;
|
|
2172
2172
|
}
|
|
2173
|
-
function st(
|
|
2174
|
-
var
|
|
2175
|
-
if (!L.has(
|
|
2176
|
-
var
|
|
2173
|
+
function st(t) {
|
|
2174
|
+
var n = ye(t);
|
|
2175
|
+
if (!L.has(n)) {
|
|
2176
|
+
var e = et(t, {
|
|
2177
2177
|
experimentalFragmentVariables: $,
|
|
2178
2178
|
allowLegacyFragmentVariables: $
|
|
2179
2179
|
});
|
|
2180
|
-
if (!
|
|
2180
|
+
if (!e || e.kind !== "Document")
|
|
2181
2181
|
throw new Error("Not a valid GraphQL document.");
|
|
2182
|
-
L.set(
|
|
2182
|
+
L.set(n, rt(it(e)));
|
|
2183
2183
|
}
|
|
2184
|
-
return L.get(
|
|
2184
|
+
return L.get(n);
|
|
2185
2185
|
}
|
|
2186
|
-
function l(
|
|
2187
|
-
for (var
|
|
2188
|
-
e
|
|
2189
|
-
typeof
|
|
2190
|
-
var i =
|
|
2191
|
-
return
|
|
2192
|
-
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i +=
|
|
2186
|
+
function l(t) {
|
|
2187
|
+
for (var n = [], e = 1; e < arguments.length; e++)
|
|
2188
|
+
n[e - 1] = arguments[e];
|
|
2189
|
+
typeof t == "string" && (t = [t]);
|
|
2190
|
+
var i = t[0];
|
|
2191
|
+
return n.forEach(function(r, s) {
|
|
2192
|
+
r && r.kind === "Document" ? i += r.loc.source.body : i += r, i += t[s + 1];
|
|
2193
2193
|
}), st(i);
|
|
2194
2194
|
}
|
|
2195
2195
|
function at() {
|
|
@@ -2204,15 +2204,15 @@ function ct() {
|
|
|
2204
2204
|
function dt() {
|
|
2205
2205
|
$ = !1;
|
|
2206
2206
|
}
|
|
2207
|
-
var
|
|
2207
|
+
var x = {
|
|
2208
2208
|
gql: l,
|
|
2209
2209
|
resetCaches: at,
|
|
2210
2210
|
disableFragmentWarnings: ot,
|
|
2211
2211
|
enableExperimentalFragmentVariables: ct,
|
|
2212
2212
|
disableExperimentalFragmentVariables: dt
|
|
2213
2213
|
};
|
|
2214
|
-
(function(
|
|
2215
|
-
|
|
2214
|
+
(function(t) {
|
|
2215
|
+
t.gql = x.gql, t.resetCaches = x.resetCaches, t.disableFragmentWarnings = x.disableFragmentWarnings, t.enableExperimentalFragmentVariables = x.enableExperimentalFragmentVariables, t.disableExperimentalFragmentVariables = x.disableExperimentalFragmentVariables;
|
|
2216
2216
|
})(l || (l = {}));
|
|
2217
2217
|
l.default = l;
|
|
2218
2218
|
const ut = l`
|
|
@@ -2399,110 +2399,110 @@ const ut = l`
|
|
|
2399
2399
|
mutation deleteOrder($orderId: ID!) {
|
|
2400
2400
|
cancelOrder(id: $orderId)
|
|
2401
2401
|
}
|
|
2402
|
-
`, yt = (n, e,
|
|
2403
|
-
function Ot(
|
|
2402
|
+
`, yt = (t, n, e, i) => t();
|
|
2403
|
+
function Ot(t, n = yt) {
|
|
2404
2404
|
return {
|
|
2405
|
-
findActiveOrderById(
|
|
2406
|
-
return
|
|
2405
|
+
findActiveOrderById(e, i, r) {
|
|
2406
|
+
return n((s) => t.request({ document: ut, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findActiveOrderById", "query", e);
|
|
2407
2407
|
},
|
|
2408
|
-
findOrderById(
|
|
2409
|
-
return
|
|
2408
|
+
findOrderById(e, i, r) {
|
|
2409
|
+
return n((s) => t.request({ document: lt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findOrderById", "query", e);
|
|
2410
2410
|
},
|
|
2411
|
-
addToOrder(
|
|
2412
|
-
return
|
|
2411
|
+
addToOrder(e, i, r) {
|
|
2412
|
+
return n((s) => t.request({ document: ht, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "addToOrder", "mutation", e);
|
|
2413
2413
|
},
|
|
2414
|
-
removeFromOrder(
|
|
2415
|
-
return
|
|
2414
|
+
removeFromOrder(e, i, r) {
|
|
2415
|
+
return n((s) => t.request({ document: pt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "removeFromOrder", "mutation", e);
|
|
2416
2416
|
},
|
|
2417
|
-
configurePackage(
|
|
2418
|
-
return
|
|
2417
|
+
configurePackage(e, i, r) {
|
|
2418
|
+
return n((s) => t.request({ document: mt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "configurePackage", "mutation", e);
|
|
2419
2419
|
},
|
|
2420
|
-
reserveAdditionalPackageItem(
|
|
2421
|
-
return
|
|
2420
|
+
reserveAdditionalPackageItem(e, i, r) {
|
|
2421
|
+
return n((s) => t.request({ document: ft, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "reserveAdditionalPackageItem", "mutation", e);
|
|
2422
2422
|
},
|
|
2423
|
-
configureOrderDeliveryOption(
|
|
2424
|
-
return
|
|
2423
|
+
configureOrderDeliveryOption(e, i, r) {
|
|
2424
|
+
return n((s) => t.request({ document: gt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "configureOrderDeliveryOption", "mutation", e);
|
|
2425
2425
|
},
|
|
2426
|
-
createOrderCustomer(
|
|
2427
|
-
return
|
|
2426
|
+
createOrderCustomer(e, i, r) {
|
|
2427
|
+
return n((s) => t.request({ document: It, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "createOrderCustomer", "mutation", e);
|
|
2428
2428
|
},
|
|
2429
|
-
deleteOrder(
|
|
2430
|
-
return
|
|
2429
|
+
deleteOrder(e, i, r) {
|
|
2430
|
+
return n((s) => t.request({ document: Et, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "deleteOrder", "mutation", e);
|
|
2431
2431
|
}
|
|
2432
2432
|
};
|
|
2433
2433
|
}
|
|
2434
2434
|
class kt {
|
|
2435
2435
|
config;
|
|
2436
2436
|
sdk;
|
|
2437
|
-
constructor(
|
|
2438
|
-
this.config =
|
|
2437
|
+
constructor(n) {
|
|
2438
|
+
this.config = n, this.sdk = Ot(new v(n.apiUrl));
|
|
2439
2439
|
}
|
|
2440
2440
|
// Basket update functions
|
|
2441
|
-
async addProduct(
|
|
2441
|
+
async addProduct(n, e) {
|
|
2442
2442
|
try {
|
|
2443
2443
|
return this.debugLog("Adding product", {
|
|
2444
|
-
productId:
|
|
2445
|
-
orderId:
|
|
2446
|
-
amount:
|
|
2447
|
-
seat:
|
|
2444
|
+
productId: e.id,
|
|
2445
|
+
orderId: n,
|
|
2446
|
+
amount: e.amount,
|
|
2447
|
+
seat: e.seat
|
|
2448
2448
|
}), (await this.sdk.addToOrder({
|
|
2449
|
-
productId:
|
|
2450
|
-
orderId:
|
|
2451
|
-
additionalData:
|
|
2449
|
+
productId: e.id,
|
|
2450
|
+
orderId: n,
|
|
2451
|
+
additionalData: e.seat ? {
|
|
2452
2452
|
seat: {
|
|
2453
|
-
seatId:
|
|
2454
|
-
seatLabel:
|
|
2455
|
-
holdToken:
|
|
2453
|
+
seatId: e.seat.id,
|
|
2454
|
+
seatLabel: e.seat.label,
|
|
2455
|
+
holdToken: e.seat.holdToken
|
|
2456
2456
|
}
|
|
2457
2457
|
} : null,
|
|
2458
2458
|
trackerId: this.config.trackerId,
|
|
2459
2459
|
shopId: this.config.shopId,
|
|
2460
|
-
amount:
|
|
2460
|
+
amount: e.amount
|
|
2461
2461
|
})).reserveProduct;
|
|
2462
2462
|
} catch (i) {
|
|
2463
2463
|
throw this.debugLog("Error adding product", i), this.handleError(i), i;
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
|
-
async removeProduct(
|
|
2466
|
+
async removeProduct(n, e) {
|
|
2467
2467
|
try {
|
|
2468
2468
|
return this.debugLog("Removing product", {
|
|
2469
|
-
productId:
|
|
2470
|
-
orderId:
|
|
2471
|
-
amount:
|
|
2469
|
+
productId: e.id,
|
|
2470
|
+
orderId: n,
|
|
2471
|
+
amount: e.amount
|
|
2472
2472
|
}), (await this.sdk.removeFromOrder({
|
|
2473
|
-
productId:
|
|
2474
|
-
orderId:
|
|
2475
|
-
additionalData:
|
|
2473
|
+
productId: e.id,
|
|
2474
|
+
orderId: n,
|
|
2475
|
+
additionalData: e.seat ? {
|
|
2476
2476
|
seat: {
|
|
2477
|
-
seatId:
|
|
2478
|
-
seatLabel:
|
|
2477
|
+
seatId: e.seat.id,
|
|
2478
|
+
seatLabel: e.seat.label
|
|
2479
2479
|
}
|
|
2480
2480
|
} : null,
|
|
2481
|
-
amount:
|
|
2481
|
+
amount: e.amount
|
|
2482
2482
|
})).releaseProduct ?? null;
|
|
2483
2483
|
} catch (i) {
|
|
2484
2484
|
throw this.debugLog("Error removing product", i), this.handleError(i), i;
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
-
async configurePackage(
|
|
2487
|
+
async configurePackage(n, e) {
|
|
2488
2488
|
try {
|
|
2489
|
-
const i =
|
|
2489
|
+
const i = e.items.map((s) => ({
|
|
2490
2490
|
packageItemId: s.packageItemId,
|
|
2491
2491
|
eventId: s.eventId
|
|
2492
2492
|
}));
|
|
2493
2493
|
this.debugLog("Configuring package", {
|
|
2494
|
-
packageId:
|
|
2495
|
-
orderId:
|
|
2496
|
-
amount:
|
|
2494
|
+
packageId: e.id,
|
|
2495
|
+
orderId: n,
|
|
2496
|
+
amount: e.amount,
|
|
2497
2497
|
items: i,
|
|
2498
2498
|
shopId: this.config.shopId
|
|
2499
2499
|
});
|
|
2500
2500
|
const r = await this.sdk.configurePackage({
|
|
2501
2501
|
trackerId: this.config.trackerId,
|
|
2502
2502
|
shopId: this.config.shopId,
|
|
2503
|
-
packageId:
|
|
2504
|
-
orderId:
|
|
2505
|
-
amount:
|
|
2503
|
+
packageId: e.id,
|
|
2504
|
+
orderId: n,
|
|
2505
|
+
amount: e.amount,
|
|
2506
2506
|
items: i
|
|
2507
2507
|
});
|
|
2508
2508
|
return this.debugLog("Configure package response"), r.configurePackage ?? null;
|
|
@@ -2510,33 +2510,33 @@ class kt {
|
|
|
2510
2510
|
throw this.debugLog("Error configuring package", i), this.handleError(i), i;
|
|
2511
2511
|
}
|
|
2512
2512
|
}
|
|
2513
|
-
async configureCustomer(
|
|
2514
|
-
this.debugLog("Creating/replacing customer", { orderId:
|
|
2513
|
+
async configureCustomer(n, e) {
|
|
2514
|
+
this.debugLog("Creating/replacing customer", { orderId: n, email: e.email });
|
|
2515
2515
|
try {
|
|
2516
2516
|
const i = await this.sdk.createOrderCustomer({
|
|
2517
|
-
orderId:
|
|
2518
|
-
customer:
|
|
2517
|
+
orderId: n,
|
|
2518
|
+
customer: e
|
|
2519
2519
|
});
|
|
2520
2520
|
this.debugLog("Customer set successfully", i);
|
|
2521
2521
|
} catch (i) {
|
|
2522
2522
|
throw this.debugLog("Failed to set customer", i), new Error(`Failed to set customer: ${i.message}`);
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
async reserveAdditionalPackageItem(
|
|
2525
|
+
async reserveAdditionalPackageItem(n, e) {
|
|
2526
2526
|
try {
|
|
2527
2527
|
this.debugLog("reserve additional packageItem", {
|
|
2528
|
-
orderId:
|
|
2529
|
-
eventId:
|
|
2530
|
-
amount:
|
|
2531
|
-
packageId:
|
|
2532
|
-
packageItemId:
|
|
2528
|
+
orderId: n,
|
|
2529
|
+
eventId: e.eventId,
|
|
2530
|
+
amount: e.amount,
|
|
2531
|
+
packageId: e.packageId,
|
|
2532
|
+
packageItemId: e.packageItemId
|
|
2533
2533
|
});
|
|
2534
2534
|
const i = await this.sdk.reserveAdditionalPackageItem({
|
|
2535
|
-
orderId:
|
|
2536
|
-
eventId:
|
|
2537
|
-
amount:
|
|
2538
|
-
packageId:
|
|
2539
|
-
packageItemId:
|
|
2535
|
+
orderId: n,
|
|
2536
|
+
eventId: e.eventId,
|
|
2537
|
+
amount: e.amount,
|
|
2538
|
+
packageId: e.packageId,
|
|
2539
|
+
packageItemId: e.packageItemId
|
|
2540
2540
|
});
|
|
2541
2541
|
return this.debugLog("reserve additional packageItem"), i.reserveAdditionalPackageItem ?? null;
|
|
2542
2542
|
} catch (i) {
|
|
@@ -2544,12 +2544,12 @@ class kt {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
}
|
|
2546
2546
|
// Cancel and clear order functions
|
|
2547
|
-
async cancelOrder(
|
|
2548
|
-
|
|
2547
|
+
async cancelOrder(n) {
|
|
2548
|
+
n && (this.debugLog("Cancelling order", { orderId: n }), await this.sdk.deleteOrder({ orderId: n }), this.debugLog("Order cancelled successfully"));
|
|
2549
2549
|
}
|
|
2550
|
-
async findOrder(
|
|
2550
|
+
async findOrder(n, e) {
|
|
2551
2551
|
try {
|
|
2552
|
-
const i = await this.sdk.findOrderById({ id:
|
|
2552
|
+
const i = await this.sdk.findOrderById({ id: n, reference: e });
|
|
2553
2553
|
return i.findOrder ? {
|
|
2554
2554
|
id: i.findOrder.id,
|
|
2555
2555
|
reference: i.findOrder.reference,
|
|
@@ -2574,13 +2574,13 @@ class kt {
|
|
|
2574
2574
|
return this.debugLog("Error finding order", i), this.handleError(i), null;
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
async findActiveOrder(
|
|
2578
|
-
this.debugLog("Fetching order from server", { orderId:
|
|
2577
|
+
async findActiveOrder(n) {
|
|
2578
|
+
this.debugLog("Fetching order from server", { orderId: n });
|
|
2579
2579
|
try {
|
|
2580
|
-
const
|
|
2581
|
-
if (!
|
|
2580
|
+
const e = await this.sdk.findActiveOrderById({ id: n });
|
|
2581
|
+
if (!e?.findOrder)
|
|
2582
2582
|
return null;
|
|
2583
|
-
const i =
|
|
2583
|
+
const i = e.findOrder;
|
|
2584
2584
|
this.debugLog("Order fetched successfully", i);
|
|
2585
2585
|
const r = i.items, s = r.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
2586
2586
|
let f = T.PRODUCT;
|
|
@@ -2657,21 +2657,21 @@ class kt {
|
|
|
2657
2657
|
count: h,
|
|
2658
2658
|
orderProtection: !1
|
|
2659
2659
|
};
|
|
2660
|
-
} catch (
|
|
2661
|
-
throw this.debugLog("Error fetching order",
|
|
2660
|
+
} catch (e) {
|
|
2661
|
+
throw this.debugLog("Error fetching order", e), e;
|
|
2662
2662
|
}
|
|
2663
2663
|
}
|
|
2664
|
-
debugLog(
|
|
2665
|
-
this.config.debug && console.log(`[BasketService] ${
|
|
2664
|
+
debugLog(n, e) {
|
|
2665
|
+
this.config.debug && console.log(`[BasketService] ${n}`, e || "");
|
|
2666
2666
|
}
|
|
2667
|
-
handleError(
|
|
2668
|
-
const
|
|
2669
|
-
if (
|
|
2670
|
-
const i =
|
|
2667
|
+
handleError(n) {
|
|
2668
|
+
const e = n;
|
|
2669
|
+
if (e.graphQLErrors && e.graphQLErrors.length > 0) {
|
|
2670
|
+
const i = e.graphQLErrors[0];
|
|
2671
2671
|
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
2672
2672
|
}
|
|
2673
|
-
if (
|
|
2674
|
-
const i =
|
|
2673
|
+
if (e.response?.errors && e.response.errors.length > 0) {
|
|
2674
|
+
const i = e.response.errors[0];
|
|
2675
2675
|
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
@@ -2787,73 +2787,58 @@ const Tt = l`
|
|
|
2787
2787
|
showEndSalesAtTag
|
|
2788
2788
|
}
|
|
2789
2789
|
}
|
|
2790
|
-
`, Dt = (n, e,
|
|
2791
|
-
function vt(
|
|
2790
|
+
`, Dt = (t, n, e, i) => t();
|
|
2791
|
+
function vt(t, n = Dt) {
|
|
2792
2792
|
return {
|
|
2793
|
-
EventOverviewPage(
|
|
2794
|
-
return
|
|
2793
|
+
EventOverviewPage(e, i, r) {
|
|
2794
|
+
return n((s) => t.request({ document: Tt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "EventOverviewPage", "query", e);
|
|
2795
2795
|
},
|
|
2796
|
-
EventDetailPage(
|
|
2797
|
-
return
|
|
2796
|
+
EventDetailPage(e, i, r) {
|
|
2797
|
+
return n((s) => t.request({ document: At, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "EventDetailPage", "query", e);
|
|
2798
2798
|
},
|
|
2799
|
-
findProductsByEventId(
|
|
2800
|
-
return
|
|
2799
|
+
findProductsByEventId(e, i, r) {
|
|
2800
|
+
return n((s) => t.request({ document: Nt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findProductsByEventId", "query", e);
|
|
2801
2801
|
}
|
|
2802
2802
|
};
|
|
2803
2803
|
}
|
|
2804
|
-
class
|
|
2804
|
+
class Pt {
|
|
2805
2805
|
config;
|
|
2806
2806
|
sdk;
|
|
2807
|
-
constructor(
|
|
2808
|
-
this.config =
|
|
2807
|
+
constructor(n) {
|
|
2808
|
+
this.config = n, this.sdk = vt(new v(n.apiUrl));
|
|
2809
2809
|
}
|
|
2810
|
-
async getEvents(
|
|
2810
|
+
async getEvents(n = {}) {
|
|
2811
2811
|
try {
|
|
2812
|
-
|
|
2813
|
-
index:
|
|
2814
|
-
size:
|
|
2812
|
+
n.page && (n.page = {
|
|
2813
|
+
index: n.page.index ?? 0,
|
|
2814
|
+
size: n.page.size ?? 20
|
|
2815
2815
|
}), this.debugLog("Fetching events with parameters", {
|
|
2816
2816
|
organizationId: this.config.organizationId,
|
|
2817
|
-
hostingIds:
|
|
2818
|
-
filterEventStatuses:
|
|
2819
|
-
dateRange:
|
|
2820
|
-
page:
|
|
2821
|
-
sorts:
|
|
2817
|
+
hostingIds: n.hostingIds,
|
|
2818
|
+
filterEventStatuses: n.statuses,
|
|
2819
|
+
dateRange: n.dateRange,
|
|
2820
|
+
page: n.page,
|
|
2821
|
+
sorts: n.sorts,
|
|
2822
2822
|
trackerId: this.config.trackerId
|
|
2823
|
-
}), console.log({
|
|
2824
|
-
organizationId: this.config.organizationId,
|
|
2825
|
-
hostingIds: e.hostingIds,
|
|
2826
|
-
locationIds: e.locationIds,
|
|
2827
|
-
excludedEventIds: e.excludedEventIds,
|
|
2828
|
-
filterEventStatuses: e.statuses,
|
|
2829
|
-
dateRange: e.dateRange && e.dateRange.from && e.dateRange.till ? {
|
|
2830
|
-
from: e.dateRange.from.toISO(),
|
|
2831
|
-
till: e.dateRange.till.toISO()
|
|
2832
|
-
} : void 0,
|
|
2833
|
-
page: e.page,
|
|
2834
|
-
sorts: e.sorts,
|
|
2835
|
-
trackerId: this.config.trackerId,
|
|
2836
|
-
searchTerm: e.searchTerm,
|
|
2837
|
-
priceRange: e.priceRange
|
|
2838
2823
|
});
|
|
2839
|
-
const
|
|
2824
|
+
const e = await this.sdk.EventOverviewPage({
|
|
2840
2825
|
organizationId: this.config.organizationId,
|
|
2841
|
-
hostingIds:
|
|
2842
|
-
locationIds:
|
|
2843
|
-
excludedEventIds:
|
|
2844
|
-
filterEventStatuses:
|
|
2845
|
-
dateRange:
|
|
2846
|
-
from:
|
|
2847
|
-
till:
|
|
2826
|
+
hostingIds: n.hostingIds,
|
|
2827
|
+
locationIds: n.locationIds,
|
|
2828
|
+
excludedEventIds: n.excludedEventIds,
|
|
2829
|
+
filterEventStatuses: n.statuses,
|
|
2830
|
+
dateRange: n.dateRange && n.dateRange.from && n.dateRange.till ? {
|
|
2831
|
+
from: n.dateRange.from.toISO(),
|
|
2832
|
+
till: n.dateRange.till.toISO()
|
|
2848
2833
|
} : void 0,
|
|
2849
|
-
page:
|
|
2850
|
-
sorts:
|
|
2834
|
+
page: n.page,
|
|
2835
|
+
sorts: n.sorts,
|
|
2851
2836
|
trackerId: this.config.trackerId,
|
|
2852
|
-
searchTerm:
|
|
2853
|
-
priceRange:
|
|
2837
|
+
searchTerm: n.searchTerm,
|
|
2838
|
+
priceRange: n.priceRange
|
|
2854
2839
|
});
|
|
2855
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2856
|
-
const i =
|
|
2840
|
+
if (this.debugLog("Raw GraphQL response", e), e?.findAllPublicEventByOrganizationId?.data) {
|
|
2841
|
+
const i = e.findAllPublicEventByOrganizationId.data.map((r) => ({
|
|
2857
2842
|
id: r.id,
|
|
2858
2843
|
name: r.name,
|
|
2859
2844
|
icon: r.icon,
|
|
@@ -2881,19 +2866,19 @@ class xt {
|
|
|
2881
2866
|
startingPrice: r.startingPrice,
|
|
2882
2867
|
totalViews: r.totalViews
|
|
2883
2868
|
}));
|
|
2884
|
-
return this.debugLog("Processed events", { events: i, count: i.length }), [i,
|
|
2869
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, e.findAllPublicEventByOrganizationId.count ?? 0];
|
|
2885
2870
|
} else
|
|
2886
2871
|
return this.debugLog("No events found in response"), [[], 0];
|
|
2887
|
-
} catch (
|
|
2888
|
-
throw this.debugLog("Error fetching events",
|
|
2872
|
+
} catch (e) {
|
|
2873
|
+
throw this.debugLog("Error fetching events", e), e;
|
|
2889
2874
|
}
|
|
2890
2875
|
}
|
|
2891
|
-
async getEvent(
|
|
2876
|
+
async getEvent(n) {
|
|
2892
2877
|
try {
|
|
2893
|
-
this.debugLog("Fetching single event", { eventId:
|
|
2894
|
-
const
|
|
2895
|
-
if (this.debugLog("Raw GraphQL response",
|
|
2896
|
-
const i =
|
|
2878
|
+
this.debugLog("Fetching single event", { eventId: n });
|
|
2879
|
+
const e = await this.sdk.EventDetailPage({ eventId: n });
|
|
2880
|
+
if (this.debugLog("Raw GraphQL response", e), e?.findPublicEventById) {
|
|
2881
|
+
const i = e.findPublicEventById, r = {
|
|
2897
2882
|
id: i.id,
|
|
2898
2883
|
name: i.name,
|
|
2899
2884
|
icon: i.icon,
|
|
@@ -2923,26 +2908,26 @@ class xt {
|
|
|
2923
2908
|
};
|
|
2924
2909
|
return this.debugLog("Processed single event", r), r;
|
|
2925
2910
|
} else {
|
|
2926
|
-
this.debugLog("No event found for id",
|
|
2911
|
+
this.debugLog("No event found for id", n);
|
|
2927
2912
|
return;
|
|
2928
2913
|
}
|
|
2929
|
-
} catch (
|
|
2930
|
-
throw this.debugLog("Error fetching single event",
|
|
2914
|
+
} catch (e) {
|
|
2915
|
+
throw this.debugLog("Error fetching single event", e), e;
|
|
2931
2916
|
}
|
|
2932
2917
|
}
|
|
2933
|
-
async getProducts(
|
|
2918
|
+
async getProducts(n, e, i) {
|
|
2934
2919
|
try {
|
|
2935
2920
|
this.debugLog("Fetching products for event", {
|
|
2936
|
-
eventId:
|
|
2921
|
+
eventId: n,
|
|
2937
2922
|
promoCode: i,
|
|
2938
2923
|
trackerId: this.config.trackerId,
|
|
2939
|
-
productTypes:
|
|
2924
|
+
productTypes: e
|
|
2940
2925
|
});
|
|
2941
2926
|
const r = await this.sdk.findProductsByEventId({
|
|
2942
|
-
eventId:
|
|
2927
|
+
eventId: n,
|
|
2943
2928
|
promoCode: i,
|
|
2944
2929
|
trackerId: this.config.trackerId,
|
|
2945
|
-
productTypes:
|
|
2930
|
+
productTypes: e
|
|
2946
2931
|
});
|
|
2947
2932
|
if (r?.findPublicProductsByEventId) {
|
|
2948
2933
|
const s = r.findPublicProductsByEventId.map((o) => ({
|
|
@@ -2970,21 +2955,21 @@ class xt {
|
|
|
2970
2955
|
type: o.type
|
|
2971
2956
|
}));
|
|
2972
2957
|
return this.debugLog("Products fetched", {
|
|
2973
|
-
eventId:
|
|
2958
|
+
eventId: n,
|
|
2974
2959
|
count: s.length,
|
|
2975
2960
|
types: s.map((o) => o.type)
|
|
2976
2961
|
}), s;
|
|
2977
2962
|
}
|
|
2978
2963
|
return;
|
|
2979
2964
|
} catch (r) {
|
|
2980
|
-
throw this.debugLog("Error fetching products", { eventId:
|
|
2965
|
+
throw this.debugLog("Error fetching products", { eventId: n, error: r }), r;
|
|
2981
2966
|
}
|
|
2982
2967
|
}
|
|
2983
|
-
debugLog(
|
|
2984
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${
|
|
2968
|
+
debugLog(n, e) {
|
|
2969
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${n}`, e || "");
|
|
2985
2970
|
}
|
|
2986
2971
|
}
|
|
2987
|
-
const
|
|
2972
|
+
const xt = l`
|
|
2988
2973
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String, $withTicketProtection: Boolean) {
|
|
2989
2974
|
findPaymentDetails(
|
|
2990
2975
|
orderId: $orderId
|
|
@@ -3018,36 +3003,36 @@ const Pt = l`
|
|
|
3018
3003
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
3019
3004
|
createDigitalOrderPayment(input: $input)
|
|
3020
3005
|
}
|
|
3021
|
-
`, St = (n, e,
|
|
3022
|
-
function Ct(
|
|
3006
|
+
`, St = (t, n, e, i) => t();
|
|
3007
|
+
function Ct(t, n = St) {
|
|
3023
3008
|
return {
|
|
3024
|
-
findPaymentMethods(
|
|
3025
|
-
return
|
|
3009
|
+
findPaymentMethods(e, i, r) {
|
|
3010
|
+
return n((s) => t.request({ document: xt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findPaymentMethods", "query", e);
|
|
3026
3011
|
},
|
|
3027
|
-
createDigitalPayment(
|
|
3028
|
-
return
|
|
3012
|
+
createDigitalPayment(e, i, r) {
|
|
3013
|
+
return n((s) => t.request({ document: bt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "createDigitalPayment", "mutation", e);
|
|
3029
3014
|
}
|
|
3030
3015
|
};
|
|
3031
3016
|
}
|
|
3032
3017
|
class _t {
|
|
3033
3018
|
config;
|
|
3034
3019
|
sdk;
|
|
3035
|
-
constructor(
|
|
3036
|
-
this.config =
|
|
3020
|
+
constructor(n) {
|
|
3021
|
+
this.config = n, this.sdk = Ct(new v(n.apiUrl));
|
|
3037
3022
|
}
|
|
3038
|
-
async getPaymentDetails(
|
|
3039
|
-
this.debugLog("Fetching payment methods",
|
|
3023
|
+
async getPaymentDetails(n) {
|
|
3024
|
+
this.debugLog("Fetching payment methods", n);
|
|
3040
3025
|
try {
|
|
3041
|
-
const
|
|
3042
|
-
orderId:
|
|
3043
|
-
orderItemId:
|
|
3044
|
-
amountOfTickets:
|
|
3045
|
-
paymentMethodId:
|
|
3046
|
-
withTicketProtection:
|
|
3026
|
+
const e = await this.sdk.findPaymentMethods({
|
|
3027
|
+
orderId: n.orderId,
|
|
3028
|
+
orderItemId: n.orderItemId,
|
|
3029
|
+
amountOfTickets: n.amountOfTickets,
|
|
3030
|
+
paymentMethodId: n.paymentMethodId,
|
|
3031
|
+
withTicketProtection: n.withTicketProtection
|
|
3047
3032
|
});
|
|
3048
|
-
if (!
|
|
3033
|
+
if (!e?.findPaymentDetails)
|
|
3049
3034
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
3050
|
-
const i =
|
|
3035
|
+
const i = e.findPaymentDetails;
|
|
3051
3036
|
return this.debugLog("Payment methods fetched successfully", {
|
|
3052
3037
|
methodCount: i.methods?.length ?? 0,
|
|
3053
3038
|
transactionPrice: i.transactionPrice,
|
|
@@ -3076,39 +3061,39 @@ class _t {
|
|
|
3076
3061
|
})) ?? null
|
|
3077
3062
|
})) ?? null
|
|
3078
3063
|
};
|
|
3079
|
-
} catch (
|
|
3080
|
-
throw this.debugLog("Error fetching payment methods",
|
|
3064
|
+
} catch (e) {
|
|
3065
|
+
throw this.debugLog("Error fetching payment methods", e), e;
|
|
3081
3066
|
}
|
|
3082
3067
|
}
|
|
3083
|
-
async createPayment(
|
|
3084
|
-
this.debugLog("Creating payment",
|
|
3068
|
+
async createPayment(n) {
|
|
3069
|
+
this.debugLog("Creating payment", n);
|
|
3085
3070
|
try {
|
|
3086
|
-
const
|
|
3087
|
-
orderId:
|
|
3088
|
-
paymentMethodId:
|
|
3089
|
-
issuerId:
|
|
3090
|
-
redirectUrl:
|
|
3071
|
+
const e = {
|
|
3072
|
+
orderId: n.orderId,
|
|
3073
|
+
paymentMethodId: n.paymentMethodId,
|
|
3074
|
+
issuerId: n.issuerId,
|
|
3075
|
+
redirectUrl: n.redirectUrl,
|
|
3091
3076
|
// For payment links this input in used
|
|
3092
|
-
initiatedByUserId:
|
|
3093
|
-
initiatedByTeamId:
|
|
3094
|
-
amountOfTickets:
|
|
3095
|
-
orderItemId:
|
|
3096
|
-
withTicketProtection:
|
|
3077
|
+
initiatedByUserId: n.initiatedByUserId,
|
|
3078
|
+
initiatedByTeamId: n.initiatedByTeamId,
|
|
3079
|
+
amountOfTickets: n.amountOfTickets,
|
|
3080
|
+
orderItemId: n.orderItemId,
|
|
3081
|
+
withTicketProtection: n.withTicketProtection
|
|
3097
3082
|
};
|
|
3098
|
-
|
|
3083
|
+
n.customer && (e.customer = n.customer), n.products && (e.products = n.products), n.description && (e.description = n.description), n.reference && (e.reference = n.reference), n.ipAddress && (e.ipAddress = n.ipAddress);
|
|
3099
3084
|
const i = await this.sdk.createDigitalPayment({
|
|
3100
|
-
input:
|
|
3085
|
+
input: e
|
|
3101
3086
|
});
|
|
3102
3087
|
if (!i?.createDigitalOrderPayment)
|
|
3103
3088
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
3104
3089
|
const r = i.createDigitalOrderPayment;
|
|
3105
3090
|
return this.debugLog("Payment created successfully", { paymentUrl: r }), { paymentUrl: r };
|
|
3106
|
-
} catch (
|
|
3107
|
-
throw this.debugLog("Error creating payment",
|
|
3091
|
+
} catch (e) {
|
|
3092
|
+
throw this.debugLog("Error creating payment", e), e;
|
|
3108
3093
|
}
|
|
3109
3094
|
}
|
|
3110
|
-
debugLog(
|
|
3111
|
-
this.config.debug && console.log(`[PaymentService] ${
|
|
3095
|
+
debugLog(n, e) {
|
|
3096
|
+
this.config.debug && console.log(`[PaymentService] ${n}`, e || "");
|
|
3112
3097
|
}
|
|
3113
3098
|
}
|
|
3114
3099
|
const Lt = l`
|
|
@@ -3197,40 +3182,40 @@ const Lt = l`
|
|
|
3197
3182
|
count
|
|
3198
3183
|
}
|
|
3199
3184
|
}
|
|
3200
|
-
`, Ft = (n, e,
|
|
3201
|
-
function $t(
|
|
3185
|
+
`, Ft = (t, n, e, i) => t();
|
|
3186
|
+
function $t(t, n = Ft) {
|
|
3202
3187
|
return {
|
|
3203
|
-
findAllPublicPackagesByOrganizationId(
|
|
3204
|
-
return
|
|
3188
|
+
findAllPublicPackagesByOrganizationId(e, i, r) {
|
|
3189
|
+
return n((s) => t.request({ document: Lt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicPackagesByOrganizationId", "query", e);
|
|
3205
3190
|
},
|
|
3206
|
-
findPublicPackageById(
|
|
3207
|
-
return
|
|
3191
|
+
findPublicPackageById(e, i, r) {
|
|
3192
|
+
return n((s) => t.request({ document: Rt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findPublicPackageById", "query", e);
|
|
3208
3193
|
},
|
|
3209
|
-
findPublicItemsByPackageId(
|
|
3210
|
-
return
|
|
3194
|
+
findPublicItemsByPackageId(e, i, r) {
|
|
3195
|
+
return n((s) => t.request({ document: wt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findPublicItemsByPackageId", "query", e);
|
|
3211
3196
|
}
|
|
3212
3197
|
};
|
|
3213
3198
|
}
|
|
3214
3199
|
class Bt {
|
|
3215
3200
|
config;
|
|
3216
3201
|
sdk;
|
|
3217
|
-
constructor(
|
|
3218
|
-
this.config =
|
|
3202
|
+
constructor(n) {
|
|
3203
|
+
this.config = n, this.sdk = $t(new v(n.apiUrl));
|
|
3219
3204
|
}
|
|
3220
|
-
debugLog(
|
|
3221
|
-
this.config.debug && console.log(`[PackageService] ${
|
|
3205
|
+
debugLog(n, e) {
|
|
3206
|
+
this.config.debug && console.log(`[PackageService] ${n}`, e || "");
|
|
3222
3207
|
}
|
|
3223
|
-
async getPackages(
|
|
3208
|
+
async getPackages(n = {}) {
|
|
3224
3209
|
try {
|
|
3225
|
-
let
|
|
3226
|
-
|
|
3227
|
-
index:
|
|
3228
|
-
size:
|
|
3210
|
+
let e;
|
|
3211
|
+
n.page && (e = {
|
|
3212
|
+
index: n.page.index ?? 0,
|
|
3213
|
+
size: n.page.size ?? 20
|
|
3229
3214
|
}), this.debugLog("Fetching public packages", {
|
|
3230
3215
|
organizationId: this.config.organizationId,
|
|
3231
|
-
page:
|
|
3232
|
-
tab:
|
|
3233
|
-
statuses:
|
|
3216
|
+
page: e,
|
|
3217
|
+
tab: n.tab,
|
|
3218
|
+
statuses: n.statuses
|
|
3234
3219
|
});
|
|
3235
3220
|
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
3236
3221
|
organizationId: this.config.organizationId
|
|
@@ -3243,31 +3228,31 @@ class Bt {
|
|
|
3243
3228
|
}), r.data;
|
|
3244
3229
|
}
|
|
3245
3230
|
return null;
|
|
3246
|
-
} catch (
|
|
3247
|
-
throw this.debugLog("Error fetching public packages",
|
|
3231
|
+
} catch (e) {
|
|
3232
|
+
throw this.debugLog("Error fetching public packages", e), e;
|
|
3248
3233
|
}
|
|
3249
3234
|
}
|
|
3250
|
-
async getPackage(
|
|
3235
|
+
async getPackage(n) {
|
|
3251
3236
|
try {
|
|
3252
3237
|
this.debugLog("Fetching public packages", {
|
|
3253
|
-
packageId:
|
|
3238
|
+
packageId: n
|
|
3254
3239
|
});
|
|
3255
|
-
const
|
|
3256
|
-
if (
|
|
3257
|
-
const i =
|
|
3240
|
+
const e = await this.sdk.findPublicPackageById({ packageId: n });
|
|
3241
|
+
if (e?.findPublicPackageById) {
|
|
3242
|
+
const i = e.findPublicPackageById;
|
|
3258
3243
|
return this.debugLog("Public package fetched"), i;
|
|
3259
3244
|
}
|
|
3260
3245
|
return null;
|
|
3261
|
-
} catch (
|
|
3262
|
-
throw this.debugLog("Error fetching public packages",
|
|
3246
|
+
} catch (e) {
|
|
3247
|
+
throw this.debugLog("Error fetching public packages", e), e;
|
|
3263
3248
|
}
|
|
3264
3249
|
}
|
|
3265
|
-
async getPackageItems(
|
|
3250
|
+
async getPackageItems(n, e = [R.Regular, R.AdditionalEvent]) {
|
|
3266
3251
|
try {
|
|
3267
|
-
this.debugLog("Fetching public package items", { packageId:
|
|
3252
|
+
this.debugLog("Fetching public package items", { packageId: n, types: e });
|
|
3268
3253
|
const i = await this.sdk.findPublicItemsByPackageId({
|
|
3269
|
-
packageId:
|
|
3270
|
-
types:
|
|
3254
|
+
packageId: n,
|
|
3255
|
+
types: e,
|
|
3271
3256
|
page: { index: 0, size: 100 }
|
|
3272
3257
|
});
|
|
3273
3258
|
if (i?.findPublicItemsByPackageId) {
|
|
@@ -3303,37 +3288,37 @@ const Vt = l`
|
|
|
3303
3288
|
count
|
|
3304
3289
|
}
|
|
3305
3290
|
}
|
|
3306
|
-
`, Ut = (n, e,
|
|
3307
|
-
function Mt(
|
|
3291
|
+
`, Ut = (t, n, e, i) => t();
|
|
3292
|
+
function Mt(t, n = Ut) {
|
|
3308
3293
|
return {
|
|
3309
|
-
findAllPublicCategoriesByOrganizationId(
|
|
3310
|
-
return
|
|
3294
|
+
findAllPublicCategoriesByOrganizationId(e, i, r) {
|
|
3295
|
+
return n((s) => t.request({ document: Vt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "findAllPublicCategoriesByOrganizationId", "query", e);
|
|
3311
3296
|
}
|
|
3312
3297
|
};
|
|
3313
3298
|
}
|
|
3314
3299
|
class zt {
|
|
3315
3300
|
config;
|
|
3316
3301
|
sdk;
|
|
3317
|
-
constructor(
|
|
3318
|
-
this.config =
|
|
3302
|
+
constructor(n) {
|
|
3303
|
+
this.config = n, this.sdk = Mt(new v(n.apiUrl));
|
|
3319
3304
|
}
|
|
3320
|
-
debugLog(
|
|
3321
|
-
this.config.debug && console.log(`[CategoryService] ${
|
|
3305
|
+
debugLog(n, e) {
|
|
3306
|
+
this.config.debug && console.log(`[CategoryService] ${n}`, e || "");
|
|
3322
3307
|
}
|
|
3323
|
-
async getCategories(
|
|
3308
|
+
async getCategories(n) {
|
|
3324
3309
|
try {
|
|
3325
3310
|
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
3326
|
-
const
|
|
3327
|
-
if (
|
|
3328
|
-
const i =
|
|
3311
|
+
const e = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId, dateRange: n ?? null });
|
|
3312
|
+
if (e?.findAllPublicHostingsByOrganizationId) {
|
|
3313
|
+
const i = e.findAllPublicHostingsByOrganizationId, r = e.findAllPublicLocationsByOrganizationId;
|
|
3329
3314
|
return this.debugLog("Categories fetched", { count: i.count + r.count, dataLength: i.data.length + r.data.length }), [
|
|
3330
3315
|
...i.data.map((s) => ({ id: s.id, name: s.name, icon: s.icon, activeEvents: s.amountOfActiveEvents, type: "HOSTING" })),
|
|
3331
3316
|
...r.data.map((s) => ({ id: s.id, name: s.name, activeEvents: s.amountOfActiveEvents, type: "LOCATION" }))
|
|
3332
3317
|
];
|
|
3333
3318
|
}
|
|
3334
3319
|
return [];
|
|
3335
|
-
} catch (
|
|
3336
|
-
throw this.debugLog("Error fetching categories",
|
|
3320
|
+
} catch (e) {
|
|
3321
|
+
throw this.debugLog("Error fetching categories", e), e;
|
|
3337
3322
|
}
|
|
3338
3323
|
}
|
|
3339
3324
|
}
|
|
@@ -3349,43 +3334,43 @@ const qt = l`
|
|
|
3349
3334
|
mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
|
|
3350
3335
|
createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
|
|
3351
3336
|
}
|
|
3352
|
-
`, Yt = (n, e,
|
|
3353
|
-
function Ht(
|
|
3337
|
+
`, Yt = (t, n, e, i) => t();
|
|
3338
|
+
function Ht(t, n = Yt) {
|
|
3354
3339
|
return {
|
|
3355
|
-
CreateShopView(
|
|
3356
|
-
return
|
|
3340
|
+
CreateShopView(e, i, r) {
|
|
3341
|
+
return n((s) => t.request({ document: qt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "CreateShopView", "mutation", e);
|
|
3357
3342
|
},
|
|
3358
|
-
CreateEventView(
|
|
3359
|
-
return
|
|
3343
|
+
CreateEventView(e, i, r) {
|
|
3344
|
+
return n((s) => t.request({ document: Gt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "CreateEventView", "mutation", e);
|
|
3360
3345
|
},
|
|
3361
|
-
CreatePackageView(
|
|
3362
|
-
return
|
|
3346
|
+
CreatePackageView(e, i, r) {
|
|
3347
|
+
return n((s) => t.request({ document: jt, variables: e, requestHeaders: { ...i, ...s }, signal: r }), "CreatePackageView", "mutation", e);
|
|
3363
3348
|
}
|
|
3364
3349
|
};
|
|
3365
3350
|
}
|
|
3366
3351
|
class Jt {
|
|
3367
3352
|
config;
|
|
3368
3353
|
sdk;
|
|
3369
|
-
constructor(
|
|
3370
|
-
this.config =
|
|
3354
|
+
constructor(n) {
|
|
3355
|
+
this.config = n, this.sdk = Ht(new v(n.apiUrl));
|
|
3371
3356
|
}
|
|
3372
|
-
createMetric = async (
|
|
3373
|
-
switch (!
|
|
3374
|
-
id:
|
|
3357
|
+
createMetric = async (n, e, i) => {
|
|
3358
|
+
switch (!e && !i && await this.sdk.CreateShopView({
|
|
3359
|
+
id: n,
|
|
3375
3360
|
trackerLinkId: this.config.trackerId
|
|
3376
3361
|
}), i) {
|
|
3377
3362
|
case w.Event:
|
|
3378
3363
|
await this.sdk.CreateEventView({
|
|
3379
|
-
id:
|
|
3380
|
-
shopId:
|
|
3364
|
+
id: n,
|
|
3365
|
+
shopId: e,
|
|
3381
3366
|
trackerLinkId: this.config.trackerId
|
|
3382
3367
|
});
|
|
3383
3368
|
break;
|
|
3384
3369
|
case w.Package:
|
|
3385
3370
|
await this.sdk.CreatePackageView(
|
|
3386
3371
|
{
|
|
3387
|
-
id:
|
|
3388
|
-
shopId:
|
|
3372
|
+
id: n,
|
|
3373
|
+
shopId: e,
|
|
3389
3374
|
trackerLinkId: this.config.trackerId
|
|
3390
3375
|
}
|
|
3391
3376
|
);
|
|
@@ -3403,41 +3388,41 @@ class Zt {
|
|
|
3403
3388
|
metric;
|
|
3404
3389
|
// Attach selected public types to the SDK class
|
|
3405
3390
|
static Types = Te;
|
|
3406
|
-
constructor(
|
|
3407
|
-
const { organizationId:
|
|
3408
|
-
this.basket = new kt({ debug: i, apiUrl: r, shopId:
|
|
3391
|
+
constructor(n) {
|
|
3392
|
+
const { organizationId: e, debug: i = !1, apiUrl: r = Qt } = n, s = this.getOrInitTrackerId();
|
|
3393
|
+
this.basket = new kt({ debug: i, apiUrl: r, shopId: n.shopId, trackerId: s }), this.event = new Pt({ organizationId: e, debug: i, apiUrl: r, trackerId: s }), this.payment = new _t({ debug: i, apiUrl: r }), this.package = new Bt({ organizationId: e, debug: i, apiUrl: r }), this.category = new zt({ organizationId: e, debug: i, apiUrl: r }), this.metric = new Jt({ apiUrl: r, trackerId: s });
|
|
3409
3394
|
}
|
|
3410
3395
|
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
3411
3396
|
// Persist to session when found via config or URL for subsequent page loads
|
|
3412
3397
|
getOrInitTrackerId() {
|
|
3413
3398
|
try {
|
|
3414
|
-
let
|
|
3399
|
+
let n = null, e = null;
|
|
3415
3400
|
if (typeof window < "u") {
|
|
3416
3401
|
try {
|
|
3417
|
-
|
|
3402
|
+
e = new URL(window.location.href).searchParams.get("trackerId");
|
|
3418
3403
|
} catch {
|
|
3419
3404
|
}
|
|
3420
3405
|
try {
|
|
3421
|
-
|
|
3406
|
+
n = window.sessionStorage?.getItem(Z) ?? null;
|
|
3422
3407
|
} catch {
|
|
3423
3408
|
}
|
|
3424
3409
|
}
|
|
3425
|
-
if (
|
|
3410
|
+
if (e && e.trim().length > 0) {
|
|
3426
3411
|
try {
|
|
3427
|
-
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Z,
|
|
3412
|
+
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Z, e);
|
|
3428
3413
|
} catch {
|
|
3429
3414
|
}
|
|
3430
|
-
return
|
|
3415
|
+
return e;
|
|
3431
3416
|
}
|
|
3432
|
-
if (
|
|
3417
|
+
if (n && n.trim().length > 0) {
|
|
3433
3418
|
try {
|
|
3434
3419
|
if (typeof window < "u") {
|
|
3435
3420
|
const i = new URL(window.location.href);
|
|
3436
|
-
i.searchParams.get("trackerId") || (i.searchParams.set("trackerId",
|
|
3421
|
+
i.searchParams.get("trackerId") || (i.searchParams.set("trackerId", n), window.history.replaceState({}, "", i.toString()));
|
|
3437
3422
|
}
|
|
3438
3423
|
} catch {
|
|
3439
3424
|
}
|
|
3440
|
-
return
|
|
3425
|
+
return n;
|
|
3441
3426
|
}
|
|
3442
3427
|
return;
|
|
3443
3428
|
} catch {
|