drizzle-cube 0.5.7 → 0.5.8

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 (309) hide show
  1. package/dist/adapters/express/index.cjs +1 -1
  2. package/dist/adapters/express/index.js +4 -4
  3. package/dist/adapters/fastify/index.cjs +1 -1
  4. package/dist/adapters/fastify/index.js +4 -4
  5. package/dist/adapters/{handler-Dz1F4iwf.js → handler-Cx8QYLk6.js} +18 -4
  6. package/dist/adapters/{handler-C63rJUUK.cjs → handler-CzbCuS6_.cjs} +4 -4
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +7 -7
  9. package/dist/adapters/{locale-gU_d1Wja.js → locale-BPB7flIG.js} +1 -1
  10. package/dist/adapters/{locale-CTNwPVZI.cjs → locale-tIMrNcCr.cjs} +1 -1
  11. package/dist/adapters/mcp-tools.cjs +1 -1
  12. package/dist/adapters/mcp-tools.js +2 -2
  13. package/dist/adapters/mcp-transport-C2QzXm6h.cjs +40 -0
  14. package/dist/adapters/mcp-transport-D0B3S1tB.js +579 -0
  15. package/dist/adapters/nextjs/index.cjs +1 -1
  16. package/dist/adapters/nextjs/index.js +4 -4
  17. package/dist/{server/openai-y7GhJNdn.js → adapters/openai-B5jEiqiB.js} +776 -719
  18. package/dist/{server/openai-DiVskd89.js → adapters/openai-BZdAA7Ji.js} +1 -1
  19. package/dist/adapters/openai-D0musiYP.cjs +17 -0
  20. package/dist/adapters/{openai-6wrBvAnv.cjs → openai-D_U4V0kT.cjs} +1 -1
  21. package/dist/adapters/{utils-DosuoabY.js → utils-D9JPLmfl.js} +16 -4
  22. package/dist/adapters/utils-KV37IBIv.cjs +128 -0
  23. package/dist/adapters/utils.cjs +1 -1
  24. package/dist/adapters/utils.js +1 -1
  25. package/dist/client/charts/ChartLoader.d.ts +1 -1
  26. package/dist/client/charts.js +12 -12
  27. package/dist/client/chunks/{DashboardEditModal-6KRE36mm.js → DashboardEditModal-CjCIAT-J.js} +1258 -1050
  28. package/dist/client/chunks/DashboardEditModal-CjCIAT-J.js.map +1 -0
  29. package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js → RetentionCombinedChart-BPkfcTa8.js} +3 -3
  30. package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js.map → RetentionCombinedChart-BPkfcTa8.js.map} +1 -1
  31. package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js → RetentionHeatmap-DGzLzr7h.js} +2 -2
  32. package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js.map → RetentionHeatmap-DGzLzr7h.js.map} +1 -1
  33. package/dist/client/chunks/{analysis-builder-zd48FVJO.js → analysis-builder-MuMIzoRq.js} +8 -8
  34. package/dist/client/chunks/{analysis-builder-zd48FVJO.js.map → analysis-builder-MuMIzoRq.js.map} +1 -1
  35. package/dist/client/chunks/{analysis-builder-shared-x576-O5p.js → analysis-builder-shared-CYVwSPqt.js} +21 -21
  36. package/dist/client/chunks/{analysis-builder-shared-x576-O5p.js.map → analysis-builder-shared-CYVwSPqt.js.map} +1 -1
  37. package/dist/client/chunks/{chart-activity-grid-CiHrLH6Y.js → chart-activity-grid-DmruKPab.js} +9 -4
  38. package/dist/client/chunks/{chart-activity-grid-CiHrLH6Y.js.map → chart-activity-grid-DmruKPab.js.map} +1 -1
  39. package/dist/client/chunks/{chart-area-CXFK-Grv.js → chart-area-DHCPM4Em.js} +2 -2
  40. package/dist/client/chunks/{chart-area-CXFK-Grv.js.map → chart-area-DHCPM4Em.js.map} +1 -1
  41. package/dist/client/chunks/{chart-bar-DKXfLoGG.js → chart-bar-KddciGDv.js} +3 -3
  42. package/dist/client/chunks/{chart-bar-DKXfLoGG.js.map → chart-bar-KddciGDv.js.map} +1 -1
  43. package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js → chart-box-plot-DYKfyOI8.js} +2 -2
  44. package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js.map → chart-box-plot-DYKfyOI8.js.map} +1 -1
  45. package/dist/client/chunks/{chart-bubble-DGkTQlxM.js → chart-bubble-CfqiB538.js} +2 -2
  46. package/dist/client/chunks/{chart-bubble-DGkTQlxM.js.map → chart-bubble-CfqiB538.js.map} +1 -1
  47. package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js → chart-candlestick-Dwc92Mrj.js} +2 -2
  48. package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js.map → chart-candlestick-Dwc92Mrj.js.map} +1 -1
  49. package/dist/client/chunks/{chart-data-table-Cm5jrpaw.js → chart-data-table-BO4sXsim.js} +27 -27
  50. package/dist/client/chunks/{chart-data-table-Cm5jrpaw.js.map → chart-data-table-BO4sXsim.js.map} +1 -1
  51. package/dist/client/chunks/{chart-funnel-Eke8IPtG.js → chart-funnel-DnWRsmnS.js} +2 -2
  52. package/dist/client/chunks/{chart-funnel-Eke8IPtG.js.map → chart-funnel-DnWRsmnS.js.map} +1 -1
  53. package/dist/client/chunks/{chart-gauge-DeRZNsyl.js → chart-gauge-CgMeqeGb.js} +2 -2
  54. package/dist/client/chunks/{chart-gauge-DeRZNsyl.js.map → chart-gauge-CgMeqeGb.js.map} +1 -1
  55. package/dist/client/chunks/{chart-heat-map-C86thSJ4.js → chart-heat-map-DcGm9SWK.js} +2 -2
  56. package/dist/client/chunks/{chart-heat-map-C86thSJ4.js.map → chart-heat-map-DcGm9SWK.js.map} +1 -1
  57. package/dist/client/chunks/{chart-kpi-delta-CxOYD2f1.js → chart-kpi-delta-C2wKPqCb.js} +3 -3
  58. package/dist/client/chunks/{chart-kpi-delta-CxOYD2f1.js.map → chart-kpi-delta-C2wKPqCb.js.map} +1 -1
  59. package/dist/client/chunks/{chart-kpi-number-C6gWz-x4.js → chart-kpi-number-gWYF44ol.js} +5 -5
  60. package/dist/client/chunks/{chart-kpi-number-C6gWz-x4.js.map → chart-kpi-number-gWYF44ol.js.map} +1 -1
  61. package/dist/client/chunks/{chart-kpi-text-dDONrhS-.js → chart-kpi-text-DIYtJtk4.js} +3 -3
  62. package/dist/client/chunks/{chart-kpi-text-dDONrhS-.js.map → chart-kpi-text-DIYtJtk4.js.map} +1 -1
  63. package/dist/client/chunks/{chart-line-r4iWevKZ.js → chart-line-9BEGN5Ti.js} +3 -3
  64. package/dist/client/chunks/{chart-line-r4iWevKZ.js.map → chart-line-9BEGN5Ti.js.map} +1 -1
  65. package/dist/client/chunks/{chart-markdown-BPW-EAm9.js → chart-markdown-dgUetjyM.js} +1359 -1240
  66. package/dist/client/chunks/chart-markdown-dgUetjyM.js.map +1 -0
  67. package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js → chart-measure-profile-ClfpLs4q.js} +3 -3
  68. package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js.map → chart-measure-profile-ClfpLs4q.js.map} +1 -1
  69. package/dist/client/chunks/{chart-pie-yqH2YVEI.js → chart-pie-BjAIhyOi.js} +3 -3
  70. package/dist/client/chunks/{chart-pie-yqH2YVEI.js.map → chart-pie-BjAIhyOi.js.map} +1 -1
  71. package/dist/client/chunks/{chart-radar-B-_3v-rE.js → chart-radar-Dgkcl2bN.js} +3 -3
  72. package/dist/client/chunks/{chart-radar-B-_3v-rE.js.map → chart-radar-Dgkcl2bN.js.map} +1 -1
  73. package/dist/client/chunks/{chart-radial-bar-C0EgzfAF.js → chart-radial-bar-DdWJjAhK.js} +3 -3
  74. package/dist/client/chunks/{chart-radial-bar-C0EgzfAF.js.map → chart-radial-bar-DdWJjAhK.js.map} +1 -1
  75. package/dist/client/chunks/{chart-sankey-CFzjGvZX.js → chart-sankey-M3XpO_ah.js} +2 -2
  76. package/dist/client/chunks/{chart-sankey-CFzjGvZX.js.map → chart-sankey-M3XpO_ah.js.map} +1 -1
  77. package/dist/client/chunks/{chart-scatter-DZPirzwX.js → chart-scatter-DaHYP_OL.js} +3 -3
  78. package/dist/client/chunks/{chart-scatter-DZPirzwX.js.map → chart-scatter-DaHYP_OL.js.map} +1 -1
  79. package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js → chart-sunburst-A_u6lqlS.js} +3 -3
  80. package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js.map → chart-sunburst-A_u6lqlS.js.map} +1 -1
  81. package/dist/client/chunks/{chart-tree-map-Bi4axCvh.js → chart-tree-map-uiwUU4nb.js} +3 -3
  82. package/dist/client/chunks/{chart-tree-map-Bi4axCvh.js.map → chart-tree-map-uiwUU4nb.js.map} +1 -1
  83. package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js → chart-waterfall-BuhMoagf.js} +3 -3
  84. package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js.map → chart-waterfall-BuhMoagf.js.map} +1 -1
  85. package/dist/client/chunks/{charts-core-CrBDYN6N.js → charts-core-jRtb0S2M.js} +2 -2
  86. package/dist/client/chunks/{charts-core-CrBDYN6N.js.map → charts-core-jRtb0S2M.js.map} +1 -1
  87. package/dist/client/chunks/{core-DsAWNRRv.js → core-D7vPfUIe.js} +2 -2
  88. package/dist/client/chunks/{core-DsAWNRRv.js.map → core-D7vPfUIe.js.map} +1 -1
  89. package/dist/client/chunks/{nl-NL-oyr2wENY.js → nl-NL-CpVs7ox3.js} +7 -2
  90. package/dist/client/chunks/{nl-NL-oyr2wENY.js.map → nl-NL-CpVs7ox3.js.map} +1 -1
  91. package/dist/client/chunks/{schema-visualization-BszcrmZX.js → schema-visualization-DE09kQE3.js} +3 -3
  92. package/dist/client/chunks/{schema-visualization-BszcrmZX.js.map → schema-visualization-DE09kQE3.js.map} +1 -1
  93. package/dist/client/chunks/{useDirtyStateTracking-B5wCDJSj.js → useDirtyStateTracking-CoeQbprt.js} +4 -4
  94. package/dist/client/chunks/{useDirtyStateTracking-B5wCDJSj.js.map → useDirtyStateTracking-CoeQbprt.js.map} +1 -1
  95. package/dist/client/chunks/{useExplainAI-CCeCYzDm.js → useExplainAI-DlnXWdmz.js} +4 -4
  96. package/dist/client/chunks/{useExplainAI-CCeCYzDm.js.map → useExplainAI-DlnXWdmz.js.map} +1 -1
  97. package/dist/client/chunks/{utils-kqa-JIMg.js → utils-CTKNaXS8.js} +3 -3
  98. package/dist/client/chunks/{utils-kqa-JIMg.js.map → utils-CTKNaXS8.js.map} +1 -1
  99. package/dist/client/chunks/{vendor-0hJNlZXQ.js → vendor-CPIYyeuD.js} +2 -2
  100. package/dist/client/chunks/{vendor-0hJNlZXQ.js.map → vendor-CPIYyeuD.js.map} +1 -1
  101. package/dist/client/components/AnalysisBuilder/AnalysisAIPanel.d.ts +1 -1
  102. package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +1 -1
  103. package/dist/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +1 -1
  104. package/dist/client/components/AnalysisBuilder/AnalysisDisplayConfigPanel.d.ts +1 -1
  105. package/dist/client/components/AnalysisBuilder/AnalysisFilterGroup.d.ts +1 -1
  106. package/dist/client/components/AnalysisBuilder/AnalysisFilterItem.d.ts +1 -1
  107. package/dist/client/components/AnalysisBuilder/AnalysisFilterSection.d.ts +1 -1
  108. package/dist/client/components/AnalysisBuilder/AnalysisModeErrorBoundary.d.ts +1 -1
  109. package/dist/client/components/AnalysisBuilder/ExplainAIPanel.d.ts +2 -1
  110. package/dist/client/components/AnalysisBuilder/FieldDetailPanel.d.ts +1 -1
  111. package/dist/client/components/AnalysisBuilder/FieldSearchItem.d.ts +1 -1
  112. package/dist/client/components/AnalysisBuilder/FieldSearchModal.d.ts +1 -1
  113. package/dist/client/components/AnalysisBuilder/FilterConfigModal.d.ts +2 -1
  114. package/dist/client/components/AnalysisBuilder/LimitSection.d.ts +1 -1
  115. package/dist/client/components/AnalysisBuilder/SectionHeading.d.ts +1 -1
  116. package/dist/client/components/AnalyticsDashboard.d.ts +1 -1
  117. package/dist/client/components/AnalyticsPage.d.ts +1 -1
  118. package/dist/client/components/ChartErrorBoundary.d.ts +1 -1
  119. package/dist/client/components/ChartTypeSelector.d.ts +1 -1
  120. package/dist/client/components/ColorPaletteSelector.d.ts +1 -1
  121. package/dist/client/components/DashboardEditModal.d.ts +2 -1
  122. package/dist/client/components/DashboardFilters/DashboardFilterConfigModal.d.ts +1 -1
  123. package/dist/client/components/DashboardFilters/DashboardFilterItem.d.ts +1 -1
  124. package/dist/client/components/DashboardGrid.d.ts +1 -1
  125. package/dist/client/components/DashboardThumbnailPlaceholder.d.ts +1 -1
  126. package/dist/client/components/DataBrowser/DataBrowserSidebar.d.ts +1 -1
  127. package/dist/client/components/DataBrowser/DataBrowserToolbar.d.ts +1 -1
  128. package/dist/client/components/DataBrowser/index.d.ts +1 -1
  129. package/dist/client/components/DataHistogram.d.ts +1 -1
  130. package/dist/client/components/DebugModal.d.ts +1 -1
  131. package/dist/client/components/DrillBreadcrumb.d.ts +2 -1
  132. package/dist/client/components/LoadingIndicator.d.ts +1 -1
  133. package/dist/client/components/MobileStackedLayout.d.ts +1 -1
  134. package/dist/client/components/PortletAnalysisModal.d.ts +1 -1
  135. package/dist/client/components/PortletContainer.d.ts +1 -1
  136. package/dist/client/components/PortletFilterConfigModal.d.ts +6 -4
  137. package/dist/client/components/RowManagedLayout.d.ts +1 -1
  138. package/dist/client/components/ScaledGridWrapper.d.ts +1 -1
  139. package/dist/client/components/SchemaVisualization/CubeNode.d.ts +1 -1
  140. package/dist/client/components/SchemaVisualization/FieldDetailPanel.d.ts +1 -1
  141. package/dist/client/components/SchemaVisualization/RelationshipEdge.d.ts +1 -1
  142. package/dist/client/components/SchemaVisualization/SchemaVisualizationLazy.d.ts +1 -1
  143. package/dist/client/components/SchemaVisualization/index.d.ts +1 -1
  144. package/dist/client/components/TextPortletModal.d.ts +1 -1
  145. package/dist/client/components/charts/AxisFormatControls.d.ts +2 -2
  146. package/dist/client/components/charts/ChartContainer.d.ts +1 -1
  147. package/dist/client/components/charts/ChartLegend.d.ts +1 -1
  148. package/dist/client/components/charts/ChartTooltip.d.ts +1 -1
  149. package/dist/client/components/charts/MissingDependencyFallback.d.ts +1 -1
  150. package/dist/client/components/dashboard/DashboardContext.d.ts +2 -2
  151. package/dist/client/components/dashboard/DashboardCoordinator.d.ts +1 -1
  152. package/dist/client/components/dashboard/DashboardFilterBar.d.ts +1 -1
  153. package/dist/client/components/dashboard/DashboardGridSurface.d.ts +1 -1
  154. package/dist/client/components/dashboard/DashboardModals.d.ts +1 -1
  155. package/dist/client/components/dashboard/DashboardProvider.d.ts +1 -1
  156. package/dist/client/components/dashboard/DashboardToolbar.d.ts +1 -1
  157. package/dist/client/components/dashboard/dashboardGridUtils.d.ts +1 -1
  158. package/dist/client/components.js +2 -2
  159. package/dist/client/hooks/dashboard/useDashboardController.d.ts +2 -2
  160. package/dist/client/hooks/useDashboardHook.d.ts +2 -2
  161. package/dist/client/hooks.js +3 -3
  162. package/dist/client/icons.d.ts +1 -1
  163. package/dist/client/icons.js +1 -1
  164. package/dist/client/index.js +15 -15
  165. package/dist/client/providers/CubeApiProvider.d.ts +1 -1
  166. package/dist/client/providers/CubeFeaturesProvider.d.ts +1 -1
  167. package/dist/client/providers/CubeMetaProvider.d.ts +1 -1
  168. package/dist/client/providers/CubeProvider.d.ts +1 -1
  169. package/dist/client/providers/I18nProvider.d.ts +1 -1
  170. package/dist/client/providers.js +1 -1
  171. package/dist/client/schema.js +1 -1
  172. package/dist/client/stores/analysisBuilderStore.d.ts +1 -1
  173. package/dist/client/stores/dashboardStore.d.ts +1 -1
  174. package/dist/client/stores/dataBrowserStore.d.ts +1 -1
  175. package/dist/client/stores/notebookStore.d.ts +1 -1
  176. package/dist/client/styles.css +1 -1
  177. package/dist/client/types/drill.d.ts +1 -1
  178. package/dist/client/types.d.ts +7 -2
  179. package/dist/client/utils/drillQueryBuilder.d.ts +2 -2
  180. package/dist/client/utils/filterUtils.d.ts +33 -5
  181. package/dist/client/utils/joinReachability.d.ts +27 -0
  182. package/dist/client/utils.js +5 -5
  183. package/dist/client-bundle-stats.html +1 -1
  184. package/dist/mcp-app/mcp-app.html +4 -4
  185. package/dist/server/index.cjs +6 -6
  186. package/dist/server/index.d.ts +2 -5050
  187. package/dist/server/index.js +33 -7
  188. package/dist/{adapters/openai-y7GhJNdn.js → server/openai-B5jEiqiB.js} +776 -719
  189. package/dist/{adapters/openai-DiVskd89.js → server/openai-BZdAA7Ji.js} +1 -1
  190. package/dist/server/openai-D0musiYP.cjs +17 -0
  191. package/dist/server/{openai-6wrBvAnv.cjs → openai-D_U4V0kT.cjs} +1 -1
  192. package/dist/server/server/adapters/base-adapter.d.ts +287 -0
  193. package/dist/server/server/adapters/databend-adapter.d.ts +114 -0
  194. package/dist/server/server/adapters/duckdb-adapter.d.ts +122 -0
  195. package/dist/server/server/adapters/mysql-adapter.d.ts +122 -0
  196. package/dist/server/server/adapters/postgres-adapter.d.ts +119 -0
  197. package/dist/server/server/adapters/singlestore-adapter.d.ts +4 -0
  198. package/dist/server/server/adapters/snowflake-adapter.d.ts +116 -0
  199. package/dist/server/server/adapters/sqlite-adapter.d.ts +140 -0
  200. package/dist/server/server/agent/chart-validation.d.ts +27 -0
  201. package/dist/server/server/agent/handler.d.ts +25 -0
  202. package/dist/server/server/agent/index.d.ts +11 -0
  203. package/dist/server/server/agent/providers/anthropic.d.ts +24 -0
  204. package/dist/server/server/agent/providers/factory.d.ts +12 -0
  205. package/dist/server/server/agent/providers/google.d.ts +23 -0
  206. package/dist/server/server/agent/providers/index.d.ts +6 -0
  207. package/dist/server/server/agent/providers/openai.d.ts +26 -0
  208. package/dist/server/server/agent/providers/types.d.ts +95 -0
  209. package/dist/server/server/agent/system-prompt.d.ts +5 -0
  210. package/dist/server/server/agent/tools.d.ts +28 -0
  211. package/dist/server/server/agent/types.d.ts +192 -0
  212. package/dist/server/server/ai/discovery.d.ts +62 -0
  213. package/dist/server/server/ai/index.d.ts +10 -0
  214. package/dist/server/server/ai/mcp-prompts.d.ts +83 -0
  215. package/dist/server/server/ai/query-schema.d.ts +258 -0
  216. package/dist/server/server/ai/schemas.d.ts +63 -0
  217. package/dist/server/server/ai/suggestion.d.ts +19 -0
  218. package/dist/server/server/ai/validation.d.ts +34 -0
  219. package/dist/server/server/builders/comparison-query-builder.d.ts +70 -0
  220. package/dist/server/server/builders/cte-builder.d.ts +62 -0
  221. package/dist/server/server/builders/date-time-builder.d.ts +29 -0
  222. package/dist/server/server/builders/filter-builder.d.ts +23 -0
  223. package/dist/server/server/builders/flow-query-builder.d.ts +109 -0
  224. package/dist/server/server/builders/funnel-query-builder.d.ts +134 -0
  225. package/dist/server/server/builders/group-by-builder.d.ts +27 -0
  226. package/dist/server/server/builders/index.d.ts +13 -0
  227. package/dist/server/server/builders/measure-builder.d.ts +142 -0
  228. package/dist/server/server/builders/retention-query-builder.d.ts +100 -0
  229. package/dist/server/server/cache-providers/index.d.ts +5 -0
  230. package/dist/server/server/cache-providers/memory.d.ts +105 -0
  231. package/dist/server/server/cache-utils.d.ts +65 -0
  232. package/dist/server/server/compiler.d.ts +218 -0
  233. package/dist/server/server/cube-utils.d.ts +133 -0
  234. package/dist/server/server/database-utils.d.ts +18 -0
  235. package/dist/server/server/executor.d.ts +183 -0
  236. package/dist/server/server/executors/base-executor.d.ts +16 -0
  237. package/dist/server/server/executors/databend-executor.d.ts +33 -0
  238. package/dist/server/server/executors/duckdb-executor.d.ts +33 -0
  239. package/dist/server/server/executors/index.d.ts +21 -0
  240. package/dist/server/server/executors/mysql-executor.d.ts +27 -0
  241. package/dist/server/server/executors/postgres-executor.d.ts +27 -0
  242. package/dist/server/server/executors/singlestore-executor.d.ts +9 -0
  243. package/dist/server/server/executors/snowflake-executor.d.ts +33 -0
  244. package/dist/server/server/executors/sqlite-executor.d.ts +28 -0
  245. package/dist/server/server/explain/databend-parser.d.ts +16 -0
  246. package/dist/server/server/explain/duckdb-parser.d.ts +28 -0
  247. package/dist/server/server/explain/index.d.ts +9 -0
  248. package/dist/server/server/explain/mysql-parser.d.ts +38 -0
  249. package/dist/server/server/explain/postgres-parser.d.ts +18 -0
  250. package/dist/server/server/explain/snowflake-parser.d.ts +17 -0
  251. package/dist/server/server/explain/sqlite-parser.d.ts +23 -0
  252. package/dist/server/server/filter-cache.d.ts +73 -0
  253. package/dist/server/server/gap-filler.d.ts +42 -0
  254. package/dist/server/server/index.d.ts +36 -0
  255. package/dist/server/server/logical-plan/index.d.ts +14 -0
  256. package/dist/server/server/logical-plan/logical-plan-builder.d.ts +58 -0
  257. package/dist/server/server/logical-plan/logical-planner.d.ts +232 -0
  258. package/dist/server/server/logical-plan/optimiser.d.ts +32 -0
  259. package/dist/server/server/logical-plan/types.d.ts +191 -0
  260. package/dist/server/server/physical-plan/drizzle-plan-builder.d.ts +50 -0
  261. package/dist/server/server/physical-plan/drizzle-sql-builder.d.ts +107 -0
  262. package/dist/server/server/physical-plan/index.d.ts +2 -0
  263. package/dist/server/server/physical-plan/processors/cte-processor.d.ts +6 -0
  264. package/dist/server/server/physical-plan/processors/index.d.ts +6 -0
  265. package/dist/server/server/physical-plan/processors/joins-processor.d.ts +6 -0
  266. package/dist/server/server/physical-plan/processors/predicates-processor.d.ts +6 -0
  267. package/dist/server/server/physical-plan/processors/selection-processor.d.ts +6 -0
  268. package/dist/server/server/physical-plan/processors/shared.d.ts +33 -0
  269. package/dist/server/server/physical-plan/processors/window-processor.d.ts +6 -0
  270. package/dist/server/server/prompts/explain-analysis-prompt.d.ts +47 -0
  271. package/dist/server/server/prompts/index.d.ts +27 -0
  272. package/dist/server/server/prompts/single-step-prompt.d.ts +31 -0
  273. package/dist/server/server/prompts/step0-validation-prompt.d.ts +39 -0
  274. package/dist/server/server/prompts/step1-shape-prompt.d.ts +29 -0
  275. package/dist/server/server/prompts/step2-complete-prompt.d.ts +19 -0
  276. package/dist/server/server/prompts/types.d.ts +37 -0
  277. package/dist/server/server/resolvers/calculated-measure-resolver.d.ts +93 -0
  278. package/dist/server/server/resolvers/index.d.ts +6 -0
  279. package/dist/server/server/resolvers/join-path-resolver.d.ts +152 -0
  280. package/dist/server/server/template-substitution.d.ts +57 -0
  281. package/dist/server/server/types/analysis.d.ts +189 -0
  282. package/dist/server/server/types/cache.d.ts +132 -0
  283. package/dist/server/server/types/core.d.ts +164 -0
  284. package/dist/server/server/types/cube.d.ts +530 -0
  285. package/dist/server/server/types/executor.d.ts +156 -0
  286. package/dist/server/server/types/flow.d.ts +143 -0
  287. package/dist/server/server/types/funnel.d.ts +118 -0
  288. package/dist/server/server/types/index.d.ts +11 -0
  289. package/dist/server/server/types/metadata.d.ts +113 -0
  290. package/dist/server/server/types/query.d.ts +153 -0
  291. package/dist/server/server/types/retention.d.ts +141 -0
  292. package/dist/server/server/types/utils.d.ts +11 -0
  293. package/package.json +5 -5
  294. package/dist/adapters/mcp-transport-C4J4SAcn.cjs +0 -40
  295. package/dist/adapters/mcp-transport-CVUiifEc.js +0 -579
  296. package/dist/adapters/openai-BDwb2u7y.cjs +0 -17
  297. package/dist/adapters/utils-CkEkU8Bo.cjs +0 -128
  298. package/dist/client/chunks/DashboardEditModal-6KRE36mm.js.map +0 -1
  299. package/dist/client/chunks/chart-markdown-BPW-EAm9.js.map +0 -1
  300. package/dist/server/openai-BDwb2u7y.cjs +0 -17
  301. /package/dist/adapters/{express → adapters/express}/index.d.ts +0 -0
  302. /package/dist/adapters/{fastify → adapters/fastify}/index.d.ts +0 -0
  303. /package/dist/adapters/{hono → adapters/hono}/index.d.ts +0 -0
  304. /package/dist/adapters/{locale.d.ts → adapters/locale.d.ts} +0 -0
  305. /package/dist/adapters/{mcp-tools.d.ts → adapters/mcp-tools.d.ts} +0 -0
  306. /package/dist/adapters/{mcp-transport.d.ts → adapters/mcp-transport.d.ts} +0 -0
  307. /package/dist/adapters/{nextjs → adapters/nextjs}/index.d.ts +0 -0
  308. /package/dist/adapters/{types.d.ts → adapters/types.d.ts} +0 -0
  309. /package/dist/adapters/{utils.d.ts → adapters/utils.d.ts} +0 -0
@@ -0,0 +1,143 @@
1
+ import { Filter } from './query';
2
+ /**
3
+ * Flow query configuration for server-side execution
4
+ * This is the configuration extracted from SemanticQuery.flow
5
+ */
6
+ export interface FlowQueryConfig {
7
+ /**
8
+ * Binding key that identifies individual entities (e.g., userId)
9
+ * Can be a single string like 'Events.userId' or array for multi-cube
10
+ */
11
+ bindingKey: string | {
12
+ cube: string;
13
+ dimension: string;
14
+ }[];
15
+ /**
16
+ * Time dimension used for ordering events
17
+ * Can be a single string like 'Events.timestamp' or array for multi-cube
18
+ */
19
+ timeDimension: string | {
20
+ cube: string;
21
+ dimension: string;
22
+ }[];
23
+ /**
24
+ * The starting step from which we explore paths
25
+ * Defines the anchor point for bidirectional flow analysis
26
+ */
27
+ startingStep: {
28
+ /** Display name for the starting step */
29
+ name: string;
30
+ /** Filter(s) that identify events for this starting step */
31
+ filter?: Filter | Filter[];
32
+ };
33
+ /** Number of steps to explore BEFORE the starting step (0-5) */
34
+ stepsBefore: number;
35
+ /** Number of steps to explore AFTER the starting step (0-5) */
36
+ stepsAfter: number;
37
+ /**
38
+ * Event dimension that categorizes events (e.g., 'Events.eventType')
39
+ * This dimension's values become the node labels in the Sankey diagram
40
+ */
41
+ eventDimension: string;
42
+ /**
43
+ * Optional limit on the number of entities to process
44
+ * Useful for performance on large datasets
45
+ */
46
+ entityLimit?: number;
47
+ /**
48
+ * Output mode for flow data aggregation
49
+ * - 'sankey': Aggregate by (layer, event_type) - standard flow visualization where paths can converge
50
+ * - 'sunburst': Path-qualified nodes for hierarchical tree visualization where each path is unique
51
+ * @default 'sankey'
52
+ */
53
+ outputMode?: 'sankey' | 'sunburst';
54
+ /**
55
+ * Join strategy for fetching before/after steps
56
+ * - 'auto' (default): Use lateral when supported, otherwise window
57
+ * - 'lateral': Force lateral joins (error if not supported)
58
+ * - 'window': Force window-function strategy
59
+ */
60
+ joinStrategy?: 'auto' | 'lateral' | 'window';
61
+ }
62
+ /**
63
+ * A node in the Sankey diagram
64
+ * Represents an event type at a specific layer (distance from starting step)
65
+ */
66
+ export interface SankeyNode {
67
+ /**
68
+ * Unique identifier for this node
69
+ * Format: "before_{depth}_{eventType}" or "after_{depth}_{eventType}" or "start_{eventType}"
70
+ */
71
+ id: string;
72
+ /** Display name (typically the event type value) */
73
+ name: string;
74
+ /**
75
+ * Layer position in the Sankey diagram
76
+ * Negative for steps before starting step, 0 for starting step, positive for after
77
+ */
78
+ layer: number;
79
+ /** Total count of entities passing through this node */
80
+ value?: number;
81
+ }
82
+ /**
83
+ * A link (edge) in the Sankey diagram
84
+ * Represents a transition between two nodes
85
+ */
86
+ export interface SankeyLink {
87
+ /** Source node ID */
88
+ source: string;
89
+ /** Target node ID */
90
+ target: string;
91
+ /** Count of entities that follow this path */
92
+ value: number;
93
+ }
94
+ /**
95
+ * Flow result row returned from query execution
96
+ * Contains the complete Sankey diagram data
97
+ */
98
+ export interface FlowResultRow {
99
+ nodes: SankeyNode[];
100
+ links: SankeyLink[];
101
+ }
102
+ /**
103
+ * Internal representation of a resolved step during query building
104
+ */
105
+ export interface ResolvedFlowStep {
106
+ /** Layer index (-N to +N, 0 is starting step) */
107
+ layer: number;
108
+ /** Direction from starting step */
109
+ direction: 'before' | 'start' | 'after';
110
+ /** Depth from starting step (0 for start, 1+ for before/after) */
111
+ depth: number;
112
+ }
113
+ /**
114
+ * Raw aggregation row from the flow CTEs
115
+ * Before transformation to SankeyNode/SankeyLink format
116
+ */
117
+ export interface RawFlowNodeRow {
118
+ node_id: string;
119
+ event_type: string;
120
+ layer: number;
121
+ count: number;
122
+ }
123
+ /**
124
+ * Raw link row from the flow CTEs
125
+ * Before transformation to SankeyLink format
126
+ */
127
+ export interface RawFlowLinkRow {
128
+ source_id: string;
129
+ target_id: string;
130
+ count: number;
131
+ }
132
+ /**
133
+ * Flow validation result
134
+ */
135
+ export interface FlowValidationResult {
136
+ isValid: boolean;
137
+ errors: string[];
138
+ warnings: string[];
139
+ }
140
+ /** Minimum number of steps before/after */
141
+ export declare const FLOW_MIN_DEPTH = 0;
142
+ /** Maximum number of steps before/after */
143
+ export declare const FLOW_MAX_DEPTH = 5;
@@ -0,0 +1,118 @@
1
+ import { Filter } from './query';
2
+ /**
3
+ * Single-cube step definition - all steps use the same cube
4
+ */
5
+ export interface FunnelStepSingleCube {
6
+ /** Step display name */
7
+ name: string;
8
+ /** Filter conditions for this step */
9
+ filter?: Filter | Filter[];
10
+ /**
11
+ * Time window constraint - max duration from previous step.
12
+ * Format: ISO 8601 duration (e.g., "P7D" for 7 days, "PT1H" for 1 hour)
13
+ */
14
+ timeToConvert?: string;
15
+ }
16
+ /**
17
+ * Multi-cube step definition - steps can use different cubes
18
+ */
19
+ export interface FunnelStepMultiCube extends FunnelStepSingleCube {
20
+ /** Which cube this step uses */
21
+ cube: string;
22
+ }
23
+ export type FunnelStep = FunnelStepSingleCube | FunnelStepMultiCube;
24
+ /**
25
+ * Binding key mapping for multi-cube funnels
26
+ * Maps the user/entity identifier across different cubes
27
+ */
28
+ export interface FunnelBindingKeyMapping {
29
+ cube: string;
30
+ dimension: string;
31
+ }
32
+ /**
33
+ * Time dimension mapping for multi-cube funnels
34
+ * Maps the timestamp field across different cubes
35
+ */
36
+ export interface FunnelTimeDimensionMapping {
37
+ cube: string;
38
+ dimension: string;
39
+ }
40
+ /**
41
+ * Funnel query configuration
42
+ */
43
+ export interface FunnelQueryConfig {
44
+ /**
45
+ * Binding key - dimension that links entities across steps.
46
+ * This is typically a user ID, session ID, or other entity identifier.
47
+ * String for single-cube (e.g., 'Events.userId'),
48
+ * Array for multi-cube with different column names per cube.
49
+ */
50
+ bindingKey: string | FunnelBindingKeyMapping[];
51
+ /**
52
+ * Time dimension for temporal ordering.
53
+ * Used to determine event order and calculate time-to-convert.
54
+ * String for single-cube (e.g., 'Events.timestamp'),
55
+ * Array for multi-cube with different timestamp columns per cube.
56
+ */
57
+ timeDimension: string | FunnelTimeDimensionMapping[];
58
+ /** Ordered array of funnel steps (minimum 2) */
59
+ steps: FunnelStep[];
60
+ /** Include time-to-convert metrics in results (default: false) */
61
+ includeTimeMetrics?: boolean;
62
+ /**
63
+ * Global time window - all steps must complete within this duration
64
+ * from the first step. Format: ISO 8601 duration.
65
+ */
66
+ globalTimeWindow?: string;
67
+ }
68
+ /**
69
+ * Result row for funnel query
70
+ */
71
+ export interface FunnelResultRow {
72
+ /** Step name */
73
+ step: string;
74
+ /** Step position (0-indexed) */
75
+ stepIndex: number;
76
+ /** Count of entities that reached this step */
77
+ count: number;
78
+ /**
79
+ * Step-to-step conversion rate (count / previous step count).
80
+ * null for first step.
81
+ */
82
+ conversionRate: number | null;
83
+ /**
84
+ * Cumulative conversion rate from first step (count / first step count).
85
+ */
86
+ cumulativeConversionRate: number;
87
+ /** Average time to reach this step from previous step (seconds) */
88
+ avgSecondsToConvert?: number | null;
89
+ /** Median time to reach this step from previous step (seconds) */
90
+ medianSecondsToConvert?: number | null;
91
+ /** 90th percentile time to reach this step (seconds) */
92
+ p90SecondsToConvert?: number | null;
93
+ /** Minimum time to reach this step (seconds) */
94
+ minSecondsToConvert?: number | null;
95
+ /** Maximum time to reach this step (seconds) */
96
+ maxSecondsToConvert?: number | null;
97
+ }
98
+ /**
99
+ * Funnel capabilities per database engine
100
+ */
101
+ export interface FunnelCapabilities {
102
+ /** Whether database supports PERCENTILE_CONT */
103
+ supportsPercentile: boolean;
104
+ /** Whether database supports INTERVAL arithmetic directly */
105
+ supportsIntervalArithmetic: boolean;
106
+ }
107
+ /**
108
+ * Type guard for multi-cube step
109
+ */
110
+ export declare function isMultiCubeStep(step: FunnelStep): step is FunnelStepMultiCube;
111
+ /**
112
+ * Type guard for multi-cube binding key
113
+ */
114
+ export declare function isMultiCubeBindingKey(bindingKey: string | FunnelBindingKeyMapping[]): bindingKey is FunnelBindingKeyMapping[];
115
+ /**
116
+ * Type guard for multi-cube time dimension
117
+ */
118
+ export declare function isMultiCubeTimeDimension(timeDimension: string | FunnelTimeDimensionMapping[]): timeDimension is FunnelTimeDimensionMapping[];
@@ -0,0 +1,11 @@
1
+ export * from './core';
2
+ export * from './query';
3
+ export * from './funnel';
4
+ export * from './retention';
5
+ export * from './cube';
6
+ export * from './executor';
7
+ export * from './metadata';
8
+ export * from './analysis';
9
+ export * from './utils';
10
+ export * from './cache';
11
+ export { defineCube } from '../cube-utils';
@@ -0,0 +1,113 @@
1
+ import { MeasureType, MeasureFormat, DimensionFormat, TimeGranularity } from './core';
2
+ /**
3
+ * Cube relationship metadata for ERD visualization
4
+ */
5
+ export interface CubeRelationshipMetadata {
6
+ targetCube: string;
7
+ relationship: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
8
+ joinFields: Array<{
9
+ sourceField: string;
10
+ targetField: string;
11
+ }>;
12
+ }
13
+ /**
14
+ * Cube metadata for API responses
15
+ */
16
+ export interface CubeMetadata {
17
+ name: string;
18
+ title: string;
19
+ description?: string;
20
+ /**
21
+ * Example questions that can be answered using this cube
22
+ * Used by AI agents to understand cube capabilities
23
+ */
24
+ exampleQuestions?: string[];
25
+ measures: MeasureMetadata[];
26
+ dimensions: DimensionMetadata[];
27
+ segments: any[];
28
+ relationships?: CubeRelationshipMetadata[];
29
+ /**
30
+ * Hierarchies for structured drill-down paths
31
+ * Enables navigation through dimension levels (e.g., country -> region -> city)
32
+ */
33
+ hierarchies?: HierarchyMetadata[];
34
+ /** Additional cube metadata (e.g., eventStream configuration for funnel queries) */
35
+ meta?: Record<string, any>;
36
+ }
37
+ /**
38
+ * Measure metadata for API responses
39
+ */
40
+ export interface MeasureMetadata {
41
+ name: string;
42
+ title: string;
43
+ shortTitle: string;
44
+ type: MeasureType;
45
+ format?: MeasureFormat;
46
+ description?: string;
47
+ /**
48
+ * Alternative names for this measure
49
+ * Used by AI agents for natural language matching
50
+ */
51
+ synonyms?: string[];
52
+ /**
53
+ * Dimension names shown when drilling into this measure
54
+ * Full names like "CubeName.dimensionName" for cross-cube support
55
+ * If not specified, drilling is disabled for this measure
56
+ */
57
+ drillMembers?: string[];
58
+ }
59
+ /**
60
+ * Dimension metadata for API responses
61
+ */
62
+ export interface DimensionMetadata {
63
+ name: string;
64
+ title: string;
65
+ shortTitle: string;
66
+ type: string;
67
+ format?: DimensionFormat;
68
+ description?: string;
69
+ /**
70
+ * Alternative names for this dimension
71
+ * Used by AI agents for natural language matching
72
+ */
73
+ synonyms?: string[];
74
+ /**
75
+ * Supported granularities for time dimensions
76
+ * Only present when type is 'time'
77
+ * Used for time-based drill-down (year -> quarter -> month -> week -> day)
78
+ */
79
+ granularities?: TimeGranularity[];
80
+ }
81
+ /**
82
+ * Hierarchy metadata for structured drill-down paths
83
+ */
84
+ export interface HierarchyMetadata {
85
+ /** Unique identifier for the hierarchy */
86
+ name: string;
87
+ /** Display title for the hierarchy */
88
+ title: string;
89
+ /** Cube name this hierarchy belongs to */
90
+ cubeName: string;
91
+ /**
92
+ * Full dimension names in order from least to most granular
93
+ * Format: "CubeName.dimensionName"
94
+ */
95
+ levels: string[];
96
+ }
97
+ /**
98
+ * Pre-aggregation configuration
99
+ */
100
+ export interface SemanticPreAggregation {
101
+ name: string;
102
+ measures: string[];
103
+ dimensions: string[];
104
+ timeDimension?: {
105
+ dimension: string;
106
+ granularity: TimeGranularity[];
107
+ };
108
+ refreshKey?: {
109
+ every: string;
110
+ sql?: string;
111
+ };
112
+ indexes?: Record<string, string[]>;
113
+ }
@@ -0,0 +1,153 @@
1
+ import { TimeGranularity } from './core';
2
+ import { FunnelQueryConfig } from './funnel';
3
+ import { FlowQueryConfig } from './flow';
4
+ import { RetentionQueryConfig } from './retention';
5
+ /**
6
+ * Semantic query structure (Cube.js compatible)
7
+ */
8
+ export interface SemanticQuery {
9
+ measures?: string[];
10
+ dimensions?: string[];
11
+ filters?: Array<Filter>;
12
+ timeDimensions?: Array<TimeDimension>;
13
+ limit?: number;
14
+ offset?: number;
15
+ order?: Record<string, 'asc' | 'desc'>;
16
+ /**
17
+ * Default value to fill missing time series gaps with.
18
+ * Used when fillMissingDates is enabled on time dimensions.
19
+ * Default: 0
20
+ */
21
+ fillMissingDatesValue?: number | null;
22
+ /**
23
+ * When true, returns raw row-level data without GROUP BY or aggregation.
24
+ * Measures are rendered as raw column expressions (no aggregation wrappers).
25
+ * Security context and joins still apply normally.
26
+ *
27
+ * Constraints:
28
+ * - Requires at least one dimension
29
+ * - Only compatible with sum, avg, min, max, and number measure types
30
+ * - Incompatible with count, countDistinct, calculated, and window function measures
31
+ * - Incompatible with measure filters, hasMany joins, funnel/flow/retention modes
32
+ * - Incompatible with compareDateRange and fillMissingDates
33
+ */
34
+ ungrouped?: boolean;
35
+ /**
36
+ * Funnel analysis configuration for query-time funnel definition.
37
+ * When specified, the query executes as a funnel analysis instead of
38
+ * standard measures/dimensions aggregation.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * {
43
+ * funnel: {
44
+ * bindingKey: 'Events.userId',
45
+ * timeDimension: 'Events.timestamp',
46
+ * steps: [
47
+ * { name: 'Signup', filter: { member: 'Events.eventType', operator: 'equals', values: ['signup'] } },
48
+ * { name: 'Activation', filter: { member: 'Events.eventType', operator: 'equals', values: ['activation'] }, timeToConvert: 'P7D' }
49
+ * ]
50
+ * }
51
+ * }
52
+ * ```
53
+ */
54
+ funnel?: FunnelQueryConfig;
55
+ /**
56
+ * Flow analysis configuration for bidirectional path exploration.
57
+ * When specified, the query executes as a flow analysis instead of
58
+ * standard measures/dimensions aggregation.
59
+ *
60
+ * Flow analysis explores paths BEFORE and AFTER a defined starting step,
61
+ * producing Sankey diagram data (nodes and links).
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * {
66
+ * flow: {
67
+ * bindingKey: 'Events.userId',
68
+ * timeDimension: 'Events.timestamp',
69
+ * eventDimension: 'Events.eventType',
70
+ * startingStep: {
71
+ * name: 'Purchase',
72
+ * filter: { member: 'Events.eventType', operator: 'equals', values: ['purchase'] }
73
+ * },
74
+ * stepsBefore: 3,
75
+ * stepsAfter: 2
76
+ * }
77
+ * }
78
+ * ```
79
+ */
80
+ flow?: FlowQueryConfig;
81
+ /**
82
+ * Retention analysis configuration for cohort-based retention tracking.
83
+ * When specified, the query executes as a retention analysis instead of
84
+ * standard measures/dimensions aggregation.
85
+ *
86
+ * Retention analysis tracks what percentage of users from each cohort
87
+ * return in subsequent time periods.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * {
92
+ * retention: {
93
+ * timeDimension: 'Events.timestamp',
94
+ * bindingKey: 'Events.userId',
95
+ * dateRange: { start: '2024-01-01', end: '2024-12-31' },
96
+ * granularity: 'week',
97
+ * periods: 12,
98
+ * retentionType: 'classic',
99
+ * breakdownDimensions: ['Events.country', 'Events.plan']
100
+ * }
101
+ * }
102
+ * ```
103
+ */
104
+ retention?: RetentionQueryConfig;
105
+ }
106
+ /**
107
+ * Filter definitions with logical operators
108
+ */
109
+ export type Filter = FilterCondition | LogicalFilter;
110
+ export interface FilterCondition {
111
+ member: string;
112
+ operator: FilterOperator;
113
+ values: any[];
114
+ dateRange?: string | string[];
115
+ }
116
+ export interface LogicalFilter {
117
+ and?: Filter[];
118
+ or?: Filter[];
119
+ }
120
+ /**
121
+ * Time dimension with granularity
122
+ */
123
+ export interface TimeDimension {
124
+ dimension: string;
125
+ granularity?: TimeGranularity;
126
+ dateRange?: string | string[];
127
+ /**
128
+ * Fill missing dates in time series with the fill value.
129
+ * Requires both granularity and dateRange to be set.
130
+ * Default: true (enabled)
131
+ */
132
+ fillMissingDates?: boolean;
133
+ /**
134
+ * Array of date ranges for period-over-period comparison.
135
+ * When specified, queries are executed for each period and results are merged
136
+ * with period metadata (__periodIndex, __periodDayIndex) for alignment.
137
+ *
138
+ * Each range can be:
139
+ * - A relative string: 'this week', 'last month', 'last 30 days'
140
+ * - A tuple: ['2024-01-01', '2024-01-31']
141
+ *
142
+ * @example
143
+ * compareDateRange: [
144
+ * 'last 30 days', // Current period
145
+ * ['2024-01-01', '2024-01-30'] // Prior period to compare
146
+ * ]
147
+ */
148
+ compareDateRange?: (string | [string, string])[];
149
+ }
150
+ /**
151
+ * Supported filter operators
152
+ */
153
+ export type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'startsWith' | 'notStartsWith' | 'endsWith' | 'notEndsWith' | 'gt' | 'gte' | 'lt' | 'lte' | 'set' | 'notSet' | 'inDateRange' | 'beforeDate' | 'afterDate' | 'between' | 'notBetween' | 'in' | 'notIn' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex' | 'isEmpty' | 'isNotEmpty' | 'arrayContains' | 'arrayOverlaps' | 'arrayContained';
@@ -0,0 +1,141 @@
1
+ import { Filter } from './query';
2
+ /**
3
+ * Binding key mapping for multi-cube retention
4
+ * Maps the user/entity identifier across cohort and activity cubes
5
+ */
6
+ export interface RetentionBindingKeyMapping {
7
+ cube: string;
8
+ dimension: string;
9
+ }
10
+ /**
11
+ * Time dimension mapping for multi-cube retention
12
+ * Maps the timestamp field across different cubes
13
+ */
14
+ export interface RetentionTimeDimensionMapping {
15
+ cube: string;
16
+ dimension: string;
17
+ }
18
+ /**
19
+ * Date range for cohort analysis
20
+ */
21
+ export interface RetentionDateRange {
22
+ /** Start date (inclusive), ISO 8601 format (YYYY-MM-DD) */
23
+ start: string;
24
+ /** End date (inclusive), ISO 8601 format (YYYY-MM-DD) */
25
+ end: string;
26
+ }
27
+ /**
28
+ * Retention query configuration (Simplified Mixpanel-style format)
29
+ *
30
+ * Key simplifications from previous version:
31
+ * - Single timeDimension for both cohort entry and activity
32
+ * - Single granularity for viewing periods (no separate cohort/period granularity)
33
+ * - Single cohort (date range defines the cohort) with optional breakdown
34
+ */
35
+ export interface RetentionQueryConfig {
36
+ /**
37
+ * Single timestamp dimension for the analysis.
38
+ * String for single-cube (e.g., 'Events.timestamp'),
39
+ * Object for multi-cube with explicit cube reference.
40
+ */
41
+ timeDimension: string | RetentionTimeDimensionMapping;
42
+ /**
43
+ * Binding key - dimension that links users across events.
44
+ * This is typically a user ID or other entity identifier.
45
+ * String for single-cube (e.g., 'Events.userId'),
46
+ * Array for multi-cube with different column names per cube.
47
+ */
48
+ bindingKey: string | RetentionBindingKeyMapping[];
49
+ /**
50
+ * Date range for cohort analysis (REQUIRED).
51
+ * Users who first performed the cohort action within this range are included.
52
+ */
53
+ dateRange: RetentionDateRange;
54
+ /**
55
+ * Granularity for viewing retention periods.
56
+ * Determines how period_number is calculated (day/week/month).
57
+ */
58
+ granularity: 'day' | 'week' | 'month';
59
+ /**
60
+ * Number of periods to calculate (e.g., 12 for 12 weeks).
61
+ * Period 0 is always the cohort entry period.
62
+ */
63
+ periods: number;
64
+ /**
65
+ * Retention type:
66
+ * - 'classic': User returned exactly in period N (bounded)
67
+ * - 'rolling': User returned in period N or any later period (unbounded)
68
+ */
69
+ retentionType: 'classic' | 'rolling';
70
+ /**
71
+ * Optional filters on cohort entry events.
72
+ * Applied when identifying which users enter the cohort.
73
+ */
74
+ cohortFilters?: Filter | Filter[];
75
+ /**
76
+ * Optional filters on return activity events.
77
+ * Applied when checking for user activity in each period.
78
+ */
79
+ activityFilters?: Filter | Filter[];
80
+ /**
81
+ * Optional breakdown dimensions for segmenting the cohort.
82
+ * When provided, retention is calculated per unique combination of breakdown values.
83
+ * e.g., ["Events.country", "Events.plan"] to see retention by country and plan.
84
+ */
85
+ breakdownDimensions?: string[];
86
+ }
87
+ /**
88
+ * Single retention data point in the flat result format.
89
+ * Results are returned as a flat array; client transforms to matrix if needed.
90
+ *
91
+ * Simplified format: no cohortPeriod since we use a single cohort model.
92
+ * When breakdownDimensions are specified, results include breakdownValues.
93
+ */
94
+ export interface RetentionResultRow {
95
+ /** Period number (0 = cohort entry, 1 = first retention period, etc.) */
96
+ period: number;
97
+ /** Number of users in the cohort (or segment when breakdown is used) */
98
+ cohortSize: number;
99
+ /** Number of users retained in this period */
100
+ retainedUsers: number;
101
+ /** Retention rate as decimal (0-1), e.g., 0.45 for 45% */
102
+ retentionRate: number;
103
+ /**
104
+ * Breakdown values when breakdownDimensions are specified.
105
+ * Keyed by dimension name (e.g., { "Events.country": "US", "Events.plan": "pro" })
106
+ */
107
+ breakdownValues?: Record<string, string | null>;
108
+ }
109
+ /**
110
+ * Retention capabilities per database engine
111
+ */
112
+ export interface RetentionCapabilities {
113
+ /** Whether database supports DATE_TRUNC natively */
114
+ supportsDateTrunc: boolean;
115
+ /** Whether database supports DATE_DIFF with unit specification */
116
+ supportsDateDiff: boolean;
117
+ /** Whether database supports generate_series for period generation */
118
+ supportsGenerateSeries: boolean;
119
+ }
120
+ /**
121
+ * Type guard for multi-cube binding key
122
+ */
123
+ export declare function isRetentionMultiCubeBindingKey(bindingKey: string | RetentionBindingKeyMapping[]): bindingKey is RetentionBindingKeyMapping[];
124
+ /**
125
+ * Type guard for multi-cube time dimension (object form)
126
+ */
127
+ export declare function isRetentionMultiCubeTimeDimension(timeDimension: string | RetentionTimeDimensionMapping): timeDimension is RetentionTimeDimensionMapping;
128
+ /**
129
+ * Type guard for retention query
130
+ */
131
+ export declare function isRetentionQuery(query: unknown): query is {
132
+ retention: RetentionQueryConfig;
133
+ };
134
+ /**
135
+ * Extract cube name from a time dimension specification
136
+ */
137
+ export declare function extractCubeFromTimeDimension(timeDimension: string | RetentionTimeDimensionMapping): string;
138
+ /**
139
+ * Extract dimension name from a time dimension specification
140
+ */
141
+ export declare function extractDimensionFromTimeDimension(timeDimension: string | RetentionTimeDimensionMapping): string;
@@ -0,0 +1,11 @@
1
+ import { SQL, AnyColumn } from 'drizzle-orm';
2
+ import { QueryContext } from './cube';
3
+ /**
4
+ * Type-level utility to extract the schema type from a cube reference
5
+ * Since we removed generics, this now returns 'any'
6
+ */
7
+ export type ExtractSchemaFromCubeRef = any;
8
+ /**
9
+ * Type for SQL expressions that can be functions or direct values
10
+ */
11
+ export type SqlExpression = AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL);