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