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,10 +1,10 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { j as
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { jsx as
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
1
|
+
import { t as y, a as M, b as B, c as Q, d as J, e as Y, f as F, g as H, n as V, h as $, i as k } from "../chunks/validation-CQFpcSSP.js";
|
|
2
|
+
import { m as ze, j as Me, k as Be, l as Qe, v as Je } from "../chunks/validation-CQFpcSSP.js";
|
|
3
|
+
import { j as W } from "../chunks/index-CuHybtft.js";
|
|
4
|
+
import { createContext as X, useContext as G, useMemo as m, useState as O, useCallback as R, useEffect as L, useRef as j } from "react";
|
|
5
|
+
import { jsx as Z } from "react/jsx-runtime";
|
|
6
|
+
import { c as ee } from "../chunks/validators-CuKnUZFO.js";
|
|
7
|
+
const te = [
|
|
8
8
|
"records",
|
|
9
9
|
"changes",
|
|
10
10
|
"drivers",
|
|
@@ -12,7 +12,7 @@ const G = [
|
|
|
12
12
|
"largestPositiveChanges",
|
|
13
13
|
"largestNegativeDrivers",
|
|
14
14
|
"largestPositiveDrivers"
|
|
15
|
-
],
|
|
15
|
+
], re = [
|
|
16
16
|
"records",
|
|
17
17
|
"changes",
|
|
18
18
|
"drivers",
|
|
@@ -21,10 +21,10 @@ const G = [
|
|
|
21
21
|
"largestNegativeDrivers",
|
|
22
22
|
"largestPositiveDrivers"
|
|
23
23
|
];
|
|
24
|
-
function
|
|
24
|
+
function N(e) {
|
|
25
25
|
if (!e)
|
|
26
26
|
return {};
|
|
27
|
-
const t =
|
|
27
|
+
const t = se(e.executionResult), n = ne(e, t), r = ie(n);
|
|
28
28
|
return {
|
|
29
29
|
...e,
|
|
30
30
|
...Object.keys(n).length ? { resultSets: n } : {},
|
|
@@ -35,35 +35,35 @@ function V(e) {
|
|
|
35
35
|
} : {}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const n =
|
|
40
|
-
for (const i of
|
|
38
|
+
function ne(e, t) {
|
|
39
|
+
const n = oe(e.resultSets);
|
|
40
|
+
for (const i of te) {
|
|
41
41
|
if (n[i]) {
|
|
42
|
-
n[i] =
|
|
42
|
+
n[i] = U(n[i]);
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
const u =
|
|
45
|
+
const u = ae(e[i]);
|
|
46
46
|
if (!u.length)
|
|
47
47
|
continue;
|
|
48
|
-
const s = t.length ? t :
|
|
48
|
+
const s = t.length ? t : ce(u);
|
|
49
49
|
n[i] = {
|
|
50
50
|
records: b(u, s),
|
|
51
51
|
columns: s,
|
|
52
52
|
rowCount: u.length
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const r =
|
|
55
|
+
const r = ue(e.executionResult);
|
|
56
56
|
return r && r.records.length > 0 && !n.records && (n.records = r), n;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function oe(e) {
|
|
59
59
|
return Object.fromEntries(
|
|
60
60
|
Object.entries(e || {}).map(([t, n]) => [
|
|
61
61
|
t,
|
|
62
|
-
|
|
62
|
+
U(n)
|
|
63
63
|
])
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function U(e) {
|
|
67
67
|
var t;
|
|
68
68
|
return {
|
|
69
69
|
...e,
|
|
@@ -74,14 +74,14 @@ function $(e) {
|
|
|
74
74
|
rowCount: e.rowCount ?? ((t = e.records) == null ? void 0 : t.length) ?? 0
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ie(e) {
|
|
78
78
|
var t;
|
|
79
|
-
for (const n of
|
|
79
|
+
for (const n of re)
|
|
80
80
|
if ((t = e[n]) != null && t.records.length)
|
|
81
81
|
return e[n];
|
|
82
82
|
return Object.values(e).find((n) => n.records.length) || Object.values(e)[0];
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function ue(e) {
|
|
85
85
|
const t = e == null ? void 0 : e.result;
|
|
86
86
|
if (!(!t || t.kind !== "records" && t.kind !== "sql"))
|
|
87
87
|
return {
|
|
@@ -90,11 +90,11 @@ function re(e) {
|
|
|
90
90
|
rowCount: t.rowCount ?? t.records.length
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function se(e) {
|
|
94
94
|
const t = e == null ? void 0 : e.result;
|
|
95
95
|
return !t || t.kind !== "records" && t.kind !== "sql" ? [] : t.columns;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function ae(e) {
|
|
98
98
|
return Array.isArray(e) ? e.filter(
|
|
99
99
|
(t) => !!(t && typeof t == "object" && !Array.isArray(t))
|
|
100
100
|
) : [];
|
|
@@ -103,7 +103,7 @@ function b(e, t) {
|
|
|
103
103
|
return t.length ? e.map((n) => {
|
|
104
104
|
const r = {};
|
|
105
105
|
return t.forEach((i, u) => {
|
|
106
|
-
const s =
|
|
106
|
+
const s = le(n, {
|
|
107
107
|
name: i.key,
|
|
108
108
|
label: i.label,
|
|
109
109
|
fallbackNames: [i.name, Object.keys(n)[u]]
|
|
@@ -112,7 +112,7 @@ function b(e, t) {
|
|
|
112
112
|
}), Object.keys(r).length ? r : n;
|
|
113
113
|
}) : e;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function ce(e) {
|
|
116
116
|
return Array.from(
|
|
117
117
|
new Set(e.flatMap((n) => Object.keys(n)))
|
|
118
118
|
).map((n) => ({
|
|
@@ -121,7 +121,7 @@ function ie(e) {
|
|
|
121
121
|
label: n
|
|
122
122
|
}));
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function le(e, t) {
|
|
125
125
|
const n = [
|
|
126
126
|
t.name,
|
|
127
127
|
t.label,
|
|
@@ -131,13 +131,13 @@ function ue(e, t) {
|
|
|
131
131
|
if (Object.prototype.hasOwnProperty.call(e, r))
|
|
132
132
|
return e[r];
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function _e(e) {
|
|
135
135
|
return e;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Te(e) {
|
|
138
138
|
return e;
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const Pe = {
|
|
141
141
|
filter(e) {
|
|
142
142
|
return {
|
|
143
143
|
...e,
|
|
@@ -157,6 +157,13 @@ const xe = {
|
|
|
157
157
|
role: "sqlParam"
|
|
158
158
|
};
|
|
159
159
|
},
|
|
160
|
+
derivedField(e) {
|
|
161
|
+
return {
|
|
162
|
+
...e,
|
|
163
|
+
kind: "derived_field",
|
|
164
|
+
expressionLanguage: e.expressionLanguage || "semaphor_sql_template"
|
|
165
|
+
};
|
|
166
|
+
},
|
|
160
167
|
metric(e) {
|
|
161
168
|
return {
|
|
162
169
|
...e,
|
|
@@ -186,25 +193,34 @@ const xe = {
|
|
|
186
193
|
...e,
|
|
187
194
|
queryKind: "sql"
|
|
188
195
|
};
|
|
196
|
+
},
|
|
197
|
+
matrix(e) {
|
|
198
|
+
return {
|
|
199
|
+
...e,
|
|
200
|
+
queryKind: "matrix"
|
|
201
|
+
};
|
|
189
202
|
}
|
|
190
203
|
};
|
|
191
|
-
function
|
|
204
|
+
function de() {
|
|
192
205
|
return {
|
|
193
206
|
executeAnalysis: (e, t, n) => h(
|
|
194
207
|
e,
|
|
195
208
|
t,
|
|
196
209
|
n ?? {}
|
|
197
|
-
).then(
|
|
210
|
+
).then(N),
|
|
198
211
|
executeMetric: (e, t) => h(e, t),
|
|
199
212
|
executeRecords: (e, t) => h(e, t),
|
|
200
213
|
executeInputOptions: (e, t) => h(e, t),
|
|
201
|
-
executeSql: (e, t) => h(e, t)
|
|
214
|
+
executeSql: (e, t) => h(e, t),
|
|
215
|
+
executeMatrix: (e, t) => h(e, t)
|
|
202
216
|
};
|
|
203
217
|
}
|
|
204
218
|
async function h(e, t, n) {
|
|
205
219
|
if (!t.token)
|
|
206
|
-
throw new Error(
|
|
207
|
-
|
|
220
|
+
throw new Error(
|
|
221
|
+
"SemaphorDataAppProvider needs a token to execute queries."
|
|
222
|
+
);
|
|
223
|
+
const r = await fetch(me(t), {
|
|
208
224
|
method: "POST",
|
|
209
225
|
headers: {
|
|
210
226
|
"Content-Type": "application/json",
|
|
@@ -216,14 +232,14 @@ async function h(e, t, n) {
|
|
|
216
232
|
...n ? { analysisOptions: n } : {},
|
|
217
233
|
resultShape: e.kind
|
|
218
234
|
})
|
|
219
|
-
}), i = await
|
|
235
|
+
}), i = await fe(r);
|
|
220
236
|
if (!r.ok || i.error)
|
|
221
237
|
throw new Error(
|
|
222
238
|
i.error || `Semaphor Data App execution failed with status ${r.status}.`
|
|
223
239
|
);
|
|
224
240
|
return i;
|
|
225
241
|
}
|
|
226
|
-
async function
|
|
242
|
+
async function fe(e) {
|
|
227
243
|
const t = await e.text().catch(() => "");
|
|
228
244
|
if (!t.trim())
|
|
229
245
|
return e.ok ? {
|
|
@@ -236,46 +252,46 @@ async function ae(e) {
|
|
|
236
252
|
error: "Semaphor Data App execution returned invalid JSON.",
|
|
237
253
|
details: t
|
|
238
254
|
} : {
|
|
239
|
-
error:
|
|
255
|
+
error: pe(e, t),
|
|
240
256
|
details: t
|
|
241
257
|
};
|
|
242
258
|
}
|
|
243
259
|
}
|
|
244
|
-
function
|
|
260
|
+
function pe(e, t) {
|
|
245
261
|
const n = e.statusText ? ` ${e.statusText}` : "", r = t.replace(/\s+/g, " ").trim();
|
|
246
262
|
return r ? `Semaphor Data App execution failed with status ${e.status}${n}: ${r.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${n}.`;
|
|
247
263
|
}
|
|
248
|
-
function
|
|
249
|
-
const t =
|
|
264
|
+
function me(e) {
|
|
265
|
+
const t = he(e).replace(/\/+$/, "");
|
|
250
266
|
return t ? t.endsWith("/api") ? `${t}/v1/data-app/execute` : `${t}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
|
|
251
267
|
}
|
|
252
|
-
function
|
|
268
|
+
function he(e) {
|
|
253
269
|
if (e.apiBaseUrl)
|
|
254
270
|
return e.apiBaseUrl;
|
|
255
271
|
if (!e.token)
|
|
256
272
|
return "";
|
|
257
273
|
try {
|
|
258
|
-
return
|
|
274
|
+
return W(e.token).apiServiceUrl || "";
|
|
259
275
|
} catch {
|
|
260
276
|
return "";
|
|
261
277
|
}
|
|
262
278
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
279
|
+
const z = X({});
|
|
280
|
+
function ve() {
|
|
265
281
|
if (!(typeof window > "u"))
|
|
266
282
|
return window.__SEMAPHOR_DATA_APP_RUNTIME__;
|
|
267
283
|
}
|
|
268
|
-
function
|
|
269
|
-
return
|
|
284
|
+
function ye() {
|
|
285
|
+
return G(z);
|
|
270
286
|
}
|
|
271
|
-
function
|
|
287
|
+
function je({
|
|
272
288
|
token: e,
|
|
273
289
|
apiBaseUrl: t,
|
|
274
290
|
executor: n,
|
|
275
291
|
children: r
|
|
276
292
|
}) {
|
|
277
293
|
var o;
|
|
278
|
-
const i =
|
|
294
|
+
const i = ve(), u = ((o = i == null ? void 0 : i.authToken) == null ? void 0 : o.accessToken) || e, s = (i == null ? void 0 : i.dataApiBaseUrl) || (i == null ? void 0 : i.apiBaseUrl) || t, f = m(() => de(), []), a = n || f, c = m(
|
|
279
295
|
() => ({
|
|
280
296
|
token: u,
|
|
281
297
|
apiBaseUrl: s,
|
|
@@ -283,143 +299,179 @@ function we({
|
|
|
283
299
|
}),
|
|
284
300
|
[s, a, u]
|
|
285
301
|
);
|
|
286
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ Z(z.Provider, { value: c, children: r });
|
|
287
303
|
}
|
|
288
|
-
const
|
|
289
|
-
function
|
|
290
|
-
const t =
|
|
304
|
+
const I = { value: null }, x = {}, qe = { records: [] }, D = { options: [] }, Se = { records: [] }, E = {};
|
|
305
|
+
function Ae(e) {
|
|
306
|
+
const t = y(e.inputs), n = Y(e);
|
|
291
307
|
try {
|
|
292
|
-
const r =
|
|
308
|
+
const r = F(e), i = v(r);
|
|
293
309
|
return i ? {
|
|
294
310
|
error: i,
|
|
295
311
|
activeInputs: t,
|
|
296
312
|
analysisOptions: n,
|
|
297
|
-
queryKey:
|
|
298
|
-
|
|
313
|
+
queryKey: d(
|
|
314
|
+
void 0,
|
|
315
|
+
t,
|
|
316
|
+
i,
|
|
317
|
+
n
|
|
318
|
+
),
|
|
319
|
+
idleData: x
|
|
299
320
|
} : {
|
|
300
321
|
intent: r,
|
|
301
322
|
error: null,
|
|
302
323
|
activeInputs: t,
|
|
303
324
|
analysisOptions: n,
|
|
304
|
-
queryKey:
|
|
305
|
-
idleData:
|
|
325
|
+
queryKey: d(r, t, void 0, n),
|
|
326
|
+
idleData: x
|
|
306
327
|
};
|
|
307
328
|
} catch (r) {
|
|
308
|
-
const i =
|
|
329
|
+
const i = p(r);
|
|
309
330
|
return {
|
|
310
331
|
error: i,
|
|
311
332
|
activeInputs: t,
|
|
312
333
|
analysisOptions: n,
|
|
313
|
-
queryKey:
|
|
314
|
-
|
|
334
|
+
queryKey: d(
|
|
335
|
+
void 0,
|
|
336
|
+
t,
|
|
337
|
+
i,
|
|
338
|
+
n
|
|
339
|
+
),
|
|
340
|
+
idleData: x
|
|
315
341
|
};
|
|
316
342
|
}
|
|
317
343
|
}
|
|
318
|
-
function
|
|
319
|
-
const t =
|
|
344
|
+
function ge(e) {
|
|
345
|
+
const t = y(e.inputs);
|
|
320
346
|
try {
|
|
321
|
-
const n =
|
|
347
|
+
const n = H(e), r = v(n);
|
|
322
348
|
return r ? {
|
|
323
349
|
error: r,
|
|
324
350
|
activeInputs: t,
|
|
325
|
-
queryKey:
|
|
326
|
-
idleData:
|
|
351
|
+
queryKey: d(void 0, t, r),
|
|
352
|
+
idleData: I
|
|
327
353
|
} : {
|
|
328
354
|
intent: n,
|
|
329
355
|
error: null,
|
|
330
356
|
activeInputs: t,
|
|
331
|
-
queryKey:
|
|
332
|
-
idleData:
|
|
357
|
+
queryKey: d(n, t),
|
|
358
|
+
idleData: I
|
|
333
359
|
};
|
|
334
360
|
} catch (n) {
|
|
335
|
-
const r =
|
|
361
|
+
const r = p(n);
|
|
336
362
|
return {
|
|
337
363
|
error: r,
|
|
338
364
|
activeInputs: t,
|
|
339
|
-
queryKey:
|
|
340
|
-
idleData:
|
|
365
|
+
queryKey: d(void 0, t, r),
|
|
366
|
+
idleData: I
|
|
341
367
|
};
|
|
342
368
|
}
|
|
343
369
|
}
|
|
344
|
-
function
|
|
345
|
-
const t =
|
|
370
|
+
function ke(e) {
|
|
371
|
+
const t = y(e.inputs), n = qe;
|
|
346
372
|
try {
|
|
347
|
-
const r =
|
|
373
|
+
const r = J(e), i = v(r);
|
|
348
374
|
return i ? {
|
|
349
375
|
error: i,
|
|
350
376
|
activeInputs: t,
|
|
351
|
-
queryKey:
|
|
377
|
+
queryKey: d(void 0, t, i),
|
|
352
378
|
idleData: n
|
|
353
379
|
} : {
|
|
354
380
|
intent: r,
|
|
355
381
|
error: null,
|
|
356
382
|
activeInputs: t,
|
|
357
|
-
queryKey:
|
|
383
|
+
queryKey: d(r, t),
|
|
358
384
|
idleData: n
|
|
359
385
|
};
|
|
360
386
|
} catch (r) {
|
|
361
|
-
const i =
|
|
387
|
+
const i = p(r);
|
|
362
388
|
return {
|
|
363
389
|
error: i,
|
|
364
390
|
activeInputs: t,
|
|
365
|
-
queryKey:
|
|
391
|
+
queryKey: d(void 0, t, i),
|
|
366
392
|
idleData: n
|
|
367
393
|
};
|
|
368
394
|
}
|
|
369
395
|
}
|
|
370
|
-
function
|
|
396
|
+
function Ie(e) {
|
|
371
397
|
try {
|
|
372
|
-
const t =
|
|
398
|
+
const t = Q(e), n = v(t);
|
|
373
399
|
return n ? {
|
|
374
400
|
error: n,
|
|
375
|
-
queryKey:
|
|
376
|
-
idleData:
|
|
401
|
+
queryKey: d(void 0, void 0, n),
|
|
402
|
+
idleData: D
|
|
377
403
|
} : {
|
|
378
404
|
intent: t,
|
|
379
405
|
error: null,
|
|
380
|
-
queryKey:
|
|
381
|
-
idleData:
|
|
406
|
+
queryKey: d(t),
|
|
407
|
+
idleData: D
|
|
382
408
|
};
|
|
383
409
|
} catch (t) {
|
|
384
|
-
const n =
|
|
410
|
+
const n = p(t);
|
|
385
411
|
return {
|
|
386
412
|
error: n,
|
|
387
|
-
queryKey:
|
|
388
|
-
idleData:
|
|
413
|
+
queryKey: d(void 0, void 0, n),
|
|
414
|
+
idleData: D
|
|
389
415
|
};
|
|
390
416
|
}
|
|
391
417
|
}
|
|
392
|
-
function
|
|
393
|
-
const t =
|
|
418
|
+
function xe(e) {
|
|
419
|
+
const t = y(e.inputs), n = Se;
|
|
394
420
|
try {
|
|
395
|
-
const r =
|
|
421
|
+
const r = B(e), i = v(r);
|
|
396
422
|
return i ? {
|
|
397
423
|
error: i,
|
|
398
424
|
activeInputs: t,
|
|
399
|
-
queryKey:
|
|
425
|
+
queryKey: d(void 0, t, i),
|
|
400
426
|
idleData: n
|
|
401
427
|
} : {
|
|
402
428
|
intent: r,
|
|
403
429
|
error: null,
|
|
404
430
|
activeInputs: t,
|
|
405
|
-
queryKey:
|
|
431
|
+
queryKey: d(r, t),
|
|
406
432
|
idleData: n
|
|
407
433
|
};
|
|
408
434
|
} catch (r) {
|
|
409
|
-
const i =
|
|
435
|
+
const i = p(r);
|
|
410
436
|
return {
|
|
411
437
|
error: i,
|
|
412
438
|
activeInputs: t,
|
|
413
|
-
queryKey:
|
|
439
|
+
queryKey: d(void 0, t, i),
|
|
414
440
|
idleData: n
|
|
415
441
|
};
|
|
416
442
|
}
|
|
417
443
|
}
|
|
418
|
-
function
|
|
444
|
+
function De(e) {
|
|
445
|
+
const t = y(e.inputs);
|
|
446
|
+
try {
|
|
447
|
+
const n = M(e), r = v(n);
|
|
448
|
+
return r ? {
|
|
449
|
+
error: r,
|
|
450
|
+
activeInputs: t,
|
|
451
|
+
queryKey: d(void 0, t, r),
|
|
452
|
+
idleData: E
|
|
453
|
+
} : {
|
|
454
|
+
intent: n,
|
|
455
|
+
error: null,
|
|
456
|
+
activeInputs: t,
|
|
457
|
+
queryKey: d(n, t),
|
|
458
|
+
idleData: E
|
|
459
|
+
};
|
|
460
|
+
} catch (n) {
|
|
461
|
+
const r = p(n);
|
|
462
|
+
return {
|
|
463
|
+
error: r,
|
|
464
|
+
activeInputs: t,
|
|
465
|
+
queryKey: d(void 0, t, r),
|
|
466
|
+
idleData: E
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function p(e) {
|
|
419
471
|
return e instanceof Error ? e : new Error(String(e));
|
|
420
472
|
}
|
|
421
473
|
function v(e) {
|
|
422
|
-
const t =
|
|
474
|
+
const t = ee(e);
|
|
423
475
|
if (t.ok)
|
|
424
476
|
return null;
|
|
425
477
|
const n = t.errors.map(
|
|
@@ -427,7 +479,7 @@ function v(e) {
|
|
|
427
479
|
).join("; ");
|
|
428
480
|
return new Error(`Invalid Semaphor analytics intent. ${n}`);
|
|
429
481
|
}
|
|
430
|
-
function
|
|
482
|
+
function d(e, t, n, r) {
|
|
431
483
|
return JSON.stringify({
|
|
432
484
|
intent: e,
|
|
433
485
|
activeInputs: t,
|
|
@@ -435,20 +487,20 @@ function f(e, t, n, r) {
|
|
|
435
487
|
error: n == null ? void 0 : n.message
|
|
436
488
|
});
|
|
437
489
|
}
|
|
438
|
-
function
|
|
439
|
-
const [t, n] =
|
|
440
|
-
() =>
|
|
490
|
+
function Ve(e) {
|
|
491
|
+
const [t, n] = O(e.defaultValue), r = Object.prototype.hasOwnProperty.call(e, "value"), i = r ? e.value : t, u = m(
|
|
492
|
+
() => V(e.options),
|
|
441
493
|
[e.options]
|
|
442
|
-
), s =
|
|
494
|
+
), s = R(
|
|
443
495
|
(a) => {
|
|
444
496
|
var o;
|
|
445
497
|
const c = a;
|
|
446
498
|
(o = e.onValueChange) == null || o.call(e, c), r || n(c);
|
|
447
499
|
},
|
|
448
500
|
[r, e]
|
|
449
|
-
),
|
|
450
|
-
return
|
|
451
|
-
const a =
|
|
501
|
+
), f = R(() => s(void 0), [s]);
|
|
502
|
+
return m(() => {
|
|
503
|
+
const a = $(e);
|
|
452
504
|
return {
|
|
453
505
|
id: e.id,
|
|
454
506
|
kind: e.kind,
|
|
@@ -458,43 +510,43 @@ function Ce(e) {
|
|
|
458
510
|
controlRole: e.kind === "control" ? e.role : void 0,
|
|
459
511
|
value: i,
|
|
460
512
|
options: u,
|
|
461
|
-
isActive:
|
|
513
|
+
isActive: k(i),
|
|
462
514
|
setValue: s,
|
|
463
|
-
clear:
|
|
515
|
+
clear: f,
|
|
464
516
|
toAnalyticsInput: () => ({
|
|
465
517
|
inputId: a.inputId,
|
|
466
518
|
field: a.field,
|
|
467
519
|
kind: e.kind,
|
|
468
520
|
label: e.label,
|
|
469
521
|
value: i,
|
|
470
|
-
isActive:
|
|
522
|
+
isActive: k(i),
|
|
471
523
|
operator: a.operator,
|
|
472
524
|
controlRole: e.kind === "control" ? e.role : void 0
|
|
473
525
|
})
|
|
474
526
|
};
|
|
475
|
-
}, [
|
|
527
|
+
}, [f, u, s, e, i]);
|
|
476
528
|
}
|
|
477
|
-
function
|
|
478
|
-
const [t, n] =
|
|
479
|
-
return
|
|
529
|
+
function $e(e) {
|
|
530
|
+
const [t, n] = O(() => Ke(e));
|
|
531
|
+
return L(() => {
|
|
480
532
|
n((r) => {
|
|
481
533
|
let i = r;
|
|
482
534
|
for (const u of e)
|
|
483
535
|
!Object.prototype.hasOwnProperty.call(i, u.id) && u.defaultValue !== void 0 && (i = { ...i, [u.id]: u.defaultValue });
|
|
484
536
|
return i;
|
|
485
537
|
});
|
|
486
|
-
}, [e]),
|
|
538
|
+
}, [e]), m(
|
|
487
539
|
() => e.map((r) => {
|
|
488
540
|
const i = Object.prototype.hasOwnProperty.call(
|
|
489
541
|
r,
|
|
490
542
|
"value"
|
|
491
|
-
), u = i ? r.value : t[r.id], s =
|
|
543
|
+
), u = i ? r.value : t[r.id], s = V(r.options), f = (o) => {
|
|
492
544
|
var l;
|
|
493
|
-
(l = r.onValueChange) == null || l.call(r, o), i || n((
|
|
494
|
-
...
|
|
545
|
+
(l = r.onValueChange) == null || l.call(r, o), i || n((q) => ({
|
|
546
|
+
...q,
|
|
495
547
|
[r.id]: o
|
|
496
548
|
}));
|
|
497
|
-
}, a = () =>
|
|
549
|
+
}, a = () => f(void 0), c = $(r);
|
|
498
550
|
return {
|
|
499
551
|
id: r.id,
|
|
500
552
|
kind: r.kind,
|
|
@@ -504,8 +556,8 @@ function _e(e) {
|
|
|
504
556
|
controlRole: r.kind === "control" ? r.role : void 0,
|
|
505
557
|
value: u,
|
|
506
558
|
options: s,
|
|
507
|
-
isActive:
|
|
508
|
-
setValue:
|
|
559
|
+
isActive: k(u),
|
|
560
|
+
setValue: f,
|
|
509
561
|
clear: a,
|
|
510
562
|
toAnalyticsInput: () => ({
|
|
511
563
|
inputId: c.inputId,
|
|
@@ -513,7 +565,7 @@ function _e(e) {
|
|
|
513
565
|
kind: r.kind,
|
|
514
566
|
label: r.label,
|
|
515
567
|
value: u,
|
|
516
|
-
isActive:
|
|
568
|
+
isActive: k(u),
|
|
517
569
|
operator: c.operator,
|
|
518
570
|
controlRole: r.kind === "control" ? r.role : void 0
|
|
519
571
|
})
|
|
@@ -522,88 +574,99 @@ function _e(e) {
|
|
|
522
574
|
[e, t]
|
|
523
575
|
);
|
|
524
576
|
}
|
|
525
|
-
function
|
|
526
|
-
const n =
|
|
577
|
+
function Le(e, t = {}) {
|
|
578
|
+
const n = m(
|
|
527
579
|
() => t.inputs ? {
|
|
528
580
|
...e,
|
|
529
581
|
inputs: t.inputs
|
|
530
582
|
} : e,
|
|
531
583
|
[t.inputs, e]
|
|
532
|
-
), r =
|
|
584
|
+
), r = m(() => {
|
|
533
585
|
switch (n.queryKind) {
|
|
534
586
|
case "metric":
|
|
535
587
|
return {
|
|
536
588
|
queryKind: n.queryKind,
|
|
537
|
-
request:
|
|
589
|
+
request: ge(n)
|
|
538
590
|
};
|
|
539
591
|
case "analysis":
|
|
540
592
|
return {
|
|
541
593
|
queryKind: n.queryKind,
|
|
542
|
-
request:
|
|
594
|
+
request: Ae(n)
|
|
543
595
|
};
|
|
544
596
|
case "records":
|
|
545
597
|
return {
|
|
546
598
|
queryKind: n.queryKind,
|
|
547
|
-
request:
|
|
599
|
+
request: ke(n)
|
|
548
600
|
};
|
|
549
601
|
case "inputOptions":
|
|
550
602
|
return {
|
|
551
603
|
queryKind: n.queryKind,
|
|
552
|
-
request:
|
|
604
|
+
request: Ie(n)
|
|
553
605
|
};
|
|
554
606
|
case "sql":
|
|
555
607
|
return {
|
|
556
608
|
queryKind: n.queryKind,
|
|
557
|
-
request:
|
|
609
|
+
request: xe(n)
|
|
610
|
+
};
|
|
611
|
+
case "matrix":
|
|
612
|
+
return {
|
|
613
|
+
queryKind: n.queryKind,
|
|
614
|
+
request: De(n)
|
|
558
615
|
};
|
|
559
616
|
default:
|
|
560
|
-
return
|
|
617
|
+
return K(n);
|
|
561
618
|
}
|
|
562
|
-
}, [n]), i =
|
|
619
|
+
}, [n]), i = R(
|
|
563
620
|
(o) => {
|
|
564
|
-
var
|
|
621
|
+
var q, S, w, C, _, A, T, g, P;
|
|
565
622
|
const l = r.request;
|
|
566
623
|
if (l.intent)
|
|
567
624
|
switch (r.queryKind) {
|
|
568
625
|
case "metric":
|
|
569
|
-
return (
|
|
626
|
+
return (q = o.executor) == null ? void 0 : q.executeMetric(
|
|
570
627
|
l.intent,
|
|
571
628
|
o
|
|
572
629
|
);
|
|
573
630
|
case "analysis":
|
|
574
|
-
return (
|
|
575
|
-
|
|
631
|
+
return (w = (S = o.executor) == null ? void 0 : S.executeAnalysis) == null ? void 0 : w.call(
|
|
632
|
+
S,
|
|
576
633
|
l.intent,
|
|
577
634
|
o,
|
|
578
635
|
l.analysisOptions
|
|
579
636
|
);
|
|
580
637
|
case "records":
|
|
581
|
-
return (
|
|
638
|
+
return (C = o.executor) == null ? void 0 : C.executeRecords(
|
|
582
639
|
l.intent,
|
|
583
640
|
o
|
|
584
641
|
);
|
|
585
642
|
case "inputOptions":
|
|
586
|
-
return (
|
|
643
|
+
return (_ = o.executor) == null ? void 0 : _.executeInputOptions(
|
|
587
644
|
l.intent,
|
|
588
645
|
o
|
|
589
646
|
);
|
|
590
647
|
case "sql":
|
|
591
|
-
return (
|
|
592
|
-
|
|
648
|
+
return (T = (A = o.executor) == null ? void 0 : A.executeSql) == null ? void 0 : T.call(
|
|
649
|
+
A,
|
|
650
|
+
l.intent,
|
|
651
|
+
o
|
|
652
|
+
);
|
|
653
|
+
case "matrix":
|
|
654
|
+
return (P = (g = o.executor) == null ? void 0 : g.executeMatrix) == null ? void 0 : P.call(
|
|
655
|
+
g,
|
|
593
656
|
l.intent,
|
|
594
657
|
o
|
|
595
658
|
);
|
|
596
659
|
default:
|
|
597
|
-
return
|
|
660
|
+
return K(r);
|
|
598
661
|
}
|
|
599
662
|
},
|
|
600
663
|
[r]
|
|
601
|
-
), u =
|
|
664
|
+
), u = Ee(
|
|
602
665
|
r.request.queryKey,
|
|
603
666
|
i,
|
|
604
667
|
r.request.idleData,
|
|
605
668
|
r.request.activeInputs
|
|
606
|
-
), s = r.request.error ? r.request.idleData : u.data,
|
|
669
|
+
), s = r.request.error ? r.request.idleData : u.data, f = r.request.error ? "error" : u.status, a = !r.request.error && u.status === "loading", c = r.request.error || u.error;
|
|
607
670
|
switch (r.queryKind) {
|
|
608
671
|
case "metric": {
|
|
609
672
|
const o = s;
|
|
@@ -617,18 +680,18 @@ function Pe(e, t = {}) {
|
|
|
617
680
|
deltaPercent: o == null ? void 0 : o.deltaPercent,
|
|
618
681
|
records: o == null ? void 0 : o.records,
|
|
619
682
|
executionResult: o == null ? void 0 : o.executionResult,
|
|
620
|
-
status:
|
|
683
|
+
status: f,
|
|
621
684
|
isLoading: a,
|
|
622
685
|
error: c
|
|
623
686
|
};
|
|
624
687
|
}
|
|
625
688
|
case "analysis": {
|
|
626
|
-
const o =
|
|
689
|
+
const o = N(s);
|
|
627
690
|
return {
|
|
628
691
|
id: n.id,
|
|
629
692
|
intent: r.request.intent,
|
|
630
693
|
...o || {},
|
|
631
|
-
status:
|
|
694
|
+
status: f,
|
|
632
695
|
isLoading: a,
|
|
633
696
|
error: c
|
|
634
697
|
};
|
|
@@ -643,7 +706,7 @@ function Pe(e, t = {}) {
|
|
|
643
706
|
rowCount: o == null ? void 0 : o.rowCount,
|
|
644
707
|
pagination: o == null ? void 0 : o.pagination,
|
|
645
708
|
executionResult: o == null ? void 0 : o.executionResult,
|
|
646
|
-
status:
|
|
709
|
+
status: f,
|
|
647
710
|
isLoading: a,
|
|
648
711
|
error: c
|
|
649
712
|
};
|
|
@@ -655,7 +718,7 @@ function Pe(e, t = {}) {
|
|
|
655
718
|
intent: r.request.intent,
|
|
656
719
|
options: (o == null ? void 0 : o.options) || [],
|
|
657
720
|
executionResult: o == null ? void 0 : o.executionResult,
|
|
658
|
-
status:
|
|
721
|
+
status: f,
|
|
659
722
|
isLoading: a,
|
|
660
723
|
error: c
|
|
661
724
|
};
|
|
@@ -672,22 +735,36 @@ function Pe(e, t = {}) {
|
|
|
672
735
|
output: o == null ? void 0 : o.output,
|
|
673
736
|
rowLimitExceeded: o == null ? void 0 : o.rowLimitExceeded,
|
|
674
737
|
executionResult: o == null ? void 0 : o.executionResult,
|
|
675
|
-
status:
|
|
738
|
+
status: f,
|
|
739
|
+
isLoading: a,
|
|
740
|
+
error: c
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
case "matrix": {
|
|
744
|
+
const o = s;
|
|
745
|
+
return {
|
|
746
|
+
id: n.id,
|
|
747
|
+
intent: r.request.intent,
|
|
748
|
+
payload: o == null ? void 0 : o.payload,
|
|
749
|
+
grid: o == null ? void 0 : o.grid,
|
|
750
|
+
expansion: o == null ? void 0 : o.expansion,
|
|
751
|
+
executionResult: o == null ? void 0 : o.executionResult,
|
|
752
|
+
status: f,
|
|
676
753
|
isLoading: a,
|
|
677
754
|
error: c
|
|
678
755
|
};
|
|
679
756
|
}
|
|
680
757
|
default:
|
|
681
|
-
return
|
|
758
|
+
return K(r);
|
|
682
759
|
}
|
|
683
760
|
}
|
|
684
|
-
function
|
|
685
|
-
const i =
|
|
761
|
+
function Ee(e, t, n, r) {
|
|
762
|
+
const i = ye(), u = j(t), s = j(r), [f, a] = O({
|
|
686
763
|
status: "idle",
|
|
687
764
|
data: n,
|
|
688
765
|
error: null
|
|
689
766
|
});
|
|
690
|
-
return u.current = t, s.current = r,
|
|
767
|
+
return u.current = t, s.current = r, L(() => {
|
|
691
768
|
let c;
|
|
692
769
|
try {
|
|
693
770
|
c = u.current({
|
|
@@ -698,7 +775,7 @@ function ge(e, t, n, r) {
|
|
|
698
775
|
a({
|
|
699
776
|
status: "error",
|
|
700
777
|
data: n,
|
|
701
|
-
error:
|
|
778
|
+
error: p(l)
|
|
702
779
|
});
|
|
703
780
|
return;
|
|
704
781
|
}
|
|
@@ -717,47 +794,48 @@ function ge(e, t, n, r) {
|
|
|
717
794
|
o || a({
|
|
718
795
|
status: "error",
|
|
719
796
|
data: n,
|
|
720
|
-
error:
|
|
797
|
+
error: p(l)
|
|
721
798
|
});
|
|
722
799
|
}), () => {
|
|
723
800
|
o = !0;
|
|
724
801
|
};
|
|
725
|
-
}, [n, e, i]),
|
|
802
|
+
}, [n, e, i]), f;
|
|
726
803
|
}
|
|
727
|
-
function
|
|
804
|
+
function Ke(e) {
|
|
728
805
|
return Object.fromEntries(
|
|
729
806
|
e.filter((t) => t.defaultValue !== void 0).map((t) => [t.id, t.defaultValue])
|
|
730
807
|
);
|
|
731
808
|
}
|
|
732
|
-
function
|
|
809
|
+
function K(e) {
|
|
733
810
|
throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
|
|
734
811
|
}
|
|
735
812
|
export {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
M as
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
813
|
+
z as SemaphorDataAppContext,
|
|
814
|
+
je as SemaphorDataAppProvider,
|
|
815
|
+
de as createSemaphorQueryExecutor,
|
|
816
|
+
_e as defineSemaphorDataApp,
|
|
817
|
+
Te as defineSemaphorInput,
|
|
818
|
+
k as hasSemaphorInputValue,
|
|
819
|
+
N as normalizeSemaphorAnalysisPayload,
|
|
820
|
+
ze as normalizeSemaphorAnalysisQueryOptions,
|
|
821
|
+
V as normalizeSemaphorInputOptions,
|
|
822
|
+
ve as readWindowRuntime,
|
|
823
|
+
Pe as semaphor,
|
|
824
|
+
y as toSemaphorActiveInputSnapshots,
|
|
825
|
+
F as toSemaphorAnalysisIntent,
|
|
826
|
+
Y as toSemaphorAnalysisQueryOptions,
|
|
827
|
+
Me as toSemaphorInputBinding,
|
|
828
|
+
Be as toSemaphorInputBindings,
|
|
829
|
+
Q as toSemaphorInputOptionsIntent,
|
|
830
|
+
Qe as toSemaphorInputSnapshots,
|
|
831
|
+
$ as toSemaphorInputSpec,
|
|
832
|
+
M as toSemaphorMatrixIntent,
|
|
833
|
+
H as toSemaphorMetricIntent,
|
|
834
|
+
J as toSemaphorRecordsIntent,
|
|
835
|
+
B as toSemaphorSqlIntent,
|
|
836
|
+
ye as useSemaphorDataAppRuntime,
|
|
837
|
+
Ve as useSemaphorInput,
|
|
838
|
+
$e as useSemaphorInputs,
|
|
839
|
+
Le as useSemaphorQuery,
|
|
840
|
+
Je as validateSemaphorDataAppQuerySpecs
|
|
763
841
|
};
|