react-semaphor 0.1.359 → 0.1.361

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