react-semaphor 0.1.420 → 0.1.422
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 +28 -27
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/analyze-result-contract-D7pjjYPy.js +2069 -0
- package/dist/chunks/analyze-result-contract-DpDcImgk.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-f0Z7Kf-U.js → calendar-preferences-dialog-C2fBRNZh.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DIfAbE_y.js → calendar-preferences-dialog-Cbavs2EK.js} +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-anh-Jy5v.js → dashboard-briefing-launcher-C0_ZbBK3.js} +4 -4
- package/dist/chunks/{dashboard-briefing-launcher-C3tNkGFG.js → dashboard-briefing-launcher-CGfEFUnX.js} +1 -1
- package/dist/chunks/{dashboard-controls-DQxlOxzy.js → dashboard-controls-BUuS-BGl.js} +1 -1
- package/dist/chunks/{dashboard-controls-8dCQaPaq.js → dashboard-controls-ae5t32xV.js} +5 -5
- package/dist/chunks/{dashboard-json-B309EInF.js → dashboard-json-DTL_kYhz.js} +1 -1
- package/dist/chunks/{dashboard-json-i7Ae9KGD.js → dashboard-json-Db3rkY_a.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-z3IqzYnj.js → edit-dashboard-visual-CW7mv_si.js} +7030 -6963
- package/dist/chunks/{edit-dashboard-visual-4HycwBHR.js → edit-dashboard-visual-Ciqdu58a.js} +38 -38
- package/dist/chunks/{index-yxKWKFdr.js → index-8y8XX7sX.js} +121 -121
- package/dist/chunks/{index-B6DLEXRX.js → index-OD6mLD7U.js} +257 -256
- package/dist/chunks/{switch-COWQU8aK.js → switch-CWcWwwDJ.js} +1 -1
- package/dist/chunks/{switch-D6Ygf3wA.js → switch-DRNqX0v0.js} +1 -1
- package/dist/chunks/{update-policy-BzT2k4n6.js → update-policy-BCJc0oI5.js} +211 -187
- package/dist/chunks/update-policy-C1pmhLz9.js +3 -0
- package/dist/chunks/{use-create-flow-overlay-state-DENfd7sW.js → use-create-flow-overlay-state-C0Uhmlpd.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CX0D-6HM.js → use-create-flow-overlay-state-CkMmXhI-.js} +3 -3
- package/dist/chunks/validators-DMlVbd1p.js +1 -0
- package/dist/chunks/{validators-Cxr9qbrR.js → validators-PXkij33j.js} +93 -93
- 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 +14 -14
- 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 +188 -251
- package/dist/data-app-codegen-node/index.js +631 -673
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +678 -638
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +51 -51
- 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/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +12 -9
- package/dist/types/dashboard-assistant.d.ts +0 -6
- package/dist/types/data-app-codegen-node.d.ts +12 -2
- package/dist/types/data-app-codegen.d.ts +12 -2
- package/dist/types/data-app-sdk-validation.d.ts +0 -6
- package/dist/types/data-app-sdk.d.ts +17 -7
- package/package.json +1 -1
- package/dist/chunks/analyze-result-contract-DdhEt99q.js +0 -2004
- package/dist/chunks/analyze-result-contract-DwRzl7yJ.js +0 -1
- package/dist/chunks/update-policy-VloD-0YM.js +0 -3
- package/dist/chunks/validators-BMQo93Y0.js +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-
|
|
3
|
-
import { C as
|
|
1
|
+
import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/analyze-result-contract-D7pjjYPy.js";
|
|
2
|
+
import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-BCJc0oI5.js";
|
|
3
|
+
import { C as Mn, e as Cn, R as On, f as xn, g as Gn, h as Nn, i as En, j as An, v as jn, d as vn } from "../chunks/update-policy-BCJc0oI5.js";
|
|
4
4
|
import { createHash as ye } from "node:crypto";
|
|
5
|
-
const
|
|
5
|
+
const wn = "src/semaphor/generated", v = `// 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
|
|
8
|
+
function Sn(e, n = {}) {
|
|
9
9
|
ke(e);
|
|
10
|
-
const r =
|
|
10
|
+
const r = Ce(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 t =
|
|
15
|
+
const t = xe(r), o = Ge({
|
|
16
16
|
contract: r,
|
|
17
17
|
files: t,
|
|
18
18
|
generatorName: n.generatorName || "react-semaphor/data-app-codegen/node",
|
|
@@ -27,7 +27,7 @@ function wn(e, n = {}) {
|
|
|
27
27
|
files: a,
|
|
28
28
|
manifest: o,
|
|
29
29
|
contentHash: String(o.generatedContentHash || ""),
|
|
30
|
-
usageExample:
|
|
30
|
+
usageExample: je(r),
|
|
31
31
|
warnings: r.warnings,
|
|
32
32
|
stats: {
|
|
33
33
|
inputCount: r.inputs.length,
|
|
@@ -38,32 +38,32 @@ function wn(e, n = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
41
|
+
function Ce(e) {
|
|
42
|
+
var d, p, m, i, l, g, h, I, $, M, b, C;
|
|
43
43
|
const n = [], r = [];
|
|
44
44
|
for (const s of e.inputs) {
|
|
45
|
-
|
|
46
|
-
for (const
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
w(r, s.fieldRef);
|
|
46
|
+
for (const V of s.bindings || [])
|
|
47
|
+
w(r, V.fieldRef);
|
|
48
|
+
w(r, (d = s.optionQuery) == null ? void 0 : d.valueFieldRef), w(r, (p = s.optionQuery) == null ? void 0 : p.labelFieldRef), w(r, (m = s.optionQuery) == null ? void 0 : m.filterFieldRef), B(r, (i = s.optionQuery) == null ? void 0 : i.spec);
|
|
49
49
|
}
|
|
50
50
|
for (const s of e.filterContracts) {
|
|
51
|
-
|
|
52
|
-
for (const
|
|
53
|
-
|
|
51
|
+
w(r, s.fieldRef), w(r, (l = s.optionQuery) == null ? void 0 : l.valueFieldRef), w(r, (g = s.optionQuery) == null ? void 0 : g.labelFieldRef), w(r, (h = s.optionQuery) == null ? void 0 : h.filterFieldRef), B(r, (I = s.optionQuery) == null ? void 0 : I.spec);
|
|
52
|
+
for (const V of s.bindings || [])
|
|
53
|
+
w(r, V.fieldRef);
|
|
54
54
|
}
|
|
55
55
|
for (const s of e.views) {
|
|
56
|
-
for (const
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
for (const V of s.fields || [])
|
|
57
|
+
w(r, V);
|
|
58
|
+
B(r, ($ = s.sdkSpec) == null ? void 0 : $.spec), B(r, s.visualSpec);
|
|
59
59
|
}
|
|
60
60
|
const t = e.implementationChecklist || {};
|
|
61
61
|
for (const s of Object.values(t.bindingsByView || {}))
|
|
62
|
-
for (const
|
|
63
|
-
|
|
62
|
+
for (const V of Array.isArray(s) ? s : [])
|
|
63
|
+
w(r, V.fieldRef), w(r, V.optionValueField), w(r, V.optionLabelField);
|
|
64
64
|
for (const s of t.requiredInputOptions || [])
|
|
65
|
-
|
|
66
|
-
const o =
|
|
65
|
+
w(r, s.visibleLabelField), w(r, s.optionValueField), w(r, s.runtimeFilterField);
|
|
66
|
+
const o = pn(
|
|
67
67
|
[
|
|
68
68
|
...e.sources.map((s) => ({
|
|
69
69
|
raw: s,
|
|
@@ -71,128 +71,129 @@ function xe(e) {
|
|
|
71
71
|
aliases: Ie(s),
|
|
72
72
|
name: ""
|
|
73
73
|
})),
|
|
74
|
-
...r.map((s) =>
|
|
74
|
+
...r.map((s) => an(s)).filter(E)
|
|
75
75
|
]
|
|
76
76
|
);
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
s.raw.label || (
|
|
77
|
+
P(o, (s) => {
|
|
78
|
+
const V = F(s.raw);
|
|
79
|
+
return K(
|
|
80
|
+
s.raw.label || (V == null ? void 0 : V.datasetName) || (V == null ? void 0 : V.datasetId) || (V == null ? void 0 : V.name) || s.raw.kind || "source"
|
|
81
81
|
);
|
|
82
82
|
});
|
|
83
|
-
const a =
|
|
83
|
+
const a = ln(o), u = X(
|
|
84
84
|
r.filter((s) => s.name).map((s) => ({
|
|
85
85
|
raw: s,
|
|
86
|
-
key:
|
|
86
|
+
key: Z(s),
|
|
87
87
|
name: ""
|
|
88
88
|
})),
|
|
89
89
|
(s) => s.key
|
|
90
90
|
);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(s) =>
|
|
94
|
-
s.raw.sourceKey ?
|
|
91
|
+
P(
|
|
92
|
+
u,
|
|
93
|
+
(s) => K([
|
|
94
|
+
s.raw.sourceKey ? yn(s.raw.sourceKey) : "",
|
|
95
95
|
s.raw.aggregate ? s.raw.aggregate.toLowerCase() : "",
|
|
96
96
|
s.raw.name
|
|
97
97
|
].filter(Boolean).join("_"))
|
|
98
98
|
);
|
|
99
|
-
const
|
|
99
|
+
const c = new Map(u.map((s) => [s.key, s.name])), S = e.inputs.map((s) => ({
|
|
100
100
|
raw: s,
|
|
101
|
-
name:
|
|
101
|
+
name: K(s.id || s.label || "input")
|
|
102
102
|
}));
|
|
103
|
-
|
|
104
|
-
const f =
|
|
103
|
+
P(S, (s) => s.name);
|
|
104
|
+
const f = S.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
|
+
P(f, (s) => s.name);
|
|
110
110
|
for (const s of f)
|
|
111
|
-
|
|
112
|
-
`Input option query ${((
|
|
111
|
+
un(s.raw.labelFieldRef, s.raw.valueFieldRef) && dn(s.raw.valueFieldRef) && n.push(
|
|
112
|
+
`Input option query ${((M = s.raw.spec) == null ? void 0 : M.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
|
-
const
|
|
114
|
+
const y = e.views.filter(
|
|
115
115
|
(s) => {
|
|
116
|
-
var
|
|
117
|
-
return !!((
|
|
116
|
+
var V, T;
|
|
117
|
+
return !!((V = s.sdkSpec) != null && V.builder && ((T = s.sdkSpec) != null && T.spec));
|
|
118
118
|
}
|
|
119
119
|
).map((s) => ({
|
|
120
120
|
raw: s,
|
|
121
|
-
name:
|
|
121
|
+
name: K(s.id || s.title || "query")
|
|
122
122
|
}));
|
|
123
|
-
|
|
124
|
-
const
|
|
123
|
+
P(y, (s) => s.name);
|
|
124
|
+
const O = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => sn(s));
|
|
125
125
|
for (const s of e.views)
|
|
126
|
-
(!("sdkSpec" in s) || !((b = s.sdkSpec) != null && b.builder) || !((
|
|
127
|
-
return
|
|
128
|
-
inputs:
|
|
129
|
-
views:
|
|
126
|
+
(!("sdkSpec" in s) || !((b = s.sdkSpec) != null && b.builder) || !((C = s.sdkSpec) != null && C.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
|
|
127
|
+
return Oe({
|
|
128
|
+
inputs: S,
|
|
129
|
+
views: y,
|
|
130
130
|
filterContracts: e.filterContracts
|
|
131
131
|
}), {
|
|
132
132
|
summary: e,
|
|
133
133
|
title: e.title || "Semaphor Data App",
|
|
134
134
|
sources: o,
|
|
135
|
-
fields:
|
|
136
|
-
inputs:
|
|
135
|
+
fields: u,
|
|
136
|
+
inputs: S,
|
|
137
137
|
optionQueries: f,
|
|
138
|
-
views:
|
|
139
|
-
presentationViews:
|
|
138
|
+
views: y,
|
|
139
|
+
presentationViews: O,
|
|
140
140
|
filterContracts: e.filterContracts,
|
|
141
141
|
checklist: t,
|
|
142
142
|
sourceNameByKey: a,
|
|
143
|
-
fieldNameByKey:
|
|
143
|
+
fieldNameByKey: c,
|
|
144
144
|
warnings: n
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Oe({
|
|
148
148
|
inputs: e,
|
|
149
149
|
views: n,
|
|
150
150
|
filterContracts: r
|
|
151
151
|
}) {
|
|
152
152
|
const t = new Set(e.map((a) => a.raw.id).filter(Boolean)), o = new Set(n.map((a) => a.raw.id).filter(Boolean));
|
|
153
|
-
for (const [a,
|
|
154
|
-
if (!t.has(
|
|
153
|
+
for (const [a, u] of r.entries()) {
|
|
154
|
+
if (!t.has(u.inputId))
|
|
155
155
|
throw new Error(`filterContracts.${a}.inputId must reference a generated input.`);
|
|
156
|
-
const
|
|
157
|
-
for (const [f,
|
|
158
|
-
if (!o.has(
|
|
156
|
+
const c = new Set(u.appliesToViewIds || []), S = new Set(u.notAppliedToViewIds || []);
|
|
157
|
+
for (const [f, y] of (u.appliesToViewIds || []).entries())
|
|
158
|
+
if (!o.has(y))
|
|
159
159
|
throw new Error(
|
|
160
160
|
`filterContracts.${a}.appliesToViewIds.${f} must reference an executable generated view.`
|
|
161
161
|
);
|
|
162
|
-
for (const [f,
|
|
163
|
-
if (!o.has(
|
|
162
|
+
for (const [f, y] of (u.notAppliedToViewIds || []).entries())
|
|
163
|
+
if (!o.has(y))
|
|
164
164
|
throw new Error(
|
|
165
165
|
`filterContracts.${a}.notAppliedToViewIds.${f} must reference an executable generated view.`
|
|
166
166
|
);
|
|
167
|
-
for (const [f,
|
|
168
|
-
if (!o.has(
|
|
167
|
+
for (const [f, y] of (u.bindings || []).entries()) {
|
|
168
|
+
if (!o.has(y.viewId))
|
|
169
169
|
throw new Error(
|
|
170
170
|
`filterContracts.${a}.bindings.${f}.viewId must reference an executable generated view.`
|
|
171
171
|
);
|
|
172
|
-
if (!
|
|
172
|
+
if (!c.has(y.viewId))
|
|
173
173
|
throw new Error(
|
|
174
174
|
`filterContracts.${a}.bindings.${f}.viewId must be included in appliesToViewIds.`
|
|
175
175
|
);
|
|
176
|
-
if (
|
|
176
|
+
if (S.has(y.viewId))
|
|
177
177
|
throw new Error(
|
|
178
178
|
`filterContracts.${a}.bindings.${f}.viewId must not be listed in notAppliedToViewIds.`
|
|
179
179
|
);
|
|
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":
|
|
185
|
+
"sources.ts": Ke(e),
|
|
186
|
+
"fields.ts": Te(e),
|
|
187
|
+
"inputs.ts": Qe(e),
|
|
188
|
+
"queries.ts": De(e),
|
|
189
189
|
"bindings.ts": Le(e),
|
|
190
|
-
"accessors.ts":
|
|
190
|
+
"accessors.ts": Ye(e),
|
|
191
191
|
"metadata.ts": We(e),
|
|
192
|
-
"index.ts":
|
|
192
|
+
"index.ts": Xe(),
|
|
193
|
+
"USAGE.md": Ee(e)
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
+
function Ge({
|
|
196
197
|
contract: e,
|
|
197
198
|
files: n,
|
|
198
199
|
generatorName: r,
|
|
@@ -205,19 +206,51 @@ function Oe({
|
|
|
205
206
|
name: r,
|
|
206
207
|
version: t
|
|
207
208
|
},
|
|
208
|
-
generatedContentHash:
|
|
209
|
+
generatedContentHash: Ne(n),
|
|
209
210
|
codegenSummaryValidatorVersion: Re,
|
|
210
|
-
codegenSummaryHash:
|
|
211
|
+
codegenSummaryHash: Ae(e.summary),
|
|
211
212
|
codegenSummary: e.summary
|
|
212
213
|
};
|
|
213
214
|
}
|
|
214
|
-
function
|
|
215
|
+
function Ne(e) {
|
|
215
216
|
const n = ye("sha256");
|
|
216
|
-
for (const r of Object.keys(e).
|
|
217
|
+
for (const r of Object.keys(e).filter(
|
|
218
|
+
(t) => t.endsWith(".ts")
|
|
219
|
+
).sort())
|
|
217
220
|
n.update(r), n.update("\0"), n.update(e[r]), n.update("\0");
|
|
218
221
|
return `sha256:${n.digest("hex")}`;
|
|
219
222
|
}
|
|
220
|
-
function
|
|
223
|
+
function Ee(e) {
|
|
224
|
+
const n = [
|
|
225
|
+
"# Semaphor Generated Data App Contract",
|
|
226
|
+
"",
|
|
227
|
+
"Generated files in this directory are governed Semaphor analytics wiring. Do not hand-edit them.",
|
|
228
|
+
"",
|
|
229
|
+
"Use the app-facing exports from `index.ts`:",
|
|
230
|
+
"",
|
|
231
|
+
"- `queries`: generated governed query factories.",
|
|
232
|
+
"- `queryOptionsForView`: active-input wiring for each generated view.",
|
|
233
|
+
"- `rowsForView`: table/records row readers.",
|
|
234
|
+
"- `rowValuesForView`: friendly row object readers for chart/table views.",
|
|
235
|
+
"- `metricValuesForView`: friendly metric-value readers.",
|
|
236
|
+
"- `kpiPropsForView`: KPI component props derived from runtime metric results.",
|
|
237
|
+
"- `roleValuesForView`: canonical dimension/measure/date/id role readers.",
|
|
238
|
+
"- `appInputSpecs`: generated input/filter specs.",
|
|
239
|
+
"- `inputOptionQueries`: option-list query factories for generated inputs.",
|
|
240
|
+
"- `semaphorGeneratedContractMetadata`: generated view/input metadata and presentation-only views.",
|
|
241
|
+
"",
|
|
242
|
+
"Start with these exports before opening large generated internals such as `metadata.ts`.",
|
|
243
|
+
""
|
|
244
|
+
];
|
|
245
|
+
return e.views.length > 0 && (n.push("Generated executable views:"), e.views.forEach((r) => {
|
|
246
|
+
n.push(`- \`${r.raw.id}\`: ${r.raw.title || r.name}`);
|
|
247
|
+
}), n.push("")), e.inputs.length > 0 && (n.push("Generated inputs:"), e.inputs.forEach((r) => {
|
|
248
|
+
n.push(`- \`${r.raw.id}\`: ${r.raw.label || r.name}`);
|
|
249
|
+
}), n.push("")), `${n.join(`
|
|
250
|
+
`)}
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
function Ae(e) {
|
|
221
254
|
return `sha256:${ye("sha256").update(ae(e)).digest("hex")}`;
|
|
222
255
|
}
|
|
223
256
|
function ae(e) {
|
|
@@ -228,9 +261,9 @@ function ae(e) {
|
|
|
228
261
|
const n = e;
|
|
229
262
|
return `{${Object.keys(n).sort().filter((t) => n[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(n[t])}`).join(",")}}`;
|
|
230
263
|
}
|
|
231
|
-
function
|
|
264
|
+
function je(e) {
|
|
232
265
|
const n = e.views.find(
|
|
233
|
-
(f) =>
|
|
266
|
+
(f) => A(f) && j(f)
|
|
234
267
|
);
|
|
235
268
|
if (n)
|
|
236
269
|
return [
|
|
@@ -246,7 +279,7 @@ function Ee(e) {
|
|
|
246
279
|
].join(`
|
|
247
280
|
`);
|
|
248
281
|
const r = e.views.find(
|
|
249
|
-
(f) =>
|
|
282
|
+
(f) => A(f)
|
|
250
283
|
);
|
|
251
284
|
if (r)
|
|
252
285
|
return [
|
|
@@ -262,7 +295,7 @@ function Ee(e) {
|
|
|
262
295
|
].join(`
|
|
263
296
|
`);
|
|
264
297
|
const t = e.views.find(
|
|
265
|
-
(f) =>
|
|
298
|
+
(f) => z(f) && j(f)
|
|
266
299
|
);
|
|
267
300
|
if (t)
|
|
268
301
|
return [
|
|
@@ -276,7 +309,7 @@ function Ee(e) {
|
|
|
276
309
|
].join(`
|
|
277
310
|
`);
|
|
278
311
|
const o = e.views.find(
|
|
279
|
-
(f) => ue(f) &&
|
|
312
|
+
(f) => ue(f) && j(f)
|
|
280
313
|
);
|
|
281
314
|
if (o)
|
|
282
315
|
return [
|
|
@@ -290,8 +323,8 @@ function Ee(e) {
|
|
|
290
323
|
].join(`
|
|
291
324
|
`);
|
|
292
325
|
const a = e.views.find((f) => {
|
|
293
|
-
var
|
|
294
|
-
return
|
|
326
|
+
var y;
|
|
327
|
+
return mn((y = f.raw.sdkSpec) == null ? void 0 : y.builder);
|
|
295
328
|
});
|
|
296
329
|
if (a)
|
|
297
330
|
return [
|
|
@@ -303,65 +336,65 @@ function Ee(e) {
|
|
|
303
336
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
304
337
|
].join(`
|
|
305
338
|
`);
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
339
|
+
const u = e.views.find((f) => ve(f));
|
|
340
|
+
if (u)
|
|
308
341
|
return [
|
|
309
|
-
'import { appInputSpecs, createInputHandleMap,
|
|
342
|
+
'import { appInputSpecs, createInputHandleMap, kpiPropsForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
310
343
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
311
344
|
"const inputHandles = createInputHandleMap(handles);",
|
|
312
|
-
`const result = useSemaphorQuery(queries.${
|
|
313
|
-
`const
|
|
345
|
+
`const result = useSemaphorQuery(queries.${u.name}(), queryOptionsForView.${u.name}(inputHandles));`,
|
|
346
|
+
`const kpiProps = kpiPropsForView.${u.name}(result);`,
|
|
314
347
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
315
348
|
].join(`
|
|
316
349
|
`);
|
|
317
|
-
const
|
|
350
|
+
const c = e.views[0];
|
|
318
351
|
return [
|
|
319
352
|
'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
|
|
320
353
|
"const handles = useSemaphorInputs(appInputSpecs);",
|
|
321
354
|
"const inputHandles = createInputHandleMap(handles);",
|
|
322
|
-
|
|
355
|
+
c ? `const result = useSemaphorQuery(queries.${c.name}(), queryOptionsForView.${c.name}(inputHandles));` : "const result = undefined;",
|
|
323
356
|
"const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
|
|
324
357
|
].join(`
|
|
325
358
|
`);
|
|
326
359
|
}
|
|
327
|
-
function
|
|
360
|
+
function z(e) {
|
|
328
361
|
var n;
|
|
329
|
-
return
|
|
362
|
+
return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
|
|
330
363
|
}
|
|
331
|
-
function
|
|
364
|
+
function ve(e) {
|
|
332
365
|
var n;
|
|
333
|
-
return
|
|
366
|
+
return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
|
|
334
367
|
}
|
|
335
|
-
function
|
|
368
|
+
function A(e) {
|
|
336
369
|
var n, r, t;
|
|
337
|
-
return
|
|
370
|
+
return z(e) && ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.sorting) == null ? void 0 : t.mode) === "server";
|
|
338
371
|
}
|
|
339
372
|
function ue(e) {
|
|
340
373
|
var n;
|
|
341
|
-
return
|
|
374
|
+
return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
|
|
342
375
|
}
|
|
343
|
-
function
|
|
376
|
+
function j(e) {
|
|
344
377
|
var n, r, t;
|
|
345
378
|
return ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.pagination) == null ? void 0 : t.mode) === "server";
|
|
346
379
|
}
|
|
347
380
|
function He(e) {
|
|
348
|
-
return
|
|
381
|
+
return z(e) && (j(e) || A(e)) || ue(e) && j(e);
|
|
349
382
|
}
|
|
350
|
-
function
|
|
383
|
+
function Ke(e) {
|
|
351
384
|
const n = e.sources.map(({ name: t, raw: o }) => {
|
|
352
|
-
const a =
|
|
385
|
+
const a = qe(o);
|
|
353
386
|
return ` ${t}: ${a},`;
|
|
354
387
|
}).join(`
|
|
355
388
|
`), r = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
|
|
356
389
|
|
|
357
390
|
` : "";
|
|
358
|
-
return `${
|
|
391
|
+
return `${v}
|
|
359
392
|
${r}export const sources = {
|
|
360
393
|
${n}
|
|
361
394
|
} as const;
|
|
362
395
|
`;
|
|
363
396
|
}
|
|
364
|
-
function
|
|
397
|
+
function qe(e) {
|
|
365
398
|
if (e.kind === "semantic") {
|
|
366
399
|
const n = {
|
|
367
400
|
domainId: e.domainId,
|
|
@@ -369,11 +402,11 @@ function je(e) {
|
|
|
369
402
|
datasetName: e.datasetName,
|
|
370
403
|
label: e.label
|
|
371
404
|
};
|
|
372
|
-
return `semaphor.source.semantic(${k(
|
|
405
|
+
return `semaphor.source.semantic(${k(N(n))})`;
|
|
373
406
|
}
|
|
374
|
-
return `${k(
|
|
407
|
+
return `${k(N({ ...e, sourceKey: void 0 }))} as const`;
|
|
375
408
|
}
|
|
376
|
-
function
|
|
409
|
+
function Te(e) {
|
|
377
410
|
const n = e.fields.map(({ name: t, raw: o }) => {
|
|
378
411
|
const a = Be(o, e);
|
|
379
412
|
return ` ${t}: ${a},`;
|
|
@@ -381,7 +414,7 @@ function qe(e) {
|
|
|
381
414
|
`), r = n.includes("sources.") ? `import { sources } from "./sources";
|
|
382
415
|
|
|
383
416
|
` : "";
|
|
384
|
-
return `${
|
|
417
|
+
return `${v}
|
|
385
418
|
${r}export const fields = {
|
|
386
419
|
${n}
|
|
387
420
|
} as const;
|
|
@@ -394,95 +427,95 @@ function Be(e, n) {
|
|
|
394
427
|
role: e.role,
|
|
395
428
|
dataType: e.dataType,
|
|
396
429
|
aggregate: e.aggregate
|
|
397
|
-
}, t =
|
|
430
|
+
}, t = cn(e), o = t ? n.sourceNameByKey.get(t) : void 0;
|
|
398
431
|
if (t && !o)
|
|
399
432
|
throw new Error(
|
|
400
433
|
`Field ${e.name} references source ${t}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
|
|
401
434
|
);
|
|
402
|
-
const a = Object.entries(
|
|
435
|
+
const a = Object.entries(N(r)).map(([u, c]) => `${JSON.stringify(u)}: ${G(c, n)}`);
|
|
403
436
|
return o && a.push(`"source": sources.${o}`), `{ ${a.join(", ")} }`;
|
|
404
437
|
}
|
|
405
|
-
function
|
|
406
|
-
const n = e.inputs.map((
|
|
407
|
-
const i =
|
|
408
|
-
`id: ${JSON.stringify(
|
|
409
|
-
`label: ${JSON.stringify(
|
|
410
|
-
`operator: ${JSON.stringify(
|
|
438
|
+
function Qe(e) {
|
|
439
|
+
const n = e.inputs.map((m) => {
|
|
440
|
+
const i = R(m.raw.fieldRef, e), l = [
|
|
441
|
+
`id: ${JSON.stringify(m.raw.id)}`,
|
|
442
|
+
`label: ${JSON.stringify(m.raw.label || m.raw.id)}`,
|
|
443
|
+
`operator: ${JSON.stringify(fn(m.raw))}`
|
|
411
444
|
];
|
|
412
|
-
if (i &&
|
|
413
|
-
throw new Error(`Input ${
|
|
414
|
-
return ` ${
|
|
445
|
+
if (i && l.push(`field: fields.${i}`), m.raw.relationshipHint && l.push(`relationshipHint: ${k(m.raw.relationshipHint)}`), !i)
|
|
446
|
+
throw new Error(`Input ${m.raw.id || m.name} is missing a generated field reference.`);
|
|
447
|
+
return ` ${m.name}: semaphor.filter({ ${l.join(", ")} }),`;
|
|
415
448
|
}).join(`
|
|
416
|
-
`), r = e.inputs.map((
|
|
417
|
-
const i =
|
|
418
|
-
id:
|
|
419
|
-
inputId:
|
|
420
|
-
source:
|
|
421
|
-
sourceKey:
|
|
449
|
+
`), r = e.inputs.map((m) => `filterSpecs.${m.name}`).join(", "), t = e.inputs.map((m) => JSON.stringify(m.raw.id)).join(", "), o = e.optionQueries.map((m) => {
|
|
450
|
+
const i = m.input.raw, l = m.raw, g = F(l.spec) || {}, {
|
|
451
|
+
id: h,
|
|
452
|
+
inputId: I,
|
|
453
|
+
source: $,
|
|
454
|
+
sourceKey: M,
|
|
422
455
|
valueField: b,
|
|
423
|
-
labelField:
|
|
456
|
+
labelField: C,
|
|
424
457
|
population: s,
|
|
425
|
-
dependencies:
|
|
458
|
+
dependencies: V,
|
|
426
459
|
limit: T,
|
|
427
460
|
...ee
|
|
428
|
-
} =
|
|
461
|
+
} = g, U = l.sourceKey ? { sourceKey: l.sourceKey } : l.source || $ || (typeof M == "string" ? { sourceKey: M } : void 0), ne = Se(U, e), re = R(l.valueFieldRef, e), te = R(l.labelFieldRef, e), oe = he(m), se = {
|
|
429
462
|
...ee,
|
|
430
|
-
id:
|
|
463
|
+
id: l.id || g.id || `${i.id}-options`,
|
|
431
464
|
inputId: i.id,
|
|
432
|
-
source:
|
|
433
|
-
valueField:
|
|
434
|
-
labelField:
|
|
435
|
-
population:
|
|
465
|
+
source: U,
|
|
466
|
+
valueField: l.valueFieldRef,
|
|
467
|
+
labelField: l.labelFieldRef,
|
|
468
|
+
population: l.population || s,
|
|
436
469
|
dependencies: oe,
|
|
437
|
-
limit:
|
|
470
|
+
limit: l.limit || T || 100
|
|
438
471
|
};
|
|
439
472
|
if (!ne || !re || !te)
|
|
440
|
-
throw new Error(`Input option query ${
|
|
441
|
-
const
|
|
442
|
-
return ` ${
|
|
473
|
+
throw new Error(`Input option query ${l.id || `${i.id}-options`} is missing source, valueField, or labelField.`);
|
|
474
|
+
const Ve = Object.entries(N(se)).map(([Fe, be]) => `${JSON.stringify(Fe)}: ${G(be, e)}`);
|
|
475
|
+
return ` ${m.name}: semaphor.inputOptions({ ${Ve.join(", ")} }),`;
|
|
443
476
|
}).join(`
|
|
444
|
-
`), a = e.optionQueries.map((
|
|
445
|
-
const i =
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
477
|
+
`), a = e.optionQueries.map((m) => {
|
|
478
|
+
const i = Pe(e, m), l = i.length > 0 ? "inputHandles" : "_inputHandles", g = i.map((h) => {
|
|
479
|
+
const I = R(h.raw.fieldRef, e);
|
|
480
|
+
if (!I)
|
|
448
481
|
throw new Error(
|
|
449
|
-
`Input option query ${
|
|
482
|
+
`Input option query ${m.raw.id || `${m.input.raw.id}-options`} references input ${h.raw.id} without a generated field reference.`
|
|
450
483
|
);
|
|
451
|
-
const
|
|
452
|
-
return ` if (${
|
|
453
|
-
inputs.push(semaphor.bindInput(${
|
|
484
|
+
const $ = `inputHandles[${JSON.stringify(h.raw.id)}]`;
|
|
485
|
+
return ` if (${$}) {
|
|
486
|
+
inputs.push(semaphor.bindInput(${$}, { field: fields.${I} }));
|
|
454
487
|
}`;
|
|
455
488
|
}).join(`
|
|
456
489
|
`);
|
|
457
|
-
return ` ${
|
|
490
|
+
return ` ${m.name}(${l}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
458
491
|
const inputs: SemaphorInputReference[] = [];
|
|
459
|
-
${
|
|
492
|
+
${g}
|
|
460
493
|
return inputs;
|
|
461
494
|
},`;
|
|
462
495
|
}).join(`
|
|
463
496
|
|
|
464
|
-
`),
|
|
497
|
+
`), u = e.optionQueries.map((m) => ` ${m.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
|
|
465
498
|
return {
|
|
466
|
-
inputs: inputsForInputOptionQuery.${
|
|
499
|
+
inputs: inputsForInputOptionQuery.${m.name}(inputHandles),
|
|
467
500
|
};
|
|
468
501
|
},`).join(`
|
|
469
502
|
|
|
470
|
-
`),
|
|
471
|
-
return queryOptionsForInputOptionQuery.${
|
|
472
|
-
`),
|
|
503
|
+
`), c = e.optionQueries.map((m) => ` case ${JSON.stringify(m.raw.id || `${m.input.raw.id}-options`)}:
|
|
504
|
+
return queryOptionsForInputOptionQuery.${m.name}(inputHandles);`).join(`
|
|
505
|
+
`), S = e.inputs.length > 0, f = e.optionQueries.length > 0, y = f ? "inputOptionQueryId" : "_inputOptionQueryId", O = f ? "inputHandles" : "_inputHandles", d = [
|
|
473
506
|
"SemaphorInputHandle",
|
|
474
507
|
f ? "SemaphorInputReference" : void 0,
|
|
475
508
|
"SemaphorQueryRuntimeOptions"
|
|
476
|
-
].filter(
|
|
477
|
-
|
|
478
|
-
`import type { ${
|
|
479
|
-
|
|
509
|
+
].filter(E).join(", "), p = [
|
|
510
|
+
S || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
511
|
+
`import type { ${d} } from "react-semaphor/data-app-sdk";`,
|
|
512
|
+
S || f ? 'import { fields } from "./fields";' : void 0,
|
|
480
513
|
f ? 'import { sources } from "./sources";' : void 0,
|
|
481
514
|
'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
|
|
482
|
-
].filter(
|
|
515
|
+
].filter(E).join(`
|
|
483
516
|
`);
|
|
484
|
-
return `${
|
|
485
|
-
${
|
|
517
|
+
return `${v}
|
|
518
|
+
${p}
|
|
486
519
|
|
|
487
520
|
export const filterSpecs = {
|
|
488
521
|
${n}
|
|
@@ -506,22 +539,22 @@ ${a}
|
|
|
506
539
|
} as const;
|
|
507
540
|
|
|
508
541
|
export const queryOptionsForInputOptionQuery = {
|
|
509
|
-
${
|
|
542
|
+
${u}
|
|
510
543
|
} as const;
|
|
511
544
|
|
|
512
545
|
export function queryOptionsForInputOptionQueryId(
|
|
513
|
-
${
|
|
514
|
-
${
|
|
546
|
+
${y}: SemaphorGeneratedInputOptionQueryId,
|
|
547
|
+
${O}: SemaphorGeneratedInputHandleMap,
|
|
515
548
|
): SemaphorQueryRuntimeOptions {
|
|
516
|
-
switch (${
|
|
517
|
-
${
|
|
549
|
+
switch (${y}) {
|
|
550
|
+
${c}
|
|
518
551
|
}
|
|
519
|
-
throw new Error(\`Unknown generated Semaphor input option query id: \${${
|
|
552
|
+
throw new Error(\`Unknown generated Semaphor input option query id: \${${y}}\`);
|
|
520
553
|
}
|
|
521
554
|
`;
|
|
522
555
|
}
|
|
523
|
-
function
|
|
524
|
-
const r =
|
|
556
|
+
function Pe(e, n) {
|
|
557
|
+
const r = he(n);
|
|
525
558
|
if (!r || r.mode === "independent")
|
|
526
559
|
return [];
|
|
527
560
|
if (r.mode !== "explicit")
|
|
@@ -532,78 +565,78 @@ function Qe(e, n) {
|
|
|
532
565
|
]);
|
|
533
566
|
return e.inputs.filter((a) => o.has(a.raw.id) ? !1 : t.has(a.raw.id));
|
|
534
567
|
}
|
|
535
|
-
function
|
|
568
|
+
function he(e) {
|
|
536
569
|
var n;
|
|
537
570
|
return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
|
|
538
571
|
}
|
|
539
|
-
function
|
|
540
|
-
const n = e.views.map((
|
|
541
|
-
var
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
const b = (
|
|
545
|
-
view:
|
|
572
|
+
function De(e) {
|
|
573
|
+
const n = e.views.map((p) => {
|
|
574
|
+
var l, g, h, I, $, M;
|
|
575
|
+
const m = q(p.raw.sdkSpec.builder), i = _e(p);
|
|
576
|
+
if (z(p) && He(p)) {
|
|
577
|
+
const b = (l = p.raw.visualSpec) == null ? void 0 : l.tableBehavior, C = F(i.pagination), s = j(p), V = A(p), T = ((g = b == null ? void 0 : b.pagination) == null ? void 0 : g.pageSize) || J(C == null ? void 0 : C.pageSize) || J(i.limit) || 100, ee = V ? L(p, e) : [], U = V ? Ue({
|
|
578
|
+
view: p,
|
|
546
579
|
contract: e,
|
|
547
580
|
sortFields: ee,
|
|
548
|
-
defaultField: (
|
|
549
|
-
}) : void 0, ne =
|
|
550
|
-
viewName:
|
|
581
|
+
defaultField: (h = b == null ? void 0 : b.sorting) == null ? void 0 : h.defaultField
|
|
582
|
+
}) : void 0, ne = V ? (I = b == null ? void 0 : b.sorting) == null ? void 0 : I.defaultDirection : void 0, re = Je({
|
|
583
|
+
viewName: p.name,
|
|
551
584
|
supportsPagination: s,
|
|
552
|
-
supportsSort:
|
|
553
|
-
}), te =
|
|
554
|
-
recordsSortFieldsForView.${
|
|
585
|
+
supportsSort: V
|
|
586
|
+
}), te = V ? ` const orderBy = resolveRecordsOrderBy(
|
|
587
|
+
recordsSortFieldsForView.${p.name},
|
|
555
588
|
params.sort,
|
|
556
|
-
${
|
|
557
|
-
${
|
|
589
|
+
${G(U, e)},
|
|
590
|
+
${G(ne, e)},
|
|
558
591
|
);
|
|
559
|
-
` : "", oe =
|
|
592
|
+
` : "", oe = V ? ` ...(orderBy ? { orderBy } : {}),
|
|
560
593
|
` : "", se = s ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(T)}),
|
|
561
594
|
` : "";
|
|
562
|
-
return ` ${
|
|
595
|
+
return ` ${p.name}(
|
|
563
596
|
params: ${re} = {},
|
|
564
597
|
) {
|
|
565
|
-
${te} return semaphor.${
|
|
566
|
-
...${
|
|
598
|
+
${te} return semaphor.${m}({
|
|
599
|
+
...${G(i, e)},
|
|
567
600
|
${oe}${se} });
|
|
568
601
|
},`;
|
|
569
602
|
}
|
|
570
|
-
if (ue(
|
|
571
|
-
const b = (
|
|
572
|
-
return ` ${
|
|
603
|
+
if (ue(p) && j(p)) {
|
|
604
|
+
const b = ($ = p.raw.visualSpec) == null ? void 0 : $.tableBehavior, C = F(i.pagination), s = ((M = b == null ? void 0 : b.pagination) == null ? void 0 : M.pageSize) || J(C == null ? void 0 : C.pageSize) || J(i.limit) || 100;
|
|
605
|
+
return ` ${p.name}(
|
|
573
606
|
params: SemaphorGeneratedServerPaginationParams = {},
|
|
574
607
|
) {
|
|
575
|
-
return semaphor.${
|
|
576
|
-
...${
|
|
608
|
+
return semaphor.${m}({
|
|
609
|
+
...${G(i, e)},
|
|
577
610
|
pagination: resolveServerTablePagination(params, ${JSON.stringify(s)}),
|
|
578
611
|
});
|
|
579
612
|
},`;
|
|
580
613
|
}
|
|
581
|
-
return ` ${
|
|
614
|
+
return ` ${p.name}: () => semaphor.${m}(${G(i, e)}),`;
|
|
582
615
|
}).join(`
|
|
583
|
-
`), r = e.views.filter((
|
|
584
|
-
const i =
|
|
616
|
+
`), r = e.views.filter((p) => A(p)).map((p) => {
|
|
617
|
+
const i = L(p, e).map((l) => ` ${JSON.stringify(l.key)}: fields.${l.fieldName},`).join(`
|
|
585
618
|
`);
|
|
586
|
-
return ` ${
|
|
619
|
+
return ` ${p.name}: {
|
|
587
620
|
${i}
|
|
588
621
|
},`;
|
|
589
622
|
}).join(`
|
|
590
|
-
`), t = e.views.filter((
|
|
591
|
-
const i =
|
|
623
|
+
`), t = e.views.filter((p) => A(p)).map((p) => {
|
|
624
|
+
const i = L(p, e).map((l) => ` { key: ${JSON.stringify(l.key)}, label: ${JSON.stringify(l.label)}, field: fields.${l.fieldName} },`).join(`
|
|
592
625
|
`);
|
|
593
|
-
return ` ${
|
|
626
|
+
return ` ${p.name}: [
|
|
594
627
|
${i}
|
|
595
628
|
],`;
|
|
596
629
|
}).join(`
|
|
597
|
-
`), o = e.views.some((
|
|
598
|
-
`),
|
|
630
|
+
`), o = e.views.some((p) => A(p)), a = e.views.some((p) => j(p)), u = [n, r, t].join(`
|
|
631
|
+
`), c = [
|
|
599
632
|
n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
600
633
|
o ? 'import type { SemaphorFieldRef } from "react-semaphor/data-app-sdk";' : void 0,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
].filter(
|
|
634
|
+
u.includes("fields.") ? 'import { fields } from "./fields";' : void 0,
|
|
635
|
+
u.includes("sources.") ? 'import { sources } from "./sources";' : void 0
|
|
636
|
+
].filter(E).join(`
|
|
604
637
|
`);
|
|
605
|
-
return `${
|
|
606
|
-
${
|
|
638
|
+
return `${v}
|
|
639
|
+
${c}
|
|
607
640
|
${o ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
|
|
608
641
|
|
|
609
642
|
export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
|
|
@@ -667,52 +700,52 @@ ${a ? `function resolveServerTablePagination(
|
|
|
667
700
|
` : ""}
|
|
668
701
|
`;
|
|
669
702
|
}
|
|
670
|
-
function
|
|
671
|
-
var a,
|
|
672
|
-
const n =
|
|
703
|
+
function _e(e) {
|
|
704
|
+
var a, u;
|
|
705
|
+
const n = F((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: t, ...o } = n;
|
|
673
706
|
return {
|
|
674
707
|
...o,
|
|
675
708
|
id: e.raw.id,
|
|
676
|
-
label: ((
|
|
709
|
+
label: ((u = e.raw.visualSpec) == null ? void 0 : u.title) || e.raw.title || o.label
|
|
677
710
|
};
|
|
678
711
|
}
|
|
679
|
-
function
|
|
680
|
-
var a,
|
|
681
|
-
const r = [], t =
|
|
682
|
-
for (const
|
|
683
|
-
|
|
684
|
-
for (const
|
|
712
|
+
function L(e, n) {
|
|
713
|
+
var a, u;
|
|
714
|
+
const r = [], t = F((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
|
|
715
|
+
for (const c of H(t.fields)) w(r, c);
|
|
716
|
+
w(r, t.dateField), w(r, (u = F(t.orderBy)) == null ? void 0 : u.field);
|
|
717
|
+
for (const c of e.raw.fields || []) w(r, c);
|
|
685
718
|
return X(
|
|
686
|
-
r.map((
|
|
687
|
-
const
|
|
688
|
-
if (!(!
|
|
719
|
+
r.map((c) => {
|
|
720
|
+
const S = R(c, n);
|
|
721
|
+
if (!(!c.name || !S))
|
|
689
722
|
return {
|
|
690
|
-
key:
|
|
691
|
-
fieldName:
|
|
692
|
-
rawName:
|
|
693
|
-
label:
|
|
723
|
+
key: S,
|
|
724
|
+
fieldName: S,
|
|
725
|
+
rawName: c.name,
|
|
726
|
+
label: c.label || c.name
|
|
694
727
|
};
|
|
695
|
-
}).filter(
|
|
696
|
-
(
|
|
728
|
+
}).filter(E),
|
|
729
|
+
(c) => c.key
|
|
697
730
|
);
|
|
698
731
|
}
|
|
699
|
-
function
|
|
732
|
+
function Ue({
|
|
700
733
|
view: e,
|
|
701
734
|
contract: n,
|
|
702
735
|
sortFields: r,
|
|
703
736
|
defaultField: t
|
|
704
737
|
}) {
|
|
705
|
-
var
|
|
706
|
-
const o = new Set(r.map((
|
|
738
|
+
var S, f;
|
|
739
|
+
const o = new Set(r.map((y) => y.key));
|
|
707
740
|
if (t && o.has(t))
|
|
708
741
|
return t;
|
|
709
|
-
const a = r.filter((
|
|
742
|
+
const a = r.filter((y) => y.rawName === t);
|
|
710
743
|
if (a.length === 1)
|
|
711
744
|
return a[0].key;
|
|
712
|
-
const
|
|
713
|
-
return
|
|
745
|
+
const u = F((S = e.raw.sdkSpec) == null ? void 0 : S.spec), c = R((f = F(u == null ? void 0 : u.orderBy)) == null ? void 0 : f.field, n);
|
|
746
|
+
return c && o.has(c) ? c : void 0;
|
|
714
747
|
}
|
|
715
|
-
function
|
|
748
|
+
function Je({
|
|
716
749
|
viewName: e,
|
|
717
750
|
supportsPagination: n,
|
|
718
751
|
supportsSort: r
|
|
@@ -720,58 +753,58 @@ function Ue({
|
|
|
720
753
|
return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
|
|
721
754
|
}
|
|
722
755
|
function Le(e) {
|
|
723
|
-
const n = e.views.map((
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
if (!
|
|
756
|
+
const n = e.views.map((y) => {
|
|
757
|
+
const d = ze(e, y.raw.id).map((p) => {
|
|
758
|
+
const m = p.inputId, i = R(p.fieldRef, e);
|
|
759
|
+
if (!m || !i)
|
|
727
760
|
return "";
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
730
|
-
|
|
731
|
-
else if (Array.isArray(
|
|
732
|
-
const
|
|
733
|
-
var
|
|
734
|
-
return (
|
|
735
|
-
}).filter((
|
|
736
|
-
|
|
761
|
+
const l = [`field: fields.${i}`];
|
|
762
|
+
if (p.relationshipHint)
|
|
763
|
+
l.push(`relationshipHint: ${k(p.relationshipHint)}`);
|
|
764
|
+
else if (Array.isArray(p.relationshipsUsed) && p.relationshipsUsed.length > 0) {
|
|
765
|
+
const h = p.relationshipsUsed.map((I) => {
|
|
766
|
+
var $;
|
|
767
|
+
return ($ = F(I)) == null ? void 0 : $.id;
|
|
768
|
+
}).filter((I) => typeof I == "string" && I.length > 0);
|
|
769
|
+
h.length > 0 && l.push(`relationshipHint: ${k({ relationshipIds: h })}`);
|
|
737
770
|
}
|
|
738
|
-
const
|
|
739
|
-
return ` if (${
|
|
740
|
-
inputs.push(semaphor.bindInput(${
|
|
771
|
+
const g = `inputHandles[${JSON.stringify(m)}]`;
|
|
772
|
+
return ` if (${g}) {
|
|
773
|
+
inputs.push(semaphor.bindInput(${g}, { ${l.join(", ")} }));
|
|
741
774
|
}`;
|
|
742
775
|
}).filter(Boolean).join(`
|
|
743
776
|
`);
|
|
744
|
-
return { view:
|
|
745
|
-
}), r = n.some((
|
|
746
|
-
const
|
|
747
|
-
return ` ${
|
|
777
|
+
return { view: y, renderedBindings: d };
|
|
778
|
+
}), r = n.some((y) => y.renderedBindings.length > 0), t = n.map(({ view: y, renderedBindings: O }) => {
|
|
779
|
+
const d = O ? "inputHandles" : "_inputHandles";
|
|
780
|
+
return ` ${y.name}(${d}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
748
781
|
const inputs: SemaphorInputReference[] = [];
|
|
749
|
-
${
|
|
782
|
+
${O}
|
|
750
783
|
return inputs;
|
|
751
784
|
},`;
|
|
752
785
|
}).join(`
|
|
753
786
|
|
|
754
|
-
`), o = e.views.map((
|
|
787
|
+
`), o = e.views.map((y) => ` ${y.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
|
|
755
788
|
return {
|
|
756
|
-
inputs: inputsForView.${
|
|
757
|
-
debug: queryDebugForView.${
|
|
789
|
+
inputs: inputsForView.${y.name}(inputHandles),
|
|
790
|
+
debug: queryDebugForView.${y.name},
|
|
758
791
|
};
|
|
759
792
|
},`).join(`
|
|
760
793
|
|
|
761
|
-
`), a = e.views.map((
|
|
762
|
-
return inputsForView.${
|
|
763
|
-
`),
|
|
764
|
-
return queryOptionsForView.${
|
|
765
|
-
`),
|
|
794
|
+
`), a = e.views.map((y) => ` case ${JSON.stringify(y.raw.id)}:
|
|
795
|
+
return inputsForView.${y.name}(inputHandles);`).join(`
|
|
796
|
+
`), u = e.views.map((y) => ` case ${JSON.stringify(y.raw.id)}:
|
|
797
|
+
return queryOptionsForView.${y.name}(inputHandles);`).join(`
|
|
798
|
+
`), c = e.views.length > 0, S = c ? "inputHandles" : "_inputHandles", f = [
|
|
766
799
|
r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
|
|
767
800
|
'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions } from "react-semaphor/data-app-sdk";',
|
|
768
801
|
r ? 'import { fields } from "./fields";' : void 0,
|
|
769
802
|
'import type { SemaphorGeneratedInputHandleMap } from "./inputs";',
|
|
770
|
-
|
|
803
|
+
c ? 'import { queryDebugForView } from "./metadata";' : void 0,
|
|
771
804
|
'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
|
|
772
|
-
].filter(
|
|
805
|
+
].filter(E).join(`
|
|
773
806
|
`);
|
|
774
|
-
return `${
|
|
807
|
+
return `${v}
|
|
775
808
|
${f}
|
|
776
809
|
|
|
777
810
|
export const inputsForView = {
|
|
@@ -784,7 +817,7 @@ ${o}
|
|
|
784
817
|
|
|
785
818
|
export function inputsForViewId(
|
|
786
819
|
viewId: SemaphorGeneratedQueryViewId,
|
|
787
|
-
${
|
|
820
|
+
${S}: SemaphorGeneratedInputHandleMap,
|
|
788
821
|
): SemaphorInputReference[] {
|
|
789
822
|
switch (viewId) {
|
|
790
823
|
${a}
|
|
@@ -794,16 +827,16 @@ ${a}
|
|
|
794
827
|
|
|
795
828
|
export function queryOptionsForViewId(
|
|
796
829
|
viewId: SemaphorGeneratedQueryViewId,
|
|
797
|
-
${
|
|
830
|
+
${S}: SemaphorGeneratedInputHandleMap,
|
|
798
831
|
): SemaphorQueryRuntimeOptions {
|
|
799
832
|
switch (viewId) {
|
|
800
|
-
${
|
|
833
|
+
${u}
|
|
801
834
|
}
|
|
802
835
|
throw new Error(\`Unknown generated Semaphor view id: \${viewId}\`);
|
|
803
836
|
}
|
|
804
837
|
`;
|
|
805
838
|
}
|
|
806
|
-
function
|
|
839
|
+
function ze(e, n) {
|
|
807
840
|
return e.filterContracts.flatMap(
|
|
808
841
|
(r) => (r.bindings || []).filter((t) => t.viewId === n).map((t) => ({
|
|
809
842
|
inputId: r.inputId,
|
|
@@ -813,140 +846,160 @@ function Je(e, n) {
|
|
|
813
846
|
}))
|
|
814
847
|
);
|
|
815
848
|
}
|
|
816
|
-
function
|
|
849
|
+
function Ye(e) {
|
|
817
850
|
const n = e.views.map((i) => {
|
|
818
|
-
const
|
|
819
|
-
const
|
|
820
|
-
return
|
|
851
|
+
const g = D(i, e).map((h) => {
|
|
852
|
+
const I = R(h.raw, e);
|
|
853
|
+
return I ? ` ${h.name}: fields.${I},` : "";
|
|
821
854
|
}).filter(Boolean).join(`
|
|
822
855
|
`);
|
|
823
856
|
return ` ${i.name}: {
|
|
824
|
-
${
|
|
857
|
+
${g}
|
|
825
858
|
},`;
|
|
826
859
|
}).join(`
|
|
827
860
|
`), r = e.views.map((i) => {
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
return
|
|
861
|
+
const g = Q(i, e).map((h) => {
|
|
862
|
+
const I = R(h.raw, e);
|
|
863
|
+
return I ? ` ${h.name}: fields.${I},` : "";
|
|
831
864
|
}).filter(Boolean).join(`
|
|
832
865
|
`);
|
|
833
866
|
return ` ${i.name}: {
|
|
834
|
-
${
|
|
867
|
+
${g}
|
|
835
868
|
},`;
|
|
836
869
|
}).join(`
|
|
837
870
|
`), t = e.views.map((i) => {
|
|
838
|
-
const
|
|
839
|
-
const R = Array.from(
|
|
840
|
-
new Set(
|
|
841
|
-
he(F.raw).filter((b) => g.has(b))
|
|
842
|
-
)
|
|
843
|
-
);
|
|
844
|
-
return ` ${F.name}: metricKeysForField(metricFieldsForView.${i.name}.${F.name}, { allowNameFallback: ${S.has(F.raw.name) ? "false" : "true"}, excludedKeys: ${k(R)} }),`;
|
|
845
|
-
}).join(`
|
|
871
|
+
const g = Q(i, e).map((h, I) => ` ${h.name}: ${JSON.stringify(en(i, h, I))},`).join(`
|
|
846
872
|
`);
|
|
847
873
|
return ` ${i.name}: {
|
|
848
|
-
${
|
|
874
|
+
${g}
|
|
849
875
|
},`;
|
|
850
876
|
}).join(`
|
|
851
877
|
`), o = e.views.map((i) => {
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
return ` ${i.name}: {
|
|
855
|
-
${S}
|
|
856
|
-
},`;
|
|
857
|
-
}).join(`
|
|
858
|
-
`), a = e.views.map((i) => {
|
|
859
|
-
const p = P(i, e);
|
|
860
|
-
if (p.length === 0)
|
|
878
|
+
const l = Q(i, e);
|
|
879
|
+
if (l.length === 0)
|
|
861
880
|
return ` ${i.name}(): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
|
|
862
881
|
return {};
|
|
863
882
|
},`;
|
|
864
|
-
const
|
|
865
|
-
const
|
|
866
|
-
return ` ${
|
|
883
|
+
const g = l.map((h) => {
|
|
884
|
+
const $ = `readMetricValueByBinding(measures, measureBindings, ${`metricMeasureBindingKeysForView.${i.name}.${h.name}`})`;
|
|
885
|
+
return ` ${h.name}: ${$},`;
|
|
867
886
|
}).join(`
|
|
868
887
|
`);
|
|
869
888
|
return ` ${i.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
|
|
870
889
|
const measures = result?.measures;
|
|
871
890
|
const measureBindings = result?.measureBindings;
|
|
872
|
-
const primaryValue = result?.primaryValue;
|
|
873
891
|
return {
|
|
874
892
|
${g}
|
|
875
893
|
};
|
|
876
894
|
},`;
|
|
877
895
|
}).join(`
|
|
878
896
|
|
|
879
|
-
`),
|
|
880
|
-
const
|
|
881
|
-
if (
|
|
897
|
+
`), a = e.views.map((i) => {
|
|
898
|
+
const l = Q(i, e);
|
|
899
|
+
if (l.length === 0)
|
|
882
900
|
return ` ${i.name}(): Array<keyof typeof metricFieldsForView.${i.name}> {
|
|
883
901
|
return [];
|
|
884
902
|
},`;
|
|
885
|
-
const
|
|
903
|
+
const g = l.map((h, I) => {
|
|
904
|
+
const $ = `metricMeasureBindingKeysForView.${i.name}.${h.name}`, M = I === 0 ? `readMetricValueByBinding(measures, measureBindings, ${$}) === undefined && !hasOwnPrimaryMetricValue(result)` : `readMetricValueByBinding(measures, measureBindings, ${$}) === undefined`;
|
|
905
|
+
return ` ...(missing.has(${$}) || (${M}) ? [${JSON.stringify(h.name)} as keyof typeof metricFieldsForView.${i.name}] : []),`;
|
|
906
|
+
}).join(`
|
|
886
907
|
`);
|
|
887
908
|
return ` ${i.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${i.name}> {
|
|
888
909
|
const missing = new Set(result?.missingMeasures || []);
|
|
910
|
+
const measures = result?.measures;
|
|
911
|
+
const measureBindings = result?.measureBindings;
|
|
889
912
|
return [
|
|
890
|
-
${
|
|
913
|
+
${g}
|
|
891
914
|
];
|
|
892
915
|
},`;
|
|
893
916
|
}).join(`
|
|
894
917
|
|
|
895
|
-
`),
|
|
896
|
-
const
|
|
897
|
-
|
|
918
|
+
`), u = e.views.map((i) => {
|
|
919
|
+
const l = Q(i, e);
|
|
920
|
+
if (l.length === 0)
|
|
921
|
+
return "";
|
|
922
|
+
const g = l[0], h = l.map(($) => `{ key: ${JSON.stringify($.name)}, label: ${JSON.stringify($.raw.label || $.raw.name)} }`).join(", "), I = l.filter(($) => $.name !== g.name).map(($) => ` if (missing.includes(${JSON.stringify($.name)})) delete values.${$.name};`).join(`
|
|
923
|
+
`);
|
|
924
|
+
return ` ${i.name}(result: SemaphorGeneratedMetricResult): SemaphorGeneratedKpiProps {
|
|
925
|
+
const values = mapMetricDisplayValues(metricValuesForView.${i.name}(result));
|
|
926
|
+
const missing = missingMetricMeasuresForView.${i.name}(result).map((key) => String(key));
|
|
927
|
+
const primaryMissing = missing.includes(${JSON.stringify(g.name)});
|
|
928
|
+
const boundPrimaryValue = values.${g.name};
|
|
929
|
+
const primaryValue = primaryMissing || boundPrimaryValue === undefined ? result?.primaryValue : boundPrimaryValue;
|
|
930
|
+
if (primaryMissing) values.${g.name} = metricDisplayValue(result?.primaryValue);
|
|
931
|
+
${I}
|
|
932
|
+
return {
|
|
933
|
+
result: {
|
|
934
|
+
...(result || {}),
|
|
935
|
+
primaryValue: metricDisplayValue(result?.primaryValue),
|
|
936
|
+
comparisonValue: metricDisplayValue(result?.comparisonValue),
|
|
937
|
+
measures: values,
|
|
938
|
+
},
|
|
939
|
+
title: ${JSON.stringify(i.raw.title || i.raw.id)},
|
|
940
|
+
label: ${JSON.stringify(g.raw.label || g.raw.name)},
|
|
941
|
+
value: metricDisplayValue(primaryValue),
|
|
942
|
+
measures: [${h}],
|
|
943
|
+
missingMeasures: missing,
|
|
944
|
+
showComparison: Boolean(result?.comparisonKind),
|
|
945
|
+
};
|
|
946
|
+
},`;
|
|
947
|
+
}).filter(Boolean).join(`
|
|
948
|
+
|
|
949
|
+
`), c = e.views.map((i) => {
|
|
950
|
+
const l = Ze(i, e);
|
|
951
|
+
return ` ${i.name}: ${k(l)},`;
|
|
898
952
|
}).join(`
|
|
899
|
-
`),
|
|
900
|
-
const
|
|
953
|
+
`), S = e.views.map((i) => {
|
|
954
|
+
const g = D(i, e).map((h) => ` ${h.name}: resolveColumnKey(columns, fieldsForView.${i.name}.${h.name}),`).join(`
|
|
901
955
|
`);
|
|
902
956
|
return ` ${i.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, string | undefined> {
|
|
903
957
|
return {
|
|
904
|
-
${
|
|
958
|
+
${g}
|
|
905
959
|
};
|
|
906
960
|
},`;
|
|
907
961
|
}).join(`
|
|
908
962
|
|
|
909
963
|
`), f = e.views.map((i) => {
|
|
910
|
-
const
|
|
964
|
+
const g = D(i, e).map((h) => ` ${h.name}: readCell(row, columns, fieldsForView.${i.name}.${h.name}),`).join(`
|
|
911
965
|
`);
|
|
912
966
|
return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, unknown> {
|
|
913
967
|
return {
|
|
914
|
-
${
|
|
968
|
+
${g}
|
|
915
969
|
};
|
|
916
970
|
},`;
|
|
917
971
|
}).join(`
|
|
918
972
|
|
|
919
|
-
`),
|
|
973
|
+
`), y = e.views.map((i) => ` ${i.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${i.name}, unknown>> {
|
|
920
974
|
return (result?.records || []).map((row) => rowValuesForView.${i.name}(row, result?.columns));
|
|
921
975
|
},`).join(`
|
|
922
976
|
|
|
923
|
-
`),
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
977
|
+
`), O = e.views.map((i) => {
|
|
978
|
+
const l = D(i, e), g = l.filter((s) => s.raw.role === "dimension"), h = l.filter((s) => s.raw.role === "measure"), I = g[0], $ = g[1], M = h[0], b = h[1], C = [
|
|
979
|
+
I ? ` primaryDimension: values.${I.name},` : " primaryDimension: undefined,",
|
|
980
|
+
$ ? ` secondaryDimension: values.${$.name},` : " secondaryDimension: undefined,",
|
|
981
|
+
M ? ` primaryMeasure: values.${M.name},` : " primaryMeasure: undefined,",
|
|
928
982
|
b ? ` secondaryMeasure: values.${b.name},` : " secondaryMeasure: undefined,"
|
|
929
983
|
].join(`
|
|
930
984
|
`);
|
|
931
985
|
return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): SemaphorGeneratedRoleValues {
|
|
932
986
|
const values = rowValuesForView.${i.name}(row, columns);
|
|
933
987
|
return {
|
|
934
|
-
${
|
|
988
|
+
${C}
|
|
935
989
|
};
|
|
936
990
|
},`;
|
|
937
991
|
}).join(`
|
|
938
992
|
|
|
939
|
-
`),
|
|
993
|
+
`), d = n.includes("fields.") || r.includes("fields."), m = [
|
|
940
994
|
`import { ${[
|
|
941
995
|
"type SemaphorFieldRef",
|
|
942
|
-
"type SemaphorResultColumn"
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
].filter(K).join(`
|
|
996
|
+
"type SemaphorResultColumn"
|
|
997
|
+
].filter(E).join(", ")} } from "react-semaphor/data-app-sdk";`,
|
|
998
|
+
d ? 'import { fields } from "./fields";' : void 0
|
|
999
|
+
].filter(E).join(`
|
|
947
1000
|
`);
|
|
948
|
-
return `${
|
|
949
|
-
${
|
|
1001
|
+
return `${v}
|
|
1002
|
+
${m}
|
|
950
1003
|
|
|
951
1004
|
export type SemaphorGeneratedRow = Record<string, unknown>;
|
|
952
1005
|
export type SemaphorGeneratedColumns = readonly SemaphorResultColumn[] | null | undefined;
|
|
@@ -956,12 +1009,16 @@ export type SemaphorGeneratedRecordsResult = {
|
|
|
956
1009
|
} | null | undefined;
|
|
957
1010
|
export type SemaphorGeneratedMetricMeasures = Record<string, unknown> | null | undefined;
|
|
958
1011
|
export type SemaphorGeneratedMetricMeasureBindings = Record<string, string> | null | undefined;
|
|
1012
|
+
export type SemaphorGeneratedMetricValue = number | string | null;
|
|
959
1013
|
export type SemaphorGeneratedMetricResult = {
|
|
960
1014
|
readonly measures?: SemaphorGeneratedMetricMeasures;
|
|
961
1015
|
readonly measureBindings?: SemaphorGeneratedMetricMeasureBindings;
|
|
962
1016
|
readonly missingMeasures?: readonly string[];
|
|
963
1017
|
readonly primaryValue: unknown;
|
|
964
|
-
readonly
|
|
1018
|
+
readonly comparisonKind?: string;
|
|
1019
|
+
readonly comparisonValue?: unknown;
|
|
1020
|
+
readonly delta?: number | null;
|
|
1021
|
+
readonly deltaPercent?: number | null;
|
|
965
1022
|
} | null | undefined;
|
|
966
1023
|
export type SemaphorGeneratedRoleValues = {
|
|
967
1024
|
readonly primaryDimension: unknown;
|
|
@@ -976,6 +1033,28 @@ export type SemaphorGeneratedTableColumn = {
|
|
|
976
1033
|
readonly sortable?: boolean;
|
|
977
1034
|
readonly sortKey?: string;
|
|
978
1035
|
};
|
|
1036
|
+
export type SemaphorGeneratedKpiResult<TValues extends Record<string, SemaphorGeneratedMetricValue> = Record<string, SemaphorGeneratedMetricValue>> =
|
|
1037
|
+
Record<string, unknown> & {
|
|
1038
|
+
readonly primaryValue?: SemaphorGeneratedMetricValue;
|
|
1039
|
+
readonly comparisonValue?: SemaphorGeneratedMetricValue;
|
|
1040
|
+
readonly comparisonKind?: string;
|
|
1041
|
+
readonly delta?: number | null;
|
|
1042
|
+
readonly deltaPercent?: number | null;
|
|
1043
|
+
readonly measures: TValues;
|
|
1044
|
+
};
|
|
1045
|
+
export type SemaphorGeneratedKpiMeasureConfig = {
|
|
1046
|
+
key: string;
|
|
1047
|
+
label: string;
|
|
1048
|
+
};
|
|
1049
|
+
export type SemaphorGeneratedKpiProps = {
|
|
1050
|
+
readonly result: SemaphorGeneratedKpiResult;
|
|
1051
|
+
readonly title: string;
|
|
1052
|
+
readonly label: string;
|
|
1053
|
+
readonly value: SemaphorGeneratedMetricValue;
|
|
1054
|
+
readonly measures: SemaphorGeneratedKpiMeasureConfig[];
|
|
1055
|
+
readonly missingMeasures: readonly string[];
|
|
1056
|
+
readonly showComparison: boolean;
|
|
1057
|
+
};
|
|
979
1058
|
|
|
980
1059
|
export const fieldsForView = {
|
|
981
1060
|
${n}
|
|
@@ -985,20 +1064,16 @@ export const metricFieldsForView = {
|
|
|
985
1064
|
${r}
|
|
986
1065
|
} as const;
|
|
987
1066
|
|
|
988
|
-
export const metricMeasureKeysForView = {
|
|
989
|
-
${t}
|
|
990
|
-
} as const;
|
|
991
|
-
|
|
992
1067
|
export const metricMeasureBindingKeysForView = {
|
|
993
|
-
${
|
|
1068
|
+
${t}
|
|
994
1069
|
} as const;
|
|
995
1070
|
|
|
996
1071
|
export const tableColumnsForView = {
|
|
997
|
-
${
|
|
1072
|
+
${c}
|
|
998
1073
|
} as const;
|
|
999
1074
|
|
|
1000
1075
|
export const columnKeysForView = {
|
|
1001
|
-
${
|
|
1076
|
+
${S}
|
|
1002
1077
|
} as const;
|
|
1003
1078
|
|
|
1004
1079
|
export const rowValuesForView = {
|
|
@@ -1006,19 +1081,23 @@ ${f}
|
|
|
1006
1081
|
} as const;
|
|
1007
1082
|
|
|
1008
1083
|
export const rowsForView = {
|
|
1009
|
-
${
|
|
1084
|
+
${y}
|
|
1010
1085
|
} as const;
|
|
1011
1086
|
|
|
1012
1087
|
export const roleValuesForView = {
|
|
1013
|
-
${
|
|
1088
|
+
${O}
|
|
1014
1089
|
} as const;
|
|
1015
1090
|
|
|
1016
1091
|
export const metricValuesForView = {
|
|
1017
|
-
${
|
|
1092
|
+
${o}
|
|
1018
1093
|
} as const;
|
|
1019
1094
|
|
|
1020
1095
|
export const missingMetricMeasuresForView = {
|
|
1021
|
-
${
|
|
1096
|
+
${a}
|
|
1097
|
+
} as const;
|
|
1098
|
+
|
|
1099
|
+
export const kpiPropsForView = {
|
|
1100
|
+
${u}
|
|
1022
1101
|
} as const;
|
|
1023
1102
|
|
|
1024
1103
|
export function resolveColumnKey(
|
|
@@ -1062,155 +1141,42 @@ export function readStringCell(
|
|
|
1062
1141
|
return value === null || value === undefined ? "" : String(value);
|
|
1063
1142
|
}
|
|
1064
1143
|
|
|
1065
|
-
export function readMetricValue(
|
|
1066
|
-
measures: SemaphorGeneratedMetricMeasures,
|
|
1067
|
-
field: SemaphorFieldRef,
|
|
1068
|
-
): unknown {
|
|
1069
|
-
return readMetricValueByKeys(measures, metricKeysForField(field));
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
export function readMetricValueByKeys(
|
|
1073
|
-
measures: SemaphorGeneratedMetricMeasures,
|
|
1074
|
-
keys: readonly string[],
|
|
1075
|
-
): unknown {
|
|
1076
|
-
if (!measures) {
|
|
1077
|
-
return undefined;
|
|
1078
|
-
}
|
|
1079
|
-
for (const key of keys) {
|
|
1080
|
-
if (Object.prototype.hasOwnProperty.call(measures, key)) {
|
|
1081
|
-
return measures[key];
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
return undefined;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
1144
|
export function readMetricValueByBinding(
|
|
1088
1145
|
measures: SemaphorGeneratedMetricMeasures,
|
|
1089
1146
|
measureBindings: SemaphorGeneratedMetricMeasureBindings,
|
|
1090
1147
|
bindingKey: string,
|
|
1091
|
-
fallbackKeys: readonly string[],
|
|
1092
1148
|
): unknown {
|
|
1093
1149
|
const resultKey = measureBindings?.[bindingKey];
|
|
1094
1150
|
if (resultKey && measures && Object.prototype.hasOwnProperty.call(measures, resultKey)) {
|
|
1095
1151
|
return measures[resultKey];
|
|
1096
1152
|
}
|
|
1097
|
-
return
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
export function readMetricValueByKeysWithFallback(
|
|
1101
|
-
measures: SemaphorGeneratedMetricMeasures,
|
|
1102
|
-
keys: readonly string[],
|
|
1103
|
-
fallbackValue: unknown,
|
|
1104
|
-
): unknown {
|
|
1105
|
-
const value = readMetricValueByKeys(measures, keys);
|
|
1106
|
-
return value === undefined ? fallbackValue : value;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
export function readMetricValueByBindingWithFallback(
|
|
1110
|
-
measures: SemaphorGeneratedMetricMeasures,
|
|
1111
|
-
measureBindings: SemaphorGeneratedMetricMeasureBindings,
|
|
1112
|
-
bindingKey: string,
|
|
1113
|
-
fallbackKeys: readonly string[],
|
|
1114
|
-
fallbackValue: unknown,
|
|
1115
|
-
): unknown {
|
|
1116
|
-
const value = readMetricValueByBinding(measures, measureBindings, bindingKey, fallbackKeys);
|
|
1117
|
-
return value === undefined ? fallbackValue : value;
|
|
1153
|
+
return undefined;
|
|
1118
1154
|
}
|
|
1119
1155
|
|
|
1120
|
-
export function
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
const value = readMetricValue(measures, field);
|
|
1125
|
-
if (typeof value === "number") {
|
|
1126
|
-
return Number.isFinite(value) ? value : null;
|
|
1127
|
-
}
|
|
1128
|
-
if (typeof value === "string" && value.trim().length > 0) {
|
|
1129
|
-
const parsed = Number(value);
|
|
1130
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1131
|
-
}
|
|
1132
|
-
return null;
|
|
1156
|
+
export function hasOwnPrimaryMetricValue(
|
|
1157
|
+
result: SemaphorGeneratedMetricResult,
|
|
1158
|
+
): boolean {
|
|
1159
|
+
return Boolean(result && Object.prototype.hasOwnProperty.call(result, "primaryValue"));
|
|
1133
1160
|
}
|
|
1134
1161
|
|
|
1135
|
-
export function
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1162
|
+
export function mapMetricDisplayValues(
|
|
1163
|
+
values: Record<string, unknown>,
|
|
1164
|
+
): Record<string, SemaphorGeneratedMetricValue> {
|
|
1165
|
+
return Object.fromEntries(
|
|
1166
|
+
Object.entries(values)
|
|
1167
|
+
.map(([key, value]) => [key, metricDisplayValue(value)] as const)
|
|
1168
|
+
.filter(([key]) => values[key] !== undefined),
|
|
1169
|
+
);
|
|
1141
1170
|
}
|
|
1142
1171
|
|
|
1143
|
-
export function
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
): string[] {
|
|
1147
|
-
const prefixes = metricKeyPrefixesForSource(field.source);
|
|
1148
|
-
const aggregate = metricAggregateForField(field);
|
|
1149
|
-
const excludedKeys = new Set(options.excludedKeys || []);
|
|
1150
|
-
return uniqueStrings([
|
|
1151
|
-
metricQualifiedKeyForField(field),
|
|
1152
|
-
...prefixes.map((prefix) => \`\${prefix}.\${field.name}\`),
|
|
1153
|
-
\`\${aggregate.toLowerCase()}_\${field.name}\`,
|
|
1154
|
-
\`\${aggregate}_\${field.name}\`,
|
|
1155
|
-
\`\${field.name}_\${aggregate.toLowerCase()}\`,
|
|
1156
|
-
\`\${field.name}_\${aggregate}\`,
|
|
1157
|
-
...(options.allowNameFallback === false ? [] : [field.name]),
|
|
1158
|
-
]).filter((key) => !excludedKeys.has(key));
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
function metricQualifiedKeyForField(field: SemaphorFieldRef): string {
|
|
1162
|
-
return semaphorMetricMeasureBindingKey(field);
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function metricAggregateForField(field: SemaphorFieldRef): string {
|
|
1166
|
-
return stringProperty(field as Record<string, unknown>, "aggregate")?.toUpperCase() || "SUM";
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
function metricKeyPrefixesForSource(
|
|
1170
|
-
source: SemaphorFieldRef["source"] | undefined,
|
|
1171
|
-
): string[] {
|
|
1172
|
-
if (!source) {
|
|
1173
|
-
return [];
|
|
1172
|
+
export function metricDisplayValue(value: unknown): SemaphorGeneratedMetricValue {
|
|
1173
|
+
if (value === null || value === undefined) {
|
|
1174
|
+
return null;
|
|
1174
1175
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
const prefixes: string[] = [];
|
|
1178
|
-
const datasetName = stringProperty(sourceRecord, "datasetName");
|
|
1179
|
-
const datasetId = stringProperty(sourceRecord, "datasetId");
|
|
1180
|
-
if (datasetName) {
|
|
1181
|
-
prefixes.push(datasetName);
|
|
1182
|
-
}
|
|
1183
|
-
if (datasetId) {
|
|
1184
|
-
prefixes.push(datasetId);
|
|
1185
|
-
}
|
|
1186
|
-
return uniqueStrings(prefixes);
|
|
1176
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
1177
|
+
return value;
|
|
1187
1178
|
}
|
|
1188
|
-
|
|
1189
|
-
const prefixes: string[] = [];
|
|
1190
|
-
const databaseName = stringProperty(sourceRecord, "databaseName");
|
|
1191
|
-
const schemaName = stringProperty(sourceRecord, "schemaName");
|
|
1192
|
-
const tableName = stringProperty(sourceRecord, "tableName");
|
|
1193
|
-
if (tableName) {
|
|
1194
|
-
prefixes.push(tableName);
|
|
1195
|
-
}
|
|
1196
|
-
if (schemaName && tableName) {
|
|
1197
|
-
prefixes.push(\`\${schemaName}.\${tableName}\`);
|
|
1198
|
-
}
|
|
1199
|
-
if (databaseName && schemaName && tableName) {
|
|
1200
|
-
prefixes.push(\`\${databaseName}.\${schemaName}.\${tableName}\`);
|
|
1201
|
-
}
|
|
1202
|
-
return uniqueStrings(prefixes);
|
|
1203
|
-
}
|
|
1204
|
-
return [];
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
function stringProperty(record: Record<string, unknown>, key: string): string | undefined {
|
|
1208
|
-
const value = record[key];
|
|
1209
|
-
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
function uniqueStrings(values: string[]): string[] {
|
|
1213
|
-
return Array.from(new Set(values.filter((value) => value.length > 0)));
|
|
1179
|
+
return String(value);
|
|
1214
1180
|
}
|
|
1215
1181
|
|
|
1216
1182
|
function resolveColumn(
|
|
@@ -1317,87 +1283,87 @@ function sourcesReferToSameDataset(
|
|
|
1317
1283
|
}
|
|
1318
1284
|
`;
|
|
1319
1285
|
}
|
|
1320
|
-
function
|
|
1286
|
+
function Ze(e, n) {
|
|
1321
1287
|
const r = D(e, n), t = new Map(
|
|
1322
|
-
(
|
|
1288
|
+
(A(e) ? L(e, n) : []).map((o) => [o.fieldName, o.key])
|
|
1323
1289
|
);
|
|
1324
1290
|
return r.map((o) => {
|
|
1325
|
-
const a =
|
|
1326
|
-
return
|
|
1291
|
+
const a = R(o.raw, n), u = a ? t.get(a) : void 0;
|
|
1292
|
+
return N({
|
|
1327
1293
|
key: o.name,
|
|
1328
1294
|
label: o.raw.label || o.raw.name,
|
|
1329
1295
|
dataType: o.raw.dataType,
|
|
1330
|
-
sortable: !!
|
|
1331
|
-
sortKey:
|
|
1296
|
+
sortable: !!u,
|
|
1297
|
+
sortKey: u
|
|
1332
1298
|
});
|
|
1333
1299
|
});
|
|
1334
1300
|
}
|
|
1335
1301
|
function We(e) {
|
|
1336
|
-
const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((
|
|
1337
|
-
|
|
1302
|
+
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), a = e.inputs.map((d) => d.raw.id).filter(Boolean), u = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean), c = Object.fromEntries(o.map((d) => [
|
|
1303
|
+
d,
|
|
1338
1304
|
e.filterContracts.filter(
|
|
1339
|
-
(
|
|
1340
|
-
).map((
|
|
1341
|
-
])),
|
|
1342
|
-
|
|
1305
|
+
(p) => Array.isArray(p.appliesToViewIds) && p.appliesToViewIds.includes(d)
|
|
1306
|
+
).map((p) => p.inputId)
|
|
1307
|
+
])), S = Object.fromEntries(e.views.map((d) => [
|
|
1308
|
+
d.raw.id,
|
|
1343
1309
|
{
|
|
1344
|
-
title:
|
|
1345
|
-
visual:
|
|
1346
|
-
visualSpec:
|
|
1347
|
-
queryKind:
|
|
1348
|
-
sdkBuilder:
|
|
1310
|
+
title: d.raw.title,
|
|
1311
|
+
visual: d.raw.visual,
|
|
1312
|
+
visualSpec: d.raw.visualSpec,
|
|
1313
|
+
queryKind: d.raw.queryKind,
|
|
1314
|
+
sdkBuilder: d.raw.sdkBuilder
|
|
1349
1315
|
}
|
|
1350
|
-
])), f = Object.fromEntries(e.views.map((
|
|
1351
|
-
var
|
|
1316
|
+
])), f = Object.fromEntries(e.views.map((d) => {
|
|
1317
|
+
var p;
|
|
1352
1318
|
return [
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
viewId:
|
|
1356
|
-
queryId:
|
|
1357
|
-
title:
|
|
1358
|
-
visualType: ((
|
|
1359
|
-
suggestedComponentName: me(
|
|
1319
|
+
d.raw.id,
|
|
1320
|
+
N({
|
|
1321
|
+
viewId: d.raw.id,
|
|
1322
|
+
queryId: d.name,
|
|
1323
|
+
title: d.raw.title,
|
|
1324
|
+
visualType: ((p = d.raw.visualSpec) == null ? void 0 : p.visualType) || d.raw.visual,
|
|
1325
|
+
suggestedComponentName: me(d.raw.title || d.raw.id || d.name),
|
|
1360
1326
|
marker: {
|
|
1361
1327
|
attribute: "data-semaphor-view-id",
|
|
1362
|
-
value:
|
|
1328
|
+
value: d.raw.id
|
|
1363
1329
|
}
|
|
1364
1330
|
})
|
|
1365
1331
|
];
|
|
1366
|
-
})),
|
|
1367
|
-
var
|
|
1332
|
+
})), y = Object.fromEntries(e.inputs.map((d) => {
|
|
1333
|
+
var p;
|
|
1368
1334
|
return [
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
inputId:
|
|
1372
|
-
label:
|
|
1373
|
-
type:
|
|
1374
|
-
optionQueryId: ((
|
|
1375
|
-
suggestedComponentName: me(
|
|
1335
|
+
d.raw.id,
|
|
1336
|
+
N({
|
|
1337
|
+
inputId: d.raw.id,
|
|
1338
|
+
label: d.raw.label,
|
|
1339
|
+
type: d.raw.type,
|
|
1340
|
+
optionQueryId: ((p = d.raw.optionQuery) == null ? void 0 : p.id) || (d.raw.optionQuery ? `${d.raw.id}-options` : void 0),
|
|
1341
|
+
suggestedComponentName: me(d.raw.label || d.raw.id || d.name),
|
|
1376
1342
|
marker: {
|
|
1377
1343
|
attribute: "data-semaphor-input-id",
|
|
1378
|
-
value:
|
|
1344
|
+
value: d.raw.id
|
|
1379
1345
|
}
|
|
1380
1346
|
})
|
|
1381
1347
|
];
|
|
1382
|
-
})),
|
|
1383
|
-
var
|
|
1348
|
+
})), O = Object.fromEntries(e.views.map((d) => {
|
|
1349
|
+
var p, m, i;
|
|
1384
1350
|
return [
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
viewId:
|
|
1388
|
-
viewTitle: ((
|
|
1389
|
-
visualType: (
|
|
1390
|
-
title: ((i =
|
|
1351
|
+
d.name,
|
|
1352
|
+
N({
|
|
1353
|
+
viewId: d.raw.id,
|
|
1354
|
+
viewTitle: ((p = d.raw.visualSpec) == null ? void 0 : p.title) || d.raw.title,
|
|
1355
|
+
visualType: (m = d.raw.visualSpec) == null ? void 0 : m.visualType,
|
|
1356
|
+
title: ((i = d.raw.visualSpec) == null ? void 0 : i.title) || d.raw.title
|
|
1391
1357
|
})
|
|
1392
1358
|
];
|
|
1393
1359
|
}));
|
|
1394
|
-
return `${
|
|
1360
|
+
return `${v}
|
|
1395
1361
|
export const generatedViewIds = ${k(t)} as const;
|
|
1396
1362
|
export const generatedQueryViewIds = ${k(o)} as const;
|
|
1397
1363
|
export const generatedInputIds = ${k(a)} as const;
|
|
1398
|
-
export const generatedInputOptionQueryIds = ${k(
|
|
1364
|
+
export const generatedInputOptionQueryIds = ${k(u)} as const;
|
|
1399
1365
|
export const generatedViewAuthoring = ${k(f)} as const;
|
|
1400
|
-
export const generatedInputAuthoring = ${k(
|
|
1366
|
+
export const generatedInputAuthoring = ${k(y)} as const;
|
|
1401
1367
|
|
|
1402
1368
|
export type SemaphorGeneratedViewId = typeof generatedViewIds[number];
|
|
1403
1369
|
export type SemaphorGeneratedQueryViewId = typeof generatedQueryViewIds[number];
|
|
@@ -1416,7 +1382,7 @@ export type SemaphorGeneratedFilterContract = {
|
|
|
1416
1382
|
readonly [key: string]: unknown;
|
|
1417
1383
|
};
|
|
1418
1384
|
|
|
1419
|
-
export const generatedInputIdsForView = ${k(
|
|
1385
|
+
export const generatedInputIdsForView = ${k(c)} as const;
|
|
1420
1386
|
export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${k(e.filterContracts)} as const;
|
|
1421
1387
|
|
|
1422
1388
|
export function semaphorViewMarkerProps(viewId: SemaphorGeneratedViewId) {
|
|
@@ -1437,7 +1403,7 @@ export function filterContractsForView(viewId: SemaphorGeneratedQueryViewId) {
|
|
|
1437
1403
|
);
|
|
1438
1404
|
}
|
|
1439
1405
|
|
|
1440
|
-
export const queryDebugForView = ${k(
|
|
1406
|
+
export const queryDebugForView = ${k(O)} as const;
|
|
1441
1407
|
|
|
1442
1408
|
export const semaphorGeneratedContractMetadata = ${k({
|
|
1443
1409
|
schemaVersion: "semaphor-generated-data-app-contract/v1",
|
|
@@ -1448,17 +1414,17 @@ export const semaphorGeneratedContractMetadata = ${k({
|
|
|
1448
1414
|
generatedViewIds: t,
|
|
1449
1415
|
generatedQueryViewIds: o,
|
|
1450
1416
|
generatedInputIds: a,
|
|
1451
|
-
generatedInputOptionQueryIds:
|
|
1452
|
-
generatedInputIdsForView:
|
|
1417
|
+
generatedInputOptionQueryIds: u,
|
|
1418
|
+
generatedInputIdsForView: c,
|
|
1453
1419
|
generatedViewAuthoring: f,
|
|
1454
|
-
generatedInputAuthoring:
|
|
1455
|
-
visualSpecs:
|
|
1420
|
+
generatedInputAuthoring: y,
|
|
1421
|
+
visualSpecs: S,
|
|
1456
1422
|
presentationViews: e.presentationViews
|
|
1457
1423
|
})} as const;
|
|
1458
1424
|
`;
|
|
1459
1425
|
}
|
|
1460
|
-
function
|
|
1461
|
-
return `${
|
|
1426
|
+
function Xe() {
|
|
1427
|
+
return `${v}
|
|
1462
1428
|
export * from "./sources";
|
|
1463
1429
|
export * from "./fields";
|
|
1464
1430
|
export * from "./inputs";
|
|
@@ -1468,48 +1434,42 @@ export * from "./accessors";
|
|
|
1468
1434
|
export * from "./metadata";
|
|
1469
1435
|
`;
|
|
1470
1436
|
}
|
|
1471
|
-
function
|
|
1437
|
+
function B(e, n) {
|
|
1472
1438
|
if (!(!n || typeof n != "object")) {
|
|
1473
1439
|
if (Array.isArray(n)) {
|
|
1474
|
-
for (const r of n)
|
|
1440
|
+
for (const r of n) B(e, r);
|
|
1475
1441
|
return;
|
|
1476
1442
|
}
|
|
1477
|
-
|
|
1443
|
+
x(n) && w(e, Y(n));
|
|
1478
1444
|
for (const r of Object.values(n))
|
|
1479
|
-
|
|
1445
|
+
B(e, r);
|
|
1480
1446
|
}
|
|
1481
1447
|
}
|
|
1482
1448
|
function D(e, n) {
|
|
1483
1449
|
const r = [];
|
|
1484
|
-
if (
|
|
1450
|
+
if (on(r, e.raw.sdkSpec), r.length === 0)
|
|
1485
1451
|
for (const o of e.raw.fields || [])
|
|
1486
|
-
|
|
1452
|
+
w(r, o);
|
|
1487
1453
|
const t = X(
|
|
1488
|
-
r.filter((o) => o.name &&
|
|
1454
|
+
r.filter((o) => o.name && R(o, n)).map((o) => ({ raw: o, key: Z(o), name: "" })),
|
|
1489
1455
|
(o) => o.key
|
|
1490
1456
|
);
|
|
1491
|
-
return
|
|
1492
|
-
t,
|
|
1493
|
-
(o) => q(o.raw.label || o.raw.name || "field")
|
|
1494
|
-
), t;
|
|
1457
|
+
return ge(t, n, "field"), t;
|
|
1495
1458
|
}
|
|
1496
|
-
function
|
|
1497
|
-
if (
|
|
1459
|
+
function Q(e, n) {
|
|
1460
|
+
if (q(e.raw.sdkSpec.builder) !== "metric")
|
|
1498
1461
|
return [];
|
|
1499
|
-
const r =
|
|
1500
|
-
|
|
1501
|
-
for (const a of
|
|
1502
|
-
|
|
1462
|
+
const r = F(e.raw.sdkSpec.spec), t = [];
|
|
1463
|
+
w(t, r == null ? void 0 : r.primaryMeasure);
|
|
1464
|
+
for (const a of H(r == null ? void 0 : r.measures))
|
|
1465
|
+
w(t, a);
|
|
1503
1466
|
const o = X(
|
|
1504
|
-
t.filter((a) => a.name &&
|
|
1467
|
+
t.filter((a) => a.name && R(a, n)).map((a) => ({ raw: a, key: Z(a), name: "" })),
|
|
1505
1468
|
(a) => a.key
|
|
1506
1469
|
);
|
|
1507
|
-
return
|
|
1508
|
-
o,
|
|
1509
|
-
(a) => q(a.raw.label || a.raw.name || "metric")
|
|
1510
|
-
), o;
|
|
1470
|
+
return ge(o, n, "metric"), o;
|
|
1511
1471
|
}
|
|
1512
|
-
function
|
|
1472
|
+
function en(e, n, r) {
|
|
1513
1473
|
var o;
|
|
1514
1474
|
const t = (o = e.raw.metricBindingKeys) == null ? void 0 : o[r];
|
|
1515
1475
|
if (typeof t == "string" && t.trim())
|
|
@@ -1518,93 +1478,91 @@ function Xe(e, n, r) {
|
|
|
1518
1478
|
`views.${e.raw.id}.metricBindingKeys must include a binding key for metric field ${n.raw.name}.`
|
|
1519
1479
|
);
|
|
1520
1480
|
}
|
|
1521
|
-
function
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
for (const r of e)
|
|
1533
|
-
for (const t of new Set(he(r.raw)))
|
|
1534
|
-
n.set(t, (n.get(t) || 0) + 1);
|
|
1535
|
-
return new Set(
|
|
1536
|
-
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1537
|
-
);
|
|
1481
|
+
function ge(e, n, r) {
|
|
1482
|
+
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1483
|
+
for (const u of e) {
|
|
1484
|
+
const c = K(u.raw.name || u.raw.label || r) || r;
|
|
1485
|
+
t.set(u.key, c), o.set(c, (o.get(c) || 0) + 1);
|
|
1486
|
+
}
|
|
1487
|
+
const a = /* @__PURE__ */ new Set();
|
|
1488
|
+
for (const u of e) {
|
|
1489
|
+
const c = t.get(u.key) || r, S = R(u.raw, n) || c, f = o.get(c) === 1 ? c : S;
|
|
1490
|
+
u.name = nn(f, u.key, a);
|
|
1491
|
+
}
|
|
1538
1492
|
}
|
|
1539
|
-
function
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1493
|
+
function nn(e, n, r) {
|
|
1494
|
+
const t = tn(e) ? e : K(e || "field") || "field";
|
|
1495
|
+
if (!r.has(t))
|
|
1496
|
+
return r.add(t), t;
|
|
1497
|
+
const o = rn(n), a = `${t}${o}`;
|
|
1498
|
+
if (!r.has(a))
|
|
1499
|
+
return r.add(a), a;
|
|
1500
|
+
let u = 2;
|
|
1501
|
+
for (; r.has(`${a}${u}`); )
|
|
1502
|
+
u += 1;
|
|
1503
|
+
const c = `${a}${u}`;
|
|
1504
|
+
return r.add(c), c;
|
|
1548
1505
|
}
|
|
1549
1506
|
function rn(e) {
|
|
1550
|
-
|
|
1551
|
-
for (
|
|
1552
|
-
n
|
|
1553
|
-
return
|
|
1554
|
-
Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
|
|
1555
|
-
);
|
|
1507
|
+
let n = 0;
|
|
1508
|
+
for (let r = 0; r < e.length; r += 1)
|
|
1509
|
+
n = n * 31 + e.charCodeAt(r) >>> 0;
|
|
1510
|
+
return n.toString(36).slice(0, 6).replace(/^[0-9]/, "x$&");
|
|
1556
1511
|
}
|
|
1557
|
-
function tn(e
|
|
1558
|
-
|
|
1512
|
+
function tn(e) {
|
|
1513
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e);
|
|
1514
|
+
}
|
|
1515
|
+
function on(e, n) {
|
|
1516
|
+
const r = F(n.spec);
|
|
1559
1517
|
if (!r)
|
|
1560
1518
|
return;
|
|
1561
|
-
const t =
|
|
1519
|
+
const t = q(n.builder);
|
|
1562
1520
|
if (t === "records") {
|
|
1563
|
-
for (const o of
|
|
1521
|
+
for (const o of H(r.fields)) w(e, o);
|
|
1564
1522
|
return;
|
|
1565
1523
|
}
|
|
1566
1524
|
if (t === "sql") {
|
|
1567
|
-
for (const o of
|
|
1525
|
+
for (const o of H(r.fields)) w(e, o);
|
|
1568
1526
|
return;
|
|
1569
1527
|
}
|
|
1570
1528
|
if (t === "analysis" || t === "metric") {
|
|
1571
|
-
|
|
1572
|
-
for (const o of
|
|
1573
|
-
for (const o of
|
|
1574
|
-
|
|
1529
|
+
w(e, r.primaryMeasure);
|
|
1530
|
+
for (const o of H(r.measures)) w(e, o);
|
|
1531
|
+
for (const o of H(r.dimensions)) w(e, o);
|
|
1532
|
+
w(e, r.dateField);
|
|
1575
1533
|
return;
|
|
1576
1534
|
}
|
|
1577
1535
|
if (t === "matrix") {
|
|
1578
|
-
const o = pe(r.rows), a = pe(r.columns),
|
|
1579
|
-
for (const
|
|
1580
|
-
for (const
|
|
1581
|
-
for (const
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1536
|
+
const o = pe(r.rows), a = pe(r.columns), u = H(r.values);
|
|
1537
|
+
for (const c of o) le(e, c);
|
|
1538
|
+
for (const c of a) le(e, c);
|
|
1539
|
+
for (const c of u) {
|
|
1540
|
+
const S = F(c);
|
|
1541
|
+
w(e, S == null ? void 0 : S.field), w(e, S == null ? void 0 : S.measure);
|
|
1584
1542
|
}
|
|
1585
1543
|
}
|
|
1586
1544
|
}
|
|
1587
1545
|
function pe(e) {
|
|
1588
1546
|
if (Array.isArray(e))
|
|
1589
1547
|
return e;
|
|
1590
|
-
const n =
|
|
1548
|
+
const n = F(e);
|
|
1591
1549
|
return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
|
|
1592
1550
|
}
|
|
1593
1551
|
function le(e, n) {
|
|
1594
1552
|
var r;
|
|
1595
|
-
if (
|
|
1596
|
-
|
|
1553
|
+
if (x(n)) {
|
|
1554
|
+
w(e, n);
|
|
1597
1555
|
return;
|
|
1598
1556
|
}
|
|
1599
|
-
|
|
1557
|
+
w(e, (r = F(n)) == null ? void 0 : r.field);
|
|
1600
1558
|
}
|
|
1601
1559
|
function ce(e) {
|
|
1602
1560
|
var n, r, t, o;
|
|
1603
1561
|
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";
|
|
1604
1562
|
}
|
|
1605
|
-
function
|
|
1606
|
-
const n =
|
|
1607
|
-
return
|
|
1563
|
+
function sn(e) {
|
|
1564
|
+
const n = F(e) || {};
|
|
1565
|
+
return N({
|
|
1608
1566
|
id: e.id,
|
|
1609
1567
|
title: e.title,
|
|
1610
1568
|
purpose: e.purpose,
|
|
@@ -1618,10 +1576,10 @@ function on(e) {
|
|
|
1618
1576
|
description: n.description
|
|
1619
1577
|
});
|
|
1620
1578
|
}
|
|
1621
|
-
function
|
|
1622
|
-
|
|
1579
|
+
function w(e, n) {
|
|
1580
|
+
x(n) && e.push(Y(n));
|
|
1623
1581
|
}
|
|
1624
|
-
function
|
|
1582
|
+
function Y(e) {
|
|
1625
1583
|
return {
|
|
1626
1584
|
name: e.name,
|
|
1627
1585
|
label: e.label,
|
|
@@ -1632,7 +1590,7 @@ function U(e) {
|
|
|
1632
1590
|
...e.source ? { source: e.source } : {}
|
|
1633
1591
|
};
|
|
1634
1592
|
}
|
|
1635
|
-
function
|
|
1593
|
+
function an(e) {
|
|
1636
1594
|
if (!e.source)
|
|
1637
1595
|
return;
|
|
1638
1596
|
const n = {
|
|
@@ -1647,48 +1605,48 @@ function sn(e) {
|
|
|
1647
1605
|
name: ""
|
|
1648
1606
|
};
|
|
1649
1607
|
}
|
|
1650
|
-
function
|
|
1651
|
-
const n =
|
|
1608
|
+
function x(e) {
|
|
1609
|
+
const n = F(e);
|
|
1652
1610
|
return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
|
|
1653
1611
|
}
|
|
1654
1612
|
function we(e) {
|
|
1655
|
-
const n =
|
|
1613
|
+
const n = F(e);
|
|
1656
1614
|
return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
|
|
1657
1615
|
}
|
|
1658
|
-
function
|
|
1616
|
+
function G(e, n) {
|
|
1659
1617
|
if (e === void 0)
|
|
1660
1618
|
return "undefined";
|
|
1661
1619
|
if (e === null || typeof e == "number" || typeof e == "boolean" || typeof e == "string")
|
|
1662
1620
|
return JSON.stringify(e);
|
|
1663
1621
|
if (Array.isArray(e))
|
|
1664
|
-
return `[${e.map((o) =>
|
|
1665
|
-
if (
|
|
1666
|
-
const o =
|
|
1622
|
+
return `[${e.map((o) => G(o, n)).join(", ")}]`;
|
|
1623
|
+
if (x(e)) {
|
|
1624
|
+
const o = R(Y(e), n);
|
|
1667
1625
|
if (o) return `fields.${o}`;
|
|
1668
1626
|
}
|
|
1669
1627
|
if (we(e)) {
|
|
1670
1628
|
const o = Se(e, n);
|
|
1671
1629
|
if (o) return `sources.${o}`;
|
|
1672
1630
|
}
|
|
1673
|
-
const r =
|
|
1674
|
-
return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, a]) => `${JSON.stringify(o)}: ${
|
|
1631
|
+
const r = F(e);
|
|
1632
|
+
return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, a]) => `${JSON.stringify(o)}: ${G(a, n)}`).join(", ")} }` : JSON.stringify(e);
|
|
1675
1633
|
}
|
|
1676
1634
|
function k(e) {
|
|
1677
1635
|
return JSON.stringify(e, null, 2);
|
|
1678
1636
|
}
|
|
1679
|
-
function
|
|
1680
|
-
if (
|
|
1681
|
-
return n.fieldNameByKey.get(
|
|
1637
|
+
function R(e, n) {
|
|
1638
|
+
if (x(e))
|
|
1639
|
+
return n.fieldNameByKey.get(Z(Y(e)));
|
|
1682
1640
|
}
|
|
1683
1641
|
function Se(e, n) {
|
|
1684
1642
|
if (we(e))
|
|
1685
|
-
for (const r of
|
|
1643
|
+
for (const r of W(e)) {
|
|
1686
1644
|
const t = n.sourceNameByKey.get(r);
|
|
1687
1645
|
if (t)
|
|
1688
1646
|
return t;
|
|
1689
1647
|
}
|
|
1690
1648
|
}
|
|
1691
|
-
function
|
|
1649
|
+
function Z(e) {
|
|
1692
1650
|
return [
|
|
1693
1651
|
e.sourceKey || "",
|
|
1694
1652
|
e.name || "",
|
|
@@ -1696,29 +1654,29 @@ function L(e) {
|
|
|
1696
1654
|
e.aggregate || ""
|
|
1697
1655
|
].join("|");
|
|
1698
1656
|
}
|
|
1699
|
-
function
|
|
1700
|
-
return !
|
|
1657
|
+
function un(e, n) {
|
|
1658
|
+
return !x(e) || !x(n) || e.name !== n.name ? !1 : ie(e).some(
|
|
1701
1659
|
(r) => ie(n).includes(r)
|
|
1702
1660
|
);
|
|
1703
1661
|
}
|
|
1704
|
-
function un(e) {
|
|
1705
|
-
return C(e) && e.role === "id";
|
|
1706
|
-
}
|
|
1707
1662
|
function dn(e) {
|
|
1663
|
+
return x(e) && e.role === "id";
|
|
1664
|
+
}
|
|
1665
|
+
function pn(e) {
|
|
1708
1666
|
const n = [], r = /* @__PURE__ */ new Map();
|
|
1709
1667
|
for (const t of e) {
|
|
1710
|
-
const o = _(t.aliases.length ? t.aliases : [t.key]), a = o.map((
|
|
1668
|
+
const o = _(t.aliases.length ? t.aliases : [t.key]), a = o.map((u) => r.get(u)).find(E);
|
|
1711
1669
|
if (a) {
|
|
1712
1670
|
a.aliases = _([...a.aliases, ...o]);
|
|
1713
1671
|
continue;
|
|
1714
1672
|
}
|
|
1715
1673
|
t.aliases = o, n.push(t);
|
|
1716
|
-
for (const
|
|
1717
|
-
r.set(
|
|
1674
|
+
for (const u of o)
|
|
1675
|
+
r.set(u, t);
|
|
1718
1676
|
}
|
|
1719
1677
|
return n;
|
|
1720
1678
|
}
|
|
1721
|
-
function
|
|
1679
|
+
function ln(e) {
|
|
1722
1680
|
const n = /* @__PURE__ */ new Map();
|
|
1723
1681
|
for (const r of e)
|
|
1724
1682
|
for (const t of _([r.key, ...r.aliases])) {
|
|
@@ -1733,10 +1691,10 @@ function _(e) {
|
|
|
1733
1691
|
return Array.from(new Set(e.filter(Boolean)));
|
|
1734
1692
|
}
|
|
1735
1693
|
function $e(e) {
|
|
1736
|
-
return
|
|
1694
|
+
return W(e)[0] || de(e);
|
|
1737
1695
|
}
|
|
1738
|
-
function
|
|
1739
|
-
const n =
|
|
1696
|
+
function W(e) {
|
|
1697
|
+
const n = F(e);
|
|
1740
1698
|
if (!n)
|
|
1741
1699
|
return [];
|
|
1742
1700
|
const r = [];
|
|
@@ -1747,36 +1705,36 @@ function Z(e) {
|
|
|
1747
1705
|
return r.length === 0 && r.push(de(e)), _(r);
|
|
1748
1706
|
}
|
|
1749
1707
|
function Ie(e) {
|
|
1750
|
-
return
|
|
1708
|
+
return W(e);
|
|
1751
1709
|
}
|
|
1752
1710
|
function de(e) {
|
|
1753
|
-
const n =
|
|
1711
|
+
const n = F(e);
|
|
1754
1712
|
return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
|
|
1755
1713
|
}
|
|
1756
|
-
function
|
|
1757
|
-
return
|
|
1714
|
+
function cn(e) {
|
|
1715
|
+
return x(e) && ie(e)[0] || "";
|
|
1758
1716
|
}
|
|
1759
1717
|
function ie(e) {
|
|
1760
|
-
return
|
|
1718
|
+
return x(e) ? _([
|
|
1761
1719
|
...typeof e.sourceKey == "string" ? [e.sourceKey] : [],
|
|
1762
|
-
...e.source ?
|
|
1720
|
+
...e.source ? W(e.source) : []
|
|
1763
1721
|
]) : [];
|
|
1764
1722
|
}
|
|
1765
|
-
function
|
|
1723
|
+
function q(e) {
|
|
1766
1724
|
const n = String(e || "").replace(/^semaphor\./, "");
|
|
1767
1725
|
if (!["metric", "records", "analysis", "matrix", "sql"].includes(n))
|
|
1768
1726
|
throw new Error(`Unsupported sdkSpec builder: ${e}`);
|
|
1769
1727
|
return n;
|
|
1770
1728
|
}
|
|
1771
|
-
function
|
|
1772
|
-
const n =
|
|
1729
|
+
function mn(e) {
|
|
1730
|
+
const n = q(e);
|
|
1773
1731
|
return n === "records" || n === "sql";
|
|
1774
1732
|
}
|
|
1775
|
-
function
|
|
1776
|
-
const n =
|
|
1733
|
+
function fn(e) {
|
|
1734
|
+
const n = F(e);
|
|
1777
1735
|
return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
|
|
1778
1736
|
}
|
|
1779
|
-
function
|
|
1737
|
+
function P(e, n) {
|
|
1780
1738
|
const r = /* @__PURE__ */ new Map();
|
|
1781
1739
|
for (const t of e) {
|
|
1782
1740
|
const o = n(t) || "item", a = r.get(o) || 0;
|
|
@@ -1791,7 +1749,7 @@ function X(e, n) {
|
|
|
1791
1749
|
}
|
|
1792
1750
|
return t;
|
|
1793
1751
|
}
|
|
1794
|
-
function
|
|
1752
|
+
function K(e) {
|
|
1795
1753
|
const n = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
1796
1754
|
if (n.length === 0)
|
|
1797
1755
|
return "item";
|
|
@@ -1802,47 +1760,47 @@ function q(e) {
|
|
|
1802
1760
|
return /^[A-Za-z_$]/.test(o) ? o : `item${o}`;
|
|
1803
1761
|
}
|
|
1804
1762
|
function me(e) {
|
|
1805
|
-
const n =
|
|
1763
|
+
const n = K(e);
|
|
1806
1764
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
1807
1765
|
}
|
|
1808
|
-
function
|
|
1766
|
+
function yn(e) {
|
|
1809
1767
|
const n = String(e).split(":");
|
|
1810
1768
|
return n[n.length - 1] || String(e);
|
|
1811
1769
|
}
|
|
1812
|
-
function
|
|
1770
|
+
function N(e) {
|
|
1813
1771
|
return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
|
|
1814
1772
|
}
|
|
1815
|
-
function
|
|
1773
|
+
function F(e) {
|
|
1816
1774
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1817
1775
|
}
|
|
1818
|
-
function
|
|
1776
|
+
function H(e) {
|
|
1819
1777
|
return Array.isArray(e) ? e : [];
|
|
1820
1778
|
}
|
|
1821
|
-
function
|
|
1779
|
+
function J(e) {
|
|
1822
1780
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
1823
1781
|
}
|
|
1824
|
-
function
|
|
1782
|
+
function E(e) {
|
|
1825
1783
|
return e !== void 0;
|
|
1826
1784
|
}
|
|
1827
1785
|
export {
|
|
1828
|
-
|
|
1786
|
+
Mn as CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1829
1787
|
Re as CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1830
1788
|
Me as CONTRACT_MANIFEST_SCHEMA_VERSION,
|
|
1831
|
-
|
|
1789
|
+
wn as DEFAULT_GENERATED_CONTRACT_OUTPUT_DIR,
|
|
1832
1790
|
fe as GENERATED_CONTRACT_SCHEMA_VERSION,
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1791
|
+
Cn as GENERATED_CONTRACT_TYPESCRIPT_FILES,
|
|
1792
|
+
On as REQUIRED_GENERATED_CONTRACT_FILES,
|
|
1793
|
+
Vn as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
|
|
1836
1794
|
Fn as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
|
|
1837
1795
|
ke as assertValidCodegenSummary,
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1796
|
+
xn as buildSemaphorGeneratedActiveInput,
|
|
1797
|
+
Gn as buildSemaphorGeneratedInputOptionIntent,
|
|
1798
|
+
Nn as buildSemaphorGeneratedViewExecutionRequest,
|
|
1799
|
+
En as buildSemaphorGeneratedViewExecutionRequests,
|
|
1800
|
+
An as evaluateSemaphorDataAppContractUpdatePolicy,
|
|
1801
|
+
Sn as generateSemaphorDataAppContract,
|
|
1844
1802
|
bn as isSemaphorDataAppCodegenSummary,
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1803
|
+
jn as validateCodegenSummary,
|
|
1804
|
+
kn as validateSemaphorDataAppCodegenSummary,
|
|
1805
|
+
vn as validateSemaphorGeneratedContract
|
|
1848
1806
|
};
|