@debugged-development/ticketapp-sdk 0.0.3 → 1.0.2
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/README.md +639 -153
- package/dist/graphql/generated.d.ts +320 -1
- package/dist/graphql/generated.d.ts.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1663 -1210
- package/dist/sdk.d.ts +28 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/services/basketService.d.ts +2 -5
- package/dist/services/basketService.d.ts.map +1 -1
- package/dist/services/eventService.d.ts +1 -0
- package/dist/services/eventService.d.ts.map +1 -1
- package/dist/services/packageService.d.ts +60 -0
- package/dist/services/packageService.d.ts.map +1 -0
- package/dist/services/paymentService.d.ts +1 -0
- package/dist/services/paymentService.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { GraphQLClient as
|
|
2
|
-
import { createSlice as
|
|
3
|
-
import { DateTime as
|
|
4
|
-
const
|
|
1
|
+
import { GraphQLClient as M } from "graphql-request";
|
|
2
|
+
import { createSlice as ce, configureStore as ue } from "@reduxjs/toolkit";
|
|
3
|
+
import { DateTime as _ } from "luxon";
|
|
4
|
+
const ee = {
|
|
5
5
|
order: null,
|
|
6
6
|
processing: !1,
|
|
7
7
|
error: null
|
|
8
|
-
},
|
|
8
|
+
}, le = ce({
|
|
9
9
|
name: "basket",
|
|
10
|
-
initialState:
|
|
10
|
+
initialState: ee,
|
|
11
11
|
reducers: {
|
|
12
|
-
setProcessing: (
|
|
13
|
-
|
|
12
|
+
setProcessing: (e, t) => {
|
|
13
|
+
e.processing = t.payload;
|
|
14
14
|
},
|
|
15
|
-
setError: (
|
|
16
|
-
|
|
15
|
+
setError: (e, t) => {
|
|
16
|
+
e.error = t.payload;
|
|
17
17
|
},
|
|
18
|
-
setOrder: (
|
|
19
|
-
|
|
18
|
+
setOrder: (e, t) => {
|
|
19
|
+
e.order = t.payload;
|
|
20
20
|
},
|
|
21
|
-
initializeOrder: (
|
|
22
|
-
|
|
23
|
-
id:
|
|
24
|
-
currency:
|
|
21
|
+
initializeOrder: (e, t) => {
|
|
22
|
+
e.order || (e.order = {
|
|
23
|
+
id: t.payload.id,
|
|
24
|
+
currency: t.payload.currency,
|
|
25
25
|
items: [],
|
|
26
|
-
expiredAt:
|
|
26
|
+
expiredAt: _.fromISO(t.payload.expiredAt)
|
|
27
27
|
});
|
|
28
28
|
},
|
|
29
|
-
addProductToOrder: (
|
|
30
|
-
const { input: r, amountReserved:
|
|
31
|
-
if (!
|
|
29
|
+
addProductToOrder: (e, t) => {
|
|
30
|
+
const { input: r, amountReserved: i, expiredAt: n } = t.payload;
|
|
31
|
+
if (!e.order)
|
|
32
32
|
return;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
33
|
+
const s = e.order.items.findIndex((o) => r.seat ? o.id === r.id && o.seats?.some((c) => c.id === r.seat?.id) : o.id === r.id);
|
|
34
|
+
if (s >= 0)
|
|
35
|
+
e.order.items[s].amount += i;
|
|
36
36
|
else {
|
|
37
|
-
const
|
|
37
|
+
const o = {
|
|
38
38
|
id: r.id,
|
|
39
39
|
type: "PRODUCT",
|
|
40
40
|
name: r.name,
|
|
41
|
-
amount:
|
|
41
|
+
amount: i,
|
|
42
42
|
price: r.price,
|
|
43
43
|
depositPrice: r.depositPrice,
|
|
44
44
|
serviceFee: r.serviceFee,
|
|
45
45
|
originalPrice: r.price,
|
|
46
46
|
seats: r.seat ? [{ id: r.seat.id, label: r.seat.label }] : void 0
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
e.order.items.push(o);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
e.order.expiredAt = _.fromISO(n);
|
|
51
51
|
},
|
|
52
|
-
removeProductFromOrder: (
|
|
53
|
-
if (!
|
|
54
|
-
const { id: r, amountReleased:
|
|
55
|
-
(
|
|
52
|
+
removeProductFromOrder: (e, t) => {
|
|
53
|
+
if (!e.order) return;
|
|
54
|
+
const { id: r, amountReleased: i, seatId: n } = t.payload, s = e.order.items.findIndex(
|
|
55
|
+
(o) => o.type === "PRODUCT" && o.id === r
|
|
56
56
|
);
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
else if (
|
|
62
|
-
const
|
|
63
|
-
|
|
57
|
+
if (s !== -1) {
|
|
58
|
+
const o = e.order.items[s];
|
|
59
|
+
if (o.amount -= i, o.amount <= 0)
|
|
60
|
+
e.order.items.splice(s, 1);
|
|
61
|
+
else if (o.seats && n) {
|
|
62
|
+
const c = o.seats.findIndex((l) => l.id === n);
|
|
63
|
+
c !== -1 && o.seats.splice(c, 1);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
e.order.items.length === 0 && (e.order = null);
|
|
67
67
|
},
|
|
68
|
-
setPackageInOrder: (
|
|
69
|
-
const { input: r, amountReserved:
|
|
70
|
-
|
|
68
|
+
setPackageInOrder: (e, t) => {
|
|
69
|
+
const { input: r, amountReserved: i, expiredAt: n } = t.payload;
|
|
70
|
+
e.order || (e.order = {
|
|
71
71
|
id: "",
|
|
72
72
|
currency: r.currency,
|
|
73
73
|
items: [],
|
|
74
|
-
expiredAt:
|
|
74
|
+
expiredAt: _.fromISO(n)
|
|
75
75
|
});
|
|
76
|
-
const
|
|
77
|
-
(
|
|
76
|
+
const s = e.order.items.find(
|
|
77
|
+
(o) => o.type === "PACKAGE" && o.id === r.id
|
|
78
78
|
);
|
|
79
|
-
|
|
79
|
+
s ? (s.amount = i, s.packageItems = r.items) : e.order.items.push({
|
|
80
80
|
id: r.id,
|
|
81
81
|
type: "PACKAGE",
|
|
82
82
|
name: r.name,
|
|
83
|
-
amount:
|
|
83
|
+
amount: i,
|
|
84
84
|
price: r.discountPrice ?? r.price,
|
|
85
85
|
depositPrice: r.depositPrice,
|
|
86
86
|
originalPrice: r.price,
|
|
@@ -88,17 +88,17 @@ const J = {
|
|
|
88
88
|
packageItems: r.items
|
|
89
89
|
});
|
|
90
90
|
},
|
|
91
|
-
setDeliveryOption: (
|
|
92
|
-
if (!
|
|
93
|
-
const r =
|
|
91
|
+
setDeliveryOption: (e, t) => {
|
|
92
|
+
if (!e.order) return;
|
|
93
|
+
const r = t.payload, i = e.order.items.findIndex(
|
|
94
94
|
(n) => n.type === "DELIVERY"
|
|
95
95
|
);
|
|
96
96
|
if (r)
|
|
97
|
-
if (
|
|
98
|
-
const n =
|
|
97
|
+
if (i !== -1) {
|
|
98
|
+
const n = e.order.items[i];
|
|
99
99
|
n.id = r.id, n.name = r.name, n.price = r.price, n.serviceFee = r.serviceFee;
|
|
100
100
|
} else
|
|
101
|
-
|
|
101
|
+
e.order.items.push({
|
|
102
102
|
id: r.id,
|
|
103
103
|
type: "PRODUCT",
|
|
104
104
|
name: r.name,
|
|
@@ -107,139 +107,149 @@ const J = {
|
|
|
107
107
|
originalPrice: r.price,
|
|
108
108
|
serviceFee: r.serviceFee
|
|
109
109
|
});
|
|
110
|
-
else
|
|
110
|
+
else i !== -1 && e.order.items.splice(i, 1);
|
|
111
111
|
},
|
|
112
|
-
setCustomer: (
|
|
113
|
-
|
|
112
|
+
setCustomer: (e, t) => {
|
|
113
|
+
e.order && (e.order.customer = t.payload);
|
|
114
114
|
},
|
|
115
|
-
clearBasket: () =>
|
|
115
|
+
clearBasket: () => ee
|
|
116
116
|
}
|
|
117
117
|
}), {
|
|
118
118
|
setProcessing: N,
|
|
119
|
-
setError:
|
|
120
|
-
setOrder:
|
|
121
|
-
initializeOrder:
|
|
122
|
-
addProductToOrder:
|
|
123
|
-
removeProductFromOrder:
|
|
124
|
-
setPackageInOrder:
|
|
125
|
-
setDeliveryOption:
|
|
126
|
-
setCustomer:
|
|
127
|
-
clearBasket:
|
|
128
|
-
} =
|
|
119
|
+
setError: nn,
|
|
120
|
+
setOrder: sn,
|
|
121
|
+
initializeOrder: B,
|
|
122
|
+
addProductToOrder: te,
|
|
123
|
+
removeProductFromOrder: rr,
|
|
124
|
+
setPackageInOrder: re,
|
|
125
|
+
setDeliveryOption: nr,
|
|
126
|
+
setCustomer: ne,
|
|
127
|
+
clearBasket: ie
|
|
128
|
+
} = le.actions, ir = le.reducer, se = {
|
|
129
129
|
events: [],
|
|
130
130
|
processing: !1,
|
|
131
131
|
error: null,
|
|
132
132
|
loadingProducts: {}
|
|
133
|
-
},
|
|
133
|
+
}, W = ce({
|
|
134
134
|
name: "event",
|
|
135
|
-
initialState:
|
|
135
|
+
initialState: se,
|
|
136
136
|
reducers: {
|
|
137
|
-
setProcessing: (
|
|
138
|
-
|
|
137
|
+
setProcessing: (e, t) => {
|
|
138
|
+
e.processing = t.payload;
|
|
139
139
|
},
|
|
140
|
-
setError: (
|
|
141
|
-
|
|
140
|
+
setError: (e, t) => {
|
|
141
|
+
e.error = t.payload;
|
|
142
142
|
},
|
|
143
|
-
setEvents: (
|
|
144
|
-
|
|
143
|
+
setEvents: (e, t) => {
|
|
144
|
+
e.events = t.payload;
|
|
145
145
|
},
|
|
146
|
-
setEventProducts: (
|
|
147
|
-
const r =
|
|
148
|
-
r && (r.products =
|
|
146
|
+
setEventProducts: (e, t) => {
|
|
147
|
+
const r = e.events.find((i) => i.id === t.payload.eventId);
|
|
148
|
+
r && (r.products = t.payload.products);
|
|
149
149
|
},
|
|
150
|
-
setLoadingProducts: (
|
|
151
|
-
|
|
150
|
+
setLoadingProducts: (e, t) => {
|
|
151
|
+
e.loadingProducts[t.payload.eventId] = t.payload.loading;
|
|
152
152
|
},
|
|
153
|
-
clearEvents: () =>
|
|
153
|
+
clearEvents: () => se
|
|
154
154
|
}
|
|
155
155
|
}), {
|
|
156
|
-
setProcessing:
|
|
157
|
-
setError:
|
|
158
|
-
setEvents:
|
|
159
|
-
setEventProducts:
|
|
160
|
-
setLoadingProducts:
|
|
161
|
-
clearEvents:
|
|
162
|
-
} =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
156
|
+
setProcessing: H,
|
|
157
|
+
setError: he,
|
|
158
|
+
setEvents: z,
|
|
159
|
+
setEventProducts: Ee,
|
|
160
|
+
setLoadingProducts: Y,
|
|
161
|
+
clearEvents: Ie
|
|
162
|
+
} = W.actions, pe = W.reducer, sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
163
|
+
__proto__: null,
|
|
164
|
+
clearEvents: Ie,
|
|
165
|
+
default: pe,
|
|
166
|
+
eventSlice: W,
|
|
167
|
+
setError: he,
|
|
168
|
+
setEventProducts: Ee,
|
|
169
|
+
setEvents: z,
|
|
170
|
+
setLoadingProducts: Y,
|
|
171
|
+
setProcessing: H
|
|
172
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
173
|
+
var F = function() {
|
|
174
|
+
return F = Object.assign || function(t) {
|
|
175
|
+
for (var r, i = 1, n = arguments.length; i < n; i++) {
|
|
176
|
+
r = arguments[i];
|
|
177
|
+
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
168
178
|
}
|
|
169
|
-
return
|
|
170
|
-
},
|
|
179
|
+
return t;
|
|
180
|
+
}, F.apply(this, arguments);
|
|
171
181
|
};
|
|
172
|
-
function
|
|
173
|
-
if (!!!
|
|
174
|
-
throw new Error(
|
|
182
|
+
function G(e, t) {
|
|
183
|
+
if (!!!e)
|
|
184
|
+
throw new Error(t);
|
|
175
185
|
}
|
|
176
|
-
function
|
|
177
|
-
return typeof
|
|
186
|
+
function ar(e) {
|
|
187
|
+
return typeof e == "object" && e !== null;
|
|
178
188
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!!!
|
|
189
|
+
function or(e, t) {
|
|
190
|
+
if (!!!e)
|
|
181
191
|
throw new Error(
|
|
182
192
|
"Unexpected invariant triggered."
|
|
183
193
|
);
|
|
184
194
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
187
|
-
let r = 0,
|
|
188
|
-
for (const n of
|
|
189
|
-
if (typeof n.index == "number" ||
|
|
195
|
+
const dr = /\r\n|[\n\r]/g;
|
|
196
|
+
function q(e, t) {
|
|
197
|
+
let r = 0, i = 1;
|
|
198
|
+
for (const n of e.body.matchAll(dr)) {
|
|
199
|
+
if (typeof n.index == "number" || or(!1), n.index >= t)
|
|
190
200
|
break;
|
|
191
|
-
r = n.index + n[0].length,
|
|
201
|
+
r = n.index + n[0].length, i += 1;
|
|
192
202
|
}
|
|
193
203
|
return {
|
|
194
|
-
line:
|
|
195
|
-
column:
|
|
204
|
+
line: i,
|
|
205
|
+
column: t + 1 - r
|
|
196
206
|
};
|
|
197
207
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
|
|
208
|
+
function cr(e) {
|
|
209
|
+
return ge(
|
|
210
|
+
e.source,
|
|
211
|
+
q(e.source, e.start)
|
|
202
212
|
);
|
|
203
213
|
}
|
|
204
|
-
function
|
|
205
|
-
const r =
|
|
206
|
-
`,
|
|
207
|
-
if (
|
|
208
|
-
const
|
|
209
|
-
for (let
|
|
210
|
-
|
|
211
|
-
return
|
|
212
|
-
[`${
|
|
213
|
-
...
|
|
214
|
-
["|", "^".padStart(
|
|
215
|
-
["|",
|
|
214
|
+
function ge(e, t) {
|
|
215
|
+
const r = e.locationOffset.column - 1, i = "".padStart(r) + e.body, n = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, c = t.line === 1 ? r : 0, l = t.column + c, h = `${e.name}:${o}:${l}
|
|
216
|
+
`, d = i.split(/\r\n|[\n\r]/g), A = d[n];
|
|
217
|
+
if (A.length > 120) {
|
|
218
|
+
const p = Math.floor(l / 80), O = l % 80, f = [];
|
|
219
|
+
for (let m = 0; m < A.length; m += 80)
|
|
220
|
+
f.push(A.slice(m, m + 80));
|
|
221
|
+
return h + ae([
|
|
222
|
+
[`${o} |`, f[0]],
|
|
223
|
+
...f.slice(1, p + 1).map((m) => ["|", m]),
|
|
224
|
+
["|", "^".padStart(O)],
|
|
225
|
+
["|", f[p + 1]]
|
|
216
226
|
]);
|
|
217
227
|
}
|
|
218
|
-
return
|
|
228
|
+
return h + ae([
|
|
219
229
|
// Lines specified like this: ["prefix", "string"],
|
|
220
|
-
[`${
|
|
221
|
-
[`${
|
|
230
|
+
[`${o - 1} |`, d[n - 1]],
|
|
231
|
+
[`${o} |`, A],
|
|
222
232
|
["|", "^".padStart(l)],
|
|
223
|
-
[`${
|
|
233
|
+
[`${o + 1} |`, d[n + 1]]
|
|
224
234
|
]);
|
|
225
235
|
}
|
|
226
|
-
function
|
|
227
|
-
const
|
|
228
|
-
return
|
|
236
|
+
function ae(e) {
|
|
237
|
+
const t = e.filter(([i, n]) => n !== void 0), r = Math.max(...t.map(([i]) => i.length));
|
|
238
|
+
return t.map(([i, n]) => i.padStart(r) + (n ? " " + n : "")).join(`
|
|
229
239
|
`);
|
|
230
240
|
}
|
|
231
|
-
function
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
nodes:
|
|
235
|
-
source:
|
|
236
|
-
positions:
|
|
237
|
-
path:
|
|
238
|
-
originalError:
|
|
239
|
-
extensions:
|
|
240
|
-
} :
|
|
241
|
+
function ur(e) {
|
|
242
|
+
const t = e[0];
|
|
243
|
+
return t == null || "kind" in t || "length" in t ? {
|
|
244
|
+
nodes: t,
|
|
245
|
+
source: e[1],
|
|
246
|
+
positions: e[2],
|
|
247
|
+
path: e[3],
|
|
248
|
+
originalError: e[4],
|
|
249
|
+
extensions: e[5]
|
|
250
|
+
} : t;
|
|
241
251
|
}
|
|
242
|
-
class
|
|
252
|
+
class X extends Error {
|
|
243
253
|
/**
|
|
244
254
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
245
255
|
* which correspond to this error.
|
|
@@ -278,20 +288,20 @@ class q extends Error {
|
|
|
278
288
|
/**
|
|
279
289
|
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
280
290
|
*/
|
|
281
|
-
constructor(
|
|
282
|
-
var
|
|
283
|
-
const { nodes:
|
|
284
|
-
super(
|
|
285
|
-
Array.isArray(
|
|
291
|
+
constructor(t, ...r) {
|
|
292
|
+
var i, n, s;
|
|
293
|
+
const { nodes: o, source: c, positions: l, path: h, originalError: d, extensions: A } = ur(r);
|
|
294
|
+
super(t), this.name = "GraphQLError", this.path = h ?? void 0, this.originalError = d ?? void 0, this.nodes = oe(
|
|
295
|
+
Array.isArray(o) ? o : o ? [o] : void 0
|
|
286
296
|
);
|
|
287
|
-
const
|
|
288
|
-
(
|
|
297
|
+
const p = oe(
|
|
298
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((f) => f.loc).filter((f) => f != null)
|
|
289
299
|
);
|
|
290
|
-
this.source =
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
) ?
|
|
294
|
-
this.extensions = (
|
|
300
|
+
this.source = c ?? (p == null || (n = p[0]) === null || n === void 0 ? void 0 : n.source), this.positions = l ?? p?.map((f) => f.start), this.locations = l && c ? l.map((f) => q(c, f)) : p?.map((f) => q(f.source, f.start));
|
|
301
|
+
const O = ar(
|
|
302
|
+
d?.extensions
|
|
303
|
+
) ? d?.extensions : void 0;
|
|
304
|
+
this.extensions = (s = A ?? O) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
295
305
|
message: {
|
|
296
306
|
writable: !0,
|
|
297
307
|
enumerable: !0
|
|
@@ -311,11 +321,11 @@ class q extends Error {
|
|
|
311
321
|
originalError: {
|
|
312
322
|
enumerable: !1
|
|
313
323
|
}
|
|
314
|
-
}),
|
|
315
|
-
value:
|
|
324
|
+
}), d != null && d.stack ? Object.defineProperty(this, "stack", {
|
|
325
|
+
value: d.stack,
|
|
316
326
|
writable: !0,
|
|
317
327
|
configurable: !0
|
|
318
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
328
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, X) : Object.defineProperty(this, "stack", {
|
|
319
329
|
value: Error().stack,
|
|
320
330
|
writable: !0,
|
|
321
331
|
configurable: !0
|
|
@@ -325,36 +335,36 @@ class q extends Error {
|
|
|
325
335
|
return "GraphQLError";
|
|
326
336
|
}
|
|
327
337
|
toString() {
|
|
328
|
-
let
|
|
338
|
+
let t = this.message;
|
|
329
339
|
if (this.nodes)
|
|
330
340
|
for (const r of this.nodes)
|
|
331
|
-
r.loc && (
|
|
341
|
+
r.loc && (t += `
|
|
332
342
|
|
|
333
|
-
` +
|
|
343
|
+
` + cr(r.loc));
|
|
334
344
|
else if (this.source && this.locations)
|
|
335
345
|
for (const r of this.locations)
|
|
336
|
-
|
|
346
|
+
t += `
|
|
337
347
|
|
|
338
|
-
` +
|
|
339
|
-
return
|
|
348
|
+
` + ge(this.source, r);
|
|
349
|
+
return t;
|
|
340
350
|
}
|
|
341
351
|
toJSON() {
|
|
342
|
-
const
|
|
352
|
+
const t = {
|
|
343
353
|
message: this.message
|
|
344
354
|
};
|
|
345
|
-
return this.locations != null && (
|
|
355
|
+
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
|
|
346
356
|
}
|
|
347
357
|
}
|
|
348
|
-
function
|
|
349
|
-
return
|
|
358
|
+
function oe(e) {
|
|
359
|
+
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
350
360
|
}
|
|
351
|
-
function
|
|
352
|
-
return new
|
|
353
|
-
source:
|
|
354
|
-
positions: [
|
|
361
|
+
function g(e, t, r) {
|
|
362
|
+
return new X(`Syntax Error: ${r}`, {
|
|
363
|
+
source: e,
|
|
364
|
+
positions: [t]
|
|
355
365
|
});
|
|
356
366
|
}
|
|
357
|
-
class
|
|
367
|
+
class lr {
|
|
358
368
|
/**
|
|
359
369
|
* The character offset at which this Node begins.
|
|
360
370
|
*/
|
|
@@ -370,8 +380,8 @@ class $e {
|
|
|
370
380
|
/**
|
|
371
381
|
* The Source document the AST represents.
|
|
372
382
|
*/
|
|
373
|
-
constructor(
|
|
374
|
-
this.start =
|
|
383
|
+
constructor(t, r, i) {
|
|
384
|
+
this.start = t.start, this.end = r.end, this.startToken = t, this.endToken = r, this.source = i;
|
|
375
385
|
}
|
|
376
386
|
get [Symbol.toStringTag]() {
|
|
377
387
|
return "Location";
|
|
@@ -383,7 +393,7 @@ class $e {
|
|
|
383
393
|
};
|
|
384
394
|
}
|
|
385
395
|
}
|
|
386
|
-
class
|
|
396
|
+
class fe {
|
|
387
397
|
/**
|
|
388
398
|
* The kind of Token.
|
|
389
399
|
*/
|
|
@@ -410,8 +420,8 @@ class he {
|
|
|
410
420
|
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
411
421
|
* the last.
|
|
412
422
|
*/
|
|
413
|
-
constructor(
|
|
414
|
-
this.kind =
|
|
423
|
+
constructor(t, r, i, n, s, o) {
|
|
424
|
+
this.kind = t, this.start = r, this.end = i, this.line = n, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
415
425
|
}
|
|
416
426
|
get [Symbol.toStringTag]() {
|
|
417
427
|
return "Token";
|
|
@@ -425,7 +435,7 @@ class he {
|
|
|
425
435
|
};
|
|
426
436
|
}
|
|
427
437
|
}
|
|
428
|
-
const
|
|
438
|
+
const hr = {
|
|
429
439
|
Name: [],
|
|
430
440
|
Document: ["definitions"],
|
|
431
441
|
OperationDefinition: [
|
|
@@ -500,59 +510,59 @@ const Be = {
|
|
|
500
510
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
501
511
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
502
512
|
};
|
|
503
|
-
new Set(Object.keys(
|
|
504
|
-
var
|
|
505
|
-
(function(
|
|
506
|
-
|
|
507
|
-
})(
|
|
508
|
-
var
|
|
509
|
-
(function(
|
|
510
|
-
|
|
511
|
-
})(
|
|
512
|
-
var
|
|
513
|
-
(function(
|
|
514
|
-
|
|
515
|
-
})(
|
|
516
|
-
function
|
|
517
|
-
return
|
|
518
|
-
}
|
|
519
|
-
function
|
|
520
|
-
return
|
|
521
|
-
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
528
|
-
}
|
|
529
|
-
function
|
|
530
|
-
return
|
|
531
|
-
}
|
|
532
|
-
function
|
|
533
|
-
var
|
|
534
|
-
let r = Number.MAX_SAFE_INTEGER,
|
|
535
|
-
for (let
|
|
536
|
-
var
|
|
537
|
-
const
|
|
538
|
-
l !==
|
|
539
|
-
}
|
|
540
|
-
return
|
|
541
|
-
(
|
|
513
|
+
new Set(Object.keys(hr));
|
|
514
|
+
var v;
|
|
515
|
+
(function(e) {
|
|
516
|
+
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
517
|
+
})(v || (v = {}));
|
|
518
|
+
var K;
|
|
519
|
+
(function(e) {
|
|
520
|
+
e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
521
|
+
})(K || (K = {}));
|
|
522
|
+
var u;
|
|
523
|
+
(function(e) {
|
|
524
|
+
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
525
|
+
})(u || (u = {}));
|
|
526
|
+
function Er(e) {
|
|
527
|
+
return e === 9 || e === 32;
|
|
528
|
+
}
|
|
529
|
+
function C(e) {
|
|
530
|
+
return e >= 48 && e <= 57;
|
|
531
|
+
}
|
|
532
|
+
function Ae(e) {
|
|
533
|
+
return e >= 97 && e <= 122 || // A-Z
|
|
534
|
+
e >= 65 && e <= 90;
|
|
535
|
+
}
|
|
536
|
+
function me(e) {
|
|
537
|
+
return Ae(e) || e === 95;
|
|
538
|
+
}
|
|
539
|
+
function Ir(e) {
|
|
540
|
+
return Ae(e) || C(e) || e === 95;
|
|
541
|
+
}
|
|
542
|
+
function pr(e) {
|
|
543
|
+
var t;
|
|
544
|
+
let r = Number.MAX_SAFE_INTEGER, i = null, n = -1;
|
|
545
|
+
for (let o = 0; o < e.length; ++o) {
|
|
546
|
+
var s;
|
|
547
|
+
const c = e[o], l = gr(c);
|
|
548
|
+
l !== c.length && (i = (s = i) !== null && s !== void 0 ? s : o, n = o, o !== 0 && l < r && (r = l));
|
|
549
|
+
}
|
|
550
|
+
return e.map((o, c) => c === 0 ? o : o.slice(r)).slice(
|
|
551
|
+
(t = i) !== null && t !== void 0 ? t : 0,
|
|
542
552
|
n + 1
|
|
543
553
|
);
|
|
544
554
|
}
|
|
545
|
-
function
|
|
546
|
-
let
|
|
547
|
-
for (;
|
|
548
|
-
++
|
|
549
|
-
return
|
|
555
|
+
function gr(e) {
|
|
556
|
+
let t = 0;
|
|
557
|
+
for (; t < e.length && Er(e.charCodeAt(t)); )
|
|
558
|
+
++t;
|
|
559
|
+
return t;
|
|
550
560
|
}
|
|
551
|
-
var
|
|
552
|
-
(function(
|
|
553
|
-
|
|
554
|
-
})(
|
|
555
|
-
class
|
|
561
|
+
var a;
|
|
562
|
+
(function(e) {
|
|
563
|
+
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
564
|
+
})(a || (a = {}));
|
|
565
|
+
class fr {
|
|
556
566
|
/**
|
|
557
567
|
* The previously focused non-ignored token.
|
|
558
568
|
*/
|
|
@@ -565,9 +575,9 @@ class je {
|
|
|
565
575
|
/**
|
|
566
576
|
* The character offset at which the current line begins.
|
|
567
577
|
*/
|
|
568
|
-
constructor(
|
|
569
|
-
const r = new
|
|
570
|
-
this.source =
|
|
578
|
+
constructor(t) {
|
|
579
|
+
const r = new fe(a.SOF, 0, 0, 0, 0);
|
|
580
|
+
this.source = t, this.lastToken = r, this.token = r, this.line = 1, this.lineStart = 0;
|
|
571
581
|
}
|
|
572
582
|
get [Symbol.toStringTag]() {
|
|
573
583
|
return "Lexer";
|
|
@@ -583,54 +593,54 @@ class je {
|
|
|
583
593
|
* the state of Lexer.
|
|
584
594
|
*/
|
|
585
595
|
lookahead() {
|
|
586
|
-
let
|
|
587
|
-
if (
|
|
596
|
+
let t = this.token;
|
|
597
|
+
if (t.kind !== a.EOF)
|
|
588
598
|
do
|
|
589
|
-
if (
|
|
590
|
-
|
|
599
|
+
if (t.next)
|
|
600
|
+
t = t.next;
|
|
591
601
|
else {
|
|
592
|
-
const r =
|
|
593
|
-
|
|
602
|
+
const r = mr(this, t.end);
|
|
603
|
+
t.next = r, r.prev = t, t = r;
|
|
594
604
|
}
|
|
595
|
-
while (
|
|
596
|
-
return
|
|
605
|
+
while (t.kind === a.COMMENT);
|
|
606
|
+
return t;
|
|
597
607
|
}
|
|
598
608
|
}
|
|
599
|
-
function
|
|
600
|
-
return
|
|
609
|
+
function Ar(e) {
|
|
610
|
+
return e === a.BANG || e === a.DOLLAR || e === a.AMP || e === a.PAREN_L || e === a.PAREN_R || e === a.SPREAD || e === a.COLON || e === a.EQUALS || e === a.AT || e === a.BRACKET_L || e === a.BRACKET_R || e === a.BRACE_L || e === a.PIPE || e === a.BRACE_R;
|
|
601
611
|
}
|
|
602
|
-
function
|
|
603
|
-
return
|
|
612
|
+
function L(e) {
|
|
613
|
+
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
604
614
|
}
|
|
605
|
-
function
|
|
606
|
-
return
|
|
615
|
+
function V(e, t) {
|
|
616
|
+
return Oe(e.charCodeAt(t)) && Te(e.charCodeAt(t + 1));
|
|
607
617
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
618
|
+
function Oe(e) {
|
|
619
|
+
return e >= 55296 && e <= 56319;
|
|
610
620
|
}
|
|
611
|
-
function
|
|
612
|
-
return
|
|
621
|
+
function Te(e) {
|
|
622
|
+
return e >= 56320 && e <= 57343;
|
|
613
623
|
}
|
|
614
|
-
function
|
|
615
|
-
const r =
|
|
624
|
+
function R(e, t) {
|
|
625
|
+
const r = e.source.body.codePointAt(t);
|
|
616
626
|
if (r === void 0)
|
|
617
|
-
return
|
|
627
|
+
return a.EOF;
|
|
618
628
|
if (r >= 32 && r <= 126) {
|
|
619
|
-
const
|
|
620
|
-
return
|
|
629
|
+
const i = String.fromCodePoint(r);
|
|
630
|
+
return i === '"' ? `'"'` : `"${i}"`;
|
|
621
631
|
}
|
|
622
632
|
return "U+" + r.toString(16).toUpperCase().padStart(4, "0");
|
|
623
633
|
}
|
|
624
|
-
function
|
|
625
|
-
const
|
|
626
|
-
return new
|
|
634
|
+
function I(e, t, r, i, n) {
|
|
635
|
+
const s = e.line, o = 1 + r - e.lineStart;
|
|
636
|
+
return new fe(t, r, i, s, o, n);
|
|
627
637
|
}
|
|
628
|
-
function
|
|
629
|
-
const r =
|
|
630
|
-
let n =
|
|
631
|
-
for (; n <
|
|
632
|
-
const
|
|
633
|
-
switch (
|
|
638
|
+
function mr(e, t) {
|
|
639
|
+
const r = e.source.body, i = r.length;
|
|
640
|
+
let n = t;
|
|
641
|
+
for (; n < i; ) {
|
|
642
|
+
const s = r.charCodeAt(n);
|
|
643
|
+
switch (s) {
|
|
634
644
|
// Ignored ::
|
|
635
645
|
// - UnicodeBOM
|
|
636
646
|
// - WhiteSpace
|
|
@@ -659,14 +669,14 @@ function Ye(t, e) {
|
|
|
659
669
|
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
660
670
|
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
661
671
|
case 10:
|
|
662
|
-
++n, ++
|
|
672
|
+
++n, ++e.line, e.lineStart = n;
|
|
663
673
|
continue;
|
|
664
674
|
case 13:
|
|
665
|
-
r.charCodeAt(n + 1) === 10 ? n += 2 : ++n, ++
|
|
675
|
+
r.charCodeAt(n + 1) === 10 ? n += 2 : ++n, ++e.line, e.lineStart = n;
|
|
666
676
|
continue;
|
|
667
677
|
// Comment
|
|
668
678
|
case 35:
|
|
669
|
-
return
|
|
679
|
+
return Or(e, n);
|
|
670
680
|
// Token ::
|
|
671
681
|
// - Punctuator
|
|
672
682
|
// - Name
|
|
@@ -676,207 +686,207 @@ function Ye(t, e) {
|
|
|
676
686
|
//
|
|
677
687
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
678
688
|
case 33:
|
|
679
|
-
return
|
|
689
|
+
return I(e, a.BANG, n, n + 1);
|
|
680
690
|
case 36:
|
|
681
|
-
return
|
|
691
|
+
return I(e, a.DOLLAR, n, n + 1);
|
|
682
692
|
case 38:
|
|
683
|
-
return
|
|
693
|
+
return I(e, a.AMP, n, n + 1);
|
|
684
694
|
case 40:
|
|
685
|
-
return
|
|
695
|
+
return I(e, a.PAREN_L, n, n + 1);
|
|
686
696
|
case 41:
|
|
687
|
-
return
|
|
697
|
+
return I(e, a.PAREN_R, n, n + 1);
|
|
688
698
|
case 46:
|
|
689
699
|
if (r.charCodeAt(n + 1) === 46 && r.charCodeAt(n + 2) === 46)
|
|
690
|
-
return
|
|
700
|
+
return I(e, a.SPREAD, n, n + 3);
|
|
691
701
|
break;
|
|
692
702
|
case 58:
|
|
693
|
-
return
|
|
703
|
+
return I(e, a.COLON, n, n + 1);
|
|
694
704
|
case 61:
|
|
695
|
-
return
|
|
705
|
+
return I(e, a.EQUALS, n, n + 1);
|
|
696
706
|
case 64:
|
|
697
|
-
return
|
|
707
|
+
return I(e, a.AT, n, n + 1);
|
|
698
708
|
case 91:
|
|
699
|
-
return
|
|
709
|
+
return I(e, a.BRACKET_L, n, n + 1);
|
|
700
710
|
case 93:
|
|
701
|
-
return
|
|
711
|
+
return I(e, a.BRACKET_R, n, n + 1);
|
|
702
712
|
case 123:
|
|
703
|
-
return
|
|
713
|
+
return I(e, a.BRACE_L, n, n + 1);
|
|
704
714
|
case 124:
|
|
705
|
-
return
|
|
715
|
+
return I(e, a.PIPE, n, n + 1);
|
|
706
716
|
case 125:
|
|
707
|
-
return
|
|
717
|
+
return I(e, a.BRACE_R, n, n + 1);
|
|
708
718
|
// StringValue
|
|
709
719
|
case 34:
|
|
710
|
-
return r.charCodeAt(n + 1) === 34 && r.charCodeAt(n + 2) === 34 ?
|
|
720
|
+
return r.charCodeAt(n + 1) === 34 && r.charCodeAt(n + 2) === 34 ? vr(e, n) : Nr(e, n);
|
|
711
721
|
}
|
|
712
|
-
if (
|
|
713
|
-
return
|
|
714
|
-
if (
|
|
715
|
-
return
|
|
716
|
-
throw
|
|
717
|
-
|
|
722
|
+
if (C(s) || s === 45)
|
|
723
|
+
return Tr(e, n, s);
|
|
724
|
+
if (me(s))
|
|
725
|
+
return Lr(e, n);
|
|
726
|
+
throw g(
|
|
727
|
+
e.source,
|
|
718
728
|
n,
|
|
719
|
-
|
|
729
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : L(s) || V(r, n) ? `Unexpected character: ${R(e, n)}.` : `Invalid character: ${R(e, n)}.`
|
|
720
730
|
);
|
|
721
731
|
}
|
|
722
|
-
return
|
|
732
|
+
return I(e, a.EOF, i, i);
|
|
723
733
|
}
|
|
724
|
-
function
|
|
725
|
-
const r =
|
|
726
|
-
let n =
|
|
727
|
-
for (; n <
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
734
|
+
function Or(e, t) {
|
|
735
|
+
const r = e.source.body, i = r.length;
|
|
736
|
+
let n = t + 1;
|
|
737
|
+
for (; n < i; ) {
|
|
738
|
+
const s = r.charCodeAt(n);
|
|
739
|
+
if (s === 10 || s === 13)
|
|
730
740
|
break;
|
|
731
|
-
if (
|
|
741
|
+
if (L(s))
|
|
732
742
|
++n;
|
|
733
|
-
else if (
|
|
743
|
+
else if (V(r, n))
|
|
734
744
|
n += 2;
|
|
735
745
|
else
|
|
736
746
|
break;
|
|
737
747
|
}
|
|
738
|
-
return
|
|
739
|
-
t,
|
|
740
|
-
o.COMMENT,
|
|
748
|
+
return I(
|
|
741
749
|
e,
|
|
750
|
+
a.COMMENT,
|
|
751
|
+
t,
|
|
742
752
|
n,
|
|
743
|
-
r.slice(
|
|
753
|
+
r.slice(t + 1, n)
|
|
744
754
|
);
|
|
745
755
|
}
|
|
746
|
-
function
|
|
747
|
-
const
|
|
748
|
-
let n =
|
|
749
|
-
if (
|
|
750
|
-
if (
|
|
751
|
-
throw
|
|
752
|
-
|
|
756
|
+
function Tr(e, t, r) {
|
|
757
|
+
const i = e.source.body;
|
|
758
|
+
let n = t, s = r, o = !1;
|
|
759
|
+
if (s === 45 && (s = i.charCodeAt(++n)), s === 48) {
|
|
760
|
+
if (s = i.charCodeAt(++n), C(s))
|
|
761
|
+
throw g(
|
|
762
|
+
e.source,
|
|
753
763
|
n,
|
|
754
|
-
`Invalid number, unexpected digit after 0: ${
|
|
755
|
-
|
|
764
|
+
`Invalid number, unexpected digit after 0: ${R(
|
|
765
|
+
e,
|
|
756
766
|
n
|
|
757
767
|
)}.`
|
|
758
768
|
);
|
|
759
769
|
} else
|
|
760
|
-
n =
|
|
761
|
-
if (
|
|
762
|
-
throw
|
|
763
|
-
|
|
770
|
+
n = $(e, n, s), s = i.charCodeAt(n);
|
|
771
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++n), n = $(e, n, s), s = i.charCodeAt(n)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++n), (s === 43 || s === 45) && (s = i.charCodeAt(++n)), n = $(e, n, s), s = i.charCodeAt(n)), s === 46 || me(s))
|
|
772
|
+
throw g(
|
|
773
|
+
e.source,
|
|
764
774
|
n,
|
|
765
|
-
`Invalid number, expected digit but got: ${
|
|
766
|
-
|
|
775
|
+
`Invalid number, expected digit but got: ${R(
|
|
776
|
+
e,
|
|
767
777
|
n
|
|
768
778
|
)}.`
|
|
769
779
|
);
|
|
770
|
-
return
|
|
771
|
-
t,
|
|
772
|
-
a ? o.FLOAT : o.INT,
|
|
780
|
+
return I(
|
|
773
781
|
e,
|
|
782
|
+
o ? a.FLOAT : a.INT,
|
|
783
|
+
t,
|
|
774
784
|
n,
|
|
775
|
-
|
|
785
|
+
i.slice(t, n)
|
|
776
786
|
);
|
|
777
787
|
}
|
|
778
|
-
function
|
|
779
|
-
if (!
|
|
780
|
-
throw
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
`Invalid number, expected digit but got: ${
|
|
784
|
-
|
|
785
|
-
|
|
788
|
+
function $(e, t, r) {
|
|
789
|
+
if (!C(r))
|
|
790
|
+
throw g(
|
|
791
|
+
e.source,
|
|
792
|
+
t,
|
|
793
|
+
`Invalid number, expected digit but got: ${R(
|
|
794
|
+
e,
|
|
795
|
+
t
|
|
786
796
|
)}.`
|
|
787
797
|
);
|
|
788
|
-
const
|
|
789
|
-
let n =
|
|
790
|
-
for (;
|
|
798
|
+
const i = e.source.body;
|
|
799
|
+
let n = t + 1;
|
|
800
|
+
for (; C(i.charCodeAt(n)); )
|
|
791
801
|
++n;
|
|
792
802
|
return n;
|
|
793
803
|
}
|
|
794
|
-
function
|
|
795
|
-
const r =
|
|
796
|
-
let n =
|
|
797
|
-
for (; n <
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
return
|
|
801
|
-
if (
|
|
802
|
-
|
|
803
|
-
const l = r.charCodeAt(n + 1) === 117 ? r.charCodeAt(n + 2) === 123 ?
|
|
804
|
-
|
|
804
|
+
function Nr(e, t) {
|
|
805
|
+
const r = e.source.body, i = r.length;
|
|
806
|
+
let n = t + 1, s = n, o = "";
|
|
807
|
+
for (; n < i; ) {
|
|
808
|
+
const c = r.charCodeAt(n);
|
|
809
|
+
if (c === 34)
|
|
810
|
+
return o += r.slice(s, n), I(e, a.STRING, t, n + 1, o);
|
|
811
|
+
if (c === 92) {
|
|
812
|
+
o += r.slice(s, n);
|
|
813
|
+
const l = r.charCodeAt(n + 1) === 117 ? r.charCodeAt(n + 2) === 123 ? Dr(e, n) : _r(e, n) : Rr(e, n);
|
|
814
|
+
o += l.value, n += l.size, s = n;
|
|
805
815
|
continue;
|
|
806
816
|
}
|
|
807
|
-
if (
|
|
817
|
+
if (c === 10 || c === 13)
|
|
808
818
|
break;
|
|
809
|
-
if (
|
|
819
|
+
if (L(c))
|
|
810
820
|
++n;
|
|
811
|
-
else if (
|
|
821
|
+
else if (V(r, n))
|
|
812
822
|
n += 2;
|
|
813
823
|
else
|
|
814
|
-
throw
|
|
815
|
-
|
|
824
|
+
throw g(
|
|
825
|
+
e.source,
|
|
816
826
|
n,
|
|
817
|
-
`Invalid character within String: ${
|
|
818
|
-
|
|
827
|
+
`Invalid character within String: ${R(
|
|
828
|
+
e,
|
|
819
829
|
n
|
|
820
830
|
)}.`
|
|
821
831
|
);
|
|
822
832
|
}
|
|
823
|
-
throw
|
|
833
|
+
throw g(e.source, n, "Unterminated string.");
|
|
824
834
|
}
|
|
825
|
-
function
|
|
826
|
-
const r =
|
|
827
|
-
let
|
|
835
|
+
function Dr(e, t) {
|
|
836
|
+
const r = e.source.body;
|
|
837
|
+
let i = 0, n = 3;
|
|
828
838
|
for (; n < 12; ) {
|
|
829
|
-
const
|
|
830
|
-
if (
|
|
831
|
-
if (n < 5 || !
|
|
839
|
+
const s = r.charCodeAt(t + n++);
|
|
840
|
+
if (s === 125) {
|
|
841
|
+
if (n < 5 || !L(i))
|
|
832
842
|
break;
|
|
833
843
|
return {
|
|
834
|
-
value: String.fromCodePoint(
|
|
844
|
+
value: String.fromCodePoint(i),
|
|
835
845
|
size: n
|
|
836
846
|
};
|
|
837
847
|
}
|
|
838
|
-
if (
|
|
848
|
+
if (i = i << 4 | k(s), i < 0)
|
|
839
849
|
break;
|
|
840
850
|
}
|
|
841
|
-
throw
|
|
842
|
-
|
|
843
|
-
|
|
851
|
+
throw g(
|
|
852
|
+
e.source,
|
|
853
|
+
t,
|
|
844
854
|
`Invalid Unicode escape sequence: "${r.slice(
|
|
845
|
-
|
|
846
|
-
|
|
855
|
+
t,
|
|
856
|
+
t + n
|
|
847
857
|
)}".`
|
|
848
858
|
);
|
|
849
859
|
}
|
|
850
|
-
function
|
|
851
|
-
const r =
|
|
852
|
-
if (
|
|
860
|
+
function _r(e, t) {
|
|
861
|
+
const r = e.source.body, i = de(r, t + 2);
|
|
862
|
+
if (L(i))
|
|
853
863
|
return {
|
|
854
|
-
value: String.fromCodePoint(
|
|
864
|
+
value: String.fromCodePoint(i),
|
|
855
865
|
size: 6
|
|
856
866
|
};
|
|
857
|
-
if (
|
|
858
|
-
const n =
|
|
859
|
-
if (
|
|
867
|
+
if (Oe(i) && r.charCodeAt(t + 6) === 92 && r.charCodeAt(t + 7) === 117) {
|
|
868
|
+
const n = de(r, t + 8);
|
|
869
|
+
if (Te(n))
|
|
860
870
|
return {
|
|
861
|
-
value: String.fromCodePoint(
|
|
871
|
+
value: String.fromCodePoint(i, n),
|
|
862
872
|
size: 12
|
|
863
873
|
};
|
|
864
874
|
}
|
|
865
|
-
throw
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
`Invalid Unicode escape sequence: "${r.slice(
|
|
875
|
+
throw g(
|
|
876
|
+
e.source,
|
|
877
|
+
t,
|
|
878
|
+
`Invalid Unicode escape sequence: "${r.slice(t, t + 6)}".`
|
|
869
879
|
);
|
|
870
880
|
}
|
|
871
|
-
function
|
|
872
|
-
return
|
|
881
|
+
function de(e, t) {
|
|
882
|
+
return k(e.charCodeAt(t)) << 12 | k(e.charCodeAt(t + 1)) << 8 | k(e.charCodeAt(t + 2)) << 4 | k(e.charCodeAt(t + 3));
|
|
873
883
|
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
884
|
+
function k(e) {
|
|
885
|
+
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
876
886
|
}
|
|
877
|
-
function
|
|
878
|
-
const r =
|
|
879
|
-
switch (r.charCodeAt(
|
|
887
|
+
function Rr(e, t) {
|
|
888
|
+
const r = e.source.body;
|
|
889
|
+
switch (r.charCodeAt(t + 1)) {
|
|
880
890
|
case 34:
|
|
881
891
|
return {
|
|
882
892
|
value: '"',
|
|
@@ -919,152 +929,152 @@ function Ke(t, e) {
|
|
|
919
929
|
size: 2
|
|
920
930
|
};
|
|
921
931
|
}
|
|
922
|
-
throw
|
|
923
|
-
|
|
924
|
-
|
|
932
|
+
throw g(
|
|
933
|
+
e.source,
|
|
934
|
+
t,
|
|
925
935
|
`Invalid character escape sequence: "${r.slice(
|
|
926
|
-
|
|
927
|
-
|
|
936
|
+
t,
|
|
937
|
+
t + 2
|
|
928
938
|
)}".`
|
|
929
939
|
);
|
|
930
940
|
}
|
|
931
|
-
function
|
|
932
|
-
const r =
|
|
933
|
-
let n =
|
|
941
|
+
function vr(e, t) {
|
|
942
|
+
const r = e.source.body, i = r.length;
|
|
943
|
+
let n = e.lineStart, s = t + 3, o = s, c = "";
|
|
934
944
|
const l = [];
|
|
935
|
-
for (;
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
|
|
939
|
-
const
|
|
940
|
-
t,
|
|
941
|
-
o.BLOCK_STRING,
|
|
945
|
+
for (; s < i; ) {
|
|
946
|
+
const h = r.charCodeAt(s);
|
|
947
|
+
if (h === 34 && r.charCodeAt(s + 1) === 34 && r.charCodeAt(s + 2) === 34) {
|
|
948
|
+
c += r.slice(o, s), l.push(c);
|
|
949
|
+
const d = I(
|
|
942
950
|
e,
|
|
943
|
-
|
|
951
|
+
a.BLOCK_STRING,
|
|
952
|
+
t,
|
|
953
|
+
s + 3,
|
|
944
954
|
// Return a string of the lines joined with U+000A.
|
|
945
|
-
|
|
955
|
+
pr(l).join(`
|
|
946
956
|
`)
|
|
947
957
|
);
|
|
948
|
-
return
|
|
958
|
+
return e.line += l.length - 1, e.lineStart = n, d;
|
|
949
959
|
}
|
|
950
|
-
if (
|
|
951
|
-
|
|
960
|
+
if (h === 92 && r.charCodeAt(s + 1) === 34 && r.charCodeAt(s + 2) === 34 && r.charCodeAt(s + 3) === 34) {
|
|
961
|
+
c += r.slice(o, s), o = s + 1, s += 4;
|
|
952
962
|
continue;
|
|
953
963
|
}
|
|
954
|
-
if (
|
|
955
|
-
|
|
964
|
+
if (h === 10 || h === 13) {
|
|
965
|
+
c += r.slice(o, s), l.push(c), h === 13 && r.charCodeAt(s + 1) === 10 ? s += 2 : ++s, c = "", o = s, n = s;
|
|
956
966
|
continue;
|
|
957
967
|
}
|
|
958
|
-
if (
|
|
959
|
-
++
|
|
960
|
-
else if (
|
|
961
|
-
|
|
968
|
+
if (L(h))
|
|
969
|
+
++s;
|
|
970
|
+
else if (V(r, s))
|
|
971
|
+
s += 2;
|
|
962
972
|
else
|
|
963
|
-
throw
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
`Invalid character within String: ${
|
|
967
|
-
|
|
968
|
-
|
|
973
|
+
throw g(
|
|
974
|
+
e.source,
|
|
975
|
+
s,
|
|
976
|
+
`Invalid character within String: ${R(
|
|
977
|
+
e,
|
|
978
|
+
s
|
|
969
979
|
)}.`
|
|
970
980
|
);
|
|
971
981
|
}
|
|
972
|
-
throw
|
|
982
|
+
throw g(e.source, s, "Unterminated string.");
|
|
973
983
|
}
|
|
974
|
-
function
|
|
975
|
-
const r =
|
|
976
|
-
let n =
|
|
977
|
-
for (; n <
|
|
978
|
-
const
|
|
979
|
-
if (
|
|
984
|
+
function Lr(e, t) {
|
|
985
|
+
const r = e.source.body, i = r.length;
|
|
986
|
+
let n = t + 1;
|
|
987
|
+
for (; n < i; ) {
|
|
988
|
+
const s = r.charCodeAt(n);
|
|
989
|
+
if (Ir(s))
|
|
980
990
|
++n;
|
|
981
991
|
else
|
|
982
992
|
break;
|
|
983
993
|
}
|
|
984
|
-
return
|
|
985
|
-
t,
|
|
986
|
-
o.NAME,
|
|
994
|
+
return I(
|
|
987
995
|
e,
|
|
996
|
+
a.NAME,
|
|
997
|
+
t,
|
|
988
998
|
n,
|
|
989
|
-
r.slice(
|
|
999
|
+
r.slice(t, n)
|
|
990
1000
|
);
|
|
991
1001
|
}
|
|
992
|
-
const
|
|
993
|
-
function
|
|
994
|
-
return w(
|
|
1002
|
+
const Pr = 10, Ne = 2;
|
|
1003
|
+
function De(e) {
|
|
1004
|
+
return w(e, []);
|
|
995
1005
|
}
|
|
996
|
-
function w(
|
|
997
|
-
switch (typeof
|
|
1006
|
+
function w(e, t) {
|
|
1007
|
+
switch (typeof e) {
|
|
998
1008
|
case "string":
|
|
999
|
-
return JSON.stringify(
|
|
1009
|
+
return JSON.stringify(e);
|
|
1000
1010
|
case "function":
|
|
1001
|
-
return
|
|
1011
|
+
return e.name ? `[function ${e.name}]` : "[function]";
|
|
1002
1012
|
case "object":
|
|
1003
|
-
return
|
|
1013
|
+
return kr(e, t);
|
|
1004
1014
|
default:
|
|
1005
|
-
return String(
|
|
1015
|
+
return String(e);
|
|
1006
1016
|
}
|
|
1007
1017
|
}
|
|
1008
|
-
function
|
|
1009
|
-
if (
|
|
1018
|
+
function kr(e, t) {
|
|
1019
|
+
if (e === null)
|
|
1010
1020
|
return "null";
|
|
1011
|
-
if (
|
|
1021
|
+
if (t.includes(e))
|
|
1012
1022
|
return "[Circular]";
|
|
1013
|
-
const r = [...
|
|
1014
|
-
if (
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1017
|
-
return typeof
|
|
1018
|
-
} else if (Array.isArray(
|
|
1019
|
-
return
|
|
1020
|
-
return
|
|
1021
|
-
}
|
|
1022
|
-
function
|
|
1023
|
-
return typeof
|
|
1024
|
-
}
|
|
1025
|
-
function
|
|
1026
|
-
const r = Object.entries(
|
|
1027
|
-
return r.length === 0 ? "{}" :
|
|
1028
|
-
([n,
|
|
1023
|
+
const r = [...t, e];
|
|
1024
|
+
if (Cr(e)) {
|
|
1025
|
+
const i = e.toJSON();
|
|
1026
|
+
if (i !== e)
|
|
1027
|
+
return typeof i == "string" ? i : w(i, r);
|
|
1028
|
+
} else if (Array.isArray(e))
|
|
1029
|
+
return xr(e, r);
|
|
1030
|
+
return Sr(e, r);
|
|
1031
|
+
}
|
|
1032
|
+
function Cr(e) {
|
|
1033
|
+
return typeof e.toJSON == "function";
|
|
1034
|
+
}
|
|
1035
|
+
function Sr(e, t) {
|
|
1036
|
+
const r = Object.entries(e);
|
|
1037
|
+
return r.length === 0 ? "{}" : t.length > Ne ? "[" + br(e) + "]" : "{ " + r.map(
|
|
1038
|
+
([n, s]) => n + ": " + w(s, t)
|
|
1029
1039
|
).join(", ") + " }";
|
|
1030
1040
|
}
|
|
1031
|
-
function
|
|
1032
|
-
if (
|
|
1041
|
+
function xr(e, t) {
|
|
1042
|
+
if (e.length === 0)
|
|
1033
1043
|
return "[]";
|
|
1034
|
-
if (
|
|
1044
|
+
if (t.length > Ne)
|
|
1035
1045
|
return "[Array]";
|
|
1036
|
-
const r = Math.min(
|
|
1037
|
-
for (let
|
|
1038
|
-
n.push(w(
|
|
1039
|
-
return
|
|
1040
|
-
}
|
|
1041
|
-
function
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1044
|
-
const r =
|
|
1046
|
+
const r = Math.min(Pr, e.length), i = e.length - r, n = [];
|
|
1047
|
+
for (let s = 0; s < r; ++s)
|
|
1048
|
+
n.push(w(e[s], t));
|
|
1049
|
+
return i === 1 ? n.push("... 1 more item") : i > 1 && n.push(`... ${i} more items`), "[" + n.join(", ") + "]";
|
|
1050
|
+
}
|
|
1051
|
+
function br(e) {
|
|
1052
|
+
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
1053
|
+
if (t === "Object" && typeof e.constructor == "function") {
|
|
1054
|
+
const r = e.constructor.name;
|
|
1045
1055
|
if (typeof r == "string" && r !== "")
|
|
1046
1056
|
return r;
|
|
1047
1057
|
}
|
|
1048
|
-
return
|
|
1058
|
+
return t;
|
|
1049
1059
|
}
|
|
1050
|
-
const
|
|
1051
|
-
process.env.NODE_ENV === "production",
|
|
1060
|
+
const Fr = globalThis.process && // eslint-disable-next-line no-undef
|
|
1061
|
+
process.env.NODE_ENV === "production", yr = (
|
|
1052
1062
|
/* c8 ignore next 6 */
|
|
1053
1063
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
1054
|
-
|
|
1055
|
-
return
|
|
1056
|
-
} : function(
|
|
1057
|
-
if (
|
|
1064
|
+
Fr ? function(t, r) {
|
|
1065
|
+
return t instanceof r;
|
|
1066
|
+
} : function(t, r) {
|
|
1067
|
+
if (t instanceof r)
|
|
1058
1068
|
return !0;
|
|
1059
|
-
if (typeof
|
|
1060
|
-
var
|
|
1061
|
-
const n = r.prototype[Symbol.toStringTag],
|
|
1069
|
+
if (typeof t == "object" && t !== null) {
|
|
1070
|
+
var i;
|
|
1071
|
+
const n = r.prototype[Symbol.toStringTag], s = (
|
|
1062
1072
|
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
1063
|
-
Symbol.toStringTag in
|
|
1073
|
+
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
|
|
1064
1074
|
);
|
|
1065
|
-
if (n ===
|
|
1066
|
-
const
|
|
1067
|
-
throw new Error(`Cannot use ${n} "${
|
|
1075
|
+
if (n === s) {
|
|
1076
|
+
const o = De(t);
|
|
1077
|
+
throw new Error(`Cannot use ${n} "${o}" from another module or realm.
|
|
1068
1078
|
|
|
1069
1079
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
1070
1080
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -1081,15 +1091,15 @@ spurious results.`);
|
|
|
1081
1091
|
return !1;
|
|
1082
1092
|
}
|
|
1083
1093
|
);
|
|
1084
|
-
class
|
|
1085
|
-
constructor(
|
|
1094
|
+
class _e {
|
|
1095
|
+
constructor(t, r = "GraphQL request", i = {
|
|
1086
1096
|
line: 1,
|
|
1087
1097
|
column: 1
|
|
1088
1098
|
}) {
|
|
1089
|
-
typeof
|
|
1099
|
+
typeof t == "string" || G(!1, `Body must be a string. Received: ${De(t)}.`), this.body = t, this.name = r, this.locationOffset = i, this.locationOffset.line > 0 || G(
|
|
1090
1100
|
!1,
|
|
1091
1101
|
"line in locationOffset is 1-indexed and must be positive."
|
|
1092
|
-
), this.locationOffset.column > 0 ||
|
|
1102
|
+
), this.locationOffset.column > 0 || G(
|
|
1093
1103
|
!1,
|
|
1094
1104
|
"column in locationOffset is 1-indexed and must be positive."
|
|
1095
1105
|
);
|
|
@@ -1098,20 +1108,20 @@ class ye {
|
|
|
1098
1108
|
return "Source";
|
|
1099
1109
|
}
|
|
1100
1110
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return
|
|
1111
|
+
function Ur(e) {
|
|
1112
|
+
return yr(e, _e);
|
|
1103
1113
|
}
|
|
1104
|
-
function
|
|
1105
|
-
const r = new
|
|
1106
|
-
return Object.defineProperty(
|
|
1114
|
+
function Mr(e, t) {
|
|
1115
|
+
const r = new Vr(e, t), i = r.parseDocument();
|
|
1116
|
+
return Object.defineProperty(i, "tokenCount", {
|
|
1107
1117
|
enumerable: !1,
|
|
1108
1118
|
value: r.tokenCount
|
|
1109
|
-
}),
|
|
1119
|
+
}), i;
|
|
1110
1120
|
}
|
|
1111
|
-
class
|
|
1112
|
-
constructor(
|
|
1113
|
-
const
|
|
1114
|
-
this._lexer = new
|
|
1121
|
+
class Vr {
|
|
1122
|
+
constructor(t, r = {}) {
|
|
1123
|
+
const i = Ur(t) ? t : new _e(t);
|
|
1124
|
+
this._lexer = new fr(i), this._options = r, this._tokenCounter = 0;
|
|
1115
1125
|
}
|
|
1116
1126
|
get tokenCount() {
|
|
1117
1127
|
return this._tokenCounter;
|
|
@@ -1120,10 +1130,10 @@ class ut {
|
|
|
1120
1130
|
* Converts a name lex token into a name parse node.
|
|
1121
1131
|
*/
|
|
1122
1132
|
parseName() {
|
|
1123
|
-
const
|
|
1124
|
-
return this.node(
|
|
1125
|
-
kind:
|
|
1126
|
-
value:
|
|
1133
|
+
const t = this.expectToken(a.NAME);
|
|
1134
|
+
return this.node(t, {
|
|
1135
|
+
kind: u.NAME,
|
|
1136
|
+
value: t.value
|
|
1127
1137
|
});
|
|
1128
1138
|
}
|
|
1129
1139
|
// Implements the parsing rules in the Document section.
|
|
@@ -1132,11 +1142,11 @@ class ut {
|
|
|
1132
1142
|
*/
|
|
1133
1143
|
parseDocument() {
|
|
1134
1144
|
return this.node(this._lexer.token, {
|
|
1135
|
-
kind:
|
|
1145
|
+
kind: u.DOCUMENT,
|
|
1136
1146
|
definitions: this.many(
|
|
1137
|
-
|
|
1147
|
+
a.SOF,
|
|
1138
1148
|
this.parseDefinition,
|
|
1139
|
-
|
|
1149
|
+
a.EOF
|
|
1140
1150
|
)
|
|
1141
1151
|
});
|
|
1142
1152
|
}
|
|
@@ -1164,10 +1174,10 @@ class ut {
|
|
|
1164
1174
|
* - InputObjectTypeDefinition
|
|
1165
1175
|
*/
|
|
1166
1176
|
parseDefinition() {
|
|
1167
|
-
if (this.peek(
|
|
1177
|
+
if (this.peek(a.BRACE_L))
|
|
1168
1178
|
return this.parseOperationDefinition();
|
|
1169
|
-
const
|
|
1170
|
-
if (r.kind ===
|
|
1179
|
+
const t = this.peekDescription(), r = t ? this._lexer.lookahead() : this._lexer.token;
|
|
1180
|
+
if (r.kind === a.NAME) {
|
|
1171
1181
|
switch (r.value) {
|
|
1172
1182
|
case "schema":
|
|
1173
1183
|
return this.parseSchemaDefinition();
|
|
@@ -1186,8 +1196,8 @@ class ut {
|
|
|
1186
1196
|
case "directive":
|
|
1187
1197
|
return this.parseDirectiveDefinition();
|
|
1188
1198
|
}
|
|
1189
|
-
if (
|
|
1190
|
-
throw
|
|
1199
|
+
if (t)
|
|
1200
|
+
throw g(
|
|
1191
1201
|
this._lexer.source,
|
|
1192
1202
|
this._lexer.token.start,
|
|
1193
1203
|
"Unexpected description, descriptions are supported only on type definitions."
|
|
@@ -1212,22 +1222,22 @@ class ut {
|
|
|
1212
1222
|
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1213
1223
|
*/
|
|
1214
1224
|
parseOperationDefinition() {
|
|
1215
|
-
const
|
|
1216
|
-
if (this.peek(
|
|
1217
|
-
return this.node(
|
|
1218
|
-
kind:
|
|
1219
|
-
operation:
|
|
1225
|
+
const t = this._lexer.token;
|
|
1226
|
+
if (this.peek(a.BRACE_L))
|
|
1227
|
+
return this.node(t, {
|
|
1228
|
+
kind: u.OPERATION_DEFINITION,
|
|
1229
|
+
operation: v.QUERY,
|
|
1220
1230
|
name: void 0,
|
|
1221
1231
|
variableDefinitions: [],
|
|
1222
1232
|
directives: [],
|
|
1223
1233
|
selectionSet: this.parseSelectionSet()
|
|
1224
1234
|
});
|
|
1225
1235
|
const r = this.parseOperationType();
|
|
1226
|
-
let
|
|
1227
|
-
return this.peek(
|
|
1228
|
-
kind:
|
|
1236
|
+
let i;
|
|
1237
|
+
return this.peek(a.NAME) && (i = this.parseName()), this.node(t, {
|
|
1238
|
+
kind: u.OPERATION_DEFINITION,
|
|
1229
1239
|
operation: r,
|
|
1230
|
-
name:
|
|
1240
|
+
name: i,
|
|
1231
1241
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1232
1242
|
directives: this.parseDirectives(!1),
|
|
1233
1243
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1237,25 +1247,25 @@ class ut {
|
|
|
1237
1247
|
* OperationType : one of query mutation subscription
|
|
1238
1248
|
*/
|
|
1239
1249
|
parseOperationType() {
|
|
1240
|
-
const
|
|
1241
|
-
switch (
|
|
1250
|
+
const t = this.expectToken(a.NAME);
|
|
1251
|
+
switch (t.value) {
|
|
1242
1252
|
case "query":
|
|
1243
|
-
return
|
|
1253
|
+
return v.QUERY;
|
|
1244
1254
|
case "mutation":
|
|
1245
|
-
return
|
|
1255
|
+
return v.MUTATION;
|
|
1246
1256
|
case "subscription":
|
|
1247
|
-
return
|
|
1257
|
+
return v.SUBSCRIPTION;
|
|
1248
1258
|
}
|
|
1249
|
-
throw this.unexpected(
|
|
1259
|
+
throw this.unexpected(t);
|
|
1250
1260
|
}
|
|
1251
1261
|
/**
|
|
1252
1262
|
* VariableDefinitions : ( VariableDefinition+ )
|
|
1253
1263
|
*/
|
|
1254
1264
|
parseVariableDefinitions() {
|
|
1255
1265
|
return this.optionalMany(
|
|
1256
|
-
|
|
1266
|
+
a.PAREN_L,
|
|
1257
1267
|
this.parseVariableDefinition,
|
|
1258
|
-
|
|
1268
|
+
a.PAREN_R
|
|
1259
1269
|
);
|
|
1260
1270
|
}
|
|
1261
1271
|
/**
|
|
@@ -1263,10 +1273,10 @@ class ut {
|
|
|
1263
1273
|
*/
|
|
1264
1274
|
parseVariableDefinition() {
|
|
1265
1275
|
return this.node(this._lexer.token, {
|
|
1266
|
-
kind:
|
|
1276
|
+
kind: u.VARIABLE_DEFINITION,
|
|
1267
1277
|
variable: this.parseVariable(),
|
|
1268
|
-
type: (this.expectToken(
|
|
1269
|
-
defaultValue: this.expectOptionalToken(
|
|
1278
|
+
type: (this.expectToken(a.COLON), this.parseTypeReference()),
|
|
1279
|
+
defaultValue: this.expectOptionalToken(a.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
1270
1280
|
directives: this.parseConstDirectives()
|
|
1271
1281
|
});
|
|
1272
1282
|
}
|
|
@@ -1274,9 +1284,9 @@ class ut {
|
|
|
1274
1284
|
* Variable : $ Name
|
|
1275
1285
|
*/
|
|
1276
1286
|
parseVariable() {
|
|
1277
|
-
const
|
|
1278
|
-
return this.expectToken(
|
|
1279
|
-
kind:
|
|
1287
|
+
const t = this._lexer.token;
|
|
1288
|
+
return this.expectToken(a.DOLLAR), this.node(t, {
|
|
1289
|
+
kind: u.VARIABLE,
|
|
1280
1290
|
name: this.parseName()
|
|
1281
1291
|
});
|
|
1282
1292
|
}
|
|
@@ -1287,11 +1297,11 @@ class ut {
|
|
|
1287
1297
|
*/
|
|
1288
1298
|
parseSelectionSet() {
|
|
1289
1299
|
return this.node(this._lexer.token, {
|
|
1290
|
-
kind:
|
|
1300
|
+
kind: u.SELECTION_SET,
|
|
1291
1301
|
selections: this.many(
|
|
1292
|
-
|
|
1302
|
+
a.BRACE_L,
|
|
1293
1303
|
this.parseSelection,
|
|
1294
|
-
|
|
1304
|
+
a.BRACE_R
|
|
1295
1305
|
)
|
|
1296
1306
|
});
|
|
1297
1307
|
}
|
|
@@ -1302,7 +1312,7 @@ class ut {
|
|
|
1302
1312
|
* - InlineFragment
|
|
1303
1313
|
*/
|
|
1304
1314
|
parseSelection() {
|
|
1305
|
-
return this.peek(
|
|
1315
|
+
return this.peek(a.SPREAD) ? this.parseFragment() : this.parseField();
|
|
1306
1316
|
}
|
|
1307
1317
|
/**
|
|
1308
1318
|
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
@@ -1310,33 +1320,33 @@ class ut {
|
|
|
1310
1320
|
* Alias : Name :
|
|
1311
1321
|
*/
|
|
1312
1322
|
parseField() {
|
|
1313
|
-
const
|
|
1314
|
-
let
|
|
1315
|
-
return this.expectOptionalToken(
|
|
1316
|
-
kind:
|
|
1317
|
-
alias:
|
|
1323
|
+
const t = this._lexer.token, r = this.parseName();
|
|
1324
|
+
let i, n;
|
|
1325
|
+
return this.expectOptionalToken(a.COLON) ? (i = r, n = this.parseName()) : n = r, this.node(t, {
|
|
1326
|
+
kind: u.FIELD,
|
|
1327
|
+
alias: i,
|
|
1318
1328
|
name: n,
|
|
1319
1329
|
arguments: this.parseArguments(!1),
|
|
1320
1330
|
directives: this.parseDirectives(!1),
|
|
1321
|
-
selectionSet: this.peek(
|
|
1331
|
+
selectionSet: this.peek(a.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
1322
1332
|
});
|
|
1323
1333
|
}
|
|
1324
1334
|
/**
|
|
1325
1335
|
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1326
1336
|
*/
|
|
1327
|
-
parseArguments(
|
|
1328
|
-
const r =
|
|
1329
|
-
return this.optionalMany(
|
|
1337
|
+
parseArguments(t) {
|
|
1338
|
+
const r = t ? this.parseConstArgument : this.parseArgument;
|
|
1339
|
+
return this.optionalMany(a.PAREN_L, r, a.PAREN_R);
|
|
1330
1340
|
}
|
|
1331
1341
|
/**
|
|
1332
1342
|
* Argument[Const] : Name : Value[?Const]
|
|
1333
1343
|
*/
|
|
1334
|
-
parseArgument(
|
|
1335
|
-
const r = this._lexer.token,
|
|
1336
|
-
return this.expectToken(
|
|
1337
|
-
kind:
|
|
1338
|
-
name:
|
|
1339
|
-
value: this.parseValueLiteral(
|
|
1344
|
+
parseArgument(t = !1) {
|
|
1345
|
+
const r = this._lexer.token, i = this.parseName();
|
|
1346
|
+
return this.expectToken(a.COLON), this.node(r, {
|
|
1347
|
+
kind: u.ARGUMENT,
|
|
1348
|
+
name: i,
|
|
1349
|
+
value: this.parseValueLiteral(t)
|
|
1340
1350
|
});
|
|
1341
1351
|
}
|
|
1342
1352
|
parseConstArgument() {
|
|
@@ -1351,15 +1361,15 @@ class ut {
|
|
|
1351
1361
|
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1352
1362
|
*/
|
|
1353
1363
|
parseFragment() {
|
|
1354
|
-
const
|
|
1355
|
-
this.expectToken(
|
|
1364
|
+
const t = this._lexer.token;
|
|
1365
|
+
this.expectToken(a.SPREAD);
|
|
1356
1366
|
const r = this.expectOptionalKeyword("on");
|
|
1357
|
-
return !r && this.peek(
|
|
1358
|
-
kind:
|
|
1367
|
+
return !r && this.peek(a.NAME) ? this.node(t, {
|
|
1368
|
+
kind: u.FRAGMENT_SPREAD,
|
|
1359
1369
|
name: this.parseFragmentName(),
|
|
1360
1370
|
directives: this.parseDirectives(!1)
|
|
1361
|
-
}) : this.node(
|
|
1362
|
-
kind:
|
|
1371
|
+
}) : this.node(t, {
|
|
1372
|
+
kind: u.INLINE_FRAGMENT,
|
|
1363
1373
|
typeCondition: r ? this.parseNamedType() : void 0,
|
|
1364
1374
|
directives: this.parseDirectives(!1),
|
|
1365
1375
|
selectionSet: this.parseSelectionSet()
|
|
@@ -1372,16 +1382,16 @@ class ut {
|
|
|
1372
1382
|
* TypeCondition : NamedType
|
|
1373
1383
|
*/
|
|
1374
1384
|
parseFragmentDefinition() {
|
|
1375
|
-
const
|
|
1376
|
-
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(
|
|
1377
|
-
kind:
|
|
1385
|
+
const t = this._lexer.token;
|
|
1386
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
|
|
1387
|
+
kind: u.FRAGMENT_DEFINITION,
|
|
1378
1388
|
name: this.parseFragmentName(),
|
|
1379
1389
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
1380
1390
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1381
1391
|
directives: this.parseDirectives(!1),
|
|
1382
1392
|
selectionSet: this.parseSelectionSet()
|
|
1383
|
-
}) : this.node(
|
|
1384
|
-
kind:
|
|
1393
|
+
}) : this.node(t, {
|
|
1394
|
+
kind: u.FRAGMENT_DEFINITION,
|
|
1385
1395
|
name: this.parseFragmentName(),
|
|
1386
1396
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1387
1397
|
directives: this.parseDirectives(!1),
|
|
@@ -1415,56 +1425,56 @@ class ut {
|
|
|
1415
1425
|
*
|
|
1416
1426
|
* EnumValue : Name but not `true`, `false` or `null`
|
|
1417
1427
|
*/
|
|
1418
|
-
parseValueLiteral(
|
|
1428
|
+
parseValueLiteral(t) {
|
|
1419
1429
|
const r = this._lexer.token;
|
|
1420
1430
|
switch (r.kind) {
|
|
1421
|
-
case
|
|
1422
|
-
return this.parseList(
|
|
1423
|
-
case
|
|
1424
|
-
return this.parseObject(
|
|
1425
|
-
case
|
|
1431
|
+
case a.BRACKET_L:
|
|
1432
|
+
return this.parseList(t);
|
|
1433
|
+
case a.BRACE_L:
|
|
1434
|
+
return this.parseObject(t);
|
|
1435
|
+
case a.INT:
|
|
1426
1436
|
return this.advanceLexer(), this.node(r, {
|
|
1427
|
-
kind:
|
|
1437
|
+
kind: u.INT,
|
|
1428
1438
|
value: r.value
|
|
1429
1439
|
});
|
|
1430
|
-
case
|
|
1440
|
+
case a.FLOAT:
|
|
1431
1441
|
return this.advanceLexer(), this.node(r, {
|
|
1432
|
-
kind:
|
|
1442
|
+
kind: u.FLOAT,
|
|
1433
1443
|
value: r.value
|
|
1434
1444
|
});
|
|
1435
|
-
case
|
|
1436
|
-
case
|
|
1445
|
+
case a.STRING:
|
|
1446
|
+
case a.BLOCK_STRING:
|
|
1437
1447
|
return this.parseStringLiteral();
|
|
1438
|
-
case
|
|
1448
|
+
case a.NAME:
|
|
1439
1449
|
switch (this.advanceLexer(), r.value) {
|
|
1440
1450
|
case "true":
|
|
1441
1451
|
return this.node(r, {
|
|
1442
|
-
kind:
|
|
1452
|
+
kind: u.BOOLEAN,
|
|
1443
1453
|
value: !0
|
|
1444
1454
|
});
|
|
1445
1455
|
case "false":
|
|
1446
1456
|
return this.node(r, {
|
|
1447
|
-
kind:
|
|
1457
|
+
kind: u.BOOLEAN,
|
|
1448
1458
|
value: !1
|
|
1449
1459
|
});
|
|
1450
1460
|
case "null":
|
|
1451
1461
|
return this.node(r, {
|
|
1452
|
-
kind:
|
|
1462
|
+
kind: u.NULL
|
|
1453
1463
|
});
|
|
1454
1464
|
default:
|
|
1455
1465
|
return this.node(r, {
|
|
1456
|
-
kind:
|
|
1466
|
+
kind: u.ENUM,
|
|
1457
1467
|
value: r.value
|
|
1458
1468
|
});
|
|
1459
1469
|
}
|
|
1460
|
-
case
|
|
1461
|
-
if (
|
|
1462
|
-
if (this.expectToken(
|
|
1463
|
-
const
|
|
1464
|
-
throw
|
|
1470
|
+
case a.DOLLAR:
|
|
1471
|
+
if (t)
|
|
1472
|
+
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1473
|
+
const i = this._lexer.token.value;
|
|
1474
|
+
throw g(
|
|
1465
1475
|
this._lexer.source,
|
|
1466
1476
|
r.start,
|
|
1467
|
-
`Unexpected variable "$${
|
|
1477
|
+
`Unexpected variable "$${i}" in constant value.`
|
|
1468
1478
|
);
|
|
1469
1479
|
} else
|
|
1470
1480
|
throw this.unexpected(r);
|
|
@@ -1477,11 +1487,11 @@ class ut {
|
|
|
1477
1487
|
return this.parseValueLiteral(!0);
|
|
1478
1488
|
}
|
|
1479
1489
|
parseStringLiteral() {
|
|
1480
|
-
const
|
|
1481
|
-
return this.advanceLexer(), this.node(
|
|
1482
|
-
kind:
|
|
1483
|
-
value:
|
|
1484
|
-
block:
|
|
1490
|
+
const t = this._lexer.token;
|
|
1491
|
+
return this.advanceLexer(), this.node(t, {
|
|
1492
|
+
kind: u.STRING,
|
|
1493
|
+
value: t.value,
|
|
1494
|
+
block: t.kind === a.BLOCK_STRING
|
|
1485
1495
|
});
|
|
1486
1496
|
}
|
|
1487
1497
|
/**
|
|
@@ -1489,11 +1499,11 @@ class ut {
|
|
|
1489
1499
|
* - [ ]
|
|
1490
1500
|
* - [ Value[?Const]+ ]
|
|
1491
1501
|
*/
|
|
1492
|
-
parseList(
|
|
1493
|
-
const r = () => this.parseValueLiteral(
|
|
1502
|
+
parseList(t) {
|
|
1503
|
+
const r = () => this.parseValueLiteral(t);
|
|
1494
1504
|
return this.node(this._lexer.token, {
|
|
1495
|
-
kind:
|
|
1496
|
-
values: this.any(
|
|
1505
|
+
kind: u.LIST,
|
|
1506
|
+
values: this.any(a.BRACKET_L, r, a.BRACKET_R)
|
|
1497
1507
|
});
|
|
1498
1508
|
}
|
|
1499
1509
|
/**
|
|
@@ -1503,32 +1513,32 @@ class ut {
|
|
|
1503
1513
|
* - { ObjectField[?Const]+ }
|
|
1504
1514
|
* ```
|
|
1505
1515
|
*/
|
|
1506
|
-
parseObject(
|
|
1507
|
-
const r = () => this.parseObjectField(
|
|
1516
|
+
parseObject(t) {
|
|
1517
|
+
const r = () => this.parseObjectField(t);
|
|
1508
1518
|
return this.node(this._lexer.token, {
|
|
1509
|
-
kind:
|
|
1510
|
-
fields: this.any(
|
|
1519
|
+
kind: u.OBJECT,
|
|
1520
|
+
fields: this.any(a.BRACE_L, r, a.BRACE_R)
|
|
1511
1521
|
});
|
|
1512
1522
|
}
|
|
1513
1523
|
/**
|
|
1514
1524
|
* ObjectField[Const] : Name : Value[?Const]
|
|
1515
1525
|
*/
|
|
1516
|
-
parseObjectField(
|
|
1517
|
-
const r = this._lexer.token,
|
|
1518
|
-
return this.expectToken(
|
|
1519
|
-
kind:
|
|
1520
|
-
name:
|
|
1521
|
-
value: this.parseValueLiteral(
|
|
1526
|
+
parseObjectField(t) {
|
|
1527
|
+
const r = this._lexer.token, i = this.parseName();
|
|
1528
|
+
return this.expectToken(a.COLON), this.node(r, {
|
|
1529
|
+
kind: u.OBJECT_FIELD,
|
|
1530
|
+
name: i,
|
|
1531
|
+
value: this.parseValueLiteral(t)
|
|
1522
1532
|
});
|
|
1523
1533
|
}
|
|
1524
1534
|
// Implements the parsing rules in the Directives section.
|
|
1525
1535
|
/**
|
|
1526
1536
|
* Directives[Const] : Directive[?Const]+
|
|
1527
1537
|
*/
|
|
1528
|
-
parseDirectives(
|
|
1538
|
+
parseDirectives(t) {
|
|
1529
1539
|
const r = [];
|
|
1530
|
-
for (; this.peek(
|
|
1531
|
-
r.push(this.parseDirective(
|
|
1540
|
+
for (; this.peek(a.AT); )
|
|
1541
|
+
r.push(this.parseDirective(t));
|
|
1532
1542
|
return r;
|
|
1533
1543
|
}
|
|
1534
1544
|
parseConstDirectives() {
|
|
@@ -1539,12 +1549,12 @@ class ut {
|
|
|
1539
1549
|
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1540
1550
|
* ```
|
|
1541
1551
|
*/
|
|
1542
|
-
parseDirective(
|
|
1552
|
+
parseDirective(t) {
|
|
1543
1553
|
const r = this._lexer.token;
|
|
1544
|
-
return this.expectToken(
|
|
1545
|
-
kind:
|
|
1554
|
+
return this.expectToken(a.AT), this.node(r, {
|
|
1555
|
+
kind: u.DIRECTIVE,
|
|
1546
1556
|
name: this.parseName(),
|
|
1547
|
-
arguments: this.parseArguments(
|
|
1557
|
+
arguments: this.parseArguments(t)
|
|
1548
1558
|
});
|
|
1549
1559
|
}
|
|
1550
1560
|
// Implements the parsing rules in the Types section.
|
|
@@ -1555,18 +1565,18 @@ class ut {
|
|
|
1555
1565
|
* - NonNullType
|
|
1556
1566
|
*/
|
|
1557
1567
|
parseTypeReference() {
|
|
1558
|
-
const
|
|
1568
|
+
const t = this._lexer.token;
|
|
1559
1569
|
let r;
|
|
1560
|
-
if (this.expectOptionalToken(
|
|
1561
|
-
const
|
|
1562
|
-
this.expectToken(
|
|
1563
|
-
kind:
|
|
1564
|
-
type:
|
|
1570
|
+
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1571
|
+
const i = this.parseTypeReference();
|
|
1572
|
+
this.expectToken(a.BRACKET_R), r = this.node(t, {
|
|
1573
|
+
kind: u.LIST_TYPE,
|
|
1574
|
+
type: i
|
|
1565
1575
|
});
|
|
1566
1576
|
} else
|
|
1567
1577
|
r = this.parseNamedType();
|
|
1568
|
-
return this.expectOptionalToken(
|
|
1569
|
-
kind:
|
|
1578
|
+
return this.expectOptionalToken(a.BANG) ? this.node(t, {
|
|
1579
|
+
kind: u.NON_NULL_TYPE,
|
|
1570
1580
|
type: r
|
|
1571
1581
|
}) : r;
|
|
1572
1582
|
}
|
|
@@ -1575,13 +1585,13 @@ class ut {
|
|
|
1575
1585
|
*/
|
|
1576
1586
|
parseNamedType() {
|
|
1577
1587
|
return this.node(this._lexer.token, {
|
|
1578
|
-
kind:
|
|
1588
|
+
kind: u.NAMED_TYPE,
|
|
1579
1589
|
name: this.parseName()
|
|
1580
1590
|
});
|
|
1581
1591
|
}
|
|
1582
1592
|
// Implements the parsing rules in the Type Definition section.
|
|
1583
1593
|
peekDescription() {
|
|
1584
|
-
return this.peek(
|
|
1594
|
+
return this.peek(a.STRING) || this.peek(a.BLOCK_STRING);
|
|
1585
1595
|
}
|
|
1586
1596
|
/**
|
|
1587
1597
|
* Description : StringValue
|
|
@@ -1596,17 +1606,17 @@ class ut {
|
|
|
1596
1606
|
* ```
|
|
1597
1607
|
*/
|
|
1598
1608
|
parseSchemaDefinition() {
|
|
1599
|
-
const
|
|
1609
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1600
1610
|
this.expectKeyword("schema");
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1611
|
+
const i = this.parseConstDirectives(), n = this.many(
|
|
1612
|
+
a.BRACE_L,
|
|
1603
1613
|
this.parseOperationTypeDefinition,
|
|
1604
|
-
|
|
1614
|
+
a.BRACE_R
|
|
1605
1615
|
);
|
|
1606
|
-
return this.node(
|
|
1607
|
-
kind:
|
|
1616
|
+
return this.node(t, {
|
|
1617
|
+
kind: u.SCHEMA_DEFINITION,
|
|
1608
1618
|
description: r,
|
|
1609
|
-
directives:
|
|
1619
|
+
directives: i,
|
|
1610
1620
|
operationTypes: n
|
|
1611
1621
|
});
|
|
1612
1622
|
}
|
|
@@ -1614,26 +1624,26 @@ class ut {
|
|
|
1614
1624
|
* OperationTypeDefinition : OperationType : NamedType
|
|
1615
1625
|
*/
|
|
1616
1626
|
parseOperationTypeDefinition() {
|
|
1617
|
-
const
|
|
1618
|
-
this.expectToken(
|
|
1619
|
-
const
|
|
1620
|
-
return this.node(
|
|
1621
|
-
kind:
|
|
1627
|
+
const t = this._lexer.token, r = this.parseOperationType();
|
|
1628
|
+
this.expectToken(a.COLON);
|
|
1629
|
+
const i = this.parseNamedType();
|
|
1630
|
+
return this.node(t, {
|
|
1631
|
+
kind: u.OPERATION_TYPE_DEFINITION,
|
|
1622
1632
|
operation: r,
|
|
1623
|
-
type:
|
|
1633
|
+
type: i
|
|
1624
1634
|
});
|
|
1625
1635
|
}
|
|
1626
1636
|
/**
|
|
1627
1637
|
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1628
1638
|
*/
|
|
1629
1639
|
parseScalarTypeDefinition() {
|
|
1630
|
-
const
|
|
1640
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1631
1641
|
this.expectKeyword("scalar");
|
|
1632
|
-
const
|
|
1633
|
-
return this.node(
|
|
1634
|
-
kind:
|
|
1642
|
+
const i = this.parseName(), n = this.parseConstDirectives();
|
|
1643
|
+
return this.node(t, {
|
|
1644
|
+
kind: u.SCALAR_TYPE_DEFINITION,
|
|
1635
1645
|
description: r,
|
|
1636
|
-
name:
|
|
1646
|
+
name: i,
|
|
1637
1647
|
directives: n
|
|
1638
1648
|
});
|
|
1639
1649
|
}
|
|
@@ -1643,16 +1653,16 @@ class ut {
|
|
|
1643
1653
|
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1644
1654
|
*/
|
|
1645
1655
|
parseObjectTypeDefinition() {
|
|
1646
|
-
const
|
|
1656
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1647
1657
|
this.expectKeyword("type");
|
|
1648
|
-
const
|
|
1649
|
-
return this.node(
|
|
1650
|
-
kind:
|
|
1658
|
+
const i = this.parseName(), n = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1659
|
+
return this.node(t, {
|
|
1660
|
+
kind: u.OBJECT_TYPE_DEFINITION,
|
|
1651
1661
|
description: r,
|
|
1652
|
-
name:
|
|
1662
|
+
name: i,
|
|
1653
1663
|
interfaces: n,
|
|
1654
|
-
directives:
|
|
1655
|
-
fields:
|
|
1664
|
+
directives: s,
|
|
1665
|
+
fields: o
|
|
1656
1666
|
});
|
|
1657
1667
|
}
|
|
1658
1668
|
/**
|
|
@@ -1661,7 +1671,7 @@ class ut {
|
|
|
1661
1671
|
* - ImplementsInterfaces & NamedType
|
|
1662
1672
|
*/
|
|
1663
1673
|
parseImplementsInterfaces() {
|
|
1664
|
-
return this.expectOptionalKeyword("implements") ? this.delimitedMany(
|
|
1674
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(a.AMP, this.parseNamedType) : [];
|
|
1665
1675
|
}
|
|
1666
1676
|
/**
|
|
1667
1677
|
* ```
|
|
@@ -1670,9 +1680,9 @@ class ut {
|
|
|
1670
1680
|
*/
|
|
1671
1681
|
parseFieldsDefinition() {
|
|
1672
1682
|
return this.optionalMany(
|
|
1673
|
-
|
|
1683
|
+
a.BRACE_L,
|
|
1674
1684
|
this.parseFieldDefinition,
|
|
1675
|
-
|
|
1685
|
+
a.BRACE_R
|
|
1676
1686
|
);
|
|
1677
1687
|
}
|
|
1678
1688
|
/**
|
|
@@ -1680,16 +1690,16 @@ class ut {
|
|
|
1680
1690
|
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1681
1691
|
*/
|
|
1682
1692
|
parseFieldDefinition() {
|
|
1683
|
-
const
|
|
1684
|
-
this.expectToken(
|
|
1685
|
-
const
|
|
1686
|
-
return this.node(
|
|
1687
|
-
kind:
|
|
1693
|
+
const t = this._lexer.token, r = this.parseDescription(), i = this.parseName(), n = this.parseArgumentDefs();
|
|
1694
|
+
this.expectToken(a.COLON);
|
|
1695
|
+
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1696
|
+
return this.node(t, {
|
|
1697
|
+
kind: u.FIELD_DEFINITION,
|
|
1688
1698
|
description: r,
|
|
1689
|
-
name:
|
|
1699
|
+
name: i,
|
|
1690
1700
|
arguments: n,
|
|
1691
|
-
type:
|
|
1692
|
-
directives:
|
|
1701
|
+
type: s,
|
|
1702
|
+
directives: o
|
|
1693
1703
|
});
|
|
1694
1704
|
}
|
|
1695
1705
|
/**
|
|
@@ -1697,9 +1707,9 @@ class ut {
|
|
|
1697
1707
|
*/
|
|
1698
1708
|
parseArgumentDefs() {
|
|
1699
1709
|
return this.optionalMany(
|
|
1700
|
-
|
|
1710
|
+
a.PAREN_L,
|
|
1701
1711
|
this.parseInputValueDef,
|
|
1702
|
-
|
|
1712
|
+
a.PAREN_R
|
|
1703
1713
|
);
|
|
1704
1714
|
}
|
|
1705
1715
|
/**
|
|
@@ -1707,19 +1717,19 @@ class ut {
|
|
|
1707
1717
|
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1708
1718
|
*/
|
|
1709
1719
|
parseInputValueDef() {
|
|
1710
|
-
const
|
|
1711
|
-
this.expectToken(
|
|
1720
|
+
const t = this._lexer.token, r = this.parseDescription(), i = this.parseName();
|
|
1721
|
+
this.expectToken(a.COLON);
|
|
1712
1722
|
const n = this.parseTypeReference();
|
|
1713
|
-
let
|
|
1714
|
-
this.expectOptionalToken(
|
|
1715
|
-
const
|
|
1716
|
-
return this.node(
|
|
1717
|
-
kind:
|
|
1723
|
+
let s;
|
|
1724
|
+
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1725
|
+
const o = this.parseConstDirectives();
|
|
1726
|
+
return this.node(t, {
|
|
1727
|
+
kind: u.INPUT_VALUE_DEFINITION,
|
|
1718
1728
|
description: r,
|
|
1719
|
-
name:
|
|
1729
|
+
name: i,
|
|
1720
1730
|
type: n,
|
|
1721
|
-
defaultValue:
|
|
1722
|
-
directives:
|
|
1731
|
+
defaultValue: s,
|
|
1732
|
+
directives: o
|
|
1723
1733
|
});
|
|
1724
1734
|
}
|
|
1725
1735
|
/**
|
|
@@ -1727,16 +1737,16 @@ class ut {
|
|
|
1727
1737
|
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1728
1738
|
*/
|
|
1729
1739
|
parseInterfaceTypeDefinition() {
|
|
1730
|
-
const
|
|
1740
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1731
1741
|
this.expectKeyword("interface");
|
|
1732
|
-
const
|
|
1733
|
-
return this.node(
|
|
1734
|
-
kind:
|
|
1742
|
+
const i = this.parseName(), n = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1743
|
+
return this.node(t, {
|
|
1744
|
+
kind: u.INTERFACE_TYPE_DEFINITION,
|
|
1735
1745
|
description: r,
|
|
1736
|
-
name:
|
|
1746
|
+
name: i,
|
|
1737
1747
|
interfaces: n,
|
|
1738
|
-
directives:
|
|
1739
|
-
fields:
|
|
1748
|
+
directives: s,
|
|
1749
|
+
fields: o
|
|
1740
1750
|
});
|
|
1741
1751
|
}
|
|
1742
1752
|
/**
|
|
@@ -1744,15 +1754,15 @@ class ut {
|
|
|
1744
1754
|
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1745
1755
|
*/
|
|
1746
1756
|
parseUnionTypeDefinition() {
|
|
1747
|
-
const
|
|
1757
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1748
1758
|
this.expectKeyword("union");
|
|
1749
|
-
const
|
|
1750
|
-
return this.node(
|
|
1751
|
-
kind:
|
|
1759
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1760
|
+
return this.node(t, {
|
|
1761
|
+
kind: u.UNION_TYPE_DEFINITION,
|
|
1752
1762
|
description: r,
|
|
1753
|
-
name:
|
|
1763
|
+
name: i,
|
|
1754
1764
|
directives: n,
|
|
1755
|
-
types:
|
|
1765
|
+
types: s
|
|
1756
1766
|
});
|
|
1757
1767
|
}
|
|
1758
1768
|
/**
|
|
@@ -1761,22 +1771,22 @@ class ut {
|
|
|
1761
1771
|
* - UnionMemberTypes | NamedType
|
|
1762
1772
|
*/
|
|
1763
1773
|
parseUnionMemberTypes() {
|
|
1764
|
-
return this.expectOptionalToken(
|
|
1774
|
+
return this.expectOptionalToken(a.EQUALS) ? this.delimitedMany(a.PIPE, this.parseNamedType) : [];
|
|
1765
1775
|
}
|
|
1766
1776
|
/**
|
|
1767
1777
|
* EnumTypeDefinition :
|
|
1768
1778
|
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1769
1779
|
*/
|
|
1770
1780
|
parseEnumTypeDefinition() {
|
|
1771
|
-
const
|
|
1781
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1772
1782
|
this.expectKeyword("enum");
|
|
1773
|
-
const
|
|
1774
|
-
return this.node(
|
|
1775
|
-
kind:
|
|
1783
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1784
|
+
return this.node(t, {
|
|
1785
|
+
kind: u.ENUM_TYPE_DEFINITION,
|
|
1776
1786
|
description: r,
|
|
1777
|
-
name:
|
|
1787
|
+
name: i,
|
|
1778
1788
|
directives: n,
|
|
1779
|
-
values:
|
|
1789
|
+
values: s
|
|
1780
1790
|
});
|
|
1781
1791
|
}
|
|
1782
1792
|
/**
|
|
@@ -1786,20 +1796,20 @@ class ut {
|
|
|
1786
1796
|
*/
|
|
1787
1797
|
parseEnumValuesDefinition() {
|
|
1788
1798
|
return this.optionalMany(
|
|
1789
|
-
|
|
1799
|
+
a.BRACE_L,
|
|
1790
1800
|
this.parseEnumValueDefinition,
|
|
1791
|
-
|
|
1801
|
+
a.BRACE_R
|
|
1792
1802
|
);
|
|
1793
1803
|
}
|
|
1794
1804
|
/**
|
|
1795
1805
|
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1796
1806
|
*/
|
|
1797
1807
|
parseEnumValueDefinition() {
|
|
1798
|
-
const
|
|
1799
|
-
return this.node(
|
|
1800
|
-
kind:
|
|
1808
|
+
const t = this._lexer.token, r = this.parseDescription(), i = this.parseEnumValueName(), n = this.parseConstDirectives();
|
|
1809
|
+
return this.node(t, {
|
|
1810
|
+
kind: u.ENUM_VALUE_DEFINITION,
|
|
1801
1811
|
description: r,
|
|
1802
|
-
name:
|
|
1812
|
+
name: i,
|
|
1803
1813
|
directives: n
|
|
1804
1814
|
});
|
|
1805
1815
|
}
|
|
@@ -1808,10 +1818,10 @@ class ut {
|
|
|
1808
1818
|
*/
|
|
1809
1819
|
parseEnumValueName() {
|
|
1810
1820
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
1811
|
-
throw
|
|
1821
|
+
throw g(
|
|
1812
1822
|
this._lexer.source,
|
|
1813
1823
|
this._lexer.token.start,
|
|
1814
|
-
`${
|
|
1824
|
+
`${x(
|
|
1815
1825
|
this._lexer.token
|
|
1816
1826
|
)} is reserved and cannot be used for an enum value.`
|
|
1817
1827
|
);
|
|
@@ -1822,15 +1832,15 @@ class ut {
|
|
|
1822
1832
|
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1823
1833
|
*/
|
|
1824
1834
|
parseInputObjectTypeDefinition() {
|
|
1825
|
-
const
|
|
1835
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
1826
1836
|
this.expectKeyword("input");
|
|
1827
|
-
const
|
|
1828
|
-
return this.node(
|
|
1829
|
-
kind:
|
|
1837
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1838
|
+
return this.node(t, {
|
|
1839
|
+
kind: u.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1830
1840
|
description: r,
|
|
1831
|
-
name:
|
|
1841
|
+
name: i,
|
|
1832
1842
|
directives: n,
|
|
1833
|
-
fields:
|
|
1843
|
+
fields: s
|
|
1834
1844
|
});
|
|
1835
1845
|
}
|
|
1836
1846
|
/**
|
|
@@ -1840,9 +1850,9 @@ class ut {
|
|
|
1840
1850
|
*/
|
|
1841
1851
|
parseInputFieldsDefinition() {
|
|
1842
1852
|
return this.optionalMany(
|
|
1843
|
-
|
|
1853
|
+
a.BRACE_L,
|
|
1844
1854
|
this.parseInputValueDef,
|
|
1845
|
-
|
|
1855
|
+
a.BRACE_R
|
|
1846
1856
|
);
|
|
1847
1857
|
}
|
|
1848
1858
|
/**
|
|
@@ -1859,9 +1869,9 @@ class ut {
|
|
|
1859
1869
|
* - InputObjectTypeDefinition
|
|
1860
1870
|
*/
|
|
1861
1871
|
parseTypeSystemExtension() {
|
|
1862
|
-
const
|
|
1863
|
-
if (
|
|
1864
|
-
switch (
|
|
1872
|
+
const t = this._lexer.lookahead();
|
|
1873
|
+
if (t.kind === a.NAME)
|
|
1874
|
+
switch (t.value) {
|
|
1865
1875
|
case "schema":
|
|
1866
1876
|
return this.parseSchemaExtension();
|
|
1867
1877
|
case "scalar":
|
|
@@ -1877,7 +1887,7 @@ class ut {
|
|
|
1877
1887
|
case "input":
|
|
1878
1888
|
return this.parseInputObjectTypeExtension();
|
|
1879
1889
|
}
|
|
1880
|
-
throw this.unexpected(
|
|
1890
|
+
throw this.unexpected(t);
|
|
1881
1891
|
}
|
|
1882
1892
|
/**
|
|
1883
1893
|
* ```
|
|
@@ -1887,19 +1897,19 @@ class ut {
|
|
|
1887
1897
|
* ```
|
|
1888
1898
|
*/
|
|
1889
1899
|
parseSchemaExtension() {
|
|
1890
|
-
const
|
|
1900
|
+
const t = this._lexer.token;
|
|
1891
1901
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1892
|
-
const r = this.parseConstDirectives(),
|
|
1893
|
-
|
|
1902
|
+
const r = this.parseConstDirectives(), i = this.optionalMany(
|
|
1903
|
+
a.BRACE_L,
|
|
1894
1904
|
this.parseOperationTypeDefinition,
|
|
1895
|
-
|
|
1905
|
+
a.BRACE_R
|
|
1896
1906
|
);
|
|
1897
|
-
if (r.length === 0 &&
|
|
1907
|
+
if (r.length === 0 && i.length === 0)
|
|
1898
1908
|
throw this.unexpected();
|
|
1899
|
-
return this.node(
|
|
1900
|
-
kind:
|
|
1909
|
+
return this.node(t, {
|
|
1910
|
+
kind: u.SCHEMA_EXTENSION,
|
|
1901
1911
|
directives: r,
|
|
1902
|
-
operationTypes:
|
|
1912
|
+
operationTypes: i
|
|
1903
1913
|
});
|
|
1904
1914
|
}
|
|
1905
1915
|
/**
|
|
@@ -1907,15 +1917,15 @@ class ut {
|
|
|
1907
1917
|
* - extend scalar Name Directives[Const]
|
|
1908
1918
|
*/
|
|
1909
1919
|
parseScalarTypeExtension() {
|
|
1910
|
-
const
|
|
1920
|
+
const t = this._lexer.token;
|
|
1911
1921
|
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1912
|
-
const r = this.parseName(),
|
|
1913
|
-
if (
|
|
1922
|
+
const r = this.parseName(), i = this.parseConstDirectives();
|
|
1923
|
+
if (i.length === 0)
|
|
1914
1924
|
throw this.unexpected();
|
|
1915
|
-
return this.node(
|
|
1916
|
-
kind:
|
|
1925
|
+
return this.node(t, {
|
|
1926
|
+
kind: u.SCALAR_TYPE_EXTENSION,
|
|
1917
1927
|
name: r,
|
|
1918
|
-
directives:
|
|
1928
|
+
directives: i
|
|
1919
1929
|
});
|
|
1920
1930
|
}
|
|
1921
1931
|
/**
|
|
@@ -1925,17 +1935,17 @@ class ut {
|
|
|
1925
1935
|
* - extend type Name ImplementsInterfaces
|
|
1926
1936
|
*/
|
|
1927
1937
|
parseObjectTypeExtension() {
|
|
1928
|
-
const
|
|
1938
|
+
const t = this._lexer.token;
|
|
1929
1939
|
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1930
|
-
const r = this.parseName(),
|
|
1931
|
-
if (
|
|
1940
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), n = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1941
|
+
if (i.length === 0 && n.length === 0 && s.length === 0)
|
|
1932
1942
|
throw this.unexpected();
|
|
1933
|
-
return this.node(
|
|
1934
|
-
kind:
|
|
1943
|
+
return this.node(t, {
|
|
1944
|
+
kind: u.OBJECT_TYPE_EXTENSION,
|
|
1935
1945
|
name: r,
|
|
1936
|
-
interfaces:
|
|
1946
|
+
interfaces: i,
|
|
1937
1947
|
directives: n,
|
|
1938
|
-
fields:
|
|
1948
|
+
fields: s
|
|
1939
1949
|
});
|
|
1940
1950
|
}
|
|
1941
1951
|
/**
|
|
@@ -1945,17 +1955,17 @@ class ut {
|
|
|
1945
1955
|
* - extend interface Name ImplementsInterfaces
|
|
1946
1956
|
*/
|
|
1947
1957
|
parseInterfaceTypeExtension() {
|
|
1948
|
-
const
|
|
1958
|
+
const t = this._lexer.token;
|
|
1949
1959
|
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1950
|
-
const r = this.parseName(),
|
|
1951
|
-
if (
|
|
1960
|
+
const r = this.parseName(), i = this.parseImplementsInterfaces(), n = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1961
|
+
if (i.length === 0 && n.length === 0 && s.length === 0)
|
|
1952
1962
|
throw this.unexpected();
|
|
1953
|
-
return this.node(
|
|
1954
|
-
kind:
|
|
1963
|
+
return this.node(t, {
|
|
1964
|
+
kind: u.INTERFACE_TYPE_EXTENSION,
|
|
1955
1965
|
name: r,
|
|
1956
|
-
interfaces:
|
|
1966
|
+
interfaces: i,
|
|
1957
1967
|
directives: n,
|
|
1958
|
-
fields:
|
|
1968
|
+
fields: s
|
|
1959
1969
|
});
|
|
1960
1970
|
}
|
|
1961
1971
|
/**
|
|
@@ -1964,15 +1974,15 @@ class ut {
|
|
|
1964
1974
|
* - extend union Name Directives[Const]
|
|
1965
1975
|
*/
|
|
1966
1976
|
parseUnionTypeExtension() {
|
|
1967
|
-
const
|
|
1977
|
+
const t = this._lexer.token;
|
|
1968
1978
|
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1969
|
-
const r = this.parseName(),
|
|
1970
|
-
if (
|
|
1979
|
+
const r = this.parseName(), i = this.parseConstDirectives(), n = this.parseUnionMemberTypes();
|
|
1980
|
+
if (i.length === 0 && n.length === 0)
|
|
1971
1981
|
throw this.unexpected();
|
|
1972
|
-
return this.node(
|
|
1973
|
-
kind:
|
|
1982
|
+
return this.node(t, {
|
|
1983
|
+
kind: u.UNION_TYPE_EXTENSION,
|
|
1974
1984
|
name: r,
|
|
1975
|
-
directives:
|
|
1985
|
+
directives: i,
|
|
1976
1986
|
types: n
|
|
1977
1987
|
});
|
|
1978
1988
|
}
|
|
@@ -1982,15 +1992,15 @@ class ut {
|
|
|
1982
1992
|
* - extend enum Name Directives[Const]
|
|
1983
1993
|
*/
|
|
1984
1994
|
parseEnumTypeExtension() {
|
|
1985
|
-
const
|
|
1995
|
+
const t = this._lexer.token;
|
|
1986
1996
|
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1987
|
-
const r = this.parseName(),
|
|
1988
|
-
if (
|
|
1997
|
+
const r = this.parseName(), i = this.parseConstDirectives(), n = this.parseEnumValuesDefinition();
|
|
1998
|
+
if (i.length === 0 && n.length === 0)
|
|
1989
1999
|
throw this.unexpected();
|
|
1990
|
-
return this.node(
|
|
1991
|
-
kind:
|
|
2000
|
+
return this.node(t, {
|
|
2001
|
+
kind: u.ENUM_TYPE_EXTENSION,
|
|
1992
2002
|
name: r,
|
|
1993
|
-
directives:
|
|
2003
|
+
directives: i,
|
|
1994
2004
|
values: n
|
|
1995
2005
|
});
|
|
1996
2006
|
}
|
|
@@ -2000,15 +2010,15 @@ class ut {
|
|
|
2000
2010
|
* - extend input Name Directives[Const]
|
|
2001
2011
|
*/
|
|
2002
2012
|
parseInputObjectTypeExtension() {
|
|
2003
|
-
const
|
|
2013
|
+
const t = this._lexer.token;
|
|
2004
2014
|
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
2005
|
-
const r = this.parseName(),
|
|
2006
|
-
if (
|
|
2015
|
+
const r = this.parseName(), i = this.parseConstDirectives(), n = this.parseInputFieldsDefinition();
|
|
2016
|
+
if (i.length === 0 && n.length === 0)
|
|
2007
2017
|
throw this.unexpected();
|
|
2008
|
-
return this.node(
|
|
2009
|
-
kind:
|
|
2018
|
+
return this.node(t, {
|
|
2019
|
+
kind: u.INPUT_OBJECT_TYPE_EXTENSION,
|
|
2010
2020
|
name: r,
|
|
2011
|
-
directives:
|
|
2021
|
+
directives: i,
|
|
2012
2022
|
fields: n
|
|
2013
2023
|
});
|
|
2014
2024
|
}
|
|
@@ -2019,18 +2029,18 @@ class ut {
|
|
|
2019
2029
|
* ```
|
|
2020
2030
|
*/
|
|
2021
2031
|
parseDirectiveDefinition() {
|
|
2022
|
-
const
|
|
2023
|
-
this.expectKeyword("directive"), this.expectToken(
|
|
2024
|
-
const
|
|
2032
|
+
const t = this._lexer.token, r = this.parseDescription();
|
|
2033
|
+
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
2034
|
+
const i = this.parseName(), n = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
2025
2035
|
this.expectKeyword("on");
|
|
2026
|
-
const
|
|
2027
|
-
return this.node(
|
|
2028
|
-
kind:
|
|
2036
|
+
const o = this.parseDirectiveLocations();
|
|
2037
|
+
return this.node(t, {
|
|
2038
|
+
kind: u.DIRECTIVE_DEFINITION,
|
|
2029
2039
|
description: r,
|
|
2030
|
-
name:
|
|
2040
|
+
name: i,
|
|
2031
2041
|
arguments: n,
|
|
2032
|
-
repeatable:
|
|
2033
|
-
locations:
|
|
2042
|
+
repeatable: s,
|
|
2043
|
+
locations: o
|
|
2034
2044
|
});
|
|
2035
2045
|
}
|
|
2036
2046
|
/**
|
|
@@ -2039,7 +2049,7 @@ class ut {
|
|
|
2039
2049
|
* - DirectiveLocations | DirectiveLocation
|
|
2040
2050
|
*/
|
|
2041
2051
|
parseDirectiveLocations() {
|
|
2042
|
-
return this.delimitedMany(
|
|
2052
|
+
return this.delimitedMany(a.PIPE, this.parseDirectiveLocation);
|
|
2043
2053
|
}
|
|
2044
2054
|
/*
|
|
2045
2055
|
* DirectiveLocation :
|
|
@@ -2069,10 +2079,10 @@ class ut {
|
|
|
2069
2079
|
* `INPUT_FIELD_DEFINITION`
|
|
2070
2080
|
*/
|
|
2071
2081
|
parseDirectiveLocation() {
|
|
2072
|
-
const
|
|
2073
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
2082
|
+
const t = this._lexer.token, r = this.parseName();
|
|
2083
|
+
if (Object.prototype.hasOwnProperty.call(K, r.value))
|
|
2074
2084
|
return r;
|
|
2075
|
-
throw this.unexpected(
|
|
2085
|
+
throw this.unexpected(t);
|
|
2076
2086
|
}
|
|
2077
2087
|
// Core parsing utility functions
|
|
2078
2088
|
/**
|
|
@@ -2080,9 +2090,9 @@ class ut {
|
|
|
2080
2090
|
* location object, used to identify the place in the source that created a
|
|
2081
2091
|
* given parsed object.
|
|
2082
2092
|
*/
|
|
2083
|
-
node(
|
|
2084
|
-
return this._options.noLocation !== !0 && (r.loc = new
|
|
2085
|
-
|
|
2093
|
+
node(t, r) {
|
|
2094
|
+
return this._options.noLocation !== !0 && (r.loc = new lr(
|
|
2095
|
+
t,
|
|
2086
2096
|
this._lexer.lastToken,
|
|
2087
2097
|
this._lexer.source
|
|
2088
2098
|
)), r;
|
|
@@ -2090,62 +2100,62 @@ class ut {
|
|
|
2090
2100
|
/**
|
|
2091
2101
|
* Determines if the next token is of a given kind
|
|
2092
2102
|
*/
|
|
2093
|
-
peek(
|
|
2094
|
-
return this._lexer.token.kind ===
|
|
2103
|
+
peek(t) {
|
|
2104
|
+
return this._lexer.token.kind === t;
|
|
2095
2105
|
}
|
|
2096
2106
|
/**
|
|
2097
2107
|
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2098
2108
|
* Otherwise, do not change the parser state and throw an error.
|
|
2099
2109
|
*/
|
|
2100
|
-
expectToken(
|
|
2110
|
+
expectToken(t) {
|
|
2101
2111
|
const r = this._lexer.token;
|
|
2102
|
-
if (r.kind ===
|
|
2112
|
+
if (r.kind === t)
|
|
2103
2113
|
return this.advanceLexer(), r;
|
|
2104
|
-
throw
|
|
2114
|
+
throw g(
|
|
2105
2115
|
this._lexer.source,
|
|
2106
2116
|
r.start,
|
|
2107
|
-
`Expected ${
|
|
2117
|
+
`Expected ${Re(t)}, found ${x(r)}.`
|
|
2108
2118
|
);
|
|
2109
2119
|
}
|
|
2110
2120
|
/**
|
|
2111
2121
|
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2112
2122
|
* Otherwise, do not change the parser state and return "false".
|
|
2113
2123
|
*/
|
|
2114
|
-
expectOptionalToken(
|
|
2115
|
-
return this._lexer.token.kind ===
|
|
2124
|
+
expectOptionalToken(t) {
|
|
2125
|
+
return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
|
|
2116
2126
|
}
|
|
2117
2127
|
/**
|
|
2118
2128
|
* If the next token is a given keyword, advance the lexer.
|
|
2119
2129
|
* Otherwise, do not change the parser state and throw an error.
|
|
2120
2130
|
*/
|
|
2121
|
-
expectKeyword(
|
|
2131
|
+
expectKeyword(t) {
|
|
2122
2132
|
const r = this._lexer.token;
|
|
2123
|
-
if (r.kind ===
|
|
2133
|
+
if (r.kind === a.NAME && r.value === t)
|
|
2124
2134
|
this.advanceLexer();
|
|
2125
2135
|
else
|
|
2126
|
-
throw
|
|
2136
|
+
throw g(
|
|
2127
2137
|
this._lexer.source,
|
|
2128
2138
|
r.start,
|
|
2129
|
-
`Expected "${
|
|
2139
|
+
`Expected "${t}", found ${x(r)}.`
|
|
2130
2140
|
);
|
|
2131
2141
|
}
|
|
2132
2142
|
/**
|
|
2133
2143
|
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2134
2144
|
* Otherwise, do not change the parser state and return "false".
|
|
2135
2145
|
*/
|
|
2136
|
-
expectOptionalKeyword(
|
|
2146
|
+
expectOptionalKeyword(t) {
|
|
2137
2147
|
const r = this._lexer.token;
|
|
2138
|
-
return r.kind ===
|
|
2148
|
+
return r.kind === a.NAME && r.value === t ? (this.advanceLexer(), !0) : !1;
|
|
2139
2149
|
}
|
|
2140
2150
|
/**
|
|
2141
2151
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2142
2152
|
*/
|
|
2143
|
-
unexpected(
|
|
2144
|
-
const r =
|
|
2145
|
-
return
|
|
2153
|
+
unexpected(t) {
|
|
2154
|
+
const r = t ?? this._lexer.token;
|
|
2155
|
+
return g(
|
|
2146
2156
|
this._lexer.source,
|
|
2147
2157
|
r.start,
|
|
2148
|
-
`Unexpected ${
|
|
2158
|
+
`Unexpected ${x(r)}.`
|
|
2149
2159
|
);
|
|
2150
2160
|
}
|
|
2151
2161
|
/**
|
|
@@ -2153,10 +2163,10 @@ class ut {
|
|
|
2153
2163
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2154
2164
|
* Advances the parser to the next lex token after the closing token.
|
|
2155
2165
|
*/
|
|
2156
|
-
any(
|
|
2157
|
-
this.expectToken(
|
|
2166
|
+
any(t, r, i) {
|
|
2167
|
+
this.expectToken(t);
|
|
2158
2168
|
const n = [];
|
|
2159
|
-
for (; !this.expectOptionalToken(
|
|
2169
|
+
for (; !this.expectOptionalToken(i); )
|
|
2160
2170
|
n.push(r.call(this));
|
|
2161
2171
|
return n;
|
|
2162
2172
|
}
|
|
@@ -2166,12 +2176,12 @@ class ut {
|
|
|
2166
2176
|
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2167
2177
|
* Advances the parser to the next lex token after the closing token.
|
|
2168
2178
|
*/
|
|
2169
|
-
optionalMany(
|
|
2170
|
-
if (this.expectOptionalToken(
|
|
2179
|
+
optionalMany(t, r, i) {
|
|
2180
|
+
if (this.expectOptionalToken(t)) {
|
|
2171
2181
|
const n = [];
|
|
2172
2182
|
do
|
|
2173
2183
|
n.push(r.call(this));
|
|
2174
|
-
while (!this.expectOptionalToken(
|
|
2184
|
+
while (!this.expectOptionalToken(i));
|
|
2175
2185
|
return n;
|
|
2176
2186
|
}
|
|
2177
2187
|
return [];
|
|
@@ -2181,12 +2191,12 @@ class ut {
|
|
|
2181
2191
|
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2182
2192
|
* Advances the parser to the next lex token after the closing token.
|
|
2183
2193
|
*/
|
|
2184
|
-
many(
|
|
2185
|
-
this.expectToken(
|
|
2194
|
+
many(t, r, i) {
|
|
2195
|
+
this.expectToken(t);
|
|
2186
2196
|
const n = [];
|
|
2187
2197
|
do
|
|
2188
2198
|
n.push(r.call(this));
|
|
2189
|
-
while (!this.expectOptionalToken(
|
|
2199
|
+
while (!this.expectOptionalToken(i));
|
|
2190
2200
|
return n;
|
|
2191
2201
|
}
|
|
2192
2202
|
/**
|
|
@@ -2194,107 +2204,108 @@ class ut {
|
|
|
2194
2204
|
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2195
2205
|
* Advances the parser to the next lex token after last item in the list.
|
|
2196
2206
|
*/
|
|
2197
|
-
delimitedMany(
|
|
2198
|
-
this.expectOptionalToken(
|
|
2199
|
-
const
|
|
2207
|
+
delimitedMany(t, r) {
|
|
2208
|
+
this.expectOptionalToken(t);
|
|
2209
|
+
const i = [];
|
|
2200
2210
|
do
|
|
2201
|
-
|
|
2202
|
-
while (this.expectOptionalToken(
|
|
2203
|
-
return
|
|
2211
|
+
i.push(r.call(this));
|
|
2212
|
+
while (this.expectOptionalToken(t));
|
|
2213
|
+
return i;
|
|
2204
2214
|
}
|
|
2205
2215
|
advanceLexer() {
|
|
2206
|
-
const { maxTokens:
|
|
2207
|
-
if (r.kind !==
|
|
2208
|
-
throw
|
|
2216
|
+
const { maxTokens: t } = this._options, r = this._lexer.advance();
|
|
2217
|
+
if (r.kind !== a.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
|
|
2218
|
+
throw g(
|
|
2209
2219
|
this._lexer.source,
|
|
2210
2220
|
r.start,
|
|
2211
|
-
`Document contains more that ${
|
|
2221
|
+
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
2212
2222
|
);
|
|
2213
2223
|
}
|
|
2214
2224
|
}
|
|
2215
|
-
function
|
|
2216
|
-
const
|
|
2217
|
-
return
|
|
2225
|
+
function x(e) {
|
|
2226
|
+
const t = e.value;
|
|
2227
|
+
return Re(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2218
2228
|
}
|
|
2219
|
-
function
|
|
2220
|
-
return
|
|
2229
|
+
function Re(e) {
|
|
2230
|
+
return Ar(e) ? `"${e}"` : e;
|
|
2221
2231
|
}
|
|
2222
|
-
var
|
|
2223
|
-
function
|
|
2224
|
-
return
|
|
2232
|
+
var b = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), ve = !0, y = !1;
|
|
2233
|
+
function Le(e) {
|
|
2234
|
+
return e.replace(/[\s,]+/g, " ").trim();
|
|
2225
2235
|
}
|
|
2226
|
-
function
|
|
2227
|
-
return
|
|
2236
|
+
function wr(e) {
|
|
2237
|
+
return Le(e.source.body.substring(e.start, e.end));
|
|
2228
2238
|
}
|
|
2229
|
-
function
|
|
2230
|
-
var
|
|
2231
|
-
return
|
|
2232
|
-
if (
|
|
2233
|
-
var n =
|
|
2234
|
-
|
|
2239
|
+
function Br(e) {
|
|
2240
|
+
var t = /* @__PURE__ */ new Set(), r = [];
|
|
2241
|
+
return e.definitions.forEach(function(i) {
|
|
2242
|
+
if (i.kind === "FragmentDefinition") {
|
|
2243
|
+
var n = i.name.value, s = wr(i.loc), o = j.get(n);
|
|
2244
|
+
o && !o.has(s) ? ve && console.warn("Warning: fragment with name " + n + ` already exists.
|
|
2235
2245
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2236
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) :
|
|
2246
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || j.set(n, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), r.push(i));
|
|
2237
2247
|
} else
|
|
2238
|
-
r.push(
|
|
2239
|
-
}),
|
|
2240
|
-
}
|
|
2241
|
-
function
|
|
2242
|
-
var
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
var
|
|
2246
|
-
|
|
2248
|
+
r.push(i);
|
|
2249
|
+
}), F(F({}, e), { definitions: r });
|
|
2250
|
+
}
|
|
2251
|
+
function Gr(e) {
|
|
2252
|
+
var t = new Set(e.definitions);
|
|
2253
|
+
t.forEach(function(i) {
|
|
2254
|
+
i.loc && delete i.loc, Object.keys(i).forEach(function(n) {
|
|
2255
|
+
var s = i[n];
|
|
2256
|
+
s && typeof s == "object" && t.add(s);
|
|
2247
2257
|
});
|
|
2248
2258
|
});
|
|
2249
|
-
var r =
|
|
2250
|
-
return r && (delete r.startToken, delete r.endToken),
|
|
2251
|
-
}
|
|
2252
|
-
function
|
|
2253
|
-
var
|
|
2254
|
-
if (!
|
|
2255
|
-
var r =
|
|
2256
|
-
experimentalFragmentVariables:
|
|
2257
|
-
allowLegacyFragmentVariables:
|
|
2259
|
+
var r = e.loc;
|
|
2260
|
+
return r && (delete r.startToken, delete r.endToken), e;
|
|
2261
|
+
}
|
|
2262
|
+
function $r(e) {
|
|
2263
|
+
var t = Le(e);
|
|
2264
|
+
if (!b.has(t)) {
|
|
2265
|
+
var r = Mr(e, {
|
|
2266
|
+
experimentalFragmentVariables: y,
|
|
2267
|
+
allowLegacyFragmentVariables: y
|
|
2258
2268
|
});
|
|
2259
2269
|
if (!r || r.kind !== "Document")
|
|
2260
2270
|
throw new Error("Not a valid GraphQL document.");
|
|
2261
|
-
|
|
2271
|
+
b.set(t, Gr(Br(r)));
|
|
2262
2272
|
}
|
|
2263
|
-
return
|
|
2273
|
+
return b.get(t);
|
|
2264
2274
|
}
|
|
2265
|
-
function
|
|
2266
|
-
for (var
|
|
2267
|
-
|
|
2268
|
-
typeof
|
|
2269
|
-
var
|
|
2270
|
-
return
|
|
2271
|
-
n && n.kind === "Document" ?
|
|
2272
|
-
}),
|
|
2275
|
+
function E(e) {
|
|
2276
|
+
for (var t = [], r = 1; r < arguments.length; r++)
|
|
2277
|
+
t[r - 1] = arguments[r];
|
|
2278
|
+
typeof e == "string" && (e = [e]);
|
|
2279
|
+
var i = e[0];
|
|
2280
|
+
return t.forEach(function(n, s) {
|
|
2281
|
+
n && n.kind === "Document" ? i += n.loc.source.body : i += n, i += e[s + 1];
|
|
2282
|
+
}), $r(i);
|
|
2273
2283
|
}
|
|
2274
|
-
function
|
|
2275
|
-
|
|
2284
|
+
function Hr() {
|
|
2285
|
+
b.clear(), j.clear();
|
|
2276
2286
|
}
|
|
2277
|
-
function
|
|
2278
|
-
|
|
2287
|
+
function zr() {
|
|
2288
|
+
ve = !1;
|
|
2279
2289
|
}
|
|
2280
|
-
function
|
|
2281
|
-
|
|
2290
|
+
function Yr() {
|
|
2291
|
+
y = !0;
|
|
2282
2292
|
}
|
|
2283
|
-
function
|
|
2284
|
-
|
|
2293
|
+
function qr() {
|
|
2294
|
+
y = !1;
|
|
2285
2295
|
}
|
|
2286
|
-
var
|
|
2287
|
-
gql:
|
|
2288
|
-
resetCaches:
|
|
2289
|
-
disableFragmentWarnings:
|
|
2290
|
-
enableExperimentalFragmentVariables:
|
|
2291
|
-
disableExperimentalFragmentVariables:
|
|
2296
|
+
var P = {
|
|
2297
|
+
gql: E,
|
|
2298
|
+
resetCaches: Hr,
|
|
2299
|
+
disableFragmentWarnings: zr,
|
|
2300
|
+
enableExperimentalFragmentVariables: Yr,
|
|
2301
|
+
disableExperimentalFragmentVariables: qr
|
|
2292
2302
|
};
|
|
2293
|
-
(function(
|
|
2294
|
-
|
|
2295
|
-
})(
|
|
2296
|
-
|
|
2297
|
-
const yt = I`
|
|
2303
|
+
(function(e) {
|
|
2304
|
+
e.gql = P.gql, e.resetCaches = P.resetCaches, e.disableFragmentWarnings = P.disableFragmentWarnings, e.enableExperimentalFragmentVariables = P.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = P.disableExperimentalFragmentVariables;
|
|
2305
|
+
})(E || (E = {}));
|
|
2306
|
+
E.default = E;
|
|
2307
|
+
var Pe = /* @__PURE__ */ ((e) => (e.Private = "PRIVATE", e.Public = "PUBLIC", e))(Pe || {}), ke = /* @__PURE__ */ ((e) => (e.Addon = "ADDON", e.Delivery = "DELIVERY", e.Door = "DOOR", e.Friend = "FRIEND", e.Guest = "GUEST", e.Pickup = "PICKUP", e.Promoter = "PROMOTER", e.Ticket = "TICKET", e))(ke || {}), Ce = /* @__PURE__ */ ((e) => (e.Fixed = "FIXED", e.Percentage = "PERCENTAGE", e))(Ce || {}), Se = /* @__PURE__ */ ((e) => (e.Progressive = "PROGRESSIVE", e.Retroactive = "RETROACTIVE", e))(Se || {}), xe = /* @__PURE__ */ ((e) => (e.AllEvents = "ALL_EVENTS", e.PerEvent = "PER_EVENT", e))(xe || {}), be = /* @__PURE__ */ ((e) => (e.Collect = "COLLECT", e.Sale = "SALE", e.Scan = "SCAN", e))(be || {}), Fe = /* @__PURE__ */ ((e) => (e.Aed = "AED", e.Afn = "AFN", e.All = "ALL", e.Amd = "AMD", e.Ars = "ARS", e.Aud = "AUD", e.Azn = "AZN", e.Bam = "BAM", e.Bdt = "BDT", e.Bgn = "BGN", e.Bhd = "BHD", e.Bif = "BIF", e.Bnd = "BND", e.Bob = "BOB", e.Brl = "BRL", e.Bwp = "BWP", e.Byn = "BYN", e.Bzd = "BZD", e.Cad = "CAD", e.Cdf = "CDF", e.Chf = "CHF", e.Clp = "CLP", e.Cny = "CNY", e.Cop = "COP", e.Crc = "CRC", e.Cve = "CVE", e.Czk = "CZK", e.Djf = "DJF", e.Dkk = "DKK", e.Dop = "DOP", e.Dzd = "DZD", e.Eek = "EEK", e.Egp = "EGP", e.Ern = "ERN", e.Etb = "ETB", e.Eur = "EUR", e.Gbp = "GBP", e.Gel = "GEL", e.Ghs = "GHS", e.Gnf = "GNF", e.Gtq = "GTQ", e.Hkd = "HKD", e.Hnl = "HNL", e.Hrk = "HRK", e.Huf = "HUF", e.Idr = "IDR", e.Ils = "ILS", e.Inr = "INR", e.Iqd = "IQD", e.Irr = "IRR", e.Isk = "ISK", e.Jmd = "JMD", e.Jod = "JOD", e.Jpy = "JPY", e.Kes = "KES", e.Khr = "KHR", e.Kmf = "KMF", e.Krw = "KRW", e.Kwd = "KWD", e.Kzt = "KZT", e.Lbp = "LBP", e.Lkr = "LKR", e.Ltl = "LTL", e.Lvl = "LVL", e.Lyd = "LYD", e.Mad = "MAD", e.Mdl = "MDL", e.Mga = "MGA", e.Mkd = "MKD", e.Mmk = "MMK", e.Mop = "MOP", e.Mur = "MUR", e.Mxn = "MXN", e.Myr = "MYR", e.Mzn = "MZN", e.Nad = "NAD", e.Ngn = "NGN", e.Nio = "NIO", e.Nok = "NOK", e.Npr = "NPR", e.Nzd = "NZD", e.Omr = "OMR", e.Pab = "PAB", e.Pen = "PEN", e.Php = "PHP", e.Pkr = "PKR", e.Pln = "PLN", e.Pyg = "PYG", e.Qar = "QAR", e.Ron = "RON", e.Rsd = "RSD", e.Rub = "RUB", e.Rwf = "RWF", e.Sar = "SAR", e.Sdg = "SDG", e.Sek = "SEK", e.Sgd = "SGD", e.Sos = "SOS", e.Syp = "SYP", e.Thb = "THB", e.Tnd = "TND", e.Top = "TOP", e.Try = "TRY", e.Ttd = "TTD", e.Twd = "TWD", e.Tzs = "TZS", e.Uah = "UAH", e.Ugx = "UGX", e.Usd = "USD", e.Uyu = "UYU", e.Uzs = "UZS", e.Vef = "VEF", e.Vnd = "VND", e.Xaf = "XAF", e.Xof = "XOF", e.Yer = "YER", e.Zar = "ZAR", e.Zmk = "ZMK", e.Zwl = "ZWL", e))(Fe || {}), ye = /* @__PURE__ */ ((e) => (e.Age = "AGE", e.Email = "EMAIL", e.FirstName = "FIRST_NAME", e.Gender = "GENDER", e.GooglePlace = "GOOGLE_PLACE", e.LastName = "LAST_NAME", e.Residence = "RESIDENCE", e))(ye || {}), Ue = /* @__PURE__ */ ((e) => (e.Checkbox = "CHECKBOX", e.Date = "DATE", e.Dropdown = "DROPDOWN", e.Email = "EMAIL", e.Numeric = "NUMERIC", e.PhoneNumber = "PHONE_NUMBER", e.RadioButton = "RADIO_BUTTON", e.Text = "TEXT", e.TextArea = "TEXT_AREA", e.Time = "TIME", e))(Ue || {}), Me = /* @__PURE__ */ ((e) => (e.Banner = "Banner", e.Icon = "Icon", e))(Me || {}), Ve = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Ve || {}), we = /* @__PURE__ */ ((e) => (e.Txt = "TXT", e.Xlsx = "XLSX", e))(we || {}), Be = /* @__PURE__ */ ((e) => (e.Completed = "COMPLETED", e.Failed = "FAILED", e.Initial = "INITIAL", e.Processing = "PROCESSING", e))(Be || {}), Ge = /* @__PURE__ */ ((e) => (e.Collector = "COLLECTOR", e.Event = "EVENT", e.Organization = "ORGANIZATION", e.Payout = "PAYOUT", e.Profit = "PROFIT", e.Promoter = "PROMOTER", e.Seller = "SELLER", e))(Ge || {}), $e = /* @__PURE__ */ ((e) => (e.Admin = "ADMIN", e.CashCollector = "CASH_COLLECTOR", e.Collector = "COLLECTOR", e.EventManager = "EVENT_MANAGER", e.HostingManager = "HOSTING_MANAGER", e.LocationManager = "LOCATION_MANAGER", e.OfflineVendor = "OFFLINE_VENDOR", e.OnlineVendor = "ONLINE_VENDOR", e.OrganizationManager = "ORGANIZATION_MANAGER", e.Scanner = "SCANNER", e))($e || {}), He = /* @__PURE__ */ ((e) => (e.Day = "DAY", e.Hour = "HOUR", e.Minute = "MINUTE", e.Month = "MONTH", e.Quarter = "QUARTER", e.Week = "WEEK", e.Year = "YEAR", e))(He || {}), ze = /* @__PURE__ */ ((e) => (e.Expired = "EXPIRED", e.Valid = "VALID", e))(ze || {}), Ye = /* @__PURE__ */ ((e) => (e.Addons = "ADDONS", e.AppCustomerHistory = "APP_CUSTOMER_HISTORY", e.Arrivals = "ARRIVALS", e.CalculateCashPayout = "CALCULATE_CASH_PAYOUT", e.Cash = "CASH", e.CashHistory = "CASH_HISTORY", e.Collector = "COLLECTOR", e.Commission = "COMMISSION", e.CountryStatistics = "COUNTRY_STATISTICS", e.CustomField = "CUSTOM_FIELD", e.DepositPrice = "DEPOSIT_PRICE", e.DetailStatistics = "DETAIL_STATISTICS", e.DiscountPrice = "DISCOUNT_PRICE", e.DoorSale = "DOOR_SALE", e.DynamicEvents = "DYNAMIC_EVENTS", e.EmailMarketing = "EMAIL_MARKETING", e.EventCapacity = "EVENT_CAPACITY", e.EventDeliveryOptions = "EVENT_DELIVERY_OPTIONS", e.EventPercentage = "EVENT_PERCENTAGE", e.EventSeatsIntegration = "EVENT_SEATS_INTEGRATION", e.GroupTickets = "GROUP_TICKETS", e.Guest = "GUEST", e.Hosting = "HOSTING", e.Location = "LOCATION", e.Marketing = "MARKETING", e.MobileRefund = "MOBILE_REFUND", e.OrderDetail = "ORDER_DETAIL", e.OrderPending = "ORDER_PENDING", e.OrderRefund = "ORDER_REFUND", e.Override = "OVERRIDE", e.Package = "PACKAGE", e.PaidInAdvance = "PAID_IN_ADVANCE", e.ProductAdditionalInfo = "PRODUCT_ADDITIONAL_INFO", e.ProductPurchasePrice = "PRODUCT_PURCHASE_PRICE", e.Promoter = "PROMOTER", e.Reporting = "REPORTING", e.Role = "ROLE", e.Shop = "SHOP", e.SingleTickets = "SINGLE_TICKETS", e.TapToPay = "TAP_TO_PAY", e.Team = "TEAM", e.TicketLimit = "TICKET_LIMIT", e.TicketSeller = "TICKET_SELLER", e.Token = "TOKEN", e.ViewStatistics = "VIEW_STATISTICS", e))(Ye || {}), qe = /* @__PURE__ */ ((e) => (e.AddOn = "ADD_ON", e.DeliveryOption = "DELIVERY_OPTION", e.EntranceTicket = "ENTRANCE_TICKET", e))(qe || {}), Ke = /* @__PURE__ */ ((e) => (e.Dashboard = "DASHBOARD", e.Offline = "OFFLINE", e.Online = "ONLINE", e.Ticketswap = "TICKETSWAP", e))(Ke || {}), je = /* @__PURE__ */ ((e) => (e.Canceled = "CANCELED", e.Finalized = "FINALIZED", e.PendingFinalization = "PENDING_FINALIZATION", e))(je || {}), We = /* @__PURE__ */ ((e) => (e.Default = "DEFAULT", e.Door = "DOOR", e.Email = "EMAIL", e.Guest = "GUEST", e.Promoter = "PROMOTER", e.Swap = "SWAP", e.Tracker = "TRACKER", e))(We || {}), Xe = /* @__PURE__ */ ((e) => (e.CustomField = "CUSTOM_FIELD", e.Event = "EVENT", e.Guest = "GUEST", e.Hosting = "HOSTING", e.Location = "LOCATION", e.Marketing = "MARKETING", e.Module = "MODULE", e.Organization = "ORGANIZATION", e.Permission = "PERMISSION", e.Product = "PRODUCT", e.Role = "ROLE", e.Shop = "SHOP", e.Team = "TEAM", e.User = "USER", e))(Xe || {}), U = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(U || {}), Qe = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Concept = "CONCEPT", e.Paused = "PAUSED", e.SoldOut = "SOLD_OUT", e))(Qe || {}), Je = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(Je || {}), Ze = /* @__PURE__ */ ((e) => (e.Fixed = "FIXED", e.Percentage = "PERCENTAGE", e))(Ze || {}), et = /* @__PURE__ */ ((e) => (e.Collect = "COLLECT", e.Initial = "INITIAL", e))(et || {}), tt = /* @__PURE__ */ ((e) => (e.Canceled = "CANCELED", e.ChargedBack = "CHARGED_BACK", e.Denied = "DENIED", e.Expired = "EXPIRED", e.Failure = "FAILURE", e.Paid = "PAID", e.Refunded = "REFUNDED", e.Rejected = "REJECTED", e))(tt || {}), rt = /* @__PURE__ */ ((e) => (e.Cash = "CASH", e.Digital = "DIGITAL", e.Other = "OTHER", e.TapToPay = "TAP_TO_PAY", e))(rt || {}), nt = /* @__PURE__ */ ((e) => (e.AccessDashboard = "ACCESS_DASHBOARD", e.AccessSale = "ACCESS_SALE", e.AccessScan = "ACCESS_SCAN", e.AdminModuleUpdate = "ADMIN_MODULE_UPDATE", e.AdminModuleView = "ADMIN_MODULE_VIEW", e.AdminOrganizationCreate = "ADMIN_ORGANIZATION_CREATE", e.AdminOrganizationDelete = "ADMIN_ORGANIZATION_DELETE", e.AdminOrganizationView = "ADMIN_ORGANIZATION_VIEW", e.AdminPermissionUpdate = "ADMIN_PERMISSION_UPDATE", e.AdminPermissionView = "ADMIN_PERMISSION_VIEW", e.AdminSuper = "ADMIN_SUPER", e.AdminUserCreate = "ADMIN_USER_CREATE", e.AdminUserDelete = "ADMIN_USER_DELETE", e.AdminUserView = "ADMIN_USER_VIEW", e.CashCollectorStatistics = "CASH_COLLECTOR_STATISTICS", e.CashCollectorView = "CASH_COLLECTOR_VIEW", e.CashDepositCreate = "CASH_DEPOSIT_CREATE", e.CashDepositView = "CASH_DEPOSIT_VIEW", e.CashOnHandView = "CASH_ON_HAND_VIEW", e.CollectorManage = "COLLECTOR_MANAGE", e.CollectorStatistics = "COLLECTOR_STATISTICS", e.CollectorView = "COLLECTOR_VIEW", e.CommissionManage = "COMMISSION_MANAGE", e.CommissionPayoutCreate = "COMMISSION_PAYOUT_CREATE", e.CommissionPayoutView = "COMMISSION_PAYOUT_VIEW", e.CommissionStatistics = "COMMISSION_STATISTICS", e.CommissionView = "COMMISSION_VIEW", e.CustomFieldManage = "CUSTOM_FIELD_MANAGE", e.CustomFieldView = "CUSTOM_FIELD_VIEW", e.EmailRuleManage = "EMAIL_RULE_MANAGE", e.EmailRuleStatistics = "EMAIL_RULE_STATISTICS", e.EmailRuleView = "EMAIL_RULE_VIEW", e.EmailRunStatistics = "EMAIL_RUN_STATISTICS", e.EmailRunView = "EMAIL_RUN_VIEW", e.EventManage = "EVENT_MANAGE", e.EventStatistics = "EVENT_STATISTICS", e.EventView = "EVENT_VIEW", e.GuestManage = "GUEST_MANAGE", e.GuestProductManage = "GUEST_PRODUCT_MANAGE", e.GuestProductStatistics = "GUEST_PRODUCT_STATISTICS", e.GuestProductView = "GUEST_PRODUCT_VIEW", e.GuestView = "GUEST_VIEW", e.HostingManage = "HOSTING_MANAGE", e.HostingStatistics = "HOSTING_STATISTICS", e.HostingView = "HOSTING_VIEW", e.LocationManage = "LOCATION_MANAGE", e.LocationStatistics = "LOCATION_STATISTICS", e.LocationView = "LOCATION_VIEW", e.NoteManage = "NOTE_MANAGE", e.NoteView = "NOTE_VIEW", e.OrderCreateDoor = "ORDER_CREATE_DOOR", e.OrderCreateSeller = "ORDER_CREATE_SELLER", e.OrderManage = "ORDER_MANAGE", e.OrderView = "ORDER_VIEW", e.OrganizationManage = "ORGANIZATION_MANAGE", e.OrganizationStatistics = "ORGANIZATION_STATISTICS", e.OrganizationSuper = "ORGANIZATION_SUPER", e.OverrideManage = "OVERRIDE_MANAGE", e.PackageManage = "PACKAGE_MANAGE", e.PackageStatistics = "PACKAGE_STATISTICS", e.PackageView = "PACKAGE_VIEW", e.ProductManage = "PRODUCT_MANAGE", e.ProductStatistics = "PRODUCT_STATISTICS", e.ProductView = "PRODUCT_VIEW", e.PromoterManage = "PROMOTER_MANAGE", e.PromoterStatistics = "PROMOTER_STATISTICS", e.PromoterView = "PROMOTER_VIEW", e.ReportingManage = "REPORTING_MANAGE", e.ReportingView = "REPORTING_VIEW", e.RoleAssign = "ROLE_ASSIGN", e.RoleManage = "ROLE_MANAGE", e.RoleView = "ROLE_VIEW", e.SellerManage = "SELLER_MANAGE", e.SellerStatistics = "SELLER_STATISTICS", e.SellerView = "SELLER_VIEW", e.ShopManage = "SHOP_MANAGE", e.ShopView = "SHOP_VIEW", e.TeamManage = "TEAM_MANAGE", e.TeamStatistics = "TEAM_STATISTICS", e.TeamUserInvite = "TEAM_USER_INVITE", e.TeamUserRemove = "TEAM_USER_REMOVE", e.TeamView = "TEAM_VIEW", e.TemplateManage = "TEMPLATE_MANAGE", e.TemplateView = "TEMPLATE_VIEW", e.TicketLimitManage = "TICKET_LIMIT_MANAGE", e.TicketLimitView = "TICKET_LIMIT_VIEW", e.TokenManage = "TOKEN_MANAGE", e.TokenView = "TOKEN_VIEW", e.TrackerManage = "TRACKER_MANAGE", e.TrackerStatistics = "TRACKER_STATISTICS", e.TrackerView = "TRACKER_VIEW", e.UserInviteManage = "USER_INVITE_MANAGE", e.UserInviteView = "USER_INVITE_VIEW", e.UserManage = "USER_MANAGE", e.UserView = "USER_VIEW", e))(nt || {}), it = /* @__PURE__ */ ((e) => (e.AllReserved = "ALL_RESERVED", e.Available = "AVAILABLE", e.SoldOut = "SOLD_OUT", e))(it || {}), st = /* @__PURE__ */ ((e) => (e.Addon = "ADDON", e.Delivery = "DELIVERY", e.Door = "DOOR", e.Friend = "FRIEND", e.Guest = "GUEST", e.Pickup = "PICKUP", e.Promoter = "PROMOTER", e.Ticket = "TICKET", e))(st || {}), at = /* @__PURE__ */ ((e) => (e.Other = "OTHER", e.Ticketapp = "TICKETAPP", e))(at || {}), ot = /* @__PURE__ */ ((e) => (e.Email = "EMAIL", e.Phone = "PHONE", e))(ot || {}), dt = /* @__PURE__ */ ((e) => (e.Cancelled = "CANCELLED", e.Completed = "COMPLETED", e.Failed = "FAILED", e.Pending = "PENDING", e.Processing = "PROCESSING", e))(dt || {}), ct = /* @__PURE__ */ ((e) => (e.Csv = "CSV", e.Txt = "TXT", e))(ct || {}), ut = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(ut || {}), lt = /* @__PURE__ */ ((e) => (e.NonPaid = "NON_PAID", e.Paid = "PAID", e))(lt || {}), ht = /* @__PURE__ */ ((e) => (e.CashCollector = "CASH_COLLECTOR", e.Collector = "COLLECTOR", e.CommissionPayouts = "COMMISSION_PAYOUTS", e.GuestManager = "GUEST_MANAGER", e.OfflineVendor = "OFFLINE_VENDOR", e.OnlineVendor = "ONLINE_VENDOR", e))(ht || {}), Et = /* @__PURE__ */ ((e) => (e.Offline = "OFFLINE", e.Online = "ONLINE", e))(Et || {}), It = /* @__PURE__ */ ((e) => (e.Door = "DOOR", e.Promoter = "PROMOTER", e.Seller = "SELLER", e.Web = "WEB", e))(It || {}), pt = /* @__PURE__ */ ((e) => (e.AlreadyScanned = "ALREADY_SCANNED", e.AlreadyScannedByGroup = "ALREADY_SCANNED_BY_GROUP", e.InvalidDate = "INVALID_DATE", e.MaxScanAmountReached = "MAX_SCAN_AMOUNT_REACHED", e.NotFinalized = "NOT_FINALIZED", e.NotFoundForEvent = "NOT_FOUND_FOR_EVENT", e.TicketSwapped = "TICKET_SWAPPED", e))(pt || {}), gt = /* @__PURE__ */ ((e) => (e.Default = "DEFAULT", e.Transparent = "TRANSPARENT", e))(gt || {}), ft = /* @__PURE__ */ ((e) => (e.Calendar = "CALENDAR", e.Large = "LARGE", e.Small = "SMALL", e))(ft || {}), At = /* @__PURE__ */ ((e) => (e.Asc = "ASC", e.Desc = "DESC", e))(At || {}), mt = /* @__PURE__ */ ((e) => (e.Canceled = "CANCELED", e.CashTransaction = "CASH_TRANSACTION", e.CashTransactionDeposit = "CASH_TRANSACTION_DEPOSIT", e.Collect = "COLLECT", e.Commission = "COMMISSION", e.CommissionPayout = "COMMISSION_PAYOUT", e.Refunded = "REFUNDED", e.Sale = "SALE", e.Scan = "SCAN", e))(mt || {}), Ot = /* @__PURE__ */ ((e) => (e.Past = "PAST", e.Upcoming = "UPCOMING", e))(Ot || {}), Tt = /* @__PURE__ */ ((e) => (e.Collector = "COLLECTOR", e.Offline = "OFFLINE", e.Online = "ONLINE", e))(Tt || {}), Nt = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Expired = "EXPIRED", e.Inactive = "INACTIVE", e))(Nt || {}), Dt = /* @__PURE__ */ ((e) => (e.Team = "TEAM", e.User = "USER", e))(Dt || {}), _t = /* @__PURE__ */ ((e) => (e.Event = "EVENT", e.Hosting = "HOSTING", e.Location = "LOCATION", e.Package = "PACKAGE", e))(_t || {}), Rt = /* @__PURE__ */ ((e) => (e.FullyPickedUp = "FULLY_PICKED_UP", e.NotPicketUp = "NOT_PICKET_UP", e.PartialPicketUp = "PARTIAL_PICKET_UP", e))(Rt || {}), vt = /* @__PURE__ */ ((e) => (e.Email = "EMAIL", e.Facebook = "FACEBOOK", e.Instagram = "INSTAGRAM", e.Qr = "QR", e.Sms = "SMS", e.Snapchat = "SNAPCHAT", e.Tiktok = "TIKTOK", e.Twitter = "TWITTER", e.Website = "WEBSITE", e))(vt || {}), Lt = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e))(Lt || {}), Pt = /* @__PURE__ */ ((e) => (e.Default = "DEFAULT", e.DiscountedPrices = "DISCOUNTED_PRICES", e.DiscountedProducts = "DISCOUNTED_PRODUCTS", e))(Pt || {}), kt = /* @__PURE__ */ ((e) => (e.Active = "ACTIVE", e.Inactive = "INACTIVE", e.Invited = "INVITED", e))(kt || {});
|
|
2308
|
+
const Ct = E`
|
|
2298
2309
|
query findActiveOrderById($id: String) {
|
|
2299
2310
|
findOrder(id: $id) {
|
|
2300
2311
|
id
|
|
@@ -2368,7 +2379,7 @@ const yt = I`
|
|
|
2368
2379
|
}
|
|
2369
2380
|
}
|
|
2370
2381
|
}
|
|
2371
|
-
`,
|
|
2382
|
+
`, St = E`
|
|
2372
2383
|
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID!, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2373
2384
|
reserveProduct(
|
|
2374
2385
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
@@ -2378,7 +2389,7 @@ const yt = I`
|
|
|
2378
2389
|
amountReserved
|
|
2379
2390
|
}
|
|
2380
2391
|
}
|
|
2381
|
-
`,
|
|
2392
|
+
`, xt = E`
|
|
2382
2393
|
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2383
2394
|
releaseProduct(
|
|
2384
2395
|
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
@@ -2387,7 +2398,7 @@ const yt = I`
|
|
|
2387
2398
|
amountReleased
|
|
2388
2399
|
}
|
|
2389
2400
|
}
|
|
2390
|
-
`,
|
|
2401
|
+
`, bt = E`
|
|
2391
2402
|
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID!, $trackerId: ID) {
|
|
2392
2403
|
configurePackage(
|
|
2393
2404
|
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
@@ -2397,21 +2408,21 @@ const yt = I`
|
|
|
2397
2408
|
amountReserved
|
|
2398
2409
|
}
|
|
2399
2410
|
}
|
|
2400
|
-
`,
|
|
2411
|
+
`, Ft = E`
|
|
2401
2412
|
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2402
2413
|
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2403
2414
|
}
|
|
2404
|
-
`,
|
|
2415
|
+
`, yt = E`
|
|
2405
2416
|
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2406
2417
|
createOrderCustomer(
|
|
2407
2418
|
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2408
2419
|
)
|
|
2409
2420
|
}
|
|
2410
|
-
`,
|
|
2421
|
+
`, Ut = E`
|
|
2411
2422
|
mutation deleteOrder($orderId: ID!) {
|
|
2412
2423
|
cancelOrder(id: $orderId)
|
|
2413
2424
|
}
|
|
2414
|
-
`,
|
|
2425
|
+
`, Mt = E`
|
|
2415
2426
|
query EventOverviewPage($organizationId: ID!, $locationIds: [String!], $hostingIds: [String!], $trackerId: String, $showDoorTickets: Boolean) {
|
|
2416
2427
|
findAllPublicEventByOrganizationId(
|
|
2417
2428
|
id: $organizationId
|
|
@@ -2444,7 +2455,7 @@ const yt = I`
|
|
|
2444
2455
|
}
|
|
2445
2456
|
}
|
|
2446
2457
|
}
|
|
2447
|
-
`,
|
|
2458
|
+
`, Vt = E`
|
|
2448
2459
|
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
2449
2460
|
findPublicProductsByEventId(
|
|
2450
2461
|
eventId: $eventId
|
|
@@ -2478,7 +2489,227 @@ const yt = I`
|
|
|
2478
2489
|
showEndSalesAtTag
|
|
2479
2490
|
}
|
|
2480
2491
|
}
|
|
2481
|
-
`,
|
|
2492
|
+
`, wt = E`
|
|
2493
|
+
query findAllPackages($page: PageInput, $tab: PackageTabType, $statuses: [PackageStatus!]) {
|
|
2494
|
+
findAllPackages(page: $page, tab: $tab, statuses: $statuses) {
|
|
2495
|
+
data {
|
|
2496
|
+
id
|
|
2497
|
+
slug
|
|
2498
|
+
status
|
|
2499
|
+
name
|
|
2500
|
+
description
|
|
2501
|
+
shortTitle
|
|
2502
|
+
shortDescription
|
|
2503
|
+
startAvailabilityAt
|
|
2504
|
+
endAvailabilityAt
|
|
2505
|
+
maxAmountOfPersonsPerOrder
|
|
2506
|
+
icon
|
|
2507
|
+
banner
|
|
2508
|
+
currency
|
|
2509
|
+
amountOfEvents
|
|
2510
|
+
amountOfAddons
|
|
2511
|
+
prices {
|
|
2512
|
+
price
|
|
2513
|
+
deposit
|
|
2514
|
+
discount
|
|
2515
|
+
serviceFee
|
|
2516
|
+
}
|
|
2517
|
+
allowedPaymentTypes
|
|
2518
|
+
}
|
|
2519
|
+
count
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
`, Bt = E`
|
|
2523
|
+
query findAllPackageItems($packageId: ID!, $types: [PackageItemType!]) {
|
|
2524
|
+
findAllPackageItems(packageId: $packageId, types: $types) {
|
|
2525
|
+
data {
|
|
2526
|
+
id
|
|
2527
|
+
name
|
|
2528
|
+
description
|
|
2529
|
+
type
|
|
2530
|
+
price
|
|
2531
|
+
depositPrice
|
|
2532
|
+
discountPrice
|
|
2533
|
+
serviceFee
|
|
2534
|
+
banner
|
|
2535
|
+
package {
|
|
2536
|
+
id
|
|
2537
|
+
name
|
|
2538
|
+
}
|
|
2539
|
+
activeEvents {
|
|
2540
|
+
id
|
|
2541
|
+
name
|
|
2542
|
+
startAt
|
|
2543
|
+
endAt
|
|
2544
|
+
timezone
|
|
2545
|
+
icon
|
|
2546
|
+
banner
|
|
2547
|
+
location {
|
|
2548
|
+
id
|
|
2549
|
+
name
|
|
2550
|
+
address
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
count
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
`, Gt = E`
|
|
2558
|
+
mutation setPackageItemToOrder($sessionId: ID!, $amount: Int!, $items: [SetPackageItem!]!) {
|
|
2559
|
+
setPackageItemToOrder(
|
|
2560
|
+
input: {sessionId: $sessionId, amount: $amount, items: $items}
|
|
2561
|
+
) {
|
|
2562
|
+
id
|
|
2563
|
+
currency
|
|
2564
|
+
items {
|
|
2565
|
+
id
|
|
2566
|
+
price
|
|
2567
|
+
depositPrice
|
|
2568
|
+
originalPrice
|
|
2569
|
+
serviceFee
|
|
2570
|
+
amount
|
|
2571
|
+
expiredAt
|
|
2572
|
+
event {
|
|
2573
|
+
id
|
|
2574
|
+
name
|
|
2575
|
+
startAt
|
|
2576
|
+
endAt
|
|
2577
|
+
timezone
|
|
2578
|
+
icon
|
|
2579
|
+
banner
|
|
2580
|
+
location {
|
|
2581
|
+
id
|
|
2582
|
+
name
|
|
2583
|
+
address
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
product {
|
|
2587
|
+
id
|
|
2588
|
+
name
|
|
2589
|
+
icon
|
|
2590
|
+
description
|
|
2591
|
+
type
|
|
2592
|
+
}
|
|
2593
|
+
packageItem {
|
|
2594
|
+
id
|
|
2595
|
+
name
|
|
2596
|
+
type
|
|
2597
|
+
package {
|
|
2598
|
+
id
|
|
2599
|
+
name
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
seats {
|
|
2603
|
+
id
|
|
2604
|
+
label
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
`, $t = E`
|
|
2610
|
+
mutation setAdditionalPackageItemToOrder($sessionId: ID!, $packageItemId: ID!, $eventId: ID!, $amount: Int!) {
|
|
2611
|
+
setAdditionalPackageItemToOrder(
|
|
2612
|
+
input: {sessionId: $sessionId, packageItemId: $packageItemId, eventId: $eventId, amount: $amount}
|
|
2613
|
+
) {
|
|
2614
|
+
id
|
|
2615
|
+
currency
|
|
2616
|
+
items {
|
|
2617
|
+
id
|
|
2618
|
+
price
|
|
2619
|
+
depositPrice
|
|
2620
|
+
originalPrice
|
|
2621
|
+
serviceFee
|
|
2622
|
+
amount
|
|
2623
|
+
expiredAt
|
|
2624
|
+
event {
|
|
2625
|
+
id
|
|
2626
|
+
name
|
|
2627
|
+
startAt
|
|
2628
|
+
endAt
|
|
2629
|
+
timezone
|
|
2630
|
+
}
|
|
2631
|
+
product {
|
|
2632
|
+
id
|
|
2633
|
+
name
|
|
2634
|
+
type
|
|
2635
|
+
}
|
|
2636
|
+
packageItem {
|
|
2637
|
+
id
|
|
2638
|
+
name
|
|
2639
|
+
type
|
|
2640
|
+
package {
|
|
2641
|
+
id
|
|
2642
|
+
name
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
`, Ht = E`
|
|
2649
|
+
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
2650
|
+
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
2651
|
+
data {
|
|
2652
|
+
id
|
|
2653
|
+
slug
|
|
2654
|
+
status
|
|
2655
|
+
name
|
|
2656
|
+
description
|
|
2657
|
+
shortTitle
|
|
2658
|
+
shortDescription
|
|
2659
|
+
startAvailabilityAt
|
|
2660
|
+
endAvailabilityAt
|
|
2661
|
+
maxAmountOfPersonsPerOrder
|
|
2662
|
+
icon
|
|
2663
|
+
banner
|
|
2664
|
+
currency
|
|
2665
|
+
amountOfEvents
|
|
2666
|
+
amountOfAddons
|
|
2667
|
+
prices {
|
|
2668
|
+
price
|
|
2669
|
+
deposit
|
|
2670
|
+
discount
|
|
2671
|
+
serviceFee
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
count
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
`, zt = E`
|
|
2678
|
+
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
2679
|
+
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
2680
|
+
data {
|
|
2681
|
+
id
|
|
2682
|
+
name
|
|
2683
|
+
description
|
|
2684
|
+
type
|
|
2685
|
+
price
|
|
2686
|
+
depositPrice
|
|
2687
|
+
discountPrice
|
|
2688
|
+
serviceFee
|
|
2689
|
+
banner
|
|
2690
|
+
package {
|
|
2691
|
+
id
|
|
2692
|
+
name
|
|
2693
|
+
}
|
|
2694
|
+
activeEvents {
|
|
2695
|
+
id
|
|
2696
|
+
name
|
|
2697
|
+
startAt
|
|
2698
|
+
endAt
|
|
2699
|
+
timezone
|
|
2700
|
+
icon
|
|
2701
|
+
banner
|
|
2702
|
+
location {
|
|
2703
|
+
id
|
|
2704
|
+
name
|
|
2705
|
+
address
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
count
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
`, Yt = E`
|
|
2482
2713
|
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
|
|
2483
2714
|
findPaymentDetails(
|
|
2484
2715
|
orderId: $orderId
|
|
@@ -2505,93 +2736,188 @@ const yt = I`
|
|
|
2505
2736
|
additionalTransactionFee
|
|
2506
2737
|
}
|
|
2507
2738
|
}
|
|
2508
|
-
`,
|
|
2739
|
+
`, qt = E`
|
|
2509
2740
|
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
2510
2741
|
createDigitalOrderPayment(input: $input)
|
|
2511
2742
|
}
|
|
2512
|
-
`,
|
|
2513
|
-
function
|
|
2743
|
+
`, Kr = (e, t, r, i) => e();
|
|
2744
|
+
function S(e, t = Kr) {
|
|
2514
2745
|
return {
|
|
2515
|
-
findActiveOrderById(r,
|
|
2516
|
-
return
|
|
2746
|
+
findActiveOrderById(r, i, n) {
|
|
2747
|
+
return t((s) => e.request({ document: Ct, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findActiveOrderById", "query", r);
|
|
2748
|
+
},
|
|
2749
|
+
addToOrder(r, i, n) {
|
|
2750
|
+
return t((s) => e.request({ document: St, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "addToOrder", "mutation", r);
|
|
2751
|
+
},
|
|
2752
|
+
removeFromOrder(r, i, n) {
|
|
2753
|
+
return t((s) => e.request({ document: xt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "removeFromOrder", "mutation", r);
|
|
2754
|
+
},
|
|
2755
|
+
configurePackage(r, i, n) {
|
|
2756
|
+
return t((s) => e.request({ document: bt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "configurePackage", "mutation", r);
|
|
2517
2757
|
},
|
|
2518
|
-
|
|
2519
|
-
return
|
|
2758
|
+
configureOrderDeliveryOption(r, i, n) {
|
|
2759
|
+
return t((s) => e.request({ document: Ft, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "configureOrderDeliveryOption", "mutation", r);
|
|
2520
2760
|
},
|
|
2521
|
-
|
|
2522
|
-
return
|
|
2761
|
+
createOrderCustomer(r, i, n) {
|
|
2762
|
+
return t((s) => e.request({ document: yt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "createOrderCustomer", "mutation", r);
|
|
2523
2763
|
},
|
|
2524
|
-
|
|
2525
|
-
return
|
|
2764
|
+
deleteOrder(r, i, n) {
|
|
2765
|
+
return t((s) => e.request({ document: Ut, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "deleteOrder", "mutation", r);
|
|
2526
2766
|
},
|
|
2527
|
-
|
|
2528
|
-
return
|
|
2767
|
+
EventOverviewPage(r, i, n) {
|
|
2768
|
+
return t((s) => e.request({ document: Mt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "EventOverviewPage", "query", r);
|
|
2529
2769
|
},
|
|
2530
|
-
|
|
2531
|
-
return
|
|
2770
|
+
findProductsByEventId(r, i, n) {
|
|
2771
|
+
return t((s) => e.request({ document: Vt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findProductsByEventId", "query", r);
|
|
2532
2772
|
},
|
|
2533
|
-
|
|
2534
|
-
return
|
|
2773
|
+
findAllPackages(r, i, n) {
|
|
2774
|
+
return t((s) => e.request({ document: wt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findAllPackages", "query", r);
|
|
2535
2775
|
},
|
|
2536
|
-
|
|
2537
|
-
return
|
|
2776
|
+
findAllPackageItems(r, i, n) {
|
|
2777
|
+
return t((s) => e.request({ document: Bt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findAllPackageItems", "query", r);
|
|
2538
2778
|
},
|
|
2539
|
-
|
|
2540
|
-
return
|
|
2779
|
+
setPackageItemToOrder(r, i, n) {
|
|
2780
|
+
return t((s) => e.request({ document: Gt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "setPackageItemToOrder", "mutation", r);
|
|
2541
2781
|
},
|
|
2542
|
-
|
|
2543
|
-
return
|
|
2782
|
+
setAdditionalPackageItemToOrder(r, i, n) {
|
|
2783
|
+
return t((s) => e.request({ document: $t, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "setAdditionalPackageItemToOrder", "mutation", r);
|
|
2544
2784
|
},
|
|
2545
|
-
|
|
2546
|
-
return
|
|
2785
|
+
findAllPublicPackagesByOrganizationId(r, i, n) {
|
|
2786
|
+
return t((s) => e.request({ document: Ht, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findAllPublicPackagesByOrganizationId", "query", r);
|
|
2787
|
+
},
|
|
2788
|
+
findPublicItemsByPackageId(r, i, n) {
|
|
2789
|
+
return t((s) => e.request({ document: zt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findPublicItemsByPackageId", "query", r);
|
|
2790
|
+
},
|
|
2791
|
+
findPaymentMethods(r, i, n) {
|
|
2792
|
+
return t((s) => e.request({ document: Yt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "findPaymentMethods", "query", r);
|
|
2793
|
+
},
|
|
2794
|
+
createDigitalPayment(r, i, n) {
|
|
2795
|
+
return t((s) => e.request({ document: qt, variables: r, requestHeaders: { ...i, ...s }, signal: n }), "createDigitalPayment", "mutation", r);
|
|
2547
2796
|
}
|
|
2548
2797
|
};
|
|
2549
2798
|
}
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2799
|
+
const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2800
|
+
__proto__: null,
|
|
2801
|
+
AddToOrderDocument: St,
|
|
2802
|
+
CacheControlScope: Pe,
|
|
2803
|
+
CategoryType: ke,
|
|
2804
|
+
CommissionPriceType: Ce,
|
|
2805
|
+
CommissionTierApplicationMethod: Se,
|
|
2806
|
+
CommissionTierCalculationScope: xe,
|
|
2807
|
+
CommissionType: be,
|
|
2808
|
+
ConfigureOrderDeliveryOptionDocument: Ft,
|
|
2809
|
+
ConfigurePackageDocument: bt,
|
|
2810
|
+
CreateDigitalPaymentDocument: qt,
|
|
2811
|
+
CreateOrderCustomerDocument: yt,
|
|
2812
|
+
Currency: Fe,
|
|
2813
|
+
CustomFieldMandatoryType: ye,
|
|
2814
|
+
CustomFieldType: Ue,
|
|
2815
|
+
DeleteOrderDocument: Ut,
|
|
2816
|
+
EventContentType: Me,
|
|
2817
|
+
EventOverviewPageDocument: Mt,
|
|
2818
|
+
EventStatus: Ve,
|
|
2819
|
+
ExportFormatType: we,
|
|
2820
|
+
ExportStatus: Be,
|
|
2821
|
+
ExportType: Ge,
|
|
2822
|
+
FindActiveOrderByIdDocument: Ct,
|
|
2823
|
+
FindAllPackageItemsDocument: Bt,
|
|
2824
|
+
FindAllPackagesDocument: wt,
|
|
2825
|
+
FindAllPublicPackagesByOrganizationIdDocument: Ht,
|
|
2826
|
+
FindPaymentMethodsDocument: Yt,
|
|
2827
|
+
FindProductsByEventIdDocument: Vt,
|
|
2828
|
+
FindPublicItemsByPackageIdDocument: zt,
|
|
2829
|
+
GlobalRoleType: $e,
|
|
2830
|
+
IntervalType: He,
|
|
2831
|
+
InviteStatus: ze,
|
|
2832
|
+
ModuleScope: Ye,
|
|
2833
|
+
OrderItemType: qe,
|
|
2834
|
+
OrderSaleLocation: Ke,
|
|
2835
|
+
OrderTicketStatus: je,
|
|
2836
|
+
OrderType: We,
|
|
2837
|
+
OverrideType: Xe,
|
|
2838
|
+
PackageItemType: U,
|
|
2839
|
+
PackageStatus: Qe,
|
|
2840
|
+
PackageTabType: Je,
|
|
2841
|
+
PaymentMethodFeeType: Ze,
|
|
2842
|
+
PaymentSalesType: et,
|
|
2843
|
+
PaymentStatus: tt,
|
|
2844
|
+
PaymentType: rt,
|
|
2845
|
+
PermissionScope: nt,
|
|
2846
|
+
ProductStatus: it,
|
|
2847
|
+
ProductType: st,
|
|
2848
|
+
RefundType: at,
|
|
2849
|
+
RemoveFromOrderDocument: xt,
|
|
2850
|
+
ReportDeliveryMethod: ot,
|
|
2851
|
+
ReportExecutionStatus: dt,
|
|
2852
|
+
ReportFormat: ct,
|
|
2853
|
+
ReportStatus: ut,
|
|
2854
|
+
RevenueType: lt,
|
|
2855
|
+
RoleType: ht,
|
|
2856
|
+
SalesLocations: Et,
|
|
2857
|
+
SalesType: It,
|
|
2858
|
+
ScannedTicketStatus: pt,
|
|
2859
|
+
SetAdditionalPackageItemToOrderDocument: $t,
|
|
2860
|
+
SetPackageItemToOrderDocument: Gt,
|
|
2861
|
+
ShopTemplateType: gt,
|
|
2862
|
+
ShopVariationType: ft,
|
|
2863
|
+
SortOrder: At,
|
|
2864
|
+
StatisticType: mt,
|
|
2865
|
+
TabType: Ot,
|
|
2866
|
+
TeamType: Tt,
|
|
2867
|
+
TerminalStatus: Nt,
|
|
2868
|
+
TicketLimitAppliedForType: Dt,
|
|
2869
|
+
TicketLimitType: _t,
|
|
2870
|
+
TicketStatus: Rt,
|
|
2871
|
+
TrackerMediaType: vt,
|
|
2872
|
+
TrackerTabType: Lt,
|
|
2873
|
+
TrackerType: Pt,
|
|
2874
|
+
UserStatus: kt,
|
|
2875
|
+
getSdk: S
|
|
2876
|
+
}, Symbol.toStringTag, { value: "Module" })), Wr = "https://api.ticketapp.com/graphql";
|
|
2877
|
+
class Kt {
|
|
2552
2878
|
config;
|
|
2553
2879
|
sdk;
|
|
2554
2880
|
store;
|
|
2555
|
-
constructor(
|
|
2881
|
+
constructor(t) {
|
|
2556
2882
|
this.config = {
|
|
2557
|
-
...
|
|
2558
|
-
}, this.store =
|
|
2883
|
+
...t
|
|
2884
|
+
}, this.store = ue({
|
|
2559
2885
|
reducer: {
|
|
2560
|
-
event:
|
|
2886
|
+
event: pe
|
|
2561
2887
|
}
|
|
2562
2888
|
});
|
|
2563
|
-
const r = new
|
|
2564
|
-
this.sdk =
|
|
2889
|
+
const r = new M(t.apiUrl ?? Wr);
|
|
2890
|
+
this.sdk = S(r);
|
|
2565
2891
|
}
|
|
2566
2892
|
getState() {
|
|
2567
2893
|
return this.store.getState().event;
|
|
2568
2894
|
}
|
|
2569
|
-
subscribe(
|
|
2570
|
-
return this.store.subscribe(
|
|
2895
|
+
subscribe(t) {
|
|
2896
|
+
return this.store.subscribe(t);
|
|
2571
2897
|
}
|
|
2572
|
-
debugLog(
|
|
2573
|
-
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${
|
|
2898
|
+
debugLog(t, r) {
|
|
2899
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, r || "");
|
|
2574
2900
|
}
|
|
2575
2901
|
async fetchEvents() {
|
|
2576
|
-
this.store.dispatch(
|
|
2902
|
+
this.store.dispatch(H(!0));
|
|
2577
2903
|
try {
|
|
2578
|
-
const
|
|
2904
|
+
const t = sessionStorage.getItem("TIC_TRACKER_ID") || void 0;
|
|
2579
2905
|
this.debugLog("Fetching events with parameters", {
|
|
2580
2906
|
organizationId: this.config.organizationId,
|
|
2581
2907
|
locationIds: this.config.filteredLocationIds,
|
|
2582
2908
|
hostingIds: this.config.filteredHostingIds,
|
|
2583
|
-
trackerId:
|
|
2909
|
+
trackerId: t,
|
|
2584
2910
|
showDoorTickets: this.config.enableDoorTickets
|
|
2585
2911
|
});
|
|
2586
2912
|
const r = await this.sdk.EventOverviewPage({
|
|
2587
2913
|
organizationId: this.config.organizationId,
|
|
2588
2914
|
locationIds: this.config.filteredLocationIds,
|
|
2589
2915
|
hostingIds: this.config.filteredHostingIds,
|
|
2590
|
-
trackerId:
|
|
2916
|
+
trackerId: t,
|
|
2591
2917
|
showDoorTickets: this.config.enableDoorTickets
|
|
2592
2918
|
});
|
|
2593
2919
|
if (this.debugLog("Raw GraphQL response", r), r?.findAllPublicEventByOrganizationId?.data) {
|
|
2594
|
-
const
|
|
2920
|
+
const i = r.findAllPublicEventByOrganizationId.data.map((n) => ({
|
|
2595
2921
|
id: n.id,
|
|
2596
2922
|
name: n.name,
|
|
2597
2923
|
icon: n.icon ?? null,
|
|
@@ -2599,8 +2925,8 @@ class Vt {
|
|
|
2599
2925
|
description: n.description ?? null,
|
|
2600
2926
|
addonDescription: n.addonDescription ?? null,
|
|
2601
2927
|
infoDescription: n.infoDescription ?? null,
|
|
2602
|
-
startAt:
|
|
2603
|
-
endAt:
|
|
2928
|
+
startAt: _.fromISO(n.startAt, { zone: n.timezone }),
|
|
2929
|
+
endAt: _.fromISO(n.endAt, { zone: n.timezone }),
|
|
2604
2930
|
timezone: n.timezone,
|
|
2605
2931
|
startSalesAt: n.startSalesAt ?? null,
|
|
2606
2932
|
endSalesAt: n.endSalesAt ?? null,
|
|
@@ -2614,88 +2940,88 @@ class Vt {
|
|
|
2614
2940
|
} : { id: "", name: "", address: null },
|
|
2615
2941
|
products: []
|
|
2616
2942
|
}));
|
|
2617
|
-
this.debugLog("Processed events", { events:
|
|
2943
|
+
this.debugLog("Processed events", { events: i, count: i.length }), this.store.dispatch(z(i)), this.debugLog("Redux state after setEvents", this.getState());
|
|
2618
2944
|
} else
|
|
2619
|
-
this.debugLog("No events found in response"), this.store.dispatch(
|
|
2620
|
-
} catch (
|
|
2621
|
-
throw this.debugLog("Error fetching events",
|
|
2945
|
+
this.debugLog("No events found in response"), this.store.dispatch(z([]));
|
|
2946
|
+
} catch (t) {
|
|
2947
|
+
throw this.debugLog("Error fetching events", t), this.store.dispatch(he(t.message || "Failed to fetch events")), t;
|
|
2622
2948
|
} finally {
|
|
2623
|
-
this.store.dispatch(
|
|
2949
|
+
this.store.dispatch(H(!1));
|
|
2624
2950
|
}
|
|
2625
2951
|
}
|
|
2626
|
-
async fetchProductsForEvent(
|
|
2627
|
-
this.store.dispatch(
|
|
2952
|
+
async fetchProductsForEvent(t, r, i) {
|
|
2953
|
+
this.store.dispatch(Y({ eventId: t, loading: !0 }));
|
|
2628
2954
|
try {
|
|
2629
|
-
const n = sessionStorage.getItem("TIC_TRACKER_ID") || void 0,
|
|
2955
|
+
const n = sessionStorage.getItem("TIC_TRACKER_ID") || void 0, s = this.config.enableDoorTickets && r ? r : void 0;
|
|
2630
2956
|
this.debugLog("Fetching products for event", {
|
|
2631
|
-
eventId:
|
|
2632
|
-
promoCode:
|
|
2957
|
+
eventId: t,
|
|
2958
|
+
promoCode: i,
|
|
2633
2959
|
trackerId: n,
|
|
2634
|
-
productTypes:
|
|
2960
|
+
productTypes: s
|
|
2635
2961
|
});
|
|
2636
|
-
const
|
|
2637
|
-
eventId:
|
|
2638
|
-
promoCode:
|
|
2962
|
+
const o = await this.sdk.findProductsByEventId({
|
|
2963
|
+
eventId: t,
|
|
2964
|
+
promoCode: i,
|
|
2639
2965
|
trackerId: n,
|
|
2640
|
-
productTypes:
|
|
2966
|
+
productTypes: s
|
|
2641
2967
|
});
|
|
2642
|
-
if (
|
|
2643
|
-
const
|
|
2968
|
+
if (o?.findPublicProductsByEventId) {
|
|
2969
|
+
const c = o.findPublicProductsByEventId.map((l) => ({
|
|
2644
2970
|
...l
|
|
2645
2971
|
}));
|
|
2646
2972
|
return this.debugLog("Products fetched", {
|
|
2647
|
-
eventId:
|
|
2648
|
-
count:
|
|
2649
|
-
types:
|
|
2650
|
-
}), this.store.dispatch(
|
|
2973
|
+
eventId: t,
|
|
2974
|
+
count: c.length,
|
|
2975
|
+
types: c.map((l) => l.type)
|
|
2976
|
+
}), this.store.dispatch(Ee({ eventId: t, products: c })), c;
|
|
2651
2977
|
}
|
|
2652
2978
|
return;
|
|
2653
2979
|
} catch (n) {
|
|
2654
|
-
throw this.debugLog("Error fetching products", { eventId:
|
|
2980
|
+
throw this.debugLog("Error fetching products", { eventId: t, error: n }), n;
|
|
2655
2981
|
} finally {
|
|
2656
|
-
this.store.dispatch(
|
|
2982
|
+
this.store.dispatch(Y({ eventId: t, loading: !1 }));
|
|
2657
2983
|
}
|
|
2658
2984
|
}
|
|
2659
2985
|
clearEvents() {
|
|
2660
|
-
this.debugLog("Clearing events"), this.store.dispatch(
|
|
2986
|
+
this.debugLog("Clearing events"), this.store.dispatch(Ie());
|
|
2661
2987
|
}
|
|
2662
2988
|
}
|
|
2663
|
-
const
|
|
2664
|
-
class
|
|
2989
|
+
const Xr = "https://api.ticketapp.com/graphql";
|
|
2990
|
+
class jt {
|
|
2665
2991
|
config;
|
|
2666
2992
|
sdk;
|
|
2667
|
-
constructor(
|
|
2668
|
-
this.config =
|
|
2669
|
-
const r = new
|
|
2670
|
-
headers:
|
|
2993
|
+
constructor(t = {}) {
|
|
2994
|
+
this.config = t;
|
|
2995
|
+
const r = new M(t.apiUrl ?? Xr, {
|
|
2996
|
+
headers: t.headers
|
|
2671
2997
|
});
|
|
2672
|
-
this.sdk =
|
|
2998
|
+
this.sdk = S(r);
|
|
2673
2999
|
}
|
|
2674
|
-
debugLog(
|
|
2675
|
-
this.config.debug && console.log(`[PaymentService] ${
|
|
3000
|
+
debugLog(t, r) {
|
|
3001
|
+
this.config.debug && console.log(`[PaymentService] ${t}`, r || "");
|
|
2676
3002
|
}
|
|
2677
|
-
async getPaymentMethods(
|
|
2678
|
-
this.debugLog("Fetching payment methods",
|
|
3003
|
+
async getPaymentMethods(t) {
|
|
3004
|
+
this.debugLog("Fetching payment methods", t);
|
|
2679
3005
|
try {
|
|
2680
3006
|
const r = await this.sdk.findPaymentMethods({
|
|
2681
|
-
orderId:
|
|
2682
|
-
orderItemId:
|
|
2683
|
-
amountOfTickets:
|
|
2684
|
-
paymentMethodId:
|
|
3007
|
+
orderId: t.orderId,
|
|
3008
|
+
orderItemId: t.orderItemId,
|
|
3009
|
+
amountOfTickets: t.amountOfTickets,
|
|
3010
|
+
paymentMethodId: t.paymentMethodId
|
|
2685
3011
|
});
|
|
2686
3012
|
if (!r?.findPaymentDetails)
|
|
2687
3013
|
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
2688
|
-
const
|
|
3014
|
+
const i = r.findPaymentDetails;
|
|
2689
3015
|
return this.debugLog("Payment methods fetched successfully", {
|
|
2690
|
-
methodCount:
|
|
2691
|
-
transactionPrice:
|
|
2692
|
-
baseTransactionFee:
|
|
2693
|
-
additionalTransactionFee:
|
|
3016
|
+
methodCount: i.methods?.length ?? 0,
|
|
3017
|
+
transactionPrice: i.transactionPrice,
|
|
3018
|
+
baseTransactionFee: i.baseTransactionFee,
|
|
3019
|
+
additionalTransactionFee: i.additionalTransactionFee
|
|
2694
3020
|
}), {
|
|
2695
|
-
transactionPrice:
|
|
2696
|
-
baseTransactionFee:
|
|
2697
|
-
additionalTransactionFee:
|
|
2698
|
-
methods:
|
|
3021
|
+
transactionPrice: i.transactionPrice,
|
|
3022
|
+
baseTransactionFee: i.baseTransactionFee ?? null,
|
|
3023
|
+
additionalTransactionFee: i.additionalTransactionFee ?? null,
|
|
3024
|
+
methods: i.methods?.map((n) => ({
|
|
2699
3025
|
id: n.id,
|
|
2700
3026
|
name: n.name,
|
|
2701
3027
|
image: n.image,
|
|
@@ -2703,10 +3029,10 @@ class Gt {
|
|
|
2703
3029
|
type: n.fee.type,
|
|
2704
3030
|
value: n.fee.value
|
|
2705
3031
|
} : null,
|
|
2706
|
-
issuers: n.issuers?.map((
|
|
2707
|
-
id:
|
|
2708
|
-
name:
|
|
2709
|
-
image:
|
|
3032
|
+
issuers: n.issuers?.map((s) => ({
|
|
3033
|
+
id: s.id,
|
|
3034
|
+
name: s.name,
|
|
3035
|
+
image: s.image
|
|
2710
3036
|
})) ?? null
|
|
2711
3037
|
})) ?? null
|
|
2712
3038
|
};
|
|
@@ -2714,26 +3040,26 @@ class Gt {
|
|
|
2714
3040
|
throw this.debugLog("Error fetching payment methods", r), r;
|
|
2715
3041
|
}
|
|
2716
3042
|
}
|
|
2717
|
-
async createPayment(
|
|
2718
|
-
this.debugLog("Creating payment",
|
|
3043
|
+
async createPayment(t) {
|
|
3044
|
+
this.debugLog("Creating payment", t);
|
|
2719
3045
|
try {
|
|
2720
3046
|
const r = {
|
|
2721
|
-
orderId:
|
|
2722
|
-
paymentMethodId:
|
|
2723
|
-
issuerId:
|
|
2724
|
-
redirectUrl:
|
|
2725
|
-
initiatedByUserId:
|
|
2726
|
-
initiatedByTeamId:
|
|
2727
|
-
orderItemId:
|
|
2728
|
-
amountOfTickets:
|
|
3047
|
+
orderId: t.orderId,
|
|
3048
|
+
paymentMethodId: t.paymentMethodId,
|
|
3049
|
+
issuerId: t.issuerId,
|
|
3050
|
+
redirectUrl: t.redirectUrl,
|
|
3051
|
+
initiatedByUserId: t.initiatedByUserId,
|
|
3052
|
+
initiatedByTeamId: t.initiatedByTeamId,
|
|
3053
|
+
orderItemId: t.orderItemId,
|
|
3054
|
+
amountOfTickets: t.amountOfTickets
|
|
2729
3055
|
};
|
|
2730
|
-
|
|
2731
|
-
const
|
|
3056
|
+
t.customer && (r.customer = t.customer), t.products && (r.products = t.products), t.description && (r.description = t.description), t.reference && (r.reference = t.reference), t.ipAddress && (r.ipAddress = t.ipAddress);
|
|
3057
|
+
const i = await this.sdk.createDigitalPayment({
|
|
2732
3058
|
input: r
|
|
2733
3059
|
});
|
|
2734
|
-
if (!
|
|
3060
|
+
if (!i?.createDigitalOrderPayment)
|
|
2735
3061
|
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
2736
|
-
const n =
|
|
3062
|
+
const n = i.createDigitalOrderPayment;
|
|
2737
3063
|
return this.debugLog("Payment created successfully", {
|
|
2738
3064
|
paymentUrl: n
|
|
2739
3065
|
}), {
|
|
@@ -2743,40 +3069,137 @@ class Gt {
|
|
|
2743
3069
|
throw this.debugLog("Error creating payment", r), r;
|
|
2744
3070
|
}
|
|
2745
3071
|
}
|
|
2746
|
-
calculateTotalWithFee(
|
|
2747
|
-
return r.fee ? r.fee.type === "FIXED" ?
|
|
3072
|
+
calculateTotalWithFee(t, r) {
|
|
3073
|
+
return r.fee ? r.fee.type === "FIXED" ? t + r.fee.value : r.fee.type === "PERCENTAGE" ? t + t * (r.fee.value / 100) : t : t;
|
|
2748
3074
|
}
|
|
2749
|
-
calculateFee(
|
|
2750
|
-
return r.fee ? r.fee.type === "FIXED" ? r.fee.value : r.fee.type === "PERCENTAGE" ?
|
|
3075
|
+
calculateFee(t, r) {
|
|
3076
|
+
return r.fee ? r.fee.type === "FIXED" ? r.fee.value : r.fee.type === "PERCENTAGE" ? t * (r.fee.value / 100) : 0 : 0;
|
|
2751
3077
|
}
|
|
2752
|
-
formatFee(
|
|
2753
|
-
return
|
|
3078
|
+
formatFee(t, r = "€") {
|
|
3079
|
+
return t.fee ? t.fee.type === "FIXED" ? `${r}${t.fee.value.toFixed(2)}` : t.fee.type === "PERCENTAGE" ? `${t.fee.value}%` : "Free" : "Free";
|
|
2754
3080
|
}
|
|
2755
3081
|
}
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
3082
|
+
const Qr = "https://api.ticketapp.com/graphql";
|
|
3083
|
+
class Wt {
|
|
3084
|
+
config;
|
|
3085
|
+
sdk;
|
|
3086
|
+
constructor(t) {
|
|
3087
|
+
if (!t.organizationId)
|
|
3088
|
+
throw new Error("organizationId is required for public package queries");
|
|
3089
|
+
this.config = {
|
|
3090
|
+
...t
|
|
3091
|
+
};
|
|
3092
|
+
const r = new M(t.apiUrl ?? Qr);
|
|
3093
|
+
this.sdk = S(r);
|
|
3094
|
+
}
|
|
3095
|
+
debugLog(t, r) {
|
|
3096
|
+
this.config.debug && console.log(`[PackageService] ${t}`, r || "");
|
|
3097
|
+
}
|
|
3098
|
+
async getPackages(t, r, i) {
|
|
3099
|
+
try {
|
|
3100
|
+
this.debugLog("Fetching public packages", { organizationId: this.config.organizationId, page: t, tab: r, statuses: i });
|
|
3101
|
+
const n = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
3102
|
+
organizationId: this.config.organizationId
|
|
3103
|
+
});
|
|
3104
|
+
if (n?.findAllPublicPackagesByOrganizationId) {
|
|
3105
|
+
const s = n.findAllPublicPackagesByOrganizationId;
|
|
3106
|
+
return this.debugLog("Public packages fetched", {
|
|
3107
|
+
count: s.count,
|
|
3108
|
+
dataLength: s.data.length
|
|
3109
|
+
}), s;
|
|
3110
|
+
}
|
|
3111
|
+
return null;
|
|
3112
|
+
} catch (n) {
|
|
3113
|
+
throw this.debugLog("Error fetching public packages", n), n;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
async getPackageItems(t, r = [U.Regular, U.AdditionalEvent]) {
|
|
3117
|
+
try {
|
|
3118
|
+
this.debugLog("Fetching public package items", { packageId: t, types: r });
|
|
3119
|
+
const i = await this.sdk.findPublicItemsByPackageId({
|
|
3120
|
+
packageId: t,
|
|
3121
|
+
types: r,
|
|
3122
|
+
page: { index: 0, size: 100 }
|
|
3123
|
+
});
|
|
3124
|
+
if (i?.findPublicItemsByPackageId) {
|
|
3125
|
+
const n = i.findPublicItemsByPackageId;
|
|
3126
|
+
return this.debugLog("Public package items fetched", {
|
|
3127
|
+
count: n.count,
|
|
3128
|
+
dataLength: n.data.length
|
|
3129
|
+
}), n;
|
|
3130
|
+
}
|
|
3131
|
+
return null;
|
|
3132
|
+
} catch (i) {
|
|
3133
|
+
throw this.debugLog("Error fetching public package items", i), i;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
async setPackageToOrder(t, r, i) {
|
|
3137
|
+
try {
|
|
3138
|
+
this.debugLog("Setting package to order", { sessionId: t, items: r, amount: i });
|
|
3139
|
+
const n = await this.sdk.setPackageItemToOrder({
|
|
3140
|
+
sessionId: t,
|
|
3141
|
+
amount: i,
|
|
3142
|
+
items: r
|
|
3143
|
+
});
|
|
3144
|
+
return n?.setPackageItemToOrder ? (this.debugLog("Package set successfully", n.setPackageItemToOrder), n.setPackageItemToOrder) : null;
|
|
3145
|
+
} catch (n) {
|
|
3146
|
+
throw this.debugLog("Error setting package to order", n), n;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
async setAdditionalPackageItem(t, r, i, n) {
|
|
3150
|
+
try {
|
|
3151
|
+
this.debugLog("Setting additional package item", {
|
|
3152
|
+
sessionId: t,
|
|
3153
|
+
packageItemId: r,
|
|
3154
|
+
eventId: i,
|
|
3155
|
+
amount: n
|
|
3156
|
+
});
|
|
3157
|
+
const s = await this.sdk.setAdditionalPackageItemToOrder({
|
|
3158
|
+
sessionId: t,
|
|
3159
|
+
packageItemId: r,
|
|
3160
|
+
eventId: i,
|
|
3161
|
+
amount: n
|
|
3162
|
+
});
|
|
3163
|
+
return s?.setAdditionalPackageItemToOrder ? (this.debugLog("Additional package item set successfully", s.setAdditionalPackageItemToOrder), s.setAdditionalPackageItemToOrder) : null;
|
|
3164
|
+
} catch (s) {
|
|
3165
|
+
throw this.debugLog("Error setting additional package item", s), s;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
var D = /* @__PURE__ */ ((e) => (e.PACKAGE = "PACKAGE", e.PRODUCT = "PRODUCT", e.ADD_ONS = "ADD_ONS", e.DELIVERY = "DELIVERY", e.PICKUP = "PICKUP", e))(D || {}), Xt = /* @__PURE__ */ ((e) => (e.Ticket = "Ticket", e.Door = "Door", e.Addon = "Addon", e.Promoter = "Promoter", e.Pickup = "Pickup", e.Delivery = "Delivery", e))(Xt || {}), Qt = /* @__PURE__ */ ((e) => (e.FIXED = "FIXED", e.PERCENTAGE = "PERCENTAGE", e))(Qt || {}), Jt = /* @__PURE__ */ ((e) => (e.AdditionalEvent = "ADDITIONAL_EVENT", e.Addon = "ADDON", e.Regular = "REGULAR", e))(Jt || {});
|
|
3170
|
+
const Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3171
|
+
__proto__: null,
|
|
3172
|
+
BasketOrderType: D,
|
|
3173
|
+
BasketService: Zt,
|
|
3174
|
+
EventService: Kt,
|
|
3175
|
+
PackageItemType: Jt,
|
|
3176
|
+
PackageService: Wt,
|
|
3177
|
+
PaymentMethodFeeType: Qt,
|
|
3178
|
+
PaymentService: jt,
|
|
3179
|
+
ProductType: Xt
|
|
3180
|
+
}, Symbol.toStringTag, { value: "Module" })), Zr = "https://api.ticketapp.com/graphql";
|
|
3181
|
+
class Zt {
|
|
2759
3182
|
config;
|
|
2760
3183
|
orderIdKey;
|
|
2761
3184
|
sdk;
|
|
2762
3185
|
store;
|
|
2763
|
-
constructor(
|
|
3186
|
+
constructor(t) {
|
|
2764
3187
|
this.config = {
|
|
2765
|
-
...
|
|
2766
|
-
}, this.orderIdKey = `ORDER_ID_${
|
|
3188
|
+
...t
|
|
3189
|
+
}, this.orderIdKey = `ORDER_ID_${t.shopSlug}`, this.store = ue({
|
|
2767
3190
|
reducer: {
|
|
2768
|
-
basket:
|
|
3191
|
+
basket: ir
|
|
2769
3192
|
}
|
|
2770
3193
|
});
|
|
2771
|
-
const r = new
|
|
2772
|
-
this.sdk =
|
|
3194
|
+
const r = new M(t.apiUrl ?? Zr);
|
|
3195
|
+
this.sdk = S(r), this.restoreOrderFromSession();
|
|
2773
3196
|
}
|
|
2774
3197
|
async restoreOrderFromSession() {
|
|
2775
|
-
const
|
|
2776
|
-
if (
|
|
2777
|
-
this.debugLog("Found existing order ID in session, restoring...", { orderId:
|
|
3198
|
+
const t = this.getOrderId();
|
|
3199
|
+
if (t) {
|
|
3200
|
+
this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
|
|
2778
3201
|
try {
|
|
2779
|
-
await this.fetchOrder(
|
|
3202
|
+
await this.fetchOrder(t), this.debugLog("Order restored successfully");
|
|
2780
3203
|
} catch (r) {
|
|
2781
3204
|
this.debugLog("Failed to restore order, clearing session", r), this.clearOrderFromSession();
|
|
2782
3205
|
}
|
|
@@ -2785,78 +3208,74 @@ class jt {
|
|
|
2785
3208
|
getState() {
|
|
2786
3209
|
return this.store.getState().basket;
|
|
2787
3210
|
}
|
|
2788
|
-
subscribe(
|
|
2789
|
-
return this.store.subscribe(
|
|
3211
|
+
subscribe(t) {
|
|
3212
|
+
return this.store.subscribe(t);
|
|
2790
3213
|
}
|
|
2791
|
-
/**
|
|
2792
|
-
* Get the current order with a count of total items
|
|
2793
|
-
* @returns CurrentOrder object with count property, or null if no order exists
|
|
2794
|
-
*/
|
|
2795
3214
|
getCurrentOrder() {
|
|
2796
|
-
const
|
|
2797
|
-
if (!
|
|
3215
|
+
const t = this.getState();
|
|
3216
|
+
if (!t.order)
|
|
2798
3217
|
return null;
|
|
2799
|
-
const r =
|
|
3218
|
+
const r = t.order.items.reduce((i, n) => i + (n.amount || 0), 0);
|
|
2800
3219
|
return {
|
|
2801
|
-
...
|
|
3220
|
+
...t.order,
|
|
2802
3221
|
count: r
|
|
2803
3222
|
};
|
|
2804
3223
|
}
|
|
2805
3224
|
getOrderId() {
|
|
2806
3225
|
return sessionStorage.getItem(this.orderIdKey);
|
|
2807
3226
|
}
|
|
2808
|
-
setOrderId(
|
|
2809
|
-
sessionStorage.setItem(this.orderIdKey,
|
|
3227
|
+
setOrderId(t) {
|
|
3228
|
+
sessionStorage.setItem(this.orderIdKey, t);
|
|
2810
3229
|
}
|
|
2811
3230
|
getTrackerId() {
|
|
2812
3231
|
return sessionStorage.getItem("TIC_TRACKER_ID");
|
|
2813
3232
|
}
|
|
2814
3233
|
generateOrderId() {
|
|
2815
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
3234
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
2816
3235
|
const r = Math.random() * 16 | 0;
|
|
2817
|
-
return (
|
|
3236
|
+
return (t === "x" ? r : r & 3 | 8).toString(16);
|
|
2818
3237
|
});
|
|
2819
3238
|
}
|
|
2820
|
-
debugLog(
|
|
2821
|
-
this.config.debug && console.log(`[BasketService:${this.config.shopSlug}] ${
|
|
3239
|
+
debugLog(t, r) {
|
|
3240
|
+
this.config.debug && console.log(`[BasketService:${this.config.shopSlug}] ${t}`, r || "");
|
|
2822
3241
|
}
|
|
2823
|
-
async addProduct(
|
|
3242
|
+
async addProduct(t) {
|
|
2824
3243
|
this.store.dispatch(N(!0));
|
|
2825
3244
|
try {
|
|
2826
|
-
const
|
|
3245
|
+
const i = this.store.getState().basket.order?.id ?? this.getOrderId() ?? this.generateOrderId(), n = this.getTrackerId();
|
|
2827
3246
|
this.debugLog("Adding product", {
|
|
2828
|
-
productId:
|
|
2829
|
-
orderId:
|
|
2830
|
-
amount:
|
|
2831
|
-
seat:
|
|
3247
|
+
productId: t.id,
|
|
3248
|
+
orderId: i,
|
|
3249
|
+
amount: t.amount,
|
|
3250
|
+
seat: t.seat
|
|
2832
3251
|
});
|
|
2833
|
-
const
|
|
2834
|
-
productId:
|
|
2835
|
-
orderId:
|
|
2836
|
-
additionalData:
|
|
3252
|
+
const s = await this.sdk.addToOrder({
|
|
3253
|
+
productId: t.id,
|
|
3254
|
+
orderId: i,
|
|
3255
|
+
additionalData: t.seat ? {
|
|
2837
3256
|
seat: {
|
|
2838
|
-
seatId:
|
|
2839
|
-
seatLabel:
|
|
2840
|
-
holdToken:
|
|
3257
|
+
seatId: t.seat.id,
|
|
3258
|
+
seatLabel: t.seat.label,
|
|
3259
|
+
holdToken: t.seat.holdToken
|
|
2841
3260
|
}
|
|
2842
3261
|
} : null,
|
|
2843
3262
|
trackerId: n || void 0,
|
|
2844
3263
|
shopId: this.config.shopId,
|
|
2845
|
-
amount:
|
|
3264
|
+
amount: t.amount
|
|
2846
3265
|
});
|
|
2847
|
-
if (
|
|
2848
|
-
const { orderId:
|
|
2849
|
-
this.debugLog("Product added successfully",
|
|
2850
|
-
|
|
2851
|
-
id:
|
|
2852
|
-
currency:
|
|
2853
|
-
expiredAt:
|
|
3266
|
+
if (s?.reserveProduct) {
|
|
3267
|
+
const { orderId: o, expiredAt: c, amountReserved: l } = s.reserveProduct;
|
|
3268
|
+
this.debugLog("Product added successfully", s.reserveProduct), this.setOrderId(o), this.store.dispatch(
|
|
3269
|
+
B({
|
|
3270
|
+
id: o,
|
|
3271
|
+
currency: t.currency,
|
|
3272
|
+
expiredAt: c
|
|
2854
3273
|
})
|
|
2855
3274
|
), this.store.dispatch(
|
|
2856
|
-
|
|
2857
|
-
input:
|
|
3275
|
+
te({
|
|
3276
|
+
input: t,
|
|
2858
3277
|
amountReserved: l,
|
|
2859
|
-
expiredAt:
|
|
3278
|
+
expiredAt: c
|
|
2860
3279
|
})
|
|
2861
3280
|
);
|
|
2862
3281
|
}
|
|
@@ -2866,38 +3285,38 @@ class jt {
|
|
|
2866
3285
|
this.store.dispatch(N(!1));
|
|
2867
3286
|
}
|
|
2868
3287
|
}
|
|
2869
|
-
async removeProduct(
|
|
2870
|
-
const
|
|
2871
|
-
if (
|
|
3288
|
+
async removeProduct(t) {
|
|
3289
|
+
const i = this.getState().order;
|
|
3290
|
+
if (i) {
|
|
2872
3291
|
this.store.dispatch(N(!0));
|
|
2873
3292
|
try {
|
|
2874
3293
|
this.debugLog("Removing product", {
|
|
2875
|
-
productId:
|
|
2876
|
-
orderId:
|
|
2877
|
-
amount:
|
|
3294
|
+
productId: t.id,
|
|
3295
|
+
orderId: i.id,
|
|
3296
|
+
amount: t.amount
|
|
2878
3297
|
});
|
|
2879
3298
|
const n = await this.sdk.removeFromOrder({
|
|
2880
|
-
productId:
|
|
2881
|
-
orderId:
|
|
2882
|
-
additionalData:
|
|
3299
|
+
productId: t.id,
|
|
3300
|
+
orderId: i.id,
|
|
3301
|
+
additionalData: t.seat ? {
|
|
2883
3302
|
seat: {
|
|
2884
|
-
seatId:
|
|
2885
|
-
seatLabel:
|
|
3303
|
+
seatId: t.seat.id,
|
|
3304
|
+
seatLabel: t.seat.label
|
|
2886
3305
|
}
|
|
2887
3306
|
} : null,
|
|
2888
|
-
amount:
|
|
3307
|
+
amount: t.amount
|
|
2889
3308
|
});
|
|
2890
3309
|
if (n?.releaseProduct) {
|
|
2891
|
-
const { amountReleased:
|
|
3310
|
+
const { amountReleased: s } = n.releaseProduct;
|
|
2892
3311
|
this.debugLog("Product removed successfully", n.releaseProduct), this.store.dispatch(
|
|
2893
|
-
|
|
2894
|
-
id:
|
|
2895
|
-
amountReleased:
|
|
2896
|
-
seatId:
|
|
3312
|
+
rr({
|
|
3313
|
+
id: t.id,
|
|
3314
|
+
amountReleased: s,
|
|
3315
|
+
seatId: t.seat?.id
|
|
2897
3316
|
})
|
|
2898
3317
|
);
|
|
2899
|
-
const
|
|
2900
|
-
(!
|
|
3318
|
+
const o = this.getState();
|
|
3319
|
+
(!o.order || o.order.items.length === 0) && (this.debugLog("Basket is now empty, cancelling order and clearing session"), await this.cancelOrder());
|
|
2901
3320
|
}
|
|
2902
3321
|
} catch (n) {
|
|
2903
3322
|
throw this.debugLog("Error removing product", n), this.handleError(n), n;
|
|
@@ -2906,40 +3325,40 @@ class jt {
|
|
|
2906
3325
|
}
|
|
2907
3326
|
}
|
|
2908
3327
|
}
|
|
2909
|
-
async configurePackage(
|
|
3328
|
+
async configurePackage(t) {
|
|
2910
3329
|
this.store.dispatch(N(!0));
|
|
2911
3330
|
try {
|
|
2912
|
-
const
|
|
2913
|
-
packageItemId:
|
|
2914
|
-
eventId:
|
|
3331
|
+
const i = this.store.getState().basket.order?.id ?? this.getOrderId() ?? this.generateOrderId(), n = this.getTrackerId(), s = t.items.map((c) => ({
|
|
3332
|
+
packageItemId: c.packageItemId,
|
|
3333
|
+
eventId: c.eventId
|
|
2915
3334
|
}));
|
|
2916
3335
|
this.debugLog("Configuring package", {
|
|
2917
|
-
packageId:
|
|
2918
|
-
orderId:
|
|
2919
|
-
amount:
|
|
2920
|
-
items:
|
|
3336
|
+
packageId: t.id,
|
|
3337
|
+
orderId: i,
|
|
3338
|
+
amount: t.amount,
|
|
3339
|
+
items: s,
|
|
2921
3340
|
shopId: this.config.shopId
|
|
2922
3341
|
});
|
|
2923
|
-
const
|
|
3342
|
+
const o = await this.sdk.configurePackage({
|
|
2924
3343
|
trackerId: n || void 0,
|
|
2925
3344
|
shopId: this.config.shopId,
|
|
2926
|
-
packageId:
|
|
2927
|
-
orderId:
|
|
2928
|
-
amount:
|
|
2929
|
-
items:
|
|
3345
|
+
packageId: t.id,
|
|
3346
|
+
orderId: i,
|
|
3347
|
+
amount: t.amount,
|
|
3348
|
+
items: s
|
|
2930
3349
|
});
|
|
2931
|
-
if (this.debugLog("Configure package response",
|
|
2932
|
-
const { orderId:
|
|
2933
|
-
return this.debugLog("Package configured successfully"), this.setOrderId(
|
|
2934
|
-
|
|
2935
|
-
id:
|
|
2936
|
-
currency:
|
|
3350
|
+
if (this.debugLog("Configure package response", o), o?.configurePackage && o.configurePackage.amountReserved > 0) {
|
|
3351
|
+
const { orderId: c, expiredAt: l, amountReserved: h } = o.configurePackage;
|
|
3352
|
+
return this.debugLog("Package configured successfully"), this.setOrderId(c), this.store.dispatch(
|
|
3353
|
+
B({
|
|
3354
|
+
id: c,
|
|
3355
|
+
currency: t.currency,
|
|
2937
3356
|
expiredAt: l
|
|
2938
3357
|
})
|
|
2939
3358
|
), this.store.dispatch(
|
|
2940
|
-
|
|
2941
|
-
input:
|
|
2942
|
-
amountReserved:
|
|
3359
|
+
re({
|
|
3360
|
+
input: t,
|
|
3361
|
+
amountReserved: h,
|
|
2943
3362
|
expiredAt: l
|
|
2944
3363
|
})
|
|
2945
3364
|
), null;
|
|
@@ -2951,191 +3370,225 @@ class jt {
|
|
|
2951
3370
|
this.store.dispatch(N(!1));
|
|
2952
3371
|
}
|
|
2953
3372
|
}
|
|
2954
|
-
async setDelivery(
|
|
3373
|
+
async setDelivery(t) {
|
|
2955
3374
|
this.store.dispatch(N(!0));
|
|
2956
3375
|
try {
|
|
2957
|
-
this.store.dispatch(
|
|
3376
|
+
this.store.dispatch(nr(t));
|
|
2958
3377
|
} catch (r) {
|
|
2959
3378
|
throw this.debugLog("Error setting delivery", r), this.handleError(r), r;
|
|
2960
3379
|
} finally {
|
|
2961
3380
|
this.store.dispatch(N(!1));
|
|
2962
3381
|
}
|
|
2963
3382
|
}
|
|
2964
|
-
async fetchOrder(
|
|
2965
|
-
this.debugLog("Fetching order from server", { orderId:
|
|
3383
|
+
async fetchOrder(t) {
|
|
3384
|
+
this.debugLog("Fetching order from server", { orderId: t });
|
|
2966
3385
|
try {
|
|
2967
|
-
const r = await this.sdk.findActiveOrderById({ id:
|
|
3386
|
+
const r = await this.sdk.findActiveOrderById({ id: t });
|
|
2968
3387
|
if (!r?.findOrder) {
|
|
2969
3388
|
this.debugLog("Order not found"), this.clearOrderFromSession();
|
|
2970
3389
|
return;
|
|
2971
3390
|
}
|
|
2972
|
-
const
|
|
2973
|
-
this.debugLog("Order fetched successfully",
|
|
2974
|
-
const n =
|
|
2975
|
-
let
|
|
2976
|
-
return
|
|
2977
|
-
id:
|
|
2978
|
-
type:
|
|
2979
|
-
name:
|
|
2980
|
-
icon:
|
|
2981
|
-
description:
|
|
2982
|
-
amount:
|
|
2983
|
-
price:
|
|
2984
|
-
depositPrice:
|
|
2985
|
-
originalPrice:
|
|
2986
|
-
serviceFee:
|
|
2987
|
-
seats:
|
|
2988
|
-
id:
|
|
2989
|
-
label:
|
|
3391
|
+
const i = r.findOrder;
|
|
3392
|
+
this.debugLog("Order fetched successfully", i);
|
|
3393
|
+
const n = i.items, s = n.filter((d) => d.product != null && d.amount > 0).map((d) => {
|
|
3394
|
+
let A = D.PRODUCT;
|
|
3395
|
+
return d.product.type === "PROMOTER" ? A = D.ADD_ONS : d.product.type === "PICKUP" ? A = D.PICKUP : d.product.type === "DELIVERY" && (A = D.DELIVERY), {
|
|
3396
|
+
id: d.product.id,
|
|
3397
|
+
type: A,
|
|
3398
|
+
name: d.product.name,
|
|
3399
|
+
icon: d.product.icon,
|
|
3400
|
+
description: d.product.description,
|
|
3401
|
+
amount: d.amount,
|
|
3402
|
+
price: d.price ?? 0,
|
|
3403
|
+
depositPrice: d.depositPrice ?? 0,
|
|
3404
|
+
originalPrice: d.originalPrice ?? 0,
|
|
3405
|
+
serviceFee: d.serviceFee ?? 0,
|
|
3406
|
+
seats: d.seats?.map((p) => ({
|
|
3407
|
+
id: p.id,
|
|
3408
|
+
label: p.label
|
|
2990
3409
|
}))
|
|
2991
3410
|
};
|
|
2992
|
-
}),
|
|
3411
|
+
}), o = n.filter((d) => d.packageItem != null && d.amount > 0).reduce((d, A) => {
|
|
2993
3412
|
const {
|
|
2994
|
-
packageItem:
|
|
2995
|
-
event:
|
|
2996
|
-
amount:
|
|
2997
|
-
price:
|
|
2998
|
-
serviceFee:
|
|
2999
|
-
depositPrice:
|
|
3000
|
-
originalPrice:
|
|
3001
|
-
} =
|
|
3002
|
-
|
|
3003
|
-
id:
|
|
3004
|
-
type:
|
|
3005
|
-
name:
|
|
3006
|
-
amount:
|
|
3007
|
-
price:
|
|
3008
|
-
serviceFee:
|
|
3009
|
-
depositPrice:
|
|
3010
|
-
originalPrice:
|
|
3413
|
+
packageItem: p,
|
|
3414
|
+
event: O,
|
|
3415
|
+
amount: f,
|
|
3416
|
+
price: m,
|
|
3417
|
+
serviceFee: Q,
|
|
3418
|
+
depositPrice: J,
|
|
3419
|
+
originalPrice: Z
|
|
3420
|
+
} = A, T = p.package.id;
|
|
3421
|
+
d[T] ? (d[T].price += m ?? 0, d[T].serviceFee += Q ?? 0, d[T].originalPrice += Z ?? 0, d[T].depositPrice += J ?? m ?? 0) : d[T] = {
|
|
3422
|
+
id: T,
|
|
3423
|
+
type: D.PACKAGE,
|
|
3424
|
+
name: p.package.name,
|
|
3425
|
+
amount: f,
|
|
3426
|
+
price: m ?? 0,
|
|
3427
|
+
serviceFee: Q ?? 0,
|
|
3428
|
+
depositPrice: J ?? m ?? 0,
|
|
3429
|
+
originalPrice: Z ?? 0,
|
|
3011
3430
|
packageItems: []
|
|
3012
3431
|
};
|
|
3013
|
-
const
|
|
3014
|
-
zone:
|
|
3015
|
-
}),
|
|
3016
|
-
zone:
|
|
3432
|
+
const er = _.fromISO(O.startAt, {
|
|
3433
|
+
zone: O.timezone
|
|
3434
|
+
}), tr = _.fromISO(O.endAt, {
|
|
3435
|
+
zone: O.timezone
|
|
3017
3436
|
});
|
|
3018
|
-
return
|
|
3019
|
-
packageItemId:
|
|
3020
|
-
eventId:
|
|
3021
|
-
name:
|
|
3022
|
-
startAt:
|
|
3023
|
-
endAt:
|
|
3024
|
-
}),
|
|
3025
|
-
}, {}),
|
|
3026
|
-
...
|
|
3027
|
-
...Object.values(
|
|
3437
|
+
return d[T].packageItems.push({
|
|
3438
|
+
packageItemId: p.id,
|
|
3439
|
+
eventId: O.id,
|
|
3440
|
+
name: O.name,
|
|
3441
|
+
startAt: er,
|
|
3442
|
+
endAt: tr
|
|
3443
|
+
}), d;
|
|
3444
|
+
}, {}), c = [
|
|
3445
|
+
...s,
|
|
3446
|
+
...Object.values(o)
|
|
3028
3447
|
];
|
|
3029
|
-
if (
|
|
3448
|
+
if (c.length === 0) {
|
|
3030
3449
|
this.debugLog("All order items have zero or negative amounts, clearing session"), this.clearOrderFromSession();
|
|
3031
3450
|
return;
|
|
3032
3451
|
}
|
|
3033
|
-
const l = n.filter((
|
|
3452
|
+
const l = n.filter((d) => d.amount > 0).map((d) => new Date(d.expiredAt).getTime());
|
|
3034
3453
|
if (l.length === 0) {
|
|
3035
3454
|
this.debugLog("No valid items with expiration times, clearing session"), this.clearOrderFromSession();
|
|
3036
3455
|
return;
|
|
3037
3456
|
}
|
|
3038
|
-
const
|
|
3039
|
-
this.store.dispatch(
|
|
3040
|
-
|
|
3041
|
-
id:
|
|
3042
|
-
currency:
|
|
3043
|
-
expiredAt:
|
|
3457
|
+
const h = _.fromMillis(Math.min(...l));
|
|
3458
|
+
this.store.dispatch(ie()), this.store.dispatch(
|
|
3459
|
+
B({
|
|
3460
|
+
id: i.id,
|
|
3461
|
+
currency: i.currency,
|
|
3462
|
+
expiredAt: h.toISO()
|
|
3044
3463
|
})
|
|
3045
|
-
),
|
|
3046
|
-
|
|
3047
|
-
|
|
3464
|
+
), c.forEach((d) => {
|
|
3465
|
+
d.type === D.PACKAGE ? this.store.dispatch(
|
|
3466
|
+
re({
|
|
3048
3467
|
input: {
|
|
3049
|
-
id:
|
|
3050
|
-
name:
|
|
3051
|
-
currency:
|
|
3052
|
-
price:
|
|
3053
|
-
depositPrice:
|
|
3054
|
-
serviceFee:
|
|
3055
|
-
amount:
|
|
3056
|
-
items:
|
|
3468
|
+
id: d.id,
|
|
3469
|
+
name: d.name,
|
|
3470
|
+
currency: i.currency,
|
|
3471
|
+
price: d.originalPrice ?? 0,
|
|
3472
|
+
depositPrice: d.depositPrice,
|
|
3473
|
+
serviceFee: d.serviceFee ?? 0,
|
|
3474
|
+
amount: d.amount,
|
|
3475
|
+
items: d.packageItems || []
|
|
3057
3476
|
},
|
|
3058
|
-
amountReserved:
|
|
3059
|
-
expiredAt:
|
|
3477
|
+
amountReserved: d.amount,
|
|
3478
|
+
expiredAt: h.toISO()
|
|
3060
3479
|
})
|
|
3061
3480
|
) : this.store.dispatch(
|
|
3062
|
-
|
|
3481
|
+
te({
|
|
3063
3482
|
input: {
|
|
3064
|
-
id:
|
|
3065
|
-
name:
|
|
3066
|
-
price:
|
|
3067
|
-
depositPrice:
|
|
3068
|
-
serviceFee:
|
|
3069
|
-
currency:
|
|
3070
|
-
amount:
|
|
3483
|
+
id: d.id,
|
|
3484
|
+
name: d.name,
|
|
3485
|
+
price: d.originalPrice,
|
|
3486
|
+
depositPrice: d.depositPrice,
|
|
3487
|
+
serviceFee: d.serviceFee,
|
|
3488
|
+
currency: i.currency,
|
|
3489
|
+
amount: d.amount
|
|
3071
3490
|
},
|
|
3072
|
-
amountReserved:
|
|
3073
|
-
expiredAt:
|
|
3491
|
+
amountReserved: d.amount,
|
|
3492
|
+
expiredAt: h.toISO()
|
|
3074
3493
|
})
|
|
3075
3494
|
);
|
|
3076
|
-
}),
|
|
3077
|
-
|
|
3078
|
-
firstName:
|
|
3079
|
-
lastName:
|
|
3080
|
-
email:
|
|
3081
|
-
age:
|
|
3495
|
+
}), i.mainBooker && (this.debugLog("Order has customer (mainBooker)", i.mainBooker), this.store.dispatch(
|
|
3496
|
+
ne({
|
|
3497
|
+
firstName: i.mainBooker.firstName ?? void 0,
|
|
3498
|
+
lastName: i.mainBooker.lastName ?? void 0,
|
|
3499
|
+
email: i.mainBooker.email ?? void 0,
|
|
3500
|
+
age: i.mainBooker.age ?? void 0
|
|
3082
3501
|
})
|
|
3083
3502
|
)), this.debugLog("Order state fully synced", this.getState());
|
|
3084
3503
|
} catch (r) {
|
|
3085
3504
|
throw this.debugLog("Error fetching order", r), r;
|
|
3086
3505
|
}
|
|
3087
3506
|
}
|
|
3088
|
-
async createCustomer(
|
|
3089
|
-
const
|
|
3090
|
-
if (!
|
|
3507
|
+
async createCustomer(t) {
|
|
3508
|
+
const i = this.store.getState().basket.order;
|
|
3509
|
+
if (!i)
|
|
3091
3510
|
throw new Error("No active order. Add items to basket first.");
|
|
3092
|
-
await this.fetchOrder(
|
|
3511
|
+
await this.fetchOrder(i.id);
|
|
3093
3512
|
const n = this.store.getState().basket;
|
|
3094
3513
|
if (n.order?.customer)
|
|
3095
3514
|
throw this.debugLog("Order already has a customer after fetching", n.order.customer), new Error("Order already has a customer associated with it.");
|
|
3096
3515
|
this.debugLog("Creating customer", {
|
|
3097
|
-
orderId:
|
|
3098
|
-
email:
|
|
3099
|
-
orderHasItems:
|
|
3516
|
+
orderId: i.id,
|
|
3517
|
+
email: t.email,
|
|
3518
|
+
orderHasItems: i.items.length > 0
|
|
3100
3519
|
});
|
|
3101
3520
|
try {
|
|
3102
|
-
const
|
|
3103
|
-
orderId:
|
|
3104
|
-
customer:
|
|
3521
|
+
const s = await this.sdk.createOrderCustomer({
|
|
3522
|
+
orderId: i.id,
|
|
3523
|
+
customer: t
|
|
3105
3524
|
});
|
|
3106
|
-
this.debugLog("Customer created successfully",
|
|
3107
|
-
} catch (
|
|
3525
|
+
this.debugLog("Customer created successfully", s), this.store.dispatch(ne(t));
|
|
3526
|
+
} catch (s) {
|
|
3108
3527
|
throw this.debugLog("Failed to create customer", {
|
|
3109
|
-
error:
|
|
3110
|
-
response:
|
|
3111
|
-
graphQLErrors:
|
|
3112
|
-
}), new Error(`Failed to create customer: ${
|
|
3528
|
+
error: s.message,
|
|
3529
|
+
response: s.response,
|
|
3530
|
+
graphQLErrors: s.response?.errors
|
|
3531
|
+
}), new Error(`Failed to create customer: ${s.message}`);
|
|
3113
3532
|
}
|
|
3114
3533
|
}
|
|
3115
3534
|
async cancelOrder() {
|
|
3116
|
-
const
|
|
3117
|
-
|
|
3535
|
+
const t = this.getOrderId();
|
|
3536
|
+
t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
|
|
3118
3537
|
}
|
|
3119
3538
|
clearOrderFromSession() {
|
|
3120
|
-
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(
|
|
3539
|
+
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(ie());
|
|
3121
3540
|
}
|
|
3122
|
-
handleError(
|
|
3123
|
-
const r =
|
|
3541
|
+
handleError(t) {
|
|
3542
|
+
const r = t;
|
|
3124
3543
|
if (r.graphQLErrors && r.graphQLErrors.length > 0) {
|
|
3125
|
-
const
|
|
3126
|
-
|
|
3544
|
+
const i = r.graphQLErrors[0];
|
|
3545
|
+
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
3127
3546
|
}
|
|
3128
3547
|
if (r.response?.errors && r.response.errors.length > 0) {
|
|
3129
|
-
const
|
|
3130
|
-
console.error("GraphQL Error:",
|
|
3548
|
+
const i = r.response.errors[0];
|
|
3549
|
+
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
3131
3550
|
}
|
|
3132
3551
|
}
|
|
3133
3552
|
}
|
|
3553
|
+
class an {
|
|
3554
|
+
basket;
|
|
3555
|
+
event;
|
|
3556
|
+
payment;
|
|
3557
|
+
package;
|
|
3558
|
+
// Attach all types to the SDK class
|
|
3559
|
+
static Types = Jr;
|
|
3560
|
+
static GraphQL = jr;
|
|
3561
|
+
static EventStore = sr;
|
|
3562
|
+
constructor(t) {
|
|
3563
|
+
const {
|
|
3564
|
+
organizationId: r,
|
|
3565
|
+
shopId: i,
|
|
3566
|
+
shopSlug: n,
|
|
3567
|
+
debug: s = !1,
|
|
3568
|
+
filteredLocationIds: o = [],
|
|
3569
|
+
filteredHostingIds: c = [],
|
|
3570
|
+
enableDoorTickets: l = !1,
|
|
3571
|
+
apiUrl: h
|
|
3572
|
+
} = t;
|
|
3573
|
+
this.basket = new Zt({ shopId: i, shopSlug: n, debug: s, apiUrl: h }), this.event = new Kt({
|
|
3574
|
+
organizationId: r,
|
|
3575
|
+
shopId: i,
|
|
3576
|
+
debug: s,
|
|
3577
|
+
filteredLocationIds: o,
|
|
3578
|
+
filteredHostingIds: c,
|
|
3579
|
+
enableDoorTickets: l,
|
|
3580
|
+
apiUrl: h
|
|
3581
|
+
}), this.payment = new jt({ debug: s, apiUrl: h }), this.package = new Wt({ organizationId: r, debug: s, apiUrl: h });
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3134
3584
|
export {
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3585
|
+
D as BasketOrderType,
|
|
3586
|
+
Zt as BasketService,
|
|
3587
|
+
Kt as EventService,
|
|
3588
|
+
Jt as PackageItemType,
|
|
3589
|
+
Wt as PackageService,
|
|
3590
|
+
Qt as PaymentMethodFeeType,
|
|
3591
|
+
jt as PaymentService,
|
|
3592
|
+
Xt as ProductType,
|
|
3593
|
+
an as TicketappSDK
|
|
3141
3594
|
};
|