drizzle-cube 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +4 -4
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +4 -4
- package/dist/adapters/{handler-Dz1F4iwf.js → handler-Cx8QYLk6.js} +18 -4
- package/dist/adapters/{handler-C63rJUUK.cjs → handler-CzbCuS6_.cjs} +4 -4
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +7 -7
- package/dist/adapters/{locale-gU_d1Wja.js → locale-BPB7flIG.js} +1 -1
- package/dist/adapters/{locale-CTNwPVZI.cjs → locale-tIMrNcCr.cjs} +1 -1
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +2 -2
- package/dist/adapters/mcp-transport-C2QzXm6h.cjs +40 -0
- package/dist/adapters/mcp-transport-D0B3S1tB.js +579 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +4 -4
- package/dist/{server/openai-y7GhJNdn.js → adapters/openai-B5jEiqiB.js} +776 -719
- package/dist/{server/openai-DiVskd89.js → adapters/openai-BZdAA7Ji.js} +1 -1
- package/dist/adapters/openai-D0musiYP.cjs +17 -0
- package/dist/adapters/{openai-6wrBvAnv.cjs → openai-D_U4V0kT.cjs} +1 -1
- package/dist/adapters/{utils-DosuoabY.js → utils-D9JPLmfl.js} +16 -4
- package/dist/adapters/utils-KV37IBIv.cjs +128 -0
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts/ChartLoader.d.ts +1 -1
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/{DashboardEditModal-6KRE36mm.js → DashboardEditModal-CjCIAT-J.js} +1258 -1050
- package/dist/client/chunks/DashboardEditModal-CjCIAT-J.js.map +1 -0
- package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js → RetentionCombinedChart-BPkfcTa8.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-CCpu0C-s.js.map → RetentionCombinedChart-BPkfcTa8.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js → RetentionHeatmap-DGzLzr7h.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-B24PiIfr.js.map → RetentionHeatmap-DGzLzr7h.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-zd48FVJO.js → analysis-builder-MuMIzoRq.js} +8 -8
- package/dist/client/chunks/{analysis-builder-zd48FVJO.js.map → analysis-builder-MuMIzoRq.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-x576-O5p.js → analysis-builder-shared-CYVwSPqt.js} +21 -21
- package/dist/client/chunks/{analysis-builder-shared-x576-O5p.js.map → analysis-builder-shared-CYVwSPqt.js.map} +1 -1
- package/dist/client/chunks/{chart-activity-grid-CiHrLH6Y.js → chart-activity-grid-DmruKPab.js} +9 -4
- package/dist/client/chunks/{chart-activity-grid-CiHrLH6Y.js.map → chart-activity-grid-DmruKPab.js.map} +1 -1
- package/dist/client/chunks/{chart-area-CXFK-Grv.js → chart-area-DHCPM4Em.js} +2 -2
- package/dist/client/chunks/{chart-area-CXFK-Grv.js.map → chart-area-DHCPM4Em.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-DKXfLoGG.js → chart-bar-KddciGDv.js} +3 -3
- package/dist/client/chunks/{chart-bar-DKXfLoGG.js.map → chart-bar-KddciGDv.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js → chart-box-plot-DYKfyOI8.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-Bu9hy-17.js.map → chart-box-plot-DYKfyOI8.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-DGkTQlxM.js → chart-bubble-CfqiB538.js} +2 -2
- package/dist/client/chunks/{chart-bubble-DGkTQlxM.js.map → chart-bubble-CfqiB538.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js → chart-candlestick-Dwc92Mrj.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-Dau5AF4E.js.map → chart-candlestick-Dwc92Mrj.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-Cm5jrpaw.js → chart-data-table-BO4sXsim.js} +27 -27
- package/dist/client/chunks/{chart-data-table-Cm5jrpaw.js.map → chart-data-table-BO4sXsim.js.map} +1 -1
- package/dist/client/chunks/{chart-funnel-Eke8IPtG.js → chart-funnel-DnWRsmnS.js} +2 -2
- package/dist/client/chunks/{chart-funnel-Eke8IPtG.js.map → chart-funnel-DnWRsmnS.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-DeRZNsyl.js → chart-gauge-CgMeqeGb.js} +2 -2
- package/dist/client/chunks/{chart-gauge-DeRZNsyl.js.map → chart-gauge-CgMeqeGb.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-C86thSJ4.js → chart-heat-map-DcGm9SWK.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-C86thSJ4.js.map → chart-heat-map-DcGm9SWK.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-CxOYD2f1.js → chart-kpi-delta-C2wKPqCb.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-CxOYD2f1.js.map → chart-kpi-delta-C2wKPqCb.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-C6gWz-x4.js → chart-kpi-number-gWYF44ol.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-C6gWz-x4.js.map → chart-kpi-number-gWYF44ol.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-dDONrhS-.js → chart-kpi-text-DIYtJtk4.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-dDONrhS-.js.map → chart-kpi-text-DIYtJtk4.js.map} +1 -1
- package/dist/client/chunks/{chart-line-r4iWevKZ.js → chart-line-9BEGN5Ti.js} +3 -3
- package/dist/client/chunks/{chart-line-r4iWevKZ.js.map → chart-line-9BEGN5Ti.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-BPW-EAm9.js → chart-markdown-dgUetjyM.js} +1359 -1240
- package/dist/client/chunks/chart-markdown-dgUetjyM.js.map +1 -0
- package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js → chart-measure-profile-ClfpLs4q.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-BI3kADCp.js.map → chart-measure-profile-ClfpLs4q.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-yqH2YVEI.js → chart-pie-BjAIhyOi.js} +3 -3
- package/dist/client/chunks/{chart-pie-yqH2YVEI.js.map → chart-pie-BjAIhyOi.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-B-_3v-rE.js → chart-radar-Dgkcl2bN.js} +3 -3
- package/dist/client/chunks/{chart-radar-B-_3v-rE.js.map → chart-radar-Dgkcl2bN.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-C0EgzfAF.js → chart-radial-bar-DdWJjAhK.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar-C0EgzfAF.js.map → chart-radial-bar-DdWJjAhK.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-CFzjGvZX.js → chart-sankey-M3XpO_ah.js} +2 -2
- package/dist/client/chunks/{chart-sankey-CFzjGvZX.js.map → chart-sankey-M3XpO_ah.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DZPirzwX.js → chart-scatter-DaHYP_OL.js} +3 -3
- package/dist/client/chunks/{chart-scatter-DZPirzwX.js.map → chart-scatter-DaHYP_OL.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js → chart-sunburst-A_u6lqlS.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-91Q2tzaB.js.map → chart-sunburst-A_u6lqlS.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-Bi4axCvh.js → chart-tree-map-uiwUU4nb.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-Bi4axCvh.js.map → chart-tree-map-uiwUU4nb.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js → chart-waterfall-BuhMoagf.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-DcHbbPaG.js.map → chart-waterfall-BuhMoagf.js.map} +1 -1
- package/dist/client/chunks/{charts-core-CrBDYN6N.js → charts-core-jRtb0S2M.js} +2 -2
- package/dist/client/chunks/{charts-core-CrBDYN6N.js.map → charts-core-jRtb0S2M.js.map} +1 -1
- 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-CpVs7ox3.js} +7 -2
- package/dist/client/chunks/{nl-NL-oyr2wENY.js.map → nl-NL-CpVs7ox3.js.map} +1 -1
- package/dist/client/chunks/{schema-visualization-BszcrmZX.js → schema-visualization-DE09kQE3.js} +3 -3
- package/dist/client/chunks/{schema-visualization-BszcrmZX.js.map → schema-visualization-DE09kQE3.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-B5wCDJSj.js → useDirtyStateTracking-CoeQbprt.js} +4 -4
- package/dist/client/chunks/{useDirtyStateTracking-B5wCDJSj.js.map → useDirtyStateTracking-CoeQbprt.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-CCeCYzDm.js → useExplainAI-DlnXWdmz.js} +4 -4
- package/dist/client/chunks/{useExplainAI-CCeCYzDm.js.map → useExplainAI-DlnXWdmz.js.map} +1 -1
- package/dist/client/chunks/{utils-kqa-JIMg.js → utils-CTKNaXS8.js} +3 -3
- package/dist/client/chunks/{utils-kqa-JIMg.js.map → utils-CTKNaXS8.js.map} +1 -1
- package/dist/client/chunks/{vendor-0hJNlZXQ.js → vendor-CPIYyeuD.js} +2 -2
- package/dist/client/chunks/{vendor-0hJNlZXQ.js.map → vendor-CPIYyeuD.js.map} +1 -1
- 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/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/FilterConfigModal.d.ts +2 -1
- package/dist/client/components/AnalysisBuilder/LimitSection.d.ts +1 -1
- package/dist/client/components/AnalysisBuilder/SectionHeading.d.ts +1 -1
- 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/DashboardFilterConfigModal.d.ts +1 -1
- package/dist/client/components/DashboardFilters/DashboardFilterItem.d.ts +1 -1
- package/dist/client/components/DashboardGrid.d.ts +1 -1
- 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/charts/AxisFormatControls.d.ts +2 -2
- 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/ChartTooltip.d.ts +1 -1
- package/dist/client/components/charts/MissingDependencyFallback.d.ts +1 -1
- 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/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/dashboardGridUtils.d.ts +1 -1
- package/dist/client/components.js +2 -2
- package/dist/client/hooks/dashboard/useDashboardController.d.ts +2 -2
- 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 +1 -1
- package/dist/client/index.js +15 -15
- 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 +1 -1
- package/dist/client/schema.js +1 -1
- 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/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/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.js +5 -5
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +4 -4
- package/dist/server/index.cjs +6 -6
- package/dist/server/index.d.ts +2 -5050
- package/dist/server/index.js +33 -7
- package/dist/{adapters/openai-y7GhJNdn.js → server/openai-B5jEiqiB.js} +776 -719
- package/dist/{adapters/openai-DiVskd89.js → server/openai-BZdAA7Ji.js} +1 -1
- package/dist/server/openai-D0musiYP.cjs +17 -0
- package/dist/server/{openai-6wrBvAnv.cjs → openai-D_U4V0kT.cjs} +1 -1
- package/dist/server/server/adapters/base-adapter.d.ts +287 -0
- package/dist/server/server/adapters/databend-adapter.d.ts +114 -0
- package/dist/server/server/adapters/duckdb-adapter.d.ts +122 -0
- package/dist/server/server/adapters/mysql-adapter.d.ts +122 -0
- package/dist/server/server/adapters/postgres-adapter.d.ts +119 -0
- package/dist/server/server/adapters/singlestore-adapter.d.ts +4 -0
- package/dist/server/server/adapters/snowflake-adapter.d.ts +116 -0
- package/dist/server/server/adapters/sqlite-adapter.d.ts +140 -0
- package/dist/server/server/agent/chart-validation.d.ts +27 -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.d.ts +62 -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.d.ts +19 -0
- package/dist/server/server/ai/validation.d.ts +34 -0
- package/dist/server/server/builders/comparison-query-builder.d.ts +70 -0
- package/dist/server/server/builders/cte-builder.d.ts +62 -0
- package/dist/server/server/builders/date-time-builder.d.ts +29 -0
- package/dist/server/server/builders/filter-builder.d.ts +23 -0
- package/dist/server/server/builders/flow-query-builder.d.ts +109 -0
- package/dist/server/server/builders/funnel-query-builder.d.ts +134 -0
- package/dist/server/server/builders/group-by-builder.d.ts +27 -0
- package/dist/server/server/builders/index.d.ts +13 -0
- package/dist/server/server/builders/measure-builder.d.ts +142 -0
- package/dist/server/server/builders/retention-query-builder.d.ts +100 -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 +65 -0
- package/dist/server/server/compiler.d.ts +218 -0
- package/dist/server/server/cube-utils.d.ts +133 -0
- package/dist/server/server/database-utils.d.ts +18 -0
- package/dist/server/server/executor.d.ts +183 -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/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/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 +42 -0
- package/dist/server/server/index.d.ts +36 -0
- package/dist/server/server/logical-plan/index.d.ts +14 -0
- package/dist/server/server/logical-plan/logical-plan-builder.d.ts +58 -0
- package/dist/server/server/logical-plan/logical-planner.d.ts +232 -0
- package/dist/server/server/logical-plan/optimiser.d.ts +32 -0
- package/dist/server/server/logical-plan/types.d.ts +191 -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 +107 -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 +6 -0
- package/dist/server/server/physical-plan/processors/joins-processor.d.ts +6 -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 +33 -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/resolvers/calculated-measure-resolver.d.ts +93 -0
- package/dist/server/server/resolvers/index.d.ts +6 -0
- package/dist/server/server/resolvers/join-path-resolver.d.ts +152 -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 +530 -0
- package/dist/server/server/types/executor.d.ts +156 -0
- package/dist/server/server/types/flow.d.ts +143 -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/package.json +5 -5
- package/dist/adapters/mcp-transport-C4J4SAcn.cjs +0 -40
- package/dist/adapters/mcp-transport-CVUiifEc.js +0 -579
- 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/chart-markdown-BPW-EAm9.js.map +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
- /package/dist/adapters/{utils.d.ts → adapters/utils.d.ts} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
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 STDDEV_POP/STDDEV_SAMP */
|
|
9
|
+
supportsStddev: boolean;
|
|
10
|
+
/** Whether the database supports VAR_POP/VAR_SAMP */
|
|
11
|
+
supportsVariance: boolean;
|
|
12
|
+
/** Whether the database supports PERCENTILE_CONT or similar */
|
|
13
|
+
supportsPercentile: boolean;
|
|
14
|
+
/** Whether the database supports window functions (LAG, LEAD, RANK, etc.) */
|
|
15
|
+
supportsWindowFunctions: boolean;
|
|
16
|
+
/** Whether the database supports frame clauses (ROWS BETWEEN, RANGE BETWEEN) */
|
|
17
|
+
supportsFrameClause: boolean;
|
|
18
|
+
/** Whether the database supports LATERAL joins (PostgreSQL 9.3+, MySQL 8.0.14+) */
|
|
19
|
+
supportsLateralJoins: boolean;
|
|
20
|
+
/** Whether percentile functions work in subqueries against CTEs (false for DuckDB) */
|
|
21
|
+
supportsPercentileSubqueries: boolean;
|
|
22
|
+
/** Whether derived tables (subqueries) work in FROM clauses inside CTEs (false for Databend) */
|
|
23
|
+
supportsDerivedTablesInCTE: boolean;
|
|
24
|
+
/** Whether correlated LATERAL subqueries can reference CTEs (false for Snowflake) */
|
|
25
|
+
supportsLateralSubqueriesInCTE: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Window function types supported by the adapter
|
|
29
|
+
*/
|
|
30
|
+
export type WindowFunctionType = 'lag' | 'lead' | 'rank' | 'denseRank' | 'rowNumber' | 'ntile' | 'firstValue' | 'lastValue' | 'movingAvg' | 'movingSum';
|
|
31
|
+
/**
|
|
32
|
+
* Window function configuration
|
|
33
|
+
*/
|
|
34
|
+
export interface WindowFunctionConfig {
|
|
35
|
+
/** Number of rows to offset for lag/lead */
|
|
36
|
+
offset?: number;
|
|
37
|
+
/** Default value when offset is out of bounds */
|
|
38
|
+
defaultValue?: any;
|
|
39
|
+
/** Number of buckets for ntile */
|
|
40
|
+
nTile?: number;
|
|
41
|
+
/** Frame specification for moving aggregates */
|
|
42
|
+
frame?: {
|
|
43
|
+
type: 'rows' | 'range';
|
|
44
|
+
start: number | 'unbounded';
|
|
45
|
+
end: number | 'current' | 'unbounded';
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface DatabaseAdapter {
|
|
49
|
+
/**
|
|
50
|
+
* Get the database engine type this adapter supports
|
|
51
|
+
*/
|
|
52
|
+
getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
53
|
+
/**
|
|
54
|
+
* Check if the database supports LATERAL joins
|
|
55
|
+
* Required for optimized flow queries with index-backed seeks
|
|
56
|
+
* @returns true for PostgreSQL 9.3+, MySQL 8.0.14+, SingleStore; false for SQLite
|
|
57
|
+
*/
|
|
58
|
+
supportsLateralJoins(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Build SQL INTERVAL from ISO 8601 duration string
|
|
61
|
+
* Used for time window constraints in funnel analysis
|
|
62
|
+
* @param duration - ISO 8601 duration (e.g., "P7D" for 7 days, "PT1H" for 1 hour)
|
|
63
|
+
* @returns SQL expression representing the interval
|
|
64
|
+
*/
|
|
65
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
66
|
+
/**
|
|
67
|
+
* Build time difference expression in seconds between two timestamps
|
|
68
|
+
* Used for calculating time-to-convert metrics in funnel analysis
|
|
69
|
+
* @param end - End timestamp expression
|
|
70
|
+
* @param start - Start timestamp expression
|
|
71
|
+
* @returns SQL expression for (end - start) in seconds
|
|
72
|
+
*/
|
|
73
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
74
|
+
/**
|
|
75
|
+
* Build expression to add an ISO 8601 duration to a timestamp
|
|
76
|
+
* Used for time window constraint checks in funnel analysis
|
|
77
|
+
* @param timestamp - Base timestamp expression
|
|
78
|
+
* @param duration - ISO 8601 duration to add
|
|
79
|
+
* @returns SQL expression for timestamp + interval
|
|
80
|
+
*/
|
|
81
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
82
|
+
/**
|
|
83
|
+
* Build conditional aggregation with database-specific syntax
|
|
84
|
+
* Used for single-pass funnel metrics aggregation
|
|
85
|
+
* PostgreSQL uses FILTER clause, MySQL/SQLite use CASE WHEN
|
|
86
|
+
* @param aggFn - Aggregation function: 'count' | 'avg' | 'min' | 'max' | 'sum'
|
|
87
|
+
* @param expr - Expression to aggregate (null for COUNT(*))
|
|
88
|
+
* @param condition - Condition for filtering
|
|
89
|
+
* @returns SQL for conditional aggregation
|
|
90
|
+
*/
|
|
91
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
92
|
+
/**
|
|
93
|
+
* Build date difference expression in specified periods
|
|
94
|
+
* Used for retention analysis to calculate period numbers
|
|
95
|
+
* @param startDate - Start date expression
|
|
96
|
+
* @param endDate - End date expression
|
|
97
|
+
* @param unit - Unit for difference ('day' | 'week' | 'month')
|
|
98
|
+
* @returns SQL expression for date difference in periods
|
|
99
|
+
*/
|
|
100
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
101
|
+
/**
|
|
102
|
+
* Build a subquery that generates a series of period numbers (0 to maxPeriod)
|
|
103
|
+
* Used for retention analysis to cross-join with user data
|
|
104
|
+
* @param maxPeriod - Maximum period number to generate
|
|
105
|
+
* @returns SQL expression for period series subquery with alias 'p' containing 'period_number' column
|
|
106
|
+
*/
|
|
107
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
108
|
+
/**
|
|
109
|
+
* Build time dimension expression with granularity truncation
|
|
110
|
+
* @param granularity - Time granularity (day, month, year, etc.)
|
|
111
|
+
* @param fieldExpr - The date/timestamp field expression
|
|
112
|
+
* @returns SQL expression for truncated time dimension
|
|
113
|
+
*/
|
|
114
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
115
|
+
/**
|
|
116
|
+
* Build string matching condition
|
|
117
|
+
* @param fieldExpr - The field to search in
|
|
118
|
+
* @param operator - The string matching operator
|
|
119
|
+
* @param value - The value to match
|
|
120
|
+
* @returns SQL expression for string matching
|
|
121
|
+
*/
|
|
122
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
123
|
+
/**
|
|
124
|
+
* Cast expression to specific database type
|
|
125
|
+
* @param fieldExpr - The field expression to cast
|
|
126
|
+
* @param targetType - Target database type
|
|
127
|
+
* @returns SQL expression with type casting
|
|
128
|
+
*/
|
|
129
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
130
|
+
/**
|
|
131
|
+
* Build AVG aggregation expression with database-specific null handling
|
|
132
|
+
* @param fieldExpr - The field expression to average
|
|
133
|
+
* @returns SQL expression for AVG aggregation (COALESCE vs IFNULL for null handling)
|
|
134
|
+
*/
|
|
135
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
136
|
+
/**
|
|
137
|
+
* Build CASE WHEN conditional expression
|
|
138
|
+
* @param conditions - Array of condition/result pairs
|
|
139
|
+
* @param elseValue - Optional ELSE clause value
|
|
140
|
+
* @returns SQL expression for CASE WHEN statement
|
|
141
|
+
*/
|
|
142
|
+
buildCaseWhen(conditions: Array<{
|
|
143
|
+
when: SQL;
|
|
144
|
+
then: any;
|
|
145
|
+
}>, elseValue?: any): SQL;
|
|
146
|
+
/**
|
|
147
|
+
* Build boolean literal expression
|
|
148
|
+
* @param value - Boolean value to represent
|
|
149
|
+
* @returns SQL expression for boolean literal (TRUE/FALSE/1/0 depending on database)
|
|
150
|
+
*/
|
|
151
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
152
|
+
/**
|
|
153
|
+
* Convert filter values to database-compatible types
|
|
154
|
+
* @param value - The filter value to convert
|
|
155
|
+
* @returns Converted value for database queries
|
|
156
|
+
*/
|
|
157
|
+
convertFilterValue(value: any): any;
|
|
158
|
+
/**
|
|
159
|
+
* Prepare date value for database-specific storage format
|
|
160
|
+
* @param date - Date value to prepare
|
|
161
|
+
* @returns Database-compatible date representation
|
|
162
|
+
*/
|
|
163
|
+
prepareDateValue(date: Date): any;
|
|
164
|
+
/**
|
|
165
|
+
* Check if this database stores timestamps as integers
|
|
166
|
+
* @returns True if timestamps are stored as integers (milliseconds), false for native timestamps
|
|
167
|
+
*/
|
|
168
|
+
isTimestampInteger(): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Convert time dimension result values back to Date objects for consistency
|
|
171
|
+
* @param value - The time dimension value from query results
|
|
172
|
+
* @returns Date object or original value if not a time dimension
|
|
173
|
+
*/
|
|
174
|
+
convertTimeDimensionResult(value: any): any;
|
|
175
|
+
/**
|
|
176
|
+
* Preprocess calculated measure template for database-specific transformations
|
|
177
|
+
* This allows each adapter to modify the template before substitution occurs
|
|
178
|
+
* @param calculatedSql - The template string with {member} references
|
|
179
|
+
* @returns Preprocessed template string
|
|
180
|
+
*/
|
|
181
|
+
preprocessCalculatedTemplate(calculatedSql: string): string;
|
|
182
|
+
/**
|
|
183
|
+
* Get database capabilities for feature detection
|
|
184
|
+
* Used for graceful degradation when functions aren't supported
|
|
185
|
+
*/
|
|
186
|
+
getCapabilities(): DatabaseCapabilities;
|
|
187
|
+
/**
|
|
188
|
+
* Build STDDEV aggregation expression
|
|
189
|
+
* @param fieldExpr - The field expression to calculate stddev for
|
|
190
|
+
* @param useSample - Use sample stddev (STDDEV_SAMP) vs population (STDDEV_POP). Default: false
|
|
191
|
+
* @returns SQL expression or null if unsupported
|
|
192
|
+
*/
|
|
193
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
194
|
+
/**
|
|
195
|
+
* Build VARIANCE aggregation expression
|
|
196
|
+
* @param fieldExpr - The field expression to calculate variance for
|
|
197
|
+
* @param useSample - Use sample variance (VAR_SAMP) vs population (VAR_POP). Default: false
|
|
198
|
+
* @returns SQL expression or null if unsupported
|
|
199
|
+
*/
|
|
200
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
201
|
+
/**
|
|
202
|
+
* Build PERCENTILE aggregation expression
|
|
203
|
+
* @param fieldExpr - The field expression to calculate percentile for
|
|
204
|
+
* @param percentile - Percentile value (0-100)
|
|
205
|
+
* @returns SQL expression or null if unsupported
|
|
206
|
+
*/
|
|
207
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL | null;
|
|
208
|
+
/**
|
|
209
|
+
* Build a window function expression
|
|
210
|
+
* @param type - Window function type (lag, lead, rank, etc.)
|
|
211
|
+
* @param fieldExpr - The field expression (null for rank functions that don't need a field)
|
|
212
|
+
* @param partitionBy - PARTITION BY columns
|
|
213
|
+
* @param orderBy - ORDER BY columns with direction
|
|
214
|
+
* @param config - Additional configuration (offset, default, frame, etc.)
|
|
215
|
+
* @returns SQL expression or null if unsupported
|
|
216
|
+
*/
|
|
217
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
218
|
+
field: AnyColumn | SQL;
|
|
219
|
+
direction: 'asc' | 'desc';
|
|
220
|
+
}>, config?: WindowFunctionConfig): SQL | null;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Abstract base class for database adapters
|
|
224
|
+
* Provides common functionality that can be shared across database implementations
|
|
225
|
+
*/
|
|
226
|
+
export declare abstract class BaseDatabaseAdapter implements DatabaseAdapter {
|
|
227
|
+
abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
228
|
+
abstract supportsLateralJoins(): boolean;
|
|
229
|
+
abstract buildIntervalFromISO(duration: string): SQL;
|
|
230
|
+
abstract buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
231
|
+
abstract buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
232
|
+
abstract buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
233
|
+
abstract buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
234
|
+
abstract buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
235
|
+
abstract buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
236
|
+
abstract buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
237
|
+
abstract castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
238
|
+
abstract buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
239
|
+
abstract buildCaseWhen(conditions: Array<{
|
|
240
|
+
when: SQL;
|
|
241
|
+
then: any;
|
|
242
|
+
}>, elseValue?: any): SQL;
|
|
243
|
+
abstract buildBooleanLiteral(value: boolean): SQL;
|
|
244
|
+
abstract convertFilterValue(value: any): any;
|
|
245
|
+
abstract prepareDateValue(date: Date): any;
|
|
246
|
+
abstract isTimestampInteger(): boolean;
|
|
247
|
+
abstract convertTimeDimensionResult(value: any): any;
|
|
248
|
+
abstract getCapabilities(): DatabaseCapabilities;
|
|
249
|
+
abstract buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
250
|
+
abstract buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL | null;
|
|
251
|
+
abstract buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL | null;
|
|
252
|
+
abstract buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
253
|
+
field: AnyColumn | SQL;
|
|
254
|
+
direction: 'asc' | 'desc';
|
|
255
|
+
}>, config?: WindowFunctionConfig): SQL | null;
|
|
256
|
+
/**
|
|
257
|
+
* Default implementation returns template unchanged
|
|
258
|
+
* Override in specific adapters for database-specific preprocessing
|
|
259
|
+
*/
|
|
260
|
+
preprocessCalculatedTemplate(calculatedSql: string): string;
|
|
261
|
+
/**
|
|
262
|
+
* Helper method to build pattern for string matching
|
|
263
|
+
* Can be overridden by specific adapters if needed
|
|
264
|
+
*/
|
|
265
|
+
protected buildPattern(operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith', value: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* Parse ISO 8601 duration into components
|
|
268
|
+
* Supports P[n]Y[n]M[n]DT[n]H[n]M[n]S format
|
|
269
|
+
* @param duration - ISO 8601 duration string (e.g., "P7D", "PT1H30M", "P1DT2H")
|
|
270
|
+
* @returns Parsed duration components
|
|
271
|
+
*/
|
|
272
|
+
protected parseISODuration(duration: string): {
|
|
273
|
+
years: number;
|
|
274
|
+
months: number;
|
|
275
|
+
days: number;
|
|
276
|
+
hours: number;
|
|
277
|
+
minutes: number;
|
|
278
|
+
seconds: number;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Convert ISO 8601 duration to total seconds
|
|
282
|
+
* Note: Months and years are approximated (30 days/month, 365 days/year)
|
|
283
|
+
* @param duration - ISO 8601 duration string
|
|
284
|
+
* @returns Total seconds
|
|
285
|
+
*/
|
|
286
|
+
protected durationToSeconds(duration: string): number;
|
|
287
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities, WindowFunctionType, WindowFunctionConfig } from './base-adapter';
|
|
4
|
+
export declare class DatabendAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'databend';
|
|
6
|
+
/**
|
|
7
|
+
* Databend does not support LATERAL joins
|
|
8
|
+
*/
|
|
9
|
+
supportsLateralJoins(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Build Databend INTERVAL from ISO 8601 duration
|
|
12
|
+
* Databend supports INTERVAL n UNIT syntax (e.g., INTERVAL 7 DAY)
|
|
13
|
+
*/
|
|
14
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
15
|
+
/**
|
|
16
|
+
* Build Databend time difference in seconds
|
|
17
|
+
* Uses TIMESTAMPDIFF(SECOND, start, end)
|
|
18
|
+
*/
|
|
19
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
20
|
+
/**
|
|
21
|
+
* Build Databend timestamp + interval expression
|
|
22
|
+
* Uses timestamp + INTERVAL n UNIT syntax (Databend doesn't support DATE_ADD function)
|
|
23
|
+
*/
|
|
24
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
25
|
+
/**
|
|
26
|
+
* Build Databend conditional aggregation using CASE WHEN
|
|
27
|
+
* FILTER clause support is uncertain in Databend, so use CASE WHEN for safety
|
|
28
|
+
*/
|
|
29
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
30
|
+
/**
|
|
31
|
+
* Build Databend date difference in periods using DATE_DIFF
|
|
32
|
+
*/
|
|
33
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
34
|
+
/**
|
|
35
|
+
* Build Databend period series using generate_series via numbers table
|
|
36
|
+
* Databend has a numbers() table function that can be used similarly
|
|
37
|
+
*/
|
|
38
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
39
|
+
/**
|
|
40
|
+
* Build Databend time dimension using DATE_TRUNC function
|
|
41
|
+
* Databend supports DATE_TRUNC with quoted granularity like PostgreSQL
|
|
42
|
+
*/
|
|
43
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
44
|
+
/**
|
|
45
|
+
* Build Databend string matching conditions using LOWER+LIKE fallback
|
|
46
|
+
* Databend does not support ILIKE
|
|
47
|
+
*/
|
|
48
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
49
|
+
/**
|
|
50
|
+
* Build Databend type casting
|
|
51
|
+
* Databend supports both :: syntax and CAST() function
|
|
52
|
+
*/
|
|
53
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
54
|
+
/**
|
|
55
|
+
* Build Databend AVG aggregation with COALESCE for NULL handling
|
|
56
|
+
*/
|
|
57
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
58
|
+
/**
|
|
59
|
+
* Build Databend CASE WHEN conditional expression
|
|
60
|
+
*/
|
|
61
|
+
buildCaseWhen(conditions: Array<{
|
|
62
|
+
when: SQL;
|
|
63
|
+
then: any;
|
|
64
|
+
}>, elseValue?: any): SQL;
|
|
65
|
+
/**
|
|
66
|
+
* Build Databend boolean literal
|
|
67
|
+
* Databend uses TRUE/FALSE keywords
|
|
68
|
+
*/
|
|
69
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
70
|
+
/**
|
|
71
|
+
* Convert filter values - Databend uses native types
|
|
72
|
+
*/
|
|
73
|
+
convertFilterValue(value: any): any;
|
|
74
|
+
/**
|
|
75
|
+
* Prepare date value for Databend
|
|
76
|
+
* Databend accepts Date objects directly
|
|
77
|
+
*/
|
|
78
|
+
prepareDateValue(date: Date): any;
|
|
79
|
+
/**
|
|
80
|
+
* Databend stores timestamps as native timestamp types
|
|
81
|
+
*/
|
|
82
|
+
isTimestampInteger(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Databend time dimensions already return proper values
|
|
85
|
+
*/
|
|
86
|
+
convertTimeDimensionResult(value: any): any;
|
|
87
|
+
/**
|
|
88
|
+
* Databend capabilities - start conservative
|
|
89
|
+
*/
|
|
90
|
+
getCapabilities(): DatabaseCapabilities;
|
|
91
|
+
/**
|
|
92
|
+
* Build Databend STDDEV aggregation
|
|
93
|
+
*/
|
|
94
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
95
|
+
/**
|
|
96
|
+
* Build Databend VARIANCE aggregation
|
|
97
|
+
* Databend doesn't have VAR_POP/VAR_SAMP, but COVAR_POP(x,x) = VAR_POP(x)
|
|
98
|
+
* and COVAR_SAMP(x,x) = VAR_SAMP(x) mathematically
|
|
99
|
+
*/
|
|
100
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
101
|
+
/**
|
|
102
|
+
* Build Databend PERCENTILE aggregation
|
|
103
|
+
* Databend may support QUANTILE or PERCENTILE_CONT - start with unsupported
|
|
104
|
+
*/
|
|
105
|
+
buildPercentile(_fieldExpr: AnyColumn | SQL, _percentile: number): SQL;
|
|
106
|
+
/**
|
|
107
|
+
* Build Databend window function expression
|
|
108
|
+
* Databend has full window function support
|
|
109
|
+
*/
|
|
110
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
111
|
+
field: AnyColumn | SQL;
|
|
112
|
+
direction: 'asc' | 'desc';
|
|
113
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
114
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities, WindowFunctionType, WindowFunctionConfig } 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
|
+
supportsLateralJoins(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Build DuckDB INTERVAL from ISO 8601 duration
|
|
14
|
+
* DuckDB supports PostgreSQL-style INTERVAL literal syntax: INTERVAL '7 days'
|
|
15
|
+
*/
|
|
16
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
17
|
+
/**
|
|
18
|
+
* Build DuckDB time difference in seconds using EPOCH() function
|
|
19
|
+
* DuckDB uses EPOCH(timestamp) instead of EXTRACT(EPOCH FROM timestamp)
|
|
20
|
+
* Returns (end - start) as seconds
|
|
21
|
+
*/
|
|
22
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
23
|
+
/**
|
|
24
|
+
* Build DuckDB timestamp + interval expression
|
|
25
|
+
*/
|
|
26
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
27
|
+
/**
|
|
28
|
+
* Build DuckDB conditional aggregation using CASE WHEN
|
|
29
|
+
* DuckDB supports FILTER clause, but CASE WHEN provides broader compatibility
|
|
30
|
+
* Using FILTER clause as DuckDB does support it
|
|
31
|
+
*/
|
|
32
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
33
|
+
/**
|
|
34
|
+
* Build DuckDB date difference in periods using DATE_DIFF
|
|
35
|
+
* DuckDB has native DATE_DIFF function with unit support
|
|
36
|
+
*/
|
|
37
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
38
|
+
/**
|
|
39
|
+
* Build DuckDB period series using UNNEST(generate_series(...))
|
|
40
|
+
* DuckDB's generate_series returns an array, so we need to UNNEST it to get a table
|
|
41
|
+
*/
|
|
42
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
43
|
+
/**
|
|
44
|
+
* Build DuckDB time dimension using DATE_TRUNC function
|
|
45
|
+
* DuckDB uses DATE_TRUNC like PostgreSQL
|
|
46
|
+
*/
|
|
47
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
48
|
+
/**
|
|
49
|
+
* Build DuckDB string matching conditions using ILIKE (case-insensitive)
|
|
50
|
+
* DuckDB supports ILIKE like PostgreSQL
|
|
51
|
+
*/
|
|
52
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
53
|
+
/**
|
|
54
|
+
* Build DuckDB type casting
|
|
55
|
+
* DuckDB supports both :: syntax and CAST() function
|
|
56
|
+
*/
|
|
57
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
58
|
+
/**
|
|
59
|
+
* Build DuckDB AVG aggregation with COALESCE for NULL handling
|
|
60
|
+
*/
|
|
61
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
62
|
+
/**
|
|
63
|
+
* Build DuckDB CASE WHEN conditional expression
|
|
64
|
+
*/
|
|
65
|
+
buildCaseWhen(conditions: Array<{
|
|
66
|
+
when: SQL;
|
|
67
|
+
then: any;
|
|
68
|
+
}>, elseValue?: any): SQL;
|
|
69
|
+
/**
|
|
70
|
+
* Build DuckDB boolean literal
|
|
71
|
+
* DuckDB uses TRUE/FALSE keywords
|
|
72
|
+
*/
|
|
73
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
74
|
+
/**
|
|
75
|
+
* Convert filter values - DuckDB uses native types
|
|
76
|
+
*/
|
|
77
|
+
convertFilterValue(value: any): any;
|
|
78
|
+
/**
|
|
79
|
+
* Prepare date value for DuckDB
|
|
80
|
+
* DuckDB accepts Date objects directly
|
|
81
|
+
*/
|
|
82
|
+
prepareDateValue(date: Date): any;
|
|
83
|
+
/**
|
|
84
|
+
* DuckDB stores timestamps as native timestamp types
|
|
85
|
+
*/
|
|
86
|
+
isTimestampInteger(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* DuckDB time dimensions already return proper values
|
|
89
|
+
*/
|
|
90
|
+
convertTimeDimensionResult(value: any): any;
|
|
91
|
+
/**
|
|
92
|
+
* DuckDB has full support for statistical and window functions
|
|
93
|
+
* Note: supportsPercentileSubqueries is false because DuckDB's QUANTILE_CONT
|
|
94
|
+
* doesn't work well in scalar subqueries against CTEs in funnel queries
|
|
95
|
+
* Note: supportsLateralJoins is false because DuckDB doesn't support non-constant
|
|
96
|
+
* LIMIT in correlated subqueries, which is required for flow query LATERAL joins
|
|
97
|
+
*/
|
|
98
|
+
getCapabilities(): DatabaseCapabilities;
|
|
99
|
+
/**
|
|
100
|
+
* Build DuckDB STDDEV aggregation
|
|
101
|
+
* Uses STDDEV_POP for population, STDDEV_SAMP for sample
|
|
102
|
+
*/
|
|
103
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
104
|
+
/**
|
|
105
|
+
* Build DuckDB VARIANCE aggregation
|
|
106
|
+
* Uses VAR_POP for population, VAR_SAMP for sample
|
|
107
|
+
*/
|
|
108
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
109
|
+
/**
|
|
110
|
+
* Build DuckDB PERCENTILE aggregation
|
|
111
|
+
* DuckDB uses QUANTILE_CONT instead of PERCENTILE_CONT
|
|
112
|
+
*/
|
|
113
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
114
|
+
/**
|
|
115
|
+
* Build DuckDB window function expression
|
|
116
|
+
* DuckDB has full window function support
|
|
117
|
+
*/
|
|
118
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
119
|
+
field: AnyColumn | SQL;
|
|
120
|
+
direction: 'asc' | 'desc';
|
|
121
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
122
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { TimeGranularity } from '../types';
|
|
3
|
+
import { BaseDatabaseAdapter, DatabaseCapabilities, WindowFunctionType, WindowFunctionConfig } from './base-adapter';
|
|
4
|
+
export declare class MySQLAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'mysql' | 'singlestore';
|
|
6
|
+
/**
|
|
7
|
+
* MySQL supports LATERAL joins since version 8.0.14
|
|
8
|
+
*/
|
|
9
|
+
supportsLateralJoins(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Build MySQL INTERVAL from ISO 8601 duration
|
|
12
|
+
* MySQL uses DATE_ADD with INTERVAL syntax but intervals must be added separately
|
|
13
|
+
* For simplicity, we convert to seconds for consistent handling
|
|
14
|
+
*/
|
|
15
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
16
|
+
/**
|
|
17
|
+
* Build MySQL time difference in seconds using TIMESTAMPDIFF
|
|
18
|
+
* Returns (end - start) as seconds
|
|
19
|
+
*/
|
|
20
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
21
|
+
/**
|
|
22
|
+
* Build MySQL timestamp + interval expression
|
|
23
|
+
* Uses DATE_ADD function
|
|
24
|
+
*/
|
|
25
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
26
|
+
/**
|
|
27
|
+
* Build MySQL conditional aggregation using CASE WHEN
|
|
28
|
+
* MySQL doesn't support FILTER clause, so we use CASE WHEN pattern
|
|
29
|
+
* Example: AVG(CASE WHEN step_1_time IS NOT NULL THEN time_diff END)
|
|
30
|
+
*/
|
|
31
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
32
|
+
/**
|
|
33
|
+
* Build MySQL date difference in periods using TIMESTAMPDIFF
|
|
34
|
+
* For retention analysis period calculations
|
|
35
|
+
*/
|
|
36
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
37
|
+
/**
|
|
38
|
+
* Build MySQL period series using recursive CTE
|
|
39
|
+
* MySQL 8.0+ supports recursive CTEs for generating sequences
|
|
40
|
+
*/
|
|
41
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
42
|
+
/**
|
|
43
|
+
* Build MySQL time dimension using DATE_FORMAT function
|
|
44
|
+
* MySQL equivalent to PostgreSQL's DATE_TRUNC
|
|
45
|
+
*/
|
|
46
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
47
|
+
/**
|
|
48
|
+
* Build MySQL string matching conditions using LIKE
|
|
49
|
+
* MySQL LIKE is case-insensitive by default (depending on collation)
|
|
50
|
+
* For guaranteed case-insensitive matching, we use LOWER() functions
|
|
51
|
+
*/
|
|
52
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
53
|
+
/**
|
|
54
|
+
* Build MySQL type casting using CAST() function
|
|
55
|
+
* MySQL equivalent to PostgreSQL's :: casting syntax
|
|
56
|
+
*/
|
|
57
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
58
|
+
/**
|
|
59
|
+
* Build MySQL AVG aggregation with IFNULL for NULL handling
|
|
60
|
+
* MySQL AVG returns NULL for empty sets, using IFNULL for consistency
|
|
61
|
+
*/
|
|
62
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
63
|
+
/**
|
|
64
|
+
* Build MySQL CASE WHEN conditional expression
|
|
65
|
+
*/
|
|
66
|
+
buildCaseWhen(conditions: Array<{
|
|
67
|
+
when: SQL;
|
|
68
|
+
then: any;
|
|
69
|
+
}>, elseValue?: any): SQL;
|
|
70
|
+
/**
|
|
71
|
+
* Build MySQL boolean literal
|
|
72
|
+
* MySQL uses TRUE/FALSE keywords (equivalent to 1/0)
|
|
73
|
+
*/
|
|
74
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
75
|
+
/**
|
|
76
|
+
* Convert filter values - MySQL uses native types
|
|
77
|
+
* No conversion needed for MySQL
|
|
78
|
+
*/
|
|
79
|
+
convertFilterValue(value: any): any;
|
|
80
|
+
/**
|
|
81
|
+
* Prepare date value for MySQL
|
|
82
|
+
* MySQL accepts Date objects directly
|
|
83
|
+
*/
|
|
84
|
+
prepareDateValue(date: Date): any;
|
|
85
|
+
/**
|
|
86
|
+
* MySQL stores timestamps as native timestamp types
|
|
87
|
+
*/
|
|
88
|
+
isTimestampInteger(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* MySQL time dimensions already return proper values
|
|
91
|
+
* No conversion needed
|
|
92
|
+
*/
|
|
93
|
+
convertTimeDimensionResult(value: any): any;
|
|
94
|
+
/**
|
|
95
|
+
* MySQL 8.0+ has support for statistical and window functions
|
|
96
|
+
* but not PERCENTILE_CONT
|
|
97
|
+
*/
|
|
98
|
+
getCapabilities(): DatabaseCapabilities;
|
|
99
|
+
/**
|
|
100
|
+
* Build MySQL STDDEV aggregation
|
|
101
|
+
* Uses STDDEV_POP for population, STDDEV_SAMP for sample
|
|
102
|
+
*/
|
|
103
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
104
|
+
/**
|
|
105
|
+
* Build MySQL VARIANCE aggregation
|
|
106
|
+
* Uses VAR_POP for population, VAR_SAMP for sample
|
|
107
|
+
*/
|
|
108
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
109
|
+
/**
|
|
110
|
+
* MySQL does not support PERCENTILE_CONT
|
|
111
|
+
* Returns null for graceful degradation
|
|
112
|
+
*/
|
|
113
|
+
buildPercentile(_fieldExpr: AnyColumn | SQL, _percentile: number): SQL | null;
|
|
114
|
+
/**
|
|
115
|
+
* Build MySQL window function expression
|
|
116
|
+
* MySQL 8.0+ has full window function support
|
|
117
|
+
*/
|
|
118
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
119
|
+
field: AnyColumn | SQL;
|
|
120
|
+
direction: 'asc' | 'desc';
|
|
121
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
122
|
+
}
|