@sqlrooms/mosaic 0.29.0-rc.5 → 0.29.0-rc.6

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 (334) hide show
  1. package/README.md +43 -39
  2. package/dist/DataPointLimitError.d.ts +9 -0
  3. package/dist/DataPointLimitError.d.ts.map +1 -0
  4. package/dist/DataPointLimitError.js +14 -0
  5. package/dist/DataPointLimitError.js.map +1 -0
  6. package/dist/MosaicSlice.d.ts.map +1 -1
  7. package/dist/MosaicSlice.js +3 -3
  8. package/dist/MosaicSlice.js.map +1 -1
  9. package/dist/VgPlotChart.d.ts +8 -11
  10. package/dist/VgPlotChart.d.ts.map +1 -1
  11. package/dist/VgPlotChart.js +74 -90
  12. package/dist/VgPlotChart.js.map +1 -1
  13. package/dist/VgPlotChartError.d.ts +7 -0
  14. package/dist/VgPlotChartError.d.ts.map +1 -0
  15. package/dist/VgPlotChartError.js +9 -0
  16. package/dist/VgPlotChartError.js.map +1 -0
  17. package/dist/ai.d.ts +103 -0
  18. package/dist/ai.d.ts.map +1 -0
  19. package/dist/ai.js +445 -0
  20. package/dist/ai.js.map +1 -0
  21. package/dist/boxplot/BoxPlotClient.d.ts +7 -0
  22. package/dist/boxplot/BoxPlotClient.d.ts.map +1 -1
  23. package/dist/boxplot/BoxPlotClient.js +22 -0
  24. package/dist/boxplot/BoxPlotClient.js.map +1 -1
  25. package/dist/chart/ChartRuntimeIssuePanel.d.ts +7 -0
  26. package/dist/chart/ChartRuntimeIssuePanel.d.ts.map +1 -0
  27. package/dist/chart/ChartRuntimeIssuePanel.js +10 -0
  28. package/dist/chart/ChartRuntimeIssuePanel.js.map +1 -0
  29. package/dist/chart/MosaicDashboardChart.d.ts +1 -1
  30. package/dist/chart/MosaicDashboardChart.d.ts.map +1 -1
  31. package/dist/chart/MosaicDashboardChart.js +1 -1
  32. package/dist/chart/MosaicDashboardChart.js.map +1 -1
  33. package/dist/chart/MosaicDashboardChartContent.d.ts +1 -1
  34. package/dist/chart/MosaicDashboardChartContent.d.ts.map +1 -1
  35. package/dist/chart/MosaicDashboardChartContent.js +29 -2
  36. package/dist/chart/MosaicDashboardChartContent.js.map +1 -1
  37. package/dist/chart/MosaicDashboardChartRenderer.d.ts +2 -1
  38. package/dist/chart/MosaicDashboardChartRenderer.d.ts.map +1 -1
  39. package/dist/chart/MosaicDashboardChartRenderer.js +2 -2
  40. package/dist/chart/MosaicDashboardChartRenderer.js.map +1 -1
  41. package/dist/chart/MosaicDashboardComponentChart.d.ts +5 -1
  42. package/dist/chart/MosaicDashboardComponentChart.d.ts.map +1 -1
  43. package/dist/chart/MosaicDashboardComponentChart.js +4 -1
  44. package/dist/chart/MosaicDashboardComponentChart.js.map +1 -1
  45. package/dist/chart/MosaicDashboardVgPlotChart.d.ts +4 -0
  46. package/dist/chart/MosaicDashboardVgPlotChart.d.ts.map +1 -1
  47. package/dist/chart/MosaicDashboardVgPlotChart.js +2 -2
  48. package/dist/chart/MosaicDashboardVgPlotChart.js.map +1 -1
  49. package/dist/chart/addChartPanelAction.d.ts +3 -0
  50. package/dist/chart/addChartPanelAction.d.ts.map +1 -0
  51. package/dist/chart/addChartPanelAction.js +14 -0
  52. package/dist/chart/addChartPanelAction.js.map +1 -0
  53. package/dist/chart/chart-settings/ChartSettings.d.ts.map +1 -1
  54. package/dist/chart/chart-settings/ChartSettings.js +7 -4
  55. package/dist/chart/chart-settings/ChartSettings.js.map +1 -1
  56. package/dist/chart/chart-settings/ChartSettingsContent.d.ts +1 -1
  57. package/dist/chart/chart-settings/ChartSettingsContent.d.ts.map +1 -1
  58. package/dist/chart/chart-settings/ChartSettingsContent.js.map +1 -1
  59. package/dist/chart/chart-settings/ChartSettingsContext.d.ts +0 -2
  60. package/dist/chart/chart-settings/ChartSettingsContext.d.ts.map +1 -1
  61. package/dist/chart/chart-settings/ChartSettingsContext.js +6 -7
  62. package/dist/chart/chart-settings/ChartSettingsContext.js.map +1 -1
  63. package/dist/chart/chart-settings/ChartSettingsPanel.d.ts +1 -1
  64. package/dist/chart/chart-settings/ChartSettingsPanel.d.ts.map +1 -1
  65. package/dist/chart/chart-settings/ChartSettingsPanel.js +1 -1
  66. package/dist/chart/chart-settings/ChartSettingsPanel.js.map +1 -1
  67. package/dist/chart/chart-settings/ChartTypeSelector.d.ts.map +1 -1
  68. package/dist/chart/chart-settings/ChartTypeSelector.js +5 -5
  69. package/dist/chart/chart-settings/ChartTypeSelector.js.map +1 -1
  70. package/dist/chart-builders/ColumnSelector.d.ts +0 -2
  71. package/dist/chart-builders/ColumnSelector.d.ts.map +1 -1
  72. package/dist/chart-builders/ColumnSelector.js +4 -5
  73. package/dist/chart-builders/ColumnSelector.js.map +1 -1
  74. package/dist/chart-builders/ColumnsContext.d.ts +13 -0
  75. package/dist/chart-builders/ColumnsContext.d.ts.map +1 -0
  76. package/dist/chart-builders/ColumnsContext.js +15 -0
  77. package/dist/chart-builders/ColumnsContext.js.map +1 -0
  78. package/dist/chart-builders/MultiFieldSelector.js +4 -4
  79. package/dist/chart-builders/MultiFieldSelector.js.map +1 -1
  80. package/dist/chart-builders/TableSelector.d.ts +14 -0
  81. package/dist/chart-builders/TableSelector.d.ts.map +1 -0
  82. package/dist/chart-builders/TableSelector.js +23 -0
  83. package/dist/chart-builders/TableSelector.js.map +1 -0
  84. package/dist/chart-runtime.d.ts +50 -0
  85. package/dist/chart-runtime.d.ts.map +1 -0
  86. package/dist/chart-runtime.js +76 -0
  87. package/dist/chart-runtime.js.map +1 -0
  88. package/dist/chart-types/base-types.d.ts +45 -25
  89. package/dist/chart-types/base-types.d.ts.map +1 -1
  90. package/dist/chart-types/base-types.js.map +1 -1
  91. package/dist/chart-types/box-plot/definition.d.ts.map +1 -1
  92. package/dist/chart-types/box-plot/definition.js +5 -0
  93. package/dist/chart-types/box-plot/definition.js.map +1 -1
  94. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.d.ts.map +1 -1
  95. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +4 -1
  96. package/dist/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -1
  97. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +4 -0
  98. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -1
  99. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js +13 -2
  100. package/dist/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -1
  101. package/dist/chart-types/box-plot/schema.d.ts +5 -0
  102. package/dist/chart-types/box-plot/schema.d.ts.map +1 -1
  103. package/dist/chart-types/box-plot/schema.js +2 -0
  104. package/dist/chart-types/box-plot/schema.js.map +1 -1
  105. package/dist/chart-types/box-plot/tool.d.ts +5 -9
  106. package/dist/chart-types/box-plot/tool.d.ts.map +1 -1
  107. package/dist/chart-types/box-plot/tool.js +14 -6
  108. package/dist/chart-types/box-plot/tool.js.map +1 -1
  109. package/dist/chart-types/bubble-chart/definition.d.ts.map +1 -1
  110. package/dist/chart-types/bubble-chart/definition.js +5 -0
  111. package/dist/chart-types/bubble-chart/definition.js.map +1 -1
  112. package/dist/chart-types/bubble-chart/schema.d.ts +5 -0
  113. package/dist/chart-types/bubble-chart/schema.d.ts.map +1 -1
  114. package/dist/chart-types/bubble-chart/schema.js +2 -0
  115. package/dist/chart-types/bubble-chart/schema.js.map +1 -1
  116. package/dist/chart-types/bubble-chart/tool.d.ts +5 -9
  117. package/dist/chart-types/bubble-chart/tool.d.ts.map +1 -1
  118. package/dist/chart-types/bubble-chart/tool.js +17 -9
  119. package/dist/chart-types/bubble-chart/tool.js.map +1 -1
  120. package/dist/chart-types/chart-config.d.ts +46 -0
  121. package/dist/chart-types/chart-config.d.ts.map +1 -1
  122. package/dist/chart-types/chart-config.js +2 -0
  123. package/dist/chart-types/chart-config.js.map +1 -1
  124. package/dist/chart-types/count-plot/schema.d.ts +5 -0
  125. package/dist/chart-types/count-plot/schema.d.ts.map +1 -1
  126. package/dist/chart-types/count-plot/schema.js +2 -0
  127. package/dist/chart-types/count-plot/schema.js.map +1 -1
  128. package/dist/chart-types/count-plot/tool.d.ts +5 -9
  129. package/dist/chart-types/count-plot/tool.d.ts.map +1 -1
  130. package/dist/chart-types/count-plot/tool.js +14 -6
  131. package/dist/chart-types/count-plot/tool.js.map +1 -1
  132. package/dist/chart-types/custom-spec/definition.d.ts.map +1 -1
  133. package/dist/chart-types/custom-spec/definition.js +5 -0
  134. package/dist/chart-types/custom-spec/definition.js.map +1 -1
  135. package/dist/chart-types/custom-spec/schema.d.ts +5 -0
  136. package/dist/chart-types/custom-spec/schema.d.ts.map +1 -1
  137. package/dist/chart-types/custom-spec/schema.js +2 -0
  138. package/dist/chart-types/custom-spec/schema.js.map +1 -1
  139. package/dist/chart-types/data-policy-schema.d.ts +8 -0
  140. package/dist/chart-types/data-policy-schema.d.ts.map +1 -0
  141. package/dist/chart-types/data-policy-schema.js +7 -0
  142. package/dist/chart-types/data-policy-schema.js.map +1 -0
  143. package/dist/chart-types/heatmap/schema.d.ts +5 -0
  144. package/dist/chart-types/heatmap/schema.d.ts.map +1 -1
  145. package/dist/chart-types/heatmap/schema.js +2 -0
  146. package/dist/chart-types/heatmap/schema.js.map +1 -1
  147. package/dist/chart-types/heatmap/tool.d.ts +5 -9
  148. package/dist/chart-types/heatmap/tool.d.ts.map +1 -1
  149. package/dist/chart-types/heatmap/tool.js +16 -8
  150. package/dist/chart-types/heatmap/tool.js.map +1 -1
  151. package/dist/chart-types/histogram/HistogramSettings.d.ts.map +1 -1
  152. package/dist/chart-types/histogram/HistogramSettings.js +4 -2
  153. package/dist/chart-types/histogram/HistogramSettings.js.map +1 -1
  154. package/dist/chart-types/histogram/schema.d.ts +10 -0
  155. package/dist/chart-types/histogram/schema.d.ts.map +1 -1
  156. package/dist/chart-types/histogram/schema.js +13 -0
  157. package/dist/chart-types/histogram/schema.js.map +1 -1
  158. package/dist/chart-types/histogram/spec.d.ts +1 -1
  159. package/dist/chart-types/histogram/spec.d.ts.map +1 -1
  160. package/dist/chart-types/histogram/spec.js +4 -3
  161. package/dist/chart-types/histogram/spec.js.map +1 -1
  162. package/dist/chart-types/histogram/tool.d.ts +7 -9
  163. package/dist/chart-types/histogram/tool.d.ts.map +1 -1
  164. package/dist/chart-types/histogram/tool.js +17 -7
  165. package/dist/chart-types/histogram/tool.js.map +1 -1
  166. package/dist/chart-types/index.d.ts +45 -3
  167. package/dist/chart-types/index.d.ts.map +1 -1
  168. package/dist/chart-types/index.js +8 -2
  169. package/dist/chart-types/index.js.map +1 -1
  170. package/dist/chart-types/line-chart/LineChartSettings.d.ts.map +1 -1
  171. package/dist/chart-types/line-chart/LineChartSettings.js +3 -1
  172. package/dist/chart-types/line-chart/LineChartSettings.js.map +1 -1
  173. package/dist/chart-types/line-chart/definition.d.ts.map +1 -1
  174. package/dist/chart-types/line-chart/definition.js +7 -0
  175. package/dist/chart-types/line-chart/definition.js.map +1 -1
  176. package/dist/chart-types/line-chart/schema.d.ts +5 -0
  177. package/dist/chart-types/line-chart/schema.d.ts.map +1 -1
  178. package/dist/chart-types/line-chart/schema.js +2 -0
  179. package/dist/chart-types/line-chart/schema.js.map +1 -1
  180. package/dist/chart-types/line-chart/tool.d.ts +5 -9
  181. package/dist/chart-types/line-chart/tool.d.ts.map +1 -1
  182. package/dist/chart-types/line-chart/tool.js +16 -8
  183. package/dist/chart-types/line-chart/tool.js.map +1 -1
  184. package/dist/chart-types/list-panels-tool.d.ts +35 -0
  185. package/dist/chart-types/list-panels-tool.d.ts.map +1 -0
  186. package/dist/chart-types/list-panels-tool.js +66 -0
  187. package/dist/chart-types/list-panels-tool.js.map +1 -0
  188. package/dist/chart-types/profiler-tool.d.ts +40 -0
  189. package/dist/chart-types/profiler-tool.d.ts.map +1 -0
  190. package/dist/chart-types/profiler-tool.js +73 -0
  191. package/dist/chart-types/profiler-tool.js.map +1 -0
  192. package/dist/chart-types/remove-panel-tool.d.ts +31 -0
  193. package/dist/chart-types/remove-panel-tool.d.ts.map +1 -0
  194. package/dist/chart-types/remove-panel-tool.js +55 -0
  195. package/dist/chart-types/remove-panel-tool.js.map +1 -0
  196. package/dist/chart-types/text-panel-tool.d.ts +42 -0
  197. package/dist/chart-types/text-panel-tool.d.ts.map +1 -0
  198. package/dist/chart-types/text-panel-tool.js +71 -0
  199. package/dist/chart-types/text-panel-tool.js.map +1 -0
  200. package/dist/chart-types/tool-helpers.d.ts +44 -0
  201. package/dist/chart-types/tool-helpers.d.ts.map +1 -0
  202. package/dist/chart-types/tool-helpers.js +129 -0
  203. package/dist/chart-types/tool-helpers.js.map +1 -0
  204. package/dist/chart-types/tool-schemas.d.ts +1 -0
  205. package/dist/chart-types/tool-schemas.d.ts.map +1 -1
  206. package/dist/chart-types/tool-schemas.js +5 -1
  207. package/dist/chart-types/tool-schemas.js.map +1 -1
  208. package/dist/dashboard/MosaicDashboard.d.ts +5 -2
  209. package/dist/dashboard/MosaicDashboard.d.ts.map +1 -1
  210. package/dist/dashboard/MosaicDashboard.js +20 -39
  211. package/dist/dashboard/MosaicDashboard.js.map +1 -1
  212. package/dist/dashboard/MosaicDashboardContext.d.ts +2 -0
  213. package/dist/dashboard/MosaicDashboardContext.d.ts.map +1 -1
  214. package/dist/dashboard/MosaicDashboardContext.js.map +1 -1
  215. package/dist/dashboard/MosaicDashboardEmptyState.d.ts.map +1 -1
  216. package/dist/dashboard/MosaicDashboardEmptyState.js +8 -44
  217. package/dist/dashboard/MosaicDashboardEmptyState.js.map +1 -1
  218. package/dist/dashboard/MosaicDashboardPanel.d.ts.map +1 -1
  219. package/dist/dashboard/MosaicDashboardPanel.js +2 -5
  220. package/dist/dashboard/MosaicDashboardPanel.js.map +1 -1
  221. package/dist/dashboard/MosaicDashboardPanelHeader.d.ts +2 -2
  222. package/dist/dashboard/MosaicDashboardPanelHeader.d.ts.map +1 -1
  223. package/dist/dashboard/MosaicDashboardPanelHeader.js +2 -2
  224. package/dist/dashboard/MosaicDashboardPanelHeader.js.map +1 -1
  225. package/dist/dashboard/MosaicDashboardPanels.d.ts.map +1 -1
  226. package/dist/dashboard/MosaicDashboardPanels.js +3 -2
  227. package/dist/dashboard/MosaicDashboardPanels.js.map +1 -1
  228. package/dist/dashboard/MosaicDashboardSlice.d.ts +185 -107
  229. package/dist/dashboard/MosaicDashboardSlice.d.ts.map +1 -1
  230. package/dist/dashboard/MosaicDashboardSlice.js +80 -57
  231. package/dist/dashboard/MosaicDashboardSlice.js.map +1 -1
  232. package/dist/dashboard/action-types.d.ts +25 -0
  233. package/dist/dashboard/action-types.d.ts.map +1 -0
  234. package/dist/dashboard/action-types.js +5 -0
  235. package/dist/dashboard/action-types.js.map +1 -0
  236. package/dist/dashboard/core-types.d.ts +26 -0
  237. package/dist/dashboard/core-types.d.ts.map +1 -0
  238. package/dist/dashboard/core-types.js +21 -0
  239. package/dist/dashboard/core-types.js.map +1 -0
  240. package/dist/dashboard/dashboard-types.d.ts +491 -0
  241. package/dist/dashboard/dashboard-types.d.ts.map +1 -0
  242. package/dist/dashboard/dashboard-types.js +54 -0
  243. package/dist/dashboard/dashboard-types.js.map +1 -0
  244. package/dist/dashboard/defaultPanelActions.d.ts +3 -0
  245. package/dist/dashboard/defaultPanelActions.d.ts.map +1 -0
  246. package/dist/dashboard/defaultPanelActions.js +9 -0
  247. package/dist/dashboard/defaultPanelActions.js.map +1 -0
  248. package/dist/dashboard/defaultPanelRenderers.d.ts.map +1 -1
  249. package/dist/dashboard/defaultPanelRenderers.js +1 -1
  250. package/dist/dashboard/defaultPanelRenderers.js.map +1 -1
  251. package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.d.ts +6 -0
  252. package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.d.ts.map +1 -0
  253. package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.js +46 -0
  254. package/dist/dashboard/initial-state/BuildDashboardManuallyPanel.js.map +1 -0
  255. package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.d.ts +7 -0
  256. package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.d.ts.map +1 -0
  257. package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.js +29 -0
  258. package/dist/dashboard/initial-state/BuildDashboardWithAIPanel.js.map +1 -0
  259. package/dist/dashboard/initial-state/MosaicDashboardInitialState.d.ts +6 -0
  260. package/dist/dashboard/initial-state/MosaicDashboardInitialState.d.ts.map +1 -0
  261. package/dist/dashboard/initial-state/MosaicDashboardInitialState.js +9 -0
  262. package/dist/dashboard/initial-state/MosaicDashboardInitialState.js.map +1 -0
  263. package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.d.ts +7 -0
  264. package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.d.ts.map +1 -0
  265. package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js +12 -0
  266. package/dist/dashboard/toolbar/MosaicDashboardAddPanelDropdown.js.map +1 -0
  267. package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.d.ts +7 -0
  268. package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.d.ts.map +1 -0
  269. package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js +36 -0
  270. package/dist/dashboard/toolbar/MosaicDashboardResetFiltersButton.js.map +1 -0
  271. package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -0
  272. package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +15 -0
  273. package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -0
  274. package/dist/dashboard/useAddPanelActions.d.ts +10 -0
  275. package/dist/dashboard/useAddPanelActions.d.ts.map +1 -0
  276. package/dist/dashboard/useAddPanelActions.js +26 -0
  277. package/dist/dashboard/useAddPanelActions.js.map +1 -0
  278. package/dist/dashboard/useMosaicDashboardAddPanelActionContext.d.ts +3 -0
  279. package/dist/dashboard/useMosaicDashboardAddPanelActionContext.d.ts.map +1 -0
  280. package/dist/dashboard/useMosaicDashboardAddPanelActionContext.js +18 -0
  281. package/dist/dashboard/useMosaicDashboardAddPanelActionContext.js.map +1 -0
  282. package/dist/dashboard/useSelectedOrFirstTable.d.ts +10 -0
  283. package/dist/dashboard/useSelectedOrFirstTable.d.ts.map +1 -0
  284. package/dist/dashboard/useSelectedOrFirstTable.js +25 -0
  285. package/dist/dashboard/useSelectedOrFirstTable.js.map +1 -0
  286. package/dist/dashboard/useTablesWithColumns.d.ts +9 -0
  287. package/dist/dashboard/useTablesWithColumns.d.ts.map +1 -0
  288. package/dist/dashboard/useTablesWithColumns.js +13 -0
  289. package/dist/dashboard/useTablesWithColumns.js.map +1 -0
  290. package/dist/index.d.ts +25 -4
  291. package/dist/index.d.ts.map +1 -1
  292. package/dist/index.js +22 -2
  293. package/dist/index.js.map +1 -1
  294. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts +2 -1
  295. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.d.ts.map +1 -1
  296. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js +3 -3
  297. package/dist/profiler/MosaicDashboardProfilerPanelRenderer.js.map +1 -1
  298. package/dist/profiler/addProfilerPanelAction.d.ts +3 -0
  299. package/dist/profiler/addProfilerPanelAction.d.ts.map +1 -0
  300. package/dist/profiler/addProfilerPanelAction.js +9 -0
  301. package/dist/profiler/addProfilerPanelAction.js.map +1 -0
  302. package/dist/text/MosaicDashboardTextRenderer.d.ts +2 -1
  303. package/dist/text/MosaicDashboardTextRenderer.d.ts.map +1 -1
  304. package/dist/text/MosaicDashboardTextRenderer.js +4 -4
  305. package/dist/text/MosaicDashboardTextRenderer.js.map +1 -1
  306. package/dist/text/addTextPanelAction.d.ts +3 -0
  307. package/dist/text/addTextPanelAction.d.ts.map +1 -0
  308. package/dist/text/addTextPanelAction.js +9 -0
  309. package/dist/text/addTextPanelAction.js.map +1 -0
  310. package/dist/useMosaicClient.d.ts +4 -0
  311. package/dist/useMosaicClient.d.ts.map +1 -1
  312. package/dist/useMosaicClient.js +33 -3
  313. package/dist/useMosaicClient.js.map +1 -1
  314. package/dist/useVgPlotChartError.d.ts +13 -0
  315. package/dist/useVgPlotChartError.d.ts.map +1 -0
  316. package/dist/useVgPlotChartError.js +18 -0
  317. package/dist/useVgPlotChartError.js.map +1 -0
  318. package/dist/useVgPlotChartRender.d.ts +24 -0
  319. package/dist/useVgPlotChartRender.d.ts.map +1 -0
  320. package/dist/useVgPlotChartRender.js +152 -0
  321. package/dist/useVgPlotChartRender.js.map +1 -0
  322. package/dist/useVgPlotChartRetention.d.ts +21 -0
  323. package/dist/useVgPlotChartRetention.d.ts.map +1 -0
  324. package/dist/useVgPlotChartRetention.js +63 -0
  325. package/dist/useVgPlotChartRetention.js.map +1 -0
  326. package/dist/wrapCoordinatorWithValidation.d.ts +11 -0
  327. package/dist/wrapCoordinatorWithValidation.d.ts.map +1 -0
  328. package/dist/wrapCoordinatorWithValidation.js +23 -0
  329. package/dist/wrapCoordinatorWithValidation.js.map +1 -0
  330. package/package.json +31 -13
  331. package/dist/dashboard/MosaicDashboardToolbar.d.ts.map +0 -1
  332. package/dist/dashboard/MosaicDashboardToolbar.js +0 -86
  333. package/dist/dashboard/MosaicDashboardToolbar.js.map +0 -1
  334. /package/dist/dashboard/{MosaicDashboardToolbar.d.ts → toolbar/MosaicDashboardToolbar.d.ts} +0 -0
@@ -3,6 +3,7 @@ import { BoxPlotChartSettings } from './schema';
3
3
  import { BaseChartToolParameters } from '../tool-schemas';
4
4
  import { validateColumnExists } from '../tool-validation';
5
5
  import { NUMERIC_COLUMN_TYPES, CATEGORICAL_COLUMN_TYPES, } from '../../chart-builders/constants';
6
+ import { createOrUpdateChartPanel } from '../tool-helpers';
6
7
  export const BoxPlotToolParameters = BaseChartToolParameters.extend({
7
8
  settings: BoxPlotChartSettings.required(),
8
9
  });
@@ -17,30 +18,37 @@ Required:
17
18
  - x: categorical/grouping column (${CATEGORICAL_COLUMN_TYPES.join(', ')}) - e.g., region, terrain type, zone classification
18
19
  - y: numeric (${NUMERIC_COLUMN_TYPES.join(', ')})
19
20
 
21
+ NOTE: Box plots aggregate data by computing quartiles and outliers per group, so they handle large datasets efficiently (no data point limit).
22
+
23
+ To UPDATE an existing box plot: provide the panelId parameter. Otherwise creates new panel.
24
+
20
25
  Best for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.
21
26
 
22
27
  Do NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,
23
28
  inputSchema: BoxPlotToolParameters,
24
29
  execute: async (params, context) => {
25
30
  try {
26
- const { artifactId, tableName, columns } = deps.resolveResources(params, context);
31
+ const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing, context);
32
+ const { tableName, columns } = deps.resolveTable(artifactId, params.tableName);
27
33
  // Validate settings
28
34
  validateColumnExists(params.settings.x, CATEGORICAL_COLUMN_TYPES, columns, 'x');
29
35
  validateColumnExists(params.settings.y, NUMERIC_COLUMN_TYPES, columns, 'y');
30
- const title = `Box plot - ${params.settings.y} by ${params.settings.x}`;
31
- const result = deps.createChart({
32
- artifactId,
36
+ const result = createOrUpdateChartPanel(deps, {
37
+ panelId: params.panelId,
38
+ dashboardId: artifactId,
33
39
  tableName,
40
+ title: `Box plot - ${params.settings.y} by ${params.settings.x}`,
34
41
  config: {
35
42
  chartType: 'box-plot',
36
43
  settings: params.settings,
37
44
  },
38
- title,
39
45
  });
40
46
  return {
41
47
  llmResult: {
42
48
  success: true,
43
- details: `Created box plot "${result.title}".`,
49
+ details: params.panelId
50
+ ? `Updated box plot "${result.title}".`
51
+ : `Created box plot "${result.title}".`,
44
52
  data: result,
45
53
  },
46
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,o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MAAM,CAAC,KAAK,IAAI;wBAC9C,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {BoxPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../tool-schemas';\nimport {type ChartToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {\n NUMERIC_COLUMN_TYPES,\n CATEGORICAL_COLUMN_TYPES,\n} from '../../chart-builders/constants';\n\nexport const BoxPlotToolParameters = BaseChartToolParameters.extend({\n settings: BoxPlotChartSettings.required(),\n});\n\nexport type BoxPlotToolParams = z.infer<typeof BoxPlotToolParameters>;\n\nexport function createBoxPlotAiTool(deps: ChartToolDeps) {\n return tool({\n description: `Box plot: compares distributions of numeric values across categories. Shows median, quartiles (25th, 75th percentiles), and outliers per group.\n\nUse when: user asks to \"compare [numeric] across/by [category]\", \"distribution by group\", \"show outliers by\", \"compare ranges\".\nExample queries: \"compare population by administrative region\", \"show elevation distribution by terrain type\", \"parcel area range by zone\", \"compare building heights across districts\", \"temperature by climate zone\".\n\nRequired:\n- x: categorical/grouping column (${CATEGORICAL_COLUMN_TYPES.join(', ')}) - e.g., region, terrain type, zone classification\n- y: numeric (${NUMERIC_COLUMN_TYPES.join(', ')})\n\nBest for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.\n\nDo NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,\n inputSchema: BoxPlotToolParameters,\n execute: async (params, context) => {\n try {\n const {artifactId, tableName, columns} = deps.resolveResources(\n params,\n context,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.x,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'x',\n );\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const title = `Box plot - ${params.settings.y} by ${params.settings.x}`;\n\n const result = deps.createChart({\n artifactId,\n tableName,\n config: {\n chartType: 'box-plot',\n settings: params.settings,\n },\n title,\n });\n\n return {\n llmResult: {\n success: true,\n details: `Created box plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAC,wBAAwB,EAAC,MAAM,iBAAiB,CAAC;AAEzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAClE,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAIH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;;oCAMmB,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvD,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;mHAQoE;QAC/G,WAAW,EAAE,qBAAqB;QAClC,OAAO,EAAE,KAAK,EAAE,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C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {BoxPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {\n NUMERIC_COLUMN_TYPES,\n CATEGORICAL_COLUMN_TYPES,\n} from '../../chart-builders/constants';\nimport {createOrUpdateChartPanel} from '../tool-helpers';\n\nexport const BoxPlotToolParameters = BaseChartToolParameters.extend({\n settings: BoxPlotChartSettings.required(),\n});\n\nexport type BoxPlotToolParams = z.infer<typeof BoxPlotToolParameters>;\n\nexport function createBoxPlotAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Box plot: compares distributions of numeric values across categories. Shows median, quartiles (25th, 75th percentiles), and outliers per group.\n\nUse when: user asks to \"compare [numeric] across/by [category]\", \"distribution by group\", \"show outliers by\", \"compare ranges\".\nExample queries: \"compare population by administrative region\", \"show elevation distribution by terrain type\", \"parcel area range by zone\", \"compare building heights across districts\", \"temperature by climate zone\".\n\nRequired:\n- x: categorical/grouping column (${CATEGORICAL_COLUMN_TYPES.join(', ')}) - e.g., region, terrain type, zone classification\n- y: numeric (${NUMERIC_COLUMN_TYPES.join(', ')})\n\nNOTE: Box plots aggregate data by computing quartiles and outliers per group, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing box plot: provide the panelId parameter. Otherwise creates new panel.\n\nBest for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.\n\nDo NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,\n inputSchema: BoxPlotToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.x,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'x',\n );\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: `Box plot - ${params.settings.y} by ${params.settings.x}`,\n config: {\n chartType: 'box-plot',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated box plot \"${result.title}\".`\n : `Created box plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAsB,MAAM,UAAU,CAAC;AAShE,eAAO,MAAM,oBAAoB,EAAE,uBAAuB,CAAC,iBAAiB,CAWzE,CAAC"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAsB,MAAM,UAAU,CAAC;AAUhE,eAAO,MAAM,oBAAoB,EAAE,uBAAuB,CAAC,iBAAiB,CAgBzE,CAAC"}
@@ -4,6 +4,7 @@ import { BubbleChartSettingsComponent } from './BubbleChartSettings';
4
4
  import { createBubbleChartAiTool } from './tool';
5
5
  import { Workflow } from 'lucide-react';
6
6
  import { createBubbleChartSpec } from './spec';
7
+ import { DEFAULT_CHART_MAX_DATA_POINTS } from '../../chart-runtime';
7
8
  const DESCRIPTION = 'Create a bubble chart';
8
9
  export const bubbleChartChartType = {
9
10
  id: 'bubble-chart',
@@ -14,6 +15,10 @@ export const bubbleChartChartType = {
14
15
  settingsComponent: BubbleChartSettingsComponent,
15
16
  buildTitle: titleFromDescription(DESCRIPTION),
16
17
  createTool: createBubbleChartAiTool,
18
+ getDataPolicy: () => ({
19
+ maxRows: DEFAULT_CHART_MAX_DATA_POINTS,
20
+ reason: 'Bubble charts render one point per row. Use a heatmap or another aggregated chart for larger datasets.',
21
+ }),
17
22
  createSpec: createBubbleChartSpec,
18
23
  };
19
24
  //# sourceMappingURL=definition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAChE,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAC/B;IACE,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,mBAAmB;IAC3B,iBAAiB,EAAE,4BAA4B;IAC/C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import type {SpecChartTypeDefinition} from '../base-types';\nimport {BubbleChartConfig, BubbleChartSettings} from './schema';\nimport {titleFromDescription} from '../../chart-builders/chartTypeUtils';\nimport {BubbleChartSettingsComponent} from './BubbleChartSettings';\nimport {createBubbleChartAiTool} from './tool';\nimport {Workflow} from 'lucide-react';\nimport {createBubbleChartSpec} from './spec';\n\nconst DESCRIPTION = 'Create a bubble chart';\n\nexport const bubbleChartChartType: SpecChartTypeDefinition<BubbleChartConfig> =\n {\n id: 'bubble-chart',\n label: 'Bubble Chart',\n description: DESCRIPTION,\n icon: Workflow,\n schema: BubbleChartSettings,\n settingsComponent: BubbleChartSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n createTool: createBubbleChartAiTool,\n createSpec: createBubbleChartSpec,\n };\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAChE,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAC,6BAA6B,EAAC,MAAM,qBAAqB,CAAC;AAElE,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAC/B;IACE,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,mBAAmB;IAC3B,iBAAiB,EAAE,4BAA4B;IAC/C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,uBAAuB;IACnC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;QACpB,OAAO,EAAE,6BAA6B;QACtC,MAAM,EACJ,wGAAwG;KAC3G,CAAC;IACF,UAAU,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import type {SpecChartTypeDefinition} from '../base-types';\nimport {BubbleChartConfig, BubbleChartSettings} from './schema';\nimport {titleFromDescription} from '../../chart-builders/chartTypeUtils';\nimport {BubbleChartSettingsComponent} from './BubbleChartSettings';\nimport {createBubbleChartAiTool} from './tool';\nimport {Workflow} from 'lucide-react';\nimport {createBubbleChartSpec} from './spec';\nimport {DEFAULT_CHART_MAX_DATA_POINTS} from '../../chart-runtime';\n\nconst DESCRIPTION = 'Create a bubble chart';\n\nexport const bubbleChartChartType: SpecChartTypeDefinition<BubbleChartConfig> =\n {\n id: 'bubble-chart',\n label: 'Bubble Chart',\n description: DESCRIPTION,\n icon: Workflow,\n schema: BubbleChartSettings,\n settingsComponent: BubbleChartSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n createTool: createBubbleChartAiTool,\n getDataPolicy: () => ({\n maxRows: DEFAULT_CHART_MAX_DATA_POINTS,\n reason:\n 'Bubble charts render one point per row. Use a heatmap or another aggregated chart for larger datasets.',\n }),\n createSpec: createBubbleChartSpec,\n };\n"]}
@@ -13,6 +13,11 @@ export declare const BubbleChartConfig: z.ZodObject<{
13
13
  size: z.ZodOptional<z.ZodString>;
14
14
  }, z.core.$strip>;
15
15
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
16
+ dataPolicy: z.ZodOptional<z.ZodObject<{
17
+ disabled: z.ZodOptional<z.ZodBoolean>;
18
+ maxRows: z.ZodOptional<z.ZodNumber>;
19
+ reason: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>;
16
21
  }, z.core.$strip>;
17
22
  export type BubbleChartConfig = z.infer<typeof BubbleChartConfig>;
18
23
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,mBAAmB;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;iBAI5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,mBAAmB;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ChartDataPolicyOverrideConfig } from '../data-policy-schema';
2
3
  export const BubbleChartSettings = z.object({
3
4
  x: z.string().optional().describe('Numeric column for X axis position'),
4
5
  y: z.string().optional().describe('Numeric column for Y axis position'),
@@ -11,5 +12,6 @@ export const BubbleChartConfig = z.object({
11
12
  chartType: z.literal('bubble-chart'),
12
13
  settings: BubbleChartSettings,
13
14
  settingsOpen: z.boolean().optional(),
15
+ dataPolicy: ChartDataPolicyOverrideConfig.optional(),
14
16
  });
15
17
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvE,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2CAA2C,CAAC;CACzD,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IACpC,QAAQ,EAAE,mBAAmB;IAC7B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\nexport const BubbleChartSettings = z.object({\n x: z.string().optional().describe('Numeric column for X axis position'),\n y: z.string().optional().describe('Numeric column for Y axis position'),\n size: z\n .string()\n .optional()\n .describe('Numeric column for bubble size (optional)'),\n});\n\nexport type BubbleChartSettings = z.infer<typeof BubbleChartSettings>;\n\nexport const BubbleChartConfig = z.object({\n chartType: z.literal('bubble-chart'),\n settings: BubbleChartSettings,\n settingsOpen: z.boolean().optional(),\n});\n\nexport type BubbleChartConfig = z.infer<typeof BubbleChartConfig>;\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvE,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2CAA2C,CAAC;CACzD,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IACpC,QAAQ,EAAE,mBAAmB;IAC7B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {ChartDataPolicyOverrideConfig} from '../data-policy-schema';\n\nexport const BubbleChartSettings = z.object({\n x: z.string().optional().describe('Numeric column for X axis position'),\n y: z.string().optional().describe('Numeric column for Y axis position'),\n size: z\n .string()\n .optional()\n .describe('Numeric column for bubble size (optional)'),\n});\n\nexport type BubbleChartSettings = z.infer<typeof BubbleChartSettings>;\n\nexport const BubbleChartConfig = z.object({\n chartType: z.literal('bubble-chart'),\n settings: BubbleChartSettings,\n settingsOpen: z.boolean().optional(),\n dataPolicy: ChartDataPolicyOverrideConfig.optional(),\n});\n\nexport type BubbleChartConfig = z.infer<typeof BubbleChartConfig>;\n"]}
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
- import { type ChartToolDeps } from '../base-types';
2
+ import { type DashboardToolDeps } from '../base-types';
3
3
  export declare const BubbleChartToolParameters: z.ZodObject<{
4
4
  artifactId: z.ZodOptional<z.ZodString>;
5
5
  tableName: z.ZodOptional<z.ZodString>;
6
6
  createArtifactIfMissing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
+ panelId: z.ZodOptional<z.ZodString>;
7
8
  reasoning: z.ZodString;
8
9
  settings: z.ZodObject<{
9
10
  x: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
@@ -12,7 +13,7 @@ export declare const BubbleChartToolParameters: z.ZodObject<{
12
13
  }, z.core.$strip>;
13
14
  }, z.core.$strip>;
14
15
  export type BubbleChartToolParams = z.infer<typeof BubbleChartToolParameters>;
15
- export declare function createBubbleChartAiTool(deps: ChartToolDeps): import("ai").Tool<{
16
+ export declare function createBubbleChartAiTool(deps: DashboardToolDeps): import("ai").Tool<{
16
17
  createArtifactIfMissing: boolean;
17
18
  reasoning: string;
18
19
  settings: {
@@ -22,17 +23,12 @@ export declare function createBubbleChartAiTool(deps: ChartToolDeps): import("ai
22
23
  };
23
24
  artifactId?: string | undefined;
24
25
  tableName?: string | undefined;
26
+ panelId?: string | undefined;
25
27
  }, {
26
28
  llmResult: {
27
29
  success: boolean;
28
30
  details: string;
29
- data: {
30
- panelId: string;
31
- artifactId: string;
32
- tableName: string;
33
- title: string;
34
- config: any;
35
- };
31
+ data: import("..").PanelResult;
36
32
  errorMessage?: undefined;
37
33
  };
38
34
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,eAAe,CAAC;AAIjD,eAAO,MAAM,yBAAyB;;;;;;;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE9E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmE1D"}
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,yBAAyB;;;;;;;;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE9E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;GA6E9D"}
@@ -3,6 +3,7 @@ import { BubbleChartSettings } from './schema';
3
3
  import { BaseChartToolParameters } from '../tool-schemas';
4
4
  import { validateColumnExists } from '../tool-validation';
5
5
  import { NUMERIC_COLUMN_TYPES } from '../../chart-builders/constants';
6
+ import { createOrUpdateChartPanel } from '../tool-helpers';
6
7
  export const BubbleChartToolParameters = BaseChartToolParameters.extend({
7
8
  settings: BubbleChartSettings.required(),
8
9
  });
@@ -16,30 +17,37 @@ Example queries: "plot latitude vs longitude", "show correlation between elevati
16
17
  Required: x and y must be numeric (${NUMERIC_COLUMN_TYPES.join(', ')}).
17
18
  Optional: size can encode a third numeric dimension (magnitude, frequency, count).
18
19
 
19
- Do NOT use for: distributions (use histogram), categorical counts (use count-plot), trends over time (use line-chart).`,
20
+ IMPORTANT: Bubble charts render ALL rows as individual points. Do NOT create bubble charts for tables with more than ${deps.maxDataPoints.toLocaleString()} rows - use aggregated visualizations instead (histogram, count-plot, line-chart with time intervals, or heatmap).
21
+
22
+ To UPDATE an existing bubble chart: provide the panelId parameter. Otherwise creates new panel.
23
+
24
+ Do NOT use for: distributions (use histogram), categorical counts (use count-plot), trends over time (use line-chart), or large datasets (>${deps.maxDataPoints.toLocaleString()} rows).`,
20
25
  inputSchema: BubbleChartToolParameters,
21
26
  execute: async (params, context) => {
22
27
  try {
23
- const { artifactId, tableName, columns } = deps.resolveResources(params, context);
28
+ const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing, context);
29
+ const { tableName, columns } = deps.resolveTable(artifactId, params.tableName);
24
30
  // Validate settings
25
31
  validateColumnExists(params.settings.x, NUMERIC_COLUMN_TYPES, columns, 'x');
26
32
  validateColumnExists(params.settings.y, NUMERIC_COLUMN_TYPES, columns, 'y');
27
- const title = params.settings.x && params.settings.y
28
- ? `Bubble chart - ${params.settings.x} vs ${params.settings.y}`
29
- : 'Bubble chart';
30
- const result = deps.createChart({
31
- artifactId,
33
+ const result = createOrUpdateChartPanel(deps, {
34
+ panelId: params.panelId,
35
+ dashboardId: artifactId,
32
36
  tableName,
37
+ title: params.settings.x && params.settings.y
38
+ ? `Bubble chart - ${params.settings.x} vs ${params.settings.y}`
39
+ : 'Bubble chart',
33
40
  config: {
34
41
  chartType: 'bubble-chart',
35
42
  settings: params.settings,
36
43
  },
37
- title,
38
44
  });
39
45
  return {
40
46
  llmResult: {
41
47
  success: true,
42
- details: `Created bubble chart "${result.title}".`,
48
+ details: params.panelId
49
+ ? `Updated bubble chart "${result.title}".`
50
+ : `Created bubble chart "${result.title}".`,
43
51
  data: result,
44
52
  },
45
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACtE,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAIH,MAAM,UAAU,uBAAuB,CAAC,IAAmB;IACzD,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;qCAKoB,oBAAoB,CAAC,IAAI,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,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {BubbleChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../tool-schemas';\nimport {type ChartToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {NUMERIC_COLUMN_TYPES} from '../../chart-builders/constants';\n\nexport const BubbleChartToolParameters = BaseChartToolParameters.extend({\n settings: BubbleChartSettings.required(),\n});\n\nexport type BubbleChartToolParams = z.infer<typeof BubbleChartToolParameters>;\n\nexport function createBubbleChartAiTool(deps: ChartToolDeps) {\n return tool({\n description: `Bubble/scatter chart: plots individual points positioned by two numeric columns (x, y), with optional size dimension.\n\nUse when: user asks to \"plot X vs Y\", \"show relationship between\", \"scatter plot\", \"correlation\", \"compare two numeric columns\".\nExample queries: \"plot latitude vs longitude\", \"show correlation between elevation and temperature\", \"visualize coordinates sized by population\", \"plot area vs population density\".\n\nRequired: x and y must be numeric (${NUMERIC_COLUMN_TYPES.join(', ')}).\nOptional: size can encode a third numeric dimension (magnitude, frequency, count).\n\nDo NOT use for: distributions (use histogram), categorical counts (use count-plot), trends over time (use line-chart).`,\n inputSchema: BubbleChartToolParameters,\n execute: async (params, context) => {\n try {\n const {artifactId, tableName, columns} = deps.resolveResources(\n params,\n context,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.x,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'x',\n );\n\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const title =\n params.settings.x && params.settings.y\n ? `Bubble chart - ${params.settings.x} vs ${params.settings.y}`\n : 'Bubble chart';\n\n const result = deps.createChart({\n artifactId,\n tableName,\n config: {\n chartType: 'bubble-chart',\n settings: params.settings,\n },\n title,\n });\n\n return {\n llmResult: {\n success: true,\n details: `Created bubble chart \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/bubble-chart/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,wBAAwB,EAAC,MAAM,iBAAiB,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACtE,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAIH,MAAM,UAAU,uBAAuB,CAAC,IAAuB;IAC7D,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;qCAKoB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;;;uHAGmD,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;;;;6IAIb,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,SAAS;QACrL,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;YACjC,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CACrC,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,uBAAuB,EAC9B,OAAO,CACR,CAAC;gBACF,MAAM,EAAC,SAAS,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,YAAY,CAC5C,UAAU,EACV,MAAM,CAAC,SAAS,CACjB,CAAC;gBAEF,oBAAoB;gBACpB,oBAAoB,CAClB,M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ameters} from '../tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {NUMERIC_COLUMN_TYPES} from '../../chart-builders/constants';\nimport {createOrUpdateChartPanel} from '../tool-helpers';\n\nexport const BubbleChartToolParameters = BaseChartToolParameters.extend({\n settings: BubbleChartSettings.required(),\n});\n\nexport type BubbleChartToolParams = z.infer<typeof BubbleChartToolParameters>;\n\nexport function createBubbleChartAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Bubble/scatter chart: plots individual points positioned by two numeric columns (x, y), with optional size dimension.\n\nUse when: user asks to \"plot X vs Y\", \"show relationship between\", \"scatter plot\", \"correlation\", \"compare two numeric columns\".\nExample queries: \"plot latitude vs longitude\", \"show correlation between elevation and temperature\", \"visualize coordinates sized by population\", \"plot area vs population density\".\n\nRequired: x and y must be numeric (${NUMERIC_COLUMN_TYPES.join(', ')}).\nOptional: size can encode a third numeric dimension (magnitude, frequency, count).\n\nIMPORTANT: Bubble charts render ALL rows as individual points. Do NOT create bubble charts for tables with more than ${deps.maxDataPoints.toLocaleString()} rows - use aggregated visualizations instead (histogram, count-plot, line-chart with time intervals, or heatmap).\n\nTo UPDATE an existing bubble chart: provide the panelId parameter. Otherwise creates new panel.\n\nDo NOT use for: distributions (use histogram), categorical counts (use count-plot), trends over time (use line-chart), or large datasets (>${deps.maxDataPoints.toLocaleString()} rows).`,\n inputSchema: BubbleChartToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.x,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'x',\n );\n\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title:\n params.settings.x && params.settings.y\n ? `Bubble chart - ${params.settings.x} vs ${params.settings.y}`\n : 'Bubble chart',\n config: {\n chartType: 'bubble-chart',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated bubble chart \"${result.title}\".`\n : `Created bubble chart \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
@@ -9,6 +9,11 @@ export declare const CustomChartConfig: z.ZodObject<{
9
9
  chartType: z.ZodString;
10
10
  settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
11
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
12
+ dataPolicy: z.ZodOptional<z.ZodObject<{
13
+ disabled: z.ZodOptional<z.ZodBoolean>;
14
+ maxRows: z.ZodOptional<z.ZodNumber>;
15
+ reason: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
12
17
  }, z.core.$strip>;
13
18
  export type CustomChartConfig = z.infer<typeof CustomChartConfig>;
14
19
  /**
@@ -19,14 +24,25 @@ export declare const ChartConfig: z.ZodUnion<[z.ZodDiscriminatedUnion<readonly [
19
24
  chartType: z.ZodLiteral<"histogram">;
20
25
  settings: z.ZodObject<{
21
26
  field: z.ZodOptional<z.ZodString>;
27
+ maxBins: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
22
28
  }, z.core.$strip>;
23
29
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
30
+ dataPolicy: z.ZodOptional<z.ZodObject<{
31
+ disabled: z.ZodOptional<z.ZodBoolean>;
32
+ maxRows: z.ZodOptional<z.ZodNumber>;
33
+ reason: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>>;
24
35
  }, z.core.$strip>, z.ZodObject<{
25
36
  chartType: z.ZodLiteral<"count-plot">;
26
37
  settings: z.ZodObject<{
27
38
  field: z.ZodOptional<z.ZodString>;
28
39
  }, z.core.$strip>;
29
40
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
41
+ dataPolicy: z.ZodOptional<z.ZodObject<{
42
+ disabled: z.ZodOptional<z.ZodBoolean>;
43
+ maxRows: z.ZodOptional<z.ZodNumber>;
44
+ reason: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>>;
30
46
  }, z.core.$strip>, z.ZodObject<{
31
47
  chartType: z.ZodLiteral<"line-chart">;
32
48
  settings: z.ZodObject<{
@@ -53,6 +69,11 @@ export declare const ChartConfig: z.ZodUnion<[z.ZodDiscriminatedUnion<readonly [
53
69
  }, z.core.$strip>>>;
54
70
  }, z.core.$strip>;
55
71
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
72
+ dataPolicy: z.ZodOptional<z.ZodObject<{
73
+ disabled: z.ZodOptional<z.ZodBoolean>;
74
+ maxRows: z.ZodOptional<z.ZodNumber>;
75
+ reason: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>>;
56
77
  }, z.core.$strip>, z.ZodObject<{
57
78
  chartType: z.ZodLiteral<"bubble-chart">;
58
79
  settings: z.ZodObject<{
@@ -61,6 +82,11 @@ export declare const ChartConfig: z.ZodUnion<[z.ZodDiscriminatedUnion<readonly [
61
82
  size: z.ZodOptional<z.ZodString>;
62
83
  }, z.core.$strip>;
63
84
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
85
+ dataPolicy: z.ZodOptional<z.ZodObject<{
86
+ disabled: z.ZodOptional<z.ZodBoolean>;
87
+ maxRows: z.ZodOptional<z.ZodNumber>;
88
+ reason: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>>;
64
90
  }, z.core.$strip>, z.ZodObject<{
65
91
  chartType: z.ZodLiteral<"heatmap">;
66
92
  settings: z.ZodObject<{
@@ -68,6 +94,11 @@ export declare const ChartConfig: z.ZodUnion<[z.ZodDiscriminatedUnion<readonly [
68
94
  y: z.ZodOptional<z.ZodString>;
69
95
  }, z.core.$strip>;
70
96
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
97
+ dataPolicy: z.ZodOptional<z.ZodObject<{
98
+ disabled: z.ZodOptional<z.ZodBoolean>;
99
+ maxRows: z.ZodOptional<z.ZodNumber>;
100
+ reason: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>>;
71
102
  }, z.core.$strip>, z.ZodObject<{
72
103
  chartType: z.ZodLiteral<"box-plot">;
73
104
  settings: z.ZodObject<{
@@ -75,16 +106,31 @@ export declare const ChartConfig: z.ZodUnion<[z.ZodDiscriminatedUnion<readonly [
75
106
  y: z.ZodString;
76
107
  }, z.core.$strip>;
77
108
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
109
+ dataPolicy: z.ZodOptional<z.ZodObject<{
110
+ disabled: z.ZodOptional<z.ZodBoolean>;
111
+ maxRows: z.ZodOptional<z.ZodNumber>;
112
+ reason: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>>;
78
114
  }, z.core.$strip>, z.ZodObject<{
79
115
  chartType: z.ZodLiteral<"custom-spec">;
80
116
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
81
117
  settings: z.ZodObject<{
82
118
  vgPlotSpec: z.ZodOptional<z.ZodUnknown>;
83
119
  }, z.core.$strip>;
120
+ dataPolicy: z.ZodOptional<z.ZodObject<{
121
+ disabled: z.ZodOptional<z.ZodBoolean>;
122
+ maxRows: z.ZodOptional<z.ZodNumber>;
123
+ reason: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>>;
84
125
  }, z.core.$strip>], "chartType">, z.ZodObject<{
85
126
  chartType: z.ZodString;
86
127
  settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
87
128
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
129
+ dataPolicy: z.ZodOptional<z.ZodObject<{
130
+ disabled: z.ZodOptional<z.ZodBoolean>;
131
+ maxRows: z.ZodOptional<z.ZodNumber>;
132
+ reason: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strip>>;
88
134
  }, z.core.$strip>]>;
89
135
  export type ChartConfig = z.infer<typeof ChartConfig>;
90
136
  export type ChartSettings = ChartConfig['settings'];
@@ -1 +1 @@
1
- {"version":3,"file":"chart-config.d.ts","sourceRoot":"","sources":["../../src/chart-types/chart-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAWtB,eAAO,MAAM,mBAAmB,wCAAoC,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAsBtE,eAAO,MAAM,iBAAiB;;;;iBAM5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAEzB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"chart-config.d.ts","sourceRoot":"","sources":["../../src/chart-types/chart-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAYtB,eAAO,MAAM,mBAAmB,wCAAoC,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAsBtE,eAAO,MAAM,iBAAiB;;;;;;;;;iBAO5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAEA,CAAC;AAEzB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC"}
@@ -11,6 +11,7 @@ import { BubbleChartConfig } from './bubble-chart/schema';
11
11
  import { HeatmapChartConfig } from './heatmap/schema';
12
12
  import { BoxPlotChartConfig } from './box-plot/schema';
13
13
  import { CustomSpecChartConfig } from './custom-spec/schema';
14
+ import { ChartDataPolicyOverrideConfig } from './data-policy-schema';
14
15
  export const CustomChartSettings = z.record(z.string(), z.unknown());
15
16
  const KNOWN_CHART_CONFIGS = [
16
17
  HistogramChartConfig,
@@ -36,6 +37,7 @@ export const CustomChartConfig = z.object({
36
37
  }),
37
38
  settings: CustomChartSettings,
38
39
  settingsOpen: z.boolean().optional(),
40
+ dataPolicy: ChartDataPolicyOverrideConfig.optional(),
39
41
  });
40
42
  /**
41
43
  * Discriminated union of all chart configuration types.
@@ -1 +1 @@
1
- {"version":3,"file":"chart-config.js","sourceRoot":"","sources":["../../src/chart-types/chart-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,uDAAuD;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAC,MAAM,sBAAsB,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAIrE,MAAM,mBAAmB,GAAG;IAC1B,oBAAoB;IACpB,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;CACb,CAAC;AAEX,MAAM,iBAAiB,GAAa;IAClC,oBAAoB;IACpB,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;CACtB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtE,OAAO,EAAE,wDAAwD;KAClE,CAAC;IACF,QAAQ,EAAE,mBAAmB;IAC7B,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,kBAAkB,CAAC,WAAW,EAAE,mBAAmB,CAAC;KACpD,EAAE,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * Central ChartConfig discriminated union.\n * Separated from index.ts to avoid circular dependencies with Settings components.\n */\n\nimport {z} from 'zod';\n\n// Import only the Zod schemas (no Settings components)\nimport {HistogramChartConfig} from './histogram/schema';\nimport {CountPlotChartConfig} from './count-plot/schema';\nimport {LineChartConfig} from './line-chart/schema';\nimport {BubbleChartConfig} from './bubble-chart/schema';\nimport {HeatmapChartConfig} from './heatmap/schema';\nimport {BoxPlotChartConfig} from './box-plot/schema';\nimport {CustomSpecChartConfig} from './custom-spec/schema';\n\nexport const CustomChartSettings = z.record(z.string(), z.unknown());\n\nexport type CustomChartSettings = z.infer<typeof CustomChartSettings>;\n\nconst KNOWN_CHART_CONFIGS = [\n HistogramChartConfig,\n CountPlotChartConfig,\n LineChartConfig,\n BubbleChartConfig,\n HeatmapChartConfig,\n BoxPlotChartConfig,\n CustomSpecChartConfig,\n] as const;\n\nconst KNOWN_CHART_TYPES: string[] = [\n HistogramChartConfig,\n CountPlotChartConfig,\n LineChartConfig,\n BubbleChartConfig,\n HeatmapChartConfig,\n BoxPlotChartConfig,\n CustomSpecChartConfig,\n].map((config) => config.shape.chartType.value);\n\nexport const CustomChartConfig = z.object({\n chartType: z.string().refine((val) => !KNOWN_CHART_TYPES.includes(val), {\n message: 'Custom chart type cannot use reserved chart type names',\n }),\n settings: CustomChartSettings,\n settingsOpen: z.boolean().optional(),\n});\n\nexport type CustomChartConfig = z.infer<typeof CustomChartConfig>;\n\n/**\n * Discriminated union of all chart configuration types.\n * This schema is used for runtime validation and type inference.\n */\nexport const ChartConfig = z\n .discriminatedUnion('chartType', KNOWN_CHART_CONFIGS)\n .or(CustomChartConfig);\n\nexport type ChartConfig = z.infer<typeof ChartConfig>;\n\nexport type ChartSettings = ChartConfig['settings'];\nexport type ChartType = ChartConfig['chartType'];\n"]}
1
+ {"version":3,"file":"chart-config.js","sourceRoot":"","sources":["../../src/chart-types/chart-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,uDAAuD;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAA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AAC,QAAQ,EAAE;CACrD,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,kBAAkB,CAAC,WAAW,EAAE,mBAAmB,CAAC;KACpD,EAAE,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * Central ChartConfig discriminated union.\n * Separated from index.ts to avoid circular dependencies with Settings components.\n */\n\nimport {z} from 'zod';\n\n// Import only the Zod schemas (no Settings components)\nimport {HistogramChartConfig} from './histogram/schema';\nimport {CountPlotChartConfig} from './count-plot/schema';\nimport {LineChartConfig} from './line-chart/schema';\nimport {BubbleChartConfig} from './bubble-chart/schema';\nimport {HeatmapChartConfig} from './heatmap/schema';\nimport {BoxPlotChartConfig} from './box-plot/schema';\nimport {CustomSpecChartConfig} from './custom-spec/schema';\nimport {ChartDataPolicyOverrideConfig} from './data-policy-schema';\n\nexport const CustomChartSettings = z.record(z.string(), z.unknown());\n\nexport type CustomChartSettings = z.infer<typeof CustomChartSettings>;\n\nconst KNOWN_CHART_CONFIGS = [\n HistogramChartConfig,\n CountPlotChartConfig,\n LineChartConfig,\n BubbleChartConfig,\n HeatmapChartConfig,\n BoxPlotChartConfig,\n CustomSpecChartConfig,\n] as const;\n\nconst KNOWN_CHART_TYPES: string[] = [\n HistogramChartConfig,\n CountPlotChartConfig,\n LineChartConfig,\n BubbleChartConfig,\n HeatmapChartConfig,\n BoxPlotChartConfig,\n CustomSpecChartConfig,\n].map((config) => config.shape.chartType.value);\n\nexport const CustomChartConfig = z.object({\n chartType: z.string().refine((val) => !KNOWN_CHART_TYPES.includes(val), {\n message: 'Custom chart type cannot use reserved chart type names',\n }),\n settings: CustomChartSettings,\n settingsOpen: z.boolean().optional(),\n dataPolicy: ChartDataPolicyOverrideConfig.optional(),\n});\n\nexport type CustomChartConfig = z.infer<typeof CustomChartConfig>;\n\n/**\n * Discriminated union of all chart configuration types.\n * This schema is used for runtime validation and type inference.\n */\nexport const ChartConfig = z\n .discriminatedUnion('chartType', KNOWN_CHART_CONFIGS)\n .or(CustomChartConfig);\n\nexport type ChartConfig = z.infer<typeof ChartConfig>;\n\nexport type ChartSettings = ChartConfig['settings'];\nexport type ChartType = ChartConfig['chartType'];\n"]}
@@ -9,6 +9,11 @@ export declare const CountPlotChartConfig: z.ZodObject<{
9
9
  field: z.ZodOptional<z.ZodString>;
10
10
  }, z.core.$strip>;
11
11
  settingsOpen: z.ZodOptional<z.ZodBoolean>;
12
+ dataPolicy: z.ZodOptional<z.ZodObject<{
13
+ disabled: z.ZodOptional<z.ZodBoolean>;
14
+ maxRows: z.ZodOptional<z.ZodNumber>;
15
+ reason: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
12
17
  }, z.core.$strip>;
13
18
  export type CountPlotChartConfig = z.infer<typeof CountPlotChartConfig>;
14
19
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/count-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,sBAAsB;;iBAKjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/chart-types/count-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,sBAAsB;;iBAKjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;;;;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ChartDataPolicyOverrideConfig } from '../data-policy-schema';
2
3
  export const CountPlotChartSettings = z.object({
3
4
  field: z
4
5
  .string()
@@ -9,5 +10,6 @@ export const CountPlotChartConfig = z.object({
9
10
  chartType: z.literal('count-plot'),
10
11
  settings: CountPlotChartSettings,
11
12
  settingsOpen: z.boolean().optional(),
13
+ dataPolicy: ChartDataPolicyOverrideConfig.optional(),
12
14
  });
13
15
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/count-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAClC,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\nexport const CountPlotChartSettings = z.object({\n field: z\n .string()\n .optional()\n .describe('Categorical column to count frequency of values'),\n});\n\nexport type CountPlotChartSettings = z.infer<typeof CountPlotChartSettings>;\n\nexport const CountPlotChartConfig = z.object({\n chartType: z.literal('count-plot'),\n settings: CountPlotChartSettings,\n settingsOpen: z.boolean().optional(),\n});\n\nexport type CountPlotChartConfig = z.infer<typeof CountPlotChartConfig>;\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/chart-types/count-plot/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,6BAA6B,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAClC,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {ChartDataPolicyOverrideConfig} from '../data-policy-schema';\n\nexport const CountPlotChartSettings = z.object({\n field: z\n .string()\n .optional()\n .describe('Categorical column to count frequency of values'),\n});\n\nexport type CountPlotChartSettings = z.infer<typeof CountPlotChartSettings>;\n\nexport const CountPlotChartConfig = z.object({\n chartType: z.literal('count-plot'),\n settings: CountPlotChartSettings,\n settingsOpen: z.boolean().optional(),\n dataPolicy: ChartDataPolicyOverrideConfig.optional(),\n});\n\nexport type CountPlotChartConfig = z.infer<typeof CountPlotChartConfig>;\n"]}
@@ -1,16 +1,17 @@
1
1
  import { z } from 'zod';
2
- import { type ChartToolDeps } from '../base-types';
2
+ import { type DashboardToolDeps } from '../base-types';
3
3
  export declare const CountPlotToolParameters: z.ZodObject<{
4
4
  artifactId: z.ZodOptional<z.ZodString>;
5
5
  tableName: z.ZodOptional<z.ZodString>;
6
6
  createArtifactIfMissing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
+ panelId: z.ZodOptional<z.ZodString>;
7
8
  reasoning: z.ZodString;
8
9
  settings: z.ZodObject<{
9
10
  field: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
10
11
  }, z.core.$strip>;
11
12
  }, z.core.$strip>;
12
13
  export type CountPlotToolParams = z.infer<typeof CountPlotToolParameters>;
13
- export declare function createCountPlotAiTool(deps: ChartToolDeps): import("ai").Tool<{
14
+ export declare function createCountPlotAiTool(deps: DashboardToolDeps): import("ai").Tool<{
14
15
  createArtifactIfMissing: boolean;
15
16
  reasoning: string;
16
17
  settings: {
@@ -18,17 +19,12 @@ export declare function createCountPlotAiTool(deps: ChartToolDeps): import("ai")
18
19
  };
19
20
  artifactId?: string | undefined;
20
21
  tableName?: string | undefined;
22
+ panelId?: string | undefined;
21
23
  }, {
22
24
  llmResult: {
23
25
  success: boolean;
24
26
  details: string;
25
- data: {
26
- panelId: string;
27
- artifactId: string;
28
- tableName: string;
29
- title: string;
30
- config: any;
31
- };
27
+ data: import("..").PanelResult;
32
28
  errorMessage?: undefined;
33
29
  };
34
30
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,eAAe,CAAC;AAIjD,eAAO,MAAM,uBAAuB;;;;;;;;iBAElC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDxD"}
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,uBAAuB;;;;;;;;;iBAElC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;GAmE5D"}
@@ -3,6 +3,7 @@ import { CountPlotChartSettings } from './schema';
3
3
  import { BaseChartToolParameters } from '../tool-schemas';
4
4
  import { validateColumnExists } from '../tool-validation';
5
5
  import { CATEGORICAL_COLUMN_TYPES } from '../../chart-builders/constants';
6
+ import { createOrUpdateChartPanel } from '../tool-helpers';
6
7
  export const CountPlotToolParameters = BaseChartToolParameters.extend({
7
8
  settings: CountPlotChartSettings.required(),
8
9
  });
@@ -15,28 +16,35 @@ Example queries: "count by land use type", "how many features per administrative
15
16
 
16
17
  Required: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}).
17
18
 
19
+ NOTE: Count plots aggregate by counting unique values, so they handle large datasets efficiently (no data point limit).
20
+
21
+ To UPDATE an existing count plot: provide the panelId parameter. Otherwise creates new panel.
22
+
18
23
  CRITICAL: Only for categorical data (text, categories, enums).
19
24
  Do NOT use for: numeric distributions (use histogram), relationships between columns (use bubble-chart), time series (use line-chart).`,
20
25
  inputSchema: CountPlotToolParameters,
21
26
  execute: async (params, context) => {
22
27
  try {
23
- const { artifactId, tableName, columns } = deps.resolveResources(params, context);
28
+ const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing, context);
29
+ const { tableName, columns } = deps.resolveTable(artifactId, params.tableName);
24
30
  // Validate settings - expect categorical columns
25
31
  validateColumnExists(params.settings.field, CATEGORICAL_COLUMN_TYPES, columns, 'field');
26
- const title = `Count plot of ${params.settings.field}`;
27
- const result = deps.createChart({
28
- artifactId,
32
+ const result = createOrUpdateChartPanel(deps, {
33
+ panelId: params.panelId,
34
+ dashboardId: artifactId,
29
35
  tableName,
36
+ title: `Count plot of ${params.settings.field}`,
30
37
  config: {
31
38
  chartType: 'count-plot',
32
39
  settings: params.settings,
33
40
  },
34
- title,
35
41
  });
36
42
  return {
37
43
  llmResult: {
38
44
  success: true,
39
- details: `Created count plot "${result.title}".`,
45
+ details: params.panelId
46
+ ? `Updated count plot "${result.title}".`
47
+ : `Created count plot "${result.title}".`,
40
48
  data: result,
41
49
  },
42
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,wBAAwB,EAAC,MAAM,gCAAgC,CAAC;AAExE,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACpE,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,IAAmB;IACvD,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;4CAK2B,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;;;uIAGwD;QACnI,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;YACjC,IAAI,CAAC;gBACH,MAAM,EAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,gBAAgB,CAC5D,MAAM,EACN,OAAO,CACR,CAAC;gBAEF,iDAAiD;gBACjD,oBAAoB,CAClB,MAAM,CAAC,QAAQ,CAAC,KAAK,EACrB,wBAAwB,EACxB,OAAO,EACP,OAAO,CACR,CAAC;gBAEF,MAAM,KAAK,GAAG,iBAAiB,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAEvD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;oBAC9B,UAAU;oBACV,SAAS;oBACT,MAAM,EAAE;wBACN,SAAS,EAAE,YAAY;wBACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B;oBACD,KAAK;iBACN,CAAC,CAAC;gBAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,uBAAuB,MAAM,CAAC,KAAK,IAAI;wBAChD,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {CountPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../tool-schemas';\nimport {type ChartToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {CATEGORICAL_COLUMN_TYPES} from '../../chart-builders/constants';\n\nexport const CountPlotToolParameters = BaseChartToolParameters.extend({\n settings: CountPlotChartSettings.required(),\n});\n\nexport type CountPlotToolParams = z.infer<typeof CountPlotToolParameters>;\n\nexport function createCountPlotAiTool(deps: ChartToolDeps) {\n return tool({\n description: `Count plot: horizontal bar chart showing frequency of categorical/text values. Counts how many times each unique value appears.\n\nUse when: user asks to \"count\", \"frequency of\", \"how many\", \"breakdown by category\", \"distribution of [text/category column]\".\nExample queries: \"count by land use type\", \"how many features per administrative region\", \"frequency of terrain types\", \"breakdown by zone classification\", \"count parcels by ownership type\".\n\nRequired: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}).\n\nCRITICAL: Only for categorical data (text, categories, enums).\nDo NOT use for: numeric distributions (use histogram), relationships between columns (use bubble-chart), time series (use line-chart).`,\n inputSchema: CountPlotToolParameters,\n execute: async (params, context) => {\n try {\n const {artifactId, tableName, columns} = deps.resolveResources(\n params,\n context,\n );\n\n // Validate settings - expect categorical columns\n validateColumnExists(\n params.settings.field,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'field',\n );\n\n const title = `Count plot of ${params.settings.field}`;\n\n const result = deps.createChart({\n artifactId,\n tableName,\n config: {\n chartType: 'count-plot',\n settings: params.settings,\n },\n title,\n });\n\n return {\n llmResult: {\n success: true,\n details: `Created count plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,wBAAwB,EAAC,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAC,wBAAwB,EAAC,MAAM,iBAAiB,CAAC;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IACpE,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,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C,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {CountPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../tool-validation';\nimport {CATEGORICAL_COLUMN_TYPES} from '../../chart-builders/constants';\nimport {createOrUpdateChartPanel} from '../tool-helpers';\n\nexport const CountPlotToolParameters = BaseChartToolParameters.extend({\n settings: CountPlotChartSettings.required(),\n});\n\nexport type CountPlotToolParams = z.infer<typeof CountPlotToolParameters>;\n\nexport function createCountPlotAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Count plot: horizontal bar chart showing frequency of categorical/text values. Counts how many times each unique value appears.\n\nUse when: user asks to \"count\", \"frequency of\", \"how many\", \"breakdown by category\", \"distribution of [text/category column]\".\nExample queries: \"count by land use type\", \"how many features per administrative region\", \"frequency of terrain types\", \"breakdown by zone classification\", \"count parcels by ownership type\".\n\nRequired: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}).\n\nNOTE: Count plots aggregate by counting unique values, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing count plot: provide the panelId parameter. Otherwise creates new panel.\n\nCRITICAL: Only for categorical data (text, categories, enums).\nDo NOT use for: numeric distributions (use histogram), relationships between columns (use bubble-chart), time series (use line-chart).`,\n inputSchema: CountPlotToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings - expect categorical columns\n validateColumnExists(\n params.settings.field,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'field',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: `Count plot of ${params.settings.field}`,\n config: {\n chartType: 'count-plot',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated count plot \"${result.title}\".`\n : `Created count plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/custom-spec/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,qBAAqB,EAA0B,MAAM,UAAU,CAAC;AAQxE,eAAO,MAAM,mBAAmB,EAAE,uBAAuB,CAAC,qBAAqB,CAU5E,CAAC"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/chart-types/custom-spec/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,qBAAqB,EAA0B,MAAM,UAAU,CAAC;AASxE,eAAO,MAAM,mBAAmB,EAAE,uBAAuB,CAAC,qBAAqB,CAe5E,CAAC"}