react-semaphor 0.1.540 → 0.1.542
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 +50 -45
- package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
- package/dist/chunks/{assistant-chat-ya7xopaC.js → assistant-chat-oHF5lTjA.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-ChIyd_-L.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-briefing-launcher-DJI-zfEq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
- package/dist/chunks/{dashboard-controls-Dh7HqoKy.js → dashboard-controls-CIn22Qgp.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-BnmlB71h.js → dashboard-json-ZUYsIExq.js} +4 -4
- package/dist/chunks/{dashboard-B6Bithfl.js → dashboard-s5WJBcK8.js} +1 -1
- package/dist/chunks/{document-dashboard-inputs-BrYYlRVo.js → document-dashboard-inputs-C6MJVyoI.js} +2357 -4948
- package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CydOkSko.js → edit-dashboard-visual-DLdereA7.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/index-CV5rHq5D.js +2673 -0
- 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-BSAqPpHt.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-BBlAfBA0.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
- package/dist/chunks/{report-preferences-dialog-neMDolLg.js → report-preferences-dialog-MRUWpMcJ.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CCrLpfSQ.js → saved-dashboard-context-DjPqgFly.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator--4DWtVBu.js → semaphor-ready-indicator-BWSpRsPj.js} +38555 -40449
- package/dist/chunks/{shelf-drop-preview-context-CpdB5ois.js → shelf-drop-preview-context-CQbFLm3q.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-BHSnuZHd.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-8g6Zhphh.js → use-create-flow-overlay-state-BJDNqdOh.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 +399 -380
- 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 -238
- package/dist/index.js +174 -175
- package/dist/pdf-export-policy/index.js +20 -10
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +23 -0
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +6 -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-card.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/query-context/card-server-request.d.ts +5 -1
- package/dist/types/lib/types/common-types.d.ts +7 -0
- package/dist/types/lib/types/explorer-types.d.ts +8 -2
- 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/card-query-request.d.ts +20 -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/attachment-filter-line.d.ts +14 -0
- 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/filter-line.d.ts +7 -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 +3 -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/pdf-export-policy.d.ts +9 -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-BjK9YfMI.js +0 -979
- 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/index-CqMiAkay.js +0 -3164
- 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
|
@@ -1,1076 +0,0 @@
|
|
|
1
|
-
var ce = Object.defineProperty;
|
|
2
|
-
var le = (e, t, n) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var U = (e, t, n) => le(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { B as N, l as B, E as M, ad as ue, I as q, a2 as fe, U as me, V as pe, am as H, u as te, aa as ge } from "./validators-Ej1DdCXa.js";
|
|
5
|
-
import "./matrix-operation-contract-B8PBF1Gd.js";
|
|
6
|
-
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
7
|
-
import { ZodError as he } from "zod";
|
|
8
|
-
import { o as be, b as ye, l as Ie, R as ne, U as ie, y as ve, X as _e, V as W, W as De, E as Fe, C as Te, Q as $e, O as ke } from "./calculated-field-identity-DcBS2NPP.js";
|
|
9
|
-
import { C as P } from "./common-types-CUf03Htv.js";
|
|
10
|
-
import { a as oe } from "./matrix-card-CJn1hB5V.js";
|
|
11
|
-
const J = /\[\[\s*param\.([A-Za-z0-9_.-]+)\s*\]\]/g, K = /\bparam\s*\(\s*(['"])([^'"]+)\1/g;
|
|
12
|
-
function Se(e) {
|
|
13
|
-
const t = [];
|
|
14
|
-
let n = 0;
|
|
15
|
-
for (; n < e.length; ) {
|
|
16
|
-
const o = e.indexOf("{{", n), i = e.indexOf("{%", n);
|
|
17
|
-
let r = -1, a = "";
|
|
18
|
-
if (o === -1 ? (r = i, a = "%}") : i === -1 || o < i ? (r = o, a = "}}") : (r = i, a = "%}"), r === -1)
|
|
19
|
-
break;
|
|
20
|
-
const s = e.indexOf(a, r + 2);
|
|
21
|
-
if (s === -1) {
|
|
22
|
-
n = r + 2;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
t.push(e.slice(r + 2, s)), n = s + 2;
|
|
26
|
-
}
|
|
27
|
-
return t;
|
|
28
|
-
}
|
|
29
|
-
function re(e) {
|
|
30
|
-
var o, i;
|
|
31
|
-
if (!e)
|
|
32
|
-
return [];
|
|
33
|
-
const t = /* @__PURE__ */ new Set();
|
|
34
|
-
let n;
|
|
35
|
-
for (J.lastIndex = 0; (n = J.exec(e)) !== null; ) {
|
|
36
|
-
const r = (o = n[1]) == null ? void 0 : o.trim();
|
|
37
|
-
r && t.add(r);
|
|
38
|
-
}
|
|
39
|
-
for (const r of Se(e))
|
|
40
|
-
for (K.lastIndex = 0; (n = K.exec(r)) !== null; ) {
|
|
41
|
-
const a = (i = n[2]) == null ? void 0 : i.trim();
|
|
42
|
-
a && t.add(a);
|
|
43
|
-
}
|
|
44
|
-
return Array.from(t);
|
|
45
|
-
}
|
|
46
|
-
function at(e) {
|
|
47
|
-
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
48
|
-
for (const o of e.controlBindings || [])
|
|
49
|
-
t.add(o.controlId), o.target === "sql_param" && n.set(o.paramId, o.controlId);
|
|
50
|
-
for (const o of re(e.sql))
|
|
51
|
-
t.add(n.get(o) ?? o);
|
|
52
|
-
return Array.from(t);
|
|
53
|
-
}
|
|
54
|
-
function st(e) {
|
|
55
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
56
|
-
for (const o of e.controlBindings || [])
|
|
57
|
-
o.target === "sql_param" && n.set(o.paramId, o.controlId);
|
|
58
|
-
for (const o of re(e.sql))
|
|
59
|
-
t.set(o, {
|
|
60
|
-
paramId: o,
|
|
61
|
-
controlId: n.get(o) ?? o
|
|
62
|
-
});
|
|
63
|
-
return Array.from(t.values());
|
|
64
|
-
}
|
|
65
|
-
function R(e) {
|
|
66
|
-
return (e == null ? void 0 : e.trim()) || void 0;
|
|
67
|
-
}
|
|
68
|
-
function X(e) {
|
|
69
|
-
return e.split(".").at(-1) || e;
|
|
70
|
-
}
|
|
71
|
-
function Q(e, t) {
|
|
72
|
-
var p, d;
|
|
73
|
-
const n = R(t);
|
|
74
|
-
if (!n) return;
|
|
75
|
-
const o = X(n), i = R((p = e.fieldMeta) == null ? void 0 : p.name);
|
|
76
|
-
if (i && i !== n && i !== o)
|
|
77
|
-
return;
|
|
78
|
-
const r = R(
|
|
79
|
-
(d = e.fieldMeta) == null ? void 0 : d.qualifiedFieldName
|
|
80
|
-
);
|
|
81
|
-
if (r && X(r) !== o)
|
|
82
|
-
return;
|
|
83
|
-
const a = n.includes(".") ? n : void 0, s = r != null && r.includes(".") ? r : void 0;
|
|
84
|
-
if (!(a && s && a !== s))
|
|
85
|
-
return {
|
|
86
|
-
leafName: o,
|
|
87
|
-
...a || s ? {
|
|
88
|
-
qualifiedFieldName: a || s
|
|
89
|
-
} : {}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function Y(e, t) {
|
|
93
|
-
return Q(e, t) || Q({}, t);
|
|
94
|
-
}
|
|
95
|
-
function Z({
|
|
96
|
-
source: e,
|
|
97
|
-
sourceFieldName: t,
|
|
98
|
-
target: n,
|
|
99
|
-
targetFieldName: o
|
|
100
|
-
}) {
|
|
101
|
-
const i = Y(
|
|
102
|
-
e,
|
|
103
|
-
t
|
|
104
|
-
), r = Y(
|
|
105
|
-
n,
|
|
106
|
-
o
|
|
107
|
-
);
|
|
108
|
-
return !i || !r || i.leafName !== r.leafName ? !1 : r.qualifiedFieldName ? i.qualifiedFieldName === r.qualifiedFieldName : !0;
|
|
109
|
-
}
|
|
110
|
-
function E(e, t) {
|
|
111
|
-
var i, r;
|
|
112
|
-
const n = xe(e);
|
|
113
|
-
if (n) return n;
|
|
114
|
-
const o = (r = (i = e == null ? void 0 : e.fieldMeta) == null ? void 0 : i.nativeDataType) == null ? void 0 : r.trim();
|
|
115
|
-
if (z(e == null ? void 0 : e.fieldMeta, t) && o && o !== "date" && o !== "datetime")
|
|
116
|
-
return o;
|
|
117
|
-
}
|
|
118
|
-
function xe(e) {
|
|
119
|
-
var n;
|
|
120
|
-
const t = (n = e == null ? void 0 : e.nativeDataType) == null ? void 0 : n.trim();
|
|
121
|
-
return t && t !== "date" && t !== "datetime" ? t : void 0;
|
|
122
|
-
}
|
|
123
|
-
function z(e, t) {
|
|
124
|
-
var a, s;
|
|
125
|
-
const n = t.trim();
|
|
126
|
-
if (!n) return !1;
|
|
127
|
-
const o = n.split(".").at(-1), i = (a = e == null ? void 0 : e.qualifiedFieldName) == null ? void 0 : a.trim();
|
|
128
|
-
if (i && !(i === n || !i.includes(".") && i === o))
|
|
129
|
-
return !1;
|
|
130
|
-
const r = (s = e == null ? void 0 : e.name) == null ? void 0 : s.trim();
|
|
131
|
-
return r && r !== n && r !== o ? !1 : !!(i || r);
|
|
132
|
-
}
|
|
133
|
-
function Ne({
|
|
134
|
-
fieldName: e,
|
|
135
|
-
definition: t,
|
|
136
|
-
value: n
|
|
137
|
-
}) {
|
|
138
|
-
if ((t == null ? void 0 : t.column) === e) {
|
|
139
|
-
const o = E(t, e);
|
|
140
|
-
if (o)
|
|
141
|
-
return o;
|
|
142
|
-
}
|
|
143
|
-
return (n == null ? void 0 : n.name) === e ? E(n, e) : void 0;
|
|
144
|
-
}
|
|
145
|
-
function Me({
|
|
146
|
-
definition: e,
|
|
147
|
-
value: t,
|
|
148
|
-
sourceValue: n = t
|
|
149
|
-
}) {
|
|
150
|
-
const o = e && Z({
|
|
151
|
-
source: e,
|
|
152
|
-
sourceFieldName: e.column,
|
|
153
|
-
target: t,
|
|
154
|
-
targetFieldName: t.name
|
|
155
|
-
}) ? e : void 0, i = n && Z({
|
|
156
|
-
source: n,
|
|
157
|
-
sourceFieldName: n.name,
|
|
158
|
-
target: t,
|
|
159
|
-
targetFieldName: t.name
|
|
160
|
-
}) ? n : void 0, r = (o ? E(o, o.column) : void 0) || (i ? E(i, i.name) : void 0);
|
|
161
|
-
return ae({
|
|
162
|
-
carrier: t,
|
|
163
|
-
nativeDataType: r,
|
|
164
|
-
projectNestedNativeDataType: z(
|
|
165
|
-
t.fieldMeta,
|
|
166
|
-
t.name
|
|
167
|
-
)
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function dt({
|
|
171
|
-
filterDefinitions: e,
|
|
172
|
-
filterValues: t
|
|
173
|
-
}) {
|
|
174
|
-
if (!(e != null && e.length) || !t.length)
|
|
175
|
-
return t;
|
|
176
|
-
const n = new Map(
|
|
177
|
-
e.map((r) => [r.id, r])
|
|
178
|
-
);
|
|
179
|
-
let o = !1;
|
|
180
|
-
const i = t.map((r) => {
|
|
181
|
-
if (typeof r.name != "string" || !r.name.trim())
|
|
182
|
-
return r;
|
|
183
|
-
const a = n.get(r.filterId);
|
|
184
|
-
if (!a)
|
|
185
|
-
return r;
|
|
186
|
-
const s = Me({
|
|
187
|
-
definition: a,
|
|
188
|
-
value: r
|
|
189
|
-
});
|
|
190
|
-
return o || (o = s !== r), s;
|
|
191
|
-
});
|
|
192
|
-
return o ? i : t;
|
|
193
|
-
}
|
|
194
|
-
function ct(e) {
|
|
195
|
-
const t = Ne({
|
|
196
|
-
fieldName: e.column,
|
|
197
|
-
definition: e
|
|
198
|
-
});
|
|
199
|
-
return ae({
|
|
200
|
-
carrier: e,
|
|
201
|
-
nativeDataType: t,
|
|
202
|
-
projectNestedNativeDataType: z(
|
|
203
|
-
e.fieldMeta,
|
|
204
|
-
e.column
|
|
205
|
-
)
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function ae({
|
|
209
|
-
carrier: e,
|
|
210
|
-
nativeDataType: t,
|
|
211
|
-
projectNestedNativeDataType: n
|
|
212
|
-
}) {
|
|
213
|
-
var d;
|
|
214
|
-
const o = (d = e.fieldMeta) == null ? void 0 : d.nativeDataType;
|
|
215
|
-
if (t) {
|
|
216
|
-
if (e.nativeDataType === t && (!e.fieldMeta || (n ? o === t : !o)))
|
|
217
|
-
return e;
|
|
218
|
-
const { nativeDataType: x, ...f } = e.fieldMeta || {};
|
|
219
|
-
return {
|
|
220
|
-
...e,
|
|
221
|
-
nativeDataType: t,
|
|
222
|
-
...e.fieldMeta ? {
|
|
223
|
-
fieldMeta: n ? {
|
|
224
|
-
...e.fieldMeta,
|
|
225
|
-
nativeDataType: t
|
|
226
|
-
} : f
|
|
227
|
-
} : {}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
if (e.nativeDataType === void 0 && o === void 0)
|
|
231
|
-
return e;
|
|
232
|
-
const {
|
|
233
|
-
nativeDataType: i,
|
|
234
|
-
fieldMeta: r,
|
|
235
|
-
...a
|
|
236
|
-
} = e, { nativeDataType: s, ...p } = r || {};
|
|
237
|
-
return {
|
|
238
|
-
...a,
|
|
239
|
-
...r ? { fieldMeta: p } : {}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function ee(e) {
|
|
243
|
-
const t = /* @__PURE__ */ new Set();
|
|
244
|
-
for (const n of [e.name, e.sourceField]) {
|
|
245
|
-
if (!n) continue;
|
|
246
|
-
const o = N(n);
|
|
247
|
-
if (!o) continue;
|
|
248
|
-
t.add(o);
|
|
249
|
-
const i = o.split("."), r = i[i.length - 1];
|
|
250
|
-
r && t.add(r);
|
|
251
|
-
}
|
|
252
|
-
return t;
|
|
253
|
-
}
|
|
254
|
-
function se(e, t) {
|
|
255
|
-
const n = B(e), o = B(t);
|
|
256
|
-
return n === "unknown" || o === "unknown" ? !1 : (n === "date" || n === "datetime") && (o === "date" || o === "datetime") ? !0 : n === o;
|
|
257
|
-
}
|
|
258
|
-
function Ce(e, t) {
|
|
259
|
-
return M(e.field.source, t.field.source) && N(e.field.name) === N(t.field.name) && N(e.field.sourceField || e.field.name) === N(t.field.sourceField || t.field.name);
|
|
260
|
-
}
|
|
261
|
-
function Ae(e, t) {
|
|
262
|
-
if (e.kind !== "field") return !1;
|
|
263
|
-
const n = ee(t), o = ee(e.field);
|
|
264
|
-
return se(t.dataType, e.field.dataType) && [...o].some((i) => n.has(i));
|
|
265
|
-
}
|
|
266
|
-
function lt(e) {
|
|
267
|
-
const t = e.candidates.filter(
|
|
268
|
-
(n) => Ae(
|
|
269
|
-
n,
|
|
270
|
-
e.logicalValueField
|
|
271
|
-
)
|
|
272
|
-
);
|
|
273
|
-
return t.length === 1 ? { status: "matched", target: t[0] } : t.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
|
|
274
|
-
}
|
|
275
|
-
function ut(e) {
|
|
276
|
-
const t = [];
|
|
277
|
-
for (const n of e.acceptedTargets)
|
|
278
|
-
!se(
|
|
279
|
-
e.logicalValueField.dataType,
|
|
280
|
-
n.field.dataType
|
|
281
|
-
) || t.some(
|
|
282
|
-
(o) => Ce(o, n)
|
|
283
|
-
) || t.push(n);
|
|
284
|
-
return t.length === 1 ? { status: "matched", target: t[0] } : t.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
|
|
285
|
-
}
|
|
286
|
-
function we(e) {
|
|
287
|
-
return (e.field.sourceField || e.field.name).trim() || void 0;
|
|
288
|
-
}
|
|
289
|
-
function ft(e) {
|
|
290
|
-
if (e.inventory.kind !== "sql" || e.target.kind !== "field")
|
|
291
|
-
return { status: "ineligible" };
|
|
292
|
-
const t = be(
|
|
293
|
-
e.inventory,
|
|
294
|
-
e.target.field.source
|
|
295
|
-
), n = we(e.target);
|
|
296
|
-
if (!t || !n) return { status: "ineligible" };
|
|
297
|
-
if (t.executionTable) {
|
|
298
|
-
const a = [
|
|
299
|
-
t.executionTable.databaseName,
|
|
300
|
-
t.executionTable.schemaName,
|
|
301
|
-
t.executionTable.tableName,
|
|
302
|
-
n
|
|
303
|
-
].filter(Boolean).join(".");
|
|
304
|
-
return {
|
|
305
|
-
status: "eligible",
|
|
306
|
-
source: t.source,
|
|
307
|
-
executionIdentifier: a
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
if (e.inventory.pinnedCatalogSources.length !== 1)
|
|
311
|
-
return { status: "ineligible" };
|
|
312
|
-
const o = N(n), i = (e.candidateTargets || []).filter(
|
|
313
|
-
(a) => N(
|
|
314
|
-
a.field.sourceField || a.field.name
|
|
315
|
-
) === o
|
|
316
|
-
), r = [];
|
|
317
|
-
for (const a of i)
|
|
318
|
-
r.some(
|
|
319
|
-
(s) => M(s, a.field.source)
|
|
320
|
-
) || r.push(a.field.source);
|
|
321
|
-
return r.length > 1 ? { status: "ineligible" } : {
|
|
322
|
-
status: "eligible",
|
|
323
|
-
source: t.source,
|
|
324
|
-
executionIdentifier: n
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
const Oe = Object.freeze({ mode: "all_applicable" });
|
|
328
|
-
function Ee(e) {
|
|
329
|
-
if (e === void 0)
|
|
330
|
-
return { ok: !0, dependencies: { ...Oe } };
|
|
331
|
-
const t = ue(e, "dashboard");
|
|
332
|
-
if (!t.ok)
|
|
333
|
-
return {
|
|
334
|
-
ok: !1,
|
|
335
|
-
error: "Invalid dashboard option dependency policy.",
|
|
336
|
-
issues: t.errors.map((o) => o.message)
|
|
337
|
-
};
|
|
338
|
-
const n = e;
|
|
339
|
-
switch (n.mode) {
|
|
340
|
-
case "independent":
|
|
341
|
-
return { ok: !0, dependencies: { mode: "independent" } };
|
|
342
|
-
case "explicit":
|
|
343
|
-
return {
|
|
344
|
-
ok: !0,
|
|
345
|
-
dependencies: {
|
|
346
|
-
mode: "explicit",
|
|
347
|
-
includeInputIds: [...n.includeInputIds || []]
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
case "all_applicable":
|
|
351
|
-
return {
|
|
352
|
-
ok: !0,
|
|
353
|
-
dependencies: {
|
|
354
|
-
mode: "all_applicable",
|
|
355
|
-
...n.excludeInputIds ? { excludeInputIds: [...n.excludeInputIds] } : {}
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
default:
|
|
359
|
-
return {
|
|
360
|
-
ok: !1,
|
|
361
|
-
error: "Invalid dashboard option dependency policy.",
|
|
362
|
-
issues: ["Dashboard option dependencies must declare a mode."]
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function Re(e) {
|
|
367
|
-
if (e === void 0) return { ok: !0, population: void 0 };
|
|
368
|
-
const t = { ok: !1, error: "Invalid option population." };
|
|
369
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return t;
|
|
370
|
-
const n = e;
|
|
371
|
-
if (n.kind === "option_source")
|
|
372
|
-
return { ok: !0, population: { kind: "option_source" } };
|
|
373
|
-
if (n.kind !== "related_population") return t;
|
|
374
|
-
const o = n.baseSource;
|
|
375
|
-
if (!o || o.kind !== "semantic" || !q(o))
|
|
376
|
-
return t;
|
|
377
|
-
const i = n.relationshipHint;
|
|
378
|
-
return i !== void 0 && (!i || typeof i != "object" || i.relationshipIds !== void 0 && (!Array.isArray(i.relationshipIds) || i.relationshipIds.some(
|
|
379
|
-
(r) => typeof r != "string" || !r.trim()
|
|
380
|
-
))) ? t : {
|
|
381
|
-
ok: !0,
|
|
382
|
-
population: {
|
|
383
|
-
kind: "related_population",
|
|
384
|
-
baseSource: o,
|
|
385
|
-
...i ? { relationshipHint: i } : {}
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
function mt(e) {
|
|
390
|
-
const { dependencies: t } = e, n = /* @__PURE__ */ new Set([
|
|
391
|
-
e.targetInputId,
|
|
392
|
-
...t.excludeInputIds || []
|
|
393
|
-
]);
|
|
394
|
-
return t.mode === "independent" ? [] : t.mode === "explicit" ? (t.includeInputIds || []).filter(
|
|
395
|
-
(o) => !n.has(o)
|
|
396
|
-
) : e.peerInputIds.filter((o) => !n.has(o));
|
|
397
|
-
}
|
|
398
|
-
function pt(e, t, n) {
|
|
399
|
-
if (t === n) return e;
|
|
400
|
-
let o = !1;
|
|
401
|
-
const i = (a) => a != null && a.includes(t) ? (o = !0, Array.from(
|
|
402
|
-
new Set(a.map((s) => s === t ? n : s))
|
|
403
|
-
)) : a, r = e.map((a) => {
|
|
404
|
-
const s = a.optionDependencies;
|
|
405
|
-
if (!s) return a;
|
|
406
|
-
const p = i(s.includeInputIds), d = i(s.excludeInputIds);
|
|
407
|
-
return p === s.includeInputIds && d === s.excludeInputIds ? a : {
|
|
408
|
-
...a,
|
|
409
|
-
optionDependencies: {
|
|
410
|
-
...s,
|
|
411
|
-
...p ? { includeInputIds: p } : {},
|
|
412
|
-
...d ? { excludeInputIds: d } : {}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
});
|
|
416
|
-
return o ? r : e;
|
|
417
|
-
}
|
|
418
|
-
function gt(e, t) {
|
|
419
|
-
const n = Be(
|
|
420
|
-
e.dependencies,
|
|
421
|
-
t
|
|
422
|
-
);
|
|
423
|
-
return n === e.dependencies ? e : { ...e, dependencies: n };
|
|
424
|
-
}
|
|
425
|
-
function Be(e, t) {
|
|
426
|
-
if (!(t != null && t.length) || e.mode !== "explicit")
|
|
427
|
-
return e;
|
|
428
|
-
const n = new Set(e.includeInputIds || []), o = Array.from(new Set(t)).filter(
|
|
429
|
-
(i) => n.has(i)
|
|
430
|
-
);
|
|
431
|
-
return o.length ? { ...e, omitInputIds: o } : e;
|
|
432
|
-
}
|
|
433
|
-
class Pe extends Error {
|
|
434
|
-
constructor(n) {
|
|
435
|
-
super(n.map((o) => o.message).join(" "));
|
|
436
|
-
U(this, "issues");
|
|
437
|
-
this.name = "DashboardFilterMappingContractError", this.issues = n;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
const qe = {
|
|
441
|
-
string: !0,
|
|
442
|
-
number: !0,
|
|
443
|
-
boolean: !0,
|
|
444
|
-
date: !0,
|
|
445
|
-
datetime: !0
|
|
446
|
-
};
|
|
447
|
-
function I(e) {
|
|
448
|
-
return typeof e == "string" && e.trim().length > 0;
|
|
449
|
-
}
|
|
450
|
-
function b(e) {
|
|
451
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
452
|
-
}
|
|
453
|
-
function O(e) {
|
|
454
|
-
return Array.isArray(e) && e.every((t) => typeof t == "string");
|
|
455
|
-
}
|
|
456
|
-
function ze(e) {
|
|
457
|
-
if (!b(e)) return !1;
|
|
458
|
-
switch (e.kind) {
|
|
459
|
-
case "allSheets":
|
|
460
|
-
return e.sheetKinds === void 0 || O(e.sheetKinds) && e.sheetKinds.every(
|
|
461
|
-
(t) => t === "dashboard" || t === "document"
|
|
462
|
-
);
|
|
463
|
-
case "sheets":
|
|
464
|
-
return O(e.sheetIds);
|
|
465
|
-
case "cards":
|
|
466
|
-
return O(e.cardIds);
|
|
467
|
-
case "documentSections":
|
|
468
|
-
return I(e.sheetId) && O(e.sectionIds);
|
|
469
|
-
default:
|
|
470
|
-
return !1;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
function Le(e) {
|
|
474
|
-
return e === "shared" || e === "perSheet" || e === "perCard" || e === "perDocumentSection";
|
|
475
|
-
}
|
|
476
|
-
function je(e) {
|
|
477
|
-
return b(e) ? I(e.id) && I(e.column) && I(e.dataType) : !1;
|
|
478
|
-
}
|
|
479
|
-
function Ge(e, t, n, o) {
|
|
480
|
-
var s;
|
|
481
|
-
if (!b(t)) {
|
|
482
|
-
o.push({
|
|
483
|
-
code: "invalid_option_source",
|
|
484
|
-
path: n,
|
|
485
|
-
message: `${n} must be a semantic or physical option source.`,
|
|
486
|
-
inputId: e
|
|
487
|
-
});
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
const i = t.source, r = [
|
|
491
|
-
["labelField", t.labelField],
|
|
492
|
-
["valueField", t.valueField],
|
|
493
|
-
["searchField", t.searchField]
|
|
494
|
-
];
|
|
495
|
-
if (!b(i) || i.kind !== "semantic" && i.kind !== "physical" || !q(i) || !b(t.labelField) || !b(t.valueField) || t.searchField !== void 0 && !b(t.searchField) || t.disambiguationFields !== void 0 && (!Array.isArray(t.disambiguationFields) || !t.disambiguationFields.every(b))) {
|
|
496
|
-
o.push({
|
|
497
|
-
code: "invalid_option_source",
|
|
498
|
-
path: n,
|
|
499
|
-
message: `${n} must contain a valid semantic or physical source and field references.`,
|
|
500
|
-
inputId: e
|
|
501
|
-
});
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
for (const [p, d] of r)
|
|
505
|
-
d !== void 0 && b(d) && (!I(d.name) || d.source !== void 0 && !M(
|
|
506
|
-
d.source,
|
|
507
|
-
i
|
|
508
|
-
)) && o.push({
|
|
509
|
-
code: "invalid_option_source",
|
|
510
|
-
path: `${n}.${p}`,
|
|
511
|
-
message: `${n}.${p} must be a named field belonging to the declared option source.`,
|
|
512
|
-
inputId: e
|
|
513
|
-
});
|
|
514
|
-
for (const [p, d] of ((s = t.disambiguationFields) == null ? void 0 : s.entries()) || [])
|
|
515
|
-
(!b(d) || !I(d.name) || d.source !== void 0 && !M(
|
|
516
|
-
d.source,
|
|
517
|
-
i
|
|
518
|
-
)) && o.push({
|
|
519
|
-
code: "invalid_option_source",
|
|
520
|
-
path: `${n}.disambiguationFields[${p}]`,
|
|
521
|
-
message: `${n}.disambiguationFields[${p}] must be a named field belonging to the declared option source.`,
|
|
522
|
-
inputId: e
|
|
523
|
-
});
|
|
524
|
-
const a = t.valueField;
|
|
525
|
-
["string", "number", "boolean", "date", "datetime"].includes(
|
|
526
|
-
String(a.dataType)
|
|
527
|
-
) || o.push({
|
|
528
|
-
code: "invalid_option_source",
|
|
529
|
-
path: `${n}.valueField.dataType`,
|
|
530
|
-
message: `${n}.valueField.dataType must be a known option-value datatype.`,
|
|
531
|
-
inputId: e
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
function Ve(e, t, n) {
|
|
535
|
-
var o;
|
|
536
|
-
if (e.optionDependencies !== void 0) {
|
|
537
|
-
const i = Ee(e.optionDependencies);
|
|
538
|
-
i.ok ? b(e.optionDependencies) && e.optionDependencies.omitInputIds !== void 0 && n.push({
|
|
539
|
-
code: "invalid_option_dependencies",
|
|
540
|
-
path: `${t}.optionDependencies.omitInputIds`,
|
|
541
|
-
message: `${t}.optionDependencies cannot persist a browse override (omitInputIds).`,
|
|
542
|
-
inputId: e.id
|
|
543
|
-
}) : n.push({
|
|
544
|
-
code: "invalid_option_dependencies",
|
|
545
|
-
path: `${t}.optionDependencies`,
|
|
546
|
-
message: `${t}.optionDependencies ${i.issues.join("; ") || i.error}`,
|
|
547
|
-
inputId: e.id
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
if (e.optionPopulation !== void 0) {
|
|
551
|
-
const i = Re(e.optionPopulation);
|
|
552
|
-
i.ok ? ((o = i.population) == null ? void 0 : o.kind) === "related_population" && !Ue(e.optionSource) && n.push({
|
|
553
|
-
code: "invalid_option_population",
|
|
554
|
-
path: `${t}.optionPopulation`,
|
|
555
|
-
message: `${t}.optionPopulation related_population requires an authored semantic optionSource.`,
|
|
556
|
-
inputId: e.id
|
|
557
|
-
}) : n.push({
|
|
558
|
-
code: "invalid_option_population",
|
|
559
|
-
path: `${t}.optionPopulation`,
|
|
560
|
-
message: `${t}.optionPopulation must be option_source or a related_population with a complete semantic baseSource.`,
|
|
561
|
-
inputId: e.id
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
function Ue(e) {
|
|
566
|
-
return b(e) && b(e.source) && e.source.kind === "semantic";
|
|
567
|
-
}
|
|
568
|
-
function He(e, t, n, o, i, r) {
|
|
569
|
-
var d;
|
|
570
|
-
if (I(t.bindingId) || i.push({
|
|
571
|
-
code: "invalid_binding_id",
|
|
572
|
-
path: `${n}.bindingId`,
|
|
573
|
-
message: `${n}.bindingId must be an opaque non-empty id.`,
|
|
574
|
-
inputId: e,
|
|
575
|
-
cardId: t.cardId
|
|
576
|
-
}), ((d = t.target) == null ? void 0 : d.kind) !== "field") {
|
|
577
|
-
i.push({
|
|
578
|
-
code: "unsupported_target",
|
|
579
|
-
path: `${n}.target`,
|
|
580
|
-
message: `${n}.target must be one direct field target.`,
|
|
581
|
-
inputId: e,
|
|
582
|
-
cardId: t.cardId,
|
|
583
|
-
bindingId: t.bindingId
|
|
584
|
-
});
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
const a = t.target.field;
|
|
588
|
-
if (!I(a == null ? void 0 : a.name) || !a.source || a.source.kind !== "semantic" && a.source.kind !== "physical" || !q(a.source)) {
|
|
589
|
-
i.push({
|
|
590
|
-
code: "invalid_target_field",
|
|
591
|
-
path: `${n}.target.field`,
|
|
592
|
-
message: `${n}.target.field must have a name and a source-qualified semantic or physical identity.`,
|
|
593
|
-
inputId: e,
|
|
594
|
-
cardId: t.cardId,
|
|
595
|
-
bindingId: t.bindingId
|
|
596
|
-
});
|
|
597
|
-
return;
|
|
598
|
-
}
|
|
599
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
600
|
-
qe,
|
|
601
|
-
a.dataType
|
|
602
|
-
) || i.push({
|
|
603
|
-
code: "unknown_target_data_type",
|
|
604
|
-
path: `${n}.target.field.dataType`,
|
|
605
|
-
message: `${n}.target.field.dataType must be known.`,
|
|
606
|
-
inputId: e,
|
|
607
|
-
cardId: t.cardId,
|
|
608
|
-
bindingId: t.bindingId
|
|
609
|
-
}), a.sourceField !== void 0 && !I(a.sourceField) && i.push({
|
|
610
|
-
code: "invalid_target_field",
|
|
611
|
-
path: `${n}.target.field.sourceField`,
|
|
612
|
-
message: `${n}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,
|
|
613
|
-
inputId: e,
|
|
614
|
-
cardId: t.cardId,
|
|
615
|
-
bindingId: t.bindingId
|
|
616
|
-
}), !r) return;
|
|
617
|
-
const s = o.get(t.cardId);
|
|
618
|
-
if (!s) {
|
|
619
|
-
i.push({
|
|
620
|
-
code: "unknown_card",
|
|
621
|
-
path: `${n}.cardId`,
|
|
622
|
-
message: `${n}.cardId '${t.cardId}' does not exist.`,
|
|
623
|
-
inputId: e,
|
|
624
|
-
cardId: t.cardId,
|
|
625
|
-
bindingId: t.bindingId
|
|
626
|
-
});
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
const p = ye(s);
|
|
630
|
-
(p.kind === "unconfigured" || !Ie(p, a.source)) && i.push({
|
|
631
|
-
code: "unavailable_card_source",
|
|
632
|
-
path: `${n}.target.field.source`,
|
|
633
|
-
message: `${n}.target field source is not declared by card '${s.id}'.`,
|
|
634
|
-
inputId: e,
|
|
635
|
-
cardId: s.id,
|
|
636
|
-
bindingId: t.bindingId
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
function We(e, t, n, o, i, r) {
|
|
640
|
-
if (t === void 0) return;
|
|
641
|
-
if (!b(t) || t.kind !== "cardMappings" || !Array.isArray(t.cards)) {
|
|
642
|
-
i.push({
|
|
643
|
-
code: "invalid_application",
|
|
644
|
-
path: n,
|
|
645
|
-
message: `${n} must be a cardMappings application with a cards array.`,
|
|
646
|
-
inputId: e
|
|
647
|
-
});
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
const a = /* @__PURE__ */ new Set();
|
|
651
|
-
t.cards.forEach((s, p) => {
|
|
652
|
-
const d = `${n}.cards[${p}]`;
|
|
653
|
-
if (!I(s == null ? void 0 : s.cardId)) {
|
|
654
|
-
i.push({
|
|
655
|
-
code: "unknown_card",
|
|
656
|
-
path: `${d}.cardId`,
|
|
657
|
-
message: `${d}.cardId is required.`,
|
|
658
|
-
inputId: e
|
|
659
|
-
});
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
if (a.has(s.cardId)) {
|
|
663
|
-
i.push({
|
|
664
|
-
code: "duplicate_card_application",
|
|
665
|
-
path: `${d}.cardId`,
|
|
666
|
-
message: `${n} contains more than one entry for card '${s.cardId}'.`,
|
|
667
|
-
inputId: e,
|
|
668
|
-
cardId: s.cardId
|
|
669
|
-
});
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
if (a.add(s.cardId), r && !o.has(s.cardId)) {
|
|
673
|
-
i.push({
|
|
674
|
-
code: "unknown_card",
|
|
675
|
-
path: `${d}.cardId`,
|
|
676
|
-
message: `${d}.cardId '${s.cardId}' does not exist.`,
|
|
677
|
-
inputId: e,
|
|
678
|
-
cardId: s.cardId
|
|
679
|
-
});
|
|
680
|
-
return;
|
|
681
|
-
}
|
|
682
|
-
s.kind === "bound" ? He(
|
|
683
|
-
e,
|
|
684
|
-
s,
|
|
685
|
-
d,
|
|
686
|
-
o,
|
|
687
|
-
i,
|
|
688
|
-
r
|
|
689
|
-
) : s.kind !== "excluded" && i.push({
|
|
690
|
-
code: "invalid_application",
|
|
691
|
-
path: d,
|
|
692
|
-
message: `${d}.kind must be 'bound' or 'excluded'.`,
|
|
693
|
-
inputId: e,
|
|
694
|
-
cardId: s.cardId
|
|
695
|
-
});
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
function Je({
|
|
699
|
-
inputs: e,
|
|
700
|
-
dashboardFilters: t,
|
|
701
|
-
cards: n = [],
|
|
702
|
-
validateCardTargets: o = !1
|
|
703
|
-
}) {
|
|
704
|
-
const i = [], r = new Map(
|
|
705
|
-
(t || []).map((d) => [d.id, d])
|
|
706
|
-
), a = new Map(
|
|
707
|
-
o ? n.map((d) => [d.id, d]) : []
|
|
708
|
-
), s = [], p = /* @__PURE__ */ new Map();
|
|
709
|
-
return e != null && !Array.isArray(e) ? (i.push({
|
|
710
|
-
code: "invalid_input",
|
|
711
|
-
path: "dashboard.inputs",
|
|
712
|
-
message: "dashboard.inputs must be an array when present."
|
|
713
|
-
}), { ok: !1, inputs: s, issues: i }) : ((Array.isArray(e) ? e : []).forEach((d, x) => {
|
|
714
|
-
const f = `dashboard.inputs[${x}]`;
|
|
715
|
-
if (!b(d) || d.kind !== "filter" && d.kind !== "control" || !I(d.id) || !I(d.label) || !I(d.variableName) || !ze(d.scope) || !Le(d.runtimeScope)) {
|
|
716
|
-
i.push({
|
|
717
|
-
code: "invalid_input",
|
|
718
|
-
path: f,
|
|
719
|
-
message: `${f} must be a complete filter or control Dashboard Input envelope.`,
|
|
720
|
-
inputId: b(d) && typeof d.id == "string" ? d.id : void 0
|
|
721
|
-
});
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
if (d.kind === "control" && !b(d.control)) {
|
|
725
|
-
i.push({
|
|
726
|
-
code: "invalid_input",
|
|
727
|
-
path: `${f}.control`,
|
|
728
|
-
message: `${f}.control must be a control definition.`,
|
|
729
|
-
inputId: d.id
|
|
730
|
-
});
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
const l = d;
|
|
734
|
-
if (l.kind === "control") {
|
|
735
|
-
s.push(l);
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
const v = l.filter, F = l.filterReference, c = v !== void 0, m = !!F;
|
|
739
|
-
if (c && m) {
|
|
740
|
-
i.push({
|
|
741
|
-
code: "both_filter_definitions",
|
|
742
|
-
path: f,
|
|
743
|
-
message: `${f} must contain either filter or filterReference, not both.`,
|
|
744
|
-
inputId: l.id
|
|
745
|
-
});
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
if (!c && !m) {
|
|
749
|
-
i.push({
|
|
750
|
-
code: "missing_filter_definition",
|
|
751
|
-
path: f,
|
|
752
|
-
message: `${f} must contain filter or filterReference.`,
|
|
753
|
-
inputId: l.id
|
|
754
|
-
});
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
if (c && !je(v)) {
|
|
758
|
-
i.push({
|
|
759
|
-
code: "invalid_input",
|
|
760
|
-
path: `${f}.filter`,
|
|
761
|
-
message: `${f}.filter must be a complete dashboard filter definition.`,
|
|
762
|
-
inputId: l.id
|
|
763
|
-
});
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
let u, h;
|
|
767
|
-
if (c)
|
|
768
|
-
u = v, h = "embedded";
|
|
769
|
-
else {
|
|
770
|
-
if ((F == null ? void 0 : F.kind) !== "dashboardFilter") {
|
|
771
|
-
i.push({
|
|
772
|
-
code: "invalid_filter_reference",
|
|
773
|
-
path: `${f}.filterReference.kind`,
|
|
774
|
-
message: `${f}.filterReference.kind must be 'dashboardFilter'.`,
|
|
775
|
-
inputId: l.id
|
|
776
|
-
});
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
const k = typeof (F == null ? void 0 : F.filterId) == "string" ? F.filterId : void 0;
|
|
780
|
-
if (u = k ? r.get(k) : void 0, h = "dashboardFilter", !u) {
|
|
781
|
-
i.push({
|
|
782
|
-
code: "orphaned_filter_reference",
|
|
783
|
-
path: `${f}.filterReference.filterId`,
|
|
784
|
-
message: `${f}.filterReference cannot resolve dashboard filter '${k || ""}'.`,
|
|
785
|
-
inputId: l.id
|
|
786
|
-
});
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
if (u.kind === "global-date") {
|
|
790
|
-
i.push({
|
|
791
|
-
code: "global_date_reference",
|
|
792
|
-
path: `${f}.filterReference`,
|
|
793
|
-
message: `${f}.filterReference cannot reference the Global Date filter.`,
|
|
794
|
-
inputId: l.id
|
|
795
|
-
});
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
const S = p.get(u.id);
|
|
799
|
-
if (S) {
|
|
800
|
-
i.push({
|
|
801
|
-
code: "duplicate_filter_reference",
|
|
802
|
-
path: `${f}.filterReference.filterId`,
|
|
803
|
-
message: `${f}.filterReference duplicates dashboard filter '${u.id}' already owned by Dashboard Input '${S}'.`,
|
|
804
|
-
inputId: l.id
|
|
805
|
-
});
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
p.set(u.id, l.id);
|
|
809
|
-
}
|
|
810
|
-
if (!u) return;
|
|
811
|
-
if (l.forceSelection !== void 0 && typeof l.forceSelection != "boolean" && i.push({
|
|
812
|
-
code: "invalid_input",
|
|
813
|
-
path: `${f}.forceSelection`,
|
|
814
|
-
message: `${f}.forceSelection must be a boolean.`,
|
|
815
|
-
inputId: l.id
|
|
816
|
-
}), l.optionSource !== void 0 && Ge(
|
|
817
|
-
l.id,
|
|
818
|
-
l.optionSource,
|
|
819
|
-
`${f}.optionSource`,
|
|
820
|
-
i
|
|
821
|
-
), Ve(l, f, i), l.application && u.kind === "global-date") {
|
|
822
|
-
i.push({
|
|
823
|
-
code: "global_date_reference",
|
|
824
|
-
path: `${f}.application`,
|
|
825
|
-
message: `${f}.application cannot map the Global Date filter.`,
|
|
826
|
-
inputId: l.id
|
|
827
|
-
});
|
|
828
|
-
return;
|
|
829
|
-
}
|
|
830
|
-
l.application && l.scope.kind !== "allSheets" && l.scope.kind !== "sheets" && i.push({
|
|
831
|
-
code: "unsupported_mapped_scope",
|
|
832
|
-
path: `${f}.scope`,
|
|
833
|
-
message: `${f}.scope must be allSheets or sheets when cardMappings are present.`,
|
|
834
|
-
inputId: l.id
|
|
835
|
-
}), We(
|
|
836
|
-
l.id,
|
|
837
|
-
l.application,
|
|
838
|
-
`${f}.application`,
|
|
839
|
-
a,
|
|
840
|
-
i,
|
|
841
|
-
o
|
|
842
|
-
);
|
|
843
|
-
const {
|
|
844
|
-
filter: $,
|
|
845
|
-
filterReference: L,
|
|
846
|
-
// A reference-backed authored input must shadow the generated
|
|
847
|
-
// dashboard-filter compatibility input. Older writers may have copied
|
|
848
|
-
// the compatibility marker onto the reference; never preserve it.
|
|
849
|
-
compatibility: C,
|
|
850
|
-
...w
|
|
851
|
-
} = l;
|
|
852
|
-
s.push({
|
|
853
|
-
...w,
|
|
854
|
-
filter: u,
|
|
855
|
-
...c && C ? { compatibility: C } : {},
|
|
856
|
-
...l.optionSource ? {
|
|
857
|
-
optionSource: l.optionSource
|
|
858
|
-
} : {},
|
|
859
|
-
...l.optionDependencies ? { optionDependencies: l.optionDependencies } : {},
|
|
860
|
-
...l.optionPopulation ? { optionPopulation: l.optionPopulation } : {},
|
|
861
|
-
definitionOrigin: h
|
|
862
|
-
});
|
|
863
|
-
}), i.length ? { ok: !1, inputs: s, issues: i } : { ok: !0, inputs: s });
|
|
864
|
-
}
|
|
865
|
-
function ht(e) {
|
|
866
|
-
const t = Je(e);
|
|
867
|
-
if (!t.ok) throw new Pe(t.issues);
|
|
868
|
-
return t.inputs;
|
|
869
|
-
}
|
|
870
|
-
function bt(e = () => globalThis.crypto.randomUUID()) {
|
|
871
|
-
return e();
|
|
872
|
-
}
|
|
873
|
-
function Ke(e, t) {
|
|
874
|
-
return e.name === t.name && e.qualifiedEntityName === t.qualifiedEntityName;
|
|
875
|
-
}
|
|
876
|
-
function yt(e, t, n) {
|
|
877
|
-
var i, r;
|
|
878
|
-
if (n.sortPolicy === "dropUnrelatedSorts") {
|
|
879
|
-
const a = new Set(
|
|
880
|
-
(e.metricColumns || []).map((s) => s.id)
|
|
881
|
-
);
|
|
882
|
-
return {
|
|
883
|
-
...e,
|
|
884
|
-
groupByColumns: [t],
|
|
885
|
-
sortByColumns: (e.sortByColumns || []).filter(
|
|
886
|
-
(s) => s.id === t.id || a.has(s.id)
|
|
887
|
-
)
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
const o = (i = e.groupByColumns) == null ? void 0 : i[0];
|
|
891
|
-
return {
|
|
892
|
-
...e,
|
|
893
|
-
groupByColumns: [t],
|
|
894
|
-
sortByColumns: (r = e.sortByColumns) == null ? void 0 : r.map(
|
|
895
|
-
(a) => o && Ke(a, o) ? {
|
|
896
|
-
...t,
|
|
897
|
-
role: "sortby",
|
|
898
|
-
direction: a.direction
|
|
899
|
-
} : a
|
|
900
|
-
)
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
const Xe = /* @__PURE__ */ new Set([
|
|
904
|
-
"day",
|
|
905
|
-
"week",
|
|
906
|
-
"month",
|
|
907
|
-
"quarter",
|
|
908
|
-
"year",
|
|
909
|
-
"hour",
|
|
910
|
-
"minute",
|
|
911
|
-
"second"
|
|
912
|
-
]);
|
|
913
|
-
function It(e) {
|
|
914
|
-
let t = e.spec;
|
|
915
|
-
const n = ne(
|
|
916
|
-
e.controlDefinitions || [],
|
|
917
|
-
e.cardControlDefinitions || []
|
|
918
|
-
), o = (e.controlBindings || []).filter(
|
|
919
|
-
(c) => c.target !== "sql_param"
|
|
920
|
-
), i = o.filter(
|
|
921
|
-
(c) => c.target === "config_metric_selector" || c.target === "config_field_selector"
|
|
922
|
-
), r = o.filter(
|
|
923
|
-
(c) => c.target === "config_grain" || c.target === "config_aggregation"
|
|
924
|
-
), a = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
|
|
925
|
-
let p;
|
|
926
|
-
const d = () => {
|
|
927
|
-
if (p) return p;
|
|
928
|
-
const c = e.catalog, m = /* @__PURE__ */ new Map();
|
|
929
|
-
for (const u of c) {
|
|
930
|
-
const h = m.get(u.id) ?? [];
|
|
931
|
-
m.set(u.id, [...h, u]);
|
|
932
|
-
}
|
|
933
|
-
return p = { refs: c, byId: m }, p;
|
|
934
|
-
}, x = (c, m) => {
|
|
935
|
-
throw new $e(c, {
|
|
936
|
-
code: ke,
|
|
937
|
-
...m ? { controlId: m } : {}
|
|
938
|
-
});
|
|
939
|
-
}, f = (c, m) => {
|
|
940
|
-
var h;
|
|
941
|
-
if (c.derivedField) return c.derivedField.dataType;
|
|
942
|
-
const u = d().refs.filter(($) => $.field.name === c.name && M($.field.source ?? e.spec.source, c.source ?? e.spec.source));
|
|
943
|
-
return u.length > 1 ? x("The selected field is ambiguous in the authorized Matrix field catalog.", m) : B(((h = u[0]) == null ? void 0 : h.field.dataType) ?? c.dataType);
|
|
944
|
-
}, l = (c, m) => ve(c, m.target, (u) => f(u, m.controlId)), v = fe.safeParse(t);
|
|
945
|
-
if (!v.success) return x(v.error.message);
|
|
946
|
-
t = v.data;
|
|
947
|
-
const F = [...i, ...r].map((c) => {
|
|
948
|
-
const m = ie({ binding: c, definitions: n, controlValues: e.controlValues }), u = !c.matrixTargetId && m !== void 0 && m !== P ? l(v.data, c) : [];
|
|
949
|
-
return {
|
|
950
|
-
binding: c,
|
|
951
|
-
selectedValue: m,
|
|
952
|
-
targetId: c.matrixTargetId ?? (u.length === 1 ? u[0].id : void 0)
|
|
953
|
-
};
|
|
954
|
-
});
|
|
955
|
-
for (const { binding: c, targetId: m, selectedValue: u } of F) {
|
|
956
|
-
if (u === void 0 || u === P)
|
|
957
|
-
continue;
|
|
958
|
-
const h = (g) => x(g, c.controlId), $ = c.target === "config_metric_selector" || c.target === "config_aggregation", L = l(t, c);
|
|
959
|
-
(!m || !L.some((g) => g.id === m)) && h("Choose a valid Matrix level or measure target for this control.");
|
|
960
|
-
const C = `${c.target}:${m}`;
|
|
961
|
-
a.has(C) && h("Multiple controls cannot replace the same Matrix target."), a.add(C);
|
|
962
|
-
const w = (g) => {
|
|
963
|
-
const y = (d().byId.get(g.id) ?? []).filter((D) => !g.source || M(g.source, D.field.source ?? e.spec.source));
|
|
964
|
-
if (y.length !== 1) return h(y.length ? "The selected field is ambiguous in the authorized Matrix field catalog." : "The selected field is not in the authorized Matrix field catalog.");
|
|
965
|
-
const T = pe.safeParse(y[0].field);
|
|
966
|
-
return T.success ? T.data : h(T.error.message);
|
|
967
|
-
}, k = c.target === "config_metric_selector" || c.target === "config_field_selector" ? c.mapping[u] : void 0, S = k && typeof k == "object" && "kind" in k && k.kind === "matrix_instance" ? k.id : void 0;
|
|
968
|
-
if ($) {
|
|
969
|
-
s.set(m, c.controlId);
|
|
970
|
-
const g = S === void 0 ? void 0 : v.data.measures.find(
|
|
971
|
-
(_) => _.id === S && _.kind === "aggregate"
|
|
972
|
-
);
|
|
973
|
-
S !== void 0 && !g && h("The selected Matrix aggregate measure is no longer available.");
|
|
974
|
-
const y = c.target === "config_metric_selector" && !g ? _e({ binding: c, selectedValue: u }) : void 0, T = ((g == null ? void 0 : g.kind) === "aggregate" ? g.aggregate : y == null ? void 0 : y.aggregate) ?? (c.target === "config_aggregation" ? W({ binding: c, selectedValue: u }) : void 0), D = T === void 0 ? void 0 : me.safeParse(T);
|
|
975
|
-
D && !D.success && h("This aggregation is not supported by Matrix."), t = {
|
|
976
|
-
...t,
|
|
977
|
-
measures: t.measures.map(
|
|
978
|
-
(_) => _.id !== m || _.kind !== "aggregate" ? _ : {
|
|
979
|
-
..._,
|
|
980
|
-
...y ? { field: w(y) } : {},
|
|
981
|
-
...(g == null ? void 0 : g.kind) === "aggregate" ? { field: g.field } : {},
|
|
982
|
-
aggregate: D != null && D.success ? D.data : _.aggregate
|
|
983
|
-
}
|
|
984
|
-
)
|
|
985
|
-
};
|
|
986
|
-
} else {
|
|
987
|
-
const g = S === void 0 ? void 0 : [...v.data.rows, ...v.data.columns].find(
|
|
988
|
-
(_) => _.id === S
|
|
989
|
-
);
|
|
990
|
-
S !== void 0 && !g && h("The selected Matrix level is no longer available.");
|
|
991
|
-
const y = c.target === "config_field_selector" && !g ? De({ binding: c, selectedValue: u }) : void 0, T = c.target === "config_grain" ? W({ binding: c, selectedValue: u }) : g ? g.grain : y == null ? void 0 : y.granularity;
|
|
992
|
-
T !== void 0 && !Xe.has(T) && h("This time grain is not supported by Matrix.");
|
|
993
|
-
const D = (_) => _.map((A) => {
|
|
994
|
-
if (A.id !== m) return A;
|
|
995
|
-
const j = (g == null ? void 0 : g.field) ?? (y ? w(y) : A.field), G = f(j, c.controlId), V = T ?? (y && H(G) ? A.grain : void 0);
|
|
996
|
-
return V && !H(G) && h("A time grain requires a temporal Matrix level."), { ...A, field: j, grain: V };
|
|
997
|
-
});
|
|
998
|
-
t = {
|
|
999
|
-
...t,
|
|
1000
|
-
rows: D(t.rows),
|
|
1001
|
-
columns: D(t.columns)
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
for (const [c, m] of Array.from(s)) {
|
|
1006
|
-
const u = t.measures.find(($) => $.id === c);
|
|
1007
|
-
if (!u || u.kind !== "aggregate") continue;
|
|
1008
|
-
const h = f(u.field, m);
|
|
1009
|
-
Fe(h).some(($) => $.value === u.aggregate) || x(`Aggregation '${u.aggregate}' is not eligible for this Matrix field datatype.`, m);
|
|
1010
|
-
}
|
|
1011
|
-
try {
|
|
1012
|
-
return Te(v.data, t);
|
|
1013
|
-
} catch (c) {
|
|
1014
|
-
if (c instanceof he) return x(c.message);
|
|
1015
|
-
throw c;
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
function de(e, t) {
|
|
1019
|
-
const n = [], o = (i) => {
|
|
1020
|
-
if (i.source) {
|
|
1021
|
-
const r = ge.safeParse(i.source);
|
|
1022
|
-
if (r.success) n.push(r.data);
|
|
1023
|
-
else if (t) throw r.error;
|
|
1024
|
-
}
|
|
1025
|
-
i.derivedField && Object.values(i.derivedField.inputs).forEach((r) => o(r.field));
|
|
1026
|
-
};
|
|
1027
|
-
for (const i of e) {
|
|
1028
|
-
if (i.target !== "config_field_selector" && i.target !== "config_metric_selector") continue;
|
|
1029
|
-
const r = t == null ? void 0 : t.get(i), a = t ? r && r !== P ? [i.mapping[r]] : [] : Object.values(i.mapping);
|
|
1030
|
-
for (const s of a)
|
|
1031
|
-
s && "role" in s && o(s);
|
|
1032
|
-
}
|
|
1033
|
-
return n;
|
|
1034
|
-
}
|
|
1035
|
-
function vt(e, t = [], n = []) {
|
|
1036
|
-
return te([...oe(e), ...de(t), ...n]);
|
|
1037
|
-
}
|
|
1038
|
-
function _t(e, t = {}) {
|
|
1039
|
-
const n = t.controlBindings ?? [], o = ne(t.controlDefinitions ?? [], t.cardControlDefinitions ?? []), i = new Map(n.filter((r) => r.target === "config_field_selector" || r.target === "config_metric_selector").map((r) => [r, ie({ binding: r, definitions: o, controlValues: t.controlValues })]));
|
|
1040
|
-
return te([...oe(e), ...de(n, i)]);
|
|
1041
|
-
}
|
|
1042
|
-
function Qe(e) {
|
|
1043
|
-
return (e == null ? void 0 : e.kind) === "document";
|
|
1044
|
-
}
|
|
1045
|
-
function Dt(e) {
|
|
1046
|
-
return (e || []).filter((t) => !Qe(t));
|
|
1047
|
-
}
|
|
1048
|
-
export {
|
|
1049
|
-
Pe as D,
|
|
1050
|
-
vt as a,
|
|
1051
|
-
_t as b,
|
|
1052
|
-
ut as c,
|
|
1053
|
-
Ae as d,
|
|
1054
|
-
st as e,
|
|
1055
|
-
ft as f,
|
|
1056
|
-
ht as g,
|
|
1057
|
-
bt as h,
|
|
1058
|
-
yt as i,
|
|
1059
|
-
It as j,
|
|
1060
|
-
Oe as k,
|
|
1061
|
-
Ee as l,
|
|
1062
|
-
Me as m,
|
|
1063
|
-
Je as n,
|
|
1064
|
-
Re as o,
|
|
1065
|
-
pt as p,
|
|
1066
|
-
Be as q,
|
|
1067
|
-
lt as r,
|
|
1068
|
-
mt as s,
|
|
1069
|
-
Qe as t,
|
|
1070
|
-
ct as u,
|
|
1071
|
-
dt as v,
|
|
1072
|
-
gt as w,
|
|
1073
|
-
at as x,
|
|
1074
|
-
Dt as y,
|
|
1075
|
-
re as z
|
|
1076
|
-
};
|