react-semaphor 0.1.469 → 0.1.471

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 (93) hide show
  1. package/README.md +10 -0
  2. package/dist/analytics-protocol/index.cjs +1 -1
  3. package/dist/analytics-protocol/index.js +107 -106
  4. package/dist/brand-studio/index.cjs +1 -1
  5. package/dist/brand-studio/index.js +4 -4
  6. package/dist/briefings/index.cjs +1 -1
  7. package/dist/briefings/index.js +4 -4
  8. package/dist/chunks/{analyze-result-contract-kaCNxjA7.js → analyze-result-contract-B3agc2XU.js} +1 -1
  9. package/dist/chunks/{analyze-result-contract-CMwVg9w2.cjs → analyze-result-contract-OgPk-zGu.cjs} +1 -1
  10. package/dist/chunks/{common-types-tRK8fhXV.cjs → common-types-C1IM7gao.cjs} +1 -1
  11. package/dist/chunks/{common-types-BgI-ymBp.js → common-types-g_1fKJLK.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-kKSBCRLE.js → dashboard-briefing-launcher-C2-b7rZU.js} +10 -10
  13. package/dist/chunks/dashboard-briefing-launcher-ChHmLu0F.cjs +26 -0
  14. package/dist/chunks/{dashboard-controls-DP2rftVR.js → dashboard-controls-Db7VOHdj.js} +9 -9
  15. package/dist/chunks/{dashboard-controls-Z8ow3GV6.cjs → dashboard-controls-kw4QQDSz.cjs} +1 -1
  16. package/dist/chunks/dashboard-filter-value-compatibility-Dmh-NaPK.cjs +1 -0
  17. package/dist/chunks/dashboard-filter-value-compatibility-ilbH2A31.js +836 -0
  18. package/dist/chunks/{dashboard-input-contract-12mPNhCF.cjs → dashboard-input-contract-JFJZgenC.cjs} +1 -1
  19. package/dist/chunks/{dashboard-input-contract-Ciboc347.js → dashboard-input-contract-Vr_3ApfF.js} +1 -1
  20. package/dist/chunks/{dashboard-json-CPq7IMvR.cjs → dashboard-json-Cu37kF4Q.cjs} +1 -1
  21. package/dist/chunks/{dashboard-json-3qT123Xa.js → dashboard-json-Dp-38lll.js} +7 -7
  22. package/dist/chunks/{edit-dashboard-visual-7eUCTZnx.cjs → edit-dashboard-visual-Cbtpwhlp.cjs} +33 -33
  23. package/dist/chunks/{edit-dashboard-visual-Clz6LQOX.js → edit-dashboard-visual-CffII05Z.js} +3611 -3713
  24. package/dist/chunks/{editor-action-buttons-WJFWflfs.cjs → editor-action-buttons-DcTGZa2C.cjs} +1 -1
  25. package/dist/chunks/{editor-action-buttons-CFbMRQSE.js → editor-action-buttons-DqwDHxFv.js} +6 -6
  26. package/dist/chunks/{index-CQN-X1jN.cjs → index-B4VxBoJg.cjs} +1 -1
  27. package/dist/chunks/{index-8Cm77joZ.js → index-CUf0lwSP.js} +24824 -24881
  28. package/dist/chunks/{index-DKaQRhKm.cjs → index-DUYREWSl.cjs} +227 -227
  29. package/dist/chunks/{index-DO4BESNy.js → index-oVXvCLH-.js} +9 -9
  30. package/dist/chunks/{matrix-result-contract-ClC6Pd_g.js → matrix-result-contract-DoU9diAh.js} +3 -3
  31. package/dist/chunks/{matrix-result-contract-DF-qt0jx.cjs → matrix-result-contract-SrzyG_KQ.cjs} +1 -1
  32. package/dist/chunks/{pivot-header-presentation-OpY8xzdT.js → pivot-header-presentation-7XrwJYDm.js} +102 -95
  33. package/dist/chunks/pivot-header-presentation-Cr6pU5JL.cjs +4 -0
  34. package/dist/chunks/{pivot-result-identity-CCMpd8ZA.js → pivot-result-identity-5v4hRVbc.js} +1 -1
  35. package/dist/chunks/{pivot-result-identity-gsOwOjHi.cjs → pivot-result-identity-DRUlTWUq.cjs} +1 -1
  36. package/dist/chunks/{pivot-result-lifecycle-CEfU43GZ.cjs → pivot-result-lifecycle-DJgO2P0H.cjs} +1 -1
  37. package/dist/chunks/{pivot-result-lifecycle-B38AZx4a.js → pivot-result-lifecycle-O_roVguV.js} +7 -7
  38. package/dist/chunks/{raw-temporal-contract-r_EMdR85.js → raw-temporal-contract-BEMf3avg.js} +1 -1
  39. package/dist/chunks/{raw-temporal-contract-UdblxoVB.cjs → raw-temporal-contract-D8YuxTAg.cjs} +1 -1
  40. package/dist/chunks/{report-preferences-dialog-C5UOCTwt.cjs → report-preferences-dialog-BEe2cTT-.cjs} +1 -1
  41. package/dist/chunks/{report-preferences-dialog-D-NDYRrk.js → report-preferences-dialog-C_FTOmOg.js} +6 -6
  42. package/dist/chunks/{report-runtime-context-CcXUjpb-.js → report-runtime-context-DnNbpkGo.js} +1 -1
  43. package/dist/chunks/{report-runtime-context-CLtzrZdC.cjs → report-runtime-context-RFiWq4wK.cjs} +1 -1
  44. package/dist/chunks/{saved-temporal-bucket-format-hylaofsQ.js → saved-temporal-bucket-format-CygnBDO2.js} +24 -24
  45. package/dist/chunks/{saved-temporal-bucket-format-Ca4hUfTo.cjs → saved-temporal-bucket-format-DNMtD77o.cjs} +1 -1
  46. package/dist/chunks/{switch-DyE2_OmQ.cjs → switch-CQN9Hzho.cjs} +19 -19
  47. package/dist/chunks/{switch-BagpmPNw.js → switch-n2yUNY8i.js} +177 -164
  48. package/dist/chunks/{temporal-bucket-BDRcWdVv.cjs → temporal-bucket-9Wz9Ds6H.cjs} +1 -1
  49. package/dist/chunks/{temporal-bucket-Cc9fmx8s.js → temporal-bucket-CUKJktCl.js} +1 -1
  50. package/dist/chunks/{temporal-bucket-authoring-DjPFtRSF.js → temporal-bucket-authoring-CZoJV2L6.js} +3 -3
  51. package/dist/chunks/{temporal-bucket-authoring-C6sZAVqS.cjs → temporal-bucket-authoring-DSpzgXHc.cjs} +1 -1
  52. package/dist/chunks/{temporal-bucket-contract-vrOkax-r.cjs → temporal-bucket-contract-BD862TAa.cjs} +1 -1
  53. package/dist/chunks/{temporal-bucket-contract-DT4kU0VY.js → temporal-bucket-contract-Cno9TlYr.js} +1 -1
  54. package/dist/chunks/{token-types-DALtlgbG.cjs → token-types-CoHsSJ4E.cjs} +1 -1
  55. package/dist/chunks/{token-types-Z889rD6g.js → token-types-W3EHNW-D.js} +1 -1
  56. package/dist/chunks/{update-policy-Cyufdviq.cjs → update-policy-BGNXFgBU.cjs} +1 -1
  57. package/dist/chunks/{update-policy-Bu5Tw43R.js → update-policy-kRNJwwUV.js} +1 -1
  58. package/dist/chunks/{validators-DhTaCK1O.js → validators-B5t1s8oh.js} +274 -266
  59. package/dist/chunks/validators-DcshgK7w.cjs +1 -0
  60. package/dist/dashboard/index.cjs +1 -1
  61. package/dist/dashboard/index.js +2 -2
  62. package/dist/dashboard-authoring/index.cjs +1 -1
  63. package/dist/dashboard-authoring/index.js +4 -4
  64. package/dist/data-app-builder/index.cjs +1 -1
  65. package/dist/data-app-builder/index.js +2 -2
  66. package/dist/data-app-codegen/index.cjs +1 -1
  67. package/dist/data-app-codegen/index.js +2 -2
  68. package/dist/data-app-codegen-node/index.cjs +1 -1
  69. package/dist/data-app-codegen-node/index.js +3 -3
  70. package/dist/data-app-sdk/index.cjs +1 -1
  71. package/dist/data-app-sdk/index.js +3 -3
  72. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  73. package/dist/data-app-sdk-adapters/index.js +2 -2
  74. package/dist/data-app-sdk-validation/index.cjs +1 -1
  75. package/dist/data-app-sdk-validation/index.js +3 -3
  76. package/dist/format-utils/index.cjs +3 -3
  77. package/dist/format-utils/index.js +72 -69
  78. package/dist/index.cjs +1 -1
  79. package/dist/index.js +14 -14
  80. package/dist/report-runtime-context/index.cjs +1 -1
  81. package/dist/report-runtime-context/index.js +2 -2
  82. package/dist/surfboard/index.cjs +1 -1
  83. package/dist/surfboard/index.js +3 -3
  84. package/dist/types/analytics-protocol.d.ts +13 -0
  85. package/dist/types/format-utils.d.ts +9 -0
  86. package/dist/types/index.cjs +1 -1
  87. package/dist/types/index.js +4 -4
  88. package/package.json +1 -1
  89. package/dist/chunks/dashboard-briefing-launcher-BqxcYhO2.cjs +0 -26
  90. package/dist/chunks/dashboard-filter-value-compatibility-Ce7jUVh-.js +0 -692
  91. package/dist/chunks/dashboard-filter-value-compatibility-iCPBcrRS.cjs +0 -1
  92. package/dist/chunks/pivot-header-presentation-DyV0iOZ_.cjs +0 -4
  93. package/dist/chunks/validators-DO-YuzgO.cjs +0 -1
@@ -1,692 +0,0 @@
1
- var O = Object.defineProperty;
2
- var M = (e, n, i) => n in e ? O(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
- var C = (e, n, i) => M(e, typeof n != "symbol" ? n + "" : n, i);
4
- import { ah as h, aj as S, h as N, ag as q, B as I, E as D } from "./validators-DhTaCK1O.js";
5
- import "./analyze-result-contract-kaCNxjA7.js";
6
- import "../value-format-preferences/index.js";
7
- function p(e) {
8
- return !!e && typeof e == "object" && !Array.isArray(e);
9
- }
10
- function E(e) {
11
- return p(e) && typeof e.name == "string";
12
- }
13
- function _(e) {
14
- return !p(e) || e.kind !== "semantic" && e.kind !== "physical" || (e.kind === "semantic" ? [e.datasetId, e.datasetName, e.connectionId] : [e.databaseName, e.schemaName]).some(
15
- (i) => i !== void 0 && typeof i != "string"
16
- ) ? !1 : N(
17
- e
18
- );
19
- }
20
- function x(e, n) {
21
- var c, o;
22
- if ((n == null ? void 0 : n.mode) !== "database" && e.type === "dataset" && "domainId" in e && e.domainId) {
23
- const r = e, a = {
24
- kind: "semantic",
25
- domainId: r.domainId,
26
- datasetId: r.id,
27
- datasetName: r.name,
28
- connectionId: r.connectionId || (n == null ? void 0 : n.connectionId),
29
- label: r.label
30
- };
31
- return _(a) ? q(a) : void 0;
32
- }
33
- const i = e.connectionId || (n == null ? void 0 : n.connectionId), d = e.type === "dataset" && "table" in e && e.table ? e.table : e.name;
34
- if (!i || !d)
35
- return;
36
- const t = {
37
- kind: "physical",
38
- connectionId: i,
39
- connectionType: e.connectionType || (n == null ? void 0 : n.connectionType),
40
- tableName: d,
41
- databaseName: e.database || ((c = n == null ? void 0 : n.dbSelection) == null ? void 0 : c.database),
42
- schemaName: e.schema || ((o = n == null ? void 0 : n.dbSelection) == null ? void 0 : o.schema),
43
- dialect: e.dialect
44
- };
45
- return _(t) ? t : void 0;
46
- }
47
- function H(e, n) {
48
- var r, a;
49
- const i = x(e, n);
50
- if (!i) return;
51
- const d = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, t = i.kind === "physical" ? i.tableName : d, c = e.connectionId || (n == null ? void 0 : n.connectionId), o = t && c ? {
52
- connectionId: c,
53
- databaseName: e.database || ((r = n == null ? void 0 : n.dbSelection) == null ? void 0 : r.database),
54
- schemaName: e.schema || ((a = n == null ? void 0 : n.dbSelection) == null ? void 0 : a.schema),
55
- tableName: t
56
- } : void 0;
57
- return { source: i, ...o ? { executionTable: o } : {} };
58
- }
59
- function L(e) {
60
- const n = p(e.dataSource) ? e.dataSource : void 0;
61
- if (typeof e.sql == "string" && e.sql.trim()) {
62
- const o = [], r = Array.isArray(n == null ? void 0 : n.selectedEntities) ? n.selectedEntities : [];
63
- for (const a of r) {
64
- if (!E(a)) continue;
65
- const s = H(a, n);
66
- s && !o.some(
67
- (F) => h(
68
- F.source,
69
- s.source
70
- )
71
- ) && o.push(s);
72
- }
73
- return {
74
- cardId: e.id,
75
- kind: "sql",
76
- pinnedCatalogSources: o
77
- };
78
- }
79
- if (!p(e.config))
80
- return { cardId: e.id, kind: "unconfigured" };
81
- const i = [], d = p(e.config.matrixIntent) ? e.config.matrixIntent : void 0, t = e.type === "matrixTable" ? (d == null ? void 0 : d.kind) === "matrix" ? d.source : e.config.source : void 0;
82
- _(t) && i.push(t);
83
- const c = p(e.config.joinPlan) ? e.config.joinPlan : void 0;
84
- if (c) {
85
- const o = Array.isArray(c.joins) ? c.joins : [], r = [c.baseEntity];
86
- for (const a of o)
87
- p(a) && r.push(a.source, a.target);
88
- for (const a of r) {
89
- if (!E(a)) continue;
90
- const s = x(a, n);
91
- s && i.push(s);
92
- }
93
- } else if (e.type !== "matrixTable") {
94
- const o = Array.isArray(n == null ? void 0 : n.selectedEntities) ? n.selectedEntities : [];
95
- if (o.length === 1 && E(o[0])) {
96
- const r = x(o[0], n);
97
- r && i.push(r);
98
- }
99
- }
100
- if (!i.length && !c && e.type !== "matrixTable") {
101
- const o = e.config.queryBaseSource;
102
- _(o) && i.push(o);
103
- }
104
- return {
105
- cardId: e.id,
106
- kind: "config",
107
- executableSources: S(i)
108
- };
109
- }
110
- function V(e, n) {
111
- return (e.kind === "config" ? e.executableSources : e.kind === "sql" ? e.pinnedCatalogSources.map((d) => d.source) : []).some(
112
- (d) => h(d, n)
113
- );
114
- }
115
- function ge(e, n) {
116
- if (e.kind === "config")
117
- return e.executableSources.find(
118
- (i) => h(i, n)
119
- );
120
- }
121
- function he(e, n) {
122
- var i;
123
- return (i = j(e, n)) == null ? void 0 : i.source;
124
- }
125
- function j(e, n) {
126
- if (e.kind === "sql")
127
- return e.pinnedCatalogSources.find(
128
- (i) => h(i.source, n)
129
- );
130
- }
131
- function P(e) {
132
- const n = /* @__PURE__ */ new Set();
133
- for (const i of [e.name, e.sourceField]) {
134
- if (!i) continue;
135
- const d = I(i);
136
- if (!d) continue;
137
- n.add(d);
138
- const t = d.split("."), c = t[t.length - 1];
139
- c && n.add(c);
140
- }
141
- return n;
142
- }
143
- function B(e, n) {
144
- const i = D(e), d = D(n);
145
- return i === "unknown" || d === "unknown" ? !1 : (i === "date" || i === "datetime") && (d === "date" || d === "datetime") ? !0 : i === d;
146
- }
147
- function U(e, n) {
148
- return h(e.field.source, n.field.source) && I(e.field.name) === I(n.field.name) && I(e.field.sourceField || e.field.name) === I(n.field.sourceField || n.field.name);
149
- }
150
- function W(e, n) {
151
- if (e.kind !== "field") return !1;
152
- const i = P(n), d = P(e.field);
153
- return B(n.dataType, e.field.dataType) && [...d].some((t) => i.has(t));
154
- }
155
- function pe(e) {
156
- const n = e.candidates.filter(
157
- (i) => W(
158
- i,
159
- e.logicalValueField
160
- )
161
- );
162
- return n.length === 1 ? { status: "matched", target: n[0] } : n.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
163
- }
164
- function Ie(e) {
165
- const n = [];
166
- for (const i of e.acceptedTargets)
167
- !B(
168
- e.logicalValueField.dataType,
169
- i.field.dataType
170
- ) || n.some(
171
- (d) => U(d, i)
172
- ) || n.push(i);
173
- return n.length === 1 ? { status: "matched", target: n[0] } : n.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
174
- }
175
- const K = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, Y = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, G = /\bwhere\b/i;
176
- function J(e) {
177
- return e != null && e.trim() ? K.test(e) || Y.test(e) : !1;
178
- }
179
- function ye(e) {
180
- return !(e != null && e.trim()) || J(e) ? null : G.test(e) ? {
181
- helper: "{{ filters | and }}",
182
- description: "For queries with an existing WHERE clause."
183
- } : {
184
- helper: "{{ filters | where }}",
185
- description: "For queries without a WHERE clause."
186
- };
187
- }
188
- function Q(e) {
189
- return (e.field.sourceField || e.field.name).trim() || void 0;
190
- }
191
- function $e(e) {
192
- if (e.inventory.kind !== "sql" || e.target.kind !== "field")
193
- return { status: "ineligible" };
194
- const n = j(
195
- e.inventory,
196
- e.target.field.source
197
- ), i = Q(e.target);
198
- if (!n || !i) return { status: "ineligible" };
199
- if (n.executionTable) {
200
- const o = [
201
- n.executionTable.databaseName,
202
- n.executionTable.schemaName,
203
- n.executionTable.tableName,
204
- i
205
- ].filter(Boolean).join(".");
206
- return {
207
- status: "eligible",
208
- source: n.source,
209
- executionIdentifier: o
210
- };
211
- }
212
- if (e.inventory.pinnedCatalogSources.length !== 1)
213
- return { status: "ineligible" };
214
- const d = I(i), t = (e.candidateTargets || []).filter(
215
- (o) => I(
216
- o.field.sourceField || o.field.name
217
- ) === d
218
- ), c = [];
219
- for (const o of t)
220
- c.some(
221
- (r) => h(r, o.field.source)
222
- ) || c.push(o.field.source);
223
- return c.length > 1 ? { status: "ineligible" } : {
224
- status: "eligible",
225
- source: n.source,
226
- executionIdentifier: i
227
- };
228
- }
229
- class X extends Error {
230
- constructor(i) {
231
- super(i.map((d) => d.message).join(" "));
232
- C(this, "issues");
233
- this.name = "DashboardFilterMappingContractError", this.issues = i;
234
- }
235
- }
236
- const Z = {
237
- string: !0,
238
- number: !0,
239
- boolean: !0,
240
- date: !0,
241
- datetime: !0
242
- };
243
- function m(e) {
244
- return typeof e == "string" && e.trim().length > 0;
245
- }
246
- function f(e) {
247
- return !!e && typeof e == "object" && !Array.isArray(e);
248
- }
249
- function $(e) {
250
- return Array.isArray(e) && e.every((n) => typeof n == "string");
251
- }
252
- function ee(e) {
253
- if (!f(e)) return !1;
254
- switch (e.kind) {
255
- case "allSheets":
256
- return e.sheetKinds === void 0 || $(e.sheetKinds) && e.sheetKinds.every(
257
- (n) => n === "dashboard" || n === "document"
258
- );
259
- case "sheets":
260
- return $(e.sheetIds);
261
- case "cards":
262
- return $(e.cardIds);
263
- case "documentSections":
264
- return m(e.sheetId) && $(e.sectionIds);
265
- default:
266
- return !1;
267
- }
268
- }
269
- function ne(e) {
270
- return e === "shared" || e === "perSheet" || e === "perCard" || e === "perDocumentSection";
271
- }
272
- function ie(e) {
273
- return f(e) ? m(e.id) && m(e.column) && m(e.dataType) : !1;
274
- }
275
- function te(e, n, i, d) {
276
- var r;
277
- if (!f(n)) {
278
- d.push({
279
- code: "invalid_option_source",
280
- path: i,
281
- message: `${i} must be a semantic or physical option source.`,
282
- inputId: e
283
- });
284
- return;
285
- }
286
- const t = n.source, c = [
287
- ["labelField", n.labelField],
288
- ["valueField", n.valueField],
289
- ["searchField", n.searchField]
290
- ];
291
- if (!f(t) || t.kind !== "semantic" && t.kind !== "physical" || !N(t) || !f(n.labelField) || !f(n.valueField) || n.searchField !== void 0 && !f(n.searchField) || n.disambiguationFields !== void 0 && (!Array.isArray(n.disambiguationFields) || !n.disambiguationFields.every(f))) {
292
- d.push({
293
- code: "invalid_option_source",
294
- path: i,
295
- message: `${i} must contain a valid semantic or physical source and field references.`,
296
- inputId: e
297
- });
298
- return;
299
- }
300
- for (const [a, s] of c)
301
- s !== void 0 && f(s) && (!m(s.name) || s.source !== void 0 && !h(
302
- s.source,
303
- t
304
- )) && d.push({
305
- code: "invalid_option_source",
306
- path: `${i}.${a}`,
307
- message: `${i}.${a} must be a named field belonging to the declared option source.`,
308
- inputId: e
309
- });
310
- for (const [a, s] of ((r = n.disambiguationFields) == null ? void 0 : r.entries()) || [])
311
- (!f(s) || !m(s.name) || s.source !== void 0 && !h(
312
- s.source,
313
- t
314
- )) && d.push({
315
- code: "invalid_option_source",
316
- path: `${i}.disambiguationFields[${a}]`,
317
- message: `${i}.disambiguationFields[${a}] must be a named field belonging to the declared option source.`,
318
- inputId: e
319
- });
320
- const o = n.valueField;
321
- ["string", "number", "boolean", "date", "datetime"].includes(
322
- String(o.dataType)
323
- ) || d.push({
324
- code: "invalid_option_source",
325
- path: `${i}.valueField.dataType`,
326
- message: `${i}.valueField.dataType must be a known option-value datatype.`,
327
- inputId: e
328
- });
329
- }
330
- function se(e, n, i, d, t, c) {
331
- var s;
332
- if (m(n.bindingId) || t.push({
333
- code: "invalid_binding_id",
334
- path: `${i}.bindingId`,
335
- message: `${i}.bindingId must be an opaque non-empty id.`,
336
- inputId: e,
337
- cardId: n.cardId
338
- }), ((s = n.target) == null ? void 0 : s.kind) !== "field") {
339
- t.push({
340
- code: "unsupported_target",
341
- path: `${i}.target`,
342
- message: `${i}.target must be one direct field target.`,
343
- inputId: e,
344
- cardId: n.cardId,
345
- bindingId: n.bindingId
346
- });
347
- return;
348
- }
349
- const o = n.target.field;
350
- if (!m(o == null ? void 0 : o.name) || !o.source || o.source.kind !== "semantic" && o.source.kind !== "physical" || !N(o.source)) {
351
- t.push({
352
- code: "invalid_target_field",
353
- path: `${i}.target.field`,
354
- message: `${i}.target.field must have a name and a source-qualified semantic or physical identity.`,
355
- inputId: e,
356
- cardId: n.cardId,
357
- bindingId: n.bindingId
358
- });
359
- return;
360
- }
361
- if (Object.prototype.hasOwnProperty.call(
362
- Z,
363
- o.dataType
364
- ) || t.push({
365
- code: "unknown_target_data_type",
366
- path: `${i}.target.field.dataType`,
367
- message: `${i}.target.field.dataType must be known.`,
368
- inputId: e,
369
- cardId: n.cardId,
370
- bindingId: n.bindingId
371
- }), o.sourceField !== void 0 && !m(o.sourceField) && t.push({
372
- code: "invalid_target_field",
373
- path: `${i}.target.field.sourceField`,
374
- message: `${i}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,
375
- inputId: e,
376
- cardId: n.cardId,
377
- bindingId: n.bindingId
378
- }), !c) return;
379
- const r = d.get(n.cardId);
380
- if (!r) {
381
- t.push({
382
- code: "unknown_card",
383
- path: `${i}.cardId`,
384
- message: `${i}.cardId '${n.cardId}' does not exist.`,
385
- inputId: e,
386
- cardId: n.cardId,
387
- bindingId: n.bindingId
388
- });
389
- return;
390
- }
391
- const a = L(r);
392
- (a.kind === "unconfigured" || !V(a, o.source)) && t.push({
393
- code: "unavailable_card_source",
394
- path: `${i}.target.field.source`,
395
- message: `${i}.target field source is not declared by card '${r.id}'.`,
396
- inputId: e,
397
- cardId: r.id,
398
- bindingId: n.bindingId
399
- });
400
- }
401
- function re(e, n, i, d, t, c) {
402
- if (n === void 0) return;
403
- if (!f(n) || n.kind !== "cardMappings" || !Array.isArray(n.cards)) {
404
- t.push({
405
- code: "invalid_application",
406
- path: i,
407
- message: `${i} must be a cardMappings application with a cards array.`,
408
- inputId: e
409
- });
410
- return;
411
- }
412
- const o = /* @__PURE__ */ new Set();
413
- n.cards.forEach((r, a) => {
414
- const s = `${i}.cards[${a}]`;
415
- if (!m(r == null ? void 0 : r.cardId)) {
416
- t.push({
417
- code: "unknown_card",
418
- path: `${s}.cardId`,
419
- message: `${s}.cardId is required.`,
420
- inputId: e
421
- });
422
- return;
423
- }
424
- if (o.has(r.cardId)) {
425
- t.push({
426
- code: "duplicate_card_application",
427
- path: `${s}.cardId`,
428
- message: `${i} contains more than one entry for card '${r.cardId}'.`,
429
- inputId: e,
430
- cardId: r.cardId
431
- });
432
- return;
433
- }
434
- if (o.add(r.cardId), c && !d.has(r.cardId)) {
435
- t.push({
436
- code: "unknown_card",
437
- path: `${s}.cardId`,
438
- message: `${s}.cardId '${r.cardId}' does not exist.`,
439
- inputId: e,
440
- cardId: r.cardId
441
- });
442
- return;
443
- }
444
- r.kind === "bound" ? se(
445
- e,
446
- r,
447
- s,
448
- d,
449
- t,
450
- c
451
- ) : r.kind !== "excluded" && t.push({
452
- code: "invalid_application",
453
- path: s,
454
- message: `${s}.kind must be 'bound' or 'excluded'.`,
455
- inputId: e,
456
- cardId: r.cardId
457
- });
458
- });
459
- }
460
- function oe({
461
- inputs: e,
462
- dashboardFilters: n,
463
- cards: i = [],
464
- validateCardTargets: d = !1
465
- }) {
466
- const t = [], c = new Map(
467
- (n || []).map((s) => [s.id, s])
468
- ), o = new Map(
469
- d ? i.map((s) => [s.id, s]) : []
470
- ), r = [], a = /* @__PURE__ */ new Map();
471
- return e != null && !Array.isArray(e) ? (t.push({
472
- code: "invalid_input",
473
- path: "dashboard.inputs",
474
- message: "dashboard.inputs must be an array when present."
475
- }), { ok: !1, inputs: r, issues: t }) : ((Array.isArray(e) ? e : []).forEach((s, F) => {
476
- const u = `dashboard.inputs[${F}]`;
477
- if (!f(s) || s.kind !== "filter" && s.kind !== "control" || !m(s.id) || !m(s.label) || !m(s.variableName) || !ee(s.scope) || !ne(s.runtimeScope)) {
478
- t.push({
479
- code: "invalid_input",
480
- path: u,
481
- message: `${u} must be a complete filter or control Dashboard Input envelope.`,
482
- inputId: f(s) && typeof s.id == "string" ? s.id : void 0
483
- });
484
- return;
485
- }
486
- if (s.kind === "control" && !f(s.control)) {
487
- t.push({
488
- code: "invalid_input",
489
- path: `${u}.control`,
490
- message: `${u}.control must be a control definition.`,
491
- inputId: s.id
492
- });
493
- return;
494
- }
495
- const l = s;
496
- if (l.kind === "control") {
497
- r.push(l);
498
- return;
499
- }
500
- const T = l.filter, g = l.filterReference, y = T !== void 0, R = !!g;
501
- if (y && R) {
502
- t.push({
503
- code: "both_filter_definitions",
504
- path: u,
505
- message: `${u} must contain either filter or filterReference, not both.`,
506
- inputId: l.id
507
- });
508
- return;
509
- }
510
- if (!y && !R) {
511
- t.push({
512
- code: "missing_filter_definition",
513
- path: u,
514
- message: `${u} must contain filter or filterReference.`,
515
- inputId: l.id
516
- });
517
- return;
518
- }
519
- if (y && !ie(T)) {
520
- t.push({
521
- code: "invalid_input",
522
- path: `${u}.filter`,
523
- message: `${u}.filter must be a complete dashboard filter definition.`,
524
- inputId: l.id
525
- });
526
- return;
527
- }
528
- let b, k;
529
- if (y)
530
- b = T, k = "embedded";
531
- else {
532
- if ((g == null ? void 0 : g.kind) !== "dashboardFilter") {
533
- t.push({
534
- code: "invalid_filter_reference",
535
- path: `${u}.filterReference.kind`,
536
- message: `${u}.filterReference.kind must be 'dashboardFilter'.`,
537
- inputId: l.id
538
- });
539
- return;
540
- }
541
- const v = typeof (g == null ? void 0 : g.filterId) == "string" ? g.filterId : void 0;
542
- if (b = v ? c.get(v) : void 0, k = "dashboardFilter", !b) {
543
- t.push({
544
- code: "orphaned_filter_reference",
545
- path: `${u}.filterReference.filterId`,
546
- message: `${u}.filterReference cannot resolve dashboard filter '${v || ""}'.`,
547
- inputId: l.id
548
- });
549
- return;
550
- }
551
- if (b.kind === "global-date") {
552
- t.push({
553
- code: "global_date_reference",
554
- path: `${u}.filterReference`,
555
- message: `${u}.filterReference cannot reference the Global Date filter.`,
556
- inputId: l.id
557
- });
558
- return;
559
- }
560
- const w = a.get(b.id);
561
- if (w) {
562
- t.push({
563
- code: "duplicate_filter_reference",
564
- path: `${u}.filterReference.filterId`,
565
- message: `${u}.filterReference duplicates dashboard filter '${b.id}' already owned by Dashboard Input '${w}'.`,
566
- inputId: l.id
567
- });
568
- return;
569
- }
570
- a.set(b.id, l.id);
571
- }
572
- if (!b) return;
573
- if (l.optionSource !== void 0 && te(
574
- l.id,
575
- l.optionSource,
576
- `${u}.optionSource`,
577
- t
578
- ), l.application && b.kind === "global-date") {
579
- t.push({
580
- code: "global_date_reference",
581
- path: `${u}.application`,
582
- message: `${u}.application cannot map the Global Date filter.`,
583
- inputId: l.id
584
- });
585
- return;
586
- }
587
- l.application && l.scope.kind !== "allSheets" && l.scope.kind !== "sheets" && t.push({
588
- code: "unsupported_mapped_scope",
589
- path: `${u}.scope`,
590
- message: `${u}.scope must be allSheets or sheets when cardMappings are present.`,
591
- inputId: l.id
592
- }), re(
593
- l.id,
594
- l.application,
595
- `${u}.application`,
596
- o,
597
- t,
598
- d
599
- );
600
- const {
601
- filter: ce,
602
- filterReference: le,
603
- // A reference-backed authored input must shadow the generated
604
- // dashboard-filter compatibility input. Older writers may have copied
605
- // the compatibility marker onto the reference; never preserve it.
606
- compatibility: A,
607
- ...z
608
- } = l;
609
- r.push({
610
- ...z,
611
- filter: b,
612
- ...y && A ? { compatibility: A } : {},
613
- ...l.optionSource ? {
614
- optionSource: l.optionSource
615
- } : {},
616
- definitionOrigin: k
617
- });
618
- }), t.length ? { ok: !1, inputs: r, issues: t } : { ok: !0, inputs: r });
619
- }
620
- function _e(e) {
621
- const n = oe(e);
622
- if (!n.ok) throw new X(n.issues);
623
- return n.inputs;
624
- }
625
- function Fe(e = () => globalThis.crypto.randomUUID()) {
626
- return e();
627
- }
628
- const de = {
629
- date: /* @__PURE__ */ new Set([
630
- "between",
631
- "not between",
632
- "=",
633
- "!=",
634
- ">",
635
- ">=",
636
- "<",
637
- "<=",
638
- "is null",
639
- "is not null"
640
- ]),
641
- number: /* @__PURE__ */ new Set([
642
- "between",
643
- "not between",
644
- "=",
645
- "!=",
646
- ">",
647
- ">=",
648
- "<",
649
- "<=",
650
- "in",
651
- "not in",
652
- "is null",
653
- "is not null"
654
- ]),
655
- string: /* @__PURE__ */ new Set([
656
- "=",
657
- "!=",
658
- "in",
659
- "not in",
660
- "like",
661
- "not like",
662
- "is null",
663
- "is not null"
664
- ]),
665
- boolean: /* @__PURE__ */ new Set(["=", "!=", "in", "not in", "is null", "is not null"])
666
- };
667
- function ae(e) {
668
- const n = D(e);
669
- return n === "number" || n === "boolean" ? n : n === "date" || n === "datetime" ? "date" : "string";
670
- }
671
- function Te(e, n) {
672
- return typeof n != "string" ? !1 : de[ae(e)].has(n);
673
- }
674
- export {
675
- X as D,
676
- he as a,
677
- L as b,
678
- j as c,
679
- V as d,
680
- W as e,
681
- ge as f,
682
- Ie as g,
683
- J as h,
684
- ye as i,
685
- $e as j,
686
- _e as k,
687
- Fe as l,
688
- ae as m,
689
- oe as n,
690
- Te as o,
691
- pe as r
692
- };