react-semaphor 0.1.337 → 0.1.339

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 (59) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +58 -57
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +3 -3
  5. package/dist/chunks/{braces-Q86XHDaD.js → braces-Ccvdip75.js} +1 -1
  6. package/dist/chunks/{braces-BLa_lORs.js → braces-DDHkbW1c.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-Cocogo9H.js → calendar-preferences-dialog-2IbYrrP1.js} +3 -3
  8. package/dist/chunks/{calendar-preferences-dialog-Bm7ji3k9.js → calendar-preferences-dialog-8-KE5sVX.js} +1 -1
  9. package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +100 -0
  10. package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +1 -0
  11. package/dist/chunks/{chevrons-up-down-BBTZ5pAY.js → chevrons-up-down-B9fTSds9.js} +1 -1
  12. package/dist/chunks/{chevrons-up-down-CYuWasy_.js → chevrons-up-down-pV0i9ptS.js} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-BtqtLx1-.js → dashboard-briefing-launcher-CcqDPVke.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-DF4CoaRn.js → dashboard-briefing-launcher-DtxDRAiu.js} +4 -4
  15. package/dist/chunks/{dashboard-controls-B5U-VUxs.js → dashboard-controls-Bi98DhYD.js} +6 -6
  16. package/dist/chunks/{dashboard-controls-0VMAeMoa.js → dashboard-controls-By7aKmDj.js} +1 -1
  17. package/dist/chunks/{dashboard-json-CqbLOfnr.js → dashboard-json-BOyLuhS6.js} +1 -1
  18. package/dist/chunks/{dashboard-json-Hmc0Ri5z.js → dashboard-json-CGxIsTEP.js} +2 -2
  19. package/dist/chunks/{edit-dashboard-visual-D4VVu-QQ.js → edit-dashboard-visual-Ba8LenNc.js} +6 -6
  20. package/dist/chunks/{edit-dashboard-visual-C0EDM0QB.js → edit-dashboard-visual-BuXlHmJH.js} +1 -1
  21. package/dist/chunks/{index-DE0vIuYG.js → index-DT9osgRT.js} +2 -2
  22. package/dist/chunks/{index-DzyUhzV3.js → index-DVPvpd8u.js} +5 -5
  23. package/dist/chunks/{palette-DalASD28.js → palette-BMXS-AcI.js} +1 -1
  24. package/dist/chunks/{palette-B9AbDw0n.js → palette-DKecBucs.js} +1 -1
  25. package/dist/chunks/{resource-management-panel-C4YydU9I.js → resource-management-panel-98Hy6SYB.js} +3 -3
  26. package/dist/chunks/{resource-management-panel-P9iNqBM1.js → resource-management-panel-ByR-FD3h.js} +1 -1
  27. package/dist/chunks/{switch-BAYfpAEb.js → switch-CP7SmEIZ.js} +1 -1
  28. package/dist/chunks/{switch-CyRoZr5T.js → switch-DYRgERrC.js} +1 -1
  29. package/dist/chunks/{use-create-flow-overlay-state-P1LMwQ89.js → use-create-flow-overlay-state-D5uvjbwY.js} +3 -3
  30. package/dist/chunks/{use-create-flow-overlay-state-CbhjxI3W.js → use-create-flow-overlay-state-uNxArZdj.js} +1 -1
  31. package/dist/chunks/{use-visual-utils-lB-3Zk0b.js → use-visual-utils-BLh9mKic.js} +2 -2
  32. package/dist/chunks/{use-visual-utils-CV6_-y4p.js → use-visual-utils-CpaqIHoc.js} +1 -1
  33. package/dist/chunks/{validators-BOqiGymD.js → validators-CPEQojnV.js} +325 -250
  34. package/dist/chunks/validators-CfP-49k9.js +1 -0
  35. package/dist/dashboard/index.cjs +1 -1
  36. package/dist/dashboard/index.js +1 -1
  37. package/dist/dashboard-authoring/index.cjs +3 -3
  38. package/dist/dashboard-authoring/index.js +424 -561
  39. package/dist/data-app-builder/index.cjs +1 -1
  40. package/dist/data-app-builder/index.js +1 -1
  41. package/dist/data-app-sdk/index.cjs +1 -1
  42. package/dist/data-app-sdk/index.js +313 -308
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +74 -48
  48. package/dist/types/dashboard-authoring.d.ts +33 -52
  49. package/dist/types/dashboard.d.ts +32 -0
  50. package/dist/types/data-app-builder.d.ts +23 -13
  51. package/dist/types/data-app-sdk.d.ts +33 -46
  52. package/dist/types/main.d.ts +37 -51
  53. package/dist/types/shared.d.ts +32 -0
  54. package/dist/types/surfboard.d.ts +32 -0
  55. package/dist/types/types.d.ts +32 -0
  56. package/package.json +1 -1
  57. package/dist/chunks/catalog-field-grounding-DmT7aGUA.js +0 -191
  58. package/dist/chunks/catalog-field-grounding-VgVzDd25.js +0 -1
  59. package/dist/chunks/validators-BtFXY3S_.js +0 -2
@@ -1,35 +1,94 @@
1
- function s(e, i, n) {
2
- return n ? { code: e, message: i, path: n } : { code: e, message: i };
3
- }
4
1
  function y(e) {
5
- const i = /* @__PURE__ */ new Set();
6
- for (const n of e) {
7
- if (i.has(n))
8
- return n;
9
- i.add(n);
2
+ return e ? e.kind === "semantic" ? [
3
+ e.kind,
4
+ e.domainId,
5
+ e.datasetId || "",
6
+ e.datasetName
7
+ ].join(":") : e.kind === "physical" ? [
8
+ e.kind,
9
+ e.connectionId,
10
+ e.databaseName || "",
11
+ e.schemaName || "",
12
+ e.tableName
13
+ ].join(":") : [
14
+ e.kind,
15
+ e.connectionId,
16
+ e.dialect || "",
17
+ e.label || ""
18
+ ].join(":") : "";
19
+ }
20
+ function I(e, i) {
21
+ return !e || !i ? e === i : e.kind !== i.kind ? !1 : e.kind === "semantic" && i.kind === "semantic" ? e.domainId !== i.domainId ? !1 : e.datasetId && i.datasetId ? e.datasetId === i.datasetId : e.datasetName === i.datasetName : y(e) === y(i);
22
+ }
23
+ function $(e, i) {
24
+ return e.kind !== "semantic" || i.kind !== "semantic" ? e : {
25
+ ...e,
26
+ datasetId: e.datasetId || i.datasetId,
27
+ label: e.label || i.label,
28
+ connectionId: e.connectionId || i.connectionId
29
+ };
30
+ }
31
+ function S(e, i) {
32
+ return e.name === i.name && I(e.source, i.source);
33
+ }
34
+ function D(e, i) {
35
+ return {
36
+ ...e,
37
+ label: e.label || i.label,
38
+ role: e.role || i.role,
39
+ dataType: e.dataType || i.dataType,
40
+ source: e.source && i.source ? $(e.source, i.source) : e.source || i.source
41
+ };
42
+ }
43
+ function n(e, i, s) {
44
+ return s ? { code: e, message: i, path: s } : { code: e, message: i };
45
+ }
46
+ function M(e) {
47
+ for (let i = 0; i < e.length; i += 1) {
48
+ const s = e[i];
49
+ if (e.some(
50
+ (r, o) => o !== i && _(r, s)
51
+ ))
52
+ return !1;
10
53
  }
11
- return null;
54
+ return !0;
55
+ }
56
+ function _(e, i) {
57
+ return S(e, i);
58
+ }
59
+ function N(e, i) {
60
+ const s = i.filter((r) => r.name === e.name);
61
+ return e.source ? s.some((r) => _(r, e)) : s.length === 1;
12
62
  }
13
- function a(e) {
63
+ function d(e) {
14
64
  return typeof e == "string" && e.trim().length > 0;
15
65
  }
16
- function p(e) {
66
+ function u(e) {
17
67
  return !!(e && typeof e == "object" && !Array.isArray(e));
18
68
  }
19
- function h(e, i, n, o = {}) {
69
+ function h(e) {
70
+ const i = /* @__PURE__ */ new Set();
71
+ for (const s of e) {
72
+ if (i.has(s))
73
+ return s;
74
+ i.add(s);
75
+ }
76
+ return null;
77
+ }
78
+ function v(e, i, s) {
20
79
  if (!e || typeof e != "object") {
21
- n.push(s("missing_source", "Analytics intent needs a source.", i));
80
+ s.push(n("missing_source", "Analytics intent needs a source.", i));
22
81
  return;
23
82
  }
24
83
  if (e.kind === "semantic") {
25
- a(e.domainId) || n.push(
26
- s(
84
+ d(e.domainId) || s.push(
85
+ n(
27
86
  "missing_semantic_domain",
28
87
  "Semantic source needs a domainId.",
29
88
  `${i}.domainId`
30
89
  )
31
- ), a(e.datasetName) || n.push(
32
- s(
90
+ ), d(e.datasetName) || s.push(
91
+ n(
33
92
  "missing_dataset_name",
34
93
  "Semantic source needs a datasetName.",
35
94
  `${i}.datasetName`
@@ -38,14 +97,14 @@ function h(e, i, n, o = {}) {
38
97
  return;
39
98
  }
40
99
  if (e.kind === "physical") {
41
- a(e.connectionId) || n.push(
42
- s(
100
+ d(e.connectionId) || s.push(
101
+ n(
43
102
  "missing_connection_id",
44
103
  "Physical source needs a connectionId.",
45
104
  `${i}.connectionId`
46
105
  )
47
- ), a(e.tableName) || n.push(
48
- s(
106
+ ), d(e.tableName) || s.push(
107
+ n(
49
108
  "missing_table_name",
50
109
  "Physical source needs a tableName.",
51
110
  `${i}.tableName`
@@ -54,36 +113,34 @@ function h(e, i, n, o = {}) {
54
113
  return;
55
114
  }
56
115
  if (e.kind === "sql") {
57
- a(e.connectionId) || n.push(
58
- s(
116
+ d(e.connectionId) || s.push(
117
+ n(
59
118
  "missing_connection_id",
60
119
  "SQL source needs a connectionId.",
61
120
  `${i}.connectionId`
62
121
  )
63
- ), o.requireSqlText !== !1 && !a(e.sql) && n.push(s("missing_sql", "SQL source needs SQL text.", `${i}.sql`));
122
+ );
64
123
  return;
65
124
  }
66
- n.push(s("invalid_source_kind", "Source kind is not supported.", i));
125
+ s.push(n("invalid_source_kind", "Source kind is not supported.", i));
67
126
  }
68
- function m(e, i, n, o = {}) {
69
- if (!e || !p(e)) {
70
- o.required && n.push(
71
- s("missing_field_ref", "Field reference needs a name.", i)
127
+ function f(e, i, s, r = {}) {
128
+ if (!e || !u(e)) {
129
+ r.required && s.push(
130
+ n("missing_field_ref", "Field reference needs a name.", i)
72
131
  );
73
132
  return;
74
133
  }
75
- a(e.name) || n.push(
76
- s("missing_field_ref", "Field reference needs a name.", `${i}.name`)
77
- ), e.source !== void 0 && h(e.source, `${i}.source`, n, {
78
- requireSqlText: !1
79
- });
134
+ d(e.name) || s.push(
135
+ n("missing_field_ref", "Field reference needs a name.", `${i}.name`)
136
+ ), e.source !== void 0 && v(e.source, `${i}.source`, s);
80
137
  }
81
- function k(e, i) {
138
+ function R(e, i) {
82
139
  if (e.analysis === void 0)
83
140
  return;
84
- if (!p(e.analysis)) {
141
+ if (!u(e.analysis)) {
85
142
  i.push(
86
- s(
143
+ n(
87
144
  "invalid_metric_analysis",
88
145
  "Metric analysis must be a structured object.",
89
146
  "analysis"
@@ -93,7 +150,7 @@ function k(e, i) {
93
150
  }
94
151
  if (e.analysis.kind !== "period_change") {
95
152
  i.push(
96
- s(
153
+ n(
97
154
  "invalid_metric_analysis",
98
155
  "Metric analysis kind is not supported.",
99
156
  "analysis.kind"
@@ -102,25 +159,25 @@ function k(e, i) {
102
159
  return;
103
160
  }
104
161
  e.dateField || i.push(
105
- s(
162
+ n(
106
163
  "missing_analysis_date_field",
107
164
  "Period-change analysis needs a dateField.",
108
165
  "dateField"
109
166
  )
110
167
  ), e.timeGrain || i.push(
111
- s(
168
+ n(
112
169
  "missing_analysis_time_grain",
113
170
  "Period-change analysis needs a timeGrain.",
114
171
  "timeGrain"
115
172
  )
116
173
  );
117
- const { timeWindow: n } = e.analysis;
118
- n !== void 0 && b(n, "analysis.timeWindow", i);
174
+ const { timeWindow: s } = e.analysis;
175
+ s !== void 0 && b(s, "analysis.timeWindow", i);
119
176
  }
120
- function b(e, i, n) {
121
- if (!p(e)) {
122
- n.push(
123
- s(
177
+ function b(e, i, s) {
178
+ if (!u(e)) {
179
+ s.push(
180
+ n(
124
181
  "invalid_time_window",
125
182
  "Time window must be a structured object.",
126
183
  i
@@ -128,31 +185,31 @@ function b(e, i, n) {
128
185
  );
129
186
  return;
130
187
  }
131
- e.unit !== "second" && e.unit !== "minute" && e.unit !== "hour" && e.unit !== "day" && e.unit !== "week" && e.unit !== "month" && e.unit !== "quarter" && e.unit !== "year" && n.push(
132
- s(
188
+ e.unit !== "second" && e.unit !== "minute" && e.unit !== "hour" && e.unit !== "day" && e.unit !== "week" && e.unit !== "month" && e.unit !== "quarter" && e.unit !== "year" && s.push(
189
+ n(
133
190
  "invalid_time_window",
134
191
  "Time window unit must be second, minute, hour, day, week, month, quarter, or year.",
135
192
  `${i}.unit`
136
193
  )
137
- ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && n.push(
138
- s(
194
+ ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && s.push(
195
+ n(
139
196
  "invalid_time_window",
140
197
  "Time window value must be a positive number.",
141
198
  `${i}.value`
142
199
  )
143
- ), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && n.push(
144
- s(
200
+ ), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && s.push(
201
+ n(
145
202
  "invalid_time_window",
146
203
  "Time window anchor must be now or latest_available.",
147
204
  `${i}.anchor`
148
205
  )
149
206
  );
150
207
  }
151
- function q(e, i, n) {
208
+ function j(e, i, s) {
152
209
  if (e !== void 0) {
153
210
  if (!Array.isArray(e)) {
154
- n.push(
155
- s(
211
+ s.push(
212
+ n(
156
213
  "invalid_analytics_filters",
157
214
  "Analytics filters must be an array.",
158
215
  i
@@ -160,56 +217,68 @@ function q(e, i, n) {
160
217
  );
161
218
  return;
162
219
  }
163
- e.forEach((o, f) => {
164
- const d = `${i}.${f}`;
165
- if (!p(o)) {
166
- n.push(
167
- s(
220
+ e.forEach((r, o) => {
221
+ const a = `${i}.${o}`;
222
+ if (!u(r)) {
223
+ s.push(
224
+ n(
168
225
  "invalid_analytics_filter",
169
226
  "Analytics filter must be a structured object.",
170
- d
227
+ a
171
228
  )
172
229
  );
173
230
  return;
174
231
  }
175
- const r = o;
176
- m(r.field, `${d}.field`, n, {
232
+ const t = r;
233
+ f(t.field, `${a}.field`, s, {
177
234
  required: !0
178
- }), r.operator !== void 0 && r.operator !== "=" && r.operator !== "!=" && r.operator !== "in" && r.operator !== "not_in" && r.operator !== "contains" && r.operator !== "not_contains" && r.operator !== "between" && r.operator !== "not_between" && r.operator !== ">" && r.operator !== ">=" && r.operator !== "<" && r.operator !== "<=" && r.operator !== "is_null" && r.operator !== "is_not_null" && n.push(
179
- s(
235
+ });
236
+ const p = t.operator === "is_null" || t.operator === "is_not_null";
237
+ if (t.operator !== void 0 && t.operator !== "=" && t.operator !== "!=" && t.operator !== "in" && t.operator !== "not_in" && t.operator !== "contains" && t.operator !== "not_contains" && t.operator !== "between" && t.operator !== "not_between" && t.operator !== ">" && t.operator !== ">=" && t.operator !== "<" && t.operator !== "<=" && t.operator !== "is_null" && t.operator !== "is_not_null" && s.push(
238
+ n(
180
239
  "invalid_analytics_filter_operator",
181
240
  "Analytics filter operator is not supported.",
182
- `${d}.operator`
241
+ `${a}.operator`
183
242
  )
184
- ), r.value === void 0 && r.values === void 0 && r.operator !== "is_null" && r.operator !== "is_not_null" && n.push(
185
- s(
243
+ ), t.values === void 0 && !p && s.push(
244
+ n(
186
245
  "missing_analytics_filter_value",
187
- "Analytics filter needs value or values unless it is a null check.",
188
- d
246
+ "Analytics filter needs values unless it is a null check.",
247
+ a
189
248
  )
190
- ), r.values !== void 0 && !Array.isArray(r.values) && n.push(
191
- s(
249
+ ), p && t.values !== void 0) {
250
+ s.push(
251
+ n(
252
+ "invalid_analytics_filter_values",
253
+ "Null-check analytics filters must not include values.",
254
+ `${a}.values`
255
+ )
256
+ );
257
+ return;
258
+ }
259
+ t.values !== void 0 && !Array.isArray(t.values) && s.push(
260
+ n(
192
261
  "invalid_analytics_filter_values",
193
262
  "Analytics filter values must be an array when provided.",
194
- `${d}.values`
263
+ `${a}.values`
195
264
  )
196
265
  );
197
266
  });
198
267
  }
199
268
  }
200
269
  function g(e) {
201
- var o, f, d, r;
202
- const i = [], n = [];
270
+ var r;
271
+ const i = [], s = [];
203
272
  if (!e || typeof e != "object")
204
273
  return {
205
274
  ok: !1,
206
275
  errors: [
207
- s(
276
+ n(
208
277
  "invalid_analytics_intent",
209
278
  "Analytics intent must be a structured object."
210
279
  )
211
280
  ],
212
- warnings: n,
281
+ warnings: s,
213
282
  repairHints: [
214
283
  {
215
284
  code: "invalid_analytics_intent",
@@ -218,147 +287,148 @@ function g(e) {
218
287
  ]
219
288
  };
220
289
  if (e.version !== void 0 && e.version !== 1 && i.push(
221
- s("invalid_version", "Analytics intent version must be 1.", "version")
222
- ), h(e.source, "source", i, {
223
- requireSqlText: e.kind !== "sql" || !a(e.sql)
224
- }), e.kind === "metric") {
225
- const u = Array.isArray(e.metrics) ? e.metrics.filter(a) : [];
290
+ n("invalid_version", "Analytics intent version must be 1.", "version")
291
+ ), v(e.source, "source", i), e.kind === "metric") {
292
+ const o = Array.isArray(e.metrics) ? e.metrics.filter(
293
+ (a) => u(a) && d(a.name)
294
+ ) : [];
226
295
  if (!Array.isArray(e.metrics) || e.metrics.length === 0 ? i.push(
227
- s("missing_metric", "Metric intent needs at least one metric.", "metrics")
228
- ) : e.metrics.some((t) => !a(t)) && i.push(
229
- s(
296
+ n("missing_metric", "Metric intent needs at least one metric.", "metrics")
297
+ ) : e.metrics.some(
298
+ (a) => !u(a) || !d(a.name)
299
+ ) && i.push(
300
+ n(
230
301
  "invalid_metric_list",
231
- "Metric intent metrics must be an array of non-empty metric names.",
302
+ "Metric intent metrics must be an array of field references with names.",
232
303
  "metrics"
233
304
  )
234
- ), u.length > 0) {
235
- const t = y(u);
236
- t && i.push(
237
- s(
305
+ ), o.forEach((a, t) => {
306
+ f(a, `metrics.${t}`, i, {
307
+ required: !0
308
+ });
309
+ }), o.length > 0 && !M(o)) {
310
+ const a = o.find(
311
+ (t, p) => o.some(
312
+ (c, l) => l !== p && _(c, t)
313
+ )
314
+ );
315
+ a && i.push(
316
+ n(
238
317
  "duplicate_metric",
239
- `Metric intent has duplicate metric "${t}".`,
318
+ `Metric intent has duplicate metric "${a.name}".`,
240
319
  "metrics"
241
320
  )
242
321
  );
243
322
  }
244
- if (e.primaryMetric !== void 0 && (!a(e.primaryMetric) || u.length > 0 && !u.includes(e.primaryMetric)) && i.push(
245
- s(
323
+ u(e.primaryMetric) && d(e.primaryMetric.name) && e.primaryMetric.source === void 0 && o.filter((a) => {
324
+ var t;
325
+ return a.name === ((t = e.primaryMetric) == null ? void 0 : t.name);
326
+ }).length > 1 && i.push(
327
+ n(
328
+ "ambiguous_primary_metric",
329
+ "Metric intent primaryMetric needs a source when it names a duplicated metric.",
330
+ "primaryMetric"
331
+ )
332
+ ), e.primaryMetric !== void 0 && (f(e.primaryMetric, "primaryMetric", i, {
333
+ required: !0
334
+ }), u(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !N(
335
+ e.primaryMetric,
336
+ o
337
+ ) && i.push(
338
+ n(
246
339
  "invalid_primary_metric",
247
- "Metric intent primaryMetric must be one of metrics.",
340
+ "Metric intent primaryMetric must match one metric field reference.",
248
341
  "primaryMetric"
249
342
  )
250
- ), e.metricRefs !== void 0 && !Array.isArray(e.metricRefs))
251
- i.push(
252
- s(
253
- "invalid_metric_refs",
254
- "Metric intent metricRefs must be an array of field references.",
255
- "metricRefs"
256
- )
257
- );
258
- else if (Array.isArray(e.metricRefs)) {
259
- e.metricRefs.forEach((c, _) => {
260
- m(c, `metricRefs.${_}`, i, {
261
- required: !0
262
- });
263
- });
264
- const t = e.metricRefs.filter(
265
- (c) => p(c) && a(c.name)
266
- ).map((c) => c.name);
267
- (u.length > 0 ? t.filter(
268
- (c) => !u.includes(c)
269
- ) : []).length > 0 && i.push(
270
- s(
271
- "invalid_metric_refs",
272
- "Metric intent metricRefs must reference names included in metrics.",
273
- "metricRefs"
274
- )
275
- );
276
- }
277
- e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? i.push(
278
- s(
343
+ )), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? i.push(
344
+ n(
279
345
  "invalid_metric_dimensions",
280
346
  "Metric intent dimensions must be an array of field references.",
281
347
  "dimensions"
282
348
  )
283
349
  ) : Array.isArray(e.dimensions) && e.dimensions.some(
284
- (t) => !p(t) || !a(t.name)
350
+ (a) => !u(a) || !d(a.name)
285
351
  ) && i.push(
286
- s(
352
+ n(
287
353
  "invalid_metric_dimensions",
288
354
  "Metric intent dimensions must be an array of field references with names.",
289
355
  "dimensions"
290
356
  )
291
- ), e.dateField !== void 0 && m(e.dateField, "dateField", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
292
- s(
357
+ ), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
358
+ n(
293
359
  "missing_time_window_date_field",
294
360
  "Metric timeWindow needs a dateField.",
295
361
  "dateField"
296
362
  )
297
- )), q(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((t, l) => {
298
- m(t, `dimensions.${l}`, i);
299
- }), k(e, i);
363
+ )), j(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((a, t) => {
364
+ f(a, `dimensions.${t}`, i);
365
+ }), R(e, i);
300
366
  } else e.kind === "records" ? (!Array.isArray(e.fields) || e.fields.length === 0 ? i.push(
301
- s(
367
+ n(
302
368
  "missing_record_fields",
303
369
  "Records intent needs at least one field.",
304
370
  "fields"
305
371
  )
306
372
  ) : e.fields.some(
307
- (u) => !p(u) || !a(u.name)
373
+ (o) => !u(o) || !d(o.name)
308
374
  ) && i.push(
309
- s(
375
+ n(
310
376
  "invalid_record_fields",
311
377
  "Records intent fields must be field references with names.",
312
378
  "fields"
313
379
  )
314
- ), Array.isArray(e.fields) && e.fields.forEach((u, t) => {
315
- m(u, `fields.${t}`, i);
316
- }), e.dateField !== void 0 && m(e.dateField, "dateField", i)) : e.kind === "inputOptions" ? ((!e.field || !a(e.field.name)) && i.push(
317
- s(
380
+ ), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
381
+ f(o, `fields.${a}`, i);
382
+ }), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.orderBy !== void 0 && (u(e.orderBy) ? (f(e.orderBy.field, "orderBy.field", i, {
383
+ required: !0
384
+ }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
385
+ n(
386
+ "invalid_record_order_direction",
387
+ "Records intent orderBy direction must be asc or desc.",
388
+ "orderBy.direction"
389
+ )
390
+ )) : i.push(
391
+ n(
392
+ "invalid_record_order_by",
393
+ "Records intent orderBy must be a structured object.",
394
+ "orderBy"
395
+ )
396
+ ))) : e.kind === "inputOptions" ? ((!e.field || !d(e.field.name)) && i.push(
397
+ n(
318
398
  "missing_input_options_field",
319
399
  "Input options intent needs a field.",
320
400
  "field"
321
401
  )
322
- ), m(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && ((f = e.source) == null ? void 0 : f.kind) !== "physical" && i.push(
323
- s(
402
+ ), f(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((r = e.source) == null ? void 0 : r.kind) !== "sql" && i.push(
403
+ n(
324
404
  "invalid_sql_source",
325
- "SQL analytics intent must use a SQL or physical source.",
405
+ "SQL analytics intent must use a SQL execution source.",
326
406
  "source"
327
407
  )
328
- ), a(e.sql) && ((d = e.source) == null ? void 0 : d.kind) === "sql" && a(e.source.sql) && v(e.sql) !== v(e.source.sql) && i.push(
329
- s(
330
- "conflicting_sql",
331
- "SQL analytics intent cannot define different SQL text in source.sql and sql.",
332
- "sql"
333
- )
334
- ), !a(e.sql) && !(((r = e.source) == null ? void 0 : r.kind) === "sql" && a(e.source.sql)) && i.push(s("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((u, t) => {
335
- m(u, `fields.${t}`, i);
408
+ ), d(e.sql) || i.push(n("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
409
+ f(o, `fields.${a}`, i);
336
410
  })) : i.push(
337
- s("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
411
+ n("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
338
412
  );
339
413
  return {
340
414
  ok: i.length === 0,
341
415
  errors: i,
342
- warnings: n,
343
- repairHints: S(i)
416
+ warnings: s,
417
+ repairHints: x(i)
344
418
  };
345
419
  }
346
- function v(e) {
347
- return e.replace(/\r\n/g, `
348
- `).trim();
349
- }
350
- function $(e) {
351
- const i = [], n = [];
420
+ function q(e) {
421
+ const i = [], s = [];
352
422
  if (!e || typeof e != "object")
353
423
  return {
354
424
  ok: !1,
355
425
  errors: [
356
- s(
426
+ n(
357
427
  "invalid_operation_intent",
358
428
  "Operation intent must be a structured object."
359
429
  )
360
430
  ],
361
- warnings: n,
431
+ warnings: s,
362
432
  repairHints: [
363
433
  {
364
434
  code: "invalid_operation_intent",
@@ -367,45 +437,45 @@ function $(e) {
367
437
  ]
368
438
  };
369
439
  if (e.version !== 1 && i.push(
370
- s("invalid_version", "Operation intent version must be 1.", "version")
440
+ n("invalid_version", "Operation intent version must be 1.", "version")
371
441
  ), e.kind === "answer_obligations")
372
442
  !Array.isArray(e.obligations) || e.obligations.length === 0 ? i.push(
373
- s(
443
+ n(
374
444
  "missing_obligations",
375
445
  "Answer-obligations operation intent needs at least one obligation.",
376
446
  "obligations"
377
447
  )
378
- ) : e.obligations.forEach((o, f) => {
379
- a(o.id) || i.push(
380
- s(
448
+ ) : e.obligations.forEach((r, o) => {
449
+ d(r.id) || i.push(
450
+ n(
381
451
  "missing_obligation_id",
382
452
  "Each analytics obligation needs an id.",
383
- `obligations.${f}.id`
453
+ `obligations.${o}.id`
384
454
  )
385
- ), a(o.prompt) || i.push(
386
- s(
455
+ ), d(r.prompt) || i.push(
456
+ n(
387
457
  "missing_obligation_prompt",
388
458
  "Each analytics obligation needs a prompt.",
389
- `obligations.${f}.prompt`
459
+ `obligations.${o}.prompt`
390
460
  )
391
461
  );
392
462
  });
393
463
  else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
394
- if (a(e.instruction) || i.push(
395
- s(
464
+ if (d(e.instruction) || i.push(
465
+ n(
396
466
  "missing_instruction",
397
467
  "Change operation intent needs an instruction.",
398
468
  "instruction"
399
469
  )
400
470
  ), e.analyticsIntent) {
401
- const o = g(
471
+ const r = g(
402
472
  e.analyticsIntent
403
473
  );
404
- i.push(...o.errors), n.push(...o.warnings);
474
+ i.push(...r.errors), s.push(...r.warnings);
405
475
  }
406
476
  } else
407
477
  i.push(
408
- s(
478
+ n(
409
479
  "invalid_operation_kind",
410
480
  "Operation intent kind is not supported.",
411
481
  "kind"
@@ -414,22 +484,22 @@ function $(e) {
414
484
  return {
415
485
  ok: i.length === 0,
416
486
  errors: i,
417
- warnings: n,
418
- repairHints: w(i)
487
+ warnings: s,
488
+ repairHints: k(i)
419
489
  };
420
490
  }
421
- function R(e) {
422
- const i = [], n = [];
491
+ function T(e) {
492
+ const i = [], s = [];
423
493
  if (!e || typeof e != "object")
424
494
  return {
425
495
  ok: !1,
426
496
  errors: [
427
- s(
497
+ n(
428
498
  "invalid_recovery_plan",
429
499
  "Analytics recovery plan must be a structured object."
430
500
  )
431
501
  ],
432
- warnings: n,
502
+ warnings: s,
433
503
  repairHints: [
434
504
  {
435
505
  code: "invalid_recovery_plan",
@@ -438,17 +508,17 @@ function R(e) {
438
508
  ]
439
509
  };
440
510
  e.version !== 1 && i.push(
441
- s("invalid_version", "Recovery plan version must be 1.", "version")
511
+ n("invalid_version", "Recovery plan version must be 1.", "version")
442
512
  ), e.kind !== "analytics_recovery_plan" && i.push(
443
- s(
513
+ n(
444
514
  "invalid_recovery_plan_kind",
445
515
  "Recovery plan kind must be analytics_recovery_plan.",
446
516
  "kind"
447
517
  )
448
518
  );
449
- const o = $(e.operationIntent);
450
- return i.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || i.push(
451
- s(
519
+ const r = q(e.operationIntent);
520
+ return i.push(...r.errors), s.push(...r.warnings), Array.isArray(e.plannedToolCalls) || i.push(
521
+ n(
452
522
  "invalid_planned_tool_calls",
453
523
  "Recovery plan plannedToolCalls must be an array.",
454
524
  "plannedToolCalls"
@@ -456,17 +526,17 @@ function R(e) {
456
526
  ), {
457
527
  ok: i.length === 0,
458
528
  errors: i,
459
- warnings: n,
460
- repairHints: w(i)
529
+ warnings: s,
530
+ repairHints: k(i)
461
531
  };
462
532
  }
463
- function w(e) {
533
+ function k(e) {
464
534
  return e.map((i) => ({
465
535
  code: i.code,
466
536
  recommendedNextStep: i.code === "missing_obligations" ? "Normalize the user request into one or more typed analytics obligations before recovery planning." : "Correct the operation/recovery contract shape before planning execution."
467
537
  }));
468
538
  }
469
- function S(e) {
539
+ function x(e) {
470
540
  return e.map((i) => {
471
541
  switch (i.code) {
472
542
  case "missing_source":
@@ -519,14 +589,14 @@ function S(e) {
519
589
  }
520
590
  }).filter((i) => !!i);
521
591
  }
522
- function x(e, i, n, o) {
592
+ function F(e, i, s, r) {
523
593
  if (!e || typeof e != "object") {
524
- n.push(s("invalid_view", "Dashboard view must be an object.", i));
594
+ s.push(n("invalid_view", "Dashboard view must be an object.", i));
525
595
  return;
526
596
  }
527
- if (a(e.title) || n.push(s("missing_view_title", "Dashboard view needs a title.", i)), !e.presentation || typeof e.presentation != "object") {
528
- n.push(
529
- s(
597
+ if (d(e.title) || s.push(n("missing_view_title", "Dashboard view needs a title.", i)), !e.presentation || typeof e.presentation != "object") {
598
+ s.push(
599
+ n(
530
600
  "missing_presentation",
531
601
  "Dashboard view needs a presentation.",
532
602
  `${i}.presentation`
@@ -535,8 +605,8 @@ function x(e, i, n, o) {
535
605
  return;
536
606
  }
537
607
  if (e.presentation.kind === "text") {
538
- a(e.text) || o.push(
539
- s(
608
+ d(e.text) || r.push(
609
+ n(
540
610
  "missing_text_content",
541
611
  "Text views should include text content.",
542
612
  `${i}.text`
@@ -545,8 +615,8 @@ function x(e, i, n, o) {
545
615
  return;
546
616
  }
547
617
  if (!e.analytics) {
548
- n.push(
549
- s(
618
+ s.push(
619
+ n(
550
620
  "missing_view_analytics",
551
621
  "Non-text dashboard views need analytics intent.",
552
622
  `${i}.analytics`
@@ -554,107 +624,112 @@ function x(e, i, n, o) {
554
624
  );
555
625
  return;
556
626
  }
557
- const f = g(e.analytics);
558
- for (const d of f.errors)
559
- n.push(
560
- s(d.code, d.message, `${i}.analytics${d.path ? `.${d.path}` : ""}`)
627
+ const o = g(e.analytics);
628
+ for (const a of o.errors)
629
+ s.push(
630
+ n(a.code, a.message, `${i}.analytics${a.path ? `.${a.path}` : ""}`)
561
631
  );
562
- for (const d of f.warnings)
563
- o.push(
564
- s(
565
- d.code,
566
- d.message,
567
- `${i}.analytics${d.path ? `.${d.path}` : ""}`
632
+ for (const a of o.warnings)
633
+ r.push(
634
+ n(
635
+ a.code,
636
+ a.message,
637
+ `${i}.analytics${a.path ? `.${a.path}` : ""}`
568
638
  )
569
639
  );
570
640
  }
571
- function I(e) {
572
- const i = [], n = [];
641
+ function B(e) {
642
+ const i = [], s = [];
573
643
  if (!e || typeof e != "object")
574
644
  return {
575
645
  ok: !1,
576
646
  errors: [
577
- s(
647
+ n(
578
648
  "invalid_dashboard_intent",
579
649
  "Dashboard intent must be a structured object."
580
650
  )
581
651
  ],
582
- warnings: n
652
+ warnings: s
583
653
  };
584
- e.version !== 1 && i.push(s("invalid_version", "Dashboard intent version must be 1.")), e.kind !== "dashboard" && i.push(s("invalid_kind", "Experience intent kind must be dashboard.")), a(e.title) || i.push(s("missing_title", "Dashboard intent needs a title.", "title"));
585
- const o = Array.isArray(e.inputs) ? e.inputs : [], f = y(
586
- o.filter(p).map((t) => t.id).filter((t) => typeof t == "string")
654
+ e.version !== 1 && i.push(n("invalid_version", "Dashboard intent version must be 1.")), e.kind !== "dashboard" && i.push(n("invalid_kind", "Experience intent kind must be dashboard.")), d(e.title) || i.push(n("missing_title", "Dashboard intent needs a title.", "title"));
655
+ const r = Array.isArray(e.inputs) ? e.inputs : [], o = h(
656
+ r.filter(u).map((c) => c.id).filter((c) => typeof c == "string")
587
657
  );
588
- f && i.push(
589
- s(
658
+ o && i.push(
659
+ n(
590
660
  "duplicate_input_id",
591
- `Duplicate input id: ${f}.`,
661
+ `Duplicate input id: ${o}.`,
592
662
  "inputs"
593
663
  )
594
664
  );
595
- for (const [t, l] of o.entries()) {
596
- const c = `inputs.${t}`;
597
- if (!p(l)) {
598
- i.push(s("invalid_input", "Dashboard input must be an object.", c));
665
+ for (const [c, l] of r.entries()) {
666
+ const m = `inputs.${c}`;
667
+ if (!u(l)) {
668
+ i.push(n("invalid_input", "Dashboard input must be an object.", m));
599
669
  continue;
600
670
  }
601
- a(l.id) || i.push(s("missing_input_id", "Input needs an id.", `${c}.id`)), a(l.label) || i.push(
602
- s("missing_input_label", "Input needs a label.", `${c}.label`)
603
- ), !l.field || !a(l.field.name) ? i.push(
604
- s("missing_input_field", "Input needs a field.", `${c}.field`)
605
- ) : m(l.field, `${c}.field`, i), l.source && h(l.source, `${c}.source`, i);
671
+ d(l.id) || i.push(n("missing_input_id", "Input needs an id.", `${m}.id`)), d(l.label) || i.push(
672
+ n("missing_input_label", "Input needs a label.", `${m}.label`)
673
+ ), !l.field || !d(l.field.name) ? i.push(
674
+ n("missing_input_field", "Input needs a field.", `${m}.field`)
675
+ ) : f(l.field, `${m}.field`, i);
606
676
  }
607
- const d = Array.isArray(e.sections) ? e.sections : [];
608
- d.length === 0 && i.push(
609
- s(
677
+ const a = Array.isArray(e.sections) ? e.sections : [];
678
+ a.length === 0 && i.push(
679
+ n(
610
680
  "missing_sections",
611
681
  "Dashboard intent needs at least one section.",
612
682
  "sections"
613
683
  )
614
684
  );
615
- const r = d.flatMap(
616
- (t) => t && typeof t == "object" && Array.isArray(t.views) ? t.views.filter(p).map((l) => l.id).filter((l) => !!l) : []
617
- ), u = y(r);
618
- u && i.push(
619
- s(
685
+ const t = a.flatMap(
686
+ (c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(u).map((l) => l.id).filter((l) => !!l) : []
687
+ ), p = h(t);
688
+ p && i.push(
689
+ n(
620
690
  "duplicate_view_id",
621
- `Duplicate dashboard view id: ${u}.`,
691
+ `Duplicate dashboard view id: ${p}.`,
622
692
  "sections"
623
693
  )
624
694
  );
625
- for (const [t, l] of d.entries()) {
626
- const c = `sections.${t}`;
695
+ for (const [c, l] of a.entries()) {
696
+ const m = `sections.${c}`;
627
697
  if (!l || typeof l != "object") {
628
698
  i.push(
629
- s("invalid_section", "Dashboard section must be an object.", c)
699
+ n("invalid_section", "Dashboard section must be an object.", m)
630
700
  );
631
701
  continue;
632
702
  }
633
- if (a(l.title) || i.push(
634
- s("missing_section_title", "Dashboard section needs a title.", c)
703
+ if (d(l.title) || i.push(
704
+ n("missing_section_title", "Dashboard section needs a title.", m)
635
705
  ), !Array.isArray(l.views) || l.views.length === 0) {
636
706
  i.push(
637
- s(
707
+ n(
638
708
  "missing_section_views",
639
709
  "Dashboard section needs at least one view.",
640
- `${c}.views`
710
+ `${m}.views`
641
711
  )
642
712
  );
643
713
  continue;
644
714
  }
645
- for (const [_, A] of l.views.entries())
646
- x(
715
+ for (const [w, A] of l.views.entries())
716
+ F(
647
717
  A,
648
- `${c}.views.${_}`,
718
+ `${m}.views.${w}`,
649
719
  i,
650
- n
720
+ s
651
721
  );
652
722
  }
653
- return { ok: i.length === 0, errors: i, warnings: n };
723
+ return { ok: i.length === 0, errors: i, warnings: s };
654
724
  }
655
725
  export {
656
- $ as a,
657
- R as b,
658
- I as c,
726
+ q as a,
727
+ T as b,
728
+ B as c,
729
+ I as d,
730
+ S as e,
731
+ D as f,
732
+ $ as p,
733
+ y as s,
659
734
  g as v
660
735
  };