@sisense/sdk-ui 2.28.0 → 2.29.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 +1 -1
- package/dist/ai.js +5 -5
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +1256 -1203
- package/dist/analytics-composer.cjs +7 -7
- package/dist/analytics-composer.js +19 -18
- package/dist/apply-styled-options-to-query-CaP4IMrQ.js +6379 -0
- package/dist/apply-styled-options-to-query-D5D8pRl2.cjs +1 -0
- package/dist/index.cjs +398 -398
- package/dist/index.js +22490 -21772
- package/dist/index.umd.js +700 -700
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/get-dashboard-model.d.ts +7 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/translate-dashboard-utils.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +10 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +29 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-updates-persistence.d.ts +27 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/deep-merge.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +15 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/update-types.d.ts +51 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/data.d.ts +0 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data/filter-and-aggregate-chart-data.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/types.d.ts +27 -23
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/utils.d.ts +4 -4
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/filter-to-readable-label.d.ts +14 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +5 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +5 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/truncate-pill-label.d.ts +10 -0
- package/dist/packages/sdk-ui/src/domains/widgets/change-events.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/types.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/pivot-table-widget.d.ts +15 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +41 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/types.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-track-widget-init.d.ts +44 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/widget-entity-id.d.ts +30 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/widget-tracking-adapters.d.ts +41 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-style-utils.d.ts +29 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/to-widget-dto-panels.d.ts +29 -1
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +1 -7
- package/dist/packages/sdk-ui/src/infra/app/settings/types/features.d.ts +1 -9
- package/dist/packages/sdk-ui/src/infra/app/types.d.ts +14 -0
- package/dist/packages/sdk-ui/src/infra/contexts/sisense-context/sisense-context-provider.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/formatting/format-data-set.d.ts +21 -0
- package/dist/packages/sdk-ui/src/infra/formatting/format-date.d.ts +67 -0
- package/dist/packages/sdk-ui/src/infra/formatting/format-number.d.ts +24 -0
- package/dist/packages/sdk-ui/src/infra/formatting/index.d.ts +5 -0
- package/dist/packages/sdk-ui/src/infra/modules/build-module-graph.d.ts +31 -0
- package/dist/packages/sdk-ui/src/infra/modules/build-module-registry.d.ts +31 -0
- package/dist/packages/sdk-ui/src/infra/modules/core-module-providers-tree.d.ts +11 -0
- package/dist/packages/sdk-ui/src/infra/modules/core-module.d.ts +26 -0
- package/dist/packages/sdk-ui/src/infra/modules/index.d.ts +3 -0
- package/dist/packages/sdk-ui/src/infra/modules/module-provider.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/modules/modules-context.d.ts +20 -0
- package/dist/packages/sdk-ui/src/infra/modules/types.d.ts +79 -0
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +52 -2
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/widget-plugin-registry.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/get-dimension-name.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/translate-dimensions-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/filters/get-filter-name.d.ts +10 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/filters/translate-filters-to-json.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/get-query-element-summary.d.ts +23 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/measures/get-measure-name.d.ts +10 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/measures/translate-measures-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/index.d.ts +3 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/translate-query-from-json.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/translate-query-to-json.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/adapters.d.ts +3 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +70 -9
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/widget/helpers/to-widget-props.d.ts +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/widget/helpers/translate-envelope-widget-from-json.d.ts +2 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/types.d.ts +1 -18
- package/dist/packages/sdk-ui/src/props.d.ts +9 -0
- package/dist/packages/sdk-ui/src/public-api/alpha.d.ts +3 -0
- package/dist/packages/sdk-ui/src/public-api/public.d.ts +3 -1
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +1 -1
- package/dist/packages/sdk-ui/src/shared/components/loading-overlay.d.ts +1 -0
- package/dist/packages/sdk-ui/src/shared/hooks/use-element-height.d.ts +19 -0
- package/dist/packages/sdk-ui/src/shared/hooks/use-synced-state.d.ts +23 -2
- package/dist/packages/sdk-ui/src/shared/utils/filter-relations.d.ts +8 -0
- package/dist/packages/sdk-ui/src/shared/utils/gradient.d.ts +5 -0
- package/dist/types-7YG0uOzO.js +74 -0
- package/dist/{types-CzgBH2kL.cjs → types-DlYJ_DZ0.cjs} +1 -1
- package/dist/{use-hover-CaSOzp0i.cjs → use-hover-CANskYrn.cjs} +127 -127
- package/dist/{use-hover-B6VmMb06.js → use-hover-Dju4Dcv3.js} +11021 -10942
- package/dist/{utils-CsV-iYtb.js → utils-BKRpWUGm.js} +1061 -1058
- package/dist/{utils-BwGnDoB0.cjs → utils-C4PIba42.cjs} +10 -10
- package/dist/{widget-composer-C72Io-3c.cjs → widget-composer-BXEyx308.cjs} +1 -1
- package/dist/{widget-composer-Bv_OVu1o.js → widget-composer-DRDw1oBF.js} +3 -3
- package/package.json +9 -8
- package/dist/apply-styled-options-to-query-23D9br-S.cjs +0 -1
- package/dist/apply-styled-options-to-query-BagjzMqm.js +0 -5992
- package/dist/dimensions-Bn1EaWiP.js +0 -204
- package/dist/dimensions-D8r34WRI.cjs +0 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-scroll-persistence.d.ts +0 -16
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/with-navigator-scroll-save.d.ts +0 -10
- package/dist/types-D3fPN43o.js +0 -74
|
@@ -1,54 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var ur = Object.defineProperty, cr = Object.defineProperties;
|
|
2
|
+
var lr = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ae = Object.getOwnPropertySymbols;
|
|
4
|
+
var Je = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var je = (e, t, r) => t in e ? ur(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, l = (e, t) => {
|
|
6
6
|
for (var r in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
10
|
-
|
|
7
|
+
Je.call(t, r) && je(e, r, t[r]);
|
|
8
|
+
if (ae)
|
|
9
|
+
for (var r of ae(t))
|
|
10
|
+
Ke.call(t, r) && je(e, r, t[r]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, E = (e, t) => cr(e, lr(t));
|
|
13
|
+
var Fe = (e, t) => {
|
|
14
14
|
var r = {};
|
|
15
15
|
for (var s in e)
|
|
16
|
-
|
|
17
|
-
if (e != null &&
|
|
18
|
-
for (var s of
|
|
19
|
-
t.indexOf(s) < 0 &&
|
|
16
|
+
Je.call(e, s) && t.indexOf(s) < 0 && (r[s] = e[s]);
|
|
17
|
+
if (e != null && ae)
|
|
18
|
+
for (var s of ae(e))
|
|
19
|
+
t.indexOf(s) < 0 && Ke.call(e, s) && (r[s] = e[s]);
|
|
20
20
|
return r;
|
|
21
21
|
};
|
|
22
|
-
import { f as
|
|
23
|
-
import { b as
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
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));
|
|
22
|
+
import { f as fr, J as dr } from "../types-7YG0uOzO.js";
|
|
23
|
+
import { b as Ki, E as Gi, a as Yi, i as Hi, e as Qi, d as Xi } from "../types-7YG0uOzO.js";
|
|
24
|
+
import { ci as mr, bq as pr, cj as gr, ck as yr, cl as hr, cm as br, cn as Fr, at as ve, co as Er, as as Ar, cp as Tr, b9 as wr, au as Sr, cq as Cr, bc as Or, ba as qr, aM as $r, b8 as Dr, bb as xr, cr as Nr, aq as vr, bp as Mr, cs as Rr, e as Ir, ct as kr, cu as Lr, cv as Br, cw as zr, cx as Ur, cy as _r, cz as Pr, cA as Wr, cB as Vr, cC as jr, cD as Jr, al as Kr, cE as Gr, cF as Yr, ap as U, l as te, b as Hr, x as q, a1 as Qr, ad as _, ao as pt, cG as Xr, cH as Zr, cI as es, M as j, cb as ts, cJ as rs, aI as ss, af as Ge, ar as de, cf as ns, cg as is, bO as gt, cK as yt, a8 as as, cL as ht, cM as bt, A as os, bY as Ft, cN as us, bF as cs, aA as ls } from "../apply-styled-options-to-query-CaP4IMrQ.js";
|
|
25
|
+
function fs(e, t) {
|
|
26
|
+
const r = e.length, s = t.length, n = Array.from({ length: r + 1 }, (i, a) => Array.from({ length: s + 1 }, (o, u) => a === 0 ? u : u === 0 ? a : 0));
|
|
28
27
|
for (let i = 1; i <= r; i++)
|
|
29
|
-
for (let
|
|
30
|
-
n[i][
|
|
28
|
+
for (let a = 1; a <= s; a++)
|
|
29
|
+
n[i][a] = Math.min(n[i - 1][a] + 1, n[i][a - 1] + 1, n[i - 1][a - 1] + (e[i - 1] === t[a - 1] ? 0 : 1));
|
|
31
30
|
return n[r][s];
|
|
32
31
|
}
|
|
33
|
-
function
|
|
32
|
+
function Me(e, t) {
|
|
34
33
|
const r = [];
|
|
35
|
-
let s = "", n = 0, i = !1,
|
|
36
|
-
for (let
|
|
37
|
-
const u = e[
|
|
34
|
+
let s = "", n = 0, i = !1, a = null;
|
|
35
|
+
for (let o = 0; o < e.length; o++) {
|
|
36
|
+
const u = e[o], c = e[o + 1];
|
|
38
37
|
if (i) {
|
|
39
|
-
if (u !==
|
|
38
|
+
if (u !== a) {
|
|
40
39
|
s += u;
|
|
41
40
|
continue;
|
|
42
41
|
}
|
|
43
|
-
if (c ===
|
|
44
|
-
s += u + c,
|
|
42
|
+
if (c === a) {
|
|
43
|
+
s += u + c, o++;
|
|
45
44
|
continue;
|
|
46
45
|
}
|
|
47
|
-
i = !1,
|
|
46
|
+
i = !1, a = null, s += u;
|
|
48
47
|
continue;
|
|
49
48
|
} else {
|
|
50
49
|
if (u === "'" || u === '"') {
|
|
51
|
-
i = !0,
|
|
50
|
+
i = !0, a = u, s += u;
|
|
52
51
|
continue;
|
|
53
52
|
}
|
|
54
53
|
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
@@ -60,58 +59,58 @@ function xe(e, t) {
|
|
|
60
59
|
}
|
|
61
60
|
return s.trim() && r.push(s.trim()), r;
|
|
62
61
|
}
|
|
63
|
-
function
|
|
62
|
+
function ds(e, t) {
|
|
64
63
|
let r = 0, s = !1, n = null;
|
|
65
64
|
for (let i = 0; i < e.length; i++) {
|
|
66
|
-
const
|
|
65
|
+
const a = e[i], o = e[i + 1];
|
|
67
66
|
if (s) {
|
|
68
|
-
if (
|
|
67
|
+
if (a !== n)
|
|
69
68
|
continue;
|
|
70
|
-
if (
|
|
69
|
+
if (o === n) {
|
|
71
70
|
i++;
|
|
72
71
|
continue;
|
|
73
72
|
}
|
|
74
73
|
s = !1, n = null;
|
|
75
74
|
} else {
|
|
76
|
-
if (
|
|
77
|
-
s = !0, n =
|
|
75
|
+
if (a === "'" || a === '"') {
|
|
76
|
+
s = !0, n = a;
|
|
78
77
|
continue;
|
|
79
78
|
}
|
|
80
|
-
if ("([{".includes(
|
|
79
|
+
if ("([{".includes(a) && r++, ")]}".includes(a) && r--, a === t && r === 0)
|
|
81
80
|
return i;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
return -1;
|
|
85
84
|
}
|
|
86
|
-
function
|
|
85
|
+
function ms(e, t) {
|
|
87
86
|
if (e[t] !== "(")
|
|
88
87
|
return -1;
|
|
89
88
|
let r = 1, s = t + 1, n = !1, i = null;
|
|
90
89
|
for (; s < e.length; ) {
|
|
91
|
-
const
|
|
90
|
+
const a = e[s], o = e[s + 1];
|
|
92
91
|
if (n) {
|
|
93
|
-
if (
|
|
92
|
+
if (a !== i) {
|
|
94
93
|
s++;
|
|
95
94
|
continue;
|
|
96
95
|
}
|
|
97
|
-
if (
|
|
96
|
+
if (o === i) {
|
|
98
97
|
s += 2;
|
|
99
98
|
continue;
|
|
100
99
|
}
|
|
101
100
|
n = !1, i = null, s++;
|
|
102
101
|
} else {
|
|
103
|
-
if (
|
|
104
|
-
n = !0, i =
|
|
102
|
+
if (a === "'" || a === '"') {
|
|
103
|
+
n = !0, i = a, s++;
|
|
105
104
|
continue;
|
|
106
105
|
}
|
|
107
|
-
if ("([{".includes(
|
|
106
|
+
if ("([{".includes(a) && r++, ")]}".includes(a) && --r === 0)
|
|
108
107
|
return s;
|
|
109
108
|
s++;
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
return -1;
|
|
113
112
|
}
|
|
114
|
-
function
|
|
113
|
+
function ps(e) {
|
|
115
114
|
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
116
115
|
}
|
|
117
116
|
function J(e) {
|
|
@@ -123,16 +122,16 @@ function J(e) {
|
|
|
123
122
|
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
124
123
|
if (!r)
|
|
125
124
|
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
126
|
-
const s = r[1], n = r[2], i =
|
|
125
|
+
const s = r[1], n = r[2], i = Et(n);
|
|
127
126
|
return {
|
|
128
127
|
function: s,
|
|
129
128
|
args: i
|
|
130
129
|
};
|
|
131
130
|
}
|
|
132
|
-
function
|
|
133
|
-
return e.trim() ?
|
|
131
|
+
function Et(e) {
|
|
132
|
+
return e.trim() ? Me(e, ",").map(At) : [];
|
|
134
133
|
}
|
|
135
|
-
function
|
|
134
|
+
function At(e) {
|
|
136
135
|
if (!e)
|
|
137
136
|
throw new Error("Cannot parse empty argument value");
|
|
138
137
|
if (e === "null")
|
|
@@ -153,29 +152,29 @@ function yt(e) {
|
|
|
153
152
|
const r = e.slice(1, -1).trim();
|
|
154
153
|
if (!r)
|
|
155
154
|
return [];
|
|
156
|
-
const s =
|
|
155
|
+
const s = Et(r);
|
|
157
156
|
return s.every((n) => typeof n == "string"), s;
|
|
158
157
|
}
|
|
159
158
|
if (e.startsWith("{") && e.endsWith("}")) {
|
|
160
159
|
const r = e.slice(1, -1).trim();
|
|
161
|
-
return r ?
|
|
160
|
+
return r ? ys(r) : {};
|
|
162
161
|
}
|
|
163
162
|
return e.includes("(") && e.includes(")") ? J(e) : (e.startsWith("DM."), e);
|
|
164
163
|
}
|
|
165
|
-
function
|
|
166
|
-
const t =
|
|
164
|
+
function gs(e) {
|
|
165
|
+
const t = ds(e, ":");
|
|
167
166
|
if (t === -1)
|
|
168
167
|
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
169
|
-
const r =
|
|
168
|
+
const r = ps(e.slice(0, t).trim()), s = At(e.slice(t + 1).trim());
|
|
170
169
|
return [r, s];
|
|
171
170
|
}
|
|
172
|
-
function
|
|
171
|
+
function ys(e) {
|
|
173
172
|
if (!e.trim())
|
|
174
173
|
return {};
|
|
175
|
-
const t =
|
|
174
|
+
const t = Me(e, ",").map(gs).filter(([, r]) => r !== null);
|
|
176
175
|
return Object.fromEntries(t);
|
|
177
176
|
}
|
|
178
|
-
class
|
|
177
|
+
class hs {
|
|
179
178
|
constructor() {
|
|
180
179
|
this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
|
|
181
180
|
}
|
|
@@ -192,9 +191,9 @@ class fs {
|
|
|
192
191
|
this.keyToValue.clear(), this.valueToKey.clear();
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
|
-
class
|
|
194
|
+
class Tt {
|
|
196
195
|
constructor(t) {
|
|
197
|
-
this.generateIdentifier = t, this.kv = new
|
|
196
|
+
this.generateIdentifier = t, this.kv = new hs();
|
|
198
197
|
}
|
|
199
198
|
register(t, r) {
|
|
200
199
|
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
@@ -209,7 +208,7 @@ class ht {
|
|
|
209
208
|
return this.kv.getByKey(t);
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
|
-
class
|
|
211
|
+
class bs extends Tt {
|
|
213
212
|
constructor() {
|
|
214
213
|
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
215
214
|
}
|
|
@@ -220,7 +219,7 @@ class ps extends ht {
|
|
|
220
219
|
return this.classToAllowedProps.get(t);
|
|
221
220
|
}
|
|
222
221
|
}
|
|
223
|
-
function
|
|
222
|
+
function Fs(e) {
|
|
224
223
|
if ("values" in Object)
|
|
225
224
|
return Object.values(e);
|
|
226
225
|
const t = [];
|
|
@@ -228,8 +227,8 @@ function ms(e) {
|
|
|
228
227
|
e.hasOwnProperty(r) && t.push(e[r]);
|
|
229
228
|
return t;
|
|
230
229
|
}
|
|
231
|
-
function
|
|
232
|
-
const r =
|
|
230
|
+
function Es(e, t) {
|
|
231
|
+
const r = Fs(e);
|
|
233
232
|
if ("find" in r)
|
|
234
233
|
return r.find(t);
|
|
235
234
|
const s = r;
|
|
@@ -245,14 +244,14 @@ function K(e, t) {
|
|
|
245
244
|
function oe(e, t) {
|
|
246
245
|
return e.indexOf(t) !== -1;
|
|
247
246
|
}
|
|
248
|
-
function
|
|
247
|
+
function Ye(e, t) {
|
|
249
248
|
for (let r = 0; r < e.length; r++) {
|
|
250
249
|
const s = e[r];
|
|
251
250
|
if (t(s))
|
|
252
251
|
return s;
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
|
-
class
|
|
254
|
+
class As {
|
|
256
255
|
constructor() {
|
|
257
256
|
this.transfomers = {};
|
|
258
257
|
}
|
|
@@ -260,13 +259,13 @@ class ys {
|
|
|
260
259
|
this.transfomers[t.name] = t;
|
|
261
260
|
}
|
|
262
261
|
findApplicable(t) {
|
|
263
|
-
return
|
|
262
|
+
return Es(this.transfomers, (r) => r.isApplicable(t));
|
|
264
263
|
}
|
|
265
264
|
findByName(t) {
|
|
266
265
|
return this.transfomers[t];
|
|
267
266
|
}
|
|
268
267
|
}
|
|
269
|
-
const
|
|
268
|
+
const Ts = (e) => Object.prototype.toString.call(e).slice(8, -1), wt = (e) => typeof e == "undefined", ws = (e) => e === null, Q = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Ce = (e) => Q(e) && Object.keys(e).length === 0, k = (e) => Array.isArray(e), Ss = (e) => typeof e == "string", Cs = (e) => typeof e == "number" && !isNaN(e), Os = (e) => typeof e == "boolean", qs = (e) => e instanceof RegExp, X = (e) => e instanceof Map, Z = (e) => e instanceof Set, St = (e) => Ts(e) === "Symbol", $s = (e) => e instanceof Date && !isNaN(e.valueOf()), Ds = (e) => e instanceof Error, He = (e) => typeof e == "number" && isNaN(e), xs = (e) => Os(e) || ws(e) || wt(e) || Cs(e) || Ss(e) || St(e), Ns = (e) => typeof e == "bigint", vs = (e) => e === 1 / 0 || e === -1 / 0, Ms = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Rs = (e) => e instanceof URL, Ct = (e) => e.replace(/\./g, "\\."), Ee = (e) => e.map(String).map(Ct).join("."), Y = (e) => {
|
|
270
269
|
const t = [];
|
|
271
270
|
let r = "";
|
|
272
271
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -292,12 +291,12 @@ function I(e, t, r, s) {
|
|
|
292
291
|
untransform: s
|
|
293
292
|
};
|
|
294
293
|
}
|
|
295
|
-
const
|
|
296
|
-
I(
|
|
294
|
+
const Ot = [
|
|
295
|
+
I(wt, "undefined", () => null, () => {
|
|
297
296
|
}),
|
|
298
|
-
I(
|
|
299
|
-
I(
|
|
300
|
-
I(
|
|
297
|
+
I(Ns, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
298
|
+
I($s, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
299
|
+
I(Ds, "Error", (e, t) => {
|
|
301
300
|
const r = {
|
|
302
301
|
name: e.name,
|
|
303
302
|
message: e.message
|
|
@@ -311,24 +310,24 @@ const At = [
|
|
|
311
310
|
r[s] = e[s];
|
|
312
311
|
}), r;
|
|
313
312
|
}),
|
|
314
|
-
I(
|
|
313
|
+
I(qs, "regexp", (e) => "" + e, (e) => {
|
|
315
314
|
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
316
315
|
return new RegExp(t, r);
|
|
317
316
|
}),
|
|
318
317
|
I(
|
|
319
|
-
|
|
318
|
+
Z,
|
|
320
319
|
"set",
|
|
321
320
|
// (sets only exist in es6+)
|
|
322
321
|
// eslint-disable-next-line es5/no-es6-methods
|
|
323
322
|
(e) => [...e.values()],
|
|
324
323
|
(e) => new Set(e)
|
|
325
324
|
),
|
|
326
|
-
I(
|
|
327
|
-
I((e) =>
|
|
325
|
+
I(X, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
326
|
+
I((e) => He(e) || vs(e), "number", (e) => He(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
328
327
|
I((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
329
|
-
I(
|
|
328
|
+
I(Rs, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
330
329
|
];
|
|
331
|
-
function
|
|
330
|
+
function me(e, t, r, s) {
|
|
332
331
|
return {
|
|
333
332
|
isApplicable: e,
|
|
334
333
|
annotation: t,
|
|
@@ -336,12 +335,12 @@ function de(e, t, r, s) {
|
|
|
336
335
|
untransform: s
|
|
337
336
|
};
|
|
338
337
|
}
|
|
339
|
-
const
|
|
338
|
+
const qt = me((e, t) => St(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
340
339
|
const s = r.symbolRegistry.getValue(t[1]);
|
|
341
340
|
if (!s)
|
|
342
341
|
throw new Error("Trying to deserialize unknown symbol");
|
|
343
342
|
return s;
|
|
344
|
-
}),
|
|
343
|
+
}), Is = [
|
|
345
344
|
Int8Array,
|
|
346
345
|
Uint8Array,
|
|
347
346
|
Int16Array,
|
|
@@ -351,16 +350,16 @@ const wt = de((e, t) => Et(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t)
|
|
|
351
350
|
Float32Array,
|
|
352
351
|
Float64Array,
|
|
353
352
|
Uint8ClampedArray
|
|
354
|
-
].reduce((e, t) => (e[t.name] = t, e), {}),
|
|
355
|
-
const r =
|
|
353
|
+
].reduce((e, t) => (e[t.name] = t, e), {}), $t = me(Ms, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
354
|
+
const r = Is[t[1]];
|
|
356
355
|
if (!r)
|
|
357
356
|
throw new Error("Trying to deserialize unknown typed array");
|
|
358
357
|
return new r(e);
|
|
359
358
|
});
|
|
360
|
-
function
|
|
359
|
+
function Dt(e, t) {
|
|
361
360
|
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
|
|
362
361
|
}
|
|
363
|
-
const
|
|
362
|
+
const xt = me(Dt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
364
363
|
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
365
364
|
if (!r)
|
|
366
365
|
return l({}, e);
|
|
@@ -373,44 +372,44 @@ const Ct = de(St, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructo
|
|
|
373
372
|
if (!s)
|
|
374
373
|
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
375
374
|
return Object.assign(Object.create(s.prototype), e);
|
|
376
|
-
}),
|
|
375
|
+
}), Nt = me((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) => {
|
|
377
376
|
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
378
377
|
if (!s)
|
|
379
378
|
throw new Error("Trying to deserialize unknown custom value");
|
|
380
379
|
return s.deserialize(e);
|
|
381
|
-
}),
|
|
382
|
-
const r =
|
|
380
|
+
}), ks = [xt, qt, Nt, $t], Qe = (e, t) => {
|
|
381
|
+
const r = Ye(ks, (n) => n.isApplicable(e, t));
|
|
383
382
|
if (r)
|
|
384
383
|
return {
|
|
385
384
|
value: r.transform(e, t),
|
|
386
385
|
type: r.annotation(e, t)
|
|
387
386
|
};
|
|
388
|
-
const s =
|
|
387
|
+
const s = Ye(Ot, (n) => n.isApplicable(e, t));
|
|
389
388
|
if (s)
|
|
390
389
|
return {
|
|
391
390
|
value: s.transform(e, t),
|
|
392
391
|
type: s.annotation
|
|
393
392
|
};
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
|
|
393
|
+
}, vt = {};
|
|
394
|
+
Ot.forEach((e) => {
|
|
395
|
+
vt[e.annotation] = e;
|
|
397
396
|
});
|
|
398
|
-
const
|
|
397
|
+
const Ls = (e, t, r) => {
|
|
399
398
|
if (k(t))
|
|
400
399
|
switch (t[0]) {
|
|
401
400
|
case "symbol":
|
|
402
|
-
return
|
|
401
|
+
return qt.untransform(e, t, r);
|
|
403
402
|
case "class":
|
|
404
|
-
return
|
|
403
|
+
return xt.untransform(e, t, r);
|
|
405
404
|
case "custom":
|
|
406
|
-
return
|
|
405
|
+
return Nt.untransform(e, t, r);
|
|
407
406
|
case "typed-array":
|
|
408
|
-
return
|
|
407
|
+
return $t.untransform(e, t, r);
|
|
409
408
|
default:
|
|
410
409
|
throw new Error("Unknown transformation: " + t);
|
|
411
410
|
}
|
|
412
411
|
else {
|
|
413
|
-
const s =
|
|
412
|
+
const s = vt[t];
|
|
414
413
|
if (!s)
|
|
415
414
|
throw new Error("Unknown transformation: " + t);
|
|
416
415
|
return s.untransform(e, r);
|
|
@@ -423,7 +422,7 @@ const Ns = (e, t, r) => {
|
|
|
423
422
|
r.next(), t--;
|
|
424
423
|
return r.next().value;
|
|
425
424
|
};
|
|
426
|
-
function
|
|
425
|
+
function Mt(e) {
|
|
427
426
|
if (oe(e, "__proto__"))
|
|
428
427
|
throw new Error("__proto__ is not allowed as a property");
|
|
429
428
|
if (oe(e, "prototype"))
|
|
@@ -431,44 +430,44 @@ function Ot(e) {
|
|
|
431
430
|
if (oe(e, "constructor"))
|
|
432
431
|
throw new Error("constructor is not allowed as a property");
|
|
433
432
|
}
|
|
434
|
-
const
|
|
435
|
-
|
|
433
|
+
const Bs = (e, t) => {
|
|
434
|
+
Mt(t);
|
|
436
435
|
for (let r = 0; r < t.length; r++) {
|
|
437
436
|
const s = t[r];
|
|
438
|
-
if (
|
|
437
|
+
if (Z(e))
|
|
439
438
|
e = V(e, +s);
|
|
440
|
-
else if (
|
|
441
|
-
const n = +s, i = +t[++r] == 0 ? "key" : "value",
|
|
439
|
+
else if (X(e)) {
|
|
440
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", a = V(e, n);
|
|
442
441
|
switch (i) {
|
|
443
442
|
case "key":
|
|
444
|
-
e =
|
|
443
|
+
e = a;
|
|
445
444
|
break;
|
|
446
445
|
case "value":
|
|
447
|
-
e = e.get(
|
|
446
|
+
e = e.get(a);
|
|
448
447
|
break;
|
|
449
448
|
}
|
|
450
449
|
} else
|
|
451
450
|
e = e[s];
|
|
452
451
|
}
|
|
453
452
|
return e;
|
|
454
|
-
},
|
|
455
|
-
if (
|
|
453
|
+
}, Oe = (e, t, r) => {
|
|
454
|
+
if (Mt(t), t.length === 0)
|
|
456
455
|
return r(e);
|
|
457
456
|
let s = e;
|
|
458
457
|
for (let i = 0; i < t.length - 1; i++) {
|
|
459
|
-
const
|
|
458
|
+
const a = t[i];
|
|
460
459
|
if (k(s)) {
|
|
461
|
-
const
|
|
462
|
-
s = s[a];
|
|
463
|
-
} else if (H(s))
|
|
460
|
+
const o = +a;
|
|
464
461
|
s = s[o];
|
|
465
|
-
else if (
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
462
|
+
} else if (Q(s))
|
|
463
|
+
s = s[a];
|
|
464
|
+
else if (Z(s)) {
|
|
465
|
+
const o = +a;
|
|
466
|
+
s = V(s, o);
|
|
467
|
+
} else if (X(s)) {
|
|
469
468
|
if (i === t.length - 2)
|
|
470
469
|
break;
|
|
471
|
-
const u = +
|
|
470
|
+
const u = +a, c = +t[++i] == 0 ? "key" : "value", g = V(s, u);
|
|
472
471
|
switch (c) {
|
|
473
472
|
case "key":
|
|
474
473
|
s = g;
|
|
@@ -480,130 +479,130 @@ const Ms = (e, t) => {
|
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
481
|
const n = t[t.length - 1];
|
|
483
|
-
if (k(s) ? s[+n] = r(s[+n]) :
|
|
484
|
-
const i = V(s, +n),
|
|
485
|
-
i !==
|
|
482
|
+
if (k(s) ? s[+n] = r(s[+n]) : Q(s) && (s[n] = r(s[n])), Z(s)) {
|
|
483
|
+
const i = V(s, +n), a = r(i);
|
|
484
|
+
i !== a && (s.delete(i), s.add(a));
|
|
486
485
|
}
|
|
487
|
-
if (
|
|
488
|
-
const i = +t[t.length - 2],
|
|
486
|
+
if (X(s)) {
|
|
487
|
+
const i = +t[t.length - 2], a = V(s, i);
|
|
489
488
|
switch (+n == 0 ? "key" : "value") {
|
|
490
489
|
case "key": {
|
|
491
|
-
const u = r(
|
|
492
|
-
s.set(u, s.get(
|
|
490
|
+
const u = r(a);
|
|
491
|
+
s.set(u, s.get(a)), u !== a && s.delete(a);
|
|
493
492
|
break;
|
|
494
493
|
}
|
|
495
494
|
case "value": {
|
|
496
|
-
s.set(
|
|
495
|
+
s.set(a, r(s.get(a)));
|
|
497
496
|
break;
|
|
498
497
|
}
|
|
499
498
|
}
|
|
500
499
|
}
|
|
501
500
|
return e;
|
|
502
501
|
};
|
|
503
|
-
function
|
|
502
|
+
function qe(e, t, r = []) {
|
|
504
503
|
if (!e)
|
|
505
504
|
return;
|
|
506
505
|
if (!k(e)) {
|
|
507
|
-
K(e, (i,
|
|
506
|
+
K(e, (i, a) => qe(i, t, [...r, ...Y(a)]));
|
|
508
507
|
return;
|
|
509
508
|
}
|
|
510
509
|
const [s, n] = e;
|
|
511
|
-
n && K(n, (i,
|
|
512
|
-
|
|
510
|
+
n && K(n, (i, a) => {
|
|
511
|
+
qe(i, t, [...r, ...Y(a)]);
|
|
513
512
|
}), t(s, r);
|
|
514
513
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
517
|
-
e =
|
|
514
|
+
function zs(e, t, r) {
|
|
515
|
+
return qe(t, (s, n) => {
|
|
516
|
+
e = Oe(e, n, (i) => Ls(i, s, r));
|
|
518
517
|
}), e;
|
|
519
518
|
}
|
|
520
|
-
function
|
|
519
|
+
function Us(e, t) {
|
|
521
520
|
function r(s, n) {
|
|
522
|
-
const i =
|
|
523
|
-
s.map(Y).forEach((
|
|
524
|
-
e =
|
|
521
|
+
const i = Bs(e, Y(n));
|
|
522
|
+
s.map(Y).forEach((a) => {
|
|
523
|
+
e = Oe(e, a, () => i);
|
|
525
524
|
});
|
|
526
525
|
}
|
|
527
526
|
if (k(t)) {
|
|
528
527
|
const [s, n] = t;
|
|
529
528
|
s.forEach((i) => {
|
|
530
|
-
e =
|
|
529
|
+
e = Oe(e, Y(i), () => e);
|
|
531
530
|
}), n && K(n, r);
|
|
532
531
|
} else
|
|
533
532
|
K(t, r);
|
|
534
533
|
return e;
|
|
535
534
|
}
|
|
536
|
-
const
|
|
537
|
-
function
|
|
535
|
+
const _s = (e, t) => Q(e) || k(e) || X(e) || Z(e) || Dt(e, t);
|
|
536
|
+
function Ps(e, t, r) {
|
|
538
537
|
const s = r.get(e);
|
|
539
538
|
s ? s.push(t) : r.set(e, [t]);
|
|
540
539
|
}
|
|
541
|
-
function
|
|
540
|
+
function Ws(e, t) {
|
|
542
541
|
const r = {};
|
|
543
542
|
let s;
|
|
544
543
|
return e.forEach((n) => {
|
|
545
544
|
if (n.length <= 1)
|
|
546
545
|
return;
|
|
547
|
-
t || (n = n.map((
|
|
548
|
-
const [i, ...
|
|
549
|
-
i.length === 0 ? s =
|
|
550
|
-
}), s ?
|
|
546
|
+
t || (n = n.map((o) => o.map(String)).sort((o, u) => o.length - u.length));
|
|
547
|
+
const [i, ...a] = n;
|
|
548
|
+
i.length === 0 ? s = a.map(Ee) : r[Ee(i)] = a.map(Ee);
|
|
549
|
+
}), s ? Ce(r) ? [s] : [s, r] : Ce(r) ? void 0 : r;
|
|
551
550
|
}
|
|
552
|
-
const
|
|
551
|
+
const Rt = (e, t, r, s, n = [], i = [], a = /* @__PURE__ */ new Map()) => {
|
|
553
552
|
var h;
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
556
|
-
|
|
557
|
-
const b =
|
|
553
|
+
const o = xs(e);
|
|
554
|
+
if (!o) {
|
|
555
|
+
Ps(e, n, t);
|
|
556
|
+
const b = a.get(e);
|
|
558
557
|
if (b)
|
|
559
558
|
return s ? {
|
|
560
559
|
transformedValue: null
|
|
561
560
|
} : b;
|
|
562
561
|
}
|
|
563
|
-
if (!
|
|
564
|
-
const b =
|
|
562
|
+
if (!_s(e, r)) {
|
|
563
|
+
const b = Qe(e, r), m = b ? {
|
|
565
564
|
transformedValue: b.value,
|
|
566
565
|
annotations: [b.type]
|
|
567
566
|
} : {
|
|
568
567
|
transformedValue: e
|
|
569
568
|
};
|
|
570
|
-
return
|
|
569
|
+
return o || a.set(e, m), m;
|
|
571
570
|
}
|
|
572
571
|
if (oe(i, e))
|
|
573
572
|
return {
|
|
574
573
|
transformedValue: null
|
|
575
574
|
};
|
|
576
|
-
const u =
|
|
577
|
-
K(c, (b,
|
|
578
|
-
if (
|
|
579
|
-
throw new Error(`Detected property ${
|
|
580
|
-
const
|
|
581
|
-
g[
|
|
582
|
-
|
|
575
|
+
const u = Qe(e, r), c = (h = u == null ? void 0 : u.value) != null ? h : e, g = k(c) ? [] : {}, f = {};
|
|
576
|
+
K(c, (b, m) => {
|
|
577
|
+
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
578
|
+
throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);
|
|
579
|
+
const F = Rt(b, t, r, s, [...n, m], [...i, e], a);
|
|
580
|
+
g[m] = F.transformedValue, k(F.annotations) ? f[m] = F.annotations : Q(F.annotations) && K(F.annotations, (O, N) => {
|
|
581
|
+
f[Ct(m) + "." + N] = O;
|
|
583
582
|
});
|
|
584
583
|
});
|
|
585
|
-
const
|
|
584
|
+
const p = Ce(f) ? {
|
|
586
585
|
transformedValue: g,
|
|
587
586
|
annotations: u ? [u.type] : void 0
|
|
588
587
|
} : {
|
|
589
588
|
transformedValue: g,
|
|
590
|
-
annotations: u ? [u.type,
|
|
589
|
+
annotations: u ? [u.type, f] : f
|
|
591
590
|
};
|
|
592
|
-
return
|
|
591
|
+
return o || a.set(e, p), p;
|
|
593
592
|
};
|
|
594
|
-
function
|
|
593
|
+
function It(e) {
|
|
595
594
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
596
595
|
}
|
|
597
|
-
function
|
|
598
|
-
return
|
|
596
|
+
function Xe(e) {
|
|
597
|
+
return It(e) === "Array";
|
|
599
598
|
}
|
|
600
|
-
function
|
|
601
|
-
if (
|
|
599
|
+
function Vs(e) {
|
|
600
|
+
if (It(e) !== "Object")
|
|
602
601
|
return !1;
|
|
603
602
|
const t = Object.getPrototypeOf(e);
|
|
604
603
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
605
604
|
}
|
|
606
|
-
function
|
|
605
|
+
function js(e, t, r, s, n) {
|
|
607
606
|
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
608
607
|
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
609
608
|
value: r,
|
|
@@ -612,17 +611,17 @@ function Us(e, t, r, s, n) {
|
|
|
612
611
|
configurable: !0
|
|
613
612
|
});
|
|
614
613
|
}
|
|
615
|
-
function
|
|
616
|
-
if (
|
|
617
|
-
return e.map((n) =>
|
|
618
|
-
if (!
|
|
614
|
+
function $e(e, t = {}) {
|
|
615
|
+
if (Xe(e))
|
|
616
|
+
return e.map((n) => $e(n, t));
|
|
617
|
+
if (!Vs(e))
|
|
619
618
|
return e;
|
|
620
619
|
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
621
620
|
return [...r, ...s].reduce((n, i) => {
|
|
622
|
-
if (
|
|
621
|
+
if (Xe(t.props) && !t.props.includes(i))
|
|
623
622
|
return n;
|
|
624
|
-
const
|
|
625
|
-
return
|
|
623
|
+
const a = e[i], o = $e(a, t);
|
|
624
|
+
return js(n, i, o, e, t.nonenumerable), n;
|
|
626
625
|
}, {});
|
|
627
626
|
}
|
|
628
627
|
class y {
|
|
@@ -630,27 +629,27 @@ class y {
|
|
|
630
629
|
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
631
630
|
*/
|
|
632
631
|
constructor({ dedupe: t = !1 } = {}) {
|
|
633
|
-
this.classRegistry = new
|
|
632
|
+
this.classRegistry = new bs(), this.symbolRegistry = new Tt((r) => {
|
|
634
633
|
var s;
|
|
635
634
|
return (s = r.description) != null ? s : "";
|
|
636
|
-
}), this.customTransformerRegistry = new
|
|
635
|
+
}), this.customTransformerRegistry = new As(), this.allowedErrorProps = [], this.dedupe = t;
|
|
637
636
|
}
|
|
638
637
|
serialize(t) {
|
|
639
|
-
const r = /* @__PURE__ */ new Map(), s =
|
|
638
|
+
const r = /* @__PURE__ */ new Map(), s = Rt(t, r, this, this.dedupe), n = {
|
|
640
639
|
json: s.transformedValue
|
|
641
640
|
};
|
|
642
|
-
s.annotations && (n.meta =
|
|
641
|
+
s.annotations && (n.meta = E(l({}, n.meta), {
|
|
643
642
|
values: s.annotations
|
|
644
643
|
}));
|
|
645
|
-
const i =
|
|
646
|
-
return i && (n.meta =
|
|
644
|
+
const i = Ws(r, this.dedupe);
|
|
645
|
+
return i && (n.meta = E(l({}, n.meta), {
|
|
647
646
|
referentialEqualities: i
|
|
648
647
|
})), n;
|
|
649
648
|
}
|
|
650
649
|
deserialize(t) {
|
|
651
650
|
const { json: r, meta: s } = t;
|
|
652
|
-
let n =
|
|
653
|
-
return s != null && s.values && (n =
|
|
651
|
+
let n = $e(r);
|
|
652
|
+
return s != null && s.values && (n = zs(n, s.values, this)), s != null && s.referentialEqualities && (n = Us(n, s.referentialEqualities)), n;
|
|
654
653
|
}
|
|
655
654
|
stringify(t) {
|
|
656
655
|
return JSON.stringify(this.serialize(t));
|
|
@@ -682,7 +681,7 @@ y.registerClass = y.defaultInstance.registerClass.bind(y.defaultInstance);
|
|
|
682
681
|
y.registerSymbol = y.defaultInstance.registerSymbol.bind(y.defaultInstance);
|
|
683
682
|
y.registerCustom = y.defaultInstance.registerCustom.bind(y.defaultInstance);
|
|
684
683
|
y.allowErrorProps = y.defaultInstance.allowErrorProps.bind(y.defaultInstance);
|
|
685
|
-
const P = (e) => e === void 0 ? U.None : e,
|
|
684
|
+
const P = (e) => e === void 0 ? U.None : e, Js = (e) => new dr(e.metadataItem, e.type), Re = (e) => new Nr(
|
|
686
685
|
e.name,
|
|
687
686
|
e.expression,
|
|
688
687
|
e.type,
|
|
@@ -690,7 +689,7 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
690
689
|
P(e.sort),
|
|
691
690
|
e.dataSource,
|
|
692
691
|
e.composeCode
|
|
693
|
-
),
|
|
692
|
+
), Ie = (e) => new vr(
|
|
694
693
|
e.name,
|
|
695
694
|
e.expression,
|
|
696
695
|
e.granularity,
|
|
@@ -699,27 +698,27 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
699
698
|
P(e.sort),
|
|
700
699
|
e.dataSource,
|
|
701
700
|
e.composeCode
|
|
702
|
-
),
|
|
701
|
+
), v = (e) => {
|
|
703
702
|
switch (e.__serializable) {
|
|
704
703
|
case "DimensionalAttribute":
|
|
705
|
-
return
|
|
704
|
+
return Re(e);
|
|
706
705
|
case "DimensionalLevelAttribute":
|
|
707
|
-
return
|
|
706
|
+
return Ie(e);
|
|
708
707
|
default:
|
|
709
708
|
return e;
|
|
710
709
|
}
|
|
711
|
-
},
|
|
710
|
+
}, kt = (e) => new Mr(
|
|
712
711
|
e.name,
|
|
713
712
|
e.expression,
|
|
714
|
-
e.attributes.map(
|
|
715
|
-
e.dimensions.map(
|
|
713
|
+
e.attributes.map(v),
|
|
714
|
+
e.dimensions.map(Ks),
|
|
716
715
|
e.type,
|
|
717
716
|
e.description,
|
|
718
717
|
P(e.sort),
|
|
719
718
|
e.dataSource,
|
|
720
719
|
e.composeCode,
|
|
721
|
-
e.defaultAttribute ?
|
|
722
|
-
),
|
|
720
|
+
e.defaultAttribute ? v(e.defaultAttribute) : void 0
|
|
721
|
+
), Lt = (e) => new Rr(
|
|
723
722
|
e.name,
|
|
724
723
|
e.expression,
|
|
725
724
|
e.description,
|
|
@@ -728,44 +727,59 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
728
727
|
e.composeCode,
|
|
729
728
|
e.indexed,
|
|
730
729
|
e.merged
|
|
731
|
-
),
|
|
730
|
+
), Ks = (e) => {
|
|
732
731
|
switch (e.__serializable) {
|
|
733
732
|
case "DimensionalDimension":
|
|
734
|
-
return
|
|
733
|
+
return kt(e);
|
|
735
734
|
case "DimensionalDateDimension":
|
|
736
|
-
return
|
|
735
|
+
return Lt(e);
|
|
737
736
|
default:
|
|
738
737
|
return e;
|
|
739
738
|
}
|
|
740
|
-
},
|
|
739
|
+
}, ke = (e) => new Ir(
|
|
741
740
|
e.name,
|
|
742
|
-
|
|
741
|
+
v(e.attribute),
|
|
743
742
|
e.aggregation,
|
|
744
743
|
e.format,
|
|
745
744
|
e.description,
|
|
746
745
|
P(e.sort),
|
|
747
746
|
e.dataSource,
|
|
748
747
|
e.composeCode
|
|
749
|
-
),
|
|
748
|
+
), Le = (e) => {
|
|
750
749
|
const t = Object.fromEntries(
|
|
751
750
|
Object.entries(e.context).map(([r, s]) => {
|
|
752
751
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
753
752
|
switch (s.__serializable) {
|
|
754
753
|
case "DimensionalAttribute":
|
|
755
|
-
return [r,
|
|
754
|
+
return [r, Re(s)];
|
|
756
755
|
case "DimensionalLevelAttribute":
|
|
757
|
-
return [r,
|
|
756
|
+
return [r, Ie(s)];
|
|
758
757
|
case "DimensionalBaseMeasure":
|
|
759
|
-
return [r,
|
|
758
|
+
return [r, ke(s)];
|
|
760
759
|
case "DimensionalCalculatedMeasure":
|
|
761
|
-
return [r,
|
|
760
|
+
return [r, Le(s)];
|
|
761
|
+
case "DimensionalMeasureTemplate":
|
|
762
|
+
return [r, Be(s)];
|
|
763
|
+
case "MembersFilter":
|
|
764
|
+
case "LogicalAttributeFilter":
|
|
765
|
+
case "CascadingFilter":
|
|
766
|
+
case "ExcludeFilter":
|
|
767
|
+
case "MeasureFilter":
|
|
768
|
+
case "RankingFilter":
|
|
769
|
+
case "MeasureRankingFilter":
|
|
770
|
+
case "NumericFilter":
|
|
771
|
+
case "TextFilter":
|
|
772
|
+
case "DateRangeFilter":
|
|
773
|
+
case "RelativeDateFilter":
|
|
774
|
+
case "CustomFilter":
|
|
775
|
+
return [r, S(s)];
|
|
762
776
|
default:
|
|
763
777
|
return [r, s];
|
|
764
778
|
}
|
|
765
779
|
return [r, s];
|
|
766
780
|
})
|
|
767
781
|
);
|
|
768
|
-
return new
|
|
782
|
+
return new kr(
|
|
769
783
|
e.name,
|
|
770
784
|
e.expression,
|
|
771
785
|
t,
|
|
@@ -775,58 +789,58 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
775
789
|
e.dataSource,
|
|
776
790
|
e.composeCode
|
|
777
791
|
);
|
|
778
|
-
},
|
|
792
|
+
}, Be = (e) => new Lr(
|
|
779
793
|
e.name,
|
|
780
|
-
|
|
794
|
+
v(e.attribute),
|
|
781
795
|
e.format,
|
|
782
796
|
e.description,
|
|
783
797
|
P(e.sort),
|
|
784
798
|
e.dataSource,
|
|
785
799
|
e.composeCode
|
|
786
|
-
),
|
|
800
|
+
), Ae = (e) => {
|
|
787
801
|
switch (e.__serializable) {
|
|
788
802
|
case "DimensionalBaseMeasure":
|
|
789
|
-
return
|
|
803
|
+
return ke(e);
|
|
790
804
|
case "DimensionalCalculatedMeasure":
|
|
791
|
-
return
|
|
805
|
+
return Le(e);
|
|
792
806
|
case "DimensionalMeasureTemplate":
|
|
793
|
-
return
|
|
807
|
+
return Be(e);
|
|
794
808
|
default:
|
|
795
809
|
return e;
|
|
796
810
|
}
|
|
797
811
|
}, S = (e) => {
|
|
798
812
|
switch (e.__serializable) {
|
|
799
813
|
case "MembersFilter":
|
|
800
|
-
return new
|
|
801
|
-
|
|
814
|
+
return new Yr(
|
|
815
|
+
v(e.attribute),
|
|
802
816
|
e.members,
|
|
803
|
-
e.config.backgroundFilter ?
|
|
817
|
+
e.config.backgroundFilter ? E(l({}, e.config), { backgroundFilter: S(e.config.backgroundFilter) }) : e.config,
|
|
804
818
|
e.composeCode
|
|
805
819
|
);
|
|
806
820
|
case "LogicalAttributeFilter":
|
|
807
|
-
return new
|
|
821
|
+
return new Gr(
|
|
808
822
|
e.filters.map((r) => S(r)),
|
|
809
823
|
e.operator,
|
|
810
824
|
e.config,
|
|
811
825
|
e.composeCode
|
|
812
826
|
);
|
|
813
827
|
case "CascadingFilter":
|
|
814
|
-
return new
|
|
828
|
+
return new Kr(
|
|
815
829
|
e._filters.map((r) => S(r)),
|
|
816
830
|
e.config,
|
|
817
831
|
e.composeCode
|
|
818
832
|
);
|
|
819
833
|
case "ExcludeFilter":
|
|
820
|
-
return new
|
|
834
|
+
return new Jr(
|
|
821
835
|
S(e.filter),
|
|
822
836
|
e.input ? S(e.input) : void 0,
|
|
823
837
|
e.config,
|
|
824
838
|
e.composeCode
|
|
825
839
|
);
|
|
826
840
|
case "MeasureFilter":
|
|
827
|
-
return new
|
|
828
|
-
|
|
829
|
-
|
|
841
|
+
return new jr(
|
|
842
|
+
v(e.attribute),
|
|
843
|
+
Ae(e.measure),
|
|
830
844
|
e.operatorA,
|
|
831
845
|
e.valueA,
|
|
832
846
|
e.operatorB,
|
|
@@ -835,25 +849,25 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
835
849
|
e.composeCode
|
|
836
850
|
);
|
|
837
851
|
case "RankingFilter":
|
|
838
|
-
return new
|
|
839
|
-
|
|
840
|
-
|
|
852
|
+
return new Vr(
|
|
853
|
+
v(e.attribute),
|
|
854
|
+
Ae(e.measure),
|
|
841
855
|
e.operator,
|
|
842
856
|
e.count,
|
|
843
857
|
e.config,
|
|
844
858
|
e.composeCode
|
|
845
859
|
);
|
|
846
860
|
case "MeasureRankingFilter":
|
|
847
|
-
return new
|
|
848
|
-
|
|
861
|
+
return new Wr(
|
|
862
|
+
Ae(e.measure),
|
|
849
863
|
e.operator,
|
|
850
864
|
e.count,
|
|
851
865
|
e.config,
|
|
852
866
|
e.composeCode
|
|
853
867
|
);
|
|
854
868
|
case "NumericFilter":
|
|
855
|
-
return new
|
|
856
|
-
|
|
869
|
+
return new Pr(
|
|
870
|
+
v(e.attribute),
|
|
857
871
|
e.operatorA,
|
|
858
872
|
e.valueA,
|
|
859
873
|
e.operatorB,
|
|
@@ -862,8 +876,8 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
862
876
|
e.composeCode
|
|
863
877
|
);
|
|
864
878
|
case "TextFilter":
|
|
865
|
-
return new
|
|
866
|
-
|
|
879
|
+
return new _r(
|
|
880
|
+
v(e.attribute),
|
|
867
881
|
e.operatorA,
|
|
868
882
|
e.valueA,
|
|
869
883
|
e.config,
|
|
@@ -871,8 +885,8 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
871
885
|
);
|
|
872
886
|
case "DateRangeFilter": {
|
|
873
887
|
const { valueA: r, valueB: s } = e;
|
|
874
|
-
return new
|
|
875
|
-
|
|
888
|
+
return new Ur(
|
|
889
|
+
v(e.attribute),
|
|
876
890
|
r,
|
|
877
891
|
s,
|
|
878
892
|
e.config,
|
|
@@ -880,8 +894,8 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
880
894
|
);
|
|
881
895
|
}
|
|
882
896
|
case "RelativeDateFilter":
|
|
883
|
-
return new
|
|
884
|
-
|
|
897
|
+
return new zr(
|
|
898
|
+
v(e.attribute),
|
|
885
899
|
e.offset,
|
|
886
900
|
e.count,
|
|
887
901
|
e.operator,
|
|
@@ -890,8 +904,8 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
890
904
|
e.composeCode
|
|
891
905
|
);
|
|
892
906
|
case "CustomFilter":
|
|
893
|
-
return new
|
|
894
|
-
|
|
907
|
+
return new Br(
|
|
908
|
+
v(e.attribute),
|
|
895
909
|
e.jaqlExpression,
|
|
896
910
|
e.config,
|
|
897
911
|
e.composeCode
|
|
@@ -902,71 +916,71 @@ const P = (e) => e === void 0 ? U.None : e, _s = (e) => new ar(e.metadataItem, e
|
|
|
902
916
|
};
|
|
903
917
|
y.registerCustom(
|
|
904
918
|
{
|
|
905
|
-
isApplicable:
|
|
919
|
+
isApplicable: fr,
|
|
906
920
|
serialize: (e) => e.serialize(),
|
|
907
|
-
deserialize: (e) =>
|
|
921
|
+
deserialize: (e) => Js(e)
|
|
908
922
|
},
|
|
909
923
|
"JaqlElement"
|
|
910
924
|
);
|
|
911
925
|
y.registerCustom(
|
|
912
926
|
{
|
|
913
|
-
isApplicable:
|
|
927
|
+
isApplicable: mr,
|
|
914
928
|
serialize: (e) => e.serialize(),
|
|
915
|
-
deserialize: (e) =>
|
|
929
|
+
deserialize: (e) => Re(e)
|
|
916
930
|
},
|
|
917
931
|
"DimensionalAttribute"
|
|
918
932
|
);
|
|
919
933
|
y.registerCustom(
|
|
920
934
|
{
|
|
921
|
-
isApplicable:
|
|
935
|
+
isApplicable: pr,
|
|
922
936
|
serialize: (e) => e.serialize(),
|
|
923
|
-
deserialize: (e) =>
|
|
937
|
+
deserialize: (e) => Ie(e)
|
|
924
938
|
},
|
|
925
939
|
"DimensionalLevelAttribute"
|
|
926
940
|
);
|
|
927
941
|
y.registerCustom(
|
|
928
942
|
{
|
|
929
|
-
isApplicable:
|
|
943
|
+
isApplicable: gr,
|
|
930
944
|
serialize: (e) => e.serialize(),
|
|
931
|
-
deserialize: (e) =>
|
|
945
|
+
deserialize: (e) => kt(e)
|
|
932
946
|
},
|
|
933
947
|
"DimensionalDimension"
|
|
934
948
|
);
|
|
935
949
|
y.registerCustom(
|
|
936
950
|
{
|
|
937
|
-
isApplicable:
|
|
951
|
+
isApplicable: yr,
|
|
938
952
|
serialize: (e) => e.serialize(),
|
|
939
|
-
deserialize: (e) =>
|
|
953
|
+
deserialize: (e) => Lt(e)
|
|
940
954
|
},
|
|
941
955
|
"DimensionalDateDimension"
|
|
942
956
|
);
|
|
943
957
|
y.registerCustom(
|
|
944
958
|
{
|
|
945
|
-
isApplicable:
|
|
959
|
+
isApplicable: hr,
|
|
946
960
|
serialize: (e) => e.serialize(),
|
|
947
|
-
deserialize: (e) =>
|
|
961
|
+
deserialize: (e) => ke(e)
|
|
948
962
|
},
|
|
949
963
|
"DimensionalBaseMeasure"
|
|
950
964
|
);
|
|
951
965
|
y.registerCustom(
|
|
952
966
|
{
|
|
953
|
-
isApplicable:
|
|
967
|
+
isApplicable: br,
|
|
954
968
|
serialize: (e) => e.serialize(),
|
|
955
|
-
deserialize: (e) =>
|
|
969
|
+
deserialize: (e) => Le(e)
|
|
956
970
|
},
|
|
957
971
|
"DimensionalCalculatedMeasure"
|
|
958
972
|
);
|
|
959
973
|
y.registerCustom(
|
|
960
974
|
{
|
|
961
|
-
isApplicable:
|
|
975
|
+
isApplicable: Fr,
|
|
962
976
|
serialize: (e) => e.serialize(),
|
|
963
|
-
deserialize: (e) =>
|
|
977
|
+
deserialize: (e) => Be(e)
|
|
964
978
|
},
|
|
965
979
|
"DimensionalMeasureTemplate"
|
|
966
980
|
);
|
|
967
981
|
y.registerCustom(
|
|
968
982
|
{
|
|
969
|
-
isApplicable:
|
|
983
|
+
isApplicable: ve,
|
|
970
984
|
serialize: (e) => e.serialize(),
|
|
971
985
|
deserialize: (e) => S(e)
|
|
972
986
|
},
|
|
@@ -974,7 +988,7 @@ y.registerCustom(
|
|
|
974
988
|
);
|
|
975
989
|
y.registerCustom(
|
|
976
990
|
{
|
|
977
|
-
isApplicable:
|
|
991
|
+
isApplicable: Er,
|
|
978
992
|
serialize: (e) => e.serialize(),
|
|
979
993
|
deserialize: (e) => S(e)
|
|
980
994
|
},
|
|
@@ -982,7 +996,7 @@ y.registerCustom(
|
|
|
982
996
|
);
|
|
983
997
|
y.registerCustom(
|
|
984
998
|
{
|
|
985
|
-
isApplicable:
|
|
999
|
+
isApplicable: Ar,
|
|
986
1000
|
serialize: (e) => e.serialize(),
|
|
987
1001
|
deserialize: (e) => S(e)
|
|
988
1002
|
},
|
|
@@ -990,7 +1004,7 @@ y.registerCustom(
|
|
|
990
1004
|
);
|
|
991
1005
|
y.registerCustom(
|
|
992
1006
|
{
|
|
993
|
-
isApplicable:
|
|
1007
|
+
isApplicable: Tr,
|
|
994
1008
|
serialize: (e) => e.serialize(),
|
|
995
1009
|
deserialize: (e) => S(e)
|
|
996
1010
|
},
|
|
@@ -998,7 +1012,7 @@ y.registerCustom(
|
|
|
998
1012
|
);
|
|
999
1013
|
y.registerCustom(
|
|
1000
1014
|
{
|
|
1001
|
-
isApplicable:
|
|
1015
|
+
isApplicable: wr,
|
|
1002
1016
|
serialize: (e) => e.serialize(),
|
|
1003
1017
|
deserialize: (e) => S(e)
|
|
1004
1018
|
},
|
|
@@ -1006,7 +1020,7 @@ y.registerCustom(
|
|
|
1006
1020
|
);
|
|
1007
1021
|
y.registerCustom(
|
|
1008
1022
|
{
|
|
1009
|
-
isApplicable:
|
|
1023
|
+
isApplicable: Sr,
|
|
1010
1024
|
serialize: (e) => e.serialize(),
|
|
1011
1025
|
deserialize: (e) => S(e)
|
|
1012
1026
|
},
|
|
@@ -1014,7 +1028,7 @@ y.registerCustom(
|
|
|
1014
1028
|
);
|
|
1015
1029
|
y.registerCustom(
|
|
1016
1030
|
{
|
|
1017
|
-
isApplicable:
|
|
1031
|
+
isApplicable: Cr,
|
|
1018
1032
|
serialize: (e) => e.serialize(),
|
|
1019
1033
|
deserialize: (e) => S(e)
|
|
1020
1034
|
},
|
|
@@ -1022,7 +1036,7 @@ y.registerCustom(
|
|
|
1022
1036
|
);
|
|
1023
1037
|
y.registerCustom(
|
|
1024
1038
|
{
|
|
1025
|
-
isApplicable:
|
|
1039
|
+
isApplicable: Or,
|
|
1026
1040
|
serialize: (e) => e.serialize(),
|
|
1027
1041
|
deserialize: (e) => S(e)
|
|
1028
1042
|
},
|
|
@@ -1030,7 +1044,7 @@ y.registerCustom(
|
|
|
1030
1044
|
);
|
|
1031
1045
|
y.registerCustom(
|
|
1032
1046
|
{
|
|
1033
|
-
isApplicable:
|
|
1047
|
+
isApplicable: qr,
|
|
1034
1048
|
serialize: (e) => e.serialize(),
|
|
1035
1049
|
deserialize: (e) => S(e)
|
|
1036
1050
|
},
|
|
@@ -1038,7 +1052,7 @@ y.registerCustom(
|
|
|
1038
1052
|
);
|
|
1039
1053
|
y.registerCustom(
|
|
1040
1054
|
{
|
|
1041
|
-
isApplicable:
|
|
1055
|
+
isApplicable: $r,
|
|
1042
1056
|
serialize: (e) => e.serialize(),
|
|
1043
1057
|
deserialize: (e) => S(e)
|
|
1044
1058
|
},
|
|
@@ -1046,7 +1060,7 @@ y.registerCustom(
|
|
|
1046
1060
|
);
|
|
1047
1061
|
y.registerCustom(
|
|
1048
1062
|
{
|
|
1049
|
-
isApplicable:
|
|
1063
|
+
isApplicable: Dr,
|
|
1050
1064
|
serialize: (e) => e.serialize(),
|
|
1051
1065
|
deserialize: (e) => S(e)
|
|
1052
1066
|
},
|
|
@@ -1054,64 +1068,64 @@ y.registerCustom(
|
|
|
1054
1068
|
);
|
|
1055
1069
|
y.registerCustom(
|
|
1056
1070
|
{
|
|
1057
|
-
isApplicable:
|
|
1071
|
+
isApplicable: xr,
|
|
1058
1072
|
serialize: (e) => e.serialize(),
|
|
1059
1073
|
deserialize: (e) => S(e)
|
|
1060
1074
|
},
|
|
1061
1075
|
"CustomFilter"
|
|
1062
1076
|
);
|
|
1063
|
-
const
|
|
1064
|
-
function
|
|
1077
|
+
const Bi = y, T = "DM.";
|
|
1078
|
+
function $(e) {
|
|
1065
1079
|
return typeof e == "object" && e !== null;
|
|
1066
1080
|
}
|
|
1067
|
-
function
|
|
1081
|
+
function w(e) {
|
|
1068
1082
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
1069
1083
|
}
|
|
1070
|
-
function
|
|
1071
|
-
return e.every(
|
|
1084
|
+
function Bt(e) {
|
|
1085
|
+
return Array.isArray(e) && e.every(w);
|
|
1072
1086
|
}
|
|
1073
|
-
function
|
|
1087
|
+
function pe(e) {
|
|
1074
1088
|
return "attribute" in e && "config" in e;
|
|
1075
1089
|
}
|
|
1076
|
-
function
|
|
1090
|
+
function re(e) {
|
|
1077
1091
|
return "left" in e && "right" in e && "operator" in e;
|
|
1078
1092
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return !
|
|
1093
|
+
function ze(e) {
|
|
1094
|
+
return !pe(e) && !re(e);
|
|
1081
1095
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1096
|
+
function zt(e) {
|
|
1097
|
+
return $(e) && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
|
|
1084
1098
|
}
|
|
1085
|
-
function
|
|
1086
|
-
return
|
|
1099
|
+
function Ut(e) {
|
|
1100
|
+
return !$(e) || !("column" in e) ? !1 : w(e.column);
|
|
1087
1101
|
}
|
|
1088
|
-
const
|
|
1102
|
+
const C = 3;
|
|
1089
1103
|
function x(e, t, r) {
|
|
1090
1104
|
if (t.length === 0) return;
|
|
1091
1105
|
let s = Number.MAX_SAFE_INTEGER, n;
|
|
1092
1106
|
for (const i of t) {
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1107
|
+
const a = r(i), o = fs(e, a);
|
|
1108
|
+
o < s && (s = o, n = i);
|
|
1095
1109
|
}
|
|
1096
1110
|
return n !== void 0 ? { best: n, distance: s } : void 0;
|
|
1097
1111
|
}
|
|
1098
|
-
const
|
|
1099
|
-
function
|
|
1100
|
-
return e.localeCompare(t,
|
|
1112
|
+
const _t = "en";
|
|
1113
|
+
function Te(e, t) {
|
|
1114
|
+
return e.localeCompare(t, _t, { sensitivity: "accent" }) === 0;
|
|
1101
1115
|
}
|
|
1102
|
-
function
|
|
1103
|
-
return t.length <= e.length && e.slice(0, t.length).localeCompare(t,
|
|
1116
|
+
function Ze(e, t) {
|
|
1117
|
+
return t.length <= e.length && e.slice(0, t.length).localeCompare(t, _t, { sensitivity: "accent" }) === 0;
|
|
1104
1118
|
}
|
|
1105
|
-
function
|
|
1106
|
-
const t = [...e].sort((i,
|
|
1119
|
+
function se(e) {
|
|
1120
|
+
const t = [...e].sort((i, a) => a.name.length - i.name.length), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1107
1121
|
for (const i of e) {
|
|
1108
1122
|
r.set(i.name, i);
|
|
1109
|
-
const
|
|
1110
|
-
n.set(i.name,
|
|
1111
|
-
const
|
|
1123
|
+
const a = [...i.columns].sort((u, c) => c.name.length - u.name.length);
|
|
1124
|
+
n.set(i.name, a);
|
|
1125
|
+
const o = /* @__PURE__ */ new Map();
|
|
1112
1126
|
for (const u of i.columns)
|
|
1113
|
-
|
|
1114
|
-
s.set(i.name,
|
|
1127
|
+
o.set(u.name, u);
|
|
1128
|
+
s.set(i.name, o);
|
|
1115
1129
|
}
|
|
1116
1130
|
return {
|
|
1117
1131
|
sortedTables: t,
|
|
@@ -1120,170 +1134,170 @@ function re(e) {
|
|
|
1120
1134
|
columnMap: s
|
|
1121
1135
|
};
|
|
1122
1136
|
}
|
|
1123
|
-
function
|
|
1124
|
-
if (!e.startsWith(
|
|
1137
|
+
function Ue(e, t) {
|
|
1138
|
+
if (!e.startsWith(T))
|
|
1125
1139
|
throw new Error(
|
|
1126
|
-
`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1140
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${T}TableName.ColumnName[.Level]'`
|
|
1127
1141
|
);
|
|
1128
|
-
const r = e.slice(
|
|
1142
|
+
const r = e.slice(T.length);
|
|
1129
1143
|
if (!r)
|
|
1130
1144
|
throw new Error(
|
|
1131
|
-
`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1145
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${T}TableName.ColumnName[.Level]'`
|
|
1132
1146
|
);
|
|
1133
1147
|
let s, n;
|
|
1134
|
-
for (const
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1148
|
+
for (const m of t.sortedTables)
|
|
1149
|
+
if (Ze(r, m.name + ".")) {
|
|
1150
|
+
const F = r.slice(m.name.length + 1);
|
|
1151
|
+
if (!F)
|
|
1138
1152
|
throw new Error(
|
|
1139
|
-
`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1153
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${T}TableName.ColumnName[.Level]'`
|
|
1140
1154
|
);
|
|
1141
|
-
s =
|
|
1155
|
+
s = m, n = F;
|
|
1142
1156
|
break;
|
|
1143
1157
|
}
|
|
1144
1158
|
if (!s) {
|
|
1145
|
-
const
|
|
1146
|
-
if (
|
|
1159
|
+
const m = r.indexOf(".");
|
|
1160
|
+
if (m === -1)
|
|
1147
1161
|
throw new Error(
|
|
1148
|
-
`Invalid dimensional element name format: '${e}'. Expected format: '${
|
|
1162
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${T}TableName.ColumnName[.Level]'`
|
|
1149
1163
|
);
|
|
1150
|
-
const
|
|
1151
|
-
throw new Error(`Table '${
|
|
1164
|
+
const F = r.slice(0, m), O = x(F, t.sortedTables, (W) => W.name), N = O && O.distance <= C ? ` Did you mean '${O.best.name}'?` : "";
|
|
1165
|
+
throw new Error(`Table '${F}' not found in the data model.${N}`);
|
|
1152
1166
|
}
|
|
1153
1167
|
const i = t.tableColumnMap.get(s.name);
|
|
1154
1168
|
if (!i)
|
|
1155
1169
|
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1156
|
-
let
|
|
1157
|
-
const u =
|
|
1158
|
-
for (const
|
|
1159
|
-
if (
|
|
1160
|
-
return { table: s, column:
|
|
1161
|
-
if (!
|
|
1170
|
+
let a, o;
|
|
1171
|
+
const u = q.all;
|
|
1172
|
+
for (const m of i) {
|
|
1173
|
+
if (Te(n, m.name))
|
|
1174
|
+
return { table: s, column: m };
|
|
1175
|
+
if (!Ze(n, m.name + "."))
|
|
1162
1176
|
continue;
|
|
1163
|
-
const
|
|
1164
|
-
if (!
|
|
1177
|
+
const F = n.slice(m.name.length + 1);
|
|
1178
|
+
if (!F)
|
|
1165
1179
|
continue;
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
if (
|
|
1169
|
-
return { table: s, column:
|
|
1170
|
-
|
|
1180
|
+
const O = u.includes(F), N = te(m.dataType);
|
|
1181
|
+
if (O) {
|
|
1182
|
+
if (N)
|
|
1183
|
+
return { table: s, column: m, level: F };
|
|
1184
|
+
a || (a = m, o = F);
|
|
1171
1185
|
continue;
|
|
1172
1186
|
}
|
|
1173
|
-
|
|
1187
|
+
N && !a && (a = m, o = F);
|
|
1174
1188
|
}
|
|
1175
|
-
if (
|
|
1176
|
-
if (u.includes(
|
|
1189
|
+
if (a && o) {
|
|
1190
|
+
if (u.includes(o))
|
|
1177
1191
|
throw new Error(
|
|
1178
|
-
`Invalid date level '${
|
|
1192
|
+
`Invalid date level '${o}' in dimensional element '${e}'. Column '${s.name}.${a.name}' is not a datetime column`
|
|
1179
1193
|
);
|
|
1180
|
-
const
|
|
1194
|
+
const m = x(o, u, (O) => O), F = m && m.distance <= C ? ` Did you mean '${m.best}'?` : "";
|
|
1181
1195
|
throw new Error(
|
|
1182
|
-
`Invalid date level '${
|
|
1196
|
+
`Invalid date level '${o}' in dimensional element '${e}'. Valid levels are: ${u.join(
|
|
1183
1197
|
", "
|
|
1184
|
-
)}.${
|
|
1198
|
+
)}.${F}`
|
|
1185
1199
|
);
|
|
1186
1200
|
}
|
|
1187
|
-
const c = n.indexOf("."), g = c === -1 ? n : n.slice(0, c),
|
|
1201
|
+
const c = n.indexOf("."), g = c === -1 ? n : n.slice(0, c), f = x(n, i, (m) => m.name), p = f && f.distance <= C && !Te(f.best.name, g), h = p ? ` Did you mean '${f.best.name}'?` : "", b = !p && n.endsWith(".") && f !== void 0 && Te(f.best.name, g) ? ` Use '${g}' without a trailing dot.` : "";
|
|
1188
1202
|
throw new Error(
|
|
1189
1203
|
`Column '${g}' not found in table '${s.name}'.${h}${b}`
|
|
1190
1204
|
);
|
|
1191
1205
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const { table: r, column: s, level: n } =
|
|
1206
|
+
function Gs(e, t) {
|
|
1207
|
+
const { table: r, column: s, level: n } = Ue(e, t);
|
|
1194
1208
|
if (n) {
|
|
1195
|
-
if (!
|
|
1209
|
+
if (!te(s.dataType))
|
|
1196
1210
|
throw new Error(
|
|
1197
1211
|
`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`
|
|
1198
1212
|
);
|
|
1199
|
-
const i =
|
|
1213
|
+
const i = q.all;
|
|
1200
1214
|
if (!i.includes(n))
|
|
1201
1215
|
throw new Error(
|
|
1202
1216
|
`Invalid date level '${n}' in dimensional element '${e}'. Valid levels are: ${i.join(
|
|
1203
1217
|
", "
|
|
1204
1218
|
)}`
|
|
1205
1219
|
);
|
|
1206
|
-
const
|
|
1207
|
-
if (s.dataType === "date" && !
|
|
1220
|
+
const a = q.dateOnly;
|
|
1221
|
+
if (s.dataType === "date" && !a.includes(n))
|
|
1208
1222
|
throw new Error(
|
|
1209
1223
|
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`
|
|
1210
1224
|
);
|
|
1211
|
-
const
|
|
1212
|
-
if (s.dataType === "time" && !
|
|
1225
|
+
const o = q.timeOnly;
|
|
1226
|
+
if (s.dataType === "time" && !o.includes(n))
|
|
1213
1227
|
throw new Error(
|
|
1214
1228
|
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`
|
|
1215
1229
|
);
|
|
1216
1230
|
}
|
|
1217
1231
|
return { table: r, column: s, level: n };
|
|
1218
1232
|
}
|
|
1219
|
-
function
|
|
1220
|
-
const { table: n, column: i, level:
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1223
|
-
const u = s.inferredDateLevel, c =
|
|
1233
|
+
function ee(e, t, r, s) {
|
|
1234
|
+
const { table: n, column: i, level: a } = Gs(e, r);
|
|
1235
|
+
let o = a;
|
|
1236
|
+
if (te(i.dataType) && o === void 0 && (s != null && s.inferredDateLevel)) {
|
|
1237
|
+
const u = s.inferredDateLevel, c = q.all;
|
|
1224
1238
|
if (!c.includes(u))
|
|
1225
1239
|
throw new Error(
|
|
1226
1240
|
`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`
|
|
1227
1241
|
);
|
|
1228
|
-
const g = `${e}.${u}`,
|
|
1229
|
-
if (i.dataType === "date" && !
|
|
1242
|
+
const g = `${e}.${u}`, f = q.dateOnly;
|
|
1243
|
+
if (i.dataType === "date" && !f.includes(u))
|
|
1230
1244
|
throw new Error(
|
|
1231
1245
|
`Invalid level '${u}' in dimensional element '${g}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`
|
|
1232
1246
|
);
|
|
1233
|
-
const
|
|
1234
|
-
if (i.dataType === "time" && !
|
|
1247
|
+
const p = q.timeOnly;
|
|
1248
|
+
if (i.dataType === "time" && !p.includes(u))
|
|
1235
1249
|
throw new Error(
|
|
1236
1250
|
`Invalid level '${u}' in dimensional element '${g}'. Column '${n.name}.${i.name}' is only a time column, not a date column`
|
|
1237
1251
|
);
|
|
1238
|
-
|
|
1252
|
+
o = u;
|
|
1239
1253
|
}
|
|
1240
|
-
return
|
|
1254
|
+
return Hr({
|
|
1241
1255
|
expression: i.expression,
|
|
1242
1256
|
dataType: i.dataType,
|
|
1243
|
-
granularity:
|
|
1257
|
+
granularity: o,
|
|
1244
1258
|
format: void 0,
|
|
1245
1259
|
sort: void 0,
|
|
1246
1260
|
dataSource: t
|
|
1247
1261
|
});
|
|
1248
1262
|
}
|
|
1249
|
-
function
|
|
1250
|
-
const { column: s, level: n } =
|
|
1263
|
+
function Ys(e, t, r) {
|
|
1264
|
+
const { column: s, level: n } = Ue(e, r);
|
|
1251
1265
|
if (n)
|
|
1252
1266
|
throw new Error(
|
|
1253
|
-
`Invalid DateDimension name format: '${e}'. Expected format: '${
|
|
1267
|
+
`Invalid DateDimension name format: '${e}'. Expected format: '${T}TableName.ColumnName'`
|
|
1254
1268
|
);
|
|
1255
|
-
if (!
|
|
1269
|
+
if (!te(s.dataType))
|
|
1256
1270
|
throw new Error(
|
|
1257
1271
|
`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`
|
|
1258
1272
|
);
|
|
1259
|
-
return
|
|
1273
|
+
return Qr({
|
|
1260
1274
|
name: s.name,
|
|
1261
1275
|
expression: s.expression,
|
|
1262
1276
|
dataSource: t
|
|
1263
1277
|
});
|
|
1264
1278
|
}
|
|
1265
|
-
const
|
|
1279
|
+
const Hs = (e, t) => {
|
|
1266
1280
|
if (!e) return;
|
|
1267
1281
|
const r = typeof e == "object" ? e.direction : e;
|
|
1268
|
-
if (!
|
|
1269
|
-
return
|
|
1282
|
+
if (!pt(r))
|
|
1283
|
+
return E(l({}, t), {
|
|
1270
1284
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1271
1285
|
});
|
|
1272
|
-
},
|
|
1273
|
-
const n =
|
|
1286
|
+
}, Qs = (e, t, r, s) => {
|
|
1287
|
+
const n = Hs(e.sortType, s);
|
|
1274
1288
|
if (n)
|
|
1275
1289
|
return {
|
|
1276
|
-
attribute:
|
|
1290
|
+
attribute: ee(e.column, t, r),
|
|
1277
1291
|
style: {},
|
|
1278
1292
|
error: n
|
|
1279
1293
|
};
|
|
1280
|
-
const i =
|
|
1281
|
-
return { attribute: i, style:
|
|
1282
|
-
},
|
|
1283
|
-
error:
|
|
1294
|
+
const i = ee(e.column, t, r), a = _(e, "column");
|
|
1295
|
+
return { attribute: i, style: a };
|
|
1296
|
+
}, Xs = (e, t, r, s) => typeof e == "string" ? { attribute: ee(e, t, r) } : zt(e) ? Qs(e, t, r, s) : {
|
|
1297
|
+
error: E(l({}, s), {
|
|
1284
1298
|
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1285
1299
|
})
|
|
1286
|
-
},
|
|
1300
|
+
}, Pt = (e) => {
|
|
1287
1301
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1288
1302
|
if (!t)
|
|
1289
1303
|
return { success: !0, data: [] };
|
|
@@ -1299,13 +1313,13 @@ const Ks = (e, t) => {
|
|
|
1299
1313
|
]
|
|
1300
1314
|
};
|
|
1301
1315
|
const n = [], i = [];
|
|
1302
|
-
return t.forEach((
|
|
1316
|
+
return t.forEach((a, o) => {
|
|
1303
1317
|
const u = {
|
|
1304
|
-
path: `dimensions[${
|
|
1305
|
-
input:
|
|
1318
|
+
path: `dimensions[${o}]`,
|
|
1319
|
+
input: a
|
|
1306
1320
|
};
|
|
1307
1321
|
try {
|
|
1308
|
-
const c =
|
|
1322
|
+
const c = Xs(a, r, s, u);
|
|
1309
1323
|
if (c.error) {
|
|
1310
1324
|
i.push(c.error);
|
|
1311
1325
|
return;
|
|
@@ -1315,47 +1329,47 @@ const Ks = (e, t) => {
|
|
|
1315
1329
|
);
|
|
1316
1330
|
} catch (c) {
|
|
1317
1331
|
const g = c instanceof Error ? c.message : "Unknown error";
|
|
1318
|
-
i.push(
|
|
1332
|
+
i.push(E(l({}, u), { message: g }));
|
|
1319
1333
|
}
|
|
1320
1334
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
1321
1335
|
};
|
|
1322
|
-
function
|
|
1336
|
+
function _e(e, t) {
|
|
1323
1337
|
const r = Reflect.get(e, t);
|
|
1324
1338
|
if (typeof r != "function")
|
|
1325
1339
|
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1326
1340
|
return r;
|
|
1327
1341
|
}
|
|
1328
|
-
function
|
|
1329
|
-
const r = e.replace("measureFactory.", ""), n =
|
|
1330
|
-
if (!
|
|
1342
|
+
function Zs(e, t) {
|
|
1343
|
+
const r = e.replace("measureFactory.", ""), n = _e(Xr, r)(...t);
|
|
1344
|
+
if (!ze(n))
|
|
1331
1345
|
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1332
1346
|
return n;
|
|
1333
1347
|
}
|
|
1334
|
-
function
|
|
1335
|
-
const r = e.replace("filterFactory.logic.", ""), n =
|
|
1336
|
-
if (!
|
|
1348
|
+
function en(e, t) {
|
|
1349
|
+
const r = e.replace("filterFactory.logic.", ""), n = _e(Zr, r)(...t);
|
|
1350
|
+
if (!re(n))
|
|
1337
1351
|
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1338
1352
|
return n;
|
|
1339
1353
|
}
|
|
1340
|
-
function
|
|
1354
|
+
function tn(e, t) {
|
|
1341
1355
|
if (e.startsWith("filterFactory.logic."))
|
|
1342
|
-
return
|
|
1343
|
-
const r = e.replace("filterFactory.", ""), n =
|
|
1344
|
-
if (!
|
|
1356
|
+
return en(e, t);
|
|
1357
|
+
const r = e.replace("filterFactory.", ""), n = _e(es, r)(...t);
|
|
1358
|
+
if (!pe(n) && !re(n))
|
|
1345
1359
|
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1346
1360
|
return n;
|
|
1347
1361
|
}
|
|
1348
|
-
function
|
|
1362
|
+
function rn(e, t) {
|
|
1349
1363
|
const s = e.split(".")[0];
|
|
1350
1364
|
if (s === "measureFactory")
|
|
1351
|
-
return
|
|
1365
|
+
return Zs(e, t);
|
|
1352
1366
|
if (s === "filterFactory")
|
|
1353
|
-
return
|
|
1367
|
+
return tn(e, t);
|
|
1354
1368
|
throw new Error(
|
|
1355
1369
|
`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`
|
|
1356
1370
|
);
|
|
1357
1371
|
}
|
|
1358
|
-
const
|
|
1372
|
+
const d = (e, t, r, s) => l({ category: e, minArgs: t, maxArgs: r }, s), sn = /* @__PURE__ */ new Set([
|
|
1359
1373
|
"CORREL",
|
|
1360
1374
|
"COVARP",
|
|
1361
1375
|
"COVAR",
|
|
@@ -1374,131 +1388,131 @@ const f = (e, t, r, s) => l({ category: e, minArgs: t, maxArgs: r }, s), en = /*
|
|
|
1374
1388
|
"ORDERING",
|
|
1375
1389
|
"RDOUBLE",
|
|
1376
1390
|
"RINT"
|
|
1377
|
-
]),
|
|
1391
|
+
]), ce = {
|
|
1378
1392
|
// ── X-diff (datetime difference operators) ──
|
|
1379
|
-
SDIFF:
|
|
1380
|
-
requiredDateLevel:
|
|
1393
|
+
SDIFF: d("xdiff", 2, 2, {
|
|
1394
|
+
requiredDateLevel: q.Seconds,
|
|
1381
1395
|
argType: "datetime"
|
|
1382
1396
|
}),
|
|
1383
|
-
MNDIFF:
|
|
1384
|
-
requiredDateLevel:
|
|
1397
|
+
MNDIFF: d("xdiff", 2, 2, {
|
|
1398
|
+
requiredDateLevel: q.Minutes,
|
|
1385
1399
|
argType: "datetime"
|
|
1386
1400
|
}),
|
|
1387
|
-
HDIFF:
|
|
1388
|
-
requiredDateLevel:
|
|
1401
|
+
HDIFF: d("xdiff", 2, 2, {
|
|
1402
|
+
requiredDateLevel: q.Hours,
|
|
1389
1403
|
argType: "datetime"
|
|
1390
1404
|
}),
|
|
1391
|
-
DDIFF:
|
|
1392
|
-
requiredDateLevel:
|
|
1405
|
+
DDIFF: d("xdiff", 2, 2, {
|
|
1406
|
+
requiredDateLevel: q.Days,
|
|
1393
1407
|
argType: "datetime"
|
|
1394
1408
|
}),
|
|
1395
|
-
MDIFF:
|
|
1396
|
-
requiredDateLevel:
|
|
1409
|
+
MDIFF: d("xdiff", 2, 2, {
|
|
1410
|
+
requiredDateLevel: q.Months,
|
|
1397
1411
|
argType: "datetime"
|
|
1398
1412
|
}),
|
|
1399
|
-
QDIFF:
|
|
1400
|
-
requiredDateLevel:
|
|
1413
|
+
QDIFF: d("xdiff", 2, 2, {
|
|
1414
|
+
requiredDateLevel: q.Quarters,
|
|
1401
1415
|
argType: "datetime"
|
|
1402
1416
|
}),
|
|
1403
|
-
YDIFF:
|
|
1404
|
-
requiredDateLevel:
|
|
1417
|
+
YDIFF: d("xdiff", 2, 2, {
|
|
1418
|
+
requiredDateLevel: q.Years,
|
|
1405
1419
|
argType: "datetime"
|
|
1406
1420
|
}),
|
|
1407
1421
|
// ── Aggregation ──
|
|
1408
|
-
ANYVALUE:
|
|
1409
|
-
SUM:
|
|
1410
|
-
AVG:
|
|
1411
|
-
MIN:
|
|
1412
|
-
MAX:
|
|
1413
|
-
COUNT:
|
|
1414
|
-
DUPCOUNT:
|
|
1415
|
-
COUNTDUPLICATES:
|
|
1416
|
-
STDEV:
|
|
1417
|
-
STDEVP:
|
|
1418
|
-
VAR:
|
|
1419
|
-
VARP:
|
|
1420
|
-
MEDIAN:
|
|
1421
|
-
QUARTILE:
|
|
1422
|
-
PERCENTILE:
|
|
1423
|
-
LOWERWHISKERMAX_IQR:
|
|
1424
|
-
LOWERWHISKERMAX_STDEVP:
|
|
1425
|
-
UPPERWHISKERMIN_IQR:
|
|
1426
|
-
UPPERWHISKERMIN_STDEVP:
|
|
1427
|
-
OUTLIERSCOUNT_IQR:
|
|
1428
|
-
OUTLIERSCOUNT_STDEVP:
|
|
1429
|
-
MODE:
|
|
1430
|
-
NOAGGFUNCTION:
|
|
1422
|
+
ANYVALUE: d("aggregative", 1, 1),
|
|
1423
|
+
SUM: d("aggregative", 1, 2),
|
|
1424
|
+
AVG: d("aggregative", 1, 2),
|
|
1425
|
+
MIN: d("aggregative", 1, 2),
|
|
1426
|
+
MAX: d("aggregative", 1, 2),
|
|
1427
|
+
COUNT: d("aggregative", 1, 2),
|
|
1428
|
+
DUPCOUNT: d("aggregative", 1, 1),
|
|
1429
|
+
COUNTDUPLICATES: d("aggregative", 1, 1),
|
|
1430
|
+
STDEV: d("aggregative", 1, 2),
|
|
1431
|
+
STDEVP: d("aggregative", 1, 2),
|
|
1432
|
+
VAR: d("aggregative", 1, 2),
|
|
1433
|
+
VARP: d("aggregative", 1, 2),
|
|
1434
|
+
MEDIAN: d("aggregative", 1, 2),
|
|
1435
|
+
QUARTILE: d("aggregative", 2, 3),
|
|
1436
|
+
PERCENTILE: d("aggregative", 2, 3),
|
|
1437
|
+
LOWERWHISKERMAX_IQR: d("aggregative", 1, 1),
|
|
1438
|
+
LOWERWHISKERMAX_STDEVP: d("aggregative", 1, 1),
|
|
1439
|
+
UPPERWHISKERMIN_IQR: d("aggregative", 1, 1),
|
|
1440
|
+
UPPERWHISKERMIN_STDEVP: d("aggregative", 1, 1),
|
|
1441
|
+
OUTLIERSCOUNT_IQR: d("aggregative", 1, 1),
|
|
1442
|
+
OUTLIERSCOUNT_STDEVP: d("aggregative", 1, 1),
|
|
1443
|
+
MODE: d("aggregative", 1, 1),
|
|
1444
|
+
NOAGGFUNCTION: d("aggregative", 1, 1),
|
|
1431
1445
|
// ── Window ──
|
|
1432
|
-
RANK:
|
|
1433
|
-
RSUM:
|
|
1434
|
-
RAVG:
|
|
1435
|
-
YTDSUM:
|
|
1436
|
-
QTDSUM:
|
|
1437
|
-
MTDSUM:
|
|
1438
|
-
WTDSUM:
|
|
1439
|
-
YTDAVG:
|
|
1440
|
-
QTDAVG:
|
|
1441
|
-
MTDAVG:
|
|
1442
|
-
WTDAVG:
|
|
1446
|
+
RANK: d("window", 0, Number.POSITIVE_INFINITY),
|
|
1447
|
+
RSUM: d("window", 1, 2),
|
|
1448
|
+
RAVG: d("window", 1, 2),
|
|
1449
|
+
YTDSUM: d("window", 1, 1),
|
|
1450
|
+
QTDSUM: d("window", 1, 1),
|
|
1451
|
+
MTDSUM: d("window", 1, 1),
|
|
1452
|
+
WTDSUM: d("window", 1, 1),
|
|
1453
|
+
YTDAVG: d("window", 1, 1),
|
|
1454
|
+
QTDAVG: d("window", 1, 1),
|
|
1455
|
+
MTDAVG: d("window", 1, 1),
|
|
1456
|
+
WTDAVG: d("window", 1, 1),
|
|
1443
1457
|
// ── String ──
|
|
1444
|
-
CONCAT:
|
|
1445
|
-
LEFT:
|
|
1446
|
-
RIGHT:
|
|
1458
|
+
CONCAT: d("string", 2, Number.POSITIVE_INFINITY),
|
|
1459
|
+
LEFT: d("string", 2, 2),
|
|
1460
|
+
RIGHT: d("string", 2, 2),
|
|
1447
1461
|
// ── Scalar / math ──
|
|
1448
|
-
ABS:
|
|
1449
|
-
ACOS:
|
|
1450
|
-
ASIN:
|
|
1451
|
-
ATAN:
|
|
1452
|
-
CEILING:
|
|
1453
|
-
CONTRIBUTION:
|
|
1454
|
-
COS:
|
|
1455
|
-
COT:
|
|
1456
|
-
DIFFPASTDAY:
|
|
1457
|
-
DIFFPASTMONTH:
|
|
1458
|
-
DIFFPASTPERIOD:
|
|
1459
|
-
DIFFPASTQUARTER:
|
|
1460
|
-
DIFFPASTWEEK:
|
|
1461
|
-
DIFFPASTYEAR:
|
|
1462
|
-
EXP:
|
|
1463
|
-
FLOOR:
|
|
1464
|
-
GROWTH:
|
|
1465
|
-
GROWTHPASTMONTH:
|
|
1466
|
-
GROWTHPASTQUARTER:
|
|
1467
|
-
GROWTHPASTWEEK:
|
|
1468
|
-
GROWTHPASTYEAR:
|
|
1469
|
-
GROWTHRATE:
|
|
1470
|
-
LN:
|
|
1471
|
-
LOG10:
|
|
1472
|
-
MINUS:
|
|
1473
|
-
MOD:
|
|
1474
|
-
QUOTIENT:
|
|
1475
|
-
PASTDAY:
|
|
1476
|
-
PASTMONTH:
|
|
1477
|
-
PASTPERIOD:
|
|
1478
|
-
PASTQUARTER:
|
|
1479
|
-
PASTWEEK:
|
|
1480
|
-
PASTYEAR:
|
|
1481
|
-
PERCENTILEDISCFORINTERNALUSEONLY:
|
|
1482
|
-
PERCENTILECONTFORINTERNALUSEONLY:
|
|
1483
|
-
POWER:
|
|
1484
|
-
ROUND:
|
|
1485
|
-
SIN:
|
|
1486
|
-
SQRT:
|
|
1487
|
-
TAN:
|
|
1488
|
-
},
|
|
1489
|
-
(e) =>
|
|
1462
|
+
ABS: d("scalar", 1, 1),
|
|
1463
|
+
ACOS: d("scalar", 1, 1),
|
|
1464
|
+
ASIN: d("scalar", 1, 1),
|
|
1465
|
+
ATAN: d("scalar", 1, 1),
|
|
1466
|
+
CEILING: d("scalar", 1, 1),
|
|
1467
|
+
CONTRIBUTION: d("scalar", 1, 1),
|
|
1468
|
+
COS: d("scalar", 1, 1),
|
|
1469
|
+
COT: d("scalar", 1, 1),
|
|
1470
|
+
DIFFPASTDAY: d("scalar", 1, 1),
|
|
1471
|
+
DIFFPASTMONTH: d("scalar", 1, 1),
|
|
1472
|
+
DIFFPASTPERIOD: d("scalar", 1, 1),
|
|
1473
|
+
DIFFPASTQUARTER: d("scalar", 1, 1),
|
|
1474
|
+
DIFFPASTWEEK: d("scalar", 1, 1),
|
|
1475
|
+
DIFFPASTYEAR: d("scalar", 1, 1),
|
|
1476
|
+
EXP: d("scalar", 1, 1),
|
|
1477
|
+
FLOOR: d("scalar", 1, 1),
|
|
1478
|
+
GROWTH: d("growth", 1, 1),
|
|
1479
|
+
GROWTHPASTMONTH: d("growth", 1, 1),
|
|
1480
|
+
GROWTHPASTQUARTER: d("growth", 1, 1),
|
|
1481
|
+
GROWTHPASTWEEK: d("growth", 1, 1),
|
|
1482
|
+
GROWTHPASTYEAR: d("growth", 1, 1),
|
|
1483
|
+
GROWTHRATE: d("growth", 1, 1),
|
|
1484
|
+
LN: d("scalar", 1, 1),
|
|
1485
|
+
LOG10: d("scalar", 1, 1),
|
|
1486
|
+
MINUS: d("scalar", 1, 1),
|
|
1487
|
+
MOD: d("scalar", 2, 2),
|
|
1488
|
+
QUOTIENT: d("scalar", 2, 2),
|
|
1489
|
+
PASTDAY: d("date", 1, 2),
|
|
1490
|
+
PASTMONTH: d("date", 1, 2),
|
|
1491
|
+
PASTPERIOD: d("date", 1, 2),
|
|
1492
|
+
PASTQUARTER: d("date", 1, 2),
|
|
1493
|
+
PASTWEEK: d("date", 1, 2),
|
|
1494
|
+
PASTYEAR: d("date", 1, 2),
|
|
1495
|
+
PERCENTILEDISCFORINTERNALUSEONLY: d("scalar", 1, 1),
|
|
1496
|
+
PERCENTILECONTFORINTERNALUSEONLY: d("scalar", 1, 1),
|
|
1497
|
+
POWER: d("scalar", 2, 2),
|
|
1498
|
+
ROUND: d("scalar", 2, 2),
|
|
1499
|
+
SIN: d("scalar", 1, 1),
|
|
1500
|
+
SQRT: d("scalar", 1, 1),
|
|
1501
|
+
TAN: d("scalar", 1, 1)
|
|
1502
|
+
}, nn = Object.keys(ce).filter(
|
|
1503
|
+
(e) => ce[e].category === "xdiff"
|
|
1490
1504
|
);
|
|
1491
|
-
function
|
|
1492
|
-
return
|
|
1505
|
+
function Wt() {
|
|
1506
|
+
return nn;
|
|
1493
1507
|
}
|
|
1494
|
-
function
|
|
1495
|
-
const t =
|
|
1508
|
+
function Vt(e) {
|
|
1509
|
+
const t = ce[e.toUpperCase()];
|
|
1496
1510
|
return t == null ? void 0 : t.requiredDateLevel;
|
|
1497
1511
|
}
|
|
1498
|
-
function
|
|
1512
|
+
function an(e, t) {
|
|
1499
1513
|
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`;
|
|
1500
1514
|
}
|
|
1501
|
-
const
|
|
1515
|
+
const on = /\[(\w[\w.-]*)\]/g, jt = /* @__PURE__ */ new Set([
|
|
1502
1516
|
// Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
|
|
1503
1517
|
"AVG",
|
|
1504
1518
|
"COUNT",
|
|
@@ -1519,30 +1533,30 @@ const sn = /\[(\w[\w.-]*)\]/g, zt = /* @__PURE__ */ new Set([
|
|
|
1519
1533
|
"YTDSUM"
|
|
1520
1534
|
// RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
|
|
1521
1535
|
// CORREL, COVAR*, SKEW*, SLOPE, LARGEST are unsupported in custom formulas (see UNSUPPORTED_FORMULA_FUNCTIONS).
|
|
1522
|
-
]),
|
|
1523
|
-
`\\b(${Array.from(
|
|
1536
|
+
]), un = new RegExp(
|
|
1537
|
+
`\\b(${Array.from(jt).join("|")})\\s*\\(`,
|
|
1524
1538
|
"i"
|
|
1525
1539
|
);
|
|
1526
|
-
function
|
|
1527
|
-
return
|
|
1540
|
+
function Jt(e) {
|
|
1541
|
+
return w(e) ? !0 : typeof e == "string" && e.startsWith(T) ? !1 : $(e) && "kind" in e ? e.kind === "measure" : !0;
|
|
1528
1542
|
}
|
|
1529
|
-
function
|
|
1543
|
+
function cn(e) {
|
|
1530
1544
|
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set();
|
|
1531
1545
|
let s;
|
|
1532
1546
|
for (; (s = t.exec(e)) !== null; ) {
|
|
1533
1547
|
const n = s[1];
|
|
1534
|
-
|
|
1548
|
+
jt.has(n.toUpperCase()) || r.add(n);
|
|
1535
1549
|
}
|
|
1536
1550
|
return Array.from(r);
|
|
1537
1551
|
}
|
|
1538
|
-
function
|
|
1552
|
+
function ln(e) {
|
|
1539
1553
|
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1540
1554
|
}
|
|
1541
|
-
function
|
|
1555
|
+
function fn(e) {
|
|
1542
1556
|
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1543
1557
|
}
|
|
1544
|
-
const G = (e) => e.startsWith("[") ? e : `[${e}]`,
|
|
1545
|
-
function
|
|
1558
|
+
const G = (e) => e.startsWith("[") ? e : `[${e}]`, Kt = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1559
|
+
function Gt(e, t) {
|
|
1546
1560
|
if (t.length === 0) return [];
|
|
1547
1561
|
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(
|
|
1548
1562
|
`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`,
|
|
@@ -1554,16 +1568,16 @@ function Pt(e, t) {
|
|
|
1554
1568
|
ref2: n[3].trim()
|
|
1555
1569
|
}));
|
|
1556
1570
|
}
|
|
1557
|
-
function
|
|
1558
|
-
var
|
|
1559
|
-
const s = Object.keys(t), n = ((
|
|
1571
|
+
function dn(e, t, r) {
|
|
1572
|
+
var a, o, u;
|
|
1573
|
+
const s = Object.keys(t), n = ((a = r.errorPrefix) != null ? a : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1560
1574
|
return {
|
|
1561
1575
|
formula: e,
|
|
1562
1576
|
context: t,
|
|
1563
1577
|
contextKeys: s,
|
|
1564
1578
|
canonicalContextKeys: new Set(s.map(G)),
|
|
1565
1579
|
errorPrefix: i,
|
|
1566
|
-
warnUnusedContext: (
|
|
1580
|
+
warnUnusedContext: (o = r.warnUnusedContext) != null ? o : !0,
|
|
1567
1581
|
errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : !0,
|
|
1568
1582
|
schemaIndex: r.schemaIndex,
|
|
1569
1583
|
result: { isValid: !0, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
@@ -1572,17 +1586,17 @@ function cn(e, t, r) {
|
|
|
1572
1586
|
function R(e, t) {
|
|
1573
1587
|
e.result.errors.push(t), e.result.isValid = !1;
|
|
1574
1588
|
}
|
|
1575
|
-
const
|
|
1576
|
-
function
|
|
1589
|
+
const mn = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1590
|
+
function pn(e) {
|
|
1577
1591
|
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find(
|
|
1578
|
-
(s) => !
|
|
1592
|
+
(s) => !mn.has(s[1].toUpperCase())
|
|
1579
1593
|
);
|
|
1580
1594
|
r && R(
|
|
1581
1595
|
e,
|
|
1582
1596
|
`${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`
|
|
1583
1597
|
);
|
|
1584
1598
|
}
|
|
1585
|
-
function
|
|
1599
|
+
function gn(e, t) {
|
|
1586
1600
|
const r = e[t];
|
|
1587
1601
|
let s = t + 1;
|
|
1588
1602
|
for (; s < e.length; ) {
|
|
@@ -1599,27 +1613,27 @@ function fn(e, t) {
|
|
|
1599
1613
|
}
|
|
1600
1614
|
return e.length;
|
|
1601
1615
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1616
|
+
function yn(e) {
|
|
1617
|
+
return Me(e, ",").filter((t) => t.trim().length > 0).length;
|
|
1604
1618
|
}
|
|
1605
|
-
function
|
|
1619
|
+
function hn(e, t, r, s) {
|
|
1606
1620
|
for (; t < e.length && /\s/.test(e[t]); )
|
|
1607
1621
|
t++;
|
|
1608
1622
|
if (e[t] !== "(")
|
|
1609
1623
|
return t;
|
|
1610
|
-
const n = t, i =
|
|
1624
|
+
const n = t, i = ms(e, n);
|
|
1611
1625
|
if (i === -1)
|
|
1612
1626
|
return n + 1;
|
|
1613
|
-
const
|
|
1614
|
-
return s.push({ name: r.toUpperCase(), argCount:
|
|
1627
|
+
const a = e.slice(n + 1, i);
|
|
1628
|
+
return s.push({ name: r.toUpperCase(), argCount: yn(a) }), s.push(...Yt(a)), i + 1;
|
|
1615
1629
|
}
|
|
1616
|
-
function
|
|
1630
|
+
function Yt(e) {
|
|
1617
1631
|
const t = [];
|
|
1618
1632
|
let r = 0;
|
|
1619
1633
|
for (; r < e.length; ) {
|
|
1620
1634
|
const s = e[r];
|
|
1621
1635
|
if (s === "'" || s === '"') {
|
|
1622
|
-
r =
|
|
1636
|
+
r = gn(e, r);
|
|
1623
1637
|
continue;
|
|
1624
1638
|
}
|
|
1625
1639
|
if (/[A-Za-z_]/.test(s)) {
|
|
@@ -1627,122 +1641,122 @@ function Wt(e) {
|
|
|
1627
1641
|
for (r++; r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
|
|
1628
1642
|
r++;
|
|
1629
1643
|
const i = e.slice(n, r);
|
|
1630
|
-
r =
|
|
1644
|
+
r = hn(e, r, i, t);
|
|
1631
1645
|
continue;
|
|
1632
1646
|
}
|
|
1633
1647
|
r++;
|
|
1634
1648
|
}
|
|
1635
1649
|
return t;
|
|
1636
1650
|
}
|
|
1637
|
-
function
|
|
1638
|
-
const t =
|
|
1651
|
+
function bn(e) {
|
|
1652
|
+
const t = Yt(e.formula), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
1639
1653
|
for (const { name: n, argCount: i } of t) {
|
|
1640
|
-
if (
|
|
1654
|
+
if (sn.has(n)) {
|
|
1641
1655
|
r.has(n) || (r.add(n), R(
|
|
1642
1656
|
e,
|
|
1643
1657
|
`${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`
|
|
1644
1658
|
));
|
|
1645
1659
|
continue;
|
|
1646
1660
|
}
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1661
|
+
const a = ce[n];
|
|
1662
|
+
if (a && (i < a.minArgs || i > a.maxArgs) && !s.has(n)) {
|
|
1649
1663
|
s.add(n);
|
|
1650
|
-
const
|
|
1651
|
-
R(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${
|
|
1664
|
+
const o = an(a.minArgs, a.maxArgs);
|
|
1665
|
+
R(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${o}`);
|
|
1652
1666
|
}
|
|
1653
1667
|
}
|
|
1654
1668
|
}
|
|
1655
|
-
function
|
|
1669
|
+
function Fn(e) {
|
|
1656
1670
|
return [
|
|
1657
1671
|
...new Set(
|
|
1658
|
-
[...e.matchAll(new RegExp(
|
|
1672
|
+
[...e.matchAll(new RegExp(on.source, "g"))].map((t) => t[1])
|
|
1659
1673
|
)
|
|
1660
1674
|
];
|
|
1661
1675
|
}
|
|
1662
|
-
function
|
|
1676
|
+
function En(e) {
|
|
1663
1677
|
const t = e.result.references.filter(
|
|
1664
1678
|
(n) => !e.canonicalContextKeys.has(G(n))
|
|
1665
1679
|
);
|
|
1666
1680
|
if (t.length === 0) return;
|
|
1667
|
-
const r = e.contextKeys.map((n) => `[${
|
|
1681
|
+
const r = e.contextKeys.map((n) => `[${Kt(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1668
1682
|
R(
|
|
1669
1683
|
e,
|
|
1670
1684
|
`${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`
|
|
1671
1685
|
);
|
|
1672
1686
|
}
|
|
1673
|
-
function
|
|
1674
|
-
if (
|
|
1687
|
+
function An(e) {
|
|
1688
|
+
if (un.test(e.formula)) return;
|
|
1675
1689
|
const t = e.result.references.filter((r) => {
|
|
1676
1690
|
var n;
|
|
1677
1691
|
const s = (n = e.context[G(r)]) != null ? n : e.context[r];
|
|
1678
|
-
return s !== void 0 && !
|
|
1692
|
+
return s !== void 0 && !Jt(s);
|
|
1679
1693
|
});
|
|
1680
1694
|
t.length !== 0 && R(
|
|
1681
1695
|
e,
|
|
1682
|
-
`${e.errorPrefix}args[1]: ${
|
|
1683
|
-
|
|
1684
|
-
)}Bracket reference(s) ${
|
|
1696
|
+
`${e.errorPrefix}args[1]: ${fn(
|
|
1697
|
+
cn(e.formula)
|
|
1698
|
+
)}Bracket reference(s) ${ln(
|
|
1685
1699
|
t
|
|
1686
1700
|
)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
|
|
1687
1701
|
);
|
|
1688
1702
|
}
|
|
1689
|
-
function
|
|
1703
|
+
function Tn(e) {
|
|
1690
1704
|
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0) return;
|
|
1691
1705
|
const t = new Set(e.result.references.map(G)), r = e.contextKeys.filter((i) => !t.has(G(i)));
|
|
1692
1706
|
if (e.result.unusedContextKeys = r, r.length === 0) return;
|
|
1693
|
-
const s = r.map((i) => `[${
|
|
1707
|
+
const s = r.map((i) => `[${Kt(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1694
1708
|
e.errorOnUnusedContext ? R(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1695
1709
|
}
|
|
1696
|
-
function
|
|
1697
|
-
var
|
|
1698
|
-
const n = (
|
|
1710
|
+
function et(e, t, r, s) {
|
|
1711
|
+
var a;
|
|
1712
|
+
const n = (a = s.context[G(e)]) != null ? a : s.context[e];
|
|
1699
1713
|
if (n === void 0) return;
|
|
1700
|
-
if (!(typeof n == "string" && n.startsWith(
|
|
1701
|
-
|
|
1714
|
+
if (!(typeof n == "string" && n.startsWith(T))) {
|
|
1715
|
+
Jt(n) && R(
|
|
1702
1716
|
s,
|
|
1703
|
-
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${
|
|
1717
|
+
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${T}Table.Column.Level).`
|
|
1704
1718
|
);
|
|
1705
1719
|
return;
|
|
1706
1720
|
}
|
|
1707
1721
|
if (s.schemaIndex)
|
|
1708
1722
|
try {
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1723
|
+
const o = Ue(n, s.schemaIndex);
|
|
1724
|
+
te(o.column.dataType) ? r && o.level && o.level !== r && R(
|
|
1711
1725
|
s,
|
|
1712
|
-
`${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${
|
|
1726
|
+
`${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${o.level}'.`
|
|
1713
1727
|
) : R(
|
|
1714
1728
|
s,
|
|
1715
|
-
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${
|
|
1729
|
+
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${o.column.name}'.`
|
|
1716
1730
|
);
|
|
1717
|
-
} catch (
|
|
1718
|
-
const u =
|
|
1731
|
+
} catch (o) {
|
|
1732
|
+
const u = o instanceof Error ? o.message : "Unknown error";
|
|
1719
1733
|
R(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1720
1734
|
}
|
|
1721
1735
|
}
|
|
1722
|
-
function
|
|
1723
|
-
const t =
|
|
1736
|
+
function wn(e) {
|
|
1737
|
+
const t = Wt(), r = Gt(e.formula, t);
|
|
1724
1738
|
for (const s of r) {
|
|
1725
|
-
const n =
|
|
1726
|
-
|
|
1739
|
+
const n = Vt(s.functionName);
|
|
1740
|
+
et(s.ref1, s, n, e), et(s.ref2, s, n, e);
|
|
1727
1741
|
}
|
|
1728
1742
|
}
|
|
1729
|
-
function
|
|
1743
|
+
function Sn(e, t, r = {}) {
|
|
1730
1744
|
var n;
|
|
1731
|
-
const s =
|
|
1732
|
-
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || R(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (
|
|
1745
|
+
const s = dn(e, t, r);
|
|
1746
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || R(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (pn(s), bn(s), s.result.references = Fn(e), s.result.references.length === 0 ? (s.result.warnings.push(
|
|
1733
1747
|
`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`
|
|
1734
1748
|
), s.result) : s.contextKeys.length === 0 ? (R(
|
|
1735
1749
|
s,
|
|
1736
1750
|
`${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`
|
|
1737
|
-
), s.result) : (
|
|
1751
|
+
), s.result) : (En(s), An(s), Tn(s), wn(s), s.result));
|
|
1738
1752
|
}
|
|
1739
|
-
function
|
|
1740
|
-
const s =
|
|
1753
|
+
function Cn(e, t, r = {}) {
|
|
1754
|
+
const s = Sn(e, t, r);
|
|
1741
1755
|
if (!s.isValid)
|
|
1742
1756
|
throw new Error(s.errors.join("; "));
|
|
1743
1757
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1744
1758
|
}
|
|
1745
|
-
function
|
|
1759
|
+
function On(e, t) {
|
|
1746
1760
|
if (e.length < 3 || e.length > 5)
|
|
1747
1761
|
throw new Error(
|
|
1748
1762
|
`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
|
|
@@ -1753,12 +1767,12 @@ function Tn(e, t) {
|
|
|
1753
1767
|
`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`
|
|
1754
1768
|
);
|
|
1755
1769
|
const s = r, n = e[2];
|
|
1756
|
-
if (
|
|
1770
|
+
if (!$(n))
|
|
1757
1771
|
throw new Error(
|
|
1758
1772
|
`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`
|
|
1759
1773
|
);
|
|
1760
1774
|
const i = n;
|
|
1761
|
-
|
|
1775
|
+
Cn(s, i, {
|
|
1762
1776
|
errorPrefix: `${t.pathPrefix}`,
|
|
1763
1777
|
errorOnUnusedContext: !0,
|
|
1764
1778
|
// Strict validation: all context keys must be used
|
|
@@ -1766,11 +1780,11 @@ function Tn(e, t) {
|
|
|
1766
1780
|
// Custom formulas must have content
|
|
1767
1781
|
schemaIndex: t.schemaIndex
|
|
1768
1782
|
});
|
|
1769
|
-
const
|
|
1783
|
+
const a = qn(s), o = {};
|
|
1770
1784
|
for (const [u, c] of Object.entries(i)) {
|
|
1771
1785
|
const g = `args[2].${u}`;
|
|
1772
|
-
if (
|
|
1773
|
-
|
|
1786
|
+
if (w(c))
|
|
1787
|
+
o[`${u}`] = M({
|
|
1774
1788
|
data: c,
|
|
1775
1789
|
context: {
|
|
1776
1790
|
dataSource: t.dataSource,
|
|
@@ -1778,122 +1792,122 @@ function Tn(e, t) {
|
|
|
1778
1792
|
pathPrefix: g
|
|
1779
1793
|
}
|
|
1780
1794
|
});
|
|
1781
|
-
else if (typeof c == "string" && c.startsWith(
|
|
1782
|
-
const
|
|
1795
|
+
else if (typeof c == "string" && c.startsWith(T)) {
|
|
1796
|
+
const f = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, p = a[f];
|
|
1783
1797
|
try {
|
|
1784
|
-
|
|
1798
|
+
o[`${u}`] = ee(
|
|
1785
1799
|
c,
|
|
1786
1800
|
t.dataSource,
|
|
1787
1801
|
t.schemaIndex,
|
|
1788
|
-
|
|
1802
|
+
p !== void 0 ? { inferredDateLevel: p } : void 0
|
|
1789
1803
|
);
|
|
1790
1804
|
} catch (h) {
|
|
1791
1805
|
const b = h instanceof Error ? h.message : "Unknown error";
|
|
1792
1806
|
throw new Error(`${g}: ${b}`);
|
|
1793
1807
|
}
|
|
1794
1808
|
} else if (c && typeof c == "object" && "kind" in c)
|
|
1795
|
-
|
|
1809
|
+
o[`${u}`] = c;
|
|
1796
1810
|
else
|
|
1797
1811
|
throw new Error(
|
|
1798
|
-
`${g}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${
|
|
1812
|
+
`${g}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${T}...), but got: ${typeof c}`
|
|
1799
1813
|
);
|
|
1800
1814
|
}
|
|
1801
|
-
return [e[0], e[1],
|
|
1815
|
+
return [e[0], e[1], o, ...e.slice(3)];
|
|
1802
1816
|
}
|
|
1803
|
-
function
|
|
1804
|
-
const t =
|
|
1817
|
+
function qn(e) {
|
|
1818
|
+
const t = Wt(), r = Gt(e, t), s = {};
|
|
1805
1819
|
for (const n of r) {
|
|
1806
|
-
const i =
|
|
1820
|
+
const i = Vt(n.functionName);
|
|
1807
1821
|
if (i !== void 0)
|
|
1808
|
-
for (const
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1822
|
+
for (const a of [n.ref1, n.ref2]) {
|
|
1823
|
+
const o = s[a];
|
|
1824
|
+
if (o !== void 0 && o !== i)
|
|
1811
1825
|
throw new Error(
|
|
1812
|
-
`Reference [${
|
|
1826
|
+
`Reference [${a}] is used in xdiff functions with conflicting date levels ('${o}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`
|
|
1813
1827
|
);
|
|
1814
|
-
s[
|
|
1828
|
+
s[a] = i;
|
|
1815
1829
|
}
|
|
1816
1830
|
}
|
|
1817
1831
|
return s;
|
|
1818
1832
|
}
|
|
1819
|
-
function
|
|
1833
|
+
function Ht(e) {
|
|
1820
1834
|
return e.type === j.TextAttribute;
|
|
1821
1835
|
}
|
|
1822
|
-
function
|
|
1836
|
+
function Qt(e) {
|
|
1823
1837
|
return e.type === j.NumericAttribute;
|
|
1824
1838
|
}
|
|
1825
|
-
function
|
|
1839
|
+
function $n(e) {
|
|
1826
1840
|
return e.type === j.DateLevel;
|
|
1827
1841
|
}
|
|
1828
|
-
function
|
|
1829
|
-
return
|
|
1842
|
+
function Dn(e) {
|
|
1843
|
+
return Ht(e) || Qt(e);
|
|
1830
1844
|
}
|
|
1831
|
-
function
|
|
1845
|
+
function ge(e) {
|
|
1832
1846
|
return e.type === j.TextAttribute ? "text" : e.type === j.NumericAttribute ? "numeric" : e.type === j.DateLevel ? "date/datetime" : "unknown";
|
|
1833
1847
|
}
|
|
1834
|
-
function
|
|
1848
|
+
function Pe(e, t) {
|
|
1835
1849
|
const r = e[0];
|
|
1836
1850
|
if (!r || typeof r != "object" || !("type" in r))
|
|
1837
1851
|
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1838
1852
|
return r;
|
|
1839
1853
|
}
|
|
1840
|
-
function
|
|
1841
|
-
const r =
|
|
1842
|
-
if (!
|
|
1854
|
+
function tt(e, t) {
|
|
1855
|
+
const r = Pe(e, t);
|
|
1856
|
+
if (!Dn(r))
|
|
1843
1857
|
throw new Error(
|
|
1844
|
-
`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${
|
|
1858
|
+
`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ge(
|
|
1845
1859
|
r
|
|
1846
1860
|
)} attribute`
|
|
1847
1861
|
);
|
|
1848
1862
|
return e;
|
|
1849
1863
|
}
|
|
1850
|
-
function
|
|
1851
|
-
const r =
|
|
1852
|
-
if (!
|
|
1864
|
+
function B(e, t) {
|
|
1865
|
+
const r = Pe(e, t);
|
|
1866
|
+
if (!Qt(r))
|
|
1853
1867
|
throw new Error(
|
|
1854
|
-
`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${
|
|
1868
|
+
`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ge(
|
|
1855
1869
|
r
|
|
1856
1870
|
)} attribute`
|
|
1857
1871
|
);
|
|
1858
1872
|
return e;
|
|
1859
1873
|
}
|
|
1860
1874
|
function z(e, t) {
|
|
1861
|
-
const r =
|
|
1862
|
-
if (!
|
|
1875
|
+
const r = Pe(e, t);
|
|
1876
|
+
if (!Ht(r))
|
|
1863
1877
|
throw new Error(
|
|
1864
|
-
`${t.pathPrefix}args[0]: Attribute must be string type, got ${
|
|
1878
|
+
`${t.pathPrefix}args[0]: Attribute must be string type, got ${ge(
|
|
1865
1879
|
r
|
|
1866
1880
|
)} attribute`
|
|
1867
1881
|
);
|
|
1868
1882
|
return e;
|
|
1869
1883
|
}
|
|
1870
|
-
function
|
|
1884
|
+
function xn(e, t) {
|
|
1871
1885
|
const r = e[0];
|
|
1872
1886
|
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1873
1887
|
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1874
1888
|
return r;
|
|
1875
1889
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const r =
|
|
1878
|
-
if (!
|
|
1890
|
+
function Nn(e, t) {
|
|
1891
|
+
const r = xn(e, t);
|
|
1892
|
+
if (!ve(r))
|
|
1879
1893
|
throw new Error(
|
|
1880
1894
|
`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`
|
|
1881
1895
|
);
|
|
1882
1896
|
return e;
|
|
1883
1897
|
}
|
|
1884
|
-
const
|
|
1885
|
-
"measureFactory.customFormula":
|
|
1898
|
+
const vn = {
|
|
1899
|
+
"measureFactory.customFormula": On,
|
|
1886
1900
|
// String | Number filters
|
|
1887
|
-
"filterFactory.equals":
|
|
1888
|
-
"filterFactory.doesntEqual":
|
|
1901
|
+
"filterFactory.equals": tt,
|
|
1902
|
+
"filterFactory.doesntEqual": tt,
|
|
1889
1903
|
// Numeric filters
|
|
1890
|
-
"filterFactory.greaterThan":
|
|
1891
|
-
"filterFactory.greaterThanOrEqual":
|
|
1892
|
-
"filterFactory.lessThan":
|
|
1893
|
-
"filterFactory.lessThanOrEqual":
|
|
1894
|
-
"filterFactory.between":
|
|
1895
|
-
"filterFactory.betweenNotEqual":
|
|
1896
|
-
"filterFactory.numeric":
|
|
1904
|
+
"filterFactory.greaterThan": B,
|
|
1905
|
+
"filterFactory.greaterThanOrEqual": B,
|
|
1906
|
+
"filterFactory.lessThan": B,
|
|
1907
|
+
"filterFactory.lessThanOrEqual": B,
|
|
1908
|
+
"filterFactory.between": B,
|
|
1909
|
+
"filterFactory.betweenNotEqual": B,
|
|
1910
|
+
"filterFactory.numeric": B,
|
|
1897
1911
|
// String filters
|
|
1898
1912
|
"filterFactory.contains": z,
|
|
1899
1913
|
"filterFactory.doesntContain": z,
|
|
@@ -1903,66 +1917,66 @@ const Dn = {
|
|
|
1903
1917
|
"filterFactory.doesntEndWith": z,
|
|
1904
1918
|
"filterFactory.like": z,
|
|
1905
1919
|
// Exclude filter
|
|
1906
|
-
"filterFactory.exclude":
|
|
1920
|
+
"filterFactory.exclude": Nn
|
|
1907
1921
|
};
|
|
1908
|
-
function
|
|
1909
|
-
return
|
|
1922
|
+
function Mn(e) {
|
|
1923
|
+
return vn[`${e}`];
|
|
1910
1924
|
}
|
|
1911
|
-
const
|
|
1925
|
+
const Xt = {
|
|
1912
1926
|
// ==================== MEASURE FACTORY FUNCTIONS ====================
|
|
1913
1927
|
// Basic aggregations
|
|
1914
1928
|
"measureFactory.sum": [
|
|
1915
1929
|
{ type: "Attribute", required: !0 },
|
|
1916
|
-
{ type: "string", required: !1 },
|
|
1930
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1917
1931
|
// name
|
|
1918
1932
|
{ type: "string", required: !1 }
|
|
1919
1933
|
// format
|
|
1920
1934
|
],
|
|
1921
1935
|
"measureFactory.average": [
|
|
1922
1936
|
{ type: "Attribute", required: !0 },
|
|
1923
|
-
{ type: "string", required: !1 },
|
|
1937
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1924
1938
|
// name
|
|
1925
1939
|
{ type: "string", required: !1 }
|
|
1926
1940
|
// format
|
|
1927
1941
|
],
|
|
1928
1942
|
"measureFactory.avg": [
|
|
1929
1943
|
{ type: "Attribute", required: !0 },
|
|
1930
|
-
{ type: "string", required: !1 },
|
|
1944
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1931
1945
|
// name
|
|
1932
1946
|
{ type: "string", required: !1 }
|
|
1933
1947
|
// format
|
|
1934
1948
|
],
|
|
1935
1949
|
"measureFactory.min": [
|
|
1936
1950
|
{ type: "Attribute", required: !0 },
|
|
1937
|
-
{ type: "string", required: !1 },
|
|
1951
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1938
1952
|
// name
|
|
1939
1953
|
{ type: "string", required: !1 }
|
|
1940
1954
|
// format
|
|
1941
1955
|
],
|
|
1942
1956
|
"measureFactory.max": [
|
|
1943
1957
|
{ type: "Attribute", required: !0 },
|
|
1944
|
-
{ type: "string", required: !1 },
|
|
1958
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1945
1959
|
// name
|
|
1946
1960
|
{ type: "string", required: !1 }
|
|
1947
1961
|
// format
|
|
1948
1962
|
],
|
|
1949
1963
|
"measureFactory.median": [
|
|
1950
1964
|
{ type: "Attribute", required: !0 },
|
|
1951
|
-
{ type: "string", required: !1 },
|
|
1965
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1952
1966
|
// name
|
|
1953
1967
|
{ type: "string", required: !1 }
|
|
1954
1968
|
// format
|
|
1955
1969
|
],
|
|
1956
1970
|
"measureFactory.count": [
|
|
1957
1971
|
{ type: "Attribute", required: !0 },
|
|
1958
|
-
{ type: "string", required: !1 },
|
|
1972
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1959
1973
|
// name
|
|
1960
1974
|
{ type: "string", required: !1 }
|
|
1961
1975
|
// format
|
|
1962
1976
|
],
|
|
1963
1977
|
"measureFactory.countDistinct": [
|
|
1964
1978
|
{ type: "Attribute", required: !0 },
|
|
1965
|
-
{ type: "string", required: !1 },
|
|
1979
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1966
1980
|
// name
|
|
1967
1981
|
{ type: "string", required: !1 }
|
|
1968
1982
|
// format
|
|
@@ -1971,7 +1985,7 @@ const Jt = {
|
|
|
1971
1985
|
{ type: "Attribute", required: !0 },
|
|
1972
1986
|
{ type: "string", required: !0 },
|
|
1973
1987
|
// aggregationType
|
|
1974
|
-
{ type: "string", required: !1 },
|
|
1988
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1975
1989
|
// name
|
|
1976
1990
|
{ type: "string", required: !1 }
|
|
1977
1991
|
// format
|
|
@@ -1979,7 +1993,7 @@ const Jt = {
|
|
|
1979
1993
|
// Constants and formulas
|
|
1980
1994
|
"measureFactory.constant": [{ type: "number", required: !0 }],
|
|
1981
1995
|
"measureFactory.customFormula": [
|
|
1982
|
-
{ type: "string", required: !0 },
|
|
1996
|
+
{ type: "string", required: !0, isName: !0 },
|
|
1983
1997
|
// title
|
|
1984
1998
|
{ type: "string", required: !0 },
|
|
1985
1999
|
// formula
|
|
@@ -1994,7 +2008,7 @@ const Jt = {
|
|
|
1994
2008
|
"measureFactory.add": [
|
|
1995
2009
|
{ type: "Measure | number", required: !0 },
|
|
1996
2010
|
{ type: "Measure | number", required: !0 },
|
|
1997
|
-
{ type: "string", required: !1 },
|
|
2011
|
+
{ type: "string", required: !1, isName: !0 },
|
|
1998
2012
|
// name
|
|
1999
2013
|
{ type: "boolean", required: !1 }
|
|
2000
2014
|
// withParentheses
|
|
@@ -2002,7 +2016,7 @@ const Jt = {
|
|
|
2002
2016
|
"measureFactory.subtract": [
|
|
2003
2017
|
{ type: "Measure | number", required: !0 },
|
|
2004
2018
|
{ type: "Measure | number", required: !0 },
|
|
2005
|
-
{ type: "string", required: !1 },
|
|
2019
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2006
2020
|
// name
|
|
2007
2021
|
{ type: "boolean", required: !1 }
|
|
2008
2022
|
// withParentheses
|
|
@@ -2010,7 +2024,7 @@ const Jt = {
|
|
|
2010
2024
|
"measureFactory.multiply": [
|
|
2011
2025
|
{ type: "Measure | number", required: !0 },
|
|
2012
2026
|
{ type: "Measure | number", required: !0 },
|
|
2013
|
-
{ type: "string", required: !1 },
|
|
2027
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2014
2028
|
// name
|
|
2015
2029
|
{ type: "boolean", required: !1 }
|
|
2016
2030
|
// withParentheses
|
|
@@ -2018,7 +2032,7 @@ const Jt = {
|
|
|
2018
2032
|
"measureFactory.divide": [
|
|
2019
2033
|
{ type: "Measure | number", required: !0 },
|
|
2020
2034
|
{ type: "Measure | number", required: !0 },
|
|
2021
|
-
{ type: "string", required: !1 },
|
|
2035
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2022
2036
|
// name
|
|
2023
2037
|
{ type: "boolean", required: !1 }
|
|
2024
2038
|
// withParentheses
|
|
@@ -2027,14 +2041,14 @@ const Jt = {
|
|
|
2027
2041
|
"measureFactory.measuredValue": [
|
|
2028
2042
|
{ type: "Measure", required: !0 },
|
|
2029
2043
|
{ type: "Filter[]", required: !0 },
|
|
2030
|
-
{ type: "string", required: !1 },
|
|
2044
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2031
2045
|
// name
|
|
2032
2046
|
{ type: "string", required: !1 }
|
|
2033
2047
|
// format
|
|
2034
2048
|
],
|
|
2035
2049
|
"measureFactory.rank": [
|
|
2036
2050
|
{ type: "Measure", required: !0 },
|
|
2037
|
-
{ type: "string", required: !1 },
|
|
2051
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2038
2052
|
// name
|
|
2039
2053
|
{ type: "string", required: !1 },
|
|
2040
2054
|
// sort
|
|
@@ -2045,14 +2059,14 @@ const Jt = {
|
|
|
2045
2059
|
],
|
|
2046
2060
|
"measureFactory.trend": [
|
|
2047
2061
|
{ type: "Measure", required: !0 },
|
|
2048
|
-
{ type: "string", required: !1 },
|
|
2062
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2049
2063
|
// name
|
|
2050
2064
|
{ type: "any", required: !1 }
|
|
2051
2065
|
// options
|
|
2052
2066
|
],
|
|
2053
2067
|
"measureFactory.forecast": [
|
|
2054
2068
|
{ type: "Measure", required: !0 },
|
|
2055
|
-
{ type: "string", required: !1 },
|
|
2069
|
+
{ type: "string", required: !1, isName: !0 },
|
|
2056
2070
|
// name
|
|
2057
2071
|
{ type: "any", required: !1 }
|
|
2058
2072
|
// options
|
|
@@ -2060,117 +2074,117 @@ const Jt = {
|
|
|
2060
2074
|
// Time-based aggregations
|
|
2061
2075
|
"measureFactory.yearToDateSum": [
|
|
2062
2076
|
{ type: "Measure", required: !0 },
|
|
2063
|
-
{ type: "string", required: !1 }
|
|
2077
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2064
2078
|
// name
|
|
2065
2079
|
],
|
|
2066
2080
|
"measureFactory.quarterToDateSum": [
|
|
2067
2081
|
{ type: "Measure", required: !0 },
|
|
2068
|
-
{ type: "string", required: !1 }
|
|
2082
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2069
2083
|
// name
|
|
2070
2084
|
],
|
|
2071
2085
|
"measureFactory.monthToDateSum": [
|
|
2072
2086
|
{ type: "Measure", required: !0 },
|
|
2073
|
-
{ type: "string", required: !1 }
|
|
2087
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2074
2088
|
// name
|
|
2075
2089
|
],
|
|
2076
2090
|
"measureFactory.weekToDateSum": [
|
|
2077
2091
|
{ type: "Measure", required: !0 },
|
|
2078
|
-
{ type: "string", required: !1 }
|
|
2092
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2079
2093
|
// name
|
|
2080
2094
|
],
|
|
2081
2095
|
"measureFactory.runningSum": [
|
|
2082
2096
|
{ type: "Measure", required: !0 },
|
|
2083
2097
|
{ type: "boolean", required: !1 },
|
|
2084
2098
|
// continuous
|
|
2085
|
-
{ type: "string", required: !1 }
|
|
2099
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2086
2100
|
// name
|
|
2087
2101
|
],
|
|
2088
2102
|
// Growth and difference calculations
|
|
2089
2103
|
"measureFactory.growth": [
|
|
2090
2104
|
{ type: "Measure", required: !0 },
|
|
2091
|
-
{ type: "string", required: !1 }
|
|
2105
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2092
2106
|
// name
|
|
2093
2107
|
],
|
|
2094
2108
|
"measureFactory.growthRate": [
|
|
2095
2109
|
{ type: "Measure", required: !0 },
|
|
2096
|
-
{ type: "string", required: !1 }
|
|
2110
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2097
2111
|
// name
|
|
2098
2112
|
],
|
|
2099
2113
|
"measureFactory.growthPastWeek": [
|
|
2100
2114
|
{ type: "Measure", required: !0 },
|
|
2101
|
-
{ type: "string", required: !1 }
|
|
2115
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2102
2116
|
// name
|
|
2103
2117
|
],
|
|
2104
2118
|
"measureFactory.growthPastMonth": [
|
|
2105
2119
|
{ type: "Measure", required: !0 },
|
|
2106
|
-
{ type: "string", required: !1 }
|
|
2120
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2107
2121
|
// name
|
|
2108
2122
|
],
|
|
2109
2123
|
"measureFactory.growthPastQuarter": [
|
|
2110
2124
|
{ type: "Measure", required: !0 },
|
|
2111
|
-
{ type: "string", required: !1 }
|
|
2125
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2112
2126
|
// name
|
|
2113
2127
|
],
|
|
2114
2128
|
"measureFactory.growthPastYear": [
|
|
2115
2129
|
{ type: "Measure", required: !0 },
|
|
2116
|
-
{ type: "string", required: !1 }
|
|
2130
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2117
2131
|
// name
|
|
2118
2132
|
],
|
|
2119
2133
|
"measureFactory.difference": [
|
|
2120
2134
|
{ type: "Measure", required: !0 },
|
|
2121
|
-
{ type: "string", required: !1 }
|
|
2135
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2122
2136
|
// name
|
|
2123
2137
|
],
|
|
2124
2138
|
"measureFactory.diffPastWeek": [
|
|
2125
2139
|
{ type: "Measure", required: !0 },
|
|
2126
|
-
{ type: "string", required: !1 }
|
|
2140
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2127
2141
|
// name
|
|
2128
2142
|
],
|
|
2129
2143
|
"measureFactory.diffPastMonth": [
|
|
2130
2144
|
{ type: "Measure", required: !0 },
|
|
2131
|
-
{ type: "string", required: !1 }
|
|
2145
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2132
2146
|
// name
|
|
2133
2147
|
],
|
|
2134
2148
|
"measureFactory.diffPastQuarter": [
|
|
2135
2149
|
{ type: "Measure", required: !0 },
|
|
2136
|
-
{ type: "string", required: !1 }
|
|
2150
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2137
2151
|
// name
|
|
2138
2152
|
],
|
|
2139
2153
|
"measureFactory.diffPastYear": [
|
|
2140
2154
|
{ type: "Measure", required: !0 },
|
|
2141
|
-
{ type: "string", required: !1 }
|
|
2155
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2142
2156
|
// name
|
|
2143
2157
|
],
|
|
2144
2158
|
// Past period measures
|
|
2145
2159
|
"measureFactory.pastDay": [
|
|
2146
2160
|
{ type: "Measure", required: !0 },
|
|
2147
|
-
{ type: "string", required: !1 }
|
|
2161
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2148
2162
|
// name
|
|
2149
2163
|
],
|
|
2150
2164
|
"measureFactory.pastWeek": [
|
|
2151
2165
|
{ type: "Measure", required: !0 },
|
|
2152
|
-
{ type: "string", required: !1 }
|
|
2166
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2153
2167
|
// name
|
|
2154
2168
|
],
|
|
2155
2169
|
"measureFactory.pastMonth": [
|
|
2156
2170
|
{ type: "Measure", required: !0 },
|
|
2157
|
-
{ type: "string", required: !1 }
|
|
2171
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2158
2172
|
// name
|
|
2159
2173
|
],
|
|
2160
2174
|
"measureFactory.pastQuarter": [
|
|
2161
2175
|
{ type: "Measure", required: !0 },
|
|
2162
|
-
{ type: "string", required: !1 }
|
|
2176
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2163
2177
|
// name
|
|
2164
2178
|
],
|
|
2165
2179
|
"measureFactory.pastYear": [
|
|
2166
2180
|
{ type: "Measure", required: !0 },
|
|
2167
|
-
{ type: "string", required: !1 }
|
|
2181
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2168
2182
|
// name
|
|
2169
2183
|
],
|
|
2170
2184
|
// Statistics
|
|
2171
2185
|
"measureFactory.contribution": [
|
|
2172
2186
|
{ type: "Measure", required: !0 },
|
|
2173
|
-
{ type: "string", required: !1 }
|
|
2187
|
+
{ type: "string", required: !1, isName: !0 }
|
|
2174
2188
|
// name
|
|
2175
2189
|
],
|
|
2176
2190
|
// ==================== FILTER FACTORY FUNCTIONS ====================
|
|
@@ -2435,18 +2449,18 @@ const Jt = {
|
|
|
2435
2449
|
{ type: "FilterRelationsNode", required: !0 }
|
|
2436
2450
|
]
|
|
2437
2451
|
};
|
|
2438
|
-
function
|
|
2439
|
-
return
|
|
2452
|
+
function ye(e) {
|
|
2453
|
+
return Xt[`${e}`];
|
|
2440
2454
|
}
|
|
2441
|
-
function
|
|
2442
|
-
const t =
|
|
2455
|
+
function Rn(e) {
|
|
2456
|
+
const t = ye(e);
|
|
2443
2457
|
return t ? t.filter((r) => r.required).length : 0;
|
|
2444
2458
|
}
|
|
2445
|
-
function
|
|
2446
|
-
const t =
|
|
2459
|
+
function In(e) {
|
|
2460
|
+
const t = ye(e);
|
|
2447
2461
|
return t ? t.length : 0;
|
|
2448
2462
|
}
|
|
2449
|
-
function
|
|
2463
|
+
function kn(e) {
|
|
2450
2464
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
2451
2465
|
return !1;
|
|
2452
2466
|
const r = Date.parse(e);
|
|
@@ -2455,319 +2469,319 @@ function Mn(e) {
|
|
|
2455
2469
|
const s = new Date(e);
|
|
2456
2470
|
return !isNaN(s.getTime());
|
|
2457
2471
|
}
|
|
2458
|
-
function
|
|
2459
|
-
if (e.startsWith(
|
|
2472
|
+
function we(e, t, r, s) {
|
|
2473
|
+
if (e.startsWith(T))
|
|
2460
2474
|
try {
|
|
2461
|
-
return
|
|
2475
|
+
return ee(e, t, r);
|
|
2462
2476
|
} catch (n) {
|
|
2463
2477
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2464
2478
|
throw new Error(`${s}: ${i}`);
|
|
2465
2479
|
}
|
|
2466
2480
|
throw new Error(
|
|
2467
|
-
`${s}: Invalid attribute '${e}'. Expected format: '${
|
|
2481
|
+
`${s}: Invalid attribute '${e}'. Expected format: '${T}TableName.ColumnName[.Level]'`
|
|
2468
2482
|
);
|
|
2469
2483
|
}
|
|
2470
|
-
function
|
|
2471
|
-
if (e.startsWith(
|
|
2484
|
+
function Ln(e, t, r, s) {
|
|
2485
|
+
if (e.startsWith(T))
|
|
2472
2486
|
try {
|
|
2473
|
-
return
|
|
2487
|
+
return Ys(e, t, r);
|
|
2474
2488
|
} catch (n) {
|
|
2475
2489
|
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2476
2490
|
throw new Error(`${s}: ${i}`);
|
|
2477
2491
|
}
|
|
2478
2492
|
throw new Error(
|
|
2479
|
-
`${s}: Invalid date dimension string '${e}'. Expected format: '${
|
|
2493
|
+
`${s}: Invalid date dimension string '${e}'. Expected format: '${T}TableName.ColumnName'`
|
|
2480
2494
|
);
|
|
2481
2495
|
}
|
|
2482
|
-
function
|
|
2483
|
-
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context,
|
|
2496
|
+
function Bn(e) {
|
|
2497
|
+
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, a = i;
|
|
2484
2498
|
if (t === void 0) {
|
|
2485
2499
|
if (r.required)
|
|
2486
|
-
throw new Error(`${
|
|
2500
|
+
throw new Error(`${a}: Required argument is missing (expected ${r.type})`);
|
|
2487
2501
|
return;
|
|
2488
2502
|
}
|
|
2489
2503
|
if (!(t === null && !r.required))
|
|
2490
2504
|
switch (r.type) {
|
|
2491
2505
|
case "string":
|
|
2492
2506
|
if (typeof t != "string")
|
|
2493
|
-
throw new Error(`${
|
|
2507
|
+
throw new Error(`${a}: Expected string, got ${typeof t}`);
|
|
2494
2508
|
return t;
|
|
2495
2509
|
case "number":
|
|
2496
2510
|
if (typeof t != "number")
|
|
2497
|
-
throw new Error(`${
|
|
2511
|
+
throw new Error(`${a}: Expected number, got ${typeof t}`);
|
|
2498
2512
|
return t;
|
|
2499
2513
|
case "boolean":
|
|
2500
2514
|
if (typeof t != "boolean")
|
|
2501
|
-
throw new Error(`${
|
|
2515
|
+
throw new Error(`${a}: Expected boolean, got ${typeof t}`);
|
|
2502
2516
|
return t;
|
|
2503
2517
|
case "string[]":
|
|
2504
2518
|
if (!Array.isArray(t))
|
|
2505
2519
|
throw new Error(
|
|
2506
|
-
`${
|
|
2520
|
+
`${a}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`
|
|
2507
2521
|
);
|
|
2508
|
-
if (!t.every((
|
|
2522
|
+
if (!t.every((o) => typeof o == "string"))
|
|
2509
2523
|
throw new Error(
|
|
2510
|
-
`${
|
|
2524
|
+
`${a}: Expected array of strings, but contains non-string values`
|
|
2511
2525
|
);
|
|
2512
2526
|
return t;
|
|
2513
2527
|
case "number[]":
|
|
2514
2528
|
if (!Array.isArray(t))
|
|
2515
2529
|
throw new Error(
|
|
2516
|
-
`${
|
|
2530
|
+
`${a}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`
|
|
2517
2531
|
);
|
|
2518
|
-
if (!t.every((
|
|
2532
|
+
if (!t.every((o) => typeof o == "number"))
|
|
2519
2533
|
throw new Error(
|
|
2520
|
-
`${
|
|
2534
|
+
`${a}: Expected array of numbers, but contains non-number values`
|
|
2521
2535
|
);
|
|
2522
2536
|
return t;
|
|
2523
2537
|
case "Attribute":
|
|
2524
2538
|
if (typeof t != "string")
|
|
2525
2539
|
throw new Error(
|
|
2526
|
-
`${
|
|
2540
|
+
`${a}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`
|
|
2527
2541
|
);
|
|
2528
|
-
return
|
|
2542
|
+
return we(t, s, n, a);
|
|
2529
2543
|
case "Attribute[]":
|
|
2530
2544
|
if (!Array.isArray(t))
|
|
2531
2545
|
throw new Error(
|
|
2532
|
-
`${
|
|
2546
|
+
`${a}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`
|
|
2533
2547
|
);
|
|
2534
|
-
return t.map((
|
|
2535
|
-
if (typeof
|
|
2536
|
-
throw new Error(`${
|
|
2537
|
-
return
|
|
2548
|
+
return t.map((o, u) => {
|
|
2549
|
+
if (typeof o != "string")
|
|
2550
|
+
throw new Error(`${a}[${u}]: Expected attribute string, got ${typeof o}`);
|
|
2551
|
+
return we(o, s, n, `${a}[${u}]`);
|
|
2538
2552
|
});
|
|
2539
2553
|
case "Measure":
|
|
2540
2554
|
case "BaseMeasure":
|
|
2541
|
-
if (!
|
|
2555
|
+
if (!w(t))
|
|
2542
2556
|
throw new Error(
|
|
2543
|
-
`${
|
|
2557
|
+
`${a}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`
|
|
2544
2558
|
);
|
|
2545
2559
|
return M({
|
|
2546
2560
|
data: t,
|
|
2547
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2561
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2548
2562
|
});
|
|
2549
2563
|
case "Measure[]":
|
|
2550
2564
|
if (!Array.isArray(t))
|
|
2551
2565
|
throw new Error(
|
|
2552
|
-
`${
|
|
2566
|
+
`${a}: Expected array of measure function calls, got ${typeof t}`
|
|
2553
2567
|
);
|
|
2554
|
-
return t.map((
|
|
2555
|
-
if (!
|
|
2568
|
+
return t.map((o, u) => {
|
|
2569
|
+
if (!w(o))
|
|
2556
2570
|
throw new Error(
|
|
2557
|
-
`${
|
|
2571
|
+
`${a}[${u}]: Expected measure function call, got ${typeof o}`
|
|
2558
2572
|
);
|
|
2559
2573
|
return M({
|
|
2560
|
-
data:
|
|
2561
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2574
|
+
data: o,
|
|
2575
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2562
2576
|
});
|
|
2563
2577
|
});
|
|
2564
2578
|
case "Filter":
|
|
2565
|
-
if (!
|
|
2579
|
+
if (!w(t))
|
|
2566
2580
|
throw new Error(
|
|
2567
|
-
`${
|
|
2581
|
+
`${a}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`
|
|
2568
2582
|
);
|
|
2569
2583
|
return M({
|
|
2570
2584
|
data: t,
|
|
2571
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2585
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2572
2586
|
});
|
|
2573
2587
|
case "Filter[]":
|
|
2574
2588
|
if (!Array.isArray(t))
|
|
2575
2589
|
throw new Error(
|
|
2576
|
-
`${
|
|
2590
|
+
`${a}: Expected array of filter function calls, got ${typeof t}`
|
|
2577
2591
|
);
|
|
2578
|
-
return t.map((
|
|
2579
|
-
if (!
|
|
2592
|
+
return t.map((o, u) => {
|
|
2593
|
+
if (!w(o))
|
|
2580
2594
|
throw new Error(
|
|
2581
|
-
`${
|
|
2595
|
+
`${a}[${u}]: Expected filter function call, got ${typeof o}`
|
|
2582
2596
|
);
|
|
2583
2597
|
return M({
|
|
2584
|
-
data:
|
|
2585
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2598
|
+
data: o,
|
|
2599
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2586
2600
|
});
|
|
2587
2601
|
});
|
|
2588
2602
|
case "FilterRelationsNode":
|
|
2589
2603
|
if (Array.isArray(t))
|
|
2590
|
-
return t.map((
|
|
2591
|
-
if (!
|
|
2604
|
+
return t.map((o, u) => {
|
|
2605
|
+
if (!w(o))
|
|
2592
2606
|
throw new Error(
|
|
2593
|
-
`${
|
|
2607
|
+
`${a}[${u}]: Expected filter function call, got ${typeof o}`
|
|
2594
2608
|
);
|
|
2595
2609
|
return M({
|
|
2596
|
-
data:
|
|
2597
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2610
|
+
data: o,
|
|
2611
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${a}[${u}]` }
|
|
2598
2612
|
});
|
|
2599
2613
|
});
|
|
2600
|
-
if (
|
|
2614
|
+
if (w(t))
|
|
2601
2615
|
return M({
|
|
2602
2616
|
data: t,
|
|
2603
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2617
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2604
2618
|
});
|
|
2605
2619
|
throw new Error(
|
|
2606
|
-
`${
|
|
2620
|
+
`${a}: Expected filter function call or array of filters, got ${typeof t}`
|
|
2607
2621
|
);
|
|
2608
2622
|
case "DateDimension":
|
|
2609
2623
|
if (typeof t != "string")
|
|
2610
2624
|
throw new Error(
|
|
2611
|
-
`${
|
|
2625
|
+
`${a}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`
|
|
2612
2626
|
);
|
|
2613
|
-
return
|
|
2627
|
+
return Ln(t, s, n, a);
|
|
2614
2628
|
case "LevelAttribute": {
|
|
2615
2629
|
if (typeof t != "string")
|
|
2616
2630
|
throw new Error(
|
|
2617
|
-
`${
|
|
2631
|
+
`${a}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`
|
|
2618
2632
|
);
|
|
2619
|
-
const
|
|
2633
|
+
const o = we(
|
|
2620
2634
|
t,
|
|
2621
2635
|
s,
|
|
2622
2636
|
n,
|
|
2623
|
-
|
|
2637
|
+
a
|
|
2624
2638
|
);
|
|
2625
|
-
if (
|
|
2639
|
+
if (!$n(o))
|
|
2626
2640
|
throw new Error(
|
|
2627
|
-
`${
|
|
2628
|
-
|
|
2641
|
+
`${a}: Attribute must be date/datetime type, got ${ge(
|
|
2642
|
+
o
|
|
2629
2643
|
)} attribute`
|
|
2630
2644
|
);
|
|
2631
|
-
return
|
|
2645
|
+
return o;
|
|
2632
2646
|
}
|
|
2633
2647
|
case "Measure | number":
|
|
2634
2648
|
if (typeof t == "number")
|
|
2635
2649
|
return t;
|
|
2636
|
-
if (
|
|
2650
|
+
if (w(t))
|
|
2637
2651
|
return M({
|
|
2638
2652
|
data: t,
|
|
2639
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2653
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: a }
|
|
2640
2654
|
});
|
|
2641
2655
|
throw new Error(
|
|
2642
|
-
`${
|
|
2656
|
+
`${a}: Expected measure function call or number, got ${typeof t}`
|
|
2643
2657
|
);
|
|
2644
2658
|
case "Date | string":
|
|
2645
2659
|
if (typeof t == "string") {
|
|
2646
|
-
if (
|
|
2660
|
+
if (kn(t))
|
|
2647
2661
|
return t;
|
|
2648
2662
|
throw new Error(
|
|
2649
|
-
`${
|
|
2663
|
+
`${a}: Expected valid ISO date string or Date object, got invalid date string '${t}'`
|
|
2650
2664
|
);
|
|
2651
2665
|
} else {
|
|
2652
2666
|
if (t instanceof Date)
|
|
2653
2667
|
return t;
|
|
2654
2668
|
throw new Error(
|
|
2655
|
-
`${
|
|
2669
|
+
`${a}: Expected date string or Date object, got ${typeof t}`
|
|
2656
2670
|
);
|
|
2657
2671
|
}
|
|
2658
2672
|
case "string | number":
|
|
2659
2673
|
if (typeof t == "string" || typeof t == "number")
|
|
2660
2674
|
return t;
|
|
2661
|
-
throw new Error(`${
|
|
2675
|
+
throw new Error(`${a}: Expected string or number, got ${typeof t}`);
|
|
2662
2676
|
case "BaseFilterConfig":
|
|
2663
2677
|
case "MembersFilterConfig":
|
|
2664
2678
|
case "CustomFormulaContext":
|
|
2665
2679
|
case "any":
|
|
2666
2680
|
if (t == null && r.required)
|
|
2667
|
-
throw new Error(`${
|
|
2681
|
+
throw new Error(`${a}: Required argument is null/undefined`);
|
|
2668
2682
|
return t;
|
|
2669
2683
|
default:
|
|
2670
2684
|
return t;
|
|
2671
2685
|
}
|
|
2672
2686
|
}
|
|
2673
2687
|
function M(e) {
|
|
2674
|
-
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args:
|
|
2688
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: a } = t, o = n ? `${n}.` : "", u = ye(i);
|
|
2675
2689
|
if (!u) {
|
|
2676
|
-
const
|
|
2690
|
+
const m = Object.keys(Xt), F = x(i, m, (N) => N), O = F && F.distance <= C ? ` Did you mean '${F.best}'?` : "";
|
|
2677
2691
|
throw new Error(
|
|
2678
|
-
`${
|
|
2692
|
+
`${o}function: Unknown function '${i}'.${O}`
|
|
2679
2693
|
);
|
|
2680
2694
|
}
|
|
2681
|
-
const c =
|
|
2682
|
-
if (
|
|
2695
|
+
const c = Rn(i), g = In(i);
|
|
2696
|
+
if (a.length < c)
|
|
2683
2697
|
throw new Error(
|
|
2684
|
-
`${
|
|
2698
|
+
`${o}function: Expected at least ${c} arguments, got ${a.length}`
|
|
2685
2699
|
);
|
|
2686
|
-
if (
|
|
2700
|
+
if (a.length > g)
|
|
2687
2701
|
throw new Error(
|
|
2688
|
-
`${
|
|
2702
|
+
`${o}function: Expected at most ${g} arguments, got ${a.length}`
|
|
2689
2703
|
);
|
|
2690
|
-
const
|
|
2691
|
-
for (let
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2694
|
-
|
|
2704
|
+
const f = [], p = [];
|
|
2705
|
+
for (let m = 0; m < Math.max(a.length, u.length); m++) {
|
|
2706
|
+
const F = u[`${m}`], O = a[`${m}`], N = o ? `${o}args[${m}]` : `args[${m}]`;
|
|
2707
|
+
if (O === void 0) {
|
|
2708
|
+
F != null && F.required && p.push(`${N}: Missing required argument (expected ${F.type})`);
|
|
2695
2709
|
continue;
|
|
2696
2710
|
}
|
|
2697
|
-
if (!
|
|
2698
|
-
|
|
2711
|
+
if (!F) {
|
|
2712
|
+
p.push(`${N}: Unexpected argument`);
|
|
2699
2713
|
continue;
|
|
2700
2714
|
}
|
|
2701
2715
|
try {
|
|
2702
|
-
const W =
|
|
2703
|
-
data:
|
|
2716
|
+
const W = Bn({
|
|
2717
|
+
data: O,
|
|
2704
2718
|
context: {
|
|
2705
2719
|
dataSource: r,
|
|
2706
2720
|
schemaIndex: s,
|
|
2707
|
-
pathPrefix:
|
|
2708
|
-
argSchema:
|
|
2721
|
+
pathPrefix: N,
|
|
2722
|
+
argSchema: F
|
|
2709
2723
|
}
|
|
2710
2724
|
});
|
|
2711
|
-
|
|
2725
|
+
f.push(W);
|
|
2712
2726
|
} catch (W) {
|
|
2713
|
-
const
|
|
2714
|
-
|
|
2727
|
+
const or = W instanceof Error ? W.message : "Unknown error";
|
|
2728
|
+
p.push(or);
|
|
2715
2729
|
}
|
|
2716
2730
|
}
|
|
2717
|
-
if (
|
|
2718
|
-
const
|
|
2719
|
-
throw new Error(
|
|
2731
|
+
if (p.length > 0) {
|
|
2732
|
+
const m = p.join("; ");
|
|
2733
|
+
throw new Error(m);
|
|
2720
2734
|
}
|
|
2721
|
-
let h =
|
|
2722
|
-
const b =
|
|
2735
|
+
let h = f;
|
|
2736
|
+
const b = Mn(i);
|
|
2723
2737
|
if (b)
|
|
2724
2738
|
try {
|
|
2725
|
-
h = b(
|
|
2739
|
+
h = b(f, {
|
|
2726
2740
|
dataSource: r,
|
|
2727
2741
|
schemaIndex: s,
|
|
2728
|
-
pathPrefix:
|
|
2742
|
+
pathPrefix: o
|
|
2729
2743
|
});
|
|
2730
|
-
} catch (
|
|
2731
|
-
const
|
|
2732
|
-
throw new Error(
|
|
2744
|
+
} catch (m) {
|
|
2745
|
+
const F = m instanceof Error ? m.message : "Unknown validation error";
|
|
2746
|
+
throw new Error(F);
|
|
2733
2747
|
}
|
|
2734
|
-
return
|
|
2748
|
+
return rn(i, h);
|
|
2735
2749
|
}
|
|
2736
|
-
function
|
|
2750
|
+
function Zt(e) {
|
|
2737
2751
|
const { attribute: t, config: r } = e;
|
|
2738
|
-
if (
|
|
2739
|
-
const { granularity: s } = t, n = e.members.map((
|
|
2740
|
-
return
|
|
2752
|
+
if (ve(e) && ts(t)) {
|
|
2753
|
+
const { granularity: s } = t, n = e.members.map((o) => s === "Years" && !isNaN(Number(o)) ? `${o}-01-01T00:00:00` : o), i = rs(r), a = Object.keys(i).length === 0 ? void 0 : i;
|
|
2754
|
+
return ss(t, n, a);
|
|
2741
2755
|
}
|
|
2742
2756
|
return e;
|
|
2743
2757
|
}
|
|
2744
|
-
function
|
|
2758
|
+
function zn(e) {
|
|
2745
2759
|
let t = [];
|
|
2746
2760
|
for (const r of e)
|
|
2747
|
-
|
|
2761
|
+
re(r) ? t = Ge(r, t) : t = Ge([Zt(r)], t);
|
|
2748
2762
|
return t != null ? t : [];
|
|
2749
2763
|
}
|
|
2750
|
-
const
|
|
2764
|
+
const Un = (e) => {
|
|
2751
2765
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2752
|
-
return t.forEach((
|
|
2766
|
+
return t.forEach((a, o) => {
|
|
2753
2767
|
const u = {
|
|
2754
|
-
path: `filters[${
|
|
2755
|
-
input:
|
|
2768
|
+
path: `filters[${o}]`,
|
|
2769
|
+
input: a
|
|
2756
2770
|
};
|
|
2757
2771
|
try {
|
|
2758
2772
|
const c = M({
|
|
2759
|
-
data:
|
|
2773
|
+
data: a,
|
|
2760
2774
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2761
2775
|
});
|
|
2762
|
-
!
|
|
2776
|
+
!re(c) && !pe(c) ? i.push(E(l({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2763
2777
|
} catch (c) {
|
|
2764
2778
|
const g = c instanceof Error ? c.message : "Unknown error";
|
|
2765
|
-
i.push(
|
|
2779
|
+
i.push(E(l({}, u), { message: g }));
|
|
2766
2780
|
}
|
|
2767
|
-
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data:
|
|
2768
|
-
},
|
|
2781
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: zn(n) };
|
|
2782
|
+
}, ne = (e) => {
|
|
2769
2783
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2770
|
-
return t ?
|
|
2784
|
+
return t ? Bt(t) ? Un({
|
|
2771
2785
|
data: t,
|
|
2772
2786
|
context: { dataSource: r, schemaIndex: s }
|
|
2773
2787
|
}) : {
|
|
@@ -2780,27 +2794,27 @@ const Bn = (e) => {
|
|
|
2780
2794
|
}
|
|
2781
2795
|
]
|
|
2782
2796
|
} : { success: !0, data: [] };
|
|
2783
|
-
},
|
|
2797
|
+
}, _n = (e) => {
|
|
2784
2798
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2785
|
-
return t.forEach((
|
|
2799
|
+
return t.forEach((a, o) => {
|
|
2786
2800
|
const u = {
|
|
2787
|
-
path: `highlights[${
|
|
2788
|
-
input:
|
|
2801
|
+
path: `highlights[${o}]`,
|
|
2802
|
+
input: a
|
|
2789
2803
|
};
|
|
2790
2804
|
try {
|
|
2791
2805
|
const c = M({
|
|
2792
|
-
data:
|
|
2806
|
+
data: a,
|
|
2793
2807
|
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2794
2808
|
});
|
|
2795
|
-
|
|
2809
|
+
pe(c) ? n.push(Zt(c)) : i.push(E(l({}, u), { message: "Invalid filter JSON" }));
|
|
2796
2810
|
} catch (c) {
|
|
2797
2811
|
const g = c instanceof Error ? c.message : "Unknown error";
|
|
2798
|
-
i.push(
|
|
2812
|
+
i.push(E(l({}, u), { message: g }));
|
|
2799
2813
|
}
|
|
2800
2814
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2801
|
-
},
|
|
2815
|
+
}, he = (e) => {
|
|
2802
2816
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2803
|
-
return t ?
|
|
2817
|
+
return t ? Bt(t) ? _n({
|
|
2804
2818
|
data: t,
|
|
2805
2819
|
context: { dataSource: r, schemaIndex: s }
|
|
2806
2820
|
}) : {
|
|
@@ -2813,51 +2827,51 @@ const Bn = (e) => {
|
|
|
2813
2827
|
}
|
|
2814
2828
|
]
|
|
2815
2829
|
} : { success: !0, data: [] };
|
|
2816
|
-
},
|
|
2817
|
-
if (e && !
|
|
2818
|
-
return
|
|
2830
|
+
}, Pn = (e, t) => {
|
|
2831
|
+
if (e && !pt(e))
|
|
2832
|
+
return E(l({}, t), {
|
|
2819
2833
|
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2820
2834
|
});
|
|
2821
|
-
},
|
|
2835
|
+
}, Wn = (e, t, r) => {
|
|
2822
2836
|
const { dataSource: s, schemaIndex: n } = t;
|
|
2823
2837
|
try {
|
|
2824
2838
|
const i = M({
|
|
2825
2839
|
data: e,
|
|
2826
2840
|
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2827
2841
|
});
|
|
2828
|
-
return
|
|
2842
|
+
return ze(i) ? { success: !0, data: i } : {
|
|
2829
2843
|
success: !1,
|
|
2830
|
-
errors: [
|
|
2844
|
+
errors: [E(l({}, r), { message: "Invalid measure JSON" })]
|
|
2831
2845
|
};
|
|
2832
2846
|
} catch (i) {
|
|
2833
|
-
const
|
|
2847
|
+
const a = i instanceof Error ? i.message : "Unknown error";
|
|
2834
2848
|
return {
|
|
2835
2849
|
success: !1,
|
|
2836
|
-
errors: [
|
|
2850
|
+
errors: [E(l({}, r), { message: a })]
|
|
2837
2851
|
};
|
|
2838
2852
|
}
|
|
2839
|
-
},
|
|
2853
|
+
}, Vn = (e, t, r, s) => {
|
|
2840
2854
|
const n = M({
|
|
2841
2855
|
data: e.column,
|
|
2842
2856
|
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
2843
2857
|
});
|
|
2844
|
-
if (!
|
|
2858
|
+
if (!ze(n))
|
|
2845
2859
|
return {
|
|
2846
2860
|
style: {},
|
|
2847
|
-
error:
|
|
2861
|
+
error: E(l({}, s), { message: "Invalid measure JSON" })
|
|
2848
2862
|
};
|
|
2849
|
-
const i =
|
|
2863
|
+
const i = Pn(e.sortType, s);
|
|
2850
2864
|
if (i) {
|
|
2851
|
-
const
|
|
2852
|
-
return { measure: n, style:
|
|
2865
|
+
const o = _(e, "column");
|
|
2866
|
+
return { measure: n, style: o, error: i };
|
|
2853
2867
|
}
|
|
2854
|
-
const
|
|
2855
|
-
return { measure: n, style:
|
|
2856
|
-
},
|
|
2857
|
-
if (
|
|
2858
|
-
return
|
|
2859
|
-
if (
|
|
2860
|
-
const n =
|
|
2868
|
+
const a = _(e, "column");
|
|
2869
|
+
return { measure: n, style: a };
|
|
2870
|
+
}, jn = (e, t, r, s) => {
|
|
2871
|
+
if (Ut(e))
|
|
2872
|
+
return Vn(e, t, r, s);
|
|
2873
|
+
if (w(e)) {
|
|
2874
|
+
const n = Wn(
|
|
2861
2875
|
e,
|
|
2862
2876
|
{ dataSource: t, schemaIndex: r },
|
|
2863
2877
|
s
|
|
@@ -2865,11 +2879,11 @@ const Bn = (e) => {
|
|
|
2865
2879
|
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2866
2880
|
}
|
|
2867
2881
|
return {
|
|
2868
|
-
error:
|
|
2882
|
+
error: E(l({}, s), {
|
|
2869
2883
|
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2870
2884
|
})
|
|
2871
2885
|
};
|
|
2872
|
-
},
|
|
2886
|
+
}, er = (e) => {
|
|
2873
2887
|
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2874
2888
|
if (!t)
|
|
2875
2889
|
return { success: !0, data: [] };
|
|
@@ -2885,13 +2899,13 @@ const Bn = (e) => {
|
|
|
2885
2899
|
]
|
|
2886
2900
|
};
|
|
2887
2901
|
const n = [], i = [];
|
|
2888
|
-
return t.forEach((
|
|
2902
|
+
return t.forEach((a, o) => {
|
|
2889
2903
|
const u = {
|
|
2890
|
-
path: `measures[${
|
|
2891
|
-
input:
|
|
2904
|
+
path: `measures[${o}]`,
|
|
2905
|
+
input: a
|
|
2892
2906
|
};
|
|
2893
2907
|
try {
|
|
2894
|
-
const c =
|
|
2908
|
+
const c = jn(a, r, s, u);
|
|
2895
2909
|
if (c.error) {
|
|
2896
2910
|
i.push(c.error);
|
|
2897
2911
|
return;
|
|
@@ -2901,14 +2915,14 @@ const Bn = (e) => {
|
|
|
2901
2915
|
);
|
|
2902
2916
|
} catch (c) {
|
|
2903
2917
|
const g = c instanceof Error ? c.message : "Unknown error";
|
|
2904
|
-
i.push(
|
|
2918
|
+
i.push(E(l({}, u), { message: g }));
|
|
2905
2919
|
}
|
|
2906
2920
|
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2907
2921
|
};
|
|
2908
|
-
function
|
|
2922
|
+
function ue(e) {
|
|
2909
2923
|
return typeof e == "string" ? e : e.title;
|
|
2910
2924
|
}
|
|
2911
|
-
function
|
|
2925
|
+
function Jn(e) {
|
|
2912
2926
|
const t = {};
|
|
2913
2927
|
for (const [r, s] of Object.entries(e)) {
|
|
2914
2928
|
const n = {};
|
|
@@ -2916,12 +2930,12 @@ function Wn(e) {
|
|
|
2916
2930
|
}
|
|
2917
2931
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
2918
2932
|
}
|
|
2919
|
-
function
|
|
2933
|
+
function tr(e) {
|
|
2920
2934
|
return typeof e == "object" && e !== null && "toJSON" in e && typeof e.toJSON == "function" ? e.toJSON() : e;
|
|
2921
2935
|
}
|
|
2922
|
-
function
|
|
2923
|
-
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(
|
|
2924
|
-
Object.entries(e).map(([t, r]) => [t,
|
|
2936
|
+
function L(e) {
|
|
2937
|
+
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(L) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
2938
|
+
Object.entries(e).map(([t, r]) => [t, L(r)])
|
|
2925
2939
|
) : e;
|
|
2926
2940
|
}
|
|
2927
2941
|
function A(e, t, r) {
|
|
@@ -2932,21 +2946,21 @@ function A(e, t, r) {
|
|
|
2932
2946
|
}
|
|
2933
2947
|
return s.data;
|
|
2934
2948
|
}
|
|
2935
|
-
const
|
|
2936
|
-
const { data: t } = e, { dataSource: r, tables: s } = e.context, n =
|
|
2937
|
-
() =>
|
|
2949
|
+
const zi = (e) => {
|
|
2950
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = se(s), i = [], a = A(
|
|
2951
|
+
() => Pt({
|
|
2938
2952
|
data: t.dimensions || [],
|
|
2939
2953
|
context: { dataSource: r, schemaIndex: n }
|
|
2940
2954
|
}),
|
|
2941
2955
|
i
|
|
2942
|
-
),
|
|
2943
|
-
() =>
|
|
2956
|
+
), o = A(
|
|
2957
|
+
() => er({
|
|
2944
2958
|
data: t.measures || [],
|
|
2945
2959
|
context: { dataSource: r, schemaIndex: n }
|
|
2946
2960
|
}),
|
|
2947
2961
|
i
|
|
2948
2962
|
), u = A(
|
|
2949
|
-
() =>
|
|
2963
|
+
() => ne({
|
|
2950
2964
|
data: t.filters || [],
|
|
2951
2965
|
context: { dataSource: r, schemaIndex: n }
|
|
2952
2966
|
}),
|
|
@@ -2954,7 +2968,7 @@ const xi = (e) => {
|
|
|
2954
2968
|
);
|
|
2955
2969
|
let c = null;
|
|
2956
2970
|
return t.highlights && (c = A(
|
|
2957
|
-
() =>
|
|
2971
|
+
() => he({
|
|
2958
2972
|
data: t.highlights || [],
|
|
2959
2973
|
context: { dataSource: r, schemaIndex: n }
|
|
2960
2974
|
}),
|
|
@@ -2965,53 +2979,53 @@ const xi = (e) => {
|
|
|
2965
2979
|
} : {
|
|
2966
2980
|
success: !0,
|
|
2967
2981
|
data: l({
|
|
2968
|
-
dataSource:
|
|
2969
|
-
dimensions:
|
|
2970
|
-
measures:
|
|
2982
|
+
dataSource: de(r),
|
|
2983
|
+
dimensions: a ? ns(a) : [],
|
|
2984
|
+
measures: o ? is(o) : [],
|
|
2971
2985
|
filters: u || []
|
|
2972
2986
|
}, c && { highlights: c })
|
|
2973
2987
|
};
|
|
2974
2988
|
};
|
|
2975
|
-
function
|
|
2989
|
+
function rt(e) {
|
|
2976
2990
|
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
2977
2991
|
}
|
|
2978
|
-
function
|
|
2992
|
+
function We(e) {
|
|
2979
2993
|
const t = [], r = [];
|
|
2980
2994
|
return e.forEach((s, n) => {
|
|
2981
|
-
var
|
|
2982
|
-
const i =
|
|
2995
|
+
var f, p, h;
|
|
2996
|
+
const i = rt(s) ? s.column : s, a = rt(s) ? s : void 0, o = () => tr(i);
|
|
2983
2997
|
if (!i.composeCode) {
|
|
2984
2998
|
r.push({
|
|
2985
2999
|
path: `dimensions[${n}]`,
|
|
2986
|
-
input:
|
|
3000
|
+
input: o(),
|
|
2987
3001
|
message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2988
3002
|
});
|
|
2989
3003
|
return;
|
|
2990
3004
|
}
|
|
2991
|
-
if (!i.composeCode.startsWith(
|
|
3005
|
+
if (!i.composeCode.startsWith(T)) {
|
|
2992
3006
|
r.push({
|
|
2993
3007
|
path: `dimensions[${n}]`,
|
|
2994
|
-
input:
|
|
2995
|
-
message: `Expected composeCode to start with '${
|
|
3008
|
+
input: o(),
|
|
3009
|
+
message: `Expected composeCode to start with '${T}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2996
3010
|
});
|
|
2997
3011
|
return;
|
|
2998
3012
|
}
|
|
2999
|
-
const u = (h =
|
|
3000
|
-
if (u !== void 0 && u !== U.None ||
|
|
3013
|
+
const u = (h = a != null && a.sortType ? gt(a.sortType) : void 0) != null ? h : ((f = i.getSort) == null ? void 0 : f.call(i)) !== void 0 && ((p = i.getSort) == null ? void 0 : p.call(i)) !== U.None ? i.getSort() : void 0, c = a ? _(a, "column") : {};
|
|
3014
|
+
if (u !== void 0 && u !== U.None || a && Object.keys(c).length > 0) {
|
|
3001
3015
|
const b = l(l({
|
|
3002
3016
|
column: i.composeCode
|
|
3003
|
-
}, u !== void 0 && u !== U.None && { sortType:
|
|
3017
|
+
}, u !== void 0 && u !== U.None && { sortType: yt(u) }), c);
|
|
3004
3018
|
t.push(b);
|
|
3005
3019
|
} else
|
|
3006
3020
|
t.push(i.composeCode);
|
|
3007
3021
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3008
3022
|
}
|
|
3009
|
-
const
|
|
3010
|
-
function
|
|
3023
|
+
const De = "Unknown error";
|
|
3024
|
+
function ie(e) {
|
|
3011
3025
|
if (!e)
|
|
3012
3026
|
return { success: !0, data: [] };
|
|
3013
3027
|
const t = [];
|
|
3014
|
-
if (
|
|
3028
|
+
if (as(e)) {
|
|
3015
3029
|
if (!e.composeCode)
|
|
3016
3030
|
return {
|
|
3017
3031
|
success: !1,
|
|
@@ -3026,7 +3040,7 @@ function ne(e) {
|
|
|
3026
3040
|
try {
|
|
3027
3041
|
return { success: !0, data: [J(e.composeCode)] };
|
|
3028
3042
|
} catch (s) {
|
|
3029
|
-
const n = s instanceof Error ? s.message :
|
|
3043
|
+
const n = s instanceof Error ? s.message : De;
|
|
3030
3044
|
return {
|
|
3031
3045
|
success: !1,
|
|
3032
3046
|
errors: [
|
|
@@ -3051,19 +3065,19 @@ function ne(e) {
|
|
|
3051
3065
|
return;
|
|
3052
3066
|
}
|
|
3053
3067
|
try {
|
|
3054
|
-
const
|
|
3055
|
-
r.push(
|
|
3056
|
-
} catch (
|
|
3057
|
-
const
|
|
3068
|
+
const a = J(s.composeCode);
|
|
3069
|
+
r.push(a);
|
|
3070
|
+
} catch (a) {
|
|
3071
|
+
const o = a instanceof Error ? a.message : De;
|
|
3058
3072
|
t.push({
|
|
3059
3073
|
path: `filters[${n}]`,
|
|
3060
3074
|
input: s,
|
|
3061
|
-
message: `Failed to parse composeCode for filter at index ${n}: ${
|
|
3075
|
+
message: `Failed to parse composeCode for filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
|
|
3062
3076
|
});
|
|
3063
3077
|
}
|
|
3064
3078
|
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
3065
3079
|
}
|
|
3066
|
-
function
|
|
3080
|
+
function be(e) {
|
|
3067
3081
|
if (!e)
|
|
3068
3082
|
return { success: !0, data: [] };
|
|
3069
3083
|
const t = [], r = [];
|
|
@@ -3078,62 +3092,62 @@ function ge(e) {
|
|
|
3078
3092
|
return;
|
|
3079
3093
|
}
|
|
3080
3094
|
try {
|
|
3081
|
-
const
|
|
3082
|
-
t.push(
|
|
3083
|
-
} catch (
|
|
3084
|
-
const
|
|
3095
|
+
const a = J(s.composeCode);
|
|
3096
|
+
t.push(a);
|
|
3097
|
+
} catch (a) {
|
|
3098
|
+
const o = a instanceof Error ? a.message : De;
|
|
3085
3099
|
r.push({
|
|
3086
3100
|
path: `highlights[${n}]`,
|
|
3087
3101
|
input: s,
|
|
3088
|
-
message: `Failed to parse composeCode for highlight filter at index ${n}: ${
|
|
3102
|
+
message: `Failed to parse composeCode for highlight filter at index ${n}: ${o}. ComposeCode: '${s.composeCode}'`
|
|
3089
3103
|
});
|
|
3090
3104
|
}
|
|
3091
3105
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3092
3106
|
}
|
|
3093
|
-
function
|
|
3107
|
+
function st(e) {
|
|
3094
3108
|
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
3095
3109
|
}
|
|
3096
|
-
function
|
|
3110
|
+
function Ve(e) {
|
|
3097
3111
|
const t = [], r = [];
|
|
3098
3112
|
return e.forEach((s, n) => {
|
|
3099
3113
|
var u, c, g;
|
|
3100
|
-
const i =
|
|
3114
|
+
const i = st(s) ? s.column : s, a = st(s) ? s : void 0, o = () => tr(i);
|
|
3101
3115
|
if (!i.composeCode) {
|
|
3102
3116
|
r.push({
|
|
3103
3117
|
path: `measures[${n}]`,
|
|
3104
|
-
input:
|
|
3118
|
+
input: o(),
|
|
3105
3119
|
message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
3106
3120
|
});
|
|
3107
3121
|
return;
|
|
3108
3122
|
}
|
|
3109
3123
|
try {
|
|
3110
|
-
const
|
|
3111
|
-
if (
|
|
3112
|
-
const b =
|
|
3113
|
-
column:
|
|
3114
|
-
},
|
|
3115
|
-
t.push(
|
|
3124
|
+
const f = J(i.composeCode), p = (g = a != null && a.sortType ? gt(a.sortType) : void 0) != null ? g : ((u = i.getSort) == null ? void 0 : u.call(i)) !== void 0 && ((c = i.getSort) == null ? void 0 : c.call(i)) !== U.None ? i.getSort() : void 0;
|
|
3125
|
+
if (p !== void 0 && p !== U.None || a && Object.keys(_(a, "column")).length > 0) {
|
|
3126
|
+
const b = a ? _(a, "column") : {}, m = l(l({
|
|
3127
|
+
column: f
|
|
3128
|
+
}, p !== void 0 && p !== U.None && { sortType: yt(p) }), b);
|
|
3129
|
+
t.push(m);
|
|
3116
3130
|
} else
|
|
3117
|
-
t.push(
|
|
3118
|
-
} catch (
|
|
3119
|
-
const
|
|
3131
|
+
t.push(f);
|
|
3132
|
+
} catch (f) {
|
|
3133
|
+
const p = f instanceof Error ? f.message : "Unknown error";
|
|
3120
3134
|
r.push({
|
|
3121
3135
|
path: `measures[${n}]`,
|
|
3122
|
-
input:
|
|
3123
|
-
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${
|
|
3136
|
+
input: o(),
|
|
3137
|
+
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${p}. ComposeCode: '${i.composeCode}'`
|
|
3124
3138
|
});
|
|
3125
3139
|
}
|
|
3126
3140
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3127
3141
|
}
|
|
3128
|
-
function
|
|
3142
|
+
function nt(e) {
|
|
3129
3143
|
var t, r, s, n;
|
|
3130
|
-
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(
|
|
3144
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(ht)) != null ? n : !1);
|
|
3131
3145
|
}
|
|
3132
|
-
function
|
|
3146
|
+
function it(e) {
|
|
3133
3147
|
var t, r, s, n;
|
|
3134
|
-
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(
|
|
3148
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(bt)) != null ? n : !1);
|
|
3135
3149
|
}
|
|
3136
|
-
function
|
|
3150
|
+
function at(e) {
|
|
3137
3151
|
try {
|
|
3138
3152
|
const t = J(e.trim());
|
|
3139
3153
|
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : void 0;
|
|
@@ -3141,67 +3155,67 @@ function st(e) {
|
|
|
3141
3155
|
return;
|
|
3142
3156
|
}
|
|
3143
3157
|
}
|
|
3144
|
-
function
|
|
3158
|
+
function Kn(e) {
|
|
3145
3159
|
var s, n, i;
|
|
3146
3160
|
if (!(e != null && e.length)) return [];
|
|
3147
3161
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
3148
|
-
for (let
|
|
3149
|
-
if (t.has(
|
|
3150
|
-
const
|
|
3151
|
-
if (
|
|
3152
|
-
r.push(
|
|
3162
|
+
for (let a = 0; a < e.length; a++) {
|
|
3163
|
+
if (t.has(a)) continue;
|
|
3164
|
+
const o = e[a];
|
|
3165
|
+
if (nt(o) || it(o)) {
|
|
3166
|
+
r.push(o);
|
|
3153
3167
|
continue;
|
|
3154
3168
|
}
|
|
3155
|
-
const u = (s =
|
|
3156
|
-
let
|
|
3157
|
-
if (h < e.length && !t.has(h) &&
|
|
3169
|
+
const u = (s = o.name) != null ? s : "Measure", c = `${ht}_${u}`, g = `${bt}_${u}`;
|
|
3170
|
+
let f, p, h = a + 1;
|
|
3171
|
+
if (h < e.length && !t.has(h) && nt(e[h]) && e[h].name === c) {
|
|
3158
3172
|
const b = (n = e[h].composeCode) == null ? void 0 : n.trim();
|
|
3159
|
-
b && (
|
|
3173
|
+
b && (f = at(b), t.add(h), h++);
|
|
3160
3174
|
}
|
|
3161
|
-
if (h < e.length && !t.has(h) &&
|
|
3175
|
+
if (h < e.length && !t.has(h) && it(e[h]) && e[h].name === g) {
|
|
3162
3176
|
const b = (i = e[h].composeCode) == null ? void 0 : i.trim();
|
|
3163
|
-
b && (
|
|
3177
|
+
b && (p = at(b), t.add(h));
|
|
3164
3178
|
}
|
|
3165
|
-
|
|
3166
|
-
column:
|
|
3167
|
-
},
|
|
3179
|
+
f !== void 0 || p !== void 0 ? r.push(l(l({
|
|
3180
|
+
column: o
|
|
3181
|
+
}, f && Object.keys(f).length > 0 && { trend: f }), p && Object.keys(p).length > 0 && { forecast: p })) : r.push(o);
|
|
3168
3182
|
}
|
|
3169
3183
|
return r;
|
|
3170
3184
|
}
|
|
3171
|
-
function
|
|
3185
|
+
function Ui(e) {
|
|
3172
3186
|
const t = [], r = A(
|
|
3173
|
-
() =>
|
|
3187
|
+
() => We(e.dimensions || []),
|
|
3174
3188
|
t
|
|
3175
|
-
), s =
|
|
3176
|
-
() =>
|
|
3189
|
+
), s = Kn(e.measures || []), n = A(
|
|
3190
|
+
() => Ve(s),
|
|
3177
3191
|
t
|
|
3178
3192
|
), i = A(
|
|
3179
|
-
() =>
|
|
3193
|
+
() => ie(e.filters),
|
|
3180
3194
|
t
|
|
3181
3195
|
);
|
|
3182
|
-
let
|
|
3183
|
-
if (e.highlights && e.highlights.length > 0 && (
|
|
3184
|
-
() =>
|
|
3196
|
+
let a = null;
|
|
3197
|
+
if (e.highlights && e.highlights.length > 0 && (a = A(
|
|
3198
|
+
() => be(e.highlights),
|
|
3185
3199
|
t
|
|
3186
3200
|
)), t.length > 0)
|
|
3187
3201
|
return {
|
|
3188
3202
|
success: !1,
|
|
3189
3203
|
errors: t
|
|
3190
3204
|
};
|
|
3191
|
-
const
|
|
3205
|
+
const o = l({
|
|
3192
3206
|
dimensions: r || [],
|
|
3193
3207
|
measures: n || [],
|
|
3194
3208
|
filters: i || []
|
|
3195
|
-
},
|
|
3209
|
+
}, a && { highlights: a });
|
|
3196
3210
|
return {
|
|
3197
3211
|
success: !0,
|
|
3198
3212
|
// Strip [[delimiters]] from all strings to preserve original names with spaces
|
|
3199
|
-
data:
|
|
3213
|
+
data: L(o)
|
|
3200
3214
|
};
|
|
3201
3215
|
}
|
|
3202
|
-
const
|
|
3203
|
-
|
|
3204
|
-
),
|
|
3216
|
+
const rr = new Set(
|
|
3217
|
+
os.filter((e) => e !== "image")
|
|
3218
|
+
), ot = Object.freeze([...rr]), Se = /* @__PURE__ */ new Set([
|
|
3205
3219
|
"category",
|
|
3206
3220
|
"value",
|
|
3207
3221
|
"breakBy",
|
|
@@ -3224,7 +3238,7 @@ const Ht = new Set(
|
|
|
3224
3238
|
"min",
|
|
3225
3239
|
"max",
|
|
3226
3240
|
"seriesToColorMap"
|
|
3227
|
-
]),
|
|
3241
|
+
]), Gn = {
|
|
3228
3242
|
line: {
|
|
3229
3243
|
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3230
3244
|
requiredAxes: ["category", "value"]
|
|
@@ -3297,7 +3311,7 @@ const Ht = new Set(
|
|
|
3297
3311
|
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3298
3312
|
requiredAxes: ["category", "value"]
|
|
3299
3313
|
}
|
|
3300
|
-
},
|
|
3314
|
+
}, Yn = /* @__PURE__ */ new Set([
|
|
3301
3315
|
"category",
|
|
3302
3316
|
"breakBy",
|
|
3303
3317
|
"breakByPoint",
|
|
@@ -3305,7 +3319,7 @@ const Ht = new Set(
|
|
|
3305
3319
|
"geo",
|
|
3306
3320
|
"details",
|
|
3307
3321
|
"date"
|
|
3308
|
-
]),
|
|
3322
|
+
]), Hn = /* @__PURE__ */ new Set([
|
|
3309
3323
|
"value",
|
|
3310
3324
|
"size",
|
|
3311
3325
|
"colorBy",
|
|
@@ -3317,34 +3331,34 @@ const Ht = new Set(
|
|
|
3317
3331
|
"max",
|
|
3318
3332
|
"color"
|
|
3319
3333
|
]);
|
|
3320
|
-
function
|
|
3321
|
-
const t =
|
|
3334
|
+
function Qn(e) {
|
|
3335
|
+
const t = Gn[e];
|
|
3322
3336
|
if (t)
|
|
3323
3337
|
return {
|
|
3324
3338
|
validAxes: new Set(t.validAxes),
|
|
3325
3339
|
requiredAxes: Object.freeze([...t.requiredAxes])
|
|
3326
3340
|
};
|
|
3327
3341
|
}
|
|
3328
|
-
function
|
|
3329
|
-
return typeof e == "string" &&
|
|
3342
|
+
function sr(e) {
|
|
3343
|
+
return typeof e == "string" && rr.has(e);
|
|
3330
3344
|
}
|
|
3331
|
-
function
|
|
3332
|
-
if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" ||
|
|
3345
|
+
function Xn(e, t, r) {
|
|
3346
|
+
if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" || Yn.has(e))
|
|
3333
3347
|
return !0;
|
|
3334
|
-
if (
|
|
3348
|
+
if (Hn.has(e))
|
|
3335
3349
|
return !1;
|
|
3336
3350
|
const s = Array.isArray(t) ? t[0] : t;
|
|
3337
3351
|
if (!s)
|
|
3338
3352
|
return !0;
|
|
3339
3353
|
let n;
|
|
3340
|
-
return
|
|
3354
|
+
return $(s) && "column" in s && (n = s.column), !(w(s) || n !== void 0 && w(n));
|
|
3341
3355
|
}
|
|
3342
|
-
function
|
|
3356
|
+
function Zn(e) {
|
|
3343
3357
|
const t = [], r = {
|
|
3344
3358
|
chartType: "",
|
|
3345
3359
|
dataOptions: {}
|
|
3346
3360
|
};
|
|
3347
|
-
if (
|
|
3361
|
+
if (!$(e))
|
|
3348
3362
|
return t.push({
|
|
3349
3363
|
path: "chartType",
|
|
3350
3364
|
input: e,
|
|
@@ -3352,29 +3366,29 @@ function Hn(e) {
|
|
|
3352
3366
|
}), { normalized: r, errors: t };
|
|
3353
3367
|
const s = e.chartType;
|
|
3354
3368
|
if (s === void 0) {
|
|
3355
|
-
const i = Object.keys(e),
|
|
3369
|
+
const i = Object.keys(e), a = x("chartType", i, (c) => c), o = a && a.distance <= C ? ` Did you mean 'chartType'? (You may have typed '${a.best}')` : "", u = a && a.distance <= C ? { [a.best]: e[a.best] } : e;
|
|
3356
3370
|
t.push({
|
|
3357
3371
|
path: "chartType",
|
|
3358
3372
|
input: u,
|
|
3359
|
-
message: `chartType is required.${
|
|
3373
|
+
message: `chartType is required.${o}`
|
|
3360
3374
|
});
|
|
3361
|
-
} else if (
|
|
3375
|
+
} else if (sr(s))
|
|
3362
3376
|
r.chartType = s;
|
|
3363
3377
|
else {
|
|
3364
|
-
const i = x(String(s),
|
|
3378
|
+
const i = x(String(s), ot, (u) => u), a = i && i.distance <= C ? ` Did you mean '${i.best}'?` : "", o = ot.slice(0, 8).join(", ");
|
|
3365
3379
|
t.push({
|
|
3366
3380
|
path: "chartType",
|
|
3367
3381
|
input: s,
|
|
3368
|
-
message: `Invalid chartType '${s}'. Valid types: ${
|
|
3382
|
+
message: `Invalid chartType '${s}'. Valid types: ${o}, ...${a}`
|
|
3369
3383
|
});
|
|
3370
3384
|
}
|
|
3371
3385
|
const n = e.dataOptions;
|
|
3372
3386
|
if (n === void 0) {
|
|
3373
|
-
const i = Object.keys(e),
|
|
3387
|
+
const i = Object.keys(e), a = x("dataOptions", i, (c) => c), o = a && a.distance <= C ? ` Did you mean 'dataOptions'? (You may have typed '${a.best}')` : "", u = a && a.distance <= C ? { [a.best]: e[a.best] } : e;
|
|
3374
3388
|
t.push({
|
|
3375
3389
|
path: "dataOptions",
|
|
3376
3390
|
input: u,
|
|
3377
|
-
message: `dataOptions is required.${
|
|
3391
|
+
message: `dataOptions is required.${o}`
|
|
3378
3392
|
});
|
|
3379
3393
|
} else n !== null && typeof n == "object" && (r.dataOptions = n);
|
|
3380
3394
|
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 };
|
|
@@ -3382,149 +3396,156 @@ function Hn(e) {
|
|
|
3382
3396
|
function D(e, t) {
|
|
3383
3397
|
return e === -1 ? "dataOptions" : typeof e == "number" ? `dataOptions[${e}]` : t !== void 0 ? `dataOptions.${e}[${t}]` : `dataOptions.${e}`;
|
|
3384
3398
|
}
|
|
3385
|
-
function
|
|
3399
|
+
function nr(e, t) {
|
|
3386
3400
|
return e ? t ? `${e}.${t}` : e : t != null ? t : "";
|
|
3387
3401
|
}
|
|
3388
|
-
function
|
|
3389
|
-
return (t) =>
|
|
3390
|
-
path:
|
|
3402
|
+
function ei(e) {
|
|
3403
|
+
return (t) => E(l({}, t), {
|
|
3404
|
+
path: nr(e, t.path)
|
|
3391
3405
|
});
|
|
3392
3406
|
}
|
|
3393
|
-
function
|
|
3394
|
-
return
|
|
3407
|
+
function ir(e) {
|
|
3408
|
+
return ei(`widgets[${e}]`);
|
|
3395
3409
|
}
|
|
3396
|
-
function
|
|
3410
|
+
function ar(e, t) {
|
|
3397
3411
|
return e.map(t);
|
|
3398
3412
|
}
|
|
3399
|
-
function
|
|
3413
|
+
function ti(e) {
|
|
3400
3414
|
return e.map(
|
|
3401
3415
|
({ attribute: t, style: r }) => r ? l({ column: t }, r) : t
|
|
3402
3416
|
);
|
|
3403
3417
|
}
|
|
3404
|
-
function
|
|
3418
|
+
function ri(e) {
|
|
3405
3419
|
return e.map(
|
|
3406
3420
|
({ measure: t, style: r }) => r ? l({ column: t }, r) : t
|
|
3407
3421
|
);
|
|
3408
3422
|
}
|
|
3409
|
-
function
|
|
3423
|
+
function si(e) {
|
|
3424
|
+
return Array.isArray(e) ? e : [e];
|
|
3425
|
+
}
|
|
3426
|
+
function ni(e) {
|
|
3427
|
+
return Array.isArray(e) ? e : [e];
|
|
3428
|
+
}
|
|
3429
|
+
function ii(e) {
|
|
3410
3430
|
return Array.isArray(e) ? e : [e];
|
|
3411
3431
|
}
|
|
3412
|
-
const
|
|
3413
|
-
function
|
|
3432
|
+
const ai = /^(dimensions|measures|filters|highlights)(\[\d+\])?$/;
|
|
3433
|
+
function xe(e) {
|
|
3414
3434
|
return (t) => {
|
|
3415
3435
|
const r = t.path.match(/\[(\d+)\]$/), s = r ? Number(r[1]) : void 0, n = D(e, s);
|
|
3416
|
-
if (
|
|
3417
|
-
return
|
|
3436
|
+
if (ai.test(t.path) || t.path.startsWith("dataOptions"))
|
|
3437
|
+
return E(l({}, t), { path: n });
|
|
3418
3438
|
const i = t.path.replace(/\[\d+\]$/, "");
|
|
3419
|
-
return
|
|
3420
|
-
path:
|
|
3439
|
+
return E(l({}, t), {
|
|
3440
|
+
path: nr(i, n)
|
|
3421
3441
|
});
|
|
3422
3442
|
};
|
|
3423
3443
|
}
|
|
3424
|
-
function
|
|
3425
|
-
const i = t ? tr(
|
|
3426
|
-
t
|
|
3427
|
-
) : [];
|
|
3428
|
-
if (i.length === 0)
|
|
3429
|
-
return [];
|
|
3444
|
+
function le(e, t, r, s, n) {
|
|
3430
3445
|
if (r === "dimension") {
|
|
3431
|
-
const
|
|
3432
|
-
|
|
3433
|
-
|
|
3446
|
+
const o = t ? si(t) : [];
|
|
3447
|
+
if (o.length === 0)
|
|
3448
|
+
return [];
|
|
3449
|
+
const u = A(
|
|
3450
|
+
() => Pt({
|
|
3451
|
+
data: o,
|
|
3434
3452
|
context: s
|
|
3435
3453
|
}),
|
|
3436
3454
|
n,
|
|
3437
|
-
|
|
3455
|
+
xe(e)
|
|
3438
3456
|
);
|
|
3439
|
-
return
|
|
3457
|
+
return u !== null ? ti(u) : null;
|
|
3440
3458
|
}
|
|
3441
|
-
const
|
|
3442
|
-
|
|
3459
|
+
const i = t ? ni(t) : [];
|
|
3460
|
+
if (i.length === 0)
|
|
3461
|
+
return [];
|
|
3462
|
+
const a = A(
|
|
3463
|
+
() => er({
|
|
3443
3464
|
data: i,
|
|
3444
3465
|
context: s
|
|
3445
3466
|
}),
|
|
3446
3467
|
n,
|
|
3447
|
-
|
|
3468
|
+
xe(e)
|
|
3448
3469
|
);
|
|
3449
|
-
return
|
|
3470
|
+
return a !== null ? ri(a) : null;
|
|
3450
3471
|
}
|
|
3451
|
-
const
|
|
3472
|
+
const ut = (e, t) => {
|
|
3452
3473
|
const r = t.path.match(/\[(\d+)\]$/), s = r ? Number(r[1]) : void 0;
|
|
3453
|
-
return
|
|
3474
|
+
return E(l({}, t), { path: D(e, s) });
|
|
3454
3475
|
};
|
|
3455
|
-
function
|
|
3476
|
+
function ct(e, t, r) {
|
|
3456
3477
|
const s = Array.isArray(t) ? t : t != null ? [t] : [];
|
|
3457
3478
|
if (r === "dimension") {
|
|
3458
|
-
const i =
|
|
3479
|
+
const i = We(
|
|
3459
3480
|
s
|
|
3460
3481
|
);
|
|
3461
3482
|
return i.success ? { success: !0, data: i.data } : {
|
|
3462
3483
|
success: !1,
|
|
3463
|
-
errors: i.errors.map((
|
|
3484
|
+
errors: i.errors.map((a) => ut(e, a))
|
|
3464
3485
|
};
|
|
3465
3486
|
}
|
|
3466
|
-
const n =
|
|
3487
|
+
const n = Ve(s);
|
|
3467
3488
|
return n.success ? { success: !0, data: n.data } : {
|
|
3468
3489
|
success: !1,
|
|
3469
|
-
errors: n.errors.map((i) =>
|
|
3490
|
+
errors: n.errors.map((i) => ut(e, i))
|
|
3470
3491
|
};
|
|
3471
3492
|
}
|
|
3472
|
-
function
|
|
3493
|
+
function oi(e, t) {
|
|
3473
3494
|
let r;
|
|
3474
|
-
|
|
3475
|
-
const n = !(
|
|
3476
|
-
return
|
|
3495
|
+
$(e) && "column" in e && (r = e.column);
|
|
3496
|
+
const n = !(w(e) || r !== void 0 && w(r)) ? "dimension" : "measure", i = [], a = le("columns", [e], n, t, i);
|
|
3497
|
+
return a !== null ? { success: !0, data: a } : { success: !1, errors: i };
|
|
3477
3498
|
}
|
|
3478
|
-
function
|
|
3499
|
+
function ui(e, t, r, s) {
|
|
3479
3500
|
const n = [];
|
|
3480
3501
|
for (const i of e) {
|
|
3481
|
-
const
|
|
3482
|
-
() =>
|
|
3502
|
+
const a = A(
|
|
3503
|
+
() => oi(i, t),
|
|
3483
3504
|
r,
|
|
3484
3505
|
s
|
|
3485
3506
|
);
|
|
3486
|
-
|
|
3507
|
+
a && n.push(...a);
|
|
3487
3508
|
}
|
|
3488
3509
|
return n;
|
|
3489
3510
|
}
|
|
3490
|
-
function
|
|
3491
|
-
if (!e ||
|
|
3511
|
+
function ci(e, t, r) {
|
|
3512
|
+
if (!e || !$(e))
|
|
3492
3513
|
return r.push({
|
|
3493
3514
|
path: D(-1),
|
|
3494
3515
|
input: e,
|
|
3495
3516
|
message: "dataOptions is required"
|
|
3496
3517
|
}), null;
|
|
3497
|
-
const s = {}, { chartType: n } = t, i = r.length,
|
|
3498
|
-
for (const
|
|
3499
|
-
if (!
|
|
3500
|
-
const
|
|
3501
|
-
|
|
3502
|
-
path: D(
|
|
3503
|
-
input:
|
|
3504
|
-
message: `Unknown dataOptions key '${
|
|
3518
|
+
const s = {}, { chartType: n } = t, i = r.length, a = e, o = Object.keys(e), u = /* @__PURE__ */ new Map();
|
|
3519
|
+
for (const f of o)
|
|
3520
|
+
if (!Se.has(f)) {
|
|
3521
|
+
const p = x(f, [...Se], (b) => b), h = p && p.distance <= C ? ` Did you mean '${p.best}'?` : "";
|
|
3522
|
+
p && p.distance <= C && u.set(f, p.best), r.push({
|
|
3523
|
+
path: D(f),
|
|
3524
|
+
input: a[f],
|
|
3525
|
+
message: `Unknown dataOptions key '${f}'.${h}`
|
|
3505
3526
|
});
|
|
3506
3527
|
}
|
|
3507
|
-
const c = n ?
|
|
3528
|
+
const c = n ? Qn(n) : void 0;
|
|
3508
3529
|
if (c) {
|
|
3509
|
-
for (const
|
|
3510
|
-
if (
|
|
3511
|
-
const
|
|
3530
|
+
for (const f of o)
|
|
3531
|
+
if (f !== "seriesToColorMap" && !c.validAxes.has(f) && Se.has(f)) {
|
|
3532
|
+
const p = x(f, [...c.validAxes], (m) => m), h = p && p.distance <= C ? ` Did you mean '${p.best}'?` : "", b = [...c.validAxes].join(", ");
|
|
3512
3533
|
r.push({
|
|
3513
|
-
path: D(
|
|
3514
|
-
input:
|
|
3515
|
-
message: `Axis '${
|
|
3534
|
+
path: D(f),
|
|
3535
|
+
input: a[f],
|
|
3536
|
+
message: `Axis '${f}' is not valid for chart type '${n}'. Valid axes: ${b}.${h}`
|
|
3516
3537
|
});
|
|
3517
3538
|
}
|
|
3518
|
-
for (const
|
|
3519
|
-
[...u.values()].includes(
|
|
3520
|
-
path: D(
|
|
3539
|
+
for (const f of c.requiredAxes)
|
|
3540
|
+
[...u.values()].includes(f) || (!(f in a) || a[f] == null) && r.push({
|
|
3541
|
+
path: D(f),
|
|
3521
3542
|
input: null,
|
|
3522
3543
|
message: `Chart type '${n}' requires '${c.requiredAxes.join(
|
|
3523
3544
|
"' and '"
|
|
3524
|
-
)}'. Missing: ${
|
|
3545
|
+
)}'. Missing: ${f}.`
|
|
3525
3546
|
});
|
|
3526
3547
|
n === "indicator" && (["value", "secondary", "min", "max"].some(
|
|
3527
|
-
(h) => h in
|
|
3548
|
+
(h) => h in a && a[h] != null
|
|
3528
3549
|
) || r.push({
|
|
3529
3550
|
path: D(-1),
|
|
3530
3551
|
input: e,
|
|
@@ -3538,66 +3559,66 @@ function si(e, t, r) {
|
|
|
3538
3559
|
if (r.length > i)
|
|
3539
3560
|
return null;
|
|
3540
3561
|
const g = Object.entries(e);
|
|
3541
|
-
for (const [
|
|
3542
|
-
if (!
|
|
3543
|
-
if (
|
|
3544
|
-
s[
|
|
3562
|
+
for (const [f, p] of g) {
|
|
3563
|
+
if (!p) continue;
|
|
3564
|
+
if (f === "seriesToColorMap") {
|
|
3565
|
+
s[f] = p;
|
|
3545
3566
|
continue;
|
|
3546
3567
|
}
|
|
3547
|
-
if (
|
|
3548
|
-
s[
|
|
3549
|
-
|
|
3568
|
+
if (f === "columns") {
|
|
3569
|
+
s[f] = ui(
|
|
3570
|
+
ii(p),
|
|
3550
3571
|
t,
|
|
3551
3572
|
r,
|
|
3552
|
-
|
|
3573
|
+
xe("columns")
|
|
3553
3574
|
);
|
|
3554
3575
|
continue;
|
|
3555
3576
|
}
|
|
3556
|
-
const h =
|
|
3557
|
-
|
|
3558
|
-
|
|
3577
|
+
const h = Xn(f, p, n) ? "dimension" : "measure", b = le(
|
|
3578
|
+
f,
|
|
3579
|
+
p,
|
|
3559
3580
|
h,
|
|
3560
3581
|
t,
|
|
3561
3582
|
r
|
|
3562
3583
|
);
|
|
3563
3584
|
if (b !== null) {
|
|
3564
|
-
const
|
|
3565
|
-
s[
|
|
3585
|
+
const m = n === "calendar-heatmap" && f === "value";
|
|
3586
|
+
s[f] = m || !Array.isArray(p) ? b[0] : b;
|
|
3566
3587
|
}
|
|
3567
3588
|
}
|
|
3568
3589
|
return r.length > i ? null : s;
|
|
3569
3590
|
}
|
|
3570
|
-
function
|
|
3591
|
+
function li(e) {
|
|
3571
3592
|
if (typeof e != "string") return "iqr";
|
|
3572
3593
|
const t = e.split("/")[1];
|
|
3573
3594
|
return t === "iqr" || t === "extremums" || t === "standardDeviation" ? t : "iqr";
|
|
3574
3595
|
}
|
|
3575
|
-
const
|
|
3576
|
-
var
|
|
3577
|
-
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors:
|
|
3578
|
-
if (
|
|
3579
|
-
return { success: !1, errors:
|
|
3580
|
-
const
|
|
3581
|
-
let g =
|
|
3596
|
+
const fi = (e) => {
|
|
3597
|
+
var m;
|
|
3598
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: a } = Zn(t);
|
|
3599
|
+
if (a.length > 0)
|
|
3600
|
+
return { success: !1, errors: a };
|
|
3601
|
+
const o = i.chartType, u = se(n), c = [];
|
|
3602
|
+
let g = ci(
|
|
3582
3603
|
i.dataOptions,
|
|
3583
|
-
{ dataSource: s, schemaIndex: u, chartType:
|
|
3604
|
+
{ dataSource: s, schemaIndex: u, chartType: o },
|
|
3584
3605
|
c
|
|
3585
3606
|
);
|
|
3586
|
-
if (
|
|
3587
|
-
const
|
|
3588
|
-
g =
|
|
3607
|
+
if (o === "boxplot" && g) {
|
|
3608
|
+
const F = li((m = i.styleOptions) == null ? void 0 : m.subtype), O = F === "iqr" || F === "standardDeviation";
|
|
3609
|
+
g = E(l({}, g), { boxType: F, outliersEnabled: O });
|
|
3589
3610
|
}
|
|
3590
|
-
let
|
|
3591
|
-
i.filters && i.filters.length > 0 && (
|
|
3592
|
-
() =>
|
|
3611
|
+
let f = null;
|
|
3612
|
+
i.filters && i.filters.length > 0 && (f = A(
|
|
3613
|
+
() => ne({
|
|
3593
3614
|
data: i.filters || [],
|
|
3594
3615
|
context: { dataSource: s, schemaIndex: u }
|
|
3595
3616
|
}),
|
|
3596
3617
|
c
|
|
3597
3618
|
));
|
|
3598
|
-
let
|
|
3599
|
-
if (i.highlights && i.highlights.length > 0 && (
|
|
3600
|
-
() =>
|
|
3619
|
+
let p = null;
|
|
3620
|
+
if (i.highlights && i.highlights.length > 0 && (p = A(
|
|
3621
|
+
() => he({
|
|
3601
3622
|
data: i.highlights || [],
|
|
3602
3623
|
context: { dataSource: s, schemaIndex: u }
|
|
3603
3624
|
}),
|
|
@@ -3607,7 +3628,7 @@ const ii = (e) => {
|
|
|
3607
3628
|
success: !1,
|
|
3608
3629
|
errors: c
|
|
3609
3630
|
};
|
|
3610
|
-
if (!
|
|
3631
|
+
if (!sr(i.chartType))
|
|
3611
3632
|
return {
|
|
3612
3633
|
success: !1,
|
|
3613
3634
|
errors: [
|
|
@@ -3622,15 +3643,15 @@ const ii = (e) => {
|
|
|
3622
3643
|
return {
|
|
3623
3644
|
success: !0,
|
|
3624
3645
|
data: l(l(l({
|
|
3625
|
-
dataSet:
|
|
3646
|
+
dataSet: de(s),
|
|
3626
3647
|
chartType: h,
|
|
3627
3648
|
dataOptions: g
|
|
3628
3649
|
}, i.styleOptions && {
|
|
3629
3650
|
// Pass-through NLQ JSON; shape matches ChartStyleOptions.
|
|
3630
3651
|
styleOptions: i.styleOptions
|
|
3631
|
-
}),
|
|
3652
|
+
}), f && { filters: f }), p && { highlights: p })
|
|
3632
3653
|
};
|
|
3633
|
-
},
|
|
3654
|
+
}, di = (e) => {
|
|
3634
3655
|
const t = [];
|
|
3635
3656
|
if (!e.chartType)
|
|
3636
3657
|
return {
|
|
@@ -3655,27 +3676,27 @@ const ii = (e) => {
|
|
|
3655
3676
|
]
|
|
3656
3677
|
};
|
|
3657
3678
|
let r = null;
|
|
3658
|
-
const s =
|
|
3679
|
+
const s = mi(e.dataOptions);
|
|
3659
3680
|
s.success ? r = s.data : t.push(...s.errors);
|
|
3660
3681
|
let n;
|
|
3661
3682
|
if (e.filters) {
|
|
3662
|
-
const
|
|
3663
|
-
() =>
|
|
3683
|
+
const o = A(
|
|
3684
|
+
() => ie(e.filters),
|
|
3664
3685
|
t
|
|
3665
3686
|
);
|
|
3666
|
-
n =
|
|
3687
|
+
n = o != null ? o : void 0;
|
|
3667
3688
|
}
|
|
3668
3689
|
let i;
|
|
3669
3690
|
if (e.highlights && e.highlights.length > 0) {
|
|
3670
|
-
const
|
|
3671
|
-
() =>
|
|
3691
|
+
const o = A(
|
|
3692
|
+
() => be(e.highlights),
|
|
3672
3693
|
t
|
|
3673
3694
|
);
|
|
3674
|
-
i =
|
|
3695
|
+
i = o != null ? o : void 0;
|
|
3675
3696
|
}
|
|
3676
3697
|
if (t.length > 0 || r === null)
|
|
3677
3698
|
return { success: !1, errors: t };
|
|
3678
|
-
const
|
|
3699
|
+
const a = l(l(l({
|
|
3679
3700
|
chartType: e.chartType,
|
|
3680
3701
|
dataOptions: r
|
|
3681
3702
|
}, e.styleOptions && {
|
|
@@ -3683,10 +3704,10 @@ const ii = (e) => {
|
|
|
3683
3704
|
}), n && n.length > 0 && { filters: n }), i && i.length > 0 && { highlights: i });
|
|
3684
3705
|
return {
|
|
3685
3706
|
success: !0,
|
|
3686
|
-
data:
|
|
3707
|
+
data: L(a)
|
|
3687
3708
|
};
|
|
3688
3709
|
};
|
|
3689
|
-
function
|
|
3710
|
+
function mi(e) {
|
|
3690
3711
|
const t = {}, r = [], s = /* @__PURE__ */ new Set(["seriesToColorMap", "boxType", "outliersEnabled", "valueTitle"]);
|
|
3691
3712
|
for (const [n, i] of Object.entries(e)) {
|
|
3692
3713
|
if (n === "seriesToColorMap" && i) {
|
|
@@ -3697,16 +3718,16 @@ function ai(e) {
|
|
|
3697
3718
|
i != null && (t[n] = i);
|
|
3698
3719
|
continue;
|
|
3699
3720
|
}
|
|
3700
|
-
const
|
|
3701
|
-
for (let g = 0; g <
|
|
3702
|
-
const
|
|
3703
|
-
|
|
3704
|
-
]) :
|
|
3721
|
+
const a = Array.isArray(i) ? i : [i], o = Array.isArray(i), u = [], c = [];
|
|
3722
|
+
for (let g = 0; g < a.length; g++) {
|
|
3723
|
+
const f = a[g], h = pi(f) ? We([
|
|
3724
|
+
f
|
|
3725
|
+
]) : Ve([f]);
|
|
3705
3726
|
h.success ? u.push(...h.data) : h.errors.forEach((b) => {
|
|
3706
|
-
var
|
|
3707
|
-
c.push(
|
|
3727
|
+
var m;
|
|
3728
|
+
c.push(E(l({}, b), {
|
|
3708
3729
|
path: D(n, g),
|
|
3709
|
-
input: (
|
|
3730
|
+
input: (m = b.input) != null ? m : f
|
|
3710
3731
|
}));
|
|
3711
3732
|
});
|
|
3712
3733
|
}
|
|
@@ -3714,15 +3735,15 @@ function ai(e) {
|
|
|
3714
3735
|
r.push(...c);
|
|
3715
3736
|
continue;
|
|
3716
3737
|
}
|
|
3717
|
-
t[n] =
|
|
3738
|
+
t[n] = o ? u : u[0];
|
|
3718
3739
|
}
|
|
3719
3740
|
return r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3720
3741
|
}
|
|
3721
|
-
function
|
|
3742
|
+
function pi(e) {
|
|
3722
3743
|
const t = Array.isArray(e) ? e[0] : e;
|
|
3723
|
-
if (!t ||
|
|
3744
|
+
if (!t || !$(t))
|
|
3724
3745
|
return !0;
|
|
3725
|
-
const r = "column" in t && t.column != null &&
|
|
3746
|
+
const r = "column" in t && t.column != null && $(t.column) ? t.column : t;
|
|
3726
3747
|
if ("composeCode" in r) {
|
|
3727
3748
|
const s = r.composeCode;
|
|
3728
3749
|
if (typeof s == "string" && s.startsWith("DM."))
|
|
@@ -3737,17 +3758,17 @@ function ui(e) {
|
|
|
3737
3758
|
}
|
|
3738
3759
|
return !("aggregation" in r || "attribute" in r && "aggregation" in r);
|
|
3739
3760
|
}
|
|
3740
|
-
const
|
|
3741
|
-
function
|
|
3742
|
-
if (
|
|
3761
|
+
const lt = ["rows", "columns", "values", "grandTotals"];
|
|
3762
|
+
function gi(e) {
|
|
3763
|
+
if (!$(e)) return !1;
|
|
3743
3764
|
const t = Object.keys(e);
|
|
3744
3765
|
return t.every((r) => r === "rows" || r === "columns") && t.every((r) => typeof e[r] == "boolean");
|
|
3745
3766
|
}
|
|
3746
|
-
function
|
|
3767
|
+
function yi(e) {
|
|
3747
3768
|
const t = [], r = {
|
|
3748
3769
|
dataOptions: {}
|
|
3749
3770
|
};
|
|
3750
|
-
if (
|
|
3771
|
+
if (!$(e))
|
|
3751
3772
|
return t.push({
|
|
3752
3773
|
path: "dataOptions",
|
|
3753
3774
|
input: e,
|
|
@@ -3755,34 +3776,34 @@ function li(e) {
|
|
|
3755
3776
|
}), { normalized: r, errors: t };
|
|
3756
3777
|
const s = e.dataOptions;
|
|
3757
3778
|
if (s === void 0) {
|
|
3758
|
-
const n = Object.keys(e), i = x("dataOptions", n, (u) => u),
|
|
3779
|
+
const n = Object.keys(e), i = x("dataOptions", n, (u) => u), a = i && i.distance <= C ? ` Did you mean 'dataOptions'? (You may have typed '${i.best}')` : "", o = i && i.distance <= C ? { [i.best]: e[i.best] } : e;
|
|
3759
3780
|
t.push({
|
|
3760
3781
|
path: "dataOptions",
|
|
3761
|
-
input:
|
|
3762
|
-
message: `dataOptions is required.${
|
|
3782
|
+
input: o,
|
|
3783
|
+
message: `dataOptions is required.${a}`
|
|
3763
3784
|
});
|
|
3764
|
-
} else if (
|
|
3785
|
+
} else if ($(s)) {
|
|
3765
3786
|
const n = s;
|
|
3766
3787
|
r.dataOptions = n;
|
|
3767
|
-
for (const
|
|
3768
|
-
if (!
|
|
3769
|
-
const
|
|
3788
|
+
for (const a of Object.keys(n))
|
|
3789
|
+
if (!lt.includes(a)) {
|
|
3790
|
+
const o = x(a, [...lt], (c) => c), u = o && o.distance <= C ? ` Did you mean '${o.best}'?` : "";
|
|
3770
3791
|
t.push({
|
|
3771
|
-
path: D(
|
|
3772
|
-
input: n[
|
|
3773
|
-
message: `Unknown dataOptions key '${
|
|
3792
|
+
path: D(a),
|
|
3793
|
+
input: n[a],
|
|
3794
|
+
message: `Unknown dataOptions key '${a}'. Valid keys: rows, columns, values, grandTotals.${u}`
|
|
3774
3795
|
});
|
|
3775
3796
|
}
|
|
3776
|
-
for (const
|
|
3777
|
-
const
|
|
3778
|
-
|
|
3779
|
-
path: D(
|
|
3780
|
-
input:
|
|
3781
|
-
message: `dataOptions.${
|
|
3797
|
+
for (const a of ["rows", "columns", "values"]) {
|
|
3798
|
+
const o = n[a];
|
|
3799
|
+
o != null && !Array.isArray(o) && t.push({
|
|
3800
|
+
path: D(a),
|
|
3801
|
+
input: o,
|
|
3802
|
+
message: `dataOptions.${a} must be an array`
|
|
3782
3803
|
});
|
|
3783
3804
|
}
|
|
3784
3805
|
const i = n.grandTotals;
|
|
3785
|
-
i != null && !
|
|
3806
|
+
i != null && !gi(i) && t.push({
|
|
3786
3807
|
path: D("grandTotals"),
|
|
3787
3808
|
input: i,
|
|
3788
3809
|
message: "grandTotals must be an object with optional rows?: boolean, columns?: boolean"
|
|
@@ -3790,7 +3811,7 @@ function li(e) {
|
|
|
3790
3811
|
}
|
|
3791
3812
|
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 };
|
|
3792
3813
|
}
|
|
3793
|
-
function
|
|
3814
|
+
function hi(e, t, r) {
|
|
3794
3815
|
if (!e || typeof e != "object")
|
|
3795
3816
|
return r.push({
|
|
3796
3817
|
path: D(-1),
|
|
@@ -3798,17 +3819,17 @@ function di(e, t, r) {
|
|
|
3798
3819
|
message: "dataOptions is required"
|
|
3799
3820
|
}), null;
|
|
3800
3821
|
const s = {}, n = r.length;
|
|
3801
|
-
for (const
|
|
3802
|
-
const
|
|
3803
|
-
|
|
3804
|
-
e[
|
|
3822
|
+
for (const a of ["rows", "columns"]) {
|
|
3823
|
+
const o = le(
|
|
3824
|
+
a,
|
|
3825
|
+
e[a],
|
|
3805
3826
|
"dimension",
|
|
3806
3827
|
t,
|
|
3807
3828
|
r
|
|
3808
3829
|
);
|
|
3809
|
-
|
|
3830
|
+
o && (s[a] = o);
|
|
3810
3831
|
}
|
|
3811
|
-
const i =
|
|
3832
|
+
const i = le(
|
|
3812
3833
|
"values",
|
|
3813
3834
|
e.values,
|
|
3814
3835
|
"measure",
|
|
@@ -3817,28 +3838,28 @@ function di(e, t, r) {
|
|
|
3817
3838
|
);
|
|
3818
3839
|
return i && (s.values = i), e.grandTotals !== void 0 && (s.grandTotals = e.grandTotals), r.length > n ? null : s;
|
|
3819
3840
|
}
|
|
3820
|
-
const
|
|
3821
|
-
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors:
|
|
3822
|
-
if (
|
|
3823
|
-
return { success: !1, errors:
|
|
3824
|
-
const
|
|
3841
|
+
const bi = (e) => {
|
|
3842
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: a } = yi(t);
|
|
3843
|
+
if (a.length > 0)
|
|
3844
|
+
return { success: !1, errors: a };
|
|
3845
|
+
const o = se(n), u = [], c = hi(
|
|
3825
3846
|
i.dataOptions,
|
|
3826
|
-
{ dataSource: s, schemaIndex:
|
|
3847
|
+
{ dataSource: s, schemaIndex: o },
|
|
3827
3848
|
u
|
|
3828
3849
|
);
|
|
3829
3850
|
let g = null;
|
|
3830
3851
|
i.filters && i.filters.length > 0 && (g = A(
|
|
3831
|
-
() =>
|
|
3852
|
+
() => ne({
|
|
3832
3853
|
data: i.filters || [],
|
|
3833
|
-
context: { dataSource: s, schemaIndex:
|
|
3854
|
+
context: { dataSource: s, schemaIndex: o }
|
|
3834
3855
|
}),
|
|
3835
3856
|
u
|
|
3836
3857
|
));
|
|
3837
|
-
let
|
|
3838
|
-
return i.highlights && i.highlights.length > 0 && (
|
|
3839
|
-
() =>
|
|
3858
|
+
let f = null;
|
|
3859
|
+
return i.highlights && i.highlights.length > 0 && (f = A(
|
|
3860
|
+
() => he({
|
|
3840
3861
|
data: i.highlights || [],
|
|
3841
|
-
context: { dataSource: s, schemaIndex:
|
|
3862
|
+
context: { dataSource: s, schemaIndex: o }
|
|
3842
3863
|
}),
|
|
3843
3864
|
u
|
|
3844
3865
|
)), u.length > 0 || c === null ? {
|
|
@@ -3847,11 +3868,11 @@ const fi = (e) => {
|
|
|
3847
3868
|
} : {
|
|
3848
3869
|
success: !0,
|
|
3849
3870
|
data: l(l(l({
|
|
3850
|
-
dataSet:
|
|
3871
|
+
dataSet: de(s),
|
|
3851
3872
|
dataOptions: c
|
|
3852
|
-
}, i.styleOptions && { styleOptions: i.styleOptions }), g && { filters: g }),
|
|
3873
|
+
}, i.styleOptions && { styleOptions: i.styleOptions }), g && { filters: g }), f && { highlights: f })
|
|
3853
3874
|
};
|
|
3854
|
-
},
|
|
3875
|
+
}, Fi = (e) => {
|
|
3855
3876
|
const t = [];
|
|
3856
3877
|
if (!e.dataOptions)
|
|
3857
3878
|
return {
|
|
@@ -3868,54 +3889,54 @@ const fi = (e) => {
|
|
|
3868
3889
|
for (const u of ["rows", "columns"]) {
|
|
3869
3890
|
const c = r[u];
|
|
3870
3891
|
if (c && c.length > 0) {
|
|
3871
|
-
const g =
|
|
3892
|
+
const g = ct(u, c, "dimension");
|
|
3872
3893
|
g.success ? s[u] = g.data : t.push(...g.errors);
|
|
3873
3894
|
}
|
|
3874
3895
|
}
|
|
3875
3896
|
const n = r.values;
|
|
3876
3897
|
if (n && n.length > 0) {
|
|
3877
|
-
const u =
|
|
3898
|
+
const u = ct("values", n, "measure");
|
|
3878
3899
|
u.success ? s.values = u.data : t.push(...u.errors);
|
|
3879
3900
|
}
|
|
3880
3901
|
r.grandTotals !== void 0 && (s.grandTotals = r.grandTotals);
|
|
3881
3902
|
let i;
|
|
3882
3903
|
if (e.filters) {
|
|
3883
3904
|
const u = A(
|
|
3884
|
-
() =>
|
|
3905
|
+
() => ie(e.filters),
|
|
3885
3906
|
t
|
|
3886
3907
|
);
|
|
3887
3908
|
i = u != null ? u : void 0;
|
|
3888
3909
|
}
|
|
3889
|
-
let
|
|
3910
|
+
let a;
|
|
3890
3911
|
if (e.highlights && e.highlights.length > 0) {
|
|
3891
3912
|
const u = A(
|
|
3892
|
-
() =>
|
|
3913
|
+
() => be(e.highlights),
|
|
3893
3914
|
t
|
|
3894
3915
|
);
|
|
3895
|
-
|
|
3916
|
+
a = u != null ? u : void 0;
|
|
3896
3917
|
}
|
|
3897
3918
|
if (t.length > 0)
|
|
3898
3919
|
return { success: !1, errors: t };
|
|
3899
|
-
const
|
|
3920
|
+
const o = l(l(l({
|
|
3900
3921
|
dataOptions: s
|
|
3901
|
-
}, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }),
|
|
3922
|
+
}, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }), a && a.length > 0 && { highlights: a });
|
|
3902
3923
|
return {
|
|
3903
3924
|
success: !0,
|
|
3904
|
-
data:
|
|
3925
|
+
data: L(o)
|
|
3905
3926
|
};
|
|
3906
|
-
},
|
|
3907
|
-
const s =
|
|
3908
|
-
() =>
|
|
3927
|
+
}, Ei = (e, t, r) => {
|
|
3928
|
+
const s = se(r.tables), n = { dataSource: r.dataSource, schemaIndex: s }, i = [], a = e && e.length > 0 ? A(
|
|
3929
|
+
() => ne({ data: e, context: n }),
|
|
3909
3930
|
i
|
|
3910
|
-
) : void 0,
|
|
3911
|
-
() =>
|
|
3931
|
+
) : void 0, o = t && t.length > 0 ? A(
|
|
3932
|
+
() => he({ data: t, context: n }),
|
|
3912
3933
|
i
|
|
3913
3934
|
) : void 0;
|
|
3914
3935
|
return i.length > 0 ? { success: !1, errors: i } : {
|
|
3915
3936
|
success: !0,
|
|
3916
|
-
data: l(l({},
|
|
3937
|
+
data: l(l({}, a != null && { filters: a }), o != null && { highlights: o })
|
|
3917
3938
|
};
|
|
3918
|
-
},
|
|
3939
|
+
}, Ai = [
|
|
3919
3940
|
"widgetType",
|
|
3920
3941
|
"id",
|
|
3921
3942
|
"title",
|
|
@@ -3923,36 +3944,36 @@ const fi = (e) => {
|
|
|
3923
3944
|
"dataSource",
|
|
3924
3945
|
"config",
|
|
3925
3946
|
"highlightSelectionDisabled"
|
|
3926
|
-
],
|
|
3927
|
-
const { id: n, title: i, description:
|
|
3928
|
-
return
|
|
3947
|
+
], ft = (e, t, r, s) => {
|
|
3948
|
+
const { id: n, title: i, description: a, dataSource: o, config: u, highlightSelectionDisabled: c } = e, g = _(e, Ai), f = r({ data: g, context: t });
|
|
3949
|
+
return f.success ? {
|
|
3929
3950
|
success: !0,
|
|
3930
|
-
data: s(
|
|
3951
|
+
data: s(f.data, {
|
|
3931
3952
|
id: n,
|
|
3932
3953
|
title: i,
|
|
3933
|
-
description:
|
|
3934
|
-
dataSource:
|
|
3954
|
+
description: a,
|
|
3955
|
+
dataSource: o,
|
|
3935
3956
|
config: u,
|
|
3936
3957
|
highlightSelectionDisabled: c
|
|
3937
3958
|
})
|
|
3938
|
-
} :
|
|
3939
|
-
},
|
|
3940
|
-
const n = e, { dataSet: r } = n, s =
|
|
3941
|
-
return l(l(l(l(l(
|
|
3959
|
+
} : f;
|
|
3960
|
+
}, Ti = (e, t) => {
|
|
3961
|
+
const n = e, { dataSet: r } = n, s = Fe(n, ["dataSet"]);
|
|
3962
|
+
return l(l(l(l(l(E(l({}, s), {
|
|
3942
3963
|
widgetType: "chart",
|
|
3943
3964
|
id: t.id
|
|
3944
|
-
}), t.dataSource !== void 0 ? { dataSource: t.dataSource } : r !== void 0 &&
|
|
3965
|
+
}), t.dataSource !== void 0 ? { dataSource: t.dataSource } : r !== void 0 && Ft(r) && { dataSource: r }), t.config !== void 0 && { config: t.config }), t.highlightSelectionDisabled !== void 0 && {
|
|
3945
3966
|
highlightSelectionDisabled: t.highlightSelectionDisabled
|
|
3946
3967
|
}), t.title !== void 0 && { title: t.title }), t.description !== void 0 && { description: t.description });
|
|
3947
|
-
},
|
|
3948
|
-
const n = e, { dataSet: r } = n, s =
|
|
3949
|
-
return l(l(l(l(
|
|
3968
|
+
}, wi = (e, t) => {
|
|
3969
|
+
const n = e, { dataSet: r } = n, s = Fe(n, ["dataSet"]);
|
|
3970
|
+
return l(l(l(l(E(l({}, s), {
|
|
3950
3971
|
widgetType: "pivot",
|
|
3951
3972
|
id: t.id
|
|
3952
|
-
}), t.dataSource !== void 0 ? { dataSource: t.dataSource } : r !== void 0 &&
|
|
3953
|
-
},
|
|
3954
|
-
function
|
|
3955
|
-
if (
|
|
3973
|
+
}), t.dataSource !== void 0 ? { dataSource: t.dataSource } : r !== void 0 && Ft(r) && { dataSource: r }), t.config !== void 0 && { config: t.config }), t.title !== void 0 && { title: t.title }), t.description !== void 0 && { description: t.description });
|
|
3974
|
+
}, Ne = ["chart", "pivot", "text", "custom"], Si = (e) => typeof e == "string" && Ne.includes(e);
|
|
3975
|
+
function Ci(e) {
|
|
3976
|
+
if (!$(e))
|
|
3956
3977
|
return {
|
|
3957
3978
|
path: "widgetType",
|
|
3958
3979
|
input: e,
|
|
@@ -3960,15 +3981,15 @@ function Ei(e) {
|
|
|
3960
3981
|
};
|
|
3961
3982
|
const t = e.widgetType;
|
|
3962
3983
|
if (t === void 0) {
|
|
3963
|
-
const r = Object.keys(e), s = x("widgetType", r, (
|
|
3984
|
+
const r = Object.keys(e), s = x("widgetType", r, (a) => a), n = s && s.distance <= C ? ` Did you mean 'widgetType'? (You may have typed '${s.best}')` : "";
|
|
3964
3985
|
return {
|
|
3965
3986
|
path: "widgetType",
|
|
3966
|
-
input: s && s.distance <=
|
|
3987
|
+
input: s && s.distance <= C ? { [s.best]: e[s.best] } : e,
|
|
3967
3988
|
message: `widgetType is required.${n}`
|
|
3968
3989
|
};
|
|
3969
3990
|
}
|
|
3970
|
-
if (!
|
|
3971
|
-
const r = x(String(t),
|
|
3991
|
+
if (!Si(t)) {
|
|
3992
|
+
const r = x(String(t), Ne, (i) => i), s = r && r.distance <= C ? ` Did you mean '${r.best}'?` : "", n = Ne.join(", ");
|
|
3972
3993
|
return {
|
|
3973
3994
|
path: "widgetType",
|
|
3974
3995
|
input: t,
|
|
@@ -3979,30 +4000,30 @@ function Ei(e) {
|
|
|
3979
4000
|
}
|
|
3980
4001
|
return null;
|
|
3981
4002
|
}
|
|
3982
|
-
const
|
|
4003
|
+
const Oi = (e) => ({
|
|
3983
4004
|
path: "id",
|
|
3984
4005
|
input: e,
|
|
3985
4006
|
message: "Widget id is required"
|
|
3986
|
-
}),
|
|
3987
|
-
const { data: t, context: r } = e, s =
|
|
4007
|
+
}), qi = (e) => !!e.id, $i = (e) => {
|
|
4008
|
+
const { data: t, context: r } = e, s = Ci(t);
|
|
3988
4009
|
if (s)
|
|
3989
4010
|
return { success: !1, errors: [s] };
|
|
3990
|
-
if (!
|
|
3991
|
-
return { success: !1, errors: [
|
|
4011
|
+
if (!qi(t))
|
|
4012
|
+
return { success: !1, errors: [Oi(t)] };
|
|
3992
4013
|
switch (t.widgetType) {
|
|
3993
4014
|
case "chart":
|
|
3994
|
-
return
|
|
4015
|
+
return ft(
|
|
3995
4016
|
t,
|
|
3996
4017
|
r,
|
|
3997
|
-
|
|
3998
|
-
|
|
4018
|
+
fi,
|
|
4019
|
+
Ti
|
|
3999
4020
|
);
|
|
4000
4021
|
case "pivot":
|
|
4001
|
-
return
|
|
4022
|
+
return ft(
|
|
4002
4023
|
t,
|
|
4003
4024
|
r,
|
|
4004
|
-
|
|
4005
|
-
|
|
4025
|
+
bi,
|
|
4026
|
+
wi
|
|
4006
4027
|
);
|
|
4007
4028
|
case "text":
|
|
4008
4029
|
return { success: !0, data: l({
|
|
@@ -4014,23 +4035,23 @@ const Fi = (e) => ({
|
|
|
4014
4035
|
const {
|
|
4015
4036
|
id: n,
|
|
4016
4037
|
customWidgetType: i,
|
|
4017
|
-
title:
|
|
4018
|
-
description:
|
|
4038
|
+
title: a,
|
|
4039
|
+
description: o,
|
|
4019
4040
|
dataSource: u,
|
|
4020
4041
|
config: c,
|
|
4021
4042
|
filters: g,
|
|
4022
|
-
highlights:
|
|
4023
|
-
dataOptions:
|
|
4043
|
+
highlights: f,
|
|
4044
|
+
dataOptions: p,
|
|
4024
4045
|
styleOptions: h,
|
|
4025
4046
|
customOptions: b
|
|
4026
|
-
} = t,
|
|
4027
|
-
return
|
|
4047
|
+
} = t, m = Ei(g, f, r);
|
|
4048
|
+
return m.success ? { success: !0, data: l(l(l(l(l(l({
|
|
4028
4049
|
widgetType: "custom",
|
|
4029
4050
|
id: n,
|
|
4030
4051
|
customWidgetType: i,
|
|
4031
|
-
dataSource: u !== void 0 ? u :
|
|
4032
|
-
dataOptions:
|
|
4033
|
-
},
|
|
4052
|
+
dataSource: u !== void 0 ? u : de(r.dataSource),
|
|
4053
|
+
dataOptions: p != null ? p : {}
|
|
4054
|
+
}, a !== void 0 && { title: a }), o !== void 0 && { description: o }), c !== void 0 && { config: c }), h !== void 0 && { styleOptions: h }), b !== void 0 && { customOptions: b }), m.data) } : m;
|
|
4034
4055
|
}
|
|
4035
4056
|
default:
|
|
4036
4057
|
return {
|
|
@@ -4046,37 +4067,37 @@ const Fi = (e) => ({
|
|
|
4046
4067
|
]
|
|
4047
4068
|
};
|
|
4048
4069
|
}
|
|
4049
|
-
},
|
|
4070
|
+
}, Di = (e) => {
|
|
4050
4071
|
const { widgetType: t } = e;
|
|
4051
4072
|
switch (t) {
|
|
4052
4073
|
case "chart": {
|
|
4053
|
-
const r =
|
|
4074
|
+
const r = di(e);
|
|
4054
4075
|
if (!r.success) return r;
|
|
4055
|
-
const s = l(l(l(l(l(
|
|
4076
|
+
const s = l(l(l(l(l(E(l({}, r.data), {
|
|
4056
4077
|
widgetType: "chart",
|
|
4057
4078
|
id: e.id
|
|
4058
4079
|
}), e.title !== void 0 && { title: e.title }), e.description !== void 0 && { description: e.description }), e.dataSource !== void 0 && {
|
|
4059
|
-
dataSource:
|
|
4080
|
+
dataSource: ue(e.dataSource)
|
|
4060
4081
|
}), e.config !== void 0 && { config: e.config }), e.highlightSelectionDisabled !== void 0 && {
|
|
4061
4082
|
highlightSelectionDisabled: e.highlightSelectionDisabled
|
|
4062
4083
|
});
|
|
4063
4084
|
return {
|
|
4064
4085
|
success: !0,
|
|
4065
|
-
data:
|
|
4086
|
+
data: L(s)
|
|
4066
4087
|
};
|
|
4067
4088
|
}
|
|
4068
4089
|
case "pivot": {
|
|
4069
|
-
const r =
|
|
4090
|
+
const r = Fi(e);
|
|
4070
4091
|
if (!r.success) return r;
|
|
4071
|
-
const s = l(l(l(l(
|
|
4092
|
+
const s = l(l(l(l(E(l({}, r.data), {
|
|
4072
4093
|
widgetType: "pivot",
|
|
4073
4094
|
id: e.id
|
|
4074
4095
|
}), e.title !== void 0 && { title: e.title }), e.description !== void 0 && { description: e.description }), e.dataSource !== void 0 && {
|
|
4075
|
-
dataSource:
|
|
4096
|
+
dataSource: ue(e.dataSource)
|
|
4076
4097
|
}), e.config !== void 0 && { config: e.config });
|
|
4077
4098
|
return {
|
|
4078
4099
|
success: !0,
|
|
4079
|
-
data:
|
|
4100
|
+
data: L(s)
|
|
4080
4101
|
};
|
|
4081
4102
|
}
|
|
4082
4103
|
case "text":
|
|
@@ -4087,10 +4108,10 @@ const Fi = (e) => ({
|
|
|
4087
4108
|
}, e.config !== void 0 && { config: e.config }) };
|
|
4088
4109
|
case "custom": {
|
|
4089
4110
|
const r = [], s = e.filters !== void 0 ? A(
|
|
4090
|
-
() =>
|
|
4111
|
+
() => ie(e.filters),
|
|
4091
4112
|
r
|
|
4092
4113
|
) : void 0, n = e.highlights !== void 0 ? A(
|
|
4093
|
-
() =>
|
|
4114
|
+
() => be(e.highlights),
|
|
4094
4115
|
r
|
|
4095
4116
|
) : void 0;
|
|
4096
4117
|
return r.length > 0 ? { success: !1, errors: r } : { success: !0, data: l(l(l(l(l(l(l(l(l({
|
|
@@ -4098,7 +4119,7 @@ const Fi = (e) => ({
|
|
|
4098
4119
|
customWidgetType: e.customWidgetType,
|
|
4099
4120
|
id: e.id
|
|
4100
4121
|
}, e.title !== void 0 && { title: e.title }), e.description !== void 0 && { description: e.description }), e.dataSource !== void 0 && {
|
|
4101
|
-
dataSource:
|
|
4122
|
+
dataSource: ue(e.dataSource)
|
|
4102
4123
|
}), e.config !== void 0 && { config: e.config }), e.dataOptions !== void 0 && {
|
|
4103
4124
|
dataOptions: e.dataOptions
|
|
4104
4125
|
}), e.styleOptions !== void 0 && { styleOptions: e.styleOptions }), e.customOptions !== void 0 && {
|
|
@@ -4121,13 +4142,13 @@ const Fi = (e) => ({
|
|
|
4121
4142
|
]
|
|
4122
4143
|
};
|
|
4123
4144
|
}
|
|
4124
|
-
},
|
|
4145
|
+
}, _i = (e) => {
|
|
4125
4146
|
const { data: t, context: r } = e, s = [], n = [];
|
|
4126
|
-
Array.isArray(t.widgets) ? t.widgets.forEach((
|
|
4127
|
-
const c =
|
|
4147
|
+
Array.isArray(t.widgets) ? t.widgets.forEach((o, u) => {
|
|
4148
|
+
const c = $i({ data: o, context: r });
|
|
4128
4149
|
if (!c.success) {
|
|
4129
4150
|
s.push(
|
|
4130
|
-
...
|
|
4151
|
+
...ar(c.errors, ir(u))
|
|
4131
4152
|
);
|
|
4132
4153
|
return;
|
|
4133
4154
|
}
|
|
@@ -4139,11 +4160,11 @@ const Fi = (e) => ({
|
|
|
4139
4160
|
});
|
|
4140
4161
|
let i = null;
|
|
4141
4162
|
if (t.filters && t.filters.length > 0) {
|
|
4142
|
-
const
|
|
4163
|
+
const o = se(r.tables);
|
|
4143
4164
|
i = A(
|
|
4144
|
-
() =>
|
|
4165
|
+
() => ne({
|
|
4145
4166
|
data: t.filters,
|
|
4146
|
-
context: { dataSource: r.dataSource, schemaIndex:
|
|
4167
|
+
context: { dataSource: r.dataSource, schemaIndex: o }
|
|
4147
4168
|
}),
|
|
4148
4169
|
s
|
|
4149
4170
|
);
|
|
@@ -4157,13 +4178,13 @@ const Fi = (e) => ({
|
|
|
4157
4178
|
}), t.styleOptions !== void 0 && { styleOptions: t.styleOptions }), t.widgetsOptions !== void 0 && {
|
|
4158
4179
|
widgetsOptions: t.widgetsOptions
|
|
4159
4180
|
}) };
|
|
4160
|
-
},
|
|
4181
|
+
}, Pi = (e) => {
|
|
4161
4182
|
const t = [], r = [];
|
|
4162
|
-
e.widgets.forEach((
|
|
4163
|
-
const u =
|
|
4183
|
+
e.widgets.forEach((a, o) => {
|
|
4184
|
+
const u = Di(a);
|
|
4164
4185
|
if (!u.success) {
|
|
4165
4186
|
t.push(
|
|
4166
|
-
...
|
|
4187
|
+
...ar(u.errors, ir(o))
|
|
4167
4188
|
);
|
|
4168
4189
|
return;
|
|
4169
4190
|
}
|
|
@@ -4171,28 +4192,28 @@ const Fi = (e) => ({
|
|
|
4171
4192
|
});
|
|
4172
4193
|
let s;
|
|
4173
4194
|
if (e.filters) {
|
|
4174
|
-
const
|
|
4175
|
-
() =>
|
|
4195
|
+
const a = A(
|
|
4196
|
+
() => ie(e.filters),
|
|
4176
4197
|
t
|
|
4177
4198
|
);
|
|
4178
|
-
s =
|
|
4199
|
+
s = a != null ? a : void 0;
|
|
4179
4200
|
}
|
|
4180
4201
|
if (t.length > 0)
|
|
4181
4202
|
return { success: !1, errors: t };
|
|
4182
|
-
const n = e.widgetsOptions !== void 0 ?
|
|
4203
|
+
const n = e.widgetsOptions !== void 0 ? Jn(e.widgetsOptions) : void 0, i = l(l(l(l(l(l(l(l({
|
|
4183
4204
|
widgets: r
|
|
4184
4205
|
}, e.id !== void 0 && { id: e.id }), e.title !== void 0 && { title: e.title }), s && s.length > 0 && { filters: s }), e.layoutOptions !== void 0 && {
|
|
4185
4206
|
layoutOptions: e.layoutOptions
|
|
4186
4207
|
}), e.config !== void 0 && { config: e.config }), e.defaultDataSource !== void 0 && {
|
|
4187
|
-
defaultDataSource:
|
|
4208
|
+
defaultDataSource: ue(e.defaultDataSource)
|
|
4188
4209
|
}), e.styleOptions !== void 0 && { styleOptions: e.styleOptions }), n !== void 0 && { widgetsOptions: n });
|
|
4189
4210
|
return {
|
|
4190
4211
|
success: !0,
|
|
4191
|
-
data:
|
|
4212
|
+
data: L(i)
|
|
4192
4213
|
};
|
|
4193
4214
|
};
|
|
4194
|
-
function
|
|
4195
|
-
const { filters: t, relations: r } =
|
|
4215
|
+
function xi(e) {
|
|
4216
|
+
const { filters: t, relations: r } = ls(
|
|
4196
4217
|
e.filters || []
|
|
4197
4218
|
);
|
|
4198
4219
|
return {
|
|
@@ -4205,27 +4226,59 @@ function Si(e) {
|
|
|
4205
4226
|
// No count/offset/ungroup - these are execution concerns, not translation concerns
|
|
4206
4227
|
};
|
|
4207
4228
|
}
|
|
4208
|
-
function
|
|
4209
|
-
const s =
|
|
4210
|
-
return
|
|
4229
|
+
function Wi(e, t, r = !1) {
|
|
4230
|
+
const s = xi(e), n = us(s, t);
|
|
4231
|
+
return cs(n, r);
|
|
4232
|
+
}
|
|
4233
|
+
function fe(e) {
|
|
4234
|
+
const t = e.trim();
|
|
4235
|
+
return t.startsWith(T) ? t.slice(T.length) : t;
|
|
4236
|
+
}
|
|
4237
|
+
function H(e) {
|
|
4238
|
+
var s;
|
|
4239
|
+
const t = ye(e.function);
|
|
4240
|
+
if (t) {
|
|
4241
|
+
const n = t.findIndex((i) => i.isName);
|
|
4242
|
+
if (n >= 0) {
|
|
4243
|
+
const i = e.args[n];
|
|
4244
|
+
if (typeof i == "string" && i.length > 0) return i;
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
const r = e.args[0];
|
|
4248
|
+
return typeof r == "string" ? fe(r) : w(r) ? H(r) : (s = e.function.split(".").pop()) != null ? s : e.function;
|
|
4249
|
+
}
|
|
4250
|
+
const dt = "filterFactory.logic.";
|
|
4251
|
+
function mt(e) {
|
|
4252
|
+
var r;
|
|
4253
|
+
if (e.function.startsWith(dt))
|
|
4254
|
+
return e.function.slice(dt.length);
|
|
4255
|
+
const t = e.args[0];
|
|
4256
|
+
return typeof t == "string" ? fe(t) : w(t) ? H(t) : (r = e.function.split(".").pop()) != null ? r : e.function;
|
|
4257
|
+
}
|
|
4258
|
+
const Ni = "measureFactory.", vi = "filterFactory.", Mi = (e) => e.function.startsWith(Ni), Ri = (e) => e.function.startsWith(vi);
|
|
4259
|
+
function Vi(e, t) {
|
|
4260
|
+
var s;
|
|
4261
|
+
const r = (s = t == null ? void 0 : t.role) != null ? s : "filter";
|
|
4262
|
+
return typeof e == "string" ? { name: fe(e), type: "dimension" } : zt(e) ? { name: fe(e.column), type: "dimension" } : Ut(e) ? { name: H(e.column), type: "measure" } : w(e) ? Mi(e) ? { name: H(e), type: "measure" } : Ri(e) ? { name: mt(e), type: r } : (t == null ? void 0 : t.role) !== void 0 ? { name: mt(e), type: r } : { name: H(e), type: "measure" } : null;
|
|
4211
4263
|
}
|
|
4212
4264
|
export {
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4265
|
+
Bi as CustomSuperJSON,
|
|
4266
|
+
Ki as EMPTY_EXPANDED_QUERY_MODEL,
|
|
4267
|
+
Gi as EMPTY_SIMPLE_QUERY_MODEL,
|
|
4268
|
+
Vi as getQueryElementSummary,
|
|
4269
|
+
Yi as isByIdDashboardCodeParams,
|
|
4270
|
+
Hi as isByIdWidgetCodeParams,
|
|
4271
|
+
Qi as isClientSideDashboardCodeParams,
|
|
4272
|
+
Xi as isClientSideWidgetCodeParams,
|
|
4273
|
+
fi as translateChartFromJSON,
|
|
4274
|
+
di as translateChartToJSON,
|
|
4275
|
+
_i as translateDashboardFromJSON,
|
|
4276
|
+
Pi as translateDashboardToJSON,
|
|
4277
|
+
bi as translatePivotTableFromJSON,
|
|
4278
|
+
Fi as translatePivotTableToJSON,
|
|
4279
|
+
zi as translateQueryFromJSON,
|
|
4280
|
+
Ui as translateQueryToJSON,
|
|
4281
|
+
Wi as translateQueryToJaql,
|
|
4282
|
+
$i as translateWidgetFromJSON,
|
|
4283
|
+
Di as translateWidgetToJSON
|
|
4231
4284
|
};
|