drizzle-cube 0.5.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/adapters/{google-CFYljAOF.js → google-CvKM9yVM.js} +83 -71
- package/dist/adapters/{handler-Cx8QYLk6.js → handler-CfgE0JSL.js} +499 -576
- package/dist/adapters/handler-Cn0dOctE.cjs +25 -0
- package/dist/adapters/hono/index.cjs +2 -2
- package/dist/adapters/hono/index.js +205 -175
- 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/adapters/{openai-BZdAA7Ji.js → openai-cDlFSTk6.js} +60 -58
- package/dist/adapters/openai-vXvLni8v.cjs +1 -0
- package/dist/adapters/{utils-D9JPLmfl.js → utils-BPWZsX7k.js} +1271 -1218
- 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 +2 -16
- 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-CjCIAT-J.js → DashboardEditModal-okVfH8ZK.js} +5296 -4544
- package/dist/client/chunks/DashboardEditModal-okVfH8ZK.js.map +1 -0
- package/dist/client/chunks/{RetentionCombinedChart-BPkfcTa8.js → RetentionCombinedChart-BgbDhsPz.js} +10 -10
- package/dist/client/chunks/{RetentionCombinedChart-BPkfcTa8.js.map → RetentionCombinedChart-BgbDhsPz.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-DGzLzr7h.js → RetentionHeatmap-DjXZaTPq.js} +5 -5
- package/dist/client/chunks/{RetentionHeatmap-DGzLzr7h.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-CYVwSPqt.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-DmruKPab.js → chart-activity-grid-DX0SJbxs.js} +635 -492
- 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-DYKfyOI8.js → chart-box-plot-kkBixZ27.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-DYKfyOI8.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-Dwc92Mrj.js → chart-candlestick-DZp19Tzh.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-Dwc92Mrj.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-BO4sXsim.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-DnWRsmnS.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-dgUetjyM.js → chart-markdown-CV75S_zL.js} +2 -2
- package/dist/client/chunks/{chart-markdown-dgUetjyM.js.map → chart-markdown-CV75S_zL.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-ClfpLs4q.js → chart-measure-profile-Ket8fJyf.js} +7 -7
- package/dist/client/chunks/{chart-measure-profile-ClfpLs4q.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-M3XpO_ah.js → chart-sankey-DjrvKw6K.js} +36 -39
- package/dist/client/chunks/{chart-sankey-M3XpO_ah.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-A_u6lqlS.js → chart-sunburst-leGpuDj7.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-A_u6lqlS.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-BuhMoagf.js → chart-waterfall-DyvQReN5.js} +7 -7
- package/dist/client/chunks/{chart-waterfall-BuhMoagf.js.map → chart-waterfall-DyvQReN5.js.map} +1 -1
- package/dist/client/chunks/{charts-core-jRtb0S2M.js → charts-core-DaXSt1Dd.js} +2 -2
- package/dist/client/chunks/{charts-core-jRtb0S2M.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/{nl-NL-CpVs7ox3.js → nl-NL-2zTAWTej.js} +2 -1
- package/dist/client/chunks/{nl-NL-CpVs7ox3.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-DE09kQE3.js → schema-visualization-Cb_E9_Gd.js} +12 -12
- package/dist/client/chunks/{schema-visualization-DE09kQE3.js.map → schema-visualization-Cb_E9_Gd.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CoeQbprt.js → useDirtyStateTracking-MbpxH_v6.js} +95 -84
- package/dist/client/chunks/useDirtyStateTracking-MbpxH_v6.js.map +1 -0
- package/dist/client/chunks/{useExplainAI-DlnXWdmz.js → useExplainAI-evnZkjCY.js} +14 -14
- package/dist/client/chunks/{useExplainAI-DlnXWdmz.js.map → useExplainAI-evnZkjCY.js.map} +1 -1
- package/dist/client/chunks/{utils-CTKNaXS8.js → utils-3P6z1vz5.js} +2 -2
- package/dist/client/chunks/{utils-CTKNaXS8.js.map → utils-3P6z1vz5.js.map} +1 -1
- package/dist/client/chunks/{vendor-CPIYyeuD.js → vendor-DSpR0IW6.js} +43 -43
- package/dist/client/chunks/{vendor-CPIYyeuD.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/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/FieldSearchResults.d.ts +16 -0
- 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/MetricRow.d.ts +23 -0
- 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/DashboardFilters/CompactFilterBarParts.d.ts +26 -0
- package/dist/client/components/DashboardFilters/DashboardFilterConfigModalParts.d.ts +27 -0
- 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/DashboardPortletCard.d.ts +2 -57
- 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 +3 -1
- 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/ChartStates.d.ts +38 -0
- 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/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/DashboardEditBar.d.ts +5 -0
- package/dist/client/components/dashboard/LayoutModeToggle.d.ts +10 -0
- 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/drillNavigation.d.ts +25 -0
- package/dist/client/hooks.js +3 -3
- 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.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/optionsToAnalysisConfig.d.ts +17 -0
- package/dist/client/styles.css +1 -1
- package/dist/client/utils/axisValueFormatting.d.ts +32 -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/server/{google-CFYljAOF.js → google-CvKM9yVM.js} +83 -71
- package/dist/server/index.cjs +179 -211
- package/dist/server/index.js +6330 -6458
- package/dist/server/{openai-BZdAA7Ji.js → openai-cDlFSTk6.js} +60 -58
- package/dist/server/openai-vXvLni8v.cjs +1 -0
- package/dist/server/server/adapters/base-adapter.d.ts +80 -35
- package/dist/server/server/adapters/databend-adapter.d.ts +8 -59
- package/dist/server/server/adapters/duckdb-adapter.d.ts +5 -59
- package/dist/server/server/adapters/mysql-adapter.d.ts +13 -70
- package/dist/server/server/adapters/postgres-adapter.d.ts +1 -65
- package/dist/server/server/adapters/snowflake-adapter.d.ts +5 -68
- package/dist/server/server/adapters/sqlite-adapter.d.ts +12 -32
- package/dist/server/server/adapters/window-function-builder.d.ts +11 -0
- package/dist/server/server/agent/chart-validation.d.ts +0 -5
- package/dist/server/server/agent/handler-steps.d.ts +37 -0
- package/dist/server/server/ai/discovery-helpers.d.ts +29 -0
- package/dist/server/server/ai/discovery.d.ts +4 -0
- package/dist/server/server/ai/suggestion-helpers.d.ts +33 -0
- package/dist/server/server/ai/suggestion.d.ts +0 -3
- package/dist/server/server/ai/validation-helpers.d.ts +21 -0
- package/dist/server/server/ai/validation.d.ts +0 -3
- package/dist/server/server/builders/analysis-utils.d.ts +106 -0
- package/dist/server/server/builders/cte-builder.d.ts +46 -0
- package/dist/server/server/builders/date-time-builder.d.ts +5 -0
- package/dist/server/server/builders/date-time-helpers.d.ts +34 -0
- package/dist/server/server/builders/filter-builder.d.ts +2 -0
- package/dist/server/server/builders/filter-operators.d.ts +23 -0
- package/dist/server/server/builders/flow-query-builder.d.ts +46 -19
- package/dist/server/server/builders/funnel-query-builder.d.ts +16 -5
- package/dist/server/server/builders/group-by-builder.d.ts +11 -0
- package/dist/server/server/builders/measure-builder.d.ts +43 -0
- package/dist/server/server/builders/retention-query-builder.d.ts +12 -14
- package/dist/server/server/cache-utils.d.ts +25 -5
- package/dist/server/server/compiler-metadata.d.ts +11 -0
- package/dist/server/server/compiler.d.ts +8 -14
- package/dist/server/server/cube-utils.d.ts +29 -4
- 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 +33 -30
- package/dist/server/server/executors/explain-utils.d.ts +28 -0
- package/dist/server/server/explain/explain-tree.d.ts +20 -0
- package/dist/server/server/filter-cache.d.ts +2 -2
- package/dist/server/server/gap-filler.d.ts +6 -0
- package/dist/server/server/index.d.ts +3 -1
- 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 +6 -1
- package/dist/server/server/logical-plan/join-planner.d.ts +27 -0
- package/dist/server/server/logical-plan/logical-planner.d.ts +7 -200
- package/dist/server/server/logical-plan/optimiser.d.ts +3 -1
- 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 +17 -9
- package/dist/server/server/measure-classification.d.ts +40 -0
- package/dist/server/server/physical-plan/drizzle-plan-builder.d.ts +21 -21
- package/dist/server/server/physical-plan/drizzle-sql-builder.d.ts +11 -0
- package/dist/server/server/physical-plan/processors/index.d.ts +2 -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/shared.d.ts +5 -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 +5 -0
- package/dist/server/server/resolvers/join-path-resolver.d.ts +6 -0
- package/dist/server/server/sql-format.d.ts +11 -0
- package/dist/server/server/types/cube.d.ts +18 -4
- package/dist/server/server/types/flow.d.ts +6 -5
- package/dist/server/server/types/index.d.ts +1 -1
- package/dist/server/server/types/validation.d.ts +14 -0
- package/package.json +11 -4
- package/dist/adapters/google-DUlXeeDA.cjs +0 -2
- package/dist/adapters/handler-CzbCuS6_.cjs +0 -25
- package/dist/adapters/locale-BPB7flIG.js +0 -8249
- package/dist/adapters/locale-tIMrNcCr.cjs +0 -198
- package/dist/adapters/mcp-transport-C2QzXm6h.cjs +0 -40
- package/dist/adapters/mcp-transport-D0B3S1tB.js +0 -579
- package/dist/adapters/openai-D_U4V0kT.cjs +0 -1
- package/dist/adapters/utils-KV37IBIv.cjs +0 -128
- package/dist/client/chunks/DashboardEditModal-CjCIAT-J.js.map +0 -1
- package/dist/client/chunks/analysis-builder-MuMIzoRq.js +0 -5367
- package/dist/client/chunks/analysis-builder-MuMIzoRq.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-CYVwSPqt.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-DmruKPab.js.map +0 -1
- package/dist/client/chunks/chart-area-DHCPM4Em.js +0 -450
- package/dist/client/chunks/chart-area-DHCPM4Em.js.map +0 -1
- package/dist/client/chunks/chart-bar-KddciGDv.js +0 -271
- package/dist/client/chunks/chart-bar-KddciGDv.js.map +0 -1
- package/dist/client/chunks/chart-bubble-CfqiB538.js +0 -273
- package/dist/client/chunks/chart-bubble-CfqiB538.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-BO4sXsim.js.map +0 -1
- package/dist/client/chunks/chart-funnel-DnWRsmnS.js.map +0 -1
- package/dist/client/chunks/chart-gauge-CgMeqeGb.js +0 -424
- package/dist/client/chunks/chart-gauge-CgMeqeGb.js.map +0 -1
- package/dist/client/chunks/chart-heat-map-DcGm9SWK.js +0 -231
- package/dist/client/chunks/chart-heat-map-DcGm9SWK.js.map +0 -1
- package/dist/client/chunks/chart-kpi-delta-C2wKPqCb.js +0 -343
- package/dist/client/chunks/chart-kpi-delta-C2wKPqCb.js.map +0 -1
- package/dist/client/chunks/chart-kpi-number-gWYF44ol.js +0 -322
- package/dist/client/chunks/chart-kpi-number-gWYF44ol.js.map +0 -1
- package/dist/client/chunks/chart-kpi-text-DIYtJtk4.js +0 -149
- package/dist/client/chunks/chart-kpi-text-DIYtJtk4.js.map +0 -1
- package/dist/client/chunks/chart-line-9BEGN5Ti.js +0 -433
- package/dist/client/chunks/chart-line-9BEGN5Ti.js.map +0 -1
- package/dist/client/chunks/chart-pie-BjAIhyOi.js +0 -172
- package/dist/client/chunks/chart-pie-BjAIhyOi.js.map +0 -1
- package/dist/client/chunks/chart-radar-Dgkcl2bN.js +0 -154
- package/dist/client/chunks/chart-radar-Dgkcl2bN.js.map +0 -1
- package/dist/client/chunks/chart-radial-bar-DdWJjAhK.js +0 -148
- package/dist/client/chunks/chart-radial-bar-DdWJjAhK.js.map +0 -1
- package/dist/client/chunks/chart-scatter-DaHYP_OL.js +0 -255
- package/dist/client/chunks/chart-scatter-DaHYP_OL.js.map +0 -1
- package/dist/client/chunks/chart-tree-map-uiwUU4nb.js +0 -298
- package/dist/client/chunks/chart-tree-map-uiwUU4nb.js.map +0 -1
- package/dist/client/chunks/useDirtyStateTracking-CoeQbprt.js.map +0 -1
- package/dist/server/google-DUlXeeDA.cjs +0 -2
- package/dist/server/openai-D_U4V0kT.cjs +0 -1
|
@@ -1,44 +1,14 @@
|
|
|
1
1
|
import { Cube, QueryContext, PhysicalQueryPlan, SemanticQuery, PrimaryCubeAnalysis, JoinPathAnalysis, QueryWarning } from '../types';
|
|
2
|
-
|
|
3
|
-
* Pre-aggregation plan for handling hasMany relationships
|
|
4
|
-
*/
|
|
2
|
+
import { JoinRef } from './types';
|
|
5
3
|
export declare class LogicalPlanner {
|
|
6
|
-
private resolverCache;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private getResolver;
|
|
4
|
+
private readonly resolverCache;
|
|
5
|
+
private readonly joinPlanner;
|
|
6
|
+
private readonly ctePlanner;
|
|
7
|
+
private readonly reporter;
|
|
11
8
|
/**
|
|
12
9
|
* Analyze a semantic query to determine which cubes are involved
|
|
13
10
|
*/
|
|
14
11
|
analyzeCubeUsage(query: SemanticQuery): Set<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Build query-level path hints (Cube-style) from all query members:
|
|
17
|
-
* measures, dimensions, time dimensions, filters, and order-by.
|
|
18
|
-
* These hints guide path selection toward the semantic query grain.
|
|
19
|
-
*/
|
|
20
|
-
private collectPathHintCubes;
|
|
21
|
-
/**
|
|
22
|
-
* Recursively extract cube names from filters (handles logical filters)
|
|
23
|
-
*/
|
|
24
|
-
private extractCubeNamesFromFilter;
|
|
25
|
-
/**
|
|
26
|
-
* Extract measures referenced in filters (for CTE inclusion)
|
|
27
|
-
*/
|
|
28
|
-
private extractMeasuresFromFilters;
|
|
29
|
-
/**
|
|
30
|
-
* Recursively extract measures from filters for a specific cube
|
|
31
|
-
* Only includes filter members that are actually measures (not dimensions)
|
|
32
|
-
*/
|
|
33
|
-
private extractMeasuresFromFilter;
|
|
34
|
-
/**
|
|
35
|
-
* Choose the primary cube based on query analysis
|
|
36
|
-
* Uses a consistent strategy to avoid measure order dependencies
|
|
37
|
-
*
|
|
38
|
-
* Delegates to analyzePrimaryCubeSelection() for the actual logic,
|
|
39
|
-
* ensuring a single source of truth for primary cube selection.
|
|
40
|
-
*/
|
|
41
|
-
choosePrimaryCube(cubeNames: string[], query: SemanticQuery, cubes?: Map<string, Cube>): string;
|
|
42
12
|
/**
|
|
43
13
|
* Analyze primary cube selection with candidate details.
|
|
44
14
|
* Exposed for LogicalPlanBuilder so dry-run/analyze can report
|
|
@@ -55,178 +25,15 @@ export declare class LogicalPlanner {
|
|
|
55
25
|
* Exposed for LogicalPlanBuilder so logical planning can compose
|
|
56
26
|
* planner phases directly.
|
|
57
27
|
*/
|
|
58
|
-
buildJoinPlanForPrimary(cubes: Map<string, Cube>, primaryCube: Cube, cubeNames: string[], ctx: QueryContext, query: SemanticQuery):
|
|
28
|
+
buildJoinPlanForPrimary(cubes: Map<string, Cube>, primaryCube: Cube, cubeNames: string[], ctx: QueryContext, query: SemanticQuery): JoinRef[];
|
|
59
29
|
/**
|
|
60
30
|
* Build pre-aggregation CTE plan from a primary cube and join plan.
|
|
61
31
|
* Exposed for LogicalPlanBuilder phase composition.
|
|
62
32
|
*/
|
|
63
|
-
buildPreAggregationCTEs(cubes: Map<string, Cube>, primaryCube: Cube, joinCubes:
|
|
33
|
+
buildPreAggregationCTEs(cubes: Map<string, Cube>, primaryCube: Cube, joinCubes: JoinRef[], query: SemanticQuery, ctx: QueryContext): PhysicalQueryPlan['preAggregationCTEs'];
|
|
64
34
|
/**
|
|
65
35
|
* Generate query warnings from pre-aggregation analysis.
|
|
66
36
|
* Exposed for LogicalPlanBuilder phase composition.
|
|
67
37
|
*/
|
|
68
38
|
buildWarnings(query: SemanticQuery, preAggregationCTEs?: PhysicalQueryPlan['preAggregationCTEs']): QueryWarning[];
|
|
69
|
-
/**
|
|
70
|
-
* Build join plan for multi-cube query
|
|
71
|
-
* Supports both direct joins and transitive joins through intermediate cubes
|
|
72
|
-
*
|
|
73
|
-
* Uses query-aware path selection to prefer joining through cubes that have
|
|
74
|
-
* measures in the query (e.g., joining Teams through EmployeeTeams when
|
|
75
|
-
* EmployeeTeams.count is a measure)
|
|
76
|
-
*/
|
|
77
|
-
private buildJoinPlan;
|
|
78
|
-
/**
|
|
79
|
-
* Plan pre-aggregation CTEs for hasMany relationships to prevent fan-out
|
|
80
|
-
* Note: belongsToMany relationships handle fan-out differently through their junction table structure
|
|
81
|
-
* and don't require CTEs - the two-hop join with the junction table provides natural grouping
|
|
82
|
-
*
|
|
83
|
-
* CRITICAL FAN-OUT PREVENTION LOGIC:
|
|
84
|
-
* When a query contains ANY hasMany relationship in the join graph, ALL cubes with measures
|
|
85
|
-
* that could be affected by row multiplication need CTEs. This includes:
|
|
86
|
-
*
|
|
87
|
-
* 1. Cubes with direct hasMany FROM primary (existing logic)
|
|
88
|
-
* 2. Cubes with measures that would be multiplied due to hasMany elsewhere in the query
|
|
89
|
-
* - Example: Query has Departments.totalBudget + Productivity.recordCount
|
|
90
|
-
* - Employees hasMany → Productivity causes row multiplication
|
|
91
|
-
* - Departments.totalBudget would be inflated without CTE pre-aggregation
|
|
92
|
-
*/
|
|
93
|
-
private planPreAggregationCTEs;
|
|
94
|
-
/**
|
|
95
|
-
* Find join information TO a cube (reverse lookup)
|
|
96
|
-
* Used when the primary cube needs a CTE and we need to find how other cubes join to it
|
|
97
|
-
*/
|
|
98
|
-
private findJoinInfoToCube;
|
|
99
|
-
/**
|
|
100
|
-
* Analyze the join path from primary cube to a target CTE cube.
|
|
101
|
-
* Detects if there are intermediate hasMany relationships that would cause fan-out.
|
|
102
|
-
*
|
|
103
|
-
* Returns information about:
|
|
104
|
-
* - The full join path
|
|
105
|
-
* - Whether there are hasMany relationships ON the path (not just at the end)
|
|
106
|
-
* - Which intermediate tables need to be absorbed into the CTE
|
|
107
|
-
* - The correct join key to use (from primary cube's connection point)
|
|
108
|
-
*
|
|
109
|
-
* @param cubes Map of all registered cubes
|
|
110
|
-
* @param primaryCube The primary cube (FROM clause)
|
|
111
|
-
* @param targetCubeName The CTE cube we're analyzing the path to
|
|
112
|
-
* @param ctx Query context for security filtering
|
|
113
|
-
*/
|
|
114
|
-
private analyzeJoinPathToPrimary;
|
|
115
|
-
/**
|
|
116
|
-
* Compute CTE reasons from the actual join plan entries.
|
|
117
|
-
*
|
|
118
|
-
* Instead of scanning all registered cubes (which causes false positives when
|
|
119
|
-
* unrelated hasMany relationships exist), this walks only the planned joins
|
|
120
|
-
* using the `relationship` field now stored on each JoinCubePlanEntry.
|
|
121
|
-
*
|
|
122
|
-
* Algorithm:
|
|
123
|
-
* 1. Scan join plan entries for hasMany/belongsToMany relationships
|
|
124
|
-
* 2. If none found → return empty map (no CTEs needed)
|
|
125
|
-
* 3. hasMany/belongsToMany targets with measures → 'hasMany'
|
|
126
|
-
* 4. Other join cubes with measures (not hasMany source) → 'fanOutPrevention'
|
|
127
|
-
*/
|
|
128
|
-
private computeCTEReasons;
|
|
129
|
-
/**
|
|
130
|
-
* Find join information for a cube from any cube in the query
|
|
131
|
-
* This extends findHasManyJoinDef to work with any relationship type
|
|
132
|
-
* and to search from any source cube, not just the primary
|
|
133
|
-
*/
|
|
134
|
-
private findJoinInfoForCube;
|
|
135
|
-
/**
|
|
136
|
-
* Find downstream cubes that need join keys included in the CTE.
|
|
137
|
-
*
|
|
138
|
-
* When a query has dimensions from a cube (e.g., Teams.name) and measures from
|
|
139
|
-
* a junction cube (e.g., EmployeeTeams.count), the junction CTE needs to include
|
|
140
|
-
* the join key to the dimension cube (team_id) so the dimension cube can be
|
|
141
|
-
* joined through the CTE instead of via an alternative path.
|
|
142
|
-
*
|
|
143
|
-
* @param cteCube The cube being converted to a CTE (e.g., EmployeeTeams)
|
|
144
|
-
* @param query The semantic query with dimensions and measures
|
|
145
|
-
* @param allCubes Map of all registered cubes
|
|
146
|
-
* @returns Array of downstream join key info for cubes needing join through this CTE
|
|
147
|
-
*/
|
|
148
|
-
private findDownstreamJoinKeys;
|
|
149
|
-
/**
|
|
150
|
-
* Expand calculated measures to include their dependencies
|
|
151
|
-
*/
|
|
152
|
-
private expandCalculatedMeasureDependencies;
|
|
153
|
-
/**
|
|
154
|
-
* Extract measure references from calculatedSql template
|
|
155
|
-
*/
|
|
156
|
-
private extractDependenciesFromTemplate;
|
|
157
|
-
/**
|
|
158
|
-
* Find hasMany join definition from primary cube to target cube
|
|
159
|
-
*/
|
|
160
|
-
private findHasManyJoinDef;
|
|
161
|
-
/**
|
|
162
|
-
* Find filters that need to propagate from related cubes to a CTE cube.
|
|
163
|
-
* When cube A has filters and a hasMany relationship to cube B (the CTE cube),
|
|
164
|
-
* A's filters should propagate into B's CTE via a subquery.
|
|
165
|
-
*
|
|
166
|
-
* Example: Employees.createdAt filter should propagate to Productivity CTE
|
|
167
|
-
* via: employee_id IN (SELECT id FROM employees WHERE created_at >= $date)
|
|
168
|
-
*/
|
|
169
|
-
private findPropagatingFilters;
|
|
170
|
-
/**
|
|
171
|
-
* Extract cube names from filters into a Set (helper for findPropagatingFilters)
|
|
172
|
-
*/
|
|
173
|
-
private extractFilterCubeNamesToSet;
|
|
174
|
-
/**
|
|
175
|
-
* Extract filters for a specific cube from the filter array
|
|
176
|
-
*
|
|
177
|
-
* Logic for preserving filter semantics:
|
|
178
|
-
* - AND: Safe to extract only matching branches (AND of fewer conditions is more permissive)
|
|
179
|
-
* - OR: Must include ALL branches or skip entirely (partial OR changes semantics)
|
|
180
|
-
* If any branch belongs to another cube, skip the entire OR to be safe
|
|
181
|
-
* since we can't evaluate the other cube's conditions
|
|
182
|
-
*/
|
|
183
|
-
private extractFiltersForCube;
|
|
184
|
-
/**
|
|
185
|
-
* Check if all simple filters in a filter array belong to the specified cube
|
|
186
|
-
* Recursively checks nested AND/OR filters
|
|
187
|
-
*/
|
|
188
|
-
private allFiltersFromCube;
|
|
189
|
-
/**
|
|
190
|
-
* Extract time dimension date range filters as regular filters for a specific cube
|
|
191
|
-
*/
|
|
192
|
-
private extractTimeDimensionFiltersForCube;
|
|
193
|
-
/**
|
|
194
|
-
* Analyze why a particular cube was chosen as primary
|
|
195
|
-
*/
|
|
196
|
-
private analyzePrimaryCubeSelection;
|
|
197
|
-
/**
|
|
198
|
-
* Analyze the join path between two cubes with detailed step information
|
|
199
|
-
*
|
|
200
|
-
* Uses JoinPathResolver.findPath() for the actual path finding,
|
|
201
|
-
* then converts the result to human-readable analysis format.
|
|
202
|
-
*/
|
|
203
|
-
private analyzeJoinPath;
|
|
204
|
-
private convertInternalPathToJoinPathSteps;
|
|
205
|
-
private buildJoinPathSelectionAnalysis;
|
|
206
|
-
private mapPreferredCandidate;
|
|
207
|
-
/**
|
|
208
|
-
* Generate warnings for query edge cases that users should be aware of.
|
|
209
|
-
* Currently detects:
|
|
210
|
-
* - FAN_OUT_NO_DIMENSIONS: Query has hasMany CTEs but no dimensions to group by
|
|
211
|
-
*
|
|
212
|
-
* Note: AVG measures in hasMany CTEs can produce mathematically imprecise results
|
|
213
|
-
* (average of averages vs weighted average), but this warning was removed as it
|
|
214
|
-
* fired too aggressively. The issue only occurs when the outer grouping is coarser
|
|
215
|
-
* than the CTE grouping, which is rare in practice. The limitation is documented
|
|
216
|
-
* in executor.ts comments.
|
|
217
|
-
*/
|
|
218
|
-
private generateWarnings;
|
|
219
|
-
/**
|
|
220
|
-
* Detect when a query has measures from multiple cubes with hasMany relationships
|
|
221
|
-
* but no dimensions to provide grouping context.
|
|
222
|
-
*
|
|
223
|
-
* This is an edge case where:
|
|
224
|
-
* - Query has measures from 2+ cubes
|
|
225
|
-
* - At least one CTE exists (indicating hasMany relationship)
|
|
226
|
-
* - Query has NO dimensions AND NO time dimensions with granularity
|
|
227
|
-
*
|
|
228
|
-
* The SQL is technically correct (CTEs with GROUP BY on join keys), but users
|
|
229
|
-
* may be confused by the aggregated results without visible grouping.
|
|
230
|
-
*/
|
|
231
|
-
private checkFanOutNoDimensions;
|
|
232
39
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { LogicalNode } from './types';
|
|
2
|
+
/** Database engine the optimiser is targeting (all 7 supported engines). */
|
|
3
|
+
export type OptimiserEngineType = 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
2
4
|
/** Context available to optimiser passes */
|
|
3
5
|
export interface OptimiserContext {
|
|
4
6
|
/** Database engine type for engine-specific rewrites */
|
|
5
|
-
engineType:
|
|
7
|
+
engineType: OptimiserEngineType;
|
|
6
8
|
}
|
|
7
9
|
/** A single optimiser pass that rewrites a logical plan */
|
|
8
10
|
export interface PlanOptimiser {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Cube, PhysicalQueryPlan, SemanticQuery, PrimaryCubeAnalysis, JoinPathAnalysis, QueryWarning } from '../types';
|
|
2
|
+
import { ResolverCache } from './planner-utils';
|
|
3
|
+
export declare class PlanAnalysisReporter {
|
|
4
|
+
private readonly resolverCache;
|
|
5
|
+
constructor(resolverCache: ResolverCache);
|
|
6
|
+
/**
|
|
7
|
+
* Analyze why a particular cube was chosen as primary
|
|
8
|
+
*/
|
|
9
|
+
analyzePrimaryCubeSelection(cubeNames: string[], query: SemanticQuery, cubes: Map<string, Cube>): PrimaryCubeAnalysis;
|
|
10
|
+
/**
|
|
11
|
+
* Build the scored candidate list (dimension count, join count, reachability).
|
|
12
|
+
*/
|
|
13
|
+
private buildPrimaryCubeCandidates;
|
|
14
|
+
/**
|
|
15
|
+
* Tier 1: select the cube with the most query dimensions that can reach all
|
|
16
|
+
* others. Returns null when no dimension-based winner applies.
|
|
17
|
+
*/
|
|
18
|
+
private selectByDimensions;
|
|
19
|
+
/**
|
|
20
|
+
* Tier 2: among cubes that can reach all others, select the most connected.
|
|
21
|
+
* Returns null when no candidate can reach all others.
|
|
22
|
+
*/
|
|
23
|
+
private selectByConnectivity;
|
|
24
|
+
/**
|
|
25
|
+
* Analyze the join path between two cubes with detailed step information
|
|
26
|
+
*
|
|
27
|
+
* Uses JoinPathResolver.findPath() for the actual path finding,
|
|
28
|
+
* then converts the result to human-readable analysis format.
|
|
29
|
+
*/
|
|
30
|
+
analyzeJoinPath(cubes: Map<string, Cube>, fromCube: string, toCube: string, query?: SemanticQuery): JoinPathAnalysis;
|
|
31
|
+
private convertInternalPathToJoinPathSteps;
|
|
32
|
+
private buildJoinPathSelectionAnalysis;
|
|
33
|
+
private mapPreferredCandidate;
|
|
34
|
+
/**
|
|
35
|
+
* Generate warnings for query edge cases that users should be aware of.
|
|
36
|
+
* Currently detects:
|
|
37
|
+
* - FAN_OUT_NO_DIMENSIONS: Query has hasMany CTEs but no dimensions to group by
|
|
38
|
+
*
|
|
39
|
+
* Note: AVG measures in hasMany CTEs can produce mathematically imprecise results
|
|
40
|
+
* (average of averages vs weighted average), but this warning was removed as it
|
|
41
|
+
* fired too aggressively. The issue only occurs when the outer grouping is coarser
|
|
42
|
+
* than the CTE grouping, which is rare in practice. The limitation is documented
|
|
43
|
+
* in executor.ts comments.
|
|
44
|
+
*/
|
|
45
|
+
generateWarnings(query: SemanticQuery, preAggregationCTEs?: PhysicalQueryPlan['preAggregationCTEs']): QueryWarning[];
|
|
46
|
+
/**
|
|
47
|
+
* Detect when a query has measures from multiple cubes with hasMany relationships
|
|
48
|
+
* but no dimensions to provide grouping context.
|
|
49
|
+
*
|
|
50
|
+
* This is an edge case where:
|
|
51
|
+
* - Query has measures from 2+ cubes
|
|
52
|
+
* - At least one CTE exists (indicating hasMany relationship)
|
|
53
|
+
* - Query has NO dimensions AND NO time dimensions with granularity
|
|
54
|
+
*
|
|
55
|
+
* The SQL is technically correct (CTEs with GROUP BY on join keys), but users
|
|
56
|
+
* may be confused by the aggregated results without visible grouping.
|
|
57
|
+
*/
|
|
58
|
+
private checkFanOutNoDimensions;
|
|
59
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Cube, SemanticQuery } from '../types';
|
|
2
|
+
import { JoinPathResolver } from '../resolvers/join-path-resolver';
|
|
3
|
+
/**
|
|
4
|
+
* Caches a JoinPathResolver per cubes map to avoid repeated instantiation.
|
|
5
|
+
* Shared by all sub-planners so a single query reuses one resolver per cubes map.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ResolverCache {
|
|
8
|
+
private cache;
|
|
9
|
+
get(cubes: Map<string, Cube>): JoinPathResolver;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Analyze a semantic query to determine which cubes are involved.
|
|
13
|
+
* Scans measures, dimensions, time dimensions, filters and ORDER BY members.
|
|
14
|
+
*/
|
|
15
|
+
export declare function analyzeCubeUsage(query: SemanticQuery): Set<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Recursively extract cube names from a filter (handles logical AND/OR filters)
|
|
18
|
+
* into the provided set.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractCubeNamesFromFilter(filter: any, cubesUsed: Set<string>): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Cube, JoinKeyInfo, PropagatingFilter, IntermediateJoinInfo, DownstreamJoinKeyInfo } from '../types/cube';
|
|
1
|
+
import { AnyColumn, Table } from 'drizzle-orm';
|
|
2
|
+
import { Cube, CubeJoin, JoinKeyInfo, PropagatingFilter, IntermediateJoinInfo, DownstreamJoinKeyInfo } from '../types/cube';
|
|
3
3
|
import { Filter } from '../types/query';
|
|
4
|
-
import {
|
|
4
|
+
import { QueryWarning, TimeGranularity } from '../types/core';
|
|
5
5
|
/** Reference to a registered cube */
|
|
6
6
|
export interface CubeRef {
|
|
7
7
|
/** Cube name (e.g. 'Employees') */
|
|
@@ -59,19 +59,25 @@ export interface JoinRef {
|
|
|
59
59
|
target: CubeRef;
|
|
60
60
|
/** Table alias in the generated SQL */
|
|
61
61
|
alias: string;
|
|
62
|
-
/** SQL join type */
|
|
62
|
+
/** SQL join type (already resolved from the effective relationship) */
|
|
63
63
|
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
64
|
-
/**
|
|
65
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Symbolic join definition. The Drizzle join condition is materialized from
|
|
66
|
+
* this by DrizzlePlanBuilder — the logical plan itself holds no SQL and no
|
|
67
|
+
* baked security context.
|
|
68
|
+
*/
|
|
69
|
+
joinDef: CubeJoin;
|
|
66
70
|
/** Relationship type from the join definition */
|
|
67
71
|
relationship?: 'belongsTo' | 'hasOne' | 'hasMany' | 'belongsToMany';
|
|
68
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Junction table for belongsToMany relationships (symbolic).
|
|
74
|
+
* The junction join condition and security WHERE are materialized from
|
|
75
|
+
* `joinDef.through` by DrizzlePlanBuilder at physical-plan time.
|
|
76
|
+
*/
|
|
69
77
|
junctionTable?: {
|
|
70
78
|
table: Table;
|
|
71
79
|
alias: string;
|
|
72
80
|
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
73
|
-
joinCondition: SQL;
|
|
74
|
-
securitySql?: (securityContext: SecurityContext) => SQL | SQL[];
|
|
75
81
|
sourceCubeName?: string;
|
|
76
82
|
};
|
|
77
83
|
}
|
|
@@ -102,6 +108,8 @@ export interface QueryNode extends LogicalNodeBase {
|
|
|
102
108
|
orderBy: OrderByRef[];
|
|
103
109
|
limit?: number;
|
|
104
110
|
offset?: number;
|
|
111
|
+
/** When true, skip GROUP BY (raw rows) */
|
|
112
|
+
ungrouped?: boolean;
|
|
105
113
|
/** Planning warnings surfaced to the caller */
|
|
106
114
|
warnings: QueryWarning[];
|
|
107
115
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Cube } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Measure types that are window functions. Window functions require special
|
|
4
|
+
* handling: no GROUP BY in the CTE, no re-aggregation in the outer query, and
|
|
5
|
+
* they return individual rows rather than grouped results.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WINDOW_FUNCTION_TYPES: readonly ["lag", "lead", "rank", "denseRank", "rowNumber", "ntile", "firstValue", "lastValue", "movingAvg", "movingSum"];
|
|
8
|
+
/** Check if a measure type is a window function. */
|
|
9
|
+
export declare function isWindowFunction(measureType: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a measure is a post-aggregation window function.
|
|
12
|
+
* Post-aggregation windows reference a base `measure` in their windowConfig,
|
|
13
|
+
* indicating they operate on aggregated data rather than raw rows.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPostAggregationWindow(measure: any): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the base-measure reference for a post-aggregation window function to a
|
|
18
|
+
* fully qualified name (e.g. 'totalRevenue' -> 'Sales.totalRevenue').
|
|
19
|
+
* Returns null when the measure is not a post-aggregation window.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getWindowBaseMeasure(measure: any, cubeName: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Default operation for a window function type.
|
|
24
|
+
* - lag/lead default to 'difference' (compare current vs previous/next)
|
|
25
|
+
* - all others default to 'raw'
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDefaultWindowOperation(windowType: string): 'raw' | 'difference' | 'ratio' | 'percentChange';
|
|
28
|
+
/**
|
|
29
|
+
* Categorize measures for post-aggregation window-function handling.
|
|
30
|
+
* - aggregateMeasures: regular aggregates (count, sum, avg, etc.)
|
|
31
|
+
* - postAggWindowMeasures: window functions referencing a base measure
|
|
32
|
+
* - requiredBaseMeasures: base measures those windows depend on (auto-added)
|
|
33
|
+
*/
|
|
34
|
+
export declare function categorizeForPostAggregation(measureNames: string[], cubeMap: Map<string, Cube>): {
|
|
35
|
+
aggregateMeasures: string[];
|
|
36
|
+
postAggWindowMeasures: string[];
|
|
37
|
+
requiredBaseMeasures: Set<string>;
|
|
38
|
+
};
|
|
39
|
+
/** Whether any measure in the list is a post-aggregation window function. */
|
|
40
|
+
export declare function hasPostAggregationWindows(measureNames: string[], cubeMap: Map<string, Cube>): boolean;
|
|
@@ -17,9 +17,29 @@ export declare class DrizzlePlanBuilder {
|
|
|
17
17
|
* This is the physical-builder input for SQL generation.
|
|
18
18
|
*/
|
|
19
19
|
derivePhysicalPlanContext(plan: QueryNode): PhysicalQueryPlan;
|
|
20
|
+
/**
|
|
21
|
+
* Materialize a symbolic JoinRef into a runtime JoinCubePlanEntry, building
|
|
22
|
+
* the Drizzle join condition(s) from the join definition. This is the seam
|
|
23
|
+
* where the logical plan's symbolic join refs become executable SQL — the
|
|
24
|
+
* planner no longer pre-builds any join SQL.
|
|
25
|
+
*
|
|
26
|
+
* Junction-table security is NOT materialized here: the stored
|
|
27
|
+
* `through.securitySql` function is carried forward and applied (in the WHERE
|
|
28
|
+
* clause) at build time with the request's security context.
|
|
29
|
+
*/
|
|
30
|
+
private materializeJoin;
|
|
20
31
|
private derivePhysicalPlanContextFromMultiFact;
|
|
21
32
|
private derivePhysicalPlanContextFromFullKeyAggregate;
|
|
22
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Reconstruct a SemanticQuery from a (possibly optimised) QueryNode.
|
|
35
|
+
*
|
|
36
|
+
* This is the materialization seam that makes the logical plan a real IR:
|
|
37
|
+
* the executor derives the query the physical builder consumes from the
|
|
38
|
+
* optimised plan, so optimiser rewrites of measures/filters/limit/etc. take
|
|
39
|
+
* effect in the generated SQL. Must faithfully round-trip every field the
|
|
40
|
+
* physical builder and processors read off a SemanticQuery.
|
|
41
|
+
*/
|
|
42
|
+
toSemanticQuery(node: QueryNode): SemanticQuery;
|
|
23
43
|
private resolvePhysicalSimpleSource;
|
|
24
44
|
private resolvePhysicalSimpleSourceFromKeysDedup;
|
|
25
45
|
private resolveKeysDeduplicationMeta;
|
|
@@ -27,24 +47,4 @@ export declare class DrizzlePlanBuilder {
|
|
|
27
47
|
* Build unified query that works for both single and multi-cube queries.
|
|
28
48
|
*/
|
|
29
49
|
build(queryPlan: PhysicalQueryPlan, query: SemanticQuery, context: QueryContext): any;
|
|
30
|
-
private tryBuildKeysDeduplicationQuery;
|
|
31
|
-
private tryBuildMultiFactMergeQuery;
|
|
32
|
-
private buildMultiFactUnionKeysFallbackQuery;
|
|
33
|
-
private buildSharedKeySelection;
|
|
34
|
-
private selectRuntimeMergeStrategy;
|
|
35
|
-
private supportsFullOuterJoin;
|
|
36
|
-
private coalesceQualifiedColumn;
|
|
37
|
-
private canExecuteKeysDeduplication;
|
|
38
|
-
private queryContainsMeasureFilter;
|
|
39
|
-
private getPrimaryKeyDimensions;
|
|
40
|
-
/**
|
|
41
|
-
* Build type-specific outer aggregation for keys deduplication.
|
|
42
|
-
* Each measure type needs different re-aggregation in the outer query:
|
|
43
|
-
* - sum/count/number: SUM (re-combine additive values)
|
|
44
|
-
* - min: MIN (preserve minimum across groups)
|
|
45
|
-
* - max: MAX (preserve maximum across groups)
|
|
46
|
-
* - avg: SUM(sums) / NULLIF(SUM(counts), 0) (weighted average from decomposed parts)
|
|
47
|
-
*/
|
|
48
|
-
private buildKeysOuterAggregation;
|
|
49
|
-
private applyJoinByType;
|
|
50
50
|
}
|
|
@@ -54,6 +54,15 @@ export declare class DrizzleSqlBuilder {
|
|
|
54
54
|
* @param preBuiltFilters - Optional map of cube name to pre-built filter SQL for parameter deduplication
|
|
55
55
|
*/
|
|
56
56
|
buildWhereConditions(cubes: Map<string, Cube> | Cube, query: SemanticQuery, context: QueryContext, queryPlan?: PhysicalQueryPlan, preBuiltFilters?: Map<string, SQL[]>): SQL[];
|
|
57
|
+
/**
|
|
58
|
+
* Append a single regular filter's WHERE condition, preferring pre-built
|
|
59
|
+
* filter SQL (for parameter deduplication) and skipping CTE-handled cubes.
|
|
60
|
+
*/
|
|
61
|
+
private appendWhereFilter;
|
|
62
|
+
/** Append a time dimension's date-range WHERE condition (cached when possible). */
|
|
63
|
+
private appendTimeDimensionWhere;
|
|
64
|
+
/** Whether a cube is materialized in a pre-aggregation CTE of the plan. */
|
|
65
|
+
private cubeIsInCTE;
|
|
57
66
|
/**
|
|
58
67
|
* Build HAVING conditions from semantic query filters (measures only)
|
|
59
68
|
* Works for both single and multi-cube queries
|
|
@@ -64,6 +73,8 @@ export declare class DrizzleSqlBuilder {
|
|
|
64
73
|
* @param filterType - 'where' for dimension filters, 'having' for measure filters
|
|
65
74
|
*/
|
|
66
75
|
private processFilter;
|
|
76
|
+
/** Build a WHERE condition for a dimension filter, honouring CTE skips and the filter cache. */
|
|
77
|
+
private processWhereDimensionFilter;
|
|
67
78
|
/**
|
|
68
79
|
* Build filter condition using Drizzle operators
|
|
69
80
|
* Delegates to FilterBuilder
|
|
@@ -2,5 +2,7 @@ export { buildCTEState } from './cte-processor';
|
|
|
2
2
|
export { buildModifiedSelections } from './selection-processor';
|
|
3
3
|
export { applyJoins } from './joins-processor';
|
|
4
4
|
export { applyPredicatesAndFinalize } from './predicates-processor';
|
|
5
|
+
export { buildKeysDeduplicationQuery } from './keys-dedup-processor';
|
|
6
|
+
export { buildMultiFactMergeQuery } from './multi-fact-processor';
|
|
5
7
|
export type { PhysicalBuildDependencies, CTEBuildState, JoinBuildState, SelectionMap, DownstreamJoinState } from './shared';
|
|
6
8
|
export { getCubesFromPlan } from './shared';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PhysicalQueryPlan, QueryContext, SemanticQuery } from '../../types';
|
|
2
|
+
import { PhysicalBuildDependencies } from './shared';
|
|
3
|
+
/**
|
|
4
|
+
* Build the dual-CTE keys-deduplication query, or return null when the plan
|
|
5
|
+
* does not qualify (caller falls back to the standard build).
|
|
6
|
+
*
|
|
7
|
+
* The query splits into:
|
|
8
|
+
* - a "keys" CTE that groups by the query grain + multiplied cube primary key
|
|
9
|
+
* (pre-aggregating regular measures), and
|
|
10
|
+
* - a "pk_agg" CTE that pre-aggregates the multiplied cube's measures per PK,
|
|
11
|
+
* then re-aggregates both in an outer query joined on the primary key.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildKeysDeduplicationQuery(queryPlan: PhysicalQueryPlan, query: SemanticQuery, context: QueryContext, deps: PhysicalBuildDependencies): any | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PhysicalQueryPlan, QueryContext, SemanticQuery } from '../../types';
|
|
2
|
+
import { PhysicalBuildDependencies } from './shared';
|
|
3
|
+
/**
|
|
4
|
+
* Build a function for `build()` so each group CTE can be materialized through
|
|
5
|
+
* the standard physical-plan builder without a class dependency.
|
|
6
|
+
*/
|
|
7
|
+
export type GroupQueryBuilder = (queryPlan: PhysicalQueryPlan, query: SemanticQuery, context: QueryContext) => any;
|
|
8
|
+
/**
|
|
9
|
+
* Build a multi-fact-merge query (joining independent measure groups on shared
|
|
10
|
+
* grain keys), or return null when the plan does not qualify. Falls back to a
|
|
11
|
+
* UNION-of-keys strategy when a FULL OUTER JOIN is requested but unsupported.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildMultiFactMergeQuery(queryPlan: PhysicalQueryPlan, query: SemanticQuery, context: QueryContext, deps: PhysicalBuildDependencies, buildGroup: GroupQueryBuilder): any | null;
|
|
@@ -30,4 +30,9 @@ export interface JoinBuildState {
|
|
|
30
30
|
absorbedIntermediateCubes: Set<string>;
|
|
31
31
|
}
|
|
32
32
|
export type SelectionMap = Record<string, any>;
|
|
33
|
+
/**
|
|
34
|
+
* Apply a join of the given type to a Drizzle query builder.
|
|
35
|
+
* Shared by the physical-plan builders that assemble CTE/merge queries.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyJoinByType(drizzleQuery: any, joinType: 'inner' | 'left' | 'right' | 'full', joinTarget: any, joinCondition: SQL): any;
|
|
33
38
|
export declare function getCubesFromPlan(queryPlan: PhysicalQueryPlan): Map<string, Cube>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { SemanticLayerCompiler } from './compiler';
|
|
2
|
+
import { SemanticQuery, SecurityContext } from './types';
|
|
3
|
+
import { CubeDiscoveryResult } from './ai/discovery';
|
|
4
|
+
/**
|
|
5
|
+
* Discovery request body
|
|
6
|
+
*/
|
|
7
|
+
export interface DiscoverRequest {
|
|
8
|
+
/** Topic or keyword to search for */
|
|
9
|
+
topic?: string;
|
|
10
|
+
/** Natural language intent */
|
|
11
|
+
intent?: string;
|
|
12
|
+
/** Maximum results to return */
|
|
13
|
+
limit?: number;
|
|
14
|
+
/** Minimum relevance score (0-1) */
|
|
15
|
+
minScore?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Load request body - execute a query
|
|
19
|
+
*/
|
|
20
|
+
export interface LoadRequest {
|
|
21
|
+
/** Query to execute */
|
|
22
|
+
query: SemanticQuery;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Discovery response shape returned by `handleDiscover`.
|
|
26
|
+
*
|
|
27
|
+
* In addition to the matched cubes, the response embeds the full query
|
|
28
|
+
* language reference and the date filtering decision tree. This is the
|
|
29
|
+
* primary delivery mechanism for query-construction guidance: clients
|
|
30
|
+
* cannot be relied upon to forward `prompts/*` content to the model, so
|
|
31
|
+
* we piggyback on `discover` (the mandated first call in our workflow)
|
|
32
|
+
* to guarantee the model sees the rules before it builds a query.
|
|
33
|
+
*
|
|
34
|
+
* The fields are stable strings — consumers may render or strip them as
|
|
35
|
+
* they see fit, but the MCP `discover` tool relies on them being present.
|
|
36
|
+
*/
|
|
37
|
+
export interface DiscoverResponse {
|
|
38
|
+
/** Matched cubes (possibly empty) with measures, dimensions, and joins */
|
|
39
|
+
cubes: CubeDiscoveryResult[];
|
|
40
|
+
/**
|
|
41
|
+
* Complete TypeScript DSL reference for query construction. Source of
|
|
42
|
+
* truth for field naming, filter operators, time dimensions, and
|
|
43
|
+
* analysis modes (funnel/flow/retention).
|
|
44
|
+
*/
|
|
45
|
+
queryLanguageReference: string;
|
|
46
|
+
/**
|
|
47
|
+
* Decision tree for date filtering vs time grouping. The single most
|
|
48
|
+
* common source of incorrect queries — read this whenever the user
|
|
49
|
+
* mentions a time period.
|
|
50
|
+
*/
|
|
51
|
+
dateFilteringGuide: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Handle /discover endpoint - find relevant cubes based on topic/intent.
|
|
55
|
+
*
|
|
56
|
+
* Always returns `queryLanguageReference` and `dateFilteringGuide` alongside
|
|
57
|
+
* the matched cubes. See `DiscoverResponse` for the rationale.
|
|
58
|
+
*/
|
|
59
|
+
export declare function handleDiscover(semanticLayer: SemanticLayerCompiler, body: DiscoverRequest): Promise<DiscoverResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Normalize AI-generated query fields before validation/execution.
|
|
62
|
+
* Fixes common LLM mistakes:
|
|
63
|
+
* - Double-prefixed fields: "Teams.Teams.name" -> "Teams.name"
|
|
64
|
+
* - Order as array: [{key: dir}] -> {key: dir}
|
|
65
|
+
* - Underscore order keys: "Teams_count" -> "Teams.count"
|
|
66
|
+
* - Invalid order keys dropped (falls back to first measure desc)
|
|
67
|
+
*
|
|
68
|
+
* This runs in the shared handleLoad path so both MCP and Agent benefit.
|
|
69
|
+
*/
|
|
70
|
+
export declare function normalizeQueryFields(query: Record<string, unknown>): Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Handle /load endpoint - execute a query and return results
|
|
73
|
+
* This completes the AI workflow: discover → suggest → validate → load
|
|
74
|
+
*/
|
|
75
|
+
export declare function handleLoad(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: LoadRequest): Promise<{
|
|
76
|
+
data: Record<string, unknown>[];
|
|
77
|
+
annotation: any;
|
|
78
|
+
query: SemanticQuery;
|
|
79
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SemanticQuery } from './types';
|
|
2
|
+
export type QueryMode = 'regular' | 'comparison' | 'funnel' | 'flow' | 'retention';
|
|
3
|
+
export interface QueryModeFlags {
|
|
4
|
+
comparison: boolean;
|
|
5
|
+
funnel: boolean;
|
|
6
|
+
flow: boolean;
|
|
7
|
+
retention: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** A query is a comparison when a time dimension carries a compareDateRange with ≥2 ranges. */
|
|
10
|
+
export declare function hasComparisonMode(query: SemanticQuery): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A query is a funnel when it has a funnel config with ≥2 steps.
|
|
13
|
+
* Null-safe on `steps` — a `funnel: {}` payload must not throw here.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasFunnelMode(query: SemanticQuery): boolean;
|
|
16
|
+
/** A query is a flow when it has a flow config with a startingStep and eventDimension. */
|
|
17
|
+
export declare function hasFlowMode(query: SemanticQuery): boolean;
|
|
18
|
+
/** A query is a retention when it has a retention config with a timeDimension and bindingKey. */
|
|
19
|
+
export declare function hasRetentionMode(query: SemanticQuery): boolean;
|
|
20
|
+
/** Per-mode booleans for a query. */
|
|
21
|
+
export declare function detectQueryModes(query: SemanticQuery): QueryModeFlags;
|
|
22
|
+
/**
|
|
23
|
+
* Active non-regular modes for a query, in execution-priority order
|
|
24
|
+
* (comparison, funnel, flow, retention). A well-formed query matches at most one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getActiveQueryModes(query: SemanticQuery): Exclude<QueryMode, 'regular'>[];
|
|
27
|
+
/** The single priority mode for a query, or 'regular' when none match. */
|
|
28
|
+
export declare function detectQueryMode(query: SemanticQuery): QueryMode;
|