drizzle-cube 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express/index.cjs +2 -2
- package/dist/adapters/express/index.js +105 -104
- package/dist/adapters/fastify/index.cjs +2 -2
- package/dist/adapters/fastify/index.js +107 -106
- package/dist/adapters/{google-CBfBGU4F.js → google-CT4kgmBf.js} +1 -1
- package/dist/adapters/{google-BOAwi9Ib.cjs → google-Dgo9-Kb5.cjs} +1 -1
- package/dist/adapters/{handler-Cqf-CqAS.cjs → handler-C1Qs8JMY.cjs} +13 -13
- package/dist/adapters/{handler-BC3nFNxV.js → handler-CoaNnZyf.js} +154 -34
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +99 -98
- package/dist/adapters/{locale-BoiA6WiV.cjs → locale-CTuvUGBs.cjs} +7 -7
- package/dist/adapters/{locale-D9VQkLXt.js → locale-wMBdZ3Ks.js} +1 -1
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +8 -3
- package/dist/adapters/mcp-transport-B_HoB1HQ.js +579 -0
- package/dist/adapters/mcp-transport-bQzyrBPI.cjs +40 -0
- package/dist/adapters/mcp-transport.d.ts +22 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +136 -135
- package/dist/adapters/{openai-B4N3KfTG.cjs → openai-BjLV_Wjx.cjs} +1 -1
- package/dist/adapters/{openai-BWdm0JvG.js → openai-DQawCWQb.js} +1 -1
- package/dist/adapters/utils-CIRA5_JO.cjs +128 -0
- package/dist/adapters/{utils-CTYvfZ3I.js → utils-hC7Z8V39.js} +1114 -664
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +52 -5
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts/chartConfigs.d.ts +34 -0
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/{DashboardEditModal-IU_0dgfC.js → DashboardEditModal-DayTXEH0.js} +10 -10
- package/dist/client/chunks/{DashboardEditModal-IU_0dgfC.js.map → DashboardEditModal-DayTXEH0.js.map} +1 -1
- package/dist/client/chunks/{FieldSearchModal-BCWanpPX.js → FieldSearchModal-B7Mr8UNT.js} +4 -4
- package/dist/client/chunks/{FieldSearchModal-BCWanpPX.js.map → FieldSearchModal-B7Mr8UNT.js.map} +1 -1
- package/dist/client/chunks/KpiDelta-C-hZ1x01.js +2 -0
- package/dist/client/chunks/KpiNumber-Beo8CK0a.js +2 -0
- package/dist/client/chunks/KpiText-ytYiRTRO.js +2 -0
- package/dist/client/chunks/{RetentionCombinedChart-CQMBODsK.js → RetentionCombinedChart-D3dRmoos.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-CQMBODsK.js.map → RetentionCombinedChart-D3dRmoos.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-B_5sewwi.js → RetentionHeatmap-DHPnn0qH.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-B_5sewwi.js.map → RetentionHeatmap-DHPnn0qH.js.map} +1 -1
- package/dist/client/chunks/SchemaVisualization-DbYZBTyi.js +2 -0
- package/dist/client/chunks/SchemaVisualizationLazy-BGo-1S3q.js +2 -0
- package/dist/client/chunks/{af-ZA-xDmO5F0s.js → af-ZA-BtTNqvHF.js} +8 -3
- package/dist/client/chunks/af-ZA-BtTNqvHF.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-Dm6eD_AX.js → analysis-builder-lcGl099d.js} +245 -255
- package/dist/client/chunks/analysis-builder-lcGl099d.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-DT5bXwCA.js → analysis-builder-shared-6BRZcEnu.js} +391 -459
- package/dist/client/chunks/analysis-builder-shared-6BRZcEnu.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CWT0gLv4.js → chart-activity-grid-BnY-jaoa.js} +26 -6
- package/dist/client/chunks/chart-activity-grid-BnY-jaoa.js.map +1 -0
- package/dist/client/chunks/{chart-area-DDti9Qtp.js → chart-area-G3OvLLK4.js} +2 -2
- package/dist/client/chunks/{chart-area-DDti9Qtp.js.map → chart-area-G3OvLLK4.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-B3s9qDlh.js → chart-bar-MLIWiLrc.js} +3 -3
- package/dist/client/chunks/{chart-bar-B3s9qDlh.js.map → chart-bar-MLIWiLrc.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-o-h9MRX5.js → chart-box-plot-c2XqKTWq.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-o-h9MRX5.js.map → chart-box-plot-c2XqKTWq.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-CMDp4Pfm.js → chart-bubble-CAGvnYb1.js} +2 -2
- package/dist/client/chunks/{chart-bubble-CMDp4Pfm.js.map → chart-bubble-CAGvnYb1.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-WyANJ0Ky.js → chart-candlestick-oSPk-KQp.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-WyANJ0Ky.js.map → chart-candlestick-oSPk-KQp.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-C-EkgYoa.js → chart-config-activity-grid-Dssynumw.js} +8 -1
- package/dist/client/chunks/chart-config-activity-grid-Dssynumw.js.map +1 -0
- package/dist/client/chunks/{chart-config-area-CMZpbIah.js → chart-config-area-40fbx2Ah.js} +8 -1
- package/dist/client/chunks/chart-config-area-40fbx2Ah.js.map +1 -0
- package/dist/client/chunks/{chart-config-bar-B8_V4YLg.js → chart-config-bar-CUWHwOPN.js} +8 -1
- package/dist/client/chunks/chart-config-bar-CUWHwOPN.js.map +1 -0
- package/dist/client/chunks/{chart-config-box-plot-Dwj7sEbU.js → chart-config-box-plot-D3Y0ien3.js} +8 -1
- package/dist/client/chunks/chart-config-box-plot-D3Y0ien3.js.map +1 -0
- package/dist/client/chunks/{chart-config-bubble-B0w0ZVp4.js → chart-config-bubble-BXSTKLn-.js} +8 -1
- package/dist/client/chunks/chart-config-bubble-BXSTKLn-.js.map +1 -0
- package/dist/client/chunks/{chart-config-candlestick-Bvo3zeIn.js → chart-config-candlestick-DEuD2Av0.js} +8 -1
- package/dist/client/chunks/chart-config-candlestick-DEuD2Av0.js.map +1 -0
- package/dist/client/chunks/{chart-config-gauge-C5ZiyZy7.js → chart-config-gauge-CCva3FfA.js} +5 -1
- package/dist/client/chunks/chart-config-gauge-CCva3FfA.js.map +1 -0
- package/dist/client/chunks/{chart-config-heat-map-Cv8qNnVP.js → chart-config-heat-map-Db4Z8UUn.js} +8 -1
- package/dist/client/chunks/chart-config-heat-map-Db4Z8UUn.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-delta-BraHQc2E.js → chart-config-kpi-delta-BfLf3iyi.js} +8 -1
- package/dist/client/chunks/chart-config-kpi-delta-BfLf3iyi.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-number-CeCkx7mC.js → chart-config-kpi-number-DWKFc9PX.js} +5 -1
- package/dist/client/chunks/chart-config-kpi-number-DWKFc9PX.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-text-CImM3SvH.js → chart-config-kpi-text-Dr4OG6cY.js} +5 -1
- package/dist/client/chunks/chart-config-kpi-text-Dr4OG6cY.js.map +1 -0
- package/dist/client/chunks/{chart-config-line-BVKapAQK.js → chart-config-line-DGYYdDw9.js} +8 -1
- package/dist/client/chunks/chart-config-line-DGYYdDw9.js.map +1 -0
- package/dist/client/chunks/{chart-config-measure-profile-KTVV1gO3.js → chart-config-measure-profile-sB3n_Azv.js} +5 -1
- package/dist/client/chunks/chart-config-measure-profile-sB3n_Azv.js.map +1 -0
- package/dist/client/chunks/{chart-config-pie-BZxVl25X.js → chart-config-pie-kte7OXa9.js} +8 -1
- package/dist/client/chunks/chart-config-pie-kte7OXa9.js.map +1 -0
- package/dist/client/chunks/{chart-config-radar-B7FByX3t.js → chart-config-radar-C9IxP5tc.js} +8 -1
- package/dist/client/chunks/chart-config-radar-C9IxP5tc.js.map +1 -0
- package/dist/client/chunks/{chart-config-radial-bar-UfW_3yyX.js → chart-config-radial-bar-C3WJ8Uhm.js} +8 -1
- package/dist/client/chunks/chart-config-radial-bar-C3WJ8Uhm.js.map +1 -0
- package/dist/client/chunks/{chart-config-scatter-BVVJuOnt.js → chart-config-scatter-BVN_29G5.js} +8 -1
- package/dist/client/chunks/chart-config-scatter-BVN_29G5.js.map +1 -0
- package/dist/client/chunks/{chart-config-tree-map-IHp97OyV.js → chart-config-tree-map-meeJEDi8.js} +8 -1
- package/dist/client/chunks/chart-config-tree-map-meeJEDi8.js.map +1 -0
- package/dist/client/chunks/{chart-config-waterfall-BdqG1V-x.js → chart-config-waterfall-CaPeWZMl.js} +8 -1
- package/dist/client/chunks/chart-config-waterfall-CaPeWZMl.js.map +1 -0
- package/dist/client/chunks/{chart-data-table-Qrt6EAno.js → chart-data-table-BRXHT2H-.js} +68 -68
- package/dist/client/chunks/chart-data-table-BRXHT2H-.js.map +1 -0
- package/dist/client/chunks/{chart-funnel-C7pgktN5.js → chart-funnel-aQ7G_CqU.js} +2 -2
- package/dist/client/chunks/{chart-funnel-C7pgktN5.js.map → chart-funnel-aQ7G_CqU.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-D2r2B_AR.js → chart-gauge-DqbDKr9E.js} +2 -2
- package/dist/client/chunks/{chart-gauge-D2r2B_AR.js.map → chart-gauge-DqbDKr9E.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-Dw2yjwfO.js → chart-heat-map--6QnhUM8.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-Dw2yjwfO.js.map → chart-heat-map--6QnhUM8.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-CgldZ7zO.js → chart-kpi-delta-DOSpRjfs.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-CgldZ7zO.js.map → chart-kpi-delta-DOSpRjfs.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-ByfuX1ki.js → chart-kpi-number-BcMjeKm8.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-ByfuX1ki.js.map → chart-kpi-number-BcMjeKm8.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-DeNuDraJ.js → chart-kpi-text-BI9isc2i.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-DeNuDraJ.js.map → chart-kpi-text-BI9isc2i.js.map} +1 -1
- package/dist/client/chunks/{chart-line-RdZwtk27.js → chart-line-C0IHQteu.js} +3 -3
- package/dist/client/chunks/{chart-line-RdZwtk27.js.map → chart-line-C0IHQteu.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-CiGRZdJj.js → chart-markdown-BmgSMqPg.js} +2 -2
- package/dist/client/chunks/{chart-markdown-CiGRZdJj.js.map → chart-markdown-BmgSMqPg.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-Ckjw9bX6.js → chart-measure-profile-DEyLW1fd.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-Ckjw9bX6.js.map → chart-measure-profile-DEyLW1fd.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-BvY4FY__.js → chart-pie-DSIekr7p.js} +3 -3
- package/dist/client/chunks/{chart-pie-BvY4FY__.js.map → chart-pie-DSIekr7p.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-DjiiEAmc.js → chart-radar-SGl62hK8.js} +3 -3
- package/dist/client/chunks/{chart-radar-DjiiEAmc.js.map → chart-radar-SGl62hK8.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-lla_JEYu.js → chart-radial-bar-C42EykOa.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar-lla_JEYu.js.map → chart-radial-bar-C42EykOa.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-WwkZAhLy.js → chart-sankey-DguImp0W.js} +2 -2
- package/dist/client/chunks/{chart-sankey-WwkZAhLy.js.map → chart-sankey-DguImp0W.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DwXnI0rr.js → chart-scatter-Doeox4OP.js} +3 -3
- package/dist/client/chunks/{chart-scatter-DwXnI0rr.js.map → chart-scatter-Doeox4OP.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-CIDB_pTl.js → chart-sunburst-F3tgCpL-.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-CIDB_pTl.js.map → chart-sunburst-F3tgCpL-.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DJHoA26f.js → chart-tree-map-DvuSCIc8.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-DJHoA26f.js.map → chart-tree-map-DvuSCIc8.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-Y7c8csO5.js → chart-waterfall-Be5duXlO.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-Y7c8csO5.js.map → chart-waterfall-Be5duXlO.js.map} +1 -1
- package/dist/client/chunks/{charts-core-BXOqaYFn.js → charts-core-XlOwoP_r.js} +2 -2
- package/dist/client/chunks/{charts-core-BXOqaYFn.js.map → charts-core-XlOwoP_r.js.map} +1 -1
- package/dist/client/chunks/{nl-NL-vCifBijs.js → nl-NL-BLDeSy_P.js} +24 -4
- package/dist/client/chunks/nl-NL-BLDeSy_P.js.map +1 -0
- package/dist/client/chunks/{schema-visualization-DWwJukK7.js → schema-visualization-CM5ikSWB.js} +4 -4
- package/dist/client/chunks/{schema-visualization-DWwJukK7.js.map → schema-visualization-CM5ikSWB.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-DyJVREop.js → useDebounce-NEZQbfxN.js} +4 -4
- package/dist/client/chunks/{useDebounce-DyJVREop.js.map → useDebounce-NEZQbfxN.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-CxSkjocM.js → useExplainAI-DivfI0dW.js} +4 -4
- package/dist/client/chunks/{useExplainAI-CxSkjocM.js.map → useExplainAI-DivfI0dW.js.map} +1 -1
- package/dist/client/chunks/{utils-BHZdKxua.js → utils-Ctl_cVNR.js} +2 -2
- package/dist/client/chunks/{utils-BHZdKxua.js.map → utils-Ctl_cVNR.js.map} +1 -1
- package/dist/client/chunks/{vendor-CBD_Olr0.js → vendor-BcLQ6iVZ.js} +2 -2
- package/dist/client/chunks/{vendor-CBD_Olr0.js.map → vendor-BcLQ6iVZ.js.map} +1 -1
- package/dist/client/components/AnalysisBuilder/types.d.ts +2 -2
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +14 -14
- package/dist/client/providers.js +1 -1
- package/dist/client/schema.js +1 -1
- package/dist/client/shared/chartDefaults.d.ts +5 -10
- package/dist/client/utils.js +5 -5
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +24 -24
- package/dist/server/index.cjs +135 -134
- package/dist/server/index.js +1128 -948
- package/package.json +2 -2
- package/dist/adapters/mcp-prompts-BUFyQLHQ.js +0 -377
- package/dist/adapters/mcp-prompts-B_NvEJT_.cjs +0 -111
- package/dist/adapters/mcp-transport-B0mgxRnJ.js +0 -579
- package/dist/adapters/mcp-transport-irsahKmD.cjs +0 -39
- package/dist/adapters/utils-XPOzzMdY.cjs +0 -17
- package/dist/client/chunks/KpiDelta-_igN6cJa.js +0 -2
- package/dist/client/chunks/KpiNumber-t5n8PtRU.js +0 -2
- package/dist/client/chunks/KpiText-BCZJJ6a0.js +0 -2
- package/dist/client/chunks/SchemaVisualization-BUUhlOvG.js +0 -2
- package/dist/client/chunks/SchemaVisualizationLazy-CwaPCUL0.js +0 -2
- package/dist/client/chunks/af-ZA-xDmO5F0s.js.map +0 -1
- package/dist/client/chunks/analysis-builder-Dm6eD_AX.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-DT5bXwCA.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-CWT0gLv4.js.map +0 -1
- package/dist/client/chunks/chart-config-activity-grid-C-EkgYoa.js.map +0 -1
- package/dist/client/chunks/chart-config-area-CMZpbIah.js.map +0 -1
- package/dist/client/chunks/chart-config-bar-B8_V4YLg.js.map +0 -1
- package/dist/client/chunks/chart-config-box-plot-Dwj7sEbU.js.map +0 -1
- package/dist/client/chunks/chart-config-bubble-B0w0ZVp4.js.map +0 -1
- package/dist/client/chunks/chart-config-candlestick-Bvo3zeIn.js.map +0 -1
- package/dist/client/chunks/chart-config-gauge-C5ZiyZy7.js.map +0 -1
- package/dist/client/chunks/chart-config-heat-map-Cv8qNnVP.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-delta-BraHQc2E.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-number-CeCkx7mC.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-text-CImM3SvH.js.map +0 -1
- package/dist/client/chunks/chart-config-line-BVKapAQK.js.map +0 -1
- package/dist/client/chunks/chart-config-measure-profile-KTVV1gO3.js.map +0 -1
- package/dist/client/chunks/chart-config-pie-BZxVl25X.js.map +0 -1
- package/dist/client/chunks/chart-config-radar-B7FByX3t.js.map +0 -1
- package/dist/client/chunks/chart-config-radial-bar-UfW_3yyX.js.map +0 -1
- package/dist/client/chunks/chart-config-scatter-BVVJuOnt.js.map +0 -1
- package/dist/client/chunks/chart-config-tree-map-IHp97OyV.js.map +0 -1
- package/dist/client/chunks/chart-config-waterfall-BdqG1V-x.js.map +0 -1
- package/dist/client/chunks/chart-data-table-Qrt6EAno.js.map +0 -1
- package/dist/client/chunks/nl-NL-vCifBijs.js.map +0 -1
- /package/dist/adapters/{anthropic-Cto4Jxqt.cjs → anthropic-BIva8k1r.cjs} +0 -0
- /package/dist/adapters/{anthropic-DpEbCVvF.js → anthropic-B_rg0BhK.js} +0 -0
- /package/dist/adapters/{dist-BnyV9wfA.cjs → dist-Boc63-1q.cjs} +0 -0
- /package/dist/adapters/{dist-DjVh2RFz.js → dist-De5fzUEM.js} +0 -0
- /package/dist/adapters/{openai-CoqT_FM5.cjs → openai-Bgri5TJc.cjs} +0 -0
- /package/dist/adapters/{openai-D0Nsvc9L.js → openai-CuUGrKaK.js} +0 -0
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { a as e, f as t, i as n, o as r, r as i, u as a,
|
|
2
|
-
import { i as s, n as c, r as l, t as u } from "../locale-
|
|
3
|
-
import {
|
|
1
|
+
import { a as e, f as t, i as n, o as r, r as i, u as a, w as o } from "../utils-hC7Z8V39.js";
|
|
2
|
+
import { i as s, n as c, r as l, t as u } from "../locale-wMBdZ3Ks.js";
|
|
3
|
+
import { C as d, S as f, _ as p, a as m, b as h, c as g, g as _, h as v, i as y, l as b, m as x, o as S, r as C, u as w, v as T, x as E, y as D } from "../mcp-transport-B_HoB1HQ.js";
|
|
4
4
|
//#region src/adapters/fastify/index.ts
|
|
5
|
-
var
|
|
6
|
-
let { cubes:
|
|
7
|
-
if (!
|
|
8
|
-
let
|
|
9
|
-
if (
|
|
5
|
+
var O = function(o, O, k) {
|
|
6
|
+
let { cubes: A, drizzle: j, schema: M, extractSecurityContext: N, engineType: P, cors: F, basePath: I = "/cubejs-api/v1", bodyLimit: L = 10485760, cache: R, mcp: z = { enabled: !0 }, agent: B } = O;
|
|
7
|
+
if (!A || A.length === 0) return k(/* @__PURE__ */ Error("At least one cube must be provided in the cubes array"));
|
|
8
|
+
let V = async (e) => l(await N(e), c((t) => e.headers[t.toLowerCase()]));
|
|
9
|
+
if (F) {
|
|
10
10
|
let e = {
|
|
11
|
-
...
|
|
12
|
-
allowedHeaders: u(
|
|
11
|
+
...F,
|
|
12
|
+
allowedHeaders: u(F.allowedHeaders)
|
|
13
13
|
};
|
|
14
14
|
o.register(import("@fastify/cors"), e);
|
|
15
15
|
}
|
|
16
16
|
o.addHook("onRequest", async (e, t) => {
|
|
17
17
|
e.method === "POST" && (e.body = void 0);
|
|
18
18
|
});
|
|
19
|
-
let
|
|
20
|
-
drizzle:
|
|
21
|
-
schema:
|
|
22
|
-
engineType:
|
|
23
|
-
cache:
|
|
24
|
-
rlsSetup:
|
|
19
|
+
let H = new s({
|
|
20
|
+
drizzle: j,
|
|
21
|
+
schema: M,
|
|
22
|
+
engineType: P,
|
|
23
|
+
cache: R,
|
|
24
|
+
rlsSetup: O.rlsSetup
|
|
25
25
|
});
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
}), o.post(`${
|
|
29
|
-
bodyLimit:
|
|
26
|
+
if (A.forEach((e) => {
|
|
27
|
+
H.registerCube(e);
|
|
28
|
+
}), o.post(`${I}/load`, {
|
|
29
|
+
bodyLimit: L,
|
|
30
30
|
schema: { body: {
|
|
31
31
|
type: "object",
|
|
32
32
|
additionalProperties: !0
|
|
33
33
|
} }
|
|
34
34
|
}, async (e, t) => {
|
|
35
35
|
try {
|
|
36
|
-
let r = e.body, a = r.query || r, o = await
|
|
36
|
+
let r = e.body, a = r.query || r, o = await V(e), s = H.validateQuery(a);
|
|
37
37
|
if (!s.isValid) return t.status(400).send(n(`Query validation failed: ${s.errors.join(", ")}`, 400));
|
|
38
38
|
let c = e.headers["x-cache-control"] === "no-cache";
|
|
39
|
-
return i(a, await
|
|
39
|
+
return i(a, await H.executeMultiCubeQuery(a, o, { skipCache: c }), H);
|
|
40
40
|
} catch (r) {
|
|
41
41
|
return e.log.error(r, "Query execution error"), t.status(500).send(n(r instanceof Error ? r.message : "Query execution failed", 500));
|
|
42
42
|
}
|
|
43
|
-
}), o.get(`${
|
|
43
|
+
}), o.get(`${I}/load`, { schema: { querystring: {
|
|
44
44
|
type: "object",
|
|
45
45
|
properties: { query: { type: "string" } },
|
|
46
46
|
required: ["query"]
|
|
@@ -52,15 +52,15 @@ var D = function(o, D, O) {
|
|
|
52
52
|
} catch {
|
|
53
53
|
return t.status(400).send(n("Invalid JSON in query parameter", 400));
|
|
54
54
|
}
|
|
55
|
-
let o = await
|
|
55
|
+
let o = await V(e), s = H.validateQuery(a);
|
|
56
56
|
if (!s.isValid) return t.status(400).send(n(`Query validation failed: ${s.errors.join(", ")}`, 400));
|
|
57
|
-
let c = e.headers["x-cache-control"] === "no-cache", l = await
|
|
58
|
-
return i(a, l,
|
|
57
|
+
let c = e.headers["x-cache-control"] === "no-cache", l = await H.executeMultiCubeQuery(a, o, { skipCache: c });
|
|
58
|
+
return i(a, l, H);
|
|
59
59
|
} catch (r) {
|
|
60
60
|
return e.log.error(r, "Query execution error"), t.status(500).send(n(r instanceof Error ? r.message : "Query execution failed", 500));
|
|
61
61
|
}
|
|
62
|
-
}), o.post(`${
|
|
63
|
-
bodyLimit:
|
|
62
|
+
}), o.post(`${I}/batch`, {
|
|
63
|
+
bodyLimit: L,
|
|
64
64
|
schema: { body: {
|
|
65
65
|
type: "object",
|
|
66
66
|
required: ["queries"],
|
|
@@ -72,50 +72,50 @@ var D = function(o, D, O) {
|
|
|
72
72
|
}, async (e, t) => {
|
|
73
73
|
try {
|
|
74
74
|
let { queries: r } = e.body;
|
|
75
|
-
return !r || !Array.isArray(r) ? t.status(400).send(n("Request body must contain a \"queries\" array", 400)) : r.length === 0 ? t.status(400).send(n("Queries array cannot be empty", 400)) : await a(r, await
|
|
75
|
+
return !r || !Array.isArray(r) ? t.status(400).send(n("Request body must contain a \"queries\" array", 400)) : r.length === 0 ? t.status(400).send(n("Queries array cannot be empty", 400)) : await a(r, await V(e), H, { skipCache: e.headers["x-cache-control"] === "no-cache" });
|
|
76
76
|
} catch (r) {
|
|
77
77
|
return e.log.error(r, "Batch execution error"), t.status(500).send(n(r instanceof Error ? r.message : "Batch execution failed", 500));
|
|
78
78
|
}
|
|
79
|
-
}), o.get(`${
|
|
79
|
+
}), o.get(`${I}/meta`, async (t, r) => {
|
|
80
80
|
try {
|
|
81
|
-
return e(
|
|
81
|
+
return e(H.getMetadata());
|
|
82
82
|
} catch (e) {
|
|
83
83
|
return t.log.error(e, "Metadata error"), r.status(500).send(n(e instanceof Error ? e.message : "Failed to fetch metadata", 500));
|
|
84
84
|
}
|
|
85
|
-
}), o.post(`${
|
|
86
|
-
bodyLimit:
|
|
85
|
+
}), o.post(`${I}/sql`, {
|
|
86
|
+
bodyLimit: L,
|
|
87
87
|
schema: { body: {
|
|
88
88
|
type: "object",
|
|
89
89
|
additionalProperties: !0
|
|
90
90
|
} }
|
|
91
91
|
}, async (e, t) => {
|
|
92
92
|
try {
|
|
93
|
-
let i = e.body, a = await
|
|
93
|
+
let i = e.body, a = await V(e), o = H.validateQuery(i);
|
|
94
94
|
if (!o.isValid) return t.status(400).send(n(`Query validation failed: ${o.errors.join(", ")}`, 400));
|
|
95
95
|
let s = i.measures?.[0] || i.dimensions?.[0];
|
|
96
96
|
if (!s) return t.status(400).send(n("No measures or dimensions specified", 400));
|
|
97
97
|
let c = s.split(".")[0];
|
|
98
|
-
return r(i, await
|
|
98
|
+
return r(i, await H.generateSQL(c, i, a));
|
|
99
99
|
} catch (r) {
|
|
100
100
|
return e.log.error({ err: String(r).replace(/\n|\r/g, "") }, "SQL generation error"), t.status(500).send(n(r instanceof Error ? r.message : "SQL generation failed", 500));
|
|
101
101
|
}
|
|
102
|
-
}), o.get(`${
|
|
102
|
+
}), o.get(`${I}/sql`, { schema: { querystring: {
|
|
103
103
|
type: "object",
|
|
104
104
|
properties: { query: { type: "string" } },
|
|
105
105
|
required: ["query"]
|
|
106
106
|
} } }, async (e, t) => {
|
|
107
107
|
try {
|
|
108
|
-
let { query: i } = e.query, a = JSON.parse(i), o = await
|
|
108
|
+
let { query: i } = e.query, a = JSON.parse(i), o = await V(e), s = H.validateQuery(a);
|
|
109
109
|
if (!s.isValid) return t.status(400).send(n(`Query validation failed: ${s.errors.join(", ")}`, 400));
|
|
110
110
|
let c = a.measures?.[0] || a.dimensions?.[0];
|
|
111
111
|
if (!c) return t.status(400).send(n("No measures or dimensions specified", 400));
|
|
112
112
|
let l = c.split(".")[0];
|
|
113
|
-
return r(a, await
|
|
113
|
+
return r(a, await H.generateSQL(l, a, o));
|
|
114
114
|
} catch (r) {
|
|
115
115
|
return e.log.error({ err: String(r).replace(/\n|\r/g, "") }, "SQL generation error"), t.status(500).send(n(r instanceof Error ? r.message : "SQL generation failed", 500));
|
|
116
116
|
}
|
|
117
|
-
}), o.post(`${
|
|
118
|
-
bodyLimit:
|
|
117
|
+
}), o.post(`${I}/dry-run`, {
|
|
118
|
+
bodyLimit: L,
|
|
119
119
|
schema: { body: {
|
|
120
120
|
type: "object",
|
|
121
121
|
additionalProperties: !0
|
|
@@ -123,57 +123,57 @@ var D = function(o, D, O) {
|
|
|
123
123
|
}, async (e, n) => {
|
|
124
124
|
try {
|
|
125
125
|
let n = e.body;
|
|
126
|
-
return await t(n.query || n, await
|
|
126
|
+
return await t(n.query || n, await V(e), H);
|
|
127
127
|
} catch (t) {
|
|
128
128
|
return e.log.error(t, "Dry-run error"), n.status(400).send({
|
|
129
129
|
error: t instanceof Error ? t.message : "Dry-run validation failed",
|
|
130
130
|
valid: !1
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
}), o.get(`${
|
|
133
|
+
}), o.get(`${I}/dry-run`, { schema: { querystring: {
|
|
134
134
|
type: "object",
|
|
135
135
|
properties: { query: { type: "string" } },
|
|
136
136
|
required: ["query"]
|
|
137
137
|
} } }, async (e, n) => {
|
|
138
138
|
try {
|
|
139
139
|
let { query: n } = e.query;
|
|
140
|
-
return await t(JSON.parse(n), await
|
|
140
|
+
return await t(JSON.parse(n), await V(e), H);
|
|
141
141
|
} catch (t) {
|
|
142
142
|
return e.log.error(t, "Dry-run error"), n.status(400).send({
|
|
143
143
|
error: t instanceof Error ? t.message : "Dry-run validation failed",
|
|
144
144
|
valid: !1
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
}), o.post(`${
|
|
148
|
-
bodyLimit:
|
|
147
|
+
}), o.post(`${I}/explain`, {
|
|
148
|
+
bodyLimit: L,
|
|
149
149
|
schema: { body: {
|
|
150
150
|
type: "object",
|
|
151
151
|
additionalProperties: !0
|
|
152
152
|
} }
|
|
153
153
|
}, async (e, t) => {
|
|
154
154
|
try {
|
|
155
|
-
let n = e.body, r = n.query || n, i = n.options || {}, a = await
|
|
156
|
-
return o.isValid ? await
|
|
155
|
+
let n = e.body, r = n.query || n, i = n.options || {}, a = await V(e), o = H.validateQuery(r);
|
|
156
|
+
return o.isValid ? await H.explainQuery(r, a, i) : t.status(400).send({ error: `Query validation failed: ${o.errors.join(", ")}` });
|
|
157
157
|
} catch (n) {
|
|
158
158
|
return e.log.error(n, "Explain error"), t.status(500).send({ error: n instanceof Error ? n.message : "Explain query failed" });
|
|
159
159
|
}
|
|
160
|
-
}),
|
|
161
|
-
bodyLimit:
|
|
160
|
+
}), B && o.post(`${I}/agent/chat`, {
|
|
161
|
+
bodyLimit: L,
|
|
162
162
|
schema: { body: {
|
|
163
163
|
type: "object",
|
|
164
164
|
additionalProperties: !0
|
|
165
165
|
} }
|
|
166
166
|
}, async (e, t) => {
|
|
167
167
|
try {
|
|
168
|
-
let { handleAgentChat: n } = await import("../handler-
|
|
168
|
+
let { handleAgentChat: n } = await import("../handler-CoaNnZyf.js"), { message: r, sessionId: i, history: a } = e.body;
|
|
169
169
|
if (!r || typeof r != "string") return t.status(400).send({ error: "message is required and must be a string" });
|
|
170
|
-
let o = (
|
|
171
|
-
if (
|
|
170
|
+
let o = (B.apiKey || "").trim();
|
|
171
|
+
if (B.allowClientApiKey) {
|
|
172
172
|
let t = e.headers["x-agent-api-key"];
|
|
173
173
|
t && (o = t.trim());
|
|
174
174
|
}
|
|
175
175
|
if (!o) return t.status(401).send({ error: "No API key configured. Set agent.apiKey in server config or send X-Agent-Api-Key header." });
|
|
176
|
-
let s =
|
|
176
|
+
let s = B.allowClientApiKey ? e.headers["x-agent-provider"] : void 0, c = B.allowClientApiKey ? e.headers["x-agent-model"] : void 0, l = B.allowClientApiKey ? e.headers["x-agent-provider-endpoint"] : void 0, u = await V(e), d = B.buildSystemContext?.(u);
|
|
177
177
|
t.raw.writeHead(200, {
|
|
178
178
|
"Content-Type": "text/event-stream",
|
|
179
179
|
"Cache-Control": "no-cache",
|
|
@@ -184,9 +184,9 @@ var D = function(o, D, O) {
|
|
|
184
184
|
message: r,
|
|
185
185
|
sessionId: i,
|
|
186
186
|
history: a,
|
|
187
|
-
semanticLayer:
|
|
187
|
+
semanticLayer: H,
|
|
188
188
|
securityContext: u,
|
|
189
|
-
agentConfig:
|
|
189
|
+
agentConfig: B,
|
|
190
190
|
apiKey: o,
|
|
191
191
|
systemContext: d,
|
|
192
192
|
providerOverride: s,
|
|
@@ -206,70 +206,71 @@ var D = function(o, D, O) {
|
|
|
206
206
|
} catch (n) {
|
|
207
207
|
if (e.log.error(n, "Agent chat error"), !t.raw.headersSent) return t.status(500).send({ error: n instanceof Error ? n.message : "Agent chat failed" });
|
|
208
208
|
}
|
|
209
|
-
}),
|
|
210
|
-
let e =
|
|
211
|
-
o.post(`${
|
|
212
|
-
bodyLimit:
|
|
209
|
+
}), z.enabled !== !1) {
|
|
210
|
+
let e = S(H, z.resources), t = D(z.prompts), n = T(z.instructions), r = z.basePath ?? "/mcp";
|
|
211
|
+
o.post(`${r}`, {
|
|
212
|
+
bodyLimit: L,
|
|
213
213
|
schema: { body: {
|
|
214
214
|
type: "object",
|
|
215
215
|
additionalProperties: !0
|
|
216
216
|
} }
|
|
217
|
-
}, async (
|
|
218
|
-
if (
|
|
219
|
-
let
|
|
220
|
-
if (!
|
|
221
|
-
let
|
|
222
|
-
if (!
|
|
223
|
-
let
|
|
224
|
-
if (!
|
|
217
|
+
}, async (r, i) => {
|
|
218
|
+
if (z.resourceMetadataUrl && !w(r.headers.authorization)) return i.header("WWW-Authenticate", g(z.resourceMetadataUrl)), i.status(401).send({ error: "Bearer token required" });
|
|
219
|
+
let a = f(r.headers.origin, z.allowedOrigins ? { allowedOrigins: z.allowedOrigins } : {});
|
|
220
|
+
if (!a.valid) return i.status(403).send(y(null, -32600, a.reason));
|
|
221
|
+
let o = r.headers.accept;
|
|
222
|
+
if (!E(o)) return i.status(400).send(y(null, -32600, "Accept header must include both application/json and text/event-stream"));
|
|
223
|
+
let s = v(r.headers);
|
|
224
|
+
if (!s.ok) return i.status(426).send({
|
|
225
225
|
error: "Unsupported MCP protocol version",
|
|
226
|
-
supported:
|
|
226
|
+
supported: s.supported
|
|
227
227
|
});
|
|
228
|
-
let
|
|
229
|
-
if (!
|
|
230
|
-
let
|
|
228
|
+
let c = _(r.body);
|
|
229
|
+
if (!c) return i.status(400).send(y(null, -32600, "Invalid JSON-RPC 2.0 request"));
|
|
230
|
+
let l = d(o), u = c.method === "initialize";
|
|
231
231
|
try {
|
|
232
|
-
let
|
|
233
|
-
semanticLayer:
|
|
234
|
-
extractSecurityContext: (e, t) =>
|
|
235
|
-
rawRequest:
|
|
236
|
-
rawResponse:
|
|
237
|
-
negotiatedProtocol:
|
|
232
|
+
let a = await b(c.method, c.params, {
|
|
233
|
+
semanticLayer: H,
|
|
234
|
+
extractSecurityContext: (e, t) => V(e),
|
|
235
|
+
rawRequest: r,
|
|
236
|
+
rawResponse: i,
|
|
237
|
+
negotiatedProtocol: s.negotiated,
|
|
238
238
|
resources: e,
|
|
239
239
|
prompts: t,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
instructions: n,
|
|
241
|
+
appEnabled: !!z.app,
|
|
242
|
+
appConfig: typeof z.app == "object" ? z.app : void 0,
|
|
243
|
+
serverName: z.serverName
|
|
243
244
|
});
|
|
244
|
-
if (
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
let
|
|
248
|
-
if (
|
|
249
|
-
let e =
|
|
250
|
-
|
|
245
|
+
if (x(c)) return i.status(202).send();
|
|
246
|
+
let o = u && a && typeof a == "object" && "sessionId" in a ? a.sessionId : void 0;
|
|
247
|
+
o && i.header(C, o);
|
|
248
|
+
let d = m(c.id ?? null, a);
|
|
249
|
+
if (l) {
|
|
250
|
+
let e = p();
|
|
251
|
+
i.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${e}\n\n${h(d, e)}`);
|
|
251
252
|
return;
|
|
252
253
|
}
|
|
253
|
-
return
|
|
254
|
+
return i.send(d);
|
|
254
255
|
} catch (e) {
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
let t = e?.code ?? -32603,
|
|
258
|
-
if (
|
|
259
|
-
let e =
|
|
260
|
-
|
|
256
|
+
if (x(c)) return r.log.error({ err: String(e).replace(/\n|\r/g, "") }, "MCP notification processing error"), i.status(202).send();
|
|
257
|
+
r.log.error({ err: String(e).replace(/\n|\r/g, "") }, "MCP RPC error");
|
|
258
|
+
let t = e?.code ?? -32603, n = e?.data, a = e.message || "MCP request failed", o = y(c.id ?? null, t, a, n);
|
|
259
|
+
if (l) {
|
|
260
|
+
let e = p();
|
|
261
|
+
i.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${e}\n\n${h(o, e)}`);
|
|
261
262
|
return;
|
|
262
263
|
}
|
|
263
|
-
return
|
|
264
|
+
return i.send(o);
|
|
264
265
|
}
|
|
265
|
-
}), o.get(`${
|
|
266
|
-
if (
|
|
267
|
-
let n =
|
|
266
|
+
}), o.get(`${r}`, async (e, t) => {
|
|
267
|
+
if (z.resourceMetadataUrl && !w(e.headers.authorization)) return t.header("WWW-Authenticate", g(z.resourceMetadataUrl)), t.status(401).send({ error: "Bearer token required" });
|
|
268
|
+
let n = p();
|
|
268
269
|
t.raw.writeHead(200, {
|
|
269
270
|
"Content-Type": "text/event-stream",
|
|
270
271
|
"Cache-Control": "no-cache",
|
|
271
272
|
Connection: "keep-alive"
|
|
272
|
-
}), t.raw.write(
|
|
273
|
+
}), t.raw.write(h({
|
|
273
274
|
jsonrpc: "2.0",
|
|
274
275
|
method: "mcp/ready",
|
|
275
276
|
params: { protocol: "streamable-http" }
|
|
@@ -280,16 +281,16 @@ var D = function(o, D, O) {
|
|
|
280
281
|
e.raw.on("close", () => {
|
|
281
282
|
clearInterval(r);
|
|
282
283
|
});
|
|
283
|
-
}), o.delete(`${
|
|
284
|
+
}), o.delete(`${r}`, async (e, t) => z.resourceMetadataUrl && !w(e.headers.authorization) ? (t.header("WWW-Authenticate", g(z.resourceMetadataUrl)), t.status(401).send({ error: "Bearer token required" })) : t.status(405).send({ error: "Session termination not supported" }));
|
|
284
285
|
}
|
|
285
|
-
o.setErrorHandler(async (e, t, r) => (t.log.error(e, "Fastify cube adapter error"), r.statusCode < 400 && r.status(500), n(e instanceof Error ? e : String(e), r.statusCode))),
|
|
286
|
+
o.setErrorHandler(async (e, t, r) => (t.log.error(e, "Fastify cube adapter error"), r.statusCode < 400 && r.status(500), n(e instanceof Error ? e : String(e), r.statusCode))), k();
|
|
286
287
|
};
|
|
287
|
-
async function
|
|
288
|
-
await e.register(
|
|
288
|
+
async function k(e, t) {
|
|
289
|
+
await e.register(O, t);
|
|
289
290
|
}
|
|
290
|
-
function
|
|
291
|
+
function A(e) {
|
|
291
292
|
let t = o("fastify")({ logger: !0 });
|
|
292
|
-
return t.register(
|
|
293
|
+
return t.register(O, e), t;
|
|
293
294
|
}
|
|
294
295
|
//#endregion
|
|
295
|
-
export {
|
|
296
|
+
export { A as createCubeApp, O as cubePlugin, k as registerCubeRoutes };
|
|
@@ -21,7 +21,7 @@ var t = class {
|
|
|
21
21
|
try {
|
|
22
22
|
this.sdk = await import(
|
|
23
23
|
/* webpackIgnore: true */
|
|
24
|
-
"./dist-
|
|
24
|
+
"./dist-De5fzUEM.js"
|
|
25
25
|
);
|
|
26
26
|
} catch {
|
|
27
27
|
throw Error("@google/generative-ai is required for the Google provider. Install it with: npm install @google/generative-ai");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(t){let n={};for(let[r,i]of Object.entries(t))if(r===`type`&&typeof i==`string`)n[r]=i.toUpperCase();else if(r===`properties`&&typeof i==`object`&&i){let t={};for(let[n,r]of Object.entries(i))typeof r==`object`&&r?t[n]=e(r):t[n]=r;n[r]=t}else r===`items`&&typeof i==`object`&&i?n[r]=e(i):n[r]=i;return n}var t=class{apiKey;sdk;initialized=!1;constructor(e){this.apiKey=e}async ensureSDK(){if(!this.initialized){try{this.sdk=await Promise.resolve().then(()=>require(`./dist-
|
|
1
|
+
function e(t){let n={};for(let[r,i]of Object.entries(t))if(r===`type`&&typeof i==`string`)n[r]=i.toUpperCase();else if(r===`properties`&&typeof i==`object`&&i){let t={};for(let[n,r]of Object.entries(i))typeof r==`object`&&r?t[n]=e(r):t[n]=r;n[r]=t}else r===`items`&&typeof i==`object`&&i?n[r]=e(i):n[r]=i;return n}var t=class{apiKey;sdk;initialized=!1;constructor(e){this.apiKey=e}async ensureSDK(){if(!this.initialized){try{this.sdk=await Promise.resolve().then(()=>require(`./dist-Boc63-1q.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 r of e){let e=r;e.usageMetadata&&(yield{type:`message_meta`,inputTokens:e.usageMetadata.promptTokenCount,outputTokens:e.usageMetadata.candidatesTokenCount,stopReason:``});let i=e.candidates?.[0];if(!i)continue;i.finishReason&&(t=i.finishReason===`STOP`?`stop`:i.finishReason===`MAX_TOKENS`?`max_tokens`:i.finishReason);let a=i.content?.parts;if(a){for(let e of a)if(e.text&&!e.thought&&(yield{type:`text_delta`,text:e.text}),e.functionCall){n=!0;let t=`gemini-tc-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,r=e.thoughtSignature?{thoughtSignature:e.thoughtSignature}:void 0;yield{type:`tool_use_start`,id:t,name:e.functionCall.name,...r?{metadata:r}:{}},yield{type:`tool_input_delta`,json:JSON.stringify(e.functionCall.args||{})},yield{type:`tool_use_end`}}}}yield{type:`message_meta`,stopReason:n?`tool_use`:t}}formatTools(t){return t.map(t=>({name:t.name,description:t.description,parameters:e(t.parameters)}))}formatMessages(e,t){let n=[];for(let t of e)if(t.role===`tool_result`){let e=t._toolResults;if(e&&e.length>0)n.push({role:`user`,parts:e.map(e=>({functionResponse:{name:e.toolName||e.toolUseId,response:{content:e.content,isError:e.isError||!1}}}))});else{let e=typeof t.content==`string`?t.content:JSON.stringify(t.content);e&&n.push({role:`user`,parts:[{text:e}]})}}else if(t.role===`user`){let e=typeof t.content==`string`?t.content:JSON.stringify(t.content);n.push({role:`user`,parts:[{text:e}]})}else if(t.role===`assistant`)if(typeof t.content==`string`)n.push({role:`model`,parts:[{text:t.content}]});else{let e=t.content,r=[];for(let t of e)if(t.type===`text`&&t.text)r.push({text:t.text});else if(t.type===`tool_use`){let e={functionCall:{name:t.name,args:t.input||{}}};t.metadata?.thoughtSignature&&(e.thoughtSignature=t.metadata.thoughtSignature),r.push(e)}r.length>0&&n.push({role:`model`,parts:r})}return{messages:n}}formatToolResults(e){return{role:`tool_result`,content:e.map(e=>`${e.toolName||e.toolUseId}: ${e.content}`).join(`
|
|
2
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=t;
|