react-semaphor 0.1.369 → 0.1.371
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 +40 -38
- package/dist/chunks/{calendar-preferences-dialog-6q51A6XC.js → calendar-preferences-dialog-ClBAkMmF.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-CUGzkNcE.js → calendar-preferences-dialog-Dn6o2r2Y.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BEZnvIla.js → dashboard-briefing-launcher-BO-kXtEd.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-ptERmNJr.js → dashboard-briefing-launcher-D3Xfc_26.js} +3 -3
- package/dist/chunks/{dashboard-controls-CqKC5oEk.js → dashboard-controls-B3sdy_Zx.js} +3 -3
- package/dist/chunks/{dashboard-controls-CGt6_hMf.js → dashboard-controls-DcXMFgGR.js} +1 -1
- package/dist/chunks/{dashboard-json-6SgPm_QW.js → dashboard-json-BWfkEy48.js} +1 -1
- package/dist/chunks/{dashboard-json-CYSbOdmE.js → dashboard-json-CFURS_OR.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-w6hKbjlw.js → edit-dashboard-visual-BD2AJLiT.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-ByQx_M2i.js → edit-dashboard-visual-DjdhKiP2.js} +3 -3
- package/dist/chunks/{index-CPyEi9gS.js → index-C0Qnfr_7.js} +5 -4
- package/dist/chunks/{index-BtqYNH_S.js → index-DlLvzmJF.js} +2 -2
- package/dist/chunks/{resource-management-panel-Bf8-3eUf.js → resource-management-panel-DytUMSGA.js} +1 -1
- package/dist/chunks/{resource-management-panel-mJ84NxzC.js → resource-management-panel-YvIfaphX.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-BfoXDDrd.js → use-create-flow-overlay-state-BETXykC9.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-c6rCm36x.js → use-create-flow-overlay-state-CwIG1Ekp.js} +1 -1
- package/dist/chunks/{use-visual-utils-NN0e3fBP.js → use-visual-utils-Bk135OgA.js} +1 -1
- package/dist/chunks/{use-visual-utils-C_c-aiqi.js → use-visual-utils-BzFjIykb.js} +1 -1
- package/dist/chunks/{validation-nOPr0mTk.js → validation-CQFpcSSP.js} +446 -246
- package/dist/chunks/validation-D4Zz6WPD.js +1 -0
- package/dist/chunks/validators-CuKnUZFO.js +2171 -0
- package/dist/chunks/validators-DHee9kM2.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 +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 +261 -183
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +542 -2
- package/dist/types/dashboard-assistant.d.ts +508 -4
- package/dist/types/dashboard-authoring.d.ts +217 -3
- package/dist/types/dashboard.d.ts +67 -2
- package/dist/types/data-app-builder.d.ts +197 -1
- package/dist/types/data-app-sdk-validation.d.ts +520 -6
- package/dist/types/data-app-sdk.d.ts +543 -8
- package/dist/types/main.d.ts +215 -3
- package/dist/types/shared.d.ts +66 -2
- package/dist/types/surfboard.d.ts +67 -2
- package/dist/types/types.d.ts +67 -2
- package/package.json +1 -1
- package/dist/chunks/validation-Dsf7PydY.js +0 -1
- package/dist/chunks/validators-CVuWOHYv.js +0 -1032
- package/dist/chunks/validators-oc8qtP4q.js +0 -1
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { n as z, c as D } from "./validators-CuKnUZFO.js";
|
|
2
|
+
import { n as O } from "./catalog-field-grounding-DoEBOXQd.js";
|
|
3
|
+
import { b as M, c as j, a as q } from "./source-identity-Dj3dryN9.js";
|
|
4
|
+
function x(e) {
|
|
5
|
+
var t, i;
|
|
6
|
+
const r = Q(e);
|
|
6
7
|
return {
|
|
7
8
|
version: 1,
|
|
8
9
|
kind: "metric",
|
|
9
10
|
id: e.id,
|
|
10
11
|
label: e.label,
|
|
11
|
-
source:
|
|
12
|
+
source: p(e),
|
|
12
13
|
metrics: r,
|
|
13
|
-
primaryMetric:
|
|
14
|
+
primaryMetric: K(e, r),
|
|
14
15
|
dateField: e.dateField ? a(e.dateField, "date") : void 0,
|
|
15
16
|
timeGrain: e.timeGrain,
|
|
16
17
|
dimensions: (t = e.dimensions) == null ? void 0 : t.map((o) => a(o, "dimension")),
|
|
17
|
-
comparison:
|
|
18
|
+
comparison: se(e.comparison),
|
|
18
19
|
orderBy: e.orderBy ? {
|
|
19
20
|
field: a(e.orderBy.field),
|
|
20
21
|
direction: e.orderBy.direction
|
|
21
22
|
} : void 0,
|
|
22
|
-
inputs:
|
|
23
|
-
limit: e.limit
|
|
23
|
+
inputs: y(e.inputs),
|
|
24
|
+
limit: e.limit,
|
|
25
|
+
...(i = e.derivedFields) != null && i.length ? { derivedFields: e.derivedFields } : {}
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
function
|
|
28
|
+
function E(e) {
|
|
27
29
|
var t;
|
|
28
30
|
return {
|
|
29
|
-
...
|
|
31
|
+
...x(e),
|
|
30
32
|
...e.timeWindow ? { timeWindow: e.timeWindow } : {},
|
|
31
33
|
...(t = e.filters) != null && t.length ? { filters: e.filters } : {},
|
|
32
34
|
...e.analysis ? { analysis: e.analysis } : {}
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
function
|
|
37
|
+
function Re(e) {
|
|
36
38
|
return {
|
|
37
39
|
...e.chartTitle ? { chartTitle: e.chartTitle } : {},
|
|
38
40
|
...e.chartType ? { chartType: e.chartType } : {},
|
|
@@ -41,76 +43,76 @@ function ge(e) {
|
|
|
41
43
|
...e.calendarContext ? { calendarContext: e.calendarContext } : {}
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
function
|
|
46
|
+
function K(e, r) {
|
|
45
47
|
if (!e.primaryMetric)
|
|
46
48
|
return r[0] || { name: "", role: "measure" };
|
|
47
|
-
const t = a(e.primaryMetric, "measure"),
|
|
48
|
-
return
|
|
49
|
+
const t = a(e.primaryMetric, "measure"), i = L(t, r), o = i.length === 1 ? i[0] : void 0;
|
|
50
|
+
return o ? F(t, o) : t;
|
|
49
51
|
}
|
|
50
|
-
function
|
|
52
|
+
function Q(e) {
|
|
51
53
|
const r = [];
|
|
52
54
|
for (const t of e.metrics.map(
|
|
53
|
-
(
|
|
55
|
+
(i) => a(i, "measure")
|
|
54
56
|
)) {
|
|
55
57
|
if (!t.name)
|
|
56
58
|
continue;
|
|
57
|
-
const
|
|
58
|
-
(
|
|
59
|
+
const i = r.findIndex(
|
|
60
|
+
(o) => N(o, t)
|
|
59
61
|
);
|
|
60
|
-
if (
|
|
62
|
+
if (i === -1) {
|
|
61
63
|
r.push(t);
|
|
62
64
|
continue;
|
|
63
65
|
}
|
|
64
|
-
r[
|
|
65
|
-
r[
|
|
66
|
+
r[i] = F(
|
|
67
|
+
r[i],
|
|
66
68
|
t
|
|
67
69
|
);
|
|
68
70
|
}
|
|
69
71
|
return r;
|
|
70
72
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
73
|
+
function N(e, r) {
|
|
74
|
+
return M(e, r) && h(e) === h(r);
|
|
73
75
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
76
|
+
function V(e, r) {
|
|
77
|
+
return h(r) === h(e);
|
|
76
78
|
}
|
|
77
|
-
function
|
|
78
|
-
return r.name !== e.name || e.source && !
|
|
79
|
+
function W(e, r) {
|
|
80
|
+
return r.name !== e.name || e.source && !M(r, e) ? !1 : V(e, r);
|
|
79
81
|
}
|
|
80
|
-
function
|
|
82
|
+
function L(e, r) {
|
|
81
83
|
const t = r.filter(
|
|
82
|
-
(
|
|
84
|
+
(i) => W(e, i)
|
|
83
85
|
);
|
|
84
86
|
return e.aggregate !== void 0, t;
|
|
85
87
|
}
|
|
86
|
-
function
|
|
88
|
+
function h(e) {
|
|
87
89
|
return (e.aggregate || "SUM").toUpperCase();
|
|
88
90
|
}
|
|
89
|
-
function
|
|
91
|
+
function F(e, r) {
|
|
90
92
|
if (e.aggregate && r.aggregate && e.aggregate !== r.aggregate)
|
|
91
93
|
throw new Error(
|
|
92
94
|
`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${r.aggregate}.`
|
|
93
95
|
);
|
|
94
96
|
return {
|
|
95
|
-
...
|
|
97
|
+
...j(e, r),
|
|
96
98
|
aggregate: e.aggregate || r.aggregate
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
function
|
|
100
|
-
var t;
|
|
101
|
+
function U(e) {
|
|
102
|
+
var t, i;
|
|
101
103
|
if ("sort" in e)
|
|
102
104
|
throw new Error(
|
|
103
105
|
"semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
|
|
104
106
|
);
|
|
105
|
-
if (!
|
|
107
|
+
if (!ae(e))
|
|
106
108
|
throw new Error("semaphor.records needs at least one field.");
|
|
107
|
-
const r =
|
|
109
|
+
const r = G(e.fields);
|
|
108
110
|
return {
|
|
109
111
|
version: 1,
|
|
110
112
|
kind: "records",
|
|
111
113
|
id: e.id,
|
|
112
114
|
label: e.label,
|
|
113
|
-
source:
|
|
115
|
+
source: p(e),
|
|
114
116
|
fields: r,
|
|
115
117
|
dateField: e.dateField ? a(e.dateField, "date") : void 0,
|
|
116
118
|
timeGrain: e.timeGrain,
|
|
@@ -120,12 +122,13 @@ function Q(e) {
|
|
|
120
122
|
field: a(e.orderBy.field),
|
|
121
123
|
direction: e.orderBy.direction
|
|
122
124
|
} : void 0,
|
|
123
|
-
inputs:
|
|
125
|
+
inputs: y(e.inputs),
|
|
124
126
|
limit: e.limit,
|
|
125
|
-
...e.pagination ? { pagination: e.pagination } : {}
|
|
127
|
+
...e.pagination ? { pagination: e.pagination } : {},
|
|
128
|
+
...(i = e.derivedFields) != null && i.length ? { derivedFields: e.derivedFields } : {}
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
|
-
function
|
|
131
|
+
function G(e) {
|
|
129
132
|
return e.map((r) => {
|
|
130
133
|
const t = a(r);
|
|
131
134
|
if (!t.role)
|
|
@@ -135,19 +138,21 @@ function E(e) {
|
|
|
135
138
|
return t;
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
|
-
function
|
|
141
|
+
function J(e) {
|
|
142
|
+
var r;
|
|
139
143
|
return {
|
|
140
144
|
version: 1,
|
|
141
145
|
kind: "inputOptions",
|
|
142
146
|
id: e.id,
|
|
143
147
|
label: e.label,
|
|
144
|
-
source:
|
|
148
|
+
source: p(e),
|
|
145
149
|
field: a(e.field, "dimension"),
|
|
146
150
|
search: e.search,
|
|
147
|
-
limit: e.limit
|
|
151
|
+
limit: e.limit,
|
|
152
|
+
...(r = e.derivedFields) != null && r.length ? { derivedFields: e.derivedFields } : {}
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
|
-
function
|
|
155
|
+
function X(e) {
|
|
151
156
|
var r;
|
|
152
157
|
return {
|
|
153
158
|
version: 1,
|
|
@@ -159,13 +164,60 @@ function W(e) {
|
|
|
159
164
|
...e.defaultParameters ? { defaultParameters: e.defaultParameters } : {},
|
|
160
165
|
...e.pythonCode ? { pythonCode: e.pythonCode } : {},
|
|
161
166
|
...(r = e.fields) != null && r.length ? { fields: e.fields.map((t) => a(t)) } : {},
|
|
162
|
-
inputs:
|
|
167
|
+
inputs: y(e.inputs),
|
|
163
168
|
limit: e.limit,
|
|
164
169
|
...e.pagination ? { pagination: e.pagination } : {},
|
|
165
170
|
rationale: e.rationale
|
|
166
171
|
};
|
|
167
172
|
}
|
|
168
|
-
function
|
|
173
|
+
function Y(e) {
|
|
174
|
+
var r, t;
|
|
175
|
+
return {
|
|
176
|
+
version: 1,
|
|
177
|
+
kind: "matrix",
|
|
178
|
+
id: e.id,
|
|
179
|
+
label: e.label,
|
|
180
|
+
source: p(e),
|
|
181
|
+
rows: e.rows.map((i) => k(i, "dimension")),
|
|
182
|
+
...e.columns ? {
|
|
183
|
+
columns: e.columns.map(
|
|
184
|
+
(i) => k(i, "dimension")
|
|
185
|
+
)
|
|
186
|
+
} : {},
|
|
187
|
+
values: e.values.map(Z),
|
|
188
|
+
...(r = e.filters) != null && r.length ? { filters: e.filters } : {},
|
|
189
|
+
inputs: y(e.inputs),
|
|
190
|
+
...e.totals ? { totals: e.totals } : {},
|
|
191
|
+
...(t = e.sort) != null && t.length ? { sort: e.sort } : {},
|
|
192
|
+
...e.expansion ? { expansion: e.expansion } : {},
|
|
193
|
+
...e.layout ? { layout: e.layout } : {},
|
|
194
|
+
...e.displayLimits ? { displayLimits: e.displayLimits } : {}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function k(e, r) {
|
|
198
|
+
return ee(e) ? {
|
|
199
|
+
...e,
|
|
200
|
+
field: a(e.field, r)
|
|
201
|
+
} : {
|
|
202
|
+
field: a(e, r)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function Z(e) {
|
|
206
|
+
return re(e) ? {
|
|
207
|
+
...e,
|
|
208
|
+
field: a(e.field, "measure")
|
|
209
|
+
} : {
|
|
210
|
+
field: a(e, "measure"),
|
|
211
|
+
aggregate: e.aggregate
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function ee(e) {
|
|
215
|
+
return "field" in e;
|
|
216
|
+
}
|
|
217
|
+
function re(e) {
|
|
218
|
+
return "field" in e;
|
|
219
|
+
}
|
|
220
|
+
function te(e) {
|
|
169
221
|
if ("toAnalyticsInput" in e) {
|
|
170
222
|
const n = e.toAnalyticsInput();
|
|
171
223
|
return {
|
|
@@ -177,7 +229,7 @@ function U(e) {
|
|
|
177
229
|
};
|
|
178
230
|
}
|
|
179
231
|
if ("id" in e) {
|
|
180
|
-
const n =
|
|
232
|
+
const n = C(e);
|
|
181
233
|
return {
|
|
182
234
|
inputId: n.inputId,
|
|
183
235
|
kind: n.kind,
|
|
@@ -186,31 +238,31 @@ function U(e) {
|
|
|
186
238
|
...n.field ? { field: n.field } : {}
|
|
187
239
|
};
|
|
188
240
|
}
|
|
189
|
-
const r = "kind" in e ? e.kind : void 0, t = "operator" in e ?
|
|
241
|
+
const r = "kind" in e ? e.kind : void 0, t = "operator" in e ? R(e.operator, e.inputId) : void 0, i = "controlRole" in e ? e.controlRole : "role" in e ? e.role : void 0, o = ie(i) ? i : void 0;
|
|
190
242
|
return {
|
|
191
243
|
inputId: e.inputId,
|
|
192
244
|
...r ? { kind: r } : {},
|
|
193
|
-
...
|
|
245
|
+
...o ? { controlRole: o } : {},
|
|
194
246
|
...t ? { operator: t } : {},
|
|
195
247
|
...e.field ? { field: e.field } : {}
|
|
196
248
|
};
|
|
197
249
|
}
|
|
198
|
-
function
|
|
250
|
+
function ie(e) {
|
|
199
251
|
return e === "grain" || e === "metric" || e === "dimension" || e === "aggregation" || e === "sqlParam";
|
|
200
252
|
}
|
|
201
|
-
function
|
|
202
|
-
const r =
|
|
253
|
+
function He(e) {
|
|
254
|
+
const r = y(e);
|
|
203
255
|
return r.length > 0 ? r : void 0;
|
|
204
256
|
}
|
|
205
|
-
function
|
|
206
|
-
return (e || []).map(
|
|
257
|
+
function oe(e) {
|
|
258
|
+
return (e || []).map(ne);
|
|
207
259
|
}
|
|
208
|
-
function
|
|
209
|
-
return
|
|
260
|
+
function Te(e) {
|
|
261
|
+
return oe(e).filter((r) => r.isActive);
|
|
210
262
|
}
|
|
211
|
-
function
|
|
263
|
+
function C(e) {
|
|
212
264
|
if (e.kind === "filter") {
|
|
213
|
-
const r =
|
|
265
|
+
const r = R(e.operator, e.id);
|
|
214
266
|
return {
|
|
215
267
|
inputId: e.id,
|
|
216
268
|
kind: e.kind,
|
|
@@ -226,7 +278,7 @@ function M(e) {
|
|
|
226
278
|
controlRole: e.role
|
|
227
279
|
};
|
|
228
280
|
}
|
|
229
|
-
function
|
|
281
|
+
function Pe(e = []) {
|
|
230
282
|
return e.map(
|
|
231
283
|
(r) => typeof r == "object" ? r : {
|
|
232
284
|
label: String(r),
|
|
@@ -234,16 +286,16 @@ function Ie(e = []) {
|
|
|
234
286
|
}
|
|
235
287
|
);
|
|
236
288
|
}
|
|
237
|
-
function
|
|
289
|
+
function S(e) {
|
|
238
290
|
return e == null ? !1 : Array.isArray(e) ? e.length > 0 : typeof e == "string" ? e.trim().length > 0 : !0;
|
|
239
291
|
}
|
|
240
|
-
function
|
|
292
|
+
function ne(e) {
|
|
241
293
|
if ("toAnalyticsInput" in e)
|
|
242
294
|
return e.toAnalyticsInput();
|
|
243
295
|
if ("kind" in e && "isActive" in e)
|
|
244
296
|
return e;
|
|
245
297
|
if ("id" in e) {
|
|
246
|
-
const r =
|
|
298
|
+
const r = C(e), t = Object.prototype.hasOwnProperty.call(e, "value") ? e.value : e.defaultValue;
|
|
247
299
|
return {
|
|
248
300
|
inputId: r.inputId,
|
|
249
301
|
kind: r.kind,
|
|
@@ -252,22 +304,22 @@ function L(e) {
|
|
|
252
304
|
...r.operator ? { operator: r.operator } : {},
|
|
253
305
|
...r.controlRole ? { controlRole: r.controlRole } : {},
|
|
254
306
|
value: t,
|
|
255
|
-
isActive:
|
|
307
|
+
isActive: S(t)
|
|
256
308
|
};
|
|
257
309
|
}
|
|
258
310
|
return {
|
|
259
311
|
...e,
|
|
260
312
|
kind: "filter",
|
|
261
|
-
isActive:
|
|
313
|
+
isActive: S(
|
|
262
314
|
e.value
|
|
263
315
|
),
|
|
264
316
|
value: e.value
|
|
265
317
|
};
|
|
266
318
|
}
|
|
267
|
-
function
|
|
319
|
+
function p(e) {
|
|
268
320
|
return e.source;
|
|
269
321
|
}
|
|
270
|
-
function
|
|
322
|
+
function ae(e) {
|
|
271
323
|
var r;
|
|
272
324
|
return !!((r = e.fields) != null && r.length);
|
|
273
325
|
}
|
|
@@ -277,68 +329,68 @@ function a(e, r) {
|
|
|
277
329
|
role: e.role || r
|
|
278
330
|
};
|
|
279
331
|
}
|
|
280
|
-
function
|
|
281
|
-
return (e || []).map(
|
|
332
|
+
function y(e) {
|
|
333
|
+
return (e || []).map(te);
|
|
282
334
|
}
|
|
283
|
-
function
|
|
335
|
+
function se(e) {
|
|
284
336
|
if (e)
|
|
285
337
|
return e;
|
|
286
338
|
}
|
|
287
|
-
function
|
|
339
|
+
function R(e, r) {
|
|
288
340
|
if (e === void 0)
|
|
289
341
|
return;
|
|
290
|
-
const t =
|
|
342
|
+
const t = z(e);
|
|
291
343
|
if (!t)
|
|
292
344
|
throw new Error(
|
|
293
345
|
`useSemaphorInput "${r}" uses unsupported filter operator "${e}".`
|
|
294
346
|
);
|
|
295
347
|
return t;
|
|
296
348
|
}
|
|
297
|
-
function
|
|
349
|
+
function de(e, r = {}) {
|
|
298
350
|
const t = r.pathPrefix || "analysisOptions";
|
|
299
351
|
if (e === void 0)
|
|
300
352
|
return { ok: !0 };
|
|
301
353
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
302
|
-
return
|
|
354
|
+
return u(
|
|
303
355
|
t,
|
|
304
356
|
"Data App analysis options must be an object."
|
|
305
357
|
);
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
if (typeof
|
|
309
|
-
return
|
|
358
|
+
const i = e, o = {};
|
|
359
|
+
if (i.chartTitle !== void 0) {
|
|
360
|
+
if (typeof i.chartTitle != "string")
|
|
361
|
+
return u(
|
|
310
362
|
`${t}.chartTitle`,
|
|
311
363
|
'Data App analysis option "chartTitle" must be a string.'
|
|
312
364
|
);
|
|
313
|
-
|
|
365
|
+
o.chartTitle = i.chartTitle;
|
|
314
366
|
}
|
|
315
|
-
if (
|
|
316
|
-
if (typeof
|
|
317
|
-
return
|
|
367
|
+
if (i.chartType !== void 0) {
|
|
368
|
+
if (typeof i.chartType != "string")
|
|
369
|
+
return u(
|
|
318
370
|
`${t}.chartType`,
|
|
319
371
|
'Data App analysis option "chartType" must be a string.'
|
|
320
372
|
);
|
|
321
|
-
|
|
373
|
+
o.chartType = i.chartType;
|
|
322
374
|
}
|
|
323
|
-
if (
|
|
324
|
-
if (!
|
|
325
|
-
return
|
|
375
|
+
if (i.driverMode !== void 0) {
|
|
376
|
+
if (!ue(i.driverMode))
|
|
377
|
+
return u(
|
|
326
378
|
`${t}.driverMode`,
|
|
327
379
|
'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.'
|
|
328
380
|
);
|
|
329
|
-
|
|
381
|
+
o.driverMode = i.driverMode;
|
|
330
382
|
}
|
|
331
|
-
if (
|
|
332
|
-
if (typeof
|
|
333
|
-
return
|
|
383
|
+
if (i.includePopulation !== void 0) {
|
|
384
|
+
if (typeof i.includePopulation != "boolean")
|
|
385
|
+
return u(
|
|
334
386
|
`${t}.includePopulation`,
|
|
335
387
|
'Data App analysis option "includePopulation" must be a boolean.'
|
|
336
388
|
);
|
|
337
|
-
|
|
389
|
+
o.includePopulation = i.includePopulation;
|
|
338
390
|
}
|
|
339
|
-
if (
|
|
340
|
-
const n =
|
|
341
|
-
|
|
391
|
+
if (i.calendarContext !== void 0) {
|
|
392
|
+
const n = ce(
|
|
393
|
+
i.calendarContext,
|
|
342
394
|
{
|
|
343
395
|
pathPrefix: `${t}.calendarContext`,
|
|
344
396
|
validateTimezone: r.validateTimezone
|
|
@@ -346,104 +398,104 @@ function Y(e, r = {}) {
|
|
|
346
398
|
);
|
|
347
399
|
if (!n.ok)
|
|
348
400
|
return n;
|
|
349
|
-
|
|
401
|
+
o.calendarContext = n.calendarContext;
|
|
350
402
|
}
|
|
351
|
-
return { ok: !0, analysisOptions:
|
|
403
|
+
return { ok: !0, analysisOptions: o };
|
|
352
404
|
}
|
|
353
|
-
function
|
|
405
|
+
function Be(e) {
|
|
354
406
|
const r = e.queries.map(
|
|
355
|
-
(
|
|
407
|
+
(o, n) => le(o, n, {
|
|
356
408
|
fieldCatalogs: e.fieldCatalogs || [],
|
|
357
409
|
requireFieldCatalog: !!e.requireFieldCatalog,
|
|
358
410
|
validateTimezone: e.validateTimezone
|
|
359
411
|
})
|
|
360
|
-
), t = r.flatMap((
|
|
412
|
+
), t = r.flatMap((o) => o.diagnostics), i = r.map((o) => o.executionResult);
|
|
361
413
|
return {
|
|
362
|
-
ok: t.every((
|
|
414
|
+
ok: t.every((o) => o.severity !== "error"),
|
|
363
415
|
diagnostics: t,
|
|
364
416
|
queries: r,
|
|
365
417
|
intents: r.flatMap(
|
|
366
|
-
(
|
|
418
|
+
(o) => o.intent ? [o.intent] : []
|
|
367
419
|
),
|
|
368
|
-
executionResults:
|
|
420
|
+
executionResults: i
|
|
369
421
|
};
|
|
370
422
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
423
|
+
function le(e, r, t) {
|
|
424
|
+
const i = `queries.${r}`;
|
|
373
425
|
try {
|
|
374
|
-
const
|
|
375
|
-
...
|
|
426
|
+
const o = me(e), n = Me(e, o), s = D(o), d = [
|
|
427
|
+
...Ie({
|
|
376
428
|
querySpec: e,
|
|
377
429
|
queryId: n,
|
|
378
|
-
intent:
|
|
379
|
-
pathPrefix:
|
|
430
|
+
intent: o,
|
|
431
|
+
pathPrefix: i
|
|
380
432
|
}),
|
|
381
|
-
...
|
|
382
|
-
(
|
|
433
|
+
...s.errors.map(
|
|
434
|
+
(c) => $(c, {
|
|
383
435
|
queryHook: e.queryHook,
|
|
384
436
|
queryId: n,
|
|
385
|
-
pathPrefix:
|
|
437
|
+
pathPrefix: i,
|
|
386
438
|
severity: "error",
|
|
387
|
-
intent:
|
|
439
|
+
intent: o
|
|
388
440
|
})
|
|
389
441
|
),
|
|
390
|
-
...
|
|
391
|
-
(
|
|
442
|
+
...s.warnings.map(
|
|
443
|
+
(c) => $(c, {
|
|
392
444
|
queryHook: e.queryHook,
|
|
393
445
|
queryId: n,
|
|
394
|
-
pathPrefix:
|
|
446
|
+
pathPrefix: i,
|
|
395
447
|
severity: "warning",
|
|
396
|
-
intent:
|
|
448
|
+
intent: o
|
|
397
449
|
})
|
|
398
450
|
),
|
|
399
|
-
...
|
|
451
|
+
...he({
|
|
400
452
|
querySpec: e,
|
|
401
453
|
queryId: n,
|
|
402
|
-
intent:
|
|
403
|
-
pathPrefix:
|
|
454
|
+
intent: o,
|
|
455
|
+
pathPrefix: i,
|
|
404
456
|
fieldCatalogs: t.fieldCatalogs,
|
|
405
457
|
requireFieldCatalog: t.requireFieldCatalog
|
|
406
458
|
}),
|
|
407
|
-
...
|
|
459
|
+
...qe({
|
|
408
460
|
querySpec: e,
|
|
409
461
|
queryId: n,
|
|
410
|
-
intent:
|
|
411
|
-
pathPrefix:
|
|
462
|
+
intent: o,
|
|
463
|
+
pathPrefix: i,
|
|
412
464
|
validateTimezone: t.validateTimezone
|
|
413
465
|
})
|
|
414
|
-
],
|
|
466
|
+
], l = _e(s, d);
|
|
415
467
|
return {
|
|
416
468
|
queryHook: e.queryHook,
|
|
417
469
|
queryId: n,
|
|
418
|
-
intent:
|
|
419
|
-
diagnostics:
|
|
420
|
-
executionResult:
|
|
421
|
-
intent:
|
|
422
|
-
validation:
|
|
423
|
-
diagnostics:
|
|
470
|
+
intent: o,
|
|
471
|
+
diagnostics: d,
|
|
472
|
+
executionResult: _({
|
|
473
|
+
intent: o,
|
|
474
|
+
validation: l,
|
|
475
|
+
diagnostics: d
|
|
424
476
|
})
|
|
425
477
|
};
|
|
426
|
-
} catch (
|
|
478
|
+
} catch (o) {
|
|
427
479
|
const n = {
|
|
428
480
|
severity: "error",
|
|
429
481
|
code: "invalid_query_spec",
|
|
430
|
-
message:
|
|
431
|
-
path:
|
|
482
|
+
message: o instanceof Error ? o.message : String(o),
|
|
483
|
+
path: i,
|
|
432
484
|
queryHook: e.queryHook,
|
|
433
|
-
queryId:
|
|
434
|
-
},
|
|
485
|
+
queryId: B(e.spec)
|
|
486
|
+
}, s = P([n]);
|
|
435
487
|
return {
|
|
436
488
|
queryHook: e.queryHook,
|
|
437
489
|
queryId: n.queryId,
|
|
438
490
|
diagnostics: [n],
|
|
439
|
-
executionResult:
|
|
440
|
-
validation:
|
|
491
|
+
executionResult: _({
|
|
492
|
+
validation: s,
|
|
441
493
|
diagnostics: [n]
|
|
442
494
|
})
|
|
443
495
|
};
|
|
444
496
|
}
|
|
445
497
|
}
|
|
446
|
-
function
|
|
498
|
+
function u(e, r) {
|
|
447
499
|
return {
|
|
448
500
|
ok: !1,
|
|
449
501
|
issues: [
|
|
@@ -455,94 +507,169 @@ function s(e, r) {
|
|
|
455
507
|
]
|
|
456
508
|
};
|
|
457
509
|
}
|
|
458
|
-
function
|
|
510
|
+
function H(e) {
|
|
459
511
|
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
460
512
|
}
|
|
461
|
-
function
|
|
513
|
+
function ue(e) {
|
|
462
514
|
return e === "absolute_delta" || e === "largest_negative" || e === "largest_positive" || e === "positive_and_negative" || e === "all";
|
|
463
515
|
}
|
|
464
|
-
function
|
|
516
|
+
function fe(e) {
|
|
465
517
|
return e.trim().length > 0 && !Number.isNaN(Date.parse(e));
|
|
466
518
|
}
|
|
467
|
-
function
|
|
468
|
-
var
|
|
519
|
+
function ce(e, r) {
|
|
520
|
+
var l;
|
|
469
521
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
470
|
-
return
|
|
522
|
+
return u(
|
|
471
523
|
r.pathPrefix,
|
|
472
524
|
'Data App analysis option "calendarContext" must be an object.'
|
|
473
525
|
);
|
|
474
|
-
const t = e,
|
|
475
|
-
return
|
|
526
|
+
const t = e, i = t.tz, o = t.weekStart, n = t.anchor, s = n && typeof n == "object" && !Array.isArray(n) ? n.iso : void 0, d = typeof i == "string" ? ((l = r.validateTimezone) == null ? void 0 : l.call(r, i)) ?? i : null;
|
|
527
|
+
return d ? typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 6 ? u(
|
|
476
528
|
`${r.pathPrefix}.weekStart`,
|
|
477
529
|
'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'
|
|
478
|
-
) : n !== "now" && !(typeof
|
|
530
|
+
) : n !== "now" && !(typeof s == "string" && fe(s)) ? u(
|
|
479
531
|
`${r.pathPrefix}.anchor`,
|
|
480
532
|
'Data App analysis option "calendarContext.anchor" must be "now" or an object with a valid iso string.'
|
|
481
533
|
) : {
|
|
482
534
|
ok: !0,
|
|
483
535
|
calendarContext: {
|
|
484
|
-
tz:
|
|
485
|
-
weekStart:
|
|
536
|
+
tz: d,
|
|
537
|
+
weekStart: o,
|
|
486
538
|
anchor: n
|
|
487
539
|
}
|
|
488
|
-
} :
|
|
540
|
+
} : u(
|
|
489
541
|
`${r.pathPrefix}.tz`,
|
|
490
542
|
'Data App analysis option "calendarContext.tz" must be a valid timezone string.'
|
|
491
543
|
);
|
|
492
544
|
}
|
|
493
|
-
function
|
|
494
|
-
return
|
|
545
|
+
function me(e) {
|
|
546
|
+
return ye(e.spec);
|
|
495
547
|
}
|
|
496
|
-
function
|
|
497
|
-
if (!
|
|
548
|
+
function ye(e) {
|
|
549
|
+
if (!H(e))
|
|
498
550
|
throw new Error("useSemaphorQuery spec must be an object.");
|
|
499
551
|
if (e.queryKind === "metric")
|
|
500
|
-
return
|
|
552
|
+
return x(e);
|
|
501
553
|
if (e.queryKind === "analysis")
|
|
502
|
-
return
|
|
554
|
+
return E(e);
|
|
503
555
|
if (e.queryKind === "records")
|
|
504
|
-
return
|
|
556
|
+
return U(e);
|
|
505
557
|
if (e.queryKind === "sql")
|
|
506
|
-
return
|
|
558
|
+
return X(e);
|
|
559
|
+
if (e.queryKind === "matrix")
|
|
560
|
+
return Y(e);
|
|
507
561
|
if (e.queryKind === "inputOptions")
|
|
508
|
-
return
|
|
562
|
+
return J(e);
|
|
509
563
|
throw new Error(
|
|
510
|
-
"useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, or
|
|
564
|
+
"useSemaphorQuery spec.queryKind must be metric, analysis, records, inputOptions, sql, or matrix."
|
|
511
565
|
);
|
|
512
566
|
}
|
|
513
|
-
function
|
|
567
|
+
function he(e) {
|
|
514
568
|
if (e.intent.kind === "sql")
|
|
515
569
|
return [];
|
|
516
570
|
if (e.fieldCatalogs.length === 0 && !e.requireFieldCatalog)
|
|
517
571
|
return [];
|
|
518
|
-
const r =
|
|
572
|
+
const r = Se(
|
|
519
573
|
e.fieldCatalogs,
|
|
520
574
|
e.intent.source
|
|
521
575
|
);
|
|
522
|
-
|
|
523
|
-
|
|
576
|
+
if (!r)
|
|
577
|
+
return [
|
|
578
|
+
{
|
|
579
|
+
severity: "error",
|
|
580
|
+
code: "invalid_source_ref",
|
|
581
|
+
message: `Source ref for ${e.querySpec.queryHook} does not match a visible Semaphor source.`,
|
|
582
|
+
path: `${e.pathPrefix}.spec.source`,
|
|
583
|
+
queryHook: e.querySpec.queryHook,
|
|
584
|
+
queryId: e.queryId,
|
|
585
|
+
intentId: e.intent.id,
|
|
586
|
+
source: e.intent.source
|
|
587
|
+
}
|
|
588
|
+
];
|
|
589
|
+
const t = pe({
|
|
590
|
+
...e,
|
|
591
|
+
catalog: r
|
|
592
|
+
}), i = {
|
|
593
|
+
...r,
|
|
594
|
+
fields: [
|
|
595
|
+
...r.fields,
|
|
596
|
+
...be(e.intent, r, e.intent.source)
|
|
597
|
+
]
|
|
598
|
+
};
|
|
599
|
+
return [
|
|
600
|
+
...t,
|
|
601
|
+
...ge({
|
|
524
602
|
...e,
|
|
525
|
-
catalog:
|
|
603
|
+
catalog: i
|
|
526
604
|
}),
|
|
527
|
-
...
|
|
605
|
+
...ve({
|
|
528
606
|
...e,
|
|
529
|
-
catalog:
|
|
607
|
+
catalog: i
|
|
530
608
|
})
|
|
531
|
-
]
|
|
532
|
-
|
|
609
|
+
];
|
|
610
|
+
}
|
|
611
|
+
function pe(e) {
|
|
612
|
+
const r = T(e.intent);
|
|
613
|
+
if (r.length === 0)
|
|
614
|
+
return [];
|
|
615
|
+
const t = [], i = /* @__PURE__ */ new Set();
|
|
616
|
+
return r.forEach((o, n) => {
|
|
617
|
+
const s = `${e.pathPrefix}.spec.derivedFields.${n}`, d = b(o.name);
|
|
618
|
+
d && (i.has(d) && t.push({
|
|
533
619
|
severity: "error",
|
|
534
|
-
code: "
|
|
535
|
-
message: `
|
|
536
|
-
path: `${
|
|
620
|
+
code: "duplicate_derived_field",
|
|
621
|
+
message: `Derived field "${o.name}" is declared more than once.`,
|
|
622
|
+
path: `${s}.name`,
|
|
537
623
|
queryHook: e.querySpec.queryHook,
|
|
538
624
|
queryId: e.queryId,
|
|
539
625
|
intentId: e.intent.id,
|
|
540
626
|
source: e.intent.source
|
|
541
|
-
}
|
|
542
|
-
|
|
627
|
+
}), i.add(d), e.catalog.fields.some(
|
|
628
|
+
(l) => b(l.name) === d
|
|
629
|
+
) && t.push({
|
|
630
|
+
severity: "error",
|
|
631
|
+
code: "derived_field_name_collision",
|
|
632
|
+
message: `Derived field "${o.name}" conflicts with a field already visible on the selected Semaphor source.`,
|
|
633
|
+
path: `${s}.name`,
|
|
634
|
+
queryHook: e.querySpec.queryHook,
|
|
635
|
+
queryId: e.queryId,
|
|
636
|
+
intentId: e.intent.id,
|
|
637
|
+
source: e.intent.source
|
|
638
|
+
})), Object.entries(o.inputs || {}).forEach(([l, c]) => {
|
|
639
|
+
const f = we(c);
|
|
640
|
+
if (!f)
|
|
641
|
+
return;
|
|
642
|
+
const g = m(f, e.intent.source);
|
|
643
|
+
if (!q(g, e.intent.source)) {
|
|
644
|
+
t.push({
|
|
645
|
+
severity: "error",
|
|
646
|
+
code: "unsupported_derived_field_source",
|
|
647
|
+
message: `Derived field "${o.name}" input "${l}" references a different Semaphor source. App-local derived fields must use fields from the query source.`,
|
|
648
|
+
path: `${s}.inputs.${l}`,
|
|
649
|
+
queryHook: e.querySpec.queryHook,
|
|
650
|
+
queryId: e.queryId,
|
|
651
|
+
intentId: e.intent.id,
|
|
652
|
+
source: g,
|
|
653
|
+
field: f
|
|
654
|
+
});
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
I(e.catalog, f, e.intent.source) || t.push({
|
|
658
|
+
severity: "error",
|
|
659
|
+
code: "missing_field",
|
|
660
|
+
message: `Derived field "${o.name}" input "${l}" references field "${f.name}", which is not visible on the selected Semaphor source.`,
|
|
661
|
+
path: `${s}.inputs.${l}`,
|
|
662
|
+
queryHook: e.querySpec.queryHook,
|
|
663
|
+
queryId: e.queryId,
|
|
664
|
+
intentId: e.intent.id,
|
|
665
|
+
source: g,
|
|
666
|
+
field: f
|
|
667
|
+
});
|
|
668
|
+
});
|
|
669
|
+
}), t;
|
|
543
670
|
}
|
|
544
|
-
function
|
|
545
|
-
return
|
|
671
|
+
function ge(e) {
|
|
672
|
+
return ke(e.intent).flatMap(({ field: r, path: t }) => I(e.catalog, r, e.intent.source) ? [] : [
|
|
546
673
|
{
|
|
547
674
|
severity: "error",
|
|
548
675
|
code: "missing_field",
|
|
@@ -551,26 +678,26 @@ function ae(e) {
|
|
|
551
678
|
queryHook: e.querySpec.queryHook,
|
|
552
679
|
queryId: e.queryId,
|
|
553
680
|
intentId: e.intent.id,
|
|
554
|
-
source:
|
|
681
|
+
source: m(r, e.intent.source),
|
|
555
682
|
field: r
|
|
556
683
|
}
|
|
557
684
|
]);
|
|
558
685
|
}
|
|
559
|
-
function
|
|
560
|
-
return ("inputs" in e.intent ? e.intent.inputs || [] : []).flatMap((t,
|
|
686
|
+
function ve(e) {
|
|
687
|
+
return ("inputs" in e.intent ? e.intent.inputs || [] : []).flatMap((t, i) => {
|
|
561
688
|
if (!t.field)
|
|
562
689
|
return [];
|
|
563
|
-
const
|
|
564
|
-
return
|
|
690
|
+
const o = m(t.field, e.intent.source);
|
|
691
|
+
return q(o, e.intent.source) ? I(e.catalog, t.field, e.intent.source) ? [] : [
|
|
565
692
|
{
|
|
566
693
|
severity: "error",
|
|
567
694
|
code: "missing_field",
|
|
568
695
|
message: `Input "${t.inputId}" references field "${t.field.name}", which is not visible on the selected Semaphor source.`,
|
|
569
|
-
path: `${e.pathPrefix}.spec.inputs.${
|
|
696
|
+
path: `${e.pathPrefix}.spec.inputs.${i}.field`,
|
|
570
697
|
queryHook: e.querySpec.queryHook,
|
|
571
698
|
queryId: e.queryId,
|
|
572
699
|
intentId: e.intent.id,
|
|
573
|
-
source:
|
|
700
|
+
source: o,
|
|
574
701
|
field: t.field
|
|
575
702
|
}
|
|
576
703
|
] : [
|
|
@@ -578,20 +705,20 @@ function se(e) {
|
|
|
578
705
|
severity: "error",
|
|
579
706
|
code: "unsupported_input_filter_composition",
|
|
580
707
|
message: `Input "${t.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,
|
|
581
|
-
path: `${e.pathPrefix}.spec.inputs.${
|
|
708
|
+
path: `${e.pathPrefix}.spec.inputs.${i}.field`,
|
|
582
709
|
queryHook: e.querySpec.queryHook,
|
|
583
710
|
queryId: e.queryId,
|
|
584
711
|
intentId: e.intent.id,
|
|
585
|
-
source:
|
|
712
|
+
source: o,
|
|
586
713
|
field: t.field
|
|
587
714
|
}
|
|
588
715
|
];
|
|
589
716
|
});
|
|
590
717
|
}
|
|
591
|
-
function
|
|
718
|
+
function qe(e) {
|
|
592
719
|
if (e.querySpec.spec.queryKind !== "analysis")
|
|
593
720
|
return [];
|
|
594
|
-
const r =
|
|
721
|
+
const r = de(
|
|
595
722
|
e.querySpec.spec,
|
|
596
723
|
{
|
|
597
724
|
pathPrefix: `${e.pathPrefix}.spec`,
|
|
@@ -609,8 +736,8 @@ function de(e) {
|
|
|
609
736
|
source: e.intent.source
|
|
610
737
|
}));
|
|
611
738
|
}
|
|
612
|
-
function
|
|
613
|
-
return e.querySpec.spec.queryKind !== "sql" ? [] :
|
|
739
|
+
function Ie(e) {
|
|
740
|
+
return e.querySpec.spec.queryKind !== "sql" ? [] : H(e.querySpec.spec) ? Object.prototype.hasOwnProperty.call(e.querySpec.spec, "parameters") ? [
|
|
614
741
|
{
|
|
615
742
|
severity: "error",
|
|
616
743
|
code: "deprecated_sql_parameters",
|
|
@@ -622,7 +749,7 @@ function le(e) {
|
|
|
622
749
|
}
|
|
623
750
|
] : [] : [];
|
|
624
751
|
}
|
|
625
|
-
function
|
|
752
|
+
function ke(e) {
|
|
626
753
|
return e.kind === "metric" ? [
|
|
627
754
|
...e.metrics.map((r, t) => ({
|
|
628
755
|
field: r,
|
|
@@ -650,33 +777,105 @@ function ue(e) {
|
|
|
650
777
|
field: r.field,
|
|
651
778
|
path: `spec.filters.${t}.field`
|
|
652
779
|
}))
|
|
653
|
-
] : e.kind === "inputOptions" ? [{ field: e.field, path: "spec.field" }] : [
|
|
780
|
+
] : e.kind === "inputOptions" ? [{ field: e.field, path: "spec.field" }] : e.kind === "matrix" ? [
|
|
781
|
+
...e.rows.map((r, t) => ({
|
|
782
|
+
field: r.field,
|
|
783
|
+
path: `spec.rows.${t}.field`
|
|
784
|
+
})),
|
|
785
|
+
...e.rows.flatMap(
|
|
786
|
+
(r, t) => {
|
|
787
|
+
var i;
|
|
788
|
+
return ((i = r.sortBy) == null ? void 0 : i.by.kind) === "field" ? [
|
|
789
|
+
{
|
|
790
|
+
field: r.sortBy.by.field,
|
|
791
|
+
path: `spec.rows.${t}.sortBy.by.field`
|
|
792
|
+
}
|
|
793
|
+
] : [];
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
...(e.columns || []).map((r, t) => ({
|
|
797
|
+
field: r.field,
|
|
798
|
+
path: `spec.columns.${t}.field`
|
|
799
|
+
})),
|
|
800
|
+
...(e.columns || []).flatMap(
|
|
801
|
+
(r, t) => {
|
|
802
|
+
var i;
|
|
803
|
+
return ((i = r.sortBy) == null ? void 0 : i.by.kind) === "field" ? [
|
|
804
|
+
{
|
|
805
|
+
field: r.sortBy.by.field,
|
|
806
|
+
path: `spec.columns.${t}.sortBy.by.field`
|
|
807
|
+
}
|
|
808
|
+
] : [];
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
...e.values.map((r, t) => ({
|
|
812
|
+
field: r.field,
|
|
813
|
+
path: `spec.values.${t}.field`
|
|
814
|
+
})),
|
|
815
|
+
...(e.sort || []).flatMap(
|
|
816
|
+
(r, t) => r.by.kind === "field" ? [
|
|
817
|
+
{
|
|
818
|
+
field: r.by.field,
|
|
819
|
+
path: `spec.sort.${t}.by.field`
|
|
820
|
+
}
|
|
821
|
+
] : []
|
|
822
|
+
),
|
|
823
|
+
...(e.filters || []).map((r, t) => ({
|
|
824
|
+
field: r.field,
|
|
825
|
+
path: `spec.filters.${t}.field`
|
|
826
|
+
}))
|
|
827
|
+
] : [];
|
|
654
828
|
}
|
|
655
|
-
function
|
|
656
|
-
return e.find((t) =>
|
|
829
|
+
function Se(e, r) {
|
|
830
|
+
return e.find((t) => v(t, r));
|
|
657
831
|
}
|
|
658
|
-
function
|
|
659
|
-
const
|
|
660
|
-
if (
|
|
832
|
+
function I(e, r, t) {
|
|
833
|
+
const i = m(r, t);
|
|
834
|
+
if (v(e, i))
|
|
661
835
|
return e.fields.find(
|
|
662
|
-
(
|
|
836
|
+
(o) => Ae(o, r) && v(
|
|
663
837
|
e,
|
|
664
|
-
|
|
838
|
+
m(o, e.source)
|
|
665
839
|
)
|
|
666
840
|
);
|
|
667
841
|
}
|
|
668
|
-
function
|
|
842
|
+
function T(e) {
|
|
843
|
+
return !("derivedFields" in e) || !Array.isArray(e.derivedFields) ? [] : e.derivedFields;
|
|
844
|
+
}
|
|
845
|
+
function be(e, r, t) {
|
|
846
|
+
return T(e).map((i) => ({
|
|
847
|
+
name: i.name,
|
|
848
|
+
label: i.label,
|
|
849
|
+
role: $e(i.resultRole),
|
|
850
|
+
dataType: i.dataType,
|
|
851
|
+
source: r.source || t,
|
|
852
|
+
...i.defaultAggregate ? { aggregate: i.defaultAggregate } : {}
|
|
853
|
+
}));
|
|
854
|
+
}
|
|
855
|
+
function $e(e) {
|
|
856
|
+
return e === "measure" ? "measure" : e === "date" ? "date" : e === "id" ? "id" : "dimension";
|
|
857
|
+
}
|
|
858
|
+
function we(e) {
|
|
859
|
+
if (!e || typeof e != "object")
|
|
860
|
+
return;
|
|
861
|
+
const r = e;
|
|
862
|
+
return r.field || r.metric || r.dimension;
|
|
863
|
+
}
|
|
864
|
+
function b(e) {
|
|
865
|
+
return O(e);
|
|
866
|
+
}
|
|
867
|
+
function v(e, r) {
|
|
669
868
|
return [e.source, ...e.sourceAliases || []].some(
|
|
670
|
-
(t) =>
|
|
869
|
+
(t) => q(t, r)
|
|
671
870
|
);
|
|
672
871
|
}
|
|
673
|
-
function
|
|
872
|
+
function m(e, r) {
|
|
674
873
|
return e.source || r;
|
|
675
874
|
}
|
|
676
|
-
function
|
|
875
|
+
function Ae(e, r) {
|
|
677
876
|
return !!(e.name && r.name && e.name === r.name);
|
|
678
877
|
}
|
|
679
|
-
function
|
|
878
|
+
function $(e, r) {
|
|
680
879
|
return {
|
|
681
880
|
severity: r.severity,
|
|
682
881
|
code: e.code || "invalid_analytics_intent",
|
|
@@ -688,15 +887,15 @@ function v(e, r) {
|
|
|
688
887
|
source: r.intent.source
|
|
689
888
|
};
|
|
690
889
|
}
|
|
691
|
-
function
|
|
692
|
-
const t =
|
|
890
|
+
function _e(e, r) {
|
|
891
|
+
const t = P(r);
|
|
693
892
|
return {
|
|
694
893
|
ok: t.ok && e.ok,
|
|
695
|
-
errors:
|
|
894
|
+
errors: A([
|
|
696
895
|
...e.errors,
|
|
697
896
|
...t.errors
|
|
698
897
|
]),
|
|
699
|
-
warnings:
|
|
898
|
+
warnings: A([
|
|
700
899
|
...e.warnings,
|
|
701
900
|
...t.warnings
|
|
702
901
|
]),
|
|
@@ -706,25 +905,25 @@ function me(e, r) {
|
|
|
706
905
|
]
|
|
707
906
|
};
|
|
708
907
|
}
|
|
709
|
-
function
|
|
710
|
-
const r = e.filter((
|
|
908
|
+
function P(e) {
|
|
909
|
+
const r = e.filter((i) => i.severity === "error").map(w), t = e.filter((i) => i.severity === "warning").map(w);
|
|
711
910
|
return {
|
|
712
911
|
ok: r.length === 0,
|
|
713
912
|
errors: r,
|
|
714
913
|
warnings: t,
|
|
715
|
-
repairHints: r.map((
|
|
716
|
-
var
|
|
914
|
+
repairHints: r.map((i) => {
|
|
915
|
+
var o, n;
|
|
717
916
|
return {
|
|
718
|
-
code:
|
|
719
|
-
message:
|
|
720
|
-
fieldRole:
|
|
721
|
-
invalidField: (
|
|
722
|
-
recommendedNextStep: ((n =
|
|
917
|
+
code: i.code,
|
|
918
|
+
message: i.message,
|
|
919
|
+
fieldRole: i.fieldRole,
|
|
920
|
+
invalidField: (o = i.repairHint) == null ? void 0 : o.invalidField,
|
|
921
|
+
recommendedNextStep: ((n = i.repairHint) == null ? void 0 : n.recommendedNextStep) || "Update the Data App SDK query spec to use visible Semaphor source and field refs."
|
|
723
922
|
};
|
|
724
923
|
})
|
|
725
924
|
};
|
|
726
925
|
}
|
|
727
|
-
function
|
|
926
|
+
function w(e) {
|
|
728
927
|
var r;
|
|
729
928
|
return {
|
|
730
929
|
code: e.code,
|
|
@@ -740,22 +939,22 @@ function q(e) {
|
|
|
740
939
|
}
|
|
741
940
|
};
|
|
742
941
|
}
|
|
743
|
-
function
|
|
942
|
+
function A(e) {
|
|
744
943
|
const r = /* @__PURE__ */ new Set();
|
|
745
944
|
return e.filter((t) => {
|
|
746
|
-
const
|
|
747
|
-
return r.has(
|
|
945
|
+
const i = `${t.code}:${t.path || ""}:${t.message}`;
|
|
946
|
+
return r.has(i) ? !1 : (r.add(i), !0);
|
|
748
947
|
});
|
|
749
948
|
}
|
|
750
|
-
function
|
|
751
|
-
var t,
|
|
949
|
+
function _(e) {
|
|
950
|
+
var t, i;
|
|
752
951
|
const r = e.diagnostics.filter(
|
|
753
|
-
(
|
|
952
|
+
(o) => o.severity === "error"
|
|
754
953
|
);
|
|
755
954
|
return {
|
|
756
955
|
intentId: (t = e.intent) == null ? void 0 : t.id,
|
|
757
956
|
status: r.length ? "failed" : "answered",
|
|
758
|
-
resultShape: (
|
|
957
|
+
resultShape: (i = e.intent) == null ? void 0 : i.kind,
|
|
759
958
|
intent: e.intent,
|
|
760
959
|
validation: e.validation,
|
|
761
960
|
coverage: {
|
|
@@ -763,41 +962,42 @@ function k(e) {
|
|
|
763
962
|
missingObligations: r.length ? ["query_spec_validation"] : [],
|
|
764
963
|
warnings: e.validation.warnings
|
|
765
964
|
},
|
|
766
|
-
missingFields: r.filter((
|
|
767
|
-
(
|
|
965
|
+
missingFields: r.filter((o) => o.code === "missing_field").flatMap(
|
|
966
|
+
(o) => {
|
|
768
967
|
var n;
|
|
769
|
-
return (n =
|
|
968
|
+
return (n = o.field) != null && n.name ? [o.field.name] : [];
|
|
770
969
|
}
|
|
771
970
|
),
|
|
772
|
-
warnings: e.diagnostics.filter((
|
|
971
|
+
warnings: e.diagnostics.filter((o) => o.severity === "warning").map((o) => o.message),
|
|
773
972
|
metadata: {
|
|
774
973
|
validationKind: "data_app_sdk_query_spec"
|
|
775
974
|
}
|
|
776
975
|
};
|
|
777
976
|
}
|
|
778
|
-
function
|
|
779
|
-
return r.id ||
|
|
977
|
+
function Me(e, r) {
|
|
978
|
+
return r.id || B(e.spec);
|
|
780
979
|
}
|
|
781
|
-
function
|
|
980
|
+
function B(e) {
|
|
782
981
|
if (!e || typeof e != "object" || !("id" in e))
|
|
783
982
|
return;
|
|
784
983
|
const r = e.id;
|
|
785
984
|
return typeof r == "string" && r.trim() ? r : void 0;
|
|
786
985
|
}
|
|
787
986
|
export {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
987
|
+
Y as a,
|
|
988
|
+
X as b,
|
|
989
|
+
J as c,
|
|
990
|
+
U as d,
|
|
991
|
+
Re as e,
|
|
992
|
+
E as f,
|
|
993
|
+
x as g,
|
|
994
|
+
C as h,
|
|
995
|
+
S as i,
|
|
996
|
+
te as j,
|
|
997
|
+
He as k,
|
|
998
|
+
oe as l,
|
|
999
|
+
de as m,
|
|
1000
|
+
Pe as n,
|
|
1001
|
+
Te as t,
|
|
1002
|
+
Be as v
|
|
803
1003
|
};
|