drizzle-cube 0.4.28 → 0.4.30

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 (382) hide show
  1. package/dist/adapters/anthropic-BIva8k1r.cjs +1 -0
  2. package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
  3. package/dist/adapters/dist-Boc63-1q.cjs +2 -0
  4. package/dist/adapters/dist-De5fzUEM.js +581 -0
  5. package/dist/adapters/express/index.cjs +2 -10
  6. package/dist/adapters/express/index.js +232 -342
  7. package/dist/adapters/fastify/index.cjs +2 -10
  8. package/dist/adapters/fastify/index.js +275 -424
  9. package/dist/adapters/google-CT4kgmBf.js +154 -0
  10. package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
  11. package/dist/adapters/handler-B8vuFQYP.cjs +25 -0
  12. package/dist/adapters/handler-D-2-6uLM.js +2951 -0
  13. package/dist/adapters/hono/index.cjs +2 -10
  14. package/dist/adapters/hono/index.js +307 -402
  15. package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
  16. package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
  17. package/dist/adapters/mcp-transport-CuugoG8t.js +7821 -0
  18. package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
  19. package/dist/adapters/nextjs/index.cjs +1 -9
  20. package/dist/adapters/nextjs/index.js +377 -600
  21. package/dist/adapters/openai-CjBvA6mK.js +4114 -0
  22. package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
  23. package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
  24. package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
  25. package/dist/adapters/types.cjs +0 -1
  26. package/dist/adapters/types.js +0 -1
  27. package/dist/adapters/utils-ChhNGUOF.js +5396 -0
  28. package/dist/adapters/utils-CwJplXR5.cjs +15 -0
  29. package/dist/adapters/utils.cjs +1 -19
  30. package/dist/adapters/utils.js +2 -21333
  31. package/dist/client/charts.js +15 -186
  32. package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
  33. package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
  34. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
  35. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
  36. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
  37. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js.map +1 -0
  38. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
  39. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
  40. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
  41. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
  42. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
  43. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
  44. package/dist/client/chunks/analysis-builder-DF0XntqC.js +6111 -0
  45. package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
  46. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
  47. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
  48. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
  49. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
  50. package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
  51. package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
  52. package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
  53. package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
  54. package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
  55. package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
  56. package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
  57. package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
  58. package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
  59. package/dist/client/chunks/chart-candlestick-C3Rep469.js.map +1 -0
  60. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
  61. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
  62. package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
  63. package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
  64. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
  65. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
  66. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
  67. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
  68. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
  69. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
  70. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
  71. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
  72. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
  73. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
  74. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
  75. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
  76. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
  77. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
  78. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
  79. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
  80. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
  81. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
  82. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
  83. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
  84. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
  85. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
  86. package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
  87. package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
  88. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
  89. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
  90. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
  91. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
  92. package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
  93. package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
  94. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
  95. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
  96. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
  97. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
  98. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
  99. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
  100. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
  101. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
  102. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
  103. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
  104. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
  105. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
  106. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
  107. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
  108. package/dist/client/chunks/chart-data-table-DehW1C1G.js +4088 -0
  109. package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
  110. package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
  111. package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
  112. package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
  113. package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
  114. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
  115. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
  116. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
  117. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
  118. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
  119. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
  120. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
  121. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
  122. package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
  123. package/dist/client/chunks/chart-line-DOIMkP0b.js.map +1 -0
  124. package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
  125. package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
  126. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js +179 -0
  127. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
  128. package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
  129. package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
  130. package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
  131. package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
  132. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
  133. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
  134. package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
  135. package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
  136. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
  137. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
  138. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
  139. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
  140. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
  141. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
  142. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
  143. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
  144. package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
  145. package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
  146. package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
  147. package/dist/client/chunks/charts-loader-AGpph8_I.js.map +1 -0
  148. package/dist/client/chunks/core-D1TOj17W.js +845 -0
  149. package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
  150. package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
  151. package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
  152. package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
  153. package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
  154. package/dist/client/chunks/json-BpTrLZSh.js +38 -0
  155. package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
  156. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
  157. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
  158. package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
  159. package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
  160. package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
  161. package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
  162. package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
  163. package/dist/client/chunks/schema-visualization-ZugB4Io9.js +1073 -0
  164. package/dist/client/chunks/schema-visualization-ZugB4Io9.js.map +1 -0
  165. package/dist/client/chunks/sql-B0chxcEK.js +120 -0
  166. package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
  167. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
  168. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
  169. package/dist/client/chunks/useDebounce-BQjNWndQ.js +1394 -0
  170. package/dist/client/chunks/useDebounce-BQjNWndQ.js.map +1 -0
  171. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
  172. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
  173. package/dist/client/chunks/useExplainAI-c_bHxZe5.js +203 -0
  174. package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +1 -0
  175. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
  176. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
  177. package/dist/client/chunks/utils-A54Ny29G.js +128 -0
  178. package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
  179. package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
  180. package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
  181. package/dist/client/components.js +4 -18
  182. package/dist/client/hooks.js +6 -58
  183. package/dist/client/icons.js +2 -15
  184. package/dist/client/index.js +1061 -1295
  185. package/dist/client/index.js.map +1 -1
  186. package/dist/client/providers.js +3 -9
  187. package/dist/client/styles.css +2 -1
  188. package/dist/client/types.d.ts +1 -0
  189. package/dist/client/utils.js +7 -74
  190. package/dist/client-bundle-stats.html +1 -1
  191. package/dist/server/anthropic-BsNspi1r.js +140 -0
  192. package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
  193. package/dist/server/dist-CMWZC51B.js +581 -0
  194. package/dist/server/dist-DxegvyZF.cjs +2 -0
  195. package/dist/server/google-BXwMolCu.js +154 -0
  196. package/dist/server/google-DzQWXFwF.cjs +2 -0
  197. package/dist/server/index.cjs +109 -127
  198. package/dist/server/index.d.ts +13 -4
  199. package/dist/server/index.js +15089 -34349
  200. package/dist/server/openai-BPhmb8mi.js +4114 -0
  201. package/dist/server/openai-CLsoLaue.cjs +1 -0
  202. package/dist/server/openai-D1kZ5sdM.js +153 -0
  203. package/dist/server/openai-DkOKbVLC.cjs +16 -0
  204. package/package.json +5 -5
  205. package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
  206. package/dist/adapters/anthropic-CTu9E801.js +0 -126
  207. package/dist/adapters/google-BAK9pnQf.cjs +0 -2
  208. package/dist/adapters/google-DficVAsJ.js +0 -146
  209. package/dist/adapters/handler-BV2_dul8.js +0 -2713
  210. package/dist/adapters/handler-LMRPeTNJ.cjs +0 -39
  211. package/dist/adapters/index-BgCeQBuN.cjs +0 -2
  212. package/dist/adapters/index-C3PskWTr.js +0 -5353
  213. package/dist/adapters/index-C45_meK_.js +0 -719
  214. package/dist/adapters/index-ht4NPca9.cjs +0 -23
  215. package/dist/adapters/mcp-transport-B6ZudTSk.js +0 -11010
  216. package/dist/adapters/mcp-transport-DCiSGtp1.cjs +0 -257
  217. package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
  218. package/dist/adapters/openai-mcE24du8.js +0 -131
  219. package/dist/client/charts.js.map +0 -1
  220. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
  221. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
  222. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
  223. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
  224. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
  225. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
  226. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
  227. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
  228. package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
  229. package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
  230. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
  231. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
  232. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
  233. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
  234. package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
  235. package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
  236. package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
  237. package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
  238. package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
  239. package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
  240. package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
  241. package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
  242. package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
  243. package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
  244. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
  245. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
  246. package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
  247. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
  248. package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
  249. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
  250. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
  251. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
  252. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
  253. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
  254. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
  255. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
  256. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
  257. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
  258. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
  259. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
  260. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
  261. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
  262. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
  263. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
  264. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
  265. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
  266. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
  267. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
  268. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
  269. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
  270. package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
  271. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
  272. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
  273. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
  274. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
  275. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
  276. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
  277. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
  278. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
  279. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
  280. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
  281. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
  282. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
  283. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
  284. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
  285. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
  286. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
  287. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
  288. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
  289. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
  290. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
  291. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
  292. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
  293. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
  294. package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
  295. package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
  296. package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
  297. package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
  298. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
  299. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
  300. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
  301. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
  302. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
  303. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
  304. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
  305. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
  306. package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
  307. package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
  308. package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
  309. package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
  310. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
  311. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
  312. package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
  313. package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
  314. package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
  315. package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
  316. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
  317. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
  318. package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
  319. package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
  320. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
  321. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
  322. package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
  323. package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
  324. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
  325. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
  326. package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
  327. package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
  328. package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
  329. package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
  330. package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
  331. package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
  332. package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
  333. package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
  334. package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
  335. package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
  336. package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
  337. package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
  338. package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
  339. package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
  340. package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
  341. package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
  342. package/dist/client/chunks/index-CApFCBF9.js +0 -81
  343. package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
  344. package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
  345. package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
  346. package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
  347. package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
  348. package/dist/client/chunks/json-C_6Prymp.js +0 -39
  349. package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
  350. package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
  351. package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
  352. package/dist/client/chunks/retention-CzCo8262.js +0 -120
  353. package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
  354. package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
  355. package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
  356. package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
  357. package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
  358. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
  359. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
  360. package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
  361. package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
  362. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
  363. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
  364. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
  365. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
  366. package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
  367. package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
  368. package/dist/client/components.js.map +0 -1
  369. package/dist/client/hooks.js.map +0 -1
  370. package/dist/client/icons.js.map +0 -1
  371. package/dist/client/providers.js.map +0 -1
  372. package/dist/client/utils.js.map +0 -1
  373. package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
  374. package/dist/server/anthropic-CTu9E801.js +0 -126
  375. package/dist/server/google-BAK9pnQf.cjs +0 -2
  376. package/dist/server/google-DficVAsJ.js +0 -146
  377. package/dist/server/index-BgCeQBuN.cjs +0 -2
  378. package/dist/server/index-C3PskWTr.js +0 -5353
  379. package/dist/server/index-C45_meK_.js +0 -719
  380. package/dist/server/index-ht4NPca9.cjs +0 -23
  381. package/dist/server/openai-BvA6eLs8.cjs +0 -1
  382. package/dist/server/openai-mcE24du8.js +0 -131
@@ -1,427 +1,278 @@
1
- import { S as H, v as D, b as E, a as T, n as V, p as z, w as _, d as B, i as j, M as F, c as U, e as P, s as Q } from "../mcp-transport-B6ZudTSk.js";
2
- import { formatErrorResponse as d, formatCubeResponse as A, handleBatchRequest as X, formatMetaResponse as G, formatSqlResponse as I, handleDryRun as O } from "../utils.js";
3
- const M = function(i, N, $) {
4
- const {
5
- cubes: R,
6
- drizzle: k,
7
- schema: J,
8
- extractSecurityContext: y,
9
- engineType: L,
10
- cors: q,
11
- basePath: p = "/cubejs-api/v1",
12
- bodyLimit: g = 10485760,
13
- // 10MB
14
- cache: K,
15
- mcp: S = { enabled: !0 },
16
- agent: h
17
- } = N;
18
- if (!R || R.length === 0)
19
- return $(new Error("At least one cube must be provided in the cubes array"));
20
- q && i.register(import("@fastify/cors"), q), i.addHook("onRequest", async (t, r) => {
21
- t.method === "POST" && (t.body = void 0);
22
- });
23
- const c = new H({
24
- drizzle: k,
25
- schema: J,
26
- engineType: L,
27
- cache: K
28
- });
29
- if (R.forEach((t) => {
30
- c.registerCube(t);
31
- }), i.post(`${p}/load`, {
32
- bodyLimit: g,
33
- schema: {
34
- body: {
35
- type: "object",
36
- additionalProperties: !0
37
- }
38
- }
39
- }, async (t, r) => {
40
- try {
41
- const e = t.body, a = e.query || e, n = await y(t), o = c.validateQuery(a);
42
- if (!o.isValid)
43
- return r.status(400).send(d(
44
- `Query validation failed: ${o.errors.join(", ")}`,
45
- 400
46
- ));
47
- const s = t.headers["x-cache-control"] === "no-cache", u = await c.executeMultiCubeQuery(a, n, { skipCache: s });
48
- return A(a, u, c);
49
- } catch (e) {
50
- return t.log.error(e, "Query execution error"), r.status(500).send(d(
51
- e instanceof Error ? e.message : "Query execution failed",
52
- 500
53
- ));
54
- }
55
- }), i.get(`${p}/load`, {
56
- schema: {
57
- querystring: {
58
- type: "object",
59
- properties: {
60
- query: { type: "string" }
61
- },
62
- required: ["query"]
63
- }
64
- }
65
- }, async (t, r) => {
66
- try {
67
- const { query: e } = t.query;
68
- let a;
69
- try {
70
- a = JSON.parse(e);
71
- } catch {
72
- return r.status(400).send(d(
73
- "Invalid JSON in query parameter",
74
- 400
75
- ));
76
- }
77
- const n = await y(t), o = c.validateQuery(a);
78
- if (!o.isValid)
79
- return r.status(400).send(d(
80
- `Query validation failed: ${o.errors.join(", ")}`,
81
- 400
82
- ));
83
- const s = t.headers["x-cache-control"] === "no-cache", u = await c.executeMultiCubeQuery(a, n, { skipCache: s });
84
- return A(a, u, c);
85
- } catch (e) {
86
- return t.log.error(e, "Query execution error"), r.status(500).send(d(
87
- e instanceof Error ? e.message : "Query execution failed",
88
- 500
89
- ));
90
- }
91
- }), i.post(`${p}/batch`, {
92
- bodyLimit: g,
93
- schema: {
94
- body: {
95
- type: "object",
96
- required: ["queries"],
97
- properties: {
98
- queries: {
99
- type: "array",
100
- items: { type: "object" }
101
- }
102
- }
103
- }
104
- }
105
- }, async (t, r) => {
106
- try {
107
- const { queries: e } = t.body;
108
- if (!e || !Array.isArray(e))
109
- return r.status(400).send(d(
110
- 'Request body must contain a "queries" array',
111
- 400
112
- ));
113
- if (e.length === 0)
114
- return r.status(400).send(d(
115
- "Queries array cannot be empty",
116
- 400
117
- ));
118
- const a = await y(t), n = t.headers["x-cache-control"] === "no-cache";
119
- return await X(e, a, c, { skipCache: n });
120
- } catch (e) {
121
- return t.log.error(e, "Batch execution error"), r.status(500).send(d(
122
- e instanceof Error ? e.message : "Batch execution failed",
123
- 500
124
- ));
125
- }
126
- }), i.get(`${p}/meta`, async (t, r) => {
127
- try {
128
- const e = c.getMetadata();
129
- return G(e);
130
- } catch (e) {
131
- return t.log.error(e, "Metadata error"), r.status(500).send(d(
132
- e instanceof Error ? e.message : "Failed to fetch metadata",
133
- 500
134
- ));
135
- }
136
- }), i.post(`${p}/sql`, {
137
- bodyLimit: g,
138
- schema: {
139
- body: {
140
- type: "object",
141
- additionalProperties: !0
142
- }
143
- }
144
- }, async (t, r) => {
145
- try {
146
- const e = t.body, a = await y(t), n = c.validateQuery(e);
147
- if (!n.isValid)
148
- return r.status(400).send(d(
149
- `Query validation failed: ${n.errors.join(", ")}`,
150
- 400
151
- ));
152
- const o = e.measures?.[0] || e.dimensions?.[0];
153
- if (!o)
154
- return r.status(400).send(d(
155
- "No measures or dimensions specified",
156
- 400
157
- ));
158
- const s = o.split(".")[0], u = await c.generateSQL(s, e, a);
159
- return I(e, u);
160
- } catch (e) {
161
- return t.log.error(e, "SQL generation error"), r.status(500).send(d(
162
- e instanceof Error ? e.message : "SQL generation failed",
163
- 500
164
- ));
165
- }
166
- }), i.get(`${p}/sql`, {
167
- schema: {
168
- querystring: {
169
- type: "object",
170
- properties: {
171
- query: { type: "string" }
172
- },
173
- required: ["query"]
174
- }
175
- }
176
- }, async (t, r) => {
177
- try {
178
- const { query: e } = t.query, a = JSON.parse(e), n = await y(t), o = c.validateQuery(a);
179
- if (!o.isValid)
180
- return r.status(400).send(d(
181
- `Query validation failed: ${o.errors.join(", ")}`,
182
- 400
183
- ));
184
- const s = a.measures?.[0] || a.dimensions?.[0];
185
- if (!s)
186
- return r.status(400).send(d(
187
- "No measures or dimensions specified",
188
- 400
189
- ));
190
- const u = s.split(".")[0], w = await c.generateSQL(u, a, n);
191
- return I(a, w);
192
- } catch (e) {
193
- return t.log.error(e, "SQL generation error"), r.status(500).send(d(
194
- e instanceof Error ? e.message : "SQL generation failed",
195
- 500
196
- ));
197
- }
198
- }), i.post(`${p}/dry-run`, {
199
- bodyLimit: g,
200
- schema: {
201
- body: {
202
- type: "object",
203
- additionalProperties: !0
204
- }
205
- }
206
- }, async (t, r) => {
207
- try {
208
- const e = t.body, a = e.query || e, n = await y(t);
209
- return await O(a, n, c);
210
- } catch (e) {
211
- return t.log.error(e, "Dry-run error"), r.status(400).send({
212
- error: e instanceof Error ? e.message : "Dry-run validation failed",
213
- valid: !1
214
- });
215
- }
216
- }), i.get(`${p}/dry-run`, {
217
- schema: {
218
- querystring: {
219
- type: "object",
220
- properties: {
221
- query: { type: "string" }
222
- },
223
- required: ["query"]
224
- }
225
- }
226
- }, async (t, r) => {
227
- try {
228
- const { query: e } = t.query, a = JSON.parse(e), n = await y(t);
229
- return await O(a, n, c);
230
- } catch (e) {
231
- return t.log.error(e, "Dry-run error"), r.status(400).send({
232
- error: e instanceof Error ? e.message : "Dry-run validation failed",
233
- valid: !1
234
- });
235
- }
236
- }), i.post(`${p}/explain`, {
237
- bodyLimit: g,
238
- schema: {
239
- body: {
240
- type: "object",
241
- additionalProperties: !0
242
- }
243
- }
244
- }, async (t, r) => {
245
- try {
246
- const e = t.body, a = e.query || e, n = e.options || {}, o = await y(t), s = c.validateQuery(a);
247
- return s.isValid ? await c.explainQuery(a, o, n) : r.status(400).send({
248
- error: `Query validation failed: ${s.errors.join(", ")}`
249
- });
250
- } catch (e) {
251
- return t.log.error(e, "Explain error"), r.status(500).send({
252
- error: e instanceof Error ? e.message : "Explain query failed"
253
- });
254
- }
255
- }), h && i.post(`${p}/agent/chat`, {
256
- bodyLimit: g,
257
- schema: {
258
- body: {
259
- type: "object",
260
- additionalProperties: !0
261
- }
262
- }
263
- }, async (t, r) => {
264
- try {
265
- const { handleAgentChat: e } = await import("../handler-BV2_dul8.js"), a = t.body, { message: n, sessionId: o, history: s } = a;
266
- if (!n || typeof n != "string")
267
- return r.status(400).send({ error: "message is required and must be a string" });
268
- let u = (h.apiKey || "").trim();
269
- if (h.allowClientApiKey) {
270
- const m = t.headers["x-agent-api-key"];
271
- m && (u = m.trim());
272
- }
273
- if (!u)
274
- return r.status(401).send({
275
- error: "No API key configured. Set agent.apiKey in server config or send X-Agent-Api-Key header."
276
- });
277
- const w = h.allowClientApiKey ? t.headers["x-agent-provider"] : void 0, l = h.allowClientApiKey ? t.headers["x-agent-model"] : void 0, v = h.allowClientApiKey ? t.headers["x-agent-provider-endpoint"] : void 0, b = await y(t), f = h.buildSystemContext?.(b);
278
- r.raw.writeHead(200, {
279
- "Content-Type": "text/event-stream",
280
- "Cache-Control": "no-cache",
281
- Connection: "keep-alive"
282
- });
283
- try {
284
- const m = e({
285
- message: n,
286
- sessionId: o,
287
- history: s,
288
- semanticLayer: c,
289
- securityContext: b,
290
- agentConfig: h,
291
- apiKey: u,
292
- systemContext: f,
293
- providerOverride: w,
294
- modelOverride: l,
295
- baseURLOverride: v
296
- });
297
- for await (const C of m)
298
- r.raw.write(`data: ${JSON.stringify(C)}
299
-
300
- `);
301
- } catch (m) {
302
- const C = {
303
- type: "error",
304
- data: { message: m instanceof Error ? m.message : "Stream failed" }
305
- };
306
- r.raw.write(`data: ${JSON.stringify(C)}
307
-
308
- `);
309
- } finally {
310
- r.raw.end();
311
- }
312
- } catch (e) {
313
- if (t.log.error(e, "Agent chat error"), !r.raw.headersSent)
314
- return r.status(500).send({
315
- error: e instanceof Error ? e.message : "Agent chat failed"
316
- });
317
- }
318
- }), S.enabled !== !1) {
319
- const t = S.basePath ?? "/mcp";
320
- i.post(`${t}`, {
321
- bodyLimit: g,
322
- schema: {
323
- body: {
324
- type: "object",
325
- additionalProperties: !0
326
- }
327
- }
328
- }, async (r, e) => {
329
- const a = D(
330
- r.headers.origin,
331
- S.allowedOrigins ? { allowedOrigins: S.allowedOrigins } : {}
332
- );
333
- if (!a.valid)
334
- return e.status(403).send(E(null, -32600, a.reason));
335
- const n = r.headers.accept;
336
- if (!T(n))
337
- return e.status(400).send(E(null, -32600, "Accept header must include both application/json and text/event-stream"));
338
- const o = V(r.headers);
339
- if (!o.ok)
340
- return e.status(426).send({
341
- error: "Unsupported MCP protocol version",
342
- supported: o.supported
343
- });
344
- const s = z(r.body);
345
- if (!s)
346
- return e.status(400).send(E(null, -32600, "Invalid JSON-RPC 2.0 request"));
347
- const u = _(n), w = s.method === "initialize";
348
- try {
349
- const l = await B(
350
- s.method,
351
- s.params,
352
- {
353
- semanticLayer: c,
354
- extractSecurityContext: y,
355
- rawRequest: r,
356
- rawResponse: e,
357
- negotiatedProtocol: o.negotiated
358
- }
359
- );
360
- if (j(s))
361
- return e.status(202).send();
362
- const v = w && l && typeof l == "object" && "sessionId" in l ? l.sessionId : void 0;
363
- v && e.header(F, v);
364
- const b = U(s.id ?? null, l);
365
- if (u) {
366
- const f = P();
367
- e.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${f}
368
-
369
- ${Q(b, f)}`);
370
- return;
371
- }
372
- return e.send(b);
373
- } catch (l) {
374
- if (j(s))
375
- return r.log.error(l, "MCP notification processing error"), e.status(202).send();
376
- r.log.error(l, "MCP RPC error");
377
- const v = l?.code ?? -32603, b = l?.data, f = l.message || "MCP request failed", m = E(s.id ?? null, v, f, b);
378
- if (u) {
379
- const C = P();
380
- e.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${C}
381
-
382
- ${Q(m, C)}`);
383
- return;
384
- }
385
- return e.send(m);
386
- }
387
- }), i.get(`${t}`, async (r, e) => {
388
- const a = P();
389
- e.raw.writeHead(200, {
390
- "Content-Type": "text/event-stream",
391
- "Cache-Control": "no-cache",
392
- Connection: "keep-alive"
393
- }), e.raw.write(Q({
394
- jsonrpc: "2.0",
395
- method: "mcp/ready",
396
- params: { protocol: "streamable-http" }
397
- }, a, 15e3));
398
- const n = setInterval(() => {
399
- e.raw.write(`: keep-alive
400
-
401
- `);
402
- }, 15e3);
403
- r.raw.on("close", () => {
404
- clearInterval(n);
405
- });
406
- }), i.delete(`${t}`, async (r, e) => e.status(405).send({ error: "Session termination not supported" }));
407
- }
408
- i.setErrorHandler(async (t, r, e) => {
409
- r.log.error(t, "Fastify cube adapter error"), e.statusCode < 400 && e.status(500);
410
- const a = t instanceof Error ? t : String(t);
411
- return d(a, e.statusCode);
412
- }), $();
1
+ import { a as e, f as t, g as n, i as r, o as i, r as a, u as o } from "../utils-ChhNGUOF.js";
2
+ import { c as s, d as c, f as l, h as u, i as d, l as f, m as p, n as m, p as h, r as g, s as _, t as v, u as y } from "../mcp-transport-CuugoG8t.js";
3
+ //#region src/adapters/fastify/index.ts
4
+ var b = function(n, b, x) {
5
+ let { cubes: S, drizzle: C, schema: w, extractSecurityContext: T, engineType: E, cors: D, basePath: O = "/cubejs-api/v1", bodyLimit: k = 10485760, cache: A, mcp: j = { enabled: !0 }, agent: M } = b;
6
+ if (!S || S.length === 0) return x(/* @__PURE__ */ Error("At least one cube must be provided in the cubes array"));
7
+ D && n.register(import("@fastify/cors"), D), n.addHook("onRequest", async (e, t) => {
8
+ e.method === "POST" && (e.body = void 0);
9
+ });
10
+ let N = new u({
11
+ drizzle: C,
12
+ schema: w,
13
+ engineType: E,
14
+ cache: A
15
+ });
16
+ if (S.forEach((e) => {
17
+ N.registerCube(e);
18
+ }), n.post(`${O}/load`, {
19
+ bodyLimit: k,
20
+ schema: { body: {
21
+ type: "object",
22
+ additionalProperties: !0
23
+ } }
24
+ }, async (e, t) => {
25
+ try {
26
+ let n = e.body, i = n.query || n, o = await T(e), s = N.validateQuery(i);
27
+ if (!s.isValid) return t.status(400).send(r(`Query validation failed: ${s.errors.join(", ")}`, 400));
28
+ let c = e.headers["x-cache-control"] === "no-cache";
29
+ return a(i, await N.executeMultiCubeQuery(i, o, { skipCache: c }), N);
30
+ } catch (n) {
31
+ return e.log.error(n, "Query execution error"), t.status(500).send(r(n instanceof Error ? n.message : "Query execution failed", 500));
32
+ }
33
+ }), n.get(`${O}/load`, { schema: { querystring: {
34
+ type: "object",
35
+ properties: { query: { type: "string" } },
36
+ required: ["query"]
37
+ } } }, async (e, t) => {
38
+ try {
39
+ let { query: n } = e.query, i;
40
+ try {
41
+ i = JSON.parse(n);
42
+ } catch {
43
+ return t.status(400).send(r("Invalid JSON in query parameter", 400));
44
+ }
45
+ let o = await T(e), s = N.validateQuery(i);
46
+ if (!s.isValid) return t.status(400).send(r(`Query validation failed: ${s.errors.join(", ")}`, 400));
47
+ let c = e.headers["x-cache-control"] === "no-cache", l = await N.executeMultiCubeQuery(i, o, { skipCache: c });
48
+ return a(i, l, N);
49
+ } catch (n) {
50
+ return e.log.error(n, "Query execution error"), t.status(500).send(r(n instanceof Error ? n.message : "Query execution failed", 500));
51
+ }
52
+ }), n.post(`${O}/batch`, {
53
+ bodyLimit: k,
54
+ schema: { body: {
55
+ type: "object",
56
+ required: ["queries"],
57
+ properties: { queries: {
58
+ type: "array",
59
+ items: { type: "object" }
60
+ } }
61
+ } }
62
+ }, async (e, t) => {
63
+ try {
64
+ let { queries: n } = e.body;
65
+ return !n || !Array.isArray(n) ? t.status(400).send(r("Request body must contain a \"queries\" array", 400)) : n.length === 0 ? t.status(400).send(r("Queries array cannot be empty", 400)) : await o(n, await T(e), N, { skipCache: e.headers["x-cache-control"] === "no-cache" });
66
+ } catch (n) {
67
+ return e.log.error(n, "Batch execution error"), t.status(500).send(r(n instanceof Error ? n.message : "Batch execution failed", 500));
68
+ }
69
+ }), n.get(`${O}/meta`, async (t, n) => {
70
+ try {
71
+ return e(N.getMetadata());
72
+ } catch (e) {
73
+ return t.log.error(e, "Metadata error"), n.status(500).send(r(e instanceof Error ? e.message : "Failed to fetch metadata", 500));
74
+ }
75
+ }), n.post(`${O}/sql`, {
76
+ bodyLimit: k,
77
+ schema: { body: {
78
+ type: "object",
79
+ additionalProperties: !0
80
+ } }
81
+ }, async (e, t) => {
82
+ try {
83
+ let n = e.body, a = await T(e), o = N.validateQuery(n);
84
+ if (!o.isValid) return t.status(400).send(r(`Query validation failed: ${o.errors.join(", ")}`, 400));
85
+ let s = n.measures?.[0] || n.dimensions?.[0];
86
+ if (!s) return t.status(400).send(r("No measures or dimensions specified", 400));
87
+ let c = s.split(".")[0];
88
+ return i(n, await N.generateSQL(c, n, a));
89
+ } catch (n) {
90
+ return e.log.error(n, "SQL generation error"), t.status(500).send(r(n instanceof Error ? n.message : "SQL generation failed", 500));
91
+ }
92
+ }), n.get(`${O}/sql`, { schema: { querystring: {
93
+ type: "object",
94
+ properties: { query: { type: "string" } },
95
+ required: ["query"]
96
+ } } }, async (e, t) => {
97
+ try {
98
+ let { query: n } = e.query, a = JSON.parse(n), o = await T(e), s = N.validateQuery(a);
99
+ if (!s.isValid) return t.status(400).send(r(`Query validation failed: ${s.errors.join(", ")}`, 400));
100
+ let c = a.measures?.[0] || a.dimensions?.[0];
101
+ if (!c) return t.status(400).send(r("No measures or dimensions specified", 400));
102
+ let l = c.split(".")[0];
103
+ return i(a, await N.generateSQL(l, a, o));
104
+ } catch (n) {
105
+ return e.log.error(n, "SQL generation error"), t.status(500).send(r(n instanceof Error ? n.message : "SQL generation failed", 500));
106
+ }
107
+ }), n.post(`${O}/dry-run`, {
108
+ bodyLimit: k,
109
+ schema: { body: {
110
+ type: "object",
111
+ additionalProperties: !0
112
+ } }
113
+ }, async (e, n) => {
114
+ try {
115
+ let n = e.body;
116
+ return await t(n.query || n, await T(e), N);
117
+ } catch (t) {
118
+ return e.log.error(t, "Dry-run error"), n.status(400).send({
119
+ error: t instanceof Error ? t.message : "Dry-run validation failed",
120
+ valid: !1
121
+ });
122
+ }
123
+ }), n.get(`${O}/dry-run`, { schema: { querystring: {
124
+ type: "object",
125
+ properties: { query: { type: "string" } },
126
+ required: ["query"]
127
+ } } }, async (e, n) => {
128
+ try {
129
+ let { query: n } = e.query;
130
+ return await t(JSON.parse(n), await T(e), N);
131
+ } catch (t) {
132
+ return e.log.error(t, "Dry-run error"), n.status(400).send({
133
+ error: t instanceof Error ? t.message : "Dry-run validation failed",
134
+ valid: !1
135
+ });
136
+ }
137
+ }), n.post(`${O}/explain`, {
138
+ bodyLimit: k,
139
+ schema: { body: {
140
+ type: "object",
141
+ additionalProperties: !0
142
+ } }
143
+ }, async (e, t) => {
144
+ try {
145
+ let n = e.body, r = n.query || n, i = n.options || {}, a = await T(e), o = N.validateQuery(r);
146
+ return o.isValid ? await N.explainQuery(r, a, i) : t.status(400).send({ error: `Query validation failed: ${o.errors.join(", ")}` });
147
+ } catch (n) {
148
+ return e.log.error(n, "Explain error"), t.status(500).send({ error: n instanceof Error ? n.message : "Explain query failed" });
149
+ }
150
+ }), M && n.post(`${O}/agent/chat`, {
151
+ bodyLimit: k,
152
+ schema: { body: {
153
+ type: "object",
154
+ additionalProperties: !0
155
+ } }
156
+ }, async (e, t) => {
157
+ try {
158
+ let { handleAgentChat: n } = await import("../handler-D-2-6uLM.js"), { message: r, sessionId: i, history: a } = e.body;
159
+ if (!r || typeof r != "string") return t.status(400).send({ error: "message is required and must be a string" });
160
+ let o = (M.apiKey || "").trim();
161
+ if (M.allowClientApiKey) {
162
+ let t = e.headers["x-agent-api-key"];
163
+ t && (o = t.trim());
164
+ }
165
+ 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." });
166
+ let s = M.allowClientApiKey ? e.headers["x-agent-provider"] : void 0, c = M.allowClientApiKey ? e.headers["x-agent-model"] : void 0, l = M.allowClientApiKey ? e.headers["x-agent-provider-endpoint"] : void 0, u = await T(e), d = M.buildSystemContext?.(u);
167
+ t.raw.writeHead(200, {
168
+ "Content-Type": "text/event-stream",
169
+ "Cache-Control": "no-cache",
170
+ Connection: "keep-alive"
171
+ });
172
+ try {
173
+ let e = n({
174
+ message: r,
175
+ sessionId: i,
176
+ history: a,
177
+ semanticLayer: N,
178
+ securityContext: u,
179
+ agentConfig: M,
180
+ apiKey: o,
181
+ systemContext: d,
182
+ providerOverride: s,
183
+ modelOverride: c,
184
+ baseURLOverride: l
185
+ });
186
+ for await (let n of e) t.raw.write(`data: ${JSON.stringify(n)}\n\n`);
187
+ } catch (e) {
188
+ let n = {
189
+ type: "error",
190
+ data: { message: e instanceof Error ? e.message : "Stream failed" }
191
+ };
192
+ t.raw.write(`data: ${JSON.stringify(n)}\n\n`);
193
+ } finally {
194
+ t.raw.end();
195
+ }
196
+ } catch (n) {
197
+ 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" });
198
+ }
199
+ }), j.enabled !== !1) {
200
+ let e = j.basePath ?? "/mcp";
201
+ n.post(`${e}`, {
202
+ bodyLimit: k,
203
+ schema: { body: {
204
+ type: "object",
205
+ additionalProperties: !0
206
+ } }
207
+ }, async (e, t) => {
208
+ let n = h(e.headers.origin, j.allowedOrigins ? { allowedOrigins: j.allowedOrigins } : {});
209
+ if (!n.valid) return t.status(403).send(m(null, -32600, n.reason));
210
+ let r = e.headers.accept;
211
+ if (!l(r)) return t.status(400).send(m(null, -32600, "Accept header must include both application/json and text/event-stream"));
212
+ let i = s(e.headers);
213
+ if (!i.ok) return t.status(426).send({
214
+ error: "Unsupported MCP protocol version",
215
+ supported: i.supported
216
+ });
217
+ let a = f(e.body);
218
+ if (!a) return t.status(400).send(m(null, -32600, "Invalid JSON-RPC 2.0 request"));
219
+ let o = p(r), u = a.method === "initialize";
220
+ try {
221
+ let n = await d(a.method, a.params, {
222
+ semanticLayer: N,
223
+ extractSecurityContext: T,
224
+ rawRequest: e,
225
+ rawResponse: t,
226
+ negotiatedProtocol: i.negotiated
227
+ });
228
+ if (_(a)) return t.status(202).send();
229
+ let r = u && n && typeof n == "object" && "sessionId" in n ? n.sessionId : void 0;
230
+ r && t.header(v, r);
231
+ let s = g(a.id ?? null, n);
232
+ if (o) {
233
+ let e = y();
234
+ t.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${e}\n\n${c(s, e)}`);
235
+ return;
236
+ }
237
+ return t.send(s);
238
+ } catch (n) {
239
+ if (_(a)) return e.log.error(n, "MCP notification processing error"), t.status(202).send();
240
+ e.log.error(n, "MCP RPC error");
241
+ let r = n?.code ?? -32603, i = n?.data, s = n.message || "MCP request failed", l = m(a.id ?? null, r, s, i);
242
+ if (o) {
243
+ let e = y();
244
+ t.header("Content-Type", "text/event-stream").header("Cache-Control", "no-cache").header("Connection", "keep-alive").send(`id: ${e}\n\n${c(l, e)}`);
245
+ return;
246
+ }
247
+ return t.send(l);
248
+ }
249
+ }), n.get(`${e}`, async (e, t) => {
250
+ let n = y();
251
+ t.raw.writeHead(200, {
252
+ "Content-Type": "text/event-stream",
253
+ "Cache-Control": "no-cache",
254
+ Connection: "keep-alive"
255
+ }), t.raw.write(c({
256
+ jsonrpc: "2.0",
257
+ method: "mcp/ready",
258
+ params: { protocol: "streamable-http" }
259
+ }, n, 15e3));
260
+ let r = setInterval(() => {
261
+ t.raw.write(": keep-alive\n\n");
262
+ }, 15e3);
263
+ e.raw.on("close", () => {
264
+ clearInterval(r);
265
+ });
266
+ }), n.delete(`${e}`, async (e, t) => t.status(405).send({ error: "Session termination not supported" }));
267
+ }
268
+ n.setErrorHandler(async (e, t, n) => (t.log.error(e, "Fastify cube adapter error"), n.statusCode < 400 && n.status(500), r(e instanceof Error ? e : String(e), n.statusCode))), x();
413
269
  };
414
- async function Z(x, i) {
415
- await x.register(M, i);
270
+ async function x(e, t) {
271
+ await e.register(b, t);
416
272
  }
417
- function ee(x) {
418
- const i = require("fastify")({
419
- logger: !0
420
- });
421
- return i.register(M, x), i;
273
+ function S(e) {
274
+ let t = n("fastify")({ logger: !0 });
275
+ return t.register(b, e), t;
422
276
  }
423
- export {
424
- ee as createCubeApp,
425
- M as cubePlugin,
426
- Z as registerCubeRoutes
427
- };
277
+ //#endregion
278
+ export { S as createCubeApp, b as cubePlugin, x as registerCubeRoutes };