drizzle-cube 0.3.13 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.d.ts +8 -1
- package/dist/adapters/express/index.js +162 -99
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.d.ts +8 -1
- package/dist/adapters/fastify/index.js +183 -96
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.ts +8 -1
- package/dist/adapters/hono/index.js +198 -142
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +29 -1
- package/dist/adapters/nextjs/index.js +251 -132
- package/dist/adapters/utils.d.ts +100 -1
- package/dist/adapters/validation-Bgauxvm6.cjs +214 -0
- package/dist/adapters/{compiler-DTOU8IsK.js → validation-_UkKJ2pC.js} +9582 -5295
- package/dist/client/adapters/index.d.ts +2 -0
- package/dist/client/adapters/retentionModeAdapter.d.ts +3 -0
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js +256 -0
- package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js.map +1 -0
- package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js +47 -0
- package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap-Bofadstm.js +178 -0
- package/dist/client/chunks/RetentionHeatmap-Bofadstm.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js +28 -0
- package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js.map +1 -0
- package/dist/client/chunks/analysis-builder-APeCxkEH.js +6939 -0
- package/dist/client/chunks/analysis-builder-APeCxkEH.js.map +1 -0
- package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js +2779 -0
- package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js → chart-activity-grid-BnweuBvr.js} +11 -11
- package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js.map → chart-activity-grid-BnweuBvr.js.map} +1 -1
- package/dist/client/chunks/{chart-area-cPrJnhLj.js → chart-area-DLmXFWWy.js} +2 -2
- package/dist/client/chunks/{chart-area-cPrJnhLj.js.map → chart-area-DLmXFWWy.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-D68HFPpa.js → chart-bar-7y0-F27Q.js} +2 -2
- package/dist/client/chunks/{chart-bar-D68HFPpa.js.map → chart-bar-7y0-F27Q.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-CquyYfNO.js → chart-bubble-3jYKCA2B.js} +2 -2
- package/dist/client/chunks/{chart-bubble-CquyYfNO.js.map → chart-bubble-3jYKCA2B.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js → chart-config-activity-grid-BBSNCbkb.js} +2 -2
- package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js.map → chart-config-activity-grid-BBSNCbkb.js.map} +1 -1
- package/dist/client/chunks/{chart-config-area-OApsRaYC.js → chart-config-area-CyyJOO2T.js} +2 -2
- package/dist/client/chunks/{chart-config-area-OApsRaYC.js.map → chart-config-area-CyyJOO2T.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js → chart-config-bar-BJKGnfLt.js} +2 -2
- package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js.map → chart-config-bar-BJKGnfLt.js.map} +1 -1
- package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js → chart-config-bubble-CuSsCHZ4.js} +2 -2
- package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js.map → chart-config-bubble-CuSsCHZ4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js → chart-config-data-table-BhgqwoqT.js} +2 -2
- package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js.map → chart-config-data-table-BhgqwoqT.js.map} +1 -1
- package/dist/client/chunks/{chart-config-funnel-f17Livgr.js → chart-config-funnel-BlSQYng0.js} +4 -4
- package/dist/client/chunks/{chart-config-funnel-f17Livgr.js.map → chart-config-funnel-BlSQYng0.js.map} +1 -1
- package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js → chart-config-heat-map-DHQGFZhX.js} +2 -2
- package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js.map → chart-config-heat-map-DHQGFZhX.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js → chart-config-kpi-delta-yTA5ug_l.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js.map → chart-config-kpi-delta-yTA5ug_l.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js → chart-config-kpi-number-nVAwDXzq.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js.map → chart-config-kpi-number-nVAwDXzq.js.map} +1 -1
- package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js → chart-config-kpi-text-DZjqsx-b.js} +2 -2
- package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js.map → chart-config-kpi-text-DZjqsx-b.js.map} +1 -1
- package/dist/client/chunks/{chart-config-line-BnLlRUQE.js → chart-config-line-DR0ThxZy.js} +2 -2
- package/dist/client/chunks/{chart-config-line-BnLlRUQE.js.map → chart-config-line-DR0ThxZy.js.map} +1 -1
- package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js → chart-config-markdown-DZxdGNVQ.js} +2 -2
- package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js.map → chart-config-markdown-DZxdGNVQ.js.map} +1 -1
- package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js → chart-config-pie-BM5lgH-w.js} +2 -2
- package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js.map → chart-config-pie-BM5lgH-w.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radar-CXa0354h.js → chart-config-radar-BBAVIF0S.js} +2 -2
- package/dist/client/chunks/{chart-config-radar-CXa0354h.js.map → chart-config-radar-BBAVIF0S.js.map} +1 -1
- package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js → chart-config-radial-bar-CTwjDRnB.js} +2 -2
- package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js.map → chart-config-radial-bar-CTwjDRnB.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js → chart-config-sankey-CNAgsMQ4.js} +2 -2
- package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js.map → chart-config-sankey-CNAgsMQ4.js.map} +1 -1
- package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js → chart-config-scatter-CWvN2E-X.js} +2 -2
- package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js.map → chart-config-scatter-CWvN2E-X.js.map} +1 -1
- package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js → chart-config-sunburst-W_SKwaj0.js} +4 -4
- package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js.map → chart-config-sunburst-W_SKwaj0.js.map} +1 -1
- package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js → chart-config-tree-map-CLmRvvMR.js} +2 -2
- package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js.map → chart-config-tree-map-CLmRvvMR.js.map} +1 -1
- package/dist/client/chunks/{chart-data-table-D4WDqbM0.js → chart-data-table-rUFLqysu.js} +4 -4
- package/dist/client/chunks/{chart-data-table-D4WDqbM0.js.map → chart-data-table-rUFLqysu.js.map} +1 -1
- package/dist/client/chunks/{chart-funnel-Csdn4FbN.js → chart-funnel-C7zGBfSw.js} +2 -2
- package/dist/client/chunks/{chart-funnel-Csdn4FbN.js.map → chart-funnel-C7zGBfSw.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-v1afxnjq.js → chart-heat-map-B-l8hK8b.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-v1afxnjq.js.map → chart-heat-map-B-l8hK8b.js.map} +1 -1
- package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js +351 -0
- package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js.map +1 -0
- package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js +473 -0
- package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js.map +1 -0
- package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js → chart-kpi-text-BLQ_CWQP.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js.map → chart-kpi-text-BLQ_CWQP.js.map} +1 -1
- package/dist/client/chunks/{chart-line-DqqE7ky9.js → chart-line-FSEpBk6Y.js} +5 -5
- package/dist/client/chunks/{chart-line-DqqE7ky9.js.map → chart-line-FSEpBk6Y.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-B5WBzIRH.js → chart-pie-BRQEH9e-.js} +2 -2
- package/dist/client/chunks/{chart-pie-B5WBzIRH.js.map → chart-pie-BRQEH9e-.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-DL_dvhA-.js → chart-radar-DgsFyiIP.js} +2 -2
- package/dist/client/chunks/{chart-radar-DL_dvhA-.js.map → chart-radar-DgsFyiIP.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js → chart-radial-bar-CUMoXyl9.js} +2 -2
- package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js.map → chart-radial-bar-CUMoXyl9.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-C_bgIfg-.js → chart-sankey-IAKDEe7A.js} +2 -2
- package/dist/client/chunks/{chart-sankey-C_bgIfg-.js.map → chart-sankey-IAKDEe7A.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DjmJRlK0.js → chart-scatter-D6XwOD2W.js} +15 -15
- package/dist/client/chunks/{chart-scatter-DjmJRlK0.js.map → chart-scatter-D6XwOD2W.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-CbMEnaes.js → chart-sunburst-CP_pnj0S.js} +2 -2
- package/dist/client/chunks/{chart-sunburst-CbMEnaes.js.map → chart-sunburst-CP_pnj0S.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js → chart-tree-map-DQMsn47a.js} +30 -30
- package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js.map → chart-tree-map-DQMsn47a.js.map} +1 -1
- package/dist/client/chunks/chartConfigRegistry-BumUIPw4.js +44 -0
- package/dist/client/chunks/{chartConfigRegistry-CiOq-PqX.js.map → chartConfigRegistry-BumUIPw4.js.map} +1 -1
- package/dist/client/chunks/charts-Dk_9XrA7.js +230 -0
- package/dist/client/chunks/charts-Dk_9XrA7.js.map +1 -0
- package/dist/client/chunks/{charts-core-CXrhEEVF.js → charts-core-CjQZBxmv.js} +10 -10
- package/dist/client/chunks/{charts-core-CXrhEEVF.js.map → charts-core-CjQZBxmv.js.map} +1 -1
- package/dist/client/chunks/{charts-loader-BtsnUO4Q.js → charts-loader-ChTUa_-G.js} +30 -28
- package/dist/client/chunks/charts-loader-ChTUa_-G.js.map +1 -0
- package/dist/client/chunks/{components-BDrlf9Er.js → components-BKZ7EAg0.js} +3575 -3208
- package/dist/client/chunks/components-BKZ7EAg0.js.map +1 -0
- package/dist/client/chunks/{core-B8zw0qRf.js → core-BRC075EG.js} +2 -2
- package/dist/client/chunks/{core-B8zw0qRf.js.map → core-BRC075EG.js.map} +1 -1
- package/dist/client/chunks/hooks-D7APQ8uS.js +150 -0
- package/dist/client/chunks/{hooks-B8Zw5PfL.js.map → hooks-D7APQ8uS.js.map} +1 -1
- package/dist/client/chunks/{icons-NzFHtqeM.js → icons-DRreo6m8.js} +128 -112
- package/dist/client/chunks/{icons-NzFHtqeM.js.map → icons-DRreo6m8.js.map} +1 -1
- package/dist/client/chunks/{providers-CqCiJTEj.js → providers-Cj7PQfXn.js} +2 -2
- package/dist/client/chunks/{providers-CqCiJTEj.js.map → providers-Cj7PQfXn.js.map} +1 -1
- package/dist/client/chunks/retention-CzCo8262.js +120 -0
- package/dist/client/chunks/retention-CzCo8262.js.map +1 -0
- package/dist/client/chunks/{useDirtyStateTracking-C_mitVwh.js → useDirtyStateTracking-ZSi3voVl.js} +101 -99
- package/dist/client/chunks/useDirtyStateTracking-ZSi3voVl.js.map +1 -0
- package/dist/client/chunks/{vendor-DzzxS7Ay.js → vendor-cTQhZ_G3.js} +549 -541
- package/dist/client/chunks/vendor-cTQhZ_G3.js.map +1 -0
- package/dist/client/components/AnalysisBuilder/AnalysisTypeSelector.d.ts +3 -1
- package/dist/client/components/AnalysisBuilder/RetentionConfigPanel.d.ts +36 -0
- package/dist/client/components/AnalysisBuilder/RetentionModeContent.d.ts +71 -0
- package/dist/client/components/AnalysisBuilder/types.d.ts +99 -0
- package/dist/client/components/DebugModal.d.ts +2 -1
- package/dist/client/components/charts/RetentionCombinedChart.config.d.ts +2 -0
- package/dist/client/components/charts/RetentionCombinedChart.d.ts +14 -0
- package/dist/client/components/charts/RetentionHeatmap.config.d.ts +2 -0
- package/dist/client/components/charts/RetentionHeatmap.d.ts +7 -0
- package/dist/client/components.js +2 -2
- package/dist/client/hooks/queries/index.d.ts +2 -1
- package/dist/client/hooks/queries/useDryRunQuery.d.ts +26 -0
- package/dist/client/hooks/queries/useExplainQuery.d.ts +3 -1
- package/dist/client/hooks/queries/useFlowQuery.d.ts +5 -0
- package/dist/client/hooks/queries/useRetentionQuery.d.ts +67 -0
- package/dist/client/hooks/useAnalysisBuilderHook.d.ts +61 -0
- package/dist/client/hooks/useAnalysisQueryExecution.d.ts +42 -1
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons/customIcons.d.ts +7 -0
- package/dist/client/icons/types.d.ts +1 -0
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +11 -11
- package/dist/client/providers.js +1 -1
- package/dist/client/stores/analysisBuilderStore.d.ts +86 -1
- package/dist/client/stores/dashboardStore.d.ts +2 -1
- package/dist/client/stores/slices/index.d.ts +2 -0
- package/dist/client/stores/slices/retentionSlice.d.ts +66 -0
- package/dist/client/styles.css +1 -1
- package/dist/client/types/analysisConfig.d.ts +29 -4
- package/dist/client/types/funnel.d.ts +5 -0
- package/dist/client/types/retention.d.ts +301 -0
- package/dist/client/types.d.ts +6 -3
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +101 -79
- package/dist/server/index.d.ts +427 -0
- package/dist/server/index.js +9140 -4934
- package/package.json +5 -2
- package/dist/adapters/compiler-CO13DaEb.cjs +0 -192
- package/dist/client/chunks/analysis-builder-Dc9NrG_N.js +0 -6013
- package/dist/client/chunks/analysis-builder-Dc9NrG_N.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js +0 -2540
- package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js.map +0 -1
- package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js +0 -435
- package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js.map +0 -1
- package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js +0 -392
- package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js.map +0 -1
- package/dist/client/chunks/chartConfigRegistry-CiOq-PqX.js +0 -44
- package/dist/client/chunks/charts-loader-BtsnUO4Q.js.map +0 -1
- package/dist/client/chunks/charts-xNubY0vm.js +0 -226
- package/dist/client/chunks/charts-xNubY0vm.js.map +0 -1
- package/dist/client/chunks/components-BDrlf9Er.js.map +0 -1
- package/dist/client/chunks/hooks-B8Zw5PfL.js +0 -123
- package/dist/client/chunks/useDirtyStateTracking-C_mitVwh.js.map +0 -1
- package/dist/client/chunks/vendor-DzzxS7Ay.js.map +0 -1
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { S as R,
|
|
2
|
-
const Q = function(
|
|
1
|
+
import { S as R, j as c, f as v, h as P, a as L, b as x, c as q, d as D, e as N, g as M, i as V } from "../validation-_UkKJ2pC.js";
|
|
2
|
+
const Q = function(o, w, h) {
|
|
3
3
|
const {
|
|
4
|
-
cubes:
|
|
4
|
+
cubes: b,
|
|
5
5
|
drizzle: C,
|
|
6
|
-
schema:
|
|
7
|
-
extractSecurityContext:
|
|
6
|
+
schema: j,
|
|
7
|
+
extractSecurityContext: d,
|
|
8
8
|
engineType: E,
|
|
9
|
-
cors:
|
|
10
|
-
basePath:
|
|
11
|
-
bodyLimit:
|
|
9
|
+
cors: f,
|
|
10
|
+
basePath: y = "/cubejs-api/v1",
|
|
11
|
+
bodyLimit: l = 10485760,
|
|
12
12
|
// 10MB
|
|
13
|
-
cache: S
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
cache: S,
|
|
14
|
+
mcp: m = { enabled: !0 }
|
|
15
|
+
} = w;
|
|
16
|
+
if (!b || b.length === 0)
|
|
17
|
+
return h(new Error("At least one cube must be provided in the cubes array"));
|
|
18
|
+
f && o.register(import("@fastify/cors"), f), o.addHook("onRequest", async (r, a) => {
|
|
18
19
|
r.method === "POST" && (r.body = void 0);
|
|
19
20
|
});
|
|
20
|
-
const
|
|
21
|
+
const n = new R({
|
|
21
22
|
drizzle: C,
|
|
22
|
-
schema:
|
|
23
|
+
schema: j,
|
|
23
24
|
engineType: E,
|
|
24
25
|
cache: S
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
bodyLimit:
|
|
27
|
+
if (b.forEach((r) => {
|
|
28
|
+
n.registerCube(r);
|
|
29
|
+
}), o.post(`${y}/load`, {
|
|
30
|
+
bodyLimit: l,
|
|
30
31
|
schema: {
|
|
31
32
|
body: {
|
|
32
33
|
type: "object",
|
|
33
34
|
additionalProperties: !0
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
}, async (r,
|
|
37
|
+
}, async (r, a) => {
|
|
37
38
|
try {
|
|
38
|
-
const e = r.body,
|
|
39
|
+
const e = r.body, s = e.query || e, t = await d(r), i = n.validateQuery(s);
|
|
39
40
|
if (!i.isValid)
|
|
40
|
-
return
|
|
41
|
+
return a.status(400).send(c(
|
|
41
42
|
`Query validation failed: ${i.errors.join(", ")}`,
|
|
42
43
|
400
|
|
43
44
|
));
|
|
44
|
-
const u = r.headers["x-cache-control"] === "no-cache",
|
|
45
|
-
return
|
|
45
|
+
const u = r.headers["x-cache-control"] === "no-cache", g = await n.executeMultiCubeQuery(s, t, { skipCache: u });
|
|
46
|
+
return v(s, g, n);
|
|
46
47
|
} catch (e) {
|
|
47
|
-
return r.log.error(e, "Query execution error"),
|
|
48
|
+
return r.log.error(e, "Query execution error"), a.status(500).send(c(
|
|
48
49
|
e instanceof Error ? e.message : "Query execution failed",
|
|
49
50
|
500
|
|
50
51
|
));
|
|
51
52
|
}
|
|
52
|
-
}),
|
|
53
|
+
}), o.get(`${y}/load`, {
|
|
53
54
|
schema: {
|
|
54
55
|
querystring: {
|
|
55
56
|
type: "object",
|
|
@@ -59,34 +60,34 @@ const Q = function(s, v, b) {
|
|
|
59
60
|
required: ["query"]
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
}, async (r,
|
|
63
|
+
}, async (r, a) => {
|
|
63
64
|
try {
|
|
64
65
|
const { query: e } = r.query;
|
|
65
|
-
let
|
|
66
|
+
let s;
|
|
66
67
|
try {
|
|
67
|
-
|
|
68
|
+
s = JSON.parse(e);
|
|
68
69
|
} catch {
|
|
69
|
-
return
|
|
70
|
+
return a.status(400).send(c(
|
|
70
71
|
"Invalid JSON in query parameter",
|
|
71
72
|
400
|
|
72
73
|
));
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
+
const t = await d(r), i = n.validateQuery(s);
|
|
75
76
|
if (!i.isValid)
|
|
76
|
-
return
|
|
77
|
+
return a.status(400).send(c(
|
|
77
78
|
`Query validation failed: ${i.errors.join(", ")}`,
|
|
78
79
|
400
|
|
79
80
|
));
|
|
80
|
-
const u = r.headers["x-cache-control"] === "no-cache",
|
|
81
|
-
return
|
|
81
|
+
const u = r.headers["x-cache-control"] === "no-cache", g = await n.executeMultiCubeQuery(s, t, { skipCache: u });
|
|
82
|
+
return v(s, g, n);
|
|
82
83
|
} catch (e) {
|
|
83
|
-
return r.log.error(e, "Query execution error"),
|
|
84
|
+
return r.log.error(e, "Query execution error"), a.status(500).send(c(
|
|
84
85
|
e instanceof Error ? e.message : "Query execution failed",
|
|
85
86
|
500
|
|
86
87
|
));
|
|
87
88
|
}
|
|
88
|
-
}),
|
|
89
|
-
bodyLimit:
|
|
89
|
+
}), o.post(`${y}/batch`, {
|
|
90
|
+
bodyLimit: l,
|
|
90
91
|
schema: {
|
|
91
92
|
body: {
|
|
92
93
|
type: "object",
|
|
@@ -99,68 +100,68 @@ const Q = function(s, v, b) {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
|
-
}, async (r,
|
|
103
|
+
}, async (r, a) => {
|
|
103
104
|
try {
|
|
104
105
|
const { queries: e } = r.body;
|
|
105
106
|
if (!e || !Array.isArray(e))
|
|
106
|
-
return
|
|
107
|
+
return a.status(400).send(c(
|
|
107
108
|
'Request body must contain a "queries" array',
|
|
108
109
|
400
|
|
109
110
|
));
|
|
110
111
|
if (e.length === 0)
|
|
111
|
-
return
|
|
112
|
+
return a.status(400).send(c(
|
|
112
113
|
"Queries array cannot be empty",
|
|
113
114
|
400
|
|
114
115
|
));
|
|
115
|
-
const
|
|
116
|
-
return await
|
|
116
|
+
const s = await d(r), t = r.headers["x-cache-control"] === "no-cache";
|
|
117
|
+
return await P(e, s, n, { skipCache: t });
|
|
117
118
|
} catch (e) {
|
|
118
|
-
return r.log.error(e, "Batch execution error"),
|
|
119
|
+
return r.log.error(e, "Batch execution error"), a.status(500).send(c(
|
|
119
120
|
e instanceof Error ? e.message : "Batch execution failed",
|
|
120
121
|
500
|
|
121
122
|
));
|
|
122
123
|
}
|
|
123
|
-
}),
|
|
124
|
+
}), o.get(`${y}/meta`, async (r, a) => {
|
|
124
125
|
try {
|
|
125
|
-
const e =
|
|
126
|
-
return
|
|
126
|
+
const e = n.getMetadata();
|
|
127
|
+
return L(e);
|
|
127
128
|
} catch (e) {
|
|
128
|
-
return r.log.error(e, "Metadata error"),
|
|
129
|
+
return r.log.error(e, "Metadata error"), a.status(500).send(c(
|
|
129
130
|
e instanceof Error ? e.message : "Failed to fetch metadata",
|
|
130
131
|
500
|
|
131
132
|
));
|
|
132
133
|
}
|
|
133
|
-
}),
|
|
134
|
-
bodyLimit:
|
|
134
|
+
}), o.post(`${y}/sql`, {
|
|
135
|
+
bodyLimit: l,
|
|
135
136
|
schema: {
|
|
136
137
|
body: {
|
|
137
138
|
type: "object",
|
|
138
139
|
additionalProperties: !0
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
}, async (r,
|
|
142
|
+
}, async (r, a) => {
|
|
142
143
|
try {
|
|
143
|
-
const e = r.body,
|
|
144
|
-
if (!
|
|
145
|
-
return
|
|
146
|
-
`Query validation failed: ${
|
|
144
|
+
const e = r.body, s = await d(r), t = n.validateQuery(e);
|
|
145
|
+
if (!t.isValid)
|
|
146
|
+
return a.status(400).send(c(
|
|
147
|
+
`Query validation failed: ${t.errors.join(", ")}`,
|
|
147
148
|
400
|
|
148
149
|
));
|
|
149
150
|
const i = e.measures?.[0] || e.dimensions?.[0];
|
|
150
151
|
if (!i)
|
|
151
|
-
return
|
|
152
|
+
return a.status(400).send(c(
|
|
152
153
|
"No measures or dimensions specified",
|
|
153
154
|
400
|
|
154
155
|
));
|
|
155
|
-
const u = i.split(".")[0],
|
|
156
|
-
return x(e,
|
|
156
|
+
const u = i.split(".")[0], g = await n.generateSQL(u, e, s);
|
|
157
|
+
return x(e, g);
|
|
157
158
|
} catch (e) {
|
|
158
|
-
return r.log.error(e, "SQL generation error"),
|
|
159
|
+
return r.log.error(e, "SQL generation error"), a.status(500).send(c(
|
|
159
160
|
e instanceof Error ? e.message : "SQL generation failed",
|
|
160
161
|
500
|
|
161
162
|
));
|
|
162
163
|
}
|
|
163
|
-
}),
|
|
164
|
+
}), o.get(`${y}/sql`, {
|
|
164
165
|
schema: {
|
|
165
166
|
querystring: {
|
|
166
167
|
type: "object",
|
|
@@ -170,47 +171,47 @@ const Q = function(s, v, b) {
|
|
|
170
171
|
required: ["query"]
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
}, async (r,
|
|
174
|
+
}, async (r, a) => {
|
|
174
175
|
try {
|
|
175
|
-
const { query: e } = r.query,
|
|
176
|
+
const { query: e } = r.query, s = JSON.parse(e), t = await d(r), i = n.validateQuery(s);
|
|
176
177
|
if (!i.isValid)
|
|
177
|
-
return
|
|
178
|
+
return a.status(400).send(c(
|
|
178
179
|
`Query validation failed: ${i.errors.join(", ")}`,
|
|
179
180
|
400
|
|
180
181
|
));
|
|
181
|
-
const u =
|
|
182
|
+
const u = s.measures?.[0] || s.dimensions?.[0];
|
|
182
183
|
if (!u)
|
|
183
|
-
return
|
|
184
|
+
return a.status(400).send(c(
|
|
184
185
|
"No measures or dimensions specified",
|
|
185
186
|
400
|
|
186
187
|
));
|
|
187
|
-
const
|
|
188
|
-
return x(
|
|
188
|
+
const g = u.split(".")[0], $ = await n.generateSQL(g, s, t);
|
|
189
|
+
return x(s, $);
|
|
189
190
|
} catch (e) {
|
|
190
|
-
return r.log.error(e, "SQL generation error"),
|
|
191
|
+
return r.log.error(e, "SQL generation error"), a.status(500).send(c(
|
|
191
192
|
e instanceof Error ? e.message : "SQL generation failed",
|
|
192
193
|
500
|
|
193
194
|
));
|
|
194
195
|
}
|
|
195
|
-
}),
|
|
196
|
-
bodyLimit:
|
|
196
|
+
}), o.post(`${y}/dry-run`, {
|
|
197
|
+
bodyLimit: l,
|
|
197
198
|
schema: {
|
|
198
199
|
body: {
|
|
199
200
|
type: "object",
|
|
200
201
|
additionalProperties: !0
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
}, async (r,
|
|
204
|
+
}, async (r, a) => {
|
|
204
205
|
try {
|
|
205
|
-
const e = r.body,
|
|
206
|
-
return await q(
|
|
206
|
+
const e = r.body, s = e.query || e, t = await d(r);
|
|
207
|
+
return await q(s, t, n);
|
|
207
208
|
} catch (e) {
|
|
208
|
-
return r.log.error(e, "Dry-run error"),
|
|
209
|
+
return r.log.error(e, "Dry-run error"), a.status(400).send({
|
|
209
210
|
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
210
211
|
valid: !1
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
|
-
}),
|
|
214
|
+
}), o.get(`${y}/dry-run`, {
|
|
214
215
|
schema: {
|
|
215
216
|
querystring: {
|
|
216
217
|
type: "object",
|
|
@@ -220,52 +221,138 @@ const Q = function(s, v, b) {
|
|
|
220
221
|
required: ["query"]
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
}, async (r,
|
|
224
|
+
}, async (r, a) => {
|
|
224
225
|
try {
|
|
225
|
-
const { query: e } = r.query,
|
|
226
|
-
return await q(
|
|
226
|
+
const { query: e } = r.query, s = JSON.parse(e), t = await d(r);
|
|
227
|
+
return await q(s, t, n);
|
|
227
228
|
} catch (e) {
|
|
228
|
-
return r.log.error(e, "Dry-run error"),
|
|
229
|
+
return r.log.error(e, "Dry-run error"), a.status(400).send({
|
|
229
230
|
error: e instanceof Error ? e.message : "Dry-run validation failed",
|
|
230
231
|
valid: !1
|
|
231
232
|
});
|
|
232
233
|
}
|
|
233
|
-
}),
|
|
234
|
-
bodyLimit:
|
|
234
|
+
}), o.post(`${y}/explain`, {
|
|
235
|
+
bodyLimit: l,
|
|
235
236
|
schema: {
|
|
236
237
|
body: {
|
|
237
238
|
type: "object",
|
|
238
239
|
additionalProperties: !0
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
}, async (r,
|
|
242
|
+
}, async (r, a) => {
|
|
242
243
|
try {
|
|
243
|
-
const e = r.body,
|
|
244
|
-
return u.isValid ? await
|
|
244
|
+
const e = r.body, s = e.query || e, t = e.options || {}, i = await d(r), u = n.validateQuery(s);
|
|
245
|
+
return u.isValid ? await n.explainQuery(s, i, t) : a.status(400).send({
|
|
245
246
|
error: `Query validation failed: ${u.errors.join(", ")}`
|
|
246
247
|
});
|
|
247
248
|
} catch (e) {
|
|
248
|
-
return r.log.error(e, "Explain error"),
|
|
249
|
+
return r.log.error(e, "Explain error"), a.status(500).send({
|
|
249
250
|
error: e instanceof Error ? e.message : "Explain query failed"
|
|
250
251
|
});
|
|
251
252
|
}
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
}), m.enabled !== !1) {
|
|
254
|
+
const r = m.tools || ["discover", "suggest", "validate", "load"], a = m.basePath ?? "/mcp";
|
|
255
|
+
r.includes("discover") && o.post(`${a}/discover`, {
|
|
256
|
+
bodyLimit: l,
|
|
257
|
+
schema: {
|
|
258
|
+
body: {
|
|
259
|
+
type: "object",
|
|
260
|
+
additionalProperties: !0
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}, async (e, s) => {
|
|
264
|
+
try {
|
|
265
|
+
const t = e.body;
|
|
266
|
+
return await D(n, t);
|
|
267
|
+
} catch (t) {
|
|
268
|
+
return e.log.error(t, "Discover error"), s.status(500).send(c(
|
|
269
|
+
t instanceof Error ? t.message : "Discovery failed",
|
|
270
|
+
500
|
|
271
|
+
));
|
|
272
|
+
}
|
|
273
|
+
}), r.includes("suggest") && o.post(`${a}/suggest`, {
|
|
274
|
+
bodyLimit: l,
|
|
275
|
+
schema: {
|
|
276
|
+
body: {
|
|
277
|
+
type: "object",
|
|
278
|
+
required: ["naturalLanguage"],
|
|
279
|
+
properties: {
|
|
280
|
+
naturalLanguage: { type: "string" },
|
|
281
|
+
cube: { type: "string" }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, async (e, s) => {
|
|
286
|
+
try {
|
|
287
|
+
const t = e.body;
|
|
288
|
+
return await N(n, t);
|
|
289
|
+
} catch (t) {
|
|
290
|
+
return e.log.error(t, "Suggest error"), s.status(500).send(c(
|
|
291
|
+
t instanceof Error ? t.message : "Query suggestion failed",
|
|
292
|
+
500
|
|
293
|
+
));
|
|
294
|
+
}
|
|
295
|
+
}), r.includes("validate") && o.post(`${a}/validate`, {
|
|
296
|
+
bodyLimit: l,
|
|
297
|
+
schema: {
|
|
298
|
+
body: {
|
|
299
|
+
type: "object",
|
|
300
|
+
required: ["query"],
|
|
301
|
+
properties: {
|
|
302
|
+
query: { type: "object" }
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, async (e, s) => {
|
|
307
|
+
try {
|
|
308
|
+
const t = e.body;
|
|
309
|
+
return await M(n, t);
|
|
310
|
+
} catch (t) {
|
|
311
|
+
return e.log.error(t, "Validate error"), s.status(500).send(c(
|
|
312
|
+
t instanceof Error ? t.message : "Query validation failed",
|
|
313
|
+
500
|
|
314
|
+
));
|
|
315
|
+
}
|
|
316
|
+
}), r.includes("load") && o.post(`${a}/load`, {
|
|
317
|
+
bodyLimit: l,
|
|
318
|
+
schema: {
|
|
319
|
+
body: {
|
|
320
|
+
type: "object",
|
|
321
|
+
required: ["query"],
|
|
322
|
+
properties: {
|
|
323
|
+
query: { type: "object" }
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, async (e, s) => {
|
|
328
|
+
try {
|
|
329
|
+
const t = e.body, i = await d(e);
|
|
330
|
+
return await V(n, i, t);
|
|
331
|
+
} catch (t) {
|
|
332
|
+
return e.log.error(t, "Load error"), s.status(500).send(c(
|
|
333
|
+
t instanceof Error ? t.message : "Query execution failed",
|
|
334
|
+
500
|
|
335
|
+
));
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
o.setErrorHandler(async (r, a, e) => {
|
|
340
|
+
a.log.error(r, "Fastify cube adapter error"), e.statusCode < 400 && e.status(500);
|
|
341
|
+
const s = r instanceof Error ? r : String(r);
|
|
342
|
+
return c(s, e.statusCode);
|
|
343
|
+
}), h();
|
|
257
344
|
};
|
|
258
|
-
async function
|
|
259
|
-
await p.register(Q,
|
|
345
|
+
async function O(p, o) {
|
|
346
|
+
await p.register(Q, o);
|
|
260
347
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
348
|
+
function k(p) {
|
|
349
|
+
const o = require("fastify")({
|
|
263
350
|
logger: !0
|
|
264
351
|
});
|
|
265
|
-
return
|
|
352
|
+
return o.register(Q, p), o;
|
|
266
353
|
}
|
|
267
354
|
export {
|
|
268
|
-
|
|
355
|
+
k as createCubeApp,
|
|
269
356
|
Q as cubePlugin,
|
|
270
|
-
|
|
357
|
+
O as registerCubeRoutes
|
|
271
358
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("hono"),d=require("../validation-Bgauxvm6.cjs");var b=j=>{const c={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...j},p=(u=>typeof u=="string"?u==="*"?()=>u:a=>u===a?a:null:typeof u=="function"?u:a=>u.includes(a)?a:null)(c.origin),y=(u=>typeof u=="function"?u:Array.isArray(u)?()=>u:()=>[])(c.allowMethods);return async function(a,f){function h(i,n){a.res.headers.set(i,n)}const m=await p(a.req.header("origin")||"",a);if(m&&h("Access-Control-Allow-Origin",m),c.credentials&&h("Access-Control-Allow-Credentials","true"),c.exposeHeaders?.length&&h("Access-Control-Expose-Headers",c.exposeHeaders.join(",")),a.req.method==="OPTIONS"){c.origin!=="*"&&h("Vary","Origin"),c.maxAge!=null&&h("Access-Control-Max-Age",c.maxAge.toString());const i=await y(a.req.header("origin")||"",a);i.length&&h("Access-Control-Allow-Methods",i.join(","));let n=c.allowHeaders;if(!n?.length){const r=a.req.header("Access-Control-Request-Headers");r&&(n=r.split(/\s*,\s*/))}return n?.length&&(h("Access-Control-Allow-Headers",n.join(",")),a.res.headers.append("Vary","Access-Control-Request-Headers")),a.res.headers.delete("Content-Length"),a.res.headers.delete("Content-Type"),new Response(null,{headers:a.res.headers,status:204,statusText:"No Content"})}await f(),c.origin!=="*"&&a.header("Vary","Origin",{append:!0})}};function C(j){const{cubes:g,drizzle:c,schema:p,extractSecurityContext:y,engineType:u,cors:a,basePath:f="/cubejs-api/v1",cache:h,mcp:m={enabled:!0}}=j;if(!g||g.length===0)throw new Error("At least one cube must be provided in the cubes array");const i=new w.Hono;a&&i.use("/*",b(a));const n=new d.SemanticLayerCompiler({drizzle:c,schema:p,engineType:u,cache:h});if(g.forEach(r=>{n.registerCube(r)}),i.post(`${f}/load`,async r=>{try{const e=await r.req.json(),o=e.query||e,t=await y(r),s=n.validateQuery(o);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const l=r.req.header("x-cache-control")==="no-cache",q=await n.executeMultiCubeQuery(o,t,{skipCache:l});return r.json(d.formatCubeResponse(o,q,n))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),i.get(`${f}/load`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);let o;try{o=JSON.parse(e)}catch{return r.json({error:"Invalid JSON in query parameter"},400)}const t=await y(r),s=n.validateQuery(o);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const l=r.req.header("x-cache-control")==="no-cache",q=await n.executeMultiCubeQuery(o,t,{skipCache:l});return r.json(d.formatCubeResponse(o,q,n))}catch(e){return console.error("Query execution error:",e),r.json({error:e instanceof Error?e.message:"Query execution failed"},500)}}),i.post(`${f}/batch`,async r=>{try{const e=await r.req.json(),{queries:o}=e;if(!o||!Array.isArray(o))return r.json({error:'Request body must contain a "queries" array'},400);if(o.length===0)return r.json({error:"Queries array cannot be empty"},400);const t=await y(r),s=r.req.header("x-cache-control")==="no-cache",l=await d.handleBatchRequest(o,t,n,{skipCache:s});return r.json(l)}catch(e){return console.error("Batch execution error:",e),r.json({error:e instanceof Error?e.message:"Batch execution failed"},500)}}),i.get(`${f}/meta`,r=>{try{const e=n.getMetadata();return r.json(d.formatMetaResponse(e))}catch(e){return console.error("Metadata error:",e),r.json({error:e instanceof Error?e.message:"Failed to fetch metadata"},500)}}),i.post(`${f}/sql`,async r=>{try{const e=await r.req.json(),o=await y(r),t=n.validateQuery(e);if(!t.isValid)return r.json({error:`Query validation failed: ${t.errors.join(", ")}`},400);const s=e.measures?.[0]||e.dimensions?.[0];if(!s)return r.json({error:"No measures or dimensions specified"},400);const l=s.split(".")[0],q=await n.generateSQL(l,e,o);return r.json(d.formatSqlResponse(e,q))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),i.get(`${f}/sql`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required"},400);const o=JSON.parse(e),t=await y(r),s=n.validateQuery(o);if(!s.isValid)return r.json({error:`Query validation failed: ${s.errors.join(", ")}`},400);const l=o.measures?.[0]||o.dimensions?.[0];if(!l)return r.json({error:"No measures or dimensions specified"},400);const q=l.split(".")[0],x=await n.generateSQL(q,o,t);return r.json(d.formatSqlResponse(o,x))}catch(e){return console.error("SQL generation error:",e),r.json({error:e instanceof Error?e.message:"SQL generation failed"},500)}}),i.post(`${f}/dry-run`,async r=>{try{const e=await r.req.json(),o=e.query||e,t=await y(r),s=await d.handleDryRun(o,t,n);return r.json(s)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),i.get(`${f}/dry-run`,async r=>{try{const e=r.req.query("query");if(!e)return r.json({error:"Query parameter is required",valid:!1},400);const o=JSON.parse(e),t=await y(r),s=await d.handleDryRun(o,t,n);return r.json(s)}catch(e){return console.error("Dry-run error:",e),r.json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1},400)}}),i.post(`${f}/explain`,async r=>{try{const e=await r.req.json(),o=e.query||e,t=e.options||{},s=await y(r),l=n.validateQuery(o);if(!l.isValid)return r.json({error:`Query validation failed: ${l.errors.join(", ")}`},400);const q=await n.explainQuery(o,s,t);return r.json(q)}catch(e){return console.error("Explain error:",e),r.json({error:e instanceof Error?e.message:"Explain query failed"},500)}}),m.enabled!==!1){const r=m.tools||["discover","suggest","validate","load"],e=m.basePath??"/mcp";r.includes("discover")&&i.post(`${e}/discover`,async o=>{try{const t=await o.req.json(),s=await d.handleDiscover(n,t);return o.json(s)}catch(t){return console.error("Discover error:",t),o.json({error:t instanceof Error?t.message:"Discovery failed"},500)}}),r.includes("suggest")&&i.post(`${e}/suggest`,async o=>{try{const t=await o.req.json();if(!t.naturalLanguage)return o.json({error:"naturalLanguage field is required"},400);const s=await d.handleSuggest(n,t);return o.json(s)}catch(t){return console.error("Suggest error:",t),o.json({error:t instanceof Error?t.message:"Query suggestion failed"},500)}}),r.includes("validate")&&i.post(`${e}/validate`,async o=>{try{const t=await o.req.json();if(!t.query)return o.json({error:"query field is required"},400);const s=await d.handleValidate(n,t);return o.json(s)}catch(t){return console.error("Validate error:",t),o.json({error:t instanceof Error?t.message:"Query validation failed"},500)}}),r.includes("load")&&i.post(`${e}/load`,async o=>{try{const t=await o.req.json();if(!t.query)return o.json({error:"query field is required"},400);const s=await y(o),l=await d.handleLoad(n,s,t);return o.json(l)}catch(t){return console.error("Load error:",t),o.json({error:t instanceof Error?t.message:"Query execution failed"},500)}})}return i}function v(j,g){const c=C(g);return j.route("/",c),j}function Q(j){const g=new w.Hono;return v(g,j)}exports.createCubeApp=Q;exports.createCubeRoutes=C;exports.mountCubeRoutes=v;
|
|
@@ -3,6 +3,7 @@ import { SemanticQuery, SecurityContext, DatabaseExecutor, DrizzleDatabase, Cube
|
|
|
3
3
|
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
4
4
|
import { MySql2Database } from 'drizzle-orm/mysql2';
|
|
5
5
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
6
|
+
import { MCPOptions } from '../utils';
|
|
6
7
|
export interface HonoAdapterOptions {
|
|
7
8
|
/**
|
|
8
9
|
* Array of cube definitions to register
|
|
@@ -46,7 +47,7 @@ export interface HonoAdapterOptions {
|
|
|
46
47
|
/**
|
|
47
48
|
* Database engine type (optional - auto-detected if not provided)
|
|
48
49
|
*/
|
|
49
|
-
engineType?: 'postgres' | 'mysql' | 'sqlite';
|
|
50
|
+
engineType?: 'postgres' | 'mysql' | 'sqlite' | 'singlestore' | 'duckdb';
|
|
50
51
|
/**
|
|
51
52
|
* CORS configuration (optional)
|
|
52
53
|
*/
|
|
@@ -65,6 +66,12 @@ export interface HonoAdapterOptions {
|
|
|
65
66
|
* When provided, query results will be cached using the specified provider
|
|
66
67
|
*/
|
|
67
68
|
cache?: CacheConfig;
|
|
69
|
+
/**
|
|
70
|
+
* MCP (AI-Ready) endpoint configuration
|
|
71
|
+
* Enables AI agents to discover and query your data
|
|
72
|
+
* @default { enabled: true }
|
|
73
|
+
*/
|
|
74
|
+
mcp?: MCPOptions;
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
70
77
|
* Create Hono routes for Cube.js-compatible API
|