@deenruv/product-options-fields-plugin 1.0.17-dev.20 → 1.0.17-dev.23

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.
@@ -0,0 +1,1276 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MetricType = exports.MetricInterval = exports.ChartMetricType = exports.MetricIntervalType = exports.MetricRangeType = exports.OrderType = exports.LanguageCode = exports.HistoryEntryType = exports.CurrencyCode = exports.LogicalOperator = exports.ErrorCode = exports.SortOrder = exports.Permission = exports.DeletionResult = exports.AdjustmentType = exports.GlobalFlag = exports.AssetType = exports.StockMovementType = exports.JobState = exports.$ = exports.GRAPHQL_TYPE_SEPARATOR = exports.START_VAR_NAME = exports.resolverFor = exports.InternalArgsBuilt = exports.ResolveFromPath = exports.purifyGraphQLKey = exports.PrepareScalarPaths = exports.GraphQLError = exports.SEPARATOR = exports.traverseResponse = exports.decodeScalarsInResponse = exports.fields = exports.ZeusScalars = exports.Gql = exports.TypeFromSelector = exports.Selector = exports.ZeusSelect = exports.Zeus = exports.SubscriptionSSE = exports.SubscriptionThunderSSE = exports.Subscription = exports.SubscriptionThunder = exports.Chain = exports.Thunder = exports.InternalsBuildQuery = exports.apiFetch = exports.apiSubscriptionSSE = exports.apiSubscription = exports.HEADERS = exports.HOST = void 0;
5
+ const const_1 = require("./const");
6
+ exports.HOST = "http://localhost:6100/admin-api";
7
+ exports.HEADERS = {};
8
+ const apiSubscription = (options) => (query) => {
9
+ var _a, _b, _c;
10
+ try {
11
+ const queryString = options[0] + "?query=" + encodeURIComponent(query);
12
+ const wsString = queryString.replace("http", "ws");
13
+ const host = (options.length > 1 && ((_b = (_a = options[1]) === null || _a === void 0 ? void 0 : _a.websocket) === null || _b === void 0 ? void 0 : _b[0])) || wsString;
14
+ const webSocketOptions = ((_c = options[1]) === null || _c === void 0 ? void 0 : _c.websocket) || [host];
15
+ const ws = new WebSocket(...webSocketOptions);
16
+ return {
17
+ ws,
18
+ on: (e) => {
19
+ ws.onmessage = (event) => {
20
+ if (event.data) {
21
+ const parsed = JSON.parse(event.data);
22
+ const data = parsed.data;
23
+ return e(data);
24
+ }
25
+ };
26
+ },
27
+ off: (e) => {
28
+ ws.onclose = e;
29
+ },
30
+ error: (e) => {
31
+ ws.onerror = e;
32
+ },
33
+ open: (e) => {
34
+ ws.onopen = e;
35
+ },
36
+ };
37
+ }
38
+ catch (_d) {
39
+ throw new Error("No websockets implemented");
40
+ }
41
+ };
42
+ exports.apiSubscription = apiSubscription;
43
+ const apiSubscriptionSSE = (options) => (query, variables) => {
44
+ const url = options[0];
45
+ const fetchOptions = options[1] || {};
46
+ let abortController = null;
47
+ let reader = null;
48
+ let onCallback = null;
49
+ let errorCallback = null;
50
+ let openCallback = null;
51
+ let offCallback = null;
52
+ let isClosing = false; // Flag to track intentional close
53
+ const startStream = async () => {
54
+ var _a;
55
+ try {
56
+ abortController = new AbortController();
57
+ const response = await fetch(url, Object.assign({ method: "POST", headers: Object.assign({ Accept: "text/event-stream", "Content-Type": "application/json", "Cache-Control": "no-cache" }, fetchOptions.headers), body: JSON.stringify({ query, variables }), signal: abortController.signal }, fetchOptions));
58
+ if (!response.ok) {
59
+ throw new Error(`HTTP error! status: ${response.status}`);
60
+ }
61
+ if (openCallback) {
62
+ openCallback();
63
+ }
64
+ reader = ((_a = response.body) === null || _a === void 0 ? void 0 : _a.getReader()) || null;
65
+ if (!reader) {
66
+ throw new Error("No response body");
67
+ }
68
+ const decoder = new TextDecoder();
69
+ let buffer = "";
70
+ while (true) {
71
+ const { done, value } = await reader.read();
72
+ if (done) {
73
+ if (offCallback) {
74
+ offCallback({
75
+ data: null,
76
+ code: 1000,
77
+ reason: "Stream completed",
78
+ });
79
+ }
80
+ break;
81
+ }
82
+ buffer += decoder.decode(value, { stream: true });
83
+ const lines = buffer.split("\n");
84
+ buffer = lines.pop() || "";
85
+ for (const line of lines) {
86
+ if (line.startsWith("data: ")) {
87
+ try {
88
+ const data = line.slice(6);
89
+ const parsed = JSON.parse(data);
90
+ if (parsed.errors) {
91
+ if (errorCallback) {
92
+ errorCallback({ data: parsed.data, errors: parsed.errors });
93
+ }
94
+ }
95
+ else if (onCallback && parsed.data) {
96
+ onCallback(parsed.data);
97
+ }
98
+ }
99
+ catch (_b) {
100
+ if (errorCallback) {
101
+ errorCallback({ errors: ["Failed to parse SSE data"] });
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ catch (err) {
109
+ const error = err;
110
+ // Don't report errors if we're intentionally closing (AbortError) or during cleanup
111
+ if (error.name !== "AbortError" && !isClosing && errorCallback) {
112
+ errorCallback({ errors: [error.message || "Unknown error"] });
113
+ }
114
+ }
115
+ };
116
+ return {
117
+ on: (e) => {
118
+ onCallback = e;
119
+ },
120
+ off: (e) => {
121
+ offCallback = e;
122
+ },
123
+ error: (e) => {
124
+ errorCallback = e;
125
+ },
126
+ open: (e) => {
127
+ if (e) {
128
+ openCallback = e;
129
+ }
130
+ startStream();
131
+ },
132
+ close: () => {
133
+ isClosing = true; // Mark as intentionally closing to suppress error callbacks
134
+ if (abortController) {
135
+ abortController.abort();
136
+ }
137
+ if (reader) {
138
+ // Wrap in try-catch to suppress AbortError during cleanup
139
+ reader.cancel().catch(() => {
140
+ // Ignore cancel errors - stream may already be closed
141
+ });
142
+ }
143
+ },
144
+ };
145
+ };
146
+ exports.apiSubscriptionSSE = apiSubscriptionSSE;
147
+ const handleFetchResponse = (response) => {
148
+ if (!response.ok) {
149
+ return new Promise((_, reject) => {
150
+ response
151
+ .text()
152
+ .then((text) => {
153
+ try {
154
+ reject(JSON.parse(text));
155
+ }
156
+ catch (err) {
157
+ reject(text);
158
+ }
159
+ })
160
+ .catch(reject);
161
+ });
162
+ }
163
+ return response.json();
164
+ };
165
+ const apiFetch = (options) => (query, variables = {}) => {
166
+ const fetchOptions = options[1] || {};
167
+ if (fetchOptions.method && fetchOptions.method === "GET") {
168
+ return fetch(`${options[0]}?query=${encodeURIComponent(query)}`, fetchOptions)
169
+ .then(handleFetchResponse)
170
+ .then((response) => {
171
+ if (response.errors) {
172
+ throw new GraphQLError(response);
173
+ }
174
+ return response.data;
175
+ });
176
+ }
177
+ return fetch(`${options[0]}`, Object.assign({ body: JSON.stringify({ query, variables }), method: "POST", headers: {
178
+ "Content-Type": "application/json",
179
+ } }, fetchOptions))
180
+ .then(handleFetchResponse)
181
+ .then((response) => {
182
+ if (response.errors) {
183
+ throw new GraphQLError(response);
184
+ }
185
+ return response.data;
186
+ });
187
+ };
188
+ exports.apiFetch = apiFetch;
189
+ const InternalsBuildQuery = ({ ops, props, returns, options, scalars, }) => {
190
+ const ibb = (k, o, p = "", root = true, vars = []) => {
191
+ var _a;
192
+ const keyForPath = (0, exports.purifyGraphQLKey)(k);
193
+ const newPath = [p, keyForPath].join(exports.SEPARATOR);
194
+ if (!o) {
195
+ return "";
196
+ }
197
+ if (typeof o === "boolean" || typeof o === "number") {
198
+ return k;
199
+ }
200
+ if (typeof o === "string") {
201
+ return `${k} ${o}`;
202
+ }
203
+ if (Array.isArray(o)) {
204
+ const args = (0, exports.InternalArgsBuilt)({
205
+ props,
206
+ returns,
207
+ ops,
208
+ scalars,
209
+ vars,
210
+ })(o[0], newPath);
211
+ return `${ibb(args ? `${k}(${args})` : k, o[1], p, false, vars)}`;
212
+ }
213
+ if (k === "__alias") {
214
+ return Object.entries(o)
215
+ .map(([alias, objectUnderAlias]) => {
216
+ if (typeof objectUnderAlias !== "object" ||
217
+ Array.isArray(objectUnderAlias)) {
218
+ throw new Error("Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}");
219
+ }
220
+ const operationName = Object.keys(objectUnderAlias)[0];
221
+ const operation = objectUnderAlias[operationName];
222
+ return ibb(`${alias}:${operationName}`, operation, p, false, vars);
223
+ })
224
+ .join("\n");
225
+ }
226
+ const hasOperationName = root && (options === null || options === void 0 ? void 0 : options.operationName) ? " " + options.operationName : "";
227
+ const keyForDirectives = (_a = o.__directives) !== null && _a !== void 0 ? _a : "";
228
+ const query = `{${Object.entries(o)
229
+ .filter(([k]) => k !== "__directives")
230
+ .map((e) => ibb(...e, [p, `field<>${keyForPath}`].join(exports.SEPARATOR), false, vars))
231
+ .join("\n")}}`;
232
+ if (!root) {
233
+ return `${k} ${keyForDirectives}${hasOperationName} ${query}`;
234
+ }
235
+ const varsString = vars
236
+ .map((v) => `${v.name}: ${v.graphQLType}`)
237
+ .join(", ");
238
+ return `${k} ${keyForDirectives}${hasOperationName}${varsString ? `(${varsString})` : ""} ${query}`;
239
+ };
240
+ return ibb;
241
+ };
242
+ exports.InternalsBuildQuery = InternalsBuildQuery;
243
+ const Thunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => {
244
+ const options = Object.assign(Object.assign({}, thunderGraphQLOptions), graphqlOptions);
245
+ return fn((0, exports.Zeus)(operation, o, {
246
+ operationOptions: ops,
247
+ scalars: options === null || options === void 0 ? void 0 : options.scalars,
248
+ }), ops === null || ops === void 0 ? void 0 : ops.variables).then((data) => {
249
+ if (options === null || options === void 0 ? void 0 : options.scalars) {
250
+ return (0, exports.decodeScalarsInResponse)({
251
+ response: data,
252
+ initialOp: operation,
253
+ initialZeusQuery: o,
254
+ returns: const_1.ReturnTypes,
255
+ scalars: options.scalars,
256
+ ops: const_1.Ops,
257
+ });
258
+ }
259
+ return data;
260
+ });
261
+ };
262
+ exports.Thunder = Thunder;
263
+ const Chain = (...options) => (0, exports.Thunder)((0, exports.apiFetch)(options));
264
+ exports.Chain = Chain;
265
+ const SubscriptionThunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => {
266
+ const options = Object.assign(Object.assign({}, thunderGraphQLOptions), graphqlOptions);
267
+ const returnedFunction = fn((0, exports.Zeus)(operation, o, {
268
+ operationOptions: ops,
269
+ scalars: options === null || options === void 0 ? void 0 : options.scalars,
270
+ }));
271
+ if ((returnedFunction === null || returnedFunction === void 0 ? void 0 : returnedFunction.on) && (options === null || options === void 0 ? void 0 : options.scalars)) {
272
+ const wrapped = returnedFunction.on;
273
+ returnedFunction.on = (fnToCall) => wrapped((data) => {
274
+ if (options === null || options === void 0 ? void 0 : options.scalars) {
275
+ return fnToCall((0, exports.decodeScalarsInResponse)({
276
+ response: data,
277
+ initialOp: operation,
278
+ initialZeusQuery: o,
279
+ returns: const_1.ReturnTypes,
280
+ scalars: options.scalars,
281
+ ops: const_1.Ops,
282
+ }));
283
+ }
284
+ return fnToCall(data);
285
+ });
286
+ }
287
+ return returnedFunction;
288
+ };
289
+ exports.SubscriptionThunder = SubscriptionThunder;
290
+ const Subscription = (...options) => (0, exports.SubscriptionThunder)((0, exports.apiSubscription)(options));
291
+ exports.Subscription = Subscription;
292
+ const SubscriptionThunderSSE = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => {
293
+ const options = Object.assign(Object.assign({}, thunderGraphQLOptions), graphqlOptions);
294
+ const returnedFunction = fn((0, exports.Zeus)(operation, o, {
295
+ operationOptions: ops,
296
+ scalars: options === null || options === void 0 ? void 0 : options.scalars,
297
+ }), ops === null || ops === void 0 ? void 0 : ops.variables);
298
+ if ((returnedFunction === null || returnedFunction === void 0 ? void 0 : returnedFunction.on) && (options === null || options === void 0 ? void 0 : options.scalars)) {
299
+ const wrapped = returnedFunction.on;
300
+ returnedFunction.on = (fnToCall) => wrapped((data) => {
301
+ if (options === null || options === void 0 ? void 0 : options.scalars) {
302
+ return fnToCall((0, exports.decodeScalarsInResponse)({
303
+ response: data,
304
+ initialOp: operation,
305
+ initialZeusQuery: o,
306
+ returns: const_1.ReturnTypes,
307
+ scalars: options.scalars,
308
+ ops: const_1.Ops,
309
+ }));
310
+ }
311
+ return fnToCall(data);
312
+ });
313
+ }
314
+ return returnedFunction;
315
+ };
316
+ exports.SubscriptionThunderSSE = SubscriptionThunderSSE;
317
+ const SubscriptionSSE = (...options) => (0, exports.SubscriptionThunderSSE)((0, exports.apiSubscriptionSSE)(options));
318
+ exports.SubscriptionSSE = SubscriptionSSE;
319
+ const Zeus = (operation, o, ops) => (0, exports.InternalsBuildQuery)({
320
+ props: const_1.AllTypesProps,
321
+ returns: const_1.ReturnTypes,
322
+ ops: const_1.Ops,
323
+ options: ops === null || ops === void 0 ? void 0 : ops.operationOptions,
324
+ scalars: ops === null || ops === void 0 ? void 0 : ops.scalars,
325
+ })(operation, o);
326
+ exports.Zeus = Zeus;
327
+ const ZeusSelect = () => ((t) => t);
328
+ exports.ZeusSelect = ZeusSelect;
329
+ const Selector = (key) => key && (0, exports.ZeusSelect)();
330
+ exports.Selector = Selector;
331
+ const TypeFromSelector = (key) => key && (0, exports.ZeusSelect)();
332
+ exports.TypeFromSelector = TypeFromSelector;
333
+ exports.Gql = (0, exports.Chain)(exports.HOST, {
334
+ headers: Object.assign({ "Content-Type": "application/json" }, exports.HEADERS),
335
+ });
336
+ exports.ZeusScalars = (0, exports.ZeusSelect)();
337
+ const fields = (k) => {
338
+ const t = const_1.ReturnTypes[k];
339
+ const fnType = k in const_1.AllTypesProps
340
+ ? const_1.AllTypesProps[k]
341
+ : undefined;
342
+ const hasFnTypes = typeof fnType === "object" ? fnType : undefined;
343
+ const o = Object.fromEntries(Object.entries(t)
344
+ .filter(([k, value]) => {
345
+ const isFunctionType = hasFnTypes &&
346
+ k in hasFnTypes &&
347
+ !!hasFnTypes[k];
348
+ if (isFunctionType)
349
+ return false;
350
+ const isReturnType = const_1.ReturnTypes[value];
351
+ if (!isReturnType)
352
+ return true;
353
+ if (typeof isReturnType !== "string")
354
+ return false;
355
+ if (isReturnType.startsWith("scalar.")) {
356
+ return true;
357
+ }
358
+ return false;
359
+ })
360
+ .map(([key]) => [key, true]));
361
+ return o;
362
+ };
363
+ exports.fields = fields;
364
+ const decodeScalarsInResponse = ({ response, scalars, returns, ops, initialZeusQuery, initialOp, }) => {
365
+ if (!scalars) {
366
+ return response;
367
+ }
368
+ const builder = (0, exports.PrepareScalarPaths)({
369
+ ops,
370
+ returns,
371
+ });
372
+ const scalarPaths = builder(initialOp, ops[initialOp], initialZeusQuery);
373
+ if (scalarPaths) {
374
+ const r = (0, exports.traverseResponse)({ scalarPaths, resolvers: scalars })(initialOp, response, [ops[initialOp]]);
375
+ return r;
376
+ }
377
+ return response;
378
+ };
379
+ exports.decodeScalarsInResponse = decodeScalarsInResponse;
380
+ const traverseResponse = ({ resolvers, scalarPaths, }) => {
381
+ const ibb = (k, o, p = []) => {
382
+ var _a;
383
+ if (Array.isArray(o)) {
384
+ return o.map((eachO) => ibb(k, eachO, p));
385
+ }
386
+ if (o == null) {
387
+ return o;
388
+ }
389
+ const scalarPathString = p.join(exports.SEPARATOR);
390
+ const currentScalarString = scalarPaths[scalarPathString];
391
+ if (currentScalarString) {
392
+ const currentDecoder = (_a = resolvers[currentScalarString.split(".")[1]]) === null || _a === void 0 ? void 0 : _a.decode;
393
+ if (currentDecoder) {
394
+ return currentDecoder(o);
395
+ }
396
+ }
397
+ if (typeof o === "boolean" ||
398
+ typeof o === "number" ||
399
+ typeof o === "string" ||
400
+ !o) {
401
+ return o;
402
+ }
403
+ const entries = Object.entries(o).map(([k, v]) => [k, ibb(k, v, [...p, (0, exports.purifyGraphQLKey)(k)])]);
404
+ const objectFromEntries = entries.reduce((a, [k, v]) => {
405
+ a[k] = v;
406
+ return a;
407
+ }, {});
408
+ return objectFromEntries;
409
+ };
410
+ return ibb;
411
+ };
412
+ exports.traverseResponse = traverseResponse;
413
+ exports.SEPARATOR = "|";
414
+ class GraphQLError extends Error {
415
+ constructor(response) {
416
+ var _a, _b;
417
+ super(((_b = (_a = response.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || "GraphQL Response Error");
418
+ this.response = response;
419
+ console.error(response);
420
+ }
421
+ toString() {
422
+ return "GraphQL Response Error";
423
+ }
424
+ }
425
+ exports.GraphQLError = GraphQLError;
426
+ const ExtractScalar = (mappedParts, returns) => {
427
+ if (mappedParts.length === 0) {
428
+ return;
429
+ }
430
+ const oKey = mappedParts[0];
431
+ const returnP1 = returns[oKey];
432
+ if (typeof returnP1 === "object") {
433
+ const returnP2 = returnP1[mappedParts[1]];
434
+ if (returnP2) {
435
+ return ExtractScalar([returnP2, ...mappedParts.slice(2)], returns);
436
+ }
437
+ return undefined;
438
+ }
439
+ return returnP1;
440
+ };
441
+ const PrepareScalarPaths = ({ ops, returns, }) => {
442
+ const ibb = (k, originalKey, o, p = [], pOriginals = [], root = true) => {
443
+ if (!o) {
444
+ return;
445
+ }
446
+ if (typeof o === "boolean" ||
447
+ typeof o === "number" ||
448
+ typeof o === "string") {
449
+ const extractionArray = [...pOriginals, originalKey];
450
+ const isScalar = ExtractScalar(extractionArray, returns);
451
+ if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith("scalar")) {
452
+ const partOfTree = {
453
+ [[...p, k].join(exports.SEPARATOR)]: isScalar,
454
+ };
455
+ return partOfTree;
456
+ }
457
+ return {};
458
+ }
459
+ if (Array.isArray(o)) {
460
+ return ibb(k, k, o[1], p, pOriginals, false);
461
+ }
462
+ if (k === "__alias") {
463
+ return Object.entries(o)
464
+ .map(([alias, objectUnderAlias]) => {
465
+ if (typeof objectUnderAlias !== "object" ||
466
+ Array.isArray(objectUnderAlias)) {
467
+ throw new Error("Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}");
468
+ }
469
+ const operationName = Object.keys(objectUnderAlias)[0];
470
+ const operation = objectUnderAlias[operationName];
471
+ return ibb(alias, operationName, operation, p, pOriginals, false);
472
+ })
473
+ .reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
474
+ }
475
+ const keyName = root ? ops[k] : k;
476
+ return Object.entries(o)
477
+ .filter(([k]) => k !== "__directives")
478
+ .map(([k, v]) => {
479
+ // Inline fragments shouldn't be added to the path as they aren't a field
480
+ const isInlineFragment = originalKey.match(/^...\s*on/) != null;
481
+ return ibb(k, k, v, isInlineFragment ? p : [...p, (0, exports.purifyGraphQLKey)(keyName || k)], isInlineFragment
482
+ ? pOriginals
483
+ : [...pOriginals, (0, exports.purifyGraphQLKey)(originalKey)], false);
484
+ })
485
+ .reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
486
+ };
487
+ return ibb;
488
+ };
489
+ exports.PrepareScalarPaths = PrepareScalarPaths;
490
+ const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g, "").replace(/^[^:]*\:/g, "");
491
+ exports.purifyGraphQLKey = purifyGraphQLKey;
492
+ const mapPart = (p) => {
493
+ const [isArg, isField] = p.split("<>");
494
+ if (isField) {
495
+ return {
496
+ v: isField,
497
+ __type: "field",
498
+ };
499
+ }
500
+ return {
501
+ v: isArg,
502
+ __type: "arg",
503
+ };
504
+ };
505
+ const ResolveFromPath = (props, returns, ops) => {
506
+ const ResolvePropsType = (mappedParts) => {
507
+ const oKey = ops[mappedParts[0].v];
508
+ const propsP1 = oKey ? props[oKey] : props[mappedParts[0].v];
509
+ if (propsP1 === "enum" && mappedParts.length === 1) {
510
+ return "enum";
511
+ }
512
+ if (typeof propsP1 === "string" &&
513
+ propsP1.startsWith("scalar.") &&
514
+ mappedParts.length === 1) {
515
+ return propsP1;
516
+ }
517
+ if (typeof propsP1 === "object") {
518
+ if (mappedParts.length < 2) {
519
+ return "not";
520
+ }
521
+ const propsP2 = propsP1[mappedParts[1].v];
522
+ if (typeof propsP2 === "string") {
523
+ return rpp(`${propsP2}${exports.SEPARATOR}${mappedParts
524
+ .slice(2)
525
+ .map((mp) => mp.v)
526
+ .join(exports.SEPARATOR)}`);
527
+ }
528
+ if (typeof propsP2 === "object") {
529
+ if (mappedParts.length < 3) {
530
+ return "not";
531
+ }
532
+ const propsP3 = propsP2[mappedParts[2].v];
533
+ if (propsP3 && mappedParts[2].__type === "arg") {
534
+ return rpp(`${propsP3}${exports.SEPARATOR}${mappedParts
535
+ .slice(3)
536
+ .map((mp) => mp.v)
537
+ .join(exports.SEPARATOR)}`);
538
+ }
539
+ }
540
+ }
541
+ };
542
+ const ResolveReturnType = (mappedParts) => {
543
+ if (mappedParts.length === 0) {
544
+ return "not";
545
+ }
546
+ const oKey = ops[mappedParts[0].v];
547
+ const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
548
+ if (typeof returnP1 === "object") {
549
+ if (mappedParts.length < 2)
550
+ return "not";
551
+ const returnP2 = returnP1[mappedParts[1].v];
552
+ if (returnP2) {
553
+ return rpp(`${returnP2}${exports.SEPARATOR}${mappedParts
554
+ .slice(2)
555
+ .map((mp) => mp.v)
556
+ .join(exports.SEPARATOR)}`);
557
+ }
558
+ }
559
+ };
560
+ const rpp = (path) => {
561
+ const parts = path.split(exports.SEPARATOR).filter((l) => l.length > 0);
562
+ const mappedParts = parts.map(mapPart);
563
+ const propsP1 = ResolvePropsType(mappedParts);
564
+ if (propsP1) {
565
+ return propsP1;
566
+ }
567
+ const returnP1 = ResolveReturnType(mappedParts);
568
+ if (returnP1) {
569
+ return returnP1;
570
+ }
571
+ return "not";
572
+ };
573
+ return rpp;
574
+ };
575
+ exports.ResolveFromPath = ResolveFromPath;
576
+ const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
577
+ const arb = (a, p = "", root = true) => {
578
+ var _a, _b;
579
+ if (typeof a === "string") {
580
+ if (a.startsWith(exports.START_VAR_NAME)) {
581
+ const [varName, graphQLType] = a
582
+ .replace(exports.START_VAR_NAME, "$")
583
+ .split(exports.GRAPHQL_TYPE_SEPARATOR);
584
+ const v = vars.find((v) => v.name === varName);
585
+ if (!v) {
586
+ vars.push({
587
+ name: varName,
588
+ graphQLType,
589
+ });
590
+ }
591
+ else {
592
+ if (v.graphQLType !== graphQLType) {
593
+ throw new Error(`Invalid variable exists with two different GraphQL Types, "${v.graphQLType}" and ${graphQLType}`);
594
+ }
595
+ }
596
+ return varName;
597
+ }
598
+ }
599
+ const checkType = (0, exports.ResolveFromPath)(props, returns, ops)(p);
600
+ if (checkType.startsWith("scalar.")) {
601
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
602
+ const [_, ...splittedScalar] = checkType.split(".");
603
+ const scalarKey = splittedScalar.join(".");
604
+ return ((_b = (_a = scalars === null || scalars === void 0 ? void 0 : scalars[scalarKey]) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.call(_a, a)) || JSON.stringify(a);
605
+ }
606
+ if (Array.isArray(a)) {
607
+ return `[${a.map((arr) => arb(arr, p, false)).join(", ")}]`;
608
+ }
609
+ if (typeof a === "string") {
610
+ if (checkType === "enum") {
611
+ return a;
612
+ }
613
+ return `${JSON.stringify(a)}`;
614
+ }
615
+ if (typeof a === "object") {
616
+ if (a === null) {
617
+ return `null`;
618
+ }
619
+ const returnedObjectString = Object.entries(a)
620
+ .filter(([, v]) => typeof v !== "undefined")
621
+ .map(([k, v]) => `${k}: ${arb(v, [p, k].join(exports.SEPARATOR), false)}`)
622
+ .join(",\n");
623
+ if (!root) {
624
+ return `{${returnedObjectString}}`;
625
+ }
626
+ return returnedObjectString;
627
+ }
628
+ return `${a}`;
629
+ };
630
+ return arb;
631
+ };
632
+ exports.InternalArgsBuilt = InternalArgsBuilt;
633
+ const resolverFor = (_type, _field, fn) => fn;
634
+ exports.resolverFor = resolverFor;
635
+ exports.START_VAR_NAME = `$ZEUS_VAR`;
636
+ exports.GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
637
+ const $ = (name, graphqlType) => {
638
+ return (exports.START_VAR_NAME +
639
+ name +
640
+ exports.GRAPHQL_TYPE_SEPARATOR +
641
+ graphqlType);
642
+ };
643
+ exports.$ = $;
644
+ /** @description
645
+ The state of a Job in the JobQueue
646
+
647
+ @docsCategory common */
648
+ var JobState;
649
+ (function (JobState) {
650
+ JobState["PENDING"] = "PENDING";
651
+ JobState["RUNNING"] = "RUNNING";
652
+ JobState["COMPLETED"] = "COMPLETED";
653
+ JobState["RETRYING"] = "RETRYING";
654
+ JobState["FAILED"] = "FAILED";
655
+ JobState["CANCELLED"] = "CANCELLED";
656
+ })(JobState || (exports.JobState = JobState = {}));
657
+ var StockMovementType;
658
+ (function (StockMovementType) {
659
+ StockMovementType["ADJUSTMENT"] = "ADJUSTMENT";
660
+ StockMovementType["ALLOCATION"] = "ALLOCATION";
661
+ StockMovementType["RELEASE"] = "RELEASE";
662
+ StockMovementType["SALE"] = "SALE";
663
+ StockMovementType["CANCELLATION"] = "CANCELLATION";
664
+ StockMovementType["RETURN"] = "RETURN";
665
+ })(StockMovementType || (exports.StockMovementType = StockMovementType = {}));
666
+ var AssetType;
667
+ (function (AssetType) {
668
+ AssetType["IMAGE"] = "IMAGE";
669
+ AssetType["VIDEO"] = "VIDEO";
670
+ AssetType["BINARY"] = "BINARY";
671
+ })(AssetType || (exports.AssetType = AssetType = {}));
672
+ var GlobalFlag;
673
+ (function (GlobalFlag) {
674
+ GlobalFlag["TRUE"] = "TRUE";
675
+ GlobalFlag["FALSE"] = "FALSE";
676
+ GlobalFlag["INHERIT"] = "INHERIT";
677
+ })(GlobalFlag || (exports.GlobalFlag = GlobalFlag = {}));
678
+ var AdjustmentType;
679
+ (function (AdjustmentType) {
680
+ AdjustmentType["PROMOTION"] = "PROMOTION";
681
+ AdjustmentType["DISTRIBUTED_ORDER_PROMOTION"] = "DISTRIBUTED_ORDER_PROMOTION";
682
+ AdjustmentType["OTHER"] = "OTHER";
683
+ })(AdjustmentType || (exports.AdjustmentType = AdjustmentType = {}));
684
+ var DeletionResult;
685
+ (function (DeletionResult) {
686
+ DeletionResult["DELETED"] = "DELETED";
687
+ DeletionResult["NOT_DELETED"] = "NOT_DELETED";
688
+ })(DeletionResult || (exports.DeletionResult = DeletionResult = {}));
689
+ /** @description
690
+ Permissions for administrators and customers. Used to control access to
691
+ GraphQL resolvers via the {@link Allow} decorator.
692
+
693
+ ## Understanding Permission.Owner
694
+
695
+ `Permission.Owner` is a special permission which is used in some Deenruv resolvers to indicate that that resolver should only
696
+ be accessible to the "owner" of that resource.
697
+
698
+ For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
699
+ based on the activeUserId of the current session. As a result, the resolver code looks like this:
700
+
701
+ @example
702
+ ```TypeScript
703
+ \@Query()
704
+ \@Allow(Permission.Owner)
705
+ async activeCustomer(\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
706
+ const userId = ctx.activeUserId;
707
+ if (userId) {
708
+ return this.customerService.findOneByUserId(ctx, userId);
709
+ }
710
+ }
711
+ ```
712
+
713
+ Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
714
+ nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner
715
+ of the resource has access. If not, then it is the equivalent of using `Permission.Public`.
716
+
717
+
718
+ @docsCategory common */
719
+ var Permission;
720
+ (function (Permission) {
721
+ Permission["Authenticated"] = "Authenticated";
722
+ Permission["SuperAdmin"] = "SuperAdmin";
723
+ Permission["Owner"] = "Owner";
724
+ Permission["Public"] = "Public";
725
+ Permission["UpdateGlobalSettings"] = "UpdateGlobalSettings";
726
+ Permission["CreateCatalog"] = "CreateCatalog";
727
+ Permission["ReadCatalog"] = "ReadCatalog";
728
+ Permission["UpdateCatalog"] = "UpdateCatalog";
729
+ Permission["DeleteCatalog"] = "DeleteCatalog";
730
+ Permission["CreateSettings"] = "CreateSettings";
731
+ Permission["ReadSettings"] = "ReadSettings";
732
+ Permission["UpdateSettings"] = "UpdateSettings";
733
+ Permission["DeleteSettings"] = "DeleteSettings";
734
+ Permission["CreateAdministrator"] = "CreateAdministrator";
735
+ Permission["ReadAdministrator"] = "ReadAdministrator";
736
+ Permission["UpdateAdministrator"] = "UpdateAdministrator";
737
+ Permission["DeleteAdministrator"] = "DeleteAdministrator";
738
+ Permission["CreateAsset"] = "CreateAsset";
739
+ Permission["ReadAsset"] = "ReadAsset";
740
+ Permission["UpdateAsset"] = "UpdateAsset";
741
+ Permission["DeleteAsset"] = "DeleteAsset";
742
+ Permission["CreateChannel"] = "CreateChannel";
743
+ Permission["ReadChannel"] = "ReadChannel";
744
+ Permission["UpdateChannel"] = "UpdateChannel";
745
+ Permission["DeleteChannel"] = "DeleteChannel";
746
+ Permission["CreateCollection"] = "CreateCollection";
747
+ Permission["ReadCollection"] = "ReadCollection";
748
+ Permission["UpdateCollection"] = "UpdateCollection";
749
+ Permission["DeleteCollection"] = "DeleteCollection";
750
+ Permission["CreateCountry"] = "CreateCountry";
751
+ Permission["ReadCountry"] = "ReadCountry";
752
+ Permission["UpdateCountry"] = "UpdateCountry";
753
+ Permission["DeleteCountry"] = "DeleteCountry";
754
+ Permission["CreateCustomer"] = "CreateCustomer";
755
+ Permission["ReadCustomer"] = "ReadCustomer";
756
+ Permission["UpdateCustomer"] = "UpdateCustomer";
757
+ Permission["DeleteCustomer"] = "DeleteCustomer";
758
+ Permission["CreateCustomerGroup"] = "CreateCustomerGroup";
759
+ Permission["ReadCustomerGroup"] = "ReadCustomerGroup";
760
+ Permission["UpdateCustomerGroup"] = "UpdateCustomerGroup";
761
+ Permission["DeleteCustomerGroup"] = "DeleteCustomerGroup";
762
+ Permission["CreateFacet"] = "CreateFacet";
763
+ Permission["ReadFacet"] = "ReadFacet";
764
+ Permission["UpdateFacet"] = "UpdateFacet";
765
+ Permission["DeleteFacet"] = "DeleteFacet";
766
+ Permission["CreateOrder"] = "CreateOrder";
767
+ Permission["ReadOrder"] = "ReadOrder";
768
+ Permission["UpdateOrder"] = "UpdateOrder";
769
+ Permission["DeleteOrder"] = "DeleteOrder";
770
+ Permission["CreatePaymentMethod"] = "CreatePaymentMethod";
771
+ Permission["ReadPaymentMethod"] = "ReadPaymentMethod";
772
+ Permission["UpdatePaymentMethod"] = "UpdatePaymentMethod";
773
+ Permission["DeletePaymentMethod"] = "DeletePaymentMethod";
774
+ Permission["CreateProduct"] = "CreateProduct";
775
+ Permission["ReadProduct"] = "ReadProduct";
776
+ Permission["UpdateProduct"] = "UpdateProduct";
777
+ Permission["DeleteProduct"] = "DeleteProduct";
778
+ Permission["CreatePromotion"] = "CreatePromotion";
779
+ Permission["ReadPromotion"] = "ReadPromotion";
780
+ Permission["UpdatePromotion"] = "UpdatePromotion";
781
+ Permission["DeletePromotion"] = "DeletePromotion";
782
+ Permission["CreateShippingMethod"] = "CreateShippingMethod";
783
+ Permission["ReadShippingMethod"] = "ReadShippingMethod";
784
+ Permission["UpdateShippingMethod"] = "UpdateShippingMethod";
785
+ Permission["DeleteShippingMethod"] = "DeleteShippingMethod";
786
+ Permission["CreateTag"] = "CreateTag";
787
+ Permission["ReadTag"] = "ReadTag";
788
+ Permission["UpdateTag"] = "UpdateTag";
789
+ Permission["DeleteTag"] = "DeleteTag";
790
+ Permission["CreateTaxCategory"] = "CreateTaxCategory";
791
+ Permission["ReadTaxCategory"] = "ReadTaxCategory";
792
+ Permission["UpdateTaxCategory"] = "UpdateTaxCategory";
793
+ Permission["DeleteTaxCategory"] = "DeleteTaxCategory";
794
+ Permission["CreateTaxRate"] = "CreateTaxRate";
795
+ Permission["ReadTaxRate"] = "ReadTaxRate";
796
+ Permission["UpdateTaxRate"] = "UpdateTaxRate";
797
+ Permission["DeleteTaxRate"] = "DeleteTaxRate";
798
+ Permission["CreateSeller"] = "CreateSeller";
799
+ Permission["ReadSeller"] = "ReadSeller";
800
+ Permission["UpdateSeller"] = "UpdateSeller";
801
+ Permission["DeleteSeller"] = "DeleteSeller";
802
+ Permission["CreateStockLocation"] = "CreateStockLocation";
803
+ Permission["ReadStockLocation"] = "ReadStockLocation";
804
+ Permission["UpdateStockLocation"] = "UpdateStockLocation";
805
+ Permission["DeleteStockLocation"] = "DeleteStockLocation";
806
+ Permission["CreateSystem"] = "CreateSystem";
807
+ Permission["ReadSystem"] = "ReadSystem";
808
+ Permission["UpdateSystem"] = "UpdateSystem";
809
+ Permission["DeleteSystem"] = "DeleteSystem";
810
+ Permission["CreateZone"] = "CreateZone";
811
+ Permission["ReadZone"] = "ReadZone";
812
+ Permission["UpdateZone"] = "UpdateZone";
813
+ Permission["DeleteZone"] = "DeleteZone";
814
+ })(Permission || (exports.Permission = Permission = {}));
815
+ var SortOrder;
816
+ (function (SortOrder) {
817
+ SortOrder["ASC"] = "ASC";
818
+ SortOrder["DESC"] = "DESC";
819
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
820
+ var ErrorCode;
821
+ (function (ErrorCode) {
822
+ ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
823
+ ErrorCode["MIME_TYPE_ERROR"] = "MIME_TYPE_ERROR";
824
+ ErrorCode["LANGUAGE_NOT_AVAILABLE_ERROR"] = "LANGUAGE_NOT_AVAILABLE_ERROR";
825
+ ErrorCode["DUPLICATE_ENTITY_ERROR"] = "DUPLICATE_ENTITY_ERROR";
826
+ ErrorCode["FACET_IN_USE_ERROR"] = "FACET_IN_USE_ERROR";
827
+ ErrorCode["CHANNEL_DEFAULT_LANGUAGE_ERROR"] = "CHANNEL_DEFAULT_LANGUAGE_ERROR";
828
+ ErrorCode["SETTLE_PAYMENT_ERROR"] = "SETTLE_PAYMENT_ERROR";
829
+ ErrorCode["CANCEL_PAYMENT_ERROR"] = "CANCEL_PAYMENT_ERROR";
830
+ ErrorCode["EMPTY_ORDER_LINE_SELECTION_ERROR"] = "EMPTY_ORDER_LINE_SELECTION_ERROR";
831
+ ErrorCode["ITEMS_ALREADY_FULFILLED_ERROR"] = "ITEMS_ALREADY_FULFILLED_ERROR";
832
+ ErrorCode["INVALID_FULFILLMENT_HANDLER_ERROR"] = "INVALID_FULFILLMENT_HANDLER_ERROR";
833
+ ErrorCode["CREATE_FULFILLMENT_ERROR"] = "CREATE_FULFILLMENT_ERROR";
834
+ ErrorCode["INSUFFICIENT_STOCK_ON_HAND_ERROR"] = "INSUFFICIENT_STOCK_ON_HAND_ERROR";
835
+ ErrorCode["MULTIPLE_ORDER_ERROR"] = "MULTIPLE_ORDER_ERROR";
836
+ ErrorCode["CANCEL_ACTIVE_ORDER_ERROR"] = "CANCEL_ACTIVE_ORDER_ERROR";
837
+ ErrorCode["PAYMENT_ORDER_MISMATCH_ERROR"] = "PAYMENT_ORDER_MISMATCH_ERROR";
838
+ ErrorCode["REFUND_ORDER_STATE_ERROR"] = "REFUND_ORDER_STATE_ERROR";
839
+ ErrorCode["NOTHING_TO_REFUND_ERROR"] = "NOTHING_TO_REFUND_ERROR";
840
+ ErrorCode["ALREADY_REFUNDED_ERROR"] = "ALREADY_REFUNDED_ERROR";
841
+ ErrorCode["QUANTITY_TOO_GREAT_ERROR"] = "QUANTITY_TOO_GREAT_ERROR";
842
+ ErrorCode["REFUND_AMOUNT_ERROR"] = "REFUND_AMOUNT_ERROR";
843
+ ErrorCode["REFUND_STATE_TRANSITION_ERROR"] = "REFUND_STATE_TRANSITION_ERROR";
844
+ ErrorCode["PAYMENT_STATE_TRANSITION_ERROR"] = "PAYMENT_STATE_TRANSITION_ERROR";
845
+ ErrorCode["FULFILLMENT_STATE_TRANSITION_ERROR"] = "FULFILLMENT_STATE_TRANSITION_ERROR";
846
+ ErrorCode["ORDER_MODIFICATION_STATE_ERROR"] = "ORDER_MODIFICATION_STATE_ERROR";
847
+ ErrorCode["NO_CHANGES_SPECIFIED_ERROR"] = "NO_CHANGES_SPECIFIED_ERROR";
848
+ ErrorCode["PAYMENT_METHOD_MISSING_ERROR"] = "PAYMENT_METHOD_MISSING_ERROR";
849
+ ErrorCode["REFUND_PAYMENT_ID_MISSING_ERROR"] = "REFUND_PAYMENT_ID_MISSING_ERROR";
850
+ ErrorCode["MANUAL_PAYMENT_STATE_ERROR"] = "MANUAL_PAYMENT_STATE_ERROR";
851
+ ErrorCode["PRODUCT_OPTION_IN_USE_ERROR"] = "PRODUCT_OPTION_IN_USE_ERROR";
852
+ ErrorCode["MISSING_CONDITIONS_ERROR"] = "MISSING_CONDITIONS_ERROR";
853
+ ErrorCode["NATIVE_AUTH_STRATEGY_ERROR"] = "NATIVE_AUTH_STRATEGY_ERROR";
854
+ ErrorCode["INVALID_CREDENTIALS_ERROR"] = "INVALID_CREDENTIALS_ERROR";
855
+ ErrorCode["ORDER_STATE_TRANSITION_ERROR"] = "ORDER_STATE_TRANSITION_ERROR";
856
+ ErrorCode["EMAIL_ADDRESS_CONFLICT_ERROR"] = "EMAIL_ADDRESS_CONFLICT_ERROR";
857
+ ErrorCode["GUEST_CHECKOUT_ERROR"] = "GUEST_CHECKOUT_ERROR";
858
+ ErrorCode["ORDER_LIMIT_ERROR"] = "ORDER_LIMIT_ERROR";
859
+ ErrorCode["NEGATIVE_QUANTITY_ERROR"] = "NEGATIVE_QUANTITY_ERROR";
860
+ ErrorCode["INSUFFICIENT_STOCK_ERROR"] = "INSUFFICIENT_STOCK_ERROR";
861
+ ErrorCode["COUPON_CODE_INVALID_ERROR"] = "COUPON_CODE_INVALID_ERROR";
862
+ ErrorCode["COUPON_CODE_EXPIRED_ERROR"] = "COUPON_CODE_EXPIRED_ERROR";
863
+ ErrorCode["COUPON_CODE_LIMIT_ERROR"] = "COUPON_CODE_LIMIT_ERROR";
864
+ ErrorCode["ORDER_MODIFICATION_ERROR"] = "ORDER_MODIFICATION_ERROR";
865
+ ErrorCode["INELIGIBLE_SHIPPING_METHOD_ERROR"] = "INELIGIBLE_SHIPPING_METHOD_ERROR";
866
+ ErrorCode["NO_ACTIVE_ORDER_ERROR"] = "NO_ACTIVE_ORDER_ERROR";
867
+ ErrorCode["ORDER_MIDDLEWARE_ERROR"] = "ORDER_MIDDLEWARE_ERROR";
868
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
869
+ var LogicalOperator;
870
+ (function (LogicalOperator) {
871
+ LogicalOperator["AND"] = "AND";
872
+ LogicalOperator["OR"] = "OR";
873
+ })(LogicalOperator || (exports.LogicalOperator = LogicalOperator = {}));
874
+ /** @description
875
+ ISO 4217 currency code
876
+
877
+ @docsCategory common */
878
+ var CurrencyCode;
879
+ (function (CurrencyCode) {
880
+ CurrencyCode["AED"] = "AED";
881
+ CurrencyCode["AFN"] = "AFN";
882
+ CurrencyCode["ALL"] = "ALL";
883
+ CurrencyCode["AMD"] = "AMD";
884
+ CurrencyCode["ANG"] = "ANG";
885
+ CurrencyCode["AOA"] = "AOA";
886
+ CurrencyCode["ARS"] = "ARS";
887
+ CurrencyCode["AUD"] = "AUD";
888
+ CurrencyCode["AWG"] = "AWG";
889
+ CurrencyCode["AZN"] = "AZN";
890
+ CurrencyCode["BAM"] = "BAM";
891
+ CurrencyCode["BBD"] = "BBD";
892
+ CurrencyCode["BDT"] = "BDT";
893
+ CurrencyCode["BGN"] = "BGN";
894
+ CurrencyCode["BHD"] = "BHD";
895
+ CurrencyCode["BIF"] = "BIF";
896
+ CurrencyCode["BMD"] = "BMD";
897
+ CurrencyCode["BND"] = "BND";
898
+ CurrencyCode["BOB"] = "BOB";
899
+ CurrencyCode["BRL"] = "BRL";
900
+ CurrencyCode["BSD"] = "BSD";
901
+ CurrencyCode["BTN"] = "BTN";
902
+ CurrencyCode["BWP"] = "BWP";
903
+ CurrencyCode["BYN"] = "BYN";
904
+ CurrencyCode["BZD"] = "BZD";
905
+ CurrencyCode["CAD"] = "CAD";
906
+ CurrencyCode["CDF"] = "CDF";
907
+ CurrencyCode["CHF"] = "CHF";
908
+ CurrencyCode["CLP"] = "CLP";
909
+ CurrencyCode["CNY"] = "CNY";
910
+ CurrencyCode["COP"] = "COP";
911
+ CurrencyCode["CRC"] = "CRC";
912
+ CurrencyCode["CUC"] = "CUC";
913
+ CurrencyCode["CUP"] = "CUP";
914
+ CurrencyCode["CVE"] = "CVE";
915
+ CurrencyCode["CZK"] = "CZK";
916
+ CurrencyCode["DJF"] = "DJF";
917
+ CurrencyCode["DKK"] = "DKK";
918
+ CurrencyCode["DOP"] = "DOP";
919
+ CurrencyCode["DZD"] = "DZD";
920
+ CurrencyCode["EGP"] = "EGP";
921
+ CurrencyCode["ERN"] = "ERN";
922
+ CurrencyCode["ETB"] = "ETB";
923
+ CurrencyCode["EUR"] = "EUR";
924
+ CurrencyCode["FJD"] = "FJD";
925
+ CurrencyCode["FKP"] = "FKP";
926
+ CurrencyCode["GBP"] = "GBP";
927
+ CurrencyCode["GEL"] = "GEL";
928
+ CurrencyCode["GHS"] = "GHS";
929
+ CurrencyCode["GIP"] = "GIP";
930
+ CurrencyCode["GMD"] = "GMD";
931
+ CurrencyCode["GNF"] = "GNF";
932
+ CurrencyCode["GTQ"] = "GTQ";
933
+ CurrencyCode["GYD"] = "GYD";
934
+ CurrencyCode["HKD"] = "HKD";
935
+ CurrencyCode["HNL"] = "HNL";
936
+ CurrencyCode["HRK"] = "HRK";
937
+ CurrencyCode["HTG"] = "HTG";
938
+ CurrencyCode["HUF"] = "HUF";
939
+ CurrencyCode["IDR"] = "IDR";
940
+ CurrencyCode["ILS"] = "ILS";
941
+ CurrencyCode["INR"] = "INR";
942
+ CurrencyCode["IQD"] = "IQD";
943
+ CurrencyCode["IRR"] = "IRR";
944
+ CurrencyCode["ISK"] = "ISK";
945
+ CurrencyCode["JMD"] = "JMD";
946
+ CurrencyCode["JOD"] = "JOD";
947
+ CurrencyCode["JPY"] = "JPY";
948
+ CurrencyCode["KES"] = "KES";
949
+ CurrencyCode["KGS"] = "KGS";
950
+ CurrencyCode["KHR"] = "KHR";
951
+ CurrencyCode["KMF"] = "KMF";
952
+ CurrencyCode["KPW"] = "KPW";
953
+ CurrencyCode["KRW"] = "KRW";
954
+ CurrencyCode["KWD"] = "KWD";
955
+ CurrencyCode["KYD"] = "KYD";
956
+ CurrencyCode["KZT"] = "KZT";
957
+ CurrencyCode["LAK"] = "LAK";
958
+ CurrencyCode["LBP"] = "LBP";
959
+ CurrencyCode["LKR"] = "LKR";
960
+ CurrencyCode["LRD"] = "LRD";
961
+ CurrencyCode["LSL"] = "LSL";
962
+ CurrencyCode["LYD"] = "LYD";
963
+ CurrencyCode["MAD"] = "MAD";
964
+ CurrencyCode["MDL"] = "MDL";
965
+ CurrencyCode["MGA"] = "MGA";
966
+ CurrencyCode["MKD"] = "MKD";
967
+ CurrencyCode["MMK"] = "MMK";
968
+ CurrencyCode["MNT"] = "MNT";
969
+ CurrencyCode["MOP"] = "MOP";
970
+ CurrencyCode["MRU"] = "MRU";
971
+ CurrencyCode["MUR"] = "MUR";
972
+ CurrencyCode["MVR"] = "MVR";
973
+ CurrencyCode["MWK"] = "MWK";
974
+ CurrencyCode["MXN"] = "MXN";
975
+ CurrencyCode["MYR"] = "MYR";
976
+ CurrencyCode["MZN"] = "MZN";
977
+ CurrencyCode["NAD"] = "NAD";
978
+ CurrencyCode["NGN"] = "NGN";
979
+ CurrencyCode["NIO"] = "NIO";
980
+ CurrencyCode["NOK"] = "NOK";
981
+ CurrencyCode["NPR"] = "NPR";
982
+ CurrencyCode["NZD"] = "NZD";
983
+ CurrencyCode["OMR"] = "OMR";
984
+ CurrencyCode["PAB"] = "PAB";
985
+ CurrencyCode["PEN"] = "PEN";
986
+ CurrencyCode["PGK"] = "PGK";
987
+ CurrencyCode["PHP"] = "PHP";
988
+ CurrencyCode["PKR"] = "PKR";
989
+ CurrencyCode["PLN"] = "PLN";
990
+ CurrencyCode["PYG"] = "PYG";
991
+ CurrencyCode["QAR"] = "QAR";
992
+ CurrencyCode["RON"] = "RON";
993
+ CurrencyCode["RSD"] = "RSD";
994
+ CurrencyCode["RUB"] = "RUB";
995
+ CurrencyCode["RWF"] = "RWF";
996
+ CurrencyCode["SAR"] = "SAR";
997
+ CurrencyCode["SBD"] = "SBD";
998
+ CurrencyCode["SCR"] = "SCR";
999
+ CurrencyCode["SDG"] = "SDG";
1000
+ CurrencyCode["SEK"] = "SEK";
1001
+ CurrencyCode["SGD"] = "SGD";
1002
+ CurrencyCode["SHP"] = "SHP";
1003
+ CurrencyCode["SLL"] = "SLL";
1004
+ CurrencyCode["SOS"] = "SOS";
1005
+ CurrencyCode["SRD"] = "SRD";
1006
+ CurrencyCode["SSP"] = "SSP";
1007
+ CurrencyCode["STN"] = "STN";
1008
+ CurrencyCode["SVC"] = "SVC";
1009
+ CurrencyCode["SYP"] = "SYP";
1010
+ CurrencyCode["SZL"] = "SZL";
1011
+ CurrencyCode["THB"] = "THB";
1012
+ CurrencyCode["TJS"] = "TJS";
1013
+ CurrencyCode["TMT"] = "TMT";
1014
+ CurrencyCode["TND"] = "TND";
1015
+ CurrencyCode["TOP"] = "TOP";
1016
+ CurrencyCode["TRY"] = "TRY";
1017
+ CurrencyCode["TTD"] = "TTD";
1018
+ CurrencyCode["TWD"] = "TWD";
1019
+ CurrencyCode["TZS"] = "TZS";
1020
+ CurrencyCode["UAH"] = "UAH";
1021
+ CurrencyCode["UGX"] = "UGX";
1022
+ CurrencyCode["USD"] = "USD";
1023
+ CurrencyCode["UYU"] = "UYU";
1024
+ CurrencyCode["UZS"] = "UZS";
1025
+ CurrencyCode["VES"] = "VES";
1026
+ CurrencyCode["VND"] = "VND";
1027
+ CurrencyCode["VUV"] = "VUV";
1028
+ CurrencyCode["WST"] = "WST";
1029
+ CurrencyCode["XAF"] = "XAF";
1030
+ CurrencyCode["XCD"] = "XCD";
1031
+ CurrencyCode["XOF"] = "XOF";
1032
+ CurrencyCode["XPF"] = "XPF";
1033
+ CurrencyCode["YER"] = "YER";
1034
+ CurrencyCode["ZAR"] = "ZAR";
1035
+ CurrencyCode["ZMW"] = "ZMW";
1036
+ CurrencyCode["ZWL"] = "ZWL";
1037
+ })(CurrencyCode || (exports.CurrencyCode = CurrencyCode = {}));
1038
+ var HistoryEntryType;
1039
+ (function (HistoryEntryType) {
1040
+ HistoryEntryType["CUSTOMER_REGISTERED"] = "CUSTOMER_REGISTERED";
1041
+ HistoryEntryType["CUSTOMER_VERIFIED"] = "CUSTOMER_VERIFIED";
1042
+ HistoryEntryType["CUSTOMER_DETAIL_UPDATED"] = "CUSTOMER_DETAIL_UPDATED";
1043
+ HistoryEntryType["CUSTOMER_ADDED_TO_GROUP"] = "CUSTOMER_ADDED_TO_GROUP";
1044
+ HistoryEntryType["CUSTOMER_REMOVED_FROM_GROUP"] = "CUSTOMER_REMOVED_FROM_GROUP";
1045
+ HistoryEntryType["CUSTOMER_ADDRESS_CREATED"] = "CUSTOMER_ADDRESS_CREATED";
1046
+ HistoryEntryType["CUSTOMER_ADDRESS_UPDATED"] = "CUSTOMER_ADDRESS_UPDATED";
1047
+ HistoryEntryType["CUSTOMER_ADDRESS_DELETED"] = "CUSTOMER_ADDRESS_DELETED";
1048
+ HistoryEntryType["CUSTOMER_PASSWORD_UPDATED"] = "CUSTOMER_PASSWORD_UPDATED";
1049
+ HistoryEntryType["CUSTOMER_PASSWORD_RESET_REQUESTED"] = "CUSTOMER_PASSWORD_RESET_REQUESTED";
1050
+ HistoryEntryType["CUSTOMER_PASSWORD_RESET_VERIFIED"] = "CUSTOMER_PASSWORD_RESET_VERIFIED";
1051
+ HistoryEntryType["CUSTOMER_EMAIL_UPDATE_REQUESTED"] = "CUSTOMER_EMAIL_UPDATE_REQUESTED";
1052
+ HistoryEntryType["CUSTOMER_EMAIL_UPDATE_VERIFIED"] = "CUSTOMER_EMAIL_UPDATE_VERIFIED";
1053
+ HistoryEntryType["CUSTOMER_NOTE"] = "CUSTOMER_NOTE";
1054
+ HistoryEntryType["ORDER_STATE_TRANSITION"] = "ORDER_STATE_TRANSITION";
1055
+ HistoryEntryType["ORDER_PAYMENT_TRANSITION"] = "ORDER_PAYMENT_TRANSITION";
1056
+ HistoryEntryType["ORDER_FULFILLMENT"] = "ORDER_FULFILLMENT";
1057
+ HistoryEntryType["ORDER_CANCELLATION"] = "ORDER_CANCELLATION";
1058
+ HistoryEntryType["ORDER_REFUND_TRANSITION"] = "ORDER_REFUND_TRANSITION";
1059
+ HistoryEntryType["ORDER_FULFILLMENT_TRANSITION"] = "ORDER_FULFILLMENT_TRANSITION";
1060
+ HistoryEntryType["ORDER_NOTE"] = "ORDER_NOTE";
1061
+ HistoryEntryType["ORDER_COUPON_APPLIED"] = "ORDER_COUPON_APPLIED";
1062
+ HistoryEntryType["ORDER_COUPON_REMOVED"] = "ORDER_COUPON_REMOVED";
1063
+ HistoryEntryType["ORDER_MODIFIED"] = "ORDER_MODIFIED";
1064
+ HistoryEntryType["ORDER_CUSTOMER_UPDATED"] = "ORDER_CUSTOMER_UPDATED";
1065
+ })(HistoryEntryType || (exports.HistoryEntryType = HistoryEntryType = {}));
1066
+ /** @description
1067
+ Languages in the form of a ISO 639-1 language code with optional
1068
+ region or script modifier (e.g. de_AT). The selection available is based
1069
+ on the [Unicode CLDR summary list](https://unicode-org.github.io/cldr-staging/charts/37/summary/root.html)
1070
+ and includes the major spoken languages of the world and any widely-used variants.
1071
+
1072
+ @docsCategory common */
1073
+ var LanguageCode;
1074
+ (function (LanguageCode) {
1075
+ LanguageCode["af"] = "af";
1076
+ LanguageCode["ak"] = "ak";
1077
+ LanguageCode["sq"] = "sq";
1078
+ LanguageCode["am"] = "am";
1079
+ LanguageCode["ar"] = "ar";
1080
+ LanguageCode["hy"] = "hy";
1081
+ LanguageCode["as"] = "as";
1082
+ LanguageCode["az"] = "az";
1083
+ LanguageCode["bm"] = "bm";
1084
+ LanguageCode["bn"] = "bn";
1085
+ LanguageCode["eu"] = "eu";
1086
+ LanguageCode["be"] = "be";
1087
+ LanguageCode["bs"] = "bs";
1088
+ LanguageCode["br"] = "br";
1089
+ LanguageCode["bg"] = "bg";
1090
+ LanguageCode["my"] = "my";
1091
+ LanguageCode["ca"] = "ca";
1092
+ LanguageCode["ce"] = "ce";
1093
+ LanguageCode["zh"] = "zh";
1094
+ LanguageCode["zh_Hans"] = "zh_Hans";
1095
+ LanguageCode["zh_Hant"] = "zh_Hant";
1096
+ LanguageCode["cu"] = "cu";
1097
+ LanguageCode["kw"] = "kw";
1098
+ LanguageCode["co"] = "co";
1099
+ LanguageCode["hr"] = "hr";
1100
+ LanguageCode["cs"] = "cs";
1101
+ LanguageCode["da"] = "da";
1102
+ LanguageCode["nl"] = "nl";
1103
+ LanguageCode["nl_BE"] = "nl_BE";
1104
+ LanguageCode["dz"] = "dz";
1105
+ LanguageCode["en"] = "en";
1106
+ LanguageCode["en_AU"] = "en_AU";
1107
+ LanguageCode["en_CA"] = "en_CA";
1108
+ LanguageCode["en_GB"] = "en_GB";
1109
+ LanguageCode["en_US"] = "en_US";
1110
+ LanguageCode["eo"] = "eo";
1111
+ LanguageCode["et"] = "et";
1112
+ LanguageCode["ee"] = "ee";
1113
+ LanguageCode["fo"] = "fo";
1114
+ LanguageCode["fi"] = "fi";
1115
+ LanguageCode["fr"] = "fr";
1116
+ LanguageCode["fr_CA"] = "fr_CA";
1117
+ LanguageCode["fr_CH"] = "fr_CH";
1118
+ LanguageCode["ff"] = "ff";
1119
+ LanguageCode["gl"] = "gl";
1120
+ LanguageCode["lg"] = "lg";
1121
+ LanguageCode["ka"] = "ka";
1122
+ LanguageCode["de"] = "de";
1123
+ LanguageCode["de_AT"] = "de_AT";
1124
+ LanguageCode["de_CH"] = "de_CH";
1125
+ LanguageCode["el"] = "el";
1126
+ LanguageCode["gu"] = "gu";
1127
+ LanguageCode["ht"] = "ht";
1128
+ LanguageCode["ha"] = "ha";
1129
+ LanguageCode["he"] = "he";
1130
+ LanguageCode["hi"] = "hi";
1131
+ LanguageCode["hu"] = "hu";
1132
+ LanguageCode["is"] = "is";
1133
+ LanguageCode["ig"] = "ig";
1134
+ LanguageCode["id"] = "id";
1135
+ LanguageCode["ia"] = "ia";
1136
+ LanguageCode["ga"] = "ga";
1137
+ LanguageCode["it"] = "it";
1138
+ LanguageCode["ja"] = "ja";
1139
+ LanguageCode["jv"] = "jv";
1140
+ LanguageCode["kl"] = "kl";
1141
+ LanguageCode["kn"] = "kn";
1142
+ LanguageCode["ks"] = "ks";
1143
+ LanguageCode["kk"] = "kk";
1144
+ LanguageCode["km"] = "km";
1145
+ LanguageCode["ki"] = "ki";
1146
+ LanguageCode["rw"] = "rw";
1147
+ LanguageCode["ko"] = "ko";
1148
+ LanguageCode["ku"] = "ku";
1149
+ LanguageCode["ky"] = "ky";
1150
+ LanguageCode["lo"] = "lo";
1151
+ LanguageCode["la"] = "la";
1152
+ LanguageCode["lv"] = "lv";
1153
+ LanguageCode["ln"] = "ln";
1154
+ LanguageCode["lt"] = "lt";
1155
+ LanguageCode["lu"] = "lu";
1156
+ LanguageCode["lb"] = "lb";
1157
+ LanguageCode["mk"] = "mk";
1158
+ LanguageCode["mg"] = "mg";
1159
+ LanguageCode["ms"] = "ms";
1160
+ LanguageCode["ml"] = "ml";
1161
+ LanguageCode["mt"] = "mt";
1162
+ LanguageCode["gv"] = "gv";
1163
+ LanguageCode["mi"] = "mi";
1164
+ LanguageCode["mr"] = "mr";
1165
+ LanguageCode["mn"] = "mn";
1166
+ LanguageCode["ne"] = "ne";
1167
+ LanguageCode["nd"] = "nd";
1168
+ LanguageCode["se"] = "se";
1169
+ LanguageCode["nb"] = "nb";
1170
+ LanguageCode["nn"] = "nn";
1171
+ LanguageCode["ny"] = "ny";
1172
+ LanguageCode["or"] = "or";
1173
+ LanguageCode["om"] = "om";
1174
+ LanguageCode["os"] = "os";
1175
+ LanguageCode["ps"] = "ps";
1176
+ LanguageCode["fa"] = "fa";
1177
+ LanguageCode["fa_AF"] = "fa_AF";
1178
+ LanguageCode["pl"] = "pl";
1179
+ LanguageCode["pt"] = "pt";
1180
+ LanguageCode["pt_BR"] = "pt_BR";
1181
+ LanguageCode["pt_PT"] = "pt_PT";
1182
+ LanguageCode["pa"] = "pa";
1183
+ LanguageCode["qu"] = "qu";
1184
+ LanguageCode["ro"] = "ro";
1185
+ LanguageCode["ro_MD"] = "ro_MD";
1186
+ LanguageCode["rm"] = "rm";
1187
+ LanguageCode["rn"] = "rn";
1188
+ LanguageCode["ru"] = "ru";
1189
+ LanguageCode["sm"] = "sm";
1190
+ LanguageCode["sg"] = "sg";
1191
+ LanguageCode["sa"] = "sa";
1192
+ LanguageCode["gd"] = "gd";
1193
+ LanguageCode["sr"] = "sr";
1194
+ LanguageCode["sn"] = "sn";
1195
+ LanguageCode["ii"] = "ii";
1196
+ LanguageCode["sd"] = "sd";
1197
+ LanguageCode["si"] = "si";
1198
+ LanguageCode["sk"] = "sk";
1199
+ LanguageCode["sl"] = "sl";
1200
+ LanguageCode["so"] = "so";
1201
+ LanguageCode["st"] = "st";
1202
+ LanguageCode["es"] = "es";
1203
+ LanguageCode["es_ES"] = "es_ES";
1204
+ LanguageCode["es_MX"] = "es_MX";
1205
+ LanguageCode["su"] = "su";
1206
+ LanguageCode["sw"] = "sw";
1207
+ LanguageCode["sw_CD"] = "sw_CD";
1208
+ LanguageCode["sv"] = "sv";
1209
+ LanguageCode["tg"] = "tg";
1210
+ LanguageCode["ta"] = "ta";
1211
+ LanguageCode["tt"] = "tt";
1212
+ LanguageCode["te"] = "te";
1213
+ LanguageCode["th"] = "th";
1214
+ LanguageCode["bo"] = "bo";
1215
+ LanguageCode["ti"] = "ti";
1216
+ LanguageCode["to"] = "to";
1217
+ LanguageCode["tr"] = "tr";
1218
+ LanguageCode["tk"] = "tk";
1219
+ LanguageCode["uk"] = "uk";
1220
+ LanguageCode["ur"] = "ur";
1221
+ LanguageCode["ug"] = "ug";
1222
+ LanguageCode["uz"] = "uz";
1223
+ LanguageCode["vi"] = "vi";
1224
+ LanguageCode["vo"] = "vo";
1225
+ LanguageCode["cy"] = "cy";
1226
+ LanguageCode["fy"] = "fy";
1227
+ LanguageCode["wo"] = "wo";
1228
+ LanguageCode["xh"] = "xh";
1229
+ LanguageCode["yi"] = "yi";
1230
+ LanguageCode["yo"] = "yo";
1231
+ LanguageCode["zu"] = "zu";
1232
+ })(LanguageCode || (exports.LanguageCode = LanguageCode = {}));
1233
+ var OrderType;
1234
+ (function (OrderType) {
1235
+ OrderType["Regular"] = "Regular";
1236
+ OrderType["Seller"] = "Seller";
1237
+ OrderType["Aggregate"] = "Aggregate";
1238
+ })(OrderType || (exports.OrderType = OrderType = {}));
1239
+ var MetricRangeType;
1240
+ (function (MetricRangeType) {
1241
+ MetricRangeType["Today"] = "Today";
1242
+ MetricRangeType["Yesterday"] = "Yesterday";
1243
+ MetricRangeType["ThisWeek"] = "ThisWeek";
1244
+ MetricRangeType["LastWeek"] = "LastWeek";
1245
+ MetricRangeType["ThisMonth"] = "ThisMonth";
1246
+ MetricRangeType["LastMonth"] = "LastMonth";
1247
+ MetricRangeType["ThisYear"] = "ThisYear";
1248
+ MetricRangeType["LastYear"] = "LastYear";
1249
+ MetricRangeType["FirstQuarter"] = "FirstQuarter";
1250
+ MetricRangeType["SecondQuarter"] = "SecondQuarter";
1251
+ MetricRangeType["ThirdQuarter"] = "ThirdQuarter";
1252
+ MetricRangeType["FourthQuarter"] = "FourthQuarter";
1253
+ MetricRangeType["Custom"] = "Custom";
1254
+ })(MetricRangeType || (exports.MetricRangeType = MetricRangeType = {}));
1255
+ var MetricIntervalType;
1256
+ (function (MetricIntervalType) {
1257
+ MetricIntervalType["Day"] = "Day";
1258
+ MetricIntervalType["Hour"] = "Hour";
1259
+ })(MetricIntervalType || (exports.MetricIntervalType = MetricIntervalType = {}));
1260
+ var ChartMetricType;
1261
+ (function (ChartMetricType) {
1262
+ ChartMetricType["OrderCount"] = "OrderCount";
1263
+ ChartMetricType["OrderTotal"] = "OrderTotal";
1264
+ ChartMetricType["AverageOrderValue"] = "AverageOrderValue";
1265
+ ChartMetricType["OrderTotalProductsCount"] = "OrderTotalProductsCount";
1266
+ })(ChartMetricType || (exports.ChartMetricType = ChartMetricType = {}));
1267
+ var MetricInterval;
1268
+ (function (MetricInterval) {
1269
+ MetricInterval["Daily"] = "Daily";
1270
+ })(MetricInterval || (exports.MetricInterval = MetricInterval = {}));
1271
+ var MetricType;
1272
+ (function (MetricType) {
1273
+ MetricType["OrderCount"] = "OrderCount";
1274
+ MetricType["OrderTotal"] = "OrderTotal";
1275
+ MetricType["AverageOrderValue"] = "AverageOrderValue";
1276
+ })(MetricType || (exports.MetricType = MetricType = {}));