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,119 @@
|
|
|
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 PostgresAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'postgres';
|
|
6
|
+
/**
|
|
7
|
+
* PostgreSQL supports LATERAL joins since version 9.3
|
|
8
|
+
*/
|
|
9
|
+
supportsLateralJoins(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Build PostgreSQL INTERVAL from ISO 8601 duration
|
|
12
|
+
* PostgreSQL supports INTERVAL literal syntax: INTERVAL '7 days'
|
|
13
|
+
*/
|
|
14
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
15
|
+
/**
|
|
16
|
+
* Build PostgreSQL time difference in seconds using EXTRACT(EPOCH FROM ...)
|
|
17
|
+
* Returns (end - start) as seconds
|
|
18
|
+
*/
|
|
19
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
20
|
+
/**
|
|
21
|
+
* Build PostgreSQL timestamp + interval expression
|
|
22
|
+
*/
|
|
23
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
24
|
+
/**
|
|
25
|
+
* Build PostgreSQL conditional aggregation using FILTER clause
|
|
26
|
+
* PostgreSQL supports the standard SQL FILTER clause for efficient conditional aggregation
|
|
27
|
+
* Example: AVG(time_diff) FILTER (WHERE step_1_time IS NOT NULL)
|
|
28
|
+
*/
|
|
29
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
30
|
+
/**
|
|
31
|
+
* Build PostgreSQL date difference in periods using AGE and EXTRACT
|
|
32
|
+
* For retention analysis period calculations
|
|
33
|
+
*/
|
|
34
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
35
|
+
/**
|
|
36
|
+
* Build PostgreSQL period series using generate_series
|
|
37
|
+
* PostgreSQL's generate_series returns a set directly usable as a table
|
|
38
|
+
*/
|
|
39
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
40
|
+
/**
|
|
41
|
+
* Build PostgreSQL time dimension using DATE_TRUNC function
|
|
42
|
+
* Extracted from executor.ts:649-670 and multi-cube-builder.ts:306-320
|
|
43
|
+
*/
|
|
44
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
45
|
+
/**
|
|
46
|
+
* Build PostgreSQL string matching conditions using ILIKE (case-insensitive)
|
|
47
|
+
* Extracted from executor.ts:807-813 and multi-cube-builder.ts:468-474
|
|
48
|
+
*/
|
|
49
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
50
|
+
/**
|
|
51
|
+
* Build PostgreSQL type casting using :: syntax
|
|
52
|
+
* Extracted from various locations where ::timestamp was used
|
|
53
|
+
*/
|
|
54
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
55
|
+
/**
|
|
56
|
+
* Build PostgreSQL AVG aggregation with COALESCE for NULL handling
|
|
57
|
+
* PostgreSQL AVG returns NULL for empty sets, so we use COALESCE for consistent behavior
|
|
58
|
+
* Extracted from multi-cube-builder.ts:284
|
|
59
|
+
*/
|
|
60
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
61
|
+
/**
|
|
62
|
+
* Build PostgreSQL CASE WHEN conditional expression
|
|
63
|
+
*/
|
|
64
|
+
buildCaseWhen(conditions: Array<{
|
|
65
|
+
when: SQL;
|
|
66
|
+
then: any;
|
|
67
|
+
}>, elseValue?: any): SQL;
|
|
68
|
+
/**
|
|
69
|
+
* Build PostgreSQL boolean literal
|
|
70
|
+
* PostgreSQL uses TRUE/FALSE keywords
|
|
71
|
+
*/
|
|
72
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
73
|
+
/**
|
|
74
|
+
* Convert filter values - PostgreSQL uses native types
|
|
75
|
+
* No conversion needed for PostgreSQL
|
|
76
|
+
*/
|
|
77
|
+
convertFilterValue(value: any): any;
|
|
78
|
+
/**
|
|
79
|
+
* Prepare date value for PostgreSQL
|
|
80
|
+
* PostgreSQL accepts Date objects directly
|
|
81
|
+
*/
|
|
82
|
+
prepareDateValue(date: Date): any;
|
|
83
|
+
/**
|
|
84
|
+
* PostgreSQL stores timestamps as native timestamp types
|
|
85
|
+
*/
|
|
86
|
+
isTimestampInteger(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* PostgreSQL time dimensions already return proper values
|
|
89
|
+
* No conversion needed
|
|
90
|
+
*/
|
|
91
|
+
convertTimeDimensionResult(value: any): any;
|
|
92
|
+
/**
|
|
93
|
+
* PostgreSQL has full support for statistical and window functions
|
|
94
|
+
*/
|
|
95
|
+
getCapabilities(): DatabaseCapabilities;
|
|
96
|
+
/**
|
|
97
|
+
* Build PostgreSQL STDDEV aggregation
|
|
98
|
+
* Uses STDDEV_POP for population, STDDEV_SAMP for sample
|
|
99
|
+
*/
|
|
100
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
101
|
+
/**
|
|
102
|
+
* Build PostgreSQL VARIANCE aggregation
|
|
103
|
+
* Uses VAR_POP for population, VAR_SAMP for sample
|
|
104
|
+
*/
|
|
105
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
106
|
+
/**
|
|
107
|
+
* Build PostgreSQL PERCENTILE_CONT aggregation
|
|
108
|
+
* Uses ordered-set aggregate function
|
|
109
|
+
*/
|
|
110
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
111
|
+
/**
|
|
112
|
+
* Build PostgreSQL window function expression
|
|
113
|
+
* PostgreSQL has full window function support
|
|
114
|
+
*/
|
|
115
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
116
|
+
field: AnyColumn | SQL;
|
|
117
|
+
direction: 'asc' | 'desc';
|
|
118
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
119
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 SnowflakeAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'snowflake';
|
|
6
|
+
/**
|
|
7
|
+
* Snowflake supports LATERAL joins
|
|
8
|
+
*/
|
|
9
|
+
supportsLateralJoins(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Build Snowflake INTERVAL from ISO 8601 duration
|
|
12
|
+
* Snowflake doesn't support INTERVAL literal syntax directly in all contexts,
|
|
13
|
+
* so we chain DATEADD calls. For standalone interval expressions, we return
|
|
14
|
+
* a DATEADD chain applied to TIMESTAMP '1970-01-01' and subtract it back.
|
|
15
|
+
* However, buildIntervalFromISO is typically used with buildDateAddInterval,
|
|
16
|
+
* so we return a structured representation.
|
|
17
|
+
*/
|
|
18
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
19
|
+
/**
|
|
20
|
+
* Build Snowflake time difference in seconds
|
|
21
|
+
* Uses DATEDIFF('SECOND', start, end)
|
|
22
|
+
*/
|
|
23
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
24
|
+
/**
|
|
25
|
+
* Build Snowflake timestamp + interval expression
|
|
26
|
+
* Uses chained DATEADD(unit, amount, timestamp) calls
|
|
27
|
+
*/
|
|
28
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
29
|
+
/**
|
|
30
|
+
* Build Snowflake conditional aggregation using CASE WHEN
|
|
31
|
+
* Snowflake supports FILTER clause but CASE WHEN is more portable
|
|
32
|
+
*/
|
|
33
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
34
|
+
/**
|
|
35
|
+
* Build Snowflake date difference in periods using DATEDIFF
|
|
36
|
+
*/
|
|
37
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
38
|
+
/**
|
|
39
|
+
* Build Snowflake period series using TABLE(GENERATOR(ROWCOUNT => n)) + ROW_NUMBER()
|
|
40
|
+
*/
|
|
41
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
42
|
+
/**
|
|
43
|
+
* Build Snowflake time dimension using DATE_TRUNC function
|
|
44
|
+
* Snowflake supports DATE_TRUNC with quoted granularity like PostgreSQL
|
|
45
|
+
*/
|
|
46
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
47
|
+
/**
|
|
48
|
+
* Build Snowflake string matching conditions using native ILIKE
|
|
49
|
+
* Snowflake supports ILIKE natively
|
|
50
|
+
*/
|
|
51
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
52
|
+
/**
|
|
53
|
+
* Build Snowflake type casting using :: syntax
|
|
54
|
+
* Snowflake supports both :: syntax and CAST() function
|
|
55
|
+
*/
|
|
56
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
57
|
+
/**
|
|
58
|
+
* Build Snowflake AVG aggregation with COALESCE for NULL handling
|
|
59
|
+
*/
|
|
60
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
61
|
+
/**
|
|
62
|
+
* Build Snowflake CASE WHEN conditional expression
|
|
63
|
+
*/
|
|
64
|
+
buildCaseWhen(conditions: Array<{
|
|
65
|
+
when: SQL;
|
|
66
|
+
then: any;
|
|
67
|
+
}>, elseValue?: any): SQL;
|
|
68
|
+
/**
|
|
69
|
+
* Build Snowflake boolean literal
|
|
70
|
+
* Snowflake uses TRUE/FALSE keywords
|
|
71
|
+
*/
|
|
72
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
73
|
+
/**
|
|
74
|
+
* Convert filter values - Snowflake uses native types
|
|
75
|
+
*/
|
|
76
|
+
convertFilterValue(value: any): any;
|
|
77
|
+
/**
|
|
78
|
+
* Prepare date value for Snowflake
|
|
79
|
+
* Snowflake accepts Date objects directly
|
|
80
|
+
*/
|
|
81
|
+
prepareDateValue(date: Date): any;
|
|
82
|
+
/**
|
|
83
|
+
* Snowflake stores timestamps as native timestamp types
|
|
84
|
+
*/
|
|
85
|
+
isTimestampInteger(): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Snowflake time dimensions already return proper values
|
|
88
|
+
*/
|
|
89
|
+
convertTimeDimensionResult(value: any): any;
|
|
90
|
+
/**
|
|
91
|
+
* Snowflake capabilities - full SQL support
|
|
92
|
+
*/
|
|
93
|
+
getCapabilities(): DatabaseCapabilities;
|
|
94
|
+
/**
|
|
95
|
+
* Build Snowflake STDDEV aggregation
|
|
96
|
+
*/
|
|
97
|
+
buildStddev(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
98
|
+
/**
|
|
99
|
+
* Build Snowflake VARIANCE aggregation
|
|
100
|
+
* Snowflake supports native VAR_POP/VAR_SAMP
|
|
101
|
+
*/
|
|
102
|
+
buildVariance(fieldExpr: AnyColumn | SQL, useSample?: boolean): SQL;
|
|
103
|
+
/**
|
|
104
|
+
* Build Snowflake PERCENTILE_CONT aggregation
|
|
105
|
+
* Uses ordered-set aggregate function
|
|
106
|
+
*/
|
|
107
|
+
buildPercentile(fieldExpr: AnyColumn | SQL, percentile: number): SQL;
|
|
108
|
+
/**
|
|
109
|
+
* Build Snowflake window function expression
|
|
110
|
+
* Snowflake has full window function support
|
|
111
|
+
*/
|
|
112
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
113
|
+
field: AnyColumn | SQL;
|
|
114
|
+
direction: 'asc' | 'desc';
|
|
115
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
116
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
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 SQLiteAdapter extends BaseDatabaseAdapter {
|
|
5
|
+
getEngineType(): 'sqlite';
|
|
6
|
+
/**
|
|
7
|
+
* SQLite does not support LATERAL joins
|
|
8
|
+
* Flow queries require LATERAL for efficient execution and are not supported on SQLite
|
|
9
|
+
*/
|
|
10
|
+
supportsLateralJoins(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Build SQLite INTERVAL from ISO 8601 duration
|
|
13
|
+
* SQLite doesn't have native interval types, so we convert to seconds
|
|
14
|
+
* for arithmetic operations on Unix timestamps
|
|
15
|
+
*/
|
|
16
|
+
buildIntervalFromISO(duration: string): SQL;
|
|
17
|
+
/**
|
|
18
|
+
* Build SQLite time difference in seconds
|
|
19
|
+
* SQLite timestamps are stored as Unix seconds, so simple subtraction works
|
|
20
|
+
* Returns (end - start) as seconds
|
|
21
|
+
*/
|
|
22
|
+
buildTimeDifferenceSeconds(end: SQL, start: SQL): SQL;
|
|
23
|
+
/**
|
|
24
|
+
* Build SQLite timestamp + interval expression
|
|
25
|
+
* Since SQLite stores timestamps as Unix seconds, just add the seconds
|
|
26
|
+
*/
|
|
27
|
+
buildDateAddInterval(timestamp: SQL, duration: string): SQL;
|
|
28
|
+
/**
|
|
29
|
+
* Build SQLite conditional aggregation using CASE WHEN
|
|
30
|
+
* SQLite doesn't support FILTER clause, so we use CASE WHEN pattern
|
|
31
|
+
* Example: AVG(CASE WHEN step_1_time IS NOT NULL THEN time_diff END)
|
|
32
|
+
*/
|
|
33
|
+
buildConditionalAggregation(aggFn: 'count' | 'avg' | 'min' | 'max' | 'sum', expr: SQL | null, condition: SQL): SQL;
|
|
34
|
+
/**
|
|
35
|
+
* Build SQLite date difference in periods
|
|
36
|
+
* SQLite uses Julian day calculations for date arithmetic
|
|
37
|
+
* Note: SQLite timestamps are stored as Unix seconds
|
|
38
|
+
*/
|
|
39
|
+
buildDateDiffPeriods(startDate: SQL, endDate: SQL, unit: 'day' | 'week' | 'month'): SQL;
|
|
40
|
+
/**
|
|
41
|
+
* Build SQLite period series using recursive CTE
|
|
42
|
+
* SQLite 3.8.3+ supports recursive CTEs for generating sequences
|
|
43
|
+
*/
|
|
44
|
+
buildPeriodSeriesSubquery(maxPeriod: number): SQL;
|
|
45
|
+
/**
|
|
46
|
+
* Build SQLite time dimension using date/datetime functions with modifiers
|
|
47
|
+
* For integer timestamp columns (milliseconds), first convert to datetime
|
|
48
|
+
* SQLite doesn't have DATE_TRUNC like PostgreSQL, so we use strftime and date modifiers
|
|
49
|
+
* Returns datetime strings for consistency with other databases
|
|
50
|
+
*/
|
|
51
|
+
buildTimeDimension(granularity: TimeGranularity, fieldExpr: AnyColumn | SQL): SQL;
|
|
52
|
+
/**
|
|
53
|
+
* Build SQLite string matching conditions using LOWER() + LIKE for case-insensitive matching
|
|
54
|
+
* SQLite LIKE is case-insensitive by default, but LOWER() ensures consistency
|
|
55
|
+
*/
|
|
56
|
+
buildStringCondition(fieldExpr: AnyColumn | SQL, operator: 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'like' | 'notLike' | 'ilike' | 'regex' | 'notRegex', value: string): SQL;
|
|
57
|
+
/**
|
|
58
|
+
* Build SQLite type casting using CAST() function
|
|
59
|
+
* SQLite has dynamic typing but supports CAST for consistency
|
|
60
|
+
*/
|
|
61
|
+
castToType(fieldExpr: AnyColumn | SQL, targetType: 'timestamp' | 'decimal' | 'integer'): SQL;
|
|
62
|
+
/**
|
|
63
|
+
* Build SQLite AVG aggregation with IFNULL for NULL handling
|
|
64
|
+
* SQLite AVG returns NULL for empty sets, using IFNULL for consistency
|
|
65
|
+
*/
|
|
66
|
+
buildAvg(fieldExpr: AnyColumn | SQL): SQL;
|
|
67
|
+
/**
|
|
68
|
+
* Build SQLite CASE WHEN conditional expression
|
|
69
|
+
*/
|
|
70
|
+
buildCaseWhen(conditions: Array<{
|
|
71
|
+
when: SQL;
|
|
72
|
+
then: any;
|
|
73
|
+
}>, elseValue?: any): SQL;
|
|
74
|
+
/**
|
|
75
|
+
* Build SQLite boolean literal
|
|
76
|
+
* SQLite uses 1/0 for true/false
|
|
77
|
+
*/
|
|
78
|
+
buildBooleanLiteral(value: boolean): SQL;
|
|
79
|
+
/**
|
|
80
|
+
* Preprocess calculated measure templates for SQLite-specific handling
|
|
81
|
+
*
|
|
82
|
+
* SQLite performs integer division by default (5/2 = 2 instead of 2.5).
|
|
83
|
+
* This method wraps division operands with CAST to REAL to ensure float division.
|
|
84
|
+
*
|
|
85
|
+
* Pattern matched: {measure1} / {measure2} or {measure1} / NULLIF({measure2}, 0)
|
|
86
|
+
* Transforms to: CAST({measure1} AS REAL) / ...
|
|
87
|
+
*
|
|
88
|
+
* @param calculatedSql - Template string with {member} references
|
|
89
|
+
* @returns Preprocessed template with CAST for division operations
|
|
90
|
+
*/
|
|
91
|
+
preprocessCalculatedTemplate(calculatedSql: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Convert filter values to SQLite-compatible types
|
|
94
|
+
* SQLite doesn't support boolean types - convert boolean to integer (1/0)
|
|
95
|
+
* Convert Date objects to milliseconds for integer timestamp columns
|
|
96
|
+
*/
|
|
97
|
+
convertFilterValue(value: any): any;
|
|
98
|
+
/**
|
|
99
|
+
* Prepare date value for SQLite integer timestamp storage
|
|
100
|
+
* Convert Date objects to milliseconds (Unix timestamp * 1000)
|
|
101
|
+
*/
|
|
102
|
+
prepareDateValue(date: Date): any;
|
|
103
|
+
/**
|
|
104
|
+
* SQLite stores timestamps as integers (milliseconds)
|
|
105
|
+
*/
|
|
106
|
+
isTimestampInteger(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Convert SQLite time dimension results back to Date objects
|
|
109
|
+
* SQLite time dimensions return datetime strings, but clients expect Date objects
|
|
110
|
+
*/
|
|
111
|
+
convertTimeDimensionResult(value: any): any;
|
|
112
|
+
/**
|
|
113
|
+
* SQLite has limited statistical support (no native STDDEV/VARIANCE/PERCENTILE)
|
|
114
|
+
* but supports window functions since SQLite 3.25
|
|
115
|
+
*/
|
|
116
|
+
getCapabilities(): DatabaseCapabilities;
|
|
117
|
+
/**
|
|
118
|
+
* SQLite does not have native STDDEV
|
|
119
|
+
* Returns null for graceful degradation
|
|
120
|
+
*/
|
|
121
|
+
buildStddev(_fieldExpr: AnyColumn | SQL, _useSample?: boolean): SQL | null;
|
|
122
|
+
/**
|
|
123
|
+
* SQLite does not have native VARIANCE
|
|
124
|
+
* Returns null for graceful degradation
|
|
125
|
+
*/
|
|
126
|
+
buildVariance(_fieldExpr: AnyColumn | SQL, _useSample?: boolean): SQL | null;
|
|
127
|
+
/**
|
|
128
|
+
* SQLite does not have native PERCENTILE
|
|
129
|
+
* Returns null for graceful degradation
|
|
130
|
+
*/
|
|
131
|
+
buildPercentile(_fieldExpr: AnyColumn | SQL, _percentile: number): SQL | null;
|
|
132
|
+
/**
|
|
133
|
+
* Build SQLite window function expression
|
|
134
|
+
* SQLite 3.25+ supports window functions
|
|
135
|
+
*/
|
|
136
|
+
buildWindowFunction(type: WindowFunctionType, fieldExpr: AnyColumn | SQL | null, partitionBy?: (AnyColumn | SQL)[], orderBy?: Array<{
|
|
137
|
+
field: AnyColumn | SQL;
|
|
138
|
+
direction: 'asc' | 'desc';
|
|
139
|
+
}>, config?: WindowFunctionConfig): SQL;
|
|
140
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart Config Validation for Agent Tool
|
|
3
|
+
*
|
|
4
|
+
* Validates chartConfig against drop zone requirements defined in the chart config registry.
|
|
5
|
+
* Auto-infers missing fields from the query structure.
|
|
6
|
+
* Builds per-chart-type guidance for the tool description.
|
|
7
|
+
*/
|
|
8
|
+
interface ValidationResult {
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
errors: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validate chartConfig against the chart type's drop zone requirements.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateChartConfig(chartType: string, chartConfig: Record<string, unknown> | undefined, _query: Record<string, unknown>): ValidationResult;
|
|
16
|
+
/**
|
|
17
|
+
* Auto-infer missing chartConfig fields from the query structure.
|
|
18
|
+
* Fills in xAxis, yAxis, series, sizeField, etc. based on query measures/dimensions
|
|
19
|
+
* and the chart type's drop zone acceptTypes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function inferChartConfig(chartType: string, chartConfig: Record<string, unknown> | undefined, query: Record<string, unknown>): Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Build per-chart-type requirements text for the agent tool description.
|
|
24
|
+
* Includes description, useCase, and drop zone requirements for each chart type.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildChartRequirementsDescription(allowedChartTypes: string[]): string;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SemanticLayerCompiler } from '../compiler';
|
|
2
|
+
import { SecurityContext } from '../types';
|
|
3
|
+
import { AgentConfig, AgentSSEEvent, AgentHistoryMessage } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Handle an agent chat request, yielding SSE events as the agent works.
|
|
6
|
+
*
|
|
7
|
+
* Uses the configured LLM provider with streaming for edge-runtime compatibility.
|
|
8
|
+
* Implements a manual agentic loop: send messages → stream response → execute
|
|
9
|
+
* tool calls → append results → repeat until the model stops requesting tools.
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleAgentChat(options: {
|
|
12
|
+
message: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
history?: AgentHistoryMessage[];
|
|
15
|
+
semanticLayer: SemanticLayerCompiler;
|
|
16
|
+
securityContext: SecurityContext;
|
|
17
|
+
agentConfig: AgentConfig;
|
|
18
|
+
apiKey: string;
|
|
19
|
+
/** Per-request context appended to the system prompt (e.g. user info, tenant context) */
|
|
20
|
+
systemContext?: string;
|
|
21
|
+
/** Per-request overrides from client headers (take precedence over agentConfig) */
|
|
22
|
+
providerOverride?: string;
|
|
23
|
+
modelOverride?: string;
|
|
24
|
+
baseURLOverride?: string;
|
|
25
|
+
}): AsyncGenerator<AgentSSEEvent>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Module - Public Exports
|
|
3
|
+
* Agentic AI notebook handler for drizzle-cube
|
|
4
|
+
*/
|
|
5
|
+
export { handleAgentChat } from './handler';
|
|
6
|
+
export { getToolDefinitions, createToolExecutor } from './tools';
|
|
7
|
+
export type { ToolExecutionResult } from './tools';
|
|
8
|
+
export { buildAgentSystemPrompt } from './system-prompt';
|
|
9
|
+
export { createProvider } from './providers';
|
|
10
|
+
export type { LLMProvider, ProviderName } from './providers';
|
|
11
|
+
export type { AgentChatRequest, AgentConfig, AgentObservabilityHooks, AgentSSEEvent, AgentHistoryMessage, AgentHistoryToolCall, PortletBlockData, MarkdownBlockData, DashboardSavedData } from './types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LLMProvider, ToolDefinition, InternalMessage, ToolResult, NormalizedEvent } from './types';
|
|
2
|
+
export declare class AnthropicProvider implements LLMProvider {
|
|
3
|
+
private client;
|
|
4
|
+
constructor(apiKey: string);
|
|
5
|
+
private apiKey;
|
|
6
|
+
private initialized;
|
|
7
|
+
private ensureClient;
|
|
8
|
+
createStream(params: {
|
|
9
|
+
model: string;
|
|
10
|
+
maxTokens: number;
|
|
11
|
+
system: string;
|
|
12
|
+
tools: ToolDefinition[];
|
|
13
|
+
messages: InternalMessage[];
|
|
14
|
+
}): Promise<AsyncIterable<unknown>>;
|
|
15
|
+
parseStreamEvents(stream: AsyncIterable<unknown>): AsyncGenerator<NormalizedEvent>;
|
|
16
|
+
formatTools(tools: ToolDefinition[]): unknown[];
|
|
17
|
+
formatMessages(messages: InternalMessage[], system: string): {
|
|
18
|
+
messages: unknown[];
|
|
19
|
+
system?: string;
|
|
20
|
+
};
|
|
21
|
+
formatToolResults(results: ToolResult[]): unknown;
|
|
22
|
+
shouldContinue(stopReason: string): boolean;
|
|
23
|
+
formatError(error: unknown): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LLMProvider } from './types';
|
|
2
|
+
export type ProviderName = 'anthropic' | 'openai' | 'google';
|
|
3
|
+
/**
|
|
4
|
+
* Create an LLM provider instance.
|
|
5
|
+
*
|
|
6
|
+
* @param provider - Provider name ('anthropic', 'openai', 'google')
|
|
7
|
+
* @param apiKey - API key for the provider
|
|
8
|
+
* @param options - Optional configuration (e.g. baseURL for OpenAI-compatible services)
|
|
9
|
+
*/
|
|
10
|
+
export declare function createProvider(provider: ProviderName, apiKey: string, options?: {
|
|
11
|
+
baseURL?: string;
|
|
12
|
+
}): Promise<LLMProvider>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LLMProvider, ToolDefinition, InternalMessage, ToolResult, NormalizedEvent } from './types';
|
|
2
|
+
export declare class GoogleProvider implements LLMProvider {
|
|
3
|
+
private apiKey;
|
|
4
|
+
private sdk;
|
|
5
|
+
private initialized;
|
|
6
|
+
constructor(apiKey: string);
|
|
7
|
+
private ensureSDK;
|
|
8
|
+
createStream(params: {
|
|
9
|
+
model: string;
|
|
10
|
+
maxTokens: number;
|
|
11
|
+
system: string;
|
|
12
|
+
tools: ToolDefinition[];
|
|
13
|
+
messages: InternalMessage[];
|
|
14
|
+
}): Promise<AsyncIterable<unknown>>;
|
|
15
|
+
parseStreamEvents(stream: AsyncIterable<unknown>): AsyncGenerator<NormalizedEvent>;
|
|
16
|
+
formatTools(tools: ToolDefinition[]): unknown[];
|
|
17
|
+
formatMessages(messages: InternalMessage[], _system: string): {
|
|
18
|
+
messages: unknown[];
|
|
19
|
+
};
|
|
20
|
+
formatToolResults(results: ToolResult[]): unknown;
|
|
21
|
+
shouldContinue(stopReason: string): boolean;
|
|
22
|
+
formatError(error: unknown): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LLMProvider, ToolDefinition, InternalMessage, ToolResult, NormalizedEvent } from './types';
|
|
2
|
+
export declare class OpenAIProvider implements LLMProvider {
|
|
3
|
+
private client;
|
|
4
|
+
private apiKey;
|
|
5
|
+
private baseURL?;
|
|
6
|
+
private initialized;
|
|
7
|
+
constructor(apiKey: string, options?: {
|
|
8
|
+
baseURL?: string;
|
|
9
|
+
});
|
|
10
|
+
private ensureClient;
|
|
11
|
+
createStream(params: {
|
|
12
|
+
model: string;
|
|
13
|
+
maxTokens: number;
|
|
14
|
+
system: string;
|
|
15
|
+
tools: ToolDefinition[];
|
|
16
|
+
messages: InternalMessage[];
|
|
17
|
+
}): Promise<AsyncIterable<unknown>>;
|
|
18
|
+
parseStreamEvents(stream: AsyncIterable<unknown>): AsyncGenerator<NormalizedEvent>;
|
|
19
|
+
formatTools(tools: ToolDefinition[]): unknown[];
|
|
20
|
+
formatMessages(messages: InternalMessage[], system: string): {
|
|
21
|
+
messages: unknown[];
|
|
22
|
+
};
|
|
23
|
+
formatToolResults(results: ToolResult[]): unknown[];
|
|
24
|
+
shouldContinue(stopReason: string): boolean;
|
|
25
|
+
formatError(error: unknown): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider Abstraction Types
|
|
3
|
+
* Provider-agnostic interfaces for multi-provider LLM support in the agentic notebook.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generic tool definition (provider-agnostic).
|
|
7
|
+
* Each provider's formatTools() wraps this in its own format.
|
|
8
|
+
*/
|
|
9
|
+
export interface ToolDefinition {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
parameters: {
|
|
13
|
+
type: 'object';
|
|
14
|
+
properties: Record<string, unknown>;
|
|
15
|
+
required?: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Provider-agnostic internal message format.
|
|
20
|
+
* The handler uses this for the conversation history; providers convert on the way in/out.
|
|
21
|
+
*/
|
|
22
|
+
export interface InternalMessage {
|
|
23
|
+
role: 'user' | 'assistant' | 'tool_result';
|
|
24
|
+
content: string | ContentBlock[];
|
|
25
|
+
}
|
|
26
|
+
export interface ContentBlock {
|
|
27
|
+
type: 'text' | 'tool_use';
|
|
28
|
+
text?: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
input?: Record<string, unknown>;
|
|
32
|
+
/** Provider-specific metadata (e.g. Gemini thoughtSignature) */
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface ToolResult {
|
|
36
|
+
toolUseId: string;
|
|
37
|
+
/** Tool name — needed by some providers (e.g. Gemini's functionResponse) */
|
|
38
|
+
toolName?: string;
|
|
39
|
+
content: string;
|
|
40
|
+
isError?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Normalized stream events consumed by the handler's agentic loop.
|
|
44
|
+
* Every provider must emit these — the handler never sees raw provider events.
|
|
45
|
+
*/
|
|
46
|
+
export type NormalizedEvent = {
|
|
47
|
+
type: 'text_delta';
|
|
48
|
+
text: string;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'tool_use_start';
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'tool_input_delta';
|
|
56
|
+
json: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'tool_use_end';
|
|
59
|
+
id?: string;
|
|
60
|
+
input?: Record<string, unknown>;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'message_meta';
|
|
63
|
+
inputTokens?: number;
|
|
64
|
+
outputTokens?: number;
|
|
65
|
+
stopReason: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The core provider interface.
|
|
69
|
+
* Each LLM provider implements these 7 methods to integrate with the agentic loop.
|
|
70
|
+
*/
|
|
71
|
+
export interface LLMProvider {
|
|
72
|
+
/** Create a streaming API call and return the raw iterable. */
|
|
73
|
+
createStream(params: {
|
|
74
|
+
model: string;
|
|
75
|
+
maxTokens: number;
|
|
76
|
+
system: string;
|
|
77
|
+
tools: ToolDefinition[];
|
|
78
|
+
messages: InternalMessage[];
|
|
79
|
+
}): Promise<AsyncIterable<unknown>>;
|
|
80
|
+
/** Parse the raw stream into normalized events the handler understands. */
|
|
81
|
+
parseStreamEvents(stream: AsyncIterable<unknown>): AsyncGenerator<NormalizedEvent>;
|
|
82
|
+
/** Convert generic tool definitions to provider-specific format. */
|
|
83
|
+
formatTools(tools: ToolDefinition[]): unknown[];
|
|
84
|
+
/** Convert internal messages + system prompt to provider-specific format. */
|
|
85
|
+
formatMessages(messages: InternalMessage[], system: string): {
|
|
86
|
+
messages: unknown[];
|
|
87
|
+
system?: string;
|
|
88
|
+
};
|
|
89
|
+
/** Convert tool results to provider-specific format for appending as a user message. */
|
|
90
|
+
formatToolResults(results: ToolResult[]): unknown;
|
|
91
|
+
/** Return true if the stop reason means the model wants to continue (tool use). */
|
|
92
|
+
shouldContinue(stopReason: string): boolean;
|
|
93
|
+
/** Format a provider-specific error into a user-friendly message. */
|
|
94
|
+
formatError(error: unknown): string;
|
|
95
|
+
}
|