@morscherlab/mint-sdk 1.1.25 → 1.2.0-beta.10

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 (403) hide show
  1. package/README.md +44 -12
  2. package/dist/{ExperimentPopover-tLwJ7XF4.js → ExperimentPopover-oL0fg_A0.js} +6 -4
  3. package/dist/ExperimentPopover-oL0fg_A0.js.map +1 -0
  4. package/dist/{ExperimentSelectorModal-B6P2msT4.js → ExperimentSelectorModal-BeEOomw_.js} +5 -5
  5. package/dist/ExperimentSelectorModal-BeEOomw_.js.map +1 -0
  6. package/dist/{SettingsModal-BW3Ar-uy.js → SettingsModal-Dphh3RrI.js} +5 -8
  7. package/dist/SettingsModal-Dphh3RrI.js.map +1 -0
  8. package/dist/{EmptyState-p90quq8Z.js → Skeleton-DxtwJ5gt.js} +111 -93
  9. package/dist/Skeleton-DxtwJ5gt.js.map +1 -0
  10. package/dist/__tests__/components/ExperimentTimeline.test.d.ts +1 -0
  11. package/dist/__tests__/components/PluginWorkspaceView.internal.test.d.ts +1 -0
  12. package/dist/__tests__/components/SecretInput.test.d.ts +1 -0
  13. package/dist/__tests__/components/WellEditPopupInternal.test.d.ts +1 -0
  14. package/dist/__tests__/composables/useEventStream.test.d.ts +1 -0
  15. package/dist/__tests__/composables/useListReorder.test.d.ts +1 -0
  16. package/dist/__tests__/styles/cssTokens.test.d.ts +1 -0
  17. package/dist/components/ActionMenu.vue.d.ts +1 -1
  18. package/dist/components/AppAvatarMenu.vue.d.ts +4 -0
  19. package/dist/components/AppPluginSwitcher.vue.d.ts +2 -0
  20. package/dist/components/AppSidebar.vue.d.ts +1 -1
  21. package/dist/components/AuditTrail.vue.d.ts +13 -0
  22. package/dist/components/BatchProgressList.vue.d.ts +17 -0
  23. package/dist/components/BioTemplateExperimentWorkspaceView.vue.d.ts +1 -1
  24. package/dist/components/DataFrame.vue.d.ts +14 -2
  25. package/dist/components/DatePicker.vue.d.ts +1 -1
  26. package/dist/components/DateTimePicker.vue.d.ts +2 -0
  27. package/dist/components/DropdownButton.vue.d.ts +2 -0
  28. package/dist/components/ExperimentDataViewer.vue.d.ts +26 -1
  29. package/dist/components/ExperimentPopover.vue.d.ts +1 -0
  30. package/dist/components/ExperimentTimeline.vue.d.ts +29 -1
  31. package/dist/components/FitPanel.vue.d.ts +1 -1
  32. package/dist/components/LcmsSequenceTable.vue.d.ts +29 -1
  33. package/dist/components/PluginWorkspaceView.props.d.ts +29 -1
  34. package/dist/components/PluginWorkspaceView.vue.d.ts +5 -5
  35. package/dist/components/ProgressBar.vue.d.ts +1 -1
  36. package/dist/components/ProtocolStepEditor.vue.d.ts +1 -0
  37. package/dist/components/ReagentList.vue.d.ts +29 -1
  38. package/dist/components/SampleHierarchyTree.vue.d.ts +29 -1
  39. package/dist/components/SampleSelector.drag.d.ts +13 -0
  40. package/dist/components/SampleSelector.tree.d.ts +2 -0
  41. package/dist/components/SampleSelector.vue.d.ts +34 -1
  42. package/dist/components/ScheduleCalendar.vue.d.ts +20 -0
  43. package/dist/components/SecretInput.vue.d.ts +28 -0
  44. package/dist/components/SmartGroupFieldRecipe.vue.d.ts +2 -1
  45. package/dist/components/TimePicker.vue.d.ts +1 -0
  46. package/dist/components/WellPlate.geometry.d.ts +15 -0
  47. package/dist/components/WellPlate.interaction.d.ts +13 -0
  48. package/dist/components/WellPlate.vue.d.ts +29 -0
  49. package/dist/components/index.d.ts +9 -0
  50. package/dist/components/index.js +8 -8
  51. package/dist/components/internal/AppTopBarPageSelectorInternal.vue.d.ts +2 -0
  52. package/dist/components/internal/DataStateInternal.vue.d.ts +43 -0
  53. package/dist/components/internal/WellEditPopupInternal.vue.d.ts +3 -1
  54. package/dist/components/internal/WorkspaceControlsInternal.vue.d.ts +23 -0
  55. package/dist/components/internal/WorkspaceShellInternal.vue.d.ts +70 -0
  56. package/dist/components/internal/WorkspaceSidebarInternal.vue.d.ts +43 -0
  57. package/dist/{components-DQt0tcpY.js → components-CgAUzF8F.js} +2491 -2235
  58. package/dist/components-CgAUzF8F.js.map +1 -0
  59. package/dist/composables/controlSchemaTypes.d.ts +34 -0
  60. package/dist/composables/flattenWorkspaceBindings.d.ts +61 -0
  61. package/dist/composables/index.d.ts +8 -2
  62. package/dist/composables/index.js +10 -10
  63. package/dist/composables/pluginWorkspaceModel.d.ts +164 -0
  64. package/dist/composables/useAsync.d.ts +5 -1
  65. package/dist/composables/useBioTemplateWorkspace.d.ts +4 -20
  66. package/dist/composables/useCommandHistory.d.ts +5 -1
  67. package/dist/composables/useDropdownState.d.ts +18 -2
  68. package/dist/composables/useEventStream.d.ts +52 -0
  69. package/dist/composables/useFocusTrap.d.ts +21 -0
  70. package/dist/composables/useJobsStatusTray.d.ts +1 -1
  71. package/dist/composables/useListReorder.d.ts +90 -0
  72. package/dist/composables/useMenuKeyboard.d.ts +29 -0
  73. package/dist/composables/useOptimisticMutation.d.ts +5 -1
  74. package/dist/composables/usePluginClient.d.ts +4 -17
  75. package/dist/composables/usePluginConfig.d.ts +3 -1
  76. package/dist/composables/usePluginWorkspace.d.ts +51 -0
  77. package/dist/composables/useRequestSyncState.d.ts +42 -2
  78. package/dist/composables/useResourceCrud.d.ts +5 -1
  79. package/dist/composables/useRovingFocus.d.ts +24 -0
  80. package/dist/composables/useScheduleDrag.d.ts +1 -0
  81. package/dist/composables/useWellPainting.d.ts +5 -1
  82. package/dist/composables/useWellPlateAdapter.d.ts +5 -1
  83. package/dist/composables/useWellPlateValidation.d.ts +5 -1
  84. package/dist/composables/workspaceRecipes.d.ts +188 -0
  85. package/dist/{composables-CkXDe7nm.js → composables-B_pia3hO.js} +105 -254
  86. package/dist/composables-B_pia3hO.js.map +1 -0
  87. package/dist/{useApi-CDBq6z23.js → errors-_W0-LbA6.js} +102 -3
  88. package/dist/errors-_W0-LbA6.js.map +1 -0
  89. package/dist/{experiment-Y9Iz7KYi.js → experiment-Cwl9AYxw.js} +3 -8
  90. package/dist/experiment-Cwl9AYxw.js.map +1 -0
  91. package/dist/{experiment-utils-CLnzPPq5.js → experiment-utils-DV3DrvE_.js} +70 -51
  92. package/dist/experiment-utils-DV3DrvE_.js.map +1 -0
  93. package/dist/index.d.ts +1 -0
  94. package/dist/index.js +15 -15
  95. package/dist/install.js +2 -7
  96. package/dist/install.js.map +1 -1
  97. package/dist/permissions.d.ts +42 -1
  98. package/dist/permissions.js +20 -10
  99. package/dist/permissions.js.map +1 -1
  100. package/dist/stores/index.d.ts +1 -1
  101. package/dist/stores/index.js +3 -3
  102. package/dist/stores/settings.d.ts +31 -1
  103. package/dist/styles.css +11247 -29501
  104. package/dist/templates/builderReadUtils.d.ts +1 -1
  105. package/dist/templates/index.js +2 -4
  106. package/dist/{templates-CovvRZ-9.js → templates-Qq113pyZ.js} +303 -106
  107. package/dist/templates-Qq113pyZ.js.map +1 -0
  108. package/dist/types/form-builder.d.ts +1 -1
  109. package/dist/{useControlSchema-BhoJzWzx.js → useControlSchema-aMZlb4Sc.js} +684 -1216
  110. package/dist/useControlSchema-aMZlb4Sc.js.map +1 -0
  111. package/dist/{useDropdownState-DSb3BC3N.js → useDropdownState-DitCtrTT.js} +22 -6
  112. package/dist/useDropdownState-DitCtrTT.js.map +1 -0
  113. package/dist/{useExperimentSelector-D0pjj9WH.js → useExperimentSelector-I8HC8hUu.js} +4 -4
  114. package/dist/{useExperimentSelector-D0pjj9WH.js.map → useExperimentSelector-I8HC8hUu.js.map} +1 -1
  115. package/dist/{useFormBuilder-DiEcDis2.js → useFormBuilder-TCxNnqeb.js} +2 -2
  116. package/dist/{useFormBuilder-DiEcDis2.js.map → useFormBuilder-TCxNnqeb.js.map} +1 -1
  117. package/dist/{useProtocolTemplates-DHwSveE6.js → useProtocolTemplates-BmX_iVBR.js} +660 -197
  118. package/dist/useProtocolTemplates-BmX_iVBR.js.map +1 -0
  119. package/dist/utils/color.d.ts +13 -0
  120. package/dist/utils/errors.d.ts +9 -0
  121. package/dist/utils/pluginSecrets.d.ts +53 -0
  122. package/dist/utils/records.d.ts +4 -0
  123. package/package.json +1 -1
  124. package/src/__tests__/components/ActionMenu.test.ts +94 -0
  125. package/src/__tests__/components/AppAvatarMenu.test.ts +123 -0
  126. package/src/__tests__/components/BaseTabs.test.ts +67 -0
  127. package/src/__tests__/components/DataFrame.test.ts +183 -11
  128. package/src/__tests__/components/DataStates.test.ts +176 -0
  129. package/src/__tests__/components/DatePicker.test.ts +76 -0
  130. package/src/__tests__/components/DateTimePicker.test.ts +36 -0
  131. package/src/__tests__/components/DropdownButton.test.ts +134 -0
  132. package/src/__tests__/components/ExperimentTimeline.test.ts +63 -0
  133. package/src/__tests__/components/GeneratedPluginView.test.ts +0 -5
  134. package/src/__tests__/components/GroupAssigner.test.ts +53 -0
  135. package/src/__tests__/components/JobsStatusTray.test.ts +20 -18
  136. package/src/__tests__/components/LcmsSequenceTable.test.ts +22 -0
  137. package/src/__tests__/components/PluginWorkspaceView.internal.test.ts +230 -0
  138. package/src/__tests__/components/RackEditor.test.ts +35 -0
  139. package/src/__tests__/components/ReagentList.test.ts +64 -2
  140. package/src/__tests__/components/RetiredStyles.test.ts +31 -0
  141. package/src/__tests__/components/SampleSelector.drag.test.ts +51 -1
  142. package/src/__tests__/components/ScheduleCalendar.test.ts +63 -0
  143. package/src/__tests__/components/SecretInput.test.ts +87 -0
  144. package/src/__tests__/components/SegmentedControl.test.ts +88 -0
  145. package/src/__tests__/components/TimePicker.test.ts +61 -0
  146. package/src/__tests__/components/WellEditPopupInternal.test.ts +108 -0
  147. package/src/__tests__/components/WellPlate.interaction.test.ts +59 -0
  148. package/src/__tests__/composables/useAuth.test.ts +25 -0
  149. package/src/__tests__/composables/useDropdownState.test.ts +58 -1
  150. package/src/__tests__/composables/useEventStream.test.ts +140 -0
  151. package/src/__tests__/composables/useGeneratedAnalysis.test.ts +103 -0
  152. package/src/__tests__/composables/useJobsStatusTray.test.ts +25 -161
  153. package/src/__tests__/composables/useListReorder.test.ts +145 -0
  154. package/src/__tests__/composables/usePluginClient.test.ts +148 -13
  155. package/src/__tests__/composables/useRequestSyncState.test.ts +140 -0
  156. package/src/__tests__/docs/frontendDocsCatalog.test.ts +55 -2
  157. package/src/__tests__/stores/settings.test.ts +71 -1
  158. package/src/__tests__/styles/cssTokens.test.ts +131 -0
  159. package/src/__tests__/utils/permissions.test.ts +68 -0
  160. package/src/components/ActionMenu.vue +45 -88
  161. package/src/components/AlertBox.vue +0 -4
  162. package/src/components/AppAvatarMenu.vue +26 -7
  163. package/src/components/AppLayout.vue +0 -4
  164. package/src/components/AppPluginSwitcher.story.vue +87 -0
  165. package/src/components/AppPluginSwitcher.vue +2 -5
  166. package/src/components/AppSidebar.vue +0 -4
  167. package/src/components/AppToastContainer.vue +6 -8
  168. package/src/components/AppTopBar.vue +0 -4
  169. package/src/components/ArtifactSaveDialog.vue +0 -4
  170. package/src/components/ArtifactSelectorModal.vue +0 -4
  171. package/src/components/AuditTrail.story.vue +18 -0
  172. package/src/components/AuditTrail.vue +27 -7
  173. package/src/components/AutoGroupModal.vue +0 -4
  174. package/src/components/Avatar.vue +0 -4
  175. package/src/components/BaseButton.vue +0 -4
  176. package/src/components/BaseCheckbox.vue +0 -4
  177. package/src/components/BaseInput.vue +0 -4
  178. package/src/components/BaseModal.vue +8 -60
  179. package/src/components/BasePill.vue +0 -4
  180. package/src/components/BaseRadioGroup.vue +0 -4
  181. package/src/components/BaseSelect.vue +0 -4
  182. package/src/components/BaseSlider.vue +0 -4
  183. package/src/components/BaseTabs.vue +26 -5
  184. package/src/components/BaseTextarea.vue +0 -4
  185. package/src/components/BaseToggle.vue +0 -4
  186. package/src/components/BatchProgressList.story.vue +18 -0
  187. package/src/components/BatchProgressList.vue +32 -4
  188. package/src/components/BioTemplateExperimentWorkspaceView.vue +10 -21
  189. package/src/components/BioTemplatePackWorkspaceView.vue +11 -15
  190. package/src/components/BioTemplatePresetWorkspaceView.vue +8 -13
  191. package/src/components/Breadcrumb.vue +0 -4
  192. package/src/components/Calendar.vue +0 -4
  193. package/src/components/ChartContainer.story.vue +1 -1
  194. package/src/components/ChartContainer.vue +0 -4
  195. package/src/components/ChemicalFormula.vue +0 -4
  196. package/src/components/CollapsibleCard.vue +0 -4
  197. package/src/components/ColorSlider.vue +0 -4
  198. package/src/components/ComponentBindingRenderer.vue +1 -3
  199. package/src/components/ConcentrationInput.vue +0 -4
  200. package/src/components/ConfirmDialog.vue +0 -4
  201. package/src/components/ControlWorkspaceView.vue +11 -22
  202. package/src/components/DataFrame.story.vue +14 -0
  203. package/src/components/DataFrame.vue +97 -23
  204. package/src/components/DatePicker.vue +73 -27
  205. package/src/components/DateTimePicker.vue +45 -17
  206. package/src/components/Divider.vue +0 -4
  207. package/src/components/DoseCalculator.vue +0 -4
  208. package/src/components/DoseDesignWorkspaceView.vue +6 -25
  209. package/src/components/DropdownButton.vue +24 -6
  210. package/src/components/EmptyState.vue +0 -4
  211. package/src/components/ExperimentCodeBadge.vue +0 -4
  212. package/src/components/ExperimentDataViewer.story.vue +3 -0
  213. package/src/components/ExperimentDataViewer.vue +33 -13
  214. package/src/components/ExperimentPopover.vue +2 -5
  215. package/src/components/ExperimentSelectorModal.vue +0 -4
  216. package/src/components/ExperimentTimeline.story.vue +18 -0
  217. package/src/components/ExperimentTimeline.vue +81 -75
  218. package/src/components/FileUploader.vue +0 -4
  219. package/src/components/FitPanel.vue +0 -4
  220. package/src/components/FormActions.story.vue +96 -0
  221. package/src/components/FormActions.vue +0 -4
  222. package/src/components/FormBuilder.vue +0 -4
  223. package/src/components/FormField.vue +0 -4
  224. package/src/components/FormulaInput.vue +0 -4
  225. package/src/components/GeneratedPathInput.story.vue +68 -0
  226. package/src/components/GeneratedPlotlyResult.story.vue +96 -0
  227. package/src/components/GeneratedPlotlyResult.vue +3 -3
  228. package/src/components/GeneratedPluginView.story.vue +145 -0
  229. package/src/components/GeneratedPluginView.vue +10 -10
  230. package/src/components/GeneratedResultRenderer.story.vue +117 -0
  231. package/src/components/GeneratedResultRenderer.vue +4 -4
  232. package/src/components/GroupAssigner.vue +67 -5
  233. package/src/components/IconButton.vue +0 -4
  234. package/src/components/InstrumentAlertLog.vue +0 -4
  235. package/src/components/InstrumentStateBadge.vue +0 -4
  236. package/src/components/InstrumentStatusCard.vue +0 -4
  237. package/src/components/JobsStatusTray.story.vue +6 -10
  238. package/src/components/JobsStatusTray.vue +0 -4
  239. package/src/components/LcmsSequenceTable.vue +81 -50
  240. package/src/components/LoadingSpinner.vue +0 -4
  241. package/src/components/MobileSupportGate.vue +0 -4
  242. package/src/components/MoleculeInput.vue +0 -4
  243. package/src/components/MultiSelect.vue +0 -4
  244. package/src/components/NumberInput.vue +0 -4
  245. package/src/components/PlateMapEditor.vue +3 -14
  246. package/src/components/PluginIcon.vue +0 -4
  247. package/src/components/PluginWorkspaceView.props.ts +38 -0
  248. package/src/components/PluginWorkspaceView.vue +53 -224
  249. package/src/components/ProgressBar.vue +0 -4
  250. package/src/components/ProtocolStepEditor.vue +2 -4
  251. package/src/components/RackEditor.vue +51 -70
  252. package/src/components/ReagentEditor.vue +0 -4
  253. package/src/components/ReagentList.story.vue +18 -0
  254. package/src/components/ReagentList.vue +127 -82
  255. package/src/components/ResourceCard.vue +0 -4
  256. package/src/components/RuntimeUpdateNotice.story.vue +49 -0
  257. package/src/components/RuntimeUpdateNotice.vue +4 -4
  258. package/src/components/SampleHierarchyTree.story.vue +18 -0
  259. package/src/components/SampleHierarchyTree.vue +32 -9
  260. package/src/components/SampleLegend.vue +2 -8
  261. package/src/components/SampleSelector.drag.ts +51 -0
  262. package/src/components/SampleSelector.story.vue +6 -0
  263. package/src/components/SampleSelector.tree.ts +2 -0
  264. package/src/components/SampleSelector.vue +49 -10
  265. package/src/components/SampleSelectorGroupNode.vue +19 -0
  266. package/src/components/ScheduleCalendar.story.vue +6 -0
  267. package/src/components/ScheduleCalendar.vue +82 -7
  268. package/src/components/ScientificNumber.vue +0 -4
  269. package/src/components/SecretInput.story.vue +79 -0
  270. package/src/components/SecretInput.vue +150 -0
  271. package/src/components/SectionCard.vue +0 -4
  272. package/src/components/SegmentedControl.vue +48 -5
  273. package/src/components/SequenceInput.vue +0 -4
  274. package/src/components/SequenceProgressBar.story.vue +110 -0
  275. package/src/components/SequenceProgressBar.vue +0 -4
  276. package/src/components/SettingsModal.vue +0 -4
  277. package/src/components/Skeleton.vue +0 -4
  278. package/src/components/SmartGroupFieldRecipe.vue +8 -6
  279. package/src/components/SmartGroupManual.vue +0 -4
  280. package/src/components/StatusIndicator.vue +0 -4
  281. package/src/components/StepWizard.vue +0 -4
  282. package/src/components/TagsInput.vue +4 -6
  283. package/src/components/ThemeToggle.vue +0 -4
  284. package/src/components/TimePicker.vue +36 -7
  285. package/src/components/TimeRangeInput.vue +0 -4
  286. package/src/components/Tooltip.story.vue +3 -3
  287. package/src/components/Tooltip.vue +0 -4
  288. package/src/components/UnitInput.vue +0 -4
  289. package/src/components/WellPlate.geometry.ts +60 -1
  290. package/src/components/WellPlate.interaction.ts +44 -0
  291. package/src/components/WellPlate.story.vue +8 -0
  292. package/src/components/WellPlate.vue +53 -7
  293. package/src/components/index.ts +9 -0
  294. package/src/components/internal/AppTopBarPageSelectorInternal.vue +2 -5
  295. package/src/components/internal/AppTopBarPillNavInternal.vue +0 -4
  296. package/src/components/internal/DataStateInternal.vue +74 -0
  297. package/src/components/internal/FormSectionRenderer.vue +0 -4
  298. package/src/components/internal/WellEditPopupInternal.vue +20 -5
  299. package/src/components/internal/WorkspaceControlsInternal.vue +20 -0
  300. package/src/components/internal/WorkspaceShellInternal.vue +125 -0
  301. package/src/components/internal/WorkspaceSidebarInternal.vue +82 -0
  302. package/src/composables/controlSchemaTypes.ts +34 -0
  303. package/src/composables/experimentDesignData.ts +1 -3
  304. package/src/composables/flattenWorkspaceBindings.ts +104 -0
  305. package/src/composables/formBuilderRegistry.ts +5 -0
  306. package/src/composables/index.ts +41 -5
  307. package/src/composables/pluginWorkspaceModel.ts +182 -0
  308. package/src/composables/useAsync.ts +5 -1
  309. package/src/composables/useBioTemplatePackWorkspace.ts +15 -9
  310. package/src/composables/useBioTemplatePresetWorkspace.ts +14 -15
  311. package/src/composables/useBioTemplateWorkspace.ts +18 -43
  312. package/src/composables/useCommandHistory.ts +5 -1
  313. package/src/composables/useDropdownState.ts +35 -5
  314. package/src/composables/useEventStream.ts +326 -0
  315. package/src/composables/useFileImport.ts +2 -7
  316. package/src/composables/useFocusTrap.ts +91 -0
  317. package/src/composables/useGeneratedAnalysis.ts +46 -103
  318. package/src/composables/useJobsStatusTray.ts +1 -1
  319. package/src/composables/useListReorder.story.vue +143 -0
  320. package/src/composables/useListReorder.ts +242 -0
  321. package/src/composables/useMenuKeyboard.ts +90 -0
  322. package/src/composables/useOptimisticMutation.ts +6 -16
  323. package/src/composables/usePluginClient.ts +91 -252
  324. package/src/composables/usePluginConfig.ts +3 -1
  325. package/src/composables/usePluginWorkspace.ts +208 -0
  326. package/src/composables/useRackEditor.ts +2 -11
  327. package/src/composables/useRequestSyncState.ts +98 -28
  328. package/src/composables/useResourceCrud.ts +6 -16
  329. package/src/composables/useRovingFocus.ts +66 -0
  330. package/src/composables/useScheduleDrag.ts +37 -0
  331. package/src/composables/useWellPainting.ts +10 -30
  332. package/src/composables/useWellPlateAdapter.ts +5 -1
  333. package/src/composables/useWellPlateEditor.ts +1 -11
  334. package/src/composables/useWellPlateValidation.ts +5 -1
  335. package/src/composables/workspaceRecipes.ts +267 -0
  336. package/src/index.ts +16 -0
  337. package/src/permissions.ts +48 -9
  338. package/src/stores/experiment.ts +2 -7
  339. package/src/stores/index.ts +9 -1
  340. package/src/stores/settings.ts +93 -1
  341. package/src/styles/components/audit-trail.css +5 -5
  342. package/src/styles/components/batch-progress-list.css +7 -0
  343. package/src/styles/components/color-slider.css +2 -2
  344. package/src/styles/components/data-state.css +30 -0
  345. package/src/styles/components/dataframe.css +29 -35
  346. package/src/styles/components/experiment-data-viewer.css +4 -4
  347. package/src/styles/components/experiment-timeline.css +3 -30
  348. package/src/styles/components/form-builder.css +5 -5
  349. package/src/styles/components/lcms-sequence-table.css +16 -1
  350. package/src/styles/components/multi-select.css +1 -1
  351. package/src/styles/components/reagent-list.css +38 -31
  352. package/src/styles/components/sample-hierarchy-tree.css +5 -19
  353. package/src/styles/components/sample-selector.css +9 -2
  354. package/src/styles/components/schedule-calendar.css +8 -0
  355. package/src/styles/components/scientific-number.css +1 -1
  356. package/src/styles/components/secret-input.css +60 -0
  357. package/src/styles/components/well-plate.css +8 -0
  358. package/src/styles/index.css +9 -0
  359. package/src/styles/variables.css +29 -0
  360. package/src/templates/builderPresetControls.ts +1 -1
  361. package/src/templates/builderReadUtils.ts +1 -3
  362. package/src/templates/componentPlateHelpers.ts +3 -1
  363. package/src/templates/componentTargetResolvers.ts +1 -3
  364. package/src/templates/controlSchemaTargets.ts +1 -3
  365. package/src/templates/doseResponseAdapters.ts +2 -13
  366. package/src/templates/elisaAssayCollectionBuilder.ts +2 -2
  367. package/src/templates/plateMapBuilder.ts +2 -2
  368. package/src/templates/qpcrPlateBuilder.ts +1 -1
  369. package/src/templates/templateValidators.ts +1 -1
  370. package/src/templates/timeCourseBuilder.ts +2 -2
  371. package/src/templates/wellPlateScreenCollectionBuilder.ts +2 -2
  372. package/src/types/form-builder.ts +1 -0
  373. package/src/utils/color.ts +51 -0
  374. package/src/utils/errors.ts +29 -0
  375. package/src/utils/formModelSync.ts +1 -3
  376. package/src/utils/pluginIcon.ts +1 -3
  377. package/src/utils/pluginSecrets.ts +102 -0
  378. package/src/utils/records.ts +9 -0
  379. package/dist/EmptyState-p90quq8Z.js.map +0 -1
  380. package/dist/ExperimentPopover-tLwJ7XF4.js.map +0 -1
  381. package/dist/ExperimentSelectorModal-B6P2msT4.js.map +0 -1
  382. package/dist/SettingsModal-BW3Ar-uy.js.map +0 -1
  383. package/dist/components-DQt0tcpY.js.map +0 -1
  384. package/dist/composables/autoGroupConstants.d.ts +0 -1
  385. package/dist/composables/autoGroupGrouping.d.ts +0 -3
  386. package/dist/composables/useAutoGroupInputSources.d.ts +0 -32
  387. package/dist/composables-CkXDe7nm.js.map +0 -1
  388. package/dist/experiment-Y9Iz7KYi.js.map +0 -1
  389. package/dist/experiment-utils-CLnzPPq5.js.map +0 -1
  390. package/dist/templates/builderDefaults.d.ts +0 -1
  391. package/dist/templates/plateGeometry.d.ts +0 -4
  392. package/dist/templates-CovvRZ-9.js.map +0 -1
  393. package/dist/useApi-CDBq6z23.js.map +0 -1
  394. package/dist/useControlSchema-BhoJzWzx.js.map +0 -1
  395. package/dist/useDropdownState-DSb3BC3N.js.map +0 -1
  396. package/dist/useProtocolTemplates-DHwSveE6.js.map +0 -1
  397. package/src/__tests__/composables/useAutoGroupInputSources.test.ts +0 -127
  398. package/src/composables/autoGroupConstants.ts +0 -4
  399. package/src/composables/autoGroupGrouping.ts +0 -148
  400. package/src/composables/useAutoGroupInputSources.ts +0 -147
  401. package/src/templates/builderDefaults.ts +0 -11
  402. package/src/templates/plateGeometry.ts +0 -62
  403. /package/dist/__tests__/{composables/useAutoGroupInputSources.test.d.ts → components/DataStates.test.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
- import { r as useRequestSyncState } from "./EmptyState-p90quq8Z.js";
2
- import { B as currentExperimentFromContext, U as resolveCurrentExperimentId, V as getInjectedPlatformContext } from "./useControlSchema-BhoJzWzx.js";
3
- import { i as useAuthStore, n as authenticationRequiredError, o as useSettingsStore, r as useApi, t as AuthenticationRequiredError } from "./useApi-CDBq6z23.js";
4
- import { i as usePlatformContext } from "./useFormBuilder-DiEcDis2.js";
1
+ import { n as useRequestSyncState } from "./Skeleton-DxtwJ5gt.js";
2
+ import { B as currentExperimentFromContext, U as resolveCurrentExperimentId, V as getInjectedPlatformContext, et as useEventStream, lt as PLUGIN_SECRET_FORMAT_KEY } from "./useControlSchema-aMZlb4Sc.js";
3
+ import { a as useAuthStore, d as useSettingsStore, i as useApi, n as AuthenticationRequiredError, r as authenticationRequiredError, t as readErrorMessage } from "./errors-_W0-LbA6.js";
4
+ import { i as usePlatformContext } from "./useFormBuilder-TCxNnqeb.js";
5
+ import { bn as rowLabel, pn as PLATE_CONFIGS, yn as rowIndex } from "./templates-Qq113pyZ.js";
5
6
  import { computed, getCurrentInstance, onMounted, onUnmounted, ref, shallowRef, toValue, watch } from "vue";
6
7
  import axios from "axios";
7
8
  //#region src/composables/useAuth.ts
@@ -506,7 +507,11 @@ function defaultTransformError(error) {
506
507
  * const handleSubmit = () => submit(new FormData(formRef.value))
507
508
  * ```
508
509
  */
509
- /** Wraps an async function with reactive loading, error, and success state plus optional auto-execute. */
510
+ /**
511
+ * Wraps an async function with reactive loading, error, and success state plus optional auto-execute.
512
+ *
513
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useRequestSyncState()` instead.
514
+ */
510
515
  function useAsync(asyncFn, options = {}) {
511
516
  const { initialData = null, immediate = false, immediateArgs = [], transformError = defaultTransformError, onSuccess, onError, resetOnExecute = false } = options;
512
517
  const data = ref(initialData);
@@ -633,7 +638,9 @@ function platformOwnedConfigPatch(config) {
633
638
  function responseConfigPayload(response) {
634
639
  return response.config ?? response.settings ?? {};
635
640
  }
636
- /** Loads, saves, and tracks dirty state for a plugin's persistent configuration via the platform API. */
641
+ /**
642
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `usePluginSettings()` for typed plugin settings.
643
+ */
637
644
  function usePluginConfig(pluginName) {
638
645
  const injectedContext = getInjectedPlatformContext();
639
646
  const { plugin } = usePlatformContext();
@@ -778,7 +785,11 @@ function parseAnalysisArtifactTarget(query) {
778
785
  }
779
786
  //#endregion
780
787
  //#region src/composables/useCommandHistory.ts
781
- /** Generic command-stack state for plugin editors with undo/redo controls. */
788
+ /**
789
+ * Generic command-stack state for plugin editors with undo/redo controls.
790
+ *
791
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; keep command stacks plugin-local.
792
+ */
782
793
  function useCommandHistory(options = {}) {
783
794
  const maxDepth = Math.max(1, options.maxDepth ?? 50);
784
795
  const undoStack = ref([]);
@@ -841,7 +852,11 @@ function isPromiseLike(value) {
841
852
  }
842
853
  //#endregion
843
854
  //#region src/composables/useOptimisticMutation.ts
844
- /** Run async mutations with optional optimistic local updates and rollback. */
855
+ /**
856
+ * Run async mutations with optional optimistic local updates and rollback.
857
+ *
858
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useRequestSyncState()` instead.
859
+ */
845
860
  function useOptimisticMutation(options) {
846
861
  const loading = shallowRef(false);
847
862
  const error = ref(null);
@@ -875,7 +890,7 @@ function useOptimisticMutation(options) {
875
890
  return result;
876
891
  } catch (err) {
877
892
  options.rollback?.(snapshot, variables, err);
878
- error.value = options.readErrorMessage?.(err) ?? readErrorMessage$1(err);
893
+ error.value = options.readErrorMessage?.(err) ?? readErrorMessage(err);
879
894
  options.onError?.(err, context);
880
895
  throw err;
881
896
  } finally {
@@ -894,15 +909,13 @@ function useOptimisticMutation(options) {
894
909
  reset
895
910
  };
896
911
  }
897
- function readErrorMessage$1(value) {
898
- if (value instanceof Error && value.message) return value.message;
899
- if (typeof value === "string" && value.trim()) return value;
900
- if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string" && value.message.trim()) return value.message;
901
- return "Request failed.";
902
- }
903
912
  //#endregion
904
913
  //#region src/composables/useResourceCrud.ts
905
- /** Common list/create/update/delete state wrapper for generated plugin clients. */
914
+ /**
915
+ * Common list/create/update/delete state wrapper for generated plugin clients.
916
+ *
917
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useGeneratedPluginClient()` instead.
918
+ */
906
919
  function useResourceCrud(options) {
907
920
  const items = ref([...options.initialItems ?? []]);
908
921
  const loading = shallowRef(false);
@@ -1030,46 +1043,13 @@ function resolveKey(keyOrItem, getKey) {
1030
1043
  if (typeof keyOrItem === "string" || typeof keyOrItem === "number") return keyOrItem;
1031
1044
  return getKey(keyOrItem);
1032
1045
  }
1033
- function readErrorMessage(value) {
1034
- if (value instanceof Error && value.message) return value.message;
1035
- if (typeof value === "string" && value.trim()) return value;
1036
- if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string" && value.message.trim()) return value.message;
1037
- return "Request failed.";
1038
- }
1039
1046
  //#endregion
1040
1047
  //#region src/composables/useWellPainting.ts
1041
- var ROW_LABELS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1042
- var PLATE_DIMENSIONS = {
1043
- 6: {
1044
- rows: 2,
1045
- cols: 3
1046
- },
1047
- 12: {
1048
- rows: 3,
1049
- cols: 4
1050
- },
1051
- 24: {
1052
- rows: 4,
1053
- cols: 6
1054
- },
1055
- 48: {
1056
- rows: 6,
1057
- cols: 8
1058
- },
1059
- 54: {
1060
- rows: 6,
1061
- cols: 9
1062
- },
1063
- 96: {
1064
- rows: 8,
1065
- cols: 12
1066
- },
1067
- 384: {
1068
- rows: 16,
1069
- cols: 24
1070
- }
1071
- };
1072
- /** Pointer painting/rectangle selection state for WellPlate-based editors. */
1048
+ /**
1049
+ * Pointer painting/rectangle selection state for WellPlate-based editors.
1050
+ *
1051
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useWellPlateEditor()` instead.
1052
+ */
1073
1053
  function useWellPainting(options) {
1074
1054
  const activeMode = ref(options.initialMode ?? "select");
1075
1055
  const activePayload = ref(options.initialPayload);
@@ -1144,15 +1124,15 @@ function wellIdToCoordinate(wellId) {
1144
1124
  const match = /^([A-Z]+)(\d+)$/i.exec(wellId.trim());
1145
1125
  if (!match) return null;
1146
1126
  return {
1147
- row: rowLabelToIndex$1(match[1].toUpperCase()),
1127
+ row: rowIndex(match[1].toUpperCase()),
1148
1128
  col: Number(match[2]) - 1
1149
1129
  };
1150
1130
  }
1151
1131
  function coordinateToWellId(coord) {
1152
- return `${indexToRowLabel$1(coord.row)}${coord.col + 1}`;
1132
+ return `${rowLabel(coord.row)}${coord.col + 1}`;
1153
1133
  }
1154
1134
  function wellIdsInRectangle(start, end, format) {
1155
- const dimensions = PLATE_DIMENSIONS[format];
1135
+ const dimensions = PLATE_CONFIGS[format];
1156
1136
  const minRow = Math.max(0, Math.min(start.row, end.row));
1157
1137
  const maxRow = Math.min(dimensions.rows - 1, Math.max(start.row, end.row));
1158
1138
  const minCol = Math.max(0, Math.min(start.col, end.col));
@@ -1164,25 +1144,13 @@ function wellIdsInRectangle(start, end, format) {
1164
1144
  }));
1165
1145
  return ids;
1166
1146
  }
1167
- function rowLabelToIndex$1(label) {
1168
- let result = 0;
1169
- for (const char of label) result = result * 26 + (char.charCodeAt(0) - 64);
1170
- return result - 1;
1171
- }
1172
- function indexToRowLabel$1(index) {
1173
- if (index < 26) return ROW_LABELS[index];
1174
- let value = index + 1;
1175
- let label = "";
1176
- while (value > 0) {
1177
- value--;
1178
- label = ROW_LABELS[value % 26] + label;
1179
- value = Math.floor(value / 26);
1180
- }
1181
- return label;
1182
- }
1183
1147
  //#endregion
1184
1148
  //#region src/composables/useWellPlateAdapter.ts
1185
- /** Convert domain rows into WellPlate's wells prop without hand-written adapters. */
1149
+ /**
1150
+ * Convert domain rows into WellPlate's wells prop without hand-written adapters.
1151
+ *
1152
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useWellPlateEditor()` instead.
1153
+ */
1186
1154
  function useWellPlateAdapter(options) {
1187
1155
  return { wells: computed(() => createWellPlateWells(toValue(options.entries), options)) };
1188
1156
  }
@@ -1268,7 +1236,11 @@ function indexToRowLabel(index) {
1268
1236
  }
1269
1237
  //#endregion
1270
1238
  //#region src/composables/useWellPlateValidation.ts
1271
- /** Rule-driven validation state for WellPlate layout/design screens. */
1239
+ /**
1240
+ * Rule-driven validation state for WellPlate layout/design screens.
1241
+ *
1242
+ * @deprecated Unused by the MINT platform and scheduled for removal in MINT 1.3; use `useWellPlateEditor()` instead.
1243
+ */
1272
1244
  function useWellPlateValidation(options) {
1273
1245
  const warnings = computed(() => runWellPlateValidation(toValue(options.context), toValue(options.rules)));
1274
1246
  return {
@@ -1627,14 +1599,32 @@ async function downloadPluginEndpoint(contract, endpoint, payload, options = {})
1627
1599
  if (options.filename) downloadBlob(blob, options.filename, { revokeObjectUrlDelayMs: options.revokeObjectUrlDelayMs });
1628
1600
  return blob;
1629
1601
  }
1630
- /** Return a generated plugin client from setup code with a stable typed identity. */
1631
- function usePluginClient(client) {
1632
- return client;
1633
- }
1634
1602
  function normalizePluginSettingsOptions(options = {}) {
1635
1603
  return typeof options === "string" ? { pluginName: options } : options;
1636
1604
  }
1605
+ /** @deprecated Use `useGeneratedPluginClient()` for generated clients. */
1606
+ function usePluginClient(client) {
1607
+ return client;
1608
+ }
1637
1609
  var PLATFORM_OWNED_SETTINGS_KEY = "allowed_experiment_types";
1610
+ /**
1611
+ * Secret settings travel as `{ "$secret": "<id>" }` references, so an untouched
1612
+ * secret round-trips without ever exposing its value. Declaring the format on
1613
+ * every write keeps a `null` unambiguous: it clears the stored secret instead of
1614
+ * meaning "unchanged", which is what the deprecated placeholder form meant.
1615
+ */
1616
+ function withSecretFormat(payload, secretFormat) {
1617
+ if (!secretFormat) return payload;
1618
+ return {
1619
+ ...payload,
1620
+ [PLUGIN_SECRET_FORMAT_KEY]: secretFormat
1621
+ };
1622
+ }
1623
+ function responseSecretFormat(response) {
1624
+ if (!response || typeof response !== "object") return null;
1625
+ const format = response[PLUGIN_SECRET_FORMAT_KEY];
1626
+ return typeof format === "string" && format ? format : null;
1627
+ }
1638
1628
  function cloneRecord(value) {
1639
1629
  return JSON.parse(JSON.stringify(value));
1640
1630
  }
@@ -1672,6 +1662,7 @@ function usePluginSettings(options = {}) {
1672
1662
  const values = ref({});
1673
1663
  const savedValues = shallowRef({});
1674
1664
  const revision = ref(null);
1665
+ const secretFormat = ref(null);
1675
1666
  const request = useRequestSyncState("Plugin settings request failed.");
1676
1667
  const isLoading = ref(false);
1677
1668
  const isSaving = ref(false);
@@ -1692,11 +1683,12 @@ function usePluginSettings(options = {}) {
1692
1683
  function setValues(nextValues) {
1693
1684
  values.value = cloneRecord(nextValues);
1694
1685
  }
1695
- function applyLoaded(nextValues, nextRevision) {
1686
+ function applyLoaded(nextValues, nextRevision, nextSecretFormat = secretFormat.value) {
1696
1687
  const cloned = cloneRecord(nextValues);
1697
1688
  values.value = cloned;
1698
1689
  savedValues.value = cloneRecord(cloned);
1699
1690
  revision.value = nextRevision;
1691
+ secretFormat.value = nextSecretFormat;
1700
1692
  }
1701
1693
  async function load() {
1702
1694
  isLoading.value = true;
@@ -1708,7 +1700,7 @@ function usePluginSettings(options = {}) {
1708
1700
  success: "load",
1709
1701
  errorMessage: "Failed to load plugin settings"
1710
1702
  });
1711
- applyLoaded(responseSettingsPayload(response), responseSettingsRevision(response));
1703
+ applyLoaded(responseSettingsPayload(response), responseSettingsRevision(response), responseSecretFormat(response));
1712
1704
  } catch {} finally {
1713
1705
  isLoading.value = false;
1714
1706
  }
@@ -1725,7 +1717,7 @@ function usePluginSettings(options = {}) {
1725
1717
  const typedKeys = [...dirtyKeys].filter((key) => key !== PLATFORM_OWNED_SETTINGS_KEY);
1726
1718
  let nextRevision = revision.value;
1727
1719
  if (typedKeys.length) {
1728
- response = await request.run(() => platformApi.patch(`/plugins/${encodeURIComponent(resolvedPluginName.value)}/config`, { config: topLevelSettingsPatch(payload, typedKeys) }), {
1720
+ response = await request.run(() => platformApi.patch(`/plugins/${encodeURIComponent(resolvedPluginName.value)}/config`, { config: withSecretFormat(topLevelSettingsPatch(payload, typedKeys), secretFormat.value) }), {
1729
1721
  success: "save",
1730
1722
  errorMessage: "Failed to save plugin settings"
1731
1723
  });
@@ -1739,16 +1731,16 @@ function usePluginSettings(options = {}) {
1739
1731
  nextRevision = responseSettingsRevision(response) ?? nextRevision;
1740
1732
  }
1741
1733
  if (!response) return true;
1742
- applyLoaded(responseSettingsPayload(response), nextRevision);
1734
+ applyLoaded(responseSettingsPayload(response), nextRevision, responseSecretFormat(response) ?? secretFormat.value);
1743
1735
  return true;
1744
1736
  } else {
1745
1737
  const ifMatch = revision.value ? { headers: { "If-Match": `"${revision.value}"` } } : void 0;
1746
- response = await request.run(() => pluginApi.put("/settings", payload, ifMatch), {
1738
+ response = await request.run(() => pluginApi.put("/settings", withSecretFormat(payload, secretFormat.value), ifMatch), {
1747
1739
  success: "save",
1748
1740
  errorMessage: "Failed to save plugin settings"
1749
1741
  });
1750
1742
  }
1751
- applyLoaded(responseSettingsPayload(response), responseSettingsRevision(response) ?? revision.value);
1743
+ applyLoaded(responseSettingsPayload(response), responseSettingsRevision(response) ?? revision.value, responseSecretFormat(response) ?? secretFormat.value);
1752
1744
  return true;
1753
1745
  } catch {
1754
1746
  return false;
@@ -1780,44 +1772,27 @@ function usePluginSettings(options = {}) {
1780
1772
  reset
1781
1773
  };
1782
1774
  }
1783
- function streamRequestAuth(options, policy) {
1784
- const headers = new Headers(options.headers);
1775
+ function streamRequestAuth(requestHeaders, policy) {
1776
+ const headers = new Headers(requestHeaders);
1785
1777
  const authStore = useAuthStore();
1786
1778
  if (!authStore.isInitialized) authStore.initialize();
1787
1779
  if (policy.requiresAuth && authStore.token && !headers.has("Authorization")) headers.set("Authorization", `Bearer ${authStore.token}`);
1788
- headers.set("Accept", "text/event-stream");
1789
1780
  const token = policy.requiresAuth ? authStore.token : void 0;
1790
1781
  return {
1791
1782
  headers,
1792
1783
  token: token && headers.get("Authorization") === `Bearer ${token}` ? token : void 0
1793
1784
  };
1794
1785
  }
1795
- function parseSseEvent(block, parseJson) {
1796
- let event = "message";
1797
- let id;
1798
- let retry;
1799
- const dataLines = [];
1800
- for (const line of block.split(/\r?\n/)) {
1801
- if (!line || line.startsWith(":")) continue;
1802
- const separator = line.indexOf(":");
1803
- const field = separator === -1 ? line : line.slice(0, separator);
1804
- const value = separator === -1 ? "" : line.slice(separator + 1).replace(/^ /, "");
1805
- if (field === "event") event = value || "message";
1806
- if (field === "data") dataLines.push(value);
1807
- if (field === "id") id = value;
1808
- if (field === "retry") {
1809
- const parsed = Number(value);
1810
- if (Number.isFinite(parsed)) retry = parsed;
1811
- }
1812
- }
1813
- if (!dataLines.length && !id && retry === void 0) return null;
1814
- const data = dataLines.join("\n");
1815
- return {
1816
- event,
1817
- data: parseJson && data ? JSON.parse(data) : data,
1818
- id,
1819
- retry,
1820
- raw: block
1786
+ function pluginEventStreamTransport(endpoint) {
1787
+ return async (url, init = {}) => {
1788
+ if (typeof fetch !== "function") throw new Error("[MINT SDK] fetch is required for plugin event streams.");
1789
+ const requestAuth = streamRequestAuth(init.headers, { requiresAuth: endpoint.requiresAuth !== false });
1790
+ const response = await fetch(url, {
1791
+ ...init,
1792
+ headers: requestAuth.headers
1793
+ });
1794
+ if (response.status === 401) throw authenticationRequiredError(response, requestAuth.token);
1795
+ return response;
1821
1796
  };
1822
1797
  }
1823
1798
  function looksLikeEventStreamOptions(value) {
@@ -1837,149 +1812,25 @@ function looksLikeEventStreamOptions(value) {
1837
1812
  ].some((key) => key in candidate);
1838
1813
  }
1839
1814
  function usePluginEventStream(contract, endpoint, payloadOrOptions, maybeOptions) {
1815
+ if (endpoint.method !== "get") throw new Error(`[MINT SDK] Plugin event streams must use GET; got ${endpoint.method}`);
1840
1816
  const payload = maybeOptions === void 0 && looksLikeEventStreamOptions(payloadOrOptions) ? void 0 : payloadOrOptions;
1841
1817
  const options = maybeOptions === void 0 && looksLikeEventStreamOptions(payloadOrOptions) ? payloadOrOptions : maybeOptions ?? {};
1842
- const isConnected = ref(false);
1843
- const isConnecting = ref(false);
1844
- const error = ref(null);
1845
- const lastMessage = shallowRef(null);
1846
- const lastEventId = ref(null);
1847
1818
  const responseType = endpoint.responseType?.trim();
1848
1819
  const parseJson = options.parseJson ?? Boolean(responseType && responseType !== "string");
1849
- let controller = null;
1850
- let reconnectTimer = null;
1851
- let stopped = true;
1852
- let generation = 0;
1853
- function clearReconnectTimer() {
1854
- if (reconnectTimer !== null) {
1855
- clearTimeout(reconnectTimer);
1856
- reconnectTimer = null;
1857
- }
1858
- }
1859
- function ownsConnection(connectionGeneration, connectionController) {
1860
- return !stopped && generation === connectionGeneration && controller === connectionController;
1861
- }
1862
- function scheduleReconnect(connectionGeneration) {
1863
- if (stopped || generation !== connectionGeneration || options.reconnect === false) return;
1864
- clearReconnectTimer();
1865
- reconnectTimer = setTimeout(() => {
1866
- reconnectTimer = null;
1867
- if (stopped || generation !== connectionGeneration) return;
1868
- connect(connectionGeneration);
1869
- }, options.reconnectDelayMs ?? 2e3);
1870
- }
1871
- async function connect(connectionGeneration) {
1872
- if (stopped || generation !== connectionGeneration) return;
1873
- if (endpoint.method !== "get") throw new Error(`[MINT SDK] Plugin event streams must use GET; got ${endpoint.method}`);
1874
- if (typeof fetch !== "function") throw new Error("[MINT SDK] fetch is required for plugin event streams.");
1875
- controller?.abort();
1876
- const connectionController = new AbortController();
1877
- controller = connectionController;
1878
- isConnecting.value = true;
1879
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1880
- error.value = null;
1881
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1882
- let authenticationFailed = false;
1883
- try {
1884
- const url = buildPluginEndpointUrl(contract, endpoint, payload, { baseUrl: options.baseUrl });
1885
- const requestAuth = streamRequestAuth(options, { requiresAuth: endpoint.requiresAuth !== false });
1886
- const response = await fetch(url, {
1887
- method: "GET",
1888
- headers: requestAuth.headers,
1889
- credentials: options.credentials ?? "same-origin",
1890
- signal: connectionController.signal
1891
- });
1892
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1893
- if (!response.ok) {
1894
- if (response.status === 401) {
1895
- authenticationFailed = true;
1896
- throw authenticationRequiredError(response, requestAuth.token);
1897
- }
1898
- throw new Error(`Plugin event stream failed with HTTP ${response.status}`);
1899
- }
1900
- if (!response.body) throw new Error("Plugin event stream response did not include a readable body.");
1901
- isConnected.value = true;
1902
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1903
- options.onOpen?.();
1904
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1905
- const reader = response.body.getReader();
1906
- const decoder = new TextDecoder();
1907
- let buffer = "";
1908
- for (;;) {
1909
- const { value, done } = await reader.read();
1910
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1911
- if (done) break;
1912
- buffer += decoder.decode(value, { stream: true });
1913
- let boundary = buffer.search(/\r?\n\r?\n/);
1914
- while (boundary !== -1) {
1915
- const block = buffer.slice(0, boundary);
1916
- buffer = buffer.slice(buffer[boundary] === "\r" ? boundary + 4 : boundary + 2);
1917
- const message = parseSseEvent(block, parseJson);
1918
- if (message) {
1919
- lastMessage.value = message;
1920
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1921
- if (message.id !== void 0) {
1922
- lastEventId.value = message.id;
1923
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1924
- }
1925
- if (message.retry !== void 0) options.reconnectDelayMs = message.retry;
1926
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1927
- options.onMessage?.(message);
1928
- if (!ownsConnection(connectionGeneration, connectionController)) return;
1929
- }
1930
- boundary = buffer.search(/\r?\n\r?\n/);
1931
- }
1932
- }
1933
- } catch (err) {
1934
- if (err instanceof AuthenticationRequiredError) authenticationFailed = true;
1935
- if (ownsConnection(connectionGeneration, connectionController) && !(err instanceof DOMException && err.name === "AbortError")) {
1936
- error.value = err instanceof Error ? err.message : "Plugin event stream failed";
1937
- if (ownsConnection(connectionGeneration, connectionController)) options.onError?.(err);
1938
- }
1939
- } finally {
1940
- if (ownsConnection(connectionGeneration, connectionController)) {
1941
- isConnecting.value = false;
1942
- if (ownsConnection(connectionGeneration, connectionController)) {
1943
- isConnected.value = false;
1944
- if (ownsConnection(connectionGeneration, connectionController)) {
1945
- controller = null;
1946
- if (authenticationFailed) stopped = true;
1947
- else scheduleReconnect(connectionGeneration);
1948
- }
1949
- }
1950
- }
1951
- }
1952
- }
1953
- function start() {
1954
- if (!stopped) return;
1955
- stopped = false;
1956
- clearReconnectTimer();
1957
- generation += 1;
1958
- connect(generation);
1959
- }
1960
- function stop() {
1961
- if (stopped) return;
1962
- stopped = true;
1963
- generation += 1;
1964
- clearReconnectTimer();
1965
- controller?.abort();
1966
- controller = null;
1967
- isConnecting.value = false;
1968
- isConnected.value = false;
1969
- }
1970
- const currentInstance = getCurrentInstance();
1971
- if (currentInstance && options.immediate !== false && typeof window === "undefined") onMounted(start);
1972
- if (currentInstance) onUnmounted(stop);
1973
- if (options.immediate !== false && (typeof window !== "undefined" || !currentInstance)) start();
1974
- return {
1975
- isConnected,
1976
- isConnecting,
1977
- error,
1978
- lastMessage,
1979
- lastEventId,
1980
- start,
1981
- stop
1982
- };
1820
+ return useEventStream(() => buildPluginEndpointUrl(contract, endpoint, payload, { baseUrl: options.baseUrl }), {
1821
+ transport: pluginEventStreamTransport(endpoint),
1822
+ immediate: options.immediate,
1823
+ reconnect: options.reconnect,
1824
+ reconnectDelayMs: options.reconnectDelayMs,
1825
+ parseJson,
1826
+ credentials: options.credentials,
1827
+ headers: options.headers,
1828
+ shouldReconnect: (cause) => !(cause instanceof AuthenticationRequiredError),
1829
+ onOpen: options.onOpen,
1830
+ onMessage: options.onMessage,
1831
+ onError: options.onError,
1832
+ errorLabel: "Plugin event stream"
1833
+ });
1983
1834
  }
1984
1835
  /** Read and optionally load the current platform experiment for integrated plugin views. */
1985
1836
  function useCurrentExperiment(options = {}) {
@@ -2041,4 +1892,4 @@ function useCurrentExperiment(options = {}) {
2041
1892
  //#endregion
2042
1893
  export { useAsync as A, createPluginResourceClient as C, buildAnalysisArtifactTargetQuery as D, useCommandHistory as E, resolvePluginFrontendBase as M, usePasskey as N, parseAnalysisArtifactTarget as O, useAuth as P, wellIdsInRectangle as S, useOptimisticMutation as T, createWellPlateWells as _, pluginFormDataFromPayload as a, useWellPainting as b, usePluginClient as c, buildPluginEndpointUrl as d, resolvePluginBaseUrl as f, createRowConditions as g, createColumnConditions as h, getPluginPageSelectorItems as i, useAsyncBatch as j, usePluginConfig as k, usePluginEventStream as l, useWellPlateValidation as m, downloadBlob as n, uploadPluginEndpoint as o, runWellPlateValidation as p, downloadPluginEndpoint as r, useCurrentExperiment as s, createPluginClient as t, usePluginSettings as u, useWellPlateAdapter as v, useResourceCrud as w, wellIdToCoordinate as x, coordinateToWellId as y };
2043
1894
 
2044
- //# sourceMappingURL=composables-CkXDe7nm.js.map
1895
+ //# sourceMappingURL=composables-B_pia3hO.js.map