react-semaphor 0.1.367 → 0.1.369
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/brand-studio/index.cjs +5 -5
- package/dist/brand-studio/index.js +24 -23
- package/dist/chunks/{braces-Cc86y9Ov.js → braces-C3-w6xDL.js} +1 -1
- package/dist/chunks/{braces-CXvY9MwQ.js → braces-C8QqW4wu.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BOFlzOJg.js → calendar-preferences-dialog-6q51A6XC.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-ZzwfJv2J.js → calendar-preferences-dialog-CUGzkNcE.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CUZL1zaU.js → chevrons-up-down-CnCSGY02.js} +1 -1
- package/dist/chunks/{chevrons-up-down-qQMadOWA.js → chevrons-up-down-DSvLu4Ye.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-9-PCYMjR.js → dashboard-briefing-launcher-BEZnvIla.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D2lBFqAd.js → dashboard-briefing-launcher-ptERmNJr.js} +176 -177
- package/dist/chunks/{dashboard-controls-D4bUHAjX.js → dashboard-controls-CGt6_hMf.js} +11 -11
- package/dist/chunks/{dashboard-controls-BIk094Ah.js → dashboard-controls-CqKC5oEk.js} +77 -77
- package/dist/chunks/{dashboard-json-DImOf512.js → dashboard-json-6SgPm_QW.js} +13 -14
- package/dist/chunks/dashboard-json-CYSbOdmE.js +1 -0
- package/dist/chunks/{edit-dashboard-visual-DTxkV6Fl.js → edit-dashboard-visual-ByQx_M2i.js} +8 -9
- package/dist/chunks/{edit-dashboard-visual-BHKlcqQR.js → edit-dashboard-visual-w6hKbjlw.js} +1 -1
- package/dist/chunks/index-BtqYNH_S.js +1361 -0
- package/dist/chunks/{index-BVEIk-rB.js → index-CPyEi9gS.js} +72498 -76193
- package/dist/chunks/{palette-DPuAc82h.js → palette-D-f4-82S.js} +1 -1
- package/dist/chunks/{palette-C1k347Tb.js → palette-DUGktM-M.js} +1 -1
- package/dist/chunks/{resource-management-panel-BeHceP2D.js → resource-management-panel-Bf8-3eUf.js} +1 -1
- package/dist/chunks/{resource-management-panel-BOfbSf48.js → resource-management-panel-mJ84NxzC.js} +152 -152
- package/dist/chunks/save-D3YYinDz.js +6 -0
- package/dist/chunks/save-kkBEBeLg.js +21 -0
- package/dist/chunks/{switch-xcWLtWs0.js → switch-Dkx2qEOr.js} +758 -776
- package/dist/chunks/{switch-C0S63HAv.js → switch-fIkmwzUt.js} +27 -32
- package/dist/chunks/{use-create-flow-overlay-state-B5FygfQL.js → use-create-flow-overlay-state-BfoXDDrd.js} +190 -189
- package/dist/chunks/use-create-flow-overlay-state-c6rCm36x.js +26 -0
- package/dist/chunks/{use-visual-utils-DxDE8S8M.js → use-visual-utils-C_c-aiqi.js} +1 -1
- package/dist/chunks/{use-visual-utils-CszWnFBW.js → use-visual-utils-NN0e3fBP.js} +13 -13
- package/dist/chunks/validation-Dsf7PydY.js +1 -0
- package/dist/chunks/validation-nOPr0mTk.js +803 -0
- package/dist/chunks/{validators-L0xEXtjf.js → validators-CVuWOHYv.js} +225 -158
- package/dist/chunks/validators-oc8qtP4q.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +51 -1
- package/dist/data-app-builder/index.js +3666 -2
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +585 -383
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +21 -1
- package/dist/types/dashboard-assistant.d.ts +21 -1
- package/dist/types/dashboard-authoring.d.ts +11 -1
- package/dist/types/data-app-builder.d.ts +11 -1
- package/dist/types/data-app-sdk-validation.d.ts +107 -23
- package/dist/types/data-app-sdk.d.ts +168 -35
- package/dist/types/main.d.ts +11 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-json-Bo1kX6W1.js +0 -1
- package/dist/chunks/index-HjDeEytV.js +0 -1411
- package/dist/chunks/use-create-flow-overlay-state-DOXTbTcQ.js +0 -26
- package/dist/chunks/validation-CrUjNWby.js +0 -689
- package/dist/chunks/validation-DGl8wnTt.js +0 -1
- package/dist/chunks/validators-Dq5X4mp0.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
function
|
|
3
|
-
const i =
|
|
4
|
-
return
|
|
1
|
+
import { b as q } from "./source-identity-Dj3dryN9.js";
|
|
2
|
+
function te(e) {
|
|
3
|
+
const i = j(e);
|
|
4
|
+
return B(i) ? i : void 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function j(e) {
|
|
7
7
|
if (typeof e != "string" || e.trim().length === 0)
|
|
8
8
|
return;
|
|
9
9
|
const i = e.trim().toLowerCase().replace(/_/g, " ");
|
|
@@ -44,89 +44,125 @@ function D(e) {
|
|
|
44
44
|
return O(e) ? e : void 0;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function B(e) {
|
|
48
48
|
return e === "=" || e === "!=" || e === "in" || e === "not_in" || e === "contains" || e === "not_contains" || e === "between" || e === "not_between" || e === ">" || e === ">=" || e === "<" || e === "<=";
|
|
49
49
|
}
|
|
50
50
|
function O(e) {
|
|
51
|
-
return
|
|
51
|
+
return B(e) || e === "not_contains" || e === "is_null" || e === "is_not_null";
|
|
52
52
|
}
|
|
53
53
|
function t(e, i, n) {
|
|
54
54
|
return n ? { code: e, message: i, path: n } : { code: e, message: i };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function P(e) {
|
|
57
57
|
for (let i = 0; i < e.length; i += 1) {
|
|
58
58
|
const n = e[i];
|
|
59
59
|
if (e.some(
|
|
60
|
-
(o,
|
|
60
|
+
(o, r) => r !== i && R(o, n)
|
|
61
61
|
))
|
|
62
62
|
return !1;
|
|
63
63
|
}
|
|
64
64
|
return !0;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function x(e, i) {
|
|
67
|
+
return q(e, i);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function R(e, i) {
|
|
70
|
+
return x(e, i) && y(e) === y(i);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function E(e) {
|
|
73
73
|
return `Metric intent has duplicate metric "${e.name}" with the same aggregate (${y(e)}). Use different aggregates to request both, or remove one entry.`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
75
|
+
function S(e) {
|
|
76
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
77
|
+
}
|
|
78
|
+
function C(e, i, n) {
|
|
79
|
+
if (e !== void 0) {
|
|
80
|
+
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
81
|
+
n.push(
|
|
82
|
+
t(
|
|
83
|
+
"invalid_sql_default_parameters",
|
|
84
|
+
"SQL defaultParameters must be an object keyed by parameter name.",
|
|
85
|
+
i
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
Object.entries(e).forEach(([o, r]) => {
|
|
91
|
+
if (!o.trim()) {
|
|
92
|
+
n.push(
|
|
93
|
+
t(
|
|
94
|
+
"invalid_sql_default_parameter_name",
|
|
95
|
+
"SQL defaultParameters names must be non-empty strings.",
|
|
96
|
+
`${i}.${o}`
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
(Array.isArray(r) ? r.every(S) : S(r)) || n.push(
|
|
102
|
+
t(
|
|
103
|
+
"invalid_sql_default_parameter_value",
|
|
104
|
+
"SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
|
|
105
|
+
`${i}.${o}`
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function U(e, i) {
|
|
112
|
+
return v(e, i).length === 1;
|
|
77
113
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
114
|
+
function L(e, i) {
|
|
115
|
+
return v(e, i).length === 1;
|
|
80
116
|
}
|
|
81
|
-
function
|
|
117
|
+
function v(e, i) {
|
|
82
118
|
return i.filter(
|
|
83
|
-
(o) =>
|
|
119
|
+
(o) => z(e, o)
|
|
84
120
|
);
|
|
85
121
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
function P(e, i) {
|
|
90
|
-
return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role || G(e, i) && y(i) !== y(e));
|
|
122
|
+
function z(e, i) {
|
|
123
|
+
return G(e, i) ? e.source ? x(i, e) : !0 : !1;
|
|
91
124
|
}
|
|
92
125
|
function G(e, i) {
|
|
126
|
+
return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role || Q(e, i) && y(i) !== y(e));
|
|
127
|
+
}
|
|
128
|
+
function Q(e, i) {
|
|
93
129
|
return e.role === "measure" || i.role === "measure" || e.aggregate !== void 0 || i.aggregate !== void 0;
|
|
94
130
|
}
|
|
95
131
|
function y(e) {
|
|
96
132
|
return (e.aggregate || "SUM").toUpperCase();
|
|
97
133
|
}
|
|
98
|
-
const
|
|
134
|
+
const V = /^(\d{4})-(\d{2})-(\d{2})$/, H = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
99
135
|
function $(e) {
|
|
100
136
|
if (typeof e != "string")
|
|
101
137
|
return null;
|
|
102
|
-
const i = e.trim(), n =
|
|
138
|
+
const i = e.trim(), n = V.exec(i);
|
|
103
139
|
if (n) {
|
|
104
|
-
const [,
|
|
105
|
-
return
|
|
106
|
-
Date.UTC(Number(
|
|
140
|
+
const [, h, w, A] = n;
|
|
141
|
+
return I(h, w, A) ? new Date(
|
|
142
|
+
Date.UTC(Number(h), Number(w) - 1, Number(A))
|
|
107
143
|
) : null;
|
|
108
144
|
}
|
|
109
145
|
const o = H.exec(i);
|
|
110
146
|
if (!o)
|
|
111
147
|
return null;
|
|
112
|
-
const [,
|
|
113
|
-
if (!
|
|
148
|
+
const [, r, a, s, m, u, l = "00", , f] = o;
|
|
149
|
+
if (!I(r, a, s) || !_(m, 0, 23) || !_(u, 0, 59) || !_(l, 0, 59) || !X(f))
|
|
114
150
|
return null;
|
|
115
|
-
const
|
|
116
|
-
return Number.isFinite(
|
|
151
|
+
const g = new Date(i);
|
|
152
|
+
return Number.isFinite(g.getTime()) ? g : null;
|
|
117
153
|
}
|
|
118
|
-
function
|
|
119
|
-
const o = Number(e),
|
|
120
|
-
if (!Number.isInteger(o) || !Number.isInteger(
|
|
154
|
+
function I(e, i, n) {
|
|
155
|
+
const o = Number(e), r = Number(i), a = Number(n);
|
|
156
|
+
if (!Number.isInteger(o) || !Number.isInteger(r) || !Number.isInteger(a) || r < 1 || r > 12)
|
|
121
157
|
return !1;
|
|
122
|
-
const s = new Date(Date.UTC(o,
|
|
123
|
-
return s.getUTCFullYear() === o && s.getUTCMonth() ===
|
|
158
|
+
const s = new Date(Date.UTC(o, r - 1, a));
|
|
159
|
+
return s.getUTCFullYear() === o && s.getUTCMonth() === r - 1 && s.getUTCDate() === a;
|
|
124
160
|
}
|
|
125
161
|
function _(e, i, n) {
|
|
126
162
|
const o = Number(e);
|
|
127
163
|
return Number.isInteger(o) && o >= i && o <= n;
|
|
128
164
|
}
|
|
129
|
-
function
|
|
165
|
+
function X(e) {
|
|
130
166
|
if (e === "Z")
|
|
131
167
|
return !0;
|
|
132
168
|
const i = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
@@ -135,10 +171,37 @@ function V(e) {
|
|
|
135
171
|
function d(e) {
|
|
136
172
|
return typeof e == "string" && e.trim().length > 0;
|
|
137
173
|
}
|
|
138
|
-
function
|
|
174
|
+
function c(e) {
|
|
139
175
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
140
176
|
}
|
|
141
|
-
function
|
|
177
|
+
function M(e, i, n) {
|
|
178
|
+
if (e !== void 0) {
|
|
179
|
+
if (!c(e)) {
|
|
180
|
+
n.push(
|
|
181
|
+
t(
|
|
182
|
+
"invalid_pagination",
|
|
183
|
+
"Pagination must be an object with positive integer page and pageSize.",
|
|
184
|
+
i
|
|
185
|
+
)
|
|
186
|
+
);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
(!Number.isInteger(e.page) || typeof e.page != "number" || e.page < 1) && n.push(
|
|
190
|
+
t(
|
|
191
|
+
"invalid_pagination_page",
|
|
192
|
+
"Pagination page must be a positive integer.",
|
|
193
|
+
`${i}.page`
|
|
194
|
+
)
|
|
195
|
+
), (!Number.isInteger(e.pageSize) || typeof e.pageSize != "number" || e.pageSize < 1) && n.push(
|
|
196
|
+
t(
|
|
197
|
+
"invalid_pagination_page_size",
|
|
198
|
+
"Pagination pageSize must be a positive integer.",
|
|
199
|
+
`${i}.pageSize`
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function k(e) {
|
|
142
205
|
const i = /* @__PURE__ */ new Set();
|
|
143
206
|
for (const n of e) {
|
|
144
207
|
if (i.has(n))
|
|
@@ -147,7 +210,7 @@ function I(e) {
|
|
|
147
210
|
}
|
|
148
211
|
return null;
|
|
149
212
|
}
|
|
150
|
-
const
|
|
213
|
+
const Y = /* @__PURE__ */ new Set([
|
|
151
214
|
"SUM",
|
|
152
215
|
"COUNT",
|
|
153
216
|
"AVG",
|
|
@@ -156,7 +219,7 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
156
219
|
"MEDIAN",
|
|
157
220
|
"DISTINCT"
|
|
158
221
|
]);
|
|
159
|
-
function
|
|
222
|
+
function F(e, i, n) {
|
|
160
223
|
if (!e || typeof e != "object") {
|
|
161
224
|
n.push(t("missing_source", "Analytics intent needs a source.", i));
|
|
162
225
|
return;
|
|
@@ -206,7 +269,7 @@ function x(e, i, n) {
|
|
|
206
269
|
n.push(t("invalid_source_kind", "Source kind is not supported.", i));
|
|
207
270
|
}
|
|
208
271
|
function p(e, i, n, o = {}) {
|
|
209
|
-
if (!e || !
|
|
272
|
+
if (!e || !c(e)) {
|
|
210
273
|
o.required && n.push(
|
|
211
274
|
t("missing_field_ref", "Field reference needs a name.", i)
|
|
212
275
|
);
|
|
@@ -214,10 +277,10 @@ function p(e, i, n, o = {}) {
|
|
|
214
277
|
}
|
|
215
278
|
d(e.name) || n.push(
|
|
216
279
|
t("missing_field_ref", "Field reference needs a name.", `${i}.name`)
|
|
217
|
-
), e.source !== void 0 &&
|
|
280
|
+
), e.source !== void 0 && F(e.source, `${i}.source`, n), Z(e.aggregate, `${i}.aggregate`, n);
|
|
218
281
|
}
|
|
219
|
-
function
|
|
220
|
-
e !== void 0 && (typeof e != "string" || !
|
|
282
|
+
function Z(e, i, n) {
|
|
283
|
+
e !== void 0 && (typeof e != "string" || !Y.has(e)) && n.push(
|
|
221
284
|
t(
|
|
222
285
|
"invalid_aggregate",
|
|
223
286
|
"Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
|
|
@@ -225,10 +288,10 @@ function z(e, i, n) {
|
|
|
225
288
|
)
|
|
226
289
|
);
|
|
227
290
|
}
|
|
228
|
-
function
|
|
291
|
+
function J(e, i) {
|
|
229
292
|
if (e.analysis === void 0)
|
|
230
293
|
return;
|
|
231
|
-
if (!
|
|
294
|
+
if (!c(e.analysis)) {
|
|
232
295
|
i.push(
|
|
233
296
|
t(
|
|
234
297
|
"invalid_metric_analysis",
|
|
@@ -268,10 +331,10 @@ function X(e, i) {
|
|
|
268
331
|
)
|
|
269
332
|
);
|
|
270
333
|
const { timeWindow: n } = e.analysis;
|
|
271
|
-
n !== void 0 &&
|
|
334
|
+
n !== void 0 && b(n, "analysis.timeWindow", i);
|
|
272
335
|
}
|
|
273
|
-
function
|
|
274
|
-
if (!
|
|
336
|
+
function b(e, i, n) {
|
|
337
|
+
if (!c(e)) {
|
|
275
338
|
n.push(
|
|
276
339
|
t(
|
|
277
340
|
"invalid_time_window",
|
|
@@ -301,20 +364,20 @@ function v(e, i, n) {
|
|
|
301
364
|
`${i}.end`
|
|
302
365
|
)
|
|
303
366
|
), d(e.start) && d(e.end)) {
|
|
304
|
-
const o = $(e.start),
|
|
367
|
+
const o = $(e.start), r = $(e.end);
|
|
305
368
|
o || n.push(
|
|
306
369
|
t(
|
|
307
370
|
"invalid_time_window",
|
|
308
371
|
"Absolute time window start must be a valid ISO date or timestamp.",
|
|
309
372
|
`${i}.start`
|
|
310
373
|
)
|
|
311
|
-
),
|
|
374
|
+
), r || n.push(
|
|
312
375
|
t(
|
|
313
376
|
"invalid_time_window",
|
|
314
377
|
"Absolute time window end must be a valid ISO date or timestamp.",
|
|
315
378
|
`${i}.end`
|
|
316
379
|
)
|
|
317
|
-
), o &&
|
|
380
|
+
), o && r && o.getTime() > r.getTime() && n.push(
|
|
318
381
|
t(
|
|
319
382
|
"invalid_time_window",
|
|
320
383
|
"Absolute time window start must be before or equal to end.",
|
|
@@ -350,7 +413,7 @@ function v(e, i, n) {
|
|
|
350
413
|
)
|
|
351
414
|
);
|
|
352
415
|
}
|
|
353
|
-
function
|
|
416
|
+
function N(e, i, n) {
|
|
354
417
|
if (e !== void 0) {
|
|
355
418
|
if (!Array.isArray(e)) {
|
|
356
419
|
n.push(
|
|
@@ -362,33 +425,33 @@ function S(e, i, n) {
|
|
|
362
425
|
);
|
|
363
426
|
return;
|
|
364
427
|
}
|
|
365
|
-
e.forEach((o,
|
|
366
|
-
var
|
|
367
|
-
const
|
|
368
|
-
if (!
|
|
428
|
+
e.forEach((o, r) => {
|
|
429
|
+
var u;
|
|
430
|
+
const a = `${i}.${r}`;
|
|
431
|
+
if (!c(o)) {
|
|
369
432
|
n.push(
|
|
370
433
|
t(
|
|
371
434
|
"invalid_analytics_filter",
|
|
372
435
|
"Analytics filter must be a structured object.",
|
|
373
|
-
|
|
436
|
+
a
|
|
374
437
|
)
|
|
375
438
|
);
|
|
376
439
|
return;
|
|
377
440
|
}
|
|
378
441
|
const s = o;
|
|
379
|
-
p(s.field, `${
|
|
442
|
+
p(s.field, `${a}.field`, n, {
|
|
380
443
|
required: !0
|
|
381
444
|
}), s.scope !== void 0 && s.scope !== "row" && s.scope !== "aggregate" && n.push(
|
|
382
445
|
t(
|
|
383
446
|
"invalid_analytics_filter_scope",
|
|
384
447
|
"Analytics filter scope must be row or aggregate.",
|
|
385
|
-
`${
|
|
448
|
+
`${a}.scope`
|
|
386
449
|
)
|
|
387
|
-
), s.scope === "aggregate" && ((
|
|
450
|
+
), s.scope === "aggregate" && ((u = s.field) == null ? void 0 : u.role) !== void 0 && s.field.role !== "measure" && n.push(
|
|
388
451
|
t(
|
|
389
452
|
"invalid_analytics_filter_scope",
|
|
390
453
|
"Aggregate-scope analytics filters must target a measure field.",
|
|
391
|
-
`${
|
|
454
|
+
`${a}.scope`
|
|
392
455
|
)
|
|
393
456
|
);
|
|
394
457
|
const m = s.operator === "is_null" || s.operator === "is_not_null";
|
|
@@ -396,20 +459,20 @@ function S(e, i, n) {
|
|
|
396
459
|
t(
|
|
397
460
|
"invalid_analytics_filter_operator",
|
|
398
461
|
"Analytics filter operator is not supported.",
|
|
399
|
-
`${
|
|
462
|
+
`${a}.operator`
|
|
400
463
|
)
|
|
401
464
|
), s.values === void 0 && !m && n.push(
|
|
402
465
|
t(
|
|
403
466
|
"missing_analytics_filter_value",
|
|
404
467
|
"Analytics filter needs values unless it is a null check.",
|
|
405
|
-
|
|
468
|
+
a
|
|
406
469
|
)
|
|
407
470
|
), m && s.values !== void 0) {
|
|
408
471
|
n.push(
|
|
409
472
|
t(
|
|
410
473
|
"invalid_analytics_filter_values",
|
|
411
474
|
"Null-check analytics filters must not include values.",
|
|
412
|
-
`${
|
|
475
|
+
`${a}.values`
|
|
413
476
|
)
|
|
414
477
|
);
|
|
415
478
|
return;
|
|
@@ -419,7 +482,7 @@ function S(e, i, n) {
|
|
|
419
482
|
t(
|
|
420
483
|
"invalid_analytics_filter_values",
|
|
421
484
|
"Analytics filter values must be an array when provided.",
|
|
422
|
-
`${
|
|
485
|
+
`${a}.values`
|
|
423
486
|
)
|
|
424
487
|
);
|
|
425
488
|
return;
|
|
@@ -431,7 +494,7 @@ function S(e, i, n) {
|
|
|
431
494
|
t(
|
|
432
495
|
"invalid_analytics_filter_values",
|
|
433
496
|
"Between analytics filters must include exactly two values.",
|
|
434
|
-
`${
|
|
497
|
+
`${a}.values`
|
|
435
498
|
)
|
|
436
499
|
);
|
|
437
500
|
return;
|
|
@@ -440,14 +503,14 @@ function S(e, i, n) {
|
|
|
440
503
|
t(
|
|
441
504
|
"invalid_analytics_filter_values",
|
|
442
505
|
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
443
|
-
`${
|
|
506
|
+
`${a}.values`
|
|
444
507
|
)
|
|
445
508
|
);
|
|
446
509
|
}
|
|
447
510
|
});
|
|
448
511
|
}
|
|
449
512
|
}
|
|
450
|
-
function
|
|
513
|
+
function T(e) {
|
|
451
514
|
var o;
|
|
452
515
|
const i = [], n = [];
|
|
453
516
|
if (!e || typeof e != "object")
|
|
@@ -469,41 +532,41 @@ function F(e) {
|
|
|
469
532
|
};
|
|
470
533
|
if (e.version !== void 0 && e.version !== 1 && i.push(
|
|
471
534
|
t("invalid_version", "Analytics intent version must be 1.", "version")
|
|
472
|
-
),
|
|
473
|
-
const
|
|
474
|
-
(
|
|
535
|
+
), F(e.source, "source", i), e.kind === "metric") {
|
|
536
|
+
const r = Array.isArray(e.metrics) ? e.metrics.filter(
|
|
537
|
+
(a) => c(a) && d(a.name)
|
|
475
538
|
) : [];
|
|
476
539
|
if (!Array.isArray(e.metrics) || e.metrics.length === 0 ? i.push(
|
|
477
540
|
t("missing_metric", "Metric intent needs at least one metric.", "metrics")
|
|
478
541
|
) : e.metrics.some(
|
|
479
|
-
(
|
|
542
|
+
(a) => !c(a) || !d(a.name)
|
|
480
543
|
) && i.push(
|
|
481
544
|
t(
|
|
482
545
|
"invalid_metric_list",
|
|
483
546
|
"Metric intent metrics must be an array of field references with names.",
|
|
484
547
|
"metrics"
|
|
485
548
|
)
|
|
486
|
-
),
|
|
487
|
-
p(
|
|
549
|
+
), r.forEach((a, s) => {
|
|
550
|
+
p(a, `metrics.${s}`, i, {
|
|
488
551
|
required: !0
|
|
489
552
|
});
|
|
490
|
-
}),
|
|
491
|
-
const
|
|
492
|
-
(s, m) =>
|
|
493
|
-
(
|
|
553
|
+
}), r.length > 0 && !P(r)) {
|
|
554
|
+
const a = r.find(
|
|
555
|
+
(s, m) => r.some(
|
|
556
|
+
(u, l) => l !== m && R(u, s)
|
|
494
557
|
)
|
|
495
558
|
);
|
|
496
|
-
|
|
559
|
+
a && i.push(
|
|
497
560
|
t(
|
|
498
561
|
"duplicate_metric",
|
|
499
|
-
|
|
562
|
+
E(a),
|
|
500
563
|
"metrics"
|
|
501
564
|
)
|
|
502
565
|
);
|
|
503
566
|
}
|
|
504
|
-
if (
|
|
567
|
+
if (c(e.primaryMetric) && d(e.primaryMetric.name) && v(
|
|
505
568
|
e.primaryMetric,
|
|
506
|
-
|
|
569
|
+
r
|
|
507
570
|
).length > 1 && i.push(
|
|
508
571
|
t(
|
|
509
572
|
"ambiguous_primary_metric",
|
|
@@ -512,9 +575,9 @@ function F(e) {
|
|
|
512
575
|
)
|
|
513
576
|
), e.primaryMetric !== void 0 && (p(e.primaryMetric, "primaryMetric", i, {
|
|
514
577
|
required: !0
|
|
515
|
-
}),
|
|
578
|
+
}), c(e.primaryMetric) && d(e.primaryMetric.name) && r.length > 0 && !U(
|
|
516
579
|
e.primaryMetric,
|
|
517
|
-
|
|
580
|
+
r
|
|
518
581
|
) && i.push(
|
|
519
582
|
t(
|
|
520
583
|
"invalid_primary_metric",
|
|
@@ -528,23 +591,23 @@ function F(e) {
|
|
|
528
591
|
"dimensions"
|
|
529
592
|
)
|
|
530
593
|
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
531
|
-
(
|
|
594
|
+
(a) => !c(a) || !d(a.name)
|
|
532
595
|
) && i.push(
|
|
533
596
|
t(
|
|
534
597
|
"invalid_metric_dimensions",
|
|
535
598
|
"Metric intent dimensions must be an array of field references with names.",
|
|
536
599
|
"dimensions"
|
|
537
600
|
)
|
|
538
|
-
), e.dateField !== void 0 && p(e.dateField, "dateField", i), e.timeWindow !== void 0 && (
|
|
601
|
+
), e.dateField !== void 0 && p(e.dateField, "dateField", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
|
|
539
602
|
t(
|
|
540
603
|
"missing_time_window_date_field",
|
|
541
604
|
"Metric timeWindow needs a dateField.",
|
|
542
605
|
"dateField"
|
|
543
606
|
)
|
|
544
|
-
)),
|
|
545
|
-
p(
|
|
607
|
+
)), N(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((a, s) => {
|
|
608
|
+
p(a, `dimensions.${s}`, i);
|
|
546
609
|
}), e.orderBy !== void 0) {
|
|
547
|
-
if (!
|
|
610
|
+
if (!c(e.orderBy))
|
|
548
611
|
i.push(
|
|
549
612
|
t(
|
|
550
613
|
"invalid_metric_order_by",
|
|
@@ -560,17 +623,17 @@ function F(e) {
|
|
|
560
623
|
"Metric intent orderBy direction must be asc or desc.",
|
|
561
624
|
"orderBy.direction"
|
|
562
625
|
)
|
|
563
|
-
),
|
|
564
|
-
const
|
|
565
|
-
...
|
|
566
|
-
...e.timeGrain && e.dateField &&
|
|
626
|
+
), c(e.orderBy.field) && d(e.orderBy.field.name)) {
|
|
627
|
+
const a = [
|
|
628
|
+
...r,
|
|
629
|
+
...e.timeGrain && e.dateField && c(e.dateField) ? [e.dateField] : [],
|
|
567
630
|
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
568
|
-
(s) =>
|
|
631
|
+
(s) => c(s) && d(s.name)
|
|
569
632
|
) : []
|
|
570
633
|
];
|
|
571
|
-
|
|
634
|
+
a.length > 0 && !L(
|
|
572
635
|
e.orderBy.field,
|
|
573
|
-
|
|
636
|
+
a
|
|
574
637
|
) && i.push(
|
|
575
638
|
t(
|
|
576
639
|
"invalid_metric_order_by",
|
|
@@ -580,7 +643,7 @@ function F(e) {
|
|
|
580
643
|
);
|
|
581
644
|
}
|
|
582
645
|
}
|
|
583
|
-
|
|
646
|
+
J(e, i);
|
|
584
647
|
} else e.kind === "records" ? (!Array.isArray(e.fields) || e.fields.length === 0 ? i.push(
|
|
585
648
|
t(
|
|
586
649
|
"missing_record_fields",
|
|
@@ -588,30 +651,30 @@ function F(e) {
|
|
|
588
651
|
"fields"
|
|
589
652
|
)
|
|
590
653
|
) : e.fields.some(
|
|
591
|
-
(
|
|
654
|
+
(r) => !c(r) || !d(r.name)
|
|
592
655
|
) && i.push(
|
|
593
656
|
t(
|
|
594
657
|
"invalid_record_fields",
|
|
595
658
|
"Records intent fields must be field references with names.",
|
|
596
659
|
"fields"
|
|
597
660
|
)
|
|
598
|
-
), Array.isArray(e.fields) && e.fields.forEach((
|
|
599
|
-
p(
|
|
600
|
-
}), e.dateField !== void 0 && p(e.dateField, "dateField", i), e.timeWindow !== void 0 && (
|
|
661
|
+
), Array.isArray(e.fields) && e.fields.forEach((r, a) => {
|
|
662
|
+
p(r, `fields.${a}`, i);
|
|
663
|
+
}), e.dateField !== void 0 && p(e.dateField, "dateField", i), M(e.pagination, "pagination", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
|
|
601
664
|
t(
|
|
602
665
|
"missing_time_window_date_field",
|
|
603
666
|
"Records timeWindow needs a dateField.",
|
|
604
667
|
"dateField"
|
|
605
668
|
)
|
|
606
|
-
)),
|
|
607
|
-
|
|
669
|
+
)), N(e.filters, "filters", i), Array.isArray(e.filters) && e.filters.forEach((r, a) => {
|
|
670
|
+
c(r) && r.scope === "aggregate" && i.push(
|
|
608
671
|
t(
|
|
609
672
|
"unsupported_record_filter_scope",
|
|
610
673
|
"Records intents support row-scope filters only. Use a metric intent for aggregate-scope filters.",
|
|
611
|
-
`filters.${
|
|
674
|
+
`filters.${a}.scope`
|
|
612
675
|
)
|
|
613
676
|
);
|
|
614
|
-
}), e.orderBy !== void 0 && (
|
|
677
|
+
}), e.orderBy !== void 0 && (c(e.orderBy) ? (p(e.orderBy.field, "orderBy.field", i, {
|
|
615
678
|
required: !0
|
|
616
679
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
|
|
617
680
|
t(
|
|
@@ -637,19 +700,23 @@ function F(e) {
|
|
|
637
700
|
"SQL analytics intent must use a SQL execution source.",
|
|
638
701
|
"source"
|
|
639
702
|
)
|
|
640
|
-
), d(e.sql) || i.push(t("missing_sql", "SQL analytics intent needs SQL text.", "sql")),
|
|
641
|
-
|
|
642
|
-
|
|
703
|
+
), d(e.sql) || i.push(t("missing_sql", "SQL analytics intent needs SQL text.", "sql")), C(
|
|
704
|
+
e.defaultParameters,
|
|
705
|
+
"defaultParameters",
|
|
706
|
+
i
|
|
707
|
+
), Array.isArray(e.fields) && e.fields.forEach((r, a) => {
|
|
708
|
+
p(r, `fields.${a}`, i);
|
|
709
|
+
}), M(e.pagination, "pagination", i)) : i.push(
|
|
643
710
|
t("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
|
|
644
711
|
);
|
|
645
712
|
return {
|
|
646
713
|
ok: i.length === 0,
|
|
647
714
|
errors: i,
|
|
648
715
|
warnings: n,
|
|
649
|
-
repairHints:
|
|
716
|
+
repairHints: W(i)
|
|
650
717
|
};
|
|
651
718
|
}
|
|
652
|
-
function
|
|
719
|
+
function K(e) {
|
|
653
720
|
const i = [], n = [];
|
|
654
721
|
if (!e || typeof e != "object")
|
|
655
722
|
return {
|
|
@@ -677,18 +744,18 @@ function Y(e) {
|
|
|
677
744
|
"Answer-obligations operation intent needs at least one obligation.",
|
|
678
745
|
"obligations"
|
|
679
746
|
)
|
|
680
|
-
) : e.obligations.forEach((o,
|
|
747
|
+
) : e.obligations.forEach((o, r) => {
|
|
681
748
|
d(o.id) || i.push(
|
|
682
749
|
t(
|
|
683
750
|
"missing_obligation_id",
|
|
684
751
|
"Each analytics obligation needs an id.",
|
|
685
|
-
`obligations.${
|
|
752
|
+
`obligations.${r}.id`
|
|
686
753
|
)
|
|
687
754
|
), d(o.prompt) || i.push(
|
|
688
755
|
t(
|
|
689
756
|
"missing_obligation_prompt",
|
|
690
757
|
"Each analytics obligation needs a prompt.",
|
|
691
|
-
`obligations.${
|
|
758
|
+
`obligations.${r}.prompt`
|
|
692
759
|
)
|
|
693
760
|
);
|
|
694
761
|
});
|
|
@@ -700,7 +767,7 @@ function Y(e) {
|
|
|
700
767
|
"instruction"
|
|
701
768
|
)
|
|
702
769
|
), e.analyticsIntent) {
|
|
703
|
-
const o =
|
|
770
|
+
const o = T(
|
|
704
771
|
e.analyticsIntent
|
|
705
772
|
);
|
|
706
773
|
i.push(...o.errors), n.push(...o.warnings);
|
|
@@ -717,10 +784,10 @@ function Y(e) {
|
|
|
717
784
|
ok: i.length === 0,
|
|
718
785
|
errors: i,
|
|
719
786
|
warnings: n,
|
|
720
|
-
repairHints:
|
|
787
|
+
repairHints: D(i)
|
|
721
788
|
};
|
|
722
789
|
}
|
|
723
|
-
function
|
|
790
|
+
function ne(e) {
|
|
724
791
|
const i = [], n = [];
|
|
725
792
|
if (!e || typeof e != "object")
|
|
726
793
|
return {
|
|
@@ -748,7 +815,7 @@ function ee(e) {
|
|
|
748
815
|
"kind"
|
|
749
816
|
)
|
|
750
817
|
);
|
|
751
|
-
const o =
|
|
818
|
+
const o = K(e.operationIntent);
|
|
752
819
|
return i.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || i.push(
|
|
753
820
|
t(
|
|
754
821
|
"invalid_planned_tool_calls",
|
|
@@ -759,16 +826,16 @@ function ee(e) {
|
|
|
759
826
|
ok: i.length === 0,
|
|
760
827
|
errors: i,
|
|
761
828
|
warnings: n,
|
|
762
|
-
repairHints:
|
|
829
|
+
repairHints: D(i)
|
|
763
830
|
};
|
|
764
831
|
}
|
|
765
|
-
function
|
|
832
|
+
function D(e) {
|
|
766
833
|
return e.map((i) => ({
|
|
767
834
|
code: i.code,
|
|
768
835
|
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."
|
|
769
836
|
}));
|
|
770
837
|
}
|
|
771
|
-
function
|
|
838
|
+
function W(e) {
|
|
772
839
|
return e.map((i) => {
|
|
773
840
|
switch (i.code) {
|
|
774
841
|
case "missing_source":
|
|
@@ -821,7 +888,7 @@ function Z(e) {
|
|
|
821
888
|
}
|
|
822
889
|
}).filter((i) => !!i);
|
|
823
890
|
}
|
|
824
|
-
function
|
|
891
|
+
function ee(e, i, n, o) {
|
|
825
892
|
if (!e || typeof e != "object") {
|
|
826
893
|
n.push(t("invalid_view", "Dashboard view must be an object.", i));
|
|
827
894
|
return;
|
|
@@ -856,21 +923,21 @@ function J(e, i, n, o) {
|
|
|
856
923
|
);
|
|
857
924
|
return;
|
|
858
925
|
}
|
|
859
|
-
const
|
|
860
|
-
for (const
|
|
926
|
+
const r = T(e.analytics);
|
|
927
|
+
for (const a of r.errors)
|
|
861
928
|
n.push(
|
|
862
|
-
t(
|
|
929
|
+
t(a.code, a.message, `${i}.analytics${a.path ? `.${a.path}` : ""}`)
|
|
863
930
|
);
|
|
864
|
-
for (const
|
|
931
|
+
for (const a of r.warnings)
|
|
865
932
|
o.push(
|
|
866
933
|
t(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
`${i}.analytics${
|
|
934
|
+
a.code,
|
|
935
|
+
a.message,
|
|
936
|
+
`${i}.analytics${a.path ? `.${a.path}` : ""}`
|
|
870
937
|
)
|
|
871
938
|
);
|
|
872
939
|
}
|
|
873
|
-
function
|
|
940
|
+
function se(e) {
|
|
874
941
|
const i = [], n = [];
|
|
875
942
|
if (!e || typeof e != "object")
|
|
876
943
|
return {
|
|
@@ -884,19 +951,19 @@ function ie(e) {
|
|
|
884
951
|
warnings: n
|
|
885
952
|
};
|
|
886
953
|
e.version !== 1 && i.push(t("invalid_version", "Dashboard intent version must be 1.")), e.kind !== "dashboard" && i.push(t("invalid_kind", "Experience intent kind must be dashboard.")), d(e.title) || i.push(t("missing_title", "Dashboard intent needs a title.", "title"));
|
|
887
|
-
const o = Array.isArray(e.inputs) ? e.inputs : [],
|
|
888
|
-
o.filter(
|
|
954
|
+
const o = Array.isArray(e.inputs) ? e.inputs : [], r = k(
|
|
955
|
+
o.filter(c).map((u) => u.id).filter((u) => typeof u == "string")
|
|
889
956
|
);
|
|
890
|
-
|
|
957
|
+
r && i.push(
|
|
891
958
|
t(
|
|
892
959
|
"duplicate_input_id",
|
|
893
|
-
`Duplicate input id: ${
|
|
960
|
+
`Duplicate input id: ${r}.`,
|
|
894
961
|
"inputs"
|
|
895
962
|
)
|
|
896
963
|
);
|
|
897
|
-
for (const [
|
|
898
|
-
const f = `inputs.${
|
|
899
|
-
if (!
|
|
964
|
+
for (const [u, l] of o.entries()) {
|
|
965
|
+
const f = `inputs.${u}`;
|
|
966
|
+
if (!c(l)) {
|
|
900
967
|
i.push(t("invalid_input", "Dashboard input must be an object.", f));
|
|
901
968
|
continue;
|
|
902
969
|
}
|
|
@@ -906,17 +973,17 @@ function ie(e) {
|
|
|
906
973
|
t("missing_input_field", "Input needs a field.", `${f}.field`)
|
|
907
974
|
) : p(l.field, `${f}.field`, i);
|
|
908
975
|
}
|
|
909
|
-
const
|
|
910
|
-
|
|
976
|
+
const a = Array.isArray(e.sections) ? e.sections : [];
|
|
977
|
+
a.length === 0 && i.push(
|
|
911
978
|
t(
|
|
912
979
|
"missing_sections",
|
|
913
980
|
"Dashboard intent needs at least one section.",
|
|
914
981
|
"sections"
|
|
915
982
|
)
|
|
916
983
|
);
|
|
917
|
-
const s =
|
|
918
|
-
(
|
|
919
|
-
), m =
|
|
984
|
+
const s = a.flatMap(
|
|
985
|
+
(u) => u && typeof u == "object" && Array.isArray(u.views) ? u.views.filter(c).map((l) => l.id).filter((l) => !!l) : []
|
|
986
|
+
), m = k(s);
|
|
920
987
|
m && i.push(
|
|
921
988
|
t(
|
|
922
989
|
"duplicate_view_id",
|
|
@@ -924,8 +991,8 @@ function ie(e) {
|
|
|
924
991
|
"sections"
|
|
925
992
|
)
|
|
926
993
|
);
|
|
927
|
-
for (const [
|
|
928
|
-
const f = `sections.${
|
|
994
|
+
for (const [u, l] of a.entries()) {
|
|
995
|
+
const f = `sections.${u}`;
|
|
929
996
|
if (!l || typeof l != "object") {
|
|
930
997
|
i.push(
|
|
931
998
|
t("invalid_section", "Dashboard section must be an object.", f)
|
|
@@ -944,10 +1011,10 @@ function ie(e) {
|
|
|
944
1011
|
);
|
|
945
1012
|
continue;
|
|
946
1013
|
}
|
|
947
|
-
for (const [
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
`${f}.views.${
|
|
1014
|
+
for (const [g, h] of l.views.entries())
|
|
1015
|
+
ee(
|
|
1016
|
+
h,
|
|
1017
|
+
`${f}.views.${g}`,
|
|
951
1018
|
i,
|
|
952
1019
|
n
|
|
953
1020
|
);
|
|
@@ -955,11 +1022,11 @@ function ie(e) {
|
|
|
955
1022
|
return { ok: i.length === 0, errors: i, warnings: n };
|
|
956
1023
|
}
|
|
957
1024
|
export {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1025
|
+
j as a,
|
|
1026
|
+
K as b,
|
|
1027
|
+
ne as c,
|
|
1028
|
+
se as d,
|
|
1029
|
+
te as n,
|
|
963
1030
|
$ as p,
|
|
964
|
-
|
|
1031
|
+
T as v
|
|
965
1032
|
};
|