drizzle-cube 0.7.0 → 0.8.0

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 (301) hide show
  1. package/dist/adapters/ActivityGridChart.config-BQhBE_Mr.js +2 -0
  2. package/dist/adapters/ActivityGridChart.config-C3tSuOGV.cjs +1 -0
  3. package/dist/adapters/AreaChart.config-3cme8HyQ.js +2 -0
  4. package/dist/adapters/AreaChart.config-BSxrT52Z.cjs +1 -0
  5. package/dist/adapters/BarChart.config-BKS8IecE.cjs +1 -0
  6. package/dist/adapters/BarChart.config-lt_7PdIi.js +2 -0
  7. package/dist/adapters/BoxPlotChart.config-B7qvRnrF.cjs +1 -0
  8. package/dist/adapters/BoxPlotChart.config-Dv6ECj2j.js +2 -0
  9. package/dist/adapters/BubbleChart.config-BrIH7OAy.cjs +1 -0
  10. package/dist/adapters/BubbleChart.config-Fhotb7Pg.js +2 -0
  11. package/dist/adapters/CandlestickChart.config-CWH41FmF.cjs +1 -0
  12. package/dist/adapters/CandlestickChart.config-RPtXuxsX.js +2 -0
  13. package/dist/adapters/DataTable.config-71L0GzlT.js +2 -0
  14. package/dist/adapters/DataTable.config-BsOMQq3J.cjs +1 -0
  15. package/dist/adapters/FunnelChart.config-Cqte9C04.cjs +1 -0
  16. package/dist/adapters/FunnelChart.config-DJtwWeNz.js +2 -0
  17. package/dist/adapters/GaugeChart.config-WkwZ9VdS.cjs +1 -0
  18. package/dist/adapters/GaugeChart.config-vpVQlP5B.js +2 -0
  19. package/dist/adapters/HeatMapChart.config-DcmkDl07.cjs +1 -0
  20. package/dist/adapters/HeatMapChart.config-DsmMgGxJ.js +2 -0
  21. package/dist/adapters/KpiDelta.config-DVy561BH.js +2 -0
  22. package/dist/adapters/KpiDelta.config-dpqwLHNE.cjs +1 -0
  23. package/dist/adapters/KpiNumber.config-927l8nq8.js +2 -0
  24. package/dist/adapters/KpiNumber.config-BqFBMfPf.cjs +1 -0
  25. package/dist/adapters/KpiText.config-C-fZXuHq.cjs +1 -0
  26. package/dist/adapters/KpiText.config-CWoXuhMA.js +2 -0
  27. package/dist/adapters/LineChart.config-DTp7pqOY.js +2 -0
  28. package/dist/adapters/LineChart.config-DUGvSjcH.cjs +1 -0
  29. package/dist/adapters/MarkdownChart.config-23Dmv2Ty.cjs +1 -0
  30. package/dist/adapters/MarkdownChart.config-Cb2TnS0I.js +2 -0
  31. package/dist/adapters/MeasureProfileChart.config-B2qbWdhy.cjs +1 -0
  32. package/dist/adapters/MeasureProfileChart.config-CvBCeI5b.js +2 -0
  33. package/dist/adapters/PieChart.config-BzJb13QA.js +2 -0
  34. package/dist/adapters/PieChart.config-plCn5Ehr.cjs +1 -0
  35. package/dist/adapters/ProportionBarChart.config-1r-_moBH.cjs +1 -0
  36. package/dist/adapters/ProportionBarChart.config-CN6TtHTp.js +2 -0
  37. package/dist/adapters/RadarChart.config-BYhdj9M7.js +2 -0
  38. package/dist/adapters/RadarChart.config-CeUMP-1g.cjs +1 -0
  39. package/dist/adapters/RadialBarChart.config-B88yXNsq.cjs +1 -0
  40. package/dist/adapters/RadialBarChart.config-ZMK9HMoh.js +2 -0
  41. package/dist/adapters/RetentionCombinedChart.config-B5yvgUHM.cjs +1 -0
  42. package/dist/adapters/RetentionCombinedChart.config-Dd-YMdK8.js +2 -0
  43. package/dist/adapters/RetentionHeatmap.config-BYzDleoV.cjs +1 -0
  44. package/dist/adapters/RetentionHeatmap.config-Dvj7yTB0.js +2 -0
  45. package/dist/adapters/SankeyChart.config-CPFRmgFb.cjs +1 -0
  46. package/dist/adapters/SankeyChart.config-ClgqXM1N.js +2 -0
  47. package/dist/adapters/ScatterChart.config-CvJiqPa5.cjs +1 -0
  48. package/dist/adapters/ScatterChart.config-DLZ3rYMq.js +2 -0
  49. package/dist/adapters/SunburstChart.config-C_1V5hoQ.cjs +1 -0
  50. package/dist/adapters/SunburstChart.config-FNU75NCg.js +2 -0
  51. package/dist/adapters/TreeMapChart.config-CprZk_YF.js +2 -0
  52. package/dist/adapters/TreeMapChart.config-DNwd0ge9.cjs +1 -0
  53. package/dist/adapters/WaterfallChart.config-BBhcN_Fh.cjs +1 -0
  54. package/dist/adapters/WaterfallChart.config-H7s6SSV3.js +2 -0
  55. package/dist/adapters/{compiler-DAyodAnH.cjs → compiler-BaLO10VN.cjs} +7 -7
  56. package/dist/adapters/{compiler-Dq04wAjm.js → compiler-CQJ5GOwF.js} +286 -119
  57. package/dist/adapters/core/http-port.d.ts +34 -7
  58. package/dist/adapters/core/index.cjs +1 -1
  59. package/dist/adapters/core/index.d.ts +1 -0
  60. package/dist/adapters/core/index.js +2 -2
  61. package/dist/adapters/core/rest-handlers.d.ts +1 -1
  62. package/dist/adapters/{core-BjxfG6Uf.js → core-DXkuSUBg.js} +80 -64
  63. package/dist/adapters/core-DgTGXxDu.cjs +1 -0
  64. package/dist/adapters/express/index.cjs +2 -2
  65. package/dist/adapters/express/index.d.ts +11 -2
  66. package/dist/adapters/express/index.js +14 -14
  67. package/dist/adapters/fastify/index.cjs +2 -2
  68. package/dist/adapters/fastify/index.d.ts +11 -2
  69. package/dist/adapters/fastify/index.js +12 -12
  70. package/dist/adapters/{handler-ox6qxLw5.js → handler-CphYSZRh.js} +76 -77
  71. package/dist/adapters/{handler-C6Hj6_Yk.cjs → handler-DrRT6c14.cjs} +8 -8
  72. package/dist/adapters/hono/index.cjs +1 -1
  73. package/dist/adapters/hono/index.js +9 -9
  74. package/dist/adapters/mcp-tools-handlers.d.ts +10 -3
  75. package/dist/adapters/mcp-tools.cjs +1 -1
  76. package/dist/adapters/mcp-tools.js +18 -20
  77. package/dist/adapters/mcp-transport-BGkSz-ZT.cjs +40 -0
  78. package/dist/adapters/mcp-transport-fJud19xz.js +606 -0
  79. package/dist/adapters/mcp-transport.d.ts +13 -2
  80. package/dist/adapters/nextjs/index.cjs +1 -1
  81. package/dist/adapters/nextjs/index.d.ts +5 -2
  82. package/dist/adapters/nextjs/index.js +32 -32
  83. package/dist/adapters/{openai-C9LNhHfK.js → openai-CBrN4nxl.js} +2 -2
  84. package/dist/adapters/{openai-DlT-0VRC.cjs → openai-CI9vGKSf.cjs} +1 -1
  85. package/dist/adapters/{openai-BffpdO4n.cjs → openai-CSzWluuv.cjs} +1 -1
  86. package/dist/adapters/{openai-CmyXJWti.js → openai-D-VMcPao.js} +1 -1
  87. package/dist/adapters/utils-BY0-KFyI.cjs +128 -0
  88. package/dist/adapters/{utils-tjiwXFnP.js → utils-DkmShl5f.js} +29 -22
  89. package/dist/adapters/utils.cjs +1 -1
  90. package/dist/adapters/utils.d.ts +2 -2
  91. package/dist/adapters/utils.js +1 -1
  92. package/dist/cjs/adapters/core/http-port.d.ts +34 -7
  93. package/dist/cjs/adapters/core/index.d.ts +1 -0
  94. package/dist/cjs/adapters/core/rest-handlers.d.ts +1 -1
  95. package/dist/cjs/adapters/express/index.d.ts +11 -2
  96. package/dist/cjs/adapters/fastify/index.d.ts +11 -2
  97. package/dist/cjs/adapters/mcp-tools-handlers.d.ts +10 -3
  98. package/dist/cjs/adapters/mcp-transport.d.ts +13 -2
  99. package/dist/cjs/adapters/nextjs/index.d.ts +5 -2
  100. package/dist/cjs/adapters/utils.d.ts +2 -2
  101. package/dist/cjs/client/charts/chartConfigs.d.ts +1 -1
  102. package/dist/cjs/client/components/charts/GaugeChart.d.ts +8 -0
  103. package/dist/cjs/client/components/charts/gaugeChartHelpers.d.ts +117 -12
  104. package/dist/cjs/server/adapters/base-adapter.d.ts +46 -0
  105. package/dist/cjs/server/adapters/databend-adapter.d.ts +5 -0
  106. package/dist/cjs/server/adapters/duckdb-adapter.d.ts +5 -0
  107. package/dist/cjs/server/adapters/mysql-adapter.d.ts +14 -0
  108. package/dist/cjs/server/adapters/postgres-adapter.d.ts +15 -0
  109. package/dist/cjs/server/adapters/snowflake-adapter.d.ts +6 -0
  110. package/dist/cjs/server/adapters/sqlite-adapter.d.ts +21 -0
  111. package/dist/cjs/server/attribute-dimensions.d.ts +99 -0
  112. package/dist/cjs/server/cache-utils.d.ts +5 -1
  113. package/dist/cjs/server/compiler-metadata.d.ts +24 -3
  114. package/dist/cjs/server/compiler.d.ts +157 -10
  115. package/dist/cjs/server/execution/query-result-cache.d.ts +1 -1
  116. package/dist/cjs/server/index.d.ts +11 -3
  117. package/dist/cjs/server/query-handlers.d.ts +1 -1
  118. package/dist/cjs/server/types/core.d.ts +8 -0
  119. package/dist/cjs/server/types/cube.d.ts +27 -2
  120. package/dist/client/charts/chartConfigs.d.ts +1 -1
  121. package/dist/client/charts.js +12 -12
  122. package/dist/client/chunks/{DashboardEditModal-ByXLlXZD.js → DashboardEditModal-9An5EDAz.js} +1061 -992
  123. package/dist/client/chunks/{DashboardEditModal-ByXLlXZD.js.map → DashboardEditModal-9An5EDAz.js.map} +1 -1
  124. package/dist/client/chunks/{ProportionBarChart-lOeVz8ZC.js → ProportionBarChart-BVcbGY2C.js} +3 -3
  125. package/dist/client/chunks/{ProportionBarChart-lOeVz8ZC.js.map → ProportionBarChart-BVcbGY2C.js.map} +1 -1
  126. package/dist/client/chunks/{RetentionCombinedChart-Mcm7zHFx.js → RetentionCombinedChart-D68Rvdi-.js} +3 -3
  127. package/dist/client/chunks/{RetentionCombinedChart-Mcm7zHFx.js.map → RetentionCombinedChart-D68Rvdi-.js.map} +1 -1
  128. package/dist/client/chunks/{RetentionHeatmap-4VJx5KDM.js → RetentionHeatmap-CE7BAjrB.js} +2 -2
  129. package/dist/client/chunks/{RetentionHeatmap-4VJx5KDM.js.map → RetentionHeatmap-CE7BAjrB.js.map} +1 -1
  130. package/dist/client/chunks/{af-ZA-BTaChuqI.js → af-ZA-C0dGb_53.js} +7 -3
  131. package/dist/client/chunks/af-ZA-C0dGb_53.js.map +1 -0
  132. package/dist/client/chunks/{analysis-builder-CWTJQQtL.js → analysis-builder-D1pYvvwc.js} +9 -9
  133. package/dist/client/chunks/{analysis-builder-CWTJQQtL.js.map → analysis-builder-D1pYvvwc.js.map} +1 -1
  134. package/dist/client/chunks/{analysis-builder-shared-l-4WKVS1.js → analysis-builder-shared-BQvwUc6z.js} +9 -9
  135. package/dist/client/chunks/{analysis-builder-shared-l-4WKVS1.js.map → analysis-builder-shared-BQvwUc6z.js.map} +1 -1
  136. package/dist/client/chunks/{chart-activity-grid-DVOhLgxv.js → chart-activity-grid-DvD_4wJz.js} +12 -5
  137. package/dist/client/chunks/chart-activity-grid-DvD_4wJz.js.map +1 -0
  138. package/dist/client/chunks/{chart-area-C-5ATxvi.js → chart-area-DPp3hSOK.js} +2 -2
  139. package/dist/client/chunks/{chart-area-C-5ATxvi.js.map → chart-area-DPp3hSOK.js.map} +1 -1
  140. package/dist/client/chunks/{chart-bar-CPiLaXHP.js → chart-bar-Od3pOyZ0.js} +3 -3
  141. package/dist/client/chunks/{chart-bar-CPiLaXHP.js.map → chart-bar-Od3pOyZ0.js.map} +1 -1
  142. package/dist/client/chunks/{chart-box-plot-Bae5O9xC.js → chart-box-plot-l0iFn2n2.js} +2 -2
  143. package/dist/client/chunks/{chart-box-plot-Bae5O9xC.js.map → chart-box-plot-l0iFn2n2.js.map} +1 -1
  144. package/dist/client/chunks/{chart-bubble-BFN5WIpf.js → chart-bubble-Dl0RcP8N.js} +2 -2
  145. package/dist/client/chunks/{chart-bubble-BFN5WIpf.js.map → chart-bubble-Dl0RcP8N.js.map} +1 -1
  146. package/dist/client/chunks/{chart-candlestick-PBQKp_z7.js → chart-candlestick-DZMqbscF.js} +2 -2
  147. package/dist/client/chunks/{chart-candlestick-PBQKp_z7.js.map → chart-candlestick-DZMqbscF.js.map} +1 -1
  148. package/dist/client/chunks/{chart-config-gauge-DNafFwfS.js → chart-config-gauge-CJktdjox.js} +3 -4
  149. package/dist/client/chunks/chart-config-gauge-CJktdjox.js.map +1 -0
  150. package/dist/client/chunks/{chart-data-table-SNSqZj9B.js → chart-data-table-DgiNBOWf.js} +5 -5
  151. package/dist/client/chunks/chart-data-table-DgiNBOWf.js.map +1 -0
  152. package/dist/client/chunks/{chart-funnel-CkHSXp6h.js → chart-funnel-YLZlyN1X.js} +2 -2
  153. package/dist/client/chunks/{chart-funnel-CkHSXp6h.js.map → chart-funnel-YLZlyN1X.js.map} +1 -1
  154. package/dist/client/chunks/{chart-gauge-DHIGq3TH.js → chart-gauge-BsqE2wwF.js} +169 -116
  155. package/dist/client/chunks/chart-gauge-BsqE2wwF.js.map +1 -0
  156. package/dist/client/chunks/{chart-heat-map-Bb8L1XQr.js → chart-heat-map-BsND8RM_.js} +3 -3
  157. package/dist/client/chunks/{chart-heat-map-Bb8L1XQr.js.map → chart-heat-map-BsND8RM_.js.map} +1 -1
  158. package/dist/client/chunks/{chart-kpi-delta-BJCOXE-F.js → chart-kpi-delta-m0azuva-.js} +3 -3
  159. package/dist/client/chunks/{chart-kpi-delta-BJCOXE-F.js.map → chart-kpi-delta-m0azuva-.js.map} +1 -1
  160. package/dist/client/chunks/{chart-kpi-number-Cdqgv20g.js → chart-kpi-number-6JS15SqF.js} +5 -5
  161. package/dist/client/chunks/{chart-kpi-number-Cdqgv20g.js.map → chart-kpi-number-6JS15SqF.js.map} +1 -1
  162. package/dist/client/chunks/{chart-kpi-text-B10ZHCsI.js → chart-kpi-text-BqX8p8Jn.js} +3 -3
  163. package/dist/client/chunks/{chart-kpi-text-B10ZHCsI.js.map → chart-kpi-text-BqX8p8Jn.js.map} +1 -1
  164. package/dist/client/chunks/{chart-line-CzvVL3Be.js → chart-line-NCmpxBfE.js} +3 -3
  165. package/dist/client/chunks/{chart-line-CzvVL3Be.js.map → chart-line-NCmpxBfE.js.map} +1 -1
  166. package/dist/client/chunks/{chart-markdown-C0xxBW81.js → chart-markdown-ZOobqiiX.js} +2 -2
  167. package/dist/client/chunks/{chart-markdown-C0xxBW81.js.map → chart-markdown-ZOobqiiX.js.map} +1 -1
  168. package/dist/client/chunks/{chart-measure-profile-BSUPFZCR.js → chart-measure-profile-CBAZaicJ.js} +3 -3
  169. package/dist/client/chunks/{chart-measure-profile-BSUPFZCR.js.map → chart-measure-profile-CBAZaicJ.js.map} +1 -1
  170. package/dist/client/chunks/{chart-pie-CwRfwWWZ.js → chart-pie-ChrasEI8.js} +3 -3
  171. package/dist/client/chunks/{chart-pie-CwRfwWWZ.js.map → chart-pie-ChrasEI8.js.map} +1 -1
  172. package/dist/client/chunks/{chart-radar-Dfql2E7i.js → chart-radar-CxSVF7yL.js} +3 -3
  173. package/dist/client/chunks/{chart-radar-Dfql2E7i.js.map → chart-radar-CxSVF7yL.js.map} +1 -1
  174. package/dist/client/chunks/{chart-radial-bar-oE9OZ1IX.js → chart-radial-bar--SN0Wph0.js} +3 -3
  175. package/dist/client/chunks/{chart-radial-bar-oE9OZ1IX.js.map → chart-radial-bar--SN0Wph0.js.map} +1 -1
  176. package/dist/client/chunks/{chart-sankey-tK7Oz1bC.js → chart-sankey-CDOSGg9r.js} +2 -2
  177. package/dist/client/chunks/{chart-sankey-tK7Oz1bC.js.map → chart-sankey-CDOSGg9r.js.map} +1 -1
  178. package/dist/client/chunks/{chart-scatter-BtLfAsZb.js → chart-scatter-DgcEF-kI.js} +3 -3
  179. package/dist/client/chunks/{chart-scatter-BtLfAsZb.js.map → chart-scatter-DgcEF-kI.js.map} +1 -1
  180. package/dist/client/chunks/{chart-sunburst-B7ryWwQ1.js → chart-sunburst-MB-jlGBm.js} +3 -3
  181. package/dist/client/chunks/{chart-sunburst-B7ryWwQ1.js.map → chart-sunburst-MB-jlGBm.js.map} +1 -1
  182. package/dist/client/chunks/{chart-tree-map-DU5M3-qe.js → chart-tree-map-DeDXveVd.js} +3 -3
  183. package/dist/client/chunks/{chart-tree-map-DU5M3-qe.js.map → chart-tree-map-DeDXveVd.js.map} +1 -1
  184. package/dist/client/chunks/{chart-waterfall-CAwutpzd.js → chart-waterfall-ur4vkO1j.js} +3 -3
  185. package/dist/client/chunks/{chart-waterfall-CAwutpzd.js.map → chart-waterfall-ur4vkO1j.js.map} +1 -1
  186. package/dist/client/chunks/{charts-core-BxBB2zBE.js → charts-core-BAH5pkSB.js} +2 -2
  187. package/dist/client/chunks/{charts-core-BxBB2zBE.js.map → charts-core-BAH5pkSB.js.map} +1 -1
  188. package/dist/client/chunks/charts-loader-eToV8je7.js +85 -0
  189. package/dist/client/chunks/{charts-loader-0avVzeDd.js.map → charts-loader-eToV8je7.js.map} +1 -1
  190. package/dist/client/chunks/{exceljs.min-DWC_b8G9.js → exceljs.min-CiByP8VQ.js} +2 -3
  191. package/dist/client/chunks/{exceljs.min-DWC_b8G9.js.map → exceljs.min-CiByP8VQ.js.map} +1 -1
  192. package/dist/client/chunks/{nl-NL-BSMhprPr.js → nl-NL-CMXHDBr0.js} +10 -3
  193. package/dist/client/chunks/nl-NL-CMXHDBr0.js.map +1 -0
  194. package/dist/client/chunks/{schema-visualization-CGbnbzj_.js → schema-visualization-BEbFtUIL.js} +3 -3
  195. package/dist/client/chunks/{schema-visualization-CGbnbzj_.js.map → schema-visualization-BEbFtUIL.js.map} +1 -1
  196. package/dist/client/chunks/{useDirtyStateTracking-Dc-Si4db.js → useDirtyStateTracking-CSDg96Rw.js} +4 -4
  197. package/dist/client/chunks/{useDirtyStateTracking-Dc-Si4db.js.map → useDirtyStateTracking-CSDg96Rw.js.map} +1 -1
  198. package/dist/client/chunks/{useExplainAI-DJbc7Lu4.js → useExplainAI-BnkoZ-zS.js} +4 -4
  199. package/dist/client/chunks/{useExplainAI-DJbc7Lu4.js.map → useExplainAI-BnkoZ-zS.js.map} +1 -1
  200. package/dist/client/chunks/{vendor-cTfe9Kho.js → vendor-BmJDaduD.js} +2 -2
  201. package/dist/client/chunks/vendor-BmJDaduD.js.map +1 -0
  202. package/dist/client/components/charts/GaugeChart.d.ts +8 -0
  203. package/dist/client/components/charts/gaugeChartHelpers.d.ts +117 -12
  204. package/dist/client/components.js +1 -1
  205. package/dist/client/hooks.js +3 -3
  206. package/dist/client/icons.js +1 -1
  207. package/dist/client/index.js +13 -13
  208. package/dist/client/providers.js +1 -1
  209. package/dist/client/schema.js +1 -1
  210. package/dist/client/utils.js +4 -4
  211. package/dist/client-bundle-stats.html +1 -1
  212. package/dist/mcp-app/mcp-app.html +88 -88
  213. package/dist/server/adapters/base-adapter.d.ts +46 -0
  214. package/dist/server/adapters/databend-adapter.d.ts +5 -0
  215. package/dist/server/adapters/duckdb-adapter.d.ts +5 -0
  216. package/dist/server/adapters/mysql-adapter.d.ts +14 -0
  217. package/dist/server/adapters/postgres-adapter.d.ts +15 -0
  218. package/dist/server/adapters/snowflake-adapter.d.ts +6 -0
  219. package/dist/server/adapters/sqlite-adapter.d.ts +21 -0
  220. package/dist/server/attribute-dimensions.d.ts +99 -0
  221. package/dist/server/cache-utils.d.ts +5 -1
  222. package/dist/server/compiler-metadata.d.ts +24 -3
  223. package/dist/server/compiler.d.ts +157 -10
  224. package/dist/server/execution/query-result-cache.d.ts +1 -1
  225. package/dist/server/index.cjs +40 -36
  226. package/dist/server/index.d.ts +11 -3
  227. package/dist/server/index.js +681 -482
  228. package/dist/server/{openai-Czk1BdHa.js → openai-6uUf7h-5.js} +1 -1
  229. package/dist/server/{openai-DBwI1OSu.cjs → openai-BBe1XbZd.cjs} +1 -1
  230. package/dist/server/{openai-Cu4TXXjl.cjs → openai-BmADmD1e.cjs} +1 -1
  231. package/dist/server/{openai-CUf4vc3Q.js → openai-C1gLuR-0.js} +1 -1
  232. package/dist/server/query-handlers.d.ts +1 -1
  233. package/dist/server/types/core.d.ts +8 -0
  234. package/dist/server/types/cube.d.ts +27 -2
  235. package/package.json +2 -2
  236. package/dist/adapters/ActivityGridChart.config-DaYILvFZ.cjs +0 -1
  237. package/dist/adapters/ActivityGridChart.config-_SyTBEyR.js +0 -2
  238. package/dist/adapters/AreaChart.config-BKh6fY1_.cjs +0 -1
  239. package/dist/adapters/AreaChart.config-CJoxLP3Y.js +0 -2
  240. package/dist/adapters/BarChart.config-Bm1bfRbI.cjs +0 -1
  241. package/dist/adapters/BarChart.config-CGu2Bqrx.js +0 -2
  242. package/dist/adapters/BoxPlotChart.config-B7M9CQaE.js +0 -2
  243. package/dist/adapters/BoxPlotChart.config-CXQel8Hk.cjs +0 -1
  244. package/dist/adapters/BubbleChart.config-BJ36IuVS.cjs +0 -1
  245. package/dist/adapters/BubbleChart.config-CWoXeLdm.js +0 -2
  246. package/dist/adapters/CandlestickChart.config-CGMLZVIy.cjs +0 -1
  247. package/dist/adapters/CandlestickChart.config-CzOcfF1e.js +0 -2
  248. package/dist/adapters/DataTable.config-CdAzueTs.cjs +0 -1
  249. package/dist/adapters/DataTable.config-D_KmPyxV.js +0 -2
  250. package/dist/adapters/FunnelChart.config-D1QAUuYl.cjs +0 -1
  251. package/dist/adapters/FunnelChart.config-DCRHQoFc.js +0 -2
  252. package/dist/adapters/GaugeChart.config-DAybRXP3.js +0 -2
  253. package/dist/adapters/GaugeChart.config-WUPfyLP-.cjs +0 -1
  254. package/dist/adapters/HeatMapChart.config-CziltPnC.cjs +0 -1
  255. package/dist/adapters/HeatMapChart.config-DHpXNONW.js +0 -2
  256. package/dist/adapters/KpiDelta.config-Bw5o0ocY.js +0 -2
  257. package/dist/adapters/KpiDelta.config-CdAmE1pw.cjs +0 -1
  258. package/dist/adapters/KpiNumber.config-CQ_wq2gx.js +0 -2
  259. package/dist/adapters/KpiNumber.config-wxN8x4DC.cjs +0 -1
  260. package/dist/adapters/KpiText.config-DIRIC97F.cjs +0 -1
  261. package/dist/adapters/KpiText.config-eODcP6Hn.js +0 -2
  262. package/dist/adapters/LineChart.config-32-9zA2V.js +0 -2
  263. package/dist/adapters/LineChart.config-BukeFp6z.cjs +0 -1
  264. package/dist/adapters/MarkdownChart.config-BVsR5LDy.js +0 -2
  265. package/dist/adapters/MarkdownChart.config-j4veYjcZ.cjs +0 -1
  266. package/dist/adapters/MeasureProfileChart.config-BRDYx1hw.js +0 -2
  267. package/dist/adapters/MeasureProfileChart.config-CIosBxco.cjs +0 -1
  268. package/dist/adapters/PieChart.config-Bj8KiA0n.cjs +0 -1
  269. package/dist/adapters/PieChart.config-DgAj3y-I.js +0 -2
  270. package/dist/adapters/ProportionBarChart.config-BfFOppHY.js +0 -2
  271. package/dist/adapters/ProportionBarChart.config-c8GGE1aK.cjs +0 -1
  272. package/dist/adapters/RadarChart.config-D7iHY1v9.js +0 -2
  273. package/dist/adapters/RadarChart.config-ghlANG2-.cjs +0 -1
  274. package/dist/adapters/RadialBarChart.config-CsXIz-0v.js +0 -2
  275. package/dist/adapters/RadialBarChart.config-Dsvu2CPV.cjs +0 -1
  276. package/dist/adapters/RetentionCombinedChart.config-CdT1kXC7.js +0 -2
  277. package/dist/adapters/RetentionCombinedChart.config-sDjFKH9K.cjs +0 -1
  278. package/dist/adapters/RetentionHeatmap.config-CvKBvQmu.cjs +0 -1
  279. package/dist/adapters/RetentionHeatmap.config-DbM3ICwc.js +0 -2
  280. package/dist/adapters/SankeyChart.config-BNBcIHaD.js +0 -2
  281. package/dist/adapters/SankeyChart.config-DZscz3kh.cjs +0 -1
  282. package/dist/adapters/ScatterChart.config-BNYIddyM.cjs +0 -1
  283. package/dist/adapters/ScatterChart.config-CEhtoLWc.js +0 -2
  284. package/dist/adapters/SunburstChart.config-ClseCzji.cjs +0 -1
  285. package/dist/adapters/SunburstChart.config-nnphNoVO.js +0 -2
  286. package/dist/adapters/TreeMapChart.config-C8-75muA.js +0 -2
  287. package/dist/adapters/TreeMapChart.config-DoXeUg9Y.cjs +0 -1
  288. package/dist/adapters/WaterfallChart.config-BOF1qxY3.cjs +0 -1
  289. package/dist/adapters/WaterfallChart.config-uW5YyOji.js +0 -2
  290. package/dist/adapters/core-zV2w0hO2.cjs +0 -1
  291. package/dist/adapters/mcp-transport-C_t_p0wU.cjs +0 -40
  292. package/dist/adapters/mcp-transport-DFH9e6de.js +0 -603
  293. package/dist/adapters/utils-C5FLHK04.cjs +0 -128
  294. package/dist/client/chunks/af-ZA-BTaChuqI.js.map +0 -1
  295. package/dist/client/chunks/chart-activity-grid-DVOhLgxv.js.map +0 -1
  296. package/dist/client/chunks/chart-config-gauge-DNafFwfS.js.map +0 -1
  297. package/dist/client/chunks/chart-data-table-SNSqZj9B.js.map +0 -1
  298. package/dist/client/chunks/chart-gauge-DHIGq3TH.js.map +0 -1
  299. package/dist/client/chunks/charts-loader-0avVzeDd.js +0 -85
  300. package/dist/client/chunks/nl-NL-BSMhprPr.js.map +0 -1
  301. package/dist/client/chunks/vendor-cTfe9Kho.js.map +0 -1
@@ -542,7 +542,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
542
542
  "chart.configText.add_2_or_more_measures_they_become_the_x_axis_categories_in_the_order_li": "Add 2 or more measures — they become the X-axis categories in the order listed",
543
543
  "chart.configText.add_an_accent_colored_border_on_one_side_of_the_content": "Add an accent-colored border on one side of the content",
544
544
  "chart.configText.all_fields_to_display_as_columns": "All fields to display as columns",
545
- "chart.configText.array_of_value_0_1_fraction_color_bands_shown_as_outer_arc_markers": "Array of {value (0–1 fraction), color} bands shown as outer arc markers",
545
+ "chart.gauge.thresholds.description": "Each band runs from its value up to the next one. Values are on the gauge’s own scale.",
546
546
  "chart.configText.axes_categories": "Axes (Categories)",
547
547
  "chart.configText.bubble_colour": "Bubble Colour",
548
548
  "chart.configText.bubble_labels": "Bubble Labels",
@@ -714,6 +714,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
714
714
  "server.errors.retentionValidationFailed": "Retention validation failed: {errors}",
715
715
  "server.errors.cubeRefUnresolved": "{cubeName}.joins.{joinName}: target cube '{targetCube}' is not registered",
716
716
  "server.errors.unresolvedCubeRefs": "Unresolved cube references:\n{details}",
717
+ "server.errors.cubeSetIdEmpty": "Cube set id must not be empty — the empty id is reserved for the base cube set",
718
+ "server.errors.cubeSetNotFound": "No cube set registered for '{setId}'",
719
+ "server.errors.attributeIdRequired": "Attribute definitions must have a non-empty id",
717
720
  "server.errors.calculatedMeasureValidation": "Calculated measure validation failed for cube '{cubeName}':\n{details}",
718
721
  "server.errors.queryValidationFailed": "Query validation failed: {errors}",
719
722
  "server.errors.queryContainsMultipleModes": "Query contains multiple query modes: {modes}",
@@ -1585,7 +1588,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1585
1588
  "chart.option.proportionBarLabels.label": "Show labels",
1586
1589
  "chart.runtime.summarySince": "since {period}",
1587
1590
  "chart.option.showPoints.label": "Show data points",
1588
- "chart.option.showPoints.description": "Draw a marker at every data point. Turn off for dense series, where the markers obscure the line"
1591
+ "chart.option.showPoints.description": "Draw a marker at every data point. Turn off for dense series, where the markers obscure the line",
1592
+ "chart.gauge.thresholds.from": "Band starts at",
1593
+ "chart.gauge.thresholds.colour": "Band colour",
1594
+ "chart.gauge.thresholds.add": "Add band",
1595
+ "chart.gauge.thresholds.remove": "Remove band"
1589
1596
  };
1590
1597
  function f(e, t) {
1591
1598
  let n = d[e];
@@ -6421,13 +6428,13 @@ function Mo(e, t, n) {
6421
6428
  //#endregion
6422
6429
  //#region src/server/query-handlers.ts
6423
6430
  var No = fo.messages[0]?.content.text ?? "";
6424
- async function Po(e, t) {
6431
+ async function Po(e, t, n) {
6425
6432
  return {
6426
- cubes: jo(e.getMetadata(), {
6427
- topic: t.topic,
6428
- intent: t.intent,
6429
- limit: t.limit,
6430
- minScore: t.minScore
6433
+ cubes: jo(e.getMetadata(t), {
6434
+ topic: n.topic,
6435
+ intent: n.intent,
6436
+ limit: n.limit,
6437
+ minScore: n.minScore
6431
6438
  }),
6432
6439
  queryLanguageReference: co,
6433
6440
  dateFilteringGuide: No
@@ -6480,7 +6487,7 @@ function zo(e, t) {
6480
6487
  return r;
6481
6488
  }
6482
6489
  async function Bo(e, t, n) {
6483
- let r = Fo(n.query), i = e.validateQuery(r);
6490
+ let r = Fo(n.query), i = e.validateQuery(r, t);
6484
6491
  if (!i.isValid) throw Error(`Query validation failed: ${i.errors.join(", ")}`);
6485
6492
  let a = await e.executeMultiCubeQuery(r, t);
6486
6493
  return {
@@ -7214,9 +7221,9 @@ function ys(e, t, n) {
7214
7221
  return;
7215
7222
  }
7216
7223
  }
7217
- function Y(e, t, n) {
7218
- let r = t.validateQuery(e);
7219
- if (!r.isValid) throw Error(`${n} validation failed: ${r.errors.join(", ")}`);
7224
+ function Y(e, t, n, r) {
7225
+ let i = n.validateQuery(e, t);
7226
+ if (!i.isValid) throw Error(`${r} validation failed: ${i.errors.join(", ")}`);
7220
7227
  }
7221
7228
  async function X(e, t, n) {
7222
7229
  return {
@@ -7289,7 +7296,7 @@ async function ws(e, t, n) {
7289
7296
  }[vs(e)]();
7290
7297
  }
7291
7298
  async function Ts(e, t, n) {
7292
- Y(e, n, "Query");
7299
+ Y(e, t, n, "Query");
7293
7300
  let r = bs(e), i = r.length > 1, { sqlResult: a, analysis: o } = await X(e, t, n), s = r.map((t) => ({
7294
7301
  cube: t,
7295
7302
  query: {
@@ -7315,7 +7322,7 @@ async function Ts(e, t, n) {
7315
7322
  });
7316
7323
  }
7317
7324
  async function Es(e, t, n) {
7318
- Y(e, n, "Comparison query");
7325
+ Y(e, t, n, "Comparison query");
7319
7326
  let r = bs(e), i = r.length > 1, { sqlResult: a, analysis: o } = await X(e, t, n), s = e.timeDimensions?.find((e) => e.compareDateRange && e.compareDateRange.length >= 2), c = s ? {
7320
7327
  timeDimension: s.dimension,
7321
7328
  granularity: s.granularity || "day",
@@ -7464,7 +7471,7 @@ async function js(e, t, n, r) {
7464
7471
  }) };
7465
7472
  }
7466
7473
  async function Ms(e, t, n) {
7467
- Y(e, n, "Funnel query");
7474
+ Y(e, t, n, "Funnel query");
7468
7475
  let r = xs(e), { sqlResult: i, analysis: a } = await X(e, t, n), o = e.funnel;
7469
7476
  return $({
7470
7477
  mode: "funnel",
@@ -7491,7 +7498,7 @@ async function Ms(e, t, n) {
7491
7498
  });
7492
7499
  }
7493
7500
  async function Ns(e, t, n) {
7494
- Y(e, n, "Flow query");
7501
+ Y(e, t, n, "Flow query");
7495
7502
  let r = Ss(e), { sqlResult: i, analysis: a } = await X(e, t, n), o = e.flow;
7496
7503
  return $({
7497
7504
  mode: "flow",
@@ -7513,7 +7520,7 @@ async function Ns(e, t, n) {
7513
7520
  });
7514
7521
  }
7515
7522
  async function Ps(e, t, n) {
7516
- Y(e, n, "Retention query");
7523
+ Y(e, t, n, "Retention query");
7517
7524
  let r = Cs(e), { sqlResult: i, analysis: a } = await X(e, t, n), o = e.retention;
7518
7525
  return $({
7519
7526
  mode: "retention",
@@ -7535,13 +7542,13 @@ async function Ps(e, t, n) {
7535
7542
  }
7536
7543
  });
7537
7544
  }
7538
- async function Fs(e, t) {
7539
- return es(e.getMetadata(), t.naturalLanguage, t.cube);
7545
+ async function Fs(e, t, n) {
7546
+ return es(e.getMetadata(t), n.naturalLanguage, n.cube);
7540
7547
  }
7541
7548
  async function Is(e, t, n) {
7542
- let r = e.getMetadata(), i = await fs(t.query, r);
7543
- if (i.isValid && n) try {
7544
- let r = Fo(i.correctedQuery ?? t.query), a = await e.dryRun(r, n);
7549
+ let r = e.getMetadata(t), i = await fs(n.query, r);
7550
+ if (i.isValid) try {
7551
+ let r = Fo(i.correctedQuery ?? n.query), a = await e.dryRun(r, t);
7545
7552
  return {
7546
7553
  ...i,
7547
7554
  sql: a
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-C5FLHK04.cjs");exports.buildTransformedQuery=e.t,exports.calculateQueryComplexity=e.n,exports.formatCubeResponse=e.r,exports.formatErrorResponse=e.i,exports.formatMetaResponse=e.a,exports.formatSqlResponse=e.o,exports.formatSqlString=e.S,exports.generateRequestId=e.s,exports.getDatabaseType=e.c,exports.handleBatchRequest=e.l,exports.handleDiscover=e.p,exports.handleDryRun=e.u,exports.handleLoad=e.m,exports.handleSuggest=e.d,exports.handleValidate=e.f,exports.normalizeQueryFields=e.h;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-BY0-KFyI.cjs");exports.buildTransformedQuery=e.t,exports.calculateQueryComplexity=e.n,exports.formatCubeResponse=e.r,exports.formatErrorResponse=e.i,exports.formatMetaResponse=e.a,exports.formatSqlResponse=e.o,exports.formatSqlString=e.S,exports.generateRequestId=e.s,exports.getDatabaseType=e.c,exports.handleBatchRequest=e.l,exports.handleDiscover=e.p,exports.handleDryRun=e.u,exports.handleLoad=e.m,exports.handleSuggest=e.d,exports.handleValidate=e.f,exports.normalizeQueryFields=e.h;
@@ -354,11 +354,11 @@ export interface ValidateRequest {
354
354
  /**
355
355
  * Handle /suggest endpoint - generate query from natural language
356
356
  */
357
- export declare function handleSuggest(semanticLayer: SemanticLayerCompiler, body: SuggestRequest): Promise<QuerySuggestion>;
357
+ export declare function handleSuggest(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: SuggestRequest): Promise<QuerySuggestion>;
358
358
  /**
359
359
  * Handle /validate endpoint - validate query with corrections
360
360
  */
361
- export declare function handleValidate(semanticLayer: SemanticLayerCompiler, body: ValidateRequest, securityContext?: SecurityContext): Promise<AIValidationResult & {
361
+ export declare function handleValidate(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: ValidateRequest): Promise<AIValidationResult & {
362
362
  sql?: {
363
363
  sql: string;
364
364
  params?: any[];
@@ -1,2 +1,2 @@
1
- import { S as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./utils-tjiwXFnP.js";
1
+ import { S as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./utils-DkmShl5f.js";
2
2
  export { m as buildTransformedQuery, l as calculateQueryComplexity, f as formatCubeResponse, o as formatErrorResponse, t as formatMetaResponse, u as formatSqlResponse, e as formatSqlString, p as generateRequestId, n as getDatabaseType, s as handleBatchRequest, d as handleDiscover, h as handleDryRun, c as handleLoad, r as handleSuggest, i as handleValidate, a as normalizeQueryFields };
@@ -7,8 +7,16 @@
7
7
  * (Hono/Next.js). Implementations are constructed per request by each adapter.
8
8
  *
9
9
  * This interface is public — third parties implement it to build adapters for
10
- * other frameworks. Add new capabilities as optional members or via a separate
11
- * extension interface; a new required member is a breaking change.
10
+ * other frameworks. Prefer optional members or a separate extension interface
11
+ * for new capabilities, because a new required member is a breaking change for
12
+ * those adapters.
13
+ *
14
+ * `setHeader` was promoted from {@link McpHttpPort} to this interface in the
15
+ * per-tenant cube sets release, so that the core can stamp `Cache-Control` on
16
+ * every REST response (see {@link withRestCacheHeaders}). Every REST body is now
17
+ * tenant-scoped, and that guarantee cannot be left to each adapter. The break is
18
+ * accepted for this release: third-party REST-only adapters must add
19
+ * `setHeader`, which all four first-party adapters already implemented.
12
20
  */
13
21
  export interface HttpPort<TRes> {
14
22
  /** Read a request header by (case-insensitive) name. Synchronous. */
@@ -17,23 +25,42 @@ export interface HttpPort<TRes> {
17
25
  getBody(): Promise<unknown>;
18
26
  /** Read a raw query-string value by name (used by GET). */
19
27
  getQueryParam(name: string): string | undefined;
28
+ /** Set a response header. Must be called before `send`/`sendSse`/`sendEmpty`. */
29
+ setHeader(name: string, value: string): void;
20
30
  /** Send a response with the given status and JSON body; returns the framework's response value. */
21
31
  send(status: number, body: unknown): TRes;
22
32
  }
23
33
  /**
24
- * Extension of {@link HttpPort} for the MCP POST handler, which needs to set
25
- * response headers (WWW-Authenticate, MCP-Session-Id), emit a single-event SSE
26
- * response, and send an empty-body acknowledgement (202 for notifications).
34
+ * Extension of {@link HttpPort} for the MCP POST handler, which needs to emit a
35
+ * single-event SSE response and send an empty-body acknowledgement (202 for
36
+ * notifications).
27
37
  *
28
38
  * Kept separate from the minimal REST port so third-party adapters only
29
39
  * implement these when they wire up MCP. New required members on this interface
30
40
  * are still a breaking change for MCP-capable adapters.
31
41
  */
32
42
  export interface McpHttpPort<TRes> extends HttpPort<TRes> {
33
- /** Set a response header. Must be called before `send`/`sendSse`/`sendEmpty`. */
34
- setHeader(name: string, value: string): void;
35
43
  /** Send a single-event SSE response (status 200): write the pre-serialized body, then end. */
36
44
  sendSse(status: number, body: string): TRes;
37
45
  /** Send an empty-body response (no JSON), e.g. a 202 notification acknowledgement. */
38
46
  sendEmpty(status: number): TRes;
39
47
  }
48
+ /**
49
+ * `Cache-Control` stamped on every REST response.
50
+ *
51
+ * Every REST body varies by tenant: `/meta` returns the caller's cube set, and
52
+ * `/load`, `/sql`, `/dry-run`, `/batch` and `/explain` return that tenant's data
53
+ * or SQL. With no `Cache-Control` a shared cache may store and reuse these
54
+ * responses heuristically, which would cross-serve one tenant's cubes to
55
+ * another. `private` bars shared caches; `no-store` bars storage entirely.
56
+ */
57
+ export declare const REST_CACHE_CONTROL = "private, no-store";
58
+ /**
59
+ * Wrap a port so every response it sends carries {@link REST_CACHE_CONTROL}.
60
+ *
61
+ * Applied once over the whole REST surface in `createCubeHttpHandler`, not per
62
+ * route, so no endpoint can forget it — including the 400/500 error paths.
63
+ * Deliberately NOT applied to MCP: its SSE responses set their own
64
+ * `Cache-Control`, and JSON-RPC POSTs are not heuristically cacheable.
65
+ */
66
+ export declare function withRestCacheHeaders<TRes>(port: HttpPort<TRes>): HttpPort<TRes>;
@@ -6,6 +6,7 @@
6
6
  * {@link createCubeHttpHandler}.
7
7
  */
8
8
  export type { HttpPort, McpHttpPort } from './http-port.js';
9
+ export { withRestCacheHeaders, REST_CACHE_CONTROL } from './http-port.js';
9
10
  export { withLocaleFromHeaders, resolveSecurityContext, type HeaderReader, type BaseSecurityContextThunk } from './security-context.js';
10
11
  export { createCubeHttpHandler, type CubeHttpHandler, type CubeHttpHandlerOptions } from './cube-http-handler.js';
11
12
  export type { RestHandlers } from './rest-handlers.js';
@@ -3,7 +3,7 @@ import { HttpPort } from './http-port.js';
3
3
  import { BaseSecurityContextThunk } from './security-context.js';
4
4
  /** REST handlers keyed by endpoint; each closes over the shared semantic layer. */
5
5
  export interface RestHandlers {
6
- handleMetaGet<TRes>(port: HttpPort<TRes>): TRes;
6
+ handleMetaGet<TRes>(port: HttpPort<TRes>, getBaseSecurityContext: BaseSecurityContextThunk): Promise<TRes>;
7
7
  handleSqlGet<TRes>(port: HttpPort<TRes>, getBaseSecurityContext: BaseSecurityContextThunk): Promise<TRes>;
8
8
  handleSqlPost<TRes>(port: HttpPort<TRes>, getBaseSecurityContext: BaseSecurityContextThunk): Promise<TRes>;
9
9
  handleDryRunGet<TRes>(port: HttpPort<TRes>, getBaseSecurityContext: BaseSecurityContextThunk): Promise<TRes>;
@@ -2,15 +2,24 @@ import { Router, Request, Response, Express } from 'express';
2
2
  import { CorsOptions } from 'cors';
3
3
  import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube, CacheConfig, RLSSetupFn } from '../../server/index.js';
4
4
  import { AgentConfig } from '../../server/agent/types.js';
5
+ import { SemanticLayerCompiler } from '../../server/compiler.js';
5
6
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
6
7
  import { MySql2Database } from 'drizzle-orm/mysql2';
7
8
  import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
8
9
  import { MCPOptions } from '../utils.js';
9
10
  export interface ExpressAdapterOptions {
10
11
  /**
11
- * Array of cube definitions to register
12
+ * Pre-configured SemanticLayerCompiler instance.
13
+ * When provided, skips creating a new compiler and cube registration (caller
14
+ * manages it). Required to use per-tenant cube sets, since the caller must own
15
+ * the compiler to call `registerCubeSet` — see docs/per-tenant-cube-sets.md.
12
16
  */
13
- cubes: Cube[];
17
+ semanticLayer?: SemanticLayerCompiler;
18
+ /**
19
+ * Array of cube definitions to register.
20
+ * Required unless `semanticLayer` is provided.
21
+ */
22
+ cubes?: Cube[];
14
23
  /**
15
24
  * Drizzle database instance (REQUIRED)
16
25
  * This is the core of drizzle-cube - Drizzle ORM integration
@@ -2,15 +2,24 @@ import { FastifyPluginCallback, FastifyRequest, FastifyInstance } from 'fastify'
2
2
  import { FastifyCorsOptions } from '@fastify/cors';
3
3
  import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube, CacheConfig, RLSSetupFn } from '../../server/index.js';
4
4
  import { AgentConfig } from '../../server/agent/types.js';
5
+ import { SemanticLayerCompiler } from '../../server/compiler.js';
5
6
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
6
7
  import { MySql2Database } from 'drizzle-orm/mysql2';
7
8
  import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
8
9
  import { MCPOptions } from '../utils.js';
9
10
  export interface FastifyAdapterOptions {
10
11
  /**
11
- * Array of cube definitions to register
12
+ * Pre-configured SemanticLayerCompiler instance.
13
+ * When provided, skips creating a new compiler and cube registration (caller
14
+ * manages it). Required to use per-tenant cube sets, since the caller must own
15
+ * the compiler to call `registerCubeSet` — see docs/per-tenant-cube-sets.md.
12
16
  */
13
- cubes: Cube[];
17
+ semanticLayer?: SemanticLayerCompiler;
18
+ /**
19
+ * Array of cube definitions to register.
20
+ * Required unless `semanticLayer` is provided.
21
+ */
22
+ cubes?: Cube[];
14
23
  /**
15
24
  * Drizzle database instance (REQUIRED)
16
25
  * This is the core of drizzle-cube - Drizzle ORM integration
@@ -6,9 +6,16 @@ export interface CubeToolHandlerDeps {
6
6
  wrapContent: (result: unknown) => MCPToolResult;
7
7
  wrapError: (error: unknown) => MCPToolResult;
8
8
  }
9
- /** Execute the `discover` tool. */
10
- export declare function runDiscoverTool(deps: CubeToolHandlerDeps, args: unknown): Promise<MCPToolResult>;
11
- /** Execute the `validate` toolsecurity context is optional (SQL omitted without auth). */
9
+ /**
10
+ * Execute the `discover` tool. Reads the caller's cube set, so it resolves a
11
+ * security context firstdiscovery has no unauthenticated mode.
12
+ */
13
+ export declare function runDiscoverTool(deps: CubeToolHandlerDeps, args: unknown, meta?: unknown): Promise<MCPToolResult>;
14
+ /**
15
+ * Execute the `validate` tool. The security context is required: validation is
16
+ * against the caller's cube set, so a caller whose context cannot be resolved
17
+ * gets an error rather than a base-set answer with the SQL omitted.
18
+ */
12
19
  export declare function runValidateTool(deps: CubeToolHandlerDeps, args: unknown, meta?: unknown): Promise<MCPToolResult>;
13
20
  /**
14
21
  * Execute the `load` / `chart` tools. Both run the same query path; `chart`
@@ -172,5 +172,16 @@ export declare function resolveMcpResources(resources?: MCPResourceResolver): MC
172
172
  * project-specific guidance like custom cube semantics).
173
173
  */
174
174
  export declare function resolveMcpInstructions(instructions?: MCPInstructionsResolver): string;
175
- export declare function buildMcpSchemaResource(semanticLayer: SemanticLayerCompiler): MCPResource;
176
- export declare function buildMcpResources(semanticLayer: SemanticLayerCompiler, resources?: MCPResourceResolver): MCPResource[];
175
+ /**
176
+ * The `drizzle-cube://schema` resource: this caller's cube metadata as JSON.
177
+ *
178
+ * Its body is tenant-specific, so it must be built per request under the
179
+ * caller's security context. Building it once at handler construction — as this
180
+ * used to be — would freeze every tenant's view to the base set.
181
+ */
182
+ export declare function buildMcpSchemaResource(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext): MCPResource;
183
+ /**
184
+ * Static resources plus this caller's schema resource. Call per request, never
185
+ * at setup time — see {@link buildMcpSchemaResource}.
186
+ */
187
+ export declare function buildMcpResources(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, resources?: MCPResourceResolver): MCPResource[];
@@ -26,9 +26,12 @@ export interface NextCorsOptions {
26
26
  }
27
27
  export interface NextAdapterOptions {
28
28
  /**
29
- * Array of cube definitions to register
29
+ * Array of cube definitions to register.
30
+ * Required unless `semanticLayer` is provided — `createSemanticLayer` returns
31
+ * an injected compiler untouched, so a caller managing their own (which
32
+ * per-tenant cube sets require) supplies no cubes here.
30
33
  */
31
- cubes: Cube[];
34
+ cubes?: Cube[];
32
35
  /**
33
36
  * Drizzle database instance (REQUIRED)
34
37
  * This is the core of drizzle-cube - Drizzle ORM integration
@@ -354,11 +354,11 @@ export interface ValidateRequest {
354
354
  /**
355
355
  * Handle /suggest endpoint - generate query from natural language
356
356
  */
357
- export declare function handleSuggest(semanticLayer: SemanticLayerCompiler, body: SuggestRequest): Promise<QuerySuggestion>;
357
+ export declare function handleSuggest(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: SuggestRequest): Promise<QuerySuggestion>;
358
358
  /**
359
359
  * Handle /validate endpoint - validate query with corrections
360
360
  */
361
- export declare function handleValidate(semanticLayer: SemanticLayerCompiler, body: ValidateRequest, securityContext?: SecurityContext): Promise<AIValidationResult & {
361
+ export declare function handleValidate(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: ValidateRequest): Promise<AIValidationResult & {
362
362
  sql?: {
363
363
  sql: string;
364
364
  params?: any[];
@@ -28,7 +28,7 @@ export interface DisplayOptionConfig {
28
28
  /** Display label for the option */
29
29
  label: string;
30
30
  /** Type of input control to render */
31
- type: 'boolean' | 'string' | 'number' | 'select' | 'color' | 'paletteColor' | 'axisFormat' | 'stringArray' | 'buttonGroup';
31
+ type: 'boolean' | 'string' | 'number' | 'select' | 'color' | 'paletteColor' | 'axisFormat' | 'stringArray' | 'buttonGroup' | 'thresholdBands';
32
32
  /** Default value for the option */
33
33
  defaultValue?: any;
34
34
  /** Placeholder text for string/number inputs */
@@ -1,4 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { ChartProps } from '../../types.js';
3
+ /**
4
+ * Gauge chart: a 270° dial whose arc *is* the threshold banding — one thick,
5
+ * rounded segment per threshold with a small gap between them — read by a
6
+ * tapered needle, with numeric scale labels at the band boundaries and the
7
+ * measure label + value stacked below the centre.
8
+ *
9
+ * All geometry lives in `gaugeChartHelpers.ts`; this component only renders it.
10
+ */
3
11
  declare const GaugeChart: React.MemoExoticComponent<({ data, chartConfig, displayConfig, height, }: ChartProps) => React.JSX.Element>;
4
12
  export default GaugeChart;
@@ -1,36 +1,141 @@
1
1
  import { AxisFormatConfig, ThresholdBand } from '../../types.js';
2
2
  /**
3
- * Co-located helpers for GaugeChart: pure geometry/value math and threshold
4
- * parsing extracted from the component so the render body stays flat. Pure
5
- * extraction no behaviour change.
3
+ * Co-located geometry/value maths for {@link GaugeChart}.
4
+ *
5
+ * Everything here is pure so the component stays declarative: it reads a
6
+ * layout, a list of band segments, a list of scale ticks and a needle path,
7
+ * then renders them.
8
+ *
9
+ * ## Angle convention
10
+ * d3-shape's: `0` points at 12 o'clock and positive angles run clockwise. The
11
+ * dial sweeps 270°, from `START_ANGLE` (-135°, lower-left) to `END_ANGLE`
12
+ * (+135°, lower-right).
13
+ *
14
+ * ## Threshold semantics
15
+ * A {@link ThresholdBand}'s `value` is the **lower bound** of its band, as a
16
+ * 0–1 fraction of the min→max range. So `[{0, red}, {0.5, amber}, {0.7, green}]`
17
+ * paints 0–50% red, 50–70% amber and 70–100% green. This matches
18
+ * {@link resolveColor}, and the invariant
19
+ * `bandContaining(f).color === resolveColor(f)` holds for every `f` in [0, 1).
6
20
  */
21
+ /** Dial start: -135°, lower-left. */
7
22
  export declare const START_ANGLE: number;
23
+ /** Dial end: +135°, lower-right. */
8
24
  export declare const END_ANGLE: number;
9
- export declare const TRACK_COLOR = "#e2e8f0";
10
- export declare const DEFAULT_FILL = "#6366f1";
25
+ /** Total dial sweep in radians (270°). */
26
+ export declare const ANGLE_SPAN: number;
27
+ /** Neutral band colour for the region below every configured threshold. */
28
+ export declare const DEFAULT_FILL = "var(--dc-accent)";
29
+ /** Angular gap rendered between adjacent band segments (radians, ~2.3°). */
30
+ export declare const BAND_GAP_RADIANS = 0.04;
31
+ /**
32
+ * Height of the 270° arc's bounding box as a multiple of its radius.
33
+ * The arc spans y from `-r` (top) to `+r·cos45°` (the two lower tips).
34
+ */
35
+ export declare const ARC_BBOX_HEIGHT_RATIO: number;
36
+ /** Width of the 270° arc's bounding box as a multiple of its radius. */
37
+ export declare const ARC_BBOX_WIDTH_RATIO = 2;
11
38
  export declare function parseNum(v: unknown): number | null;
12
39
  export declare function clamp(v: number, lo: number, hi: number): number;
40
+ /** A finite `value`, or `fallback` when it is undefined / NaN / infinite. */
41
+ export declare function finiteOr(value: number | undefined | null, fallback: number): number;
42
+ /** Map a 0–1 fraction of the range onto its dial angle. */
43
+ export declare function fractionToAngle(fraction: number): number;
13
44
  export declare function valueToAngle(value: number, min: number, max: number): number;
45
+ /** Cartesian point at `angle`/`radius` in the d3 angle convention. */
46
+ export declare function polarPoint(angle: number, radius: number): {
47
+ x: number;
48
+ y: number;
49
+ };
14
50
  export declare function resolveColor(fraction: number, thresholds: ThresholdBand[]): string;
15
- export declare function buildArcPath(innerRadius: number, outerRadius: number, startAngle: number, endAngle: number): string;
51
+ export declare function buildArcPath(innerRadius: number, outerRadius: number, startAngle: number, endAngle: number, cornerRadius?: number): string;
16
52
  /** Parse the displayConfig.thresholds value (array or JSON string) into bands. */
17
53
  export declare function parseThresholds(raw: unknown): ThresholdBand[];
54
+ /** Clamp threshold fractions into [0, 1] and sort them ascending. */
55
+ export declare function normalizeThresholds(thresholds: ThresholdBand[]): ThresholdBand[];
18
56
  export interface ThresholdArcBand {
19
57
  color: string;
20
- start: number;
21
- end: number;
58
+ /** Lower bound of the band, as a 0–1 fraction of the min→max range. */
59
+ startFraction: number;
60
+ /** Upper bound of the band, as a 0–1 fraction of the min→max range. */
61
+ endFraction: number;
62
+ /** Dial angle of {@link startFraction}. */
63
+ startAngle: number;
64
+ /** Dial angle of {@link endFraction}. */
65
+ endAngle: number;
22
66
  }
23
- /** Build the outer-ring threshold arc bands (in fraction space 0..1). */
67
+ /**
68
+ * Split the dial into coloured bands. The bands tile the whole 0–1 range with
69
+ * no holes: a leading neutral band covers anything below the first threshold,
70
+ * and the last threshold's band runs to 1. Zero-width bands (duplicate
71
+ * thresholds, or one pinned at 1) are dropped.
72
+ *
73
+ * With no thresholds configured the dial is a single neutral band, so the
74
+ * gauge still renders a full arc.
75
+ */
24
76
  export declare function buildThresholdBands(thresholds: ThresholdBand[]): ThresholdArcBand[];
77
+ export interface GaugeBandSegment {
78
+ color: string;
79
+ startAngle: number;
80
+ endAngle: number;
81
+ }
82
+ /**
83
+ * Turn logical bands into drawable segments by inserting a gap at every
84
+ * *internal* boundary (the dial's outer ends keep the full 270° sweep).
85
+ * Segments too narrow to render cleanly with rounded caps are dropped.
86
+ */
87
+ export declare function buildBandSegments(bands: ThresholdArcBand[], gap?: number): GaugeBandSegment[];
88
+ export interface GaugeScaleTick {
89
+ fraction: number;
90
+ value: number;
91
+ angle: number;
92
+ }
93
+ /**
94
+ * Numeric scale ticks at the band boundaries (plus the dial's start and end).
95
+ * Ticks are thinned back-to-front so the max is always kept and no two labels
96
+ * collide.
97
+ */
98
+ export declare function buildScaleTicks(bands: ThresholdArcBand[], minValue: number, maxValue: number): GaugeScaleTick[];
99
+ /** Triangular needle: wide at the hub, tapering to a point at `length`. */
100
+ export declare function buildNeedlePath(angle: number, length: number, halfWidth: number): string;
101
+ export interface GaugeLayout {
102
+ /** Dial centre in SVG coordinates. */
103
+ cx: number;
104
+ cy: number;
105
+ radius: number;
106
+ outerRadius: number;
107
+ innerRadius: number;
108
+ /** Corner radius that fully rounds a band segment's ends. */
109
+ bandCornerRadius: number;
110
+ /** Radius at which scale tick labels are centred (just inside the band). */
111
+ tickRadius: number;
112
+ needleLength: number;
113
+ needleHalfWidth: number;
114
+ hubRadius: number;
115
+ tickFontSize: number;
116
+ labelFontSize: number;
117
+ labelY: number;
118
+ valueFontSize: number;
119
+ valueY: number;
120
+ }
121
+ /**
122
+ * Size and position the dial so its 270° bounding box is centred in, and fits
123
+ * inside, a `width` x `height` box. Everything else is expressed as a ratio of
124
+ * the resulting radius so the gauge scales smoothly.
125
+ */
126
+ export declare function computeGaugeLayout(width: number, height: number): GaugeLayout;
25
127
  export interface GaugeGeometry {
26
128
  effectiveMax: number;
27
129
  clampedValue: number;
28
130
  fraction: number;
29
131
  fillColor: string;
30
- fillAngle: number;
31
132
  needleAngle: number;
32
133
  }
33
- /** Compute the gauge's clamped value, fraction, fill colour, and angles. */
134
+ /** Compute the gauge's clamped value, fraction, indicated colour and angle. */
34
135
  export declare function computeGaugeGeometry(rawValue: number, minValue: number, maxValue: number, thresholds: ThresholdBand[]): GaugeGeometry;
35
- /** Format a gauge value with the optional axis format, else locale string. */
136
+ /**
137
+ * Format a gauge value. With a configured axis format this honours its unit,
138
+ * decimals and abbreviation (so a percent format renders `66.9%`); without one
139
+ * it falls back to the shared default numeric formatting (`66.94`).
140
+ */
36
141
  export declare function formatGaugeValue(value: number, yAxisFormat?: AxisFormatConfig): string;
@@ -111,6 +111,17 @@ export interface DatabaseAdapter {
111
111
  * @returns SQL expression with type casting
112
112
  */
113
113
  castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
114
+ /**
115
+ * Cast expression to specific database type, tolerantly: unparseable input yields NULL
116
+ * instead of raising an error (PostgreSQL's `::`/`CAST` on bad input) or silently producing
117
+ * 0 (MySQL/SQLite `CAST` on non-numeric text). Intended for EAV-style schemas where a text
118
+ * column holds numbers/timestamps for some attributes and free text for others, so one dirty
119
+ * value doesn't fail the whole query or masquerade as a real 0.
120
+ * @param fieldExpr - The field expression to cast
121
+ * @param targetType - Target database type
122
+ * @returns SQL expression with tolerant type casting; unparseable/NULL input yields NULL
123
+ */
124
+ tryCastToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
114
125
  /**
115
126
  * Build AVG aggregation expression with database-specific null handling
116
127
  * @param fieldExpr - The field expression to average
@@ -216,6 +227,7 @@ export declare abstract class BaseDatabaseAdapter implements DatabaseAdapter {
216
227
  abstract buildPeriodSeriesSubquery(maxPeriod: number): SQL;
217
228
  abstract buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
218
229
  abstract castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
230
+ abstract tryCastToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
219
231
  abstract getCapabilities(): DatabaseCapabilities;
220
232
  abstract buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL | null;
221
233
  /**
@@ -303,6 +315,40 @@ export declare abstract class BaseDatabaseAdapter implements DatabaseAdapter {
303
315
  field: AnyColumn | SQL;
304
316
  direction: 'asc' | 'desc';
305
317
  }>, config?: WindowFunctionConfig): SQL | null;
318
+ /**
319
+ * Regex pattern for tryCastToType's decimal guard: optional leading sign, digits with an
320
+ * optional fractional part (or a bare fractional part like `.5`), surrounded by optional
321
+ * spaces; rejects everything else. Shared by PostgreSQL (`~`) and MySQL/SingleStore
322
+ * (`REGEXP`).
323
+ *
324
+ * Deliberately written using only POSIX ERE syntax (`[0-9]` instead of `\d`, a literal
325
+ * space instead of `\s`) rather than Perl/ICU shorthands. PostgreSQL's `~` always
326
+ * understands `\d`/`\s`, and MySQL 8.0.4+'s default ICU regex engine does too — but
327
+ * SingleStore's `REGEXP` is dialect-switchable via the `regexp_format` session variable
328
+ * ('extended' = POSIX ERE, 'advanced' = ICU/PCRE-style), and SingleStore's own docs
329
+ * recommend explicitly opting into 'advanced' for new regex logic, implying 'extended'
330
+ * (POSIX, no `\d`/`\s`) is the default. Since SingleStoreAdapter inherits this pattern
331
+ * unchanged from MySQLAdapter and this repo doesn't control session variables for
332
+ * consumers, the pattern is written as the POSIX-ERE/ICU/ARE intersection so it matches
333
+ * correctly regardless of which dialect is active.
334
+ */
335
+ protected decimalTryCastPattern(): string;
336
+ /**
337
+ * Regex pattern for tryCastToType's integer guard: optional leading sign, digits only,
338
+ * surrounded by optional spaces. Same POSIX-ERE/ICU/ARE-portable rationale as
339
+ * decimalTryCastPattern().
340
+ */
341
+ protected integerTryCastPattern(): string;
342
+ /**
343
+ * Regex pattern for tryCastToType's timestamp guard: an ISO 8601-shaped date, optionally
344
+ * followed by a time component (with optional seconds, fractional seconds and a UTC/offset
345
+ * suffix), surrounded by optional spaces. This only validates the *shape* of the input —
346
+ * it does not catch calendar-invalid dates (e.g. 2024-02-30) or reject strings that "look"
347
+ * like a timestamp but aren't (that would need engine-side parsing, which is exactly what
348
+ * tryCastToType is avoiding relying on for error-safety). Same POSIX-ERE/ICU/ARE-portable
349
+ * rationale as decimalTryCastPattern().
350
+ */
351
+ protected timestampTryCastPattern(): string;
306
352
  /**
307
353
  * Helper method to build pattern for string matching
308
354
  * Can be overridden by specific adapters if needed
@@ -45,6 +45,11 @@ export declare class DatabendAdapter extends BaseDatabaseAdapter {
45
45
  * Databend supports both :: syntax and CAST() function
46
46
  */
47
47
  castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
48
+ /**
49
+ * Build Databend tolerant type casting using the native TRY_CAST function, which returns
50
+ * NULL on conversion failure instead of raising an error (unlike `::`/CAST).
51
+ */
52
+ tryCastToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
48
53
  /**
49
54
  * Databend capabilities - start conservative
50
55
  */