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