@sisense/sdk-ui 2.9.0 → 2.10.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 +31 -31
- package/dist/ai.js +27 -27
- package/dist/analytics-composer/node.cjs +3 -1
- package/dist/analytics-composer/node.js +514 -378
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +6 -6
- package/dist/derive-chart-family-B1on_xkS.cjs +170 -0
- package/dist/derive-chart-family-BllGhqsW.js +29469 -0
- package/dist/{dimensions-CVJeJ8mi.cjs → dimensions-BYqdB-Q8.cjs} +1 -1
- package/dist/{dimensions-B2jz151s.js → dimensions-D-Z9sitz.js} +1 -1
- package/dist/execute-query-CABqVn7C.cjs +1 -0
- package/dist/{execute-query-agpyzZz6.js → execute-query-CGLL9vXX.js} +269 -247
- package/dist/index.cjs +25 -26
- package/dist/index.js +7945 -7469
- package/dist/index.umd.js +383 -374
- package/dist/packages/sdk-ui/src/analytics-composer/new-nlq-translator/common.d.ts +14 -0
- package/dist/packages/sdk-ui/src/analytics-composer/new-nlq-translator/translate-dimensions.d.ts +2 -2
- package/dist/packages/sdk-ui/src/analytics-composer/new-nlq-translator/translate-filters.d.ts +5 -5
- package/dist/packages/sdk-ui/src/analytics-composer/new-nlq-translator/translate-measures.d.ts +3 -3
- package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +12 -0
- package/dist/packages/sdk-ui/src/calendar-heatmap-chart.d.ts +12 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/calendar-heatmap-chart-builder.d.ts +8 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/constants.d.ts +87 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/data-options/data-options.d.ts +54 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/data-options/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/data.d.ts +33 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/design-options.d.ts +22 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/highcharts-options-builder.d.ts +8 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/axes-options.d.ts +12 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/chart-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/extras-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/index.d.ts +7 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/legend-options.d.ts +8 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/plot-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/series-options/calendar-data-generator.d.ts +35 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/series-options/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/series-options/series-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/highchart-options-builder/options/tooltip-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/calendar-heatmap-charts-grid.d.ts +26 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/calendar-heatmap.d.ts +17 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/calendar-pagination/calendar-pagination.d.ts +30 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/calendar-pagination/helpers.d.ts +3 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/calendar-pagination/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/helpers/data-helpers.d.ts +4 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/helpers/sizing-helpers.d.ts +25 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/helpers/view-helpers.d.ts +14 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/hooks/index.d.ts +4 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/hooks/use-calendar-heatmap-chart-options.d.ts +55 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/hooks/use-calendar-heatmap-navigation.d.ts +33 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/renderer/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/calendar-heatmap-chart/types.d.ts +13 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/data-options.d.ts +5 -1
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/cartesians/helpers/highchart-options/legend.d.ts +3 -2
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/helpers/data-options.d.ts +22 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/helpers/data.d.ts +13 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/alerts/index.d.ts +5 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/data/index.d.ts +15 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/data-options/index.d.ts +32 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/design-options/index.d.ts +17 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/highchart-options/highcharts-options-builder.d.ts +2 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/pie-chart-builder.d.ts +2 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/categoricals/pie-chart/types.d.ts +12 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/highcharts-based-chart-renderer/highcharts-based-chart-renderer.d.ts +2 -4
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/highcharts-based-chart-renderer/use-extra-config.d.ts +2 -0
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/chart/restructured-charts/types.d.ts +10 -9
- package/dist/packages/sdk-ui/src/chart-data/types.d.ts +2 -1
- package/dist/packages/sdk-ui/src/chart-data-options/translate-data-options.d.ts +2 -1
- package/dist/packages/sdk-ui/src/chart-data-options/types.d.ts +19 -2
- package/dist/packages/sdk-ui/src/chart-data-options/utils.d.ts +4 -4
- package/dist/packages/sdk-ui/src/chart-data-options/validate-data-options/validate-categorical-data-options.d.ts +14 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/cartesian/utils/series-processor.d.ts +4 -1
- package/dist/packages/sdk-ui/src/chart-options-processor/{category-chart-options.d.ts → category-chart-options/category-chart-options.d.ts} +9 -5
- package/dist/packages/sdk-ui/src/chart-options-processor/category-chart-options/funnel-chart-options.d.ts +15 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/category-chart-options/pie-chart-options.d.ts +15 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/category-chart-options/sunburst-chart-options.d.ts +17 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/category-chart-options/treemap-chart-options.d.ts +17 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/chart-options-service.d.ts +26 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/scatter-chart-options.d.ts +3 -3
- package/dist/packages/sdk-ui/src/chart-options-processor/style-to-design-options-translator/translate-to-highcharts-options.d.ts +1 -3
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/axis-section.d.ts +6 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/design-options.d.ts +18 -4
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/legend-section.d.ts +28 -14
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/pie-series.d.ts +34 -6
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/tooltip-utils.d.ts +5 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/translations-to-highcharts.d.ts +1 -1
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/types.d.ts +50 -6
- package/dist/packages/sdk-ui/src/common/formatters/create-date-formatter.d.ts +10 -0
- package/dist/packages/sdk-ui/src/common/hooks/useDateFormatter.d.ts +7 -0
- package/dist/packages/sdk-ui/src/common/icons/double-arrow-end-icon.d.ts +6 -0
- package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +0 -19
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-filters.d.ts +12 -1
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-formatters.d.ts +18 -0
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-handlers.d.ts +23 -0
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-widget-transforms.d.ts +29 -0
- package/dist/packages/sdk-ui/src/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +1 -0
- package/dist/packages/sdk-ui/src/pivot-table/formatters/header-cell-formatters/header-cell-value-formatter.d.ts +2 -1
- package/dist/packages/sdk-ui/src/pivot-table/formatters/types.d.ts +0 -1
- package/dist/packages/sdk-ui/src/polar-chart.d.ts +1 -1
- package/dist/packages/sdk-ui/src/props.d.ts +72 -7
- package/dist/packages/sdk-ui/src/sisense-chart/types.d.ts +2 -2
- package/dist/packages/sdk-ui/src/theme-provider/default-theme-settings.d.ts +1 -0
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +11 -0
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +22 -0
- package/dist/packages/sdk-ui/src/types.d.ts +254 -16
- package/dist/packages/sdk-ui/src/utils/combine-handlers.d.ts +19 -0
- package/dist/packages/sdk-ui/src/utils/utility-types/transformer.d.ts +8 -0
- package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +4 -6
- package/dist/{types-BYUVZb6u.js → types-BRtWk8uC.js} +1 -1
- package/dist/{types-QUSMO7gF.cjs → types-Ds0KtTJF.cjs} +1 -1
- package/dist/use-common-filters-D8tEa9zb.js +91245 -0
- package/dist/use-common-filters-hw1WKPCY.cjs +844 -0
- package/dist/{widget-composer-CGp5yOny.cjs → widget-composer-B7zeAa_D.cjs} +1 -1
- package/dist/{widget-composer-BG4HonVl.js → widget-composer-DL0xPtlC.js} +3 -3
- package/package.json +9 -9
- package/dist/derive-chart-family-BLG1sO1D.js +0 -86946
- package/dist/derive-chart-family-QPmz5DJ3.cjs +0 -656
- package/dist/execute-query-Cp3se7Yb.cjs +0 -1
- package/dist/packages/sdk-ui/src/utils/__development-utils__/highcharts-options-builder-collector.d.ts +0 -61
- package/dist/packages/sdk-ui/src/utils/__development-utils__/input-output-collector.d.ts +0 -125
- package/dist/use-common-filters-DmdADAhl.cjs +0 -350
- package/dist/use-common-filters-wo5IRF5u.js +0 -31972
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Ie = Object.defineProperty, Te = Object.defineProperties;
|
|
2
|
+
var Me = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var X = Object.getOwnPropertySymbols;
|
|
4
|
+
var ke = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Z = (e, t, r) => t in e ? Ie(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
|
+
ke.call(t, r) && Z(e, r, t[r]);
|
|
8
|
+
if (X)
|
|
9
|
+
for (var r of X(t))
|
|
10
|
+
Ne.call(t, r) && Z(e, r, t[r]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
import { f as
|
|
14
|
-
import { b as
|
|
15
|
-
import { bU as Se, bV as
|
|
16
|
-
import { i as Dt, b as
|
|
17
|
-
class
|
|
12
|
+
}, T = (e, t) => Te(e, Me(t));
|
|
13
|
+
import { f as Pe, J as Oe } from "../types-BRtWk8uC.js";
|
|
14
|
+
import { b as Mr, E as kr, a as Nr, i as Pr, e as Or, d as Sr } from "../types-BRtWk8uC.js";
|
|
15
|
+
import { bU as Se, bV as Le, bW as _e, bX as xe, bY as Ve, at as ne, bZ as Be, as as Ue, b_ as Ke, b5 as Qe, au as qe, b8 as He, b6 as Ye, aH as We, b4 as Xe, b7 as Ze, e as je, d as Ge, l as Je, b$ as ve, c0 as et, c1 as tt, c2 as rt, c3 as st, c4 as nt, c5 as it, c6 as at, c7 as ot, c8 as lt, ao as ct, c9 as ut, ca as ft, S as mt, i as dt, cb as ie, c as ae, cc as pt, cd as gt, ce as yt, aD as bt, ah as j, ar as ht, cf as wt, v as At, u as Et } from "../execute-query-CGLL9vXX.js";
|
|
16
|
+
import { i as Dt, b as zt, D as Ft, d as Ct } from "../dimensions-D-Z9sitz.js";
|
|
17
|
+
class Rt {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
|
|
20
20
|
}
|
|
@@ -31,9 +31,9 @@ class Ct {
|
|
|
31
31
|
this.keyToValue.clear(), this.valueToKey.clear();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class oe {
|
|
35
35
|
constructor(t) {
|
|
36
|
-
this.generateIdentifier = t, this.kv = new
|
|
36
|
+
this.generateIdentifier = t, this.kv = new Rt();
|
|
37
37
|
}
|
|
38
38
|
register(t, r) {
|
|
39
39
|
this.kv.getByValue(t) || (r || (r = this.generateIdentifier(t)), this.kv.set(r, t));
|
|
@@ -48,7 +48,7 @@ class ie {
|
|
|
48
48
|
return this.kv.getByKey(t);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class $t extends oe {
|
|
52
52
|
constructor() {
|
|
53
53
|
super((t) => t.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
54
54
|
}
|
|
@@ -67,21 +67,21 @@ function It(e) {
|
|
|
67
67
|
e.hasOwnProperty(r) && t.push(e[r]);
|
|
68
68
|
return t;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Tt(e, t) {
|
|
71
71
|
const r = It(e);
|
|
72
72
|
if ("find" in r)
|
|
73
73
|
return r.find(t);
|
|
74
74
|
const s = r;
|
|
75
|
-
for (let
|
|
76
|
-
const
|
|
77
|
-
if (t(
|
|
78
|
-
return
|
|
75
|
+
for (let n = 0; n < s.length; n++) {
|
|
76
|
+
const i = s[n];
|
|
77
|
+
if (t(i))
|
|
78
|
+
return i;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function E(e, t) {
|
|
82
82
|
Object.entries(e).forEach(([r, s]) => t(s, r));
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function M(e, t) {
|
|
85
85
|
return e.indexOf(t) !== -1;
|
|
86
86
|
}
|
|
87
87
|
function G(e, t) {
|
|
@@ -91,7 +91,7 @@ function G(e, t) {
|
|
|
91
91
|
return s;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class Mt {
|
|
95
95
|
constructor() {
|
|
96
96
|
this.transfomers = {};
|
|
97
97
|
}
|
|
@@ -99,26 +99,26 @@ class Tt {
|
|
|
99
99
|
this.transfomers[t.name] = t;
|
|
100
100
|
}
|
|
101
101
|
findApplicable(t) {
|
|
102
|
-
return
|
|
102
|
+
return Tt(this.transfomers, (r) => r.isApplicable(t));
|
|
103
103
|
}
|
|
104
104
|
findByName(t) {
|
|
105
105
|
return this.transfomers[t];
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const kt = (e) => Object.prototype.toString.call(e).slice(8, -1), le = (e) => typeof e == "undefined", Nt = (e) => e === null, C = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, O = (e) => C(e) && Object.keys(e).length === 0, g = (e) => Array.isArray(e), Pt = (e) => typeof e == "string", Ot = (e) => typeof e == "number" && !isNaN(e), St = (e) => typeof e == "boolean", Lt = (e) => e instanceof RegExp, R = (e) => e instanceof Map, $ = (e) => e instanceof Set, ce = (e) => kt(e) === "Symbol", _t = (e) => e instanceof Date && !isNaN(e.valueOf()), xt = (e) => e instanceof Error, J = (e) => typeof e == "number" && isNaN(e), Vt = (e) => St(e) || Nt(e) || le(e) || Ot(e) || Pt(e) || ce(e), Bt = (e) => typeof e == "bigint", Ut = (e) => e === 1 / 0 || e === -1 / 0, Kt = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Qt = (e) => e instanceof URL, ue = (e) => e.replace(/\./g, "\\."), P = (e) => e.map(String).map(ue).join("."), F = (e) => {
|
|
109
109
|
const t = [];
|
|
110
110
|
let r = "";
|
|
111
|
-
for (let
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
114
|
-
r += ".",
|
|
111
|
+
for (let n = 0; n < e.length; n++) {
|
|
112
|
+
let i = e.charAt(n);
|
|
113
|
+
if (i === "\\" && e.charAt(n + 1) === ".") {
|
|
114
|
+
r += ".", n++;
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
117
|
+
if (i === ".") {
|
|
118
118
|
t.push(r), r = "";
|
|
119
119
|
continue;
|
|
120
120
|
}
|
|
121
|
-
r +=
|
|
121
|
+
r += i;
|
|
122
122
|
}
|
|
123
123
|
const s = r;
|
|
124
124
|
return t.push(s), t;
|
|
@@ -131,11 +131,11 @@ function d(e, t, r, s) {
|
|
|
131
131
|
untransform: s
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
d(
|
|
134
|
+
const fe = [
|
|
135
|
+
d(le, "undefined", () => null, () => {
|
|
136
136
|
}),
|
|
137
137
|
d(Bt, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
138
|
-
d(
|
|
138
|
+
d(_t, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
139
139
|
d(xt, "Error", (e, t) => {
|
|
140
140
|
const r = {
|
|
141
141
|
name: e.name,
|
|
@@ -150,24 +150,24 @@ const le = [
|
|
|
150
150
|
r[s] = e[s];
|
|
151
151
|
}), r;
|
|
152
152
|
}),
|
|
153
|
-
d(
|
|
153
|
+
d(Lt, "regexp", (e) => "" + e, (e) => {
|
|
154
154
|
const t = e.slice(1, e.lastIndexOf("/")), r = e.slice(e.lastIndexOf("/") + 1);
|
|
155
155
|
return new RegExp(t, r);
|
|
156
156
|
}),
|
|
157
157
|
d(
|
|
158
|
-
|
|
158
|
+
$,
|
|
159
159
|
"set",
|
|
160
160
|
// (sets only exist in es6+)
|
|
161
161
|
// eslint-disable-next-line es5/no-es6-methods
|
|
162
162
|
(e) => [...e.values()],
|
|
163
163
|
(e) => new Set(e)
|
|
164
164
|
),
|
|
165
|
-
d(
|
|
166
|
-
d((e) =>
|
|
165
|
+
d(R, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
166
|
+
d((e) => J(e) || Ut(e), "number", (e) => J(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
167
167
|
d((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
168
|
-
d(
|
|
168
|
+
d(Qt, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
169
169
|
];
|
|
170
|
-
function
|
|
170
|
+
function k(e, t, r, s) {
|
|
171
171
|
return {
|
|
172
172
|
isApplicable: e,
|
|
173
173
|
annotation: t,
|
|
@@ -175,12 +175,12 @@ function M(e, t, r, s) {
|
|
|
175
175
|
untransform: s
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const me = k((e, t) => ce(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, r) => {
|
|
179
179
|
const s = r.symbolRegistry.getValue(t[1]);
|
|
180
180
|
if (!s)
|
|
181
181
|
throw new Error("Trying to deserialize unknown symbol");
|
|
182
182
|
return s;
|
|
183
|
-
}),
|
|
183
|
+
}), qt = [
|
|
184
184
|
Int8Array,
|
|
185
185
|
Uint8Array,
|
|
186
186
|
Int16Array,
|
|
@@ -190,71 +190,71 @@ const ce = M((e, t) => ae(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t)
|
|
|
190
190
|
Float32Array,
|
|
191
191
|
Float64Array,
|
|
192
192
|
Uint8ClampedArray
|
|
193
|
-
].reduce((e, t) => (e[t.name] = t, e), {}),
|
|
194
|
-
const r =
|
|
193
|
+
].reduce((e, t) => (e[t.name] = t, e), {}), de = k(Kt, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
194
|
+
const r = qt[t[1]];
|
|
195
195
|
if (!r)
|
|
196
196
|
throw new Error("Trying to deserialize unknown typed array");
|
|
197
197
|
return new r(e);
|
|
198
198
|
});
|
|
199
|
-
function
|
|
199
|
+
function pe(e, t) {
|
|
200
200
|
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
202
|
+
const ge = k(pe, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
203
203
|
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
204
204
|
if (!r)
|
|
205
205
|
return y({}, e);
|
|
206
206
|
const s = {};
|
|
207
|
-
return r.forEach((
|
|
208
|
-
s[
|
|
207
|
+
return r.forEach((n) => {
|
|
208
|
+
s[n] = e[n];
|
|
209
209
|
}), s;
|
|
210
210
|
}, (e, t, r) => {
|
|
211
211
|
const s = r.classRegistry.getValue(t[1]);
|
|
212
212
|
if (!s)
|
|
213
213
|
throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
214
214
|
return Object.assign(Object.create(s.prototype), e);
|
|
215
|
-
}),
|
|
215
|
+
}), ye = k((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) => {
|
|
216
216
|
const s = r.customTransformerRegistry.findByName(t[1]);
|
|
217
217
|
if (!s)
|
|
218
218
|
throw new Error("Trying to deserialize unknown custom value");
|
|
219
219
|
return s.deserialize(e);
|
|
220
|
-
}),
|
|
221
|
-
const r = G(
|
|
220
|
+
}), Ht = [ge, me, ye, de], v = (e, t) => {
|
|
221
|
+
const r = G(Ht, (n) => n.isApplicable(e, t));
|
|
222
222
|
if (r)
|
|
223
223
|
return {
|
|
224
224
|
value: r.transform(e, t),
|
|
225
225
|
type: r.annotation(e, t)
|
|
226
226
|
};
|
|
227
|
-
const s = G(
|
|
227
|
+
const s = G(fe, (n) => n.isApplicable(e, t));
|
|
228
228
|
if (s)
|
|
229
229
|
return {
|
|
230
230
|
value: s.transform(e, t),
|
|
231
231
|
type: s.annotation
|
|
232
232
|
};
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
}, be = {};
|
|
234
|
+
fe.forEach((e) => {
|
|
235
|
+
be[e.annotation] = e;
|
|
236
236
|
});
|
|
237
237
|
const Yt = (e, t, r) => {
|
|
238
238
|
if (g(t))
|
|
239
239
|
switch (t[0]) {
|
|
240
240
|
case "symbol":
|
|
241
|
-
return ce.untransform(e, t, r);
|
|
242
|
-
case "class":
|
|
243
241
|
return me.untransform(e, t, r);
|
|
242
|
+
case "class":
|
|
243
|
+
return ge.untransform(e, t, r);
|
|
244
244
|
case "custom":
|
|
245
|
-
return
|
|
245
|
+
return ye.untransform(e, t, r);
|
|
246
246
|
case "typed-array":
|
|
247
|
-
return
|
|
247
|
+
return de.untransform(e, t, r);
|
|
248
248
|
default:
|
|
249
249
|
throw new Error("Unknown transformation: " + t);
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
|
-
const s =
|
|
252
|
+
const s = be[t];
|
|
253
253
|
if (!s)
|
|
254
254
|
throw new Error("Unknown transformation: " + t);
|
|
255
255
|
return s.untransform(e, r);
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, w = (e, t) => {
|
|
258
258
|
if (t > e.size)
|
|
259
259
|
throw new Error("index out of bounds");
|
|
260
260
|
const r = e.keys();
|
|
@@ -262,234 +262,234 @@ const Yt = (e, t, r) => {
|
|
|
262
262
|
r.next(), t--;
|
|
263
263
|
return r.next().value;
|
|
264
264
|
};
|
|
265
|
-
function
|
|
266
|
-
if (
|
|
265
|
+
function he(e) {
|
|
266
|
+
if (M(e, "__proto__"))
|
|
267
267
|
throw new Error("__proto__ is not allowed as a property");
|
|
268
|
-
if (
|
|
268
|
+
if (M(e, "prototype"))
|
|
269
269
|
throw new Error("prototype is not allowed as a property");
|
|
270
|
-
if (
|
|
270
|
+
if (M(e, "constructor"))
|
|
271
271
|
throw new Error("constructor is not allowed as a property");
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
273
|
+
const Wt = (e, t) => {
|
|
274
|
+
he(t);
|
|
275
275
|
for (let r = 0; r < t.length; r++) {
|
|
276
276
|
const s = t[r];
|
|
277
|
-
if (
|
|
278
|
-
e =
|
|
279
|
-
else if (
|
|
280
|
-
const
|
|
281
|
-
switch (
|
|
277
|
+
if ($(e))
|
|
278
|
+
e = w(e, +s);
|
|
279
|
+
else if (R(e)) {
|
|
280
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", a = w(e, n);
|
|
281
|
+
switch (i) {
|
|
282
282
|
case "key":
|
|
283
|
-
e =
|
|
283
|
+
e = a;
|
|
284
284
|
break;
|
|
285
285
|
case "value":
|
|
286
|
-
e = e.get(
|
|
286
|
+
e = e.get(a);
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
} else
|
|
290
290
|
e = e[s];
|
|
291
291
|
}
|
|
292
292
|
return e;
|
|
293
|
-
},
|
|
294
|
-
if (
|
|
293
|
+
}, S = (e, t, r) => {
|
|
294
|
+
if (he(t), t.length === 0)
|
|
295
295
|
return r(e);
|
|
296
296
|
let s = e;
|
|
297
|
-
for (let
|
|
298
|
-
const
|
|
297
|
+
for (let i = 0; i < t.length - 1; i++) {
|
|
298
|
+
const a = t[i];
|
|
299
299
|
if (g(s)) {
|
|
300
|
-
const
|
|
301
|
-
s = s[l];
|
|
302
|
-
} else if (F(s))
|
|
300
|
+
const o = +a;
|
|
303
301
|
s = s[o];
|
|
304
|
-
else if (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
302
|
+
} else if (C(s))
|
|
303
|
+
s = s[a];
|
|
304
|
+
else if ($(s)) {
|
|
305
|
+
const o = +a;
|
|
306
|
+
s = w(s, o);
|
|
307
|
+
} else if (R(s)) {
|
|
308
|
+
if (i === t.length - 2)
|
|
309
309
|
break;
|
|
310
|
-
const
|
|
310
|
+
const c = +a, I = +t[++i] == 0 ? "key" : "value", h = w(s, c);
|
|
311
311
|
switch (I) {
|
|
312
312
|
case "key":
|
|
313
|
-
s =
|
|
313
|
+
s = h;
|
|
314
314
|
break;
|
|
315
315
|
case "value":
|
|
316
|
-
s = s.get(
|
|
316
|
+
s = s.get(h);
|
|
317
317
|
break;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
if (g(s) ? s[+
|
|
323
|
-
const
|
|
324
|
-
|
|
321
|
+
const n = t[t.length - 1];
|
|
322
|
+
if (g(s) ? s[+n] = r(s[+n]) : C(s) && (s[n] = r(s[n])), $(s)) {
|
|
323
|
+
const i = w(s, +n), a = r(i);
|
|
324
|
+
i !== a && (s.delete(i), s.add(a));
|
|
325
325
|
}
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
328
|
-
switch (+
|
|
326
|
+
if (R(s)) {
|
|
327
|
+
const i = +t[t.length - 2], a = w(s, i);
|
|
328
|
+
switch (+n == 0 ? "key" : "value") {
|
|
329
329
|
case "key": {
|
|
330
|
-
const
|
|
331
|
-
s.set(
|
|
330
|
+
const c = r(a);
|
|
331
|
+
s.set(c, s.get(a)), c !== a && s.delete(a);
|
|
332
332
|
break;
|
|
333
333
|
}
|
|
334
334
|
case "value": {
|
|
335
|
-
s.set(
|
|
335
|
+
s.set(a, r(s.get(a)));
|
|
336
336
|
break;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
return e;
|
|
341
341
|
};
|
|
342
|
-
function
|
|
342
|
+
function L(e, t, r = []) {
|
|
343
343
|
if (!e)
|
|
344
344
|
return;
|
|
345
345
|
if (!g(e)) {
|
|
346
|
-
|
|
346
|
+
E(e, (i, a) => L(i, t, [...r, ...F(a)]));
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
const [s,
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
const [s, n] = e;
|
|
350
|
+
n && E(n, (i, a) => {
|
|
351
|
+
L(i, t, [...r, ...F(a)]);
|
|
352
352
|
}), t(s, r);
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
return
|
|
356
|
-
e =
|
|
354
|
+
function Xt(e, t, r) {
|
|
355
|
+
return L(t, (s, n) => {
|
|
356
|
+
e = S(e, n, (i) => Yt(i, s, r));
|
|
357
357
|
}), e;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
function r(s,
|
|
361
|
-
const
|
|
362
|
-
s.map(
|
|
363
|
-
e =
|
|
359
|
+
function Zt(e, t) {
|
|
360
|
+
function r(s, n) {
|
|
361
|
+
const i = Wt(e, F(n));
|
|
362
|
+
s.map(F).forEach((a) => {
|
|
363
|
+
e = S(e, a, () => i);
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
if (g(t)) {
|
|
367
|
-
const [s,
|
|
368
|
-
s.forEach((
|
|
369
|
-
e =
|
|
370
|
-
}),
|
|
367
|
+
const [s, n] = t;
|
|
368
|
+
s.forEach((i) => {
|
|
369
|
+
e = S(e, F(i), () => e);
|
|
370
|
+
}), n && E(n, r);
|
|
371
371
|
} else
|
|
372
|
-
|
|
372
|
+
E(t, r);
|
|
373
373
|
return e;
|
|
374
374
|
}
|
|
375
|
-
const
|
|
375
|
+
const jt = (e, t) => C(e) || g(e) || R(e) || $(e) || pe(e, t);
|
|
376
376
|
function Gt(e, t, r) {
|
|
377
377
|
const s = r.get(e);
|
|
378
378
|
s ? s.push(t) : r.set(e, [t]);
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Jt(e, t) {
|
|
381
381
|
const r = {};
|
|
382
382
|
let s;
|
|
383
|
-
return e.forEach((
|
|
384
|
-
if (
|
|
383
|
+
return e.forEach((n) => {
|
|
384
|
+
if (n.length <= 1)
|
|
385
385
|
return;
|
|
386
|
-
t || (
|
|
387
|
-
const [
|
|
388
|
-
|
|
389
|
-
}), s ?
|
|
390
|
-
}
|
|
391
|
-
const
|
|
392
|
-
var
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
Gt(e,
|
|
396
|
-
const p =
|
|
386
|
+
t || (n = n.map((o) => o.map(String)).sort((o, c) => o.length - c.length));
|
|
387
|
+
const [i, ...a] = n;
|
|
388
|
+
i.length === 0 ? s = a.map(P) : r[P(i)] = a.map(P);
|
|
389
|
+
}), s ? O(r) ? [s] : [s, r] : O(r) ? void 0 : r;
|
|
390
|
+
}
|
|
391
|
+
const we = (e, t, r, s, n = [], i = [], a = /* @__PURE__ */ new Map()) => {
|
|
392
|
+
var W;
|
|
393
|
+
const o = Vt(e);
|
|
394
|
+
if (!o) {
|
|
395
|
+
Gt(e, n, t);
|
|
396
|
+
const p = a.get(e);
|
|
397
397
|
if (p)
|
|
398
398
|
return s ? {
|
|
399
399
|
transformedValue: null
|
|
400
400
|
} : p;
|
|
401
401
|
}
|
|
402
|
-
if (!
|
|
403
|
-
const p =
|
|
402
|
+
if (!jt(e, r)) {
|
|
403
|
+
const p = v(e, r), m = p ? {
|
|
404
404
|
transformedValue: p.value,
|
|
405
405
|
annotations: [p.type]
|
|
406
406
|
} : {
|
|
407
407
|
transformedValue: e
|
|
408
408
|
};
|
|
409
|
-
return
|
|
409
|
+
return o || a.set(e, m), m;
|
|
410
410
|
}
|
|
411
|
-
if (
|
|
411
|
+
if (M(i, e))
|
|
412
412
|
return {
|
|
413
413
|
transformedValue: null
|
|
414
414
|
};
|
|
415
|
-
const
|
|
416
|
-
|
|
415
|
+
const c = v(e, r), I = (W = c == null ? void 0 : c.value) != null ? W : e, h = g(I) ? [] : {}, D = {};
|
|
416
|
+
E(I, (p, m) => {
|
|
417
417
|
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
418
418
|
throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
D[
|
|
419
|
+
const z = we(p, t, r, s, [...n, m], [...i, e], a);
|
|
420
|
+
h[m] = z.transformedValue, g(z.annotations) ? D[m] = z.annotations : C(z.annotations) && E(z.annotations, (Re, $e) => {
|
|
421
|
+
D[ue(m) + "." + $e] = Re;
|
|
422
422
|
});
|
|
423
423
|
});
|
|
424
|
-
const Y =
|
|
425
|
-
transformedValue:
|
|
426
|
-
annotations:
|
|
424
|
+
const Y = O(D) ? {
|
|
425
|
+
transformedValue: h,
|
|
426
|
+
annotations: c ? [c.type] : void 0
|
|
427
427
|
} : {
|
|
428
|
-
transformedValue:
|
|
429
|
-
annotations:
|
|
428
|
+
transformedValue: h,
|
|
429
|
+
annotations: c ? [c.type, D] : D
|
|
430
430
|
};
|
|
431
|
-
return
|
|
431
|
+
return o || a.set(e, Y), Y;
|
|
432
432
|
};
|
|
433
|
-
function
|
|
433
|
+
function Ae(e) {
|
|
434
434
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
436
|
+
function ee(e) {
|
|
437
|
+
return Ae(e) === "Array";
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
if (
|
|
439
|
+
function vt(e) {
|
|
440
|
+
if (Ae(e) !== "Object")
|
|
441
441
|
return !1;
|
|
442
442
|
const t = Object.getPrototypeOf(e);
|
|
443
443
|
return !!t && t.constructor === Object && t === Object.prototype;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
const
|
|
447
|
-
|
|
445
|
+
function er(e, t, r, s, n) {
|
|
446
|
+
const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
|
|
447
|
+
i === "enumerable" && (e[t] = r), n && i === "nonenumerable" && Object.defineProperty(e, t, {
|
|
448
448
|
value: r,
|
|
449
449
|
enumerable: !1,
|
|
450
450
|
writable: !0,
|
|
451
451
|
configurable: !0
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
|
-
function
|
|
455
|
-
if (
|
|
456
|
-
return e.map((
|
|
457
|
-
if (!
|
|
454
|
+
function _(e, t = {}) {
|
|
455
|
+
if (ee(e))
|
|
456
|
+
return e.map((n) => _(n, t));
|
|
457
|
+
if (!vt(e))
|
|
458
458
|
return e;
|
|
459
459
|
const r = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
|
|
460
|
-
return [...r, ...s].reduce((
|
|
461
|
-
if (
|
|
462
|
-
return
|
|
463
|
-
const
|
|
464
|
-
return
|
|
460
|
+
return [...r, ...s].reduce((n, i) => {
|
|
461
|
+
if (ee(t.props) && !t.props.includes(i))
|
|
462
|
+
return n;
|
|
463
|
+
const a = e[i], o = _(a, t);
|
|
464
|
+
return er(n, i, o, e, t.nonenumerable), n;
|
|
465
465
|
}, {});
|
|
466
466
|
}
|
|
467
|
-
class
|
|
467
|
+
class l {
|
|
468
468
|
/**
|
|
469
469
|
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
470
470
|
*/
|
|
471
471
|
constructor({ dedupe: t = !1 } = {}) {
|
|
472
|
-
this.classRegistry = new
|
|
472
|
+
this.classRegistry = new $t(), this.symbolRegistry = new oe((r) => {
|
|
473
473
|
var s;
|
|
474
474
|
return (s = r.description) != null ? s : "";
|
|
475
|
-
}), this.customTransformerRegistry = new
|
|
475
|
+
}), this.customTransformerRegistry = new Mt(), this.allowedErrorProps = [], this.dedupe = t;
|
|
476
476
|
}
|
|
477
477
|
serialize(t) {
|
|
478
|
-
const r = /* @__PURE__ */ new Map(), s =
|
|
478
|
+
const r = /* @__PURE__ */ new Map(), s = we(t, r, this, this.dedupe), n = {
|
|
479
479
|
json: s.transformedValue
|
|
480
480
|
};
|
|
481
|
-
s.annotations && (
|
|
481
|
+
s.annotations && (n.meta = T(y({}, n.meta), {
|
|
482
482
|
values: s.annotations
|
|
483
483
|
}));
|
|
484
|
-
const
|
|
485
|
-
return
|
|
486
|
-
referentialEqualities:
|
|
487
|
-
})),
|
|
484
|
+
const i = Jt(r, this.dedupe);
|
|
485
|
+
return i && (n.meta = T(y({}, n.meta), {
|
|
486
|
+
referentialEqualities: i
|
|
487
|
+
})), n;
|
|
488
488
|
}
|
|
489
489
|
deserialize(t) {
|
|
490
490
|
const { json: r, meta: s } = t;
|
|
491
|
-
let
|
|
492
|
-
return s != null && s.values && (
|
|
491
|
+
let n = _(r);
|
|
492
|
+
return s != null && s.values && (n = Xt(n, s.values, this)), s != null && s.referentialEqualities && (n = Zt(n, s.referentialEqualities)), n;
|
|
493
493
|
}
|
|
494
494
|
stringify(t) {
|
|
495
495
|
return JSON.stringify(this.serialize(t));
|
|
@@ -512,16 +512,16 @@ class a {
|
|
|
512
512
|
this.allowedErrorProps.push(...t);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const b = (e) => e === void 0 ?
|
|
515
|
+
l.defaultInstance = new l();
|
|
516
|
+
l.serialize = l.defaultInstance.serialize.bind(l.defaultInstance);
|
|
517
|
+
l.deserialize = l.defaultInstance.deserialize.bind(l.defaultInstance);
|
|
518
|
+
l.stringify = l.defaultInstance.stringify.bind(l.defaultInstance);
|
|
519
|
+
l.parse = l.defaultInstance.parse.bind(l.defaultInstance);
|
|
520
|
+
l.registerClass = l.defaultInstance.registerClass.bind(l.defaultInstance);
|
|
521
|
+
l.registerSymbol = l.defaultInstance.registerSymbol.bind(l.defaultInstance);
|
|
522
|
+
l.registerCustom = l.defaultInstance.registerCustom.bind(l.defaultInstance);
|
|
523
|
+
l.allowErrorProps = l.defaultInstance.allowErrorProps.bind(l.defaultInstance);
|
|
524
|
+
const b = (e) => e === void 0 ? mt.None : e, tr = (e) => new Oe(e.metadataItem, e.type), x = (e) => new je(e.name, e.expression, e.type, e.description, b(e.sort), e.dataSource, e.composeCode), V = (e) => new Ge(e.name, e.expression, e.granularity, e.format, e.description, b(e.sort), e.dataSource, e.composeCode), f = (e) => {
|
|
525
525
|
switch (e.__serializable) {
|
|
526
526
|
case "DimensionalAttribute":
|
|
527
527
|
return x(e);
|
|
@@ -530,16 +530,16 @@ const b = (e) => e === void 0 ? ct.None : e, er = (e) => new Oe(e.metadataItem,
|
|
|
530
530
|
default:
|
|
531
531
|
return e;
|
|
532
532
|
}
|
|
533
|
-
},
|
|
533
|
+
}, Ee = (e) => new Ft(e.name, e.expression, e.attributes.map(f), e.dimensions.map(rr), e.type, e.description, b(e.sort), e.dataSource, e.composeCode, e.defaultAttribute ? f(e.defaultAttribute) : void 0), De = (e) => new Ct(e.name, e.expression, e.description, b(e.sort), e.dataSource, e.composeCode), rr = (e) => {
|
|
534
534
|
switch (e.__serializable) {
|
|
535
535
|
case "DimensionalDimension":
|
|
536
|
-
return
|
|
536
|
+
return Ee(e);
|
|
537
537
|
case "DimensionalDateDimension":
|
|
538
|
-
return
|
|
538
|
+
return De(e);
|
|
539
539
|
default:
|
|
540
540
|
return e;
|
|
541
541
|
}
|
|
542
|
-
}, B = (e) => new
|
|
542
|
+
}, B = (e) => new Je(e.name, f(e.attribute), e.aggregation, e.format, e.description, b(e.sort), e.dataSource, e.composeCode), U = (e) => {
|
|
543
543
|
const t = Object.fromEntries(Object.entries(e.context).map(([r, s]) => {
|
|
544
544
|
if (s && typeof s == "object" && "__serializable" in s)
|
|
545
545
|
switch (s.__serializable) {
|
|
@@ -561,7 +561,7 @@ const b = (e) => e === void 0 ? ct.None : e, er = (e) => new Oe(e.metadataItem,
|
|
|
561
561
|
case "DimensionalCalculatedMeasure":
|
|
562
562
|
return [
|
|
563
563
|
r,
|
|
564
|
-
|
|
564
|
+
U(s)
|
|
565
565
|
];
|
|
566
566
|
default:
|
|
567
567
|
return [
|
|
@@ -574,303 +574,439 @@ const b = (e) => e === void 0 ? ct.None : e, er = (e) => new Oe(e.metadataItem,
|
|
|
574
574
|
s
|
|
575
575
|
];
|
|
576
576
|
}));
|
|
577
|
-
return new
|
|
578
|
-
},
|
|
577
|
+
return new ve(e.name, e.expression, t, e.format, e.description, b(e.sort), e.dataSource, e.composeCode);
|
|
578
|
+
}, ze = (e) => new et(e.name, f(e.attribute), e.format, e.description, b(e.sort), e.dataSource, e.composeCode), te = (e) => {
|
|
579
579
|
switch (e.__serializable) {
|
|
580
580
|
case "DimensionalBaseMeasure":
|
|
581
581
|
return B(e);
|
|
582
582
|
case "DimensionalCalculatedMeasure":
|
|
583
|
-
return
|
|
583
|
+
return U(e);
|
|
584
584
|
case "DimensionalMeasureTemplate":
|
|
585
|
-
return
|
|
585
|
+
return ze(e);
|
|
586
586
|
default:
|
|
587
587
|
return e;
|
|
588
588
|
}
|
|
589
|
-
},
|
|
589
|
+
}, u = (e) => {
|
|
590
590
|
switch (e.__serializable) {
|
|
591
591
|
case "MembersFilter":
|
|
592
|
-
return new
|
|
593
|
-
backgroundFilter:
|
|
592
|
+
return new ft(f(e.attribute), e.members, e.config.backgroundFilter ? T(y({}, e.config), {
|
|
593
|
+
backgroundFilter: u(e.config.backgroundFilter)
|
|
594
594
|
}) : e.config, e.composeCode);
|
|
595
595
|
case "LogicalAttributeFilter":
|
|
596
|
-
return new
|
|
596
|
+
return new ut(e.filters.map((r) => u(r)), e.operator, e.config, e.composeCode);
|
|
597
597
|
case "CascadingFilter":
|
|
598
|
-
return new
|
|
598
|
+
return new ct(e._filters.map((r) => u(r)), e.config, e.composeCode);
|
|
599
599
|
case "ExcludeFilter":
|
|
600
|
-
return new
|
|
600
|
+
return new lt(u(e.filter), e.input ? u(e.input) : void 0, e.config, e.composeCode);
|
|
601
601
|
case "MeasureFilter":
|
|
602
|
-
return new
|
|
602
|
+
return new ot(f(e.attribute), te(e.measure), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
603
603
|
case "RankingFilter":
|
|
604
|
-
return new
|
|
604
|
+
return new at(f(e.attribute), te(e.measure), e.operator, e.count, e.config, e.composeCode);
|
|
605
605
|
case "NumericFilter":
|
|
606
|
-
return new
|
|
606
|
+
return new it(f(e.attribute), e.operatorA, e.valueA, e.operatorB, e.valueB, e.config, e.composeCode);
|
|
607
607
|
case "TextFilter":
|
|
608
|
-
return new
|
|
608
|
+
return new nt(f(e.attribute), e.operatorA, e.valueA, e.config, e.composeCode);
|
|
609
609
|
case "DateRangeFilter": {
|
|
610
610
|
const { valueA: r, valueB: s } = e;
|
|
611
|
-
return new
|
|
611
|
+
return new st(f(e.attribute), r, s, e.config, e.composeCode);
|
|
612
612
|
}
|
|
613
613
|
case "RelativeDateFilter":
|
|
614
|
-
return new
|
|
614
|
+
return new rt(f(e.attribute), e.offset, e.count, e.operator, e.anchor, e.config, e.composeCode);
|
|
615
615
|
case "CustomFilter":
|
|
616
|
-
return new
|
|
616
|
+
return new tt(f(e.attribute), e.jaqlExpression, e.config, e.composeCode);
|
|
617
617
|
default:
|
|
618
618
|
return e;
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
|
-
|
|
622
|
-
isApplicable:
|
|
621
|
+
l.registerCustom({
|
|
622
|
+
isApplicable: Pe,
|
|
623
623
|
serialize: (e) => e.serialize(),
|
|
624
|
-
deserialize: (e) =>
|
|
624
|
+
deserialize: (e) => tr(e)
|
|
625
625
|
}, "JaqlElement");
|
|
626
|
-
|
|
626
|
+
l.registerCustom({
|
|
627
627
|
isApplicable: Se,
|
|
628
628
|
serialize: (e) => e.serialize(),
|
|
629
629
|
deserialize: (e) => x(e)
|
|
630
630
|
}, "DimensionalAttribute");
|
|
631
|
-
|
|
632
|
-
isApplicable:
|
|
631
|
+
l.registerCustom({
|
|
632
|
+
isApplicable: Le,
|
|
633
633
|
serialize: (e) => e.serialize(),
|
|
634
634
|
deserialize: (e) => V(e)
|
|
635
635
|
}, "DimensionalLevelAttribute");
|
|
636
|
-
|
|
636
|
+
l.registerCustom({
|
|
637
637
|
isApplicable: Dt,
|
|
638
638
|
serialize: (e) => e.serialize(),
|
|
639
|
-
deserialize: (e) =>
|
|
639
|
+
deserialize: (e) => Ee(e)
|
|
640
640
|
}, "DimensionalDimension");
|
|
641
|
-
|
|
642
|
-
isApplicable:
|
|
641
|
+
l.registerCustom({
|
|
642
|
+
isApplicable: zt,
|
|
643
643
|
serialize: (e) => e.serialize(),
|
|
644
|
-
deserialize: (e) =>
|
|
644
|
+
deserialize: (e) => De(e)
|
|
645
645
|
}, "DimensionalDateDimension");
|
|
646
|
-
|
|
647
|
-
isApplicable:
|
|
646
|
+
l.registerCustom({
|
|
647
|
+
isApplicable: _e,
|
|
648
648
|
serialize: (e) => e.serialize(),
|
|
649
649
|
deserialize: (e) => B(e)
|
|
650
650
|
}, "DimensionalBaseMeasure");
|
|
651
|
-
|
|
652
|
-
isApplicable:
|
|
651
|
+
l.registerCustom({
|
|
652
|
+
isApplicable: xe,
|
|
653
653
|
serialize: (e) => e.serialize(),
|
|
654
|
-
deserialize: (e) =>
|
|
654
|
+
deserialize: (e) => U(e)
|
|
655
655
|
}, "DimensionalCalculatedMeasure");
|
|
656
|
-
|
|
657
|
-
isApplicable:
|
|
656
|
+
l.registerCustom({
|
|
657
|
+
isApplicable: Ve,
|
|
658
658
|
serialize: (e) => e.serialize(),
|
|
659
|
-
deserialize: (e) =>
|
|
659
|
+
deserialize: (e) => ze(e)
|
|
660
660
|
}, "DimensionalMeasureTemplate");
|
|
661
|
-
|
|
662
|
-
isApplicable:
|
|
661
|
+
l.registerCustom({
|
|
662
|
+
isApplicable: ne,
|
|
663
663
|
serialize: (e) => e.serialize(),
|
|
664
|
-
deserialize: (e) =>
|
|
664
|
+
deserialize: (e) => u(e)
|
|
665
665
|
}, "MembersFilter");
|
|
666
|
-
|
|
667
|
-
isApplicable:
|
|
666
|
+
l.registerCustom({
|
|
667
|
+
isApplicable: Be,
|
|
668
668
|
serialize: (e) => e.serialize(),
|
|
669
|
-
deserialize: (e) =>
|
|
669
|
+
deserialize: (e) => u(e)
|
|
670
670
|
}, "LogicalAttributeFilter");
|
|
671
|
-
|
|
672
|
-
isApplicable:
|
|
671
|
+
l.registerCustom({
|
|
672
|
+
isApplicable: Ue,
|
|
673
673
|
serialize: (e) => e.serialize(),
|
|
674
|
-
deserialize: (e) =>
|
|
674
|
+
deserialize: (e) => u(e)
|
|
675
675
|
}, "CascadingFilter");
|
|
676
|
-
|
|
677
|
-
isApplicable:
|
|
676
|
+
l.registerCustom({
|
|
677
|
+
isApplicable: Ke,
|
|
678
678
|
serialize: (e) => e.serialize(),
|
|
679
|
-
deserialize: (e) =>
|
|
679
|
+
deserialize: (e) => u(e)
|
|
680
680
|
}, "ExcludeFilter");
|
|
681
|
-
|
|
682
|
-
isApplicable:
|
|
681
|
+
l.registerCustom({
|
|
682
|
+
isApplicable: Qe,
|
|
683
683
|
serialize: (e) => e.serialize(),
|
|
684
|
-
deserialize: (e) =>
|
|
684
|
+
deserialize: (e) => u(e)
|
|
685
685
|
}, "MeasureFilter");
|
|
686
|
-
|
|
687
|
-
isApplicable:
|
|
686
|
+
l.registerCustom({
|
|
687
|
+
isApplicable: qe,
|
|
688
688
|
serialize: (e) => e.serialize(),
|
|
689
|
-
deserialize: (e) =>
|
|
689
|
+
deserialize: (e) => u(e)
|
|
690
690
|
}, "RankingFilter");
|
|
691
|
-
|
|
692
|
-
isApplicable:
|
|
691
|
+
l.registerCustom({
|
|
692
|
+
isApplicable: He,
|
|
693
693
|
serialize: (e) => e.serialize(),
|
|
694
|
-
deserialize: (e) =>
|
|
694
|
+
deserialize: (e) => u(e)
|
|
695
695
|
}, "NumericFilter");
|
|
696
|
-
|
|
697
|
-
isApplicable:
|
|
696
|
+
l.registerCustom({
|
|
697
|
+
isApplicable: Ye,
|
|
698
698
|
serialize: (e) => e.serialize(),
|
|
699
|
-
deserialize: (e) =>
|
|
699
|
+
deserialize: (e) => u(e)
|
|
700
700
|
}, "TextFilter");
|
|
701
|
-
|
|
702
|
-
isApplicable:
|
|
701
|
+
l.registerCustom({
|
|
702
|
+
isApplicable: We,
|
|
703
703
|
serialize: (e) => e.serialize(),
|
|
704
|
-
deserialize: (e) =>
|
|
704
|
+
deserialize: (e) => u(e)
|
|
705
705
|
}, "DateRangeFilter");
|
|
706
|
-
|
|
707
|
-
isApplicable:
|
|
706
|
+
l.registerCustom({
|
|
707
|
+
isApplicable: Xe,
|
|
708
708
|
serialize: (e) => e.serialize(),
|
|
709
|
-
deserialize: (e) =>
|
|
709
|
+
deserialize: (e) => u(e)
|
|
710
710
|
}, "RelativeDateFilter");
|
|
711
|
-
|
|
712
|
-
isApplicable:
|
|
711
|
+
l.registerCustom({
|
|
712
|
+
isApplicable: Ze,
|
|
713
713
|
serialize: (e) => e.serialize(),
|
|
714
|
-
deserialize: (e) =>
|
|
714
|
+
deserialize: (e) => u(e)
|
|
715
715
|
}, "CustomFilter");
|
|
716
|
-
const
|
|
717
|
-
function
|
|
716
|
+
const Cr = l, A = "DM.";
|
|
717
|
+
function sr(e) {
|
|
718
718
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
719
719
|
}
|
|
720
|
-
function U(e) {
|
|
721
|
-
return e.every(rr);
|
|
722
|
-
}
|
|
723
720
|
function K(e) {
|
|
724
|
-
return
|
|
721
|
+
return e.every(sr);
|
|
725
722
|
}
|
|
726
723
|
function Q(e) {
|
|
724
|
+
return "attribute" in e && "config" in e;
|
|
725
|
+
}
|
|
726
|
+
function q(e) {
|
|
727
727
|
return "left" in e && "right" in e && "operator" in e;
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
return !
|
|
729
|
+
function nr(e) {
|
|
730
|
+
return !Q(e) && !q(e);
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function H(e, t) {
|
|
733
733
|
const r = {}, s = e !== "" ? e + "." : "";
|
|
734
|
-
for (const
|
|
735
|
-
if (typeof t[`${
|
|
736
|
-
r[`${s}${
|
|
737
|
-
else if (typeof t[`${
|
|
738
|
-
const
|
|
739
|
-
for (const
|
|
740
|
-
r[`${s}${
|
|
734
|
+
for (const n in t)
|
|
735
|
+
if (typeof t[`${n}`] == "function")
|
|
736
|
+
r[`${s}${n}`] = t[`${n}`];
|
|
737
|
+
else if (typeof t[`${n}`] == "object") {
|
|
738
|
+
const i = H("", t[`${n}`]);
|
|
739
|
+
for (const a in i)
|
|
740
|
+
r[`${s}${n}.${a}`] = i[`${a}`];
|
|
741
741
|
}
|
|
742
742
|
return r;
|
|
743
743
|
}
|
|
744
|
-
const
|
|
744
|
+
const re = H("measureFactory", pt), se = H("filterFactory", gt);
|
|
745
745
|
function ir(e, t) {
|
|
746
746
|
const s = e.split(".")[0];
|
|
747
|
-
if (s === "filterFactory" &&
|
|
747
|
+
if (s === "filterFactory" && se[`${e}`])
|
|
748
|
+
return se[`${e}`](...t);
|
|
749
|
+
if (s === "measureFactory" && re[`${e}`])
|
|
748
750
|
return re[`${e}`](...t);
|
|
749
|
-
if (s === "measureFactory" && te[`${e}`])
|
|
750
|
-
return te[`${e}`](...t);
|
|
751
751
|
throw new Error(`Function "${e}" not found in filterFactory or measureFactory.`);
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function ar(e) {
|
|
754
754
|
const t = e.split(".");
|
|
755
|
-
if (t.length < 3 || t[0] !==
|
|
756
|
-
throw new Error(`Invalid attribute name format: "${e}". Expected format: "
|
|
755
|
+
if (t.length < 3 || `${t[0]}.` !== A)
|
|
756
|
+
throw new Error(`Invalid attribute name format: "${e}". Expected format: "${A}TableName.ColumnName[.Level]".`);
|
|
757
757
|
const r = t[1], s = t[2];
|
|
758
|
-
let
|
|
759
|
-
return t.length === 4 && (
|
|
758
|
+
let n;
|
|
759
|
+
return t.length === 4 && (n = t[3]), {
|
|
760
760
|
tableName: r,
|
|
761
761
|
columnName: s,
|
|
762
|
-
level:
|
|
762
|
+
level: n
|
|
763
763
|
};
|
|
764
764
|
}
|
|
765
|
-
function
|
|
766
|
-
const { tableName: r, columnName: s, level:
|
|
767
|
-
if (!
|
|
765
|
+
function or(e, t) {
|
|
766
|
+
const { tableName: r, columnName: s, level: n } = ar(e), i = t.find((o) => o.name === r);
|
|
767
|
+
if (!i)
|
|
768
768
|
throw new Error(`Table "${r}" not found in the data model.`);
|
|
769
|
-
const
|
|
770
|
-
if (!
|
|
769
|
+
const a = i.columns.find((o) => o.name === s);
|
|
770
|
+
if (!a)
|
|
771
771
|
throw new Error(`Column "${s}" not found in table "${r}".`);
|
|
772
|
-
if (
|
|
773
|
-
if (
|
|
774
|
-
throw new Error(`Invalid date level "${
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
777
|
-
throw new Error(`Invalid date level "${
|
|
772
|
+
if (n) {
|
|
773
|
+
if (a.dataType !== ie.DATETIME)
|
|
774
|
+
throw new Error(`Invalid date level "${n}" in attribute "${e}". Column "${r}.${s}" is not a datetime column.`);
|
|
775
|
+
const o = ae.all;
|
|
776
|
+
if (!o.includes(n))
|
|
777
|
+
throw new Error(`Invalid date level "${n}" in attribute "${e}". Valid levels are: ${o.join(", ")}.`);
|
|
778
|
+
}
|
|
779
|
+
return {
|
|
780
|
+
field: a,
|
|
781
|
+
level: n
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function lr(e, t) {
|
|
785
|
+
if (e.startsWith(A)) return {
|
|
786
|
+
isLikelyAttribute: !0,
|
|
787
|
+
suggestion: e
|
|
788
|
+
};
|
|
789
|
+
const r = e.split(".");
|
|
790
|
+
if (r.length === 2) {
|
|
791
|
+
const [s, n] = r, i = t.some((a) => a.name === s && a.columns.some((o) => o.name === n));
|
|
792
|
+
return i ? {
|
|
793
|
+
isLikelyAttribute: i,
|
|
794
|
+
suggestion: `${A}${e}`
|
|
795
|
+
} : {
|
|
796
|
+
isLikelyAttribute: !1
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
if (r.length === 3) {
|
|
800
|
+
const [s, n, i] = r, a = t.find((c) => c.name === s);
|
|
801
|
+
if (!a)
|
|
802
|
+
return {
|
|
803
|
+
isLikelyAttribute: !1
|
|
804
|
+
};
|
|
805
|
+
const o = a.columns.find((c) => c.name === n);
|
|
806
|
+
return o ? o.dataType === ie.DATETIME && ae.all.includes(i) ? {
|
|
807
|
+
isLikelyAttribute: !0,
|
|
808
|
+
suggestion: `${A}${e}`
|
|
809
|
+
} : {
|
|
810
|
+
isLikelyAttribute: !1
|
|
811
|
+
} : {
|
|
812
|
+
isLikelyAttribute: !1
|
|
813
|
+
};
|
|
778
814
|
}
|
|
779
815
|
return {
|
|
780
|
-
|
|
781
|
-
level: i
|
|
816
|
+
isLikelyAttribute: !1
|
|
782
817
|
};
|
|
783
818
|
}
|
|
784
|
-
function
|
|
785
|
-
const { field: s, level:
|
|
786
|
-
return
|
|
819
|
+
function Fe(e, t, r) {
|
|
820
|
+
const { field: s, level: n } = or(e, r);
|
|
821
|
+
return dt({
|
|
787
822
|
expression: s.expression,
|
|
788
823
|
dataType: s.dataType,
|
|
789
|
-
granularity:
|
|
824
|
+
granularity: n,
|
|
790
825
|
format: void 0,
|
|
791
826
|
sort: void 0,
|
|
792
827
|
dataSource: t
|
|
793
828
|
});
|
|
794
829
|
}
|
|
795
|
-
function
|
|
796
|
-
|
|
830
|
+
function cr(e, t, r) {
|
|
831
|
+
if (typeof e == "object" && e !== null && !Array.isArray(e) && "function" in e && "args" in e)
|
|
832
|
+
return N(e, t, r);
|
|
833
|
+
if (typeof e == "string") {
|
|
834
|
+
if (e.startsWith(A))
|
|
835
|
+
return Fe(e, t, r);
|
|
836
|
+
const { isLikelyAttribute: s, suggestion: n } = lr(e, r);
|
|
837
|
+
if (s)
|
|
838
|
+
throw new Error(`Invalid attribute format: "${e}". Did you mean "${n}"?`);
|
|
839
|
+
}
|
|
840
|
+
return e;
|
|
797
841
|
}
|
|
798
|
-
function
|
|
799
|
-
const { function: s, args:
|
|
800
|
-
return ir(s,
|
|
842
|
+
function N(e, t, r) {
|
|
843
|
+
const { function: s, args: n } = e, i = n.map((a) => cr(a, t, r));
|
|
844
|
+
return ir(s, i);
|
|
801
845
|
}
|
|
802
|
-
function
|
|
846
|
+
function Ce(e) {
|
|
803
847
|
const { attribute: t, config: r } = e;
|
|
804
|
-
if (
|
|
848
|
+
if (ne(e) && yt(t)) {
|
|
805
849
|
const { granularity: s } = t;
|
|
806
|
-
return
|
|
850
|
+
return bt(t, e.members.map((n) => s === "Years" && !isNaN(Number(n)) ? `${n}-01-01T00:00:00` : n), r);
|
|
807
851
|
}
|
|
808
852
|
return e;
|
|
809
853
|
}
|
|
810
|
-
function
|
|
854
|
+
function ur(e) {
|
|
811
855
|
let t = [];
|
|
812
856
|
for (const r of e)
|
|
813
|
-
|
|
814
|
-
|
|
857
|
+
q(r) ? t = j(r, t) : t = j([
|
|
858
|
+
Ce(r)
|
|
815
859
|
], t);
|
|
816
860
|
return t != null ? t : [];
|
|
817
861
|
}
|
|
818
|
-
const
|
|
819
|
-
const s =
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
862
|
+
const fr = (e, t, r) => {
|
|
863
|
+
const s = [], n = [];
|
|
864
|
+
return e.forEach((i, a) => {
|
|
865
|
+
try {
|
|
866
|
+
const o = N(i, t, r);
|
|
867
|
+
!q(o) && !Q(o) ? n.push(`Filter ${a + 1} (${i.function}): Invalid filter JSON`) : s.push(o);
|
|
868
|
+
} catch (o) {
|
|
869
|
+
const c = o instanceof Error ? o.message : "Unknown error";
|
|
870
|
+
n.push(`Filter ${a + 1} (${i.function}): ${c}`);
|
|
871
|
+
}
|
|
872
|
+
}), n.length > 0 ? {
|
|
873
|
+
success: !1,
|
|
874
|
+
errors: n
|
|
875
|
+
} : {
|
|
876
|
+
success: !0,
|
|
877
|
+
data: ur(s)
|
|
878
|
+
};
|
|
879
|
+
}, mr = (e, t, r) => e ? K(e) ? fr(e, t, r) : {
|
|
880
|
+
success: !1,
|
|
881
|
+
errors: [
|
|
882
|
+
'Invalid filters JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
883
|
+
]
|
|
884
|
+
} : {
|
|
885
|
+
success: !0,
|
|
886
|
+
data: []
|
|
887
|
+
}, dr = (e, t, r) => {
|
|
888
|
+
const s = [], n = [];
|
|
889
|
+
return e.forEach((i, a) => {
|
|
890
|
+
try {
|
|
891
|
+
const o = N(i, t, r);
|
|
892
|
+
Q(o) ? s.push(Ce(o)) : n.push(`Highlight ${a + 1} (${i.function}): Invalid filter JSON`);
|
|
893
|
+
} catch (o) {
|
|
894
|
+
const c = o instanceof Error ? o.message : "Unknown error";
|
|
895
|
+
n.push(`Highlight ${a + 1} (${i.function}): ${c}`);
|
|
896
|
+
}
|
|
897
|
+
}), n.length > 0 ? {
|
|
898
|
+
success: !1,
|
|
899
|
+
errors: n
|
|
900
|
+
} : {
|
|
901
|
+
success: !0,
|
|
902
|
+
data: s
|
|
903
|
+
};
|
|
904
|
+
}, pr = (e, t, r) => e ? K(e) ? dr(e, t, r) : {
|
|
905
|
+
success: !1,
|
|
906
|
+
errors: [
|
|
907
|
+
'Invalid highlights JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
908
|
+
]
|
|
909
|
+
} : {
|
|
910
|
+
success: !0,
|
|
911
|
+
data: []
|
|
843
912
|
};
|
|
844
|
-
function
|
|
913
|
+
function gr(e) {
|
|
845
914
|
return e.every((t) => typeof t == "string");
|
|
846
915
|
}
|
|
847
|
-
const
|
|
916
|
+
const yr = (e, t, r) => {
|
|
848
917
|
if (!e)
|
|
849
|
-
return
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
},
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
918
|
+
return {
|
|
919
|
+
success: !0,
|
|
920
|
+
data: []
|
|
921
|
+
};
|
|
922
|
+
if (!gr(e))
|
|
923
|
+
return {
|
|
924
|
+
success: !1,
|
|
925
|
+
errors: [
|
|
926
|
+
"Invalid dimensions JSON. Expected an array of strings."
|
|
927
|
+
]
|
|
928
|
+
};
|
|
929
|
+
const s = [], n = [];
|
|
930
|
+
return e.forEach((i, a) => {
|
|
931
|
+
try {
|
|
932
|
+
const o = Fe(i, t, r);
|
|
933
|
+
s.push(o);
|
|
934
|
+
} catch (o) {
|
|
935
|
+
const c = o instanceof Error ? o.message : "Unknown error";
|
|
936
|
+
n.push(`Dimension ${a + 1} ("${i}"): ${c}`);
|
|
937
|
+
}
|
|
938
|
+
}), n.length > 0 ? {
|
|
939
|
+
success: !1,
|
|
940
|
+
errors: n
|
|
941
|
+
} : {
|
|
942
|
+
success: !0,
|
|
943
|
+
data: s
|
|
944
|
+
};
|
|
945
|
+
}, br = (e, t, r) => {
|
|
946
|
+
const s = [], n = [];
|
|
947
|
+
return e.forEach((i, a) => {
|
|
948
|
+
try {
|
|
949
|
+
const o = N(i, t, r);
|
|
950
|
+
nr(o) ? s.push(o) : n.push(`Measure ${a + 1} (${i.function}): Invalid measure JSON`);
|
|
951
|
+
} catch (o) {
|
|
952
|
+
const c = o instanceof Error ? o.message : "Unknown error";
|
|
953
|
+
n.push(`Measure ${a + 1} (${i.function}): ${c}`);
|
|
954
|
+
}
|
|
955
|
+
}), n.length > 0 ? {
|
|
956
|
+
success: !1,
|
|
957
|
+
errors: n
|
|
958
|
+
} : {
|
|
959
|
+
success: !0,
|
|
960
|
+
data: s
|
|
961
|
+
};
|
|
962
|
+
}, hr = (e, t, r) => e ? K(e) ? br(e, t, r) : {
|
|
963
|
+
success: !1,
|
|
964
|
+
errors: [
|
|
965
|
+
'Invalid measures JSON. Expected an array of function calls with "function" and "args" properties.'
|
|
966
|
+
]
|
|
967
|
+
} : {
|
|
968
|
+
success: !0,
|
|
969
|
+
data: []
|
|
970
|
+
};
|
|
971
|
+
function wr(e) {
|
|
972
|
+
const t = {}, r = [];
|
|
973
|
+
for (const s in e) {
|
|
974
|
+
const n = e[`${s}`], i = n();
|
|
975
|
+
if (i.success)
|
|
976
|
+
t[`${s}`] = i.data;
|
|
977
|
+
else {
|
|
978
|
+
const a = i.errors.map((o) => `[${s}] ${o}`);
|
|
979
|
+
r.push(...a);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return r.length > 0 ? {
|
|
983
|
+
success: !1,
|
|
984
|
+
errors: r
|
|
985
|
+
} : {
|
|
986
|
+
success: !0,
|
|
987
|
+
data: t
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
const Rr = (e, t, r) => {
|
|
991
|
+
const s = {
|
|
992
|
+
dimensions: () => yr(e.dimensions || [], t, r),
|
|
993
|
+
measures: () => hr(e.measures || [], t, r),
|
|
994
|
+
filters: () => mr(e.filters || [], t, r)
|
|
995
|
+
};
|
|
996
|
+
e.highlights && (s.highlights = () => pr(e.highlights || [], t, r));
|
|
997
|
+
const n = wr(s);
|
|
998
|
+
if (!n.success) {
|
|
999
|
+
const a = `Translation failed with ${n.errors.length} error(s):
|
|
1000
|
+
${n.errors.join(`
|
|
1001
|
+
`)}`;
|
|
1002
|
+
throw new Error(a);
|
|
1003
|
+
}
|
|
1004
|
+
return y({
|
|
1005
|
+
dataSource: ht(t)
|
|
1006
|
+
}, n.data);
|
|
1007
|
+
};
|
|
1008
|
+
function Ar(e) {
|
|
1009
|
+
const { filters: t, relations: r } = Et(e.filters || []);
|
|
874
1010
|
return {
|
|
875
1011
|
dataSource: e.dataSource,
|
|
876
1012
|
dimensions: e.dimensions,
|
|
@@ -880,18 +1016,18 @@ function br(e) {
|
|
|
880
1016
|
highlights: e.highlights
|
|
881
1017
|
};
|
|
882
1018
|
}
|
|
883
|
-
function
|
|
884
|
-
const s =
|
|
885
|
-
return
|
|
1019
|
+
function $r(e, t, r = !1) {
|
|
1020
|
+
const s = Ar(e), n = wt(s, t);
|
|
1021
|
+
return At(n, r);
|
|
886
1022
|
}
|
|
887
1023
|
export {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1024
|
+
Cr as CustomSuperJSON,
|
|
1025
|
+
Mr as EMPTY_EXPANDED_QUERY_MODEL,
|
|
1026
|
+
kr as EMPTY_SIMPLE_QUERY_MODEL,
|
|
1027
|
+
Nr as isByIdDashboardCodeParams,
|
|
1028
|
+
Pr as isByIdWidgetCodeParams,
|
|
893
1029
|
Or as isClientSideDashboardCodeParams,
|
|
894
1030
|
Sr as isClientSideWidgetCodeParams,
|
|
895
|
-
|
|
896
|
-
|
|
1031
|
+
Rr as translateQueryJSON,
|
|
1032
|
+
$r as translateQueryToJaql
|
|
897
1033
|
};
|