react-semaphor 0.1.341 → 0.1.343

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.
@@ -17,10 +17,10 @@ function y(e) {
17
17
  e.label || ""
18
18
  ].join(":") : "";
19
19
  }
20
- function S(e, i) {
20
+ function M(e, i) {
21
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
22
  }
23
- function $(e, i) {
23
+ function S(e, i) {
24
24
  return e.kind !== "semantic" || i.kind !== "semantic" ? e : {
25
25
  ...e,
26
26
  datasetId: e.datasetId || i.datasetId,
@@ -28,19 +28,19 @@ function $(e, i) {
28
28
  connectionId: e.connectionId || i.connectionId
29
29
  };
30
30
  }
31
- function M(e, i) {
32
- return e.name === i.name && S(e.source, i.source);
31
+ function $(e, i) {
32
+ return e.name === i.name && M(e.source, i.source);
33
33
  }
34
- function B(e, i) {
34
+ function P(e, i) {
35
35
  return {
36
36
  ...e,
37
37
  label: e.label || i.label,
38
38
  role: e.role || i.role,
39
39
  dataType: e.dataType || i.dataType,
40
- source: e.source && i.source ? $(e.source, i.source) : e.source || i.source
40
+ source: e.source && i.source ? S(e.source, i.source) : e.source || i.source
41
41
  };
42
42
  }
43
- function n(e, i, s) {
43
+ function a(e, i, s) {
44
44
  return s ? { code: e, message: i, path: s } : { code: e, message: i };
45
45
  }
46
46
  function N(e) {
@@ -54,9 +54,9 @@ function N(e) {
54
54
  return !0;
55
55
  }
56
56
  function _(e, i) {
57
- return M(e, i);
57
+ return $(e, i);
58
58
  }
59
- function R(e, i) {
59
+ function B(e, i) {
60
60
  const s = i.filter((r) => r.name === e.name);
61
61
  return e.source ? s.some(
62
62
  (r) => _(r, e) && h(e, r)
@@ -65,10 +65,19 @@ function R(e, i) {
65
65
  function h(e, i) {
66
66
  return i ? e.aggregate ? i.aggregate === e.aggregate : !0 : !1;
67
67
  }
68
+ function R(e, i) {
69
+ const s = i.filter(
70
+ (r) => F(e, r)
71
+ );
72
+ return e.source ? s.some((r) => _(r, e)) : s.length === 1;
73
+ }
74
+ function F(e, i) {
75
+ return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role || e.aggregate !== void 0 && i.aggregate !== e.aggregate);
76
+ }
68
77
  function d(e) {
69
78
  return typeof e == "string" && e.trim().length > 0;
70
79
  }
71
- function u(e) {
80
+ function c(e) {
72
81
  return !!(e && typeof e == "object" && !Array.isArray(e));
73
82
  }
74
83
  function v(e) {
@@ -89,20 +98,20 @@ const j = /* @__PURE__ */ new Set([
89
98
  "MEDIAN",
90
99
  "DISTINCT"
91
100
  ]);
92
- function b(e, i, s) {
101
+ function g(e, i, s) {
93
102
  if (!e || typeof e != "object") {
94
- s.push(n("missing_source", "Analytics intent needs a source.", i));
103
+ s.push(a("missing_source", "Analytics intent needs a source.", i));
95
104
  return;
96
105
  }
97
106
  if (e.kind === "semantic") {
98
107
  d(e.domainId) || s.push(
99
- n(
108
+ a(
100
109
  "missing_semantic_domain",
101
110
  "Semantic source needs a domainId.",
102
111
  `${i}.domainId`
103
112
  )
104
113
  ), d(e.datasetName) || s.push(
105
- n(
114
+ a(
106
115
  "missing_dataset_name",
107
116
  "Semantic source needs a datasetName.",
108
117
  `${i}.datasetName`
@@ -112,13 +121,13 @@ function b(e, i, s) {
112
121
  }
113
122
  if (e.kind === "physical") {
114
123
  d(e.connectionId) || s.push(
115
- n(
124
+ a(
116
125
  "missing_connection_id",
117
126
  "Physical source needs a connectionId.",
118
127
  `${i}.connectionId`
119
128
  )
120
129
  ), d(e.tableName) || s.push(
121
- n(
130
+ a(
122
131
  "missing_table_name",
123
132
  "Physical source needs a tableName.",
124
133
  `${i}.tableName`
@@ -128,7 +137,7 @@ function b(e, i, s) {
128
137
  }
129
138
  if (e.kind === "sql") {
130
139
  d(e.connectionId) || s.push(
131
- n(
140
+ a(
132
141
  "missing_connection_id",
133
142
  "SQL source needs a connectionId.",
134
143
  `${i}.connectionId`
@@ -136,22 +145,22 @@ function b(e, i, s) {
136
145
  );
137
146
  return;
138
147
  }
139
- s.push(n("invalid_source_kind", "Source kind is not supported.", i));
148
+ s.push(a("invalid_source_kind", "Source kind is not supported.", i));
140
149
  }
141
150
  function f(e, i, s, r = {}) {
142
- if (!e || !u(e)) {
151
+ if (!e || !c(e)) {
143
152
  r.required && s.push(
144
- n("missing_field_ref", "Field reference needs a name.", i)
153
+ a("missing_field_ref", "Field reference needs a name.", i)
145
154
  );
146
155
  return;
147
156
  }
148
157
  d(e.name) || s.push(
149
- n("missing_field_ref", "Field reference needs a name.", `${i}.name`)
150
- ), e.source !== void 0 && b(e.source, `${i}.source`, s), q(e.aggregate, `${i}.aggregate`, s);
158
+ a("missing_field_ref", "Field reference needs a name.", `${i}.name`)
159
+ ), e.source !== void 0 && g(e.source, `${i}.source`, s), T(e.aggregate, `${i}.aggregate`, s);
151
160
  }
152
- function q(e, i, s) {
161
+ function T(e, i, s) {
153
162
  e !== void 0 && (typeof e != "string" || !j.has(e)) && s.push(
154
- n(
163
+ a(
155
164
  "invalid_aggregate",
156
165
  "Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
157
166
  i
@@ -161,9 +170,9 @@ function q(e, i, s) {
161
170
  function x(e, i) {
162
171
  if (e.analysis === void 0)
163
172
  return;
164
- if (!u(e.analysis)) {
173
+ if (!c(e.analysis)) {
165
174
  i.push(
166
- n(
175
+ a(
167
176
  "invalid_metric_analysis",
168
177
  "Metric analysis must be a structured object.",
169
178
  "analysis"
@@ -173,7 +182,7 @@ function x(e, i) {
173
182
  }
174
183
  if (e.analysis.kind !== "period_change") {
175
184
  i.push(
176
- n(
185
+ a(
177
186
  "invalid_metric_analysis",
178
187
  "Metric analysis kind is not supported.",
179
188
  "analysis.kind"
@@ -182,25 +191,31 @@ function x(e, i) {
182
191
  return;
183
192
  }
184
193
  e.dateField || i.push(
185
- n(
194
+ a(
186
195
  "missing_analysis_date_field",
187
196
  "Period-change analysis needs a dateField.",
188
197
  "dateField"
189
198
  )
190
199
  ), e.timeGrain || i.push(
191
- n(
200
+ a(
192
201
  "missing_analysis_time_grain",
193
202
  "Period-change analysis needs a timeGrain.",
194
203
  "timeGrain"
195
204
  )
205
+ ), e.analysis.orderBy !== void 0 && e.analysis.orderBy !== "absolute_change" && e.analysis.orderBy !== "positive_change" && e.analysis.orderBy !== "negative_change" && e.analysis.orderBy !== "period" && i.push(
206
+ a(
207
+ "invalid_metric_analysis",
208
+ "Period-change analysis orderBy must be absolute_change, positive_change, negative_change, or period.",
209
+ "analysis.orderBy"
210
+ )
196
211
  );
197
212
  const { timeWindow: s } = e.analysis;
198
- s !== void 0 && g(s, "analysis.timeWindow", i);
213
+ s !== void 0 && b(s, "analysis.timeWindow", i);
199
214
  }
200
- function g(e, i, s) {
201
- if (!u(e)) {
215
+ function b(e, i, s) {
216
+ if (!c(e)) {
202
217
  s.push(
203
- n(
218
+ a(
204
219
  "invalid_time_window",
205
220
  "Time window must be a structured object.",
206
221
  i
@@ -209,30 +224,36 @@ function g(e, i, s) {
209
224
  return;
210
225
  }
211
226
  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(
212
- n(
227
+ a(
213
228
  "invalid_time_window",
214
229
  "Time window unit must be second, minute, hour, day, week, month, quarter, or year.",
215
230
  `${i}.unit`
216
231
  )
217
232
  ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && s.push(
218
- n(
233
+ a(
219
234
  "invalid_time_window",
220
235
  "Time window value must be a positive number.",
221
236
  `${i}.value`
222
237
  )
223
238
  ), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && s.push(
224
- n(
239
+ a(
225
240
  "invalid_time_window",
226
241
  "Time window anchor must be now or latest_available.",
227
242
  `${i}.anchor`
228
243
  )
244
+ ), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" && s.push(
245
+ a(
246
+ "invalid_time_window",
247
+ "Time window completeness must be include_partial or complete_periods.",
248
+ `${i}.completeness`
249
+ )
229
250
  );
230
251
  }
231
- function F(e, i, s) {
252
+ function D(e, i, s) {
232
253
  if (e !== void 0) {
233
254
  if (!Array.isArray(e)) {
234
255
  s.push(
235
- n(
256
+ a(
236
257
  "invalid_analytics_filters",
237
258
  "Analytics filters must be an array.",
238
259
  i
@@ -241,49 +262,49 @@ function F(e, i, s) {
241
262
  return;
242
263
  }
243
264
  e.forEach((r, o) => {
244
- const a = `${i}.${o}`;
245
- if (!u(r)) {
265
+ const n = `${i}.${o}`;
266
+ if (!c(r)) {
246
267
  s.push(
247
- n(
268
+ a(
248
269
  "invalid_analytics_filter",
249
270
  "Analytics filter must be a structured object.",
250
- a
271
+ n
251
272
  )
252
273
  );
253
274
  return;
254
275
  }
255
276
  const t = r;
256
- f(t.field, `${a}.field`, s, {
277
+ f(t.field, `${n}.field`, s, {
257
278
  required: !0
258
279
  });
259
280
  const p = t.operator === "is_null" || t.operator === "is_not_null";
260
281
  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(
261
- n(
282
+ a(
262
283
  "invalid_analytics_filter_operator",
263
284
  "Analytics filter operator is not supported.",
264
- `${a}.operator`
285
+ `${n}.operator`
265
286
  )
266
287
  ), t.values === void 0 && !p && s.push(
267
- n(
288
+ a(
268
289
  "missing_analytics_filter_value",
269
290
  "Analytics filter needs values unless it is a null check.",
270
- a
291
+ n
271
292
  )
272
293
  ), p && t.values !== void 0) {
273
294
  s.push(
274
- n(
295
+ a(
275
296
  "invalid_analytics_filter_values",
276
297
  "Null-check analytics filters must not include values.",
277
- `${a}.values`
298
+ `${n}.values`
278
299
  )
279
300
  );
280
301
  return;
281
302
  }
282
303
  t.values !== void 0 && !Array.isArray(t.values) && s.push(
283
- n(
304
+ a(
284
305
  "invalid_analytics_filter_values",
285
306
  "Analytics filter values must be an array when provided.",
286
- `${a}.values`
307
+ `${n}.values`
287
308
  )
288
309
  );
289
310
  });
@@ -296,7 +317,7 @@ function A(e) {
296
317
  return {
297
318
  ok: !1,
298
319
  errors: [
299
- n(
320
+ a(
300
321
  "invalid_analytics_intent",
301
322
  "Analytics intent must be a structured object."
302
323
  )
@@ -310,143 +331,180 @@ function A(e) {
310
331
  ]
311
332
  };
312
333
  if (e.version !== void 0 && e.version !== 1 && i.push(
313
- n("invalid_version", "Analytics intent version must be 1.", "version")
314
- ), b(e.source, "source", i), e.kind === "metric") {
334
+ a("invalid_version", "Analytics intent version must be 1.", "version")
335
+ ), g(e.source, "source", i), e.kind === "metric") {
315
336
  const o = Array.isArray(e.metrics) ? e.metrics.filter(
316
- (a) => u(a) && d(a.name)
337
+ (n) => c(n) && d(n.name)
317
338
  ) : [];
318
339
  if (!Array.isArray(e.metrics) || e.metrics.length === 0 ? i.push(
319
- n("missing_metric", "Metric intent needs at least one metric.", "metrics")
340
+ a("missing_metric", "Metric intent needs at least one metric.", "metrics")
320
341
  ) : e.metrics.some(
321
- (a) => !u(a) || !d(a.name)
342
+ (n) => !c(n) || !d(n.name)
322
343
  ) && i.push(
323
- n(
344
+ a(
324
345
  "invalid_metric_list",
325
346
  "Metric intent metrics must be an array of field references with names.",
326
347
  "metrics"
327
348
  )
328
- ), o.forEach((a, t) => {
329
- f(a, `metrics.${t}`, i, {
349
+ ), o.forEach((n, t) => {
350
+ f(n, `metrics.${t}`, i, {
330
351
  required: !0
331
352
  });
332
353
  }), o.length > 0 && !N(o)) {
333
- const a = o.find(
354
+ const n = o.find(
334
355
  (t, p) => o.some(
335
- (c, l) => l !== p && _(c, t)
356
+ (u, l) => l !== p && _(u, t)
336
357
  )
337
358
  );
338
- a && i.push(
339
- n(
359
+ n && i.push(
360
+ a(
340
361
  "duplicate_metric",
341
- `Metric intent has duplicate metric "${a.name}".`,
362
+ `Metric intent has duplicate metric "${n.name}".`,
342
363
  "metrics"
343
364
  )
344
365
  );
345
366
  }
346
- u(e.primaryMetric) && d(e.primaryMetric.name) && e.primaryMetric.source === void 0 && o.filter((a) => {
367
+ if (c(e.primaryMetric) && d(e.primaryMetric.name) && e.primaryMetric.source === void 0 && o.filter((n) => {
347
368
  var t;
348
- return a.name === ((t = e.primaryMetric) == null ? void 0 : t.name);
369
+ return n.name === ((t = e.primaryMetric) == null ? void 0 : t.name);
349
370
  }).length > 1 && i.push(
350
- n(
371
+ a(
351
372
  "ambiguous_primary_metric",
352
373
  "Metric intent primaryMetric needs a source when it names a duplicated metric.",
353
374
  "primaryMetric"
354
375
  )
355
376
  ), e.primaryMetric !== void 0 && (f(e.primaryMetric, "primaryMetric", i, {
356
377
  required: !0
357
- }), u(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !R(
378
+ }), c(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !B(
358
379
  e.primaryMetric,
359
380
  o
360
381
  ) && i.push(
361
- n(
382
+ a(
362
383
  "invalid_primary_metric",
363
384
  "Metric intent primaryMetric must match one metric field reference.",
364
385
  "primaryMetric"
365
386
  )
366
387
  )), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? i.push(
367
- n(
388
+ a(
368
389
  "invalid_metric_dimensions",
369
390
  "Metric intent dimensions must be an array of field references.",
370
391
  "dimensions"
371
392
  )
372
393
  ) : Array.isArray(e.dimensions) && e.dimensions.some(
373
- (a) => !u(a) || !d(a.name)
394
+ (n) => !c(n) || !d(n.name)
374
395
  ) && i.push(
375
- n(
396
+ a(
376
397
  "invalid_metric_dimensions",
377
398
  "Metric intent dimensions must be an array of field references with names.",
378
399
  "dimensions"
379
400
  )
380
- ), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.timeWindow !== void 0 && (g(e.timeWindow, "timeWindow", i), e.dateField || i.push(
381
- n(
401
+ ), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
402
+ a(
382
403
  "missing_time_window_date_field",
383
404
  "Metric timeWindow needs a dateField.",
384
405
  "dateField"
385
406
  )
386
- )), F(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((a, t) => {
387
- f(a, `dimensions.${t}`, i);
388
- }), x(e, i);
407
+ )), D(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((n, t) => {
408
+ f(n, `dimensions.${t}`, i);
409
+ }), e.orderBy !== void 0) {
410
+ if (!c(e.orderBy))
411
+ i.push(
412
+ a(
413
+ "invalid_metric_order_by",
414
+ "Metric intent orderBy must be a structured object.",
415
+ "orderBy"
416
+ )
417
+ );
418
+ else if (f(e.orderBy.field, "orderBy.field", i, {
419
+ required: !0
420
+ }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
421
+ a(
422
+ "invalid_metric_order_direction",
423
+ "Metric intent orderBy direction must be asc or desc.",
424
+ "orderBy.direction"
425
+ )
426
+ ), c(e.orderBy.field) && d(e.orderBy.field.name)) {
427
+ const n = [
428
+ ...o,
429
+ ...e.timeGrain && e.dateField && c(e.dateField) ? [e.dateField] : [],
430
+ ...Array.isArray(e.dimensions) ? e.dimensions.filter(
431
+ (t) => c(t) && d(t.name)
432
+ ) : []
433
+ ];
434
+ n.length > 0 && !R(
435
+ e.orderBy.field,
436
+ n
437
+ ) && i.push(
438
+ a(
439
+ "invalid_metric_order_by",
440
+ "Metric intent orderBy.field must match one selected metric, grouped dateField, or dimension.",
441
+ "orderBy.field"
442
+ )
443
+ );
444
+ }
445
+ }
446
+ x(e, i);
389
447
  } else e.kind === "records" ? (!Array.isArray(e.fields) || e.fields.length === 0 ? i.push(
390
- n(
448
+ a(
391
449
  "missing_record_fields",
392
450
  "Records intent needs at least one field.",
393
451
  "fields"
394
452
  )
395
453
  ) : e.fields.some(
396
- (o) => !u(o) || !d(o.name)
454
+ (o) => !c(o) || !d(o.name)
397
455
  ) && i.push(
398
- n(
456
+ a(
399
457
  "invalid_record_fields",
400
458
  "Records intent fields must be field references with names.",
401
459
  "fields"
402
460
  )
403
- ), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
404
- f(o, `fields.${a}`, i);
405
- }), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.orderBy !== void 0 && (u(e.orderBy) ? (f(e.orderBy.field, "orderBy.field", i, {
461
+ ), Array.isArray(e.fields) && e.fields.forEach((o, n) => {
462
+ f(o, `fields.${n}`, i);
463
+ }), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.orderBy !== void 0 && (c(e.orderBy) ? (f(e.orderBy.field, "orderBy.field", i, {
406
464
  required: !0
407
465
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
408
- n(
466
+ a(
409
467
  "invalid_record_order_direction",
410
468
  "Records intent orderBy direction must be asc or desc.",
411
469
  "orderBy.direction"
412
470
  )
413
471
  )) : i.push(
414
- n(
472
+ a(
415
473
  "invalid_record_order_by",
416
474
  "Records intent orderBy must be a structured object.",
417
475
  "orderBy"
418
476
  )
419
477
  ))) : e.kind === "inputOptions" ? ((!e.field || !d(e.field.name)) && i.push(
420
- n(
478
+ a(
421
479
  "missing_input_options_field",
422
480
  "Input options intent needs a field.",
423
481
  "field"
424
482
  )
425
483
  ), f(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((r = e.source) == null ? void 0 : r.kind) !== "sql" && i.push(
426
- n(
484
+ a(
427
485
  "invalid_sql_source",
428
486
  "SQL analytics intent must use a SQL execution source.",
429
487
  "source"
430
488
  )
431
- ), d(e.sql) || i.push(n("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
432
- f(o, `fields.${a}`, i);
489
+ ), d(e.sql) || i.push(a("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((o, n) => {
490
+ f(o, `fields.${n}`, i);
433
491
  })) : i.push(
434
- n("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
492
+ a("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
435
493
  );
436
494
  return {
437
495
  ok: i.length === 0,
438
496
  errors: i,
439
497
  warnings: s,
440
- repairHints: D(i)
498
+ repairHints: E(i)
441
499
  };
442
500
  }
443
- function T(e) {
501
+ function q(e) {
444
502
  const i = [], s = [];
445
503
  if (!e || typeof e != "object")
446
504
  return {
447
505
  ok: !1,
448
506
  errors: [
449
- n(
507
+ a(
450
508
  "invalid_operation_intent",
451
509
  "Operation intent must be a structured object."
452
510
  )
@@ -460,23 +518,23 @@ function T(e) {
460
518
  ]
461
519
  };
462
520
  if (e.version !== 1 && i.push(
463
- n("invalid_version", "Operation intent version must be 1.", "version")
521
+ a("invalid_version", "Operation intent version must be 1.", "version")
464
522
  ), e.kind === "answer_obligations")
465
523
  !Array.isArray(e.obligations) || e.obligations.length === 0 ? i.push(
466
- n(
524
+ a(
467
525
  "missing_obligations",
468
526
  "Answer-obligations operation intent needs at least one obligation.",
469
527
  "obligations"
470
528
  )
471
529
  ) : e.obligations.forEach((r, o) => {
472
530
  d(r.id) || i.push(
473
- n(
531
+ a(
474
532
  "missing_obligation_id",
475
533
  "Each analytics obligation needs an id.",
476
534
  `obligations.${o}.id`
477
535
  )
478
536
  ), d(r.prompt) || i.push(
479
- n(
537
+ a(
480
538
  "missing_obligation_prompt",
481
539
  "Each analytics obligation needs a prompt.",
482
540
  `obligations.${o}.prompt`
@@ -485,7 +543,7 @@ function T(e) {
485
543
  });
486
544
  else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
487
545
  if (d(e.instruction) || i.push(
488
- n(
546
+ a(
489
547
  "missing_instruction",
490
548
  "Change operation intent needs an instruction.",
491
549
  "instruction"
@@ -498,7 +556,7 @@ function T(e) {
498
556
  }
499
557
  } else
500
558
  i.push(
501
- n(
559
+ a(
502
560
  "invalid_operation_kind",
503
561
  "Operation intent kind is not supported.",
504
562
  "kind"
@@ -511,13 +569,13 @@ function T(e) {
511
569
  repairHints: k(i)
512
570
  };
513
571
  }
514
- function C(e) {
572
+ function O(e) {
515
573
  const i = [], s = [];
516
574
  if (!e || typeof e != "object")
517
575
  return {
518
576
  ok: !1,
519
577
  errors: [
520
- n(
578
+ a(
521
579
  "invalid_recovery_plan",
522
580
  "Analytics recovery plan must be a structured object."
523
581
  )
@@ -531,17 +589,17 @@ function C(e) {
531
589
  ]
532
590
  };
533
591
  e.version !== 1 && i.push(
534
- n("invalid_version", "Recovery plan version must be 1.", "version")
592
+ a("invalid_version", "Recovery plan version must be 1.", "version")
535
593
  ), e.kind !== "analytics_recovery_plan" && i.push(
536
- n(
594
+ a(
537
595
  "invalid_recovery_plan_kind",
538
596
  "Recovery plan kind must be analytics_recovery_plan.",
539
597
  "kind"
540
598
  )
541
599
  );
542
- const r = T(e.operationIntent);
600
+ const r = q(e.operationIntent);
543
601
  return i.push(...r.errors), s.push(...r.warnings), Array.isArray(e.plannedToolCalls) || i.push(
544
- n(
602
+ a(
545
603
  "invalid_planned_tool_calls",
546
604
  "Recovery plan plannedToolCalls must be an array.",
547
605
  "plannedToolCalls"
@@ -559,7 +617,7 @@ function k(e) {
559
617
  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."
560
618
  }));
561
619
  }
562
- function D(e) {
620
+ function E(e) {
563
621
  return e.map((i) => {
564
622
  switch (i.code) {
565
623
  case "missing_source":
@@ -612,14 +670,14 @@ function D(e) {
612
670
  }
613
671
  }).filter((i) => !!i);
614
672
  }
615
- function E(e, i, s, r) {
673
+ function C(e, i, s, r) {
616
674
  if (!e || typeof e != "object") {
617
- s.push(n("invalid_view", "Dashboard view must be an object.", i));
675
+ s.push(a("invalid_view", "Dashboard view must be an object.", i));
618
676
  return;
619
677
  }
620
- if (d(e.title) || s.push(n("missing_view_title", "Dashboard view needs a title.", i)), !e.presentation || typeof e.presentation != "object") {
678
+ if (d(e.title) || s.push(a("missing_view_title", "Dashboard view needs a title.", i)), !e.presentation || typeof e.presentation != "object") {
621
679
  s.push(
622
- n(
680
+ a(
623
681
  "missing_presentation",
624
682
  "Dashboard view needs a presentation.",
625
683
  `${i}.presentation`
@@ -629,7 +687,7 @@ function E(e, i, s, r) {
629
687
  }
630
688
  if (e.presentation.kind === "text") {
631
689
  d(e.text) || r.push(
632
- n(
690
+ a(
633
691
  "missing_text_content",
634
692
  "Text views should include text content.",
635
693
  `${i}.text`
@@ -639,7 +697,7 @@ function E(e, i, s, r) {
639
697
  }
640
698
  if (!e.analytics) {
641
699
  s.push(
642
- n(
700
+ a(
643
701
  "missing_view_analytics",
644
702
  "Non-text dashboard views need analytics intent.",
645
703
  `${i}.analytics`
@@ -648,86 +706,86 @@ function E(e, i, s, r) {
648
706
  return;
649
707
  }
650
708
  const o = A(e.analytics);
651
- for (const a of o.errors)
709
+ for (const n of o.errors)
652
710
  s.push(
653
- n(a.code, a.message, `${i}.analytics${a.path ? `.${a.path}` : ""}`)
711
+ a(n.code, n.message, `${i}.analytics${n.path ? `.${n.path}` : ""}`)
654
712
  );
655
- for (const a of o.warnings)
713
+ for (const n of o.warnings)
656
714
  r.push(
657
- n(
658
- a.code,
659
- a.message,
660
- `${i}.analytics${a.path ? `.${a.path}` : ""}`
715
+ a(
716
+ n.code,
717
+ n.message,
718
+ `${i}.analytics${n.path ? `.${n.path}` : ""}`
661
719
  )
662
720
  );
663
721
  }
664
- function P(e) {
722
+ function H(e) {
665
723
  const i = [], s = [];
666
724
  if (!e || typeof e != "object")
667
725
  return {
668
726
  ok: !1,
669
727
  errors: [
670
- n(
728
+ a(
671
729
  "invalid_dashboard_intent",
672
730
  "Dashboard intent must be a structured object."
673
731
  )
674
732
  ],
675
733
  warnings: s
676
734
  };
677
- 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"));
735
+ e.version !== 1 && i.push(a("invalid_version", "Dashboard intent version must be 1.")), e.kind !== "dashboard" && i.push(a("invalid_kind", "Experience intent kind must be dashboard.")), d(e.title) || i.push(a("missing_title", "Dashboard intent needs a title.", "title"));
678
736
  const r = Array.isArray(e.inputs) ? e.inputs : [], o = v(
679
- r.filter(u).map((c) => c.id).filter((c) => typeof c == "string")
737
+ r.filter(c).map((u) => u.id).filter((u) => typeof u == "string")
680
738
  );
681
739
  o && i.push(
682
- n(
740
+ a(
683
741
  "duplicate_input_id",
684
742
  `Duplicate input id: ${o}.`,
685
743
  "inputs"
686
744
  )
687
745
  );
688
- for (const [c, l] of r.entries()) {
689
- const m = `inputs.${c}`;
690
- if (!u(l)) {
691
- i.push(n("invalid_input", "Dashboard input must be an object.", m));
746
+ for (const [u, l] of r.entries()) {
747
+ const m = `inputs.${u}`;
748
+ if (!c(l)) {
749
+ i.push(a("invalid_input", "Dashboard input must be an object.", m));
692
750
  continue;
693
751
  }
694
- d(l.id) || i.push(n("missing_input_id", "Input needs an id.", `${m}.id`)), d(l.label) || i.push(
695
- n("missing_input_label", "Input needs a label.", `${m}.label`)
752
+ d(l.id) || i.push(a("missing_input_id", "Input needs an id.", `${m}.id`)), d(l.label) || i.push(
753
+ a("missing_input_label", "Input needs a label.", `${m}.label`)
696
754
  ), !l.field || !d(l.field.name) ? i.push(
697
- n("missing_input_field", "Input needs a field.", `${m}.field`)
755
+ a("missing_input_field", "Input needs a field.", `${m}.field`)
698
756
  ) : f(l.field, `${m}.field`, i);
699
757
  }
700
- const a = Array.isArray(e.sections) ? e.sections : [];
701
- a.length === 0 && i.push(
702
- n(
758
+ const n = Array.isArray(e.sections) ? e.sections : [];
759
+ n.length === 0 && i.push(
760
+ a(
703
761
  "missing_sections",
704
762
  "Dashboard intent needs at least one section.",
705
763
  "sections"
706
764
  )
707
765
  );
708
- const t = a.flatMap(
709
- (c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(u).map((l) => l.id).filter((l) => !!l) : []
766
+ const t = n.flatMap(
767
+ (u) => u && typeof u == "object" && Array.isArray(u.views) ? u.views.filter(c).map((l) => l.id).filter((l) => !!l) : []
710
768
  ), p = v(t);
711
769
  p && i.push(
712
- n(
770
+ a(
713
771
  "duplicate_view_id",
714
772
  `Duplicate dashboard view id: ${p}.`,
715
773
  "sections"
716
774
  )
717
775
  );
718
- for (const [c, l] of a.entries()) {
719
- const m = `sections.${c}`;
776
+ for (const [u, l] of n.entries()) {
777
+ const m = `sections.${u}`;
720
778
  if (!l || typeof l != "object") {
721
779
  i.push(
722
- n("invalid_section", "Dashboard section must be an object.", m)
780
+ a("invalid_section", "Dashboard section must be an object.", m)
723
781
  );
724
782
  continue;
725
783
  }
726
784
  if (d(l.title) || i.push(
727
- n("missing_section_title", "Dashboard section needs a title.", m)
785
+ a("missing_section_title", "Dashboard section needs a title.", m)
728
786
  ), !Array.isArray(l.views) || l.views.length === 0) {
729
787
  i.push(
730
- n(
788
+ a(
731
789
  "missing_section_views",
732
790
  "Dashboard section needs at least one view.",
733
791
  `${m}.views`
@@ -736,7 +794,7 @@ function P(e) {
736
794
  continue;
737
795
  }
738
796
  for (const [w, I] of l.views.entries())
739
- E(
797
+ C(
740
798
  I,
741
799
  `${m}.views.${w}`,
742
800
  i,
@@ -746,13 +804,13 @@ function P(e) {
746
804
  return { ok: i.length === 0, errors: i, warnings: s };
747
805
  }
748
806
  export {
749
- T as a,
750
- C as b,
751
- P as c,
752
- S as d,
753
- M as e,
754
- B as f,
755
- $ as p,
807
+ q as a,
808
+ O as b,
809
+ H as c,
810
+ M as d,
811
+ $ as e,
812
+ P as f,
813
+ S as p,
756
814
  y as s,
757
815
  A as v
758
816
  };