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