drizzle-cube 0.5.8 → 0.6.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 (388) hide show
  1. package/README.md +2 -0
  2. package/dist/adapters/adapters/hono/agent-handler.d.ts +9 -0
  3. package/dist/adapters/adapters/hono/mcp-handler.d.ts +37 -0
  4. package/dist/adapters/adapters/mcp-tools-handlers.d.ts +18 -0
  5. package/dist/adapters/adapters/nextjs/mcp-handler.d.ts +36 -0
  6. package/dist/adapters/adapters/utils.d.ts +6 -81
  7. package/dist/adapters/express/index.cjs +1 -1
  8. package/dist/adapters/express/index.js +50 -50
  9. package/dist/adapters/fastify/index.cjs +1 -1
  10. package/dist/adapters/fastify/index.js +78 -78
  11. package/dist/adapters/google-BOnRIN1w.cjs +2 -0
  12. package/dist/adapters/{google-CFYljAOF.js → google-CvKM9yVM.js} +83 -71
  13. package/dist/adapters/{handler-Cx8QYLk6.js → handler-CfgE0JSL.js} +499 -576
  14. package/dist/adapters/handler-Cn0dOctE.cjs +25 -0
  15. package/dist/adapters/hono/index.cjs +2 -2
  16. package/dist/adapters/hono/index.js +205 -175
  17. package/dist/adapters/locale-DDvZDFVn.js +8114 -0
  18. package/dist/adapters/locale-ZLUUNUxr.cjs +166 -0
  19. package/dist/adapters/mcp-tools.cjs +1 -1
  20. package/dist/adapters/mcp-tools.js +49 -38
  21. package/dist/adapters/mcp-transport-Chiaj4ll.cjs +40 -0
  22. package/dist/adapters/mcp-transport-H96VG3WY.js +591 -0
  23. package/dist/adapters/nextjs/index.cjs +1 -1
  24. package/dist/adapters/nextjs/index.js +190 -197
  25. package/dist/adapters/{openai-BZdAA7Ji.js → openai-cDlFSTk6.js} +60 -58
  26. package/dist/adapters/openai-vXvLni8v.cjs +1 -0
  27. package/dist/adapters/{utils-D9JPLmfl.js → utils-BPWZsX7k.js} +1271 -1218
  28. package/dist/adapters/utils-_whV4fXL.cjs +128 -0
  29. package/dist/adapters/utils.cjs +1 -1
  30. package/dist/adapters/utils.js +2 -2
  31. package/dist/client/charts/ChartLoader.d.ts +2 -16
  32. package/dist/client/charts/chartComponentRegistry.d.ts +46 -0
  33. package/dist/client/charts/chartConfigHelpers.d.ts +38 -0
  34. package/dist/client/charts.js +14 -13
  35. package/dist/client/chunks/{DashboardEditModal-CjCIAT-J.js → DashboardEditModal-okVfH8ZK.js} +5296 -4544
  36. package/dist/client/chunks/DashboardEditModal-okVfH8ZK.js.map +1 -0
  37. package/dist/client/chunks/{RetentionCombinedChart-BPkfcTa8.js → RetentionCombinedChart-BgbDhsPz.js} +10 -10
  38. package/dist/client/chunks/{RetentionCombinedChart-BPkfcTa8.js.map → RetentionCombinedChart-BgbDhsPz.js.map} +1 -1
  39. package/dist/client/chunks/{RetentionHeatmap-DGzLzr7h.js → RetentionHeatmap-DjXZaTPq.js} +5 -5
  40. package/dist/client/chunks/{RetentionHeatmap-DGzLzr7h.js.map → RetentionHeatmap-DjXZaTPq.js.map} +1 -1
  41. package/dist/client/chunks/analysis-builder-DB88FojM.js +5674 -0
  42. package/dist/client/chunks/analysis-builder-DB88FojM.js.map +1 -0
  43. package/dist/client/chunks/{analysis-builder-shared-CYVwSPqt.js → analysis-builder-shared-BVK4TYfR.js} +1578 -1292
  44. package/dist/client/chunks/analysis-builder-shared-BVK4TYfR.js.map +1 -0
  45. package/dist/client/chunks/{chart-activity-grid-DmruKPab.js → chart-activity-grid-DX0SJbxs.js} +635 -492
  46. package/dist/client/chunks/chart-activity-grid-DX0SJbxs.js.map +1 -0
  47. package/dist/client/chunks/chart-area-of01_62R.js +775 -0
  48. package/dist/client/chunks/chart-area-of01_62R.js.map +1 -0
  49. package/dist/client/chunks/chart-bar-BqelQE_I.js +194 -0
  50. package/dist/client/chunks/chart-bar-BqelQE_I.js.map +1 -0
  51. package/dist/client/chunks/{chart-box-plot-DYKfyOI8.js → chart-box-plot-kkBixZ27.js} +2 -2
  52. package/dist/client/chunks/{chart-box-plot-DYKfyOI8.js.map → chart-box-plot-kkBixZ27.js.map} +1 -1
  53. package/dist/client/chunks/chart-bubble-B2he1--4.js +221 -0
  54. package/dist/client/chunks/chart-bubble-B2he1--4.js.map +1 -0
  55. package/dist/client/chunks/{chart-candlestick-Dwc92Mrj.js → chart-candlestick-DZp19Tzh.js} +2 -2
  56. package/dist/client/chunks/{chart-candlestick-Dwc92Mrj.js.map → chart-candlestick-DZp19Tzh.js.map} +1 -1
  57. package/dist/client/chunks/chart-config-area-BNigHUy8.js +124 -0
  58. package/dist/client/chunks/chart-config-area-BNigHUy8.js.map +1 -0
  59. package/dist/client/chunks/chart-config-bar-DSO_LRTx.js +54 -0
  60. package/dist/client/chunks/chart-config-bar-DSO_LRTx.js.map +1 -0
  61. package/dist/client/chunks/{chart-config-box-plot-DJ-dWWXA.js → chart-config-box-plot-oW8axV2q.js} +5 -10
  62. package/dist/client/chunks/chart-config-box-plot-oW8axV2q.js.map +1 -0
  63. package/dist/client/chunks/{chart-config-gauge-DSwC04l0.js → chart-config-gauge-Dq-_H9UN.js} +5 -7
  64. package/dist/client/chunks/chart-config-gauge-Dq-_H9UN.js.map +1 -0
  65. package/dist/client/chunks/{chart-config-kpi-delta-D6BIkHL3.js → chart-config-kpi-delta-DSQbvqu_.js} +5 -10
  66. package/dist/client/chunks/chart-config-kpi-delta-DSQbvqu_.js.map +1 -0
  67. package/dist/client/chunks/{chart-config-kpi-number-Bx-V9a62.js → chart-config-kpi-number-EFSWY1We.js} +5 -7
  68. package/dist/client/chunks/chart-config-kpi-number-EFSWY1We.js.map +1 -0
  69. package/dist/client/chunks/{chart-config-kpi-text-CcqC1u-8.js → chart-config-kpi-text-KM3V5X2u.js} +5 -7
  70. package/dist/client/chunks/chart-config-kpi-text-KM3V5X2u.js.map +1 -0
  71. package/dist/client/chunks/{chart-config-line-Db3jDsWc.js → chart-config-line-D6jG8PCH.js} +9 -36
  72. package/dist/client/chunks/chart-config-line-D6jG8PCH.js.map +1 -0
  73. package/dist/client/chunks/{chart-config-pie-DD4SmRTF.js → chart-config-pie-BhzW-fdn.js} +6 -16
  74. package/dist/client/chunks/chart-config-pie-BhzW-fdn.js.map +1 -0
  75. package/dist/client/chunks/{chart-config-radar-CC2XAaGr.js → chart-config-radar-D7REP1q_.js} +6 -16
  76. package/dist/client/chunks/chart-config-radar-D7REP1q_.js.map +1 -0
  77. package/dist/client/chunks/{chart-config-radial-bar-DmxKx1R0.js → chart-config-radial-bar-Byx6qOPU.js} +6 -16
  78. package/dist/client/chunks/chart-config-radial-bar-Byx6qOPU.js.map +1 -0
  79. package/dist/client/chunks/{chart-config-tree-map-BI-oQStO.js → chart-config-tree-map-DVrvf3yQ.js} +6 -16
  80. package/dist/client/chunks/chart-config-tree-map-DVrvf3yQ.js.map +1 -0
  81. package/dist/client/chunks/{chart-config-waterfall-DSnyixbI.js → chart-config-waterfall-DmFeQdIk.js} +5 -10
  82. package/dist/client/chunks/chart-config-waterfall-DmFeQdIk.js.map +1 -0
  83. package/dist/client/chunks/{chart-data-table-BO4sXsim.js → chart-data-table-CKauQXme.js} +1046 -1121
  84. package/dist/client/chunks/chart-data-table-CKauQXme.js.map +1 -0
  85. package/dist/client/chunks/{chart-funnel-DnWRsmnS.js → chart-funnel-CToKSBaL.js} +184 -222
  86. package/dist/client/chunks/chart-funnel-CToKSBaL.js.map +1 -0
  87. package/dist/client/chunks/chart-gauge-DTVezSk7.js +403 -0
  88. package/dist/client/chunks/chart-gauge-DTVezSk7.js.map +1 -0
  89. package/dist/client/chunks/chart-heat-map-DTuUl0BR.js +236 -0
  90. package/dist/client/chunks/chart-heat-map-DTuUl0BR.js.map +1 -0
  91. package/dist/client/chunks/chart-kpi-delta-Dn-jjO-2.js +408 -0
  92. package/dist/client/chunks/chart-kpi-delta-Dn-jjO-2.js.map +1 -0
  93. package/dist/client/chunks/chart-kpi-number-P_WBiO5S.js +244 -0
  94. package/dist/client/chunks/chart-kpi-number-P_WBiO5S.js.map +1 -0
  95. package/dist/client/chunks/chart-kpi-text-C-Y4eb5H.js +185 -0
  96. package/dist/client/chunks/chart-kpi-text-C-Y4eb5H.js.map +1 -0
  97. package/dist/client/chunks/chart-line-DKgrQA6c.js +101 -0
  98. package/dist/client/chunks/chart-line-DKgrQA6c.js.map +1 -0
  99. package/dist/client/chunks/{chart-markdown-dgUetjyM.js → chart-markdown-CV75S_zL.js} +2 -2
  100. package/dist/client/chunks/{chart-markdown-dgUetjyM.js.map → chart-markdown-CV75S_zL.js.map} +1 -1
  101. package/dist/client/chunks/{chart-measure-profile-ClfpLs4q.js → chart-measure-profile-Ket8fJyf.js} +7 -7
  102. package/dist/client/chunks/{chart-measure-profile-ClfpLs4q.js.map → chart-measure-profile-Ket8fJyf.js.map} +1 -1
  103. package/dist/client/chunks/chart-pie-ByieAX5H.js +119 -0
  104. package/dist/client/chunks/chart-pie-ByieAX5H.js.map +1 -0
  105. package/dist/client/chunks/chart-radar-CiSwHWp4.js +138 -0
  106. package/dist/client/chunks/chart-radar-CiSwHWp4.js.map +1 -0
  107. package/dist/client/chunks/chart-radial-bar-BF6Mhl6f.js +122 -0
  108. package/dist/client/chunks/chart-radial-bar-BF6Mhl6f.js.map +1 -0
  109. package/dist/client/chunks/{chart-sankey-M3XpO_ah.js → chart-sankey-DjrvKw6K.js} +36 -39
  110. package/dist/client/chunks/{chart-sankey-M3XpO_ah.js.map → chart-sankey-DjrvKw6K.js.map} +1 -1
  111. package/dist/client/chunks/chart-scatter-Dd9WFqnS.js +258 -0
  112. package/dist/client/chunks/chart-scatter-Dd9WFqnS.js.map +1 -0
  113. package/dist/client/chunks/{chart-sunburst-A_u6lqlS.js → chart-sunburst-leGpuDj7.js} +3 -3
  114. package/dist/client/chunks/{chart-sunburst-A_u6lqlS.js.map → chart-sunburst-leGpuDj7.js.map} +1 -1
  115. package/dist/client/chunks/chart-tree-map-Ceq5sLZA.js +323 -0
  116. package/dist/client/chunks/chart-tree-map-Ceq5sLZA.js.map +1 -0
  117. package/dist/client/chunks/{chart-waterfall-BuhMoagf.js → chart-waterfall-DyvQReN5.js} +7 -7
  118. package/dist/client/chunks/{chart-waterfall-BuhMoagf.js.map → chart-waterfall-DyvQReN5.js.map} +1 -1
  119. package/dist/client/chunks/{charts-core-jRtb0S2M.js → charts-core-DaXSt1Dd.js} +2 -2
  120. package/dist/client/chunks/{charts-core-jRtb0S2M.js.map → charts-core-DaXSt1Dd.js.map} +1 -1
  121. package/dist/client/chunks/charts-loader-DdTeCeNo.js +84 -0
  122. package/dist/client/chunks/charts-loader-DdTeCeNo.js.map +1 -0
  123. package/dist/client/chunks/{nl-NL-CpVs7ox3.js → nl-NL-2zTAWTej.js} +2 -1
  124. package/dist/client/chunks/{nl-NL-CpVs7ox3.js.map → nl-NL-2zTAWTej.js.map} +1 -1
  125. package/dist/client/chunks/retention-ChW9jYdy.js.map +1 -1
  126. package/dist/client/chunks/{schema-visualization-DE09kQE3.js → schema-visualization-Cb_E9_Gd.js} +12 -12
  127. package/dist/client/chunks/{schema-visualization-DE09kQE3.js.map → schema-visualization-Cb_E9_Gd.js.map} +1 -1
  128. package/dist/client/chunks/{useDirtyStateTracking-CoeQbprt.js → useDirtyStateTracking-MbpxH_v6.js} +95 -84
  129. package/dist/client/chunks/useDirtyStateTracking-MbpxH_v6.js.map +1 -0
  130. package/dist/client/chunks/{useExplainAI-DlnXWdmz.js → useExplainAI-evnZkjCY.js} +14 -14
  131. package/dist/client/chunks/{useExplainAI-DlnXWdmz.js.map → useExplainAI-evnZkjCY.js.map} +1 -1
  132. package/dist/client/chunks/{utils-CTKNaXS8.js → utils-3P6z1vz5.js} +2 -2
  133. package/dist/client/chunks/{utils-CTKNaXS8.js.map → utils-3P6z1vz5.js.map} +1 -1
  134. package/dist/client/chunks/{vendor-CPIYyeuD.js → vendor-DSpR0IW6.js} +43 -43
  135. package/dist/client/chunks/{vendor-CPIYyeuD.js.map → vendor-DSpR0IW6.js.map} +1 -1
  136. package/dist/client/components/AgenticNotebook/agentChatParts.d.ts +34 -0
  137. package/dist/client/components/AgenticNotebook/chatMessageParts.d.ts +39 -0
  138. package/dist/client/components/AgenticNotebook/useAgentChatController.d.ts +25 -0
  139. package/dist/client/components/AgenticNotebook/useNotebookAutosave.d.ts +12 -0
  140. package/dist/client/components/AnalysisBuilder/AnalysisQueryPanelParts.d.ts +64 -0
  141. package/dist/client/components/AnalysisBuilder/AnalysisResultsHeader.d.ts +67 -0
  142. package/dist/client/components/AnalysisBuilder/BreakdownComparisonToggle.d.ts +13 -0
  143. package/dist/client/components/AnalysisBuilder/BreakdownRow.d.ts +26 -0
  144. package/dist/client/components/AnalysisBuilder/DisplayOptionControl.d.ts +10 -0
  145. package/dist/client/components/AnalysisBuilder/ExecutionPlanPanelParts.d.ts +22 -0
  146. package/dist/client/components/AnalysisBuilder/FieldSearchResults.d.ts +16 -0
  147. package/dist/client/components/AnalysisBuilder/FilterValueInput.d.ts +63 -0
  148. package/dist/client/components/AnalysisBuilder/FlowDepthControls.d.ts +10 -0
  149. package/dist/client/components/AnalysisBuilder/FlowVisualizationPicker.d.ts +7 -0
  150. package/dist/client/components/AnalysisBuilder/LegacyBooleanOptions.d.ts +8 -0
  151. package/dist/client/components/AnalysisBuilder/MetricRow.d.ts +23 -0
  152. package/dist/client/components/AnalysisBuilder/SortToggleButton.d.ts +13 -0
  153. package/dist/client/components/AnalysisBuilder/StringArrayInput.d.ts +17 -0
  154. package/dist/client/components/AnalysisBuilder/filterConfigModalUtils.d.ts +30 -0
  155. package/dist/client/components/AnalysisBuilder/hooks/useAnalysisBuilderImperativeHandle.d.ts +13 -0
  156. package/dist/client/components/AnalysisBuilder/hooks/useDragReorder.d.ts +25 -0
  157. package/dist/client/components/AnalysisBuilder/hooks/useFieldSearchKeyboard.d.ts +11 -0
  158. package/dist/client/components/AnalysisBuilder/utils/axisConfigUtils.d.ts +23 -0
  159. package/dist/client/components/AnalysisBuilder/utils/executionPlanMarkdown.d.ts +8 -0
  160. package/dist/client/components/AnalysisBuilder/utils/fieldUtils.d.ts +5 -0
  161. package/dist/client/components/AnalysisBuilder/utils/resultsPanelDerive.d.ts +68 -0
  162. package/dist/client/components/AnalysisBuilder/utils/shareStateUtils.d.ts +68 -0
  163. package/dist/client/components/AnalysisBuilder/utils/sortUtils.d.ts +7 -0
  164. package/dist/client/components/DashboardFilters/CompactFilterBarParts.d.ts +26 -0
  165. package/dist/client/components/DashboardFilters/DashboardFilterConfigModalParts.d.ts +27 -0
  166. package/dist/client/components/DashboardFilters/DashboardFilterValueInput.d.ts +39 -0
  167. package/dist/client/components/DashboardFilters/dashboardFilterConfigModalUtils.d.ts +21 -0
  168. package/dist/client/components/DashboardFilters/useCompactFilterBar.d.ts +19 -0
  169. package/dist/client/components/DashboardFilters/useDashboardFilterConfigModal.d.ts +69 -0
  170. package/dist/client/components/DashboardFilters/useDateRangeState.d.ts +19 -0
  171. package/dist/client/components/DashboardFilters/useFilterDropdowns.d.ts +21 -0
  172. package/dist/client/components/DashboardFilters/useFilterValueFetch.d.ts +23 -0
  173. package/dist/client/components/DashboardPortletCard.d.ts +2 -57
  174. package/dist/client/components/analyticsPortlet/PortletChart.d.ts +31 -0
  175. package/dist/client/components/analyticsPortlet/PortletChartView.d.ts +35 -0
  176. package/dist/client/components/analyticsPortlet/PortletStates.d.ts +65 -0
  177. package/dist/client/components/analyticsPortlet/parsePortletQuery.d.ts +22 -0
  178. package/dist/client/components/analyticsPortlet/portletRenderState.d.ts +31 -0
  179. package/dist/client/components/analyticsPortlet/usePortletDebugData.d.ts +37 -0
  180. package/dist/client/components/analyticsPortlet/usePortletDrillState.d.ts +17 -0
  181. package/dist/client/components/analyticsPortlet/usePortletQueryResults.d.ts +37 -0
  182. package/dist/client/components/charts/ActivityGridChart.helpers.d.ts +33 -0
  183. package/dist/client/components/charts/ActivityGridChart.render.d.ts +31 -0
  184. package/dist/client/components/charts/AxisFormatControls.d.ts +3 -1
  185. package/dist/client/components/charts/BarChart.helpers.d.ts +23 -0
  186. package/dist/client/components/charts/BarSeries.d.ts +29 -0
  187. package/dist/client/components/charts/BubbleChart.helpers.d.ts +43 -0
  188. package/dist/client/components/charts/BubbleChart.render.d.ts +21 -0
  189. package/dist/client/components/charts/ChartStates.d.ts +38 -0
  190. package/dist/client/components/charts/FunnelChart.helpers.d.ts +25 -0
  191. package/dist/client/components/charts/FunnelViews.d.ts +16 -0
  192. package/dist/client/components/charts/HeatMapCanvas.d.ts +25 -0
  193. package/dist/client/components/charts/HeatMapChart.helpers.d.ts +64 -0
  194. package/dist/client/components/charts/KpiDelta.helpers.d.ts +20 -0
  195. package/dist/client/components/charts/KpiNumber.helpers.d.ts +30 -0
  196. package/dist/client/components/charts/KpiStates.d.ts +19 -0
  197. package/dist/client/components/charts/ScatterChart.helpers.d.ts +43 -0
  198. package/dist/client/components/charts/ScatterSeries.d.ts +17 -0
  199. package/dist/client/components/charts/ScatterTooltip.d.ts +21 -0
  200. package/dist/client/components/charts/TreeMapChart.helpers.d.ts +37 -0
  201. package/dist/client/components/charts/TreeMapContent.d.ts +24 -0
  202. package/dist/client/components/charts/TreeMapLegend.d.ts +13 -0
  203. package/dist/client/components/charts/cartesianChartHelpers.d.ts +126 -0
  204. package/dist/client/components/charts/chartAxisResolution.d.ts +32 -0
  205. package/dist/client/components/charts/chartScaffolding.d.ts +77 -0
  206. package/dist/client/components/charts/gaugeChartHelpers.d.ts +36 -0
  207. package/dist/client/components/charts/kpiTextHelpers.d.ts +46 -0
  208. package/dist/client/components/charts/radarChartHelpers.d.ts +14 -0
  209. package/dist/client/components/charts/radialBarChartHelpers.d.ts +22 -0
  210. package/dist/client/components/charts/useChartDimensions.d.ts +20 -0
  211. package/dist/client/components/charts/useKpiDimensions.d.ts +30 -0
  212. package/dist/client/components/dashboard/DashboardEditBar.d.ts +5 -0
  213. package/dist/client/components/dashboard/LayoutModeToggle.d.ts +10 -0
  214. package/dist/client/components/dashboardPortletCard/FilterFieldChip.d.ts +12 -0
  215. package/dist/client/components/dashboardPortletCard/PortletCardHeader.d.ts +43 -0
  216. package/dist/client/components/dashboardPortletCard/cardStyles.d.ts +33 -0
  217. package/dist/client/components/dashboardPortletCard/filterField.d.ts +12 -0
  218. package/dist/client/components/dashboardPortletCard/propsEqual.d.ts +55 -0
  219. package/dist/client/components/dashboardPortletCard/usePortletCardActions.d.ts +16 -0
  220. package/dist/client/components/portletAnalysisModal/saveValidation.d.ts +8 -0
  221. package/dist/client/components/shared/dateRangeUtils.d.ts +40 -0
  222. package/dist/client/components/shared/filterDisplayUtils.d.ts +10 -0
  223. package/dist/client/components/shared/filterItem/FilterDateRangeSelector.d.ts +17 -0
  224. package/dist/client/components/shared/filterItem/FilterFieldDropdown.d.ts +16 -0
  225. package/dist/client/components/shared/filterItem/dateRangeSync.d.ts +14 -0
  226. package/dist/client/components/shared/filterItem/fieldVisuals.d.ts +5 -0
  227. package/dist/client/components/shared/filterValueSelector/FilterValueInputs.d.ts +55 -0
  228. package/dist/client/components/shared/filterValueSelector/useFilterValueSelectorState.d.ts +25 -0
  229. package/dist/client/components/shared/queryFieldUtils.d.ts +21 -0
  230. package/dist/client/components/shared/utils.d.ts +4 -43
  231. package/dist/client/components.js +3 -3
  232. package/dist/client/hooks/agentChatStream.d.ts +39 -0
  233. package/dist/client/hooks/analysisQueryExecutionModes.d.ts +133 -0
  234. package/dist/client/hooks/drillNavigation.d.ts +25 -0
  235. package/dist/client/hooks.js +3 -3
  236. package/dist/client/icons.js +2 -2
  237. package/dist/client/index.js +816 -669
  238. package/dist/client/index.js.map +1 -1
  239. package/dist/client/providers.js +3 -3
  240. package/dist/client/schema.js +1 -1
  241. package/dist/client/shared/chartConfigBuilders.d.ts +18 -0
  242. package/dist/client/shared/components/QueryAnalysisPanel.sections.d.ts +41 -0
  243. package/dist/client/shared/queryTransforms.d.ts +20 -0
  244. package/dist/client/shared/utils.d.ts +2 -4
  245. package/dist/client/stores/optionsToAnalysisConfig.d.ts +17 -0
  246. package/dist/client/styles.css +1 -1
  247. package/dist/client/utils/axisValueFormatting.d.ts +32 -0
  248. package/dist/client/utils/timeValueFormatting.d.ts +32 -0
  249. package/dist/client/utils.js +6 -6
  250. package/dist/client-bundle-stats.html +1 -1
  251. package/dist/mcp-app/mcp-app.html +55 -55
  252. package/dist/server/google-BOnRIN1w.cjs +2 -0
  253. package/dist/server/{google-CFYljAOF.js → google-CvKM9yVM.js} +83 -71
  254. package/dist/server/index.cjs +179 -211
  255. package/dist/server/index.js +6330 -6458
  256. package/dist/server/{openai-BZdAA7Ji.js → openai-cDlFSTk6.js} +60 -58
  257. package/dist/server/openai-vXvLni8v.cjs +1 -0
  258. package/dist/server/server/adapters/base-adapter.d.ts +80 -35
  259. package/dist/server/server/adapters/databend-adapter.d.ts +8 -59
  260. package/dist/server/server/adapters/duckdb-adapter.d.ts +5 -59
  261. package/dist/server/server/adapters/mysql-adapter.d.ts +13 -70
  262. package/dist/server/server/adapters/postgres-adapter.d.ts +1 -65
  263. package/dist/server/server/adapters/snowflake-adapter.d.ts +5 -68
  264. package/dist/server/server/adapters/sqlite-adapter.d.ts +12 -32
  265. package/dist/server/server/adapters/window-function-builder.d.ts +11 -0
  266. package/dist/server/server/agent/chart-validation.d.ts +0 -5
  267. package/dist/server/server/agent/handler-steps.d.ts +37 -0
  268. package/dist/server/server/ai/discovery-helpers.d.ts +29 -0
  269. package/dist/server/server/ai/discovery.d.ts +4 -0
  270. package/dist/server/server/ai/suggestion-helpers.d.ts +33 -0
  271. package/dist/server/server/ai/suggestion.d.ts +0 -3
  272. package/dist/server/server/ai/validation-helpers.d.ts +21 -0
  273. package/dist/server/server/ai/validation.d.ts +0 -3
  274. package/dist/server/server/builders/analysis-utils.d.ts +106 -0
  275. package/dist/server/server/builders/cte-builder.d.ts +46 -0
  276. package/dist/server/server/builders/date-time-builder.d.ts +5 -0
  277. package/dist/server/server/builders/date-time-helpers.d.ts +34 -0
  278. package/dist/server/server/builders/filter-builder.d.ts +2 -0
  279. package/dist/server/server/builders/filter-operators.d.ts +23 -0
  280. package/dist/server/server/builders/flow-query-builder.d.ts +46 -19
  281. package/dist/server/server/builders/funnel-query-builder.d.ts +16 -5
  282. package/dist/server/server/builders/group-by-builder.d.ts +11 -0
  283. package/dist/server/server/builders/measure-builder.d.ts +43 -0
  284. package/dist/server/server/builders/retention-query-builder.d.ts +12 -14
  285. package/dist/server/server/cache-utils.d.ts +25 -5
  286. package/dist/server/server/compiler-metadata.d.ts +11 -0
  287. package/dist/server/server/compiler.d.ts +8 -14
  288. package/dist/server/server/cube-utils.d.ts +29 -4
  289. package/dist/server/server/execution/annotation-builder.d.ts +12 -0
  290. package/dist/server/server/execution/filter-cache-preloader.d.ts +19 -0
  291. package/dist/server/server/execution/mode-router.d.ts +25 -0
  292. package/dist/server/server/execution/query-result-cache.d.ts +21 -0
  293. package/dist/server/server/execution/result-post-processor.d.ts +10 -0
  294. package/dist/server/server/executor.d.ts +33 -30
  295. package/dist/server/server/executors/explain-utils.d.ts +28 -0
  296. package/dist/server/server/explain/explain-tree.d.ts +20 -0
  297. package/dist/server/server/filter-cache.d.ts +2 -2
  298. package/dist/server/server/gap-filler.d.ts +6 -0
  299. package/dist/server/server/index.d.ts +3 -1
  300. package/dist/server/server/logical-plan/cte-planner-helpers.d.ts +37 -0
  301. package/dist/server/server/logical-plan/cte-planner.d.ts +104 -0
  302. package/dist/server/server/logical-plan/filter-propagation.d.ts +44 -0
  303. package/dist/server/server/logical-plan/index.d.ts +6 -1
  304. package/dist/server/server/logical-plan/join-planner.d.ts +27 -0
  305. package/dist/server/server/logical-plan/logical-planner.d.ts +7 -200
  306. package/dist/server/server/logical-plan/optimiser.d.ts +3 -1
  307. package/dist/server/server/logical-plan/plan-analysis-reporter.d.ts +59 -0
  308. package/dist/server/server/logical-plan/planner-utils.d.ts +20 -0
  309. package/dist/server/server/logical-plan/types.d.ts +17 -9
  310. package/dist/server/server/measure-classification.d.ts +40 -0
  311. package/dist/server/server/physical-plan/drizzle-plan-builder.d.ts +21 -21
  312. package/dist/server/server/physical-plan/drizzle-sql-builder.d.ts +11 -0
  313. package/dist/server/server/physical-plan/processors/index.d.ts +2 -0
  314. package/dist/server/server/physical-plan/processors/keys-dedup-processor.d.ts +13 -0
  315. package/dist/server/server/physical-plan/processors/multi-fact-processor.d.ts +13 -0
  316. package/dist/server/server/physical-plan/processors/shared.d.ts +5 -0
  317. package/dist/server/server/query-handlers.d.ts +79 -0
  318. package/dist/server/server/query-modes.d.ts +28 -0
  319. package/dist/server/server/query-validator.d.ts +9 -0
  320. package/dist/server/server/resolvers/calculated-measure-resolver.d.ts +5 -0
  321. package/dist/server/server/resolvers/join-path-resolver.d.ts +6 -0
  322. package/dist/server/server/sql-format.d.ts +11 -0
  323. package/dist/server/server/types/cube.d.ts +18 -4
  324. package/dist/server/server/types/flow.d.ts +6 -5
  325. package/dist/server/server/types/index.d.ts +1 -1
  326. package/dist/server/server/types/validation.d.ts +14 -0
  327. package/package.json +11 -4
  328. package/dist/adapters/google-DUlXeeDA.cjs +0 -2
  329. package/dist/adapters/handler-CzbCuS6_.cjs +0 -25
  330. package/dist/adapters/locale-BPB7flIG.js +0 -8249
  331. package/dist/adapters/locale-tIMrNcCr.cjs +0 -198
  332. package/dist/adapters/mcp-transport-C2QzXm6h.cjs +0 -40
  333. package/dist/adapters/mcp-transport-D0B3S1tB.js +0 -579
  334. package/dist/adapters/openai-D_U4V0kT.cjs +0 -1
  335. package/dist/adapters/utils-KV37IBIv.cjs +0 -128
  336. package/dist/client/chunks/DashboardEditModal-CjCIAT-J.js.map +0 -1
  337. package/dist/client/chunks/analysis-builder-MuMIzoRq.js +0 -5367
  338. package/dist/client/chunks/analysis-builder-MuMIzoRq.js.map +0 -1
  339. package/dist/client/chunks/analysis-builder-shared-CYVwSPqt.js.map +0 -1
  340. package/dist/client/chunks/chart-activity-grid-DmruKPab.js.map +0 -1
  341. package/dist/client/chunks/chart-area-DHCPM4Em.js +0 -450
  342. package/dist/client/chunks/chart-area-DHCPM4Em.js.map +0 -1
  343. package/dist/client/chunks/chart-bar-KddciGDv.js +0 -271
  344. package/dist/client/chunks/chart-bar-KddciGDv.js.map +0 -1
  345. package/dist/client/chunks/chart-bubble-CfqiB538.js +0 -273
  346. package/dist/client/chunks/chart-bubble-CfqiB538.js.map +0 -1
  347. package/dist/client/chunks/chart-config-area-Bq_UsW3x.js +0 -101
  348. package/dist/client/chunks/chart-config-area-Bq_UsW3x.js.map +0 -1
  349. package/dist/client/chunks/chart-config-bar-_JEGZnAu.js +0 -95
  350. package/dist/client/chunks/chart-config-bar-_JEGZnAu.js.map +0 -1
  351. package/dist/client/chunks/chart-config-box-plot-DJ-dWWXA.js.map +0 -1
  352. package/dist/client/chunks/chart-config-gauge-DSwC04l0.js.map +0 -1
  353. package/dist/client/chunks/chart-config-kpi-delta-D6BIkHL3.js.map +0 -1
  354. package/dist/client/chunks/chart-config-kpi-number-Bx-V9a62.js.map +0 -1
  355. package/dist/client/chunks/chart-config-kpi-text-CcqC1u-8.js.map +0 -1
  356. package/dist/client/chunks/chart-config-line-Db3jDsWc.js.map +0 -1
  357. package/dist/client/chunks/chart-config-pie-DD4SmRTF.js.map +0 -1
  358. package/dist/client/chunks/chart-config-radar-CC2XAaGr.js.map +0 -1
  359. package/dist/client/chunks/chart-config-radial-bar-DmxKx1R0.js.map +0 -1
  360. package/dist/client/chunks/chart-config-tree-map-BI-oQStO.js.map +0 -1
  361. package/dist/client/chunks/chart-config-waterfall-DSnyixbI.js.map +0 -1
  362. package/dist/client/chunks/chart-data-table-BO4sXsim.js.map +0 -1
  363. package/dist/client/chunks/chart-funnel-DnWRsmnS.js.map +0 -1
  364. package/dist/client/chunks/chart-gauge-CgMeqeGb.js +0 -424
  365. package/dist/client/chunks/chart-gauge-CgMeqeGb.js.map +0 -1
  366. package/dist/client/chunks/chart-heat-map-DcGm9SWK.js +0 -231
  367. package/dist/client/chunks/chart-heat-map-DcGm9SWK.js.map +0 -1
  368. package/dist/client/chunks/chart-kpi-delta-C2wKPqCb.js +0 -343
  369. package/dist/client/chunks/chart-kpi-delta-C2wKPqCb.js.map +0 -1
  370. package/dist/client/chunks/chart-kpi-number-gWYF44ol.js +0 -322
  371. package/dist/client/chunks/chart-kpi-number-gWYF44ol.js.map +0 -1
  372. package/dist/client/chunks/chart-kpi-text-DIYtJtk4.js +0 -149
  373. package/dist/client/chunks/chart-kpi-text-DIYtJtk4.js.map +0 -1
  374. package/dist/client/chunks/chart-line-9BEGN5Ti.js +0 -433
  375. package/dist/client/chunks/chart-line-9BEGN5Ti.js.map +0 -1
  376. package/dist/client/chunks/chart-pie-BjAIhyOi.js +0 -172
  377. package/dist/client/chunks/chart-pie-BjAIhyOi.js.map +0 -1
  378. package/dist/client/chunks/chart-radar-Dgkcl2bN.js +0 -154
  379. package/dist/client/chunks/chart-radar-Dgkcl2bN.js.map +0 -1
  380. package/dist/client/chunks/chart-radial-bar-DdWJjAhK.js +0 -148
  381. package/dist/client/chunks/chart-radial-bar-DdWJjAhK.js.map +0 -1
  382. package/dist/client/chunks/chart-scatter-DaHYP_OL.js +0 -255
  383. package/dist/client/chunks/chart-scatter-DaHYP_OL.js.map +0 -1
  384. package/dist/client/chunks/chart-tree-map-uiwUU4nb.js +0 -298
  385. package/dist/client/chunks/chart-tree-map-uiwUU4nb.js.map +0 -1
  386. package/dist/client/chunks/useDirtyStateTracking-CoeQbprt.js.map +0 -1
  387. package/dist/server/google-DUlXeeDA.cjs +0 -2
  388. package/dist/server/openai-D_U4V0kT.cjs +0 -1
@@ -1,4 +1,5 @@
1
1
  import { SecurityContext, SemanticQuery, QueryResult, DatabaseExecutor, Cube, CacheConfig, ExplainOptions, ExplainResult, ExecutionOptions, QueryAnalysis, RLSSetupFn } from './types';
2
+ import { PlanOptimiser } from './logical-plan';
2
3
  export declare class QueryExecutor {
3
4
  private dbExecutor;
4
5
  private queryBuilder;
@@ -8,11 +9,13 @@ export declare class QueryExecutor {
8
9
  private funnelQueryBuilder;
9
10
  private flowQueryBuilder;
10
11
  private retentionQueryBuilder;
11
- private cacheConfig?;
12
12
  private logicalPlanBuilder;
13
13
  private planOptimiser;
14
+ private modeRouter;
15
+ private resultCache;
16
+ private filterCachePreloader;
14
17
  private rlsSetup?;
15
- constructor(dbExecutor: DatabaseExecutor, cacheConfig?: CacheConfig, rlsSetup?: RLSSetupFn);
18
+ constructor(dbExecutor: DatabaseExecutor, cacheConfig?: CacheConfig, rlsSetup?: RLSSetupFn, planOptimiser?: PlanOptimiser);
16
19
  /**
17
20
  * Execute a function within a RLS-configured transaction context.
18
21
  * If no rlsSetup function is configured, the function is called directly.
@@ -55,34 +58,41 @@ export declare class QueryExecutor {
55
58
  private executeComparisonQuery;
56
59
  private buildComparisonExecutionPlan;
57
60
  /**
58
- * Execute a funnel query with caching support
61
+ * Execute an analysis query (funnel/flow/retention) with caching support.
62
+ * Wraps the inner execute callback with cache-set logic; the three analysis
63
+ * modes share identical wrapper behaviour, differing only in which inner
64
+ * execute method they invoke.
65
+ *
66
+ * Cache metadata is intentionally NOT attached here: fresh results across all
67
+ * query modes (regular, comparison, and analysis) uniformly carry no `cache`
68
+ * field — only cache *hits* (handled in execute()) carry cache metadata.
59
69
  */
60
- private executeFunnelQueryWithCache;
70
+ private executeAnalysisQueryWithCache;
61
71
  /**
62
72
  * Execute a funnel analysis query
63
73
  */
64
74
  private executeFunnelQuery;
65
- /**
66
- * Execute a flow query with caching support
67
- */
68
- private executeFlowQueryWithCache;
69
75
  /**
70
76
  * Execute a flow analysis query
71
77
  * Produces Sankey diagram data (nodes and links)
72
78
  */
73
79
  private executeFlowQuery;
74
- /**
75
- * Execute a retention query with caching support
76
- */
77
- private executeRetentionQueryWithCache;
78
80
  /**
79
81
  * Execute a retention analysis query
80
82
  * Calculates cohort-based retention rates
81
83
  */
82
84
  private executeRetentionQuery;
83
85
  /**
84
- * Standard query execution (non-comparison)
85
- * This is the core execution logic extracted for use by comparison queries
86
+ * Standard (regular/non-comparison) query execution.
87
+ *
88
+ * This is the single core execution path used by both the regular query mode
89
+ * and comparison-mode period sub-queries. It always runs the dev-time
90
+ * security-context validation and propagates planner warnings; the optional
91
+ * `cacheKey` controls whether the fresh result is written to the cache.
92
+ *
93
+ * @param cacheKey - When provided (and a cache provider is configured), the
94
+ * fresh result is written to the cache. Pass `undefined` to skip caching
95
+ * (e.g. comparison period sub-queries cache at the comparison level).
86
96
  */
87
97
  private executeStandardQuery;
88
98
  /**
@@ -90,8 +100,9 @@ export declare class QueryExecutor {
90
100
  */
91
101
  private createQueryContext;
92
102
  /**
93
- * Normalize engine type for optimiser passes.
94
- * SingleStore follows MySQL SQL semantics for planner choices.
103
+ * Resolve the real database engine type for optimiser passes.
104
+ * Returns the true engine for all 7 supported engines (no collapsing);
105
+ * passes decide for themselves whether to treat e.g. SingleStore like MySQL.
95
106
  */
96
107
  private getOptimiserEngineType;
97
108
  /**
@@ -145,6 +156,12 @@ export declare class QueryExecutor {
145
156
  sql: string;
146
157
  params?: any[];
147
158
  }>;
159
+ /**
160
+ * Generic dry-run SQL generator for analysis modes (funnel/flow/retention).
161
+ * The three modes share an identical shape (mode guard → config validation →
162
+ * build query → toSQL()), differing only in which builder/config they use.
163
+ */
164
+ private dryRunAnalysis;
148
165
  /**
149
166
  * Execute EXPLAIN on a query to get the execution plan
150
167
  * Generates the SQL using the same secure path as execute/generateSQL,
@@ -163,21 +180,7 @@ export declare class QueryExecutor {
163
180
  * Generate SQL using unified approach (works for both single and multi-cube)
164
181
  */
165
182
  private generateUnifiedSQL;
166
- private resolveQueryMode;
167
- private validateQueryForMode;
168
183
  private executeQueryByModeWithCache;
169
- private executeRegularQueryWithCache;
170
- private cacheResult;
171
184
  private generateSqlForMode;
172
185
  private generateComparisonSQL;
173
- /**
174
- * Generate annotations for UI metadata - unified approach
175
- */
176
- private generateAnnotations;
177
- /**
178
- * Pre-build filter SQL and store in cache for reuse across CTEs and main query
179
- * This enables parameter deduplication - the same filter values are shared
180
- * rather than appearing as separate parameters in different parts of the query
181
- */
182
- private preloadFilterCache;
183
186
  }
@@ -0,0 +1,28 @@
1
+ import { SQL } from 'drizzle-orm';
2
+ /**
3
+ * Rebuild a parameterized SQL string into a Drizzle SQL object with `params`
4
+ * bound as real driver parameters.
5
+ *
6
+ * @param sqlString - SQL produced by Drizzle's `.toSQL()`, containing either `?`
7
+ * placeholders (mysql/sqlite/singlestore/snowflake) or `$n` placeholders
8
+ * (postgres/duckdb/databend)
9
+ * @param params - Bound parameter values, in order
10
+ * @param style - Placeholder style used by `sqlString`
11
+ */
12
+ export declare function buildBoundSql(sqlString: string, params: unknown[], style: 'question' | 'dollar'): SQL;
13
+ /**
14
+ * Normalize raw MySQL EXPLAIN result rows into the column shape the MySQL parser
15
+ * expects. Extracted from MySQLExecutor.explainQuery to keep that method simple.
16
+ */
17
+ export declare function normalizeMySQLExplainRows(result: unknown): any[];
18
+ /**
19
+ * Normalize raw SQLite EXPLAIN QUERY PLAN result rows into the column shape the
20
+ * SQLite parser expects. Extracted from SQLiteExecutor.explainQuery.
21
+ */
22
+ export declare function normalizeSQLiteExplainRows(result: unknown): any[];
23
+ /**
24
+ * Extract the textual plan lines from PostgreSQL EXPLAIN result rows. Handles the
25
+ * differing column-name casing across drivers. Extracted from
26
+ * PostgresExecutor.explainQuery.
27
+ */
28
+ export declare function extractPostgresExplainLines(rows: any[]): string[];
@@ -0,0 +1,20 @@
1
+ import { ExplainOperation } from '../types/executor';
2
+ /** Stack entry tracking an operation and its indentation depth. */
3
+ export interface ExplainStackEntry {
4
+ indent: number;
5
+ op: ExplainOperation;
6
+ }
7
+ /**
8
+ * Insert an operation into the hierarchical tree using the indentation stack.
9
+ *
10
+ * Pops the stack until the top entry has strictly less indentation than the
11
+ * incoming operation, then attaches the operation either as a root (pushed to
12
+ * `operations`) or as a child of the current stack top. Finally pushes the
13
+ * operation onto the stack so subsequent deeper lines can nest under it.
14
+ */
15
+ export declare function pushOperationToTree(stack: ExplainStackEntry[], operations: ExplainOperation[], operation: ExplainOperation, indent: number): void;
16
+ /**
17
+ * Count indentation level based on tree drawing characters and spaces.
18
+ * Used by DuckDB and Databend parsers.
19
+ */
20
+ export declare function countTreeIndent(line: string): number;
@@ -1,5 +1,5 @@
1
1
  import { SQL } from 'drizzle-orm';
2
- import { Filter, FilterCondition } from './types';
2
+ import { Filter, FilterCondition, FilterCache } from './types';
3
3
  /**
4
4
  * Generates a deterministic cache key for a filter
5
5
  * Keys are based on filter content (member, operator, values) not object identity
@@ -26,7 +26,7 @@ export interface FilterCacheStats {
26
26
  * - Key by content: Filters with same member/operator/values share SQL
27
27
  * - Thread-safe: No shared mutable state between queries
28
28
  */
29
- export declare class FilterCacheManager {
29
+ export declare class FilterCacheManager implements FilterCache {
30
30
  private cache;
31
31
  private stats;
32
32
  /**
@@ -1,5 +1,11 @@
1
1
  import { SemanticQuery } from './types/query';
2
2
  import { TimeGranularity } from './types/core';
3
+ /**
4
+ * Maximum number of time buckets gap filling will generate. Beyond this, gap
5
+ * filling is skipped entirely (data is returned unmodified) to avoid both
6
+ * runaway memory use and silent truncation of real rows.
7
+ */
8
+ export declare const MAX_GAP_FILL_BUCKETS = 10000;
3
9
  export interface GapFillerConfig {
4
10
  /** The time dimension key (e.g., 'Sales.date') */
5
11
  timeDimensionKey: string;
@@ -6,6 +6,8 @@ import { SemanticLayerCompiler } from './compiler';
6
6
  */
7
7
  export { SemanticLayerCompiler } from './compiler';
8
8
  export { QueryExecutor } from './executor';
9
+ export { detectQueryMode, detectQueryModes, getActiveQueryModes, hasComparisonMode, hasFunnelMode, hasFlowMode, hasRetentionMode } from './query-modes';
10
+ export type { QueryMode, QueryModeFlags } from './query-modes';
9
11
  export { LogicalPlanner } from './logical-plan';
10
12
  export { DrizzleSqlBuilder } from './physical-plan';
11
13
  export { CTEBuilder, ComparisonQueryBuilder, FunnelQueryBuilder, FlowQueryBuilder, RetentionQueryBuilder } from './builders';
@@ -16,7 +18,7 @@ export { DrizzlePlanBuilder } from './physical-plan';
16
18
  export { createDatabaseExecutor, createPostgresExecutor, createSQLiteExecutor, createMySQLExecutor, createDuckDBExecutor, createDatabendExecutor, createSnowflakeExecutor, BaseDatabaseExecutor, PostgresExecutor, SQLiteExecutor, MySQLExecutor, DuckDBExecutor, DatabendExecutor, SnowflakeExecutor } from './executors';
17
19
  export { resolveSqlExpression, createMultiCubeContext, resolveCubeReference, getJoinType } from './cube-utils';
18
20
  export { defineCube } from './cube-utils';
19
- export { generateCacheKey, normalizeQuery, fnv1aHash, getCubeInvalidationPattern } from './cache-utils';
21
+ export { generateCacheKey, normalizeQuery, fnv1aHash, strongHash, getCubeInvalidationPattern } from './cache-utils';
20
22
  export { MemoryCacheProvider } from './cache-providers';
21
23
  export { STEP0_VALIDATION_PROMPT, SYSTEM_PROMPT_TEMPLATE, STEP1_SYSTEM_PROMPT, STEP2_SYSTEM_PROMPT, buildStep0Prompt, buildSystemPrompt, buildStep1Prompt, buildStep2Prompt, EXPLAIN_ANALYSIS_PROMPT, buildExplainAnalysisPrompt, formatCubeSchemaForExplain, formatExistingIndexes } from './prompts';
22
24
  export type { Step0Result, PromptContext, DimensionValues, Step1Result } from './prompts';
@@ -0,0 +1,37 @@
1
+ import { Cube, CubeJoin, SemanticQuery } from '../types';
2
+ /** A resolved CTE join key (column names plus the underlying column objects). */
3
+ export interface CTEJoinKey {
4
+ sourceColumn: string;
5
+ targetColumn: string;
6
+ sourceColumnObj: any;
7
+ targetColumnObj: any;
8
+ }
9
+ /** A join definition located relative to a primary/target cube pair. */
10
+ export interface FoundJoinInfo {
11
+ sourceCube: Cube;
12
+ joinDef: CubeJoin;
13
+ reversed?: boolean;
14
+ }
15
+ /**
16
+ * Derive the CTE join keys for a located join definition, handling
17
+ * belongsToMany junctions and reversed (belongsTo-back-to-primary) joins.
18
+ */
19
+ export declare function deriveCTEJoinKeys(joinInfo: FoundJoinInfo, primaryCube: Cube): CTEJoinKey[];
20
+ /**
21
+ * Derive the join keys connecting a downstream dimension cube through the CTE
22
+ * cube, handling belongsToMany (via junction sourceKey) and regular joins.
23
+ */
24
+ export declare function deriveDownstreamJoinKeys(joinDef: CubeJoin): CTEJoinKey[];
25
+ /**
26
+ * Find join information for a target cube, searching (in priority order):
27
+ * 1. The primary cube's direct join to the target.
28
+ * 2. The target cube's join back to the primary (reverse lookup → reversed).
29
+ * 3. Any other registered cube's join to the target.
30
+ */
31
+ export declare function findJoinInfoForCube(cubes: Map<string, Cube>, primaryCube: Cube, targetCubeName: string): FoundJoinInfo | null;
32
+ /**
33
+ * Collect the names of cubes (other than the CTE cube) that contribute
34
+ * dimensions, time dimensions, or filter members to the query. These are the
35
+ * candidate downstream cubes that may need to join through the CTE.
36
+ */
37
+ export declare function collectDimensionCubeNames(query: SemanticQuery, cteCubeName: string): Set<string>;
@@ -0,0 +1,104 @@
1
+ import { Cube, QueryContext, PhysicalQueryPlan, SemanticQuery } from '../types';
2
+ import { ResolverCache } from './planner-utils';
3
+ import { FilterPropagation } from './filter-propagation';
4
+ import { JoinRef } from './types';
5
+ export declare class CTEPlanner {
6
+ private readonly resolverCache;
7
+ private readonly filterPropagation;
8
+ constructor(resolverCache: ResolverCache, filterPropagation: FilterPropagation);
9
+ /**
10
+ * Plan pre-aggregation CTEs for hasMany relationships to prevent fan-out
11
+ * Note: belongsToMany relationships handle fan-out differently through their junction table structure
12
+ * and don't require CTEs - the two-hop join with the junction table provides natural grouping
13
+ *
14
+ * CRITICAL FAN-OUT PREVENTION LOGIC:
15
+ * When a query contains ANY hasMany relationship in the join graph, ALL cubes with measures
16
+ * that could be affected by row multiplication need CTEs. This includes:
17
+ *
18
+ * 1. Cubes with direct hasMany FROM primary (existing logic)
19
+ * 2. Cubes with measures that would be multiplied due to hasMany elsewhere in the query
20
+ * - Example: Query has Departments.totalBudget + Productivity.recordCount
21
+ * - Employees hasMany → Productivity causes row multiplication
22
+ * - Departments.totalBudget would be inflated without CTE pre-aggregation
23
+ */
24
+ planPreAggregationCTEs(cubes: Map<string, Cube>, primaryCube: Cube, joinCubes: JoinRef[], query: SemanticQuery, _ctx: QueryContext): PhysicalQueryPlan['preAggregationCTEs'];
25
+ /**
26
+ * Build a single pre-aggregation CTE for one join-cube entry, or return null
27
+ * when the cube contributes no aggregate measures / has no resolvable join.
28
+ */
29
+ private buildCTEForJoinCube;
30
+ /**
31
+ * Resolve the join keys (and any intermediate joins to absorb) for a CTE cube.
32
+ *
33
+ * Analyses the path from primary to the CTE cube: if an intermediate hasMany
34
+ * exists, returns the corrected keys plus intermediate joins; otherwise locates
35
+ * the join definition and derives keys from it.
36
+ */
37
+ private resolveCTEJoinKeys;
38
+ /**
39
+ * Locate the join definition for a CTE cube, preferring the final step of the
40
+ * analysed path and falling back to a primary/reverse/any-cube search.
41
+ */
42
+ private locateJoinInfo;
43
+ /**
44
+ * Analyze the join path from primary cube to a target CTE cube.
45
+ * Detects if there are intermediate hasMany relationships that would cause fan-out.
46
+ *
47
+ * Returns information about:
48
+ * - The full join path
49
+ * - Whether there are hasMany relationships ON the path (not just at the end)
50
+ * - Which intermediate tables need to be absorbed into the CTE
51
+ * - The correct join key to use (from primary cube's connection point)
52
+ *
53
+ * @param cubes Map of all registered cubes
54
+ * @param primaryCube The primary cube (FROM clause)
55
+ * @param targetCubeName The CTE cube we're analyzing the path to
56
+ * @param query The semantic query (drives query-aware path selection)
57
+ */
58
+ private analyzeJoinPathToPrimary;
59
+ /**
60
+ * Compute CTE reasons from the actual join plan entries.
61
+ *
62
+ * Instead of scanning all registered cubes (which causes false positives when
63
+ * unrelated hasMany relationships exist), this walks only the planned joins
64
+ * using the `relationship` field now stored on each JoinCubePlanEntry.
65
+ *
66
+ * Algorithm:
67
+ * 1. Scan join plan entries for hasMany/belongsToMany relationships
68
+ * 2. If none found → return empty map (no CTEs needed)
69
+ * 3. hasMany/belongsToMany targets with measures → 'hasMany'
70
+ * 4. Other join cubes with measures (not hasMany source) → 'fanOutPrevention'
71
+ */
72
+ private computeCTEReasons;
73
+ /**
74
+ * Find downstream cubes that need join keys included in the CTE.
75
+ *
76
+ * When a query has dimensions from a cube (e.g., Teams.name) and measures from
77
+ * a junction cube (e.g., EmployeeTeams.count), the junction CTE needs to include
78
+ * the join key to the dimension cube (team_id) so the dimension cube can be
79
+ * joined through the CTE instead of via an alternative path.
80
+ *
81
+ * @param cteCube The cube being converted to a CTE (e.g., EmployeeTeams)
82
+ * @param query The semantic query with dimensions and measures
83
+ * @param allCubes Map of all registered cubes
84
+ * @returns Array of downstream join key info for cubes needing join through this CTE
85
+ */
86
+ private findDownstreamJoinKeys;
87
+ /**
88
+ * Expand calculated measures to include their dependencies
89
+ */
90
+ private expandCalculatedMeasureDependencies;
91
+ /**
92
+ * Extract measure references from calculatedSql template
93
+ */
94
+ private extractDependenciesFromTemplate;
95
+ /**
96
+ * Extract measures referenced in filters (for CTE inclusion)
97
+ */
98
+ private extractMeasuresFromFilters;
99
+ /**
100
+ * Recursively extract measures from filters for a specific cube
101
+ * Only includes filter members that are actually measures (not dimensions)
102
+ */
103
+ private extractMeasuresFromFilter;
104
+ }
@@ -0,0 +1,44 @@
1
+ import { Cube, SemanticQuery, PropagatingFilter, Filter } from '../types';
2
+ export declare class FilterPropagation {
3
+ /**
4
+ * Find filters that need to propagate from related cubes to a CTE cube.
5
+ * When cube A has filters and a hasMany relationship to cube B (the CTE cube),
6
+ * A's filters should propagate into B's CTE via a subquery.
7
+ *
8
+ * Example: Employees.createdAt filter should propagate to Productivity CTE
9
+ * via: employee_id IN (SELECT id FROM employees WHERE created_at >= $date)
10
+ */
11
+ findPropagatingFilters(query: SemanticQuery, cteCube: Cube, allCubes: Map<string, Cube>): PropagatingFilter[];
12
+ /**
13
+ * Collect cube names referenced by filters and by time-dimension date ranges.
14
+ */
15
+ private collectFilterCubeNames;
16
+ /**
17
+ * Build a single PropagatingFilter for a filterCube → cteCube hasMany edge,
18
+ * or null when the cube contributes no filters / the join has no keys.
19
+ */
20
+ private buildPropagatingFilter;
21
+ /**
22
+ * Extract cube names from filters into a Set (helper for findPropagatingFilters)
23
+ */
24
+ extractFilterCubeNamesToSet(filters: Filter[], cubesSet: Set<string>): void;
25
+ /**
26
+ * Extract filters for a specific cube from the filter array
27
+ *
28
+ * Logic for preserving filter semantics:
29
+ * - AND: Safe to extract only matching branches (AND of fewer conditions is more permissive)
30
+ * - OR: Must include ALL branches or skip entirely (partial OR changes semantics)
31
+ * If any branch belongs to another cube, skip the entire OR to be safe
32
+ * since we can't evaluate the other cube's conditions
33
+ */
34
+ extractFiltersForCube(filters: Filter[], targetCubeName: string): Filter[];
35
+ /**
36
+ * Check if all simple filters in a filter array belong to the specified cube
37
+ * Recursively checks nested AND/OR filters
38
+ */
39
+ allFiltersFromCube(filters: Filter[], targetCubeName: string): boolean;
40
+ /**
41
+ * Extract time dimension date range filters as regular filters for a specific cube
42
+ */
43
+ extractTimeDimensionFiltersForCube(query: SemanticQuery, targetCubeName: string): Filter[];
44
+ }
@@ -10,5 +10,10 @@ export type { LogicalNode, LogicalNodeType, LogicalNodeBase, QueryNode, SimpleSo
10
10
  export { LogicalPlanner } from './logical-planner';
11
11
  export { LogicalPlanBuilder } from './logical-plan-builder';
12
12
  export type { LogicalPlanWithAnalysis } from './logical-plan-builder';
13
- export type { PlanOptimiser, OptimiserContext } from './optimiser';
13
+ export { JoinPlanner } from './join-planner';
14
+ export { CTEPlanner } from './cte-planner';
15
+ export { FilterPropagation } from './filter-propagation';
16
+ export { PlanAnalysisReporter } from './plan-analysis-reporter';
17
+ export { ResolverCache, analyzeCubeUsage, extractCubeNamesFromFilter } from './planner-utils';
18
+ export type { PlanOptimiser, OptimiserContext, OptimiserEngineType } from './optimiser';
14
19
  export { IdentityOptimiser, OptimiserPipeline } from './optimiser';
@@ -0,0 +1,27 @@
1
+ import { Cube, CubeJoin, SemanticQuery } from '../types';
2
+ import { ResolverCache } from './planner-utils';
3
+ import { JoinRef } from './types';
4
+ export declare class JoinPlanner {
5
+ private readonly resolverCache;
6
+ constructor(resolverCache: ResolverCache);
7
+ /**
8
+ * Build join plan for multi-cube query
9
+ * Supports both direct joins and transitive joins through intermediate cubes
10
+ *
11
+ * Uses query-aware path selection to prefer joining through cubes that have
12
+ * measures in the query (e.g., joining Teams through EmployeeTeams when
13
+ * EmployeeTeams.count is a measure)
14
+ */
15
+ buildJoinPlan(cubes: Map<string, Cube>, primaryCube: Cube, cubeNames: string[], _ctx: unknown, query: SemanticQuery): JoinRef[];
16
+ /**
17
+ * Build a single symbolic JoinRef for a join-path step. Handles belongsToMany
18
+ * (junction-table) joins and regular (belongsTo/hasOne/hasMany) joins. The join
19
+ * conditions and security WHERE are materialized later by DrizzlePlanBuilder;
20
+ * only the join type is resolved here (it depends on the effective relationship).
21
+ */
22
+ private buildJoinRef;
23
+ /**
24
+ * Find hasMany join definition from primary cube to target cube
25
+ */
26
+ findHasManyJoinDef(primaryCube: Cube, targetCubeName: string, cubes?: Map<string, Cube>): CubeJoin | null;
27
+ }