react-semaphor 0.1.459 → 0.1.460

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.
Files changed (114) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +32 -32
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +4 -4
  7. package/dist/chunks/{analyze-result-contract-BbRJ-C06.js → analyze-result-contract-DROq4vgY.js} +1 -1
  8. package/dist/chunks/{analyze-result-contract-LPDNldic.cjs → analyze-result-contract-DSGoFuXQ.cjs} +1 -1
  9. package/dist/chunks/canonical-result-keys-CEQefvdO.js +33 -0
  10. package/dist/chunks/canonical-result-keys-Cb96edol.cjs +1 -0
  11. package/dist/chunks/{common-types-H51FLKB7.js → common-types-BHVKgxRR.js} +1 -1
  12. package/dist/chunks/{common-types-C57kJ59w.cjs → common-types-BcV9PD9D.cjs} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-ClCj98sq.js → dashboard-briefing-launcher-B07JnyCb.js} +60 -61
  14. package/dist/chunks/{dashboard-briefing-launcher-DHtEouuH.cjs → dashboard-briefing-launcher-BCkOKkCv.cjs} +2 -2
  15. package/dist/chunks/{dashboard-controls-VRShl9J0.cjs → dashboard-controls-BpxouYOZ.cjs} +1 -1
  16. package/dist/chunks/{dashboard-controls-B8gsKlxc.js → dashboard-controls-C8OxHQV6.js} +44 -45
  17. package/dist/chunks/dashboard-filter-value-compatibility-KXIyvbhc.js +677 -0
  18. package/dist/chunks/dashboard-filter-value-compatibility-UapptYnn.cjs +1 -0
  19. package/dist/chunks/dashboard-input-contract-BkRFQ7Tq.cjs +1 -0
  20. package/dist/chunks/{dashboard-date-comparison-definition-DC3ekV2S.js → dashboard-input-contract-D5dxTWJ5.js} +41 -25
  21. package/dist/chunks/dashboard-json-Bc-iIwxF.cjs +1 -0
  22. package/dist/chunks/{dashboard-json-i_Auue_K.js → dashboard-json-CecgbGtq.js} +13 -14
  23. package/dist/chunks/{edit-dashboard-visual-B3JF0fe4.js → edit-dashboard-visual-CpJKJaER.js} +880 -894
  24. package/dist/chunks/{edit-dashboard-visual-DWWyT55u.cjs → edit-dashboard-visual-xacUS2i5.cjs} +28 -28
  25. package/dist/chunks/{editor-action-buttons-BTlCsP63.cjs → editor-action-buttons-23Wf8EMx.cjs} +2 -2
  26. package/dist/chunks/{editor-action-buttons-C9x3nGnb.js → editor-action-buttons-DEoieV2G.js} +28 -28
  27. package/dist/chunks/index-B9c22LmC.cjs +1392 -0
  28. package/dist/chunks/{index-BS2-ZZGf.js → index-DDoyXYWM.js} +43665 -41560
  29. package/dist/chunks/{index-BIFLI8ul.js → index-De_7nrwb.js} +10 -10
  30. package/dist/chunks/index-DjjKJPDy.cjs +4 -0
  31. package/dist/chunks/{matrix-result-contract-CofATICL.js → matrix-result-contract-BTpPuHOc.js} +88 -104
  32. package/dist/chunks/matrix-result-contract-ZRNfeIbI.cjs +1 -0
  33. package/dist/chunks/{pivot-header-presentation-B9nXXKlW.cjs → pivot-header-presentation-BijPbP33.cjs} +1 -1
  34. package/dist/chunks/{pivot-header-presentation-D-0jvUwn.js → pivot-header-presentation-DW0gKG8g.js} +2 -2
  35. package/dist/chunks/{pivot-result-identity-Bb4EixVN.cjs → pivot-result-identity-DxHtiKVj.cjs} +1 -1
  36. package/dist/chunks/{pivot-result-identity-DU1v-5Xk.js → pivot-result-identity-Z9tN2tEV.js} +1 -1
  37. package/dist/chunks/{pivot-result-lifecycle-DTLRuDEW.cjs → pivot-result-lifecycle-BXzIlQVu.cjs} +1 -1
  38. package/dist/chunks/{pivot-result-lifecycle-CHWEGU2o.js → pivot-result-lifecycle-g2U-vzQb.js} +7 -7
  39. package/dist/chunks/{raw-temporal-contract-BtjH_G-d.cjs → raw-temporal-contract-DfAvqNMo.cjs} +1 -1
  40. package/dist/chunks/{raw-temporal-contract-CxncLze5.js → raw-temporal-contract-UtAqoOZO.js} +1 -1
  41. package/dist/chunks/{report-preferences-dialog-BDpkcUtz.js → report-preferences-dialog-CZiNX1Ri.js} +6 -6
  42. package/dist/chunks/{report-preferences-dialog-BK0yAJnQ.cjs → report-preferences-dialog-D_N6NXnq.cjs} +1 -1
  43. package/dist/chunks/{report-runtime-context-DqxS4wbi.cjs → report-runtime-context-C0NfLPfc.cjs} +1 -1
  44. package/dist/chunks/{report-runtime-context-SM6YO61_.js → report-runtime-context-CNncA3VD.js} +11 -11
  45. package/dist/chunks/{saved-temporal-bucket-format-CFfWXRl9.cjs → saved-temporal-bucket-format-3QKveR3v.cjs} +1 -1
  46. package/dist/chunks/{saved-temporal-bucket-format-SGAV0ivR.js → saved-temporal-bucket-format-Dd2eixTH.js} +11 -11
  47. package/dist/chunks/switch-DNFbgZz4.cjs +138 -0
  48. package/dist/chunks/{switch-DQR-Va05.js → switch-DSZobe8w.js} +6542 -5189
  49. package/dist/chunks/{temporal-bucket-5UYEotyQ.js → temporal-bucket-C85rmFmC.js} +4 -4
  50. package/dist/chunks/temporal-bucket-authoring-1fZuPAVb.js +653 -0
  51. package/dist/chunks/temporal-bucket-authoring-BK1UhYpD.cjs +1 -0
  52. package/dist/chunks/{temporal-bucket-contract-D5d-xEl3.js → temporal-bucket-contract-DXXNZssK.js} +1 -1
  53. package/dist/chunks/{temporal-bucket-contract-D2-93DGr.cjs → temporal-bucket-contract-xFkvboaw.cjs} +1 -1
  54. package/dist/chunks/{temporal-bucket-DHY1y9lq.cjs → temporal-bucket-pMfghsLX.cjs} +1 -1
  55. package/dist/chunks/{token-types-GbxRUozo.js → token-types-BLxc7UwR.js} +1 -1
  56. package/dist/chunks/{token-types-D7CaaI80.cjs → token-types-BYYO109W.cjs} +1 -1
  57. package/dist/chunks/{update-policy-hednMF-0.js → update-policy-CB8XJIoY.js} +1 -1
  58. package/dist/chunks/{update-policy-BmiOd0PB.cjs → update-policy-DMjjGjQY.cjs} +1 -1
  59. package/dist/chunks/{validators-DEmd8Sin.js → validators-DVd8s3qY.js} +416 -350
  60. package/dist/chunks/validators-dJlwubP4.cjs +1 -0
  61. package/dist/dashboard/index.cjs +1 -1
  62. package/dist/dashboard/index.js +2 -2
  63. package/dist/dashboard-authoring/index.cjs +3 -3
  64. package/dist/dashboard-authoring/index.js +328 -311
  65. package/dist/data-app-builder/index.cjs +1 -1
  66. package/dist/data-app-builder/index.js +2 -2
  67. package/dist/data-app-codegen/index.cjs +1 -1
  68. package/dist/data-app-codegen/index.js +2 -2
  69. package/dist/data-app-codegen-node/index.cjs +1 -1
  70. package/dist/data-app-codegen-node/index.js +3 -3
  71. package/dist/data-app-sdk/index.cjs +1 -1
  72. package/dist/data-app-sdk/index.js +55 -55
  73. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  74. package/dist/data-app-sdk-adapters/index.js +61 -56
  75. package/dist/data-app-sdk-validation/index.cjs +1 -1
  76. package/dist/data-app-sdk-validation/index.js +9 -9
  77. package/dist/format-utils/index.cjs +1 -1
  78. package/dist/format-utils/index.js +15 -15
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.js +154 -155
  81. package/dist/report-runtime-context/index.cjs +1 -1
  82. package/dist/report-runtime-context/index.js +2 -2
  83. package/dist/style.css +1 -1
  84. package/dist/surfboard/index.cjs +1 -1
  85. package/dist/surfboard/index.js +3 -3
  86. package/dist/types/analytics-protocol.d.ts +16 -8
  87. package/dist/types/briefings.d.ts +80 -9
  88. package/dist/types/dashboard-assistant.d.ts +11 -6
  89. package/dist/types/dashboard-authoring.d.ts +242 -15
  90. package/dist/types/dashboard.d.ts +94 -10
  91. package/dist/types/data-app-builder.d.ts +11 -6
  92. package/dist/types/data-app-codegen-node.d.ts +16 -8
  93. package/dist/types/data-app-codegen.d.ts +16 -8
  94. package/dist/types/data-app-sdk-adapters.d.ts +17 -11
  95. package/dist/types/data-app-sdk-validation.d.ts +17 -11
  96. package/dist/types/data-app-sdk.d.ts +17 -11
  97. package/dist/types/index.cjs +1 -1
  98. package/dist/types/index.js +4 -4
  99. package/dist/types/main.d.ts +210 -16
  100. package/dist/types/shared.d.ts +80 -9
  101. package/dist/types/surfboard.d.ts +94 -10
  102. package/dist/types/types.d.ts +94 -10
  103. package/package.json +1 -1
  104. package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +0 -1
  105. package/dist/chunks/canonical-result-keys-D6avdjpA.js +0 -467
  106. package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +0 -1
  107. package/dist/chunks/dashboard-json-BhvPMpZA.cjs +0 -1
  108. package/dist/chunks/index-DHF-2AqS.cjs +0 -1392
  109. package/dist/chunks/index-k8tEp0ys.cjs +0 -4
  110. package/dist/chunks/matrix-result-contract-zamd9euI.cjs +0 -1
  111. package/dist/chunks/switch-f3TuZNLr.cjs +0 -138
  112. package/dist/chunks/temporal-bucket-authoring-K1kE6R_z.js +0 -222
  113. package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +0 -1
  114. package/dist/chunks/validators-BDYprKI9.cjs +0 -1
@@ -1,467 +0,0 @@
1
- import "./validators-DEmd8Sin.js";
2
- import "./analyze-result-contract-BbRJ-C06.js";
3
- import { g as I, C as k } from "./temporal-bucket-5UYEotyQ.js";
4
- import "../value-format-preferences/index.js";
5
- const _ = /* @__PURE__ */ new Set([
6
- "previous_period",
7
- "same_period_last_year",
8
- "start_vs_end",
9
- "target"
10
- ]), V = /* @__PURE__ */ new Set([..._, "none", ""]);
11
- function l(e) {
12
- return !!e && typeof e == "object" && !Array.isArray(e);
13
- }
14
- function E(e) {
15
- const o = l(e.preferences) ? e.preferences : void 0, r = o && l(o.kpiVisualOptions) ? o.kpiVisualOptions : void 0, i = o && l(o.tableVisualOptions) ? o.tableVisualOptions : void 0;
16
- return {
17
- preferences: o,
18
- kpiOptions: r,
19
- kpiComparison: r && l(r.metricComparison) ? r.metricComparison : void 0,
20
- kpiComparisonPresent: !!r && "metricComparison" in r,
21
- tableOptions: i,
22
- tableComparison: i && l(i.metricComparison) ? i.metricComparison : void 0,
23
- tableComparisonPresent: !!i && "metricComparison" in i
24
- };
25
- }
26
- function $(e) {
27
- const o = [], r = (i, a) => {
28
- if (Array.isArray(i)) {
29
- i.forEach((n, c) => r(n, `${a}[${c}]`));
30
- return;
31
- }
32
- if (!l(i)) return;
33
- const m = i.config;
34
- if (l(m)) {
35
- const n = E(i), c = !!(n.kpiComparisonPresent || n.tableComparisonPresent), g = m.metricColumns, p = Array.isArray(g) ? g.flatMap(
36
- (s, t) => l(s) ? [{ index: t, metric: s }] : []
37
- ) : [];
38
- if ((p.some(({ metric: s }) => "comparisonType" in s) || c) && o.push({
39
- path: a,
40
- card: i,
41
- metrics: p,
42
- malformedMetricIndexes: Array.isArray(g) ? g.flatMap(
43
- (s, t) => l(s) ? [] : [t]
44
- ) : [],
45
- malformedMetricColumns: "metricColumns" in m && !Array.isArray(g),
46
- hasLegacyPresentation: c
47
- }), "metricColumns" in m || c) return;
48
- }
49
- Object.entries(i).forEach(
50
- ([n, c]) => r(c, a ? `${a}.${n}` : n)
51
- );
52
- };
53
- return r(e, "$"), o;
54
- }
55
- const A = {
56
- difference: "difference",
57
- change: "percent_change",
58
- change_difference: "both",
59
- ratio: "ratio"
60
- };
61
- function O(e, o) {
62
- if (!e) return;
63
- const r = Object.fromEntries(
64
- o.flatMap(
65
- (i) => typeof e[i] == "string" ? [[i, e[i]]] : []
66
- )
67
- );
68
- return Object.keys(r).length ? r : void 0;
69
- }
70
- function N(e, o, r) {
71
- if (e !== void 0) {
72
- if (!l(e)) {
73
- r.push({
74
- severity: "error",
75
- code: "invalid_legacy_comparison_presentation",
76
- path: o,
77
- message: "Legacy comparison formatOptions must be an object."
78
- });
79
- return;
80
- }
81
- Object.entries(e).forEach(([i, a]) => {
82
- if (i === "decimalPlaces") {
83
- (typeof a != "number" || !Number.isInteger(a) || a < 0 || a > 6) && r.push({
84
- severity: "error",
85
- code: "invalid_legacy_comparison_presentation",
86
- path: `${o}.decimalPlaces`,
87
- message: "Legacy comparison decimalPlaces must be an integer from 0 through 6."
88
- });
89
- return;
90
- }
91
- i === "type" && (a === void 0 || a === "auto") || a !== void 0 && r.push({
92
- severity: "error",
93
- code: "unsupported_comparison_format",
94
- path: `${o}.${i}`,
95
- message: `Legacy comparison format option "${i}" has no canonical presentation mapping.`
96
- });
97
- });
98
- }
99
- }
100
- function v(e, o) {
101
- const r = o === "kpi" ? e.calculationType : e.calculatedAs, i = o === "table" && r === void 0 ? "both" : A[String(r)], a = l(e.formatOptions) ? e.formatOptions : void 0, m = l(e.conditionalLabels) ? e.conditionalLabels : void 0, n = l(
102
- o === "kpi" ? e.colorConfig : e.colors
103
- ) ? o === "kpi" ? e.colorConfig : e.colors : void 0, c = {};
104
- if (i && (c.displayMode = i), typeof (a == null ? void 0 : a.decimalPlaces) == "number" && (c.precision = a.decimalPlaces), o === "kpi") {
105
- const s = e.showArrow !== !1, t = e.showColor !== !1;
106
- c.indicatorStyle = s ? t ? "arrow_badge" : "arrow" : t ? "badge" : "none", c.showColor = t, (e.position === "left" || e.position === "right" || e.position === "top") && (c.position = e.position), typeof e.conditionalLabel == "boolean" && (c.conditionalLabel = e.conditionalLabel), typeof e.labelName == "string" && (c.labelName = e.labelName);
107
- } else (e.indicatorStyle === "arrow_badge" || e.indicatorStyle === "arrow" || e.indicatorStyle === "badge" || e.indicatorStyle === "none") && (c.indicatorStyle = e.indicatorStyle);
108
- const g = m ? {
109
- ...O(m, ["increase", "decrease"]),
110
- ...typeof m.noChange == "string" ? { neutral: m.noChange } : typeof m.neutral == "string" ? { neutral: m.neutral } : {}
111
- } : void 0;
112
- g && Object.keys(g).length && (c.conditionalLabels = g);
113
- const p = n ? {
114
- ...O(n, ["increase", "decrease"]),
115
- ...typeof n.noChange == "string" ? { neutral: n.noChange } : typeof n.neutral == "string" ? { neutral: n.neutral } : {}
116
- } : void 0;
117
- return p && Object.keys(p).length && (c.colors = p), c;
118
- }
119
- function w(e) {
120
- return { ...k, ...e };
121
- }
122
- function P(e) {
123
- return e.some(({ metric: o }) => o.comparisonType === "previous_period" || o.comparisonType === "same_period_last_year" || o.comparisonType === "target" ? !0 : l(o.comparison) && o.comparison.mode === "explicit");
124
- }
125
- function C(e) {
126
- const o = e.card.config;
127
- return e.metrics.length === 2 && (o.groupByColumns === void 0 || Array.isArray(o.groupByColumns) && o.groupByColumns.length === 0);
128
- }
129
- function L(e, o, r, i) {
130
- const a = o === "kpi" ? [
131
- "enabled",
132
- "calculationType",
133
- "formatOptions",
134
- "showArrow",
135
- "showColor",
136
- "conditionalLabel",
137
- "labelName",
138
- "position",
139
- "conditionalLabels",
140
- "colorConfig",
141
- "lowerIsBetter"
142
- ] : [
143
- "calculatedAs",
144
- "indicatorStyle",
145
- "formatOptions",
146
- "colors",
147
- "lowerIsBetter"
148
- ];
149
- Object.keys(e).forEach((s) => {
150
- a.includes(s) || i.push({
151
- severity: "error",
152
- code: "invalid_legacy_comparison_presentation",
153
- path: `${r}.${s}`,
154
- message: `Unknown legacy comparison presentation field "${s}" cannot be dropped automatically.`
155
- });
156
- });
157
- const m = o === "kpi" ? "calculationType" : "calculatedAs";
158
- e[m] !== void 0 && !A[String(e[m])] && i.push({
159
- severity: "error",
160
- code: "invalid_legacy_comparison_presentation",
161
- path: `${r}.${m}`,
162
- message: `Legacy comparison ${m} is unsupported.`
163
- }), o === "kpi" && e.position !== void 0 && !["left", "right", "top"].includes(String(e.position)) && i.push({
164
- severity: "error",
165
- code: "invalid_legacy_comparison_presentation",
166
- path: `${r}.position`,
167
- message: "Legacy comparison position is unsupported."
168
- }), o === "kpi" && e.labelName !== void 0 && typeof e.labelName != "string" && i.push({
169
- severity: "error",
170
- code: "invalid_legacy_comparison_presentation",
171
- path: `${r}.labelName`,
172
- message: "Legacy comparison labelName must be a string."
173
- }), (o === "kpi" ? [
174
- ["conditionalLabels", ["increase", "decrease", "noChange"]],
175
- ["colorConfig", ["increase", "decrease", "noChange"]]
176
- ] : [["colors", ["increase", "decrease", "neutral"]]]).forEach(([s, t]) => {
177
- if (e[s] !== void 0) {
178
- if (!l(e[s])) {
179
- i.push({
180
- severity: "error",
181
- code: "invalid_legacy_comparison_presentation",
182
- path: `${r}.${s}`,
183
- message: `Legacy comparison ${s} must be an object.`
184
- });
185
- return;
186
- }
187
- Object.entries(e[s]).forEach(([u, f]) => {
188
- t.includes(u) ? typeof f != "string" && i.push({
189
- severity: "error",
190
- code: "invalid_legacy_comparison_presentation",
191
- path: `${r}.${s}.${u}`,
192
- message: `Legacy comparison ${s}.${u} must be a string.`
193
- }) : i.push({
194
- severity: "error",
195
- code: "invalid_legacy_comparison_presentation",
196
- path: `${r}.${s}.${u}`,
197
- message: `Unknown legacy comparison ${s} field "${u}" cannot be dropped automatically.`
198
- });
199
- });
200
- }
201
- }), (o === "kpi" ? ["enabled", "showArrow", "showColor", "conditionalLabel", "lowerIsBetter"] : ["lowerIsBetter"]).forEach((s) => {
202
- e[s] !== void 0 && typeof e[s] != "boolean" && i.push({
203
- severity: "error",
204
- code: "invalid_legacy_comparison_presentation",
205
- path: `${r}.${s}`,
206
- message: `Legacy comparison ${s} must be a boolean.`
207
- });
208
- }), o === "table" && e.indicatorStyle !== void 0 && !["arrow_badge", "arrow", "badge", "none"].includes(
209
- String(e.indicatorStyle)
210
- ) && i.push({
211
- severity: "error",
212
- code: "invalid_legacy_comparison_presentation",
213
- path: `${r}.indicatorStyle`,
214
- message: "Legacy comparison indicatorStyle is unsupported."
215
- }), N(e.formatOptions, `${r}.formatOptions`, i);
216
- const g = v(e, o);
217
- I(g, r).errors.forEach((s) => {
218
- i.push({
219
- severity: "error",
220
- code: "invalid_legacy_comparison_presentation",
221
- path: s.path || r,
222
- message: s.message
223
- });
224
- });
225
- }
226
- function T(e) {
227
- const o = E(e.card), r = o.kpiComparison ? v(o.kpiComparison, "kpi") : void 0, i = o.tableComparison ? v(o.tableComparison, "table") : void 0;
228
- return { namespaces: o, kpi: r, table: i, presentation: r || i };
229
- }
230
- function M(e) {
231
- const o = l(e.preferences) ? e.preferences : {}, r = l(o.kpiVisualOptions) ? o.kpiVisualOptions : {}, i = l(r.metricComparison) ? r.metricComparison : {}, a = l(o.tableVisualOptions) ? o.tableVisualOptions : {}, m = l(a.metricComparison) ? a.metricComparison : {};
232
- return r.lowerIsBetter === !0 || i.lowerIsBetter === !0 || m.lowerIsBetter === !0 ? "lower_is_better" : "higher_is_better";
233
- }
234
- function B(e) {
235
- switch (e.comparisonType) {
236
- case "previous_period":
237
- return { mode: "explicit", spec: { kind: "previous_period" } };
238
- case "same_period_last_year":
239
- return { mode: "explicit", spec: { kind: "previous_year" } };
240
- case "target":
241
- return {
242
- mode: "explicit",
243
- spec: { kind: "target", targetValue: e.targetValue }
244
- };
245
- default:
246
- return;
247
- }
248
- }
249
- function R(e) {
250
- const o = l(e.preferences) ? e.preferences : void 0;
251
- if (!o) return;
252
- const r = l(o.kpiVisualOptions) ? o.kpiVisualOptions : void 0;
253
- r && delete r.lowerIsBetter;
254
- const i = l(o.tableVisualOptions) ? o.tableVisualOptions : void 0, a = i && l(i.metricComparison) ? i.metricComparison : void 0;
255
- a && delete a.lowerIsBetter;
256
- }
257
- function G(e) {
258
- const o = $(e);
259
- if (!o.length)
260
- return { document: e, changed: !1, changes: [], diagnostics: [] };
261
- const r = [];
262
- if (o.forEach((n) => {
263
- var c, g, p, s;
264
- if (n.malformedMetricColumns && r.push({
265
- severity: "error",
266
- code: "malformed_metric_columns",
267
- path: `${n.path}.config.metricColumns`,
268
- message: "Metric columns must be an array before comparison migration."
269
- }), n.malformedMetricIndexes.forEach((t) => {
270
- r.push({
271
- severity: "error",
272
- code: "malformed_metric_columns",
273
- path: `${n.path}.config.metricColumns[${t}]`,
274
- message: "Metric columns must contain objects before comparison migration."
275
- });
276
- }), n.metrics.forEach(({ metric: t, index: u }) => {
277
- if (!("comparisonType" in t)) return;
278
- const f = `${n.path}.config.metricColumns[${u}]`, d = String(t.comparisonType || "");
279
- "comparison" in t && r.push({
280
- severity: "error",
281
- code: "conflicting_comparison_contracts",
282
- path: f,
283
- message: "Metric contains both legacy and canonical comparison configuration; resolve the conflict before migration."
284
- });
285
- const h = l(t.parameters) ? t.parameters : void 0, b = h && l(h.windowTransform) ? h.windowTransform : void 0;
286
- _.has(d) && (b == null ? void 0 : b.function) === "previous_period_delta" && r.push({
287
- severity: "error",
288
- code: "conflicting_comparison_window_transform",
289
- path: f,
290
- message: "A metric cannot combine baseline comparison with previous_period_delta; resolve the authoring intent before migration."
291
- }), V.has(d) || r.push({
292
- severity: "error",
293
- code: "unsupported_comparison_type",
294
- path: `${f}.comparisonType`,
295
- message: `Unsupported legacy metric comparison type "${d}".`
296
- }), t.comparisonType === "target" && (typeof t.targetValue != "number" || !Number.isFinite(t.targetValue)) && r.push({
297
- severity: "error",
298
- code: "invalid_target_value",
299
- path: `${f}.targetValue`,
300
- message: "Legacy target comparison requires a finite metric targetValue."
301
- }), t.comparisonType === "start_vs_end" && r.push({
302
- severity: "error",
303
- code: "unsupported_start_vs_end",
304
- path: `${f}.comparisonType`,
305
- message: "start_vs_end is retired and cannot be migrated automatically."
306
- }), t.targetValue !== void 0 && t.comparisonType !== "target" && r.push({
307
- severity: "warning",
308
- code: "stray_target_value",
309
- path: `${f}.targetValue`,
310
- message: "Dead non-target targetValue will be removed without changing the baseline."
311
- });
312
- }), n.hasLegacyPresentation) {
313
- const { namespaces: t, kpi: u, table: f } = T(n), d = [
314
- (c = t.kpiOptions) == null ? void 0 : c.lowerIsBetter,
315
- (g = t.kpiComparison) == null ? void 0 : g.lowerIsBetter,
316
- (p = t.tableComparison) == null ? void 0 : p.lowerIsBetter
317
- ].filter((h) => typeof h == "boolean");
318
- new Set(d).size > 1 && r.push({
319
- severity: "error",
320
- code: "conflicting_legacy_polarity",
321
- path: `${n.path}.preferences`,
322
- message: "Legacy comparison polarity values disagree; resolve the conflict before migration."
323
- }), ((s = t.kpiOptions) == null ? void 0 : s.lowerIsBetter) !== void 0 && typeof t.kpiOptions.lowerIsBetter != "boolean" && r.push({
324
- severity: "error",
325
- code: "invalid_legacy_comparison_presentation",
326
- path: `${n.path}.preferences.kpiVisualOptions.lowerIsBetter`,
327
- message: "Legacy comparison lowerIsBetter must be a boolean."
328
- }), t.kpiComparisonPresent && !t.kpiComparison && r.push({
329
- severity: "error",
330
- code: "invalid_legacy_comparison_presentation",
331
- path: `${n.path}.preferences.kpiVisualOptions.metricComparison`,
332
- message: "Legacy KPI comparison presentation must be an object."
333
- }), t.tableComparisonPresent && !t.tableComparison && r.push({
334
- severity: "error",
335
- code: "invalid_legacy_comparison_presentation",
336
- path: `${n.path}.preferences.tableVisualOptions.metricComparison`,
337
- message: "Legacy table comparison presentation must be an object."
338
- }), "comparisonPresentation" in (t.preferences || {}) && r.push({
339
- severity: "error",
340
- code: "conflicting_comparison_presentation_contracts",
341
- path: `${n.path}.preferences.comparisonPresentation`,
342
- message: "Card contains both legacy and canonical comparison presentation; resolve the conflict before migration."
343
- }), t.kpiComparison && typeof t.kpiComparison.enabled == "boolean" && "metricPairComparisonEnabled" in (t.preferences || {}) && C(n) && r.push({
344
- severity: "error",
345
- code: "conflicting_comparison_presentation_contracts",
346
- path: `${n.path}.preferences.metricPairComparisonEnabled`,
347
- message: "Card contains both legacy and canonical metric-pair enablement; resolve the conflict before migration."
348
- }), t.kpiComparison && L(
349
- t.kpiComparison,
350
- "kpi",
351
- `${n.path}.preferences.kpiVisualOptions.metricComparison`,
352
- r
353
- ), t.tableComparison && L(
354
- t.tableComparison,
355
- "table",
356
- `${n.path}.preferences.tableVisualOptions.metricComparison`,
357
- r
358
- ), u && f && JSON.stringify(w(u)) !== JSON.stringify(w(f)) && r.push({
359
- severity: "error",
360
- code: "conflicting_legacy_presentation_namespaces",
361
- path: `${n.path}.preferences`,
362
- message: "KPI and table comparison presentation values disagree; resolve the conflict before migration."
363
- });
364
- }
365
- }), r.some((n) => n.severity === "error"))
366
- return { document: e, changed: !1, changes: [], diagnostics: r };
367
- const i = JSON.parse(JSON.stringify(e)), a = $(i), m = [];
368
- return a.forEach((n) => {
369
- var g;
370
- const c = M(n.card);
371
- if (n.metrics.forEach(({ metric: p, index: s }) => {
372
- if (!("comparisonType" in p)) return;
373
- const t = String(p.comparisonType || ""), u = `${n.path}.config.metricColumns[${s}]`, f = B(p), d = ["comparisonType"];
374
- delete p.comparisonType, "targetValue" in p && (delete p.targetValue, d.push("targetValue")), "comparisonDisplay" in p && (delete p.comparisonDisplay, d.push("comparisonDisplay")), f ? p.comparison = f : delete p.comparison, _.has(t) && (p.comparisonPolarity = c), m.push({
375
- kind: "metric",
376
- path: u,
377
- metricId: typeof p.id == "string" ? p.id : void 0,
378
- legacyType: t,
379
- comparison: f,
380
- comparisonPolarity: _.has(t) ? c : void 0,
381
- removedFields: d
382
- });
383
- }), R(n.card), n.hasLegacyPresentation) {
384
- const { namespaces: p, presentation: s } = T(n), t = (g = p.kpiComparison) == null ? void 0 : g.enabled, u = {
385
- ...s
386
- };
387
- typeof t == "boolean" && P(n.metrics) && (u.showComparison = t);
388
- const f = typeof t == "boolean" && C(n) ? t : void 0, d = typeof t == "boolean" && !P(n.metrics) && !C(n) ? ["kpiVisualOptions.metricComparison.enabled"] : void 0, h = p.preferences, b = [];
389
- n.metrics.forEach(({ metric: y }) => {
390
- "comparisonPolarity" in y || (y.comparisonPolarity = c, typeof y.id == "string" && b.push(y.id));
391
- }), Object.keys(u).length && (h.comparisonPresentation = u), f !== void 0 && (h.metricPairComparisonEnabled = f), p.kpiOptions && delete p.kpiOptions.metricComparison, p.tableOptions && delete p.tableOptions.metricComparison, m.push({
392
- kind: "presentation",
393
- path: `${n.path}.preferences`,
394
- comparisonPresentation: Object.keys(u).length ? u : void 0,
395
- metricPairComparisonEnabled: f,
396
- comparisonPolarityMetricIds: b,
397
- intentionallyDiscardedFields: d,
398
- removedFields: [
399
- ...p.kpiComparison ? ["kpiVisualOptions.metricComparison"] : [],
400
- ...p.tableComparison ? ["tableVisualOptions.metricComparison"] : []
401
- ]
402
- });
403
- }
404
- }), { document: i, changed: !0, changes: m, diagnostics: r };
405
- }
406
- const D = [
407
- "bar",
408
- "horizontalBar",
409
- "line",
410
- "area",
411
- "stackedArea",
412
- "combo",
413
- "stackedBar",
414
- "stackedLine"
415
- ], x = new Set(
416
- D
417
- );
418
- function j(e) {
419
- return typeof e == "string" && x.has(e);
420
- }
421
- function J(e) {
422
- return e === "detailTable" || e === "table" || e === "aggregateTable" || e === "pivotTable" || e === "custom" || j(e);
423
- }
424
- function S(e) {
425
- return !!(e != null && e.trim());
426
- }
427
- function q(e) {
428
- return S(e.sql) || S(e.normalizedPython) ? "freeform" : e.hasExecutableConfig ? "config" : "none";
429
- }
430
- const F = "SEMAPHOR_CALCULATED_FIELD";
431
- function K(e, o, r) {
432
- if (r && (o === "groupby" || o === "pivotby"))
433
- return r;
434
- if (o === "metric" && e.name === "*" && !e.expression)
435
- return e.alias || "count";
436
- if (e.alias) return e.alias;
437
- const i = e.entityName && e.entityName !== F ? e.entityName : void 0;
438
- if (e.role === "metric") {
439
- let a = e.aggregate || "metric";
440
- if (e.expression) {
441
- const m = e.expression.match(
442
- /^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
443
- );
444
- a = m ? m[1].toLowerCase() : "expr";
445
- } else
446
- a = a.toLowerCase();
447
- return i && i !== e.name ? `${i}_${e.name}_${a}` : `${e.name}_${a}`;
448
- }
449
- return i && i !== e.name ? `${i}_${e.name}` : e.name;
450
- }
451
- function W(e) {
452
- return K(e, "detail");
453
- }
454
- function X(e) {
455
- const o = e.label;
456
- return o && e.labelCount === 1 && (o === e.rawKey || !e.rawKeys.has(o)) ? o : e.rawKey;
457
- }
458
- export {
459
- D as S,
460
- K as a,
461
- W as b,
462
- X as c,
463
- j as i,
464
- q as r,
465
- J as s,
466
- G as t
467
- };
@@ -1 +0,0 @@
1
- "use strict";const I=require("./validators-BDYprKI9.cjs");function b(e,n){const t=e.split(".").map(r=>r.trim()),i=n.split(".").map(r=>r.trim());if(t.length===0||i.length===0||t.some(r=>!r)||i.some(r=>!r))return!1;const[s,o]=t.length<=i.length?[t,i]:[i,t],a=o.length-s.length;return s.every((r,c)=>r===o[c+a])}function C(e,n){const t=e.split("."),i=n.split("."),s=t.pop(),o=i.pop();return!!(s&&s===o&&t.length>0&&i.length>0&&b(t.join("."),i.join(".")))}function N(e){const n=e.map(i=>i.trim()).filter(Boolean);if(n.every((i,s)=>n.slice(s+1).every(o=>b(i,o))))return[...n].sort((i,s)=>s.split(".").length-i.split(".").length)[0]}function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function D(e){if(typeof e!="string")return"";const n=e.split(".").map(t=>t.trim());return n.length>1&&n.every(Boolean)?n.join("."):""}function v(e){if(typeof e!="string")return"";const n=e.split(".").map(t=>t.trim());return n.length>0&&n.every(Boolean)?n.join("."):""}function d(e){return typeof e=="string"?e.trim():""}function S(e,n){return e.every((t,i)=>e.slice(i+1).every(s=>n(t,s)))}function q(e,n){const t=d(e.id),i=d(e.name),s=d(n.entityId),o=d(n.entityName);return!i||!s&&!o?!1:(!s||s===t||s===i)&&(!o||o===i)}function E(e){const n=u(e.semanticContext)?e.semanticContext:void 0,t=u(e.fieldMeta)?e.fieldMeta:void 0,i=d(n==null?void 0:n.semanticDomainId),s=Array.isArray(n==null?void 0:n.selectedEntities)?n.selectedEntities.filter(g=>u(g)&&g.type==="dataset"):[];if(!!!(i||s.length>0||(t==null?void 0:t.entityType)==="dataset"))return;if(!i)return{status:"unresolved",reason:"incomplete_source_identity"};const a=d(t==null?void 0:t.entityId),r=d(t==null?void 0:t.entityName),c=!!(a||r),f=c?s.filter(g=>q(g,{entityId:a,entityName:r})):s;if(f.length>1)return{status:"unresolved",reason:"incomplete_source_identity"};if(c&&s.length>0&&f.length===0)return{status:"unresolved",reason:"divergent_source_identity"};const l=f[0],m=d(l==null?void 0:l.domainId),p=d(l==null?void 0:l.id),y=d(l==null?void 0:l.name);if(m&&m!==i)return{status:"unresolved",reason:"divergent_source_identity"};const h=p,_=y||r;return _?{status:"resolved",source:{kind:"semantic",domainId:i,datasetName:_,...h?{datasetId:h}:{}}}:{status:"unresolved",reason:"incomplete_source_identity"}}function A(e,n){const t=d(e.connectionId),i=u(e.semanticContext)?e.semanticContext:void 0,s=d(i==null?void 0:i.connectionId);if(t&&s&&t!==s)return{status:"unresolved",reason:"divergent_source_identity"};const o=t||s,a=u(e.fieldMeta)?e.fieldMeta:void 0,r=n.split(".").slice(0,-1).join("."),c=v(e.qualifiedTableName),f=v(a==null?void 0:a.qualifiedEntityName),l=[c,f,r].filter(Boolean),m=N(l);return!m&&l.length>0?{status:"unresolved",reason:"divergent_source_identity"}:!o||!m?{status:"unresolved",reason:"incomplete_source_identity"}:{status:"resolved",source:{kind:"physical",connectionId:o,tableName:m}}}function B(e,n){const t=u(e.fieldMeta)?e.fieldMeta:void 0,i=typeof(t==null?void 0:t.qualifiedFieldName)=="string"?t.qualifiedFieldName.trim():"",s=D(t==null?void 0:t.qualifiedFieldName),o=typeof e.column=="string"?e.column.trim():"",a=D(o),r=typeof e.qualifiedTableName=="string"?e.qualifiedTableName.trim():"",c=v(e.qualifiedTableName);if(i&&!s||n&&r&&!c||o.includes(".")&&!a)return{status:"unresolved",reason:"incomplete_field_identity"};const f=a.split("."),l=a?f[f.length-1]:o,m=n&&c&&l?`${c}.${l}`:"",p=[s,a,m].filter(Boolean);if(!S(p,C))return{status:"unresolved",reason:"divergent_field_identity"};const y=a||s||m;return y?{status:"resolved",qualifiedFieldName:y}:{status:"unresolved",reason:"incomplete_field_identity"}}function F(e){if(!u(e))return{status:"ineligible",reason:"invalid_input"};if(e.kind==="global-date")return{status:"eligible",kind:"global_date"};const n=I.normalizeAnalyticsCatalogDataType(e.dataType);if(n!=="date"&&n!=="datetime")return{status:"ineligible",reason:"non_date_filter"};const t=u(e.fieldMeta)?e.fieldMeta:void 0,i=I.normalizeAnalyticsCatalogDataType(t==null?void 0:t.dataType);if((t==null?void 0:t.dataType)!==void 0&&i!=="date"&&i!=="datetime")return{status:"ineligible",reason:"non_date_filter"};if(e.customFilterPreferences)return{status:"ineligible",reason:"custom_filter"};if(e.targetColumns!==void 0&&(!Array.isArray(e.targetColumns)||e.targetColumns.length>0))return{status:"ineligible",reason:"multi_target_filter"};const s=E(e),o=B(e,s===void 0);if(o.status==="unresolved")return{status:"ineligible",reason:o.reason};const a=s||A(e,o.qualifiedFieldName);return a.status==="resolved"?{status:"eligible",kind:"field_date",qualifiedFieldName:o.qualifiedFieldName,source:a.source}:{status:"ineligible",reason:a.reason}}function T(e){if(!u(e)||e.kind!=="filter"||!u(e.filter))return{status:"ineligible",reason:"invalid_input"};const n=F(e.filter);return n.status==="ineligible"?n:n.kind==="field_date"&&u(e.compatibility)&&e.compatibility.source==="cardInlineFilter"?{status:"ineligible",reason:"card_inline_filter"}:n}function k(e){return T(e).status==="eligible"}exports.isComparisonCapableDashboardDateInputDefinition=k;exports.qualifiedEntityIdentitiesReferToSameEntity=b;exports.qualifiedFieldIdentitiesReferToSameField=C;exports.resolveDashboardDateComparisonFilterDefinition=F;exports.resolveDashboardDateComparisonInputDefinition=T;exports.selectMostQualifiedCompatibleEntityIdentity=N;exports.semanticDatasetMatchesFieldCoordinates=q;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./x-B6ghREd2.cjs"),r=require("./switch-f3TuZNLr.cjs");require("./saved-temporal-bucket-format-CFfWXRl9.cjs");require("./validators-BDYprKI9.cjs");require("./analyze-result-contract-LPDNldic.cjs");require("../value-format-preferences/index.cjs");require("./index-DHF-2AqS.cjs");require("./index-ByFbacH7.cjs");require("./temporal-bucket-authoring-o3Emn05L.cjs");require("./canonical-result-keys-BA0HCP4e.cjs");require("./color-CyB5o13F.cjs");require("react-dom");require("./index-k8tEp0ys.cjs");function S(){const t=r.useDashboardStore(e=>e.dashboard),d=r.useDashboardStore(e=>e.actions.setDashboard),c=r.useDashboardStore(e=>e.showDashboardJSON),h=r.useDashboardStore(e=>e.actions.setShowDashboardJSON),s=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,n]=o.useState(s),i=o.useRef(s);return o.useEffect(()=>{s!==i.current&&(n(s),i.current=s)},[s]),a.jsxs("div",{className:r.cn("relative p-2",{hidden:!c}),children:[a.jsxs(r.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(r.CodeEditor,{value:l,onValueChange:e=>{n(e);try{const u=JSON.parse(e);i.current=JSON.stringify(u,null,2),d(u)}catch{}},language:"json"})})]})}exports.default=S;