@sisense/sdk-ui 2.22.0 → 2.24.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 +19 -19
- package/dist/ai.js +59 -59
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +2440 -1253
- package/dist/analytics-composer.cjs +47 -47
- package/dist/analytics-composer.js +135 -131
- package/dist/dimensions-C1R5YRt-.js +204 -0
- package/dist/dimensions-C7yXAoZs.cjs +1 -0
- package/dist/execute-query-0Y9Fn9Pf.cjs +1 -0
- package/dist/execute-query-b9oy2Egy.js +5869 -0
- package/dist/{index-NyouhE_A.cjs → index-Ck-0gJC9.cjs} +1 -1
- package/dist/{index-kxX21arA.js → index-r66Tjiqj.js} +39 -2
- package/dist/index.cjs +633 -616
- package/dist/index.js +18198 -17875
- package/dist/index.umd.js +1006 -949
- 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/hooks/use-widget-csv-download.d.ts +24 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +43 -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/helpers/use-translated-data-options.d.ts +12 -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/chart-widget/use-chart-widget-csv-download.d.ts +18 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/use-custom-widget-csv-download.d.ts +15 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/types.d.ts +12 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/use-pivot-widget-csv-download.d.ts +18 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/tabber-buttons-widget/types.d.ts +8 -8
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +21 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-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/translate-widget-style-options/to-widget-dto-style.d.ts +11 -2
- 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-csv-query-file-loader.d.ts +16 -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/hooks/use-with-csv-download-menu-item.d.ts +22 -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/domains/widgets/shared/widget-header/widget-menu-button.d.ts +1 -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/custom-widgets-provider/custom-widgets-provider-adapter.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-custom-widgets.d.ts +11 -4
- package/dist/packages/sdk-ui/src/infra/contexts/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/plugins/custom-plugin-context-provider.d.ts +18 -0
- package/dist/packages/sdk-ui/src/infra/plugins/plugin-context.d.ts +29 -0
- package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/plugin-provider.d.ts +4 -2
- package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/types.d.ts +12 -4
- package/dist/packages/sdk-ui/src/infra/plugins/use-widget-plugin-registry.d.ts +7 -0
- package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/validate-plugins.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +302 -0
- package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/widget-plugin-registry.d.ts +33 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +37 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +74 -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 +25 -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 +41 -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/shared/utils/parse-compose-code.d.ts +34 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/schema-index.d.ts +52 -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 +20 -2
- 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 +10 -6
- package/dist/packages/sdk-ui/src/public-api/public.d.ts +2 -2
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +14 -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/const.d.ts +5 -0
- 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/shared/types/menu-item.d.ts +5 -1
- package/dist/packages/sdk-ui/src/shared/utils/menu-item-converters.d.ts +12 -0
- package/dist/packages/sdk-ui/src/types.d.ts +3 -3
- package/dist/quota-notification-BqRYSJ7r.cjs +713 -0
- package/dist/{quota-notification-D6oMJal8.js → quota-notification-CeKnEyQG.js} +18423 -17044
- package/dist/translations/de-de.cjs +1 -1
- package/dist/translations/de-de.js +40 -3
- 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 +40 -3
- package/dist/translations/es-es.cjs +1 -1
- package/dist/translations/es-es.js +40 -3
- package/dist/translations/fr-fr.cjs +1 -1
- package/dist/translations/fr-fr.js +40 -3
- package/dist/translations/it-it.cjs +1 -1
- package/dist/translations/it-it.js +42 -5
- package/dist/translations/ja-jp.cjs +1 -1
- package/dist/translations/ja-jp.js +42 -5
- package/dist/translations/ko-kr.cjs +1 -1
- package/dist/translations/ko-kr.js +42 -5
- package/dist/translations/nl-nl.cjs +1 -1
- package/dist/translations/nl-nl.js +42 -5
- package/dist/translations/pt-br.cjs +1 -1
- package/dist/translations/pt-br.js +40 -3
- package/dist/translations/ru-ru.cjs +1 -1
- package/dist/translations/ru-ru.js +42 -5
- package/dist/translations/tr-tr.cjs +1 -1
- package/dist/translations/tr-tr.js +40 -3
- package/dist/translations/zh-cn.cjs +1 -1
- package/dist/translations/zh-cn.js +42 -5
- package/dist/{types-CoY6F8Ma.cjs → types-C0QU2tsE.cjs} +1 -1
- package/dist/{types-ixSwJkxM.js → types-DJtC8_5_.js} +1 -1
- package/dist/{utils-BP-BglHE.js → utils-BCp2ISWh.js} +3745 -3773
- package/dist/{utils-C8YMrOdw.cjs → utils-D8O1_kl3.cjs} +33 -33
- package/dist/{widget-composer-DI4sHaNe.cjs → widget-composer-BkHZISs7.cjs} +1 -1
- package/dist/{widget-composer-CUUFoCb9.js → widget-composer-CDNL9_XF.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/infra/contexts/plugin-provider/index.d.ts +0 -5
- package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-context.d.ts +0 -15
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/common.d.ts +0 -84
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/parse-compose-code.d.ts +0 -15
- 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 Vt = Object.defineProperty, Wt = Object.defineProperties;
|
|
2
|
+
var jt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ue = Object.getOwnPropertySymbols;
|
|
4
|
+
var Kt = Object.prototype.hasOwnProperty, Gt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _e = (e, t, r) => t in e ? Vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, y = (e, t) => {
|
|
6
|
+
for (var r in t || (t = {}))
|
|
7
|
+
Kt.call(t, r) && _e(e, r, t[r]);
|
|
8
|
+
if (Ue)
|
|
9
|
+
for (var r of Ue(t))
|
|
10
|
+
Gt.call(t, r) && _e(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) => Wt(e, jt(t));
|
|
13
|
+
import { f as Yt, J as Jt } from "../types-DJtC8_5_.js";
|
|
14
|
+
import { b as pi, E as gi, a as yi, i as hi, e as bi, d as Ai } from "../types-DJtC8_5_.js";
|
|
15
|
+
import { cb as Ht, bK as Qt, cc as Xt, cd as Zt, ce as er, aG as Fe, cf as tr, aF as rr, cg as sr, bi as nr, aH as ir, ch as or, bl as ar, bj as ur, aV as cr, bh as lr, bk as fr, d as dr, c as mr, k as pr, ci as gr, cj as yr, ck as hr, cl as br, cm as Ar, cn as Fr, co as wr, cp as Er, cq as Cr, cr as Tr, cs as qr, aE as xr, ct as $r, cu as Sr, S as B, t as X, h as Or, b as $, av as _, at as se, cv as Dr, cw as Mr, cx as Nr, M as U, cy as Rr, cz as vr, aR as Ir, ax as Ve, aw as we, bQ as ne, U as Pr, V as kr, cA as it, ag as Br, A as zr, cB as Lr, y as Ur, x as _r } from "../execute-query-b9oy2Egy.js";
|
|
16
|
+
import { i as Vr, b as Wr, D as jr, d as Kr, a as Gr } from "../dimensions-C1R5YRt-.js";
|
|
17
|
+
function Yr(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 Jr {
|
|
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 ot {
|
|
42
|
+
constructor(t) {
|
|
43
|
+
this.generateIdentifier = t, this.kv = new Jr();
|
|
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 Hr extends ot {
|
|
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 Qr(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 Xr(e, t) {
|
|
78
|
+
const r = Qr(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 V(e, t) {
|
|
89
|
+
Object.entries(e).forEach(([r, s]) => t(s, r));
|
|
83
90
|
}
|
|
84
|
-
function
|
|
85
|
-
return e.indexOf(
|
|
91
|
+
function ee(e, t) {
|
|
92
|
+
return e.indexOf(t) !== -1;
|
|
86
93
|
}
|
|
87
|
-
function
|
|
88
|
-
for (let
|
|
89
|
-
const s = e[
|
|
90
|
-
if (
|
|
94
|
+
function We(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 Zr {
|
|
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 Xr(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 es = (e) => Object.prototype.toString.call(e).slice(8, -1), at = (e) => typeof e == "undefined", ts = (e) => e === null, G = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, pe = (e) => G(e) && Object.keys(e).length === 0, I = (e) => Array.isArray(e), rs = (e) => typeof e == "string", ss = (e) => typeof e == "number" && !isNaN(e), ns = (e) => typeof e == "boolean", is = (e) => e instanceof RegExp, Y = (e) => e instanceof Map, J = (e) => e instanceof Set, ut = (e) => es(e) === "Symbol", os = (e) => e instanceof Date && !isNaN(e.valueOf()), as = (e) => e instanceof Error, je = (e) => typeof e == "number" && isNaN(e), us = (e) => ns(e) || ts(e) || at(e) || ss(e) || rs(e) || ut(e), cs = (e) => typeof e == "bigint", ls = (e) => e === 1 / 0 || e === -1 / 0, fs = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), ds = (e) => e instanceof URL, ct = (e) => e.replace(/\./g, "\\."), ce = (e) => e.map(String).map(ct).join("."), K = (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 lt = [
|
|
142
|
+
v(at, "undefined", () => null, () => {
|
|
136
143
|
}),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
144
|
+
v(cs, "bigint", (e) => e.toString(), (e) => typeof BigInt != "undefined" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
|
|
145
|
+
v(os, "Date", (e) => e.toISOString(), (e) => new Date(e)),
|
|
146
|
+
v(as, "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(is, "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
|
+
J,
|
|
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(Y, "map", (e) => [...e.entries()], (e) => new Map(e)),
|
|
173
|
+
v((e) => je(e) || ls(e), "number", (e) => je(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
|
|
174
|
+
v((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
|
|
175
|
+
v(ds, "URL", (e) => e.toString(), (e) => new URL(e))
|
|
169
176
|
];
|
|
170
|
-
function
|
|
177
|
+
function ie(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 ft = ie((e, t) => ut(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
|
+
}), ms = [
|
|
184
191
|
Int8Array,
|
|
185
192
|
Uint8Array,
|
|
186
193
|
Int16Array,
|
|
@@ -190,124 +197,124 @@ 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), {}), dt = ie(fs, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
|
|
201
|
+
const r = ms[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 mt(e, t) {
|
|
207
|
+
return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
|
|
201
208
|
}
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
if (!
|
|
205
|
-
return
|
|
209
|
+
const pt = ie(mt, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
|
|
210
|
+
const r = t.classRegistry.getAllowedProps(e.constructor);
|
|
211
|
+
if (!r)
|
|
212
|
+
return y({}, 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
|
+
}), gt = ie((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
|
+
}), ps = [pt, ft, gt, dt], Ke = (e, t) => {
|
|
228
|
+
const r = We(ps, (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 = We(lt, (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
|
+
}, yt = {};
|
|
241
|
+
lt.forEach((e) => {
|
|
242
|
+
yt[e.annotation] = e;
|
|
236
243
|
});
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
switch (
|
|
244
|
+
const gs = (e, t, r) => {
|
|
245
|
+
if (I(t))
|
|
246
|
+
switch (t[0]) {
|
|
240
247
|
case "symbol":
|
|
241
|
-
return
|
|
248
|
+
return ft.untransform(e, t, r);
|
|
242
249
|
case "class":
|
|
243
|
-
return
|
|
250
|
+
return pt.untransform(e, t, r);
|
|
244
251
|
case "custom":
|
|
245
|
-
return
|
|
252
|
+
return gt.untransform(e, t, r);
|
|
246
253
|
case "typed-array":
|
|
247
|
-
return
|
|
254
|
+
return dt.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 = yt[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
|
+
}, L = (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 ht(e) {
|
|
273
|
+
if (ee(e, "__proto__"))
|
|
267
274
|
throw new Error("__proto__ is not allowed as a property");
|
|
268
|
-
if (
|
|
275
|
+
if (ee(e, "prototype"))
|
|
269
276
|
throw new Error("prototype is not allowed as a property");
|
|
270
|
-
if (
|
|
277
|
+
if (ee(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 ys = (e, t) => {
|
|
281
|
+
ht(t);
|
|
282
|
+
for (let r = 0; r < t.length; r++) {
|
|
283
|
+
const s = t[r];
|
|
284
|
+
if (J(e))
|
|
285
|
+
e = L(e, +s);
|
|
286
|
+
else if (Y(e)) {
|
|
287
|
+
const n = +s, i = +t[++r] == 0 ? "key" : "value", o = L(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
|
+
}, ge = (e, t, r) => {
|
|
301
|
+
if (ht(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 (I(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 (G(s))
|
|
310
|
+
s = s[o];
|
|
311
|
+
else if (J(s)) {
|
|
312
|
+
const a = +o;
|
|
313
|
+
s = L(s, a);
|
|
314
|
+
} else if (Y(s)) {
|
|
315
|
+
if (i === t.length - 2)
|
|
309
316
|
break;
|
|
310
|
-
const u = +
|
|
317
|
+
const u = +o, c = +t[++i] == 0 ? "key" : "value", p = L(s, u);
|
|
311
318
|
switch (c) {
|
|
312
319
|
case "key":
|
|
313
320
|
s = p;
|
|
@@ -318,352 +325,354 @@ const $t = (e, r) => {
|
|
|
318
325
|
}
|
|
319
326
|
}
|
|
320
327
|
}
|
|
321
|
-
const n =
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
|
|
328
|
+
const n = t[t.length - 1];
|
|
329
|
+
if (I(s) ? s[+n] = r(s[+n]) : G(s) && (s[n] = r(s[n])), J(s)) {
|
|
330
|
+
const i = L(s, +n), o = r(i);
|
|
331
|
+
i !== o && (s.delete(i), s.add(o));
|
|
325
332
|
}
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
333
|
+
if (Y(s)) {
|
|
334
|
+
const i = +t[t.length - 2], o = L(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 ye(e, t, r = []) {
|
|
343
350
|
if (!e)
|
|
344
351
|
return;
|
|
345
|
-
if (!
|
|
346
|
-
|
|
352
|
+
if (!I(e)) {
|
|
353
|
+
V(e, (i, o) => ye(i, t, [...r, ...K(o)]));
|
|
347
354
|
return;
|
|
348
355
|
}
|
|
349
356
|
const [s, n] = e;
|
|
350
|
-
n &&
|
|
351
|
-
|
|
352
|
-
}),
|
|
357
|
+
n && V(n, (i, o) => {
|
|
358
|
+
ye(i, t, [...r, ...K(o)]);
|
|
359
|
+
}), t(s, r);
|
|
353
360
|
}
|
|
354
|
-
function
|
|
355
|
-
return
|
|
356
|
-
e =
|
|
361
|
+
function hs(e, t, r) {
|
|
362
|
+
return ye(t, (s, n) => {
|
|
363
|
+
e = ge(e, n, (i) => gs(i, s, r));
|
|
357
364
|
}), e;
|
|
358
365
|
}
|
|
359
|
-
function
|
|
360
|
-
function
|
|
361
|
-
const
|
|
362
|
-
s.map(
|
|
363
|
-
e =
|
|
366
|
+
function bs(e, t) {
|
|
367
|
+
function r(s, n) {
|
|
368
|
+
const i = ys(e, K(n));
|
|
369
|
+
s.map(K).forEach((o) => {
|
|
370
|
+
e = ge(e, o, () => i);
|
|
364
371
|
});
|
|
365
372
|
}
|
|
366
|
-
if (
|
|
367
|
-
const [s, n] =
|
|
368
|
-
s.forEach((
|
|
369
|
-
e =
|
|
370
|
-
}), n &&
|
|
373
|
+
if (I(t)) {
|
|
374
|
+
const [s, n] = t;
|
|
375
|
+
s.forEach((i) => {
|
|
376
|
+
e = ge(e, K(i), () => e);
|
|
377
|
+
}), n && V(n, r);
|
|
371
378
|
} else
|
|
372
|
-
|
|
379
|
+
V(t, r);
|
|
373
380
|
return e;
|
|
374
381
|
}
|
|
375
|
-
const
|
|
376
|
-
function
|
|
377
|
-
const s =
|
|
378
|
-
s ? s.push(
|
|
382
|
+
const As = (e, t) => G(e) || I(e) || Y(e) || J(e) || mt(e, t);
|
|
383
|
+
function Fs(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 ws(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(ce) : r[ce(i)] = o.map(ce);
|
|
396
|
+
}), s ? pe(r) ? [s] : [s, r] : pe(r) ? void 0 : r;
|
|
397
|
+
}
|
|
398
|
+
const bt = (e, t, r, s, n = [], i = [], o = /* @__PURE__ */ new Map()) => {
|
|
399
|
+
var b;
|
|
400
|
+
const a = us(e);
|
|
394
401
|
if (!a) {
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
402
|
+
Fs(e, n, t);
|
|
403
|
+
const g = o.get(e);
|
|
404
|
+
if (g)
|
|
398
405
|
return s ? {
|
|
399
406
|
transformedValue: null
|
|
400
|
-
} :
|
|
407
|
+
} : g;
|
|
401
408
|
}
|
|
402
|
-
if (!
|
|
403
|
-
const
|
|
404
|
-
transformedValue:
|
|
405
|
-
annotations: [
|
|
409
|
+
if (!As(e, r)) {
|
|
410
|
+
const g = Ke(e, r), m = g ? {
|
|
411
|
+
transformedValue: g.value,
|
|
412
|
+
annotations: [g.type]
|
|
406
413
|
} : {
|
|
407
414
|
transformedValue: e
|
|
408
415
|
};
|
|
409
|
-
return a ||
|
|
416
|
+
return a || o.set(e, m), m;
|
|
410
417
|
}
|
|
411
|
-
if (
|
|
418
|
+
if (ee(i, e))
|
|
412
419
|
return {
|
|
413
420
|
transformedValue: null
|
|
414
421
|
};
|
|
415
|
-
const u =
|
|
416
|
-
|
|
417
|
-
if (
|
|
418
|
-
throw new Error(`Detected property ${
|
|
419
|
-
const
|
|
420
|
-
p[
|
|
421
|
-
|
|
422
|
+
const u = Ke(e, r), c = (b = u == null ? void 0 : u.value) != null ? b : e, p = I(c) ? [] : {}, l = {};
|
|
423
|
+
V(c, (g, m) => {
|
|
424
|
+
if (m === "__proto__" || m === "constructor" || m === "prototype")
|
|
425
|
+
throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);
|
|
426
|
+
const A = bt(g, t, r, s, [...n, m], [...i, e], o);
|
|
427
|
+
p[m] = A.transformedValue, I(A.annotations) ? l[m] = A.annotations : G(A.annotations) && V(A.annotations, (C, N) => {
|
|
428
|
+
l[ct(m) + "." + N] = C;
|
|
422
429
|
});
|
|
423
430
|
});
|
|
424
|
-
const
|
|
431
|
+
const d = pe(l) ? {
|
|
425
432
|
transformedValue: p,
|
|
426
433
|
annotations: u ? [u.type] : void 0
|
|
427
434
|
} : {
|
|
428
435
|
transformedValue: p,
|
|
429
|
-
annotations: u ? [u.type,
|
|
436
|
+
annotations: u ? [u.type, l] : l
|
|
430
437
|
};
|
|
431
|
-
return a ||
|
|
438
|
+
return a || o.set(e, d), d;
|
|
432
439
|
};
|
|
433
|
-
function
|
|
440
|
+
function At(e) {
|
|
434
441
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
435
442
|
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
443
|
+
function Ge(e) {
|
|
444
|
+
return At(e) === "Array";
|
|
438
445
|
}
|
|
439
|
-
function
|
|
440
|
-
if (
|
|
446
|
+
function Es(e) {
|
|
447
|
+
if (At(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 Cs(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 he(e, t = {}) {
|
|
462
|
+
if (Ge(e))
|
|
463
|
+
return e.map((n) => he(n, t));
|
|
464
|
+
if (!Es(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 (Ge(t.props) && !t.props.includes(i))
|
|
462
469
|
return n;
|
|
463
|
-
const
|
|
464
|
-
return
|
|
470
|
+
const o = e[i], a = he(o, t);
|
|
471
|
+
return Cs(n, i, a, e, t.nonenumerable), n;
|
|
465
472
|
}, {});
|
|
466
473
|
}
|
|
467
|
-
class
|
|
474
|
+
class h {
|
|
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 Hr(), this.symbolRegistry = new ot((r) => {
|
|
473
480
|
var s;
|
|
474
|
-
return (s =
|
|
475
|
-
}), this.customTransformerRegistry = new
|
|
481
|
+
return (s = r.description) != null ? s : "";
|
|
482
|
+
}), this.customTransformerRegistry = new Zr(), this.allowedErrorProps = [], this.dedupe = t;
|
|
476
483
|
}
|
|
477
|
-
serialize(
|
|
478
|
-
const
|
|
484
|
+
serialize(t) {
|
|
485
|
+
const r = /* @__PURE__ */ new Map(), s = bt(t, r, this, this.dedupe), n = {
|
|
479
486
|
json: s.transformedValue
|
|
480
487
|
};
|
|
481
|
-
s.annotations && (n.meta =
|
|
488
|
+
s.annotations && (n.meta = F(y({}, n.meta), {
|
|
482
489
|
values: s.annotations
|
|
483
490
|
}));
|
|
484
|
-
const
|
|
485
|
-
return
|
|
486
|
-
referentialEqualities:
|
|
491
|
+
const i = ws(r, this.dedupe);
|
|
492
|
+
return i && (n.meta = F(y({}, 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 = he(r);
|
|
499
|
+
return s != null && s.values && (n = hs(n, s.values, this)), s != null && s.referentialEqualities && (n = bs(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(
|
|
507
|
-
this.customTransformerRegistry.register(
|
|
508
|
-
name:
|
|
509
|
-
},
|
|
513
|
+
registerCustom(t, r) {
|
|
514
|
+
this.customTransformerRegistry.register(y({
|
|
515
|
+
name: r
|
|
516
|
+
}, t));
|
|
510
517
|
}
|
|
511
|
-
allowErrorProps(...
|
|
512
|
-
this.allowedErrorProps.push(...
|
|
518
|
+
allowErrorProps(...t) {
|
|
519
|
+
this.allowedErrorProps.push(...t);
|
|
513
520
|
}
|
|
514
521
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const
|
|
522
|
+
h.defaultInstance = new h();
|
|
523
|
+
h.serialize = h.defaultInstance.serialize.bind(h.defaultInstance);
|
|
524
|
+
h.deserialize = h.defaultInstance.deserialize.bind(h.defaultInstance);
|
|
525
|
+
h.stringify = h.defaultInstance.stringify.bind(h.defaultInstance);
|
|
526
|
+
h.parse = h.defaultInstance.parse.bind(h.defaultInstance);
|
|
527
|
+
h.registerClass = h.defaultInstance.registerClass.bind(h.defaultInstance);
|
|
528
|
+
h.registerSymbol = h.defaultInstance.registerSymbol.bind(h.defaultInstance);
|
|
529
|
+
h.registerCustom = h.defaultInstance.registerCustom.bind(h.defaultInstance);
|
|
530
|
+
h.allowErrorProps = h.defaultInstance.allowErrorProps.bind(h.defaultInstance);
|
|
531
|
+
const z = (e) => e === void 0 ? B.None : e, Ts = (e) => new Jt(e.metadataItem, e.type), Ee = (e) => new dr(
|
|
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
|
+
), Ce = (e) => new mr(
|
|
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
|
+
), O = (e) => {
|
|
542
549
|
switch (e.__serializable) {
|
|
543
550
|
case "DimensionalAttribute":
|
|
544
|
-
return
|
|
551
|
+
return Ee(e);
|
|
545
552
|
case "DimensionalLevelAttribute":
|
|
546
|
-
return
|
|
553
|
+
return Ce(e);
|
|
547
554
|
default:
|
|
548
555
|
return e;
|
|
549
556
|
}
|
|
550
|
-
},
|
|
557
|
+
}, Ft = (e) => new jr(
|
|
551
558
|
e.name,
|
|
552
559
|
e.expression,
|
|
553
|
-
e.attributes.map(
|
|
554
|
-
e.dimensions.map(
|
|
560
|
+
e.attributes.map(O),
|
|
561
|
+
e.dimensions.map(qs),
|
|
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 ? O(e.defaultAttribute) : void 0
|
|
568
|
+
), wt = (e) => new Kr(
|
|
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
|
+
), qs = (e) => {
|
|
569
578
|
switch (e.__serializable) {
|
|
570
579
|
case "DimensionalDimension":
|
|
571
|
-
return
|
|
580
|
+
return Ft(e);
|
|
572
581
|
case "DimensionalDateDimension":
|
|
573
|
-
return
|
|
582
|
+
return wt(e);
|
|
574
583
|
default:
|
|
575
584
|
return e;
|
|
576
585
|
}
|
|
577
|
-
},
|
|
586
|
+
}, Te = (e) => new pr(
|
|
578
587
|
e.name,
|
|
579
|
-
|
|
588
|
+
O(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
|
+
), qe = (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, Ee(s)];
|
|
593
602
|
case "DimensionalLevelAttribute":
|
|
594
|
-
return [
|
|
603
|
+
return [r, Ce(s)];
|
|
595
604
|
case "DimensionalBaseMeasure":
|
|
596
|
-
return [
|
|
605
|
+
return [r, Te(s)];
|
|
597
606
|
case "DimensionalCalculatedMeasure":
|
|
598
|
-
return [
|
|
607
|
+
return [r, qe(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 gr(
|
|
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
|
+
}, Et = (e) => new yr(
|
|
616
625
|
e.name,
|
|
617
|
-
|
|
626
|
+
O(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
|
+
), le = (e) => {
|
|
624
633
|
switch (e.__serializable) {
|
|
625
634
|
case "DimensionalBaseMeasure":
|
|
626
|
-
return
|
|
635
|
+
return Te(e);
|
|
627
636
|
case "DimensionalCalculatedMeasure":
|
|
628
|
-
return
|
|
637
|
+
return qe(e);
|
|
629
638
|
case "DimensionalMeasureTemplate":
|
|
630
|
-
return
|
|
639
|
+
return Et(e);
|
|
631
640
|
default:
|
|
632
641
|
return e;
|
|
633
642
|
}
|
|
634
|
-
},
|
|
643
|
+
}, T = (e) => {
|
|
635
644
|
switch (e.__serializable) {
|
|
636
645
|
case "MembersFilter":
|
|
637
|
-
return new
|
|
638
|
-
|
|
646
|
+
return new Sr(
|
|
647
|
+
O(e.attribute),
|
|
639
648
|
e.members,
|
|
640
|
-
e.config.backgroundFilter ?
|
|
649
|
+
e.config.backgroundFilter ? F(y({}, e.config), { backgroundFilter: T(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 $r(
|
|
654
|
+
e.filters.map((r) => T(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 xr(
|
|
661
|
+
e._filters.map((r) => T(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 qr(
|
|
667
|
+
T(e.filter),
|
|
668
|
+
e.input ? T(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 Tr(
|
|
674
|
+
O(e.attribute),
|
|
675
|
+
le(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 Cr(
|
|
685
|
+
O(e.attribute),
|
|
686
|
+
le(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 Er(
|
|
694
|
+
le(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 wr(
|
|
702
|
+
O(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 Fr(
|
|
712
|
+
O(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 Ar(
|
|
721
|
+
O(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 br(
|
|
730
|
+
O(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 hr(
|
|
740
|
+
O(e.attribute),
|
|
732
741
|
e.jaqlExpression,
|
|
733
742
|
e.config,
|
|
734
743
|
e.composeCode
|
|
@@ -737,438 +746,751 @@ 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
|
+
h.registerCustom(
|
|
741
750
|
{
|
|
742
|
-
isApplicable:
|
|
751
|
+
isApplicable: Yt,
|
|
743
752
|
serialize: (e) => e.serialize(),
|
|
744
|
-
deserialize: (e) =>
|
|
753
|
+
deserialize: (e) => Ts(e)
|
|
745
754
|
},
|
|
746
755
|
"JaqlElement"
|
|
747
756
|
);
|
|
748
|
-
|
|
757
|
+
h.registerCustom(
|
|
749
758
|
{
|
|
750
|
-
isApplicable:
|
|
759
|
+
isApplicable: Ht,
|
|
751
760
|
serialize: (e) => e.serialize(),
|
|
752
|
-
deserialize: (e) =>
|
|
761
|
+
deserialize: (e) => Ee(e)
|
|
753
762
|
},
|
|
754
763
|
"DimensionalAttribute"
|
|
755
764
|
);
|
|
756
|
-
|
|
765
|
+
h.registerCustom(
|
|
757
766
|
{
|
|
758
|
-
isApplicable:
|
|
767
|
+
isApplicable: Qt,
|
|
759
768
|
serialize: (e) => e.serialize(),
|
|
760
|
-
deserialize: (e) =>
|
|
769
|
+
deserialize: (e) => Ce(e)
|
|
761
770
|
},
|
|
762
771
|
"DimensionalLevelAttribute"
|
|
763
772
|
);
|
|
764
|
-
|
|
773
|
+
h.registerCustom(
|
|
765
774
|
{
|
|
766
|
-
isApplicable:
|
|
775
|
+
isApplicable: Vr,
|
|
767
776
|
serialize: (e) => e.serialize(),
|
|
768
|
-
deserialize: (e) =>
|
|
777
|
+
deserialize: (e) => Ft(e)
|
|
769
778
|
},
|
|
770
779
|
"DimensionalDimension"
|
|
771
780
|
);
|
|
772
|
-
|
|
781
|
+
h.registerCustom(
|
|
773
782
|
{
|
|
774
|
-
isApplicable:
|
|
783
|
+
isApplicable: Wr,
|
|
775
784
|
serialize: (e) => e.serialize(),
|
|
776
|
-
deserialize: (e) =>
|
|
785
|
+
deserialize: (e) => wt(e)
|
|
777
786
|
},
|
|
778
787
|
"DimensionalDateDimension"
|
|
779
788
|
);
|
|
780
|
-
|
|
789
|
+
h.registerCustom(
|
|
781
790
|
{
|
|
782
|
-
isApplicable:
|
|
791
|
+
isApplicable: Xt,
|
|
783
792
|
serialize: (e) => e.serialize(),
|
|
784
|
-
deserialize: (e) =>
|
|
793
|
+
deserialize: (e) => Te(e)
|
|
785
794
|
},
|
|
786
795
|
"DimensionalBaseMeasure"
|
|
787
796
|
);
|
|
788
|
-
|
|
797
|
+
h.registerCustom(
|
|
789
798
|
{
|
|
790
|
-
isApplicable:
|
|
799
|
+
isApplicable: Zt,
|
|
791
800
|
serialize: (e) => e.serialize(),
|
|
792
|
-
deserialize: (e) =>
|
|
801
|
+
deserialize: (e) => qe(e)
|
|
793
802
|
},
|
|
794
803
|
"DimensionalCalculatedMeasure"
|
|
795
804
|
);
|
|
796
|
-
|
|
805
|
+
h.registerCustom(
|
|
797
806
|
{
|
|
798
|
-
isApplicable:
|
|
807
|
+
isApplicable: er,
|
|
799
808
|
serialize: (e) => e.serialize(),
|
|
800
|
-
deserialize: (e) =>
|
|
809
|
+
deserialize: (e) => Et(e)
|
|
801
810
|
},
|
|
802
811
|
"DimensionalMeasureTemplate"
|
|
803
812
|
);
|
|
804
|
-
|
|
813
|
+
h.registerCustom(
|
|
805
814
|
{
|
|
806
|
-
isApplicable:
|
|
815
|
+
isApplicable: Fe,
|
|
807
816
|
serialize: (e) => e.serialize(),
|
|
808
|
-
deserialize: (e) =>
|
|
817
|
+
deserialize: (e) => T(e)
|
|
809
818
|
},
|
|
810
819
|
"MembersFilter"
|
|
811
820
|
);
|
|
812
|
-
|
|
821
|
+
h.registerCustom(
|
|
813
822
|
{
|
|
814
|
-
isApplicable:
|
|
823
|
+
isApplicable: tr,
|
|
815
824
|
serialize: (e) => e.serialize(),
|
|
816
|
-
deserialize: (e) =>
|
|
825
|
+
deserialize: (e) => T(e)
|
|
817
826
|
},
|
|
818
827
|
"LogicalAttributeFilter"
|
|
819
828
|
);
|
|
820
|
-
|
|
829
|
+
h.registerCustom(
|
|
821
830
|
{
|
|
822
|
-
isApplicable:
|
|
831
|
+
isApplicable: rr,
|
|
823
832
|
serialize: (e) => e.serialize(),
|
|
824
|
-
deserialize: (e) =>
|
|
833
|
+
deserialize: (e) => T(e)
|
|
825
834
|
},
|
|
826
835
|
"CascadingFilter"
|
|
827
836
|
);
|
|
828
|
-
|
|
837
|
+
h.registerCustom(
|
|
829
838
|
{
|
|
830
|
-
isApplicable:
|
|
839
|
+
isApplicable: sr,
|
|
831
840
|
serialize: (e) => e.serialize(),
|
|
832
|
-
deserialize: (e) =>
|
|
841
|
+
deserialize: (e) => T(e)
|
|
833
842
|
},
|
|
834
843
|
"ExcludeFilter"
|
|
835
844
|
);
|
|
836
|
-
|
|
845
|
+
h.registerCustom(
|
|
837
846
|
{
|
|
838
|
-
isApplicable:
|
|
847
|
+
isApplicable: nr,
|
|
839
848
|
serialize: (e) => e.serialize(),
|
|
840
|
-
deserialize: (e) =>
|
|
849
|
+
deserialize: (e) => T(e)
|
|
841
850
|
},
|
|
842
851
|
"MeasureFilter"
|
|
843
852
|
);
|
|
844
|
-
|
|
853
|
+
h.registerCustom(
|
|
845
854
|
{
|
|
846
|
-
isApplicable:
|
|
855
|
+
isApplicable: ir,
|
|
847
856
|
serialize: (e) => e.serialize(),
|
|
848
|
-
deserialize: (e) =>
|
|
857
|
+
deserialize: (e) => T(e)
|
|
849
858
|
},
|
|
850
859
|
"RankingFilter"
|
|
851
860
|
);
|
|
852
|
-
|
|
861
|
+
h.registerCustom(
|
|
853
862
|
{
|
|
854
|
-
isApplicable:
|
|
863
|
+
isApplicable: or,
|
|
855
864
|
serialize: (e) => e.serialize(),
|
|
856
|
-
deserialize: (e) =>
|
|
865
|
+
deserialize: (e) => T(e)
|
|
857
866
|
},
|
|
858
867
|
"MeasureRankingFilter"
|
|
859
868
|
);
|
|
860
|
-
|
|
869
|
+
h.registerCustom(
|
|
861
870
|
{
|
|
862
|
-
isApplicable:
|
|
871
|
+
isApplicable: ar,
|
|
863
872
|
serialize: (e) => e.serialize(),
|
|
864
|
-
deserialize: (e) =>
|
|
873
|
+
deserialize: (e) => T(e)
|
|
865
874
|
},
|
|
866
875
|
"NumericFilter"
|
|
867
876
|
);
|
|
868
|
-
|
|
877
|
+
h.registerCustom(
|
|
869
878
|
{
|
|
870
|
-
isApplicable:
|
|
879
|
+
isApplicable: ur,
|
|
871
880
|
serialize: (e) => e.serialize(),
|
|
872
|
-
deserialize: (e) =>
|
|
881
|
+
deserialize: (e) => T(e)
|
|
873
882
|
},
|
|
874
883
|
"TextFilter"
|
|
875
884
|
);
|
|
876
|
-
|
|
885
|
+
h.registerCustom(
|
|
877
886
|
{
|
|
878
|
-
isApplicable:
|
|
887
|
+
isApplicable: cr,
|
|
879
888
|
serialize: (e) => e.serialize(),
|
|
880
|
-
deserialize: (e) =>
|
|
889
|
+
deserialize: (e) => T(e)
|
|
881
890
|
},
|
|
882
891
|
"DateRangeFilter"
|
|
883
892
|
);
|
|
884
|
-
|
|
893
|
+
h.registerCustom(
|
|
885
894
|
{
|
|
886
|
-
isApplicable:
|
|
895
|
+
isApplicable: lr,
|
|
887
896
|
serialize: (e) => e.serialize(),
|
|
888
|
-
deserialize: (e) =>
|
|
897
|
+
deserialize: (e) => T(e)
|
|
889
898
|
},
|
|
890
899
|
"RelativeDateFilter"
|
|
891
900
|
);
|
|
892
|
-
|
|
901
|
+
h.registerCustom(
|
|
893
902
|
{
|
|
894
|
-
isApplicable:
|
|
903
|
+
isApplicable: fr,
|
|
895
904
|
serialize: (e) => e.serialize(),
|
|
896
|
-
deserialize: (e) =>
|
|
905
|
+
deserialize: (e) => T(e)
|
|
897
906
|
},
|
|
898
907
|
"CustomFilter"
|
|
899
908
|
);
|
|
900
|
-
const
|
|
901
|
-
function
|
|
909
|
+
const ni = h, E = "DM.";
|
|
910
|
+
function S(e) {
|
|
911
|
+
return typeof e == "object" && e !== null;
|
|
912
|
+
}
|
|
913
|
+
function q(e) {
|
|
902
914
|
return typeof e == "object" && e !== null && "function" in e && "args" in e;
|
|
903
915
|
}
|
|
904
|
-
function
|
|
905
|
-
return e.every(
|
|
916
|
+
function Ct(e) {
|
|
917
|
+
return e.every(q);
|
|
906
918
|
}
|
|
907
|
-
function
|
|
919
|
+
function oe(e) {
|
|
908
920
|
return "attribute" in e && "config" in e;
|
|
909
921
|
}
|
|
910
|
-
function
|
|
922
|
+
function Z(e) {
|
|
911
923
|
return "left" in e && "right" in e && "operator" in e;
|
|
912
924
|
}
|
|
913
|
-
function
|
|
914
|
-
return !
|
|
915
|
-
}
|
|
916
|
-
function It(e) {
|
|
917
|
-
return typeof e == "object" && e !== null && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
|
|
925
|
+
function xe(e) {
|
|
926
|
+
return !oe(e) && !Z(e);
|
|
918
927
|
}
|
|
919
|
-
function
|
|
920
|
-
|
|
921
|
-
return typeof e != "object" || e === null || r === null || !("column" in r) ? !1 : E(r.column);
|
|
928
|
+
function xs(e) {
|
|
929
|
+
return S(e) && "column" in e && typeof e.column == "string" && !("function" in e && "args" in e);
|
|
922
930
|
}
|
|
923
|
-
function
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
931
|
+
function $s(e) {
|
|
932
|
+
return !S(e) || !("column" in e) ? !1 : q(e.column);
|
|
933
|
+
}
|
|
934
|
+
const x = 3;
|
|
935
|
+
function R(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 = Yr(e, o);
|
|
940
|
+
a < s && (s = a, n = i);
|
|
941
|
+
}
|
|
942
|
+
return n !== void 0 ? { best: n, distance: s } : void 0;
|
|
943
|
+
}
|
|
944
|
+
const Tt = "en";
|
|
945
|
+
function fe(e, t) {
|
|
946
|
+
return e.localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
|
|
947
|
+
}
|
|
948
|
+
function Ye(e, t) {
|
|
949
|
+
return t.length <= e.length && e.slice(0, t.length).localeCompare(t, Tt, { sensitivity: "accent" }) === 0;
|
|
950
|
+
}
|
|
951
|
+
function $e(e) {
|
|
952
|
+
const t = [...e].sort((i, o) => o.name.length - i.name.length), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
953
|
+
for (const i of e) {
|
|
954
|
+
r.set(i.name, i);
|
|
955
|
+
const o = [...i.columns].sort((u, c) => c.name.length - u.name.length);
|
|
956
|
+
n.set(i.name, o);
|
|
929
957
|
const a = /* @__PURE__ */ new Map();
|
|
930
|
-
for (const u of
|
|
958
|
+
for (const u of i.columns)
|
|
931
959
|
a.set(u.name, u);
|
|
932
|
-
s.set(
|
|
960
|
+
s.set(i.name, a);
|
|
933
961
|
}
|
|
934
962
|
return {
|
|
935
|
-
sortedTables:
|
|
963
|
+
sortedTables: t,
|
|
936
964
|
tableColumnMap: n,
|
|
937
|
-
tableMap:
|
|
965
|
+
tableMap: r,
|
|
938
966
|
columnMap: s
|
|
939
967
|
};
|
|
940
968
|
}
|
|
941
|
-
function
|
|
942
|
-
if (!e.startsWith(
|
|
969
|
+
function Se(e, t) {
|
|
970
|
+
if (!e.startsWith(E))
|
|
943
971
|
throw new Error(
|
|
944
|
-
`Invalid dimensional element name format:
|
|
972
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
945
973
|
);
|
|
946
|
-
const
|
|
947
|
-
if (!
|
|
974
|
+
const r = e.slice(E.length);
|
|
975
|
+
if (!r)
|
|
948
976
|
throw new Error(
|
|
949
|
-
`Invalid dimensional element name format:
|
|
977
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
950
978
|
);
|
|
951
979
|
let s, n;
|
|
952
|
-
for (const m of
|
|
953
|
-
if (
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
980
|
+
for (const m of t.sortedTables)
|
|
981
|
+
if (Ye(r, m.name + ".")) {
|
|
982
|
+
const A = r.slice(m.name.length + 1);
|
|
983
|
+
if (!A)
|
|
956
984
|
throw new Error(
|
|
957
|
-
`Invalid dimensional element name format:
|
|
985
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
958
986
|
);
|
|
959
|
-
s = m, n =
|
|
987
|
+
s = m, n = A;
|
|
960
988
|
break;
|
|
961
989
|
}
|
|
962
990
|
if (!s) {
|
|
963
|
-
const m =
|
|
991
|
+
const m = r.indexOf(".");
|
|
964
992
|
if (m === -1)
|
|
965
993
|
throw new Error(
|
|
966
|
-
`Invalid dimensional element name format:
|
|
994
|
+
`Invalid dimensional element name format: '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
967
995
|
);
|
|
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 m of
|
|
977
|
-
if (n
|
|
996
|
+
const A = r.slice(0, m), C = R(A, t.sortedTables, (ue) => ue.name), N = C && C.distance <= x ? ` Did you mean '${C.best.name}'?` : "";
|
|
997
|
+
throw new Error(`Table '${A}' not found in the data model.${N}`);
|
|
998
|
+
}
|
|
999
|
+
const i = t.tableColumnMap.get(s.name);
|
|
1000
|
+
if (!i)
|
|
1001
|
+
throw new Error(`Table '${s.name}' found but has no columns`);
|
|
1002
|
+
let o, a;
|
|
1003
|
+
const u = $.all;
|
|
1004
|
+
for (const m of i) {
|
|
1005
|
+
if (fe(n, m.name))
|
|
978
1006
|
return { table: s, column: m };
|
|
979
|
-
if (!n
|
|
1007
|
+
if (!Ye(n, m.name + "."))
|
|
980
1008
|
continue;
|
|
981
|
-
const
|
|
982
|
-
if (!
|
|
1009
|
+
const A = n.slice(m.name.length + 1);
|
|
1010
|
+
if (!A)
|
|
983
1011
|
continue;
|
|
984
|
-
const
|
|
985
|
-
if (
|
|
986
|
-
if (
|
|
987
|
-
return { table: s, column: m, level:
|
|
988
|
-
|
|
1012
|
+
const C = u.includes(A), N = X(m.dataType);
|
|
1013
|
+
if (C) {
|
|
1014
|
+
if (N)
|
|
1015
|
+
return { table: s, column: m, level: A };
|
|
1016
|
+
o || (o = m, a = A);
|
|
989
1017
|
continue;
|
|
990
1018
|
}
|
|
991
|
-
|
|
1019
|
+
N && !o && (o = m, a = A);
|
|
992
1020
|
}
|
|
993
|
-
if (
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1021
|
+
if (o && a) {
|
|
1022
|
+
if (u.includes(a))
|
|
1023
|
+
throw new Error(
|
|
1024
|
+
`Invalid date level '${a}' in dimensional element '${e}'. Column '${s.name}.${o.name}' is not a datetime column`
|
|
1025
|
+
);
|
|
1026
|
+
const m = R(a, u, (C) => C), A = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
|
|
1027
|
+
throw new Error(
|
|
1028
|
+
`Invalid date level '${a}' in dimensional element '${e}'. Valid levels are: ${u.join(
|
|
998
1029
|
", "
|
|
999
|
-
)}`
|
|
1030
|
+
)}.${A}`
|
|
1000
1031
|
);
|
|
1001
|
-
|
|
1002
|
-
|
|
1032
|
+
}
|
|
1033
|
+
const c = n.indexOf("."), p = c === -1 ? n : n.slice(0, c), l = R(n, i, (m) => m.name), d = l && l.distance <= x && !fe(l.best.name, p), b = d ? ` Did you mean '${l.best.name}'?` : "", g = !d && n.endsWith(".") && l !== void 0 && fe(l.best.name, p) ? ` Use '${p}' without a trailing dot.` : "";
|
|
1034
|
+
throw new Error(
|
|
1035
|
+
`Column '${p}' not found in table '${s.name}'.${b}${g}`
|
|
1036
|
+
);
|
|
1003
1037
|
}
|
|
1004
|
-
function
|
|
1005
|
-
const { table:
|
|
1038
|
+
function Ss(e, t) {
|
|
1039
|
+
const { table: r, column: s, level: n } = Se(e, t);
|
|
1006
1040
|
if (n) {
|
|
1007
|
-
if (!
|
|
1041
|
+
if (!X(s.dataType))
|
|
1008
1042
|
throw new Error(
|
|
1009
|
-
`Invalid date level
|
|
1043
|
+
`Invalid date level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is not a datetime column`
|
|
1010
1044
|
);
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1045
|
+
const i = $.all;
|
|
1046
|
+
if (!i.includes(n))
|
|
1013
1047
|
throw new Error(
|
|
1014
|
-
`Invalid date level
|
|
1048
|
+
`Invalid date level '${n}' in dimensional element '${e}'. Valid levels are: ${i.join(
|
|
1015
1049
|
", "
|
|
1016
1050
|
)}`
|
|
1017
1051
|
);
|
|
1018
|
-
const
|
|
1019
|
-
if (s.dataType === "date" && !
|
|
1052
|
+
const o = $.dateOnly;
|
|
1053
|
+
if (s.dataType === "date" && !o.includes(n))
|
|
1020
1054
|
throw new Error(
|
|
1021
|
-
`Invalid level
|
|
1055
|
+
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a date column, not a datetime column`
|
|
1022
1056
|
);
|
|
1023
|
-
const a =
|
|
1057
|
+
const a = $.timeOnly;
|
|
1024
1058
|
if (s.dataType === "time" && !a.includes(n))
|
|
1025
1059
|
throw new Error(
|
|
1026
|
-
`Invalid level
|
|
1060
|
+
`Invalid level '${n}' in dimensional element '${e}'. Column '${r.name}.${s.name}' is only a time column, not a date column`
|
|
1027
1061
|
);
|
|
1028
1062
|
}
|
|
1029
|
-
return { column: s, level: n };
|
|
1063
|
+
return { table: r, column: s, level: n };
|
|
1030
1064
|
}
|
|
1031
|
-
function
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1065
|
+
function H(e, t, r, s) {
|
|
1066
|
+
const { table: n, column: i, level: o } = Ss(e, r);
|
|
1067
|
+
let a = o;
|
|
1068
|
+
if (X(i.dataType) && a === void 0 && (s != null && s.inferredDateLevel)) {
|
|
1069
|
+
const u = s.inferredDateLevel, c = $.all;
|
|
1070
|
+
if (!c.includes(u))
|
|
1071
|
+
throw new Error(
|
|
1072
|
+
`Invalid inferred date level '${u}'. Valid levels are: ${c.join(", ")}`
|
|
1073
|
+
);
|
|
1074
|
+
const p = `${e}.${u}`, l = $.dateOnly;
|
|
1075
|
+
if (i.dataType === "date" && !l.includes(u))
|
|
1076
|
+
throw new Error(
|
|
1077
|
+
`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a date column, not a datetime column`
|
|
1078
|
+
);
|
|
1079
|
+
const d = $.timeOnly;
|
|
1080
|
+
if (i.dataType === "time" && !d.includes(u))
|
|
1081
|
+
throw new Error(
|
|
1082
|
+
`Invalid level '${u}' in dimensional element '${p}'. Column '${n.name}.${i.name}' is only a time column, not a date column`
|
|
1083
|
+
);
|
|
1084
|
+
a = u;
|
|
1085
|
+
}
|
|
1086
|
+
return Or({
|
|
1087
|
+
expression: i.expression,
|
|
1088
|
+
dataType: i.dataType,
|
|
1089
|
+
granularity: a,
|
|
1052
1090
|
format: void 0,
|
|
1053
1091
|
sort: void 0,
|
|
1054
|
-
dataSource:
|
|
1092
|
+
dataSource: t
|
|
1055
1093
|
});
|
|
1056
1094
|
}
|
|
1057
|
-
function
|
|
1058
|
-
const { column: s, level: n } =
|
|
1095
|
+
function Os(e, t, r) {
|
|
1096
|
+
const { column: s, level: n } = Se(e, r);
|
|
1059
1097
|
if (n)
|
|
1060
1098
|
throw new Error(
|
|
1061
|
-
`Invalid DateDimension name format:
|
|
1099
|
+
`Invalid DateDimension name format: '${e}'. Expected format: '${E}TableName.ColumnName'`
|
|
1062
1100
|
);
|
|
1063
|
-
if (!
|
|
1101
|
+
if (!X(s.dataType))
|
|
1064
1102
|
throw new Error(
|
|
1065
|
-
`Invalid DateDimension name
|
|
1103
|
+
`Invalid DateDimension name '${e}'. Column '${s.name}' is not a datetime column (got ${s.dataType}).`
|
|
1066
1104
|
);
|
|
1067
|
-
return
|
|
1105
|
+
return Gr({
|
|
1068
1106
|
name: s.name,
|
|
1069
1107
|
expression: s.expression,
|
|
1070
|
-
dataSource:
|
|
1108
|
+
dataSource: t
|
|
1071
1109
|
});
|
|
1072
1110
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
}
|
|
1088
|
-
const
|
|
1089
|
-
return
|
|
1090
|
-
},
|
|
1091
|
-
error:
|
|
1092
|
-
message:
|
|
1111
|
+
const Ds = (e, t) => {
|
|
1112
|
+
if (!e) return;
|
|
1113
|
+
const r = typeof e == "object" ? e.direction : e;
|
|
1114
|
+
if (!se(r))
|
|
1115
|
+
return F(y({}, t), {
|
|
1116
|
+
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${r}'.`
|
|
1117
|
+
});
|
|
1118
|
+
}, Ms = (e, t, r, s) => {
|
|
1119
|
+
const n = Ds(e.sortType, s);
|
|
1120
|
+
if (n)
|
|
1121
|
+
return {
|
|
1122
|
+
attribute: H(e.column, t, r),
|
|
1123
|
+
style: {},
|
|
1124
|
+
error: n
|
|
1125
|
+
};
|
|
1126
|
+
const i = H(e.column, t, r), o = _(e, "column");
|
|
1127
|
+
return { attribute: i, style: o };
|
|
1128
|
+
}, Ns = (e, t, r, s) => typeof e == "string" ? { attribute: H(e, t, r) } : xs(e) ? Ms(e, t, r, s) : {
|
|
1129
|
+
error: F(y({}, s), {
|
|
1130
|
+
message: "Invalid dimension item. Expected a string (composeCode) or object with 'column' and optional 'sortType'."
|
|
1093
1131
|
})
|
|
1094
|
-
},
|
|
1095
|
-
const { data:
|
|
1096
|
-
if (!
|
|
1132
|
+
}, qt = (e) => {
|
|
1133
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
1134
|
+
if (!t)
|
|
1097
1135
|
return { success: !0, data: [] };
|
|
1098
|
-
if (!Array.isArray(
|
|
1136
|
+
if (!Array.isArray(t))
|
|
1099
1137
|
return {
|
|
1100
1138
|
success: !1,
|
|
1101
1139
|
errors: [
|
|
1102
1140
|
{
|
|
1103
1141
|
category: "dimensions",
|
|
1104
1142
|
index: -1,
|
|
1105
|
-
input:
|
|
1143
|
+
input: t,
|
|
1106
1144
|
message: "Invalid dimensions JSON. Expected an array."
|
|
1107
1145
|
}
|
|
1108
1146
|
]
|
|
1109
1147
|
};
|
|
1110
|
-
const n = [],
|
|
1111
|
-
return
|
|
1148
|
+
const n = [], i = [];
|
|
1149
|
+
return t.forEach((o, a) => {
|
|
1112
1150
|
const u = {
|
|
1113
1151
|
category: "dimensions",
|
|
1114
1152
|
index: a,
|
|
1115
|
-
input:
|
|
1153
|
+
input: o
|
|
1116
1154
|
};
|
|
1117
1155
|
try {
|
|
1118
|
-
const c =
|
|
1156
|
+
const c = Ns(o, r, s, u);
|
|
1119
1157
|
if (c.error) {
|
|
1120
|
-
|
|
1158
|
+
i.push(c.error);
|
|
1121
1159
|
return;
|
|
1122
1160
|
}
|
|
1123
|
-
c.attribute && n.push(
|
|
1161
|
+
c.attribute && n.push(
|
|
1162
|
+
c.style !== void 0 ? { attribute: c.attribute, style: c.style } : { attribute: c.attribute }
|
|
1163
|
+
);
|
|
1124
1164
|
} catch (c) {
|
|
1125
1165
|
const p = c instanceof Error ? c.message : "Unknown error";
|
|
1126
|
-
|
|
1166
|
+
i.push(F(y({}, u), { message: p }));
|
|
1127
1167
|
}
|
|
1128
|
-
}),
|
|
1168
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
1129
1169
|
};
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1132
|
-
if (typeof
|
|
1133
|
-
throw new Error(`Function
|
|
1134
|
-
return
|
|
1170
|
+
function Oe(e, t) {
|
|
1171
|
+
const r = Reflect.get(e, t);
|
|
1172
|
+
if (typeof r != "function")
|
|
1173
|
+
throw new Error(`Function '${t}' not found or is not a function`);
|
|
1174
|
+
return r;
|
|
1135
1175
|
}
|
|
1136
|
-
function
|
|
1137
|
-
const
|
|
1138
|
-
if (!
|
|
1139
|
-
throw new Error(`Function
|
|
1176
|
+
function Rs(e, t) {
|
|
1177
|
+
const r = e.replace("measureFactory.", ""), n = Oe(Dr, r)(...t);
|
|
1178
|
+
if (!xe(n))
|
|
1179
|
+
throw new Error(`Function '${e}' did not return a valid Measure`);
|
|
1140
1180
|
return n;
|
|
1141
1181
|
}
|
|
1142
|
-
function
|
|
1143
|
-
const
|
|
1144
|
-
if (!
|
|
1145
|
-
throw new Error(`Function
|
|
1182
|
+
function vs(e, t) {
|
|
1183
|
+
const r = e.replace("filterFactory.logic.", ""), n = Oe(Mr, r)(...t);
|
|
1184
|
+
if (!Z(n))
|
|
1185
|
+
throw new Error(`Function '${e}' did not return a valid FilterRelations`);
|
|
1146
1186
|
return n;
|
|
1147
1187
|
}
|
|
1148
|
-
function
|
|
1188
|
+
function Is(e, t) {
|
|
1149
1189
|
if (e.startsWith("filterFactory.logic."))
|
|
1150
|
-
return
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1153
|
-
throw new Error(`Function
|
|
1190
|
+
return vs(e, t);
|
|
1191
|
+
const r = e.replace("filterFactory.", ""), n = Oe(Nr, r)(...t);
|
|
1192
|
+
if (!oe(n) && !Z(n))
|
|
1193
|
+
throw new Error(`Function '${e}' did not return a valid Filter or FilterRelations`);
|
|
1154
1194
|
return n;
|
|
1155
1195
|
}
|
|
1156
|
-
function
|
|
1196
|
+
function Ps(e, t) {
|
|
1157
1197
|
const s = e.split(".")[0];
|
|
1158
1198
|
if (s === "measureFactory")
|
|
1159
|
-
return
|
|
1199
|
+
return Rs(e, t);
|
|
1160
1200
|
if (s === "filterFactory")
|
|
1161
|
-
return
|
|
1201
|
+
return Is(e, t);
|
|
1162
1202
|
throw new Error(
|
|
1163
|
-
`Unsupported factory:
|
|
1203
|
+
`Unsupported factory: '${s}'. Supported factories: measureFactory, filterFactory`
|
|
1164
1204
|
);
|
|
1165
1205
|
}
|
|
1166
|
-
const
|
|
1206
|
+
const f = (e, t, r, s) => y({ category: e, minArgs: t, maxArgs: r }, s), ks = /* @__PURE__ */ new Set([
|
|
1207
|
+
"CORREL",
|
|
1208
|
+
"COVARP",
|
|
1209
|
+
"COVAR",
|
|
1210
|
+
"EXPONDIST",
|
|
1211
|
+
"INTERCEPT",
|
|
1212
|
+
"LARGEST",
|
|
1213
|
+
"NORMDIST",
|
|
1214
|
+
"POISSONDIST",
|
|
1215
|
+
"SKEWP",
|
|
1216
|
+
"SKEW",
|
|
1217
|
+
"SLOPE",
|
|
1218
|
+
"TDIST",
|
|
1219
|
+
"COSH",
|
|
1220
|
+
"SINH",
|
|
1221
|
+
"TANH",
|
|
1222
|
+
"ORDERING",
|
|
1223
|
+
"RDOUBLE",
|
|
1224
|
+
"RINT"
|
|
1225
|
+
]), te = {
|
|
1226
|
+
// ── X-diff (datetime difference operators) ──
|
|
1227
|
+
SDIFF: f("xdiff", 2, 2, {
|
|
1228
|
+
requiredDateLevel: $.Seconds,
|
|
1229
|
+
argType: "datetime"
|
|
1230
|
+
}),
|
|
1231
|
+
MNDIFF: f("xdiff", 2, 2, {
|
|
1232
|
+
requiredDateLevel: $.Minutes,
|
|
1233
|
+
argType: "datetime"
|
|
1234
|
+
}),
|
|
1235
|
+
HDIFF: f("xdiff", 2, 2, {
|
|
1236
|
+
requiredDateLevel: $.Hours,
|
|
1237
|
+
argType: "datetime"
|
|
1238
|
+
}),
|
|
1239
|
+
DDIFF: f("xdiff", 2, 2, {
|
|
1240
|
+
requiredDateLevel: $.Days,
|
|
1241
|
+
argType: "datetime"
|
|
1242
|
+
}),
|
|
1243
|
+
MDIFF: f("xdiff", 2, 2, {
|
|
1244
|
+
requiredDateLevel: $.Months,
|
|
1245
|
+
argType: "datetime"
|
|
1246
|
+
}),
|
|
1247
|
+
QDIFF: f("xdiff", 2, 2, {
|
|
1248
|
+
requiredDateLevel: $.Quarters,
|
|
1249
|
+
argType: "datetime"
|
|
1250
|
+
}),
|
|
1251
|
+
YDIFF: f("xdiff", 2, 2, {
|
|
1252
|
+
requiredDateLevel: $.Years,
|
|
1253
|
+
argType: "datetime"
|
|
1254
|
+
}),
|
|
1255
|
+
// ── Aggregation ──
|
|
1256
|
+
ANYVALUE: f("aggregative", 1, 1),
|
|
1257
|
+
SUM: f("aggregative", 1, 2),
|
|
1258
|
+
AVG: f("aggregative", 1, 2),
|
|
1259
|
+
MIN: f("aggregative", 1, 2),
|
|
1260
|
+
MAX: f("aggregative", 1, 2),
|
|
1261
|
+
COUNT: f("aggregative", 1, 2),
|
|
1262
|
+
DUPCOUNT: f("aggregative", 1, 1),
|
|
1263
|
+
COUNTDUPLICATES: f("aggregative", 1, 1),
|
|
1264
|
+
STDEV: f("aggregative", 1, 2),
|
|
1265
|
+
STDEVP: f("aggregative", 1, 2),
|
|
1266
|
+
VAR: f("aggregative", 1, 2),
|
|
1267
|
+
VARP: f("aggregative", 1, 2),
|
|
1268
|
+
MEDIAN: f("aggregative", 1, 2),
|
|
1269
|
+
QUARTILE: f("aggregative", 2, 3),
|
|
1270
|
+
PERCENTILE: f("aggregative", 2, 3),
|
|
1271
|
+
LOWERWHISKERMAX_IQR: f("aggregative", 1, 1),
|
|
1272
|
+
LOWERWHISKERMAX_STDEVP: f("aggregative", 1, 1),
|
|
1273
|
+
UPPERWHISKERMIN_IQR: f("aggregative", 1, 1),
|
|
1274
|
+
UPPERWHISKERMIN_STDEVP: f("aggregative", 1, 1),
|
|
1275
|
+
OUTLIERSCOUNT_IQR: f("aggregative", 1, 1),
|
|
1276
|
+
OUTLIERSCOUNT_STDEVP: f("aggregative", 1, 1),
|
|
1277
|
+
MODE: f("aggregative", 1, 1),
|
|
1278
|
+
NOAGGFUNCTION: f("aggregative", 1, 1),
|
|
1279
|
+
// ── Window ──
|
|
1280
|
+
RANK: f("window", 0, Number.POSITIVE_INFINITY),
|
|
1281
|
+
RSUM: f("window", 1, 2),
|
|
1282
|
+
RAVG: f("window", 1, 2),
|
|
1283
|
+
YTDSUM: f("window", 1, 1),
|
|
1284
|
+
QTDSUM: f("window", 1, 1),
|
|
1285
|
+
MTDSUM: f("window", 1, 1),
|
|
1286
|
+
WTDSUM: f("window", 1, 1),
|
|
1287
|
+
YTDAVG: f("window", 1, 1),
|
|
1288
|
+
QTDAVG: f("window", 1, 1),
|
|
1289
|
+
MTDAVG: f("window", 1, 1),
|
|
1290
|
+
WTDAVG: f("window", 1, 1),
|
|
1291
|
+
// ── String ──
|
|
1292
|
+
CONCAT: f("string", 2, Number.POSITIVE_INFINITY),
|
|
1293
|
+
LEFT: f("string", 2, 2),
|
|
1294
|
+
RIGHT: f("string", 2, 2),
|
|
1295
|
+
// ── Scalar / math ──
|
|
1296
|
+
ABS: f("scalar", 1, 1),
|
|
1297
|
+
ACOS: f("scalar", 1, 1),
|
|
1298
|
+
ASIN: f("scalar", 1, 1),
|
|
1299
|
+
ATAN: f("scalar", 1, 1),
|
|
1300
|
+
CEILING: f("scalar", 1, 1),
|
|
1301
|
+
CONTRIBUTION: f("scalar", 1, 1),
|
|
1302
|
+
COS: f("scalar", 1, 1),
|
|
1303
|
+
COT: f("scalar", 1, 1),
|
|
1304
|
+
DIFFPASTDAY: f("scalar", 1, 1),
|
|
1305
|
+
DIFFPASTMONTH: f("scalar", 1, 1),
|
|
1306
|
+
DIFFPASTPERIOD: f("scalar", 1, 1),
|
|
1307
|
+
DIFFPASTQUARTER: f("scalar", 1, 1),
|
|
1308
|
+
DIFFPASTWEEK: f("scalar", 1, 1),
|
|
1309
|
+
DIFFPASTYEAR: f("scalar", 1, 1),
|
|
1310
|
+
EXP: f("scalar", 1, 1),
|
|
1311
|
+
FLOOR: f("scalar", 1, 1),
|
|
1312
|
+
GROWTH: f("growth", 1, 1),
|
|
1313
|
+
GROWTHPASTMONTH: f("growth", 1, 1),
|
|
1314
|
+
GROWTHPASTQUARTER: f("growth", 1, 1),
|
|
1315
|
+
GROWTHPASTWEEK: f("growth", 1, 1),
|
|
1316
|
+
GROWTHPASTYEAR: f("growth", 1, 1),
|
|
1317
|
+
GROWTHRATE: f("growth", 1, 1),
|
|
1318
|
+
LN: f("scalar", 1, 1),
|
|
1319
|
+
LOG10: f("scalar", 1, 1),
|
|
1320
|
+
MINUS: f("scalar", 1, 1),
|
|
1321
|
+
MOD: f("scalar", 2, 2),
|
|
1322
|
+
QUOTIENT: f("scalar", 2, 2),
|
|
1323
|
+
PASTDAY: f("date", 1, 2),
|
|
1324
|
+
PASTMONTH: f("date", 1, 2),
|
|
1325
|
+
PASTPERIOD: f("date", 1, 2),
|
|
1326
|
+
PASTQUARTER: f("date", 1, 2),
|
|
1327
|
+
PASTWEEK: f("date", 1, 2),
|
|
1328
|
+
PASTYEAR: f("date", 1, 2),
|
|
1329
|
+
PERCENTILEDISCFORINTERNALUSEONLY: f("scalar", 1, 1),
|
|
1330
|
+
PERCENTILECONTFORINTERNALUSEONLY: f("scalar", 1, 1),
|
|
1331
|
+
POWER: f("scalar", 2, 2),
|
|
1332
|
+
ROUND: f("scalar", 2, 2),
|
|
1333
|
+
SIN: f("scalar", 1, 1),
|
|
1334
|
+
SQRT: f("scalar", 1, 1),
|
|
1335
|
+
TAN: f("scalar", 1, 1)
|
|
1336
|
+
}, Bs = Object.keys(te).filter(
|
|
1337
|
+
(e) => te[e].category === "xdiff"
|
|
1338
|
+
);
|
|
1339
|
+
function xt() {
|
|
1340
|
+
return Bs;
|
|
1341
|
+
}
|
|
1342
|
+
function $t(e) {
|
|
1343
|
+
const t = te[e.toUpperCase()];
|
|
1344
|
+
return t == null ? void 0 : t.requiredDateLevel;
|
|
1345
|
+
}
|
|
1346
|
+
function zs(e, t) {
|
|
1347
|
+
return e === t ? e === 1 ? "1 parameter" : `${e} parameters` : t === Number.POSITIVE_INFINITY ? e <= 1 ? "any number of parameters" : `at least ${e} parameters` : `${e} or ${t} parameters`;
|
|
1348
|
+
}
|
|
1349
|
+
function De(e, t) {
|
|
1350
|
+
const r = [];
|
|
1351
|
+
let s = "", n = 0, i = !1, o = null;
|
|
1352
|
+
for (let a = 0; a < e.length; a++) {
|
|
1353
|
+
const u = e[a], c = e[a + 1];
|
|
1354
|
+
if (i) {
|
|
1355
|
+
if (u !== o) {
|
|
1356
|
+
s += u;
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
if (c === o) {
|
|
1360
|
+
s += u + c, a++;
|
|
1361
|
+
continue;
|
|
1362
|
+
}
|
|
1363
|
+
i = !1, o = null, s += u;
|
|
1364
|
+
continue;
|
|
1365
|
+
} else {
|
|
1366
|
+
if (u === "'" || u === '"') {
|
|
1367
|
+
i = !0, o = u, s += u;
|
|
1368
|
+
continue;
|
|
1369
|
+
}
|
|
1370
|
+
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === t && n === 0) {
|
|
1371
|
+
r.push(s.trim()), s = "";
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
s += u;
|
|
1376
|
+
}
|
|
1377
|
+
return s.trim() && r.push(s.trim()), r;
|
|
1378
|
+
}
|
|
1379
|
+
function Ls(e, t) {
|
|
1380
|
+
let r = 0, s = !1, n = null;
|
|
1381
|
+
for (let i = 0; i < e.length; i++) {
|
|
1382
|
+
const o = e[i], a = e[i + 1];
|
|
1383
|
+
if (s) {
|
|
1384
|
+
if (o !== n) continue;
|
|
1385
|
+
if (a === n) {
|
|
1386
|
+
i++;
|
|
1387
|
+
continue;
|
|
1388
|
+
}
|
|
1389
|
+
s = !1, n = null;
|
|
1390
|
+
} else {
|
|
1391
|
+
if (o === "'" || o === '"') {
|
|
1392
|
+
s = !0, n = o;
|
|
1393
|
+
continue;
|
|
1394
|
+
}
|
|
1395
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && r--, o === t && r === 0) return i;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
return -1;
|
|
1399
|
+
}
|
|
1400
|
+
function Us(e, t) {
|
|
1401
|
+
if (e[t] !== "(") return -1;
|
|
1402
|
+
let r = 1, s = t + 1, n = !1, i = null;
|
|
1403
|
+
for (; s < e.length; ) {
|
|
1404
|
+
const o = e[s], a = e[s + 1];
|
|
1405
|
+
if (n) {
|
|
1406
|
+
if (o !== i) {
|
|
1407
|
+
s++;
|
|
1408
|
+
continue;
|
|
1409
|
+
}
|
|
1410
|
+
if (a === i) {
|
|
1411
|
+
s += 2;
|
|
1412
|
+
continue;
|
|
1413
|
+
}
|
|
1414
|
+
n = !1, i = null, s++;
|
|
1415
|
+
} else {
|
|
1416
|
+
if (o === "'" || o === '"') {
|
|
1417
|
+
n = !0, i = o, s++;
|
|
1418
|
+
continue;
|
|
1419
|
+
}
|
|
1420
|
+
if ("([{".includes(o) && r++, ")]}".includes(o) && --r === 0) return s;
|
|
1421
|
+
s++;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return -1;
|
|
1425
|
+
}
|
|
1426
|
+
function _s(e) {
|
|
1427
|
+
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
1428
|
+
}
|
|
1429
|
+
function W(e) {
|
|
1430
|
+
if (!e || typeof e != "string")
|
|
1431
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
1432
|
+
const t = e.trim();
|
|
1433
|
+
if (!t)
|
|
1434
|
+
throw new Error("Invalid composeCode: empty string");
|
|
1435
|
+
const r = t.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
1436
|
+
if (!r)
|
|
1437
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${t}'`);
|
|
1438
|
+
const s = r[1], n = r[2], i = St(n);
|
|
1439
|
+
return {
|
|
1440
|
+
function: s,
|
|
1441
|
+
args: i
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
function St(e) {
|
|
1445
|
+
return e.trim() ? De(e, ",").map(Ot) : [];
|
|
1446
|
+
}
|
|
1447
|
+
function Ot(e) {
|
|
1448
|
+
if (!e)
|
|
1449
|
+
throw new Error("Cannot parse empty argument value");
|
|
1450
|
+
if (e === "null")
|
|
1451
|
+
return null;
|
|
1452
|
+
if (e === "undefined")
|
|
1453
|
+
return;
|
|
1454
|
+
if (e === "true")
|
|
1455
|
+
return !0;
|
|
1456
|
+
if (e === "false")
|
|
1457
|
+
return !1;
|
|
1458
|
+
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
1459
|
+
return parseFloat(e);
|
|
1460
|
+
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
1461
|
+
const r = e[0];
|
|
1462
|
+
return e.slice(1, -1).replace(new RegExp(`${r}${r}`, "g"), r);
|
|
1463
|
+
}
|
|
1464
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
1465
|
+
const r = e.slice(1, -1).trim();
|
|
1466
|
+
if (!r)
|
|
1467
|
+
return [];
|
|
1468
|
+
const s = St(r);
|
|
1469
|
+
return s.every((n) => typeof n == "string"), s;
|
|
1470
|
+
}
|
|
1471
|
+
if (e.startsWith("{") && e.endsWith("}")) {
|
|
1472
|
+
const r = e.slice(1, -1).trim();
|
|
1473
|
+
return r ? Ws(r) : {};
|
|
1474
|
+
}
|
|
1475
|
+
return e.includes("(") && e.includes(")") ? W(e) : (e.startsWith("DM."), e);
|
|
1476
|
+
}
|
|
1477
|
+
function Vs(e) {
|
|
1478
|
+
const t = Ls(e, ":");
|
|
1479
|
+
if (t === -1)
|
|
1480
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);
|
|
1481
|
+
const r = _s(e.slice(0, t).trim()), s = Ot(e.slice(t + 1).trim());
|
|
1482
|
+
return [r, s];
|
|
1483
|
+
}
|
|
1484
|
+
function Ws(e) {
|
|
1485
|
+
if (!e.trim()) return {};
|
|
1486
|
+
const t = De(e, ",").map(Vs).filter(([, r]) => r !== null);
|
|
1487
|
+
return Object.fromEntries(t);
|
|
1488
|
+
}
|
|
1489
|
+
const js = /\[(\w[\w.-]*)\]/g, Dt = /* @__PURE__ */ new Set([
|
|
1167
1490
|
// Universal – Aggregative (per Sisense doc: (A) only; Statistical CONTRIBUTION, PERCENTILE, etc. are non-aggregative)
|
|
1168
1491
|
"AVG",
|
|
1169
1492
|
"COUNT",
|
|
1170
1493
|
"DUPCOUNT",
|
|
1171
|
-
"LARGEST",
|
|
1172
1494
|
"MAX",
|
|
1173
1495
|
"MEDIAN",
|
|
1174
1496
|
"MIN",
|
|
@@ -1182,236 +1504,395 @@ const Yt = /\[(\w[\w.-]*)\]/g, Qe = /* @__PURE__ */ new Set([
|
|
|
1182
1504
|
"QTDAVG",
|
|
1183
1505
|
"QTDSUM",
|
|
1184
1506
|
"YTDAVG",
|
|
1185
|
-
"YTDSUM"
|
|
1507
|
+
"YTDSUM"
|
|
1186
1508
|
// RAVG, RSUM are non-aggregative per Sisense doc (Other Functions, not (A))
|
|
1187
|
-
//
|
|
1188
|
-
|
|
1189
|
-
"
|
|
1190
|
-
"COVAR",
|
|
1191
|
-
"SKEWP",
|
|
1192
|
-
"SKEW",
|
|
1193
|
-
"SLOPE"
|
|
1194
|
-
]), Ht = new RegExp(
|
|
1195
|
-
`\\b(${Array.from(Qe).join("|")})\\s*\\(`,
|
|
1509
|
+
// CORREL, COVAR*, SKEW*, SLOPE, LARGEST are unsupported in custom formulas (see UNSUPPORTED_FORMULA_FUNCTIONS).
|
|
1510
|
+
]), Ks = new RegExp(
|
|
1511
|
+
`\\b(${Array.from(Dt).join("|")})\\s*\\(`,
|
|
1196
1512
|
"i"
|
|
1197
1513
|
);
|
|
1198
|
-
function
|
|
1199
|
-
return
|
|
1514
|
+
function Mt(e) {
|
|
1515
|
+
return q(e) ? !0 : typeof e == "string" && e.startsWith(E) ? !1 : S(e) && "kind" in e ? e.kind === "measure" : !0;
|
|
1200
1516
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const
|
|
1517
|
+
function Gs(e) {
|
|
1518
|
+
const t = /\b(\w+)\s*\(/g, r = /* @__PURE__ */ new Set();
|
|
1203
1519
|
let s;
|
|
1204
|
-
for (; (s =
|
|
1520
|
+
for (; (s = t.exec(e)) !== null; ) {
|
|
1205
1521
|
const n = s[1];
|
|
1206
|
-
|
|
1522
|
+
Dt.has(n.toUpperCase()) || r.add(n);
|
|
1207
1523
|
}
|
|
1208
|
-
return Array.from(
|
|
1524
|
+
return Array.from(r);
|
|
1209
1525
|
}
|
|
1210
|
-
function
|
|
1211
|
-
return e.length === 1 ? `[${e[0]}]` : e.map((
|
|
1526
|
+
function Ys(e) {
|
|
1527
|
+
return e.length === 1 ? `[${e[0]}]` : e.map((t) => `[${t}]`).join(", ");
|
|
1212
1528
|
}
|
|
1213
|
-
function
|
|
1529
|
+
function Js(e) {
|
|
1214
1530
|
return e.length === 0 ? "" : e.length === 1 ? `${e[0]} is not an aggregative function. ` : `${e.join(", ")} are not aggregative functions. `;
|
|
1215
1531
|
}
|
|
1216
|
-
const
|
|
1217
|
-
function
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1532
|
+
const j = (e) => e.startsWith("[") ? e : `[${e}]`, Nt = (e) => e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e;
|
|
1533
|
+
function Rt(e, t) {
|
|
1534
|
+
if (t.length === 0) return [];
|
|
1535
|
+
const r = t.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), s = new RegExp(
|
|
1536
|
+
`\\b(${r})\\s*\\(\\s*\\[([^\\]]+)\\]\\s*,\\s*\\[([^\\]]+)\\]\\s*\\)`,
|
|
1537
|
+
"gi"
|
|
1538
|
+
);
|
|
1539
|
+
return [...e.matchAll(s)].map((n) => ({
|
|
1540
|
+
functionName: n[1].toUpperCase(),
|
|
1541
|
+
ref1: n[2].trim(),
|
|
1542
|
+
ref2: n[3].trim()
|
|
1543
|
+
}));
|
|
1544
|
+
}
|
|
1545
|
+
function Hs(e, t, r) {
|
|
1546
|
+
var o, a, u;
|
|
1547
|
+
const s = Object.keys(t), n = ((o = r.errorPrefix) != null ? o : "customFormula validation").trim(), i = n === "" ? "" : n.endsWith(" ") ? n : `${n} `;
|
|
1548
|
+
return {
|
|
1549
|
+
formula: e,
|
|
1550
|
+
context: t,
|
|
1551
|
+
contextKeys: s,
|
|
1552
|
+
canonicalContextKeys: new Set(s.map(j)),
|
|
1553
|
+
errorPrefix: i,
|
|
1554
|
+
warnUnusedContext: (a = r.warnUnusedContext) != null ? a : !0,
|
|
1555
|
+
errorOnUnusedContext: (u = r.errorOnUnusedContext) != null ? u : !0,
|
|
1556
|
+
schemaIndex: r.schemaIndex,
|
|
1557
|
+
result: { isValid: !0, errors: [], warnings: [], references: [], unusedContextKeys: [] }
|
|
1229
1558
|
};
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
)
|
|
1559
|
+
}
|
|
1560
|
+
function M(e, t) {
|
|
1561
|
+
e.result.errors.push(t), e.result.isValid = !1;
|
|
1562
|
+
}
|
|
1563
|
+
const Qs = /* @__PURE__ */ new Set(["CASE", "WHEN", "THEN", "ELSE", "END", "AND", "OR"]);
|
|
1564
|
+
function Xs(e) {
|
|
1565
|
+
const t = /\b(\w+)\s*\[/gi, r = [...e.formula.matchAll(t)].find(
|
|
1566
|
+
(s) => !Qs.has(s[1].toUpperCase())
|
|
1567
|
+
);
|
|
1568
|
+
r && M(
|
|
1569
|
+
e,
|
|
1570
|
+
`${e.errorPrefix}args[1]: Invalid syntax: '${r[1]}' - operator cannot be used before bracket reference without parentheses`
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
function Zs(e, t) {
|
|
1574
|
+
const r = e[t];
|
|
1575
|
+
let s = t + 1;
|
|
1576
|
+
for (; s < e.length; ) {
|
|
1577
|
+
const n = e[s], i = e[s + 1];
|
|
1578
|
+
if (n !== r) {
|
|
1579
|
+
s++;
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
if (i === r) {
|
|
1583
|
+
s += 2;
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
return s + 1;
|
|
1587
|
+
}
|
|
1588
|
+
return e.length;
|
|
1589
|
+
}
|
|
1590
|
+
function en(e) {
|
|
1591
|
+
return De(e, ",").filter((t) => t.trim().length > 0).length;
|
|
1592
|
+
}
|
|
1593
|
+
function tn(e, t, r, s) {
|
|
1594
|
+
for (; t < e.length && /\s/.test(e[t]); )
|
|
1595
|
+
t++;
|
|
1596
|
+
if (e[t] !== "(")
|
|
1597
|
+
return t;
|
|
1598
|
+
const n = t, i = Us(e, n);
|
|
1599
|
+
if (i === -1)
|
|
1600
|
+
return n + 1;
|
|
1601
|
+
const o = e.slice(n + 1, i);
|
|
1602
|
+
return s.push({ name: r.toUpperCase(), argCount: en(o) }), s.push(...vt(o)), i + 1;
|
|
1603
|
+
}
|
|
1604
|
+
function vt(e) {
|
|
1605
|
+
const t = [];
|
|
1606
|
+
let r = 0;
|
|
1607
|
+
for (; r < e.length; ) {
|
|
1608
|
+
const s = e[r];
|
|
1609
|
+
if (s === "'" || s === '"') {
|
|
1610
|
+
r = Zs(e, r);
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
if (/[A-Za-z_]/.test(s)) {
|
|
1614
|
+
const n = r;
|
|
1615
|
+
for (r++; r < e.length && /[A-Za-z0-9_]/.test(e[r]); )
|
|
1616
|
+
r++;
|
|
1617
|
+
const i = e.slice(n, r);
|
|
1618
|
+
r = tn(e, r, i, t);
|
|
1619
|
+
continue;
|
|
1620
|
+
}
|
|
1621
|
+
r++;
|
|
1238
1622
|
}
|
|
1239
|
-
|
|
1623
|
+
return t;
|
|
1624
|
+
}
|
|
1625
|
+
function rn(e) {
|
|
1626
|
+
const t = vt(e.formula), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
1627
|
+
for (const { name: n, argCount: i } of t) {
|
|
1628
|
+
if (ks.has(n)) {
|
|
1629
|
+
r.has(n) || (r.add(n), M(
|
|
1630
|
+
e,
|
|
1631
|
+
`${e.errorPrefix}args[1]: Function ${n} is not supported in custom formulas`
|
|
1632
|
+
));
|
|
1633
|
+
continue;
|
|
1634
|
+
}
|
|
1635
|
+
const o = te[n];
|
|
1636
|
+
if (o && (i < o.minArgs || i > o.maxArgs) && !s.has(n)) {
|
|
1637
|
+
s.add(n);
|
|
1638
|
+
const a = zs(o.minArgs, o.maxArgs);
|
|
1639
|
+
M(e, `${e.errorPrefix}args[1]: Function ${n} accepts ${a}`);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
function sn(e) {
|
|
1644
|
+
return [
|
|
1240
1645
|
...new Set(
|
|
1241
|
-
[...e.matchAll(new RegExp(
|
|
1646
|
+
[...e.matchAll(new RegExp(js.source, "g"))].map((t) => t[1])
|
|
1242
1647
|
)
|
|
1243
1648
|
];
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
), a;
|
|
1249
|
-
if (p.length === 0)
|
|
1250
|
-
return a.errors.push(
|
|
1251
|
-
`${i}args[2]: Context cannot be empty - custom formulas require context definitions`
|
|
1252
|
-
), a.isValid = !1, a;
|
|
1253
|
-
const m = new Set(p.map(B)), y = a.references.filter(
|
|
1254
|
-
(f) => !m.has(B(f))
|
|
1649
|
+
}
|
|
1650
|
+
function nn(e) {
|
|
1651
|
+
const t = e.result.references.filter(
|
|
1652
|
+
(n) => !e.canonicalContextKeys.has(j(n))
|
|
1255
1653
|
);
|
|
1256
|
-
if (
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1654
|
+
if (t.length === 0) return;
|
|
1655
|
+
const r = e.contextKeys.map((n) => `[${Nt(n)}]`).join(", "), s = t.length === 1 ? `Reference [${t[0]}]` : `References [${t.join("], [")}]`;
|
|
1656
|
+
M(
|
|
1657
|
+
e,
|
|
1658
|
+
`${e.errorPrefix}args[1]: ${s} not found in context. Available keys: ${r}`
|
|
1659
|
+
);
|
|
1660
|
+
}
|
|
1661
|
+
function on(e) {
|
|
1662
|
+
if (Ks.test(e.formula)) return;
|
|
1663
|
+
const t = e.result.references.filter((r) => {
|
|
1664
|
+
var n;
|
|
1665
|
+
const s = (n = e.context[j(r)]) != null ? n : e.context[r];
|
|
1666
|
+
return s !== void 0 && !Mt(s);
|
|
1667
|
+
});
|
|
1668
|
+
t.length !== 0 && M(
|
|
1669
|
+
e,
|
|
1670
|
+
`${e.errorPrefix}args[1]: ${Js(
|
|
1671
|
+
Gs(e.formula)
|
|
1672
|
+
)}Bracket reference(s) ${Ys(
|
|
1673
|
+
t
|
|
1674
|
+
)} point to raw attributes and must be wrapped in an aggregative function (e.g. SUM, AVG)`
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
function an(e) {
|
|
1678
|
+
if (!e.warnUnusedContext && !e.errorOnUnusedContext || e.contextKeys.length === 0) return;
|
|
1679
|
+
const t = new Set(e.result.references.map(j)), r = e.contextKeys.filter((i) => !t.has(j(i)));
|
|
1680
|
+
if (e.result.unusedContextKeys = r, r.length === 0) return;
|
|
1681
|
+
const s = r.map((i) => `[${Nt(i)}]`).join(", "), n = `${e.errorPrefix}args[2]: Context keys ${s} are defined but not used in formula`;
|
|
1682
|
+
e.errorOnUnusedContext ? M(e, n) : e.warnUnusedContext && e.result.warnings.push(n);
|
|
1683
|
+
}
|
|
1684
|
+
function Je(e, t, r, s) {
|
|
1685
|
+
var o;
|
|
1686
|
+
const n = (o = s.context[j(e)]) != null ? o : s.context[e];
|
|
1687
|
+
if (n === void 0) return;
|
|
1688
|
+
if (!(typeof n == "string" && n.startsWith(E))) {
|
|
1689
|
+
Mt(n) && M(
|
|
1690
|
+
s,
|
|
1691
|
+
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimension attributes. Reference [${e}] points to a measure; use an attribute (e.g. ${E}Table.Column.Level).`
|
|
1265
1692
|
);
|
|
1693
|
+
return;
|
|
1266
1694
|
}
|
|
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($);
|
|
1695
|
+
if (s.schemaIndex)
|
|
1696
|
+
try {
|
|
1697
|
+
const a = Se(n, s.schemaIndex);
|
|
1698
|
+
X(a.column.dataType) ? r && a.level && a.level !== r && M(
|
|
1699
|
+
s,
|
|
1700
|
+
`${s.errorPrefix}args[1]: ${t.functionName} expects date level '${r}'. Reference [${e}] has level '${a.level}'.`
|
|
1701
|
+
) : M(
|
|
1702
|
+
s,
|
|
1703
|
+
`${s.errorPrefix}args[1]: ${t.functionName} requires datetime dimensions. Reference [${e}] resolves to non-datetime column '${a.column.name}'.`
|
|
1704
|
+
);
|
|
1705
|
+
} catch (a) {
|
|
1706
|
+
const u = a instanceof Error ? a.message : "Unknown error";
|
|
1707
|
+
M(s, `${s.errorPrefix}args[1]: ${t.functionName} reference [${e}]: ${u}`);
|
|
1286
1708
|
}
|
|
1287
|
-
}
|
|
1288
|
-
return a;
|
|
1289
1709
|
}
|
|
1290
|
-
function
|
|
1291
|
-
const
|
|
1710
|
+
function un(e) {
|
|
1711
|
+
const t = xt(), r = Rt(e.formula, t);
|
|
1712
|
+
for (const s of r) {
|
|
1713
|
+
const n = $t(s.functionName);
|
|
1714
|
+
Je(s.ref1, s, n, e), Je(s.ref2, s, n, e);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
function cn(e, t, r = {}) {
|
|
1718
|
+
var n;
|
|
1719
|
+
const s = Hs(e, t, r);
|
|
1720
|
+
return !e || e.trim().length === 0 ? ((n = r.allowEmptyFormula) != null && n || M(s, `${s.errorPrefix}args[1]: Formula cannot be empty`), s.result) : (Xs(s), rn(s), s.result.references = sn(e), s.result.references.length === 0 ? (s.result.warnings.push(
|
|
1721
|
+
`${s.errorPrefix}args[1]: No bracket references found in formula - ensure this is intentional`
|
|
1722
|
+
), s.result) : s.contextKeys.length === 0 ? (M(
|
|
1723
|
+
s,
|
|
1724
|
+
`${s.errorPrefix}args[2]: Context cannot be empty - custom formulas require context definitions`
|
|
1725
|
+
), s.result) : (nn(s), on(s), an(s), un(s), s.result));
|
|
1726
|
+
}
|
|
1727
|
+
function ln(e, t, r = {}) {
|
|
1728
|
+
const s = cn(e, t, r);
|
|
1292
1729
|
if (!s.isValid)
|
|
1293
1730
|
throw new Error(s.errors.join("; "));
|
|
1294
1731
|
s.warnings.length > 0 && console.warn("Formula validation warnings:", s.warnings.join("; "));
|
|
1295
1732
|
}
|
|
1296
|
-
function
|
|
1733
|
+
function fn(e, t) {
|
|
1297
1734
|
if (e.length < 3 || e.length > 5)
|
|
1298
1735
|
throw new Error(
|
|
1299
|
-
`${
|
|
1736
|
+
`${t.pathPrefix}Expected 3, 4, or 5 arguments for customFormula (title, formula, context, format?, description?)`
|
|
1737
|
+
);
|
|
1738
|
+
const r = e[1];
|
|
1739
|
+
if (typeof r != "string")
|
|
1740
|
+
throw new Error(
|
|
1741
|
+
`${t.pathPrefix}args[1]: Expected formula string, got ${typeof r}`
|
|
1742
|
+
);
|
|
1743
|
+
const s = r, n = e[2];
|
|
1744
|
+
if (!S(n))
|
|
1745
|
+
throw new Error(
|
|
1746
|
+
`${t.pathPrefix}args[2]: Expected context object, got ${n === null ? "null" : typeof n}`
|
|
1300
1747
|
);
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
errorPrefix: `${
|
|
1748
|
+
const i = n;
|
|
1749
|
+
ln(s, i, {
|
|
1750
|
+
errorPrefix: `${t.pathPrefix}`,
|
|
1304
1751
|
errorOnUnusedContext: !0,
|
|
1305
1752
|
// Strict validation: all context keys must be used
|
|
1306
|
-
allowEmptyFormula: !1
|
|
1753
|
+
allowEmptyFormula: !1,
|
|
1307
1754
|
// Custom formulas must have content
|
|
1755
|
+
schemaIndex: t.schemaIndex
|
|
1308
1756
|
});
|
|
1309
|
-
const
|
|
1310
|
-
for (const [
|
|
1311
|
-
const
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
data:
|
|
1757
|
+
const o = dn(s), a = {};
|
|
1758
|
+
for (const [u, c] of Object.entries(i)) {
|
|
1759
|
+
const p = `args[2].${u}`;
|
|
1760
|
+
if (q(c))
|
|
1761
|
+
a[`${u}`] = D({
|
|
1762
|
+
data: c,
|
|
1315
1763
|
context: {
|
|
1316
|
-
dataSource:
|
|
1317
|
-
schemaIndex:
|
|
1318
|
-
pathPrefix:
|
|
1764
|
+
dataSource: t.dataSource,
|
|
1765
|
+
schemaIndex: t.schemaIndex,
|
|
1766
|
+
pathPrefix: p
|
|
1319
1767
|
}
|
|
1320
1768
|
});
|
|
1321
|
-
else if (typeof
|
|
1769
|
+
else if (typeof c == "string" && c.startsWith(E)) {
|
|
1770
|
+
const l = u.startsWith("[") && u.endsWith("]") ? u.slice(1, -1) : u, d = o[l];
|
|
1322
1771
|
try {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1772
|
+
a[`${u}`] = H(
|
|
1773
|
+
c,
|
|
1774
|
+
t.dataSource,
|
|
1775
|
+
t.schemaIndex,
|
|
1776
|
+
d !== void 0 ? { inferredDateLevel: d } : void 0
|
|
1327
1777
|
);
|
|
1328
|
-
} catch (
|
|
1329
|
-
const
|
|
1330
|
-
throw new Error(`${
|
|
1778
|
+
} catch (b) {
|
|
1779
|
+
const g = b instanceof Error ? b.message : "Unknown error";
|
|
1780
|
+
throw new Error(`${p}: ${g}`);
|
|
1331
1781
|
}
|
|
1332
|
-
else if (
|
|
1333
|
-
|
|
1782
|
+
} else if (c && typeof c == "object" && "kind" in c)
|
|
1783
|
+
a[`${u}`] = c;
|
|
1334
1784
|
else
|
|
1335
1785
|
throw new Error(
|
|
1336
|
-
`${
|
|
1786
|
+
`${p}: Invalid context value for key '${u}'. Expected a function call or attribute reference (${E}...), but got: ${typeof c}`
|
|
1337
1787
|
);
|
|
1338
1788
|
}
|
|
1339
|
-
e[2] =
|
|
1789
|
+
e[2] = a;
|
|
1340
1790
|
}
|
|
1341
|
-
function
|
|
1342
|
-
const t = e
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1791
|
+
function dn(e) {
|
|
1792
|
+
const t = xt(), r = Rt(e, t), s = {};
|
|
1793
|
+
for (const n of r) {
|
|
1794
|
+
const i = $t(n.functionName);
|
|
1795
|
+
if (i !== void 0)
|
|
1796
|
+
for (const o of [n.ref1, n.ref2]) {
|
|
1797
|
+
const a = s[o];
|
|
1798
|
+
if (a !== void 0 && a !== i)
|
|
1799
|
+
throw new Error(
|
|
1800
|
+
`Reference [${o}] is used in xdiff functions with conflicting date levels ('${a}' and '${i}'). Specify the date level in the context (e.g. DM.Table.Column.${i}).`
|
|
1801
|
+
);
|
|
1802
|
+
s[o] = i;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
return s;
|
|
1806
|
+
}
|
|
1807
|
+
function It(e) {
|
|
1808
|
+
return e.type === U.TextAttribute;
|
|
1809
|
+
}
|
|
1810
|
+
function Pt(e) {
|
|
1811
|
+
return e.type === U.NumericAttribute;
|
|
1812
|
+
}
|
|
1813
|
+
function mn(e) {
|
|
1814
|
+
return e.type === U.DateLevel;
|
|
1815
|
+
}
|
|
1816
|
+
function pn(e) {
|
|
1817
|
+
return It(e) || Pt(e);
|
|
1346
1818
|
}
|
|
1347
|
-
function
|
|
1348
|
-
|
|
1349
|
-
|
|
1819
|
+
function ae(e) {
|
|
1820
|
+
return e.type === U.TextAttribute ? "text" : e.type === U.NumericAttribute ? "numeric" : e.type === U.DateLevel ? "date/datetime" : "unknown";
|
|
1821
|
+
}
|
|
1822
|
+
function Me(e, t) {
|
|
1823
|
+
const r = e[0];
|
|
1824
|
+
if (!r || typeof r != "object" || !("type" in r))
|
|
1825
|
+
throw new Error(`${t.pathPrefix}args[0]: Expected attribute as first argument`);
|
|
1826
|
+
return r;
|
|
1827
|
+
}
|
|
1828
|
+
function He(e, t) {
|
|
1829
|
+
const r = Me(e, t);
|
|
1830
|
+
if (!pn(r))
|
|
1350
1831
|
throw new Error(
|
|
1351
|
-
`${
|
|
1352
|
-
|
|
1832
|
+
`${t.pathPrefix}args[0]: Attribute must be string or numeric type, got ${ae(
|
|
1833
|
+
r
|
|
1353
1834
|
)} attribute`
|
|
1354
1835
|
);
|
|
1355
1836
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const
|
|
1358
|
-
if (!
|
|
1837
|
+
function P(e, t) {
|
|
1838
|
+
const r = Me(e, t);
|
|
1839
|
+
if (!Pt(r))
|
|
1359
1840
|
throw new Error(
|
|
1360
|
-
`${
|
|
1361
|
-
|
|
1841
|
+
`${t.pathPrefix}args[0]: Attribute must be numeric type, got ${ae(
|
|
1842
|
+
r
|
|
1362
1843
|
)} attribute`
|
|
1363
1844
|
);
|
|
1364
1845
|
}
|
|
1365
|
-
function
|
|
1366
|
-
const
|
|
1367
|
-
if (!
|
|
1846
|
+
function k(e, t) {
|
|
1847
|
+
const r = Me(e, t);
|
|
1848
|
+
if (!It(r))
|
|
1368
1849
|
throw new Error(
|
|
1369
|
-
`${
|
|
1370
|
-
|
|
1850
|
+
`${t.pathPrefix}args[0]: Attribute must be string type, got ${ae(
|
|
1851
|
+
r
|
|
1371
1852
|
)} attribute`
|
|
1372
1853
|
);
|
|
1373
1854
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const
|
|
1376
|
-
if (!
|
|
1377
|
-
throw new Error(`${
|
|
1378
|
-
return
|
|
1855
|
+
function gn(e, t) {
|
|
1856
|
+
const r = e[0];
|
|
1857
|
+
if (!r || typeof r != "object" || !("attribute" in r))
|
|
1858
|
+
throw new Error(`${t.pathPrefix}args[0]: Expected filter as first argument`);
|
|
1859
|
+
return r;
|
|
1379
1860
|
}
|
|
1380
|
-
function
|
|
1381
|
-
const
|
|
1382
|
-
if (!
|
|
1861
|
+
function yn(e, t) {
|
|
1862
|
+
const r = gn(e, t);
|
|
1863
|
+
if (!Fe(r))
|
|
1383
1864
|
throw new Error(
|
|
1384
|
-
`${
|
|
1865
|
+
`${t.pathPrefix}args[0]: exclude filter only accepts members filter, got ${r.__serializable || "unknown"} filter`
|
|
1385
1866
|
);
|
|
1386
1867
|
}
|
|
1387
|
-
const
|
|
1388
|
-
"measureFactory.customFormula":
|
|
1868
|
+
const hn = {
|
|
1869
|
+
"measureFactory.customFormula": fn,
|
|
1389
1870
|
// String | Number filters
|
|
1390
|
-
"filterFactory.equals":
|
|
1391
|
-
"filterFactory.doesntEqual":
|
|
1871
|
+
"filterFactory.equals": He,
|
|
1872
|
+
"filterFactory.doesntEqual": He,
|
|
1392
1873
|
// Numeric filters
|
|
1393
|
-
"filterFactory.greaterThan":
|
|
1394
|
-
"filterFactory.greaterThanOrEqual":
|
|
1395
|
-
"filterFactory.lessThan":
|
|
1396
|
-
"filterFactory.lessThanOrEqual":
|
|
1397
|
-
"filterFactory.between":
|
|
1398
|
-
"filterFactory.betweenNotEqual":
|
|
1399
|
-
"filterFactory.numeric":
|
|
1874
|
+
"filterFactory.greaterThan": P,
|
|
1875
|
+
"filterFactory.greaterThanOrEqual": P,
|
|
1876
|
+
"filterFactory.lessThan": P,
|
|
1877
|
+
"filterFactory.lessThanOrEqual": P,
|
|
1878
|
+
"filterFactory.between": P,
|
|
1879
|
+
"filterFactory.betweenNotEqual": P,
|
|
1880
|
+
"filterFactory.numeric": P,
|
|
1400
1881
|
// String filters
|
|
1401
|
-
"filterFactory.contains":
|
|
1402
|
-
"filterFactory.doesntContain":
|
|
1403
|
-
"filterFactory.startsWith":
|
|
1404
|
-
"filterFactory.doesntStartWith":
|
|
1405
|
-
"filterFactory.endsWith":
|
|
1406
|
-
"filterFactory.doesntEndWith":
|
|
1407
|
-
"filterFactory.like":
|
|
1882
|
+
"filterFactory.contains": k,
|
|
1883
|
+
"filterFactory.doesntContain": k,
|
|
1884
|
+
"filterFactory.startsWith": k,
|
|
1885
|
+
"filterFactory.doesntStartWith": k,
|
|
1886
|
+
"filterFactory.endsWith": k,
|
|
1887
|
+
"filterFactory.doesntEndWith": k,
|
|
1888
|
+
"filterFactory.like": k,
|
|
1408
1889
|
// Exclude filter
|
|
1409
|
-
"filterFactory.exclude":
|
|
1890
|
+
"filterFactory.exclude": yn
|
|
1410
1891
|
};
|
|
1411
|
-
function
|
|
1412
|
-
return
|
|
1892
|
+
function bn(e) {
|
|
1893
|
+
return hn[`${e}`];
|
|
1413
1894
|
}
|
|
1414
|
-
const
|
|
1895
|
+
const kt = {
|
|
1415
1896
|
// ==================== MEASURE FACTORY FUNCTIONS ====================
|
|
1416
1897
|
// Basic aggregations
|
|
1417
1898
|
"measureFactory.sum": [
|
|
@@ -1938,656 +2419,610 @@ const us = {
|
|
|
1938
2419
|
{ type: "FilterRelationsNode", required: !0 }
|
|
1939
2420
|
]
|
|
1940
2421
|
};
|
|
1941
|
-
function
|
|
1942
|
-
return
|
|
2422
|
+
function Ne(e) {
|
|
2423
|
+
return kt[`${e}`];
|
|
1943
2424
|
}
|
|
1944
|
-
function
|
|
1945
|
-
const
|
|
1946
|
-
return
|
|
2425
|
+
function An(e) {
|
|
2426
|
+
const t = Ne(e);
|
|
2427
|
+
return t ? t.filter((r) => r.required).length : 0;
|
|
1947
2428
|
}
|
|
1948
|
-
function
|
|
1949
|
-
const
|
|
1950
|
-
return
|
|
2429
|
+
function Fn(e) {
|
|
2430
|
+
const t = Ne(e);
|
|
2431
|
+
return t ? t.length : 0;
|
|
1951
2432
|
}
|
|
1952
|
-
function
|
|
2433
|
+
function wn(e) {
|
|
1953
2434
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}/.test(e))
|
|
1954
2435
|
return !1;
|
|
1955
|
-
const
|
|
1956
|
-
if (isNaN(
|
|
2436
|
+
const r = Date.parse(e);
|
|
2437
|
+
if (isNaN(r) || e.length < 10)
|
|
1957
2438
|
return !1;
|
|
1958
2439
|
const s = new Date(e);
|
|
1959
2440
|
return !isNaN(s.getTime());
|
|
1960
2441
|
}
|
|
1961
|
-
function
|
|
1962
|
-
if (e.startsWith(
|
|
2442
|
+
function de(e, t, r, s) {
|
|
2443
|
+
if (e.startsWith(E))
|
|
1963
2444
|
try {
|
|
1964
|
-
return
|
|
2445
|
+
return H(e, t, r);
|
|
1965
2446
|
} catch (n) {
|
|
1966
|
-
const
|
|
1967
|
-
throw new Error(`${s}: ${
|
|
2447
|
+
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2448
|
+
throw new Error(`${s}: ${i}`);
|
|
1968
2449
|
}
|
|
1969
2450
|
throw new Error(
|
|
1970
|
-
`${s}: Invalid attribute
|
|
2451
|
+
`${s}: Invalid attribute '${e}'. Expected format: '${E}TableName.ColumnName[.Level]'`
|
|
1971
2452
|
);
|
|
1972
2453
|
}
|
|
1973
|
-
function
|
|
1974
|
-
if (e.startsWith(
|
|
2454
|
+
function En(e, t, r, s) {
|
|
2455
|
+
if (e.startsWith(E))
|
|
1975
2456
|
try {
|
|
1976
|
-
return
|
|
2457
|
+
return Os(e, t, r);
|
|
1977
2458
|
} catch (n) {
|
|
1978
|
-
const
|
|
1979
|
-
throw new Error(`${s}: ${
|
|
2459
|
+
const i = n instanceof Error ? n.message : "Unknown error";
|
|
2460
|
+
throw new Error(`${s}: ${i}`);
|
|
1980
2461
|
}
|
|
1981
2462
|
throw new Error(
|
|
1982
|
-
`${s}: Invalid date dimension string
|
|
2463
|
+
`${s}: Invalid date dimension string '${e}'. Expected format: '${E}TableName.ColumnName'`
|
|
1983
2464
|
);
|
|
1984
2465
|
}
|
|
1985
|
-
function
|
|
1986
|
-
const
|
|
1987
|
-
if (
|
|
1988
|
-
if (
|
|
1989
|
-
throw new Error(`${
|
|
2466
|
+
function Cn(e) {
|
|
2467
|
+
const t = e.data, { argSchema: r, dataSource: s, schemaIndex: n, pathPrefix: i } = e.context, o = i;
|
|
2468
|
+
if (t === void 0) {
|
|
2469
|
+
if (r.required)
|
|
2470
|
+
throw new Error(`${o}: Required argument is missing (expected ${r.type})`);
|
|
1990
2471
|
return;
|
|
1991
2472
|
}
|
|
1992
|
-
if (!(
|
|
1993
|
-
switch (
|
|
2473
|
+
if (!(t === null && !r.required))
|
|
2474
|
+
switch (r.type) {
|
|
1994
2475
|
case "string":
|
|
1995
|
-
if (typeof
|
|
1996
|
-
throw new Error(`${
|
|
1997
|
-
return
|
|
2476
|
+
if (typeof t != "string")
|
|
2477
|
+
throw new Error(`${o}: Expected string, got ${typeof t}`);
|
|
2478
|
+
return t;
|
|
1998
2479
|
case "number":
|
|
1999
|
-
if (typeof
|
|
2000
|
-
throw new Error(`${
|
|
2001
|
-
return
|
|
2480
|
+
if (typeof t != "number")
|
|
2481
|
+
throw new Error(`${o}: Expected number, got ${typeof t}`);
|
|
2482
|
+
return t;
|
|
2002
2483
|
case "boolean":
|
|
2003
|
-
if (typeof
|
|
2004
|
-
throw new Error(`${
|
|
2005
|
-
return
|
|
2484
|
+
if (typeof t != "boolean")
|
|
2485
|
+
throw new Error(`${o}: Expected boolean, got ${typeof t}`);
|
|
2486
|
+
return t;
|
|
2006
2487
|
case "string[]":
|
|
2007
|
-
if (!Array.isArray(
|
|
2488
|
+
if (!Array.isArray(t))
|
|
2008
2489
|
throw new Error(
|
|
2009
|
-
`${
|
|
2490
|
+
`${o}: Expected array of strings, got ${typeof t}. Example: ['value1', 'value2']`
|
|
2010
2491
|
);
|
|
2011
|
-
if (!
|
|
2492
|
+
if (!t.every((a) => typeof a == "string"))
|
|
2012
2493
|
throw new Error(
|
|
2013
|
-
`${
|
|
2494
|
+
`${o}: Expected array of strings, but contains non-string values`
|
|
2014
2495
|
);
|
|
2015
|
-
return
|
|
2496
|
+
return t;
|
|
2016
2497
|
case "number[]":
|
|
2017
|
-
if (!Array.isArray(
|
|
2498
|
+
if (!Array.isArray(t))
|
|
2018
2499
|
throw new Error(
|
|
2019
|
-
`${
|
|
2500
|
+
`${o}: Expected array of numbers, got ${typeof t}. Example: [10, 20]`
|
|
2020
2501
|
);
|
|
2021
|
-
if (!
|
|
2502
|
+
if (!t.every((a) => typeof a == "number"))
|
|
2022
2503
|
throw new Error(
|
|
2023
|
-
`${
|
|
2504
|
+
`${o}: Expected array of numbers, but contains non-number values`
|
|
2024
2505
|
);
|
|
2025
|
-
return
|
|
2506
|
+
return t;
|
|
2026
2507
|
case "Attribute":
|
|
2027
|
-
if (typeof
|
|
2508
|
+
if (typeof t != "string")
|
|
2028
2509
|
throw new Error(
|
|
2029
|
-
`${
|
|
2510
|
+
`${o}: Expected attribute string, got ${typeof t}. Example: 'DM.Commerce.Revenue'`
|
|
2030
2511
|
);
|
|
2031
|
-
return
|
|
2512
|
+
return de(t, s, n, o);
|
|
2032
2513
|
case "Attribute[]":
|
|
2033
|
-
if (!Array.isArray(
|
|
2514
|
+
if (!Array.isArray(t))
|
|
2034
2515
|
throw new Error(
|
|
2035
|
-
`${
|
|
2516
|
+
`${o}: Expected array of attributes, got ${typeof t}. Example: ['DM.Commerce.AgeRange']`
|
|
2036
2517
|
);
|
|
2037
|
-
return
|
|
2518
|
+
return t.map((a, u) => {
|
|
2038
2519
|
if (typeof a != "string")
|
|
2039
|
-
throw new Error(`${
|
|
2040
|
-
return
|
|
2520
|
+
throw new Error(`${o}[${u}]: Expected attribute string, got ${typeof a}`);
|
|
2521
|
+
return de(a, s, n, `${o}[${u}]`);
|
|
2041
2522
|
});
|
|
2042
2523
|
case "Measure":
|
|
2043
2524
|
case "BaseMeasure":
|
|
2044
|
-
if (!
|
|
2525
|
+
if (!q(t))
|
|
2045
2526
|
throw new Error(
|
|
2046
|
-
`${
|
|
2527
|
+
`${o}: Expected measure function call, got ${typeof t}. Example: {'function': 'measureFactory.sum', 'args': ['DM.Commerce.Revenue']}`
|
|
2047
2528
|
);
|
|
2048
|
-
return
|
|
2049
|
-
data:
|
|
2050
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2529
|
+
return D({
|
|
2530
|
+
data: t,
|
|
2531
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2051
2532
|
});
|
|
2052
2533
|
case "Measure[]":
|
|
2053
|
-
if (!Array.isArray(
|
|
2534
|
+
if (!Array.isArray(t))
|
|
2054
2535
|
throw new Error(
|
|
2055
|
-
`${
|
|
2536
|
+
`${o}: Expected array of measure function calls, got ${typeof t}`
|
|
2056
2537
|
);
|
|
2057
|
-
return
|
|
2058
|
-
if (!
|
|
2538
|
+
return t.map((a, u) => {
|
|
2539
|
+
if (!q(a))
|
|
2059
2540
|
throw new Error(
|
|
2060
|
-
`${
|
|
2541
|
+
`${o}[${u}]: Expected measure function call, got ${typeof a}`
|
|
2061
2542
|
);
|
|
2062
|
-
return
|
|
2543
|
+
return D({
|
|
2063
2544
|
data: a,
|
|
2064
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2545
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2065
2546
|
});
|
|
2066
2547
|
});
|
|
2067
2548
|
case "Filter":
|
|
2068
|
-
if (!
|
|
2549
|
+
if (!q(t))
|
|
2069
2550
|
throw new Error(
|
|
2070
|
-
`${
|
|
2551
|
+
`${o}: Expected filter function call, got ${typeof t}. Example: {'function': 'filterFactory.contains', 'args': ['DM.Brand.Brand', 'Apple']}`
|
|
2071
2552
|
);
|
|
2072
|
-
return
|
|
2073
|
-
data:
|
|
2074
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2553
|
+
return D({
|
|
2554
|
+
data: t,
|
|
2555
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2075
2556
|
});
|
|
2076
2557
|
case "Filter[]":
|
|
2077
|
-
if (!Array.isArray(
|
|
2558
|
+
if (!Array.isArray(t))
|
|
2078
2559
|
throw new Error(
|
|
2079
|
-
`${
|
|
2560
|
+
`${o}: Expected array of filter function calls, got ${typeof t}`
|
|
2080
2561
|
);
|
|
2081
|
-
return
|
|
2082
|
-
if (!
|
|
2562
|
+
return t.map((a, u) => {
|
|
2563
|
+
if (!q(a))
|
|
2083
2564
|
throw new Error(
|
|
2084
|
-
`${
|
|
2565
|
+
`${o}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2085
2566
|
);
|
|
2086
|
-
return
|
|
2567
|
+
return D({
|
|
2087
2568
|
data: a,
|
|
2088
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2569
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2089
2570
|
});
|
|
2090
2571
|
});
|
|
2091
2572
|
case "FilterRelationsNode":
|
|
2092
|
-
if (Array.isArray(
|
|
2093
|
-
return
|
|
2094
|
-
if (!
|
|
2573
|
+
if (Array.isArray(t))
|
|
2574
|
+
return t.map((a, u) => {
|
|
2575
|
+
if (!q(a))
|
|
2095
2576
|
throw new Error(
|
|
2096
|
-
`${
|
|
2577
|
+
`${o}[${u}]: Expected filter function call, got ${typeof a}`
|
|
2097
2578
|
);
|
|
2098
|
-
return
|
|
2579
|
+
return D({
|
|
2099
2580
|
data: a,
|
|
2100
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix: `${
|
|
2581
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: `${o}[${u}]` }
|
|
2101
2582
|
});
|
|
2102
2583
|
});
|
|
2103
|
-
if (
|
|
2104
|
-
return
|
|
2105
|
-
data:
|
|
2106
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2584
|
+
if (q(t))
|
|
2585
|
+
return D({
|
|
2586
|
+
data: t,
|
|
2587
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2107
2588
|
});
|
|
2108
2589
|
throw new Error(
|
|
2109
|
-
`${
|
|
2590
|
+
`${o}: Expected filter function call or array of filters, got ${typeof t}`
|
|
2110
2591
|
);
|
|
2111
2592
|
case "DateDimension":
|
|
2112
|
-
if (typeof
|
|
2593
|
+
if (typeof t != "string")
|
|
2113
2594
|
throw new Error(
|
|
2114
|
-
`${
|
|
2595
|
+
`${o}: Expected date dimension string, got ${typeof t}. Example: 'DM.Commerce.Date'`
|
|
2115
2596
|
);
|
|
2116
|
-
return
|
|
2597
|
+
return En(t, s, n, o);
|
|
2117
2598
|
case "LevelAttribute": {
|
|
2118
|
-
if (typeof
|
|
2599
|
+
if (typeof t != "string")
|
|
2119
2600
|
throw new Error(
|
|
2120
|
-
`${
|
|
2601
|
+
`${o}: Expected date attribute string, got ${typeof t}. Example: 'DM.Commerce.Date.Years'`
|
|
2121
2602
|
);
|
|
2122
|
-
const a =
|
|
2123
|
-
|
|
2603
|
+
const a = de(
|
|
2604
|
+
t,
|
|
2124
2605
|
s,
|
|
2125
2606
|
n,
|
|
2126
|
-
|
|
2607
|
+
o
|
|
2127
2608
|
);
|
|
2128
|
-
if (!
|
|
2609
|
+
if (!mn(a))
|
|
2129
2610
|
throw new Error(
|
|
2130
|
-
`${
|
|
2611
|
+
`${o}: Attribute must be date/datetime type, got ${ae(
|
|
2131
2612
|
a
|
|
2132
2613
|
)} attribute`
|
|
2133
2614
|
);
|
|
2134
2615
|
return a;
|
|
2135
2616
|
}
|
|
2136
2617
|
case "Measure | number":
|
|
2137
|
-
if (typeof
|
|
2138
|
-
return
|
|
2139
|
-
if (
|
|
2140
|
-
return
|
|
2141
|
-
data:
|
|
2142
|
-
context: { dataSource: s, schemaIndex: n, pathPrefix:
|
|
2618
|
+
if (typeof t == "number")
|
|
2619
|
+
return t;
|
|
2620
|
+
if (q(t))
|
|
2621
|
+
return D({
|
|
2622
|
+
data: t,
|
|
2623
|
+
context: { dataSource: s, schemaIndex: n, pathPrefix: o }
|
|
2143
2624
|
});
|
|
2144
2625
|
throw new Error(
|
|
2145
|
-
`${
|
|
2626
|
+
`${o}: Expected measure function call or number, got ${typeof t}`
|
|
2146
2627
|
);
|
|
2147
2628
|
case "Date | string":
|
|
2148
|
-
if (typeof
|
|
2149
|
-
if (
|
|
2150
|
-
return
|
|
2629
|
+
if (typeof t == "string") {
|
|
2630
|
+
if (wn(t))
|
|
2631
|
+
return t;
|
|
2151
2632
|
throw new Error(
|
|
2152
|
-
`${
|
|
2633
|
+
`${o}: Expected valid ISO date string or Date object, got invalid date string '${t}'`
|
|
2153
2634
|
);
|
|
2154
2635
|
} else {
|
|
2155
|
-
if (
|
|
2156
|
-
return
|
|
2636
|
+
if (t instanceof Date)
|
|
2637
|
+
return t;
|
|
2157
2638
|
throw new Error(
|
|
2158
|
-
`${
|
|
2639
|
+
`${o}: Expected date string or Date object, got ${typeof t}`
|
|
2159
2640
|
);
|
|
2160
2641
|
}
|
|
2161
2642
|
case "string | number":
|
|
2162
|
-
if (typeof
|
|
2163
|
-
return
|
|
2164
|
-
throw new Error(`${
|
|
2643
|
+
if (typeof t == "string" || typeof t == "number")
|
|
2644
|
+
return t;
|
|
2645
|
+
throw new Error(`${o}: Expected string or number, got ${typeof t}`);
|
|
2165
2646
|
case "BaseFilterConfig":
|
|
2166
2647
|
case "MembersFilterConfig":
|
|
2167
2648
|
case "CustomFormulaContext":
|
|
2168
2649
|
case "any":
|
|
2169
|
-
if (
|
|
2170
|
-
throw new Error(`${
|
|
2171
|
-
return
|
|
2650
|
+
if (t == null && r.required)
|
|
2651
|
+
throw new Error(`${o}: Required argument is null/undefined`);
|
|
2652
|
+
return t;
|
|
2172
2653
|
default:
|
|
2173
|
-
return
|
|
2654
|
+
return t;
|
|
2174
2655
|
}
|
|
2175
2656
|
}
|
|
2176
|
-
function
|
|
2177
|
-
const { data:
|
|
2178
|
-
if (!u)
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2657
|
+
function D(e) {
|
|
2658
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s, pathPrefix: n } = e.context, { function: i, args: o } = t, a = n ? `${n}.` : "", u = Ne(i);
|
|
2659
|
+
if (!u) {
|
|
2660
|
+
const g = Object.keys(kt), m = R(i, g, (C) => C), A = m && m.distance <= x ? ` Did you mean '${m.best}'?` : "";
|
|
2661
|
+
throw new Error(
|
|
2662
|
+
`${a}function: Unknown function '${i}'.${A}`
|
|
2663
|
+
);
|
|
2664
|
+
}
|
|
2665
|
+
const c = An(i), p = Fn(i);
|
|
2666
|
+
if (o.length < c)
|
|
2182
2667
|
throw new Error(
|
|
2183
|
-
`${a}function: Expected at least ${c} arguments, got ${
|
|
2668
|
+
`${a}function: Expected at least ${c} arguments, got ${o.length}`
|
|
2184
2669
|
);
|
|
2185
|
-
if (
|
|
2670
|
+
if (o.length > p)
|
|
2186
2671
|
throw new Error(
|
|
2187
|
-
`${a}function: Expected at most ${p} arguments, got ${
|
|
2672
|
+
`${a}function: Expected at most ${p} arguments, got ${o.length}`
|
|
2188
2673
|
);
|
|
2189
|
-
const
|
|
2190
|
-
for (let
|
|
2191
|
-
const
|
|
2192
|
-
if (
|
|
2193
|
-
|
|
2674
|
+
const l = [], d = [];
|
|
2675
|
+
for (let g = 0; g < Math.max(o.length, u.length); g++) {
|
|
2676
|
+
const m = u[`${g}`], A = o[`${g}`], C = a ? `${a}args[${g}]` : `args[${g}]`;
|
|
2677
|
+
if (A === void 0) {
|
|
2678
|
+
m != null && m.required && d.push(`${C}: Missing required argument (expected ${m.type})`);
|
|
2194
2679
|
continue;
|
|
2195
2680
|
}
|
|
2196
|
-
if (!
|
|
2197
|
-
|
|
2681
|
+
if (!m) {
|
|
2682
|
+
d.push(`${C}: Unexpected argument`);
|
|
2198
2683
|
continue;
|
|
2199
2684
|
}
|
|
2200
2685
|
try {
|
|
2201
|
-
const
|
|
2202
|
-
data:
|
|
2686
|
+
const N = Cn({
|
|
2687
|
+
data: A,
|
|
2203
2688
|
context: {
|
|
2204
|
-
dataSource:
|
|
2689
|
+
dataSource: r,
|
|
2205
2690
|
schemaIndex: s,
|
|
2206
|
-
pathPrefix:
|
|
2207
|
-
argSchema:
|
|
2691
|
+
pathPrefix: C,
|
|
2692
|
+
argSchema: m
|
|
2208
2693
|
}
|
|
2209
2694
|
});
|
|
2210
|
-
|
|
2211
|
-
} catch (
|
|
2212
|
-
const
|
|
2213
|
-
|
|
2695
|
+
l.push(N);
|
|
2696
|
+
} catch (N) {
|
|
2697
|
+
const ue = N instanceof Error ? N.message : "Unknown error";
|
|
2698
|
+
d.push(ue);
|
|
2214
2699
|
}
|
|
2215
2700
|
}
|
|
2216
|
-
if (
|
|
2217
|
-
const
|
|
2218
|
-
throw new Error(
|
|
2701
|
+
if (d.length > 0) {
|
|
2702
|
+
const g = d.join("; ");
|
|
2703
|
+
throw new Error(g);
|
|
2219
2704
|
}
|
|
2220
|
-
const
|
|
2221
|
-
if (
|
|
2705
|
+
const b = bn(i);
|
|
2706
|
+
if (b)
|
|
2222
2707
|
try {
|
|
2223
|
-
|
|
2224
|
-
dataSource:
|
|
2708
|
+
b(l, {
|
|
2709
|
+
dataSource: r,
|
|
2225
2710
|
schemaIndex: s,
|
|
2226
2711
|
pathPrefix: a
|
|
2227
2712
|
});
|
|
2228
|
-
} catch (
|
|
2229
|
-
const
|
|
2230
|
-
throw new Error(
|
|
2713
|
+
} catch (g) {
|
|
2714
|
+
const m = g instanceof Error ? g.message : "Unknown validation error";
|
|
2715
|
+
throw new Error(m);
|
|
2231
2716
|
}
|
|
2232
|
-
return
|
|
2717
|
+
return Ps(i, l);
|
|
2233
2718
|
}
|
|
2234
|
-
function
|
|
2235
|
-
const { attribute:
|
|
2236
|
-
if (
|
|
2237
|
-
const { granularity: s } =
|
|
2238
|
-
return
|
|
2719
|
+
function Bt(e) {
|
|
2720
|
+
const { attribute: t, config: r } = e;
|
|
2721
|
+
if (Fe(e) && Rr(t)) {
|
|
2722
|
+
const { granularity: s } = t, n = e.members.map((a) => s === "Years" && !isNaN(Number(a)) ? `${a}-01-01T00:00:00` : a), i = vr(r), o = Object.keys(i).length === 0 ? void 0 : i;
|
|
2723
|
+
return Ir(t, n, o);
|
|
2239
2724
|
}
|
|
2240
2725
|
return e;
|
|
2241
2726
|
}
|
|
2242
|
-
function
|
|
2243
|
-
let
|
|
2244
|
-
for (const
|
|
2245
|
-
|
|
2246
|
-
return
|
|
2727
|
+
function Tn(e) {
|
|
2728
|
+
let t = [];
|
|
2729
|
+
for (const r of e)
|
|
2730
|
+
Z(r) ? t = Ve(r, t) : t = Ve([Bt(r)], t);
|
|
2731
|
+
return t != null ? t : [];
|
|
2247
2732
|
}
|
|
2248
|
-
const
|
|
2249
|
-
const { data:
|
|
2250
|
-
return
|
|
2733
|
+
const qn = (e) => {
|
|
2734
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2735
|
+
return t.forEach((o, a) => {
|
|
2251
2736
|
const u = {
|
|
2252
2737
|
category: "filters",
|
|
2253
2738
|
index: a,
|
|
2254
|
-
input:
|
|
2739
|
+
input: o
|
|
2255
2740
|
};
|
|
2256
2741
|
try {
|
|
2257
|
-
const c =
|
|
2258
|
-
data:
|
|
2259
|
-
context: { dataSource:
|
|
2742
|
+
const c = D({
|
|
2743
|
+
data: o,
|
|
2744
|
+
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2260
2745
|
});
|
|
2261
|
-
!
|
|
2746
|
+
!Z(c) && !oe(c) ? i.push(F(y({}, u), { message: "Invalid filter JSON" })) : n.push(c);
|
|
2262
2747
|
} catch (c) {
|
|
2263
2748
|
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2264
|
-
|
|
2749
|
+
i.push(F(y({}, u), { message: p }));
|
|
2265
2750
|
}
|
|
2266
|
-
}),
|
|
2267
|
-
},
|
|
2268
|
-
const { data:
|
|
2269
|
-
return
|
|
2270
|
-
data:
|
|
2271
|
-
context: { dataSource:
|
|
2751
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: Tn(n) };
|
|
2752
|
+
}, Re = (e) => {
|
|
2753
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2754
|
+
return t ? Ct(t) ? qn({
|
|
2755
|
+
data: t,
|
|
2756
|
+
context: { dataSource: r, schemaIndex: s }
|
|
2272
2757
|
}) : {
|
|
2273
2758
|
success: !1,
|
|
2274
2759
|
errors: [
|
|
2275
2760
|
{
|
|
2276
2761
|
category: "filters",
|
|
2277
2762
|
index: -1,
|
|
2278
|
-
input:
|
|
2279
|
-
message:
|
|
2763
|
+
input: t,
|
|
2764
|
+
message: "Invalid filters JSON. Expected an array of function calls with 'function' and 'args' properties."
|
|
2280
2765
|
}
|
|
2281
2766
|
]
|
|
2282
2767
|
} : { success: !0, data: [] };
|
|
2283
|
-
},
|
|
2284
|
-
const { data:
|
|
2285
|
-
return
|
|
2768
|
+
}, xn = (e) => {
|
|
2769
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context, n = [], i = [];
|
|
2770
|
+
return t.forEach((o, a) => {
|
|
2286
2771
|
const u = {
|
|
2287
2772
|
category: "highlights",
|
|
2288
2773
|
index: a,
|
|
2289
|
-
input:
|
|
2774
|
+
input: o
|
|
2290
2775
|
};
|
|
2291
2776
|
try {
|
|
2292
|
-
const c =
|
|
2293
|
-
data:
|
|
2294
|
-
context: { dataSource:
|
|
2777
|
+
const c = D({
|
|
2778
|
+
data: o,
|
|
2779
|
+
context: { dataSource: r, schemaIndex: s, pathPrefix: "" }
|
|
2295
2780
|
});
|
|
2296
|
-
|
|
2781
|
+
oe(c) ? n.push(Bt(c)) : i.push(F(y({}, u), { message: "Invalid filter JSON" }));
|
|
2297
2782
|
} catch (c) {
|
|
2298
2783
|
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2299
|
-
|
|
2784
|
+
i.push(F(y({}, u), { message: p }));
|
|
2300
2785
|
}
|
|
2301
|
-
}),
|
|
2302
|
-
},
|
|
2303
|
-
const { data:
|
|
2304
|
-
return
|
|
2305
|
-
data:
|
|
2306
|
-
context: { dataSource:
|
|
2786
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2787
|
+
}, ve = (e) => {
|
|
2788
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2789
|
+
return t ? Ct(t) ? xn({
|
|
2790
|
+
data: t,
|
|
2791
|
+
context: { dataSource: r, schemaIndex: s }
|
|
2307
2792
|
}) : {
|
|
2308
2793
|
success: !1,
|
|
2309
2794
|
errors: [
|
|
2310
2795
|
{
|
|
2311
2796
|
category: "highlights",
|
|
2312
2797
|
index: -1,
|
|
2313
|
-
input:
|
|
2314
|
-
message:
|
|
2798
|
+
input: t,
|
|
2799
|
+
message: "Invalid highlights JSON. Expected an array of function calls with 'function' and 'args' properties."
|
|
2315
2800
|
}
|
|
2316
2801
|
]
|
|
2317
2802
|
} : { success: !0, data: [] };
|
|
2318
|
-
},
|
|
2319
|
-
|
|
2803
|
+
}, $n = (e, t) => {
|
|
2804
|
+
if (e && !se(e))
|
|
2805
|
+
return F(y({}, t), {
|
|
2806
|
+
message: `Invalid sort type. Expected 'sortAsc', 'sortDesc', or 'sortNone'. Got: '${e}'.`
|
|
2807
|
+
});
|
|
2808
|
+
}, Sn = (e, t, r) => {
|
|
2809
|
+
const { dataSource: s, schemaIndex: n } = t;
|
|
2320
2810
|
try {
|
|
2321
|
-
const
|
|
2811
|
+
const i = D({
|
|
2322
2812
|
data: e,
|
|
2323
2813
|
context: { dataSource: s, schemaIndex: n, pathPrefix: "" }
|
|
2324
2814
|
});
|
|
2325
|
-
return
|
|
2815
|
+
return xe(i) ? { success: !0, data: i } : {
|
|
2326
2816
|
success: !1,
|
|
2327
|
-
errors: [
|
|
2817
|
+
errors: [F(y({}, r), { message: "Invalid measure JSON" })]
|
|
2328
2818
|
};
|
|
2329
|
-
} catch (
|
|
2330
|
-
const
|
|
2819
|
+
} catch (i) {
|
|
2820
|
+
const o = i instanceof Error ? i.message : "Unknown error";
|
|
2331
2821
|
return {
|
|
2332
2822
|
success: !1,
|
|
2333
|
-
errors: [
|
|
2823
|
+
errors: [F(y({}, r), { message: o })]
|
|
2334
2824
|
};
|
|
2335
2825
|
}
|
|
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({
|
|
2826
|
+
}, On = (e, t, r, s) => {
|
|
2827
|
+
const n = D({
|
|
2343
2828
|
data: e.column,
|
|
2344
|
-
context: { dataSource:
|
|
2829
|
+
context: { dataSource: t, schemaIndex: r, pathPrefix: "" }
|
|
2345
2830
|
});
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2831
|
+
if (!xe(n))
|
|
2832
|
+
return {
|
|
2833
|
+
style: {},
|
|
2834
|
+
error: F(y({}, s), { message: "Invalid measure JSON" })
|
|
2835
|
+
};
|
|
2836
|
+
const i = $n(e.sortType, s);
|
|
2837
|
+
if (i) {
|
|
2838
|
+
const a = _(e, "column");
|
|
2839
|
+
return { measure: n, style: a, error: i };
|
|
2840
|
+
}
|
|
2841
|
+
const o = _(e, "column");
|
|
2842
|
+
return { measure: n, style: o };
|
|
2843
|
+
}, Dn = (e, t, r, s) => {
|
|
2844
|
+
if ($s(e))
|
|
2845
|
+
return On(e, t, r, s);
|
|
2846
|
+
if (q(e)) {
|
|
2847
|
+
const n = Sn(
|
|
2352
2848
|
e,
|
|
2353
|
-
{ dataSource:
|
|
2849
|
+
{ dataSource: t, schemaIndex: r },
|
|
2354
2850
|
s
|
|
2355
2851
|
);
|
|
2356
2852
|
return n.success ? { measure: n.data } : { error: n.errors[0] };
|
|
2357
2853
|
}
|
|
2358
2854
|
return {
|
|
2359
|
-
error:
|
|
2360
|
-
message:
|
|
2855
|
+
error: F(y({}, s), {
|
|
2856
|
+
message: "Invalid measure item. Expected a function call (function/args) or object with 'column' and optional 'sortType'."
|
|
2361
2857
|
})
|
|
2362
2858
|
};
|
|
2363
|
-
},
|
|
2364
|
-
const { data:
|
|
2365
|
-
if (!
|
|
2859
|
+
}, zt = (e) => {
|
|
2860
|
+
const { data: t } = e, { dataSource: r, schemaIndex: s } = e.context;
|
|
2861
|
+
if (!t)
|
|
2366
2862
|
return { success: !0, data: [] };
|
|
2367
|
-
if (!Array.isArray(
|
|
2863
|
+
if (!Array.isArray(t))
|
|
2368
2864
|
return {
|
|
2369
2865
|
success: !1,
|
|
2370
2866
|
errors: [
|
|
2371
2867
|
{
|
|
2372
2868
|
category: "measures",
|
|
2373
2869
|
index: -1,
|
|
2374
|
-
input:
|
|
2870
|
+
input: t,
|
|
2375
2871
|
message: "Invalid measures JSON. Expected an array."
|
|
2376
2872
|
}
|
|
2377
2873
|
]
|
|
2378
2874
|
};
|
|
2379
|
-
const n = [],
|
|
2380
|
-
return
|
|
2875
|
+
const n = [], i = [];
|
|
2876
|
+
return t.forEach((o, a) => {
|
|
2381
2877
|
const u = {
|
|
2382
2878
|
category: "measures",
|
|
2383
2879
|
index: a,
|
|
2384
|
-
input:
|
|
2880
|
+
input: o
|
|
2385
2881
|
};
|
|
2386
2882
|
try {
|
|
2387
|
-
const c =
|
|
2883
|
+
const c = Dn(o, r, s, u);
|
|
2388
2884
|
if (c.error) {
|
|
2389
|
-
|
|
2885
|
+
i.push(c.error);
|
|
2390
2886
|
return;
|
|
2391
2887
|
}
|
|
2392
|
-
c.measure && n.push(
|
|
2888
|
+
c.measure && n.push(
|
|
2889
|
+
c.style !== void 0 ? { measure: c.measure, style: c.style } : { measure: c.measure }
|
|
2890
|
+
);
|
|
2393
2891
|
} catch (c) {
|
|
2394
2892
|
const p = c instanceof Error ? c.message : "Unknown error";
|
|
2395
|
-
|
|
2893
|
+
i.push(F(y({}, u), { message: p }));
|
|
2396
2894
|
}
|
|
2397
|
-
}),
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2895
|
+
}), i.length > 0 ? { success: !1, errors: i } : { success: !0, data: n };
|
|
2896
|
+
};
|
|
2897
|
+
function Q(e) {
|
|
2898
|
+
return typeof e == "string" ? e.replace(/\[\[([^\]]+)\]\]/g, "$1") : Array.isArray(e) ? e.map(Q) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
2899
|
+
Object.entries(e).map(([t, r]) => [t, Q(r)])
|
|
2900
|
+
) : e;
|
|
2901
|
+
}
|
|
2902
|
+
function w(e, t, r) {
|
|
2903
|
+
const s = e();
|
|
2904
|
+
if (!s.success) {
|
|
2905
|
+
const n = r ? s.errors.map(r) : s.errors;
|
|
2906
|
+
return t.push(...n), null;
|
|
2907
|
+
}
|
|
2908
|
+
return s.data;
|
|
2909
|
+
}
|
|
2910
|
+
const Ie = "$trend", Pe = "$forecast";
|
|
2911
|
+
function Mn(e) {
|
|
2912
|
+
return e.map(({ attribute: t, style: r }) => {
|
|
2913
|
+
const s = r == null ? void 0 : r.sortType;
|
|
2914
|
+
if (!s) return t;
|
|
2915
|
+
const n = typeof s == "object" ? s.direction : s;
|
|
2916
|
+
return se(n) ? t.sort(ne(n)) : t;
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2919
|
+
function Nn(e) {
|
|
2920
|
+
var t, r;
|
|
2921
|
+
return (r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1;
|
|
2922
|
+
}
|
|
2923
|
+
function Rn(e) {
|
|
2924
|
+
var t, r;
|
|
2925
|
+
return (r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1;
|
|
2926
|
+
}
|
|
2927
|
+
function vn(e) {
|
|
2928
|
+
var r, s;
|
|
2929
|
+
const t = [];
|
|
2930
|
+
for (const { measure: n, style: i } of e) {
|
|
2931
|
+
const o = i == null ? void 0 : i.sortType, a = o && se(o) ? n.sort(ne(o)) : n;
|
|
2932
|
+
t.push(a), i != null && i.trend && !Nn(n) && t.push(
|
|
2933
|
+
Pr(n, `${Ie}_${(r = n.name) != null ? r : "Measure"}`, i.trend)
|
|
2934
|
+
), i != null && i.forecast && !Rn(n) && t.push(
|
|
2935
|
+
kr(
|
|
2936
|
+
n,
|
|
2937
|
+
`${Pe}_${(s = n.name) != null ? s : "Measure"}`,
|
|
2938
|
+
i.forecast
|
|
2939
|
+
)
|
|
2940
|
+
);
|
|
2941
|
+
}
|
|
2942
|
+
return t;
|
|
2943
|
+
}
|
|
2944
|
+
const ii = (e) => {
|
|
2945
|
+
const { data: t } = e, { dataSource: r, tables: s } = e.context, n = $e(s), i = [], o = w(
|
|
2946
|
+
() => qt({
|
|
2947
|
+
data: t.dimensions || [],
|
|
2948
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2949
|
+
}),
|
|
2950
|
+
i
|
|
2951
|
+
), a = w(
|
|
2952
|
+
() => zt({
|
|
2953
|
+
data: t.measures || [],
|
|
2954
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2415
2955
|
}),
|
|
2416
|
-
|
|
2956
|
+
i
|
|
2957
|
+
), u = w(
|
|
2958
|
+
() => Re({
|
|
2959
|
+
data: t.filters || [],
|
|
2960
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2961
|
+
}),
|
|
2962
|
+
i
|
|
2417
2963
|
);
|
|
2418
2964
|
let c = null;
|
|
2419
|
-
return
|
|
2420
|
-
() =>
|
|
2421
|
-
data:
|
|
2422
|
-
context: { dataSource:
|
|
2965
|
+
return t.highlights && (c = w(
|
|
2966
|
+
() => ve({
|
|
2967
|
+
data: t.highlights || [],
|
|
2968
|
+
context: { dataSource: r, schemaIndex: n }
|
|
2423
2969
|
}),
|
|
2424
|
-
|
|
2425
|
-
)),
|
|
2970
|
+
i
|
|
2971
|
+
)), i.length > 0 ? {
|
|
2426
2972
|
success: !1,
|
|
2427
|
-
errors:
|
|
2973
|
+
errors: i
|
|
2428
2974
|
} : {
|
|
2429
2975
|
success: !0,
|
|
2430
|
-
data:
|
|
2431
|
-
dataSource:
|
|
2432
|
-
dimensions:
|
|
2433
|
-
measures: a
|
|
2976
|
+
data: y({
|
|
2977
|
+
dataSource: we(r),
|
|
2978
|
+
dimensions: o ? Mn(o) : [],
|
|
2979
|
+
measures: a ? vn(a) : [],
|
|
2434
2980
|
filters: u || []
|
|
2435
2981
|
}, c && { highlights: c })
|
|
2436
2982
|
};
|
|
2437
2983
|
};
|
|
2438
|
-
function
|
|
2439
|
-
|
|
2984
|
+
function Qe(e) {
|
|
2985
|
+
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
2986
|
+
}
|
|
2987
|
+
function ke(e) {
|
|
2988
|
+
const t = [], r = [];
|
|
2440
2989
|
return e.forEach((s, n) => {
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2990
|
+
var l, d, b;
|
|
2991
|
+
const i = Qe(s) ? s.column : s, o = Qe(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
2992
|
+
if (!i.composeCode) {
|
|
2993
|
+
r.push({
|
|
2444
2994
|
category: "dimensions",
|
|
2445
2995
|
index: n,
|
|
2446
|
-
input:
|
|
2447
|
-
message: `Dimension at index ${n} (${
|
|
2996
|
+
input: a(),
|
|
2997
|
+
message: `Dimension at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2448
2998
|
});
|
|
2449
2999
|
return;
|
|
2450
3000
|
}
|
|
2451
|
-
if (!
|
|
2452
|
-
|
|
3001
|
+
if (!i.composeCode.startsWith(E)) {
|
|
3002
|
+
r.push({
|
|
2453
3003
|
category: "dimensions",
|
|
2454
3004
|
index: n,
|
|
2455
|
-
input:
|
|
2456
|
-
message: `Expected composeCode to start with
|
|
3005
|
+
input: a(),
|
|
3006
|
+
message: `Expected composeCode to start with '${E}' for dimension at index ${n} (${i.name || "unnamed"}). Got: '${i.composeCode}'`
|
|
2457
3007
|
});
|
|
2458
3008
|
return;
|
|
2459
3009
|
}
|
|
2460
|
-
const i =
|
|
2461
|
-
if (
|
|
2462
|
-
const
|
|
2463
|
-
column:
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
r.push(a);
|
|
3010
|
+
const u = (b = o != null && o.sortType ? ne(o.sortType) : void 0) != null ? b : ((l = i.getSort) == null ? void 0 : l.call(i)) !== void 0 && ((d = i.getSort) == null ? void 0 : d.call(i)) !== B.None ? i.getSort() : void 0, c = o ? _(o, "column") : {};
|
|
3011
|
+
if (u !== void 0 && u !== B.None || o && Object.keys(c).length > 0) {
|
|
3012
|
+
const g = y(y({
|
|
3013
|
+
column: i.composeCode
|
|
3014
|
+
}, u !== void 0 && u !== B.None && { sortType: it(u) }), c);
|
|
3015
|
+
t.push(g);
|
|
2467
3016
|
} else
|
|
2468
|
-
|
|
2469
|
-
}),
|
|
2470
|
-
}
|
|
2471
|
-
function He(e, r) {
|
|
2472
|
-
const t = [];
|
|
2473
|
-
let s = "", n = 0, o = !1, i = null;
|
|
2474
|
-
for (let a = 0; a < e.length; a++) {
|
|
2475
|
-
const u = e[a], c = e[a + 1];
|
|
2476
|
-
if (o) {
|
|
2477
|
-
if (u !== i) {
|
|
2478
|
-
s += u;
|
|
2479
|
-
continue;
|
|
2480
|
-
}
|
|
2481
|
-
if (c === i) {
|
|
2482
|
-
s += u + c, a++;
|
|
2483
|
-
continue;
|
|
2484
|
-
}
|
|
2485
|
-
o = !1, i = null, s += u;
|
|
2486
|
-
continue;
|
|
2487
|
-
} else {
|
|
2488
|
-
if (u === "'" || u === '"') {
|
|
2489
|
-
o = !0, i = u, s += u;
|
|
2490
|
-
continue;
|
|
2491
|
-
}
|
|
2492
|
-
if ("([{".includes(u) && n++, ")]}".includes(u) && n--, u === r && n === 0) {
|
|
2493
|
-
t.push(s.trim()), s = "";
|
|
2494
|
-
continue;
|
|
2495
|
-
}
|
|
2496
|
-
}
|
|
2497
|
-
s += u;
|
|
2498
|
-
}
|
|
2499
|
-
return s.trim() && t.push(s.trim()), t;
|
|
2500
|
-
}
|
|
2501
|
-
function As(e, r) {
|
|
2502
|
-
let t = 0, s = !1, n = null;
|
|
2503
|
-
for (let o = 0; o < e.length; o++) {
|
|
2504
|
-
const i = e[o], a = e[o + 1];
|
|
2505
|
-
if (s) {
|
|
2506
|
-
if (i !== n) continue;
|
|
2507
|
-
if (a === n) {
|
|
2508
|
-
o++;
|
|
2509
|
-
continue;
|
|
2510
|
-
}
|
|
2511
|
-
s = !1, n = null;
|
|
2512
|
-
} else {
|
|
2513
|
-
if (i === "'" || i === '"') {
|
|
2514
|
-
s = !0, n = i;
|
|
2515
|
-
continue;
|
|
2516
|
-
}
|
|
2517
|
-
if ("([{".includes(i) && t++, ")]}".includes(i) && t--, i === r && t === 0) return o;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
return -1;
|
|
2521
|
-
}
|
|
2522
|
-
function xs(e) {
|
|
2523
|
-
return e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"') ? e.slice(1, -1) : e;
|
|
2524
|
-
}
|
|
2525
|
-
function _(e) {
|
|
2526
|
-
if (!e || typeof e != "string")
|
|
2527
|
-
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);
|
|
2528
|
-
const r = e.trim();
|
|
2529
|
-
if (!r)
|
|
2530
|
-
throw new Error("Invalid composeCode: empty string");
|
|
2531
|
-
const t = r.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
2532
|
-
if (!t)
|
|
2533
|
-
throw new Error(`Invalid composeCode format: expected function call, got "${r}"`);
|
|
2534
|
-
const s = t[1], n = t[2], o = Ze(n);
|
|
2535
|
-
return {
|
|
2536
|
-
function: s,
|
|
2537
|
-
args: o
|
|
2538
|
-
};
|
|
2539
|
-
}
|
|
2540
|
-
function Ze(e) {
|
|
2541
|
-
return e.trim() ? He(e, ",").map(Xe) : [];
|
|
2542
|
-
}
|
|
2543
|
-
function Xe(e) {
|
|
2544
|
-
if (!e)
|
|
2545
|
-
throw new Error("Cannot parse empty argument value");
|
|
2546
|
-
if (e === "null")
|
|
2547
|
-
return null;
|
|
2548
|
-
if (e === "undefined")
|
|
2549
|
-
return;
|
|
2550
|
-
if (e === "true")
|
|
2551
|
-
return !0;
|
|
2552
|
-
if (e === "false")
|
|
2553
|
-
return !1;
|
|
2554
|
-
if (e.match(/^-?\d+(\.\d+)?$/))
|
|
2555
|
-
return parseFloat(e);
|
|
2556
|
-
if (e.startsWith("'") && e.endsWith("'") || e.startsWith('"') && e.endsWith('"')) {
|
|
2557
|
-
const t = e[0];
|
|
2558
|
-
return e.slice(1, -1).replace(new RegExp(`${t}${t}`, "g"), t);
|
|
2559
|
-
}
|
|
2560
|
-
if (e.startsWith("[") && e.endsWith("]")) {
|
|
2561
|
-
const t = e.slice(1, -1).trim();
|
|
2562
|
-
if (!t)
|
|
2563
|
-
return [];
|
|
2564
|
-
const s = Ze(t);
|
|
2565
|
-
return s.every((n) => typeof n == "string"), s;
|
|
2566
|
-
}
|
|
2567
|
-
if (e.startsWith("{") && e.endsWith("}")) {
|
|
2568
|
-
const t = e.slice(1, -1).trim();
|
|
2569
|
-
return t ? Ms(t) : {};
|
|
2570
|
-
}
|
|
2571
|
-
return e.includes("(") && e.includes(")") ? _(e) : (e.startsWith("DM."), e);
|
|
2572
|
-
}
|
|
2573
|
-
function Ds(e) {
|
|
2574
|
-
const r = As(e, ":");
|
|
2575
|
-
if (r === -1)
|
|
2576
|
-
throw new Error(`Invalid object property: expected "key: value", got "${e}"`);
|
|
2577
|
-
const t = xs(e.slice(0, r).trim()), s = Xe(e.slice(r + 1).trim());
|
|
2578
|
-
return [t, s];
|
|
2579
|
-
}
|
|
2580
|
-
function Ms(e) {
|
|
2581
|
-
if (!e.trim()) return {};
|
|
2582
|
-
const r = He(e, ",").map(Ds).filter(([, t]) => t !== null);
|
|
2583
|
-
return Object.fromEntries(r);
|
|
3017
|
+
t.push(i.composeCode);
|
|
3018
|
+
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
2584
3019
|
}
|
|
2585
|
-
const
|
|
2586
|
-
function
|
|
3020
|
+
const be = "Unknown error";
|
|
3021
|
+
function Be(e) {
|
|
2587
3022
|
if (!e)
|
|
2588
3023
|
return { success: !0, data: [] };
|
|
2589
|
-
const
|
|
2590
|
-
if (
|
|
3024
|
+
const t = [];
|
|
3025
|
+
if (Br(e)) {
|
|
2591
3026
|
if (!e.composeCode)
|
|
2592
3027
|
return {
|
|
2593
3028
|
success: !1,
|
|
@@ -2601,9 +3036,9 @@ function Ss(e) {
|
|
|
2601
3036
|
]
|
|
2602
3037
|
};
|
|
2603
3038
|
try {
|
|
2604
|
-
return { success: !0, data: [
|
|
3039
|
+
return { success: !0, data: [W(e.composeCode)] };
|
|
2605
3040
|
} catch (s) {
|
|
2606
|
-
const n = s instanceof Error ? s.message :
|
|
3041
|
+
const n = s instanceof Error ? s.message : be;
|
|
2607
3042
|
return {
|
|
2608
3043
|
success: !1,
|
|
2609
3044
|
errors: [
|
|
@@ -2611,162 +3046,914 @@ function Ss(e) {
|
|
|
2611
3046
|
category: "filters",
|
|
2612
3047
|
index: -1,
|
|
2613
3048
|
input: e,
|
|
2614
|
-
message: `Failed to parse composeCode for FilterRelations: ${n}. ComposeCode:
|
|
3049
|
+
message: `Failed to parse composeCode for FilterRelations: ${n}. ComposeCode: '${e.composeCode}'`
|
|
2615
3050
|
}
|
|
2616
3051
|
]
|
|
2617
3052
|
};
|
|
2618
3053
|
}
|
|
2619
3054
|
}
|
|
2620
|
-
const
|
|
3055
|
+
const r = [];
|
|
2621
3056
|
return e.forEach((s, n) => {
|
|
3057
|
+
var i;
|
|
2622
3058
|
if (!s.composeCode) {
|
|
2623
|
-
|
|
3059
|
+
t.push({
|
|
2624
3060
|
category: "filters",
|
|
2625
3061
|
index: n,
|
|
2626
3062
|
input: s,
|
|
2627
|
-
message: `Filter at index ${n} (${s.name
|
|
3063
|
+
message: `Filter at index ${n} (${(i = s.name) != null ? i : "unnamed"}) is missing composeCode`
|
|
2628
3064
|
});
|
|
2629
3065
|
return;
|
|
2630
3066
|
}
|
|
2631
3067
|
try {
|
|
2632
|
-
const o =
|
|
2633
|
-
|
|
3068
|
+
const o = W(s.composeCode);
|
|
3069
|
+
r.push(o);
|
|
2634
3070
|
} catch (o) {
|
|
2635
|
-
const
|
|
2636
|
-
|
|
3071
|
+
const a = o instanceof Error ? o.message : be;
|
|
3072
|
+
t.push({
|
|
2637
3073
|
category: "filters",
|
|
2638
3074
|
index: n,
|
|
2639
3075
|
input: s,
|
|
2640
|
-
message: `Failed to parse composeCode for filter at index ${n}: ${
|
|
3076
|
+
message: `Failed to parse composeCode for filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2641
3077
|
});
|
|
2642
3078
|
}
|
|
2643
|
-
}),
|
|
3079
|
+
}), t.length > 0 ? { success: !1, errors: t } : { success: !0, data: r };
|
|
2644
3080
|
}
|
|
2645
|
-
function
|
|
3081
|
+
function ze(e) {
|
|
2646
3082
|
if (!e)
|
|
2647
3083
|
return { success: !0, data: [] };
|
|
2648
|
-
const
|
|
3084
|
+
const t = [], r = [];
|
|
2649
3085
|
return e.forEach((s, n) => {
|
|
3086
|
+
var i;
|
|
2650
3087
|
if (!s.composeCode) {
|
|
2651
|
-
|
|
3088
|
+
r.push({
|
|
2652
3089
|
category: "highlights",
|
|
2653
3090
|
index: n,
|
|
2654
3091
|
input: s,
|
|
2655
|
-
message: `Highlight filter at index ${n} (${s.name
|
|
3092
|
+
message: `Highlight filter at index ${n} (${(i = s.name) != null ? i : "unnamed"}) is missing composeCode`
|
|
2656
3093
|
});
|
|
2657
3094
|
return;
|
|
2658
3095
|
}
|
|
2659
3096
|
try {
|
|
2660
|
-
const o =
|
|
2661
|
-
|
|
3097
|
+
const o = W(s.composeCode);
|
|
3098
|
+
t.push(o);
|
|
2662
3099
|
} catch (o) {
|
|
2663
|
-
const
|
|
2664
|
-
|
|
3100
|
+
const a = o instanceof Error ? o.message : be;
|
|
3101
|
+
r.push({
|
|
2665
3102
|
category: "highlights",
|
|
2666
3103
|
index: n,
|
|
2667
3104
|
input: s,
|
|
2668
|
-
message: `Failed to parse composeCode for highlight filter at index ${n}: ${
|
|
3105
|
+
message: `Failed to parse composeCode for highlight filter at index ${n}: ${a}. ComposeCode: '${s.composeCode}'`
|
|
2669
3106
|
});
|
|
2670
3107
|
}
|
|
2671
|
-
}),
|
|
3108
|
+
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3109
|
+
}
|
|
3110
|
+
function Xe(e) {
|
|
3111
|
+
return typeof e == "object" && e !== null && "column" in e && e.column !== void 0;
|
|
2672
3112
|
}
|
|
2673
|
-
function
|
|
2674
|
-
const
|
|
3113
|
+
function Le(e) {
|
|
3114
|
+
const t = [], r = [];
|
|
2675
3115
|
return e.forEach((s, n) => {
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
3116
|
+
var u, c, p;
|
|
3117
|
+
const i = Xe(s) ? s.column : s, o = Xe(s) ? s : void 0, a = () => typeof i.toJSON == "function" ? i.toJSON() : i;
|
|
3118
|
+
if (!i.composeCode) {
|
|
3119
|
+
r.push({
|
|
2679
3120
|
category: "measures",
|
|
2680
3121
|
index: n,
|
|
2681
|
-
input:
|
|
2682
|
-
message: `Measure at index ${n} (${
|
|
3122
|
+
input: a(),
|
|
3123
|
+
message: `Measure at index ${n} (${i.name || "unnamed"}) is missing composeCode`
|
|
2683
3124
|
});
|
|
2684
3125
|
return;
|
|
2685
3126
|
}
|
|
2686
3127
|
try {
|
|
2687
|
-
const
|
|
2688
|
-
if (
|
|
2689
|
-
const
|
|
2690
|
-
column:
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
r.push(u);
|
|
3128
|
+
const l = W(i.composeCode), d = (p = o != null && o.sortType ? ne(o.sortType) : void 0) != null ? p : ((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;
|
|
3129
|
+
if (d !== void 0 && d !== B.None || o && Object.keys(_(o, "column")).length > 0) {
|
|
3130
|
+
const g = o ? _(o, "column") : {}, m = y(y({
|
|
3131
|
+
column: l
|
|
3132
|
+
}, d !== void 0 && d !== B.None && { sortType: it(d) }), g);
|
|
3133
|
+
t.push(m);
|
|
2694
3134
|
} else
|
|
2695
|
-
|
|
2696
|
-
} catch (
|
|
2697
|
-
const
|
|
2698
|
-
|
|
3135
|
+
t.push(l);
|
|
3136
|
+
} catch (l) {
|
|
3137
|
+
const d = l instanceof Error ? l.message : "Unknown error";
|
|
3138
|
+
r.push({
|
|
2699
3139
|
category: "measures",
|
|
2700
3140
|
index: n,
|
|
2701
|
-
input:
|
|
2702
|
-
message: `Failed to parse composeCode for measure at index ${n} (${
|
|
3141
|
+
input: a(),
|
|
3142
|
+
message: `Failed to parse composeCode for measure at index ${n} (${i.name || "unnamed"}): ${d}. ComposeCode: '${i.composeCode}'`
|
|
2703
3143
|
});
|
|
2704
3144
|
}
|
|
2705
|
-
}),
|
|
3145
|
+
}), r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
2706
3146
|
}
|
|
2707
|
-
function
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
) : e;
|
|
3147
|
+
function Ze(e) {
|
|
3148
|
+
var t, r, s, n;
|
|
3149
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.trend")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(Ie)) != null ? n : !1);
|
|
2711
3150
|
}
|
|
2712
|
-
function
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
3151
|
+
function et(e) {
|
|
3152
|
+
var t, r, s, n;
|
|
3153
|
+
return ((r = (t = e.composeCode) == null ? void 0 : t.includes("measureFactory.forecast")) != null ? r : !1) || ((n = (s = e.name) == null ? void 0 : s.startsWith(Pe)) != null ? n : !1);
|
|
3154
|
+
}
|
|
3155
|
+
function tt(e) {
|
|
3156
|
+
try {
|
|
3157
|
+
const t = W(e.trim());
|
|
3158
|
+
return t.args[2] != null && typeof t.args[2] == "object" ? t.args[2] : void 0;
|
|
3159
|
+
} catch (t) {
|
|
3160
|
+
return;
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
function In(e) {
|
|
3164
|
+
var s, n, i;
|
|
3165
|
+
if (!(e != null && e.length)) return [];
|
|
3166
|
+
const t = /* @__PURE__ */ new Set(), r = [];
|
|
3167
|
+
for (let o = 0; o < e.length; o++) {
|
|
3168
|
+
if (t.has(o)) continue;
|
|
3169
|
+
const a = e[o];
|
|
3170
|
+
if (Ze(a) || et(a)) {
|
|
3171
|
+
r.push(a);
|
|
3172
|
+
continue;
|
|
3173
|
+
}
|
|
3174
|
+
const u = (s = a.name) != null ? s : "Measure", c = `${Ie}_${u}`, p = `${Pe}_${u}`;
|
|
3175
|
+
let l, d, b = o + 1;
|
|
3176
|
+
if (b < e.length && !t.has(b) && Ze(e[b]) && e[b].name === c) {
|
|
3177
|
+
const g = (n = e[b].composeCode) == null ? void 0 : n.trim();
|
|
3178
|
+
g && (l = tt(g), t.add(b), b++);
|
|
3179
|
+
}
|
|
3180
|
+
if (b < e.length && !t.has(b) && et(e[b]) && e[b].name === p) {
|
|
3181
|
+
const g = (i = e[b].composeCode) == null ? void 0 : i.trim();
|
|
3182
|
+
g && (d = tt(g), t.add(b));
|
|
3183
|
+
}
|
|
3184
|
+
l !== void 0 || d !== void 0 ? r.push(y(y({
|
|
3185
|
+
column: a
|
|
3186
|
+
}, l && Object.keys(l).length > 0 && { trend: l }), d && Object.keys(d).length > 0 && { forecast: d })) : r.push(a);
|
|
3187
|
+
}
|
|
3188
|
+
return r;
|
|
3189
|
+
}
|
|
3190
|
+
function oi(e) {
|
|
3191
|
+
const t = [], r = w(
|
|
3192
|
+
() => ke(e.dimensions || []),
|
|
3193
|
+
t
|
|
3194
|
+
), s = In(e.measures || []), n = w(
|
|
3195
|
+
() => Le(s),
|
|
3196
|
+
t
|
|
3197
|
+
), i = w(
|
|
3198
|
+
() => Be(e.filters),
|
|
3199
|
+
t
|
|
2722
3200
|
);
|
|
2723
3201
|
let o = null;
|
|
2724
|
-
if (e.highlights && e.highlights.length > 0 && (o =
|
|
2725
|
-
() =>
|
|
2726
|
-
|
|
2727
|
-
)),
|
|
3202
|
+
if (e.highlights && e.highlights.length > 0 && (o = w(
|
|
3203
|
+
() => ze(e.highlights),
|
|
3204
|
+
t
|
|
3205
|
+
)), t.length > 0)
|
|
2728
3206
|
return {
|
|
2729
3207
|
success: !1,
|
|
2730
|
-
errors:
|
|
3208
|
+
errors: t
|
|
2731
3209
|
};
|
|
2732
|
-
const
|
|
2733
|
-
dimensions:
|
|
2734
|
-
measures:
|
|
2735
|
-
filters:
|
|
3210
|
+
const a = y({
|
|
3211
|
+
dimensions: r || [],
|
|
3212
|
+
measures: n || [],
|
|
3213
|
+
filters: i || []
|
|
2736
3214
|
}, o && { highlights: o });
|
|
2737
3215
|
return {
|
|
2738
3216
|
success: !0,
|
|
2739
3217
|
// Strip [[delimiters]] from all strings to preserve original names with spaces
|
|
2740
|
-
data:
|
|
3218
|
+
data: Q(a)
|
|
2741
3219
|
};
|
|
2742
3220
|
}
|
|
2743
|
-
|
|
2744
|
-
|
|
3221
|
+
const Lt = new Set(
|
|
3222
|
+
zr.filter((e) => e !== "image")
|
|
3223
|
+
), rt = Object.freeze([...Lt]), me = /* @__PURE__ */ new Set([
|
|
3224
|
+
"category",
|
|
3225
|
+
"value",
|
|
3226
|
+
"breakBy",
|
|
3227
|
+
"breakByPoint",
|
|
3228
|
+
"x",
|
|
3229
|
+
"y",
|
|
3230
|
+
"breakByColor",
|
|
3231
|
+
"size",
|
|
3232
|
+
"boxType",
|
|
3233
|
+
"outliers",
|
|
3234
|
+
"geo",
|
|
3235
|
+
"colorBy",
|
|
3236
|
+
"details",
|
|
3237
|
+
"color",
|
|
3238
|
+
"date",
|
|
3239
|
+
"columns",
|
|
3240
|
+
"rows",
|
|
3241
|
+
"values",
|
|
3242
|
+
"secondary",
|
|
3243
|
+
"min",
|
|
3244
|
+
"max",
|
|
3245
|
+
"seriesToColorMap"
|
|
3246
|
+
]), Pn = {
|
|
3247
|
+
line: {
|
|
3248
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3249
|
+
requiredAxes: ["category", "value"]
|
|
3250
|
+
},
|
|
3251
|
+
area: {
|
|
3252
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3253
|
+
requiredAxes: ["category", "value"]
|
|
3254
|
+
},
|
|
3255
|
+
bar: {
|
|
3256
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3257
|
+
requiredAxes: ["category", "value"]
|
|
3258
|
+
},
|
|
3259
|
+
column: {
|
|
3260
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3261
|
+
requiredAxes: ["category", "value"]
|
|
3262
|
+
},
|
|
3263
|
+
streamgraph: {
|
|
3264
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3265
|
+
requiredAxes: ["category", "value"]
|
|
3266
|
+
},
|
|
3267
|
+
polar: {
|
|
3268
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3269
|
+
requiredAxes: ["category", "value"]
|
|
3270
|
+
},
|
|
3271
|
+
pie: {
|
|
3272
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "seriesToColorMap"]),
|
|
3273
|
+
requiredAxes: ["category", "value"]
|
|
3274
|
+
},
|
|
3275
|
+
funnel: {
|
|
3276
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "seriesToColorMap"]),
|
|
3277
|
+
requiredAxes: ["category", "value"]
|
|
3278
|
+
},
|
|
3279
|
+
treemap: {
|
|
3280
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "seriesToColorMap"]),
|
|
3281
|
+
requiredAxes: ["category", "value"]
|
|
3282
|
+
},
|
|
3283
|
+
sunburst: {
|
|
3284
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "seriesToColorMap"]),
|
|
3285
|
+
requiredAxes: ["category", "value"]
|
|
3286
|
+
},
|
|
3287
|
+
scatter: {
|
|
3288
|
+
validAxes: /* @__PURE__ */ new Set(["x", "y", "breakByPoint", "breakByColor", "size", "seriesToColorMap"]),
|
|
3289
|
+
requiredAxes: []
|
|
3290
|
+
},
|
|
3291
|
+
table: {
|
|
3292
|
+
validAxes: /* @__PURE__ */ new Set(["columns"]),
|
|
3293
|
+
requiredAxes: ["columns"]
|
|
3294
|
+
},
|
|
3295
|
+
indicator: {
|
|
3296
|
+
validAxes: /* @__PURE__ */ new Set(["value", "secondary", "min", "max"]),
|
|
3297
|
+
requiredAxes: []
|
|
3298
|
+
},
|
|
3299
|
+
boxplot: {
|
|
3300
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "boxType", "outliers"]),
|
|
3301
|
+
requiredAxes: ["value"]
|
|
3302
|
+
},
|
|
3303
|
+
areamap: {
|
|
3304
|
+
validAxes: /* @__PURE__ */ new Set(["geo", "color"]),
|
|
3305
|
+
requiredAxes: ["geo"]
|
|
3306
|
+
},
|
|
3307
|
+
scattermap: {
|
|
3308
|
+
validAxes: /* @__PURE__ */ new Set(["geo", "size", "colorBy", "details"]),
|
|
3309
|
+
requiredAxes: ["geo"]
|
|
3310
|
+
},
|
|
3311
|
+
"calendar-heatmap": {
|
|
3312
|
+
validAxes: /* @__PURE__ */ new Set(["date", "value"]),
|
|
3313
|
+
requiredAxes: ["date", "value"]
|
|
3314
|
+
},
|
|
3315
|
+
arearange: {
|
|
3316
|
+
validAxes: /* @__PURE__ */ new Set(["category", "value", "breakBy", "seriesToColorMap"]),
|
|
3317
|
+
requiredAxes: ["category", "value"]
|
|
3318
|
+
}
|
|
3319
|
+
}, kn = /* @__PURE__ */ new Set([
|
|
3320
|
+
"category",
|
|
3321
|
+
"breakBy",
|
|
3322
|
+
"breakByPoint",
|
|
3323
|
+
"rows",
|
|
3324
|
+
"geo",
|
|
3325
|
+
"details",
|
|
3326
|
+
"date"
|
|
3327
|
+
]), Bn = /* @__PURE__ */ new Set([
|
|
3328
|
+
"value",
|
|
3329
|
+
"size",
|
|
3330
|
+
"colorBy",
|
|
3331
|
+
"boxType",
|
|
3332
|
+
"outliers",
|
|
3333
|
+
"values",
|
|
3334
|
+
"secondary",
|
|
3335
|
+
"min",
|
|
3336
|
+
"max",
|
|
3337
|
+
"color"
|
|
3338
|
+
]);
|
|
3339
|
+
function zn(e) {
|
|
3340
|
+
const t = Pn[e];
|
|
3341
|
+
if (t)
|
|
3342
|
+
return {
|
|
3343
|
+
validAxes: new Set(t.validAxes),
|
|
3344
|
+
requiredAxes: Object.freeze([...t.requiredAxes])
|
|
3345
|
+
};
|
|
3346
|
+
}
|
|
3347
|
+
function Ut(e) {
|
|
3348
|
+
return typeof e == "string" && Lt.has(e);
|
|
3349
|
+
}
|
|
3350
|
+
function Ln(e, t, r) {
|
|
3351
|
+
if (r === "boxplot" && e === "value" || r === "calendar-heatmap" && e === "date" || kn.has(e))
|
|
3352
|
+
return !0;
|
|
3353
|
+
if (Bn.has(e))
|
|
3354
|
+
return !1;
|
|
3355
|
+
const s = Array.isArray(t) ? t[0] : t;
|
|
3356
|
+
if (!s)
|
|
3357
|
+
return !0;
|
|
3358
|
+
let n;
|
|
3359
|
+
return S(s) && "column" in s && (n = s.column), !(q(s) || n !== void 0 && q(n));
|
|
3360
|
+
}
|
|
3361
|
+
function Un(e) {
|
|
3362
|
+
const t = [], r = {
|
|
3363
|
+
chartType: "",
|
|
3364
|
+
dataOptions: {}
|
|
3365
|
+
};
|
|
3366
|
+
if (!S(e))
|
|
3367
|
+
return t.push({
|
|
3368
|
+
category: "chartType",
|
|
3369
|
+
index: -1,
|
|
3370
|
+
input: e,
|
|
3371
|
+
message: "Expected an object"
|
|
3372
|
+
}), { normalized: r, errors: t };
|
|
3373
|
+
const s = e.chartType;
|
|
3374
|
+
if (s === void 0) {
|
|
3375
|
+
const i = Object.keys(e), o = R("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;
|
|
3376
|
+
t.push({
|
|
3377
|
+
category: "chartType",
|
|
3378
|
+
index: -1,
|
|
3379
|
+
input: u,
|
|
3380
|
+
message: `chartType is required.${a}`
|
|
3381
|
+
});
|
|
3382
|
+
} else if (Ut(s))
|
|
3383
|
+
r.chartType = s;
|
|
3384
|
+
else {
|
|
3385
|
+
const i = R(String(s), rt, (u) => u), o = i && i.distance <= x ? ` Did you mean '${i.best}'?` : "", a = rt.slice(0, 8).join(", ");
|
|
3386
|
+
t.push({
|
|
3387
|
+
category: "chartType",
|
|
3388
|
+
index: -1,
|
|
3389
|
+
input: s,
|
|
3390
|
+
message: `Invalid chartType '${s}'. Valid types: ${a}, ...${o}`
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
const n = e.dataOptions;
|
|
3394
|
+
if (n === void 0) {
|
|
3395
|
+
const i = Object.keys(e), o = R("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;
|
|
3396
|
+
t.push({
|
|
3397
|
+
category: "dataOptions",
|
|
3398
|
+
index: -1,
|
|
3399
|
+
input: u,
|
|
3400
|
+
message: `dataOptions is required.${a}`
|
|
3401
|
+
});
|
|
3402
|
+
} else n !== null && typeof n == "object" && (r.dataOptions = n);
|
|
3403
|
+
return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
|
|
3404
|
+
}
|
|
3405
|
+
function _n(e) {
|
|
3406
|
+
return e.map(
|
|
3407
|
+
({ attribute: t, style: r }) => r ? y({ column: t }, r) : t
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
function Vn(e) {
|
|
3411
|
+
return e.map(
|
|
3412
|
+
({ measure: t, style: r }) => r ? y({ column: t }, r) : t
|
|
3413
|
+
);
|
|
3414
|
+
}
|
|
3415
|
+
function _t(e) {
|
|
3416
|
+
return Array.isArray(e) ? e : [e];
|
|
3417
|
+
}
|
|
3418
|
+
function Ae(e) {
|
|
3419
|
+
return (t) => F(y({}, t), {
|
|
3420
|
+
category: "dataOptions",
|
|
3421
|
+
index: e
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
function re(e, t, r, s, n) {
|
|
3425
|
+
const i = t ? _t(
|
|
3426
|
+
t
|
|
3427
|
+
) : [];
|
|
3428
|
+
if (i.length === 0)
|
|
3429
|
+
return [];
|
|
3430
|
+
if (r === "dimension") {
|
|
3431
|
+
const a = w(
|
|
3432
|
+
() => qt({
|
|
3433
|
+
data: i,
|
|
3434
|
+
context: s
|
|
3435
|
+
}),
|
|
3436
|
+
n,
|
|
3437
|
+
Ae(e)
|
|
3438
|
+
);
|
|
3439
|
+
return a !== null ? _n(a) : null;
|
|
3440
|
+
}
|
|
3441
|
+
const o = w(
|
|
3442
|
+
() => zt({
|
|
3443
|
+
data: i,
|
|
3444
|
+
context: s
|
|
3445
|
+
}),
|
|
3446
|
+
n,
|
|
3447
|
+
Ae(e)
|
|
3448
|
+
);
|
|
3449
|
+
return o !== null ? Vn(o) : null;
|
|
3450
|
+
}
|
|
3451
|
+
function st(e, t, r) {
|
|
3452
|
+
const s = Array.isArray(t) ? t : t != null ? [t] : [];
|
|
3453
|
+
if (r === "dimension") {
|
|
3454
|
+
const i = ke(
|
|
3455
|
+
s
|
|
3456
|
+
);
|
|
3457
|
+
return i.success ? { success: !0, data: i.data } : {
|
|
3458
|
+
success: !1,
|
|
3459
|
+
errors: i.errors.map((o) => F(y({}, o), {
|
|
3460
|
+
category: "dataOptions",
|
|
3461
|
+
index: e
|
|
3462
|
+
}))
|
|
3463
|
+
};
|
|
3464
|
+
}
|
|
3465
|
+
const n = Le(s);
|
|
3466
|
+
return n.success ? { success: !0, data: n.data } : {
|
|
3467
|
+
success: !1,
|
|
3468
|
+
errors: n.errors.map((i) => F(y({}, i), {
|
|
3469
|
+
category: "dataOptions",
|
|
3470
|
+
index: e
|
|
3471
|
+
}))
|
|
3472
|
+
};
|
|
3473
|
+
}
|
|
3474
|
+
function Wn(e, t) {
|
|
3475
|
+
let r;
|
|
3476
|
+
S(e) && "column" in e && (r = e.column);
|
|
3477
|
+
const n = !(q(e) || r !== void 0 && q(r)) ? "dimension" : "measure", i = [], o = re("columns", [e], n, t, i);
|
|
3478
|
+
return o !== null ? { success: !0, data: o } : { success: !1, errors: i };
|
|
3479
|
+
}
|
|
3480
|
+
function jn(e, t, r, s) {
|
|
3481
|
+
const n = [];
|
|
3482
|
+
for (const i of e) {
|
|
3483
|
+
const o = w(
|
|
3484
|
+
() => Wn(i, t),
|
|
3485
|
+
r,
|
|
3486
|
+
s
|
|
3487
|
+
);
|
|
3488
|
+
o && n.push(...o);
|
|
3489
|
+
}
|
|
3490
|
+
return n;
|
|
3491
|
+
}
|
|
3492
|
+
function Kn(e, t, r) {
|
|
3493
|
+
if (!e || !S(e))
|
|
3494
|
+
return r.push({
|
|
3495
|
+
category: "dataOptions",
|
|
3496
|
+
index: -1,
|
|
3497
|
+
input: e,
|
|
3498
|
+
message: "dataOptions is required"
|
|
3499
|
+
}), null;
|
|
3500
|
+
const s = {}, { chartType: n } = t, i = r.length, o = e, a = Object.keys(e), u = /* @__PURE__ */ new Map();
|
|
3501
|
+
for (const l of a)
|
|
3502
|
+
if (!me.has(l)) {
|
|
3503
|
+
const d = R(l, [...me], (g) => g), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "";
|
|
3504
|
+
d && d.distance <= x && u.set(l, d.best), r.push({
|
|
3505
|
+
category: "dataOptions",
|
|
3506
|
+
index: l,
|
|
3507
|
+
input: o[l],
|
|
3508
|
+
message: `Unknown dataOptions key '${l}'.${b}`
|
|
3509
|
+
});
|
|
3510
|
+
}
|
|
3511
|
+
const c = n ? zn(n) : void 0;
|
|
3512
|
+
if (c) {
|
|
3513
|
+
for (const l of a)
|
|
3514
|
+
if (l !== "seriesToColorMap" && !c.validAxes.has(l) && me.has(l)) {
|
|
3515
|
+
const d = R(l, [...c.validAxes], (m) => m), b = d && d.distance <= x ? ` Did you mean '${d.best}'?` : "", g = [...c.validAxes].join(", ");
|
|
3516
|
+
r.push({
|
|
3517
|
+
category: "dataOptions",
|
|
3518
|
+
index: l,
|
|
3519
|
+
input: o[l],
|
|
3520
|
+
message: `Axis '${l}' is not valid for chart type '${n}'. Valid axes: ${g}.${b}`
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
for (const l of c.requiredAxes)
|
|
3524
|
+
[...u.values()].includes(l) || (!(l in o) || o[l] == null) && r.push({
|
|
3525
|
+
category: "dataOptions",
|
|
3526
|
+
index: l,
|
|
3527
|
+
input: null,
|
|
3528
|
+
message: `Chart type '${n}' requires '${c.requiredAxes.join(
|
|
3529
|
+
"' and '"
|
|
3530
|
+
)}'. Missing: ${l}.`
|
|
3531
|
+
});
|
|
3532
|
+
n === "indicator" && (["value", "secondary", "min", "max"].some(
|
|
3533
|
+
(b) => b in o && o[b] != null
|
|
3534
|
+
) || r.push({
|
|
3535
|
+
category: "dataOptions",
|
|
3536
|
+
index: -1,
|
|
3537
|
+
input: e,
|
|
3538
|
+
message: "Indicator chart requires at least one of: value, secondary, min, max."
|
|
3539
|
+
})), n === "scatter" && ("x" in e && e.x != null || "y" in e && e.y != null || r.push({
|
|
3540
|
+
category: "dataOptions",
|
|
3541
|
+
index: -1,
|
|
3542
|
+
input: e,
|
|
3543
|
+
message: "Scatter chart requires at least one of: x, y."
|
|
3544
|
+
}));
|
|
3545
|
+
}
|
|
3546
|
+
if (r.length > i)
|
|
3547
|
+
return null;
|
|
3548
|
+
const p = Object.entries(e);
|
|
3549
|
+
for (const [l, d] of p) {
|
|
3550
|
+
if (!d) continue;
|
|
3551
|
+
if (l === "seriesToColorMap") {
|
|
3552
|
+
s[l] = d;
|
|
3553
|
+
continue;
|
|
3554
|
+
}
|
|
3555
|
+
if (l === "columns") {
|
|
3556
|
+
s[l] = jn(
|
|
3557
|
+
_t(d),
|
|
3558
|
+
t,
|
|
3559
|
+
r,
|
|
3560
|
+
Ae("columns")
|
|
3561
|
+
);
|
|
3562
|
+
continue;
|
|
3563
|
+
}
|
|
3564
|
+
const b = Ln(l, d, n) ? "dimension" : "measure", g = re(
|
|
3565
|
+
l,
|
|
3566
|
+
d,
|
|
3567
|
+
b,
|
|
3568
|
+
t,
|
|
3569
|
+
r
|
|
3570
|
+
);
|
|
3571
|
+
if (g !== null) {
|
|
3572
|
+
const m = n === "calendar-heatmap" && l === "value";
|
|
3573
|
+
s[l] = m || !Array.isArray(d) ? g[0] : g;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
return r.length > i ? null : s;
|
|
3577
|
+
}
|
|
3578
|
+
function Gn(e) {
|
|
3579
|
+
if (typeof e != "string") return "iqr";
|
|
3580
|
+
const t = e.split("/")[1];
|
|
3581
|
+
return t === "iqr" || t === "extremums" || t === "standardDeviation" ? t : "iqr";
|
|
3582
|
+
}
|
|
3583
|
+
const ai = (e) => {
|
|
3584
|
+
var m;
|
|
3585
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = Un(t);
|
|
3586
|
+
if (o.length > 0)
|
|
3587
|
+
return { success: !1, errors: o };
|
|
3588
|
+
const a = i.chartType, u = $e(n), c = [];
|
|
3589
|
+
let p = Kn(
|
|
3590
|
+
i.dataOptions,
|
|
3591
|
+
{ dataSource: s, schemaIndex: u, chartType: a },
|
|
3592
|
+
c
|
|
3593
|
+
);
|
|
3594
|
+
if (a === "boxplot" && p) {
|
|
3595
|
+
const A = Gn((m = i.styleOptions) == null ? void 0 : m.subtype), C = A === "iqr" || A === "standardDeviation";
|
|
3596
|
+
p = F(y({}, p), { boxType: A, outliersEnabled: C });
|
|
3597
|
+
}
|
|
3598
|
+
let l = null;
|
|
3599
|
+
i.filters && i.filters.length > 0 && (l = w(
|
|
3600
|
+
() => Re({
|
|
3601
|
+
data: i.filters || [],
|
|
3602
|
+
context: { dataSource: s, schemaIndex: u }
|
|
3603
|
+
}),
|
|
3604
|
+
c
|
|
3605
|
+
));
|
|
3606
|
+
let d = null;
|
|
3607
|
+
if (i.highlights && i.highlights.length > 0 && (d = w(
|
|
3608
|
+
() => ve({
|
|
3609
|
+
data: i.highlights || [],
|
|
3610
|
+
context: { dataSource: s, schemaIndex: u }
|
|
3611
|
+
}),
|
|
3612
|
+
c
|
|
3613
|
+
)), c.length > 0 || p === null)
|
|
3614
|
+
return {
|
|
3615
|
+
success: !1,
|
|
3616
|
+
errors: c
|
|
3617
|
+
};
|
|
3618
|
+
if (!Ut(i.chartType))
|
|
3619
|
+
return {
|
|
3620
|
+
success: !1,
|
|
3621
|
+
errors: [
|
|
3622
|
+
{
|
|
3623
|
+
category: "chartType",
|
|
3624
|
+
index: -1,
|
|
3625
|
+
input: i.chartType,
|
|
3626
|
+
message: "Invalid chartType"
|
|
3627
|
+
}
|
|
3628
|
+
]
|
|
3629
|
+
};
|
|
3630
|
+
const b = i.chartType;
|
|
3631
|
+
return {
|
|
3632
|
+
success: !0,
|
|
3633
|
+
data: y(y(y({
|
|
3634
|
+
dataSet: we(s),
|
|
3635
|
+
chartType: b,
|
|
3636
|
+
dataOptions: p
|
|
3637
|
+
}, i.styleOptions && {
|
|
3638
|
+
// Pass-through NLQ JSON; shape matches ChartStyleOptions.
|
|
3639
|
+
styleOptions: i.styleOptions
|
|
3640
|
+
}), l && { filters: l }), d && { highlights: d })
|
|
3641
|
+
};
|
|
3642
|
+
}, ui = (e) => {
|
|
3643
|
+
const t = [];
|
|
3644
|
+
if (!e.chartType)
|
|
3645
|
+
return {
|
|
3646
|
+
success: !1,
|
|
3647
|
+
errors: [
|
|
3648
|
+
{
|
|
3649
|
+
category: "dimensions",
|
|
3650
|
+
index: -1,
|
|
3651
|
+
input: e,
|
|
3652
|
+
message: "chartType is required"
|
|
3653
|
+
}
|
|
3654
|
+
]
|
|
3655
|
+
};
|
|
3656
|
+
if (!e.dataOptions)
|
|
3657
|
+
return {
|
|
3658
|
+
success: !1,
|
|
3659
|
+
errors: [
|
|
3660
|
+
{
|
|
3661
|
+
category: "dimensions",
|
|
3662
|
+
index: -1,
|
|
3663
|
+
input: e,
|
|
3664
|
+
message: "dataOptions is required"
|
|
3665
|
+
}
|
|
3666
|
+
]
|
|
3667
|
+
};
|
|
3668
|
+
let r = null;
|
|
3669
|
+
const s = Yn(e.dataOptions);
|
|
3670
|
+
s.success ? r = s.data : t.push(...s.errors);
|
|
3671
|
+
let n;
|
|
3672
|
+
if (e.filters) {
|
|
3673
|
+
const u = w(
|
|
3674
|
+
() => Be(e.filters),
|
|
3675
|
+
t
|
|
3676
|
+
);
|
|
3677
|
+
n = u != null ? u : void 0;
|
|
3678
|
+
}
|
|
3679
|
+
let i;
|
|
3680
|
+
if (e.highlights && e.highlights.length > 0) {
|
|
3681
|
+
const u = w(
|
|
3682
|
+
() => ze(e.highlights),
|
|
3683
|
+
t
|
|
3684
|
+
);
|
|
3685
|
+
i = u != null ? u : void 0;
|
|
3686
|
+
}
|
|
3687
|
+
if (t.length > 0 || r === null)
|
|
3688
|
+
return { success: !1, errors: t };
|
|
3689
|
+
const o = y(y(y({
|
|
3690
|
+
chartType: e.chartType,
|
|
3691
|
+
dataOptions: r
|
|
3692
|
+
}, e.styleOptions && {
|
|
3693
|
+
styleOptions: e.styleOptions
|
|
3694
|
+
}), n && n.length > 0 && { filters: n }), i && i.length > 0 && { highlights: i });
|
|
3695
|
+
return {
|
|
3696
|
+
success: !0,
|
|
3697
|
+
data: Q(
|
|
3698
|
+
o
|
|
3699
|
+
)
|
|
3700
|
+
};
|
|
3701
|
+
};
|
|
3702
|
+
function Yn(e) {
|
|
3703
|
+
const t = {}, r = [], s = /* @__PURE__ */ new Set(["seriesToColorMap", "boxType", "outliersEnabled", "valueTitle"]);
|
|
3704
|
+
for (const [n, i] of Object.entries(e)) {
|
|
3705
|
+
if (n === "seriesToColorMap" && i) {
|
|
3706
|
+
t[n] = i;
|
|
3707
|
+
continue;
|
|
3708
|
+
}
|
|
3709
|
+
if (s.has(n) || i == null) {
|
|
3710
|
+
i != null && (t[n] = i);
|
|
3711
|
+
continue;
|
|
3712
|
+
}
|
|
3713
|
+
const o = Array.isArray(i) ? i : [i], a = Array.isArray(i), u = [], c = [];
|
|
3714
|
+
for (let p = 0; p < o.length; p++) {
|
|
3715
|
+
const l = o[p], b = Jn(l) ? ke([
|
|
3716
|
+
l
|
|
3717
|
+
]) : Le([l]);
|
|
3718
|
+
b.success ? u.push(...b.data) : b.errors.forEach((g) => {
|
|
3719
|
+
var m;
|
|
3720
|
+
c.push(F(y({}, g), { index: p, input: (m = g.input) != null ? m : l }));
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
if (c.length > 0) {
|
|
3724
|
+
r.push(...c);
|
|
3725
|
+
continue;
|
|
3726
|
+
}
|
|
3727
|
+
t[n] = a ? u : u[0];
|
|
3728
|
+
}
|
|
3729
|
+
return r.length > 0 ? { success: !1, errors: r } : { success: !0, data: t };
|
|
3730
|
+
}
|
|
3731
|
+
function Jn(e) {
|
|
3732
|
+
const t = Array.isArray(e) ? e[0] : e;
|
|
3733
|
+
if (!t || !S(t))
|
|
3734
|
+
return !0;
|
|
3735
|
+
const r = "column" in t && t.column != null && S(t.column) ? t.column : t;
|
|
3736
|
+
if ("composeCode" in r) {
|
|
3737
|
+
const s = r.composeCode;
|
|
3738
|
+
if (typeof s == "string" && s.startsWith("DM."))
|
|
3739
|
+
return !0;
|
|
3740
|
+
if (typeof s == "string" && (s.includes("measureFactory") || s.includes("Formula")))
|
|
3741
|
+
return !1;
|
|
3742
|
+
}
|
|
3743
|
+
if ("type" in r) {
|
|
3744
|
+
const s = r.type;
|
|
3745
|
+
if (s === "basemeasure" || s === "calculatedmeasure")
|
|
3746
|
+
return !1;
|
|
3747
|
+
}
|
|
3748
|
+
return !("aggregation" in r || "attribute" in r && "aggregation" in r);
|
|
3749
|
+
}
|
|
3750
|
+
const nt = ["rows", "columns", "values", "grandTotals"];
|
|
3751
|
+
function Hn(e) {
|
|
3752
|
+
if (!S(e)) return !1;
|
|
3753
|
+
const t = Object.keys(e);
|
|
3754
|
+
return t.every((r) => r === "rows" || r === "columns") && t.every((r) => typeof e[r] == "boolean");
|
|
3755
|
+
}
|
|
3756
|
+
function Qn(e) {
|
|
3757
|
+
const t = [], r = {
|
|
3758
|
+
dataOptions: {}
|
|
3759
|
+
};
|
|
3760
|
+
if (!S(e))
|
|
3761
|
+
return t.push({
|
|
3762
|
+
category: "dataOptions",
|
|
3763
|
+
index: -1,
|
|
3764
|
+
input: e,
|
|
3765
|
+
message: "Expected an object"
|
|
3766
|
+
}), { normalized: r, errors: t };
|
|
3767
|
+
const s = e.dataOptions;
|
|
3768
|
+
if (s === void 0) {
|
|
3769
|
+
const n = Object.keys(e), i = R("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;
|
|
3770
|
+
t.push({
|
|
3771
|
+
category: "dataOptions",
|
|
3772
|
+
index: -1,
|
|
3773
|
+
input: a,
|
|
3774
|
+
message: `dataOptions is required.${o}`
|
|
3775
|
+
});
|
|
3776
|
+
} else if (S(s)) {
|
|
3777
|
+
const n = s;
|
|
3778
|
+
r.dataOptions = n;
|
|
3779
|
+
for (const o of Object.keys(n))
|
|
3780
|
+
if (!nt.includes(o)) {
|
|
3781
|
+
const a = R(o, [...nt], (c) => c), u = a && a.distance <= x ? ` Did you mean '${a.best}'?` : "";
|
|
3782
|
+
t.push({
|
|
3783
|
+
category: "dataOptions",
|
|
3784
|
+
index: o,
|
|
3785
|
+
input: n[o],
|
|
3786
|
+
message: `Unknown dataOptions key '${o}'. Valid keys: rows, columns, values, grandTotals.${u}`
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
for (const o of ["rows", "columns", "values"]) {
|
|
3790
|
+
const a = n[o];
|
|
3791
|
+
a != null && !Array.isArray(a) && t.push({
|
|
3792
|
+
category: "dataOptions",
|
|
3793
|
+
index: o,
|
|
3794
|
+
input: a,
|
|
3795
|
+
message: `dataOptions.${o} must be an array`
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
const i = n.grandTotals;
|
|
3799
|
+
i != null && !Hn(i) && t.push({
|
|
3800
|
+
category: "dataOptions",
|
|
3801
|
+
index: "grandTotals",
|
|
3802
|
+
input: i,
|
|
3803
|
+
message: "grandTotals must be an object with optional rows?: boolean, columns?: boolean"
|
|
3804
|
+
});
|
|
3805
|
+
}
|
|
3806
|
+
return e.styleOptions !== void 0 && (r.styleOptions = e.styleOptions), e.filters !== void 0 && Array.isArray(e.filters) && (r.filters = e.filters), e.highlights !== void 0 && Array.isArray(e.highlights) && (r.highlights = e.highlights), { normalized: r, errors: t };
|
|
3807
|
+
}
|
|
3808
|
+
function Xn(e, t, r) {
|
|
3809
|
+
if (!e || typeof e != "object")
|
|
3810
|
+
return r.push({
|
|
3811
|
+
category: "dataOptions",
|
|
3812
|
+
index: -1,
|
|
3813
|
+
input: e,
|
|
3814
|
+
message: "dataOptions is required"
|
|
3815
|
+
}), null;
|
|
3816
|
+
const s = {}, n = r.length;
|
|
3817
|
+
for (const o of ["rows", "columns"]) {
|
|
3818
|
+
const a = re(
|
|
3819
|
+
o,
|
|
3820
|
+
e[o],
|
|
3821
|
+
"dimension",
|
|
3822
|
+
t,
|
|
3823
|
+
r
|
|
3824
|
+
);
|
|
3825
|
+
a && (s[o] = a);
|
|
3826
|
+
}
|
|
3827
|
+
const i = re(
|
|
3828
|
+
"values",
|
|
3829
|
+
e.values,
|
|
3830
|
+
"measure",
|
|
3831
|
+
t,
|
|
3832
|
+
r
|
|
3833
|
+
);
|
|
3834
|
+
return i && (s.values = i), e.grandTotals !== void 0 && (s.grandTotals = e.grandTotals), r.length > n ? null : s;
|
|
3835
|
+
}
|
|
3836
|
+
const ci = (e) => {
|
|
3837
|
+
const { data: t, context: r } = e, { dataSource: s, tables: n } = r, { normalized: i, errors: o } = Qn(t);
|
|
3838
|
+
if (o.length > 0)
|
|
3839
|
+
return { success: !1, errors: o };
|
|
3840
|
+
const a = $e(n), u = [], c = Xn(
|
|
3841
|
+
i.dataOptions,
|
|
3842
|
+
{ dataSource: s, schemaIndex: a },
|
|
3843
|
+
u
|
|
3844
|
+
);
|
|
3845
|
+
let p = null;
|
|
3846
|
+
i.filters && i.filters.length > 0 && (p = w(
|
|
3847
|
+
() => Re({
|
|
3848
|
+
data: i.filters || [],
|
|
3849
|
+
context: { dataSource: s, schemaIndex: a }
|
|
3850
|
+
}),
|
|
3851
|
+
u
|
|
3852
|
+
));
|
|
3853
|
+
let l = null;
|
|
3854
|
+
return i.highlights && i.highlights.length > 0 && (l = w(
|
|
3855
|
+
() => ve({
|
|
3856
|
+
data: i.highlights || [],
|
|
3857
|
+
context: { dataSource: s, schemaIndex: a }
|
|
3858
|
+
}),
|
|
3859
|
+
u
|
|
3860
|
+
)), u.length > 0 || c === null ? {
|
|
3861
|
+
success: !1,
|
|
3862
|
+
errors: u
|
|
3863
|
+
} : {
|
|
3864
|
+
success: !0,
|
|
3865
|
+
data: y(y(y({
|
|
3866
|
+
dataSet: we(s),
|
|
3867
|
+
dataOptions: c
|
|
3868
|
+
}, i.styleOptions && { styleOptions: i.styleOptions }), p && { filters: p }), l && { highlights: l })
|
|
3869
|
+
};
|
|
3870
|
+
}, li = (e) => {
|
|
3871
|
+
const t = [];
|
|
3872
|
+
if (!e.dataOptions)
|
|
3873
|
+
return {
|
|
3874
|
+
success: !1,
|
|
3875
|
+
errors: [
|
|
3876
|
+
{
|
|
3877
|
+
category: "dataOptions",
|
|
3878
|
+
index: -1,
|
|
3879
|
+
input: e,
|
|
3880
|
+
message: "dataOptions is required"
|
|
3881
|
+
}
|
|
3882
|
+
]
|
|
3883
|
+
};
|
|
3884
|
+
const r = e.dataOptions, s = {};
|
|
3885
|
+
for (const c of ["rows", "columns"]) {
|
|
3886
|
+
const p = r[c];
|
|
3887
|
+
if (p && p.length > 0) {
|
|
3888
|
+
const l = st(c, p, "dimension");
|
|
3889
|
+
l.success ? s[c] = l.data : t.push(...l.errors);
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
const n = r.values;
|
|
3893
|
+
if (n && n.length > 0) {
|
|
3894
|
+
const c = st("values", n, "measure");
|
|
3895
|
+
c.success ? s.values = c.data : t.push(...c.errors);
|
|
3896
|
+
}
|
|
3897
|
+
r.grandTotals !== void 0 && (s.grandTotals = r.grandTotals);
|
|
3898
|
+
let i;
|
|
3899
|
+
if (e.filters) {
|
|
3900
|
+
const c = w(
|
|
3901
|
+
() => Be(e.filters),
|
|
3902
|
+
t
|
|
3903
|
+
);
|
|
3904
|
+
i = c != null ? c : void 0;
|
|
3905
|
+
}
|
|
3906
|
+
let o;
|
|
3907
|
+
if (e.highlights && e.highlights.length > 0) {
|
|
3908
|
+
const c = w(
|
|
3909
|
+
() => ze(e.highlights),
|
|
3910
|
+
t
|
|
3911
|
+
);
|
|
3912
|
+
o = c != null ? c : void 0;
|
|
3913
|
+
}
|
|
3914
|
+
if (t.length > 0)
|
|
3915
|
+
return { success: !1, errors: t };
|
|
3916
|
+
const a = y(y(y({
|
|
3917
|
+
dataOptions: s
|
|
3918
|
+
}, e.styleOptions && { styleOptions: e.styleOptions }), i && i.length > 0 && { filters: i }), o && o.length > 0 && { highlights: o });
|
|
3919
|
+
return {
|
|
3920
|
+
success: !0,
|
|
3921
|
+
data: Q(
|
|
3922
|
+
a
|
|
3923
|
+
)
|
|
3924
|
+
};
|
|
3925
|
+
};
|
|
3926
|
+
function Zn(e) {
|
|
3927
|
+
const { filters: t, relations: r } = _r(
|
|
2745
3928
|
e.filters || []
|
|
2746
3929
|
);
|
|
2747
3930
|
return {
|
|
2748
3931
|
dataSource: e.dataSource,
|
|
2749
3932
|
dimensions: e.dimensions,
|
|
2750
3933
|
measures: e.measures,
|
|
2751
|
-
filters:
|
|
2752
|
-
filterRelations:
|
|
3934
|
+
filters: t,
|
|
3935
|
+
filterRelations: r,
|
|
2753
3936
|
highlights: e.highlights
|
|
2754
3937
|
// No count/offset/ungroup - these are execution concerns, not translation concerns
|
|
2755
3938
|
};
|
|
2756
3939
|
}
|
|
2757
|
-
function
|
|
2758
|
-
const s =
|
|
2759
|
-
return
|
|
3940
|
+
function fi(e, t, r = !1) {
|
|
3941
|
+
const s = Zn(e), n = Lr(s, t);
|
|
3942
|
+
return Ur(n, r);
|
|
2760
3943
|
}
|
|
2761
3944
|
export {
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
3945
|
+
ni as CustomSuperJSON,
|
|
3946
|
+
pi as EMPTY_EXPANDED_QUERY_MODEL,
|
|
3947
|
+
gi as EMPTY_SIMPLE_QUERY_MODEL,
|
|
3948
|
+
yi as isByIdDashboardCodeParams,
|
|
3949
|
+
hi as isByIdWidgetCodeParams,
|
|
3950
|
+
bi as isClientSideDashboardCodeParams,
|
|
3951
|
+
Ai as isClientSideWidgetCodeParams,
|
|
3952
|
+
ai as translateChartFromJSON,
|
|
3953
|
+
ui as translateChartToJSON,
|
|
3954
|
+
ci as translatePivotTableFromJSON,
|
|
3955
|
+
li as translatePivotTableToJSON,
|
|
3956
|
+
ii as translateQueryFromJSON,
|
|
3957
|
+
oi as translateQueryToJSON,
|
|
3958
|
+
fi as translateQueryToJaql
|
|
2772
3959
|
};
|