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