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