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,332 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Database capabilities for feature detection
|
|
5
|
+
* Used for graceful degradation when functions aren't supported
|
|
6
|
+
*/
|
|
7
|
+
export interface DatabaseCapabilities {
|
|
8
|
+
/** Whether the database supports PERCENTILE_CONT or similar */
|
|
9
|
+
supportsPercentile: boolean;
|
|
10
|
+
/** Whether the database supports LATERAL joins (PostgreSQL 9.3+, MySQL 8.0.14+) */
|
|
11
|
+
supportsLateralJoins: boolean;
|
|
12
|
+
/** Whether percentile functions work in subqueries against CTEs (false for DuckDB) */
|
|
13
|
+
supportsPercentileSubqueries: boolean;
|
|
14
|
+
/** Whether correlated LATERAL subqueries can reference CTEs (false for Snowflake) */
|
|
15
|
+
supportsLateralSubqueriesInCTE: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Window function types supported by the adapter
|
|
19
|
+
*/
|
|
20
|
+
export type WindowFunctionType = 'lag' | 'lead' | 'rank' | 'denseRank' | 'rowNumber' | 'ntile' | 'firstValue' | 'lastValue' | 'movingAvg' | 'movingSum';
|
|
21
|
+
/**
|
|
22
|
+
* Window function configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface WindowFunctionConfig {
|
|
25
|
+
/** Number of rows to offset for lag/lead */
|
|
26
|
+
offset?: number;
|
|
27
|
+
/** Default value when offset is out of bounds */
|
|
28
|
+
defaultValue?: any;
|
|
29
|
+
/** Number of buckets for ntile */
|
|
30
|
+
nTile?: number;
|
|
31
|
+
/** Frame specification for moving aggregates */
|
|
32
|
+
frame?: {
|
|
33
|
+
type: 'rows' | 'range';
|
|
34
|
+
start: number | 'unbounded';
|
|
35
|
+
end: number | 'current' | 'unbounded';
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface DatabaseAdapter {
|
|
39
|
+
/**
|
|
40
|
+
* Get the database engine type this adapter supports
|
|
41
|
+
*/
|
|
42
|
+
getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
43
|
+
/**
|
|
44
|
+
* Build SQL INTERVAL from ISO 8601 duration string
|
|
45
|
+
* Used for time window constraints in funnel analysis
|
|
46
|
+
* @param duration - ISO 8601 duration (e.g., "P7D" for 7 days, "PT1H" for 1 hour)
|
|
47
|
+
* @returns SQL expression representing the interval
|
|
48
|
+
*/
|
|
49
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
50
|
+
/**
|
|
51
|
+
* Build time difference expression in seconds between two timestamps
|
|
52
|
+
* Used for calculating time-to-convert metrics in funnel analysis
|
|
53
|
+
* @param end - End timestamp expression
|
|
54
|
+
* @param start - Start timestamp expression
|
|
55
|
+
* @returns SQL expression for (end - start) in seconds
|
|
56
|
+
*/
|
|
57
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
58
|
+
/**
|
|
59
|
+
* Build expression to add an ISO 8601 duration to a timestamp
|
|
60
|
+
* Used for time window constraint checks in funnel analysis
|
|
61
|
+
* @param timestamp - Base timestamp expression
|
|
62
|
+
* @param duration - ISO 8601 duration to add
|
|
63
|
+
* @returns SQL expression for timestamp + interval
|
|
64
|
+
*/
|
|
65
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
66
|
+
/**
|
|
67
|
+
* Build conditional aggregation with database-specific syntax
|
|
68
|
+
* Used for single-pass funnel metrics aggregation
|
|
69
|
+
* PostgreSQL uses FILTER clause, MySQL/SQLite use CASE WHEN
|
|
70
|
+
* @param aggFn - Aggregation function: 'count' | 'avg' | 'min' | 'max' | 'sum'
|
|
71
|
+
* @param expr - Expression to aggregate (null for COUNT(*))
|
|
72
|
+
* @param condition - Condition for filtering
|
|
73
|
+
* @returns SQL for conditional aggregation
|
|
74
|
+
*/
|
|
75
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
76
|
+
/**
|
|
77
|
+
* Build date difference expression in specified periods
|
|
78
|
+
* Used for retention analysis to calculate period numbers
|
|
79
|
+
* @param startDate - Start date expression
|
|
80
|
+
* @param endDate - End date expression
|
|
81
|
+
* @param unit - Unit for difference ('day' | 'week' | 'month')
|
|
82
|
+
* @returns SQL expression for date difference in periods
|
|
83
|
+
*/
|
|
84
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
85
|
+
/**
|
|
86
|
+
* Build a subquery that generates a series of period numbers (0 to maxPeriod)
|
|
87
|
+
* Used for retention analysis to cross-join with user data
|
|
88
|
+
* @param maxPeriod - Maximum period number to generate
|
|
89
|
+
* @returns SQL expression for period series subquery with alias 'p' containing 'period_number' column
|
|
90
|
+
*/
|
|
91
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
92
|
+
/**
|
|
93
|
+
* Build time dimension expression with granularity truncation
|
|
94
|
+
* @param granularity - Time granularity (day, month, year, etc.)
|
|
95
|
+
* @param fieldExpr - The date/timestamp field expression
|
|
96
|
+
* @returns SQL expression for truncated time dimension
|
|
97
|
+
*/
|
|
98
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
99
|
+
/**
|
|
100
|
+
* Build string matching condition
|
|
101
|
+
* @param fieldExpr - The field to search in
|
|
102
|
+
* @param operator - The string matching operator
|
|
103
|
+
* @param value - The value to match
|
|
104
|
+
* @returns SQL expression for string matching
|
|
105
|
+
*/
|
|
106
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
107
|
+
/**
|
|
108
|
+
* Cast expression to specific database type
|
|
109
|
+
* @param fieldExpr - The field expression to cast
|
|
110
|
+
* @param targetType - Target database type
|
|
111
|
+
* @returns SQL expression with type casting
|
|
112
|
+
*/
|
|
113
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
114
|
+
/**
|
|
115
|
+
* Build AVG aggregation expression with database-specific null handling
|
|
116
|
+
* @param fieldExpr - The field expression to average
|
|
117
|
+
* @returns SQL expression for AVG aggregation (COALESCE vs IFNULL for null handling)
|
|
118
|
+
*/
|
|
119
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
120
|
+
/**
|
|
121
|
+
* Build CASE WHEN conditional expression
|
|
122
|
+
* @param conditions - Array of condition/result pairs
|
|
123
|
+
* @param elseValue - Optional ELSE clause value
|
|
124
|
+
* @returns SQL expression for CASE WHEN statement
|
|
125
|
+
*/
|
|
126
|
+
buildCaseWhen(conditions: Array<{
|
|
127
|
+
when: SQL;
|
|
128
|
+
then: any;
|
|
129
|
+
}>, elseValue?: any): SQL;
|
|
130
|
+
/**
|
|
131
|
+
* Build boolean literal expression
|
|
132
|
+
* @param value - Boolean value to represent
|
|
133
|
+
* @returns SQL expression for boolean literal (TRUE/FALSE/1/0 depending on database)
|
|
134
|
+
*/
|
|
135
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
136
|
+
/**
|
|
137
|
+
* Convert filter values to database-compatible types
|
|
138
|
+
* @param value - The filter value to convert
|
|
139
|
+
* @returns Converted value for database queries
|
|
140
|
+
*/
|
|
141
|
+
convertFilterValue(value: any): any;
|
|
142
|
+
/**
|
|
143
|
+
* Prepare date value for database-specific storage format
|
|
144
|
+
* @param date - Date value to prepare
|
|
145
|
+
* @returns Database-compatible date representation
|
|
146
|
+
*/
|
|
147
|
+
prepareDateValue(date: Date): any;
|
|
148
|
+
/**
|
|
149
|
+
* Check if this database stores timestamps as integers
|
|
150
|
+
* @returns True if timestamps are stored as integers (milliseconds), false for native timestamps
|
|
151
|
+
*/
|
|
152
|
+
isTimestampInteger(): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Convert time dimension result values back to Date objects for consistency
|
|
155
|
+
* @param value - The time dimension value from query results
|
|
156
|
+
* @returns Date object or original value if not a time dimension
|
|
157
|
+
*/
|
|
158
|
+
convertTimeDimensionResult(value: any): any;
|
|
159
|
+
/**
|
|
160
|
+
* Preprocess calculated measure template for database-specific transformations
|
|
161
|
+
* This allows each adapter to modify the template before substitution occurs
|
|
162
|
+
* @param calculatedSql - The template string with {member} references
|
|
163
|
+
* @returns Preprocessed template string
|
|
164
|
+
*/
|
|
165
|
+
preprocessCalculatedTemplate(calculatedSql: string): string;
|
|
166
|
+
/**
|
|
167
|
+
* Get database capabilities for feature detection
|
|
168
|
+
* Used for graceful degradation when functions aren't supported
|
|
169
|
+
*/
|
|
170
|
+
getCapabilities(): DatabaseCapabilities;
|
|
171
|
+
/**
|
|
172
|
+
* Build STDDEV aggregation expression
|
|
173
|
+
* @param fieldExpr - The field expression to calculate stddev for
|
|
174
|
+
* @param useSample - Use sample stddev (STDDEV_SAMP) vs population (STDDEV_POP). Default: false
|
|
175
|
+
* @returns SQL expression or null if unsupported
|
|
176
|
+
*/
|
|
177
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
178
|
+
/**
|
|
179
|
+
* Build VARIANCE aggregation expression
|
|
180
|
+
* @param fieldExpr - The field expression to calculate variance for
|
|
181
|
+
* @param useSample - Use sample variance (VAR_SAMP) vs population (VAR_POP). Default: false
|
|
182
|
+
* @returns SQL expression or null if unsupported
|
|
183
|
+
*/
|
|
184
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
185
|
+
/**
|
|
186
|
+
* Build PERCENTILE aggregation expression
|
|
187
|
+
* @param fieldExpr - The field expression to calculate percentile for
|
|
188
|
+
* @param percentile - Percentile value (0-100)
|
|
189
|
+
* @returns SQL expression or null if unsupported
|
|
190
|
+
*/
|
|
191
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL | null;
|
|
192
|
+
/**
|
|
193
|
+
* Build a window function expression
|
|
194
|
+
* @param type - Window function type (lag, lead, rank, etc.)
|
|
195
|
+
* @param fieldExpr - The field expression (null for rank functions that don't need a field)
|
|
196
|
+
* @param partitionBy - PARTITION BY columns
|
|
197
|
+
* @param orderBy - ORDER BY columns with direction
|
|
198
|
+
* @param config - Additional configuration (offset, default, frame, etc.)
|
|
199
|
+
* @returns SQL expression or null if unsupported
|
|
200
|
+
*/
|
|
201
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
202
|
+
field: AnyColumn | SQL;
|
|
203
|
+
direction: 'asc' | 'desc';
|
|
204
|
+
}>, config?: WindowFunctionConfig): SQL | null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Abstract base class for database adapters
|
|
208
|
+
* Provides common functionality that can be shared across database implementations
|
|
209
|
+
*/
|
|
210
|
+
export declare abstract class BaseDatabaseAdapter implements DatabaseAdapter {
|
|
211
|
+
abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
212
|
+
abstract buildIntervalFromISO(duration: string): SQL;
|
|
213
|
+
abstract buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
214
|
+
abstract buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
215
|
+
abstract buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
216
|
+
abstract buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
217
|
+
abstract buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
218
|
+
abstract castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
219
|
+
abstract getCapabilities(): DatabaseCapabilities;
|
|
220
|
+
abstract buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL | null;
|
|
221
|
+
/**
|
|
222
|
+
* Default implementation returns template unchanged
|
|
223
|
+
* Override in specific adapters for database-specific preprocessing
|
|
224
|
+
*/
|
|
225
|
+
preprocessCalculatedTemplate(calculatedSql: string): string;
|
|
226
|
+
/**
|
|
227
|
+
* Wrap an aggregate so NULL (empty set) becomes 0.
|
|
228
|
+
* Default uses COALESCE; engines without COALESCE (MySQL/SQLite) override with IFNULL.
|
|
229
|
+
*/
|
|
230
|
+
protected nullToZero(expr: SQL): SQL;
|
|
231
|
+
/**
|
|
232
|
+
* Case-insensitive LIKE matching for contains/startsWith/endsWith/ilike.
|
|
233
|
+
* Default uses native ILIKE (PostgreSQL/DuckDB/Snowflake); engines without ILIKE
|
|
234
|
+
* (MySQL/SQLite/Databend) override with LOWER()+LIKE.
|
|
235
|
+
* @param pattern - the LIKE pattern in its original case (already wrapped with % as needed)
|
|
236
|
+
*/
|
|
237
|
+
protected caseInsensitiveLike(fieldExpr: AnyColumn | SQL, pattern: string, negated: boolean): SQL;
|
|
238
|
+
/**
|
|
239
|
+
* Regular-expression matching. Default uses PostgreSQL's ~* / !~* operators;
|
|
240
|
+
* each other engine overrides with its own regex syntax (REGEXP, GLOB, regexp_matches, REGEXP_LIKE).
|
|
241
|
+
*/
|
|
242
|
+
protected regexCondition(fieldExpr: AnyColumn | SQL, value: string, negated: boolean): SQL;
|
|
243
|
+
/**
|
|
244
|
+
* Build a string matching condition. The case-insensitive and regex families are
|
|
245
|
+
* delegated to the caseInsensitiveLike()/regexCondition() hooks; plain LIKE/NOT LIKE
|
|
246
|
+
* are identical across all engines.
|
|
247
|
+
*/
|
|
248
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
249
|
+
/**
|
|
250
|
+
* Build conditional aggregation. Default uses portable CASE WHEN
|
|
251
|
+
* (MySQL/SQLite/Databend/Snowflake); PostgreSQL/DuckDB override with the FILTER clause.
|
|
252
|
+
*/
|
|
253
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
254
|
+
/**
|
|
255
|
+
* Build AVG with null-to-zero handling (COALESCE/IFNULL via nullToZero()).
|
|
256
|
+
*/
|
|
257
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
258
|
+
/**
|
|
259
|
+
* Build CASE WHEN conditional expression.
|
|
260
|
+
* SQLite overrides this to handle embedded SQL objects in THEN/ELSE.
|
|
261
|
+
*/
|
|
262
|
+
buildCaseWhen(conditions: Array<{
|
|
263
|
+
when: SQL;
|
|
264
|
+
then: any;
|
|
265
|
+
}>, elseValue?: any): SQL;
|
|
266
|
+
/**
|
|
267
|
+
* Build boolean literal. Default uses TRUE/FALSE keywords; SQLite overrides with 1/0.
|
|
268
|
+
*/
|
|
269
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
270
|
+
/**
|
|
271
|
+
* Convert filter values to database-compatible types.
|
|
272
|
+
* Default is a pass-through; SQLite overrides to handle booleans/dates as integers.
|
|
273
|
+
*/
|
|
274
|
+
convertFilterValue(value: any): any;
|
|
275
|
+
/**
|
|
276
|
+
* Prepare a Date for storage. Default passes the Date through (native timestamps);
|
|
277
|
+
* SQLite overrides to convert to integer milliseconds.
|
|
278
|
+
*/
|
|
279
|
+
prepareDateValue(date: Date): any;
|
|
280
|
+
/**
|
|
281
|
+
* Whether timestamps are stored as integers. Default false; SQLite overrides to true.
|
|
282
|
+
*/
|
|
283
|
+
isTimestampInteger(): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Convert a time-dimension result value. Default is a pass-through.
|
|
286
|
+
*/
|
|
287
|
+
convertTimeDimensionResult(value: any): any;
|
|
288
|
+
/**
|
|
289
|
+
* Build STDDEV aggregation. Default uses STDDEV_POP/STDDEV_SAMP with null-to-zero.
|
|
290
|
+
* Engines without native STDDEV (SQLite) override to return null.
|
|
291
|
+
*/
|
|
292
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
293
|
+
/**
|
|
294
|
+
* Build VARIANCE aggregation. Default uses VAR_POP/VAR_SAMP with null-to-zero.
|
|
295
|
+
* SQLite overrides to null; Databend overrides to a COVAR-based workaround.
|
|
296
|
+
*/
|
|
297
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
298
|
+
/**
|
|
299
|
+
* Build a window function expression. Identical across all supported engines
|
|
300
|
+
* (standard SQL:2003 window syntax), so it lives here as a shared default.
|
|
301
|
+
*/
|
|
302
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
303
|
+
field: AnyColumn | SQL;
|
|
304
|
+
direction: 'asc' | 'desc';
|
|
305
|
+
}>, config?: WindowFunctionConfig): SQL | null;
|
|
306
|
+
/**
|
|
307
|
+
* Helper method to build pattern for string matching
|
|
308
|
+
* Can be overridden by specific adapters if needed
|
|
309
|
+
*/
|
|
310
|
+
protected buildPattern(operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith', value: string): string;
|
|
311
|
+
/**
|
|
312
|
+
* Parse ISO 8601 duration into components
|
|
313
|
+
* Supports P[n]Y[n]M[n]DT[n]H[n]M[n]S format
|
|
314
|
+
* @param duration - ISO 8601 duration string (e.g., "P7D", "PT1H30M", "P1DT2H")
|
|
315
|
+
* @returns Parsed duration components
|
|
316
|
+
*/
|
|
317
|
+
protected parseISODuration(duration: string): {
|
|
318
|
+
years: number;
|
|
319
|
+
months: number;
|
|
320
|
+
days: number;
|
|
321
|
+
hours: number;
|
|
322
|
+
minutes: number;
|
|
323
|
+
seconds: number;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Convert ISO 8601 duration to total seconds
|
|
327
|
+
* Note: Months and years are approximated (30 days/month, 365 days/year)
|
|
328
|
+
* @param duration - ISO 8601 duration string
|
|
329
|
+
* @returns Total seconds
|
|
330
|
+
*/
|
|
331
|
+
protected durationToSeconds(duration: string): number;
|
|
332
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities } from './base-adapter';
|
|
4
|
+
export declare class DatabendAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'databend';
|
|
6
|
+
/**
|
|
7
|
+
* Build Databend INTERVAL from ISO 8601 duration
|
|
8
|
+
* Databend supports INTERVAL n UNIT syntax (e.g., INTERVAL 7 DAY)
|
|
9
|
+
*/
|
|
10
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
11
|
+
/**
|
|
12
|
+
* Build Databend time difference in seconds
|
|
13
|
+
* Uses TIMESTAMPDIFF(SECOND, start, end)
|
|
14
|
+
*/
|
|
15
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
16
|
+
/**
|
|
17
|
+
* Build Databend timestamp + interval expression
|
|
18
|
+
* Uses timestamp + INTERVAL n UNIT syntax (Databend doesn't support DATE_ADD function)
|
|
19
|
+
*/
|
|
20
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
21
|
+
/**
|
|
22
|
+
* Build Databend date difference in periods using DATE_DIFF
|
|
23
|
+
*/
|
|
24
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
25
|
+
/**
|
|
26
|
+
* Build Databend period series using generate_series via numbers table
|
|
27
|
+
* Databend has a numbers() table function that can be used similarly
|
|
28
|
+
*/
|
|
29
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
30
|
+
/**
|
|
31
|
+
* Build Databend time dimension using DATE_TRUNC function
|
|
32
|
+
* Databend supports DATE_TRUNC with unquoted granularity keywords
|
|
33
|
+
*/
|
|
34
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
35
|
+
/**
|
|
36
|
+
* Databend has no ILIKE — use LOWER()+LIKE with SQL-side LOWER() on the pattern.
|
|
37
|
+
*/
|
|
38
|
+
protected caseInsensitiveLike(fieldExpr: AnyColumn | SQL, pattern: string, negated: boolean): SQL;
|
|
39
|
+
/**
|
|
40
|
+
* Databend regex matching uses the REGEXP operator
|
|
41
|
+
*/
|
|
42
|
+
protected regexCondition(fieldExpr: AnyColumn | SQL, value: string, negated: boolean): SQL;
|
|
43
|
+
/**
|
|
44
|
+
* Build Databend type casting
|
|
45
|
+
* Databend supports both :: syntax and CAST() function
|
|
46
|
+
*/
|
|
47
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
48
|
+
/**
|
|
49
|
+
* Databend capabilities - start conservative
|
|
50
|
+
*/
|
|
51
|
+
getCapabilities(): DatabaseCapabilities;
|
|
52
|
+
/**
|
|
53
|
+
* Build Databend VARIANCE aggregation
|
|
54
|
+
* Databend doesn't have VAR_POP/VAR_SAMP, but COVAR_POP(x,x) = VAR_POP(x)
|
|
55
|
+
* and COVAR_SAMP(x,x) = VAR_SAMP(x) mathematically
|
|
56
|
+
*/
|
|
57
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
58
|
+
/**
|
|
59
|
+
* Build Databend PERCENTILE aggregation
|
|
60
|
+
* Databend may support QUANTILE or PERCENTILE_CONT - start with unsupported
|
|
61
|
+
*/
|
|
62
|
+
buildPercentile(_fieldExpr: AnyColumn | SQL, _percentile: number): SQL;
|
|
63
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities } from './base-adapter';
|
|
4
|
+
export declare class DuckDBAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'duckdb';
|
|
6
|
+
/**
|
|
7
|
+
* DuckDB does not support non-constant LIMIT in correlated subqueries,
|
|
8
|
+
* which is required for the LATERAL join strategy in flow queries.
|
|
9
|
+
* Use window function strategy instead.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Build DuckDB INTERVAL from ISO 8601 duration
|
|
13
|
+
* DuckDB supports PostgreSQL-style INTERVAL literal syntax: INTERVAL '7 days'
|
|
14
|
+
*/
|
|
15
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
16
|
+
/**
|
|
17
|
+
* Build DuckDB time difference in seconds using EPOCH() function
|
|
18
|
+
* DuckDB uses EPOCH(timestamp) instead of EXTRACT(EPOCH FROM timestamp)
|
|
19
|
+
* Returns (end - start) as seconds
|
|
20
|
+
*/
|
|
21
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
22
|
+
/**
|
|
23
|
+
* Build DuckDB timestamp + interval expression
|
|
24
|
+
*/
|
|
25
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
26
|
+
/**
|
|
27
|
+
* Build DuckDB conditional aggregation using the FILTER clause
|
|
28
|
+
* DuckDB supports the standard SQL FILTER clause like PostgreSQL
|
|
29
|
+
*/
|
|
30
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
31
|
+
/**
|
|
32
|
+
* Build DuckDB date difference in periods using DATE_DIFF
|
|
33
|
+
* DuckDB has native DATE_DIFF function with unit support
|
|
34
|
+
*/
|
|
35
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
36
|
+
/**
|
|
37
|
+
* Build DuckDB period series using UNNEST(generate_series(...))
|
|
38
|
+
* DuckDB's generate_series returns an array, so we need to UNNEST it to get a table
|
|
39
|
+
*/
|
|
40
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
41
|
+
/**
|
|
42
|
+
* Build DuckDB time dimension using DATE_TRUNC function
|
|
43
|
+
* DuckDB uses DATE_TRUNC like PostgreSQL
|
|
44
|
+
*/
|
|
45
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
46
|
+
/**
|
|
47
|
+
* DuckDB uses function-style regex matching: regexp_matches(field, pattern)
|
|
48
|
+
*/
|
|
49
|
+
protected regexCondition(fieldExpr: AnyColumn | SQL, value: string, negated: boolean): SQL;
|
|
50
|
+
/**
|
|
51
|
+
* Build DuckDB type casting
|
|
52
|
+
* DuckDB supports both :: syntax and CAST() function
|
|
53
|
+
*/
|
|
54
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
55
|
+
/**
|
|
56
|
+
* DuckDB has full support for statistical and window functions
|
|
57
|
+
* Note: supportsPercentileSubqueries is false because DuckDB's QUANTILE_CONT
|
|
58
|
+
* doesn't work well in scalar subqueries against CTEs in funnel queries
|
|
59
|
+
* Note: supportsLateralJoins is false because DuckDB doesn't support non-constant
|
|
60
|
+
* LIMIT in correlated subqueries, which is required for flow query LATERAL joins
|
|
61
|
+
*/
|
|
62
|
+
getCapabilities(): DatabaseCapabilities;
|
|
63
|
+
/**
|
|
64
|
+
* Build DuckDB PERCENTILE aggregation
|
|
65
|
+
* DuckDB uses QUANTILE_CONT instead of PERCENTILE_CONT
|
|
66
|
+
*/
|
|
67
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
68
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities } from './base-adapter';
|
|
4
|
+
export declare class MySQLAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'mysql' | 'singlestore';
|
|
6
|
+
/**
|
|
7
|
+
* Build MySQL INTERVAL from ISO 8601 duration
|
|
8
|
+
* MySQL has no standalone interval literal usable in arithmetic, so we convert
|
|
9
|
+
* to total seconds for consistent handling.
|
|
10
|
+
*/
|
|
11
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
12
|
+
/**
|
|
13
|
+
* Build MySQL time difference in seconds using TIMESTAMPDIFF
|
|
14
|
+
* Returns (end - start) as seconds
|
|
15
|
+
*/
|
|
16
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
17
|
+
/**
|
|
18
|
+
* Build MySQL timestamp + interval expression
|
|
19
|
+
* Uses a chain of DATE_ADD calls, one per duration component
|
|
20
|
+
*/
|
|
21
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
22
|
+
/**
|
|
23
|
+
* Build MySQL date difference in periods using TIMESTAMPDIFF
|
|
24
|
+
* For retention analysis period calculations
|
|
25
|
+
*/
|
|
26
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
27
|
+
/**
|
|
28
|
+
* Build MySQL period series using recursive CTE
|
|
29
|
+
* MySQL 8.0+ supports recursive CTEs for generating sequences
|
|
30
|
+
*/
|
|
31
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
32
|
+
/**
|
|
33
|
+
* Build MySQL time dimension using DATE_FORMAT function
|
|
34
|
+
* MySQL equivalent to PostgreSQL's DATE_TRUNC
|
|
35
|
+
*/
|
|
36
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
37
|
+
/**
|
|
38
|
+
* MySQL has no ILIKE — use LOWER()+LIKE with the pattern lowercased in JS.
|
|
39
|
+
*/
|
|
40
|
+
protected caseInsensitiveLike(fieldExpr: AnyColumn | SQL, pattern: string, negated: boolean): SQL;
|
|
41
|
+
/**
|
|
42
|
+
* MySQL regex matching uses the REGEXP operator
|
|
43
|
+
*/
|
|
44
|
+
protected regexCondition(fieldExpr: AnyColumn | SQL, value: string, negated: boolean): SQL;
|
|
45
|
+
/**
|
|
46
|
+
* Build MySQL type casting using CAST() function
|
|
47
|
+
* MySQL equivalent to PostgreSQL's :: casting syntax
|
|
48
|
+
*/
|
|
49
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
50
|
+
/**
|
|
51
|
+
* MySQL AVG/STDDEV/VARIANCE use IFNULL (no COALESCE-for-zero idiom mismatch,
|
|
52
|
+
* but IFNULL is the MySQL-idiomatic null guard).
|
|
53
|
+
*/
|
|
54
|
+
protected nullToZero(expr: SQL): SQL;
|
|
55
|
+
/**
|
|
56
|
+
* MySQL 8.0+ has support for statistical and window functions
|
|
57
|
+
* but not PERCENTILE_CONT
|
|
58
|
+
*/
|
|
59
|
+
getCapabilities(): DatabaseCapabilities;
|
|
60
|
+
/**
|
|
61
|
+
* MySQL does not support PERCENTILE_CONT
|
|
62
|
+
* Returns null for graceful degradation
|
|
63
|
+
*/
|
|
64
|
+
buildPercentile(_fieldExpr: AnyColumn | SQL, _percentile: number): SQL | null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities } from './base-adapter';
|
|
4
|
+
export declare class PostgresAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'postgres';
|
|
6
|
+
/**
|
|
7
|
+
* Build PostgreSQL INTERVAL from ISO 8601 duration
|
|
8
|
+
* PostgreSQL supports INTERVAL literal syntax: INTERVAL '7 days'
|
|
9
|
+
*/
|
|
10
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
11
|
+
/**
|
|
12
|
+
* Build PostgreSQL time difference in seconds using EXTRACT(EPOCH FROM ...)
|
|
13
|
+
* Returns (end - start) as seconds
|
|
14
|
+
*/
|
|
15
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
16
|
+
/**
|
|
17
|
+
* Build PostgreSQL timestamp + interval expression
|
|
18
|
+
*/
|
|
19
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
20
|
+
/**
|
|
21
|
+
* Build PostgreSQL conditional aggregation using FILTER clause
|
|
22
|
+
* PostgreSQL supports the standard SQL FILTER clause for efficient conditional aggregation
|
|
23
|
+
* Example: AVG(time_diff) FILTER (WHERE step_1_time IS NOT NULL)
|
|
24
|
+
*/
|
|
25
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
26
|
+
/**
|
|
27
|
+
* Build PostgreSQL date difference in periods using AGE and EXTRACT
|
|
28
|
+
* For retention analysis period calculations
|
|
29
|
+
*/
|
|
30
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
31
|
+
/**
|
|
32
|
+
* Build PostgreSQL period series using generate_series
|
|
33
|
+
* PostgreSQL's generate_series returns a set directly usable as a table
|
|
34
|
+
*/
|
|
35
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
36
|
+
/**
|
|
37
|
+
* Build PostgreSQL time dimension using DATE_TRUNC function
|
|
38
|
+
* Extracted from executor.ts:649-670 and multi-cube-builder.ts:306-320
|
|
39
|
+
*/
|
|
40
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
41
|
+
/**
|
|
42
|
+
* Build PostgreSQL type casting using :: syntax
|
|
43
|
+
* Extracted from various locations where ::timestamp was used
|
|
44
|
+
*/
|
|
45
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
46
|
+
/**
|
|
47
|
+
* PostgreSQL has full support for statistical and window functions
|
|
48
|
+
*/
|
|
49
|
+
getCapabilities(): DatabaseCapabilities;
|
|
50
|
+
/**
|
|
51
|
+
* Build PostgreSQL PERCENTILE_CONT aggregation
|
|
52
|
+
* Uses ordered-set aggregate function
|
|
53
|
+
*/
|
|
54
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
55
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities } from './base-adapter';
|
|
4
|
+
export declare class SnowflakeAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'snowflake';
|
|
6
|
+
/**
|
|
7
|
+
* Build Snowflake INTERVAL from ISO 8601 duration
|
|
8
|
+
* Snowflake doesn't have a standalone INTERVAL type like PostgreSQL.
|
|
9
|
+
* We convert to total seconds for use in DATEADD; callers should prefer buildDateAddInterval.
|
|
10
|
+
*/
|
|
11
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
12
|
+
/**
|
|
13
|
+
* Build Snowflake time difference in seconds
|
|
14
|
+
* Uses DATEDIFF('SECOND', start, end)
|
|
15
|
+
*/
|
|
16
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
17
|
+
/**
|
|
18
|
+
* Build Snowflake timestamp + interval expression
|
|
19
|
+
* Uses chained DATEADD(unit, amount, timestamp) calls
|
|
20
|
+
*/
|
|
21
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
22
|
+
/**
|
|
23
|
+
* Build Snowflake date difference in periods using DATEDIFF
|
|
24
|
+
*/
|
|
25
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
26
|
+
/**
|
|
27
|
+
* Build Snowflake period series using TABLE(GENERATOR(ROWCOUNT => n)) + ROW_NUMBER()
|
|
28
|
+
*/
|
|
29
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
30
|
+
/**
|
|
31
|
+
* Build Snowflake time dimension using DATE_TRUNC function
|
|
32
|
+
* Snowflake supports DATE_TRUNC with quoted granularity like PostgreSQL
|
|
33
|
+
*/
|
|
34
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
35
|
+
/**
|
|
36
|
+
* Snowflake uses function-style regex matching: REGEXP_LIKE(field, pattern)
|
|
37
|
+
*/
|
|
38
|
+
protected regexCondition(fieldExpr: AnyColumn | SQL, value: string, negated: boolean): SQL;
|
|
39
|
+
/**
|
|
40
|
+
* Build Snowflake type casting using :: syntax
|
|
41
|
+
* Snowflake supports both :: syntax and CAST() function
|
|
42
|
+
*/
|
|
43
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
44
|
+
/**
|
|
45
|
+
* Snowflake capabilities - full SQL support
|
|
46
|
+
*/
|
|
47
|
+
getCapabilities(): DatabaseCapabilities;
|
|
48
|
+
/**
|
|
49
|
+
* Build Snowflake PERCENTILE_CONT aggregation
|
|
50
|
+
* Uses ordered-set aggregate function
|
|
51
|
+
*/
|
|
52
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
53
|
+
}
|