@dcupl/common 2.0.0-beta.2 → 2.0.0-beta.3
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/esm/index.js +266 -239
- package/dist/esm/index.js.map +1 -1
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneDeep as
|
|
1
|
+
import { cloneDeep as y, get as D, every as B, findIndex as E, size as L, isEqual as O, differenceBy as q, startsWith as H, endsWith as U, isEqualWith as b, isMatch as V, find as J } from "lodash-es";
|
|
2
2
|
function Q(o) {
|
|
3
3
|
const e = S(o);
|
|
4
4
|
return Z(e);
|
|
@@ -41,7 +41,7 @@ const x = {
|
|
|
41
41
|
return performance.getEntriesByType(o);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
class
|
|
44
|
+
class Se {
|
|
45
45
|
data;
|
|
46
46
|
enabled = !1;
|
|
47
47
|
constructor() {
|
|
@@ -71,11 +71,11 @@ class Ke {
|
|
|
71
71
|
return;
|
|
72
72
|
const i = s.value - r.value, n = Math.round(i * 100) / 100, a = this.data.get(t);
|
|
73
73
|
if (a && e.sum) {
|
|
74
|
-
const
|
|
74
|
+
const c = a.value + n, f = {
|
|
75
75
|
...a,
|
|
76
|
-
value:
|
|
76
|
+
value: c
|
|
77
77
|
};
|
|
78
|
-
return this.data.set(t,
|
|
78
|
+
return this.data.set(t, f), f;
|
|
79
79
|
}
|
|
80
80
|
const u = {
|
|
81
81
|
name: e.name,
|
|
@@ -118,7 +118,7 @@ class Ke {
|
|
|
118
118
|
return e + "_" + r;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
let Y = class
|
|
121
|
+
let Y = class T {
|
|
122
122
|
nodes;
|
|
123
123
|
edges;
|
|
124
124
|
nodeKinds = /* @__PURE__ */ new Map();
|
|
@@ -253,8 +253,8 @@ let Y = class j {
|
|
|
253
253
|
r.add(a);
|
|
254
254
|
const u = this.edges.get(a);
|
|
255
255
|
if (u)
|
|
256
|
-
for (let
|
|
257
|
-
n(
|
|
256
|
+
for (let c of u)
|
|
257
|
+
n(c);
|
|
258
258
|
r.delete(a), t.add(a), s.push(a);
|
|
259
259
|
};
|
|
260
260
|
for (let a of this.nodes)
|
|
@@ -340,8 +340,8 @@ let Y = class j {
|
|
|
340
340
|
i.add(a);
|
|
341
341
|
const u = this.edges.get(a);
|
|
342
342
|
if (u)
|
|
343
|
-
for (const
|
|
344
|
-
t.set(
|
|
343
|
+
for (const c of u)
|
|
344
|
+
t.set(c, (t.get(c) || 0) - 1), (t.get(c) || 0) === 0 && s.push(c);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
if (i.size !== this.nodes.size)
|
|
@@ -362,23 +362,23 @@ let Y = class j {
|
|
|
362
362
|
* - 'both': union of upstream and downstream
|
|
363
363
|
*/
|
|
364
364
|
getImpactedNodes(e, t = "downstream", r) {
|
|
365
|
-
const s = new Set(e), i = (
|
|
366
|
-
const
|
|
367
|
-
for (;
|
|
368
|
-
const d =
|
|
365
|
+
const s = new Set(e), i = (c) => !r || r.length === 0 || r.includes(this.nodeKinds.get(c) ?? void 0), n = () => {
|
|
366
|
+
const c = /* @__PURE__ */ new Set(), f = Array.from(s);
|
|
367
|
+
for (; f.length; ) {
|
|
368
|
+
const d = f.shift();
|
|
369
369
|
for (const [l, h] of this.edges)
|
|
370
|
-
h.has(d) && !
|
|
370
|
+
h.has(d) && !c.has(l) && (c.add(l), f.push(l));
|
|
371
371
|
}
|
|
372
|
-
return
|
|
372
|
+
return c;
|
|
373
373
|
}, a = () => {
|
|
374
|
-
const
|
|
375
|
-
for (;
|
|
376
|
-
const d =
|
|
374
|
+
const c = /* @__PURE__ */ new Set(), f = Array.from(s);
|
|
375
|
+
for (; f.length; ) {
|
|
376
|
+
const d = f.shift(), l = this.edges.get(d);
|
|
377
377
|
if (l)
|
|
378
378
|
for (const h of l)
|
|
379
|
-
|
|
379
|
+
c.has(h) || (c.add(h), f.push(h));
|
|
380
380
|
}
|
|
381
|
-
return
|
|
381
|
+
return c;
|
|
382
382
|
};
|
|
383
383
|
let u;
|
|
384
384
|
return t === "both" ? u = /* @__PURE__ */ new Set([...n(), ...a()]) : t === "upstream" ? u = a() : u = n(), Array.from(u).filter(i);
|
|
@@ -392,7 +392,7 @@ let Y = class j {
|
|
|
392
392
|
return { nodes: e, edges: t };
|
|
393
393
|
}
|
|
394
394
|
static fromJSON(e) {
|
|
395
|
-
const t = new
|
|
395
|
+
const t = new T();
|
|
396
396
|
for (const r of e.nodes)
|
|
397
397
|
t.addNode(r.name, { kind: r.kind, meta: r.meta });
|
|
398
398
|
for (const r of e.edges)
|
|
@@ -400,15 +400,15 @@ let Y = class j {
|
|
|
400
400
|
return t;
|
|
401
401
|
}
|
|
402
402
|
diff(e) {
|
|
403
|
-
const t = new Set(this.getNodes()), r = new Set(e.getNodes()), s = Array.from(r).filter((d) => !t.has(d)), i = Array.from(t).filter((d) => !r.has(d)), n = new Set(this.getAllEdges().map((d) => d.join("→"))), a = new Set(e.getAllEdges().map((d) => d.join("→"))), u = Array.from(a).filter((d) => !n.has(d)).map((d) => d.split("→")),
|
|
403
|
+
const t = new Set(this.getNodes()), r = new Set(e.getNodes()), s = Array.from(r).filter((d) => !t.has(d)), i = Array.from(t).filter((d) => !r.has(d)), n = new Set(this.getAllEdges().map((d) => d.join("→"))), a = new Set(e.getAllEdges().map((d) => d.join("→"))), u = Array.from(a).filter((d) => !n.has(d)).map((d) => d.split("→")), c = Array.from(n).filter((d) => !a.has(d)).map((d) => d.split("→")), f = [];
|
|
404
404
|
for (const d of /* @__PURE__ */ new Set([...t, ...r])) {
|
|
405
405
|
const l = this.nodeKinds.get(d), h = e.nodeKinds.get(d);
|
|
406
|
-
l !== h &&
|
|
406
|
+
l !== h && f.push({ name: d, from: l, to: h });
|
|
407
407
|
}
|
|
408
|
-
return { addedNodes: s, removedNodes: i, addedEdges: u, removedEdges:
|
|
408
|
+
return { addedNodes: s, removedNodes: i, addedEdges: u, removedEdges: c, kindChanges: f };
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
|
-
class
|
|
411
|
+
class Ie {
|
|
412
412
|
graph;
|
|
413
413
|
nodeIndex;
|
|
414
414
|
constructor() {
|
|
@@ -800,7 +800,7 @@ class p {
|
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
const X = new p();
|
|
803
|
-
class
|
|
803
|
+
class Qe {
|
|
804
804
|
constructor(e) {
|
|
805
805
|
this.enabled = e, this.cache = /* @__PURE__ */ new Map(), this.cacheDependencies = /* @__PURE__ */ new Map();
|
|
806
806
|
}
|
|
@@ -842,8 +842,8 @@ class Ie {
|
|
|
842
842
|
if (s.models.has(n))
|
|
843
843
|
if (s.modelAttributes.has(n)) {
|
|
844
844
|
const u = s.modelAttributes.get(n);
|
|
845
|
-
for (const
|
|
846
|
-
if (u.has(
|
|
845
|
+
for (const c of a)
|
|
846
|
+
if (u.has(c)) {
|
|
847
847
|
i = !0;
|
|
848
848
|
break;
|
|
849
849
|
}
|
|
@@ -915,7 +915,7 @@ class Ie {
|
|
|
915
915
|
}
|
|
916
916
|
generateContext(e) {
|
|
917
917
|
try {
|
|
918
|
-
return
|
|
918
|
+
return y(e);
|
|
919
919
|
} catch (t) {
|
|
920
920
|
return this.log.error("Error in cache generateContext", t), e;
|
|
921
921
|
}
|
|
@@ -939,7 +939,7 @@ class Ie {
|
|
|
939
939
|
};
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
const
|
|
942
|
+
const Me = (o, e = "") => `${o}#${e}`, Ne = (o) => `${o.gt}_${o.gte}_${o.lt}_${o.lte}_${o.eq}_${o.ne}`, ke = (o) => `${o.gt}_${o.gte}_${o.lt}_${o.lte}_${o.eq}_${o.ne}`, Ce = (o, e) => {
|
|
943
943
|
const t = typeof e == "function" ? e : (r) => r[e];
|
|
944
944
|
return [
|
|
945
945
|
...o.reduce((r, s) => {
|
|
@@ -947,7 +947,7 @@ const Qe = (o, e = "") => `${o}#${e}`, Me = (o) => `${o.gt}_${o.gte}_${o.lt}_${o
|
|
|
947
947
|
return r.has(i) || r.set(i, s), r;
|
|
948
948
|
}, /* @__PURE__ */ new Map()).values()
|
|
949
949
|
];
|
|
950
|
-
},
|
|
950
|
+
}, Ee = (o, e) => o.reduce(function(t, r) {
|
|
951
951
|
const s = typeof e == "function" ? e(r) : r[e];
|
|
952
952
|
return Object.prototype.hasOwnProperty.call(t, s) || (t[s] = []), t[s].push(r), t;
|
|
953
953
|
}, {});
|
|
@@ -957,7 +957,7 @@ function ee(o = 10) {
|
|
|
957
957
|
for (let r = 0; r < o; r++) e += t.charAt(Math.floor(Math.random() * t.length));
|
|
958
958
|
return e;
|
|
959
959
|
}
|
|
960
|
-
const
|
|
960
|
+
const Oe = (o) => o.replace(/\/+$/, ""), te = (o) => typeof o != "string" ? "" : o.replace(/[[\]{}()*+?.,\\^$|#]/g, "\\$&"), qe = (o) => typeof o != "string" ? "" : o.replace(/\\([[\]{}()*+?.,\\^$|#])/g, "$1"), $e = (o, e) => {
|
|
961
961
|
try {
|
|
962
962
|
return re(o, e) >= 0;
|
|
963
963
|
} catch {
|
|
@@ -974,7 +974,7 @@ const Ee = (o) => o.replace(/\/+$/, ""), te = (o) => typeof o != "string" ? "" :
|
|
|
974
974
|
}
|
|
975
975
|
return 0;
|
|
976
976
|
}, F = (o) => /^\d+(\.\d+){0,2}$/.test(o);
|
|
977
|
-
class
|
|
977
|
+
class Fe {
|
|
978
978
|
key;
|
|
979
979
|
parentCd;
|
|
980
980
|
dcuplInitOptions;
|
|
@@ -1010,13 +1010,13 @@ class $e {
|
|
|
1010
1010
|
};
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
const P = (o, e) => e ? typeof structuredClone < "u" ? structuredClone(o) :
|
|
1013
|
+
const P = (o, e) => e ? typeof structuredClone < "u" ? structuredClone(o) : y(o) : o, G = (o, e, t, r, s, i) => {
|
|
1014
1014
|
try {
|
|
1015
1015
|
const n = !!e.dcuplInitOptions.performance?.clone?.enabled && !!t.cloneResult, a = P(i, n);
|
|
1016
1016
|
if (t.scope === "list" && (t.listKey = o.cdRef?.key || o.key, t.modelKey = o.model?.key || o.modelKey), t.type === "list_created" && t.args[0].listKey.startsWith("__global_list__") || t.listKey?.startsWith("__global_list__"))
|
|
1017
1017
|
return a;
|
|
1018
|
-
const u = x.now(),
|
|
1019
|
-
t.duration =
|
|
1018
|
+
const u = x.now(), c = u - r, f = Math.round(c * 1e3) / 1e3;
|
|
1019
|
+
t.duration = f, t.start = r, t.end = u;
|
|
1020
1020
|
const d = {
|
|
1021
1021
|
duration: t.duration
|
|
1022
1022
|
};
|
|
@@ -1033,57 +1033,57 @@ const P = (o, e) => e ? typeof structuredClone < "u" ? structuredClone(o) : m(o)
|
|
|
1033
1033
|
} catch {
|
|
1034
1034
|
return i;
|
|
1035
1035
|
}
|
|
1036
|
-
},
|
|
1036
|
+
}, Ge = (o) => (t, r, s) => {
|
|
1037
1037
|
const i = s.value;
|
|
1038
1038
|
return s.value = function(...n) {
|
|
1039
|
-
const a = x.now(), u = this.cdRef,
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1039
|
+
const a = x.now(), u = this.cdRef, c = P(o, !0);
|
|
1040
|
+
c.key || (u.increaseCounter(), c.key = u.getCounter());
|
|
1041
|
+
const f = ee();
|
|
1042
1042
|
u.analyticsController.mark({
|
|
1043
|
-
name: `${
|
|
1044
|
-
context:
|
|
1043
|
+
name: `${c.type}:start`,
|
|
1044
|
+
context: f
|
|
1045
1045
|
});
|
|
1046
1046
|
const d = this.model?.key;
|
|
1047
|
-
!
|
|
1047
|
+
!c.originCdRefKey && u.key && (c.originCdRefKey = u.key), d && (c.modelKey = d);
|
|
1048
1048
|
const l = i.apply(this, n);
|
|
1049
|
-
return
|
|
1049
|
+
return c.method = r, c.args = n, l && typeof l == "object" && "then" in l ? l.then((h) => G(this, u, c, a, f, h)) : G(this, u, c, a, f, l);
|
|
1050
1050
|
}, s;
|
|
1051
1051
|
};
|
|
1052
|
-
function
|
|
1052
|
+
function je(o, e, t, r) {
|
|
1053
1053
|
t.max || (t.max = 20);
|
|
1054
1054
|
const s = [], i = t.transform ? r.transformValue(t.value, t.transform) : t.value;
|
|
1055
1055
|
for (const [n, a] of e.entries()) {
|
|
1056
|
-
const u = Array.from(a).some((
|
|
1056
|
+
const u = Array.from(a).some((f) => o.has(f)), c = t.transform ? r.transformValue(n, t.transform) : n;
|
|
1057
1057
|
if (!(t.excludeUndefineds && typeof n > "u") && !(t.excludeNulls && n === null)) {
|
|
1058
1058
|
if (u && (i === "" || i === "//")) {
|
|
1059
|
-
const
|
|
1059
|
+
const f = {
|
|
1060
1060
|
value: n,
|
|
1061
1061
|
keys: t.calculateResultKeys ? Array.from(a) : []
|
|
1062
1062
|
};
|
|
1063
|
-
s.push(
|
|
1063
|
+
s.push(f);
|
|
1064
1064
|
} else if (u && typeof i == "string" && i.startsWith("/") && i.endsWith("/")) {
|
|
1065
|
-
if (r.queryFind(
|
|
1066
|
-
const
|
|
1065
|
+
if (r.queryFind(c, i, "some")) {
|
|
1066
|
+
const f = {
|
|
1067
1067
|
value: n,
|
|
1068
1068
|
keys: t.calculateResultKeys ? Array.from(a) : []
|
|
1069
1069
|
};
|
|
1070
|
-
s.push(
|
|
1070
|
+
s.push(f);
|
|
1071
1071
|
}
|
|
1072
1072
|
} else if (u && typeof i == "string") {
|
|
1073
|
-
const
|
|
1074
|
-
if (
|
|
1073
|
+
const f = String(c ?? ""), d = i;
|
|
1074
|
+
if (f.toLowerCase().startsWith(d.toLowerCase())) {
|
|
1075
1075
|
const l = {
|
|
1076
1076
|
value: n,
|
|
1077
1077
|
keys: t.calculateResultKeys ? Array.from(a) : []
|
|
1078
1078
|
};
|
|
1079
1079
|
s.push(l);
|
|
1080
1080
|
}
|
|
1081
|
-
} else if (u && r.queryFind(
|
|
1082
|
-
const
|
|
1081
|
+
} else if (u && r.queryFind(c, i, "some")) {
|
|
1082
|
+
const f = {
|
|
1083
1083
|
value: n,
|
|
1084
1084
|
keys: t.calculateResultKeys ? Array.from(a) : []
|
|
1085
1085
|
};
|
|
1086
|
-
s.push(
|
|
1086
|
+
s.push(f);
|
|
1087
1087
|
}
|
|
1088
1088
|
if (s.length === t.max)
|
|
1089
1089
|
break;
|
|
@@ -1306,8 +1306,8 @@ class de {
|
|
|
1306
1306
|
if (r = e.split(/[.[]/)[0], i) {
|
|
1307
1307
|
const u = e.indexOf("]");
|
|
1308
1308
|
if (u > -1) {
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1309
|
+
const c = e.indexOf(".", u + 1);
|
|
1310
|
+
c > -1 ? t = e.substring(c + 1) : t = void 0;
|
|
1311
1311
|
} else s && (t = e.substring(e.indexOf(".") + 1));
|
|
1312
1312
|
} else s && (t = e.substring(e.indexOf(".") + 1));
|
|
1313
1313
|
const a = {
|
|
@@ -1370,13 +1370,13 @@ class de {
|
|
|
1370
1370
|
const n = /\[([^\]]+)\]/g;
|
|
1371
1371
|
let a;
|
|
1372
1372
|
for (; (a = n.exec(e)) !== null; ) {
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1373
|
+
const f = a[1];
|
|
1374
|
+
f && f !== "*" && !/^\d+$/.test(f) && r.push(`Invalid bracket content: Must be a number or '*', got '${f}' in ${e}`);
|
|
1375
1375
|
}
|
|
1376
1376
|
const u = (e.match(/\./g) || []).length + 1;
|
|
1377
1377
|
u > t && r.push(`Path too deep: Maximum depth is ${t}, got ${u} in ${e}`);
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1378
|
+
const c = e.match(/[^a-zA-Z0-9._[\]*-]/g);
|
|
1379
|
+
return c && r.push(`Invalid characters in path: ${c.join(", ")} in ${e}`), {
|
|
1380
1380
|
valid: r.length === 0,
|
|
1381
1381
|
errors: r.length > 0 ? r : void 0
|
|
1382
1382
|
};
|
|
@@ -1436,17 +1436,39 @@ class de {
|
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
const g = new de();
|
|
1439
|
-
function
|
|
1440
|
-
if (
|
|
1441
|
-
const a =
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1439
|
+
function v(o, e) {
|
|
1440
|
+
if (e.includes("[*]")) {
|
|
1441
|
+
const i = e.indexOf("[*]"), n = e.substring(0, i), a = e.substring(i + 3), u = n ? D(o, n) : o;
|
|
1442
|
+
if (!Array.isArray(u)) return [];
|
|
1443
|
+
const c = [];
|
|
1444
|
+
for (const f of u)
|
|
1445
|
+
!a || a === "" ? f !== void 0 && c.push(f) : a.startsWith(".") && c.push(...v(f, a.slice(1)));
|
|
1446
|
+
return c;
|
|
1447
|
+
}
|
|
1448
|
+
const t = e.split(".");
|
|
1449
|
+
let r = [o];
|
|
1450
|
+
for (const i of t) {
|
|
1451
|
+
const n = [];
|
|
1452
|
+
for (const a of r)
|
|
1453
|
+
if (a != null)
|
|
1454
|
+
if (Array.isArray(a))
|
|
1455
|
+
for (const u of a) {
|
|
1456
|
+
if (u == null) continue;
|
|
1457
|
+
const c = u[i];
|
|
1458
|
+
c !== void 0 && n.push(c);
|
|
1459
|
+
}
|
|
1460
|
+
else {
|
|
1461
|
+
const u = a[i];
|
|
1462
|
+
u !== void 0 && n.push(u);
|
|
1463
|
+
}
|
|
1464
|
+
if (r = n, r.length === 0) return [];
|
|
1465
|
+
}
|
|
1466
|
+
const s = [];
|
|
1467
|
+
for (const i of r)
|
|
1468
|
+
if (Array.isArray(i))
|
|
1469
|
+
for (const n of i) n !== void 0 && s.push(n);
|
|
1470
|
+
else i !== void 0 && s.push(i);
|
|
1471
|
+
return s;
|
|
1450
1472
|
}
|
|
1451
1473
|
function K(o) {
|
|
1452
1474
|
let e = 0;
|
|
@@ -1456,7 +1478,7 @@ function K(o) {
|
|
|
1456
1478
|
}
|
|
1457
1479
|
return Math.pow(10, e);
|
|
1458
1480
|
}
|
|
1459
|
-
function
|
|
1481
|
+
function j(o, e, t) {
|
|
1460
1482
|
return (o * t + e * t) / t;
|
|
1461
1483
|
}
|
|
1462
1484
|
function le(o, e, t) {
|
|
@@ -1470,30 +1492,42 @@ const M = (o, e, t, r) => {
|
|
|
1470
1492
|
types: o.types
|
|
1471
1493
|
};
|
|
1472
1494
|
let i;
|
|
1473
|
-
(s.types.includes("sum") || s.types.includes("avg")
|
|
1495
|
+
(s.types.includes("sum") || s.types.includes("avg")) && (i = ye(r, e));
|
|
1474
1496
|
let n;
|
|
1475
|
-
return (s.types.includes("min") || s.types.includes("max")) && (n =
|
|
1476
|
-
a === "sum" ? s.sum = i?.sum : a === "avg" ? s.avg = i?.average : a === "count" ? s.count =
|
|
1497
|
+
return (s.types.includes("min") || s.types.includes("max")) && (n = pe(r, e)), o.types.forEach((a) => {
|
|
1498
|
+
a === "sum" ? s.sum = i?.sum : a === "avg" ? s.avg = i?.average : a === "count" ? s.count = he(r, e) : a === "min" ? s.min = n && n[0] : a === "max" ? s.max = n && n[1] : a === "distinct" ? s.distinct = me(o, e, t) : a === "group" && (s.group = ge(o, e));
|
|
1477
1499
|
}), s;
|
|
1478
1500
|
}, he = (o, e) => {
|
|
1501
|
+
const r = g.parse(o).isDeepQuery;
|
|
1502
|
+
let s = 0;
|
|
1503
|
+
for (const i of e.values())
|
|
1504
|
+
if (i)
|
|
1505
|
+
if (r)
|
|
1506
|
+
s += v(i, o).filter((n) => n != null).length;
|
|
1507
|
+
else {
|
|
1508
|
+
const n = i[o];
|
|
1509
|
+
if (n == null) continue;
|
|
1510
|
+
Array.isArray(n) ? s += n.filter((a) => a != null).length : s++;
|
|
1511
|
+
}
|
|
1512
|
+
return s;
|
|
1513
|
+
}, pe = (o, e) => {
|
|
1479
1514
|
let t, r;
|
|
1480
1515
|
const i = g.parse(o).isDeepQuery;
|
|
1481
|
-
for (const n of e.values())
|
|
1482
|
-
if (n)
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
} else
|
|
1490
|
-
a = n[o] !== void 0 ? [n[o]] : [];
|
|
1491
|
-
for (const u of a)
|
|
1492
|
-
(t === void 0 || u < t) && (t = u), (r === void 0 || u > r) && (r = u);
|
|
1516
|
+
for (const n of e.values()) {
|
|
1517
|
+
if (!n) continue;
|
|
1518
|
+
let a;
|
|
1519
|
+
if (i)
|
|
1520
|
+
a = v(n, o);
|
|
1521
|
+
else {
|
|
1522
|
+
const u = n[o];
|
|
1523
|
+
u === void 0 ? a = [] : Array.isArray(u) ? a = u.filter((c) => c !== void 0) : a = [u];
|
|
1493
1524
|
}
|
|
1525
|
+
for (const u of a)
|
|
1526
|
+
u == null || typeof u == "object" || ((t === void 0 || u < t) && (t = u), (r === void 0 || u > r) && (r = u));
|
|
1527
|
+
}
|
|
1494
1528
|
if (!(t === void 0 || r === void 0))
|
|
1495
1529
|
return [t, r];
|
|
1496
|
-
},
|
|
1530
|
+
}, ge = (o, e) => {
|
|
1497
1531
|
const t = [];
|
|
1498
1532
|
o.groupOptions?.groups?.forEach((n) => {
|
|
1499
1533
|
t.push({
|
|
@@ -1509,45 +1543,38 @@ const M = (o, e, t, r) => {
|
|
|
1509
1543
|
}, i = g.parse(o.attribute).isDeepQuery;
|
|
1510
1544
|
for (const n of e.values()) {
|
|
1511
1545
|
let a;
|
|
1512
|
-
|
|
1513
|
-
a = A(n, o.attribute);
|
|
1514
|
-
else if (i) {
|
|
1515
|
-
const f = y(n, o.attribute);
|
|
1516
|
-
a = f !== void 0 ? [f] : [];
|
|
1517
|
-
} else
|
|
1518
|
-
a = [n[o.attribute]];
|
|
1546
|
+
i ? a = v(n, o.attribute) : a = [n[o.attribute]];
|
|
1519
1547
|
let u = !1;
|
|
1520
|
-
for (const
|
|
1521
|
-
for (const
|
|
1522
|
-
(typeof
|
|
1548
|
+
for (const c of a)
|
|
1549
|
+
for (const f of t)
|
|
1550
|
+
(typeof f.option.value < "u" && f.option.value.includes(c) || typeof f.option.from < "u" && f.option.from < c && typeof f.option.to < "u" && f.option.to > c) && (f.keys.includes(n.key) || (f.count++, f.keys.push(n.key)), u = !0);
|
|
1523
1551
|
!u && o?.groupOptions?.calculateNotFound && (r.count++, r.keys.push(n.key));
|
|
1524
1552
|
}
|
|
1525
1553
|
return o?.groupOptions?.calculateNotFound && t.push(r), t;
|
|
1526
|
-
},
|
|
1554
|
+
}, ye = (o, e) => {
|
|
1527
1555
|
let t = 0, r = 0;
|
|
1528
1556
|
const i = g.parse(o).isDeepQuery;
|
|
1529
|
-
for (const
|
|
1530
|
-
if (!
|
|
1531
|
-
let
|
|
1532
|
-
if (i
|
|
1533
|
-
|
|
1534
|
-
else
|
|
1535
|
-
const c =
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
for (const c of f)
|
|
1557
|
+
for (const a of e.values()) {
|
|
1558
|
+
if (!a) continue;
|
|
1559
|
+
let u;
|
|
1560
|
+
if (i)
|
|
1561
|
+
u = v(a, o);
|
|
1562
|
+
else {
|
|
1563
|
+
const c = a[o];
|
|
1564
|
+
c === void 0 ? u = [] : Array.isArray(c) ? u = c : u = [c];
|
|
1565
|
+
}
|
|
1566
|
+
for (const c of u)
|
|
1540
1567
|
if (Array.isArray(c))
|
|
1541
|
-
for (const
|
|
1542
|
-
typeof
|
|
1543
|
-
else typeof c == "number" && (t =
|
|
1568
|
+
for (const f of c)
|
|
1569
|
+
typeof f == "number" && (t = j(t, f, K([t, f])), r++);
|
|
1570
|
+
else typeof c == "number" && (t = j(t, c, K([t, c])), r++);
|
|
1544
1571
|
}
|
|
1545
1572
|
return r === 0 ? void 0 : {
|
|
1546
1573
|
average: le(t, r, K([t, r])),
|
|
1547
|
-
count:
|
|
1574
|
+
count: r,
|
|
1548
1575
|
sum: t
|
|
1549
1576
|
};
|
|
1550
|
-
},
|
|
1577
|
+
}, me = (o, e, t) => {
|
|
1551
1578
|
const r = [];
|
|
1552
1579
|
for (const [s, i] of t)
|
|
1553
1580
|
if (!(o.excludeUndefineds && typeof s > "u") && Array.from(i).find((n) => e.has(n))) {
|
|
@@ -1575,7 +1602,7 @@ class R {
|
|
|
1575
1602
|
queries: []
|
|
1576
1603
|
};
|
|
1577
1604
|
_initOptions;
|
|
1578
|
-
currentQuery =
|
|
1605
|
+
currentQuery = y(this._defaultQueryOptions);
|
|
1579
1606
|
deepQueryService;
|
|
1580
1607
|
constructor(e) {
|
|
1581
1608
|
this.deepQueryService = e || g;
|
|
@@ -1604,7 +1631,7 @@ class R {
|
|
|
1604
1631
|
* });
|
|
1605
1632
|
*/
|
|
1606
1633
|
init(e) {
|
|
1607
|
-
this._initOptions =
|
|
1634
|
+
this._initOptions = y(e), this.currentQuery = y(this._defaultQueryOptions), this.currentQuery.modelKey = e.modelKey, "queries" in e && Array.isArray(e.queries) && (e.groupType && (this.currentQuery.groupType = e.groupType), e.queries && (this.currentQuery.queries = y(e.queries)), e.count !== void 0 && (this.currentQuery.count = e.count), e.start !== void 0 && (this.currentQuery.start = e.start), e.sort && (this.currentQuery.sort = e.sort), e.projection && (this.currentQuery.projection = e.projection));
|
|
1608
1635
|
}
|
|
1609
1636
|
reset() {
|
|
1610
1637
|
return this.init(this._initOptions), this.getQuery();
|
|
@@ -1622,7 +1649,7 @@ class R {
|
|
|
1622
1649
|
return this.currentQuery.queries.find((t) => this.isQueryGroup(t) && t.groupKey === e);
|
|
1623
1650
|
}
|
|
1624
1651
|
getQuery() {
|
|
1625
|
-
return
|
|
1652
|
+
return y(this.currentQuery);
|
|
1626
1653
|
}
|
|
1627
1654
|
hasQueryGroup(e) {
|
|
1628
1655
|
return this.currentQuery.queries.some((t) => this.isQueryGroup(t) && t.groupKey === e);
|
|
@@ -1638,7 +1665,7 @@ class R {
|
|
|
1638
1665
|
}
|
|
1639
1666
|
validate(e) {
|
|
1640
1667
|
const t = e.queries.map((s) => this.validateQuery(s));
|
|
1641
|
-
return { valid:
|
|
1668
|
+
return { valid: B(t, (s) => s.valid), errors: t.map((s) => s.errors).flat() };
|
|
1642
1669
|
}
|
|
1643
1670
|
applyOptions(e, t = "update") {
|
|
1644
1671
|
return t === "set" ? (this.currentQuery.count = e.count, this.currentQuery.start = e.start, this.currentQuery.sort = e.sort, this.currentQuery.projection = e.projection) : (typeof e?.sort < "u" && (this.currentQuery.sort = e.sort), typeof e?.count < "u" && (this.currentQuery.count = e.count), typeof e?.start < "u" && (this.currentQuery.start = e?.start), typeof e?.projection < "u" && (this.currentQuery.projection = e?.projection)), this.getQuery();
|
|
@@ -2250,26 +2277,26 @@ class R {
|
|
|
2250
2277
|
}
|
|
2251
2278
|
const I = new R();
|
|
2252
2279
|
function Te(o, e, t, r, s, i, n) {
|
|
2253
|
-
const a = [], u = I.removeQuery({ groupKey: s },
|
|
2280
|
+
const a = [], u = I.removeQuery({ groupKey: s }, y(r)), c = n.queryData(o, u, !1, i), f = e ? [...e.keys()] : [], d = new Set(f), l = i.get(s);
|
|
2254
2281
|
if (!t.excludeUnresolved)
|
|
2255
2282
|
for (const h of l.keys())
|
|
2256
2283
|
d.add(h);
|
|
2257
2284
|
t.excludeUndefineds ? d.delete(void 0) : d.add(void 0);
|
|
2258
2285
|
for (const h of d.values()) {
|
|
2259
|
-
const
|
|
2286
|
+
const A = /* @__PURE__ */ new Map(), W = l.get(h) || /* @__PURE__ */ new Set();
|
|
2260
2287
|
for (const k of W) {
|
|
2261
|
-
const C =
|
|
2262
|
-
if (C && (
|
|
2288
|
+
const C = c.get(k);
|
|
2289
|
+
if (C && (A.set(k, C), !t?.calculateFacets))
|
|
2263
2290
|
break;
|
|
2264
2291
|
}
|
|
2265
2292
|
const N = {
|
|
2266
2293
|
key: String(h),
|
|
2267
2294
|
value: h,
|
|
2268
|
-
selected:
|
|
2269
|
-
enabled:
|
|
2270
|
-
size:
|
|
2295
|
+
selected: ve(s, h, r),
|
|
2296
|
+
enabled: A.size > 0,
|
|
2297
|
+
size: A.size,
|
|
2271
2298
|
entry: e.get(h),
|
|
2272
|
-
resultKeys: Array.from(
|
|
2299
|
+
resultKeys: Array.from(A.keys())
|
|
2273
2300
|
};
|
|
2274
2301
|
if (!(t?.excludeZeros && N.size === 0)) {
|
|
2275
2302
|
if (t?.count && a.length === t?.count)
|
|
@@ -2279,7 +2306,7 @@ function Te(o, e, t, r, s, i, n) {
|
|
|
2279
2306
|
}
|
|
2280
2307
|
return a;
|
|
2281
2308
|
}
|
|
2282
|
-
const
|
|
2309
|
+
const ve = (o, e, t) => {
|
|
2283
2310
|
const r = t.queries.findIndex((s) => I.isQueryGroup(s) && s.groupKey === o);
|
|
2284
2311
|
return r > -1 ? !!t.queries[r].queries.find((i) => {
|
|
2285
2312
|
if (I.isQuery(i)) {
|
|
@@ -2289,7 +2316,7 @@ const me = (o, e, t) => {
|
|
|
2289
2316
|
return !1;
|
|
2290
2317
|
}) : !1;
|
|
2291
2318
|
};
|
|
2292
|
-
class
|
|
2319
|
+
class we {
|
|
2293
2320
|
indexMap = /* @__PURE__ */ new Map();
|
|
2294
2321
|
// Possible performance gain*
|
|
2295
2322
|
dataMap = /* @__PURE__ */ new Map();
|
|
@@ -2359,9 +2386,9 @@ class ve {
|
|
|
2359
2386
|
if (!i) {
|
|
2360
2387
|
this.reset(s), this.indexMap.set(s, /* @__PURE__ */ new Map());
|
|
2361
2388
|
const u = g.parse(e).isDeepQuery;
|
|
2362
|
-
for (const
|
|
2363
|
-
let
|
|
2364
|
-
u
|
|
2389
|
+
for (const c of t.values()) {
|
|
2390
|
+
let f;
|
|
2391
|
+
u ? (f = v(c, e), f.length === 0 && (f = [void 0])) : f = [c[e]], this.fillInverseIndex(s, c.key, f), this.fillDataMap(s, f);
|
|
2365
2392
|
}
|
|
2366
2393
|
i = this.getIndex(s) || /* @__PURE__ */ new Map();
|
|
2367
2394
|
}
|
|
@@ -2537,8 +2564,8 @@ class ve {
|
|
|
2537
2564
|
};
|
|
2538
2565
|
}
|
|
2539
2566
|
}
|
|
2540
|
-
const
|
|
2541
|
-
function z(o, e, t = { key: "root" }, r = "root", s = new
|
|
2567
|
+
const m = "__";
|
|
2568
|
+
function z(o, e, t = { key: "root" }, r = "root", s = new we(), i) {
|
|
2542
2569
|
const n = i || o;
|
|
2543
2570
|
for (const a of e.columns)
|
|
2544
2571
|
a.attribute && (g.parse(a.attribute), s.getOrCreateIndex(a.attribute, n));
|
|
@@ -2548,7 +2575,7 @@ function z(o, e, t = { key: "root" }, r = "root", s = new ve(), i) {
|
|
|
2548
2575
|
a.attribute && (g.parse(a.attribute), s.getOrCreateIndex(a.attribute, n));
|
|
2549
2576
|
if (e.rows && e.rows.length > 0) {
|
|
2550
2577
|
t.rows = t.rows || [];
|
|
2551
|
-
const a =
|
|
2578
|
+
const a = xe(o, e.rows[0], e, s, r, i);
|
|
2552
2579
|
t.rows.push(a);
|
|
2553
2580
|
}
|
|
2554
2581
|
if (e.columns && e.columns.length > 0) {
|
|
@@ -2565,46 +2592,46 @@ function z(o, e, t = { key: "root" }, r = "root", s = new ve(), i) {
|
|
|
2565
2592
|
}
|
|
2566
2593
|
return t;
|
|
2567
2594
|
}
|
|
2568
|
-
function
|
|
2595
|
+
function xe(o, e, t, r, s = "", i) {
|
|
2569
2596
|
const n = { key: e.attribute }, a = r.getIndex(e.attribute);
|
|
2570
2597
|
if (!a)
|
|
2571
2598
|
return n;
|
|
2572
|
-
for (const [u,
|
|
2573
|
-
const
|
|
2599
|
+
for (const [u, c] of a.entries()) {
|
|
2600
|
+
const f = {
|
|
2574
2601
|
key: u,
|
|
2575
2602
|
value: u
|
|
2576
2603
|
}, d = /* @__PURE__ */ new Map();
|
|
2577
|
-
for (const l of
|
|
2604
|
+
for (const l of c)
|
|
2578
2605
|
o.has(l) && d.set(l, o.get(l));
|
|
2579
2606
|
if (d.size) {
|
|
2580
2607
|
for (const l of t.values) {
|
|
2581
|
-
if (
|
|
2608
|
+
if (f.values = f.values || [], s === "root" && e?.calculateTotals === !1)
|
|
2582
2609
|
continue;
|
|
2583
2610
|
const h = M(l, d, r.getIndex(l.attribute), l.attribute);
|
|
2584
|
-
|
|
2611
|
+
f.values.push(h);
|
|
2585
2612
|
}
|
|
2586
|
-
if (n.rows = n.rows || [], n.rows.push(
|
|
2613
|
+
if (n.rows = n.rows || [], n.rows.push(f), t.rows.length > 1) {
|
|
2587
2614
|
const l = { ...t, rows: t.rows.slice(1) };
|
|
2588
2615
|
z(
|
|
2589
2616
|
d,
|
|
2590
2617
|
l,
|
|
2591
|
-
|
|
2592
|
-
s +
|
|
2618
|
+
f,
|
|
2619
|
+
s + m + e.attribute + m + u,
|
|
2593
2620
|
r,
|
|
2594
2621
|
i
|
|
2595
2622
|
);
|
|
2596
2623
|
} else if (t.columns)
|
|
2597
2624
|
for (const l of t.columns) {
|
|
2598
|
-
|
|
2625
|
+
f.columns = f.columns || [];
|
|
2599
2626
|
const h = _(
|
|
2600
2627
|
d,
|
|
2601
2628
|
l,
|
|
2602
2629
|
t,
|
|
2603
2630
|
r,
|
|
2604
|
-
s +
|
|
2631
|
+
s + m + e.attribute + m + u,
|
|
2605
2632
|
i
|
|
2606
2633
|
);
|
|
2607
|
-
|
|
2634
|
+
f.columns.push(h);
|
|
2608
2635
|
}
|
|
2609
2636
|
}
|
|
2610
2637
|
}
|
|
@@ -2614,27 +2641,27 @@ function _(o, e, t, r, s = "", i) {
|
|
|
2614
2641
|
const n = { key: e.attribute }, a = r.getIndex(e.attribute);
|
|
2615
2642
|
if (!a)
|
|
2616
2643
|
return n;
|
|
2617
|
-
for (const [u,
|
|
2618
|
-
const
|
|
2644
|
+
for (const [u, c] of a.entries()) {
|
|
2645
|
+
const f = {
|
|
2619
2646
|
key: u,
|
|
2620
2647
|
value: u
|
|
2621
2648
|
}, d = /* @__PURE__ */ new Map();
|
|
2622
|
-
for (const l of
|
|
2649
|
+
for (const l of c)
|
|
2623
2650
|
o.has(l) && d.set(l, o.get(l));
|
|
2624
2651
|
if (d.size) {
|
|
2625
2652
|
for (const l of t.values) {
|
|
2626
|
-
if (
|
|
2653
|
+
if (f.values = f.values || [], s === "root" && e?.calculateTotals === !1)
|
|
2627
2654
|
continue;
|
|
2628
2655
|
const h = M(l, d, r.getIndex(l.attribute), l.attribute);
|
|
2629
|
-
|
|
2656
|
+
f.values.push(h);
|
|
2630
2657
|
}
|
|
2631
|
-
if (n.columns = n.columns || [], n.columns.push(
|
|
2658
|
+
if (n.columns = n.columns || [], n.columns.push(f), t.columns.length > 1) {
|
|
2632
2659
|
const l = { ...t, columns: t.columns.slice(1) };
|
|
2633
2660
|
z(
|
|
2634
2661
|
d,
|
|
2635
2662
|
l,
|
|
2636
|
-
|
|
2637
|
-
s +
|
|
2663
|
+
f,
|
|
2664
|
+
s + m + e.attribute + m + u,
|
|
2638
2665
|
r,
|
|
2639
2666
|
i
|
|
2640
2667
|
);
|
|
@@ -2643,11 +2670,11 @@ function _(o, e, t, r, s = "", i) {
|
|
|
2643
2670
|
}
|
|
2644
2671
|
return n;
|
|
2645
2672
|
}
|
|
2646
|
-
const
|
|
2673
|
+
const Pe = (o, e) => {
|
|
2647
2674
|
const t = [];
|
|
2648
2675
|
for (const r of o) {
|
|
2649
2676
|
for (const [s, i] of Object.entries(r)) {
|
|
2650
|
-
const n = t.find((u) => u.key === s), a =
|
|
2677
|
+
const n = t.find((u) => u.key === s), a = De(i);
|
|
2651
2678
|
if (n)
|
|
2652
2679
|
n.type !== a && (n.type = "any");
|
|
2653
2680
|
else {
|
|
@@ -2662,12 +2689,12 @@ const je = (o, e) => {
|
|
|
2662
2689
|
break;
|
|
2663
2690
|
}
|
|
2664
2691
|
return t;
|
|
2665
|
-
},
|
|
2692
|
+
}, Ae = (o) => Number(o) === o && o % 1 === 0, be = (o) => Number(o) === o && o % 1 !== 0, De = (o) => {
|
|
2666
2693
|
switch (typeof o) {
|
|
2667
2694
|
case "string":
|
|
2668
2695
|
return "string";
|
|
2669
2696
|
case "number":
|
|
2670
|
-
return
|
|
2697
|
+
return Ae(o) ? "int" : be(o) ? "float" : "any";
|
|
2671
2698
|
case "boolean":
|
|
2672
2699
|
return "boolean";
|
|
2673
2700
|
case "object":
|
|
@@ -2675,7 +2702,7 @@ const je = (o, e) => {
|
|
|
2675
2702
|
default:
|
|
2676
2703
|
return "any";
|
|
2677
2704
|
}
|
|
2678
|
-
},
|
|
2705
|
+
}, Re = (o, e) => {
|
|
2679
2706
|
const t = te(o.text || ""), r = e?.attributeKey || o.filterKey;
|
|
2680
2707
|
let s;
|
|
2681
2708
|
const i = e?.comparisonType || "containsIgnoreCase";
|
|
@@ -2739,7 +2766,7 @@ const je = (o, e) => {
|
|
|
2739
2766
|
}
|
|
2740
2767
|
]
|
|
2741
2768
|
}), s;
|
|
2742
|
-
},
|
|
2769
|
+
}, ze = (o, e) => {
|
|
2743
2770
|
const t = e?.attributeKey || o.filterKey;
|
|
2744
2771
|
return {
|
|
2745
2772
|
groupKey: o.filterKey,
|
|
@@ -2752,7 +2779,7 @@ const je = (o, e) => {
|
|
|
2752
2779
|
}
|
|
2753
2780
|
]
|
|
2754
2781
|
};
|
|
2755
|
-
},
|
|
2782
|
+
}, _e = (o, e) => {
|
|
2756
2783
|
const t = e?.attributeKey || o.filterKey, r = {
|
|
2757
2784
|
groupKey: o.filterKey,
|
|
2758
2785
|
queries: []
|
|
@@ -2767,7 +2794,7 @@ const je = (o, e) => {
|
|
|
2767
2794
|
operator: "eq",
|
|
2768
2795
|
options: { invert: !0 }
|
|
2769
2796
|
})), typeof o.gt < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: o.gt, operator: "gt" })), typeof o.lt < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: o.lt, operator: "lt" })), typeof o.gte < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: o.gte, operator: "gte" })), typeof o.lte < "u" && (r.groupType = "and", r.queries.push({ attribute: t, value: o.lte, operator: "lte" })), r;
|
|
2770
|
-
},
|
|
2797
|
+
}, We = (o, e) => {
|
|
2771
2798
|
const t = e?.attributeKey || o.filterKey, r = {
|
|
2772
2799
|
groupKey: o.filterKey,
|
|
2773
2800
|
queries: []
|
|
@@ -2780,8 +2807,8 @@ const je = (o, e) => {
|
|
|
2780
2807
|
operator: "eq"
|
|
2781
2808
|
});
|
|
2782
2809
|
}), r;
|
|
2783
|
-
},
|
|
2784
|
-
class
|
|
2810
|
+
}, Le = (o) => !(typeof o.modelKey != "string" || !Array.isArray(o.queries));
|
|
2811
|
+
class He {
|
|
2785
2812
|
constructor(e, t, r) {
|
|
2786
2813
|
this.scriptController = e, this.globalItemService = t, this.modelParser = r;
|
|
2787
2814
|
}
|
|
@@ -2802,7 +2829,7 @@ class Le {
|
|
|
2802
2829
|
evaluateQuery(e, t) {
|
|
2803
2830
|
let r, s = e.value;
|
|
2804
2831
|
const i = e.options?.arrayValueHandling || "some";
|
|
2805
|
-
if (Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (s = this.transformValue(s, e.options.transform)), e.attribute.includes(".") || e.attribute.includes("[") ? r =
|
|
2832
|
+
if (Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (s = this.transformValue(s, e.options.transform)), e.attribute.includes(".") || e.attribute.includes("[") ? r = D(t, e.attribute) : r = t[e.attribute], Array.isArray(e.options?.transform) && e.options.transform.length > 0 && (r = this.transformValue(r, e.options.transform)), (typeof r > "u" || r === null) && !["typeof", "isTruthy", "eq"].includes(e.operator))
|
|
2806
2833
|
return !1;
|
|
2807
2834
|
switch (e.operator) {
|
|
2808
2835
|
case "eq":
|
|
@@ -2841,25 +2868,25 @@ class Le {
|
|
|
2841
2868
|
if (typeof t.value == "string" ? a = t.value : t.value?.key && Object.keys(t.value).length === 1 && (a = t.value.key), typeof a < "u") {
|
|
2842
2869
|
const u = n.get(a);
|
|
2843
2870
|
if (u)
|
|
2844
|
-
if (u.forEach((
|
|
2845
|
-
r.has(
|
|
2871
|
+
if (u.forEach((c) => {
|
|
2872
|
+
r.has(c) && i.set(c, r.get(c));
|
|
2846
2873
|
}), t.options?.invert) {
|
|
2847
|
-
const
|
|
2848
|
-
return
|
|
2849
|
-
|
|
2850
|
-
}),
|
|
2874
|
+
const c = q(Array.from(r.values()), Array.from(i.values()), "key"), f = /* @__PURE__ */ new Map();
|
|
2875
|
+
return c.forEach((d) => {
|
|
2876
|
+
f.set(d.key, d);
|
|
2877
|
+
}), f;
|
|
2851
2878
|
} else
|
|
2852
2879
|
return i;
|
|
2853
2880
|
}
|
|
2854
2881
|
}
|
|
2855
2882
|
for (let [a, u] of r) {
|
|
2856
|
-
const
|
|
2857
|
-
if (
|
|
2858
|
-
const
|
|
2859
|
-
|
|
2883
|
+
const c = this.queryBuilder.extractQueryAttributes({ queries: [t] });
|
|
2884
|
+
if (c.some((f) => f.isDeepQuery)) {
|
|
2885
|
+
const f = this.queryBuilder.getProjectionForAttributeEntries(
|
|
2886
|
+
c.filter((d) => d.isDeepQuery)
|
|
2860
2887
|
);
|
|
2861
2888
|
u = this.globalItemService.getProjectedData(
|
|
2862
|
-
|
|
2889
|
+
f,
|
|
2863
2890
|
this.modelParser.models.get(e.modelKey),
|
|
2864
2891
|
u
|
|
2865
2892
|
);
|
|
@@ -2875,10 +2902,10 @@ class Le {
|
|
|
2875
2902
|
} catch {
|
|
2876
2903
|
return !1;
|
|
2877
2904
|
}
|
|
2878
|
-
else return Array.isArray(e) ? !!e.find((r) =>
|
|
2905
|
+
else return Array.isArray(e) ? !!e.find((r) => b(r, t, this.equalRegexFn)) : typeof t == "object" ? V(e, t) : e === t;
|
|
2879
2906
|
}
|
|
2880
2907
|
queryFind(e, t, r) {
|
|
2881
|
-
return Array.isArray(e) ? typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? r === "some" ? e.some((s) =>
|
|
2908
|
+
return Array.isArray(e) ? typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? r === "some" ? e.some((s) => b(s, t, this.equalRegexFn)) : e.every((s) => b(s, t, this.equalRegexFn)) : !!J(e, t) : b(e, t, this.equalRegexFn);
|
|
2882
2909
|
}
|
|
2883
2910
|
validateQuery(e) {
|
|
2884
2911
|
if (this.queryBuilder.isQuery(e)) {
|
|
@@ -2889,7 +2916,7 @@ class Le {
|
|
|
2889
2916
|
return !0;
|
|
2890
2917
|
} else {
|
|
2891
2918
|
if (this.queryBuilder.isQueryGroup(e))
|
|
2892
|
-
return
|
|
2919
|
+
return B(e.queries, (t) => this.validateQuery(t));
|
|
2893
2920
|
throw new Error("invalid query - missing query or attribute");
|
|
2894
2921
|
}
|
|
2895
2922
|
}
|
|
@@ -2898,10 +2925,10 @@ class Le {
|
|
|
2898
2925
|
if (t.attribute.includes("[*]")) {
|
|
2899
2926
|
const n = t.options?.invert === !0, a = /* @__PURE__ */ new Set();
|
|
2900
2927
|
for (let u of r.values()) {
|
|
2901
|
-
const
|
|
2902
|
-
if (
|
|
2928
|
+
const c = this.queryBuilder.extractQueryAttributes({ queries: [t] });
|
|
2929
|
+
if (c.some((l) => l.isDeepQuery)) {
|
|
2903
2930
|
const l = this.queryBuilder.getProjectionForAttributeEntries(
|
|
2904
|
-
|
|
2931
|
+
c.filter((h) => h.isDeepQuery)
|
|
2905
2932
|
);
|
|
2906
2933
|
u = this.globalItemService.getProjectedData(
|
|
2907
2934
|
l,
|
|
@@ -2909,9 +2936,9 @@ class Le {
|
|
|
2909
2936
|
u
|
|
2910
2937
|
);
|
|
2911
2938
|
}
|
|
2912
|
-
const
|
|
2939
|
+
const f = this.handleArrayStarQuery(t, u);
|
|
2913
2940
|
let d = !1;
|
|
2914
|
-
for (const l of
|
|
2941
|
+
for (const l of f.queries) {
|
|
2915
2942
|
const h = { ...l, options: { ...l.options, invert: !1 } };
|
|
2916
2943
|
if (this.evaluateQuery(h, u)) {
|
|
2917
2944
|
d = !0;
|
|
@@ -2921,19 +2948,19 @@ class Le {
|
|
|
2921
2948
|
d && (a.add(u.key), n || i.set(u.key, u));
|
|
2922
2949
|
}
|
|
2923
2950
|
if (n)
|
|
2924
|
-
for (const [u,
|
|
2925
|
-
a.has(u) || i.set(u,
|
|
2951
|
+
for (const [u, c] of r)
|
|
2952
|
+
a.has(u) || i.set(u, c);
|
|
2926
2953
|
} else {
|
|
2927
2954
|
if (t.operator === "eq")
|
|
2928
2955
|
return this.evaluateEqOperator(e, t, r, s);
|
|
2929
2956
|
for (let [n, a] of r) {
|
|
2930
2957
|
const u = this.queryBuilder.extractQueryAttributes({ queries: [t] });
|
|
2931
|
-
if (u.some((
|
|
2932
|
-
const
|
|
2933
|
-
u.filter((
|
|
2958
|
+
if (u.some((c) => c.isDeepQuery)) {
|
|
2959
|
+
const c = this.queryBuilder.getProjectionForAttributeEntries(
|
|
2960
|
+
u.filter((f) => f.isDeepQuery)
|
|
2934
2961
|
);
|
|
2935
2962
|
a = this.globalItemService.getProjectedData(
|
|
2936
|
-
|
|
2963
|
+
c,
|
|
2937
2964
|
this.modelParser.models.get(e.modelKey),
|
|
2938
2965
|
a
|
|
2939
2966
|
);
|
|
@@ -2950,7 +2977,7 @@ class Le {
|
|
|
2950
2977
|
queries: []
|
|
2951
2978
|
};
|
|
2952
2979
|
if (r !== -1) {
|
|
2953
|
-
const i = e.attribute.substring(0, r), n = i.includes(".") ?
|
|
2980
|
+
const i = e.attribute.substring(0, r), n = i.includes(".") ? D(t, i) : t[i];
|
|
2954
2981
|
if (Array.isArray(n))
|
|
2955
2982
|
for (let a = 0; a < n.length; a++) {
|
|
2956
2983
|
const u = e.attribute.replace("[*]", `[${a}]`);
|
|
@@ -2969,14 +2996,14 @@ class Le {
|
|
|
2969
2996
|
if (!t.queries || t.queries?.length === 0)
|
|
2970
2997
|
return a;
|
|
2971
2998
|
for (const u of t.queries) {
|
|
2972
|
-
let
|
|
2973
|
-
if (this.queryBuilder.isQuery(u) ?
|
|
2974
|
-
|
|
2975
|
-
n.set(
|
|
2999
|
+
let c = /* @__PURE__ */ new Map();
|
|
3000
|
+
if (this.queryBuilder.isQuery(u) ? c = this.getEvaluatedQueryDataset(e, u, a, i) : c = this.evaluateQueryGroup(e, u, a, s, i), n.size === 0 && (n = c), t.groupType === "or")
|
|
3001
|
+
c.forEach((f) => {
|
|
3002
|
+
n.set(f.key, f);
|
|
2976
3003
|
});
|
|
2977
3004
|
else {
|
|
2978
|
-
const
|
|
2979
|
-
for (const d of
|
|
3005
|
+
const f = q(Array.from(n.values()), Array.from(c.values()), "key");
|
|
3006
|
+
for (const d of f)
|
|
2980
3007
|
n.delete(d.key);
|
|
2981
3008
|
}
|
|
2982
3009
|
t.groupType === "and" ? a = n : a = r;
|
|
@@ -3021,7 +3048,7 @@ class Le {
|
|
|
3021
3048
|
// }
|
|
3022
3049
|
// }
|
|
3023
3050
|
}
|
|
3024
|
-
class
|
|
3051
|
+
class Ue {
|
|
3025
3052
|
scripts = /* @__PURE__ */ new Map();
|
|
3026
3053
|
scriptFunctions = /* @__PURE__ */ new Map();
|
|
3027
3054
|
constructor() {
|
|
@@ -3064,10 +3091,10 @@ class He {
|
|
|
3064
3091
|
return this.getScriptAsFn(e, i)(t, ...n);
|
|
3065
3092
|
}
|
|
3066
3093
|
}
|
|
3067
|
-
const
|
|
3094
|
+
const Ve = (o, e) => o ? (e || (e = {}), o.replace(/\$\{(.*?)\}/g, (t, r) => D(e, r.trim(), ""))) : "", Je = (o) => {
|
|
3068
3095
|
const e = /* @__PURE__ */ new Set();
|
|
3069
3096
|
return o.replace(/\$\{(.*?)\}/g, (r, s) => (e.add(s.trim()), "")), { variables: Array.from(e).map((r) => ({ name: r })) };
|
|
3070
|
-
},
|
|
3097
|
+
}, Ze = [
|
|
3071
3098
|
"any",
|
|
3072
3099
|
"Array<date>",
|
|
3073
3100
|
"Array<float>",
|
|
@@ -3079,7 +3106,7 @@ const Ue = (o, e) => o ? (e || (e = {}), o.replace(/\$\{(.*?)\}/g, (t, r) => y(e
|
|
|
3079
3106
|
"int",
|
|
3080
3107
|
"json",
|
|
3081
3108
|
"string"
|
|
3082
|
-
],
|
|
3109
|
+
], Ye = ["int", "float", "Array<int>", "Array<float>"], Xe = ["date", "Array<date>"], et = [
|
|
3083
3110
|
"eq",
|
|
3084
3111
|
"find",
|
|
3085
3112
|
"gt",
|
|
@@ -3091,57 +3118,57 @@ const Ue = (o, e) => o ? (e || (e = {}), o.replace(/\$\{(.*?)\}/g, (t, r) => y(e
|
|
|
3091
3118
|
"size"
|
|
3092
3119
|
];
|
|
3093
3120
|
export {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3121
|
+
Se as AnalyticsController,
|
|
3122
|
+
Ie as AttributeDependencyGraph,
|
|
3123
|
+
Qe as CacheController,
|
|
3124
|
+
Fe as ChangeDetector,
|
|
3125
|
+
Xe as DatePropertyTypes,
|
|
3099
3126
|
R as DcuplQueryBuilder,
|
|
3100
|
-
|
|
3127
|
+
et as DcuplQueryOperatorsAsArray,
|
|
3101
3128
|
de as DeepQueryService,
|
|
3102
3129
|
Y as DependencyGraph,
|
|
3103
|
-
|
|
3130
|
+
we as IndicesController,
|
|
3104
3131
|
p as Logger,
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3132
|
+
Ye as NumberPropertyTypes,
|
|
3133
|
+
Ze as PropertyTypesAsArray,
|
|
3134
|
+
He as QueryManager,
|
|
3135
|
+
Ue as ScriptController,
|
|
3109
3136
|
P as clone,
|
|
3110
3137
|
re as compareVersions,
|
|
3111
|
-
|
|
3138
|
+
je as computeSuggestions,
|
|
3112
3139
|
g as deepQueryService,
|
|
3113
3140
|
te as escapeRegExp,
|
|
3114
|
-
|
|
3115
|
-
|
|
3141
|
+
Ve as evaluateTemplate,
|
|
3142
|
+
ze as generateBooleanQuery,
|
|
3116
3143
|
ee as generateKey,
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3144
|
+
_e as generateNumberAndDateQuery,
|
|
3145
|
+
We as generateReferenceQuery,
|
|
3146
|
+
Re as generateTextQuery,
|
|
3120
3147
|
M as getAggregation,
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3148
|
+
ke as getDateConstraintUid,
|
|
3149
|
+
De as getDcuplPropertyTypeForNativeType,
|
|
3150
|
+
v as getDeepPathValues,
|
|
3151
|
+
me as getDistinct,
|
|
3125
3152
|
Te as getFacets,
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3153
|
+
Me as getFilterEntryId,
|
|
3154
|
+
Ne as getNumberConstraintUid,
|
|
3155
|
+
Pe as getPropertiesForData,
|
|
3156
|
+
Ee as groupBy,
|
|
3157
|
+
$e as hasMinimumVersion,
|
|
3131
3158
|
se as isDateInstance,
|
|
3132
|
-
|
|
3133
|
-
|
|
3159
|
+
be as isFloat,
|
|
3160
|
+
Ae as isInt,
|
|
3134
3161
|
ne as isValidDate,
|
|
3135
|
-
|
|
3162
|
+
Le as isValidQueryStatement,
|
|
3136
3163
|
F as isValidVersion,
|
|
3137
3164
|
X as logger,
|
|
3138
3165
|
Be as parseDate,
|
|
3139
|
-
|
|
3166
|
+
Je as parseTemplate,
|
|
3140
3167
|
x as perf,
|
|
3141
3168
|
z as pivot,
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3169
|
+
Oe as removeTrailingSlash,
|
|
3170
|
+
Ge as trigger,
|
|
3171
|
+
qe as unescapeRegExp,
|
|
3172
|
+
Ce as uniqBy
|
|
3146
3173
|
};
|
|
3147
3174
|
//# sourceMappingURL=index.js.map
|