react-semaphor 0.1.369 → 0.1.371

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