react-semaphor 0.1.415 → 0.1.417
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 +1 -4
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +2 -2
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/{analyze-result-contract-DPjm6btg.js → analyze-result-contract-B0O3oIYu.js} +2 -1
- package/dist/chunks/analyze-result-contract-CL97m8X8.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-B8FmFRHX.js → calendar-preferences-dialog-BOfryj8P.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-ck4AU-to.js → calendar-preferences-dialog-Rq9qiG3X.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Br_1IK1z.js → dashboard-briefing-launcher-D_P0cNQ_.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Tr2SqDMK.js → dashboard-briefing-launcher-DgvlOcRI.js} +4 -4
- package/dist/chunks/{dashboard-controls-B7OObDNl.js → dashboard-controls-DzVA-wWu.js} +1 -1
- package/dist/chunks/{dashboard-controls-B2bEv8uG.js → dashboard-controls-JYTKRokc.js} +5 -5
- package/dist/chunks/{dashboard-json-DNixjalS.js → dashboard-json-D5TEri2w.js} +1 -1
- package/dist/chunks/{dashboard-json-DAB8WVyb.js → dashboard-json-h6YMk_-l.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-Dh8Ge3-B.js → edit-dashboard-visual-DOtCYmDn.js} +4 -4
- package/dist/chunks/{edit-dashboard-visual-DWygSAp3.js → edit-dashboard-visual-kfbu03n9.js} +1 -1
- package/dist/chunks/{index-CQIMj-FF.js → index-Beol8cOo.js} +2 -2
- package/dist/chunks/{index-BkTLAfKy.js → index-BgESS5r7.js} +5 -5
- package/dist/chunks/{switch-DMlqgIx_.js → switch--FHwRAOL.js} +1 -1
- package/dist/chunks/{switch-DgiogS4X.js → switch-C8_t4Pio.js} +1 -1
- package/dist/chunks/update-policy-B50M0Jeg.js +3 -0
- package/dist/chunks/{update-policy-BnEbPhHW.js → update-policy-CQLHKQ_h.js} +304 -290
- package/dist/chunks/{use-create-flow-overlay-state-CZA-dSns.js → use-create-flow-overlay-state-BEPWzqQn.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-uujasvbD.js → use-create-flow-overlay-state-NEs9ePDy.js} +3 -3
- package/dist/chunks/validators-JzI7olk4.js +1 -0
- package/dist/chunks/{validators-C-_9Ew5G.js → validators-UqQI3Cg_.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +2 -2
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +42 -42
- package/dist/data-app-codegen-node/index.js +270 -264
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +2 -2
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- 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 +2 -2
- package/dist/types/dashboard-assistant.d.ts +1 -1
- package/dist/types/dashboard-authoring.d.ts +1 -1
- package/dist/types/data-app-builder.d.ts +1 -1
- package/dist/types/data-app-codegen-node.d.ts +5 -4
- package/dist/types/data-app-codegen.d.ts +5 -4
- package/dist/types/data-app-sdk-adapters.d.ts +1 -1
- package/dist/types/data-app-sdk-validation.d.ts +1 -1
- package/dist/types/data-app-sdk.d.ts +1 -1
- package/dist/types/main.d.ts +1 -1
- package/package.json +1 -1
- package/src/data-app-sdk/README.md +1 -4
- package/dist/chunks/analyze-result-contract-8nxUOWp8.js +0 -1
- package/dist/chunks/update-policy-CWg9c08k.js +0 -3
- package/dist/chunks/validators-CB9BFarT.js +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { c as
|
|
3
|
-
import { C as
|
|
1
|
+
import { S as wn, a as $n, i as In, v as Fn } from "../chunks/analyze-result-contract-B0O3oIYu.js";
|
|
2
|
+
import { c as Ve, G as me, a as ke, b as Re } from "../chunks/update-policy-CQLHKQ_h.js";
|
|
3
|
+
import { C as Vn, e as kn, R as Rn, f as Mn, g as Nn, h as xn, i as Cn, j as On, v as Gn, d as Kn } from "../chunks/update-policy-CQLHKQ_h.js";
|
|
4
4
|
import { createHash as fe } from "node:crypto";
|
|
5
|
-
const
|
|
5
|
+
const yn = "src/semaphor/generated", H = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
|
|
6
6
|
// Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
|
|
7
7
|
`;
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
const r =
|
|
8
|
+
function gn(e, n = {}) {
|
|
9
|
+
Ve(e);
|
|
10
|
+
const r = Me(e);
|
|
11
11
|
if (r.views.length === 0 && !n.allowEmpty)
|
|
12
12
|
throw new Error(
|
|
13
13
|
"Contract generation produced zero executable views. Stop and ask for a different domain/goal or semantic model improvement; pass --allow-empty only for an explicit model-gap report."
|
|
14
14
|
);
|
|
15
|
-
const o =
|
|
15
|
+
const o = xe(r), t = Ce({
|
|
16
16
|
contract: r,
|
|
17
17
|
files: o,
|
|
18
18
|
generatorName: n.generatorName || "react-semaphor/data-app-codegen/node",
|
|
@@ -27,7 +27,7 @@ function fn(e, n = {}) {
|
|
|
27
27
|
files: a,
|
|
28
28
|
manifest: t,
|
|
29
29
|
contentHash: String(t.generatedContentHash || ""),
|
|
30
|
-
usageExample:
|
|
30
|
+
usageExample: Ke(r),
|
|
31
31
|
warnings: r.warnings,
|
|
32
32
|
stats: {
|
|
33
33
|
inputCount: r.inputs.length,
|
|
@@ -38,24 +38,24 @@ function fn(e, n = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
41
|
+
function Me(e) {
|
|
42
|
+
var l, u, d, m, c, $, F, b, R, G, V, N;
|
|
43
43
|
const n = [], r = [];
|
|
44
44
|
for (const s of e.inputs) {
|
|
45
45
|
g(r, s.fieldRef);
|
|
46
46
|
for (const S of s.bindings || [])
|
|
47
47
|
g(r, S.fieldRef);
|
|
48
|
-
g(r, (
|
|
48
|
+
g(r, (l = s.optionQuery) == null ? void 0 : l.valueFieldRef), g(r, (u = s.optionQuery) == null ? void 0 : u.labelFieldRef), g(r, (d = s.optionQuery) == null ? void 0 : d.filterFieldRef), T(r, (m = s.optionQuery) == null ? void 0 : m.spec);
|
|
49
49
|
}
|
|
50
50
|
for (const s of e.filterContracts) {
|
|
51
|
-
g(r, s.fieldRef), g(r, (
|
|
51
|
+
g(r, s.fieldRef), g(r, (c = s.optionQuery) == null ? void 0 : c.valueFieldRef), g(r, ($ = s.optionQuery) == null ? void 0 : $.labelFieldRef), g(r, (F = s.optionQuery) == null ? void 0 : F.filterFieldRef), T(r, (b = s.optionQuery) == null ? void 0 : b.spec);
|
|
52
52
|
for (const S of s.bindings || [])
|
|
53
53
|
g(r, S.fieldRef);
|
|
54
54
|
}
|
|
55
55
|
for (const s of e.views) {
|
|
56
56
|
for (const S of s.fields || [])
|
|
57
57
|
g(r, S);
|
|
58
|
-
T(r, (
|
|
58
|
+
T(r, (R = s.sdkSpec) == null ? void 0 : R.spec), T(r, s.visualSpec);
|
|
59
59
|
}
|
|
60
60
|
const o = e.implementationChecklist || {};
|
|
61
61
|
for (const s of Object.values(o.bindingsByView || {}))
|
|
@@ -63,24 +63,24 @@ function ke(e) {
|
|
|
63
63
|
g(r, S.fieldRef), g(r, S.optionValueField), g(r, S.optionLabelField);
|
|
64
64
|
for (const s of o.requiredInputOptions || [])
|
|
65
65
|
g(r, s.visibleLabelField), g(r, s.optionValueField), g(r, s.runtimeFilterField);
|
|
66
|
-
const t =
|
|
66
|
+
const t = an(
|
|
67
67
|
[
|
|
68
68
|
...e.sources.map((s) => ({
|
|
69
69
|
raw: s,
|
|
70
|
-
key:
|
|
71
|
-
aliases:
|
|
70
|
+
key: we(s),
|
|
71
|
+
aliases: $e(s),
|
|
72
72
|
name: ""
|
|
73
73
|
})),
|
|
74
|
-
...r.map((s) =>
|
|
74
|
+
...r.map((s) => tn(s)).filter(O)
|
|
75
75
|
]
|
|
76
76
|
);
|
|
77
|
-
|
|
78
|
-
const S =
|
|
77
|
+
v(t, (s) => {
|
|
78
|
+
const S = w(s.raw);
|
|
79
79
|
return Q(
|
|
80
80
|
s.raw.label || (S == null ? void 0 : S.datasetName) || (S == null ? void 0 : S.datasetId) || (S == null ? void 0 : S.name) || s.raw.kind || "source"
|
|
81
81
|
);
|
|
82
82
|
});
|
|
83
|
-
const a =
|
|
83
|
+
const a = un(t), p = X(
|
|
84
84
|
r.filter((s) => s.name).map((s) => ({
|
|
85
85
|
raw: s,
|
|
86
86
|
key: D(s),
|
|
@@ -88,10 +88,10 @@ function ke(e) {
|
|
|
88
88
|
})),
|
|
89
89
|
(s) => s.key
|
|
90
90
|
);
|
|
91
|
-
|
|
91
|
+
v(
|
|
92
92
|
p,
|
|
93
93
|
(s) => Q([
|
|
94
|
-
s.raw.sourceKey ?
|
|
94
|
+
s.raw.sourceKey ? cn(s.raw.sourceKey) : "",
|
|
95
95
|
s.raw.aggregate ? s.raw.aggregate.toLowerCase() : "",
|
|
96
96
|
s.raw.name
|
|
97
97
|
].filter(Boolean).join("_"))
|
|
@@ -100,15 +100,15 @@ function ke(e) {
|
|
|
100
100
|
raw: s,
|
|
101
101
|
name: Q(s.id || s.label || "input")
|
|
102
102
|
}));
|
|
103
|
-
|
|
103
|
+
v(h, (s) => s.name);
|
|
104
104
|
const y = h.filter((s) => !!s.raw.optionQuery).map((s) => ({
|
|
105
105
|
input: s,
|
|
106
106
|
name: `${s.name}Options`,
|
|
107
107
|
raw: s.raw.optionQuery
|
|
108
108
|
}));
|
|
109
|
-
|
|
109
|
+
v(y, (s) => s.name);
|
|
110
110
|
for (const s of y)
|
|
111
|
-
|
|
111
|
+
on(s.raw.labelFieldRef, s.raw.valueFieldRef) && sn(s.raw.valueFieldRef) && n.push(
|
|
112
112
|
`Input option query ${((G = s.raw.spec) == null ? void 0 : G.inputId) || s.input.raw.id || s.name} uses identifier field ${s.raw.valueFieldRef.name} as both label and value. It can execute, but the UI will show key values unless the semantic model exposes a human-readable label through a modeled relationship.`
|
|
113
113
|
);
|
|
114
114
|
const i = e.views.filter(
|
|
@@ -120,11 +120,11 @@ function ke(e) {
|
|
|
120
120
|
raw: s,
|
|
121
121
|
name: Q(s.id || s.title || "query")
|
|
122
122
|
}));
|
|
123
|
-
|
|
124
|
-
const I = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) =>
|
|
123
|
+
v(i, (s) => s.name);
|
|
124
|
+
const I = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => rn(s));
|
|
125
125
|
for (const s of e.views)
|
|
126
|
-
(!("sdkSpec" in s) || !((V = s.sdkSpec) != null && V.builder) || !((
|
|
127
|
-
return
|
|
126
|
+
(!("sdkSpec" in s) || !((V = s.sdkSpec) != null && V.builder) || !((N = s.sdkSpec) != null && N.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
|
|
127
|
+
return Ne({
|
|
128
128
|
inputs: h,
|
|
129
129
|
views: i,
|
|
130
130
|
filterContracts: e.filterContracts
|
|
@@ -144,7 +144,7 @@ function ke(e) {
|
|
|
144
144
|
warnings: n
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ne({
|
|
148
148
|
inputs: e,
|
|
149
149
|
views: n,
|
|
150
150
|
filterContracts: r
|
|
@@ -180,44 +180,44 @@ function Re({
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function xe(e) {
|
|
184
184
|
return {
|
|
185
|
-
"sources.ts":
|
|
186
|
-
"fields.ts":
|
|
187
|
-
"inputs.ts":
|
|
188
|
-
"queries.ts":
|
|
189
|
-
"bindings.ts":
|
|
190
|
-
"accessors.ts":
|
|
191
|
-
"metadata.ts":
|
|
192
|
-
"index.ts":
|
|
185
|
+
"sources.ts": ve(e),
|
|
186
|
+
"fields.ts": Ae(e),
|
|
187
|
+
"inputs.ts": je(e),
|
|
188
|
+
"queries.ts": Qe(e),
|
|
189
|
+
"bindings.ts": Ue(e),
|
|
190
|
+
"accessors.ts": Je(e),
|
|
191
|
+
"metadata.ts": Ye(e),
|
|
192
|
+
"index.ts": We()
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Ce({
|
|
196
196
|
contract: e,
|
|
197
197
|
files: n,
|
|
198
198
|
generatorName: r,
|
|
199
199
|
generatorVersion: o
|
|
200
200
|
}) {
|
|
201
201
|
return {
|
|
202
|
-
schemaVersion:
|
|
202
|
+
schemaVersion: Re,
|
|
203
203
|
generatedContractSchemaVersion: me,
|
|
204
204
|
generator: {
|
|
205
205
|
name: r,
|
|
206
206
|
version: o
|
|
207
207
|
},
|
|
208
|
-
generatedContentHash:
|
|
209
|
-
codegenSummaryValidatorVersion:
|
|
210
|
-
codegenSummaryHash:
|
|
208
|
+
generatedContentHash: Oe(n),
|
|
209
|
+
codegenSummaryValidatorVersion: ke,
|
|
210
|
+
codegenSummaryHash: Ge(e.summary),
|
|
211
211
|
codegenSummary: e.summary
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Oe(e) {
|
|
215
215
|
const n = fe("sha256");
|
|
216
216
|
for (const r of Object.keys(e).sort())
|
|
217
217
|
n.update(r), n.update("\0"), n.update(e[r]), n.update("\0");
|
|
218
218
|
return `sha256:${n.digest("hex")}`;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Ge(e) {
|
|
221
221
|
return `sha256:${fe("sha256").update(ae(e)).digest("hex")}`;
|
|
222
222
|
}
|
|
223
223
|
function ae(e) {
|
|
@@ -228,7 +228,7 @@ function ae(e) {
|
|
|
228
228
|
const n = e;
|
|
229
229
|
return `{${Object.keys(n).sort().filter((o) => n[o] !== void 0).map((o) => `${JSON.stringify(o)}:${ae(n[o])}`).join(",")}}`;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function Ke(e) {
|
|
232
232
|
const n = e.views.find(
|
|
233
233
|
(y) => K(y) && E(y)
|
|
234
234
|
);
|
|
@@ -291,7 +291,7 @@ function Oe(e) {
|
|
|
291
291
|
`);
|
|
292
292
|
const a = e.views.find((y) => {
|
|
293
293
|
var i;
|
|
294
|
-
return
|
|
294
|
+
return pn((i = y.raw.sdkSpec) == null ? void 0 : i.builder);
|
|
295
295
|
});
|
|
296
296
|
if (a)
|
|
297
297
|
return [
|
|
@@ -303,7 +303,7 @@ function Oe(e) {
|
|
|
303
303
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
304
304
|
].join(`
|
|
305
305
|
`);
|
|
306
|
-
const p = e.views.find((y) =>
|
|
306
|
+
const p = e.views.find((y) => Ee(y));
|
|
307
307
|
if (p)
|
|
308
308
|
return [
|
|
309
309
|
'import { appInputSpecs, createInputHandleMap, metricValuesForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
@@ -328,7 +328,7 @@ function W(e) {
|
|
|
328
328
|
var n;
|
|
329
329
|
return B((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function Ee(e) {
|
|
332
332
|
var n;
|
|
333
333
|
return B((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
|
|
334
334
|
}
|
|
@@ -344,24 +344,24 @@ function E(e) {
|
|
|
344
344
|
var n, r, o;
|
|
345
345
|
return ((o = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.pagination) == null ? void 0 : o.mode) === "server";
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function He(e) {
|
|
348
348
|
return W(e) && (E(e) || K(e)) || ue(e) && E(e);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function ve(e) {
|
|
351
351
|
const n = e.sources.map(({ name: o, raw: t }) => {
|
|
352
|
-
const a =
|
|
352
|
+
const a = qe(t);
|
|
353
353
|
return ` ${o}: ${a},`;
|
|
354
354
|
}).join(`
|
|
355
355
|
`), r = e.sources.some((o) => o.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
|
|
356
356
|
|
|
357
357
|
` : "";
|
|
358
|
-
return `${
|
|
358
|
+
return `${H}
|
|
359
359
|
${r}export const sources = {
|
|
360
360
|
${n}
|
|
361
361
|
} as const;
|
|
362
362
|
`;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function qe(e) {
|
|
365
365
|
if (e.kind === "semantic") {
|
|
366
366
|
const n = {
|
|
367
367
|
domainId: e.domainId,
|
|
@@ -373,28 +373,28 @@ function ve(e) {
|
|
|
373
373
|
}
|
|
374
374
|
return `${k(A({ ...e, sourceKey: void 0 }))} as const`;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Ae(e) {
|
|
377
377
|
const n = e.fields.map(({ name: o, raw: t }) => {
|
|
378
|
-
const a =
|
|
378
|
+
const a = Be(t, e);
|
|
379
379
|
return ` ${o}: ${a},`;
|
|
380
380
|
}).join(`
|
|
381
381
|
`), r = n.includes("sources.") ? `import { sources } from "./sources";
|
|
382
382
|
|
|
383
383
|
` : "";
|
|
384
|
-
return `${
|
|
384
|
+
return `${H}
|
|
385
385
|
${r}export const fields = {
|
|
386
386
|
${n}
|
|
387
387
|
} as const;
|
|
388
388
|
`;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function Be(e, n) {
|
|
391
391
|
const r = {
|
|
392
392
|
name: e.name,
|
|
393
393
|
label: e.label,
|
|
394
394
|
role: e.role,
|
|
395
395
|
dataType: e.dataType,
|
|
396
396
|
aggregate: e.aggregate
|
|
397
|
-
}, o =
|
|
397
|
+
}, o = dn(e), t = o ? n.sourceNameByKey.get(o) : void 0;
|
|
398
398
|
if (o && !t)
|
|
399
399
|
throw new Error(
|
|
400
400
|
`Field ${e.name} references source ${o}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
|
|
@@ -402,61 +402,61 @@ function qe(e, n) {
|
|
|
402
402
|
const a = Object.entries(A(r)).map(([p, f]) => `${JSON.stringify(p)}: ${C(f, n)}`);
|
|
403
403
|
return t && a.push(`"source": sources.${t}`), `{ ${a.join(", ")} }`;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function je(e) {
|
|
406
406
|
const n = e.inputs.map((d) => {
|
|
407
|
-
const m =
|
|
407
|
+
const m = M(d.raw.fieldRef, e), c = [
|
|
408
408
|
`id: ${JSON.stringify(d.raw.id)}`,
|
|
409
409
|
`label: ${JSON.stringify(d.raw.label || d.raw.id)}`,
|
|
410
|
-
`operator: ${JSON.stringify(
|
|
410
|
+
`operator: ${JSON.stringify(ln(d.raw))}`
|
|
411
411
|
];
|
|
412
|
-
if (m &&
|
|
412
|
+
if (m && c.push(`field: fields.${m}`), d.raw.relationshipHint && c.push(`relationshipHint: ${k(d.raw.relationshipHint)}`), !m)
|
|
413
413
|
throw new Error(`Input ${d.raw.id || d.name} is missing a generated field reference.`);
|
|
414
|
-
return ` ${d.name}: semaphor.filter({ ${
|
|
414
|
+
return ` ${d.name}: semaphor.filter({ ${c.join(", ")} }),`;
|
|
415
415
|
}).join(`
|
|
416
416
|
`), r = e.inputs.map((d) => `filterSpecs.${d.name}`).join(", "), o = e.inputs.map((d) => JSON.stringify(d.raw.id)).join(", "), t = e.optionQueries.map((d) => {
|
|
417
|
-
const m = d.input.raw,
|
|
418
|
-
id:
|
|
419
|
-
inputId:
|
|
420
|
-
source:
|
|
417
|
+
const m = d.input.raw, c = d.raw, $ = w(c.spec) || {}, {
|
|
418
|
+
id: F,
|
|
419
|
+
inputId: b,
|
|
420
|
+
source: R,
|
|
421
421
|
sourceKey: G,
|
|
422
422
|
valueField: V,
|
|
423
|
-
labelField:
|
|
423
|
+
labelField: N,
|
|
424
424
|
population: s,
|
|
425
425
|
dependencies: S,
|
|
426
426
|
limit: j,
|
|
427
427
|
...ee
|
|
428
|
-
} =
|
|
428
|
+
} = $, U = c.sourceKey ? { sourceKey: c.sourceKey } : c.source || R || (typeof G == "string" ? { sourceKey: G } : void 0), ne = Se(U, e), re = M(c.valueFieldRef, e), te = M(c.labelFieldRef, e), oe = ye(d), se = {
|
|
429
429
|
...ee,
|
|
430
|
-
id:
|
|
430
|
+
id: c.id || $.id || `${m.id}-options`,
|
|
431
431
|
inputId: m.id,
|
|
432
432
|
source: U,
|
|
433
|
-
valueField:
|
|
434
|
-
labelField:
|
|
435
|
-
population:
|
|
436
|
-
dependencies:
|
|
437
|
-
limit:
|
|
433
|
+
valueField: c.valueFieldRef,
|
|
434
|
+
labelField: c.labelFieldRef,
|
|
435
|
+
population: c.population || s,
|
|
436
|
+
dependencies: oe,
|
|
437
|
+
limit: c.limit || j || 100
|
|
438
438
|
};
|
|
439
439
|
if (!ne || !re || !te)
|
|
440
|
-
throw new Error(`Input option query ${
|
|
441
|
-
const
|
|
442
|
-
return ` ${d.name}: semaphor.inputOptions({ ${
|
|
440
|
+
throw new Error(`Input option query ${c.id || `${m.id}-options`} is missing source, valueField, or labelField.`);
|
|
441
|
+
const Ie = Object.entries(A(se)).map(([Fe, be]) => `${JSON.stringify(Fe)}: ${C(be, e)}`);
|
|
442
|
+
return ` ${d.name}: semaphor.inputOptions({ ${Ie.join(", ")} }),`;
|
|
443
443
|
}).join(`
|
|
444
444
|
`), a = e.optionQueries.map((d) => {
|
|
445
|
-
const
|
|
446
|
-
const b =
|
|
445
|
+
const m = Te(e, d), c = m.length > 0 ? "inputHandles" : "_inputHandles", $ = m.map((F) => {
|
|
446
|
+
const b = M(F.raw.fieldRef, e);
|
|
447
447
|
if (!b)
|
|
448
448
|
throw new Error(
|
|
449
|
-
`Input option query ${d.raw.id || `${d.input.raw.id}-options`} references input ${
|
|
449
|
+
`Input option query ${d.raw.id || `${d.input.raw.id}-options`} references input ${F.raw.id} without a generated field reference.`
|
|
450
450
|
);
|
|
451
|
-
const
|
|
452
|
-
return ` if (${
|
|
453
|
-
inputs.push(semaphor.bindInput(${
|
|
451
|
+
const R = `inputHandles[${JSON.stringify(F.raw.id)}]`;
|
|
452
|
+
return ` if (${R}) {
|
|
453
|
+
inputs.push(semaphor.bindInput(${R}, { field: fields.${b} }));
|
|
454
454
|
}`;
|
|
455
455
|
}).join(`
|
|
456
456
|
`);
|
|
457
|
-
return ` ${d.name}(
|
|
457
|
+
return ` ${d.name}(${c}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
458
458
|
const inputs: SemaphorInputReference[] = [];
|
|
459
|
-
${
|
|
459
|
+
${$}
|
|
460
460
|
return inputs;
|
|
461
461
|
},`;
|
|
462
462
|
}).join(`
|
|
@@ -469,19 +469,19 @@ ${l}
|
|
|
469
469
|
|
|
470
470
|
`), f = e.optionQueries.map((d) => ` case ${JSON.stringify(d.raw.id || `${d.input.raw.id}-options`)}:
|
|
471
471
|
return queryOptionsForInputOptionQuery.${d.name}(inputHandles);`).join(`
|
|
472
|
-
`), h = e.inputs.length > 0, y = e.optionQueries.length > 0, i = y ? "inputOptionQueryId" : "_inputOptionQueryId", I = y ? "inputHandles" : "_inputHandles",
|
|
472
|
+
`), h = e.inputs.length > 0, y = e.optionQueries.length > 0, i = y ? "inputOptionQueryId" : "_inputOptionQueryId", I = y ? "inputHandles" : "_inputHandles", l = [
|
|
473
473
|
"SemaphorInputHandle",
|
|
474
474
|
y ? "SemaphorInputReference" : void 0,
|
|
475
475
|
"SemaphorQueryRuntimeOptions"
|
|
476
476
|
].filter(O).join(", "), u = [
|
|
477
477
|
h || y ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
478
|
-
`import type { ${
|
|
478
|
+
`import type { ${l} } from "react-semaphor/data-app-sdk";`,
|
|
479
479
|
h || y ? 'import { fields } from "./fields";' : void 0,
|
|
480
480
|
y ? 'import { sources } from "./sources";' : void 0,
|
|
481
481
|
'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
|
|
482
482
|
].filter(O).join(`
|
|
483
483
|
`);
|
|
484
|
-
return `${
|
|
484
|
+
return `${H}
|
|
485
485
|
${u}
|
|
486
486
|
|
|
487
487
|
export const filterSpecs = {
|
|
@@ -520,27 +520,33 @@ ${f}
|
|
|
520
520
|
}
|
|
521
521
|
`;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
const r = n
|
|
525
|
-
if (
|
|
523
|
+
function Te(e, n) {
|
|
524
|
+
const r = ye(n);
|
|
525
|
+
if (!r || r.mode === "independent")
|
|
526
|
+
return [];
|
|
527
|
+
if (r.mode !== "explicit")
|
|
526
528
|
return [];
|
|
527
|
-
const o = /* @__PURE__ */ new Set([
|
|
529
|
+
const o = new Set(r.includeInputIds || []), t = /* @__PURE__ */ new Set([
|
|
528
530
|
n.input.raw.id,
|
|
529
|
-
...
|
|
530
|
-
])
|
|
531
|
-
return e.inputs.filter((a) =>
|
|
531
|
+
...r.excludeInputIds || []
|
|
532
|
+
]);
|
|
533
|
+
return e.inputs.filter((a) => t.has(a.raw.id) ? !1 : o.has(a.raw.id));
|
|
532
534
|
}
|
|
533
|
-
function
|
|
535
|
+
function ye(e) {
|
|
536
|
+
var n;
|
|
537
|
+
return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
|
|
538
|
+
}
|
|
539
|
+
function Qe(e) {
|
|
534
540
|
const n = e.views.map((u) => {
|
|
535
|
-
var
|
|
536
|
-
const d = B(u.raw.sdkSpec.builder), m =
|
|
537
|
-
if (W(u) &&
|
|
538
|
-
const V = (
|
|
541
|
+
var c, $, F, b, R, G;
|
|
542
|
+
const d = B(u.raw.sdkSpec.builder), m = _e(u);
|
|
543
|
+
if (W(u) && He(u)) {
|
|
544
|
+
const V = (c = u.raw.visualSpec) == null ? void 0 : c.tableBehavior, N = w(m.pagination), s = E(u), S = K(u), j = (($ = V == null ? void 0 : V.pagination) == null ? void 0 : $.pageSize) || J(N == null ? void 0 : N.pageSize) || J(m.limit) || 100, ee = S ? z(u, e) : [], U = S ? Pe({
|
|
539
545
|
view: u,
|
|
540
546
|
contract: e,
|
|
541
547
|
sortFields: ee,
|
|
542
|
-
defaultField: (
|
|
543
|
-
}) : void 0, ne = S ? (
|
|
548
|
+
defaultField: (F = V == null ? void 0 : V.sorting) == null ? void 0 : F.defaultField
|
|
549
|
+
}) : void 0, ne = S ? (b = V == null ? void 0 : V.sorting) == null ? void 0 : b.defaultDirection : void 0, re = De({
|
|
544
550
|
viewName: u.name,
|
|
545
551
|
supportsPagination: s,
|
|
546
552
|
supportsSort: S
|
|
@@ -562,7 +568,7 @@ ${oe}${se} });
|
|
|
562
568
|
},`;
|
|
563
569
|
}
|
|
564
570
|
if (ue(u) && E(u)) {
|
|
565
|
-
const V = (
|
|
571
|
+
const V = (R = u.raw.visualSpec) == null ? void 0 : R.tableBehavior, N = w(m.pagination), s = ((G = V == null ? void 0 : V.pagination) == null ? void 0 : G.pageSize) || J(N == null ? void 0 : N.pageSize) || J(m.limit) || 100;
|
|
566
572
|
return ` ${u.name}(
|
|
567
573
|
params: SemaphorGeneratedServerPaginationParams = {},
|
|
568
574
|
) {
|
|
@@ -575,14 +581,14 @@ ${oe}${se} });
|
|
|
575
581
|
return ` ${u.name}: () => semaphor.${d}(${C(m, e)}),`;
|
|
576
582
|
}).join(`
|
|
577
583
|
`), r = e.views.filter((u) => K(u)).map((u) => {
|
|
578
|
-
const m = z(u, e).map((
|
|
584
|
+
const m = z(u, e).map((c) => ` ${JSON.stringify(c.key)}: fields.${c.fieldName},`).join(`
|
|
579
585
|
`);
|
|
580
586
|
return ` ${u.name}: {
|
|
581
587
|
${m}
|
|
582
588
|
},`;
|
|
583
589
|
}).join(`
|
|
584
590
|
`), o = e.views.filter((u) => K(u)).map((u) => {
|
|
585
|
-
const m = z(u, e).map((
|
|
591
|
+
const m = z(u, e).map((c) => ` { key: ${JSON.stringify(c.key)}, label: ${JSON.stringify(c.label)}, field: fields.${c.fieldName} },`).join(`
|
|
586
592
|
`);
|
|
587
593
|
return ` ${u.name}: [
|
|
588
594
|
${m}
|
|
@@ -596,7 +602,7 @@ ${m}
|
|
|
596
602
|
p.includes("sources.") ? 'import { sources } from "./sources";' : void 0
|
|
597
603
|
].filter(O).join(`
|
|
598
604
|
`);
|
|
599
|
-
return `${
|
|
605
|
+
return `${H}
|
|
600
606
|
${f}
|
|
601
607
|
${t ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
|
|
602
608
|
|
|
@@ -661,9 +667,9 @@ ${a ? `function resolveServerTablePagination(
|
|
|
661
667
|
` : ""}
|
|
662
668
|
`;
|
|
663
669
|
}
|
|
664
|
-
function
|
|
670
|
+
function _e(e) {
|
|
665
671
|
var a, p;
|
|
666
|
-
const n =
|
|
672
|
+
const n = w((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: o, ...t } = n;
|
|
667
673
|
return {
|
|
668
674
|
...t,
|
|
669
675
|
id: e.raw.id,
|
|
@@ -672,13 +678,13 @@ function Te(e) {
|
|
|
672
678
|
}
|
|
673
679
|
function z(e, n) {
|
|
674
680
|
var a, p;
|
|
675
|
-
const r = [], o =
|
|
681
|
+
const r = [], o = w((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
|
|
676
682
|
for (const f of q(o.fields)) g(r, f);
|
|
677
|
-
g(r, o.dateField), g(r, (p =
|
|
683
|
+
g(r, o.dateField), g(r, (p = w(o.orderBy)) == null ? void 0 : p.field);
|
|
678
684
|
for (const f of e.raw.fields || []) g(r, f);
|
|
679
685
|
return X(
|
|
680
686
|
r.map((f) => {
|
|
681
|
-
const h =
|
|
687
|
+
const h = M(f, n);
|
|
682
688
|
if (!(!f.name || !h))
|
|
683
689
|
return {
|
|
684
690
|
key: h,
|
|
@@ -690,7 +696,7 @@ function z(e, n) {
|
|
|
690
696
|
(f) => f.key
|
|
691
697
|
);
|
|
692
698
|
}
|
|
693
|
-
function
|
|
699
|
+
function Pe({
|
|
694
700
|
view: e,
|
|
695
701
|
contract: n,
|
|
696
702
|
sortFields: r,
|
|
@@ -703,42 +709,42 @@ function Qe({
|
|
|
703
709
|
const a = r.filter((i) => i.rawName === o);
|
|
704
710
|
if (a.length === 1)
|
|
705
711
|
return a[0].key;
|
|
706
|
-
const p =
|
|
712
|
+
const p = w((h = e.raw.sdkSpec) == null ? void 0 : h.spec), f = M((y = w(p == null ? void 0 : p.orderBy)) == null ? void 0 : y.field, n);
|
|
707
713
|
return f && t.has(f) ? f : void 0;
|
|
708
714
|
}
|
|
709
|
-
function
|
|
715
|
+
function De({
|
|
710
716
|
viewName: e,
|
|
711
717
|
supportsPagination: n,
|
|
712
718
|
supportsSort: r
|
|
713
719
|
}) {
|
|
714
720
|
return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
|
|
715
721
|
}
|
|
716
|
-
function
|
|
722
|
+
function Ue(e) {
|
|
717
723
|
const n = e.views.map((i) => {
|
|
718
|
-
const
|
|
719
|
-
const d = u.inputId, m =
|
|
724
|
+
const l = Le(e, i.raw.id).map((u) => {
|
|
725
|
+
const d = u.inputId, m = M(u.fieldRef, e);
|
|
720
726
|
if (!d || !m)
|
|
721
727
|
return "";
|
|
722
|
-
const
|
|
728
|
+
const c = [`field: fields.${m}`];
|
|
723
729
|
if (u.relationshipHint)
|
|
724
|
-
|
|
730
|
+
c.push(`relationshipHint: ${k(u.relationshipHint)}`);
|
|
725
731
|
else if (Array.isArray(u.relationshipsUsed) && u.relationshipsUsed.length > 0) {
|
|
726
|
-
const
|
|
727
|
-
var
|
|
728
|
-
return (
|
|
729
|
-
}).filter((
|
|
730
|
-
|
|
732
|
+
const F = u.relationshipsUsed.map((b) => {
|
|
733
|
+
var R;
|
|
734
|
+
return (R = w(b)) == null ? void 0 : R.id;
|
|
735
|
+
}).filter((b) => typeof b == "string" && b.length > 0);
|
|
736
|
+
F.length > 0 && c.push(`relationshipHint: ${k({ relationshipIds: F })}`);
|
|
731
737
|
}
|
|
732
|
-
const
|
|
733
|
-
return ` if (${
|
|
734
|
-
inputs.push(semaphor.bindInput(${
|
|
738
|
+
const $ = `inputHandles[${JSON.stringify(d)}]`;
|
|
739
|
+
return ` if (${$}) {
|
|
740
|
+
inputs.push(semaphor.bindInput(${$}, { ${c.join(", ")} }));
|
|
735
741
|
}`;
|
|
736
742
|
}).filter(Boolean).join(`
|
|
737
743
|
`);
|
|
738
|
-
return { view: i, renderedBindings:
|
|
744
|
+
return { view: i, renderedBindings: l };
|
|
739
745
|
}), r = n.some((i) => i.renderedBindings.length > 0), o = n.map(({ view: i, renderedBindings: I }) => {
|
|
740
|
-
const
|
|
741
|
-
return ` ${i.name}(${
|
|
746
|
+
const l = I ? "inputHandles" : "_inputHandles";
|
|
747
|
+
return ` ${i.name}(${l}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
742
748
|
const inputs: SemaphorInputReference[] = [];
|
|
743
749
|
${I}
|
|
744
750
|
return inputs;
|
|
@@ -765,7 +771,7 @@ ${I}
|
|
|
765
771
|
'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
|
|
766
772
|
].filter(O).join(`
|
|
767
773
|
`);
|
|
768
|
-
return `${
|
|
774
|
+
return `${H}
|
|
769
775
|
${y}
|
|
770
776
|
|
|
771
777
|
export const inputsForView = {
|
|
@@ -797,7 +803,7 @@ ${p}
|
|
|
797
803
|
}
|
|
798
804
|
`;
|
|
799
805
|
}
|
|
800
|
-
function
|
|
806
|
+
function Le(e, n) {
|
|
801
807
|
return e.filterContracts.flatMap(
|
|
802
808
|
(r) => (r.bindings || []).filter((o) => o.viewId === n).map((o) => ({
|
|
803
809
|
inputId: r.inputId,
|
|
@@ -807,60 +813,60 @@ function De(e, n) {
|
|
|
807
813
|
}))
|
|
808
814
|
);
|
|
809
815
|
}
|
|
810
|
-
function
|
|
811
|
-
const n = e.views.map((
|
|
812
|
-
const d = Y(
|
|
813
|
-
const
|
|
814
|
-
return
|
|
816
|
+
function Je(e) {
|
|
817
|
+
const n = e.views.map((l) => {
|
|
818
|
+
const d = Y(l, e).map((m) => {
|
|
819
|
+
const c = M(m.raw, e);
|
|
820
|
+
return c ? ` ${m.name}: fields.${c},` : "";
|
|
815
821
|
}).filter(Boolean).join(`
|
|
816
822
|
`);
|
|
817
|
-
return ` ${
|
|
823
|
+
return ` ${l.name}: {
|
|
818
824
|
${d}
|
|
819
825
|
},`;
|
|
820
826
|
}).join(`
|
|
821
|
-
`), r = e.views.map((
|
|
822
|
-
const d = L(
|
|
823
|
-
const
|
|
824
|
-
return
|
|
827
|
+
`), r = e.views.map((l) => {
|
|
828
|
+
const d = L(l, e).map((m) => {
|
|
829
|
+
const c = M(m.raw, e);
|
|
830
|
+
return c ? ` ${m.name}: fields.${c},` : "";
|
|
825
831
|
}).filter(Boolean).join(`
|
|
826
832
|
`);
|
|
827
|
-
return ` ${
|
|
833
|
+
return ` ${l.name}: {
|
|
828
834
|
${d}
|
|
829
835
|
},`;
|
|
830
836
|
}).join(`
|
|
831
|
-
`), o = e.views.map((
|
|
832
|
-
const u = L(
|
|
833
|
-
const
|
|
837
|
+
`), o = e.views.map((l) => {
|
|
838
|
+
const u = L(l, e), d = en(u), m = Xe(u), c = u.map(($) => {
|
|
839
|
+
const F = Array.from(
|
|
834
840
|
new Set(
|
|
835
|
-
|
|
841
|
+
ge($.raw).filter((b) => m.has(b))
|
|
836
842
|
)
|
|
837
843
|
);
|
|
838
|
-
return ` ${
|
|
844
|
+
return ` ${$.name}: metricKeysForField(metricFieldsForView.${l.name}.${$.name}, { allowNameFallback: ${d.has($.raw.name) ? "false" : "true"}, excludedKeys: ${k(F)} }),`;
|
|
839
845
|
}).join(`
|
|
840
846
|
`);
|
|
841
|
-
return ` ${
|
|
842
|
-
${
|
|
847
|
+
return ` ${l.name}: {
|
|
848
|
+
${c}
|
|
843
849
|
},`;
|
|
844
850
|
}).join(`
|
|
845
|
-
`), t = e.views.map((
|
|
846
|
-
const d = L(
|
|
851
|
+
`), t = e.views.map((l) => {
|
|
852
|
+
const d = L(l, e).map((m) => ` ${m.name}: semaphorMetricMeasureBindingKey(metricFieldsForView.${l.name}.${m.name}),`).join(`
|
|
847
853
|
`);
|
|
848
|
-
return ` ${
|
|
854
|
+
return ` ${l.name}: {
|
|
849
855
|
${d}
|
|
850
856
|
},`;
|
|
851
857
|
}).join(`
|
|
852
|
-
`), a = e.views.map((
|
|
853
|
-
const u = L(
|
|
858
|
+
`), a = e.views.map((l) => {
|
|
859
|
+
const u = L(l, e);
|
|
854
860
|
if (u.length === 0)
|
|
855
|
-
return ` ${
|
|
861
|
+
return ` ${l.name}(): Record<keyof typeof metricFieldsForView.${l.name}, unknown> {
|
|
856
862
|
return {};
|
|
857
863
|
},`;
|
|
858
|
-
const d =
|
|
859
|
-
const
|
|
860
|
-
return ` ${
|
|
864
|
+
const d = Ze(l, u), m = u.map((c) => {
|
|
865
|
+
const $ = `metricMeasureKeysForView.${l.name}.${c.name}`, F = `metricMeasureBindingKeysForView.${l.name}.${c.name}`, b = d.has(c.name) ? `readMetricValueByBindingWithFallback(measures, measureBindings, ${F}, ${$}, scalarValue)` : `readMetricValueByBinding(measures, measureBindings, ${F}, ${$})`;
|
|
866
|
+
return ` ${c.name}: ${b},`;
|
|
861
867
|
}).join(`
|
|
862
868
|
`);
|
|
863
|
-
return ` ${
|
|
869
|
+
return ` ${l.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${l.name}, unknown> {
|
|
864
870
|
const measures = result?.measures;
|
|
865
871
|
const measureBindings = result?.measureBindings;
|
|
866
872
|
const scalarValue = result?.value;
|
|
@@ -870,24 +876,24 @@ ${m}
|
|
|
870
876
|
},`;
|
|
871
877
|
}).join(`
|
|
872
878
|
|
|
873
|
-
`), p = e.views.map((
|
|
874
|
-
const u =
|
|
875
|
-
return ` ${
|
|
879
|
+
`), p = e.views.map((l) => {
|
|
880
|
+
const u = ze(l, e);
|
|
881
|
+
return ` ${l.name}: ${k(u)},`;
|
|
876
882
|
}).join(`
|
|
877
|
-
`), f = e.views.map((
|
|
878
|
-
const d = Y(
|
|
883
|
+
`), f = e.views.map((l) => {
|
|
884
|
+
const d = Y(l, e).map((m) => ` ${m.name}: resolveColumnKey(columns, fieldsForView.${l.name}.${m.name}),`).join(`
|
|
879
885
|
`);
|
|
880
|
-
return ` ${
|
|
886
|
+
return ` ${l.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${l.name}, string | undefined> {
|
|
881
887
|
return {
|
|
882
888
|
${d}
|
|
883
889
|
};
|
|
884
890
|
},`;
|
|
885
891
|
}).join(`
|
|
886
892
|
|
|
887
|
-
`), h = e.views.map((
|
|
888
|
-
const d = Y(
|
|
893
|
+
`), h = e.views.map((l) => {
|
|
894
|
+
const d = Y(l, e).map((m) => ` ${m.name}: readCell(row, columns, fieldsForView.${l.name}.${m.name}),`).join(`
|
|
889
895
|
`);
|
|
890
|
-
return ` ${
|
|
896
|
+
return ` ${l.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${l.name}, unknown> {
|
|
891
897
|
return {
|
|
892
898
|
${d}
|
|
893
899
|
};
|
|
@@ -903,7 +909,7 @@ ${d}
|
|
|
903
909
|
y ? 'import { fields } from "./fields";' : void 0
|
|
904
910
|
].filter(O).join(`
|
|
905
911
|
`);
|
|
906
|
-
return `${
|
|
912
|
+
return `${H}
|
|
907
913
|
${I}
|
|
908
914
|
|
|
909
915
|
export type SemaphorGeneratedRow = Record<string, unknown>;
|
|
@@ -1251,12 +1257,12 @@ function sourcesReferToSameDataset(
|
|
|
1251
1257
|
}
|
|
1252
1258
|
`;
|
|
1253
1259
|
}
|
|
1254
|
-
function
|
|
1260
|
+
function ze(e, n) {
|
|
1255
1261
|
const r = Y(e, n), o = new Map(
|
|
1256
1262
|
(K(e) ? z(e, n) : []).map((t) => [t.fieldName, t.key])
|
|
1257
1263
|
);
|
|
1258
1264
|
return r.map((t) => {
|
|
1259
|
-
const a =
|
|
1265
|
+
const a = M(t.raw, n), p = a ? o.get(a) : void 0;
|
|
1260
1266
|
return A({
|
|
1261
1267
|
key: t.name,
|
|
1262
1268
|
label: t.raw.label || t.raw.name,
|
|
@@ -1266,7 +1272,7 @@ function Le(e, n) {
|
|
|
1266
1272
|
});
|
|
1267
1273
|
});
|
|
1268
1274
|
}
|
|
1269
|
-
function
|
|
1275
|
+
function Ye(e) {
|
|
1270
1276
|
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, o = e.summary.views.map((i) => i.id).filter(Boolean), t = e.views.map((i) => i.raw.id).filter(Boolean), a = e.inputs.map((i) => i.raw.id).filter(Boolean), p = e.optionQueries.map((i) => i.raw.id || `${i.input.raw.id}-options`).filter(Boolean), f = Object.fromEntries(t.map((i) => [
|
|
1271
1277
|
i,
|
|
1272
1278
|
e.filterContracts.filter(
|
|
@@ -1282,18 +1288,18 @@ function Je(e) {
|
|
|
1282
1288
|
sdkBuilder: i.raw.sdkBuilder
|
|
1283
1289
|
}
|
|
1284
1290
|
])), y = Object.fromEntries(e.views.map((i) => {
|
|
1285
|
-
var I,
|
|
1291
|
+
var I, l, u;
|
|
1286
1292
|
return [
|
|
1287
1293
|
i.name,
|
|
1288
1294
|
A({
|
|
1289
1295
|
viewId: i.raw.id,
|
|
1290
1296
|
viewTitle: ((I = i.raw.visualSpec) == null ? void 0 : I.title) || i.raw.title,
|
|
1291
|
-
visualType: (
|
|
1297
|
+
visualType: (l = i.raw.visualSpec) == null ? void 0 : l.visualType,
|
|
1292
1298
|
title: ((u = i.raw.visualSpec) == null ? void 0 : u.title) || i.raw.title
|
|
1293
1299
|
})
|
|
1294
1300
|
];
|
|
1295
1301
|
}));
|
|
1296
|
-
return `${
|
|
1302
|
+
return `${H}
|
|
1297
1303
|
export const generatedViewIds = ${k(o)} as const;
|
|
1298
1304
|
export const generatedQueryViewIds = ${k(t)} as const;
|
|
1299
1305
|
export const generatedInputIds = ${k(a)} as const;
|
|
@@ -1343,8 +1349,8 @@ export const semaphorGeneratedContractMetadata = ${k({
|
|
|
1343
1349
|
})} as const;
|
|
1344
1350
|
`;
|
|
1345
1351
|
}
|
|
1346
|
-
function
|
|
1347
|
-
return `${
|
|
1352
|
+
function We() {
|
|
1353
|
+
return `${H}
|
|
1348
1354
|
export * from "./sources";
|
|
1349
1355
|
export * from "./fields";
|
|
1350
1356
|
export * from "./inputs";
|
|
@@ -1360,21 +1366,21 @@ function T(e, n) {
|
|
|
1360
1366
|
for (const r of n) T(e, r);
|
|
1361
1367
|
return;
|
|
1362
1368
|
}
|
|
1363
|
-
|
|
1369
|
+
x(n) && g(e, P(n));
|
|
1364
1370
|
for (const r of Object.values(n))
|
|
1365
1371
|
T(e, r);
|
|
1366
1372
|
}
|
|
1367
1373
|
}
|
|
1368
1374
|
function Y(e, n) {
|
|
1369
1375
|
const r = [];
|
|
1370
|
-
if (
|
|
1376
|
+
if (nn(r, e.raw.sdkSpec), r.length === 0)
|
|
1371
1377
|
for (const t of e.raw.fields || [])
|
|
1372
1378
|
g(r, t);
|
|
1373
1379
|
const o = X(
|
|
1374
|
-
r.filter((t) => t.name &&
|
|
1380
|
+
r.filter((t) => t.name && M(t, n)).map((t) => ({ raw: t, key: D(t), name: "" })),
|
|
1375
1381
|
(t) => t.key
|
|
1376
1382
|
);
|
|
1377
|
-
return
|
|
1383
|
+
return v(
|
|
1378
1384
|
o,
|
|
1379
1385
|
(t) => Q(t.raw.label || t.raw.name || "field")
|
|
1380
1386
|
), o;
|
|
@@ -1382,38 +1388,38 @@ function Y(e, n) {
|
|
|
1382
1388
|
function L(e, n) {
|
|
1383
1389
|
if (B(e.raw.sdkSpec.builder) !== "metric")
|
|
1384
1390
|
return [];
|
|
1385
|
-
const r =
|
|
1391
|
+
const r = w(e.raw.sdkSpec.spec), o = [];
|
|
1386
1392
|
g(o, r == null ? void 0 : r.primaryMeasure);
|
|
1387
1393
|
for (const a of q(r == null ? void 0 : r.measures))
|
|
1388
1394
|
g(o, a);
|
|
1389
1395
|
const t = X(
|
|
1390
|
-
o.filter((a) => a.name &&
|
|
1396
|
+
o.filter((a) => a.name && M(a, n)).map((a) => ({ raw: a, key: D(a), name: "" })),
|
|
1391
1397
|
(a) => a.key
|
|
1392
1398
|
);
|
|
1393
|
-
return
|
|
1399
|
+
return v(
|
|
1394
1400
|
t,
|
|
1395
1401
|
(a) => Q(a.raw.label || a.raw.name || "metric")
|
|
1396
1402
|
), t;
|
|
1397
1403
|
}
|
|
1398
|
-
function
|
|
1404
|
+
function Ze(e, n) {
|
|
1399
1405
|
if (n.length === 1)
|
|
1400
1406
|
return /* @__PURE__ */ new Set([n[0].name]);
|
|
1401
|
-
const r =
|
|
1402
|
-
if (!
|
|
1407
|
+
const r = w(e.raw.sdkSpec.spec);
|
|
1408
|
+
if (!x(r == null ? void 0 : r.primaryMeasure))
|
|
1403
1409
|
return /* @__PURE__ */ new Set();
|
|
1404
1410
|
const o = D(P(r.primaryMeasure)), t = n.find((a) => a.key === o);
|
|
1405
1411
|
return t ? /* @__PURE__ */ new Set([t.name]) : /* @__PURE__ */ new Set();
|
|
1406
1412
|
}
|
|
1407
|
-
function
|
|
1413
|
+
function Xe(e) {
|
|
1408
1414
|
const n = /* @__PURE__ */ new Map();
|
|
1409
1415
|
for (const r of e)
|
|
1410
|
-
for (const o of new Set(
|
|
1416
|
+
for (const o of new Set(ge(r.raw)))
|
|
1411
1417
|
n.set(o, (n.get(o) || 0) + 1);
|
|
1412
1418
|
return new Set(
|
|
1413
1419
|
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1414
1420
|
);
|
|
1415
1421
|
}
|
|
1416
|
-
function
|
|
1422
|
+
function ge(e) {
|
|
1417
1423
|
const n = (e.aggregate || "SUM").toUpperCase();
|
|
1418
1424
|
return _([
|
|
1419
1425
|
`${n.toLowerCase()}_${e.name}`,
|
|
@@ -1423,7 +1429,7 @@ function ye(e) {
|
|
|
1423
1429
|
e.name
|
|
1424
1430
|
]);
|
|
1425
1431
|
}
|
|
1426
|
-
function
|
|
1432
|
+
function en(e) {
|
|
1427
1433
|
const n = /* @__PURE__ */ new Map();
|
|
1428
1434
|
for (const r of e)
|
|
1429
1435
|
n.set(r.raw.name, (n.get(r.raw.name) || 0) + 1);
|
|
@@ -1431,8 +1437,8 @@ function Ze(e) {
|
|
|
1431
1437
|
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1432
1438
|
);
|
|
1433
1439
|
}
|
|
1434
|
-
function
|
|
1435
|
-
const r =
|
|
1440
|
+
function nn(e, n) {
|
|
1441
|
+
const r = w(n.spec);
|
|
1436
1442
|
if (!r)
|
|
1437
1443
|
return;
|
|
1438
1444
|
const o = B(n.builder);
|
|
@@ -1452,35 +1458,35 @@ function Xe(e, n) {
|
|
|
1452
1458
|
return;
|
|
1453
1459
|
}
|
|
1454
1460
|
if (o === "matrix") {
|
|
1455
|
-
const t =
|
|
1456
|
-
for (const f of t)
|
|
1457
|
-
for (const f of a)
|
|
1461
|
+
const t = pe(r.rows), a = pe(r.columns), p = q(r.values);
|
|
1462
|
+
for (const f of t) le(e, f);
|
|
1463
|
+
for (const f of a) le(e, f);
|
|
1458
1464
|
for (const f of p) {
|
|
1459
|
-
const h =
|
|
1465
|
+
const h = w(f);
|
|
1460
1466
|
g(e, h == null ? void 0 : h.field), g(e, h == null ? void 0 : h.measure);
|
|
1461
1467
|
}
|
|
1462
1468
|
}
|
|
1463
1469
|
}
|
|
1464
|
-
function
|
|
1470
|
+
function pe(e) {
|
|
1465
1471
|
if (Array.isArray(e))
|
|
1466
1472
|
return e;
|
|
1467
|
-
const n =
|
|
1473
|
+
const n = w(e);
|
|
1468
1474
|
return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
|
|
1469
1475
|
}
|
|
1470
|
-
function
|
|
1476
|
+
function le(e, n) {
|
|
1471
1477
|
var r;
|
|
1472
|
-
if (
|
|
1478
|
+
if (x(n)) {
|
|
1473
1479
|
g(e, n);
|
|
1474
1480
|
return;
|
|
1475
1481
|
}
|
|
1476
|
-
g(e, (r =
|
|
1482
|
+
g(e, (r = w(n)) == null ? void 0 : r.field);
|
|
1477
1483
|
}
|
|
1478
1484
|
function ce(e) {
|
|
1479
1485
|
var n, r, o, t;
|
|
1480
1486
|
return ((n = e == null ? void 0 : e.computation) == null ? void 0 : n.kind) === "presentation_only" || ((r = e == null ? void 0 : e.computation) == null ? void 0 : r.kind) === "derived" || ((o = e == null ? void 0 : e.computation) == null ? void 0 : o.kind) === "unsupported" || (e == null ? void 0 : e.visual) === "text_block" || ((t = e == null ? void 0 : e.visualSpec) == null ? void 0 : t.visualType) === "text_block";
|
|
1481
1487
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const n =
|
|
1488
|
+
function rn(e) {
|
|
1489
|
+
const n = w(e) || {};
|
|
1484
1490
|
return A({
|
|
1485
1491
|
id: e.id,
|
|
1486
1492
|
title: e.title,
|
|
@@ -1496,7 +1502,7 @@ function en(e) {
|
|
|
1496
1502
|
});
|
|
1497
1503
|
}
|
|
1498
1504
|
function g(e, n) {
|
|
1499
|
-
|
|
1505
|
+
x(n) && e.push(P(n));
|
|
1500
1506
|
}
|
|
1501
1507
|
function P(e) {
|
|
1502
1508
|
return {
|
|
@@ -1509,27 +1515,27 @@ function P(e) {
|
|
|
1509
1515
|
...e.source ? { source: e.source } : {}
|
|
1510
1516
|
};
|
|
1511
1517
|
}
|
|
1512
|
-
function
|
|
1518
|
+
function tn(e) {
|
|
1513
1519
|
if (!e.source)
|
|
1514
1520
|
return;
|
|
1515
1521
|
const n = {
|
|
1516
1522
|
...e.source,
|
|
1517
1523
|
...e.sourceKey ? { sourceKey: e.sourceKey } : {}
|
|
1518
|
-
}, r =
|
|
1524
|
+
}, r = we(n);
|
|
1519
1525
|
if (r)
|
|
1520
1526
|
return {
|
|
1521
1527
|
raw: n,
|
|
1522
1528
|
key: r,
|
|
1523
|
-
aliases:
|
|
1529
|
+
aliases: $e(n),
|
|
1524
1530
|
name: ""
|
|
1525
1531
|
};
|
|
1526
1532
|
}
|
|
1527
|
-
function
|
|
1528
|
-
const n =
|
|
1533
|
+
function x(e) {
|
|
1534
|
+
const n = w(e);
|
|
1529
1535
|
return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
|
|
1530
1536
|
}
|
|
1531
|
-
function
|
|
1532
|
-
const n =
|
|
1537
|
+
function he(e) {
|
|
1538
|
+
const n = w(e);
|
|
1533
1539
|
return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
|
|
1534
1540
|
}
|
|
1535
1541
|
function C(e, n) {
|
|
@@ -1539,26 +1545,26 @@ function C(e, n) {
|
|
|
1539
1545
|
return JSON.stringify(e);
|
|
1540
1546
|
if (Array.isArray(e))
|
|
1541
1547
|
return `[${e.map((t) => C(t, n)).join(", ")}]`;
|
|
1542
|
-
if (
|
|
1543
|
-
const t =
|
|
1548
|
+
if (x(e)) {
|
|
1549
|
+
const t = M(P(e), n);
|
|
1544
1550
|
if (t) return `fields.${t}`;
|
|
1545
1551
|
}
|
|
1546
|
-
if (
|
|
1547
|
-
const t =
|
|
1552
|
+
if (he(e)) {
|
|
1553
|
+
const t = Se(e, n);
|
|
1548
1554
|
if (t) return `sources.${t}`;
|
|
1549
1555
|
}
|
|
1550
|
-
const r =
|
|
1556
|
+
const r = w(e);
|
|
1551
1557
|
return r ? `{ ${Object.entries(r).filter(([, t]) => t !== void 0).map(([t, a]) => `${JSON.stringify(t)}: ${C(a, n)}`).join(", ")} }` : JSON.stringify(e);
|
|
1552
1558
|
}
|
|
1553
1559
|
function k(e) {
|
|
1554
1560
|
return JSON.stringify(e, null, 2);
|
|
1555
1561
|
}
|
|
1556
|
-
function
|
|
1557
|
-
if (
|
|
1562
|
+
function M(e, n) {
|
|
1563
|
+
if (x(e))
|
|
1558
1564
|
return n.fieldNameByKey.get(D(P(e)));
|
|
1559
1565
|
}
|
|
1560
|
-
function
|
|
1561
|
-
if (
|
|
1566
|
+
function Se(e, n) {
|
|
1567
|
+
if (he(e))
|
|
1562
1568
|
for (const r of Z(e)) {
|
|
1563
1569
|
const o = n.sourceNameByKey.get(r);
|
|
1564
1570
|
if (o)
|
|
@@ -1573,15 +1579,15 @@ function D(e) {
|
|
|
1573
1579
|
e.aggregate || ""
|
|
1574
1580
|
].join("|");
|
|
1575
1581
|
}
|
|
1576
|
-
function
|
|
1577
|
-
return !
|
|
1582
|
+
function on(e, n) {
|
|
1583
|
+
return !x(e) || !x(n) || e.name !== n.name ? !1 : ie(e).some(
|
|
1578
1584
|
(r) => ie(n).includes(r)
|
|
1579
1585
|
);
|
|
1580
1586
|
}
|
|
1581
|
-
function
|
|
1582
|
-
return
|
|
1587
|
+
function sn(e) {
|
|
1588
|
+
return x(e) && e.role === "id";
|
|
1583
1589
|
}
|
|
1584
|
-
function
|
|
1590
|
+
function an(e) {
|
|
1585
1591
|
const n = [], r = /* @__PURE__ */ new Map();
|
|
1586
1592
|
for (const o of e) {
|
|
1587
1593
|
const t = _(o.aliases.length ? o.aliases : [o.key]), a = t.map((p) => r.get(p)).find(O);
|
|
@@ -1595,7 +1601,7 @@ function on(e) {
|
|
|
1595
1601
|
}
|
|
1596
1602
|
return n;
|
|
1597
1603
|
}
|
|
1598
|
-
function
|
|
1604
|
+
function un(e) {
|
|
1599
1605
|
const n = /* @__PURE__ */ new Map();
|
|
1600
1606
|
for (const r of e)
|
|
1601
1607
|
for (const o of _([r.key, ...r.aliases])) {
|
|
@@ -1609,11 +1615,11 @@ function sn(e) {
|
|
|
1609
1615
|
function _(e) {
|
|
1610
1616
|
return Array.from(new Set(e.filter(Boolean)));
|
|
1611
1617
|
}
|
|
1612
|
-
function
|
|
1618
|
+
function we(e) {
|
|
1613
1619
|
return Z(e)[0] || de(e);
|
|
1614
1620
|
}
|
|
1615
1621
|
function Z(e) {
|
|
1616
|
-
const n =
|
|
1622
|
+
const n = w(e);
|
|
1617
1623
|
if (!n)
|
|
1618
1624
|
return [];
|
|
1619
1625
|
const r = [];
|
|
@@ -1623,18 +1629,18 @@ function Z(e) {
|
|
|
1623
1629
|
}
|
|
1624
1630
|
return r.length === 0 && r.push(de(e)), _(r);
|
|
1625
1631
|
}
|
|
1626
|
-
function
|
|
1632
|
+
function $e(e) {
|
|
1627
1633
|
return Z(e);
|
|
1628
1634
|
}
|
|
1629
1635
|
function de(e) {
|
|
1630
|
-
const n =
|
|
1636
|
+
const n = w(e);
|
|
1631
1637
|
return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
|
|
1632
1638
|
}
|
|
1633
|
-
function
|
|
1634
|
-
return
|
|
1639
|
+
function dn(e) {
|
|
1640
|
+
return x(e) && ie(e)[0] || "";
|
|
1635
1641
|
}
|
|
1636
1642
|
function ie(e) {
|
|
1637
|
-
return
|
|
1643
|
+
return x(e) ? _([
|
|
1638
1644
|
...typeof e.sourceKey == "string" ? [e.sourceKey] : [],
|
|
1639
1645
|
...e.source ? Z(e.source) : []
|
|
1640
1646
|
]) : [];
|
|
@@ -1645,15 +1651,15 @@ function B(e) {
|
|
|
1645
1651
|
throw new Error(`Unsupported sdkSpec builder: ${e}`);
|
|
1646
1652
|
return n;
|
|
1647
1653
|
}
|
|
1648
|
-
function
|
|
1654
|
+
function pn(e) {
|
|
1649
1655
|
const n = B(e);
|
|
1650
1656
|
return n === "records" || n === "sql";
|
|
1651
1657
|
}
|
|
1652
|
-
function
|
|
1653
|
-
const n =
|
|
1658
|
+
function ln(e) {
|
|
1659
|
+
const n = w(e);
|
|
1654
1660
|
return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
|
|
1655
1661
|
}
|
|
1656
|
-
function
|
|
1662
|
+
function v(e, n) {
|
|
1657
1663
|
const r = /* @__PURE__ */ new Map();
|
|
1658
1664
|
for (const o of e) {
|
|
1659
1665
|
const t = n(o) || "item", a = r.get(t) || 0;
|
|
@@ -1678,14 +1684,14 @@ function Q(e) {
|
|
|
1678
1684
|
].join("");
|
|
1679
1685
|
return /^[A-Za-z_$]/.test(t) ? t : `item${t}`;
|
|
1680
1686
|
}
|
|
1681
|
-
function
|
|
1687
|
+
function cn(e) {
|
|
1682
1688
|
const n = String(e).split(":");
|
|
1683
1689
|
return n[n.length - 1] || String(e);
|
|
1684
1690
|
}
|
|
1685
1691
|
function A(e) {
|
|
1686
1692
|
return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
|
|
1687
1693
|
}
|
|
1688
|
-
function
|
|
1694
|
+
function w(e) {
|
|
1689
1695
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1690
1696
|
}
|
|
1691
1697
|
function q(e) {
|
|
@@ -1698,24 +1704,24 @@ function O(e) {
|
|
|
1698
1704
|
return e !== void 0;
|
|
1699
1705
|
}
|
|
1700
1706
|
export {
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1707
|
+
Vn as CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1708
|
+
ke as CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1709
|
+
Re as CONTRACT_MANIFEST_SCHEMA_VERSION,
|
|
1710
|
+
yn as DEFAULT_GENERATED_CONTRACT_OUTPUT_DIR,
|
|
1705
1711
|
me as GENERATED_CONTRACT_SCHEMA_VERSION,
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1712
|
+
kn as GENERATED_CONTRACT_TYPESCRIPT_FILES,
|
|
1713
|
+
Rn as REQUIRED_GENERATED_CONTRACT_FILES,
|
|
1714
|
+
wn as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1715
|
+
$n as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1716
|
+
Ve as assertValidCodegenSummary,
|
|
1717
|
+
Mn as buildSemaphorGeneratedActiveInput,
|
|
1718
|
+
Nn as buildSemaphorGeneratedInputOptionIntent,
|
|
1719
|
+
xn as buildSemaphorGeneratedViewExecutionRequest,
|
|
1720
|
+
Cn as buildSemaphorGeneratedViewExecutionRequests,
|
|
1721
|
+
On as evaluateSemaphorDataAppContractUpdatePolicy,
|
|
1722
|
+
gn as generateSemaphorDataAppContract,
|
|
1723
|
+
In as isSemaphorDataAppCodegenSummary,
|
|
1724
|
+
Gn as validateCodegenSummary,
|
|
1725
|
+
Fn as validateSemaphorDataAppCodegenSummary,
|
|
1726
|
+
Kn as validateSemaphorGeneratedContract
|
|
1721
1727
|
};
|