@flanksource/clicky-ui 0.3.25 → 0.3.27

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 (535) hide show
  1. package/NOTICE.md +1 -0
  2. package/dist/ai.cjs +4 -0
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.js +6 -2
  5. package/dist/ai.js.map +1 -1
  6. package/dist/chat.cjs +8 -0
  7. package/dist/chat.cjs.map +1 -1
  8. package/dist/chat.js +9 -1
  9. package/dist/chat.js.map +1 -1
  10. package/dist/comments/CommentCard.cjs +89 -14
  11. package/dist/comments/CommentCard.cjs.map +1 -1
  12. package/dist/comments/CommentCard.d.ts.map +1 -1
  13. package/dist/comments/CommentCard.js +90 -15
  14. package/dist/comments/CommentCard.js.map +1 -1
  15. package/dist/comments/CommentComposer.cjs +25 -2
  16. package/dist/comments/CommentComposer.cjs.map +1 -1
  17. package/dist/comments/CommentComposer.d.ts.map +1 -1
  18. package/dist/comments/CommentComposer.js +25 -2
  19. package/dist/comments/CommentComposer.js.map +1 -1
  20. package/dist/comments/CommentProvider.cjs +21 -14
  21. package/dist/comments/CommentProvider.cjs.map +1 -1
  22. package/dist/comments/CommentProvider.d.ts +1 -1
  23. package/dist/comments/CommentProvider.d.ts.map +1 -1
  24. package/dist/comments/CommentProvider.js +21 -14
  25. package/dist/comments/CommentProvider.js.map +1 -1
  26. package/dist/comments/CommentSidePanel.cjs +1 -1
  27. package/dist/comments/CommentSidePanel.cjs.map +1 -1
  28. package/dist/comments/CommentSidePanel.js +1 -1
  29. package/dist/comments/CommentSidePanel.js.map +1 -1
  30. package/dist/comments/comment-types.cjs.map +1 -1
  31. package/dist/comments/comment-types.d.ts +6 -0
  32. package/dist/comments/comment-types.d.ts.map +1 -1
  33. package/dist/comments/comment-types.js.map +1 -1
  34. package/dist/components/DimensionField.cjs +56 -0
  35. package/dist/components/DimensionField.cjs.map +1 -0
  36. package/dist/components/DimensionField.d.ts +17 -0
  37. package/dist/components/DimensionField.d.ts.map +1 -0
  38. package/dist/components/DimensionField.js +56 -0
  39. package/dist/components/DimensionField.js.map +1 -0
  40. package/dist/components.cjs +4 -0
  41. package/dist/components.cjs.map +1 -1
  42. package/dist/components.d.ts +2 -0
  43. package/dist/components.d.ts.map +1 -1
  44. package/dist/components.js +4 -0
  45. package/dist/components.js.map +1 -1
  46. package/dist/data/Clicky.cjs +4 -5
  47. package/dist/data/Clicky.cjs.map +1 -1
  48. package/dist/data/Clicky.d.ts.map +1 -1
  49. package/dist/data/Clicky.js +4 -5
  50. package/dist/data/Clicky.js.map +1 -1
  51. package/dist/data/FixtureEditor/fixture-frontmatter.cjs +4 -0
  52. package/dist/data/FixtureEditor/fixture-frontmatter.cjs.map +1 -1
  53. package/dist/data/FixtureEditor/fixture-frontmatter.d.ts.map +1 -1
  54. package/dist/data/FixtureEditor/fixture-frontmatter.js +4 -0
  55. package/dist/data/FixtureEditor/fixture-frontmatter.js.map +1 -1
  56. package/dist/data/TaskExecDetails.cjs +8 -3
  57. package/dist/data/TaskExecDetails.cjs.map +1 -1
  58. package/dist/data/TaskExecDetails.d.ts +4 -0
  59. package/dist/data/TaskExecDetails.d.ts.map +1 -1
  60. package/dist/data/TaskExecDetails.js +9 -4
  61. package/dist/data/TaskExecDetails.js.map +1 -1
  62. package/dist/data/TaskManagerButton.cjs +101 -7
  63. package/dist/data/TaskManagerButton.cjs.map +1 -1
  64. package/dist/data/TaskManagerButton.d.ts +6 -1
  65. package/dist/data/TaskManagerButton.d.ts.map +1 -1
  66. package/dist/data/TaskManagerButton.js +103 -9
  67. package/dist/data/TaskManagerButton.js.map +1 -1
  68. package/dist/data/TaskProcessDetails.cjs +2 -0
  69. package/dist/data/TaskProcessDetails.cjs.map +1 -1
  70. package/dist/data/TaskProcessDetails.d.ts.map +1 -1
  71. package/dist/data/TaskProcessDetails.js +2 -0
  72. package/dist/data/TaskProcessDetails.js.map +1 -1
  73. package/dist/data/TaskProgress.cjs +14 -4
  74. package/dist/data/TaskProgress.cjs.map +1 -1
  75. package/dist/data/TaskProgress.js +14 -4
  76. package/dist/data/TaskProgress.js.map +1 -1
  77. package/dist/data/TaskSnapshot.cjs.map +1 -1
  78. package/dist/data/TaskSnapshot.d.ts +1 -0
  79. package/dist/data/TaskSnapshot.d.ts.map +1 -1
  80. package/dist/data/TaskSnapshot.js.map +1 -1
  81. package/dist/data/ai/ChatWindow.cjs +18 -23
  82. package/dist/data/ai/ChatWindow.cjs.map +1 -1
  83. package/dist/data/ai/ChatWindow.d.ts +1 -1
  84. package/dist/data/ai/ChatWindow.d.ts.map +1 -1
  85. package/dist/data/ai/ChatWindow.js +19 -24
  86. package/dist/data/ai/ChatWindow.js.map +1 -1
  87. package/dist/data/ai/ChatWindow.preferences.cjs +12 -21
  88. package/dist/data/ai/ChatWindow.preferences.cjs.map +1 -1
  89. package/dist/data/ai/ChatWindow.preferences.d.ts +3 -2
  90. package/dist/data/ai/ChatWindow.preferences.d.ts.map +1 -1
  91. package/dist/data/ai/ChatWindow.preferences.js +12 -21
  92. package/dist/data/ai/ChatWindow.preferences.js.map +1 -1
  93. package/dist/data/ai/ChatWindow.tool-catalog.cjs +21 -38
  94. package/dist/data/ai/ChatWindow.tool-catalog.cjs.map +1 -1
  95. package/dist/data/ai/ChatWindow.tool-catalog.d.ts +5 -5
  96. package/dist/data/ai/ChatWindow.tool-catalog.d.ts.map +1 -1
  97. package/dist/data/ai/ChatWindow.tool-catalog.js +21 -38
  98. package/dist/data/ai/ChatWindow.tool-catalog.js.map +1 -1
  99. package/dist/data/ai/ChatWindow.types.d.ts +2 -2
  100. package/dist/data/ai/ChatWindow.types.d.ts.map +1 -1
  101. package/dist/data/ai/ChatWindowManager.cjs +2 -2
  102. package/dist/data/ai/ChatWindowManager.cjs.map +1 -1
  103. package/dist/data/ai/ChatWindowManager.js +2 -2
  104. package/dist/data/ai/ChatWindowManager.js.map +1 -1
  105. package/dist/data/ai/ChatWindowRequestBody.cjs +4 -2
  106. package/dist/data/ai/ChatWindowRequestBody.cjs.map +1 -1
  107. package/dist/data/ai/ChatWindowRequestBody.d.ts +15 -3
  108. package/dist/data/ai/ChatWindowRequestBody.d.ts.map +1 -1
  109. package/dist/data/ai/ChatWindowRequestBody.js +4 -2
  110. package/dist/data/ai/ChatWindowRequestBody.js.map +1 -1
  111. package/dist/data/ai/PromptRunEditor/index.cjs +2 -3
  112. package/dist/data/ai/PromptRunEditor/index.cjs.map +1 -1
  113. package/dist/data/ai/PromptRunEditor/index.d.ts.map +1 -1
  114. package/dist/data/ai/PromptRunEditor/index.js +2 -3
  115. package/dist/data/ai/PromptRunEditor/index.js.map +1 -1
  116. package/dist/data/ai/PromptRunEditor/model.cjs +1 -0
  117. package/dist/data/ai/PromptRunEditor/model.cjs.map +1 -1
  118. package/dist/data/ai/PromptRunEditor/model.d.ts +1 -1
  119. package/dist/data/ai/PromptRunEditor/model.d.ts.map +1 -1
  120. package/dist/data/ai/PromptRunEditor/model.js +1 -0
  121. package/dist/data/ai/PromptRunEditor/model.js.map +1 -1
  122. package/dist/data/ai/RuntimeModePicker.cjs +11 -9
  123. package/dist/data/ai/RuntimeModePicker.cjs.map +1 -1
  124. package/dist/data/ai/RuntimeModePicker.d.ts.map +1 -1
  125. package/dist/data/ai/RuntimeModePicker.js +12 -10
  126. package/dist/data/ai/RuntimeModePicker.js.map +1 -1
  127. package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs +5 -0
  128. package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs.map +1 -1
  129. package/dist/data/ai/SpecRuntimeEditor/ModelSection.d.ts.map +1 -1
  130. package/dist/data/ai/SpecRuntimeEditor/ModelSection.js +5 -0
  131. package/dist/data/ai/SpecRuntimeEditor/ModelSection.js.map +1 -1
  132. package/dist/data/ai/SpecRuntimeEditor.model.cjs +4 -0
  133. package/dist/data/ai/SpecRuntimeEditor.model.cjs.map +1 -1
  134. package/dist/data/ai/SpecRuntimeEditor.model.d.ts +2 -0
  135. package/dist/data/ai/SpecRuntimeEditor.model.d.ts.map +1 -1
  136. package/dist/data/ai/SpecRuntimeEditor.model.js +4 -0
  137. package/dist/data/ai/SpecRuntimeEditor.model.js.map +1 -1
  138. package/dist/data/ai/ToolPreferences.cjs +5 -5
  139. package/dist/data/ai/ToolPreferences.cjs.map +1 -1
  140. package/dist/data/ai/ToolPreferences.d.ts +6 -5
  141. package/dist/data/ai/ToolPreferences.d.ts.map +1 -1
  142. package/dist/data/ai/ToolPreferences.js +5 -5
  143. package/dist/data/ai/ToolPreferences.js.map +1 -1
  144. package/dist/data/ai/ToolPreferences.model.cjs +61 -37
  145. package/dist/data/ai/ToolPreferences.model.cjs.map +1 -1
  146. package/dist/data/ai/ToolPreferences.model.d.ts +32 -13
  147. package/dist/data/ai/ToolPreferences.model.d.ts.map +1 -1
  148. package/dist/data/ai/ToolPreferences.model.js +62 -38
  149. package/dist/data/ai/ToolPreferences.model.js.map +1 -1
  150. package/dist/data/ai/ToolPreferencesList.cjs +17 -20
  151. package/dist/data/ai/ToolPreferencesList.cjs.map +1 -1
  152. package/dist/data/ai/ToolPreferencesList.d.ts +16 -7
  153. package/dist/data/ai/ToolPreferencesList.d.ts.map +1 -1
  154. package/dist/data/ai/ToolPreferencesList.js +18 -21
  155. package/dist/data/ai/ToolPreferencesList.js.map +1 -1
  156. package/dist/data/ai/chat-window-context.cjs +1 -1
  157. package/dist/data/ai/chat-window-context.cjs.map +1 -1
  158. package/dist/data/ai/chat-window-context.d.ts +7 -7
  159. package/dist/data/ai/chat-window-context.d.ts.map +1 -1
  160. package/dist/data/ai/chat-window-context.js +1 -1
  161. package/dist/data/ai/chat-window-context.js.map +1 -1
  162. package/dist/data/ai/index.d.ts +3 -1
  163. package/dist/data/ai/index.d.ts.map +1 -1
  164. package/dist/data/chat/Chat.cjs +4 -2
  165. package/dist/data/chat/Chat.cjs.map +1 -1
  166. package/dist/data/chat/Chat.d.ts.map +1 -1
  167. package/dist/data/chat/Chat.js +4 -2
  168. package/dist/data/chat/Chat.js.map +1 -1
  169. package/dist/data/chat/Chat.runtime.cjs +14 -3
  170. package/dist/data/chat/Chat.runtime.cjs.map +1 -1
  171. package/dist/data/chat/Chat.runtime.d.ts.map +1 -1
  172. package/dist/data/chat/Chat.runtime.js +15 -4
  173. package/dist/data/chat/Chat.runtime.js.map +1 -1
  174. package/dist/data/chat/clickyOperationsToTools.cjs +2 -1
  175. package/dist/data/chat/clickyOperationsToTools.cjs.map +1 -1
  176. package/dist/data/chat/clickyOperationsToTools.d.ts.map +1 -1
  177. package/dist/data/chat/clickyOperationsToTools.js +2 -1
  178. package/dist/data/chat/clickyOperationsToTools.js.map +1 -1
  179. package/dist/data/chat/index.d.ts +2 -1
  180. package/dist/data/chat/index.d.ts.map +1 -1
  181. package/dist/data/chat/tool-policy.cjs +132 -0
  182. package/dist/data/chat/tool-policy.cjs.map +1 -0
  183. package/dist/data/chat/tool-policy.d.ts +81 -0
  184. package/dist/data/chat/tool-policy.d.ts.map +1 -0
  185. package/dist/data/chat/tool-policy.js +132 -0
  186. package/dist/data/chat/tool-policy.js.map +1 -0
  187. package/dist/data/chat/types.cjs +20 -0
  188. package/dist/data/chat/types.cjs.map +1 -1
  189. package/dist/data/chat/types.d.ts +22 -2
  190. package/dist/data/chat/types.d.ts.map +1 -1
  191. package/dist/data/chat/types.js +20 -0
  192. package/dist/data/chat/types.js.map +1 -1
  193. package/dist/data/debugConsoleSignal.cjs +64 -0
  194. package/dist/data/debugConsoleSignal.cjs.map +1 -0
  195. package/dist/data/debugConsoleSignal.d.ts +83 -0
  196. package/dist/data/debugConsoleSignal.d.ts.map +1 -0
  197. package/dist/data/debugConsoleSignal.js +64 -0
  198. package/dist/data/debugConsoleSignal.js.map +1 -0
  199. package/dist/data/har/HarPanel.cjs +20 -14
  200. package/dist/data/har/HarPanel.cjs.map +1 -1
  201. package/dist/data/har/HarPanel.d.ts.map +1 -1
  202. package/dist/data/har/HarPanel.js +20 -14
  203. package/dist/data/har/HarPanel.js.map +1 -1
  204. package/dist/data/har/types.d.ts +18 -0
  205. package/dist/data/har/types.d.ts.map +1 -1
  206. package/dist/data/query-browser/QueryBrowser.cjs +4 -42
  207. package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
  208. package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
  209. package/dist/data/query-browser/QueryBrowser.js +5 -43
  210. package/dist/data/query-browser/QueryBrowser.js.map +1 -1
  211. package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
  212. package/dist/data/query-browser/QueryBrowser.types.d.ts +0 -1
  213. package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
  214. package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
  215. package/dist/data/runtime/RuntimeBar.cjs +26 -41
  216. package/dist/data/runtime/RuntimeBar.cjs.map +1 -1
  217. package/dist/data/runtime/RuntimeBar.d.ts.map +1 -1
  218. package/dist/data/runtime/RuntimeBar.js +28 -43
  219. package/dist/data/runtime/RuntimeBar.js.map +1 -1
  220. package/dist/data/runtime/RuntimeBar.model.cjs +65 -0
  221. package/dist/data/runtime/RuntimeBar.model.cjs.map +1 -1
  222. package/dist/data/runtime/RuntimeBar.model.d.ts +11 -3
  223. package/dist/data/runtime/RuntimeBar.model.d.ts.map +1 -1
  224. package/dist/data/runtime/RuntimeBar.model.js +65 -0
  225. package/dist/data/runtime/RuntimeBar.model.js.map +1 -1
  226. package/dist/data/runtime/model-capabilities.cjs +8 -5
  227. package/dist/data/runtime/model-capabilities.cjs.map +1 -1
  228. package/dist/data/runtime/model-capabilities.d.ts +6 -1
  229. package/dist/data/runtime/model-capabilities.d.ts.map +1 -1
  230. package/dist/data/runtime/model-capabilities.js +8 -5
  231. package/dist/data/runtime/model-capabilities.js.map +1 -1
  232. package/dist/data/runtime/runtime-mode.cjs +17 -0
  233. package/dist/data/runtime/runtime-mode.cjs.map +1 -1
  234. package/dist/data/runtime/runtime-mode.d.ts +6 -0
  235. package/dist/data/runtime/runtime-mode.d.ts.map +1 -1
  236. package/dist/data/runtime/runtime-mode.js +17 -0
  237. package/dist/data/runtime/runtime-mode.js.map +1 -1
  238. package/dist/data/useDebugAction.cjs +29 -0
  239. package/dist/data/useDebugAction.cjs.map +1 -0
  240. package/dist/data/useDebugAction.d.ts +16 -0
  241. package/dist/data/useDebugAction.d.ts.map +1 -0
  242. package/dist/data/useDebugAction.js +29 -0
  243. package/dist/data/useDebugAction.js.map +1 -0
  244. package/dist/data/version-info.cjs +3 -3
  245. package/dist/data/version-info.js +3 -3
  246. package/dist/data.cjs +16 -8
  247. package/dist/data.cjs.map +1 -1
  248. package/dist/data.d.ts +3 -2
  249. package/dist/data.d.ts.map +1 -1
  250. package/dist/data.js +16 -8
  251. package/dist/devtools/DebugConsole.cjs +138 -0
  252. package/dist/devtools/DebugConsole.cjs.map +1 -0
  253. package/dist/devtools/DebugConsole.d.ts +23 -0
  254. package/dist/devtools/DebugConsole.d.ts.map +1 -0
  255. package/dist/devtools/DebugConsole.js +138 -0
  256. package/dist/devtools/DebugConsole.js.map +1 -0
  257. package/dist/devtools/DebugConsoleButton.cjs +59 -0
  258. package/dist/devtools/DebugConsoleButton.cjs.map +1 -0
  259. package/dist/devtools/DebugConsoleButton.d.ts +20 -0
  260. package/dist/devtools/DebugConsoleButton.d.ts.map +1 -0
  261. package/dist/devtools/DebugConsoleButton.js +59 -0
  262. package/dist/devtools/DebugConsoleButton.js.map +1 -0
  263. package/dist/devtools/DebugConsoleDock.cjs +112 -0
  264. package/dist/devtools/DebugConsoleDock.cjs.map +1 -0
  265. package/dist/devtools/DebugConsoleDock.d.ts +26 -0
  266. package/dist/devtools/DebugConsoleDock.d.ts.map +1 -0
  267. package/dist/devtools/DebugConsoleDock.js +112 -0
  268. package/dist/devtools/DebugConsoleDock.js.map +1 -0
  269. package/dist/devtools/ExecutionDetail.cjs +135 -0
  270. package/dist/devtools/ExecutionDetail.cjs.map +1 -0
  271. package/dist/devtools/ExecutionDetail.d.ts +19 -0
  272. package/dist/devtools/ExecutionDetail.d.ts.map +1 -0
  273. package/dist/devtools/ExecutionDetail.js +135 -0
  274. package/dist/devtools/ExecutionDetail.js.map +1 -0
  275. package/dist/devtools/debugClient.cjs +172 -0
  276. package/dist/devtools/debugClient.cjs.map +1 -0
  277. package/dist/devtools/debugClient.d.ts +98 -0
  278. package/dist/devtools/debugClient.d.ts.map +1 -0
  279. package/dist/devtools/debugClient.js +172 -0
  280. package/dist/devtools/debugClient.js.map +1 -0
  281. package/dist/devtools/debugStore.cjs +115 -0
  282. package/dist/devtools/debugStore.cjs.map +1 -0
  283. package/dist/devtools/debugStore.d.ts +83 -0
  284. package/dist/devtools/debugStore.d.ts.map +1 -0
  285. package/dist/devtools/debugStore.js +115 -0
  286. package/dist/devtools/debugStore.js.map +1 -0
  287. package/dist/devtools/dockState.cjs +51 -0
  288. package/dist/devtools/dockState.cjs.map +1 -0
  289. package/dist/devtools/dockState.d.ts +31 -0
  290. package/dist/devtools/dockState.d.ts.map +1 -0
  291. package/dist/devtools/dockState.js +51 -0
  292. package/dist/devtools/dockState.js.map +1 -0
  293. package/dist/devtools/tabs/ConsoleTab.cjs +36 -0
  294. package/dist/devtools/tabs/ConsoleTab.cjs.map +1 -0
  295. package/dist/devtools/tabs/ConsoleTab.d.ts +19 -0
  296. package/dist/devtools/tabs/ConsoleTab.d.ts.map +1 -0
  297. package/dist/devtools/tabs/ConsoleTab.js +36 -0
  298. package/dist/devtools/tabs/ConsoleTab.js.map +1 -0
  299. package/dist/devtools/tabs/InspectionCaches.cjs +150 -0
  300. package/dist/devtools/tabs/InspectionCaches.cjs.map +1 -0
  301. package/dist/devtools/tabs/InspectionCaches.d.ts +23 -0
  302. package/dist/devtools/tabs/InspectionCaches.d.ts.map +1 -0
  303. package/dist/devtools/tabs/InspectionCaches.js +150 -0
  304. package/dist/devtools/tabs/InspectionCaches.js.map +1 -0
  305. package/dist/devtools/tabs/InspectionTab.cjs +316 -0
  306. package/dist/devtools/tabs/InspectionTab.cjs.map +1 -0
  307. package/dist/devtools/tabs/InspectionTab.d.ts +27 -0
  308. package/dist/devtools/tabs/InspectionTab.d.ts.map +1 -0
  309. package/dist/devtools/tabs/InspectionTab.js +316 -0
  310. package/dist/devtools/tabs/InspectionTab.js.map +1 -0
  311. package/dist/devtools/tabs/NetworkTab.cjs +91 -0
  312. package/dist/devtools/tabs/NetworkTab.cjs.map +1 -0
  313. package/dist/devtools/tabs/NetworkTab.d.ts +20 -0
  314. package/dist/devtools/tabs/NetworkTab.d.ts.map +1 -0
  315. package/dist/devtools/tabs/NetworkTab.js +91 -0
  316. package/dist/devtools/tabs/NetworkTab.js.map +1 -0
  317. package/dist/devtools/tabs/QueriesTab.cjs +85 -0
  318. package/dist/devtools/tabs/QueriesTab.cjs.map +1 -0
  319. package/dist/devtools/tabs/QueriesTab.d.ts +24 -0
  320. package/dist/devtools/tabs/QueriesTab.d.ts.map +1 -0
  321. package/dist/devtools/tabs/QueriesTab.js +85 -0
  322. package/dist/devtools/tabs/QueriesTab.js.map +1 -0
  323. package/dist/devtools/types.cjs +26 -0
  324. package/dist/devtools/types.cjs.map +1 -0
  325. package/dist/devtools/types.d.ts +235 -0
  326. package/dist/devtools/types.d.ts.map +1 -0
  327. package/dist/devtools/types.js +26 -0
  328. package/dist/devtools/types.js.map +1 -0
  329. package/dist/devtools/useDebugStream.cjs +46 -0
  330. package/dist/devtools/useDebugStream.cjs.map +1 -0
  331. package/dist/devtools/useDebugStream.d.ts +23 -0
  332. package/dist/devtools/useDebugStream.d.ts.map +1 -0
  333. package/dist/devtools/useDebugStream.js +46 -0
  334. package/dist/devtools/useDebugStream.js.map +1 -0
  335. package/dist/devtools.cjs +51 -0
  336. package/dist/devtools.cjs.map +1 -0
  337. package/dist/devtools.d.ts +37 -0
  338. package/dist/devtools.d.ts.map +1 -0
  339. package/dist/devtools.js +51 -0
  340. package/dist/devtools.js.map +1 -0
  341. package/dist/icons/components/UiOpenScad.cjs +10 -0
  342. package/dist/icons/components/UiOpenScad.cjs.map +1 -0
  343. package/dist/icons/components/UiOpenScad.d.ts +9 -0
  344. package/dist/icons/components/UiOpenScad.d.ts.map +1 -0
  345. package/dist/icons/components/UiOpenScad.js +10 -0
  346. package/dist/icons/components/UiOpenScad.js.map +1 -0
  347. package/dist/icons/index.d.ts +1 -0
  348. package/dist/icons/index.d.ts.map +1 -1
  349. package/dist/icons/registry.cjs +2 -0
  350. package/dist/icons/registry.cjs.map +1 -1
  351. package/dist/icons/registry.d.ts.map +1 -1
  352. package/dist/icons/registry.js +2 -0
  353. package/dist/icons/registry.js.map +1 -1
  354. package/dist/icons.cjs +2 -0
  355. package/dist/icons.cjs.map +1 -1
  356. package/dist/icons.js +2 -0
  357. package/dist/icons.js.map +1 -1
  358. package/dist/index.cjs +20 -8
  359. package/dist/index.cjs.map +1 -1
  360. package/dist/index.js +20 -8
  361. package/dist/index.js.map +1 -1
  362. package/dist/layout/AppShell.cjs +15 -10
  363. package/dist/layout/AppShell.cjs.map +1 -1
  364. package/dist/layout/AppShell.d.ts +11 -0
  365. package/dist/layout/AppShell.d.ts.map +1 -1
  366. package/dist/layout/AppShell.js +15 -10
  367. package/dist/layout/AppShell.js.map +1 -1
  368. package/dist/layout/AppShell.nav.cjs +170 -49
  369. package/dist/layout/AppShell.nav.cjs.map +1 -1
  370. package/dist/layout/AppShell.nav.d.ts.map +1 -1
  371. package/dist/layout/AppShell.nav.js +170 -49
  372. package/dist/layout/AppShell.nav.js.map +1 -1
  373. package/dist/overlay/CellActions.cjs +18 -124
  374. package/dist/overlay/CellActions.cjs.map +1 -1
  375. package/dist/overlay/CellActions.d.ts +1 -1
  376. package/dist/overlay/CellActions.d.ts.map +1 -1
  377. package/dist/overlay/CellActions.js +18 -124
  378. package/dist/overlay/CellActions.js.map +1 -1
  379. package/dist/overlay/ContextMenu.cjs +144 -0
  380. package/dist/overlay/ContextMenu.cjs.map +1 -0
  381. package/dist/overlay/ContextMenu.d.ts +8 -0
  382. package/dist/overlay/ContextMenu.d.ts.map +1 -0
  383. package/dist/overlay/ContextMenu.js +144 -0
  384. package/dist/overlay/ContextMenu.js.map +1 -0
  385. package/dist/profiles/connections/connectionBrowserModel.cjs +14 -65
  386. package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
  387. package/dist/profiles/connections/connectionBrowserModel.d.ts +35 -35
  388. package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
  389. package/dist/profiles/connections/connectionBrowserModel.js +14 -65
  390. package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
  391. package/dist/profiles/connections/connectionQueryWorkspace.cjs +29 -9
  392. package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
  393. package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -2
  394. package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
  395. package/dist/profiles/connections/connectionQueryWorkspace.js +30 -10
  396. package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
  397. package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs +15 -0
  398. package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs.map +1 -1
  399. package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts +22 -1
  400. package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts.map +1 -1
  401. package/dist/profiles/connections/connectionQueryWorkspaceModel.js +15 -0
  402. package/dist/profiles/connections/connectionQueryWorkspaceModel.js.map +1 -1
  403. package/dist/profiles/connections/index.d.ts +1 -0
  404. package/dist/profiles/connections/index.d.ts.map +1 -1
  405. package/dist/profiles/connections/inspectionStatus.cjs +44 -0
  406. package/dist/profiles/connections/inspectionStatus.cjs.map +1 -0
  407. package/dist/profiles/connections/inspectionStatus.d.ts +5 -0
  408. package/dist/profiles/connections/inspectionStatus.d.ts.map +1 -0
  409. package/dist/profiles/connections/inspectionStatus.js +44 -0
  410. package/dist/profiles/connections/inspectionStatus.js.map +1 -0
  411. package/dist/profiles/connections/useInspection.cjs +123 -0
  412. package/dist/profiles/connections/useInspection.cjs.map +1 -0
  413. package/dist/profiles/connections/useInspection.d.ts +35 -0
  414. package/dist/profiles/connections/useInspection.d.ts.map +1 -0
  415. package/dist/profiles/connections/useInspection.js +123 -0
  416. package/dist/profiles/connections/useInspection.js.map +1 -0
  417. package/dist/profiles/editor/profileBuilderWorkspace.cjs +55 -23
  418. package/dist/profiles/editor/profileBuilderWorkspace.cjs.map +1 -1
  419. package/dist/profiles/editor/profileBuilderWorkspace.d.ts.map +1 -1
  420. package/dist/profiles/editor/profileBuilderWorkspace.js +56 -24
  421. package/dist/profiles/editor/profileBuilderWorkspace.js.map +1 -1
  422. package/dist/profiles/elasticsearch/esQueryBuilder.cjs +12 -3
  423. package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
  424. package/dist/profiles/elasticsearch/esQueryBuilder.d.ts +2 -2
  425. package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
  426. package/dist/profiles/elasticsearch/esQueryBuilder.js +12 -3
  427. package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
  428. package/dist/profiles/fields/profileFieldEditor.cjs +137 -22
  429. package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
  430. package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
  431. package/dist/profiles/fields/profileFieldEditor.js +137 -22
  432. package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
  433. package/dist/profiles/fields/profileFieldFilterEditor.cjs +171 -82
  434. package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
  435. package/dist/profiles/fields/profileFieldFilterEditor.d.ts +0 -9
  436. package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
  437. package/dist/profiles/fields/profileFieldFilterEditor.js +174 -85
  438. package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
  439. package/dist/profiles/fields/profileFieldIcons.cjs +6 -3
  440. package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
  441. package/dist/profiles/fields/profileFieldIcons.js +6 -3
  442. package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
  443. package/dist/profiles/query/profileSampleFilterLookup.cjs +34 -0
  444. package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -0
  445. package/dist/profiles/query/profileSampleFilterLookup.d.ts +12 -0
  446. package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -0
  447. package/dist/profiles/query/profileSampleFilterLookup.js +34 -0
  448. package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -0
  449. package/dist/profiles/query/profileSamplePayload.cjs +6 -4
  450. package/dist/profiles/query/profileSamplePayload.cjs.map +1 -1
  451. package/dist/profiles/query/profileSamplePayload.d.ts +11 -4
  452. package/dist/profiles/query/profileSamplePayload.d.ts.map +1 -1
  453. package/dist/profiles/query/profileSamplePayload.js +6 -4
  454. package/dist/profiles/query/profileSamplePayload.js.map +1 -1
  455. package/dist/profiles/query/profileSampleResult.cjs +26 -0
  456. package/dist/profiles/query/profileSampleResult.cjs.map +1 -0
  457. package/dist/profiles/query/profileSampleResult.d.ts +11 -0
  458. package/dist/profiles/query/profileSampleResult.d.ts.map +1 -0
  459. package/dist/profiles/query/profileSampleResult.js +26 -0
  460. package/dist/profiles/query/profileSampleResult.js.map +1 -0
  461. package/dist/profiles/query/queryTargetPicker.cjs +5 -3
  462. package/dist/profiles/query/queryTargetPicker.cjs.map +1 -1
  463. package/dist/profiles/query/queryTargetPicker.d.ts +3 -2
  464. package/dist/profiles/query/queryTargetPicker.d.ts.map +1 -1
  465. package/dist/profiles/query/queryTargetPicker.js +5 -3
  466. package/dist/profiles/query/queryTargetPicker.js.map +1 -1
  467. package/dist/profiles/wizard/profileWizard.cjs +14 -5
  468. package/dist/profiles/wizard/profileWizard.cjs.map +1 -1
  469. package/dist/profiles/wizard/profileWizard.d.ts.map +1 -1
  470. package/dist/profiles/wizard/profileWizard.js +15 -6
  471. package/dist/profiles/wizard/profileWizard.js.map +1 -1
  472. package/dist/profiles/wizard/profileWizardModel.cjs +35 -6
  473. package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
  474. package/dist/profiles/wizard/profileWizardModel.d.ts +29 -4
  475. package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
  476. package/dist/profiles/wizard/profileWizardModel.js +35 -6
  477. package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
  478. package/dist/profiles/wizard/profileWizardQueryStep.cjs +44 -11
  479. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  480. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  481. package/dist/profiles/wizard/profileWizardQueryStep.js +46 -13
  482. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  483. package/dist/profiles/wizard/profileWizardSteps.cjs +33 -2
  484. package/dist/profiles/wizard/profileWizardSteps.cjs.map +1 -1
  485. package/dist/profiles/wizard/profileWizardSteps.d.ts +11 -2
  486. package/dist/profiles/wizard/profileWizardSteps.d.ts.map +1 -1
  487. package/dist/profiles/wizard/profileWizardSteps.js +33 -2
  488. package/dist/profiles/wizard/profileWizardSteps.js.map +1 -1
  489. package/dist/profiles.cjs +8 -2
  490. package/dist/profiles.cjs.map +1 -1
  491. package/dist/profiles.js +10 -4
  492. package/dist/profiles.js.map +1 -1
  493. package/dist/rpc/FilterForm.cjs +21 -237
  494. package/dist/rpc/FilterForm.cjs.map +1 -1
  495. package/dist/rpc/FilterForm.d.ts +3 -1
  496. package/dist/rpc/FilterForm.d.ts.map +1 -1
  497. package/dist/rpc/FilterForm.js +21 -237
  498. package/dist/rpc/FilterForm.js.map +1 -1
  499. package/dist/rpc/FilterFormFields.cjs +240 -0
  500. package/dist/rpc/FilterFormFields.cjs.map +1 -0
  501. package/dist/rpc/FilterFormFields.d.ts +12 -0
  502. package/dist/rpc/FilterFormFields.d.ts.map +1 -0
  503. package/dist/rpc/FilterFormFields.js +240 -0
  504. package/dist/rpc/FilterFormFields.js.map +1 -0
  505. package/dist/rpc/router.cjs +3 -2
  506. package/dist/rpc/router.cjs.map +1 -1
  507. package/dist/rpc/router.d.ts.map +1 -1
  508. package/dist/rpc/router.js +3 -2
  509. package/dist/rpc/router.js.map +1 -1
  510. package/dist/rpc/types.cjs.map +1 -1
  511. package/dist/rpc/types.d.ts +3 -1
  512. package/dist/rpc/types.d.ts.map +1 -1
  513. package/dist/rpc/types.js.map +1 -1
  514. package/dist/styles.css +1 -1
  515. package/package.json +6 -1
  516. package/dist/data/query-info/QueryInfoDialog.cjs +0 -106
  517. package/dist/data/query-info/QueryInfoDialog.cjs.map +0 -1
  518. package/dist/data/query-info/QueryInfoDialog.d.ts +0 -16
  519. package/dist/data/query-info/QueryInfoDialog.d.ts.map +0 -1
  520. package/dist/data/query-info/QueryInfoDialog.js +0 -106
  521. package/dist/data/query-info/QueryInfoDialog.js.map +0 -1
  522. package/dist/data/query-info/index.d.ts +0 -4
  523. package/dist/data/query-info/index.d.ts.map +0 -1
  524. package/dist/data/query-info/queryInfo.cjs +0 -42
  525. package/dist/data/query-info/queryInfo.cjs.map +0 -1
  526. package/dist/data/query-info/queryInfo.d.ts +0 -45
  527. package/dist/data/query-info/queryInfo.d.ts.map +0 -1
  528. package/dist/data/query-info/queryInfo.js +0 -42
  529. package/dist/data/query-info/queryInfo.js.map +0 -1
  530. package/dist/data/query-info/useQueryInfo.cjs +0 -48
  531. package/dist/data/query-info/useQueryInfo.cjs.map +0 -1
  532. package/dist/data/query-info/useQueryInfo.d.ts +0 -26
  533. package/dist/data/query-info/useQueryInfo.d.ts.map +0 -1
  534. package/dist/data/query-info/useQueryInfo.js +0 -48
  535. package/dist/data/query-info/useQueryInfo.js.map +0 -1
@@ -3,15 +3,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const errorDiagnostics = require("../../data/diagnostics/error-diagnostics.cjs");
4
4
  const profileApi = require("../profileApi.cjs");
5
5
  const QueryBrowser_types = require("../../data/query-browser/QueryBrowser.types.cjs");
6
- const reactQuery = require("@tanstack/react-query");
7
- const react = require("react");
8
6
  function savedConnectionID(value) {
9
7
  const prefix = "connection://";
10
8
  if (!(value == null ? void 0 : value.startsWith(prefix))) return null;
11
9
  return value.slice(prefix.length).trim() || null;
12
10
  }
13
11
  function browserBaseUrl(connectionID) {
14
- return profileApi.profileApiPath(`connection/${encodeURIComponent(connectionID)}/browser`);
12
+ return profileApi.profileApiPath(
13
+ `connection/${encodeURIComponent(connectionID)}/browser`
14
+ );
15
15
  }
16
16
  async function fetchJSON(url, init) {
17
17
  const response = await fetch(url, init);
@@ -36,6 +36,7 @@ async function fetchJSON(url, init) {
36
36
  return response.json();
37
37
  }
38
38
  const targetGroups = [
39
+ { kind: "group", label: "Index groups" },
39
40
  { kind: "pattern", label: "Index patterns" },
40
41
  { kind: "alias", label: "Aliases" },
41
42
  { kind: "data_stream", label: "Data streams" },
@@ -47,8 +48,8 @@ function openSearchIndexOptions(inspection) {
47
48
  return targetGroups.flatMap(
48
49
  ({ kind, label }) => targets.filter((target) => target.kind === kind).map((target) => ({
49
50
  value: target.name,
50
- label: target.count ? `${target.name} · ${target.count} indexes` : target.name,
51
- selectedLabel: target.name,
51
+ label: target.count ? `${target.pattern ?? target.name} · ${target.count} indexes` : target.name,
52
+ selectedLabel: target.pattern ?? target.name,
52
53
  group: label,
53
54
  title: target.count ? `${target.name} · ${target.count} rotated indexes` : `${target.name} · ${target.kind.replace("_", " ")}`
54
55
  }))
@@ -64,11 +65,12 @@ function openSearchTargetKind(inspection, name) {
64
65
  function withTarget(options, target) {
65
66
  if (!target) return options;
66
67
  const next = { ...options };
67
- if (target.index) {
68
- next.index = target.index;
69
- next.targetKind = target.targetKind;
68
+ if (target.value) {
69
+ next[target.option] = target.value;
70
+ if (target.targetKind) next.targetKind = target.targetKind;
71
+ else delete next.targetKind;
70
72
  } else {
71
- delete next.index;
73
+ delete next[target.option];
72
74
  delete next.targetKind;
73
75
  }
74
76
  return next;
@@ -81,7 +83,9 @@ function queryBrowserOptionsSchema(descriptor) {
81
83
  delete properties.search;
82
84
  delete properties.limit;
83
85
  }
84
- if (((_a = descriptor.target) == null ? void 0 : _a.kind) === "index") delete properties.index;
86
+ if (((_a = descriptor.target) == null ? void 0 : _a.kind) === "index") {
87
+ delete properties[descriptor.target.option];
88
+ }
85
89
  if (((_b = descriptor.target) == null ? void 0 : _b.kind) === "kubernetes-workload") {
86
90
  delete properties.kind;
87
91
  delete properties.namespace;
@@ -124,60 +128,6 @@ function mergeProviderOptions(input) {
124
128
  if (!input.keepTargetKind) delete merged.targetKind;
125
129
  return merged;
126
130
  }
127
- function useInspection(scope) {
128
- var _a, _b, _c, _d, _e;
129
- const { cacheKey, id, baseUrl } = scope;
130
- const base = reactQuery.useQuery({
131
- queryKey: [cacheKey, id],
132
- queryFn: () => fetchJSON(`${baseUrl}/inspect`),
133
- enabled: scope.enabled,
134
- retry: 0,
135
- staleTime: 5 * 6e4
136
- });
137
- const switchedDatabase = scope.database !== "" && scope.database !== ((_a = base.data) == null ? void 0 : _a.database);
138
- const database = reactQuery.useQuery({
139
- queryKey: [cacheKey, id, scope.database],
140
- queryFn: () => {
141
- const params = new URLSearchParams({ database: scope.database });
142
- return fetchJSON(`${baseUrl}/inspect?${params}`);
143
- },
144
- enabled: ((_b = base.data) == null ? void 0 : _b.kind) === "sql" && switchedDatabase,
145
- retry: 0,
146
- staleTime: 5 * 6e4
147
- });
148
- const active = switchedDatabase ? database : base;
149
- const data = active.data ?? base.data;
150
- const targetKind = scope.targetKind ?? ((_d = (_c = data == null ? void 0 : data.targets) == null ? void 0 : _c.find((target2) => target2.name === scope.target)) == null ? void 0 : _d.kind) ?? "";
151
- const target = reactQuery.useQuery({
152
- queryKey: [cacheKey, id, targetKind, scope.target],
153
- queryFn: () => {
154
- const params = new URLSearchParams({
155
- target: scope.target,
156
- targetKind
157
- });
158
- return fetchJSON(`${baseUrl}/inspect?${params}`);
159
- },
160
- enabled: (data == null ? void 0 : data.kind) === "opensearch" && scope.target !== "" && targetKind !== "",
161
- retry: 0,
162
- staleTime: 5 * 6e4
163
- });
164
- const activeDatabase = scope.database || scope.fallbackDatabase || (data == null ? void 0 : data.database) || "";
165
- const completion = react.useMemo(
166
- () => completionForInspection(data, target.data),
167
- [data, target.data]
168
- );
169
- return {
170
- data,
171
- nodes: (data == null ? void 0 : data.nodes) ?? [],
172
- databases: ((_e = base.data) == null ? void 0 : _e.databases) ?? [],
173
- activeDatabase,
174
- sqlDatabase: (data == null ? void 0 : data.kind) === "sql" ? activeDatabase : "",
175
- targetKind,
176
- loading: active.isLoading,
177
- error: active.error,
178
- completion
179
- };
180
- }
181
131
  exports.browserBaseUrl = browserBaseUrl;
182
132
  exports.completionForInspection = completionForInspection;
183
133
  exports.fetchJSON = fetchJSON;
@@ -186,6 +136,5 @@ exports.openSearchIndexOptions = openSearchIndexOptions;
186
136
  exports.openSearchTargetKind = openSearchTargetKind;
187
137
  exports.queryBrowserOptionsSchema = queryBrowserOptionsSchema;
188
138
  exports.savedConnectionID = savedConnectionID;
189
- exports.useInspection = useInspection;
190
139
  exports.withTarget = withTarget;
191
140
  //# sourceMappingURL=connectionBrowserModel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionBrowserModel.cjs","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"sourcesContent":["/**\n * The data layer behind every query browser: the descriptor and inspection\n * shapes the server serves, and the hook that turns a selection (database,\n * index) into the catalog and completion a browser renders. All three hosts —\n * the connection browser, the profile wizard and the profile builder — drive\n * the same plumbing from here so the surfaces cannot drift apart.\n */\n\nimport type { ComboboxOption } from \"../../components/Combobox\";\nimport type { WorkloadKind } from \"../../components/workload-picker-utils\";\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { normalizeErrorDiagnostics } from \"../../data/diagnostics/error-diagnostics\";\nimport type { QueryBrowserCompletion } from \"../../data/query-browser/QueryBrowser.completion\";\nimport type { QueryBrowserDiagnostics } from \"../../data/query-browser/QueryBrowser.types\";\nimport { profileApiPath } from \"../profileApi\";\nimport { QueryBrowserExecutionError } from \"../../data/query-browser/QueryBrowser.types\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useMemo, type ReactNode } from \"react\";\n\nexport type BrowserDescriptor = {\n kind: \"query\" | \"cache\";\n provider?: string;\n language?: \"sql\" | \"json\" | \"text\";\n queryLabel?: string;\n defaultQuery?: string;\n resultView?: \"table\" | \"logs\" | \"timeseries\";\n optionsSchema?: JsonSchemaObject;\n initialOptions?: Record<string, unknown>;\n catalog?: boolean;\n /** Allows providers whose request is entirely structural to run without editor text. */\n allowEmptyQuery?: boolean;\n /** The typed resource a query runs against instead of a catalog tree. */\n target?: BrowserTarget;\n /**\n * The row caps that apply when a profile declares none of its own: the page a\n * caller gets by default, the largest page it may ask for, and where an\n * all-row export stops. The query's own `limit` option is none of them.\n */\n rowLimits?: BrowserRowLimits;\n};\n\nexport type BrowserTarget =\n | { kind: \"index\"; label: string }\n | {\n kind: \"kubernetes-workload\";\n label: string;\n kinds: WorkloadKind[];\n };\n\n/** The defaults the server serves, shown as what an unset cap inherits. */\nexport type BrowserRowLimits = {\n pageSize: number;\n maxPageSize: number;\n maxExportRows: number;\n};\n\n/** The caps a profile sets for itself; each unset one takes its default. */\nexport type ProfileRowLimits = {\n pageSize?: number;\n maxPageSize?: number;\n maxExportRows?: number;\n};\n\nexport type TargetKind = \"index\" | \"alias\" | \"data_stream\" | \"pattern\";\n\nexport type InspectionTarget = {\n name: string;\n kind: TargetKind;\n /** The rotation wildcard this concrete index rolls up into. */\n pattern?: string;\n /** How many rotations a `pattern` target covers. */\n count?: number;\n};\n\nexport type CatalogNode = {\n id: string;\n label: string;\n kind: string;\n query?: string;\n options?: Record<string, unknown>;\n children?: CatalogNode[];\n};\n\nexport type InspectionField = {\n name: string;\n dataType?: string;\n types?: string[];\n searchable?: boolean;\n aggregatable?: boolean;\n conflicting?: boolean;\n};\n\nexport type BrowserInspection = {\n kind: \"sql\" | \"opensearch\";\n dialect?: \"postgresql\" | \"mysql\" | \"mssql\" | \"standard\";\n database?: string;\n databases?: string[];\n defaultSchema?: string;\n schemas?: {\n name: string;\n relations: {\n name: string;\n type?: \"table\" | \"view\";\n columns: InspectionField[];\n }[];\n }[];\n targets?: InspectionTarget[];\n nodes?: CatalogNode[];\n selected?: {\n target: InspectionTarget;\n fields: InspectionField[];\n };\n truncated?: boolean;\n truncateReason?: string;\n};\n\nexport type ConnectionProfileActionRenderer = (context: {\n connectionName: string;\n providerType: string;\n providerOptions?: Record<string, unknown>;\n profileQuery?: string;\n}) => ReactNode;\n\n/**\n * savedConnectionID reads the id out of a `connection://<id>` reference. An\n * inline URL has no id, and so no catalog to browse — hence null rather than a\n * guess.\n */\nexport function savedConnectionID(value: string | undefined): string | null {\n const prefix = \"connection://\";\n if (!value?.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function browserBaseUrl(connectionID: string): string {\n return profileApiPath(`connection/${encodeURIComponent(connectionID)}/browser`);\n}\n\nexport async function fetchJSON<T>(url: string, init?: RequestInit): Promise<T> {\n const response = await fetch(url, init);\n if (!response.ok) {\n const body = await response.text();\n const fallback = body.trim() || `request failed: ${response.status}`;\n try {\n const parsed = JSON.parse(body) as {\n error?: unknown;\n diagnostics?: QueryBrowserDiagnostics;\n };\n if (typeof parsed.error === \"string\") {\n const errorDetails = normalizeErrorDiagnostics(parsed, parsed.error);\n throw new QueryBrowserExecutionError(\n errorDetails?.message ?? parsed.error,\n parsed.diagnostics,\n errorDetails ?? undefined,\n );\n }\n } catch (error) {\n if (error instanceof QueryBrowserExecutionError) throw error;\n }\n throw new Error(fallback);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * Rotations lead: a cluster with fifty-three daily jaeger indexes has one\n * target an author actually means, and it is `jaeger-span-*`. The concrete\n * indexes stay listed last so a single day is still reachable.\n */\nconst targetGroups: { kind: TargetKind; label: string }[] = [\n { kind: \"pattern\", label: \"Index patterns\" },\n { kind: \"alias\", label: \"Aliases\" },\n { kind: \"data_stream\", label: \"Data streams\" },\n { kind: \"index\", label: \"Indexes\" },\n];\n\nexport function openSearchIndexOptions(\n inspection?: BrowserInspection,\n): ComboboxOption[] {\n if (inspection?.kind !== \"opensearch\") return [];\n const targets = inspection.targets ?? [];\n return targetGroups.flatMap(({ kind, label }) =>\n targets\n .filter((target) => target.kind === kind)\n .map((target) => ({\n value: target.name,\n label: target.count ? `${target.name} · ${target.count} indexes` : target.name,\n selectedLabel: target.name,\n group: label,\n title: target.count\n ? `${target.name} · ${target.count} rotated indexes`\n : `${target.name} · ${target.kind.replace(\"_\", \" \")}`,\n })),\n );\n}\n\n/**\n * openSearchTargetKind resolves how to inspect a picked target. An undiscovered\n * name containing a wildcard is a pattern by construction — the server inspects\n * it without requiring it to have been enumerated.\n */\nexport function openSearchTargetKind(\n inspection: BrowserInspection | undefined,\n name: string,\n): string {\n const discovered = (inspection?.targets ?? []).find(\n (target) => target.name === name,\n );\n if (discovered) return discovered.kind;\n return name.includes(\"*\") ? \"pattern\" : \"\";\n}\n\n/**\n * withTarget applies a picked target over a host's options, clearing both keys\n * when the picker is emptied so a stale index cannot survive the selection.\n */\nexport function withTarget(\n options: Record<string, unknown>,\n target: { index: string; targetKind: string } | undefined,\n): Record<string, unknown> {\n if (!target) return options;\n const next = { ...options };\n if (target.index) {\n next.index = target.index;\n next.targetKind = target.targetKind;\n } else {\n delete next.index;\n delete next.targetKind;\n }\n return next;\n}\n\n/**\n * queryBrowserOptionsSchema is what the inline options form edits — the leftover\n * options, once the navigator has claimed the ones that belong with the query.\n * The target has its own combobox, and where the source has a structured search\n * the builder owns both the search and the limit it returns, so none of the\n * three is rendered a second time as a generic field.\n */\nexport function queryBrowserOptionsSchema(\n descriptor: BrowserDescriptor,\n): JsonSchemaObject | undefined {\n if (!descriptor.optionsSchema) return undefined;\n const properties = { ...descriptor.optionsSchema.properties };\n if (properties.search) {\n delete properties.search;\n delete properties.limit;\n }\n if (descriptor.target?.kind === \"index\") delete properties.index;\n if (descriptor.target?.kind === \"kubernetes-workload\") {\n delete properties.kind;\n delete properties.namespace;\n delete properties.name;\n }\n return { ...descriptor.optionsSchema, properties };\n}\n\nexport function completionForInspection(\n inspection?: BrowserInspection,\n selectedInspection?: BrowserInspection,\n): QueryBrowserCompletion | undefined {\n if (inspection?.kind === \"sql\" && inspection.dialect) {\n return {\n kind: \"sql\",\n dialect: inspection.dialect,\n ...(inspection.defaultSchema\n ? { defaultSchema: inspection.defaultSchema }\n : {}),\n schemas: (inspection.schemas ?? []).map((schema) => ({\n name: schema.name,\n relations: schema.relations.map((relation) => ({\n name: relation.name,\n ...(relation.type ? { type: relation.type } : {}),\n columns: relation.columns.map((column) => ({\n name: column.name,\n types: column.dataType ? [column.dataType] : [],\n })),\n })),\n })),\n };\n }\n if (\n selectedInspection?.kind === \"opensearch\" &&\n selectedInspection.selected\n ) {\n return {\n kind: \"json-fields\",\n vocabulary: \"opensearch\",\n fields: selectedInspection.selected.fields,\n };\n }\n return undefined;\n}\n\n/**\n * mergeProviderOptions layers the option sources a browser draws on, in\n * increasing precedence, and pins the active database when there is one.\n * `targetKind` only tells the inspection endpoint which field mappings to\n * fetch, so it is dropped unless the caller is feeding the browser itself.\n */\nexport function mergeProviderOptions(input: {\n layers: Array<Record<string, unknown> | undefined>;\n database?: string;\n keepTargetKind?: boolean;\n}): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n for (const layer of input.layers) Object.assign(merged, layer ?? {});\n if (input.database) merged.database = input.database;\n if (!input.keepTargetKind) delete merged.targetKind;\n return merged;\n}\n\nexport type InspectionScope = {\n /** Query-cache namespace, so each host keeps its own inspection cache. */\n cacheKey: string;\n id: string;\n baseUrl: string;\n enabled: boolean;\n /** The database the author picked; empty means the connection's default. */\n database: string;\n /** A database carried by the stored provider options, tried before the default. */\n fallbackDatabase?: string;\n /** The selected index, alias or data stream. */\n target: string;\n /** An explicit target kind; resolved from the catalog when absent. */\n targetKind?: string;\n};\n\nexport type Inspection = {\n data?: BrowserInspection | undefined;\n nodes: CatalogNode[];\n databases: string[];\n activeDatabase: string;\n /** The database to send with a query — empty unless the source is SQL. */\n sqlDatabase: string;\n targetKind: string;\n loading: boolean;\n error: unknown;\n completion?: QueryBrowserCompletion | undefined;\n};\n\n/**\n * useInspection resolves the catalog for a browser: the base inspection, the\n * per-database one a SQL author switched to, and the per-target field mappings\n * an OpenSearch author needs for completion.\n */\nexport function useInspection(scope: InspectionScope): Inspection {\n const { cacheKey, id, baseUrl } = scope;\n const base = useQuery({\n queryKey: [cacheKey, id],\n queryFn: () => fetchJSON<BrowserInspection>(`${baseUrl}/inspect`),\n enabled: scope.enabled,\n retry: 0,\n staleTime: 5 * 60_000,\n });\n const switchedDatabase =\n scope.database !== \"\" && scope.database !== base.data?.database;\n const database = useQuery({\n queryKey: [cacheKey, id, scope.database],\n queryFn: () => {\n const params = new URLSearchParams({ database: scope.database });\n return fetchJSON<BrowserInspection>(`${baseUrl}/inspect?${params}`);\n },\n enabled: base.data?.kind === \"sql\" && switchedDatabase,\n retry: 0,\n staleTime: 5 * 60_000,\n });\n const active = switchedDatabase ? database : base;\n const data = active.data ?? base.data;\n\n const targetKind =\n scope.targetKind ??\n data?.targets?.find((target) => target.name === scope.target)?.kind ??\n \"\";\n const target = useQuery({\n queryKey: [cacheKey, id, targetKind, scope.target],\n queryFn: () => {\n const params = new URLSearchParams({\n target: scope.target,\n targetKind,\n });\n return fetchJSON<BrowserInspection>(`${baseUrl}/inspect?${params}`);\n },\n enabled: data?.kind === \"opensearch\" && scope.target !== \"\" && targetKind !== \"\",\n retry: 0,\n staleTime: 5 * 60_000,\n });\n\n const activeDatabase =\n scope.database || scope.fallbackDatabase || data?.database || \"\";\n const completion = useMemo(\n () => completionForInspection(data, target.data),\n [data, target.data],\n );\n return {\n data,\n nodes: data?.nodes ?? [],\n databases: base.data?.databases ?? [],\n activeDatabase,\n sqlDatabase: data?.kind === \"sql\" ? activeDatabase : \"\",\n targetKind,\n loading: active.isLoading,\n error: active.error,\n completion,\n };\n}\n"],"names":["profileApiPath","normalizeErrorDiagnostics","QueryBrowserExecutionError","use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CAAA;AAAA,IACtB,aAAW,UAAK,SAAL,mBAAW,cAAa,CAAA;AAAA,IACnC;AAAA,IACA,cAAa,6BAAM,UAAS,QAAQ,iBAAiB;AAAA,IACrD;AAAA,IACA,SAAS,OAAO;AAAA,IAChB,OAAO,OAAO;AAAA,IACd;AAAA,EAAA;AAEJ;;;;;;;;;;;"}
1
+ {"version":3,"file":"connectionBrowserModel.cjs","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"sourcesContent":["/**\n * The data layer behind every query browser: the descriptor and inspection\n * shapes the server serves, and the hook that turns a selection (database,\n * index) into the catalog and completion a browser renders. All three hosts —\n * the connection browser, the profile wizard and the profile builder — drive\n * the same plumbing from here so the surfaces cannot drift apart.\n */\n\nimport type { ComboboxOption } from \"../../components/Combobox\";\nimport type { WorkloadKind } from \"../../components/workload-picker-utils\";\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { normalizeErrorDiagnostics } from \"../../data/diagnostics/error-diagnostics\";\nimport type { QueryBrowserCompletion } from \"../../data/query-browser/QueryBrowser.completion\";\nimport type { QueryBrowserDiagnostics } from \"../../data/query-browser/QueryBrowser.types\";\nimport { profileApiPath } from \"../profileApi\";\nimport { QueryBrowserExecutionError } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ReactNode } from \"react\";\n\nexport type BrowserDescriptor = {\n kind: \"query\" | \"cache\";\n provider?: string;\n language?: \"sql\" | \"json\" | \"text\";\n queryLabel?: string;\n defaultQuery?: string;\n resultView?: \"table\" | \"logs\" | \"timeseries\";\n optionsSchema?: JsonSchemaObject;\n initialOptions?: Record<string, unknown>;\n catalog?: boolean;\n /** Allows providers whose request is entirely structural to run without editor text. */\n allowEmptyQuery?: boolean;\n /** The typed resource a query runs against instead of a catalog tree. */\n target?: BrowserTarget;\n /**\n * The row caps that apply when a profile declares none of its own: the page a\n * caller gets by default, the largest page it may ask for, and where an\n * all-row export stops. The query's own `limit` option is none of them.\n */\n rowLimits?: BrowserRowLimits;\n /**\n * The order the provider already returned these rows in.\n *\n * A browser query is a bounded top-N rather than a whole result, so the cut\n * and the order are the same decision: re-sorting the rows the server chose\n * shows them as though the cut had been made the other way round. Kubernetes\n * is the case that proves it — its API only resumes forward, so a limit\n * returns the oldest lines, and newest-first would read as \"the latest logs\".\n */\n resultSort?: BrowserResultSort;\n};\n\n/** A column a result is already ordered by, and which way. */\nexport type BrowserResultSort = { key: string; dir: \"asc\" | \"desc\" };\n\nexport type BrowserTarget =\n | { kind: \"index\"; label: string; option: string }\n | {\n kind: \"kubernetes-workload\";\n label: string;\n kinds: WorkloadKind[];\n };\n\n/** The defaults the server serves, shown as what an unset cap inherits. */\nexport type BrowserRowLimits = {\n pageSize: number;\n maxPageSize: number;\n maxExportRows: number;\n};\n\n/** The caps a profile sets for itself; each unset one takes its default. */\nexport type ProfileRowLimits = {\n pageSize?: number;\n maxPageSize?: number;\n maxExportRows?: number;\n};\n\nexport type TargetKind =\n | \"group\"\n | \"index\"\n | \"alias\"\n | \"data_stream\"\n | \"pattern\";\n\nexport type InspectionTarget = {\n name: string;\n kind: TargetKind;\n /** The rotation wildcard this concrete index rolls up into. */\n pattern?: string;\n /** How many rotations a `pattern` target covers. */\n count?: number;\n members?: string[];\n};\n\nexport type InspectionCache = {\n policy: string;\n state: \"fresh\" | \"stale\";\n cached: boolean;\n refreshing?: boolean;\n loadedAt: string;\n freshUntil: string;\n lastChangedAt: string;\n lastRefreshAttempt?: string;\n lastRefreshError?: string;\n ageMs: number;\n retryAfterMs?: number;\n unchangedRefreshes?: number;\n};\n\nexport type CatalogNode = {\n id: string;\n label: string;\n kind: string;\n query?: string;\n options?: Record<string, unknown>;\n children?: CatalogNode[];\n};\n\nexport type InspectionField = {\n name: string;\n dataType?: string;\n types?: string[];\n searchable?: boolean;\n aggregatable?: boolean;\n conflicting?: boolean;\n};\n\nexport type BrowserInspection = {\n kind: \"sql\" | \"opensearch\";\n dialect?: \"postgresql\" | \"mysql\" | \"mssql\" | \"standard\";\n database?: string;\n databases?: string[];\n defaultSchema?: string;\n schemas?: {\n name: string;\n relations: {\n name: string;\n type?: \"table\" | \"view\";\n columns: InspectionField[];\n }[];\n }[];\n targets?: InspectionTarget[];\n nodes?: CatalogNode[];\n selected?: {\n target: InspectionTarget;\n fields: InspectionField[];\n };\n truncated?: boolean;\n truncateReason?: string;\n cache?: InspectionCache;\n};\n\nexport type ConnectionProfileActionRenderer = (context: {\n connectionName: string;\n providerType: string;\n providerOptions?: Record<string, unknown>;\n profileQuery?: string;\n}) => ReactNode;\n\n/**\n * savedConnectionID reads the id out of a `connection://<id>` reference. An\n * inline URL has no id, and so no catalog to browse — hence null rather than a\n * guess.\n */\nexport function savedConnectionID(value: string | undefined): string | null {\n const prefix = \"connection://\";\n if (!value?.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function browserBaseUrl(connectionID: string): string {\n return profileApiPath(\n `connection/${encodeURIComponent(connectionID)}/browser`,\n );\n}\n\nexport async function fetchJSON<T>(\n url: string,\n init?: RequestInit,\n): Promise<T> {\n const response = await fetch(url, init);\n if (!response.ok) {\n const body = await response.text();\n const fallback = body.trim() || `request failed: ${response.status}`;\n try {\n const parsed = JSON.parse(body) as {\n error?: unknown;\n diagnostics?: QueryBrowserDiagnostics;\n };\n if (typeof parsed.error === \"string\") {\n const errorDetails = normalizeErrorDiagnostics(parsed, parsed.error);\n throw new QueryBrowserExecutionError(\n errorDetails?.message ?? parsed.error,\n parsed.diagnostics,\n errorDetails ?? undefined,\n );\n }\n } catch (error) {\n if (error instanceof QueryBrowserExecutionError) throw error;\n }\n throw new Error(fallback);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * Rotations lead: a cluster with fifty-three daily jaeger indexes has one\n * target an author actually means, and it is `jaeger-span-*`. The concrete\n * indexes stay listed last so a single day is still reachable.\n */\nconst targetGroups: { kind: TargetKind; label: string }[] = [\n { kind: \"group\", label: \"Index groups\" },\n { kind: \"pattern\", label: \"Index patterns\" },\n { kind: \"alias\", label: \"Aliases\" },\n { kind: \"data_stream\", label: \"Data streams\" },\n { kind: \"index\", label: \"Indexes\" },\n];\n\nexport function openSearchIndexOptions(\n inspection?: BrowserInspection,\n): ComboboxOption[] {\n if (inspection?.kind !== \"opensearch\") return [];\n const targets = inspection.targets ?? [];\n return targetGroups.flatMap(({ kind, label }) =>\n targets\n .filter((target) => target.kind === kind)\n .map((target) => ({\n value: target.name,\n label: target.count\n ? `${target.pattern ?? target.name} · ${target.count} indexes`\n : target.name,\n selectedLabel: target.pattern ?? target.name,\n group: label,\n title: target.count\n ? `${target.name} · ${target.count} rotated indexes`\n : `${target.name} · ${target.kind.replace(\"_\", \" \")}`,\n })),\n );\n}\n\n/**\n * openSearchTargetKind resolves how to inspect a picked target. An undiscovered\n * name containing a wildcard is a pattern by construction — the server inspects\n * it without requiring it to have been enumerated.\n */\nexport function openSearchTargetKind(\n inspection: BrowserInspection | undefined,\n name: string,\n): string {\n const discovered = (inspection?.targets ?? []).find(\n (target) => target.name === name,\n );\n if (discovered) return discovered.kind;\n return name.includes(\"*\") ? \"pattern\" : \"\";\n}\n\n/**\n * withTarget applies a picked target over a host's options, clearing both keys\n * when the picker is emptied so a stale index cannot survive the selection.\n */\nexport function withTarget(\n options: Record<string, unknown>,\n target: { option: string; value: string; targetKind: string } | undefined,\n): Record<string, unknown> {\n if (!target) return options;\n const next = { ...options };\n if (target.value) {\n next[target.option] = target.value;\n if (target.targetKind) next.targetKind = target.targetKind;\n else delete next.targetKind;\n } else {\n delete next[target.option];\n delete next.targetKind;\n }\n return next;\n}\n\n/**\n * queryBrowserOptionsSchema is what the inline options form edits — the leftover\n * options, once the navigator has claimed the ones that belong with the query.\n * The target has its own combobox, and where the source has a structured search\n * the builder owns both the search and the limit it returns, so none of the\n * three is rendered a second time as a generic field.\n */\nexport function queryBrowserOptionsSchema(\n descriptor: BrowserDescriptor,\n): JsonSchemaObject | undefined {\n if (!descriptor.optionsSchema) return undefined;\n const properties = { ...descriptor.optionsSchema.properties };\n if (properties.search) {\n delete properties.search;\n delete properties.limit;\n }\n if (descriptor.target?.kind === \"index\") {\n delete properties[descriptor.target.option];\n }\n if (descriptor.target?.kind === \"kubernetes-workload\") {\n delete properties.kind;\n delete properties.namespace;\n delete properties.name;\n }\n return { ...descriptor.optionsSchema, properties };\n}\n\nexport function completionForInspection(\n inspection?: BrowserInspection,\n selectedInspection?: BrowserInspection,\n): QueryBrowserCompletion | undefined {\n if (inspection?.kind === \"sql\" && inspection.dialect) {\n return {\n kind: \"sql\",\n dialect: inspection.dialect,\n ...(inspection.defaultSchema\n ? { defaultSchema: inspection.defaultSchema }\n : {}),\n schemas: (inspection.schemas ?? []).map((schema) => ({\n name: schema.name,\n relations: schema.relations.map((relation) => ({\n name: relation.name,\n ...(relation.type ? { type: relation.type } : {}),\n columns: relation.columns.map((column) => ({\n name: column.name,\n types: column.dataType ? [column.dataType] : [],\n })),\n })),\n })),\n };\n }\n if (\n selectedInspection?.kind === \"opensearch\" &&\n selectedInspection.selected\n ) {\n return {\n kind: \"json-fields\",\n vocabulary: \"opensearch\",\n fields: selectedInspection.selected.fields,\n };\n }\n return undefined;\n}\n\n/**\n * mergeProviderOptions layers the option sources a browser draws on, in\n * increasing precedence, and pins the active database when there is one.\n * `targetKind` only tells the inspection endpoint which field mappings to\n * fetch, so it is dropped unless the caller is feeding the browser itself.\n */\nexport function mergeProviderOptions(input: {\n layers: Array<Record<string, unknown> | undefined>;\n database?: string;\n keepTargetKind?: boolean;\n}): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n for (const layer of input.layers) Object.assign(merged, layer ?? {});\n if (input.database) merged.database = input.database;\n if (!input.keepTargetKind) delete merged.targetKind;\n return merged;\n}\n"],"names":["profileApiPath","normalizeErrorDiagnostics","QueryBrowserExecutionError"],"mappings":";;;;;AAkKO,SAAS,kBAAkB,OAA0C;AAC1E,QAAM,SAAS;AACf,MAAI,EAAC,+BAAO,WAAW,SAAS,QAAO;AACvC,SAAO,MAAM,MAAM,OAAO,M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,WAAA;AACxC;AAEO,SAAS,wBACd,YACA,oBACoC;AACpC,OAAI,yCAAY,UAAS,SAAS,WAAW,SAAS;AACpD,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,WAAW;AAAA,MACpB,GAAI,WAAW,gBACX,EAAE,eAAe,WAAW,cAAA,IAC5B,CAAA;AAAA,MACJ,UAAU,WAAW,WAAW,CAAA,GAAI,IAAI,CAAC,YAAY;AAAA,QACnD,MAAM,OAAO;AAAA,QACb,WAAW,OAAO,UAAU,IAAI,CAAC,cAAc;AAAA,UAC7C,MAAM,SAAS;AAAA,UACf,GAAI,SAAS,OAAO,EAAE,MAAM,SAAS,KAAA,IAAS,CAAA;AAAA,UAC9C,SAAS,SAAS,QAAQ,IAAI,CAAC,YAAY;AAAA,YACzC,MAAM,OAAO;AAAA,YACb,OAAO,OAAO,WAAW,CAAC,OAAO,QAAQ,IAAI,CAAA;AAAA,UAAC,EAC9C;AAAA,QAAA,EACF;AAAA,MAAA,EACF;AAAA,IAAA;AAAA,EAEN;AACA,OACE,yDAAoB,UAAS,gBAC7B,mBAAmB,UACnB;AACA,WAAO;AAAA,MACL,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,QAAQ,mBAAmB,SAAS;AAAA,IAAA;AAAA,EAExC;AACA,SAAO;AACT;AAQO,SAAS,qBAAqB,OAIT;AAC1B,QAAM,SAAkC,CAAA;AACxC,aAAW,SAAS,MAAM,OAAQ,QAAO,OAAO,QAAQ,SAAS,EAAE;AACnE,MAAI,MAAM,SAAU,QAAO,WAAW,MAAM;AAC5C,MAAI,CAAC,MAAM,eAAgB,QAAO,OAAO;AACzC,SAAO;AACT;;;;;;;;;;"}
@@ -23,10 +23,26 @@ export type BrowserDescriptor = {
23
23
  * all-row export stops. The query's own `limit` option is none of them.
24
24
  */
25
25
  rowLimits?: BrowserRowLimits;
26
+ /**
27
+ * The order the provider already returned these rows in.
28
+ *
29
+ * A browser query is a bounded top-N rather than a whole result, so the cut
30
+ * and the order are the same decision: re-sorting the rows the server chose
31
+ * shows them as though the cut had been made the other way round. Kubernetes
32
+ * is the case that proves it — its API only resumes forward, so a limit
33
+ * returns the oldest lines, and newest-first would read as "the latest logs".
34
+ */
35
+ resultSort?: BrowserResultSort;
36
+ };
37
+ /** A column a result is already ordered by, and which way. */
38
+ export type BrowserResultSort = {
39
+ key: string;
40
+ dir: "asc" | "desc";
26
41
  };
27
42
  export type BrowserTarget = {
28
43
  kind: "index";
29
44
  label: string;
45
+ option: string;
30
46
  } | {
31
47
  kind: "kubernetes-workload";
32
48
  label: string;
@@ -44,7 +60,7 @@ export type ProfileRowLimits = {
44
60
  maxPageSize?: number;
45
61
  maxExportRows?: number;
46
62
  };
47
- export type TargetKind = "index" | "alias" | "data_stream" | "pattern";
63
+ export type TargetKind = "group" | "index" | "alias" | "data_stream" | "pattern";
48
64
  export type InspectionTarget = {
49
65
  name: string;
50
66
  kind: TargetKind;
@@ -52,6 +68,21 @@ export type InspectionTarget = {
52
68
  pattern?: string;
53
69
  /** How many rotations a `pattern` target covers. */
54
70
  count?: number;
71
+ members?: string[];
72
+ };
73
+ export type InspectionCache = {
74
+ policy: string;
75
+ state: "fresh" | "stale";
76
+ cached: boolean;
77
+ refreshing?: boolean;
78
+ loadedAt: string;
79
+ freshUntil: string;
80
+ lastChangedAt: string;
81
+ lastRefreshAttempt?: string;
82
+ lastRefreshError?: string;
83
+ ageMs: number;
84
+ retryAfterMs?: number;
85
+ unchangedRefreshes?: number;
55
86
  };
56
87
  export type CatalogNode = {
57
88
  id: string;
@@ -91,6 +122,7 @@ export type BrowserInspection = {
91
122
  };
92
123
  truncated?: boolean;
93
124
  truncateReason?: string;
125
+ cache?: InspectionCache;
94
126
  };
95
127
  export type ConnectionProfileActionRenderer = (context: {
96
128
  connectionName: string;
@@ -118,7 +150,8 @@ export declare function openSearchTargetKind(inspection: BrowserInspection | und
118
150
  * when the picker is emptied so a stale index cannot survive the selection.
119
151
  */
120
152
  export declare function withTarget(options: Record<string, unknown>, target: {
121
- index: string;
153
+ option: string;
154
+ value: string;
122
155
  targetKind: string;
123
156
  } | undefined): Record<string, unknown>;
124
157
  /**
@@ -141,37 +174,4 @@ export declare function mergeProviderOptions(input: {
141
174
  database?: string;
142
175
  keepTargetKind?: boolean;
143
176
  }): Record<string, unknown>;
144
- export type InspectionScope = {
145
- /** Query-cache namespace, so each host keeps its own inspection cache. */
146
- cacheKey: string;
147
- id: string;
148
- baseUrl: string;
149
- enabled: boolean;
150
- /** The database the author picked; empty means the connection's default. */
151
- database: string;
152
- /** A database carried by the stored provider options, tried before the default. */
153
- fallbackDatabase?: string;
154
- /** The selected index, alias or data stream. */
155
- target: string;
156
- /** An explicit target kind; resolved from the catalog when absent. */
157
- targetKind?: string;
158
- };
159
- export type Inspection = {
160
- data?: BrowserInspection | undefined;
161
- nodes: CatalogNode[];
162
- databases: string[];
163
- activeDatabase: string;
164
- /** The database to send with a query — empty unless the source is SQL. */
165
- sqlDatabase: string;
166
- targetKind: string;
167
- loading: boolean;
168
- error: unknown;
169
- completion?: QueryBrowserCompletion | undefined;
170
- };
171
- /**
172
- * useInspection resolves the catalog for a browser: the base inspection, the
173
- * per-database one a SQL author switched to, and the per-target field mappings
174
- * an OpenSearch author needs for completion.
175
- */
176
- export declare function useInspection(scope: InspectionScope): Inspection;
177
177
  //# sourceMappingURL=connectionBrowserModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionBrowserModel.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAK/F,OAAO,EAAW,KAAK,S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CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CA2DhE"}
1
+ {"version":3,"file":"connectionBrowserModel.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAI/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;IAC7C,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wFAAwF;IACxF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAEF,8DAA8D;AAC9D,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AAU,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACxE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,iBAAiB,GAC5B,gBAAgB,GAAG,SAAS,CAgB9B;AAED,wBAAgB,uBAAuB,CACrC,UAAU,CAAC,EAAE,iBAAiB,EAC9B,kBAAkB,CAAC,EAAE,iBAAiB,GACrC,sBAAsB,GAAG,SAAS,CAgCpC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM1B"}
@@ -1,15 +1,15 @@
1
1
  import { normalizeErrorDiagnostics } from "../../data/diagnostics/error-diagnostics.js";
2
2
  import { profileApiPath } from "../profileApi.js";
3
3
  import { QueryBrowserExecutionError } from "../../data/query-browser/QueryBrowser.types.js";
4
- import { useQuery } from "@tanstack/react-query";
5
- import { useMemo } from "react";
6
4
  function savedConnectionID(value) {
7
5
  const prefix = "connection://";
8
6
  if (!(value == null ? void 0 : value.startsWith(prefix))) return null;
9
7
  return value.slice(prefix.length).trim() || null;
10
8
  }
11
9
  function browserBaseUrl(connectionID) {
12
- return profileApiPath(`connection/${encodeURIComponent(connectionID)}/browser`);
10
+ return profileApiPath(
11
+ `connection/${encodeURIComponent(connectionID)}/browser`
12
+ );
13
13
  }
14
14
  async function fetchJSON(url, init) {
15
15
  const response = await fetch(url, init);
@@ -34,6 +34,7 @@ async function fetchJSON(url, init) {
34
34
  return response.json();
35
35
  }
36
36
  const targetGroups = [
37
+ { kind: "group", label: "Index groups" },
37
38
  { kind: "pattern", label: "Index patterns" },
38
39
  { kind: "alias", label: "Aliases" },
39
40
  { kind: "data_stream", label: "Data streams" },
@@ -45,8 +46,8 @@ function openSearchIndexOptions(inspection) {
45
46
  return targetGroups.flatMap(
46
47
  ({ kind, label }) => targets.filter((target) => target.kind === kind).map((target) => ({
47
48
  value: target.name,
48
- label: target.count ? `${target.name} · ${target.count} indexes` : target.name,
49
- selectedLabel: target.name,
49
+ label: target.count ? `${target.pattern ?? target.name} · ${target.count} indexes` : target.name,
50
+ selectedLabel: target.pattern ?? target.name,
50
51
  group: label,
51
52
  title: target.count ? `${target.name} · ${target.count} rotated indexes` : `${target.name} · ${target.kind.replace("_", " ")}`
52
53
  }))
@@ -62,11 +63,12 @@ function openSearchTargetKind(inspection, name) {
62
63
  function withTarget(options, target) {
63
64
  if (!target) return options;
64
65
  const next = { ...options };
65
- if (target.index) {
66
- next.index = target.index;
67
- next.targetKind = target.targetKind;
66
+ if (target.value) {
67
+ next[target.option] = target.value;
68
+ if (target.targetKind) next.targetKind = target.targetKind;
69
+ else delete next.targetKind;
68
70
  } else {
69
- delete next.index;
71
+ delete next[target.option];
70
72
  delete next.targetKind;
71
73
  }
72
74
  return next;
@@ -79,7 +81,9 @@ function queryBrowserOptionsSchema(descriptor) {
79
81
  delete properties.search;
80
82
  delete properties.limit;
81
83
  }
82
- if (((_a = descriptor.target) == null ? void 0 : _a.kind) === "index") delete properties.index;
84
+ if (((_a = descriptor.target) == null ? void 0 : _a.kind) === "index") {
85
+ delete properties[descriptor.target.option];
86
+ }
83
87
  if (((_b = descriptor.target) == null ? void 0 : _b.kind) === "kubernetes-workload") {
84
88
  delete properties.kind;
85
89
  delete properties.namespace;
@@ -122,60 +126,6 @@ function mergeProviderOptions(input) {
122
126
  if (!input.keepTargetKind) delete merged.targetKind;
123
127
  return merged;
124
128
  }
125
- function useInspection(scope) {
126
- var _a, _b, _c, _d, _e;
127
- const { cacheKey, id, baseUrl } = scope;
128
- const base = useQuery({
129
- queryKey: [cacheKey, id],
130
- queryFn: () => fetchJSON(`${baseUrl}/inspect`),
131
- enabled: scope.enabled,
132
- retry: 0,
133
- staleTime: 5 * 6e4
134
- });
135
- const switchedDatabase = scope.database !== "" && scope.database !== ((_a = base.data) == null ? void 0 : _a.database);
136
- const database = useQuery({
137
- queryKey: [cacheKey, id, scope.database],
138
- queryFn: () => {
139
- const params = new URLSearchParams({ database: scope.database });
140
- return fetchJSON(`${baseUrl}/inspect?${params}`);
141
- },
142
- enabled: ((_b = base.data) == null ? void 0 : _b.kind) === "sql" && switchedDatabase,
143
- retry: 0,
144
- staleTime: 5 * 6e4
145
- });
146
- const active = switchedDatabase ? database : base;
147
- const data = active.data ?? base.data;
148
- const targetKind = scope.targetKind ?? ((_d = (_c = data == null ? void 0 : data.targets) == null ? void 0 : _c.find((target2) => target2.name === scope.target)) == null ? void 0 : _d.kind) ?? "";
149
- const target = useQuery({
150
- queryKey: [cacheKey, id, targetKind, scope.target],
151
- queryFn: () => {
152
- const params = new URLSearchParams({
153
- target: scope.target,
154
- targetKind
155
- });
156
- return fetchJSON(`${baseUrl}/inspect?${params}`);
157
- },
158
- enabled: (data == null ? void 0 : data.kind) === "opensearch" && scope.target !== "" && targetKind !== "",
159
- retry: 0,
160
- staleTime: 5 * 6e4
161
- });
162
- const activeDatabase = scope.database || scope.fallbackDatabase || (data == null ? void 0 : data.database) || "";
163
- const completion = useMemo(
164
- () => completionForInspection(data, target.data),
165
- [data, target.data]
166
- );
167
- return {
168
- data,
169
- nodes: (data == null ? void 0 : data.nodes) ?? [],
170
- databases: ((_e = base.data) == null ? void 0 : _e.databases) ?? [],
171
- activeDatabase,
172
- sqlDatabase: (data == null ? void 0 : data.kind) === "sql" ? activeDatabase : "",
173
- targetKind,
174
- loading: active.isLoading,
175
- error: active.error,
176
- completion
177
- };
178
- }
179
129
  export {
180
130
  browserBaseUrl,
181
131
  completionForInspection,
@@ -185,7 +135,6 @@ export {
185
135
  openSearchTargetKind,
186
136
  queryBrowserOptionsSchema,
187
137
  savedConnectionID,
188
- useInspection,
189
138
  withTarget
190
139
  };
191
140
  //# sourceMappingURL=connectionBrowserModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionBrowserModel.js","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"sourcesContent":["/**\n * The data layer behind every query browser: the descriptor and inspection\n * shapes the server serves, and the hook that turns a selection (database,\n * index) into the catalog and completion a browser renders. All three hosts —\n * the connection browser, the profile wizard and the profile builder — drive\n * the same plumbing from here so the surfaces cannot drift apart.\n */\n\nimport type { ComboboxOption } from \"../../components/Combobox\";\nimport type { WorkloadKind } from \"../../components/workload-picker-utils\";\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { normalizeErrorDiagnostics } from \"../../data/diagnostics/error-diagnostics\";\nimport type { QueryBrowserCompletion } from \"../../data/query-browser/QueryBrowser.completion\";\nimport type { QueryBrowserDiagnostics } from \"../../data/query-browser/QueryBrowser.types\";\nimport { profileApiPath } from \"../profileApi\";\nimport { QueryBrowserExecutionError } from \"../../data/query-browser/QueryBrowser.types\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useMemo, type ReactNode } from \"react\";\n\nexport type BrowserDescriptor = {\n kind: \"query\" | \"cache\";\n provider?: string;\n language?: \"sql\" | \"json\" | \"text\";\n queryLabel?: string;\n defaultQuery?: string;\n resultView?: \"table\" | \"logs\" | \"timeseries\";\n optionsSchema?: JsonSchemaObject;\n initialOptions?: Record<string, unknown>;\n catalog?: boolean;\n /** Allows providers whose request is entirely structural to run without editor text. */\n allowEmptyQuery?: boolean;\n /** The typed resource a query runs against instead of a catalog tree. */\n target?: BrowserTarget;\n /**\n * The row caps that apply when a profile declares none of its own: the page a\n * caller gets by default, the largest page it may ask for, and where an\n * all-row export stops. The query's own `limit` option is none of them.\n */\n rowLimits?: BrowserRowLimits;\n};\n\nexport type BrowserTarget =\n | { kind: \"index\"; label: string }\n | {\n kind: \"kubernetes-workload\";\n label: string;\n kinds: WorkloadKind[];\n };\n\n/** The defaults the server serves, shown as what an unset cap inherits. */\nexport type BrowserRowLimits = {\n pageSize: number;\n maxPageSize: number;\n maxExportRows: number;\n};\n\n/** The caps a profile sets for itself; each unset one takes its default. */\nexport type ProfileRowLimits = {\n pageSize?: number;\n maxPageSize?: number;\n maxExportRows?: number;\n};\n\nexport type TargetKind = \"index\" | \"alias\" | \"data_stream\" | \"pattern\";\n\nexport type InspectionTarget = {\n name: string;\n kind: TargetKind;\n /** The rotation wildcard this concrete index rolls up into. */\n pattern?: string;\n /** How many rotations a `pattern` target covers. */\n count?: number;\n};\n\nexport type CatalogNode = {\n id: string;\n label: string;\n kind: string;\n query?: string;\n options?: Record<string, unknown>;\n children?: CatalogNode[];\n};\n\nexport type InspectionField = {\n name: string;\n dataType?: string;\n types?: string[];\n searchable?: boolean;\n aggregatable?: boolean;\n conflicting?: boolean;\n};\n\nexport type BrowserInspection = {\n kind: \"sql\" | \"opensearch\";\n dialect?: \"postgresql\" | \"mysql\" | \"mssql\" | \"standard\";\n database?: string;\n databases?: string[];\n defaultSchema?: string;\n schemas?: {\n name: string;\n relations: {\n name: string;\n type?: \"table\" | \"view\";\n columns: InspectionField[];\n }[];\n }[];\n targets?: InspectionTarget[];\n nodes?: CatalogNode[];\n selected?: {\n target: InspectionTarget;\n fields: InspectionField[];\n };\n truncated?: boolean;\n truncateReason?: string;\n};\n\nexport type ConnectionProfileActionRenderer = (context: {\n connectionName: string;\n providerType: string;\n providerOptions?: Record<string, unknown>;\n profileQuery?: string;\n}) => ReactNode;\n\n/**\n * savedConnectionID reads the id out of a `connection://<id>` reference. An\n * inline URL has no id, and so no catalog to browse — hence null rather than a\n * guess.\n */\nexport function savedConnectionID(value: string | undefined): string | null {\n const prefix = \"connection://\";\n if (!value?.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function browserBaseUrl(connectionID: string): string {\n return profileApiPath(`connection/${encodeURIComponent(connectionID)}/browser`);\n}\n\nexport async function fetchJSON<T>(url: string, init?: RequestInit): Promise<T> {\n const response = await fetch(url, init);\n if (!response.ok) {\n const body = await response.text();\n const fallback = body.trim() || `request failed: ${response.status}`;\n try {\n const parsed = JSON.parse(body) as {\n error?: unknown;\n diagnostics?: QueryBrowserDiagnostics;\n };\n if (typeof parsed.error === \"string\") {\n const errorDetails = normalizeErrorDiagnostics(parsed, parsed.error);\n throw new QueryBrowserExecutionError(\n errorDetails?.message ?? parsed.error,\n parsed.diagnostics,\n errorDetails ?? undefined,\n );\n }\n } catch (error) {\n if (error instanceof QueryBrowserExecutionError) throw error;\n }\n throw new Error(fallback);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * Rotations lead: a cluster with fifty-three daily jaeger indexes has one\n * target an author actually means, and it is `jaeger-span-*`. The concrete\n * indexes stay listed last so a single day is still reachable.\n */\nconst targetGroups: { kind: TargetKind; label: string }[] = [\n { kind: \"pattern\", label: \"Index patterns\" },\n { kind: \"alias\", label: \"Aliases\" },\n { kind: \"data_stream\", label: \"Data streams\" },\n { kind: \"index\", label: \"Indexes\" },\n];\n\nexport function openSearchIndexOptions(\n inspection?: BrowserInspection,\n): ComboboxOption[] {\n if (inspection?.kind !== \"opensearch\") return [];\n const targets = inspection.targets ?? [];\n return targetGroups.flatMap(({ kind, label }) =>\n targets\n .filter((target) => target.kind === kind)\n .map((target) => ({\n value: target.name,\n label: target.count ? `${target.name} · ${target.count} indexes` : target.name,\n selectedLabel: target.name,\n group: label,\n title: target.count\n ? `${target.name} · ${target.count} rotated indexes`\n : `${target.name} · ${target.kind.replace(\"_\", \" \")}`,\n })),\n );\n}\n\n/**\n * openSearchTargetKind resolves how to inspect a picked target. An undiscovered\n * name containing a wildcard is a pattern by construction — the server inspects\n * it without requiring it to have been enumerated.\n */\nexport function openSearchTargetKind(\n inspection: BrowserInspection | undefined,\n name: string,\n): string {\n const discovered = (inspection?.targets ?? []).find(\n (target) => target.name === name,\n );\n if (discovered) return discovered.kind;\n return name.includes(\"*\") ? \"pattern\" : \"\";\n}\n\n/**\n * withTarget applies a picked target over a host's options, clearing both keys\n * when the picker is emptied so a stale index cannot survive the selection.\n */\nexport function withTarget(\n options: Record<string, unknown>,\n target: { index: string; targetKind: string } | undefined,\n): Record<string, unknown> {\n if (!target) return options;\n const next = { ...options };\n if (target.index) {\n next.index = target.index;\n next.targetKind = target.targetKind;\n } else {\n delete next.index;\n delete next.targetKind;\n }\n return next;\n}\n\n/**\n * queryBrowserOptionsSchema is what the inline options form edits — the leftover\n * options, once the navigator has claimed the ones that belong with the query.\n * The target has its own combobox, and where the source has a structured search\n * the builder owns both the search and the limit it returns, so none of the\n * three is rendered a second time as a generic field.\n */\nexport function queryBrowserOptionsSchema(\n descriptor: BrowserDescriptor,\n): JsonSchemaObject | undefined {\n if (!descriptor.optionsSchema) return undefined;\n const properties = { ...descriptor.optionsSchema.properties };\n if (properties.search) {\n delete properties.search;\n delete properties.limit;\n }\n if (descriptor.target?.kind === \"index\") delete properties.index;\n if (descriptor.target?.kind === \"kubernetes-workload\") {\n delete properties.kind;\n delete properties.namespace;\n delete properties.name;\n }\n return { ...descriptor.optionsSchema, properties };\n}\n\nexport function completionForInspection(\n inspection?: BrowserInspection,\n selectedInspection?: BrowserInspection,\n): QueryBrowserCompletion | undefined {\n if (inspection?.kind === \"sql\" && inspection.dialect) {\n return {\n kind: \"sql\",\n dialect: inspection.dialect,\n ...(inspection.defaultSchema\n ? { defaultSchema: inspection.defaultSchema }\n : {}),\n schemas: (inspection.schemas ?? []).map((schema) => ({\n name: schema.name,\n relations: schema.relations.map((relation) => ({\n name: relation.name,\n ...(relation.type ? { type: relation.type } : {}),\n columns: relation.columns.map((column) => ({\n name: column.name,\n types: column.dataType ? [column.dataType] : [],\n })),\n })),\n })),\n };\n }\n if (\n selectedInspection?.kind === \"opensearch\" &&\n selectedInspection.selected\n ) {\n return {\n kind: \"json-fields\",\n vocabulary: \"opensearch\",\n fields: selectedInspection.selected.fields,\n };\n }\n return undefined;\n}\n\n/**\n * mergeProviderOptions layers the option sources a browser draws on, in\n * increasing precedence, and pins the active database when there is one.\n * `targetKind` only tells the inspection endpoint which field mappings to\n * fetch, so it is dropped unless the caller is feeding the browser itself.\n */\nexport function mergeProviderOptions(input: {\n layers: Array<Record<string, unknown> | undefined>;\n database?: string;\n keepTargetKind?: boolean;\n}): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n for (const layer of input.layers) Object.assign(merged, layer ?? {});\n if (input.database) merged.database = input.database;\n if (!input.keepTargetKind) delete merged.targetKind;\n return merged;\n}\n\nexport type InspectionScope = {\n /** Query-cache namespace, so each host keeps its own inspection cache. */\n cacheKey: string;\n id: string;\n baseUrl: string;\n enabled: boolean;\n /** The database the author picked; empty means the connection's default. */\n database: string;\n /** A database carried by the stored provider options, tried before the default. */\n fallbackDatabase?: string;\n /** The selected index, alias or data stream. */\n target: string;\n /** An explicit target kind; resolved from the catalog when absent. */\n targetKind?: string;\n};\n\nexport type Inspection = {\n data?: BrowserInspection | undefined;\n nodes: CatalogNode[];\n databases: string[];\n activeDatabase: string;\n /** The database to send with a query — empty unless the source is SQL. */\n sqlDatabase: string;\n targetKind: string;\n loading: boolean;\n error: unknown;\n completion?: QueryBrowserCompletion | undefined;\n};\n\n/**\n * useInspection resolves the catalog for a browser: the base inspection, the\n * per-database one a SQL author switched to, and the per-target field mappings\n * an OpenSearch author needs for completion.\n */\nexport function useInspection(scope: InspectionScope): Inspection {\n const { cacheKey, id, baseUrl } = scope;\n const base = useQuery({\n queryKey: [cacheKey, id],\n queryFn: () => fetchJSON<BrowserInspection>(`${baseUrl}/inspect`),\n enabled: scope.enabled,\n retry: 0,\n staleTime: 5 * 60_000,\n });\n const switchedDatabase =\n scope.database !== \"\" && scope.database !== base.data?.database;\n const database = useQuery({\n queryKey: [cacheKey, id, scope.database],\n queryFn: () => {\n const params = new URLSearchParams({ database: scope.database });\n return fetchJSON<BrowserInspection>(`${baseUrl}/inspect?${params}`);\n },\n enabled: base.data?.kind === \"sql\" && switchedDatabase,\n retry: 0,\n staleTime: 5 * 60_000,\n });\n const active = switchedDatabase ? database : base;\n const data = active.data ?? base.data;\n\n const targetKind =\n scope.targetKind ??\n data?.targets?.find((target) => target.name === scope.target)?.kind ??\n \"\";\n const target = useQuery({\n queryKey: [cacheKey, id, targetKind, scope.target],\n queryFn: () => {\n const params = new URLSearchParams({\n target: scope.target,\n targetKind,\n });\n return fetchJSON<BrowserInspection>(`${baseUrl}/inspect?${params}`);\n },\n enabled: data?.kind === \"opensearch\" && scope.target !== \"\" && targetKind !== \"\",\n retry: 0,\n staleTime: 5 * 60_000,\n });\n\n const activeDatabase =\n scope.database || scope.fallbackDatabase || data?.database || \"\";\n const completion = useMemo(\n () => completionForInspection(data, target.data),\n [data, target.data],\n );\n return {\n data,\n nodes: data?.nodes ?? [],\n databases: base.data?.databases ?? [],\n activeDatabase,\n sqlDatabase: data?.kind === \"sql\" ? activeDatabase : \"\",\n targetKind,\n loading: active.isLoading,\n error: active.error,\n completion,\n };\n}\n"],"names":["target"],"mappings":";;;;;AAgIO,SAAS,kBAAkB,OAA0C;AAC1E,QAAM,SAAS;AACf,MAAI,EAAC,+BAAO,WAAW,SAAS,QAAO;AACvC,SAAO,MAAM,MAAM,OAAO,MAAM,EAAE,UAAU;AAC9C;AAEO,SAAS,eAAe,cAA8B;AAC3D,SAAO,eAAe,cAAc,mBAAmB,YAAY,CAAC,UAAU;AAChF;AAEA,eAAsB,UAAa,KAAa,MAAgC;AAC9E,QAAM,WAAW,MAAM,MAAM,KAAK,IAAI;AACtC,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,OAAO,MAAM,SAAS,KAAA;AAC5B,UAAM,WAAW,KAAK,KAAA,KAAU,mBAAmB,SAAS,MAAM;AAClE,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,IAAI;AAI9B,UAAI,OAAO,OAAO,UAAU,UAAU;AACpC,cAAM,eAAe,0BAA0B,QAAQ,OAAO,KAAK;AACnE,cAAM,IAAI;AAAA,WACR,6CAAc,YAAW,OAAO;AAAA,UAChC,O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A,IACjD,SAAS,MAAM;AACb,YAAM,SAAS,IAAI,gBAAgB;AAAA,QACjC,QAAQ,MAAM;AAAA,QACd;AAAA,MAAA,CACD;AACD,aAAO,UAA6B,GAAG,OAAO,YAAY,MAAM,EAAE;AAAA,IACpE;AAAA,IACA,UAAS,6BAAM,UAAS,gBAAgB,MAAM,WAAW,MAAM,eAAe;AAAA,IAC9E,OAAO;AAAA,IACP,WAAW,IAAI;AAAA,EAAA,CAChB;AAED,QAAM,iBACJ,MAAM,YAAY,MAAM,qBAAoB,6BAAM,aAAY;AAChE,QAAM,aAAa;AAAA,IACjB,MAAM,wBAAwB,MAAM,OAAO,IAAI;AAAA,IAC/C,CAAC,MAAM,OAAO,IAAI;AAAA,EAAA;AAEpB,SAAO;AAAA,IACL;AAAA,IACA,QAAO,6BAAM,UAAS,CAAA;AAAA,IACtB,aAAW,UAAK,SAAL,mBAAW,cAAa,CAAA;AAAA,IACnC;AAAA,IACA,cAAa,6BAAM,UAAS,QAAQ,iBAAiB;AAAA,IACrD;AAAA,IACA,SAAS,OAAO;AAAA,IAChB,OAAO,OAAO;AAAA,IACd;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"connectionBrowserModel.js","sources":["../../../src/profiles/connections/connectionBrowserModel.ts"],"sourcesContent":["/**\n * The data layer behind every query browser: the descriptor and inspection\n * shapes the server serves, and the hook that turns a selection (database,\n * index) into the catalog and completion a browser renders. All three hosts —\n * the connection browser, the profile wizard and the profile builder — drive\n * the same plumbing from here so the surfaces cannot drift apart.\n */\n\nimport type { ComboboxOption } from \"../../components/Combobox\";\nimport type { WorkloadKind } from \"../../components/workload-picker-utils\";\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { normalizeErrorDiagnostics } from \"../../data/diagnostics/error-diagnostics\";\nimport type { QueryBrowserCompletion } from \"../../data/query-browser/QueryBrowser.completion\";\nimport type { QueryBrowserDiagnostics } from \"../../data/query-browser/QueryBrowser.types\";\nimport { profileApiPath } from \"../profileApi\";\nimport { QueryBrowserExecutionError } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ReactNode } from \"react\";\n\nexport type BrowserDescriptor = {\n kind: \"query\" | \"cache\";\n provider?: string;\n language?: \"sql\" | \"json\" | \"text\";\n queryLabel?: string;\n defaultQuery?: string;\n resultView?: \"table\" | \"logs\" | \"timeseries\";\n optionsSchema?: JsonSchemaObject;\n initialOptions?: Record<string, unknown>;\n catalog?: boolean;\n /** Allows providers whose request is entirely structural to run without editor text. */\n allowEmptyQuery?: boolean;\n /** The typed resource a query runs against instead of a catalog tree. */\n target?: BrowserTarget;\n /**\n * The row caps that apply when a profile declares none of its own: the page a\n * caller gets by default, the largest page it may ask for, and where an\n * all-row export stops. The query's own `limit` option is none of them.\n */\n rowLimits?: BrowserRowLimits;\n /**\n * The order the provider already returned these rows in.\n *\n * A browser query is a bounded top-N rather than a whole result, so the cut\n * and the order are the same decision: re-sorting the rows the server chose\n * shows them as though the cut had been made the other way round. Kubernetes\n * is the case that proves it — its API only resumes forward, so a limit\n * returns the oldest lines, and newest-first would read as \"the latest logs\".\n */\n resultSort?: BrowserResultSort;\n};\n\n/** A column a result is already ordered by, and which way. */\nexport type BrowserResultSort = { key: string; dir: \"asc\" | \"desc\" };\n\nexport type BrowserTarget =\n | { kind: \"index\"; label: string; option: string }\n | {\n kind: \"kubernetes-workload\";\n label: string;\n kinds: WorkloadKind[];\n };\n\n/** The defaults the server serves, shown as what an unset cap inherits. */\nexport type BrowserRowLimits = {\n pageSize: number;\n maxPageSize: number;\n maxExportRows: number;\n};\n\n/** The caps a profile sets for itself; each unset one takes its default. */\nexport type ProfileRowLimits = {\n pageSize?: number;\n maxPageSize?: number;\n maxExportRows?: number;\n};\n\nexport type TargetKind =\n | \"group\"\n | \"index\"\n | \"alias\"\n | \"data_stream\"\n | \"pattern\";\n\nexport type InspectionTarget = {\n name: string;\n kind: TargetKind;\n /** The rotation wildcard this concrete index rolls up into. */\n pattern?: string;\n /** How many rotations a `pattern` target covers. */\n count?: number;\n members?: string[];\n};\n\nexport type InspectionCache = {\n policy: string;\n state: \"fresh\" | \"stale\";\n cached: boolean;\n refreshing?: boolean;\n loadedAt: string;\n freshUntil: string;\n lastChangedAt: string;\n lastRefreshAttempt?: string;\n lastRefreshError?: string;\n ageMs: number;\n retryAfterMs?: number;\n unchangedRefreshes?: number;\n};\n\nexport type CatalogNode = {\n id: string;\n label: string;\n kind: string;\n query?: string;\n options?: Record<string, unknown>;\n children?: CatalogNode[];\n};\n\nexport type InspectionField = {\n name: string;\n dataType?: string;\n types?: string[];\n searchable?: boolean;\n aggregatable?: boolean;\n conflicting?: boolean;\n};\n\nexport type BrowserInspection = {\n kind: \"sql\" | \"opensearch\";\n dialect?: \"postgresql\" | \"mysql\" | \"mssql\" | \"standard\";\n database?: string;\n databases?: string[];\n defaultSchema?: string;\n schemas?: {\n name: string;\n relations: {\n name: string;\n type?: \"table\" | \"view\";\n columns: InspectionField[];\n }[];\n }[];\n targets?: InspectionTarget[];\n nodes?: CatalogNode[];\n selected?: {\n target: InspectionTarget;\n fields: InspectionField[];\n };\n truncated?: boolean;\n truncateReason?: string;\n cache?: InspectionCache;\n};\n\nexport type ConnectionProfileActionRenderer = (context: {\n connectionName: string;\n providerType: string;\n providerOptions?: Record<string, unknown>;\n profileQuery?: string;\n}) => ReactNode;\n\n/**\n * savedConnectionID reads the id out of a `connection://<id>` reference. An\n * inline URL has no id, and so no catalog to browse — hence null rather than a\n * guess.\n */\nexport function savedConnectionID(value: string | undefined): string | null {\n const prefix = \"connection://\";\n if (!value?.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function browserBaseUrl(connectionID: string): string {\n return profileApiPath(\n `connection/${encodeURIComponent(connectionID)}/browser`,\n );\n}\n\nexport async function fetchJSON<T>(\n url: string,\n init?: RequestInit,\n): Promise<T> {\n const response = await fetch(url, init);\n if (!response.ok) {\n const body = await response.text();\n const fallback = body.trim() || `request failed: ${response.status}`;\n try {\n const parsed = JSON.parse(body) as {\n error?: unknown;\n diagnostics?: QueryBrowserDiagnostics;\n };\n if (typeof parsed.error === \"string\") {\n const errorDetails = normalizeErrorDiagnostics(parsed, parsed.error);\n throw new QueryBrowserExecutionError(\n errorDetails?.message ?? parsed.error,\n parsed.diagnostics,\n errorDetails ?? undefined,\n );\n }\n } catch (error) {\n if (error instanceof QueryBrowserExecutionError) throw error;\n }\n throw new Error(fallback);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * Rotations lead: a cluster with fifty-three daily jaeger indexes has one\n * target an author actually means, and it is `jaeger-span-*`. The concrete\n * indexes stay listed last so a single day is still reachable.\n */\nconst targetGroups: { kind: TargetKind; label: string }[] = [\n { kind: \"group\", label: \"Index groups\" },\n { kind: \"pattern\", label: \"Index patterns\" },\n { kind: \"alias\", label: \"Aliases\" },\n { kind: \"data_stream\", label: \"Data streams\" },\n { kind: \"index\", label: \"Indexes\" },\n];\n\nexport function openSearchIndexOptions(\n inspection?: BrowserInspection,\n): ComboboxOption[] {\n if (inspection?.kind !== \"opensearch\") return [];\n const targets = inspection.targets ?? [];\n return targetGroups.flatMap(({ kind, label }) =>\n targets\n .filter((target) => target.kind === kind)\n .map((target) => ({\n value: target.name,\n label: target.count\n ? `${target.pattern ?? target.name} · ${target.count} indexes`\n : target.name,\n selectedLabel: target.pattern ?? target.name,\n group: label,\n title: target.count\n ? `${target.name} · ${target.count} rotated indexes`\n : `${target.name} · ${target.kind.replace(\"_\", \" \")}`,\n })),\n );\n}\n\n/**\n * openSearchTargetKind resolves how to inspect a picked target. An undiscovered\n * name containing a wildcard is a pattern by construction — the server inspects\n * it without requiring it to have been enumerated.\n */\nexport function openSearchTargetKind(\n inspection: BrowserInspection | undefined,\n name: string,\n): string {\n const discovered = (inspection?.targets ?? []).find(\n (target) => target.name === name,\n );\n if (discovered) return discovered.kind;\n return name.includes(\"*\") ? \"pattern\" : \"\";\n}\n\n/**\n * withTarget applies a picked target over a host's options, clearing both keys\n * when the picker is emptied so a stale index cannot survive the selection.\n */\nexport function withTarget(\n options: Record<string, unknown>,\n target: { option: string; value: string; targetKind: string } | undefined,\n): Record<string, unknown> {\n if (!target) return options;\n const next = { ...options };\n if (target.value) {\n next[target.option] = target.value;\n if (target.targetKind) next.targetKind = target.targetKind;\n else delete next.targetKind;\n } else {\n delete next[target.option];\n delete next.targetKind;\n }\n return next;\n}\n\n/**\n * queryBrowserOptionsSchema is what the inline options form edits — the leftover\n * options, once the navigator has claimed the ones that belong with the query.\n * The target has its own combobox, and where the source has a structured search\n * the builder owns both the search and the limit it returns, so none of the\n * three is rendered a second time as a generic field.\n */\nexport function queryBrowserOptionsSchema(\n descriptor: BrowserDescriptor,\n): JsonSchemaObject | undefined {\n if (!descriptor.optionsSchema) return undefined;\n const properties = { ...descriptor.optionsSchema.properties };\n if (properties.search) {\n delete properties.search;\n delete properties.limit;\n }\n if (descriptor.target?.kind === \"index\") {\n delete properties[descriptor.target.option];\n }\n if (descriptor.target?.kind === \"kubernetes-workload\") {\n delete properties.kind;\n delete properties.namespace;\n delete properties.name;\n }\n return { ...descriptor.optionsSchema, properties };\n}\n\nexport function completionForInspection(\n inspection?: BrowserInspection,\n selectedInspection?: BrowserInspection,\n): QueryBrowserCompletion | undefined {\n if (inspection?.kind === \"sql\" && inspection.dialect) {\n return {\n kind: \"sql\",\n dialect: inspection.dialect,\n ...(inspection.defaultSchema\n ? { defaultSchema: inspection.defaultSchema }\n : {}),\n schemas: (inspection.schemas ?? []).map((schema) => ({\n name: schema.name,\n relations: schema.relations.map((relation) => ({\n name: relation.name,\n ...(relation.type ? { type: relation.type } : {}),\n columns: relation.columns.map((column) => ({\n name: column.name,\n types: column.dataType ? [column.dataType] : [],\n })),\n })),\n })),\n };\n }\n if (\n selectedInspection?.kind === \"opensearch\" &&\n selectedInspection.selected\n ) {\n return {\n kind: \"json-fields\",\n vocabulary: \"opensearch\",\n fields: selectedInspection.selected.fields,\n };\n }\n return undefined;\n}\n\n/**\n * mergeProviderOptions layers the option sources a browser draws on, in\n * increasing precedence, and pins the active database when there is one.\n * `targetKind` only tells the inspection endpoint which field mappings to\n * fetch, so it is dropped unless the caller is feeding the browser itself.\n */\nexport function mergeProviderOptions(input: {\n layers: Array<Record<string, unknown> | undefined>;\n database?: string;\n keepTargetKind?: boolean;\n}): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n for (const layer of input.layers) Object.assign(merged, layer ?? {});\n if (input.database) merged.database = input.database;\n if (!input.keepTargetKind) delete merged.targetKind;\n return merged;\n}\n"],"names":[],"mappings":";;;AAkKO,SAAS,kBAAkB,OAA0C;AAC1E,QAAM,SAAS;AACf,MAAI,EAAC,+BAAO,WAAW,SAAS,QAAO;AACvC,SAAO,MAAM,MAAM,OAAO,MAAM,EAAE,UAAU;AAC9C;AAEO,SAAS,eAAe,cAA8B;AAC3D,SAAO;AAAA,IACL,cAAc,mBAAmB,YAAY,CAAC;AAAA,EAAA;AAElD;AAEA,eAAsB,UACpB,KACA,MACY;AACZ,QAAM,WAAW,MAAM,MAAM,KAAK,IAAI;AACtC,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,OAAO,MAAM,SAAS,KAAA;AAC5B,UAAM,WAAW,KAAK,KAAA,KAAU,mBAAmB,SAAS,MAAM;AAClE,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,IAAI;AAI9B,UAAI,OAAO,OAAO,UAAU,UAAU;AACpC,cAAM,eAAe,0BAA0B,QAAQ,OAAO,KAAK;AACnE,cAAM,IAAI;AAAA,WACR,6CAAc,YAAW,OAAO;AAAA,UAChC,OAAO;AAAA,UACP,gBAAgB;AAAA,QAAA;AAAA,MAEpB;AAAA,IACF,SAAS,OAAO;AACd,UAAI,iBAAiB,2BAA4B,OAAM;AAAA,IACzD;AACA,UAAM,IAAI,MAAM,QAAQ;AAAA,EAC1B;AACA,SAAO,SAAS,KAAA;AAClB;AAOA,MAAM,eAAsD;AAAA,EAC1D,EAAE,MAAM,SAAS,OAAO,eAAA;AAAA,EACxB,EAAE,MAA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AAqB,OAIT;AAC1B,QAAM,SAAkC,CAAA;AACxC,aAAW,SAAS,MAAM,OAAQ,QAAO,OAAO,QAAQ,SAAS,EAAE;AACnE,MAAI,MAAM,SAAU,QAAO,WAAW,MAAM;AAC5C,MAAI,CAAC,MAAM,eAAgB,QAAO,OAAO;AACzC,SAAO;AACT;"}
@@ -18,6 +18,7 @@ const kubernetesWorkloadTargetPicker = require("../query/kubernetesWorkloadTarge
18
18
  const connectionQueryWorkspaceModel = require("./connectionQueryWorkspaceModel.cjs");
19
19
  const esQueryBuilderForm = require("../elasticsearch/esQueryBuilderForm.cjs");
20
20
  const esQueryCompile = require("../elasticsearch/esQueryCompile.cjs");
21
+ const inspectionStatus = require("./inspectionStatus.cjs");
21
22
  function ConnectionQueryWorkspace({
22
23
  id,
23
24
  title,
@@ -84,6 +85,7 @@ function ConnectionQueryWorkspace({
84
85
  });
85
86
  const specMode = search !== void 0;
86
87
  const active = tabs.some((entry) => entry.id === tab) ? tab : (_a = tabs[0]) == null ? void 0 : _a.id;
88
+ const indexTarget = ((_b = descriptor.target) == null ? void 0 : _b.kind) === "index" ? descriptor.target : void 0;
87
89
  react.useEffect(() => {
88
90
  if (active === "form" && onSearchChange && search === void 0) {
89
91
  onSearchChange(esQueryBuilderModel.toBuilderMode());
@@ -114,13 +116,21 @@ function ConnectionQueryWorkspace({
114
116
  },
115
117
  className,
116
118
  navigator: tabs.length === 0 && !descriptor.target ? void 0 : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-col gap-2", children: [
117
- ((_b = descriptor.target) == null ? void 0 : _b.kind) === "index" ? /* @__PURE__ */ jsxRuntime.jsx(
119
+ descriptor.catalog ? /* @__PURE__ */ jsxRuntime.jsx(inspectionStatus.InspectionStatus, { inspection }) : null,
120
+ indexTarget ? /* @__PURE__ */ jsxRuntime.jsx(
118
121
  queryTargetPicker.QueryTargetPicker,
119
122
  {
120
- label: descriptor.target.label,
123
+ label: indexTarget.label,
121
124
  inspection,
122
- value: String(browserOptions.index ?? ""),
123
- onChange: (index, targetKind) => applyOptions(connectionBrowserModel.withTarget(edited.current, { index, targetKind }))
125
+ discoverable: descriptor.catalog === true,
126
+ value: String(browserOptions[indexTarget.option] ?? ""),
127
+ onChange: (index, targetKind) => applyOptions(
128
+ connectionBrowserModel.withTarget(edited.current, {
129
+ option: indexTarget.option,
130
+ value: index,
131
+ targetKind
132
+ })
133
+ )
124
134
  }
125
135
  ) : null,
126
136
  ((_c = descriptor.target) == null ? void 0 : _c.kind) === "kubernetes-workload" ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -172,10 +182,12 @@ function ConnectionQueryWorkspace({
172
182
  }
173
183
  ) : null
174
184
  ] }),
175
- execute: (request) => execute(
176
- specMode ? { ...request, query: "", options: { ...request.options, search } } : request
177
- ),
178
- ...lookupFilterValues ? { lookupFilterValues } : {},
185
+ execute: (request) => execute(specMode ? connectionQueryWorkspaceModel.structuredSearchRequest(request, search) : request),
186
+ ...lookupFilterValues ? {
187
+ lookupFilterValues: (request) => lookupFilterValues(
188
+ specMode ? connectionQueryWorkspaceModel.structuredSearchRequest(request, search) : request
189
+ )
190
+ } : {},
179
191
  renderResults: renderResults ?? descriptorResultView(descriptor)
180
192
  }
181
193
  );
@@ -184,7 +196,15 @@ function descriptorResultView(descriptor) {
184
196
  if (descriptor.resultView === "logs") {
185
197
  return ({ result, defaultView }) => {
186
198
  var _a;
187
- return ((_a = result.rows) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxRuntime.jsx(LogsTable.LogsTable, { logs: result.rows, autoFilter: false, fullscreenTitle: "Logs" }) : defaultView;
199
+ return ((_a = result.rows) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxRuntime.jsx(
200
+ LogsTable.LogsTable,
201
+ {
202
+ logs: result.rows,
203
+ autoFilter: false,
204
+ fullscreenTitle: "Logs",
205
+ ...connectionQueryWorkspaceModel.logsResultSort(descriptor)
206
+ }
207
+ ) : defaultView;
188
208
  };
189
209
  }
190
210
  if (descriptor.resultView === "timeseries") {