@deenruv/replicate-plugin 1.0.17-dev.18 → 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.
- package/dist/plugin-server/graphql/generated-admin-types.d.ts +411 -61
- package/dist/plugin-server/graphql/generated-admin-types.js +29 -11
- package/dist/plugin-server/zeus/const.js +802 -634
- package/dist/plugin-server/zeus/index.d.ts +5727 -3479
- package/dist/plugin-server/zeus/index.js +123 -82
- package/dist/plugin-server/zeus/typedDocumentNode.d.ts +2 -2
- package/dist/plugin-ui/graphql/queries.d.ts +2 -2
- package/dist/plugin-ui/graphql/selectors.d.ts +3 -2
- package/dist/plugin-ui/zeus/const.js +802 -634
- package/dist/plugin-ui/zeus/index.d.ts +5727 -3479
- package/dist/plugin-ui/zeus/index.js +123 -82
- 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.PredictionStatus = exports.PredictionType = exports.
|
|
4
|
+
exports.PredictionStatus = exports.PredictionType = 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_js_1 = require("./const.js");
|
|
6
|
-
exports.HOST = "
|
|
6
|
+
exports.HOST = "Specify host";
|
|
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,24 +200,28 @@ 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_js_1.ReturnTypes[k];
|
|
205
|
-
const fnType = k in const_js_1.AllTypesProps
|
|
206
|
-
|
|
208
|
+
const fnType = k in const_js_1.AllTypesProps
|
|
209
|
+
? const_js_1.AllTypesProps[k]
|
|
210
|
+
: undefined;
|
|
211
|
+
const hasFnTypes = typeof fnType === "object" ? fnType : undefined;
|
|
207
212
|
const o = Object.fromEntries(Object.entries(t)
|
|
208
213
|
.filter(([k, value]) => {
|
|
209
|
-
const isFunctionType = hasFnTypes &&
|
|
214
|
+
const isFunctionType = hasFnTypes &&
|
|
215
|
+
k in hasFnTypes &&
|
|
216
|
+
!!hasFnTypes[k];
|
|
210
217
|
if (isFunctionType)
|
|
211
218
|
return false;
|
|
212
219
|
const isReturnType = const_js_1.ReturnTypes[value];
|
|
213
220
|
if (!isReturnType)
|
|
214
221
|
return true;
|
|
215
|
-
if (typeof isReturnType !==
|
|
222
|
+
if (typeof isReturnType !== "string")
|
|
216
223
|
return false;
|
|
217
|
-
if (isReturnType.startsWith(
|
|
224
|
+
if (isReturnType.startsWith("scalar.")) {
|
|
218
225
|
return true;
|
|
219
226
|
}
|
|
220
227
|
return false;
|
|
@@ -251,12 +258,15 @@ const traverseResponse = ({ resolvers, scalarPaths, }) => {
|
|
|
251
258
|
const scalarPathString = p.join(exports.SEPARATOR);
|
|
252
259
|
const currentScalarString = scalarPaths[scalarPathString];
|
|
253
260
|
if (currentScalarString) {
|
|
254
|
-
const currentDecoder = (_a = resolvers[currentScalarString.split(
|
|
261
|
+
const currentDecoder = (_a = resolvers[currentScalarString.split(".")[1]]) === null || _a === void 0 ? void 0 : _a.decode;
|
|
255
262
|
if (currentDecoder) {
|
|
256
263
|
return currentDecoder(o);
|
|
257
264
|
}
|
|
258
265
|
}
|
|
259
|
-
if (typeof o ===
|
|
266
|
+
if (typeof o === "boolean" ||
|
|
267
|
+
typeof o === "number" ||
|
|
268
|
+
typeof o === "string" ||
|
|
269
|
+
!o) {
|
|
260
270
|
return o;
|
|
261
271
|
}
|
|
262
272
|
const entries = Object.entries(o).map(([k, v]) => [k, ibb(k, v, [...p, (0, exports.purifyGraphQLKey)(k)])]);
|
|
@@ -269,15 +279,15 @@ const traverseResponse = ({ resolvers, scalarPaths, }) => {
|
|
|
269
279
|
return ibb;
|
|
270
280
|
};
|
|
271
281
|
exports.traverseResponse = traverseResponse;
|
|
272
|
-
exports.SEPARATOR =
|
|
282
|
+
exports.SEPARATOR = "|";
|
|
273
283
|
class GraphQLError extends Error {
|
|
274
284
|
constructor(response) {
|
|
275
|
-
super(
|
|
285
|
+
super("");
|
|
276
286
|
this.response = response;
|
|
277
287
|
console.error(response);
|
|
278
288
|
}
|
|
279
289
|
toString() {
|
|
280
|
-
return
|
|
290
|
+
return "GraphQL Response Error";
|
|
281
291
|
}
|
|
282
292
|
}
|
|
283
293
|
exports.GraphQLError = GraphQLError;
|
|
@@ -287,7 +297,7 @@ const ExtractScalar = (mappedParts, returns) => {
|
|
|
287
297
|
}
|
|
288
298
|
const oKey = mappedParts[0];
|
|
289
299
|
const returnP1 = returns[oKey];
|
|
290
|
-
if (typeof returnP1 ===
|
|
300
|
+
if (typeof returnP1 === "object") {
|
|
291
301
|
const returnP2 = returnP1[mappedParts[1]];
|
|
292
302
|
if (returnP2) {
|
|
293
303
|
return ExtractScalar([returnP2, ...mappedParts.slice(2)], returns);
|
|
@@ -296,15 +306,17 @@ const ExtractScalar = (mappedParts, returns) => {
|
|
|
296
306
|
}
|
|
297
307
|
return returnP1;
|
|
298
308
|
};
|
|
299
|
-
const PrepareScalarPaths = ({ ops, returns }) => {
|
|
309
|
+
const PrepareScalarPaths = ({ ops, returns, }) => {
|
|
300
310
|
const ibb = (k, originalKey, o, p = [], pOriginals = [], root = true) => {
|
|
301
311
|
if (!o) {
|
|
302
312
|
return;
|
|
303
313
|
}
|
|
304
|
-
if (typeof o ===
|
|
314
|
+
if (typeof o === "boolean" ||
|
|
315
|
+
typeof o === "number" ||
|
|
316
|
+
typeof o === "string") {
|
|
305
317
|
const extractionArray = [...pOriginals, originalKey];
|
|
306
318
|
const isScalar = ExtractScalar(extractionArray, returns);
|
|
307
|
-
if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith(
|
|
319
|
+
if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith("scalar")) {
|
|
308
320
|
const partOfTree = {
|
|
309
321
|
[[...p, k].join(exports.SEPARATOR)]: isScalar,
|
|
310
322
|
};
|
|
@@ -315,11 +327,12 @@ const PrepareScalarPaths = ({ ops, returns }) => {
|
|
|
315
327
|
if (Array.isArray(o)) {
|
|
316
328
|
return ibb(k, k, o[1], p, pOriginals, false);
|
|
317
329
|
}
|
|
318
|
-
if (k ===
|
|
330
|
+
if (k === "__alias") {
|
|
319
331
|
return Object.entries(o)
|
|
320
332
|
.map(([alias, objectUnderAlias]) => {
|
|
321
|
-
if (typeof objectUnderAlias !==
|
|
322
|
-
|
|
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 }}}");
|
|
323
336
|
}
|
|
324
337
|
const operationName = Object.keys(objectUnderAlias)[0];
|
|
325
338
|
const operation = objectUnderAlias[operationName];
|
|
@@ -329,59 +342,63 @@ const PrepareScalarPaths = ({ ops, returns }) => {
|
|
|
329
342
|
}
|
|
330
343
|
const keyName = root ? ops[k] : k;
|
|
331
344
|
return Object.entries(o)
|
|
332
|
-
.filter(([k]) => k !==
|
|
345
|
+
.filter(([k]) => k !== "__directives")
|
|
333
346
|
.map(([k, v]) => {
|
|
334
347
|
// Inline fragments shouldn't be added to the path as they aren't a field
|
|
335
348
|
const isInlineFragment = originalKey.match(/^...\s*on/) != null;
|
|
336
|
-
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);
|
|
337
352
|
})
|
|
338
353
|
.reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
|
|
339
354
|
};
|
|
340
355
|
return ibb;
|
|
341
356
|
};
|
|
342
357
|
exports.PrepareScalarPaths = PrepareScalarPaths;
|
|
343
|
-
const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g,
|
|
358
|
+
const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g, "").replace(/^[^:]*\:/g, "");
|
|
344
359
|
exports.purifyGraphQLKey = purifyGraphQLKey;
|
|
345
360
|
const mapPart = (p) => {
|
|
346
|
-
const [isArg, isField] = p.split(
|
|
361
|
+
const [isArg, isField] = p.split("<>");
|
|
347
362
|
if (isField) {
|
|
348
363
|
return {
|
|
349
364
|
v: isField,
|
|
350
|
-
__type:
|
|
365
|
+
__type: "field",
|
|
351
366
|
};
|
|
352
367
|
}
|
|
353
368
|
return {
|
|
354
369
|
v: isArg,
|
|
355
|
-
__type:
|
|
370
|
+
__type: "arg",
|
|
356
371
|
};
|
|
357
372
|
};
|
|
358
373
|
const ResolveFromPath = (props, returns, ops) => {
|
|
359
374
|
const ResolvePropsType = (mappedParts) => {
|
|
360
375
|
const oKey = ops[mappedParts[0].v];
|
|
361
376
|
const propsP1 = oKey ? props[oKey] : props[mappedParts[0].v];
|
|
362
|
-
if (propsP1 ===
|
|
363
|
-
return
|
|
377
|
+
if (propsP1 === "enum" && mappedParts.length === 1) {
|
|
378
|
+
return "enum";
|
|
364
379
|
}
|
|
365
|
-
if (typeof propsP1 ===
|
|
380
|
+
if (typeof propsP1 === "string" &&
|
|
381
|
+
propsP1.startsWith("scalar.") &&
|
|
382
|
+
mappedParts.length === 1) {
|
|
366
383
|
return propsP1;
|
|
367
384
|
}
|
|
368
|
-
if (typeof propsP1 ===
|
|
385
|
+
if (typeof propsP1 === "object") {
|
|
369
386
|
if (mappedParts.length < 2) {
|
|
370
|
-
return
|
|
387
|
+
return "not";
|
|
371
388
|
}
|
|
372
389
|
const propsP2 = propsP1[mappedParts[1].v];
|
|
373
|
-
if (typeof propsP2 ===
|
|
390
|
+
if (typeof propsP2 === "string") {
|
|
374
391
|
return rpp(`${propsP2}${exports.SEPARATOR}${mappedParts
|
|
375
392
|
.slice(2)
|
|
376
393
|
.map((mp) => mp.v)
|
|
377
394
|
.join(exports.SEPARATOR)}`);
|
|
378
395
|
}
|
|
379
|
-
if (typeof propsP2 ===
|
|
396
|
+
if (typeof propsP2 === "object") {
|
|
380
397
|
if (mappedParts.length < 3) {
|
|
381
|
-
return
|
|
398
|
+
return "not";
|
|
382
399
|
}
|
|
383
400
|
const propsP3 = propsP2[mappedParts[2].v];
|
|
384
|
-
if (propsP3 && mappedParts[2].__type ===
|
|
401
|
+
if (propsP3 && mappedParts[2].__type === "arg") {
|
|
385
402
|
return rpp(`${propsP3}${exports.SEPARATOR}${mappedParts
|
|
386
403
|
.slice(3)
|
|
387
404
|
.map((mp) => mp.v)
|
|
@@ -392,13 +409,13 @@ const ResolveFromPath = (props, returns, ops) => {
|
|
|
392
409
|
};
|
|
393
410
|
const ResolveReturnType = (mappedParts) => {
|
|
394
411
|
if (mappedParts.length === 0) {
|
|
395
|
-
return
|
|
412
|
+
return "not";
|
|
396
413
|
}
|
|
397
414
|
const oKey = ops[mappedParts[0].v];
|
|
398
415
|
const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
|
|
399
|
-
if (typeof returnP1 ===
|
|
416
|
+
if (typeof returnP1 === "object") {
|
|
400
417
|
if (mappedParts.length < 2)
|
|
401
|
-
return
|
|
418
|
+
return "not";
|
|
402
419
|
const returnP2 = returnP1[mappedParts[1].v];
|
|
403
420
|
if (returnP2) {
|
|
404
421
|
return rpp(`${returnP2}${exports.SEPARATOR}${mappedParts
|
|
@@ -419,17 +436,19 @@ const ResolveFromPath = (props, returns, ops) => {
|
|
|
419
436
|
if (returnP1) {
|
|
420
437
|
return returnP1;
|
|
421
438
|
}
|
|
422
|
-
return
|
|
439
|
+
return "not";
|
|
423
440
|
};
|
|
424
441
|
return rpp;
|
|
425
442
|
};
|
|
426
443
|
exports.ResolveFromPath = ResolveFromPath;
|
|
427
444
|
const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
|
|
428
|
-
const arb = (a, p =
|
|
445
|
+
const arb = (a, p = "", root = true) => {
|
|
429
446
|
var _a, _b;
|
|
430
|
-
if (typeof a ===
|
|
447
|
+
if (typeof a === "string") {
|
|
431
448
|
if (a.startsWith(exports.START_VAR_NAME)) {
|
|
432
|
-
const [varName, graphQLType] = a
|
|
449
|
+
const [varName, graphQLType] = a
|
|
450
|
+
.replace(exports.START_VAR_NAME, "$")
|
|
451
|
+
.split(exports.GRAPHQL_TYPE_SEPARATOR);
|
|
433
452
|
const v = vars.find((v) => v.name === varName);
|
|
434
453
|
if (!v) {
|
|
435
454
|
vars.push({
|
|
@@ -446,28 +465,29 @@ const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
|
|
|
446
465
|
}
|
|
447
466
|
}
|
|
448
467
|
const checkType = (0, exports.ResolveFromPath)(props, returns, ops)(p);
|
|
449
|
-
if (checkType.startsWith(
|
|
450
|
-
|
|
451
|
-
const
|
|
468
|
+
if (checkType.startsWith("scalar.")) {
|
|
469
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
470
|
+
const [_, ...splittedScalar] = checkType.split(".");
|
|
471
|
+
const scalarKey = splittedScalar.join(".");
|
|
452
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);
|
|
453
473
|
}
|
|
454
474
|
if (Array.isArray(a)) {
|
|
455
|
-
return `[${a.map((arr) => arb(arr, p, false)).join(
|
|
475
|
+
return `[${a.map((arr) => arb(arr, p, false)).join(", ")}]`;
|
|
456
476
|
}
|
|
457
|
-
if (typeof a ===
|
|
458
|
-
if (checkType ===
|
|
477
|
+
if (typeof a === "string") {
|
|
478
|
+
if (checkType === "enum") {
|
|
459
479
|
return a;
|
|
460
480
|
}
|
|
461
481
|
return `${JSON.stringify(a)}`;
|
|
462
482
|
}
|
|
463
|
-
if (typeof a ===
|
|
483
|
+
if (typeof a === "object") {
|
|
464
484
|
if (a === null) {
|
|
465
485
|
return `null`;
|
|
466
486
|
}
|
|
467
487
|
const returnedObjectString = Object.entries(a)
|
|
468
|
-
.filter(([, v]) => typeof v !==
|
|
488
|
+
.filter(([, v]) => typeof v !== "undefined")
|
|
469
489
|
.map(([k, v]) => `${k}: ${arb(v, [p, k].join(exports.SEPARATOR), false)}`)
|
|
470
|
-
.join(
|
|
490
|
+
.join(",\n");
|
|
471
491
|
if (!root) {
|
|
472
492
|
return `{${returnedObjectString}}`;
|
|
473
493
|
}
|
|
@@ -483,7 +503,10 @@ exports.resolverFor = resolverFor;
|
|
|
483
503
|
exports.START_VAR_NAME = `$ZEUS_VAR`;
|
|
484
504
|
exports.GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
|
|
485
505
|
const $ = (name, graphqlType) => {
|
|
486
|
-
return (exports.START_VAR_NAME +
|
|
506
|
+
return (exports.START_VAR_NAME +
|
|
507
|
+
name +
|
|
508
|
+
exports.GRAPHQL_TYPE_SEPARATOR +
|
|
509
|
+
graphqlType);
|
|
487
510
|
};
|
|
488
511
|
exports.$ = $;
|
|
489
512
|
/** @description
|
|
@@ -1081,16 +1104,34 @@ var OrderType;
|
|
|
1081
1104
|
OrderType["Seller"] = "Seller";
|
|
1082
1105
|
OrderType["Aggregate"] = "Aggregate";
|
|
1083
1106
|
})(OrderType || (exports.OrderType = OrderType = {}));
|
|
1084
|
-
var
|
|
1085
|
-
(function (
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
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 = {}));
|
|
1094
1135
|
var PredictionType;
|
|
1095
1136
|
(function (PredictionType) {
|
|
1096
1137
|
PredictionType["RFM_SCORE"] = "RFM_SCORE";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypedDocumentNode } from
|
|
2
|
-
import { ValueTypes, GenericOperation, OperationOptions, GraphQLTypes, InputType, ScalarDefinition, ThunderGraphQLOptions, ExtractVariables } from
|
|
1
|
+
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import { ValueTypes, GenericOperation, OperationOptions, GraphQLTypes, InputType, ScalarDefinition, ThunderGraphQLOptions, ExtractVariables } from "./index.js";
|
|
3
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>>;
|
|
@@ -59,12 +59,12 @@ export declare const getPredictionItemQuery: import("@graphql-typed-document-nod
|
|
|
59
59
|
status: import("../zeus").PredictionStatus;
|
|
60
60
|
predictions?: {
|
|
61
61
|
id: string;
|
|
62
|
-
customer
|
|
62
|
+
customer?: {
|
|
63
63
|
id: string;
|
|
64
64
|
firstName: string;
|
|
65
65
|
lastName: string;
|
|
66
66
|
emailAddress: string;
|
|
67
|
-
};
|
|
67
|
+
} | undefined;
|
|
68
68
|
score: number;
|
|
69
69
|
}[] | undefined;
|
|
70
70
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { scalars } from "@deenruv/admin-types";
|
|
1
2
|
import { FromSelector } from "../zeus";
|
|
2
3
|
export declare const PredictionSelector: {
|
|
3
4
|
predictions: {
|
|
@@ -20,5 +21,5 @@ export declare const ReplicateEntityListSelector: {
|
|
|
20
21
|
};
|
|
21
22
|
totalItems: true;
|
|
22
23
|
};
|
|
23
|
-
export type ReplicatePredictionListType = FromSelector<typeof PredictionSelector, "PredictionResult">;
|
|
24
|
-
export type ReplicateEntityListType = FromSelector<typeof ReplicateEntityListSelector, "ReplicateEntityList">;
|
|
24
|
+
export type ReplicatePredictionListType = FromSelector<typeof PredictionSelector, "PredictionResult", typeof scalars>;
|
|
25
|
+
export type ReplicateEntityListType = FromSelector<typeof ReplicateEntityListSelector, "ReplicateEntityList", typeof scalars>;
|