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.
Files changed (182) hide show
  1. package/dist/adapters/express/index.cjs +1 -1
  2. package/dist/adapters/express/index.d.ts +8 -1
  3. package/dist/adapters/express/index.js +162 -99
  4. package/dist/adapters/fastify/index.cjs +1 -1
  5. package/dist/adapters/fastify/index.d.ts +8 -1
  6. package/dist/adapters/fastify/index.js +183 -96
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.d.ts +8 -1
  9. package/dist/adapters/hono/index.js +198 -142
  10. package/dist/adapters/nextjs/index.cjs +1 -1
  11. package/dist/adapters/nextjs/index.d.ts +29 -1
  12. package/dist/adapters/nextjs/index.js +251 -132
  13. package/dist/adapters/utils.d.ts +100 -1
  14. package/dist/adapters/validation-Bgauxvm6.cjs +214 -0
  15. package/dist/adapters/{compiler-DTOU8IsK.js → validation-_UkKJ2pC.js} +9582 -5295
  16. package/dist/client/adapters/index.d.ts +2 -0
  17. package/dist/client/adapters/retentionModeAdapter.d.ts +3 -0
  18. package/dist/client/charts.js +12 -12
  19. package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js +256 -0
  20. package/dist/client/chunks/RetentionCombinedChart-DirfDaZH.js.map +1 -0
  21. package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js +47 -0
  22. package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js.map +1 -0
  23. package/dist/client/chunks/RetentionHeatmap-Bofadstm.js +178 -0
  24. package/dist/client/chunks/RetentionHeatmap-Bofadstm.js.map +1 -0
  25. package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js +28 -0
  26. package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js.map +1 -0
  27. package/dist/client/chunks/analysis-builder-APeCxkEH.js +6939 -0
  28. package/dist/client/chunks/analysis-builder-APeCxkEH.js.map +1 -0
  29. package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js +2779 -0
  30. package/dist/client/chunks/analysis-builder-shared-DEovRjrp.js.map +1 -0
  31. package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js → chart-activity-grid-BnweuBvr.js} +11 -11
  32. package/dist/client/chunks/{chart-activity-grid-CuPARsr1.js.map → chart-activity-grid-BnweuBvr.js.map} +1 -1
  33. package/dist/client/chunks/{chart-area-cPrJnhLj.js → chart-area-DLmXFWWy.js} +2 -2
  34. package/dist/client/chunks/{chart-area-cPrJnhLj.js.map → chart-area-DLmXFWWy.js.map} +1 -1
  35. package/dist/client/chunks/{chart-bar-D68HFPpa.js → chart-bar-7y0-F27Q.js} +2 -2
  36. package/dist/client/chunks/{chart-bar-D68HFPpa.js.map → chart-bar-7y0-F27Q.js.map} +1 -1
  37. package/dist/client/chunks/{chart-bubble-CquyYfNO.js → chart-bubble-3jYKCA2B.js} +2 -2
  38. package/dist/client/chunks/{chart-bubble-CquyYfNO.js.map → chart-bubble-3jYKCA2B.js.map} +1 -1
  39. package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js → chart-config-activity-grid-BBSNCbkb.js} +2 -2
  40. package/dist/client/chunks/{chart-config-activity-grid-Bkvx0F-G.js.map → chart-config-activity-grid-BBSNCbkb.js.map} +1 -1
  41. package/dist/client/chunks/{chart-config-area-OApsRaYC.js → chart-config-area-CyyJOO2T.js} +2 -2
  42. package/dist/client/chunks/{chart-config-area-OApsRaYC.js.map → chart-config-area-CyyJOO2T.js.map} +1 -1
  43. package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js → chart-config-bar-BJKGnfLt.js} +2 -2
  44. package/dist/client/chunks/{chart-config-bar-Dy21oaIA.js.map → chart-config-bar-BJKGnfLt.js.map} +1 -1
  45. package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js → chart-config-bubble-CuSsCHZ4.js} +2 -2
  46. package/dist/client/chunks/{chart-config-bubble-Chv0SoFm.js.map → chart-config-bubble-CuSsCHZ4.js.map} +1 -1
  47. package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js → chart-config-data-table-BhgqwoqT.js} +2 -2
  48. package/dist/client/chunks/{chart-config-data-table-DTIdC35a.js.map → chart-config-data-table-BhgqwoqT.js.map} +1 -1
  49. package/dist/client/chunks/{chart-config-funnel-f17Livgr.js → chart-config-funnel-BlSQYng0.js} +4 -4
  50. package/dist/client/chunks/{chart-config-funnel-f17Livgr.js.map → chart-config-funnel-BlSQYng0.js.map} +1 -1
  51. package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js → chart-config-heat-map-DHQGFZhX.js} +2 -2
  52. package/dist/client/chunks/{chart-config-heat-map-DPhNICha.js.map → chart-config-heat-map-DHQGFZhX.js.map} +1 -1
  53. package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js → chart-config-kpi-delta-yTA5ug_l.js} +2 -2
  54. package/dist/client/chunks/{chart-config-kpi-delta-CCl1d-St.js.map → chart-config-kpi-delta-yTA5ug_l.js.map} +1 -1
  55. package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js → chart-config-kpi-number-nVAwDXzq.js} +2 -2
  56. package/dist/client/chunks/{chart-config-kpi-number-DkE3eSwH.js.map → chart-config-kpi-number-nVAwDXzq.js.map} +1 -1
  57. package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js → chart-config-kpi-text-DZjqsx-b.js} +2 -2
  58. package/dist/client/chunks/{chart-config-kpi-text-BMbgdxZm.js.map → chart-config-kpi-text-DZjqsx-b.js.map} +1 -1
  59. package/dist/client/chunks/{chart-config-line-BnLlRUQE.js → chart-config-line-DR0ThxZy.js} +2 -2
  60. package/dist/client/chunks/{chart-config-line-BnLlRUQE.js.map → chart-config-line-DR0ThxZy.js.map} +1 -1
  61. package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js → chart-config-markdown-DZxdGNVQ.js} +2 -2
  62. package/dist/client/chunks/{chart-config-markdown-DIaMFC0Z.js.map → chart-config-markdown-DZxdGNVQ.js.map} +1 -1
  63. package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js → chart-config-pie-BM5lgH-w.js} +2 -2
  64. package/dist/client/chunks/{chart-config-pie-O9y_T0BQ.js.map → chart-config-pie-BM5lgH-w.js.map} +1 -1
  65. package/dist/client/chunks/{chart-config-radar-CXa0354h.js → chart-config-radar-BBAVIF0S.js} +2 -2
  66. package/dist/client/chunks/{chart-config-radar-CXa0354h.js.map → chart-config-radar-BBAVIF0S.js.map} +1 -1
  67. package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js → chart-config-radial-bar-CTwjDRnB.js} +2 -2
  68. package/dist/client/chunks/{chart-config-radial-bar-BppJU8-Q.js.map → chart-config-radial-bar-CTwjDRnB.js.map} +1 -1
  69. package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js → chart-config-sankey-CNAgsMQ4.js} +2 -2
  70. package/dist/client/chunks/{chart-config-sankey-BfBHgL4x.js.map → chart-config-sankey-CNAgsMQ4.js.map} +1 -1
  71. package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js → chart-config-scatter-CWvN2E-X.js} +2 -2
  72. package/dist/client/chunks/{chart-config-scatter-BTt8a10R.js.map → chart-config-scatter-CWvN2E-X.js.map} +1 -1
  73. package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js → chart-config-sunburst-W_SKwaj0.js} +4 -4
  74. package/dist/client/chunks/{chart-config-sunburst-DNmQpIIx.js.map → chart-config-sunburst-W_SKwaj0.js.map} +1 -1
  75. package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js → chart-config-tree-map-CLmRvvMR.js} +2 -2
  76. package/dist/client/chunks/{chart-config-tree-map-HVgG4oa0.js.map → chart-config-tree-map-CLmRvvMR.js.map} +1 -1
  77. package/dist/client/chunks/{chart-data-table-D4WDqbM0.js → chart-data-table-rUFLqysu.js} +4 -4
  78. package/dist/client/chunks/{chart-data-table-D4WDqbM0.js.map → chart-data-table-rUFLqysu.js.map} +1 -1
  79. package/dist/client/chunks/{chart-funnel-Csdn4FbN.js → chart-funnel-C7zGBfSw.js} +2 -2
  80. package/dist/client/chunks/{chart-funnel-Csdn4FbN.js.map → chart-funnel-C7zGBfSw.js.map} +1 -1
  81. package/dist/client/chunks/{chart-heat-map-v1afxnjq.js → chart-heat-map-B-l8hK8b.js} +2 -2
  82. package/dist/client/chunks/{chart-heat-map-v1afxnjq.js.map → chart-heat-map-B-l8hK8b.js.map} +1 -1
  83. package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js +351 -0
  84. package/dist/client/chunks/chart-kpi-delta-sfZEvQZm.js.map +1 -0
  85. package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js +473 -0
  86. package/dist/client/chunks/chart-kpi-number-BxGNOtzI.js.map +1 -0
  87. package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js → chart-kpi-text-BLQ_CWQP.js} +3 -3
  88. package/dist/client/chunks/{chart-kpi-text-CRp8QWYG.js.map → chart-kpi-text-BLQ_CWQP.js.map} +1 -1
  89. package/dist/client/chunks/{chart-line-DqqE7ky9.js → chart-line-FSEpBk6Y.js} +5 -5
  90. package/dist/client/chunks/{chart-line-DqqE7ky9.js.map → chart-line-FSEpBk6Y.js.map} +1 -1
  91. package/dist/client/chunks/{chart-pie-B5WBzIRH.js → chart-pie-BRQEH9e-.js} +2 -2
  92. package/dist/client/chunks/{chart-pie-B5WBzIRH.js.map → chart-pie-BRQEH9e-.js.map} +1 -1
  93. package/dist/client/chunks/{chart-radar-DL_dvhA-.js → chart-radar-DgsFyiIP.js} +2 -2
  94. package/dist/client/chunks/{chart-radar-DL_dvhA-.js.map → chart-radar-DgsFyiIP.js.map} +1 -1
  95. package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js → chart-radial-bar-CUMoXyl9.js} +2 -2
  96. package/dist/client/chunks/{chart-radial-bar-DDRo6nz-.js.map → chart-radial-bar-CUMoXyl9.js.map} +1 -1
  97. package/dist/client/chunks/{chart-sankey-C_bgIfg-.js → chart-sankey-IAKDEe7A.js} +2 -2
  98. package/dist/client/chunks/{chart-sankey-C_bgIfg-.js.map → chart-sankey-IAKDEe7A.js.map} +1 -1
  99. package/dist/client/chunks/{chart-scatter-DjmJRlK0.js → chart-scatter-D6XwOD2W.js} +15 -15
  100. package/dist/client/chunks/{chart-scatter-DjmJRlK0.js.map → chart-scatter-D6XwOD2W.js.map} +1 -1
  101. package/dist/client/chunks/{chart-sunburst-CbMEnaes.js → chart-sunburst-CP_pnj0S.js} +2 -2
  102. package/dist/client/chunks/{chart-sunburst-CbMEnaes.js.map → chart-sunburst-CP_pnj0S.js.map} +1 -1
  103. package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js → chart-tree-map-DQMsn47a.js} +30 -30
  104. package/dist/client/chunks/{chart-tree-map-DEfJtJVC.js.map → chart-tree-map-DQMsn47a.js.map} +1 -1
  105. package/dist/client/chunks/chartConfigRegistry-BumUIPw4.js +44 -0
  106. package/dist/client/chunks/{chartConfigRegistry-CiOq-PqX.js.map → chartConfigRegistry-BumUIPw4.js.map} +1 -1
  107. package/dist/client/chunks/charts-Dk_9XrA7.js +230 -0
  108. package/dist/client/chunks/charts-Dk_9XrA7.js.map +1 -0
  109. package/dist/client/chunks/{charts-core-CXrhEEVF.js → charts-core-CjQZBxmv.js} +10 -10
  110. package/dist/client/chunks/{charts-core-CXrhEEVF.js.map → charts-core-CjQZBxmv.js.map} +1 -1
  111. package/dist/client/chunks/{charts-loader-BtsnUO4Q.js → charts-loader-ChTUa_-G.js} +30 -28
  112. package/dist/client/chunks/charts-loader-ChTUa_-G.js.map +1 -0
  113. package/dist/client/chunks/{components-BDrlf9Er.js → components-BKZ7EAg0.js} +3575 -3208
  114. package/dist/client/chunks/components-BKZ7EAg0.js.map +1 -0
  115. package/dist/client/chunks/{core-B8zw0qRf.js → core-BRC075EG.js} +2 -2
  116. package/dist/client/chunks/{core-B8zw0qRf.js.map → core-BRC075EG.js.map} +1 -1
  117. package/dist/client/chunks/hooks-D7APQ8uS.js +150 -0
  118. package/dist/client/chunks/{hooks-B8Zw5PfL.js.map → hooks-D7APQ8uS.js.map} +1 -1
  119. package/dist/client/chunks/{icons-NzFHtqeM.js → icons-DRreo6m8.js} +128 -112
  120. package/dist/client/chunks/{icons-NzFHtqeM.js.map → icons-DRreo6m8.js.map} +1 -1
  121. package/dist/client/chunks/{providers-CqCiJTEj.js → providers-Cj7PQfXn.js} +2 -2
  122. package/dist/client/chunks/{providers-CqCiJTEj.js.map → providers-Cj7PQfXn.js.map} +1 -1
  123. package/dist/client/chunks/retention-CzCo8262.js +120 -0
  124. package/dist/client/chunks/retention-CzCo8262.js.map +1 -0
  125. package/dist/client/chunks/{useDirtyStateTracking-C_mitVwh.js → useDirtyStateTracking-ZSi3voVl.js} +101 -99
  126. package/dist/client/chunks/useDirtyStateTracking-ZSi3voVl.js.map +1 -0
  127. package/dist/client/chunks/{vendor-DzzxS7Ay.js → vendor-cTQhZ_G3.js} +549 -541
  128. package/dist/client/chunks/vendor-cTQhZ_G3.js.map +1 -0
  129. package/dist/client/components/AnalysisBuilder/AnalysisTypeSelector.d.ts +3 -1
  130. package/dist/client/components/AnalysisBuilder/RetentionConfigPanel.d.ts +36 -0
  131. package/dist/client/components/AnalysisBuilder/RetentionModeContent.d.ts +71 -0
  132. package/dist/client/components/AnalysisBuilder/types.d.ts +99 -0
  133. package/dist/client/components/DebugModal.d.ts +2 -1
  134. package/dist/client/components/charts/RetentionCombinedChart.config.d.ts +2 -0
  135. package/dist/client/components/charts/RetentionCombinedChart.d.ts +14 -0
  136. package/dist/client/components/charts/RetentionHeatmap.config.d.ts +2 -0
  137. package/dist/client/components/charts/RetentionHeatmap.d.ts +7 -0
  138. package/dist/client/components.js +2 -2
  139. package/dist/client/hooks/queries/index.d.ts +2 -1
  140. package/dist/client/hooks/queries/useDryRunQuery.d.ts +26 -0
  141. package/dist/client/hooks/queries/useExplainQuery.d.ts +3 -1
  142. package/dist/client/hooks/queries/useFlowQuery.d.ts +5 -0
  143. package/dist/client/hooks/queries/useRetentionQuery.d.ts +67 -0
  144. package/dist/client/hooks/useAnalysisBuilderHook.d.ts +61 -0
  145. package/dist/client/hooks/useAnalysisQueryExecution.d.ts +42 -1
  146. package/dist/client/hooks.js +3 -3
  147. package/dist/client/icons/customIcons.d.ts +7 -0
  148. package/dist/client/icons/types.d.ts +1 -0
  149. package/dist/client/icons.js +1 -1
  150. package/dist/client/index.js +11 -11
  151. package/dist/client/providers.js +1 -1
  152. package/dist/client/stores/analysisBuilderStore.d.ts +86 -1
  153. package/dist/client/stores/dashboardStore.d.ts +2 -1
  154. package/dist/client/stores/slices/index.d.ts +2 -0
  155. package/dist/client/stores/slices/retentionSlice.d.ts +66 -0
  156. package/dist/client/styles.css +1 -1
  157. package/dist/client/types/analysisConfig.d.ts +29 -4
  158. package/dist/client/types/funnel.d.ts +5 -0
  159. package/dist/client/types/retention.d.ts +301 -0
  160. package/dist/client/types.d.ts +6 -3
  161. package/dist/client-bundle-stats.html +1 -1
  162. package/dist/server/index.cjs +101 -79
  163. package/dist/server/index.d.ts +427 -0
  164. package/dist/server/index.js +9140 -4934
  165. package/package.json +5 -2
  166. package/dist/adapters/compiler-CO13DaEb.cjs +0 -192
  167. package/dist/client/chunks/analysis-builder-Dc9NrG_N.js +0 -6013
  168. package/dist/client/chunks/analysis-builder-Dc9NrG_N.js.map +0 -1
  169. package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js +0 -2540
  170. package/dist/client/chunks/analysis-builder-shared-B3-UWqQ2.js.map +0 -1
  171. package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js +0 -435
  172. package/dist/client/chunks/chart-kpi-delta-Bs5R5xr4.js.map +0 -1
  173. package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js +0 -392
  174. package/dist/client/chunks/chart-kpi-number-Cf4Pgkm9.js.map +0 -1
  175. package/dist/client/chunks/chartConfigRegistry-CiOq-PqX.js +0 -44
  176. package/dist/client/chunks/charts-loader-BtsnUO4Q.js.map +0 -1
  177. package/dist/client/chunks/charts-xNubY0vm.js +0 -226
  178. package/dist/client/chunks/charts-xNubY0vm.js.map +0 -1
  179. package/dist/client/chunks/components-BDrlf9Er.js.map +0 -1
  180. package/dist/client/chunks/hooks-B8Zw5PfL.js +0 -123
  181. package/dist/client/chunks/useDirtyStateTracking-C_mitVwh.js.map +0 -1
  182. package/dist/client/chunks/vendor-DzzxS7Ay.js.map +0 -1
@@ -1,72 +1,72 @@
1
- import { NextResponse as a } from "next/server";
2
- import { d as i, f as w, a as p, b as N, c as E, h as C, S } from "../compiler-DTOU8IsK.js";
3
- function j(t) {
4
- const { cubes: n, drizzle: s, schema: o, engineType: y, cache: r } = t;
5
- if (!n || n.length === 0)
1
+ import { NextResponse as n } from "next/server";
2
+ import { j as i, f as w, a as v, b as N, c as E, h as S, d as b, e as C, g as H, i as p, S as O } from "../validation-_UkKJ2pC.js";
3
+ function h(r) {
4
+ const { cubes: t, drizzle: s, schema: c, engineType: l, cache: a } = r;
5
+ if (!t || t.length === 0)
6
6
  throw new Error("At least one cube must be provided in the cubes array");
7
- const c = new S({
7
+ const o = new O({
8
8
  drizzle: s,
9
- schema: o,
10
- engineType: y,
11
- cache: r
9
+ schema: c,
10
+ engineType: l,
11
+ cache: a
12
12
  });
13
- return n.forEach((e) => {
14
- c.registerCube(e);
15
- }), c;
13
+ return t.forEach((e) => {
14
+ o.registerCube(e);
15
+ }), o;
16
16
  }
17
- function m(t, n) {
18
- const s = t.headers.get("origin"), o = {};
19
- return n.origin && (typeof n.origin == "string" ? o["Access-Control-Allow-Origin"] = n.origin : Array.isArray(n.origin) ? s && n.origin.includes(s) && (o["Access-Control-Allow-Origin"] = s) : typeof n.origin == "function" && s && n.origin(s) && (o["Access-Control-Allow-Origin"] = s)), n.methods && (o["Access-Control-Allow-Methods"] = n.methods.join(", ")), n.allowedHeaders && (o["Access-Control-Allow-Headers"] = n.allowedHeaders.join(", ")), n.credentials && (o["Access-Control-Allow-Credentials"] = "true"), o;
17
+ function y(r, t) {
18
+ const s = r.headers.get("origin"), c = {};
19
+ return t.origin && (typeof t.origin == "string" ? c["Access-Control-Allow-Origin"] = t.origin : Array.isArray(t.origin) ? s && t.origin.includes(s) && (c["Access-Control-Allow-Origin"] = s) : typeof t.origin == "function" && s && t.origin(s) && (c["Access-Control-Allow-Origin"] = s)), t.methods && (c["Access-Control-Allow-Methods"] = t.methods.join(", ")), t.allowedHeaders && (c["Access-Control-Allow-Headers"] = t.allowedHeaders.join(", ")), t.credentials && (c["Access-Control-Allow-Credentials"] = "true"), c;
20
20
  }
21
- function P(t) {
21
+ function B(r) {
22
22
  return async function(s) {
23
- const o = m(s, t);
23
+ const c = y(s, r);
24
24
  return new Response(null, {
25
25
  status: 200,
26
- headers: o
26
+ headers: c
27
27
  });
28
28
  };
29
29
  }
30
- function v(t) {
31
- const { extractSecurityContext: n, cors: s } = t, o = j(t);
32
- return async function(r, c) {
30
+ function L(r) {
31
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
32
+ return async function(a, o) {
33
33
  try {
34
34
  let e;
35
- if (r.method === "POST") {
36
- const h = await r.json();
37
- e = h.query || h;
38
- } else if (r.method === "GET") {
39
- const h = r.nextUrl.searchParams.get("query");
40
- if (!h)
41
- return a.json(
35
+ if (a.method === "POST") {
36
+ const j = await a.json();
37
+ e = j.query || j;
38
+ } else if (a.method === "GET") {
39
+ const j = a.nextUrl.searchParams.get("query");
40
+ if (!j)
41
+ return n.json(
42
42
  i("Query parameter is required", 400),
43
43
  { status: 400 }
44
44
  );
45
45
  try {
46
- e = JSON.parse(h);
46
+ e = JSON.parse(j);
47
47
  } catch {
48
- return a.json(
48
+ return n.json(
49
49
  i("Invalid JSON in query parameter", 400),
50
50
  { status: 400 }
51
51
  );
52
52
  }
53
53
  } else
54
- return a.json(
54
+ return n.json(
55
55
  i("Method not allowed", 405),
56
56
  { status: 405 }
57
57
  );
58
- const u = await n(r, c), d = o.validateQuery(e);
59
- if (!d.isValid)
60
- return a.json(
61
- i(`Query validation failed: ${d.errors.join(", ")}`, 400),
58
+ const u = await t(a, o), f = c.validateQuery(e);
59
+ if (!f.isValid)
60
+ return n.json(
61
+ i(`Query validation failed: ${f.errors.join(", ")}`, 400),
62
62
  { status: 400 }
63
63
  );
64
- const l = r.headers.get("x-cache-control") === "no-cache", f = await o.executeMultiCubeQuery(e, u, { skipCache: l }), x = w(e, f, o);
65
- return a.json(x, {
66
- headers: s ? m(r, s) : {}
64
+ const d = a.headers.get("x-cache-control") === "no-cache", m = await c.executeMultiCubeQuery(e, u, { skipCache: d }), g = w(e, m, c);
65
+ return n.json(g, {
66
+ headers: s ? y(a, s) : {}
67
67
  });
68
68
  } catch (e) {
69
- return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:", e), a.json(
69
+ return process.env.NODE_ENV !== "test" && console.error("Next.js load handler error:", e), n.json(
70
70
  i(
71
71
  e instanceof Error ? e.message : "Query execution failed",
72
72
  500
@@ -76,18 +76,18 @@ function v(t) {
76
76
  }
77
77
  };
78
78
  }
79
- function b(t) {
80
- const { cors: n } = t, s = j(t);
81
- return async function(y, r) {
79
+ function P(r) {
80
+ const { cors: t } = r, s = h(r);
81
+ return async function(l, a) {
82
82
  try {
83
- const c = s.getMetadata(), e = p(c);
84
- return a.json(e, {
85
- headers: n ? m(y, n) : {}
83
+ const o = s.getMetadata(), e = v(o);
84
+ return n.json(e, {
85
+ headers: t ? y(l, t) : {}
86
86
  });
87
- } catch (c) {
88
- return process.env.NODE_ENV !== "test" && console.error("Next.js meta handler error:", c), a.json(
87
+ } catch (o) {
88
+ return process.env.NODE_ENV !== "test" && console.error("Next.js meta handler error:", o), n.json(
89
89
  i(
90
- c instanceof Error ? c.message : "Failed to fetch metadata",
90
+ o instanceof Error ? o.message : "Failed to fetch metadata",
91
91
  500
92
92
  ),
93
93
  { status: 500 }
@@ -95,52 +95,52 @@ function b(t) {
95
95
  }
96
96
  };
97
97
  }
98
- function H(t) {
99
- const { extractSecurityContext: n, cors: s } = t, o = j(t);
100
- return async function(r, c) {
98
+ function Q(r) {
99
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
100
+ return async function(a, o) {
101
101
  try {
102
102
  let e;
103
- if (r.method === "POST") {
104
- const g = await r.json();
105
- e = g.query || g;
106
- } else if (r.method === "GET") {
107
- const g = r.nextUrl.searchParams.get("query");
108
- if (!g)
109
- return a.json(
103
+ if (a.method === "POST") {
104
+ const x = await a.json();
105
+ e = x.query || x;
106
+ } else if (a.method === "GET") {
107
+ const x = a.nextUrl.searchParams.get("query");
108
+ if (!x)
109
+ return n.json(
110
110
  i("Query parameter is required", 400),
111
111
  { status: 400 }
112
112
  );
113
113
  try {
114
- e = JSON.parse(g);
114
+ e = JSON.parse(x);
115
115
  } catch {
116
- return a.json(
116
+ return n.json(
117
117
  i("Invalid JSON in query parameter", 400),
118
118
  { status: 400 }
119
119
  );
120
120
  }
121
121
  } else
122
- return a.json(
122
+ return n.json(
123
123
  i("Method not allowed", 405),
124
124
  { status: 405 }
125
125
  );
126
- const u = await n(r, c), d = o.validateQuery(e);
127
- if (!d.isValid)
128
- return a.json(
129
- i(`Query validation failed: ${d.errors.join(", ")}`, 400),
126
+ const u = await t(a, o), f = c.validateQuery(e);
127
+ if (!f.isValid)
128
+ return n.json(
129
+ i(`Query validation failed: ${f.errors.join(", ")}`, 400),
130
130
  { status: 400 }
131
131
  );
132
- const l = e.measures?.[0] || e.dimensions?.[0];
133
- if (!l)
134
- return a.json(
132
+ const d = e.measures?.[0] || e.dimensions?.[0];
133
+ if (!d)
134
+ return n.json(
135
135
  i("No measures or dimensions specified", 400),
136
136
  { status: 400 }
137
137
  );
138
- const f = l.split(".")[0], x = await o.generateSQL(f, e, u), h = N(e, x);
139
- return a.json(h, {
140
- headers: s ? m(r, s) : {}
138
+ const m = d.split(".")[0], g = await c.generateSQL(m, e, u), j = N(e, g);
139
+ return n.json(j, {
140
+ headers: s ? y(a, s) : {}
141
141
  });
142
142
  } catch (e) {
143
- return process.env.NODE_ENV !== "test" && console.error("Next.js SQL handler error:", e), a.json(
143
+ return process.env.NODE_ENV !== "test" && console.error("Next.js SQL handler error:", e), n.json(
144
144
  i(
145
145
  e instanceof Error ? e.message : "SQL generation failed",
146
146
  500
@@ -150,40 +150,40 @@ function H(t) {
150
150
  }
151
151
  };
152
152
  }
153
- function A(t) {
154
- const { extractSecurityContext: n, cors: s } = t, o = j(t);
155
- return async function(r, c) {
153
+ function T(r) {
154
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
155
+ return async function(a, o) {
156
156
  try {
157
157
  let e;
158
- if (r.method === "POST") {
159
- const l = await r.json();
160
- e = l.query || l;
161
- } else if (r.method === "GET") {
162
- const l = r.nextUrl.searchParams.get("query");
163
- if (!l)
164
- return a.json(
158
+ if (a.method === "POST") {
159
+ const d = await a.json();
160
+ e = d.query || d;
161
+ } else if (a.method === "GET") {
162
+ const d = a.nextUrl.searchParams.get("query");
163
+ if (!d)
164
+ return n.json(
165
165
  { error: "Query parameter is required", valid: !1 },
166
166
  { status: 400 }
167
167
  );
168
168
  try {
169
- e = JSON.parse(l);
169
+ e = JSON.parse(d);
170
170
  } catch {
171
- return a.json(
171
+ return n.json(
172
172
  { error: "Invalid JSON in query parameter", valid: !1 },
173
173
  { status: 400 }
174
174
  );
175
175
  }
176
176
  } else
177
- return a.json(
177
+ return n.json(
178
178
  { error: "Method not allowed", valid: !1 },
179
179
  { status: 405 }
180
180
  );
181
- const u = await n(r, c), d = await E(e, u, o);
182
- return a.json(d, {
183
- headers: s ? m(r, s) : {}
181
+ const u = await t(a, o), f = await E(e, u, c);
182
+ return n.json(f, {
183
+ headers: s ? y(a, s) : {}
184
184
  });
185
185
  } catch (e) {
186
- return process.env.NODE_ENV !== "test" && console.error("Next.js dry-run handler error:", e), a.json(
186
+ return process.env.NODE_ENV !== "test" && console.error("Next.js dry-run handler error:", e), n.json(
187
187
  {
188
188
  error: e instanceof Error ? e.message : "Dry-run validation failed",
189
189
  valid: !1
@@ -193,32 +193,32 @@ function A(t) {
193
193
  }
194
194
  };
195
195
  }
196
- function Q(t) {
197
- const { extractSecurityContext: n, cors: s } = t, o = j(t);
198
- return async function(r, c) {
196
+ function A(r) {
197
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
198
+ return async function(a, o) {
199
199
  try {
200
- if (r.method !== "POST")
201
- return a.json(
200
+ if (a.method !== "POST")
201
+ return n.json(
202
202
  i("Method not allowed - use POST", 405),
203
203
  { status: 405 }
204
204
  );
205
- const e = await r.json(), { queries: u } = e;
205
+ const e = await a.json(), { queries: u } = e;
206
206
  if (!u || !Array.isArray(u))
207
- return a.json(
207
+ return n.json(
208
208
  i('Request body must contain a "queries" array', 400),
209
209
  { status: 400 }
210
210
  );
211
211
  if (u.length === 0)
212
- return a.json(
212
+ return n.json(
213
213
  i("Queries array cannot be empty", 400),
214
214
  { status: 400 }
215
215
  );
216
- const d = await n(r, c), l = r.headers.get("x-cache-control") === "no-cache", f = await C(u, d, o, { skipCache: l });
217
- return a.json(f, {
218
- headers: s ? m(r, s) : {}
216
+ const f = await t(a, o), d = a.headers.get("x-cache-control") === "no-cache", m = await S(u, f, c, { skipCache: d });
217
+ return n.json(m, {
218
+ headers: s ? y(a, s) : {}
219
219
  });
220
220
  } catch (e) {
221
- return process.env.NODE_ENV !== "test" && console.error("Next.js batch handler error:", e), a.json(
221
+ return process.env.NODE_ENV !== "test" && console.error("Next.js batch handler error:", e), n.json(
222
222
  i(
223
223
  e instanceof Error ? e.message : "Batch execution failed",
224
224
  500
@@ -228,54 +228,173 @@ function Q(t) {
228
228
  }
229
229
  };
230
230
  }
231
- function R(t) {
232
- const { extractSecurityContext: n, cors: s } = t, o = j(t);
233
- return async function(r, c) {
231
+ function M(r) {
232
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
233
+ return async function(a, o) {
234
234
  try {
235
- if (r.method !== "POST")
236
- return a.json(
235
+ if (a.method !== "POST")
236
+ return n.json(
237
237
  { error: "Method not allowed" },
238
238
  { status: 405 }
239
239
  );
240
- const e = await r.json(), u = e.query || e, d = e.options || {}, l = await n(r, c), f = o.validateQuery(u);
241
- if (!f.isValid)
242
- return a.json(
243
- { error: `Query validation failed: ${f.errors.join(", ")}` },
240
+ const e = await a.json(), u = e.query || e, f = e.options || {}, d = await t(a, o), m = c.validateQuery(u);
241
+ if (!m.isValid)
242
+ return n.json(
243
+ { error: `Query validation failed: ${m.errors.join(", ")}` },
244
244
  { status: 400 }
245
245
  );
246
- const x = await o.explainQuery(
246
+ const g = await c.explainQuery(
247
247
  u,
248
- l,
249
- d
248
+ d,
249
+ f
250
250
  );
251
- return a.json(x, {
252
- headers: s ? m(r, s) : {}
251
+ return n.json(g, {
252
+ headers: s ? y(a, s) : {}
253
253
  });
254
254
  } catch (e) {
255
- return process.env.NODE_ENV !== "test" && console.error("Next.js explain handler error:", e), a.json(
255
+ return process.env.NODE_ENV !== "test" && console.error("Next.js explain handler error:", e), n.json(
256
256
  { error: e instanceof Error ? e.message : "Explain query failed" },
257
257
  { status: 500 }
258
258
  );
259
259
  }
260
260
  };
261
261
  }
262
- function M(t) {
263
- return {
264
- load: v(t),
265
- meta: b(t),
266
- sql: H(t),
267
- dryRun: A(t),
268
- batch: Q(t),
269
- explain: R(t)
262
+ function D(r) {
263
+ const { cors: t } = r, s = h(r);
264
+ return async function(l, a) {
265
+ try {
266
+ if (l.method !== "POST")
267
+ return n.json(
268
+ i("Method not allowed - use POST", 405),
269
+ { status: 405 }
270
+ );
271
+ const o = await l.json(), e = await b(s, o);
272
+ return n.json(e, {
273
+ headers: t ? y(l, t) : {}
274
+ });
275
+ } catch (o) {
276
+ return process.env.NODE_ENV !== "test" && console.error("Next.js discover handler error:", o), n.json(
277
+ i(
278
+ o instanceof Error ? o.message : "Discovery failed",
279
+ 500
280
+ ),
281
+ { status: 500 }
282
+ );
283
+ }
284
+ };
285
+ }
286
+ function R(r) {
287
+ const { cors: t } = r, s = h(r);
288
+ return async function(l, a) {
289
+ try {
290
+ if (l.method !== "POST")
291
+ return n.json(
292
+ i("Method not allowed - use POST", 405),
293
+ { status: 405 }
294
+ );
295
+ const o = await l.json();
296
+ if (!o.naturalLanguage)
297
+ return n.json(
298
+ i("naturalLanguage field is required", 400),
299
+ { status: 400 }
300
+ );
301
+ const e = await C(s, o);
302
+ return n.json(e, {
303
+ headers: t ? y(l, t) : {}
304
+ });
305
+ } catch (o) {
306
+ return process.env.NODE_ENV !== "test" && console.error("Next.js suggest handler error:", o), n.json(
307
+ i(
308
+ o instanceof Error ? o.message : "Query suggestion failed",
309
+ 500
310
+ ),
311
+ { status: 500 }
312
+ );
313
+ }
314
+ };
315
+ }
316
+ function V(r) {
317
+ const { cors: t } = r, s = h(r);
318
+ return async function(l, a) {
319
+ try {
320
+ if (l.method !== "POST")
321
+ return n.json(
322
+ i("Method not allowed - use POST", 405),
323
+ { status: 405 }
324
+ );
325
+ const o = await l.json();
326
+ if (!o.query)
327
+ return n.json(
328
+ i("query field is required", 400),
329
+ { status: 400 }
330
+ );
331
+ const e = await H(s, o);
332
+ return n.json(e, {
333
+ headers: t ? y(l, t) : {}
334
+ });
335
+ } catch (o) {
336
+ return process.env.NODE_ENV !== "test" && console.error("Next.js validate handler error:", o), n.json(
337
+ i(
338
+ o instanceof Error ? o.message : "Query validation failed",
339
+ 500
340
+ ),
341
+ { status: 500 }
342
+ );
343
+ }
344
+ };
345
+ }
346
+ function _(r) {
347
+ const { extractSecurityContext: t, cors: s } = r, c = h(r);
348
+ return async function(a, o) {
349
+ try {
350
+ if (a.method !== "POST")
351
+ return n.json(
352
+ i("Method not allowed - use POST", 405),
353
+ { status: 405 }
354
+ );
355
+ const e = await a.json();
356
+ if (!e.query)
357
+ return n.json(
358
+ i("query field is required", 400),
359
+ { status: 400 }
360
+ );
361
+ const u = await t(a, o), f = await p(c, u, e);
362
+ return n.json(f, {
363
+ headers: s ? y(a, s) : {}
364
+ });
365
+ } catch (e) {
366
+ return process.env.NODE_ENV !== "test" && console.error("Next.js MCP load handler error:", e), n.json(
367
+ i(
368
+ e instanceof Error ? e.message : "Query execution failed",
369
+ 500
370
+ ),
371
+ { status: 500 }
372
+ );
373
+ }
374
+ };
375
+ }
376
+ function G(r) {
377
+ const { mcp: t = { enabled: !0 } } = r, s = t.tools || ["discover", "suggest", "validate", "load"], c = {
378
+ load: L(r),
379
+ meta: P(r),
380
+ sql: Q(r),
381
+ dryRun: T(r),
382
+ batch: A(r),
383
+ explain: M(r)
270
384
  };
385
+ return t.enabled !== !1 && (s.includes("discover") && (c.discover = D(r)), s.includes("suggest") && (c.suggest = R(r)), s.includes("validate") && (c.validate = V(r)), s.includes("load") && (c.mcpLoad = _(r))), c;
271
386
  }
272
387
  export {
273
- Q as createBatchHandler,
274
- M as createCubeHandlers,
275
- A as createDryRunHandler,
276
- R as createExplainHandler,
277
- v as createLoadHandler,
278
- b as createMetaHandler,
279
- P as createOptionsHandler,
280
- H as createSqlHandler
388
+ A as createBatchHandler,
389
+ G as createCubeHandlers,
390
+ D as createDiscoverHandler,
391
+ T as createDryRunHandler,
392
+ M as createExplainHandler,
393
+ L as createLoadHandler,
394
+ _ as createMcpLoadHandler,
395
+ P as createMetaHandler,
396
+ B as createOptionsHandler,
397
+ Q as createSqlHandler,
398
+ R as createSuggestHandler,
399
+ V as createValidateHandler
281
400
  };
@@ -1,4 +1,4 @@
1
- import { SemanticLayerCompiler, SemanticQuery, SecurityContext, QueryAnalysis } from '../server';
1
+ import { SemanticLayerCompiler, SemanticQuery, SecurityContext, QueryAnalysis, CubeDiscoveryResult, QuerySuggestion, AIValidationResult } from '../server';
2
2
  /**
3
3
  * Calculate query complexity based on query structure
4
4
  */
@@ -85,6 +85,33 @@ export declare function handleDryRun(query: SemanticQuery, securityContext: Secu
85
85
  sql: string;
86
86
  params: any[];
87
87
  };
88
+ } | {
89
+ queryType: string;
90
+ normalizedQueries: never[];
91
+ queryOrder: string[];
92
+ transformedQueries: never[];
93
+ pivotQuery: {
94
+ measures: never[];
95
+ dimensions: never[];
96
+ timeDimensions: never[];
97
+ order: {};
98
+ filters: never[];
99
+ queryType: string;
100
+ joinType: string;
101
+ query: SemanticQuery;
102
+ retention: {
103
+ timeDimension: string | import('../server').RetentionTimeDimensionMapping;
104
+ bindingKey: string | import('../server').RetentionBindingKeyMapping[];
105
+ granularity: "day" | "week" | "month";
106
+ periods: number;
107
+ retentionType: "classic" | "rolling";
108
+ breakdownDimensions: string[] | undefined;
109
+ };
110
+ };
111
+ sql: {
112
+ sql: string;
113
+ params: any[];
114
+ };
88
115
  } | {
89
116
  queryType: string;
90
117
  normalizedQueries: {
@@ -173,6 +200,7 @@ export declare function formatCubeResponse(query: SemanticQuery, result: {
173
200
  fillMissingDatesValue?: number | null;
174
201
  funnel?: import('../server').FunnelQueryConfig;
175
202
  flow?: import('../server/types/flow').FlowQueryConfig;
203
+ retention?: import('../server').RetentionQueryConfig;
176
204
  };
177
205
  slowQuery: boolean;
178
206
  };
@@ -259,6 +287,7 @@ export declare function handleBatchRequest(queries: SemanticQuery[], securityCon
259
287
  fillMissingDatesValue?: number | null;
260
288
  funnel?: import('../server').FunnelQueryConfig;
261
289
  flow?: import('../server/types/flow').FlowQueryConfig;
290
+ retention?: import('../server').RetentionQueryConfig;
262
291
  };
263
292
  slowQuery: boolean;
264
293
  success: boolean;
@@ -270,3 +299,73 @@ export declare function handleBatchRequest(queries: SemanticQuery[], securityCon
270
299
  query: SemanticQuery;
271
300
  })[];
272
301
  }>;
302
+ /**
303
+ * MCP Endpoint Options
304
+ */
305
+ export interface MCPOptions {
306
+ /** Enable MCP endpoints (default: true) */
307
+ enabled?: boolean;
308
+ /** Which MCP tools to expose (default: all) */
309
+ tools?: ('discover' | 'suggest' | 'validate' | 'load')[];
310
+ /** Base path for MCP endpoints (default: '/mcp') */
311
+ basePath?: string;
312
+ }
313
+ /**
314
+ * Discovery request body
315
+ */
316
+ export interface DiscoverRequest {
317
+ /** Topic or keyword to search for */
318
+ topic?: string;
319
+ /** Natural language intent */
320
+ intent?: string;
321
+ /** Maximum results to return */
322
+ limit?: number;
323
+ /** Minimum relevance score (0-1) */
324
+ minScore?: number;
325
+ }
326
+ /**
327
+ * Suggest request body
328
+ */
329
+ export interface SuggestRequest {
330
+ /** Natural language query */
331
+ naturalLanguage: string;
332
+ /** Optional target cube name */
333
+ cube?: string;
334
+ }
335
+ /**
336
+ * Validate request body
337
+ */
338
+ export interface ValidateRequest {
339
+ /** Query to validate */
340
+ query: SemanticQuery;
341
+ }
342
+ /**
343
+ * Load request body - execute a query
344
+ */
345
+ export interface LoadRequest {
346
+ /** Query to execute */
347
+ query: SemanticQuery;
348
+ }
349
+ /**
350
+ * Handle /discover endpoint - find relevant cubes based on topic/intent
351
+ */
352
+ export declare function handleDiscover(semanticLayer: SemanticLayerCompiler, body: DiscoverRequest): Promise<{
353
+ cubes: CubeDiscoveryResult[];
354
+ }>;
355
+ /**
356
+ * Handle /suggest endpoint - generate query from natural language
357
+ */
358
+ export declare function handleSuggest(semanticLayer: SemanticLayerCompiler, body: SuggestRequest): Promise<QuerySuggestion>;
359
+ /**
360
+ * Handle /validate endpoint - validate query with corrections
361
+ */
362
+ export declare function handleValidate(semanticLayer: SemanticLayerCompiler, body: ValidateRequest): Promise<AIValidationResult>;
363
+ /**
364
+ * Handle /load endpoint - execute a query and return results
365
+ * This completes the AI workflow: discover → suggest → validate → load
366
+ */
367
+ export declare function handleLoad(semanticLayer: SemanticLayerCompiler, securityContext: SecurityContext, body: LoadRequest): Promise<{
368
+ data: Record<string, unknown>[];
369
+ annotation: any;
370
+ query: SemanticQuery;
371
+ }>;