react-semaphor 0.1.381 → 0.1.382
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.
- package/DATA_APP_SDK.md +238 -0
- package/README.md +7 -0
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +45 -41
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +6 -6
- package/dist/chunks/analyze-result-contract-CtXfp3nv.js +1 -0
- package/dist/chunks/analyze-result-contract-DuhlklhI.js +102 -0
- package/dist/chunks/{braces-BT-ZyB-g.js → braces-CGi-YFZp.js} +1 -1
- package/dist/chunks/{braces-DOxxfERN.js → braces-CP8BEzl3.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-Dsgs8WDv.js → calendar-preferences-dialog-CV4xF2Tp.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-iZs8XqyH.js → calendar-preferences-dialog-rDDobeLo.js} +1 -1
- package/dist/chunks/catalog-field-grounding-Bnx-3tE0.js +1 -0
- package/dist/chunks/catalog-field-grounding-CJKAqtiC.js +100 -0
- package/dist/chunks/{dashboard-briefing-launcher-Coks66cV.js → dashboard-briefing-launcher-BT00MvGB.js} +5 -5
- package/dist/chunks/{dashboard-briefing-launcher-B5vPTl8P.js → dashboard-briefing-launcher-Dcbh-mjY.js} +1 -1
- package/dist/chunks/{dashboard-controls-BfkcnIdy.js → dashboard-controls-B6y7jkKO.js} +8 -8
- package/dist/chunks/{dashboard-controls-Dyqye6fh.js → dashboard-controls-CRqnPibB.js} +1 -1
- package/dist/chunks/{dashboard-json-DjXi4cI6.js → dashboard-json-CfIUG8k1.js} +3 -3
- package/dist/chunks/{dashboard-json-CV_LnO9x.js → dashboard-json-DEQqRR1x.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DOW1Ap1N.js → edit-dashboard-visual-DMbf89xa.js} +5 -5
- package/dist/chunks/{edit-dashboard-visual-yinO0yU-.js → edit-dashboard-visual-wDOcHak3.js} +1 -1
- package/dist/chunks/{index-DlprYjr6.js → index-BAsWLkZ8.js} +169 -168
- package/dist/chunks/{index-CkoRCh3g.js → index-CrKxP9uF.js} +5 -5
- package/dist/chunks/{layout-grid-DTbOIOsE.js → layout-grid-BsKH3TgY.js} +1 -1
- package/dist/chunks/{layout-grid-DccceHv4.js → layout-grid-jJQUqDN9.js} +1 -1
- package/dist/chunks/operators-C8TxpM4C.js +48 -0
- package/dist/chunks/operators-DrTQsJXv.js +1 -0
- package/dist/chunks/{palette-SimHJELn.js → palette-9zLPGlj2.js} +1 -1
- package/dist/chunks/{palette-DCzLwqIw.js → palette-xU9Qt6bE.js} +1 -1
- package/dist/chunks/{save-D2O96E5A.js → save-8A_q6K4E.js} +1 -1
- package/dist/chunks/{save-zNVYH02T.js → save-DzciESDh.js} +1 -1
- package/dist/chunks/{source-identity-Dj3dryN9.js → source-identity-CN4xiyKJ.js} +5 -5
- package/dist/chunks/{switch-DMPsMpHW.js → switch-DArtNJZh.js} +292 -291
- package/dist/chunks/{switch-Jhyl63RF.js → switch-k7kj6NRg.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-r5JKyXU8.js → use-create-flow-overlay-state-BdG1DiSx.js} +4 -4
- package/dist/chunks/{use-create-flow-overlay-state-NsqFPwdB.js → use-create-flow-overlay-state-ipeaE65_.js} +1 -1
- package/dist/chunks/{validators-CtNmgsvG.js → validators-CHPH6ORs.js} +641 -498
- package/dist/chunks/validators-lWo8m0Q7.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +105 -92
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +444 -380
- package/dist/data-app-sdk-adapters/index.cjs +1 -0
- package/dist/data-app-sdk-adapters/index.js +383 -0
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +1073 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +58 -31
- package/dist/types/dashboard-assistant.d.ts +40 -15
- package/dist/types/dashboard-authoring.d.ts +36 -16
- package/dist/types/dashboard.d.ts +8 -8
- package/dist/types/data-app-builder.d.ts +35 -11
- package/dist/types/data-app-sdk-adapters.d.ts +733 -0
- package/dist/types/data-app-sdk-validation.d.ts +85 -25
- package/dist/types/data-app-sdk.d.ts +99 -155
- package/dist/types/main.d.ts +35 -11
- package/dist/types/shared.d.ts +8 -8
- package/dist/types/surfboard.d.ts +8 -8
- package/dist/types/types.d.ts +8 -8
- package/package.json +9 -2
- package/src/data-app-sdk/README.md +240 -0
- package/dist/chunks/catalog-field-grounding-8L9I0zdg.js +0 -1
- package/dist/chunks/catalog-field-grounding-BK4BX8sZ.js +0 -200
- package/dist/chunks/validation-BM3-ShHV.js +0 -1003
- package/dist/chunks/validation-BVpqRFar.js +0 -1
- package/dist/chunks/validators-jpoYhpHh.js +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { D as P, a as be } from "../chunks/contracts-CoCOpd_i.js";
|
|
2
|
+
import { a as Ie, b as E, c as ye } from "../chunks/source-identity-CN4xiyKJ.js";
|
|
3
|
+
import { b as ae, e as _e } from "../chunks/validators-CHPH6ORs.js";
|
|
4
|
+
import "../chunks/analyze-result-contract-DuhlklhI.js";
|
|
5
|
+
import { b as we } from "../chunks/catalog-field-grounding-CJKAqtiC.js";
|
|
6
|
+
import { n as ve } from "../chunks/operators-C8TxpM4C.js";
|
|
5
7
|
function _(e) {
|
|
6
8
|
return e && typeof e == "object" ? e : null;
|
|
7
9
|
}
|
|
@@ -12,10 +14,10 @@ function Se(e) {
|
|
|
12
14
|
var t, n, r;
|
|
13
15
|
return !!(e && typeof e == "object") && (((t = _(e)) == null ? void 0 : t.kind) === "semantic" || ((n = _(e)) == null ? void 0 : n.kind) === "physical" || ((r = _(e)) == null ? void 0 : r.kind) === "sql");
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function T(e) {
|
|
16
18
|
return Se(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function St(e) {
|
|
19
21
|
return Ie(e);
|
|
20
22
|
}
|
|
21
23
|
function ie(e, t) {
|
|
@@ -24,7 +26,7 @@ function ie(e, t) {
|
|
|
24
26
|
function Ce(e, t) {
|
|
25
27
|
return ye(e, t);
|
|
26
28
|
}
|
|
27
|
-
function
|
|
29
|
+
function z(e) {
|
|
28
30
|
const t = [];
|
|
29
31
|
for (const n of e) {
|
|
30
32
|
const r = t.findIndex(
|
|
@@ -37,14 +39,14 @@ function P(e) {
|
|
|
37
39
|
}
|
|
38
40
|
return t;
|
|
39
41
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
42
|
+
function Ct(e) {
|
|
43
|
+
return z(e)[0];
|
|
42
44
|
}
|
|
43
45
|
function L(e, t) {
|
|
44
46
|
return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !E(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
|
|
45
47
|
}
|
|
46
48
|
function j(e) {
|
|
47
|
-
return
|
|
49
|
+
return T(e) ? e : void 0;
|
|
48
50
|
}
|
|
49
51
|
function ne(e, t) {
|
|
50
52
|
if (!(e.kind !== "semantic" || e.connectionId))
|
|
@@ -79,43 +81,43 @@ function ke({
|
|
|
79
81
|
if ((t == null ? void 0 : t.source) === void 0)
|
|
80
82
|
return j(n);
|
|
81
83
|
}
|
|
82
|
-
function
|
|
84
|
+
function kt(e, t) {
|
|
83
85
|
if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
|
|
84
86
|
return !1;
|
|
85
87
|
const n = S(e), r = S(t);
|
|
86
88
|
return !n || !r ? !0 : ie(n, r);
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function x(e) {
|
|
89
91
|
var t;
|
|
90
92
|
return C((t = _(e)) == null ? void 0 : t.kind);
|
|
91
93
|
}
|
|
92
94
|
function oe(e) {
|
|
93
95
|
var t, n;
|
|
94
|
-
return
|
|
96
|
+
return x(e) !== "semantic" ? null : ((n = C((t = _(e)) == null ? void 0 : t.domainId)) == null ? void 0 : n.trim()) || null;
|
|
95
97
|
}
|
|
96
98
|
function xe(e) {
|
|
97
99
|
var t;
|
|
98
|
-
return
|
|
100
|
+
return x(e) !== "semantic" ? null : C((t = _(e)) == null ? void 0 : t.datasetName);
|
|
99
101
|
}
|
|
100
102
|
function De(e) {
|
|
101
103
|
var t;
|
|
102
|
-
return
|
|
104
|
+
return x(e) !== "semantic" ? null : C((t = _(e)) == null ? void 0 : t.datasetId);
|
|
103
105
|
}
|
|
104
106
|
function Ae(e) {
|
|
105
107
|
var t;
|
|
106
|
-
return
|
|
108
|
+
return x(e) !== "physical" ? null : C((t = _(e)) == null ? void 0 : t.connectionId);
|
|
107
109
|
}
|
|
108
110
|
function Fe(e) {
|
|
109
111
|
var t;
|
|
110
|
-
return
|
|
112
|
+
return x(e) !== "physical" ? null : C((t = _(e)) == null ? void 0 : t.tableName);
|
|
111
113
|
}
|
|
112
114
|
function Te(e) {
|
|
113
115
|
var t;
|
|
114
|
-
return
|
|
116
|
+
return x(e) !== "physical" ? "" : C((t = _(e)) == null ? void 0 : t.databaseName) || "";
|
|
115
117
|
}
|
|
116
118
|
function $e(e) {
|
|
117
119
|
var t;
|
|
118
|
-
return
|
|
120
|
+
return x(e) !== "physical" ? "" : C((t = _(e)) == null ? void 0 : t.schemaName) || "";
|
|
119
121
|
}
|
|
120
122
|
function Me(e) {
|
|
121
123
|
if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
|
|
@@ -141,7 +143,7 @@ function H(e, t) {
|
|
|
141
143
|
}
|
|
142
144
|
return t.kind === "physical" ? Ae(e) === t.connectionId && Fe(e) === t.tableName && Te(e) === (t.databaseName || "") && $e(e) === (t.schemaName || "") : !1;
|
|
143
145
|
}
|
|
144
|
-
function
|
|
146
|
+
function xt(e, t) {
|
|
145
147
|
return e.find(
|
|
146
148
|
(n) => H(n, t)
|
|
147
149
|
);
|
|
@@ -149,7 +151,7 @@ function Ct(e, t) {
|
|
|
149
151
|
function p(e, t, n) {
|
|
150
152
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
151
153
|
}
|
|
152
|
-
function
|
|
154
|
+
function N(e) {
|
|
153
155
|
const t = /* @__PURE__ */ new Set();
|
|
154
156
|
for (const n of e) {
|
|
155
157
|
if (t.has(n))
|
|
@@ -186,7 +188,7 @@ function se({
|
|
|
186
188
|
)
|
|
187
189
|
);
|
|
188
190
|
}
|
|
189
|
-
function
|
|
191
|
+
function B(e) {
|
|
190
192
|
return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
|
|
191
193
|
}
|
|
192
194
|
function q(e) {
|
|
@@ -200,26 +202,33 @@ function re(e) {
|
|
|
200
202
|
) : [];
|
|
201
203
|
}
|
|
202
204
|
function Be(e) {
|
|
203
|
-
var n;
|
|
205
|
+
var n, r;
|
|
204
206
|
if (!e)
|
|
205
207
|
return [];
|
|
206
208
|
const t = [e.source];
|
|
207
209
|
return e.kind === "metric" ? t.push(
|
|
208
|
-
...
|
|
209
|
-
...q(e.
|
|
210
|
-
e.
|
|
210
|
+
...B([
|
|
211
|
+
...q(e.measures),
|
|
212
|
+
e.primaryMeasure,
|
|
211
213
|
e.dateField,
|
|
212
214
|
...q(e.dimensions),
|
|
213
|
-
...re(e.filters).map((
|
|
215
|
+
...re(e.filters).map((o) => o.field)
|
|
214
216
|
])
|
|
215
217
|
) : e.kind === "records" ? t.push(
|
|
216
|
-
...
|
|
218
|
+
...B([
|
|
217
219
|
...q(e.fields),
|
|
218
220
|
e.dateField,
|
|
219
221
|
(n = e.orderBy) == null ? void 0 : n.field,
|
|
220
|
-
...re(e.filters).map((
|
|
222
|
+
...re(e.filters).map((o) => o.field)
|
|
223
|
+
])
|
|
224
|
+
) : e.kind === "inputOptions" ? (((r = e.population) == null ? void 0 : r.kind) === "related_population" && t.push(e.population.baseSource), t.push(
|
|
225
|
+
...B([
|
|
226
|
+
e.labelField,
|
|
227
|
+
e.valueField,
|
|
228
|
+
e.searchField,
|
|
229
|
+
...e.disambiguationFields || []
|
|
221
230
|
])
|
|
222
|
-
)
|
|
231
|
+
)) : e.kind === "sql" && t.push(...B(e.fields || [])), t;
|
|
223
232
|
}
|
|
224
233
|
function de({
|
|
225
234
|
card: e,
|
|
@@ -314,17 +323,17 @@ function Pe(e) {
|
|
|
314
323
|
p("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
|
|
315
324
|
);
|
|
316
325
|
const d = (i == null ? void 0 : i.cards) || [];
|
|
317
|
-
d.length >
|
|
326
|
+
d.length > P && t.push(
|
|
318
327
|
p(
|
|
319
328
|
"too_many_cards",
|
|
320
|
-
`Generated dashboards can contain at most ${
|
|
329
|
+
`Generated dashboards can contain at most ${P} cards.`
|
|
321
330
|
)
|
|
322
331
|
);
|
|
323
|
-
const s =
|
|
332
|
+
const s = N(d.map((l) => l.id));
|
|
324
333
|
s && t.push(
|
|
325
334
|
p("duplicate_card_id", `Duplicate generated card id: ${s}.`)
|
|
326
335
|
);
|
|
327
|
-
const u =
|
|
336
|
+
const u = N(d.map((l) => l.frameId));
|
|
328
337
|
u && t.push(
|
|
329
338
|
p(
|
|
330
339
|
"duplicate_frame_id",
|
|
@@ -345,14 +354,14 @@ function Pe(e) {
|
|
|
345
354
|
l.id
|
|
346
355
|
)
|
|
347
356
|
), se({ card: l, datasets: o, errors: t }), ce({ card: l, errors: t }), de({ card: l, datasets: o, errors: t });
|
|
348
|
-
const h = Array.isArray(n.filterInputs) ? n.filterInputs : [], I = h.map((l) => l.id), w =
|
|
357
|
+
const h = Array.isArray(n.filterInputs) ? n.filterInputs : [], I = h.map((l) => l.id), w = N(I);
|
|
349
358
|
w && t.push(
|
|
350
359
|
p(
|
|
351
360
|
"duplicate_input_id",
|
|
352
361
|
`Duplicate dashboard input id: ${w}.`
|
|
353
362
|
)
|
|
354
363
|
);
|
|
355
|
-
const v = h.map((l) => l.variableName).filter(Boolean) || [], y =
|
|
364
|
+
const v = h.map((l) => l.variableName).filter(Boolean) || [], y = N(v);
|
|
356
365
|
y && t.push(
|
|
357
366
|
p(
|
|
358
367
|
"duplicate_input_variable",
|
|
@@ -526,7 +535,7 @@ function K(e) {
|
|
|
526
535
|
);
|
|
527
536
|
}
|
|
528
537
|
function We(e) {
|
|
529
|
-
const t =
|
|
538
|
+
const t = we(e);
|
|
530
539
|
return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
|
|
531
540
|
}
|
|
532
541
|
function Ee(e) {
|
|
@@ -673,7 +682,7 @@ function Xe(e, t) {
|
|
|
673
682
|
defaultInputValues: n.shared && Object.keys(n.shared).length > 0 ? n : void 0
|
|
674
683
|
};
|
|
675
684
|
}
|
|
676
|
-
function
|
|
685
|
+
function Dt(e) {
|
|
677
686
|
var v, y;
|
|
678
687
|
const t = Pe(e.plan);
|
|
679
688
|
if (!t.ok)
|
|
@@ -743,7 +752,7 @@ function kt(e) {
|
|
|
743
752
|
...u ? { defaultInputValues: u } : {}
|
|
744
753
|
}, warnings: r, skippedOperations: o };
|
|
745
754
|
}
|
|
746
|
-
function
|
|
755
|
+
function D(e, t, n) {
|
|
747
756
|
return n ? { code: e, message: t, cardId: n } : { code: e, message: t };
|
|
748
757
|
}
|
|
749
758
|
function Ye(e) {
|
|
@@ -832,7 +841,7 @@ function rt(e, t) {
|
|
|
832
841
|
}
|
|
833
842
|
});
|
|
834
843
|
}
|
|
835
|
-
function
|
|
844
|
+
function At(e) {
|
|
836
845
|
var d;
|
|
837
846
|
const t = ze(e.changePlan);
|
|
838
847
|
if (!t.ok)
|
|
@@ -855,11 +864,11 @@ function xt(e) {
|
|
|
855
864
|
return w + (((y = v.cards) == null ? void 0 : y.length) || 0);
|
|
856
865
|
},
|
|
857
866
|
0
|
|
858
|
-
) >=
|
|
867
|
+
) >= P) {
|
|
859
868
|
o.push(
|
|
860
|
-
|
|
869
|
+
D(
|
|
861
870
|
"generated_card_limit_reached",
|
|
862
|
-
`AI refinement is capped at ${
|
|
871
|
+
`AI refinement is capped at ${P} cards.`,
|
|
863
872
|
s.card.id
|
|
864
873
|
)
|
|
865
874
|
);
|
|
@@ -868,7 +877,7 @@ function xt(e) {
|
|
|
868
877
|
const h = a.get(s.card.id);
|
|
869
878
|
if (!h) {
|
|
870
879
|
o.push(
|
|
871
|
-
|
|
880
|
+
D(
|
|
872
881
|
"missing_card_artifact",
|
|
873
882
|
`Card "${s.card.title}" was skipped because no generated artifact was supplied.`,
|
|
874
883
|
s.card.id
|
|
@@ -914,7 +923,7 @@ function xt(e) {
|
|
|
914
923
|
else if (s.field.scope === "card" && s.field.field) {
|
|
915
924
|
const u = s.field.targetCardId ? R(n, s.field.targetCardId) : null;
|
|
916
925
|
u ? ((d = u.card).calculatedFields ?? (d.calculatedFields = []), u.card.calculatedFields.push(s.field.field)) : o.push(
|
|
917
|
-
|
|
926
|
+
D(
|
|
918
927
|
"missing_calculated_field_target",
|
|
919
928
|
`Calculated field "${s.field.name}" needs a valid target card.`
|
|
920
929
|
)
|
|
@@ -926,7 +935,7 @@ function xt(e) {
|
|
|
926
935
|
const u = R(n, s.cardId);
|
|
927
936
|
if (!u) {
|
|
928
937
|
o.push(
|
|
929
|
-
|
|
938
|
+
D(
|
|
930
939
|
"card_not_found",
|
|
931
940
|
`Card "${s.cardId}" could not be renamed because it was not found.`,
|
|
932
941
|
s.cardId
|
|
@@ -948,7 +957,7 @@ function xt(e) {
|
|
|
948
957
|
}
|
|
949
958
|
case "reuseCalculatedField":
|
|
950
959
|
r.push(
|
|
951
|
-
|
|
960
|
+
D(
|
|
952
961
|
"reused_calculated_field",
|
|
953
962
|
`Calculated field "${s.fieldId}" is reused by reference.`
|
|
954
963
|
)
|
|
@@ -956,7 +965,7 @@ function xt(e) {
|
|
|
956
965
|
break;
|
|
957
966
|
case "unsupported":
|
|
958
967
|
o.push(
|
|
959
|
-
|
|
968
|
+
D("unsupported_operation", s.reason || s.requestedAction)
|
|
960
969
|
);
|
|
961
970
|
break;
|
|
962
971
|
}
|
|
@@ -976,25 +985,25 @@ function he(e, t) {
|
|
|
976
985
|
n += 1, r = `${e}-${n}`;
|
|
977
986
|
return t.add(r), r;
|
|
978
987
|
}
|
|
979
|
-
function
|
|
988
|
+
function $(e) {
|
|
980
989
|
return !!(e && typeof e == "object");
|
|
981
990
|
}
|
|
982
991
|
function me(e) {
|
|
983
992
|
return Array.isArray(e.inputs) ? e.inputs.filter(
|
|
984
|
-
(t) =>
|
|
993
|
+
(t) => $(t) && typeof t.id == "string"
|
|
985
994
|
) : [];
|
|
986
995
|
}
|
|
987
996
|
function U(e) {
|
|
988
997
|
return Array.isArray(e.sections) ? e.sections.filter(
|
|
989
|
-
(t) =>
|
|
998
|
+
(t) => $(t)
|
|
990
999
|
) : [];
|
|
991
1000
|
}
|
|
992
1001
|
function J(e) {
|
|
993
1002
|
return Array.isArray(e.views) ? e.views.filter(
|
|
994
|
-
(t) =>
|
|
1003
|
+
(t) => $(t)
|
|
995
1004
|
) : [];
|
|
996
1005
|
}
|
|
997
|
-
function
|
|
1006
|
+
function k(e) {
|
|
998
1007
|
if (!Array.isArray(e))
|
|
999
1008
|
return [];
|
|
1000
1009
|
const t = [];
|
|
@@ -1005,33 +1014,37 @@ function D(e) {
|
|
|
1005
1014
|
return t;
|
|
1006
1015
|
}
|
|
1007
1016
|
function at(e) {
|
|
1008
|
-
var r, o;
|
|
1017
|
+
var r, o, a;
|
|
1009
1018
|
if (!e)
|
|
1010
1019
|
return [];
|
|
1011
1020
|
const t = [];
|
|
1012
|
-
if (
|
|
1013
|
-
t.push(...
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
...
|
|
1017
|
-
(r = e.filters) == null ? void 0 : r.map((
|
|
1021
|
+
if (T(e.source) && t.push(e.source), e.kind === "metric") {
|
|
1022
|
+
t.push(...k(e.measures));
|
|
1023
|
+
const i = S(e.dateField);
|
|
1024
|
+
i && t.push(i), t.push(...k(e.dimensions)), t.push(
|
|
1025
|
+
...k(
|
|
1026
|
+
(r = e.filters) == null ? void 0 : r.map((d) => d.field)
|
|
1018
1027
|
)
|
|
1019
1028
|
);
|
|
1020
1029
|
} else if (e.kind === "records") {
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1023
|
-
...
|
|
1024
|
-
(o = e.filters) == null ? void 0 : o.map((
|
|
1030
|
+
const i = S(e.dateField);
|
|
1031
|
+
i && t.push(i), t.push(...k(e.fields)), t.push(
|
|
1032
|
+
...k(
|
|
1033
|
+
(o = e.filters) == null ? void 0 : o.map((d) => d.field)
|
|
1025
1034
|
)
|
|
1026
1035
|
);
|
|
1027
|
-
} else
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1036
|
+
} else e.kind === "inputOptions" ? (((a = e.population) == null ? void 0 : a.kind) === "related_population" && T(e.population.baseSource) && t.push(e.population.baseSource), t.push(
|
|
1037
|
+
...k([
|
|
1038
|
+
e.labelField,
|
|
1039
|
+
e.valueField,
|
|
1040
|
+
e.searchField,
|
|
1041
|
+
...e.disambiguationFields || []
|
|
1042
|
+
].filter((i) => !!i))
|
|
1043
|
+
)) : e.kind === "sql" && t.push(...k(e.fields));
|
|
1031
1044
|
const n = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
|
|
1032
|
-
for (const
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1045
|
+
for (const i of n) {
|
|
1046
|
+
const d = S(i.field);
|
|
1047
|
+
d && t.push(d);
|
|
1035
1048
|
}
|
|
1036
1049
|
return t;
|
|
1037
1050
|
}
|
|
@@ -1051,11 +1064,11 @@ function ot(e) {
|
|
|
1051
1064
|
const t = [];
|
|
1052
1065
|
for (const r of U(e))
|
|
1053
1066
|
for (const o of J(r))
|
|
1054
|
-
|
|
1067
|
+
T((n = o.analytics) == null ? void 0 : n.source) && t.push(o.analytics.source);
|
|
1055
1068
|
return t;
|
|
1056
1069
|
}
|
|
1057
1070
|
function st(e, t) {
|
|
1058
|
-
const n =
|
|
1071
|
+
const n = z(e).filter(T);
|
|
1059
1072
|
if (n.length === 0)
|
|
1060
1073
|
return t.push(
|
|
1061
1074
|
b(
|
|
@@ -1076,7 +1089,7 @@ function st(e, t) {
|
|
|
1076
1089
|
), [n[0]]) : n;
|
|
1077
1090
|
}
|
|
1078
1091
|
function dt(e, t) {
|
|
1079
|
-
const n = U(e), r = me(e), o =
|
|
1092
|
+
const n = U(e), r = me(e), o = z(it(e)), a = z(
|
|
1080
1093
|
ot(e)
|
|
1081
1094
|
);
|
|
1082
1095
|
return {
|
|
@@ -1115,7 +1128,7 @@ function ut(e) {
|
|
|
1115
1128
|
return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((n = e.presentation) == null ? void 0 : n.kind) === "table" ? "table" : ((r = e.presentation) == null ? void 0 : r.kind) === "text" ? "text" : "chart";
|
|
1116
1129
|
}
|
|
1117
1130
|
function ft(e) {
|
|
1118
|
-
const t =
|
|
1131
|
+
const t = ve(e);
|
|
1119
1132
|
switch (t) {
|
|
1120
1133
|
case "not_in":
|
|
1121
1134
|
return "not in";
|
|
@@ -1130,7 +1143,7 @@ function ft(e) {
|
|
|
1130
1143
|
}
|
|
1131
1144
|
}
|
|
1132
1145
|
function pt(e) {
|
|
1133
|
-
return
|
|
1146
|
+
return $(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
|
|
1134
1147
|
}
|
|
1135
1148
|
function ht(e) {
|
|
1136
1149
|
if (!(!e || e.kind !== "physical"))
|
|
@@ -1144,7 +1157,7 @@ function mt(e, t, n, r, o, a) {
|
|
|
1144
1157
|
`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
|
|
1145
1158
|
)
|
|
1146
1159
|
), null;
|
|
1147
|
-
if (
|
|
1160
|
+
if (!$(e.field) || typeof e.field.name != "string")
|
|
1148
1161
|
return a.push(
|
|
1149
1162
|
b(
|
|
1150
1163
|
"filter_requires_field",
|
|
@@ -1275,7 +1288,7 @@ function gt(e) {
|
|
|
1275
1288
|
cardIds: t.filter((a) => !n.has(a))
|
|
1276
1289
|
};
|
|
1277
1290
|
}
|
|
1278
|
-
function
|
|
1291
|
+
function Ft(e) {
|
|
1279
1292
|
var v, y, c;
|
|
1280
1293
|
const t = [], n = _e(e);
|
|
1281
1294
|
for (const f of n.warnings)
|
|
@@ -1312,15 +1325,15 @@ function Dt(e) {
|
|
|
1312
1325
|
);
|
|
1313
1326
|
continue;
|
|
1314
1327
|
}
|
|
1315
|
-
const Z = he(V, s),
|
|
1316
|
-
m.id && a.set(m.id,
|
|
1328
|
+
const Z = he(V, s), M = `card-${Z}`;
|
|
1329
|
+
m.id && a.set(m.id, M), (c = i.get(Q)) == null || c.push(M);
|
|
1317
1330
|
const ge = m.analytics && "inputs" in m.analytics ? m.analytics.inputs : void 0;
|
|
1318
1331
|
for (const ee of ge || []) {
|
|
1319
1332
|
const te = d.get(ee.inputId) || [];
|
|
1320
|
-
te.push(
|
|
1333
|
+
te.push(M), d.set(ee.inputId, te);
|
|
1321
1334
|
}
|
|
1322
1335
|
o.push({
|
|
1323
|
-
id:
|
|
1336
|
+
id: M,
|
|
1324
1337
|
frameId: `frame-${Z}`,
|
|
1325
1338
|
title: m.title,
|
|
1326
1339
|
description: m.description,
|
|
@@ -1374,23 +1387,23 @@ function Dt(e) {
|
|
|
1374
1387
|
}
|
|
1375
1388
|
export {
|
|
1376
1389
|
be as DASHBOARD_AUTHORING_BREAKPOINTS,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1390
|
+
P as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
|
|
1391
|
+
At as applyDashboardChangePlan,
|
|
1392
|
+
Dt as compileDashboardFromPlan,
|
|
1380
1393
|
K as compileResponsiveDashboardLayouts,
|
|
1381
1394
|
H as dashboardAuthoringDatasetMatchesSource,
|
|
1382
|
-
|
|
1395
|
+
kt as dashboardAuthoringFieldsReferToSameTarget,
|
|
1383
1396
|
S as dashboardAuthoringSourceFromField,
|
|
1384
|
-
|
|
1397
|
+
St as dashboardAuthoringSourceKey,
|
|
1385
1398
|
ie as dashboardAuthoringSourcesReferToSameDataset,
|
|
1386
|
-
|
|
1387
|
-
|
|
1399
|
+
Ft as dashboardPlanFromSemaphorDashboardIntent,
|
|
1400
|
+
xt as findDashboardAuthoringDatasetForSource,
|
|
1388
1401
|
Me as getDashboardAuthoringCardSource,
|
|
1389
|
-
|
|
1402
|
+
T as isMaterializableDashboardAuthoringSource,
|
|
1390
1403
|
Se as isSemaphorSourceRef,
|
|
1391
|
-
|
|
1404
|
+
z as mergeDashboardAuthoringSources,
|
|
1392
1405
|
Ce as preferDashboardAuthoringSourceMetadata,
|
|
1393
|
-
|
|
1406
|
+
Ct as preferredDashboardAuthoringSource,
|
|
1394
1407
|
ke as resolveDashboardAuthoringSource,
|
|
1395
1408
|
Ne as validateDashboardAuthoringDatasetScope,
|
|
1396
1409
|
ze as validateDashboardChangePlan,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-CrKxP9uF.js"),x=require("../chunks/switch-k7kj6NRg.js"),Ye=require("../data-app-builder-browser-runtime/index.cjs"),Nn=require("../chunks/save-8A_q6K4E.js");function Fr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const An=Fr(p),Cn=Fr(kn);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -2,10 +2,10 @@ import { jsx as r, jsxs as c, Fragment as re } from "react/jsx-runtime";
|
|
|
2
2
|
import * as Yn from "react";
|
|
3
3
|
import { useContext as Zn, useState as x, useRef as oe, useMemo as ze, useEffect as W, useCallback as Ot } from "react";
|
|
4
4
|
import * as Xn from "react-dom/client";
|
|
5
|
-
import { ae as ea, af as ta, ag as Ir, ah as jr, ai as zr, aj as ra, ak as Wr, al as Hr, am as Jr, an as Vr, ao as _r, ap as Ur, aq as Gr, ar as na, as as aa, at as oa, au as Ht, av as on, x as Kr, aw as sa, ax as Vt, ay as _t, az as sn, aA as ia, aB as la, aC as da } from "../chunks/index-
|
|
6
|
-
import { c as $e, B as H, P as it, b as lt, d as dt, a1 as ca, a2 as ua, a3 as pa, a4 as ha, a5 as ma, X as Je, f as me, R as fa, e as Ut } from "../chunks/switch-
|
|
5
|
+
import { ae as ea, af as ta, ag as Ir, ah as jr, ai as zr, aj as ra, ak as Wr, al as Hr, am as Jr, an as Vr, ao as _r, ap as Ur, aq as Gr, ar as na, as as aa, at as oa, au as Ht, av as on, x as Kr, aw as sa, ax as Vt, ay as _t, az as sn, aA as ia, aB as la, aC as da } from "../chunks/index-BAsWLkZ8.js";
|
|
6
|
+
import { c as $e, B as H, P as it, b as lt, d as dt, a1 as ca, a2 as ua, a3 as pa, a4 as ha, a5 as ma, X as Je, f as me, R as fa, e as Ut } from "../chunks/switch-DArtNJZh.js";
|
|
7
7
|
import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
|
|
8
|
-
import { S as ga } from "../chunks/save-
|
|
8
|
+
import { S as ga } from "../chunks/save-DzciESDh.js";
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.453.0 - ISC
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../chunks/validation-BVpqRFar.js"),V=require("../chunks/index-BxM99sFL.js"),m=require("react"),N=require("react/jsx-runtime"),z=require("../chunks/validators-jpoYhpHh.js");require("../chunks/catalog-field-grounding-8L9I0zdg.js");const Q=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"],B=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"];function R(e){if(!e)return{};const t=F(e.executionResult),r=L(e,t),n=J(r);return{...e,...Object.keys(r).length?{resultSets:r}:{},...n?{columns:n.columns,records:n.records,rowCount:n.rowCount}:{}}}function L(e,t){const r=U(e.resultSets);for(const i of Q){if(r[i]){r[i]=M(r[i]);continue}const a=W(e[i]);if(!a.length)continue;const s=t.length?t:H(a);r[i]={records:O(a,s),columns:s,rowCount:a.length}}const n=Y(e.executionResult);return n&&n.records.length>0&&!r.records&&(r.records=n),r}function U(e){return Object.fromEntries(Object.entries(e||{}).map(([t,r])=>[t,M(r)]))}function M(e){var t;return{...e,records:O(e.records||[],e.columns||[]),rowCount:e.rowCount??((t=e.records)==null?void 0:t.length)??0}}function J(e){var t;for(const r of B)if((t=e[r])!=null&&t.records.length)return e[r];return Object.values(e).find(r=>r.records.length)||Object.values(e)[0]}function Y(e){const t=e==null?void 0:e.result;if(!(!t||t.kind!=="records"&&t.kind!=="sql"))return{records:O(t.records,t.columns),columns:t.columns,rowCount:t.rowCount??t.records.length}}function F(e){const t=e==null?void 0:e.result;return!t||t.kind!=="records"&&t.kind!=="sql"?[]:t.columns}function W(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object"&&!Array.isArray(t))):[]}function O(e,t){return t.length?e.map(r=>{const n={};return t.forEach((i,a)=>{const s=X(r,{name:i.key,label:i.label,fallbackNames:[i.name,Object.keys(r)[a]]});s!==void 0&&(n[i.key]=s)}),Object.keys(n).length?n:r}):e}function H(e){return Array.from(new Set(e.flatMap(r=>Object.keys(r)))).map(r=>({key:r,name:r,label:r}))}function X(e,t){const r=[t.name,t.label,...t.fallbackNames||[]].filter(n=>!!n);for(const n of r)if(Object.prototype.hasOwnProperty.call(e,n))return e[n]}function G(e){return e}function Z(e){return e}const ee={filter(e){return{...e,kind:"filter"}},control(e){return{...e,kind:"control"}},sqlParam(e){return{...e,kind:"control",role:"sqlParam"}},derivedField(e){return{...e,kind:"derived_field",expressionLanguage:e.expressionLanguage||"semaphor_sql_template"}},metric(e){return{...e,queryKind:"metric"}},analysis(e){return{...e,queryKind:"analysis"}},records(e){return{...e,queryKind:"records"}},inputOptions(e){return{...e,queryKind:"inputOptions"}},sql(e){return{...e,queryKind:"sql"}},matrix(e){return{...e,queryKind:"matrix"}}};function P(){return{executeAnalysis:(e,t,r)=>S(e,t,r??{}).then(R),executeMetric:(e,t)=>S(e,t),executeRecords:(e,t)=>S(e,t),executeInputOptions:(e,t)=>S(e,t),executeSql:(e,t)=>S(e,t),executeMatrix:(e,t)=>S(e,t)}}async function S(e,t,r){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const n=ue(t),i=te(e,n);let a;try{a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,...r?{analysisOptions:r}:{},resultShape:e.kind})})}catch(d){throw new Error(`${i}: ${d instanceof Error?d.message:String(d)}`)}const s=await oe(a);if(!a.ok||s.error)throw new Error(`${i}: ${s.error||`Semaphor Data App execution failed with status ${a.status}.`}`);return s}function te(e,t){return[`Semaphor ${e.kind} query`,e.id?`id=${e.id}`:void 0,e.label?`label=${e.label}`:void 0,re(e),`endpoint=${ne(t)}`].filter(r=>!!r).join(" ")}function re(e){const t="source"in e?e.source:void 0;if(!(!t||typeof t!="object")){if(t.kind==="semantic")return`source=${[t.domainId,t.datasetId||t.datasetName].filter(Boolean).join("/")}`;if(t.kind==="physical")return`source=${[t.connectionId,t.databaseName,t.schemaName,t.tableName].filter(Boolean).join("/")}`;if(t.kind==="sql")return t.connectionId?`source=${t.connectionId}`:void 0}}function ne(e){if(!e)return"/api/v1/data-app/execute";try{return new URL(e,"http://localhost").pathname}catch{return e}}async function oe(e){const t=await e.text().catch(()=>"");if(!t.trim())return e.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(t)}catch{return e.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:t}:{error:ie(e,t),details:t}}}function ie(e,t){const r=e.statusText?` ${e.statusText}`:"",n=t.replace(/\s+/g," ").trim();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}.`}function ue(e){const t=ae(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function ae(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return V.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const b=m.createContext({});function j(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function T(){return m.useContext(b)}function se({token:e,apiBaseUrl:t,executor:r,children:n}){var o;const i=j(),a=((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=m.useMemo(()=>P(),[]),c=r||d,l=m.useMemo(()=>({token:a,apiBaseUrl:s,executor:c}),[s,c,a]);return N.jsx(b.Provider,{value:l,children:n})}const g={value:null},x={},ce={records:[]},k={options:[]},le={records:[]},D={};function de(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),r=u.toSemaphorAnalysisQueryOptions(e);try{const n=u.toSemaphorAnalysisIntent(e),i=y(n);return i?{error:i,activeInputs:t,analysisOptions:r,queryKey:h(void 0,t,i,r),idleData:x}:{intent:n,error:null,activeInputs:t,analysisOptions:r,queryKey:h(n,t,void 0,r),idleData:x}}catch(n){const i=f(n);return{error:i,activeInputs:t,analysisOptions:r,queryKey:h(void 0,t,i,r),idleData:x}}}function pe(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const r=u.toSemaphorMetricIntent(e),n=y(r);return n?{error:n,activeInputs:t,queryKey:h(void 0,t,n),idleData:g}:{intent:r,error:null,activeInputs:t,queryKey:h(r,t),idleData:g}}catch(r){const n=f(r);return{error:n,activeInputs:t,queryKey:h(void 0,t,n),idleData:g}}}function me(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),r=ce;try{const n=u.toSemaphorRecordsIntent(e),i=y(n);return i?{error:i,activeInputs:t,queryKey:h(void 0,t,i),idleData:r}:{intent:n,error:null,activeInputs:t,queryKey:h(n,t),idleData:r}}catch(n){const i=f(n);return{error:i,activeInputs:t,queryKey:h(void 0,t,i),idleData:r}}}function he(e){try{const t=u.toSemaphorInputOptionsIntent(e),r=y(t);return r?{error:r,queryKey:h(void 0,void 0,r),idleData:k}:{intent:t,error:null,queryKey:h(t),idleData:k}}catch(t){const r=f(t);return{error:r,queryKey:h(void 0,void 0,r),idleData:k}}}function fe(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs),r=le;try{const n=u.toSemaphorSqlIntent(e),i=y(n);return i?{error:i,activeInputs:t,queryKey:h(void 0,t,i),idleData:r}:{intent:n,error:null,activeInputs:t,queryKey:h(n,t),idleData:r}}catch(n){const i=f(n);return{error:i,activeInputs:t,queryKey:h(void 0,t,i),idleData:r}}}function Se(e){const t=u.toSemaphorActiveInputSnapshots(e.inputs);try{const r=u.toSemaphorMatrixIntent(e),n=y(r);return n?{error:n,activeInputs:t,queryKey:h(void 0,t,n),idleData:D}:{intent:r,error:null,activeInputs:t,queryKey:h(r,t),idleData:D}}catch(r){const n=f(r);return{error:n,activeInputs:t,queryKey:h(void 0,t,n),idleData:D}}}function f(e){return e instanceof Error?e:new Error(String(e))}function y(e){const t=z.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const r=t.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${r}`)}function h(e,t,r,n){return JSON.stringify({intent:e,activeInputs:t,analysisOptions:n,error:r==null?void 0:r.message})}function ye(e){const[t,r]=m.useState(e.defaultValue),n=Object.prototype.hasOwnProperty.call(e,"value"),i=n?e.value:t,a=m.useMemo(()=>u.normalizeSemaphorInputOptions(e.options),[e.options]),s=m.useCallback(c=>{var o;const l=c;(o=e.onValueChange)==null||o.call(e,l),n||r(l)},[n,e]),d=m.useCallback(()=>s(void 0),[s]);return m.useMemo(()=>{const c=u.toSemaphorInputSpec(e);return{id:e.id,kind:e.kind,label:e.label,field:c.field,operator:c.operator,controlRole:e.kind==="control"?e.role:void 0,value:i,options:a,isActive:u.hasSemaphorInputValue(i),setValue:s,clear:d,toAnalyticsInput:()=>({inputId:c.inputId,field:c.field,kind:e.kind,label:e.label,value:i,isActive:u.hasSemaphorInputValue(i),operator:c.operator,controlRole:e.kind==="control"?e.role:void 0})}},[d,a,s,e,i])}function ve(e){const[t,r]=m.useState(()=>Ae(e));return m.useEffect(()=>{r(n=>{let i=n;for(const a of e)!Object.prototype.hasOwnProperty.call(i,a.id)&&a.defaultValue!==void 0&&(i={...i,[a.id]:a.defaultValue});return i})},[e]),m.useMemo(()=>e.map(n=>{const i=Object.prototype.hasOwnProperty.call(n,"value"),a=i?n.value:t[n.id],s=u.normalizeSemaphorInputOptions(n.options),d=o=>{var p;(p=n.onValueChange)==null||p.call(n,o),i||r(v=>({...v,[n.id]:o}))},c=()=>d(void 0),l=u.toSemaphorInputSpec(n);return{id:n.id,kind:n.kind,label:n.label,field:l.field,operator:l.operator,controlRole:n.kind==="control"?n.role:void 0,value:a,options:s,isActive:u.hasSemaphorInputValue(a),setValue:d,clear:c,toAnalyticsInput:()=>({inputId:l.inputId,field:l.field,kind:n.kind,label:n.label,value:a,isActive:u.hasSemaphorInputValue(a),operator:l.operator,controlRole:n.kind==="control"?n.role:void 0})}}),[e,t])}function qe(e,t={}){const r=m.useMemo(()=>t.inputs?{...e,inputs:t.inputs}:e,[t.inputs,e]),n=m.useMemo(()=>{switch(r.queryKind){case"metric":return{queryKind:r.queryKind,request:pe(r)};case"analysis":return{queryKind:r.queryKind,request:de(r)};case"records":return{queryKind:r.queryKind,request:me(r)};case"inputOptions":return{queryKind:r.queryKind,request:he(r)};case"sql":return{queryKind:r.queryKind,request:fe(r)};case"matrix":return{queryKind:r.queryKind,request:Se(r)};default:return E(r)}},[r]),i=m.useCallback(o=>{var v,q,K,w,C,I,$,A,_;const p=n.request;if(p.intent)switch(n.queryKind){case"metric":return(v=o.executor)==null?void 0:v.executeMetric(p.intent,o);case"analysis":return(K=(q=o.executor)==null?void 0:q.executeAnalysis)==null?void 0:K.call(q,p.intent,o,p.analysisOptions);case"records":return(w=o.executor)==null?void 0:w.executeRecords(p.intent,o);case"inputOptions":return(C=o.executor)==null?void 0:C.executeInputOptions(p.intent,o);case"sql":return($=(I=o.executor)==null?void 0:I.executeSql)==null?void 0:$.call(I,p.intent,o);case"matrix":return(_=(A=o.executor)==null?void 0:A.executeMatrix)==null?void 0:_.call(A,p.intent,o);default:return E(n)}},[n]),a=Ie(n.request.queryKey,i,n.request.idleData,n.request.activeInputs),s=n.request.error?n.request.idleData:a.data,d=n.request.error?"error":a.status,c=!n.request.error&&a.status==="loading",l=n.request.error||a.error;switch(n.queryKind){case"metric":{const o=s;return{id:r.id,intent:n.request.intent,value:(o==null?void 0:o.value)??null,metrics:o==null?void 0:o.metrics,comparisonValue:o==null?void 0:o.comparisonValue,delta:o==null?void 0:o.delta,deltaPercent:o==null?void 0:o.deltaPercent,records:o==null?void 0:o.records,executionResult:o==null?void 0:o.executionResult,status:d,isLoading:c,error:l}}case"analysis":{const o=R(s);return{id:r.id,intent:n.request.intent,...o||{},status:d,isLoading:c,error:l}}case"records":{const o=s;return{id:r.id,intent:n.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,executionResult:o==null?void 0:o.executionResult,status:d,isLoading:c,error:l}}case"inputOptions":{const o=s;return{id:r.id,intent:n.request.intent,options:(o==null?void 0:o.options)||[],executionResult:o==null?void 0:o.executionResult,status:d,isLoading:c,error:l}}case"sql":{const o=s;return{id:r.id,intent:n.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,output:o==null?void 0:o.output,rowLimitExceeded:o==null?void 0:o.rowLimitExceeded,executionResult:o==null?void 0:o.executionResult,status:d,isLoading:c,error:l}}case"matrix":{const o=s;return{id:r.id,intent:n.request.intent,matrixResult:o==null?void 0:o.matrixResult,grid:o==null?void 0:o.grid,expansion:o==null?void 0:o.expansion,executionResult:o==null?void 0:o.executionResult,status:d,isLoading:c,error:l}}default:return E(n)}}function Ie(e,t,r,n){const i=T(),a=m.useRef(t),s=m.useRef(n),[d,c]=m.useState({status:"idle",data:r,error:null});return a.current=t,s.current=n,m.useEffect(()=>{let l;try{l=a.current({...i,activeInputs:s.current})}catch(p){c({status:"error",data:r,error:f(p)});return}if(!l){c({status:"idle",data:r,error:null});return}let o=!1;return c(p=>({status:"loading",data:p.data,error:null})),l.then(p=>{o||c({status:"success",data:p,error:null})}).catch(p=>{o||c({status:"error",data:r,error:f(p)})}),()=>{o=!0}},[r,e,i]),d}function Ae(e){return Object.fromEntries(e.filter(t=>t.defaultValue!==void 0).map(t=>[t.id,t.defaultValue]))}function E(e){throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`)}exports.hasSemaphorInputValue=u.hasSemaphorInputValue;exports.normalizeSemaphorAnalysisQueryOptions=u.normalizeSemaphorAnalysisQueryOptions;exports.normalizeSemaphorInputOptions=u.normalizeSemaphorInputOptions;exports.toSemaphorActiveInputSnapshots=u.toSemaphorActiveInputSnapshots;exports.toSemaphorAnalysisIntent=u.toSemaphorAnalysisIntent;exports.toSemaphorAnalysisQueryOptions=u.toSemaphorAnalysisQueryOptions;exports.toSemaphorInputBinding=u.toSemaphorInputBinding;exports.toSemaphorInputBindings=u.toSemaphorInputBindings;exports.toSemaphorInputOptionsIntent=u.toSemaphorInputOptionsIntent;exports.toSemaphorInputSnapshots=u.toSemaphorInputSnapshots;exports.toSemaphorInputSpec=u.toSemaphorInputSpec;exports.toSemaphorMatrixIntent=u.toSemaphorMatrixIntent;exports.toSemaphorMetricIntent=u.toSemaphorMetricIntent;exports.toSemaphorRecordsIntent=u.toSemaphorRecordsIntent;exports.toSemaphorSqlIntent=u.toSemaphorSqlIntent;exports.validateSemaphorDataAppQuerySpecs=u.validateSemaphorDataAppQuerySpecs;exports.SemaphorDataAppContext=b;exports.SemaphorDataAppProvider=se;exports.createSemaphorQueryExecutor=P;exports.defineSemaphorDataApp=G;exports.defineSemaphorInput=Z;exports.normalizeSemaphorAnalysisPayload=R;exports.readWindowRuntime=j;exports.semaphor=ee;exports.useSemaphorDataAppRuntime=T;exports.useSemaphorInput=ye;exports.useSemaphorInputs=ve;exports.useSemaphorQuery=qe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../data-app-sdk-adapters/index.cjs"),N=require("../chunks/index-BxM99sFL.js"),d=require("react"),L=require("../chunks/validators-lWo8m0Q7.js");require("../chunks/analyze-result-contract-CtXfp3nv.js");const U=require("react/jsx-runtime");function k(e,t,n={}){return{...n,name:e,role:t}}function z(e){return e}function B(e){return e}const H={source:{semantic(e){return{...e,kind:"semantic"}},sql(e){return{...e,kind:"sql"}}},field:{measure(e,t){return k(e,"measure",t)},dimension(e,t){return k(e,"dimension",t)},date(e,t){return k(e,"date",t)},id(e,t){return k(e,"id",t)}},filter(e){return{...e,kind:"filter"}},bindInput(e,t){return{toAnalyticsInput(){const[n]=c.toSemaphorInputSnapshots([e]),r=c.toSemaphorInputBinding({...t,inputId:t.inputId||n.inputId});return{...n,inputId:r.inputId,...r.kind?{kind:r.kind}:{},...r.controlRole?{controlRole:r.controlRole}:{},...r.operator?{operator:r.operator}:{},...r.field?{field:r.field}:{},...r.relationshipHint?{relationshipHint:r.relationshipHint}:{}}}}},control(e){return{...e,kind:"control"}},sqlParam(e){return{...e,kind:"control",role:"sqlParam"}},derivedField(e){return{...e,kind:"derived_field",expressionLanguage:e.expressionLanguage||"semaphor_sql_template"}},metric(e){return{...e,queryKind:"metric"}},analysis(e){return{...e,queryKind:"analysis"}},records(e){return{...e,queryKind:"records"}},inputOptions(e){return{...e,queryKind:"inputOptions"}},sql(e){return{...e,queryKind:"sql"}},matrix(e){return{...e,queryKind:"matrix"}}},Q=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"],F=["records","changes","drivers","largestNegativeChanges","largestPositiveChanges","largestNegativeDrivers","largestPositiveDrivers"];function _(e){if(!e)return{};const t=G(e.executionResult),n=J(e,t),r=W(n);return{...e,...Object.keys(n).length?{resultSets:n}:{},...r?{columns:r.columns,records:r.records,rowCount:r.rowCount}:{}}}function J(e,t){const n=Y(e.resultSets);for(const i of Q){if(n[i]){n[i]=j(n[i]);continue}const u=Z(e[i]);if(!u.length)continue;const s=t.length?t:ee(u);n[i]={records:K(u,s),columns:s,rowCount:u.length}}const r=X(e.executionResult);return r&&r.records.length>0&&!n.records&&(n.records=r),n}function Y(e){return Object.fromEntries(Object.entries(e||{}).map(([t,n])=>[t,j(n)]))}function j(e){var t;return{...e,records:K(e.records||[],e.columns||[]),rowCount:e.rowCount??((t=e.records)==null?void 0:t.length)??0}}function W(e){var t;for(const n of F)if((t=e[n])!=null&&t.records.length)return e[n];return Object.values(e).find(n=>n.records.length)||Object.values(e)[0]}function X(e){const t=e==null?void 0:e.result;if(!(!t||t.kind!=="records"&&t.kind!=="sql"))return{records:K(t.records,t.columns),columns:t.columns,rowCount:t.rowCount??t.records.length}}function G(e){const t=e==null?void 0:e.result;return!t||t.kind!=="records"&&t.kind!=="sql"?[]:t.columns}function Z(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object"&&!Array.isArray(t))):[]}function K(e,t){return t.length?e.map(n=>{const r={};return t.forEach((i,u)=>{const s=te(n,{name:i.key,label:i.label,fallbackNames:[i.name,Object.keys(n)[u]]});s!==void 0&&(r[i.key]=s)}),Object.keys(r).length?r:n}):e}function ee(e){return Array.from(new Set(e.flatMap(n=>Object.keys(n)))).map(n=>({key:n,name:n,label:n}))}function te(e,t){const n=[t.name,t.label,...t.fallbackNames||[]].filter(r=>!!r);for(const r of n)if(Object.prototype.hasOwnProperty.call(e,r))return e[r]}function P(){return{executeAnalysis:(e,t,n)=>v(e,t,n??{}).then(_),executeMetric:(e,t)=>v(e,t),executeRecords:(e,t)=>v(e,t),executeInputOptions:(e,t)=>v(e,t),executeSql:(e,t)=>v(e,t),executeMatrix:(e,t)=>v(e,t)}}async function v(e,t,n){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const r=se(t),i=re(e,r);let u;try{u=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,...n?{analysisOptions:n}:{},resultShape:e.kind})})}catch(p){throw new Error(`${i}: ${p instanceof Error?p.message:String(p)}`)}const s=await ie(u);if(!u.ok||s.error)throw new Error(`${i}: ${s.error||`Semaphor Data App execution failed with status ${u.status}.`}`);return s}function re(e,t){return[`Semaphor ${e.kind} query`,e.id?`id=${e.id}`:void 0,e.label?`label=${e.label}`:void 0,ne(e),`endpoint=${oe(t)}`].filter(n=>!!n).join(" ")}function ne(e){const t="source"in e?e.source:void 0;if(!(!t||typeof t!="object")){if(t.kind==="semantic")return`source=${[t.domainId,t.datasetId||t.datasetName].filter(Boolean).join("/")}`;if(t.kind==="physical")return`source=${[t.connectionId,t.databaseName,t.schemaName,t.tableName].filter(Boolean).join("/")}`;if(t.kind==="sql")return t.connectionId?`source=${t.connectionId}`:void 0}}function oe(e){if(!e)return"/api/v1/data-app/execute";try{return new URL(e,"http://localhost").pathname}catch{return e}}async function ie(e){const t=await e.text().catch(()=>"");if(!t.trim())return e.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(t)}catch{return e.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:t}:{error:ue(e,t),details:t}}}function ue(e,t){const n=e.statusText?` ${e.statusText}`:"",r=t.replace(/\s+/g," ").trim();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}.`}function se(e){const t=ae(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function ae(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return N.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const T=d.createContext({});function ce(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function le(){return d.useContext(T)}const g={value:null},x={},de={records:[]},E={options:[]},pe={records:[]},D={};function fe(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs),n=c.toSemaphorAnalysisQueryOptions(e);try{const r=c.toSemaphorAnalysisIntent(e),i=y(r);return i?{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}:{intent:r,error:null,activeInputs:t,analysisOptions:n,queryKey:m(r,t,void 0,n),idleData:x}}catch(r){const i=h(r);return{error:i,activeInputs:t,analysisOptions:n,queryKey:m(void 0,t,i,n),idleData:x}}}function me(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs);try{const n=c.toSemaphorMetricIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:g}}catch(n){const r=h(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:g}}}function he(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs),n=de;try{const r=c.toSemaphorRecordsIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=h(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function ve(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs);try{const n=c.toSemaphorInputOptionsIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:E}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:E}}catch(n){const r=h(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:E}}}function ye(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs),n=pe;try{const r=c.toSemaphorSqlIntent(e),i=y(r);return i?{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}:{intent:r,error:null,activeInputs:t,queryKey:m(r,t),idleData:n}}catch(r){const i=h(r);return{error:i,activeInputs:t,queryKey:m(void 0,t,i),idleData:n}}}function Se(e){const t=c.toSemaphorActiveInputSnapshots(e.inputs);try{const n=c.toSemaphorMatrixIntent(e),r=y(n);return r?{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:D}:{intent:n,error:null,activeInputs:t,queryKey:m(n,t),idleData:D}}catch(n){const r=h(n);return{error:r,activeInputs:t,queryKey:m(void 0,t,r),idleData:D}}}function h(e){return e instanceof Error?e:new Error(String(e))}function y(e){const t=L.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const n=t.errors.map(r=>r.path?`${r.code} at ${r.path}: ${r.message}`:`${r.code}: ${r.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${n}`)}function m(e,t,n,r){return JSON.stringify({intent:e,activeInputs:t,analysisOptions:r,error:n==null?void 0:n.message})}function qe(e){const[t,n]=d.useState(e.defaultValue),r=Object.prototype.hasOwnProperty.call(e,"value"),i=r?e.value:t,u=d.useMemo(()=>c.normalizeSemaphorInputOptions(e.options),[e.options]),s=d.useCallback(a=>{var o;const l=a;(o=e.onValueChange)==null||o.call(e,l),r||n(l)},[r,e]),p=d.useCallback(()=>s(void 0),[s]);return d.useMemo(()=>{const a=c.toSemaphorInputSpec(e);return{id:e.id,kind:e.kind,label:e.label,field:a.field,operator:a.operator,relationshipHint:a.relationshipHint,controlRole:e.kind==="control"?e.role:void 0,value:i,options:u,isActive:c.hasSemaphorInputValue(i),setValue:s,clear:p,toAnalyticsInput:()=>({inputId:a.inputId,field:a.field,kind:e.kind,label:e.label,value:i,isActive:c.hasSemaphorInputValue(i),operator:a.operator,relationshipHint:a.relationshipHint,controlRole:e.kind==="control"?e.role:void 0})}},[p,u,s,e,i])}function Ie(e){const[t,n]=d.useState(()=>Ee(e));return d.useEffect(()=>{n(r=>{let i=r;for(const u of e)!Object.prototype.hasOwnProperty.call(i,u.id)&&u.defaultValue!==void 0&&(i={...i,[u.id]:u.defaultValue});return i})},[e]),d.useMemo(()=>e.map(r=>{const i=Object.prototype.hasOwnProperty.call(r,"value"),u=i?r.value:t[r.id],s=c.normalizeSemaphorInputOptions(r.options),p=o=>{var f;(f=r.onValueChange)==null||f.call(r,o),i||n(S=>({...S,[r.id]:o}))},a=()=>p(void 0),l=c.toSemaphorInputSpec(r);return{id:r.id,kind:r.kind,label:r.label,field:l.field,operator:l.operator,relationshipHint:l.relationshipHint,controlRole:r.kind==="control"?r.role:void 0,value:u,options:s,isActive:c.hasSemaphorInputValue(u),setValue:p,clear:a,toAnalyticsInput:()=>({inputId:l.inputId,field:l.field,kind:r.kind,label:r.label,value:u,isActive:c.hasSemaphorInputValue(u),operator:l.operator,relationshipHint:l.relationshipHint,controlRole:r.kind==="control"?r.role:void 0})}}),[e,t])}function Ae(e,t){const n=(t==null?void 0:t.status)==="success"?t.options:void 0,r=d.useMemo(()=>ke(n),[n]);d.useEffect(()=>{M(e.value,n)||e.clear()},[e,r,t==null?void 0:t.status,n])}function M(e,t){if(!c.hasSemaphorInputValue(e)||t===void 0)return!0;const n=new Set(t.map(i=>$(i.value)));return(Array.isArray(e)?e:[e]).every(i=>n.has($(i)))}function ke(e){return JSON.stringify((e||[]).map(t=>t.value))}function $(e){return`${typeof e}:${String(e)}`}function ge(e,t={}){const n=d.useMemo(()=>t.inputs?{...e,inputs:t.inputs}:e,[t.inputs,e]),r=d.useMemo(()=>{switch(n.queryKind){case"metric":return{queryKind:n.queryKind,request:me(n)};case"analysis":return{queryKind:n.queryKind,request:fe(n)};case"records":return{queryKind:n.queryKind,request:he(n)};case"inputOptions":return{queryKind:n.queryKind,request:ve(n)};case"sql":return{queryKind:n.queryKind,request:ye(n)};case"matrix":return{queryKind:n.queryKind,request:Se(n)};default:return b(n)}},[n]),i=d.useCallback(o=>{var S,q,O,R,w,I,C,A,V;const f=r.request;if(f.intent)switch(r.queryKind){case"metric":return(S=o.executor)==null?void 0:S.executeMetric(f.intent,o);case"analysis":return(O=(q=o.executor)==null?void 0:q.executeAnalysis)==null?void 0:O.call(q,f.intent,o,f.analysisOptions);case"records":return(R=o.executor)==null?void 0:R.executeRecords(f.intent,o);case"inputOptions":return(w=o.executor)==null?void 0:w.executeInputOptions(f.intent,o);case"sql":return(C=(I=o.executor)==null?void 0:I.executeSql)==null?void 0:C.call(I,f.intent,o);case"matrix":return(V=(A=o.executor)==null?void 0:A.executeMatrix)==null?void 0:V.call(A,f.intent,o);default:return b(r)}},[r]),u=xe(r.request.queryKey,i,r.request.idleData,r.request.activeInputs),s=r.request.error?r.request.idleData:u.data,p=r.request.error?"error":u.status,a=!r.request.error&&u.status==="loading",l=r.request.error||u.error;switch(r.queryKind){case"metric":{const o=s;return{id:n.id,intent:r.request.intent,value:(o==null?void 0:o.value)??null,measures:o==null?void 0:o.measures,comparisonValue:o==null?void 0:o.comparisonValue,delta:o==null?void 0:o.delta,deltaPercent:o==null?void 0:o.deltaPercent,records:o==null?void 0:o.records,executionResult:o==null?void 0:o.executionResult,status:p,isLoading:a,error:l}}case"analysis":{const o=_(s);return{id:n.id,intent:r.request.intent,...o||{},status:p,isLoading:a,error:l}}case"records":{const o=s;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,executionResult:o==null?void 0:o.executionResult,status:p,isLoading:a,error:l}}case"inputOptions":{const o=s;return{id:n.id,intent:r.request.intent,options:(o==null?void 0:o.options)||[],executionResult:o==null?void 0:o.executionResult,status:p,isLoading:a,error:l}}case"sql":{const o=s;return{id:n.id,intent:r.request.intent,records:(o==null?void 0:o.records)||[],columns:o==null?void 0:o.columns,rowCount:o==null?void 0:o.rowCount,pagination:o==null?void 0:o.pagination,output:o==null?void 0:o.output,rowLimitExceeded:o==null?void 0:o.rowLimitExceeded,executionResult:o==null?void 0:o.executionResult,status:p,isLoading:a,error:l}}case"matrix":{const o=s;return{id:n.id,intent:r.request.intent,matrixResult:o==null?void 0:o.matrixResult,grid:o==null?void 0:o.grid,expansion:o==null?void 0:o.expansion,executionResult:o==null?void 0:o.executionResult,status:p,isLoading:a,error:l}}default:return b(r)}}function xe(e,t,n,r){const i=le(),u=d.useRef(t),s=d.useRef(r),[p,a]=d.useState({status:"idle",data:n,error:null});return u.current=t,s.current=r,d.useEffect(()=>{let l;try{l=u.current({...i,activeInputs:s.current})}catch(f){a({status:"error",data:n,error:h(f)});return}if(!l){a({status:"idle",data:n,error:null});return}let o=!1;return a(f=>({status:"loading",data:f.data,error:null})),l.then(f=>{o||a({status:"success",data:f,error:null})}).catch(f=>{o||a({status:"error",data:n,error:h(f)})}),()=>{o=!0}},[n,e,i]),p}function Ee(e){return Object.fromEntries(e.filter(t=>t.defaultValue!==void 0).map(t=>[t.id,t.defaultValue]))}function b(e){throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`)}function De({token:e,apiBaseUrl:t,executor:n,children:r}){var o;const i=ce(),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,p=d.useMemo(()=>P(),[]),a=n||p,l=d.useMemo(()=>({token:u,apiBaseUrl:s,executor:a}),[s,a,u]);return U.jsx(T.Provider,{value:l,children:r})}exports.SemaphorDataAppProvider=De;exports.createSemaphorQueryExecutor=P;exports.defineSemaphorDataApp=z;exports.defineSemaphorInput=B;exports.isSemaphorInputValueValidForOptions=M;exports.semaphor=H;exports.useClearInvalidSemaphorInputValue=Ae;exports.useSemaphorInput=qe;exports.useSemaphorInputs=Ie;exports.useSemaphorQuery=ge;
|