react-semaphor 0.1.359 → 0.1.360
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/chunks/{calendar-preferences-dialog-BeZvsJV0.js → calendar-preferences-dialog-BEKBpwMY.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BHq3bPkF.js → calendar-preferences-dialog-GwtaSN53.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-gm3YPxOh.js → dashboard-briefing-launcher-D6gGO5wz.js} +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-Dr6trdJw.js → dashboard-briefing-launcher-DYxd4856.js} +1 -1
- package/dist/chunks/{dashboard-controls-BZljC-GB.js → dashboard-controls-B4u5RsKl.js} +3 -3
- package/dist/chunks/{dashboard-controls-4a3fKtuD.js → dashboard-controls-C_rExqPw.js} +1 -1
- package/dist/chunks/{dashboard-json-wTRw_VIn.js → dashboard-json-BWWU6a7V.js} +1 -1
- package/dist/chunks/{dashboard-json-4uDp0D6Y.js → dashboard-json-CPGTofhm.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CqnMxF8h.js → edit-dashboard-visual-D_jZ-iix.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BztJSdkR.js → edit-dashboard-visual-biMO829J.js} +3 -3
- package/dist/chunks/{index-DZ3lq1Pk.js → index-CJ2IEuKz.js} +31368 -31127
- package/dist/chunks/index-Db1XVmfU.js +1411 -0
- package/dist/chunks/{resource-management-panel-CEVKKwSW.js → resource-management-panel-B9-5VHYe.js} +2 -2
- package/dist/chunks/{resource-management-panel-BajPY5IU.js → resource-management-panel-Bam-yvnt.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CT1BlsPJ.js → use-create-flow-overlay-state-DAvEqaJV.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-D010FtSh.js → use-create-flow-overlay-state-dhxgdLYo.js} +1 -1
- package/dist/chunks/{use-visual-utils-CIHFvxpt.js → use-visual-utils-CAKdXsr5.js} +1 -1
- package/dist/chunks/{use-visual-utils-H2FXMsGo.js → use-visual-utils-FoHNPwpu.js} +1 -1
- package/dist/chunks/validation-C_WDLZdp.js +1 -0
- package/dist/chunks/validation-McK0uXpV.js +669 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/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 +308 -440
- package/dist/data-app-sdk-validation/index.cjs +1 -0
- package/dist/data-app-sdk-validation/index.js +7 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/data-app-builder.d.ts +68 -9
- package/dist/types/data-app-sdk-validation.d.ts +595 -0
- package/dist/types/data-app-sdk.d.ts +333 -0
- package/package.json +6 -1
- package/dist/chunks/index-YZnHD2NF.js +0 -1410
|
@@ -1,563 +1,431 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const e = z(t);
|
|
1
|
+
import { t as x, a as g, b as O, c as K, d as T, e as $, n as _, f as b, h as E } from "../chunks/validation-McK0uXpV.js";
|
|
2
|
+
import { k as dt, g as pt, i as yt, j as ft, v as mt } from "../chunks/validation-McK0uXpV.js";
|
|
3
|
+
import { j as P } from "../chunks/index-CuHybtft.js";
|
|
4
|
+
import { createContext as U, useContext as w, useMemo as d, useState as k, useCallback as f, useRef as q, useEffect as C } from "react";
|
|
5
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
6
|
+
import { v as L } from "../chunks/validators-BnLhuIhd.js";
|
|
7
|
+
function M() {
|
|
9
8
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
source: k(t),
|
|
15
|
-
metrics: e,
|
|
16
|
-
primaryMetric: F(t, e),
|
|
17
|
-
dateField: t.dateField ? s(t.dateField, "date") : void 0,
|
|
18
|
-
timeGrain: t.timeGrain,
|
|
19
|
-
dimensions: (r = t.dimensions) == null ? void 0 : r.map((n) => s(n, "dimension")),
|
|
20
|
-
comparison: et(t.comparison),
|
|
21
|
-
orderBy: t.orderBy ? {
|
|
22
|
-
field: s(t.orderBy.field),
|
|
23
|
-
direction: t.orderBy.direction
|
|
24
|
-
} : void 0,
|
|
25
|
-
inputs: D(t.inputs),
|
|
26
|
-
limit: t.limit
|
|
9
|
+
executeAnalysis: (e, t, o) => h(e, t, o ?? {}),
|
|
10
|
+
executeMetric: (e, t) => h(e, t),
|
|
11
|
+
executeRecords: (e, t) => h(e, t),
|
|
12
|
+
executeInputOptions: (e, t) => h(e, t)
|
|
27
13
|
};
|
|
28
14
|
}
|
|
29
|
-
function
|
|
30
|
-
if (!t.
|
|
31
|
-
return e[0] || { name: "", role: "measure" };
|
|
32
|
-
const r = s(t.primaryMetric, "measure"), n = L(r, e), o = n.length === 1 ? n[0] : void 0;
|
|
33
|
-
return o ? w(r, o) : r;
|
|
34
|
-
}
|
|
35
|
-
function z(t) {
|
|
36
|
-
const e = [];
|
|
37
|
-
for (const r of t.metrics.map((n) => s(n, "measure"))) {
|
|
38
|
-
if (!r.name)
|
|
39
|
-
continue;
|
|
40
|
-
const n = e.findIndex(
|
|
41
|
-
(o) => V(o, r)
|
|
42
|
-
);
|
|
43
|
-
if (n === -1) {
|
|
44
|
-
e.push(r);
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
e[n] = w(e[n], r);
|
|
48
|
-
}
|
|
49
|
-
return e;
|
|
50
|
-
}
|
|
51
|
-
function V(t, e) {
|
|
52
|
-
return x(t, e) && g(t) === g(e);
|
|
53
|
-
}
|
|
54
|
-
function j(t, e) {
|
|
55
|
-
return g(e) === g(t);
|
|
56
|
-
}
|
|
57
|
-
function N(t, e) {
|
|
58
|
-
return e.name !== t.name || t.source && !x(e, t) ? !1 : j(t, e);
|
|
59
|
-
}
|
|
60
|
-
function L(t, e) {
|
|
61
|
-
const r = e.filter(
|
|
62
|
-
(n) => N(t, n)
|
|
63
|
-
);
|
|
64
|
-
return t.aggregate !== void 0, r;
|
|
65
|
-
}
|
|
66
|
-
function g(t) {
|
|
67
|
-
return (t.aggregate || "SUM").toUpperCase();
|
|
68
|
-
}
|
|
69
|
-
function w(t, e) {
|
|
70
|
-
if (t.aggregate && e.aggregate && t.aggregate !== e.aggregate)
|
|
71
|
-
throw new Error(
|
|
72
|
-
`Metric "${t.name}" was requested with conflicting aggregate semantics: ${t.aggregate} and ${e.aggregate}.`
|
|
73
|
-
);
|
|
74
|
-
return {
|
|
75
|
-
...O(t, e),
|
|
76
|
-
aggregate: t.aggregate || e.aggregate
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function Q(t) {
|
|
80
|
-
if ("sort" in t)
|
|
81
|
-
throw new Error(
|
|
82
|
-
"useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
|
|
83
|
-
);
|
|
84
|
-
if (!tt(t))
|
|
85
|
-
throw new Error(
|
|
86
|
-
"useSemaphorRecords needs at least one field."
|
|
87
|
-
);
|
|
88
|
-
const e = G(t.fields);
|
|
89
|
-
return {
|
|
90
|
-
version: 1,
|
|
91
|
-
kind: "records",
|
|
92
|
-
id: t.id,
|
|
93
|
-
label: t.label,
|
|
94
|
-
source: k(t),
|
|
95
|
-
fields: e,
|
|
96
|
-
dateField: t.dateField ? s(t.dateField, "date") : void 0,
|
|
97
|
-
timeGrain: t.timeGrain,
|
|
98
|
-
orderBy: t.orderBy ? {
|
|
99
|
-
field: s(t.orderBy.field),
|
|
100
|
-
direction: t.orderBy.direction
|
|
101
|
-
} : void 0,
|
|
102
|
-
inputs: D(t.inputs),
|
|
103
|
-
limit: t.limit
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function G(t) {
|
|
107
|
-
return t.map((e) => {
|
|
108
|
-
const r = s(e);
|
|
109
|
-
if (!r.role)
|
|
110
|
-
throw new Error(
|
|
111
|
-
`useSemaphorRecords field "${r.name}" needs an explicit role.`
|
|
112
|
-
);
|
|
113
|
-
return r;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function J(t) {
|
|
117
|
-
return {
|
|
118
|
-
version: 1,
|
|
119
|
-
kind: "inputOptions",
|
|
120
|
-
id: t.id,
|
|
121
|
-
label: t.label,
|
|
122
|
-
source: k(t),
|
|
123
|
-
field: s(t.field, "dimension"),
|
|
124
|
-
search: t.search,
|
|
125
|
-
limit: t.limit
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
function H(t) {
|
|
129
|
-
if ("toAnalyticsInput" in t) {
|
|
130
|
-
const e = t.toAnalyticsInput();
|
|
131
|
-
return {
|
|
132
|
-
inputId: e.inputId,
|
|
133
|
-
...e.field ? { field: e.field } : {}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
inputId: t.inputId,
|
|
138
|
-
...t.field ? { field: t.field } : {}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function vt(t) {
|
|
142
|
-
const e = D(t);
|
|
143
|
-
return e.length > 0 ? e : void 0;
|
|
144
|
-
}
|
|
145
|
-
function W(t) {
|
|
146
|
-
return (t || []).map(Z);
|
|
147
|
-
}
|
|
148
|
-
function B(t) {
|
|
149
|
-
return W(t).filter((e) => e.isActive);
|
|
150
|
-
}
|
|
151
|
-
function X(t) {
|
|
152
|
-
return t.kind === "filter" ? {
|
|
153
|
-
inputId: t.id,
|
|
154
|
-
kind: t.kind,
|
|
155
|
-
label: t.label,
|
|
156
|
-
field: s(t.field, "dimension"),
|
|
157
|
-
operator: t.operator || "in"
|
|
158
|
-
} : {
|
|
159
|
-
inputId: t.id,
|
|
160
|
-
kind: t.kind,
|
|
161
|
-
label: t.label
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function Y(t = []) {
|
|
165
|
-
return t.map(
|
|
166
|
-
(e) => typeof e == "object" ? e : {
|
|
167
|
-
label: String(e),
|
|
168
|
-
value: e
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
function A(t) {
|
|
173
|
-
return t == null ? !1 : Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.trim().length > 0 : !0;
|
|
174
|
-
}
|
|
175
|
-
function Z(t) {
|
|
176
|
-
return "toAnalyticsInput" in t ? t.toAnalyticsInput() : "kind" in t && "isActive" in t ? t : {
|
|
177
|
-
...t,
|
|
178
|
-
kind: "filter",
|
|
179
|
-
isActive: A(
|
|
180
|
-
t.value
|
|
181
|
-
),
|
|
182
|
-
value: t.value
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
function k(t) {
|
|
186
|
-
return t.source;
|
|
187
|
-
}
|
|
188
|
-
function tt(t) {
|
|
189
|
-
var e;
|
|
190
|
-
return !!((e = t.fields) != null && e.length);
|
|
191
|
-
}
|
|
192
|
-
function s(t, e) {
|
|
193
|
-
return {
|
|
194
|
-
...t,
|
|
195
|
-
role: t.role || e
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function D(t) {
|
|
199
|
-
return (t || []).map(H);
|
|
200
|
-
}
|
|
201
|
-
function et(t) {
|
|
202
|
-
if (t)
|
|
203
|
-
return t;
|
|
204
|
-
}
|
|
205
|
-
function rt() {
|
|
206
|
-
return {
|
|
207
|
-
executeMetric: (t, e) => v(t, e),
|
|
208
|
-
executeRecords: (t, e) => v(t, e),
|
|
209
|
-
executeInputOptions: (t, e) => v(t, e)
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
async function v(t, e) {
|
|
213
|
-
if (!e.token)
|
|
15
|
+
async function h(e, t, o) {
|
|
16
|
+
if (!t.token)
|
|
214
17
|
throw new Error("SemaphorDataAppProvider needs a token to execute queries.");
|
|
215
|
-
const
|
|
18
|
+
const n = await fetch(Q(t), {
|
|
216
19
|
method: "POST",
|
|
217
20
|
headers: {
|
|
218
21
|
"Content-Type": "application/json",
|
|
219
|
-
Authorization: `Bearer ${
|
|
22
|
+
Authorization: `Bearer ${t.token}`
|
|
220
23
|
},
|
|
221
24
|
body: JSON.stringify({
|
|
222
|
-
intent:
|
|
223
|
-
activeInputs:
|
|
224
|
-
|
|
25
|
+
intent: e,
|
|
26
|
+
activeInputs: t.activeInputs,
|
|
27
|
+
...o ? { analysisOptions: o } : {},
|
|
28
|
+
resultShape: e.kind
|
|
225
29
|
})
|
|
226
|
-
}),
|
|
227
|
-
if (!
|
|
30
|
+
}), r = await V(n);
|
|
31
|
+
if (!n.ok || r.error)
|
|
228
32
|
throw new Error(
|
|
229
|
-
|
|
33
|
+
r.error || `Semaphor Data App execution failed with status ${n.status}.`
|
|
230
34
|
);
|
|
231
|
-
return
|
|
35
|
+
return r;
|
|
232
36
|
}
|
|
233
|
-
async function
|
|
234
|
-
const
|
|
235
|
-
if (!
|
|
236
|
-
return
|
|
37
|
+
async function V(e) {
|
|
38
|
+
const t = await e.text().catch(() => "");
|
|
39
|
+
if (!t.trim())
|
|
40
|
+
return e.ok ? {
|
|
237
41
|
error: "Semaphor Data App execution returned an empty response."
|
|
238
42
|
} : {};
|
|
239
43
|
try {
|
|
240
|
-
return JSON.parse(
|
|
44
|
+
return JSON.parse(t);
|
|
241
45
|
} catch {
|
|
242
|
-
return
|
|
46
|
+
return e.ok ? {
|
|
243
47
|
error: "Semaphor Data App execution returned invalid JSON.",
|
|
244
|
-
details:
|
|
48
|
+
details: t
|
|
245
49
|
} : {
|
|
246
|
-
error:
|
|
247
|
-
details:
|
|
50
|
+
error: N(e, t),
|
|
51
|
+
details: t
|
|
248
52
|
};
|
|
249
53
|
}
|
|
250
54
|
}
|
|
251
|
-
function
|
|
252
|
-
const
|
|
253
|
-
return n ? `Semaphor Data App execution failed with status ${
|
|
55
|
+
function N(e, t) {
|
|
56
|
+
const o = e.statusText ? ` ${e.statusText}` : "", n = t.replace(/\s+/g, " ").trim();
|
|
57
|
+
return n ? `Semaphor Data App execution failed with status ${e.status}${o}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${o}.`;
|
|
254
58
|
}
|
|
255
|
-
function
|
|
256
|
-
const
|
|
257
|
-
return
|
|
59
|
+
function Q(e) {
|
|
60
|
+
const t = j(e).replace(/\/+$/, "");
|
|
61
|
+
return t ? t.endsWith("/api") ? `${t}/v1/data-app/execute` : `${t}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
|
|
258
62
|
}
|
|
259
|
-
function
|
|
260
|
-
if (
|
|
261
|
-
return
|
|
262
|
-
if (!
|
|
63
|
+
function j(e) {
|
|
64
|
+
if (e.apiBaseUrl)
|
|
65
|
+
return e.apiBaseUrl;
|
|
66
|
+
if (!e.token)
|
|
263
67
|
return "";
|
|
264
68
|
try {
|
|
265
|
-
return
|
|
69
|
+
return P(e.token).apiServiceUrl || "";
|
|
266
70
|
} catch {
|
|
267
71
|
return "";
|
|
268
72
|
}
|
|
269
73
|
}
|
|
270
|
-
const
|
|
271
|
-
function
|
|
74
|
+
const R = U({});
|
|
75
|
+
function z() {
|
|
272
76
|
if (!(typeof window > "u"))
|
|
273
77
|
return window.__SEMAPHOR_DATA_APP_RUNTIME__;
|
|
274
78
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
79
|
+
function J() {
|
|
80
|
+
return w(R);
|
|
277
81
|
}
|
|
278
|
-
function
|
|
279
|
-
token:
|
|
280
|
-
apiBaseUrl:
|
|
281
|
-
executor:
|
|
82
|
+
function nt({
|
|
83
|
+
token: e,
|
|
84
|
+
apiBaseUrl: t,
|
|
85
|
+
executor: o,
|
|
282
86
|
children: n
|
|
283
87
|
}) {
|
|
284
|
-
var
|
|
285
|
-
const
|
|
88
|
+
var c;
|
|
89
|
+
const r = z(), i = ((c = r == null ? void 0 : r.authToken) == null ? void 0 : c.accessToken) || e, a = (r == null ? void 0 : r.dataApiBaseUrl) || (r == null ? void 0 : r.apiBaseUrl) || t, y = d(() => M(), []), u = o || y, l = d(
|
|
286
90
|
() => ({
|
|
287
|
-
token:
|
|
288
|
-
apiBaseUrl:
|
|
91
|
+
token: i,
|
|
92
|
+
apiBaseUrl: a,
|
|
289
93
|
executor: u
|
|
290
94
|
}),
|
|
291
|
-
[
|
|
95
|
+
[a, u, i]
|
|
292
96
|
);
|
|
293
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ B(R.Provider, { value: l, children: n });
|
|
98
|
+
}
|
|
99
|
+
const A = { value: null }, I = {}, H = { records: [] }, D = { options: [] };
|
|
100
|
+
function W(e) {
|
|
101
|
+
const t = x(e.inputs), o = g(e);
|
|
102
|
+
try {
|
|
103
|
+
const n = O(e), r = v(n);
|
|
104
|
+
return r ? {
|
|
105
|
+
error: r,
|
|
106
|
+
activeInputs: t,
|
|
107
|
+
analysisOptions: o,
|
|
108
|
+
queryKey: s(void 0, t, r, o),
|
|
109
|
+
idleData: I
|
|
110
|
+
} : {
|
|
111
|
+
intent: n,
|
|
112
|
+
error: null,
|
|
113
|
+
activeInputs: t,
|
|
114
|
+
analysisOptions: o,
|
|
115
|
+
queryKey: s(n, t, void 0, o),
|
|
116
|
+
idleData: I
|
|
117
|
+
};
|
|
118
|
+
} catch (n) {
|
|
119
|
+
const r = m(n);
|
|
120
|
+
return {
|
|
121
|
+
error: r,
|
|
122
|
+
activeInputs: t,
|
|
123
|
+
analysisOptions: o,
|
|
124
|
+
queryKey: s(void 0, t, r, o),
|
|
125
|
+
idleData: I
|
|
126
|
+
};
|
|
127
|
+
}
|
|
294
128
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const e = B(t.inputs);
|
|
129
|
+
function Y(e) {
|
|
130
|
+
const t = x(e.inputs);
|
|
298
131
|
try {
|
|
299
|
-
const
|
|
132
|
+
const o = K(e), n = v(o);
|
|
300
133
|
return n ? {
|
|
301
134
|
error: n,
|
|
302
|
-
activeInputs:
|
|
303
|
-
queryKey:
|
|
304
|
-
idleData:
|
|
135
|
+
activeInputs: t,
|
|
136
|
+
queryKey: s(void 0, t, n),
|
|
137
|
+
idleData: A
|
|
305
138
|
} : {
|
|
306
|
-
intent:
|
|
139
|
+
intent: o,
|
|
307
140
|
error: null,
|
|
308
|
-
activeInputs:
|
|
309
|
-
queryKey:
|
|
310
|
-
idleData:
|
|
141
|
+
activeInputs: t,
|
|
142
|
+
queryKey: s(o, t),
|
|
143
|
+
idleData: A
|
|
311
144
|
};
|
|
312
|
-
} catch (
|
|
313
|
-
const n =
|
|
145
|
+
} catch (o) {
|
|
146
|
+
const n = m(o);
|
|
314
147
|
return {
|
|
315
148
|
error: n,
|
|
316
|
-
activeInputs:
|
|
317
|
-
queryKey:
|
|
318
|
-
idleData:
|
|
149
|
+
activeInputs: t,
|
|
150
|
+
queryKey: s(void 0, t, n),
|
|
151
|
+
idleData: A
|
|
319
152
|
};
|
|
320
153
|
}
|
|
321
154
|
}
|
|
322
|
-
function
|
|
323
|
-
const
|
|
155
|
+
function F(e) {
|
|
156
|
+
const t = x(e.inputs), o = H;
|
|
324
157
|
try {
|
|
325
|
-
const n =
|
|
326
|
-
return
|
|
327
|
-
error:
|
|
328
|
-
activeInputs:
|
|
329
|
-
queryKey:
|
|
330
|
-
idleData:
|
|
158
|
+
const n = T(e), r = v(n);
|
|
159
|
+
return r ? {
|
|
160
|
+
error: r,
|
|
161
|
+
activeInputs: t,
|
|
162
|
+
queryKey: s(void 0, t, r),
|
|
163
|
+
idleData: o
|
|
331
164
|
} : {
|
|
332
165
|
intent: n,
|
|
333
166
|
error: null,
|
|
334
|
-
activeInputs:
|
|
335
|
-
queryKey:
|
|
336
|
-
idleData:
|
|
167
|
+
activeInputs: t,
|
|
168
|
+
queryKey: s(n, t),
|
|
169
|
+
idleData: o
|
|
337
170
|
};
|
|
338
171
|
} catch (n) {
|
|
339
|
-
const
|
|
172
|
+
const r = m(n);
|
|
340
173
|
return {
|
|
341
|
-
error:
|
|
342
|
-
activeInputs:
|
|
343
|
-
queryKey:
|
|
344
|
-
idleData:
|
|
174
|
+
error: r,
|
|
175
|
+
activeInputs: t,
|
|
176
|
+
queryKey: s(void 0, t, r),
|
|
177
|
+
idleData: o
|
|
345
178
|
};
|
|
346
179
|
}
|
|
347
180
|
}
|
|
348
|
-
function
|
|
181
|
+
function G(e) {
|
|
349
182
|
try {
|
|
350
|
-
const
|
|
351
|
-
return
|
|
352
|
-
error:
|
|
353
|
-
queryKey:
|
|
354
|
-
idleData:
|
|
183
|
+
const t = $(e), o = v(t);
|
|
184
|
+
return o ? {
|
|
185
|
+
error: o,
|
|
186
|
+
queryKey: s(void 0, void 0, o),
|
|
187
|
+
idleData: D
|
|
355
188
|
} : {
|
|
356
|
-
intent:
|
|
189
|
+
intent: t,
|
|
357
190
|
error: null,
|
|
358
|
-
queryKey:
|
|
359
|
-
idleData:
|
|
191
|
+
queryKey: s(t),
|
|
192
|
+
idleData: D
|
|
360
193
|
};
|
|
361
|
-
} catch (
|
|
362
|
-
const
|
|
194
|
+
} catch (t) {
|
|
195
|
+
const o = m(t);
|
|
363
196
|
return {
|
|
364
|
-
error:
|
|
365
|
-
queryKey:
|
|
366
|
-
idleData:
|
|
197
|
+
error: o,
|
|
198
|
+
queryKey: s(void 0, void 0, o),
|
|
199
|
+
idleData: D
|
|
367
200
|
};
|
|
368
201
|
}
|
|
369
202
|
}
|
|
370
|
-
function
|
|
371
|
-
return
|
|
203
|
+
function m(e) {
|
|
204
|
+
return e instanceof Error ? e : new Error(String(e));
|
|
372
205
|
}
|
|
373
|
-
function
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
206
|
+
function v(e) {
|
|
207
|
+
const t = L(e);
|
|
208
|
+
if (t.ok)
|
|
376
209
|
return null;
|
|
377
|
-
const
|
|
210
|
+
const o = t.errors.map(
|
|
378
211
|
(n) => n.path ? `${n.code} at ${n.path}: ${n.message}` : `${n.code}: ${n.message}`
|
|
379
212
|
).join("; ");
|
|
380
|
-
return new Error(`Invalid Semaphor analytics intent. ${
|
|
213
|
+
return new Error(`Invalid Semaphor analytics intent. ${o}`);
|
|
381
214
|
}
|
|
382
|
-
function
|
|
215
|
+
function s(e, t, o, n) {
|
|
383
216
|
return JSON.stringify({
|
|
384
|
-
intent:
|
|
385
|
-
activeInputs:
|
|
386
|
-
|
|
217
|
+
intent: e,
|
|
218
|
+
activeInputs: t,
|
|
219
|
+
analysisOptions: n,
|
|
220
|
+
error: o == null ? void 0 : o.message
|
|
387
221
|
});
|
|
388
222
|
}
|
|
389
|
-
function
|
|
390
|
-
const [
|
|
391
|
-
() =>
|
|
392
|
-
[
|
|
393
|
-
),
|
|
223
|
+
function ot(e) {
|
|
224
|
+
const [t, o] = k(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), r = n ? e.value : t, i = d(
|
|
225
|
+
() => _(e.options),
|
|
226
|
+
[e.options]
|
|
227
|
+
), a = f(
|
|
394
228
|
(u) => {
|
|
395
|
-
var
|
|
396
|
-
const
|
|
397
|
-
(
|
|
229
|
+
var c;
|
|
230
|
+
const l = u;
|
|
231
|
+
(c = e.onValueChange) == null || c.call(e, l), n || o(l);
|
|
398
232
|
},
|
|
399
|
-
[n,
|
|
400
|
-
),
|
|
401
|
-
return
|
|
402
|
-
const u =
|
|
233
|
+
[n, e]
|
|
234
|
+
), y = f(() => a(void 0), [a]);
|
|
235
|
+
return d(() => {
|
|
236
|
+
const u = b(e);
|
|
403
237
|
return {
|
|
404
|
-
id:
|
|
405
|
-
kind:
|
|
406
|
-
label:
|
|
238
|
+
id: e.id,
|
|
239
|
+
kind: e.kind,
|
|
240
|
+
label: e.label,
|
|
407
241
|
field: u.field,
|
|
408
242
|
operator: u.operator,
|
|
409
|
-
controlRole:
|
|
410
|
-
value:
|
|
411
|
-
options:
|
|
412
|
-
isActive:
|
|
413
|
-
setValue:
|
|
414
|
-
clear:
|
|
243
|
+
controlRole: e.kind === "control" ? e.role : void 0,
|
|
244
|
+
value: r,
|
|
245
|
+
options: i,
|
|
246
|
+
isActive: E(r),
|
|
247
|
+
setValue: a,
|
|
248
|
+
clear: y,
|
|
415
249
|
toAnalyticsInput: () => ({
|
|
416
250
|
inputId: u.inputId,
|
|
417
251
|
field: u.field,
|
|
418
|
-
kind:
|
|
419
|
-
label:
|
|
420
|
-
value:
|
|
421
|
-
isActive:
|
|
252
|
+
kind: e.kind,
|
|
253
|
+
label: e.label,
|
|
254
|
+
value: r,
|
|
255
|
+
isActive: E(r),
|
|
422
256
|
operator: u.operator,
|
|
423
|
-
controlRole:
|
|
257
|
+
controlRole: e.kind === "control" ? e.role : void 0
|
|
424
258
|
})
|
|
425
259
|
};
|
|
426
|
-
}, [
|
|
260
|
+
}, [y, i, a, e, r]);
|
|
261
|
+
}
|
|
262
|
+
function at(e) {
|
|
263
|
+
const t = d(() => W(e), [e]), o = f(
|
|
264
|
+
(i) => {
|
|
265
|
+
var a;
|
|
266
|
+
return t.intent ? (a = i.executor) == null ? void 0 : a.executeAnalysis(
|
|
267
|
+
t.intent,
|
|
268
|
+
i,
|
|
269
|
+
t.analysisOptions
|
|
270
|
+
) : void 0;
|
|
271
|
+
},
|
|
272
|
+
[t.analysisOptions, t.intent]
|
|
273
|
+
), n = S(
|
|
274
|
+
t.queryKey,
|
|
275
|
+
o,
|
|
276
|
+
t.idleData,
|
|
277
|
+
t.activeInputs
|
|
278
|
+
), r = t.error ? t.idleData : n.data;
|
|
279
|
+
return {
|
|
280
|
+
id: e.id,
|
|
281
|
+
intent: t.intent,
|
|
282
|
+
...r || {},
|
|
283
|
+
status: t.error ? "error" : n.status,
|
|
284
|
+
isLoading: !t.error && n.status === "loading",
|
|
285
|
+
error: t.error || n.error
|
|
286
|
+
};
|
|
427
287
|
}
|
|
428
|
-
function
|
|
429
|
-
const
|
|
430
|
-
(
|
|
431
|
-
var
|
|
432
|
-
return
|
|
288
|
+
function it(e) {
|
|
289
|
+
const t = d(() => Y(e), [e]), o = f(
|
|
290
|
+
(i) => {
|
|
291
|
+
var a;
|
|
292
|
+
return t.intent ? (a = i.executor) == null ? void 0 : a.executeMetric(t.intent, i) : void 0;
|
|
433
293
|
},
|
|
434
|
-
[
|
|
435
|
-
), n =
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
),
|
|
294
|
+
[t.intent]
|
|
295
|
+
), n = S(
|
|
296
|
+
t.queryKey,
|
|
297
|
+
o,
|
|
298
|
+
t.idleData,
|
|
299
|
+
t.activeInputs
|
|
300
|
+
), r = t.error ? t.idleData : n.data;
|
|
441
301
|
return {
|
|
442
|
-
id:
|
|
443
|
-
intent:
|
|
444
|
-
value: (
|
|
445
|
-
metrics:
|
|
446
|
-
comparisonValue:
|
|
447
|
-
delta:
|
|
448
|
-
deltaPercent:
|
|
449
|
-
records:
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
302
|
+
id: e.id,
|
|
303
|
+
intent: t.intent,
|
|
304
|
+
value: (r == null ? void 0 : r.value) ?? null,
|
|
305
|
+
metrics: r == null ? void 0 : r.metrics,
|
|
306
|
+
comparisonValue: r == null ? void 0 : r.comparisonValue,
|
|
307
|
+
delta: r == null ? void 0 : r.delta,
|
|
308
|
+
deltaPercent: r == null ? void 0 : r.deltaPercent,
|
|
309
|
+
records: r == null ? void 0 : r.records,
|
|
310
|
+
executionResult: r == null ? void 0 : r.executionResult,
|
|
311
|
+
status: t.error ? "error" : n.status,
|
|
312
|
+
isLoading: !t.error && n.status === "loading",
|
|
313
|
+
error: t.error || n.error
|
|
453
314
|
};
|
|
454
315
|
}
|
|
455
|
-
function
|
|
456
|
-
const
|
|
457
|
-
(
|
|
458
|
-
var
|
|
459
|
-
return
|
|
316
|
+
function ut(e) {
|
|
317
|
+
const t = d(() => F(e), [e]), o = f(
|
|
318
|
+
(i) => {
|
|
319
|
+
var a;
|
|
320
|
+
return t.intent ? (a = i.executor) == null ? void 0 : a.executeRecords(t.intent, i) : void 0;
|
|
460
321
|
},
|
|
461
|
-
[
|
|
462
|
-
), n =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
),
|
|
322
|
+
[t.intent]
|
|
323
|
+
), n = S(
|
|
324
|
+
t.queryKey,
|
|
325
|
+
o,
|
|
326
|
+
t.idleData,
|
|
327
|
+
t.activeInputs
|
|
328
|
+
), r = t.error ? t.idleData : n.data;
|
|
468
329
|
return {
|
|
469
|
-
id:
|
|
470
|
-
intent:
|
|
471
|
-
records: (
|
|
472
|
-
columns:
|
|
473
|
-
rowCount:
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
330
|
+
id: e.id,
|
|
331
|
+
intent: t.intent,
|
|
332
|
+
records: (r == null ? void 0 : r.records) || [],
|
|
333
|
+
columns: r == null ? void 0 : r.columns,
|
|
334
|
+
rowCount: r == null ? void 0 : r.rowCount,
|
|
335
|
+
executionResult: r == null ? void 0 : r.executionResult,
|
|
336
|
+
status: t.error ? "error" : n.status,
|
|
337
|
+
isLoading: !t.error && n.status === "loading",
|
|
338
|
+
error: t.error || n.error
|
|
477
339
|
};
|
|
478
340
|
}
|
|
479
|
-
function
|
|
480
|
-
const
|
|
481
|
-
(
|
|
482
|
-
var
|
|
483
|
-
return
|
|
341
|
+
function st(e) {
|
|
342
|
+
const t = d(() => G(e), [e]), o = f(
|
|
343
|
+
(i) => {
|
|
344
|
+
var a;
|
|
345
|
+
return t.intent ? (a = i.executor) == null ? void 0 : a.executeInputOptions(t.intent, i) : void 0;
|
|
484
346
|
},
|
|
485
|
-
[
|
|
486
|
-
), n =
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
),
|
|
347
|
+
[t.intent]
|
|
348
|
+
), n = S(
|
|
349
|
+
t.queryKey,
|
|
350
|
+
o,
|
|
351
|
+
t.idleData
|
|
352
|
+
), r = t.error ? t.idleData : n.data;
|
|
491
353
|
return {
|
|
492
|
-
id:
|
|
493
|
-
intent:
|
|
494
|
-
options: (
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
354
|
+
id: e.id,
|
|
355
|
+
intent: t.intent,
|
|
356
|
+
options: (r == null ? void 0 : r.options) || [],
|
|
357
|
+
executionResult: r == null ? void 0 : r.executionResult,
|
|
358
|
+
status: t.error ? "error" : n.status,
|
|
359
|
+
isLoading: !t.error && n.status === "loading",
|
|
360
|
+
error: t.error || n.error
|
|
498
361
|
};
|
|
499
362
|
}
|
|
500
|
-
function
|
|
501
|
-
const
|
|
363
|
+
function S(e, t, o, n) {
|
|
364
|
+
const r = J(), i = q(t), a = q(n), [y, u] = k({
|
|
502
365
|
status: "idle",
|
|
503
|
-
data:
|
|
366
|
+
data: o,
|
|
504
367
|
error: null
|
|
505
368
|
});
|
|
506
|
-
return
|
|
507
|
-
let
|
|
369
|
+
return i.current = t, a.current = n, C(() => {
|
|
370
|
+
let l;
|
|
508
371
|
try {
|
|
509
|
-
|
|
510
|
-
...
|
|
511
|
-
activeInputs:
|
|
372
|
+
l = i.current({
|
|
373
|
+
...r,
|
|
374
|
+
activeInputs: a.current
|
|
512
375
|
});
|
|
513
|
-
} catch (
|
|
376
|
+
} catch (p) {
|
|
514
377
|
u({
|
|
515
378
|
status: "error",
|
|
516
|
-
data:
|
|
517
|
-
error:
|
|
379
|
+
data: o,
|
|
380
|
+
error: m(p)
|
|
518
381
|
});
|
|
519
382
|
return;
|
|
520
383
|
}
|
|
521
|
-
if (!
|
|
522
|
-
u({ status: "idle", data:
|
|
384
|
+
if (!l) {
|
|
385
|
+
u({ status: "idle", data: o, error: null });
|
|
523
386
|
return;
|
|
524
387
|
}
|
|
525
|
-
let
|
|
526
|
-
return u((
|
|
388
|
+
let c = !1;
|
|
389
|
+
return u((p) => ({
|
|
527
390
|
status: "loading",
|
|
528
|
-
data:
|
|
391
|
+
data: p.data,
|
|
529
392
|
error: null
|
|
530
|
-
})),
|
|
531
|
-
|
|
532
|
-
}).catch((
|
|
533
|
-
|
|
393
|
+
})), l.then((p) => {
|
|
394
|
+
c || u({ status: "success", data: p, error: null });
|
|
395
|
+
}).catch((p) => {
|
|
396
|
+
c || u({
|
|
534
397
|
status: "error",
|
|
535
|
-
data:
|
|
536
|
-
error:
|
|
398
|
+
data: o,
|
|
399
|
+
error: m(p)
|
|
537
400
|
});
|
|
538
401
|
}), () => {
|
|
539
|
-
|
|
402
|
+
c = !0;
|
|
540
403
|
};
|
|
541
|
-
}, [
|
|
404
|
+
}, [o, e, r]), y;
|
|
542
405
|
}
|
|
543
406
|
export {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
407
|
+
R as SemaphorDataAppContext,
|
|
408
|
+
nt as SemaphorDataAppProvider,
|
|
409
|
+
M as createSemaphorQueryExecutor,
|
|
410
|
+
E as hasSemaphorInputValue,
|
|
411
|
+
dt as normalizeSemaphorAnalysisQueryOptions,
|
|
412
|
+
_ as normalizeSemaphorInputOptions,
|
|
413
|
+
z as readWindowRuntime,
|
|
414
|
+
x as toSemaphorActiveInputSnapshots,
|
|
415
|
+
O as toSemaphorAnalysisIntent,
|
|
416
|
+
g as toSemaphorAnalysisQueryOptions,
|
|
417
|
+
pt as toSemaphorInputBinding,
|
|
418
|
+
yt as toSemaphorInputBindings,
|
|
419
|
+
$ as toSemaphorInputOptionsIntent,
|
|
420
|
+
ft as toSemaphorInputSnapshots,
|
|
421
|
+
b as toSemaphorInputSpec,
|
|
422
|
+
K as toSemaphorMetricIntent,
|
|
423
|
+
T as toSemaphorRecordsIntent,
|
|
424
|
+
at as useSemaphorAnalysis,
|
|
425
|
+
J as useSemaphorDataAppRuntime,
|
|
426
|
+
ot as useSemaphorInput,
|
|
427
|
+
st as useSemaphorInputOptions,
|
|
428
|
+
it as useSemaphorMetric,
|
|
429
|
+
ut as useSemaphorRecords,
|
|
430
|
+
mt as validateSemaphorDataAppHookSpecs
|
|
563
431
|
};
|