react-semaphor 0.1.366 → 0.1.368

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