react-semaphor 0.1.365 → 0.1.366
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 +26 -24
- package/dist/chunks/{calendar-preferences-dialog-CgBwWqfY.js → calendar-preferences-dialog-BOFlzOJg.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CK_6KGFV.js → dashboard-briefing-launcher-D2lBFqAd.js} +3 -3
- package/dist/chunks/{dashboard-controls-CsIEj0Vm.js → dashboard-controls-BIk094Ah.js} +3 -3
- package/dist/chunks/{dashboard-json-OhYs9GOx.js → dashboard-json-DImOf512.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-q_XG4oWg.js → edit-dashboard-visual-DTxkV6Fl.js} +3 -3
- package/dist/chunks/{index-Ds3_EAla.js → index-BVEIk-rB.js} +5 -5
- package/dist/chunks/{resource-management-panel-CYXyE2js.js → resource-management-panel-BOfbSf48.js} +2 -2
- package/dist/chunks/{source-identity-qAmkNtEK.js → source-identity-Dj3dryN9.js} +3 -3
- package/dist/chunks/{use-create-flow-overlay-state-CRQcqLs3.js → use-create-flow-overlay-state-B5FygfQL.js} +2 -2
- package/dist/chunks/{use-visual-utils-CpZplRpR.js → use-visual-utils-CszWnFBW.js} +1 -1
- package/dist/chunks/validation-DiCE3_4O.js +1 -0
- package/dist/chunks/{validation-B4_hBuYu.js → validation-WGWJOQsV.js} +115 -94
- package/dist/chunks/{validators-BnLhuIhd.js → validators-Bxc1OmZK.js} +296 -237
- package/dist/chunks/validators-BxhJ_NtM.js +1 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +135 -134
- package/dist/data-app-builder/index.js +1 -1
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +3 -3
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +3 -3
- package/dist/index.js +5 -5
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +11 -1
- package/dist/types/dashboard-assistant.d.ts +2 -0
- package/dist/types/dashboard-authoring.d.ts +7 -1
- package/dist/types/data-app-builder.d.ts +2 -0
- package/dist/types/data-app-sdk-validation.d.ts +4 -0
- package/dist/types/data-app-sdk.d.ts +21 -6
- package/dist/types/main.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/validation-CsK42Vbq.js +0 -1
- package/dist/chunks/validators-Cu_w8ZEP.js +0 -1
|
@@ -1,81 +1,132 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
import { b as T } from "./source-identity-Dj3dryN9.js";
|
|
2
|
+
function W(e) {
|
|
3
|
+
const i = D(e);
|
|
4
|
+
return k(i) ? i : void 0;
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
+
function D(e) {
|
|
7
|
+
if (typeof e != "string" || e.trim().length === 0)
|
|
8
|
+
return;
|
|
9
|
+
const i = e.trim().toLowerCase().replace(/_/g, " ");
|
|
10
|
+
switch (i) {
|
|
11
|
+
case "eq":
|
|
12
|
+
case "equals":
|
|
13
|
+
case "=":
|
|
14
|
+
return "=";
|
|
15
|
+
case "neq":
|
|
16
|
+
case "not equals":
|
|
17
|
+
case "not equal":
|
|
18
|
+
case "!=":
|
|
19
|
+
return "!=";
|
|
20
|
+
case "in":
|
|
21
|
+
return "in";
|
|
22
|
+
case "not in":
|
|
23
|
+
return "not_in";
|
|
24
|
+
case "contains":
|
|
25
|
+
case "like":
|
|
26
|
+
return "contains";
|
|
27
|
+
case "not contains":
|
|
28
|
+
case "not like":
|
|
29
|
+
return "not_contains";
|
|
30
|
+
case "between":
|
|
31
|
+
return "between";
|
|
32
|
+
case "not between":
|
|
33
|
+
return "not_between";
|
|
34
|
+
case ">":
|
|
35
|
+
case ">=":
|
|
36
|
+
case "<":
|
|
37
|
+
case "<=":
|
|
38
|
+
return i;
|
|
39
|
+
case "is null":
|
|
40
|
+
return "is_null";
|
|
41
|
+
case "is not null":
|
|
42
|
+
return "is_not_null";
|
|
43
|
+
default:
|
|
44
|
+
return O(e) ? e : void 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function k(e) {
|
|
48
|
+
return e === "=" || e === "!=" || e === "in" || e === "not_in" || e === "contains" || e === "between" || e === "not_between" || e === ">" || e === ">=" || e === "<" || e === "<=";
|
|
49
|
+
}
|
|
50
|
+
function O(e) {
|
|
51
|
+
return k(e) || e === "not_contains" || e === "is_null" || e === "is_not_null";
|
|
52
|
+
}
|
|
53
|
+
function n(e, i, t) {
|
|
54
|
+
return t ? { code: e, message: i, path: t } : { code: e, message: i };
|
|
55
|
+
}
|
|
56
|
+
function q(e) {
|
|
6
57
|
for (let i = 0; i < e.length; i += 1) {
|
|
7
|
-
const
|
|
58
|
+
const t = e[i];
|
|
8
59
|
if (e.some(
|
|
9
|
-
(r, o) => o !== i &&
|
|
60
|
+
(r, o) => o !== i && B(r, t)
|
|
10
61
|
))
|
|
11
62
|
return !1;
|
|
12
63
|
}
|
|
13
64
|
return !0;
|
|
14
65
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
66
|
+
function N(e, i) {
|
|
67
|
+
return T(e, i);
|
|
17
68
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
69
|
+
function B(e, i) {
|
|
70
|
+
return N(e, i) && y(e) === y(i);
|
|
20
71
|
}
|
|
21
|
-
function
|
|
72
|
+
function j(e) {
|
|
22
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.`;
|
|
23
74
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
75
|
+
function C(e, i) {
|
|
76
|
+
return b(e, i).length === 1;
|
|
26
77
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
78
|
+
function E(e, i) {
|
|
79
|
+
return b(e, i).length === 1;
|
|
29
80
|
}
|
|
30
|
-
function
|
|
81
|
+
function b(e, i) {
|
|
31
82
|
return i.filter(
|
|
32
|
-
(r) =>
|
|
83
|
+
(r) => U(e, r)
|
|
33
84
|
);
|
|
34
85
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
86
|
+
function U(e, i) {
|
|
87
|
+
return P(e, i) ? e.source ? N(i, e) : !0 : !1;
|
|
37
88
|
}
|
|
38
|
-
function
|
|
39
|
-
return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role ||
|
|
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));
|
|
40
91
|
}
|
|
41
|
-
function
|
|
92
|
+
function G(e, i) {
|
|
42
93
|
return e.role === "measure" || i.role === "measure" || e.aggregate !== void 0 || i.aggregate !== void 0;
|
|
43
94
|
}
|
|
44
95
|
function y(e) {
|
|
45
96
|
return (e.aggregate || "SUM").toUpperCase();
|
|
46
97
|
}
|
|
47
|
-
const
|
|
48
|
-
function
|
|
98
|
+
const L = /^(\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
|
+
function M(e) {
|
|
49
100
|
if (typeof e != "string")
|
|
50
101
|
return null;
|
|
51
|
-
const i = e.trim(),
|
|
52
|
-
if (
|
|
53
|
-
const [,
|
|
54
|
-
return
|
|
55
|
-
Date.UTC(Number(
|
|
102
|
+
const i = e.trim(), t = L.exec(i);
|
|
103
|
+
if (t) {
|
|
104
|
+
const [, g, w, A] = t;
|
|
105
|
+
return $(g, w, A) ? new Date(
|
|
106
|
+
Date.UTC(Number(g), Number(w) - 1, Number(A))
|
|
56
107
|
) : null;
|
|
57
108
|
}
|
|
58
|
-
const r =
|
|
109
|
+
const r = H.exec(i);
|
|
59
110
|
if (!r)
|
|
60
111
|
return null;
|
|
61
|
-
const [, o, a,
|
|
62
|
-
if (
|
|
112
|
+
const [, o, a, s, p, c, l = "00", , f] = r;
|
|
113
|
+
if (!$(o, a, s) || !_(p, 0, 23) || !_(c, 0, 59) || !_(l, 0, 59) || !V(f))
|
|
63
114
|
return null;
|
|
64
115
|
const h = new Date(i);
|
|
65
116
|
return Number.isFinite(h.getTime()) ? h : null;
|
|
66
117
|
}
|
|
67
|
-
function
|
|
68
|
-
const r = Number(e), o = Number(i), a = Number(
|
|
118
|
+
function $(e, i, t) {
|
|
119
|
+
const r = Number(e), o = Number(i), a = Number(t);
|
|
69
120
|
if (!Number.isInteger(r) || !Number.isInteger(o) || !Number.isInteger(a) || o < 1 || o > 12)
|
|
70
121
|
return !1;
|
|
71
|
-
const
|
|
72
|
-
return
|
|
122
|
+
const s = new Date(Date.UTC(r, o - 1, a));
|
|
123
|
+
return s.getUTCFullYear() === r && s.getUTCMonth() === o - 1 && s.getUTCDate() === a;
|
|
73
124
|
}
|
|
74
|
-
function _(e, i,
|
|
125
|
+
function _(e, i, t) {
|
|
75
126
|
const r = Number(e);
|
|
76
|
-
return Number.isInteger(r) && r >= i && r <=
|
|
127
|
+
return Number.isInteger(r) && r >= i && r <= t;
|
|
77
128
|
}
|
|
78
|
-
function
|
|
129
|
+
function V(e) {
|
|
79
130
|
if (e === "Z")
|
|
80
131
|
return !0;
|
|
81
132
|
const i = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
@@ -87,16 +138,16 @@ function d(e) {
|
|
|
87
138
|
function u(e) {
|
|
88
139
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
89
140
|
}
|
|
90
|
-
function
|
|
141
|
+
function I(e) {
|
|
91
142
|
const i = /* @__PURE__ */ new Set();
|
|
92
|
-
for (const
|
|
93
|
-
if (i.has(
|
|
94
|
-
return
|
|
95
|
-
i.add(
|
|
143
|
+
for (const t of e) {
|
|
144
|
+
if (i.has(t))
|
|
145
|
+
return t;
|
|
146
|
+
i.add(t);
|
|
96
147
|
}
|
|
97
148
|
return null;
|
|
98
149
|
}
|
|
99
|
-
const
|
|
150
|
+
const Q = /* @__PURE__ */ new Set([
|
|
100
151
|
"SUM",
|
|
101
152
|
"COUNT",
|
|
102
153
|
"AVG",
|
|
@@ -105,20 +156,20 @@ const G = /* @__PURE__ */ new Set([
|
|
|
105
156
|
"MEDIAN",
|
|
106
157
|
"DISTINCT"
|
|
107
158
|
]);
|
|
108
|
-
function
|
|
159
|
+
function x(e, i, t) {
|
|
109
160
|
if (!e || typeof e != "object") {
|
|
110
|
-
|
|
161
|
+
t.push(n("missing_source", "Analytics intent needs a source.", i));
|
|
111
162
|
return;
|
|
112
163
|
}
|
|
113
164
|
if (e.kind === "semantic") {
|
|
114
|
-
d(e.domainId) ||
|
|
115
|
-
|
|
165
|
+
d(e.domainId) || t.push(
|
|
166
|
+
n(
|
|
116
167
|
"missing_semantic_domain",
|
|
117
168
|
"Semantic source needs a domainId.",
|
|
118
169
|
`${i}.domainId`
|
|
119
170
|
)
|
|
120
|
-
), d(e.datasetName) ||
|
|
121
|
-
|
|
171
|
+
), d(e.datasetName) || t.push(
|
|
172
|
+
n(
|
|
122
173
|
"missing_dataset_name",
|
|
123
174
|
"Semantic source needs a datasetName.",
|
|
124
175
|
`${i}.datasetName`
|
|
@@ -127,14 +178,14 @@ function k(e, i, s) {
|
|
|
127
178
|
return;
|
|
128
179
|
}
|
|
129
180
|
if (e.kind === "physical") {
|
|
130
|
-
d(e.connectionId) ||
|
|
131
|
-
|
|
181
|
+
d(e.connectionId) || t.push(
|
|
182
|
+
n(
|
|
132
183
|
"missing_connection_id",
|
|
133
184
|
"Physical source needs a connectionId.",
|
|
134
185
|
`${i}.connectionId`
|
|
135
186
|
)
|
|
136
|
-
), d(e.tableName) ||
|
|
137
|
-
|
|
187
|
+
), d(e.tableName) || t.push(
|
|
188
|
+
n(
|
|
138
189
|
"missing_table_name",
|
|
139
190
|
"Physical source needs a tableName.",
|
|
140
191
|
`${i}.tableName`
|
|
@@ -143,8 +194,8 @@ function k(e, i, s) {
|
|
|
143
194
|
return;
|
|
144
195
|
}
|
|
145
196
|
if (e.kind === "sql") {
|
|
146
|
-
d(e.connectionId) ||
|
|
147
|
-
|
|
197
|
+
d(e.connectionId) || t.push(
|
|
198
|
+
n(
|
|
148
199
|
"missing_connection_id",
|
|
149
200
|
"SQL source needs a connectionId.",
|
|
150
201
|
`${i}.connectionId`
|
|
@@ -152,34 +203,34 @@ function k(e, i, s) {
|
|
|
152
203
|
);
|
|
153
204
|
return;
|
|
154
205
|
}
|
|
155
|
-
|
|
206
|
+
t.push(n("invalid_source_kind", "Source kind is not supported.", i));
|
|
156
207
|
}
|
|
157
|
-
function m(e, i,
|
|
208
|
+
function m(e, i, t, r = {}) {
|
|
158
209
|
if (!e || !u(e)) {
|
|
159
|
-
r.required &&
|
|
160
|
-
|
|
210
|
+
r.required && t.push(
|
|
211
|
+
n("missing_field_ref", "Field reference needs a name.", i)
|
|
161
212
|
);
|
|
162
213
|
return;
|
|
163
214
|
}
|
|
164
|
-
d(e.name) ||
|
|
165
|
-
|
|
166
|
-
), e.source !== void 0 &&
|
|
215
|
+
d(e.name) || t.push(
|
|
216
|
+
n("missing_field_ref", "Field reference needs a name.", `${i}.name`)
|
|
217
|
+
), e.source !== void 0 && x(e.source, `${i}.source`, t), z(e.aggregate, `${i}.aggregate`, t);
|
|
167
218
|
}
|
|
168
|
-
function
|
|
169
|
-
e !== void 0 && (typeof e != "string" || !
|
|
170
|
-
|
|
219
|
+
function z(e, i, t) {
|
|
220
|
+
e !== void 0 && (typeof e != "string" || !Q.has(e)) && t.push(
|
|
221
|
+
n(
|
|
171
222
|
"invalid_aggregate",
|
|
172
223
|
"Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
|
|
173
224
|
i
|
|
174
225
|
)
|
|
175
226
|
);
|
|
176
227
|
}
|
|
177
|
-
function
|
|
228
|
+
function X(e, i) {
|
|
178
229
|
if (e.analysis === void 0)
|
|
179
230
|
return;
|
|
180
231
|
if (!u(e.analysis)) {
|
|
181
232
|
i.push(
|
|
182
|
-
|
|
233
|
+
n(
|
|
183
234
|
"invalid_metric_analysis",
|
|
184
235
|
"Metric analysis must be a structured object.",
|
|
185
236
|
"analysis"
|
|
@@ -189,7 +240,7 @@ function L(e, i) {
|
|
|
189
240
|
}
|
|
190
241
|
if (e.analysis.kind !== "period_change") {
|
|
191
242
|
i.push(
|
|
192
|
-
|
|
243
|
+
n(
|
|
193
244
|
"invalid_metric_analysis",
|
|
194
245
|
"Metric analysis kind is not supported.",
|
|
195
246
|
"analysis.kind"
|
|
@@ -198,31 +249,31 @@ function L(e, i) {
|
|
|
198
249
|
return;
|
|
199
250
|
}
|
|
200
251
|
e.dateField || i.push(
|
|
201
|
-
|
|
252
|
+
n(
|
|
202
253
|
"missing_analysis_date_field",
|
|
203
254
|
"Period-change analysis needs a dateField.",
|
|
204
255
|
"dateField"
|
|
205
256
|
)
|
|
206
257
|
), e.timeGrain || i.push(
|
|
207
|
-
|
|
258
|
+
n(
|
|
208
259
|
"missing_analysis_time_grain",
|
|
209
260
|
"Period-change analysis needs a timeGrain.",
|
|
210
261
|
"timeGrain"
|
|
211
262
|
)
|
|
212
263
|
), 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(
|
|
213
|
-
|
|
264
|
+
n(
|
|
214
265
|
"invalid_metric_analysis",
|
|
215
266
|
"Period-change analysis orderBy must be absolute_change, positive_change, negative_change, or period.",
|
|
216
267
|
"analysis.orderBy"
|
|
217
268
|
)
|
|
218
269
|
);
|
|
219
|
-
const { timeWindow:
|
|
220
|
-
|
|
270
|
+
const { timeWindow: t } = e.analysis;
|
|
271
|
+
t !== void 0 && v(t, "analysis.timeWindow", i);
|
|
221
272
|
}
|
|
222
|
-
function
|
|
273
|
+
function v(e, i, t) {
|
|
223
274
|
if (!u(e)) {
|
|
224
|
-
|
|
225
|
-
|
|
275
|
+
t.push(
|
|
276
|
+
n(
|
|
226
277
|
"invalid_time_window",
|
|
227
278
|
"Time window must be a structured object.",
|
|
228
279
|
i
|
|
@@ -230,41 +281,41 @@ function N(e, i, s) {
|
|
|
230
281
|
);
|
|
231
282
|
return;
|
|
232
283
|
}
|
|
233
|
-
if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "absolute" &&
|
|
234
|
-
|
|
284
|
+
if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "absolute" && t.push(
|
|
285
|
+
n(
|
|
235
286
|
"invalid_time_window",
|
|
236
287
|
"Time window kind must be relative or absolute.",
|
|
237
288
|
`${i}.kind`
|
|
238
289
|
)
|
|
239
290
|
), e.kind === "absolute") {
|
|
240
|
-
if (d(e.start) ||
|
|
241
|
-
|
|
291
|
+
if (d(e.start) || t.push(
|
|
292
|
+
n(
|
|
242
293
|
"invalid_time_window",
|
|
243
294
|
"Absolute time window start must be a non-empty ISO date or timestamp string.",
|
|
244
295
|
`${i}.start`
|
|
245
296
|
)
|
|
246
|
-
), d(e.end) ||
|
|
247
|
-
|
|
297
|
+
), d(e.end) || t.push(
|
|
298
|
+
n(
|
|
248
299
|
"invalid_time_window",
|
|
249
300
|
"Absolute time window end must be a non-empty ISO date or timestamp string.",
|
|
250
301
|
`${i}.end`
|
|
251
302
|
)
|
|
252
303
|
), d(e.start) && d(e.end)) {
|
|
253
|
-
const r =
|
|
254
|
-
r ||
|
|
255
|
-
|
|
304
|
+
const r = M(e.start), o = M(e.end);
|
|
305
|
+
r || t.push(
|
|
306
|
+
n(
|
|
256
307
|
"invalid_time_window",
|
|
257
308
|
"Absolute time window start must be a valid ISO date or timestamp.",
|
|
258
309
|
`${i}.start`
|
|
259
310
|
)
|
|
260
|
-
), o ||
|
|
261
|
-
|
|
311
|
+
), o || t.push(
|
|
312
|
+
n(
|
|
262
313
|
"invalid_time_window",
|
|
263
314
|
"Absolute time window end must be a valid ISO date or timestamp.",
|
|
264
315
|
`${i}.end`
|
|
265
316
|
)
|
|
266
|
-
), r && o && r.getTime() > o.getTime() &&
|
|
267
|
-
|
|
317
|
+
), r && o && r.getTime() > o.getTime() && t.push(
|
|
318
|
+
n(
|
|
268
319
|
"invalid_time_window",
|
|
269
320
|
"Absolute time window start must be before or equal to end.",
|
|
270
321
|
i
|
|
@@ -273,37 +324,37 @@ function N(e, i, s) {
|
|
|
273
324
|
}
|
|
274
325
|
return;
|
|
275
326
|
}
|
|
276
|
-
e.unit !== "second" && e.unit !== "minute" && e.unit !== "hour" && e.unit !== "day" && e.unit !== "week" && e.unit !== "month" && e.unit !== "quarter" && e.unit !== "year" &&
|
|
277
|
-
|
|
327
|
+
e.unit !== "second" && e.unit !== "minute" && e.unit !== "hour" && e.unit !== "day" && e.unit !== "week" && e.unit !== "month" && e.unit !== "quarter" && e.unit !== "year" && t.push(
|
|
328
|
+
n(
|
|
278
329
|
"invalid_time_window",
|
|
279
330
|
"Time window unit must be second, minute, hour, day, week, month, quarter, or year.",
|
|
280
331
|
`${i}.unit`
|
|
281
332
|
)
|
|
282
|
-
), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) &&
|
|
283
|
-
|
|
333
|
+
), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && t.push(
|
|
334
|
+
n(
|
|
284
335
|
"invalid_time_window",
|
|
285
336
|
"Time window value must be a positive number.",
|
|
286
337
|
`${i}.value`
|
|
287
338
|
)
|
|
288
|
-
), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" &&
|
|
289
|
-
|
|
339
|
+
), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && t.push(
|
|
340
|
+
n(
|
|
290
341
|
"invalid_time_window",
|
|
291
342
|
"Time window anchor must be now or latest_available.",
|
|
292
343
|
`${i}.anchor`
|
|
293
344
|
)
|
|
294
|
-
), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" &&
|
|
295
|
-
|
|
345
|
+
), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" && t.push(
|
|
346
|
+
n(
|
|
296
347
|
"invalid_time_window",
|
|
297
348
|
"Time window completeness must be include_partial or complete_periods.",
|
|
298
349
|
`${i}.completeness`
|
|
299
350
|
)
|
|
300
351
|
);
|
|
301
352
|
}
|
|
302
|
-
function
|
|
353
|
+
function S(e, i, t) {
|
|
303
354
|
if (e !== void 0) {
|
|
304
355
|
if (!Array.isArray(e)) {
|
|
305
|
-
|
|
306
|
-
|
|
356
|
+
t.push(
|
|
357
|
+
n(
|
|
307
358
|
"invalid_analytics_filters",
|
|
308
359
|
"Analytics filters must be an array.",
|
|
309
360
|
i
|
|
@@ -315,8 +366,8 @@ function V(e, i, s) {
|
|
|
315
366
|
var c;
|
|
316
367
|
const a = `${i}.${o}`;
|
|
317
368
|
if (!u(r)) {
|
|
318
|
-
|
|
319
|
-
|
|
369
|
+
t.push(
|
|
370
|
+
n(
|
|
320
371
|
"invalid_analytics_filter",
|
|
321
372
|
"Analytics filter must be a structured object.",
|
|
322
373
|
a
|
|
@@ -324,38 +375,38 @@ function V(e, i, s) {
|
|
|
324
375
|
);
|
|
325
376
|
return;
|
|
326
377
|
}
|
|
327
|
-
const
|
|
328
|
-
m(
|
|
378
|
+
const s = r;
|
|
379
|
+
m(s.field, `${a}.field`, t, {
|
|
329
380
|
required: !0
|
|
330
|
-
}),
|
|
331
|
-
|
|
381
|
+
}), s.scope !== void 0 && s.scope !== "row" && s.scope !== "aggregate" && t.push(
|
|
382
|
+
n(
|
|
332
383
|
"invalid_analytics_filter_scope",
|
|
333
384
|
"Analytics filter scope must be row or aggregate.",
|
|
334
385
|
`${a}.scope`
|
|
335
386
|
)
|
|
336
|
-
),
|
|
337
|
-
|
|
387
|
+
), s.scope === "aggregate" && ((c = s.field) == null ? void 0 : c.role) !== void 0 && s.field.role !== "measure" && t.push(
|
|
388
|
+
n(
|
|
338
389
|
"invalid_analytics_filter_scope",
|
|
339
390
|
"Aggregate-scope analytics filters must target a measure field.",
|
|
340
391
|
`${a}.scope`
|
|
341
392
|
)
|
|
342
393
|
);
|
|
343
|
-
const p =
|
|
344
|
-
if (
|
|
345
|
-
|
|
394
|
+
const p = s.operator === "is_null" || s.operator === "is_not_null";
|
|
395
|
+
if (s.operator !== void 0 && s.operator !== "=" && s.operator !== "!=" && s.operator !== "in" && s.operator !== "not_in" && s.operator !== "contains" && s.operator !== "not_contains" && s.operator !== "between" && s.operator !== "not_between" && s.operator !== ">" && s.operator !== ">=" && s.operator !== "<" && s.operator !== "<=" && s.operator !== "is_null" && s.operator !== "is_not_null" && t.push(
|
|
396
|
+
n(
|
|
346
397
|
"invalid_analytics_filter_operator",
|
|
347
398
|
"Analytics filter operator is not supported.",
|
|
348
399
|
`${a}.operator`
|
|
349
400
|
)
|
|
350
|
-
),
|
|
351
|
-
|
|
401
|
+
), s.values === void 0 && !p && t.push(
|
|
402
|
+
n(
|
|
352
403
|
"missing_analytics_filter_value",
|
|
353
404
|
"Analytics filter needs values unless it is a null check.",
|
|
354
405
|
a
|
|
355
406
|
)
|
|
356
|
-
), p &&
|
|
357
|
-
|
|
358
|
-
|
|
407
|
+
), p && s.values !== void 0) {
|
|
408
|
+
t.push(
|
|
409
|
+
n(
|
|
359
410
|
"invalid_analytics_filter_values",
|
|
360
411
|
"Null-check analytics filters must not include values.",
|
|
361
412
|
`${a}.values`
|
|
@@ -363,9 +414,9 @@ function V(e, i, s) {
|
|
|
363
414
|
);
|
|
364
415
|
return;
|
|
365
416
|
}
|
|
366
|
-
if (
|
|
367
|
-
|
|
368
|
-
|
|
417
|
+
if (s.values !== void 0 && !Array.isArray(s.values)) {
|
|
418
|
+
t.push(
|
|
419
|
+
n(
|
|
369
420
|
"invalid_analytics_filter_values",
|
|
370
421
|
"Analytics filter values must be an array when provided.",
|
|
371
422
|
`${a}.values`
|
|
@@ -373,11 +424,11 @@ function V(e, i, s) {
|
|
|
373
424
|
);
|
|
374
425
|
return;
|
|
375
426
|
}
|
|
376
|
-
if (
|
|
377
|
-
const l =
|
|
378
|
-
if (
|
|
379
|
-
l !== 2 &&
|
|
380
|
-
|
|
427
|
+
if (s.values !== void 0) {
|
|
428
|
+
const l = s.values.length;
|
|
429
|
+
if (s.operator === "between" || s.operator === "not_between") {
|
|
430
|
+
l !== 2 && t.push(
|
|
431
|
+
n(
|
|
381
432
|
"invalid_analytics_filter_values",
|
|
382
433
|
"Between analytics filters must include exactly two values.",
|
|
383
434
|
`${a}.values`
|
|
@@ -385,8 +436,8 @@ function V(e, i, s) {
|
|
|
385
436
|
);
|
|
386
437
|
return;
|
|
387
438
|
}
|
|
388
|
-
(
|
|
389
|
-
|
|
439
|
+
(s.operator === "contains" || s.operator === "not_contains" || s.operator === "=" || s.operator === "!=" || s.operator === ">" || s.operator === ">=" || s.operator === "<" || s.operator === "<=" || s.operator === void 0) && l !== 1 && t.push(
|
|
440
|
+
n(
|
|
390
441
|
"invalid_analytics_filter_values",
|
|
391
442
|
"Scalar analytics filters must include exactly one value. Use in/not_in for multiple values.",
|
|
392
443
|
`${a}.values`
|
|
@@ -396,19 +447,19 @@ function V(e, i, s) {
|
|
|
396
447
|
});
|
|
397
448
|
}
|
|
398
449
|
}
|
|
399
|
-
function
|
|
450
|
+
function F(e) {
|
|
400
451
|
var r;
|
|
401
|
-
const i = [],
|
|
452
|
+
const i = [], t = [];
|
|
402
453
|
if (!e || typeof e != "object")
|
|
403
454
|
return {
|
|
404
455
|
ok: !1,
|
|
405
456
|
errors: [
|
|
406
|
-
|
|
457
|
+
n(
|
|
407
458
|
"invalid_analytics_intent",
|
|
408
459
|
"Analytics intent must be a structured object."
|
|
409
460
|
)
|
|
410
461
|
],
|
|
411
|
-
warnings:
|
|
462
|
+
warnings: t,
|
|
412
463
|
repairHints: [
|
|
413
464
|
{
|
|
414
465
|
code: "invalid_analytics_intent",
|
|
@@ -417,61 +468,61 @@ function B(e) {
|
|
|
417
468
|
]
|
|
418
469
|
};
|
|
419
470
|
if (e.version !== void 0 && e.version !== 1 && i.push(
|
|
420
|
-
|
|
421
|
-
),
|
|
471
|
+
n("invalid_version", "Analytics intent version must be 1.", "version")
|
|
472
|
+
), x(e.source, "source", i), e.kind === "metric") {
|
|
422
473
|
const o = Array.isArray(e.metrics) ? e.metrics.filter(
|
|
423
474
|
(a) => u(a) && d(a.name)
|
|
424
475
|
) : [];
|
|
425
476
|
if (!Array.isArray(e.metrics) || e.metrics.length === 0 ? i.push(
|
|
426
|
-
|
|
477
|
+
n("missing_metric", "Metric intent needs at least one metric.", "metrics")
|
|
427
478
|
) : e.metrics.some(
|
|
428
479
|
(a) => !u(a) || !d(a.name)
|
|
429
480
|
) && i.push(
|
|
430
|
-
|
|
481
|
+
n(
|
|
431
482
|
"invalid_metric_list",
|
|
432
483
|
"Metric intent metrics must be an array of field references with names.",
|
|
433
484
|
"metrics"
|
|
434
485
|
)
|
|
435
|
-
), o.forEach((a,
|
|
436
|
-
m(a, `metrics.${
|
|
486
|
+
), o.forEach((a, s) => {
|
|
487
|
+
m(a, `metrics.${s}`, i, {
|
|
437
488
|
required: !0
|
|
438
489
|
});
|
|
439
|
-
}), o.length > 0 && !
|
|
490
|
+
}), o.length > 0 && !q(o)) {
|
|
440
491
|
const a = o.find(
|
|
441
|
-
(
|
|
442
|
-
(c, l) => l !== p &&
|
|
492
|
+
(s, p) => o.some(
|
|
493
|
+
(c, l) => l !== p && B(c, s)
|
|
443
494
|
)
|
|
444
495
|
);
|
|
445
496
|
a && i.push(
|
|
446
|
-
|
|
497
|
+
n(
|
|
447
498
|
"duplicate_metric",
|
|
448
|
-
|
|
499
|
+
j(a),
|
|
449
500
|
"metrics"
|
|
450
501
|
)
|
|
451
502
|
);
|
|
452
503
|
}
|
|
453
|
-
if (u(e.primaryMetric) && d(e.primaryMetric.name) &&
|
|
504
|
+
if (u(e.primaryMetric) && d(e.primaryMetric.name) && b(
|
|
454
505
|
e.primaryMetric,
|
|
455
506
|
o
|
|
456
507
|
).length > 1 && i.push(
|
|
457
|
-
|
|
508
|
+
n(
|
|
458
509
|
"ambiguous_primary_metric",
|
|
459
510
|
"Metric intent primaryMetric must identify exactly one selected metric.",
|
|
460
511
|
"primaryMetric"
|
|
461
512
|
)
|
|
462
513
|
), e.primaryMetric !== void 0 && (m(e.primaryMetric, "primaryMetric", i, {
|
|
463
514
|
required: !0
|
|
464
|
-
}), u(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !
|
|
515
|
+
}), u(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !C(
|
|
465
516
|
e.primaryMetric,
|
|
466
517
|
o
|
|
467
518
|
) && i.push(
|
|
468
|
-
|
|
519
|
+
n(
|
|
469
520
|
"invalid_primary_metric",
|
|
470
521
|
"Metric intent primaryMetric must match one metric field reference.",
|
|
471
522
|
"primaryMetric"
|
|
472
523
|
)
|
|
473
524
|
)), e.dimensions !== void 0 && !Array.isArray(e.dimensions) ? i.push(
|
|
474
|
-
|
|
525
|
+
n(
|
|
475
526
|
"invalid_metric_dimensions",
|
|
476
527
|
"Metric intent dimensions must be an array of field references.",
|
|
477
528
|
"dimensions"
|
|
@@ -479,23 +530,23 @@ function B(e) {
|
|
|
479
530
|
) : Array.isArray(e.dimensions) && e.dimensions.some(
|
|
480
531
|
(a) => !u(a) || !d(a.name)
|
|
481
532
|
) && i.push(
|
|
482
|
-
|
|
533
|
+
n(
|
|
483
534
|
"invalid_metric_dimensions",
|
|
484
535
|
"Metric intent dimensions must be an array of field references with names.",
|
|
485
536
|
"dimensions"
|
|
486
537
|
)
|
|
487
|
-
), e.dateField !== void 0 && m(e.dateField, "dateField", i), e.timeWindow !== void 0 && (
|
|
488
|
-
|
|
538
|
+
), e.dateField !== void 0 && m(e.dateField, "dateField", i), e.timeWindow !== void 0 && (v(e.timeWindow, "timeWindow", i), e.dateField || i.push(
|
|
539
|
+
n(
|
|
489
540
|
"missing_time_window_date_field",
|
|
490
541
|
"Metric timeWindow needs a dateField.",
|
|
491
542
|
"dateField"
|
|
492
543
|
)
|
|
493
|
-
)),
|
|
494
|
-
m(a, `dimensions.${
|
|
544
|
+
)), S(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((a, s) => {
|
|
545
|
+
m(a, `dimensions.${s}`, i);
|
|
495
546
|
}), e.orderBy !== void 0) {
|
|
496
547
|
if (!u(e.orderBy))
|
|
497
548
|
i.push(
|
|
498
|
-
|
|
549
|
+
n(
|
|
499
550
|
"invalid_metric_order_by",
|
|
500
551
|
"Metric intent orderBy must be a structured object.",
|
|
501
552
|
"orderBy"
|
|
@@ -504,7 +555,7 @@ function B(e) {
|
|
|
504
555
|
else if (m(e.orderBy.field, "orderBy.field", i, {
|
|
505
556
|
required: !0
|
|
506
557
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
|
|
507
|
-
|
|
558
|
+
n(
|
|
508
559
|
"invalid_metric_order_direction",
|
|
509
560
|
"Metric intent orderBy direction must be asc or desc.",
|
|
510
561
|
"orderBy.direction"
|
|
@@ -514,14 +565,14 @@ function B(e) {
|
|
|
514
565
|
...o,
|
|
515
566
|
...e.timeGrain && e.dateField && u(e.dateField) ? [e.dateField] : [],
|
|
516
567
|
...Array.isArray(e.dimensions) ? e.dimensions.filter(
|
|
517
|
-
(
|
|
568
|
+
(s) => u(s) && d(s.name)
|
|
518
569
|
) : []
|
|
519
570
|
];
|
|
520
|
-
a.length > 0 && !
|
|
571
|
+
a.length > 0 && !E(
|
|
521
572
|
e.orderBy.field,
|
|
522
573
|
a
|
|
523
574
|
) && i.push(
|
|
524
|
-
|
|
575
|
+
n(
|
|
525
576
|
"invalid_metric_order_by",
|
|
526
577
|
"Metric intent orderBy.field must match one selected metric, grouped dateField, or dimension.",
|
|
527
578
|
"orderBy.field"
|
|
@@ -529,9 +580,9 @@ function B(e) {
|
|
|
529
580
|
);
|
|
530
581
|
}
|
|
531
582
|
}
|
|
532
|
-
|
|
583
|
+
X(e, i);
|
|
533
584
|
} else e.kind === "records" ? (!Array.isArray(e.fields) || e.fields.length === 0 ? i.push(
|
|
534
|
-
|
|
585
|
+
n(
|
|
535
586
|
"missing_record_fields",
|
|
536
587
|
"Records intent needs at least one field.",
|
|
537
588
|
"fields"
|
|
@@ -539,63 +590,69 @@ function B(e) {
|
|
|
539
590
|
) : e.fields.some(
|
|
540
591
|
(o) => !u(o) || !d(o.name)
|
|
541
592
|
) && i.push(
|
|
542
|
-
|
|
593
|
+
n(
|
|
543
594
|
"invalid_record_fields",
|
|
544
595
|
"Records intent fields must be field references with names.",
|
|
545
596
|
"fields"
|
|
546
597
|
)
|
|
547
598
|
), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
|
|
548
599
|
m(o, `fields.${a}`, i);
|
|
549
|
-
}), e.dateField !== void 0 && m(e.dateField, "dateField", i), e.
|
|
600
|
+
}), e.dateField !== void 0 && m(e.dateField, "dateField", i), e.timeWindow !== void 0 && (v(e.timeWindow, "timeWindow", i), e.dateField || i.push(
|
|
601
|
+
n(
|
|
602
|
+
"missing_time_window_date_field",
|
|
603
|
+
"Records timeWindow needs a dateField.",
|
|
604
|
+
"dateField"
|
|
605
|
+
)
|
|
606
|
+
)), S(e.filters, "filters", i), e.orderBy !== void 0 && (u(e.orderBy) ? (m(e.orderBy.field, "orderBy.field", i, {
|
|
550
607
|
required: !0
|
|
551
608
|
}), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
|
|
552
|
-
|
|
609
|
+
n(
|
|
553
610
|
"invalid_record_order_direction",
|
|
554
611
|
"Records intent orderBy direction must be asc or desc.",
|
|
555
612
|
"orderBy.direction"
|
|
556
613
|
)
|
|
557
614
|
)) : i.push(
|
|
558
|
-
|
|
615
|
+
n(
|
|
559
616
|
"invalid_record_order_by",
|
|
560
617
|
"Records intent orderBy must be a structured object.",
|
|
561
618
|
"orderBy"
|
|
562
619
|
)
|
|
563
620
|
))) : e.kind === "inputOptions" ? ((!e.field || !d(e.field.name)) && i.push(
|
|
564
|
-
|
|
621
|
+
n(
|
|
565
622
|
"missing_input_options_field",
|
|
566
623
|
"Input options intent needs a field.",
|
|
567
624
|
"field"
|
|
568
625
|
)
|
|
569
626
|
), m(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((r = e.source) == null ? void 0 : r.kind) !== "sql" && i.push(
|
|
570
|
-
|
|
627
|
+
n(
|
|
571
628
|
"invalid_sql_source",
|
|
572
629
|
"SQL analytics intent must use a SQL execution source.",
|
|
573
630
|
"source"
|
|
574
631
|
)
|
|
575
|
-
), d(e.sql) || i.push(
|
|
632
|
+
), d(e.sql) || i.push(n("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((o, a) => {
|
|
576
633
|
m(o, `fields.${a}`, i);
|
|
577
634
|
})) : i.push(
|
|
578
|
-
|
|
635
|
+
n("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
|
|
579
636
|
);
|
|
580
637
|
return {
|
|
581
638
|
ok: i.length === 0,
|
|
582
639
|
errors: i,
|
|
583
|
-
warnings:
|
|
584
|
-
repairHints:
|
|
640
|
+
warnings: t,
|
|
641
|
+
repairHints: Z(i)
|
|
585
642
|
};
|
|
586
643
|
}
|
|
587
|
-
function
|
|
588
|
-
const i = [],
|
|
644
|
+
function Y(e) {
|
|
645
|
+
const i = [], t = [];
|
|
589
646
|
if (!e || typeof e != "object")
|
|
590
647
|
return {
|
|
591
648
|
ok: !1,
|
|
592
649
|
errors: [
|
|
593
|
-
|
|
650
|
+
n(
|
|
594
651
|
"invalid_operation_intent",
|
|
595
652
|
"Operation intent must be a structured object."
|
|
596
653
|
)
|
|
597
654
|
],
|
|
598
|
-
warnings:
|
|
655
|
+
warnings: t,
|
|
599
656
|
repairHints: [
|
|
600
657
|
{
|
|
601
658
|
code: "invalid_operation_intent",
|
|
@@ -604,23 +661,23 @@ function Q(e) {
|
|
|
604
661
|
]
|
|
605
662
|
};
|
|
606
663
|
if (e.version !== 1 && i.push(
|
|
607
|
-
|
|
664
|
+
n("invalid_version", "Operation intent version must be 1.", "version")
|
|
608
665
|
), e.kind === "answer_obligations")
|
|
609
666
|
!Array.isArray(e.obligations) || e.obligations.length === 0 ? i.push(
|
|
610
|
-
|
|
667
|
+
n(
|
|
611
668
|
"missing_obligations",
|
|
612
669
|
"Answer-obligations operation intent needs at least one obligation.",
|
|
613
670
|
"obligations"
|
|
614
671
|
)
|
|
615
672
|
) : e.obligations.forEach((r, o) => {
|
|
616
673
|
d(r.id) || i.push(
|
|
617
|
-
|
|
674
|
+
n(
|
|
618
675
|
"missing_obligation_id",
|
|
619
676
|
"Each analytics obligation needs an id.",
|
|
620
677
|
`obligations.${o}.id`
|
|
621
678
|
)
|
|
622
679
|
), d(r.prompt) || i.push(
|
|
623
|
-
|
|
680
|
+
n(
|
|
624
681
|
"missing_obligation_prompt",
|
|
625
682
|
"Each analytics obligation needs a prompt.",
|
|
626
683
|
`obligations.${o}.prompt`
|
|
@@ -629,20 +686,20 @@ function Q(e) {
|
|
|
629
686
|
});
|
|
630
687
|
else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
|
|
631
688
|
if (d(e.instruction) || i.push(
|
|
632
|
-
|
|
689
|
+
n(
|
|
633
690
|
"missing_instruction",
|
|
634
691
|
"Change operation intent needs an instruction.",
|
|
635
692
|
"instruction"
|
|
636
693
|
)
|
|
637
694
|
), e.analyticsIntent) {
|
|
638
|
-
const r =
|
|
695
|
+
const r = F(
|
|
639
696
|
e.analyticsIntent
|
|
640
697
|
);
|
|
641
|
-
i.push(...r.errors),
|
|
698
|
+
i.push(...r.errors), t.push(...r.warnings);
|
|
642
699
|
}
|
|
643
700
|
} else
|
|
644
701
|
i.push(
|
|
645
|
-
|
|
702
|
+
n(
|
|
646
703
|
"invalid_operation_kind",
|
|
647
704
|
"Operation intent kind is not supported.",
|
|
648
705
|
"kind"
|
|
@@ -651,22 +708,22 @@ function Q(e) {
|
|
|
651
708
|
return {
|
|
652
709
|
ok: i.length === 0,
|
|
653
710
|
errors: i,
|
|
654
|
-
warnings:
|
|
655
|
-
repairHints:
|
|
711
|
+
warnings: t,
|
|
712
|
+
repairHints: R(i)
|
|
656
713
|
};
|
|
657
714
|
}
|
|
658
|
-
function
|
|
659
|
-
const i = [],
|
|
715
|
+
function ee(e) {
|
|
716
|
+
const i = [], t = [];
|
|
660
717
|
if (!e || typeof e != "object")
|
|
661
718
|
return {
|
|
662
719
|
ok: !1,
|
|
663
720
|
errors: [
|
|
664
|
-
|
|
721
|
+
n(
|
|
665
722
|
"invalid_recovery_plan",
|
|
666
723
|
"Analytics recovery plan must be a structured object."
|
|
667
724
|
)
|
|
668
725
|
],
|
|
669
|
-
warnings:
|
|
726
|
+
warnings: t,
|
|
670
727
|
repairHints: [
|
|
671
728
|
{
|
|
672
729
|
code: "invalid_recovery_plan",
|
|
@@ -675,17 +732,17 @@ function z(e) {
|
|
|
675
732
|
]
|
|
676
733
|
};
|
|
677
734
|
e.version !== 1 && i.push(
|
|
678
|
-
|
|
735
|
+
n("invalid_version", "Recovery plan version must be 1.", "version")
|
|
679
736
|
), e.kind !== "analytics_recovery_plan" && i.push(
|
|
680
|
-
|
|
737
|
+
n(
|
|
681
738
|
"invalid_recovery_plan_kind",
|
|
682
739
|
"Recovery plan kind must be analytics_recovery_plan.",
|
|
683
740
|
"kind"
|
|
684
741
|
)
|
|
685
742
|
);
|
|
686
|
-
const r =
|
|
687
|
-
return i.push(...r.errors),
|
|
688
|
-
|
|
743
|
+
const r = Y(e.operationIntent);
|
|
744
|
+
return i.push(...r.errors), t.push(...r.warnings), Array.isArray(e.plannedToolCalls) || i.push(
|
|
745
|
+
n(
|
|
689
746
|
"invalid_planned_tool_calls",
|
|
690
747
|
"Recovery plan plannedToolCalls must be an array.",
|
|
691
748
|
"plannedToolCalls"
|
|
@@ -693,17 +750,17 @@ function z(e) {
|
|
|
693
750
|
), {
|
|
694
751
|
ok: i.length === 0,
|
|
695
752
|
errors: i,
|
|
696
|
-
warnings:
|
|
697
|
-
repairHints:
|
|
753
|
+
warnings: t,
|
|
754
|
+
repairHints: R(i)
|
|
698
755
|
};
|
|
699
756
|
}
|
|
700
|
-
function
|
|
757
|
+
function R(e) {
|
|
701
758
|
return e.map((i) => ({
|
|
702
759
|
code: i.code,
|
|
703
760
|
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."
|
|
704
761
|
}));
|
|
705
762
|
}
|
|
706
|
-
function
|
|
763
|
+
function Z(e) {
|
|
707
764
|
return e.map((i) => {
|
|
708
765
|
switch (i.code) {
|
|
709
766
|
case "missing_source":
|
|
@@ -756,14 +813,14 @@ function X(e) {
|
|
|
756
813
|
}
|
|
757
814
|
}).filter((i) => !!i);
|
|
758
815
|
}
|
|
759
|
-
function
|
|
816
|
+
function J(e, i, t, r) {
|
|
760
817
|
if (!e || typeof e != "object") {
|
|
761
|
-
|
|
818
|
+
t.push(n("invalid_view", "Dashboard view must be an object.", i));
|
|
762
819
|
return;
|
|
763
820
|
}
|
|
764
|
-
if (d(e.title) ||
|
|
765
|
-
|
|
766
|
-
|
|
821
|
+
if (d(e.title) || t.push(n("missing_view_title", "Dashboard view needs a title.", i)), !e.presentation || typeof e.presentation != "object") {
|
|
822
|
+
t.push(
|
|
823
|
+
n(
|
|
767
824
|
"missing_presentation",
|
|
768
825
|
"Dashboard view needs a presentation.",
|
|
769
826
|
`${i}.presentation`
|
|
@@ -773,7 +830,7 @@ function Y(e, i, s, r) {
|
|
|
773
830
|
}
|
|
774
831
|
if (e.presentation.kind === "text") {
|
|
775
832
|
d(e.text) || r.push(
|
|
776
|
-
|
|
833
|
+
n(
|
|
777
834
|
"missing_text_content",
|
|
778
835
|
"Text views should include text content.",
|
|
779
836
|
`${i}.text`
|
|
@@ -782,8 +839,8 @@ function Y(e, i, s, r) {
|
|
|
782
839
|
return;
|
|
783
840
|
}
|
|
784
841
|
if (!e.analytics) {
|
|
785
|
-
|
|
786
|
-
|
|
842
|
+
t.push(
|
|
843
|
+
n(
|
|
787
844
|
"missing_view_analytics",
|
|
788
845
|
"Non-text dashboard views need analytics intent.",
|
|
789
846
|
`${i}.analytics`
|
|
@@ -791,39 +848,39 @@ function Y(e, i, s, r) {
|
|
|
791
848
|
);
|
|
792
849
|
return;
|
|
793
850
|
}
|
|
794
|
-
const o =
|
|
851
|
+
const o = F(e.analytics);
|
|
795
852
|
for (const a of o.errors)
|
|
796
|
-
|
|
797
|
-
|
|
853
|
+
t.push(
|
|
854
|
+
n(a.code, a.message, `${i}.analytics${a.path ? `.${a.path}` : ""}`)
|
|
798
855
|
);
|
|
799
856
|
for (const a of o.warnings)
|
|
800
857
|
r.push(
|
|
801
|
-
|
|
858
|
+
n(
|
|
802
859
|
a.code,
|
|
803
860
|
a.message,
|
|
804
861
|
`${i}.analytics${a.path ? `.${a.path}` : ""}`
|
|
805
862
|
)
|
|
806
863
|
);
|
|
807
864
|
}
|
|
808
|
-
function
|
|
809
|
-
const i = [],
|
|
865
|
+
function ie(e) {
|
|
866
|
+
const i = [], t = [];
|
|
810
867
|
if (!e || typeof e != "object")
|
|
811
868
|
return {
|
|
812
869
|
ok: !1,
|
|
813
870
|
errors: [
|
|
814
|
-
|
|
871
|
+
n(
|
|
815
872
|
"invalid_dashboard_intent",
|
|
816
873
|
"Dashboard intent must be a structured object."
|
|
817
874
|
)
|
|
818
875
|
],
|
|
819
|
-
warnings:
|
|
876
|
+
warnings: t
|
|
820
877
|
};
|
|
821
|
-
e.version !== 1 && i.push(
|
|
822
|
-
const r = Array.isArray(e.inputs) ? e.inputs : [], o =
|
|
878
|
+
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"));
|
|
879
|
+
const r = Array.isArray(e.inputs) ? e.inputs : [], o = I(
|
|
823
880
|
r.filter(u).map((c) => c.id).filter((c) => typeof c == "string")
|
|
824
881
|
);
|
|
825
882
|
o && i.push(
|
|
826
|
-
|
|
883
|
+
n(
|
|
827
884
|
"duplicate_input_id",
|
|
828
885
|
`Duplicate input id: ${o}.`,
|
|
829
886
|
"inputs"
|
|
@@ -832,28 +889,28 @@ function J(e) {
|
|
|
832
889
|
for (const [c, l] of r.entries()) {
|
|
833
890
|
const f = `inputs.${c}`;
|
|
834
891
|
if (!u(l)) {
|
|
835
|
-
i.push(
|
|
892
|
+
i.push(n("invalid_input", "Dashboard input must be an object.", f));
|
|
836
893
|
continue;
|
|
837
894
|
}
|
|
838
|
-
d(l.id) || i.push(
|
|
839
|
-
|
|
895
|
+
d(l.id) || i.push(n("missing_input_id", "Input needs an id.", `${f}.id`)), d(l.label) || i.push(
|
|
896
|
+
n("missing_input_label", "Input needs a label.", `${f}.label`)
|
|
840
897
|
), !l.field || !d(l.field.name) ? i.push(
|
|
841
|
-
|
|
898
|
+
n("missing_input_field", "Input needs a field.", `${f}.field`)
|
|
842
899
|
) : m(l.field, `${f}.field`, i);
|
|
843
900
|
}
|
|
844
901
|
const a = Array.isArray(e.sections) ? e.sections : [];
|
|
845
902
|
a.length === 0 && i.push(
|
|
846
|
-
|
|
903
|
+
n(
|
|
847
904
|
"missing_sections",
|
|
848
905
|
"Dashboard intent needs at least one section.",
|
|
849
906
|
"sections"
|
|
850
907
|
)
|
|
851
908
|
);
|
|
852
|
-
const
|
|
909
|
+
const s = a.flatMap(
|
|
853
910
|
(c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(u).map((l) => l.id).filter((l) => !!l) : []
|
|
854
|
-
), p =
|
|
911
|
+
), p = I(s);
|
|
855
912
|
p && i.push(
|
|
856
|
-
|
|
913
|
+
n(
|
|
857
914
|
"duplicate_view_id",
|
|
858
915
|
`Duplicate dashboard view id: ${p}.`,
|
|
859
916
|
"sections"
|
|
@@ -863,15 +920,15 @@ function J(e) {
|
|
|
863
920
|
const f = `sections.${c}`;
|
|
864
921
|
if (!l || typeof l != "object") {
|
|
865
922
|
i.push(
|
|
866
|
-
|
|
923
|
+
n("invalid_section", "Dashboard section must be an object.", f)
|
|
867
924
|
);
|
|
868
925
|
continue;
|
|
869
926
|
}
|
|
870
927
|
if (d(l.title) || i.push(
|
|
871
|
-
|
|
928
|
+
n("missing_section_title", "Dashboard section needs a title.", f)
|
|
872
929
|
), !Array.isArray(l.views) || l.views.length === 0) {
|
|
873
930
|
i.push(
|
|
874
|
-
|
|
931
|
+
n(
|
|
875
932
|
"missing_section_views",
|
|
876
933
|
"Dashboard section needs at least one view.",
|
|
877
934
|
`${f}.views`
|
|
@@ -879,20 +936,22 @@ function J(e) {
|
|
|
879
936
|
);
|
|
880
937
|
continue;
|
|
881
938
|
}
|
|
882
|
-
for (const [h,
|
|
883
|
-
|
|
884
|
-
|
|
939
|
+
for (const [h, g] of l.views.entries())
|
|
940
|
+
J(
|
|
941
|
+
g,
|
|
885
942
|
`${f}.views.${h}`,
|
|
886
943
|
i,
|
|
887
|
-
|
|
944
|
+
t
|
|
888
945
|
);
|
|
889
946
|
}
|
|
890
|
-
return { ok: i.length === 0, errors: i, warnings:
|
|
947
|
+
return { ok: i.length === 0, errors: i, warnings: t };
|
|
891
948
|
}
|
|
892
949
|
export {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
950
|
+
D as a,
|
|
951
|
+
Y as b,
|
|
952
|
+
ee as c,
|
|
953
|
+
ie as d,
|
|
954
|
+
W as n,
|
|
955
|
+
M as p,
|
|
956
|
+
F as v
|
|
898
957
|
};
|