react-semaphor 0.1.378 → 0.1.380

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