@deenruv/order-line-attributes-plugin 1.0.17-dev.20 → 1.0.17-dev.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin-server/zeus/const.js +760 -742
- package/dist/plugin-server/zeus/index.d.ts +5606 -4290
- package/dist/plugin-server/zeus/index.js +129 -96
- package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -1
- package/dist/plugin-server/zeus/typedDocumentNode.js +14 -29
- package/dist/plugin-ui/graphql/queries.d.ts +3 -1
- package/dist/plugin-ui/graphql/selectors.d.ts +6 -5
- package/dist/plugin-ui/zeus/const.js +760 -742
- package/dist/plugin-ui/zeus/index.d.ts +5606 -4290
- package/dist/plugin-ui/zeus/index.js +129 -96
- package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +2 -2
- package/dist/plugin-ui/zeus/typedDocumentNode.js +2 -2
- package/package.json +6 -6
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
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.Subscription = exports.SubscriptionThunder = exports.Chain = exports.Thunder = exports.InternalsBuildQuery = exports.apiFetch = exports.apiSubscription = exports.HEADERS = exports.HOST = void 0;
|
|
5
5
|
const const_1 = require("./const");
|
|
6
6
|
exports.HOST = "http://localhost:6100/admin-api";
|
|
7
7
|
exports.HEADERS = {};
|
|
8
8
|
const apiSubscription = (options) => (query) => {
|
|
9
9
|
var _a, _b, _c;
|
|
10
10
|
try {
|
|
11
|
-
const queryString = options[0] +
|
|
12
|
-
const wsString = queryString.replace(
|
|
11
|
+
const queryString = options[0] + "?query=" + encodeURIComponent(query);
|
|
12
|
+
const wsString = queryString.replace("http", "ws");
|
|
13
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
14
|
const webSocketOptions = ((_c = options[1]) === null || _c === void 0 ? void 0 : _c.websocket) || [host];
|
|
15
15
|
const ws = new WebSocket(...webSocketOptions);
|
|
@@ -36,7 +36,7 @@ const apiSubscription = (options) => (query) => {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
catch (_d) {
|
|
39
|
-
throw new Error(
|
|
39
|
+
throw new Error("No websockets implemented");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
exports.apiSubscription = apiSubscription;
|
|
@@ -60,7 +60,7 @@ const handleFetchResponse = (response) => {
|
|
|
60
60
|
};
|
|
61
61
|
const apiFetch = (options) => (query, variables = {}) => {
|
|
62
62
|
const fetchOptions = options[1] || {};
|
|
63
|
-
if (fetchOptions.method && fetchOptions.method ===
|
|
63
|
+
if (fetchOptions.method && fetchOptions.method === "GET") {
|
|
64
64
|
return fetch(`${options[0]}?query=${encodeURIComponent(query)}`, fetchOptions)
|
|
65
65
|
.then(handleFetchResponse)
|
|
66
66
|
.then((response) => {
|
|
@@ -70,8 +70,8 @@ const apiFetch = (options) => (query, variables = {}) => {
|
|
|
70
70
|
return response.data;
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
return fetch(`${options[0]}`, Object.assign({ body: JSON.stringify({ query, variables }), method:
|
|
74
|
-
|
|
73
|
+
return fetch(`${options[0]}`, Object.assign({ body: JSON.stringify({ query, variables }), method: "POST", headers: {
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
75
|
} }, fetchOptions))
|
|
76
76
|
.then(handleFetchResponse)
|
|
77
77
|
.then((response) => {
|
|
@@ -83,17 +83,17 @@ const apiFetch = (options) => (query, variables = {}) => {
|
|
|
83
83
|
};
|
|
84
84
|
exports.apiFetch = apiFetch;
|
|
85
85
|
const InternalsBuildQuery = ({ ops, props, returns, options, scalars, }) => {
|
|
86
|
-
const ibb = (k, o, p =
|
|
86
|
+
const ibb = (k, o, p = "", root = true, vars = []) => {
|
|
87
87
|
var _a;
|
|
88
88
|
const keyForPath = (0, exports.purifyGraphQLKey)(k);
|
|
89
89
|
const newPath = [p, keyForPath].join(exports.SEPARATOR);
|
|
90
90
|
if (!o) {
|
|
91
|
-
return
|
|
91
|
+
return "";
|
|
92
92
|
}
|
|
93
|
-
if (typeof o ===
|
|
93
|
+
if (typeof o === "boolean" || typeof o === "number") {
|
|
94
94
|
return k;
|
|
95
95
|
}
|
|
96
|
-
if (typeof o ===
|
|
96
|
+
if (typeof o === "string") {
|
|
97
97
|
return `${k} ${o}`;
|
|
98
98
|
}
|
|
99
99
|
if (Array.isArray(o)) {
|
|
@@ -106,29 +106,32 @@ const InternalsBuildQuery = ({ ops, props, returns, options, scalars, }) => {
|
|
|
106
106
|
})(o[0], newPath);
|
|
107
107
|
return `${ibb(args ? `${k}(${args})` : k, o[1], p, false, vars)}`;
|
|
108
108
|
}
|
|
109
|
-
if (k ===
|
|
109
|
+
if (k === "__alias") {
|
|
110
110
|
return Object.entries(o)
|
|
111
111
|
.map(([alias, objectUnderAlias]) => {
|
|
112
|
-
if (typeof objectUnderAlias !==
|
|
113
|
-
|
|
112
|
+
if (typeof objectUnderAlias !== "object" ||
|
|
113
|
+
Array.isArray(objectUnderAlias)) {
|
|
114
|
+
throw new Error("Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}");
|
|
114
115
|
}
|
|
115
116
|
const operationName = Object.keys(objectUnderAlias)[0];
|
|
116
117
|
const operation = objectUnderAlias[operationName];
|
|
117
118
|
return ibb(`${alias}:${operationName}`, operation, p, false, vars);
|
|
118
119
|
})
|
|
119
|
-
.join(
|
|
120
|
+
.join("\n");
|
|
120
121
|
}
|
|
121
|
-
const hasOperationName = root && (options === null || options === void 0 ? void 0 : options.operationName) ?
|
|
122
|
-
const keyForDirectives = (_a = o.__directives) !== null && _a !== void 0 ? _a :
|
|
122
|
+
const hasOperationName = root && (options === null || options === void 0 ? void 0 : options.operationName) ? " " + options.operationName : "";
|
|
123
|
+
const keyForDirectives = (_a = o.__directives) !== null && _a !== void 0 ? _a : "";
|
|
123
124
|
const query = `{${Object.entries(o)
|
|
124
|
-
.filter(([k]) => k !==
|
|
125
|
+
.filter(([k]) => k !== "__directives")
|
|
125
126
|
.map((e) => ibb(...e, [p, `field<>${keyForPath}`].join(exports.SEPARATOR), false, vars))
|
|
126
|
-
.join(
|
|
127
|
+
.join("\n")}}`;
|
|
127
128
|
if (!root) {
|
|
128
129
|
return `${k} ${keyForDirectives}${hasOperationName} ${query}`;
|
|
129
130
|
}
|
|
130
|
-
const varsString = vars
|
|
131
|
-
|
|
131
|
+
const varsString = vars
|
|
132
|
+
.map((v) => `${v.name}: ${v.graphQLType}`)
|
|
133
|
+
.join(", ");
|
|
134
|
+
return `${k} ${keyForDirectives}${hasOperationName}${varsString ? `(${varsString})` : ""} ${query}`;
|
|
132
135
|
};
|
|
133
136
|
return ibb;
|
|
134
137
|
};
|
|
@@ -197,17 +200,31 @@ exports.Selector = Selector;
|
|
|
197
200
|
const TypeFromSelector = (key) => key && (0, exports.ZeusSelect)();
|
|
198
201
|
exports.TypeFromSelector = TypeFromSelector;
|
|
199
202
|
exports.Gql = (0, exports.Chain)(exports.HOST, {
|
|
200
|
-
headers: Object.assign({
|
|
203
|
+
headers: Object.assign({ "Content-Type": "application/json" }, exports.HEADERS),
|
|
201
204
|
});
|
|
202
205
|
exports.ZeusScalars = (0, exports.ZeusSelect)();
|
|
203
206
|
const fields = (k) => {
|
|
204
207
|
const t = const_1.ReturnTypes[k];
|
|
208
|
+
const fnType = k in const_1.AllTypesProps
|
|
209
|
+
? const_1.AllTypesProps[k]
|
|
210
|
+
: undefined;
|
|
211
|
+
const hasFnTypes = typeof fnType === "object" ? fnType : undefined;
|
|
205
212
|
const o = Object.fromEntries(Object.entries(t)
|
|
206
|
-
.filter(([, value]) => {
|
|
213
|
+
.filter(([k, value]) => {
|
|
214
|
+
const isFunctionType = hasFnTypes &&
|
|
215
|
+
k in hasFnTypes &&
|
|
216
|
+
!!hasFnTypes[k];
|
|
217
|
+
if (isFunctionType)
|
|
218
|
+
return false;
|
|
207
219
|
const isReturnType = const_1.ReturnTypes[value];
|
|
208
|
-
if (!isReturnType
|
|
220
|
+
if (!isReturnType)
|
|
221
|
+
return true;
|
|
222
|
+
if (typeof isReturnType !== "string")
|
|
223
|
+
return false;
|
|
224
|
+
if (isReturnType.startsWith("scalar.")) {
|
|
209
225
|
return true;
|
|
210
226
|
}
|
|
227
|
+
return false;
|
|
211
228
|
})
|
|
212
229
|
.map(([key]) => [key, true]));
|
|
213
230
|
return o;
|
|
@@ -241,12 +258,15 @@ const traverseResponse = ({ resolvers, scalarPaths, }) => {
|
|
|
241
258
|
const scalarPathString = p.join(exports.SEPARATOR);
|
|
242
259
|
const currentScalarString = scalarPaths[scalarPathString];
|
|
243
260
|
if (currentScalarString) {
|
|
244
|
-
const currentDecoder = (_a = resolvers[currentScalarString.split(
|
|
261
|
+
const currentDecoder = (_a = resolvers[currentScalarString.split(".")[1]]) === null || _a === void 0 ? void 0 : _a.decode;
|
|
245
262
|
if (currentDecoder) {
|
|
246
263
|
return currentDecoder(o);
|
|
247
264
|
}
|
|
248
265
|
}
|
|
249
|
-
if (typeof o ===
|
|
266
|
+
if (typeof o === "boolean" ||
|
|
267
|
+
typeof o === "number" ||
|
|
268
|
+
typeof o === "string" ||
|
|
269
|
+
!o) {
|
|
250
270
|
return o;
|
|
251
271
|
}
|
|
252
272
|
const entries = Object.entries(o).map(([k, v]) => [k, ibb(k, v, [...p, (0, exports.purifyGraphQLKey)(k)])]);
|
|
@@ -259,15 +279,15 @@ const traverseResponse = ({ resolvers, scalarPaths, }) => {
|
|
|
259
279
|
return ibb;
|
|
260
280
|
};
|
|
261
281
|
exports.traverseResponse = traverseResponse;
|
|
262
|
-
exports.SEPARATOR =
|
|
282
|
+
exports.SEPARATOR = "|";
|
|
263
283
|
class GraphQLError extends Error {
|
|
264
284
|
constructor(response) {
|
|
265
|
-
super(
|
|
285
|
+
super("");
|
|
266
286
|
this.response = response;
|
|
267
287
|
console.error(response);
|
|
268
288
|
}
|
|
269
289
|
toString() {
|
|
270
|
-
return
|
|
290
|
+
return "GraphQL Response Error";
|
|
271
291
|
}
|
|
272
292
|
}
|
|
273
293
|
exports.GraphQLError = GraphQLError;
|
|
@@ -277,7 +297,7 @@ const ExtractScalar = (mappedParts, returns) => {
|
|
|
277
297
|
}
|
|
278
298
|
const oKey = mappedParts[0];
|
|
279
299
|
const returnP1 = returns[oKey];
|
|
280
|
-
if (typeof returnP1 ===
|
|
300
|
+
if (typeof returnP1 === "object") {
|
|
281
301
|
const returnP2 = returnP1[mappedParts[1]];
|
|
282
302
|
if (returnP2) {
|
|
283
303
|
return ExtractScalar([returnP2, ...mappedParts.slice(2)], returns);
|
|
@@ -286,15 +306,17 @@ const ExtractScalar = (mappedParts, returns) => {
|
|
|
286
306
|
}
|
|
287
307
|
return returnP1;
|
|
288
308
|
};
|
|
289
|
-
const PrepareScalarPaths = ({ ops, returns }) => {
|
|
309
|
+
const PrepareScalarPaths = ({ ops, returns, }) => {
|
|
290
310
|
const ibb = (k, originalKey, o, p = [], pOriginals = [], root = true) => {
|
|
291
311
|
if (!o) {
|
|
292
312
|
return;
|
|
293
313
|
}
|
|
294
|
-
if (typeof o ===
|
|
314
|
+
if (typeof o === "boolean" ||
|
|
315
|
+
typeof o === "number" ||
|
|
316
|
+
typeof o === "string") {
|
|
295
317
|
const extractionArray = [...pOriginals, originalKey];
|
|
296
318
|
const isScalar = ExtractScalar(extractionArray, returns);
|
|
297
|
-
if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith(
|
|
319
|
+
if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith("scalar")) {
|
|
298
320
|
const partOfTree = {
|
|
299
321
|
[[...p, k].join(exports.SEPARATOR)]: isScalar,
|
|
300
322
|
};
|
|
@@ -305,11 +327,12 @@ const PrepareScalarPaths = ({ ops, returns }) => {
|
|
|
305
327
|
if (Array.isArray(o)) {
|
|
306
328
|
return ibb(k, k, o[1], p, pOriginals, false);
|
|
307
329
|
}
|
|
308
|
-
if (k ===
|
|
330
|
+
if (k === "__alias") {
|
|
309
331
|
return Object.entries(o)
|
|
310
332
|
.map(([alias, objectUnderAlias]) => {
|
|
311
|
-
if (typeof objectUnderAlias !==
|
|
312
|
-
|
|
333
|
+
if (typeof objectUnderAlias !== "object" ||
|
|
334
|
+
Array.isArray(objectUnderAlias)) {
|
|
335
|
+
throw new Error("Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}");
|
|
313
336
|
}
|
|
314
337
|
const operationName = Object.keys(objectUnderAlias)[0];
|
|
315
338
|
const operation = objectUnderAlias[operationName];
|
|
@@ -319,59 +342,63 @@ const PrepareScalarPaths = ({ ops, returns }) => {
|
|
|
319
342
|
}
|
|
320
343
|
const keyName = root ? ops[k] : k;
|
|
321
344
|
return Object.entries(o)
|
|
322
|
-
.filter(([k]) => k !==
|
|
345
|
+
.filter(([k]) => k !== "__directives")
|
|
323
346
|
.map(([k, v]) => {
|
|
324
347
|
// Inline fragments shouldn't be added to the path as they aren't a field
|
|
325
348
|
const isInlineFragment = originalKey.match(/^...\s*on/) != null;
|
|
326
|
-
return ibb(k, k, v, isInlineFragment ? p : [...p, (0, exports.purifyGraphQLKey)(keyName || k)], isInlineFragment
|
|
349
|
+
return ibb(k, k, v, isInlineFragment ? p : [...p, (0, exports.purifyGraphQLKey)(keyName || k)], isInlineFragment
|
|
350
|
+
? pOriginals
|
|
351
|
+
: [...pOriginals, (0, exports.purifyGraphQLKey)(originalKey)], false);
|
|
327
352
|
})
|
|
328
353
|
.reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
|
|
329
354
|
};
|
|
330
355
|
return ibb;
|
|
331
356
|
};
|
|
332
357
|
exports.PrepareScalarPaths = PrepareScalarPaths;
|
|
333
|
-
const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g,
|
|
358
|
+
const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g, "").replace(/^[^:]*\:/g, "");
|
|
334
359
|
exports.purifyGraphQLKey = purifyGraphQLKey;
|
|
335
360
|
const mapPart = (p) => {
|
|
336
|
-
const [isArg, isField] = p.split(
|
|
361
|
+
const [isArg, isField] = p.split("<>");
|
|
337
362
|
if (isField) {
|
|
338
363
|
return {
|
|
339
364
|
v: isField,
|
|
340
|
-
__type:
|
|
365
|
+
__type: "field",
|
|
341
366
|
};
|
|
342
367
|
}
|
|
343
368
|
return {
|
|
344
369
|
v: isArg,
|
|
345
|
-
__type:
|
|
370
|
+
__type: "arg",
|
|
346
371
|
};
|
|
347
372
|
};
|
|
348
373
|
const ResolveFromPath = (props, returns, ops) => {
|
|
349
374
|
const ResolvePropsType = (mappedParts) => {
|
|
350
375
|
const oKey = ops[mappedParts[0].v];
|
|
351
376
|
const propsP1 = oKey ? props[oKey] : props[mappedParts[0].v];
|
|
352
|
-
if (propsP1 ===
|
|
353
|
-
return
|
|
377
|
+
if (propsP1 === "enum" && mappedParts.length === 1) {
|
|
378
|
+
return "enum";
|
|
354
379
|
}
|
|
355
|
-
if (typeof propsP1 ===
|
|
380
|
+
if (typeof propsP1 === "string" &&
|
|
381
|
+
propsP1.startsWith("scalar.") &&
|
|
382
|
+
mappedParts.length === 1) {
|
|
356
383
|
return propsP1;
|
|
357
384
|
}
|
|
358
|
-
if (typeof propsP1 ===
|
|
385
|
+
if (typeof propsP1 === "object") {
|
|
359
386
|
if (mappedParts.length < 2) {
|
|
360
|
-
return
|
|
387
|
+
return "not";
|
|
361
388
|
}
|
|
362
389
|
const propsP2 = propsP1[mappedParts[1].v];
|
|
363
|
-
if (typeof propsP2 ===
|
|
390
|
+
if (typeof propsP2 === "string") {
|
|
364
391
|
return rpp(`${propsP2}${exports.SEPARATOR}${mappedParts
|
|
365
392
|
.slice(2)
|
|
366
393
|
.map((mp) => mp.v)
|
|
367
394
|
.join(exports.SEPARATOR)}`);
|
|
368
395
|
}
|
|
369
|
-
if (typeof propsP2 ===
|
|
396
|
+
if (typeof propsP2 === "object") {
|
|
370
397
|
if (mappedParts.length < 3) {
|
|
371
|
-
return
|
|
398
|
+
return "not";
|
|
372
399
|
}
|
|
373
400
|
const propsP3 = propsP2[mappedParts[2].v];
|
|
374
|
-
if (propsP3 && mappedParts[2].__type ===
|
|
401
|
+
if (propsP3 && mappedParts[2].__type === "arg") {
|
|
375
402
|
return rpp(`${propsP3}${exports.SEPARATOR}${mappedParts
|
|
376
403
|
.slice(3)
|
|
377
404
|
.map((mp) => mp.v)
|
|
@@ -382,13 +409,13 @@ const ResolveFromPath = (props, returns, ops) => {
|
|
|
382
409
|
};
|
|
383
410
|
const ResolveReturnType = (mappedParts) => {
|
|
384
411
|
if (mappedParts.length === 0) {
|
|
385
|
-
return
|
|
412
|
+
return "not";
|
|
386
413
|
}
|
|
387
414
|
const oKey = ops[mappedParts[0].v];
|
|
388
415
|
const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
|
|
389
|
-
if (typeof returnP1 ===
|
|
416
|
+
if (typeof returnP1 === "object") {
|
|
390
417
|
if (mappedParts.length < 2)
|
|
391
|
-
return
|
|
418
|
+
return "not";
|
|
392
419
|
const returnP2 = returnP1[mappedParts[1].v];
|
|
393
420
|
if (returnP2) {
|
|
394
421
|
return rpp(`${returnP2}${exports.SEPARATOR}${mappedParts
|
|
@@ -409,17 +436,19 @@ const ResolveFromPath = (props, returns, ops) => {
|
|
|
409
436
|
if (returnP1) {
|
|
410
437
|
return returnP1;
|
|
411
438
|
}
|
|
412
|
-
return
|
|
439
|
+
return "not";
|
|
413
440
|
};
|
|
414
441
|
return rpp;
|
|
415
442
|
};
|
|
416
443
|
exports.ResolveFromPath = ResolveFromPath;
|
|
417
444
|
const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
|
|
418
|
-
const arb = (a, p =
|
|
445
|
+
const arb = (a, p = "", root = true) => {
|
|
419
446
|
var _a, _b;
|
|
420
|
-
if (typeof a ===
|
|
447
|
+
if (typeof a === "string") {
|
|
421
448
|
if (a.startsWith(exports.START_VAR_NAME)) {
|
|
422
|
-
const [varName, graphQLType] = a
|
|
449
|
+
const [varName, graphQLType] = a
|
|
450
|
+
.replace(exports.START_VAR_NAME, "$")
|
|
451
|
+
.split(exports.GRAPHQL_TYPE_SEPARATOR);
|
|
423
452
|
const v = vars.find((v) => v.name === varName);
|
|
424
453
|
if (!v) {
|
|
425
454
|
vars.push({
|
|
@@ -436,29 +465,29 @@ const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
|
|
|
436
465
|
}
|
|
437
466
|
}
|
|
438
467
|
const checkType = (0, exports.ResolveFromPath)(props, returns, ops)(p);
|
|
439
|
-
if (checkType.startsWith(
|
|
468
|
+
if (checkType.startsWith("scalar.")) {
|
|
440
469
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
441
|
-
const [_, ...splittedScalar] = checkType.split(
|
|
442
|
-
const scalarKey = splittedScalar.join(
|
|
470
|
+
const [_, ...splittedScalar] = checkType.split(".");
|
|
471
|
+
const scalarKey = splittedScalar.join(".");
|
|
443
472
|
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);
|
|
444
473
|
}
|
|
445
474
|
if (Array.isArray(a)) {
|
|
446
|
-
return `[${a.map((arr) => arb(arr, p, false)).join(
|
|
475
|
+
return `[${a.map((arr) => arb(arr, p, false)).join(", ")}]`;
|
|
447
476
|
}
|
|
448
|
-
if (typeof a ===
|
|
449
|
-
if (checkType ===
|
|
477
|
+
if (typeof a === "string") {
|
|
478
|
+
if (checkType === "enum") {
|
|
450
479
|
return a;
|
|
451
480
|
}
|
|
452
481
|
return `${JSON.stringify(a)}`;
|
|
453
482
|
}
|
|
454
|
-
if (typeof a ===
|
|
483
|
+
if (typeof a === "object") {
|
|
455
484
|
if (a === null) {
|
|
456
485
|
return `null`;
|
|
457
486
|
}
|
|
458
487
|
const returnedObjectString = Object.entries(a)
|
|
459
|
-
.filter(([, v]) => typeof v !==
|
|
488
|
+
.filter(([, v]) => typeof v !== "undefined")
|
|
460
489
|
.map(([k, v]) => `${k}: ${arb(v, [p, k].join(exports.SEPARATOR), false)}`)
|
|
461
|
-
.join(
|
|
490
|
+
.join(",\n");
|
|
462
491
|
if (!root) {
|
|
463
492
|
return `{${returnedObjectString}}`;
|
|
464
493
|
}
|
|
@@ -474,7 +503,10 @@ exports.resolverFor = resolverFor;
|
|
|
474
503
|
exports.START_VAR_NAME = `$ZEUS_VAR`;
|
|
475
504
|
exports.GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
|
|
476
505
|
const $ = (name, graphqlType) => {
|
|
477
|
-
return (exports.START_VAR_NAME +
|
|
506
|
+
return (exports.START_VAR_NAME +
|
|
507
|
+
name +
|
|
508
|
+
exports.GRAPHQL_TYPE_SEPARATOR +
|
|
509
|
+
graphqlType);
|
|
478
510
|
};
|
|
479
511
|
exports.$ = $;
|
|
480
512
|
/** @description
|
|
@@ -700,6 +732,7 @@ var ErrorCode;
|
|
|
700
732
|
ErrorCode["ORDER_MODIFICATION_ERROR"] = "ORDER_MODIFICATION_ERROR";
|
|
701
733
|
ErrorCode["INELIGIBLE_SHIPPING_METHOD_ERROR"] = "INELIGIBLE_SHIPPING_METHOD_ERROR";
|
|
702
734
|
ErrorCode["NO_ACTIVE_ORDER_ERROR"] = "NO_ACTIVE_ORDER_ERROR";
|
|
735
|
+
ErrorCode["ORDER_MIDDLEWARE_ERROR"] = "ORDER_MIDDLEWARE_ERROR";
|
|
703
736
|
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
704
737
|
var LogicalOperator;
|
|
705
738
|
(function (LogicalOperator) {
|
|
@@ -1071,31 +1104,31 @@ var OrderType;
|
|
|
1071
1104
|
OrderType["Seller"] = "Seller";
|
|
1072
1105
|
OrderType["Aggregate"] = "Aggregate";
|
|
1073
1106
|
})(OrderType || (exports.OrderType = OrderType = {}));
|
|
1074
|
-
var
|
|
1075
|
-
(function (
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
})(
|
|
1095
|
-
var
|
|
1096
|
-
(function (
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
})(
|
|
1107
|
+
var MetricRangeType;
|
|
1108
|
+
(function (MetricRangeType) {
|
|
1109
|
+
MetricRangeType["Today"] = "Today";
|
|
1110
|
+
MetricRangeType["Yesterday"] = "Yesterday";
|
|
1111
|
+
MetricRangeType["ThisWeek"] = "ThisWeek";
|
|
1112
|
+
MetricRangeType["LastWeek"] = "LastWeek";
|
|
1113
|
+
MetricRangeType["ThisMonth"] = "ThisMonth";
|
|
1114
|
+
MetricRangeType["LastMonth"] = "LastMonth";
|
|
1115
|
+
MetricRangeType["ThisYear"] = "ThisYear";
|
|
1116
|
+
MetricRangeType["LastYear"] = "LastYear";
|
|
1117
|
+
MetricRangeType["FirstQuarter"] = "FirstQuarter";
|
|
1118
|
+
MetricRangeType["SecondQuarter"] = "SecondQuarter";
|
|
1119
|
+
MetricRangeType["ThirdQuarter"] = "ThirdQuarter";
|
|
1120
|
+
MetricRangeType["FourthQuarter"] = "FourthQuarter";
|
|
1121
|
+
MetricRangeType["Custom"] = "Custom";
|
|
1122
|
+
})(MetricRangeType || (exports.MetricRangeType = MetricRangeType = {}));
|
|
1123
|
+
var MetricIntervalType;
|
|
1124
|
+
(function (MetricIntervalType) {
|
|
1125
|
+
MetricIntervalType["Day"] = "Day";
|
|
1126
|
+
MetricIntervalType["Hour"] = "Hour";
|
|
1127
|
+
})(MetricIntervalType || (exports.MetricIntervalType = MetricIntervalType = {}));
|
|
1128
|
+
var ChartMetricType;
|
|
1129
|
+
(function (ChartMetricType) {
|
|
1130
|
+
ChartMetricType["OrderCount"] = "OrderCount";
|
|
1131
|
+
ChartMetricType["OrderTotal"] = "OrderTotal";
|
|
1132
|
+
ChartMetricType["AverageOrderValue"] = "AverageOrderValue";
|
|
1133
|
+
ChartMetricType["OrderTotalProductsCount"] = "OrderTotalProductsCount";
|
|
1134
|
+
})(ChartMetricType || (exports.ChartMetricType = ChartMetricType = {}));
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import { ValueTypes, GenericOperation, OperationOptions, GraphQLTypes, InputType, ScalarDefinition, ThunderGraphQLOptions, ExtractVariables } from "./";
|
|
3
|
+
export declare const typedGql: <O extends "query" | "mutation", SCLR extends ScalarDefinition, R extends keyof ValueTypes = GenericOperation<O>>(operation: O, graphqlOptions?: ThunderGraphQLOptions<SCLR> | undefined) => <Z extends ValueTypes[R]>(o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : never; }, ops?: OperationOptions) => TypedDocumentNode<InputType<GraphQLTypes[R], Z, SCLR>, ExtractVariables<Z>>;
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// import {
|
|
6
|
-
// ValueTypes,
|
|
7
|
-
// GenericOperation,
|
|
8
|
-
// OperationOptions,
|
|
9
|
-
// GraphQLTypes,
|
|
10
|
-
// InputType,
|
|
11
|
-
// ScalarDefinition,
|
|
12
|
-
// ThunderGraphQLOptions,
|
|
13
|
-
// Zeus,
|
|
14
|
-
// ExtractVariables,
|
|
15
|
-
// } from './';
|
|
16
|
-
// import { Ops } from './const';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
17
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// });
|
|
30
|
-
// return gql(str) as TypedDocumentNode<InputType<GraphQLTypes[R], Z, SCLR>, ExtractVariables<Z>>;
|
|
31
|
-
// };
|
|
6
|
+
exports.typedGql = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const _1 = require("./");
|
|
9
|
+
const typedGql = (operation, graphqlOptions) => (o, ops) => {
|
|
10
|
+
const str = (0, _1.Zeus)(operation, o, {
|
|
11
|
+
operationOptions: ops,
|
|
12
|
+
scalars: graphqlOptions === null || graphqlOptions === void 0 ? void 0 : graphqlOptions.scalars,
|
|
13
|
+
});
|
|
14
|
+
return (0, graphql_tag_1.default)(str);
|
|
15
|
+
};
|
|
16
|
+
exports.typedGql = typedGql;
|
|
@@ -5,7 +5,9 @@ export declare const ProductFacetValuesQuery: import("@graphql-typed-document-no
|
|
|
5
5
|
id: string;
|
|
6
6
|
customFields?: {
|
|
7
7
|
hexColor?: string | null | undefined;
|
|
8
|
-
image
|
|
8
|
+
image?: {
|
|
9
|
+
preview: string;
|
|
10
|
+
} | undefined;
|
|
9
11
|
} | undefined;
|
|
10
12
|
name: string;
|
|
11
13
|
code: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { scalars } from "@deenruv/admin-types";
|
|
1
2
|
import { FromSelector } from "../zeus";
|
|
2
3
|
declare const FacetSelector: {
|
|
3
4
|
id: true;
|
|
@@ -14,7 +15,7 @@ declare const FacetValueSelector: {
|
|
|
14
15
|
customFields: {
|
|
15
16
|
hexColor: true;
|
|
16
17
|
image: {
|
|
17
|
-
preview:
|
|
18
|
+
preview: true;
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
21
|
facet: {
|
|
@@ -35,7 +36,7 @@ export declare const ProductFacetValueSelector: {
|
|
|
35
36
|
customFields: {
|
|
36
37
|
hexColor: true;
|
|
37
38
|
image: {
|
|
38
|
-
preview:
|
|
39
|
+
preview: true;
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
facet: {
|
|
@@ -48,7 +49,7 @@ export declare const ProductFacetValueSelector: {
|
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
|
-
export type ProductFacetValueType = FromSelector<typeof ProductFacetValueSelector, "Product">;
|
|
52
|
-
export type FacetValueType = FromSelector<typeof FacetValueSelector, "FacetValue">;
|
|
53
|
-
export type FacetType = FromSelector<typeof FacetSelector, "Facet">;
|
|
52
|
+
export type ProductFacetValueType = FromSelector<typeof ProductFacetValueSelector, "Product", typeof scalars>;
|
|
53
|
+
export type FacetValueType = FromSelector<typeof FacetValueSelector, "FacetValue", typeof scalars>;
|
|
54
|
+
export type FacetType = FromSelector<typeof FacetSelector, "Facet", typeof scalars>;
|
|
54
55
|
export {};
|