@sisense/sdk-ui 2.20.0 → 2.21.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 +65 -65
- package/dist/ai.js +618 -589
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +844 -709
- package/dist/analytics-composer.cjs +23 -23
- package/dist/analytics-composer.js +8 -8
- package/dist/{dimensions-CgMckRe2.cjs → dimensions-DVGn8ORR.cjs} +1 -1
- package/dist/{dimensions-Blw0p98x.js → dimensions-DuUqQgpi.js} +1 -1
- package/dist/{execute-query-VxgY3tbz.js → execute-query-B21bnb05.js} +177 -162
- package/dist/{execute-query-CgkFRn7s.cjs → execute-query-BIkhszY1.cjs} +1 -1
- package/dist/index.cjs +410 -395
- package/dist/index.js +16854 -16244
- package/dist/index.umd.js +684 -619
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/common-filters-connector.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/selection-utils.d.ts +4 -3
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/types.d.ts +10 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/use-common-filters.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/common-filters/utils.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/content-panel.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/components/editable-layout-row.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/editable-layout.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/helpers.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-config-transformers.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-filters.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-handlers.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-widget-transforms.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-jtd-widget.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-jtd.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-tabber.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/utils.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-level-filter.d.ts +8 -1
- package/dist/packages/sdk-ui/src/domains/filters/components/common/reorderable-list.d.ts +32 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/custom-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile-container.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/filters-panel/types.d.ts +14 -1
- package/dist/packages/sdk-ui/src/domains/filters/components/member-filter-tile/member-filter-tile.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/filters/components/unsupported-filter-tile.d.ts +8 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-boxplot-data-options.d.ts +2 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/chart-widget.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/types.d.ts +100 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/use-with-chart-widget-drilldown.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/{common-widget.d.ts → common-widget/common-widget.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/common-widget/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/common-widget/types.d.ts +8 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/{custom-widget.d.ts → custom-widget/custom-widget.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/types.d.ts +71 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/pivot-table-widget.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/types.d.ts +141 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/use-with-pivot-table-widget-drilldown.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/tabber-buttons-widget/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/{table-widget.d.ts → table-widget/table-widget.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/table-widget/types.d.ts +61 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/text-widget/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/{text-widget.d.ts → text-widget/text-widget.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/text-widget/types.d.ts +29 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +45 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/{widget.d.ts → widget/widget.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-dashboard-filters.d.ts +425 -425
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-filters.d.ts +34 -34
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/utils.d.ts +11 -5
- package/dist/packages/sdk-ui/src/domains/widgets/helpers/header-menu-utils.d.ts +9 -0
- package/dist/packages/sdk-ui/src/domains/widgets/helpers/index.d.ts +7 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-container/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/{widget-container.d.ts → widget-container/widget-container.d.ts} +7 -3
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/types.d.ts +58 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header-info-button.d.ts +13 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header-toolbar.d.ts +23 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header.d.ts +14 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-menu-button.d.ts +5 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +8 -1
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +1 -0
- package/dist/packages/sdk-ui/src/infra/app/settings/types/deployment-props.d.ts +1 -0
- package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/types.d.ts +41 -12
- package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-execute-custom-widget-query.d.ts +12 -3
- package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +4 -3
- package/dist/packages/sdk-ui/src/modules/ai/api/narration-endpoints.d.ts +24 -0
- package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -2
- package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +3 -1
- package/dist/packages/sdk-ui/src/modules/ai/use-get-nlq-result.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/common/utils.d.ts +2 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/dashboard/stringify-widgets.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-from-json.d.ts +3 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-to-json.d.ts +6 -6
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-filters-to-json.d.ts +3 -4
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-measures-from-json.d.ts +13 -28
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-measures-to-json.d.ts +6 -7
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +45 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/types.d.ts +3 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/to-widget-code.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/to-widget-props.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/widget/widget-composer.d.ts +1 -1
- package/dist/packages/sdk-ui/src/props.d.ts +6 -407
- package/dist/packages/sdk-ui/src/public-api/internal.d.ts +3 -0
- package/dist/packages/sdk-ui/src/public-api/public.d.ts +5 -5
- package/dist/packages/sdk-ui/src/shared/components/dynamic-size-container/default-size.d.ts +6 -6
- package/dist/packages/sdk-ui/src/types.d.ts +113 -6
- package/dist/{types-YU936hyL.cjs → types-Ch9J6ycn.cjs} +1 -1
- package/dist/{types-tDJE6TNR.js → types-Ockb-LJ0.js} +1 -1
- package/dist/{use-common-filters-BCebg2_K.cjs → use-common-filters-CXJN3RSs.cjs} +145 -95
- package/dist/{use-common-filters-B2wOzse2.js → use-common-filters-DBqRT0et.js} +8597 -8473
- package/dist/{utils-BRCTwjTN.js → utils-BXDqo_yg.js} +3256 -3264
- package/dist/{utils-pvzOGByh.cjs → utils-DH69_bUK.cjs} +21 -21
- package/dist/{widget-composer-T6nvM6Xc.js → widget-composer-DfVCQL2G.js} +3 -3
- package/dist/{widget-composer-ChJ9V_fN.cjs → widget-composer-DgCWcMJ1.cjs} +1 -1
- package/package.json +11 -9
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header-info-button.d.ts +0 -9
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header.d.ts +0 -13
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Xe = Object.defineProperty, ve = Object.defineProperties;
|
|
2
|
+
var er = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var pe = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var ye = (e, r, t) => r in e ?
|
|
4
|
+
var rr = Object.prototype.hasOwnProperty, tr = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ye = (e, r, t) => r in e ? Xe(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, p = (e, r) => {
|
|
6
6
|
for (var t in r || (r = {}))
|
|
7
|
-
|
|
7
|
+
rr.call(r, t) && ye(e, t, r[t]);
|
|
8
8
|
if (pe)
|
|
9
9
|
for (var t of pe(r))
|
|
10
|
-
|
|
10
|
+
tr.call(r, t) && ye(e, t, r[t]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
import { f as
|
|
14
|
-
import { b as
|
|
15
|
-
import { bW as
|
|
16
|
-
import { i as
|
|
17
|
-
class
|
|
12
|
+
}, b = (e, r) => ve(e, er(r));
|
|
13
|
+
import { f as sr, J as nr } from "../types-Ockb-LJ0.js";
|
|
14
|
+
import { b as _s, E as Us, a as Ws, i as js, e as Js, d as Gs } from "../types-Ockb-LJ0.js";
|
|
15
|
+
import { bW as ir, bA as or, bX as ar, bY as ur, bZ as cr, aw as se, b_ as lr, av as fr, b$ as dr, b8 as mr, ax as pr, c0 as yr, bb as gr, b9 as hr, aL as br, b7 as Fr, ba as wr, d as qr, c as Er, k as Cr, c1 as $r, c2 as Ar, c3 as xr, c4 as Dr, c5 as Mr, c6 as Sr, c7 as Tr, c8 as Nr, c9 as Rr, ca as Or, cb as Ir, au as zr, cc as Pr, cd as Br, S as ne, h as kr, s as ie, b as U, M as O, ce as Ee, bG as Ce, cf as Lr, cg as Vr, ch as _r, ci as Ur, cj as Wr, aH as jr, an as ge, am as Jr, ck as $e, a7 as Gr, cl as Kr, y as Qr, x as Yr } from "../execute-query-B21bnb05.js";
|
|
16
|
+
import { i as Hr, b as Zr, D as Xr, d as vr, a as et } from "../dimensions-DuUqQgpi.js";
|
|
17
|
+
class rt {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
|
|
20
20
|
}
|
|
@@ -31,9 +31,9 @@ class Gr {
|
|
|
31
31
|
this.keyToValue.clear(), this.valueToKey.clear();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class Ae {
|
|
35
35
|
constructor(r) {
|
|
36
|
-
this.generateIdentifier = r, this.kv = new
|
|
36
|
+
this.generateIdentifier = r, this.kv = new rt();
|
|
37
37
|
}
|
|
38
38
|
register(r, t) {
|
|
39
39
|
this.kv.getByValue(r) || (t || (t = this.generateIdentifier(r)), this.kv.set(t, r));
|
|
@@ -48,7 +48,7 @@ class Ee {
|
|
|
48
48
|
return this.kv.getByKey(r);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class tt extends Ae {
|
|
52
52
|
constructor() {
|
|
53
53
|
super((r) => r.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
54
54
|
}
|
|
@@ -59,7 +59,7 @@ class Xr extends Ee {
|
|
|
59
59
|
return this.classToAllowedProps.get(r);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function st(e) {
|
|
63
63
|
if ("values" in Object)
|
|
64
64
|
return Object.values(e);
|
|
65
65
|
const r = [];
|
|
@@ -67,21 +67,21 @@ function vr(e) {
|
|
|
67
67
|
e.hasOwnProperty(t) && r.push(e[t]);
|
|
68
68
|
return r;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const t =
|
|
70
|
+
function nt(e, r) {
|
|
71
|
+
const t = st(e);
|
|
72
72
|
if ("find" in t)
|
|
73
73
|
return t.find(r);
|
|
74
74
|
const s = t;
|
|
75
75
|
for (let n = 0; n < s.length; n++) {
|
|
76
|
-
const
|
|
77
|
-
if (r(
|
|
78
|
-
return
|
|
76
|
+
const o = s[n];
|
|
77
|
+
if (r(o))
|
|
78
|
+
return o;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function I(e, r) {
|
|
82
82
|
Object.entries(e).forEach(([t, s]) => r(s, t));
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function W(e, r) {
|
|
85
85
|
return e.indexOf(r) !== -1;
|
|
86
86
|
}
|
|
87
87
|
function he(e, r) {
|
|
@@ -91,7 +91,7 @@ function he(e, r) {
|
|
|
91
91
|
return s;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class it {
|
|
95
95
|
constructor() {
|
|
96
96
|
this.transfomers = {};
|
|
97
97
|
}
|
|
@@ -99,26 +99,26 @@ class rt {
|
|
|
99
99
|
this.transfomers[r.name] = r;
|
|
100
100
|
}
|
|
101
101
|
findApplicable(r) {
|
|
102
|
-
return
|
|
102
|
+
return nt(this.transfomers, (t) => t.isApplicable(r));
|
|
103
103
|
}
|
|
104
104
|
findByName(r) {
|
|
105
105
|
return this.transfomers[r];
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const ot = (e) => Object.prototype.toString.call(e).slice(8, -1), xe = (e) => typeof e == "undefined", at = (e) => e === null, B = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Z = (e) => B(e) && Object.keys(e).length === 0, D = (e) => Array.isArray(e), ut = (e) => typeof e == "string", ct = (e) => typeof e == "number" && !isNaN(e), lt = (e) => typeof e == "boolean", ft = (e) => e instanceof RegExp, k = (e) => e instanceof Map, L = (e) => e instanceof Set, De = (e) => ot(e) === "Symbol", dt = (e) => e instanceof Date && !isNaN(e.valueOf()), mt = (e) => e instanceof Error, be = (e) => typeof e == "number" && isNaN(e), pt = (e) => lt(e) || at(e) || xe(e) || ct(e) || ut(e) || De(e), yt = (e) => typeof e == "bigint", gt = (e) => e === 1 / 0 || e === -1 / 0, ht = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), bt = (e) => e instanceof URL, Me = (e) => e.replace(/\./g, "\\."), Q = (e) => e.map(String).map(Me).join("."), P = (e) => {
|
|
109
109
|
const r = [];
|
|
110
110
|
let t = "";
|
|
111
111
|
for (let n = 0; n < e.length; n++) {
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
112
|
+
let o = e.charAt(n);
|
|
113
|
+
if (o === "\\" && e.charAt(n + 1) === ".") {
|
|
114
114
|
t += ".", n++;
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
117
|
+
if (o === ".") {
|
|
118
118
|
r.push(t), t = "";
|
|
119
119
|
continue;
|
|
120
120
|
}
|
|
121
|
-
t +=
|
|
121
|
+
t += o;
|
|
122
122
|
}
|
|
123
123
|
const s = t;
|
|
124
124
|
return r.push(s), r;
|
|
@@ -131,12 +131,12 @@ function $(e, r, t, s) {
|
|
|
131
131
|
untransform: s
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
$(
|
|
134
|
+
const Se = [
|
|
135
|
+
$(xe, "undefined", () => null, () => {
|
|
136
136
|
}),
|
|
137
|
-
$(
|
|
138
|
-
$(
|
|
139
|
-
$(
|
|
137
|
+
$(yt, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
138
|
+
$(dt, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
139
|
+
$(mt, "Error", (e, r) => {
|
|
140
140
|
const t = {
|
|
141
141
|
name: e.name,
|
|
142
142
|
message: e.message
|
|
@@ -150,7 +150,7 @@ const Ae = [
|
|
|
150
150
|
t[s] = e[s];
|
|
151
151
|
}), t;
|
|
152
152
|
}),
|
|
153
|
-
$(
|
|
153
|
+
$(ft, "regexp", (e) => "" + e, (e) => {
|
|
154
154
|
const r = e.slice(1, e.lastIndexOf("/")), t = e.slice(e.lastIndexOf("/") + 1);
|
|
155
155
|
return new RegExp(r, t);
|
|
156
156
|
}),
|
|
@@ -162,10 +162,10 @@ const Ae = [
|
|
|
162
162
|
(e) => [...e.values()],
|
|
163
163
|
(e) => new Set(e)
|
|
164
164
|
),
|
|
165
|
-
$(
|
|
166
|
-
$((e) => be(e) ||
|
|
165
|
+
$(k, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
166
|
+
$((e) => be(e) || gt(e), "number", (e) => be(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
167
167
|
$((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
168
|
-
$(
|
|
168
|
+
$(bt, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
169
169
|
];
|
|
170
170
|
function j(e, r, t, s) {
|
|
171
171
|
return {
|
|
@@ -175,12 +175,12 @@ function j(e, r, t, s) {
|
|
|
175
175
|
untransform: s
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const Te = j((e, r) => De(e) ? !!r.symbolRegistry.getIdentifier(e) : !1, (e, r) => ["symbol", r.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, r, t) => {
|
|
179
179
|
const s = t.symbolRegistry.getValue(r[1]);
|
|
180
180
|
if (!s)
|
|
181
181
|
throw new Error("Trying to deserialize unknown symbol");
|
|
182
182
|
return s;
|
|
183
|
-
}),
|
|
183
|
+
}), Ft = [
|
|
184
184
|
Int8Array,
|
|
185
185
|
Uint8Array,
|
|
186
186
|
Int16Array,
|
|
@@ -190,19 +190,19 @@ const De = j((e, r) => $e(e) ? !!r.symbolRegistry.getIdentifier(e) : !1, (e, r)
|
|
|
190
190
|
Float32Array,
|
|
191
191
|
Float64Array,
|
|
192
192
|
Uint8ClampedArray
|
|
193
|
-
].reduce((e, r) => (e[r.name] = r, e), {}),
|
|
194
|
-
const t =
|
|
193
|
+
].reduce((e, r) => (e[r.name] = r, e), {}), Ne = j(ht, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, r) => {
|
|
194
|
+
const t = Ft[r[1]];
|
|
195
195
|
if (!t)
|
|
196
196
|
throw new Error("Trying to deserialize unknown typed array");
|
|
197
197
|
return new t(e);
|
|
198
198
|
});
|
|
199
|
-
function
|
|
199
|
+
function Re(e, r) {
|
|
200
200
|
return e != null && e.constructor ? !!r.classRegistry.getIdentifier(e.constructor) : !1;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
202
|
+
const Oe = j(Re, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor)], (e, r) => {
|
|
203
203
|
const t = r.classRegistry.getAllowedProps(e.constructor);
|
|
204
204
|
if (!t)
|
|
205
|
-
return
|
|
205
|
+
return p({}, e);
|
|
206
206
|
const s = {};
|
|
207
207
|
return t.forEach((n) => {
|
|
208
208
|
s[n] = e[n];
|
|
@@ -212,49 +212,49 @@ const Re = j(Ne, (e, r) => ["class", r.classRegistry.getIdentifier(e.constructor
|
|
|
212
212
|
if (!s)
|
|
213
213
|
throw new Error(`Trying to deserialize unknown class '${r[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
214
214
|
return Object.assign(Object.create(s.prototype), e);
|
|
215
|
-
}),
|
|
215
|
+
}), Ie = j((e, r) => !!r.customTransformerRegistry.findApplicable(e), (e, r) => ["custom", r.customTransformerRegistry.findApplicable(e).name], (e, r) => r.customTransformerRegistry.findApplicable(e).serialize(e), (e, r, t) => {
|
|
216
216
|
const s = t.customTransformerRegistry.findByName(r[1]);
|
|
217
217
|
if (!s)
|
|
218
218
|
throw new Error("Trying to deserialize unknown custom value");
|
|
219
219
|
return s.deserialize(e);
|
|
220
|
-
}),
|
|
221
|
-
const t = he(
|
|
220
|
+
}), wt = [Oe, Te, Ie, Ne], Fe = (e, r) => {
|
|
221
|
+
const t = he(wt, (n) => n.isApplicable(e, r));
|
|
222
222
|
if (t)
|
|
223
223
|
return {
|
|
224
224
|
value: t.transform(e, r),
|
|
225
225
|
type: t.annotation(e, r)
|
|
226
226
|
};
|
|
227
|
-
const s = he(
|
|
227
|
+
const s = he(Se, (n) => n.isApplicable(e, r));
|
|
228
228
|
if (s)
|
|
229
229
|
return {
|
|
230
230
|
value: s.transform(e, r),
|
|
231
231
|
type: s.annotation
|
|
232
232
|
};
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
}, ze = {};
|
|
234
|
+
Se.forEach((e) => {
|
|
235
|
+
ze[e.annotation] = e;
|
|
236
236
|
});
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
237
|
+
const qt = (e, r, t) => {
|
|
238
|
+
if (D(r))
|
|
239
239
|
switch (r[0]) {
|
|
240
240
|
case "symbol":
|
|
241
|
-
return
|
|
241
|
+
return Te.untransform(e, r, t);
|
|
242
242
|
case "class":
|
|
243
|
-
return
|
|
243
|
+
return Oe.untransform(e, r, t);
|
|
244
244
|
case "custom":
|
|
245
|
-
return
|
|
245
|
+
return Ie.untransform(e, r, t);
|
|
246
246
|
case "typed-array":
|
|
247
|
-
return
|
|
247
|
+
return Ne.untransform(e, r, t);
|
|
248
248
|
default:
|
|
249
249
|
throw new Error("Unknown transformation: " + r);
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
|
-
const s =
|
|
252
|
+
const s = ze[r];
|
|
253
253
|
if (!s)
|
|
254
254
|
throw new Error("Unknown transformation: " + r);
|
|
255
255
|
return s.untransform(e, t);
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, R = (e, r) => {
|
|
258
258
|
if (r > e.size)
|
|
259
259
|
throw new Error("index out of bounds");
|
|
260
260
|
const t = e.keys();
|
|
@@ -262,23 +262,23 @@ const ht = (e, r, t) => {
|
|
|
262
262
|
t.next(), r--;
|
|
263
263
|
return t.next().value;
|
|
264
264
|
};
|
|
265
|
-
function
|
|
266
|
-
if (
|
|
265
|
+
function Pe(e) {
|
|
266
|
+
if (W(e, "__proto__"))
|
|
267
267
|
throw new Error("__proto__ is not allowed as a property");
|
|
268
|
-
if (
|
|
268
|
+
if (W(e, "prototype"))
|
|
269
269
|
throw new Error("prototype is not allowed as a property");
|
|
270
|
-
if (
|
|
270
|
+
if (W(e, "constructor"))
|
|
271
271
|
throw new Error("constructor is not allowed as a property");
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
273
|
+
const Et = (e, r) => {
|
|
274
|
+
Pe(r);
|
|
275
275
|
for (let t = 0; t < r.length; t++) {
|
|
276
276
|
const s = r[t];
|
|
277
277
|
if (L(e))
|
|
278
|
-
e =
|
|
279
|
-
else if (
|
|
280
|
-
const n = +s,
|
|
281
|
-
switch (
|
|
278
|
+
e = R(e, +s);
|
|
279
|
+
else if (k(e)) {
|
|
280
|
+
const n = +s, o = +r[++t] == 0 ? "key" : "value", i = R(e, n);
|
|
281
|
+
switch (o) {
|
|
282
282
|
case "key":
|
|
283
283
|
e = i;
|
|
284
284
|
break;
|
|
@@ -291,40 +291,40 @@ const bt = (e, r) => {
|
|
|
291
291
|
}
|
|
292
292
|
return e;
|
|
293
293
|
}, X = (e, r, t) => {
|
|
294
|
-
if (
|
|
294
|
+
if (Pe(r), r.length === 0)
|
|
295
295
|
return t(e);
|
|
296
296
|
let s = e;
|
|
297
|
-
for (let
|
|
298
|
-
const i = r[
|
|
299
|
-
if (
|
|
300
|
-
const
|
|
301
|
-
s = s[
|
|
302
|
-
} else if (
|
|
297
|
+
for (let o = 0; o < r.length - 1; o++) {
|
|
298
|
+
const i = r[o];
|
|
299
|
+
if (D(s)) {
|
|
300
|
+
const a = +i;
|
|
301
|
+
s = s[a];
|
|
302
|
+
} else if (B(s))
|
|
303
303
|
s = s[i];
|
|
304
304
|
else if (L(s)) {
|
|
305
|
-
const
|
|
306
|
-
s =
|
|
307
|
-
} else if (
|
|
308
|
-
if (
|
|
305
|
+
const a = +i;
|
|
306
|
+
s = R(s, a);
|
|
307
|
+
} else if (k(s)) {
|
|
308
|
+
if (o === r.length - 2)
|
|
309
309
|
break;
|
|
310
|
-
const u = +i,
|
|
311
|
-
switch (
|
|
310
|
+
const u = +i, c = +r[++o] == 0 ? "key" : "value", m = R(s, u);
|
|
311
|
+
switch (c) {
|
|
312
312
|
case "key":
|
|
313
|
-
s =
|
|
313
|
+
s = m;
|
|
314
314
|
break;
|
|
315
315
|
case "value":
|
|
316
|
-
s = s.get(
|
|
316
|
+
s = s.get(m);
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
const n = r[r.length - 1];
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
|
|
322
|
+
if (D(s) ? s[+n] = t(s[+n]) : B(s) && (s[n] = t(s[n])), L(s)) {
|
|
323
|
+
const o = R(s, +n), i = t(o);
|
|
324
|
+
o !== i && (s.delete(o), s.add(i));
|
|
325
325
|
}
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
326
|
+
if (k(s)) {
|
|
327
|
+
const o = +r[r.length - 2], i = R(s, o);
|
|
328
328
|
switch (+n == 0 ? "key" : "value") {
|
|
329
329
|
case "key": {
|
|
330
330
|
const u = t(i);
|
|
@@ -342,109 +342,109 @@ const bt = (e, r) => {
|
|
|
342
342
|
function v(e, r, t = []) {
|
|
343
343
|
if (!e)
|
|
344
344
|
return;
|
|
345
|
-
if (!
|
|
346
|
-
|
|
345
|
+
if (!D(e)) {
|
|
346
|
+
I(e, (o, i) => v(o, r, [...t, ...P(i)]));
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
349
|
const [s, n] = e;
|
|
350
|
-
n &&
|
|
351
|
-
v(
|
|
350
|
+
n && I(n, (o, i) => {
|
|
351
|
+
v(o, r, [...t, ...P(i)]);
|
|
352
352
|
}), r(s, t);
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function Ct(e, r, t) {
|
|
355
355
|
return v(r, (s, n) => {
|
|
356
|
-
e = X(e, n, (
|
|
356
|
+
e = X(e, n, (o) => qt(o, s, t));
|
|
357
357
|
}), e;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function $t(e, r) {
|
|
360
360
|
function t(s, n) {
|
|
361
|
-
const
|
|
361
|
+
const o = Et(e, P(n));
|
|
362
362
|
s.map(P).forEach((i) => {
|
|
363
|
-
e = X(e, i, () =>
|
|
363
|
+
e = X(e, i, () => o);
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
|
-
if (
|
|
366
|
+
if (D(r)) {
|
|
367
367
|
const [s, n] = r;
|
|
368
|
-
s.forEach((
|
|
369
|
-
e = X(e, P(
|
|
370
|
-
}), n &&
|
|
368
|
+
s.forEach((o) => {
|
|
369
|
+
e = X(e, P(o), () => e);
|
|
370
|
+
}), n && I(n, t);
|
|
371
371
|
} else
|
|
372
|
-
|
|
372
|
+
I(r, t);
|
|
373
373
|
return e;
|
|
374
374
|
}
|
|
375
|
-
const
|
|
376
|
-
function
|
|
375
|
+
const At = (e, r) => B(e) || D(e) || k(e) || L(e) || Re(e, r);
|
|
376
|
+
function xt(e, r, t) {
|
|
377
377
|
const s = t.get(e);
|
|
378
378
|
s ? s.push(r) : t.set(e, [r]);
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Dt(e, r) {
|
|
381
381
|
const t = {};
|
|
382
382
|
let s;
|
|
383
383
|
return e.forEach((n) => {
|
|
384
384
|
if (n.length <= 1)
|
|
385
385
|
return;
|
|
386
|
-
r || (n = n.map((
|
|
387
|
-
const [
|
|
388
|
-
|
|
389
|
-
}), s ?
|
|
390
|
-
}
|
|
391
|
-
const
|
|
392
|
-
var
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
386
|
+
r || (n = n.map((a) => a.map(String)).sort((a, u) => a.length - u.length));
|
|
387
|
+
const [o, ...i] = n;
|
|
388
|
+
o.length === 0 ? s = i.map(Q) : t[Q(o)] = i.map(Q);
|
|
389
|
+
}), s ? Z(t) ? [s] : [s, t] : Z(t) ? void 0 : t;
|
|
390
|
+
}
|
|
391
|
+
const Be = (e, r, t, s, n = [], o = [], i = /* @__PURE__ */ new Map()) => {
|
|
392
|
+
var g;
|
|
393
|
+
const a = pt(e);
|
|
394
|
+
if (!a) {
|
|
395
|
+
xt(e, n, r);
|
|
396
|
+
const f = i.get(e);
|
|
397
|
+
if (f)
|
|
398
398
|
return s ? {
|
|
399
399
|
transformedValue: null
|
|
400
|
-
} :
|
|
400
|
+
} : f;
|
|
401
401
|
}
|
|
402
|
-
if (!
|
|
403
|
-
const
|
|
404
|
-
transformedValue:
|
|
405
|
-
annotations: [
|
|
402
|
+
if (!At(e, t)) {
|
|
403
|
+
const f = Fe(e, t), h = f ? {
|
|
404
|
+
transformedValue: f.value,
|
|
405
|
+
annotations: [f.type]
|
|
406
406
|
} : {
|
|
407
407
|
transformedValue: e
|
|
408
408
|
};
|
|
409
|
-
return
|
|
409
|
+
return a || i.set(e, h), h;
|
|
410
410
|
}
|
|
411
|
-
if (
|
|
411
|
+
if (W(o, e))
|
|
412
412
|
return {
|
|
413
413
|
transformedValue: null
|
|
414
414
|
};
|
|
415
|
-
const u = Fe(e, t),
|
|
416
|
-
|
|
417
|
-
if (
|
|
418
|
-
throw new Error(`Detected property ${
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
415
|
+
const u = Fe(e, t), c = (g = u == null ? void 0 : u.value) != null ? g : e, m = D(c) ? [] : {}, d = {};
|
|
416
|
+
I(c, (f, h) => {
|
|
417
|
+
if (h === "__proto__" || h === "constructor" || h === "prototype")
|
|
418
|
+
throw new Error(`Detected property ${h}. This is a prototype pollution risk, please remove it from your object.`);
|
|
419
|
+
const A = Be(f, r, t, s, [...n, h], [...o, e], i);
|
|
420
|
+
m[h] = A.transformedValue, D(A.annotations) ? d[h] = A.annotations : B(A.annotations) && I(A.annotations, (z, N) => {
|
|
421
|
+
d[Me(h) + "." + N] = z;
|
|
422
422
|
});
|
|
423
423
|
});
|
|
424
|
-
const y =
|
|
425
|
-
transformedValue:
|
|
424
|
+
const y = Z(d) ? {
|
|
425
|
+
transformedValue: m,
|
|
426
426
|
annotations: u ? [u.type] : void 0
|
|
427
427
|
} : {
|
|
428
|
-
transformedValue:
|
|
429
|
-
annotations: u ? [u.type,
|
|
428
|
+
transformedValue: m,
|
|
429
|
+
annotations: u ? [u.type, d] : d
|
|
430
430
|
};
|
|
431
|
-
return
|
|
431
|
+
return a || i.set(e, y), y;
|
|
432
432
|
};
|
|
433
|
-
function
|
|
433
|
+
function ke(e) {
|
|
434
434
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
435
435
|
}
|
|
436
436
|
function we(e) {
|
|
437
|
-
return
|
|
437
|
+
return ke(e) === "Array";
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
if (
|
|
439
|
+
function Mt(e) {
|
|
440
|
+
if (ke(e) !== "Object")
|
|
441
441
|
return !1;
|
|
442
442
|
const r = Object.getPrototypeOf(e);
|
|
443
443
|
return !!r && r.constructor === Object && r === Object.prototype;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
const
|
|
447
|
-
|
|
445
|
+
function St(e, r, t, s, n) {
|
|
446
|
+
const o = {}.propertyIsEnumerable.call(s, r) ? "enumerable" : "nonenumerable";
|
|
447
|
+
o === "enumerable" && (e[r] = t), n && o === "nonenumerable" && Object.defineProperty(e, r, {
|
|
448
448
|
value: t,
|
|
449
449
|
enumerable: !1,
|
|
450
450
|
writable: !0,
|
|
@@ -454,42 +454,42 @@ function xt(e, r, t, s, n) {
|
|
|
454
454
|
function ee(e, r = {}) {
|
|
455
455
|
if (we(e))
|
|
456
456
|
return e.map((n) => ee(n, r));
|
|
457
|
-
if (
|
|
457
|
+
if (!Mt(e))
|
|
458
458
|
return e;
|
|
459
459
|
const t = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
460
|
-
return [...t, ...s].reduce((n,
|
|
461
|
-
if (we(r.props) && !r.props.includes(
|
|
460
|
+
return [...t, ...s].reduce((n, o) => {
|
|
461
|
+
if (we(r.props) && !r.props.includes(o))
|
|
462
462
|
return n;
|
|
463
|
-
const i = e[
|
|
464
|
-
return
|
|
463
|
+
const i = e[o], a = ee(i, r);
|
|
464
|
+
return St(n, o, a, e, r.nonenumerable), n;
|
|
465
465
|
}, {});
|
|
466
466
|
}
|
|
467
|
-
class
|
|
467
|
+
class l {
|
|
468
468
|
/**
|
|
469
469
|
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
470
470
|
*/
|
|
471
471
|
constructor({ dedupe: r = !1 } = {}) {
|
|
472
|
-
this.classRegistry = new
|
|
472
|
+
this.classRegistry = new tt(), this.symbolRegistry = new Ae((t) => {
|
|
473
473
|
var s;
|
|
474
474
|
return (s = t.description) != null ? s : "";
|
|
475
|
-
}), this.customTransformerRegistry = new
|
|
475
|
+
}), this.customTransformerRegistry = new it(), this.allowedErrorProps = [], this.dedupe = r;
|
|
476
476
|
}
|
|
477
477
|
serialize(r) {
|
|
478
|
-
const t = /* @__PURE__ */ new Map(), s =
|
|
478
|
+
const t = /* @__PURE__ */ new Map(), s = Be(r, t, this, this.dedupe), n = {
|
|
479
479
|
json: s.transformedValue
|
|
480
480
|
};
|
|
481
|
-
s.annotations && (n.meta =
|
|
481
|
+
s.annotations && (n.meta = b(p({}, n.meta), {
|
|
482
482
|
values: s.annotations
|
|
483
483
|
}));
|
|
484
|
-
const
|
|
485
|
-
return
|
|
486
|
-
referentialEqualities:
|
|
484
|
+
const o = Dt(t, this.dedupe);
|
|
485
|
+
return o && (n.meta = b(p({}, n.meta), {
|
|
486
|
+
referentialEqualities: o
|
|
487
487
|
})), n;
|
|
488
488
|
}
|
|
489
489
|
deserialize(r) {
|
|
490
490
|
const { json: t, meta: s } = r;
|
|
491
491
|
let n = ee(t);
|
|
492
|
-
return s != null && s.values && (n =
|
|
492
|
+
return s != null && s.values && (n = Ct(n, s.values, this)), s != null && s.referentialEqualities && (n = $t(n, s.referentialEqualities)), n;
|
|
493
493
|
}
|
|
494
494
|
stringify(r) {
|
|
495
495
|
return JSON.stringify(this.serialize(r));
|
|
@@ -504,7 +504,7 @@ class c {
|
|
|
504
504
|
this.symbolRegistry.register(r, t);
|
|
505
505
|
}
|
|
506
506
|
registerCustom(r, t) {
|
|
507
|
-
this.customTransformerRegistry.register(
|
|
507
|
+
this.customTransformerRegistry.register(p({
|
|
508
508
|
name: t
|
|
509
509
|
}, r));
|
|
510
510
|
}
|
|
@@ -512,158 +512,158 @@ class c {
|
|
|
512
512
|
this.allowedErrorProps.push(...r);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const
|
|
515
|
+
l.defaultInstance = new l();
|
|
516
|
+
l.serialize = l.defaultInstance.serialize.bind(l.defaultInstance);
|
|
517
|
+
l.deserialize = l.defaultInstance.deserialize.bind(l.defaultInstance);
|
|
518
|
+
l.stringify = l.defaultInstance.stringify.bind(l.defaultInstance);
|
|
519
|
+
l.parse = l.defaultInstance.parse.bind(l.defaultInstance);
|
|
520
|
+
l.registerClass = l.defaultInstance.registerClass.bind(l.defaultInstance);
|
|
521
|
+
l.registerSymbol = l.defaultInstance.registerSymbol.bind(l.defaultInstance);
|
|
522
|
+
l.registerCustom = l.defaultInstance.registerCustom.bind(l.defaultInstance);
|
|
523
|
+
l.allowErrorProps = l.defaultInstance.allowErrorProps.bind(l.defaultInstance);
|
|
524
|
+
const T = (e) => e === void 0 ? ne.None : e, Tt = (e) => new nr(e.metadataItem, e.type), oe = (e) => new qr(
|
|
525
525
|
e.name,
|
|
526
526
|
e.expression,
|
|
527
527
|
e.type,
|
|
528
528
|
e.description,
|
|
529
|
-
|
|
529
|
+
T(e.sort),
|
|
530
530
|
e.dataSource,
|
|
531
531
|
e.composeCode
|
|
532
|
-
), ae = (e) => new
|
|
532
|
+
), ae = (e) => new Er(
|
|
533
533
|
e.name,
|
|
534
534
|
e.expression,
|
|
535
535
|
e.granularity,
|
|
536
536
|
e.format,
|
|
537
537
|
e.description,
|
|
538
|
-
|
|
538
|
+
T(e.sort),
|
|
539
539
|
e.dataSource,
|
|
540
540
|
e.composeCode
|
|
541
541
|
), q = (e) => {
|
|
542
542
|
switch (e.__serializable) {
|
|
543
543
|
case "DimensionalAttribute":
|
|
544
|
-
return
|
|
544
|
+
return oe(e);
|
|
545
545
|
case "DimensionalLevelAttribute":
|
|
546
546
|
return ae(e);
|
|
547
547
|
default:
|
|
548
548
|
return e;
|
|
549
549
|
}
|
|
550
|
-
},
|
|
550
|
+
}, Le = (e) => new Xr(
|
|
551
551
|
e.name,
|
|
552
552
|
e.expression,
|
|
553
553
|
e.attributes.map(q),
|
|
554
|
-
e.dimensions.map(
|
|
554
|
+
e.dimensions.map(Nt),
|
|
555
555
|
e.type,
|
|
556
556
|
e.description,
|
|
557
|
-
|
|
557
|
+
T(e.sort),
|
|
558
558
|
e.dataSource,
|
|
559
559
|
e.composeCode,
|
|
560
560
|
e.defaultAttribute ? q(e.defaultAttribute) : void 0
|
|
561
|
-
),
|
|
561
|
+
), Ve = (e) => new vr(
|
|
562
562
|
e.name,
|
|
563
563
|
e.expression,
|
|
564
564
|
e.description,
|
|
565
|
-
|
|
565
|
+
T(e.sort),
|
|
566
566
|
e.dataSource,
|
|
567
567
|
e.composeCode
|
|
568
|
-
),
|
|
568
|
+
), Nt = (e) => {
|
|
569
569
|
switch (e.__serializable) {
|
|
570
570
|
case "DimensionalDimension":
|
|
571
|
-
return
|
|
571
|
+
return Le(e);
|
|
572
572
|
case "DimensionalDateDimension":
|
|
573
|
-
return
|
|
573
|
+
return Ve(e);
|
|
574
574
|
default:
|
|
575
575
|
return e;
|
|
576
576
|
}
|
|
577
|
-
},
|
|
577
|
+
}, ue = (e) => new Cr(
|
|
578
578
|
e.name,
|
|
579
579
|
q(e.attribute),
|
|
580
580
|
e.aggregation,
|
|
581
581
|
e.format,
|
|
582
582
|
e.description,
|
|
583
|
-
|
|
583
|
+
T(e.sort),
|
|
584
584
|
e.dataSource,
|
|
585
585
|
e.composeCode
|
|
586
|
-
),
|
|
586
|
+
), ce = (e) => {
|
|
587
587
|
const r = Object.fromEntries(
|
|
588
588
|
Object.entries(e.context).map(([t, s]) => {
|
|
589
589
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
590
590
|
switch (s.__serializable) {
|
|
591
591
|
case "DimensionalAttribute":
|
|
592
|
-
return [t,
|
|
592
|
+
return [t, oe(s)];
|
|
593
593
|
case "DimensionalLevelAttribute":
|
|
594
594
|
return [t, ae(s)];
|
|
595
595
|
case "DimensionalBaseMeasure":
|
|
596
|
-
return [t, oe(s)];
|
|
597
|
-
case "DimensionalCalculatedMeasure":
|
|
598
596
|
return [t, ue(s)];
|
|
597
|
+
case "DimensionalCalculatedMeasure":
|
|
598
|
+
return [t, ce(s)];
|
|
599
599
|
default:
|
|
600
600
|
return [t, s];
|
|
601
601
|
}
|
|
602
602
|
return [t, s];
|
|
603
603
|
})
|
|
604
604
|
);
|
|
605
|
-
return new
|
|
605
|
+
return new $r(
|
|
606
606
|
e.name,
|
|
607
607
|
e.expression,
|
|
608
608
|
r,
|
|
609
609
|
e.format,
|
|
610
610
|
e.description,
|
|
611
|
-
|
|
611
|
+
T(e.sort),
|
|
612
612
|
e.dataSource,
|
|
613
613
|
e.composeCode
|
|
614
614
|
);
|
|
615
|
-
},
|
|
615
|
+
}, _e = (e) => new Ar(
|
|
616
616
|
e.name,
|
|
617
617
|
q(e.attribute),
|
|
618
618
|
e.format,
|
|
619
619
|
e.description,
|
|
620
|
-
|
|
620
|
+
T(e.sort),
|
|
621
621
|
e.dataSource,
|
|
622
622
|
e.composeCode
|
|
623
|
-
),
|
|
623
|
+
), Y = (e) => {
|
|
624
624
|
switch (e.__serializable) {
|
|
625
625
|
case "DimensionalBaseMeasure":
|
|
626
|
-
return oe(e);
|
|
627
|
-
case "DimensionalCalculatedMeasure":
|
|
628
626
|
return ue(e);
|
|
627
|
+
case "DimensionalCalculatedMeasure":
|
|
628
|
+
return ce(e);
|
|
629
629
|
case "DimensionalMeasureTemplate":
|
|
630
|
-
return
|
|
630
|
+
return _e(e);
|
|
631
631
|
default:
|
|
632
632
|
return e;
|
|
633
633
|
}
|
|
634
|
-
},
|
|
634
|
+
}, F = (e) => {
|
|
635
635
|
switch (e.__serializable) {
|
|
636
636
|
case "MembersFilter":
|
|
637
|
-
return new
|
|
637
|
+
return new Br(
|
|
638
638
|
q(e.attribute),
|
|
639
639
|
e.members,
|
|
640
|
-
e.config.backgroundFilter ?
|
|
640
|
+
e.config.backgroundFilter ? b(p({}, e.config), { backgroundFilter: F(e.config.backgroundFilter) }) : e.config,
|
|
641
641
|
e.composeCode
|
|
642
642
|
);
|
|
643
643
|
case "LogicalAttributeFilter":
|
|
644
|
-
return new
|
|
645
|
-
e.filters.map((t) =>
|
|
644
|
+
return new Pr(
|
|
645
|
+
e.filters.map((t) => F(t)),
|
|
646
646
|
e.operator,
|
|
647
647
|
e.config,
|
|
648
648
|
e.composeCode
|
|
649
649
|
);
|
|
650
650
|
case "CascadingFilter":
|
|
651
|
-
return new
|
|
652
|
-
e._filters.map((t) =>
|
|
651
|
+
return new zr(
|
|
652
|
+
e._filters.map((t) => F(t)),
|
|
653
653
|
e.config,
|
|
654
654
|
e.composeCode
|
|
655
655
|
);
|
|
656
656
|
case "ExcludeFilter":
|
|
657
|
-
return new
|
|
658
|
-
|
|
659
|
-
e.input ?
|
|
657
|
+
return new Ir(
|
|
658
|
+
F(e.filter),
|
|
659
|
+
e.input ? F(e.input) : void 0,
|
|
660
660
|
e.config,
|
|
661
661
|
e.composeCode
|
|
662
662
|
);
|
|
663
663
|
case "MeasureFilter":
|
|
664
|
-
return new
|
|
664
|
+
return new Or(
|
|
665
665
|
q(e.attribute),
|
|
666
|
-
|
|
666
|
+
Y(e.measure),
|
|
667
667
|
e.operatorA,
|
|
668
668
|
e.valueA,
|
|
669
669
|
e.operatorB,
|
|
@@ -672,24 +672,24 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
672
672
|
e.composeCode
|
|
673
673
|
);
|
|
674
674
|
case "RankingFilter":
|
|
675
|
-
return new
|
|
675
|
+
return new Rr(
|
|
676
676
|
q(e.attribute),
|
|
677
|
-
|
|
677
|
+
Y(e.measure),
|
|
678
678
|
e.operator,
|
|
679
679
|
e.count,
|
|
680
680
|
e.config,
|
|
681
681
|
e.composeCode
|
|
682
682
|
);
|
|
683
683
|
case "MeasureRankingFilter":
|
|
684
|
-
return new
|
|
685
|
-
|
|
684
|
+
return new Nr(
|
|
685
|
+
Y(e.measure),
|
|
686
686
|
e.operator,
|
|
687
687
|
e.count,
|
|
688
688
|
e.config,
|
|
689
689
|
e.composeCode
|
|
690
690
|
);
|
|
691
691
|
case "NumericFilter":
|
|
692
|
-
return new
|
|
692
|
+
return new Tr(
|
|
693
693
|
q(e.attribute),
|
|
694
694
|
e.operatorA,
|
|
695
695
|
e.valueA,
|
|
@@ -699,7 +699,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
699
699
|
e.composeCode
|
|
700
700
|
);
|
|
701
701
|
case "TextFilter":
|
|
702
|
-
return new
|
|
702
|
+
return new Sr(
|
|
703
703
|
q(e.attribute),
|
|
704
704
|
e.operatorA,
|
|
705
705
|
e.valueA,
|
|
@@ -708,7 +708,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
708
708
|
);
|
|
709
709
|
case "DateRangeFilter": {
|
|
710
710
|
const { valueA: t, valueB: s } = e;
|
|
711
|
-
return new
|
|
711
|
+
return new Mr(
|
|
712
712
|
q(e.attribute),
|
|
713
713
|
t,
|
|
714
714
|
s,
|
|
@@ -717,7 +717,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
717
717
|
);
|
|
718
718
|
}
|
|
719
719
|
case "RelativeDateFilter":
|
|
720
|
-
return new
|
|
720
|
+
return new Dr(
|
|
721
721
|
q(e.attribute),
|
|
722
722
|
e.offset,
|
|
723
723
|
e.count,
|
|
@@ -727,7 +727,7 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
727
727
|
e.composeCode
|
|
728
728
|
);
|
|
729
729
|
case "CustomFilter":
|
|
730
|
-
return new
|
|
730
|
+
return new xr(
|
|
731
731
|
q(e.attribute),
|
|
732
732
|
e.jaqlExpression,
|
|
733
733
|
e.config,
|
|
@@ -737,195 +737,199 @@ const O = (e) => e === void 0 ? Tr.None : e, At = (e) => new ve(e.metadataItem,
|
|
|
737
737
|
return e;
|
|
738
738
|
}
|
|
739
739
|
};
|
|
740
|
-
|
|
740
|
+
l.registerCustom(
|
|
741
741
|
{
|
|
742
|
-
isApplicable:
|
|
742
|
+
isApplicable: sr,
|
|
743
743
|
serialize: (e) => e.serialize(),
|
|
744
|
-
deserialize: (e) =>
|
|
744
|
+
deserialize: (e) => Tt(e)
|
|
745
745
|
},
|
|
746
746
|
"JaqlElement"
|
|
747
747
|
);
|
|
748
|
-
|
|
748
|
+
l.registerCustom(
|
|
749
749
|
{
|
|
750
|
-
isApplicable:
|
|
750
|
+
isApplicable: ir,
|
|
751
751
|
serialize: (e) => e.serialize(),
|
|
752
|
-
deserialize: (e) =>
|
|
752
|
+
deserialize: (e) => oe(e)
|
|
753
753
|
},
|
|
754
754
|
"DimensionalAttribute"
|
|
755
755
|
);
|
|
756
|
-
|
|
756
|
+
l.registerCustom(
|
|
757
757
|
{
|
|
758
|
-
isApplicable:
|
|
758
|
+
isApplicable: or,
|
|
759
759
|
serialize: (e) => e.serialize(),
|
|
760
760
|
deserialize: (e) => ae(e)
|
|
761
761
|
},
|
|
762
762
|
"DimensionalLevelAttribute"
|
|
763
763
|
);
|
|
764
|
-
|
|
764
|
+
l.registerCustom(
|
|
765
765
|
{
|
|
766
|
-
isApplicable:
|
|
766
|
+
isApplicable: Hr,
|
|
767
767
|
serialize: (e) => e.serialize(),
|
|
768
|
-
deserialize: (e) =>
|
|
768
|
+
deserialize: (e) => Le(e)
|
|
769
769
|
},
|
|
770
770
|
"DimensionalDimension"
|
|
771
771
|
);
|
|
772
|
-
|
|
772
|
+
l.registerCustom(
|
|
773
773
|
{
|
|
774
|
-
isApplicable:
|
|
774
|
+
isApplicable: Zr,
|
|
775
775
|
serialize: (e) => e.serialize(),
|
|
776
|
-
deserialize: (e) =>
|
|
776
|
+
deserialize: (e) => Ve(e)
|
|
777
777
|
},
|
|
778
778
|
"DimensionalDateDimension"
|
|
779
779
|
);
|
|
780
|
-
|
|
780
|
+
l.registerCustom(
|
|
781
781
|
{
|
|
782
|
-
isApplicable:
|
|
782
|
+
isApplicable: ar,
|
|
783
783
|
serialize: (e) => e.serialize(),
|
|
784
|
-
deserialize: (e) =>
|
|
784
|
+
deserialize: (e) => ue(e)
|
|
785
785
|
},
|
|
786
786
|
"DimensionalBaseMeasure"
|
|
787
787
|
);
|
|
788
|
-
|
|
788
|
+
l.registerCustom(
|
|
789
789
|
{
|
|
790
|
-
isApplicable:
|
|
790
|
+
isApplicable: ur,
|
|
791
791
|
serialize: (e) => e.serialize(),
|
|
792
|
-
deserialize: (e) =>
|
|
792
|
+
deserialize: (e) => ce(e)
|
|
793
793
|
},
|
|
794
794
|
"DimensionalCalculatedMeasure"
|
|
795
795
|
);
|
|
796
|
-
|
|
796
|
+
l.registerCustom(
|
|
797
797
|
{
|
|
798
|
-
isApplicable:
|
|
798
|
+
isApplicable: cr,
|
|
799
799
|
serialize: (e) => e.serialize(),
|
|
800
|
-
deserialize: (e) =>
|
|
800
|
+
deserialize: (e) => _e(e)
|
|
801
801
|
},
|
|
802
802
|
"DimensionalMeasureTemplate"
|
|
803
803
|
);
|
|
804
|
-
|
|
804
|
+
l.registerCustom(
|
|
805
805
|
{
|
|
806
806
|
isApplicable: se,
|
|
807
807
|
serialize: (e) => e.serialize(),
|
|
808
|
-
deserialize: (e) =>
|
|
808
|
+
deserialize: (e) => F(e)
|
|
809
809
|
},
|
|
810
810
|
"MembersFilter"
|
|
811
811
|
);
|
|
812
|
-
|
|
812
|
+
l.registerCustom(
|
|
813
813
|
{
|
|
814
|
-
isApplicable:
|
|
814
|
+
isApplicable: lr,
|
|
815
815
|
serialize: (e) => e.serialize(),
|
|
816
|
-
deserialize: (e) =>
|
|
816
|
+
deserialize: (e) => F(e)
|
|
817
817
|
},
|
|
818
818
|
"LogicalAttributeFilter"
|
|
819
819
|
);
|
|
820
|
-
|
|
820
|
+
l.registerCustom(
|
|
821
821
|
{
|
|
822
|
-
isApplicable:
|
|
822
|
+
isApplicable: fr,
|
|
823
823
|
serialize: (e) => e.serialize(),
|
|
824
|
-
deserialize: (e) =>
|
|
824
|
+
deserialize: (e) => F(e)
|
|
825
825
|
},
|
|
826
826
|
"CascadingFilter"
|
|
827
827
|
);
|
|
828
|
-
|
|
828
|
+
l.registerCustom(
|
|
829
829
|
{
|
|
830
|
-
isApplicable:
|
|
830
|
+
isApplicable: dr,
|
|
831
831
|
serialize: (e) => e.serialize(),
|
|
832
|
-
deserialize: (e) =>
|
|
832
|
+
deserialize: (e) => F(e)
|
|
833
833
|
},
|
|
834
834
|
"ExcludeFilter"
|
|
835
835
|
);
|
|
836
|
-
|
|
836
|
+
l.registerCustom(
|
|
837
837
|
{
|
|
838
|
-
isApplicable:
|
|
838
|
+
isApplicable: mr,
|
|
839
839
|
serialize: (e) => e.serialize(),
|
|
840
|
-
deserialize: (e) =>
|
|
840
|
+
deserialize: (e) => F(e)
|
|
841
841
|
},
|
|
842
842
|
"MeasureFilter"
|
|
843
843
|
);
|
|
844
|
-
|
|
844
|
+
l.registerCustom(
|
|
845
845
|
{
|
|
846
|
-
isApplicable:
|
|
846
|
+
isApplicable: pr,
|
|
847
847
|
serialize: (e) => e.serialize(),
|
|
848
|
-
deserialize: (e) =>
|
|
848
|
+
deserialize: (e) => F(e)
|
|
849
849
|
},
|
|
850
850
|
"RankingFilter"
|
|
851
851
|
);
|
|
852
|
-
|
|
852
|
+
l.registerCustom(
|
|
853
853
|
{
|
|
854
|
-
isApplicable:
|
|
854
|
+
isApplicable: yr,
|
|
855
855
|
serialize: (e) => e.serialize(),
|
|
856
|
-
deserialize: (e) =>
|
|
856
|
+
deserialize: (e) => F(e)
|
|
857
857
|
},
|
|
858
858
|
"MeasureRankingFilter"
|
|
859
859
|
);
|
|
860
|
-
|
|
860
|
+
l.registerCustom(
|
|
861
861
|
{
|
|
862
|
-
isApplicable:
|
|
862
|
+
isApplicable: gr,
|
|
863
863
|
serialize: (e) => e.serialize(),
|
|
864
|
-
deserialize: (e) =>
|
|
864
|
+
deserialize: (e) => F(e)
|
|
865
865
|
},
|
|
866
866
|
"NumericFilter"
|
|
867
867
|
);
|
|
868
|
-
|
|
868
|
+
l.registerCustom(
|
|
869
869
|
{
|
|
870
|
-
isApplicable:
|
|
870
|
+
isApplicable: hr,
|
|
871
871
|
serialize: (e) => e.serialize(),
|
|
872
|
-
deserialize: (e) =>
|
|
872
|
+
deserialize: (e) => F(e)
|
|
873
873
|
},
|
|
874
874
|
"TextFilter"
|
|
875
875
|
);
|
|
876
|
-
|
|
876
|
+
l.registerCustom(
|
|
877
877
|
{
|
|
878
|
-
isApplicable:
|
|
878
|
+
isApplicable: br,
|
|
879
879
|
serialize: (e) => e.serialize(),
|
|
880
|
-
deserialize: (e) =>
|
|
880
|
+
deserialize: (e) => F(e)
|
|
881
881
|
},
|
|
882
882
|
"DateRangeFilter"
|
|
883
883
|
);
|
|
884
|
-
|
|
884
|
+
l.registerCustom(
|
|
885
885
|
{
|
|
886
|
-
isApplicable:
|
|
886
|
+
isApplicable: Fr,
|
|
887
887
|
serialize: (e) => e.serialize(),
|
|
888
|
-
deserialize: (e) =>
|
|
888
|
+
deserialize: (e) => F(e)
|
|
889
889
|
},
|
|
890
890
|
"RelativeDateFilter"
|
|
891
891
|
);
|
|
892
|
-
|
|
892
|
+
l.registerCustom(
|
|
893
893
|
{
|
|
894
|
-
isApplicable:
|
|
894
|
+
isApplicable: wr,
|
|
895
895
|
serialize: (e) => e.serialize(),
|
|
896
|
-
deserialize: (e) =>
|
|
896
|
+
deserialize: (e) => F(e)
|
|
897
897
|
},
|
|
898
898
|
"CustomFilter"
|
|
899
899
|
);
|
|
900
|
-
const
|
|
901
|
-
function
|
|
900
|
+
const zs = l, w = "DM.";
|
|
901
|
+
function E(e) {
|
|
902
902
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
903
903
|
}
|
|
904
|
-
function
|
|
905
|
-
return e.every(
|
|
904
|
+
function Ue(e) {
|
|
905
|
+
return e.every(E);
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function J(e) {
|
|
908
908
|
return "attribute" in e && "config" in e;
|
|
909
909
|
}
|
|
910
|
-
function
|
|
910
|
+
function _(e) {
|
|
911
911
|
return "left" in e && "right" in e && "operator" in e;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
return !
|
|
913
|
+
function le(e) {
|
|
914
|
+
return !J(e) && !_(e);
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
return e
|
|
918
|
-
}
|
|
919
|
-
function
|
|
920
|
-
const r =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
916
|
+
function Rt(e) {
|
|
917
|
+
return typeof e == "object" && e !== null && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
|
|
918
|
+
}
|
|
919
|
+
function Ot(e) {
|
|
920
|
+
const r = e;
|
|
921
|
+
return typeof e != "object" || e === null || r === null || !("column" in r) ? !1 : E(r.column);
|
|
922
|
+
}
|
|
923
|
+
function It(e) {
|
|
924
|
+
const r = [...e].sort((o, i) => i.name.length - o.name.length), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
925
|
+
for (const o of e) {
|
|
926
|
+
t.set(o.name, o);
|
|
927
|
+
const i = [...o.columns].sort((u, c) => c.name.length - u.name.length);
|
|
928
|
+
n.set(o.name, i);
|
|
929
|
+
const a = /* @__PURE__ */ new Map();
|
|
930
|
+
for (const u of o.columns)
|
|
931
|
+
a.set(u.name, u);
|
|
932
|
+
s.set(o.name, a);
|
|
929
933
|
}
|
|
930
934
|
return {
|
|
931
935
|
sortedTables: r,
|
|
@@ -934,114 +938,114 @@ function Nt(e) {
|
|
|
934
938
|
columnMap: s
|
|
935
939
|
};
|
|
936
940
|
}
|
|
937
|
-
function
|
|
938
|
-
if (!e.startsWith(
|
|
941
|
+
function We(e, r) {
|
|
942
|
+
if (!e.startsWith(w))
|
|
939
943
|
throw new Error(
|
|
940
|
-
`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
944
|
+
`Invalid dimensional element name format: "${e}". Expected format: "${w}TableName.ColumnName[.Level]"`
|
|
941
945
|
);
|
|
942
|
-
const t = e.slice(
|
|
946
|
+
const t = e.slice(w.length);
|
|
943
947
|
if (!t)
|
|
944
948
|
throw new Error(
|
|
945
|
-
`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
949
|
+
`Invalid dimensional element name format: "${e}". Expected format: "${w}TableName.ColumnName[.Level]"`
|
|
946
950
|
);
|
|
947
951
|
let s, n;
|
|
948
|
-
for (const
|
|
949
|
-
if (t.startsWith(
|
|
950
|
-
const y = t.slice(
|
|
952
|
+
for (const d of r.sortedTables)
|
|
953
|
+
if (t.startsWith(d.name + ".")) {
|
|
954
|
+
const y = t.slice(d.name.length + 1);
|
|
951
955
|
if (!y)
|
|
952
956
|
throw new Error(
|
|
953
|
-
`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
957
|
+
`Invalid dimensional element name format: "${e}". Expected format: "${w}TableName.ColumnName[.Level]"`
|
|
954
958
|
);
|
|
955
|
-
s =
|
|
959
|
+
s = d, n = y;
|
|
956
960
|
break;
|
|
957
961
|
}
|
|
958
962
|
if (!s) {
|
|
959
|
-
const
|
|
960
|
-
if (
|
|
963
|
+
const d = t.indexOf(".");
|
|
964
|
+
if (d === -1)
|
|
961
965
|
throw new Error(
|
|
962
|
-
`Invalid dimensional element name format: "${e}". Expected format: "${
|
|
966
|
+
`Invalid dimensional element name format: "${e}". Expected format: "${w}TableName.ColumnName[.Level]"`
|
|
963
967
|
);
|
|
964
|
-
const y = t.slice(0,
|
|
968
|
+
const y = t.slice(0, d);
|
|
965
969
|
throw new Error(`Table "${y}" not found in the data model`);
|
|
966
970
|
}
|
|
967
|
-
const
|
|
968
|
-
if (!
|
|
971
|
+
const o = r.tableColumnMap.get(s.name);
|
|
972
|
+
if (!o)
|
|
969
973
|
throw new Error(`Table "${s.name}" found but has no columns`);
|
|
970
|
-
let i,
|
|
971
|
-
const u =
|
|
972
|
-
for (const
|
|
973
|
-
if (n ===
|
|
974
|
-
return { table: s, column:
|
|
975
|
-
if (!n.startsWith(
|
|
974
|
+
let i, a;
|
|
975
|
+
const u = U.all;
|
|
976
|
+
for (const d of o) {
|
|
977
|
+
if (n === d.name)
|
|
978
|
+
return { table: s, column: d };
|
|
979
|
+
if (!n.startsWith(d.name + "."))
|
|
976
980
|
continue;
|
|
977
|
-
const y = n.slice(
|
|
981
|
+
const y = n.slice(d.name.length + 1);
|
|
978
982
|
if (!y)
|
|
979
983
|
continue;
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
if (
|
|
983
|
-
return { table: s, column:
|
|
984
|
-
i || (i =
|
|
984
|
+
const g = u.includes(y), f = ie(d.dataType);
|
|
985
|
+
if (g) {
|
|
986
|
+
if (f)
|
|
987
|
+
return { table: s, column: d, level: y };
|
|
988
|
+
i || (i = d, a = y);
|
|
985
989
|
continue;
|
|
986
990
|
}
|
|
987
|
-
|
|
991
|
+
f && !i && (i = d, a = y);
|
|
988
992
|
}
|
|
989
|
-
if (i &&
|
|
990
|
-
throw u.includes(
|
|
991
|
-
`Invalid date level "${
|
|
993
|
+
if (i && a)
|
|
994
|
+
throw u.includes(a) ? new Error(
|
|
995
|
+
`Invalid date level "${a}" in dimensional element "${e}". Column "${s.name}.${i.name}" is not a datetime column`
|
|
992
996
|
) : new Error(
|
|
993
|
-
`Invalid date level "${
|
|
997
|
+
`Invalid date level "${a}" in dimensional element "${e}". Valid levels are: ${u.join(
|
|
994
998
|
", "
|
|
995
999
|
)}`
|
|
996
1000
|
);
|
|
997
|
-
const
|
|
998
|
-
throw new Error(`Column "${
|
|
1001
|
+
const c = n.indexOf("."), m = c === -1 ? n : n.slice(0, c);
|
|
1002
|
+
throw new Error(`Column "${m}" not found in table "${s.name}"`);
|
|
999
1003
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const { table: t, column: s, level: n } =
|
|
1004
|
+
function zt(e, r) {
|
|
1005
|
+
const { table: t, column: s, level: n } = We(e, r);
|
|
1002
1006
|
if (n) {
|
|
1003
|
-
if (!
|
|
1007
|
+
if (!ie(s.dataType))
|
|
1004
1008
|
throw new Error(
|
|
1005
1009
|
`Invalid date level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is not a datetime column`
|
|
1006
1010
|
);
|
|
1007
|
-
const
|
|
1008
|
-
if (!
|
|
1011
|
+
const o = U.all;
|
|
1012
|
+
if (!o.includes(n))
|
|
1009
1013
|
throw new Error(
|
|
1010
|
-
`Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${
|
|
1014
|
+
`Invalid date level "${n}" in dimensional element "${e}". Valid levels are: ${o.join(
|
|
1011
1015
|
", "
|
|
1012
1016
|
)}`
|
|
1013
1017
|
);
|
|
1014
|
-
const i =
|
|
1018
|
+
const i = U.dateOnly;
|
|
1015
1019
|
if (s.dataType === "date" && !i.includes(n))
|
|
1016
1020
|
throw new Error(
|
|
1017
1021
|
`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a date column, not a datetime column`
|
|
1018
1022
|
);
|
|
1019
|
-
const
|
|
1020
|
-
if (s.dataType === "time" && !
|
|
1023
|
+
const a = U.timeOnly;
|
|
1024
|
+
if (s.dataType === "time" && !a.includes(n))
|
|
1021
1025
|
throw new Error(
|
|
1022
1026
|
`Invalid level "${n}" in dimensional element "${e}". Column "${t.name}.${s.name}" is only a time column, not a date column`
|
|
1023
1027
|
);
|
|
1024
1028
|
}
|
|
1025
1029
|
return { column: s, level: n };
|
|
1026
1030
|
}
|
|
1027
|
-
function
|
|
1028
|
-
return e.type ===
|
|
1031
|
+
function je(e) {
|
|
1032
|
+
return e.type === O.TextAttribute;
|
|
1029
1033
|
}
|
|
1030
|
-
function
|
|
1031
|
-
return e.type ===
|
|
1034
|
+
function Je(e) {
|
|
1035
|
+
return e.type === O.NumericAttribute;
|
|
1032
1036
|
}
|
|
1033
|
-
function
|
|
1034
|
-
return e.type ===
|
|
1037
|
+
function Pt(e) {
|
|
1038
|
+
return e.type === O.DateLevel;
|
|
1035
1039
|
}
|
|
1036
|
-
function
|
|
1037
|
-
return
|
|
1040
|
+
function Bt(e) {
|
|
1041
|
+
return je(e) || Je(e);
|
|
1038
1042
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return e.type ===
|
|
1043
|
+
function G(e) {
|
|
1044
|
+
return e.type === O.TextAttribute ? "text" : e.type === O.NumericAttribute ? "numeric" : e.type === O.DateLevel ? "date/datetime" : "unknown";
|
|
1041
1045
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const { column: s, level: n } =
|
|
1044
|
-
return
|
|
1046
|
+
function K(e, r, t) {
|
|
1047
|
+
const { column: s, level: n } = zt(e, t);
|
|
1048
|
+
return kr({
|
|
1045
1049
|
expression: s.expression,
|
|
1046
1050
|
dataType: s.dataType,
|
|
1047
1051
|
granularity: n,
|
|
@@ -1050,31 +1054,48 @@ function ce(e, r, t) {
|
|
|
1050
1054
|
dataSource: r
|
|
1051
1055
|
});
|
|
1052
1056
|
}
|
|
1053
|
-
function
|
|
1054
|
-
const { column: s, level: n } =
|
|
1057
|
+
function kt(e, r, t) {
|
|
1058
|
+
const { column: s, level: n } = We(e, t);
|
|
1055
1059
|
if (n)
|
|
1056
1060
|
throw new Error(
|
|
1057
|
-
`Invalid DateDimension name format: "${e}". Expected format: "${
|
|
1061
|
+
`Invalid DateDimension name format: "${e}". Expected format: "${w}TableName.ColumnName"`
|
|
1058
1062
|
);
|
|
1059
|
-
if (!
|
|
1063
|
+
if (!ie(s.dataType))
|
|
1060
1064
|
throw new Error(
|
|
1061
1065
|
`Invalid DateDimension name "${e}". Column "${s.name}" is not a datetime column (got ${s.dataType}).`
|
|
1062
1066
|
);
|
|
1063
|
-
return
|
|
1067
|
+
return et({
|
|
1064
1068
|
name: s.name,
|
|
1065
1069
|
expression: s.expression,
|
|
1066
1070
|
dataSource: r
|
|
1067
1071
|
});
|
|
1068
1072
|
}
|
|
1069
|
-
function
|
|
1073
|
+
function x(e, r) {
|
|
1070
1074
|
const t = e();
|
|
1071
1075
|
return t.success ? t.data : (r.push(...t.errors), null);
|
|
1072
1076
|
}
|
|
1073
|
-
const
|
|
1077
|
+
const Lt = (e, r, t) => {
|
|
1078
|
+
if (!r)
|
|
1079
|
+
return { attribute: e };
|
|
1080
|
+
const s = typeof r == "object" ? r.direction : r;
|
|
1081
|
+
return Ee(s) ? { attribute: e.sort(Ce(s)) } : {
|
|
1082
|
+
attribute: e,
|
|
1083
|
+
error: b(p({}, t), {
|
|
1084
|
+
message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${s}".`
|
|
1085
|
+
})
|
|
1086
|
+
};
|
|
1087
|
+
}, Vt = (e, r, t, s) => {
|
|
1088
|
+
const n = K(e.column, r, t);
|
|
1089
|
+
return Lt(n, e.sortType, s);
|
|
1090
|
+
}, _t = (e, r, t, s) => typeof e == "string" ? { attribute: K(e, r, t) } : Rt(e) ? Vt(e, r, t, s) : {
|
|
1091
|
+
error: b(p({}, s), {
|
|
1092
|
+
message: 'Invalid dimension item. Expected a string (composeCode) or object with "column" and optional "sortType".'
|
|
1093
|
+
})
|
|
1094
|
+
}, Ut = (e) => {
|
|
1074
1095
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
1075
1096
|
if (!r)
|
|
1076
1097
|
return { success: !0, data: [] };
|
|
1077
|
-
if (!
|
|
1098
|
+
if (!Array.isArray(r))
|
|
1078
1099
|
return {
|
|
1079
1100
|
success: !1,
|
|
1080
1101
|
errors: [
|
|
@@ -1082,25 +1103,29 @@ const It = (e) => {
|
|
|
1082
1103
|
category: "dimensions",
|
|
1083
1104
|
index: -1,
|
|
1084
1105
|
input: r,
|
|
1085
|
-
message: "Invalid dimensions JSON. Expected an array
|
|
1106
|
+
message: "Invalid dimensions JSON. Expected an array."
|
|
1086
1107
|
}
|
|
1087
1108
|
]
|
|
1088
1109
|
};
|
|
1089
|
-
const n = [],
|
|
1090
|
-
return r.forEach((i,
|
|
1110
|
+
const n = [], o = [];
|
|
1111
|
+
return r.forEach((i, a) => {
|
|
1091
1112
|
const u = {
|
|
1092
1113
|
category: "dimensions",
|
|
1093
|
-
index:
|
|
1114
|
+
index: a,
|
|
1094
1115
|
input: i
|
|
1095
1116
|
};
|
|
1096
1117
|
try {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1118
|
+
const c = _t(i, t, s, u);
|
|
1119
|
+
if (c.error) {
|
|
1120
|
+
o.push(c.error);
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
c.attribute && n.push(c.attribute);
|
|
1124
|
+
} catch (c) {
|
|
1125
|
+
const m = c instanceof Error ? c.message : "Unknown error";
|
|
1126
|
+
o.push(b(p({}, u), { message: m }));
|
|
1102
1127
|
}
|
|
1103
|
-
}),
|
|
1128
|
+
}), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
|
|
1104
1129
|
};
|
|
1105
1130
|
function fe(e, r) {
|
|
1106
1131
|
const t = Reflect.get(e, r);
|
|
@@ -1108,44 +1133,93 @@ function fe(e, r) {
|
|
|
1108
1133
|
throw new Error(`Function "${r}" not found or is not a function`);
|
|
1109
1134
|
return t;
|
|
1110
1135
|
}
|
|
1111
|
-
function
|
|
1112
|
-
const t = e.replace("measureFactory.", ""), n = fe(
|
|
1113
|
-
if (!
|
|
1136
|
+
function Wt(e, r) {
|
|
1137
|
+
const t = e.replace("measureFactory.", ""), n = fe(Lr, t)(...r);
|
|
1138
|
+
if (!le(n))
|
|
1114
1139
|
throw new Error(`Function "${e}" did not return a valid Measure`);
|
|
1115
1140
|
return n;
|
|
1116
1141
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const t = e.replace("filterFactory.logic.", ""), n = fe(
|
|
1119
|
-
if (!
|
|
1142
|
+
function jt(e, r) {
|
|
1143
|
+
const t = e.replace("filterFactory.logic.", ""), n = fe(Vr, t)(...r);
|
|
1144
|
+
if (!_(n))
|
|
1120
1145
|
throw new Error(`Function "${e}" did not return a valid FilterRelations`);
|
|
1121
1146
|
return n;
|
|
1122
1147
|
}
|
|
1123
|
-
function
|
|
1148
|
+
function Jt(e, r) {
|
|
1124
1149
|
if (e.startsWith("filterFactory.logic."))
|
|
1125
|
-
return
|
|
1126
|
-
const t = e.replace("filterFactory.", ""), n = fe(
|
|
1127
|
-
if (!
|
|
1150
|
+
return jt(e, r);
|
|
1151
|
+
const t = e.replace("filterFactory.", ""), n = fe(_r, t)(...r);
|
|
1152
|
+
if (!J(n) && !_(n))
|
|
1128
1153
|
throw new Error(`Function "${e}" did not return a valid Filter or FilterRelations`);
|
|
1129
1154
|
return n;
|
|
1130
1155
|
}
|
|
1131
|
-
function
|
|
1156
|
+
function Gt(e, r) {
|
|
1132
1157
|
const s = e.split(".")[0];
|
|
1133
1158
|
if (s === "measureFactory")
|
|
1134
|
-
return
|
|
1159
|
+
return Wt(e, r);
|
|
1135
1160
|
if (s === "filterFactory")
|
|
1136
|
-
return
|
|
1161
|
+
return Jt(e, r);
|
|
1137
1162
|
throw new Error(
|
|
1138
1163
|
`Unsupported factory: "${s}". Supported factories: measureFactory, filterFactory`
|
|
1139
1164
|
);
|
|
1140
1165
|
}
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1166
|
+
const Kt = /\[([a-zA-Z_][a-zA-Z0-9_.-]*)\]/g, Ge = /* @__PURE__ */ new Set([
|
|
1167
|
+
// Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
|
|
1168
|
+
"AVG",
|
|
1169
|
+
"COUNT",
|
|
1170
|
+
"DUPCOUNT",
|
|
1171
|
+
"LARGEST",
|
|
1172
|
+
"MAX",
|
|
1173
|
+
"MEDIAN",
|
|
1174
|
+
"MIN",
|
|
1175
|
+
"MODE",
|
|
1176
|
+
"SUM",
|
|
1177
|
+
// Universal – Time-to-date (WTD/MTD/QTD/YTD)
|
|
1178
|
+
"WTDAVG",
|
|
1179
|
+
"WTDSUM",
|
|
1180
|
+
"MTDAVG",
|
|
1181
|
+
"MTDSUM",
|
|
1182
|
+
"QTDAVG",
|
|
1183
|
+
"QTDSUM",
|
|
1184
|
+
"YTDAVG",
|
|
1185
|
+
"YTDSUM",
|
|
1186
|
+
// RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
|
|
1187
|
+
// Elasticube – Aggregative
|
|
1188
|
+
"CORREL",
|
|
1189
|
+
"COVARP",
|
|
1190
|
+
"COVAR",
|
|
1191
|
+
"SKEWP",
|
|
1192
|
+
"SKEW",
|
|
1193
|
+
"SLOPE"
|
|
1194
|
+
]), Qt = new RegExp(
|
|
1195
|
+
`\\b(${Array.from(Ge).join("|")})\\s*\\(`,
|
|
1196
|
+
"i"
|
|
1197
|
+
);
|
|
1198
|
+
function Yt(e) {
|
|
1199
|
+
return E(e) ? !0 : typeof e == "string" && e.startsWith(w) ? !1 : e && typeof e == "object" && "kind" in e ? e.kind === "measure" : !0;
|
|
1200
|
+
}
|
|
1201
|
+
function Ht(e) {
|
|
1202
|
+
const r = /\b(\w+)\s*\(/g, t = /* @__PURE__ */ new Set();
|
|
1203
|
+
let s;
|
|
1204
|
+
for (; (s = r.exec(e)) !== null; ) {
|
|
1205
|
+
const n = s[1];
|
|
1206
|
+
Ge.has(n.toUpperCase()) || t.add(n);
|
|
1207
|
+
}
|
|
1208
|
+
return Array.from(t);
|
|
1209
|
+
}
|
|
1210
|
+
function Zt(e) {
|
|
1211
|
+
return e.length === 1 ? `[${e[0]}]` : e.map((r) => `[${r}]`).join(", ");
|
|
1212
|
+
}
|
|
1213
|
+
function Xt(e) {
|
|
1214
|
+
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1215
|
+
}
|
|
1216
|
+
function vt(e, r, t = {}) {
|
|
1143
1217
|
const {
|
|
1144
1218
|
warnUnusedContext: s = !0,
|
|
1145
1219
|
errorOnUnusedContext: n = !0,
|
|
1146
|
-
allowEmptyFormula:
|
|
1220
|
+
allowEmptyFormula: o = !1,
|
|
1147
1221
|
errorPrefix: i = "customFormula validation"
|
|
1148
|
-
} = t,
|
|
1222
|
+
} = t, a = {
|
|
1149
1223
|
isValid: !0,
|
|
1150
1224
|
errors: [],
|
|
1151
1225
|
warnings: [],
|
|
@@ -1153,70 +1227,71 @@ function Lt(e, r, t = {}) {
|
|
|
1153
1227
|
unusedContextKeys: []
|
|
1154
1228
|
};
|
|
1155
1229
|
if (!e || e.trim().length === 0)
|
|
1156
|
-
return
|
|
1157
|
-
const u = /\b\w+\s*\[/gi,
|
|
1158
|
-
if (
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
`${i}args[1]: Invalid syntax: '${
|
|
1162
|
-
),
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
if (o.references.length > 0 && (/\b\w+\s*\(/gi.test(e) || o.references.every((A) => {
|
|
1173
|
-
if (!(A in r))
|
|
1174
|
-
return !1;
|
|
1175
|
-
const D = r[A];
|
|
1176
|
-
return x(D) ? !1 : typeof D == "string" && D.startsWith(h) ? !0 : D && typeof D == "object" && "kind" in D ? D.kind !== "measure" : !1;
|
|
1177
|
-
}) && (o.errors.push(
|
|
1178
|
-
`${i}args[1]: Formulas with bracket references must contain aggregate function calls`
|
|
1179
|
-
), o.isValid = !1)), o.references.length === 0)
|
|
1180
|
-
return o.warnings.push(
|
|
1230
|
+
return o || (a.errors.push(`${i}args[1]: Formula cannot be empty`), a.isValid = !1), a;
|
|
1231
|
+
const u = /\b\w+\s*\[/gi, c = e.match(u);
|
|
1232
|
+
if (c) {
|
|
1233
|
+
const g = c[0].replace(/\s*\[.*$/, "");
|
|
1234
|
+
a.errors.push(
|
|
1235
|
+
`${i}args[1]: Invalid syntax: '${g}' - operator cannot be used before bracket reference without parentheses`
|
|
1236
|
+
), a.isValid = !1;
|
|
1237
|
+
}
|
|
1238
|
+
a.references = [
|
|
1239
|
+
...new Set(
|
|
1240
|
+
[...e.matchAll(new RegExp(Kt.source, "g"))].map((g) => g[1])
|
|
1241
|
+
)
|
|
1242
|
+
];
|
|
1243
|
+
const m = Object.keys(r);
|
|
1244
|
+
if (a.references.length === 0)
|
|
1245
|
+
return a.warnings.push(
|
|
1181
1246
|
`${i}args[1]: No bracket references found in formula - ensure this is intentional`
|
|
1182
|
-
),
|
|
1183
|
-
if (
|
|
1184
|
-
return
|
|
1247
|
+
), a;
|
|
1248
|
+
if (m.length === 0)
|
|
1249
|
+
return a.errors.push(
|
|
1185
1250
|
`${i}args[2]: Context cannot be empty - custom formulas require context definitions`
|
|
1186
|
-
),
|
|
1187
|
-
const d =
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
`${i}args[1]: Reference [${d[0]}] not found in context. Available keys: ${F.join(", ")}`
|
|
1192
|
-
) : o.errors.push(
|
|
1251
|
+
), a.isValid = !1, a;
|
|
1252
|
+
const d = a.references.filter((g) => !m.includes(g));
|
|
1253
|
+
if (d.length > 0 && (a.isValid = !1, d.length === 1 ? a.errors.push(
|
|
1254
|
+
`${i}args[1]: Reference [${d[0]}] not found in context. Available keys: ${m.join(", ")}`
|
|
1255
|
+
) : a.errors.push(
|
|
1193
1256
|
`${i}args[1]: References [${d.join(
|
|
1194
1257
|
"], ["
|
|
1195
|
-
)}] not found in context. Available keys: ${
|
|
1196
|
-
)), (
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1199
|
-
|
|
1258
|
+
)}] not found in context. Available keys: ${m.join(", ")}`
|
|
1259
|
+
)), !Qt.test(e)) {
|
|
1260
|
+
const g = a.references.filter(
|
|
1261
|
+
(f) => f in r && !Yt(r[f])
|
|
1262
|
+
);
|
|
1263
|
+
g.length > 0 && (a.errors.push(
|
|
1264
|
+
`${i}args[1]: ${Xt(
|
|
1265
|
+
Ht(e)
|
|
1266
|
+
)}Bracket reference(s) ${Zt(
|
|
1267
|
+
g
|
|
1268
|
+
)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
|
|
1269
|
+
), a.isValid = !1);
|
|
1270
|
+
}
|
|
1271
|
+
if ((s || n) && m.length > 0) {
|
|
1272
|
+
const g = m.filter((f) => !a.references.includes(f));
|
|
1273
|
+
if (a.unusedContextKeys = g, g.length > 0) {
|
|
1274
|
+
const f = `${i}args[2]: Context keys [${g.join(
|
|
1200
1275
|
", "
|
|
1201
1276
|
)}] are defined but not used in formula`;
|
|
1202
|
-
n ? (
|
|
1277
|
+
n ? (a.errors.push(f), a.isValid = !1) : s && a.warnings.push(f);
|
|
1203
1278
|
}
|
|
1204
1279
|
}
|
|
1205
|
-
return
|
|
1280
|
+
return a;
|
|
1206
1281
|
}
|
|
1207
|
-
function
|
|
1208
|
-
const s =
|
|
1282
|
+
function es(e, r, t = {}) {
|
|
1283
|
+
const s = vt(e, r, t);
|
|
1209
1284
|
if (!s.isValid)
|
|
1210
1285
|
throw new Error(s.errors.join("; "));
|
|
1211
1286
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1212
1287
|
}
|
|
1213
|
-
function
|
|
1288
|
+
function rs(e, r) {
|
|
1214
1289
|
if (e.length < 3 || e.length > 5)
|
|
1215
1290
|
throw new Error(
|
|
1216
1291
|
`${r.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
|
|
1217
1292
|
);
|
|
1218
1293
|
const t = e[1], s = e[2];
|
|
1219
|
-
|
|
1294
|
+
es(t, s, {
|
|
1220
1295
|
errorPrefix: `${r.pathPrefix}`,
|
|
1221
1296
|
errorOnUnusedContext: !0,
|
|
1222
1297
|
// Strict validation: all context keys must be used
|
|
@@ -1224,33 +1299,33 @@ function Wt(e, r) {
|
|
|
1224
1299
|
// Custom formulas must have content
|
|
1225
1300
|
});
|
|
1226
1301
|
const n = {};
|
|
1227
|
-
for (const [
|
|
1228
|
-
const
|
|
1229
|
-
if (
|
|
1230
|
-
n[`${
|
|
1302
|
+
for (const [o, i] of Object.entries(s)) {
|
|
1303
|
+
const a = `args[2].${o}`;
|
|
1304
|
+
if (E(i))
|
|
1305
|
+
n[`${o}`] = C({
|
|
1231
1306
|
data: i,
|
|
1232
1307
|
context: {
|
|
1233
1308
|
dataSource: r.dataSource,
|
|
1234
1309
|
schemaIndex: r.schemaIndex,
|
|
1235
|
-
pathPrefix:
|
|
1310
|
+
pathPrefix: a
|
|
1236
1311
|
}
|
|
1237
1312
|
});
|
|
1238
|
-
else if (typeof i == "string" && i.startsWith(
|
|
1313
|
+
else if (typeof i == "string" && i.startsWith(w))
|
|
1239
1314
|
try {
|
|
1240
|
-
n[`${
|
|
1315
|
+
n[`${o}`] = K(
|
|
1241
1316
|
i,
|
|
1242
1317
|
r.dataSource,
|
|
1243
1318
|
r.schemaIndex
|
|
1244
1319
|
);
|
|
1245
1320
|
} catch (u) {
|
|
1246
|
-
const
|
|
1247
|
-
throw new Error(`${
|
|
1321
|
+
const c = u instanceof Error ? u.message : "Unknown error";
|
|
1322
|
+
throw new Error(`${a}: ${c}`);
|
|
1248
1323
|
}
|
|
1249
1324
|
else if (i && typeof i == "object" && "kind" in i)
|
|
1250
|
-
n[`${
|
|
1325
|
+
n[`${o}`] = i;
|
|
1251
1326
|
else
|
|
1252
1327
|
throw new Error(
|
|
1253
|
-
`${
|
|
1328
|
+
`${a}: Invalid context value for key '${o}'. Expected a function call or attribute reference (${w}...), but got: ${typeof i}`
|
|
1254
1329
|
);
|
|
1255
1330
|
}
|
|
1256
1331
|
e[2] = n;
|
|
@@ -1263,57 +1338,57 @@ function de(e, r) {
|
|
|
1263
1338
|
}
|
|
1264
1339
|
function qe(e, r) {
|
|
1265
1340
|
const t = de(e, r);
|
|
1266
|
-
if (!
|
|
1341
|
+
if (!Bt(t))
|
|
1267
1342
|
throw new Error(
|
|
1268
|
-
`${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${
|
|
1343
|
+
`${r.pathPrefix}args[0]: Attribute must be string or numeric type, got ${G(
|
|
1269
1344
|
t
|
|
1270
1345
|
)} attribute`
|
|
1271
1346
|
);
|
|
1272
1347
|
}
|
|
1273
|
-
function
|
|
1348
|
+
function M(e, r) {
|
|
1274
1349
|
const t = de(e, r);
|
|
1275
|
-
if (!
|
|
1350
|
+
if (!Je(t))
|
|
1276
1351
|
throw new Error(
|
|
1277
|
-
`${r.pathPrefix}args[0]: Attribute must be numeric type, got ${
|
|
1352
|
+
`${r.pathPrefix}args[0]: Attribute must be numeric type, got ${G(
|
|
1278
1353
|
t
|
|
1279
1354
|
)} attribute`
|
|
1280
1355
|
);
|
|
1281
1356
|
}
|
|
1282
1357
|
function S(e, r) {
|
|
1283
1358
|
const t = de(e, r);
|
|
1284
|
-
if (!
|
|
1359
|
+
if (!je(t))
|
|
1285
1360
|
throw new Error(
|
|
1286
|
-
`${r.pathPrefix}args[0]: Attribute must be string type, got ${
|
|
1361
|
+
`${r.pathPrefix}args[0]: Attribute must be string type, got ${G(
|
|
1287
1362
|
t
|
|
1288
1363
|
)} attribute`
|
|
1289
1364
|
);
|
|
1290
1365
|
}
|
|
1291
|
-
function
|
|
1366
|
+
function ts(e, r) {
|
|
1292
1367
|
const t = e[0];
|
|
1293
1368
|
if (!t || typeof t != "object" || !("attribute" in t))
|
|
1294
1369
|
throw new Error(`${r.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1295
1370
|
return t;
|
|
1296
1371
|
}
|
|
1297
|
-
function
|
|
1298
|
-
const t =
|
|
1372
|
+
function ss(e, r) {
|
|
1373
|
+
const t = ts(e, r);
|
|
1299
1374
|
if (!se(t))
|
|
1300
1375
|
throw new Error(
|
|
1301
1376
|
`${r.pathPrefix}args[0]: exclude filter only accepts members filter, got ${t.__serializable || "unknown"} filter`
|
|
1302
1377
|
);
|
|
1303
1378
|
}
|
|
1304
|
-
const
|
|
1305
|
-
"measureFactory.customFormula":
|
|
1379
|
+
const ns = {
|
|
1380
|
+
"measureFactory.customFormula": rs,
|
|
1306
1381
|
// String | Number filters
|
|
1307
1382
|
"filterFactory.equals": qe,
|
|
1308
1383
|
"filterFactory.doesntEqual": qe,
|
|
1309
1384
|
// Numeric filters
|
|
1310
|
-
"filterFactory.greaterThan":
|
|
1311
|
-
"filterFactory.greaterThanOrEqual":
|
|
1312
|
-
"filterFactory.lessThan":
|
|
1313
|
-
"filterFactory.lessThanOrEqual":
|
|
1314
|
-
"filterFactory.between":
|
|
1315
|
-
"filterFactory.betweenNotEqual":
|
|
1316
|
-
"filterFactory.numeric":
|
|
1385
|
+
"filterFactory.greaterThan": M,
|
|
1386
|
+
"filterFactory.greaterThanOrEqual": M,
|
|
1387
|
+
"filterFactory.lessThan": M,
|
|
1388
|
+
"filterFactory.lessThanOrEqual": M,
|
|
1389
|
+
"filterFactory.between": M,
|
|
1390
|
+
"filterFactory.betweenNotEqual": M,
|
|
1391
|
+
"filterFactory.numeric": M,
|
|
1317
1392
|
// String filters
|
|
1318
1393
|
"filterFactory.contains": S,
|
|
1319
1394
|
"filterFactory.doesntContain": S,
|
|
@@ -1323,12 +1398,12 @@ const jt = {
|
|
|
1323
1398
|
"filterFactory.doesntEndWith": S,
|
|
1324
1399
|
"filterFactory.like": S,
|
|
1325
1400
|
// Exclude filter
|
|
1326
|
-
"filterFactory.exclude":
|
|
1401
|
+
"filterFactory.exclude": ss
|
|
1327
1402
|
};
|
|
1328
|
-
function
|
|
1329
|
-
return
|
|
1403
|
+
function is(e) {
|
|
1404
|
+
return ns[`${e}`];
|
|
1330
1405
|
}
|
|
1331
|
-
const
|
|
1406
|
+
const os = {
|
|
1332
1407
|
// ==================== MEASURE FACTORY FUNCTIONS ====================
|
|
1333
1408
|
// Basic aggregations
|
|
1334
1409
|
"measureFactory.sum": [
|
|
@@ -1856,17 +1931,17 @@ const Qt = {
|
|
|
1856
1931
|
]
|
|
1857
1932
|
};
|
|
1858
1933
|
function me(e) {
|
|
1859
|
-
return
|
|
1934
|
+
return os[`${e}`];
|
|
1860
1935
|
}
|
|
1861
|
-
function
|
|
1936
|
+
function as(e) {
|
|
1862
1937
|
const r = me(e);
|
|
1863
1938
|
return r ? r.filter((t) => t.required).length : 0;
|
|
1864
1939
|
}
|
|
1865
|
-
function
|
|
1940
|
+
function us(e) {
|
|
1866
1941
|
const r = me(e);
|
|
1867
1942
|
return r ? r.length : 0;
|
|
1868
1943
|
}
|
|
1869
|
-
function
|
|
1944
|
+
function cs(e) {
|
|
1870
1945
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1871
1946
|
return !1;
|
|
1872
1947
|
const t = Date.parse(e);
|
|
@@ -1875,32 +1950,32 @@ function Zt(e) {
|
|
|
1875
1950
|
const s = new Date(e);
|
|
1876
1951
|
return !isNaN(s.getTime());
|
|
1877
1952
|
}
|
|
1878
|
-
function
|
|
1879
|
-
if (e.startsWith(
|
|
1953
|
+
function H(e, r, t, s) {
|
|
1954
|
+
if (e.startsWith(w))
|
|
1880
1955
|
try {
|
|
1881
|
-
return
|
|
1956
|
+
return K(e, r, t);
|
|
1882
1957
|
} catch (n) {
|
|
1883
|
-
const
|
|
1884
|
-
throw new Error(`${s}: ${
|
|
1958
|
+
const o = n instanceof Error ? n.message : "Unknown error";
|
|
1959
|
+
throw new Error(`${s}: ${o}`);
|
|
1885
1960
|
}
|
|
1886
1961
|
throw new Error(
|
|
1887
|
-
`${s}: Invalid attribute "${e}". Expected format: "${
|
|
1962
|
+
`${s}: Invalid attribute "${e}". Expected format: "${w}TableName.ColumnName[.Level]"`
|
|
1888
1963
|
);
|
|
1889
1964
|
}
|
|
1890
|
-
function
|
|
1891
|
-
if (e.startsWith(
|
|
1965
|
+
function ls(e, r, t, s) {
|
|
1966
|
+
if (e.startsWith(w))
|
|
1892
1967
|
try {
|
|
1893
|
-
return
|
|
1968
|
+
return kt(e, r, t);
|
|
1894
1969
|
} catch (n) {
|
|
1895
|
-
const
|
|
1896
|
-
throw new Error(`${s}: ${
|
|
1970
|
+
const o = n instanceof Error ? n.message : "Unknown error";
|
|
1971
|
+
throw new Error(`${s}: ${o}`);
|
|
1897
1972
|
}
|
|
1898
1973
|
throw new Error(
|
|
1899
|
-
`${s}: Invalid date dimension string "${e}". Expected format: "${
|
|
1974
|
+
`${s}: Invalid date dimension string "${e}". Expected format: "${w}TableName.ColumnName"`
|
|
1900
1975
|
);
|
|
1901
1976
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix:
|
|
1977
|
+
function fs(e) {
|
|
1978
|
+
const r = e.data, { argSchema: t, dataSource: s, schemaIndex: n, pathPrefix: o } = e.context, i = o;
|
|
1904
1979
|
if (r === void 0) {
|
|
1905
1980
|
if (t.required)
|
|
1906
1981
|
throw new Error(`${i}: Required argument is missing (expected ${t.type})`);
|
|
@@ -1924,7 +1999,7 @@ function Xt(e) {
|
|
|
1924
1999
|
throw new Error(
|
|
1925
2000
|
`${i}: Expected array of strings, got ${typeof r}. Example: ["value1", "value2"]`
|
|
1926
2001
|
);
|
|
1927
|
-
if (!r.every((
|
|
2002
|
+
if (!r.every((a) => typeof a == "string"))
|
|
1928
2003
|
throw new Error(
|
|
1929
2004
|
`${i}: Expected array of strings, but contains non-string values`
|
|
1930
2005
|
);
|
|
@@ -1934,7 +2009,7 @@ function Xt(e) {
|
|
|
1934
2009
|
throw new Error(
|
|
1935
2010
|
`${i}: Expected array of numbers, got ${typeof r}. Example: [10, 20]`
|
|
1936
2011
|
);
|
|
1937
|
-
if (!r.every((
|
|
2012
|
+
if (!r.every((a) => typeof a == "number"))
|
|
1938
2013
|
throw new Error(
|
|
1939
2014
|
`${i}: Expected array of numbers, but contains non-number values`
|
|
1940
2015
|
);
|
|
@@ -1944,20 +2019,20 @@ function Xt(e) {
|
|
|
1944
2019
|
throw new Error(
|
|
1945
2020
|
`${i}: Expected attribute string, got ${typeof r}. Example: "DM.Commerce.Revenue"`
|
|
1946
2021
|
);
|
|
1947
|
-
return
|
|
2022
|
+
return H(r, s, n, i);
|
|
1948
2023
|
case "Attribute[]":
|
|
1949
2024
|
if (!Array.isArray(r))
|
|
1950
2025
|
throw new Error(
|
|
1951
2026
|
`${i}: Expected array of attributes, got ${typeof r}. Example: ["DM.Commerce.AgeRange"]`
|
|
1952
2027
|
);
|
|
1953
|
-
return r.map((
|
|
1954
|
-
if (typeof
|
|
1955
|
-
throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof
|
|
1956
|
-
return
|
|
2028
|
+
return r.map((a, u) => {
|
|
2029
|
+
if (typeof a != "string")
|
|
2030
|
+
throw new Error(`${i}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
2031
|
+
return H(a, s, n, `${i}[${u}]`);
|
|
1957
2032
|
});
|
|
1958
2033
|
case "Measure":
|
|
1959
2034
|
case "BaseMeasure":
|
|
1960
|
-
if (!
|
|
2035
|
+
if (!E(r))
|
|
1961
2036
|
throw new Error(
|
|
1962
2037
|
`${i}: Expected measure function call, got ${typeof r}. Example: {"function": "measureFactory.sum", "args": ["DM.Commerce.Revenue"]}`
|
|
1963
2038
|
);
|
|
@@ -1970,18 +2045,18 @@ function Xt(e) {
|
|
|
1970
2045
|
throw new Error(
|
|
1971
2046
|
`${i}: Expected array of measure function calls, got ${typeof r}`
|
|
1972
2047
|
);
|
|
1973
|
-
return r.map((
|
|
1974
|
-
if (!
|
|
2048
|
+
return r.map((a, u) => {
|
|
2049
|
+
if (!E(a))
|
|
1975
2050
|
throw new Error(
|
|
1976
|
-
`${i}[${u}]: Expected measure function call, got ${typeof
|
|
2051
|
+
`${i}[${u}]: Expected measure function call, got ${typeof a}`
|
|
1977
2052
|
);
|
|
1978
2053
|
return C({
|
|
1979
|
-
data:
|
|
2054
|
+
data: a,
|
|
1980
2055
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
1981
2056
|
});
|
|
1982
2057
|
});
|
|
1983
2058
|
case "Filter":
|
|
1984
|
-
if (!
|
|
2059
|
+
if (!E(r))
|
|
1985
2060
|
throw new Error(
|
|
1986
2061
|
`${i}: Expected filter function call, got ${typeof r}. Example: {"function": "filterFactory.contains", "args": ["DM.Brand.Brand", "Apple"]}`
|
|
1987
2062
|
);
|
|
@@ -1994,29 +2069,29 @@ function Xt(e) {
|
|
|
1994
2069
|
throw new Error(
|
|
1995
2070
|
`${i}: Expected array of filter function calls, got ${typeof r}`
|
|
1996
2071
|
);
|
|
1997
|
-
return r.map((
|
|
1998
|
-
if (!
|
|
2072
|
+
return r.map((a, u) => {
|
|
2073
|
+
if (!E(a))
|
|
1999
2074
|
throw new Error(
|
|
2000
|
-
`${i}[${u}]: Expected filter function call, got ${typeof
|
|
2075
|
+
`${i}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2001
2076
|
);
|
|
2002
2077
|
return C({
|
|
2003
|
-
data:
|
|
2078
|
+
data: a,
|
|
2004
2079
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
2005
2080
|
});
|
|
2006
2081
|
});
|
|
2007
2082
|
case "FilterRelationsNode":
|
|
2008
2083
|
if (Array.isArray(r))
|
|
2009
|
-
return r.map((
|
|
2010
|
-
if (!
|
|
2084
|
+
return r.map((a, u) => {
|
|
2085
|
+
if (!E(a))
|
|
2011
2086
|
throw new Error(
|
|
2012
|
-
`${i}[${u}]: Expected filter function call, got ${typeof
|
|
2087
|
+
`${i}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2013
2088
|
);
|
|
2014
2089
|
return C({
|
|
2015
|
-
data:
|
|
2090
|
+
data: a,
|
|
2016
2091
|
context: { dataSource: s, schemaIndex: n, pathPrefix: `${i}[${u}]` }
|
|
2017
2092
|
});
|
|
2018
2093
|
});
|
|
2019
|
-
if (
|
|
2094
|
+
if (E(r))
|
|
2020
2095
|
return C({
|
|
2021
2096
|
data: r,
|
|
2022
2097
|
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
@@ -2029,30 +2104,30 @@ function Xt(e) {
|
|
|
2029
2104
|
throw new Error(
|
|
2030
2105
|
`${i}: Expected date dimension string, got ${typeof r}. Example: "DM.Commerce.Date"`
|
|
2031
2106
|
);
|
|
2032
|
-
return
|
|
2107
|
+
return ls(r, s, n, i);
|
|
2033
2108
|
case "LevelAttribute": {
|
|
2034
2109
|
if (typeof r != "string")
|
|
2035
2110
|
throw new Error(
|
|
2036
2111
|
`${i}: Expected date attribute string, got ${typeof r}. Example: "DM.Commerce.Date.Years"`
|
|
2037
2112
|
);
|
|
2038
|
-
const
|
|
2113
|
+
const a = H(
|
|
2039
2114
|
r,
|
|
2040
2115
|
s,
|
|
2041
2116
|
n,
|
|
2042
2117
|
i
|
|
2043
2118
|
);
|
|
2044
|
-
if (!
|
|
2119
|
+
if (!Pt(a))
|
|
2045
2120
|
throw new Error(
|
|
2046
|
-
`${i}: Attribute must be date/datetime type, got ${
|
|
2047
|
-
|
|
2121
|
+
`${i}: Attribute must be date/datetime type, got ${G(
|
|
2122
|
+
a
|
|
2048
2123
|
)} attribute`
|
|
2049
2124
|
);
|
|
2050
|
-
return
|
|
2125
|
+
return a;
|
|
2051
2126
|
}
|
|
2052
2127
|
case "Measure | number":
|
|
2053
2128
|
if (typeof r == "number")
|
|
2054
2129
|
return r;
|
|
2055
|
-
if (
|
|
2130
|
+
if (E(r))
|
|
2056
2131
|
return C({
|
|
2057
2132
|
data: r,
|
|
2058
2133
|
context: { dataSource: s, schemaIndex: n, pathPrefix: i }
|
|
@@ -2062,7 +2137,7 @@ function Xt(e) {
|
|
|
2062
2137
|
);
|
|
2063
2138
|
case "Date | string":
|
|
2064
2139
|
if (typeof r == "string") {
|
|
2065
|
-
if (
|
|
2140
|
+
if (cs(r))
|
|
2066
2141
|
return r;
|
|
2067
2142
|
throw new Error(
|
|
2068
2143
|
`${i}: Expected valid ISO date string or Date object, got invalid date string "${r}"`
|
|
@@ -2090,99 +2165,99 @@ function Xt(e) {
|
|
|
2090
2165
|
}
|
|
2091
2166
|
}
|
|
2092
2167
|
function C(e) {
|
|
2093
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function:
|
|
2168
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s, pathPrefix: n } = e.context, { function: o, args: i } = r, a = n ? `${n}.` : "", u = me(o);
|
|
2094
2169
|
if (!u)
|
|
2095
|
-
throw new Error(`${
|
|
2096
|
-
const
|
|
2097
|
-
if (i.length <
|
|
2170
|
+
throw new Error(`${a}function: Unknown function "${o}"`);
|
|
2171
|
+
const c = as(o), m = us(o);
|
|
2172
|
+
if (i.length < c)
|
|
2098
2173
|
throw new Error(
|
|
2099
|
-
`${
|
|
2174
|
+
`${a}function: Expected at least ${c} arguments, got ${i.length}`
|
|
2100
2175
|
);
|
|
2101
|
-
if (i.length >
|
|
2176
|
+
if (i.length > m)
|
|
2102
2177
|
throw new Error(
|
|
2103
|
-
`${
|
|
2178
|
+
`${a}function: Expected at most ${m} arguments, got ${i.length}`
|
|
2104
2179
|
);
|
|
2105
|
-
const
|
|
2106
|
-
for (let
|
|
2107
|
-
const
|
|
2108
|
-
if (
|
|
2109
|
-
|
|
2180
|
+
const d = [], y = [];
|
|
2181
|
+
for (let f = 0; f < Math.max(i.length, u.length); f++) {
|
|
2182
|
+
const h = u[`${f}`], A = i[`${f}`], z = a ? `${a}args[${f}]` : `args[${f}]`;
|
|
2183
|
+
if (A === void 0) {
|
|
2184
|
+
h != null && h.required && y.push(`${z}: Missing required argument (expected ${h.type})`);
|
|
2110
2185
|
continue;
|
|
2111
2186
|
}
|
|
2112
|
-
if (!
|
|
2113
|
-
y.push(`${
|
|
2187
|
+
if (!h) {
|
|
2188
|
+
y.push(`${z}: Unexpected argument`);
|
|
2114
2189
|
continue;
|
|
2115
2190
|
}
|
|
2116
2191
|
try {
|
|
2117
|
-
const
|
|
2118
|
-
data:
|
|
2192
|
+
const N = fs({
|
|
2193
|
+
data: A,
|
|
2119
2194
|
context: {
|
|
2120
2195
|
dataSource: t,
|
|
2121
2196
|
schemaIndex: s,
|
|
2122
|
-
pathPrefix:
|
|
2123
|
-
argSchema:
|
|
2197
|
+
pathPrefix: z,
|
|
2198
|
+
argSchema: h
|
|
2124
2199
|
}
|
|
2125
2200
|
});
|
|
2126
|
-
|
|
2127
|
-
} catch (
|
|
2128
|
-
const
|
|
2129
|
-
y.push(
|
|
2201
|
+
d.push(N);
|
|
2202
|
+
} catch (N) {
|
|
2203
|
+
const Ze = N instanceof Error ? N.message : "Unknown error";
|
|
2204
|
+
y.push(Ze);
|
|
2130
2205
|
}
|
|
2131
2206
|
}
|
|
2132
2207
|
if (y.length > 0) {
|
|
2133
|
-
const
|
|
2134
|
-
throw new Error(
|
|
2208
|
+
const f = y.join("; ");
|
|
2209
|
+
throw new Error(f);
|
|
2135
2210
|
}
|
|
2136
|
-
const
|
|
2137
|
-
if (
|
|
2211
|
+
const g = is(o);
|
|
2212
|
+
if (g)
|
|
2138
2213
|
try {
|
|
2139
|
-
|
|
2214
|
+
g(d, {
|
|
2140
2215
|
dataSource: t,
|
|
2141
2216
|
schemaIndex: s,
|
|
2142
|
-
pathPrefix:
|
|
2217
|
+
pathPrefix: a
|
|
2143
2218
|
});
|
|
2144
|
-
} catch (
|
|
2145
|
-
const
|
|
2146
|
-
throw new Error(
|
|
2219
|
+
} catch (f) {
|
|
2220
|
+
const h = f instanceof Error ? f.message : "Unknown validation error";
|
|
2221
|
+
throw new Error(h);
|
|
2147
2222
|
}
|
|
2148
|
-
return
|
|
2223
|
+
return Gt(o, d);
|
|
2149
2224
|
}
|
|
2150
|
-
function
|
|
2225
|
+
function Ke(e) {
|
|
2151
2226
|
const { attribute: r, config: t } = e;
|
|
2152
|
-
if (se(e) &&
|
|
2153
|
-
const { granularity: s } = r, n = e.members.map((
|
|
2154
|
-
return
|
|
2227
|
+
if (se(e) && Ur(r)) {
|
|
2228
|
+
const { granularity: s } = r, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), o = Wr(t), i = Object.keys(o).length === 0 ? void 0 : o;
|
|
2229
|
+
return jr(r, n, i);
|
|
2155
2230
|
}
|
|
2156
2231
|
return e;
|
|
2157
2232
|
}
|
|
2158
|
-
function
|
|
2233
|
+
function ds(e) {
|
|
2159
2234
|
let r = [];
|
|
2160
2235
|
for (const t of e)
|
|
2161
|
-
|
|
2236
|
+
_(t) ? r = ge(t, r) : r = ge([Ke(t)], r);
|
|
2162
2237
|
return r != null ? r : [];
|
|
2163
2238
|
}
|
|
2164
|
-
const
|
|
2165
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [],
|
|
2166
|
-
return r.forEach((i,
|
|
2239
|
+
const ms = (e) => {
|
|
2240
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
|
|
2241
|
+
return r.forEach((i, a) => {
|
|
2167
2242
|
const u = {
|
|
2168
2243
|
category: "filters",
|
|
2169
|
-
index:
|
|
2244
|
+
index: a,
|
|
2170
2245
|
input: i
|
|
2171
2246
|
};
|
|
2172
2247
|
try {
|
|
2173
|
-
const
|
|
2248
|
+
const c = C({
|
|
2174
2249
|
data: i,
|
|
2175
2250
|
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
2176
2251
|
});
|
|
2177
|
-
!
|
|
2178
|
-
} catch (
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2252
|
+
!_(c) && !J(c) ? o.push(b(p({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2253
|
+
} catch (c) {
|
|
2254
|
+
const m = c instanceof Error ? c.message : "Unknown error";
|
|
2255
|
+
o.push(b(p({}, u), { message: m }));
|
|
2181
2256
|
}
|
|
2182
|
-
}),
|
|
2183
|
-
},
|
|
2257
|
+
}), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: ds(n) };
|
|
2258
|
+
}, ps = (e) => {
|
|
2184
2259
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2185
|
-
return r ?
|
|
2260
|
+
return r ? Ue(r) ? ms({
|
|
2186
2261
|
data: r,
|
|
2187
2262
|
context: { dataSource: t, schemaIndex: s }
|
|
2188
2263
|
}) : {
|
|
@@ -2196,28 +2271,28 @@ const es = (e) => {
|
|
|
2196
2271
|
}
|
|
2197
2272
|
]
|
|
2198
2273
|
} : { success: !0, data: [] };
|
|
2199
|
-
},
|
|
2200
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [],
|
|
2201
|
-
return r.forEach((i,
|
|
2274
|
+
}, ys = (e) => {
|
|
2275
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context, n = [], o = [];
|
|
2276
|
+
return r.forEach((i, a) => {
|
|
2202
2277
|
const u = {
|
|
2203
2278
|
category: "highlights",
|
|
2204
|
-
index:
|
|
2279
|
+
index: a,
|
|
2205
2280
|
input: i
|
|
2206
2281
|
};
|
|
2207
2282
|
try {
|
|
2208
|
-
const
|
|
2283
|
+
const c = C({
|
|
2209
2284
|
data: i,
|
|
2210
2285
|
context: { dataSource: t, schemaIndex: s, pathPrefix: "" }
|
|
2211
2286
|
});
|
|
2212
|
-
|
|
2213
|
-
} catch (
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2287
|
+
J(c) ? n.push(Ke(c)) : o.push(b(p({}, u), { message: "Invalid filter JSON" }));
|
|
2288
|
+
} catch (c) {
|
|
2289
|
+
const m = c instanceof Error ? c.message : "Unknown error";
|
|
2290
|
+
o.push(b(p({}, u), { message: m }));
|
|
2216
2291
|
}
|
|
2217
|
-
}),
|
|
2218
|
-
},
|
|
2292
|
+
}), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
|
|
2293
|
+
}, gs = (e) => {
|
|
2219
2294
|
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2220
|
-
return r ?
|
|
2295
|
+
return r ? Ue(r) ? ys({
|
|
2221
2296
|
data: r,
|
|
2222
2297
|
context: { dataSource: t, schemaIndex: s }
|
|
2223
2298
|
}) : {
|
|
@@ -2231,125 +2306,178 @@ const es = (e) => {
|
|
|
2231
2306
|
}
|
|
2232
2307
|
]
|
|
2233
2308
|
} : { success: !0, data: [] };
|
|
2234
|
-
},
|
|
2235
|
-
const {
|
|
2236
|
-
|
|
2309
|
+
}, hs = (e, r, t) => {
|
|
2310
|
+
const { dataSource: s, schemaIndex: n } = r;
|
|
2311
|
+
try {
|
|
2312
|
+
const o = C({
|
|
2313
|
+
data: e,
|
|
2314
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2315
|
+
});
|
|
2316
|
+
return le(o) ? { success: !0, data: o } : {
|
|
2317
|
+
success: !1,
|
|
2318
|
+
errors: [b(p({}, t), { message: "Invalid measure JSON" })]
|
|
2319
|
+
};
|
|
2320
|
+
} catch (o) {
|
|
2321
|
+
const i = o instanceof Error ? o.message : "Unknown error";
|
|
2322
|
+
return {
|
|
2323
|
+
success: !1,
|
|
2324
|
+
errors: [b(p({}, t), { message: i })]
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
}, bs = (e, r, t) => r ? Ee(r) ? { measure: e.sort(Ce(r)) } : {
|
|
2328
|
+
measure: e,
|
|
2329
|
+
error: b(p({}, t), {
|
|
2330
|
+
message: `Invalid sort type. Expected "sortAsc", "sortDesc", or "sortNone". Got: "${r}".`
|
|
2331
|
+
})
|
|
2332
|
+
} : { measure: e }, Fs = (e, r, t, s) => {
|
|
2333
|
+
const n = C({
|
|
2334
|
+
data: e.column,
|
|
2335
|
+
context: { dataSource: r, schemaIndex: t, pathPrefix: "" }
|
|
2336
|
+
});
|
|
2337
|
+
return le(n) ? bs(n, e.sortType, s) : { error: b(p({}, s), { message: "Invalid measure JSON" }) };
|
|
2338
|
+
}, ws = (e, r, t, s) => {
|
|
2339
|
+
if (Ot(e))
|
|
2340
|
+
return Fs(e, r, t, s);
|
|
2341
|
+
if (E(e)) {
|
|
2342
|
+
const n = hs(
|
|
2343
|
+
e,
|
|
2344
|
+
{ dataSource: r, schemaIndex: t },
|
|
2345
|
+
s
|
|
2346
|
+
);
|
|
2347
|
+
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2348
|
+
}
|
|
2349
|
+
return {
|
|
2350
|
+
error: b(p({}, s), {
|
|
2351
|
+
message: 'Invalid measure item. Expected a function call (function/args) or object with "column" and optional "sortType".'
|
|
2352
|
+
})
|
|
2353
|
+
};
|
|
2354
|
+
}, qs = (e) => {
|
|
2355
|
+
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2356
|
+
if (!r)
|
|
2357
|
+
return { success: !0, data: [] };
|
|
2358
|
+
if (!Array.isArray(r))
|
|
2359
|
+
return {
|
|
2360
|
+
success: !1,
|
|
2361
|
+
errors: [
|
|
2362
|
+
{
|
|
2363
|
+
category: "measures",
|
|
2364
|
+
index: -1,
|
|
2365
|
+
input: r,
|
|
2366
|
+
message: "Invalid measures JSON. Expected an array."
|
|
2367
|
+
}
|
|
2368
|
+
]
|
|
2369
|
+
};
|
|
2370
|
+
const n = [], o = [];
|
|
2371
|
+
return r.forEach((i, a) => {
|
|
2237
2372
|
const u = {
|
|
2238
2373
|
category: "measures",
|
|
2239
|
-
index:
|
|
2374
|
+
index: a,
|
|
2240
2375
|
input: i
|
|
2241
2376
|
};
|
|
2242
2377
|
try {
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
_e(l) ? n.push(l) : a.push(E(b({}, u), { message: "Invalid measure JSON" }));
|
|
2248
|
-
} catch (l) {
|
|
2249
|
-
const p = l instanceof Error ? l.message : "Unknown error";
|
|
2250
|
-
a.push(E(b({}, u), { message: p }));
|
|
2251
|
-
}
|
|
2252
|
-
}), a.length > 0 ? { success: !1, errors: a } : { success: !0, data: n };
|
|
2253
|
-
}, is = (e) => {
|
|
2254
|
-
const { data: r } = e, { dataSource: t, schemaIndex: s } = e.context;
|
|
2255
|
-
return r ? le(r) ? ns({
|
|
2256
|
-
data: r,
|
|
2257
|
-
context: { dataSource: t, schemaIndex: s }
|
|
2258
|
-
}) : {
|
|
2259
|
-
success: !1,
|
|
2260
|
-
errors: [
|
|
2261
|
-
{
|
|
2262
|
-
category: "measures",
|
|
2263
|
-
index: -1,
|
|
2264
|
-
input: r,
|
|
2265
|
-
message: 'Invalid measures JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
2378
|
+
const c = ws(i, t, s, u);
|
|
2379
|
+
if (c.error) {
|
|
2380
|
+
o.push(c.error);
|
|
2381
|
+
return;
|
|
2266
2382
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2383
|
+
c.measure && n.push(c.measure);
|
|
2384
|
+
} catch (c) {
|
|
2385
|
+
const m = c instanceof Error ? c.message : "Unknown error";
|
|
2386
|
+
o.push(b(p({}, u), { message: m }));
|
|
2387
|
+
}
|
|
2388
|
+
}), o.length > 0 ? { success: !1, errors: o } : { success: !0, data: n };
|
|
2389
|
+
}, Ps = (e) => {
|
|
2390
|
+
const { data: r } = e, { dataSource: t, tables: s } = e.context, n = It(s), o = [], i = x(
|
|
2391
|
+
() => Ut({
|
|
2272
2392
|
data: r.dimensions || [],
|
|
2273
2393
|
context: { dataSource: t, schemaIndex: n }
|
|
2274
2394
|
}),
|
|
2275
|
-
|
|
2276
|
-
),
|
|
2277
|
-
() =>
|
|
2395
|
+
o
|
|
2396
|
+
), a = x(
|
|
2397
|
+
() => qs({
|
|
2278
2398
|
data: r.measures || [],
|
|
2279
2399
|
context: { dataSource: t, schemaIndex: n }
|
|
2280
2400
|
}),
|
|
2281
|
-
|
|
2282
|
-
), u =
|
|
2283
|
-
() =>
|
|
2401
|
+
o
|
|
2402
|
+
), u = x(
|
|
2403
|
+
() => ps({
|
|
2284
2404
|
data: r.filters || [],
|
|
2285
2405
|
context: { dataSource: t, schemaIndex: n }
|
|
2286
2406
|
}),
|
|
2287
|
-
|
|
2407
|
+
o
|
|
2288
2408
|
);
|
|
2289
|
-
let
|
|
2290
|
-
return r.highlights && (
|
|
2291
|
-
() =>
|
|
2409
|
+
let c = null;
|
|
2410
|
+
return r.highlights && (c = x(
|
|
2411
|
+
() => gs({
|
|
2292
2412
|
data: r.highlights || [],
|
|
2293
2413
|
context: { dataSource: t, schemaIndex: n }
|
|
2294
2414
|
}),
|
|
2295
|
-
|
|
2296
|
-
)),
|
|
2415
|
+
o
|
|
2416
|
+
)), o.length > 0 ? {
|
|
2297
2417
|
success: !1,
|
|
2298
|
-
errors:
|
|
2418
|
+
errors: o
|
|
2299
2419
|
} : {
|
|
2300
2420
|
success: !0,
|
|
2301
|
-
data:
|
|
2302
|
-
dataSource:
|
|
2421
|
+
data: p({
|
|
2422
|
+
dataSource: Jr(t),
|
|
2303
2423
|
dimensions: i || [],
|
|
2304
|
-
measures:
|
|
2424
|
+
measures: a || [],
|
|
2305
2425
|
filters: u || []
|
|
2306
|
-
},
|
|
2426
|
+
}, c && { highlights: c })
|
|
2307
2427
|
};
|
|
2308
2428
|
};
|
|
2309
|
-
function
|
|
2429
|
+
function Es(e) {
|
|
2310
2430
|
const r = [], t = [];
|
|
2311
2431
|
return e.forEach((s, n) => {
|
|
2312
|
-
const
|
|
2432
|
+
const o = () => typeof s.toJSON == "function" ? s.toJSON() : s;
|
|
2313
2433
|
if (!s.composeCode) {
|
|
2314
2434
|
t.push({
|
|
2315
2435
|
category: "dimensions",
|
|
2316
2436
|
index: n,
|
|
2317
|
-
input:
|
|
2437
|
+
input: o(),
|
|
2318
2438
|
message: `Dimension at index ${n} (${s.name || "unnamed"}) is missing composeCode`
|
|
2319
2439
|
});
|
|
2320
2440
|
return;
|
|
2321
2441
|
}
|
|
2322
|
-
if (!s.composeCode.startsWith(
|
|
2442
|
+
if (!s.composeCode.startsWith(w)) {
|
|
2323
2443
|
t.push({
|
|
2324
2444
|
category: "dimensions",
|
|
2325
2445
|
index: n,
|
|
2326
|
-
input:
|
|
2327
|
-
message: `Expected composeCode to start with "${
|
|
2446
|
+
input: o(),
|
|
2447
|
+
message: `Expected composeCode to start with "${w}" for dimension at index ${n} (${s.name || "unnamed"}). Got: "${s.composeCode}"`
|
|
2328
2448
|
});
|
|
2329
2449
|
return;
|
|
2330
2450
|
}
|
|
2331
|
-
|
|
2451
|
+
const i = s.getSort();
|
|
2452
|
+
if (i !== void 0 && i !== ne.None) {
|
|
2453
|
+
const a = {
|
|
2454
|
+
column: s.composeCode,
|
|
2455
|
+
sortType: $e(i)
|
|
2456
|
+
};
|
|
2457
|
+
r.push(a);
|
|
2458
|
+
} else
|
|
2459
|
+
r.push(s.composeCode);
|
|
2332
2460
|
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
2333
2461
|
}
|
|
2334
|
-
function
|
|
2462
|
+
function Qe(e, r) {
|
|
2335
2463
|
const t = [];
|
|
2336
|
-
let s = "", n = 0,
|
|
2337
|
-
for (let
|
|
2338
|
-
const u = e[
|
|
2339
|
-
if (
|
|
2464
|
+
let s = "", n = 0, o = !1, i = null;
|
|
2465
|
+
for (let a = 0; a < e.length; a++) {
|
|
2466
|
+
const u = e[a], c = e[a + 1];
|
|
2467
|
+
if (o) {
|
|
2340
2468
|
if (u !== i) {
|
|
2341
2469
|
s += u;
|
|
2342
2470
|
continue;
|
|
2343
2471
|
}
|
|
2344
|
-
if (
|
|
2345
|
-
s += u +
|
|
2472
|
+
if (c === i) {
|
|
2473
|
+
s += u + c, a++;
|
|
2346
2474
|
continue;
|
|
2347
2475
|
}
|
|
2348
|
-
|
|
2476
|
+
o = !1, i = null, s += u;
|
|
2349
2477
|
continue;
|
|
2350
2478
|
} else {
|
|
2351
2479
|
if (u === "'" || u === '"') {
|
|
2352
|
-
|
|
2480
|
+
o = !0, i = u, s += u;
|
|
2353
2481
|
continue;
|
|
2354
2482
|
}
|
|
2355
2483
|
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === r && n === 0) {
|
|
@@ -2361,14 +2489,14 @@ function Ue(e, r) {
|
|
|
2361
2489
|
}
|
|
2362
2490
|
return s.trim() && t.push(s.trim()), t;
|
|
2363
2491
|
}
|
|
2364
|
-
function
|
|
2492
|
+
function Cs(e, r) {
|
|
2365
2493
|
let t = 0, s = !1, n = null;
|
|
2366
|
-
for (let
|
|
2367
|
-
const i = e[
|
|
2494
|
+
for (let o = 0; o < e.length; o++) {
|
|
2495
|
+
const i = e[o], a = e[o + 1];
|
|
2368
2496
|
if (s) {
|
|
2369
2497
|
if (i !== n) continue;
|
|
2370
|
-
if (
|
|
2371
|
-
|
|
2498
|
+
if (a === n) {
|
|
2499
|
+
o++;
|
|
2372
2500
|
continue;
|
|
2373
2501
|
}
|
|
2374
2502
|
s = !1, n = null;
|
|
@@ -2377,12 +2505,12 @@ function os(e, r) {
|
|
|
2377
2505
|
s = !0, n = i;
|
|
2378
2506
|
continue;
|
|
2379
2507
|
}
|
|
2380
|
-
if ("([{".includes(i) && t++, ")]}".includes(i) && t--, i === r && t === 0) return
|
|
2508
|
+
if ("([{".includes(i) && t++, ")]}".includes(i) && t--, i === r && t === 0) return o;
|
|
2381
2509
|
}
|
|
2382
2510
|
}
|
|
2383
2511
|
return -1;
|
|
2384
2512
|
}
|
|
2385
|
-
function
|
|
2513
|
+
function $s(e) {
|
|
2386
2514
|
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
2387
2515
|
}
|
|
2388
2516
|
function V(e) {
|
|
@@ -2394,16 +2522,16 @@ function V(e) {
|
|
|
2394
2522
|
const t = r.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
2395
2523
|
if (!t)
|
|
2396
2524
|
throw new Error(`Invalid composeCode format: expected function call, got "${r}"`);
|
|
2397
|
-
const s = t[1], n = t[2],
|
|
2525
|
+
const s = t[1], n = t[2], o = Ye(n);
|
|
2398
2526
|
return {
|
|
2399
2527
|
function: s,
|
|
2400
|
-
args:
|
|
2528
|
+
args: o
|
|
2401
2529
|
};
|
|
2402
2530
|
}
|
|
2403
|
-
function
|
|
2404
|
-
return e.trim() ?
|
|
2531
|
+
function Ye(e) {
|
|
2532
|
+
return e.trim() ? Qe(e, ",").map(He) : [];
|
|
2405
2533
|
}
|
|
2406
|
-
function
|
|
2534
|
+
function He(e) {
|
|
2407
2535
|
if (!e)
|
|
2408
2536
|
throw new Error("Cannot parse empty argument value");
|
|
2409
2537
|
if (e === "null")
|
|
@@ -2424,33 +2552,33 @@ function Ke(e) {
|
|
|
2424
2552
|
const t = e.slice(1, -1).trim();
|
|
2425
2553
|
if (!t)
|
|
2426
2554
|
return [];
|
|
2427
|
-
const s =
|
|
2555
|
+
const s = Ye(t);
|
|
2428
2556
|
return s.every((n) => typeof n == "string"), s;
|
|
2429
2557
|
}
|
|
2430
2558
|
if (e.startsWith("{") && e.endsWith("}")) {
|
|
2431
2559
|
const t = e.slice(1, -1).trim();
|
|
2432
|
-
return t ?
|
|
2560
|
+
return t ? xs(t) : {};
|
|
2433
2561
|
}
|
|
2434
2562
|
return e.includes("(") && e.includes(")") ? V(e) : (e.startsWith("DM."), e);
|
|
2435
2563
|
}
|
|
2436
|
-
function
|
|
2437
|
-
const r =
|
|
2564
|
+
function As(e) {
|
|
2565
|
+
const r = Cs(e, ":");
|
|
2438
2566
|
if (r === -1)
|
|
2439
2567
|
throw new Error(`Invalid object property: expected "key: value", got "${e}"`);
|
|
2440
|
-
const t =
|
|
2568
|
+
const t = $s(e.slice(0, r).trim()), s = He(e.slice(r + 1).trim());
|
|
2441
2569
|
return [t, s];
|
|
2442
2570
|
}
|
|
2443
|
-
function
|
|
2571
|
+
function xs(e) {
|
|
2444
2572
|
if (!e.trim()) return {};
|
|
2445
|
-
const r =
|
|
2573
|
+
const r = Qe(e, ",").map(As).filter(([, t]) => t !== null);
|
|
2446
2574
|
return Object.fromEntries(r);
|
|
2447
2575
|
}
|
|
2448
2576
|
const re = "Unknown error";
|
|
2449
|
-
function
|
|
2577
|
+
function Ds(e) {
|
|
2450
2578
|
if (!e)
|
|
2451
2579
|
return { success: !0, data: [] };
|
|
2452
2580
|
const r = [];
|
|
2453
|
-
if (
|
|
2581
|
+
if (Gr(e)) {
|
|
2454
2582
|
if (!e.composeCode)
|
|
2455
2583
|
return {
|
|
2456
2584
|
success: !1,
|
|
@@ -2492,10 +2620,10 @@ function fs(e) {
|
|
|
2492
2620
|
return;
|
|
2493
2621
|
}
|
|
2494
2622
|
try {
|
|
2495
|
-
const
|
|
2496
|
-
t.push(
|
|
2497
|
-
} catch (
|
|
2498
|
-
const i =
|
|
2623
|
+
const o = V(s.composeCode);
|
|
2624
|
+
t.push(o);
|
|
2625
|
+
} catch (o) {
|
|
2626
|
+
const i = o instanceof Error ? o.message : re;
|
|
2499
2627
|
r.push({
|
|
2500
2628
|
category: "filters",
|
|
2501
2629
|
index: n,
|
|
@@ -2505,7 +2633,7 @@ function fs(e) {
|
|
|
2505
2633
|
}
|
|
2506
2634
|
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
2507
2635
|
}
|
|
2508
|
-
function
|
|
2636
|
+
function Ms(e) {
|
|
2509
2637
|
if (!e)
|
|
2510
2638
|
return { success: !0, data: [] };
|
|
2511
2639
|
const r = [], t = [];
|
|
@@ -2520,10 +2648,10 @@ function ds(e) {
|
|
|
2520
2648
|
return;
|
|
2521
2649
|
}
|
|
2522
2650
|
try {
|
|
2523
|
-
const
|
|
2524
|
-
r.push(
|
|
2525
|
-
} catch (
|
|
2526
|
-
const i =
|
|
2651
|
+
const o = V(s.composeCode);
|
|
2652
|
+
r.push(o);
|
|
2653
|
+
} catch (o) {
|
|
2654
|
+
const i = o instanceof Error ? o.message : re;
|
|
2527
2655
|
t.push({
|
|
2528
2656
|
category: "highlights",
|
|
2529
2657
|
index: n,
|
|
@@ -2533,29 +2661,36 @@ function ds(e) {
|
|
|
2533
2661
|
}
|
|
2534
2662
|
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
2535
2663
|
}
|
|
2536
|
-
function
|
|
2664
|
+
function Ss(e) {
|
|
2537
2665
|
const r = [], t = [];
|
|
2538
2666
|
return e.forEach((s, n) => {
|
|
2539
|
-
const
|
|
2667
|
+
const o = () => typeof s.toJSON == "function" ? s.toJSON() : s;
|
|
2540
2668
|
if (!s.composeCode) {
|
|
2541
2669
|
t.push({
|
|
2542
2670
|
category: "measures",
|
|
2543
2671
|
index: n,
|
|
2544
|
-
input:
|
|
2672
|
+
input: o(),
|
|
2545
2673
|
message: `Measure at index ${n} (${s.name || "unnamed"}) is missing composeCode`
|
|
2546
2674
|
});
|
|
2547
2675
|
return;
|
|
2548
2676
|
}
|
|
2549
2677
|
try {
|
|
2550
|
-
const i = V(s.composeCode);
|
|
2551
|
-
|
|
2678
|
+
const i = V(s.composeCode), a = s.getSort();
|
|
2679
|
+
if (a !== void 0 && a !== ne.None) {
|
|
2680
|
+
const u = {
|
|
2681
|
+
column: i,
|
|
2682
|
+
sortType: $e(a)
|
|
2683
|
+
};
|
|
2684
|
+
r.push(u);
|
|
2685
|
+
} else
|
|
2686
|
+
r.push(i);
|
|
2552
2687
|
} catch (i) {
|
|
2553
|
-
const
|
|
2688
|
+
const a = i instanceof Error ? i.message : "Unknown error";
|
|
2554
2689
|
t.push({
|
|
2555
2690
|
category: "measures",
|
|
2556
2691
|
index: n,
|
|
2557
|
-
input:
|
|
2558
|
-
message: `Failed to parse composeCode for measure at index ${n} (${s.name || "unnamed"}): ${
|
|
2692
|
+
input: o(),
|
|
2693
|
+
message: `Failed to parse composeCode for measure at index ${n} (${s.name || "unnamed"}): ${a}. ComposeCode: "${s.composeCode}"`
|
|
2559
2694
|
});
|
|
2560
2695
|
}
|
|
2561
2696
|
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
@@ -2565,39 +2700,39 @@ function te(e) {
|
|
|
2565
2700
|
Object.entries(e).map(([r, t]) => [r, te(t)])
|
|
2566
2701
|
) : e;
|
|
2567
2702
|
}
|
|
2568
|
-
function
|
|
2569
|
-
const r = [], t =
|
|
2570
|
-
() =>
|
|
2703
|
+
function Bs(e) {
|
|
2704
|
+
const r = [], t = x(
|
|
2705
|
+
() => Es(e.dimensions || []),
|
|
2571
2706
|
r
|
|
2572
|
-
), s =
|
|
2573
|
-
() =>
|
|
2707
|
+
), s = x(
|
|
2708
|
+
() => Ss(e.measures || []),
|
|
2574
2709
|
r
|
|
2575
|
-
), n =
|
|
2576
|
-
() =>
|
|
2710
|
+
), n = x(
|
|
2711
|
+
() => Ds(e.filters),
|
|
2577
2712
|
r
|
|
2578
2713
|
);
|
|
2579
|
-
let
|
|
2580
|
-
if (e.highlights && e.highlights.length > 0 && (
|
|
2581
|
-
() =>
|
|
2714
|
+
let o = null;
|
|
2715
|
+
if (e.highlights && e.highlights.length > 0 && (o = x(
|
|
2716
|
+
() => Ms(e.highlights),
|
|
2582
2717
|
r
|
|
2583
2718
|
)), r.length > 0)
|
|
2584
2719
|
return {
|
|
2585
2720
|
success: !1,
|
|
2586
2721
|
errors: r
|
|
2587
2722
|
};
|
|
2588
|
-
const i =
|
|
2723
|
+
const i = p({
|
|
2589
2724
|
dimensions: t || [],
|
|
2590
2725
|
measures: s || [],
|
|
2591
2726
|
filters: n || []
|
|
2592
|
-
},
|
|
2727
|
+
}, o && { highlights: o });
|
|
2593
2728
|
return {
|
|
2594
2729
|
success: !0,
|
|
2595
2730
|
// Strip [[delimiters]] from all strings to preserve original names with spaces
|
|
2596
2731
|
data: te(i)
|
|
2597
2732
|
};
|
|
2598
2733
|
}
|
|
2599
|
-
function
|
|
2600
|
-
const { filters: r, relations: t } =
|
|
2734
|
+
function Ts(e) {
|
|
2735
|
+
const { filters: r, relations: t } = Yr(
|
|
2601
2736
|
e.filters || []
|
|
2602
2737
|
);
|
|
2603
2738
|
return {
|
|
@@ -2610,19 +2745,19 @@ function ps(e) {
|
|
|
2610
2745
|
// No count/offset/ungroup - these are execution concerns, not translation concerns
|
|
2611
2746
|
};
|
|
2612
2747
|
}
|
|
2613
|
-
function
|
|
2614
|
-
const s =
|
|
2615
|
-
return
|
|
2748
|
+
function ks(e, r, t = !1) {
|
|
2749
|
+
const s = Ts(e), n = Kr(s, r);
|
|
2750
|
+
return Qr(n, t);
|
|
2616
2751
|
}
|
|
2617
2752
|
export {
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2753
|
+
zs as CustomSuperJSON,
|
|
2754
|
+
_s as EMPTY_EXPANDED_QUERY_MODEL,
|
|
2755
|
+
Us as EMPTY_SIMPLE_QUERY_MODEL,
|
|
2756
|
+
Ws as isByIdDashboardCodeParams,
|
|
2757
|
+
js as isByIdWidgetCodeParams,
|
|
2758
|
+
Js as isClientSideDashboardCodeParams,
|
|
2759
|
+
Gs as isClientSideWidgetCodeParams,
|
|
2760
|
+
Ps as translateQueryFromJSON,
|
|
2761
|
+
Bs as translateQueryToJSON,
|
|
2762
|
+
ks as translateQueryToJaql
|
|
2628
2763
|
};
|