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,133 @@
|
|
|
1
|
+
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
+
import { Cube, CubeJoin, QueryContext, MultiCubeQueryContext, SqlExpression, SecurityContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve cube reference (handles direct, lazy, and string name references)
|
|
5
|
+
*
|
|
6
|
+
* String references are resolved from the optional `cubes` registry map.
|
|
7
|
+
* Returns `null` when a string ref cannot be resolved (logs a warning).
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveCubeReference(ref: Cube | (() => Cube) | string, cubes?: Map<string, Cube>): Cube | null;
|
|
10
|
+
/**
|
|
11
|
+
* Reverse a semantic relationship type for bidirectional join path resolution.
|
|
12
|
+
* When traversing a join edge in reverse (target→source instead of source→target),
|
|
13
|
+
* the relationship semantics flip: belongsTo↔hasMany, hasOne stays hasOne,
|
|
14
|
+
* belongsToMany stays belongsToMany (symmetric).
|
|
15
|
+
*/
|
|
16
|
+
export declare function reverseRelationship(relationship: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Derive SQL join type from semantic relationship
|
|
19
|
+
*/
|
|
20
|
+
export declare function getJoinType(relationship: string, override?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* DRIZZLE ORM LIMITATION: SQL Object Mutation Protection
|
|
23
|
+
*
|
|
24
|
+
* Create an isolated copy of a SQL expression to prevent mutation issues
|
|
25
|
+
* when the expression will be reused across multiple query contexts.
|
|
26
|
+
*
|
|
27
|
+
* ## Background
|
|
28
|
+
*
|
|
29
|
+
* Drizzle SQL objects are mutable - their internal `queryChunks` array can be
|
|
30
|
+
* modified during query construction. When column objects (like employees.id)
|
|
31
|
+
* are reused across multiple parts of a query (SELECT, WHERE, GROUP BY), this
|
|
32
|
+
* mutation can cause:
|
|
33
|
+
* - Duplicate SQL fragments in generated queries
|
|
34
|
+
* - Incorrect parameter binding order
|
|
35
|
+
* - Query execution failures
|
|
36
|
+
*
|
|
37
|
+
* ## Evidence from Drizzle Source Code
|
|
38
|
+
*
|
|
39
|
+
* Investigation of Drizzle ORM source code (/tmp/drizzle-orm/drizzle-orm/src/sql/sql.ts)
|
|
40
|
+
* revealed:
|
|
41
|
+
*
|
|
42
|
+
* 1. SQL objects have a mutable `queryChunks` array (line 133)
|
|
43
|
+
* 2. The `append()` method directly mutates this array
|
|
44
|
+
* 3. No public `clone()` method exists (only internal SQL.Aliased.clone())
|
|
45
|
+
* 4. The `sql` template function creates NEW arrays but chunks are pushed by reference
|
|
46
|
+
*
|
|
47
|
+
* ## The Double Wrapping Pattern
|
|
48
|
+
*
|
|
49
|
+
* `sql`${sql`${expr}`}`` creates two layers of SQL isolation:
|
|
50
|
+
*
|
|
51
|
+
* **Single wrap** (`sql`${expr}``):
|
|
52
|
+
* - Creates a new SQL object
|
|
53
|
+
* - But queryChunks contains REFERENCES to original objects
|
|
54
|
+
* - Original objects can still be mutated
|
|
55
|
+
*
|
|
56
|
+
* **Double wrap** (`sql`${sql`${expr}`}``):
|
|
57
|
+
* - Inner wrap: Creates fresh SQL from original expression
|
|
58
|
+
* - Outer wrap: Creates complete isolation from shared state
|
|
59
|
+
* - When Drizzle processes nested SQL, it recursively builds from inner chunks
|
|
60
|
+
* - This prevents corruption when SQL expressions are reused
|
|
61
|
+
*
|
|
62
|
+
* ## When to Use
|
|
63
|
+
*
|
|
64
|
+
* - **resolveSqlExpression()**: ALWAYS (expressions may be reused)
|
|
65
|
+
* - **buildMeasureExpression()**: ALWAYS (after resolveSqlExpression)
|
|
66
|
+
* - **New aggregations**: Single wrap OK (creating fresh SQL for first time)
|
|
67
|
+
*
|
|
68
|
+
* ## Alternatives Investigated
|
|
69
|
+
*
|
|
70
|
+
* - ❌ Use Drizzle's clone() - Doesn't exist publicly
|
|
71
|
+
* - ❌ Store SQL factory functions - Still returns same column objects
|
|
72
|
+
* - ❌ Create fresh column references - Impossible, columns are singletons
|
|
73
|
+
* - ❌ Avoid SQL reuse - Unavoidable (same dimension in SELECT, WHERE, GROUP BY)
|
|
74
|
+
*
|
|
75
|
+
* ## Performance Impact
|
|
76
|
+
*
|
|
77
|
+
* - Memory: ~200 bytes per wrap (negligible)
|
|
78
|
+
* - CPU: Two function calls during query building (microseconds)
|
|
79
|
+
* - No runtime query performance impact
|
|
80
|
+
*
|
|
81
|
+
* @param expr - SQL expression that may be reused across query contexts
|
|
82
|
+
* @returns Isolated SQL expression safe for reuse
|
|
83
|
+
*/
|
|
84
|
+
export declare function isolateSqlExpression(expr: AnyColumn | SQL): SQL;
|
|
85
|
+
/**
|
|
86
|
+
* Sanitize a property key to prevent prototype pollution.
|
|
87
|
+
* Keys in this codebase come from validated cube field names (e.g., "Cube.measure")
|
|
88
|
+
* but CodeQL cannot trace that validation across module boundaries.
|
|
89
|
+
*/
|
|
90
|
+
export declare function safeKey(key: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Helper to resolve SQL expressions with mutation protection
|
|
93
|
+
*
|
|
94
|
+
* Evaluates function-based SQL expressions and applies isolation to prevent
|
|
95
|
+
* Drizzle's internal mutation from corrupting reused SQL objects.
|
|
96
|
+
*
|
|
97
|
+
* @param expr - Column, SQL object, or function that returns one
|
|
98
|
+
* @param ctx - Query context for function evaluation
|
|
99
|
+
* @returns Isolated SQL expression safe for reuse
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolveSqlExpression(expr: AnyColumn | SQL | ((ctx: QueryContext) => AnyColumn | SQL), ctx: QueryContext): AnyColumn | SQL;
|
|
102
|
+
/**
|
|
103
|
+
* Helper to create multi-cube query context
|
|
104
|
+
*/
|
|
105
|
+
export declare function createMultiCubeContext(baseContext: QueryContext, cubes: Map<string, Cube>, currentCube: Cube): MultiCubeQueryContext;
|
|
106
|
+
/**
|
|
107
|
+
* Type guard to check if value is a function-based SQL expression
|
|
108
|
+
*/
|
|
109
|
+
export declare function isFunctionSqlExpression(expr: SqlExpression): expr is (ctx: QueryContext) => AnyColumn | SQL;
|
|
110
|
+
/**
|
|
111
|
+
* Helper function to create cubes
|
|
112
|
+
*/
|
|
113
|
+
export declare function defineCube(name: string, definition: Omit<Cube, 'name'>): Cube;
|
|
114
|
+
/**
|
|
115
|
+
* Expanded join information for belongsToMany relationships
|
|
116
|
+
*/
|
|
117
|
+
export interface ExpandedBelongsToManyJoin {
|
|
118
|
+
/** Junction table joins */
|
|
119
|
+
junctionJoins: Array<{
|
|
120
|
+
joinType: 'inner' | 'left' | 'right' | 'full';
|
|
121
|
+
table: any;
|
|
122
|
+
condition: SQL;
|
|
123
|
+
}>;
|
|
124
|
+
/** Security conditions for junction table (if any) */
|
|
125
|
+
junctionSecurityConditions?: SQL[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Expand a belongsToMany join into junction table joins
|
|
129
|
+
* This converts a many-to-many relationship into two separate joins:
|
|
130
|
+
* 1. Source cube -> Junction table
|
|
131
|
+
* 2. Junction table -> Target cube
|
|
132
|
+
*/
|
|
133
|
+
export declare function expandBelongsToManyJoin(joinDef: CubeJoin, securityContext: SecurityContext): ExpandedBelongsToManyJoin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DatabaseAdapter } from './adapters/base-adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Create a database adapter for the specified engine type
|
|
4
|
+
* @param engineType - The database engine type
|
|
5
|
+
* @returns Database adapter instance
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDatabaseAdapter(engineType: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake'): DatabaseAdapter;
|
|
8
|
+
/**
|
|
9
|
+
* Get available database adapters
|
|
10
|
+
* @returns Array of supported engine types
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSupportedEngines(): ('postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake')[];
|
|
13
|
+
/**
|
|
14
|
+
* Check if an engine type is supported
|
|
15
|
+
* @param engineType - Engine type to check
|
|
16
|
+
* @returns True if supported, false otherwise
|
|
17
|
+
*/
|
|
18
|
+
export declare function isEngineSupported(engineType: string): engineType is 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { SecurityContext, SemanticQuery, QueryResult, DatabaseExecutor, Cube, CacheConfig, ExplainOptions, ExplainResult, ExecutionOptions, QueryAnalysis, RLSSetupFn } from './types';
|
|
2
|
+
export declare class QueryExecutor {
|
|
3
|
+
private dbExecutor;
|
|
4
|
+
private queryBuilder;
|
|
5
|
+
private drizzlePlanBuilder;
|
|
6
|
+
private databaseAdapter;
|
|
7
|
+
private comparisonQueryBuilder;
|
|
8
|
+
private funnelQueryBuilder;
|
|
9
|
+
private flowQueryBuilder;
|
|
10
|
+
private retentionQueryBuilder;
|
|
11
|
+
private cacheConfig?;
|
|
12
|
+
private logicalPlanBuilder;
|
|
13
|
+
private planOptimiser;
|
|
14
|
+
private rlsSetup?;
|
|
15
|
+
constructor(dbExecutor: DatabaseExecutor, cacheConfig?: CacheConfig, rlsSetup?: RLSSetupFn);
|
|
16
|
+
/**
|
|
17
|
+
* Execute a function within a RLS-configured transaction context.
|
|
18
|
+
* If no rlsSetup function is configured, the function is called directly.
|
|
19
|
+
* Otherwise, opens a transaction, calls rlsSetup to configure RLS, then
|
|
20
|
+
* runs fn with this.dbExecutor replaced by a transaction-scoped executor.
|
|
21
|
+
*
|
|
22
|
+
* Concurrency-safe: the dbExecutor is per-request (created fresh by
|
|
23
|
+
* SemanticLayerCompiler.createQueryExecutor), so reassigning this.dbExecutor
|
|
24
|
+
* only affects this request.
|
|
25
|
+
*/
|
|
26
|
+
private withRLSContext;
|
|
27
|
+
/**
|
|
28
|
+
* Unified query execution method that handles both single and multi-cube queries
|
|
29
|
+
* @param options.skipCache - Skip cache lookup (but still cache the fresh result)
|
|
30
|
+
*/
|
|
31
|
+
execute(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext, options?: ExecutionOptions): Promise<QueryResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Build a logical plan for a query without executing it.
|
|
34
|
+
* Useful for testing, debugging, and plan inspection.
|
|
35
|
+
*/
|
|
36
|
+
buildLogicalPlan(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): import('./logical-plan').QueryNode;
|
|
37
|
+
/**
|
|
38
|
+
* Analyze planning decisions for a regular query using the same logical
|
|
39
|
+
* planning path as execution and dry-run SQL generation.
|
|
40
|
+
*/
|
|
41
|
+
analyzeQuery(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): QueryAnalysis;
|
|
42
|
+
/**
|
|
43
|
+
* Legacy interface for single cube queries
|
|
44
|
+
*/
|
|
45
|
+
executeQuery(cube: Cube, query: SemanticQuery, securityContext: SecurityContext): Promise<QueryResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a comparison query with caching support
|
|
48
|
+
* Wraps executeComparisonQuery with cache set logic
|
|
49
|
+
*/
|
|
50
|
+
private executeComparisonQueryWithCache;
|
|
51
|
+
/**
|
|
52
|
+
* Execute a comparison query with multiple date periods
|
|
53
|
+
* Expands compareDateRange into multiple sub-queries and merges results
|
|
54
|
+
*/
|
|
55
|
+
private executeComparisonQuery;
|
|
56
|
+
private buildComparisonExecutionPlan;
|
|
57
|
+
/**
|
|
58
|
+
* Execute a funnel query with caching support
|
|
59
|
+
*/
|
|
60
|
+
private executeFunnelQueryWithCache;
|
|
61
|
+
/**
|
|
62
|
+
* Execute a funnel analysis query
|
|
63
|
+
*/
|
|
64
|
+
private executeFunnelQuery;
|
|
65
|
+
/**
|
|
66
|
+
* Execute a flow query with caching support
|
|
67
|
+
*/
|
|
68
|
+
private executeFlowQueryWithCache;
|
|
69
|
+
/**
|
|
70
|
+
* Execute a flow analysis query
|
|
71
|
+
* Produces Sankey diagram data (nodes and links)
|
|
72
|
+
*/
|
|
73
|
+
private executeFlowQuery;
|
|
74
|
+
/**
|
|
75
|
+
* Execute a retention query with caching support
|
|
76
|
+
*/
|
|
77
|
+
private executeRetentionQueryWithCache;
|
|
78
|
+
/**
|
|
79
|
+
* Execute a retention analysis query
|
|
80
|
+
* Calculates cohort-based retention rates
|
|
81
|
+
*/
|
|
82
|
+
private executeRetentionQuery;
|
|
83
|
+
/**
|
|
84
|
+
* Standard query execution (non-comparison)
|
|
85
|
+
* This is the core execution logic extracted for use by comparison queries
|
|
86
|
+
*/
|
|
87
|
+
private executeStandardQuery;
|
|
88
|
+
/**
|
|
89
|
+
* Create a query context with optional filter cache.
|
|
90
|
+
*/
|
|
91
|
+
private createQueryContext;
|
|
92
|
+
/**
|
|
93
|
+
* Normalize engine type for optimiser passes.
|
|
94
|
+
* SingleStore follows MySQL SQL semantics for planner choices.
|
|
95
|
+
*/
|
|
96
|
+
private getOptimiserEngineType;
|
|
97
|
+
/**
|
|
98
|
+
* Shared regular-query planning pipeline used by execute, dry-run SQL,
|
|
99
|
+
* and analysis. This is the single source of planning truth.
|
|
100
|
+
*/
|
|
101
|
+
private buildRegularQueryArtifacts;
|
|
102
|
+
/**
|
|
103
|
+
* Validate that all cubes in the query plan have proper security filtering.
|
|
104
|
+
* Emits a warning if a cube's sql() function doesn't return a WHERE clause.
|
|
105
|
+
*
|
|
106
|
+
* Security is critical in multi-tenant applications - this validation helps
|
|
107
|
+
* detect cubes that may leak data across tenants.
|
|
108
|
+
*/
|
|
109
|
+
private validateSecurityContext;
|
|
110
|
+
/**
|
|
111
|
+
* Generate raw SQL for debugging (without execution) - unified approach
|
|
112
|
+
*/
|
|
113
|
+
generateSQL(cube: Cube, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
114
|
+
sql: string;
|
|
115
|
+
params?: any[];
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Generate raw SQL for multi-cube queries without execution - unified approach
|
|
119
|
+
*/
|
|
120
|
+
generateMultiCubeSQL(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
121
|
+
sql: string;
|
|
122
|
+
params?: any[];
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Generate SQL for a funnel query without execution (dry-run)
|
|
126
|
+
* Returns the actual CTE-based SQL that would be executed
|
|
127
|
+
*/
|
|
128
|
+
dryRunFunnel(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
129
|
+
sql: string;
|
|
130
|
+
params?: any[];
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* Generate SQL for a flow query without execution (dry-run)
|
|
134
|
+
* Returns the actual CTE-based SQL that would be executed
|
|
135
|
+
*/
|
|
136
|
+
dryRunFlow(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
137
|
+
sql: string;
|
|
138
|
+
params?: any[];
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Generate SQL for a retention query without execution (dry-run)
|
|
142
|
+
* Returns the actual CTE-based SQL that would be executed
|
|
143
|
+
*/
|
|
144
|
+
dryRunRetention(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
145
|
+
sql: string;
|
|
146
|
+
params?: any[];
|
|
147
|
+
}>;
|
|
148
|
+
/**
|
|
149
|
+
* Execute EXPLAIN on a query to get the execution plan
|
|
150
|
+
* Generates the SQL using the same secure path as execute/generateSQL,
|
|
151
|
+
* then runs EXPLAIN on the database.
|
|
152
|
+
*/
|
|
153
|
+
explainQuery(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext, options?: ExplainOptions): Promise<ExplainResult>;
|
|
154
|
+
/**
|
|
155
|
+
* Generate SQL for any query mode without execution.
|
|
156
|
+
* This is the canonical dry-run SQL entrypoint used by explain/adapters.
|
|
157
|
+
*/
|
|
158
|
+
dryRunSQL(cubes: Map<string, Cube>, query: SemanticQuery, securityContext: SecurityContext): Promise<{
|
|
159
|
+
sql: string;
|
|
160
|
+
params?: any[];
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Generate SQL using unified approach (works for both single and multi-cube)
|
|
164
|
+
*/
|
|
165
|
+
private generateUnifiedSQL;
|
|
166
|
+
private resolveQueryMode;
|
|
167
|
+
private validateQueryForMode;
|
|
168
|
+
private executeQueryByModeWithCache;
|
|
169
|
+
private executeRegularQueryWithCache;
|
|
170
|
+
private cacheResult;
|
|
171
|
+
private generateSqlForMode;
|
|
172
|
+
private generateComparisonSQL;
|
|
173
|
+
/**
|
|
174
|
+
* Generate annotations for UI metadata - unified approach
|
|
175
|
+
*/
|
|
176
|
+
private generateAnnotations;
|
|
177
|
+
/**
|
|
178
|
+
* Pre-build filter SQL and store in cache for reuse across CTEs and main query
|
|
179
|
+
* This enables parameter deduplication - the same filter values are shared
|
|
180
|
+
* rather than appearing as separate parameters in different parts of the query
|
|
181
|
+
*/
|
|
182
|
+
private preloadFilterCache;
|
|
183
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, DatabaseExecutor, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { DatabaseAdapter } from '../adapters/base-adapter';
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for database executors
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BaseDatabaseExecutor implements DatabaseExecutor {
|
|
8
|
+
db: DrizzleDatabase;
|
|
9
|
+
schema?: any | undefined;
|
|
10
|
+
databaseAdapter: DatabaseAdapter;
|
|
11
|
+
constructor(db: DrizzleDatabase, schema?: any | undefined, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake');
|
|
12
|
+
abstract execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
13
|
+
abstract getEngineType(): 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake';
|
|
14
|
+
abstract explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
15
|
+
abstract getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class DatabendExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Extract SQL string and params from a query object for error logging
|
|
8
|
+
*/
|
|
9
|
+
private extractSqlFromQuery;
|
|
10
|
+
/**
|
|
11
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
12
|
+
*/
|
|
13
|
+
private convertNumericFields;
|
|
14
|
+
/**
|
|
15
|
+
* Coerce a value to a number if it represents a numeric type
|
|
16
|
+
*/
|
|
17
|
+
private coerceToNumber;
|
|
18
|
+
getEngineType(): 'databend';
|
|
19
|
+
/**
|
|
20
|
+
* Execute EXPLAIN on a SQL query to get the execution plan
|
|
21
|
+
* Databend supports EXPLAIN and EXPLAIN ANALYZE
|
|
22
|
+
*/
|
|
23
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Get existing indexes for the specified tables
|
|
26
|
+
* Databend uses system tables for index information
|
|
27
|
+
*/
|
|
28
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Factory function for creating Databend executors
|
|
32
|
+
*/
|
|
33
|
+
export declare function createDatabendExecutor(db: DrizzleDatabase, schema?: any): DatabendExecutor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class DuckDBExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Extract SQL string and params from a query object for error logging
|
|
8
|
+
*/
|
|
9
|
+
private extractSqlFromQuery;
|
|
10
|
+
/**
|
|
11
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
12
|
+
*/
|
|
13
|
+
private convertNumericFields;
|
|
14
|
+
/**
|
|
15
|
+
* Coerce a value to a number if it represents a numeric type
|
|
16
|
+
*/
|
|
17
|
+
private coerceToNumber;
|
|
18
|
+
getEngineType(): 'duckdb';
|
|
19
|
+
/**
|
|
20
|
+
* Execute EXPLAIN on a SQL query to get the execution plan
|
|
21
|
+
* DuckDB supports EXPLAIN and EXPLAIN ANALYZE
|
|
22
|
+
*/
|
|
23
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Get existing indexes for the specified tables
|
|
26
|
+
* DuckDB uses duckdb_indexes() table function
|
|
27
|
+
*/
|
|
28
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Factory function for creating DuckDB executors
|
|
32
|
+
*/
|
|
33
|
+
export declare function createDuckDBExecutor(db: DrizzleDatabase, schema?: any): DuckDBExecutor;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DrizzleDatabase, DatabaseExecutor } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Database executors for different database engines
|
|
4
|
+
* Handles SQL execution with proper type coercion
|
|
5
|
+
*/
|
|
6
|
+
export { BaseDatabaseExecutor } from './base-executor';
|
|
7
|
+
export { PostgresExecutor, createPostgresExecutor } from './postgres-executor';
|
|
8
|
+
export { MySQLExecutor, createMySQLExecutor } from './mysql-executor';
|
|
9
|
+
export { SQLiteExecutor, createSQLiteExecutor } from './sqlite-executor';
|
|
10
|
+
export { SingleStoreExecutor, createSingleStoreExecutor } from './singlestore-executor';
|
|
11
|
+
export { DuckDBExecutor, createDuckDBExecutor } from './duckdb-executor';
|
|
12
|
+
export { DatabendExecutor, createDatabendExecutor } from './databend-executor';
|
|
13
|
+
export { SnowflakeExecutor, createSnowflakeExecutor } from './snowflake-executor';
|
|
14
|
+
/**
|
|
15
|
+
* Auto-detect database type and create appropriate executor
|
|
16
|
+
* @param db - Drizzle database instance
|
|
17
|
+
* @param schema - Optional schema for type inference
|
|
18
|
+
* @param engineType - Optional explicit engine type override
|
|
19
|
+
* @returns Appropriate database executor
|
|
20
|
+
*/
|
|
21
|
+
export declare function createDatabaseExecutor(db: DrizzleDatabase, schema?: any, engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb' | 'databend' | 'snowflake'): DatabaseExecutor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class MySQLExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Convert numeric string fields to numbers (measure fields + numeric dimensions)
|
|
8
|
+
*/
|
|
9
|
+
private convertNumericFields;
|
|
10
|
+
/**
|
|
11
|
+
* Coerce a value to a number if it represents a numeric type
|
|
12
|
+
*/
|
|
13
|
+
private coerceToNumber;
|
|
14
|
+
getEngineType(): 'mysql' | 'singlestore';
|
|
15
|
+
/**
|
|
16
|
+
* Execute EXPLAIN on a SQL query to get the execution plan
|
|
17
|
+
*/
|
|
18
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Get existing indexes for the specified tables
|
|
21
|
+
*/
|
|
22
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Factory function for creating MySQL executors
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMySQLExecutor(db: DrizzleDatabase, schema?: any): MySQLExecutor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class PostgresExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
8
|
+
*/
|
|
9
|
+
private convertNumericFields;
|
|
10
|
+
/**
|
|
11
|
+
* Coerce a value to a number if it represents a numeric type
|
|
12
|
+
*/
|
|
13
|
+
private coerceToNumber;
|
|
14
|
+
getEngineType(): 'postgres';
|
|
15
|
+
/**
|
|
16
|
+
* Execute EXPLAIN on a SQL query to get the execution plan
|
|
17
|
+
*/
|
|
18
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Get existing indexes for the specified tables
|
|
21
|
+
*/
|
|
22
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Factory function for creating PostgreSQL executors
|
|
26
|
+
*/
|
|
27
|
+
export declare function createPostgresExecutor(db: DrizzleDatabase, schema?: any): PostgresExecutor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DrizzleDatabase } from '../types';
|
|
2
|
+
import { MySQLExecutor } from './mysql-executor';
|
|
3
|
+
export declare class SingleStoreExecutor extends MySQLExecutor {
|
|
4
|
+
getEngineType(): 'singlestore';
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Factory function for creating SingleStore executors
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSingleStoreExecutor(db: DrizzleDatabase, schema?: any): SingleStoreExecutor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class SnowflakeExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Extract SQL string and params from a query object for error logging
|
|
8
|
+
*/
|
|
9
|
+
private extractSqlFromQuery;
|
|
10
|
+
/**
|
|
11
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
12
|
+
*/
|
|
13
|
+
private convertNumericFields;
|
|
14
|
+
/**
|
|
15
|
+
* Coerce a value to a number if it represents a numeric type
|
|
16
|
+
*/
|
|
17
|
+
private coerceToNumber;
|
|
18
|
+
getEngineType(): 'snowflake';
|
|
19
|
+
/**
|
|
20
|
+
* Execute EXPLAIN on a SQL query to get the execution plan
|
|
21
|
+
* Snowflake supports EXPLAIN and EXPLAIN USING TEXT/JSON/TABULAR
|
|
22
|
+
*/
|
|
23
|
+
explainQuery(sqlString: string, params: unknown[], options?: ExplainOptions): Promise<ExplainResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Get existing indexes for the specified tables
|
|
26
|
+
* Snowflake doesn't use traditional indexes (it uses micro-partitioning)
|
|
27
|
+
*/
|
|
28
|
+
getTableIndexes(_tableNames: string[]): Promise<IndexInfo[]>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Factory function for creating Snowflake executors
|
|
32
|
+
*/
|
|
33
|
+
export declare function createSnowflakeExecutor(db: DrizzleDatabase, schema?: any): SnowflakeExecutor;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SQL } from 'drizzle-orm';
|
|
2
|
+
import { DrizzleDatabase, ExplainOptions, ExplainResult, IndexInfo } from '../types';
|
|
3
|
+
import { BaseDatabaseExecutor } from './base-executor';
|
|
4
|
+
export declare class SQLiteExecutor extends BaseDatabaseExecutor {
|
|
5
|
+
execute<T = any[]>(query: SQL | any, numericFields?: string[]): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Convert numeric string fields to numbers (only for measure fields)
|
|
8
|
+
*/
|
|
9
|
+
private convertNumericFields;
|
|
10
|
+
/**
|
|
11
|
+
* Coerce a value to a number if it represents a numeric type
|
|
12
|
+
*/
|
|
13
|
+
private coerceToNumber;
|
|
14
|
+
getEngineType(): 'sqlite';
|
|
15
|
+
/**
|
|
16
|
+
* Execute EXPLAIN QUERY PLAN on a SQL query to get the execution plan
|
|
17
|
+
* Note: SQLite doesn't support EXPLAIN ANALYZE
|
|
18
|
+
*/
|
|
19
|
+
explainQuery(sqlString: string, params: unknown[], _options?: ExplainOptions): Promise<ExplainResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Get existing indexes for the specified tables
|
|
22
|
+
*/
|
|
23
|
+
getTableIndexes(tableNames: string[]): Promise<IndexInfo[]>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Factory function for creating SQLite executors
|
|
27
|
+
*/
|
|
28
|
+
export declare function createSQLiteExecutor(db: DrizzleDatabase, schema?: any): SQLiteExecutor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExplainResult } from '../types/executor';
|
|
2
|
+
/**
|
|
3
|
+
* Parse Databend EXPLAIN output
|
|
4
|
+
*
|
|
5
|
+
* Databend EXPLAIN output is typically indented text showing the query plan tree.
|
|
6
|
+
* Example:
|
|
7
|
+
* "Filter"
|
|
8
|
+
* "├── filters: [employees.organisation_id = 1]"
|
|
9
|
+
* "├── TableScan"
|
|
10
|
+
* "│ ├── table: employees"
|
|
11
|
+
* "│ ├── estimated rows: 1000"
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseDatabendExplain(rawOutput: string[], sqlQuery: {
|
|
14
|
+
sql: string;
|
|
15
|
+
params?: unknown[];
|
|
16
|
+
}): ExplainResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ExplainResult } from '../types/executor';
|
|
2
|
+
/**
|
|
3
|
+
* Parse DuckDB EXPLAIN output
|
|
4
|
+
*
|
|
5
|
+
* Example DuckDB EXPLAIN output:
|
|
6
|
+
* "┌───────────────────────────┐"
|
|
7
|
+
* "│ EXPLANATION OF │"
|
|
8
|
+
* "│ QUERY PLAN │"
|
|
9
|
+
* "└───────────────────────────┘"
|
|
10
|
+
* "┌─────────────────────────────────────────────────────────────────────┐"
|
|
11
|
+
* "│ QUERY PLAN │"
|
|
12
|
+
* "├─────────────────────────────────────────────────────────────────────┤"
|
|
13
|
+
* "│ HASH_JOIN │"
|
|
14
|
+
* "│ ├──SEQ_SCAN employees │"
|
|
15
|
+
* "│ │ (cost=100.0 rows=1000) │"
|
|
16
|
+
* "│ └──SEQ_SCAN departments │"
|
|
17
|
+
* "│ (cost=50.0 rows=500) │"
|
|
18
|
+
* "└─────────────────────────────────────────────────────────────────────┘"
|
|
19
|
+
*
|
|
20
|
+
* Or simpler format:
|
|
21
|
+
* "HASH_JOIN"
|
|
22
|
+
* "├──SEQ_SCAN employees"
|
|
23
|
+
* "└──SEQ_SCAN departments"
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseDuckDBExplain(rawOutput: string[], sqlQuery: {
|
|
26
|
+
sql: string;
|
|
27
|
+
params?: unknown[];
|
|
28
|
+
}): ExplainResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EXPLAIN plan parsers
|
|
3
|
+
* Normalize raw EXPLAIN output from different databases to a common format
|
|
4
|
+
*/
|
|
5
|
+
export { parsePostgresExplain } from './postgres-parser';
|
|
6
|
+
export { parseMySQLExplain } from './mysql-parser';
|
|
7
|
+
export { parseSQLiteExplain } from './sqlite-parser';
|
|
8
|
+
export { parseDuckDBExplain } from './duckdb-parser';
|
|
9
|
+
export type { ExplainOperation, ExplainResult, ExplainSummary, ExplainOptions } from '../types/executor';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ExplainResult } from '../types/executor';
|
|
2
|
+
/**
|
|
3
|
+
* MySQL EXPLAIN row structure
|
|
4
|
+
* Standard columns returned by EXPLAIN
|
|
5
|
+
*/
|
|
6
|
+
interface MySQLExplainRow {
|
|
7
|
+
id: number;
|
|
8
|
+
select_type: string;
|
|
9
|
+
table: string | null;
|
|
10
|
+
partitions: string | null;
|
|
11
|
+
type: string;
|
|
12
|
+
possible_keys: string | null;
|
|
13
|
+
key: string | null;
|
|
14
|
+
key_len: string | null;
|
|
15
|
+
ref: string | null;
|
|
16
|
+
rows: number;
|
|
17
|
+
filtered: number;
|
|
18
|
+
Extra: string | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parse MySQL EXPLAIN output
|
|
22
|
+
*
|
|
23
|
+
* MySQL EXPLAIN returns rows with columns:
|
|
24
|
+
* id, select_type, table, partitions, type, possible_keys, key, key_len, ref, rows, filtered, Extra
|
|
25
|
+
*
|
|
26
|
+
* The 'type' column indicates access method:
|
|
27
|
+
* - ALL: Full table scan (like Seq Scan)
|
|
28
|
+
* - index: Full index scan
|
|
29
|
+
* - range: Index range scan
|
|
30
|
+
* - ref: Index lookup using non-unique index
|
|
31
|
+
* - eq_ref: Index lookup using unique index
|
|
32
|
+
* - const: Single row lookup
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseMySQLExplain(rows: MySQLExplainRow[], sqlQuery: {
|
|
35
|
+
sql: string;
|
|
36
|
+
params?: unknown[];
|
|
37
|
+
}): ExplainResult;
|
|
38
|
+
export {};
|