react-semaphor 0.1.537 → 0.1.538
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/analytics-protocol/index.js +352 -341
- package/dist/assistant-context/index.js +10 -0
- package/dist/assistant-protocol/index.js +104 -0
- package/dist/brand-studio/index.js +35 -31
- package/dist/briefings/index.js +46 -45
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
- package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
- package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
- package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
- package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
- package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
- package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
- package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
- package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
- package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
- package/dist/chunks/context-HD9usB1P.js +349 -0
- package/dist/chunks/conversation-sQiWYUOb.js +16 -0
- package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
- package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
- package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-FpONU8QV.js} +683 -686
- package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
- package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
- package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
- package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
- package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
- package/dist/chunks/index-CqMiAkay.js +3164 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
- package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
- package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
- package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
- package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
- package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
- package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
- package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
- package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
- package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
- package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
- package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
- package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
- package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
- package/dist/chunks/save-CfJpQQ68.js +21 -0
- package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
- package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
- package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-CHHoWhil.js} +65586 -62749
- package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
- package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
- package/dist/chunks/switch-CvItuC1Q.js +8199 -0
- package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
- package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
- package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
- package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
- package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
- package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
- package/dist/chunks/x-4f5U2XwU.js +100 -0
- package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +823 -661
- package/dist/data-app-sdk/index.js +32 -30
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +23 -22
- package/dist/format-utils/index.js +173 -168
- package/dist/index.js +267 -258
- package/dist/layouts/index.js +236 -24
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/assistant-context.d.ts +2 -0
- package/dist/types/assistant-protocol.d.ts +2 -0
- package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
- package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
- package/dist/types/components/assistant/assistant-store.d.ts +52 -0
- package/dist/types/components/assistant/use-assistant.d.ts +38 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/surfboard/filter/types.d.ts +5 -2
- package/dist/types/index.js +50 -51
- package/dist/types/lib/api/invalidate-token.d.ts +7 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
- package/dist/types/lib/charts/types.d.ts +7 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
- package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
- package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
- package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
- package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
- package/dist/types/lib/print/print-inputs.d.ts +4 -2
- package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
- package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
- package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
- package/dist/types/lib/stores/editor-store.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +11 -0
- package/dist/types/lib/utils/card-type-change.d.ts +30 -0
- package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
- package/dist/types/shared/assistant-context/index.d.ts +9 -0
- package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
- package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
- package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
- package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
- package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
- package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
- package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
- package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
- package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
- package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
- package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
- package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
- package/dist/types/shared/format-utils/index.d.ts +3 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
- package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
- package/dist/types/shared/layouts/index.d.ts +1 -0
- package/package.json +12 -2
- package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
- package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
- package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
- package/dist/chunks/constants-DNWVy8Y3.js +0 -9
- package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
- package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
- package/dist/chunks/index-DTcTAGGM.js +0 -4101
- package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
- package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
- package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
- package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
- package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
- package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
- package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
- package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
- package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
- package/dist/chunks/save-kO6cIaob.js +0 -34
- package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
- package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
- package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
- package/dist/chunks/x-CXDkqdur.js +0 -149
- package/dist/types/lib/class-utils.d.ts +0 -2
- package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
- package/dist/types/lib/utils.d.ts +0 -51
|
@@ -1,1229 +0,0 @@
|
|
|
1
|
-
import { N as me, G as D, u as O, l as ue, B as Z, F as ee } from "./validators-DMSH81OM.js";
|
|
2
|
-
import { D as fe, t as de } from "./matrix-operation-contract-BKupLHXL.js";
|
|
3
|
-
import { f as he, C as be } from "./metric-comparison-BKHyvnAy.js";
|
|
4
|
-
import { z as u } from "zod";
|
|
5
|
-
import { o as ge } from "./source-entity-resolution-C-oNyYMp.js";
|
|
6
|
-
import { r as ye } from "./field-dependencies-CpRUwr9J.js";
|
|
7
|
-
import { i as Ce, a as ve } from "./matrix-card-CAdizkUl.js";
|
|
8
|
-
import { v as $, i as Ye, f as _e } from "./temporal-bucket-DlFuhCnT.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, Y = C && h(C.windowTransform) ? C.windowTransform : void 0;
|
|
291
|
-
N.has(y) && (Y == null ? void 0 : Y.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, Y = [];
|
|
394
|
-
s.metrics.forEach(({ metric: A }) => {
|
|
395
|
-
"comparisonPolarity" in A || (A.comparisonPolarity = r, typeof A.id == "string" && Y.push(A.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: Y,
|
|
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 De(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
|
-
...De({
|
|
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 Ae(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) => !Ae(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) => D(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) => D(
|
|
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) => D(o, t)
|
|
786
|
-
);
|
|
787
|
-
}
|
|
788
|
-
function Ve(e, t) {
|
|
789
|
-
if (e.kind === "config")
|
|
790
|
-
return e.executableSources.find(
|
|
791
|
-
(n) => D(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) => D(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 _(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
|
-
_("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
|
-
_("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
|
-
_("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
|
-
_("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
|
-
_("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
|
-
_("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 _e({
|
|
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 && Ye(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 Yt(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 _t(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
|
-
Yt 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
|
-
_t as v,
|
|
1227
|
-
ct as w,
|
|
1228
|
-
lt as x
|
|
1229
|
-
};
|