@sisense/sdk-ui 2.25.0 → 2.26.0
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/ai.cjs +33 -33
- package/dist/ai.js +626 -639
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +1010 -865
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +6 -6
- package/dist/{apply-styled-options-to-query-BsBTwL6W.js → apply-styled-options-to-query-Bzt2GrgO.js} +1459 -1426
- package/dist/apply-styled-options-to-query-COD9fRYD.cjs +1 -0
- package/dist/dimensions-Ce2zWFrs.js +204 -0
- package/dist/dimensions-u3w5qNF0.cjs +1 -0
- package/dist/index.cjs +380 -380
- package/dist/index.js +17024 -16696
- package/dist/index.umd.js +649 -660
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/translate-dashboard-utils.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +12 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/utils.d.ts +5 -2
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-scroll-persistence.d.ts +16 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +2 -3
- package/dist/packages/sdk-ui/src/domains/data-browser/data-source-dimensional-model/hooks/use-get-data-source-dimensions.d.ts +10 -0
- package/dist/packages/sdk-ui/src/domains/data-browser/data-source-dimensional-model/hooks/use-get-data-source-fields.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/drilldown/components/drilldown-widget/drilldown-widget.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/narrative/core/widget-narrative-options.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-get-widget-narrative.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-widget-narrative-state.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/query-execution/core/date-formats/simple-date-format-replacers.d.ts +13 -0
- package/dist/packages/sdk-ui/src/domains/query-execution/hooks/use-execute-pivot-query/use-execute-pivot-query.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/query-execution/hooks/use-execute-query/use-execute-query.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/area-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/areamap-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/bar-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/boxplot-chart/boxplot-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/axis.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/column-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/funnel-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/line-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/pie-chart/pie-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/polar-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/scatter-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/scattermap-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/sunburst-chart/sunburst-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/table/table.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/components/treemap-chart/treemap-chart.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/types.d.ts +6 -6
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/cartesian/utils/axis/axis-builders.d.ts +6 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/plot-bands.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/translations/axis-section.d.ts +29 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/translations/design-options.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-options-processor/translations/tooltip-utils.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/compose-code-to-readable.d.ts +24 -4
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +3 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-params-to-view-model.d.ts +6 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +6 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +118 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/types.d.ts +18 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/use-scroller-location-save.d.ts +8 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/utils.d.ts +9 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/widget-by-id.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/with-navigator-scroll-save.d.ts +10 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/use-get-widget-model.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/to-widget-dto-panels.d.ts +170 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +8 -14
- package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-endpoints.d.ts +3 -3
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +12 -1
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +10 -2
- package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-custom-widgets.d.ts +10 -3
- package/dist/packages/sdk-ui/src/infra/plugins/plugin-context.d.ts +2 -2
- package/dist/packages/sdk-ui/src/infra/plugins/types.d.ts +2 -2
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +3 -4
- package/dist/packages/sdk-ui/src/modules/ai/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/public-api/internal.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +1 -1
- package/dist/packages/sdk-ui/src/shared/utils/filter-relations.d.ts +2 -0
- package/dist/packages/sdk-ui/src/types.d.ts +7 -7
- package/dist/{types-GFLaiax5.cjs → types-COBvZZm_.cjs} +1 -1
- package/dist/{types-BBp2sp_s.js → types-D6jCGncV.js} +1 -1
- package/dist/{use-hover-mptQLQ4S.js → use-hover-B1HPf4hF.js} +6190 -6093
- package/dist/{use-hover-DsnmY-p_.cjs → use-hover-CaQrW_gv.cjs} +112 -112
- package/dist/{utils-DTUC-wtI.js → utils-BQtueE3Z.js} +9591 -9422
- package/dist/utils-CAubp1g1.cjs +179 -0
- package/dist/{widget-composer-D0BZrLna.js → widget-composer-BAJFWk3t.js} +3 -3
- package/dist/{widget-composer-CDb2iOoS.cjs → widget-composer-C75b-E6W.cjs} +1 -1
- package/package.json +8 -8
- package/dist/apply-styled-options-to-query-mFJvsssw.cjs +0 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/index.d.ts +0 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/table-widget.d.ts +0 -22
- package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/types.d.ts +0 -61
- package/dist/parse-compose-code-DfZskSng.js +0 -352
- package/dist/parse-compose-code-v4J9BrUg.cjs +0 -1
- package/dist/utils-BlNqPAG8.cjs +0 -190
|
@@ -1,27 +1,172 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Vt = Object.defineProperty, Wt = Object.defineProperties;
|
|
2
|
+
var jt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ke = Object.getOwnPropertySymbols;
|
|
4
|
+
var Kt = Object.prototype.hasOwnProperty, Gt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Be = (e, t, r) => t in e ? Vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, y = (e, t) => {
|
|
6
6
|
for (var r in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
Kt.call(t, r) && Be(e, r, t[r]);
|
|
8
|
+
if (ke)
|
|
9
|
+
for (var r of ke(t))
|
|
10
|
+
Gt.call(t, r) && Be(e, r, t[r]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
import { f as
|
|
14
|
-
import { b as
|
|
15
|
-
import { cg as
|
|
16
|
-
import { i as
|
|
17
|
-
function
|
|
18
|
-
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i,
|
|
12
|
+
}, w = (e, t) => Wt(e, jt(t));
|
|
13
|
+
import { f as Yt, J as Jt } from "../types-D6jCGncV.js";
|
|
14
|
+
import { b as li, E as fi, a as di, i as mi, e as pi, d as gi } from "../types-D6jCGncV.js";
|
|
15
|
+
import { cg as Ht, bs as Qt, ch as Xt, ci as Zt, cj as er, aw as be, ck as tr, av as rr, cl as sr, bb as nr, ax as ir, cm as or, be as ar, bc as ur, aO as cr, ba as lr, bd as fr, d as dr, c as mr, k as pr, cn as gr, co as yr, cp as hr, cq as br, cr as Ar, cs as wr, ct as Fr, cu as Er, cv as Cr, cw as qr, cx as Tr, au as xr, cy as $r, cz as Sr, S as B, t as X, h as Or, b as $, al as _, ak as tt, cA as Dr, cB as Mr, cC as Nr, M as U, cD as Rr, cE as vr, aK as Ir, an as ze, am as Ae, cd as Pr, ce as kr, bP as rt, cF as st, ad as Br, cG as nt, cH as it, A as zr, cI as Lr, bG as Ur, aD as _r } from "../apply-styled-options-to-query-Bzt2GrgO.js";
|
|
16
|
+
import { i as Vr, b as Wr, D as jr, d as Kr, a as Gr } from "../dimensions-Ce2zWFrs.js";
|
|
17
|
+
function Yr(e, t) {
|
|
18
|
+
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, o) => Array.from({ length: s + 1 }, (a, u) => o === 0 ? u : u === 0 ? o : 0));
|
|
19
19
|
for (let i = 1; i <= r; i++)
|
|
20
|
-
for (let
|
|
21
|
-
n[i][
|
|
20
|
+
for (let o = 1; o <= s; o++)
|
|
21
|
+
n[i][o] = Math.min(n[i - 1][o] + 1, n[i][o - 1] + 1, n[i - 1][o - 1] + (e[i - 1] === t[o - 1] ? 0 : 1));
|
|
22
22
|
return n[r][s];
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
function we(e, t) {
|
|
25
|
+
const r = [];
|
|
26
|
+
let s = "", n = 0, i = !1, o = null;
|
|
27
|
+
for (let a = 0; a < e.length; a++) {
|
|
28
|
+
const u = e[a], c = e[a + 1];
|
|
29
|
+
if (i) {
|
|
30
|
+
if (u !== o) {
|
|
31
|
+
s += u;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (c === o) {
|
|
35
|
+
s += u + c, a++;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
i = !1, o = null, s += u;
|
|
39
|
+
continue;
|
|
40
|
+
} else {
|
|
41
|
+
if (u === "'" || u === '"') {
|
|
42
|
+
i = !0, o = u, s += u;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
46
|
+
r.push(s.trim()), s = "";
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
s += u;
|
|
51
|
+
}
|
|
52
|
+
return s.trim() && r.push(s.trim()), r;
|
|
53
|
+
}
|
|
54
|
+
function Jr(e, t) {
|
|
55
|
+
let r = 0, s = !1, n = null;
|
|
56
|
+
for (let i = 0; i < e.length; i++) {
|
|
57
|
+
const o = e[i], a = e[i + 1];
|
|
58
|
+
if (s) {
|
|
59
|
+
if (o !== n)
|
|
60
|
+
continue;
|
|
61
|
+
if (a === n) {
|
|
62
|
+
i++;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
s = !1, n = null;
|
|
66
|
+
} else {
|
|
67
|
+
if (o === "'" || o === '"') {
|
|
68
|
+
s = !0, n = o;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0)
|
|
72
|
+
return i;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return -1;
|
|
76
|
+
}
|
|
77
|
+
function Hr(e, t) {
|
|
78
|
+
if (e[t] !== "(")
|
|
79
|
+
return -1;
|
|
80
|
+
let r = 1, s = t + 1, n = !1, i = null;
|
|
81
|
+
for (; s < e.length; ) {
|
|
82
|
+
const o = e[s], a = e[s + 1];
|
|
83
|
+
if (n) {
|
|
84
|
+
if (o !== i) {
|
|
85
|
+
s++;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (a === i) {
|
|
89
|
+
s += 2;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
n = !1, i = null, s++;
|
|
93
|
+
} else {
|
|
94
|
+
if (o === "'" || o === '"') {
|
|
95
|
+
n = !0, i = o, s++;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && --r === 0)
|
|
99
|
+
return s;
|
|
100
|
+
s++;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return -1;
|
|
104
|
+
}
|
|
105
|
+
function Qr(e) {
|
|
106
|
+
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
107
|
+
}
|
|
108
|
+
function V(e) {
|
|
109
|
+
if (!e || typeof e != "string")
|
|
110
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
111
|
+
const t = e.trim();
|
|
112
|
+
if (!t)
|
|
113
|
+
throw new Error("Invalid composeCode: empty string");
|
|
114
|
+
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
115
|
+
if (!r)
|
|
116
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
117
|
+
const s = r[1], n = r[2], i = ot(n);
|
|
118
|
+
return {
|
|
119
|
+
function: s,
|
|
120
|
+
args: i
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function ot(e) {
|
|
124
|
+
return e.trim() ? we(e, ",").map(at) : [];
|
|
125
|
+
}
|
|
126
|
+
function at(e) {
|
|
127
|
+
if (!e)
|
|
128
|
+
throw new Error("Cannot parse empty argument value");
|
|
129
|
+
if (e === "null")
|
|
130
|
+
return null;
|
|
131
|
+
if (e === "undefined")
|
|
132
|
+
return;
|
|
133
|
+
if (e === "true")
|
|
134
|
+
return !0;
|
|
135
|
+
if (e === "false")
|
|
136
|
+
return !1;
|
|
137
|
+
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
138
|
+
return parseFloat(e);
|
|
139
|
+
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
140
|
+
const r = e[0];
|
|
141
|
+
return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
|
|
142
|
+
}
|
|
143
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
144
|
+
const r = e.slice(1, -1).trim();
|
|
145
|
+
if (!r)
|
|
146
|
+
return [];
|
|
147
|
+
const s = ot(r);
|
|
148
|
+
return s.every((n) => typeof n == "string"), s;
|
|
149
|
+
}
|
|
150
|
+
if (e.startsWith("{") && e.endsWith("}")) {
|
|
151
|
+
const r = e.slice(1, -1).trim();
|
|
152
|
+
return r ? Zr(r) : {};
|
|
153
|
+
}
|
|
154
|
+
return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
|
|
155
|
+
}
|
|
156
|
+
function Xr(e) {
|
|
157
|
+
const t = Jr(e, ":");
|
|
158
|
+
if (t === -1)
|
|
159
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
160
|
+
const r = Qr(e.slice(0, t).trim()), s = at(e.slice(t + 1).trim());
|
|
161
|
+
return [r, s];
|
|
162
|
+
}
|
|
163
|
+
function Zr(e) {
|
|
164
|
+
if (!e.trim())
|
|
165
|
+
return {};
|
|
166
|
+
const t = we(e, ",").map(Xr).filter(([, r]) => r !== null);
|
|
167
|
+
return Object.fromEntries(t);
|
|
168
|
+
}
|
|
169
|
+
class es {
|
|
25
170
|
constructor() {
|
|
26
171
|
this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
|
|
27
172
|
}
|
|
@@ -38,9 +183,9 @@ class Yr {
|
|
|
38
183
|
this.keyToValue.clear(), this.valueToKey.clear();
|
|
39
184
|
}
|
|
40
185
|
}
|
|
41
|
-
class
|
|
186
|
+
class ut {
|
|
42
187
|
constructor(t) {
|
|
43
|
-
this.generateIdentifier = t, this.kv = new
|
|
188
|
+
this.generateIdentifier = t, this.kv = new es();
|
|
44
189
|
}
|
|
45
190
|
register(t, r) {
|
|
46
191
|
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
@@ -55,7 +200,7 @@ class it {
|
|
|
55
200
|
return this.kv.getByKey(t);
|
|
56
201
|
}
|
|
57
202
|
}
|
|
58
|
-
class
|
|
203
|
+
class ts extends ut {
|
|
59
204
|
constructor() {
|
|
60
205
|
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
61
206
|
}
|
|
@@ -66,7 +211,7 @@ class Jr extends it {
|
|
|
66
211
|
return this.classToAllowedProps.get(t);
|
|
67
212
|
}
|
|
68
213
|
}
|
|
69
|
-
function
|
|
214
|
+
function rs(e) {
|
|
70
215
|
if ("values" in Object)
|
|
71
216
|
return Object.values(e);
|
|
72
217
|
const t = [];
|
|
@@ -74,8 +219,8 @@ function Hr(e) {
|
|
|
74
219
|
e.hasOwnProperty(r) && t.push(e[r]);
|
|
75
220
|
return t;
|
|
76
221
|
}
|
|
77
|
-
function
|
|
78
|
-
const r =
|
|
222
|
+
function ss(e, t) {
|
|
223
|
+
const r = rs(e);
|
|
79
224
|
if ("find" in r)
|
|
80
225
|
return r.find(t);
|
|
81
226
|
const s = r;
|
|
@@ -85,20 +230,20 @@ function Qr(e, t) {
|
|
|
85
230
|
return i;
|
|
86
231
|
}
|
|
87
232
|
}
|
|
88
|
-
function
|
|
233
|
+
function W(e, t) {
|
|
89
234
|
Object.entries(e).forEach(([r, s]) => t(s, r));
|
|
90
235
|
}
|
|
91
236
|
function ee(e, t) {
|
|
92
237
|
return e.indexOf(t) !== -1;
|
|
93
238
|
}
|
|
94
|
-
function
|
|
239
|
+
function Le(e, t) {
|
|
95
240
|
for (let r = 0; r < e.length; r++) {
|
|
96
241
|
const s = e[r];
|
|
97
242
|
if (t(s))
|
|
98
243
|
return s;
|
|
99
244
|
}
|
|
100
245
|
}
|
|
101
|
-
class
|
|
246
|
+
class ns {
|
|
102
247
|
constructor() {
|
|
103
248
|
this.transfomers = {};
|
|
104
249
|
}
|
|
@@ -106,13 +251,13 @@ class Xr {
|
|
|
106
251
|
this.transfomers[t.name] = t;
|
|
107
252
|
}
|
|
108
253
|
findApplicable(t) {
|
|
109
|
-
return
|
|
254
|
+
return ss(this.transfomers, (r) => r.isApplicable(t));
|
|
110
255
|
}
|
|
111
256
|
findByName(t) {
|
|
112
257
|
return this.transfomers[t];
|
|
113
258
|
}
|
|
114
259
|
}
|
|
115
|
-
const
|
|
260
|
+
const is = (e) => Object.prototype.toString.call(e).slice(8, -1), ct = (e) => typeof e == "undefined", os = (e) => e === null, G = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, de = (e) => G(e) && Object.keys(e).length === 0, I = (e) => Array.isArray(e), as = (e) => typeof e == "string", us = (e) => typeof e == "number" && !isNaN(e), cs = (e) => typeof e == "boolean", ls = (e) => e instanceof RegExp, Y = (e) => e instanceof Map, J = (e) => e instanceof Set, lt = (e) => is(e) === "Symbol", fs = (e) => e instanceof Date && !isNaN(e.valueOf()), ds = (e) => e instanceof Error, Ue = (e) => typeof e == "number" && isNaN(e), ms = (e) => cs(e) || os(e) || ct(e) || us(e) || as(e) || lt(e), ps = (e) => typeof e == "bigint", gs = (e) => e === 1 / 0 || e === -1 / 0, ys = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), hs = (e) => e instanceof URL, ft = (e) => e.replace(/\./g, "\\."), ae = (e) => e.map(String).map(ft).join("."), K = (e) => {
|
|
116
261
|
const t = [];
|
|
117
262
|
let r = "";
|
|
118
263
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -130,7 +275,7 @@ const Zr = (e) => Object.prototype.toString.call(e).slice(8, -1), at = (e) => ty
|
|
|
130
275
|
const s = r;
|
|
131
276
|
return t.push(s), t;
|
|
132
277
|
};
|
|
133
|
-
function
|
|
278
|
+
function v(e, t, r, s) {
|
|
134
279
|
return {
|
|
135
280
|
isApplicable: e,
|
|
136
281
|
annotation: t,
|
|
@@ -138,12 +283,12 @@ function R(e, t, r, s) {
|
|
|
138
283
|
untransform: s
|
|
139
284
|
};
|
|
140
285
|
}
|
|
141
|
-
const
|
|
142
|
-
|
|
286
|
+
const dt = [
|
|
287
|
+
v(ct, "undefined", () => null, () => {
|
|
143
288
|
}),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
289
|
+
v(ps, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
290
|
+
v(fs, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
291
|
+
v(ds, "Error", (e, t) => {
|
|
147
292
|
const r = {
|
|
148
293
|
name: e.name,
|
|
149
294
|
message: e.message
|
|
@@ -157,11 +302,11 @@ const lt = [
|
|
|
157
302
|
r[s] = e[s];
|
|
158
303
|
}), r;
|
|
159
304
|
}),
|
|
160
|
-
|
|
305
|
+
v(ls, "regexp", (e) => "" + e, (e) => {
|
|
161
306
|
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
162
307
|
return new RegExp(t, r);
|
|
163
308
|
}),
|
|
164
|
-
|
|
309
|
+
v(
|
|
165
310
|
J,
|
|
166
311
|
"set",
|
|
167
312
|
// (sets only exist in es6+)
|
|
@@ -169,10 +314,10 @@ const lt = [
|
|
|
169
314
|
(e) => [...e.values()],
|
|
170
315
|
(e) => new Set(e)
|
|
171
316
|
),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
317
|
+
v(Y, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
318
|
+
v((e) => Ue(e) || gs(e), "number", (e) => Ue(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
319
|
+
v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
320
|
+
v(hs, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
176
321
|
];
|
|
177
322
|
function se(e, t, r, s) {
|
|
178
323
|
return {
|
|
@@ -182,12 +327,12 @@ function se(e, t, r, s) {
|
|
|
182
327
|
untransform: s
|
|
183
328
|
};
|
|
184
329
|
}
|
|
185
|
-
const
|
|
330
|
+
const mt = se((e, t) => lt(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
186
331
|
const s = r.symbolRegistry.getValue(t[1]);
|
|
187
332
|
if (!s)
|
|
188
333
|
throw new Error("Trying to deserialize unknown symbol");
|
|
189
334
|
return s;
|
|
190
|
-
}),
|
|
335
|
+
}), bs = [
|
|
191
336
|
Int8Array,
|
|
192
337
|
Uint8Array,
|
|
193
338
|
Int16Array,
|
|
@@ -197,16 +342,16 @@ const ct = se((e, t) => ot(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t)
|
|
|
197
342
|
Float32Array,
|
|
198
343
|
Float64Array,
|
|
199
344
|
Uint8ClampedArray
|
|
200
|
-
].reduce((e, t) => (e[t.name] = t, e), {}),
|
|
201
|
-
const r =
|
|
345
|
+
].reduce((e, t) => (e[t.name] = t, e), {}), pt = se(ys, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
346
|
+
const r = bs[t[1]];
|
|
202
347
|
if (!r)
|
|
203
348
|
throw new Error("Trying to deserialize unknown typed array");
|
|
204
349
|
return new r(e);
|
|
205
350
|
});
|
|
206
|
-
function
|
|
351
|
+
function gt(e, t) {
|
|
207
352
|
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
|
|
208
353
|
}
|
|
209
|
-
const
|
|
354
|
+
const yt = se(gt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
210
355
|
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
211
356
|
if (!r)
|
|
212
357
|
return y({}, e);
|
|
@@ -219,44 +364,44 @@ const mt = se(dt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructo
|
|
|
219
364
|
if (!s)
|
|
220
365
|
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
221
366
|
return Object.assign(Object.create(s.prototype), e);
|
|
222
|
-
}),
|
|
367
|
+
}), ht = se((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, r) => {
|
|
223
368
|
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
224
369
|
if (!s)
|
|
225
370
|
throw new Error("Trying to deserialize unknown custom value");
|
|
226
371
|
return s.deserialize(e);
|
|
227
|
-
}),
|
|
228
|
-
const r =
|
|
372
|
+
}), As = [yt, mt, ht, pt], _e = (e, t) => {
|
|
373
|
+
const r = Le(As, (n) => n.isApplicable(e, t));
|
|
229
374
|
if (r)
|
|
230
375
|
return {
|
|
231
376
|
value: r.transform(e, t),
|
|
232
377
|
type: r.annotation(e, t)
|
|
233
378
|
};
|
|
234
|
-
const s =
|
|
379
|
+
const s = Le(dt, (n) => n.isApplicable(e, t));
|
|
235
380
|
if (s)
|
|
236
381
|
return {
|
|
237
382
|
value: s.transform(e, t),
|
|
238
383
|
type: s.annotation
|
|
239
384
|
};
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
|
|
385
|
+
}, bt = {};
|
|
386
|
+
dt.forEach((e) => {
|
|
387
|
+
bt[e.annotation] = e;
|
|
243
388
|
});
|
|
244
|
-
const
|
|
389
|
+
const ws = (e, t, r) => {
|
|
245
390
|
if (I(t))
|
|
246
391
|
switch (t[0]) {
|
|
247
392
|
case "symbol":
|
|
248
|
-
return ct.untransform(e, t, r);
|
|
249
|
-
case "class":
|
|
250
393
|
return mt.untransform(e, t, r);
|
|
394
|
+
case "class":
|
|
395
|
+
return yt.untransform(e, t, r);
|
|
251
396
|
case "custom":
|
|
252
|
-
return
|
|
397
|
+
return ht.untransform(e, t, r);
|
|
253
398
|
case "typed-array":
|
|
254
|
-
return
|
|
399
|
+
return pt.untransform(e, t, r);
|
|
255
400
|
default:
|
|
256
401
|
throw new Error("Unknown transformation: " + t);
|
|
257
402
|
}
|
|
258
403
|
else {
|
|
259
|
-
const s =
|
|
404
|
+
const s = bt[t];
|
|
260
405
|
if (!s)
|
|
261
406
|
throw new Error("Unknown transformation: " + t);
|
|
262
407
|
return s.untransform(e, r);
|
|
@@ -269,7 +414,7 @@ const ps = (e, t, r) => {
|
|
|
269
414
|
r.next(), t--;
|
|
270
415
|
return r.next().value;
|
|
271
416
|
};
|
|
272
|
-
function
|
|
417
|
+
function At(e) {
|
|
273
418
|
if (ee(e, "__proto__"))
|
|
274
419
|
throw new Error("__proto__ is not allowed as a property");
|
|
275
420
|
if (ee(e, "prototype"))
|
|
@@ -277,20 +422,20 @@ function yt(e) {
|
|
|
277
422
|
if (ee(e, "constructor"))
|
|
278
423
|
throw new Error("constructor is not allowed as a property");
|
|
279
424
|
}
|
|
280
|
-
const
|
|
281
|
-
|
|
425
|
+
const Fs = (e, t) => {
|
|
426
|
+
At(t);
|
|
282
427
|
for (let r = 0; r < t.length; r++) {
|
|
283
428
|
const s = t[r];
|
|
284
429
|
if (J(e))
|
|
285
430
|
e = L(e, +s);
|
|
286
431
|
else if (Y(e)) {
|
|
287
|
-
const n = +s, i = +t[++r] == 0 ? "key" : "value",
|
|
432
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", o = L(e, n);
|
|
288
433
|
switch (i) {
|
|
289
434
|
case "key":
|
|
290
|
-
e =
|
|
435
|
+
e = o;
|
|
291
436
|
break;
|
|
292
437
|
case "value":
|
|
293
|
-
e = e.get(
|
|
438
|
+
e = e.get(o);
|
|
294
439
|
break;
|
|
295
440
|
}
|
|
296
441
|
} else
|
|
@@ -298,24 +443,24 @@ const gs = (e, t) => {
|
|
|
298
443
|
}
|
|
299
444
|
return e;
|
|
300
445
|
}, me = (e, t, r) => {
|
|
301
|
-
if (
|
|
446
|
+
if (At(t), t.length === 0)
|
|
302
447
|
return r(e);
|
|
303
448
|
let s = e;
|
|
304
449
|
for (let i = 0; i < t.length - 1; i++) {
|
|
305
|
-
const
|
|
450
|
+
const o = t[i];
|
|
306
451
|
if (I(s)) {
|
|
307
|
-
const
|
|
308
|
-
s = s[o];
|
|
309
|
-
} else if (G(s))
|
|
452
|
+
const a = +o;
|
|
310
453
|
s = s[a];
|
|
454
|
+
} else if (G(s))
|
|
455
|
+
s = s[o];
|
|
311
456
|
else if (J(s)) {
|
|
312
|
-
const
|
|
313
|
-
s = L(s,
|
|
457
|
+
const a = +o;
|
|
458
|
+
s = L(s, a);
|
|
314
459
|
} else if (Y(s)) {
|
|
315
460
|
if (i === t.length - 2)
|
|
316
461
|
break;
|
|
317
|
-
const u = +
|
|
318
|
-
switch (
|
|
462
|
+
const u = +o, c = +t[++i] == 0 ? "key" : "value", p = L(s, u);
|
|
463
|
+
switch (c) {
|
|
319
464
|
case "key":
|
|
320
465
|
s = p;
|
|
321
466
|
break;
|
|
@@ -327,19 +472,19 @@ const gs = (e, t) => {
|
|
|
327
472
|
}
|
|
328
473
|
const n = t[t.length - 1];
|
|
329
474
|
if (I(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J(s)) {
|
|
330
|
-
const i = L(s, +n),
|
|
331
|
-
i !==
|
|
475
|
+
const i = L(s, +n), o = r(i);
|
|
476
|
+
i !== o && (s.delete(i), s.add(o));
|
|
332
477
|
}
|
|
333
478
|
if (Y(s)) {
|
|
334
|
-
const i = +t[t.length - 2],
|
|
479
|
+
const i = +t[t.length - 2], o = L(s, i);
|
|
335
480
|
switch (+n == 0 ? "key" : "value") {
|
|
336
481
|
case "key": {
|
|
337
|
-
const u = r(
|
|
338
|
-
s.set(u, s.get(
|
|
482
|
+
const u = r(o);
|
|
483
|
+
s.set(u, s.get(o)), u !== o && s.delete(o);
|
|
339
484
|
break;
|
|
340
485
|
}
|
|
341
486
|
case "value": {
|
|
342
|
-
s.set(
|
|
487
|
+
s.set(o, r(s.get(o)));
|
|
343
488
|
break;
|
|
344
489
|
}
|
|
345
490
|
}
|
|
@@ -350,106 +495,106 @@ function pe(e, t, r = []) {
|
|
|
350
495
|
if (!e)
|
|
351
496
|
return;
|
|
352
497
|
if (!I(e)) {
|
|
353
|
-
|
|
498
|
+
W(e, (i, o) => pe(i, t, [...r, ...K(o)]));
|
|
354
499
|
return;
|
|
355
500
|
}
|
|
356
501
|
const [s, n] = e;
|
|
357
|
-
n &&
|
|
358
|
-
pe(i, t, [...r, ...
|
|
502
|
+
n && W(n, (i, o) => {
|
|
503
|
+
pe(i, t, [...r, ...K(o)]);
|
|
359
504
|
}), t(s, r);
|
|
360
505
|
}
|
|
361
|
-
function
|
|
506
|
+
function Es(e, t, r) {
|
|
362
507
|
return pe(t, (s, n) => {
|
|
363
|
-
e = me(e, n, (i) =>
|
|
508
|
+
e = me(e, n, (i) => ws(i, s, r));
|
|
364
509
|
}), e;
|
|
365
510
|
}
|
|
366
|
-
function
|
|
511
|
+
function Cs(e, t) {
|
|
367
512
|
function r(s, n) {
|
|
368
|
-
const i =
|
|
369
|
-
s.map(
|
|
370
|
-
e = me(e,
|
|
513
|
+
const i = Fs(e, K(n));
|
|
514
|
+
s.map(K).forEach((o) => {
|
|
515
|
+
e = me(e, o, () => i);
|
|
371
516
|
});
|
|
372
517
|
}
|
|
373
518
|
if (I(t)) {
|
|
374
519
|
const [s, n] = t;
|
|
375
520
|
s.forEach((i) => {
|
|
376
|
-
e = me(e,
|
|
377
|
-
}), n &&
|
|
521
|
+
e = me(e, K(i), () => e);
|
|
522
|
+
}), n && W(n, r);
|
|
378
523
|
} else
|
|
379
|
-
|
|
524
|
+
W(t, r);
|
|
380
525
|
return e;
|
|
381
526
|
}
|
|
382
|
-
const
|
|
383
|
-
function
|
|
527
|
+
const qs = (e, t) => G(e) || I(e) || Y(e) || J(e) || gt(e, t);
|
|
528
|
+
function Ts(e, t, r) {
|
|
384
529
|
const s = r.get(e);
|
|
385
530
|
s ? s.push(t) : r.set(e, [t]);
|
|
386
531
|
}
|
|
387
|
-
function
|
|
532
|
+
function xs(e, t) {
|
|
388
533
|
const r = {};
|
|
389
534
|
let s;
|
|
390
535
|
return e.forEach((n) => {
|
|
391
536
|
if (n.length <= 1)
|
|
392
537
|
return;
|
|
393
|
-
t || (n = n.map((
|
|
394
|
-
const [i, ...
|
|
395
|
-
i.length === 0 ? s =
|
|
538
|
+
t || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
|
|
539
|
+
const [i, ...o] = n;
|
|
540
|
+
i.length === 0 ? s = o.map(ae) : r[ae(i)] = o.map(ae);
|
|
396
541
|
}), s ? de(r) ? [s] : [s, r] : de(r) ? void 0 : r;
|
|
397
542
|
}
|
|
398
|
-
const
|
|
543
|
+
const wt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map()) => {
|
|
399
544
|
var b;
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
402
|
-
|
|
403
|
-
const g =
|
|
545
|
+
const a = ms(e);
|
|
546
|
+
if (!a) {
|
|
547
|
+
Ts(e, n, t);
|
|
548
|
+
const g = o.get(e);
|
|
404
549
|
if (g)
|
|
405
550
|
return s ? {
|
|
406
551
|
transformedValue: null
|
|
407
552
|
} : g;
|
|
408
553
|
}
|
|
409
|
-
if (!
|
|
410
|
-
const g =
|
|
554
|
+
if (!qs(e, r)) {
|
|
555
|
+
const g = _e(e, r), m = g ? {
|
|
411
556
|
transformedValue: g.value,
|
|
412
557
|
annotations: [g.type]
|
|
413
558
|
} : {
|
|
414
559
|
transformedValue: e
|
|
415
560
|
};
|
|
416
|
-
return
|
|
561
|
+
return a || o.set(e, m), m;
|
|
417
562
|
}
|
|
418
563
|
if (ee(i, e))
|
|
419
564
|
return {
|
|
420
565
|
transformedValue: null
|
|
421
566
|
};
|
|
422
|
-
const u =
|
|
423
|
-
|
|
567
|
+
const u = _e(e, r), c = (b = u == null ? void 0 : u.value) != null ? b : e, p = I(c) ? [] : {}, l = {};
|
|
568
|
+
W(c, (g, m) => {
|
|
424
569
|
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
425
570
|
throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);
|
|
426
|
-
const
|
|
427
|
-
p[m] =
|
|
428
|
-
|
|
571
|
+
const A = wt(g, t, r, s, [...n, m], [...i, e], o);
|
|
572
|
+
p[m] = A.transformedValue, I(A.annotations) ? l[m] = A.annotations : G(A.annotations) && W(A.annotations, (C, N) => {
|
|
573
|
+
l[ft(m) + "." + N] = C;
|
|
429
574
|
});
|
|
430
575
|
});
|
|
431
|
-
const d = de(
|
|
576
|
+
const d = de(l) ? {
|
|
432
577
|
transformedValue: p,
|
|
433
578
|
annotations: u ? [u.type] : void 0
|
|
434
579
|
} : {
|
|
435
580
|
transformedValue: p,
|
|
436
|
-
annotations: u ? [u.type,
|
|
581
|
+
annotations: u ? [u.type, l] : l
|
|
437
582
|
};
|
|
438
|
-
return
|
|
583
|
+
return a || o.set(e, d), d;
|
|
439
584
|
};
|
|
440
|
-
function
|
|
585
|
+
function Ft(e) {
|
|
441
586
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
442
587
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
588
|
+
function Ve(e) {
|
|
589
|
+
return Ft(e) === "Array";
|
|
445
590
|
}
|
|
446
|
-
function
|
|
447
|
-
if (
|
|
591
|
+
function $s(e) {
|
|
592
|
+
if (Ft(e) !== "Object")
|
|
448
593
|
return !1;
|
|
449
594
|
const t = Object.getPrototypeOf(e);
|
|
450
595
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
451
596
|
}
|
|
452
|
-
function
|
|
597
|
+
function Ss(e, t, r, s, n) {
|
|
453
598
|
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
454
599
|
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
455
600
|
value: r,
|
|
@@ -459,16 +604,16 @@ function Es(e, t, r, s, n) {
|
|
|
459
604
|
});
|
|
460
605
|
}
|
|
461
606
|
function ge(e, t = {}) {
|
|
462
|
-
if (
|
|
607
|
+
if (Ve(e))
|
|
463
608
|
return e.map((n) => ge(n, t));
|
|
464
|
-
if (
|
|
609
|
+
if (!$s(e))
|
|
465
610
|
return e;
|
|
466
611
|
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
467
612
|
return [...r, ...s].reduce((n, i) => {
|
|
468
|
-
if (
|
|
613
|
+
if (Ve(t.props) && !t.props.includes(i))
|
|
469
614
|
return n;
|
|
470
|
-
const
|
|
471
|
-
return
|
|
615
|
+
const o = e[i], a = ge(o, t);
|
|
616
|
+
return Ss(n, i, a, e, t.nonenumerable), n;
|
|
472
617
|
}, {});
|
|
473
618
|
}
|
|
474
619
|
class h {
|
|
@@ -476,27 +621,27 @@ class h {
|
|
|
476
621
|
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
477
622
|
*/
|
|
478
623
|
constructor({ dedupe: t = !1 } = {}) {
|
|
479
|
-
this.classRegistry = new
|
|
624
|
+
this.classRegistry = new ts(), this.symbolRegistry = new ut((r) => {
|
|
480
625
|
var s;
|
|
481
626
|
return (s = r.description) != null ? s : "";
|
|
482
|
-
}), this.customTransformerRegistry = new
|
|
627
|
+
}), this.customTransformerRegistry = new ns(), this.allowedErrorProps = [], this.dedupe = t;
|
|
483
628
|
}
|
|
484
629
|
serialize(t) {
|
|
485
|
-
const r = /* @__PURE__ */ new Map(), s =
|
|
630
|
+
const r = /* @__PURE__ */ new Map(), s = wt(t, r, this, this.dedupe), n = {
|
|
486
631
|
json: s.transformedValue
|
|
487
632
|
};
|
|
488
|
-
s.annotations && (n.meta =
|
|
633
|
+
s.annotations && (n.meta = w(y({}, n.meta), {
|
|
489
634
|
values: s.annotations
|
|
490
635
|
}));
|
|
491
|
-
const i =
|
|
492
|
-
return i && (n.meta =
|
|
636
|
+
const i = xs(r, this.dedupe);
|
|
637
|
+
return i && (n.meta = w(y({}, n.meta), {
|
|
493
638
|
referentialEqualities: i
|
|
494
639
|
})), n;
|
|
495
640
|
}
|
|
496
641
|
deserialize(t) {
|
|
497
642
|
const { json: r, meta: s } = t;
|
|
498
643
|
let n = ge(r);
|
|
499
|
-
return s != null && s.values && (n =
|
|
644
|
+
return s != null && s.values && (n = Es(n, s.values, this)), s != null && s.referentialEqualities && (n = Cs(n, s.referentialEqualities)), n;
|
|
500
645
|
}
|
|
501
646
|
stringify(t) {
|
|
502
647
|
return JSON.stringify(this.serialize(t));
|
|
@@ -528,7 +673,7 @@ h.registerClass = h.defaultInstance.registerClass.bind(h.defaultInstance);
|
|
|
528
673
|
h.registerSymbol = h.defaultInstance.registerSymbol.bind(h.defaultInstance);
|
|
529
674
|
h.registerCustom = h.defaultInstance.registerCustom.bind(h.defaultInstance);
|
|
530
675
|
h.allowErrorProps = h.defaultInstance.allowErrorProps.bind(h.defaultInstance);
|
|
531
|
-
const z = (e) => e === void 0 ? B.None : e,
|
|
676
|
+
const z = (e) => e === void 0 ? B.None : e, Os = (e) => new Jt(e.metadataItem, e.type), Fe = (e) => new dr(
|
|
532
677
|
e.name,
|
|
533
678
|
e.expression,
|
|
534
679
|
e.type,
|
|
@@ -536,7 +681,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
536
681
|
z(e.sort),
|
|
537
682
|
e.dataSource,
|
|
538
683
|
e.composeCode
|
|
539
|
-
),
|
|
684
|
+
), Ee = (e) => new mr(
|
|
540
685
|
e.name,
|
|
541
686
|
e.expression,
|
|
542
687
|
e.granularity,
|
|
@@ -548,24 +693,24 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
548
693
|
), O = (e) => {
|
|
549
694
|
switch (e.__serializable) {
|
|
550
695
|
case "DimensionalAttribute":
|
|
551
|
-
return
|
|
696
|
+
return Fe(e);
|
|
552
697
|
case "DimensionalLevelAttribute":
|
|
553
|
-
return
|
|
698
|
+
return Ee(e);
|
|
554
699
|
default:
|
|
555
700
|
return e;
|
|
556
701
|
}
|
|
557
|
-
},
|
|
702
|
+
}, Et = (e) => new jr(
|
|
558
703
|
e.name,
|
|
559
704
|
e.expression,
|
|
560
705
|
e.attributes.map(O),
|
|
561
|
-
e.dimensions.map(
|
|
706
|
+
e.dimensions.map(Ds),
|
|
562
707
|
e.type,
|
|
563
708
|
e.description,
|
|
564
709
|
z(e.sort),
|
|
565
710
|
e.dataSource,
|
|
566
711
|
e.composeCode,
|
|
567
712
|
e.defaultAttribute ? O(e.defaultAttribute) : void 0
|
|
568
|
-
),
|
|
713
|
+
), Ct = (e) => new Kr(
|
|
569
714
|
e.name,
|
|
570
715
|
e.expression,
|
|
571
716
|
e.description,
|
|
@@ -574,16 +719,16 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
574
719
|
e.composeCode,
|
|
575
720
|
e.indexed,
|
|
576
721
|
e.merged
|
|
577
|
-
),
|
|
722
|
+
), Ds = (e) => {
|
|
578
723
|
switch (e.__serializable) {
|
|
579
724
|
case "DimensionalDimension":
|
|
580
|
-
return
|
|
725
|
+
return Et(e);
|
|
581
726
|
case "DimensionalDateDimension":
|
|
582
|
-
return
|
|
727
|
+
return Ct(e);
|
|
583
728
|
default:
|
|
584
729
|
return e;
|
|
585
730
|
}
|
|
586
|
-
},
|
|
731
|
+
}, Ce = (e) => new pr(
|
|
587
732
|
e.name,
|
|
588
733
|
O(e.attribute),
|
|
589
734
|
e.aggregation,
|
|
@@ -592,26 +737,26 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
592
737
|
z(e.sort),
|
|
593
738
|
e.dataSource,
|
|
594
739
|
e.composeCode
|
|
595
|
-
),
|
|
740
|
+
), qe = (e) => {
|
|
596
741
|
const t = Object.fromEntries(
|
|
597
742
|
Object.entries(e.context).map(([r, s]) => {
|
|
598
743
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
599
744
|
switch (s.__serializable) {
|
|
600
745
|
case "DimensionalAttribute":
|
|
601
|
-
return [r,
|
|
746
|
+
return [r, Fe(s)];
|
|
602
747
|
case "DimensionalLevelAttribute":
|
|
603
|
-
return [r, we(s)];
|
|
604
|
-
case "DimensionalBaseMeasure":
|
|
605
748
|
return [r, Ee(s)];
|
|
606
|
-
case "
|
|
749
|
+
case "DimensionalBaseMeasure":
|
|
607
750
|
return [r, Ce(s)];
|
|
751
|
+
case "DimensionalCalculatedMeasure":
|
|
752
|
+
return [r, qe(s)];
|
|
608
753
|
default:
|
|
609
754
|
return [r, s];
|
|
610
755
|
}
|
|
611
756
|
return [r, s];
|
|
612
757
|
})
|
|
613
758
|
);
|
|
614
|
-
return new
|
|
759
|
+
return new gr(
|
|
615
760
|
e.name,
|
|
616
761
|
e.expression,
|
|
617
762
|
t,
|
|
@@ -621,7 +766,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
621
766
|
e.dataSource,
|
|
622
767
|
e.composeCode
|
|
623
768
|
);
|
|
624
|
-
},
|
|
769
|
+
}, qt = (e) => new yr(
|
|
625
770
|
e.name,
|
|
626
771
|
O(e.attribute),
|
|
627
772
|
e.format,
|
|
@@ -632,45 +777,45 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
632
777
|
), ue = (e) => {
|
|
633
778
|
switch (e.__serializable) {
|
|
634
779
|
case "DimensionalBaseMeasure":
|
|
635
|
-
return Ee(e);
|
|
636
|
-
case "DimensionalCalculatedMeasure":
|
|
637
780
|
return Ce(e);
|
|
781
|
+
case "DimensionalCalculatedMeasure":
|
|
782
|
+
return qe(e);
|
|
638
783
|
case "DimensionalMeasureTemplate":
|
|
639
|
-
return
|
|
784
|
+
return qt(e);
|
|
640
785
|
default:
|
|
641
786
|
return e;
|
|
642
787
|
}
|
|
643
|
-
},
|
|
788
|
+
}, q = (e) => {
|
|
644
789
|
switch (e.__serializable) {
|
|
645
790
|
case "MembersFilter":
|
|
646
|
-
return new
|
|
791
|
+
return new Sr(
|
|
647
792
|
O(e.attribute),
|
|
648
793
|
e.members,
|
|
649
|
-
e.config.backgroundFilter ?
|
|
794
|
+
e.config.backgroundFilter ? w(y({}, e.config), { backgroundFilter: q(e.config.backgroundFilter) }) : e.config,
|
|
650
795
|
e.composeCode
|
|
651
796
|
);
|
|
652
797
|
case "LogicalAttributeFilter":
|
|
653
|
-
return new
|
|
654
|
-
e.filters.map((r) =>
|
|
798
|
+
return new $r(
|
|
799
|
+
e.filters.map((r) => q(r)),
|
|
655
800
|
e.operator,
|
|
656
801
|
e.config,
|
|
657
802
|
e.composeCode
|
|
658
803
|
);
|
|
659
804
|
case "CascadingFilter":
|
|
660
|
-
return new
|
|
661
|
-
e._filters.map((r) =>
|
|
805
|
+
return new xr(
|
|
806
|
+
e._filters.map((r) => q(r)),
|
|
662
807
|
e.config,
|
|
663
808
|
e.composeCode
|
|
664
809
|
);
|
|
665
810
|
case "ExcludeFilter":
|
|
666
|
-
return new
|
|
667
|
-
|
|
668
|
-
e.input ?
|
|
811
|
+
return new Tr(
|
|
812
|
+
q(e.filter),
|
|
813
|
+
e.input ? q(e.input) : void 0,
|
|
669
814
|
e.config,
|
|
670
815
|
e.composeCode
|
|
671
816
|
);
|
|
672
817
|
case "MeasureFilter":
|
|
673
|
-
return new
|
|
818
|
+
return new qr(
|
|
674
819
|
O(e.attribute),
|
|
675
820
|
ue(e.measure),
|
|
676
821
|
e.operatorA,
|
|
@@ -681,7 +826,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
681
826
|
e.composeCode
|
|
682
827
|
);
|
|
683
828
|
case "RankingFilter":
|
|
684
|
-
return new
|
|
829
|
+
return new Cr(
|
|
685
830
|
O(e.attribute),
|
|
686
831
|
ue(e.measure),
|
|
687
832
|
e.operator,
|
|
@@ -690,7 +835,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
690
835
|
e.composeCode
|
|
691
836
|
);
|
|
692
837
|
case "MeasureRankingFilter":
|
|
693
|
-
return new
|
|
838
|
+
return new Er(
|
|
694
839
|
ue(e.measure),
|
|
695
840
|
e.operator,
|
|
696
841
|
e.count,
|
|
@@ -698,7 +843,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
698
843
|
e.composeCode
|
|
699
844
|
);
|
|
700
845
|
case "NumericFilter":
|
|
701
|
-
return new
|
|
846
|
+
return new Fr(
|
|
702
847
|
O(e.attribute),
|
|
703
848
|
e.operatorA,
|
|
704
849
|
e.valueA,
|
|
@@ -708,7 +853,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
708
853
|
e.composeCode
|
|
709
854
|
);
|
|
710
855
|
case "TextFilter":
|
|
711
|
-
return new
|
|
856
|
+
return new wr(
|
|
712
857
|
O(e.attribute),
|
|
713
858
|
e.operatorA,
|
|
714
859
|
e.valueA,
|
|
@@ -717,7 +862,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
717
862
|
);
|
|
718
863
|
case "DateRangeFilter": {
|
|
719
864
|
const { valueA: r, valueB: s } = e;
|
|
720
|
-
return new
|
|
865
|
+
return new Ar(
|
|
721
866
|
O(e.attribute),
|
|
722
867
|
r,
|
|
723
868
|
s,
|
|
@@ -726,7 +871,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
726
871
|
);
|
|
727
872
|
}
|
|
728
873
|
case "RelativeDateFilter":
|
|
729
|
-
return new
|
|
874
|
+
return new br(
|
|
730
875
|
O(e.attribute),
|
|
731
876
|
e.offset,
|
|
732
877
|
e.count,
|
|
@@ -736,7 +881,7 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
736
881
|
e.composeCode
|
|
737
882
|
);
|
|
738
883
|
case "CustomFilter":
|
|
739
|
-
return new
|
|
884
|
+
return new hr(
|
|
740
885
|
O(e.attribute),
|
|
741
886
|
e.jaqlExpression,
|
|
742
887
|
e.config,
|
|
@@ -748,65 +893,65 @@ const z = (e) => e === void 0 ? B.None : e, Cs = (e) => new Kt(e.metadataItem, e
|
|
|
748
893
|
};
|
|
749
894
|
h.registerCustom(
|
|
750
895
|
{
|
|
751
|
-
isApplicable:
|
|
896
|
+
isApplicable: Yt,
|
|
752
897
|
serialize: (e) => e.serialize(),
|
|
753
|
-
deserialize: (e) =>
|
|
898
|
+
deserialize: (e) => Os(e)
|
|
754
899
|
},
|
|
755
900
|
"JaqlElement"
|
|
756
901
|
);
|
|
757
902
|
h.registerCustom(
|
|
758
903
|
{
|
|
759
|
-
isApplicable:
|
|
904
|
+
isApplicable: Ht,
|
|
760
905
|
serialize: (e) => e.serialize(),
|
|
761
|
-
deserialize: (e) =>
|
|
906
|
+
deserialize: (e) => Fe(e)
|
|
762
907
|
},
|
|
763
908
|
"DimensionalAttribute"
|
|
764
909
|
);
|
|
765
910
|
h.registerCustom(
|
|
766
911
|
{
|
|
767
|
-
isApplicable:
|
|
912
|
+
isApplicable: Qt,
|
|
768
913
|
serialize: (e) => e.serialize(),
|
|
769
|
-
deserialize: (e) =>
|
|
914
|
+
deserialize: (e) => Ee(e)
|
|
770
915
|
},
|
|
771
916
|
"DimensionalLevelAttribute"
|
|
772
917
|
);
|
|
773
918
|
h.registerCustom(
|
|
774
919
|
{
|
|
775
|
-
isApplicable:
|
|
920
|
+
isApplicable: Vr,
|
|
776
921
|
serialize: (e) => e.serialize(),
|
|
777
|
-
deserialize: (e) =>
|
|
922
|
+
deserialize: (e) => Et(e)
|
|
778
923
|
},
|
|
779
924
|
"DimensionalDimension"
|
|
780
925
|
);
|
|
781
926
|
h.registerCustom(
|
|
782
927
|
{
|
|
783
|
-
isApplicable:
|
|
928
|
+
isApplicable: Wr,
|
|
784
929
|
serialize: (e) => e.serialize(),
|
|
785
|
-
deserialize: (e) =>
|
|
930
|
+
deserialize: (e) => Ct(e)
|
|
786
931
|
},
|
|
787
932
|
"DimensionalDateDimension"
|
|
788
933
|
);
|
|
789
934
|
h.registerCustom(
|
|
790
935
|
{
|
|
791
|
-
isApplicable:
|
|
936
|
+
isApplicable: Xt,
|
|
792
937
|
serialize: (e) => e.serialize(),
|
|
793
|
-
deserialize: (e) =>
|
|
938
|
+
deserialize: (e) => Ce(e)
|
|
794
939
|
},
|
|
795
940
|
"DimensionalBaseMeasure"
|
|
796
941
|
);
|
|
797
942
|
h.registerCustom(
|
|
798
943
|
{
|
|
799
|
-
isApplicable:
|
|
944
|
+
isApplicable: Zt,
|
|
800
945
|
serialize: (e) => e.serialize(),
|
|
801
|
-
deserialize: (e) =>
|
|
946
|
+
deserialize: (e) => qe(e)
|
|
802
947
|
},
|
|
803
948
|
"DimensionalCalculatedMeasure"
|
|
804
949
|
);
|
|
805
950
|
h.registerCustom(
|
|
806
951
|
{
|
|
807
|
-
isApplicable:
|
|
952
|
+
isApplicable: er,
|
|
808
953
|
serialize: (e) => e.serialize(),
|
|
809
|
-
deserialize: (e) =>
|
|
954
|
+
deserialize: (e) => qt(e)
|
|
810
955
|
},
|
|
811
956
|
"DimensionalMeasureTemplate"
|
|
812
957
|
);
|
|
@@ -814,107 +959,107 @@ h.registerCustom(
|
|
|
814
959
|
{
|
|
815
960
|
isApplicable: be,
|
|
816
961
|
serialize: (e) => e.serialize(),
|
|
817
|
-
deserialize: (e) =>
|
|
962
|
+
deserialize: (e) => q(e)
|
|
818
963
|
},
|
|
819
964
|
"MembersFilter"
|
|
820
965
|
);
|
|
821
966
|
h.registerCustom(
|
|
822
967
|
{
|
|
823
|
-
isApplicable:
|
|
968
|
+
isApplicable: tr,
|
|
824
969
|
serialize: (e) => e.serialize(),
|
|
825
|
-
deserialize: (e) =>
|
|
970
|
+
deserialize: (e) => q(e)
|
|
826
971
|
},
|
|
827
972
|
"LogicalAttributeFilter"
|
|
828
973
|
);
|
|
829
974
|
h.registerCustom(
|
|
830
975
|
{
|
|
831
|
-
isApplicable:
|
|
976
|
+
isApplicable: rr,
|
|
832
977
|
serialize: (e) => e.serialize(),
|
|
833
|
-
deserialize: (e) =>
|
|
978
|
+
deserialize: (e) => q(e)
|
|
834
979
|
},
|
|
835
980
|
"CascadingFilter"
|
|
836
981
|
);
|
|
837
982
|
h.registerCustom(
|
|
838
983
|
{
|
|
839
|
-
isApplicable:
|
|
984
|
+
isApplicable: sr,
|
|
840
985
|
serialize: (e) => e.serialize(),
|
|
841
|
-
deserialize: (e) =>
|
|
986
|
+
deserialize: (e) => q(e)
|
|
842
987
|
},
|
|
843
988
|
"ExcludeFilter"
|
|
844
989
|
);
|
|
845
990
|
h.registerCustom(
|
|
846
991
|
{
|
|
847
|
-
isApplicable:
|
|
992
|
+
isApplicable: nr,
|
|
848
993
|
serialize: (e) => e.serialize(),
|
|
849
|
-
deserialize: (e) =>
|
|
994
|
+
deserialize: (e) => q(e)
|
|
850
995
|
},
|
|
851
996
|
"MeasureFilter"
|
|
852
997
|
);
|
|
853
998
|
h.registerCustom(
|
|
854
999
|
{
|
|
855
|
-
isApplicable:
|
|
1000
|
+
isApplicable: ir,
|
|
856
1001
|
serialize: (e) => e.serialize(),
|
|
857
|
-
deserialize: (e) =>
|
|
1002
|
+
deserialize: (e) => q(e)
|
|
858
1003
|
},
|
|
859
1004
|
"RankingFilter"
|
|
860
1005
|
);
|
|
861
1006
|
h.registerCustom(
|
|
862
1007
|
{
|
|
863
|
-
isApplicable:
|
|
1008
|
+
isApplicable: or,
|
|
864
1009
|
serialize: (e) => e.serialize(),
|
|
865
|
-
deserialize: (e) =>
|
|
1010
|
+
deserialize: (e) => q(e)
|
|
866
1011
|
},
|
|
867
1012
|
"MeasureRankingFilter"
|
|
868
1013
|
);
|
|
869
1014
|
h.registerCustom(
|
|
870
1015
|
{
|
|
871
|
-
isApplicable:
|
|
1016
|
+
isApplicable: ar,
|
|
872
1017
|
serialize: (e) => e.serialize(),
|
|
873
|
-
deserialize: (e) =>
|
|
1018
|
+
deserialize: (e) => q(e)
|
|
874
1019
|
},
|
|
875
1020
|
"NumericFilter"
|
|
876
1021
|
);
|
|
877
1022
|
h.registerCustom(
|
|
878
1023
|
{
|
|
879
|
-
isApplicable:
|
|
1024
|
+
isApplicable: ur,
|
|
880
1025
|
serialize: (e) => e.serialize(),
|
|
881
|
-
deserialize: (e) =>
|
|
1026
|
+
deserialize: (e) => q(e)
|
|
882
1027
|
},
|
|
883
1028
|
"TextFilter"
|
|
884
1029
|
);
|
|
885
1030
|
h.registerCustom(
|
|
886
1031
|
{
|
|
887
|
-
isApplicable:
|
|
1032
|
+
isApplicable: cr,
|
|
888
1033
|
serialize: (e) => e.serialize(),
|
|
889
|
-
deserialize: (e) =>
|
|
1034
|
+
deserialize: (e) => q(e)
|
|
890
1035
|
},
|
|
891
1036
|
"DateRangeFilter"
|
|
892
1037
|
);
|
|
893
1038
|
h.registerCustom(
|
|
894
1039
|
{
|
|
895
|
-
isApplicable:
|
|
1040
|
+
isApplicable: lr,
|
|
896
1041
|
serialize: (e) => e.serialize(),
|
|
897
|
-
deserialize: (e) =>
|
|
1042
|
+
deserialize: (e) => q(e)
|
|
898
1043
|
},
|
|
899
1044
|
"RelativeDateFilter"
|
|
900
1045
|
);
|
|
901
1046
|
h.registerCustom(
|
|
902
1047
|
{
|
|
903
|
-
isApplicable:
|
|
1048
|
+
isApplicable: fr,
|
|
904
1049
|
serialize: (e) => e.serialize(),
|
|
905
|
-
deserialize: (e) =>
|
|
1050
|
+
deserialize: (e) => q(e)
|
|
906
1051
|
},
|
|
907
1052
|
"CustomFilter"
|
|
908
1053
|
);
|
|
909
|
-
const
|
|
1054
|
+
const ei = h, E = "DM.";
|
|
910
1055
|
function S(e) {
|
|
911
1056
|
return typeof e == "object" && e !== null;
|
|
912
1057
|
}
|
|
913
|
-
function
|
|
1058
|
+
function T(e) {
|
|
914
1059
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
915
1060
|
}
|
|
916
|
-
function
|
|
917
|
-
return e.every(
|
|
1061
|
+
function Tt(e) {
|
|
1062
|
+
return e.every(T);
|
|
918
1063
|
}
|
|
919
1064
|
function ne(e) {
|
|
920
1065
|
return "attribute" in e && "config" in e;
|
|
@@ -925,39 +1070,39 @@ function Z(e) {
|
|
|
925
1070
|
function Te(e) {
|
|
926
1071
|
return !ne(e) && !Z(e);
|
|
927
1072
|
}
|
|
928
|
-
function
|
|
1073
|
+
function Ms(e) {
|
|
929
1074
|
return S(e) && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
|
|
930
1075
|
}
|
|
931
|
-
function
|
|
932
|
-
return !S(e) || !("column" in e) ? !1 :
|
|
1076
|
+
function Ns(e) {
|
|
1077
|
+
return !S(e) || !("column" in e) ? !1 : T(e.column);
|
|
933
1078
|
}
|
|
934
1079
|
const x = 3;
|
|
935
|
-
function
|
|
1080
|
+
function R(e, t, r) {
|
|
936
1081
|
if (t.length === 0) return;
|
|
937
1082
|
let s = Number.MAX_SAFE_INTEGER, n;
|
|
938
1083
|
for (const i of t) {
|
|
939
|
-
const
|
|
940
|
-
|
|
1084
|
+
const o = r(i), a = Yr(e, o);
|
|
1085
|
+
a < s && (s = a, n = i);
|
|
941
1086
|
}
|
|
942
1087
|
return n !== void 0 ? { best: n, distance: s } : void 0;
|
|
943
1088
|
}
|
|
944
|
-
const
|
|
945
|
-
function
|
|
946
|
-
return e.localeCompare(t,
|
|
1089
|
+
const xt = "en";
|
|
1090
|
+
function ce(e, t) {
|
|
1091
|
+
return e.localeCompare(t, xt, { sensitivity: "accent" }) === 0;
|
|
947
1092
|
}
|
|
948
|
-
function
|
|
949
|
-
return t.length <= e.length && e.slice(0, t.length).localeCompare(t,
|
|
1093
|
+
function We(e, t) {
|
|
1094
|
+
return t.length <= e.length && e.slice(0, t.length).localeCompare(t, xt, { sensitivity: "accent" }) === 0;
|
|
950
1095
|
}
|
|
951
|
-
function
|
|
952
|
-
const t = [...e].sort((i,
|
|
1096
|
+
function xe(e) {
|
|
1097
|
+
const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
953
1098
|
for (const i of e) {
|
|
954
1099
|
r.set(i.name, i);
|
|
955
|
-
const
|
|
956
|
-
n.set(i.name,
|
|
957
|
-
const
|
|
1100
|
+
const o = [...i.columns].sort((u, c) => c.name.length - u.name.length);
|
|
1101
|
+
n.set(i.name, o);
|
|
1102
|
+
const a = /* @__PURE__ */ new Map();
|
|
958
1103
|
for (const u of i.columns)
|
|
959
|
-
|
|
960
|
-
s.set(i.name,
|
|
1104
|
+
a.set(u.name, u);
|
|
1105
|
+
s.set(i.name, a);
|
|
961
1106
|
}
|
|
962
1107
|
return {
|
|
963
1108
|
sortedTables: t,
|
|
@@ -966,7 +1111,7 @@ function qe(e) {
|
|
|
966
1111
|
columnMap: s
|
|
967
1112
|
};
|
|
968
1113
|
}
|
|
969
|
-
function
|
|
1114
|
+
function $e(e, t) {
|
|
970
1115
|
if (!e.startsWith(E))
|
|
971
1116
|
throw new Error(
|
|
972
1117
|
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
@@ -978,13 +1123,13 @@ function xe(e, t) {
|
|
|
978
1123
|
);
|
|
979
1124
|
let s, n;
|
|
980
1125
|
for (const m of t.sortedTables)
|
|
981
|
-
if (
|
|
982
|
-
const
|
|
983
|
-
if (!
|
|
1126
|
+
if (We(r, m.name + ".")) {
|
|
1127
|
+
const A = r.slice(m.name.length + 1);
|
|
1128
|
+
if (!A)
|
|
984
1129
|
throw new Error(
|
|
985
1130
|
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
986
1131
|
);
|
|
987
|
-
s = m, n =
|
|
1132
|
+
s = m, n = A;
|
|
988
1133
|
break;
|
|
989
1134
|
}
|
|
990
1135
|
if (!s) {
|
|
@@ -993,50 +1138,50 @@ function xe(e, t) {
|
|
|
993
1138
|
throw new Error(
|
|
994
1139
|
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
995
1140
|
);
|
|
996
|
-
const
|
|
997
|
-
throw new Error(`Table '${
|
|
1141
|
+
const A = r.slice(0, m), C = R(A, t.sortedTables, (oe) => oe.name), N = C && C.distance <= x ? ` Did you mean '${C.best.name}'?` : "";
|
|
1142
|
+
throw new Error(`Table '${A}' not found in the data model.${N}`);
|
|
998
1143
|
}
|
|
999
1144
|
const i = t.tableColumnMap.get(s.name);
|
|
1000
1145
|
if (!i)
|
|
1001
1146
|
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1002
|
-
let
|
|
1147
|
+
let o, a;
|
|
1003
1148
|
const u = $.all;
|
|
1004
1149
|
for (const m of i) {
|
|
1005
|
-
if (
|
|
1150
|
+
if (ce(n, m.name))
|
|
1006
1151
|
return { table: s, column: m };
|
|
1007
|
-
if (!
|
|
1152
|
+
if (!We(n, m.name + "."))
|
|
1008
1153
|
continue;
|
|
1009
|
-
const
|
|
1010
|
-
if (!
|
|
1154
|
+
const A = n.slice(m.name.length + 1);
|
|
1155
|
+
if (!A)
|
|
1011
1156
|
continue;
|
|
1012
|
-
const C = u.includes(
|
|
1157
|
+
const C = u.includes(A), N = X(m.dataType);
|
|
1013
1158
|
if (C) {
|
|
1014
1159
|
if (N)
|
|
1015
|
-
return { table: s, column: m, level:
|
|
1016
|
-
|
|
1160
|
+
return { table: s, column: m, level: A };
|
|
1161
|
+
o || (o = m, a = A);
|
|
1017
1162
|
continue;
|
|
1018
1163
|
}
|
|
1019
|
-
N && !
|
|
1164
|
+
N && !o && (o = m, a = A);
|
|
1020
1165
|
}
|
|
1021
|
-
if (
|
|
1022
|
-
if (u.includes(
|
|
1166
|
+
if (o && a) {
|
|
1167
|
+
if (u.includes(a))
|
|
1023
1168
|
throw new Error(
|
|
1024
|
-
`Invalid date level '${
|
|
1169
|
+
`Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`
|
|
1025
1170
|
);
|
|
1026
|
-
const m =
|
|
1171
|
+
const m = R(a, u, (C) => C), A = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
|
|
1027
1172
|
throw new Error(
|
|
1028
|
-
`Invalid date level '${
|
|
1173
|
+
`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(
|
|
1029
1174
|
", "
|
|
1030
|
-
)}.${
|
|
1175
|
+
)}.${A}`
|
|
1031
1176
|
);
|
|
1032
1177
|
}
|
|
1033
|
-
const
|
|
1178
|
+
const c = n.indexOf("."), p = c === -1 ? n : n.slice(0, c), l = R(n, i, (m) => m.name), d = l && l.distance <= x && !ce(l.best.name, p), b = d ? ` Did you mean '${l.best.name}'?` : "", g = !d && n.endsWith(".") && l !== void 0 && ce(l.best.name, p) ? ` Use '${p}' without a trailing dot.` : "";
|
|
1034
1179
|
throw new Error(
|
|
1035
1180
|
`Column '${p}' not found in table '${s.name}'.${b}${g}`
|
|
1036
1181
|
);
|
|
1037
1182
|
}
|
|
1038
|
-
function
|
|
1039
|
-
const { table: r, column: s, level: n } =
|
|
1183
|
+
function Rs(e, t) {
|
|
1184
|
+
const { table: r, column: s, level: n } = $e(e, t);
|
|
1040
1185
|
if (n) {
|
|
1041
1186
|
if (!X(s.dataType))
|
|
1042
1187
|
throw new Error(
|
|
@@ -1049,13 +1194,13 @@ function $s(e, t) {
|
|
|
1049
1194
|
", "
|
|
1050
1195
|
)}`
|
|
1051
1196
|
);
|
|
1052
|
-
const
|
|
1053
|
-
if (s.dataType === "date" && !
|
|
1197
|
+
const o = $.dateOnly;
|
|
1198
|
+
if (s.dataType === "date" && !o.includes(n))
|
|
1054
1199
|
throw new Error(
|
|
1055
1200
|
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`
|
|
1056
1201
|
);
|
|
1057
|
-
const
|
|
1058
|
-
if (s.dataType === "time" && !
|
|
1202
|
+
const a = $.timeOnly;
|
|
1203
|
+
if (s.dataType === "time" && !a.includes(n))
|
|
1059
1204
|
throw new Error(
|
|
1060
1205
|
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`
|
|
1061
1206
|
);
|
|
@@ -1063,16 +1208,16 @@ function $s(e, t) {
|
|
|
1063
1208
|
return { table: r, column: s, level: n };
|
|
1064
1209
|
}
|
|
1065
1210
|
function H(e, t, r, s) {
|
|
1066
|
-
const { table: n, column: i, level:
|
|
1067
|
-
let
|
|
1068
|
-
if (X(i.dataType) &&
|
|
1069
|
-
const u = s.inferredDateLevel,
|
|
1070
|
-
if (!
|
|
1211
|
+
const { table: n, column: i, level: o } = Rs(e, r);
|
|
1212
|
+
let a = o;
|
|
1213
|
+
if (X(i.dataType) && a === void 0 && (s != null && s.inferredDateLevel)) {
|
|
1214
|
+
const u = s.inferredDateLevel, c = $.all;
|
|
1215
|
+
if (!c.includes(u))
|
|
1071
1216
|
throw new Error(
|
|
1072
|
-
`Invalid inferred date level '${u}'. Valid levels are: ${
|
|
1217
|
+
`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`
|
|
1073
1218
|
);
|
|
1074
|
-
const p = `${e}.${u}`,
|
|
1075
|
-
if (i.dataType === "date" && !
|
|
1219
|
+
const p = `${e}.${u}`, l = $.dateOnly;
|
|
1220
|
+
if (i.dataType === "date" && !l.includes(u))
|
|
1076
1221
|
throw new Error(
|
|
1077
1222
|
`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`
|
|
1078
1223
|
);
|
|
@@ -1081,19 +1226,19 @@ function H(e, t, r, s) {
|
|
|
1081
1226
|
throw new Error(
|
|
1082
1227
|
`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a time column, not a date column`
|
|
1083
1228
|
);
|
|
1084
|
-
|
|
1229
|
+
a = u;
|
|
1085
1230
|
}
|
|
1086
|
-
return
|
|
1231
|
+
return Or({
|
|
1087
1232
|
expression: i.expression,
|
|
1088
1233
|
dataType: i.dataType,
|
|
1089
|
-
granularity:
|
|
1234
|
+
granularity: a,
|
|
1090
1235
|
format: void 0,
|
|
1091
1236
|
sort: void 0,
|
|
1092
1237
|
dataSource: t
|
|
1093
1238
|
});
|
|
1094
1239
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const { column: s, level: n } =
|
|
1240
|
+
function vs(e, t, r) {
|
|
1241
|
+
const { column: s, level: n } = $e(e, r);
|
|
1097
1242
|
if (n)
|
|
1098
1243
|
throw new Error(
|
|
1099
1244
|
`Invalid DateDimension name format: '${e}'. Expected format: '${E}TableName.ColumnName'`
|
|
@@ -1102,34 +1247,34 @@ function Ss(e, t, r) {
|
|
|
1102
1247
|
throw new Error(
|
|
1103
1248
|
`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`
|
|
1104
1249
|
);
|
|
1105
|
-
return
|
|
1250
|
+
return Gr({
|
|
1106
1251
|
name: s.name,
|
|
1107
1252
|
expression: s.expression,
|
|
1108
1253
|
dataSource: t
|
|
1109
1254
|
});
|
|
1110
1255
|
}
|
|
1111
|
-
const
|
|
1256
|
+
const Is = (e, t) => {
|
|
1112
1257
|
if (!e) return;
|
|
1113
1258
|
const r = typeof e == "object" ? e.direction : e;
|
|
1114
|
-
if (!
|
|
1115
|
-
return
|
|
1259
|
+
if (!tt(r))
|
|
1260
|
+
return w(y({}, t), {
|
|
1116
1261
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1117
1262
|
});
|
|
1118
|
-
},
|
|
1119
|
-
const n =
|
|
1263
|
+
}, Ps = (e, t, r, s) => {
|
|
1264
|
+
const n = Is(e.sortType, s);
|
|
1120
1265
|
if (n)
|
|
1121
1266
|
return {
|
|
1122
1267
|
attribute: H(e.column, t, r),
|
|
1123
1268
|
style: {},
|
|
1124
1269
|
error: n
|
|
1125
1270
|
};
|
|
1126
|
-
const i = H(e.column, t, r),
|
|
1127
|
-
return { attribute: i, style:
|
|
1128
|
-
},
|
|
1129
|
-
error:
|
|
1271
|
+
const i = H(e.column, t, r), o = _(e, "column");
|
|
1272
|
+
return { attribute: i, style: o };
|
|
1273
|
+
}, ks = (e, t, r, s) => typeof e == "string" ? { attribute: H(e, t, r) } : Ms(e) ? Ps(e, t, r, s) : {
|
|
1274
|
+
error: w(y({}, s), {
|
|
1130
1275
|
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1131
1276
|
})
|
|
1132
|
-
},
|
|
1277
|
+
}, $t = (e) => {
|
|
1133
1278
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1134
1279
|
if (!t)
|
|
1135
1280
|
return { success: !0, data: [] };
|
|
@@ -1146,64 +1291,64 @@ const Os = (e, t) => {
|
|
|
1146
1291
|
]
|
|
1147
1292
|
};
|
|
1148
1293
|
const n = [], i = [];
|
|
1149
|
-
return t.forEach((
|
|
1294
|
+
return t.forEach((o, a) => {
|
|
1150
1295
|
const u = {
|
|
1151
1296
|
category: "dimensions",
|
|
1152
|
-
index:
|
|
1153
|
-
input:
|
|
1297
|
+
index: a,
|
|
1298
|
+
input: o
|
|
1154
1299
|
};
|
|
1155
1300
|
try {
|
|
1156
|
-
const
|
|
1157
|
-
if (
|
|
1158
|
-
i.push(
|
|
1301
|
+
const c = ks(o, r, s, u);
|
|
1302
|
+
if (c.error) {
|
|
1303
|
+
i.push(c.error);
|
|
1159
1304
|
return;
|
|
1160
1305
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1306
|
+
c.attribute && n.push(
|
|
1307
|
+
c.style !== void 0 ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute }
|
|
1163
1308
|
);
|
|
1164
|
-
} catch (
|
|
1165
|
-
const p =
|
|
1166
|
-
i.push(
|
|
1309
|
+
} catch (c) {
|
|
1310
|
+
const p = c instanceof Error ? c.message : "Unknown error";
|
|
1311
|
+
i.push(w(y({}, u), { message: p }));
|
|
1167
1312
|
}
|
|
1168
1313
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
1169
1314
|
};
|
|
1170
|
-
function
|
|
1315
|
+
function Se(e, t) {
|
|
1171
1316
|
const r = Reflect.get(e, t);
|
|
1172
1317
|
if (typeof r != "function")
|
|
1173
1318
|
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1174
1319
|
return r;
|
|
1175
1320
|
}
|
|
1176
|
-
function
|
|
1177
|
-
const r = e.replace("measureFactory.", ""), n =
|
|
1321
|
+
function Bs(e, t) {
|
|
1322
|
+
const r = e.replace("measureFactory.", ""), n = Se(Dr, r)(...t);
|
|
1178
1323
|
if (!Te(n))
|
|
1179
1324
|
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1180
1325
|
return n;
|
|
1181
1326
|
}
|
|
1182
|
-
function
|
|
1183
|
-
const r = e.replace("filterFactory.logic.", ""), n =
|
|
1327
|
+
function zs(e, t) {
|
|
1328
|
+
const r = e.replace("filterFactory.logic.", ""), n = Se(Mr, r)(...t);
|
|
1184
1329
|
if (!Z(n))
|
|
1185
1330
|
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1186
1331
|
return n;
|
|
1187
1332
|
}
|
|
1188
|
-
function
|
|
1333
|
+
function Ls(e, t) {
|
|
1189
1334
|
if (e.startsWith("filterFactory.logic."))
|
|
1190
|
-
return
|
|
1191
|
-
const r = e.replace("filterFactory.", ""), n =
|
|
1335
|
+
return zs(e, t);
|
|
1336
|
+
const r = e.replace("filterFactory.", ""), n = Se(Nr, r)(...t);
|
|
1192
1337
|
if (!ne(n) && !Z(n))
|
|
1193
1338
|
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1194
1339
|
return n;
|
|
1195
1340
|
}
|
|
1196
|
-
function
|
|
1341
|
+
function Us(e, t) {
|
|
1197
1342
|
const s = e.split(".")[0];
|
|
1198
1343
|
if (s === "measureFactory")
|
|
1199
|
-
return
|
|
1344
|
+
return Bs(e, t);
|
|
1200
1345
|
if (s === "filterFactory")
|
|
1201
|
-
return
|
|
1346
|
+
return Ls(e, t);
|
|
1202
1347
|
throw new Error(
|
|
1203
1348
|
`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`
|
|
1204
1349
|
);
|
|
1205
1350
|
}
|
|
1206
|
-
const f = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s),
|
|
1351
|
+
const f = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s), _s = /* @__PURE__ */ new Set([
|
|
1207
1352
|
"CORREL",
|
|
1208
1353
|
"COVARP",
|
|
1209
1354
|
"COVAR",
|
|
@@ -1333,20 +1478,20 @@ const f = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s), Ps = /*
|
|
|
1333
1478
|
SIN: f("scalar", 1, 1),
|
|
1334
1479
|
SQRT: f("scalar", 1, 1),
|
|
1335
1480
|
TAN: f("scalar", 1, 1)
|
|
1336
|
-
},
|
|
1481
|
+
}, Vs = Object.keys(te).filter(
|
|
1337
1482
|
(e) => te[e].category === "xdiff"
|
|
1338
1483
|
);
|
|
1339
|
-
function
|
|
1340
|
-
return
|
|
1484
|
+
function St() {
|
|
1485
|
+
return Vs;
|
|
1341
1486
|
}
|
|
1342
|
-
function
|
|
1487
|
+
function Ot(e) {
|
|
1343
1488
|
const t = te[e.toUpperCase()];
|
|
1344
1489
|
return t == null ? void 0 : t.requiredDateLevel;
|
|
1345
1490
|
}
|
|
1346
|
-
function
|
|
1491
|
+
function Ws(e, t) {
|
|
1347
1492
|
return e === t ? e === 1 ? "1 parameter" : `${e} parameters` : t === Number.POSITIVE_INFINITY ? e <= 1 ? "any number of parameters" : `at least ${e} parameters` : `${e} or ${t} parameters`;
|
|
1348
1493
|
}
|
|
1349
|
-
const
|
|
1494
|
+
const js = /\[(\w[\w.-]*)\]/g, Dt = /* @__PURE__ */ new Set([
|
|
1350
1495
|
// Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
|
|
1351
1496
|
"AVG",
|
|
1352
1497
|
"COUNT",
|
|
@@ -1367,30 +1512,30 @@ const zs = /\[(\w[\w.-]*)\]/g, $t = /* @__PURE__ */ new Set([
|
|
|
1367
1512
|
"YTDSUM"
|
|
1368
1513
|
// RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
|
|
1369
1514
|
// CORREL, COVAR*, SKEW*, SLOPE, LARGEST are unsupported in custom formulas (see UNSUPPORTED_FORMULA_FUNCTIONS).
|
|
1370
|
-
]),
|
|
1371
|
-
`\\b(${Array.from(
|
|
1515
|
+
]), Ks = new RegExp(
|
|
1516
|
+
`\\b(${Array.from(Dt).join("|")})\\s*\\(`,
|
|
1372
1517
|
"i"
|
|
1373
1518
|
);
|
|
1374
|
-
function
|
|
1375
|
-
return
|
|
1519
|
+
function Mt(e) {
|
|
1520
|
+
return T(e) ? !0 : typeof e == "string" && e.startsWith(E) ? !1 : S(e) && "kind" in e ? e.kind === "measure" : !0;
|
|
1376
1521
|
}
|
|
1377
|
-
function
|
|
1522
|
+
function Gs(e) {
|
|
1378
1523
|
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set();
|
|
1379
1524
|
let s;
|
|
1380
1525
|
for (; (s = t.exec(e)) !== null; ) {
|
|
1381
1526
|
const n = s[1];
|
|
1382
|
-
|
|
1527
|
+
Dt.has(n.toUpperCase()) || r.add(n);
|
|
1383
1528
|
}
|
|
1384
1529
|
return Array.from(r);
|
|
1385
1530
|
}
|
|
1386
|
-
function
|
|
1531
|
+
function Ys(e) {
|
|
1387
1532
|
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1388
1533
|
}
|
|
1389
|
-
function
|
|
1534
|
+
function Js(e) {
|
|
1390
1535
|
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1391
1536
|
}
|
|
1392
|
-
const j = (e) => e.startsWith("[") ? e : `[${e}]`,
|
|
1393
|
-
function
|
|
1537
|
+
const j = (e) => e.startsWith("[") ? e : `[${e}]`, Nt = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1538
|
+
function Rt(e, t) {
|
|
1394
1539
|
if (t.length === 0) return [];
|
|
1395
1540
|
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(
|
|
1396
1541
|
`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`,
|
|
@@ -1402,16 +1547,16 @@ function Dt(e, t) {
|
|
|
1402
1547
|
ref2: n[3].trim()
|
|
1403
1548
|
}));
|
|
1404
1549
|
}
|
|
1405
|
-
function
|
|
1406
|
-
var
|
|
1407
|
-
const s = Object.keys(t), n = ((
|
|
1550
|
+
function Hs(e, t, r) {
|
|
1551
|
+
var o, a, u;
|
|
1552
|
+
const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1408
1553
|
return {
|
|
1409
1554
|
formula: e,
|
|
1410
1555
|
context: t,
|
|
1411
1556
|
contextKeys: s,
|
|
1412
1557
|
canonicalContextKeys: new Set(s.map(j)),
|
|
1413
1558
|
errorPrefix: i,
|
|
1414
|
-
warnUnusedContext: (
|
|
1559
|
+
warnUnusedContext: (a = r.warnUnusedContext) != null ? a : !0,
|
|
1415
1560
|
errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : !0,
|
|
1416
1561
|
schemaIndex: r.schemaIndex,
|
|
1417
1562
|
result: { isValid: !0, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
@@ -1420,17 +1565,17 @@ function js(e, t, r) {
|
|
|
1420
1565
|
function M(e, t) {
|
|
1421
1566
|
e.result.errors.push(t), e.result.isValid = !1;
|
|
1422
1567
|
}
|
|
1423
|
-
const
|
|
1424
|
-
function
|
|
1568
|
+
const Qs = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1569
|
+
function Xs(e) {
|
|
1425
1570
|
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find(
|
|
1426
|
-
(s) => !
|
|
1571
|
+
(s) => !Qs.has(s[1].toUpperCase())
|
|
1427
1572
|
);
|
|
1428
1573
|
r && M(
|
|
1429
1574
|
e,
|
|
1430
1575
|
`${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`
|
|
1431
1576
|
);
|
|
1432
1577
|
}
|
|
1433
|
-
function
|
|
1578
|
+
function Zs(e, t) {
|
|
1434
1579
|
const r = e[t];
|
|
1435
1580
|
let s = t + 1;
|
|
1436
1581
|
for (; s < e.length; ) {
|
|
@@ -1447,27 +1592,27 @@ function Gs(e, t) {
|
|
|
1447
1592
|
}
|
|
1448
1593
|
return e.length;
|
|
1449
1594
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return
|
|
1595
|
+
function en(e) {
|
|
1596
|
+
return we(e, ",").filter((t) => t.trim().length > 0).length;
|
|
1452
1597
|
}
|
|
1453
|
-
function
|
|
1598
|
+
function tn(e, t, r, s) {
|
|
1454
1599
|
for (; t < e.length && /\s/.test(e[t]); )
|
|
1455
1600
|
t++;
|
|
1456
1601
|
if (e[t] !== "(")
|
|
1457
1602
|
return t;
|
|
1458
|
-
const n = t, i =
|
|
1603
|
+
const n = t, i = Hr(e, n);
|
|
1459
1604
|
if (i === -1)
|
|
1460
1605
|
return n + 1;
|
|
1461
|
-
const
|
|
1462
|
-
return s.push({ name: r.toUpperCase(), argCount:
|
|
1606
|
+
const o = e.slice(n + 1, i);
|
|
1607
|
+
return s.push({ name: r.toUpperCase(), argCount: en(o) }), s.push(...vt(o)), i + 1;
|
|
1463
1608
|
}
|
|
1464
|
-
function
|
|
1609
|
+
function vt(e) {
|
|
1465
1610
|
const t = [];
|
|
1466
1611
|
let r = 0;
|
|
1467
1612
|
for (; r < e.length; ) {
|
|
1468
1613
|
const s = e[r];
|
|
1469
1614
|
if (s === "'" || s === '"') {
|
|
1470
|
-
r =
|
|
1615
|
+
r = Zs(e, r);
|
|
1471
1616
|
continue;
|
|
1472
1617
|
}
|
|
1473
1618
|
if (/[A-Za-z_]/.test(s)) {
|
|
@@ -1475,78 +1620,78 @@ function Mt(e) {
|
|
|
1475
1620
|
for (r++; r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
|
|
1476
1621
|
r++;
|
|
1477
1622
|
const i = e.slice(n, r);
|
|
1478
|
-
r =
|
|
1623
|
+
r = tn(e, r, i, t);
|
|
1479
1624
|
continue;
|
|
1480
1625
|
}
|
|
1481
1626
|
r++;
|
|
1482
1627
|
}
|
|
1483
1628
|
return t;
|
|
1484
1629
|
}
|
|
1485
|
-
function
|
|
1486
|
-
const t =
|
|
1630
|
+
function rn(e) {
|
|
1631
|
+
const t = vt(e.formula), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
1487
1632
|
for (const { name: n, argCount: i } of t) {
|
|
1488
|
-
if (
|
|
1633
|
+
if (_s.has(n)) {
|
|
1489
1634
|
r.has(n) || (r.add(n), M(
|
|
1490
1635
|
e,
|
|
1491
1636
|
`${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`
|
|
1492
1637
|
));
|
|
1493
1638
|
continue;
|
|
1494
1639
|
}
|
|
1495
|
-
const
|
|
1496
|
-
if (
|
|
1640
|
+
const o = te[n];
|
|
1641
|
+
if (o && (i < o.minArgs || i > o.maxArgs) && !s.has(n)) {
|
|
1497
1642
|
s.add(n);
|
|
1498
|
-
const
|
|
1499
|
-
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${
|
|
1643
|
+
const a = Ws(o.minArgs, o.maxArgs);
|
|
1644
|
+
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${a}`);
|
|
1500
1645
|
}
|
|
1501
1646
|
}
|
|
1502
1647
|
}
|
|
1503
|
-
function
|
|
1648
|
+
function sn(e) {
|
|
1504
1649
|
return [
|
|
1505
1650
|
...new Set(
|
|
1506
|
-
[...e.matchAll(new RegExp(
|
|
1651
|
+
[...e.matchAll(new RegExp(js.source, "g"))].map((t) => t[1])
|
|
1507
1652
|
)
|
|
1508
1653
|
];
|
|
1509
1654
|
}
|
|
1510
|
-
function
|
|
1655
|
+
function nn(e) {
|
|
1511
1656
|
const t = e.result.references.filter(
|
|
1512
1657
|
(n) => !e.canonicalContextKeys.has(j(n))
|
|
1513
1658
|
);
|
|
1514
1659
|
if (t.length === 0) return;
|
|
1515
|
-
const r = e.contextKeys.map((n) => `[${
|
|
1660
|
+
const r = e.contextKeys.map((n) => `[${Nt(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1516
1661
|
M(
|
|
1517
1662
|
e,
|
|
1518
1663
|
`${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`
|
|
1519
1664
|
);
|
|
1520
1665
|
}
|
|
1521
|
-
function
|
|
1522
|
-
if (
|
|
1666
|
+
function on(e) {
|
|
1667
|
+
if (Ks.test(e.formula)) return;
|
|
1523
1668
|
const t = e.result.references.filter((r) => {
|
|
1524
1669
|
var n;
|
|
1525
1670
|
const s = (n = e.context[j(r)]) != null ? n : e.context[r];
|
|
1526
|
-
return s !== void 0 && !
|
|
1671
|
+
return s !== void 0 && !Mt(s);
|
|
1527
1672
|
});
|
|
1528
1673
|
t.length !== 0 && M(
|
|
1529
1674
|
e,
|
|
1530
|
-
`${e.errorPrefix}args[1]: ${
|
|
1531
|
-
|
|
1532
|
-
)}Bracket reference(s) ${
|
|
1675
|
+
`${e.errorPrefix}args[1]: ${Js(
|
|
1676
|
+
Gs(e.formula)
|
|
1677
|
+
)}Bracket reference(s) ${Ys(
|
|
1533
1678
|
t
|
|
1534
1679
|
)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
|
|
1535
1680
|
);
|
|
1536
1681
|
}
|
|
1537
|
-
function
|
|
1682
|
+
function an(e) {
|
|
1538
1683
|
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0) return;
|
|
1539
1684
|
const t = new Set(e.result.references.map(j)), r = e.contextKeys.filter((i) => !t.has(j(i)));
|
|
1540
1685
|
if (e.result.unusedContextKeys = r, r.length === 0) return;
|
|
1541
|
-
const s = r.map((i) => `[${
|
|
1686
|
+
const s = r.map((i) => `[${Nt(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1542
1687
|
e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1543
1688
|
}
|
|
1544
1689
|
function je(e, t, r, s) {
|
|
1545
|
-
var
|
|
1546
|
-
const n = (
|
|
1690
|
+
var o;
|
|
1691
|
+
const n = (o = s.context[j(e)]) != null ? o : s.context[e];
|
|
1547
1692
|
if (n === void 0) return;
|
|
1548
1693
|
if (!(typeof n == "string" && n.startsWith(E))) {
|
|
1549
|
-
|
|
1694
|
+
Mt(n) && M(
|
|
1550
1695
|
s,
|
|
1551
1696
|
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E}Table.Column.Level).`
|
|
1552
1697
|
);
|
|
@@ -1554,43 +1699,43 @@ function je(e, t, r, s) {
|
|
|
1554
1699
|
}
|
|
1555
1700
|
if (s.schemaIndex)
|
|
1556
1701
|
try {
|
|
1557
|
-
const
|
|
1558
|
-
X(
|
|
1702
|
+
const a = $e(n, s.schemaIndex);
|
|
1703
|
+
X(a.column.dataType) ? r && a.level && a.level !== r && M(
|
|
1559
1704
|
s,
|
|
1560
|
-
`${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${
|
|
1705
|
+
`${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`
|
|
1561
1706
|
) : M(
|
|
1562
1707
|
s,
|
|
1563
|
-
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${
|
|
1708
|
+
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`
|
|
1564
1709
|
);
|
|
1565
|
-
} catch (
|
|
1566
|
-
const u =
|
|
1710
|
+
} catch (a) {
|
|
1711
|
+
const u = a instanceof Error ? a.message : "Unknown error";
|
|
1567
1712
|
M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1568
1713
|
}
|
|
1569
1714
|
}
|
|
1570
|
-
function
|
|
1571
|
-
const t =
|
|
1715
|
+
function un(e) {
|
|
1716
|
+
const t = St(), r = Rt(e.formula, t);
|
|
1572
1717
|
for (const s of r) {
|
|
1573
|
-
const n =
|
|
1718
|
+
const n = Ot(s.functionName);
|
|
1574
1719
|
je(s.ref1, s, n, e), je(s.ref2, s, n, e);
|
|
1575
1720
|
}
|
|
1576
1721
|
}
|
|
1577
|
-
function
|
|
1722
|
+
function cn(e, t, r = {}) {
|
|
1578
1723
|
var n;
|
|
1579
|
-
const s =
|
|
1580
|
-
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (
|
|
1724
|
+
const s = Hs(e, t, r);
|
|
1725
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Xs(s), rn(s), s.result.references = sn(e), s.result.references.length === 0 ? (s.result.warnings.push(
|
|
1581
1726
|
`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`
|
|
1582
1727
|
), s.result) : s.contextKeys.length === 0 ? (M(
|
|
1583
1728
|
s,
|
|
1584
1729
|
`${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`
|
|
1585
|
-
), s.result) : (
|
|
1730
|
+
), s.result) : (nn(s), on(s), an(s), un(s), s.result));
|
|
1586
1731
|
}
|
|
1587
|
-
function
|
|
1588
|
-
const s =
|
|
1732
|
+
function ln(e, t, r = {}) {
|
|
1733
|
+
const s = cn(e, t, r);
|
|
1589
1734
|
if (!s.isValid)
|
|
1590
1735
|
throw new Error(s.errors.join("; "));
|
|
1591
1736
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1592
1737
|
}
|
|
1593
|
-
function
|
|
1738
|
+
function fn(e, t) {
|
|
1594
1739
|
if (e.length < 3 || e.length > 5)
|
|
1595
1740
|
throw new Error(
|
|
1596
1741
|
`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
|
|
@@ -1606,7 +1751,7 @@ function nn(e, t) {
|
|
|
1606
1751
|
`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`
|
|
1607
1752
|
);
|
|
1608
1753
|
const i = n;
|
|
1609
|
-
|
|
1754
|
+
ln(s, i, {
|
|
1610
1755
|
errorPrefix: `${t.pathPrefix}`,
|
|
1611
1756
|
errorOnUnusedContext: !0,
|
|
1612
1757
|
// Strict validation: all context keys must be used
|
|
@@ -1614,23 +1759,23 @@ function nn(e, t) {
|
|
|
1614
1759
|
// Custom formulas must have content
|
|
1615
1760
|
schemaIndex: t.schemaIndex
|
|
1616
1761
|
});
|
|
1617
|
-
const
|
|
1618
|
-
for (const [u,
|
|
1762
|
+
const o = dn(s), a = {};
|
|
1763
|
+
for (const [u, c] of Object.entries(i)) {
|
|
1619
1764
|
const p = `args[2].${u}`;
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1622
|
-
data:
|
|
1765
|
+
if (T(c))
|
|
1766
|
+
a[`${u}`] = D({
|
|
1767
|
+
data: c,
|
|
1623
1768
|
context: {
|
|
1624
1769
|
dataSource: t.dataSource,
|
|
1625
1770
|
schemaIndex: t.schemaIndex,
|
|
1626
1771
|
pathPrefix: p
|
|
1627
1772
|
}
|
|
1628
1773
|
});
|
|
1629
|
-
else if (typeof
|
|
1630
|
-
const
|
|
1774
|
+
else if (typeof c == "string" && c.startsWith(E)) {
|
|
1775
|
+
const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = o[l];
|
|
1631
1776
|
try {
|
|
1632
|
-
|
|
1633
|
-
|
|
1777
|
+
a[`${u}`] = H(
|
|
1778
|
+
c,
|
|
1634
1779
|
t.dataSource,
|
|
1635
1780
|
t.schemaIndex,
|
|
1636
1781
|
d !== void 0 ? { inferredDateLevel: d } : void 0
|
|
@@ -1639,55 +1784,55 @@ function nn(e, t) {
|
|
|
1639
1784
|
const g = b instanceof Error ? b.message : "Unknown error";
|
|
1640
1785
|
throw new Error(`${p}: ${g}`);
|
|
1641
1786
|
}
|
|
1642
|
-
} else if (
|
|
1643
|
-
|
|
1787
|
+
} else if (c && typeof c == "object" && "kind" in c)
|
|
1788
|
+
a[`${u}`] = c;
|
|
1644
1789
|
else
|
|
1645
1790
|
throw new Error(
|
|
1646
|
-
`${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E}...), but got: ${typeof
|
|
1791
|
+
`${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E}...), but got: ${typeof c}`
|
|
1647
1792
|
);
|
|
1648
1793
|
}
|
|
1649
|
-
e[2] =
|
|
1794
|
+
e[2] = a;
|
|
1650
1795
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const t =
|
|
1796
|
+
function dn(e) {
|
|
1797
|
+
const t = St(), r = Rt(e, t), s = {};
|
|
1653
1798
|
for (const n of r) {
|
|
1654
|
-
const i =
|
|
1799
|
+
const i = Ot(n.functionName);
|
|
1655
1800
|
if (i !== void 0)
|
|
1656
|
-
for (const
|
|
1657
|
-
const
|
|
1658
|
-
if (
|
|
1801
|
+
for (const o of [n.ref1, n.ref2]) {
|
|
1802
|
+
const a = s[o];
|
|
1803
|
+
if (a !== void 0 && a !== i)
|
|
1659
1804
|
throw new Error(
|
|
1660
|
-
`Reference [${
|
|
1805
|
+
`Reference [${o}] is used in xdiff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`
|
|
1661
1806
|
);
|
|
1662
|
-
s[
|
|
1807
|
+
s[o] = i;
|
|
1663
1808
|
}
|
|
1664
1809
|
}
|
|
1665
1810
|
return s;
|
|
1666
1811
|
}
|
|
1667
|
-
function
|
|
1812
|
+
function It(e) {
|
|
1668
1813
|
return e.type === U.TextAttribute;
|
|
1669
1814
|
}
|
|
1670
|
-
function
|
|
1815
|
+
function Pt(e) {
|
|
1671
1816
|
return e.type === U.NumericAttribute;
|
|
1672
1817
|
}
|
|
1673
|
-
function
|
|
1818
|
+
function mn(e) {
|
|
1674
1819
|
return e.type === U.DateLevel;
|
|
1675
1820
|
}
|
|
1676
|
-
function
|
|
1677
|
-
return
|
|
1821
|
+
function pn(e) {
|
|
1822
|
+
return It(e) || Pt(e);
|
|
1678
1823
|
}
|
|
1679
1824
|
function ie(e) {
|
|
1680
1825
|
return e.type === U.TextAttribute ? "text" : e.type === U.NumericAttribute ? "numeric" : e.type === U.DateLevel ? "date/datetime" : "unknown";
|
|
1681
1826
|
}
|
|
1682
|
-
function
|
|
1827
|
+
function Oe(e, t) {
|
|
1683
1828
|
const r = e[0];
|
|
1684
1829
|
if (!r || typeof r != "object" || !("type" in r))
|
|
1685
1830
|
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1686
1831
|
return r;
|
|
1687
1832
|
}
|
|
1688
|
-
function
|
|
1689
|
-
const r =
|
|
1690
|
-
if (!
|
|
1833
|
+
function Ke(e, t) {
|
|
1834
|
+
const r = Oe(e, t);
|
|
1835
|
+
if (!pn(r))
|
|
1691
1836
|
throw new Error(
|
|
1692
1837
|
`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ie(
|
|
1693
1838
|
r
|
|
@@ -1695,8 +1840,8 @@ function We(e, t) {
|
|
|
1695
1840
|
);
|
|
1696
1841
|
}
|
|
1697
1842
|
function P(e, t) {
|
|
1698
|
-
const r =
|
|
1699
|
-
if (!
|
|
1843
|
+
const r = Oe(e, t);
|
|
1844
|
+
if (!Pt(r))
|
|
1700
1845
|
throw new Error(
|
|
1701
1846
|
`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ie(
|
|
1702
1847
|
r
|
|
@@ -1704,32 +1849,32 @@ function P(e, t) {
|
|
|
1704
1849
|
);
|
|
1705
1850
|
}
|
|
1706
1851
|
function k(e, t) {
|
|
1707
|
-
const r =
|
|
1708
|
-
if (!
|
|
1852
|
+
const r = Oe(e, t);
|
|
1853
|
+
if (!It(r))
|
|
1709
1854
|
throw new Error(
|
|
1710
1855
|
`${t.pathPrefix}args[0]: Attribute must be string type, got ${ie(
|
|
1711
1856
|
r
|
|
1712
1857
|
)} attribute`
|
|
1713
1858
|
);
|
|
1714
1859
|
}
|
|
1715
|
-
function
|
|
1860
|
+
function gn(e, t) {
|
|
1716
1861
|
const r = e[0];
|
|
1717
1862
|
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1718
1863
|
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1719
1864
|
return r;
|
|
1720
1865
|
}
|
|
1721
|
-
function
|
|
1722
|
-
const r =
|
|
1866
|
+
function yn(e, t) {
|
|
1867
|
+
const r = gn(e, t);
|
|
1723
1868
|
if (!be(r))
|
|
1724
1869
|
throw new Error(
|
|
1725
1870
|
`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`
|
|
1726
1871
|
);
|
|
1727
1872
|
}
|
|
1728
|
-
const
|
|
1729
|
-
"measureFactory.customFormula":
|
|
1873
|
+
const hn = {
|
|
1874
|
+
"measureFactory.customFormula": fn,
|
|
1730
1875
|
// String | Number filters
|
|
1731
|
-
"filterFactory.equals":
|
|
1732
|
-
"filterFactory.doesntEqual":
|
|
1876
|
+
"filterFactory.equals": Ke,
|
|
1877
|
+
"filterFactory.doesntEqual": Ke,
|
|
1733
1878
|
// Numeric filters
|
|
1734
1879
|
"filterFactory.greaterThan": P,
|
|
1735
1880
|
"filterFactory.greaterThanOrEqual": P,
|
|
@@ -1747,12 +1892,12 @@ const fn = {
|
|
|
1747
1892
|
"filterFactory.doesntEndWith": k,
|
|
1748
1893
|
"filterFactory.like": k,
|
|
1749
1894
|
// Exclude filter
|
|
1750
|
-
"filterFactory.exclude":
|
|
1895
|
+
"filterFactory.exclude": yn
|
|
1751
1896
|
};
|
|
1752
|
-
function
|
|
1753
|
-
return
|
|
1897
|
+
function bn(e) {
|
|
1898
|
+
return hn[`${e}`];
|
|
1754
1899
|
}
|
|
1755
|
-
const
|
|
1900
|
+
const kt = {
|
|
1756
1901
|
// ==================== MEASURE FACTORY FUNCTIONS ====================
|
|
1757
1902
|
// Basic aggregations
|
|
1758
1903
|
"measureFactory.sum": [
|
|
@@ -2279,18 +2424,18 @@ const Rt = {
|
|
|
2279
2424
|
{ type: "FilterRelationsNode", required: !0 }
|
|
2280
2425
|
]
|
|
2281
2426
|
};
|
|
2282
|
-
function
|
|
2283
|
-
return
|
|
2427
|
+
function De(e) {
|
|
2428
|
+
return kt[`${e}`];
|
|
2284
2429
|
}
|
|
2285
|
-
function
|
|
2286
|
-
const t =
|
|
2430
|
+
function An(e) {
|
|
2431
|
+
const t = De(e);
|
|
2287
2432
|
return t ? t.filter((r) => r.required).length : 0;
|
|
2288
2433
|
}
|
|
2289
|
-
function
|
|
2290
|
-
const t =
|
|
2434
|
+
function wn(e) {
|
|
2435
|
+
const t = De(e);
|
|
2291
2436
|
return t ? t.length : 0;
|
|
2292
2437
|
}
|
|
2293
|
-
function
|
|
2438
|
+
function Fn(e) {
|
|
2294
2439
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
2295
2440
|
return !1;
|
|
2296
2441
|
const r = Date.parse(e);
|
|
@@ -2299,7 +2444,7 @@ function gn(e) {
|
|
|
2299
2444
|
const s = new Date(e);
|
|
2300
2445
|
return !isNaN(s.getTime());
|
|
2301
2446
|
}
|
|
2302
|
-
function
|
|
2447
|
+
function le(e, t, r, s) {
|
|
2303
2448
|
if (e.startsWith(E))
|
|
2304
2449
|
try {
|
|
2305
2450
|
return H(e, t, r);
|
|
@@ -2311,10 +2456,10 @@ function ce(e, t, r, s) {
|
|
|
2311
2456
|
`${s}: Invalid attribute '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
2312
2457
|
);
|
|
2313
2458
|
}
|
|
2314
|
-
function
|
|
2459
|
+
function En(e, t, r, s) {
|
|
2315
2460
|
if (e.startsWith(E))
|
|
2316
2461
|
try {
|
|
2317
|
-
return
|
|
2462
|
+
return vs(e, t, r);
|
|
2318
2463
|
} catch (n) {
|
|
2319
2464
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2320
2465
|
throw new Error(`${s}: ${i}`);
|
|
@@ -2323,218 +2468,218 @@ function yn(e, t, r, s) {
|
|
|
2323
2468
|
`${s}: Invalid date dimension string '${e}'. Expected format: '${E}TableName.ColumnName'`
|
|
2324
2469
|
);
|
|
2325
2470
|
}
|
|
2326
|
-
function
|
|
2327
|
-
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context,
|
|
2471
|
+
function Cn(e) {
|
|
2472
|
+
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
|
|
2328
2473
|
if (t === void 0) {
|
|
2329
2474
|
if (r.required)
|
|
2330
|
-
throw new Error(`${
|
|
2475
|
+
throw new Error(`${o}: Required argument is missing (expected ${r.type})`);
|
|
2331
2476
|
return;
|
|
2332
2477
|
}
|
|
2333
2478
|
if (!(t === null && !r.required))
|
|
2334
2479
|
switch (r.type) {
|
|
2335
2480
|
case "string":
|
|
2336
2481
|
if (typeof t != "string")
|
|
2337
|
-
throw new Error(`${
|
|
2482
|
+
throw new Error(`${o}: Expected string, got ${typeof t}`);
|
|
2338
2483
|
return t;
|
|
2339
2484
|
case "number":
|
|
2340
2485
|
if (typeof t != "number")
|
|
2341
|
-
throw new Error(`${
|
|
2486
|
+
throw new Error(`${o}: Expected number, got ${typeof t}`);
|
|
2342
2487
|
return t;
|
|
2343
2488
|
case "boolean":
|
|
2344
2489
|
if (typeof t != "boolean")
|
|
2345
|
-
throw new Error(`${
|
|
2490
|
+
throw new Error(`${o}: Expected boolean, got ${typeof t}`);
|
|
2346
2491
|
return t;
|
|
2347
2492
|
case "string[]":
|
|
2348
2493
|
if (!Array.isArray(t))
|
|
2349
2494
|
throw new Error(
|
|
2350
|
-
`${
|
|
2495
|
+
`${o}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`
|
|
2351
2496
|
);
|
|
2352
|
-
if (!t.every((
|
|
2497
|
+
if (!t.every((a) => typeof a == "string"))
|
|
2353
2498
|
throw new Error(
|
|
2354
|
-
`${
|
|
2499
|
+
`${o}: Expected array of strings, but contains non-string values`
|
|
2355
2500
|
);
|
|
2356
2501
|
return t;
|
|
2357
2502
|
case "number[]":
|
|
2358
2503
|
if (!Array.isArray(t))
|
|
2359
2504
|
throw new Error(
|
|
2360
|
-
`${
|
|
2505
|
+
`${o}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`
|
|
2361
2506
|
);
|
|
2362
|
-
if (!t.every((
|
|
2507
|
+
if (!t.every((a) => typeof a == "number"))
|
|
2363
2508
|
throw new Error(
|
|
2364
|
-
`${
|
|
2509
|
+
`${o}: Expected array of numbers, but contains non-number values`
|
|
2365
2510
|
);
|
|
2366
2511
|
return t;
|
|
2367
2512
|
case "Attribute":
|
|
2368
2513
|
if (typeof t != "string")
|
|
2369
2514
|
throw new Error(
|
|
2370
|
-
`${
|
|
2515
|
+
`${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`
|
|
2371
2516
|
);
|
|
2372
|
-
return
|
|
2517
|
+
return le(t, s, n, o);
|
|
2373
2518
|
case "Attribute[]":
|
|
2374
2519
|
if (!Array.isArray(t))
|
|
2375
2520
|
throw new Error(
|
|
2376
|
-
`${
|
|
2521
|
+
`${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`
|
|
2377
2522
|
);
|
|
2378
|
-
return t.map((
|
|
2379
|
-
if (typeof
|
|
2380
|
-
throw new Error(`${
|
|
2381
|
-
return
|
|
2523
|
+
return t.map((a, u) => {
|
|
2524
|
+
if (typeof a != "string")
|
|
2525
|
+
throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
2526
|
+
return le(a, s, n, `${o}[${u}]`);
|
|
2382
2527
|
});
|
|
2383
2528
|
case "Measure":
|
|
2384
2529
|
case "BaseMeasure":
|
|
2385
|
-
if (!
|
|
2530
|
+
if (!T(t))
|
|
2386
2531
|
throw new Error(
|
|
2387
|
-
`${
|
|
2532
|
+
`${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`
|
|
2388
2533
|
);
|
|
2389
2534
|
return D({
|
|
2390
2535
|
data: t,
|
|
2391
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2536
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2392
2537
|
});
|
|
2393
2538
|
case "Measure[]":
|
|
2394
2539
|
if (!Array.isArray(t))
|
|
2395
2540
|
throw new Error(
|
|
2396
|
-
`${
|
|
2541
|
+
`${o}: Expected array of measure function calls, got ${typeof t}`
|
|
2397
2542
|
);
|
|
2398
|
-
return t.map((
|
|
2399
|
-
if (!
|
|
2543
|
+
return t.map((a, u) => {
|
|
2544
|
+
if (!T(a))
|
|
2400
2545
|
throw new Error(
|
|
2401
|
-
`${
|
|
2546
|
+
`${o}[${u}]: Expected measure function call, got ${typeof a}`
|
|
2402
2547
|
);
|
|
2403
2548
|
return D({
|
|
2404
|
-
data:
|
|
2405
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2549
|
+
data: a,
|
|
2550
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2406
2551
|
});
|
|
2407
2552
|
});
|
|
2408
2553
|
case "Filter":
|
|
2409
|
-
if (!
|
|
2554
|
+
if (!T(t))
|
|
2410
2555
|
throw new Error(
|
|
2411
|
-
`${
|
|
2556
|
+
`${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`
|
|
2412
2557
|
);
|
|
2413
2558
|
return D({
|
|
2414
2559
|
data: t,
|
|
2415
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2560
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2416
2561
|
});
|
|
2417
2562
|
case "Filter[]":
|
|
2418
2563
|
if (!Array.isArray(t))
|
|
2419
2564
|
throw new Error(
|
|
2420
|
-
`${
|
|
2565
|
+
`${o}: Expected array of filter function calls, got ${typeof t}`
|
|
2421
2566
|
);
|
|
2422
|
-
return t.map((
|
|
2423
|
-
if (!
|
|
2567
|
+
return t.map((a, u) => {
|
|
2568
|
+
if (!T(a))
|
|
2424
2569
|
throw new Error(
|
|
2425
|
-
`${
|
|
2570
|
+
`${o}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2426
2571
|
);
|
|
2427
2572
|
return D({
|
|
2428
|
-
data:
|
|
2429
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2573
|
+
data: a,
|
|
2574
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2430
2575
|
});
|
|
2431
2576
|
});
|
|
2432
2577
|
case "FilterRelationsNode":
|
|
2433
2578
|
if (Array.isArray(t))
|
|
2434
|
-
return t.map((
|
|
2435
|
-
if (!
|
|
2579
|
+
return t.map((a, u) => {
|
|
2580
|
+
if (!T(a))
|
|
2436
2581
|
throw new Error(
|
|
2437
|
-
`${
|
|
2582
|
+
`${o}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2438
2583
|
);
|
|
2439
2584
|
return D({
|
|
2440
|
-
data:
|
|
2441
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2585
|
+
data: a,
|
|
2586
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2442
2587
|
});
|
|
2443
2588
|
});
|
|
2444
|
-
if (
|
|
2589
|
+
if (T(t))
|
|
2445
2590
|
return D({
|
|
2446
2591
|
data: t,
|
|
2447
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2592
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2448
2593
|
});
|
|
2449
2594
|
throw new Error(
|
|
2450
|
-
`${
|
|
2595
|
+
`${o}: Expected filter function call or array of filters, got ${typeof t}`
|
|
2451
2596
|
);
|
|
2452
2597
|
case "DateDimension":
|
|
2453
2598
|
if (typeof t != "string")
|
|
2454
2599
|
throw new Error(
|
|
2455
|
-
`${
|
|
2600
|
+
`${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`
|
|
2456
2601
|
);
|
|
2457
|
-
return
|
|
2602
|
+
return En(t, s, n, o);
|
|
2458
2603
|
case "LevelAttribute": {
|
|
2459
2604
|
if (typeof t != "string")
|
|
2460
2605
|
throw new Error(
|
|
2461
|
-
`${
|
|
2606
|
+
`${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`
|
|
2462
2607
|
);
|
|
2463
|
-
const
|
|
2608
|
+
const a = le(
|
|
2464
2609
|
t,
|
|
2465
2610
|
s,
|
|
2466
2611
|
n,
|
|
2467
|
-
|
|
2612
|
+
o
|
|
2468
2613
|
);
|
|
2469
|
-
if (!
|
|
2614
|
+
if (!mn(a))
|
|
2470
2615
|
throw new Error(
|
|
2471
|
-
`${
|
|
2472
|
-
|
|
2616
|
+
`${o}: Attribute must be date/datetime type, got ${ie(
|
|
2617
|
+
a
|
|
2473
2618
|
)} attribute`
|
|
2474
2619
|
);
|
|
2475
|
-
return
|
|
2620
|
+
return a;
|
|
2476
2621
|
}
|
|
2477
2622
|
case "Measure | number":
|
|
2478
2623
|
if (typeof t == "number")
|
|
2479
2624
|
return t;
|
|
2480
|
-
if (
|
|
2625
|
+
if (T(t))
|
|
2481
2626
|
return D({
|
|
2482
2627
|
data: t,
|
|
2483
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2628
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2484
2629
|
});
|
|
2485
2630
|
throw new Error(
|
|
2486
|
-
`${
|
|
2631
|
+
`${o}: Expected measure function call or number, got ${typeof t}`
|
|
2487
2632
|
);
|
|
2488
2633
|
case "Date | string":
|
|
2489
2634
|
if (typeof t == "string") {
|
|
2490
|
-
if (
|
|
2635
|
+
if (Fn(t))
|
|
2491
2636
|
return t;
|
|
2492
2637
|
throw new Error(
|
|
2493
|
-
`${
|
|
2638
|
+
`${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`
|
|
2494
2639
|
);
|
|
2495
2640
|
} else {
|
|
2496
2641
|
if (t instanceof Date)
|
|
2497
2642
|
return t;
|
|
2498
2643
|
throw new Error(
|
|
2499
|
-
`${
|
|
2644
|
+
`${o}: Expected date string or Date object, got ${typeof t}`
|
|
2500
2645
|
);
|
|
2501
2646
|
}
|
|
2502
2647
|
case "string | number":
|
|
2503
2648
|
if (typeof t == "string" || typeof t == "number")
|
|
2504
2649
|
return t;
|
|
2505
|
-
throw new Error(`${
|
|
2650
|
+
throw new Error(`${o}: Expected string or number, got ${typeof t}`);
|
|
2506
2651
|
case "BaseFilterConfig":
|
|
2507
2652
|
case "MembersFilterConfig":
|
|
2508
2653
|
case "CustomFormulaContext":
|
|
2509
2654
|
case "any":
|
|
2510
2655
|
if (t == null && r.required)
|
|
2511
|
-
throw new Error(`${
|
|
2656
|
+
throw new Error(`${o}: Required argument is null/undefined`);
|
|
2512
2657
|
return t;
|
|
2513
2658
|
default:
|
|
2514
2659
|
return t;
|
|
2515
2660
|
}
|
|
2516
2661
|
}
|
|
2517
2662
|
function D(e) {
|
|
2518
|
-
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args:
|
|
2663
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = De(i);
|
|
2519
2664
|
if (!u) {
|
|
2520
|
-
const g = Object.keys(
|
|
2665
|
+
const g = Object.keys(kt), m = R(i, g, (C) => C), A = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
|
|
2521
2666
|
throw new Error(
|
|
2522
|
-
`${
|
|
2667
|
+
`${a}function: Unknown function '${i}'.${A}`
|
|
2523
2668
|
);
|
|
2524
2669
|
}
|
|
2525
|
-
const
|
|
2526
|
-
if (
|
|
2670
|
+
const c = An(i), p = wn(i);
|
|
2671
|
+
if (o.length < c)
|
|
2527
2672
|
throw new Error(
|
|
2528
|
-
`${
|
|
2673
|
+
`${a}function: Expected at least ${c} arguments, got ${o.length}`
|
|
2529
2674
|
);
|
|
2530
|
-
if (
|
|
2675
|
+
if (o.length > p)
|
|
2531
2676
|
throw new Error(
|
|
2532
|
-
`${
|
|
2677
|
+
`${a}function: Expected at most ${p} arguments, got ${o.length}`
|
|
2533
2678
|
);
|
|
2534
|
-
const
|
|
2535
|
-
for (let g = 0; g < Math.max(
|
|
2536
|
-
const m = u[`${g}`],
|
|
2537
|
-
if (
|
|
2679
|
+
const l = [], d = [];
|
|
2680
|
+
for (let g = 0; g < Math.max(o.length, u.length); g++) {
|
|
2681
|
+
const m = u[`${g}`], A = o[`${g}`], C = a ? `${a}args[${g}]` : `args[${g}]`;
|
|
2682
|
+
if (A === void 0) {
|
|
2538
2683
|
m != null && m.required && d.push(`${C}: Missing required argument (expected ${m.type})`);
|
|
2539
2684
|
continue;
|
|
2540
2685
|
}
|
|
@@ -2543,8 +2688,8 @@ function D(e) {
|
|
|
2543
2688
|
continue;
|
|
2544
2689
|
}
|
|
2545
2690
|
try {
|
|
2546
|
-
const N =
|
|
2547
|
-
data:
|
|
2691
|
+
const N = Cn({
|
|
2692
|
+
data: A,
|
|
2548
2693
|
context: {
|
|
2549
2694
|
dataSource: r,
|
|
2550
2695
|
schemaIndex: s,
|
|
@@ -2552,66 +2697,66 @@ function D(e) {
|
|
|
2552
2697
|
argSchema: m
|
|
2553
2698
|
}
|
|
2554
2699
|
});
|
|
2555
|
-
|
|
2700
|
+
l.push(N);
|
|
2556
2701
|
} catch (N) {
|
|
2557
|
-
const
|
|
2558
|
-
d.push(
|
|
2702
|
+
const oe = N instanceof Error ? N.message : "Unknown error";
|
|
2703
|
+
d.push(oe);
|
|
2559
2704
|
}
|
|
2560
2705
|
}
|
|
2561
2706
|
if (d.length > 0) {
|
|
2562
2707
|
const g = d.join("; ");
|
|
2563
2708
|
throw new Error(g);
|
|
2564
2709
|
}
|
|
2565
|
-
const b =
|
|
2710
|
+
const b = bn(i);
|
|
2566
2711
|
if (b)
|
|
2567
2712
|
try {
|
|
2568
|
-
b(
|
|
2713
|
+
b(l, {
|
|
2569
2714
|
dataSource: r,
|
|
2570
2715
|
schemaIndex: s,
|
|
2571
|
-
pathPrefix:
|
|
2716
|
+
pathPrefix: a
|
|
2572
2717
|
});
|
|
2573
2718
|
} catch (g) {
|
|
2574
2719
|
const m = g instanceof Error ? g.message : "Unknown validation error";
|
|
2575
2720
|
throw new Error(m);
|
|
2576
2721
|
}
|
|
2577
|
-
return
|
|
2722
|
+
return Us(i, l);
|
|
2578
2723
|
}
|
|
2579
|
-
function
|
|
2724
|
+
function Bt(e) {
|
|
2580
2725
|
const { attribute: t, config: r } = e;
|
|
2581
|
-
if (be(e) &&
|
|
2582
|
-
const { granularity: s } = t, n = e.members.map((
|
|
2583
|
-
return
|
|
2726
|
+
if (be(e) && Rr(t)) {
|
|
2727
|
+
const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = vr(r), o = Object.keys(i).length === 0 ? void 0 : i;
|
|
2728
|
+
return Ir(t, n, o);
|
|
2584
2729
|
}
|
|
2585
2730
|
return e;
|
|
2586
2731
|
}
|
|
2587
|
-
function
|
|
2732
|
+
function qn(e) {
|
|
2588
2733
|
let t = [];
|
|
2589
2734
|
for (const r of e)
|
|
2590
|
-
Z(r) ? t =
|
|
2735
|
+
Z(r) ? t = ze(r, t) : t = ze([Bt(r)], t);
|
|
2591
2736
|
return t != null ? t : [];
|
|
2592
2737
|
}
|
|
2593
|
-
const
|
|
2738
|
+
const Tn = (e) => {
|
|
2594
2739
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2595
|
-
return t.forEach((
|
|
2740
|
+
return t.forEach((o, a) => {
|
|
2596
2741
|
const u = {
|
|
2597
2742
|
category: "filters",
|
|
2598
|
-
index:
|
|
2599
|
-
input:
|
|
2743
|
+
index: a,
|
|
2744
|
+
input: o
|
|
2600
2745
|
};
|
|
2601
2746
|
try {
|
|
2602
|
-
const
|
|
2603
|
-
data:
|
|
2747
|
+
const c = D({
|
|
2748
|
+
data: o,
|
|
2604
2749
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2605
2750
|
});
|
|
2606
|
-
!Z(
|
|
2607
|
-
} catch (
|
|
2608
|
-
const p =
|
|
2609
|
-
i.push(
|
|
2751
|
+
!Z(c) && !ne(c) ? i.push(w(y({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2752
|
+
} catch (c) {
|
|
2753
|
+
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2754
|
+
i.push(w(y({}, u), { message: p }));
|
|
2610
2755
|
}
|
|
2611
|
-
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data:
|
|
2612
|
-
},
|
|
2756
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: qn(n) };
|
|
2757
|
+
}, Me = (e) => {
|
|
2613
2758
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2614
|
-
return t ?
|
|
2759
|
+
return t ? Tt(t) ? Tn({
|
|
2615
2760
|
data: t,
|
|
2616
2761
|
context: { dataSource: r, schemaIndex: s }
|
|
2617
2762
|
}) : {
|
|
@@ -2625,28 +2770,28 @@ const Fn = (e) => {
|
|
|
2625
2770
|
}
|
|
2626
2771
|
]
|
|
2627
2772
|
} : { success: !0, data: [] };
|
|
2628
|
-
},
|
|
2773
|
+
}, xn = (e) => {
|
|
2629
2774
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2630
|
-
return t.forEach((
|
|
2775
|
+
return t.forEach((o, a) => {
|
|
2631
2776
|
const u = {
|
|
2632
2777
|
category: "highlights",
|
|
2633
|
-
index:
|
|
2634
|
-
input:
|
|
2778
|
+
index: a,
|
|
2779
|
+
input: o
|
|
2635
2780
|
};
|
|
2636
2781
|
try {
|
|
2637
|
-
const
|
|
2638
|
-
data:
|
|
2782
|
+
const c = D({
|
|
2783
|
+
data: o,
|
|
2639
2784
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2640
2785
|
});
|
|
2641
|
-
ne(
|
|
2642
|
-
} catch (
|
|
2643
|
-
const p =
|
|
2644
|
-
i.push(
|
|
2786
|
+
ne(c) ? n.push(Bt(c)) : i.push(w(y({}, u), { message: "Invalid filter JSON" }));
|
|
2787
|
+
} catch (c) {
|
|
2788
|
+
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2789
|
+
i.push(w(y({}, u), { message: p }));
|
|
2645
2790
|
}
|
|
2646
2791
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2647
|
-
},
|
|
2792
|
+
}, Ne = (e) => {
|
|
2648
2793
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2649
|
-
return t ?
|
|
2794
|
+
return t ? Tt(t) ? xn({
|
|
2650
2795
|
data: t,
|
|
2651
2796
|
context: { dataSource: r, schemaIndex: s }
|
|
2652
2797
|
}) : {
|
|
@@ -2660,12 +2805,12 @@ const Fn = (e) => {
|
|
|
2660
2805
|
}
|
|
2661
2806
|
]
|
|
2662
2807
|
} : { success: !0, data: [] };
|
|
2663
|
-
},
|
|
2664
|
-
if (e && !
|
|
2665
|
-
return
|
|
2808
|
+
}, $n = (e, t) => {
|
|
2809
|
+
if (e && !tt(e))
|
|
2810
|
+
return w(y({}, t), {
|
|
2666
2811
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2667
2812
|
});
|
|
2668
|
-
},
|
|
2813
|
+
}, Sn = (e, t, r) => {
|
|
2669
2814
|
const { dataSource: s, schemaIndex: n } = t;
|
|
2670
2815
|
try {
|
|
2671
2816
|
const i = D({
|
|
@@ -2674,16 +2819,16 @@ const Fn = (e) => {
|
|
|
2674
2819
|
});
|
|
2675
2820
|
return Te(i) ? { success: !0, data: i } : {
|
|
2676
2821
|
success: !1,
|
|
2677
|
-
errors: [
|
|
2822
|
+
errors: [w(y({}, r), { message: "Invalid measure JSON" })]
|
|
2678
2823
|
};
|
|
2679
2824
|
} catch (i) {
|
|
2680
|
-
const
|
|
2825
|
+
const o = i instanceof Error ? i.message : "Unknown error";
|
|
2681
2826
|
return {
|
|
2682
2827
|
success: !1,
|
|
2683
|
-
errors: [
|
|
2828
|
+
errors: [w(y({}, r), { message: o })]
|
|
2684
2829
|
};
|
|
2685
2830
|
}
|
|
2686
|
-
},
|
|
2831
|
+
}, On = (e, t, r, s) => {
|
|
2687
2832
|
const n = D({
|
|
2688
2833
|
data: e.column,
|
|
2689
2834
|
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
@@ -2691,20 +2836,20 @@ const Fn = (e) => {
|
|
|
2691
2836
|
if (!Te(n))
|
|
2692
2837
|
return {
|
|
2693
2838
|
style: {},
|
|
2694
|
-
error:
|
|
2839
|
+
error: w(y({}, s), { message: "Invalid measure JSON" })
|
|
2695
2840
|
};
|
|
2696
|
-
const i =
|
|
2841
|
+
const i = $n(e.sortType, s);
|
|
2697
2842
|
if (i) {
|
|
2698
|
-
const
|
|
2699
|
-
return { measure: n, style:
|
|
2700
|
-
}
|
|
2701
|
-
const
|
|
2702
|
-
return { measure: n, style:
|
|
2703
|
-
},
|
|
2704
|
-
if (
|
|
2705
|
-
return
|
|
2706
|
-
if (
|
|
2707
|
-
const n =
|
|
2843
|
+
const a = _(e, "column");
|
|
2844
|
+
return { measure: n, style: a, error: i };
|
|
2845
|
+
}
|
|
2846
|
+
const o = _(e, "column");
|
|
2847
|
+
return { measure: n, style: o };
|
|
2848
|
+
}, Dn = (e, t, r, s) => {
|
|
2849
|
+
if (Ns(e))
|
|
2850
|
+
return On(e, t, r, s);
|
|
2851
|
+
if (T(e)) {
|
|
2852
|
+
const n = Sn(
|
|
2708
2853
|
e,
|
|
2709
2854
|
{ dataSource: t, schemaIndex: r },
|
|
2710
2855
|
s
|
|
@@ -2712,11 +2857,11 @@ const Fn = (e) => {
|
|
|
2712
2857
|
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2713
2858
|
}
|
|
2714
2859
|
return {
|
|
2715
|
-
error:
|
|
2860
|
+
error: w(y({}, s), {
|
|
2716
2861
|
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2717
2862
|
})
|
|
2718
2863
|
};
|
|
2719
|
-
},
|
|
2864
|
+
}, zt = (e) => {
|
|
2720
2865
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2721
2866
|
if (!t)
|
|
2722
2867
|
return { success: !0, data: [] };
|
|
@@ -2733,24 +2878,24 @@ const Fn = (e) => {
|
|
|
2733
2878
|
]
|
|
2734
2879
|
};
|
|
2735
2880
|
const n = [], i = [];
|
|
2736
|
-
return t.forEach((
|
|
2881
|
+
return t.forEach((o, a) => {
|
|
2737
2882
|
const u = {
|
|
2738
2883
|
category: "measures",
|
|
2739
|
-
index:
|
|
2740
|
-
input:
|
|
2884
|
+
index: a,
|
|
2885
|
+
input: o
|
|
2741
2886
|
};
|
|
2742
2887
|
try {
|
|
2743
|
-
const
|
|
2744
|
-
if (
|
|
2745
|
-
i.push(
|
|
2888
|
+
const c = Dn(o, r, s, u);
|
|
2889
|
+
if (c.error) {
|
|
2890
|
+
i.push(c.error);
|
|
2746
2891
|
return;
|
|
2747
2892
|
}
|
|
2748
|
-
|
|
2749
|
-
|
|
2893
|
+
c.measure && n.push(
|
|
2894
|
+
c.style !== void 0 ? { measure: c.measure, style: c.style } : { measure: c.measure }
|
|
2750
2895
|
);
|
|
2751
|
-
} catch (
|
|
2752
|
-
const p =
|
|
2753
|
-
i.push(
|
|
2896
|
+
} catch (c) {
|
|
2897
|
+
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2898
|
+
i.push(w(y({}, u), { message: p }));
|
|
2754
2899
|
}
|
|
2755
2900
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2756
2901
|
};
|
|
@@ -2759,7 +2904,7 @@ function Q(e) {
|
|
|
2759
2904
|
Object.entries(e).map(([t, r]) => [t, Q(r)])
|
|
2760
2905
|
) : e;
|
|
2761
2906
|
}
|
|
2762
|
-
function
|
|
2907
|
+
function F(e, t, r) {
|
|
2763
2908
|
const s = e();
|
|
2764
2909
|
if (!s.success) {
|
|
2765
2910
|
const n = r ? s.errors.map(r) : s.errors;
|
|
@@ -2767,29 +2912,29 @@ function w(e, t, r) {
|
|
|
2767
2912
|
}
|
|
2768
2913
|
return s.data;
|
|
2769
2914
|
}
|
|
2770
|
-
const
|
|
2771
|
-
const { data: t } = e, { dataSource: r, tables: s } = e.context, n =
|
|
2772
|
-
() =>
|
|
2915
|
+
const ti = (e) => {
|
|
2916
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = xe(s), i = [], o = F(
|
|
2917
|
+
() => $t({
|
|
2773
2918
|
data: t.dimensions || [],
|
|
2774
2919
|
context: { dataSource: r, schemaIndex: n }
|
|
2775
2920
|
}),
|
|
2776
2921
|
i
|
|
2777
|
-
),
|
|
2778
|
-
() =>
|
|
2922
|
+
), a = F(
|
|
2923
|
+
() => zt({
|
|
2779
2924
|
data: t.measures || [],
|
|
2780
2925
|
context: { dataSource: r, schemaIndex: n }
|
|
2781
2926
|
}),
|
|
2782
2927
|
i
|
|
2783
|
-
), u =
|
|
2784
|
-
() =>
|
|
2928
|
+
), u = F(
|
|
2929
|
+
() => Me({
|
|
2785
2930
|
data: t.filters || [],
|
|
2786
2931
|
context: { dataSource: r, schemaIndex: n }
|
|
2787
2932
|
}),
|
|
2788
2933
|
i
|
|
2789
2934
|
);
|
|
2790
|
-
let
|
|
2791
|
-
return t.highlights && (
|
|
2792
|
-
() =>
|
|
2935
|
+
let c = null;
|
|
2936
|
+
return t.highlights && (c = F(
|
|
2937
|
+
() => Ne({
|
|
2793
2938
|
data: t.highlights || [],
|
|
2794
2939
|
context: { dataSource: r, schemaIndex: n }
|
|
2795
2940
|
}),
|
|
@@ -2800,26 +2945,26 @@ const Jn = (e) => {
|
|
|
2800
2945
|
} : {
|
|
2801
2946
|
success: !0,
|
|
2802
2947
|
data: y({
|
|
2803
|
-
dataSource:
|
|
2804
|
-
dimensions:
|
|
2805
|
-
measures:
|
|
2948
|
+
dataSource: Ae(r),
|
|
2949
|
+
dimensions: o ? Pr(o) : [],
|
|
2950
|
+
measures: a ? kr(a) : [],
|
|
2806
2951
|
filters: u || []
|
|
2807
|
-
},
|
|
2952
|
+
}, c && { highlights: c })
|
|
2808
2953
|
};
|
|
2809
2954
|
};
|
|
2810
|
-
function
|
|
2955
|
+
function Ge(e) {
|
|
2811
2956
|
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
2812
2957
|
}
|
|
2813
|
-
function
|
|
2958
|
+
function Re(e) {
|
|
2814
2959
|
const t = [], r = [];
|
|
2815
2960
|
return e.forEach((s, n) => {
|
|
2816
|
-
var
|
|
2817
|
-
const i =
|
|
2961
|
+
var l, d, b;
|
|
2962
|
+
const i = Ge(s) ? s.column : s, o = Ge(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2818
2963
|
if (!i.composeCode) {
|
|
2819
2964
|
r.push({
|
|
2820
2965
|
category: "dimensions",
|
|
2821
2966
|
index: n,
|
|
2822
|
-
input:
|
|
2967
|
+
input: a(),
|
|
2823
2968
|
message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2824
2969
|
});
|
|
2825
2970
|
return;
|
|
@@ -2828,16 +2973,16 @@ function Ne(e) {
|
|
|
2828
2973
|
r.push({
|
|
2829
2974
|
category: "dimensions",
|
|
2830
2975
|
index: n,
|
|
2831
|
-
input:
|
|
2976
|
+
input: a(),
|
|
2832
2977
|
message: `Expected composeCode to start with '${E}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2833
2978
|
});
|
|
2834
2979
|
return;
|
|
2835
2980
|
}
|
|
2836
|
-
const u = (b =
|
|
2837
|
-
if (u !== void 0 && u !== B.None ||
|
|
2981
|
+
const u = (b = o != null && o.sortType ? rt(o.sortType) : void 0) != null ? b : ((l = i.getSort) == null ? void 0 : l.call(i)) !== void 0 && ((d = i.getSort) == null ? void 0 : d.call(i)) !== B.None ? i.getSort() : void 0, c = o ? _(o, "column") : {};
|
|
2982
|
+
if (u !== void 0 && u !== B.None || o && Object.keys(c).length > 0) {
|
|
2838
2983
|
const g = y(y({
|
|
2839
2984
|
column: i.composeCode
|
|
2840
|
-
}, u !== void 0 && u !== B.None && { sortType:
|
|
2985
|
+
}, u !== void 0 && u !== B.None && { sortType: st(u) }), c);
|
|
2841
2986
|
t.push(g);
|
|
2842
2987
|
} else
|
|
2843
2988
|
t.push(i.composeCode);
|
|
@@ -2848,7 +2993,7 @@ function ve(e) {
|
|
|
2848
2993
|
if (!e)
|
|
2849
2994
|
return { success: !0, data: [] };
|
|
2850
2995
|
const t = [];
|
|
2851
|
-
if (
|
|
2996
|
+
if (Br(e)) {
|
|
2852
2997
|
if (!e.composeCode)
|
|
2853
2998
|
return {
|
|
2854
2999
|
success: !1,
|
|
@@ -2862,7 +3007,7 @@ function ve(e) {
|
|
|
2862
3007
|
]
|
|
2863
3008
|
};
|
|
2864
3009
|
try {
|
|
2865
|
-
return { success: !0, data: [
|
|
3010
|
+
return { success: !0, data: [V(e.composeCode)] };
|
|
2866
3011
|
} catch (s) {
|
|
2867
3012
|
const n = s instanceof Error ? s.message : ye;
|
|
2868
3013
|
return {
|
|
@@ -2891,20 +3036,20 @@ function ve(e) {
|
|
|
2891
3036
|
return;
|
|
2892
3037
|
}
|
|
2893
3038
|
try {
|
|
2894
|
-
const
|
|
2895
|
-
r.push(
|
|
2896
|
-
} catch (
|
|
2897
|
-
const
|
|
3039
|
+
const o = V(s.composeCode);
|
|
3040
|
+
r.push(o);
|
|
3041
|
+
} catch (o) {
|
|
3042
|
+
const a = o instanceof Error ? o.message : ye;
|
|
2898
3043
|
t.push({
|
|
2899
3044
|
category: "filters",
|
|
2900
3045
|
index: n,
|
|
2901
3046
|
input: s,
|
|
2902
|
-
message: `Failed to parse composeCode for filter at index ${n}: ${
|
|
3047
|
+
message: `Failed to parse composeCode for filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2903
3048
|
});
|
|
2904
3049
|
}
|
|
2905
3050
|
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
2906
3051
|
}
|
|
2907
|
-
function
|
|
3052
|
+
function Ie(e) {
|
|
2908
3053
|
if (!e)
|
|
2909
3054
|
return { success: !0, data: [] };
|
|
2910
3055
|
const t = [], r = [];
|
|
@@ -2920,133 +3065,133 @@ function Re(e) {
|
|
|
2920
3065
|
return;
|
|
2921
3066
|
}
|
|
2922
3067
|
try {
|
|
2923
|
-
const
|
|
2924
|
-
t.push(
|
|
2925
|
-
} catch (
|
|
2926
|
-
const
|
|
3068
|
+
const o = V(s.composeCode);
|
|
3069
|
+
t.push(o);
|
|
3070
|
+
} catch (o) {
|
|
3071
|
+
const a = o instanceof Error ? o.message : ye;
|
|
2927
3072
|
r.push({
|
|
2928
3073
|
category: "highlights",
|
|
2929
3074
|
index: n,
|
|
2930
3075
|
input: s,
|
|
2931
|
-
message: `Failed to parse composeCode for highlight filter at index ${n}: ${
|
|
3076
|
+
message: `Failed to parse composeCode for highlight filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2932
3077
|
});
|
|
2933
3078
|
}
|
|
2934
3079
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
2935
3080
|
}
|
|
2936
|
-
function
|
|
3081
|
+
function Ye(e) {
|
|
2937
3082
|
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
2938
3083
|
}
|
|
2939
|
-
function
|
|
3084
|
+
function Pe(e) {
|
|
2940
3085
|
const t = [], r = [];
|
|
2941
3086
|
return e.forEach((s, n) => {
|
|
2942
|
-
var u,
|
|
2943
|
-
const i =
|
|
3087
|
+
var u, c, p;
|
|
3088
|
+
const i = Ye(s) ? s.column : s, o = Ye(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2944
3089
|
if (!i.composeCode) {
|
|
2945
3090
|
r.push({
|
|
2946
3091
|
category: "measures",
|
|
2947
3092
|
index: n,
|
|
2948
|
-
input:
|
|
3093
|
+
input: a(),
|
|
2949
3094
|
message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2950
3095
|
});
|
|
2951
3096
|
return;
|
|
2952
3097
|
}
|
|
2953
3098
|
try {
|
|
2954
|
-
const
|
|
2955
|
-
if (d !== void 0 && d !== B.None ||
|
|
2956
|
-
const g =
|
|
2957
|
-
column:
|
|
2958
|
-
}, d !== void 0 && d !== B.None && { sortType:
|
|
3099
|
+
const l = V(i.composeCode), d = (p = o != null && o.sortType ? rt(o.sortType) : void 0) != null ? p : ((u = i.getSort) == null ? void 0 : u.call(i)) !== void 0 && ((c = i.getSort) == null ? void 0 : c.call(i)) !== B.None ? i.getSort() : void 0;
|
|
3100
|
+
if (d !== void 0 && d !== B.None || o && Object.keys(_(o, "column")).length > 0) {
|
|
3101
|
+
const g = o ? _(o, "column") : {}, m = y(y({
|
|
3102
|
+
column: l
|
|
3103
|
+
}, d !== void 0 && d !== B.None && { sortType: st(d) }), g);
|
|
2959
3104
|
t.push(m);
|
|
2960
3105
|
} else
|
|
2961
|
-
t.push(
|
|
2962
|
-
} catch (
|
|
2963
|
-
const d =
|
|
3106
|
+
t.push(l);
|
|
3107
|
+
} catch (l) {
|
|
3108
|
+
const d = l instanceof Error ? l.message : "Unknown error";
|
|
2964
3109
|
r.push({
|
|
2965
3110
|
category: "measures",
|
|
2966
3111
|
index: n,
|
|
2967
|
-
input:
|
|
3112
|
+
input: a(),
|
|
2968
3113
|
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
|
|
2969
3114
|
});
|
|
2970
3115
|
}
|
|
2971
3116
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
2972
3117
|
}
|
|
2973
|
-
function Ye(e) {
|
|
2974
|
-
var t, r, s, n;
|
|
2975
|
-
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(st)) != null ? n : !1);
|
|
2976
|
-
}
|
|
2977
3118
|
function Je(e) {
|
|
2978
3119
|
var t, r, s, n;
|
|
2979
|
-
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.
|
|
3120
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(nt)) != null ? n : !1);
|
|
2980
3121
|
}
|
|
2981
3122
|
function He(e) {
|
|
3123
|
+
var t, r, s, n;
|
|
3124
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(it)) != null ? n : !1);
|
|
3125
|
+
}
|
|
3126
|
+
function Qe(e) {
|
|
2982
3127
|
try {
|
|
2983
|
-
const t =
|
|
3128
|
+
const t = V(e.trim());
|
|
2984
3129
|
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : void 0;
|
|
2985
3130
|
} catch (t) {
|
|
2986
3131
|
return;
|
|
2987
3132
|
}
|
|
2988
3133
|
}
|
|
2989
|
-
function
|
|
3134
|
+
function Mn(e) {
|
|
2990
3135
|
var s, n, i;
|
|
2991
3136
|
if (!(e != null && e.length)) return [];
|
|
2992
3137
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
2993
|
-
for (let
|
|
2994
|
-
if (t.has(
|
|
2995
|
-
const
|
|
2996
|
-
if (
|
|
2997
|
-
r.push(
|
|
3138
|
+
for (let o = 0; o < e.length; o++) {
|
|
3139
|
+
if (t.has(o)) continue;
|
|
3140
|
+
const a = e[o];
|
|
3141
|
+
if (Je(a) || He(a)) {
|
|
3142
|
+
r.push(a);
|
|
2998
3143
|
continue;
|
|
2999
3144
|
}
|
|
3000
|
-
const u = (s =
|
|
3001
|
-
let
|
|
3002
|
-
if (b < e.length && !t.has(b) &&
|
|
3145
|
+
const u = (s = a.name) != null ? s : "Measure", c = `${nt}_${u}`, p = `${it}_${u}`;
|
|
3146
|
+
let l, d, b = o + 1;
|
|
3147
|
+
if (b < e.length && !t.has(b) && Je(e[b]) && e[b].name === c) {
|
|
3003
3148
|
const g = (n = e[b].composeCode) == null ? void 0 : n.trim();
|
|
3004
|
-
g && (
|
|
3149
|
+
g && (l = Qe(g), t.add(b), b++);
|
|
3005
3150
|
}
|
|
3006
|
-
if (b < e.length && !t.has(b) &&
|
|
3151
|
+
if (b < e.length && !t.has(b) && He(e[b]) && e[b].name === p) {
|
|
3007
3152
|
const g = (i = e[b].composeCode) == null ? void 0 : i.trim();
|
|
3008
|
-
g && (d =
|
|
3153
|
+
g && (d = Qe(g), t.add(b));
|
|
3009
3154
|
}
|
|
3010
|
-
|
|
3011
|
-
column:
|
|
3012
|
-
},
|
|
3155
|
+
l !== void 0 || d !== void 0 ? r.push(y(y({
|
|
3156
|
+
column: a
|
|
3157
|
+
}, l && Object.keys(l).length > 0 && { trend: l }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(a);
|
|
3013
3158
|
}
|
|
3014
3159
|
return r;
|
|
3015
3160
|
}
|
|
3016
|
-
function
|
|
3017
|
-
const t = [], r =
|
|
3018
|
-
() =>
|
|
3161
|
+
function ri(e) {
|
|
3162
|
+
const t = [], r = F(
|
|
3163
|
+
() => Re(e.dimensions || []),
|
|
3019
3164
|
t
|
|
3020
|
-
), s =
|
|
3021
|
-
() =>
|
|
3165
|
+
), s = Mn(e.measures || []), n = F(
|
|
3166
|
+
() => Pe(s),
|
|
3022
3167
|
t
|
|
3023
|
-
), i =
|
|
3168
|
+
), i = F(
|
|
3024
3169
|
() => ve(e.filters),
|
|
3025
3170
|
t
|
|
3026
3171
|
);
|
|
3027
|
-
let
|
|
3028
|
-
if (e.highlights && e.highlights.length > 0 && (
|
|
3029
|
-
() =>
|
|
3172
|
+
let o = null;
|
|
3173
|
+
if (e.highlights && e.highlights.length > 0 && (o = F(
|
|
3174
|
+
() => Ie(e.highlights),
|
|
3030
3175
|
t
|
|
3031
3176
|
)), t.length > 0)
|
|
3032
3177
|
return {
|
|
3033
3178
|
success: !1,
|
|
3034
3179
|
errors: t
|
|
3035
3180
|
};
|
|
3036
|
-
const
|
|
3181
|
+
const a = y({
|
|
3037
3182
|
dimensions: r || [],
|
|
3038
3183
|
measures: n || [],
|
|
3039
3184
|
filters: i || []
|
|
3040
|
-
},
|
|
3185
|
+
}, o && { highlights: o });
|
|
3041
3186
|
return {
|
|
3042
3187
|
success: !0,
|
|
3043
3188
|
// Strip [[delimiters]] from all strings to preserve original names with spaces
|
|
3044
|
-
data: Q(
|
|
3189
|
+
data: Q(a)
|
|
3045
3190
|
};
|
|
3046
3191
|
}
|
|
3047
|
-
const
|
|
3048
|
-
|
|
3049
|
-
),
|
|
3192
|
+
const Lt = new Set(
|
|
3193
|
+
zr.filter((e) => e !== "image")
|
|
3194
|
+
), Xe = Object.freeze([...Lt]), fe = /* @__PURE__ */ new Set([
|
|
3050
3195
|
"category",
|
|
3051
3196
|
"value",
|
|
3052
3197
|
"breakBy",
|
|
@@ -3069,7 +3214,7 @@ const kt = new Set(
|
|
|
3069
3214
|
"min",
|
|
3070
3215
|
"max",
|
|
3071
3216
|
"seriesToColorMap"
|
|
3072
|
-
]),
|
|
3217
|
+
]), Nn = {
|
|
3073
3218
|
line: {
|
|
3074
3219
|
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3075
3220
|
requiredAxes: ["category", "value"]
|
|
@@ -3142,7 +3287,7 @@ const kt = new Set(
|
|
|
3142
3287
|
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3143
3288
|
requiredAxes: ["category", "value"]
|
|
3144
3289
|
}
|
|
3145
|
-
},
|
|
3290
|
+
}, Rn = /* @__PURE__ */ new Set([
|
|
3146
3291
|
"category",
|
|
3147
3292
|
"breakBy",
|
|
3148
3293
|
"breakByPoint",
|
|
@@ -3150,7 +3295,7 @@ const kt = new Set(
|
|
|
3150
3295
|
"geo",
|
|
3151
3296
|
"details",
|
|
3152
3297
|
"date"
|
|
3153
|
-
]),
|
|
3298
|
+
]), vn = /* @__PURE__ */ new Set([
|
|
3154
3299
|
"value",
|
|
3155
3300
|
"size",
|
|
3156
3301
|
"colorBy",
|
|
@@ -3162,29 +3307,29 @@ const kt = new Set(
|
|
|
3162
3307
|
"max",
|
|
3163
3308
|
"color"
|
|
3164
3309
|
]);
|
|
3165
|
-
function
|
|
3166
|
-
const t =
|
|
3310
|
+
function In(e) {
|
|
3311
|
+
const t = Nn[e];
|
|
3167
3312
|
if (t)
|
|
3168
3313
|
return {
|
|
3169
3314
|
validAxes: new Set(t.validAxes),
|
|
3170
3315
|
requiredAxes: Object.freeze([...t.requiredAxes])
|
|
3171
3316
|
};
|
|
3172
3317
|
}
|
|
3173
|
-
function
|
|
3174
|
-
return typeof e == "string" &&
|
|
3318
|
+
function Ut(e) {
|
|
3319
|
+
return typeof e == "string" && Lt.has(e);
|
|
3175
3320
|
}
|
|
3176
|
-
function
|
|
3177
|
-
if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" ||
|
|
3321
|
+
function Pn(e, t, r) {
|
|
3322
|
+
if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" || Rn.has(e))
|
|
3178
3323
|
return !0;
|
|
3179
|
-
if (
|
|
3324
|
+
if (vn.has(e))
|
|
3180
3325
|
return !1;
|
|
3181
3326
|
const s = Array.isArray(t) ? t[0] : t;
|
|
3182
3327
|
if (!s)
|
|
3183
3328
|
return !0;
|
|
3184
3329
|
let n;
|
|
3185
|
-
return S(s) && "column" in s && (n = s.column), !(
|
|
3330
|
+
return S(s) && "column" in s && (n = s.column), !(T(s) || n !== void 0 && T(n));
|
|
3186
3331
|
}
|
|
3187
|
-
function
|
|
3332
|
+
function kn(e) {
|
|
3188
3333
|
const t = [], r = {
|
|
3189
3334
|
chartType: "",
|
|
3190
3335
|
dataOptions: {}
|
|
@@ -3198,124 +3343,124 @@ function Mn(e) {
|
|
|
3198
3343
|
}), { normalized: r, errors: t };
|
|
3199
3344
|
const s = e.chartType;
|
|
3200
3345
|
if (s === void 0) {
|
|
3201
|
-
const i = Object.keys(e),
|
|
3346
|
+
const i = Object.keys(e), o = R("chartType", i, (c) => c), a = o && o.distance <= x ? ` Did you mean 'chartType'? (You may have typed '${o.best}')` : "", u = o && o.distance <= x ? { [o.best]: e[o.best] } : e;
|
|
3202
3347
|
t.push({
|
|
3203
3348
|
category: "chartType",
|
|
3204
3349
|
index: -1,
|
|
3205
3350
|
input: u,
|
|
3206
|
-
message: `chartType is required.${
|
|
3351
|
+
message: `chartType is required.${a}`
|
|
3207
3352
|
});
|
|
3208
|
-
} else if (
|
|
3353
|
+
} else if (Ut(s))
|
|
3209
3354
|
r.chartType = s;
|
|
3210
3355
|
else {
|
|
3211
|
-
const i =
|
|
3356
|
+
const i = R(String(s), Xe, (u) => u), o = i && i.distance <= x ? ` Did you mean '${i.best}'?` : "", a = Xe.slice(0, 8).join(", ");
|
|
3212
3357
|
t.push({
|
|
3213
3358
|
category: "chartType",
|
|
3214
3359
|
index: -1,
|
|
3215
3360
|
input: s,
|
|
3216
|
-
message: `Invalid chartType '${s}'. Valid types: ${
|
|
3361
|
+
message: `Invalid chartType '${s}'. Valid types: ${a}, ...${o}`
|
|
3217
3362
|
});
|
|
3218
3363
|
}
|
|
3219
3364
|
const n = e.dataOptions;
|
|
3220
3365
|
if (n === void 0) {
|
|
3221
|
-
const i = Object.keys(e),
|
|
3366
|
+
const i = Object.keys(e), o = R("dataOptions", i, (c) => c), a = o && o.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${o.best}')` : "", u = o && o.distance <= x ? { [o.best]: e[o.best] } : e;
|
|
3222
3367
|
t.push({
|
|
3223
3368
|
category: "dataOptions",
|
|
3224
3369
|
index: -1,
|
|
3225
3370
|
input: u,
|
|
3226
|
-
message: `dataOptions is required.${
|
|
3371
|
+
message: `dataOptions is required.${a}`
|
|
3227
3372
|
});
|
|
3228
3373
|
} else n !== null && typeof n == "object" && (r.dataOptions = n);
|
|
3229
3374
|
return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
|
|
3230
3375
|
}
|
|
3231
|
-
function
|
|
3376
|
+
function Bn(e) {
|
|
3232
3377
|
return e.map(
|
|
3233
3378
|
({ attribute: t, style: r }) => r ? y({ column: t }, r) : t
|
|
3234
3379
|
);
|
|
3235
3380
|
}
|
|
3236
|
-
function
|
|
3381
|
+
function zn(e) {
|
|
3237
3382
|
return e.map(
|
|
3238
3383
|
({ measure: t, style: r }) => r ? y({ column: t }, r) : t
|
|
3239
3384
|
);
|
|
3240
3385
|
}
|
|
3241
|
-
function
|
|
3386
|
+
function _t(e) {
|
|
3242
3387
|
return Array.isArray(e) ? e : [e];
|
|
3243
3388
|
}
|
|
3244
3389
|
function he(e) {
|
|
3245
|
-
return (t) =>
|
|
3390
|
+
return (t) => w(y({}, t), {
|
|
3246
3391
|
category: "dataOptions",
|
|
3247
3392
|
index: e
|
|
3248
3393
|
});
|
|
3249
3394
|
}
|
|
3250
3395
|
function re(e, t, r, s, n) {
|
|
3251
|
-
const i = t ?
|
|
3396
|
+
const i = t ? _t(
|
|
3252
3397
|
t
|
|
3253
3398
|
) : [];
|
|
3254
3399
|
if (i.length === 0)
|
|
3255
3400
|
return [];
|
|
3256
3401
|
if (r === "dimension") {
|
|
3257
|
-
const
|
|
3258
|
-
() =>
|
|
3402
|
+
const a = F(
|
|
3403
|
+
() => $t({
|
|
3259
3404
|
data: i,
|
|
3260
3405
|
context: s
|
|
3261
3406
|
}),
|
|
3262
3407
|
n,
|
|
3263
3408
|
he(e)
|
|
3264
3409
|
);
|
|
3265
|
-
return
|
|
3410
|
+
return a !== null ? Bn(a) : null;
|
|
3266
3411
|
}
|
|
3267
|
-
const
|
|
3268
|
-
() =>
|
|
3412
|
+
const o = F(
|
|
3413
|
+
() => zt({
|
|
3269
3414
|
data: i,
|
|
3270
3415
|
context: s
|
|
3271
3416
|
}),
|
|
3272
3417
|
n,
|
|
3273
3418
|
he(e)
|
|
3274
3419
|
);
|
|
3275
|
-
return
|
|
3420
|
+
return o !== null ? zn(o) : null;
|
|
3276
3421
|
}
|
|
3277
|
-
function
|
|
3422
|
+
function Ze(e, t, r) {
|
|
3278
3423
|
const s = Array.isArray(t) ? t : t != null ? [t] : [];
|
|
3279
3424
|
if (r === "dimension") {
|
|
3280
|
-
const i =
|
|
3425
|
+
const i = Re(
|
|
3281
3426
|
s
|
|
3282
3427
|
);
|
|
3283
3428
|
return i.success ? { success: !0, data: i.data } : {
|
|
3284
3429
|
success: !1,
|
|
3285
|
-
errors: i.errors.map((
|
|
3430
|
+
errors: i.errors.map((o) => w(y({}, o), {
|
|
3286
3431
|
category: "dataOptions",
|
|
3287
3432
|
index: e
|
|
3288
3433
|
}))
|
|
3289
3434
|
};
|
|
3290
3435
|
}
|
|
3291
|
-
const n =
|
|
3436
|
+
const n = Pe(s);
|
|
3292
3437
|
return n.success ? { success: !0, data: n.data } : {
|
|
3293
3438
|
success: !1,
|
|
3294
|
-
errors: n.errors.map((i) =>
|
|
3439
|
+
errors: n.errors.map((i) => w(y({}, i), {
|
|
3295
3440
|
category: "dataOptions",
|
|
3296
3441
|
index: e
|
|
3297
3442
|
}))
|
|
3298
3443
|
};
|
|
3299
3444
|
}
|
|
3300
|
-
function
|
|
3445
|
+
function Ln(e, t) {
|
|
3301
3446
|
let r;
|
|
3302
3447
|
S(e) && "column" in e && (r = e.column);
|
|
3303
|
-
const n = !(
|
|
3304
|
-
return
|
|
3448
|
+
const n = !(T(e) || r !== void 0 && T(r)) ? "dimension" : "measure", i = [], o = re("columns", [e], n, t, i);
|
|
3449
|
+
return o !== null ? { success: !0, data: o } : { success: !1, errors: i };
|
|
3305
3450
|
}
|
|
3306
|
-
function
|
|
3451
|
+
function Un(e, t, r, s) {
|
|
3307
3452
|
const n = [];
|
|
3308
3453
|
for (const i of e) {
|
|
3309
|
-
const
|
|
3310
|
-
() =>
|
|
3454
|
+
const o = F(
|
|
3455
|
+
() => Ln(i, t),
|
|
3311
3456
|
r,
|
|
3312
3457
|
s
|
|
3313
3458
|
);
|
|
3314
|
-
|
|
3459
|
+
o && n.push(...o);
|
|
3315
3460
|
}
|
|
3316
3461
|
return n;
|
|
3317
3462
|
}
|
|
3318
|
-
function
|
|
3463
|
+
function _n(e, t, r) {
|
|
3319
3464
|
if (!e || !S(e))
|
|
3320
3465
|
return r.push({
|
|
3321
3466
|
category: "dataOptions",
|
|
@@ -3323,40 +3468,40 @@ function Pn(e, t, r) {
|
|
|
3323
3468
|
input: e,
|
|
3324
3469
|
message: "dataOptions is required"
|
|
3325
3470
|
}), null;
|
|
3326
|
-
const s = {}, { chartType: n } = t, i = r.length,
|
|
3327
|
-
for (const
|
|
3328
|
-
if (!fe.has(
|
|
3329
|
-
const d =
|
|
3330
|
-
d && d.distance <= x && u.set(
|
|
3471
|
+
const s = {}, { chartType: n } = t, i = r.length, o = e, a = Object.keys(e), u = /* @__PURE__ */ new Map();
|
|
3472
|
+
for (const l of a)
|
|
3473
|
+
if (!fe.has(l)) {
|
|
3474
|
+
const d = R(l, [...fe], (g) => g), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
|
|
3475
|
+
d && d.distance <= x && u.set(l, d.best), r.push({
|
|
3331
3476
|
category: "dataOptions",
|
|
3332
|
-
index:
|
|
3333
|
-
input:
|
|
3334
|
-
message: `Unknown dataOptions key '${
|
|
3477
|
+
index: l,
|
|
3478
|
+
input: o[l],
|
|
3479
|
+
message: `Unknown dataOptions key '${l}'.${b}`
|
|
3335
3480
|
});
|
|
3336
3481
|
}
|
|
3337
|
-
const
|
|
3338
|
-
if (
|
|
3339
|
-
for (const
|
|
3340
|
-
if (
|
|
3341
|
-
const d =
|
|
3482
|
+
const c = n ? In(n) : void 0;
|
|
3483
|
+
if (c) {
|
|
3484
|
+
for (const l of a)
|
|
3485
|
+
if (l !== "seriesToColorMap" && !c.validAxes.has(l) && fe.has(l)) {
|
|
3486
|
+
const d = R(l, [...c.validAxes], (m) => m), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "", g = [...c.validAxes].join(", ");
|
|
3342
3487
|
r.push({
|
|
3343
3488
|
category: "dataOptions",
|
|
3344
|
-
index:
|
|
3345
|
-
input:
|
|
3346
|
-
message: `Axis '${
|
|
3489
|
+
index: l,
|
|
3490
|
+
input: o[l],
|
|
3491
|
+
message: `Axis '${l}' is not valid for chart type '${n}'. Valid axes: ${g}.${b}`
|
|
3347
3492
|
});
|
|
3348
3493
|
}
|
|
3349
|
-
for (const
|
|
3350
|
-
[...u.values()].includes(
|
|
3494
|
+
for (const l of c.requiredAxes)
|
|
3495
|
+
[...u.values()].includes(l) || (!(l in o) || o[l] == null) && r.push({
|
|
3351
3496
|
category: "dataOptions",
|
|
3352
|
-
index:
|
|
3497
|
+
index: l,
|
|
3353
3498
|
input: null,
|
|
3354
|
-
message: `Chart type '${n}' requires '${
|
|
3499
|
+
message: `Chart type '${n}' requires '${c.requiredAxes.join(
|
|
3355
3500
|
"' and '"
|
|
3356
|
-
)}'. Missing: ${
|
|
3501
|
+
)}'. Missing: ${l}.`
|
|
3357
3502
|
});
|
|
3358
3503
|
n === "indicator" && (["value", "secondary", "min", "max"].some(
|
|
3359
|
-
(b) => b in
|
|
3504
|
+
(b) => b in o && o[b] != null
|
|
3360
3505
|
) || r.push({
|
|
3361
3506
|
category: "dataOptions",
|
|
3362
3507
|
index: -1,
|
|
@@ -3372,76 +3517,76 @@ function Pn(e, t, r) {
|
|
|
3372
3517
|
if (r.length > i)
|
|
3373
3518
|
return null;
|
|
3374
3519
|
const p = Object.entries(e);
|
|
3375
|
-
for (const [
|
|
3520
|
+
for (const [l, d] of p) {
|
|
3376
3521
|
if (!d) continue;
|
|
3377
|
-
if (
|
|
3378
|
-
s[
|
|
3522
|
+
if (l === "seriesToColorMap") {
|
|
3523
|
+
s[l] = d;
|
|
3379
3524
|
continue;
|
|
3380
3525
|
}
|
|
3381
|
-
if (
|
|
3382
|
-
s[
|
|
3383
|
-
|
|
3526
|
+
if (l === "columns") {
|
|
3527
|
+
s[l] = Un(
|
|
3528
|
+
_t(d),
|
|
3384
3529
|
t,
|
|
3385
3530
|
r,
|
|
3386
3531
|
he("columns")
|
|
3387
3532
|
);
|
|
3388
3533
|
continue;
|
|
3389
3534
|
}
|
|
3390
|
-
const b =
|
|
3391
|
-
|
|
3535
|
+
const b = Pn(l, d, n) ? "dimension" : "measure", g = re(
|
|
3536
|
+
l,
|
|
3392
3537
|
d,
|
|
3393
3538
|
b,
|
|
3394
3539
|
t,
|
|
3395
3540
|
r
|
|
3396
3541
|
);
|
|
3397
3542
|
if (g !== null) {
|
|
3398
|
-
const m = n === "calendar-heatmap" &&
|
|
3399
|
-
s[
|
|
3543
|
+
const m = n === "calendar-heatmap" && l === "value";
|
|
3544
|
+
s[l] = m || !Array.isArray(d) ? g[0] : g;
|
|
3400
3545
|
}
|
|
3401
3546
|
}
|
|
3402
3547
|
return r.length > i ? null : s;
|
|
3403
3548
|
}
|
|
3404
|
-
function
|
|
3549
|
+
function Vn(e) {
|
|
3405
3550
|
if (typeof e != "string") return "iqr";
|
|
3406
3551
|
const t = e.split("/")[1];
|
|
3407
3552
|
return t === "iqr" || t === "extremums" || t === "standardDeviation" ? t : "iqr";
|
|
3408
3553
|
}
|
|
3409
|
-
const
|
|
3554
|
+
const si = (e) => {
|
|
3410
3555
|
var m;
|
|
3411
|
-
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors:
|
|
3412
|
-
if (
|
|
3413
|
-
return { success: !1, errors:
|
|
3414
|
-
const
|
|
3415
|
-
let p =
|
|
3556
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = kn(t);
|
|
3557
|
+
if (o.length > 0)
|
|
3558
|
+
return { success: !1, errors: o };
|
|
3559
|
+
const a = i.chartType, u = xe(n), c = [];
|
|
3560
|
+
let p = _n(
|
|
3416
3561
|
i.dataOptions,
|
|
3417
|
-
{ dataSource: s, schemaIndex: u, chartType:
|
|
3418
|
-
|
|
3562
|
+
{ dataSource: s, schemaIndex: u, chartType: a },
|
|
3563
|
+
c
|
|
3419
3564
|
);
|
|
3420
|
-
if (
|
|
3421
|
-
const
|
|
3422
|
-
p =
|
|
3565
|
+
if (a === "boxplot" && p) {
|
|
3566
|
+
const A = Vn((m = i.styleOptions) == null ? void 0 : m.subtype), C = A === "iqr" || A === "standardDeviation";
|
|
3567
|
+
p = w(y({}, p), { boxType: A, outliersEnabled: C });
|
|
3423
3568
|
}
|
|
3424
|
-
let
|
|
3425
|
-
i.filters && i.filters.length > 0 && (
|
|
3426
|
-
() =>
|
|
3569
|
+
let l = null;
|
|
3570
|
+
i.filters && i.filters.length > 0 && (l = F(
|
|
3571
|
+
() => Me({
|
|
3427
3572
|
data: i.filters || [],
|
|
3428
3573
|
context: { dataSource: s, schemaIndex: u }
|
|
3429
3574
|
}),
|
|
3430
|
-
|
|
3575
|
+
c
|
|
3431
3576
|
));
|
|
3432
3577
|
let d = null;
|
|
3433
|
-
if (i.highlights && i.highlights.length > 0 && (d =
|
|
3434
|
-
() =>
|
|
3578
|
+
if (i.highlights && i.highlights.length > 0 && (d = F(
|
|
3579
|
+
() => Ne({
|
|
3435
3580
|
data: i.highlights || [],
|
|
3436
3581
|
context: { dataSource: s, schemaIndex: u }
|
|
3437
3582
|
}),
|
|
3438
|
-
|
|
3439
|
-
)),
|
|
3583
|
+
c
|
|
3584
|
+
)), c.length > 0 || p === null)
|
|
3440
3585
|
return {
|
|
3441
3586
|
success: !1,
|
|
3442
|
-
errors:
|
|
3587
|
+
errors: c
|
|
3443
3588
|
};
|
|
3444
|
-
if (!
|
|
3589
|
+
if (!Ut(i.chartType))
|
|
3445
3590
|
return {
|
|
3446
3591
|
success: !1,
|
|
3447
3592
|
errors: [
|
|
@@ -3457,15 +3602,15 @@ const Qn = (e) => {
|
|
|
3457
3602
|
return {
|
|
3458
3603
|
success: !0,
|
|
3459
3604
|
data: y(y(y({
|
|
3460
|
-
dataSet:
|
|
3605
|
+
dataSet: Ae(s),
|
|
3461
3606
|
chartType: b,
|
|
3462
3607
|
dataOptions: p
|
|
3463
3608
|
}, i.styleOptions && {
|
|
3464
3609
|
// Pass-through NLQ JSON; shape matches ChartStyleOptions.
|
|
3465
3610
|
styleOptions: i.styleOptions
|
|
3466
|
-
}),
|
|
3611
|
+
}), l && { filters: l }), d && { highlights: d })
|
|
3467
3612
|
};
|
|
3468
|
-
},
|
|
3613
|
+
}, ni = (e) => {
|
|
3469
3614
|
const t = [];
|
|
3470
3615
|
if (!e.chartType)
|
|
3471
3616
|
return {
|
|
@@ -3492,11 +3637,11 @@ const Qn = (e) => {
|
|
|
3492
3637
|
]
|
|
3493
3638
|
};
|
|
3494
3639
|
let r = null;
|
|
3495
|
-
const s =
|
|
3640
|
+
const s = Wn(e.dataOptions);
|
|
3496
3641
|
s.success ? r = s.data : t.push(...s.errors);
|
|
3497
3642
|
let n;
|
|
3498
3643
|
if (e.filters) {
|
|
3499
|
-
const u =
|
|
3644
|
+
const u = F(
|
|
3500
3645
|
() => ve(e.filters),
|
|
3501
3646
|
t
|
|
3502
3647
|
);
|
|
@@ -3504,15 +3649,15 @@ const Qn = (e) => {
|
|
|
3504
3649
|
}
|
|
3505
3650
|
let i;
|
|
3506
3651
|
if (e.highlights && e.highlights.length > 0) {
|
|
3507
|
-
const u =
|
|
3508
|
-
() =>
|
|
3652
|
+
const u = F(
|
|
3653
|
+
() => Ie(e.highlights),
|
|
3509
3654
|
t
|
|
3510
3655
|
);
|
|
3511
3656
|
i = u != null ? u : void 0;
|
|
3512
3657
|
}
|
|
3513
3658
|
if (t.length > 0 || r === null)
|
|
3514
3659
|
return { success: !1, errors: t };
|
|
3515
|
-
const
|
|
3660
|
+
const o = y(y(y({
|
|
3516
3661
|
chartType: e.chartType,
|
|
3517
3662
|
dataOptions: r
|
|
3518
3663
|
}, e.styleOptions && {
|
|
@@ -3521,11 +3666,11 @@ const Qn = (e) => {
|
|
|
3521
3666
|
return {
|
|
3522
3667
|
success: !0,
|
|
3523
3668
|
data: Q(
|
|
3524
|
-
|
|
3669
|
+
o
|
|
3525
3670
|
)
|
|
3526
3671
|
};
|
|
3527
3672
|
};
|
|
3528
|
-
function
|
|
3673
|
+
function Wn(e) {
|
|
3529
3674
|
const t = {}, r = [], s = /* @__PURE__ */ new Set(["seriesToColorMap", "boxType", "outliersEnabled", "valueTitle"]);
|
|
3530
3675
|
for (const [n, i] of Object.entries(e)) {
|
|
3531
3676
|
if (n === "seriesToColorMap" && i) {
|
|
@@ -3536,25 +3681,25 @@ function Bn(e) {
|
|
|
3536
3681
|
i != null && (t[n] = i);
|
|
3537
3682
|
continue;
|
|
3538
3683
|
}
|
|
3539
|
-
const
|
|
3540
|
-
for (let p = 0; p <
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
]) :
|
|
3684
|
+
const o = Array.isArray(i) ? i : [i], a = Array.isArray(i), u = [], c = [];
|
|
3685
|
+
for (let p = 0; p < o.length; p++) {
|
|
3686
|
+
const l = o[p], b = jn(l) ? Re([
|
|
3687
|
+
l
|
|
3688
|
+
]) : Pe([l]);
|
|
3544
3689
|
b.success ? u.push(...b.data) : b.errors.forEach((g) => {
|
|
3545
3690
|
var m;
|
|
3546
|
-
|
|
3691
|
+
c.push(w(y({}, g), { index: p, input: (m = g.input) != null ? m : l }));
|
|
3547
3692
|
});
|
|
3548
3693
|
}
|
|
3549
|
-
if (
|
|
3550
|
-
r.push(...
|
|
3694
|
+
if (c.length > 0) {
|
|
3695
|
+
r.push(...c);
|
|
3551
3696
|
continue;
|
|
3552
3697
|
}
|
|
3553
|
-
t[n] =
|
|
3698
|
+
t[n] = a ? u : u[0];
|
|
3554
3699
|
}
|
|
3555
3700
|
return r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3556
3701
|
}
|
|
3557
|
-
function
|
|
3702
|
+
function jn(e) {
|
|
3558
3703
|
const t = Array.isArray(e) ? e[0] : e;
|
|
3559
3704
|
if (!t || !S(t))
|
|
3560
3705
|
return !0;
|
|
@@ -3573,13 +3718,13 @@ function zn(e) {
|
|
|
3573
3718
|
}
|
|
3574
3719
|
return !("aggregation" in r || "attribute" in r && "aggregation" in r);
|
|
3575
3720
|
}
|
|
3576
|
-
const
|
|
3577
|
-
function
|
|
3721
|
+
const et = ["rows", "columns", "values", "grandTotals"];
|
|
3722
|
+
function Kn(e) {
|
|
3578
3723
|
if (!S(e)) return !1;
|
|
3579
3724
|
const t = Object.keys(e);
|
|
3580
3725
|
return t.every((r) => r === "rows" || r === "columns") && t.every((r) => typeof e[r] == "boolean");
|
|
3581
3726
|
}
|
|
3582
|
-
function
|
|
3727
|
+
function Gn(e) {
|
|
3583
3728
|
const t = [], r = {
|
|
3584
3729
|
dataOptions: {}
|
|
3585
3730
|
};
|
|
@@ -3592,37 +3737,37 @@ function Un(e) {
|
|
|
3592
3737
|
}), { normalized: r, errors: t };
|
|
3593
3738
|
const s = e.dataOptions;
|
|
3594
3739
|
if (s === void 0) {
|
|
3595
|
-
const n = Object.keys(e), i =
|
|
3740
|
+
const n = Object.keys(e), i = R("dataOptions", n, (u) => u), o = i && i.distance <= x ? ` Did you mean 'dataOptions'? (You may have typed '${i.best}')` : "", a = i && i.distance <= x ? { [i.best]: e[i.best] } : e;
|
|
3596
3741
|
t.push({
|
|
3597
3742
|
category: "dataOptions",
|
|
3598
3743
|
index: -1,
|
|
3599
|
-
input:
|
|
3600
|
-
message: `dataOptions is required.${
|
|
3744
|
+
input: a,
|
|
3745
|
+
message: `dataOptions is required.${o}`
|
|
3601
3746
|
});
|
|
3602
3747
|
} else if (S(s)) {
|
|
3603
3748
|
const n = s;
|
|
3604
3749
|
r.dataOptions = n;
|
|
3605
|
-
for (const
|
|
3606
|
-
if (!
|
|
3607
|
-
const
|
|
3750
|
+
for (const o of Object.keys(n))
|
|
3751
|
+
if (!et.includes(o)) {
|
|
3752
|
+
const a = R(o, [...et], (c) => c), u = a && a.distance <= x ? ` Did you mean '${a.best}'?` : "";
|
|
3608
3753
|
t.push({
|
|
3609
3754
|
category: "dataOptions",
|
|
3610
|
-
index:
|
|
3611
|
-
input: n[
|
|
3612
|
-
message: `Unknown dataOptions key '${
|
|
3755
|
+
index: o,
|
|
3756
|
+
input: n[o],
|
|
3757
|
+
message: `Unknown dataOptions key '${o}'. Valid keys: rows, columns, values, grandTotals.${u}`
|
|
3613
3758
|
});
|
|
3614
3759
|
}
|
|
3615
|
-
for (const
|
|
3616
|
-
const
|
|
3617
|
-
|
|
3760
|
+
for (const o of ["rows", "columns", "values"]) {
|
|
3761
|
+
const a = n[o];
|
|
3762
|
+
a != null && !Array.isArray(a) && t.push({
|
|
3618
3763
|
category: "dataOptions",
|
|
3619
|
-
index:
|
|
3620
|
-
input:
|
|
3621
|
-
message: `dataOptions.${
|
|
3764
|
+
index: o,
|
|
3765
|
+
input: a,
|
|
3766
|
+
message: `dataOptions.${o} must be an array`
|
|
3622
3767
|
});
|
|
3623
3768
|
}
|
|
3624
3769
|
const i = n.grandTotals;
|
|
3625
|
-
i != null && !
|
|
3770
|
+
i != null && !Kn(i) && t.push({
|
|
3626
3771
|
category: "dataOptions",
|
|
3627
3772
|
index: "grandTotals",
|
|
3628
3773
|
input: i,
|
|
@@ -3631,7 +3776,7 @@ function Un(e) {
|
|
|
3631
3776
|
}
|
|
3632
3777
|
return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
|
|
3633
3778
|
}
|
|
3634
|
-
function
|
|
3779
|
+
function Yn(e, t, r) {
|
|
3635
3780
|
if (!e || typeof e != "object")
|
|
3636
3781
|
return r.push({
|
|
3637
3782
|
category: "dataOptions",
|
|
@@ -3640,15 +3785,15 @@ function _n(e, t, r) {
|
|
|
3640
3785
|
message: "dataOptions is required"
|
|
3641
3786
|
}), null;
|
|
3642
3787
|
const s = {}, n = r.length;
|
|
3643
|
-
for (const
|
|
3644
|
-
const
|
|
3645
|
-
|
|
3646
|
-
e[
|
|
3788
|
+
for (const o of ["rows", "columns"]) {
|
|
3789
|
+
const a = re(
|
|
3790
|
+
o,
|
|
3791
|
+
e[o],
|
|
3647
3792
|
"dimension",
|
|
3648
3793
|
t,
|
|
3649
3794
|
r
|
|
3650
3795
|
);
|
|
3651
|
-
|
|
3796
|
+
a && (s[o] = a);
|
|
3652
3797
|
}
|
|
3653
3798
|
const i = re(
|
|
3654
3799
|
"values",
|
|
@@ -3659,41 +3804,41 @@ function _n(e, t, r) {
|
|
|
3659
3804
|
);
|
|
3660
3805
|
return i && (s.values = i), e.grandTotals !== void 0 && (s.grandTotals = e.grandTotals), r.length > n ? null : s;
|
|
3661
3806
|
}
|
|
3662
|
-
const
|
|
3663
|
-
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors:
|
|
3664
|
-
if (
|
|
3665
|
-
return { success: !1, errors:
|
|
3666
|
-
const
|
|
3807
|
+
const ii = (e) => {
|
|
3808
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = Gn(t);
|
|
3809
|
+
if (o.length > 0)
|
|
3810
|
+
return { success: !1, errors: o };
|
|
3811
|
+
const a = xe(n), u = [], c = Yn(
|
|
3667
3812
|
i.dataOptions,
|
|
3668
|
-
{ dataSource: s, schemaIndex:
|
|
3813
|
+
{ dataSource: s, schemaIndex: a },
|
|
3669
3814
|
u
|
|
3670
3815
|
);
|
|
3671
3816
|
let p = null;
|
|
3672
|
-
i.filters && i.filters.length > 0 && (p =
|
|
3673
|
-
() =>
|
|
3817
|
+
i.filters && i.filters.length > 0 && (p = F(
|
|
3818
|
+
() => Me({
|
|
3674
3819
|
data: i.filters || [],
|
|
3675
|
-
context: { dataSource: s, schemaIndex:
|
|
3820
|
+
context: { dataSource: s, schemaIndex: a }
|
|
3676
3821
|
}),
|
|
3677
3822
|
u
|
|
3678
3823
|
));
|
|
3679
|
-
let
|
|
3680
|
-
return i.highlights && i.highlights.length > 0 && (
|
|
3681
|
-
() =>
|
|
3824
|
+
let l = null;
|
|
3825
|
+
return i.highlights && i.highlights.length > 0 && (l = F(
|
|
3826
|
+
() => Ne({
|
|
3682
3827
|
data: i.highlights || [],
|
|
3683
|
-
context: { dataSource: s, schemaIndex:
|
|
3828
|
+
context: { dataSource: s, schemaIndex: a }
|
|
3684
3829
|
}),
|
|
3685
3830
|
u
|
|
3686
|
-
)), u.length > 0 ||
|
|
3831
|
+
)), u.length > 0 || c === null ? {
|
|
3687
3832
|
success: !1,
|
|
3688
3833
|
errors: u
|
|
3689
3834
|
} : {
|
|
3690
3835
|
success: !0,
|
|
3691
3836
|
data: y(y(y({
|
|
3692
|
-
dataSet:
|
|
3693
|
-
dataOptions:
|
|
3694
|
-
}, i.styleOptions && { styleOptions: i.styleOptions }), p && { filters: p }),
|
|
3837
|
+
dataSet: Ae(s),
|
|
3838
|
+
dataOptions: c
|
|
3839
|
+
}, i.styleOptions && { styleOptions: i.styleOptions }), p && { filters: p }), l && { highlights: l })
|
|
3695
3840
|
};
|
|
3696
|
-
},
|
|
3841
|
+
}, oi = (e) => {
|
|
3697
3842
|
const t = [];
|
|
3698
3843
|
if (!e.dataOptions)
|
|
3699
3844
|
return {
|
|
@@ -3708,49 +3853,49 @@ const Zn = (e) => {
|
|
|
3708
3853
|
]
|
|
3709
3854
|
};
|
|
3710
3855
|
const r = e.dataOptions, s = {};
|
|
3711
|
-
for (const
|
|
3712
|
-
const p = r[
|
|
3856
|
+
for (const c of ["rows", "columns"]) {
|
|
3857
|
+
const p = r[c];
|
|
3713
3858
|
if (p && p.length > 0) {
|
|
3714
|
-
const
|
|
3715
|
-
|
|
3859
|
+
const l = Ze(c, p, "dimension");
|
|
3860
|
+
l.success ? s[c] = l.data : t.push(...l.errors);
|
|
3716
3861
|
}
|
|
3717
3862
|
}
|
|
3718
3863
|
const n = r.values;
|
|
3719
3864
|
if (n && n.length > 0) {
|
|
3720
|
-
const
|
|
3721
|
-
|
|
3865
|
+
const c = Ze("values", n, "measure");
|
|
3866
|
+
c.success ? s.values = c.data : t.push(...c.errors);
|
|
3722
3867
|
}
|
|
3723
3868
|
r.grandTotals !== void 0 && (s.grandTotals = r.grandTotals);
|
|
3724
3869
|
let i;
|
|
3725
3870
|
if (e.filters) {
|
|
3726
|
-
const
|
|
3871
|
+
const c = F(
|
|
3727
3872
|
() => ve(e.filters),
|
|
3728
3873
|
t
|
|
3729
3874
|
);
|
|
3730
|
-
i =
|
|
3875
|
+
i = c != null ? c : void 0;
|
|
3731
3876
|
}
|
|
3732
|
-
let
|
|
3877
|
+
let o;
|
|
3733
3878
|
if (e.highlights && e.highlights.length > 0) {
|
|
3734
|
-
const
|
|
3735
|
-
() =>
|
|
3879
|
+
const c = F(
|
|
3880
|
+
() => Ie(e.highlights),
|
|
3736
3881
|
t
|
|
3737
3882
|
);
|
|
3738
|
-
|
|
3883
|
+
o = c != null ? c : void 0;
|
|
3739
3884
|
}
|
|
3740
3885
|
if (t.length > 0)
|
|
3741
3886
|
return { success: !1, errors: t };
|
|
3742
|
-
const
|
|
3887
|
+
const a = y(y(y({
|
|
3743
3888
|
dataOptions: s
|
|
3744
|
-
}, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }),
|
|
3889
|
+
}, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }), o && o.length > 0 && { highlights: o });
|
|
3745
3890
|
return {
|
|
3746
3891
|
success: !0,
|
|
3747
3892
|
data: Q(
|
|
3748
|
-
|
|
3893
|
+
a
|
|
3749
3894
|
)
|
|
3750
3895
|
};
|
|
3751
3896
|
};
|
|
3752
|
-
function
|
|
3753
|
-
const { filters: t, relations: r } =
|
|
3897
|
+
function Jn(e) {
|
|
3898
|
+
const { filters: t, relations: r } = _r(
|
|
3754
3899
|
e.filters || []
|
|
3755
3900
|
);
|
|
3756
3901
|
return {
|
|
@@ -3763,23 +3908,23 @@ function Vn(e) {
|
|
|
3763
3908
|
// No count/offset/ungroup - these are execution concerns, not translation concerns
|
|
3764
3909
|
};
|
|
3765
3910
|
}
|
|
3766
|
-
function
|
|
3767
|
-
const s =
|
|
3768
|
-
return
|
|
3911
|
+
function ai(e, t, r = !1) {
|
|
3912
|
+
const s = Jn(e), n = Lr(s, t);
|
|
3913
|
+
return Ur(n, r);
|
|
3769
3914
|
}
|
|
3770
3915
|
export {
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3916
|
+
ei as CustomSuperJSON,
|
|
3917
|
+
li as EMPTY_EXPANDED_QUERY_MODEL,
|
|
3918
|
+
fi as EMPTY_SIMPLE_QUERY_MODEL,
|
|
3919
|
+
di as isByIdDashboardCodeParams,
|
|
3920
|
+
mi as isByIdWidgetCodeParams,
|
|
3921
|
+
pi as isClientSideDashboardCodeParams,
|
|
3922
|
+
gi as isClientSideWidgetCodeParams,
|
|
3923
|
+
si as translateChartFromJSON,
|
|
3924
|
+
ni as translateChartToJSON,
|
|
3925
|
+
ii as translatePivotTableFromJSON,
|
|
3926
|
+
oi as translatePivotTableToJSON,
|
|
3927
|
+
ti as translateQueryFromJSON,
|
|
3928
|
+
ri as translateQueryToJSON,
|
|
3929
|
+
ai as translateQueryToJaql
|
|
3785
3930
|
};
|