drizzle-cube 0.5.7 → 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.
- package/README.md +2 -0
- package/dist/adapters/adapters/hono/agent-handler.d.ts +9 -0
- package/dist/adapters/adapters/hono/mcp-handler.d.ts +37 -0
- package/dist/adapters/adapters/mcp-tools-handlers.d.ts +18 -0
- package/dist/adapters/adapters/nextjs/mcp-handler.d.ts +36 -0
- package/dist/adapters/{utils.d.ts → adapters/utils.d.ts} +6 -81
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +50 -50
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +78 -78
- package/dist/adapters/google-BOnRIN1w.cjs +2 -0
- package/dist/{server/google-CFYljAOF.js → adapters/google-CvKM9yVM.js} +83 -71
- package/dist/adapters/{handler-Dz1F4iwf.js → handler-CfgE0JSL.js} +515 -578
- package/dist/adapters/handler-Cn0dOctE.cjs +25 -0
- package/dist/adapters/hono/index.cjs +2 -2
- package/dist/adapters/hono/index.js +208 -178
- package/dist/adapters/locale-DDvZDFVn.js +8114 -0
- package/dist/adapters/locale-ZLUUNUxr.cjs +166 -0
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +49 -38
- package/dist/adapters/mcp-transport-Chiaj4ll.cjs +40 -0
- package/dist/adapters/mcp-transport-H96VG3WY.js +591 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +190 -197
- package/dist/{server/openai-y7GhJNdn.js → adapters/openai-B5jEiqiB.js} +776 -719
- package/dist/adapters/openai-D0musiYP.cjs +17 -0
- package/dist/{server/openai-DiVskd89.js → adapters/openai-cDlFSTk6.js} +61 -59
- package/dist/adapters/openai-vXvLni8v.cjs +1 -0
- package/dist/adapters/{utils-DosuoabY.js → utils-BPWZsX7k.js} +1285 -1220
- package/dist/adapters/utils-_whV4fXL.cjs +128 -0
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.js +2 -2
- package/dist/client/charts/ChartLoader.d.ts +3 -17
- package/dist/client/charts/chartComponentRegistry.d.ts +46 -0
- package/dist/client/charts/chartConfigHelpers.d.ts +38 -0
- package/dist/client/charts.js +14 -13
- package/dist/client/chunks/{DashboardEditModal-6KRE36mm.js → DashboardEditModal-okVfH8ZK.js} +5446 -4486
- package/dist/client/chunks/DashboardEditModal-okVfH8ZK.js.map +1 -0
- package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js → RetentionCombinedChart-BgbDhsPz.js} +10 -10
- package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js.map → RetentionCombinedChart-BgbDhsPz.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js → RetentionHeatmap-DjXZaTPq.js} +5 -5
- package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js.map → RetentionHeatmap-DjXZaTPq.js.map} +1 -1
- package/dist/client/chunks/analysis-builder-DB88FojM.js +5674 -0
- package/dist/client/chunks/analysis-builder-DB88FojM.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-x576-O5p.js → analysis-builder-shared-BVK4TYfR.js} +1578 -1292
- package/dist/client/chunks/analysis-builder-shared-BVK4TYfR.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CiHrLH6Y.js → chart-activity-grid-DX0SJbxs.js} +642 -494
- package/dist/client/chunks/chart-activity-grid-DX0SJbxs.js.map +1 -0
- package/dist/client/chunks/chart-area-of01_62R.js +775 -0
- package/dist/client/chunks/chart-area-of01_62R.js.map +1 -0
- package/dist/client/chunks/chart-bar-BqelQE_I.js +194 -0
- package/dist/client/chunks/chart-bar-BqelQE_I.js.map +1 -0
- package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js → chart-box-plot-kkBixZ27.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js.map → chart-box-plot-kkBixZ27.js.map} +1 -1
- package/dist/client/chunks/chart-bubble-B2he1--4.js +221 -0
- package/dist/client/chunks/chart-bubble-B2he1--4.js.map +1 -0
- package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js → chart-candlestick-DZp19Tzh.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js.map → chart-candlestick-DZp19Tzh.js.map} +1 -1
- package/dist/client/chunks/chart-config-area-BNigHUy8.js +124 -0
- package/dist/client/chunks/chart-config-area-BNigHUy8.js.map +1 -0
- package/dist/client/chunks/chart-config-bar-DSO_LRTx.js +54 -0
- package/dist/client/chunks/chart-config-bar-DSO_LRTx.js.map +1 -0
- package/dist/client/chunks/{chart-config-box-plot-DJ-dWWXA.js → chart-config-box-plot-oW8axV2q.js} +5 -10
- package/dist/client/chunks/chart-config-box-plot-oW8axV2q.js.map +1 -0
- package/dist/client/chunks/{chart-config-gauge-DSwC04l0.js → chart-config-gauge-Dq-_H9UN.js} +5 -7
- package/dist/client/chunks/chart-config-gauge-Dq-_H9UN.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-delta-D6BIkHL3.js → chart-config-kpi-delta-DSQbvqu_.js} +5 -10
- package/dist/client/chunks/chart-config-kpi-delta-DSQbvqu_.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-number-Bx-V9a62.js → chart-config-kpi-number-EFSWY1We.js} +5 -7
- package/dist/client/chunks/chart-config-kpi-number-EFSWY1We.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-text-CcqC1u-8.js → chart-config-kpi-text-KM3V5X2u.js} +5 -7
- package/dist/client/chunks/chart-config-kpi-text-KM3V5X2u.js.map +1 -0
- package/dist/client/chunks/{chart-config-line-Db3jDsWc.js → chart-config-line-D6jG8PCH.js} +9 -36
- package/dist/client/chunks/chart-config-line-D6jG8PCH.js.map +1 -0
- package/dist/client/chunks/{chart-config-pie-DD4SmRTF.js → chart-config-pie-BhzW-fdn.js} +6 -16
- package/dist/client/chunks/chart-config-pie-BhzW-fdn.js.map +1 -0
- package/dist/client/chunks/{chart-config-radar-CC2XAaGr.js → chart-config-radar-D7REP1q_.js} +6 -16
- package/dist/client/chunks/chart-config-radar-D7REP1q_.js.map +1 -0
- package/dist/client/chunks/{chart-config-radial-bar-DmxKx1R0.js → chart-config-radial-bar-Byx6qOPU.js} +6 -16
- package/dist/client/chunks/chart-config-radial-bar-Byx6qOPU.js.map +1 -0
- package/dist/client/chunks/{chart-config-tree-map-BI-oQStO.js → chart-config-tree-map-DVrvf3yQ.js} +6 -16
- package/dist/client/chunks/chart-config-tree-map-DVrvf3yQ.js.map +1 -0
- package/dist/client/chunks/{chart-config-waterfall-DSnyixbI.js → chart-config-waterfall-DmFeQdIk.js} +5 -10
- package/dist/client/chunks/chart-config-waterfall-DmFeQdIk.js.map +1 -0
- package/dist/client/chunks/{chart-data-table-Cm5jrpaw.js → chart-data-table-CKauQXme.js} +1046 -1121
- package/dist/client/chunks/chart-data-table-CKauQXme.js.map +1 -0
- package/dist/client/chunks/{chart-funnel-Eke8IPtG.js → chart-funnel-CToKSBaL.js} +184 -222
- package/dist/client/chunks/chart-funnel-CToKSBaL.js.map +1 -0
- package/dist/client/chunks/chart-gauge-DTVezSk7.js +403 -0
- package/dist/client/chunks/chart-gauge-DTVezSk7.js.map +1 -0
- package/dist/client/chunks/chart-heat-map-DTuUl0BR.js +236 -0
- package/dist/client/chunks/chart-heat-map-DTuUl0BR.js.map +1 -0
- package/dist/client/chunks/chart-kpi-delta-Dn-jjO-2.js +408 -0
- package/dist/client/chunks/chart-kpi-delta-Dn-jjO-2.js.map +1 -0
- package/dist/client/chunks/chart-kpi-number-P_WBiO5S.js +244 -0
- package/dist/client/chunks/chart-kpi-number-P_WBiO5S.js.map +1 -0
- package/dist/client/chunks/chart-kpi-text-C-Y4eb5H.js +185 -0
- package/dist/client/chunks/chart-kpi-text-C-Y4eb5H.js.map +1 -0
- package/dist/client/chunks/chart-line-DKgrQA6c.js +101 -0
- package/dist/client/chunks/chart-line-DKgrQA6c.js.map +1 -0
- package/dist/client/chunks/{chart-markdown-BPW-EAm9.js → chart-markdown-CV75S_zL.js} +1359 -1240
- package/dist/client/chunks/chart-markdown-CV75S_zL.js.map +1 -0
- package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js → chart-measure-profile-Ket8fJyf.js} +7 -7
- package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js.map → chart-measure-profile-Ket8fJyf.js.map} +1 -1
- package/dist/client/chunks/chart-pie-ByieAX5H.js +119 -0
- package/dist/client/chunks/chart-pie-ByieAX5H.js.map +1 -0
- package/dist/client/chunks/chart-radar-CiSwHWp4.js +138 -0
- package/dist/client/chunks/chart-radar-CiSwHWp4.js.map +1 -0
- package/dist/client/chunks/chart-radial-bar-BF6Mhl6f.js +122 -0
- package/dist/client/chunks/chart-radial-bar-BF6Mhl6f.js.map +1 -0
- package/dist/client/chunks/{chart-sankey-CFzjGvZX.js → chart-sankey-DjrvKw6K.js} +36 -39
- package/dist/client/chunks/{chart-sankey-CFzjGvZX.js.map → chart-sankey-DjrvKw6K.js.map} +1 -1
- package/dist/client/chunks/chart-scatter-Dd9WFqnS.js +258 -0
- package/dist/client/chunks/chart-scatter-Dd9WFqnS.js.map +1 -0
- package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js → chart-sunburst-leGpuDj7.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js.map → chart-sunburst-leGpuDj7.js.map} +1 -1
- package/dist/client/chunks/chart-tree-map-Ceq5sLZA.js +323 -0
- package/dist/client/chunks/chart-tree-map-Ceq5sLZA.js.map +1 -0
- package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js → chart-waterfall-DyvQReN5.js} +7 -7
- package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js.map → chart-waterfall-DyvQReN5.js.map} +1 -1
- package/dist/client/chunks/{charts-core-CrBDYN6N.js → charts-core-DaXSt1Dd.js} +2 -2
- package/dist/client/chunks/{charts-core-CrBDYN6N.js.map → charts-core-DaXSt1Dd.js.map} +1 -1
- package/dist/client/chunks/charts-loader-DdTeCeNo.js +84 -0
- package/dist/client/chunks/charts-loader-DdTeCeNo.js.map +1 -0
- package/dist/client/chunks/{core-DsAWNRRv.js → core-D7vPfUIe.js} +2 -2
- package/dist/client/chunks/{core-DsAWNRRv.js.map → core-D7vPfUIe.js.map} +1 -1
- package/dist/client/chunks/{nl-NL-oyr2wENY.js → nl-NL-2zTAWTej.js} +8 -2
- package/dist/client/chunks/{nl-NL-oyr2wENY.js.map → nl-NL-2zTAWTej.js.map} +1 -1
- package/dist/client/chunks/retention-ChW9jYdy.js.map +1 -1
- package/dist/client/chunks/{schema-visualization-BszcrmZX.js → schema-visualization-Cb_E9_Gd.js} +12 -12
- package/dist/client/chunks/{schema-visualization-BszcrmZX.js.map → schema-visualization-Cb_E9_Gd.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-B5wCDJSj.js → useDirtyStateTracking-MbpxH_v6.js} +95 -84
- package/dist/client/chunks/useDirtyStateTracking-MbpxH_v6.js.map +1 -0
- package/dist/client/chunks/{useExplainAI-CCeCYzDm.js → useExplainAI-evnZkjCY.js} +14 -14
- package/dist/client/chunks/{useExplainAI-CCeCYzDm.js.map → useExplainAI-evnZkjCY.js.map} +1 -1
- package/dist/client/chunks/{utils-kqa-JIMg.js → utils-3P6z1vz5.js} +3 -3
- package/dist/client/chunks/{utils-kqa-JIMg.js.map → utils-3P6z1vz5.js.map} +1 -1
- package/dist/client/chunks/{vendor-0hJNlZXQ.js → vendor-DSpR0IW6.js} +43 -43
- package/dist/client/chunks/{vendor-0hJNlZXQ.js.map → vendor-DSpR0IW6.js.map} +1 -1
- package/dist/client/components/AgenticNotebook/agentChatParts.d.ts +34 -0
- package/dist/client/components/AgenticNotebook/chatMessageParts.d.ts +39 -0
- package/dist/client/components/AgenticNotebook/useAgentChatController.d.ts +25 -0
- package/dist/client/components/AgenticNotebook/useNotebookAutosave.d.ts +12 -0
- package/dist/client/components/AnalysisBuilder/AnalysisAIPanel.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisDisplayConfigPanel.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisFilterGroup.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisFilterItem.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisFilterSection.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisModeErrorBoundary.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/AnalysisQueryPanelParts.d.ts +64 -0
- package/dist/client/components/AnalysisBuilder/AnalysisResultsHeader.d.ts +67 -0
- package/dist/client/components/AnalysisBuilder/BreakdownComparisonToggle.d.ts +13 -0
- package/dist/client/components/AnalysisBuilder/BreakdownRow.d.ts +26 -0
- package/dist/client/components/AnalysisBuilder/DisplayOptionControl.d.ts +10 -0
- package/dist/client/components/AnalysisBuilder/ExecutionPlanPanelParts.d.ts +22 -0
- package/dist/client/components/AnalysisBuilder/ExplainAIPanel.d.ts +2 -1
- package/dist/client/components/AnalysisBuilder/FieldDetailPanel.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/FieldSearchItem.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/FieldSearchModal.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/FieldSearchResults.d.ts +16 -0
- package/dist/client/components/AnalysisBuilder/FilterConfigModal.d.ts +2 -1
- package/dist/client/components/AnalysisBuilder/FilterValueInput.d.ts +63 -0
- package/dist/client/components/AnalysisBuilder/FlowDepthControls.d.ts +10 -0
- package/dist/client/components/AnalysisBuilder/FlowVisualizationPicker.d.ts +7 -0
- package/dist/client/components/AnalysisBuilder/LegacyBooleanOptions.d.ts +8 -0
- package/dist/client/components/AnalysisBuilder/LimitSection.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/MetricRow.d.ts +23 -0
- package/dist/client/components/AnalysisBuilder/SectionHeading.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/SortToggleButton.d.ts +13 -0
- package/dist/client/components/AnalysisBuilder/StringArrayInput.d.ts +17 -0
- package/dist/client/components/AnalysisBuilder/filterConfigModalUtils.d.ts +30 -0
- package/dist/client/components/AnalysisBuilder/hooks/useAnalysisBuilderImperativeHandle.d.ts +13 -0
- package/dist/client/components/AnalysisBuilder/hooks/useDragReorder.d.ts +25 -0
- package/dist/client/components/AnalysisBuilder/hooks/useFieldSearchKeyboard.d.ts +11 -0
- package/dist/client/components/AnalysisBuilder/utils/axisConfigUtils.d.ts +23 -0
- package/dist/client/components/AnalysisBuilder/utils/executionPlanMarkdown.d.ts +8 -0
- package/dist/client/components/AnalysisBuilder/utils/fieldUtils.d.ts +5 -0
- package/dist/client/components/AnalysisBuilder/utils/resultsPanelDerive.d.ts +68 -0
- package/dist/client/components/AnalysisBuilder/utils/shareStateUtils.d.ts +68 -0
- package/dist/client/components/AnalysisBuilder/utils/sortUtils.d.ts +7 -0
- package/dist/client/components/AnalyticsDashboard.d.ts +1 -1
- package/dist/client/components/AnalyticsPage.d.ts +1 -1
- package/dist/client/components/ChartErrorBoundary.d.ts +1 -1
- package/dist/client/components/ChartTypeSelector.d.ts +1 -1
- package/dist/client/components/ColorPaletteSelector.d.ts +1 -1
- package/dist/client/components/DashboardEditModal.d.ts +2 -1
- package/dist/client/components/DashboardFilters/CompactFilterBarParts.d.ts +26 -0
- package/dist/client/components/DashboardFilters/DashboardFilterConfigModal.d.ts +1 -1
- package/dist/client/components/DashboardFilters/DashboardFilterConfigModalParts.d.ts +27 -0
- package/dist/client/components/DashboardFilters/DashboardFilterItem.d.ts +1 -1
- package/dist/client/components/DashboardFilters/DashboardFilterValueInput.d.ts +39 -0
- package/dist/client/components/DashboardFilters/dashboardFilterConfigModalUtils.d.ts +21 -0
- package/dist/client/components/DashboardFilters/useCompactFilterBar.d.ts +19 -0
- package/dist/client/components/DashboardFilters/useDashboardFilterConfigModal.d.ts +69 -0
- package/dist/client/components/DashboardFilters/useDateRangeState.d.ts +19 -0
- package/dist/client/components/DashboardFilters/useFilterDropdowns.d.ts +21 -0
- package/dist/client/components/DashboardFilters/useFilterValueFetch.d.ts +23 -0
- package/dist/client/components/DashboardGrid.d.ts +1 -1
- package/dist/client/components/DashboardPortletCard.d.ts +2 -57
- package/dist/client/components/DashboardThumbnailPlaceholder.d.ts +1 -1
- package/dist/client/components/DataBrowser/DataBrowserSidebar.d.ts +1 -1
- package/dist/client/components/DataBrowser/DataBrowserToolbar.d.ts +1 -1
- package/dist/client/components/DataBrowser/index.d.ts +1 -1
- package/dist/client/components/DataHistogram.d.ts +1 -1
- package/dist/client/components/DebugModal.d.ts +1 -1
- package/dist/client/components/DrillBreadcrumb.d.ts +2 -1
- package/dist/client/components/LoadingIndicator.d.ts +1 -1
- package/dist/client/components/MobileStackedLayout.d.ts +1 -1
- package/dist/client/components/PortletAnalysisModal.d.ts +1 -1
- package/dist/client/components/PortletContainer.d.ts +1 -1
- package/dist/client/components/PortletFilterConfigModal.d.ts +6 -4
- package/dist/client/components/RowManagedLayout.d.ts +1 -1
- package/dist/client/components/ScaledGridWrapper.d.ts +1 -1
- package/dist/client/components/SchemaVisualization/CubeNode.d.ts +1 -1
- package/dist/client/components/SchemaVisualization/FieldDetailPanel.d.ts +1 -1
- package/dist/client/components/SchemaVisualization/RelationshipEdge.d.ts +1 -1
- package/dist/client/components/SchemaVisualization/SchemaVisualizationLazy.d.ts +1 -1
- package/dist/client/components/SchemaVisualization/index.d.ts +1 -1
- package/dist/client/components/TextPortletModal.d.ts +1 -1
- package/dist/client/components/analyticsPortlet/PortletChart.d.ts +31 -0
- package/dist/client/components/analyticsPortlet/PortletChartView.d.ts +35 -0
- package/dist/client/components/analyticsPortlet/PortletStates.d.ts +65 -0
- package/dist/client/components/analyticsPortlet/parsePortletQuery.d.ts +22 -0
- package/dist/client/components/analyticsPortlet/portletRenderState.d.ts +31 -0
- package/dist/client/components/analyticsPortlet/usePortletDebugData.d.ts +37 -0
- package/dist/client/components/analyticsPortlet/usePortletDrillState.d.ts +17 -0
- package/dist/client/components/analyticsPortlet/usePortletQueryResults.d.ts +37 -0
- package/dist/client/components/charts/ActivityGridChart.helpers.d.ts +33 -0
- package/dist/client/components/charts/ActivityGridChart.render.d.ts +31 -0
- package/dist/client/components/charts/AxisFormatControls.d.ts +5 -3
- package/dist/client/components/charts/BarChart.helpers.d.ts +23 -0
- package/dist/client/components/charts/BarSeries.d.ts +29 -0
- package/dist/client/components/charts/BubbleChart.helpers.d.ts +43 -0
- package/dist/client/components/charts/BubbleChart.render.d.ts +21 -0
- package/dist/client/components/charts/ChartContainer.d.ts +1 -1
- package/dist/client/components/charts/ChartLegend.d.ts +1 -1
- package/dist/client/components/charts/ChartStates.d.ts +38 -0
- package/dist/client/components/charts/ChartTooltip.d.ts +1 -1
- package/dist/client/components/charts/FunnelChart.helpers.d.ts +25 -0
- package/dist/client/components/charts/FunnelViews.d.ts +16 -0
- package/dist/client/components/charts/HeatMapCanvas.d.ts +25 -0
- package/dist/client/components/charts/HeatMapChart.helpers.d.ts +64 -0
- package/dist/client/components/charts/KpiDelta.helpers.d.ts +20 -0
- package/dist/client/components/charts/KpiNumber.helpers.d.ts +30 -0
- package/dist/client/components/charts/KpiStates.d.ts +19 -0
- package/dist/client/components/charts/MissingDependencyFallback.d.ts +1 -1
- package/dist/client/components/charts/ScatterChart.helpers.d.ts +43 -0
- package/dist/client/components/charts/ScatterSeries.d.ts +17 -0
- package/dist/client/components/charts/ScatterTooltip.d.ts +21 -0
- package/dist/client/components/charts/TreeMapChart.helpers.d.ts +37 -0
- package/dist/client/components/charts/TreeMapContent.d.ts +24 -0
- package/dist/client/components/charts/TreeMapLegend.d.ts +13 -0
- package/dist/client/components/charts/cartesianChartHelpers.d.ts +126 -0
- package/dist/client/components/charts/chartAxisResolution.d.ts +32 -0
- package/dist/client/components/charts/chartScaffolding.d.ts +77 -0
- package/dist/client/components/charts/gaugeChartHelpers.d.ts +36 -0
- package/dist/client/components/charts/kpiTextHelpers.d.ts +46 -0
- package/dist/client/components/charts/radarChartHelpers.d.ts +14 -0
- package/dist/client/components/charts/radialBarChartHelpers.d.ts +22 -0
- package/dist/client/components/charts/useChartDimensions.d.ts +20 -0
- package/dist/client/components/charts/useKpiDimensions.d.ts +30 -0
- package/dist/client/components/dashboard/DashboardContext.d.ts +2 -2
- package/dist/client/components/dashboard/DashboardCoordinator.d.ts +1 -1
- package/dist/client/components/dashboard/DashboardEditBar.d.ts +5 -0
- package/dist/client/components/dashboard/DashboardFilterBar.d.ts +1 -1
- package/dist/client/components/dashboard/DashboardGridSurface.d.ts +1 -1
- package/dist/client/components/dashboard/DashboardModals.d.ts +1 -1
- package/dist/client/components/dashboard/DashboardProvider.d.ts +1 -1
- package/dist/client/components/dashboard/DashboardToolbar.d.ts +1 -1
- package/dist/client/components/dashboard/LayoutModeToggle.d.ts +10 -0
- package/dist/client/components/dashboard/dashboardGridUtils.d.ts +1 -1
- package/dist/client/components/dashboardPortletCard/FilterFieldChip.d.ts +12 -0
- package/dist/client/components/dashboardPortletCard/PortletCardHeader.d.ts +43 -0
- package/dist/client/components/dashboardPortletCard/cardStyles.d.ts +33 -0
- package/dist/client/components/dashboardPortletCard/filterField.d.ts +12 -0
- package/dist/client/components/dashboardPortletCard/propsEqual.d.ts +55 -0
- package/dist/client/components/dashboardPortletCard/usePortletCardActions.d.ts +16 -0
- package/dist/client/components/portletAnalysisModal/saveValidation.d.ts +8 -0
- package/dist/client/components/shared/dateRangeUtils.d.ts +40 -0
- package/dist/client/components/shared/filterDisplayUtils.d.ts +10 -0
- package/dist/client/components/shared/filterItem/FilterDateRangeSelector.d.ts +17 -0
- package/dist/client/components/shared/filterItem/FilterFieldDropdown.d.ts +16 -0
- package/dist/client/components/shared/filterItem/dateRangeSync.d.ts +14 -0
- package/dist/client/components/shared/filterItem/fieldVisuals.d.ts +5 -0
- package/dist/client/components/shared/filterValueSelector/FilterValueInputs.d.ts +55 -0
- package/dist/client/components/shared/filterValueSelector/useFilterValueSelectorState.d.ts +25 -0
- package/dist/client/components/shared/queryFieldUtils.d.ts +21 -0
- package/dist/client/components/shared/utils.d.ts +4 -43
- package/dist/client/components.js +3 -3
- package/dist/client/hooks/agentChatStream.d.ts +39 -0
- package/dist/client/hooks/analysisQueryExecutionModes.d.ts +133 -0
- package/dist/client/hooks/dashboard/useDashboardController.d.ts +2 -2
- package/dist/client/hooks/drillNavigation.d.ts +25 -0
- package/dist/client/hooks/useDashboardHook.d.ts +2 -2
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons.d.ts +1 -1
- package/dist/client/icons.js +2 -2
- package/dist/client/index.js +816 -669
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers/CubeApiProvider.d.ts +1 -1
- package/dist/client/providers/CubeFeaturesProvider.d.ts +1 -1
- package/dist/client/providers/CubeMetaProvider.d.ts +1 -1
- package/dist/client/providers/CubeProvider.d.ts +1 -1
- package/dist/client/providers/I18nProvider.d.ts +1 -1
- package/dist/client/providers.js +3 -3
- package/dist/client/schema.js +1 -1
- package/dist/client/shared/chartConfigBuilders.d.ts +18 -0
- package/dist/client/shared/components/QueryAnalysisPanel.sections.d.ts +41 -0
- package/dist/client/shared/queryTransforms.d.ts +20 -0
- package/dist/client/shared/utils.d.ts +2 -4
- package/dist/client/stores/analysisBuilderStore.d.ts +1 -1
- package/dist/client/stores/dashboardStore.d.ts +1 -1
- package/dist/client/stores/dataBrowserStore.d.ts +1 -1
- package/dist/client/stores/notebookStore.d.ts +1 -1
- package/dist/client/stores/optionsToAnalysisConfig.d.ts +17 -0
- package/dist/client/styles.css +1 -1
- package/dist/client/types/drill.d.ts +1 -1
- package/dist/client/types.d.ts +7 -2
- package/dist/client/utils/axisValueFormatting.d.ts +32 -0
- package/dist/client/utils/drillQueryBuilder.d.ts +2 -2
- package/dist/client/utils/filterUtils.d.ts +33 -5
- package/dist/client/utils/joinReachability.d.ts +27 -0
- package/dist/client/utils/timeValueFormatting.d.ts +32 -0
- package/dist/client/utils.js +6 -6
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +55 -55
- package/dist/server/google-BOnRIN1w.cjs +2 -0
- package/dist/{adapters/google-CFYljAOF.js → server/google-CvKM9yVM.js} +83 -71
- package/dist/server/index.cjs +179 -211
- package/dist/server/index.d.ts +2 -5050
- package/dist/server/index.js +6360 -6462
- package/dist/{adapters/openai-y7GhJNdn.js → server/openai-B5jEiqiB.js} +776 -719
- package/dist/server/openai-D0musiYP.cjs +17 -0
- package/dist/{adapters/openai-DiVskd89.js → server/openai-cDlFSTk6.js} +61 -59
- package/dist/server/openai-vXvLni8v.cjs +1 -0
- package/dist/server/server/adapters/base-adapter.d.ts +332 -0
- package/dist/server/server/adapters/databend-adapter.d.ts +63 -0
- package/dist/server/server/adapters/duckdb-adapter.d.ts +68 -0
- package/dist/server/server/adapters/mysql-adapter.d.ts +65 -0
- package/dist/server/server/adapters/postgres-adapter.d.ts +55 -0
- package/dist/server/server/adapters/singlestore-adapter.d.ts +4 -0
- package/dist/server/server/adapters/snowflake-adapter.d.ts +53 -0
- package/dist/server/server/adapters/sqlite-adapter.d.ts +120 -0
- package/dist/server/server/adapters/window-function-builder.d.ts +11 -0
- package/dist/server/server/agent/chart-validation.d.ts +22 -0
- package/dist/server/server/agent/handler-steps.d.ts +37 -0
- package/dist/server/server/agent/handler.d.ts +25 -0
- package/dist/server/server/agent/index.d.ts +11 -0
- package/dist/server/server/agent/providers/anthropic.d.ts +24 -0
- package/dist/server/server/agent/providers/factory.d.ts +12 -0
- package/dist/server/server/agent/providers/google.d.ts +23 -0
- package/dist/server/server/agent/providers/index.d.ts +6 -0
- package/dist/server/server/agent/providers/openai.d.ts +26 -0
- package/dist/server/server/agent/providers/types.d.ts +95 -0
- package/dist/server/server/agent/system-prompt.d.ts +5 -0
- package/dist/server/server/agent/tools.d.ts +28 -0
- package/dist/server/server/agent/types.d.ts +192 -0
- package/dist/server/server/ai/discovery-helpers.d.ts +29 -0
- package/dist/server/server/ai/discovery.d.ts +66 -0
- package/dist/server/server/ai/index.d.ts +10 -0
- package/dist/server/server/ai/mcp-prompts.d.ts +83 -0
- package/dist/server/server/ai/query-schema.d.ts +258 -0
- package/dist/server/server/ai/schemas.d.ts +63 -0
- package/dist/server/server/ai/suggestion-helpers.d.ts +33 -0
- package/dist/server/server/ai/suggestion.d.ts +16 -0
- package/dist/server/server/ai/validation-helpers.d.ts +21 -0
- package/dist/server/server/ai/validation.d.ts +31 -0
- package/dist/server/server/builders/analysis-utils.d.ts +106 -0
- package/dist/server/server/builders/comparison-query-builder.d.ts +70 -0
- package/dist/server/server/builders/cte-builder.d.ts +108 -0
- package/dist/server/server/builders/date-time-builder.d.ts +34 -0
- package/dist/server/server/builders/date-time-helpers.d.ts +34 -0
- package/dist/server/server/builders/filter-builder.d.ts +25 -0
- package/dist/server/server/builders/filter-operators.d.ts +23 -0
- package/dist/server/server/builders/flow-query-builder.d.ts +136 -0
- package/dist/server/server/builders/funnel-query-builder.d.ts +145 -0
- package/dist/server/server/builders/group-by-builder.d.ts +38 -0
- package/dist/server/server/builders/index.d.ts +13 -0
- package/dist/server/server/builders/measure-builder.d.ts +185 -0
- package/dist/server/server/builders/retention-query-builder.d.ts +98 -0
- package/dist/server/server/cache-providers/index.d.ts +5 -0
- package/dist/server/server/cache-providers/memory.d.ts +105 -0
- package/dist/server/server/cache-utils.d.ts +85 -0
- package/dist/server/server/compiler-metadata.d.ts +11 -0
- package/dist/server/server/compiler.d.ts +212 -0
- package/dist/server/server/cube-utils.d.ts +158 -0
- package/dist/server/server/database-utils.d.ts +18 -0
- package/dist/server/server/execution/annotation-builder.d.ts +12 -0
- package/dist/server/server/execution/filter-cache-preloader.d.ts +19 -0
- package/dist/server/server/execution/mode-router.d.ts +25 -0
- package/dist/server/server/execution/query-result-cache.d.ts +21 -0
- package/dist/server/server/execution/result-post-processor.d.ts +10 -0
- package/dist/server/server/executor.d.ts +186 -0
- package/dist/server/server/executors/base-executor.d.ts +16 -0
- package/dist/server/server/executors/databend-executor.d.ts +33 -0
- package/dist/server/server/executors/duckdb-executor.d.ts +33 -0
- package/dist/server/server/executors/explain-utils.d.ts +28 -0
- package/dist/server/server/executors/index.d.ts +21 -0
- package/dist/server/server/executors/mysql-executor.d.ts +27 -0
- package/dist/server/server/executors/postgres-executor.d.ts +27 -0
- package/dist/server/server/executors/singlestore-executor.d.ts +9 -0
- package/dist/server/server/executors/snowflake-executor.d.ts +33 -0
- package/dist/server/server/executors/sqlite-executor.d.ts +28 -0
- package/dist/server/server/explain/databend-parser.d.ts +16 -0
- package/dist/server/server/explain/duckdb-parser.d.ts +28 -0
- package/dist/server/server/explain/explain-tree.d.ts +20 -0
- package/dist/server/server/explain/index.d.ts +9 -0
- package/dist/server/server/explain/mysql-parser.d.ts +38 -0
- package/dist/server/server/explain/postgres-parser.d.ts +18 -0
- package/dist/server/server/explain/snowflake-parser.d.ts +17 -0
- package/dist/server/server/explain/sqlite-parser.d.ts +23 -0
- package/dist/server/server/filter-cache.d.ts +73 -0
- package/dist/server/server/gap-filler.d.ts +48 -0
- package/dist/server/server/index.d.ts +38 -0
- package/dist/server/server/logical-plan/cte-planner-helpers.d.ts +37 -0
- package/dist/server/server/logical-plan/cte-planner.d.ts +104 -0
- package/dist/server/server/logical-plan/filter-propagation.d.ts +44 -0
- package/dist/server/server/logical-plan/index.d.ts +19 -0
- package/dist/server/server/logical-plan/join-planner.d.ts +27 -0
- package/dist/server/server/logical-plan/logical-plan-builder.d.ts +58 -0
- package/dist/server/server/logical-plan/logical-planner.d.ts +39 -0
- package/dist/server/server/logical-plan/optimiser.d.ts +34 -0
- package/dist/server/server/logical-plan/plan-analysis-reporter.d.ts +59 -0
- package/dist/server/server/logical-plan/planner-utils.d.ts +20 -0
- package/dist/server/server/logical-plan/types.d.ts +199 -0
- package/dist/server/server/measure-classification.d.ts +40 -0
- package/dist/server/server/physical-plan/drizzle-plan-builder.d.ts +50 -0
- package/dist/server/server/physical-plan/drizzle-sql-builder.d.ts +118 -0
- package/dist/server/server/physical-plan/index.d.ts +2 -0
- package/dist/server/server/physical-plan/processors/cte-processor.d.ts +6 -0
- package/dist/server/server/physical-plan/processors/index.d.ts +8 -0
- package/dist/server/server/physical-plan/processors/joins-processor.d.ts +6 -0
- package/dist/server/server/physical-plan/processors/keys-dedup-processor.d.ts +13 -0
- package/dist/server/server/physical-plan/processors/multi-fact-processor.d.ts +13 -0
- package/dist/server/server/physical-plan/processors/predicates-processor.d.ts +6 -0
- package/dist/server/server/physical-plan/processors/selection-processor.d.ts +6 -0
- package/dist/server/server/physical-plan/processors/shared.d.ts +38 -0
- package/dist/server/server/physical-plan/processors/window-processor.d.ts +6 -0
- package/dist/server/server/prompts/explain-analysis-prompt.d.ts +47 -0
- package/dist/server/server/prompts/index.d.ts +27 -0
- package/dist/server/server/prompts/single-step-prompt.d.ts +31 -0
- package/dist/server/server/prompts/step0-validation-prompt.d.ts +39 -0
- package/dist/server/server/prompts/step1-shape-prompt.d.ts +29 -0
- package/dist/server/server/prompts/step2-complete-prompt.d.ts +19 -0
- package/dist/server/server/prompts/types.d.ts +37 -0
- package/dist/server/server/query-handlers.d.ts +79 -0
- package/dist/server/server/query-modes.d.ts +28 -0
- package/dist/server/server/query-validator.d.ts +9 -0
- package/dist/server/server/resolvers/calculated-measure-resolver.d.ts +98 -0
- package/dist/server/server/resolvers/index.d.ts +6 -0
- package/dist/server/server/resolvers/join-path-resolver.d.ts +158 -0
- package/dist/server/server/sql-format.d.ts +11 -0
- package/dist/server/server/template-substitution.d.ts +57 -0
- package/dist/server/server/types/analysis.d.ts +189 -0
- package/dist/server/server/types/cache.d.ts +132 -0
- package/dist/server/server/types/core.d.ts +164 -0
- package/dist/server/server/types/cube.d.ts +544 -0
- package/dist/server/server/types/executor.d.ts +156 -0
- package/dist/server/server/types/flow.d.ts +144 -0
- package/dist/server/server/types/funnel.d.ts +118 -0
- package/dist/server/server/types/index.d.ts +11 -0
- package/dist/server/server/types/metadata.d.ts +113 -0
- package/dist/server/server/types/query.d.ts +153 -0
- package/dist/server/server/types/retention.d.ts +141 -0
- package/dist/server/server/types/utils.d.ts +11 -0
- package/dist/server/server/types/validation.d.ts +14 -0
- package/package.json +15 -8
- package/dist/adapters/google-DUlXeeDA.cjs +0 -2
- package/dist/adapters/handler-C63rJUUK.cjs +0 -25
- package/dist/adapters/locale-CTNwPVZI.cjs +0 -198
- package/dist/adapters/locale-gU_d1Wja.js +0 -8249
- package/dist/adapters/mcp-transport-C4J4SAcn.cjs +0 -40
- package/dist/adapters/mcp-transport-CVUiifEc.js +0 -579
- package/dist/adapters/openai-6wrBvAnv.cjs +0 -1
- package/dist/adapters/openai-BDwb2u7y.cjs +0 -17
- package/dist/adapters/utils-CkEkU8Bo.cjs +0 -128
- package/dist/client/chunks/DashboardEditModal-6KRE36mm.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-x576-O5p.js.map +0 -1
- package/dist/client/chunks/analysis-builder-zd48FVJO.js +0 -5367
- package/dist/client/chunks/analysis-builder-zd48FVJO.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-CiHrLH6Y.js.map +0 -1
- package/dist/client/chunks/chart-area-CXFK-Grv.js +0 -450
- package/dist/client/chunks/chart-area-CXFK-Grv.js.map +0 -1
- package/dist/client/chunks/chart-bar-DKXfLoGG.js +0 -271
- package/dist/client/chunks/chart-bar-DKXfLoGG.js.map +0 -1
- package/dist/client/chunks/chart-bubble-DGkTQlxM.js +0 -273
- package/dist/client/chunks/chart-bubble-DGkTQlxM.js.map +0 -1
- package/dist/client/chunks/chart-config-area-Bq_UsW3x.js +0 -101
- package/dist/client/chunks/chart-config-area-Bq_UsW3x.js.map +0 -1
- package/dist/client/chunks/chart-config-bar-_JEGZnAu.js +0 -95
- package/dist/client/chunks/chart-config-bar-_JEGZnAu.js.map +0 -1
- package/dist/client/chunks/chart-config-box-plot-DJ-dWWXA.js.map +0 -1
- package/dist/client/chunks/chart-config-gauge-DSwC04l0.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-delta-D6BIkHL3.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-number-Bx-V9a62.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-text-CcqC1u-8.js.map +0 -1
- package/dist/client/chunks/chart-config-line-Db3jDsWc.js.map +0 -1
- package/dist/client/chunks/chart-config-pie-DD4SmRTF.js.map +0 -1
- package/dist/client/chunks/chart-config-radar-CC2XAaGr.js.map +0 -1
- package/dist/client/chunks/chart-config-radial-bar-DmxKx1R0.js.map +0 -1
- package/dist/client/chunks/chart-config-tree-map-BI-oQStO.js.map +0 -1
- package/dist/client/chunks/chart-config-waterfall-DSnyixbI.js.map +0 -1
- package/dist/client/chunks/chart-data-table-Cm5jrpaw.js.map +0 -1
- package/dist/client/chunks/chart-funnel-Eke8IPtG.js.map +0 -1
- package/dist/client/chunks/chart-gauge-DeRZNsyl.js +0 -424
- package/dist/client/chunks/chart-gauge-DeRZNsyl.js.map +0 -1
- package/dist/client/chunks/chart-heat-map-C86thSJ4.js +0 -231
- package/dist/client/chunks/chart-heat-map-C86thSJ4.js.map +0 -1
- package/dist/client/chunks/chart-kpi-delta-CxOYD2f1.js +0 -343
- package/dist/client/chunks/chart-kpi-delta-CxOYD2f1.js.map +0 -1
- package/dist/client/chunks/chart-kpi-number-C6gWz-x4.js +0 -322
- package/dist/client/chunks/chart-kpi-number-C6gWz-x4.js.map +0 -1
- package/dist/client/chunks/chart-kpi-text-dDONrhS-.js +0 -149
- package/dist/client/chunks/chart-kpi-text-dDONrhS-.js.map +0 -1
- package/dist/client/chunks/chart-line-r4iWevKZ.js +0 -433
- package/dist/client/chunks/chart-line-r4iWevKZ.js.map +0 -1
- package/dist/client/chunks/chart-markdown-BPW-EAm9.js.map +0 -1
- package/dist/client/chunks/chart-pie-yqH2YVEI.js +0 -172
- package/dist/client/chunks/chart-pie-yqH2YVEI.js.map +0 -1
- package/dist/client/chunks/chart-radar-B-_3v-rE.js +0 -154
- package/dist/client/chunks/chart-radar-B-_3v-rE.js.map +0 -1
- package/dist/client/chunks/chart-radial-bar-C0EgzfAF.js +0 -148
- package/dist/client/chunks/chart-radial-bar-C0EgzfAF.js.map +0 -1
- package/dist/client/chunks/chart-scatter-DZPirzwX.js +0 -255
- package/dist/client/chunks/chart-scatter-DZPirzwX.js.map +0 -1
- package/dist/client/chunks/chart-tree-map-Bi4axCvh.js +0 -298
- package/dist/client/chunks/chart-tree-map-Bi4axCvh.js.map +0 -1
- package/dist/client/chunks/useDirtyStateTracking-B5wCDJSj.js.map +0 -1
- package/dist/server/google-DUlXeeDA.cjs +0 -2
- package/dist/server/openai-6wrBvAnv.cjs +0 -1
- package/dist/server/openai-BDwb2u7y.cjs +0 -17
- /package/dist/adapters/{express → adapters/express}/index.d.ts +0 -0
- /package/dist/adapters/{fastify → adapters/fastify}/index.d.ts +0 -0
- /package/dist/adapters/{hono → adapters/hono}/index.d.ts +0 -0
- /package/dist/adapters/{locale.d.ts → adapters/locale.d.ts} +0 -0
- /package/dist/adapters/{mcp-tools.d.ts → adapters/mcp-tools.d.ts} +0 -0
- /package/dist/adapters/{mcp-transport.d.ts → adapters/mcp-transport.d.ts} +0 -0
- /package/dist/adapters/{nextjs → adapters/nextjs}/index.d.ts +0 -0
- /package/dist/adapters/{types.d.ts → adapters/types.d.ts} +0 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { SQL, AnyColumn, Table, Subquery, View } from 'drizzle-orm';
|
|
2
|
+
import { SecurityContext, DrizzleDatabase, QueryResult, MeasureType, DimensionType, TimeGranularity } from './core';
|
|
3
|
+
import { SemanticQuery } from './query';
|
|
4
|
+
/**
|
|
5
|
+
* Filter SQL cache used for parameter deduplication across CTEs and the main
|
|
6
|
+
* query. Defined here (rather than imported from the runtime filter-cache
|
|
7
|
+
* module) so the types package has no dependency on runtime modules.
|
|
8
|
+
* Implemented by `FilterCacheManager`.
|
|
9
|
+
*/
|
|
10
|
+
export interface FilterCache {
|
|
11
|
+
getOrBuild(key: string, builder: () => SQL | null): SQL | null;
|
|
12
|
+
has(key: string): boolean;
|
|
13
|
+
get(key: string): SQL | undefined;
|
|
14
|
+
preload(entries: Array<{
|
|
15
|
+
key: string;
|
|
16
|
+
sql: SQL;
|
|
17
|
+
}>): void;
|
|
18
|
+
set(key: string, sql: SQL): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Any queryable relation that can be used in FROM/JOIN clauses
|
|
23
|
+
* Supports tables, views, subqueries, and raw SQL expressions
|
|
24
|
+
*/
|
|
25
|
+
export type QueryableRelation = Table | View | Subquery | SQL;
|
|
26
|
+
/**
|
|
27
|
+
* Base query definition that can be extended dynamically
|
|
28
|
+
* Returns just the FROM/JOIN/WHERE setup, not a complete SELECT
|
|
29
|
+
*/
|
|
30
|
+
export interface BaseQueryDefinition {
|
|
31
|
+
/** Main table to query from */
|
|
32
|
+
from: QueryableRelation;
|
|
33
|
+
/** Optional joins to other tables */
|
|
34
|
+
joins?: Array<{
|
|
35
|
+
table: QueryableRelation;
|
|
36
|
+
on: SQL;
|
|
37
|
+
type?: 'left' | 'right' | 'inner' | 'full';
|
|
38
|
+
}>;
|
|
39
|
+
/** Base WHERE conditions (typically security context filtering) */
|
|
40
|
+
where?: SQL;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Query context passed to cube SQL functions
|
|
44
|
+
* Provides access to database, schema, and security context
|
|
45
|
+
*/
|
|
46
|
+
export interface QueryContext {
|
|
47
|
+
/** Drizzle database instance */
|
|
48
|
+
db: DrizzleDatabase;
|
|
49
|
+
/** Database schema (tables, columns, etc.) */
|
|
50
|
+
schema?: any;
|
|
51
|
+
/** Security context for filtering */
|
|
52
|
+
securityContext: SecurityContext;
|
|
53
|
+
/** The semantic query being executed */
|
|
54
|
+
query?: SemanticQuery;
|
|
55
|
+
/** The compiled cube being queried */
|
|
56
|
+
cube?: Cube;
|
|
57
|
+
/**
|
|
58
|
+
* Filter cache for parameter deduplication across CTEs
|
|
59
|
+
* Created at query start and used throughout query building
|
|
60
|
+
*/
|
|
61
|
+
filterCache?: FilterCache;
|
|
62
|
+
/**
|
|
63
|
+
* When true, measures should be rendered as raw column expressions
|
|
64
|
+
* without aggregation wrappers. Set from SemanticQuery.ungrouped.
|
|
65
|
+
*/
|
|
66
|
+
ungrouped?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Multi-cube query context for cross-cube operations
|
|
70
|
+
*/
|
|
71
|
+
export interface MultiCubeQueryContext extends QueryContext {
|
|
72
|
+
/** Available cubes for cross-cube operations */
|
|
73
|
+
cubes: Map<string, Cube>;
|
|
74
|
+
/** Current cube being processed */
|
|
75
|
+
currentCube: Cube;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Hierarchy definition for grouped drill-down paths
|
|
79
|
+
* Groups dimensions into ordered levels for structured navigation
|
|
80
|
+
*/
|
|
81
|
+
export interface Hierarchy {
|
|
82
|
+
/** Unique identifier for the hierarchy */
|
|
83
|
+
name: string;
|
|
84
|
+
/** Display title for the hierarchy */
|
|
85
|
+
title?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Dimension names in order from least to most granular
|
|
88
|
+
* @example ['country', 'region', 'city'] for geographic hierarchy
|
|
89
|
+
* @example ['category', 'subcategory', 'product'] for product hierarchy
|
|
90
|
+
*/
|
|
91
|
+
levels: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Cube definition focused on Drizzle query building
|
|
95
|
+
*/
|
|
96
|
+
export interface Cube {
|
|
97
|
+
name: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Example questions that can be answered using this cube
|
|
102
|
+
* Used by AI agents to understand cube capabilities
|
|
103
|
+
* @example ['What was total revenue last month?', 'Show me sales by category']
|
|
104
|
+
*/
|
|
105
|
+
exampleQuestions?: string[];
|
|
106
|
+
/**
|
|
107
|
+
* Base query setup - returns the foundation that can be extended
|
|
108
|
+
* Should return FROM/JOIN/WHERE setup, NOT a complete SELECT
|
|
109
|
+
*/
|
|
110
|
+
sql: (ctx: QueryContext) => BaseQueryDefinition;
|
|
111
|
+
/** Cube dimensions using direct column references */
|
|
112
|
+
dimensions: Record<string, Dimension>;
|
|
113
|
+
/** Cube measures using direct column references */
|
|
114
|
+
measures: Record<string, Measure>;
|
|
115
|
+
/** Optional joins to other cubes for multi-cube queries */
|
|
116
|
+
joins?: Record<string, CubeJoin>;
|
|
117
|
+
/**
|
|
118
|
+
* Hierarchies for structured drill-down paths
|
|
119
|
+
* Groups dimensions into levels for navigation (e.g., country -> region -> city)
|
|
120
|
+
* A dimension can appear in multiple hierarchies
|
|
121
|
+
*/
|
|
122
|
+
hierarchies?: Record<string, Hierarchy>;
|
|
123
|
+
/** Whether cube is publicly accessible */
|
|
124
|
+
public?: boolean;
|
|
125
|
+
/** SQL alias for the cube */
|
|
126
|
+
sqlAlias?: string;
|
|
127
|
+
/** Data source identifier */
|
|
128
|
+
dataSource?: string;
|
|
129
|
+
/** Additional metadata */
|
|
130
|
+
meta?: Record<string, any>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Dimension definition
|
|
134
|
+
*/
|
|
135
|
+
export interface Dimension {
|
|
136
|
+
name: string;
|
|
137
|
+
title?: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Alternative names for this dimension
|
|
141
|
+
* Used by AI agents for natural language matching
|
|
142
|
+
* @example ['date', 'day', 'timestamp'] for a createdAt dimension
|
|
143
|
+
*/
|
|
144
|
+
synonyms?: string[];
|
|
145
|
+
type: DimensionType;
|
|
146
|
+
/** Direct column reference or SQL expression */
|
|
147
|
+
sql: AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL);
|
|
148
|
+
/** Whether this is a primary key */
|
|
149
|
+
primaryKey?: boolean;
|
|
150
|
+
/** Whether to show in UI */
|
|
151
|
+
shown?: boolean;
|
|
152
|
+
/** Display format */
|
|
153
|
+
format?: string;
|
|
154
|
+
/** Additional metadata */
|
|
155
|
+
meta?: Record<string, any>;
|
|
156
|
+
/**
|
|
157
|
+
* Supported granularities for time dimensions
|
|
158
|
+
* If not specified for time dimensions, defaults to ['year', 'quarter', 'month', 'week', 'day']
|
|
159
|
+
* Only applies when type is 'time'
|
|
160
|
+
* @example ['year', 'quarter', 'month', 'day'] for a custom subset
|
|
161
|
+
*/
|
|
162
|
+
granularities?: TimeGranularity[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Measure definition
|
|
166
|
+
*/
|
|
167
|
+
export interface Measure {
|
|
168
|
+
name: string;
|
|
169
|
+
title?: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Alternative names for this measure
|
|
173
|
+
* Used by AI agents for natural language matching
|
|
174
|
+
* @example ['revenue', 'sales', 'income'] for a totalRevenue measure
|
|
175
|
+
*/
|
|
176
|
+
synonyms?: string[];
|
|
177
|
+
type: MeasureType;
|
|
178
|
+
/**
|
|
179
|
+
* Column to aggregate or SQL expression
|
|
180
|
+
* Optional for calculated measures (type: 'calculated') which use calculatedSql instead
|
|
181
|
+
*/
|
|
182
|
+
sql?: AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL);
|
|
183
|
+
/** Display format */
|
|
184
|
+
format?: string;
|
|
185
|
+
/** Whether to show in UI */
|
|
186
|
+
shown?: boolean;
|
|
187
|
+
/** Filters applied to this measure */
|
|
188
|
+
filters?: Array<(ctx: QueryContext) => SQL>;
|
|
189
|
+
/** Rolling window configuration */
|
|
190
|
+
rollingWindow?: {
|
|
191
|
+
trailing?: string;
|
|
192
|
+
leading?: string;
|
|
193
|
+
offset?: string;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Calculated measure template with {member} references
|
|
197
|
+
* Only used when type === 'calculated'
|
|
198
|
+
* Example: "1.0 * {completed} / NULLIF({total}, 0)"
|
|
199
|
+
*/
|
|
200
|
+
calculatedSql?: string;
|
|
201
|
+
/**
|
|
202
|
+
* List of measure dependencies for calculated measures
|
|
203
|
+
* Auto-detected from calculatedSql if not provided
|
|
204
|
+
* Example: ['completed', 'total']
|
|
205
|
+
*/
|
|
206
|
+
dependencies?: string[];
|
|
207
|
+
/** Additional metadata */
|
|
208
|
+
meta?: Record<string, any>;
|
|
209
|
+
/**
|
|
210
|
+
* Dimension names shown when drilling into this measure
|
|
211
|
+
* Can include cross-cube dimensions via joins (e.g., 'Products.name', 'Users.email')
|
|
212
|
+
* If not specified, drilling is disabled for this measure
|
|
213
|
+
* @example ['id', 'status', 'createdAt'] for same-cube dimensions
|
|
214
|
+
* @example ['Orders.id', 'Products.name', 'Users.city'] for cross-cube dimensions
|
|
215
|
+
*/
|
|
216
|
+
drillMembers?: string[];
|
|
217
|
+
/**
|
|
218
|
+
* Statistical function configuration
|
|
219
|
+
* Used for percentile, stddev, variance measure types
|
|
220
|
+
*/
|
|
221
|
+
statisticalConfig?: {
|
|
222
|
+
/** Percentile value (0-100) for percentile measures. Default: 50 for median */
|
|
223
|
+
percentile?: number;
|
|
224
|
+
/** Use sample vs population calculation for stddev/variance. Default: false (population) */
|
|
225
|
+
useSample?: boolean;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Window function configuration
|
|
229
|
+
* Used for lag, lead, rank, movingAvg, and other window function measure types
|
|
230
|
+
*
|
|
231
|
+
* Post-aggregation window functions:
|
|
232
|
+
* When `measure` is specified, the window function operates on AGGREGATED data.
|
|
233
|
+
* The base measure is first aggregated (grouped by query dimensions), then the
|
|
234
|
+
* window function is applied to the aggregated results.
|
|
235
|
+
*
|
|
236
|
+
* Example: Month-over-month revenue change
|
|
237
|
+
* ```typescript
|
|
238
|
+
* revenueChange: {
|
|
239
|
+
* type: 'lag',
|
|
240
|
+
* windowConfig: {
|
|
241
|
+
* measure: 'totalRevenue', // Reference to aggregate measure
|
|
242
|
+
* operation: 'difference', // current - previous
|
|
243
|
+
* orderBy: [{ field: 'date', direction: 'asc' }]
|
|
244
|
+
* }
|
|
245
|
+
* }
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
windowConfig?: {
|
|
249
|
+
/**
|
|
250
|
+
* Reference to the measure this window function operates on.
|
|
251
|
+
* The referenced measure will be aggregated first, then the window function applied.
|
|
252
|
+
* Can be a simple name ('totalRevenue') or fully qualified ('Sales.totalRevenue').
|
|
253
|
+
*/
|
|
254
|
+
measure?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Operation to perform after getting the window result:
|
|
257
|
+
* - 'raw': Return the window function result directly (default for rank, rowNumber, ntile)
|
|
258
|
+
* - 'difference': Subtract window result from current value (current - window)
|
|
259
|
+
* - 'ratio': Divide current value by window result (current / window)
|
|
260
|
+
* - 'percentChange': Calculate percentage change ((current - window) / window * 100)
|
|
261
|
+
*
|
|
262
|
+
* Default: 'difference' for lag/lead, 'raw' for rank/rowNumber/ntile/firstValue/lastValue
|
|
263
|
+
*/
|
|
264
|
+
operation?: 'raw' | 'difference' | 'ratio' | 'percentChange';
|
|
265
|
+
/** Dimension references to partition by (e.g., ['employeeId']) */
|
|
266
|
+
partitionBy?: string[];
|
|
267
|
+
/** Columns to order by with direction */
|
|
268
|
+
orderBy?: Array<{
|
|
269
|
+
field: string;
|
|
270
|
+
direction: 'asc' | 'desc';
|
|
271
|
+
}>;
|
|
272
|
+
/** Number of rows to offset for lag/lead. Default: 1 */
|
|
273
|
+
offset?: number;
|
|
274
|
+
/** Default value when offset is out of bounds for lag/lead */
|
|
275
|
+
defaultValue?: any;
|
|
276
|
+
/** Number of buckets for ntile. Default: 4 */
|
|
277
|
+
nTile?: number;
|
|
278
|
+
/** Window frame specification for moving aggregates */
|
|
279
|
+
frame?: {
|
|
280
|
+
type: 'rows' | 'range';
|
|
281
|
+
start: number | 'unbounded';
|
|
282
|
+
end: number | 'current' | 'unbounded';
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Relationship types supported by cube joins
|
|
288
|
+
*/
|
|
289
|
+
export type CubeRelationship = 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
|
|
290
|
+
/**
|
|
291
|
+
* Type-safe cube join definition with lazy loading support
|
|
292
|
+
*/
|
|
293
|
+
export interface CubeJoin {
|
|
294
|
+
/** Target cube reference - lazy loaded to avoid circular dependencies, or string name resolved from registry */
|
|
295
|
+
targetCube: Cube | (() => Cube) | string;
|
|
296
|
+
/** Semantic relationship - determines join behavior */
|
|
297
|
+
relationship: CubeRelationship;
|
|
298
|
+
/** Array of join conditions - supports multi-column joins */
|
|
299
|
+
on: Array<{
|
|
300
|
+
/** Column from source cube */
|
|
301
|
+
source: AnyColumn;
|
|
302
|
+
/** Column from target cube */
|
|
303
|
+
target: AnyColumn;
|
|
304
|
+
/** Comparison operator - defaults to eq */
|
|
305
|
+
as?: (source: AnyColumn, target: AnyColumn) => SQL;
|
|
306
|
+
}>;
|
|
307
|
+
/** Override default SQL join type (derived from relationship) */
|
|
308
|
+
sqlJoinType?: 'inner' | 'left' | 'right' | 'full';
|
|
309
|
+
/**
|
|
310
|
+
* Preferred path targets - marks this join as the canonical route to reach specific cubes.
|
|
311
|
+
* When multiple paths exist to a target cube, paths using preferred joins are prioritized.
|
|
312
|
+
*
|
|
313
|
+
* Example: EmployeeTeams join with `preferredFor: ['Teams']` ensures employee-team
|
|
314
|
+
* queries use the junction table path rather than going through Departments.
|
|
315
|
+
*/
|
|
316
|
+
preferredFor?: string[];
|
|
317
|
+
/**
|
|
318
|
+
* Many-to-many relationship configuration through a junction table
|
|
319
|
+
* Only used when relationship is 'belongsToMany'
|
|
320
|
+
*/
|
|
321
|
+
through?: {
|
|
322
|
+
/** Junction/join table (Drizzle table reference) */
|
|
323
|
+
table: Table;
|
|
324
|
+
/** Join conditions from source cube to junction table */
|
|
325
|
+
sourceKey: Array<{
|
|
326
|
+
source: AnyColumn;
|
|
327
|
+
target: AnyColumn;
|
|
328
|
+
as?: (source: AnyColumn, target: AnyColumn) => SQL;
|
|
329
|
+
}>;
|
|
330
|
+
/** Join conditions from junction table to target cube */
|
|
331
|
+
targetKey: Array<{
|
|
332
|
+
source: AnyColumn;
|
|
333
|
+
target: AnyColumn;
|
|
334
|
+
as?: (source: AnyColumn, target: AnyColumn) => SQL;
|
|
335
|
+
}>;
|
|
336
|
+
/** Optional security context SQL for junction table */
|
|
337
|
+
securitySql?: (securityContext: SecurityContext) => SQL | SQL[];
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Compiled cube with execution function
|
|
342
|
+
*/
|
|
343
|
+
export interface CompiledCube extends Cube {
|
|
344
|
+
/** Execute a query against this cube */
|
|
345
|
+
queryFn: (query: SemanticQuery, securityContext: SecurityContext) => Promise<QueryResult>;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Join key information for CTE joins
|
|
349
|
+
* Describes how a CTE should be joined to the main query
|
|
350
|
+
*/
|
|
351
|
+
export interface JoinKeyInfo {
|
|
352
|
+
/** Column name in the source table */
|
|
353
|
+
sourceColumn: string;
|
|
354
|
+
/** Column name in the target table (CTE) */
|
|
355
|
+
targetColumn: string;
|
|
356
|
+
/** Optional Drizzle column object for source */
|
|
357
|
+
sourceColumnObj?: AnyColumn;
|
|
358
|
+
/** Optional Drizzle column object for target */
|
|
359
|
+
targetColumnObj?: AnyColumn;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Single join key pair for composite key support
|
|
363
|
+
*/
|
|
364
|
+
export interface JoinKeyPair {
|
|
365
|
+
/** Primary key column on source cube */
|
|
366
|
+
source: AnyColumn;
|
|
367
|
+
/** Foreign key column on target cube (CTE cube) */
|
|
368
|
+
target: AnyColumn;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Propagating filter information for cross-cube filter propagation
|
|
372
|
+
* When cube A has filters and cube B (with hasMany from A) needs a CTE,
|
|
373
|
+
* A's filters should propagate into B's CTE via a subquery
|
|
374
|
+
*/
|
|
375
|
+
export interface PropagatingFilter {
|
|
376
|
+
/** The source cube whose filters need to propagate */
|
|
377
|
+
sourceCube: Cube;
|
|
378
|
+
/** Filters from the source cube to apply */
|
|
379
|
+
filters: import('./query').Filter[];
|
|
380
|
+
/** Join conditions linking source cube PK(s) to target cube FK(s) - supports composite keys */
|
|
381
|
+
joinConditions: JoinKeyPair[];
|
|
382
|
+
/** Pre-built filter SQL for parameter deduplication (optional, built during query planning) */
|
|
383
|
+
preBuiltFilterSQL?: SQL;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Intermediate join information for multi-hop CTE paths
|
|
387
|
+
* When a CTE cube joins to primary through intermediate tables that have hasMany,
|
|
388
|
+
* these intermediate tables are absorbed into the CTE to prevent fan-out.
|
|
389
|
+
*/
|
|
390
|
+
export interface IntermediateJoinInfo {
|
|
391
|
+
/** The intermediate cube that's being absorbed into the CTE */
|
|
392
|
+
cube: Cube;
|
|
393
|
+
/** The join definition from the intermediate cube to this CTE cube */
|
|
394
|
+
joinDef: CubeJoin;
|
|
395
|
+
/** The column on the intermediate table that connects to the primary cube */
|
|
396
|
+
primaryJoinColumn: AnyColumn;
|
|
397
|
+
/** The column on the intermediate table that connects to the CTE cube */
|
|
398
|
+
cteJoinColumn: AnyColumn;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Pre-aggregation CTE information
|
|
402
|
+
* Describes a Common Table Expression used for pre-aggregating hasMany relationships
|
|
403
|
+
*/
|
|
404
|
+
export interface PreAggregationCTEInfo {
|
|
405
|
+
/** The cube being pre-aggregated */
|
|
406
|
+
cube: Cube;
|
|
407
|
+
/** Table alias for this cube in the main query */
|
|
408
|
+
alias: string;
|
|
409
|
+
/** CTE alias (WITH clause name) */
|
|
410
|
+
cteAlias: string;
|
|
411
|
+
/** Join keys to connect CTE back to main query (e.g., employee_id for Employees → EmployeeTeams) */
|
|
412
|
+
joinKeys: JoinKeyInfo[];
|
|
413
|
+
/** List of measure names included in this CTE (aggregate measures + window base measures) */
|
|
414
|
+
measures: string[];
|
|
415
|
+
/** Propagating filters from related cubes (for cross-cube filter propagation) */
|
|
416
|
+
propagatingFilters?: PropagatingFilter[];
|
|
417
|
+
/**
|
|
418
|
+
* Downstream join keys for cubes that need to be joined through this CTE.
|
|
419
|
+
* When a query has dimensions from a cube (e.g., Teams) that should be joined
|
|
420
|
+
* through this CTE cube (e.g., EmployeeTeams), we include those join keys here
|
|
421
|
+
* so the CTE includes them in SELECT and GROUP BY, allowing downstream joins.
|
|
422
|
+
*/
|
|
423
|
+
downstreamJoinKeys?: DownstreamJoinKeyInfo[];
|
|
424
|
+
/**
|
|
425
|
+
* Intermediate joins that need to be absorbed into this CTE.
|
|
426
|
+
* When the path from primary cube to CTE cube goes through intermediate tables
|
|
427
|
+
* with hasMany relationships, those joins are included IN the CTE rather than
|
|
428
|
+
* in the main query to prevent fan-out.
|
|
429
|
+
*
|
|
430
|
+
* Example: Departments → Employees → EmployeeTeams
|
|
431
|
+
* - Primary: Departments
|
|
432
|
+
* - CTE: EmployeeTeams
|
|
433
|
+
* - Intermediate: Employees (has hasMany to EmployeeTeams)
|
|
434
|
+
*
|
|
435
|
+
* The CTE will JOIN to employees and GROUP BY employees.department_id,
|
|
436
|
+
* then join directly to Departments.
|
|
437
|
+
*/
|
|
438
|
+
intermediateJoins?: IntermediateJoinInfo[];
|
|
439
|
+
/**
|
|
440
|
+
* Type of CTE:
|
|
441
|
+
* - 'aggregate': Standard CTE with GROUP BY for count/sum/avg measures
|
|
442
|
+
*
|
|
443
|
+
* Note: Window function CTEs are no longer used. Post-aggregation window
|
|
444
|
+
* functions (lag, lead, rank, etc.) operate on aggregated data and are
|
|
445
|
+
* applied in the outer query SELECT clause, not in separate CTEs.
|
|
446
|
+
*/
|
|
447
|
+
cteType?: 'aggregate';
|
|
448
|
+
/**
|
|
449
|
+
* Reason for creating this CTE:
|
|
450
|
+
* - 'hasMany': Direct hasMany relationship target - requires SUM in outer query
|
|
451
|
+
* - 'fanOutPrevention': Cube affected by hasMany elsewhere - requires MAX in outer query
|
|
452
|
+
*
|
|
453
|
+
* This determines how the outer query aggregates CTE values:
|
|
454
|
+
* - hasMany CTEs have multiple rows per join key, so SUM combines them
|
|
455
|
+
* - fanOutPrevention CTEs have one row per key, but get duplicated by joins,
|
|
456
|
+
* so MAX retrieves the value without re-summing
|
|
457
|
+
*/
|
|
458
|
+
cteReason?: 'hasMany' | 'fanOutPrevention';
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Information about downstream join keys for CTE building.
|
|
462
|
+
* Used when a cube (e.g., Teams) needs to be joined through a CTE cube (e.g., EmployeeTeams)
|
|
463
|
+
*/
|
|
464
|
+
export interface DownstreamJoinKeyInfo {
|
|
465
|
+
/** The downstream cube name (e.g., 'Teams') */
|
|
466
|
+
targetCubeName: string;
|
|
467
|
+
/** Join keys from CTE cube to downstream cube */
|
|
468
|
+
joinKeys: JoinKeyInfo[];
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Planned join entry used by runtime physical builders.
|
|
472
|
+
*/
|
|
473
|
+
export interface JoinCubePlanEntry {
|
|
474
|
+
cube: Cube;
|
|
475
|
+
alias: string;
|
|
476
|
+
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
477
|
+
joinCondition: SQL;
|
|
478
|
+
/** Relationship type from the join definition that produced this entry */
|
|
479
|
+
relationship?: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
|
|
480
|
+
/** Junction table information for belongsToMany relationships */
|
|
481
|
+
junctionTable?: {
|
|
482
|
+
table: Table;
|
|
483
|
+
alias: string;
|
|
484
|
+
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
485
|
+
joinCondition: SQL;
|
|
486
|
+
/** Optional security SQL function to apply to junction table */
|
|
487
|
+
securitySql?: (securityContext: SecurityContext) => SQL | SQL[];
|
|
488
|
+
/** Source cube name for the belongsToMany relationship (needed for CTE rewriting) */
|
|
489
|
+
sourceCubeName?: string;
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Runtime physical-plan context used by query execution builders.
|
|
494
|
+
* This is the only runtime plan context consumed by SQL builders.
|
|
495
|
+
*/
|
|
496
|
+
export interface PhysicalQueryPlan {
|
|
497
|
+
/** Primary cube that drives the query */
|
|
498
|
+
primaryCube: Cube;
|
|
499
|
+
/** Additional cubes to join (empty for single-cube queries) */
|
|
500
|
+
joinCubes: JoinCubePlanEntry[];
|
|
501
|
+
/** Pre-aggregation CTEs for hasMany relationships to prevent fan-out */
|
|
502
|
+
preAggregationCTEs?: PreAggregationCTEInfo[];
|
|
503
|
+
/**
|
|
504
|
+
* Optional keys-based deduplication metadata.
|
|
505
|
+
* When present, physical builders may choose a keys+aggregate execution path.
|
|
506
|
+
*/
|
|
507
|
+
keysDeduplication?: {
|
|
508
|
+
multipliedCubeName: string;
|
|
509
|
+
primaryKeyDimensions: string[];
|
|
510
|
+
/** Measure names NOT from the multiplied cube (pre-aggregated in keys CTE) */
|
|
511
|
+
regularMeasures?: string[];
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Optional multi-fact merge metadata.
|
|
515
|
+
* When present, SQL builders execute independent grouped subqueries and
|
|
516
|
+
* merge them by shared dimension keys.
|
|
517
|
+
*/
|
|
518
|
+
multiFactMerge?: {
|
|
519
|
+
mergeStrategy: 'fullJoin' | 'leftJoin' | 'innerJoin';
|
|
520
|
+
sharedDimensions: string[];
|
|
521
|
+
groups: Array<{
|
|
522
|
+
alias: string;
|
|
523
|
+
query: SemanticQuery;
|
|
524
|
+
queryPlan: PhysicalQueryPlan;
|
|
525
|
+
measures: string[];
|
|
526
|
+
}>;
|
|
527
|
+
};
|
|
528
|
+
/** Warnings about potential query issues (e.g., fan-out without dimensions) */
|
|
529
|
+
warnings?: import('./core').QueryWarning[];
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Utility type for cube definition with schema inference
|
|
533
|
+
*/
|
|
534
|
+
export type CubeDefinition = Omit<Cube, 'name'> & {
|
|
535
|
+
name?: string;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Helper type for creating type-safe cubes
|
|
539
|
+
*/
|
|
540
|
+
export interface CubeDefiner {
|
|
541
|
+
<TName extends string>(name: TName, definition: CubeDefinition): Cube & {
|
|
542
|
+
name: TName;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase } from './core';
|
|
3
|
+
import { DatabaseAdapter } from '../adapters/base-adapter';
|
|
4
|
+
/**
|
|
5
|
+
* Database executor interface that wraps Drizzle ORM
|
|
6
|
+
* Provides type-safe SQL execution with engine-specific implementations
|
|
7
|
+
*/
|
|
8
|
+
export interface DatabaseExecutor {
|
|
9
|
+
/** The Drizzle database instance */
|
|
10
|
+
db: DrizzleDatabase;
|
|
11
|
+
/** Optional schema for type inference */
|
|
12
|
+
schema?: any;
|
|
13
|
+
/** Database adapter for SQL dialect-specific operations */
|
|
14
|
+
databaseAdapter: DatabaseAdapter;
|
|
15
|
+
/** Execute a Drizzle SQL query or query object */
|
|
16
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
17
|
+
/** Get the database engine type */
|
|
18
|
+
getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
19
|
+
/** Execute EXPLAIN on a SQL query to get the execution plan */
|
|
20
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
21
|
+
/** Get existing indexes for the specified tables */
|
|
22
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options for EXPLAIN query execution
|
|
26
|
+
*/
|
|
27
|
+
export interface ExplainOptions {
|
|
28
|
+
/** Use EXPLAIN ANALYZE to actually execute the query and get real timing (PostgreSQL, MySQL 8.0.18+) */
|
|
29
|
+
analyze?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A single operation/node in the query execution plan
|
|
33
|
+
* Normalized structure across all databases
|
|
34
|
+
*/
|
|
35
|
+
export interface ExplainOperation {
|
|
36
|
+
/** Operation type (e.g., 'Seq Scan', 'Index Scan', 'Hash Join', 'Sort') */
|
|
37
|
+
type: string;
|
|
38
|
+
/** Table name if applicable */
|
|
39
|
+
table?: string;
|
|
40
|
+
/** Index name if used */
|
|
41
|
+
index?: string;
|
|
42
|
+
/** Estimated row count from planner */
|
|
43
|
+
estimatedRows?: number;
|
|
44
|
+
/** Actual row count (if ANALYZE was used) */
|
|
45
|
+
actualRows?: number;
|
|
46
|
+
/** Estimated cost (database-specific units) */
|
|
47
|
+
estimatedCost?: number;
|
|
48
|
+
/** Filter condition if any */
|
|
49
|
+
filter?: string;
|
|
50
|
+
/** Additional details specific to this operation */
|
|
51
|
+
details?: string;
|
|
52
|
+
/** Nested/child operations */
|
|
53
|
+
children?: ExplainOperation[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of an EXPLAIN query
|
|
57
|
+
* Provides both normalized structure and raw output
|
|
58
|
+
*/
|
|
59
|
+
export interface ExplainResult {
|
|
60
|
+
/** Normalized hierarchical plan as operations */
|
|
61
|
+
operations: ExplainOperation[];
|
|
62
|
+
/** Summary statistics */
|
|
63
|
+
summary: ExplainSummary;
|
|
64
|
+
/** Raw EXPLAIN output as text (for display) */
|
|
65
|
+
raw: string;
|
|
66
|
+
/** Original SQL query */
|
|
67
|
+
sql: {
|
|
68
|
+
sql: string;
|
|
69
|
+
params?: unknown[];
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Summary statistics from the execution plan
|
|
74
|
+
*/
|
|
75
|
+
export interface ExplainSummary {
|
|
76
|
+
/** Database engine type */
|
|
77
|
+
database: 'postgres' | 'mysql' | 'sqlite' | 'duckdb' | 'databend' | 'snowflake';
|
|
78
|
+
/** Planning time in milliseconds (if available) */
|
|
79
|
+
planningTime?: number;
|
|
80
|
+
/** Execution time in milliseconds (if ANALYZE was used) */
|
|
81
|
+
executionTime?: number;
|
|
82
|
+
/** Total estimated cost */
|
|
83
|
+
totalCost?: number;
|
|
84
|
+
/** Quick flag: true if any sequential scans detected */
|
|
85
|
+
hasSequentialScans: boolean;
|
|
86
|
+
/** List of indexes used in the plan */
|
|
87
|
+
usedIndexes: string[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A recommendation from AI analysis of an execution plan
|
|
91
|
+
*/
|
|
92
|
+
export interface ExplainRecommendation {
|
|
93
|
+
/** Type of recommendation */
|
|
94
|
+
type: 'index' | 'table' | 'cube' | 'general';
|
|
95
|
+
/** Severity/priority of the recommendation */
|
|
96
|
+
severity: 'critical' | 'warning' | 'suggestion';
|
|
97
|
+
/** Short actionable title */
|
|
98
|
+
title: string;
|
|
99
|
+
/** Detailed explanation of why this helps */
|
|
100
|
+
description: string;
|
|
101
|
+
/** Actionable SQL statement (e.g., CREATE INDEX) - for index/table recommendations */
|
|
102
|
+
sql?: string;
|
|
103
|
+
/** TypeScript code snippet to add to cube definition - for cube recommendations */
|
|
104
|
+
cubeCode?: string;
|
|
105
|
+
/** Which cube to modify - for cube recommendations */
|
|
106
|
+
cubeName?: string;
|
|
107
|
+
/** Affected database table */
|
|
108
|
+
table?: string;
|
|
109
|
+
/** Affected columns */
|
|
110
|
+
columns?: string[];
|
|
111
|
+
/** Expected performance improvement */
|
|
112
|
+
estimatedImpact?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Issue identified in the execution plan
|
|
116
|
+
*/
|
|
117
|
+
export interface ExplainIssue {
|
|
118
|
+
/** Type of issue */
|
|
119
|
+
type: 'sequential_scan' | 'missing_index' | 'high_cost' | 'sort_operation' | string;
|
|
120
|
+
/** Description of the issue */
|
|
121
|
+
description: string;
|
|
122
|
+
/** Severity level */
|
|
123
|
+
severity: 'high' | 'medium' | 'low';
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* AI-generated analysis of an execution plan
|
|
127
|
+
*/
|
|
128
|
+
export interface AIExplainAnalysis {
|
|
129
|
+
/** One-sentence description of what the query does */
|
|
130
|
+
summary: string;
|
|
131
|
+
/** Overall performance assessment */
|
|
132
|
+
assessment: 'good' | 'warning' | 'critical';
|
|
133
|
+
/** Reason for the assessment */
|
|
134
|
+
assessmentReason: string;
|
|
135
|
+
/** Detailed explanation of the query's purpose and structure */
|
|
136
|
+
queryUnderstanding: string;
|
|
137
|
+
/** Issues identified in the execution plan */
|
|
138
|
+
issues: ExplainIssue[];
|
|
139
|
+
/** Actionable recommendations for improvement */
|
|
140
|
+
recommendations: ExplainRecommendation[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Information about a database index
|
|
144
|
+
*/
|
|
145
|
+
export interface IndexInfo {
|
|
146
|
+
/** Table the index belongs to */
|
|
147
|
+
table_name: string;
|
|
148
|
+
/** Name of the index */
|
|
149
|
+
index_name: string;
|
|
150
|
+
/** Columns included in the index (in order) */
|
|
151
|
+
columns: string[];
|
|
152
|
+
/** Whether the index enforces uniqueness */
|
|
153
|
+
is_unique: boolean;
|
|
154
|
+
/** Whether this is the primary key index */
|
|
155
|
+
is_primary: boolean;
|
|
156
|
+
}
|