react-semaphor 0.1.417 → 0.1.418
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 +49 -50
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/analyze-result-contract-Akysi2ML.js +2003 -0
- package/dist/chunks/analyze-result-contract-COjyJzYm.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-BOfryj8P.js → calendar-preferences-dialog-BbuLgela.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-Rq9qiG3X.js → calendar-preferences-dialog-CInkkhl_.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D_P0cNQ_.js → dashboard-briefing-launcher-B4OWNsVD.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DgvlOcRI.js → dashboard-briefing-launcher-D7FNuDuc.js} +4 -4
- package/dist/chunks/{dashboard-controls-DzVA-wWu.js → dashboard-controls-DTC1eCz0.js} +1 -1
- package/dist/chunks/{dashboard-controls-JYTKRokc.js → dashboard-controls-DcX7Mid4.js} +5 -5
- package/dist/chunks/{dashboard-json-h6YMk_-l.js → dashboard-json-BHWbQS6I.js} +3 -3
- package/dist/chunks/{dashboard-json-D5TEri2w.js → dashboard-json-vu38P5pV.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-kfbu03n9.js → edit-dashboard-visual-CkBhJBhp.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DOtCYmDn.js → edit-dashboard-visual-DsCr90_3.js} +4 -4
- package/dist/chunks/{index-BgESS5r7.js → index-C56DuHI8.js} +163 -164
- package/dist/chunks/{index-Beol8cOo.js → index-C8thRvkW.js} +4 -4
- package/dist/chunks/{switch--FHwRAOL.js → switch-BXuyni6l.js} +1 -1
- package/dist/chunks/{switch-C8_t4Pio.js → switch-Dsx-IwBE.js} +1 -1
- package/dist/chunks/{update-policy-CQLHKQ_h.js → update-policy-B5S_LfEu.js} +161 -142
- package/dist/chunks/update-policy-BqBKUk3Q.js +3 -0
- package/dist/chunks/{use-create-flow-overlay-state-BEPWzqQn.js → use-create-flow-overlay-state-BDv_VpL6.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-NEs9ePDy.js → use-create-flow-overlay-state-CzftV84t.js} +3 -3
- package/dist/chunks/{validators-UqQI3Cg_.js → validators-CLzrE2N_.js} +1 -1
- package/dist/chunks/validators-CPFcUMrV.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 +28 -29
- 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 +154 -125
- package/dist/data-app-codegen-node/index.js +695 -613
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +171 -157
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +26 -27
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +17 -18
- 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 +5 -0
- package/dist/types/dashboard-assistant.d.ts +1 -0
- package/dist/types/data-app-codegen-node.d.ts +2 -1
- package/dist/types/data-app-codegen.d.ts +2 -1
- package/dist/types/data-app-sdk-validation.d.ts +1 -0
- package/dist/types/data-app-sdk.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunks/analyze-result-contract-B0O3oIYu.js +0 -1870
- package/dist/chunks/analyze-result-contract-CL97m8X8.js +0 -1
- package/dist/chunks/source-identity-BM2FvJDP.js +0 -1
- package/dist/chunks/source-identity-Cv4Nm3TM.js +0 -75
- package/dist/chunks/update-policy-B50M0Jeg.js +0 -3
- package/dist/chunks/validators-JzI7olk4.js +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { c as
|
|
3
|
-
import { C as
|
|
4
|
-
import { createHash as
|
|
5
|
-
const
|
|
1
|
+
import { S as In, a as Fn, i as bn, v as Vn } from "../chunks/analyze-result-contract-Akysi2ML.js";
|
|
2
|
+
import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-B5S_LfEu.js";
|
|
3
|
+
import { C as Rn, e as Mn, R as Nn, f as xn, g as Cn, h as On, i as Gn, j as Kn, v as En, d as An } from "../chunks/update-policy-B5S_LfEu.js";
|
|
4
|
+
import { createHash as ye } from "node:crypto";
|
|
5
|
+
const hn = "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 wn(e, n = {}) {
|
|
9
|
+
ke(e);
|
|
10
|
+
const r = Ne(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
|
|
15
|
+
const t = Ce(r), o = Oe({
|
|
16
16
|
contract: r,
|
|
17
|
-
files:
|
|
17
|
+
files: t,
|
|
18
18
|
generatorName: n.generatorName || "react-semaphor/data-app-codegen/node",
|
|
19
19
|
generatorVersion: n.generatorVersion || "unknown"
|
|
20
|
-
}),
|
|
21
|
-
...
|
|
22
|
-
"contract.manifest.json": `${JSON.stringify(
|
|
20
|
+
}), i = {
|
|
21
|
+
...t,
|
|
22
|
+
"contract.manifest.json": `${JSON.stringify(o, null, 2)}
|
|
23
23
|
`
|
|
24
24
|
};
|
|
25
25
|
return {
|
|
26
|
-
schemaVersion:
|
|
27
|
-
files:
|
|
28
|
-
manifest:
|
|
29
|
-
contentHash: String(
|
|
30
|
-
usageExample:
|
|
26
|
+
schemaVersion: fe,
|
|
27
|
+
files: i,
|
|
28
|
+
manifest: o,
|
|
29
|
+
contentHash: String(o.generatedContentHash || ""),
|
|
30
|
+
usageExample: Ee(r),
|
|
31
31
|
warnings: r.warnings,
|
|
32
32
|
stats: {
|
|
33
33
|
inputCount: r.inputs.length,
|
|
@@ -38,199 +38,199 @@ function gn(e, n = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
41
|
+
function Ne(e) {
|
|
42
|
+
var d, s, u, c, p, S, I, F, b, K, V, N;
|
|
43
43
|
const n = [], r = [];
|
|
44
|
-
for (const
|
|
45
|
-
g(r,
|
|
46
|
-
for (const
|
|
47
|
-
g(r,
|
|
48
|
-
g(r, (
|
|
44
|
+
for (const a of e.inputs) {
|
|
45
|
+
g(r, a.fieldRef);
|
|
46
|
+
for (const w of a.bindings || [])
|
|
47
|
+
g(r, w.fieldRef);
|
|
48
|
+
g(r, (d = a.optionQuery) == null ? void 0 : d.valueFieldRef), g(r, (s = a.optionQuery) == null ? void 0 : s.labelFieldRef), g(r, (u = a.optionQuery) == null ? void 0 : u.filterFieldRef), Q(r, (c = a.optionQuery) == null ? void 0 : c.spec);
|
|
49
49
|
}
|
|
50
|
-
for (const
|
|
51
|
-
g(r,
|
|
52
|
-
for (const
|
|
53
|
-
g(r,
|
|
50
|
+
for (const a of e.filterContracts) {
|
|
51
|
+
g(r, a.fieldRef), g(r, (p = a.optionQuery) == null ? void 0 : p.valueFieldRef), g(r, (S = a.optionQuery) == null ? void 0 : S.labelFieldRef), g(r, (I = a.optionQuery) == null ? void 0 : I.filterFieldRef), Q(r, (F = a.optionQuery) == null ? void 0 : F.spec);
|
|
52
|
+
for (const w of a.bindings || [])
|
|
53
|
+
g(r, w.fieldRef);
|
|
54
54
|
}
|
|
55
|
-
for (const
|
|
56
|
-
for (const
|
|
57
|
-
g(r,
|
|
58
|
-
|
|
55
|
+
for (const a of e.views) {
|
|
56
|
+
for (const w of a.fields || [])
|
|
57
|
+
g(r, w);
|
|
58
|
+
Q(r, (b = a.sdkSpec) == null ? void 0 : b.spec), Q(r, a.visualSpec);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
for (const
|
|
62
|
-
for (const
|
|
63
|
-
g(r,
|
|
64
|
-
for (const
|
|
65
|
-
g(r,
|
|
66
|
-
const
|
|
60
|
+
const t = e.implementationChecklist || {};
|
|
61
|
+
for (const a of Object.values(t.bindingsByView || {}))
|
|
62
|
+
for (const w of Array.isArray(a) ? a : [])
|
|
63
|
+
g(r, w.fieldRef), g(r, w.optionValueField), g(r, w.optionLabelField);
|
|
64
|
+
for (const a of t.requiredInputOptions || [])
|
|
65
|
+
g(r, a.visibleLabelField), g(r, a.optionValueField), g(r, a.runtimeFilterField);
|
|
66
|
+
const o = dn(
|
|
67
67
|
[
|
|
68
|
-
...e.sources.map((
|
|
69
|
-
raw:
|
|
70
|
-
key:
|
|
71
|
-
aliases:
|
|
68
|
+
...e.sources.map((a) => ({
|
|
69
|
+
raw: a,
|
|
70
|
+
key: $e(a),
|
|
71
|
+
aliases: Ie(a),
|
|
72
72
|
name: ""
|
|
73
73
|
})),
|
|
74
|
-
...r.map((
|
|
74
|
+
...r.map((a) => sn(a)).filter(G)
|
|
75
75
|
]
|
|
76
76
|
);
|
|
77
|
-
v(
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
|
|
77
|
+
v(o, (a) => {
|
|
78
|
+
const w = $(a.raw);
|
|
79
|
+
return B(
|
|
80
|
+
a.raw.label || (w == null ? void 0 : w.datasetName) || (w == null ? void 0 : w.datasetId) || (w == null ? void 0 : w.name) || a.raw.kind || "source"
|
|
81
81
|
);
|
|
82
82
|
});
|
|
83
|
-
const
|
|
84
|
-
r.filter((
|
|
85
|
-
raw:
|
|
86
|
-
key:
|
|
83
|
+
const i = pn(o), l = X(
|
|
84
|
+
r.filter((a) => a.name).map((a) => ({
|
|
85
|
+
raw: a,
|
|
86
|
+
key: U(a),
|
|
87
87
|
name: ""
|
|
88
88
|
})),
|
|
89
|
-
(
|
|
89
|
+
(a) => a.key
|
|
90
90
|
);
|
|
91
91
|
v(
|
|
92
|
-
|
|
93
|
-
(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
l,
|
|
93
|
+
(a) => B([
|
|
94
|
+
a.raw.sourceKey ? fn(a.raw.sourceKey) : "",
|
|
95
|
+
a.raw.aggregate ? a.raw.aggregate.toLowerCase() : "",
|
|
96
|
+
a.raw.name
|
|
97
97
|
].filter(Boolean).join("_"))
|
|
98
98
|
);
|
|
99
|
-
const
|
|
100
|
-
raw:
|
|
101
|
-
name:
|
|
99
|
+
const y = new Map(l.map((a) => [a.key, a.name])), h = e.inputs.map((a) => ({
|
|
100
|
+
raw: a,
|
|
101
|
+
name: B(a.id || a.label || "input")
|
|
102
102
|
}));
|
|
103
|
-
v(h, (
|
|
104
|
-
const
|
|
105
|
-
input:
|
|
106
|
-
name: `${
|
|
107
|
-
raw:
|
|
103
|
+
v(h, (a) => a.name);
|
|
104
|
+
const f = h.filter((a) => !!a.raw.optionQuery).map((a) => ({
|
|
105
|
+
input: a,
|
|
106
|
+
name: `${a.name}Options`,
|
|
107
|
+
raw: a.raw.optionQuery
|
|
108
108
|
}));
|
|
109
|
-
v(
|
|
110
|
-
for (const
|
|
111
|
-
|
|
112
|
-
`Input option query ${((
|
|
109
|
+
v(f, (a) => a.name);
|
|
110
|
+
for (const a of f)
|
|
111
|
+
an(a.raw.labelFieldRef, a.raw.valueFieldRef) && un(a.raw.valueFieldRef) && n.push(
|
|
112
|
+
`Input option query ${((K = a.raw.spec) == null ? void 0 : K.inputId) || a.input.raw.id || a.name} uses identifier field ${a.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
|
-
const
|
|
115
|
-
(
|
|
116
|
-
var
|
|
117
|
-
return !!((
|
|
114
|
+
const m = e.views.filter(
|
|
115
|
+
(a) => {
|
|
116
|
+
var w, T;
|
|
117
|
+
return !!((w = a.sdkSpec) != null && w.builder && ((T = a.sdkSpec) != null && T.spec));
|
|
118
118
|
}
|
|
119
|
-
).map((
|
|
120
|
-
raw:
|
|
121
|
-
name:
|
|
119
|
+
).map((a) => ({
|
|
120
|
+
raw: a,
|
|
121
|
+
name: B(a.id || a.title || "query")
|
|
122
122
|
}));
|
|
123
|
-
v(
|
|
124
|
-
const
|
|
125
|
-
for (const
|
|
126
|
-
(!("sdkSpec" in
|
|
127
|
-
return
|
|
123
|
+
v(m, (a) => a.name);
|
|
124
|
+
const M = e.views.filter((a) => ce(a) && !("sdkSpec" in a)).map((a) => on(a));
|
|
125
|
+
for (const a of e.views)
|
|
126
|
+
(!("sdkSpec" in a) || !((V = a.sdkSpec) != null && V.builder) || !((N = a.sdkSpec) != null && N.spec)) && !ce(a) && n.push(`Skipped view ${a.id || a.title || "unknown"} because it has no sdkSpec.`);
|
|
127
|
+
return xe({
|
|
128
128
|
inputs: h,
|
|
129
|
-
views:
|
|
129
|
+
views: m,
|
|
130
130
|
filterContracts: e.filterContracts
|
|
131
131
|
}), {
|
|
132
132
|
summary: e,
|
|
133
133
|
title: e.title || "Semaphor Data App",
|
|
134
|
-
sources:
|
|
135
|
-
fields:
|
|
134
|
+
sources: o,
|
|
135
|
+
fields: l,
|
|
136
136
|
inputs: h,
|
|
137
|
-
optionQueries:
|
|
138
|
-
views:
|
|
139
|
-
presentationViews:
|
|
137
|
+
optionQueries: f,
|
|
138
|
+
views: m,
|
|
139
|
+
presentationViews: M,
|
|
140
140
|
filterContracts: e.filterContracts,
|
|
141
|
-
checklist:
|
|
142
|
-
sourceNameByKey:
|
|
143
|
-
fieldNameByKey:
|
|
141
|
+
checklist: t,
|
|
142
|
+
sourceNameByKey: i,
|
|
143
|
+
fieldNameByKey: y,
|
|
144
144
|
warnings: n
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function xe({
|
|
148
148
|
inputs: e,
|
|
149
149
|
views: n,
|
|
150
150
|
filterContracts: r
|
|
151
151
|
}) {
|
|
152
|
-
const
|
|
153
|
-
for (const [
|
|
154
|
-
if (!
|
|
155
|
-
throw new Error(`filterContracts.${
|
|
156
|
-
const
|
|
157
|
-
for (const [
|
|
158
|
-
if (!
|
|
152
|
+
const t = new Set(e.map((i) => i.raw.id).filter(Boolean)), o = new Set(n.map((i) => i.raw.id).filter(Boolean));
|
|
153
|
+
for (const [i, l] of r.entries()) {
|
|
154
|
+
if (!t.has(l.inputId))
|
|
155
|
+
throw new Error(`filterContracts.${i}.inputId must reference a generated input.`);
|
|
156
|
+
const y = new Set(l.appliesToViewIds || []), h = new Set(l.notAppliedToViewIds || []);
|
|
157
|
+
for (const [f, m] of (l.appliesToViewIds || []).entries())
|
|
158
|
+
if (!o.has(m))
|
|
159
159
|
throw new Error(
|
|
160
|
-
`filterContracts.${
|
|
160
|
+
`filterContracts.${i}.appliesToViewIds.${f} must reference an executable generated view.`
|
|
161
161
|
);
|
|
162
|
-
for (const [
|
|
163
|
-
if (!
|
|
162
|
+
for (const [f, m] of (l.notAppliedToViewIds || []).entries())
|
|
163
|
+
if (!o.has(m))
|
|
164
164
|
throw new Error(
|
|
165
|
-
`filterContracts.${
|
|
165
|
+
`filterContracts.${i}.notAppliedToViewIds.${f} must reference an executable generated view.`
|
|
166
166
|
);
|
|
167
|
-
for (const [
|
|
168
|
-
if (!
|
|
167
|
+
for (const [f, m] of (l.bindings || []).entries()) {
|
|
168
|
+
if (!o.has(m.viewId))
|
|
169
169
|
throw new Error(
|
|
170
|
-
`filterContracts.${
|
|
170
|
+
`filterContracts.${i}.bindings.${f}.viewId must reference an executable generated view.`
|
|
171
171
|
);
|
|
172
|
-
if (!
|
|
172
|
+
if (!y.has(m.viewId))
|
|
173
173
|
throw new Error(
|
|
174
|
-
`filterContracts.${
|
|
174
|
+
`filterContracts.${i}.bindings.${f}.viewId must be included in appliesToViewIds.`
|
|
175
175
|
);
|
|
176
|
-
if (h.has(
|
|
176
|
+
if (h.has(m.viewId))
|
|
177
177
|
throw new Error(
|
|
178
|
-
`filterContracts.${
|
|
178
|
+
`filterContracts.${i}.bindings.${f}.viewId must not be listed in notAppliedToViewIds.`
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function Ce(e) {
|
|
184
184
|
return {
|
|
185
185
|
"sources.ts": ve(e),
|
|
186
|
-
"fields.ts":
|
|
187
|
-
"inputs.ts":
|
|
188
|
-
"queries.ts":
|
|
189
|
-
"bindings.ts":
|
|
190
|
-
"accessors.ts":
|
|
191
|
-
"metadata.ts":
|
|
192
|
-
"index.ts":
|
|
186
|
+
"fields.ts": Be(e),
|
|
187
|
+
"inputs.ts": Te(e),
|
|
188
|
+
"queries.ts": _e(e),
|
|
189
|
+
"bindings.ts": Le(e),
|
|
190
|
+
"accessors.ts": ze(e),
|
|
191
|
+
"metadata.ts": We(e),
|
|
192
|
+
"index.ts": Ze()
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Oe({
|
|
196
196
|
contract: e,
|
|
197
197
|
files: n,
|
|
198
198
|
generatorName: r,
|
|
199
|
-
generatorVersion:
|
|
199
|
+
generatorVersion: t
|
|
200
200
|
}) {
|
|
201
201
|
return {
|
|
202
|
-
schemaVersion:
|
|
203
|
-
generatedContractSchemaVersion:
|
|
202
|
+
schemaVersion: Me,
|
|
203
|
+
generatedContractSchemaVersion: fe,
|
|
204
204
|
generator: {
|
|
205
205
|
name: r,
|
|
206
|
-
version:
|
|
206
|
+
version: t
|
|
207
207
|
},
|
|
208
|
-
generatedContentHash:
|
|
209
|
-
codegenSummaryValidatorVersion:
|
|
210
|
-
codegenSummaryHash:
|
|
208
|
+
generatedContentHash: Ge(n),
|
|
209
|
+
codegenSummaryValidatorVersion: Re,
|
|
210
|
+
codegenSummaryHash: Ke(e.summary),
|
|
211
211
|
codegenSummary: e.summary
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
const n =
|
|
214
|
+
function Ge(e) {
|
|
215
|
+
const n = ye("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
|
|
221
|
-
return `sha256:${
|
|
220
|
+
function Ke(e) {
|
|
221
|
+
return `sha256:${ye("sha256").update(ae(e)).digest("hex")}`;
|
|
222
222
|
}
|
|
223
223
|
function ae(e) {
|
|
224
224
|
if (e === null || typeof e != "object")
|
|
225
225
|
return JSON.stringify(e);
|
|
226
226
|
if (Array.isArray(e))
|
|
227
|
-
return `[${e.map((
|
|
227
|
+
return `[${e.map((t) => ae(t)).join(",")}]`;
|
|
228
228
|
const n = e;
|
|
229
|
-
return `{${Object.keys(n).sort().filter((
|
|
229
|
+
return `{${Object.keys(n).sort().filter((t) => n[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(n[t])}`).join(",")}}`;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function Ee(e) {
|
|
232
232
|
const n = e.views.find(
|
|
233
|
-
(
|
|
233
|
+
(f) => E(f) && A(f)
|
|
234
234
|
);
|
|
235
235
|
if (n)
|
|
236
236
|
return [
|
|
@@ -246,7 +246,7 @@ function Ke(e) {
|
|
|
246
246
|
].join(`
|
|
247
247
|
`);
|
|
248
248
|
const r = e.views.find(
|
|
249
|
-
(
|
|
249
|
+
(f) => E(f)
|
|
250
250
|
);
|
|
251
251
|
if (r)
|
|
252
252
|
return [
|
|
@@ -261,98 +261,98 @@ function Ke(e) {
|
|
|
261
261
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
262
262
|
].join(`
|
|
263
263
|
`);
|
|
264
|
-
const
|
|
265
|
-
(
|
|
264
|
+
const t = e.views.find(
|
|
265
|
+
(f) => W(f) && A(f)
|
|
266
266
|
);
|
|
267
|
-
if (
|
|
267
|
+
if (t)
|
|
268
268
|
return [
|
|
269
269
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, rowValuesForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
270
270
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
271
271
|
"const inputHandles = createInputHandleMap(handles);",
|
|
272
|
-
`const query = queries.${
|
|
273
|
-
`const result = useSemaphorQuery(query, queryOptionsForView.${
|
|
274
|
-
`const rows = result.records.map((row) => rowValuesForView.${
|
|
272
|
+
`const query = queries.${t.name}({ page, pageSize });`,
|
|
273
|
+
`const result = useSemaphorQuery(query, queryOptionsForView.${t.name}(inputHandles));`,
|
|
274
|
+
`const rows = result.records.map((row) => rowValuesForView.${t.name}(row, result.columns));`,
|
|
275
275
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
276
276
|
].join(`
|
|
277
277
|
`);
|
|
278
|
-
const
|
|
279
|
-
(
|
|
278
|
+
const o = e.views.find(
|
|
279
|
+
(f) => ue(f) && A(f)
|
|
280
280
|
);
|
|
281
|
-
if (
|
|
281
|
+
if (o)
|
|
282
282
|
return [
|
|
283
283
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, rowValuesForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
284
284
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
285
285
|
"const inputHandles = createInputHandleMap(handles);",
|
|
286
|
-
`const query = queries.${
|
|
287
|
-
`const result = useSemaphorQuery(query, queryOptionsForView.${
|
|
288
|
-
`const rows = result.records.map((row) => rowValuesForView.${
|
|
286
|
+
`const query = queries.${o.name}({ page, pageSize });`,
|
|
287
|
+
`const result = useSemaphorQuery(query, queryOptionsForView.${o.name}(inputHandles));`,
|
|
288
|
+
`const rows = result.records.map((row) => rowValuesForView.${o.name}(row, result.columns));`,
|
|
289
289
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
290
290
|
].join(`
|
|
291
291
|
`);
|
|
292
|
-
const
|
|
293
|
-
var
|
|
294
|
-
return
|
|
292
|
+
const i = e.views.find((f) => {
|
|
293
|
+
var m;
|
|
294
|
+
return cn((m = f.raw.sdkSpec) == null ? void 0 : m.builder);
|
|
295
295
|
});
|
|
296
|
-
if (
|
|
296
|
+
if (i)
|
|
297
297
|
return [
|
|
298
298
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, rowValuesForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
299
299
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
300
300
|
"const inputHandles = createInputHandleMap(handles);",
|
|
301
|
-
`const result = useSemaphorQuery(queries.${
|
|
302
|
-
`const rows = result.records.map((row) => rowValuesForView.${
|
|
301
|
+
`const result = useSemaphorQuery(queries.${i.name}(), queryOptionsForView.${i.name}(inputHandles));`,
|
|
302
|
+
`const rows = result.records.map((row) => rowValuesForView.${i.name}(row, result.columns));`,
|
|
303
303
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
304
304
|
].join(`
|
|
305
305
|
`);
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
306
|
+
const l = e.views.find((f) => Ae(f));
|
|
307
|
+
if (l)
|
|
308
308
|
return [
|
|
309
309
|
'import { appInputSpecs, createInputHandleMap, metricValuesForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
310
310
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
311
311
|
"const inputHandles = createInputHandleMap(handles);",
|
|
312
|
-
`const result = useSemaphorQuery(queries.${
|
|
313
|
-
`const metrics = metricValuesForView.${
|
|
312
|
+
`const result = useSemaphorQuery(queries.${l.name}(), queryOptionsForView.${l.name}(inputHandles));`,
|
|
313
|
+
`const metrics = metricValuesForView.${l.name}(result);`,
|
|
314
314
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
315
315
|
].join(`
|
|
316
316
|
`);
|
|
317
|
-
const
|
|
317
|
+
const y = e.views[0];
|
|
318
318
|
return [
|
|
319
319
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
320
320
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
321
321
|
"const inputHandles = createInputHandleMap(handles);",
|
|
322
|
-
|
|
322
|
+
y ? `const result = useSemaphorQuery(queries.${y.name}(), queryOptionsForView.${y.name}(inputHandles));` : "const result = undefined;",
|
|
323
323
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
324
324
|
].join(`
|
|
325
325
|
`);
|
|
326
326
|
}
|
|
327
327
|
function W(e) {
|
|
328
328
|
var n;
|
|
329
|
-
return
|
|
329
|
+
return j((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function Ae(e) {
|
|
332
332
|
var n;
|
|
333
|
-
return
|
|
333
|
+
return j((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
var n, r,
|
|
337
|
-
return W(e) && ((
|
|
335
|
+
function E(e) {
|
|
336
|
+
var n, r, t;
|
|
337
|
+
return W(e) && ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.sorting) == null ? void 0 : t.mode) === "server";
|
|
338
338
|
}
|
|
339
339
|
function ue(e) {
|
|
340
340
|
var n;
|
|
341
|
-
return
|
|
341
|
+
return j((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
var n, r,
|
|
345
|
-
return ((
|
|
343
|
+
function A(e) {
|
|
344
|
+
var n, r, t;
|
|
345
|
+
return ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.pagination) == null ? void 0 : t.mode) === "server";
|
|
346
346
|
}
|
|
347
347
|
function He(e) {
|
|
348
|
-
return W(e) && (
|
|
348
|
+
return W(e) && (A(e) || E(e)) || ue(e) && A(e);
|
|
349
349
|
}
|
|
350
350
|
function ve(e) {
|
|
351
|
-
const n = e.sources.map(({ name:
|
|
352
|
-
const
|
|
353
|
-
return ` ${
|
|
351
|
+
const n = e.sources.map(({ name: t, raw: o }) => {
|
|
352
|
+
const i = qe(o);
|
|
353
|
+
return ` ${t}: ${i},`;
|
|
354
354
|
}).join(`
|
|
355
|
-
`), r = e.sources.some((
|
|
355
|
+
`), r = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
|
|
356
356
|
|
|
357
357
|
` : "";
|
|
358
358
|
return `${H}
|
|
@@ -369,14 +369,14 @@ function qe(e) {
|
|
|
369
369
|
datasetName: e.datasetName,
|
|
370
370
|
label: e.label
|
|
371
371
|
};
|
|
372
|
-
return `semaphor.source.semantic(${k(
|
|
372
|
+
return `semaphor.source.semantic(${k(O(n))})`;
|
|
373
373
|
}
|
|
374
|
-
return `${k(
|
|
374
|
+
return `${k(O({ ...e, sourceKey: void 0 }))} as const`;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
const n = e.fields.map(({ name:
|
|
378
|
-
const
|
|
379
|
-
return ` ${
|
|
376
|
+
function Be(e) {
|
|
377
|
+
const n = e.fields.map(({ name: t, raw: o }) => {
|
|
378
|
+
const i = je(o, e);
|
|
379
|
+
return ` ${t}: ${i},`;
|
|
380
380
|
}).join(`
|
|
381
381
|
`), r = n.includes("sources.") ? `import { sources } from "./sources";
|
|
382
382
|
|
|
@@ -387,109 +387,109 @@ ${n}
|
|
|
387
387
|
} as const;
|
|
388
388
|
`;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function je(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
|
-
},
|
|
398
|
-
if (
|
|
397
|
+
}, t = ln(e), o = t ? n.sourceNameByKey.get(t) : void 0;
|
|
398
|
+
if (t && !o)
|
|
399
399
|
throw new Error(
|
|
400
|
-
`Field ${e.name} references source ${
|
|
400
|
+
`Field ${e.name} references source ${t}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
|
|
401
401
|
);
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
}
|
|
405
|
-
function
|
|
406
|
-
const n = e.inputs.map((
|
|
407
|
-
const
|
|
408
|
-
`id: ${JSON.stringify(
|
|
409
|
-
`label: ${JSON.stringify(
|
|
410
|
-
`operator: ${JSON.stringify(
|
|
402
|
+
const i = Object.entries(O(r)).map(([l, y]) => `${JSON.stringify(l)}: ${C(y, n)}`);
|
|
403
|
+
return o && i.push(`"source": sources.${o}`), `{ ${i.join(", ")} }`;
|
|
404
|
+
}
|
|
405
|
+
function Te(e) {
|
|
406
|
+
const n = e.inputs.map((u) => {
|
|
407
|
+
const c = R(u.raw.fieldRef, e), p = [
|
|
408
|
+
`id: ${JSON.stringify(u.raw.id)}`,
|
|
409
|
+
`label: ${JSON.stringify(u.raw.label || u.raw.id)}`,
|
|
410
|
+
`operator: ${JSON.stringify(mn(u.raw))}`
|
|
411
411
|
];
|
|
412
|
-
if (
|
|
413
|
-
throw new Error(`Input ${
|
|
414
|
-
return ` ${
|
|
412
|
+
if (c && p.push(`field: fields.${c}`), u.raw.relationshipHint && p.push(`relationshipHint: ${k(u.raw.relationshipHint)}`), !c)
|
|
413
|
+
throw new Error(`Input ${u.raw.id || u.name} is missing a generated field reference.`);
|
|
414
|
+
return ` ${u.name}: semaphor.filter({ ${p.join(", ")} }),`;
|
|
415
415
|
}).join(`
|
|
416
|
-
`), r = e.inputs.map((
|
|
417
|
-
const
|
|
418
|
-
id:
|
|
419
|
-
inputId:
|
|
420
|
-
source:
|
|
421
|
-
sourceKey:
|
|
416
|
+
`), r = e.inputs.map((u) => `filterSpecs.${u.name}`).join(", "), t = e.inputs.map((u) => JSON.stringify(u.raw.id)).join(", "), o = e.optionQueries.map((u) => {
|
|
417
|
+
const c = u.input.raw, p = u.raw, S = $(p.spec) || {}, {
|
|
418
|
+
id: I,
|
|
419
|
+
inputId: F,
|
|
420
|
+
source: b,
|
|
421
|
+
sourceKey: K,
|
|
422
422
|
valueField: V,
|
|
423
423
|
labelField: N,
|
|
424
|
-
population:
|
|
425
|
-
dependencies:
|
|
426
|
-
limit:
|
|
424
|
+
population: a,
|
|
425
|
+
dependencies: w,
|
|
426
|
+
limit: T,
|
|
427
427
|
...ee
|
|
428
|
-
} =
|
|
428
|
+
} = S, L = p.sourceKey ? { sourceKey: p.sourceKey } : p.source || b || (typeof K == "string" ? { sourceKey: K } : void 0), ne = Se(L, e), re = R(p.valueFieldRef, e), te = R(p.labelFieldRef, e), oe = ge(u), se = {
|
|
429
429
|
...ee,
|
|
430
|
-
id:
|
|
431
|
-
inputId:
|
|
432
|
-
source:
|
|
433
|
-
valueField:
|
|
434
|
-
labelField:
|
|
435
|
-
population:
|
|
430
|
+
id: p.id || S.id || `${c.id}-options`,
|
|
431
|
+
inputId: c.id,
|
|
432
|
+
source: L,
|
|
433
|
+
valueField: p.valueFieldRef,
|
|
434
|
+
labelField: p.labelFieldRef,
|
|
435
|
+
population: p.population || a,
|
|
436
436
|
dependencies: oe,
|
|
437
|
-
limit:
|
|
437
|
+
limit: p.limit || T || 100
|
|
438
438
|
};
|
|
439
439
|
if (!ne || !re || !te)
|
|
440
|
-
throw new Error(`Input option query ${
|
|
441
|
-
const
|
|
442
|
-
return ` ${
|
|
440
|
+
throw new Error(`Input option query ${p.id || `${c.id}-options`} is missing source, valueField, or labelField.`);
|
|
441
|
+
const Fe = Object.entries(O(se)).map(([be, Ve]) => `${JSON.stringify(be)}: ${C(Ve, e)}`);
|
|
442
|
+
return ` ${u.name}: semaphor.inputOptions({ ${Fe.join(", ")} }),`;
|
|
443
443
|
}).join(`
|
|
444
|
-
`),
|
|
445
|
-
const
|
|
446
|
-
const
|
|
447
|
-
if (!
|
|
444
|
+
`), i = e.optionQueries.map((u) => {
|
|
445
|
+
const c = Qe(e, u), p = c.length > 0 ? "inputHandles" : "_inputHandles", S = c.map((I) => {
|
|
446
|
+
const F = R(I.raw.fieldRef, e);
|
|
447
|
+
if (!F)
|
|
448
448
|
throw new Error(
|
|
449
|
-
`Input option query ${
|
|
449
|
+
`Input option query ${u.raw.id || `${u.input.raw.id}-options`} references input ${I.raw.id} without a generated field reference.`
|
|
450
450
|
);
|
|
451
|
-
const
|
|
452
|
-
return ` if (${
|
|
453
|
-
inputs.push(semaphor.bindInput(${
|
|
451
|
+
const b = `inputHandles[${JSON.stringify(I.raw.id)}]`;
|
|
452
|
+
return ` if (${b}) {
|
|
453
|
+
inputs.push(semaphor.bindInput(${b}, { field: fields.${F} }));
|
|
454
454
|
}`;
|
|
455
455
|
}).join(`
|
|
456
456
|
`);
|
|
457
|
-
return ` ${
|
|
457
|
+
return ` ${u.name}(${p}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
458
458
|
const inputs: SemaphorInputReference[] = [];
|
|
459
|
-
${
|
|
459
|
+
${S}
|
|
460
460
|
return inputs;
|
|
461
461
|
},`;
|
|
462
462
|
}).join(`
|
|
463
463
|
|
|
464
|
-
`),
|
|
464
|
+
`), l = e.optionQueries.map((u) => ` ${u.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
|
|
465
465
|
return {
|
|
466
|
-
inputs: inputsForInputOptionQuery.${
|
|
466
|
+
inputs: inputsForInputOptionQuery.${u.name}(inputHandles),
|
|
467
467
|
};
|
|
468
468
|
},`).join(`
|
|
469
469
|
|
|
470
|
-
`),
|
|
471
|
-
return queryOptionsForInputOptionQuery.${
|
|
472
|
-
`), h = e.inputs.length > 0,
|
|
470
|
+
`), y = e.optionQueries.map((u) => ` case ${JSON.stringify(u.raw.id || `${u.input.raw.id}-options`)}:
|
|
471
|
+
return queryOptionsForInputOptionQuery.${u.name}(inputHandles);`).join(`
|
|
472
|
+
`), h = e.inputs.length > 0, f = e.optionQueries.length > 0, m = f ? "inputOptionQueryId" : "_inputOptionQueryId", M = f ? "inputHandles" : "_inputHandles", d = [
|
|
473
473
|
"SemaphorInputHandle",
|
|
474
|
-
|
|
474
|
+
f ? "SemaphorInputReference" : void 0,
|
|
475
475
|
"SemaphorQueryRuntimeOptions"
|
|
476
|
-
].filter(
|
|
477
|
-
h ||
|
|
478
|
-
`import type { ${
|
|
479
|
-
h ||
|
|
480
|
-
|
|
476
|
+
].filter(G).join(", "), s = [
|
|
477
|
+
h || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
478
|
+
`import type { ${d} } from "react-semaphor/data-app-sdk";`,
|
|
479
|
+
h || f ? 'import { fields } from "./fields";' : void 0,
|
|
480
|
+
f ? 'import { sources } from "./sources";' : void 0,
|
|
481
481
|
'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
|
|
482
|
-
].filter(
|
|
482
|
+
].filter(G).join(`
|
|
483
483
|
`);
|
|
484
484
|
return `${H}
|
|
485
|
-
${
|
|
485
|
+
${s}
|
|
486
486
|
|
|
487
487
|
export const filterSpecs = {
|
|
488
488
|
${n}
|
|
489
489
|
} as const;
|
|
490
490
|
|
|
491
491
|
export const appInputSpecs = [${r}] as const;
|
|
492
|
-
export const appInputIds = [${
|
|
492
|
+
export const appInputIds = [${t}] as const;
|
|
493
493
|
|
|
494
494
|
export type SemaphorGeneratedInputHandleMap = Partial<Record<SemaphorGeneratedInputId, SemaphorInputHandle>>;
|
|
495
495
|
|
|
@@ -498,113 +498,113 @@ export function createInputHandleMap(handles: readonly SemaphorInputHandle[]): S
|
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
export const inputOptionQueries = {
|
|
501
|
-
${
|
|
501
|
+
${o}
|
|
502
502
|
} as const;
|
|
503
503
|
|
|
504
504
|
export const inputsForInputOptionQuery = {
|
|
505
|
-
${
|
|
505
|
+
${i}
|
|
506
506
|
} as const;
|
|
507
507
|
|
|
508
508
|
export const queryOptionsForInputOptionQuery = {
|
|
509
|
-
${
|
|
509
|
+
${l}
|
|
510
510
|
} as const;
|
|
511
511
|
|
|
512
512
|
export function queryOptionsForInputOptionQueryId(
|
|
513
|
-
${
|
|
514
|
-
${
|
|
513
|
+
${m}: SemaphorGeneratedInputOptionQueryId,
|
|
514
|
+
${M}: SemaphorGeneratedInputHandleMap,
|
|
515
515
|
): SemaphorQueryRuntimeOptions {
|
|
516
|
-
switch (${
|
|
517
|
-
${
|
|
516
|
+
switch (${m}) {
|
|
517
|
+
${y}
|
|
518
518
|
}
|
|
519
|
-
throw new Error(\`Unknown generated Semaphor input option query id: \${${
|
|
519
|
+
throw new Error(\`Unknown generated Semaphor input option query id: \${${m}}\`);
|
|
520
520
|
}
|
|
521
521
|
`;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
const r =
|
|
523
|
+
function Qe(e, n) {
|
|
524
|
+
const r = ge(n);
|
|
525
525
|
if (!r || r.mode === "independent")
|
|
526
526
|
return [];
|
|
527
527
|
if (r.mode !== "explicit")
|
|
528
528
|
return [];
|
|
529
|
-
const
|
|
529
|
+
const t = new Set(r.includeInputIds || []), o = /* @__PURE__ */ new Set([
|
|
530
530
|
n.input.raw.id,
|
|
531
531
|
...r.excludeInputIds || []
|
|
532
532
|
]);
|
|
533
|
-
return e.inputs.filter((
|
|
533
|
+
return e.inputs.filter((i) => o.has(i.raw.id) ? !1 : t.has(i.raw.id));
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function ge(e) {
|
|
536
536
|
var n;
|
|
537
537
|
return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
const n = e.views.map((
|
|
541
|
-
var
|
|
542
|
-
const
|
|
543
|
-
if (W(
|
|
544
|
-
const V = (
|
|
545
|
-
view:
|
|
539
|
+
function _e(e) {
|
|
540
|
+
const n = e.views.map((s) => {
|
|
541
|
+
var p, S, I, F, b, K;
|
|
542
|
+
const u = j(s.raw.sdkSpec.builder), c = Pe(s);
|
|
543
|
+
if (W(s) && He(s)) {
|
|
544
|
+
const V = (p = s.raw.visualSpec) == null ? void 0 : p.tableBehavior, N = $(c.pagination), a = A(s), w = E(s), T = ((S = V == null ? void 0 : V.pagination) == null ? void 0 : S.pageSize) || J(N == null ? void 0 : N.pageSize) || J(c.limit) || 100, ee = w ? z(s, e) : [], L = w ? De({
|
|
545
|
+
view: s,
|
|
546
546
|
contract: e,
|
|
547
547
|
sortFields: ee,
|
|
548
|
-
defaultField: (
|
|
549
|
-
}) : void 0, ne =
|
|
550
|
-
viewName:
|
|
551
|
-
supportsPagination:
|
|
552
|
-
supportsSort:
|
|
553
|
-
}), te =
|
|
554
|
-
recordsSortFieldsForView.${
|
|
548
|
+
defaultField: (I = V == null ? void 0 : V.sorting) == null ? void 0 : I.defaultField
|
|
549
|
+
}) : void 0, ne = w ? (F = V == null ? void 0 : V.sorting) == null ? void 0 : F.defaultDirection : void 0, re = Ue({
|
|
550
|
+
viewName: s.name,
|
|
551
|
+
supportsPagination: a,
|
|
552
|
+
supportsSort: w
|
|
553
|
+
}), te = w ? ` const orderBy = resolveRecordsOrderBy(
|
|
554
|
+
recordsSortFieldsForView.${s.name},
|
|
555
555
|
params.sort,
|
|
556
|
-
${C(
|
|
556
|
+
${C(L, e)},
|
|
557
557
|
${C(ne, e)},
|
|
558
558
|
);
|
|
559
|
-
` : "", oe =
|
|
560
|
-
` : "", se =
|
|
559
|
+
` : "", oe = w ? ` ...(orderBy ? { orderBy } : {}),
|
|
560
|
+
` : "", se = a ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(T)}),
|
|
561
561
|
` : "";
|
|
562
|
-
return ` ${
|
|
562
|
+
return ` ${s.name}(
|
|
563
563
|
params: ${re} = {},
|
|
564
564
|
) {
|
|
565
|
-
${te} return semaphor.${
|
|
566
|
-
...${C(
|
|
565
|
+
${te} return semaphor.${u}({
|
|
566
|
+
...${C(c, e)},
|
|
567
567
|
${oe}${se} });
|
|
568
568
|
},`;
|
|
569
569
|
}
|
|
570
|
-
if (ue(
|
|
571
|
-
const V = (
|
|
572
|
-
return ` ${
|
|
570
|
+
if (ue(s) && A(s)) {
|
|
571
|
+
const V = (b = s.raw.visualSpec) == null ? void 0 : b.tableBehavior, N = $(c.pagination), a = ((K = V == null ? void 0 : V.pagination) == null ? void 0 : K.pageSize) || J(N == null ? void 0 : N.pageSize) || J(c.limit) || 100;
|
|
572
|
+
return ` ${s.name}(
|
|
573
573
|
params: SemaphorGeneratedServerPaginationParams = {},
|
|
574
574
|
) {
|
|
575
|
-
return semaphor.${
|
|
576
|
-
...${C(
|
|
577
|
-
pagination: resolveServerTablePagination(params, ${JSON.stringify(
|
|
575
|
+
return semaphor.${u}({
|
|
576
|
+
...${C(c, e)},
|
|
577
|
+
pagination: resolveServerTablePagination(params, ${JSON.stringify(a)}),
|
|
578
578
|
});
|
|
579
579
|
},`;
|
|
580
580
|
}
|
|
581
|
-
return ` ${
|
|
581
|
+
return ` ${s.name}: () => semaphor.${u}(${C(c, e)}),`;
|
|
582
582
|
}).join(`
|
|
583
|
-
`), r = e.views.filter((
|
|
584
|
-
const
|
|
583
|
+
`), r = e.views.filter((s) => E(s)).map((s) => {
|
|
584
|
+
const c = z(s, e).map((p) => ` ${JSON.stringify(p.key)}: fields.${p.fieldName},`).join(`
|
|
585
585
|
`);
|
|
586
|
-
return ` ${
|
|
587
|
-
${
|
|
586
|
+
return ` ${s.name}: {
|
|
587
|
+
${c}
|
|
588
588
|
},`;
|
|
589
589
|
}).join(`
|
|
590
|
-
`),
|
|
591
|
-
const
|
|
590
|
+
`), t = e.views.filter((s) => E(s)).map((s) => {
|
|
591
|
+
const c = z(s, e).map((p) => ` { key: ${JSON.stringify(p.key)}, label: ${JSON.stringify(p.label)}, field: fields.${p.fieldName} },`).join(`
|
|
592
592
|
`);
|
|
593
|
-
return ` ${
|
|
594
|
-
${
|
|
593
|
+
return ` ${s.name}: [
|
|
594
|
+
${c}
|
|
595
595
|
],`;
|
|
596
596
|
}).join(`
|
|
597
|
-
`),
|
|
598
|
-
`),
|
|
597
|
+
`), o = e.views.some((s) => E(s)), i = e.views.some((s) => A(s)), l = [n, r, t].join(`
|
|
598
|
+
`), y = [
|
|
599
599
|
n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
].filter(
|
|
600
|
+
o ? 'import type { SemaphorFieldRef } from "react-semaphor/data-app-sdk";' : void 0,
|
|
601
|
+
l.includes("fields.") ? 'import { fields } from "./fields";' : void 0,
|
|
602
|
+
l.includes("sources.") ? 'import { sources } from "./sources";' : void 0
|
|
603
|
+
].filter(G).join(`
|
|
604
604
|
`);
|
|
605
605
|
return `${H}
|
|
606
|
-
${
|
|
607
|
-
${
|
|
606
|
+
${y}
|
|
607
|
+
${o ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
|
|
608
608
|
|
|
609
609
|
export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
|
|
610
610
|
key: TSortKey;
|
|
@@ -614,11 +614,11 @@ export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
|
|
|
614
614
|
export type SemaphorGeneratedRecordsSortParams<TSortKey extends string = string> = {
|
|
615
615
|
sort?: SemaphorGeneratedRecordsSort<TSortKey> | null;
|
|
616
616
|
};
|
|
617
|
-
` : ""}${
|
|
617
|
+
` : ""}${i ? `export type SemaphorGeneratedServerPaginationParams = {
|
|
618
618
|
page?: number;
|
|
619
619
|
pageSize?: number;
|
|
620
620
|
};
|
|
621
|
-
` : ""}${
|
|
621
|
+
` : ""}${o && i ? `export type SemaphorGeneratedRecordsQueryParams<TSortKey extends string = string> =
|
|
622
622
|
SemaphorGeneratedServerPaginationParams &
|
|
623
623
|
SemaphorGeneratedRecordsSortParams<TSortKey>;
|
|
624
624
|
` : ""}
|
|
@@ -628,14 +628,14 @@ ${r}
|
|
|
628
628
|
} as const;
|
|
629
629
|
|
|
630
630
|
export const recordsSortOptionsForView = {
|
|
631
|
-
${
|
|
631
|
+
${t}
|
|
632
632
|
} as const;
|
|
633
633
|
|
|
634
634
|
export const queries = {
|
|
635
635
|
${n}
|
|
636
636
|
} as const;
|
|
637
637
|
|
|
638
|
-
${
|
|
638
|
+
${o ? `function resolveRecordsOrderBy<TSortKey extends string>(
|
|
639
639
|
sortFields: Record<TSortKey, SemaphorFieldRef>,
|
|
640
640
|
sort: SemaphorGeneratedRecordsSort<TSortKey> | null | undefined,
|
|
641
641
|
defaultKey: TSortKey | undefined,
|
|
@@ -655,7 +655,7 @@ ${t ? `function resolveRecordsOrderBy<TSortKey extends string>(
|
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
657
|
` : ""}
|
|
658
|
-
${
|
|
658
|
+
${i ? `function resolveServerTablePagination(
|
|
659
659
|
params: SemaphorGeneratedServerPaginationParams,
|
|
660
660
|
defaultPageSize: number,
|
|
661
661
|
) {
|
|
@@ -667,119 +667,119 @@ ${a ? `function resolveServerTablePagination(
|
|
|
667
667
|
` : ""}
|
|
668
668
|
`;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
671
|
-
var
|
|
672
|
-
const n =
|
|
670
|
+
function Pe(e) {
|
|
671
|
+
var i, l;
|
|
672
|
+
const n = $((i = e.raw.sdkSpec) == null ? void 0 : i.spec) || {}, { kind: r, id: t, ...o } = n;
|
|
673
673
|
return {
|
|
674
|
-
...
|
|
674
|
+
...o,
|
|
675
675
|
id: e.raw.id,
|
|
676
|
-
label: ((
|
|
676
|
+
label: ((l = e.raw.visualSpec) == null ? void 0 : l.title) || e.raw.title || o.label
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
679
|
function z(e, n) {
|
|
680
|
-
var
|
|
681
|
-
const r = [],
|
|
682
|
-
for (const
|
|
683
|
-
g(r,
|
|
684
|
-
for (const
|
|
680
|
+
var i, l;
|
|
681
|
+
const r = [], t = $((i = e.raw.sdkSpec) == null ? void 0 : i.spec) || {};
|
|
682
|
+
for (const y of q(t.fields)) g(r, y);
|
|
683
|
+
g(r, t.dateField), g(r, (l = $(t.orderBy)) == null ? void 0 : l.field);
|
|
684
|
+
for (const y of e.raw.fields || []) g(r, y);
|
|
685
685
|
return X(
|
|
686
|
-
r.map((
|
|
687
|
-
const h =
|
|
688
|
-
if (!(!
|
|
686
|
+
r.map((y) => {
|
|
687
|
+
const h = R(y, n);
|
|
688
|
+
if (!(!y.name || !h))
|
|
689
689
|
return {
|
|
690
690
|
key: h,
|
|
691
691
|
fieldName: h,
|
|
692
|
-
rawName:
|
|
693
|
-
label:
|
|
692
|
+
rawName: y.name,
|
|
693
|
+
label: y.label || y.name
|
|
694
694
|
};
|
|
695
|
-
}).filter(
|
|
696
|
-
(
|
|
695
|
+
}).filter(G),
|
|
696
|
+
(y) => y.key
|
|
697
697
|
);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function De({
|
|
700
700
|
view: e,
|
|
701
701
|
contract: n,
|
|
702
702
|
sortFields: r,
|
|
703
|
-
defaultField:
|
|
703
|
+
defaultField: t
|
|
704
704
|
}) {
|
|
705
|
-
var h,
|
|
706
|
-
const
|
|
707
|
-
if (
|
|
708
|
-
return
|
|
709
|
-
const
|
|
710
|
-
if (
|
|
711
|
-
return
|
|
712
|
-
const
|
|
713
|
-
return
|
|
714
|
-
}
|
|
715
|
-
function
|
|
705
|
+
var h, f;
|
|
706
|
+
const o = new Set(r.map((m) => m.key));
|
|
707
|
+
if (t && o.has(t))
|
|
708
|
+
return t;
|
|
709
|
+
const i = r.filter((m) => m.rawName === t);
|
|
710
|
+
if (i.length === 1)
|
|
711
|
+
return i[0].key;
|
|
712
|
+
const l = $((h = e.raw.sdkSpec) == null ? void 0 : h.spec), y = R((f = $(l == null ? void 0 : l.orderBy)) == null ? void 0 : f.field, n);
|
|
713
|
+
return y && o.has(y) ? y : void 0;
|
|
714
|
+
}
|
|
715
|
+
function Ue({
|
|
716
716
|
viewName: e,
|
|
717
717
|
supportsPagination: n,
|
|
718
718
|
supportsSort: r
|
|
719
719
|
}) {
|
|
720
720
|
return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
|
|
721
721
|
}
|
|
722
|
-
function
|
|
723
|
-
const n = e.views.map((
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
if (!
|
|
722
|
+
function Le(e) {
|
|
723
|
+
const n = e.views.map((m) => {
|
|
724
|
+
const d = Je(e, m.raw.id).map((s) => {
|
|
725
|
+
const u = s.inputId, c = R(s.fieldRef, e);
|
|
726
|
+
if (!u || !c)
|
|
727
727
|
return "";
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
730
|
-
|
|
731
|
-
else if (Array.isArray(
|
|
732
|
-
const
|
|
733
|
-
var
|
|
734
|
-
return (
|
|
735
|
-
}).filter((
|
|
736
|
-
|
|
728
|
+
const p = [`field: fields.${c}`];
|
|
729
|
+
if (s.relationshipHint)
|
|
730
|
+
p.push(`relationshipHint: ${k(s.relationshipHint)}`);
|
|
731
|
+
else if (Array.isArray(s.relationshipsUsed) && s.relationshipsUsed.length > 0) {
|
|
732
|
+
const I = s.relationshipsUsed.map((F) => {
|
|
733
|
+
var b;
|
|
734
|
+
return (b = $(F)) == null ? void 0 : b.id;
|
|
735
|
+
}).filter((F) => typeof F == "string" && F.length > 0);
|
|
736
|
+
I.length > 0 && p.push(`relationshipHint: ${k({ relationshipIds: I })}`);
|
|
737
737
|
}
|
|
738
|
-
const
|
|
739
|
-
return ` if (${
|
|
740
|
-
inputs.push(semaphor.bindInput(${
|
|
738
|
+
const S = `inputHandles[${JSON.stringify(u)}]`;
|
|
739
|
+
return ` if (${S}) {
|
|
740
|
+
inputs.push(semaphor.bindInput(${S}, { ${p.join(", ")} }));
|
|
741
741
|
}`;
|
|
742
742
|
}).filter(Boolean).join(`
|
|
743
743
|
`);
|
|
744
|
-
return { view:
|
|
745
|
-
}), r = n.some((
|
|
746
|
-
const
|
|
747
|
-
return ` ${
|
|
744
|
+
return { view: m, renderedBindings: d };
|
|
745
|
+
}), r = n.some((m) => m.renderedBindings.length > 0), t = n.map(({ view: m, renderedBindings: M }) => {
|
|
746
|
+
const d = M ? "inputHandles" : "_inputHandles";
|
|
747
|
+
return ` ${m.name}(${d}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
748
748
|
const inputs: SemaphorInputReference[] = [];
|
|
749
|
-
${
|
|
749
|
+
${M}
|
|
750
750
|
return inputs;
|
|
751
751
|
},`;
|
|
752
752
|
}).join(`
|
|
753
753
|
|
|
754
|
-
`),
|
|
754
|
+
`), o = e.views.map((m) => ` ${m.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
|
|
755
755
|
return {
|
|
756
|
-
inputs: inputsForView.${
|
|
757
|
-
debug: queryDebugForView.${
|
|
756
|
+
inputs: inputsForView.${m.name}(inputHandles),
|
|
757
|
+
debug: queryDebugForView.${m.name},
|
|
758
758
|
};
|
|
759
759
|
},`).join(`
|
|
760
760
|
|
|
761
|
-
`),
|
|
762
|
-
return inputsForView.${
|
|
763
|
-
`),
|
|
764
|
-
return queryOptionsForView.${
|
|
765
|
-
`),
|
|
761
|
+
`), i = e.views.map((m) => ` case ${JSON.stringify(m.raw.id)}:
|
|
762
|
+
return inputsForView.${m.name}(inputHandles);`).join(`
|
|
763
|
+
`), l = e.views.map((m) => ` case ${JSON.stringify(m.raw.id)}:
|
|
764
|
+
return queryOptionsForView.${m.name}(inputHandles);`).join(`
|
|
765
|
+
`), y = e.views.length > 0, h = y ? "inputHandles" : "_inputHandles", f = [
|
|
766
766
|
r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
767
767
|
'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions } from "react-semaphor/data-app-sdk";',
|
|
768
768
|
r ? 'import { fields } from "./fields";' : void 0,
|
|
769
769
|
'import type { SemaphorGeneratedInputHandleMap } from "./inputs";',
|
|
770
|
-
|
|
770
|
+
y ? 'import { queryDebugForView } from "./metadata";' : void 0,
|
|
771
771
|
'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
|
|
772
|
-
].filter(
|
|
772
|
+
].filter(G).join(`
|
|
773
773
|
`);
|
|
774
774
|
return `${H}
|
|
775
|
-
${
|
|
775
|
+
${f}
|
|
776
776
|
|
|
777
777
|
export const inputsForView = {
|
|
778
|
-
${
|
|
778
|
+
${t}
|
|
779
779
|
} as const;
|
|
780
780
|
|
|
781
781
|
export const queryOptionsForView = {
|
|
782
|
-
${
|
|
782
|
+
${o}
|
|
783
783
|
} as const;
|
|
784
784
|
|
|
785
785
|
export function inputsForViewId(
|
|
@@ -787,7 +787,7 @@ export function inputsForViewId(
|
|
|
787
787
|
${h}: SemaphorGeneratedInputHandleMap,
|
|
788
788
|
): SemaphorInputReference[] {
|
|
789
789
|
switch (viewId) {
|
|
790
|
-
${
|
|
790
|
+
${i}
|
|
791
791
|
}
|
|
792
792
|
throw new Error(\`Unknown generated Semaphor view id: \${viewId}\`);
|
|
793
793
|
}
|
|
@@ -797,120 +797,136 @@ export function queryOptionsForViewId(
|
|
|
797
797
|
${h}: SemaphorGeneratedInputHandleMap,
|
|
798
798
|
): SemaphorQueryRuntimeOptions {
|
|
799
799
|
switch (viewId) {
|
|
800
|
-
${
|
|
800
|
+
${l}
|
|
801
801
|
}
|
|
802
802
|
throw new Error(\`Unknown generated Semaphor view id: \${viewId}\`);
|
|
803
803
|
}
|
|
804
804
|
`;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Je(e, n) {
|
|
807
807
|
return e.filterContracts.flatMap(
|
|
808
|
-
(r) => (r.bindings || []).filter((
|
|
808
|
+
(r) => (r.bindings || []).filter((t) => t.viewId === n).map((t) => ({
|
|
809
809
|
inputId: r.inputId,
|
|
810
|
-
fieldRef:
|
|
811
|
-
relationshipHint:
|
|
812
|
-
relationshipsUsed:
|
|
810
|
+
fieldRef: t.fieldRef,
|
|
811
|
+
relationshipHint: t.relationshipHint,
|
|
812
|
+
relationshipsUsed: t.relationshipsUsed
|
|
813
813
|
}))
|
|
814
814
|
);
|
|
815
815
|
}
|
|
816
|
-
function
|
|
817
|
-
const n = e.views.map((
|
|
818
|
-
const
|
|
819
|
-
const
|
|
820
|
-
return
|
|
816
|
+
function ze(e) {
|
|
817
|
+
const n = e.views.map((s) => {
|
|
818
|
+
const c = Y(s, e).map((p) => {
|
|
819
|
+
const S = R(p.raw, e);
|
|
820
|
+
return S ? ` ${p.name}: fields.${S},` : "";
|
|
821
821
|
}).filter(Boolean).join(`
|
|
822
822
|
`);
|
|
823
|
-
return ` ${
|
|
824
|
-
${
|
|
823
|
+
return ` ${s.name}: {
|
|
824
|
+
${c}
|
|
825
825
|
},`;
|
|
826
826
|
}).join(`
|
|
827
|
-
`), r = e.views.map((
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
return
|
|
827
|
+
`), r = e.views.map((s) => {
|
|
828
|
+
const c = P(s, e).map((p) => {
|
|
829
|
+
const S = R(p.raw, e);
|
|
830
|
+
return S ? ` ${p.name}: fields.${S},` : "";
|
|
831
831
|
}).filter(Boolean).join(`
|
|
832
832
|
`);
|
|
833
|
-
return ` ${
|
|
834
|
-
${
|
|
833
|
+
return ` ${s.name}: {
|
|
834
|
+
${c}
|
|
835
835
|
},`;
|
|
836
836
|
}).join(`
|
|
837
|
-
`),
|
|
838
|
-
const u =
|
|
837
|
+
`), t = e.views.map((s) => {
|
|
838
|
+
const u = P(s, e), c = rn(u), p = nn(u), S = u.map((I) => {
|
|
839
839
|
const F = Array.from(
|
|
840
840
|
new Set(
|
|
841
|
-
|
|
841
|
+
he(I.raw).filter((b) => p.has(b))
|
|
842
842
|
)
|
|
843
843
|
);
|
|
844
|
-
return ` ${
|
|
844
|
+
return ` ${I.name}: metricKeysForField(metricFieldsForView.${s.name}.${I.name}, { allowNameFallback: ${c.has(I.raw.name) ? "false" : "true"}, excludedKeys: ${k(F)} }),`;
|
|
845
845
|
}).join(`
|
|
846
846
|
`);
|
|
847
|
-
return ` ${
|
|
848
|
-
${
|
|
847
|
+
return ` ${s.name}: {
|
|
848
|
+
${S}
|
|
849
849
|
},`;
|
|
850
850
|
}).join(`
|
|
851
|
-
`),
|
|
852
|
-
const
|
|
851
|
+
`), o = e.views.map((s) => {
|
|
852
|
+
const c = P(s, e).map((p, S) => ` ${p.name}: ${JSON.stringify(Xe(s, p, S))},`).join(`
|
|
853
853
|
`);
|
|
854
|
-
return ` ${
|
|
855
|
-
${
|
|
854
|
+
return ` ${s.name}: {
|
|
855
|
+
${c}
|
|
856
856
|
},`;
|
|
857
857
|
}).join(`
|
|
858
|
-
`),
|
|
859
|
-
const u =
|
|
858
|
+
`), i = e.views.map((s) => {
|
|
859
|
+
const u = P(s, e);
|
|
860
860
|
if (u.length === 0)
|
|
861
|
-
return ` ${
|
|
861
|
+
return ` ${s.name}(): Record<keyof typeof metricFieldsForView.${s.name}, unknown> {
|
|
862
862
|
return {};
|
|
863
863
|
},`;
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
return ` ${
|
|
864
|
+
const c = en(s, u), p = u.map((S) => {
|
|
865
|
+
const I = `metricMeasureKeysForView.${s.name}.${S.name}`, F = `metricMeasureBindingKeysForView.${s.name}.${S.name}`, b = c.has(S.name) ? `readMetricValueByBindingWithFallback(measures, measureBindings, ${F}, ${I}, scalarValue)` : `readMetricValueByBinding(measures, measureBindings, ${F}, ${I})`;
|
|
866
|
+
return ` ${S.name}: ${b},`;
|
|
867
867
|
}).join(`
|
|
868
868
|
`);
|
|
869
|
-
return ` ${
|
|
869
|
+
return ` ${s.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${s.name}, unknown> {
|
|
870
870
|
const measures = result?.measures;
|
|
871
871
|
const measureBindings = result?.measureBindings;
|
|
872
872
|
const scalarValue = result?.value;
|
|
873
873
|
return {
|
|
874
|
-
${
|
|
874
|
+
${p}
|
|
875
875
|
};
|
|
876
876
|
},`;
|
|
877
877
|
}).join(`
|
|
878
878
|
|
|
879
|
-
`),
|
|
880
|
-
const u =
|
|
881
|
-
|
|
879
|
+
`), l = e.views.map((s) => {
|
|
880
|
+
const u = P(s, e);
|
|
881
|
+
if (u.length === 0)
|
|
882
|
+
return ` ${s.name}(): Array<keyof typeof metricFieldsForView.${s.name}> {
|
|
883
|
+
return [];
|
|
884
|
+
},`;
|
|
885
|
+
const c = u.map((p) => ` ...(missing.has(metricMeasureBindingKeysForView.${s.name}.${p.name}) ? [${JSON.stringify(p.name)} as keyof typeof metricFieldsForView.${s.name}] : []),`).join(`
|
|
886
|
+
`);
|
|
887
|
+
return ` ${s.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${s.name}> {
|
|
888
|
+
const missing = new Set(result?.missingMeasures || []);
|
|
889
|
+
return [
|
|
890
|
+
${c}
|
|
891
|
+
];
|
|
892
|
+
},`;
|
|
893
|
+
}).join(`
|
|
894
|
+
|
|
895
|
+
`), y = e.views.map((s) => {
|
|
896
|
+
const u = Ye(s, e);
|
|
897
|
+
return ` ${s.name}: ${k(u)},`;
|
|
882
898
|
}).join(`
|
|
883
|
-
`),
|
|
884
|
-
const
|
|
899
|
+
`), h = e.views.map((s) => {
|
|
900
|
+
const c = Y(s, e).map((p) => ` ${p.name}: resolveColumnKey(columns, fieldsForView.${s.name}.${p.name}),`).join(`
|
|
885
901
|
`);
|
|
886
|
-
return ` ${
|
|
902
|
+
return ` ${s.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${s.name}, string | undefined> {
|
|
887
903
|
return {
|
|
888
|
-
${
|
|
904
|
+
${c}
|
|
889
905
|
};
|
|
890
906
|
},`;
|
|
891
907
|
}).join(`
|
|
892
908
|
|
|
893
|
-
`),
|
|
894
|
-
const
|
|
909
|
+
`), f = e.views.map((s) => {
|
|
910
|
+
const c = Y(s, e).map((p) => ` ${p.name}: readCell(row, columns, fieldsForView.${s.name}.${p.name}),`).join(`
|
|
895
911
|
`);
|
|
896
|
-
return ` ${
|
|
912
|
+
return ` ${s.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${s.name}, unknown> {
|
|
897
913
|
return {
|
|
898
|
-
${
|
|
914
|
+
${c}
|
|
899
915
|
};
|
|
900
916
|
},`;
|
|
901
917
|
}).join(`
|
|
902
918
|
|
|
903
|
-
`),
|
|
919
|
+
`), m = n.includes("fields.") || r.includes("fields."), d = [
|
|
904
920
|
`import { ${[
|
|
905
921
|
"type SemaphorFieldRef",
|
|
906
922
|
"type SemaphorResultColumn",
|
|
907
923
|
"semaphorMetricMeasureBindingKey"
|
|
908
|
-
].filter(
|
|
909
|
-
|
|
910
|
-
].filter(
|
|
924
|
+
].filter(G).join(", ")} } from "react-semaphor/data-app-sdk";`,
|
|
925
|
+
m ? 'import { fields } from "./fields";' : void 0
|
|
926
|
+
].filter(G).join(`
|
|
911
927
|
`);
|
|
912
928
|
return `${H}
|
|
913
|
-
${
|
|
929
|
+
${d}
|
|
914
930
|
|
|
915
931
|
export type SemaphorGeneratedRow = Record<string, unknown>;
|
|
916
932
|
export type SemaphorGeneratedColumns = readonly SemaphorResultColumn[] | null | undefined;
|
|
@@ -919,6 +935,7 @@ export type SemaphorGeneratedMetricMeasureBindings = Record<string, string> | nu
|
|
|
919
935
|
export type SemaphorGeneratedMetricResult = {
|
|
920
936
|
readonly measures?: SemaphorGeneratedMetricMeasures;
|
|
921
937
|
readonly measureBindings?: SemaphorGeneratedMetricMeasureBindings;
|
|
938
|
+
readonly missingMeasures?: readonly string[];
|
|
922
939
|
readonly value?: unknown;
|
|
923
940
|
} | null | undefined;
|
|
924
941
|
export type SemaphorGeneratedTableColumn = {
|
|
@@ -938,27 +955,31 @@ ${r}
|
|
|
938
955
|
} as const;
|
|
939
956
|
|
|
940
957
|
export const metricMeasureKeysForView = {
|
|
941
|
-
${
|
|
958
|
+
${t}
|
|
942
959
|
} as const;
|
|
943
960
|
|
|
944
961
|
export const metricMeasureBindingKeysForView = {
|
|
945
|
-
${
|
|
962
|
+
${o}
|
|
946
963
|
} as const;
|
|
947
964
|
|
|
948
965
|
export const tableColumnsForView = {
|
|
949
|
-
${
|
|
966
|
+
${y}
|
|
950
967
|
} as const;
|
|
951
968
|
|
|
952
969
|
export const columnKeysForView = {
|
|
953
|
-
${
|
|
970
|
+
${h}
|
|
954
971
|
} as const;
|
|
955
972
|
|
|
956
973
|
export const rowValuesForView = {
|
|
957
|
-
${
|
|
974
|
+
${f}
|
|
958
975
|
} as const;
|
|
959
976
|
|
|
960
977
|
export const metricValuesForView = {
|
|
961
|
-
${
|
|
978
|
+
${i}
|
|
979
|
+
} as const;
|
|
980
|
+
|
|
981
|
+
export const missingMetricMeasuresForView = {
|
|
982
|
+
${l}
|
|
962
983
|
} as const;
|
|
963
984
|
|
|
964
985
|
export function resolveColumnKey(
|
|
@@ -1257,53 +1278,87 @@ function sourcesReferToSameDataset(
|
|
|
1257
1278
|
}
|
|
1258
1279
|
`;
|
|
1259
1280
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const r = Y(e, n),
|
|
1262
|
-
(
|
|
1281
|
+
function Ye(e, n) {
|
|
1282
|
+
const r = Y(e, n), t = new Map(
|
|
1283
|
+
(E(e) ? z(e, n) : []).map((o) => [o.fieldName, o.key])
|
|
1263
1284
|
);
|
|
1264
|
-
return r.map((
|
|
1265
|
-
const
|
|
1266
|
-
return
|
|
1267
|
-
key:
|
|
1268
|
-
label:
|
|
1269
|
-
dataType:
|
|
1270
|
-
sortable: !!
|
|
1271
|
-
sortKey:
|
|
1285
|
+
return r.map((o) => {
|
|
1286
|
+
const i = R(o.raw, n), l = i ? t.get(i) : void 0;
|
|
1287
|
+
return O({
|
|
1288
|
+
key: o.name,
|
|
1289
|
+
label: o.raw.label || o.raw.name,
|
|
1290
|
+
dataType: o.raw.dataType,
|
|
1291
|
+
sortable: !!l,
|
|
1292
|
+
sortKey: l
|
|
1272
1293
|
});
|
|
1273
1294
|
});
|
|
1274
1295
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {},
|
|
1277
|
-
|
|
1296
|
+
function We(e) {
|
|
1297
|
+
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((d) => d.id).filter(Boolean), o = e.views.map((d) => d.raw.id).filter(Boolean), i = e.inputs.map((d) => d.raw.id).filter(Boolean), l = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean), y = Object.fromEntries(o.map((d) => [
|
|
1298
|
+
d,
|
|
1278
1299
|
e.filterContracts.filter(
|
|
1279
|
-
(
|
|
1280
|
-
).map((
|
|
1281
|
-
])), h = Object.fromEntries(e.views.map((
|
|
1282
|
-
|
|
1300
|
+
(s) => Array.isArray(s.appliesToViewIds) && s.appliesToViewIds.includes(d)
|
|
1301
|
+
).map((s) => s.inputId)
|
|
1302
|
+
])), h = Object.fromEntries(e.views.map((d) => [
|
|
1303
|
+
d.raw.id,
|
|
1283
1304
|
{
|
|
1284
|
-
title:
|
|
1285
|
-
visual:
|
|
1286
|
-
visualSpec:
|
|
1287
|
-
queryKind:
|
|
1288
|
-
sdkBuilder:
|
|
1305
|
+
title: d.raw.title,
|
|
1306
|
+
visual: d.raw.visual,
|
|
1307
|
+
visualSpec: d.raw.visualSpec,
|
|
1308
|
+
queryKind: d.raw.queryKind,
|
|
1309
|
+
sdkBuilder: d.raw.sdkBuilder
|
|
1289
1310
|
}
|
|
1290
|
-
])),
|
|
1291
|
-
var
|
|
1311
|
+
])), f = Object.fromEntries(e.views.map((d) => {
|
|
1312
|
+
var s;
|
|
1292
1313
|
return [
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
viewId:
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1314
|
+
d.raw.id,
|
|
1315
|
+
O({
|
|
1316
|
+
viewId: d.raw.id,
|
|
1317
|
+
queryId: d.name,
|
|
1318
|
+
title: d.raw.title,
|
|
1319
|
+
visualType: ((s = d.raw.visualSpec) == null ? void 0 : s.visualType) || d.raw.visual,
|
|
1320
|
+
suggestedComponentName: me(d.raw.title || d.raw.id || d.name),
|
|
1321
|
+
marker: {
|
|
1322
|
+
attribute: "data-semaphor-view-id",
|
|
1323
|
+
value: d.raw.id
|
|
1324
|
+
}
|
|
1325
|
+
})
|
|
1326
|
+
];
|
|
1327
|
+
})), m = Object.fromEntries(e.inputs.map((d) => {
|
|
1328
|
+
var s;
|
|
1329
|
+
return [
|
|
1330
|
+
d.raw.id,
|
|
1331
|
+
O({
|
|
1332
|
+
inputId: d.raw.id,
|
|
1333
|
+
label: d.raw.label,
|
|
1334
|
+
type: d.raw.type,
|
|
1335
|
+
optionQueryId: ((s = d.raw.optionQuery) == null ? void 0 : s.id) || (d.raw.optionQuery ? `${d.raw.id}-options` : void 0),
|
|
1336
|
+
suggestedComponentName: me(d.raw.label || d.raw.id || d.name),
|
|
1337
|
+
marker: {
|
|
1338
|
+
attribute: "data-semaphor-input-id",
|
|
1339
|
+
value: d.raw.id
|
|
1340
|
+
}
|
|
1341
|
+
})
|
|
1342
|
+
];
|
|
1343
|
+
})), M = Object.fromEntries(e.views.map((d) => {
|
|
1344
|
+
var s, u, c;
|
|
1345
|
+
return [
|
|
1346
|
+
d.name,
|
|
1347
|
+
O({
|
|
1348
|
+
viewId: d.raw.id,
|
|
1349
|
+
viewTitle: ((s = d.raw.visualSpec) == null ? void 0 : s.title) || d.raw.title,
|
|
1350
|
+
visualType: (u = d.raw.visualSpec) == null ? void 0 : u.visualType,
|
|
1351
|
+
title: ((c = d.raw.visualSpec) == null ? void 0 : c.title) || d.raw.title
|
|
1299
1352
|
})
|
|
1300
1353
|
];
|
|
1301
1354
|
}));
|
|
1302
1355
|
return `${H}
|
|
1303
|
-
export const generatedViewIds = ${k(
|
|
1304
|
-
export const generatedQueryViewIds = ${k(
|
|
1305
|
-
export const generatedInputIds = ${k(
|
|
1306
|
-
export const generatedInputOptionQueryIds = ${k(
|
|
1356
|
+
export const generatedViewIds = ${k(t)} as const;
|
|
1357
|
+
export const generatedQueryViewIds = ${k(o)} as const;
|
|
1358
|
+
export const generatedInputIds = ${k(i)} as const;
|
|
1359
|
+
export const generatedInputOptionQueryIds = ${k(l)} as const;
|
|
1360
|
+
export const generatedViewAuthoring = ${k(f)} as const;
|
|
1361
|
+
export const generatedInputAuthoring = ${k(m)} as const;
|
|
1307
1362
|
|
|
1308
1363
|
export type SemaphorGeneratedViewId = typeof generatedViewIds[number];
|
|
1309
1364
|
export type SemaphorGeneratedQueryViewId = typeof generatedQueryViewIds[number];
|
|
@@ -1322,16 +1377,28 @@ export type SemaphorGeneratedFilterContract = {
|
|
|
1322
1377
|
readonly [key: string]: unknown;
|
|
1323
1378
|
};
|
|
1324
1379
|
|
|
1325
|
-
export const generatedInputIdsForView = ${k(
|
|
1380
|
+
export const generatedInputIdsForView = ${k(y)} as const;
|
|
1326
1381
|
export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${k(e.filterContracts)} as const;
|
|
1327
1382
|
|
|
1383
|
+
export function semaphorViewMarkerProps(viewId: SemaphorGeneratedViewId) {
|
|
1384
|
+
return {
|
|
1385
|
+
"data-semaphor-view-id": viewId,
|
|
1386
|
+
} as const;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export function semaphorInputMarkerProps(inputId: SemaphorGeneratedInputId) {
|
|
1390
|
+
return {
|
|
1391
|
+
"data-semaphor-input-id": inputId,
|
|
1392
|
+
} as const;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1328
1395
|
export function filterContractsForView(viewId: SemaphorGeneratedQueryViewId) {
|
|
1329
1396
|
return generatedFilterContracts.filter((filterContract) =>
|
|
1330
1397
|
filterContract.appliesToViewIds.includes(viewId)
|
|
1331
1398
|
);
|
|
1332
1399
|
}
|
|
1333
1400
|
|
|
1334
|
-
export const queryDebugForView = ${k(
|
|
1401
|
+
export const queryDebugForView = ${k(M)} as const;
|
|
1335
1402
|
|
|
1336
1403
|
export const semaphorGeneratedContractMetadata = ${k({
|
|
1337
1404
|
schemaVersion: "semaphor-generated-data-app-contract/v1",
|
|
@@ -1339,17 +1406,19 @@ export const semaphorGeneratedContractMetadata = ${k({
|
|
|
1339
1406
|
requiredDevtools: r,
|
|
1340
1407
|
filterContracts: e.filterContracts,
|
|
1341
1408
|
filterScopeByInput: n,
|
|
1342
|
-
generatedViewIds:
|
|
1343
|
-
generatedQueryViewIds:
|
|
1344
|
-
generatedInputIds:
|
|
1345
|
-
generatedInputOptionQueryIds:
|
|
1346
|
-
generatedInputIdsForView:
|
|
1409
|
+
generatedViewIds: t,
|
|
1410
|
+
generatedQueryViewIds: o,
|
|
1411
|
+
generatedInputIds: i,
|
|
1412
|
+
generatedInputOptionQueryIds: l,
|
|
1413
|
+
generatedInputIdsForView: y,
|
|
1414
|
+
generatedViewAuthoring: f,
|
|
1415
|
+
generatedInputAuthoring: m,
|
|
1347
1416
|
visualSpecs: h,
|
|
1348
1417
|
presentationViews: e.presentationViews
|
|
1349
1418
|
})} as const;
|
|
1350
1419
|
`;
|
|
1351
1420
|
}
|
|
1352
|
-
function
|
|
1421
|
+
function Ze() {
|
|
1353
1422
|
return `${H}
|
|
1354
1423
|
export * from "./sources";
|
|
1355
1424
|
export * from "./fields";
|
|
@@ -1360,66 +1429,75 @@ export * from "./accessors";
|
|
|
1360
1429
|
export * from "./metadata";
|
|
1361
1430
|
`;
|
|
1362
1431
|
}
|
|
1363
|
-
function
|
|
1432
|
+
function Q(e, n) {
|
|
1364
1433
|
if (!(!n || typeof n != "object")) {
|
|
1365
1434
|
if (Array.isArray(n)) {
|
|
1366
|
-
for (const r of n)
|
|
1435
|
+
for (const r of n) Q(e, r);
|
|
1367
1436
|
return;
|
|
1368
1437
|
}
|
|
1369
|
-
x(n) && g(e,
|
|
1438
|
+
x(n) && g(e, D(n));
|
|
1370
1439
|
for (const r of Object.values(n))
|
|
1371
|
-
|
|
1440
|
+
Q(e, r);
|
|
1372
1441
|
}
|
|
1373
1442
|
}
|
|
1374
1443
|
function Y(e, n) {
|
|
1375
1444
|
const r = [];
|
|
1376
|
-
if (
|
|
1377
|
-
for (const
|
|
1378
|
-
g(r,
|
|
1445
|
+
if (tn(r, e.raw.sdkSpec), r.length === 0)
|
|
1446
|
+
for (const o of e.raw.fields || [])
|
|
1447
|
+
g(r, o);
|
|
1448
|
+
const t = X(
|
|
1449
|
+
r.filter((o) => o.name && R(o, n)).map((o) => ({ raw: o, key: U(o), name: "" })),
|
|
1450
|
+
(o) => o.key
|
|
1451
|
+
);
|
|
1452
|
+
return v(
|
|
1453
|
+
t,
|
|
1454
|
+
(o) => B(o.raw.label || o.raw.name || "field")
|
|
1455
|
+
), t;
|
|
1456
|
+
}
|
|
1457
|
+
function P(e, n) {
|
|
1458
|
+
if (j(e.raw.sdkSpec.builder) !== "metric")
|
|
1459
|
+
return [];
|
|
1460
|
+
const r = $(e.raw.sdkSpec.spec), t = [];
|
|
1461
|
+
g(t, r == null ? void 0 : r.primaryMeasure);
|
|
1462
|
+
for (const i of q(r == null ? void 0 : r.measures))
|
|
1463
|
+
g(t, i);
|
|
1379
1464
|
const o = X(
|
|
1380
|
-
|
|
1381
|
-
(
|
|
1465
|
+
t.filter((i) => i.name && R(i, n)).map((i) => ({ raw: i, key: U(i), name: "" })),
|
|
1466
|
+
(i) => i.key
|
|
1382
1467
|
);
|
|
1383
1468
|
return v(
|
|
1384
1469
|
o,
|
|
1385
|
-
(
|
|
1470
|
+
(i) => B(i.raw.label || i.raw.name || "metric")
|
|
1386
1471
|
), o;
|
|
1387
1472
|
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
const t = X(
|
|
1396
|
-
o.filter((a) => a.name && M(a, n)).map((a) => ({ raw: a, key: D(a), name: "" })),
|
|
1397
|
-
(a) => a.key
|
|
1473
|
+
function Xe(e, n, r) {
|
|
1474
|
+
var o;
|
|
1475
|
+
const t = (o = e.raw.metricBindingKeys) == null ? void 0 : o[r];
|
|
1476
|
+
if (typeof t == "string" && t.trim())
|
|
1477
|
+
return t;
|
|
1478
|
+
throw new Error(
|
|
1479
|
+
`views.${e.raw.id}.metricBindingKeys must include a binding key for metric field ${n.raw.name}.`
|
|
1398
1480
|
);
|
|
1399
|
-
return v(
|
|
1400
|
-
t,
|
|
1401
|
-
(a) => Q(a.raw.label || a.raw.name || "metric")
|
|
1402
|
-
), t;
|
|
1403
1481
|
}
|
|
1404
|
-
function
|
|
1482
|
+
function en(e, n) {
|
|
1405
1483
|
if (n.length === 1)
|
|
1406
1484
|
return /* @__PURE__ */ new Set([n[0].name]);
|
|
1407
|
-
const r =
|
|
1485
|
+
const r = $(e.raw.sdkSpec.spec);
|
|
1408
1486
|
if (!x(r == null ? void 0 : r.primaryMeasure))
|
|
1409
1487
|
return /* @__PURE__ */ new Set();
|
|
1410
|
-
const
|
|
1411
|
-
return
|
|
1488
|
+
const t = U(D(r.primaryMeasure)), o = n.find((i) => i.key === t);
|
|
1489
|
+
return o ? /* @__PURE__ */ new Set([o.name]) : /* @__PURE__ */ new Set();
|
|
1412
1490
|
}
|
|
1413
|
-
function
|
|
1491
|
+
function nn(e) {
|
|
1414
1492
|
const n = /* @__PURE__ */ new Map();
|
|
1415
1493
|
for (const r of e)
|
|
1416
|
-
for (const
|
|
1417
|
-
n.set(
|
|
1494
|
+
for (const t of new Set(he(r.raw)))
|
|
1495
|
+
n.set(t, (n.get(t) || 0) + 1);
|
|
1418
1496
|
return new Set(
|
|
1419
1497
|
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1420
1498
|
);
|
|
1421
1499
|
}
|
|
1422
|
-
function
|
|
1500
|
+
function he(e) {
|
|
1423
1501
|
const n = (e.aggregate || "SUM").toUpperCase();
|
|
1424
1502
|
return _([
|
|
1425
1503
|
`${n.toLowerCase()}_${e.name}`,
|
|
@@ -1429,7 +1507,7 @@ function ge(e) {
|
|
|
1429
1507
|
e.name
|
|
1430
1508
|
]);
|
|
1431
1509
|
}
|
|
1432
|
-
function
|
|
1510
|
+
function rn(e) {
|
|
1433
1511
|
const n = /* @__PURE__ */ new Map();
|
|
1434
1512
|
for (const r of e)
|
|
1435
1513
|
n.set(r.raw.name, (n.get(r.raw.name) || 0) + 1);
|
|
@@ -1437,32 +1515,32 @@ function en(e) {
|
|
|
1437
1515
|
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1438
1516
|
);
|
|
1439
1517
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const r =
|
|
1518
|
+
function tn(e, n) {
|
|
1519
|
+
const r = $(n.spec);
|
|
1442
1520
|
if (!r)
|
|
1443
1521
|
return;
|
|
1444
|
-
const
|
|
1445
|
-
if (
|
|
1446
|
-
for (const
|
|
1522
|
+
const t = j(n.builder);
|
|
1523
|
+
if (t === "records") {
|
|
1524
|
+
for (const o of q(r.fields)) g(e, o);
|
|
1447
1525
|
return;
|
|
1448
1526
|
}
|
|
1449
|
-
if (
|
|
1450
|
-
for (const
|
|
1527
|
+
if (t === "sql") {
|
|
1528
|
+
for (const o of q(r.fields)) g(e, o);
|
|
1451
1529
|
return;
|
|
1452
1530
|
}
|
|
1453
|
-
if (
|
|
1531
|
+
if (t === "analysis" || t === "metric") {
|
|
1454
1532
|
g(e, r.primaryMeasure);
|
|
1455
|
-
for (const
|
|
1456
|
-
for (const
|
|
1533
|
+
for (const o of q(r.measures)) g(e, o);
|
|
1534
|
+
for (const o of q(r.dimensions)) g(e, o);
|
|
1457
1535
|
g(e, r.dateField);
|
|
1458
1536
|
return;
|
|
1459
1537
|
}
|
|
1460
|
-
if (
|
|
1461
|
-
const
|
|
1462
|
-
for (const
|
|
1463
|
-
for (const
|
|
1464
|
-
for (const
|
|
1465
|
-
const h =
|
|
1538
|
+
if (t === "matrix") {
|
|
1539
|
+
const o = pe(r.rows), i = pe(r.columns), l = q(r.values);
|
|
1540
|
+
for (const y of o) le(e, y);
|
|
1541
|
+
for (const y of i) le(e, y);
|
|
1542
|
+
for (const y of l) {
|
|
1543
|
+
const h = $(y);
|
|
1466
1544
|
g(e, h == null ? void 0 : h.field), g(e, h == null ? void 0 : h.measure);
|
|
1467
1545
|
}
|
|
1468
1546
|
}
|
|
@@ -1470,7 +1548,7 @@ function nn(e, n) {
|
|
|
1470
1548
|
function pe(e) {
|
|
1471
1549
|
if (Array.isArray(e))
|
|
1472
1550
|
return e;
|
|
1473
|
-
const n =
|
|
1551
|
+
const n = $(e);
|
|
1474
1552
|
return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
|
|
1475
1553
|
}
|
|
1476
1554
|
function le(e, n) {
|
|
@@ -1479,15 +1557,15 @@ function le(e, n) {
|
|
|
1479
1557
|
g(e, n);
|
|
1480
1558
|
return;
|
|
1481
1559
|
}
|
|
1482
|
-
g(e, (r =
|
|
1560
|
+
g(e, (r = $(n)) == null ? void 0 : r.field);
|
|
1483
1561
|
}
|
|
1484
1562
|
function ce(e) {
|
|
1485
|
-
var n, r,
|
|
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" || ((
|
|
1563
|
+
var n, r, t, o;
|
|
1564
|
+
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" || ((t = e == null ? void 0 : e.computation) == null ? void 0 : t.kind) === "unsupported" || (e == null ? void 0 : e.visual) === "text_block" || ((o = e == null ? void 0 : e.visualSpec) == null ? void 0 : o.visualType) === "text_block";
|
|
1487
1565
|
}
|
|
1488
|
-
function
|
|
1489
|
-
const n =
|
|
1490
|
-
return
|
|
1566
|
+
function on(e) {
|
|
1567
|
+
const n = $(e) || {};
|
|
1568
|
+
return O({
|
|
1491
1569
|
id: e.id,
|
|
1492
1570
|
title: e.title,
|
|
1493
1571
|
purpose: e.purpose,
|
|
@@ -1502,9 +1580,9 @@ function rn(e) {
|
|
|
1502
1580
|
});
|
|
1503
1581
|
}
|
|
1504
1582
|
function g(e, n) {
|
|
1505
|
-
x(n) && e.push(
|
|
1583
|
+
x(n) && e.push(D(n));
|
|
1506
1584
|
}
|
|
1507
|
-
function
|
|
1585
|
+
function D(e) {
|
|
1508
1586
|
return {
|
|
1509
1587
|
name: e.name,
|
|
1510
1588
|
label: e.label,
|
|
@@ -1515,27 +1593,27 @@ function P(e) {
|
|
|
1515
1593
|
...e.source ? { source: e.source } : {}
|
|
1516
1594
|
};
|
|
1517
1595
|
}
|
|
1518
|
-
function
|
|
1596
|
+
function sn(e) {
|
|
1519
1597
|
if (!e.source)
|
|
1520
1598
|
return;
|
|
1521
1599
|
const n = {
|
|
1522
1600
|
...e.source,
|
|
1523
1601
|
...e.sourceKey ? { sourceKey: e.sourceKey } : {}
|
|
1524
|
-
}, r =
|
|
1602
|
+
}, r = $e(n);
|
|
1525
1603
|
if (r)
|
|
1526
1604
|
return {
|
|
1527
1605
|
raw: n,
|
|
1528
1606
|
key: r,
|
|
1529
|
-
aliases:
|
|
1607
|
+
aliases: Ie(n),
|
|
1530
1608
|
name: ""
|
|
1531
1609
|
};
|
|
1532
1610
|
}
|
|
1533
1611
|
function x(e) {
|
|
1534
|
-
const n =
|
|
1612
|
+
const n = $(e);
|
|
1535
1613
|
return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
|
|
1536
1614
|
}
|
|
1537
|
-
function
|
|
1538
|
-
const n =
|
|
1615
|
+
function we(e) {
|
|
1616
|
+
const n = $(e);
|
|
1539
1617
|
return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
|
|
1540
1618
|
}
|
|
1541
1619
|
function C(e, n) {
|
|
@@ -1544,34 +1622,34 @@ function C(e, n) {
|
|
|
1544
1622
|
if (e === null || typeof e == "number" || typeof e == "boolean" || typeof e == "string")
|
|
1545
1623
|
return JSON.stringify(e);
|
|
1546
1624
|
if (Array.isArray(e))
|
|
1547
|
-
return `[${e.map((
|
|
1625
|
+
return `[${e.map((o) => C(o, n)).join(", ")}]`;
|
|
1548
1626
|
if (x(e)) {
|
|
1549
|
-
const
|
|
1550
|
-
if (
|
|
1627
|
+
const o = R(D(e), n);
|
|
1628
|
+
if (o) return `fields.${o}`;
|
|
1551
1629
|
}
|
|
1552
|
-
if (
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1630
|
+
if (we(e)) {
|
|
1631
|
+
const o = Se(e, n);
|
|
1632
|
+
if (o) return `sources.${o}`;
|
|
1555
1633
|
}
|
|
1556
|
-
const r =
|
|
1557
|
-
return r ? `{ ${Object.entries(r).filter(([,
|
|
1634
|
+
const r = $(e);
|
|
1635
|
+
return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, i]) => `${JSON.stringify(o)}: ${C(i, n)}`).join(", ")} }` : JSON.stringify(e);
|
|
1558
1636
|
}
|
|
1559
1637
|
function k(e) {
|
|
1560
1638
|
return JSON.stringify(e, null, 2);
|
|
1561
1639
|
}
|
|
1562
|
-
function
|
|
1640
|
+
function R(e, n) {
|
|
1563
1641
|
if (x(e))
|
|
1564
|
-
return n.fieldNameByKey.get(D(
|
|
1642
|
+
return n.fieldNameByKey.get(U(D(e)));
|
|
1565
1643
|
}
|
|
1566
1644
|
function Se(e, n) {
|
|
1567
|
-
if (
|
|
1645
|
+
if (we(e))
|
|
1568
1646
|
for (const r of Z(e)) {
|
|
1569
|
-
const
|
|
1570
|
-
if (
|
|
1571
|
-
return
|
|
1647
|
+
const t = n.sourceNameByKey.get(r);
|
|
1648
|
+
if (t)
|
|
1649
|
+
return t;
|
|
1572
1650
|
}
|
|
1573
1651
|
}
|
|
1574
|
-
function
|
|
1652
|
+
function U(e) {
|
|
1575
1653
|
return [
|
|
1576
1654
|
e.sourceKey || "",
|
|
1577
1655
|
e.name || "",
|
|
@@ -1579,64 +1657,64 @@ function D(e) {
|
|
|
1579
1657
|
e.aggregate || ""
|
|
1580
1658
|
].join("|");
|
|
1581
1659
|
}
|
|
1582
|
-
function
|
|
1660
|
+
function an(e, n) {
|
|
1583
1661
|
return !x(e) || !x(n) || e.name !== n.name ? !1 : ie(e).some(
|
|
1584
1662
|
(r) => ie(n).includes(r)
|
|
1585
1663
|
);
|
|
1586
1664
|
}
|
|
1587
|
-
function
|
|
1665
|
+
function un(e) {
|
|
1588
1666
|
return x(e) && e.role === "id";
|
|
1589
1667
|
}
|
|
1590
|
-
function
|
|
1668
|
+
function dn(e) {
|
|
1591
1669
|
const n = [], r = /* @__PURE__ */ new Map();
|
|
1592
|
-
for (const
|
|
1593
|
-
const
|
|
1594
|
-
if (
|
|
1595
|
-
|
|
1670
|
+
for (const t of e) {
|
|
1671
|
+
const o = _(t.aliases.length ? t.aliases : [t.key]), i = o.map((l) => r.get(l)).find(G);
|
|
1672
|
+
if (i) {
|
|
1673
|
+
i.aliases = _([...i.aliases, ...o]);
|
|
1596
1674
|
continue;
|
|
1597
1675
|
}
|
|
1598
|
-
|
|
1599
|
-
for (const
|
|
1600
|
-
r.set(
|
|
1676
|
+
t.aliases = o, n.push(t);
|
|
1677
|
+
for (const l of o)
|
|
1678
|
+
r.set(l, t);
|
|
1601
1679
|
}
|
|
1602
1680
|
return n;
|
|
1603
1681
|
}
|
|
1604
|
-
function
|
|
1682
|
+
function pn(e) {
|
|
1605
1683
|
const n = /* @__PURE__ */ new Map();
|
|
1606
1684
|
for (const r of e)
|
|
1607
|
-
for (const
|
|
1608
|
-
const
|
|
1609
|
-
if (
|
|
1610
|
-
throw new Error(`Source identity ${
|
|
1611
|
-
n.set(
|
|
1685
|
+
for (const t of _([r.key, ...r.aliases])) {
|
|
1686
|
+
const o = n.get(t);
|
|
1687
|
+
if (o && o !== r.name)
|
|
1688
|
+
throw new Error(`Source identity ${t} resolves to multiple generated sources.`);
|
|
1689
|
+
n.set(t, r.name);
|
|
1612
1690
|
}
|
|
1613
1691
|
return n;
|
|
1614
1692
|
}
|
|
1615
1693
|
function _(e) {
|
|
1616
1694
|
return Array.from(new Set(e.filter(Boolean)));
|
|
1617
1695
|
}
|
|
1618
|
-
function
|
|
1696
|
+
function $e(e) {
|
|
1619
1697
|
return Z(e)[0] || de(e);
|
|
1620
1698
|
}
|
|
1621
1699
|
function Z(e) {
|
|
1622
|
-
const n =
|
|
1700
|
+
const n = $(e);
|
|
1623
1701
|
if (!n)
|
|
1624
1702
|
return [];
|
|
1625
1703
|
const r = [];
|
|
1626
1704
|
if (typeof n.sourceKey == "string" && r.push(n.sourceKey), n.kind === "semantic" || n.datasetName) {
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1705
|
+
const t = typeof n.domainId == "string" ? n.domainId : "";
|
|
1706
|
+
t && typeof n.datasetId == "string" && r.push(`semantic:${t}:datasetId:${n.datasetId}`), t && typeof n.datasetName == "string" && r.push(`semantic:${t}:datasetName:${n.datasetName}`);
|
|
1629
1707
|
}
|
|
1630
1708
|
return r.length === 0 && r.push(de(e)), _(r);
|
|
1631
1709
|
}
|
|
1632
|
-
function
|
|
1710
|
+
function Ie(e) {
|
|
1633
1711
|
return Z(e);
|
|
1634
1712
|
}
|
|
1635
1713
|
function de(e) {
|
|
1636
|
-
const n =
|
|
1714
|
+
const n = $(e);
|
|
1637
1715
|
return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
|
|
1638
1716
|
}
|
|
1639
|
-
function
|
|
1717
|
+
function ln(e) {
|
|
1640
1718
|
return x(e) && ie(e)[0] || "";
|
|
1641
1719
|
}
|
|
1642
1720
|
function ie(e) {
|
|
@@ -1645,53 +1723,57 @@ function ie(e) {
|
|
|
1645
1723
|
...e.source ? Z(e.source) : []
|
|
1646
1724
|
]) : [];
|
|
1647
1725
|
}
|
|
1648
|
-
function
|
|
1726
|
+
function j(e) {
|
|
1649
1727
|
const n = String(e || "").replace(/^semaphor\./, "");
|
|
1650
1728
|
if (!["metric", "records", "analysis", "matrix", "sql"].includes(n))
|
|
1651
1729
|
throw new Error(`Unsupported sdkSpec builder: ${e}`);
|
|
1652
1730
|
return n;
|
|
1653
1731
|
}
|
|
1654
|
-
function
|
|
1655
|
-
const n =
|
|
1732
|
+
function cn(e) {
|
|
1733
|
+
const n = j(e);
|
|
1656
1734
|
return n === "records" || n === "sql";
|
|
1657
1735
|
}
|
|
1658
|
-
function
|
|
1659
|
-
const n =
|
|
1736
|
+
function mn(e) {
|
|
1737
|
+
const n = $(e);
|
|
1660
1738
|
return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
|
|
1661
1739
|
}
|
|
1662
1740
|
function v(e, n) {
|
|
1663
1741
|
const r = /* @__PURE__ */ new Map();
|
|
1664
|
-
for (const
|
|
1665
|
-
const
|
|
1666
|
-
r.set(
|
|
1742
|
+
for (const t of e) {
|
|
1743
|
+
const o = n(t) || "item", i = r.get(o) || 0;
|
|
1744
|
+
r.set(o, i + 1), t.name = i === 0 ? o : `${o}${i + 1}`;
|
|
1667
1745
|
}
|
|
1668
1746
|
}
|
|
1669
1747
|
function X(e, n) {
|
|
1670
|
-
const r = /* @__PURE__ */ new Set(),
|
|
1671
|
-
for (const
|
|
1672
|
-
const
|
|
1673
|
-
!
|
|
1748
|
+
const r = /* @__PURE__ */ new Set(), t = [];
|
|
1749
|
+
for (const o of e) {
|
|
1750
|
+
const i = n(o);
|
|
1751
|
+
!i || r.has(i) || (r.add(i), t.push(o));
|
|
1674
1752
|
}
|
|
1675
|
-
return
|
|
1753
|
+
return t;
|
|
1676
1754
|
}
|
|
1677
|
-
function
|
|
1755
|
+
function B(e) {
|
|
1678
1756
|
const n = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
1679
1757
|
if (n.length === 0)
|
|
1680
1758
|
return "item";
|
|
1681
|
-
const [r, ...
|
|
1759
|
+
const [r, ...t] = n, o = [
|
|
1682
1760
|
r.toLowerCase(),
|
|
1683
|
-
...
|
|
1761
|
+
...t.map((i) => i.charAt(0).toUpperCase() + i.slice(1).toLowerCase())
|
|
1684
1762
|
].join("");
|
|
1685
|
-
return /^[A-Za-z_$]/.test(
|
|
1763
|
+
return /^[A-Za-z_$]/.test(o) ? o : `item${o}`;
|
|
1686
1764
|
}
|
|
1687
|
-
function
|
|
1765
|
+
function me(e) {
|
|
1766
|
+
const n = B(e);
|
|
1767
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
1768
|
+
}
|
|
1769
|
+
function fn(e) {
|
|
1688
1770
|
const n = String(e).split(":");
|
|
1689
1771
|
return n[n.length - 1] || String(e);
|
|
1690
1772
|
}
|
|
1691
|
-
function
|
|
1773
|
+
function O(e) {
|
|
1692
1774
|
return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
|
|
1693
1775
|
}
|
|
1694
|
-
function
|
|
1776
|
+
function $(e) {
|
|
1695
1777
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1696
1778
|
}
|
|
1697
1779
|
function q(e) {
|
|
@@ -1700,28 +1782,28 @@ function q(e) {
|
|
|
1700
1782
|
function J(e) {
|
|
1701
1783
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
1702
1784
|
}
|
|
1703
|
-
function
|
|
1785
|
+
function G(e) {
|
|
1704
1786
|
return e !== void 0;
|
|
1705
1787
|
}
|
|
1706
1788
|
export {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1789
|
+
Rn as CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1790
|
+
Re as CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1791
|
+
Me as CONTRACT_MANIFEST_SCHEMA_VERSION,
|
|
1792
|
+
hn as DEFAULT_GENERATED_CONTRACT_OUTPUT_DIR,
|
|
1793
|
+
fe as GENERATED_CONTRACT_SCHEMA_VERSION,
|
|
1794
|
+
Mn as GENERATED_CONTRACT_TYPESCRIPT_FILES,
|
|
1795
|
+
Nn as REQUIRED_GENERATED_CONTRACT_FILES,
|
|
1796
|
+
In as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1797
|
+
Fn as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1798
|
+
ke as assertValidCodegenSummary,
|
|
1799
|
+
xn as buildSemaphorGeneratedActiveInput,
|
|
1800
|
+
Cn as buildSemaphorGeneratedInputOptionIntent,
|
|
1801
|
+
On as buildSemaphorGeneratedViewExecutionRequest,
|
|
1802
|
+
Gn as buildSemaphorGeneratedViewExecutionRequests,
|
|
1803
|
+
Kn as evaluateSemaphorDataAppContractUpdatePolicy,
|
|
1804
|
+
wn as generateSemaphorDataAppContract,
|
|
1805
|
+
bn as isSemaphorDataAppCodegenSummary,
|
|
1806
|
+
En as validateCodegenSummary,
|
|
1807
|
+
Vn as validateSemaphorDataAppCodegenSummary,
|
|
1808
|
+
An as validateSemaphorGeneratedContract
|
|
1727
1809
|
};
|