react-semaphor 0.1.541 → 0.1.543
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 +75 -75
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.js +51 -49
- package/dist/chunks/apply-dashboard-operations-CG9S7MGt.js +2260 -0
- package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-BFMRUYoB.js} +12 -12
- package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
- package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
- package/dist/chunks/comparison-window-caption-Bv18samq.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-B9mKTJoy.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-Bdmry_oG.js} +18 -18
- package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-UGpjOM2k.js} +69 -70
- package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
- package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-DG8dz0eX.js} +4 -4
- package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-OwqCbrVp.js} +2382 -4975
- package/dist/chunks/document-sheet-utils-BTb3VZxV.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-CDpA4y5e.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/{index-DaQlghLY.js → index-l5LclZvs.js} +824 -1351
- package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
- package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
- package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
- package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
- package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
- package/dist/chunks/numeric-presentation-F_-H6VAw.js +5227 -0
- package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
- package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-DupbRk-R.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-D-azM_98.js +585 -0
- package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-CPwRwEJx.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-BKvMfRfC.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-CN2AHm2x.js} +37489 -39476
- package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-BGl_rxcW.js} +6 -6
- package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
- package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
- package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
- package/dist/chunks/table-export-sheet-BDRXLLdq.js +949 -0
- package/dist/chunks/table-settings-CLZocegs.js +501 -0
- package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
- package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BnclfB2k.js} +151 -151
- package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +462 -457
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.js +346 -241
- package/dist/index.js +174 -175
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +5 -3
- package/dist/types/index.js +48 -48
- package/dist/types/lib/api/exports-api.d.ts +11 -65
- package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
- package/dist/types/lib/types/explorer-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
- package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
- package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
- package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
- package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
- package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
- package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
- package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
- package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
- package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
- package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
- package/package.json +2 -1
- package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
- package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
- package/dist/chunks/common-types-CUf03Htv.js +0 -288
- package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
- package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
- package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
- package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
- package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
- package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
2
|
+
import { r as P } from "./pivot-result-identity-DJhXXcns.js";
|
|
3
|
+
import { r as R, n as M } from "./numeric-presentation-F_-H6VAw.js";
|
|
4
|
+
import "./validators-DMHTpf7a.js";
|
|
5
|
+
import "./matrix-operation-contract-8OIO4gob.js";
|
|
6
|
+
import { v as S } from "./raw-temporal-contract-C51YG48G.js";
|
|
7
|
+
import "zod";
|
|
8
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as A } from "../value-format-preferences/index.js";
|
|
9
|
+
import { f as E, M as O } from "./pivot-result-lifecycle-DupbRk-R.js";
|
|
10
|
+
import { p as g, r as b, c as q, R as z, v as L } from "./temporal-bucket-D7NBrrtL.js";
|
|
11
|
+
const $ = "SEMAPHOR_CALCULATED_FIELD";
|
|
12
|
+
function j(e, a, t) {
|
|
13
|
+
if (t && (a === "groupby" || a === "pivotby"))
|
|
14
|
+
return t;
|
|
15
|
+
if (a === "metric" && e.name === "*" && !e.expression)
|
|
16
|
+
return e.alias || "count";
|
|
17
|
+
if (e.alias) return e.alias;
|
|
18
|
+
const r = e.entityName && e.entityName !== $ ? e.entityName : void 0;
|
|
19
|
+
if (e.role === "metric") {
|
|
20
|
+
let o = e.aggregate || "metric";
|
|
21
|
+
if (e.expression) {
|
|
22
|
+
const n = e.expression.match(
|
|
23
|
+
/^(COUNT|SUM|AVG|MIN|MAX|MEDIAN|DISTINCT)\s*\(/i
|
|
24
|
+
);
|
|
25
|
+
o = n ? n[1].toLowerCase() : "expr";
|
|
26
|
+
} else
|
|
27
|
+
o = o.toLowerCase();
|
|
28
|
+
return r && r !== e.name ? `${r}_${e.name}_${o}` : `${e.name}_${o}`;
|
|
29
|
+
}
|
|
30
|
+
return r && r !== e.name ? `${r}_${e.name}` : e.name;
|
|
31
|
+
}
|
|
32
|
+
function se(e) {
|
|
33
|
+
return j(e, "detail");
|
|
34
|
+
}
|
|
35
|
+
function le(e) {
|
|
36
|
+
const a = e.label;
|
|
37
|
+
return a && e.labelCount === 1 && (a === e.rawKey || !e.rawKeys.has(a)) ? a : e.rawKey;
|
|
38
|
+
}
|
|
39
|
+
class m extends Error {
|
|
40
|
+
constructor(a, t, r) {
|
|
41
|
+
super(`${a}: ${t}`), this.code = a, this.context = r, Object.setPrototypeOf(this, m.prototype), this.name = "RawTemporalPresentationBoundaryError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function k() {
|
|
45
|
+
return { type: "raw_temporal", presentation: { mode: "auto" } };
|
|
46
|
+
}
|
|
47
|
+
function N(e) {
|
|
48
|
+
if (e.locale || e.relative || e.timezone && e.timezone !== "auto" || e.sourceTimezone && e.sourceTimezone !== "auto" || e.prefix || e.suffix)
|
|
49
|
+
throw new m(
|
|
50
|
+
"invalid_raw_temporal_format",
|
|
51
|
+
"Activated raw temporal presentation contains unsupported locale, relative-time, timezone, prefix, or suffix settings."
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function U(e) {
|
|
55
|
+
const a = e.format;
|
|
56
|
+
if ((a == null ? void 0 : a.type) === "date" && (N(a), a.pattern))
|
|
57
|
+
return {
|
|
58
|
+
type: "raw_temporal",
|
|
59
|
+
presentation: {
|
|
60
|
+
mode: "pattern",
|
|
61
|
+
dialect: "semaphor_tokens",
|
|
62
|
+
pattern: a.pattern
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if (a)
|
|
66
|
+
throw new m(
|
|
67
|
+
"invalid_raw_temporal_format",
|
|
68
|
+
`Raw temporal detail field "${e.id}" has an incompatible authored format.`,
|
|
69
|
+
{ fieldId: e.id }
|
|
70
|
+
);
|
|
71
|
+
if (e.dateFormat === "custom") {
|
|
72
|
+
if (!e.customFormat)
|
|
73
|
+
throw new m(
|
|
74
|
+
"invalid_raw_temporal_format",
|
|
75
|
+
`Raw temporal detail field "${e.id}" selects a custom pattern but has no customFormat.`,
|
|
76
|
+
{ fieldId: e.id }
|
|
77
|
+
);
|
|
78
|
+
return {
|
|
79
|
+
type: "raw_temporal",
|
|
80
|
+
presentation: {
|
|
81
|
+
mode: "pattern",
|
|
82
|
+
dialect: "semaphor_tokens",
|
|
83
|
+
pattern: e.customFormat
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return e.dateFormat ? {
|
|
88
|
+
type: "raw_temporal",
|
|
89
|
+
presentation: {
|
|
90
|
+
mode: "pattern",
|
|
91
|
+
dialect: "semaphor_tokens",
|
|
92
|
+
pattern: e.dateFormat
|
|
93
|
+
}
|
|
94
|
+
} : k();
|
|
95
|
+
}
|
|
96
|
+
function D(e) {
|
|
97
|
+
var s;
|
|
98
|
+
if (e != null && e.useRelativeTime) return;
|
|
99
|
+
if (!e) return k();
|
|
100
|
+
if (e.useCustomFormat && !((s = e.customFormat) != null && s.trim()))
|
|
101
|
+
throw new m(
|
|
102
|
+
"invalid_raw_temporal_format",
|
|
103
|
+
"Declared SQL temporal presentation selects a custom pattern but has no customFormat.",
|
|
104
|
+
{ reason: "missing_declared_sql_custom_date_format" }
|
|
105
|
+
);
|
|
106
|
+
const a = e.useCustomFormat && e.customFormat ? e.customFormat : e.format, t = e.timezone, r = e.sourceTimezone, o = t && t !== "auto" ? { timezone: t } : void 0, n = {
|
|
107
|
+
sourceTimezone: r && r !== "auto" ? r : "UTC"
|
|
108
|
+
};
|
|
109
|
+
return a ? {
|
|
110
|
+
type: "raw_temporal",
|
|
111
|
+
...o,
|
|
112
|
+
...n,
|
|
113
|
+
presentation: {
|
|
114
|
+
mode: "pattern",
|
|
115
|
+
dialect: "date_fns",
|
|
116
|
+
pattern: a
|
|
117
|
+
}
|
|
118
|
+
} : {
|
|
119
|
+
type: "raw_temporal",
|
|
120
|
+
...o,
|
|
121
|
+
...n,
|
|
122
|
+
presentation: { mode: "auto" }
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function ie(e) {
|
|
126
|
+
return e === "instant" ? "yyyy-MM-dd'T'HH:mm:ssXXX" : e === "wall_datetime" ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd";
|
|
127
|
+
}
|
|
128
|
+
function me(e) {
|
|
129
|
+
L({
|
|
130
|
+
dialect: "date_fns",
|
|
131
|
+
pattern: e.pattern,
|
|
132
|
+
valueKind: e.valueKind
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function V(e) {
|
|
136
|
+
const a = D(e.settings);
|
|
137
|
+
if (!a)
|
|
138
|
+
throw new m(
|
|
139
|
+
"invalid_raw_temporal_format",
|
|
140
|
+
"Relative-time SQL presentation does not have an absolute date preview."
|
|
141
|
+
);
|
|
142
|
+
const t = e.valueKind ?? (a.presentation.mode === "pattern" ? "instant" : "date"), r = {
|
|
143
|
+
kind: "raw_temporal",
|
|
144
|
+
valueKind: t
|
|
145
|
+
}, o = e.value ?? (t === "date" ? "2023-05-15" : t === "wall_datetime" ? "2023-05-15T14:30:45" : "2023-05-15T14:30:45Z"), n = g({
|
|
146
|
+
metadata: r,
|
|
147
|
+
format: b({
|
|
148
|
+
format: a,
|
|
149
|
+
preferences: e.preferences,
|
|
150
|
+
calendar: { tz: e.calendarTimezone }
|
|
151
|
+
})
|
|
152
|
+
})(o);
|
|
153
|
+
if (!n.ok)
|
|
154
|
+
throw new m(
|
|
155
|
+
"invalid_raw_temporal_format",
|
|
156
|
+
n.diagnostic.message
|
|
157
|
+
);
|
|
158
|
+
return n.text;
|
|
159
|
+
}
|
|
160
|
+
function ce(e) {
|
|
161
|
+
try {
|
|
162
|
+
return { ok: !0, text: V(e) };
|
|
163
|
+
} catch (a) {
|
|
164
|
+
return {
|
|
165
|
+
ok: !1,
|
|
166
|
+
message: a instanceof Error ? a.message : "Invalid SQL temporal presentation."
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function I(e) {
|
|
171
|
+
var t;
|
|
172
|
+
const a = e.effectiveCardConfig ?? e.card.config;
|
|
173
|
+
return R(e.card, a) === "freeform" && !!((t = e.card.sql) != null && t.trim()) && !M(e.card.python || "").trim();
|
|
174
|
+
}
|
|
175
|
+
function Q(e) {
|
|
176
|
+
var a, t;
|
|
177
|
+
return e.type !== "table" && e.type !== "detailTable" || !I({ card: e }) ? !1 : Object.values(
|
|
178
|
+
((t = (a = e.preferences) == null ? void 0 : a.tablePrefs) == null ? void 0 : t.columnSettingsMap) || {}
|
|
179
|
+
).some(
|
|
180
|
+
(r) => {
|
|
181
|
+
var o, n, s;
|
|
182
|
+
return r.type === "date" && ((o = r.dateFormat) == null ? void 0 : o.useRelativeTime) !== !0 && ((n = r.dateFormat) == null ? void 0 : n.useCustomFormat) === !0 && !((s = r.dateFormat.customFormat) != null && s.trim());
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function de(e) {
|
|
187
|
+
var t, r, o;
|
|
188
|
+
if (!Q(e)) return e;
|
|
189
|
+
const a = ((r = (t = e.preferences) == null ? void 0 : t.tablePrefs) == null ? void 0 : r.columnSettingsMap) || {};
|
|
190
|
+
return {
|
|
191
|
+
...e,
|
|
192
|
+
preferences: {
|
|
193
|
+
...e.preferences,
|
|
194
|
+
tablePrefs: {
|
|
195
|
+
...(o = e.preferences) == null ? void 0 : o.tablePrefs,
|
|
196
|
+
columnSettingsMap: Object.fromEntries(
|
|
197
|
+
Object.entries(a).map(([n, s]) => {
|
|
198
|
+
var l, p, i;
|
|
199
|
+
return [
|
|
200
|
+
n,
|
|
201
|
+
s.type === "date" && ((l = s.dateFormat) == null ? void 0 : l.useRelativeTime) !== !0 && ((p = s.dateFormat) == null ? void 0 : p.useCustomFormat) === !0 && !((i = s.dateFormat.customFormat) != null && i.trim()) ? {
|
|
202
|
+
...s,
|
|
203
|
+
dateFormat: {
|
|
204
|
+
...s.dateFormat,
|
|
205
|
+
format: "",
|
|
206
|
+
useCustomFormat: !1,
|
|
207
|
+
customFormat: ""
|
|
208
|
+
}
|
|
209
|
+
} : s
|
|
210
|
+
];
|
|
211
|
+
})
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function B() {
|
|
218
|
+
return {
|
|
219
|
+
activatedColumnKeys: /* @__PURE__ */ new Set(),
|
|
220
|
+
byColumnKey: /* @__PURE__ */ new Map(),
|
|
221
|
+
byFieldId: /* @__PURE__ */ new Map()
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function T(e, a) {
|
|
225
|
+
return e === void 0 ? { kind: "invalid", error: a } : {
|
|
226
|
+
kind: "invalid",
|
|
227
|
+
error: e instanceof m ? e : e instanceof z ? new m(
|
|
228
|
+
e.code,
|
|
229
|
+
e.message,
|
|
230
|
+
a.context
|
|
231
|
+
) : new m(
|
|
232
|
+
a.code,
|
|
233
|
+
e instanceof Error ? e.message : a.message,
|
|
234
|
+
a.context
|
|
235
|
+
)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function H(e) {
|
|
239
|
+
var o;
|
|
240
|
+
if (e.cardType !== "detailTable" || e.resultOwner !== "config")
|
|
241
|
+
return { kind: "inactive" };
|
|
242
|
+
if (!e.result) return { kind: "loading" };
|
|
243
|
+
const { records: a, columns: t, columnKeyMap: r } = e.result;
|
|
244
|
+
if (!Array.isArray(a) || !Array.isArray(t) || !r)
|
|
245
|
+
return T(
|
|
246
|
+
void 0,
|
|
247
|
+
new m(
|
|
248
|
+
"missing_raw_temporal_result_contract",
|
|
249
|
+
"Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
try {
|
|
253
|
+
const n = t.filter((d) => d.rawTemporal);
|
|
254
|
+
if (n.length === 0) return { kind: "inactive" };
|
|
255
|
+
const s = new Map(
|
|
256
|
+
(((o = e.effectiveCardConfig) == null ? void 0 : o.detailColumns) || []).map((d) => [
|
|
257
|
+
d.id,
|
|
258
|
+
d
|
|
259
|
+
])
|
|
260
|
+
), l = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
261
|
+
for (const d of n) {
|
|
262
|
+
const _ = Array.from(s).flatMap(
|
|
263
|
+
([v, x]) => {
|
|
264
|
+
const C = P(
|
|
265
|
+
r,
|
|
266
|
+
v,
|
|
267
|
+
"detail"
|
|
268
|
+
);
|
|
269
|
+
return C && C.role === "detail" && (C.outputKey ?? C.rawKey) === d.key ? [{ field: x, binding: C }] : [];
|
|
270
|
+
}
|
|
271
|
+
), c = _.length === 1 ? _[0] : null;
|
|
272
|
+
if (!c || typeof c.binding.rawKey != "string" || c.binding.rawKey.trim().length === 0 || c.binding.outputKey !== void 0 && (typeof c.binding.outputKey != "string" || c.binding.outputKey.trim().length === 0))
|
|
273
|
+
throw new m(
|
|
274
|
+
"missing_raw_temporal_column_binding",
|
|
275
|
+
`Raw temporal result column "${d.key}" does not have one valid exact detail result binding.`,
|
|
276
|
+
{ columnKey: d.key }
|
|
277
|
+
);
|
|
278
|
+
const { field: u, binding: h } = c, f = h.outputKey ?? h.rawKey, w = S(d, {
|
|
279
|
+
metadataRequired: !0
|
|
280
|
+
});
|
|
281
|
+
if (!w)
|
|
282
|
+
throw new m(
|
|
283
|
+
"invalid_raw_temporal_metadata",
|
|
284
|
+
`Raw temporal result column "${f}" has no metadata.`,
|
|
285
|
+
{ fieldId: u.id, columnKey: f }
|
|
286
|
+
);
|
|
287
|
+
const y = b({
|
|
288
|
+
format: U(u),
|
|
289
|
+
preferences: e.preferences,
|
|
290
|
+
calendar: e.calendar
|
|
291
|
+
}), F = {
|
|
292
|
+
fieldId: u.id,
|
|
293
|
+
columnKey: f,
|
|
294
|
+
metadata: w,
|
|
295
|
+
format: y,
|
|
296
|
+
formatValue: g({ metadata: w, format: y })
|
|
297
|
+
};
|
|
298
|
+
for (let v = 0; v < a.length; v += 1)
|
|
299
|
+
if (!Object.prototype.hasOwnProperty.call(a[v], f) || a[v][f] === void 0)
|
|
300
|
+
throw new m(
|
|
301
|
+
"missing_raw_temporal_result_contract",
|
|
302
|
+
`Raw temporal result row ${v} is missing column "${f}".`,
|
|
303
|
+
{ fieldId: u.id, columnKey: f }
|
|
304
|
+
);
|
|
305
|
+
l.set(f, F), p.set(u.id, F);
|
|
306
|
+
}
|
|
307
|
+
const i = {
|
|
308
|
+
activatedColumnKeys: new Set(l.keys()),
|
|
309
|
+
byColumnKey: l,
|
|
310
|
+
byFieldId: p
|
|
311
|
+
};
|
|
312
|
+
return a.length === 0 ? { kind: "loaded_empty", presentation: i } : { kind: "loaded_valid", presentation: i };
|
|
313
|
+
} catch (n) {
|
|
314
|
+
return T(
|
|
315
|
+
n,
|
|
316
|
+
new m(
|
|
317
|
+
"invalid_raw_temporal_metadata",
|
|
318
|
+
"Activated raw temporal result metadata is invalid."
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function X(e) {
|
|
324
|
+
var r, o, n;
|
|
325
|
+
const a = e.effectiveCardConfig ?? e.card.config, t = R(
|
|
326
|
+
e.card,
|
|
327
|
+
a
|
|
328
|
+
);
|
|
329
|
+
if (e.card.type === "detailTable" && t === "config") {
|
|
330
|
+
const s = !!((r = e.columns) != null && r.some((l) => l.rawTemporal));
|
|
331
|
+
return s && e.records !== void 0 && !e.columnKeyMap ? {
|
|
332
|
+
kind: "invalid",
|
|
333
|
+
error: new m(
|
|
334
|
+
"missing_raw_temporal_result_contract",
|
|
335
|
+
"Activated raw temporal detail results require records, columns, and columnKeyMap atomically."
|
|
336
|
+
)
|
|
337
|
+
} : e.records !== void 0 && !s ? { kind: "inactive" } : K(
|
|
338
|
+
H({
|
|
339
|
+
cardType: e.card.type,
|
|
340
|
+
resultOwner: t,
|
|
341
|
+
effectiveCardConfig: a,
|
|
342
|
+
result: e.records === void 0 || !e.columns || !e.columnKeyMap ? void 0 : {
|
|
343
|
+
records: e.records,
|
|
344
|
+
columns: e.columns,
|
|
345
|
+
columnKeyMap: e.columnKeyMap
|
|
346
|
+
},
|
|
347
|
+
preferences: e.preferences,
|
|
348
|
+
calendar: e.calendar
|
|
349
|
+
}),
|
|
350
|
+
e
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
return K(
|
|
354
|
+
G({
|
|
355
|
+
resultOwner: t,
|
|
356
|
+
sql: e.card.sql,
|
|
357
|
+
normalizedPython: M(
|
|
358
|
+
e.card.python || ""
|
|
359
|
+
),
|
|
360
|
+
records: e.records,
|
|
361
|
+
columns: e.columns,
|
|
362
|
+
columnSettings: (n = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : n.columnSettingsMap,
|
|
363
|
+
preferences: e.preferences,
|
|
364
|
+
calendar: e.calendar
|
|
365
|
+
}),
|
|
366
|
+
e
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
function ue(e) {
|
|
370
|
+
var r, o, n;
|
|
371
|
+
const a = e.effectiveCardConfig ?? e.card.config, t = R(
|
|
372
|
+
e.card,
|
|
373
|
+
a
|
|
374
|
+
);
|
|
375
|
+
return e.card.type === "detailTable" && t === "config" ? !!((r = e.columns) != null && r.some((s) => s.rawTemporal)) : I(e) ? Object.values(
|
|
376
|
+
((n = (o = e.card.preferences) == null ? void 0 : o.tablePrefs) == null ? void 0 : n.columnSettingsMap) || {}
|
|
377
|
+
).some(
|
|
378
|
+
(s) => {
|
|
379
|
+
var l;
|
|
380
|
+
return s.type === "date" && !((l = s.dateFormat) != null && l.useRelativeTime);
|
|
381
|
+
}
|
|
382
|
+
) : !1;
|
|
383
|
+
}
|
|
384
|
+
function K(e, a) {
|
|
385
|
+
if (!a.executionSnapshot || e.kind === "inactive" || e.kind === "loading" || e.kind === "invalid")
|
|
386
|
+
return e;
|
|
387
|
+
if (!a.dashboardId)
|
|
388
|
+
return {
|
|
389
|
+
kind: "invalid",
|
|
390
|
+
error: new m(
|
|
391
|
+
"missing_raw_temporal_result_contract",
|
|
392
|
+
"A dashboard ID is required to resolve the captured raw temporal presentation."
|
|
393
|
+
)
|
|
394
|
+
};
|
|
395
|
+
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
396
|
+
for (const o of e.presentation.activatedColumnKeys) {
|
|
397
|
+
const n = E({
|
|
398
|
+
snapshot: a.executionSnapshot,
|
|
399
|
+
scope: {
|
|
400
|
+
dashboardId: a.dashboardId,
|
|
401
|
+
cardId: a.card.id,
|
|
402
|
+
...a.attachmentIndex !== void 0 ? { attachmentIndex: a.attachmentIndex } : {}
|
|
403
|
+
},
|
|
404
|
+
target: { kind: "column", columnKey: o }
|
|
405
|
+
});
|
|
406
|
+
if (!n)
|
|
407
|
+
return {
|
|
408
|
+
kind: "invalid",
|
|
409
|
+
error: new O(o)
|
|
410
|
+
};
|
|
411
|
+
const s = e.presentation.byColumnKey.get(o);
|
|
412
|
+
if (!s) continue;
|
|
413
|
+
const l = {
|
|
414
|
+
...s,
|
|
415
|
+
format: n,
|
|
416
|
+
formatValue: g({
|
|
417
|
+
metadata: s.metadata,
|
|
418
|
+
format: n
|
|
419
|
+
})
|
|
420
|
+
};
|
|
421
|
+
t.set(s.columnKey, l), s.fieldId && r.set(s.fieldId, l);
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
...e,
|
|
425
|
+
presentation: {
|
|
426
|
+
activatedColumnKeys: e.presentation.activatedColumnKeys,
|
|
427
|
+
byColumnKey: t,
|
|
428
|
+
byFieldId: r
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function G(e) {
|
|
433
|
+
var t, r;
|
|
434
|
+
if (e.resultOwner !== "freeform" || !((t = e.sql) != null && t.trim()) || (r = e.normalizedPython) != null && r.trim())
|
|
435
|
+
return { kind: "inactive" };
|
|
436
|
+
const a = Object.entries(
|
|
437
|
+
e.columnSettings || {}
|
|
438
|
+
).filter(
|
|
439
|
+
([, o]) => {
|
|
440
|
+
var n;
|
|
441
|
+
return o.type === "date" && !((n = o.dateFormat) != null && n.useRelativeTime);
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
if (a.length === 0) return { kind: "inactive" };
|
|
445
|
+
if (!e.records) return { kind: "loading" };
|
|
446
|
+
try {
|
|
447
|
+
const o = /* @__PURE__ */ new Map(), n = new Set(
|
|
448
|
+
a.map(([i]) => i)
|
|
449
|
+
), s = /* @__PURE__ */ new Map(), l = [...e.columns || []];
|
|
450
|
+
for (const [i, d] of a) {
|
|
451
|
+
const _ = D(
|
|
452
|
+
d.dateFormat
|
|
453
|
+
);
|
|
454
|
+
if (!_) continue;
|
|
455
|
+
const c = q({
|
|
456
|
+
columnKey: i,
|
|
457
|
+
values: e.records.map((w) => {
|
|
458
|
+
if (!Object.prototype.hasOwnProperty.call(w, i))
|
|
459
|
+
throw new m(
|
|
460
|
+
"missing_raw_temporal_result_contract",
|
|
461
|
+
`Declared SQL temporal column "${i}" is absent from a physical result row.`,
|
|
462
|
+
{ columnKey: i }
|
|
463
|
+
);
|
|
464
|
+
const y = w[i];
|
|
465
|
+
return y === null || typeof y == "string" ? y : String(y);
|
|
466
|
+
})
|
|
467
|
+
});
|
|
468
|
+
if (s.set(i, c), c.status !== "classified") continue;
|
|
469
|
+
let u = l.findIndex(
|
|
470
|
+
(w) => w.key === i
|
|
471
|
+
);
|
|
472
|
+
if (e.columns && u < 0)
|
|
473
|
+
throw new m(
|
|
474
|
+
"missing_raw_temporal_result_contract",
|
|
475
|
+
`Classified SQL temporal column "${i}" is absent from result columns.`,
|
|
476
|
+
{ columnKey: i }
|
|
477
|
+
);
|
|
478
|
+
u < 0 && (u = l.length, l.push({
|
|
479
|
+
key: i,
|
|
480
|
+
name: i,
|
|
481
|
+
label: i,
|
|
482
|
+
role: "dimension",
|
|
483
|
+
dataType: "string"
|
|
484
|
+
}));
|
|
485
|
+
const h = {
|
|
486
|
+
...l[u],
|
|
487
|
+
role: "date",
|
|
488
|
+
dataType: c.metadata.valueKind === "date" ? "date" : "datetime",
|
|
489
|
+
rawTemporal: c.metadata
|
|
490
|
+
};
|
|
491
|
+
S(h, {
|
|
492
|
+
metadataRequired: !0
|
|
493
|
+
}), l[u] = h;
|
|
494
|
+
const f = b({
|
|
495
|
+
format: _,
|
|
496
|
+
preferences: e.preferences,
|
|
497
|
+
calendar: e.calendar
|
|
498
|
+
});
|
|
499
|
+
o.set(i, {
|
|
500
|
+
columnKey: i,
|
|
501
|
+
metadata: c.metadata,
|
|
502
|
+
format: f,
|
|
503
|
+
formatValue: g({
|
|
504
|
+
metadata: c.metadata,
|
|
505
|
+
format: f
|
|
506
|
+
})
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
const p = {
|
|
510
|
+
...B(),
|
|
511
|
+
activatedColumnKeys: n,
|
|
512
|
+
byColumnKey: o
|
|
513
|
+
};
|
|
514
|
+
return e.records.length === 0 ? {
|
|
515
|
+
kind: "loaded_empty",
|
|
516
|
+
presentation: p,
|
|
517
|
+
adaptedColumns: l,
|
|
518
|
+
sqlClassifications: s
|
|
519
|
+
} : {
|
|
520
|
+
kind: "loaded_valid",
|
|
521
|
+
presentation: p,
|
|
522
|
+
adaptedColumns: l,
|
|
523
|
+
sqlClassifications: s
|
|
524
|
+
};
|
|
525
|
+
} catch (o) {
|
|
526
|
+
return T(
|
|
527
|
+
o,
|
|
528
|
+
new m(
|
|
529
|
+
"invalid_raw_temporal_format",
|
|
530
|
+
"Declared SQL raw temporal presentation is invalid."
|
|
531
|
+
)
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function fe(e) {
|
|
536
|
+
if (e.value !== null && typeof e.value != "string")
|
|
537
|
+
return {
|
|
538
|
+
value: e.value,
|
|
539
|
+
label: String(e.value),
|
|
540
|
+
result: {
|
|
541
|
+
ok: !1,
|
|
542
|
+
text: String(e.value),
|
|
543
|
+
diagnostic: {
|
|
544
|
+
code: "invalid_raw_temporal_value",
|
|
545
|
+
message: `Raw temporal column "${e.presentation.columnKey}" must contain a string or null.`
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const a = e.presentation.formatValue(e.value);
|
|
550
|
+
return { value: e.value, label: a.text, result: a };
|
|
551
|
+
}
|
|
552
|
+
function pe(e) {
|
|
553
|
+
if (!e.result || typeof e.result != "object") return !1;
|
|
554
|
+
const a = e.result;
|
|
555
|
+
if (e.expectedResultOwner !== void 0 && a.resultOwner !== e.expectedResultOwner || !Array.isArray(a.records)) return !1;
|
|
556
|
+
const t = X({
|
|
557
|
+
card: e.card,
|
|
558
|
+
effectiveCardConfig: e.effectiveCardConfig,
|
|
559
|
+
records: a.records,
|
|
560
|
+
columns: a.columns,
|
|
561
|
+
columnKeyMap: a.columnKeyMap,
|
|
562
|
+
preferences: A,
|
|
563
|
+
calendar: { tz: "UTC" }
|
|
564
|
+
});
|
|
565
|
+
return t.kind === "inactive" || t.kind === "loaded_empty" || t.kind === "loaded_valid";
|
|
566
|
+
}
|
|
567
|
+
export {
|
|
568
|
+
m as R,
|
|
569
|
+
se as a,
|
|
570
|
+
le as b,
|
|
571
|
+
U as c,
|
|
572
|
+
D as d,
|
|
573
|
+
H as e,
|
|
574
|
+
X as f,
|
|
575
|
+
ue as g,
|
|
576
|
+
ie as h,
|
|
577
|
+
pe as i,
|
|
578
|
+
ce as j,
|
|
579
|
+
I as k,
|
|
580
|
+
de as l,
|
|
581
|
+
Q as m,
|
|
582
|
+
fe as p,
|
|
583
|
+
j as r,
|
|
584
|
+
me as v
|
|
585
|
+
};
|