react-semaphor 0.1.506 → 0.1.508

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 (247) hide show
  1. package/DATA_APP_SDK.md +56 -0
  2. package/dist/analytics-protocol/index.cjs +1 -1
  3. package/dist/analytics-protocol/index.js +194 -172
  4. package/dist/appearance/index.cjs +1 -1
  5. package/dist/appearance/index.js +1 -1
  6. package/dist/appearance-runtime/index.cjs +1 -1
  7. package/dist/appearance-runtime/index.js +1 -1
  8. package/dist/brand-studio/index.cjs +2 -2
  9. package/dist/brand-studio/index.js +139 -119
  10. package/dist/briefings/index.cjs +1 -1
  11. package/dist/briefings/index.js +3 -3
  12. package/dist/chunks/appearance-context-DzqCdhB4.cjs +1 -0
  13. package/dist/chunks/{appearance-context-XviHOhWJ.js → appearance-context-VJdrKi7r.js} +2 -1
  14. package/dist/chunks/{appearance-runtime-provider-D0xVQWnH.js → appearance-runtime-provider-CC4HT2Gi.js} +2 -2
  15. package/dist/chunks/{appearance-runtime-provider-Ca8rxO86.cjs → appearance-runtime-provider-D5pkvgE4.cjs} +1 -1
  16. package/dist/chunks/calculated-field-identity-BiTGmnST.cjs +1 -0
  17. package/dist/chunks/calculated-field-identity-CJL54uFx.js +1373 -0
  18. package/dist/chunks/{constants-NUleP4DY.js → card-config-utils-Bq1enstT.js} +260 -260
  19. package/dist/chunks/card-config-utils-CMO4_zVs.cjs +1 -0
  20. package/dist/chunks/{dashboard-briefing-launcher-DXTpU85p.js → dashboard-briefing-launcher-B9l0ZAbv.js} +12 -12
  21. package/dist/chunks/{dashboard-briefing-launcher-C8nDSDnV.cjs → dashboard-briefing-launcher-C4zsM3Hd.cjs} +1 -1
  22. package/dist/chunks/{dashboard-controls-CyL0yimg.js → dashboard-controls-BCQv4xWM.js} +16 -14
  23. package/dist/chunks/dashboard-controls-CWwllVOe.cjs +52 -0
  24. package/dist/chunks/{dashboard-json-5Jr3RudV.js → dashboard-json-BtU_q_0A.js} +9 -9
  25. package/dist/chunks/dashboard-json-DVj2xLsH.cjs +1 -0
  26. package/dist/chunks/edit-dashboard-visual-CO2IVBOq.cjs +172 -0
  27. package/dist/chunks/{edit-dashboard-visual-C7X-um9g.js → edit-dashboard-visual-RgFUx-py.js} +1986 -1990
  28. package/dist/chunks/{editor-action-buttons-CcDm8nA5.cjs → editor-action-buttons-BE8Fby6n.cjs} +2 -2
  29. package/dist/chunks/{editor-action-buttons-C5Wja_J4.js → editor-action-buttons-D-MaqTIs.js} +6 -6
  30. package/dist/chunks/field-aggregations-DUb0NU6c.js +1229 -0
  31. package/dist/chunks/field-aggregations-jSi77h9Z.cjs +1 -0
  32. package/dist/chunks/{field-dependencies-DVl2p1Nm.js → field-dependencies-Cl97kkHy.js} +30 -34
  33. package/dist/chunks/{field-dependencies-r_U0CGQ-.cjs → field-dependencies-DIab72rQ.cjs} +1 -1
  34. package/dist/chunks/{index-BVr4fcCB.js → index-0pdaQ9e1.js} +5 -5
  35. package/dist/chunks/index-BaIrLSBb.cjs +1422 -0
  36. package/dist/chunks/{index-De2QNsqV.js → index-ByiS9sB4.js} +45343 -43665
  37. package/dist/chunks/{index-C9KXfCkC.js → index-CLIro-EG.js} +3 -0
  38. package/dist/chunks/index-Cx3qmRUB.cjs +1 -0
  39. package/dist/chunks/{index-BlYf8gNa.cjs → index-DhlVxvyI.cjs} +1 -1
  40. package/dist/chunks/{matrix-card-DACDwdTq.js → matrix-card-CnKQpnsj.js} +1 -1
  41. package/dist/chunks/{matrix-card-CRXcmAjp.cjs → matrix-card-U4c72doZ.cjs} +1 -1
  42. package/dist/chunks/{matrix-control-sources-ClQzIk7E.js → matrix-control-sources-CRRdP03Q.js} +165 -134
  43. package/dist/chunks/matrix-control-sources-FjxGIbqk.cjs +1 -0
  44. package/dist/chunks/{matrix-formatter-7GLTcBuy.cjs → matrix-formatter-CveLJo6S.cjs} +1 -1
  45. package/dist/chunks/{matrix-formatter-xsq7n_e6.js → matrix-formatter-ZVS5QOuq.js} +2 -2
  46. package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +1 -0
  47. package/dist/chunks/matrix-member-presentation-CzGZJd3a.js +182 -0
  48. package/dist/chunks/matrix-operation-contract-DoiWTUbT.cjs +1 -0
  49. package/dist/chunks/matrix-operation-contract-xL8IhFzp.js +1802 -0
  50. package/dist/chunks/{pivot-header-presentation-3wqWChFd.cjs → pivot-header-presentation-Cxz8-06f.cjs} +1 -1
  51. package/dist/chunks/{pivot-header-presentation-D44ODZGn.js → pivot-header-presentation-DVylCBHB.js} +2 -2
  52. package/dist/chunks/{pivot-result-lifecycle-DZ0ZSMoM.cjs → pivot-result-lifecycle-BiERyXnS.cjs} +1 -1
  53. package/dist/chunks/{pivot-result-lifecycle-BSmqVkVG.js → pivot-result-lifecycle-CmjpW7qG.js} +1 -1
  54. package/dist/chunks/{report-preferences-dialog-xADifRXs.js → report-preferences-dialog-BbkXcnnn.js} +4 -4
  55. package/dist/chunks/report-preferences-dialog-C9rpWgQZ.cjs +1 -0
  56. package/dist/chunks/{search-BHsQIWBV.js → selection-reducer-B94WgZ9V.js} +55 -11
  57. package/dist/chunks/selection-reducer-CGKKsaPa.cjs +26 -0
  58. package/dist/chunks/{semantic-format-BhIL1PXP.cjs → semantic-format-BzH69TRq.cjs} +1 -1
  59. package/dist/chunks/{semantic-format-C3amkGmY.js → semantic-format-CBlRO8Aw.js} +1 -1
  60. package/dist/chunks/{switch-DHGiC0aU.js → switch-CD4uGTZI.js} +7450 -7694
  61. package/dist/chunks/switch-iC1x2dcE.cjs +134 -0
  62. package/dist/chunks/token-types-Ahh5u4iT.cjs +1 -0
  63. package/dist/chunks/token-types-CPde8_LG.js +8 -0
  64. package/dist/chunks/{update-policy-Cc9h57pA.cjs → update-policy-COjFudhl.cjs} +1 -1
  65. package/dist/chunks/{update-policy-eTcz52jO.js → update-policy-D9q1Tz8k.js} +1 -1
  66. package/dist/dashboard/index.cjs +1 -1
  67. package/dist/dashboard/index.js +1 -1
  68. package/dist/dashboard-authoring/index.cjs +3 -3
  69. package/dist/dashboard-authoring/index.js +734 -622
  70. package/dist/data-app-builder/index.cjs +1 -1
  71. package/dist/data-app-builder/index.js +3 -3
  72. package/dist/data-app-codegen/index.cjs +1 -1
  73. package/dist/data-app-codegen/index.js +2 -2
  74. package/dist/data-app-codegen-node/index.cjs +94 -92
  75. package/dist/data-app-codegen-node/index.js +337 -333
  76. package/dist/data-app-sdk/index.cjs +9 -9
  77. package/dist/data-app-sdk/index.js +1091 -969
  78. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  79. package/dist/data-app-sdk-adapters/index.js +104 -96
  80. package/dist/data-app-sdk-validation/index.cjs +1 -1
  81. package/dist/data-app-sdk-validation/index.js +2 -2
  82. package/dist/format-utils/index.cjs +1 -1
  83. package/dist/format-utils/index.js +8 -8
  84. package/dist/index.cjs +1 -1
  85. package/dist/index.js +15 -15
  86. package/dist/style.css +1 -1
  87. package/dist/surfboard/index.cjs +1 -1
  88. package/dist/surfboard/index.js +2 -2
  89. package/dist/types/brand-studio/brand-studio-draft.d.ts +3 -1
  90. package/dist/types/components/dashboard/card-selection-pill.d.ts +5 -0
  91. package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
  92. package/dist/types/components/dashboard/drill-breadcrumb.d.ts +1 -0
  93. package/dist/types/components/dashboard/drill-navigation-controls.d.ts +3 -3
  94. package/dist/types/components/interactions/applied-filters-display.d.ts +6 -1
  95. package/dist/types/components/interactions/click-to-filter-review-dialog.d.ts +21 -0
  96. package/dist/types/components/interactions/dashboard-drill-host.d.ts +13 -0
  97. package/dist/types/components/interactions/filter-badge-tooltip.d.ts +4 -4
  98. package/dist/types/components/interactions/insight-modal.d.ts +4 -14
  99. package/dist/types/components/interactions/insight-viewer.d.ts +7 -19
  100. package/dist/types/components/interactions/interactions-sheet.d.ts +6 -0
  101. package/dist/types/components/interactions/panels/click-to-filter-panel.d.ts +20 -0
  102. package/dist/types/components/interactions/reusable/interaction-selection-popover.d.ts +2 -2
  103. package/dist/types/components/interactions/sheet/action-editor.d.ts +17 -0
  104. package/dist/types/components/interactions/sheet/action-meta.d.ts +45 -0
  105. package/dist/types/components/interactions/sheet/action-picker.d.ts +7 -0
  106. package/dist/types/components/interactions/sheet/click-outcome-preview.d.ts +10 -0
  107. package/dist/types/components/interactions/sheet/interactions-home.d.ts +28 -0
  108. package/dist/types/components/interactions/sheet/sheet-parts.d.ts +37 -0
  109. package/dist/types/components/surfboard/filter/dashboard-filter-mapping-panel.d.ts +28 -1
  110. package/dist/types/components/surfboard/filter/selection-chip.d.ts +11 -0
  111. package/dist/types/components/surfboard/filter/selection-filter-section.d.ts +4 -0
  112. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +3 -0
  113. package/dist/types/components/ui/resizable.d.ts +1 -1
  114. package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +13 -1
  115. package/dist/types/components/visual/matrix-table/matrix-selection-click.d.ts +6 -0
  116. package/dist/types/data-app-sdk/adapters.d.ts +3 -2
  117. package/dist/types/data-app-sdk/builders.d.ts +2 -1
  118. package/dist/types/data-app-sdk/contracts.d.ts +44 -2
  119. package/dist/types/data-app-sdk/index.d.ts +1 -0
  120. package/dist/types/data-app-sdk/query-request.d.ts +7 -2
  121. package/dist/types/data-app-sdk/selection.d.ts +2 -0
  122. package/dist/types/index.cjs +1 -1
  123. package/dist/types/index.js +24 -23
  124. package/dist/types/lib/appearance/types.d.ts +3 -1
  125. package/dist/types/lib/briefings/briefing-attachment-model.d.ts +0 -2
  126. package/dist/types/lib/contexts/interactions-popover-context.d.ts +1 -8
  127. package/dist/types/lib/dashboard/click-to-filter-card-references.d.ts +23 -0
  128. package/dist/types/lib/dashboard-inputs/build-normalized-dashboard-inputs.d.ts +16 -2
  129. package/dist/types/lib/dashboard-inputs/build-selection-dashboard-inputs.d.ts +31 -0
  130. package/dist/types/lib/dashboard-inputs/click-to-filter-emitted-fields.d.ts +17 -0
  131. package/dist/types/lib/dashboard-inputs/click-to-filter-mapping-draft.d.ts +99 -0
  132. package/dist/types/lib/dashboard-inputs/click-to-filter-sheet-reach.d.ts +12 -0
  133. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +18 -1
  134. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-candidate-metadata.d.ts +4 -1
  135. package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +10 -0
  136. package/dist/types/lib/dashboard-inputs/dashboard-input-snapshot.d.ts +8 -1
  137. package/dist/types/lib/dashboard-inputs/index.d.ts +1 -0
  138. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +18 -7
  139. package/dist/types/lib/dashboard-inputs/resolve-field-date-comparison-coverage.d.ts +5 -2
  140. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +77 -0
  141. package/dist/types/lib/dashboard-inputs/selection-targets.d.ts +26 -0
  142. package/dist/types/lib/dashboard-inputs/transient-input-context.d.ts +102 -0
  143. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +50 -0
  144. package/dist/types/lib/dashboard-navigation/describe-carried-context.d.ts +11 -0
  145. package/dist/types/lib/dashboard-navigation/index.d.ts +1 -0
  146. package/dist/types/lib/dashboard-navigation/navigation-state.d.ts +120 -0
  147. package/dist/types/lib/dashboard-navigation/run-one-off-drill.d.ts +11 -0
  148. package/dist/types/lib/dashboard-navigation/use-transient-contexts.d.ts +17 -0
  149. package/dist/types/lib/dashboard-view-state/card-view-state.d.ts +48 -0
  150. package/dist/types/lib/dashboard-view-state/drill-path.d.ts +20 -0
  151. package/dist/types/lib/dashboard-view-state/index.d.ts +2 -0
  152. package/dist/types/lib/download-pdf.d.ts +0 -3
  153. package/dist/types/lib/formatters/metric-formatting.d.ts +1 -1
  154. package/dist/types/lib/hooks/ai/dashboard-context.d.ts +15 -8
  155. package/dist/types/lib/hooks/chartjs/use-chart-blur.d.ts +10 -2
  156. package/dist/types/lib/hooks/interactions/{use-event-engine.d.ts → use-drill-actions.d.ts} +28 -7
  157. package/dist/types/lib/hooks/selection/use-active-selections.d.ts +15 -0
  158. package/dist/types/lib/hooks/selection/use-click-to-filter-mapping-draft.d.ts +20 -0
  159. package/dist/types/lib/hooks/selection/use-selection-click.d.ts +34 -0
  160. package/dist/types/lib/hooks/selection/use-selection-gestures.d.ts +38 -0
  161. package/dist/types/lib/hooks/selection/use-table-row-selection.d.ts +46 -0
  162. package/dist/types/lib/hooks/use-dashboard-card.d.ts +0 -2
  163. package/dist/types/lib/hooks/use-dashboard-filter-mapping-candidates.d.ts +18 -0
  164. package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +0 -1
  165. package/dist/types/lib/hooks/use-dashboard.d.ts +1 -3
  166. package/dist/types/lib/hooks/use-interactions-popover.d.ts +1 -8
  167. package/dist/types/lib/hooks/use-resolved-card-config.d.ts +6 -0
  168. package/dist/types/lib/interactions/click-outcome.d.ts +25 -0
  169. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +3 -1
  170. package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +1 -1
  171. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +7 -0
  172. package/dist/types/lib/interactions/interaction-utils.d.ts +17 -1
  173. package/dist/types/lib/matrix-table/build-matrix-drill-to-detail.d.ts +15 -0
  174. package/dist/types/lib/matrix-table/matrix-card-interactions.d.ts +14 -3
  175. package/dist/types/lib/query-context/build-card-query-context.d.ts +19 -8
  176. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -3
  177. package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +12 -4
  178. package/dist/types/lib/query-context/compile-selection-filters.d.ts +5 -0
  179. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +46 -0
  180. package/dist/types/lib/query-context/filter-group-utils.d.ts +3 -0
  181. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +29 -0
  182. package/dist/types/lib/selection/click-to-filter-authoring-support.d.ts +9 -0
  183. package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
  184. package/dist/types/lib/selection/selection-labels.d.ts +3 -0
  185. package/dist/types/lib/selection/selection-notices.d.ts +9 -0
  186. package/dist/types/lib/selection/selection-reducer.d.ts +46 -0
  187. package/dist/types/lib/stores/dashboard-store.d.ts +62 -17
  188. package/dist/types/lib/stores/editor-store.d.ts +1 -2
  189. package/dist/types/lib/stores/index.d.ts +0 -2
  190. package/dist/types/lib/types/common-types.d.ts +60 -6
  191. package/dist/types/lib/types/explorer-types.d.ts +1 -22
  192. package/dist/types/lib/types/interaction-types.d.ts +6 -198
  193. package/dist/types/lib/utils/calculate-context-aware-filters.d.ts +21 -12
  194. package/dist/types/lib/utils/card-utils.d.ts +11 -0
  195. package/dist/types/lib/utils/date-hierarchy-utils.d.ts +3 -1
  196. package/dist/types/lib/utils/drag-and-drop-utils.d.ts +1 -1
  197. package/dist/types/lib/utils/interaction-icons.d.ts +1 -1
  198. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +32 -32
  199. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  200. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +100 -0
  201. package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +12 -0
  202. package/dist/types/shared/dashboard-authoring/apply-group-by-override.d.ts +19 -0
  203. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +88 -0
  204. package/dist/types/shared/dashboard-authoring/contracts.d.ts +8 -0
  205. package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
  206. package/dist/types/shared/dashboard-authoring/linked-click-to-filter-overrides.d.ts +32 -0
  207. package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
  208. package/package.json +1 -1
  209. package/src/data-app-sdk/README.md +58 -1
  210. package/dist/chunks/appearance-context-tNjvTJj3.cjs +0 -1
  211. package/dist/chunks/calculated-field-identity-BTpUqfEu.js +0 -1276
  212. package/dist/chunks/calculated-field-identity-rMuXuzEY.cjs +0 -1
  213. package/dist/chunks/constants-vtu7_IUo.cjs +0 -1
  214. package/dist/chunks/dashboard-controls-DlxeddZN.cjs +0 -52
  215. package/dist/chunks/dashboard-json-DhS4yJfc.cjs +0 -1
  216. package/dist/chunks/edit-dashboard-visual-X3OCnivL.cjs +0 -172
  217. package/dist/chunks/field-aggregations-BU_3gHKR.js +0 -957
  218. package/dist/chunks/field-aggregations-CDCamEsQ.cjs +0 -1
  219. package/dist/chunks/index-C8XCKzB6.cjs +0 -1
  220. package/dist/chunks/index-DSa6RSdg.cjs +0 -1417
  221. package/dist/chunks/matrix-control-sources-CeC5EMyq.cjs +0 -1
  222. package/dist/chunks/matrix-member-presentation-E2B4k3ws.cjs +0 -1
  223. package/dist/chunks/matrix-member-presentation-qiHxv67e.js +0 -105
  224. package/dist/chunks/matrix-operation-contract-Cqy4EW2H.js +0 -1638
  225. package/dist/chunks/matrix-operation-contract-D9dLX-Wr.cjs +0 -1
  226. package/dist/chunks/report-preferences-dialog-7Vsc_fsG.cjs +0 -1
  227. package/dist/chunks/search-BqqhaMx9.cjs +0 -26
  228. package/dist/chunks/switch-BytP6QY8.cjs +0 -139
  229. package/dist/types/components/interactions/configuration-popover.d.ts +0 -1
  230. package/dist/types/components/interactions/interaction-card.d.ts +0 -59
  231. package/dist/types/components/interactions/interaction-event-handler.d.ts +0 -11
  232. package/dist/types/components/interactions/interactions-list.d.ts +0 -50
  233. package/dist/types/components/interactions/panels/cross-filter-panel.d.ts +0 -24
  234. package/dist/types/components/interactions/panels/inline-drill-panel.d.ts +0 -24
  235. package/dist/types/components/interactions/selectors/action-selector.d.ts +0 -31
  236. package/dist/types/components/interactions/selectors/trigger-selector.d.ts +0 -38
  237. package/dist/types/components/surfboard/filter/click-filter-section.d.ts +0 -5
  238. package/dist/types/lib/interactions/build-interaction-event.d.ts +0 -25
  239. package/dist/types/lib/interactions/convert-click-filters-to-filter-group.d.ts +0 -10
  240. package/dist/types/lib/interactions/execute-interaction-event.d.ts +0 -80
  241. package/dist/types/lib/interactions/field-utils.d.ts +0 -11
  242. package/dist/types/lib/interactions/handle-chart-click.d.ts +0 -75
  243. package/dist/types/lib/interactions/linked-interaction-utils.d.ts +0 -14
  244. package/dist/types/lib/interactions/source-card-filter-utils.d.ts +0 -9
  245. package/dist/types/lib/stores/drill-actions.d.ts +0 -139
  246. package/dist/types/lib/stores/interaction-store.d.ts +0 -113
  247. package/dist/types/lib/stores/pointer-interaction-store.d.ts +0 -18
@@ -1,8 +1,8 @@
1
- import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/matrix-operation-contract-Cqy4EW2H.js";
2
- import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-eTcz52jO.js";
3
- import { C as Mn, e as Cn, R as On, f as Gn, g as xn, h as Nn, i as En, j as An, v as jn, d as vn } from "../chunks/update-policy-eTcz52jO.js";
1
+ import { S as Vn, a as Fn, i as bn, v as kn } from "../chunks/matrix-operation-contract-xL8IhFzp.js";
2
+ import { c as ke, G as fe, a as Re, b as Me } from "../chunks/update-policy-D9q1Tz8k.js";
3
+ import { C as Mn, e as Cn, R as On, f as Gn, g as xn, h as Nn, i as En, j as vn, v as An, d as Hn } from "../chunks/update-policy-D9q1Tz8k.js";
4
4
  import { createHash as ye } from "node:crypto";
5
- const wn = "src/semaphor/generated", v = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
5
+ const wn = "src/semaphor/generated", H = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
6
6
  // Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
7
7
  `;
8
8
  function Sn(e, n = {}) {
@@ -27,7 +27,7 @@ function Sn(e, n = {}) {
27
27
  files: a,
28
28
  manifest: o,
29
29
  contentHash: String(o.generatedContentHash || ""),
30
- usageExample: je(r),
30
+ usageExample: Ae(r),
31
31
  warnings: r.warnings,
32
32
  stats: {
33
33
  inputCount: r.inputs.length,
@@ -39,30 +39,30 @@ function Sn(e, n = {}) {
39
39
  };
40
40
  }
41
41
  function Ce(e) {
42
- var d, p, m, i, l, g, h, I, $, M, b, C;
42
+ var d, l, m, i, c, h, y, V, S, R, k, O;
43
43
  const n = [], r = [];
44
44
  for (const s of e.inputs) {
45
- w(r, s.fieldRef);
46
- for (const V of s.bindings || [])
47
- w(r, V.fieldRef);
48
- w(r, (d = s.optionQuery) == null ? void 0 : d.valueFieldRef), w(r, (p = s.optionQuery) == null ? void 0 : p.labelFieldRef), w(r, (m = s.optionQuery) == null ? void 0 : m.filterFieldRef), B(r, (i = s.optionQuery) == null ? void 0 : i.spec);
45
+ g(r, s.fieldRef);
46
+ for (const I of s.bindings || [])
47
+ g(r, I.fieldRef);
48
+ g(r, (d = s.optionQuery) == null ? void 0 : d.valueFieldRef), g(r, (l = s.optionQuery) == null ? void 0 : l.labelFieldRef), g(r, (m = s.optionQuery) == null ? void 0 : m.filterFieldRef), B(r, (i = s.optionQuery) == null ? void 0 : i.spec);
49
49
  }
50
50
  for (const s of e.filterContracts) {
51
- w(r, s.fieldRef), w(r, (l = s.optionQuery) == null ? void 0 : l.valueFieldRef), w(r, (g = s.optionQuery) == null ? void 0 : g.labelFieldRef), w(r, (h = s.optionQuery) == null ? void 0 : h.filterFieldRef), B(r, (I = s.optionQuery) == null ? void 0 : I.spec);
52
- for (const V of s.bindings || [])
53
- w(r, V.fieldRef);
51
+ g(r, s.fieldRef), g(r, (c = s.optionQuery) == null ? void 0 : c.valueFieldRef), g(r, (h = s.optionQuery) == null ? void 0 : h.labelFieldRef), g(r, (y = s.optionQuery) == null ? void 0 : y.filterFieldRef), B(r, (V = s.optionQuery) == null ? void 0 : V.spec);
52
+ for (const I of s.bindings || [])
53
+ g(r, I.fieldRef);
54
54
  }
55
55
  for (const s of e.views) {
56
- for (const V of s.fields || [])
57
- w(r, V);
58
- B(r, ($ = s.sdkSpec) == null ? void 0 : $.spec), B(r, s.visualSpec);
56
+ for (const I of s.fields || [])
57
+ g(r, I);
58
+ B(r, (S = s.sdkSpec) == null ? void 0 : S.spec), B(r, s.visualSpec);
59
59
  }
60
60
  const t = e.implementationChecklist || {};
61
61
  for (const s of Object.values(t.bindingsByView || {}))
62
- for (const V of Array.isArray(s) ? s : [])
63
- w(r, V.fieldRef), w(r, V.optionValueField), w(r, V.optionLabelField);
62
+ for (const I of Array.isArray(s) ? s : [])
63
+ g(r, I.fieldRef), g(r, I.optionValueField), g(r, I.optionLabelField);
64
64
  for (const s of t.requiredInputOptions || [])
65
- w(r, s.visibleLabelField), w(r, s.optionValueField), w(r, s.runtimeFilterField);
65
+ g(r, s.visibleLabelField), g(r, s.optionValueField), g(r, s.runtimeFilterField);
66
66
  const o = pn(
67
67
  [
68
68
  ...e.sources.map((s) => ({
@@ -75,9 +75,9 @@ function Ce(e) {
75
75
  ]
76
76
  );
77
77
  P(o, (s) => {
78
- const V = F(s.raw);
79
- return K(
80
- s.raw.label || (V == null ? void 0 : V.datasetName) || (V == null ? void 0 : V.datasetId) || (V == null ? void 0 : V.name) || s.raw.kind || "source"
78
+ const I = b(s.raw);
79
+ 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
81
  );
82
82
  });
83
83
  const a = ln(o), u = X(
@@ -90,18 +90,18 @@ function Ce(e) {
90
90
  );
91
91
  P(
92
92
  u,
93
- (s) => K([
93
+ (s) => q([
94
94
  s.raw.sourceKey ? yn(s.raw.sourceKey) : "",
95
95
  s.raw.aggregate ? s.raw.aggregate.toLowerCase() : "",
96
96
  s.raw.name
97
97
  ].filter(Boolean).join("_"))
98
98
  );
99
- const c = new Map(u.map((s) => [s.key, s.name])), S = e.inputs.map((s) => ({
99
+ const p = new Map(u.map((s) => [s.key, s.name])), w = e.inputs.map((s) => ({
100
100
  raw: s,
101
- name: K(s.id || s.label || "input")
101
+ name: q(s.id || s.label || "input")
102
102
  }));
103
- P(S, (s) => s.name);
104
- const f = S.filter((s) => !!s.raw.optionQuery).map((s) => ({
103
+ P(w, (s) => s.name);
104
+ const f = w.filter((s) => !!s.raw.optionQuery).map((s) => ({
105
105
  input: s,
106
106
  name: `${s.name}Options`,
107
107
  raw: s.raw.optionQuery
@@ -109,38 +109,38 @@ function Ce(e) {
109
109
  P(f, (s) => s.name);
110
110
  for (const s of f)
111
111
  un(s.raw.labelFieldRef, s.raw.valueFieldRef) && dn(s.raw.valueFieldRef) && n.push(
112
- `Input option query ${((M = s.raw.spec) == null ? void 0 : M.inputId) || s.input.raw.id || s.name} uses identifier field ${s.raw.valueFieldRef.name} as both label and value. It can execute, but the UI will show key values unless the semantic model exposes a human-readable label through a modeled relationship.`
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.`
113
113
  );
114
- const y = e.views.filter(
114
+ const $ = e.views.filter(
115
115
  (s) => {
116
- var V, T;
117
- return !!((V = s.sdkSpec) != null && V.builder && ((T = s.sdkSpec) != null && T.spec));
116
+ var I, T;
117
+ return !!((I = s.sdkSpec) != null && I.builder && ((T = s.sdkSpec) != null && T.spec));
118
118
  }
119
119
  ).map((s) => ({
120
120
  raw: s,
121
- name: K(s.id || s.title || "query")
121
+ name: q(s.id || s.title || "query")
122
122
  }));
123
- P(y, (s) => s.name);
124
- const O = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => sn(s));
123
+ P($, (s) => s.name);
124
+ const F = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => sn(s));
125
125
  for (const s of e.views)
126
- (!("sdkSpec" in s) || !((b = s.sdkSpec) != null && b.builder) || !((C = s.sdkSpec) != null && C.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
126
+ (!("sdkSpec" in s) || !((k = s.sdkSpec) != null && k.builder) || !((O = s.sdkSpec) != null && O.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
127
127
  return Oe({
128
- inputs: S,
129
- views: y,
128
+ inputs: w,
129
+ views: $,
130
130
  filterContracts: e.filterContracts
131
131
  }), {
132
132
  summary: e,
133
133
  title: e.title || "Semaphor Data App",
134
134
  sources: o,
135
135
  fields: u,
136
- inputs: S,
136
+ inputs: w,
137
137
  optionQueries: f,
138
- views: y,
139
- presentationViews: O,
138
+ views: $,
139
+ presentationViews: F,
140
140
  filterContracts: e.filterContracts,
141
141
  checklist: t,
142
142
  sourceNameByKey: a,
143
- fieldNameByKey: c,
143
+ fieldNameByKey: p,
144
144
  warnings: n
145
145
  };
146
146
  }
@@ -153,27 +153,27 @@ function Oe({
153
153
  for (const [a, u] of r.entries()) {
154
154
  if (!t.has(u.inputId))
155
155
  throw new Error(`filterContracts.${a}.inputId must reference a generated input.`);
156
- const c = new Set(u.appliesToViewIds || []), S = new Set(u.notAppliedToViewIds || []);
157
- for (const [f, y] of (u.appliesToViewIds || []).entries())
158
- if (!o.has(y))
156
+ const p = new Set(u.appliesToViewIds || []), w = new Set(u.notAppliedToViewIds || []);
157
+ for (const [f, $] of (u.appliesToViewIds || []).entries())
158
+ if (!o.has($))
159
159
  throw new Error(
160
160
  `filterContracts.${a}.appliesToViewIds.${f} must reference an executable generated view.`
161
161
  );
162
- for (const [f, y] of (u.notAppliedToViewIds || []).entries())
163
- if (!o.has(y))
162
+ for (const [f, $] of (u.notAppliedToViewIds || []).entries())
163
+ if (!o.has($))
164
164
  throw new Error(
165
165
  `filterContracts.${a}.notAppliedToViewIds.${f} must reference an executable generated view.`
166
166
  );
167
- for (const [f, y] of (u.bindings || []).entries()) {
168
- if (!o.has(y.viewId))
167
+ for (const [f, $] of (u.bindings || []).entries()) {
168
+ if (!o.has($.viewId))
169
169
  throw new Error(
170
170
  `filterContracts.${a}.bindings.${f}.viewId must reference an executable generated view.`
171
171
  );
172
- if (!c.has(y.viewId))
172
+ if (!p.has($.viewId))
173
173
  throw new Error(
174
174
  `filterContracts.${a}.bindings.${f}.viewId must be included in appliesToViewIds.`
175
175
  );
176
- if (S.has(y.viewId))
176
+ if (w.has($.viewId))
177
177
  throw new Error(
178
178
  `filterContracts.${a}.bindings.${f}.viewId must not be listed in notAppliedToViewIds.`
179
179
  );
@@ -182,7 +182,7 @@ function Oe({
182
182
  }
183
183
  function Ge(e) {
184
184
  return {
185
- "sources.ts": Ke(e),
185
+ "sources.ts": qe(e),
186
186
  "fields.ts": Te(e),
187
187
  "inputs.ts": Qe(e),
188
188
  "queries.ts": De(e),
@@ -208,7 +208,7 @@ function xe({
208
208
  },
209
209
  generatedContentHash: Ne(n),
210
210
  codegenSummaryValidatorVersion: Re,
211
- codegenSummaryHash: Ae(e.summary),
211
+ codegenSummaryHash: ve(e.summary),
212
212
  codegenSummary: e.summary
213
213
  };
214
214
  }
@@ -229,7 +229,7 @@ function Ee(e) {
229
229
  "Use the app-facing exports from `index.ts`:",
230
230
  "",
231
231
  "- `queries`: generated governed query factories.",
232
- "- `queryOptionsForView`: active-input wiring for each generated view.",
232
+ "- `queryOptionsForView`: scalar-input and explicit selection wiring for each generated view.",
233
233
  "- `rowsForView`: table/records row readers.",
234
234
  "- `rowValuesForView`: friendly row object readers for chart/table views.",
235
235
  "- `metricValuesForView`: friendly metric-value readers.",
@@ -240,6 +240,8 @@ function Ee(e) {
240
240
  "- `semaphorGeneratedContractMetadata`: generated view/input metadata and presentation-only views.",
241
241
  "",
242
242
  "Start with these exports before opening large generated internals such as `metadata.ts`.",
243
+ "",
244
+ "For click-to-filter behavior, create one `semaphor.selection({ id, fields })` per source chart, call `useSemaphorSelection`, render its tuples as removable chips in app code, and pass the target view's selection handles as the second argument to `queryOptionsForView.<view>(inputHandles, selections)`. Do not mix selection handles into `appInputSpecs` or scalar input arrays.",
243
245
  ""
244
246
  ];
245
247
  return e.views.length > 0 && (n.push("Generated executable views:"), e.views.forEach((r) => {
@@ -250,7 +252,7 @@ function Ee(e) {
250
252
  `)}
251
253
  `;
252
254
  }
253
- function Ae(e) {
255
+ function ve(e) {
254
256
  return `sha256:${ye("sha256").update(ae(e)).digest("hex")}`;
255
257
  }
256
258
  function ae(e) {
@@ -261,9 +263,9 @@ function ae(e) {
261
263
  const n = e;
262
264
  return `{${Object.keys(n).sort().filter((t) => n[t] !== void 0).map((t) => `${JSON.stringify(t)}:${ae(n[t])}`).join(",")}}`;
263
265
  }
264
- function je(e) {
266
+ function Ae(e) {
265
267
  const n = e.views.find(
266
- (f) => A(f) && j(f)
268
+ (f) => v(f) && A(f)
267
269
  );
268
270
  if (n)
269
271
  return [
@@ -279,7 +281,7 @@ function je(e) {
279
281
  ].join(`
280
282
  `);
281
283
  const r = e.views.find(
282
- (f) => A(f)
284
+ (f) => v(f)
283
285
  );
284
286
  if (r)
285
287
  return [
@@ -295,7 +297,7 @@ function je(e) {
295
297
  ].join(`
296
298
  `);
297
299
  const t = e.views.find(
298
- (f) => z(f) && j(f)
300
+ (f) => z(f) && A(f)
299
301
  );
300
302
  if (t)
301
303
  return [
@@ -309,7 +311,7 @@ function je(e) {
309
311
  ].join(`
310
312
  `);
311
313
  const o = e.views.find(
312
- (f) => ue(f) && j(f)
314
+ (f) => ue(f) && A(f)
313
315
  );
314
316
  if (o)
315
317
  return [
@@ -323,8 +325,8 @@ function je(e) {
323
325
  ].join(`
324
326
  `);
325
327
  const a = e.views.find((f) => {
326
- var y;
327
- return mn((y = f.raw.sdkSpec) == null ? void 0 : y.builder);
328
+ var $;
329
+ return mn(($ = f.raw.sdkSpec) == null ? void 0 : $.builder);
328
330
  });
329
331
  if (a)
330
332
  return [
@@ -336,7 +338,7 @@ function je(e) {
336
338
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
337
339
  ].join(`
338
340
  `);
339
- const u = e.views.find((f) => ve(f));
341
+ const u = e.views.find((f) => He(f));
340
342
  if (u)
341
343
  return [
342
344
  'import { appInputSpecs, createInputHandleMap, kpiPropsForView, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
@@ -347,54 +349,54 @@ function je(e) {
347
349
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
348
350
  ].join(`
349
351
  `);
350
- const c = e.views[0];
352
+ const p = e.views[0];
351
353
  return [
352
354
  'import { appInputSpecs, createInputHandleMap, queries, queryOptionsForView, semaphorGeneratedContractMetadata } from "./semaphor/generated";',
353
355
  "const handles = useSemaphorInputs(appInputSpecs);",
354
356
  "const inputHandles = createInputHandleMap(handles);",
355
- c ? `const result = useSemaphorQuery(queries.${c.name}(), queryOptionsForView.${c.name}(inputHandles));` : "const result = undefined;",
357
+ p ? `const result = useSemaphorQuery(queries.${p.name}(), queryOptionsForView.${p.name}(inputHandles));` : "const result = undefined;",
356
358
  "const presentationViews = semaphorGeneratedContractMetadata.presentationViews;"
357
359
  ].join(`
358
360
  `);
359
361
  }
360
362
  function z(e) {
361
363
  var n;
362
- return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
364
+ return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "records";
363
365
  }
364
- function ve(e) {
366
+ function He(e) {
365
367
  var n;
366
- return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
368
+ return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "metric";
367
369
  }
368
- function A(e) {
370
+ function v(e) {
369
371
  var n, r, t;
370
372
  return z(e) && ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.sorting) == null ? void 0 : t.mode) === "server";
371
373
  }
372
374
  function ue(e) {
373
375
  var n;
374
- return q((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
376
+ return K((n = e.raw.sdkSpec) == null ? void 0 : n.builder) === "sql";
375
377
  }
376
- function j(e) {
378
+ function A(e) {
377
379
  var n, r, t;
378
380
  return ((t = (r = (n = e.raw.visualSpec) == null ? void 0 : n.tableBehavior) == null ? void 0 : r.pagination) == null ? void 0 : t.mode) === "server";
379
381
  }
380
- function He(e) {
381
- return z(e) && (j(e) || A(e)) || ue(e) && j(e);
382
+ function je(e) {
383
+ return z(e) && (A(e) || v(e)) || ue(e) && A(e);
382
384
  }
383
- function Ke(e) {
385
+ function qe(e) {
384
386
  const n = e.sources.map(({ name: t, raw: o }) => {
385
- const a = qe(o);
387
+ const a = Ke(o);
386
388
  return ` ${t}: ${a},`;
387
389
  }).join(`
388
390
  `), r = e.sources.some((t) => t.raw.kind === "semantic") ? `import { semaphor } from "react-semaphor/data-app-sdk";
389
391
 
390
392
  ` : "";
391
- return `${v}
393
+ return `${H}
392
394
  ${r}export const sources = {
393
395
  ${n}
394
396
  } as const;
395
397
  `;
396
398
  }
397
- function qe(e) {
399
+ function Ke(e) {
398
400
  if (e.kind === "semantic") {
399
401
  const n = {
400
402
  domainId: e.domainId,
@@ -402,9 +404,9 @@ function qe(e) {
402
404
  datasetName: e.datasetName,
403
405
  label: e.label
404
406
  };
405
- return `semaphor.source.semantic(${k(N(n))})`;
407
+ return `semaphor.source.semantic(${M(N(n))})`;
406
408
  }
407
- return `${k(N({ ...e, sourceKey: void 0 }))} as const`;
409
+ return `${M(N({ ...e, sourceKey: void 0 }))} as const`;
408
410
  }
409
411
  function Te(e) {
410
412
  const n = e.fields.map(({ name: t, raw: o }) => {
@@ -414,7 +416,7 @@ function Te(e) {
414
416
  `), r = n.includes("sources.") ? `import { sources } from "./sources";
415
417
 
416
418
  ` : "";
417
- return `${v}
419
+ return `${H}
418
420
  ${r}export const fields = {
419
421
  ${n}
420
422
  } as const;
@@ -432,64 +434,64 @@ function Be(e, n) {
432
434
  throw new Error(
433
435
  `Field ${e.name} references source ${t}, but that source is not renderable. Include the source in codegenSummary.sources or provide field.source.`
434
436
  );
435
- const a = Object.entries(N(r)).map(([u, c]) => `${JSON.stringify(u)}: ${x(c, n)}`);
437
+ const a = Object.entries(N(r)).map(([u, p]) => `${JSON.stringify(u)}: ${x(p, n)}`);
436
438
  return o && a.push(`"source": sources.${o}`), `{ ${a.join(", ")} }`;
437
439
  }
438
440
  function Qe(e) {
439
441
  const n = e.inputs.map((m) => {
440
- const i = R(m.raw.fieldRef, e), l = [
442
+ const i = C(m.raw.fieldRef, e), c = [
441
443
  `id: ${JSON.stringify(m.raw.id)}`,
442
444
  `label: ${JSON.stringify(m.raw.label || m.raw.id)}`,
443
445
  `operator: ${JSON.stringify(fn(m.raw))}`
444
446
  ];
445
- if (i && l.push(`field: fields.${i}`), m.raw.relationshipHint && l.push(`relationshipHint: ${k(m.raw.relationshipHint)}`), !i)
447
+ if (i && c.push(`field: fields.${i}`), m.raw.relationshipHint && c.push(`relationshipHint: ${M(m.raw.relationshipHint)}`), !i)
446
448
  throw new Error(`Input ${m.raw.id || m.name} is missing a generated field reference.`);
447
- return ` ${m.name}: semaphor.filter({ ${l.join(", ")} }),`;
449
+ return ` ${m.name}: semaphor.filter({ ${c.join(", ")} }),`;
448
450
  }).join(`
449
451
  `), r = e.inputs.map((m) => `filterSpecs.${m.name}`).join(", "), t = e.inputs.map((m) => JSON.stringify(m.raw.id)).join(", "), o = e.optionQueries.map((m) => {
450
- const i = m.input.raw, l = m.raw, g = F(l.spec) || {}, {
451
- id: h,
452
- inputId: I,
453
- source: $,
454
- sourceKey: M,
455
- valueField: b,
456
- labelField: C,
452
+ const i = m.input.raw, c = m.raw, h = b(c.spec) || {}, {
453
+ id: y,
454
+ inputId: V,
455
+ source: S,
456
+ sourceKey: R,
457
+ valueField: k,
458
+ labelField: O,
457
459
  population: s,
458
- dependencies: V,
460
+ dependencies: I,
459
461
  limit: T,
460
462
  ...ee
461
- } = g, U = l.sourceKey ? { sourceKey: l.sourceKey } : l.source || $ || (typeof M == "string" ? { sourceKey: M } : void 0), ne = Se(U, e), re = R(l.valueFieldRef, e), te = R(l.labelFieldRef, e), oe = he(m), se = {
463
+ } = h, U = c.sourceKey ? { sourceKey: c.sourceKey } : c.source || S || (typeof R == "string" ? { sourceKey: R } : void 0), ne = Se(U, e), re = C(c.valueFieldRef, e), te = C(c.labelFieldRef, e), oe = he(m), se = {
462
464
  ...ee,
463
- id: l.id || g.id || `${i.id}-options`,
465
+ id: c.id || h.id || `${i.id}-options`,
464
466
  inputId: i.id,
465
467
  source: U,
466
- valueField: l.valueFieldRef,
467
- labelField: l.labelFieldRef,
468
- population: l.population || s,
468
+ valueField: c.valueFieldRef,
469
+ labelField: c.labelFieldRef,
470
+ population: c.population || s,
469
471
  dependencies: oe,
470
- limit: l.limit || T || 100
472
+ limit: c.limit || T || 100
471
473
  };
472
474
  if (!ne || !re || !te)
473
- throw new Error(`Input option query ${l.id || `${i.id}-options`} is missing source, valueField, or labelField.`);
475
+ throw new Error(`Input option query ${c.id || `${i.id}-options`} is missing source, valueField, or labelField.`);
474
476
  const Ve = Object.entries(N(se)).map(([Fe, be]) => `${JSON.stringify(Fe)}: ${x(be, e)}`);
475
477
  return ` ${m.name}: semaphor.inputOptions({ ${Ve.join(", ")} }),`;
476
478
  }).join(`
477
479
  `), a = e.optionQueries.map((m) => {
478
- const i = Pe(e, m), l = i.length > 0 ? "inputHandles" : "_inputHandles", g = i.map((h) => {
479
- const I = R(h.raw.fieldRef, e);
480
- if (!I)
480
+ const i = Pe(e, m), c = i.length > 0 ? "inputHandles" : "_inputHandles", h = i.map((y) => {
481
+ const V = C(y.raw.fieldRef, e);
482
+ if (!V)
481
483
  throw new Error(
482
- `Input option query ${m.raw.id || `${m.input.raw.id}-options`} references input ${h.raw.id} without a generated field reference.`
484
+ `Input option query ${m.raw.id || `${m.input.raw.id}-options`} references input ${y.raw.id} without a generated field reference.`
483
485
  );
484
- const $ = `inputHandles[${JSON.stringify(h.raw.id)}]`;
485
- return ` if (${$}) {
486
- inputs.push(semaphor.bindInput(${$}, { field: fields.${I} }));
486
+ const S = `inputHandles[${JSON.stringify(y.raw.id)}]`;
487
+ return ` if (${S}) {
488
+ inputs.push(semaphor.bindInput(${S}, { field: fields.${V} }));
487
489
  }`;
488
490
  }).join(`
489
491
  `);
490
- return ` ${m.name}(${l}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
492
+ return ` ${m.name}(${c}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
491
493
  const inputs: SemaphorInputReference[] = [];
492
- ${g}
494
+ ${h}
493
495
  return inputs;
494
496
  },`;
495
497
  }).join(`
@@ -500,22 +502,22 @@ ${g}
500
502
  };
501
503
  },`).join(`
502
504
 
503
- `), c = e.optionQueries.map((m) => ` case ${JSON.stringify(m.raw.id || `${m.input.raw.id}-options`)}:
505
+ `), p = e.optionQueries.map((m) => ` case ${JSON.stringify(m.raw.id || `${m.input.raw.id}-options`)}:
504
506
  return queryOptionsForInputOptionQuery.${m.name}(inputHandles);`).join(`
505
- `), S = e.inputs.length > 0, f = e.optionQueries.length > 0, y = f ? "inputOptionQueryId" : "_inputOptionQueryId", O = f ? "inputHandles" : "_inputHandles", d = [
507
+ `), w = e.inputs.length > 0, f = e.optionQueries.length > 0, $ = f ? "inputOptionQueryId" : "_inputOptionQueryId", F = f ? "inputHandles" : "_inputHandles", d = [
506
508
  "SemaphorInputHandle",
507
509
  f ? "SemaphorInputReference" : void 0,
508
510
  "SemaphorQueryRuntimeOptions"
509
- ].filter(E).join(", "), p = [
510
- S || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
511
+ ].filter(E).join(", "), l = [
512
+ w || f ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
511
513
  `import type { ${d} } from "react-semaphor/data-app-sdk";`,
512
- S || f ? 'import { fields } from "./fields";' : void 0,
514
+ w || f ? 'import { fields } from "./fields";' : void 0,
513
515
  f ? 'import { sources } from "./sources";' : void 0,
514
516
  'import type { SemaphorGeneratedInputId, SemaphorGeneratedInputOptionQueryId } from "./metadata";'
515
517
  ].filter(E).join(`
516
518
  `);
517
- return `${v}
518
- ${p}
519
+ return `${H}
520
+ ${l}
519
521
 
520
522
  export const filterSpecs = {
521
523
  ${n}
@@ -543,13 +545,13 @@ ${u}
543
545
  } as const;
544
546
 
545
547
  export function queryOptionsForInputOptionQueryId(
546
- ${y}: SemaphorGeneratedInputOptionQueryId,
547
- ${O}: SemaphorGeneratedInputHandleMap,
548
+ ${$}: SemaphorGeneratedInputOptionQueryId,
549
+ ${F}: SemaphorGeneratedInputHandleMap,
548
550
  ): SemaphorQueryRuntimeOptions {
549
- switch (${y}) {
550
- ${c}
551
+ switch (${$}) {
552
+ ${p}
551
553
  }
552
- throw new Error(\`Unknown generated Semaphor input option query id: \${${y}}\`);
554
+ throw new Error(\`Unknown generated Semaphor input option query id: \${${$}}\`);
553
555
  }
554
556
  `;
555
557
  }
@@ -567,29 +569,29 @@ function he(e) {
567
569
  return e.raw.dependencies || ((n = e.raw.spec) == null ? void 0 : n.dependencies);
568
570
  }
569
571
  function De(e) {
570
- const n = e.views.map((p) => {
571
- var l, g, h, I, $, M;
572
- const m = q(p.raw.sdkSpec.builder), i = _e(p);
573
- if (z(p) && He(p)) {
574
- const b = (l = p.raw.visualSpec) == null ? void 0 : l.tableBehavior, C = F(i.pagination), s = j(p), V = A(p), T = ((g = b == null ? void 0 : b.pagination) == null ? void 0 : g.pageSize) || J(C == null ? void 0 : C.pageSize) || J(i.limit) || 100, ee = V ? L(p, e) : [], U = V ? Ue({
575
- view: p,
572
+ const n = e.views.map((l) => {
573
+ var c, h, y, V, S, R;
574
+ const m = K(l.raw.sdkSpec.builder), i = _e(l);
575
+ if (z(l) && je(l)) {
576
+ const k = (c = l.raw.visualSpec) == null ? void 0 : c.tableBehavior, O = b(i.pagination), s = A(l), I = v(l), T = ((h = k == null ? void 0 : k.pagination) == null ? void 0 : h.pageSize) || J(O == null ? void 0 : O.pageSize) || J(i.limit) || 100, ee = I ? L(l, e) : [], U = I ? Ue({
577
+ view: l,
576
578
  contract: e,
577
579
  sortFields: ee,
578
- defaultField: (h = b == null ? void 0 : b.sorting) == null ? void 0 : h.defaultField
579
- }) : void 0, ne = V ? (I = b == null ? void 0 : b.sorting) == null ? void 0 : I.defaultDirection : void 0, re = Je({
580
- viewName: p.name,
580
+ defaultField: (y = k == null ? void 0 : k.sorting) == null ? void 0 : y.defaultField
581
+ }) : void 0, ne = I ? (V = k == null ? void 0 : k.sorting) == null ? void 0 : V.defaultDirection : void 0, re = Je({
582
+ viewName: l.name,
581
583
  supportsPagination: s,
582
- supportsSort: V
583
- }), te = V ? ` const orderBy = resolveRecordsOrderBy(
584
- recordsSortFieldsForView.${p.name},
584
+ supportsSort: I
585
+ }), te = I ? ` const orderBy = resolveRecordsOrderBy(
586
+ recordsSortFieldsForView.${l.name},
585
587
  params.sort,
586
588
  ${x(U, e)},
587
589
  ${x(ne, e)},
588
590
  );
589
- ` : "", oe = V ? ` ...(orderBy ? { orderBy } : {}),
591
+ ` : "", oe = I ? ` ...(orderBy ? { orderBy } : {}),
590
592
  ` : "", se = s ? ` pagination: resolveServerTablePagination(params, ${JSON.stringify(T)}),
591
593
  ` : "";
592
- return ` ${p.name}(
594
+ return ` ${l.name}(
593
595
  params: ${re} = {},
594
596
  ) {
595
597
  ${te} return semaphor.${m}({
@@ -597,9 +599,9 @@ ${te} return semaphor.${m}({
597
599
  ${oe}${se} });
598
600
  },`;
599
601
  }
600
- if (ue(p) && j(p)) {
601
- const b = ($ = p.raw.visualSpec) == null ? void 0 : $.tableBehavior, C = F(i.pagination), s = ((M = b == null ? void 0 : b.pagination) == null ? void 0 : M.pageSize) || J(C == null ? void 0 : C.pageSize) || J(i.limit) || 100;
602
- return ` ${p.name}(
602
+ if (ue(l) && A(l)) {
603
+ const k = (S = l.raw.visualSpec) == null ? void 0 : S.tableBehavior, O = b(i.pagination), s = ((R = k == null ? void 0 : k.pagination) == null ? void 0 : R.pageSize) || J(O == null ? void 0 : O.pageSize) || J(i.limit) || 100;
604
+ return ` ${l.name}(
603
605
  params: SemaphorGeneratedServerPaginationParams = {},
604
606
  ) {
605
607
  return semaphor.${m}({
@@ -608,32 +610,32 @@ ${oe}${se} });
608
610
  });
609
611
  },`;
610
612
  }
611
- return ` ${p.name}: () => semaphor.${m}(${x(i, e)}),`;
613
+ return ` ${l.name}: () => semaphor.${m}(${x(i, e)}),`;
612
614
  }).join(`
613
- `), r = e.views.filter((p) => A(p)).map((p) => {
614
- const i = L(p, e).map((l) => ` ${JSON.stringify(l.key)}: fields.${l.fieldName},`).join(`
615
+ `), r = e.views.filter((l) => v(l)).map((l) => {
616
+ const i = L(l, e).map((c) => ` ${JSON.stringify(c.key)}: fields.${c.fieldName},`).join(`
615
617
  `);
616
- return ` ${p.name}: {
618
+ return ` ${l.name}: {
617
619
  ${i}
618
620
  },`;
619
621
  }).join(`
620
- `), t = e.views.filter((p) => A(p)).map((p) => {
621
- const i = L(p, e).map((l) => ` { key: ${JSON.stringify(l.key)}, label: ${JSON.stringify(l.label)}, field: fields.${l.fieldName} },`).join(`
622
+ `), t = e.views.filter((l) => v(l)).map((l) => {
623
+ const i = L(l, e).map((c) => ` { key: ${JSON.stringify(c.key)}, label: ${JSON.stringify(c.label)}, field: fields.${c.fieldName} },`).join(`
622
624
  `);
623
- return ` ${p.name}: [
625
+ return ` ${l.name}: [
624
626
  ${i}
625
627
  ],`;
626
628
  }).join(`
627
- `), o = e.views.some((p) => A(p)), a = e.views.some((p) => j(p)), u = [n, r, t].join(`
628
- `), c = [
629
+ `), o = e.views.some((l) => v(l)), a = e.views.some((l) => A(l)), u = [n, r, t].join(`
630
+ `), p = [
629
631
  n ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
630
632
  o ? 'import type { SemaphorFieldRef } from "react-semaphor/data-app-sdk";' : void 0,
631
633
  u.includes("fields.") ? 'import { fields } from "./fields";' : void 0,
632
634
  u.includes("sources.") ? 'import { sources } from "./sources";' : void 0
633
635
  ].filter(E).join(`
634
636
  `);
635
- return `${v}
636
- ${c}
637
+ return `${H}
638
+ ${p}
637
639
  ${o ? `export type SemaphorGeneratedRecordsSortDirection = "asc" | "desc";
638
640
 
639
641
  export type SemaphorGeneratedRecordsSort<TSortKey extends string = string> = {
@@ -699,7 +701,7 @@ ${a ? `function resolveServerTablePagination(
699
701
  }
700
702
  function _e(e) {
701
703
  var a, u;
702
- const n = F((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: t, ...o } = n;
704
+ const n = b((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: t, ...o } = n;
703
705
  return {
704
706
  ...o,
705
707
  id: e.raw.id,
@@ -708,22 +710,22 @@ function _e(e) {
708
710
  }
709
711
  function L(e, n) {
710
712
  var a, u;
711
- const r = [], t = F((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
712
- for (const c of H(t.fields)) w(r, c);
713
- w(r, t.dateField), w(r, (u = F(t.orderBy)) == null ? void 0 : u.field);
714
- for (const c of e.raw.fields || []) w(r, c);
713
+ const r = [], t = b((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
714
+ for (const p of j(t.fields)) g(r, p);
715
+ g(r, t.dateField), g(r, (u = b(t.orderBy)) == null ? void 0 : u.field);
716
+ for (const p of e.raw.fields || []) g(r, p);
715
717
  return X(
716
- r.map((c) => {
717
- const S = R(c, n);
718
- if (!(!c.name || !S))
718
+ r.map((p) => {
719
+ const w = C(p, n);
720
+ if (!(!p.name || !w))
719
721
  return {
720
- key: S,
721
- fieldName: S,
722
- rawName: c.name,
723
- label: c.label || c.name
722
+ key: w,
723
+ fieldName: w,
724
+ rawName: p.name,
725
+ label: p.label || p.name
724
726
  };
725
727
  }).filter(E),
726
- (c) => c.key
728
+ (p) => p.key
727
729
  );
728
730
  }
729
731
  function Ue({
@@ -732,15 +734,15 @@ function Ue({
732
734
  sortFields: r,
733
735
  defaultField: t
734
736
  }) {
735
- var S, f;
736
- const o = new Set(r.map((y) => y.key));
737
+ var w, f;
738
+ const o = new Set(r.map(($) => $.key));
737
739
  if (t && o.has(t))
738
740
  return t;
739
- const a = r.filter((y) => y.rawName === t);
741
+ const a = r.filter(($) => $.rawName === t);
740
742
  if (a.length === 1)
741
743
  return a[0].key;
742
- const u = F((S = e.raw.sdkSpec) == null ? void 0 : S.spec), c = R((f = F(u == null ? void 0 : u.orderBy)) == null ? void 0 : f.field, n);
743
- return c && o.has(c) ? c : void 0;
744
+ const u = b((w = e.raw.sdkSpec) == null ? void 0 : w.spec), p = C((f = b(u == null ? void 0 : u.orderBy)) == null ? void 0 : f.field, n);
745
+ return p && o.has(p) ? p : void 0;
744
746
  }
745
747
  function Je({
746
748
  viewName: e,
@@ -750,59 +752,60 @@ function Je({
750
752
  return n && r ? `SemaphorGeneratedRecordsQueryParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : r ? `SemaphorGeneratedRecordsSortParams<Extract<keyof typeof recordsSortFieldsForView.${e}, string>>` : "SemaphorGeneratedServerPaginationParams";
751
753
  }
752
754
  function Le(e) {
753
- const n = e.views.map((y) => {
754
- const d = ze(e, y.raw.id).map((p) => {
755
- const m = p.inputId, i = R(p.fieldRef, e);
756
- if (!m || !i)
755
+ const n = e.views.map((F) => {
756
+ const l = ze(e, F.raw.id).map((m) => {
757
+ const i = m.inputId, c = C(m.fieldRef, e);
758
+ if (!i || !c)
757
759
  return "";
758
- const l = [`field: fields.${i}`];
759
- if (p.relationshipHint)
760
- l.push(`relationshipHint: ${k(p.relationshipHint)}`);
761
- else if (Array.isArray(p.relationshipsUsed) && p.relationshipsUsed.length > 0) {
762
- const h = p.relationshipsUsed.map((I) => {
763
- var $;
764
- return ($ = F(I)) == null ? void 0 : $.id;
765
- }).filter((I) => typeof I == "string" && I.length > 0);
766
- h.length > 0 && l.push(`relationshipHint: ${k({ relationshipIds: h })}`);
760
+ const h = [`field: fields.${c}`];
761
+ if (m.relationshipHint)
762
+ h.push(`relationshipHint: ${M(m.relationshipHint)}`);
763
+ else if (Array.isArray(m.relationshipsUsed) && m.relationshipsUsed.length > 0) {
764
+ const V = m.relationshipsUsed.map((S) => {
765
+ var R;
766
+ return (R = b(S)) == null ? void 0 : R.id;
767
+ }).filter((S) => typeof S == "string" && S.length > 0);
768
+ V.length > 0 && h.push(`relationshipHint: ${M({ relationshipIds: V })}`);
767
769
  }
768
- const g = `inputHandles[${JSON.stringify(m)}]`;
769
- return ` if (${g}) {
770
- inputs.push(semaphor.bindInput(${g}, { ${l.join(", ")} }));
770
+ const y = `inputHandles[${JSON.stringify(i)}]`;
771
+ return ` if (${y}) {
772
+ inputs.push(semaphor.bindInput(${y}, { ${h.join(", ")} }));
771
773
  }`;
772
774
  }).filter(Boolean).join(`
773
775
  `);
774
- return { view: y, renderedBindings: d };
775
- }), r = n.some((y) => y.renderedBindings.length > 0), t = n.map(({ view: y, renderedBindings: O }) => {
776
- const d = O ? "inputHandles" : "_inputHandles";
777
- return ` ${y.name}(${d}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
776
+ return { view: F, renderedBindings: l };
777
+ }), r = n.some((F) => F.renderedBindings.length > 0), t = n.map(({ view: F, renderedBindings: d }) => {
778
+ const l = d ? "inputHandles" : "_inputHandles";
779
+ return ` ${F.name}(${l}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
778
780
  const inputs: SemaphorInputReference[] = [];
779
- ${O}
781
+ ${d}
780
782
  return inputs;
781
783
  },`;
782
784
  }).join(`
783
785
 
784
- `), o = e.views.map((y) => ` ${y.name}(inputHandles: SemaphorGeneratedInputHandleMap): SemaphorQueryRuntimeOptions {
786
+ `), o = e.views.map((F) => ` ${F.name}(inputHandles: SemaphorGeneratedInputHandleMap, selections: SemaphorSelectionReference[] = []): SemaphorQueryRuntimeOptions {
785
787
  return {
786
- inputs: inputsForView.${y.name}(inputHandles),
787
- debug: queryDebugForView.${y.name},
788
+ inputs: inputsForView.${F.name}(inputHandles),
789
+ selections,
790
+ debug: queryDebugForView.${F.name},
788
791
  };
789
792
  },`).join(`
790
793
 
791
- `), a = e.views.map((y) => ` case ${JSON.stringify(y.raw.id)}:
792
- return inputsForView.${y.name}(inputHandles);`).join(`
793
- `), u = e.views.map((y) => ` case ${JSON.stringify(y.raw.id)}:
794
- return queryOptionsForView.${y.name}(inputHandles);`).join(`
795
- `), c = e.views.length > 0, S = c ? "inputHandles" : "_inputHandles", f = [
794
+ `), a = e.views.map((F) => ` case ${JSON.stringify(F.raw.id)}:
795
+ return inputsForView.${F.name}(inputHandles);`).join(`
796
+ `), u = e.views.map((F) => ` case ${JSON.stringify(F.raw.id)}:
797
+ return queryOptionsForView.${F.name}(inputHandles, selections);`).join(`
798
+ `), p = e.views.length > 0, w = p ? "inputHandles" : "_inputHandles", f = p ? "selections" : "_selections", $ = [
796
799
  r ? 'import { semaphor } from "react-semaphor/data-app-sdk";' : void 0,
797
- 'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions } from "react-semaphor/data-app-sdk";',
800
+ 'import type { SemaphorInputReference, SemaphorQueryRuntimeOptions, SemaphorSelectionReference } from "react-semaphor/data-app-sdk";',
798
801
  r ? 'import { fields } from "./fields";' : void 0,
799
802
  'import type { SemaphorGeneratedInputHandleMap } from "./inputs";',
800
- c ? 'import { queryDebugForView } from "./metadata";' : void 0,
803
+ p ? 'import { queryDebugForView } from "./metadata";' : void 0,
801
804
  'import type { SemaphorGeneratedQueryViewId } from "./metadata";'
802
805
  ].filter(E).join(`
803
806
  `);
804
- return `${v}
805
- ${f}
807
+ return `${H}
808
+ ${$}
806
809
 
807
810
  export const inputsForView = {
808
811
  ${t}
@@ -814,7 +817,7 @@ ${o}
814
817
 
815
818
  export function inputsForViewId(
816
819
  viewId: SemaphorGeneratedQueryViewId,
817
- ${S}: SemaphorGeneratedInputHandleMap,
820
+ ${w}: SemaphorGeneratedInputHandleMap,
818
821
  ): SemaphorInputReference[] {
819
822
  switch (viewId) {
820
823
  ${a}
@@ -824,7 +827,8 @@ ${a}
824
827
 
825
828
  export function queryOptionsForViewId(
826
829
  viewId: SemaphorGeneratedQueryViewId,
827
- ${S}: SemaphorGeneratedInputHandleMap,
830
+ ${w}: SemaphorGeneratedInputHandleMap,
831
+ ${f}: SemaphorSelectionReference[] = [],
828
832
  ): SemaphorQueryRuntimeOptions {
829
833
  switch (viewId) {
830
834
  ${u}
@@ -845,61 +849,61 @@ function ze(e, n) {
845
849
  }
846
850
  function Ye(e) {
847
851
  const n = e.views.map((i) => {
848
- const g = D(i, e).map((h) => {
849
- const I = R(h.raw, e);
850
- return I ? ` ${h.name}: fields.${I},` : "";
852
+ const h = D(i, e).map((y) => {
853
+ const V = C(y.raw, e);
854
+ return V ? ` ${y.name}: fields.${V},` : "";
851
855
  }).filter(Boolean).join(`
852
856
  `);
853
857
  return ` ${i.name}: {
854
- ${g}
858
+ ${h}
855
859
  },`;
856
860
  }).join(`
857
861
  `), r = e.views.map((i) => {
858
- const g = Q(i, e).map((h) => {
859
- const I = R(h.raw, e);
860
- return I ? ` ${h.name}: fields.${I},` : "";
862
+ const h = Q(i, e).map((y) => {
863
+ const V = C(y.raw, e);
864
+ return V ? ` ${y.name}: fields.${V},` : "";
861
865
  }).filter(Boolean).join(`
862
866
  `);
863
867
  return ` ${i.name}: {
864
- ${g}
868
+ ${h}
865
869
  },`;
866
870
  }).join(`
867
871
  `), t = e.views.map((i) => {
868
- const g = Q(i, e).map((h, I) => ` ${h.name}: ${JSON.stringify(en(i, h, I))},`).join(`
872
+ const h = Q(i, e).map((y, V) => ` ${y.name}: ${JSON.stringify(en(i, y, V))},`).join(`
869
873
  `);
870
874
  return ` ${i.name}: {
871
- ${g}
875
+ ${h}
872
876
  },`;
873
877
  }).join(`
874
878
  `), o = e.views.map((i) => {
875
- const l = Q(i, e);
876
- if (l.length === 0)
879
+ const c = Q(i, e);
880
+ if (c.length === 0)
877
881
  return ` ${i.name}(): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
878
882
  return {};
879
883
  },`;
880
- const g = l.map((h) => {
881
- const $ = `readMetricValueByBinding(measures, measureBindings, ${`metricMeasureBindingKeysForView.${i.name}.${h.name}`})`;
882
- return ` ${h.name}: ${$},`;
884
+ const h = c.map((y) => {
885
+ const S = `readMetricValueByBinding(measures, measureBindings, ${`metricMeasureBindingKeysForView.${i.name}.${y.name}`})`;
886
+ return ` ${y.name}: ${S},`;
883
887
  }).join(`
884
888
  `);
885
889
  return ` ${i.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${i.name}, unknown> {
886
890
  const measures = result?.measures;
887
891
  const measureBindings = result?.measureBindings;
888
892
  return {
889
- ${g}
893
+ ${h}
890
894
  };
891
895
  },`;
892
896
  }).join(`
893
897
 
894
898
  `), a = e.views.map((i) => {
895
- const l = Q(i, e);
896
- if (l.length === 0)
899
+ const c = Q(i, e);
900
+ if (c.length === 0)
897
901
  return ` ${i.name}(): Array<keyof typeof metricFieldsForView.${i.name}> {
898
902
  return [];
899
903
  },`;
900
- const g = l.map((h, I) => {
901
- const $ = `metricMeasureBindingKeysForView.${i.name}.${h.name}`, M = I === 0 ? `readMetricValueByBinding(measures, measureBindings, ${$}) === undefined && !hasOwnPrimaryMetricValue(result)` : `readMetricValueByBinding(measures, measureBindings, ${$}) === undefined`;
902
- return ` ...(missing.has(${$}) || (${M}) ? [${JSON.stringify(h.name)} as keyof typeof metricFieldsForView.${i.name}] : []),`;
904
+ const h = c.map((y, V) => {
905
+ const S = `metricMeasureBindingKeysForView.${i.name}.${y.name}`, R = V === 0 ? `readMetricValueByBinding(measures, measureBindings, ${S}) === undefined && !hasOwnPrimaryMetricValue(result)` : `readMetricValueByBinding(measures, measureBindings, ${S}) === undefined`;
906
+ return ` ...(missing.has(${S}) || (${R}) ? [${JSON.stringify(y.name)} as keyof typeof metricFieldsForView.${i.name}] : []),`;
903
907
  }).join(`
904
908
  `);
905
909
  return ` ${i.name}(result: SemaphorGeneratedMetricResult): Array<keyof typeof metricFieldsForView.${i.name}> {
@@ -907,25 +911,25 @@ ${g}
907
911
  const measures = result?.measures;
908
912
  const measureBindings = result?.measureBindings;
909
913
  return [
910
- ${g}
914
+ ${h}
911
915
  ];
912
916
  },`;
913
917
  }).join(`
914
918
 
915
919
  `), u = e.views.map((i) => {
916
- const l = Q(i, e);
917
- if (l.length === 0)
920
+ const c = Q(i, e);
921
+ if (c.length === 0)
918
922
  return "";
919
- const g = l[0], h = l.map(($) => `{ key: ${JSON.stringify($.name)}, label: ${JSON.stringify($.raw.label || $.raw.name)} }`).join(", "), I = l.filter(($) => $.name !== g.name).map(($) => ` if (missing.includes(${JSON.stringify($.name)})) delete values.${$.name};`).join(`
923
+ const h = c[0], y = c.map((S) => `{ key: ${JSON.stringify(S.name)}, label: ${JSON.stringify(S.raw.label || S.raw.name)} }`).join(", "), V = c.filter((S) => S.name !== h.name).map((S) => ` if (missing.includes(${JSON.stringify(S.name)})) delete values.${S.name};`).join(`
920
924
  `);
921
925
  return ` ${i.name}(result: SemaphorGeneratedMetricResult): SemaphorGeneratedKpiProps {
922
926
  const values = mapMetricDisplayValues(metricValuesForView.${i.name}(result));
923
927
  const missing = missingMetricMeasuresForView.${i.name}(result).map((key) => String(key));
924
- const primaryMissing = missing.includes(${JSON.stringify(g.name)});
925
- const boundPrimaryValue = values.${g.name};
928
+ const primaryMissing = missing.includes(${JSON.stringify(h.name)});
929
+ const boundPrimaryValue = values.${h.name};
926
930
  const primaryValue = primaryMissing || boundPrimaryValue === undefined ? result?.primaryValue : boundPrimaryValue;
927
- if (primaryMissing) values.${g.name} = metricDisplayValue(result?.primaryValue);
928
- ${I}
931
+ if (primaryMissing) values.${h.name} = metricDisplayValue(result?.primaryValue);
932
+ ${V}
929
933
  return {
930
934
  result: {
931
935
  ...(result || {}),
@@ -934,55 +938,55 @@ ${I}
934
938
  measures: values,
935
939
  },
936
940
  title: ${JSON.stringify(i.raw.title || i.raw.id)},
937
- label: ${JSON.stringify(g.raw.label || g.raw.name)},
941
+ label: ${JSON.stringify(h.raw.label || h.raw.name)},
938
942
  value: metricDisplayValue(primaryValue),
939
- measures: [${h}],
943
+ measures: [${y}],
940
944
  missingMeasures: missing,
941
945
  showComparison: Boolean(result?.comparisonKind),
942
946
  };
943
947
  },`;
944
948
  }).filter(Boolean).join(`
945
949
 
946
- `), c = e.views.map((i) => {
947
- const l = Ze(i, e);
948
- return ` ${i.name}: ${k(l)},`;
950
+ `), p = e.views.map((i) => {
951
+ const c = Ze(i, e);
952
+ return ` ${i.name}: ${M(c)},`;
949
953
  }).join(`
950
- `), S = e.views.map((i) => {
951
- const g = D(i, e).map((h) => ` ${h.name}: resolveColumnKey(columns, fieldsForView.${i.name}.${h.name}),`).join(`
954
+ `), w = e.views.map((i) => {
955
+ const h = D(i, e).map((y) => ` ${y.name}: resolveColumnKey(columns, fieldsForView.${i.name}.${y.name}),`).join(`
952
956
  `);
953
957
  return ` ${i.name}(columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, string | undefined> {
954
958
  return {
955
- ${g}
959
+ ${h}
956
960
  };
957
961
  },`;
958
962
  }).join(`
959
963
 
960
964
  `), f = e.views.map((i) => {
961
- const g = D(i, e).map((h) => ` ${h.name}: readCell(row, columns, fieldsForView.${i.name}.${h.name}),`).join(`
965
+ const h = D(i, e).map((y) => ` ${y.name}: readCell(row, columns, fieldsForView.${i.name}.${y.name}),`).join(`
962
966
  `);
963
967
  return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): Record<keyof typeof fieldsForView.${i.name}, unknown> {
964
968
  return {
965
- ${g}
969
+ ${h}
966
970
  };
967
971
  },`;
968
972
  }).join(`
969
973
 
970
- `), y = e.views.map((i) => ` ${i.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${i.name}, unknown>> {
974
+ `), $ = e.views.map((i) => ` ${i.name}(result: SemaphorGeneratedRecordsResult): Array<Record<keyof typeof fieldsForView.${i.name}, unknown>> {
971
975
  return (result?.records || []).map((row) => rowValuesForView.${i.name}(row, result?.columns));
972
976
  },`).join(`
973
977
 
974
- `), O = e.views.map((i) => {
975
- const l = D(i, e), g = l.filter((s) => s.raw.role === "dimension"), h = l.filter((s) => s.raw.role === "measure"), I = g[0], $ = g[1], M = h[0], b = h[1], C = [
976
- I ? ` primaryDimension: values.${I.name},` : " primaryDimension: undefined,",
977
- $ ? ` secondaryDimension: values.${$.name},` : " secondaryDimension: undefined,",
978
- M ? ` primaryMeasure: values.${M.name},` : " primaryMeasure: undefined,",
979
- b ? ` secondaryMeasure: values.${b.name},` : " secondaryMeasure: undefined,"
978
+ `), F = e.views.map((i) => {
979
+ const c = D(i, e), h = c.filter((s) => s.raw.role === "dimension"), y = c.filter((s) => s.raw.role === "measure"), V = h[0], S = h[1], R = y[0], k = y[1], O = [
980
+ V ? ` primaryDimension: values.${V.name},` : " primaryDimension: undefined,",
981
+ S ? ` secondaryDimension: values.${S.name},` : " secondaryDimension: undefined,",
982
+ R ? ` primaryMeasure: values.${R.name},` : " primaryMeasure: undefined,",
983
+ k ? ` secondaryMeasure: values.${k.name},` : " secondaryMeasure: undefined,"
980
984
  ].join(`
981
985
  `);
982
986
  return ` ${i.name}(row: SemaphorGeneratedRow, columns: SemaphorGeneratedColumns): SemaphorGeneratedRoleValues {
983
987
  const values = rowValuesForView.${i.name}(row, columns);
984
988
  return {
985
- ${C}
989
+ ${O}
986
990
  };
987
991
  },`;
988
992
  }).join(`
@@ -995,7 +999,7 @@ ${C}
995
999
  d ? 'import { fields } from "./fields";' : void 0
996
1000
  ].filter(E).join(`
997
1001
  `);
998
- return `${v}
1002
+ return `${H}
999
1003
  ${m}
1000
1004
 
1001
1005
  export type SemaphorGeneratedRow = Record<string, unknown>;
@@ -1066,11 +1070,11 @@ ${t}
1066
1070
  } as const;
1067
1071
 
1068
1072
  export const tableColumnsForView = {
1069
- ${c}
1073
+ ${p}
1070
1074
  } as const;
1071
1075
 
1072
1076
  export const columnKeysForView = {
1073
- ${S}
1077
+ ${w}
1074
1078
  } as const;
1075
1079
 
1076
1080
  export const rowValuesForView = {
@@ -1078,11 +1082,11 @@ ${f}
1078
1082
  } as const;
1079
1083
 
1080
1084
  export const rowsForView = {
1081
- ${y}
1085
+ ${$}
1082
1086
  } as const;
1083
1087
 
1084
1088
  export const roleValuesForView = {
1085
- ${O}
1089
+ ${F}
1086
1090
  } as const;
1087
1091
 
1088
1092
  export const metricValuesForView = {
@@ -1282,10 +1286,10 @@ function sourcesReferToSameDataset(
1282
1286
  }
1283
1287
  function Ze(e, n) {
1284
1288
  const r = D(e, n), t = new Map(
1285
- (A(e) ? L(e, n) : []).map((o) => [o.fieldName, o.key])
1289
+ (v(e) ? L(e, n) : []).map((o) => [o.fieldName, o.key])
1286
1290
  );
1287
1291
  return r.map((o) => {
1288
- const a = R(o.raw, n), u = a ? t.get(a) : void 0;
1292
+ const a = C(o.raw, n), u = a ? t.get(a) : void 0;
1289
1293
  return N({
1290
1294
  key: o.name,
1291
1295
  label: o.raw.label || o.raw.name,
@@ -1296,12 +1300,12 @@ function Ze(e, n) {
1296
1300
  });
1297
1301
  }
1298
1302
  function We(e) {
1299
- const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((d) => d.id).filter(Boolean), o = e.views.map((d) => d.raw.id).filter(Boolean), a = e.inputs.map((d) => d.raw.id).filter(Boolean), u = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean), c = Object.fromEntries(o.map((d) => [
1303
+ const n = e.checklist.filterScopeByInput || [], r = e.checklist.requiredDevtools || {}, t = e.summary.views.map((d) => d.id).filter(Boolean), o = e.views.map((d) => d.raw.id).filter(Boolean), a = e.inputs.map((d) => d.raw.id).filter(Boolean), u = e.optionQueries.map((d) => d.raw.id || `${d.input.raw.id}-options`).filter(Boolean), p = Object.fromEntries(o.map((d) => [
1300
1304
  d,
1301
1305
  e.filterContracts.filter(
1302
- (p) => Array.isArray(p.appliesToViewIds) && p.appliesToViewIds.includes(d)
1303
- ).map((p) => p.inputId)
1304
- ])), S = Object.fromEntries(e.views.map((d) => [
1306
+ (l) => Array.isArray(l.appliesToViewIds) && l.appliesToViewIds.includes(d)
1307
+ ).map((l) => l.inputId)
1308
+ ])), w = Object.fromEntries(e.views.map((d) => [
1305
1309
  d.raw.id,
1306
1310
  {
1307
1311
  title: d.raw.title,
@@ -1311,14 +1315,14 @@ function We(e) {
1311
1315
  sdkBuilder: d.raw.sdkBuilder
1312
1316
  }
1313
1317
  ])), f = Object.fromEntries(e.views.map((d) => {
1314
- var p;
1318
+ var l;
1315
1319
  return [
1316
1320
  d.raw.id,
1317
1321
  N({
1318
1322
  viewId: d.raw.id,
1319
1323
  queryId: d.name,
1320
1324
  title: d.raw.title,
1321
- visualType: ((p = d.raw.visualSpec) == null ? void 0 : p.visualType) || d.raw.visual,
1325
+ visualType: ((l = d.raw.visualSpec) == null ? void 0 : l.visualType) || d.raw.visual,
1322
1326
  suggestedComponentName: me(d.raw.title || d.raw.id || d.name),
1323
1327
  marker: {
1324
1328
  attribute: "data-semaphor-view-id",
@@ -1326,15 +1330,15 @@ function We(e) {
1326
1330
  }
1327
1331
  })
1328
1332
  ];
1329
- })), y = Object.fromEntries(e.inputs.map((d) => {
1330
- var p;
1333
+ })), $ = Object.fromEntries(e.inputs.map((d) => {
1334
+ var l;
1331
1335
  return [
1332
1336
  d.raw.id,
1333
1337
  N({
1334
1338
  inputId: d.raw.id,
1335
1339
  label: d.raw.label,
1336
1340
  type: d.raw.type,
1337
- optionQueryId: ((p = d.raw.optionQuery) == null ? void 0 : p.id) || (d.raw.optionQuery ? `${d.raw.id}-options` : void 0),
1341
+ optionQueryId: ((l = d.raw.optionQuery) == null ? void 0 : l.id) || (d.raw.optionQuery ? `${d.raw.id}-options` : void 0),
1338
1342
  suggestedComponentName: me(d.raw.label || d.raw.id || d.name),
1339
1343
  marker: {
1340
1344
  attribute: "data-semaphor-input-id",
@@ -1342,25 +1346,25 @@ function We(e) {
1342
1346
  }
1343
1347
  })
1344
1348
  ];
1345
- })), O = Object.fromEntries(e.views.map((d) => {
1346
- var p, m, i;
1349
+ })), F = Object.fromEntries(e.views.map((d) => {
1350
+ var l, m, i;
1347
1351
  return [
1348
1352
  d.name,
1349
1353
  N({
1350
1354
  viewId: d.raw.id,
1351
- viewTitle: ((p = d.raw.visualSpec) == null ? void 0 : p.title) || d.raw.title,
1355
+ viewTitle: ((l = d.raw.visualSpec) == null ? void 0 : l.title) || d.raw.title,
1352
1356
  visualType: (m = d.raw.visualSpec) == null ? void 0 : m.visualType,
1353
1357
  title: ((i = d.raw.visualSpec) == null ? void 0 : i.title) || d.raw.title
1354
1358
  })
1355
1359
  ];
1356
1360
  }));
1357
- return `${v}
1358
- export const generatedViewIds = ${k(t)} as const;
1359
- export const generatedQueryViewIds = ${k(o)} as const;
1360
- export const generatedInputIds = ${k(a)} as const;
1361
- export const generatedInputOptionQueryIds = ${k(u)} as const;
1362
- export const generatedViewAuthoring = ${k(f)} as const;
1363
- export const generatedInputAuthoring = ${k(y)} as const;
1361
+ return `${H}
1362
+ export const generatedViewIds = ${M(t)} as const;
1363
+ export const generatedQueryViewIds = ${M(o)} as const;
1364
+ export const generatedInputIds = ${M(a)} as const;
1365
+ export const generatedInputOptionQueryIds = ${M(u)} as const;
1366
+ export const generatedViewAuthoring = ${M(f)} as const;
1367
+ export const generatedInputAuthoring = ${M($)} as const;
1364
1368
 
1365
1369
  export type SemaphorGeneratedViewId = typeof generatedViewIds[number];
1366
1370
  export type SemaphorGeneratedQueryViewId = typeof generatedQueryViewIds[number];
@@ -1379,8 +1383,8 @@ export type SemaphorGeneratedFilterContract = {
1379
1383
  readonly [key: string]: unknown;
1380
1384
  };
1381
1385
 
1382
- export const generatedInputIdsForView = ${k(c)} as const;
1383
- export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${k(e.filterContracts)} as const;
1386
+ export const generatedInputIdsForView = ${M(p)} as const;
1387
+ export const generatedFilterContracts: readonly SemaphorGeneratedFilterContract[] = ${M(e.filterContracts)} as const;
1384
1388
 
1385
1389
  export function semaphorViewMarkerProps(viewId: SemaphorGeneratedViewId) {
1386
1390
  return {
@@ -1400,9 +1404,9 @@ export function filterContractsForView(viewId: SemaphorGeneratedQueryViewId) {
1400
1404
  );
1401
1405
  }
1402
1406
 
1403
- export const queryDebugForView = ${k(O)} as const;
1407
+ export const queryDebugForView = ${M(F)} as const;
1404
1408
 
1405
- export const semaphorGeneratedContractMetadata = ${k({
1409
+ export const semaphorGeneratedContractMetadata = ${M({
1406
1410
  schemaVersion: "semaphor-generated-data-app-contract/v1",
1407
1411
  title: e.title,
1408
1412
  requiredDevtools: r,
@@ -1412,16 +1416,16 @@ export const semaphorGeneratedContractMetadata = ${k({
1412
1416
  generatedQueryViewIds: o,
1413
1417
  generatedInputIds: a,
1414
1418
  generatedInputOptionQueryIds: u,
1415
- generatedInputIdsForView: c,
1419
+ generatedInputIdsForView: p,
1416
1420
  generatedViewAuthoring: f,
1417
- generatedInputAuthoring: y,
1418
- visualSpecs: S,
1421
+ generatedInputAuthoring: $,
1422
+ visualSpecs: w,
1419
1423
  presentationViews: e.presentationViews
1420
1424
  })} as const;
1421
1425
  `;
1422
1426
  }
1423
1427
  function Xe() {
1424
- return `${v}
1428
+ return `${H}
1425
1429
  export * from "./sources";
1426
1430
  export * from "./fields";
1427
1431
  export * from "./inputs";
@@ -1437,7 +1441,7 @@ function B(e, n) {
1437
1441
  for (const r of n) B(e, r);
1438
1442
  return;
1439
1443
  }
1440
- G(n) && w(e, Y(n));
1444
+ G(n) && g(e, Y(n));
1441
1445
  for (const r of Object.values(n))
1442
1446
  B(e, r);
1443
1447
  }
@@ -1446,22 +1450,22 @@ function D(e, n) {
1446
1450
  const r = [];
1447
1451
  if (on(r, e.raw.sdkSpec), r.length === 0)
1448
1452
  for (const o of e.raw.fields || [])
1449
- w(r, o);
1453
+ g(r, o);
1450
1454
  const t = X(
1451
- r.filter((o) => o.name && R(o, n)).map((o) => ({ raw: o, key: Z(o), name: "" })),
1455
+ r.filter((o) => o.name && C(o, n)).map((o) => ({ raw: o, key: Z(o), name: "" })),
1452
1456
  (o) => o.key
1453
1457
  );
1454
1458
  return ge(t, n, "field"), t;
1455
1459
  }
1456
1460
  function Q(e, n) {
1457
- if (q(e.raw.sdkSpec.builder) !== "metric")
1461
+ if (K(e.raw.sdkSpec.builder) !== "metric")
1458
1462
  return [];
1459
- const r = F(e.raw.sdkSpec.spec), t = [];
1460
- w(t, r == null ? void 0 : r.primaryMeasure);
1461
- for (const a of H(r == null ? void 0 : r.measures))
1462
- w(t, a);
1463
+ const r = b(e.raw.sdkSpec.spec), t = [];
1464
+ g(t, r == null ? void 0 : r.primaryMeasure);
1465
+ for (const a of j(r == null ? void 0 : r.measures))
1466
+ g(t, a);
1463
1467
  const o = X(
1464
- t.filter((a) => a.name && R(a, n)).map((a) => ({ raw: a, key: Z(a), name: "" })),
1468
+ t.filter((a) => a.name && C(a, n)).map((a) => ({ raw: a, key: Z(a), name: "" })),
1465
1469
  (a) => a.key
1466
1470
  );
1467
1471
  return ge(o, n, "metric"), o;
@@ -1478,17 +1482,17 @@ function en(e, n, r) {
1478
1482
  function ge(e, n, r) {
1479
1483
  const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1480
1484
  for (const u of e) {
1481
- const c = K(u.raw.name || u.raw.label || r) || r;
1482
- t.set(u.key, c), o.set(c, (o.get(c) || 0) + 1);
1485
+ const p = q(u.raw.name || u.raw.label || r) || r;
1486
+ t.set(u.key, p), o.set(p, (o.get(p) || 0) + 1);
1483
1487
  }
1484
1488
  const a = /* @__PURE__ */ new Set();
1485
1489
  for (const u of e) {
1486
- const c = t.get(u.key) || r, S = R(u.raw, n) || c, f = o.get(c) === 1 ? c : S;
1490
+ const p = t.get(u.key) || r, w = C(u.raw, n) || p, f = o.get(p) === 1 ? p : w;
1487
1491
  u.name = nn(f, u.key, a);
1488
1492
  }
1489
1493
  }
1490
1494
  function nn(e, n, r) {
1491
- const t = tn(e) ? e : K(e || "field") || "field";
1495
+ const t = tn(e) ? e : q(e || "field") || "field";
1492
1496
  if (!r.has(t))
1493
1497
  return r.add(t), t;
1494
1498
  const o = rn(n), a = `${t}${o}`;
@@ -1497,8 +1501,8 @@ function nn(e, n, r) {
1497
1501
  let u = 2;
1498
1502
  for (; r.has(`${a}${u}`); )
1499
1503
  u += 1;
1500
- const c = `${a}${u}`;
1501
- return r.add(c), c;
1504
+ const p = `${a}${u}`;
1505
+ return r.add(p), p;
1502
1506
  }
1503
1507
  function rn(e) {
1504
1508
  let n = 0;
@@ -1510,55 +1514,55 @@ function tn(e) {
1510
1514
  return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e);
1511
1515
  }
1512
1516
  function on(e, n) {
1513
- const r = F(n.spec);
1517
+ const r = b(n.spec);
1514
1518
  if (!r)
1515
1519
  return;
1516
- const t = q(n.builder);
1520
+ const t = K(n.builder);
1517
1521
  if (t === "records") {
1518
- for (const o of H(r.fields)) w(e, o);
1522
+ for (const o of j(r.fields)) g(e, o);
1519
1523
  return;
1520
1524
  }
1521
1525
  if (t === "sql") {
1522
- for (const o of H(r.fields)) w(e, o);
1526
+ for (const o of j(r.fields)) g(e, o);
1523
1527
  return;
1524
1528
  }
1525
1529
  if (t === "analysis" || t === "metric") {
1526
- w(e, r.primaryMeasure);
1527
- for (const o of H(r.measures)) w(e, o);
1528
- for (const o of H(r.dimensions)) w(e, o);
1529
- w(e, r.dateField);
1530
+ g(e, r.primaryMeasure);
1531
+ for (const o of j(r.measures)) g(e, o);
1532
+ for (const o of j(r.dimensions)) g(e, o);
1533
+ g(e, r.dateField);
1530
1534
  return;
1531
1535
  }
1532
1536
  if (t === "matrix") {
1533
- const o = pe(r.rows), a = pe(r.columns), u = H(r.values);
1534
- for (const c of o) le(e, c);
1535
- for (const c of a) le(e, c);
1536
- for (const c of u) {
1537
- const S = F(c);
1538
- w(e, S == null ? void 0 : S.field), w(e, S == null ? void 0 : S.measure);
1537
+ const o = pe(r.rows), a = pe(r.columns), u = j(r.values);
1538
+ for (const p of o) le(e, p);
1539
+ for (const p of a) le(e, p);
1540
+ for (const p of u) {
1541
+ const w = b(p);
1542
+ g(e, w == null ? void 0 : w.field), g(e, w == null ? void 0 : w.measure);
1539
1543
  }
1540
1544
  }
1541
1545
  }
1542
1546
  function pe(e) {
1543
1547
  if (Array.isArray(e))
1544
1548
  return e;
1545
- const n = F(e);
1549
+ const n = b(e);
1546
1550
  return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
1547
1551
  }
1548
1552
  function le(e, n) {
1549
1553
  var r;
1550
1554
  if (G(n)) {
1551
- w(e, n);
1555
+ g(e, n);
1552
1556
  return;
1553
1557
  }
1554
- w(e, (r = F(n)) == null ? void 0 : r.field);
1558
+ g(e, (r = b(n)) == null ? void 0 : r.field);
1555
1559
  }
1556
1560
  function ce(e) {
1557
1561
  var n, r, t, o;
1558
1562
  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";
1559
1563
  }
1560
1564
  function sn(e) {
1561
- const n = F(e) || {};
1565
+ const n = b(e) || {};
1562
1566
  return N({
1563
1567
  id: e.id,
1564
1568
  title: e.title,
@@ -1573,7 +1577,7 @@ function sn(e) {
1573
1577
  description: n.description
1574
1578
  });
1575
1579
  }
1576
- function w(e, n) {
1580
+ function g(e, n) {
1577
1581
  G(n) && e.push(Y(n));
1578
1582
  }
1579
1583
  function Y(e) {
@@ -1603,11 +1607,11 @@ function an(e) {
1603
1607
  };
1604
1608
  }
1605
1609
  function G(e) {
1606
- const n = F(e);
1610
+ const n = b(e);
1607
1611
  return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
1608
1612
  }
1609
1613
  function we(e) {
1610
- const n = F(e);
1614
+ const n = b(e);
1611
1615
  return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
1612
1616
  }
1613
1617
  function x(e, n) {
@@ -1618,20 +1622,20 @@ function x(e, n) {
1618
1622
  if (Array.isArray(e))
1619
1623
  return `[${e.map((o) => x(o, n)).join(", ")}]`;
1620
1624
  if (G(e)) {
1621
- const o = R(Y(e), n);
1625
+ const o = C(Y(e), n);
1622
1626
  if (o) return `fields.${o}`;
1623
1627
  }
1624
1628
  if (we(e)) {
1625
1629
  const o = Se(e, n);
1626
1630
  if (o) return `sources.${o}`;
1627
1631
  }
1628
- const r = F(e);
1632
+ const r = b(e);
1629
1633
  return r ? `{ ${Object.entries(r).filter(([, o]) => o !== void 0).map(([o, a]) => `${JSON.stringify(o)}: ${x(a, n)}`).join(", ")} }` : JSON.stringify(e);
1630
1634
  }
1631
- function k(e) {
1635
+ function M(e) {
1632
1636
  return JSON.stringify(e, null, 2);
1633
1637
  }
1634
- function R(e, n) {
1638
+ function C(e, n) {
1635
1639
  if (G(e))
1636
1640
  return n.fieldNameByKey.get(Z(Y(e)));
1637
1641
  }
@@ -1691,7 +1695,7 @@ function $e(e) {
1691
1695
  return W(e)[0] || de(e);
1692
1696
  }
1693
1697
  function W(e) {
1694
- const n = F(e);
1698
+ const n = b(e);
1695
1699
  if (!n)
1696
1700
  return [];
1697
1701
  const r = [];
@@ -1705,7 +1709,7 @@ function Ie(e) {
1705
1709
  return W(e);
1706
1710
  }
1707
1711
  function de(e) {
1708
- const n = F(e);
1712
+ const n = b(e);
1709
1713
  return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
1710
1714
  }
1711
1715
  function cn(e) {
@@ -1717,18 +1721,18 @@ function ie(e) {
1717
1721
  ...e.source ? W(e.source) : []
1718
1722
  ]) : [];
1719
1723
  }
1720
- function q(e) {
1724
+ function K(e) {
1721
1725
  const n = String(e || "").replace(/^semaphor\./, "");
1722
1726
  if (!["metric", "records", "analysis", "matrix", "sql"].includes(n))
1723
1727
  throw new Error(`Unsupported sdkSpec builder: ${e}`);
1724
1728
  return n;
1725
1729
  }
1726
1730
  function mn(e) {
1727
- const n = q(e);
1731
+ const n = K(e);
1728
1732
  return n === "records" || n === "sql";
1729
1733
  }
1730
1734
  function fn(e) {
1731
- const n = F(e);
1735
+ const n = b(e);
1732
1736
  return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
1733
1737
  }
1734
1738
  function P(e, n) {
@@ -1746,7 +1750,7 @@ function X(e, n) {
1746
1750
  }
1747
1751
  return t;
1748
1752
  }
1749
- function K(e) {
1753
+ function q(e) {
1750
1754
  const n = String(e || "").replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
1751
1755
  if (n.length === 0)
1752
1756
  return "item";
@@ -1757,7 +1761,7 @@ function K(e) {
1757
1761
  return /^[A-Za-z_$]/.test(o) ? o : `item${o}`;
1758
1762
  }
1759
1763
  function me(e) {
1760
- const n = K(e);
1764
+ const n = q(e);
1761
1765
  return n.charAt(0).toUpperCase() + n.slice(1);
1762
1766
  }
1763
1767
  function yn(e) {
@@ -1767,10 +1771,10 @@ function yn(e) {
1767
1771
  function N(e) {
1768
1772
  return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
1769
1773
  }
1770
- function F(e) {
1774
+ function b(e) {
1771
1775
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
1772
1776
  }
1773
- function H(e) {
1777
+ function j(e) {
1774
1778
  return Array.isArray(e) ? e : [];
1775
1779
  }
1776
1780
  function J(e) {
@@ -1794,10 +1798,10 @@ export {
1794
1798
  xn as buildSemaphorGeneratedInputOptionIntent,
1795
1799
  Nn as buildSemaphorGeneratedViewExecutionRequest,
1796
1800
  En as buildSemaphorGeneratedViewExecutionRequests,
1797
- An as evaluateSemaphorDataAppContractUpdatePolicy,
1801
+ vn as evaluateSemaphorDataAppContractUpdatePolicy,
1798
1802
  Sn as generateSemaphorDataAppContract,
1799
1803
  bn as isSemaphorDataAppCodegenSummary,
1800
- jn as validateCodegenSummary,
1804
+ An as validateCodegenSummary,
1801
1805
  kn as validateSemaphorDataAppCodegenSummary,
1802
- vn as validateSemaphorGeneratedContract
1806
+ Hn as validateSemaphorGeneratedContract
1803
1807
  };