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