react-semaphor 0.1.358 → 0.1.360
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/chunks/{calendar-preferences-dialog-DGA5mlpS.js → calendar-preferences-dialog-BEKBpwMY.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BzAHg2dH.js → calendar-preferences-dialog-GwtaSN53.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BV4oNYVr.js → dashboard-briefing-launcher-D6gGO5wz.js} +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-Cx8GVVDP.js → dashboard-briefing-launcher-DYxd4856.js} +1 -1
- package/dist/chunks/{dashboard-controls-Aqn8jM53.js → dashboard-controls-B4u5RsKl.js} +3 -3
- package/dist/chunks/{dashboard-controls-2Yydgr4q.js → dashboard-controls-C_rExqPw.js} +1 -1
- package/dist/chunks/{dashboard-json-D0Pc1dwB.js → dashboard-json-BWWU6a7V.js} +1 -1
- package/dist/chunks/{dashboard-json-DCDAthMc.js → dashboard-json-CPGTofhm.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-C-yLMahk.js → edit-dashboard-visual-D_jZ-iix.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BdVNDANy.js → edit-dashboard-visual-biMO829J.js} +3 -3
- package/dist/chunks/{index-Cs6rC7Qx.js → index-CJ2IEuKz.js} +31372 -31127
- package/dist/chunks/index-Db1XVmfU.js +1411 -0
- package/dist/chunks/{resource-management-panel-CuFOHM8_.js → resource-management-panel-B9-5VHYe.js} +2 -2
- package/dist/chunks/{resource-management-panel-D6zRXAE_.js → resource-management-panel-Bam-yvnt.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-dPApJpMV.js → use-create-flow-overlay-state-DAvEqaJV.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-CcAzq169.js → use-create-flow-overlay-state-dhxgdLYo.js} +1 -1
- package/dist/chunks/{use-visual-utils-Dg4iuSLu.js → use-visual-utils-CAKdXsr5.js} +1 -1
- package/dist/chunks/{use-visual-utils-BUSgtvLJ.js → use-visual-utils-FoHNPwpu.js} +1 -1
- package/dist/chunks/validation-C_WDLZdp.js +1 -0
- package/dist/chunks/validation-McK0uXpV.js +669 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- 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 +308 -440
- package/dist/data-app-sdk-validation/index.cjs +1 -0
- package/dist/data-app-sdk-validation/index.js +7 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/data-app-builder.d.ts +68 -9
- package/dist/types/data-app-sdk-validation.d.ts +595 -0
- package/dist/types/data-app-sdk.d.ts +333 -0
- package/package.json +6 -1
- package/dist/chunks/index-BMQsLAi3.js +0 -1410
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import { v as x } from "./validators-BnLhuIhd.js";
|
|
2
|
+
import { s as S, c as F, b as A } from "./source-identity-qAmkNtEK.js";
|
|
3
|
+
function M(e) {
|
|
4
|
+
var r;
|
|
5
|
+
const t = R(e);
|
|
6
|
+
return {
|
|
7
|
+
version: 1,
|
|
8
|
+
kind: "metric",
|
|
9
|
+
id: e.id,
|
|
10
|
+
label: e.label,
|
|
11
|
+
source: h(e),
|
|
12
|
+
metrics: t,
|
|
13
|
+
primaryMetric: P(e, t),
|
|
14
|
+
dateField: e.dateField ? a(e.dateField, "date") : void 0,
|
|
15
|
+
timeGrain: e.timeGrain,
|
|
16
|
+
dimensions: (r = e.dimensions) == null ? void 0 : r.map((i) => a(i, "dimension")),
|
|
17
|
+
comparison: W(e.comparison),
|
|
18
|
+
orderBy: e.orderBy ? {
|
|
19
|
+
field: a(e.orderBy.field),
|
|
20
|
+
direction: e.orderBy.direction
|
|
21
|
+
} : void 0,
|
|
22
|
+
inputs: p(e.inputs),
|
|
23
|
+
limit: e.limit
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function T(e) {
|
|
27
|
+
var r;
|
|
28
|
+
return {
|
|
29
|
+
...M(e),
|
|
30
|
+
...e.timeWindow ? { timeWindow: e.timeWindow } : {},
|
|
31
|
+
...(r = e.filters) != null && r.length ? { filters: e.filters } : {},
|
|
32
|
+
...e.analysis ? { analysis: e.analysis } : {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function le(e) {
|
|
36
|
+
return {
|
|
37
|
+
...e.chartTitle ? { chartTitle: e.chartTitle } : {},
|
|
38
|
+
...e.chartType ? { chartType: e.chartType } : {},
|
|
39
|
+
...e.driverMode ? { driverMode: e.driverMode } : {},
|
|
40
|
+
...e.includePopulation !== void 0 ? { includePopulation: e.includePopulation } : {},
|
|
41
|
+
...e.calendarContext ? { calendarContext: e.calendarContext } : {}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function P(e, t) {
|
|
45
|
+
if (!e.primaryMetric)
|
|
46
|
+
return t[0] || { name: "", role: "measure" };
|
|
47
|
+
const r = a(e.primaryMetric, "measure"), i = H(r, t), o = i.length === 1 ? i[0] : void 0;
|
|
48
|
+
return o ? b(r, o) : r;
|
|
49
|
+
}
|
|
50
|
+
function R(e) {
|
|
51
|
+
const t = [];
|
|
52
|
+
for (const r of e.metrics.map((i) => a(i, "measure"))) {
|
|
53
|
+
if (!r.name)
|
|
54
|
+
continue;
|
|
55
|
+
const i = t.findIndex(
|
|
56
|
+
(o) => z(o, r)
|
|
57
|
+
);
|
|
58
|
+
if (i === -1) {
|
|
59
|
+
t.push(r);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
t[i] = b(t[i], r);
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
function z(e, t) {
|
|
67
|
+
return S(e, t) && c(e) === c(t);
|
|
68
|
+
}
|
|
69
|
+
function B(e, t) {
|
|
70
|
+
return c(t) === c(e);
|
|
71
|
+
}
|
|
72
|
+
function D(e, t) {
|
|
73
|
+
return t.name !== e.name || e.source && !S(t, e) ? !1 : B(e, t);
|
|
74
|
+
}
|
|
75
|
+
function H(e, t) {
|
|
76
|
+
const r = t.filter(
|
|
77
|
+
(i) => D(e, i)
|
|
78
|
+
);
|
|
79
|
+
return e.aggregate !== void 0, r;
|
|
80
|
+
}
|
|
81
|
+
function c(e) {
|
|
82
|
+
return (e.aggregate || "SUM").toUpperCase();
|
|
83
|
+
}
|
|
84
|
+
function b(e, t) {
|
|
85
|
+
if (e.aggregate && t.aggregate && e.aggregate !== t.aggregate)
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${t.aggregate}.`
|
|
88
|
+
);
|
|
89
|
+
return {
|
|
90
|
+
...F(e, t),
|
|
91
|
+
aggregate: e.aggregate || t.aggregate
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function O(e) {
|
|
95
|
+
if ("sort" in e)
|
|
96
|
+
throw new Error(
|
|
97
|
+
"useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
|
|
98
|
+
);
|
|
99
|
+
if (!V(e))
|
|
100
|
+
throw new Error(
|
|
101
|
+
"useSemaphorRecords needs at least one field."
|
|
102
|
+
);
|
|
103
|
+
const t = j(e.fields);
|
|
104
|
+
return {
|
|
105
|
+
version: 1,
|
|
106
|
+
kind: "records",
|
|
107
|
+
id: e.id,
|
|
108
|
+
label: e.label,
|
|
109
|
+
source: h(e),
|
|
110
|
+
fields: t,
|
|
111
|
+
dateField: e.dateField ? a(e.dateField, "date") : void 0,
|
|
112
|
+
timeGrain: e.timeGrain,
|
|
113
|
+
orderBy: e.orderBy ? {
|
|
114
|
+
field: a(e.orderBy.field),
|
|
115
|
+
direction: e.orderBy.direction
|
|
116
|
+
} : void 0,
|
|
117
|
+
inputs: p(e.inputs),
|
|
118
|
+
limit: e.limit
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function j(e) {
|
|
122
|
+
return e.map((t) => {
|
|
123
|
+
const r = a(t);
|
|
124
|
+
if (!r.role)
|
|
125
|
+
throw new Error(
|
|
126
|
+
`useSemaphorRecords field "${r.name}" needs an explicit role.`
|
|
127
|
+
);
|
|
128
|
+
return r;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function N(e) {
|
|
132
|
+
return {
|
|
133
|
+
version: 1,
|
|
134
|
+
kind: "inputOptions",
|
|
135
|
+
id: e.id,
|
|
136
|
+
label: e.label,
|
|
137
|
+
source: h(e),
|
|
138
|
+
field: a(e.field, "dimension"),
|
|
139
|
+
search: e.search,
|
|
140
|
+
limit: e.limit
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function q(e) {
|
|
144
|
+
if ("toAnalyticsInput" in e) {
|
|
145
|
+
const t = e.toAnalyticsInput();
|
|
146
|
+
return {
|
|
147
|
+
inputId: t.inputId,
|
|
148
|
+
...t.field ? { field: t.field } : {}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
inputId: e.inputId,
|
|
153
|
+
...e.field ? { field: e.field } : {}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function ce(e) {
|
|
157
|
+
const t = p(e);
|
|
158
|
+
return t.length > 0 ? t : void 0;
|
|
159
|
+
}
|
|
160
|
+
function E(e) {
|
|
161
|
+
return (e || []).map(G);
|
|
162
|
+
}
|
|
163
|
+
function fe(e) {
|
|
164
|
+
return E(e).filter((t) => t.isActive);
|
|
165
|
+
}
|
|
166
|
+
function ue(e) {
|
|
167
|
+
return e.kind === "filter" ? {
|
|
168
|
+
inputId: e.id,
|
|
169
|
+
kind: e.kind,
|
|
170
|
+
label: e.label,
|
|
171
|
+
field: a(e.field, "dimension"),
|
|
172
|
+
operator: e.operator || "in"
|
|
173
|
+
} : {
|
|
174
|
+
inputId: e.id,
|
|
175
|
+
kind: e.kind,
|
|
176
|
+
label: e.label
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function me(e = []) {
|
|
180
|
+
return e.map(
|
|
181
|
+
(t) => typeof t == "object" ? t : {
|
|
182
|
+
label: String(t),
|
|
183
|
+
value: t
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
function U(e) {
|
|
188
|
+
return e == null ? !1 : Array.isArray(e) ? e.length > 0 : typeof e == "string" ? e.trim().length > 0 : !0;
|
|
189
|
+
}
|
|
190
|
+
function G(e) {
|
|
191
|
+
return "toAnalyticsInput" in e ? e.toAnalyticsInput() : "kind" in e && "isActive" in e ? e : {
|
|
192
|
+
...e,
|
|
193
|
+
kind: "filter",
|
|
194
|
+
isActive: U(
|
|
195
|
+
e.value
|
|
196
|
+
),
|
|
197
|
+
value: e.value
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function h(e) {
|
|
201
|
+
return e.source;
|
|
202
|
+
}
|
|
203
|
+
function V(e) {
|
|
204
|
+
var t;
|
|
205
|
+
return !!((t = e.fields) != null && t.length);
|
|
206
|
+
}
|
|
207
|
+
function a(e, t) {
|
|
208
|
+
return {
|
|
209
|
+
...e,
|
|
210
|
+
role: e.role || t
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function p(e) {
|
|
214
|
+
return (e || []).map(q);
|
|
215
|
+
}
|
|
216
|
+
function W(e) {
|
|
217
|
+
if (e)
|
|
218
|
+
return e;
|
|
219
|
+
}
|
|
220
|
+
function K(e, t = {}) {
|
|
221
|
+
const r = t.pathPrefix || "analysisOptions";
|
|
222
|
+
if (e === void 0)
|
|
223
|
+
return { ok: !0 };
|
|
224
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
225
|
+
return s(
|
|
226
|
+
r,
|
|
227
|
+
"Data App analysis options must be an object."
|
|
228
|
+
);
|
|
229
|
+
const i = e, o = {};
|
|
230
|
+
if (i.chartTitle !== void 0) {
|
|
231
|
+
if (typeof i.chartTitle != "string")
|
|
232
|
+
return s(
|
|
233
|
+
`${r}.chartTitle`,
|
|
234
|
+
'Data App analysis option "chartTitle" must be a string.'
|
|
235
|
+
);
|
|
236
|
+
o.chartTitle = i.chartTitle;
|
|
237
|
+
}
|
|
238
|
+
if (i.chartType !== void 0) {
|
|
239
|
+
if (typeof i.chartType != "string")
|
|
240
|
+
return s(
|
|
241
|
+
`${r}.chartType`,
|
|
242
|
+
'Data App analysis option "chartType" must be a string.'
|
|
243
|
+
);
|
|
244
|
+
o.chartType = i.chartType;
|
|
245
|
+
}
|
|
246
|
+
if (i.driverMode !== void 0) {
|
|
247
|
+
if (!L(i.driverMode))
|
|
248
|
+
return s(
|
|
249
|
+
`${r}.driverMode`,
|
|
250
|
+
'Data App analysis option "driverMode" must be absolute_delta, largest_negative, largest_positive, positive_and_negative, or all.'
|
|
251
|
+
);
|
|
252
|
+
o.driverMode = i.driverMode;
|
|
253
|
+
}
|
|
254
|
+
if (i.includePopulation !== void 0) {
|
|
255
|
+
if (typeof i.includePopulation != "boolean")
|
|
256
|
+
return s(
|
|
257
|
+
`${r}.includePopulation`,
|
|
258
|
+
'Data App analysis option "includePopulation" must be a boolean.'
|
|
259
|
+
);
|
|
260
|
+
o.includePopulation = i.includePopulation;
|
|
261
|
+
}
|
|
262
|
+
if (i.calendarContext !== void 0) {
|
|
263
|
+
const n = J(
|
|
264
|
+
i.calendarContext,
|
|
265
|
+
{
|
|
266
|
+
pathPrefix: `${r}.calendarContext`,
|
|
267
|
+
validateTimezone: t.validateTimezone
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
if (!n.ok)
|
|
271
|
+
return n;
|
|
272
|
+
o.calendarContext = n.calendarContext;
|
|
273
|
+
}
|
|
274
|
+
return { ok: !0, analysisOptions: o };
|
|
275
|
+
}
|
|
276
|
+
function he(e) {
|
|
277
|
+
const t = e.hooks.map(
|
|
278
|
+
(o, n) => Q(o, n, {
|
|
279
|
+
fieldCatalogs: e.fieldCatalogs || [],
|
|
280
|
+
requireFieldCatalog: !!e.requireFieldCatalog,
|
|
281
|
+
validateTimezone: e.validateTimezone
|
|
282
|
+
})
|
|
283
|
+
), r = t.flatMap((o) => o.diagnostics), i = t.map((o) => o.executionResult);
|
|
284
|
+
return {
|
|
285
|
+
ok: r.every((o) => o.severity !== "error"),
|
|
286
|
+
diagnostics: r,
|
|
287
|
+
hooks: t,
|
|
288
|
+
intents: t.flatMap((o) => o.intent ? [o.intent] : []),
|
|
289
|
+
executionResults: i
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function Q(e, t, r) {
|
|
293
|
+
const i = `hooks.${t}`;
|
|
294
|
+
try {
|
|
295
|
+
const o = X(e), n = ae(e, o), d = x(o), l = [
|
|
296
|
+
...d.errors.map(
|
|
297
|
+
(u) => y(u, {
|
|
298
|
+
hook: e.hook,
|
|
299
|
+
hookId: n,
|
|
300
|
+
pathPrefix: i,
|
|
301
|
+
severity: "error",
|
|
302
|
+
intent: o
|
|
303
|
+
})
|
|
304
|
+
),
|
|
305
|
+
...d.warnings.map(
|
|
306
|
+
(u) => y(u, {
|
|
307
|
+
hook: e.hook,
|
|
308
|
+
hookId: n,
|
|
309
|
+
pathPrefix: i,
|
|
310
|
+
severity: "warning",
|
|
311
|
+
intent: o
|
|
312
|
+
})
|
|
313
|
+
),
|
|
314
|
+
...Y({
|
|
315
|
+
hookSpec: e,
|
|
316
|
+
hookId: n,
|
|
317
|
+
intent: o,
|
|
318
|
+
pathPrefix: i,
|
|
319
|
+
fieldCatalogs: r.fieldCatalogs,
|
|
320
|
+
requireFieldCatalog: r.requireFieldCatalog
|
|
321
|
+
}),
|
|
322
|
+
...te({
|
|
323
|
+
hookSpec: e,
|
|
324
|
+
hookId: n,
|
|
325
|
+
intent: o,
|
|
326
|
+
pathPrefix: i,
|
|
327
|
+
validateTimezone: r.validateTimezone
|
|
328
|
+
})
|
|
329
|
+
], $ = ne(d, l);
|
|
330
|
+
return {
|
|
331
|
+
hook: e.hook,
|
|
332
|
+
hookId: n,
|
|
333
|
+
intent: o,
|
|
334
|
+
diagnostics: l,
|
|
335
|
+
executionResult: I({
|
|
336
|
+
intent: o,
|
|
337
|
+
validation: $,
|
|
338
|
+
diagnostics: l
|
|
339
|
+
})
|
|
340
|
+
};
|
|
341
|
+
} catch (o) {
|
|
342
|
+
const n = {
|
|
343
|
+
severity: "error",
|
|
344
|
+
code: "invalid_hook_spec",
|
|
345
|
+
message: o instanceof Error ? o.message : String(o),
|
|
346
|
+
path: i,
|
|
347
|
+
hook: e.hook,
|
|
348
|
+
hookId: C(e.spec)
|
|
349
|
+
}, d = w([n]);
|
|
350
|
+
return {
|
|
351
|
+
hook: e.hook,
|
|
352
|
+
hookId: n.hookId,
|
|
353
|
+
diagnostics: [n],
|
|
354
|
+
executionResult: I({
|
|
355
|
+
validation: d,
|
|
356
|
+
diagnostics: [n]
|
|
357
|
+
})
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function s(e, t) {
|
|
362
|
+
return {
|
|
363
|
+
ok: !1,
|
|
364
|
+
issues: [
|
|
365
|
+
{
|
|
366
|
+
code: "invalid_analysis_option",
|
|
367
|
+
message: t,
|
|
368
|
+
path: e
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function L(e) {
|
|
374
|
+
return e === "absolute_delta" || e === "largest_negative" || e === "largest_positive" || e === "positive_and_negative" || e === "all";
|
|
375
|
+
}
|
|
376
|
+
function J(e, t) {
|
|
377
|
+
var l;
|
|
378
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
379
|
+
return s(
|
|
380
|
+
t.pathPrefix,
|
|
381
|
+
'Data App analysis option "calendarContext" must be an object.'
|
|
382
|
+
);
|
|
383
|
+
const r = e, i = r.tz, o = r.weekStart, n = r.anchor, d = typeof i == "string" ? ((l = t.validateTimezone) == null ? void 0 : l.call(t, i)) ?? i : null;
|
|
384
|
+
return d ? typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 6 ? s(
|
|
385
|
+
`${t.pathPrefix}.weekStart`,
|
|
386
|
+
'Data App analysis option "calendarContext.weekStart" must be an integer from 0 to 6.'
|
|
387
|
+
) : n !== "now" && !(n && typeof n == "object" && !Array.isArray(n) && typeof n.iso == "string") ? s(
|
|
388
|
+
`${t.pathPrefix}.anchor`,
|
|
389
|
+
'Data App analysis option "calendarContext.anchor" must be "now" or an object with an iso string.'
|
|
390
|
+
) : {
|
|
391
|
+
ok: !0,
|
|
392
|
+
calendarContext: {
|
|
393
|
+
tz: d,
|
|
394
|
+
weekStart: o,
|
|
395
|
+
anchor: n
|
|
396
|
+
}
|
|
397
|
+
} : s(
|
|
398
|
+
`${t.pathPrefix}.tz`,
|
|
399
|
+
'Data App analysis option "calendarContext.tz" must be a valid timezone string.'
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
function X(e) {
|
|
403
|
+
return e.hook === "useSemaphorMetric" ? M(e.spec) : e.hook === "useSemaphorAnalysis" ? T(e.spec) : e.hook === "useSemaphorRecords" ? O(e.spec) : N(e.spec);
|
|
404
|
+
}
|
|
405
|
+
function Y(e) {
|
|
406
|
+
if (e.fieldCatalogs.length === 0 && !e.requireFieldCatalog)
|
|
407
|
+
return [];
|
|
408
|
+
const t = ie(e.fieldCatalogs, e.intent.source);
|
|
409
|
+
return t ? [
|
|
410
|
+
...Z({
|
|
411
|
+
...e,
|
|
412
|
+
catalog: t
|
|
413
|
+
}),
|
|
414
|
+
...ee({
|
|
415
|
+
...e,
|
|
416
|
+
catalog: t
|
|
417
|
+
})
|
|
418
|
+
] : [
|
|
419
|
+
{
|
|
420
|
+
severity: "error",
|
|
421
|
+
code: "invalid_source_ref",
|
|
422
|
+
message: `Source ref for ${e.hookSpec.hook} does not match a visible Semaphor source.`,
|
|
423
|
+
path: `${e.pathPrefix}.spec.source`,
|
|
424
|
+
hook: e.hookSpec.hook,
|
|
425
|
+
hookId: e.hookId,
|
|
426
|
+
intentId: e.intent.id,
|
|
427
|
+
source: e.intent.source
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
}
|
|
431
|
+
function Z(e) {
|
|
432
|
+
return re(e.intent).flatMap(({ field: t, path: r }) => _(e.catalog, t, e.intent.source) ? [] : [
|
|
433
|
+
{
|
|
434
|
+
severity: "error",
|
|
435
|
+
code: "missing_field",
|
|
436
|
+
message: `Field "${t.name}" is not visible on the selected Semaphor source.`,
|
|
437
|
+
path: `${e.pathPrefix}.${r}`,
|
|
438
|
+
hook: e.hookSpec.hook,
|
|
439
|
+
hookId: e.hookId,
|
|
440
|
+
intentId: e.intent.id,
|
|
441
|
+
source: f(t, e.intent.source),
|
|
442
|
+
field: t
|
|
443
|
+
}
|
|
444
|
+
]);
|
|
445
|
+
}
|
|
446
|
+
function ee(e) {
|
|
447
|
+
return ("inputs" in e.intent ? e.intent.inputs || [] : []).flatMap((r, i) => {
|
|
448
|
+
if (!r.field)
|
|
449
|
+
return [];
|
|
450
|
+
const o = f(r.field, e.intent.source);
|
|
451
|
+
return A(o, e.intent.source) ? _(e.catalog, r.field, e.intent.source) ? [] : [
|
|
452
|
+
{
|
|
453
|
+
severity: "error",
|
|
454
|
+
code: "missing_field",
|
|
455
|
+
message: `Input "${r.inputId}" references field "${r.field.name}", which is not visible on the selected Semaphor source.`,
|
|
456
|
+
path: `${e.pathPrefix}.spec.inputs.${i}.field`,
|
|
457
|
+
hook: e.hookSpec.hook,
|
|
458
|
+
hookId: e.hookId,
|
|
459
|
+
intentId: e.intent.id,
|
|
460
|
+
source: o,
|
|
461
|
+
field: r.field
|
|
462
|
+
}
|
|
463
|
+
] : [
|
|
464
|
+
{
|
|
465
|
+
severity: "error",
|
|
466
|
+
code: "unsupported_input_filter_composition",
|
|
467
|
+
message: `Input "${r.inputId}" filters a different Semaphor source than the query. Cross-source Data App inputs are not supported yet.`,
|
|
468
|
+
path: `${e.pathPrefix}.spec.inputs.${i}.field`,
|
|
469
|
+
hook: e.hookSpec.hook,
|
|
470
|
+
hookId: e.hookId,
|
|
471
|
+
intentId: e.intent.id,
|
|
472
|
+
source: o,
|
|
473
|
+
field: r.field
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
function te(e) {
|
|
479
|
+
if (e.hookSpec.hook !== "useSemaphorAnalysis")
|
|
480
|
+
return [];
|
|
481
|
+
const t = K(e.hookSpec.spec, {
|
|
482
|
+
pathPrefix: `${e.pathPrefix}.spec`,
|
|
483
|
+
validateTimezone: e.validateTimezone
|
|
484
|
+
});
|
|
485
|
+
return t.ok ? [] : t.issues.map((r) => ({
|
|
486
|
+
severity: "error",
|
|
487
|
+
code: r.code,
|
|
488
|
+
message: r.message,
|
|
489
|
+
path: r.path,
|
|
490
|
+
hook: e.hookSpec.hook,
|
|
491
|
+
hookId: e.hookId,
|
|
492
|
+
intentId: e.intent.id,
|
|
493
|
+
source: e.intent.source
|
|
494
|
+
}));
|
|
495
|
+
}
|
|
496
|
+
function re(e) {
|
|
497
|
+
return e.kind === "metric" ? [
|
|
498
|
+
...e.metrics.map((t, r) => ({
|
|
499
|
+
field: t,
|
|
500
|
+
path: `spec.metrics.${r}`
|
|
501
|
+
})),
|
|
502
|
+
...e.primaryMetric ? [{ field: e.primaryMetric, path: "spec.primaryMetric" }] : [],
|
|
503
|
+
...e.dateField ? [{ field: e.dateField, path: "spec.dateField" }] : [],
|
|
504
|
+
...(e.dimensions || []).map((t, r) => ({
|
|
505
|
+
field: t,
|
|
506
|
+
path: `spec.dimensions.${r}`
|
|
507
|
+
})),
|
|
508
|
+
...e.orderBy ? [{ field: e.orderBy.field, path: "spec.orderBy.field" }] : [],
|
|
509
|
+
...(e.filters || []).map((t, r) => ({
|
|
510
|
+
field: t.field,
|
|
511
|
+
path: `spec.filters.${r}.field`
|
|
512
|
+
}))
|
|
513
|
+
] : e.kind === "records" ? [
|
|
514
|
+
...e.fields.map((t, r) => ({
|
|
515
|
+
field: t,
|
|
516
|
+
path: `spec.fields.${r}`
|
|
517
|
+
})),
|
|
518
|
+
...e.dateField ? [{ field: e.dateField, path: "spec.dateField" }] : [],
|
|
519
|
+
...e.orderBy ? [{ field: e.orderBy.field, path: "spec.orderBy.field" }] : []
|
|
520
|
+
] : e.kind === "inputOptions" ? [{ field: e.field, path: "spec.field" }] : [];
|
|
521
|
+
}
|
|
522
|
+
function ie(e, t) {
|
|
523
|
+
return e.find((r) => m(r, t));
|
|
524
|
+
}
|
|
525
|
+
function _(e, t, r) {
|
|
526
|
+
const i = f(t, r);
|
|
527
|
+
if (m(e, i))
|
|
528
|
+
return e.fields.find(
|
|
529
|
+
(o) => oe(o, t) && m(
|
|
530
|
+
e,
|
|
531
|
+
f(o, e.source)
|
|
532
|
+
)
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
function m(e, t) {
|
|
536
|
+
return [e.source, ...e.sourceAliases || []].some(
|
|
537
|
+
(r) => A(r, t)
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
function f(e, t) {
|
|
541
|
+
return e.source || t;
|
|
542
|
+
}
|
|
543
|
+
function oe(e, t) {
|
|
544
|
+
const r = g(e.name), i = g(t.name);
|
|
545
|
+
return !!(r && i && r === i);
|
|
546
|
+
}
|
|
547
|
+
function g(e) {
|
|
548
|
+
return (e || "").trim().toLowerCase();
|
|
549
|
+
}
|
|
550
|
+
function y(e, t) {
|
|
551
|
+
return {
|
|
552
|
+
severity: t.severity,
|
|
553
|
+
code: e.code || "invalid_analytics_intent",
|
|
554
|
+
message: e.message,
|
|
555
|
+
path: e.path ? `${t.pathPrefix}.spec.${e.path}` : t.pathPrefix,
|
|
556
|
+
hook: t.hook,
|
|
557
|
+
hookId: t.hookId,
|
|
558
|
+
intentId: t.intent.id,
|
|
559
|
+
source: t.intent.source
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function ne(e, t) {
|
|
563
|
+
const r = w(t);
|
|
564
|
+
return {
|
|
565
|
+
ok: r.ok && e.ok,
|
|
566
|
+
errors: k([
|
|
567
|
+
...e.errors,
|
|
568
|
+
...r.errors
|
|
569
|
+
]),
|
|
570
|
+
warnings: k([
|
|
571
|
+
...e.warnings,
|
|
572
|
+
...r.warnings
|
|
573
|
+
]),
|
|
574
|
+
repairHints: [
|
|
575
|
+
...e.repairHints,
|
|
576
|
+
...r.repairHints
|
|
577
|
+
]
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
function w(e) {
|
|
581
|
+
const t = e.filter((i) => i.severity === "error").map(v), r = e.filter((i) => i.severity === "warning").map(v);
|
|
582
|
+
return {
|
|
583
|
+
ok: t.length === 0,
|
|
584
|
+
errors: t,
|
|
585
|
+
warnings: r,
|
|
586
|
+
repairHints: t.map((i) => {
|
|
587
|
+
var o, n;
|
|
588
|
+
return {
|
|
589
|
+
code: i.code,
|
|
590
|
+
message: i.message,
|
|
591
|
+
fieldRole: i.fieldRole,
|
|
592
|
+
invalidField: (o = i.repairHint) == null ? void 0 : o.invalidField,
|
|
593
|
+
recommendedNextStep: ((n = i.repairHint) == null ? void 0 : n.recommendedNextStep) || "Update the Data App SDK hook spec to use visible Semaphor source and field refs."
|
|
594
|
+
};
|
|
595
|
+
})
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function v(e) {
|
|
599
|
+
var t;
|
|
600
|
+
return {
|
|
601
|
+
code: e.code,
|
|
602
|
+
message: e.message,
|
|
603
|
+
path: e.path,
|
|
604
|
+
fieldRole: e.code === "invalid_source_ref" ? "source" : void 0,
|
|
605
|
+
repairHint: {
|
|
606
|
+
code: e.code,
|
|
607
|
+
message: e.message,
|
|
608
|
+
invalidField: (t = e.field) == null ? void 0 : t.name,
|
|
609
|
+
fieldRole: e.code === "invalid_source_ref" ? "source" : void 0,
|
|
610
|
+
recommendedNextStep: e.code === "unsupported_input_filter_composition" ? "Use an input field from the same Semaphor source as the query, or split the query into separate source-scoped hooks." : "Update the hook spec to use a visible Semaphor source and field ref."
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function k(e) {
|
|
615
|
+
const t = /* @__PURE__ */ new Set();
|
|
616
|
+
return e.filter((r) => {
|
|
617
|
+
const i = `${r.code}:${r.path || ""}:${r.message}`;
|
|
618
|
+
return t.has(i) ? !1 : (t.add(i), !0);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
function I(e) {
|
|
622
|
+
var r, i;
|
|
623
|
+
const t = e.diagnostics.filter((o) => o.severity === "error");
|
|
624
|
+
return {
|
|
625
|
+
intentId: (r = e.intent) == null ? void 0 : r.id,
|
|
626
|
+
status: t.length ? "failed" : "answered",
|
|
627
|
+
resultShape: (i = e.intent) == null ? void 0 : i.kind,
|
|
628
|
+
intent: e.intent,
|
|
629
|
+
validation: e.validation,
|
|
630
|
+
coverage: {
|
|
631
|
+
answeredObligations: t.length ? [] : ["hook_spec_validation"],
|
|
632
|
+
missingObligations: t.length ? ["hook_spec_validation"] : [],
|
|
633
|
+
warnings: e.validation.warnings
|
|
634
|
+
},
|
|
635
|
+
missingFields: t.filter((o) => o.code === "missing_field").flatMap((o) => {
|
|
636
|
+
var n;
|
|
637
|
+
return (n = o.field) != null && n.name ? [o.field.name] : [];
|
|
638
|
+
}),
|
|
639
|
+
warnings: e.diagnostics.filter((o) => o.severity === "warning").map((o) => o.message),
|
|
640
|
+
metadata: {
|
|
641
|
+
validationKind: "data_app_sdk_hook_spec"
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function ae(e, t) {
|
|
646
|
+
return t.id || C(e.spec);
|
|
647
|
+
}
|
|
648
|
+
function C(e) {
|
|
649
|
+
if (!e || typeof e != "object" || !("id" in e))
|
|
650
|
+
return;
|
|
651
|
+
const t = e.id;
|
|
652
|
+
return typeof t == "string" && t.trim() ? t : void 0;
|
|
653
|
+
}
|
|
654
|
+
export {
|
|
655
|
+
le as a,
|
|
656
|
+
T as b,
|
|
657
|
+
M as c,
|
|
658
|
+
O as d,
|
|
659
|
+
N as e,
|
|
660
|
+
ue as f,
|
|
661
|
+
q as g,
|
|
662
|
+
U as h,
|
|
663
|
+
ce as i,
|
|
664
|
+
E as j,
|
|
665
|
+
K as k,
|
|
666
|
+
me as n,
|
|
667
|
+
fe as t,
|
|
668
|
+
he as v
|
|
669
|
+
};
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-Db1XVmfU.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-Db1XVmfU.js");exports.DataAppBuilder=e.DataAppBuilder;
|