drizzle-cube 0.8.0 → 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-CQJ5GOwF.js → compiler-CBGD_4Et.js} +1160 -1861
- package/dist/adapters/core/index.cjs +1 -1
- package/dist/adapters/core/index.js +1 -1
- package/dist/adapters/{core-DgTGXxDu.cjs → core-CIGuwGuI.cjs} +1 -1
- package/dist/adapters/{core-DXkuSUBg.js → core-DAAnqPyN.js} +3 -3
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +5 -5
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +23 -23
- 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-DrRT6c14.cjs → handler-BcYTw6zB.cjs} +12 -12
- package/dist/adapters/{handler-CphYSZRh.js → handler-eA0VJDHj.js} +334 -237
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +4 -4
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +2 -2
- package/dist/adapters/mcp-transport-BpG44Fvn.js +730 -0
- package/dist/adapters/mcp-transport-CDxZXpc-.cjs +42 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +5 -5
- package/dist/adapters/{openai-D-VMcPao.js → openai-BZ48ioYp.js} +1 -1
- package/dist/adapters/{openai-CSzWluuv.cjs → openai-Bw1j-OiP.cjs} +1 -1
- package/dist/adapters/{openai-CI9vGKSf.cjs → openai-CLjyL5_J.cjs} +2 -2
- package/dist/adapters/{openai-CBrN4nxl.js → openai-CYYjUG_3.js} +3 -3
- package/dist/adapters/{utils-DkmShl5f.js → utils-BagURNRb.js} +1947 -1122
- package/dist/adapters/utils-BiKIg2tk.cjs +128 -0
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +17 -3
- package/dist/adapters/utils.js +1 -1
- package/dist/cjs/adapters/utils.d.ts +17 -3
- 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/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 +11 -8
- package/dist/cjs/server/builders/group-by-builder.d.ts +15 -0
- package/dist/cjs/server/compiler.d.ts +3 -4
- package/dist/cjs/server/executor.d.ts +15 -0
- package/dist/cjs/server/index.d.ts +2 -0
- package/dist/cjs/server/query-handlers.d.ts +1 -0
- package/dist/cjs/server/query-validator.d.ts +36 -4
- package/dist/cjs/server/types/core.d.ts +5 -0
- package/dist/cjs/server/types/cube.d.ts +12 -0
- 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-9An5EDAz.js → DashboardEditModal-_ZDMwaGX.js} +1653 -1188
- package/dist/client/chunks/DashboardEditModal-_ZDMwaGX.js.map +1 -0
- package/dist/client/chunks/{ProportionBarChart-BVcbGY2C.js → ProportionBarChart-qfpAWhIg.js} +3 -3
- package/dist/client/chunks/{ProportionBarChart-BVcbGY2C.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-D68Rvdi-.js → RetentionCombinedChart-C7X6aj97.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-D68Rvdi-.js.map → RetentionCombinedChart-C7X6aj97.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-CE7BAjrB.js → RetentionHeatmap-PpRpiqR_.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-CE7BAjrB.js.map → RetentionHeatmap-PpRpiqR_.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-D1pYvvwc.js → analysis-builder-DaqyOjLX.js} +169 -168
- package/dist/client/chunks/{analysis-builder-D1pYvvwc.js.map → analysis-builder-DaqyOjLX.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-BQvwUc6z.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-DvD_4wJz.js → chart-activity-grid-DO82rrbW.js} +137 -84
- package/dist/client/chunks/chart-activity-grid-DO82rrbW.js.map +1 -0
- package/dist/client/chunks/{chart-area-DPp3hSOK.js → chart-area-9SBeG0GM.js} +21 -21
- package/dist/client/chunks/{chart-area-DPp3hSOK.js.map → chart-area-9SBeG0GM.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-Od3pOyZ0.js → chart-bar-tfgmLK2D.js} +5 -5
- package/dist/client/chunks/{chart-bar-Od3pOyZ0.js.map → chart-bar-tfgmLK2D.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-l0iFn2n2.js → chart-box-plot-BuYW6j6g.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-l0iFn2n2.js.map → chart-box-plot-BuYW6j6g.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-Dl0RcP8N.js → chart-bubble-BNmonWqW.js} +2 -2
- package/dist/client/chunks/{chart-bubble-Dl0RcP8N.js.map → chart-bubble-BNmonWqW.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-DZMqbscF.js → chart-candlestick-BYeWNkKl.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-DZMqbscF.js.map → chart-candlestick-BYeWNkKl.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-DgiNBOWf.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-YLZlyN1X.js → chart-funnel-B_CWC3cL.js} +2 -2
- package/dist/client/chunks/{chart-funnel-YLZlyN1X.js.map → chart-funnel-B_CWC3cL.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-BsqE2wwF.js → chart-gauge-D7VxwPnx.js} +3 -3
- package/dist/client/chunks/{chart-gauge-BsqE2wwF.js.map → chart-gauge-D7VxwPnx.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-BsND8RM_.js → chart-heat-map-q7Vf_dog.js} +3 -3
- package/dist/client/chunks/{chart-heat-map-BsND8RM_.js.map → chart-heat-map-q7Vf_dog.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-m0azuva-.js → chart-kpi-delta-PEuA3iGs.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-m0azuva-.js.map → chart-kpi-delta-PEuA3iGs.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-6JS15SqF.js → chart-kpi-number-DlxrO6Pq.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-6JS15SqF.js.map → chart-kpi-number-DlxrO6Pq.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-BqX8p8Jn.js → chart-kpi-text-Cx6cJu2s.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-BqX8p8Jn.js.map → chart-kpi-text-Cx6cJu2s.js.map} +1 -1
- package/dist/client/chunks/{chart-line-NCmpxBfE.js → chart-line-pDe25JzB.js} +3 -3
- package/dist/client/chunks/{chart-line-NCmpxBfE.js.map → chart-line-pDe25JzB.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-ZOobqiiX.js → chart-markdown-CRY15yp0.js} +2 -2
- package/dist/client/chunks/{chart-markdown-ZOobqiiX.js.map → chart-markdown-CRY15yp0.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-CBAZaicJ.js → chart-measure-profile-DyQ-vvuC.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-CBAZaicJ.js.map → chart-measure-profile-DyQ-vvuC.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-ChrasEI8.js → chart-pie-ZrnBycy1.js} +15 -15
- package/dist/client/chunks/{chart-pie-ChrasEI8.js.map → chart-pie-ZrnBycy1.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-CxSVF7yL.js → chart-radar-BXbnYMUJ.js} +13 -13
- package/dist/client/chunks/{chart-radar-CxSVF7yL.js.map → chart-radar-BXbnYMUJ.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar--SN0Wph0.js → chart-radial-bar-CYxH3ryh.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar--SN0Wph0.js.map → chart-radial-bar-CYxH3ryh.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-CDOSGg9r.js → chart-sankey-C9R_TDDh.js} +2 -2
- package/dist/client/chunks/{chart-sankey-CDOSGg9r.js.map → chart-sankey-C9R_TDDh.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DgcEF-kI.js → chart-scatter-DrwRkzzl.js} +3 -3
- package/dist/client/chunks/{chart-scatter-DgcEF-kI.js.map → chart-scatter-DrwRkzzl.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-MB-jlGBm.js → chart-sunburst-Bs1yqIPp.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-MB-jlGBm.js.map → chart-sunburst-Bs1yqIPp.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DeDXveVd.js → chart-tree-map-BNjHhhVq.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-DeDXveVd.js.map → chart-tree-map-BNjHhhVq.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-ur4vkO1j.js → chart-waterfall-CyoC0uLT.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-ur4vkO1j.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/{nl-NL-CMXHDBr0.js → nl-NL-CEdoCz6Q.js} +51 -1
- package/dist/client/chunks/nl-NL-CEdoCz6Q.js.map +1 -0
- package/dist/client/chunks/{schema-visualization-BEbFtUIL.js → schema-visualization-DfXxFBIY.js} +3 -3
- package/dist/client/chunks/{schema-visualization-BEbFtUIL.js.map → schema-visualization-DfXxFBIY.js.map} +1 -1
- package/dist/client/chunks/{useDirtyStateTracking-CSDg96Rw.js → useDirtyStateTracking-BFJHiiVK.js} +15 -15
- package/dist/client/chunks/{useDirtyStateTracking-CSDg96Rw.js.map → useDirtyStateTracking-BFJHiiVK.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-BnkoZ-zS.js → useExplainAI-_C4WQE5I.js} +16 -16
- package/dist/client/chunks/{useExplainAI-BnkoZ-zS.js.map → useExplainAI-_C4WQE5I.js.map} +1 -1
- package/dist/client/chunks/{vendor-BmJDaduD.js → vendor-Gb3lH0cc.js} +49 -49
- package/dist/client/chunks/{vendor-BmJDaduD.js.map → vendor-Gb3lH0cc.js.map} +1 -1
- 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 +107 -107
- 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 +11 -8
- package/dist/server/builders/group-by-builder.d.ts +15 -0
- package/dist/server/compiler.d.ts +3 -4
- 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 +34 -34
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +1755 -1445
- package/dist/server/query-handlers.d.ts +1 -0
- package/dist/server/query-validator.d.ts +36 -4
- package/dist/server/types/core.d.ts +5 -0
- package/dist/server/types/cube.d.ts +12 -0
- package/dist/server/types/query.d.ts +8 -0
- package/package.json +1 -1
- package/dist/adapters/ActivityGridChart.config-BQhBE_Mr.js +0 -2
- package/dist/adapters/ActivityGridChart.config-C3tSuOGV.cjs +0 -1
- package/dist/adapters/AreaChart.config-3cme8HyQ.js +0 -2
- package/dist/adapters/AreaChart.config-BSxrT52Z.cjs +0 -1
- package/dist/adapters/BarChart.config-BKS8IecE.cjs +0 -1
- package/dist/adapters/BarChart.config-lt_7PdIi.js +0 -2
- package/dist/adapters/BoxPlotChart.config-B7qvRnrF.cjs +0 -1
- package/dist/adapters/BoxPlotChart.config-Dv6ECj2j.js +0 -2
- package/dist/adapters/BubbleChart.config-BrIH7OAy.cjs +0 -1
- package/dist/adapters/BubbleChart.config-Fhotb7Pg.js +0 -2
- package/dist/adapters/CandlestickChart.config-CWH41FmF.cjs +0 -1
- package/dist/adapters/CandlestickChart.config-RPtXuxsX.js +0 -2
- package/dist/adapters/DataTable.config-71L0GzlT.js +0 -2
- package/dist/adapters/DataTable.config-BsOMQq3J.cjs +0 -1
- package/dist/adapters/FunnelChart.config-Cqte9C04.cjs +0 -1
- package/dist/adapters/FunnelChart.config-DJtwWeNz.js +0 -2
- package/dist/adapters/GaugeChart.config-WkwZ9VdS.cjs +0 -1
- package/dist/adapters/GaugeChart.config-vpVQlP5B.js +0 -2
- package/dist/adapters/HeatMapChart.config-DcmkDl07.cjs +0 -1
- package/dist/adapters/HeatMapChart.config-DsmMgGxJ.js +0 -2
- package/dist/adapters/KpiDelta.config-DVy561BH.js +0 -2
- package/dist/adapters/KpiDelta.config-dpqwLHNE.cjs +0 -1
- package/dist/adapters/KpiNumber.config-927l8nq8.js +0 -2
- package/dist/adapters/KpiNumber.config-BqFBMfPf.cjs +0 -1
- package/dist/adapters/KpiText.config-C-fZXuHq.cjs +0 -1
- package/dist/adapters/KpiText.config-CWoXuhMA.js +0 -2
- package/dist/adapters/LineChart.config-DTp7pqOY.js +0 -2
- package/dist/adapters/LineChart.config-DUGvSjcH.cjs +0 -1
- package/dist/adapters/MarkdownChart.config-23Dmv2Ty.cjs +0 -1
- package/dist/adapters/MarkdownChart.config-Cb2TnS0I.js +0 -2
- package/dist/adapters/MeasureProfileChart.config-B2qbWdhy.cjs +0 -1
- package/dist/adapters/MeasureProfileChart.config-CvBCeI5b.js +0 -2
- package/dist/adapters/PieChart.config-BzJb13QA.js +0 -2
- package/dist/adapters/PieChart.config-plCn5Ehr.cjs +0 -1
- package/dist/adapters/ProportionBarChart.config-1r-_moBH.cjs +0 -1
- package/dist/adapters/ProportionBarChart.config-CN6TtHTp.js +0 -2
- package/dist/adapters/RadarChart.config-BYhdj9M7.js +0 -2
- package/dist/adapters/RadarChart.config-CeUMP-1g.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-B88yXNsq.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-ZMK9HMoh.js +0 -2
- package/dist/adapters/RetentionCombinedChart.config-B5yvgUHM.cjs +0 -1
- package/dist/adapters/RetentionCombinedChart.config-Dd-YMdK8.js +0 -2
- package/dist/adapters/RetentionHeatmap.config-BYzDleoV.cjs +0 -1
- package/dist/adapters/RetentionHeatmap.config-Dvj7yTB0.js +0 -2
- package/dist/adapters/SankeyChart.config-CPFRmgFb.cjs +0 -1
- package/dist/adapters/SankeyChart.config-ClgqXM1N.js +0 -2
- package/dist/adapters/ScatterChart.config-CvJiqPa5.cjs +0 -1
- package/dist/adapters/ScatterChart.config-DLZ3rYMq.js +0 -2
- package/dist/adapters/SunburstChart.config-C_1V5hoQ.cjs +0 -1
- package/dist/adapters/SunburstChart.config-FNU75NCg.js +0 -2
- package/dist/adapters/TreeMapChart.config-CprZk_YF.js +0 -2
- package/dist/adapters/TreeMapChart.config-DNwd0ge9.cjs +0 -1
- package/dist/adapters/WaterfallChart.config-BBhcN_Fh.cjs +0 -1
- package/dist/adapters/WaterfallChart.config-H7s6SSV3.js +0 -2
- package/dist/adapters/compiler-BaLO10VN.cjs +0 -166
- package/dist/adapters/mcp-transport-BGkSz-ZT.cjs +0 -40
- package/dist/adapters/mcp-transport-fJud19xz.js +0 -606
- package/dist/adapters/utils-BY0-KFyI.cjs +0 -128
- package/dist/client/chunks/DashboardEditModal-9An5EDAz.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-BQvwUc6z.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-DvD_4wJz.js.map +0 -1
- package/dist/client/chunks/chart-data-table-DgiNBOWf.js.map +0 -1
- package/dist/client/chunks/charts-core-BAH5pkSB.js +0 -215
- package/dist/client/chunks/charts-core-BAH5pkSB.js.map +0 -1
- package/dist/client/chunks/charts-loader-eToV8je7.js +0 -85
- package/dist/client/chunks/charts-loader-eToV8je7.js.map +0 -1
- package/dist/client/chunks/nl-NL-CMXHDBr0.js.map +0 -1
|
@@ -12,7 +12,7 @@ interface ValidationResult {
|
|
|
12
12
|
/**
|
|
13
13
|
* Validate chartConfig against the chart type's drop zone requirements.
|
|
14
14
|
*/
|
|
15
|
-
export declare function validateChartConfig(chartType: string, chartConfig: Record<string, unknown> | undefined,
|
|
15
|
+
export declare function validateChartConfig(chartType: string, chartConfig: Record<string, unknown> | undefined, query: Record<string, unknown>): ValidationResult;
|
|
16
16
|
export declare function inferChartConfig(chartType: string, chartConfig: Record<string, unknown> | undefined, query: Record<string, unknown>): Record<string, unknown>;
|
|
17
17
|
/**
|
|
18
18
|
* Build per-chart-type requirements text for the agent tool description.
|
|
@@ -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";
|
|
@@ -81,14 +81,17 @@ export interface BuildAttributeDimensionsOptions {
|
|
|
81
81
|
* returned by a subquery" on Postgres.
|
|
82
82
|
* - **Security inside the subquery**, not merely on the outer query.
|
|
83
83
|
*
|
|
84
|
-
* **Grouping
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
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.
|
|
92
95
|
*
|
|
93
96
|
* Performance: projection is cheap (a page of 25 rows is 25 indexed lookups per
|
|
94
97
|
* attribute), but `ORDER BY (SELECT …)` and `WHERE (SELECT …) = …` are
|
|
@@ -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.
|
|
@@ -1,6 +1,8 @@
|
|
|
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';
|
|
4
6
|
/**
|
|
5
7
|
* Identifier of the base cube set — the cubes registered with {@link
|
|
6
8
|
* SemanticLayerCompiler.registerCube}, shared by every tenant. The empty string
|
|
@@ -346,10 +348,7 @@ export declare class SemanticLayerCompiler {
|
|
|
346
348
|
* Validate a query against registered cubes
|
|
347
349
|
* Ensures all referenced cubes and fields exist
|
|
348
350
|
*/
|
|
349
|
-
validateQuery(query: SemanticQuery, securityContext: SecurityContext):
|
|
350
|
-
isValid: boolean;
|
|
351
|
-
errors: string[];
|
|
352
|
-
};
|
|
351
|
+
validateQuery(query: SemanticQuery, securityContext: SecurityContext): QueryValidationResult;
|
|
353
352
|
/**
|
|
354
353
|
* Analyze query planning decisions for debugging and transparency
|
|
355
354
|
* Returns detailed metadata about how the query would be planned
|
|
@@ -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
|
*/
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
//#region src/server/agent/providers/google.ts
|
|
2
|
-
function e(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
function e(n, r = 0) {
|
|
3
|
+
if (!n || typeof n != "object") return "value";
|
|
4
|
+
let i = n, a = i.enum;
|
|
5
|
+
if (Array.isArray(a) && a.length > 0) return a.map((e) => typeof e == "string" ? `"${e}"` : String(e)).join("|");
|
|
6
|
+
let o = typeof i.type == "string" ? i.type.toLowerCase() : "value";
|
|
7
|
+
if (o === "array") return r >= t ? "array" : `array of ${e(i.items, r + 1)}`;
|
|
8
|
+
if (o === "object") {
|
|
9
|
+
let n = i.properties;
|
|
10
|
+
if (!n || r >= t) return "object";
|
|
11
|
+
let a = new Set(Array.isArray(i.required) ? i.required : []);
|
|
12
|
+
return `{ ${Object.entries(n).map(([t, n]) => {
|
|
13
|
+
let i = a.has(t) ? " (required)" : "";
|
|
14
|
+
return `${t}: ${e(n, r + 1)}${i}`;
|
|
15
|
+
}).join(", ")} }`;
|
|
16
|
+
}
|
|
17
|
+
return o;
|
|
18
|
+
}
|
|
19
|
+
var t = 3;
|
|
20
|
+
function n(t) {
|
|
21
|
+
let r = {}, i = [];
|
|
22
|
+
for (let [a, o] of Object.entries(t)) if (a === "type" && typeof o == "string") r[a] = o.toUpperCase();
|
|
23
|
+
else if (a === "properties" && typeof o == "object" && o) {
|
|
24
|
+
let e = {};
|
|
25
|
+
for (let [t, r] of Object.entries(o)) e[t] = typeof r == "object" && r ? n(r) : r;
|
|
26
|
+
r[a] = e;
|
|
27
|
+
} else a === "items" && typeof o == "object" && o ? r[a] = n(o) : (a === "anyOf" || a === "oneOf" || a === "allOf") && Array.isArray(o) ? r[a] = o.map((e) => e && typeof e == "object" ? n(e) : e) : a === "additionalProperties" ? o && typeof o == "object" && i.push(`Each value is: ${e(o)}.`) : a === "enum" && Array.isArray(o) && o.some((e) => typeof e != "string") ? i.push(`Allowed values: ${o.join(", ")}.`) : r[a] = o;
|
|
28
|
+
return i.length > 0 && (r.description = [typeof r.description == "string" ? r.description : "", ...i].filter(Boolean).join(" ")), r;
|
|
11
29
|
}
|
|
12
|
-
function
|
|
30
|
+
function r(e) {
|
|
13
31
|
return e === "STOP" ? "stop" : e === "MAX_TOKENS" ? "max_tokens" : e;
|
|
14
32
|
}
|
|
15
|
-
function*
|
|
33
|
+
function* i(e) {
|
|
16
34
|
if (e.text && !e.thought && (yield {
|
|
17
35
|
type: "text_delta",
|
|
18
36
|
text: e.text
|
|
@@ -29,7 +47,7 @@ function* n(e) {
|
|
|
29
47
|
}, yield { type: "tool_use_end" };
|
|
30
48
|
}
|
|
31
49
|
}
|
|
32
|
-
function
|
|
50
|
+
function a(e) {
|
|
33
51
|
let t = e._toolResults;
|
|
34
52
|
if (t && t.length > 0) return {
|
|
35
53
|
role: "user",
|
|
@@ -47,7 +65,7 @@ function r(e) {
|
|
|
47
65
|
parts: [{ text: n }]
|
|
48
66
|
} : null;
|
|
49
67
|
}
|
|
50
|
-
function
|
|
68
|
+
function o(e) {
|
|
51
69
|
let t = [];
|
|
52
70
|
for (let n of e) if (n.type === "text" && n.text) t.push({ text: n.text });
|
|
53
71
|
else if (n.type === "tool_use") {
|
|
@@ -59,8 +77,8 @@ function i(e) {
|
|
|
59
77
|
}
|
|
60
78
|
return t;
|
|
61
79
|
}
|
|
62
|
-
function
|
|
63
|
-
if (e.role === "tool_result") return
|
|
80
|
+
function s(e) {
|
|
81
|
+
if (e.role === "tool_result") return a(e);
|
|
64
82
|
if (e.role === "user") return {
|
|
65
83
|
role: "user",
|
|
66
84
|
parts: [{ text: typeof e.content == "string" ? e.content : JSON.stringify(e.content) }]
|
|
@@ -70,7 +88,7 @@ function a(e) {
|
|
|
70
88
|
role: "model",
|
|
71
89
|
parts: [{ text: e.content }]
|
|
72
90
|
};
|
|
73
|
-
let t =
|
|
91
|
+
let t = o(e.content);
|
|
74
92
|
return t.length > 0 ? {
|
|
75
93
|
role: "model",
|
|
76
94
|
parts: t
|
|
@@ -78,7 +96,7 @@ function a(e) {
|
|
|
78
96
|
}
|
|
79
97
|
return null;
|
|
80
98
|
}
|
|
81
|
-
var
|
|
99
|
+
var c = class {
|
|
82
100
|
apiKey;
|
|
83
101
|
sdk;
|
|
84
102
|
initialized = !1;
|
|
@@ -111,7 +129,7 @@ var o = class {
|
|
|
111
129
|
})).stream;
|
|
112
130
|
}
|
|
113
131
|
async *parseStreamEvents(e) {
|
|
114
|
-
let
|
|
132
|
+
let t = "stop", n = !1;
|
|
115
133
|
for await (let a of e) {
|
|
116
134
|
let e = a;
|
|
117
135
|
e.usageMetadata && (yield {
|
|
@@ -122,26 +140,26 @@ var o = class {
|
|
|
122
140
|
});
|
|
123
141
|
let o = e.candidates?.[0];
|
|
124
142
|
if (!o) continue;
|
|
125
|
-
o.finishReason && (
|
|
143
|
+
o.finishReason && (t = r(o.finishReason));
|
|
126
144
|
let s = o.content?.parts;
|
|
127
|
-
if (s) for (let e of s) for (let t of
|
|
145
|
+
if (s) for (let e of s) for (let t of i(e)) t.type === "tool_use_start" && (n = !0), yield t;
|
|
128
146
|
}
|
|
129
147
|
yield {
|
|
130
148
|
type: "message_meta",
|
|
131
|
-
stopReason:
|
|
149
|
+
stopReason: n ? "tool_use" : t
|
|
132
150
|
};
|
|
133
151
|
}
|
|
134
|
-
formatTools(
|
|
135
|
-
return
|
|
136
|
-
name:
|
|
137
|
-
description:
|
|
138
|
-
parameters: e
|
|
152
|
+
formatTools(e) {
|
|
153
|
+
return e.map((e) => ({
|
|
154
|
+
name: e.name,
|
|
155
|
+
description: e.description,
|
|
156
|
+
parameters: n(e.parameters)
|
|
139
157
|
}));
|
|
140
158
|
}
|
|
141
159
|
formatMessages(e, t) {
|
|
142
160
|
let n = [];
|
|
143
161
|
for (let t of e) {
|
|
144
|
-
let e =
|
|
162
|
+
let e = s(t);
|
|
145
163
|
e && n.push(e);
|
|
146
164
|
}
|
|
147
165
|
return { messages: n };
|
|
@@ -163,4 +181,4 @@ var o = class {
|
|
|
163
181
|
}
|
|
164
182
|
};
|
|
165
183
|
//#endregion
|
|
166
|
-
export {
|
|
184
|
+
export { c as GoogleProvider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(
|
|
2
|
-
`),_toolResults:e}}shouldContinue(e){return e===`tool_use`}formatError(e){if(!e||!(e instanceof Error))return`Something went wrong. Please try again.`;let t=e.message||``,n=e;return n.status===429?`Too many requests. Please wait a moment and try again.`:n.status===403||n.status===401?`Authentication failed. Please check your API key configuration.`:n.status===503||n.status===500?`The AI service is temporarily unavailable. Please try again in a moment.`:t.includes(`SAFETY`)?`The request was blocked by safety filters. Please rephrase your request.`:t.includes(`RECITATION`)?`The response was blocked due to recitation concerns. Please try a different query.`:t.startsWith(`{`)||t.startsWith(`[`)?`The AI service encountered an error. Please try again.`:t}};exports.GoogleProvider=
|
|
1
|
+
function e(n,r=0){if(!n||typeof n!=`object`)return`value`;let i=n,a=i.enum;if(Array.isArray(a)&&a.length>0)return a.map(e=>typeof e==`string`?`"${e}"`:String(e)).join(`|`);let o=typeof i.type==`string`?i.type.toLowerCase():`value`;if(o===`array`)return r>=t?`array`:`array of ${e(i.items,r+1)}`;if(o===`object`){let n=i.properties;if(!n||r>=t)return`object`;let a=new Set(Array.isArray(i.required)?i.required:[]);return`{ ${Object.entries(n).map(([t,n])=>{let i=a.has(t)?` (required)`:``;return`${t}: ${e(n,r+1)}${i}`}).join(`, `)} }`}return o}var t=3;function n(t){let r={},i=[];for(let[a,o]of Object.entries(t))if(a===`type`&&typeof o==`string`)r[a]=o.toUpperCase();else if(a===`properties`&&typeof o==`object`&&o){let e={};for(let[t,r]of Object.entries(o))e[t]=typeof r==`object`&&r?n(r):r;r[a]=e}else a===`items`&&typeof o==`object`&&o?r[a]=n(o):(a===`anyOf`||a===`oneOf`||a===`allOf`)&&Array.isArray(o)?r[a]=o.map(e=>e&&typeof e==`object`?n(e):e):a===`additionalProperties`?o&&typeof o==`object`&&i.push(`Each value is: ${e(o)}.`):a===`enum`&&Array.isArray(o)&&o.some(e=>typeof e!=`string`)?i.push(`Allowed values: ${o.join(`, `)}.`):r[a]=o;return i.length>0&&(r.description=[typeof r.description==`string`?r.description:``,...i].filter(Boolean).join(` `)),r}function r(e){return e===`STOP`?`stop`:e===`MAX_TOKENS`?`max_tokens`:e}function*i(e){if(e.text&&!e.thought&&(yield{type:`text_delta`,text:e.text}),e.functionCall){let t=`gemini-tc-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,n=e.thoughtSignature?{thoughtSignature:e.thoughtSignature}:void 0;yield{type:`tool_use_start`,id:t,name:e.functionCall.name,...n?{metadata:n}:{}},yield{type:`tool_input_delta`,json:JSON.stringify(e.functionCall.args||{})},yield{type:`tool_use_end`}}}function a(e){let t=e._toolResults;if(t&&t.length>0)return{role:`user`,parts:t.map(e=>({functionResponse:{name:e.toolName||e.toolUseId,response:{content:e.content,isError:e.isError||!1}}}))};let n=typeof e.content==`string`?e.content:JSON.stringify(e.content);return n?{role:`user`,parts:[{text:n}]}:null}function o(e){let t=[];for(let n of e)if(n.type===`text`&&n.text)t.push({text:n.text});else if(n.type===`tool_use`){let e={functionCall:{name:n.name,args:n.input||{}}};n.metadata?.thoughtSignature&&(e.thoughtSignature=n.metadata.thoughtSignature),t.push(e)}return t}function s(e){if(e.role===`tool_result`)return a(e);if(e.role===`user`)return{role:`user`,parts:[{text:typeof e.content==`string`?e.content:JSON.stringify(e.content)}]};if(e.role===`assistant`){if(typeof e.content==`string`)return{role:`model`,parts:[{text:e.content}]};let t=o(e.content);return t.length>0?{role:`model`,parts:t}:null}return null}var c=class{apiKey;sdk;initialized=!1;constructor(e){this.apiKey=e}async ensureSDK(){if(!this.initialized){try{this.sdk=await Promise.resolve().then(()=>require("./dist-CohrBmKe.cjs"))}catch{throw Error(`@google/generative-ai is required for the Google provider. Install it with: npm install @google/generative-ai`)}this.initialized=!0}}async createStream(e){await this.ensureSDK();let{GoogleGenerativeAI:t}=this.sdk,n=new t(this.apiKey).getGenerativeModel({model:e.model,systemInstruction:e.system,generationConfig:{maxOutputTokens:e.maxTokens}}),{messages:r}=this.formatMessages(e.messages,e.system),i=this.formatTools(e.tools);return(await n.generateContentStream({contents:r,tools:i.length>0?[{functionDeclarations:i}]:void 0})).stream}async*parseStreamEvents(e){let t=`stop`,n=!1;for await(let a of e){let e=a;e.usageMetadata&&(yield{type:`message_meta`,inputTokens:e.usageMetadata.promptTokenCount,outputTokens:e.usageMetadata.candidatesTokenCount,stopReason:``});let o=e.candidates?.[0];if(!o)continue;o.finishReason&&(t=r(o.finishReason));let s=o.content?.parts;if(s)for(let e of s)for(let t of i(e))t.type===`tool_use_start`&&(n=!0),yield t}yield{type:`message_meta`,stopReason:n?`tool_use`:t}}formatTools(e){return e.map(e=>({name:e.name,description:e.description,parameters:n(e.parameters)}))}formatMessages(e,t){let n=[];for(let t of e){let e=s(t);e&&n.push(e)}return{messages:n}}formatToolResults(e){return{role:`tool_result`,content:e.map(e=>`${e.toolName||e.toolUseId}: ${e.content}`).join(`
|
|
2
|
+
`),_toolResults:e}}shouldContinue(e){return e===`tool_use`}formatError(e){if(!e||!(e instanceof Error))return`Something went wrong. Please try again.`;let t=e.message||``,n=e;return n.status===429?`Too many requests. Please wait a moment and try again.`:n.status===403||n.status===401?`Authentication failed. Please check your API key configuration.`:n.status===503||n.status===500?`The AI service is temporarily unavailable. Please try again in a moment.`:t.includes(`SAFETY`)?`The request was blocked by safety filters. Please rephrase your request.`:t.includes(`RECITATION`)?`The response was blocked due to recitation concerns. Please try a different query.`:t.startsWith(`{`)||t.startsWith(`[`)?`The AI service encountered an error. Please try again.`:t}};exports.GoogleProvider=c;
|