drizzle-cube 0.7.1 → 0.8.1
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/ActivityGridChart.config-DXUUgx0N.cjs +1 -0
- package/dist/adapters/ActivityGridChart.config-Dyozu3VW.js +2 -0
- package/dist/adapters/AreaChart.config-Di5odBXp.cjs +1 -0
- package/dist/adapters/AreaChart.config-KEaXP_4K.js +2 -0
- package/dist/adapters/BarChart.config-B-hBHykR.cjs +1 -0
- package/dist/adapters/BarChart.config-C5sqbn0A.js +2 -0
- package/dist/adapters/BoxPlotChart.config-B1R4Br7L.js +2 -0
- package/dist/adapters/BoxPlotChart.config-C82Fhd3c.cjs +1 -0
- package/dist/adapters/BubbleChart.config-CoBxmmfp.js +2 -0
- package/dist/adapters/BubbleChart.config-DfOnNjL-.cjs +1 -0
- package/dist/adapters/CandlestickChart.config-C5ggV_3j.cjs +1 -0
- package/dist/adapters/CandlestickChart.config-ZaJpWVuL.js +2 -0
- package/dist/adapters/DataTable.config-Cx2_ACdY.cjs +1 -0
- package/dist/adapters/DataTable.config-DkAgD-iz.js +2 -0
- package/dist/adapters/FunnelChart.config-CvzcECUB.js +2 -0
- package/dist/adapters/FunnelChart.config-DVH7IFnb.cjs +1 -0
- package/dist/adapters/GaugeChart.config-Csx8rt8o.cjs +1 -0
- package/dist/adapters/GaugeChart.config-DEmrNgMa.js +2 -0
- package/dist/adapters/HeatMapChart.config-BfD_dpP7.js +2 -0
- package/dist/adapters/HeatMapChart.config-D_jlyPJL.cjs +1 -0
- package/dist/adapters/KpiDelta.config-CVBdUL_n.cjs +1 -0
- package/dist/adapters/KpiDelta.config-D4dCXOxl.js +2 -0
- package/dist/adapters/KpiNumber.config-BK5pgIKz.cjs +1 -0
- package/dist/adapters/KpiNumber.config-D6XqjZrm.js +2 -0
- package/dist/adapters/KpiText.config-ChphMwG5.js +2 -0
- package/dist/adapters/KpiText.config-fO1wc6FH.cjs +1 -0
- package/dist/adapters/LineChart.config-CXJrgz1s.js +2 -0
- package/dist/adapters/LineChart.config-Cg_h-SiJ.cjs +1 -0
- package/dist/adapters/MarkdownChart.config-ByPjX-4O.cjs +1 -0
- package/dist/adapters/MarkdownChart.config-Df2yY9AT.js +2 -0
- package/dist/adapters/MeasureProfileChart.config-BBWGIteF.cjs +1 -0
- package/dist/adapters/MeasureProfileChart.config-C9OFbN9Z.js +2 -0
- package/dist/adapters/PieChart.config-C6jJj6xm.js +2 -0
- package/dist/adapters/PieChart.config-CmCw_8eN.cjs +1 -0
- package/dist/adapters/ProportionBarChart.config-B9NEyFEe.js +2 -0
- package/dist/adapters/ProportionBarChart.config-C3GAVPWn.cjs +1 -0
- package/dist/adapters/RadarChart.config-5AMwEqUJ.cjs +1 -0
- package/dist/adapters/RadarChart.config-Ct_b7IM5.js +2 -0
- package/dist/adapters/RadialBarChart.config-Bp-Sl0cm.js +2 -0
- package/dist/adapters/RadialBarChart.config-D14yoexI.cjs +1 -0
- package/dist/adapters/RecordsTable.config-D2-qmG06.cjs +1 -0
- package/dist/adapters/RecordsTable.config-DIwoqZCU.js +2 -0
- package/dist/adapters/RetentionCombinedChart.config-BWHipi5M.cjs +1 -0
- package/dist/adapters/RetentionCombinedChart.config-D40UgTcl.js +2 -0
- package/dist/adapters/RetentionHeatmap.config-GlnSLrjn.js +2 -0
- package/dist/adapters/RetentionHeatmap.config-MlhZf26c.cjs +1 -0
- package/dist/adapters/SankeyChart.config-Bf1_NHiv.js +2 -0
- package/dist/adapters/SankeyChart.config-BoYf6BFE.cjs +1 -0
- package/dist/adapters/ScatterChart.config-CV2rdGJp.js +2 -0
- package/dist/adapters/ScatterChart.config-DywduGF3.cjs +1 -0
- package/dist/adapters/SunburstChart.config-CrqiE1UZ.js +2 -0
- package/dist/adapters/SunburstChart.config-D5tbF_GJ.cjs +1 -0
- package/dist/adapters/TreeMapChart.config-BJ8HnZU0.cjs +1 -0
- package/dist/adapters/TreeMapChart.config-DxgIqIIj.js +2 -0
- package/dist/adapters/WaterfallChart.config-Cns8fLFu.js +2 -0
- package/dist/adapters/WaterfallChart.config-D_kdL9SN.cjs +1 -0
- package/dist/adapters/compiler-BxZHh0UD.cjs +166 -0
- package/dist/adapters/{compiler-DiYxWAKg.js → compiler-CBGD_4Et.js} +1389 -1923
- package/dist/adapters/core/http-port.d.ts +34 -7
- package/dist/adapters/core/index.cjs +1 -1
- package/dist/adapters/core/index.d.ts +1 -0
- package/dist/adapters/core/index.js +2 -2
- package/dist/adapters/core/rest-handlers.d.ts +1 -1
- package/dist/adapters/core-CIGuwGuI.cjs +1 -0
- package/dist/adapters/{core-BOPRmxPc.js → core-DAAnqPyN.js} +81 -65
- package/dist/adapters/express/index.cjs +2 -2
- package/dist/adapters/express/index.d.ts +11 -2
- package/dist/adapters/express/index.js +14 -14
- package/dist/adapters/fastify/index.cjs +2 -2
- package/dist/adapters/fastify/index.d.ts +11 -2
- package/dist/adapters/fastify/index.js +29 -29
- package/dist/{server/google-eKAc20al.js → adapters/google-DRY7jnOh.js} +46 -28
- package/dist/adapters/{google-BhvizbFR.cjs → google-PsZzwedr.cjs} +2 -2
- package/dist/adapters/handler-BcYTw6zB.cjs +25 -0
- package/dist/adapters/{handler-DGud-C-w.js → handler-eA0VJDHj.js} +363 -266
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +9 -9
- package/dist/adapters/mcp-tools-handlers.d.ts +10 -3
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +18 -20
- package/dist/adapters/mcp-transport-BpG44Fvn.js +730 -0
- package/dist/adapters/mcp-transport-CDxZXpc-.cjs +42 -0
- package/dist/adapters/mcp-transport.d.ts +13 -2
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +5 -2
- package/dist/adapters/nextjs/index.js +32 -32
- package/dist/adapters/{openai-Crp3X_zg.js → openai-BZ48ioYp.js} +1 -1
- package/dist/adapters/{openai-CmdN7Sj1.cjs → openai-Bw1j-OiP.cjs} +1 -1
- package/dist/adapters/{openai-Dwt9bxOE.cjs → openai-CLjyL5_J.cjs} +2 -2
- package/dist/adapters/{openai-CGJM6Qun.js → openai-CYYjUG_3.js} +4 -4
- package/dist/adapters/{utils-DboNUT3A.js → utils-BagURNRb.js} +1963 -1135
- package/dist/adapters/utils-BiKIg2tk.cjs +128 -0
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +19 -5
- package/dist/adapters/utils.js +1 -1
- package/dist/cjs/adapters/core/http-port.d.ts +34 -7
- package/dist/cjs/adapters/core/index.d.ts +1 -0
- package/dist/cjs/adapters/core/rest-handlers.d.ts +1 -1
- package/dist/cjs/adapters/express/index.d.ts +11 -2
- package/dist/cjs/adapters/fastify/index.d.ts +11 -2
- package/dist/cjs/adapters/mcp-tools-handlers.d.ts +10 -3
- package/dist/cjs/adapters/mcp-transport.d.ts +13 -2
- package/dist/cjs/adapters/nextjs/index.d.ts +5 -2
- package/dist/cjs/adapters/utils.d.ts +19 -5
- package/dist/cjs/client/charts/chartConfigRegistry.d.ts +7 -0
- package/dist/cjs/client/charts/chartConfigs.d.ts +17 -1
- package/dist/cjs/client/client/CubeClient.d.ts +11 -1
- package/dist/cjs/client/components/AnalysisBuilder/AnalysisDisplayConfigPanel.d.ts +4 -2
- package/dist/cjs/client/components/AnalysisBuilder/ColumnFormatsEditor.d.ts +10 -0
- package/dist/cjs/client/components/AnalysisBuilder/DisplayOptionControl.d.ts +3 -2
- package/dist/cjs/client/components/AnalysisBuilder/utils/queryUtils.d.ts +7 -1
- package/dist/cjs/client/components/analyticsPortlet/PortletChart.d.ts +2 -1
- package/dist/cjs/client/components/analyticsPortlet/PortletChartView.d.ts +4 -1
- package/dist/cjs/client/components/analyticsPortlet/usePortletDeadMembers.d.ts +24 -0
- package/dist/cjs/client/components/analyticsPortlet/usePortletPagination.d.ts +21 -0
- package/dist/cjs/client/components/charts/RecordsTable.config.d.ts +10 -0
- package/dist/cjs/client/components/charts/RecordsTable.d.ts +4 -0
- package/dist/cjs/client/components/charts/recordsTableHooks.d.ts +68 -0
- package/dist/cjs/client/icons/types.d.ts +1 -0
- package/dist/cjs/client/index.d.ts +2 -2
- package/dist/cjs/client/types.d.ts +92 -1
- package/dist/cjs/client/utils/recordsTableUtils.d.ts +71 -0
- package/dist/cjs/client/utils/rowLinkUtils.d.ts +35 -0
- package/dist/cjs/server/adapters/base-adapter.d.ts +46 -0
- package/dist/cjs/server/adapters/databend-adapter.d.ts +5 -0
- package/dist/cjs/server/adapters/duckdb-adapter.d.ts +5 -0
- package/dist/cjs/server/adapters/mysql-adapter.d.ts +14 -0
- package/dist/cjs/server/adapters/postgres-adapter.d.ts +15 -0
- package/dist/cjs/server/adapters/snowflake-adapter.d.ts +6 -0
- package/dist/cjs/server/adapters/sqlite-adapter.d.ts +21 -0
- package/dist/cjs/server/agent/chart-validation.d.ts +1 -1
- package/dist/cjs/server/ai/chart-schema.d.ts +117 -0
- package/dist/cjs/server/ai/discovery-helpers.d.ts +14 -0
- package/dist/cjs/server/ai/discovery.d.ts +6 -0
- package/dist/cjs/server/ai/query-schema.d.ts +1 -1
- package/dist/cjs/server/attribute-dimensions.d.ts +102 -0
- package/dist/cjs/server/builders/group-by-builder.d.ts +15 -0
- package/dist/cjs/server/cache-utils.d.ts +5 -1
- package/dist/cjs/server/compiler-metadata.d.ts +24 -3
- package/dist/cjs/server/compiler.d.ts +159 -13
- package/dist/cjs/server/execution/query-result-cache.d.ts +1 -1
- package/dist/cjs/server/executor.d.ts +15 -0
- package/dist/cjs/server/index.d.ts +13 -3
- package/dist/cjs/server/query-handlers.d.ts +2 -1
- package/dist/cjs/server/query-validator.d.ts +36 -4
- package/dist/cjs/server/types/core.d.ts +13 -0
- package/dist/cjs/server/types/cube.d.ts +39 -2
- package/dist/cjs/server/types/query.d.ts +8 -0
- package/dist/cli/index.cjs +130 -52
- package/dist/client/charts/chartConfigRegistry.d.ts +7 -0
- package/dist/client/charts/chartConfigs.d.ts +17 -1
- package/dist/client/charts.js +13 -13
- package/dist/client/chunks/{DashboardEditModal-BOfLdTgV.js → DashboardEditModal-_ZDMwaGX.js} +1653 -1188
- package/dist/client/chunks/DashboardEditModal-_ZDMwaGX.js.map +1 -0
- package/dist/client/chunks/{ProportionBarChart-DwoXU5VP.js → ProportionBarChart-qfpAWhIg.js} +3 -3
- package/dist/client/chunks/{ProportionBarChart-DwoXU5VP.js.map → ProportionBarChart-qfpAWhIg.js.map} +1 -1
- package/dist/client/chunks/RecordsTable-KmJy94xN.js +556 -0
- package/dist/client/chunks/RecordsTable-KmJy94xN.js.map +1 -0
- package/dist/client/chunks/{RetentionCombinedChart-BqlSV7yF.js → RetentionCombinedChart-C7X6aj97.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-BqlSV7yF.js.map → RetentionCombinedChart-C7X6aj97.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-VdVkBg8Q.js → RetentionHeatmap-PpRpiqR_.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-VdVkBg8Q.js.map → RetentionHeatmap-PpRpiqR_.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-DXw60SEs.js → analysis-builder-DaqyOjLX.js} +169 -168
- package/dist/client/chunks/{analysis-builder-DXw60SEs.js.map → analysis-builder-DaqyOjLX.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-CEvHIlmk.js → analysis-builder-shared-ow9KAHDP.js} +965 -954
- package/dist/client/chunks/analysis-builder-shared-ow9KAHDP.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-4jfS8khG.js → chart-activity-grid-DO82rrbW.js} +140 -84
- package/dist/client/chunks/chart-activity-grid-DO82rrbW.js.map +1 -0
- package/dist/client/chunks/{chart-area-Dol6s9no.js → chart-area-9SBeG0GM.js} +21 -21
- package/dist/client/chunks/{chart-area-Dol6s9no.js.map → chart-area-9SBeG0GM.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-5_niozi2.js → chart-bar-tfgmLK2D.js} +5 -5
- package/dist/client/chunks/{chart-bar-5_niozi2.js.map → chart-bar-tfgmLK2D.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-Dhp-VwhD.js → chart-box-plot-BuYW6j6g.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-Dhp-VwhD.js.map → chart-box-plot-BuYW6j6g.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-BM2BAMSo.js → chart-bubble-BNmonWqW.js} +2 -2
- package/dist/client/chunks/{chart-bubble-BM2BAMSo.js.map → chart-bubble-BNmonWqW.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-BNwLIBfm.js → chart-candlestick-BYeWNkKl.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-BNwLIBfm.js.map → chart-candlestick-BYeWNkKl.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-DoDHQRe7.js → chart-data-table-C_oHiK6N.js} +1094 -1029
- package/dist/client/chunks/chart-data-table-C_oHiK6N.js.map +1 -0
- package/dist/client/chunks/{chart-funnel-Cd7da_sa.js → chart-funnel-B_CWC3cL.js} +2 -2
- package/dist/client/chunks/{chart-funnel-Cd7da_sa.js.map → chart-funnel-B_CWC3cL.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-DOpul-Oz.js → chart-gauge-D7VxwPnx.js} +3 -3
- package/dist/client/chunks/{chart-gauge-DOpul-Oz.js.map → chart-gauge-D7VxwPnx.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-CeKbK655.js → chart-heat-map-q7Vf_dog.js} +3 -3
- package/dist/client/chunks/{chart-heat-map-CeKbK655.js.map → chart-heat-map-q7Vf_dog.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-Dq8qUOOT.js → chart-kpi-delta-PEuA3iGs.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-Dq8qUOOT.js.map → chart-kpi-delta-PEuA3iGs.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-DgiqTi9g.js → chart-kpi-number-DlxrO6Pq.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-DgiqTi9g.js.map → chart-kpi-number-DlxrO6Pq.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-CsZMVEnM.js → chart-kpi-text-Cx6cJu2s.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-CsZMVEnM.js.map → chart-kpi-text-Cx6cJu2s.js.map} +1 -1
- package/dist/client/chunks/{chart-line-DlwOB7C7.js → chart-line-pDe25JzB.js} +3 -3
- package/dist/client/chunks/{chart-line-DlwOB7C7.js.map → chart-line-pDe25JzB.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-DPE34SjC.js → chart-markdown-CRY15yp0.js} +2 -2
- package/dist/client/chunks/{chart-markdown-DPE34SjC.js.map → chart-markdown-CRY15yp0.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-BpTz1fce.js → chart-measure-profile-DyQ-vvuC.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-BpTz1fce.js.map → chart-measure-profile-DyQ-vvuC.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-FGw66XAH.js → chart-pie-ZrnBycy1.js} +15 -15
- package/dist/client/chunks/{chart-pie-FGw66XAH.js.map → chart-pie-ZrnBycy1.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-D-eRDoiA.js → chart-radar-BXbnYMUJ.js} +13 -13
- package/dist/client/chunks/{chart-radar-D-eRDoiA.js.map → chart-radar-BXbnYMUJ.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-DgtkNTs3.js → chart-radial-bar-CYxH3ryh.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar-DgtkNTs3.js.map → chart-radial-bar-CYxH3ryh.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-D0hhb_EQ.js → chart-sankey-C9R_TDDh.js} +2 -2
- package/dist/client/chunks/{chart-sankey-D0hhb_EQ.js.map → chart-sankey-C9R_TDDh.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-D9EcAiMQ.js → chart-scatter-DrwRkzzl.js} +3 -3
- package/dist/client/chunks/{chart-scatter-D9EcAiMQ.js.map → chart-scatter-DrwRkzzl.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-DCYmJ5DU.js → chart-sunburst-Bs1yqIPp.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-DCYmJ5DU.js.map → chart-sunburst-Bs1yqIPp.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-D_ACSSiB.js → chart-tree-map-BNjHhhVq.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-D_ACSSiB.js.map → chart-tree-map-BNjHhhVq.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-CVUVNa1R.js → chart-waterfall-CyoC0uLT.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-CVUVNa1R.js.map → chart-waterfall-CyoC0uLT.js.map} +1 -1
- package/dist/client/chunks/charts-core-DCQ7od_L.js +190 -0
- package/dist/client/chunks/charts-core-DCQ7od_L.js.map +1 -0
- package/dist/client/chunks/charts-loader-Bya_zDIA.js +86 -0
- package/dist/client/chunks/charts-loader-Bya_zDIA.js.map +1 -0
- package/dist/client/chunks/{en-US-BE6VoG0o.js → en-US-HP6FHuNy.js} +3 -1
- package/dist/client/chunks/{en-US-BE6VoG0o.js.map → en-US-HP6FHuNy.js.map} +1 -1
- package/dist/client/chunks/{exceljs.min-DWC_b8G9.js → exceljs.min-CiByP8VQ.js} +2 -3
- package/dist/client/chunks/{exceljs.min-DWC_b8G9.js.map → exceljs.min-CiByP8VQ.js.map} +1 -1
- package/dist/client/chunks/{nl-NL-DFLVORiD.js → nl-NL-CEdoCz6Q.js} +54 -1
- package/dist/client/chunks/nl-NL-CEdoCz6Q.js.map +1 -0
- package/dist/client/chunks/{schema-visualization-C6g_LCiA.js → schema-visualization-DfXxFBIY.js} +3 -3
- package/dist/client/chunks/{schema-visualization-C6g_LCiA.js.map → schema-visualization-DfXxFBIY.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-ZfChDEd3.js → useDirtyStateTracking-BFJHiiVK.js} +15 -15
- package/dist/client/chunks/{useDirtyStateTracking-ZfChDEd3.js.map → useDirtyStateTracking-BFJHiiVK.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-im9e1rVb.js → useExplainAI-_C4WQE5I.js} +16 -16
- package/dist/client/chunks/{useExplainAI-im9e1rVb.js.map → useExplainAI-_C4WQE5I.js.map} +1 -1
- package/dist/client/chunks/{vendor-Qa1s8oSX.js → vendor-Gb3lH0cc.js} +49 -49
- package/dist/client/chunks/vendor-Gb3lH0cc.js.map +1 -0
- package/dist/client/client/CubeClient.d.ts +11 -1
- package/dist/client/components/AnalysisBuilder/AnalysisDisplayConfigPanel.d.ts +4 -2
- package/dist/client/components/AnalysisBuilder/ColumnFormatsEditor.d.ts +10 -0
- package/dist/client/components/AnalysisBuilder/DisplayOptionControl.d.ts +3 -2
- package/dist/client/components/AnalysisBuilder/utils/queryUtils.d.ts +7 -1
- package/dist/client/components/analyticsPortlet/PortletChart.d.ts +2 -1
- package/dist/client/components/analyticsPortlet/PortletChartView.d.ts +4 -1
- package/dist/client/components/analyticsPortlet/usePortletDeadMembers.d.ts +24 -0
- package/dist/client/components/analyticsPortlet/usePortletPagination.d.ts +21 -0
- package/dist/client/components/charts/RecordsTable.config.d.ts +10 -0
- package/dist/client/components/charts/RecordsTable.d.ts +4 -0
- package/dist/client/components/charts/recordsTableHooks.d.ts +68 -0
- package/dist/client/components.js +1 -1
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons/types.d.ts +1 -0
- package/dist/client/icons.js +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +213 -213
- package/dist/client/providers.js +1 -1
- package/dist/client/schema.js +1 -1
- package/dist/client/styles.css +1 -1
- package/dist/client/types.d.ts +92 -1
- package/dist/client/utils/recordsTableUtils.d.ts +71 -0
- package/dist/client/utils/rowLinkUtils.d.ts +35 -0
- package/dist/client/utils.js +14 -14
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +109 -109
- package/dist/server/adapters/base-adapter.d.ts +46 -0
- package/dist/server/adapters/databend-adapter.d.ts +5 -0
- package/dist/server/adapters/duckdb-adapter.d.ts +5 -0
- package/dist/server/adapters/mysql-adapter.d.ts +14 -0
- package/dist/server/adapters/postgres-adapter.d.ts +15 -0
- package/dist/server/adapters/snowflake-adapter.d.ts +6 -0
- package/dist/server/adapters/sqlite-adapter.d.ts +21 -0
- package/dist/server/agent/chart-validation.d.ts +1 -1
- package/dist/server/ai/chart-schema.d.ts +117 -0
- package/dist/server/ai/discovery-helpers.d.ts +14 -0
- package/dist/server/ai/discovery.d.ts +6 -0
- package/dist/server/ai/query-schema.d.ts +1 -1
- package/dist/server/attribute-dimensions.d.ts +102 -0
- package/dist/server/builders/group-by-builder.d.ts +15 -0
- package/dist/server/cache-utils.d.ts +5 -1
- package/dist/server/compiler-metadata.d.ts +24 -3
- package/dist/server/compiler.d.ts +159 -13
- package/dist/server/execution/query-result-cache.d.ts +1 -1
- package/dist/server/executor.d.ts +15 -0
- package/dist/{adapters/google-eKAc20al.js → server/google-DRY7jnOh.js} +46 -28
- package/dist/server/{google-BhvizbFR.cjs → google-PsZzwedr.cjs} +2 -2
- package/dist/server/index.cjs +42 -38
- package/dist/server/index.d.ts +13 -3
- package/dist/server/index.js +2079 -1573
- package/dist/server/{openai-Czk1BdHa.js → openai-6uUf7h-5.js} +1 -1
- package/dist/server/{openai-DBwI1OSu.cjs → openai-BBe1XbZd.cjs} +1 -1
- package/dist/server/{openai-Cu4TXXjl.cjs → openai-BmADmD1e.cjs} +1 -1
- package/dist/server/{openai-CUf4vc3Q.js → openai-C1gLuR-0.js} +1 -1
- package/dist/server/query-handlers.d.ts +2 -1
- package/dist/server/query-validator.d.ts +36 -4
- package/dist/server/types/core.d.ts +13 -0
- package/dist/server/types/cube.d.ts +39 -2
- package/dist/server/types/query.d.ts +8 -0
- package/package.json +2 -2
- package/dist/adapters/ActivityGridChart.config-D6hhj345.cjs +0 -1
- package/dist/adapters/ActivityGridChart.config-QZKs_NYg.js +0 -2
- package/dist/adapters/AreaChart.config-B5XM6G22.js +0 -2
- package/dist/adapters/AreaChart.config-NP34BH5y.cjs +0 -1
- package/dist/adapters/BarChart.config-Bqlmr81N.js +0 -2
- package/dist/adapters/BarChart.config-C3bw-cAP.cjs +0 -1
- package/dist/adapters/BoxPlotChart.config-BOAvoj6x.cjs +0 -1
- package/dist/adapters/BoxPlotChart.config-CTXiycYY.js +0 -2
- package/dist/adapters/BubbleChart.config-CGFIkl4H.cjs +0 -1
- package/dist/adapters/BubbleChart.config-Njxx4Eq1.js +0 -2
- package/dist/adapters/CandlestickChart.config-BZ_yWaSo.cjs +0 -1
- package/dist/adapters/CandlestickChart.config-D4Svhmef.js +0 -2
- package/dist/adapters/DataTable.config-B-bT9puT.js +0 -2
- package/dist/adapters/DataTable.config-BHtt1cPM.cjs +0 -1
- package/dist/adapters/FunnelChart.config-C1e07O7B.cjs +0 -1
- package/dist/adapters/FunnelChart.config-CVEy0tV9.js +0 -2
- package/dist/adapters/GaugeChart.config-5PLNlQlu.js +0 -2
- package/dist/adapters/GaugeChart.config-Cdv6knjZ.cjs +0 -1
- package/dist/adapters/HeatMapChart.config-MGTfYpWJ.js +0 -2
- package/dist/adapters/HeatMapChart.config-jfBEi1ZI.cjs +0 -1
- package/dist/adapters/KpiDelta.config-D2IUsEYz.cjs +0 -1
- package/dist/adapters/KpiDelta.config-DT_MmAHw.js +0 -2
- package/dist/adapters/KpiNumber.config-ChgbKmx8.cjs +0 -1
- package/dist/adapters/KpiNumber.config-CvZ_FhyL.js +0 -2
- package/dist/adapters/KpiText.config-Bgkw8gr2.js +0 -2
- package/dist/adapters/KpiText.config-Bz9orqt6.cjs +0 -1
- package/dist/adapters/LineChart.config-BVew35dI.cjs +0 -1
- package/dist/adapters/LineChart.config-DSCCKXNg.js +0 -2
- package/dist/adapters/MarkdownChart.config-Bu6XUuhI.js +0 -2
- package/dist/adapters/MarkdownChart.config-E4aSVTf3.cjs +0 -1
- package/dist/adapters/MeasureProfileChart.config-BF249hc_.cjs +0 -1
- package/dist/adapters/MeasureProfileChart.config-lERVe38G.js +0 -2
- package/dist/adapters/PieChart.config-7Ujwp8R5.cjs +0 -1
- package/dist/adapters/PieChart.config-jQl2HIcA.js +0 -2
- package/dist/adapters/ProportionBarChart.config-o0w_Pnlt.js +0 -2
- package/dist/adapters/ProportionBarChart.config-phNohhhY.cjs +0 -1
- package/dist/adapters/RadarChart.config-BmrYBd9x.js +0 -2
- package/dist/adapters/RadarChart.config-Dlt3UflG.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-CeEm8xRb.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-Dishh6bC.js +0 -2
- package/dist/adapters/RetentionCombinedChart.config-BaD4ev85.cjs +0 -1
- package/dist/adapters/RetentionCombinedChart.config-m2FjBUi9.js +0 -2
- package/dist/adapters/RetentionHeatmap.config-DiMplGdk.js +0 -2
- package/dist/adapters/RetentionHeatmap.config-Dp6oYwQZ.cjs +0 -1
- package/dist/adapters/SankeyChart.config-C4Y6qzCS.cjs +0 -1
- package/dist/adapters/SankeyChart.config-CJHqgjQ1.js +0 -2
- package/dist/adapters/ScatterChart.config-C0QqvDrN.cjs +0 -1
- package/dist/adapters/ScatterChart.config-DywOsWPW.js +0 -2
- package/dist/adapters/SunburstChart.config-DE8RxpDR.cjs +0 -1
- package/dist/adapters/SunburstChart.config-DohowrO3.js +0 -2
- package/dist/adapters/TreeMapChart.config-D2gXz-zC.cjs +0 -1
- package/dist/adapters/TreeMapChart.config-HMlI29GG.js +0 -2
- package/dist/adapters/WaterfallChart.config-BO2WV2VB.js +0 -2
- package/dist/adapters/WaterfallChart.config-CzwGiheB.cjs +0 -1
- package/dist/adapters/compiler-BNjqYdmc.cjs +0 -166
- package/dist/adapters/core-CzFfrJzu.cjs +0 -1
- package/dist/adapters/handler-m6WgA9xu.cjs +0 -25
- package/dist/adapters/mcp-transport-B0b27YUB.cjs +0 -40
- package/dist/adapters/mcp-transport-BXyA4dTk.js +0 -603
- package/dist/adapters/utils-BoOeig94.cjs +0 -128
- package/dist/client/chunks/DashboardEditModal-BOfLdTgV.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-CEvHIlmk.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-4jfS8khG.js.map +0 -1
- package/dist/client/chunks/chart-data-table-DoDHQRe7.js.map +0 -1
- package/dist/client/chunks/charts-core-BPD_hLaL.js +0 -215
- package/dist/client/chunks/charts-core-BPD_hLaL.js.map +0 -1
- package/dist/client/chunks/charts-loader-CwMcOfwT.js +0 -85
- package/dist/client/chunks/charts-loader-CwMcOfwT.js.map +0 -1
- package/dist/client/chunks/nl-NL-DFLVORiD.js.map +0 -1
- package/dist/client/chunks/vendor-Qa1s8oSX.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart Configuration Schema — shared by the MCP and Agent tools
|
|
3
|
+
*
|
|
4
|
+
* The chart-side sibling of `QUERY_PARAMS_SCHEMA`. Used by BOTH:
|
|
5
|
+
* - MCP `chart` tool (adapters/mcp-transport.ts)
|
|
6
|
+
* - Agent `add_portlet` / `save_as_dashboard` tools (server/agent/tools.ts)
|
|
7
|
+
*
|
|
8
|
+
* Most charts need nothing here — their axes are inferred from the query. The
|
|
9
|
+
* records table is the exception: it lays out `columns` rather than axes, and a
|
|
10
|
+
* column renders as plain text unless the caller says what it is. Formats are
|
|
11
|
+
* never guessed from the data, so a model that cannot see this shape produces a
|
|
12
|
+
* listing of unformatted strings.
|
|
13
|
+
*/
|
|
14
|
+
/** `chartConfig` fields specific to the records table. */
|
|
15
|
+
export declare const RECORDS_TABLE_CHART_CONFIG_SCHEMA: {
|
|
16
|
+
readonly columns: {
|
|
17
|
+
readonly type: "array";
|
|
18
|
+
readonly items: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
};
|
|
21
|
+
readonly description: "recordsTable only: fields to render as columns, in this order. Omit to show every field the query returns, in query order.";
|
|
22
|
+
};
|
|
23
|
+
readonly hiddenColumns: {
|
|
24
|
+
readonly type: "array";
|
|
25
|
+
readonly items: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
readonly description: "recordsTable only: fields fetched for row context or rowLink tokens but never displayed (e.g. an id used in the URL template). Leave empty unless a field is genuinely only needed behind the scenes — anything listed here disappears from the table.";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** `displayConfig` fields specific to the records table. */
|
|
32
|
+
export declare const RECORDS_TABLE_DISPLAY_CONFIG_SCHEMA: {
|
|
33
|
+
readonly columnFormats: {
|
|
34
|
+
readonly type: "object";
|
|
35
|
+
readonly description: "recordsTable only: how each column renders, keyed by field name (e.g. \"Employees.salary\"). Formats are never inferred from the data — a column is plain text unless you say otherwise, so set this for any numeric, date, status or ratio column.";
|
|
36
|
+
readonly additionalProperties: {
|
|
37
|
+
readonly type: "object";
|
|
38
|
+
readonly required: readonly ["kind"];
|
|
39
|
+
readonly properties: {
|
|
40
|
+
readonly kind: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly enum: readonly ["text", "number", "date", "badge", "progress"];
|
|
43
|
+
readonly description: "Required on every entry. text: as-is. number: formatted numeric. date: formatted date. badge: coloured pill for statuses/categories. progress: bar or ring for a bounded value. Use \"text\" when you only want to set a label.";
|
|
44
|
+
};
|
|
45
|
+
readonly numberFormat: {
|
|
46
|
+
readonly type: "object";
|
|
47
|
+
readonly description: "kind \"number\": { unit: \"currency\"|\"percent\"|\"number\"|\"custom\", decimals, abbreviate (K/M/B), currencyCode, customPrefix, customSuffix }.";
|
|
48
|
+
};
|
|
49
|
+
readonly dateGranularity: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "kind \"date\": granularity to render at (e.g. \"day\", \"month\", \"year\").";
|
|
52
|
+
};
|
|
53
|
+
readonly badgeColors: {
|
|
54
|
+
readonly type: "array";
|
|
55
|
+
readonly description: "kind \"badge\": an ARRAY of { value, colorIndex } entries, not an object keyed by value. colorIndex is a number index into the dashboard palette (0, 1, 2, …), never a colour name like \"green\" — the palette is themed, so names would not follow it. A value with no entry renders neutral rather than being assigned a guessed colour.";
|
|
56
|
+
readonly items: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
readonly required: readonly ["value", "colorIndex"];
|
|
59
|
+
readonly properties: {
|
|
60
|
+
readonly value: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly description: "Cell value to colour, matched exactly";
|
|
63
|
+
};
|
|
64
|
+
readonly colorIndex: {
|
|
65
|
+
readonly type: "number";
|
|
66
|
+
readonly description: "Index into the dashboard colour palette";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly progressMin: {
|
|
72
|
+
readonly type: "number";
|
|
73
|
+
readonly description: "kind \"progress\": lower bound (default 0). Values are clamped.";
|
|
74
|
+
};
|
|
75
|
+
readonly progressMax: {
|
|
76
|
+
readonly type: "number";
|
|
77
|
+
readonly description: "kind \"progress\": upper bound (default 100). Values are clamped.";
|
|
78
|
+
};
|
|
79
|
+
readonly progressStyle: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly enum: readonly ["bar", "circle"];
|
|
82
|
+
readonly description: "kind \"progress\": full-width bar, or a compact ring for narrow columns.";
|
|
83
|
+
};
|
|
84
|
+
readonly label: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
readonly description: "Header override; defaults to the field title from the cube metadata.";
|
|
87
|
+
};
|
|
88
|
+
readonly align: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly enum: readonly ["left", "right"];
|
|
91
|
+
readonly description: "Cell alignment. Numbers usually read better right-aligned.";
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
readonly rowLink: {
|
|
97
|
+
readonly type: "object";
|
|
98
|
+
readonly description: "recordsTable only: makes each row a link.";
|
|
99
|
+
readonly required: readonly ["urlTemplate"];
|
|
100
|
+
readonly properties: {
|
|
101
|
+
readonly urlTemplate: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly description: "URL with {Cube.field} tokens substituted from the row, including hidden columns (e.g. \"/employees/{Employees.id}\"). Relative paths and http(s) URLs only.";
|
|
104
|
+
};
|
|
105
|
+
readonly target: {
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
readonly enum: readonly ["self", "blank"];
|
|
108
|
+
readonly description: "Open in the same tab (default) or a new one.";
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
readonly pageSize: {
|
|
113
|
+
readonly type: "number";
|
|
114
|
+
readonly enum: readonly [25, 50, 100];
|
|
115
|
+
readonly description: "recordsTable only: rows per page (default 25).";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
@@ -21,6 +21,20 @@ export declare function accumulateFieldScores(keyword: string, fields: Field[],
|
|
|
21
21
|
}): number;
|
|
22
22
|
/** Return the top-N field names from a score map, highest score first. */
|
|
23
23
|
export declare function topScoredFields(scores: Map<string, number>, limit: number): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Titles for suggested fields whose name does not already say what they are.
|
|
26
|
+
*
|
|
27
|
+
* Most field names describe themselves (`Employees.salary`), so repeating the
|
|
28
|
+
* title would be noise. A user-defined (EAV) attribute is the case this exists
|
|
29
|
+
* for: it is addressed by a generated slot name like `attr_2`, and the title is
|
|
30
|
+
* the only thing that says it means "Completion %". Discovery scores against
|
|
31
|
+
* that title, so without this the caller is handed an opaque identifier and told
|
|
32
|
+
* it is relevant.
|
|
33
|
+
*
|
|
34
|
+
* Returned as a separate name-keyed map rather than annotated into the field
|
|
35
|
+
* lists, which callers are told to copy verbatim into queries.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildFieldTitles(fields: Field[], suggested: string[]): Record<string, string> | undefined;
|
|
24
38
|
/**
|
|
25
39
|
* Score a single field as a best-match candidate (used by findBestFieldMatch).
|
|
26
40
|
* Returns the best score across name, title and synonyms (no description match).
|
|
@@ -11,6 +11,12 @@ export interface CubeDiscoveryResult {
|
|
|
11
11
|
matchedOn: ('name' | 'title' | 'description' | 'exampleQuestions' | 'measures' | 'dimensions')[];
|
|
12
12
|
suggestedMeasures: string[];
|
|
13
13
|
suggestedDimensions: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Titles for suggested fields whose name does not say what they are — chiefly
|
|
16
|
+
* user-defined (EAV) attributes, addressed as `attr_<id>`. Keyed by field name
|
|
17
|
+
* so the names above stay copyable verbatim. Omitted when nothing needs it.
|
|
18
|
+
*/
|
|
19
|
+
fieldTitles?: Record<string, string>;
|
|
14
20
|
capabilities: {
|
|
15
21
|
query: true;
|
|
16
22
|
funnel: boolean;
|
|
@@ -97,7 +97,7 @@ export declare const QUERY_PARAMS_SCHEMA: {
|
|
|
97
97
|
};
|
|
98
98
|
readonly ungrouped: {
|
|
99
99
|
readonly type: "boolean";
|
|
100
|
-
readonly description: "When true, returns raw row-level data without GROUP BY. Requires at least one dimension. Incompatible with count/countDistinct measures and analysis modes.";
|
|
100
|
+
readonly description: "When true, returns raw row-level data without GROUP BY. Requires at least one dimension. Incompatible with count/countDistinct measures and analysis modes. Cannot reference two cubes joined by a hasMany relationship in EITHER direction (e.g. Departments hasMany Employees) — an ungrouped query stays at one record grain, so keep it to a single cube plus its to-one joins. A field from a hasMany-related cube has to be pre-aggregated in a grouped query instead.";
|
|
101
101
|
};
|
|
102
102
|
readonly funnel: {
|
|
103
103
|
readonly type: "object";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { AnyColumn, SQL } from 'drizzle-orm';
|
|
2
|
+
import { Dimension, QueryContext } from './types/index.js';
|
|
3
|
+
/** The value types a generated attribute dimension can be cast to. */
|
|
4
|
+
export type AttributeValueType = 'string' | 'number' | 'time';
|
|
5
|
+
/** One admin-defined attribute, as loaded from the application's own table. */
|
|
6
|
+
export interface AttributeDefinition {
|
|
7
|
+
/**
|
|
8
|
+
* Stable identifier. The dimension's member name is derived from this, never
|
|
9
|
+
* from the attribute's name — so renaming an attribute updates every table
|
|
10
|
+
* header without breaking saved dashboards, drill state or share links.
|
|
11
|
+
*/
|
|
12
|
+
id: string | number;
|
|
13
|
+
/** Display name. Becomes the dimension's `title`, which the client renders. */
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Value type, if the application's attribute table records one. Filtering and
|
|
17
|
+
* sorting happen in SQL over the whole table before any row reaches the
|
|
18
|
+
* browser, so this is not cosmetic — see {@link buildAttributeDimensions}.
|
|
19
|
+
*/
|
|
20
|
+
valueType?: AttributeValueType;
|
|
21
|
+
}
|
|
22
|
+
export interface BuildAttributeDimensionsOptions {
|
|
23
|
+
/** The attributes to generate a dimension for. */
|
|
24
|
+
attributes: AttributeDefinition[];
|
|
25
|
+
/** The junction table holding one row per (record, attribute). */
|
|
26
|
+
valueTable: unknown;
|
|
27
|
+
/** Primary key of the record being extended — e.g. `employees.id`. */
|
|
28
|
+
recordKey: AnyColumn;
|
|
29
|
+
/** Column on the junction table pointing back at the record. */
|
|
30
|
+
foreignKey: AnyColumn;
|
|
31
|
+
/** Column on the junction table identifying the attribute. */
|
|
32
|
+
attributeKey: AnyColumn;
|
|
33
|
+
/** Column on the junction table holding the value. */
|
|
34
|
+
valueColumn: AnyColumn;
|
|
35
|
+
/**
|
|
36
|
+
* Row-level security for the junction table. **Required**: the subquery reads
|
|
37
|
+
* the junction table directly, so without this a tenant sees every tenant's
|
|
38
|
+
* attribute values. It is a parameter rather than an option so that omitting
|
|
39
|
+
* it is impossible rather than merely inadvisable.
|
|
40
|
+
*/
|
|
41
|
+
security: (ctx: QueryContext) => SQL;
|
|
42
|
+
/**
|
|
43
|
+
* Per-attribute type overrides, keyed by attribute id. Wins over
|
|
44
|
+
* `AttributeDefinition.valueType`.
|
|
45
|
+
*/
|
|
46
|
+
types?: Record<string, AttributeValueType>;
|
|
47
|
+
/** Member-name prefix. Defaults to `attr_`. */
|
|
48
|
+
namePrefix?: string;
|
|
49
|
+
/** Passed through to each generated dimension's `shown`. */
|
|
50
|
+
shown?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build one dimension per attribute, each backed by a correlated scalar
|
|
54
|
+
* subquery against the junction table.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* dimensions: {
|
|
58
|
+
* ...baseDimensions,
|
|
59
|
+
* ...buildAttributeDimensions({
|
|
60
|
+
* attributes: attrs,
|
|
61
|
+
* valueTable: employeeAttributeValues,
|
|
62
|
+
* recordKey: employees.id,
|
|
63
|
+
* foreignKey: employeeAttributeValues.employeeId,
|
|
64
|
+
* attributeKey: employeeAttributeValues.attributeId,
|
|
65
|
+
* valueColumn: employeeAttributeValues.value,
|
|
66
|
+
* security: (ctx) => eq(employeeAttributeValues.organisationId, ctx.securityContext.organisationId)
|
|
67
|
+
* })
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* Three details that are easy to get wrong, and are handled here:
|
|
72
|
+
*
|
|
73
|
+
* - **Typing is mandatory, not cosmetic.** Sorting and filtering run in SQL
|
|
74
|
+
* over the whole table before a page reaches the browser, so client-side
|
|
75
|
+
* conversion cannot repair them: sorted as text, `100` sorts below `9`, and
|
|
76
|
+
* `> 50` admits `'9'` while rejecting `'100'`. A `number` attribute is cast
|
|
77
|
+
* in SQL — tolerantly, so one `n/a` yields NULL for that row instead of
|
|
78
|
+
* failing the whole query.
|
|
79
|
+
* - **`LIMIT 1`.** EAV tables rarely carry a unique constraint on
|
|
80
|
+
* (record, attribute); without it a duplicate row raises "more than one row
|
|
81
|
+
* returned by a subquery" on Postgres.
|
|
82
|
+
* - **Security inside the subquery**, not merely on the outer query.
|
|
83
|
+
*
|
|
84
|
+
* **Grouping.** The subquery correlates on the record key, so a *grouped* query
|
|
85
|
+
* must also group by that key or Postgres rejects it with "subquery uses
|
|
86
|
+
* ungrouped column … from outer query" (MySQL likewise under
|
|
87
|
+
* `only_full_group_by`; SQLite permits it). The caller does not have to know
|
|
88
|
+
* that: each generated dimension declares its key via `Dimension.correlatesOn`,
|
|
89
|
+
* and the GROUP BY builder adds it. The grouping is therefore per record — the
|
|
90
|
+
* only grain at which a per-record attribute can be read — so an aggregate over
|
|
91
|
+
* an attribute counts records, not attribute values. If you need to aggregate
|
|
92
|
+
* freely *by* an attribute, pivot it into a real column with a view (see the
|
|
93
|
+
* performance ladder below). Record-grain listings (`ungrouped: true`) skip
|
|
94
|
+
* GROUP BY entirely and are unaffected.
|
|
95
|
+
*
|
|
96
|
+
* Performance: projection is cheap (a page of 25 rows is 25 indexed lookups per
|
|
97
|
+
* attribute), but `ORDER BY (SELECT …)` and `WHERE (SELECT …) = …` are
|
|
98
|
+
* proportional to the base table because no index serves them. At tens of
|
|
99
|
+
* thousands of rows that is fine; beyond it, pivot the attributes into real
|
|
100
|
+
* indexable columns via a view.
|
|
101
|
+
*/
|
|
102
|
+
export declare function buildAttributeDimensions(options: BuildAttributeDimensionsOptions): Record<string, Dimension>;
|
|
@@ -24,6 +24,21 @@ export declare class GroupByBuilder {
|
|
|
24
24
|
* Window functions do not require GROUP BY and operate on individual rows.
|
|
25
25
|
*/
|
|
26
26
|
buildGroupByFields(cubes: Map<string, Cube> | Cube, query: SemanticQuery, context: QueryContext, queryPlan?: PhysicalQueryPlan): (SQL | AnyColumn)[];
|
|
27
|
+
/**
|
|
28
|
+
* Add the correlation key of any selected dimension that declares one.
|
|
29
|
+
*
|
|
30
|
+
* A dimension built from a correlated subquery (`buildAttributeDimensions`)
|
|
31
|
+
* references the record key inside its SQL. Grouping by the subquery alone is
|
|
32
|
+
* rejected by Postgres ("subquery uses ungrouped column … from outer query")
|
|
33
|
+
* and by MySQL under `only_full_group_by`, so the key it correlates on is
|
|
34
|
+
* grouped too.
|
|
35
|
+
*
|
|
36
|
+
* This only ever fires for queries that are invalid on those engines today, so
|
|
37
|
+
* nothing that currently works changes shape. The key is the record's primary
|
|
38
|
+
* key, so adding it makes the grouping per-record — which is the grain such a
|
|
39
|
+
* dimension can be read at in the first place.
|
|
40
|
+
*/
|
|
41
|
+
private addCorrelationKeys;
|
|
27
42
|
/**
|
|
28
43
|
* Determine whether the query contains at least one aggregate (or calculated,
|
|
29
44
|
* or post-aggregation window over an aggregate) measure — which forces GROUP BY.
|
|
@@ -24,9 +24,13 @@ export interface CacheKeyConfig {
|
|
|
24
24
|
* @param query - The semantic query to cache
|
|
25
25
|
* @param securityContext - Security context for tenant isolation
|
|
26
26
|
* @param config - Cache key configuration
|
|
27
|
+
* @param cubeSetKey - Identifies the cube definitions behind the result. Always
|
|
28
|
+
* included when present: `includeSecurityContext: false` and a custom
|
|
29
|
+
* `securityContextSerializer` can each hash two tenants identically, so the
|
|
30
|
+
* security-context hash alone cannot keep differing cube sets apart.
|
|
27
31
|
* @returns Deterministic cache key string
|
|
28
32
|
*/
|
|
29
|
-
export declare function generateCacheKey(query: SemanticQuery, securityContext: SecurityContext, config?: CacheKeyConfig): string;
|
|
33
|
+
export declare function generateCacheKey(query: SemanticQuery, securityContext: SecurityContext, config?: CacheKeyConfig, cubeSetKey?: string): string;
|
|
30
34
|
/**
|
|
31
35
|
* Normalize query for consistent hashing
|
|
32
36
|
* Sorts arrays and object keys to ensure same query = same hash
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { Cube, MeasureMetadata, DimensionMetadata, CubeRelationshipMetadata, HierarchyMetadata, TimeGranularity } from './types/index.js';
|
|
2
2
|
/** Default time granularities used when a time dimension omits `granularities`. */
|
|
3
3
|
export declare const DEFAULT_TIME_GRANULARITIES: TimeGranularity[];
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Build measure metadata, normalizing drillMembers to fully-qualified names.
|
|
6
|
+
*
|
|
7
|
+
* Measures with `shown: false` are omitted from the result — matching Cube.js
|
|
8
|
+
* semantics, where a hidden measure remains fully usable in queries but is
|
|
9
|
+
* excluded from metadata/UI surfaces. `shown: undefined` means shown, so
|
|
10
|
+
* today's behaviour is preserved exactly.
|
|
11
|
+
*/
|
|
5
12
|
export declare function buildMeasureMetadata(cube: Cube): MeasureMetadata[];
|
|
6
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Build dimension metadata, including granularities for time dimensions.
|
|
15
|
+
*
|
|
16
|
+
* Dimensions with `shown: false` are omitted from the result — matching
|
|
17
|
+
* Cube.js semantics, where a hidden dimension remains fully usable in queries
|
|
18
|
+
* but is excluded from metadata/UI surfaces. `shown: undefined` means shown,
|
|
19
|
+
* so today's behaviour is preserved exactly.
|
|
20
|
+
*/
|
|
7
21
|
export declare function buildDimensionMetadata(cube: Cube): DimensionMetadata[];
|
|
8
22
|
/** Build relationship metadata from a cube's joins, resolving target cubes. */
|
|
9
23
|
export declare function buildRelationshipMetadata(cube: Cube, cubes: Map<string, Cube>, getColumnName: (column: any) => string): CubeRelationshipMetadata[];
|
|
10
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Build hierarchy metadata, qualifying level names to full member names.
|
|
26
|
+
*
|
|
27
|
+
* Levels referencing a dimension with `shown: false` are dropped, so a
|
|
28
|
+
* hierarchy never emits a dangling reference to a dimension that has been
|
|
29
|
+
* omitted from the cube's own dimension metadata. A hierarchy left with no
|
|
30
|
+
* visible levels is omitted entirely rather than published as empty.
|
|
31
|
+
*/
|
|
11
32
|
export declare function buildHierarchyMetadata(cube: Cube): HierarchyMetadata[];
|
|
@@ -1,9 +1,72 @@
|
|
|
1
1
|
import { SemanticQuery, QueryResult, SecurityContext, DatabaseExecutor, CubeMetadata, Cube, QueryAnalysis, CacheConfig, ExplainOptions, ExplainResult, ExecutionOptions, RLSSetupFn } from './types/index.js';
|
|
2
|
+
import { QueryValidationResult } from './query-validator.js';
|
|
2
3
|
import { PlanOptimiser } from './logical-plan/index.js';
|
|
3
4
|
export { validateQueryAgainstCubes } from './query-validator.js';
|
|
5
|
+
export type { QueryValidationIssue, QueryValidationResult } from './query-validator.js';
|
|
6
|
+
/**
|
|
7
|
+
* Identifier of the base cube set — the cubes registered with {@link
|
|
8
|
+
* SemanticLayerCompiler.registerCube}, shared by every tenant. The empty string
|
|
9
|
+
* is used so a set id can never collide with it (`registerCubeSet` rejects it).
|
|
10
|
+
*/
|
|
11
|
+
export declare const BASE_CUBE_SET_ID = "";
|
|
12
|
+
/**
|
|
13
|
+
* Security context for deployments with no tenancy at all.
|
|
14
|
+
*
|
|
15
|
+
* Every cube-resolving method requires a `SecurityContext` so that omitting one
|
|
16
|
+
* is a compile error rather than a silent fall back to the wrong tenant's
|
|
17
|
+
* cubes. Single-tenant callers pass this constant to say "no tenancy here" out
|
|
18
|
+
* loud, instead of an anonymous `{}` that reads like an oversight.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SINGLE_TENANT_CONTEXT: SecurityContext;
|
|
21
|
+
/** Reported to `onCubeSetRegistered` after each {@link SemanticLayerCompiler.registerCubeSet}. */
|
|
22
|
+
export interface CubeSetRegistrationInfo {
|
|
23
|
+
/** The set that was registered. */
|
|
24
|
+
setId: string;
|
|
25
|
+
/** Cubes in the set after merging over the base set. */
|
|
26
|
+
cubeCount: number;
|
|
27
|
+
/** Total dimensions across those cubes — the number that explains a slow boot. */
|
|
28
|
+
dimensionCount: number;
|
|
29
|
+
/**
|
|
30
|
+
* Monotonic across the whole compiler — incremented on every registration of
|
|
31
|
+
* any set, never reset. Part of the cache key, so results computed from
|
|
32
|
+
* superseded definitions can never be served.
|
|
33
|
+
*/
|
|
34
|
+
generation: number;
|
|
35
|
+
/** Wall-clock cost of this registration. */
|
|
36
|
+
durationMs: number;
|
|
37
|
+
}
|
|
38
|
+
/** Aggregate registration cost, for a single summary line after the boot loop. */
|
|
39
|
+
export interface CubeSetStats {
|
|
40
|
+
/** Number of registered sets, excluding the base set. */
|
|
41
|
+
setCount: number;
|
|
42
|
+
/** Total cubes across all sets (merged), excluding the base set. */
|
|
43
|
+
cubeCount: number;
|
|
44
|
+
/** Sum of every set's most recent registration time. */
|
|
45
|
+
totalRegistrationMs: number;
|
|
46
|
+
/** The most expensive set to register, if any sets are registered. */
|
|
47
|
+
slowestSet?: {
|
|
48
|
+
setId: string;
|
|
49
|
+
durationMs: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
4
52
|
export declare class SemanticLayerCompiler {
|
|
5
|
-
|
|
6
|
-
private
|
|
53
|
+
/** Cubes shared by every tenant. */
|
|
54
|
+
private baseCubes;
|
|
55
|
+
/** Per-tenant overlays, keyed by cube-set id. */
|
|
56
|
+
private cubeSets;
|
|
57
|
+
/** Generated metadata per cube set (`BASE_CUBE_SET_ID` for the base set). */
|
|
58
|
+
private metadataCache;
|
|
59
|
+
/** Bumped on every base-set mutation; part of every set's cache key. */
|
|
60
|
+
private baseGeneration;
|
|
61
|
+
/**
|
|
62
|
+
* Monotonic registration counter, never reset. Used as each set's generation
|
|
63
|
+
* so that unregistering a set and registering a different one under the same
|
|
64
|
+
* id cannot reproduce an earlier cache key and serve its stale results.
|
|
65
|
+
*/
|
|
66
|
+
private registrationCounter;
|
|
67
|
+
private contextToCubeSetId?;
|
|
68
|
+
private missingCubeSet;
|
|
69
|
+
private onCubeSetRegistered?;
|
|
7
70
|
private cacheConfig?;
|
|
8
71
|
private rlsSetup?;
|
|
9
72
|
private planOptimiser?;
|
|
@@ -29,6 +92,25 @@ export declare class SemanticLayerCompiler {
|
|
|
29
92
|
* Defaults to a no-op IdentityOptimiser when omitted.
|
|
30
93
|
*/
|
|
31
94
|
planOptimiser?: PlanOptimiser;
|
|
95
|
+
/**
|
|
96
|
+
* Maps a security context to the cube set that serves it — drizzle-cube's
|
|
97
|
+
* equivalent of Cube's `contextToAppId`. Return `undefined` (or omit this
|
|
98
|
+
* option entirely) to serve the base set, which is the single-tenant
|
|
99
|
+
* behaviour and the default.
|
|
100
|
+
*/
|
|
101
|
+
contextToCubeSetId?: (securityContext: SecurityContext) => string | number | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* What to do when `contextToCubeSetId` names a set that is not registered.
|
|
104
|
+
* `'base'` (default) serves the base set; `'throw'` fails the request, for
|
|
105
|
+
* deployments where every tenant is required to have its own set.
|
|
106
|
+
*/
|
|
107
|
+
missingCubeSet?: 'base' | 'throw';
|
|
108
|
+
/**
|
|
109
|
+
* Called after each `registerCubeSet` with its cost. Registering a set per
|
|
110
|
+
* tenant is real startup work, so it is reported rather than hidden; emit
|
|
111
|
+
* it to your own logger or metrics.
|
|
112
|
+
*/
|
|
113
|
+
onCubeSetRegistered?: (info: CubeSetRegistrationInfo) => void;
|
|
32
114
|
});
|
|
33
115
|
/**
|
|
34
116
|
* Set or update the database connection
|
|
@@ -65,12 +147,75 @@ export declare class SemanticLayerCompiler {
|
|
|
65
147
|
* Validates calculated measures during registration
|
|
66
148
|
*/
|
|
67
149
|
registerCube(cube: Cube): void;
|
|
150
|
+
/**
|
|
151
|
+
* Register the cubes that serve one tenant, overlaying the base set.
|
|
152
|
+
*
|
|
153
|
+
* Cubes are matched to the base set by name, so a set can either add cubes or
|
|
154
|
+
* replace a base cube with a tenant-specific version (the usual case for
|
|
155
|
+
* generated per-tenant dimensions). Call once per tenant at application boot;
|
|
156
|
+
* calling again for the same id replaces that set and invalidates its cached
|
|
157
|
+
* metadata and query results.
|
|
158
|
+
*/
|
|
159
|
+
registerCubeSet(setId: string, cubes: Cube[]): void;
|
|
160
|
+
/**
|
|
161
|
+
* Remove a tenant's cube set. That tenant then resolves to the base set (or
|
|
162
|
+
* throws, under `missingCubeSet: 'throw'`).
|
|
163
|
+
* Returns true if the set existed.
|
|
164
|
+
*/
|
|
165
|
+
unregisterCubeSet(setId: string): boolean;
|
|
166
|
+
/** Whether a cube set is registered for this id. */
|
|
167
|
+
hasCubeSet(setId: string): boolean;
|
|
168
|
+
/** Ids of every registered cube set, excluding the base set. */
|
|
169
|
+
getCubeSetIds(): string[];
|
|
170
|
+
/**
|
|
171
|
+
* Aggregate registration cost across all sets — for the single summary line
|
|
172
|
+
* worth logging after a boot loop.
|
|
173
|
+
*/
|
|
174
|
+
getCubeSetStats(): CubeSetStats;
|
|
175
|
+
/**
|
|
176
|
+
* Validate and enrich a cube ahead of registration, against the cubes that
|
|
177
|
+
* will be visible alongside it.
|
|
178
|
+
*/
|
|
179
|
+
private prepareCube;
|
|
180
|
+
/** Base cubes with an overlay applied over them, by cube name. */
|
|
181
|
+
private mergeWithBase;
|
|
182
|
+
/** Recompute every set's merged view — after any base-set mutation. */
|
|
183
|
+
private rebuildAllMergedSets;
|
|
184
|
+
/**
|
|
185
|
+
* Resolve the cube set serving this security context.
|
|
186
|
+
*
|
|
187
|
+
* Returns {@link BASE_CUBE_SET_ID} when no mapping is configured or the
|
|
188
|
+
* mapping yields nothing. A configured id that has no registered set falls
|
|
189
|
+
* back to the base set, or throws under `missingCubeSet: 'throw'`.
|
|
190
|
+
*/
|
|
191
|
+
private resolveSetId;
|
|
192
|
+
/**
|
|
193
|
+
* The cubes this security context may see.
|
|
194
|
+
*
|
|
195
|
+
* This is the only path by which cube *contents* are read for a query,
|
|
196
|
+
* metadata, validation or MCP response — so no such path can reach a cube
|
|
197
|
+
* list without a security context. The returned map must be treated as
|
|
198
|
+
* read-only; it is the live merged view, not a copy.
|
|
199
|
+
*/
|
|
200
|
+
private resolveCubes;
|
|
201
|
+
/**
|
|
202
|
+
* Cache-key component identifying which cube definitions produced a result.
|
|
203
|
+
*
|
|
204
|
+
* Appended unconditionally to every query cache key: the security-context
|
|
205
|
+
* hash is not enough, because `includeSecurityContext: false` and a custom
|
|
206
|
+
* `securityContextSerializer` can both hash two tenants identically. The
|
|
207
|
+
* generation makes re-registering a set invalidate its cached results, so a
|
|
208
|
+
* retyped or renamed dimension cannot be served stale for the TTL.
|
|
209
|
+
*/
|
|
210
|
+
private cubeSetCacheKey;
|
|
68
211
|
/**
|
|
69
212
|
* Validate that all string-based cube references in joins resolve to registered cubes.
|
|
70
213
|
* Call after all cubes are registered for strict startup validation.
|
|
71
214
|
* Throws an error listing all unresolved references.
|
|
72
215
|
*/
|
|
73
216
|
validateCubeReferences(): void;
|
|
217
|
+
/** Join targets naming a cube that is absent from the given cube scope. */
|
|
218
|
+
private unresolvedJoinRefs;
|
|
74
219
|
/**
|
|
75
220
|
* Validate calculated measures in a cube
|
|
76
221
|
* Checks template syntax, dependency existence, and circular dependencies
|
|
@@ -79,15 +224,17 @@ export declare class SemanticLayerCompiler {
|
|
|
79
224
|
/**
|
|
80
225
|
* Get a cube by name
|
|
81
226
|
*/
|
|
82
|
-
getCube(name: string): Cube | undefined;
|
|
227
|
+
getCube(name: string, securityContext: SecurityContext): Cube | undefined;
|
|
83
228
|
/**
|
|
84
229
|
* Get all registered cubes
|
|
85
230
|
*/
|
|
86
|
-
getAllCubes(): Cube[];
|
|
231
|
+
getAllCubes(securityContext: SecurityContext): Cube[];
|
|
87
232
|
/**
|
|
88
|
-
* Get all cubes as a Map for multi-cube queries
|
|
233
|
+
* Get all cubes as a Map for multi-cube queries.
|
|
234
|
+
*
|
|
235
|
+
* Returns the live merged view for this context — treat it as read-only.
|
|
89
236
|
*/
|
|
90
|
-
getAllCubesMap(): Map<string, Cube>;
|
|
237
|
+
getAllCubesMap(securityContext: SecurityContext): Map<string, Cube>;
|
|
91
238
|
/**
|
|
92
239
|
* Unified query execution method that handles both single and multi-cube queries
|
|
93
240
|
* @param options.skipCache - Skip cache lookup (but still cache the fresh result)
|
|
@@ -107,7 +254,7 @@ export declare class SemanticLayerCompiler {
|
|
|
107
254
|
* Uses caching to improve performance for repeated requests
|
|
108
255
|
* Cache is invalidated when cubes are modified (registerCube, removeCube, clearCubes)
|
|
109
256
|
*/
|
|
110
|
-
getMetadata(): CubeMetadata[];
|
|
257
|
+
getMetadata(securityContext: SecurityContext): CubeMetadata[];
|
|
111
258
|
/**
|
|
112
259
|
* Extract column name from Drizzle column reference
|
|
113
260
|
* Handles different column types and extracts the actual column name
|
|
@@ -172,7 +319,7 @@ export declare class SemanticLayerCompiler {
|
|
|
172
319
|
/**
|
|
173
320
|
* Check if a cube exists
|
|
174
321
|
*/
|
|
175
|
-
hasCube(name: string): boolean;
|
|
322
|
+
hasCube(name: string, securityContext: SecurityContext): boolean;
|
|
176
323
|
/**
|
|
177
324
|
* Unregister a cube by name.
|
|
178
325
|
* Returns true if the cube existed and was removed, false if not found.
|
|
@@ -191,18 +338,17 @@ export declare class SemanticLayerCompiler {
|
|
|
191
338
|
* Called whenever cubes are modified
|
|
192
339
|
*/
|
|
193
340
|
private invalidateMetadataCache;
|
|
341
|
+
/** Cubes for an already-resolved set id. */
|
|
342
|
+
private cubeSetId2Cubes;
|
|
194
343
|
/**
|
|
195
344
|
* Get cube names
|
|
196
345
|
*/
|
|
197
|
-
getCubeNames(): string[];
|
|
346
|
+
getCubeNames(securityContext: SecurityContext): string[];
|
|
198
347
|
/**
|
|
199
348
|
* Validate a query against registered cubes
|
|
200
349
|
* Ensures all referenced cubes and fields exist
|
|
201
350
|
*/
|
|
202
|
-
validateQuery(query: SemanticQuery):
|
|
203
|
-
isValid: boolean;
|
|
204
|
-
errors: string[];
|
|
205
|
-
};
|
|
351
|
+
validateQuery(query: SemanticQuery, securityContext: SecurityContext): QueryValidationResult;
|
|
206
352
|
/**
|
|
207
353
|
* Analyze query planning decisions for debugging and transparency
|
|
208
354
|
* Returns detailed metadata about how the query would be planned
|
|
@@ -6,7 +6,7 @@ export declare class QueryResultCache {
|
|
|
6
6
|
* Returns the cache key when caching is enabled and a provider is configured,
|
|
7
7
|
* otherwise undefined (which disables lookup and store).
|
|
8
8
|
*/
|
|
9
|
-
generateKey(query: SemanticQuery, securityContext: SecurityContext): string | undefined;
|
|
9
|
+
generateKey(query: SemanticQuery, securityContext: SecurityContext, cubeSetKey?: string): string | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* Look up a cached result. Returns the cached value (with cache metadata
|
|
12
12
|
* attached) on a hit, or undefined on miss / bypass / no-cache. Emits
|
|
@@ -95,6 +95,21 @@ export declare class QueryExecutor {
|
|
|
95
95
|
* (e.g. comparison period sub-queries cache at the comparison level).
|
|
96
96
|
*/
|
|
97
97
|
private executeStandardQuery;
|
|
98
|
+
/**
|
|
99
|
+
* Count the rows the query would return with no limit or offset — Cube's
|
|
100
|
+
* `total`.
|
|
101
|
+
*
|
|
102
|
+
* Rebuilds the *same* physical plan with pagination and ordering stripped and
|
|
103
|
+
* counts over it as a subquery. The wrapper is what makes a grouped query
|
|
104
|
+
* count groups rather than base rows, and rebuilding from `planQuery` rather
|
|
105
|
+
* than reading the paginated query's effective values matters because
|
|
106
|
+
* `applyLimitAndOffset` injects a default limit when an offset arrives
|
|
107
|
+
* without one.
|
|
108
|
+
*
|
|
109
|
+
* Runs inside the caller's RLS context, so the count sees exactly the rows
|
|
110
|
+
* the page did.
|
|
111
|
+
*/
|
|
112
|
+
private executeTotalCount;
|
|
98
113
|
/**
|
|
99
114
|
* Create a query context with optional filter cache.
|
|
100
115
|
*/
|
|
@@ -4,7 +4,12 @@ import { SemanticLayerCompiler } from './compiler.js';
|
|
|
4
4
|
* Drizzle Cube - Semantic Layer for Drizzle ORM
|
|
5
5
|
* Drizzle ORM-first semantic layer with Cube.js compatibility
|
|
6
6
|
*/
|
|
7
|
-
export { SemanticLayerCompiler } from './compiler.js';
|
|
7
|
+
export { SemanticLayerCompiler, BASE_CUBE_SET_ID, SINGLE_TENANT_CONTEXT } from './compiler.js';
|
|
8
|
+
export type { CubeSetRegistrationInfo, CubeSetStats } from './compiler.js';
|
|
9
|
+
export { QueryValidationError } from './query-validator.js';
|
|
10
|
+
export type { QueryValidationIssue, QueryValidationResult } from './query-validator.js';
|
|
11
|
+
export { buildAttributeDimensions } from './attribute-dimensions.js';
|
|
12
|
+
export type { AttributeDefinition, AttributeValueType, BuildAttributeDimensionsOptions } from './attribute-dimensions.js';
|
|
8
13
|
export { QueryExecutor } from './executor.js';
|
|
9
14
|
export { detectQueryMode, detectQueryModes, getActiveQueryModes, hasComparisonMode, hasFunnelMode, hasFlowMode, hasRetentionMode } from './query-modes.js';
|
|
10
15
|
export type { QueryMode, QueryModeFlags } from './query-modes.js';
|
|
@@ -29,8 +34,13 @@ export type { CubeDiscoveryResult, DiscoveryOptions, QuerySuggestion, Validation
|
|
|
29
34
|
export type * from './types/index.js';
|
|
30
35
|
export type { SQL } from 'drizzle-orm';
|
|
31
36
|
/**
|
|
32
|
-
* Create a new semantic layer instance with Drizzle integration
|
|
33
|
-
*
|
|
37
|
+
* Create a new semantic layer instance with Drizzle integration.
|
|
38
|
+
*
|
|
39
|
+
* Use this when you need multiple isolated instances. To serve different cube
|
|
40
|
+
* definitions to different tenants from one instance, prefer cube sets —
|
|
41
|
+
* `new SemanticLayerCompiler({ contextToCubeSetId })` plus `registerCubeSet()`
|
|
42
|
+
* per tenant — which shares the base cubes and keeps metadata and result caches
|
|
43
|
+
* correctly partitioned.
|
|
34
44
|
*/
|
|
35
45
|
export declare function createDrizzleSemanticLayer(options: {
|
|
36
46
|
drizzle: DrizzleDatabase;
|
|
@@ -56,7 +56,7 @@ export interface DiscoverResponse {
|
|
|
56
56
|
* Always returns `queryLanguageReference` and `dateFilteringGuide` alongside
|
|
57
57
|
* the matched cubes. See `DiscoverResponse` for the rationale.
|
|
58
58
|
*/
|
|
59
|
-
export declare function handleDiscover(semanticLayer: SemanticLayerCompiler, body: DiscoverRequest): Promise<DiscoverResponse>;
|
|
59
|
+
export declare function handleDiscover(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: DiscoverRequest): Promise<DiscoverResponse>;
|
|
60
60
|
/**
|
|
61
61
|
* Normalize AI-generated query fields before validation/execution.
|
|
62
62
|
* Fixes common LLM mistakes:
|
|
@@ -76,4 +76,5 @@ export declare function handleLoad(semanticLayer: SemanticLayerCompiler, securit
|
|
|
76
76
|
data: Record<string, unknown>[];
|
|
77
77
|
annotation: any;
|
|
78
78
|
query: SemanticQuery;
|
|
79
|
+
total?: number;
|
|
79
80
|
}>;
|