@flanksource/clicky-ui 0.3.19 → 0.3.21

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 (450) hide show
  1. package/dist/components/ErrorWrapper.cjs +1 -1
  2. package/dist/components/ErrorWrapper.cjs.map +1 -1
  3. package/dist/components/ErrorWrapper.js +1 -1
  4. package/dist/components/ErrorWrapper.js.map +1 -1
  5. package/dist/components/UnitStepControls.cjs +55 -0
  6. package/dist/components/UnitStepControls.cjs.map +1 -0
  7. package/dist/components/UnitStepControls.d.ts +10 -0
  8. package/dist/components/UnitStepControls.d.ts.map +1 -0
  9. package/dist/components/UnitStepControls.js +55 -0
  10. package/dist/components/UnitStepControls.js.map +1 -0
  11. package/dist/components/json-schema-form-accordion-array.cjs +5 -73
  12. package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
  13. package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
  14. package/dist/components/json-schema-form-accordion-array.js +3 -71
  15. package/dist/components/json-schema-form-accordion-array.js.map +1 -1
  16. package/dist/components/json-schema-form-array.cjs +6 -1
  17. package/dist/components/json-schema-form-array.cjs.map +1 -1
  18. package/dist/components/json-schema-form-array.d.ts.map +1 -1
  19. package/dist/components/json-schema-form-array.js +6 -1
  20. package/dist/components/json-schema-form-array.js.map +1 -1
  21. package/dist/components/json-schema-form-cards-array.cjs +96 -0
  22. package/dist/components/json-schema-form-cards-array.cjs.map +1 -0
  23. package/dist/components/json-schema-form-cards-array.d.ts +7 -0
  24. package/dist/components/json-schema-form-cards-array.d.ts.map +1 -0
  25. package/dist/components/json-schema-form-cards-array.js +96 -0
  26. package/dist/components/json-schema-form-cards-array.js.map +1 -0
  27. package/dist/components/json-schema-form-item-row.cjs +81 -0
  28. package/dist/components/json-schema-form-item-row.cjs.map +1 -0
  29. package/dist/components/json-schema-form-item-row.d.ts +19 -0
  30. package/dist/components/json-schema-form-item-row.d.ts.map +1 -0
  31. package/dist/components/json-schema-form-item-row.js +81 -0
  32. package/dist/components/json-schema-form-item-row.js.map +1 -0
  33. package/dist/components/json-schema-form-render.cjs +2 -2
  34. package/dist/components/json-schema-form-render.cjs.map +1 -1
  35. package/dist/components/json-schema-form-render.d.ts.map +1 -1
  36. package/dist/components/json-schema-form-render.js +2 -2
  37. package/dist/components/json-schema-form-render.js.map +1 -1
  38. package/dist/components/json-schema-form-resolve.cjs +1 -1
  39. package/dist/components/json-schema-form-resolve.cjs.map +1 -1
  40. package/dist/components/json-schema-form-resolve.js +1 -1
  41. package/dist/components/json-schema-form-resolve.js.map +1 -1
  42. package/dist/components/json-schema-form-tone.cjs +12 -0
  43. package/dist/components/json-schema-form-tone.cjs.map +1 -1
  44. package/dist/components/json-schema-form-tone.js +12 -0
  45. package/dist/components/json-schema-form-tone.js.map +1 -1
  46. package/dist/components/json-schema-form-types.d.ts +1 -1
  47. package/dist/components/json-schema-form-types.d.ts.map +1 -1
  48. package/dist/components/unit-form-extension.cjs +126 -0
  49. package/dist/components/unit-form-extension.cjs.map +1 -0
  50. package/dist/components/unit-form-extension.d.ts +8 -0
  51. package/dist/components/unit-form-extension.d.ts.map +1 -0
  52. package/dist/components/unit-form-extension.js +126 -0
  53. package/dist/components/unit-form-extension.js.map +1 -0
  54. package/dist/components.cjs +4 -0
  55. package/dist/components.cjs.map +1 -1
  56. package/dist/components.d.ts +1 -0
  57. package/dist/components.d.ts.map +1 -1
  58. package/dist/components.js +4 -0
  59. package/dist/components.js.map +1 -1
  60. package/dist/data/diagnostics/ErrorDetails.cjs +61 -8
  61. package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
  62. package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
  63. package/dist/data/diagnostics/ErrorDetails.js +61 -8
  64. package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
  65. package/dist/data/diagnostics/error-diagnostics.cjs +10 -4
  66. package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
  67. package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
  68. package/dist/data/diagnostics/error-diagnostics.js +10 -4
  69. package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
  70. package/dist/data/query-browser/QueryBrowser.cjs +12 -6
  71. package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
  72. package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
  73. package/dist/data/query-browser/QueryBrowser.js +12 -6
  74. package/dist/data/query-browser/QueryBrowser.js.map +1 -1
  75. package/dist/data/query-browser/QueryBrowser.types.cjs +2 -1
  76. package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
  77. package/dist/data/query-browser/QueryBrowser.types.d.ts +16 -14
  78. package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
  79. package/dist/data/query-browser/QueryBrowser.types.js +2 -1
  80. package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
  81. package/dist/data/version-info.cjs +3 -3
  82. package/dist/data/version-info.js +3 -3
  83. package/dist/index.cjs +4 -0
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.js +4 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/lib/string.cjs +8 -0
  88. package/dist/lib/string.cjs.map +1 -1
  89. package/dist/lib/string.d.ts +1 -0
  90. package/dist/lib/string.d.ts.map +1 -1
  91. package/dist/lib/string.js +8 -0
  92. package/dist/lib/string.js.map +1 -1
  93. package/dist/profiles/catalogTree.cjs +133 -0
  94. package/dist/profiles/catalogTree.cjs.map +1 -0
  95. package/dist/profiles/catalogTree.d.ts +11 -0
  96. package/dist/profiles/catalogTree.d.ts.map +1 -0
  97. package/dist/profiles/catalogTree.js +133 -0
  98. package/dist/profiles/catalogTree.js.map +1 -0
  99. package/dist/profiles/connectionBrowserModel.cjs +185 -0
  100. package/dist/profiles/connectionBrowserModel.cjs.map +1 -0
  101. package/dist/profiles/connectionBrowserModel.d.ts +169 -0
  102. package/dist/profiles/connectionBrowserModel.d.ts.map +1 -0
  103. package/dist/profiles/connectionBrowserModel.js +185 -0
  104. package/dist/profiles/connectionBrowserModel.js.map +1 -0
  105. package/dist/profiles/connectionQueryWorkspace.cjs +185 -0
  106. package/dist/profiles/connectionQueryWorkspace.cjs.map +1 -0
  107. package/dist/profiles/connectionQueryWorkspace.d.ts +63 -0
  108. package/dist/profiles/connectionQueryWorkspace.d.ts.map +1 -0
  109. package/dist/profiles/connectionQueryWorkspace.js +185 -0
  110. package/dist/profiles/connectionQueryWorkspace.js.map +1 -0
  111. package/dist/profiles/connectionQueryWorkspaceModel.cjs +28 -0
  112. package/dist/profiles/connectionQueryWorkspaceModel.cjs.map +1 -0
  113. package/dist/profiles/connectionQueryWorkspaceModel.d.ts +38 -0
  114. package/dist/profiles/connectionQueryWorkspaceModel.d.ts.map +1 -0
  115. package/dist/profiles/connectionQueryWorkspaceModel.js +28 -0
  116. package/dist/profiles/connectionQueryWorkspaceModel.js.map +1 -0
  117. package/dist/profiles/esFieldValues.cjs +64 -0
  118. package/dist/profiles/esFieldValues.cjs.map +1 -0
  119. package/dist/profiles/esFieldValues.d.ts +48 -0
  120. package/dist/profiles/esFieldValues.d.ts.map +1 -0
  121. package/dist/profiles/esFieldValues.js +64 -0
  122. package/dist/profiles/esFieldValues.js.map +1 -0
  123. package/dist/profiles/esParamMappingModel.cjs +301 -0
  124. package/dist/profiles/esParamMappingModel.cjs.map +1 -0
  125. package/dist/profiles/esParamMappingModel.d.ts +37 -0
  126. package/dist/profiles/esParamMappingModel.d.ts.map +1 -0
  127. package/dist/profiles/esParamMappingModel.js +301 -0
  128. package/dist/profiles/esParamMappingModel.js.map +1 -0
  129. package/dist/profiles/esParamMappingPill.cjs +24 -0
  130. package/dist/profiles/esParamMappingPill.cjs.map +1 -0
  131. package/dist/profiles/esParamMappingPill.d.ts +13 -0
  132. package/dist/profiles/esParamMappingPill.d.ts.map +1 -0
  133. package/dist/profiles/esParamMappingPill.js +24 -0
  134. package/dist/profiles/esParamMappingPill.js.map +1 -0
  135. package/dist/profiles/esParamOperandExtension.cjs +75 -0
  136. package/dist/profiles/esParamOperandExtension.cjs.map +1 -0
  137. package/dist/profiles/esParamOperandExtension.d.ts +11 -0
  138. package/dist/profiles/esParamOperandExtension.d.ts.map +1 -0
  139. package/dist/profiles/esParamOperandExtension.js +75 -0
  140. package/dist/profiles/esParamOperandExtension.js.map +1 -0
  141. package/dist/profiles/esQueryBuilder.cjs +205 -0
  142. package/dist/profiles/esQueryBuilder.cjs.map +1 -0
  143. package/dist/profiles/esQueryBuilder.d.ts +35 -0
  144. package/dist/profiles/esQueryBuilder.d.ts.map +1 -0
  145. package/dist/profiles/esQueryBuilder.js +205 -0
  146. package/dist/profiles/esQueryBuilder.js.map +1 -0
  147. package/dist/profiles/esQueryBuilderExtension.cjs +23 -0
  148. package/dist/profiles/esQueryBuilderExtension.cjs.map +1 -0
  149. package/dist/profiles/esQueryBuilderExtension.d.ts +5 -0
  150. package/dist/profiles/esQueryBuilderExtension.d.ts.map +1 -0
  151. package/dist/profiles/esQueryBuilderExtension.js +23 -0
  152. package/dist/profiles/esQueryBuilderExtension.js.map +1 -0
  153. package/dist/profiles/esQueryBuilderForm.cjs +26 -0
  154. package/dist/profiles/esQueryBuilderForm.cjs.map +1 -0
  155. package/dist/profiles/esQueryBuilderForm.d.ts +18 -0
  156. package/dist/profiles/esQueryBuilderForm.d.ts.map +1 -0
  157. package/dist/profiles/esQueryBuilderForm.js +26 -0
  158. package/dist/profiles/esQueryBuilderForm.js.map +1 -0
  159. package/dist/profiles/esQueryBuilderModel.cjs +131 -0
  160. package/dist/profiles/esQueryBuilderModel.cjs.map +1 -0
  161. package/dist/profiles/esQueryBuilderModel.d.ts +108 -0
  162. package/dist/profiles/esQueryBuilderModel.d.ts.map +1 -0
  163. package/dist/profiles/esQueryBuilderModel.js +131 -0
  164. package/dist/profiles/esQueryBuilderModel.js.map +1 -0
  165. package/dist/profiles/esQueryClauseGroup.cjs +144 -0
  166. package/dist/profiles/esQueryClauseGroup.cjs.map +1 -0
  167. package/dist/profiles/esQueryClauseGroup.d.ts +10 -0
  168. package/dist/profiles/esQueryClauseGroup.d.ts.map +1 -0
  169. package/dist/profiles/esQueryClauseGroup.js +144 -0
  170. package/dist/profiles/esQueryClauseGroup.js.map +1 -0
  171. package/dist/profiles/esQueryCompile.cjs +47 -0
  172. package/dist/profiles/esQueryCompile.cjs.map +1 -0
  173. package/dist/profiles/esQueryCompile.d.ts +39 -0
  174. package/dist/profiles/esQueryCompile.d.ts.map +1 -0
  175. package/dist/profiles/esQueryCompile.js +47 -0
  176. package/dist/profiles/esQueryCompile.js.map +1 -0
  177. package/dist/profiles/esQueryConditionRow.cjs +168 -0
  178. package/dist/profiles/esQueryConditionRow.cjs.map +1 -0
  179. package/dist/profiles/esQueryConditionRow.d.ts +37 -0
  180. package/dist/profiles/esQueryConditionRow.d.ts.map +1 -0
  181. package/dist/profiles/esQueryConditionRow.js +168 -0
  182. package/dist/profiles/esQueryConditionRow.js.map +1 -0
  183. package/dist/profiles/esQueryGroupModel.cjs +12 -0
  184. package/dist/profiles/esQueryGroupModel.cjs.map +1 -0
  185. package/dist/profiles/esQueryGroupModel.d.ts +9 -0
  186. package/dist/profiles/esQueryGroupModel.d.ts.map +1 -0
  187. package/dist/profiles/esQueryGroupModel.js +12 -0
  188. package/dist/profiles/esQueryGroupModel.js.map +1 -0
  189. package/dist/profiles/esQueryOccur.cjs +16 -0
  190. package/dist/profiles/esQueryOccur.cjs.map +1 -0
  191. package/dist/profiles/esQueryOccur.d.ts +11 -0
  192. package/dist/profiles/esQueryOccur.d.ts.map +1 -0
  193. package/dist/profiles/esQueryOccur.js +16 -0
  194. package/dist/profiles/esQueryOccur.js.map +1 -0
  195. package/dist/profiles/esQueryOperandEditors.cjs +279 -0
  196. package/dist/profiles/esQueryOperandEditors.cjs.map +1 -0
  197. package/dist/profiles/esQueryOperandEditors.d.ts +24 -0
  198. package/dist/profiles/esQueryOperandEditors.d.ts.map +1 -0
  199. package/dist/profiles/esQueryOperandEditors.js +279 -0
  200. package/dist/profiles/esQueryOperandEditors.js.map +1 -0
  201. package/dist/profiles/esQueryOperandModel.cjs +28 -0
  202. package/dist/profiles/esQueryOperandModel.cjs.map +1 -0
  203. package/dist/profiles/esQueryOperandModel.d.ts +17 -0
  204. package/dist/profiles/esQueryOperandModel.d.ts.map +1 -0
  205. package/dist/profiles/esQueryOperandModel.js +28 -0
  206. package/dist/profiles/esQueryOperandModel.js.map +1 -0
  207. package/dist/profiles/esQueryOperators.cjs +165 -0
  208. package/dist/profiles/esQueryOperators.cjs.map +1 -0
  209. package/dist/profiles/esQueryOperators.d.ts +83 -0
  210. package/dist/profiles/esQueryOperators.d.ts.map +1 -0
  211. package/dist/profiles/esQueryOperators.js +165 -0
  212. package/dist/profiles/esQueryOperators.js.map +1 -0
  213. package/dist/profiles/esQueryOutputEditor.cjs +138 -0
  214. package/dist/profiles/esQueryOutputEditor.cjs.map +1 -0
  215. package/dist/profiles/esQueryOutputEditor.d.ts +7 -0
  216. package/dist/profiles/esQueryOutputEditor.d.ts.map +1 -0
  217. package/dist/profiles/esQueryOutputEditor.js +138 -0
  218. package/dist/profiles/esQueryOutputEditor.js.map +1 -0
  219. package/dist/profiles/esQueryOutputModel.cjs +16 -0
  220. package/dist/profiles/esQueryOutputModel.cjs.map +1 -0
  221. package/dist/profiles/esQueryOutputModel.d.ts +14 -0
  222. package/dist/profiles/esQueryOutputModel.d.ts.map +1 -0
  223. package/dist/profiles/esQueryOutputModel.js +16 -0
  224. package/dist/profiles/esQueryOutputModel.js.map +1 -0
  225. package/dist/profiles/esQueryPreview.cjs +30 -0
  226. package/dist/profiles/esQueryPreview.cjs.map +1 -0
  227. package/dist/profiles/esQueryPreview.d.ts +6 -0
  228. package/dist/profiles/esQueryPreview.d.ts.map +1 -0
  229. package/dist/profiles/esQueryPreview.js +30 -0
  230. package/dist/profiles/esQueryPreview.js.map +1 -0
  231. package/dist/profiles/esQuerySortEditor.cjs +143 -0
  232. package/dist/profiles/esQuerySortEditor.cjs.map +1 -0
  233. package/dist/profiles/esQuerySortEditor.d.ts +9 -0
  234. package/dist/profiles/esQuerySortEditor.d.ts.map +1 -0
  235. package/dist/profiles/esQuerySortEditor.js +143 -0
  236. package/dist/profiles/esQuerySortEditor.js.map +1 -0
  237. package/dist/profiles/esQuerySortModel.cjs +13 -0
  238. package/dist/profiles/esQuerySortModel.cjs.map +1 -0
  239. package/dist/profiles/esQuerySortModel.d.ts +4 -0
  240. package/dist/profiles/esQuerySortModel.d.ts.map +1 -0
  241. package/dist/profiles/esQuerySortModel.js +13 -0
  242. package/dist/profiles/esQuerySortModel.js.map +1 -0
  243. package/dist/profiles/esValueCombobox.cjs +86 -0
  244. package/dist/profiles/esValueCombobox.cjs.map +1 -0
  245. package/dist/profiles/esValueCombobox.d.ts +15 -0
  246. package/dist/profiles/esValueCombobox.d.ts.map +1 -0
  247. package/dist/profiles/esValueCombobox.js +86 -0
  248. package/dist/profiles/esValueCombobox.js.map +1 -0
  249. package/dist/profiles/jsonPathSample.cjs +75 -0
  250. package/dist/profiles/jsonPathSample.cjs.map +1 -0
  251. package/dist/profiles/jsonPathSample.d.ts +27 -0
  252. package/dist/profiles/jsonPathSample.d.ts.map +1 -0
  253. package/dist/profiles/jsonPathSample.js +75 -0
  254. package/dist/profiles/jsonPathSample.js.map +1 -0
  255. package/dist/profiles/jsonPathSampleRow.cjs +14 -0
  256. package/dist/profiles/jsonPathSampleRow.cjs.map +1 -0
  257. package/dist/profiles/jsonPathSampleRow.d.ts +6 -0
  258. package/dist/profiles/jsonPathSampleRow.d.ts.map +1 -0
  259. package/dist/profiles/jsonPathSampleRow.js +14 -0
  260. package/dist/profiles/jsonPathSampleRow.js.map +1 -0
  261. package/dist/profiles/profileApi.cjs +37 -0
  262. package/dist/profiles/profileApi.cjs.map +1 -0
  263. package/dist/profiles/profileApi.d.ts +32 -0
  264. package/dist/profiles/profileApi.d.ts.map +1 -0
  265. package/dist/profiles/profileApi.js +37 -0
  266. package/dist/profiles/profileApi.js.map +1 -0
  267. package/dist/profiles/profileBuilder.cjs +65 -0
  268. package/dist/profiles/profileBuilder.cjs.map +1 -0
  269. package/dist/profiles/profileBuilder.d.ts +11 -0
  270. package/dist/profiles/profileBuilder.d.ts.map +1 -0
  271. package/dist/profiles/profileBuilder.js +65 -0
  272. package/dist/profiles/profileBuilder.js.map +1 -0
  273. package/dist/profiles/profileBuilderExtension.cjs +25 -0
  274. package/dist/profiles/profileBuilderExtension.cjs.map +1 -0
  275. package/dist/profiles/profileBuilderExtension.d.ts +5 -0
  276. package/dist/profiles/profileBuilderExtension.d.ts.map +1 -0
  277. package/dist/profiles/profileBuilderExtension.js +25 -0
  278. package/dist/profiles/profileBuilderExtension.js.map +1 -0
  279. package/dist/profiles/profileBuilderWorkspace.cjs +368 -0
  280. package/dist/profiles/profileBuilderWorkspace.cjs.map +1 -0
  281. package/dist/profiles/profileBuilderWorkspace.d.ts +21 -0
  282. package/dist/profiles/profileBuilderWorkspace.d.ts.map +1 -0
  283. package/dist/profiles/profileBuilderWorkspace.js +368 -0
  284. package/dist/profiles/profileBuilderWorkspace.js.map +1 -0
  285. package/dist/profiles/profileColumnModel.cjs +23 -0
  286. package/dist/profiles/profileColumnModel.cjs.map +1 -0
  287. package/dist/profiles/profileColumnModel.d.ts +8 -0
  288. package/dist/profiles/profileColumnModel.d.ts.map +1 -0
  289. package/dist/profiles/profileColumnModel.js +23 -0
  290. package/dist/profiles/profileColumnModel.js.map +1 -0
  291. package/dist/profiles/profileColumnPicker.cjs +68 -0
  292. package/dist/profiles/profileColumnPicker.cjs.map +1 -0
  293. package/dist/profiles/profileColumnPicker.d.ts +11 -0
  294. package/dist/profiles/profileColumnPicker.d.ts.map +1 -0
  295. package/dist/profiles/profileColumnPicker.js +68 -0
  296. package/dist/profiles/profileColumnPicker.js.map +1 -0
  297. package/dist/profiles/profileEditor.cjs +386 -0
  298. package/dist/profiles/profileEditor.cjs.map +1 -0
  299. package/dist/profiles/profileEditor.d.ts +19 -0
  300. package/dist/profiles/profileEditor.d.ts.map +1 -0
  301. package/dist/profiles/profileEditor.js +386 -0
  302. package/dist/profiles/profileEditor.js.map +1 -0
  303. package/dist/profiles/profileEditorModel.cjs +181 -0
  304. package/dist/profiles/profileEditorModel.cjs.map +1 -0
  305. package/dist/profiles/profileEditorModel.d.ts +74 -0
  306. package/dist/profiles/profileEditorModel.d.ts.map +1 -0
  307. package/dist/profiles/profileEditorModel.js +181 -0
  308. package/dist/profiles/profileEditorModel.js.map +1 -0
  309. package/dist/profiles/profileEditorPreview.cjs +38 -0
  310. package/dist/profiles/profileEditorPreview.cjs.map +1 -0
  311. package/dist/profiles/profileEditorPreview.d.ts +12 -0
  312. package/dist/profiles/profileEditorPreview.d.ts.map +1 -0
  313. package/dist/profiles/profileEditorPreview.js +38 -0
  314. package/dist/profiles/profileEditorPreview.js.map +1 -0
  315. package/dist/profiles/profileEditorRail.cjs +46 -0
  316. package/dist/profiles/profileEditorRail.cjs.map +1 -0
  317. package/dist/profiles/profileEditorRail.d.ts +8 -0
  318. package/dist/profiles/profileEditorRail.d.ts.map +1 -0
  319. package/dist/profiles/profileEditorRail.js +46 -0
  320. package/dist/profiles/profileEditorRail.js.map +1 -0
  321. package/dist/profiles/profileEditorRaw.cjs +118 -0
  322. package/dist/profiles/profileEditorRaw.cjs.map +1 -0
  323. package/dist/profiles/profileEditorRaw.d.ts +7 -0
  324. package/dist/profiles/profileEditorRaw.d.ts.map +1 -0
  325. package/dist/profiles/profileEditorRaw.js +118 -0
  326. package/dist/profiles/profileEditorRaw.js.map +1 -0
  327. package/dist/profiles/profileEditorRoutes.cjs +7 -0
  328. package/dist/profiles/profileEditorRoutes.cjs.map +1 -0
  329. package/dist/profiles/profileEditorRoutes.d.ts +2 -0
  330. package/dist/profiles/profileEditorRoutes.d.ts.map +1 -0
  331. package/dist/profiles/profileEditorRoutes.js +7 -0
  332. package/dist/profiles/profileEditorRoutes.js.map +1 -0
  333. package/dist/profiles/profileEditorSections.cjs +213 -0
  334. package/dist/profiles/profileEditorSections.cjs.map +1 -0
  335. package/dist/profiles/profileEditorSections.d.ts +23 -0
  336. package/dist/profiles/profileEditorSections.d.ts.map +1 -0
  337. package/dist/profiles/profileEditorSections.js +213 -0
  338. package/dist/profiles/profileEditorSections.js.map +1 -0
  339. package/dist/profiles/profileFieldEditor.cjs +200 -0
  340. package/dist/profiles/profileFieldEditor.cjs.map +1 -0
  341. package/dist/profiles/profileFieldEditor.d.ts +34 -0
  342. package/dist/profiles/profileFieldEditor.d.ts.map +1 -0
  343. package/dist/profiles/profileFieldEditor.js +200 -0
  344. package/dist/profiles/profileFieldEditor.js.map +1 -0
  345. package/dist/profiles/profileFieldGrid.cjs +250 -0
  346. package/dist/profiles/profileFieldGrid.cjs.map +1 -0
  347. package/dist/profiles/profileFieldGrid.d.ts +20 -0
  348. package/dist/profiles/profileFieldGrid.d.ts.map +1 -0
  349. package/dist/profiles/profileFieldGrid.js +250 -0
  350. package/dist/profiles/profileFieldGrid.js.map +1 -0
  351. package/dist/profiles/profileFieldManager.cjs +103 -0
  352. package/dist/profiles/profileFieldManager.cjs.map +1 -0
  353. package/dist/profiles/profileFieldManager.d.ts +9 -0
  354. package/dist/profiles/profileFieldManager.d.ts.map +1 -0
  355. package/dist/profiles/profileFieldManager.js +103 -0
  356. package/dist/profiles/profileFieldManager.js.map +1 -0
  357. package/dist/profiles/profileFieldState.cjs +136 -0
  358. package/dist/profiles/profileFieldState.cjs.map +1 -0
  359. package/dist/profiles/profileFieldState.d.ts +41 -0
  360. package/dist/profiles/profileFieldState.d.ts.map +1 -0
  361. package/dist/profiles/profileFieldState.js +136 -0
  362. package/dist/profiles/profileFieldState.js.map +1 -0
  363. package/dist/profiles/profileFieldTypes.cjs +17 -0
  364. package/dist/profiles/profileFieldTypes.cjs.map +1 -0
  365. package/dist/profiles/profileFieldTypes.d.ts +8 -0
  366. package/dist/profiles/profileFieldTypes.d.ts.map +1 -0
  367. package/dist/profiles/profileFieldTypes.js +17 -0
  368. package/dist/profiles/profileFieldTypes.js.map +1 -0
  369. package/dist/profiles/profileParamModel.cjs +78 -0
  370. package/dist/profiles/profileParamModel.cjs.map +1 -0
  371. package/dist/profiles/profileParamModel.d.ts +3 -0
  372. package/dist/profiles/profileParamModel.d.ts.map +1 -0
  373. package/dist/profiles/profileParamModel.js +78 -0
  374. package/dist/profiles/profileParamModel.js.map +1 -0
  375. package/dist/profiles/profileSamplePayload.cjs +15 -0
  376. package/dist/profiles/profileSamplePayload.cjs.map +1 -0
  377. package/dist/profiles/profileSamplePayload.d.ts +13 -0
  378. package/dist/profiles/profileSamplePayload.d.ts.map +1 -0
  379. package/dist/profiles/profileSamplePayload.js +15 -0
  380. package/dist/profiles/profileSamplePayload.js.map +1 -0
  381. package/dist/profiles/profileWizard.cjs +257 -0
  382. package/dist/profiles/profileWizard.cjs.map +1 -0
  383. package/dist/profiles/profileWizard.d.ts +12 -0
  384. package/dist/profiles/profileWizard.d.ts.map +1 -0
  385. package/dist/profiles/profileWizard.js +257 -0
  386. package/dist/profiles/profileWizard.js.map +1 -0
  387. package/dist/profiles/profileWizardHelp.cjs +10 -0
  388. package/dist/profiles/profileWizardHelp.cjs.map +1 -0
  389. package/dist/profiles/profileWizardHelp.d.ts +13 -0
  390. package/dist/profiles/profileWizardHelp.d.ts.map +1 -0
  391. package/dist/profiles/profileWizardHelp.js +10 -0
  392. package/dist/profiles/profileWizardHelp.js.map +1 -0
  393. package/dist/profiles/profileWizardModel.cjs +198 -0
  394. package/dist/profiles/profileWizardModel.cjs.map +1 -0
  395. package/dist/profiles/profileWizardModel.d.ts +255 -0
  396. package/dist/profiles/profileWizardModel.d.ts.map +1 -0
  397. package/dist/profiles/profileWizardModel.js +198 -0
  398. package/dist/profiles/profileWizardModel.js.map +1 -0
  399. package/dist/profiles/profileWizardQueryStep.cjs +215 -0
  400. package/dist/profiles/profileWizardQueryStep.cjs.map +1 -0
  401. package/dist/profiles/profileWizardQueryStep.d.ts +18 -0
  402. package/dist/profiles/profileWizardQueryStep.d.ts.map +1 -0
  403. package/dist/profiles/profileWizardQueryStep.js +215 -0
  404. package/dist/profiles/profileWizardQueryStep.js.map +1 -0
  405. package/dist/profiles/profileWizardSteps.cjs +214 -0
  406. package/dist/profiles/profileWizardSteps.cjs.map +1 -0
  407. package/dist/profiles/profileWizardSteps.d.ts +35 -0
  408. package/dist/profiles/profileWizardSteps.d.ts.map +1 -0
  409. package/dist/profiles/profileWizardSteps.js +214 -0
  410. package/dist/profiles/profileWizardSteps.js.map +1 -0
  411. package/dist/profiles/profileYaml.cjs +19 -0
  412. package/dist/profiles/profileYaml.cjs.map +1 -0
  413. package/dist/profiles/profileYaml.d.ts +4 -0
  414. package/dist/profiles/profileYaml.d.ts.map +1 -0
  415. package/dist/profiles/profileYaml.js +19 -0
  416. package/dist/profiles/profileYaml.js.map +1 -0
  417. package/dist/profiles/prometheusResults.cjs +60 -0
  418. package/dist/profiles/prometheusResults.cjs.map +1 -0
  419. package/dist/profiles/prometheusResults.d.ts +7 -0
  420. package/dist/profiles/prometheusResults.d.ts.map +1 -0
  421. package/dist/profiles/prometheusResults.js +60 -0
  422. package/dist/profiles/prometheusResults.js.map +1 -0
  423. package/dist/profiles/queryRowLimits.cjs +82 -0
  424. package/dist/profiles/queryRowLimits.cjs.map +1 -0
  425. package/dist/profiles/queryRowLimits.d.ts +9 -0
  426. package/dist/profiles/queryRowLimits.d.ts.map +1 -0
  427. package/dist/profiles/queryRowLimits.js +82 -0
  428. package/dist/profiles/queryRowLimits.js.map +1 -0
  429. package/dist/profiles/queryRowLimitsModel.cjs +10 -0
  430. package/dist/profiles/queryRowLimitsModel.cjs.map +1 -0
  431. package/dist/profiles/queryRowLimitsModel.d.ts +9 -0
  432. package/dist/profiles/queryRowLimitsModel.d.ts.map +1 -0
  433. package/dist/profiles/queryRowLimitsModel.js +10 -0
  434. package/dist/profiles/queryRowLimitsModel.js.map +1 -0
  435. package/dist/profiles/queryTargetPicker.cjs +42 -0
  436. package/dist/profiles/queryTargetPicker.cjs.map +1 -0
  437. package/dist/profiles/queryTargetPicker.d.ts +8 -0
  438. package/dist/profiles/queryTargetPicker.d.ts.map +1 -0
  439. package/dist/profiles/queryTargetPicker.js +42 -0
  440. package/dist/profiles/queryTargetPicker.js.map +1 -0
  441. package/dist/profiles/testSchema.d.ts +3 -0
  442. package/dist/profiles/testSchema.d.ts.map +1 -0
  443. package/dist/profiles.cjs +223 -0
  444. package/dist/profiles.cjs.map +1 -0
  445. package/dist/profiles.d.ts +68 -0
  446. package/dist/profiles.d.ts.map +1 -0
  447. package/dist/profiles.js +223 -0
  448. package/dist/profiles.js.map +1 -0
  449. package/dist/styles.css +1 -1
  450. package/package.json +6 -1
@@ -0,0 +1,386 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { Button } from "../components/button.js";
3
+ import { Workspace } from "../layout/Workspace.js";
4
+ import { Modal } from "../overlay/Modal.js";
5
+ import { useOperationLookupFetcher } from "../rpc/operationLookupFetcher.js";
6
+ import { useMemo, useState, useEffect, Suspense, lazy } from "react";
7
+ import { cloneProfileDraft, profileSampleSignature, validateProfileEditorDraft, profileColumnResetState, profileEditorSectionStatus, profileAdvancedKeys, profileEditorSections, profileUpdateConflictTarget, resetProfileColumns, mergeSampledProfileColumns } from "./profileEditorModel.js";
8
+ import { ProfileEditorPreview } from "./profileEditorPreview.js";
9
+ import { ProfileEditorRail } from "./profileEditorRail.js";
10
+ import { ProfileGeneralSection, ProfileSourceSection, ProfileSchemaSection } from "./profileEditorSections.js";
11
+ import { ProfileFieldEditorActions, ProfileFieldEditorForm, profileFieldEditorEmptyMessage } from "./profileFieldEditor.js";
12
+ import { ProfileFieldFilters, ProfileFieldGrid } from "./profileFieldGrid.js";
13
+ import { useProfileFieldState } from "./profileFieldState.js";
14
+ import { JsonPathProfileProvider } from "./jsonPathSampleRow.js";
15
+ import { resolveProfileUpdatePath } from "./profileEditorRoutes.js";
16
+ import { UiColumns } from "../icons/components/UiColumns.js";
17
+ import { UiSliders } from "../icons/components/UiSliders.js";
18
+ import { UiTable } from "../icons/components/UiTable.js";
19
+ import { UiListTree } from "../icons/components/UiListTree.js";
20
+ const ProfileEditorRaw = lazy(
21
+ () => import("./profileEditorRaw.js").then((module) => ({
22
+ default: module.ProfileEditorRaw
23
+ }))
24
+ );
25
+ function ProfileEditor({
26
+ client,
27
+ action,
28
+ surfaceKey,
29
+ initialValue,
30
+ onClose,
31
+ onSuccess
32
+ }) {
33
+ var _a, _b, _c;
34
+ const lookupFetcher = useOperationLookupFetcher(client);
35
+ const initialDraft = useMemo(() => cloneProfileDraft(initialValue), [initialValue]);
36
+ const initialSerialized = useMemo(() => JSON.stringify(initialDraft), [initialDraft]);
37
+ const [draft, setDraft] = useState(initialDraft);
38
+ const [section, setSection] = useState("general");
39
+ const [discovered, setDiscovered] = useState(initialDraft.columns ?? []);
40
+ const [sampledColumns, setSampledColumns] = useState([]);
41
+ const [sampleRows, setSampleRows] = useState([]);
42
+ const [activeField, setActiveField] = useState(((_b = (_a = initialDraft.columns) == null ? void 0 : _a[0]) == null ? void 0 : _b.name) ?? "");
43
+ const [lastSampleSignature, setLastSampleSignature] = useState(() => profileSampleSignature(initialDraft));
44
+ const [rawValid, setRawValid] = useState(true);
45
+ const [saving, setSaving] = useState(false);
46
+ const [error, setError] = useState("");
47
+ const [replaceTarget, setReplaceTarget] = useState("");
48
+ const [confirmDiscard, setConfirmDiscard] = useState(false);
49
+ const [confirmResetColumns, setConfirmResetColumns] = useState(false);
50
+ const dirty = JSON.stringify(draft) !== initialSerialized;
51
+ const validationError = validateProfileEditorDraft(draft);
52
+ const sampleStale = profileSampleSignature(draft) !== lastSampleSignature;
53
+ const resetState = profileColumnResetState({
54
+ providerType: ((_c = draft.provider) == null ? void 0 : _c.type) ?? "",
55
+ sampledColumnCount: sampledColumns.length,
56
+ sampleStale
57
+ });
58
+ const fields = useProfileFieldState({
59
+ discovered,
60
+ configured: draft.columns ?? [],
61
+ activeName: activeField,
62
+ onConfiguredChange: (columns) => setDraft((current) => ({ ...current, columns })),
63
+ onActiveNameChange: setActiveField
64
+ });
65
+ useEffect(() => {
66
+ if (!dirty) return;
67
+ const warn = (event) => event.preventDefault();
68
+ window.addEventListener("beforeunload", warn);
69
+ return () => window.removeEventListener("beforeunload", warn);
70
+ }, [dirty]);
71
+ const save = async (replaceExisting = false) => {
72
+ if (validationError) {
73
+ setError(validationError);
74
+ return;
75
+ }
76
+ if (!client.submitForm) {
77
+ setError("Profile updates are unavailable");
78
+ return;
79
+ }
80
+ setSaving(true);
81
+ setError("");
82
+ try {
83
+ const body = {
84
+ ...draft,
85
+ id: surfaceKey,
86
+ ...replaceExisting ? { replaceExisting: true } : {}
87
+ };
88
+ const response = await client.submitForm(
89
+ resolveProfileUpdatePath(action.path, surfaceKey),
90
+ action.method,
91
+ body
92
+ );
93
+ if (!response.success) {
94
+ const message = response.error || response.message || "Profile update failed";
95
+ const target = profileUpdateConflictTarget(message);
96
+ if (target && !replaceExisting) {
97
+ setReplaceTarget(target);
98
+ return;
99
+ }
100
+ throw new Error(message);
101
+ }
102
+ await onSuccess(draft.profile.trim());
103
+ } catch (saveError) {
104
+ setError(saveError instanceof Error ? saveError.message : "Profile update failed");
105
+ } finally {
106
+ setSaving(false);
107
+ }
108
+ };
109
+ const acceptSample = ({ columns, rows, sourceDraft }) => {
110
+ setSampledColumns(structuredClone(columns));
111
+ setDiscovered(columns);
112
+ setSampleRows(rows);
113
+ setDraft((current) => ({
114
+ ...current,
115
+ columns: mergeSampledProfileColumns(current.columns ?? [], columns)
116
+ }));
117
+ setActiveField((current) => {
118
+ var _a2;
119
+ return current || ((_a2 = columns[0]) == null ? void 0 : _a2.name) || "";
120
+ });
121
+ setLastSampleSignature(profileSampleSignature(sourceDraft));
122
+ };
123
+ const resetColumns = () => {
124
+ const first = sampledColumns[0];
125
+ if (!first) throw new Error("cannot reset columns without a sample");
126
+ setDraft((current) => resetProfileColumns(current, sampledColumns));
127
+ setActiveField(first.name);
128
+ setConfirmResetColumns(false);
129
+ };
130
+ const sectionContent = /* @__PURE__ */ jsxs("div", { className: "h-full overflow-auto p-5", children: [
131
+ section === "general" ? /* @__PURE__ */ jsx(ProfileGeneralSection, { draft, onChange: setDraft }) : null,
132
+ section === "source" ? /* @__PURE__ */ jsx(
133
+ ProfileSourceSection,
134
+ {
135
+ draft,
136
+ discovered,
137
+ sampleStale,
138
+ onChange: setDraft,
139
+ onSample: acceptSample
140
+ }
141
+ ) : null,
142
+ section === "parameters" ? /* @__PURE__ */ jsx(
143
+ ProfileSchemaSection,
144
+ {
145
+ draft,
146
+ keys: ["params"],
147
+ title: "Parameters",
148
+ description: "Named values the profile query and filters accept at run time.",
149
+ idPrefix: "profile-parameters",
150
+ layout: { mode: "stacked", valueMaxWidth: "none", help: "hover" },
151
+ onChange: setDraft
152
+ }
153
+ ) : null,
154
+ section === "advanced" ? /* @__PURE__ */ jsx(
155
+ ProfileSchemaSection,
156
+ {
157
+ draft,
158
+ keys: profileAdvancedKeys,
159
+ title: "Advanced composition",
160
+ description: "Compose profiles, add ordered aliases, chain post-query processors, and control output without exposing the root schema as the page layout.",
161
+ idPrefix: "profile-advanced",
162
+ ...lookupFetcher ? { lookupFetcher } : {},
163
+ onChange: setDraft
164
+ }
165
+ ) : null,
166
+ section === "raw" ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading YAML editor…" }), children: /* @__PURE__ */ jsx(ProfileEditorRaw, { draft, onChange: setDraft, onValidityChange: setRawValid }) }) : null
167
+ ] });
168
+ const panes = useMemo(() => {
169
+ var _a2;
170
+ const rail = {
171
+ id: "sections",
172
+ label: "Profile",
173
+ icon: /* @__PURE__ */ jsx(UiListTree, {}),
174
+ location: "left",
175
+ width: 240,
176
+ minWidth: 180,
177
+ maxWidth: 340,
178
+ content: /* @__PURE__ */ jsx(
179
+ ProfileEditorRail,
180
+ {
181
+ value: section,
182
+ status: profileEditorSectionStatus({
183
+ draft,
184
+ availableColumns: fields.available.length,
185
+ sampleStale
186
+ }),
187
+ onChange: setSection
188
+ }
189
+ )
190
+ };
191
+ if (section !== "columns") {
192
+ return [rail, { id: "section", label: sectionLabel(section), location: "center", collapsible: false, contentClassName: "p-0", content: sectionContent }];
193
+ }
194
+ return [
195
+ rail,
196
+ {
197
+ id: "columns",
198
+ label: "Columns",
199
+ icon: /* @__PURE__ */ jsx(UiColumns, {}),
200
+ location: "center",
201
+ collapsible: false,
202
+ contentClassName: "flex flex-col overflow-hidden",
203
+ slots: {
204
+ headerTrailing: /* @__PURE__ */ jsxs(Fragment, { children: [
205
+ /* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [
206
+ fields.configuredCount,
207
+ " of ",
208
+ fields.available.length,
209
+ " included"
210
+ ] }),
211
+ resetState.visible ? /* @__PURE__ */ jsx(
212
+ Button,
213
+ {
214
+ type: "button",
215
+ size: "sm",
216
+ variant: "outline",
217
+ disabled: resetState.disabled,
218
+ title: resetState.title,
219
+ onClick: () => setConfirmResetColumns(true),
220
+ children: "Reset columns"
221
+ }
222
+ ) : null,
223
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: fields.addField, children: "Add column" })
224
+ ] })
225
+ },
226
+ content: /* @__PURE__ */ jsxs(Fragment, { children: [
227
+ /* @__PURE__ */ jsx("div", { className: "shrink-0 border-b border-border p-2", children: /* @__PURE__ */ jsx(ProfileFieldFilters, { state: fields, compact: true }) }),
228
+ /* @__PURE__ */ jsx(ProfileFieldGrid, { state: fields })
229
+ ] })
230
+ },
231
+ {
232
+ id: "field",
233
+ label: ((_a2 = fields.activeField) == null ? void 0 : _a2.name) ?? "Field",
234
+ icon: /* @__PURE__ */ jsx(UiSliders, {}),
235
+ location: "right",
236
+ width: 380,
237
+ minWidth: 300,
238
+ maxWidth: 560,
239
+ contentClassName: "flex flex-col overflow-hidden",
240
+ // The pane header already names the field, so this composes the editor's
241
+ // parts rather than nesting its carded, self-titling variant.
242
+ content: fields.activeField ? /* @__PURE__ */ jsxs(Fragment, { children: [
243
+ /* @__PURE__ */ jsx("div", { className: "flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-2 py-1.5", children: /* @__PURE__ */ jsx(
244
+ ProfileFieldEditorActions,
245
+ {
246
+ selected: fields.selectedNames.has(fields.activeField.name),
247
+ onSelectedChange: (selected) => {
248
+ if (fields.activeField) fields.setFieldSelection(fields.activeField, selected);
249
+ },
250
+ canMoveUp: fields.canMoveUp,
251
+ canMoveDown: fields.canMoveDown,
252
+ onMoveUp: () => fields.moveActive(-1),
253
+ onMoveDown: () => fields.moveActive(1),
254
+ onRemove: fields.removeActive
255
+ }
256
+ ) }),
257
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ jsx(
258
+ ProfileFieldEditorForm,
259
+ {
260
+ field: fields.activeField,
261
+ columns: 1,
262
+ onChange: fields.updateActiveField
263
+ }
264
+ ) })
265
+ ] }) : /* @__PURE__ */ jsx("p", { className: "grid h-full place-items-center p-4 text-center text-sm text-muted-foreground", children: profileFieldEditorEmptyMessage })
266
+ },
267
+ {
268
+ id: "preview",
269
+ label: "Preview",
270
+ icon: /* @__PURE__ */ jsx(UiTable, {}),
271
+ location: "bottom",
272
+ height: 220,
273
+ minHeight: 120,
274
+ maxHeight: 520,
275
+ slots: {
276
+ headerTrailing: /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: sampleRows.length ? `${sampleRows.length} sampled rows · updates as you edit` : "No sample yet" })
277
+ },
278
+ content: /* @__PURE__ */ jsx(ProfileEditorPreview, { columns: draft.columns ?? [], rows: sampleRows })
279
+ }
280
+ ];
281
+ }, [draft, fields, resetState, sampleRows, sampleStale, section, sectionContent]);
282
+ const leave = () => dirty ? setConfirmDiscard(true) : onClose();
283
+ return /* @__PURE__ */ jsxs(JsonPathProfileProvider, { profile: draft, children: [
284
+ /* @__PURE__ */ jsxs("div", { className: "grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] bg-background", children: [
285
+ /* @__PURE__ */ jsxs("header", { className: "flex items-center gap-3 border-b border-border px-4 py-2.5", children: [
286
+ /* @__PURE__ */ jsxs("nav", { className: "flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground", children: [
287
+ /* @__PURE__ */ jsx("button", { type: "button", className: "hover:text-foreground", onClick: leave, children: "Profiles" }),
288
+ /* @__PURE__ */ jsx("span", { children: "/" }),
289
+ /* @__PURE__ */ jsx("button", { type: "button", className: "min-w-0 truncate hover:text-foreground", onClick: leave, children: initialDraft.profile ?? surfaceKey }),
290
+ /* @__PURE__ */ jsx("span", { children: "/" }),
291
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: "Edit" })
292
+ ] }),
293
+ error ? /* @__PURE__ */ jsx("span", { className: "truncate text-sm text-destructive", children: error }) : null,
294
+ /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-xs text-muted-foreground", children: dirty ? "Unsaved changes" : "No changes" }),
295
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: leave, children: "Discard" }),
296
+ /* @__PURE__ */ jsx(
297
+ Button,
298
+ {
299
+ type: "button",
300
+ size: "sm",
301
+ disabled: saving || Boolean(validationError) || section === "raw" && !rawValid,
302
+ title: validationError ?? void 0,
303
+ onClick: () => void save(),
304
+ children: saving ? "Saving…" : "Save profile"
305
+ }
306
+ )
307
+ ] }),
308
+ /* @__PURE__ */ jsx(Workspace, { panes, storageKey: "profile-editor" })
309
+ ] }),
310
+ confirmDiscard ? /* @__PURE__ */ jsx(
311
+ Modal,
312
+ {
313
+ open: true,
314
+ onClose: () => setConfirmDiscard(false),
315
+ title: "Discard profile changes?",
316
+ size: "sm",
317
+ footer: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-end gap-2", children: [
318
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", onClick: () => setConfirmDiscard(false), children: "Keep editing" }),
319
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "destructive", onClick: onClose, children: "Discard changes" })
320
+ ] }),
321
+ children: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Your unsaved profile changes will be lost." })
322
+ }
323
+ ) : null,
324
+ confirmResetColumns ? /* @__PURE__ */ jsx(
325
+ Modal,
326
+ {
327
+ open: true,
328
+ onClose: () => setConfirmResetColumns(false),
329
+ title: "Reset columns from latest sample?",
330
+ size: "sm",
331
+ footer: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-end gap-2", children: [
332
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", onClick: () => setConfirmResetColumns(false), children: "Cancel" }),
333
+ /* @__PURE__ */ jsx(
334
+ Button,
335
+ {
336
+ type: "button",
337
+ variant: "destructive",
338
+ disabled: resetState.disabled,
339
+ onClick: resetColumns,
340
+ children: "Reset columns"
341
+ }
342
+ )
343
+ ] }),
344
+ children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
345
+ "Replace ",
346
+ fields.configuredCount,
347
+ " configured column",
348
+ fields.configuredCount === 1 ? "" : "s",
349
+ " with ",
350
+ sampledColumns.length,
351
+ " column",
352
+ sampledColumns.length === 1 ? "" : "s",
353
+ " from the latest sample. Custom labels, expressions, formatting, filtering, ordering, and manually added columns will be removed. The profile will remain unsaved until you save it."
354
+ ] })
355
+ }
356
+ ) : null,
357
+ replaceTarget ? /* @__PURE__ */ jsx(
358
+ Modal,
359
+ {
360
+ open: true,
361
+ onClose: () => setReplaceTarget(""),
362
+ title: `Replace ${replaceTarget}?`,
363
+ size: "sm",
364
+ footer: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-end gap-2", children: [
365
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", onClick: () => setReplaceTarget(""), children: "Cancel" }),
366
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "destructive", disabled: saving, onClick: () => {
367
+ setReplaceTarget("");
368
+ void save(true);
369
+ }, children: "Replace profile" })
370
+ ] }),
371
+ children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
372
+ "A profile named ",
373
+ replaceTarget,
374
+ " already exists. Its definition will be overwritten, the current profile will be renamed, and dependent imports will be updated atomically."
375
+ ] })
376
+ }
377
+ ) : null
378
+ ] });
379
+ }
380
+ function sectionLabel(section) {
381
+ return profileEditorSections.find((entry) => entry.id === section).label;
382
+ }
383
+ export {
384
+ ProfileEditor
385
+ };
386
+ //# sourceMappingURL=profileEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profileEditor.js","sources":["../../src/profiles/profileEditor.tsx"],"sourcesContent":["import { Button } from \"../components/button\";\nimport { Workspace } from \"../layout/Workspace\";\nimport type { WorkspacePaneSpec } from \"../layout/Workspace\";\nimport { Modal } from \"../overlay/Modal\";\nimport { useOperationLookupFetcher } from \"../rpc/operationLookupFetcher\";\nimport type { ResolvedOperation } from \"../rpc/types\";\nimport type { OperationsApiClient } from \"../rpc/useOperations\";\nimport { UiColumns, UiListTree, UiSliders, UiTable } from \"../icons\";\nimport { lazy, Suspense, useEffect, useMemo, useState } from \"react\";\nimport {\n cloneProfileDraft,\n mergeSampledProfileColumns,\n profileAdvancedKeys,\n profileColumnResetState,\n profileEditorSectionStatus,\n profileEditorSections,\n profileSampleSignature,\n profileUpdateConflictTarget,\n resetProfileColumns,\n validateProfileEditorDraft,\n type ProfileEditorSection,\n} from \"./profileEditorModel\";\nimport { ProfileEditorPreview } from \"./profileEditorPreview\";\nimport { ProfileEditorRail } from \"./profileEditorRail\";\nimport {\n ProfileGeneralSection,\n ProfileSchemaSection,\n ProfileSourceSection,\n} from \"./profileEditorSections\";\nimport {\n ProfileFieldEditorActions,\n ProfileFieldEditorForm,\n profileFieldEditorEmptyMessage,\n} from \"./profileFieldEditor\";\nimport { ProfileFieldFilters, ProfileFieldGrid } from \"./profileFieldGrid\";\nimport { useProfileFieldState } from \"./profileFieldState\";\nimport type { ProfileSample } from \"./profileWizardQueryStep\";\nimport { JsonPathProfileProvider } from \"./jsonPathSampleRow\";\nimport type { ProfileColumn, ProfileWizardDraft } from \"./profileWizardModel\";\nimport { resolveProfileUpdatePath } from \"./profileEditorRoutes\";\n\nconst ProfileEditorRaw = lazy(() =>\n import(\"./profileEditorRaw\").then((module) => ({\n default: module.ProfileEditorRaw,\n })),\n);\n\n/**\n * The profile editor as a route rather than a dialog.\n *\n * Six sections, ~130 discoverable fields and a CEL editor per column outgrew a\n * modal: the layout is a clicky-ui Workspace, so the section rail, the column\n * grid, the field inspector and the sampled preview are panes the user can\n * resize, collapse and keep across visits.\n */\nexport function ProfileEditor({\n client,\n action,\n surfaceKey,\n initialValue,\n onClose,\n onSuccess,\n}: {\n client: OperationsApiClient;\n action: ResolvedOperation;\n surfaceKey: string;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: (name: string) => void | Promise<void>;\n}) {\n const lookupFetcher = useOperationLookupFetcher(client);\n const initialDraft = useMemo(() => cloneProfileDraft(initialValue), [initialValue]);\n const initialSerialized = useMemo(() => JSON.stringify(initialDraft), [initialDraft]);\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [section, setSection] = useState<ProfileEditorSection>(\"general\");\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(initialDraft.columns ?? []);\n const [sampledColumns, setSampledColumns] = useState<ProfileColumn[]>([]);\n const [sampleRows, setSampleRows] = useState<Record<string, unknown>[]>([]);\n const [activeField, setActiveField] = useState(initialDraft.columns?.[0]?.name ?? \"\");\n const [lastSampleSignature, setLastSampleSignature] = useState(() => profileSampleSignature(initialDraft));\n const [rawValid, setRawValid] = useState(true);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const [replaceTarget, setReplaceTarget] = useState(\"\");\n const [confirmDiscard, setConfirmDiscard] = useState(false);\n const [confirmResetColumns, setConfirmResetColumns] = useState(false);\n const dirty = JSON.stringify(draft) !== initialSerialized;\n const validationError = validateProfileEditorDraft(draft);\n const sampleStale = profileSampleSignature(draft) !== lastSampleSignature;\n const resetState = profileColumnResetState({\n providerType: draft.provider?.type ?? \"\",\n sampledColumnCount: sampledColumns.length,\n sampleStale,\n });\n\n const fields = useProfileFieldState({\n discovered,\n configured: draft.columns ?? [],\n activeName: activeField,\n onConfiguredChange: (columns) => setDraft((current) => ({ ...current, columns })),\n onActiveNameChange: setActiveField,\n });\n\n // A route can be refreshed or navigated away from; the dialog used to guard\n // unsaved edits with confirmClose, so the route has to guard them too.\n useEffect(() => {\n if (!dirty) return;\n const warn = (event: BeforeUnloadEvent) => event.preventDefault();\n window.addEventListener(\"beforeunload\", warn);\n return () => window.removeEventListener(\"beforeunload\", warn);\n }, [dirty]);\n\n const save = async (replaceExisting = false) => {\n if (validationError) {\n setError(validationError);\n return;\n }\n if (!client.submitForm) {\n setError(\"Profile updates are unavailable\");\n return;\n }\n setSaving(true);\n setError(\"\");\n try {\n const body = {\n ...draft,\n id: surfaceKey,\n ...(replaceExisting ? { replaceExisting: true } : {}),\n };\n const response = await client.submitForm(\n resolveProfileUpdatePath(action.path, surfaceKey),\n action.method,\n body,\n );\n if (!response.success) {\n const message = response.error || response.message || \"Profile update failed\";\n const target = profileUpdateConflictTarget(message);\n if (target && !replaceExisting) {\n setReplaceTarget(target);\n return;\n }\n throw new Error(message);\n }\n await onSuccess(draft.profile!.trim());\n } catch (saveError) {\n setError(saveError instanceof Error ? saveError.message : \"Profile update failed\");\n } finally {\n setSaving(false);\n }\n };\n\n const acceptSample = ({ columns, rows, sourceDraft }: ProfileSample) => {\n setSampledColumns(structuredClone(columns));\n setDiscovered(columns);\n setSampleRows(rows);\n setDraft((current) => ({\n ...current,\n columns: mergeSampledProfileColumns(current.columns ?? [], columns),\n }));\n setActiveField((current) => current || columns[0]?.name || \"\");\n setLastSampleSignature(profileSampleSignature(sourceDraft));\n };\n\n const resetColumns = () => {\n const first = sampledColumns[0];\n if (!first) throw new Error(\"cannot reset columns without a sample\");\n setDraft((current) => resetProfileColumns(current, sampledColumns));\n setActiveField(first.name);\n setConfirmResetColumns(false);\n };\n\n const sectionContent = (\n <div className=\"h-full overflow-auto p-5\">\n {section === \"general\" ? <ProfileGeneralSection draft={draft} onChange={setDraft} /> : null}\n {section === \"source\" ? (\n <ProfileSourceSection\n draft={draft}\n discovered={discovered}\n sampleStale={sampleStale}\n onChange={setDraft}\n onSample={acceptSample}\n />\n ) : null}\n {section === \"parameters\" ? (\n <ProfileSchemaSection\n draft={draft}\n keys={[\"params\"]}\n title=\"Parameters\"\n // The zero-item explanation lives on the schema now (it is the add\n // row's own copy), so this stays a one-liner rather than repeating it.\n description=\"Named values the profile query and filters accept at run time.\"\n idPrefix=\"profile-parameters\"\n // The accordion needs the full pane for its auto-fill grid — the\n // default 600px stack would cap it at two columns — and its help\n // belongs on the label, not stacked under every control.\n layout={{ mode: \"stacked\", valueMaxWidth: \"none\", help: \"hover\" }}\n onChange={setDraft}\n />\n ) : null}\n {section === \"advanced\" ? (\n <ProfileSchemaSection\n draft={draft}\n keys={profileAdvancedKeys}\n title=\"Advanced composition\"\n description=\"Compose profiles, add ordered aliases, chain post-query processors, and control output without exposing the root schema as the page layout.\"\n idPrefix=\"profile-advanced\"\n // Imports and reconcile.dest name other profiles; the fetcher is what\n // turns them from free text into the hierarchical profile picker.\n {...(lookupFetcher ? { lookupFetcher } : {})}\n onChange={setDraft}\n />\n ) : null}\n {section === \"raw\" ? (\n <Suspense fallback={<p className=\"text-sm text-muted-foreground\">Loading YAML editor…</p>}>\n <ProfileEditorRaw draft={draft} onChange={setDraft} onValidityChange={setRawValid} />\n </Suspense>\n ) : null}\n </div>\n );\n\n const panes = useMemo<WorkspacePaneSpec[]>(() => {\n const rail: WorkspacePaneSpec = {\n id: \"sections\",\n label: \"Profile\",\n icon: <UiListTree />,\n location: \"left\",\n width: 240,\n minWidth: 180,\n maxWidth: 340,\n content: (\n <ProfileEditorRail\n value={section}\n status={profileEditorSectionStatus({\n draft,\n availableColumns: fields.available.length,\n sampleStale,\n })}\n onChange={setSection}\n />\n ),\n };\n\n if (section !== \"columns\") {\n return [rail, { id: \"section\", label: sectionLabel(section), location: \"center\", collapsible: false, contentClassName: \"p-0\", content: sectionContent }];\n }\n\n return [\n rail,\n {\n id: \"columns\",\n label: \"Columns\",\n icon: <UiColumns />,\n location: \"center\",\n collapsible: false,\n contentClassName: \"flex flex-col overflow-hidden\",\n slots: {\n headerTrailing: (\n <>\n <span className=\"text-[11px] text-muted-foreground\">\n {fields.configuredCount} of {fields.available.length} included\n </span>\n {resetState.visible ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={resetState.disabled}\n title={resetState.title}\n onClick={() => setConfirmResetColumns(true)}\n >\n Reset columns\n </Button>\n ) : null}\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={fields.addField}>\n Add column\n </Button>\n </>\n ),\n },\n content: (\n <>\n <div className=\"shrink-0 border-b border-border p-2\">\n <ProfileFieldFilters state={fields} compact />\n </div>\n <ProfileFieldGrid state={fields} />\n </>\n ),\n },\n {\n id: \"field\",\n label: fields.activeField?.name ?? \"Field\",\n icon: <UiSliders />,\n location: \"right\",\n width: 380,\n minWidth: 300,\n maxWidth: 560,\n contentClassName: \"flex flex-col overflow-hidden\",\n // The pane header already names the field, so this composes the editor's\n // parts rather than nesting its carded, self-titling variant.\n content: fields.activeField ? (\n <>\n <div className=\"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-2 py-1.5\">\n <ProfileFieldEditorActions\n selected={fields.selectedNames.has(fields.activeField.name)}\n onSelectedChange={(selected) => {\n if (fields.activeField) fields.setFieldSelection(fields.activeField, selected);\n }}\n canMoveUp={fields.canMoveUp}\n canMoveDown={fields.canMoveDown}\n onMoveUp={() => fields.moveActive(-1)}\n onMoveDown={() => fields.moveActive(1)}\n onRemove={fields.removeActive}\n />\n </div>\n <div className=\"min-h-0 flex-1 overflow-auto p-3\">\n <ProfileFieldEditorForm\n field={fields.activeField}\n columns={1}\n onChange={fields.updateActiveField}\n />\n </div>\n </>\n ) : (\n <p className=\"grid h-full place-items-center p-4 text-center text-sm text-muted-foreground\">\n {profileFieldEditorEmptyMessage}\n </p>\n ),\n },\n {\n id: \"preview\",\n label: \"Preview\",\n icon: <UiTable />,\n location: \"bottom\",\n height: 220,\n minHeight: 120,\n maxHeight: 520,\n slots: {\n headerTrailing: (\n <span className=\"text-[11px] text-muted-foreground\">\n {sampleRows.length\n ? `${sampleRows.length} sampled rows · updates as you edit`\n : \"No sample yet\"}\n </span>\n ),\n },\n content: <ProfileEditorPreview columns={draft.columns ?? []} rows={sampleRows} />,\n },\n ];\n }, [draft, fields, resetState, sampleRows, sampleStale, section, sectionContent]);\n\n const leave = () => (dirty ? setConfirmDiscard(true) : onClose());\n\n return (\n <JsonPathProfileProvider profile={draft}>\n <div className=\"grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] bg-background\">\n <header className=\"flex items-center gap-3 border-b border-border px-4 py-2.5\">\n <nav className=\"flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground\">\n <button type=\"button\" className=\"hover:text-foreground\" onClick={leave}>\n Profiles\n </button>\n <span>/</span>\n <button type=\"button\" className=\"min-w-0 truncate hover:text-foreground\" onClick={leave}>\n {initialDraft.profile ?? surfaceKey}\n </button>\n <span>/</span>\n <span className=\"font-medium text-foreground\">Edit</span>\n </nav>\n {error ? <span className=\"truncate text-sm text-destructive\">{error}</span> : null}\n <span className=\"ml-auto shrink-0 text-xs text-muted-foreground\">\n {dirty ? \"Unsaved changes\" : \"No changes\"}\n </span>\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" onClick={leave}>\n Discard\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={saving || Boolean(validationError) || (section === \"raw\" && !rawValid)}\n title={validationError ?? undefined}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n </header>\n\n <Workspace panes={panes} storageKey=\"profile-editor\" />\n </div>\n\n {confirmDiscard ? (\n <Modal\n open\n onClose={() => setConfirmDiscard(false)}\n title=\"Discard profile changes?\"\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={() => setConfirmDiscard(false)}>\n Keep editing\n </Button>\n <Button type=\"button\" variant=\"destructive\" onClick={onClose}>\n Discard changes\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Your unsaved profile changes will be lost.\n </p>\n </Modal>\n ) : null}\n\n {confirmResetColumns ? (\n <Modal\n open\n onClose={() => setConfirmResetColumns(false)}\n title=\"Reset columns from latest sample?\"\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={() => setConfirmResetColumns(false)}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n disabled={resetState.disabled}\n onClick={resetColumns}\n >\n Reset columns\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Replace {fields.configuredCount} configured column{fields.configuredCount === 1 ? \"\" : \"s\"} with {sampledColumns.length} column{sampledColumns.length === 1 ? \"\" : \"s\"} from the latest sample. Custom labels, expressions, formatting, filtering, ordering, and manually added columns will be removed. The profile will remain unsaved until you save it.\n </p>\n </Modal>\n ) : null}\n\n {replaceTarget ? (\n <Modal\n open\n onClose={() => setReplaceTarget(\"\")}\n title={`Replace ${replaceTarget}?`}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={() => setReplaceTarget(\"\")}>Cancel</Button>\n <Button type=\"button\" variant=\"destructive\" disabled={saving} onClick={() => {\n setReplaceTarget(\"\");\n void save(true);\n }}>\n Replace profile\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n A profile named {replaceTarget} already exists. Its definition will be\n overwritten, the current profile will be renamed, and dependent imports\n will be updated atomically.\n </p>\n </Modal>\n ) : null}\n </JsonPathProfileProvider>\n );\n}\n\nfunction sectionLabel(section: ProfileEditor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AAQ,SAAS,MAAM,iBAAiB,EAAE,GAAG,UAAA,SAAA,CAAM;AAAA,UACjF,oBAAC,UAAO,MAAK,UAAS,SAAQ,eAAc,UAAU,QAAQ,SAAS,MAAM;AAC3E,6BAAiB,EAAE;AACnB,iBAAK,KAAK,IAAI;AAAA,UAChB,GAAG,UAAA,kBAAA,CAEH;AAAA,QAAA,GACF;AAAA,QAGF,UAAA,qBAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA;AAAA,UAAA;AAAA,UAC1B;AAAA,UAAc;AAAA,QAAA,EAAA,CAGjC;AAAA,MAAA;AAAA,IAAA,IAEA;AAAA,EAAA,GACN;AAEJ;AAEA,SAAS,aAAa,SAAuC;AAC3D,SAAO,sBAAsB,KAAK,CAAC,UAAU,MAAM,OAAO,OAAO,EAAG;AACtE;"}
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const string = require("../lib/string.cjs");
4
+ const profileApi = require("./profileApi.cjs");
5
+ const profileParamModel = require("./profileParamModel.cjs");
6
+ function profileEditorSchema() {
7
+ return profileApi.profileSchema();
8
+ }
9
+ const profileEditorSections = [
10
+ { id: "general", label: "General", hint: "Name, namespace, render mode" },
11
+ { id: "source", label: "Source & Query", hint: "Provider, connection, sample" },
12
+ { id: "columns", label: "Columns", hint: "Fields, labels, expressions" },
13
+ { id: "parameters", label: "Parameters", hint: "Named query inputs" },
14
+ { id: "advanced", label: "Advanced", hint: "Imports, aliases, processors, output" },
15
+ { id: "raw", label: "Raw YAML", hint: "Edit the document directly" }
16
+ ];
17
+ const profileAdvancedKeys = ["imports", "aliases", "ignore", "processors", "output"];
18
+ function profileEditorSectionStatus({
19
+ draft,
20
+ availableColumns,
21
+ sampleStale
22
+ }) {
23
+ var _a, _b, _c, _d, _e;
24
+ const configured = ((_a = draft.columns) == null ? void 0 : _a.length) ?? 0;
25
+ const params = Array.isArray(draft.params) ? draft.params.length : 0;
26
+ const advanced = profileAdvancedKeys.filter(
27
+ (key) => Object.prototype.hasOwnProperty.call(draft, key)
28
+ ).length;
29
+ return {
30
+ general: { attention: !((_b = draft.profile) == null ? void 0 : _b.trim()) },
31
+ source: {
32
+ badge: ((_c = draft.provider) == null ? void 0 : _c.type) || void 0,
33
+ attention: sampleStale || !((_e = (_d = draft.provider) == null ? void 0 : _d.type) == null ? void 0 : _e.trim())
34
+ },
35
+ columns: {
36
+ badge: `${configured}/${Math.max(availableColumns, configured)}`,
37
+ attention: configured === 0
38
+ },
39
+ parameters: { badge: params ? String(params) : void 0 },
40
+ advanced: { badge: advanced ? String(advanced) : void 0 },
41
+ raw: {}
42
+ };
43
+ }
44
+ function cloneProfileDraft(value) {
45
+ return structuredClone(value);
46
+ }
47
+ function profileSchemaProjection(keys) {
48
+ const properties = Object.fromEntries(
49
+ keys.flatMap((key) => {
50
+ var _a;
51
+ const property = (_a = profileApi.profileSchema().properties) == null ? void 0 : _a[key];
52
+ return property ? [[key, property]] : [];
53
+ })
54
+ );
55
+ return {
56
+ type: "object",
57
+ properties,
58
+ required: (profileApi.profileSchema().required ?? []).filter((key) => keys.includes(key))
59
+ };
60
+ }
61
+ function providerOptionsSchema(providerType) {
62
+ var _a, _b;
63
+ const definition = (_a = profileApi.profileSchema().$defs) == null ? void 0 : _a[providerType];
64
+ const options = (_b = definition == null ? void 0 : definition.properties) == null ? void 0 : _b.options;
65
+ if (!options || options.type !== "object") {
66
+ return { type: "object", properties: {}, additionalProperties: true };
67
+ }
68
+ return options;
69
+ }
70
+ function providerTypes() {
71
+ var _a, _b, _c, _d;
72
+ const values = (_d = (_c = (_b = (_a = profileApi.profileSchema().properties) == null ? void 0 : _a.provider) == null ? void 0 : _b.properties) == null ? void 0 : _c.type) == null ? void 0 : _d.enum;
73
+ return Array.isArray(values) ? values.filter((value) => typeof value === "string") : [];
74
+ }
75
+ function mergeProfileProjection(draft, keys, next) {
76
+ const merged = { ...draft };
77
+ for (const key of keys) delete merged[key];
78
+ for (const key of keys) {
79
+ if (Object.prototype.hasOwnProperty.call(next, key)) merged[key] = next[key];
80
+ }
81
+ return merged;
82
+ }
83
+ function mergeSampledProfileColumns(configured, sampled) {
84
+ const configuredNames = new Set(configured.map((column) => column.name));
85
+ return [
86
+ ...configured.map((column) => ({ ...column })),
87
+ ...sampled.filter((column) => !configuredNames.has(column.name)).map((column) => ({ ...column }))
88
+ ];
89
+ }
90
+ function resetProfileColumns(draft, sampled) {
91
+ if (sampled.length === 0) {
92
+ throw new Error("Cannot reset profile columns without sampled columns");
93
+ }
94
+ return { ...draft, columns: structuredClone(sampled) };
95
+ }
96
+ function profileColumnResetState({
97
+ providerType,
98
+ sampledColumnCount,
99
+ sampleStale
100
+ }) {
101
+ if (providerType !== "opensearch") {
102
+ return { visible: false, disabled: true, title: "" };
103
+ }
104
+ if (sampledColumnCount === 0) {
105
+ return {
106
+ visible: true,
107
+ disabled: true,
108
+ title: "Run a sample before resetting columns"
109
+ };
110
+ }
111
+ if (sampleStale) {
112
+ return {
113
+ visible: true,
114
+ disabled: true,
115
+ title: "Run another sample for the current source and query"
116
+ };
117
+ }
118
+ return {
119
+ visible: true,
120
+ disabled: false,
121
+ title: "Replace configured columns with the latest sample"
122
+ };
123
+ }
124
+ function profileSampleSignature(draft) {
125
+ return JSON.stringify({
126
+ provider: draft.provider ?? {},
127
+ query: draft.query ?? ""
128
+ });
129
+ }
130
+ function validateProfileEditorDraft(draft) {
131
+ var _a, _b, _c, _d;
132
+ if (!((_a = draft.profile) == null ? void 0 : _a.trim())) return "Profile name is required";
133
+ if (!((_c = (_b = draft.provider) == null ? void 0 : _b.type) == null ? void 0 : _c.trim())) return "Provider type is required";
134
+ const names = /* @__PURE__ */ new Set();
135
+ for (const column of draft.columns ?? []) {
136
+ const name = column.name.trim();
137
+ if (!name) return "Every column needs a name";
138
+ if (names.has(name)) return `Column name "${name}" is duplicated`;
139
+ names.add(name);
140
+ }
141
+ return profileParamModel.validateProfileParams(draft.params, (_d = draft.provider) == null ? void 0 : _d.type);
142
+ }
143
+ function profileUpdateConflictTarget(error) {
144
+ var _a;
145
+ if (!error.includes("PROFILE_NAME_CONFLICT")) return null;
146
+ return ((_a = error.match(/existing profile "([^"]+)"/)) == null ? void 0 : _a[1]) ?? null;
147
+ }
148
+ function profileRoute(name) {
149
+ const slug = string.stripSurroundingDashes(
150
+ Array.from(name.trim().toLowerCase()).map(
151
+ (character) => /[a-z0-9]/.test(character) ? character : /[ ._/-]/.test(character) ? "-" : ""
152
+ ).join("")
153
+ );
154
+ return `/profile-${slug}`;
155
+ }
156
+ function profileEditRoute(surfaceKey) {
157
+ return `/${surfaceKey}/edit`;
158
+ }
159
+ function profileEditSurfaceKey(pathname) {
160
+ var _a;
161
+ return ((_a = pathname.match(/^\/(profile-[^/]+)\/edit\/?$/)) == null ? void 0 : _a[1]) ?? null;
162
+ }
163
+ exports.cloneProfileDraft = cloneProfileDraft;
164
+ exports.mergeProfileProjection = mergeProfileProjection;
165
+ exports.mergeSampledProfileColumns = mergeSampledProfileColumns;
166
+ exports.profileAdvancedKeys = profileAdvancedKeys;
167
+ exports.profileColumnResetState = profileColumnResetState;
168
+ exports.profileEditRoute = profileEditRoute;
169
+ exports.profileEditSurfaceKey = profileEditSurfaceKey;
170
+ exports.profileEditorSchema = profileEditorSchema;
171
+ exports.profileEditorSectionStatus = profileEditorSectionStatus;
172
+ exports.profileEditorSections = profileEditorSections;
173
+ exports.profileRoute = profileRoute;
174
+ exports.profileSampleSignature = profileSampleSignature;
175
+ exports.profileSchemaProjection = profileSchemaProjection;
176
+ exports.profileUpdateConflictTarget = profileUpdateConflictTarget;
177
+ exports.providerOptionsSchema = providerOptionsSchema;
178
+ exports.providerTypes = providerTypes;
179
+ exports.resetProfileColumns = resetProfileColumns;
180
+ exports.validateProfileEditorDraft = validateProfileEditorDraft;
181
+ //# sourceMappingURL=profileEditorModel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profileEditorModel.cjs","sources":["../../src/profiles/profileEditorModel.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../components/json-schema-form-types\";\nimport { stripSurroundingDashes } from \"../lib/string\";\nimport { profileSchema } from \"./profileApi\";\nimport { validateProfileParams } from \"./profileParamModel\";\nimport type { ProfileColumn, ProfileWizardDraft } from \"./profileWizardModel\";\n\n/**\n * The schema the raw-YAML editor validates against. It is read through the\n * configured accessor rather than bundled: the document is generated from\n * commons-db's Go types and served by the host, so a copy here would drift.\n */\nexport function profileEditorSchema(): JsonSchemaObject {\n return profileSchema();\n}\n\nexport const profileEditorSections = [\n { id: \"general\", label: \"General\", hint: \"Name, namespace, render mode\" },\n { id: \"source\", label: \"Source & Query\", hint: \"Provider, connection, sample\" },\n { id: \"columns\", label: \"Columns\", hint: \"Fields, labels, expressions\" },\n { id: \"parameters\", label: \"Parameters\", hint: \"Named query inputs\" },\n { id: \"advanced\", label: \"Advanced\", hint: \"Imports, aliases, processors, output\" },\n { id: \"raw\", label: \"Raw YAML\", hint: \"Edit the document directly\" },\n] as const;\n\nexport type ProfileEditorSection = (typeof profileEditorSections)[number][\"id\"];\n\nexport const profileAdvancedKeys = [\"imports\", \"aliases\", \"ignore\", \"processors\", \"output\"];\n\nexport type ProfileSectionStatus = {\n badge?: string | undefined;\n attention?: boolean | undefined;\n};\n\n/**\n * Rail annotations per section. The route replaced tabs with a vertical rail,\n * which has room to say how much each section holds — so a stale sample or an\n * empty column set is visible without opening the section.\n */\nexport function profileEditorSectionStatus({\n draft,\n availableColumns,\n sampleStale,\n}: {\n draft: ProfileWizardDraft;\n availableColumns: number;\n sampleStale: boolean;\n}): Record<ProfileEditorSection, ProfileSectionStatus> {\n const configured = draft.columns?.length ?? 0;\n const params = Array.isArray(draft.params) ? draft.params.length : 0;\n const advanced = profileAdvancedKeys.filter((key) =>\n Object.prototype.hasOwnProperty.call(draft, key),\n ).length;\n return {\n general: { attention: !draft.profile?.trim() },\n source: {\n badge: draft.provider?.type || undefined,\n attention: sampleStale || !draft.provider?.type?.trim(),\n },\n columns: {\n badge: `${configured}/${Math.max(availableColumns, configured)}`,\n attention: configured === 0,\n },\n parameters: { badge: params ? String(params) : undefined },\n advanced: { badge: advanced ? String(advanced) : undefined },\n raw: {},\n };\n}\n\nexport function cloneProfileDraft(\n value: Record<string, unknown>,\n): ProfileWizardDraft {\n return structuredClone(value) as ProfileWizardDraft;\n}\n\nexport function profileSchemaProjection(keys: string[]): JsonSchemaObject {\n const properties = Object.fromEntries(\n keys.flatMap((key) => {\n const property = profileSchema().properties?.[key];\n return property ? [[key, property]] : [];\n }),\n );\n return {\n type: \"object\",\n properties,\n required: (profileSchema().required ?? []).filter((key) => keys.includes(key)),\n };\n}\n\nexport function providerOptionsSchema(providerType: string): JsonSchemaObject {\n const definition = profileSchema().$defs?.[providerType];\n const options = definition?.properties?.options;\n if (!options || options.type !== \"object\") {\n return { type: \"object\", properties: {}, additionalProperties: true };\n }\n return options as JsonSchemaObject;\n}\n\nexport function providerTypes(): string[] {\n const values = profileSchema().properties?.provider?.properties?.type?.enum;\n return Array.isArray(values)\n ? values.filter((value): value is string => typeof value === \"string\")\n : [];\n}\n\nexport function mergeProfileProjection(\n draft: ProfileWizardDraft,\n keys: string[],\n next: Record<string, unknown>,\n): ProfileWizardDraft {\n const merged = { ...draft };\n for (const key of keys) delete merged[key];\n for (const key of keys) {\n if (Object.prototype.hasOwnProperty.call(next, key)) merged[key] = next[key];\n }\n return merged;\n}\n\nexport function mergeSampledProfileColumns(\n configured: ProfileColumn[],\n sampled: ProfileColumn[],\n): ProfileColumn[] {\n const configuredNames = new Set(configured.map((column) => column.name));\n return [\n ...configured.map((column) => ({ ...column })),\n ...sampled\n .filter((column) => !configuredNames.has(column.name))\n .map((column) => ({ ...column })),\n ];\n}\n\nexport function resetProfileColumns(\n draft: ProfileWizardDraft,\n sampled: ProfileColumn[],\n): ProfileWizardDraft {\n if (sampled.length === 0) {\n throw new Error(\"Cannot reset profile columns without sampled columns\");\n }\n return { ...draft, columns: structuredClone(sampled) };\n}\n\nexport function profileColumnResetState({\n providerType,\n sampledColumnCount,\n sampleStale,\n}: {\n providerType: string;\n sampledColumnCount: number;\n sampleStale: boolean;\n}) {\n if (providerType !== \"opensearch\") {\n return { visible: false, disabled: true, title: \"\" };\n }\n if (sampledColumnCount === 0) {\n return {\n visible: true,\n disabled: true,\n title: \"Run a sample before resetting columns\",\n };\n }\n if (sampleStale) {\n return {\n visible: true,\n disabled: true,\n title: \"Run another sample for the current source and query\",\n };\n }\n return {\n visible: true,\n disabled: false,\n title: \"Replace configured columns with the latest sample\",\n };\n}\n\nexport function profileSampleSignature(draft: ProfileWizardDraft): string {\n return JSON.stringify({\n provider: draft.provider ?? {},\n query: draft.query ?? \"\",\n });\n}\n\nexport function validateProfileEditorDraft(\n draft: ProfileWizardDraft,\n): string | null {\n if (!draft.profile?.trim()) return \"Profile name is required\";\n if (!draft.provider?.type?.trim()) return \"Provider type is required\";\n const names = new Set<string>();\n for (const column of draft.columns ?? []) {\n const name = column.name.trim();\n if (!name) return \"Every column needs a name\";\n if (names.has(name)) return `Column name \"${name}\" is duplicated`;\n names.add(name);\n }\n return validateProfileParams(draft.params, draft.provider?.type);\n}\n\nexport function profileUpdateConflictTarget(error: string): string | null {\n if (!error.includes(\"PROFILE_NAME_CONFLICT\")) return null;\n return error.match(/existing profile \"([^\"]+)\"/)?.[1] ?? null;\n}\n\nexport function profileRoute(name: string): string {\n const slug = stripSurroundingDashes(\n Array.from(name.trim().toLowerCase())\n .map((character) =>\n /[a-z0-9]/.test(character)\n ? character\n : /[ ._/-]/.test(character)\n ? \"-\"\n : \"\",\n )\n .join(\"\"),\n );\n return `/profile-${slug}`;\n}\n\n/** Deep-linkable editor route for a profile surface (`profile-os2`). */\nexport function profileEditRoute(surfaceKey: string): string {\n return `/${surfaceKey}/edit`;\n}\n\n/** Surface key an edit route addresses, or null when the path is not one. */\nexport function profileEditSurfaceKey(pathname: string): string | null {\n return pathname.match(/^\\/(profile-[^/]+)\\/edit\\/?$/)?.[1] ?? null;\n}\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