react-semaphor 0.1.369 → 0.1.370

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,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 H, g as W, n as V, h as $, i as I } from "../chunks/validation-PPSpYtVf.js";
2
+ import { m as Le, j as Me, k as Be, l as Qe, v as Je } from "../chunks/validation-PPSpYtVf.js";
3
+ import { j as F } from "../chunks/index-CuHybtft.js";
4
+ import { createContext as X, useContext as G, useMemo as m, useState as O, useCallback as R, useEffect as N, useRef as j } from "react";
5
+ import { jsx as Z } from "react/jsx-runtime";
6
+ import { v as ee } from "../chunks/validators-DBNa-eb1.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 U(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] = z(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
+ z(n)
63
63
  ])
64
64
  );
65
65
  }
66
- function $(e) {
66
+ function z(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,
@@ -186,25 +186,34 @@ const xe = {
186
186
  ...e,
187
187
  queryKind: "sql"
188
188
  };
189
+ },
190
+ matrix(e) {
191
+ return {
192
+ ...e,
193
+ queryKind: "matrix"
194
+ };
189
195
  }
190
196
  };
191
- function se() {
197
+ function de() {
192
198
  return {
193
199
  executeAnalysis: (e, t, n) => h(
194
200
  e,
195
201
  t,
196
202
  n ?? {}
197
- ).then(V),
203
+ ).then(U),
198
204
  executeMetric: (e, t) => h(e, t),
199
205
  executeRecords: (e, t) => h(e, t),
200
206
  executeInputOptions: (e, t) => h(e, t),
201
- executeSql: (e, t) => h(e, t)
207
+ executeSql: (e, t) => h(e, t),
208
+ executeMatrix: (e, t) => h(e, t)
202
209
  };
203
210
  }
204
211
  async function h(e, t, n) {
205
212
  if (!t.token)
206
- throw new Error("SemaphorDataAppProvider needs a token to execute queries.");
207
- const r = await fetch(le(t), {
213
+ throw new Error(
214
+ "SemaphorDataAppProvider needs a token to execute queries."
215
+ );
216
+ const r = await fetch(me(t), {
208
217
  method: "POST",
209
218
  headers: {
210
219
  "Content-Type": "application/json",
@@ -216,14 +225,14 @@ async function h(e, t, n) {
216
225
  ...n ? { analysisOptions: n } : {},
217
226
  resultShape: e.kind
218
227
  })
219
- }), i = await ae(r);
228
+ }), i = await fe(r);
220
229
  if (!r.ok || i.error)
221
230
  throw new Error(
222
231
  i.error || `Semaphor Data App execution failed with status ${r.status}.`
223
232
  );
224
233
  return i;
225
234
  }
226
- async function ae(e) {
235
+ async function fe(e) {
227
236
  const t = await e.text().catch(() => "");
228
237
  if (!t.trim())
229
238
  return e.ok ? {
@@ -236,46 +245,46 @@ async function ae(e) {
236
245
  error: "Semaphor Data App execution returned invalid JSON.",
237
246
  details: t
238
247
  } : {
239
- error: ce(e, t),
248
+ error: pe(e, t),
240
249
  details: t
241
250
  };
242
251
  }
243
252
  }
244
- function ce(e, t) {
253
+ function pe(e, t) {
245
254
  const n = e.statusText ? ` ${e.statusText}` : "", r = t.replace(/\s+/g, " ").trim();
246
255
  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
256
  }
248
- function le(e) {
249
- const t = de(e).replace(/\/+$/, "");
257
+ function me(e) {
258
+ const t = he(e).replace(/\/+$/, "");
250
259
  return t ? t.endsWith("/api") ? `${t}/v1/data-app/execute` : `${t}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
251
260
  }
252
- function de(e) {
261
+ function he(e) {
253
262
  if (e.apiBaseUrl)
254
263
  return e.apiBaseUrl;
255
264
  if (!e.token)
256
265
  return "";
257
266
  try {
258
- return J(e.token).apiServiceUrl || "";
267
+ return F(e.token).apiServiceUrl || "";
259
268
  } catch {
260
269
  return "";
261
270
  }
262
271
  }
263
- const N = Y({});
264
- function fe() {
272
+ const L = X({});
273
+ function ve() {
265
274
  if (!(typeof window > "u"))
266
275
  return window.__SEMAPHOR_DATA_APP_RUNTIME__;
267
276
  }
268
- function pe() {
269
- return H(N);
277
+ function ye() {
278
+ return G(L);
270
279
  }
271
- function we({
280
+ function je({
272
281
  token: e,
273
282
  apiBaseUrl: t,
274
283
  executor: n,
275
284
  children: r
276
285
  }) {
277
286
  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(
287
+ 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
288
  () => ({
280
289
  token: u,
281
290
  apiBaseUrl: s,
@@ -283,143 +292,179 @@ function we({
283
292
  }),
284
293
  [s, a, u]
285
294
  );
286
- return /* @__PURE__ */ W(N.Provider, { value: c, children: r });
295
+ return /* @__PURE__ */ Z(L.Provider, { value: c, children: r });
287
296
  }
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);
297
+ const k = { value: null }, D = {}, qe = { records: [] }, x = { options: [] }, Se = { records: [] }, E = {};
298
+ function Ae(e) {
299
+ const t = y(e.inputs), n = Y(e);
291
300
  try {
292
- const r = Q(e), i = v(r);
301
+ const r = H(e), i = v(r);
293
302
  return i ? {
294
303
  error: i,
295
304
  activeInputs: t,
296
305
  analysisOptions: n,
297
- queryKey: f(void 0, t, i, n),
298
- idleData: I
306
+ queryKey: d(
307
+ void 0,
308
+ t,
309
+ i,
310
+ n
311
+ ),
312
+ idleData: D
299
313
  } : {
300
314
  intent: r,
301
315
  error: null,
302
316
  activeInputs: t,
303
317
  analysisOptions: n,
304
- queryKey: f(r, t, void 0, n),
305
- idleData: I
318
+ queryKey: d(r, t, void 0, n),
319
+ idleData: D
306
320
  };
307
321
  } catch (r) {
308
- const i = m(r);
322
+ const i = p(r);
309
323
  return {
310
324
  error: i,
311
325
  activeInputs: t,
312
326
  analysisOptions: n,
313
- queryKey: f(void 0, t, i, n),
314
- idleData: I
327
+ queryKey: d(
328
+ void 0,
329
+ t,
330
+ i,
331
+ n
332
+ ),
333
+ idleData: D
315
334
  };
316
335
  }
317
336
  }
318
- function ye(e) {
319
- const t = g(e.inputs);
337
+ function ge(e) {
338
+ const t = y(e.inputs);
320
339
  try {
321
- const n = M(e), r = v(n);
340
+ const n = W(e), r = v(n);
322
341
  return r ? {
323
342
  error: r,
324
343
  activeInputs: t,
325
- queryKey: f(void 0, t, r),
344
+ queryKey: d(void 0, t, r),
326
345
  idleData: k
327
346
  } : {
328
347
  intent: n,
329
348
  error: null,
330
349
  activeInputs: t,
331
- queryKey: f(n, t),
350
+ queryKey: d(n, t),
332
351
  idleData: k
333
352
  };
334
353
  } catch (n) {
335
- const r = m(n);
354
+ const r = p(n);
336
355
  return {
337
356
  error: r,
338
357
  activeInputs: t,
339
- queryKey: f(void 0, t, r),
358
+ queryKey: d(void 0, t, r),
340
359
  idleData: k
341
360
  };
342
361
  }
343
362
  }
344
- function qe(e) {
345
- const t = g(e.inputs), n = me;
363
+ function Ie(e) {
364
+ const t = y(e.inputs), n = qe;
346
365
  try {
347
- const r = L(e), i = v(r);
366
+ const r = J(e), i = v(r);
348
367
  return i ? {
349
368
  error: i,
350
369
  activeInputs: t,
351
- queryKey: f(void 0, t, i),
370
+ queryKey: d(void 0, t, i),
352
371
  idleData: n
353
372
  } : {
354
373
  intent: r,
355
374
  error: null,
356
375
  activeInputs: t,
357
- queryKey: f(r, t),
376
+ queryKey: d(r, t),
358
377
  idleData: n
359
378
  };
360
379
  } catch (r) {
361
- const i = m(r);
380
+ const i = p(r);
362
381
  return {
363
382
  error: i,
364
383
  activeInputs: t,
365
- queryKey: f(void 0, t, i),
384
+ queryKey: d(void 0, t, i),
366
385
  idleData: n
367
386
  };
368
387
  }
369
388
  }
370
- function Se(e) {
389
+ function ke(e) {
371
390
  try {
372
- const t = z(e), n = v(t);
391
+ const t = Q(e), n = v(t);
373
392
  return n ? {
374
393
  error: n,
375
- queryKey: f(void 0, void 0, n),
376
- idleData: E
394
+ queryKey: d(void 0, void 0, n),
395
+ idleData: x
377
396
  } : {
378
397
  intent: t,
379
398
  error: null,
380
- queryKey: f(t),
381
- idleData: E
399
+ queryKey: d(t),
400
+ idleData: x
382
401
  };
383
402
  } catch (t) {
384
- const n = m(t);
403
+ const n = p(t);
385
404
  return {
386
405
  error: n,
387
- queryKey: f(void 0, void 0, n),
388
- idleData: E
406
+ queryKey: d(void 0, void 0, n),
407
+ idleData: x
389
408
  };
390
409
  }
391
410
  }
392
- function Ae(e) {
393
- const t = g(e.inputs), n = he;
411
+ function De(e) {
412
+ const t = y(e.inputs), n = Se;
394
413
  try {
395
- const r = U(e), i = v(r);
414
+ const r = B(e), i = v(r);
396
415
  return i ? {
397
416
  error: i,
398
417
  activeInputs: t,
399
- queryKey: f(void 0, t, i),
418
+ queryKey: d(void 0, t, i),
400
419
  idleData: n
401
420
  } : {
402
421
  intent: r,
403
422
  error: null,
404
423
  activeInputs: t,
405
- queryKey: f(r, t),
424
+ queryKey: d(r, t),
406
425
  idleData: n
407
426
  };
408
427
  } catch (r) {
409
- const i = m(r);
428
+ const i = p(r);
410
429
  return {
411
430
  error: i,
412
431
  activeInputs: t,
413
- queryKey: f(void 0, t, i),
432
+ queryKey: d(void 0, t, i),
414
433
  idleData: n
415
434
  };
416
435
  }
417
436
  }
418
- function m(e) {
437
+ function xe(e) {
438
+ const t = y(e.inputs);
439
+ try {
440
+ const n = M(e), r = v(n);
441
+ return r ? {
442
+ error: r,
443
+ activeInputs: t,
444
+ queryKey: d(void 0, t, r),
445
+ idleData: E
446
+ } : {
447
+ intent: n,
448
+ error: null,
449
+ activeInputs: t,
450
+ queryKey: d(n, t),
451
+ idleData: E
452
+ };
453
+ } catch (n) {
454
+ const r = p(n);
455
+ return {
456
+ error: r,
457
+ activeInputs: t,
458
+ queryKey: d(void 0, t, r),
459
+ idleData: E
460
+ };
461
+ }
462
+ }
463
+ function p(e) {
419
464
  return e instanceof Error ? e : new Error(String(e));
420
465
  }
421
466
  function v(e) {
422
- const t = F(e);
467
+ const t = ee(e);
423
468
  if (t.ok)
424
469
  return null;
425
470
  const n = t.errors.map(
@@ -427,7 +472,7 @@ function v(e) {
427
472
  ).join("; ");
428
473
  return new Error(`Invalid Semaphor analytics intent. ${n}`);
429
474
  }
430
- function f(e, t, n, r) {
475
+ function d(e, t, n, r) {
431
476
  return JSON.stringify({
432
477
  intent: e,
433
478
  activeInputs: t,
@@ -435,20 +480,20 @@ function f(e, t, n, r) {
435
480
  error: n == null ? void 0 : n.message
436
481
  });
437
482
  }
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),
483
+ function Ve(e) {
484
+ const [t, n] = O(e.defaultValue), r = Object.prototype.hasOwnProperty.call(e, "value"), i = r ? e.value : t, u = m(
485
+ () => V(e.options),
441
486
  [e.options]
442
- ), s = O(
487
+ ), s = R(
443
488
  (a) => {
444
489
  var o;
445
490
  const c = a;
446
491
  (o = e.onValueChange) == null || o.call(e, c), r || n(c);
447
492
  },
448
493
  [r, e]
449
- ), d = O(() => s(void 0), [s]);
450
- return p(() => {
451
- const a = T(e);
494
+ ), f = R(() => s(void 0), [s]);
495
+ return m(() => {
496
+ const a = $(e);
452
497
  return {
453
498
  id: e.id,
454
499
  kind: e.kind,
@@ -458,43 +503,43 @@ function Ce(e) {
458
503
  controlRole: e.kind === "control" ? e.role : void 0,
459
504
  value: i,
460
505
  options: u,
461
- isActive: A(i),
506
+ isActive: I(i),
462
507
  setValue: s,
463
- clear: d,
508
+ clear: f,
464
509
  toAnalyticsInput: () => ({
465
510
  inputId: a.inputId,
466
511
  field: a.field,
467
512
  kind: e.kind,
468
513
  label: e.label,
469
514
  value: i,
470
- isActive: A(i),
515
+ isActive: I(i),
471
516
  operator: a.operator,
472
517
  controlRole: e.kind === "control" ? e.role : void 0
473
518
  })
474
519
  };
475
- }, [d, u, s, e, i]);
520
+ }, [f, u, s, e, i]);
476
521
  }
477
- function _e(e) {
478
- const [t, n] = R(() => ke(e));
479
- return j(() => {
522
+ function $e(e) {
523
+ const [t, n] = O(() => Ke(e));
524
+ return N(() => {
480
525
  n((r) => {
481
526
  let i = r;
482
527
  for (const u of e)
483
528
  !Object.prototype.hasOwnProperty.call(i, u.id) && u.defaultValue !== void 0 && (i = { ...i, [u.id]: u.defaultValue });
484
529
  return i;
485
530
  });
486
- }, [e]), p(
531
+ }, [e]), m(
487
532
  () => e.map((r) => {
488
533
  const i = Object.prototype.hasOwnProperty.call(
489
534
  r,
490
535
  "value"
491
- ), u = i ? r.value : t[r.id], s = P(r.options), d = (o) => {
536
+ ), u = i ? r.value : t[r.id], s = V(r.options), f = (o) => {
492
537
  var l;
493
- (l = r.onValueChange) == null || l.call(r, o), i || n((y) => ({
494
- ...y,
538
+ (l = r.onValueChange) == null || l.call(r, o), i || n((q) => ({
539
+ ...q,
495
540
  [r.id]: o
496
541
  }));
497
- }, a = () => d(void 0), c = T(r);
542
+ }, a = () => f(void 0), c = $(r);
498
543
  return {
499
544
  id: r.id,
500
545
  kind: r.kind,
@@ -504,8 +549,8 @@ function _e(e) {
504
549
  controlRole: r.kind === "control" ? r.role : void 0,
505
550
  value: u,
506
551
  options: s,
507
- isActive: A(u),
508
- setValue: d,
552
+ isActive: I(u),
553
+ setValue: f,
509
554
  clear: a,
510
555
  toAnalyticsInput: () => ({
511
556
  inputId: c.inputId,
@@ -513,7 +558,7 @@ function _e(e) {
513
558
  kind: r.kind,
514
559
  label: r.label,
515
560
  value: u,
516
- isActive: A(u),
561
+ isActive: I(u),
517
562
  operator: c.operator,
518
563
  controlRole: r.kind === "control" ? r.role : void 0
519
564
  })
@@ -522,88 +567,99 @@ function _e(e) {
522
567
  [e, t]
523
568
  );
524
569
  }
525
- function Pe(e, t = {}) {
526
- const n = p(
570
+ function Ne(e, t = {}) {
571
+ const n = m(
527
572
  () => t.inputs ? {
528
573
  ...e,
529
574
  inputs: t.inputs
530
575
  } : e,
531
576
  [t.inputs, e]
532
- ), r = p(() => {
577
+ ), r = m(() => {
533
578
  switch (n.queryKind) {
534
579
  case "metric":
535
580
  return {
536
581
  queryKind: n.queryKind,
537
- request: ye(n)
582
+ request: ge(n)
538
583
  };
539
584
  case "analysis":
540
585
  return {
541
586
  queryKind: n.queryKind,
542
- request: ve(n)
587
+ request: Ae(n)
543
588
  };
544
589
  case "records":
545
590
  return {
546
591
  queryKind: n.queryKind,
547
- request: qe(n)
592
+ request: Ie(n)
548
593
  };
549
594
  case "inputOptions":
550
595
  return {
551
596
  queryKind: n.queryKind,
552
- request: Se(n)
597
+ request: ke(n)
553
598
  };
554
599
  case "sql":
555
600
  return {
556
601
  queryKind: n.queryKind,
557
- request: Ae(n)
602
+ request: De(n)
603
+ };
604
+ case "matrix":
605
+ return {
606
+ queryKind: n.queryKind,
607
+ request: xe(n)
558
608
  };
559
609
  default:
560
- return D(n);
610
+ return K(n);
561
611
  }
562
- }, [n]), i = O(
612
+ }, [n]), i = R(
563
613
  (o) => {
564
- var y, q, K, x, w, S, C;
614
+ var q, S, w, C, _, A, T, g, P;
565
615
  const l = r.request;
566
616
  if (l.intent)
567
617
  switch (r.queryKind) {
568
618
  case "metric":
569
- return (y = o.executor) == null ? void 0 : y.executeMetric(
619
+ return (q = o.executor) == null ? void 0 : q.executeMetric(
570
620
  l.intent,
571
621
  o
572
622
  );
573
623
  case "analysis":
574
- return (K = (q = o.executor) == null ? void 0 : q.executeAnalysis) == null ? void 0 : K.call(
575
- q,
624
+ return (w = (S = o.executor) == null ? void 0 : S.executeAnalysis) == null ? void 0 : w.call(
625
+ S,
576
626
  l.intent,
577
627
  o,
578
628
  l.analysisOptions
579
629
  );
580
630
  case "records":
581
- return (x = o.executor) == null ? void 0 : x.executeRecords(
631
+ return (C = o.executor) == null ? void 0 : C.executeRecords(
582
632
  l.intent,
583
633
  o
584
634
  );
585
635
  case "inputOptions":
586
- return (w = o.executor) == null ? void 0 : w.executeInputOptions(
636
+ return (_ = o.executor) == null ? void 0 : _.executeInputOptions(
587
637
  l.intent,
588
638
  o
589
639
  );
590
640
  case "sql":
591
- return (C = (S = o.executor) == null ? void 0 : S.executeSql) == null ? void 0 : C.call(
592
- S,
641
+ return (T = (A = o.executor) == null ? void 0 : A.executeSql) == null ? void 0 : T.call(
642
+ A,
643
+ l.intent,
644
+ o
645
+ );
646
+ case "matrix":
647
+ return (P = (g = o.executor) == null ? void 0 : g.executeMatrix) == null ? void 0 : P.call(
648
+ g,
593
649
  l.intent,
594
650
  o
595
651
  );
596
652
  default:
597
- return D(r);
653
+ return K(r);
598
654
  }
599
655
  },
600
656
  [r]
601
- ), u = ge(
657
+ ), u = Ee(
602
658
  r.request.queryKey,
603
659
  i,
604
660
  r.request.idleData,
605
661
  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;
662
+ ), 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
663
  switch (r.queryKind) {
608
664
  case "metric": {
609
665
  const o = s;
@@ -617,18 +673,18 @@ function Pe(e, t = {}) {
617
673
  deltaPercent: o == null ? void 0 : o.deltaPercent,
618
674
  records: o == null ? void 0 : o.records,
619
675
  executionResult: o == null ? void 0 : o.executionResult,
620
- status: d,
676
+ status: f,
621
677
  isLoading: a,
622
678
  error: c
623
679
  };
624
680
  }
625
681
  case "analysis": {
626
- const o = V(s);
682
+ const o = U(s);
627
683
  return {
628
684
  id: n.id,
629
685
  intent: r.request.intent,
630
686
  ...o || {},
631
- status: d,
687
+ status: f,
632
688
  isLoading: a,
633
689
  error: c
634
690
  };
@@ -643,7 +699,7 @@ function Pe(e, t = {}) {
643
699
  rowCount: o == null ? void 0 : o.rowCount,
644
700
  pagination: o == null ? void 0 : o.pagination,
645
701
  executionResult: o == null ? void 0 : o.executionResult,
646
- status: d,
702
+ status: f,
647
703
  isLoading: a,
648
704
  error: c
649
705
  };
@@ -655,7 +711,7 @@ function Pe(e, t = {}) {
655
711
  intent: r.request.intent,
656
712
  options: (o == null ? void 0 : o.options) || [],
657
713
  executionResult: o == null ? void 0 : o.executionResult,
658
- status: d,
714
+ status: f,
659
715
  isLoading: a,
660
716
  error: c
661
717
  };
@@ -672,22 +728,36 @@ function Pe(e, t = {}) {
672
728
  output: o == null ? void 0 : o.output,
673
729
  rowLimitExceeded: o == null ? void 0 : o.rowLimitExceeded,
674
730
  executionResult: o == null ? void 0 : o.executionResult,
675
- status: d,
731
+ status: f,
732
+ isLoading: a,
733
+ error: c
734
+ };
735
+ }
736
+ case "matrix": {
737
+ const o = s;
738
+ return {
739
+ id: n.id,
740
+ intent: r.request.intent,
741
+ payload: o == null ? void 0 : o.payload,
742
+ grid: o == null ? void 0 : o.grid,
743
+ expansion: o == null ? void 0 : o.expansion,
744
+ executionResult: o == null ? void 0 : o.executionResult,
745
+ status: f,
676
746
  isLoading: a,
677
747
  error: c
678
748
  };
679
749
  }
680
750
  default:
681
- return D(r);
751
+ return K(r);
682
752
  }
683
753
  }
684
- function ge(e, t, n, r) {
685
- const i = pe(), u = _(t), s = _(r), [d, a] = R({
754
+ function Ee(e, t, n, r) {
755
+ const i = ye(), u = j(t), s = j(r), [f, a] = O({
686
756
  status: "idle",
687
757
  data: n,
688
758
  error: null
689
759
  });
690
- return u.current = t, s.current = r, j(() => {
760
+ return u.current = t, s.current = r, N(() => {
691
761
  let c;
692
762
  try {
693
763
  c = u.current({
@@ -698,7 +768,7 @@ function ge(e, t, n, r) {
698
768
  a({
699
769
  status: "error",
700
770
  data: n,
701
- error: m(l)
771
+ error: p(l)
702
772
  });
703
773
  return;
704
774
  }
@@ -717,47 +787,48 @@ function ge(e, t, n, r) {
717
787
  o || a({
718
788
  status: "error",
719
789
  data: n,
720
- error: m(l)
790
+ error: p(l)
721
791
  });
722
792
  }), () => {
723
793
  o = !0;
724
794
  };
725
- }, [n, e, i]), d;
795
+ }, [n, e, i]), f;
726
796
  }
727
- function ke(e) {
797
+ function Ke(e) {
728
798
  return Object.fromEntries(
729
799
  e.filter((t) => t.defaultValue !== void 0).map((t) => [t.id, t.defaultValue])
730
800
  );
731
801
  }
732
- function D(e) {
802
+ function K(e) {
733
803
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
734
804
  }
735
805
  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
806
+ L as SemaphorDataAppContext,
807
+ je as SemaphorDataAppProvider,
808
+ de as createSemaphorQueryExecutor,
809
+ _e as defineSemaphorDataApp,
810
+ Te as defineSemaphorInput,
811
+ I as hasSemaphorInputValue,
812
+ U as normalizeSemaphorAnalysisPayload,
813
+ Le as normalizeSemaphorAnalysisQueryOptions,
814
+ V as normalizeSemaphorInputOptions,
815
+ ve as readWindowRuntime,
816
+ Pe as semaphor,
817
+ y as toSemaphorActiveInputSnapshots,
818
+ H as toSemaphorAnalysisIntent,
819
+ Y as toSemaphorAnalysisQueryOptions,
820
+ Me as toSemaphorInputBinding,
821
+ Be as toSemaphorInputBindings,
822
+ Q as toSemaphorInputOptionsIntent,
823
+ Qe as toSemaphorInputSnapshots,
824
+ $ as toSemaphorInputSpec,
825
+ M as toSemaphorMatrixIntent,
826
+ W as toSemaphorMetricIntent,
827
+ J as toSemaphorRecordsIntent,
828
+ B as toSemaphorSqlIntent,
829
+ ye as useSemaphorDataAppRuntime,
830
+ Ve as useSemaphorInput,
831
+ $e as useSemaphorInputs,
832
+ Ne as useSemaphorQuery,
833
+ Je as validateSemaphorDataAppQuerySpecs
763
834
  };