react-semaphor 0.1.419 → 0.1.421

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.
Files changed (57) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +28 -27
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +2 -2
  5. package/dist/chunks/analyze-result-contract-B5Eeu7vD.js +1 -0
  6. package/dist/chunks/analyze-result-contract-sWcmvBOA.js +2070 -0
  7. package/dist/chunks/{calendar-preferences-dialog-f0Z7Kf-U.js → calendar-preferences-dialog-CscmhyuZ.js} +1 -1
  8. package/dist/chunks/{calendar-preferences-dialog-DIfAbE_y.js → calendar-preferences-dialog-cN3_2C-u.js} +3 -3
  9. package/dist/chunks/{dashboard-briefing-launcher-anh-Jy5v.js → dashboard-briefing-launcher-BYTBNetR.js} +4 -4
  10. package/dist/chunks/{dashboard-briefing-launcher-C3tNkGFG.js → dashboard-briefing-launcher-DmZkzIC3.js} +1 -1
  11. package/dist/chunks/{dashboard-controls-DQxlOxzy.js → dashboard-controls-9DFeKIP4.js} +1 -1
  12. package/dist/chunks/{dashboard-controls-8dCQaPaq.js → dashboard-controls-PhzuaTBj.js} +5 -5
  13. package/dist/chunks/{dashboard-json-i7Ae9KGD.js → dashboard-json-Cxhw2TZc.js} +3 -3
  14. package/dist/chunks/{dashboard-json-B309EInF.js → dashboard-json-DyRHI3mL.js} +1 -1
  15. package/dist/chunks/{edit-dashboard-visual-4HycwBHR.js → edit-dashboard-visual-3_jiBXsu.js} +1 -1
  16. package/dist/chunks/{edit-dashboard-visual-z3IqzYnj.js → edit-dashboard-visual-BigSJ3-x.js} +4 -4
  17. package/dist/chunks/{index-yxKWKFdr.js → index-BKDQw0aK.js} +2 -2
  18. package/dist/chunks/{index-B6DLEXRX.js → index-CH2ZzQo4.js} +5 -5
  19. package/dist/chunks/{switch-D6Ygf3wA.js → switch-CiOjVyVI.js} +1 -1
  20. package/dist/chunks/{switch-COWQU8aK.js → switch-TbCsyhv9.js} +1 -1
  21. package/dist/chunks/{update-policy-BzT2k4n6.js → update-policy-2MZ-Vf7v.js} +211 -187
  22. package/dist/chunks/update-policy-qpyAkOyO.js +3 -0
  23. package/dist/chunks/{use-create-flow-overlay-state-CX0D-6HM.js → use-create-flow-overlay-state-BzcJWNzh.js} +3 -3
  24. package/dist/chunks/{use-create-flow-overlay-state-DENfd7sW.js → use-create-flow-overlay-state-DUQmgb9H.js} +1 -1
  25. package/dist/chunks/{validators-Cxr9qbrR.js → validators-D0pfj3jJ.js} +93 -93
  26. package/dist/chunks/validators-Dj1Y-46V.js +1 -0
  27. package/dist/dashboard/index.cjs +1 -1
  28. package/dist/dashboard/index.js +1 -1
  29. package/dist/dashboard-authoring/index.cjs +1 -1
  30. package/dist/dashboard-authoring/index.js +14 -14
  31. package/dist/data-app-builder/index.cjs +1 -1
  32. package/dist/data-app-builder/index.js +2 -2
  33. package/dist/data-app-codegen/index.cjs +1 -1
  34. package/dist/data-app-codegen/index.js +2 -2
  35. package/dist/data-app-codegen-node/index.cjs +251 -139
  36. package/dist/data-app-codegen-node/index.js +806 -657
  37. package/dist/data-app-sdk/index.cjs +2 -2
  38. package/dist/data-app-sdk/index.js +743 -693
  39. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  40. package/dist/data-app-sdk-adapters/index.js +51 -51
  41. package/dist/data-app-sdk-validation/index.cjs +1 -1
  42. package/dist/data-app-sdk-validation/index.js +2 -2
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +7 -7
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +12 -5
  48. package/dist/types/dashboard-assistant.d.ts +0 -5
  49. package/dist/types/data-app-codegen-node.d.ts +12 -2
  50. package/dist/types/data-app-codegen.d.ts +12 -2
  51. package/dist/types/data-app-sdk-validation.d.ts +0 -5
  52. package/dist/types/data-app-sdk.d.ts +17 -5
  53. package/package.json +1 -1
  54. package/dist/chunks/analyze-result-contract-DdhEt99q.js +0 -2004
  55. package/dist/chunks/analyze-result-contract-DwRzl7yJ.js +0 -1
  56. package/dist/chunks/update-policy-VloD-0YM.js +0 -3
  57. package/dist/chunks/validators-BMQo93Y0.js +0 -1
@@ -1,69 +1,70 @@
1
- import { S as In, a as Fn, i as bn, v as Vn } from "../chunks/analyze-result-contract-DdhEt99q.js";
2
- import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-BzT2k4n6.js";
3
- import { C as Rn, e as Mn, R as xn, f as Nn, g as Cn, h as On, i as Gn, j as Kn, v as En, d as An } from "../chunks/update-policy-BzT2k4n6.js";
1
+ import { b as ke } from "../chunks/analyze-result-contract-sWcmvBOA.js";
2
+ import { S as Vr, a as br, i as kr, v as Mr } from "../chunks/analyze-result-contract-sWcmvBOA.js";
3
+ import { c as Me, G as fe, a as Re, b as xe } from "../chunks/update-policy-2MZ-Vf7v.js";
4
+ import { C as xr, e as Nr, R as Cr, f as Gr, g as Or, h as vr, i as Kr, j as Er, v as Ar, d as jr } from "../chunks/update-policy-2MZ-Vf7v.js";
4
5
  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
+ const Sr = "src/semaphor/generated", A = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
6
7
  // Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
7
8
  `;
8
- function wn(e, n = {}) {
9
- ke(e);
10
- const r = xe(e);
11
- if (r.views.length === 0 && !n.allowEmpty)
9
+ function $r(e, r = {}) {
10
+ Me(e);
11
+ const n = Ne(e);
12
+ if (n.views.length === 0 && !r.allowEmpty)
12
13
  throw new Error(
13
14
  "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
15
  );
15
- const t = Ce(r), o = Oe({
16
- contract: r,
16
+ const t = Ge(n), o = Oe({
17
+ contract: n,
17
18
  files: t,
18
- generatorName: n.generatorName || "react-semaphor/data-app-codegen/node",
19
- generatorVersion: n.generatorVersion || "unknown"
20
- }), a = {
19
+ generatorName: r.generatorName || "react-semaphor/data-app-codegen/node",
20
+ generatorVersion: r.generatorVersion || "unknown"
21
+ }), i = {
21
22
  ...t,
22
23
  "contract.manifest.json": `${JSON.stringify(o, null, 2)}
23
24
  `
24
25
  };
25
26
  return {
26
27
  schemaVersion: fe,
27
- files: a,
28
+ files: i,
28
29
  manifest: o,
29
30
  contentHash: String(o.generatedContentHash || ""),
30
- usageExample: Ee(r),
31
- warnings: r.warnings,
31
+ usageExample: Ae(n),
32
+ warnings: n.warnings,
32
33
  stats: {
33
- inputCount: r.inputs.length,
34
- executableViewCount: r.views.length,
35
- presentationViewCount: r.presentationViews.length,
36
- queryCount: r.views.length,
37
- optionQueryCount: r.optionQueries.length
34
+ inputCount: n.inputs.length,
35
+ executableViewCount: n.views.length,
36
+ presentationViewCount: n.presentationViews.length,
37
+ queryCount: n.views.length,
38
+ optionQueryCount: n.optionQueries.length
38
39
  }
39
40
  };
40
41
  }
41
- function xe(e) {
42
- var u, d, c, i, p, S, g, $, F, R, b, M;
43
- const n = [], r = [];
42
+ function Ne(e) {
43
+ var u, d, p, $, a, g, h, y, I, V, b, M;
44
+ const r = [], n = [];
44
45
  for (const s of e.inputs) {
45
- h(r, s.fieldRef);
46
- for (const I of s.bindings || [])
47
- h(r, I.fieldRef);
48
- h(r, (u = s.optionQuery) == null ? void 0 : u.valueFieldRef), h(r, (d = s.optionQuery) == null ? void 0 : d.labelFieldRef), h(r, (c = s.optionQuery) == null ? void 0 : c.filterFieldRef), Q(r, (i = s.optionQuery) == null ? void 0 : i.spec);
46
+ w(n, s.fieldRef);
47
+ for (const S of s.bindings || [])
48
+ w(n, S.fieldRef);
49
+ w(n, (u = s.optionQuery) == null ? void 0 : u.valueFieldRef), w(n, (d = s.optionQuery) == null ? void 0 : d.labelFieldRef), w(n, (p = s.optionQuery) == null ? void 0 : p.filterFieldRef), Q(n, ($ = s.optionQuery) == null ? void 0 : $.spec);
49
50
  }
50
51
  for (const s of e.filterContracts) {
51
- h(r, s.fieldRef), h(r, (p = s.optionQuery) == null ? void 0 : p.valueFieldRef), h(r, (S = s.optionQuery) == null ? void 0 : S.labelFieldRef), h(r, (g = s.optionQuery) == null ? void 0 : g.filterFieldRef), Q(r, ($ = s.optionQuery) == null ? void 0 : $.spec);
52
- for (const I of s.bindings || [])
53
- h(r, I.fieldRef);
52
+ w(n, s.fieldRef), w(n, (a = s.optionQuery) == null ? void 0 : a.valueFieldRef), w(n, (g = s.optionQuery) == null ? void 0 : g.labelFieldRef), w(n, (h = s.optionQuery) == null ? void 0 : h.filterFieldRef), Q(n, (y = s.optionQuery) == null ? void 0 : y.spec);
53
+ for (const S of s.bindings || [])
54
+ w(n, S.fieldRef);
54
55
  }
55
56
  for (const s of e.views) {
56
- for (const I of s.fields || [])
57
- h(r, I);
58
- Q(r, (F = s.sdkSpec) == null ? void 0 : F.spec), Q(r, s.visualSpec);
57
+ for (const S of s.fields || [])
58
+ w(n, S);
59
+ Q(n, (I = s.sdkSpec) == null ? void 0 : I.spec), Q(n, s.visualSpec);
59
60
  }
60
61
  const t = e.implementationChecklist || {};
61
62
  for (const s of Object.values(t.bindingsByView || {}))
62
- for (const I of Array.isArray(s) ? s : [])
63
- h(r, I.fieldRef), h(r, I.optionValueField), h(r, I.optionLabelField);
63
+ for (const S of Array.isArray(s) ? s : [])
64
+ w(n, S.fieldRef), w(n, S.optionValueField), w(n, S.optionLabelField);
64
65
  for (const s of t.requiredInputOptions || [])
65
- h(r, s.visibleLabelField), h(r, s.optionValueField), h(r, s.runtimeFilterField);
66
- const o = dn(
66
+ w(n, s.visibleLabelField), w(n, s.optionValueField), w(n, s.runtimeFilterField);
67
+ const o = lr(
67
68
  [
68
69
  ...e.sources.map((s) => ({
69
70
  raw: s,
@@ -71,153 +72,186 @@ function xe(e) {
71
72
  aliases: Ie(s),
72
73
  name: ""
73
74
  })),
74
- ...r.map((s) => sn(s)).filter(K)
75
+ ...n.map((s) => ir(s)).filter(v)
75
76
  ]
76
77
  );
77
- v(o, (s) => {
78
- const I = V(s.raw);
78
+ j(o, (s) => {
79
+ const S = k(s.raw);
79
80
  return q(
80
- s.raw.label || (I == null ? void 0 : I.datasetName) || (I == null ? void 0 : I.datasetId) || (I == null ? void 0 : I.name) || s.raw.kind || "source"
81
+ s.raw.label || (S == null ? void 0 : S.datasetName) || (S == null ? void 0 : S.datasetId) || (S == null ? void 0 : S.name) || s.raw.kind || "source"
81
82
  );
82
83
  });
83
- const a = pn(o), l = X(
84
- r.filter((s) => s.name).map((s) => ({
84
+ const i = pr(o), l = X(
85
+ n.filter((s) => s.name).map((s) => ({
85
86
  raw: s,
86
- key: L(s),
87
+ key: J(s),
87
88
  name: ""
88
89
  })),
89
90
  (s) => s.key
90
91
  );
91
- v(
92
+ j(
92
93
  l,
93
94
  (s) => q([
94
- s.raw.sourceKey ? fn(s.raw.sourceKey) : "",
95
+ s.raw.sourceKey ? yr(s.raw.sourceKey) : "",
95
96
  s.raw.aggregate ? s.raw.aggregate.toLowerCase() : "",
96
97
  s.raw.name
97
98
  ].filter(Boolean).join("_"))
98
99
  );
99
- const y = new Map(l.map((s) => [s.key, s.name])), w = e.inputs.map((s) => ({
100
+ const f = new Map(l.map((s) => [s.key, s.name])), F = e.inputs.map((s) => ({
100
101
  raw: s,
101
102
  name: q(s.id || s.label || "input")
102
103
  }));
103
- v(w, (s) => s.name);
104
- const f = w.filter((s) => !!s.raw.optionQuery).map((s) => ({
104
+ j(F, (s) => s.name);
105
+ const m = F.filter((s) => !!s.raw.optionQuery).map((s) => ({
105
106
  input: s,
106
107
  name: `${s.name}Options`,
107
108
  raw: s.raw.optionQuery
108
109
  }));
109
- v(f, (s) => s.name);
110
- for (const s of f)
111
- an(s.raw.labelFieldRef, s.raw.valueFieldRef) && un(s.raw.valueFieldRef) && n.push(
112
- `Input option query ${((R = s.raw.spec) == null ? void 0 : R.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.`
110
+ j(m, (s) => s.name);
111
+ for (const s of m)
112
+ ur(s.raw.labelFieldRef, s.raw.valueFieldRef) && dr(s.raw.valueFieldRef) && r.push(
113
+ `Input option query ${((V = s.raw.spec) == null ? void 0 : V.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
114
  );
114
- const m = e.views.filter(
115
+ const c = e.views.filter(
115
116
  (s) => {
116
- var I, T;
117
- return !!((I = s.sdkSpec) != null && I.builder && ((T = s.sdkSpec) != null && T.spec));
117
+ var S, P;
118
+ return !!((S = s.sdkSpec) != null && S.builder && ((P = s.sdkSpec) != null && P.spec));
118
119
  }
119
120
  ).map((s) => ({
120
121
  raw: s,
121
122
  name: q(s.id || s.title || "query")
122
123
  }));
123
- v(m, (s) => s.name);
124
- const N = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => on(s));
124
+ j(c, (s) => s.name);
125
+ const N = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => ar(s));
125
126
  for (const s of e.views)
126
- (!("sdkSpec" in s) || !((b = s.sdkSpec) != null && b.builder) || !((M = s.sdkSpec) != null && M.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
127
- return Ne({
128
- inputs: w,
129
- views: m,
127
+ (!("sdkSpec" in s) || !((b = s.sdkSpec) != null && b.builder) || !((M = s.sdkSpec) != null && M.spec)) && !ce(s) && r.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
128
+ return Ce({
129
+ inputs: F,
130
+ views: c,
130
131
  filterContracts: e.filterContracts
131
132
  }), {
132
133
  summary: e,
133
134
  title: e.title || "Semaphor Data App",
134
135
  sources: o,
135
136
  fields: l,
136
- inputs: w,
137
- optionQueries: f,
138
- views: m,
137
+ inputs: F,
138
+ optionQueries: m,
139
+ views: c,
139
140
  presentationViews: N,
140
141
  filterContracts: e.filterContracts,
141
142
  checklist: t,
142
- sourceNameByKey: a,
143
- fieldNameByKey: y,
144
- warnings: n
143
+ sourceNameByKey: i,
144
+ fieldNameByKey: f,
145
+ warnings: r
145
146
  };
146
147
  }
147
- function Ne({
148
+ function Ce({
148
149
  inputs: e,
149
- views: n,
150
- filterContracts: r
150
+ views: r,
151
+ filterContracts: n
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, l] of r.entries()) {
153
+ const t = new Set(e.map((i) => i.raw.id).filter(Boolean)), o = new Set(r.map((i) => i.raw.id).filter(Boolean));
154
+ for (const [i, l] of n.entries()) {
154
155
  if (!t.has(l.inputId))
155
- throw new Error(`filterContracts.${a}.inputId must reference a generated input.`);
156
- const y = new Set(l.appliesToViewIds || []), w = new Set(l.notAppliedToViewIds || []);
157
- for (const [f, m] of (l.appliesToViewIds || []).entries())
158
- if (!o.has(m))
156
+ throw new Error(`filterContracts.${i}.inputId must reference a generated input.`);
157
+ const f = new Set(l.appliesToViewIds || []), F = new Set(l.notAppliedToViewIds || []);
158
+ for (const [m, c] of (l.appliesToViewIds || []).entries())
159
+ if (!o.has(c))
159
160
  throw new Error(
160
- `filterContracts.${a}.appliesToViewIds.${f} must reference an executable generated view.`
161
+ `filterContracts.${i}.appliesToViewIds.${m} must reference an executable generated view.`
161
162
  );
162
- for (const [f, m] of (l.notAppliedToViewIds || []).entries())
163
- if (!o.has(m))
163
+ for (const [m, c] of (l.notAppliedToViewIds || []).entries())
164
+ if (!o.has(c))
164
165
  throw new Error(
165
- `filterContracts.${a}.notAppliedToViewIds.${f} must reference an executable generated view.`
166
+ `filterContracts.${i}.notAppliedToViewIds.${m} must reference an executable generated view.`
166
167
  );
167
- for (const [f, m] of (l.bindings || []).entries()) {
168
- if (!o.has(m.viewId))
168
+ for (const [m, c] of (l.bindings || []).entries()) {
169
+ if (!o.has(c.viewId))
169
170
  throw new Error(
170
- `filterContracts.${a}.bindings.${f}.viewId must reference an executable generated view.`
171
+ `filterContracts.${i}.bindings.${m}.viewId must reference an executable generated view.`
171
172
  );
172
- if (!y.has(m.viewId))
173
+ if (!f.has(c.viewId))
173
174
  throw new Error(
174
- `filterContracts.${a}.bindings.${f}.viewId must be included in appliesToViewIds.`
175
+ `filterContracts.${i}.bindings.${m}.viewId must be included in appliesToViewIds.`
175
176
  );
176
- if (w.has(m.viewId))
177
+ if (F.has(c.viewId))
177
178
  throw new Error(
178
- `filterContracts.${a}.bindings.${f}.viewId must not be listed in notAppliedToViewIds.`
179
+ `filterContracts.${i}.bindings.${m}.viewId must not be listed in notAppliedToViewIds.`
179
180
  );
180
181
  }
181
182
  }
182
183
  }
183
- function Ce(e) {
184
+ function Ge(e) {
184
185
  return {
185
- "sources.ts": ve(e),
186
- "fields.ts": qe(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()
186
+ "sources.ts": qe(e),
187
+ "fields.ts": Pe(e),
188
+ "inputs.ts": Qe(e),
189
+ "queries.ts": De(e),
190
+ "bindings.ts": ze(e),
191
+ "accessors.ts": We(e),
192
+ "metadata.ts": Xe(e),
193
+ "index.ts": er(),
194
+ "USAGE.md": Ke(e)
193
195
  };
194
196
  }
195
197
  function Oe({
196
198
  contract: e,
197
- files: n,
198
- generatorName: r,
199
+ files: r,
200
+ generatorName: n,
199
201
  generatorVersion: t
200
202
  }) {
201
203
  return {
202
- schemaVersion: Me,
204
+ schemaVersion: xe,
203
205
  generatedContractSchemaVersion: fe,
204
206
  generator: {
205
- name: r,
207
+ name: n,
206
208
  version: t
207
209
  },
208
- generatedContentHash: Ge(n),
210
+ generatedContentHash: ve(r),
209
211
  codegenSummaryValidatorVersion: Re,
210
- codegenSummaryHash: Ke(e.summary),
212
+ codegenSummaryHash: Ee(e.summary),
211
213
  codegenSummary: e.summary
212
214
  };
213
215
  }
214
- function Ge(e) {
215
- const n = ye("sha256");
216
- for (const r of Object.keys(e).sort())
217
- n.update(r), n.update("\0"), n.update(e[r]), n.update("\0");
218
- return `sha256:${n.digest("hex")}`;
216
+ function ve(e) {
217
+ const r = ye("sha256");
218
+ for (const n of Object.keys(e).filter(
219
+ (t) => t.endsWith(".ts")
220
+ ).sort())
221
+ r.update(n), r.update("\0"), r.update(e[n]), r.update("\0");
222
+ return `sha256:${r.digest("hex")}`;
219
223
  }
220
224
  function Ke(e) {
225
+ const r = [
226
+ "# Semaphor Generated Data App Contract",
227
+ "",
228
+ "Generated files in this directory are governed Semaphor analytics wiring. Do not hand-edit them.",
229
+ "",
230
+ "Use the app-facing exports from `index.ts`:",
231
+ "",
232
+ "- `queries`: generated governed query factories.",
233
+ "- `queryOptionsForView`: active-input wiring for each generated view.",
234
+ "- `rowsForView`: table/records row readers.",
235
+ "- `rowValuesForView`: friendly row object readers for chart/table views.",
236
+ "- `metricValuesForView`: friendly metric-value readers.",
237
+ "- `kpiPropsForView`: KPI component props derived from runtime metric results.",
238
+ "- `roleValuesForView`: canonical dimension/measure/date/id role readers.",
239
+ "- `appInputSpecs`: generated input/filter specs.",
240
+ "- `inputOptionQueries`: option-list query factories for generated inputs.",
241
+ "- `semaphorGeneratedContractMetadata`: generated view/input metadata and presentation-only views.",
242
+ "",
243
+ "Start with these exports before opening large generated internals such as `metadata.ts`.",
244
+ ""
245
+ ];
246
+ return e.views.length > 0 && (r.push("Generated executable views:"), e.views.forEach((n) => {
247
+ r.push(`- \`${n.raw.id}\`: ${n.raw.title || n.name}`);
248
+ }), r.push("")), e.inputs.length > 0 && (r.push("Generated inputs:"), e.inputs.forEach((n) => {
249
+ r.push(`- \`${n.raw.id}\`: ${n.raw.label || n.name}`);
250
+ }), r.push("")), `${r.join(`
251
+ `)}
252
+ `;
253
+ }
254
+ function Ee(e) {
221
255
  return `sha256:${ye("sha256").update(ae(e)).digest("hex")}`;
222
256
  }
223
257
  function ae(e) {
@@ -225,44 +259,44 @@ function ae(e) {
225
259
  return JSON.stringify(e);
226
260
  if (Array.isArray(e))
227
261
  return `[${e.map((t) => ae(t)).join(",")}]`;
228
- const n = e;
229
- return `{${Object.keys(n).sort().filter((t) => n[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(n[t])}`).join(",")}}`;
262
+ const r = e;
263
+ return `{${Object.keys(r).sort().filter((t) => r[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(r[t])}`).join(",")}}`;
230
264
  }
231
- function Ee(e) {
232
- const n = e.views.find(
233
- (f) => E(f) && A(f)
265
+ function Ae(e) {
266
+ const r = e.views.find(
267
+ (m) => K(m) && E(m)
234
268
  );
235
- if (n)
269
+ if (r)
236
270
  return [
237
271
  'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, recordsSortOptionsForView, rowsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
238
272
  "const handles = useSemaphorInputs(appInputSpecs);",
239
273
  "const inputHandles = createInputHandleMap(handles);",
240
- `const sortOption = recordsSortOptionsForView.${n.name}[0];`,
274
+ `const sortOption = recordsSortOptionsForView.${r.name}[0];`,
241
275
  'const sort = sortOption ? { key: sortOption.key, direction: "asc" as const } : undefined;',
242
- `const query = queries.${n.name}({ page, pageSize, sort });`,
243
- `const result = useSemaphorQuery(query, queryOptionsForView.${n.name}(inputHandles));`,
244
- `const rows = rowsForView.${n.name}(result);`,
276
+ `const query = queries.${r.name}({ page, pageSize, sort });`,
277
+ `const result = useSemaphorQuery(query, queryOptionsForView.${r.name}(inputHandles));`,
278
+ `const rows = rowsForView.${r.name}(result);`,
245
279
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
246
280
  ].join(`
247
281
  `);
248
- const r = e.views.find(
249
- (f) => E(f)
282
+ const n = e.views.find(
283
+ (m) => K(m)
250
284
  );
251
- if (r)
285
+ if (n)
252
286
  return [
253
287
  'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, recordsSortOptionsForView, rowsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
254
288
  "const handles = useSemaphorInputs(appInputSpecs);",
255
289
  "const inputHandles = createInputHandleMap(handles);",
256
- `const sortOption = recordsSortOptionsForView.${r.name}[0];`,
290
+ `const sortOption = recordsSortOptionsForView.${n.name}[0];`,
257
291
  'const sort = sortOption ? { key: sortOption.key, direction: "asc" as const } : undefined;',
258
- `const query = queries.${r.name}({ sort });`,
259
- `const result = useSemaphorQuery(query, queryOptionsForView.${r.name}(inputHandles));`,
260
- `const rows = rowsForView.${r.name}(result);`,
292
+ `const query = queries.${n.name}({ sort });`,
293
+ `const result = useSemaphorQuery(query, queryOptionsForView.${n.name}(inputHandles));`,
294
+ `const rows = rowsForView.${n.name}(result);`,
261
295
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
262
296
  ].join(`
263
297
  `);
264
298
  const t = e.views.find(
265
- (f) => W(f) && A(f)
299
+ (m) => W(m) && E(m)
266
300
  );
267
301
  if (t)
268
302
  return [
@@ -276,7 +310,7 @@ function Ee(e) {
276
310
  ].join(`
277
311
  `);
278
312
  const o = e.views.find(
279
- (f) => ue(f) && A(f)
313
+ (m) => ue(m) && E(m)
280
314
  );
281
315
  if (o)
282
316
  return [
@@ -289,206 +323,206 @@ function Ee(e) {
289
323
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
290
324
  ].join(`
291
325
  `);
292
- const a = e.views.find((f) => {
293
- var m;
294
- return cn((m = f.raw.sdkSpec) == null ? void 0 : m.builder);
326
+ const i = e.views.find((m) => {
327
+ var c;
328
+ return mr((c = m.raw.sdkSpec) == null ? void 0 : c.builder);
295
329
  });
296
- if (a)
330
+ if (i)
297
331
  return [
298
332
  'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, rowsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
299
333
  "const handles = useSemaphorInputs(appInputSpecs);",
300
334
  "const inputHandles = createInputHandleMap(handles);",
301
- `const result = useSemaphorQuery(queries.${a.name}(), queryOptionsForView.${a.name}(inputHandles));`,
302
- `const rows = rowsForView.${a.name}(result);`,
335
+ `const result = useSemaphorQuery(queries.${i.name}(), queryOptionsForView.${i.name}(inputHandles));`,
336
+ `const rows = rowsForView.${i.name}(result);`,
303
337
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
304
338
  ].join(`
305
339
  `);
306
- const l = e.views.find((f) => Ae(f));
340
+ const l = e.views.find((m) => je(m));
307
341
  if (l)
308
342
  return [
309
- 'import { appInputSpecs, createInputHandleMap, metricValuesForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
343
+ 'import { appInputSpecs, createInputHandleMap, kpiPropsForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
310
344
  "const handles = useSemaphorInputs(appInputSpecs);",
311
345
  "const inputHandles = createInputHandleMap(handles);",
312
346
  `const result = useSemaphorQuery(queries.${l.name}(), queryOptionsForView.${l.name}(inputHandles));`,
313
- `const metrics = metricValuesForView.${l.name}(result);`,
347
+ `const kpiProps = kpiPropsForView.${l.name}(result);`,
314
348
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
315
349
  ].join(`
316
350
  `);
317
- const y = e.views[0];
351
+ const f = e.views[0];
318
352
  return [
319
353
  'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
320
354
  "const handles = useSemaphorInputs(appInputSpecs);",
321
355
  "const inputHandles = createInputHandleMap(handles);",
322
- y ? `const result = useSemaphorQuery(queries.${y.name}(), queryOptionsForView.${y.name}(inputHandles));` : "const result = undefined;",
356
+ f ? `const result = useSemaphorQuery(queries.${f.name}(), queryOptionsForView.${f.name}(inputHandles));` : "const result = undefined;",
323
357
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
324
358
  ].join(`
325
359
  `);
326
360
  }
327
361
  function W(e) {
328
- var n;
329
- return B((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
362
+ var r;
363
+ return B((r = e.raw.sdkSpec) == null ? void 0 : r.builder) === "records";
330
364
  }
331
- function Ae(e) {
332
- var n;
333
- return B((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
365
+ function je(e) {
366
+ var r;
367
+ return B((r = e.raw.sdkSpec) == null ? void 0 : r.builder) === "metric";
334
368
  }
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";
369
+ function K(e) {
370
+ var r, n, t;
371
+ return W(e) && ((t = (n = (r = e.raw.visualSpec) == null ? void 0 : r.tableBehavior) == null ? void 0 : n.sorting) == null ? void 0 : t.mode) === "server";
338
372
  }
339
373
  function ue(e) {
340
- var n;
341
- return B((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
374
+ var r;
375
+ return B((r = e.raw.sdkSpec) == null ? void 0 : r.builder) === "sql";
342
376
  }
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";
377
+ function E(e) {
378
+ var r, n, t;
379
+ return ((t = (n = (r = e.raw.visualSpec) == null ? void 0 : r.tableBehavior) == null ? void 0 : n.pagination) == null ? void 0 : t.mode) === "server";
346
380
  }
347
381
  function He(e) {
348
- return W(e) && (A(e) || E(e)) || ue(e) && A(e);
382
+ return W(e) && (E(e) || K(e)) || ue(e) && E(e);
349
383
  }
350
- function ve(e) {
351
- const n = e.sources.map(({ name: t, raw: o }) => {
352
- const a = je(o);
353
- return ` ${t}: ${a},`;
384
+ function qe(e) {
385
+ const r = e.sources.map(({ name: t, raw: o }) => {
386
+ const i = Be(o);
387
+ return ` ${t}: ${i},`;
354
388
  }).join(`
355
- `), r = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
389
+ `), n = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
356
390
 
357
391
  ` : "";
358
- return `${H}
359
- ${r}export const sources = {
360
- ${n}
392
+ return `${A}
393
+ ${n}export const sources = {
394
+ ${r}
361
395
  } as const;
362
396
  `;
363
397
  }
364
- function je(e) {
398
+ function Be(e) {
365
399
  if (e.kind === "semantic") {
366
- const n = {
400
+ const r = {
367
401
  domainId: e.domainId,
368
402
  datasetId: e.datasetId,
369
403
  datasetName: e.datasetName,
370
404
  label: e.label
371
405
  };
372
- return `semaphor.source.semantic(${k(G(n))})`;
406
+ return `semaphor.source.semantic(${R(O(r))})`;
373
407
  }
374
- return `${k(G({ ...e, sourceKey: void 0 }))} as const`;
408
+ return `${R(O({ ...e, sourceKey: void 0 }))} as const`;
375
409
  }
376
- function qe(e) {
377
- const n = e.fields.map(({ name: t, raw: o }) => {
378
- const a = Be(o, e);
379
- return ` ${t}: ${a},`;
410
+ function Pe(e) {
411
+ const r = e.fields.map(({ name: t, raw: o }) => {
412
+ const i = Te(o, e);
413
+ return ` ${t}: ${i},`;
380
414
  }).join(`
381
- `), r = n.includes("sources.") ? `import { sources } from "./sources";
415
+ `), n = r.includes("sources.") ? `import { sources } from "./sources";
382
416
 
383
417
  ` : "";
384
- return `${H}
385
- ${r}export const fields = {
386
- ${n}
418
+ return `${A}
419
+ ${n}export const fields = {
420
+ ${r}
387
421
  } as const;
388
422
  `;
389
423
  }
390
- function Be(e, n) {
391
- const r = {
424
+ function Te(e, r) {
425
+ const n = {
392
426
  name: e.name,
393
427
  label: e.label,
394
428
  role: e.role,
395
429
  dataType: e.dataType,
396
430
  aggregate: e.aggregate
397
- }, t = ln(e), o = t ? n.sourceNameByKey.get(t) : void 0;
431
+ }, t = cr(e), o = t ? r.sourceNameByKey.get(t) : void 0;
398
432
  if (t && !o)
399
433
  throw new Error(
400
434
  `Field ${e.name} references source ${t}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
401
435
  );
402
- const a = Object.entries(G(r)).map(([l, y]) => `${JSON.stringify(l)}: ${O(y, n)}`);
403
- return o && a.push(`"source": sources.${o}`), `{ ${a.join(", ")} }`;
404
- }
405
- function Te(e) {
406
- const n = e.inputs.map((c) => {
407
- const i = x(c.raw.fieldRef, e), p = [
408
- `id: ${JSON.stringify(c.raw.id)}`,
409
- `label: ${JSON.stringify(c.raw.label || c.raw.id)}`,
410
- `operator: ${JSON.stringify(mn(c.raw))}`
436
+ const i = Object.entries(O(n)).map(([l, f]) => `${JSON.stringify(l)}: ${G(f, r)}`);
437
+ return o && i.push(`"source": sources.${o}`), `{ ${i.join(", ")} }`;
438
+ }
439
+ function Qe(e) {
440
+ const r = e.inputs.map((p) => {
441
+ const $ = x(p.raw.fieldRef, e), a = [
442
+ `id: ${JSON.stringify(p.raw.id)}`,
443
+ `label: ${JSON.stringify(p.raw.label || p.raw.id)}`,
444
+ `operator: ${JSON.stringify(fr(p.raw))}`
411
445
  ];
412
- if (i && p.push(`field: fields.${i}`), c.raw.relationshipHint && p.push(`relationshipHint: ${k(c.raw.relationshipHint)}`), !i)
413
- throw new Error(`Input ${c.raw.id || c.name} is missing a generated field reference.`);
414
- return ` ${c.name}: semaphor.filter({ ${p.join(", ")} }),`;
446
+ if ($ && a.push(`field: fields.${$}`), p.raw.relationshipHint && a.push(`relationshipHint: ${R(p.raw.relationshipHint)}`), !$)
447
+ throw new Error(`Input ${p.raw.id || p.name} is missing a generated field reference.`);
448
+ return ` ${p.name}: semaphor.filter({ ${a.join(", ")} }),`;
415
449
  }).join(`
416
- `), r = e.inputs.map((c) => `filterSpecs.${c.name}`).join(", "), t = e.inputs.map((c) => JSON.stringify(c.raw.id)).join(", "), o = e.optionQueries.map((c) => {
417
- const i = c.input.raw, p = c.raw, S = V(p.spec) || {}, {
418
- id: g,
419
- inputId: $,
420
- source: F,
421
- sourceKey: R,
450
+ `), n = e.inputs.map((p) => `filterSpecs.${p.name}`).join(", "), t = e.inputs.map((p) => JSON.stringify(p.raw.id)).join(", "), o = e.optionQueries.map((p) => {
451
+ const $ = p.input.raw, a = p.raw, g = k(a.spec) || {}, {
452
+ id: h,
453
+ inputId: y,
454
+ source: I,
455
+ sourceKey: V,
422
456
  valueField: b,
423
457
  labelField: M,
424
458
  population: s,
425
- dependencies: I,
426
- limit: T,
459
+ dependencies: S,
460
+ limit: P,
427
461
  ...ee
428
- } = S, J = p.sourceKey ? { sourceKey: p.sourceKey } : p.source || F || (typeof R == "string" ? { sourceKey: R } : void 0), ne = Se(J, e), re = x(p.valueFieldRef, e), te = x(p.labelFieldRef, e), oe = ge(c), se = {
462
+ } = g, L = a.sourceKey ? { sourceKey: a.sourceKey } : a.source || I || (typeof V == "string" ? { sourceKey: V } : void 0), re = Se(L, e), ne = x(a.valueFieldRef, e), te = x(a.labelFieldRef, e), oe = ge(p), se = {
429
463
  ...ee,
430
- id: p.id || S.id || `${i.id}-options`,
431
- inputId: i.id,
432
- source: J,
433
- valueField: p.valueFieldRef,
434
- labelField: p.labelFieldRef,
435
- population: p.population || s,
464
+ id: a.id || g.id || `${$.id}-options`,
465
+ inputId: $.id,
466
+ source: L,
467
+ valueField: a.valueFieldRef,
468
+ labelField: a.labelFieldRef,
469
+ population: a.population || s,
436
470
  dependencies: oe,
437
- limit: p.limit || T || 100
471
+ limit: a.limit || P || 100
438
472
  };
439
- if (!ne || !re || !te)
440
- throw new Error(`Input option query ${p.id || `${i.id}-options`} is missing source, valueField, or labelField.`);
441
- const Fe = Object.entries(G(se)).map(([be, Ve]) => `${JSON.stringify(be)}: ${O(Ve, e)}`);
442
- return ` ${c.name}: semaphor.inputOptions({ ${Fe.join(", ")} }),`;
473
+ if (!re || !ne || !te)
474
+ throw new Error(`Input option query ${a.id || `${$.id}-options`} is missing source, valueField, or labelField.`);
475
+ const Fe = Object.entries(O(se)).map(([Ve, be]) => `${JSON.stringify(Ve)}: ${G(be, e)}`);
476
+ return ` ${p.name}: semaphor.inputOptions({ ${Fe.join(", ")} }),`;
443
477
  }).join(`
444
- `), a = e.optionQueries.map((c) => {
445
- const i = Qe(e, c), p = i.length > 0 ? "inputHandles" : "_inputHandles", S = i.map((g) => {
446
- const $ = x(g.raw.fieldRef, e);
447
- if (!$)
478
+ `), i = e.optionQueries.map((p) => {
479
+ const $ = _e(e, p), a = $.length > 0 ? "inputHandles" : "_inputHandles", g = $.map((h) => {
480
+ const y = x(h.raw.fieldRef, e);
481
+ if (!y)
448
482
  throw new Error(
449
- `Input option query ${c.raw.id || `${c.input.raw.id}-options`} references input ${g.raw.id} without a generated field reference.`
483
+ `Input option query ${p.raw.id || `${p.input.raw.id}-options`} references input ${h.raw.id} without a generated field reference.`
450
484
  );
451
- const F = `inputHandles[${JSON.stringify(g.raw.id)}]`;
452
- return ` if (${F}) {
453
- inputs.push(semaphor.bindInput(${F}, { field: fields.${$} }));
485
+ const I = `inputHandles[${JSON.stringify(h.raw.id)}]`;
486
+ return ` if (${I}) {
487
+ inputs.push(semaphor.bindInput(${I}, { field: fields.${y} }));
454
488
  }`;
455
489
  }).join(`
456
490
  `);
457
- return ` ${c.name}(${p}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
491
+ return ` ${p.name}(${a}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
458
492
  const inputs: SemaphorInputReference[] = [];
459
- ${S}
493
+ ${g}
460
494
  return inputs;
461
495
  },`;
462
496
  }).join(`
463
497
 
464
- `), l = e.optionQueries.map((c) => ` ${c.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
498
+ `), l = e.optionQueries.map((p) => ` ${p.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
465
499
  return {
466
- inputs: inputsForInputOptionQuery.${c.name}(inputHandles),
500
+ inputs: inputsForInputOptionQuery.${p.name}(inputHandles),
467
501
  };
468
502
  },`).join(`
469
503
 
470
- `), y = e.optionQueries.map((c) => ` case ${JSON.stringify(c.raw.id || `${c.input.raw.id}-options`)}:
471
- return queryOptionsForInputOptionQuery.${c.name}(inputHandles);`).join(`
472
- `), w = e.inputs.length > 0, f = e.optionQueries.length > 0, m = f ? "inputOptionQueryId" : "_inputOptionQueryId", N = f ? "inputHandles" : "_inputHandles", u = [
504
+ `), f = e.optionQueries.map((p) => ` case ${JSON.stringify(p.raw.id || `${p.input.raw.id}-options`)}:
505
+ return queryOptionsForInputOptionQuery.${p.name}(inputHandles);`).join(`
506
+ `), F = e.inputs.length > 0, m = e.optionQueries.length > 0, c = m ? "inputOptionQueryId" : "_inputOptionQueryId", N = m ? "inputHandles" : "_inputHandles", u = [
473
507
  "SemaphorInputHandle",
474
- f ? "SemaphorInputReference" : void 0,
508
+ m ? "SemaphorInputReference" : void 0,
475
509
  "SemaphorQueryRuntimeOptions"
476
- ].filter(K).join(", "), d = [
477
- w || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
510
+ ].filter(v).join(", "), d = [
511
+ F || m ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
478
512
  `import type { ${u} } from "react-semaphor/data-app-sdk";`,
479
- w || f ? 'import { fields } from "./fields";' : void 0,
480
- f ? 'import { sources } from "./sources";' : void 0,
513
+ F || m ? 'import { fields } from "./fields";' : void 0,
514
+ m ? 'import { sources } from "./sources";' : void 0,
481
515
  'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
482
- ].filter(K).join(`
516
+ ].filter(v).join(`
483
517
  `);
484
- return `${H}
518
+ return `${A}
485
519
  ${d}
486
520
 
487
521
  export const filterSpecs = {
488
- ${n}
522
+ ${r}
489
523
  } as const;
490
524
 
491
- export const appInputSpecs = [${r}] as const;
525
+ export const appInputSpecs = [${n}] as const;
492
526
  export const appInputIds = [${t}] as const;
493
527
 
494
528
  export type SemaphorGeneratedInputHandleMap = Partial<Record<SemaphorGeneratedInputId, SemaphorInputHandle>>;
@@ -502,7 +536,7 @@ ${o}
502
536
  } as const;
503
537
 
504
538
  export const inputsForInputOptionQuery = {
505
- ${a}
539
+ ${i}
506
540
  } as const;
507
541
 
508
542
  export const queryOptionsForInputOptionQuery = {
@@ -510,100 +544,100 @@ ${l}
510
544
  } as const;
511
545
 
512
546
  export function queryOptionsForInputOptionQueryId(
513
- ${m}: SemaphorGeneratedInputOptionQueryId,
547
+ ${c}: SemaphorGeneratedInputOptionQueryId,
514
548
  ${N}: SemaphorGeneratedInputHandleMap,
515
549
  ): SemaphorQueryRuntimeOptions {
516
- switch (${m}) {
517
- ${y}
550
+ switch (${c}) {
551
+ ${f}
518
552
  }
519
- throw new Error(\`Unknown generated Semaphor input option query id: \${${m}}\`);
553
+ throw new Error(\`Unknown generated Semaphor input option query id: \${${c}}\`);
520
554
  }
521
555
  `;
522
556
  }
523
- function Qe(e, n) {
524
- const r = ge(n);
525
- if (!r || r.mode === "independent")
557
+ function _e(e, r) {
558
+ const n = ge(r);
559
+ if (!n || n.mode === "independent")
526
560
  return [];
527
- if (r.mode !== "explicit")
561
+ if (n.mode !== "explicit")
528
562
  return [];
529
- const t = new Set(r.includeInputIds || []), o = /* @__PURE__ */ new Set([
530
- n.input.raw.id,
531
- ...r.excludeInputIds || []
563
+ const t = new Set(n.includeInputIds || []), o = /* @__PURE__ */ new Set([
564
+ r.input.raw.id,
565
+ ...n.excludeInputIds || []
532
566
  ]);
533
- return e.inputs.filter((a) => o.has(a.raw.id) ? !1 : t.has(a.raw.id));
567
+ return e.inputs.filter((i) => o.has(i.raw.id) ? !1 : t.has(i.raw.id));
534
568
  }
535
569
  function ge(e) {
536
- var n;
537
- return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
570
+ var r;
571
+ return e.raw.dependencies || ((r = e.raw.spec) == null ? void 0 : r.dependencies);
538
572
  }
539
- function _e(e) {
540
- const n = e.views.map((d) => {
541
- var p, S, g, $, F, R;
542
- const c = B(d.raw.sdkSpec.builder), i = Pe(d);
573
+ function De(e) {
574
+ const r = e.views.map((d) => {
575
+ var a, g, h, y, I, V;
576
+ const p = B(d.raw.sdkSpec.builder), $ = Ue(d);
543
577
  if (W(d) && He(d)) {
544
- const b = (p = d.raw.visualSpec) == null ? void 0 : p.tableBehavior, M = V(i.pagination), s = A(d), I = E(d), T = ((S = b == null ? void 0 : b.pagination) == null ? void 0 : S.pageSize) || z(M == null ? void 0 : M.pageSize) || z(i.limit) || 100, ee = I ? Y(d, e) : [], J = I ? De({
578
+ const b = (a = d.raw.visualSpec) == null ? void 0 : a.tableBehavior, M = k($.pagination), s = E(d), S = K(d), P = ((g = b == null ? void 0 : b.pagination) == null ? void 0 : g.pageSize) || z(M == null ? void 0 : M.pageSize) || z($.limit) || 100, ee = S ? Y(d, e) : [], L = S ? Je({
545
579
  view: d,
546
580
  contract: e,
547
581
  sortFields: ee,
548
- defaultField: (g = b == null ? void 0 : b.sorting) == null ? void 0 : g.defaultField
549
- }) : void 0, ne = I ? ($ = b == null ? void 0 : b.sorting) == null ? void 0 : $.defaultDirection : void 0, re = Ue({
582
+ defaultField: (h = b == null ? void 0 : b.sorting) == null ? void 0 : h.defaultField
583
+ }) : void 0, re = S ? (y = b == null ? void 0 : b.sorting) == null ? void 0 : y.defaultDirection : void 0, ne = Le({
550
584
  viewName: d.name,
551
585
  supportsPagination: s,
552
- supportsSort: I
553
- }), te = I ? ` const orderBy = resolveRecordsOrderBy(
586
+ supportsSort: S
587
+ }), te = S ? ` const orderBy = resolveRecordsOrderBy(
554
588
  recordsSortFieldsForView.${d.name},
555
589
  params.sort,
556
- ${O(J, e)},
557
- ${O(ne, e)},
590
+ ${G(L, e)},
591
+ ${G(re, e)},
558
592
  );
559
- ` : "", oe = I ? ` ...(orderBy ? { orderBy } : {}),
560
- ` : "", se = s ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(T)}),
593
+ ` : "", oe = S ? ` ...(orderBy ? { orderBy } : {}),
594
+ ` : "", se = s ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(P)}),
561
595
  ` : "";
562
596
  return ` ${d.name}(
563
- params: ${re} = {},
597
+ params: ${ne} = {},
564
598
  ) {
565
- ${te} return semaphor.${c}({
566
- ...${O(i, e)},
599
+ ${te} return semaphor.${p}({
600
+ ...${G($, e)},
567
601
  ${oe}${se} });
568
602
  },`;
569
603
  }
570
- if (ue(d) && A(d)) {
571
- const b = (F = d.raw.visualSpec) == null ? void 0 : F.tableBehavior, M = V(i.pagination), s = ((R = b == null ? void 0 : b.pagination) == null ? void 0 : R.pageSize) || z(M == null ? void 0 : M.pageSize) || z(i.limit) || 100;
604
+ if (ue(d) && E(d)) {
605
+ const b = (I = d.raw.visualSpec) == null ? void 0 : I.tableBehavior, M = k($.pagination), s = ((V = b == null ? void 0 : b.pagination) == null ? void 0 : V.pageSize) || z(M == null ? void 0 : M.pageSize) || z($.limit) || 100;
572
606
  return ` ${d.name}(
573
607
  params: SemaphorGeneratedServerPaginationParams = {},
574
608
  ) {
575
- return semaphor.${c}({
576
- ...${O(i, e)},
609
+ return semaphor.${p}({
610
+ ...${G($, e)},
577
611
  pagination: resolveServerTablePagination(params, ${JSON.stringify(s)}),
578
612
  });
579
613
  },`;
580
614
  }
581
- return ` ${d.name}: () => semaphor.${c}(${O(i, e)}),`;
615
+ return ` ${d.name}: () => semaphor.${p}(${G($, e)}),`;
582
616
  }).join(`
583
- `), r = e.views.filter((d) => E(d)).map((d) => {
584
- const i = Y(d, e).map((p) => ` ${JSON.stringify(p.key)}: fields.${p.fieldName},`).join(`
617
+ `), n = e.views.filter((d) => K(d)).map((d) => {
618
+ const $ = Y(d, e).map((a) => ` ${JSON.stringify(a.key)}: fields.${a.fieldName},`).join(`
585
619
  `);
586
620
  return ` ${d.name}: {
587
- ${i}
621
+ ${$}
588
622
  },`;
589
623
  }).join(`
590
- `), t = e.views.filter((d) => E(d)).map((d) => {
591
- const i = Y(d, e).map((p) => ` { key: ${JSON.stringify(p.key)}, label: ${JSON.stringify(p.label)}, field: fields.${p.fieldName} },`).join(`
624
+ `), t = e.views.filter((d) => K(d)).map((d) => {
625
+ const $ = Y(d, e).map((a) => ` { key: ${JSON.stringify(a.key)}, label: ${JSON.stringify(a.label)}, field: fields.${a.fieldName} },`).join(`
592
626
  `);
593
627
  return ` ${d.name}: [
594
- ${i}
628
+ ${$}
595
629
  ],`;
596
630
  }).join(`
597
- `), o = e.views.some((d) => E(d)), a = e.views.some((d) => A(d)), l = [n, r, t].join(`
598
- `), y = [
599
- n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
631
+ `), o = e.views.some((d) => K(d)), i = e.views.some((d) => E(d)), l = [r, n, t].join(`
632
+ `), f = [
633
+ r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
600
634
  o ? 'import type { SemaphorFieldRef } from "react-semaphor/data-app-sdk";' : void 0,
601
635
  l.includes("fields.") ? 'import { fields } from "./fields";' : void 0,
602
636
  l.includes("sources.") ? 'import { sources } from "./sources";' : void 0
603
- ].filter(K).join(`
637
+ ].filter(v).join(`
604
638
  `);
605
- return `${H}
606
- ${y}
639
+ return `${A}
640
+ ${f}
607
641
  ${o ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
608
642
 
609
643
  export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
@@ -614,17 +648,17 @@ export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
614
648
  export type SemaphorGeneratedRecordsSortParams<TSortKey extends string = string> = {
615
649
  sort?: SemaphorGeneratedRecordsSort<TSortKey> | null;
616
650
  };
617
- ` : ""}${a ? `export type SemaphorGeneratedServerPaginationParams = {
651
+ ` : ""}${i ? `export type SemaphorGeneratedServerPaginationParams = {
618
652
  page?: number;
619
653
  pageSize?: number;
620
654
  };
621
- ` : ""}${o && a ? `export type SemaphorGeneratedRecordsQueryParams<TSortKey extends string = string> =
655
+ ` : ""}${o && i ? `export type SemaphorGeneratedRecordsQueryParams<TSortKey extends string = string> =
622
656
  SemaphorGeneratedServerPaginationParams &
623
657
  SemaphorGeneratedRecordsSortParams<TSortKey>;
624
658
  ` : ""}
625
659
 
626
660
  export const recordsSortFieldsForView = {
627
- ${r}
661
+ ${n}
628
662
  } as const;
629
663
 
630
664
  export const recordsSortOptionsForView = {
@@ -632,7 +666,7 @@ ${t}
632
666
  } as const;
633
667
 
634
668
  export const queries = {
635
- ${n}
669
+ ${r}
636
670
  } as const;
637
671
 
638
672
  ${o ? `function resolveRecordsOrderBy<TSortKey extends string>(
@@ -655,7 +689,7 @@ ${o ? `function resolveRecordsOrderBy<TSortKey extends string>(
655
689
  };
656
690
  }
657
691
  ` : ""}
658
- ${a ? `function resolveServerTablePagination(
692
+ ${i ? `function resolveServerTablePagination(
659
693
  params: SemaphorGeneratedServerPaginationParams,
660
694
  defaultPageSize: number,
661
695
  ) {
@@ -667,112 +701,112 @@ ${a ? `function resolveServerTablePagination(
667
701
  ` : ""}
668
702
  `;
669
703
  }
670
- function Pe(e) {
671
- var a, l;
672
- const n = V((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: t, ...o } = n;
704
+ function Ue(e) {
705
+ var i, l;
706
+ const r = k((i = e.raw.sdkSpec) == null ? void 0 : i.spec) || {}, { kind: n, id: t, ...o } = r;
673
707
  return {
674
708
  ...o,
675
709
  id: e.raw.id,
676
710
  label: ((l = e.raw.visualSpec) == null ? void 0 : l.title) || e.raw.title || o.label
677
711
  };
678
712
  }
679
- function Y(e, n) {
680
- var a, l;
681
- const r = [], t = V((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
682
- for (const y of j(t.fields)) h(r, y);
683
- h(r, t.dateField), h(r, (l = V(t.orderBy)) == null ? void 0 : l.field);
684
- for (const y of e.raw.fields || []) h(r, y);
713
+ function Y(e, r) {
714
+ var i, l;
715
+ const n = [], t = k((i = e.raw.sdkSpec) == null ? void 0 : i.spec) || {};
716
+ for (const f of H(t.fields)) w(n, f);
717
+ w(n, t.dateField), w(n, (l = k(t.orderBy)) == null ? void 0 : l.field);
718
+ for (const f of e.raw.fields || []) w(n, f);
685
719
  return X(
686
- r.map((y) => {
687
- const w = x(y, n);
688
- if (!(!y.name || !w))
720
+ n.map((f) => {
721
+ const F = x(f, r);
722
+ if (!(!f.name || !F))
689
723
  return {
690
- key: w,
691
- fieldName: w,
692
- rawName: y.name,
693
- label: y.label || y.name
724
+ key: F,
725
+ fieldName: F,
726
+ rawName: f.name,
727
+ label: f.label || f.name
694
728
  };
695
- }).filter(K),
696
- (y) => y.key
729
+ }).filter(v),
730
+ (f) => f.key
697
731
  );
698
732
  }
699
- function De({
733
+ function Je({
700
734
  view: e,
701
- contract: n,
702
- sortFields: r,
735
+ contract: r,
736
+ sortFields: n,
703
737
  defaultField: t
704
738
  }) {
705
- var w, f;
706
- const o = new Set(r.map((m) => m.key));
739
+ var F, m;
740
+ const o = new Set(n.map((c) => c.key));
707
741
  if (t && o.has(t))
708
742
  return t;
709
- const a = r.filter((m) => m.rawName === t);
710
- if (a.length === 1)
711
- return a[0].key;
712
- const l = V((w = e.raw.sdkSpec) == null ? void 0 : w.spec), y = x((f = V(l == null ? void 0 : l.orderBy)) == null ? void 0 : f.field, n);
713
- return y && o.has(y) ? y : void 0;
743
+ const i = n.filter((c) => c.rawName === t);
744
+ if (i.length === 1)
745
+ return i[0].key;
746
+ const l = k((F = e.raw.sdkSpec) == null ? void 0 : F.spec), f = x((m = k(l == null ? void 0 : l.orderBy)) == null ? void 0 : m.field, r);
747
+ return f && o.has(f) ? f : void 0;
714
748
  }
715
- function Ue({
749
+ function Le({
716
750
  viewName: e,
717
- supportsPagination: n,
718
- supportsSort: r
751
+ supportsPagination: r,
752
+ supportsSort: n
719
753
  }) {
720
- return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
754
+ return r && n ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : n ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
721
755
  }
722
- function Le(e) {
723
- const n = e.views.map((m) => {
724
- const u = Je(e, m.raw.id).map((d) => {
725
- const c = d.inputId, i = x(d.fieldRef, e);
726
- if (!c || !i)
756
+ function ze(e) {
757
+ const r = e.views.map((c) => {
758
+ const u = Ye(e, c.raw.id).map((d) => {
759
+ const p = d.inputId, $ = x(d.fieldRef, e);
760
+ if (!p || !$)
727
761
  return "";
728
- const p = [`field: fields.${i}`];
762
+ const a = [`field: fields.${$}`];
729
763
  if (d.relationshipHint)
730
- p.push(`relationshipHint: ${k(d.relationshipHint)}`);
764
+ a.push(`relationshipHint: ${R(d.relationshipHint)}`);
731
765
  else if (Array.isArray(d.relationshipsUsed) && d.relationshipsUsed.length > 0) {
732
- const g = d.relationshipsUsed.map(($) => {
733
- var F;
734
- return (F = V($)) == null ? void 0 : F.id;
735
- }).filter(($) => typeof $ == "string" && $.length > 0);
736
- g.length > 0 && p.push(`relationshipHint: ${k({ relationshipIds: g })}`);
766
+ const h = d.relationshipsUsed.map((y) => {
767
+ var I;
768
+ return (I = k(y)) == null ? void 0 : I.id;
769
+ }).filter((y) => typeof y == "string" && y.length > 0);
770
+ h.length > 0 && a.push(`relationshipHint: ${R({ relationshipIds: h })}`);
737
771
  }
738
- const S = `inputHandles[${JSON.stringify(c)}]`;
739
- return ` if (${S}) {
740
- inputs.push(semaphor.bindInput(${S}, { ${p.join(", ")} }));
772
+ const g = `inputHandles[${JSON.stringify(p)}]`;
773
+ return ` if (${g}) {
774
+ inputs.push(semaphor.bindInput(${g}, { ${a.join(", ")} }));
741
775
  }`;
742
776
  }).filter(Boolean).join(`
743
777
  `);
744
- return { view: m, renderedBindings: u };
745
- }), r = n.some((m) => m.renderedBindings.length > 0), t = n.map(({ view: m, renderedBindings: N }) => {
778
+ return { view: c, renderedBindings: u };
779
+ }), n = r.some((c) => c.renderedBindings.length > 0), t = r.map(({ view: c, renderedBindings: N }) => {
746
780
  const u = N ? "inputHandles" : "_inputHandles";
747
- return ` ${m.name}(${u}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
781
+ return ` ${c.name}(${u}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
748
782
  const inputs: SemaphorInputReference[] = [];
749
783
  ${N}
750
784
  return inputs;
751
785
  },`;
752
786
  }).join(`
753
787
 
754
- `), o = e.views.map((m) => ` ${m.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
788
+ `), o = e.views.map((c) => ` ${c.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
755
789
  return {
756
- inputs: inputsForView.${m.name}(inputHandles),
757
- debug: queryDebugForView.${m.name},
790
+ inputs: inputsForView.${c.name}(inputHandles),
791
+ debug: queryDebugForView.${c.name},
758
792
  };
759
793
  },`).join(`
760
794
 
761
- `), a = 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, w = y ? "inputHandles" : "_inputHandles", f = [
766
- r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
795
+ `), i = e.views.map((c) => ` case ${JSON.stringify(c.raw.id)}:
796
+ return inputsForView.${c.name}(inputHandles);`).join(`
797
+ `), l = e.views.map((c) => ` case ${JSON.stringify(c.raw.id)}:
798
+ return queryOptionsForView.${c.name}(inputHandles);`).join(`
799
+ `), f = e.views.length > 0, F = f ? "inputHandles" : "_inputHandles", m = [
800
+ n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
767
801
  'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions } from "react-semaphor/data-app-sdk";',
768
- r ? 'import { fields } from "./fields";' : void 0,
802
+ n ? 'import { fields } from "./fields";' : void 0,
769
803
  'import type { SemaphorGeneratedInputHandleMap } from "./inputs";',
770
- y ? 'import { queryDebugForView } from "./metadata";' : void 0,
804
+ f ? 'import { queryDebugForView } from "./metadata";' : void 0,
771
805
  'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
772
- ].filter(K).join(`
806
+ ].filter(v).join(`
773
807
  `);
774
- return `${H}
775
- ${f}
808
+ return `${A}
809
+ ${m}
776
810
 
777
811
  export const inputsForView = {
778
812
  ${t}
@@ -784,17 +818,17 @@ ${o}
784
818
 
785
819
  export function inputsForViewId(
786
820
  viewId: SemaphorGeneratedQueryViewId,
787
- ${w}: SemaphorGeneratedInputHandleMap,
821
+ ${F}: SemaphorGeneratedInputHandleMap,
788
822
  ): SemaphorInputReference[] {
789
823
  switch (viewId) {
790
- ${a}
824
+ ${i}
791
825
  }
792
826
  throw new Error(\`Unknown generated Semaphor view id: \${viewId}\`);
793
827
  }
794
828
 
795
829
  export function queryOptionsForViewId(
796
830
  viewId: SemaphorGeneratedQueryViewId,
797
- ${w}: SemaphorGeneratedInputHandleMap,
831
+ ${F}: SemaphorGeneratedInputHandleMap,
798
832
  ): SemaphorQueryRuntimeOptions {
799
833
  switch (viewId) {
800
834
  ${l}
@@ -803,150 +837,180 @@ ${l}
803
837
  }
804
838
  `;
805
839
  }
806
- function Je(e, n) {
840
+ function Ye(e, r) {
807
841
  return e.filterContracts.flatMap(
808
- (r) => (r.bindings || []).filter((t) => t.viewId === n).map((t) => ({
809
- inputId: r.inputId,
842
+ (n) => (n.bindings || []).filter((t) => t.viewId === r).map((t) => ({
843
+ inputId: n.inputId,
810
844
  fieldRef: t.fieldRef,
811
845
  relationshipHint: t.relationshipHint,
812
846
  relationshipsUsed: t.relationshipsUsed
813
847
  }))
814
848
  );
815
849
  }
816
- function ze(e) {
817
- const n = e.views.map((i) => {
818
- const S = D(i, e).map((g) => {
819
- const $ = x(g.raw, e);
820
- return $ ? ` ${g.name}: fields.${$},` : "";
850
+ function We(e) {
851
+ const r = e.views.map((a) => {
852
+ const h = D(a, e).map((y) => {
853
+ const I = x(y.raw, e);
854
+ return I ? ` ${y.name}: fields.${I},` : "";
821
855
  }).filter(Boolean).join(`
822
856
  `);
823
- return ` ${i.name}: {
824
- ${S}
857
+ return ` ${a.name}: {
858
+ ${h}
825
859
  },`;
826
860
  }).join(`
827
- `), r = e.views.map((i) => {
828
- const S = P(i, e).map((g) => {
829
- const $ = x(g.raw, e);
830
- return $ ? ` ${g.name}: fields.${$},` : "";
861
+ `), n = e.views.map((a) => {
862
+ const h = T(a, e).map((y) => {
863
+ const I = x(y.raw, e);
864
+ return I ? ` ${y.name}: fields.${I},` : "";
831
865
  }).filter(Boolean).join(`
832
866
  `);
833
- return ` ${i.name}: {
834
- ${S}
867
+ return ` ${a.name}: {
868
+ ${h}
835
869
  },`;
836
870
  }).join(`
837
- `), t = e.views.map((i) => {
838
- const p = P(i, e), S = rn(p), g = nn(p), $ = p.map((F) => {
839
- const R = Array.from(
871
+ `), t = e.views.map((a) => {
872
+ const g = T(a, e), h = or(g), y = tr(g), I = g.map((V) => {
873
+ const b = Array.from(
840
874
  new Set(
841
- he(F.raw).filter((b) => g.has(b))
875
+ he(V.raw).filter((M) => y.has(M))
842
876
  )
843
877
  );
844
- return ` ${F.name}: metricKeysForField(metricFieldsForView.${i.name}.${F.name}, { allowNameFallback: ${S.has(F.raw.name) ? "false" : "true"}, excludedKeys: ${k(R)} }),`;
878
+ return ` ${V.name}: metricKeysForField(metricFieldsForView.${a.name}.${V.name}, { allowNameFallback: ${h.has(V.raw.name) ? "false" : "true"}, excludedKeys: ${R(b)} }),`;
845
879
  }).join(`
846
880
  `);
847
- return ` ${i.name}: {
848
- ${$}
881
+ return ` ${a.name}: {
882
+ ${I}
849
883
  },`;
850
884
  }).join(`
851
- `), o = e.views.map((i) => {
852
- const S = P(i, e).map((g, $) => ` ${g.name}: ${JSON.stringify(Xe(i, g, $))},`).join(`
885
+ `), o = e.views.map((a) => {
886
+ const h = T(a, e).map((y, I) => ` ${y.name}: ${JSON.stringify(rr(a, y, I))},`).join(`
853
887
  `);
854
- return ` ${i.name}: {
855
- ${S}
888
+ return ` ${a.name}: {
889
+ ${h}
856
890
  },`;
857
891
  }).join(`
858
- `), a = e.views.map((i) => {
859
- const p = P(i, e);
860
- if (p.length === 0)
861
- return ` ${i.name}(): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
892
+ `), i = e.views.map((a) => {
893
+ const g = T(a, e);
894
+ if (g.length === 0)
895
+ return ` ${a.name}(): Record<keyof typeof metricFieldsForView.${a.name}, unknown> {
862
896
  return {};
863
897
  },`;
864
- const S = en(i, p), g = p.map(($) => {
865
- const F = `metricMeasureKeysForView.${i.name}.${$.name}`, R = `metricMeasureBindingKeysForView.${i.name}.${$.name}`, b = S.has($.name) ? `readMetricValueByBindingWithFallback(measures, measureBindings, ${R}, ${F}, primaryValue)` : `readMetricValueByBinding(measures, measureBindings, ${R}, ${F})`;
866
- return ` ${$.name}: ${b},`;
898
+ const h = nr(a, g), y = g.map((I) => {
899
+ const V = `metricMeasureKeysForView.${a.name}.${I.name}`, b = `metricMeasureBindingKeysForView.${a.name}.${I.name}`, M = h.has(I.name) ? `readMetricValueByBindingWithFallback(measures, measureBindings, ${b}, ${V}, primaryValue)` : `readMetricValueByBinding(measures, measureBindings, ${b}, ${V})`;
900
+ return ` ${I.name}: ${M},`;
867
901
  }).join(`
868
902
  `);
869
- return ` ${i.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
903
+ return ` ${a.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${a.name}, unknown> {
870
904
  const measures = result?.measures;
871
905
  const measureBindings = result?.measureBindings;
872
906
  const primaryValue = result?.primaryValue;
873
907
  return {
874
- ${g}
908
+ ${y}
875
909
  };
876
910
  },`;
877
911
  }).join(`
878
912
 
879
- `), l = e.views.map((i) => {
880
- const p = P(i, e);
881
- if (p.length === 0)
882
- return ` ${i.name}(): Array<keyof typeof metricFieldsForView.${i.name}> {
913
+ `), l = e.views.map((a) => {
914
+ const g = T(a, e);
915
+ if (g.length === 0)
916
+ return ` ${a.name}(): Array<keyof typeof metricFieldsForView.${a.name}> {
883
917
  return [];
884
918
  },`;
885
- const S = p.map((g) => ` ...(missing.has(metricMeasureBindingKeysForView.${i.name}.${g.name}) ? [${JSON.stringify(g.name)} as keyof typeof metricFieldsForView.${i.name}] : []),`).join(`
919
+ const h = g.map((y) => ` ...(missing.has(metricMeasureBindingKeysForView.${a.name}.${y.name}) ? [${JSON.stringify(y.name)} as keyof typeof metricFieldsForView.${a.name}] : []),`).join(`
886
920
  `);
887
- return ` ${i.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${i.name}> {
921
+ return ` ${a.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${a.name}> {
888
922
  const missing = new Set(result?.missingMeasures || []);
889
923
  return [
890
- ${S}
924
+ ${h}
891
925
  ];
892
926
  },`;
893
927
  }).join(`
894
928
 
895
- `), y = e.views.map((i) => {
896
- const p = Ye(i, e);
897
- return ` ${i.name}: ${k(p)},`;
929
+ `), f = e.views.map((a) => {
930
+ const g = T(a, e);
931
+ if (g.length === 0)
932
+ return "";
933
+ const h = g[0], y = g.map((V) => `{ key: ${JSON.stringify(V.name)}, label: ${JSON.stringify(V.raw.label || V.raw.name)} }`).join(", "), I = g.filter((V) => V.name !== h.name).map((V) => ` if (missing.includes(${JSON.stringify(V.name)})) delete values.${V.name};`).join(`
934
+ `);
935
+ return ` ${a.name}(result: SemaphorGeneratedMetricResult): SemaphorGeneratedKpiProps {
936
+ const values = mapMetricDisplayValues(metricValuesForView.${a.name}(result));
937
+ const missing = missingMetricMeasuresForView.${a.name}(result).map((key) => String(key));
938
+ const primaryMissing = missing.includes(${JSON.stringify(h.name)});
939
+ const primaryValue = primaryMissing ? result?.primaryValue : values.${h.name};
940
+ if (primaryMissing) values.${h.name} = metricDisplayValue(result?.primaryValue);
941
+ ${I}
942
+ return {
943
+ result: {
944
+ ...(result || {}),
945
+ value: metricDisplayValue(result?.value),
946
+ primaryValue: metricDisplayValue(result?.primaryValue),
947
+ comparisonValue: metricDisplayValue(result?.comparisonValue),
948
+ measures: values,
949
+ },
950
+ title: ${JSON.stringify(a.raw.title || a.raw.id)},
951
+ label: ${JSON.stringify(h.raw.label || h.raw.name)},
952
+ value: metricDisplayValue(primaryValue),
953
+ measures: [${y}],
954
+ missingMeasures: missing,
955
+ showComparison: Boolean(result?.comparisonKind),
956
+ };
957
+ },`;
958
+ }).filter(Boolean).join(`
959
+
960
+ `), F = e.views.map((a) => {
961
+ const g = Ze(a, e);
962
+ return ` ${a.name}: ${R(g)},`;
898
963
  }).join(`
899
- `), w = e.views.map((i) => {
900
- const S = D(i, e).map((g) => ` ${g.name}: resolveColumnKey(columns, fieldsForView.${i.name}.${g.name}),`).join(`
964
+ `), m = e.views.map((a) => {
965
+ const h = D(a, e).map((y) => ` ${y.name}: resolveColumnKey(columns, fieldsForView.${a.name}.${y.name}),`).join(`
901
966
  `);
902
- return ` ${i.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, string | undefined> {
967
+ return ` ${a.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${a.name}, string | undefined> {
903
968
  return {
904
- ${S}
969
+ ${h}
905
970
  };
906
971
  },`;
907
972
  }).join(`
908
973
 
909
- `), f = e.views.map((i) => {
910
- const S = D(i, e).map((g) => ` ${g.name}: readCell(row, columns, fieldsForView.${i.name}.${g.name}),`).join(`
974
+ `), c = e.views.map((a) => {
975
+ const h = D(a, e).map((y) => ` ${y.name}: readCell(row, columns, fieldsForView.${a.name}.${y.name}),`).join(`
911
976
  `);
912
- return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, unknown> {
977
+ return ` ${a.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${a.name}, unknown> {
913
978
  return {
914
- ${S}
979
+ ${h}
915
980
  };
916
981
  },`;
917
982
  }).join(`
918
983
 
919
- `), m = e.views.map((i) => ` ${i.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${i.name}, unknown>> {
920
- return (result?.records || []).map((row) => rowValuesForView.${i.name}(row, result?.columns));
984
+ `), N = e.views.map((a) => ` ${a.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${a.name}, unknown>> {
985
+ return (result?.records || []).map((row) => rowValuesForView.${a.name}(row, result?.columns));
921
986
  },`).join(`
922
987
 
923
- `), N = e.views.map((i) => {
924
- const p = D(i, e), S = p.filter((s) => s.raw.role === "dimension"), g = p.filter((s) => s.raw.role === "measure"), $ = S[0], F = S[1], R = g[0], b = g[1], M = [
925
- $ ? ` primaryDimension: values.${$.name},` : " primaryDimension: undefined,",
926
- F ? ` secondaryDimension: values.${F.name},` : " secondaryDimension: undefined,",
927
- R ? ` primaryMeasure: values.${R.name},` : " primaryMeasure: undefined,",
928
- b ? ` secondaryMeasure: values.${b.name},` : " secondaryMeasure: undefined,"
988
+ `), u = e.views.map((a) => {
989
+ const g = D(a, e), h = g.filter((S) => S.raw.role === "dimension"), y = g.filter((S) => S.raw.role === "measure"), I = h[0], V = h[1], b = y[0], M = y[1], s = [
990
+ I ? ` primaryDimension: values.${I.name},` : " primaryDimension: undefined,",
991
+ V ? ` secondaryDimension: values.${V.name},` : " secondaryDimension: undefined,",
992
+ b ? ` primaryMeasure: values.${b.name},` : " primaryMeasure: undefined,",
993
+ M ? ` secondaryMeasure: values.${M.name},` : " secondaryMeasure: undefined,"
929
994
  ].join(`
930
995
  `);
931
- return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): SemaphorGeneratedRoleValues {
932
- const values = rowValuesForView.${i.name}(row, columns);
996
+ return ` ${a.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): SemaphorGeneratedRoleValues {
997
+ const values = rowValuesForView.${a.name}(row, columns);
933
998
  return {
934
- ${M}
999
+ ${s}
935
1000
  };
936
1001
  },`;
937
1002
  }).join(`
938
1003
 
939
- `), u = n.includes("fields.") || r.includes("fields."), c = [
1004
+ `), d = r.includes("fields.") || n.includes("fields."), $ = [
940
1005
  `import { ${[
941
1006
  "type SemaphorFieldRef",
942
- "type SemaphorResultColumn",
943
- "semaphorMetricMeasureBindingKey"
944
- ].filter(K).join(", ")} } from "react-semaphor/data-app-sdk";`,
945
- u ? 'import { fields } from "./fields";' : void 0
946
- ].filter(K).join(`
1007
+ "type SemaphorResultColumn"
1008
+ ].filter(v).join(", ")} } from "react-semaphor/data-app-sdk";`,
1009
+ d ? 'import { fields } from "./fields";' : void 0
1010
+ ].filter(v).join(`
947
1011
  `);
948
- return `${H}
949
- ${c}
1012
+ return `${A}
1013
+ ${$}
950
1014
 
951
1015
  export type SemaphorGeneratedRow = Record<string, unknown>;
952
1016
  export type SemaphorGeneratedColumns = readonly SemaphorResultColumn[] | null | undefined;
@@ -956,12 +1020,17 @@ export type SemaphorGeneratedRecordsResult = {
956
1020
  } | null | undefined;
957
1021
  export type SemaphorGeneratedMetricMeasures = Record<string, unknown> | null | undefined;
958
1022
  export type SemaphorGeneratedMetricMeasureBindings = Record<string, string> | null | undefined;
1023
+ export type SemaphorGeneratedMetricValue = number | string | null;
959
1024
  export type SemaphorGeneratedMetricResult = {
960
1025
  readonly measures?: SemaphorGeneratedMetricMeasures;
961
1026
  readonly measureBindings?: SemaphorGeneratedMetricMeasureBindings;
962
1027
  readonly missingMeasures?: readonly string[];
963
1028
  readonly primaryValue: unknown;
964
1029
  readonly value?: unknown;
1030
+ readonly comparisonKind?: string;
1031
+ readonly comparisonValue?: unknown;
1032
+ readonly delta?: number | null;
1033
+ readonly deltaPercent?: number | null;
965
1034
  } | null | undefined;
966
1035
  export type SemaphorGeneratedRoleValues = {
967
1036
  readonly primaryDimension: unknown;
@@ -976,13 +1045,36 @@ export type SemaphorGeneratedTableColumn = {
976
1045
  readonly sortable?: boolean;
977
1046
  readonly sortKey?: string;
978
1047
  };
1048
+ export type SemaphorGeneratedKpiResult<TValues extends Record<string, SemaphorGeneratedMetricValue> = Record<string, SemaphorGeneratedMetricValue>> =
1049
+ Record<string, unknown> & {
1050
+ readonly value?: SemaphorGeneratedMetricValue;
1051
+ readonly primaryValue?: SemaphorGeneratedMetricValue;
1052
+ readonly comparisonValue?: SemaphorGeneratedMetricValue;
1053
+ readonly comparisonKind?: string;
1054
+ readonly delta?: number | null;
1055
+ readonly deltaPercent?: number | null;
1056
+ readonly measures: TValues;
1057
+ };
1058
+ export type SemaphorGeneratedKpiMeasureConfig = {
1059
+ key: string;
1060
+ label: string;
1061
+ };
1062
+ export type SemaphorGeneratedKpiProps = {
1063
+ readonly result: SemaphorGeneratedKpiResult;
1064
+ readonly title: string;
1065
+ readonly label: string;
1066
+ readonly value: SemaphorGeneratedMetricValue;
1067
+ readonly measures: SemaphorGeneratedKpiMeasureConfig[];
1068
+ readonly missingMeasures: readonly string[];
1069
+ readonly showComparison: boolean;
1070
+ };
979
1071
 
980
1072
  export const fieldsForView = {
981
- ${n}
1073
+ ${r}
982
1074
  } as const;
983
1075
 
984
1076
  export const metricFieldsForView = {
985
- ${r}
1077
+ ${n}
986
1078
  } as const;
987
1079
 
988
1080
  export const metricMeasureKeysForView = {
@@ -994,33 +1086,37 @@ ${o}
994
1086
  } as const;
995
1087
 
996
1088
  export const tableColumnsForView = {
997
- ${y}
1089
+ ${F}
998
1090
  } as const;
999
1091
 
1000
1092
  export const columnKeysForView = {
1001
- ${w}
1093
+ ${m}
1002
1094
  } as const;
1003
1095
 
1004
1096
  export const rowValuesForView = {
1005
- ${f}
1097
+ ${c}
1006
1098
  } as const;
1007
1099
 
1008
1100
  export const rowsForView = {
1009
- ${m}
1101
+ ${N}
1010
1102
  } as const;
1011
1103
 
1012
1104
  export const roleValuesForView = {
1013
- ${N}
1105
+ ${u}
1014
1106
  } as const;
1015
1107
 
1016
1108
  export const metricValuesForView = {
1017
- ${a}
1109
+ ${i}
1018
1110
  } as const;
1019
1111
 
1020
1112
  export const missingMetricMeasuresForView = {
1021
1113
  ${l}
1022
1114
  } as const;
1023
1115
 
1116
+ export const kpiPropsForView = {
1117
+ ${f}
1118
+ } as const;
1119
+
1024
1120
  export function resolveColumnKey(
1025
1121
  columns: SemaphorGeneratedColumns,
1026
1122
  field: SemaphorFieldRef,
@@ -1140,6 +1236,26 @@ export function readStringMetricValue(
1140
1236
  return value === null || value === undefined ? "" : String(value);
1141
1237
  }
1142
1238
 
1239
+ export function mapMetricDisplayValues(
1240
+ values: Record<string, unknown>,
1241
+ ): Record<string, SemaphorGeneratedMetricValue> {
1242
+ return Object.fromEntries(
1243
+ Object.entries(values)
1244
+ .map(([key, value]) => [key, metricDisplayValue(value)] as const)
1245
+ .filter(([key]) => values[key] !== undefined),
1246
+ );
1247
+ }
1248
+
1249
+ export function metricDisplayValue(value: unknown): SemaphorGeneratedMetricValue {
1250
+ if (value === null || value === undefined) {
1251
+ return null;
1252
+ }
1253
+ if (typeof value === "number" || typeof value === "string") {
1254
+ return value;
1255
+ }
1256
+ return String(value);
1257
+ }
1258
+
1143
1259
  export function metricKeysForField(
1144
1260
  field: SemaphorFieldRef,
1145
1261
  options: { allowNameFallback?: boolean; excludedKeys?: readonly string[] } = {},
@@ -1159,11 +1275,15 @@ export function metricKeysForField(
1159
1275
  }
1160
1276
 
1161
1277
  function metricQualifiedKeyForField(field: SemaphorFieldRef): string {
1162
- return semaphorMetricMeasureBindingKey(field);
1278
+ return [
1279
+ field.source ? sourceIdentityKey(field.source as Record<string, unknown>) : "unknown",
1280
+ metricAggregateForField(field),
1281
+ field.name,
1282
+ ].filter(Boolean).join(":");
1163
1283
  }
1164
1284
 
1165
1285
  function metricAggregateForField(field: SemaphorFieldRef): string {
1166
- return stringProperty(field as Record<string, unknown>, "aggregate")?.toUpperCase() || "SUM";
1286
+ return (field.aggregate || "SUM").toUpperCase();
1167
1287
  }
1168
1288
 
1169
1289
  function metricKeyPrefixesForSource(
@@ -1204,6 +1324,35 @@ function metricKeyPrefixesForSource(
1204
1324
  return [];
1205
1325
  }
1206
1326
 
1327
+ function sourceIdentityKey(source: Record<string, unknown>): string {
1328
+ const kind = stringProperty(source, "kind");
1329
+ if (kind === "semantic") {
1330
+ const datasetId = stringProperty(source, "datasetId");
1331
+ return [
1332
+ kind,
1333
+ stringProperty(source, "domainId") || "",
1334
+ datasetId
1335
+ ? \`datasetId:\${datasetId}\`
1336
+ : \`datasetName:\${stringProperty(source, "datasetName") || ""}\`,
1337
+ ].join(":");
1338
+ }
1339
+ if (kind === "physical") {
1340
+ return [
1341
+ kind,
1342
+ stringProperty(source, "connectionId") || "",
1343
+ stringProperty(source, "databaseName") || "",
1344
+ stringProperty(source, "schemaName") || "",
1345
+ stringProperty(source, "tableName") || "",
1346
+ ].join(":");
1347
+ }
1348
+ return [
1349
+ kind || "unknown",
1350
+ stringProperty(source, "connectionId") || "",
1351
+ stringProperty(source, "dialect") || "",
1352
+ stringProperty(source, "label") || "",
1353
+ ].join(":");
1354
+ }
1355
+
1207
1356
  function stringProperty(record: Record<string, unknown>, key: string): string | undefined {
1208
1357
  const value = record[key];
1209
1358
  return typeof value === "string" && value.length > 0 ? value : undefined;
@@ -1317,13 +1466,13 @@ function sourcesReferToSameDataset(
1317
1466
  }
1318
1467
  `;
1319
1468
  }
1320
- function Ye(e, n) {
1321
- const r = D(e, n), t = new Map(
1322
- (E(e) ? Y(e, n) : []).map((o) => [o.fieldName, o.key])
1469
+ function Ze(e, r) {
1470
+ const n = D(e, r), t = new Map(
1471
+ (K(e) ? Y(e, r) : []).map((o) => [o.fieldName, o.key])
1323
1472
  );
1324
- return r.map((o) => {
1325
- const a = x(o.raw, n), l = a ? t.get(a) : void 0;
1326
- return G({
1473
+ return n.map((o) => {
1474
+ const i = x(o.raw, r), l = i ? t.get(i) : void 0;
1475
+ return O({
1327
1476
  key: o.name,
1328
1477
  label: o.raw.label || o.raw.name,
1329
1478
  dataType: o.raw.dataType,
@@ -1332,13 +1481,13 @@ function Ye(e, n) {
1332
1481
  });
1333
1482
  });
1334
1483
  }
1335
- function We(e) {
1336
- const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((u) => u.id).filter(Boolean), o = e.views.map((u) => u.raw.id).filter(Boolean), a = e.inputs.map((u) => u.raw.id).filter(Boolean), l = e.optionQueries.map((u) => u.raw.id || `${u.input.raw.id}-options`).filter(Boolean), y = Object.fromEntries(o.map((u) => [
1484
+ function Xe(e) {
1485
+ const r = e.checklist.filterScopeByInput || [], n = e.checklist.requiredDevtools || {}, t = e.summary.views.map((u) => u.id).filter(Boolean), o = e.views.map((u) => u.raw.id).filter(Boolean), i = e.inputs.map((u) => u.raw.id).filter(Boolean), l = e.optionQueries.map((u) => u.raw.id || `${u.input.raw.id}-options`).filter(Boolean), f = Object.fromEntries(o.map((u) => [
1337
1486
  u,
1338
1487
  e.filterContracts.filter(
1339
1488
  (d) => Array.isArray(d.appliesToViewIds) && d.appliesToViewIds.includes(u)
1340
1489
  ).map((d) => d.inputId)
1341
- ])), w = Object.fromEntries(e.views.map((u) => [
1490
+ ])), F = Object.fromEntries(e.views.map((u) => [
1342
1491
  u.raw.id,
1343
1492
  {
1344
1493
  title: u.raw.title,
@@ -1347,11 +1496,11 @@ function We(e) {
1347
1496
  queryKind: u.raw.queryKind,
1348
1497
  sdkBuilder: u.raw.sdkBuilder
1349
1498
  }
1350
- ])), f = Object.fromEntries(e.views.map((u) => {
1499
+ ])), m = Object.fromEntries(e.views.map((u) => {
1351
1500
  var d;
1352
1501
  return [
1353
1502
  u.raw.id,
1354
- G({
1503
+ O({
1355
1504
  viewId: u.raw.id,
1356
1505
  queryId: u.name,
1357
1506
  title: u.raw.title,
@@ -1363,11 +1512,11 @@ function We(e) {
1363
1512
  }
1364
1513
  })
1365
1514
  ];
1366
- })), m = Object.fromEntries(e.inputs.map((u) => {
1515
+ })), c = Object.fromEntries(e.inputs.map((u) => {
1367
1516
  var d;
1368
1517
  return [
1369
1518
  u.raw.id,
1370
- G({
1519
+ O({
1371
1520
  inputId: u.raw.id,
1372
1521
  label: u.raw.label,
1373
1522
  type: u.raw.type,
@@ -1380,24 +1529,24 @@ function We(e) {
1380
1529
  })
1381
1530
  ];
1382
1531
  })), N = Object.fromEntries(e.views.map((u) => {
1383
- var d, c, i;
1532
+ var d, p, $;
1384
1533
  return [
1385
1534
  u.name,
1386
- G({
1535
+ O({
1387
1536
  viewId: u.raw.id,
1388
1537
  viewTitle: ((d = u.raw.visualSpec) == null ? void 0 : d.title) || u.raw.title,
1389
- visualType: (c = u.raw.visualSpec) == null ? void 0 : c.visualType,
1390
- title: ((i = u.raw.visualSpec) == null ? void 0 : i.title) || u.raw.title
1538
+ visualType: (p = u.raw.visualSpec) == null ? void 0 : p.visualType,
1539
+ title: (($ = u.raw.visualSpec) == null ? void 0 : $.title) || u.raw.title
1391
1540
  })
1392
1541
  ];
1393
1542
  }));
1394
- return `${H}
1395
- export const generatedViewIds = ${k(t)} as const;
1396
- export const generatedQueryViewIds = ${k(o)} as const;
1397
- export const generatedInputIds = ${k(a)} as const;
1398
- export const generatedInputOptionQueryIds = ${k(l)} as const;
1399
- export const generatedViewAuthoring = ${k(f)} as const;
1400
- export const generatedInputAuthoring = ${k(m)} as const;
1543
+ return `${A}
1544
+ export const generatedViewIds = ${R(t)} as const;
1545
+ export const generatedQueryViewIds = ${R(o)} as const;
1546
+ export const generatedInputIds = ${R(i)} as const;
1547
+ export const generatedInputOptionQueryIds = ${R(l)} as const;
1548
+ export const generatedViewAuthoring = ${R(m)} as const;
1549
+ export const generatedInputAuthoring = ${R(c)} as const;
1401
1550
 
1402
1551
  export type SemaphorGeneratedViewId = typeof generatedViewIds[number];
1403
1552
  export type SemaphorGeneratedQueryViewId = typeof generatedQueryViewIds[number];
@@ -1416,8 +1565,8 @@ export type SemaphorGeneratedFilterContract = {
1416
1565
  readonly [key: string]: unknown;
1417
1566
  };
1418
1567
 
1419
- export const generatedInputIdsForView = ${k(y)} as const;
1420
- export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${k(e.filterContracts)} as const;
1568
+ export const generatedInputIdsForView = ${R(f)} as const;
1569
+ export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${R(e.filterContracts)} as const;
1421
1570
 
1422
1571
  export function semaphorViewMarkerProps(viewId: SemaphorGeneratedViewId) {
1423
1572
  return {
@@ -1437,28 +1586,28 @@ export function filterContractsForView(viewId: SemaphorGeneratedQueryViewId) {
1437
1586
  );
1438
1587
  }
1439
1588
 
1440
- export const queryDebugForView = ${k(N)} as const;
1589
+ export const queryDebugForView = ${R(N)} as const;
1441
1590
 
1442
- export const semaphorGeneratedContractMetadata = ${k({
1591
+ export const semaphorGeneratedContractMetadata = ${R({
1443
1592
  schemaVersion: "semaphor-generated-data-app-contract/v1",
1444
1593
  title: e.title,
1445
- requiredDevtools: r,
1594
+ requiredDevtools: n,
1446
1595
  filterContracts: e.filterContracts,
1447
- filterScopeByInput: n,
1596
+ filterScopeByInput: r,
1448
1597
  generatedViewIds: t,
1449
1598
  generatedQueryViewIds: o,
1450
- generatedInputIds: a,
1599
+ generatedInputIds: i,
1451
1600
  generatedInputOptionQueryIds: l,
1452
- generatedInputIdsForView: y,
1453
- generatedViewAuthoring: f,
1454
- generatedInputAuthoring: m,
1455
- visualSpecs: w,
1601
+ generatedInputIdsForView: f,
1602
+ generatedViewAuthoring: m,
1603
+ generatedInputAuthoring: c,
1604
+ visualSpecs: F,
1456
1605
  presentationViews: e.presentationViews
1457
1606
  })} as const;
1458
1607
  `;
1459
1608
  }
1460
- function Ze() {
1461
- return `${H}
1609
+ function er() {
1610
+ return `${A}
1462
1611
  export * from "./sources";
1463
1612
  export * from "./fields";
1464
1613
  export * from "./inputs";
@@ -1468,143 +1617,143 @@ export * from "./accessors";
1468
1617
  export * from "./metadata";
1469
1618
  `;
1470
1619
  }
1471
- function Q(e, n) {
1472
- if (!(!n || typeof n != "object")) {
1473
- if (Array.isArray(n)) {
1474
- for (const r of n) Q(e, r);
1620
+ function Q(e, r) {
1621
+ if (!(!r || typeof r != "object")) {
1622
+ if (Array.isArray(r)) {
1623
+ for (const n of r) Q(e, n);
1475
1624
  return;
1476
1625
  }
1477
- C(n) && h(e, U(n));
1478
- for (const r of Object.values(n))
1479
- Q(e, r);
1626
+ C(r) && w(e, U(r));
1627
+ for (const n of Object.values(r))
1628
+ Q(e, n);
1480
1629
  }
1481
1630
  }
1482
- function D(e, n) {
1483
- const r = [];
1484
- if (tn(r, e.raw.sdkSpec), r.length === 0)
1631
+ function D(e, r) {
1632
+ const n = [];
1633
+ if (sr(n, e.raw.sdkSpec), n.length === 0)
1485
1634
  for (const o of e.raw.fields || [])
1486
- h(r, o);
1635
+ w(n, o);
1487
1636
  const t = X(
1488
- r.filter((o) => o.name && x(o, n)).map((o) => ({ raw: o, key: L(o), name: "" })),
1637
+ n.filter((o) => o.name && x(o, r)).map((o) => ({ raw: o, key: J(o), name: "" })),
1489
1638
  (o) => o.key
1490
1639
  );
1491
- return v(
1640
+ return j(
1492
1641
  t,
1493
1642
  (o) => q(o.raw.label || o.raw.name || "field")
1494
1643
  ), t;
1495
1644
  }
1496
- function P(e, n) {
1645
+ function T(e, r) {
1497
1646
  if (B(e.raw.sdkSpec.builder) !== "metric")
1498
1647
  return [];
1499
- const r = V(e.raw.sdkSpec.spec), t = [];
1500
- h(t, r == null ? void 0 : r.primaryMeasure);
1501
- for (const a of j(r == null ? void 0 : r.measures))
1502
- h(t, a);
1648
+ const n = k(e.raw.sdkSpec.spec), t = [];
1649
+ w(t, n == null ? void 0 : n.primaryMeasure);
1650
+ for (const i of H(n == null ? void 0 : n.measures))
1651
+ w(t, i);
1503
1652
  const o = X(
1504
- t.filter((a) => a.name && x(a, n)).map((a) => ({ raw: a, key: L(a), name: "" })),
1505
- (a) => a.key
1653
+ t.filter((i) => i.name && x(i, r)).map((i) => ({ raw: i, key: J(i), name: "" })),
1654
+ (i) => i.key
1506
1655
  );
1507
- return v(
1656
+ return j(
1508
1657
  o,
1509
- (a) => q(a.raw.label || a.raw.name || "metric")
1658
+ (i) => q(i.raw.label || i.raw.name || "metric")
1510
1659
  ), o;
1511
1660
  }
1512
- function Xe(e, n, r) {
1661
+ function rr(e, r, n) {
1513
1662
  var o;
1514
- const t = (o = e.raw.metricBindingKeys) == null ? void 0 : o[r];
1663
+ const t = (o = e.raw.metricBindingKeys) == null ? void 0 : o[n];
1515
1664
  if (typeof t == "string" && t.trim())
1516
1665
  return t;
1517
1666
  throw new Error(
1518
- `views.${e.raw.id}.metricBindingKeys must include a binding key for metric field ${n.raw.name}.`
1667
+ `views.${e.raw.id}.metricBindingKeys must include a binding key for metric field ${r.raw.name}.`
1519
1668
  );
1520
1669
  }
1521
- function en(e, n) {
1522
- if (n.length === 1)
1523
- return /* @__PURE__ */ new Set([n[0].name]);
1524
- const r = V(e.raw.sdkSpec.spec);
1525
- if (!C(r == null ? void 0 : r.primaryMeasure))
1670
+ function nr(e, r) {
1671
+ if (r.length === 1)
1672
+ return /* @__PURE__ */ new Set([r[0].name]);
1673
+ const n = k(e.raw.sdkSpec.spec);
1674
+ if (!C(n == null ? void 0 : n.primaryMeasure))
1526
1675
  return /* @__PURE__ */ new Set();
1527
- const t = L(U(r.primaryMeasure)), o = n.find((a) => a.key === t);
1676
+ const t = J(U(n.primaryMeasure)), o = r.find((i) => i.key === t);
1528
1677
  return o ? /* @__PURE__ */ new Set([o.name]) : /* @__PURE__ */ new Set();
1529
1678
  }
1530
- function nn(e) {
1531
- const n = /* @__PURE__ */ new Map();
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);
1679
+ function tr(e) {
1680
+ const r = /* @__PURE__ */ new Map();
1681
+ for (const n of e)
1682
+ for (const t of new Set(he(n.raw)))
1683
+ r.set(t, (r.get(t) || 0) + 1);
1535
1684
  return new Set(
1536
- Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
1685
+ Array.from(r.entries()).filter(([, n]) => n > 1).map(([n]) => n)
1537
1686
  );
1538
1687
  }
1539
1688
  function he(e) {
1540
- const n = (e.aggregate || "SUM").toUpperCase();
1689
+ const r = ke(e);
1541
1690
  return _([
1542
- `${n.toLowerCase()}_${e.name}`,
1543
- `${n}_${e.name}`,
1544
- `${e.name}_${n.toLowerCase()}`,
1545
- `${e.name}_${n}`,
1691
+ `${r.toLowerCase()}_${e.name}`,
1692
+ `${r}_${e.name}`,
1693
+ `${e.name}_${r.toLowerCase()}`,
1694
+ `${e.name}_${r}`,
1546
1695
  e.name
1547
1696
  ]);
1548
1697
  }
1549
- function rn(e) {
1550
- const n = /* @__PURE__ */ new Map();
1551
- for (const r of e)
1552
- n.set(r.raw.name, (n.get(r.raw.name) || 0) + 1);
1698
+ function or(e) {
1699
+ const r = /* @__PURE__ */ new Map();
1700
+ for (const n of e)
1701
+ r.set(n.raw.name, (r.get(n.raw.name) || 0) + 1);
1553
1702
  return new Set(
1554
- Array.from(n.entries()).filter(([, r]) => r > 1).map(([r]) => r)
1703
+ Array.from(r.entries()).filter(([, n]) => n > 1).map(([n]) => n)
1555
1704
  );
1556
1705
  }
1557
- function tn(e, n) {
1558
- const r = V(n.spec);
1559
- if (!r)
1706
+ function sr(e, r) {
1707
+ const n = k(r.spec);
1708
+ if (!n)
1560
1709
  return;
1561
- const t = B(n.builder);
1710
+ const t = B(r.builder);
1562
1711
  if (t === "records") {
1563
- for (const o of j(r.fields)) h(e, o);
1712
+ for (const o of H(n.fields)) w(e, o);
1564
1713
  return;
1565
1714
  }
1566
1715
  if (t === "sql") {
1567
- for (const o of j(r.fields)) h(e, o);
1716
+ for (const o of H(n.fields)) w(e, o);
1568
1717
  return;
1569
1718
  }
1570
1719
  if (t === "analysis" || t === "metric") {
1571
- h(e, r.primaryMeasure);
1572
- for (const o of j(r.measures)) h(e, o);
1573
- for (const o of j(r.dimensions)) h(e, o);
1574
- h(e, r.dateField);
1720
+ w(e, n.primaryMeasure);
1721
+ for (const o of H(n.measures)) w(e, o);
1722
+ for (const o of H(n.dimensions)) w(e, o);
1723
+ w(e, n.dateField);
1575
1724
  return;
1576
1725
  }
1577
1726
  if (t === "matrix") {
1578
- const o = pe(r.rows), a = pe(r.columns), l = j(r.values);
1579
- for (const y of o) le(e, y);
1580
- for (const y of a) le(e, y);
1581
- for (const y of l) {
1582
- const w = V(y);
1583
- h(e, w == null ? void 0 : w.field), h(e, w == null ? void 0 : w.measure);
1727
+ const o = le(n.rows), i = le(n.columns), l = H(n.values);
1728
+ for (const f of o) pe(e, f);
1729
+ for (const f of i) pe(e, f);
1730
+ for (const f of l) {
1731
+ const F = k(f);
1732
+ w(e, F == null ? void 0 : F.field), w(e, F == null ? void 0 : F.measure);
1584
1733
  }
1585
1734
  }
1586
1735
  }
1587
- function pe(e) {
1736
+ function le(e) {
1588
1737
  if (Array.isArray(e))
1589
1738
  return e;
1590
- const n = V(e);
1591
- return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
1739
+ const r = k(e);
1740
+ return Array.isArray(r == null ? void 0 : r.levels) ? r.levels : [];
1592
1741
  }
1593
- function le(e, n) {
1594
- var r;
1595
- if (C(n)) {
1596
- h(e, n);
1742
+ function pe(e, r) {
1743
+ var n;
1744
+ if (C(r)) {
1745
+ w(e, r);
1597
1746
  return;
1598
1747
  }
1599
- h(e, (r = V(n)) == null ? void 0 : r.field);
1748
+ w(e, (n = k(r)) == null ? void 0 : n.field);
1600
1749
  }
1601
1750
  function ce(e) {
1602
- var n, r, t, o;
1603
- 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";
1751
+ var r, n, t, o;
1752
+ return ((r = e == null ? void 0 : e.computation) == null ? void 0 : r.kind) === "presentation_only" || ((n = e == null ? void 0 : e.computation) == null ? void 0 : n.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
1753
  }
1605
- function on(e) {
1606
- const n = V(e) || {};
1607
- return G({
1754
+ function ar(e) {
1755
+ const r = k(e) || {};
1756
+ return O({
1608
1757
  id: e.id,
1609
1758
  title: e.title,
1610
1759
  purpose: e.purpose,
@@ -1613,13 +1762,13 @@ function on(e) {
1613
1762
  computation: e.computation,
1614
1763
  uxExpectations: e.uxExpectations,
1615
1764
  validation: e.validation,
1616
- sourceViewIds: n.sourceViewIds,
1617
- content: n.content,
1618
- description: n.description
1765
+ sourceViewIds: r.sourceViewIds,
1766
+ content: r.content,
1767
+ description: r.description
1619
1768
  });
1620
1769
  }
1621
- function h(e, n) {
1622
- C(n) && e.push(U(n));
1770
+ function w(e, r) {
1771
+ C(r) && e.push(U(r));
1623
1772
  }
1624
1773
  function U(e) {
1625
1774
  return {
@@ -1632,63 +1781,63 @@ function U(e) {
1632
1781
  ...e.source ? { source: e.source } : {}
1633
1782
  };
1634
1783
  }
1635
- function sn(e) {
1784
+ function ir(e) {
1636
1785
  if (!e.source)
1637
1786
  return;
1638
- const n = {
1787
+ const r = {
1639
1788
  ...e.source,
1640
1789
  ...e.sourceKey ? { sourceKey: e.sourceKey } : {}
1641
- }, r = $e(n);
1642
- if (r)
1790
+ }, n = $e(r);
1791
+ if (n)
1643
1792
  return {
1644
- raw: n,
1645
- key: r,
1646
- aliases: Ie(n),
1793
+ raw: r,
1794
+ key: n,
1795
+ aliases: Ie(r),
1647
1796
  name: ""
1648
1797
  };
1649
1798
  }
1650
1799
  function C(e) {
1651
- const n = V(e);
1652
- return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
1800
+ const r = k(e);
1801
+ return !!(r && typeof r.name == "string" && (typeof r.role == "string" || typeof r.dataType == "string" || typeof r.aggregate == "string" || r.source || r.sourceKey));
1653
1802
  }
1654
1803
  function we(e) {
1655
- const n = V(e);
1656
- return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
1804
+ const r = k(e);
1805
+ return !!(r && (typeof r.sourceKey == "string" || r.kind === "semantic" || typeof r.datasetName == "string" && typeof r.domainId == "string"));
1657
1806
  }
1658
- function O(e, n) {
1807
+ function G(e, r) {
1659
1808
  if (e === void 0)
1660
1809
  return "undefined";
1661
1810
  if (e === null || typeof e == "number" || typeof e == "boolean" || typeof e == "string")
1662
1811
  return JSON.stringify(e);
1663
1812
  if (Array.isArray(e))
1664
- return `[${e.map((o) => O(o, n)).join(", ")}]`;
1813
+ return `[${e.map((o) => G(o, r)).join(", ")}]`;
1665
1814
  if (C(e)) {
1666
- const o = x(U(e), n);
1815
+ const o = x(U(e), r);
1667
1816
  if (o) return `fields.${o}`;
1668
1817
  }
1669
1818
  if (we(e)) {
1670
- const o = Se(e, n);
1819
+ const o = Se(e, r);
1671
1820
  if (o) return `sources.${o}`;
1672
1821
  }
1673
- const r = V(e);
1674
- return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, a]) => `${JSON.stringify(o)}: ${O(a, n)}`).join(", ")} }` : JSON.stringify(e);
1822
+ const n = k(e);
1823
+ return n ? `{ ${Object.entries(n).filter(([, o]) => o !== void 0).map(([o, i]) => `${JSON.stringify(o)}: ${G(i, r)}`).join(", ")} }` : JSON.stringify(e);
1675
1824
  }
1676
- function k(e) {
1825
+ function R(e) {
1677
1826
  return JSON.stringify(e, null, 2);
1678
1827
  }
1679
- function x(e, n) {
1828
+ function x(e, r) {
1680
1829
  if (C(e))
1681
- return n.fieldNameByKey.get(L(U(e)));
1830
+ return r.fieldNameByKey.get(J(U(e)));
1682
1831
  }
1683
- function Se(e, n) {
1832
+ function Se(e, r) {
1684
1833
  if (we(e))
1685
- for (const r of Z(e)) {
1686
- const t = n.sourceNameByKey.get(r);
1834
+ for (const n of Z(e)) {
1835
+ const t = r.sourceNameByKey.get(n);
1687
1836
  if (t)
1688
1837
  return t;
1689
1838
  }
1690
1839
  }
1691
- function L(e) {
1840
+ function J(e) {
1692
1841
  return [
1693
1842
  e.sourceKey || "",
1694
1843
  e.name || "",
@@ -1696,38 +1845,38 @@ function L(e) {
1696
1845
  e.aggregate || ""
1697
1846
  ].join("|");
1698
1847
  }
1699
- function an(e, n) {
1700
- return !C(e) || !C(n) || e.name !== n.name ? !1 : ie(e).some(
1701
- (r) => ie(n).includes(r)
1848
+ function ur(e, r) {
1849
+ return !C(e) || !C(r) || e.name !== r.name ? !1 : ie(e).some(
1850
+ (n) => ie(r).includes(n)
1702
1851
  );
1703
1852
  }
1704
- function un(e) {
1853
+ function dr(e) {
1705
1854
  return C(e) && e.role === "id";
1706
1855
  }
1707
- function dn(e) {
1708
- const n = [], r = /* @__PURE__ */ new Map();
1856
+ function lr(e) {
1857
+ const r = [], n = /* @__PURE__ */ new Map();
1709
1858
  for (const t of e) {
1710
- const o = _(t.aliases.length ? t.aliases : [t.key]), a = o.map((l) => r.get(l)).find(K);
1711
- if (a) {
1712
- a.aliases = _([...a.aliases, ...o]);
1859
+ const o = _(t.aliases.length ? t.aliases : [t.key]), i = o.map((l) => n.get(l)).find(v);
1860
+ if (i) {
1861
+ i.aliases = _([...i.aliases, ...o]);
1713
1862
  continue;
1714
1863
  }
1715
- t.aliases = o, n.push(t);
1864
+ t.aliases = o, r.push(t);
1716
1865
  for (const l of o)
1717
- r.set(l, t);
1866
+ n.set(l, t);
1718
1867
  }
1719
- return n;
1868
+ return r;
1720
1869
  }
1721
- function pn(e) {
1722
- const n = /* @__PURE__ */ new Map();
1723
- for (const r of e)
1724
- for (const t of _([r.key, ...r.aliases])) {
1725
- const o = n.get(t);
1726
- if (o && o !== r.name)
1870
+ function pr(e) {
1871
+ const r = /* @__PURE__ */ new Map();
1872
+ for (const n of e)
1873
+ for (const t of _([n.key, ...n.aliases])) {
1874
+ const o = r.get(t);
1875
+ if (o && o !== n.name)
1727
1876
  throw new Error(`Source identity ${t} resolves to multiple generated sources.`);
1728
- n.set(t, r.name);
1877
+ r.set(t, n.name);
1729
1878
  }
1730
- return n;
1879
+ return r;
1731
1880
  }
1732
1881
  function _(e) {
1733
1882
  return Array.from(new Set(e.filter(Boolean)));
@@ -1736,24 +1885,24 @@ function $e(e) {
1736
1885
  return Z(e)[0] || de(e);
1737
1886
  }
1738
1887
  function Z(e) {
1739
- const n = V(e);
1740
- if (!n)
1888
+ const r = k(e);
1889
+ if (!r)
1741
1890
  return [];
1742
- const r = [];
1743
- if (typeof n.sourceKey == "string" && r.push(n.sourceKey), n.kind === "semantic" || n.datasetName) {
1744
- const t = typeof n.domainId == "string" ? n.domainId : "";
1745
- t && typeof n.datasetId == "string" && r.push(`semantic:${t}:datasetId:${n.datasetId}`), t && typeof n.datasetName == "string" && r.push(`semantic:${t}:datasetName:${n.datasetName}`);
1891
+ const n = [];
1892
+ if (typeof r.sourceKey == "string" && n.push(r.sourceKey), r.kind === "semantic" || r.datasetName) {
1893
+ const t = typeof r.domainId == "string" ? r.domainId : "";
1894
+ t && typeof r.datasetId == "string" && n.push(`semantic:${t}:datasetId:${r.datasetId}`), t && typeof r.datasetName == "string" && n.push(`semantic:${t}:datasetName:${r.datasetName}`);
1746
1895
  }
1747
- return r.length === 0 && r.push(de(e)), _(r);
1896
+ return n.length === 0 && n.push(de(e)), _(n);
1748
1897
  }
1749
1898
  function Ie(e) {
1750
1899
  return Z(e);
1751
1900
  }
1752
1901
  function de(e) {
1753
- const n = V(e);
1754
- return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
1902
+ const r = k(e);
1903
+ return r ? typeof r.sourceKey == "string" ? r.sourceKey : JSON.stringify(r) : "";
1755
1904
  }
1756
- function ln(e) {
1905
+ function cr(e) {
1757
1906
  return C(e) && ie(e)[0] || "";
1758
1907
  }
1759
1908
  function ie(e) {
@@ -1763,86 +1912,86 @@ function ie(e) {
1763
1912
  ]) : [];
1764
1913
  }
1765
1914
  function B(e) {
1766
- const n = String(e || "").replace(/^semaphor\./, "");
1767
- if (!["metric", "records", "analysis", "matrix", "sql"].includes(n))
1915
+ const r = String(e || "").replace(/^semaphor\./, "");
1916
+ if (!["metric", "records", "analysis", "matrix", "sql"].includes(r))
1768
1917
  throw new Error(`Unsupported sdkSpec builder: ${e}`);
1769
- return n;
1918
+ return r;
1770
1919
  }
1771
- function cn(e) {
1772
- const n = B(e);
1773
- return n === "records" || n === "sql";
1920
+ function mr(e) {
1921
+ const r = B(e);
1922
+ return r === "records" || r === "sql";
1774
1923
  }
1775
- function mn(e) {
1776
- const n = V(e);
1777
- return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
1924
+ function fr(e) {
1925
+ const r = k(e);
1926
+ return typeof (r == null ? void 0 : r.operator) == "string" ? r.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
1778
1927
  }
1779
- function v(e, n) {
1780
- const r = /* @__PURE__ */ new Map();
1928
+ function j(e, r) {
1929
+ const n = /* @__PURE__ */ new Map();
1781
1930
  for (const t of e) {
1782
- const o = n(t) || "item", a = r.get(o) || 0;
1783
- r.set(o, a + 1), t.name = a === 0 ? o : `${o}${a + 1}`;
1931
+ const o = r(t) || "item", i = n.get(o) || 0;
1932
+ n.set(o, i + 1), t.name = i === 0 ? o : `${o}${i + 1}`;
1784
1933
  }
1785
1934
  }
1786
- function X(e, n) {
1787
- const r = /* @__PURE__ */ new Set(), t = [];
1935
+ function X(e, r) {
1936
+ const n = /* @__PURE__ */ new Set(), t = [];
1788
1937
  for (const o of e) {
1789
- const a = n(o);
1790
- !a || r.has(a) || (r.add(a), t.push(o));
1938
+ const i = r(o);
1939
+ !i || n.has(i) || (n.add(i), t.push(o));
1791
1940
  }
1792
1941
  return t;
1793
1942
  }
1794
1943
  function q(e) {
1795
- const n = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
1796
- if (n.length === 0)
1944
+ const r = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
1945
+ if (r.length === 0)
1797
1946
  return "item";
1798
- const [r, ...t] = n, o = [
1799
- r.toLowerCase(),
1800
- ...t.map((a) => a.charAt(0).toUpperCase() + a.slice(1).toLowerCase())
1947
+ const [n, ...t] = r, o = [
1948
+ n.toLowerCase(),
1949
+ ...t.map((i) => i.charAt(0).toUpperCase() + i.slice(1).toLowerCase())
1801
1950
  ].join("");
1802
1951
  return /^[A-Za-z_$]/.test(o) ? o : `item${o}`;
1803
1952
  }
1804
1953
  function me(e) {
1805
- const n = q(e);
1806
- return n.charAt(0).toUpperCase() + n.slice(1);
1954
+ const r = q(e);
1955
+ return r.charAt(0).toUpperCase() + r.slice(1);
1807
1956
  }
1808
- function fn(e) {
1809
- const n = String(e).split(":");
1810
- return n[n.length - 1] || String(e);
1957
+ function yr(e) {
1958
+ const r = String(e).split(":");
1959
+ return r[r.length - 1] || String(e);
1811
1960
  }
1812
- function G(e) {
1813
- return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
1961
+ function O(e) {
1962
+ return Object.fromEntries(Object.entries(e).filter(([, r]) => r !== void 0));
1814
1963
  }
1815
- function V(e) {
1964
+ function k(e) {
1816
1965
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
1817
1966
  }
1818
- function j(e) {
1967
+ function H(e) {
1819
1968
  return Array.isArray(e) ? e : [];
1820
1969
  }
1821
1970
  function z(e) {
1822
1971
  return typeof e == "number" && Number.isFinite(e) ? e : void 0;
1823
1972
  }
1824
- function K(e) {
1973
+ function v(e) {
1825
1974
  return e !== void 0;
1826
1975
  }
1827
1976
  export {
1828
- Rn as CODEGEN_SUMMARY_SCHEMA_VERSION,
1977
+ xr as CODEGEN_SUMMARY_SCHEMA_VERSION,
1829
1978
  Re as CODEGEN_SUMMARY_VALIDATOR_VERSION,
1830
- Me as CONTRACT_MANIFEST_SCHEMA_VERSION,
1831
- hn as DEFAULT_GENERATED_CONTRACT_OUTPUT_DIR,
1979
+ xe as CONTRACT_MANIFEST_SCHEMA_VERSION,
1980
+ Sr as DEFAULT_GENERATED_CONTRACT_OUTPUT_DIR,
1832
1981
  fe as GENERATED_CONTRACT_SCHEMA_VERSION,
1833
- Mn as GENERATED_CONTRACT_TYPESCRIPT_FILES,
1834
- xn as REQUIRED_GENERATED_CONTRACT_FILES,
1835
- In as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
1836
- Fn as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
1837
- ke as assertValidCodegenSummary,
1838
- Nn as buildSemaphorGeneratedActiveInput,
1839
- Cn as buildSemaphorGeneratedInputOptionIntent,
1840
- On as buildSemaphorGeneratedViewExecutionRequest,
1841
- Gn as buildSemaphorGeneratedViewExecutionRequests,
1842
- Kn as evaluateSemaphorDataAppContractUpdatePolicy,
1843
- wn as generateSemaphorDataAppContract,
1844
- bn as isSemaphorDataAppCodegenSummary,
1845
- En as validateCodegenSummary,
1846
- Vn as validateSemaphorDataAppCodegenSummary,
1847
- An as validateSemaphorGeneratedContract
1982
+ Nr as GENERATED_CONTRACT_TYPESCRIPT_FILES,
1983
+ Cr as REQUIRED_GENERATED_CONTRACT_FILES,
1984
+ Vr as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_SCHEMA_VERSION,
1985
+ br as SEMAPHOR_DATA_APP_CODEGEN_SUMMARY_VALIDATOR_VERSION,
1986
+ Me as assertValidCodegenSummary,
1987
+ Gr as buildSemaphorGeneratedActiveInput,
1988
+ Or as buildSemaphorGeneratedInputOptionIntent,
1989
+ vr as buildSemaphorGeneratedViewExecutionRequest,
1990
+ Kr as buildSemaphorGeneratedViewExecutionRequests,
1991
+ Er as evaluateSemaphorDataAppContractUpdatePolicy,
1992
+ $r as generateSemaphorDataAppContract,
1993
+ kr as isSemaphorDataAppCodegenSummary,
1994
+ Ar as validateCodegenSummary,
1995
+ Mr as validateSemaphorDataAppCodegenSummary,
1996
+ jr as validateSemaphorGeneratedContract
1848
1997
  };