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