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
@@ -0,0 +1,581 @@
1
+ //#region node_modules/@google/generative-ai/dist/index.mjs
2
+ var e;
3
+ (function(e) {
4
+ e.STRING = "string", e.NUMBER = "number", e.INTEGER = "integer", e.BOOLEAN = "boolean", e.ARRAY = "array", e.OBJECT = "object";
5
+ })(e ||= {});
6
+ var t;
7
+ (function(e) {
8
+ e.LANGUAGE_UNSPECIFIED = "language_unspecified", e.PYTHON = "python";
9
+ })(t ||= {});
10
+ var n;
11
+ (function(e) {
12
+ e.OUTCOME_UNSPECIFIED = "outcome_unspecified", e.OUTCOME_OK = "outcome_ok", e.OUTCOME_FAILED = "outcome_failed", e.OUTCOME_DEADLINE_EXCEEDED = "outcome_deadline_exceeded";
13
+ })(n ||= {});
14
+ var r = [
15
+ "user",
16
+ "model",
17
+ "function",
18
+ "system"
19
+ ], i;
20
+ (function(e) {
21
+ e.HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED", e.HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH", e.HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT", e.HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT", e.HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT", e.HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY";
22
+ })(i ||= {});
23
+ var a;
24
+ (function(e) {
25
+ e.HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED", e.BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE", e.BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE", e.BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH", e.BLOCK_NONE = "BLOCK_NONE";
26
+ })(a ||= {});
27
+ var o;
28
+ (function(e) {
29
+ e.HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED", e.NEGLIGIBLE = "NEGLIGIBLE", e.LOW = "LOW", e.MEDIUM = "MEDIUM", e.HIGH = "HIGH";
30
+ })(o ||= {});
31
+ var s;
32
+ (function(e) {
33
+ e.BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED", e.SAFETY = "SAFETY", e.OTHER = "OTHER";
34
+ })(s ||= {});
35
+ var c;
36
+ (function(e) {
37
+ e.FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED", e.STOP = "STOP", e.MAX_TOKENS = "MAX_TOKENS", e.SAFETY = "SAFETY", e.RECITATION = "RECITATION", e.LANGUAGE = "LANGUAGE", e.BLOCKLIST = "BLOCKLIST", e.PROHIBITED_CONTENT = "PROHIBITED_CONTENT", e.SPII = "SPII", e.MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL", e.OTHER = "OTHER";
38
+ })(c ||= {});
39
+ var l;
40
+ (function(e) {
41
+ e.TASK_TYPE_UNSPECIFIED = "TASK_TYPE_UNSPECIFIED", e.RETRIEVAL_QUERY = "RETRIEVAL_QUERY", e.RETRIEVAL_DOCUMENT = "RETRIEVAL_DOCUMENT", e.SEMANTIC_SIMILARITY = "SEMANTIC_SIMILARITY", e.CLASSIFICATION = "CLASSIFICATION", e.CLUSTERING = "CLUSTERING";
42
+ })(l ||= {});
43
+ var u;
44
+ (function(e) {
45
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.AUTO = "AUTO", e.ANY = "ANY", e.NONE = "NONE";
46
+ })(u ||= {});
47
+ var d;
48
+ (function(e) {
49
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.MODE_DYNAMIC = "MODE_DYNAMIC";
50
+ })(d ||= {});
51
+ var f = class extends Error {
52
+ constructor(e) {
53
+ super(`[GoogleGenerativeAI Error]: ${e}`);
54
+ }
55
+ }, p = class extends f {
56
+ constructor(e, t) {
57
+ super(e), this.response = t;
58
+ }
59
+ }, m = class extends f {
60
+ constructor(e, t, n, r) {
61
+ super(e), this.status = t, this.statusText = n, this.errorDetails = r;
62
+ }
63
+ }, h = class extends f {}, g = class extends f {}, ee = "https://generativelanguage.googleapis.com", _ = "v1beta", v = "0.24.1", te = "genai-js", y;
64
+ (function(e) {
65
+ e.GENERATE_CONTENT = "generateContent", e.STREAM_GENERATE_CONTENT = "streamGenerateContent", e.COUNT_TOKENS = "countTokens", e.EMBED_CONTENT = "embedContent", e.BATCH_EMBED_CONTENTS = "batchEmbedContents";
66
+ })(y ||= {});
67
+ var b = class {
68
+ constructor(e, t, n, r, i) {
69
+ this.model = e, this.task = t, this.apiKey = n, this.stream = r, this.requestOptions = i;
70
+ }
71
+ toString() {
72
+ let e = this.requestOptions?.apiVersion || _, t = `${this.requestOptions?.baseUrl || ee}/${e}/${this.model}:${this.task}`;
73
+ return this.stream && (t += "?alt=sse"), t;
74
+ }
75
+ };
76
+ function x(e) {
77
+ let t = [];
78
+ return e?.apiClient && t.push(e.apiClient), t.push(`${te}/${v}`), t.join(" ");
79
+ }
80
+ async function S(e) {
81
+ let t = new Headers();
82
+ t.append("Content-Type", "application/json"), t.append("x-goog-api-client", x(e.requestOptions)), t.append("x-goog-api-key", e.apiKey);
83
+ let n = e.requestOptions?.customHeaders;
84
+ if (n) {
85
+ if (!(n instanceof Headers)) try {
86
+ n = new Headers(n);
87
+ } catch (e) {
88
+ throw new h(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${e.message}`);
89
+ }
90
+ for (let [e, r] of n.entries()) {
91
+ if (e === "x-goog-api-key") throw new h(`Cannot set reserved header name ${e}`);
92
+ if (e === "x-goog-api-client") throw new h(`Header name ${e} can only be set using the apiClient field`);
93
+ t.append(e, r);
94
+ }
95
+ }
96
+ return t;
97
+ }
98
+ async function ne(e, t, n, r, i, a) {
99
+ let o = new b(e, t, n, r, a);
100
+ return {
101
+ url: o.toString(),
102
+ fetchOptions: Object.assign(Object.assign({}, D(a)), {
103
+ method: "POST",
104
+ headers: await S(o),
105
+ body: i
106
+ })
107
+ };
108
+ }
109
+ async function C(e, t, n, r, i, a = {}, o = fetch) {
110
+ let { url: s, fetchOptions: c } = await ne(e, t, n, r, i, a);
111
+ return w(s, c, o);
112
+ }
113
+ async function w(e, t, n = fetch) {
114
+ let r;
115
+ try {
116
+ r = await n(e, t);
117
+ } catch (t) {
118
+ T(t, e);
119
+ }
120
+ return r.ok || await E(r, e), r;
121
+ }
122
+ function T(e, t) {
123
+ let n = e;
124
+ throw n.name === "AbortError" ? (n = new g(`Request aborted when fetching ${t.toString()}: ${e.message}`), n.stack = e.stack) : e instanceof m || e instanceof h || (n = new f(`Error fetching from ${t.toString()}: ${e.message}`), n.stack = e.stack), n;
125
+ }
126
+ async function E(e, t) {
127
+ let n = "", r;
128
+ try {
129
+ let t = await e.json();
130
+ n = t.error.message, t.error.details && (n += ` ${JSON.stringify(t.error.details)}`, r = t.error.details);
131
+ } catch {}
132
+ throw new m(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${n}`, e.status, e.statusText, r);
133
+ }
134
+ function D(e) {
135
+ let t = {};
136
+ if (e?.signal !== void 0 || e?.timeout >= 0) {
137
+ let n = new AbortController();
138
+ e?.timeout >= 0 && setTimeout(() => n.abort(), e.timeout), e?.signal && e.signal.addEventListener("abort", () => {
139
+ n.abort();
140
+ }), t.signal = n.signal;
141
+ }
142
+ return t;
143
+ }
144
+ function O(e) {
145
+ return e.text = () => {
146
+ if (e.candidates && e.candidates.length > 0) {
147
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
148
+ return k(e);
149
+ } else if (e.promptFeedback) throw new p(`Text not available. ${M(e)}`, e);
150
+ return "";
151
+ }, e.functionCall = () => {
152
+ if (e.candidates && e.candidates.length > 0) {
153
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
154
+ return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."), A(e)[0];
155
+ } else if (e.promptFeedback) throw new p(`Function call not available. ${M(e)}`, e);
156
+ }, e.functionCalls = () => {
157
+ if (e.candidates && e.candidates.length > 0) {
158
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), j(e.candidates[0])) throw new p(`${M(e)}`, e);
159
+ return A(e);
160
+ } else if (e.promptFeedback) throw new p(`Function call not available. ${M(e)}`, e);
161
+ }, e;
162
+ }
163
+ function k(e) {
164
+ let t = [];
165
+ if (e.candidates?.[0].content?.parts) for (let n of e.candidates?.[0].content?.parts) n.text && t.push(n.text), n.executableCode && t.push("\n```" + n.executableCode.language + "\n" + n.executableCode.code + "\n```\n"), n.codeExecutionResult && t.push("\n```\n" + n.codeExecutionResult.output + "\n```\n");
166
+ return t.length > 0 ? t.join("") : "";
167
+ }
168
+ function A(e) {
169
+ let t = [];
170
+ if (e.candidates?.[0].content?.parts) for (let n of e.candidates?.[0].content?.parts) n.functionCall && t.push(n.functionCall);
171
+ if (t.length > 0) return t;
172
+ }
173
+ var re = [
174
+ c.RECITATION,
175
+ c.SAFETY,
176
+ c.LANGUAGE
177
+ ];
178
+ function j(e) {
179
+ return !!e.finishReason && re.includes(e.finishReason);
180
+ }
181
+ function M(e) {
182
+ let t = "";
183
+ if ((!e.candidates || e.candidates.length === 0) && e.promptFeedback) t += "Response was blocked", e.promptFeedback?.blockReason && (t += ` due to ${e.promptFeedback.blockReason}`), e.promptFeedback?.blockReasonMessage && (t += `: ${e.promptFeedback.blockReasonMessage}`);
184
+ else if (e.candidates?.[0]) {
185
+ let n = e.candidates[0];
186
+ j(n) && (t += `Candidate was blocked due to ${n.finishReason}`, n.finishMessage && (t += `: ${n.finishMessage}`));
187
+ }
188
+ return t;
189
+ }
190
+ function N(e) {
191
+ return this instanceof N ? (this.v = e, this) : new N(e);
192
+ }
193
+ function P(e, t, n) {
194
+ if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
195
+ var r = n.apply(e, t || []), i, a = [];
196
+ return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() {
197
+ return this;
198
+ }, i;
199
+ function o(e) {
200
+ r[e] && (i[e] = function(t) {
201
+ return new Promise(function(n, r) {
202
+ a.push([
203
+ e,
204
+ t,
205
+ n,
206
+ r
207
+ ]) > 1 || s(e, t);
208
+ });
209
+ });
210
+ }
211
+ function s(e, t) {
212
+ try {
213
+ c(r[e](t));
214
+ } catch (e) {
215
+ d(a[0][3], e);
216
+ }
217
+ }
218
+ function c(e) {
219
+ e.value instanceof N ? Promise.resolve(e.value.v).then(l, u) : d(a[0][2], e);
220
+ }
221
+ function l(e) {
222
+ s("next", e);
223
+ }
224
+ function u(e) {
225
+ s("throw", e);
226
+ }
227
+ function d(e, t) {
228
+ e(t), a.shift(), a.length && s(a[0][0], a[0][1]);
229
+ }
230
+ }
231
+ var F = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
232
+ function I(e) {
233
+ let [t, n] = z(e.body.pipeThrough(new TextDecoderStream("utf8", { fatal: !0 }))).tee();
234
+ return {
235
+ stream: R(t),
236
+ response: L(n)
237
+ };
238
+ }
239
+ async function L(e) {
240
+ let t = [], n = e.getReader();
241
+ for (;;) {
242
+ let { done: e, value: r } = await n.read();
243
+ if (e) return O(B(t));
244
+ t.push(r);
245
+ }
246
+ }
247
+ function R(e) {
248
+ return P(this, arguments, function* () {
249
+ let t = e.getReader();
250
+ for (;;) {
251
+ let { value: e, done: n } = yield N(t.read());
252
+ if (n) break;
253
+ yield yield N(O(e));
254
+ }
255
+ });
256
+ }
257
+ function z(e) {
258
+ let t = e.getReader();
259
+ return new ReadableStream({ start(e) {
260
+ let n = "";
261
+ return r();
262
+ function r() {
263
+ return t.read().then(({ value: t, done: i }) => {
264
+ if (i) {
265
+ if (n.trim()) {
266
+ e.error(new f("Failed to parse stream"));
267
+ return;
268
+ }
269
+ e.close();
270
+ return;
271
+ }
272
+ n += t;
273
+ let a = n.match(F), o;
274
+ for (; a;) {
275
+ try {
276
+ o = JSON.parse(a[1]);
277
+ } catch {
278
+ e.error(new f(`Error parsing JSON response: "${a[1]}"`));
279
+ return;
280
+ }
281
+ e.enqueue(o), n = n.substring(a[0].length), a = n.match(F);
282
+ }
283
+ return r();
284
+ }).catch((e) => {
285
+ let t = e;
286
+ throw t.stack = e.stack, t = t.name === "AbortError" ? new g("Request aborted when reading from the stream") : new f("Error reading from the stream"), t;
287
+ });
288
+ }
289
+ } });
290
+ }
291
+ function B(e) {
292
+ let t = { promptFeedback: e[e.length - 1]?.promptFeedback };
293
+ for (let n of e) {
294
+ if (n.candidates) {
295
+ let e = 0;
296
+ for (let r of n.candidates) if (t.candidates ||= [], t.candidates[e] || (t.candidates[e] = { index: e }), t.candidates[e].citationMetadata = r.citationMetadata, t.candidates[e].groundingMetadata = r.groundingMetadata, t.candidates[e].finishReason = r.finishReason, t.candidates[e].finishMessage = r.finishMessage, t.candidates[e].safetyRatings = r.safetyRatings, r.content && r.content.parts) {
297
+ t.candidates[e].content || (t.candidates[e].content = {
298
+ role: r.content.role || "user",
299
+ parts: []
300
+ });
301
+ let n = {};
302
+ for (let i of r.content.parts) i.text && (n.text = i.text), i.functionCall && (n.functionCall = i.functionCall), i.executableCode && (n.executableCode = i.executableCode), i.codeExecutionResult && (n.codeExecutionResult = i.codeExecutionResult), Object.keys(n).length === 0 && (n.text = ""), t.candidates[e].content.parts.push(n);
303
+ }
304
+ e++;
305
+ }
306
+ n.usageMetadata && (t.usageMetadata = n.usageMetadata);
307
+ }
308
+ return t;
309
+ }
310
+ async function V(e, t, n, r) {
311
+ return I(await C(t, y.STREAM_GENERATE_CONTENT, e, !0, JSON.stringify(n), r));
312
+ }
313
+ async function H(e, t, n, r) {
314
+ return { response: O(await (await C(t, y.GENERATE_CONTENT, e, !1, JSON.stringify(n), r)).json()) };
315
+ }
316
+ function U(e) {
317
+ if (e != null) {
318
+ if (typeof e == "string") return {
319
+ role: "system",
320
+ parts: [{ text: e }]
321
+ };
322
+ if (e.text) return {
323
+ role: "system",
324
+ parts: [e]
325
+ };
326
+ if (e.parts) return e.role ? e : {
327
+ role: "system",
328
+ parts: e.parts
329
+ };
330
+ }
331
+ }
332
+ function W(e) {
333
+ let t = [];
334
+ if (typeof e == "string") t = [{ text: e }];
335
+ else for (let n of e) typeof n == "string" ? t.push({ text: n }) : t.push(n);
336
+ return G(t);
337
+ }
338
+ function G(e) {
339
+ let t = {
340
+ role: "user",
341
+ parts: []
342
+ }, n = {
343
+ role: "function",
344
+ parts: []
345
+ }, r = !1, i = !1;
346
+ for (let a of e) "functionResponse" in a ? (n.parts.push(a), i = !0) : (t.parts.push(a), r = !0);
347
+ if (r && i) throw new f("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");
348
+ if (!r && !i) throw new f("No content is provided for sending chat message.");
349
+ return r ? t : n;
350
+ }
351
+ function K(e, t) {
352
+ let n = {
353
+ model: t?.model,
354
+ generationConfig: t?.generationConfig,
355
+ safetySettings: t?.safetySettings,
356
+ tools: t?.tools,
357
+ toolConfig: t?.toolConfig,
358
+ systemInstruction: t?.systemInstruction,
359
+ cachedContent: t?.cachedContent?.name,
360
+ contents: []
361
+ }, r = e.generateContentRequest != null;
362
+ if (e.contents) {
363
+ if (r) throw new h("CountTokensRequest must have one of contents or generateContentRequest, not both.");
364
+ n.contents = e.contents;
365
+ } else if (r) n = Object.assign(Object.assign({}, n), e.generateContentRequest);
366
+ else {
367
+ let t = W(e);
368
+ n.contents = [t];
369
+ }
370
+ return { generateContentRequest: n };
371
+ }
372
+ function q(e) {
373
+ let t;
374
+ return t = e.contents ? e : { contents: [W(e)] }, e.systemInstruction && (t.systemInstruction = U(e.systemInstruction)), t;
375
+ }
376
+ function J(e) {
377
+ return typeof e == "string" || Array.isArray(e) ? { content: W(e) } : e;
378
+ }
379
+ var Y = [
380
+ "text",
381
+ "inlineData",
382
+ "functionCall",
383
+ "functionResponse",
384
+ "executableCode",
385
+ "codeExecutionResult"
386
+ ], ie = {
387
+ user: ["text", "inlineData"],
388
+ function: ["functionResponse"],
389
+ model: [
390
+ "text",
391
+ "functionCall",
392
+ "executableCode",
393
+ "codeExecutionResult"
394
+ ],
395
+ system: ["text"]
396
+ };
397
+ function ae(e) {
398
+ let t = !1;
399
+ for (let n of e) {
400
+ let { role: e, parts: i } = n;
401
+ if (!t && e !== "user") throw new f(`First content should be with role 'user', got ${e}`);
402
+ if (!r.includes(e)) throw new f(`Each item should include role field. Got ${e} but valid roles are: ${JSON.stringify(r)}`);
403
+ if (!Array.isArray(i)) throw new f("Content should have 'parts' property with an array of Parts");
404
+ if (i.length === 0) throw new f("Each Content should have at least one part");
405
+ let a = {
406
+ text: 0,
407
+ inlineData: 0,
408
+ functionCall: 0,
409
+ functionResponse: 0,
410
+ fileData: 0,
411
+ executableCode: 0,
412
+ codeExecutionResult: 0
413
+ };
414
+ for (let e of i) for (let t of Y) t in e && (a[t] += 1);
415
+ let o = ie[e];
416
+ for (let t of Y) if (!o.includes(t) && a[t] > 0) throw new f(`Content with role '${e}' can't contain '${t}' part`);
417
+ t = !0;
418
+ }
419
+ }
420
+ function X(e) {
421
+ if (e.candidates === void 0 || e.candidates.length === 0) return !1;
422
+ let t = e.candidates[0]?.content;
423
+ if (t === void 0 || t.parts === void 0 || t.parts.length === 0) return !1;
424
+ for (let e of t.parts) if (e === void 0 || Object.keys(e).length === 0 || e.text !== void 0 && e.text === "") return !1;
425
+ return !0;
426
+ }
427
+ var Z = "SILENT_ERROR", Q = class {
428
+ constructor(e, t, n, r = {}) {
429
+ this.model = t, this.params = n, this._requestOptions = r, this._history = [], this._sendPromise = Promise.resolve(), this._apiKey = e, n?.history && (ae(n.history), this._history = n.history);
430
+ }
431
+ async getHistory() {
432
+ return await this._sendPromise, this._history;
433
+ }
434
+ async sendMessage(e, t = {}) {
435
+ await this._sendPromise;
436
+ let n = W(e), r = {
437
+ safetySettings: this.params?.safetySettings,
438
+ generationConfig: this.params?.generationConfig,
439
+ tools: this.params?.tools,
440
+ toolConfig: this.params?.toolConfig,
441
+ systemInstruction: this.params?.systemInstruction,
442
+ cachedContent: this.params?.cachedContent,
443
+ contents: [...this._history, n]
444
+ }, i = Object.assign(Object.assign({}, this._requestOptions), t), a;
445
+ return this._sendPromise = this._sendPromise.then(() => H(this._apiKey, this.model, r, i)).then((e) => {
446
+ if (X(e.response)) {
447
+ this._history.push(n);
448
+ let t = Object.assign({
449
+ parts: [],
450
+ role: "model"
451
+ }, e.response.candidates?.[0].content);
452
+ this._history.push(t);
453
+ } else {
454
+ let t = M(e.response);
455
+ t && console.warn(`sendMessage() was unsuccessful. ${t}. Inspect response object for details.`);
456
+ }
457
+ a = e;
458
+ }).catch((e) => {
459
+ throw this._sendPromise = Promise.resolve(), e;
460
+ }), await this._sendPromise, a;
461
+ }
462
+ async sendMessageStream(e, t = {}) {
463
+ await this._sendPromise;
464
+ let n = W(e), r = {
465
+ safetySettings: this.params?.safetySettings,
466
+ generationConfig: this.params?.generationConfig,
467
+ tools: this.params?.tools,
468
+ toolConfig: this.params?.toolConfig,
469
+ systemInstruction: this.params?.systemInstruction,
470
+ cachedContent: this.params?.cachedContent,
471
+ contents: [...this._history, n]
472
+ }, i = Object.assign(Object.assign({}, this._requestOptions), t), a = V(this._apiKey, this.model, r, i);
473
+ return this._sendPromise = this._sendPromise.then(() => a).catch((e) => {
474
+ throw Error(Z);
475
+ }).then((e) => e.response).then((e) => {
476
+ if (X(e)) {
477
+ this._history.push(n);
478
+ let t = Object.assign({}, e.candidates[0].content);
479
+ t.role ||= "model", this._history.push(t);
480
+ } else {
481
+ let t = M(e);
482
+ t && console.warn(`sendMessageStream() was unsuccessful. ${t}. Inspect response object for details.`);
483
+ }
484
+ }).catch((e) => {
485
+ e.message !== Z && console.error(e);
486
+ }), a;
487
+ }
488
+ };
489
+ async function oe(e, t, n, r) {
490
+ return (await C(t, y.COUNT_TOKENS, e, !1, JSON.stringify(n), r)).json();
491
+ }
492
+ async function se(e, t, n, r) {
493
+ return (await C(t, y.EMBED_CONTENT, e, !1, JSON.stringify(n), r)).json();
494
+ }
495
+ async function ce(e, t, n, r) {
496
+ let i = n.requests.map((e) => Object.assign(Object.assign({}, e), { model: t }));
497
+ return (await C(t, y.BATCH_EMBED_CONTENTS, e, !1, JSON.stringify({ requests: i }), r)).json();
498
+ }
499
+ var $ = class {
500
+ constructor(e, t, n = {}) {
501
+ this.apiKey = e, this._requestOptions = n, t.model.includes("/") ? this.model = t.model : this.model = `models/${t.model}`, this.generationConfig = t.generationConfig || {}, this.safetySettings = t.safetySettings || [], this.tools = t.tools, this.toolConfig = t.toolConfig, this.systemInstruction = U(t.systemInstruction), this.cachedContent = t.cachedContent;
502
+ }
503
+ async generateContent(e, t = {}) {
504
+ let n = q(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
505
+ return H(this.apiKey, this.model, Object.assign({
506
+ generationConfig: this.generationConfig,
507
+ safetySettings: this.safetySettings,
508
+ tools: this.tools,
509
+ toolConfig: this.toolConfig,
510
+ systemInstruction: this.systemInstruction,
511
+ cachedContent: this.cachedContent?.name
512
+ }, n), r);
513
+ }
514
+ async generateContentStream(e, t = {}) {
515
+ let n = q(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
516
+ return V(this.apiKey, this.model, Object.assign({
517
+ generationConfig: this.generationConfig,
518
+ safetySettings: this.safetySettings,
519
+ tools: this.tools,
520
+ toolConfig: this.toolConfig,
521
+ systemInstruction: this.systemInstruction,
522
+ cachedContent: this.cachedContent?.name
523
+ }, n), r);
524
+ }
525
+ startChat(e) {
526
+ return new Q(this.apiKey, this.model, Object.assign({
527
+ generationConfig: this.generationConfig,
528
+ safetySettings: this.safetySettings,
529
+ tools: this.tools,
530
+ toolConfig: this.toolConfig,
531
+ systemInstruction: this.systemInstruction,
532
+ cachedContent: this.cachedContent?.name
533
+ }, e), this._requestOptions);
534
+ }
535
+ async countTokens(e, t = {}) {
536
+ let n = K(e, {
537
+ model: this.model,
538
+ generationConfig: this.generationConfig,
539
+ safetySettings: this.safetySettings,
540
+ tools: this.tools,
541
+ toolConfig: this.toolConfig,
542
+ systemInstruction: this.systemInstruction,
543
+ cachedContent: this.cachedContent
544
+ }), r = Object.assign(Object.assign({}, this._requestOptions), t);
545
+ return oe(this.apiKey, this.model, n, r);
546
+ }
547
+ async embedContent(e, t = {}) {
548
+ let n = J(e), r = Object.assign(Object.assign({}, this._requestOptions), t);
549
+ return se(this.apiKey, this.model, n, r);
550
+ }
551
+ async batchEmbedContents(e, t = {}) {
552
+ let n = Object.assign(Object.assign({}, this._requestOptions), t);
553
+ return ce(this.apiKey, this.model, e, n);
554
+ }
555
+ }, le = class {
556
+ constructor(e) {
557
+ this.apiKey = e;
558
+ }
559
+ getGenerativeModel(e, t) {
560
+ if (!e.model) throw new f("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");
561
+ return new $(this.apiKey, e, t);
562
+ }
563
+ getGenerativeModelFromCachedContent(e, t, n) {
564
+ if (!e.name) throw new h("Cached content must contain a `name` field.");
565
+ if (!e.model) throw new h("Cached content must contain a `model` field.");
566
+ for (let n of ["model", "systemInstruction"]) if (t?.[n] && e[n] && t?.[n] !== e[n]) {
567
+ if (n === "model" && (t.model.startsWith("models/") ? t.model.replace("models/", "") : t.model) === (e.model.startsWith("models/") ? e.model.replace("models/", "") : e.model)) continue;
568
+ throw new h(`Different value for "${n}" specified in modelParams (${t[n]}) and cachedContent (${e[n]})`);
569
+ }
570
+ let r = Object.assign(Object.assign({}, t), {
571
+ model: e.model,
572
+ tools: e.tools,
573
+ toolConfig: e.toolConfig,
574
+ systemInstruction: e.systemInstruction,
575
+ cachedContent: e
576
+ });
577
+ return new $(this.apiKey, r, n);
578
+ }
579
+ };
580
+ //#endregion
581
+ export { s as BlockReason, Q as ChatSession, d as DynamicRetrievalMode, t as ExecutableCodeLanguage, c as FinishReason, u as FunctionCallingMode, $ as GenerativeModel, le as GoogleGenerativeAI, g as GoogleGenerativeAIAbortError, f as GoogleGenerativeAIError, m as GoogleGenerativeAIFetchError, h as GoogleGenerativeAIRequestInputError, p as GoogleGenerativeAIResponseError, a as HarmBlockThreshold, i as HarmCategory, o as HarmProbability, n as Outcome, r as POSSIBLE_ROLES, e as SchemaType, l as TaskType };
@@ -1,11 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("express"),H=require("cors"),c=require("../mcp-transport-DCiSGtp1.cjs"),n=require("../utils.cjs");function $(C){const{cubes:v,drizzle:x,schema:I,extractSecurityContext:y,engineType:P,cors:S,basePath:f="/cubejs-api/v1",jsonLimit:Q="10mb",cache:O,mcp:E={enabled:!0},agent:h}=C;if(!v||v.length===0)throw new Error("At least one cube must be provided in the cubes array");const d=w.Router();S&&d.use(H(S)),d.use(w.json({limit:Q})),d.use(w.urlencoded({extended:!0,limit:Q}));const u=new c.SemanticLayerCompiler({drizzle:x,schema:I,engineType:P,cache:O});if(v.forEach(r=>{u.registerCube(r)}),d.post(`${f}/load`,async(r,t)=>{try{const e=r.body.query||r.body,o=await y(r,t),s=u.validateQuery(e);if(!s.isValid)return t.status(400).json(n.formatErrorResponse(`Query validation failed: ${s.errors.join(", ")}`,400));const a=r.headers["x-cache-control"]==="no-cache",i=await u.executeMultiCubeQuery(e,o,{skipCache:a});t.json(n.formatCubeResponse(e,i,u))}catch(e){console.error("Query execution error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),d.get(`${f}/load`,async(r,t)=>{try{const e=r.query.query;if(!e)return t.status(400).json(n.formatErrorResponse("Query parameter is required",400));let o;try{o=JSON.parse(e)}catch{return t.status(400).json(n.formatErrorResponse("Invalid JSON in query parameter",400))}const s=await y(r,t),a=u.validateQuery(o);if(!a.isValid)return t.status(400).json(n.formatErrorResponse(`Query validation failed: ${a.errors.join(", ")}`,400));const i=r.headers["x-cache-control"]==="no-cache",m=await u.executeMultiCubeQuery(o,s,{skipCache:i});t.json(n.formatCubeResponse(o,m,u))}catch(e){console.error("Query execution error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"Query execution failed",500))}}),d.post(`${f}/batch`,async(r,t)=>{try{const{queries:e}=r.body;if(!e||!Array.isArray(e))return t.status(400).json(n.formatErrorResponse('Request body must contain a "queries" array',400));if(e.length===0)return t.status(400).json(n.formatErrorResponse("Queries array cannot be empty",400));const o=await y(r,t),s=r.headers["x-cache-control"]==="no-cache",a=await n.handleBatchRequest(e,o,u,{skipCache:s});t.json(a)}catch(e){console.error("Batch execution error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"Batch execution failed",500))}}),d.get(`${f}/meta`,(r,t)=>{try{const e=u.getMetadata();t.json(n.formatMetaResponse(e))}catch(e){console.error("Metadata error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"Failed to fetch metadata",500))}}),d.post(`${f}/sql`,async(r,t)=>{try{const e=r.body,o=await y(r,t),s=u.validateQuery(e);if(!s.isValid)return t.status(400).json(n.formatErrorResponse(`Query validation failed: ${s.errors.join(", ")}`,400));const a=e.measures?.[0]||e.dimensions?.[0];if(!a)return t.status(400).json(n.formatErrorResponse("No measures or dimensions specified",400));const i=a.split(".")[0],m=await u.generateSQL(i,e,o);t.json(n.formatSqlResponse(e,m))}catch(e){console.error("SQL generation error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),d.get(`${f}/sql`,async(r,t)=>{try{const e=r.query.query;if(!e)return t.status(400).json(n.formatErrorResponse("Query parameter is required",400));const o=JSON.parse(e),s=await y(r,t),a=u.validateQuery(o);if(!a.isValid)return t.status(400).json(n.formatErrorResponse(`Query validation failed: ${a.errors.join(", ")}`,400));const i=o.measures?.[0]||o.dimensions?.[0];if(!i)return t.status(400).json(n.formatErrorResponse("No measures or dimensions specified",400));const m=i.split(".")[0],R=await u.generateSQL(m,o,s);t.json(n.formatSqlResponse(o,R))}catch(e){console.error("SQL generation error:",e),t.status(500).json(n.formatErrorResponse(e instanceof Error?e.message:"SQL generation failed",500))}}),d.post(`${f}/dry-run`,async(r,t)=>{try{const e=r.body.query||r.body,o=await y(r,t),s=await n.handleDryRun(e,o,u);t.json(s)}catch(e){console.error("Dry-run error:",e),t.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),d.get(`${f}/dry-run`,async(r,t)=>{try{const e=r.query.query;if(!e)return t.status(400).json({error:"Query parameter is required",valid:!1});const o=JSON.parse(e),s=await y(r,t),a=await n.handleDryRun(o,s,u);t.json(a)}catch(e){console.error("Dry-run error:",e),t.status(400).json({error:e instanceof Error?e.message:"Dry-run validation failed",valid:!1})}}),d.post(`${f}/explain`,async(r,t)=>{try{const e=r.body.query||r.body,o=r.body.options||{},s=await y(r,t),a=u.validateQuery(e);if(!a.isValid)return t.status(400).json({error:`Query validation failed: ${a.errors.join(", ")}`});const i=await u.explainQuery(e,s,o);t.json(i)}catch(e){console.error("Explain error:",e),t.status(500).json({error:e instanceof Error?e.message:"Explain query failed"})}}),h&&d.post(`${f}/agent/chat`,async(r,t)=>{try{const{handleAgentChat:e}=await Promise.resolve().then(()=>require("../handler-LMRPeTNJ.cjs")),{message:o,sessionId:s,history:a}=r.body;if(!o||typeof o!="string")return t.status(400).json({error:"message is required and must be a string"});let i=(h.apiKey||"").trim();if(h.allowClientApiKey){const p=r.headers["x-agent-api-key"];p&&(i=p.trim())}if(!i)return t.status(401).json({error:"No API key configured. Set agent.apiKey in server config or send X-Agent-Api-Key header."});const m=h.allowClientApiKey?r.headers["x-agent-provider"]:void 0,R=h.allowClientApiKey?r.headers["x-agent-model"]:void 0,l=h.allowClientApiKey?r.headers["x-agent-provider-endpoint"]:void 0,g=await y(r,t),b=h.buildSystemContext?.(g);t.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"});try{const p=e({message:o,sessionId:s,history:a,semanticLayer:u,securityContext:g,agentConfig:h,apiKey:i,systemContext:b,providerOverride:m,modelOverride:R,baseURLOverride:l});for await(const j of p)t.write(`data: ${JSON.stringify(j)}
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../utils-CwJplXR5.cjs`),t=require(`../mcp-transport-Dpp6hdZe.cjs`);let n=require(`express`);n=e.g(n);let r=require(`cors`);r=e.g(r);function i(i){let{cubes:a,drizzle:o,schema:s,extractSecurityContext:c,engineType:l,cors:u,basePath:d=`/cubejs-api/v1`,jsonLimit:f=`10mb`,cache:p,mcp:m={enabled:!0},agent:h}=i;if(!a||a.length===0)throw Error(`At least one cube must be provided in the cubes array`);let g=(0,n.Router)();u&&g.use((0,r.default)(u)),g.use(n.default.json({limit:f})),g.use(n.default.urlencoded({extended:!0,limit:f}));let _=new t.h({drizzle:o,schema:s,engineType:l,cache:p});if(a.forEach(e=>{_.registerCube(e)}),g.post(`${d}/load`,async(t,n)=>{try{let r=t.body.query||t.body,i=await c(t,n),a=_.validateQuery(r);if(!a.isValid)return n.status(400).json(e.i(`Query validation failed: ${a.errors.join(`, `)}`,400));let o=t.headers[`x-cache-control`]===`no-cache`,s=await _.executeMultiCubeQuery(r,i,{skipCache:o});n.json(e.r(r,s,_))}catch(t){console.error(`Query execution error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`Query execution failed`,500))}}),g.get(`${d}/load`,async(t,n)=>{try{let r=t.query.query;if(!r)return n.status(400).json(e.i(`Query parameter is required`,400));let i;try{i=JSON.parse(r)}catch{return n.status(400).json(e.i(`Invalid JSON in query parameter`,400))}let a=await c(t,n),o=_.validateQuery(i);if(!o.isValid)return n.status(400).json(e.i(`Query validation failed: ${o.errors.join(`, `)}`,400));let s=t.headers[`x-cache-control`]===`no-cache`,l=await _.executeMultiCubeQuery(i,a,{skipCache:s});n.json(e.r(i,l,_))}catch(t){console.error(`Query execution error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`Query execution failed`,500))}}),g.post(`${d}/batch`,async(t,n)=>{try{let{queries:r}=t.body;if(!r||!Array.isArray(r))return n.status(400).json(e.i(`Request body must contain a "queries" array`,400));if(r.length===0)return n.status(400).json(e.i(`Queries array cannot be empty`,400));let i=await e.u(r,await c(t,n),_,{skipCache:t.headers[`x-cache-control`]===`no-cache`});n.json(i)}catch(t){console.error(`Batch execution error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`Batch execution failed`,500))}}),g.get(`${d}/meta`,(t,n)=>{try{let t=_.getMetadata();n.json(e.a(t))}catch(t){console.error(`Metadata error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`Failed to fetch metadata`,500))}}),g.post(`${d}/sql`,async(t,n)=>{try{let r=t.body,i=await c(t,n),a=_.validateQuery(r);if(!a.isValid)return n.status(400).json(e.i(`Query validation failed: ${a.errors.join(`, `)}`,400));let o=r.measures?.[0]||r.dimensions?.[0];if(!o)return n.status(400).json(e.i(`No measures or dimensions specified`,400));let s=o.split(`.`)[0],l=await _.generateSQL(s,r,i);n.json(e.o(r,l))}catch(t){console.error(`SQL generation error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`SQL generation failed`,500))}}),g.get(`${d}/sql`,async(t,n)=>{try{let r=t.query.query;if(!r)return n.status(400).json(e.i(`Query parameter is required`,400));let i=JSON.parse(r),a=await c(t,n),o=_.validateQuery(i);if(!o.isValid)return n.status(400).json(e.i(`Query validation failed: ${o.errors.join(`, `)}`,400));let s=i.measures?.[0]||i.dimensions?.[0];if(!s)return n.status(400).json(e.i(`No measures or dimensions specified`,400));let l=s.split(`.`)[0],u=await _.generateSQL(l,i,a);n.json(e.o(i,u))}catch(t){console.error(`SQL generation error:`,t),n.status(500).json(e.i(t instanceof Error?t.message:`SQL generation failed`,500))}}),g.post(`${d}/dry-run`,async(t,n)=>{try{let r=await e.f(t.body.query||t.body,await c(t,n),_);n.json(r)}catch(e){console.error(`Dry-run error:`,e),n.status(400).json({error:e instanceof Error?e.message:`Dry-run validation failed`,valid:!1})}}),g.get(`${d}/dry-run`,async(t,n)=>{try{let r=t.query.query;if(!r)return n.status(400).json({error:`Query parameter is required`,valid:!1});let i=await e.f(JSON.parse(r),await c(t,n),_);n.json(i)}catch(e){console.error(`Dry-run error:`,e),n.status(400).json({error:e instanceof Error?e.message:`Dry-run validation failed`,valid:!1})}}),g.post(`${d}/explain`,async(e,t)=>{try{let n=e.body.query||e.body,r=e.body.options||{},i=await c(e,t),a=_.validateQuery(n);if(!a.isValid)return t.status(400).json({error:`Query validation failed: ${a.errors.join(`, `)}`});let o=await _.explainQuery(n,i,r);t.json(o)}catch(e){console.error(`Explain error:`,e),t.status(500).json({error:e instanceof Error?e.message:`Explain query failed`})}}),h&&g.post(`${d}/agent/chat`,async(e,t)=>{try{let{handleAgentChat:n}=await Promise.resolve().then(()=>require(`../handler-B8vuFQYP.cjs`)),{message:r,sessionId:i,history:a}=e.body;if(!r||typeof r!=`string`)return t.status(400).json({error:`message is required and must be a string`});let o=(h.apiKey||``).trim();if(h.allowClientApiKey){let t=e.headers[`x-agent-api-key`];t&&(o=t.trim())}if(!o)return t.status(401).json({error:`No API key configured. Set agent.apiKey in server config or send X-Agent-Api-Key header.`});let s=h.allowClientApiKey?e.headers[`x-agent-provider`]:void 0,l=h.allowClientApiKey?e.headers[`x-agent-model`]:void 0,u=h.allowClientApiKey?e.headers[`x-agent-provider-endpoint`]:void 0,d=await c(e,t),f=h.buildSystemContext?.(d);t.writeHead(200,{"Content-Type":`text/event-stream`,"Cache-Control":`no-cache`,Connection:`keep-alive`});try{let e=n({message:r,sessionId:i,history:a,semanticLayer:_,securityContext:d,agentConfig:h,apiKey:o,systemContext:f,providerOverride:s,modelOverride:l,baseURLOverride:u});for await(let n of e)t.write(`data: ${JSON.stringify(n)}\n\n`)}catch(e){let n={type:`error`,data:{message:e instanceof Error?e.message:`Stream failed`}};t.write(`data: ${JSON.stringify(n)}\n\n`)}finally{t.end()}}catch(e){console.error(`Agent chat error:`,e),t.headersSent||t.status(500).json({error:e instanceof Error?e.message:`Agent chat failed`})}}),m.enabled!==!1){let e=m.basePath??`/mcp`;g.post(`${e}`,async(e,n)=>{let r=t.p(e.headers.origin,m.allowedOrigins?{allowedOrigins:m.allowedOrigins}:{});if(!r.valid)return n.status(403).json(t.n(null,-32600,r.reason));let i=e.headers.accept;if(!t.f(i))return n.status(400).json(t.n(null,-32600,`Accept header must include both application/json and text/event-stream`));let a=t.c(e.headers);if(!a.ok)return n.status(426).json({error:`Unsupported MCP protocol version`,supported:a.supported});let o=t.l(e.body);if(!o)return n.status(400).json(t.n(null,-32600,`Invalid JSON-RPC 2.0 request`));let s=t.m(i),l=o.method===`initialize`;try{let r=await t.i(o.method,o.params,{semanticLayer:_,extractSecurityContext:c,rawRequest:e,rawResponse:n,negotiatedProtocol:a.negotiated});if(t.s(o))return n.status(202).end();let i=l&&r&&typeof r==`object`&&`sessionId`in r?r.sessionId:void 0;i&&n.setHeader(t.t,i);let u=t.r(o.id??null,r);if(s){let e=t.u();return n.status(200),n.setHeader(`Content-Type`,`text/event-stream`),n.setHeader(`Cache-Control`,`no-cache`),n.setHeader(`Connection`,`keep-alive`),n.write(`id: ${e}\n\n`),n.write(t.d(u,e)),n.end()}return n.json(u)}catch(e){if(t.s(o))return console.error(`MCP notification processing error:`,e),n.status(202).end();console.error(`MCP RPC error:`,e);let r=e?.code??-32603,i=e?.data,a=e.message||`MCP request failed`,c=t.n(o.id??null,r,a,i);if(s){let e=t.u();return n.status(200),n.setHeader(`Content-Type`,`text/event-stream`),n.setHeader(`Cache-Control`,`no-cache`),n.setHeader(`Connection`,`keep-alive`),n.write(`id: ${e}\n\n`),n.write(t.d(c,e)),n.end()}return n.status(200).json(c)}}),g.get(`${e}`,async(e,n)=>{let r=t.u();n.status(200),n.setHeader(`Content-Type`,`text/event-stream`),n.setHeader(`Cache-Control`,`no-cache`),n.setHeader(`Connection`,`keep-alive`),n.write(t.d({jsonrpc:`2.0`,method:`mcp/ready`,params:{protocol:`streamable-http`}},r,15e3));let i=setInterval(()=>{n.write(`: keep-alive
2
2
 
3
- `)}catch(p){const j={type:"error",data:{message:p instanceof Error?p.message:"Stream failed"}};t.write(`data: ${JSON.stringify(j)}
4
-
5
- `)}finally{t.end()}}catch(e){console.error("Agent chat error:",e),t.headersSent||t.status(500).json({error:e instanceof Error?e.message:"Agent chat failed"})}}),E.enabled!==!1){const r=E.basePath??"/mcp";d.post(`${r}`,async(t,e)=>{const o=c.validateOriginHeader(t.headers.origin,E.allowedOrigins?{allowedOrigins:E.allowedOrigins}:{});if(!o.valid)return e.status(403).json(c.buildJsonRpcError(null,-32600,o.reason));const s=t.headers.accept;if(!c.validateAcceptHeader(s))return e.status(400).json(c.buildJsonRpcError(null,-32600,"Accept header must include both application/json and text/event-stream"));const a=c.negotiateProtocol(t.headers);if(!a.ok)return e.status(426).json({error:"Unsupported MCP protocol version",supported:a.supported});const i=c.parseJsonRpc(t.body);if(!i)return e.status(400).json(c.buildJsonRpcError(null,-32600,"Invalid JSON-RPC 2.0 request"));const m=c.wantsEventStream(s),R=i.method==="initialize";try{const l=await c.dispatchMcpMethod(i.method,i.params,{semanticLayer:u,extractSecurityContext:y,rawRequest:t,rawResponse:e,negotiatedProtocol:a.negotiated});if(c.isNotification(i))return e.status(202).end();const g=R&&l&&typeof l=="object"&&"sessionId"in l?l.sessionId:void 0;g&&e.setHeader(c.MCP_SESSION_ID_HEADER,g);const b=c.buildJsonRpcResult(i.id??null,l);if(m){const p=c.primeEventId();return e.status(200),e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.write(`id: ${p}
6
-
7
- `),e.write(c.serializeSseEvent(b,p)),e.end()}return e.json(b)}catch(l){if(c.isNotification(i))return console.error("MCP notification processing error:",l),e.status(202).end();console.error("MCP RPC error:",l);const g=l?.code??-32603,b=l?.data,p=l.message||"MCP request failed",j=c.buildJsonRpcError(i.id??null,g,p,b);if(m){const q=c.primeEventId();return e.status(200),e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.write(`id: ${q}
8
-
9
- `),e.write(c.serializeSseEvent(j,q)),e.end()}return e.status(200).json(j)}}),d.get(`${r}`,async(t,e)=>{const o=c.primeEventId();e.status(200),e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.write(c.serializeSseEvent({jsonrpc:"2.0",method:"mcp/ready",params:{protocol:"streamable-http"}},o,15e3));const s=setInterval(()=>{e.write(`: keep-alive
10
-
11
- `)},15e3);t.on("close",()=>{clearInterval(s)})}),d.delete(`${r}`,(t,e)=>e.status(405).json({error:"Session termination not supported"}))}return d.use((r,t,e,o)=>{console.error("Express adapter error:",r),e.headersSent||e.status(500).json(n.formatErrorResponse(r,500))}),d}function A(C,v){const x=$(v);return C.use("/",x),C}function M(C){const v=w();return A(v,C)}exports.createCubeApp=M;exports.createCubeRouter=$;exports.mountCubeRoutes=A;
3
+ `)},15e3);e.on(`close`,()=>{clearInterval(i)})}),g.delete(`${e}`,(e,t)=>t.status(405).json({error:`Session termination not supported`}))}return g.use((t,n,r,i)=>{console.error(`Express adapter error:`,t),r.headersSent||r.status(500).json(e.i(t,500))}),g}function a(e,t){let n=i(t);return e.use(`/`,n),e}function o(e){return a((0,n.default)(),e)}exports.createCubeApp=o,exports.createCubeRouter=i,exports.mountCubeRoutes=a;