react-semaphor 0.1.477 → 0.1.478

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 (109) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +9 -9
  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-OgPk-zGu.cjs → analyze-result-contract-BX_nQmPN.cjs} +1 -1
  8. package/dist/chunks/{analyze-result-contract-C8s8EUL5.js → analyze-result-contract-DsiAzCYn.js} +1 -1
  9. package/dist/chunks/{saved-temporal-bucket-format-CHsXUPJI.js → card-config-utils-CyDKaPNT.js} +190 -190
  10. package/dist/chunks/card-config-utils-D3Xuu0ub.cjs +1 -0
  11. package/dist/chunks/{common-types-C1IM7gao.cjs → common-types-BCSbPclk.cjs} +1 -1
  12. package/dist/chunks/{common-types-BLPy5_E0.js → common-types-D3r4PILe.js} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-CXHq6ime.cjs → dashboard-briefing-launcher-7qAW16mO.cjs} +2 -2
  14. package/dist/chunks/{dashboard-briefing-launcher-C9d8CPxv.js → dashboard-briefing-launcher-DAhtLQPc.js} +134 -134
  15. package/dist/chunks/{dashboard-controls-BqDm4ARp.js → dashboard-controls-C_CBmEwW.js} +13 -12
  16. package/dist/chunks/{dashboard-controls-d7Yd2fJb.cjs → dashboard-controls-CoVqAeKG.cjs} +10 -10
  17. package/dist/chunks/{dashboard-input-contract-JFJZgenC.cjs → dashboard-date-comparison-definition-C93wv8Ua.cjs} +1 -1
  18. package/dist/chunks/{dashboard-input-contract-BrGdGFz0.js → dashboard-date-comparison-definition-KohOqBqR.js} +19 -19
  19. package/dist/chunks/dashboard-filter-value-compatibility-BAatYtUS.js +1215 -0
  20. package/dist/chunks/dashboard-filter-value-compatibility-Bco2gN96.cjs +1 -0
  21. package/dist/chunks/{dashboard-json-CL_vgcWq.js → dashboard-json-0w58H39L.js} +7 -7
  22. package/dist/chunks/dashboard-json-B3XSl7b_.cjs +1 -0
  23. package/dist/chunks/{edit-dashboard-visual-Dklel3MC.cjs → edit-dashboard-visual-BsLRKeuO.cjs} +6 -6
  24. package/dist/chunks/{edit-dashboard-visual-C0Zvyo-X.js → edit-dashboard-visual-BsWEU8xf.js} +277 -277
  25. package/dist/chunks/{editor-action-buttons-BOyUtX9j.js → editor-action-buttons-B3CB5c__.js} +39 -39
  26. package/dist/chunks/{editor-action-buttons-AcaZsiDy.cjs → editor-action-buttons-DMLDvrJD.cjs} +1 -1
  27. package/dist/chunks/{index-Cd8qGOXl.cjs → index--0Il-Bpd.cjs} +238 -238
  28. package/dist/chunks/{format-types-CFHQoIuk.js → index-BS0_dp0l.js} +168 -168
  29. package/dist/chunks/{index-D9S3j7_z.js → index-BvRREsU9.js} +9 -9
  30. package/dist/chunks/index-ByQgqT9d.cjs +1 -0
  31. package/dist/chunks/{index-v2MZLyus.cjs → index-CXeIDdjd.cjs} +1 -1
  32. package/dist/chunks/{index-DrdF7QR7.js → index-DgGcVyUs.js} +30518 -31308
  33. package/dist/chunks/matrix-result-contract-CFPnlcLm.cjs +1 -0
  34. package/dist/chunks/{matrix-result-contract-BpzhImar.js → matrix-result-contract-DFfUvb1r.js} +3 -3
  35. package/dist/chunks/{temporal-bucket-CtP7hKLa.js → metric-comparison-CTexJ8V1.js} +705 -705
  36. package/dist/chunks/metric-comparison-x0lipytf.cjs +1 -0
  37. package/dist/chunks/pivot-header-presentation-8Ra1RfHg.cjs +4 -0
  38. package/dist/chunks/{pivot-header-presentation-CaERAWpl.js → pivot-header-presentation-tpb_J900.js} +118 -118
  39. package/dist/chunks/{pivot-result-identity-CIZXsI53.js → pivot-result-identity-BIeP9v8I.js} +1 -1
  40. package/dist/chunks/{pivot-result-identity-DRUlTWUq.cjs → pivot-result-identity-BVnhG2rR.cjs} +1 -1
  41. package/dist/chunks/pivot-result-lifecycle-D_bRCqaB.cjs +1 -0
  42. package/dist/chunks/{pivot-result-lifecycle-B9FTybxN.js → pivot-result-lifecycle-mjJ1rBvV.js} +7 -7
  43. package/dist/chunks/{raw-temporal-contract-U8J9RlEH.js → raw-temporal-contract-BuQIB31z.js} +1 -1
  44. package/dist/chunks/{raw-temporal-contract-D8YuxTAg.cjs → raw-temporal-contract-vnNwLy9R.cjs} +1 -1
  45. package/dist/chunks/{report-preferences-dialog-BjygtSP3.js → report-preferences-dialog-Bytgubvz.js} +25 -25
  46. package/dist/chunks/report-preferences-dialog-I0Pbn_Yb.cjs +1 -0
  47. package/dist/chunks/{report-runtime-context-DNbgCsko.js → report-runtime-context-B_pAmqxl.js} +1 -1
  48. package/dist/chunks/{report-runtime-context-RFiWq4wK.cjs → report-runtime-context-BfW4qiMJ.cjs} +1 -1
  49. package/dist/chunks/{source-entity-resolution-BDC-Qngk.cjs → source-entity-resolution-DCAAS-y8.cjs} +1 -1
  50. package/dist/chunks/{source-entity-resolution-ugN3sZUk.js → source-entity-resolution-WUstJID6.js} +1 -1
  51. package/dist/chunks/{switch-C8NihGV4.js → switch-BsGTOjuD.js} +12342 -11110
  52. package/dist/chunks/switch-Cpj3DrCZ.cjs +138 -0
  53. package/dist/chunks/{temporal-bucket-authoring-DJ9kK2wD.js → temporal-bucket-authoring-CyTCHy1K.js} +3 -3
  54. package/dist/chunks/temporal-bucket-authoring-DueSgLJU.cjs +1 -0
  55. package/dist/chunks/{temporal-bucket-contract-CZl5D7FZ.js → temporal-bucket-contract-BeOx0uYe.js} +1 -1
  56. package/dist/chunks/{temporal-bucket-contract-BD862TAa.cjs → temporal-bucket-contract-Cp-usD9Z.cjs} +1 -1
  57. package/dist/chunks/{token-types-CoHsSJ4E.cjs → token-types-D9eN35rf.cjs} +1 -1
  58. package/dist/chunks/{token-types-DfDtCqlw.js → token-types-Dvomvqw0.js} +1 -1
  59. package/dist/chunks/{update-policy-BGNXFgBU.cjs → update-policy-Buw2LmvX.cjs} +1 -1
  60. package/dist/chunks/{update-policy-BybMiM61.js → update-policy-MWg0aH3d.js} +1 -1
  61. package/dist/chunks/{validators-D-T-2HOR.js → validators-D3AarM2T.js} +662 -663
  62. package/dist/chunks/validators-DqIM0B3C.cjs +1 -0
  63. package/dist/dashboard/index.cjs +1 -1
  64. package/dist/dashboard/index.js +2 -2
  65. package/dist/dashboard-authoring/index.cjs +3 -3
  66. package/dist/dashboard-authoring/index.js +81 -79
  67. package/dist/data-app-builder/index.cjs +1 -1
  68. package/dist/data-app-builder/index.js +2 -2
  69. package/dist/data-app-codegen/index.cjs +1 -1
  70. package/dist/data-app-codegen/index.js +2 -2
  71. package/dist/data-app-codegen-node/index.cjs +1 -1
  72. package/dist/data-app-codegen-node/index.js +3 -3
  73. package/dist/data-app-sdk/index.cjs +1 -1
  74. package/dist/data-app-sdk/index.js +3 -3
  75. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  76. package/dist/data-app-sdk-adapters/index.js +2 -2
  77. package/dist/data-app-sdk-validation/index.cjs +1 -1
  78. package/dist/data-app-sdk-validation/index.js +3 -3
  79. package/dist/format-utils/index.cjs +3 -3
  80. package/dist/format-utils/index.js +9 -9
  81. package/dist/index.cjs +1 -1
  82. package/dist/index.js +177 -176
  83. package/dist/report-runtime-context/index.cjs +1 -1
  84. package/dist/report-runtime-context/index.js +2 -2
  85. package/dist/surfboard/index.cjs +1 -1
  86. package/dist/surfboard/index.js +3 -3
  87. package/dist/types/briefings.d.ts +11 -0
  88. package/dist/types/dashboard-authoring.d.ts +17 -0
  89. package/dist/types/dashboard.d.ts +11 -0
  90. package/dist/types/index.cjs +1 -1
  91. package/dist/types/index.js +4 -4
  92. package/dist/types/main.d.ts +12 -0
  93. package/dist/types/shared.d.ts +11 -0
  94. package/dist/types/surfboard.d.ts +11 -0
  95. package/dist/types/types.d.ts +11 -0
  96. package/package.json +1 -1
  97. package/dist/chunks/dashboard-filter-value-compatibility-BCVF9IHg.js +0 -1026
  98. package/dist/chunks/dashboard-filter-value-compatibility-DLkdeypb.cjs +0 -1
  99. package/dist/chunks/dashboard-json-BYQjTmqD.cjs +0 -1
  100. package/dist/chunks/format-types-PSZZ7hG8.cjs +0 -1
  101. package/dist/chunks/matrix-result-contract-Bhg60NtS.cjs +0 -1
  102. package/dist/chunks/pivot-header-presentation-CePk1R6g.cjs +0 -4
  103. package/dist/chunks/pivot-result-lifecycle-CcGt_29N.cjs +0 -1
  104. package/dist/chunks/report-preferences-dialog-DW40ECz1.cjs +0 -1
  105. package/dist/chunks/saved-temporal-bucket-format-DNMtD77o.cjs +0 -1
  106. package/dist/chunks/switch-B1mZx2k9.cjs +0 -138
  107. package/dist/chunks/temporal-bucket-9Wz9Ds6H.cjs +0 -1
  108. package/dist/chunks/temporal-bucket-authoring-DSpzgXHc.cjs +0 -1
  109. package/dist/chunks/validators-DcshgK7w.cjs +0 -1
@@ -1,1026 +0,0 @@
1
- var te = Object.defineProperty;
2
- var ne = (e, t, n) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var H = (e, t, n) => ne(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { ai as y, ak as ie, j as P, C as F, F as x } from "./validators-D-T-2HOR.js";
5
- import "./analyze-result-contract-C8s8EUL5.js";
6
- import "../value-format-preferences/index.js";
7
- import { l as se } from "./source-entity-resolution-ugN3sZUk.js";
8
- function A(e) {
9
- return (e == null ? void 0 : e.trim()) || void 0;
10
- }
11
- function J(e) {
12
- return e.split(".").at(-1) || e;
13
- }
14
- function U(e, t) {
15
- var c, r;
16
- const n = A(t);
17
- if (!n) return;
18
- const s = J(n), i = A((c = e.fieldMeta) == null ? void 0 : c.name);
19
- if (i && i !== n && i !== s)
20
- return;
21
- const a = A(
22
- (r = e.fieldMeta) == null ? void 0 : r.qualifiedFieldName
23
- );
24
- if (a && J(a) !== s)
25
- return;
26
- const d = n.includes(".") ? n : void 0, o = a != null && a.includes(".") ? a : void 0;
27
- if (!(d && o && d !== o))
28
- return {
29
- leafName: s,
30
- ...d || o ? {
31
- qualifiedFieldName: d || o
32
- } : {}
33
- };
34
- }
35
- function Q(e, t) {
36
- return U(e, t) || U({}, t);
37
- }
38
- function K({
39
- source: e,
40
- sourceFieldName: t,
41
- target: n,
42
- targetFieldName: s
43
- }) {
44
- const i = Q(
45
- e,
46
- t
47
- ), a = Q(
48
- n,
49
- s
50
- );
51
- return !i || !a || i.leafName !== a.leafName ? !1 : a.qualifiedFieldName ? i.qualifiedFieldName === a.qualifiedFieldName : !0;
52
- }
53
- function _(e, t) {
54
- var i, a;
55
- const n = re(e);
56
- if (n) return n;
57
- const s = (a = (i = e == null ? void 0 : e.fieldMeta) == null ? void 0 : i.nativeDataType) == null ? void 0 : a.trim();
58
- if (O(e == null ? void 0 : e.fieldMeta, t) && s && s !== "date" && s !== "datetime")
59
- return s;
60
- }
61
- function re(e) {
62
- var n;
63
- const t = (n = e == null ? void 0 : e.nativeDataType) == null ? void 0 : n.trim();
64
- return t && t !== "date" && t !== "datetime" ? t : void 0;
65
- }
66
- function O(e, t) {
67
- var d, o;
68
- const n = t.trim();
69
- if (!n) return !1;
70
- const s = n.split(".").at(-1), i = (d = e == null ? void 0 : e.qualifiedFieldName) == null ? void 0 : d.trim();
71
- if (i && !(i === n || !i.includes(".") && i === s))
72
- return !1;
73
- const a = (o = e == null ? void 0 : e.name) == null ? void 0 : o.trim();
74
- return a && a !== n && a !== s ? !1 : !!(i || a);
75
- }
76
- function ae({
77
- fieldName: e,
78
- definition: t,
79
- value: n
80
- }) {
81
- if ((t == null ? void 0 : t.column) === e) {
82
- const s = _(t, e);
83
- if (s)
84
- return s;
85
- }
86
- return (n == null ? void 0 : n.name) === e ? _(n, e) : void 0;
87
- }
88
- function oe({
89
- definition: e,
90
- value: t,
91
- sourceValue: n = t
92
- }) {
93
- const s = e && K({
94
- source: e,
95
- sourceFieldName: e.column,
96
- target: t,
97
- targetFieldName: t.name
98
- }) ? e : void 0, i = n && K({
99
- source: n,
100
- sourceFieldName: n.name,
101
- target: t,
102
- targetFieldName: t.name
103
- }) ? n : void 0, a = (s ? _(s, s.column) : void 0) || (i ? _(i, i.name) : void 0);
104
- return X({
105
- carrier: t,
106
- nativeDataType: a,
107
- projectNestedNativeDataType: O(
108
- t.fieldMeta,
109
- t.name
110
- )
111
- });
112
- }
113
- function Oe({
114
- filterDefinitions: e,
115
- filterValues: t
116
- }) {
117
- if (!(e != null && e.length) || !t.length)
118
- return t;
119
- const n = new Map(
120
- e.map((a) => [a.id, a])
121
- );
122
- let s = !1;
123
- const i = t.map((a) => {
124
- if (typeof a.name != "string" || !a.name.trim())
125
- return a;
126
- const d = n.get(a.filterId);
127
- if (!d)
128
- return a;
129
- const o = oe({
130
- definition: d,
131
- value: a
132
- });
133
- return s || (s = o !== a), o;
134
- });
135
- return s ? i : t;
136
- }
137
- function Le(e) {
138
- const t = ae({
139
- fieldName: e.column,
140
- definition: e
141
- });
142
- return X({
143
- carrier: e,
144
- nativeDataType: t,
145
- projectNestedNativeDataType: O(
146
- e.fieldMeta,
147
- e.column
148
- )
149
- });
150
- }
151
- function X({
152
- carrier: e,
153
- nativeDataType: t,
154
- projectNestedNativeDataType: n
155
- }) {
156
- var r;
157
- const s = (r = e.fieldMeta) == null ? void 0 : r.nativeDataType;
158
- if (t) {
159
- if (e.nativeDataType === t && (!e.fieldMeta || (n ? s === t : !s)))
160
- return e;
161
- const { nativeDataType: g, ...f } = e.fieldMeta || {};
162
- return {
163
- ...e,
164
- nativeDataType: t,
165
- ...e.fieldMeta ? {
166
- fieldMeta: n ? {
167
- ...e.fieldMeta,
168
- nativeDataType: t
169
- } : f
170
- } : {}
171
- };
172
- }
173
- if (e.nativeDataType === void 0 && s === void 0)
174
- return e;
175
- const {
176
- nativeDataType: i,
177
- fieldMeta: a,
178
- ...d
179
- } = e, { nativeDataType: o, ...c } = a || {};
180
- return {
181
- ...d,
182
- ...a ? { fieldMeta: c } : {}
183
- };
184
- }
185
- function l(e) {
186
- return typeof e == "string" && e.trim().length > 0 ? e.trim() : null;
187
- }
188
- function Z(e) {
189
- return Array.from(new Set(e.filter((t) => !!t)));
190
- }
191
- function de(e) {
192
- const t = l(e.table), n = l(e.schema), s = l(e.catalog) || l(e.database);
193
- return t ? Z([
194
- t,
195
- n ? `${n}.${t}` : null,
196
- s ? `${s}.${t}` : null,
197
- s && n ? `${s}.${n}.${t}` : null
198
- ]) : [];
199
- }
200
- function Y(e) {
201
- const t = l(e.table) || l(e.tableName);
202
- return Z([
203
- l(e.name),
204
- l(e.alias),
205
- ...de({
206
- table: t,
207
- schema: l(e.schema) || l(e.schemaName),
208
- catalog: l(e.catalog),
209
- database: l(e.database) || l(e.databaseName)
210
- })
211
- ]);
212
- }
213
- function ce(e, t) {
214
- const n = l(e.domainId), s = l(t.domainId);
215
- if (n && s && n !== s)
216
- return !0;
217
- if (e.type === "dataset")
218
- return !1;
219
- const i = l(e.id), a = l(t.id);
220
- if (i && a && i !== a)
221
- return !0;
222
- const d = l(e.connectionId), o = l(t.connectionId);
223
- return !!(d && o && d !== o);
224
- }
225
- function w(e, t = !1) {
226
- return l(e.table) || l(e.tableName) || (e.type !== "dataset" || t ? l(e.name) : null);
227
- }
228
- function M(e) {
229
- return l(e.catalog) || l(e.database) || l(e.databaseName);
230
- }
231
- function z(e) {
232
- return l(e.schema) || l(e.schemaName);
233
- }
234
- function N(e) {
235
- return e.length === 1 ? e[0] : void 0;
236
- }
237
- function le(e, t) {
238
- const n = w(t, !0), s = M(t), i = z(t);
239
- if (!(!n || !s && !i))
240
- return N(
241
- e.filter((a) => {
242
- const d = a;
243
- return !(w(d) !== n || s && M(d) !== s || i && z(d) !== i);
244
- })
245
- );
246
- }
247
- function D(e, t) {
248
- if (!t || !(e != null && e.length))
249
- return;
250
- const n = e.filter(
251
- (o) => !ce(o, t)
252
- );
253
- if (t.type === "dataset") {
254
- const o = l(t.id);
255
- if (o)
256
- return N(
257
- n.filter(
258
- (r) => r.type === "dataset" && l(r.id) === o
259
- )
260
- );
261
- if (l(t.domainId)) {
262
- const r = l(t.name);
263
- return N(
264
- n.filter(
265
- (g) => g.type === "dataset" && l(g.name) === r
266
- )
267
- );
268
- }
269
- }
270
- let s = [];
271
- if (t.type === "dataset") {
272
- const o = l(t.name);
273
- if (s = n.filter(
274
- (c) => c.type === "dataset" && l(c.name) === o
275
- ), s.length === 1)
276
- return s[0];
277
- }
278
- if (!!(w(t, !0) && (M(t) || z(t))))
279
- return le(n, t);
280
- if (s.length > 1)
281
- return;
282
- const a = Y(t);
283
- if (a.length === 0)
284
- return;
285
- const d = n.filter((o) => Y(
286
- o
287
- ).some(
288
- (r) => a.includes(r)
289
- ));
290
- return N(d);
291
- }
292
- function R(e, t) {
293
- const n = D(e, t);
294
- return n ? { ...t, ...n } : t;
295
- }
296
- function je(e, t) {
297
- const n = t || [];
298
- return n.length === 0 ? e : {
299
- ...e,
300
- baseEntity: R(n, e.baseEntity),
301
- joins: e.joins.map((s) => ({
302
- ...s,
303
- source: R(n, s.source),
304
- target: R(n, s.target)
305
- }))
306
- };
307
- }
308
- function We(e, t) {
309
- if (!(e != null && e.joins.length))
310
- return [];
311
- const n = [
312
- e.baseEntity,
313
- ...e.joins.flatMap((i) => [i.source, i.target])
314
- ], s = [];
315
- return n.forEach((i) => {
316
- !D(t, i) && !D(s, i) && s.push(i);
317
- }), s;
318
- }
319
- function I(e) {
320
- return !!e && typeof e == "object" && !Array.isArray(e);
321
- }
322
- function $(e) {
323
- return I(e) && typeof e.name == "string";
324
- }
325
- function q(e) {
326
- return !I(e) || e.kind !== "semantic" && e.kind !== "physical" || (e.kind === "semantic" ? [e.datasetId, e.datasetName, e.connectionId] : [e.databaseName, e.schemaName]).some(
327
- (n) => n !== void 0 && typeof n != "string"
328
- ) ? !1 : P(
329
- e
330
- );
331
- }
332
- function B(e, t) {
333
- var r, g;
334
- const n = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter($) : void 0, s = D(n, e), i = s ? { ...e, ...s } : e, a = "domainId" in i && typeof i.domainId == "string" && !!i.domainId.trim();
335
- if ((t == null ? void 0 : t.mode) === "semanticDomain" && !a)
336
- return;
337
- if ((t == null ? void 0 : t.mode) !== "database" && i.type === "dataset") {
338
- const f = se(
339
- {
340
- entities: [i],
341
- semanticDomainId: t == null ? void 0 : t.semanticDomainId,
342
- connectionId: t == null ? void 0 : t.connectionId,
343
- fieldEntityType: "dataset"
344
- },
345
- { includePhysicalDatasets: !0 }
346
- );
347
- if (f.kind === "resolved") {
348
- const u = "label" in i && typeof i.label == "string" ? i.label : void 0;
349
- return {
350
- ...f.source,
351
- ...u ? { label: u } : {}
352
- };
353
- }
354
- }
355
- if ((t == null ? void 0 : t.mode) === "semanticDomain")
356
- return;
357
- const d = i.connectionId || (t == null ? void 0 : t.connectionId), o = i.type === "dataset" && "table" in i && i.table ? i.table : i.name;
358
- if (!d || !o)
359
- return;
360
- const c = {
361
- kind: "physical",
362
- connectionId: d,
363
- connectionType: i.connectionType || (t == null ? void 0 : t.connectionType),
364
- tableName: o,
365
- databaseName: i.database || ((r = t == null ? void 0 : t.dbSelection) == null ? void 0 : r.database),
366
- schemaName: i.schema || ((g = t == null ? void 0 : t.dbSelection) == null ? void 0 : g.schema),
367
- dialect: i.dialect
368
- };
369
- return q(c) ? c : void 0;
370
- }
371
- function fe(e, t) {
372
- var o, c;
373
- const n = B(e, t);
374
- if (!n) return;
375
- const s = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, i = n.kind === "physical" ? n.tableName : s, a = e.connectionId || (t == null ? void 0 : t.connectionId), d = i && a ? {
376
- connectionId: a,
377
- databaseName: e.database || ((o = t == null ? void 0 : t.dbSelection) == null ? void 0 : o.database),
378
- schemaName: e.schema || ((c = t == null ? void 0 : t.dbSelection) == null ? void 0 : c.schema),
379
- tableName: i
380
- } : void 0;
381
- return { source: n, ...d ? { executionTable: d } : {} };
382
- }
383
- function ue(e) {
384
- const t = I(e.dataSource) ? e.dataSource : void 0;
385
- if (typeof e.sql == "string" && e.sql.trim()) {
386
- const d = [], o = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
387
- for (const c of o) {
388
- if (!$(c)) continue;
389
- const r = fe(c, t);
390
- r && !d.some(
391
- (g) => y(
392
- g.source,
393
- r.source
394
- )
395
- ) && d.push(r);
396
- }
397
- return {
398
- cardId: e.id,
399
- kind: "sql",
400
- pinnedCatalogSources: d
401
- };
402
- }
403
- if (!I(e.config))
404
- return { cardId: e.id, kind: "unconfigured" };
405
- const n = [], s = I(e.config.matrixIntent) ? e.config.matrixIntent : void 0, i = e.type === "matrixTable" ? (s == null ? void 0 : s.kind) === "matrix" ? s.source : e.config.source : void 0;
406
- q(i) && n.push(i);
407
- const a = I(e.config.joinPlan) ? e.config.joinPlan : void 0;
408
- if (a) {
409
- const d = Array.isArray(a.joins) ? a.joins : [], o = [a.baseEntity];
410
- for (const r of d)
411
- I(r) && o.push(r.source, r.target);
412
- let c = !1;
413
- for (const r of o) {
414
- if (!$(r)) {
415
- c = !0;
416
- continue;
417
- }
418
- const g = B(r, t);
419
- g ? n.push(g) : c = !0;
420
- }
421
- c && (n.length = 0);
422
- } else if (e.type !== "matrixTable") {
423
- const d = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities : [];
424
- if (d.length === 1 && $(d[0])) {
425
- const o = B(d[0], t);
426
- o && n.push(o);
427
- }
428
- }
429
- if (!n.length && !a && e.type !== "matrixTable") {
430
- const d = e.config.queryBaseSource;
431
- q(d) && n.push(d);
432
- }
433
- return {
434
- cardId: e.id,
435
- kind: "config",
436
- executableSources: ie(n)
437
- };
438
- }
439
- function me(e, t) {
440
- return (e.kind === "config" ? e.executableSources : e.kind === "sql" ? e.pinnedCatalogSources.map((s) => s.source) : []).some(
441
- (s) => y(s, t)
442
- );
443
- }
444
- function He(e, t) {
445
- if (e.kind === "config")
446
- return e.executableSources.find(
447
- (n) => y(n, t)
448
- );
449
- }
450
- function Je(e, t) {
451
- var n;
452
- return (n = V(e, t)) == null ? void 0 : n.source;
453
- }
454
- function V(e, t) {
455
- if (e.kind === "sql")
456
- return e.pinnedCatalogSources.find(
457
- (n) => y(n.source, t)
458
- );
459
- }
460
- function G(e) {
461
- const t = /* @__PURE__ */ new Set();
462
- for (const n of [e.name, e.sourceField]) {
463
- if (!n) continue;
464
- const s = F(n);
465
- if (!s) continue;
466
- t.add(s);
467
- const i = s.split("."), a = i[i.length - 1];
468
- a && t.add(a);
469
- }
470
- return t;
471
- }
472
- function S(e, t) {
473
- const n = x(e), s = x(t);
474
- return n === "unknown" || s === "unknown" ? !1 : (n === "date" || n === "datetime") && (s === "date" || s === "datetime") ? !0 : n === s;
475
- }
476
- function ge(e, t) {
477
- return y(e.field.source, t.field.source) && F(e.field.name) === F(t.field.name) && F(e.field.sourceField || e.field.name) === F(t.field.sourceField || t.field.name);
478
- }
479
- function he(e, t) {
480
- if (e.kind !== "field") return !1;
481
- const n = G(t), s = G(e.field);
482
- return S(t.dataType, e.field.dataType) && [...s].some((i) => n.has(i));
483
- }
484
- function Ue(e) {
485
- const t = e.candidates.filter(
486
- (n) => he(
487
- n,
488
- e.logicalValueField
489
- )
490
- );
491
- return t.length === 1 ? { status: "matched", target: t[0] } : t.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
492
- }
493
- function Qe(e) {
494
- const t = [];
495
- for (const n of e.acceptedTargets)
496
- !S(
497
- e.logicalValueField.dataType,
498
- n.field.dataType
499
- ) || t.some(
500
- (s) => ge(s, n)
501
- ) || t.push(n);
502
- return t.length === 1 ? { status: "matched", target: t[0] } : t.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
503
- }
504
- const be = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, pe = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, ye = /\bwhere\b/i;
505
- function Ie(e) {
506
- return e != null && e.trim() ? be.test(e) || pe.test(e) : !1;
507
- }
508
- function Ke(e) {
509
- return !(e != null && e.trim()) || Ie(e) ? null : ye.test(e) ? {
510
- helper: "{{ filters | and }}",
511
- description: "For queries with an existing WHERE clause."
512
- } : {
513
- helper: "{{ filters | where }}",
514
- description: "For queries without a WHERE clause."
515
- };
516
- }
517
- function Fe(e) {
518
- return (e.field.sourceField || e.field.name).trim() || void 0;
519
- }
520
- function Ye(e) {
521
- if (e.inventory.kind !== "sql" || e.target.kind !== "field")
522
- return { status: "ineligible" };
523
- const t = V(
524
- e.inventory,
525
- e.target.field.source
526
- ), n = Fe(e.target);
527
- if (!t || !n) return { status: "ineligible" };
528
- if (t.executionTable) {
529
- const d = [
530
- t.executionTable.databaseName,
531
- t.executionTable.schemaName,
532
- t.executionTable.tableName,
533
- n
534
- ].filter(Boolean).join(".");
535
- return {
536
- status: "eligible",
537
- source: t.source,
538
- executionIdentifier: d
539
- };
540
- }
541
- if (e.inventory.pinnedCatalogSources.length !== 1)
542
- return { status: "ineligible" };
543
- const s = F(n), i = (e.candidateTargets || []).filter(
544
- (d) => F(
545
- d.field.sourceField || d.field.name
546
- ) === s
547
- ), a = [];
548
- for (const d of i)
549
- a.some(
550
- (o) => y(o, d.field.source)
551
- ) || a.push(d.field.source);
552
- return a.length > 1 ? { status: "ineligible" } : {
553
- status: "eligible",
554
- source: t.source,
555
- executionIdentifier: n
556
- };
557
- }
558
- class ve extends Error {
559
- constructor(n) {
560
- super(n.map((s) => s.message).join(" "));
561
- H(this, "issues");
562
- this.name = "DashboardFilterMappingContractError", this.issues = n;
563
- }
564
- }
565
- const Te = {
566
- string: !0,
567
- number: !0,
568
- boolean: !0,
569
- date: !0,
570
- datetime: !0
571
- };
572
- function h(e) {
573
- return typeof e == "string" && e.trim().length > 0;
574
- }
575
- function m(e) {
576
- return !!e && typeof e == "object" && !Array.isArray(e);
577
- }
578
- function T(e) {
579
- return Array.isArray(e) && e.every((t) => typeof t == "string");
580
- }
581
- function Ne(e) {
582
- if (!m(e)) return !1;
583
- switch (e.kind) {
584
- case "allSheets":
585
- return e.sheetKinds === void 0 || T(e.sheetKinds) && e.sheetKinds.every(
586
- (t) => t === "dashboard" || t === "document"
587
- );
588
- case "sheets":
589
- return T(e.sheetIds);
590
- case "cards":
591
- return T(e.cardIds);
592
- case "documentSections":
593
- return h(e.sheetId) && T(e.sectionIds);
594
- default:
595
- return !1;
596
- }
597
- }
598
- function $e(e) {
599
- return e === "shared" || e === "perSheet" || e === "perCard" || e === "perDocumentSection";
600
- }
601
- function _e(e) {
602
- return m(e) ? h(e.id) && h(e.column) && h(e.dataType) : !1;
603
- }
604
- function De(e, t, n, s) {
605
- var o;
606
- if (!m(t)) {
607
- s.push({
608
- code: "invalid_option_source",
609
- path: n,
610
- message: `${n} must be a semantic or physical option source.`,
611
- inputId: e
612
- });
613
- return;
614
- }
615
- const i = t.source, a = [
616
- ["labelField", t.labelField],
617
- ["valueField", t.valueField],
618
- ["searchField", t.searchField]
619
- ];
620
- if (!m(i) || i.kind !== "semantic" && i.kind !== "physical" || !P(i) || !m(t.labelField) || !m(t.valueField) || t.searchField !== void 0 && !m(t.searchField) || t.disambiguationFields !== void 0 && (!Array.isArray(t.disambiguationFields) || !t.disambiguationFields.every(m))) {
621
- s.push({
622
- code: "invalid_option_source",
623
- path: n,
624
- message: `${n} must contain a valid semantic or physical source and field references.`,
625
- inputId: e
626
- });
627
- return;
628
- }
629
- for (const [c, r] of a)
630
- r !== void 0 && m(r) && (!h(r.name) || r.source !== void 0 && !y(
631
- r.source,
632
- i
633
- )) && s.push({
634
- code: "invalid_option_source",
635
- path: `${n}.${c}`,
636
- message: `${n}.${c} must be a named field belonging to the declared option source.`,
637
- inputId: e
638
- });
639
- for (const [c, r] of ((o = t.disambiguationFields) == null ? void 0 : o.entries()) || [])
640
- (!m(r) || !h(r.name) || r.source !== void 0 && !y(
641
- r.source,
642
- i
643
- )) && s.push({
644
- code: "invalid_option_source",
645
- path: `${n}.disambiguationFields[${c}]`,
646
- message: `${n}.disambiguationFields[${c}] must be a named field belonging to the declared option source.`,
647
- inputId: e
648
- });
649
- const d = t.valueField;
650
- ["string", "number", "boolean", "date", "datetime"].includes(
651
- String(d.dataType)
652
- ) || s.push({
653
- code: "invalid_option_source",
654
- path: `${n}.valueField.dataType`,
655
- message: `${n}.valueField.dataType must be a known option-value datatype.`,
656
- inputId: e
657
- });
658
- }
659
- function ke(e, t, n, s, i, a) {
660
- var r;
661
- if (h(t.bindingId) || i.push({
662
- code: "invalid_binding_id",
663
- path: `${n}.bindingId`,
664
- message: `${n}.bindingId must be an opaque non-empty id.`,
665
- inputId: e,
666
- cardId: t.cardId
667
- }), ((r = t.target) == null ? void 0 : r.kind) !== "field") {
668
- i.push({
669
- code: "unsupported_target",
670
- path: `${n}.target`,
671
- message: `${n}.target must be one direct field target.`,
672
- inputId: e,
673
- cardId: t.cardId,
674
- bindingId: t.bindingId
675
- });
676
- return;
677
- }
678
- const d = t.target.field;
679
- if (!h(d == null ? void 0 : d.name) || !d.source || d.source.kind !== "semantic" && d.source.kind !== "physical" || !P(d.source)) {
680
- i.push({
681
- code: "invalid_target_field",
682
- path: `${n}.target.field`,
683
- message: `${n}.target.field must have a name and a source-qualified semantic or physical identity.`,
684
- inputId: e,
685
- cardId: t.cardId,
686
- bindingId: t.bindingId
687
- });
688
- return;
689
- }
690
- if (Object.prototype.hasOwnProperty.call(
691
- Te,
692
- d.dataType
693
- ) || i.push({
694
- code: "unknown_target_data_type",
695
- path: `${n}.target.field.dataType`,
696
- message: `${n}.target.field.dataType must be known.`,
697
- inputId: e,
698
- cardId: t.cardId,
699
- bindingId: t.bindingId
700
- }), d.sourceField !== void 0 && !h(d.sourceField) && i.push({
701
- code: "invalid_target_field",
702
- path: `${n}.target.field.sourceField`,
703
- message: `${n}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,
704
- inputId: e,
705
- cardId: t.cardId,
706
- bindingId: t.bindingId
707
- }), !a) return;
708
- const o = s.get(t.cardId);
709
- if (!o) {
710
- i.push({
711
- code: "unknown_card",
712
- path: `${n}.cardId`,
713
- message: `${n}.cardId '${t.cardId}' does not exist.`,
714
- inputId: e,
715
- cardId: t.cardId,
716
- bindingId: t.bindingId
717
- });
718
- return;
719
- }
720
- const c = ue(o);
721
- (c.kind === "unconfigured" || !me(c, d.source)) && i.push({
722
- code: "unavailable_card_source",
723
- path: `${n}.target.field.source`,
724
- message: `${n}.target field source is not declared by card '${o.id}'.`,
725
- inputId: e,
726
- cardId: o.id,
727
- bindingId: t.bindingId
728
- });
729
- }
730
- function Ee(e, t, n, s, i, a) {
731
- if (t === void 0) return;
732
- if (!m(t) || t.kind !== "cardMappings" || !Array.isArray(t.cards)) {
733
- i.push({
734
- code: "invalid_application",
735
- path: n,
736
- message: `${n} must be a cardMappings application with a cards array.`,
737
- inputId: e
738
- });
739
- return;
740
- }
741
- const d = /* @__PURE__ */ new Set();
742
- t.cards.forEach((o, c) => {
743
- const r = `${n}.cards[${c}]`;
744
- if (!h(o == null ? void 0 : o.cardId)) {
745
- i.push({
746
- code: "unknown_card",
747
- path: `${r}.cardId`,
748
- message: `${r}.cardId is required.`,
749
- inputId: e
750
- });
751
- return;
752
- }
753
- if (d.has(o.cardId)) {
754
- i.push({
755
- code: "duplicate_card_application",
756
- path: `${r}.cardId`,
757
- message: `${n} contains more than one entry for card '${o.cardId}'.`,
758
- inputId: e,
759
- cardId: o.cardId
760
- });
761
- return;
762
- }
763
- if (d.add(o.cardId), a && !s.has(o.cardId)) {
764
- i.push({
765
- code: "unknown_card",
766
- path: `${r}.cardId`,
767
- message: `${r}.cardId '${o.cardId}' does not exist.`,
768
- inputId: e,
769
- cardId: o.cardId
770
- });
771
- return;
772
- }
773
- o.kind === "bound" ? ke(
774
- e,
775
- o,
776
- r,
777
- s,
778
- i,
779
- a
780
- ) : o.kind !== "excluded" && i.push({
781
- code: "invalid_application",
782
- path: r,
783
- message: `${r}.kind must be 'bound' or 'excluded'.`,
784
- inputId: e,
785
- cardId: o.cardId
786
- });
787
- });
788
- }
789
- function Ce({
790
- inputs: e,
791
- dashboardFilters: t,
792
- cards: n = [],
793
- validateCardTargets: s = !1
794
- }) {
795
- const i = [], a = new Map(
796
- (t || []).map((r) => [r.id, r])
797
- ), d = new Map(
798
- s ? n.map((r) => [r.id, r]) : []
799
- ), o = [], c = /* @__PURE__ */ new Map();
800
- return e != null && !Array.isArray(e) ? (i.push({
801
- code: "invalid_input",
802
- path: "dashboard.inputs",
803
- message: "dashboard.inputs must be an array when present."
804
- }), { ok: !1, inputs: o, issues: i }) : ((Array.isArray(e) ? e : []).forEach((r, g) => {
805
- const f = `dashboard.inputs[${g}]`;
806
- if (!m(r) || r.kind !== "filter" && r.kind !== "control" || !h(r.id) || !h(r.label) || !h(r.variableName) || !Ne(r.scope) || !$e(r.runtimeScope)) {
807
- i.push({
808
- code: "invalid_input",
809
- path: f,
810
- message: `${f} must be a complete filter or control Dashboard Input envelope.`,
811
- inputId: m(r) && typeof r.id == "string" ? r.id : void 0
812
- });
813
- return;
814
- }
815
- if (r.kind === "control" && !m(r.control)) {
816
- i.push({
817
- code: "invalid_input",
818
- path: `${f}.control`,
819
- message: `${f}.control must be a control definition.`,
820
- inputId: r.id
821
- });
822
- return;
823
- }
824
- const u = r;
825
- if (u.kind === "control") {
826
- o.push(u);
827
- return;
828
- }
829
- const k = u.filter, p = u.filterReference, v = k !== void 0, L = !!p;
830
- if (v && L) {
831
- i.push({
832
- code: "both_filter_definitions",
833
- path: f,
834
- message: `${f} must contain either filter or filterReference, not both.`,
835
- inputId: u.id
836
- });
837
- return;
838
- }
839
- if (!v && !L) {
840
- i.push({
841
- code: "missing_filter_definition",
842
- path: f,
843
- message: `${f} must contain filter or filterReference.`,
844
- inputId: u.id
845
- });
846
- return;
847
- }
848
- if (v && !_e(k)) {
849
- i.push({
850
- code: "invalid_input",
851
- path: `${f}.filter`,
852
- message: `${f}.filter must be a complete dashboard filter definition.`,
853
- inputId: u.id
854
- });
855
- return;
856
- }
857
- let b, E;
858
- if (v)
859
- b = k, E = "embedded";
860
- else {
861
- if ((p == null ? void 0 : p.kind) !== "dashboardFilter") {
862
- i.push({
863
- code: "invalid_filter_reference",
864
- path: `${f}.filterReference.kind`,
865
- message: `${f}.filterReference.kind must be 'dashboardFilter'.`,
866
- inputId: u.id
867
- });
868
- return;
869
- }
870
- const C = typeof (p == null ? void 0 : p.filterId) == "string" ? p.filterId : void 0;
871
- if (b = C ? a.get(C) : void 0, E = "dashboardFilter", !b) {
872
- i.push({
873
- code: "orphaned_filter_reference",
874
- path: `${f}.filterReference.filterId`,
875
- message: `${f}.filterReference cannot resolve dashboard filter '${C || ""}'.`,
876
- inputId: u.id
877
- });
878
- return;
879
- }
880
- if (b.kind === "global-date") {
881
- i.push({
882
- code: "global_date_reference",
883
- path: `${f}.filterReference`,
884
- message: `${f}.filterReference cannot reference the Global Date filter.`,
885
- inputId: u.id
886
- });
887
- return;
888
- }
889
- const W = c.get(b.id);
890
- if (W) {
891
- i.push({
892
- code: "duplicate_filter_reference",
893
- path: `${f}.filterReference.filterId`,
894
- message: `${f}.filterReference duplicates dashboard filter '${b.id}' already owned by Dashboard Input '${W}'.`,
895
- inputId: u.id
896
- });
897
- return;
898
- }
899
- c.set(b.id, u.id);
900
- }
901
- if (!b) return;
902
- if (u.optionSource !== void 0 && De(
903
- u.id,
904
- u.optionSource,
905
- `${f}.optionSource`,
906
- i
907
- ), u.application && b.kind === "global-date") {
908
- i.push({
909
- code: "global_date_reference",
910
- path: `${f}.application`,
911
- message: `${f}.application cannot map the Global Date filter.`,
912
- inputId: u.id
913
- });
914
- return;
915
- }
916
- u.application && u.scope.kind !== "allSheets" && u.scope.kind !== "sheets" && i.push({
917
- code: "unsupported_mapped_scope",
918
- path: `${f}.scope`,
919
- message: `${f}.scope must be allSheets or sheets when cardMappings are present.`,
920
- inputId: u.id
921
- }), Ee(
922
- u.id,
923
- u.application,
924
- `${f}.application`,
925
- d,
926
- i,
927
- s
928
- );
929
- const {
930
- filter: xe,
931
- filterReference: we,
932
- // A reference-backed authored input must shadow the generated
933
- // dashboard-filter compatibility input. Older writers may have copied
934
- // the compatibility marker onto the reference; never preserve it.
935
- compatibility: j,
936
- ...ee
937
- } = u;
938
- o.push({
939
- ...ee,
940
- filter: b,
941
- ...v && j ? { compatibility: j } : {},
942
- ...u.optionSource ? {
943
- optionSource: u.optionSource
944
- } : {},
945
- definitionOrigin: E
946
- });
947
- }), i.length ? { ok: !1, inputs: o, issues: i } : { ok: !0, inputs: o });
948
- }
949
- function Ge(e) {
950
- const t = Ce(e);
951
- if (!t.ok) throw new ve(t.issues);
952
- return t.inputs;
953
- }
954
- function Xe(e = () => globalThis.crypto.randomUUID()) {
955
- return e();
956
- }
957
- const Ae = {
958
- date: /* @__PURE__ */ new Set([
959
- "between",
960
- "not between",
961
- "=",
962
- "!=",
963
- ">",
964
- ">=",
965
- "<",
966
- "<=",
967
- "is null",
968
- "is not null"
969
- ]),
970
- number: /* @__PURE__ */ new Set([
971
- "between",
972
- "not between",
973
- "=",
974
- "!=",
975
- ">",
976
- ">=",
977
- "<",
978
- "<=",
979
- "in",
980
- "not in",
981
- "is null",
982
- "is not null"
983
- ]),
984
- string: /* @__PURE__ */ new Set([
985
- "=",
986
- "!=",
987
- "in",
988
- "not in",
989
- "like",
990
- "not like",
991
- "is null",
992
- "is not null"
993
- ]),
994
- boolean: /* @__PURE__ */ new Set(["=", "!=", "in", "not in", "is null", "is not null"])
995
- };
996
- function Re(e) {
997
- const t = x(e);
998
- return t === "number" || t === "boolean" ? t : t === "date" || t === "datetime" ? "date" : "string";
999
- }
1000
- function Ze(e, t) {
1001
- return typeof t != "string" ? !1 : Ae[Re(e)].has(t);
1002
- }
1003
- export {
1004
- ve as D,
1005
- Je as a,
1006
- ue as b,
1007
- V as c,
1008
- me as d,
1009
- he as e,
1010
- He as f,
1011
- Qe as g,
1012
- Ie as h,
1013
- Ke as i,
1014
- Ye as j,
1015
- Ge as k,
1016
- Xe as l,
1017
- oe as m,
1018
- Ce as n,
1019
- Re as o,
1020
- Ze as p,
1021
- je as q,
1022
- Ue as r,
1023
- We as s,
1024
- Le as t,
1025
- Oe as u
1026
- };