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