react-semaphor 0.1.507 → 0.1.508
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/DATA_APP_SDK.md +56 -0
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +194 -172
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/appearance-runtime/index.cjs +1 -1
- package/dist/appearance-runtime/index.js +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +139 -119
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/appearance-context-DzqCdhB4.cjs +1 -0
- package/dist/chunks/{appearance-context-XviHOhWJ.js → appearance-context-VJdrKi7r.js} +2 -1
- package/dist/chunks/{appearance-runtime-provider-D0xVQWnH.js → appearance-runtime-provider-CC4HT2Gi.js} +2 -2
- package/dist/chunks/{appearance-runtime-provider-Ca8rxO86.cjs → appearance-runtime-provider-D5pkvgE4.cjs} +1 -1
- package/dist/chunks/calculated-field-identity-BiTGmnST.cjs +1 -0
- package/dist/chunks/calculated-field-identity-CJL54uFx.js +1373 -0
- package/dist/chunks/{constants-NUleP4DY.js → card-config-utils-Bq1enstT.js} +260 -260
- package/dist/chunks/card-config-utils-CMO4_zVs.cjs +1 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXTpU85p.js → dashboard-briefing-launcher-B9l0ZAbv.js} +12 -12
- package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-C4zsM3Hd.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-BCQv4xWM.js} +16 -14
- package/dist/chunks/dashboard-controls-CWwllVOe.cjs +52 -0
- package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-BtU_q_0A.js} +9 -9
- package/dist/chunks/dashboard-json-DVj2xLsH.cjs +1 -0
- package/dist/chunks/edit-dashboard-visual-CO2IVBOq.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-RgFUx-py.js} +1986 -1990
- package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-BE8Fby6n.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-D-MaqTIs.js} +6 -6
- package/dist/chunks/field-aggregations-DUb0NU6c.js +1229 -0
- package/dist/chunks/field-aggregations-jSi77h9Z.cjs +1 -0
- package/dist/chunks/{field-dependencies-DVl2p1Nm.js → field-dependencies-Cl97kkHy.js} +30 -34
- package/dist/chunks/{field-dependencies-r_U0CGQ-.cjs → field-dependencies-DIab72rQ.cjs} +1 -1
- package/dist/chunks/{index-BVr4fcCB.js → index-0pdaQ9e1.js} +5 -5
- package/dist/chunks/index-BaIrLSBb.cjs +1422 -0
- package/dist/chunks/{index-De2QNsqV.js → index-ByiS9sB4.js} +45343 -43665
- package/dist/chunks/{index-C9KXfCkC.js → index-CLIro-EG.js} +3 -0
- package/dist/chunks/index-Cx3qmRUB.cjs +1 -0
- package/dist/chunks/{index-BlYf8gNa.cjs → index-DhlVxvyI.cjs} +1 -1
- package/dist/chunks/{matrix-card-DACDwdTq.js → matrix-card-CnKQpnsj.js} +1 -1
- package/dist/chunks/{matrix-card-CRXcmAjp.cjs → matrix-card-U4c72doZ.cjs} +1 -1
- package/dist/chunks/{matrix-control-sources-ClQzIk7E.js → matrix-control-sources-CRRdP03Q.js} +165 -134
- package/dist/chunks/matrix-control-sources-FjxGIbqk.cjs +1 -0
- package/dist/chunks/{matrix-formatter-7GLTcBuy.cjs → matrix-formatter-CveLJo6S.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-xsq7n_e6.js → matrix-formatter-ZVS5QOuq.js} +2 -2
- package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +1 -0
- package/dist/chunks/matrix-member-presentation-CzGZJd3a.js +182 -0
- package/dist/chunks/matrix-operation-contract-DoiWTUbT.cjs +1 -0
- package/dist/chunks/matrix-operation-contract-xL8IhFzp.js +1802 -0
- package/dist/chunks/{pivot-header-presentation-3wqWChFd.cjs → pivot-header-presentation-Cxz8-06f.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-D44ODZGn.js → pivot-header-presentation-DVylCBHB.js} +2 -2
- package/dist/chunks/{pivot-result-lifecycle-DZ0ZSMoM.cjs → pivot-result-lifecycle-BiERyXnS.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BSmqVkVG.js → pivot-result-lifecycle-CmjpW7qG.js} +1 -1
- package/dist/chunks/{report-preferences-dialog-xADifRXs.js → report-preferences-dialog-BbkXcnnn.js} +4 -4
- package/dist/chunks/report-preferences-dialog-C9rpWgQZ.cjs +1 -0
- package/dist/chunks/{search-BHsQIWBV.js → selection-reducer-B94WgZ9V.js} +55 -11
- package/dist/chunks/selection-reducer-CGKKsaPa.cjs +26 -0
- package/dist/chunks/{semantic-format-BhIL1PXP.cjs → semantic-format-BzH69TRq.cjs} +1 -1
- package/dist/chunks/{semantic-format-C3amkGmY.js → semantic-format-CBlRO8Aw.js} +1 -1
- package/dist/chunks/{switch-DHGiC0aU.js → switch-CD4uGTZI.js} +7450 -7694
- package/dist/chunks/switch-iC1x2dcE.cjs +134 -0
- package/dist/chunks/token-types-Ahh5u4iT.cjs +1 -0
- package/dist/chunks/token-types-CPde8_LG.js +8 -0
- package/dist/chunks/{update-policy-Cc9h57pA.cjs → update-policy-COjFudhl.cjs} +1 -1
- package/dist/chunks/{update-policy-eTcz52jO.js → update-policy-D9q1Tz8k.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +734 -622
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +3 -3
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +94 -92
- package/dist/data-app-codegen-node/index.js +337 -333
- package/dist/data-app-sdk/index.cjs +9 -9
- package/dist/data-app-sdk/index.js +1091 -969
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +104 -96
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/brand-studio/brand-studio-draft.d.ts +3 -1
- package/dist/types/components/dashboard/card-selection-pill.d.ts +5 -0
- package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
- package/dist/types/components/dashboard/drill-breadcrumb.d.ts +1 -0
- package/dist/types/components/dashboard/drill-navigation-controls.d.ts +3 -3
- package/dist/types/components/interactions/applied-filters-display.d.ts +6 -1
- package/dist/types/components/interactions/click-to-filter-review-dialog.d.ts +21 -0
- package/dist/types/components/interactions/dashboard-drill-host.d.ts +13 -0
- package/dist/types/components/interactions/filter-badge-tooltip.d.ts +4 -4
- package/dist/types/components/interactions/insight-modal.d.ts +4 -14
- package/dist/types/components/interactions/insight-viewer.d.ts +7 -19
- package/dist/types/components/interactions/interactions-sheet.d.ts +6 -0
- package/dist/types/components/interactions/panels/click-to-filter-panel.d.ts +20 -0
- package/dist/types/components/interactions/reusable/interaction-selection-popover.d.ts +2 -2
- package/dist/types/components/interactions/sheet/action-editor.d.ts +17 -0
- package/dist/types/components/interactions/sheet/action-meta.d.ts +45 -0
- package/dist/types/components/interactions/sheet/action-picker.d.ts +7 -0
- package/dist/types/components/interactions/sheet/click-outcome-preview.d.ts +10 -0
- package/dist/types/components/interactions/sheet/interactions-home.d.ts +28 -0
- package/dist/types/components/interactions/sheet/sheet-parts.d.ts +37 -0
- package/dist/types/components/surfboard/filter/dashboard-filter-mapping-panel.d.ts +28 -1
- package/dist/types/components/surfboard/filter/selection-chip.d.ts +11 -0
- package/dist/types/components/surfboard/filter/selection-filter-section.d.ts +4 -0
- package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +3 -0
- package/dist/types/components/ui/resizable.d.ts +1 -1
- package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +13 -1
- package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
- package/dist/types/data-app-sdk/adapters.d.ts +3 -2
- package/dist/types/data-app-sdk/builders.d.ts +2 -1
- package/dist/types/data-app-sdk/contracts.d.ts +44 -2
- package/dist/types/data-app-sdk/index.d.ts +1 -0
- package/dist/types/data-app-sdk/query-request.d.ts +7 -2
- package/dist/types/data-app-sdk/selection.d.ts +2 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +24 -23
- package/dist/types/lib/appearance/types.d.ts +3 -1
- package/dist/types/lib/briefings/briefing-attachment-model.d.ts +0 -2
- package/dist/types/lib/contexts/interactions-popover-context.d.ts +1 -8
- package/dist/types/lib/dashboard/click-to-filter-card-references.d.ts +23 -0
- package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +16 -2
- package/dist/types/lib/dashboard-inputs/build-selection-dashboard-inputs.d.ts +31 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-emitted-fields.d.ts +17 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-mapping-draft.d.ts +99 -0
- package/dist/types/lib/dashboard-inputs/click-to-filter-sheet-reach.d.ts +12 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +18 -1
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-candidate-metadata.d.ts +4 -1
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +10 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-snapshot.d.ts +8 -1
- package/dist/types/lib/dashboard-inputs/index.d.ts +1 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +18 -7
- package/dist/types/lib/dashboard-inputs/resolve-field-date-comparison-coverage.d.ts +5 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +77 -0
- package/dist/types/lib/dashboard-inputs/selection-targets.d.ts +26 -0
- package/dist/types/lib/dashboard-inputs/transient-input-context.d.ts +102 -0
- package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +50 -0
- package/dist/types/lib/dashboard-navigation/describe-carried-context.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/index.d.ts +1 -0
- package/dist/types/lib/dashboard-navigation/navigation-state.d.ts +120 -0
- package/dist/types/lib/dashboard-navigation/run-one-off-drill.d.ts +11 -0
- package/dist/types/lib/dashboard-navigation/use-transient-contexts.d.ts +17 -0
- package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +48 -0
- package/dist/types/lib/dashboard-view-state/drill-path.d.ts +20 -0
- package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
- package/dist/types/lib/download-pdf.d.ts +0 -3
- package/dist/types/lib/formatters/metric-formatting.d.ts +1 -1
- package/dist/types/lib/hooks/ai/dashboard-context.d.ts +15 -8
- package/dist/types/lib/hooks/chartjs/use-chart-blur.d.ts +10 -2
- package/dist/types/lib/hooks/interactions/{use-event-engine.d.ts → use-drill-actions.d.ts} +28 -7
- package/dist/types/lib/hooks/selection/use-active-selections.d.ts +15 -0
- package/dist/types/lib/hooks/selection/use-click-to-filter-mapping-draft.d.ts +20 -0
- package/dist/types/lib/hooks/selection/use-selection-click.d.ts +34 -0
- package/dist/types/lib/hooks/selection/use-selection-gestures.d.ts +38 -0
- package/dist/types/lib/hooks/selection/use-table-row-selection.d.ts +46 -0
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +0 -2
- package/dist/types/lib/hooks/use-dashboard-filter-mapping-candidates.d.ts +18 -0
- package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +1 -3
- package/dist/types/lib/hooks/use-interactions-popover.d.ts +1 -8
- package/dist/types/lib/hooks/use-resolved-card-config.d.ts +6 -0
- package/dist/types/lib/interactions/click-outcome.d.ts +25 -0
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +3 -1
- package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +1 -1
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +7 -0
- package/dist/types/lib/interactions/interaction-utils.d.ts +17 -1
- package/dist/types/lib/matrix-table/build-matrix-drill-to-detail.d.ts +15 -0
- package/dist/types/lib/matrix-table/matrix-card-interactions.d.ts +14 -3
- package/dist/types/lib/query-context/build-card-query-context.d.ts +19 -8
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -3
- package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +12 -4
- package/dist/types/lib/query-context/compile-selection-filters.d.ts +5 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +46 -0
- package/dist/types/lib/query-context/filter-group-utils.d.ts +3 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +29 -0
- package/dist/types/lib/selection/click-to-filter-authoring-support.d.ts +9 -0
- package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
- package/dist/types/lib/selection/selection-labels.d.ts +3 -0
- package/dist/types/lib/selection/selection-notices.d.ts +9 -0
- package/dist/types/lib/selection/selection-reducer.d.ts +46 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +62 -17
- package/dist/types/lib/stores/editor-store.d.ts +1 -2
- package/dist/types/lib/stores/index.d.ts +0 -2
- package/dist/types/lib/types/common-types.d.ts +60 -6
- package/dist/types/lib/types/explorer-types.d.ts +1 -22
- package/dist/types/lib/types/interaction-types.d.ts +6 -198
- package/dist/types/lib/utils/calculate-context-aware-filters.d.ts +21 -12
- package/dist/types/lib/utils/card-utils.d.ts +11 -0
- package/dist/types/lib/utils/date-hierarchy-utils.d.ts +3 -1
- package/dist/types/lib/utils/drag-and-drop-utils.d.ts +1 -1
- package/dist/types/lib/utils/interaction-icons.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +32 -32
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +100 -0
- package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/apply-group-by-override.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +88 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/linked-click-to-filter-overrides.d.ts +32 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
- package/package.json +1 -1
- package/src/data-app-sdk/README.md +58 -1
- package/dist/chunks/appearance-context-tNjvTJj3.cjs +0 -1
- package/dist/chunks/calculated-field-identity-BTpUqfEu.js +0 -1276
- package/dist/chunks/calculated-field-identity-rMuXuzEY.cjs +0 -1
- package/dist/chunks/constants-vtu7_IUo.cjs +0 -1
- package/dist/chunks/dashboard-controls-DlxeddZN.cjs +0 -52
- package/dist/chunks/dashboard-json-DhS4yJfc.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-X3OCnivL.cjs +0 -172
- package/dist/chunks/field-aggregations-BU_3gHKR.js +0 -957
- package/dist/chunks/field-aggregations-CDCamEsQ.cjs +0 -1
- package/dist/chunks/index-C8XCKzB6.cjs +0 -1
- package/dist/chunks/index-DSa6RSdg.cjs +0 -1417
- package/dist/chunks/matrix-control-sources-CeC5EMyq.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-E2B4k3ws.cjs +0 -1
- package/dist/chunks/matrix-member-presentation-qiHxv67e.js +0 -105
- package/dist/chunks/matrix-operation-contract-Cqy4EW2H.js +0 -1638
- package/dist/chunks/matrix-operation-contract-D9dLX-Wr.cjs +0 -1
- package/dist/chunks/report-preferences-dialog-7Vsc_fsG.cjs +0 -1
- package/dist/chunks/search-BqqhaMx9.cjs +0 -26
- package/dist/chunks/switch-BytP6QY8.cjs +0 -139
- package/dist/types/components/interactions/configuration-popover.d.ts +0 -1
- package/dist/types/components/interactions/interaction-card.d.ts +0 -59
- package/dist/types/components/interactions/interaction-event-handler.d.ts +0 -11
- package/dist/types/components/interactions/interactions-list.d.ts +0 -50
- package/dist/types/components/interactions/panels/cross-filter-panel.d.ts +0 -24
- package/dist/types/components/interactions/panels/inline-drill-panel.d.ts +0 -24
- package/dist/types/components/interactions/selectors/action-selector.d.ts +0 -31
- package/dist/types/components/interactions/selectors/trigger-selector.d.ts +0 -38
- package/dist/types/components/surfboard/filter/click-filter-section.d.ts +0 -5
- package/dist/types/lib/interactions/build-interaction-event.d.ts +0 -25
- package/dist/types/lib/interactions/convert-click-filters-to-filter-group.d.ts +0 -10
- package/dist/types/lib/interactions/execute-interaction-event.d.ts +0 -80
- package/dist/types/lib/interactions/field-utils.d.ts +0 -11
- package/dist/types/lib/interactions/handle-chart-click.d.ts +0 -75
- package/dist/types/lib/interactions/linked-interaction-utils.d.ts +0 -14
- package/dist/types/lib/interactions/source-card-filter-utils.d.ts +0 -9
- package/dist/types/lib/stores/drill-actions.d.ts +0 -139
- package/dist/types/lib/stores/interaction-store.d.ts +0 -113
- package/dist/types/lib/stores/pointer-interaction-store.d.ts +0 -18
|
@@ -0,0 +1,1229 @@
|
|
|
1
|
+
import { A as me, a_ as A, u as O, f as ue, ak as Z, ah as ee } from "./validators-BDYzZFgs.js";
|
|
2
|
+
import { G as fe, u as de } from "./matrix-operation-contract-xL8IhFzp.js";
|
|
3
|
+
import { f as he, C as be } from "./metric-comparison-C-sYqv0g.js";
|
|
4
|
+
import { z as u } from "zod";
|
|
5
|
+
import { m as ge } from "./source-entity-resolution-DZhUckix.js";
|
|
6
|
+
import { r as ye } from "./field-dependencies-Cl97kkHy.js";
|
|
7
|
+
import { i as Ce, a as ve } from "./matrix-card-CnKQpnsj.js";
|
|
8
|
+
import { v as $, a as _e, f as Ye } from "./temporal-bucket-B9hMwemw.js";
|
|
9
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as te } from "../value-format-preferences/index.js";
|
|
10
|
+
const N = /* @__PURE__ */ new Set([
|
|
11
|
+
"previous_period",
|
|
12
|
+
"same_period_last_year",
|
|
13
|
+
"start_vs_end",
|
|
14
|
+
"target"
|
|
15
|
+
]), Me = /* @__PURE__ */ new Set([...N, "none", ""]);
|
|
16
|
+
function h(e) {
|
|
17
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
18
|
+
}
|
|
19
|
+
function ne(e) {
|
|
20
|
+
const t = h(e.preferences) ? e.preferences : void 0, n = t && h(t.kpiVisualOptions) ? t.kpiVisualOptions : void 0, o = t && h(t.tableVisualOptions) ? t.tableVisualOptions : void 0;
|
|
21
|
+
return {
|
|
22
|
+
preferences: t,
|
|
23
|
+
kpiOptions: n,
|
|
24
|
+
kpiComparison: n && h(n.metricComparison) ? n.metricComparison : void 0,
|
|
25
|
+
kpiComparisonPresent: !!n && "metricComparison" in n,
|
|
26
|
+
tableOptions: o,
|
|
27
|
+
tableComparison: o && h(o.metricComparison) ? o.metricComparison : void 0,
|
|
28
|
+
tableComparisonPresent: !!o && "metricComparison" in o
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function J(e) {
|
|
32
|
+
const t = [], n = (o, i) => {
|
|
33
|
+
if (Array.isArray(o)) {
|
|
34
|
+
o.forEach((s, r) => n(s, `${i}[${r}]`));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!h(o)) return;
|
|
38
|
+
const a = o.config;
|
|
39
|
+
if (h(a)) {
|
|
40
|
+
const s = ne(o), r = !!(s.kpiComparisonPresent || s.tableComparisonPresent), m = a.metricColumns, p = Array.isArray(m) ? m.flatMap(
|
|
41
|
+
(l, c) => h(l) ? [{ index: c, metric: l }] : []
|
|
42
|
+
) : [];
|
|
43
|
+
if ((p.some(({ metric: l }) => "comparisonType" in l) || r) && t.push({
|
|
44
|
+
path: i,
|
|
45
|
+
card: o,
|
|
46
|
+
metrics: p,
|
|
47
|
+
malformedMetricIndexes: Array.isArray(m) ? m.flatMap(
|
|
48
|
+
(l, c) => h(l) ? [] : [c]
|
|
49
|
+
) : [],
|
|
50
|
+
malformedMetricColumns: "metricColumns" in a && !Array.isArray(m),
|
|
51
|
+
hasLegacyPresentation: r
|
|
52
|
+
}), "metricColumns" in a || r) return;
|
|
53
|
+
}
|
|
54
|
+
Object.entries(o).forEach(
|
|
55
|
+
([s, r]) => n(r, i ? `${i}.${s}` : s)
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
return n(e, "$"), t;
|
|
59
|
+
}
|
|
60
|
+
const oe = {
|
|
61
|
+
difference: "difference",
|
|
62
|
+
change: "percent_change",
|
|
63
|
+
change_difference: "both",
|
|
64
|
+
ratio: "ratio"
|
|
65
|
+
};
|
|
66
|
+
function U(e, t) {
|
|
67
|
+
if (!e) return;
|
|
68
|
+
const n = Object.fromEntries(
|
|
69
|
+
t.flatMap(
|
|
70
|
+
(o) => typeof e[o] == "string" ? [[o, e[o]]] : []
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
return Object.keys(n).length ? n : void 0;
|
|
74
|
+
}
|
|
75
|
+
function ke(e, t, n) {
|
|
76
|
+
if (e !== void 0) {
|
|
77
|
+
if (!h(e)) {
|
|
78
|
+
n.push({
|
|
79
|
+
severity: "error",
|
|
80
|
+
code: "invalid_legacy_comparison_presentation",
|
|
81
|
+
path: t,
|
|
82
|
+
message: "Legacy comparison formatOptions must be an object."
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
Object.entries(e).forEach(([o, i]) => {
|
|
87
|
+
if (o === "decimalPlaces") {
|
|
88
|
+
(typeof i != "number" || !Number.isInteger(i) || i < 0 || i > 6) && n.push({
|
|
89
|
+
severity: "error",
|
|
90
|
+
code: "invalid_legacy_comparison_presentation",
|
|
91
|
+
path: `${t}.decimalPlaces`,
|
|
92
|
+
message: "Legacy comparison decimalPlaces must be an integer from 0 through 6."
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
o === "type" && (i === void 0 || i === "auto") || i !== void 0 && n.push({
|
|
97
|
+
severity: "error",
|
|
98
|
+
code: "unsupported_comparison_format",
|
|
99
|
+
path: `${t}.${o}`,
|
|
100
|
+
message: `Legacy comparison format option "${o}" has no canonical presentation mapping.`
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function L(e, t) {
|
|
106
|
+
const n = t === "kpi" ? e.calculationType : e.calculatedAs, o = t === "table" && n === void 0 ? "both" : oe[String(n)], i = h(e.formatOptions) ? e.formatOptions : void 0, a = h(e.conditionalLabels) ? e.conditionalLabels : void 0, s = h(
|
|
107
|
+
t === "kpi" ? e.colorConfig : e.colors
|
|
108
|
+
) ? t === "kpi" ? e.colorConfig : e.colors : void 0, r = {};
|
|
109
|
+
if (o && (r.displayMode = o), typeof (i == null ? void 0 : i.decimalPlaces) == "number" && (r.precision = i.decimalPlaces), t === "kpi") {
|
|
110
|
+
const l = e.showArrow !== !1, c = e.showColor !== !1;
|
|
111
|
+
r.indicatorStyle = l ? c ? "arrow_badge" : "arrow" : c ? "badge" : "none", r.showColor = c, (e.position === "left" || e.position === "right" || e.position === "top") && (r.position = e.position), typeof e.conditionalLabel == "boolean" && (r.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (r.labelName = e.labelName);
|
|
112
|
+
} else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (r.indicatorStyle = e.indicatorStyle);
|
|
113
|
+
const m = a ? {
|
|
114
|
+
...U(a, ["increase", "decrease"]),
|
|
115
|
+
...typeof a.noChange == "string" ? { neutral: a.noChange } : typeof a.neutral == "string" ? { neutral: a.neutral } : {}
|
|
116
|
+
} : void 0;
|
|
117
|
+
m && Object.keys(m).length && (r.conditionalLabels = m);
|
|
118
|
+
const p = s ? {
|
|
119
|
+
...U(s, ["increase", "decrease"]),
|
|
120
|
+
...typeof s.noChange == "string" ? { neutral: s.noChange } : typeof s.neutral == "string" ? { neutral: s.neutral } : {}
|
|
121
|
+
} : void 0;
|
|
122
|
+
return p && Object.keys(p).length && (r.colors = p), r;
|
|
123
|
+
}
|
|
124
|
+
function G(e) {
|
|
125
|
+
return { ...be, ...e };
|
|
126
|
+
}
|
|
127
|
+
function z(e) {
|
|
128
|
+
return e.some(({ metric: t }) => t.comparisonType === "previous_period" || t.comparisonType === "same_period_last_year" || t.comparisonType === "target" ? !0 : h(t.comparison) && t.comparison.mode === "explicit");
|
|
129
|
+
}
|
|
130
|
+
function F(e) {
|
|
131
|
+
const t = e.card.config;
|
|
132
|
+
return e.metrics.length === 2 && (t.groupByColumns === void 0 || Array.isArray(t.groupByColumns) && t.groupByColumns.length === 0);
|
|
133
|
+
}
|
|
134
|
+
function K(e, t, n, o) {
|
|
135
|
+
const i = t === "kpi" ? [
|
|
136
|
+
"enabled",
|
|
137
|
+
"calculationType",
|
|
138
|
+
"formatOptions",
|
|
139
|
+
"showArrow",
|
|
140
|
+
"showColor",
|
|
141
|
+
"conditionalLabel",
|
|
142
|
+
"labelName",
|
|
143
|
+
"position",
|
|
144
|
+
"conditionalLabels",
|
|
145
|
+
"colorConfig",
|
|
146
|
+
"lowerIsBetter"
|
|
147
|
+
] : [
|
|
148
|
+
"calculatedAs",
|
|
149
|
+
"indicatorStyle",
|
|
150
|
+
"formatOptions",
|
|
151
|
+
"colors",
|
|
152
|
+
"lowerIsBetter"
|
|
153
|
+
];
|
|
154
|
+
Object.keys(e).forEach((l) => {
|
|
155
|
+
i.includes(l) || o.push({
|
|
156
|
+
severity: "error",
|
|
157
|
+
code: "invalid_legacy_comparison_presentation",
|
|
158
|
+
path: `${n}.${l}`,
|
|
159
|
+
message: `Unknown legacy comparison presentation field "${l}" cannot be dropped automatically.`
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
const a = t === "kpi" ? "calculationType" : "calculatedAs";
|
|
163
|
+
e[a] !== void 0 && !oe[String(e[a])] && o.push({
|
|
164
|
+
severity: "error",
|
|
165
|
+
code: "invalid_legacy_comparison_presentation",
|
|
166
|
+
path: `${n}.${a}`,
|
|
167
|
+
message: `Legacy comparison ${a} is unsupported.`
|
|
168
|
+
}), t === "kpi" && e.position !== void 0 && !["left", "right", "top"].includes(String(e.position)) && o.push({
|
|
169
|
+
severity: "error",
|
|
170
|
+
code: "invalid_legacy_comparison_presentation",
|
|
171
|
+
path: `${n}.position`,
|
|
172
|
+
message: "Legacy comparison position is unsupported."
|
|
173
|
+
}), t === "kpi" && e.labelName !== void 0 && typeof e.labelName != "string" && o.push({
|
|
174
|
+
severity: "error",
|
|
175
|
+
code: "invalid_legacy_comparison_presentation",
|
|
176
|
+
path: `${n}.labelName`,
|
|
177
|
+
message: "Legacy comparison labelName must be a string."
|
|
178
|
+
}), (t === "kpi" ? [
|
|
179
|
+
["conditionalLabels", ["increase", "decrease", "noChange"]],
|
|
180
|
+
["colorConfig", ["increase", "decrease", "noChange"]]
|
|
181
|
+
] : [["colors", ["increase", "decrease", "neutral"]]]).forEach(([l, c]) => {
|
|
182
|
+
if (e[l] !== void 0) {
|
|
183
|
+
if (!h(e[l])) {
|
|
184
|
+
o.push({
|
|
185
|
+
severity: "error",
|
|
186
|
+
code: "invalid_legacy_comparison_presentation",
|
|
187
|
+
path: `${n}.${l}`,
|
|
188
|
+
message: `Legacy comparison ${l} must be an object.`
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
Object.entries(e[l]).forEach(([b, f]) => {
|
|
193
|
+
c.includes(b) ? typeof f != "string" && o.push({
|
|
194
|
+
severity: "error",
|
|
195
|
+
code: "invalid_legacy_comparison_presentation",
|
|
196
|
+
path: `${n}.${l}.${b}`,
|
|
197
|
+
message: `Legacy comparison ${l}.${b} must be a string.`
|
|
198
|
+
}) : o.push({
|
|
199
|
+
severity: "error",
|
|
200
|
+
code: "invalid_legacy_comparison_presentation",
|
|
201
|
+
path: `${n}.${l}.${b}`,
|
|
202
|
+
message: `Unknown legacy comparison ${l} field "${b}" cannot be dropped automatically.`
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}), (t === "kpi" ? ["enabled", "showArrow", "showColor", "conditionalLabel", "lowerIsBetter"] : ["lowerIsBetter"]).forEach((l) => {
|
|
207
|
+
e[l] !== void 0 && typeof e[l] != "boolean" && o.push({
|
|
208
|
+
severity: "error",
|
|
209
|
+
code: "invalid_legacy_comparison_presentation",
|
|
210
|
+
path: `${n}.${l}`,
|
|
211
|
+
message: `Legacy comparison ${l} must be a boolean.`
|
|
212
|
+
});
|
|
213
|
+
}), t === "table" && e.indicatorStyle !== void 0 && !["arrow_badge", "arrow", "badge", "none"].includes(
|
|
214
|
+
String(e.indicatorStyle)
|
|
215
|
+
) && o.push({
|
|
216
|
+
severity: "error",
|
|
217
|
+
code: "invalid_legacy_comparison_presentation",
|
|
218
|
+
path: `${n}.indicatorStyle`,
|
|
219
|
+
message: "Legacy comparison indicatorStyle is unsupported."
|
|
220
|
+
}), ke(e.formatOptions, `${n}.formatOptions`, o);
|
|
221
|
+
const m = L(e, t);
|
|
222
|
+
he(m, n).errors.forEach((l) => {
|
|
223
|
+
o.push({
|
|
224
|
+
severity: "error",
|
|
225
|
+
code: "invalid_legacy_comparison_presentation",
|
|
226
|
+
path: l.path || n,
|
|
227
|
+
message: l.message
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function Q(e) {
|
|
232
|
+
const t = ne(e.card), n = t.kpiComparison ? L(t.kpiComparison, "kpi") : void 0, o = t.tableComparison ? L(t.tableComparison, "table") : void 0;
|
|
233
|
+
return { namespaces: t, kpi: n, table: o, presentation: n || o };
|
|
234
|
+
}
|
|
235
|
+
function Ee(e) {
|
|
236
|
+
const t = h(e.preferences) ? e.preferences : {}, n = h(t.kpiVisualOptions) ? t.kpiVisualOptions : {}, o = h(n.metricComparison) ? n.metricComparison : {}, i = h(t.tableVisualOptions) ? t.tableVisualOptions : {}, a = h(i.metricComparison) ? i.metricComparison : {};
|
|
237
|
+
return n.lowerIsBetter === !0 || o.lowerIsBetter === !0 || a.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
|
|
238
|
+
}
|
|
239
|
+
function Ie(e) {
|
|
240
|
+
switch (e.comparisonType) {
|
|
241
|
+
case "previous_period":
|
|
242
|
+
return { mode: "explicit", spec: { kind: "previous_period" } };
|
|
243
|
+
case "same_period_last_year":
|
|
244
|
+
return { mode: "explicit", spec: { kind: "previous_year" } };
|
|
245
|
+
case "target":
|
|
246
|
+
return {
|
|
247
|
+
mode: "explicit",
|
|
248
|
+
spec: { kind: "target", targetValue: e.targetValue }
|
|
249
|
+
};
|
|
250
|
+
default:
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function Te(e) {
|
|
255
|
+
const t = h(e.preferences) ? e.preferences : void 0;
|
|
256
|
+
if (!t) return;
|
|
257
|
+
const n = h(t.kpiVisualOptions) ? t.kpiVisualOptions : void 0;
|
|
258
|
+
n && delete n.lowerIsBetter;
|
|
259
|
+
const o = h(t.tableVisualOptions) ? t.tableVisualOptions : void 0, i = o && h(o.metricComparison) ? o.metricComparison : void 0;
|
|
260
|
+
i && delete i.lowerIsBetter;
|
|
261
|
+
}
|
|
262
|
+
function at(e) {
|
|
263
|
+
const t = J(e);
|
|
264
|
+
if (!t.length)
|
|
265
|
+
return { document: e, changed: !1, changes: [], diagnostics: [] };
|
|
266
|
+
const n = [];
|
|
267
|
+
if (t.forEach((s) => {
|
|
268
|
+
var r, m, p, l;
|
|
269
|
+
if (s.malformedMetricColumns && n.push({
|
|
270
|
+
severity: "error",
|
|
271
|
+
code: "malformed_metric_columns",
|
|
272
|
+
path: `${s.path}.config.metricColumns`,
|
|
273
|
+
message: "Metric columns must be an array before comparison migration."
|
|
274
|
+
}), s.malformedMetricIndexes.forEach((c) => {
|
|
275
|
+
n.push({
|
|
276
|
+
severity: "error",
|
|
277
|
+
code: "malformed_metric_columns",
|
|
278
|
+
path: `${s.path}.config.metricColumns[${c}]`,
|
|
279
|
+
message: "Metric columns must contain objects before comparison migration."
|
|
280
|
+
});
|
|
281
|
+
}), s.metrics.forEach(({ metric: c, index: b }) => {
|
|
282
|
+
if (!("comparisonType" in c)) return;
|
|
283
|
+
const f = `${s.path}.config.metricColumns[${b}]`, y = String(c.comparisonType || "");
|
|
284
|
+
"comparison" in c && n.push({
|
|
285
|
+
severity: "error",
|
|
286
|
+
code: "conflicting_comparison_contracts",
|
|
287
|
+
path: f,
|
|
288
|
+
message: "Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."
|
|
289
|
+
});
|
|
290
|
+
const C = h(c.parameters) ? c.parameters : void 0, _ = C && h(C.windowTransform) ? C.windowTransform : void 0;
|
|
291
|
+
N.has(y) && (_ == null ? void 0 : _.function) === "previous_period_delta" && n.push({
|
|
292
|
+
severity: "error",
|
|
293
|
+
code: "conflicting_comparison_window_transform",
|
|
294
|
+
path: f,
|
|
295
|
+
message: "A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."
|
|
296
|
+
}), Me.has(y) || n.push({
|
|
297
|
+
severity: "error",
|
|
298
|
+
code: "unsupported_comparison_type",
|
|
299
|
+
path: `${f}.comparisonType`,
|
|
300
|
+
message: `Unsupported legacy metric comparison type "${y}".`
|
|
301
|
+
}), c.comparisonType === "target" && (typeof c.targetValue != "number" || !Number.isFinite(c.targetValue)) && n.push({
|
|
302
|
+
severity: "error",
|
|
303
|
+
code: "invalid_target_value",
|
|
304
|
+
path: `${f}.targetValue`,
|
|
305
|
+
message: "Legacy target comparison requires a finite metric targetValue."
|
|
306
|
+
}), c.comparisonType === "start_vs_end" && n.push({
|
|
307
|
+
severity: "error",
|
|
308
|
+
code: "unsupported_start_vs_end",
|
|
309
|
+
path: `${f}.comparisonType`,
|
|
310
|
+
message: "start_vs_end is retired and cannot be migrated automatically."
|
|
311
|
+
}), c.targetValue !== void 0 && c.comparisonType !== "target" && n.push({
|
|
312
|
+
severity: "warning",
|
|
313
|
+
code: "stray_target_value",
|
|
314
|
+
path: `${f}.targetValue`,
|
|
315
|
+
message: "Dead non-target targetValue will be removed without changing the baseline."
|
|
316
|
+
});
|
|
317
|
+
}), s.hasLegacyPresentation) {
|
|
318
|
+
const { namespaces: c, kpi: b, table: f } = Q(s), y = [
|
|
319
|
+
(r = c.kpiOptions) == null ? void 0 : r.lowerIsBetter,
|
|
320
|
+
(m = c.kpiComparison) == null ? void 0 : m.lowerIsBetter,
|
|
321
|
+
(p = c.tableComparison) == null ? void 0 : p.lowerIsBetter
|
|
322
|
+
].filter((C) => typeof C == "boolean");
|
|
323
|
+
new Set(y).size > 1 && n.push({
|
|
324
|
+
severity: "error",
|
|
325
|
+
code: "conflicting_legacy_polarity",
|
|
326
|
+
path: `${s.path}.preferences`,
|
|
327
|
+
message: "Legacy comparison polarity values disagree; resolve the conflict before migration."
|
|
328
|
+
}), ((l = c.kpiOptions) == null ? void 0 : l.lowerIsBetter) !== void 0 && typeof c.kpiOptions.lowerIsBetter != "boolean" && n.push({
|
|
329
|
+
severity: "error",
|
|
330
|
+
code: "invalid_legacy_comparison_presentation",
|
|
331
|
+
path: `${s.path}.preferences.kpiVisualOptions.lowerIsBetter`,
|
|
332
|
+
message: "Legacy comparison lowerIsBetter must be a boolean."
|
|
333
|
+
}), c.kpiComparisonPresent && !c.kpiComparison && n.push({
|
|
334
|
+
severity: "error",
|
|
335
|
+
code: "invalid_legacy_comparison_presentation",
|
|
336
|
+
path: `${s.path}.preferences.kpiVisualOptions.metricComparison`,
|
|
337
|
+
message: "Legacy KPI comparison presentation must be an object."
|
|
338
|
+
}), c.tableComparisonPresent && !c.tableComparison && n.push({
|
|
339
|
+
severity: "error",
|
|
340
|
+
code: "invalid_legacy_comparison_presentation",
|
|
341
|
+
path: `${s.path}.preferences.tableVisualOptions.metricComparison`,
|
|
342
|
+
message: "Legacy table comparison presentation must be an object."
|
|
343
|
+
}), "comparisonPresentation" in (c.preferences || {}) && n.push({
|
|
344
|
+
severity: "error",
|
|
345
|
+
code: "conflicting_comparison_presentation_contracts",
|
|
346
|
+
path: `${s.path}.preferences.comparisonPresentation`,
|
|
347
|
+
message: "Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."
|
|
348
|
+
}), c.kpiComparison && typeof c.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (c.preferences || {}) && F(s) && n.push({
|
|
349
|
+
severity: "error",
|
|
350
|
+
code: "conflicting_comparison_presentation_contracts",
|
|
351
|
+
path: `${s.path}.preferences.metricPairComparisonEnabled`,
|
|
352
|
+
message: "Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."
|
|
353
|
+
}), c.kpiComparison && K(
|
|
354
|
+
c.kpiComparison,
|
|
355
|
+
"kpi",
|
|
356
|
+
`${s.path}.preferences.kpiVisualOptions.metricComparison`,
|
|
357
|
+
n
|
|
358
|
+
), c.tableComparison && K(
|
|
359
|
+
c.tableComparison,
|
|
360
|
+
"table",
|
|
361
|
+
`${s.path}.preferences.tableVisualOptions.metricComparison`,
|
|
362
|
+
n
|
|
363
|
+
), b && f && JSON.stringify(G(b)) !== JSON.stringify(G(f)) && n.push({
|
|
364
|
+
severity: "error",
|
|
365
|
+
code: "conflicting_legacy_presentation_namespaces",
|
|
366
|
+
path: `${s.path}.preferences`,
|
|
367
|
+
message: "KPI and table comparison presentation values disagree; resolve the conflict before migration."
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}), n.some((s) => s.severity === "error"))
|
|
371
|
+
return { document: e, changed: !1, changes: [], diagnostics: n };
|
|
372
|
+
const o = JSON.parse(JSON.stringify(e)), i = J(o), a = [];
|
|
373
|
+
return i.forEach((s) => {
|
|
374
|
+
var m;
|
|
375
|
+
const r = Ee(s.card);
|
|
376
|
+
if (s.metrics.forEach(({ metric: p, index: l }) => {
|
|
377
|
+
if (!("comparisonType" in p)) return;
|
|
378
|
+
const c = String(p.comparisonType || ""), b = `${s.path}.config.metricColumns[${l}]`, f = Ie(p), y = ["comparisonType"];
|
|
379
|
+
delete p.comparisonType, "targetValue" in p && (delete p.targetValue, y.push("targetValue")), "comparisonDisplay" in p && (delete p.comparisonDisplay, y.push("comparisonDisplay")), f ? p.comparison = f : delete p.comparison, N.has(c) && (p.comparisonPolarity = r), a.push({
|
|
380
|
+
kind: "metric",
|
|
381
|
+
path: b,
|
|
382
|
+
metricId: typeof p.id == "string" ? p.id : void 0,
|
|
383
|
+
legacyType: c,
|
|
384
|
+
comparison: f,
|
|
385
|
+
comparisonPolarity: N.has(c) ? r : void 0,
|
|
386
|
+
removedFields: y
|
|
387
|
+
});
|
|
388
|
+
}), Te(s.card), s.hasLegacyPresentation) {
|
|
389
|
+
const { namespaces: p, presentation: l } = Q(s), c = (m = p.kpiComparison) == null ? void 0 : m.enabled, b = {
|
|
390
|
+
...l
|
|
391
|
+
};
|
|
392
|
+
typeof c == "boolean" && z(s.metrics) && (b.showComparison = c);
|
|
393
|
+
const f = typeof c == "boolean" && F(s) ? c : void 0, y = typeof c == "boolean" && !z(s.metrics) && !F(s) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, C = p.preferences, _ = [];
|
|
394
|
+
s.metrics.forEach(({ metric: D }) => {
|
|
395
|
+
"comparisonPolarity" in D || (D.comparisonPolarity = r, typeof D.id == "string" && _.push(D.id));
|
|
396
|
+
}), Object.keys(b).length && (C.comparisonPresentation = b), f !== void 0 && (C.metricPairComparisonEnabled = f), p.kpiOptions && delete p.kpiOptions.metricComparison, p.tableOptions && delete p.tableOptions.metricComparison, a.push({
|
|
397
|
+
kind: "presentation",
|
|
398
|
+
path: `${s.path}.preferences`,
|
|
399
|
+
comparisonPresentation: Object.keys(b).length ? b : void 0,
|
|
400
|
+
metricPairComparisonEnabled: f,
|
|
401
|
+
comparisonPolarityMetricIds: _,
|
|
402
|
+
intentionallyDiscardedFields: y,
|
|
403
|
+
removedFields: [
|
|
404
|
+
...p.kpiComparison ? ["kpiVisualOptions.metricComparison"] : [],
|
|
405
|
+
...p.tableComparison ? ["tableVisualOptions.metricComparison"] : []
|
|
406
|
+
]
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}), { document: o, changed: !0, changes: a, diagnostics: n };
|
|
410
|
+
}
|
|
411
|
+
function d(e) {
|
|
412
|
+
return typeof e == "string" && e.trim().length > 0 ? e.trim() : null;
|
|
413
|
+
}
|
|
414
|
+
function ie(e) {
|
|
415
|
+
return Array.from(new Set(e.filter((t) => !!t)));
|
|
416
|
+
}
|
|
417
|
+
function Ae(e) {
|
|
418
|
+
const t = d(e.table), n = d(e.schema), o = d(e.catalog) || d(e.database);
|
|
419
|
+
return t ? ie([
|
|
420
|
+
t,
|
|
421
|
+
n ? `${n}.${t}` : null,
|
|
422
|
+
o ? `${o}.${t}` : null,
|
|
423
|
+
o && n ? `${o}.${n}.${t}` : null
|
|
424
|
+
]) : [];
|
|
425
|
+
}
|
|
426
|
+
function W(e) {
|
|
427
|
+
const t = d(e.table) || d(e.tableName);
|
|
428
|
+
return ie([
|
|
429
|
+
d(e.name),
|
|
430
|
+
d(e.alias),
|
|
431
|
+
...Ae({
|
|
432
|
+
table: t,
|
|
433
|
+
schema: d(e.schema) || d(e.schemaName),
|
|
434
|
+
catalog: d(e.catalog),
|
|
435
|
+
database: d(e.database) || d(e.databaseName)
|
|
436
|
+
})
|
|
437
|
+
]);
|
|
438
|
+
}
|
|
439
|
+
function De(e, t) {
|
|
440
|
+
const n = d(e.domainId), o = d(t.domainId);
|
|
441
|
+
if (n && o && n !== o)
|
|
442
|
+
return !0;
|
|
443
|
+
if (e.type === "dataset")
|
|
444
|
+
return !1;
|
|
445
|
+
const i = d(e.id), a = d(t.id);
|
|
446
|
+
if (i && a && i !== a)
|
|
447
|
+
return !0;
|
|
448
|
+
const s = d(e.connectionId), r = d(t.connectionId);
|
|
449
|
+
return !!(s && r && s !== r);
|
|
450
|
+
}
|
|
451
|
+
function x(e, t = !1) {
|
|
452
|
+
return d(e.table) || d(e.tableName) || (e.type !== "dataset" || t ? d(e.name) : null);
|
|
453
|
+
}
|
|
454
|
+
function V(e) {
|
|
455
|
+
return d(e.catalog) || d(e.database) || d(e.databaseName);
|
|
456
|
+
}
|
|
457
|
+
function R(e) {
|
|
458
|
+
return d(e.schema) || d(e.schemaName);
|
|
459
|
+
}
|
|
460
|
+
function w(e) {
|
|
461
|
+
return e.length === 1 ? e[0] : void 0;
|
|
462
|
+
}
|
|
463
|
+
function Ne(e, t) {
|
|
464
|
+
const n = x(t, !0), o = V(t), i = R(t);
|
|
465
|
+
if (!(!n || !o && !i))
|
|
466
|
+
return w(
|
|
467
|
+
e.filter((a) => {
|
|
468
|
+
const s = a;
|
|
469
|
+
return !(x(s) !== n || o && V(s) !== o || i && R(s) !== i);
|
|
470
|
+
})
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
function E(e, t) {
|
|
474
|
+
if (!t || !(e != null && e.length))
|
|
475
|
+
return;
|
|
476
|
+
const n = e.filter(
|
|
477
|
+
(r) => !De(r, t)
|
|
478
|
+
);
|
|
479
|
+
if (t.type === "dataset") {
|
|
480
|
+
const r = d(t.id);
|
|
481
|
+
if (r)
|
|
482
|
+
return w(
|
|
483
|
+
n.filter(
|
|
484
|
+
(p) => p.type === "dataset" && d(p.id) === r
|
|
485
|
+
)
|
|
486
|
+
);
|
|
487
|
+
if (d(t.domainId)) {
|
|
488
|
+
const p = d(t.name);
|
|
489
|
+
return w(
|
|
490
|
+
n.filter(
|
|
491
|
+
(l) => l.type === "dataset" && d(l.name) === p
|
|
492
|
+
)
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
let o = [];
|
|
497
|
+
if (t.type === "dataset") {
|
|
498
|
+
const r = d(t.name);
|
|
499
|
+
if (o = n.filter(
|
|
500
|
+
(m) => m.type === "dataset" && d(m.name) === r
|
|
501
|
+
), o.length === 1)
|
|
502
|
+
return o[0];
|
|
503
|
+
}
|
|
504
|
+
if (!!(x(t, !0) && (V(t) || R(t))))
|
|
505
|
+
return Ne(n, t);
|
|
506
|
+
if (o.length > 1)
|
|
507
|
+
return;
|
|
508
|
+
const a = W(t);
|
|
509
|
+
if (a.length === 0)
|
|
510
|
+
return;
|
|
511
|
+
const s = n.filter((r) => W(
|
|
512
|
+
r
|
|
513
|
+
).some(
|
|
514
|
+
(p) => a.includes(p)
|
|
515
|
+
));
|
|
516
|
+
return w(s);
|
|
517
|
+
}
|
|
518
|
+
function B(e, t) {
|
|
519
|
+
const n = E(e, t);
|
|
520
|
+
return n ? { ...t, ...n } : t;
|
|
521
|
+
}
|
|
522
|
+
function ct(e, t) {
|
|
523
|
+
const n = t || [];
|
|
524
|
+
return n.length === 0 ? e : {
|
|
525
|
+
...e,
|
|
526
|
+
baseEntity: B(n, e.baseEntity),
|
|
527
|
+
joins: e.joins.map((o) => ({
|
|
528
|
+
...o,
|
|
529
|
+
source: B(n, o.source),
|
|
530
|
+
target: B(n, o.target)
|
|
531
|
+
}))
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function lt(e, t) {
|
|
535
|
+
if (!(e != null && e.joins.length))
|
|
536
|
+
return [];
|
|
537
|
+
const n = [
|
|
538
|
+
e.baseEntity,
|
|
539
|
+
...e.joins.flatMap((i) => [i.source, i.target])
|
|
540
|
+
], o = [];
|
|
541
|
+
return n.forEach((i) => {
|
|
542
|
+
!E(t, i) && !E(o, i) && o.push(i);
|
|
543
|
+
}), o;
|
|
544
|
+
}
|
|
545
|
+
function M(e) {
|
|
546
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
547
|
+
}
|
|
548
|
+
function k(e) {
|
|
549
|
+
return M(e) && typeof e.name == "string";
|
|
550
|
+
}
|
|
551
|
+
function H(e) {
|
|
552
|
+
return !M(e) || e.kind !== "semantic" && e.kind !== "physical" || (e.kind === "semantic" ? [e.datasetId, e.datasetName, e.connectionId] : [e.databaseName, e.schemaName]).some(
|
|
553
|
+
(n) => n !== void 0 && typeof n != "string"
|
|
554
|
+
) ? !1 : me(
|
|
555
|
+
e
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
function we(e) {
|
|
559
|
+
return [
|
|
560
|
+
...e.groupByColumns ?? [],
|
|
561
|
+
...e.metricColumns ?? [],
|
|
562
|
+
...e.pivotByColumns ?? [],
|
|
563
|
+
...e.detailColumns ?? [],
|
|
564
|
+
...e.sortByColumns ?? []
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
function S(e) {
|
|
568
|
+
return e ? [
|
|
569
|
+
...(e.conditions ?? []).flatMap(
|
|
570
|
+
(t) => t.field ? [t.field] : []
|
|
571
|
+
),
|
|
572
|
+
...(e.groups ?? []).flatMap(S)
|
|
573
|
+
] : [];
|
|
574
|
+
}
|
|
575
|
+
function se(e) {
|
|
576
|
+
var o, i;
|
|
577
|
+
const t = "parameters" in e ? S((o = e.parameters) == null ? void 0 : o.filters) : [], n = ((i = e.calculatedFormula) == null ? void 0 : i.inputFields) ?? [];
|
|
578
|
+
return [
|
|
579
|
+
...t,
|
|
580
|
+
...n.flatMap((a) => se(a))
|
|
581
|
+
];
|
|
582
|
+
}
|
|
583
|
+
function re(e) {
|
|
584
|
+
const t = Array.isArray(e == null ? void 0 : e.selectedEntities) ? e.selectedEntities.filter(k) : [];
|
|
585
|
+
return O(
|
|
586
|
+
t.flatMap((n) => {
|
|
587
|
+
const o = I(n, e);
|
|
588
|
+
return o ? [o] : [];
|
|
589
|
+
})
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function j(e, t) {
|
|
593
|
+
const n = t.filter(
|
|
594
|
+
(o) => A(o, e)
|
|
595
|
+
);
|
|
596
|
+
return n.length === 1 ? n[0] : void 0;
|
|
597
|
+
}
|
|
598
|
+
function Oe(e, t) {
|
|
599
|
+
if (t.kind === "semantic")
|
|
600
|
+
return !!(e.entityId && e.entityId === t.datasetId || e.entityName && e.entityName === t.datasetName);
|
|
601
|
+
const n = [
|
|
602
|
+
t.databaseName,
|
|
603
|
+
t.schemaName,
|
|
604
|
+
t.tableName
|
|
605
|
+
].filter((o) => !!o).join(".");
|
|
606
|
+
return !!(e.entityName === t.tableName || e.qualifiedEntityName && e.qualifiedEntityName === n);
|
|
607
|
+
}
|
|
608
|
+
function $e(e, t) {
|
|
609
|
+
const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(k) : [], o = e.entityName || e.qualifiedEntityName;
|
|
610
|
+
if (!o) return;
|
|
611
|
+
const i = e.entityId ? E(n, {
|
|
612
|
+
type: "dataset",
|
|
613
|
+
id: e.entityId,
|
|
614
|
+
name: o
|
|
615
|
+
}) : void 0;
|
|
616
|
+
if (i)
|
|
617
|
+
return I(i, t);
|
|
618
|
+
const a = E(n, {
|
|
619
|
+
type: (t == null ? void 0 : t.mode) === "semanticDomain" ? "dataset" : "table",
|
|
620
|
+
name: (t == null ? void 0 : t.mode) === "semanticDomain" ? o : e.qualifiedEntityName || o
|
|
621
|
+
});
|
|
622
|
+
if (a && !((t == null ? void 0 : t.mode) === "semanticDomain" && e.entityId && ![
|
|
623
|
+
e.entityName,
|
|
624
|
+
e.qualifiedEntityName,
|
|
625
|
+
a.name,
|
|
626
|
+
a.type === "dataset" && "table" in a ? a.table : void 0
|
|
627
|
+
].filter((r) => !!r).includes(e.entityId)))
|
|
628
|
+
return I(a, t);
|
|
629
|
+
}
|
|
630
|
+
function Pe(e, t, n) {
|
|
631
|
+
var a, s, r;
|
|
632
|
+
const o = !!(ue(e) || (s = (a = e.calculatedFormula) == null ? void 0 : a.inputFields) != null && s.length || (r = e.derivedField) != null && r.inputs && Object.keys(e.derivedField.inputs).length > 0);
|
|
633
|
+
if (e.source && !o) {
|
|
634
|
+
const m = j(
|
|
635
|
+
e.source,
|
|
636
|
+
n
|
|
637
|
+
);
|
|
638
|
+
return m ? [m] : [];
|
|
639
|
+
}
|
|
640
|
+
const i = ye(e).datasets;
|
|
641
|
+
return O(
|
|
642
|
+
i.flatMap((m) => {
|
|
643
|
+
const l = e.source && Oe(m, e.source) && j(e.source, n) || $e(m, t);
|
|
644
|
+
return l ? [l] : [];
|
|
645
|
+
})
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
function Fe(e, t) {
|
|
649
|
+
const n = re(t), o = we(e), i = S(e.filters), a = [
|
|
650
|
+
...i,
|
|
651
|
+
...[...o, ...i].flatMap(se)
|
|
652
|
+
];
|
|
653
|
+
return O(
|
|
654
|
+
[...o, ...a].flatMap(
|
|
655
|
+
(s) => Pe(s, t, n)
|
|
656
|
+
)
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
function Be(e, t, n) {
|
|
660
|
+
var i;
|
|
661
|
+
return H(e) ? !!!((i = t == null ? void 0 : t.selectedEntities) != null && i.length) || !n ? e : j(e, re(t)) : void 0;
|
|
662
|
+
}
|
|
663
|
+
function I(e, t) {
|
|
664
|
+
var p, l;
|
|
665
|
+
const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(k) : void 0, o = E(n, e), i = o ? { ...e, ...o } : e, a = "domainId" in i && typeof i.domainId == "string" && !!i.domainId.trim();
|
|
666
|
+
if ((t == null ? void 0 : t.mode) === "semanticDomain" && !a)
|
|
667
|
+
return;
|
|
668
|
+
if ((t == null ? void 0 : t.mode) !== "database" && i.type === "dataset") {
|
|
669
|
+
const c = ge(
|
|
670
|
+
{
|
|
671
|
+
entities: [i],
|
|
672
|
+
semanticDomainId: t == null ? void 0 : t.semanticDomainId,
|
|
673
|
+
connectionId: t == null ? void 0 : t.connectionId,
|
|
674
|
+
fieldEntityType: "dataset"
|
|
675
|
+
},
|
|
676
|
+
{ includePhysicalDatasets: !0 }
|
|
677
|
+
);
|
|
678
|
+
if (c.kind === "resolved") {
|
|
679
|
+
const b = "label" in i && typeof i.label == "string" ? i.label : void 0;
|
|
680
|
+
return {
|
|
681
|
+
...c.source,
|
|
682
|
+
...b ? { label: b } : {}
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if ((t == null ? void 0 : t.mode) === "semanticDomain")
|
|
687
|
+
return;
|
|
688
|
+
const s = i.connectionId || (t == null ? void 0 : t.connectionId), r = i.type === "dataset" && "table" in i && i.table ? i.table : i.name;
|
|
689
|
+
if (!s || !r)
|
|
690
|
+
return;
|
|
691
|
+
const m = {
|
|
692
|
+
kind: "physical",
|
|
693
|
+
connectionId: s,
|
|
694
|
+
connectionType: i.connectionType || (t == null ? void 0 : t.connectionType),
|
|
695
|
+
tableName: r,
|
|
696
|
+
databaseName: i.database || ((p = t == null ? void 0 : t.dbSelection) == null ? void 0 : p.database),
|
|
697
|
+
schemaName: i.schema || ((l = t == null ? void 0 : t.dbSelection) == null ? void 0 : l.schema),
|
|
698
|
+
dialect: i.dialect
|
|
699
|
+
};
|
|
700
|
+
return H(m) ? m : void 0;
|
|
701
|
+
}
|
|
702
|
+
function Le(e, t) {
|
|
703
|
+
var r, m;
|
|
704
|
+
const n = I(e, t);
|
|
705
|
+
if (!n) return;
|
|
706
|
+
const o = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, i = n.kind === "physical" ? n.tableName : o, a = e.connectionId || (t == null ? void 0 : t.connectionId), s = i && a ? {
|
|
707
|
+
connectionId: a,
|
|
708
|
+
databaseName: e.database || ((r = t == null ? void 0 : t.dbSelection) == null ? void 0 : r.database),
|
|
709
|
+
schemaName: e.schema || ((m = t == null ? void 0 : t.dbSelection) == null ? void 0 : m.schema),
|
|
710
|
+
tableName: i
|
|
711
|
+
} : void 0;
|
|
712
|
+
return { source: n, ...s ? { executionTable: s } : {} };
|
|
713
|
+
}
|
|
714
|
+
function xe(e) {
|
|
715
|
+
const t = M(e.dataSource) ? e.dataSource : void 0;
|
|
716
|
+
if (typeof e.sql == "string" && e.sql.trim()) {
|
|
717
|
+
const r = [], m = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
|
|
718
|
+
for (const p of m) {
|
|
719
|
+
if (!k(p)) continue;
|
|
720
|
+
const l = Le(p, t);
|
|
721
|
+
l && !r.some(
|
|
722
|
+
(c) => A(
|
|
723
|
+
c.source,
|
|
724
|
+
l.source
|
|
725
|
+
)
|
|
726
|
+
) && r.push(l);
|
|
727
|
+
}
|
|
728
|
+
return {
|
|
729
|
+
cardId: e.id,
|
|
730
|
+
kind: "sql",
|
|
731
|
+
pinnedCatalogSources: r
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
if (!M(e.config))
|
|
735
|
+
return { cardId: e.id, kind: "unconfigured" };
|
|
736
|
+
const n = e.config, o = [], i = Ce(e);
|
|
737
|
+
if (i.status === "invalid")
|
|
738
|
+
return { cardId: e.id, kind: "unconfigured" };
|
|
739
|
+
const a = i.status === "ready" ? i.config : void 0;
|
|
740
|
+
if (e.type === "matrixTable" && !a)
|
|
741
|
+
return { cardId: e.id, kind: "unconfigured" };
|
|
742
|
+
a && o.push(
|
|
743
|
+
...ve(a.spec).filter(H)
|
|
744
|
+
);
|
|
745
|
+
const s = (a == null ? void 0 : a.spec.joinPlan) ?? (M(n.joinPlan) ? n.joinPlan : void 0);
|
|
746
|
+
if (s) {
|
|
747
|
+
const r = Array.isArray(s.joins) ? s.joins : [], m = [s.baseEntity];
|
|
748
|
+
for (const l of r)
|
|
749
|
+
M(l) && m.push(l.source, l.target);
|
|
750
|
+
let p = !1;
|
|
751
|
+
for (const l of m) {
|
|
752
|
+
if (!k(l)) {
|
|
753
|
+
p = !0;
|
|
754
|
+
continue;
|
|
755
|
+
}
|
|
756
|
+
const c = I(l, t);
|
|
757
|
+
c ? o.push(c) : p = !0;
|
|
758
|
+
}
|
|
759
|
+
p && (o.length = 0);
|
|
760
|
+
} else if (e.type !== "matrixTable") {
|
|
761
|
+
const r = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
|
|
762
|
+
if (r.length === 1 && k(r[0])) {
|
|
763
|
+
const p = I(
|
|
764
|
+
r[0],
|
|
765
|
+
t
|
|
766
|
+
);
|
|
767
|
+
p && o.push(p);
|
|
768
|
+
}
|
|
769
|
+
o.push(...Fe(n, t));
|
|
770
|
+
const m = Be(
|
|
771
|
+
n.queryBaseSource,
|
|
772
|
+
t,
|
|
773
|
+
o.length > 0
|
|
774
|
+
);
|
|
775
|
+
m && o.push(m);
|
|
776
|
+
}
|
|
777
|
+
return {
|
|
778
|
+
cardId: e.id,
|
|
779
|
+
kind: "config",
|
|
780
|
+
executableSources: O(o)
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function pt(e, t) {
|
|
784
|
+
return (e.kind === "config" ? e.executableSources : e.kind === "sql" ? e.pinnedCatalogSources.map((o) => o.source) : []).some(
|
|
785
|
+
(o) => A(o, t)
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
function Ve(e, t) {
|
|
789
|
+
if (e.kind === "config")
|
|
790
|
+
return e.executableSources.find(
|
|
791
|
+
(n) => A(n, t)
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
function mt(e, t) {
|
|
795
|
+
var n;
|
|
796
|
+
return (n = Re(e, t)) == null ? void 0 : n.source;
|
|
797
|
+
}
|
|
798
|
+
function Re(e, t) {
|
|
799
|
+
if (e.kind === "sql")
|
|
800
|
+
return e.pinnedCatalogSources.find(
|
|
801
|
+
(n) => A(n.source, t)
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
const ae = {
|
|
805
|
+
rowMembers: !0,
|
|
806
|
+
columnMembers: !0,
|
|
807
|
+
cells: !0
|
|
808
|
+
};
|
|
809
|
+
function je(e, t) {
|
|
810
|
+
return {
|
|
811
|
+
enabled: t === "on",
|
|
812
|
+
fields: e.type === "detailTable" ? { kind: "clickedCell" } : { kind: "wholeRow" },
|
|
813
|
+
multipleSelection: !0,
|
|
814
|
+
selectionCheckboxes: "auto",
|
|
815
|
+
...e.type === "matrixTable" ? { matrixSources: { ...ae } } : {},
|
|
816
|
+
targets: { kind: "allSheets" },
|
|
817
|
+
cardMappings: []
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
const He = ["string", "number", "boolean", "date", "datetime"];
|
|
821
|
+
function Se(e) {
|
|
822
|
+
return (e.kind === "semantic" ? [e.datasetId, e.datasetName] : [
|
|
823
|
+
e.tableName,
|
|
824
|
+
[e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".")
|
|
825
|
+
]).filter((t) => !!t).map((t) => ee(t));
|
|
826
|
+
}
|
|
827
|
+
function qe(e, t) {
|
|
828
|
+
if (t.kind !== "config" || e.expression || e.calculatedFormula) return;
|
|
829
|
+
const n = Z(e.dataType);
|
|
830
|
+
if (!He.includes(n)) return;
|
|
831
|
+
let o;
|
|
832
|
+
if (e.source)
|
|
833
|
+
o = Ve(t, e.source);
|
|
834
|
+
else {
|
|
835
|
+
const i = [e.entityId, e.entityName, e.qualifiedEntityName].filter((s) => !!s).map((s) => ee(s)), a = t.executableSources.filter(
|
|
836
|
+
(s) => Se(s).some((r) => i.includes(r))
|
|
837
|
+
);
|
|
838
|
+
a.length === 1 ? o = a[0] : !a.length && t.executableSources.length === 1 && (o = t.executableSources[0]);
|
|
839
|
+
}
|
|
840
|
+
if (!(!o || !e.name))
|
|
841
|
+
return {
|
|
842
|
+
name: e.name,
|
|
843
|
+
source: o,
|
|
844
|
+
dataType: n,
|
|
845
|
+
...e.sourceField && e.sourceField !== e.name ? { sourceField: e.sourceField } : {}
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function Je(e, t) {
|
|
849
|
+
const { matrixSources: n, ...o } = t, i = t.fields.kind === "chosenColumns" ? {
|
|
850
|
+
kind: "chosenColumns",
|
|
851
|
+
clickedFieldKeys: [...new Set(t.fields.clickedFieldKeys)]
|
|
852
|
+
} : t.fields;
|
|
853
|
+
return {
|
|
854
|
+
...o,
|
|
855
|
+
fields: i,
|
|
856
|
+
...e.type === "matrixTable" ? { matrixSources: n ?? { ...ae } } : {}
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
function ut(e, t) {
|
|
860
|
+
var c, b;
|
|
861
|
+
if (e.clickToFilter)
|
|
862
|
+
return Je(e, e.clickToFilter);
|
|
863
|
+
const n = je(e, t), o = (((c = e.interactionConfig) == null ? void 0 : c.interactions) ?? []).filter(
|
|
864
|
+
(f) => f.mode === "clickFilter"
|
|
865
|
+
);
|
|
866
|
+
if (!o.length) return n;
|
|
867
|
+
const i = xe(e);
|
|
868
|
+
let a = !1;
|
|
869
|
+
const s = [];
|
|
870
|
+
for (const f of o) {
|
|
871
|
+
if (((b = f.trigger) == null ? void 0 : b.type) !== "attribute") {
|
|
872
|
+
a = !0;
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
const y = qe(
|
|
876
|
+
f.trigger.field,
|
|
877
|
+
i
|
|
878
|
+
);
|
|
879
|
+
if (!y) {
|
|
880
|
+
a = !0;
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
const C = de(y);
|
|
884
|
+
s.includes(C) || s.push(C);
|
|
885
|
+
}
|
|
886
|
+
const r = o.every(
|
|
887
|
+
(f) => f.applyToCardIds !== void 0
|
|
888
|
+
), m = [
|
|
889
|
+
...new Set(o.flatMap((f) => f.applyToCardIds ?? []))
|
|
890
|
+
], p = o.filter(
|
|
891
|
+
(f) => f.applyToCardIds === void 0
|
|
892
|
+
), l = r ? [] : [
|
|
893
|
+
...new Set(p.flatMap((f) => f.excludeCardIds ?? []))
|
|
894
|
+
].filter(
|
|
895
|
+
(f) => p.every((y) => {
|
|
896
|
+
var C;
|
|
897
|
+
return (C = y.excludeCardIds) == null ? void 0 : C.includes(f);
|
|
898
|
+
})
|
|
899
|
+
);
|
|
900
|
+
return {
|
|
901
|
+
...n,
|
|
902
|
+
enabled: !0,
|
|
903
|
+
fields: a || !s.length ? { kind: "wholeRow" } : { kind: "chosenColumns", clickedFieldKeys: s },
|
|
904
|
+
targets: r ? { kind: "cards", cardIds: m } : { kind: "allSheets" },
|
|
905
|
+
cardMappings: l.map((f) => ({
|
|
906
|
+
kind: "excluded",
|
|
907
|
+
cardId: f
|
|
908
|
+
}))
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
const ce = u.union([
|
|
912
|
+
u.object({
|
|
913
|
+
kind: u.literal("allSheets"),
|
|
914
|
+
sheetKinds: u.array(u.enum(["dashboard", "document"])).optional()
|
|
915
|
+
}).strict(),
|
|
916
|
+
u.object({ kind: u.literal("sheets"), sheetIds: u.array(u.string()) }).strict(),
|
|
917
|
+
u.object({ kind: u.literal("cards"), cardIds: u.array(u.string()) }).strict(),
|
|
918
|
+
u.object({
|
|
919
|
+
kind: u.literal("documentSections"),
|
|
920
|
+
sheetId: u.string(),
|
|
921
|
+
sectionIds: u.array(u.string())
|
|
922
|
+
}).strict()
|
|
923
|
+
]), le = u.union([
|
|
924
|
+
u.object({
|
|
925
|
+
kind: u.literal("bound"),
|
|
926
|
+
cardId: u.string().min(1),
|
|
927
|
+
clickedFieldKey: u.string().min(1),
|
|
928
|
+
target: u.object({ kind: u.literal("field"), field: fe }).strict()
|
|
929
|
+
}).strict(),
|
|
930
|
+
u.object({ kind: u.literal("excluded"), cardId: u.string().min(1) }).strict()
|
|
931
|
+
]), ft = u.object({
|
|
932
|
+
enabled: u.boolean(),
|
|
933
|
+
fields: u.union([
|
|
934
|
+
u.object({ kind: u.literal("wholeRow") }).strict(),
|
|
935
|
+
u.object({ kind: u.literal("clickedCell") }).strict(),
|
|
936
|
+
u.object({
|
|
937
|
+
kind: u.literal("chosenColumns"),
|
|
938
|
+
clickedFieldKeys: u.array(u.string().min(1))
|
|
939
|
+
}).strict()
|
|
940
|
+
]),
|
|
941
|
+
multipleSelection: u.boolean(),
|
|
942
|
+
selectionCheckboxes: u.enum(["auto", "always", "never"]),
|
|
943
|
+
matrixSources: u.object({
|
|
944
|
+
rowMembers: u.boolean(),
|
|
945
|
+
columnMembers: u.boolean(),
|
|
946
|
+
cells: u.boolean()
|
|
947
|
+
}).strict().optional(),
|
|
948
|
+
targets: ce,
|
|
949
|
+
cardMappings: u.array(le)
|
|
950
|
+
}).strict(), dt = u.boolean(), ht = u.object({
|
|
951
|
+
targets: ce.nullable().optional(),
|
|
952
|
+
cardMappings: u.array(le).nullable().optional()
|
|
953
|
+
}).strict(), Ue = [
|
|
954
|
+
"bar",
|
|
955
|
+
"horizontalBar",
|
|
956
|
+
"line",
|
|
957
|
+
"area",
|
|
958
|
+
"stackedArea",
|
|
959
|
+
"combo",
|
|
960
|
+
"stackedBar",
|
|
961
|
+
"stackedLine"
|
|
962
|
+
], Ge = new Set(
|
|
963
|
+
Ue
|
|
964
|
+
);
|
|
965
|
+
function ze(e) {
|
|
966
|
+
return typeof e == "string" && Ge.has(e);
|
|
967
|
+
}
|
|
968
|
+
function bt(e) {
|
|
969
|
+
return e === "detailTable" || e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || ze(e);
|
|
970
|
+
}
|
|
971
|
+
function X(e) {
|
|
972
|
+
return !!(e != null && e.trim());
|
|
973
|
+
}
|
|
974
|
+
function gt(e) {
|
|
975
|
+
return X(e.sql) || X(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
|
|
976
|
+
}
|
|
977
|
+
const P = {
|
|
978
|
+
type: "temporal_bucket",
|
|
979
|
+
presentation: { mode: "auto" }
|
|
980
|
+
}, v = {
|
|
981
|
+
value: "auto",
|
|
982
|
+
label: "Automatic",
|
|
983
|
+
format: P
|
|
984
|
+
};
|
|
985
|
+
function g(e, t) {
|
|
986
|
+
return {
|
|
987
|
+
value: `pattern:${e}`,
|
|
988
|
+
label: t,
|
|
989
|
+
format: {
|
|
990
|
+
type: "temporal_bucket",
|
|
991
|
+
presentation: { mode: "pattern", pattern: e }
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function T(e, t) {
|
|
996
|
+
return {
|
|
997
|
+
value: `preset:${e}`,
|
|
998
|
+
label: t,
|
|
999
|
+
format: {
|
|
1000
|
+
type: "temporal_bucket",
|
|
1001
|
+
presentation: { mode: "preset", preset: e }
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function Y(e) {
|
|
1006
|
+
return {
|
|
1007
|
+
...g(e, "Custom format…"),
|
|
1008
|
+
value: "custom",
|
|
1009
|
+
custom: !0
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
const q = {
|
|
1013
|
+
second: [
|
|
1014
|
+
v,
|
|
1015
|
+
g("HH:mm:ss", "14:30:45 (HH:mm:ss)"),
|
|
1016
|
+
g(
|
|
1017
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
1018
|
+
"2024-01-15 14:30:45 (YYYY-MM-DD HH:mm:ss)"
|
|
1019
|
+
),
|
|
1020
|
+
Y("DD/MM/YYYY HH:mm:ss")
|
|
1021
|
+
],
|
|
1022
|
+
minute: [
|
|
1023
|
+
v,
|
|
1024
|
+
g("HH:mm", "14:30 (HH:mm)"),
|
|
1025
|
+
g("YYYY-MM-DD HH:mm", "2024-01-15 14:30 (YYYY-MM-DD HH:mm)"),
|
|
1026
|
+
Y("DD/MM/YYYY HH:mm")
|
|
1027
|
+
],
|
|
1028
|
+
hour: [
|
|
1029
|
+
v,
|
|
1030
|
+
g("HH", "14 (HH)"),
|
|
1031
|
+
g("YYYY-MM-DD HH", "2024-01-15 14 (YYYY-MM-DD HH)"),
|
|
1032
|
+
Y("DD/MM/YYYY HH")
|
|
1033
|
+
],
|
|
1034
|
+
day: [
|
|
1035
|
+
v,
|
|
1036
|
+
g("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
|
|
1037
|
+
g("MM/DD/YYYY", "01/15/2024 (MM/DD/YYYY)"),
|
|
1038
|
+
g("DD/MM/YYYY", "15/01/2024 (DD/MM/YYYY)"),
|
|
1039
|
+
g("MMM DD, YYYY", "Jan 15, 2024 (MMM DD, YYYY)"),
|
|
1040
|
+
g("MMMM DD, YYYY", "January 15, 2024 (MMMM DD, YYYY)"),
|
|
1041
|
+
Y("YYYY/MM/DD")
|
|
1042
|
+
],
|
|
1043
|
+
week: [
|
|
1044
|
+
v,
|
|
1045
|
+
T("week_of_short", "Week of Jan 15, 2024"),
|
|
1046
|
+
T("week_of_long", "Week of January 15, 2024"),
|
|
1047
|
+
g("YYYY-MM-DD", "2024-01-15 (YYYY-MM-DD)"),
|
|
1048
|
+
Y("YYYY/MM/DD")
|
|
1049
|
+
],
|
|
1050
|
+
month: [
|
|
1051
|
+
v,
|
|
1052
|
+
g("MMM YYYY", "Jan 2024 (MMM YYYY)"),
|
|
1053
|
+
g("MMMM YYYY", "January 2024 (MMMM YYYY)"),
|
|
1054
|
+
g("YYYY-MM", "2024-01 (YYYY-MM)"),
|
|
1055
|
+
g("MM/YYYY", "01/2024 (MM/YYYY)"),
|
|
1056
|
+
g("YYYY MMM", "2024 Jan (YYYY MMM)"),
|
|
1057
|
+
Y("YYYY/MM")
|
|
1058
|
+
],
|
|
1059
|
+
quarter: [
|
|
1060
|
+
v,
|
|
1061
|
+
T("quarter_short", "Q1 2024"),
|
|
1062
|
+
T("quarter_long", "1st Quarter 2024")
|
|
1063
|
+
],
|
|
1064
|
+
year: [
|
|
1065
|
+
v,
|
|
1066
|
+
g("YYYY", "2024 (YYYY)"),
|
|
1067
|
+
g("YY", "24 (YY)")
|
|
1068
|
+
]
|
|
1069
|
+
}, Ke = {
|
|
1070
|
+
second: "2026-07-31T14:05:09",
|
|
1071
|
+
minute: "2026-07-31T14:05:00",
|
|
1072
|
+
hour: "2026-07-31T14:00:00",
|
|
1073
|
+
day: "2026-07-31",
|
|
1074
|
+
week: "2026-07-27",
|
|
1075
|
+
month: "2026-07-01",
|
|
1076
|
+
quarter: "2026-07-01",
|
|
1077
|
+
year: "2026-01-01"
|
|
1078
|
+
};
|
|
1079
|
+
function Qe(e, t, n = te) {
|
|
1080
|
+
return Ye({
|
|
1081
|
+
value: Ke[t],
|
|
1082
|
+
metadata: {
|
|
1083
|
+
kind: "temporal_bucket",
|
|
1084
|
+
granularity: t,
|
|
1085
|
+
calendar: {
|
|
1086
|
+
tz: "UTC",
|
|
1087
|
+
weekStart: 1,
|
|
1088
|
+
...e.presentation.mode === "preset" && (e.presentation.preset === "fiscal_quarter_short" || e.presentation.preset === "fiscal_year") ? {
|
|
1089
|
+
fiscalCalendar: {
|
|
1090
|
+
kind: "month_aligned",
|
|
1091
|
+
yearStartMonth: 7
|
|
1092
|
+
}
|
|
1093
|
+
} : {}
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
format: e.presentation.mode === "auto" ? {
|
|
1097
|
+
type: "temporal_bucket",
|
|
1098
|
+
locale: n.locale,
|
|
1099
|
+
presentation: {
|
|
1100
|
+
mode: "auto",
|
|
1101
|
+
styles: {
|
|
1102
|
+
dateStyle: n.dateStyle,
|
|
1103
|
+
dateTime: { ...n.dateTime }
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
} : {
|
|
1107
|
+
type: "temporal_bucket",
|
|
1108
|
+
locale: n.locale,
|
|
1109
|
+
presentation: e.presentation
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
function yt(e, t, n = te) {
|
|
1114
|
+
const o = q[e], i = (t == null ? void 0 : t.presentation.mode) === "preset" ? t.presentation.preset : void 0, a = i && t && $(t, e).ok && !o.some(
|
|
1115
|
+
(r) => {
|
|
1116
|
+
var m;
|
|
1117
|
+
return ((m = r.format) == null ? void 0 : m.presentation.mode) === "preset" && r.format.presentation.preset === i;
|
|
1118
|
+
}
|
|
1119
|
+
) ? T(i, i) : void 0;
|
|
1120
|
+
return (a ? [...o, a] : o).map((r) => {
|
|
1121
|
+
if (!r.format || r.custom) return r;
|
|
1122
|
+
const m = Qe(
|
|
1123
|
+
r.format,
|
|
1124
|
+
e,
|
|
1125
|
+
n
|
|
1126
|
+
);
|
|
1127
|
+
return r.format.presentation.mode === "pattern" ? {
|
|
1128
|
+
...r,
|
|
1129
|
+
label: `${m} (${r.format.presentation.pattern})`
|
|
1130
|
+
} : r.format.presentation.mode === "auto" ? { ...r, label: `Automatic (${m})` } : { ...r, label: m };
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
function Ct(e, t) {
|
|
1134
|
+
const n = q[t];
|
|
1135
|
+
if (e.presentation.mode === "pattern") {
|
|
1136
|
+
const o = e.presentation.pattern, i = n.find(
|
|
1137
|
+
(a) => {
|
|
1138
|
+
var s;
|
|
1139
|
+
return ((s = a.format) == null ? void 0 : s.presentation.mode) === "pattern" && a.format.presentation.pattern === o;
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1142
|
+
return {
|
|
1143
|
+
value: (i == null ? void 0 : i.value) ?? "custom",
|
|
1144
|
+
customPattern: i != null && i.custom || !i ? o : "",
|
|
1145
|
+
format: e
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
if (e.presentation.mode === "preset") {
|
|
1149
|
+
const o = e.presentation.preset, i = n.find(
|
|
1150
|
+
(s) => {
|
|
1151
|
+
var r;
|
|
1152
|
+
return ((r = s.format) == null ? void 0 : r.presentation.mode) === "preset" && s.format.presentation.preset === o;
|
|
1153
|
+
}
|
|
1154
|
+
), a = $(
|
|
1155
|
+
e,
|
|
1156
|
+
t
|
|
1157
|
+
).ok;
|
|
1158
|
+
return i ? { value: i.value, customPattern: "", format: e } : a ? {
|
|
1159
|
+
value: `preset:${o}`,
|
|
1160
|
+
customPattern: "",
|
|
1161
|
+
format: e
|
|
1162
|
+
} : { value: "auto", customPattern: "", format: P };
|
|
1163
|
+
}
|
|
1164
|
+
return { value: "auto", customPattern: "", format: e };
|
|
1165
|
+
}
|
|
1166
|
+
function vt(e, t, n = "") {
|
|
1167
|
+
var s;
|
|
1168
|
+
const o = q[e].find(
|
|
1169
|
+
(r) => r.value === t
|
|
1170
|
+
), i = t.startsWith("preset:") ? t.slice(7) : void 0, a = t === "custom" ? {
|
|
1171
|
+
type: "temporal_bucket",
|
|
1172
|
+
presentation: {
|
|
1173
|
+
mode: "pattern",
|
|
1174
|
+
pattern: n.trim() || (((s = o == null ? void 0 : o.format) == null ? void 0 : s.presentation.mode) === "pattern" ? o.format.presentation.pattern : "")
|
|
1175
|
+
}
|
|
1176
|
+
} : (o == null ? void 0 : o.format) ?? (i && _e(i) ? {
|
|
1177
|
+
type: "temporal_bucket",
|
|
1178
|
+
presentation: {
|
|
1179
|
+
mode: "preset",
|
|
1180
|
+
preset: i
|
|
1181
|
+
}
|
|
1182
|
+
} : void 0);
|
|
1183
|
+
return !a || !$(a, e).ok ? P : a;
|
|
1184
|
+
}
|
|
1185
|
+
function _t(e, t) {
|
|
1186
|
+
return $(e, t).ok ? e : P;
|
|
1187
|
+
}
|
|
1188
|
+
const pe = [
|
|
1189
|
+
{ value: "COUNT", label: "Count" },
|
|
1190
|
+
{ value: "DISTINCT", label: "Count Distinct" }
|
|
1191
|
+
], We = [
|
|
1192
|
+
...pe,
|
|
1193
|
+
{ value: "SUM", label: "Sum" },
|
|
1194
|
+
{ value: "AVG", label: "Average" },
|
|
1195
|
+
{ value: "MIN", label: "Min" },
|
|
1196
|
+
{ value: "MAX", label: "Max" },
|
|
1197
|
+
{ value: "MEDIAN", label: "Median" }
|
|
1198
|
+
];
|
|
1199
|
+
function Yt(e) {
|
|
1200
|
+
return Z(e) === "number" ? We : pe;
|
|
1201
|
+
}
|
|
1202
|
+
export {
|
|
1203
|
+
P as A,
|
|
1204
|
+
Ue as S,
|
|
1205
|
+
gt as a,
|
|
1206
|
+
Ct as b,
|
|
1207
|
+
ft as c,
|
|
1208
|
+
vt as d,
|
|
1209
|
+
_t as e,
|
|
1210
|
+
I as f,
|
|
1211
|
+
yt as g,
|
|
1212
|
+
xe as h,
|
|
1213
|
+
ze as i,
|
|
1214
|
+
pt as j,
|
|
1215
|
+
Ve as k,
|
|
1216
|
+
mt as l,
|
|
1217
|
+
Re as m,
|
|
1218
|
+
je as n,
|
|
1219
|
+
qe as o,
|
|
1220
|
+
Qe as p,
|
|
1221
|
+
ut as q,
|
|
1222
|
+
dt as r,
|
|
1223
|
+
bt as s,
|
|
1224
|
+
at as t,
|
|
1225
|
+
ht as u,
|
|
1226
|
+
Yt as v,
|
|
1227
|
+
ct as w,
|
|
1228
|
+
lt as x
|
|
1229
|
+
};
|