windmill-components 1.37.0 → 1.46.2

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 (401) hide show
  1. package/common.d.ts +1 -0
  2. package/components/AppConnect.svelte +45 -49
  3. package/components/ArgInfo.svelte +37 -15
  4. package/components/ArgInput.svelte +33 -34
  5. package/components/ArgInput.svelte.d.ts +3 -1
  6. package/components/ButtonAndDropdown.svelte +1 -1
  7. package/components/CenteredPage.svelte +2 -2
  8. package/components/CronInput.svelte +24 -20
  9. package/components/CronInput.svelte.d.ts +1 -0
  10. package/components/DisplayResult.svelte +2 -2
  11. package/components/Dropdown.svelte +10 -13
  12. package/components/Dropdown.svelte.d.ts +4 -1
  13. package/components/Editor.svelte +27 -3
  14. package/components/Editor.svelte.d.ts +3 -1
  15. package/components/EditorBar.svelte +77 -30
  16. package/components/EditorBar.svelte.d.ts +3 -1
  17. package/components/FieldHeader.svelte +6 -5
  18. package/components/FlowBuilder.svelte +52 -55
  19. package/components/FlowBuilder.svelte.d.ts +2 -0
  20. package/components/FlowJobResult.svelte +11 -18
  21. package/components/FlowJobResult.svelte.d.ts +2 -2
  22. package/components/FlowMetadata.svelte +65 -0
  23. package/components/FlowMetadata.svelte.d.ts +17 -0
  24. package/components/FlowModulesViewer.svelte +18 -4
  25. package/components/FlowPreviewContent.svelte +88 -50
  26. package/components/FlowPreviewContent.svelte.d.ts +1 -0
  27. package/components/FlowStatusViewer.svelte +123 -61
  28. package/components/FlowStatusViewer.svelte.d.ts +8 -3
  29. package/components/FlowViewer.svelte +84 -9
  30. package/components/FlowViewer.svelte.d.ts +1 -0
  31. package/components/GroupModal.svelte +43 -44
  32. package/components/GroupModal.svelte.d.ts +2 -2
  33. package/components/HighlightCode.svelte +4 -1
  34. package/components/HighlightCode.svelte.d.ts +1 -1
  35. package/components/IconedResourceType.svelte +6 -4
  36. package/components/IconedResourceType.svelte.d.ts +1 -0
  37. package/components/InputTransformForm.svelte +38 -27
  38. package/components/InputTransformsViewer.svelte +2 -1
  39. package/components/InviteGlobalUser.svelte +6 -10
  40. package/components/InviteGlobalUser.svelte.d.ts +1 -4
  41. package/components/InviteUser.svelte +4 -8
  42. package/components/InviteUser.svelte.d.ts +1 -4
  43. package/components/ItemPicker.svelte +50 -43
  44. package/components/ItemPicker.svelte.d.ts +2 -2
  45. package/components/JobArgs.svelte +33 -0
  46. package/components/JobArgs.svelte.d.ts +16 -0
  47. package/components/JobStatus.svelte +21 -17
  48. package/components/LogViewer.svelte +11 -6
  49. package/components/Modal.svelte +5 -5
  50. package/components/Modal.svelte.d.ts +4 -4
  51. package/components/ModulePreview.svelte +47 -63
  52. package/components/ModulePreview.svelte.d.ts +0 -1
  53. package/components/PageHeader.svelte +6 -6
  54. package/components/Password.svelte +1 -1
  55. package/components/Path.svelte +28 -7
  56. package/components/Path.svelte.d.ts +3 -3
  57. package/components/Popover.svelte +61 -0
  58. package/components/Popover.svelte.d.ts +17 -0
  59. package/components/Required.svelte +4 -4
  60. package/components/Required.svelte.d.ts +1 -0
  61. package/components/ResourceEditor.svelte +105 -116
  62. package/components/ResourceEditor.svelte.d.ts +0 -1
  63. package/components/ResourcePicker.svelte +9 -6
  64. package/components/ResourceTypePicker.svelte +3 -1
  65. package/components/RunChart.svelte +102 -0
  66. package/components/RunChart.svelte.d.ts +20 -0
  67. package/components/RunForm.svelte +58 -40
  68. package/components/RunForm.svelte.d.ts +13 -0
  69. package/components/SchemaEditor.svelte +5 -5
  70. package/components/SchemaEditorProperty.svelte +1 -1
  71. package/components/SchemaForm.svelte +3 -1
  72. package/components/SchemaForm.svelte.d.ts +1 -0
  73. package/components/SchemaModal.svelte +113 -105
  74. package/components/SchemaModal.svelte.d.ts +4 -4
  75. package/components/SchemaViewer.svelte +7 -4
  76. package/components/ScriptBuilder.svelte +143 -163
  77. package/components/ScriptBuilder.svelte.d.ts +1 -0
  78. package/components/ScriptEditor.svelte +117 -114
  79. package/components/ScriptEditor.svelte.d.ts +1 -0
  80. package/components/ScriptPicker.svelte +16 -24
  81. package/components/ScriptSchema.svelte +33 -32
  82. package/components/ShareModal.svelte +74 -68
  83. package/components/ShareModal.svelte.d.ts +2 -2
  84. package/components/SimpleEditor.svelte +4 -2
  85. package/components/SuperadminSettings.svelte +134 -0
  86. package/components/SuperadminSettings.svelte.d.ts +19 -0
  87. package/components/TableCustom.svelte +1 -1
  88. package/components/TableSimple.svelte +1 -1
  89. package/components/TestJobLoader.svelte +14 -6
  90. package/components/TestJobLoader.svelte.d.ts +4 -2
  91. package/components/Toggle.svelte +5 -3
  92. package/components/Toggle.svelte.d.ts +2 -0
  93. package/components/Tooltip.svelte +9 -64
  94. package/components/UserSettings.svelte +241 -0
  95. package/components/UserSettings.svelte.d.ts +19 -0
  96. package/components/VariableEditor.svelte +80 -74
  97. package/components/common/actionRow/ActionRow.svelte +5 -4
  98. package/components/common/alert/Alert.svelte +1 -1
  99. package/components/common/alert/Alert.svelte.d.ts +1 -0
  100. package/components/common/badge/Badge.svelte +2 -2
  101. package/components/common/breadcrumb/Breadcrumb.svelte +24 -0
  102. package/components/common/breadcrumb/Breadcrumb.svelte.d.ts +22 -0
  103. package/components/common/button/Button.svelte +20 -8
  104. package/components/common/button/Button.svelte.d.ts +1 -0
  105. package/components/common/button/model.d.ts +1 -1
  106. package/components/common/confirmationModal/ConfirmationModal.svelte +1 -0
  107. package/components/common/drawer/Drawer.svelte +38 -7
  108. package/components/common/drawer/Drawer.svelte.d.ts +6 -0
  109. package/components/common/drawer/DrawerContent.svelte +21 -7
  110. package/components/common/drawer/DrawerContent.svelte.d.ts +4 -0
  111. package/components/common/index.d.ts +1 -0
  112. package/components/common/index.js +1 -0
  113. package/components/common/kbd/Kbd.svelte +1 -1
  114. package/components/common/languageIcons/Bash.svelte +18 -0
  115. package/components/common/languageIcons/Bash.svelte.d.ts +27 -0
  116. package/components/common/languageIcons/Go.svelte +34 -0
  117. package/components/common/languageIcons/Go.svelte.d.ts +27 -0
  118. package/components/common/languageIcons/LanguageIcon.svelte +19 -0
  119. package/components/common/languageIcons/LanguageIcon.svelte.d.ts +21 -0
  120. package/components/common/languageIcons/Python.svelte +51 -0
  121. package/components/common/languageIcons/Python.svelte.d.ts +27 -0
  122. package/components/common/languageIcons/TypeScript.svelte +31 -0
  123. package/components/common/languageIcons/TypeScript.svelte.d.ts +27 -0
  124. package/components/common/languageIcons/index.d.ts +5 -0
  125. package/components/common/languageIcons/index.js +5 -0
  126. package/components/common/menu/Menu.svelte +15 -19
  127. package/components/common/skeleton/Skeleton.svelte +1 -2
  128. package/components/common/skeleton/Skeleton.svelte.d.ts +0 -1
  129. package/components/common/skeleton/SkeletonElement.svelte +1 -1
  130. package/components/common/tabs/TabContent.svelte +2 -1
  131. package/components/common/tabs/TabContent.svelte.d.ts +1 -0
  132. package/components/common/tabs/Tabs.svelte +8 -6
  133. package/components/common/tabs/Tabs.svelte.d.ts +1 -0
  134. package/components/flows/FlowEditor.svelte +11 -20
  135. package/components/flows/FlowProgressBar.svelte +55 -0
  136. package/components/flows/FlowProgressBar.svelte.d.ts +21 -0
  137. package/components/flows/common/FlowCardHeader.svelte +5 -6
  138. package/components/flows/content/CapturePayload.svelte +112 -0
  139. package/components/flows/content/CapturePayload.svelte.d.ts +17 -0
  140. package/components/flows/content/DynamicInputHelpBox.svelte +6 -10
  141. package/components/flows/content/FlowBranchAllWrapper.svelte +21 -0
  142. package/components/flows/content/FlowBranchAllWrapper.svelte.d.ts +21 -0
  143. package/components/flows/content/FlowBranchOneWrapper.svelte +49 -0
  144. package/components/flows/content/FlowBranchOneWrapper.svelte.d.ts +23 -0
  145. package/components/flows/content/FlowBranchesWrapper.svelte +140 -0
  146. package/components/flows/content/FlowBranchesWrapper.svelte.d.ts +19 -0
  147. package/components/flows/content/FlowEditorPanel.svelte +8 -6
  148. package/components/flows/content/FlowFailureModule.svelte +4 -6
  149. package/components/flows/content/FlowInput.svelte +31 -5
  150. package/components/flows/content/FlowInputs.svelte +119 -50
  151. package/components/flows/content/FlowInputs.svelte.d.ts +5 -4
  152. package/components/flows/content/FlowLoop.svelte +85 -142
  153. package/components/flows/content/FlowLoop.svelte.d.ts +2 -1
  154. package/components/flows/content/FlowModuleComponent.svelte +231 -0
  155. package/components/flows/content/FlowModuleComponent.svelte.d.ts +20 -0
  156. package/components/flows/content/FlowModuleEarlyStop.svelte +45 -48
  157. package/components/flows/content/FlowModuleEarlyStop.svelte.d.ts +1 -0
  158. package/components/flows/content/FlowModuleHeader.svelte +11 -40
  159. package/components/flows/content/FlowModuleHeader.svelte.d.ts +0 -1
  160. package/components/flows/content/FlowModuleScript.svelte +7 -12
  161. package/components/flows/content/FlowModuleScript.svelte.d.ts +1 -2
  162. package/components/flows/content/FlowModuleSuspend.svelte +31 -15
  163. package/components/flows/content/FlowModuleSuspend.svelte.d.ts +1 -0
  164. package/components/flows/content/FlowModuleWrapper.svelte +138 -38
  165. package/components/flows/content/FlowModuleWrapper.svelte.d.ts +6 -1
  166. package/components/flows/content/FlowRetries.svelte +13 -2
  167. package/components/flows/content/FlowRetries.svelte.d.ts +1 -0
  168. package/components/flows/content/FlowSchedules.svelte +0 -2
  169. package/components/flows/content/FlowSettings.svelte +103 -72
  170. package/components/flows/flowState.d.ts +8 -8
  171. package/components/flows/flowState.js +32 -17
  172. package/components/flows/flowStateUtils.d.ts +21 -38
  173. package/components/flows/flowStateUtils.js +86 -158
  174. package/components/flows/flowStore.d.ts +3 -2
  175. package/components/flows/flowStore.js +60 -7
  176. package/components/flows/header/FlowImportExportMenu.svelte +12 -22
  177. package/components/flows/header/FlowPreviewButtons.svelte +11 -11
  178. package/components/flows/map/FlowBranchAllMap.svelte +90 -0
  179. package/components/flows/map/FlowBranchAllMap.svelte.d.ts +17 -0
  180. package/components/flows/map/FlowBranchOneMap.svelte +116 -0
  181. package/components/flows/map/FlowBranchOneMap.svelte.d.ts +17 -0
  182. package/components/flows/map/FlowErrorHandlerItem.svelte +14 -11
  183. package/components/flows/map/FlowInputsItem.svelte +19 -0
  184. package/components/flows/map/FlowInputsItem.svelte.d.ts +14 -0
  185. package/components/flows/map/FlowModuleSchemaItem.svelte +53 -36
  186. package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +5 -5
  187. package/components/flows/map/FlowModuleSchemaMap.svelte +73 -144
  188. package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +2 -3
  189. package/components/flows/map/FlowSettingsItem.svelte +29 -0
  190. package/components/flows/map/FlowSettingsItem.svelte.d.ts +14 -0
  191. package/components/flows/map/InsertModuleButton.svelte +11 -0
  192. package/components/flows/map/InsertModuleButton.svelte.d.ts +16 -0
  193. package/components/flows/map/MapItem.svelte +105 -0
  194. package/components/flows/map/MapItem.svelte.d.ts +22 -0
  195. package/components/flows/pickers/FlowScriptPicker.svelte +14 -4
  196. package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -1
  197. package/components/flows/pickers/PickHubScript.svelte +5 -4
  198. package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -0
  199. package/components/flows/pickers/PickScript.svelte +6 -5
  200. package/components/flows/pickers/PickScript.svelte.d.ts +1 -0
  201. package/components/flows/previousResults.d.ts +14 -0
  202. package/components/flows/previousResults.js +118 -0
  203. package/components/flows/propPicker/PropPickerWrapper.svelte +22 -15
  204. package/components/flows/propPicker/PropPickerWrapper.svelte.d.ts +6 -2
  205. package/components/flows/utils.d.ts +8 -5
  206. package/components/flows/utils.js +86 -56
  207. package/components/graph/FlowGraph.svelte +259 -0
  208. package/components/graph/FlowGraph.svelte.d.ts +20 -0
  209. package/components/graph/index.d.ts +3 -0
  210. package/components/graph/index.js +3 -0
  211. package/components/graph/model.d.ts +20 -0
  212. package/components/graph/model.js +9 -0
  213. package/components/graph/util.d.ts +9 -0
  214. package/components/graph/util.js +14 -0
  215. package/components/icons/WindmillIcon.svelte +85 -52
  216. package/components/icons/WindmillIcon.svelte.d.ts +2 -0
  217. package/components/jobs/JobDetail.svelte +40 -30
  218. package/components/landing/FlowGettingStarted.svelte +4 -3
  219. package/components/landing/FlowLandingBox.svelte +23 -53
  220. package/components/landing/RessourceGettingStarted.svelte +1 -1
  221. package/components/landing/ScriptBox.svelte +25 -27
  222. package/components/landing/ScriptGettingStarted.svelte +4 -3
  223. package/components/preview/FlowPreviewStatus.svelte +1 -1
  224. package/components/progressBar/ProgressBar.svelte +89 -0
  225. package/components/{ProgressBar.svelte.d.ts → progressBar/ProgressBar.svelte.d.ts} +5 -2
  226. package/components/progressBar/ProgressBarGeneralPart.svelte +22 -0
  227. package/components/progressBar/ProgressBarGeneralPart.svelte.d.ts +19 -0
  228. package/components/progressBar/ProgressBarLoopAccessor.svelte +14 -0
  229. package/components/progressBar/ProgressBarLoopAccessor.svelte.d.ts +19 -0
  230. package/components/progressBar/ProgressBarLoopPart.svelte +34 -0
  231. package/components/progressBar/ProgressBarLoopPart.svelte.d.ts +19 -0
  232. package/components/progressBar/index.d.ts +2 -0
  233. package/components/progressBar/index.js +2 -0
  234. package/components/progressBar/model.d.ts +32 -0
  235. package/components/progressBar/model.js +14 -0
  236. package/components/propertyPicker/ObjectViewer.svelte +18 -13
  237. package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
  238. package/components/propertyPicker/PropPicker.svelte +90 -44
  239. package/components/propertyPicker/PropPicker.svelte.d.ts +4 -1
  240. package/components/propertyPicker/PropPickerResult.svelte +12 -0
  241. package/components/propertyPicker/PropPickerResult.svelte.d.ts +18 -0
  242. package/components/propertyPicker/utils.d.ts +1 -1
  243. package/components/propertyPicker/utils.js +4 -1
  244. package/components/{script_editor → scriptEditor}/LogPanel.svelte +30 -20
  245. package/components/{script_editor → scriptEditor}/LogPanel.svelte.d.ts +0 -0
  246. package/components/scripts/CreateActions.svelte +2 -2
  247. package/components/sidebar/SidebarContent.svelte +1 -1
  248. package/components/sidebar/UserMenu.svelte +17 -1
  249. package/components/sidebar/UserMenu.svelte.d.ts +3 -0
  250. package/components/sidebar/WorkspaceMenu.svelte +16 -14
  251. package/components/splitPanes/SplitPanesWrapper.svelte +34 -0
  252. package/components/splitPanes/SplitPanesWrapper.svelte.d.ts +20 -0
  253. package/editorUtils.js +2 -0
  254. package/gen/core/OpenAPI.js +1 -1
  255. package/gen/index.d.ts +8 -1
  256. package/gen/index.js +5 -0
  257. package/gen/models/AppWithLastVersion.d.ts +21 -0
  258. package/gen/models/AppWithLastVersion.js +12 -0
  259. package/gen/models/BranchAll.d.ts +10 -0
  260. package/gen/models/{Branches.js → BranchAll.js} +0 -0
  261. package/gen/models/{Branches.d.ts → BranchOne.d.ts} +3 -5
  262. package/gen/models/BranchOne.js +4 -0
  263. package/gen/models/CompletedJob.d.ts +4 -2
  264. package/gen/models/CompletedJob.js +2 -0
  265. package/gen/models/FlowModule.d.ts +2 -1
  266. package/gen/models/FlowModuleValue.d.ts +4 -2
  267. package/gen/models/FlowStatusModule.d.ts +11 -2
  268. package/gen/models/ForloopFlow.d.ts +1 -0
  269. package/gen/models/Identity.d.ts +3 -0
  270. package/gen/models/Identity.js +4 -0
  271. package/gen/models/ListableApp.d.ts +16 -0
  272. package/gen/models/ListableApp.js +12 -0
  273. package/gen/models/ListableVariable.d.ts +1 -1
  274. package/gen/models/PathScript.d.ts +2 -0
  275. package/gen/models/Policy.d.ts +12 -0
  276. package/gen/models/Policy.js +12 -0
  277. package/gen/models/Preview.d.ts +2 -1
  278. package/gen/models/Preview.js +1 -0
  279. package/gen/models/QueuedJob.d.ts +4 -2
  280. package/gen/models/QueuedJob.js +2 -0
  281. package/gen/models/RawScript.d.ts +4 -1
  282. package/gen/models/RawScript.js +1 -0
  283. package/gen/models/Script.d.ts +4 -2
  284. package/gen/models/Script.js +2 -0
  285. package/gen/services/AppService.d.ts +31 -0
  286. package/gen/services/AppService.js +49 -0
  287. package/gen/services/CaptureService.d.ts +30 -0
  288. package/gen/services/CaptureService.js +52 -0
  289. package/gen/services/FlowService.d.ts +90 -0
  290. package/gen/services/FlowService.js +72 -0
  291. package/gen/services/JobService.d.ts +57 -8
  292. package/gen/services/JobService.js +78 -10
  293. package/gen/services/OauthService.d.ts +6 -15
  294. package/gen/services/OauthService.js +6 -19
  295. package/gen/services/ResourceService.d.ts +10 -1
  296. package/gen/services/ResourceService.js +16 -1
  297. package/gen/services/ScriptService.d.ts +28 -3
  298. package/gen/services/ScriptService.js +27 -0
  299. package/gen/services/UserService.d.ts +14 -6
  300. package/gen/services/UserService.js +25 -11
  301. package/infer.d.ts +1 -1
  302. package/infer.js +35 -18
  303. package/logout.d.ts +1 -1
  304. package/logout.js +7 -9
  305. package/package.json +74 -68
  306. package/script_helpers.d.ts +5 -3
  307. package/script_helpers.js +42 -12
  308. package/scripts.js +9 -4
  309. package/utils.d.ts +8 -9
  310. package/utils.js +42 -81
  311. package/components/AutosizedTextarea.svelte +0 -34
  312. package/components/AutosizedTextarea.svelte.d.ts +0 -19
  313. package/components/ProgressBar.svelte +0 -31
  314. package/components/ProgressBarPart.svelte +0 -20
  315. package/components/ProgressBarPart.svelte.d.ts +0 -20
  316. package/components/Switch.svelte +0 -61
  317. package/components/Switch.svelte.d.ts +0 -31
  318. package/components/flows/content/CopyFirstStepSchema.svelte +0 -13
  319. package/components/flows/content/CopyFirstStepSchema.svelte.d.ts +0 -14
  320. package/components/flows/content/FlowLoopWrapper.svelte +0 -9
  321. package/components/flows/content/FlowLoopWrapper.svelte.d.ts +0 -14
  322. package/components/flows/content/FlowModule.svelte +0 -217
  323. package/components/flows/content/FlowModule.svelte.d.ts +0 -29
  324. package/gen/schemas/$AuditLog.d.ts +0 -32
  325. package/gen/schemas/$AuditLog.js +0 -35
  326. package/gen/schemas/$CompletedJob.d.ts +0 -98
  327. package/gen/schemas/$CompletedJob.js +0 -103
  328. package/gen/schemas/$ContextualVariable.d.ts +0 -16
  329. package/gen/schemas/$ContextualVariable.js +0 -19
  330. package/gen/schemas/$CreateResource.d.ts +0 -22
  331. package/gen/schemas/$CreateResource.js +0 -25
  332. package/gen/schemas/$CreateVariable.d.ts +0 -26
  333. package/gen/schemas/$CreateVariable.js +0 -29
  334. package/gen/schemas/$CreateWorkspace.d.ts +0 -20
  335. package/gen/schemas/$CreateWorkspace.js +0 -23
  336. package/gen/schemas/$EditResource.d.ts +0 -13
  337. package/gen/schemas/$EditResource.js +0 -16
  338. package/gen/schemas/$EditResourceType.d.ts +0 -10
  339. package/gen/schemas/$EditResourceType.js +0 -13
  340. package/gen/schemas/$EditSchedule.d.ts +0 -20
  341. package/gen/schemas/$EditSchedule.js +0 -23
  342. package/gen/schemas/$EditVariable.d.ts +0 -16
  343. package/gen/schemas/$EditVariable.js +0 -19
  344. package/gen/schemas/$EditWorkspaceUser.d.ts +0 -7
  345. package/gen/schemas/$EditWorkspaceUser.js +0 -10
  346. package/gen/schemas/$Flow.d.ts +0 -23
  347. package/gen/schemas/$Flow.js +0 -26
  348. package/gen/schemas/$FlowMetadata.d.ts +0 -31
  349. package/gen/schemas/$FlowMetadata.js +0 -34
  350. package/gen/schemas/$FlowPreview.d.ts +0 -80
  351. package/gen/schemas/$FlowPreview.js +0 -83
  352. package/gen/schemas/$GlobalUserInfo.d.ts +0 -26
  353. package/gen/schemas/$GlobalUserInfo.js +0 -29
  354. package/gen/schemas/$Group.d.ts +0 -23
  355. package/gen/schemas/$Group.js +0 -26
  356. package/gen/schemas/$Job.d.ts +0 -17
  357. package/gen/schemas/$Job.js +0 -20
  358. package/gen/schemas/$ListableVariable.d.ts +0 -35
  359. package/gen/schemas/$ListableVariable.js +0 -38
  360. package/gen/schemas/$Login.d.ts +0 -12
  361. package/gen/schemas/$Login.js +0 -15
  362. package/gen/schemas/$MainArgSignature.d.ts +0 -50
  363. package/gen/schemas/$MainArgSignature.js +0 -53
  364. package/gen/schemas/$NewSchedule.d.ts +0 -30
  365. package/gen/schemas/$NewSchedule.js +0 -33
  366. package/gen/schemas/$NewToken.d.ts +0 -11
  367. package/gen/schemas/$NewToken.js +0 -14
  368. package/gen/schemas/$NewUser.d.ts +0 -16
  369. package/gen/schemas/$NewUser.js +0 -19
  370. package/gen/schemas/$Preview.d.ts +0 -19
  371. package/gen/schemas/$Preview.js +0 -22
  372. package/gen/schemas/$QueuedJob.d.ts +0 -139
  373. package/gen/schemas/$QueuedJob.js +0 -144
  374. package/gen/schemas/$Resource.d.ts +0 -31
  375. package/gen/schemas/$Resource.js +0 -34
  376. package/gen/schemas/$ResourceType.d.ts +0 -17
  377. package/gen/schemas/$ResourceType.js +0 -20
  378. package/gen/schemas/$Schedule.d.ts +0 -47
  379. package/gen/schemas/$Schedule.js +0 -50
  380. package/gen/schemas/$Script.d.ts +0 -77
  381. package/gen/schemas/$Script.js +0 -80
  382. package/gen/schemas/$ScriptArgs.d.ts +0 -6
  383. package/gen/schemas/$ScriptArgs.js +0 -9
  384. package/gen/schemas/$SlackToken.d.ts +0 -24
  385. package/gen/schemas/$SlackToken.js +0 -27
  386. package/gen/schemas/$TokenResponse.d.ts +0 -23
  387. package/gen/schemas/$TokenResponse.js +0 -26
  388. package/gen/schemas/$TruncatedToken.d.ts +0 -25
  389. package/gen/schemas/$TruncatedToken.js +0 -28
  390. package/gen/schemas/$Usage.d.ts +0 -13
  391. package/gen/schemas/$Usage.js +0 -16
  392. package/gen/schemas/$User.d.ts +0 -42
  393. package/gen/schemas/$User.js +0 -45
  394. package/gen/schemas/$UserWorkspaceList.d.ts +0 -28
  395. package/gen/schemas/$UserWorkspaceList.js +0 -31
  396. package/gen/schemas/$WorkerPing.d.ts +0 -31
  397. package/gen/schemas/$WorkerPing.js +0 -34
  398. package/gen/schemas/$Workspace.d.ts +0 -19
  399. package/gen/schemas/$Workspace.js +0 -22
  400. package/gen/schemas/$WorkspaceInvite.d.ts +0 -16
  401. package/gen/schemas/$WorkspaceInvite.js +0 -19
@@ -7,85 +7,116 @@ import Required from '../../Required.svelte';
7
7
  import FlowCard from '../common/FlowCard.svelte';
8
8
  import FlowSchedules from './FlowSchedules.svelte';
9
9
  import SvelteMarkdown from 'svelte-markdown';
10
- import { Toggle } from 'flowbite-svelte';
10
+ import Toggle from '../../Toggle.svelte';
11
+ import { Alert } from '../../common';
12
+ import { FlowGraph } from '../../graph';
13
+ import { Pane, Splitpanes } from 'svelte-splitpanes';
11
14
  export let initialPath;
12
15
  export let defaultTab = 'metadata';
13
16
  </script>
14
17
 
15
- <FlowCard title="Settings">
16
- <Tabs selected={defaultTab}>
17
- <Tab value="metadata">Metadata</Tab>
18
- <Tab value="schedule">Schedule</Tab>
19
- <Tab value="same-worker">Same Worker</Tab>
20
-
21
- <svelte:fragment slot="content">
22
- <TabContent value="metadata" class="p-4">
23
- <Path bind:path={$flowStore.path} {initialPath} namePlaceholder="my_flow" kind="flow">
24
- <div slot="ownerToolkit">
25
- Flow permissions depend on their path. Select the group <span class="font-mono"
26
- >all</span
27
- >
28
- to share your flow, and <span class="font-mono">user</span> to keep it private.
29
- <a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
18
+ <div class="h-full overflow-hidden">
19
+ <FlowCard title="Settings">
20
+ <div class="h-full flex-1">
21
+ <Splitpanes horizontal>
22
+ <Pane size={50} minSize={20}>
23
+ <div class="max-w-full w-full overflow-hidden h-full">
24
+ {#if $flowStore.value.modules}
25
+ <FlowGraph
26
+ modules={$flowStore.value.modules}
27
+ failureModule={$flowStore.value.failure_module}
28
+ />
29
+ {/if}
30
30
  </div>
31
- </Path>
31
+ </Pane>
32
+ <Pane size={50} minSize={20}>
33
+ <Tabs selected={defaultTab}>
34
+ <Tab value="metadata">Metadata</Tab>
35
+ <Tab value="schedule">Schedule</Tab>
36
+ <Tab value="same-worker">Same Worker</Tab>
32
37
 
33
- <label class="block my-4">
34
- <span class="text-gray-700">Summary <Required required={false} /></span>
35
- <textarea
36
- bind:value={$flowStore.summary}
37
- class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
38
- placeholder="A very short summary of the flow displayed when the flow is listed"
39
- rows="1"
40
- id="flow-summary"
41
- />
42
- </label>
38
+ <svelte:fragment slot="content">
39
+ <TabContent value="metadata" class="p-4">
40
+ <Path
41
+ bind:path={$flowStore.path}
42
+ {initialPath}
43
+ namePlaceholder="my_flow"
44
+ kind="flow"
45
+ />
43
46
 
44
- <label class="block my-4" for="inp">
45
- <span class="text-gray-700"
46
- >Description<Required required={false} detail="accept markdown formatting" />
47
- <textarea
48
- id="inp"
49
- bind:value={$flowStore.description}
50
- class="
51
- mt-1
52
- block
53
- w-full
54
- rounded-md
55
- border-gray-300
56
- shadow-sm
57
- focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
58
- "
59
- placeholder="A description to help users understand what this script does and how to use it."
60
- rows="3"
61
- />
62
- </span>
63
- </label>
47
+ <label class="block my-4">
48
+ <span class="text-gray-700 text-sm">Summary <Required required={false} /></span>
49
+ <input
50
+ type="text"
51
+ bind:value={$flowStore.summary}
52
+ placeholder="A very short summary of the flow displayed when the flow is listed"
53
+ rows="1"
54
+ id="flow-summary"
55
+ />
56
+ </label>
64
57
 
65
- <div>
66
- <h3 class="text-gray-700 ">Description rendered</h3>
67
- <div
68
- class="prose mt-5 text-xs shadow-inner shadow-blue p-4 overflow-auto"
69
- style="max-height: 200px;"
70
- >
71
- <SvelteMarkdown source={$flowStore.description ?? ''} />
72
- </div>
73
- </div>
74
- </TabContent>
75
- <TabContent value="schedule" class="p-4">
76
- <FlowSchedules />
77
- </TabContent>
58
+ <label class="block my-4" for="inp">
59
+ <span class="text-gray-700 text-sm">
60
+ Description
61
+ <Required required={false} detail="markdown" />
62
+ <textarea
63
+ type="text"
64
+ class="text-sm"
65
+ id="inp"
66
+ bind:value={$flowStore.description}
67
+ placeholder="A description to help users understand what this flow does and how to use it. Markdown accepted."
68
+ rows="3"
69
+ />
70
+ </span>
71
+ </label>
78
72
 
79
- <TabContent value="same-worker" class="p-4">
80
- <span class="my-2 text-sm font-bold">Same Worker</span>
73
+ <div>
74
+ <div class="font-bold pb-1 mt-4">Description preview</div>
75
+ {#if $flowStore.description}
76
+ <div
77
+ class="prose max-h-48 mt-5 text-xs shadow-inner shadow-blue p-4 overflow-auto"
78
+ >
79
+ <SvelteMarkdown source={$flowStore.description} />
80
+ </div>
81
+ {:else}
82
+ <div class="text-sm text-gray-500">
83
+ Enter a description to see the preview
84
+ </div>
85
+ {/if}
86
+ </div>
87
+ </TabContent>
88
+ <TabContent value="schedule" class="p-4">
89
+ <Alert type="info" title="Primary Schedule">
90
+ Flows can be triggered by any schedules, their webhooks or their UI but they only
91
+ have only one primary schedules with which they share the same path. The primary
92
+ schedule can be set here.
93
+ </Alert>
94
+ <div class="mt-4" />
95
+ <FlowSchedules />
96
+ </TabContent>
81
97
 
82
- <Toggle
83
- bind:checked={$flowStore.value.same_worker}
84
- options={{
85
- right: 'Same Worker'
86
- }}
87
- />
88
- </TabContent>
89
- </svelte:fragment>
90
- </Tabs>
91
- </FlowCard>
98
+ <TabContent value="same-worker" class="p-4 flex flex-col">
99
+ <Alert
100
+ type="info"
101
+ title="Toggle Same Worker to have all steps be ran on the same worker"
102
+ >
103
+ Steps will be run one after the other on the same worker, and will share a folder
104
+ at `/shared` in which they can store heavier data and pass them to the next step. <br
105
+ /><br />Beware that the `/shared` folder is not preserved across suspends and
106
+ sleeps.
107
+ </Alert>
108
+ <span class="my-2 text-sm font-bold">Same Worker</span>
109
+ <Toggle
110
+ bind:checked={$flowStore.value.same_worker}
111
+ options={{
112
+ right: 'Same Worker'
113
+ }}
114
+ />
115
+ </TabContent>
116
+ </svelte:fragment>
117
+ </Tabs>
118
+ </Pane>
119
+ </Splitpanes>
120
+ </div>
121
+ </FlowCard>
122
+ </div>
@@ -1,15 +1,15 @@
1
1
  import type { Schema } from '../../common';
2
- import type { Flow, FlowModule } from '../../gen';
2
+ import type { Flow } from '../../gen';
3
3
  export declare type FlowModuleState = {
4
4
  schema: Schema;
5
- childFlowModules?: FlowModuleState[];
6
- previewArgs?: any;
7
5
  previewResult?: any;
6
+ previewArgs?: any;
8
7
  };
9
- export declare type FlowState = {
10
- modules: FlowModuleState[];
11
- failureModule: FlowModuleState;
12
- };
8
+ export declare type FlowState = Record<string, FlowModuleState>;
9
+ /**
10
+ * flowStateStore represents the local state of each module indexed by its id.
11
+ * It contains data loaded that are not contained in a Flow object i.e. schemas.
12
+ * We also hold the data of the results of a test job, ran by the user.
13
+ */
13
14
  export declare const flowStateStore: import("svelte/store").Writable<FlowState>;
14
15
  export declare function initFlowState(flow: Flow): Promise<void>;
15
- export declare function mapFlowModules(flowModules: FlowModule[]): Promise<FlowModuleState[]>;
@@ -1,31 +1,46 @@
1
1
  import { writable } from 'svelte/store';
2
- import { emptyFlowModuleState, isEmptyFlowModule, loadFlowModuleSchema } from './flowStateUtils';
3
- export const flowStateStore = writable({ modules: [], failureModule: emptyFlowModuleState() });
2
+ import { loadFlowModuleState } from './flowStateUtils';
3
+ import { emptyFlowModuleState, isEmptyFlowModule } from './utils';
4
+ /**
5
+ * flowStateStore represents the local state of each module indexed by its id.
6
+ * It contains data loaded that are not contained in a Flow object i.e. schemas.
7
+ * We also hold the data of the results of a test job, ran by the user.
8
+ */
9
+ export const flowStateStore = writable({});
4
10
  export async function initFlowState(flow) {
5
- const modules = await mapFlowModules(flow.value.modules);
11
+ const modulesState = {};
12
+ await mapFlowModules(flow.value.modules, modulesState);
6
13
  const failureModule = flow.value.failure_module
7
- ? await mapFlowModule(flow.value.failure_module)
14
+ ? await loadFlowModuleState(flow.value.failure_module)
8
15
  : emptyFlowModuleState();
9
16
  flowStateStore.set({
10
- modules,
11
- failureModule
17
+ ...modulesState,
18
+ failure: failureModule
12
19
  });
13
20
  }
14
- async function mapFlowModule(flowModule) {
21
+ /**
22
+ * mapFlowModule recursively explore the flow, following deeply nested loop and branches modules
23
+ * to build the initial state.
24
+ */
25
+ async function mapFlowModule(flowModule, modulesState) {
15
26
  const value = flowModule.value;
16
27
  if (value.type === 'forloopflow') {
17
- const childFlowModules = await Promise.all(value.modules.map(async (module) => loadFlowModuleSchema(module)));
18
- const loopFlowModule = await loadFlowModuleSchema(flowModule);
19
- return {
20
- ...loopFlowModule,
21
- childFlowModules
22
- };
28
+ await mapFlowModules(value.modules, modulesState);
29
+ }
30
+ if (value.type === 'branchone') {
31
+ await mapFlowModules(value.default, modulesState);
32
+ }
33
+ if (value.type === 'branchone' || value.type === 'branchall') {
34
+ await Promise.all(value.branches.map((branchModule) => mapFlowModules(branchModule.modules, modulesState)));
23
35
  }
24
36
  if (isEmptyFlowModule(flowModule)) {
25
- return emptyFlowModuleState();
37
+ modulesState[flowModule.id] = emptyFlowModuleState();
38
+ }
39
+ else {
40
+ const flowModuleState = await loadFlowModuleState(flowModule);
41
+ modulesState[flowModule.id] = flowModuleState;
26
42
  }
27
- return loadFlowModuleSchema(flowModule);
28
43
  }
29
- export async function mapFlowModules(flowModules) {
30
- return Promise.all(flowModules.map(async (flowModule) => mapFlowModule(flowModule)));
44
+ async function mapFlowModules(flowModules, modulesState) {
45
+ await Promise.all(flowModules.map((flowModule) => mapFlowModule(flowModule, modulesState)));
31
46
  }
@@ -1,39 +1,22 @@
1
1
  import type { Schema } from '../../common';
2
- import { Job, Script, type FlowModule, type RawScript } from '../../gen';
3
- import { type FlowModuleState, type FlowState } from './flowState';
4
- export declare function emptyFlowModuleState(): FlowModuleState;
5
- export declare function loadFlowModuleSchema(flowModule: FlowModule): Promise<FlowModuleState>;
6
- export declare function pickScript(path: string): Promise<[FlowModule, FlowModuleState]>;
7
- export declare function createInlineScriptModule({ language, kind, subkind }: {
8
- language: RawScript.language;
9
- kind: Script.kind;
10
- subkind: 'pgsql' | 'flow';
11
- }): Promise<[FlowModule, FlowModuleState]>;
12
- export declare function createLoop(): Promise<[FlowModule, FlowModuleState]>;
13
- export declare function fork(flowModule: FlowModule): Promise<[FlowModule, FlowModuleState]>;
14
- export declare function createInlineScriptModuleFromPath(path: string): Promise<FlowModule>;
15
- export declare function createScriptFromInlineScript({ flowModule, suffix, schema }: {
16
- flowModule: FlowModule;
17
- suffix: string;
18
- schema: Schema;
19
- }): Promise<[FlowModule, FlowModuleState]>;
20
- export declare function isEmptyFlowModule(flowModule: FlowModule): boolean;
21
- declare type Result = any;
22
- declare type PickableProperties = {
23
- flow_input?: Object;
24
- previous_result: Result | undefined;
25
- step?: Result[];
26
- };
27
- declare type StepPropPicker = {
28
- pickableProperties: PickableProperties;
29
- extraLib: string;
30
- };
31
- export declare const NEVER_TESTED_THIS_FAR = "never tested this far";
32
- export declare function getStepPropPicker(indexes: number[], flowInputSchema: Schema, flowState: FlowState, args: Record<string, any>): StepPropPicker;
33
- export declare type JobResult = {
34
- job?: Job;
35
- innerJobs: JobResult[];
36
- loopJobs?: JobResult[];
37
- };
38
- export declare function mapJobResultsToFlowState(jobs: JobResult, upto: number): void;
39
- export {};
2
+ import { Script, type FlowModule, type PathScript, type RawScript } from '../../gen';
3
+ import { type FlowModuleState } from './flowState';
4
+ import { Mutex } from 'async-mutex';
5
+ export declare function loadFlowModuleState(flowModule: FlowModule): Promise<FlowModuleState>;
6
+ export declare const idMutex: Mutex;
7
+ export declare function nextId(): string;
8
+ export declare function pickScript(path: string, summary: string, id: string): Promise<[FlowModule & {
9
+ value: PathScript;
10
+ }, FlowModuleState]>;
11
+ export declare function createInlineScriptModule(language: RawScript.language, kind: Script.kind, subkind: 'pgsql' | 'flow', id: string): Promise<[FlowModule, FlowModuleState]>;
12
+ export declare function createLoop(id: string): Promise<[FlowModule, FlowModuleState]>;
13
+ export declare function createBranches(id: string): Promise<[FlowModule, FlowModuleState]>;
14
+ export declare function createBranchAll(id: string): Promise<[FlowModule, FlowModuleState]>;
15
+ export declare function fork(flowModule: FlowModule): Promise<[FlowModule & {
16
+ value: RawScript;
17
+ }, FlowModuleState]>;
18
+ export declare function emptyModule(): FlowModule;
19
+ export declare function createScriptFromInlineScript(flowModule: FlowModule, suffix: string, schema: Schema): Promise<[FlowModule & {
20
+ value: PathScript;
21
+ }, FlowModuleState]>;
22
+ export declare function deleteFlowStateById(id: string): void;
@@ -1,81 +1,123 @@
1
- import { Job, Script, ScriptService } from '../../gen';
1
+ import { Script, ScriptService } from '../../gen';
2
2
  import { initialCode } from '../../script_helpers';
3
3
  import { userStore, workspaceStore } from '../../stores';
4
- import { buildExtraLib, emptySchema, getScriptByPath, objectToTsType, schemaToObject, schemaToTsType } from '../../utils';
4
+ import { getScriptByPath } from '../../utils';
5
5
  import { get } from 'svelte/store';
6
6
  import { flowStateStore } from './flowState';
7
7
  import { flowStore } from './flowStore';
8
- import { loadSchemaFromModule } from './utils';
9
- export function emptyFlowModuleState() {
10
- return {
11
- schema: emptySchema()
12
- };
13
- }
14
- export async function loadFlowModuleSchema(flowModule) {
8
+ import { charsToNumber, emptyFlowModuleState, findNextAvailablePath, loadSchemaFromModule, NEVER_TESTED_THIS_FAR, numberToChars } from './utils';
9
+ import { Mutex } from 'async-mutex';
10
+ export async function loadFlowModuleState(flowModule) {
15
11
  try {
16
12
  const { input_transforms, schema } = await loadSchemaFromModule(flowModule);
17
- flowModule.input_transforms = input_transforms;
13
+ if (flowModule.value.type == 'script' || flowModule.value.type == 'rawscript') {
14
+ flowModule.value.input_transforms = input_transforms;
15
+ }
18
16
  return { schema, previewResult: NEVER_TESTED_THIS_FAR };
19
17
  }
20
18
  catch (e) {
21
- return { schema: emptySchema(), previewResult: NEVER_TESTED_THIS_FAR };
19
+ console.error(e);
20
+ return emptyFlowModuleState();
22
21
  }
23
22
  }
24
- export async function pickScript(path) {
23
+ export const idMutex = new Mutex();
24
+ // Computes the next available id
25
+ export function nextId() {
26
+ const flowState = get(flowStateStore);
27
+ const max = Object.keys(flowState)
28
+ .reduce((acc, key) => {
29
+ if (key === 'failure' || key.includes('branch') || key.includes('loop')) {
30
+ return acc;
31
+ }
32
+ else {
33
+ const num = charsToNumber(key);
34
+ return Math.max(acc, num + 1);
35
+ }
36
+ }, 0);
37
+ return numberToChars(max);
38
+ }
39
+ export async function pickScript(path, summary, id) {
25
40
  const flowModule = {
26
- value: { type: 'script', path },
27
- input_transforms: {}
41
+ id,
42
+ value: { type: 'script', path, input_transforms: {} },
43
+ summary
28
44
  };
29
- return [flowModule, await loadFlowModuleSchema(flowModule)];
45
+ return [flowModule, await loadFlowModuleState(flowModule)];
30
46
  }
31
- export async function createInlineScriptModule({ language, kind, subkind }) {
47
+ export async function createInlineScriptModule(language, kind, subkind, id) {
32
48
  const code = initialCode(language, kind, subkind);
33
49
  const flowModule = {
34
- value: { type: 'rawscript', content: code, language },
35
- input_transforms: {}
50
+ id,
51
+ value: { type: 'rawscript', content: code, language, input_transforms: {} }
36
52
  };
37
- return [flowModule, await loadFlowModuleSchema(flowModule)];
53
+ return [flowModule, await loadFlowModuleState(flowModule)];
38
54
  }
39
- export async function createLoop() {
55
+ export async function createLoop(id) {
40
56
  const loopFlowModule = {
57
+ id,
41
58
  value: {
42
59
  type: 'forloopflow',
43
60
  modules: [],
44
- iterator: { type: 'javascript', expr: 'previous_result' },
61
+ iterator: { type: 'javascript', expr: '' },
45
62
  skip_failures: true
63
+ }
64
+ };
65
+ const flowModuleState = await loadFlowModuleState(loopFlowModule);
66
+ return [loopFlowModule, flowModuleState];
67
+ }
68
+ export async function createBranches(id) {
69
+ const branchesFlowModules = {
70
+ id,
71
+ value: {
72
+ type: 'branchone',
73
+ branches: [],
74
+ default: []
46
75
  },
47
- input_transforms: {}
76
+ summary: ''
48
77
  };
49
- const { schema } = await loadFlowModuleSchema(loopFlowModule);
50
- return [
51
- loopFlowModule,
52
- {
53
- schema,
54
- childFlowModules: [emptyFlowModuleState()],
55
- previewResult: NEVER_TESTED_THIS_FAR
56
- }
57
- ];
78
+ const flowModuleState = await loadFlowModuleState(branchesFlowModules);
79
+ return [branchesFlowModules, flowModuleState];
80
+ }
81
+ export async function createBranchAll(id) {
82
+ const branchesFlowModules = {
83
+ id,
84
+ value: {
85
+ type: 'branchall',
86
+ branches: []
87
+ },
88
+ summary: ''
89
+ };
90
+ const flowModuleState = await loadFlowModuleState(branchesFlowModules);
91
+ return [branchesFlowModules, flowModuleState];
58
92
  }
59
93
  export async function fork(flowModule) {
60
94
  if (flowModule.value.type !== 'script') {
61
95
  throw new Error('Can only fork a script module');
62
96
  }
63
- const fm = await createInlineScriptModuleFromPath(flowModule.value.path ?? '');
64
- return [fm, await loadFlowModuleSchema(fm)];
97
+ const forkedFlowModule = await createInlineScriptModuleFromPath(flowModule.value.path ?? '', flowModule.id);
98
+ const flowModuleState = await loadFlowModuleState(forkedFlowModule);
99
+ return [forkedFlowModule, flowModuleState];
65
100
  }
66
- export async function createInlineScriptModuleFromPath(path) {
101
+ async function createInlineScriptModuleFromPath(path, id) {
67
102
  const { content, language } = await getScriptByPath(path);
68
103
  return {
104
+ id,
69
105
  value: {
70
106
  type: 'rawscript',
71
107
  language: language,
72
108
  content: content,
73
- path
74
- },
75
- input_transforms: {}
109
+ path,
110
+ input_transforms: {}
111
+ }
112
+ };
113
+ }
114
+ export function emptyModule() {
115
+ return {
116
+ id: nextId(),
117
+ value: { type: 'identity' }
76
118
  };
77
119
  }
78
- export async function createScriptFromInlineScript({ flowModule, suffix, schema }) {
120
+ export async function createScriptFromInlineScript(flowModule, suffix, schema) {
79
121
  const flow = get(flowStore);
80
122
  const user = get(userStore);
81
123
  if (flowModule.value.type != 'rawscript') {
@@ -95,7 +137,7 @@ export async function createScriptFromInlineScript({ flowModule, suffix, schema
95
137
  workspace: get(workspaceStore),
96
138
  requestBody: {
97
139
  path: availablePath,
98
- summary: '',
140
+ summary: flowModule.summary ?? '',
99
141
  description,
100
142
  content: flowModule.value.content,
101
143
  parent_hash: undefined,
@@ -104,125 +146,11 @@ export async function createScriptFromInlineScript({ flowModule, suffix, schema
104
146
  language: flowModule.value.language
105
147
  }
106
148
  });
107
- return pickScript(availablePath);
149
+ return pickScript(availablePath, flowModule.summary ?? '', flowModule.id);
108
150
  }
109
- async function findNextAvailablePath(path) {
110
- try {
111
- await ScriptService.getScriptByPath({
112
- workspace: get(workspaceStore),
113
- path
114
- });
115
- const [_, version] = path.split(/.*_([0-9]*)/);
116
- if (version.length > 0) {
117
- path = path.slice(0, -(version.length + 1));
118
- }
119
- path = `${path}_${Number(version) + 1}`;
120
- return findNextAvailablePath(path);
121
- }
122
- catch (e) {
123
- // Catching an error means the path is available
124
- return path;
125
- }
126
- }
127
- export function isEmptyFlowModule(flowModule) {
128
- return flowModule.value.type === 'script' && flowModule.value.path === '';
129
- }
130
- export const NEVER_TESTED_THIS_FAR = 'never tested this far';
131
- export function getStepPropPicker(indexes, flowInputSchema, flowState, args) {
132
- const [parentIndex, childIndex] = indexes;
133
- const isInsideLoop = childIndex !== undefined;
134
- const flowInput = schemaToObject(flowInputSchema, args);
135
- const results = getPreviousResults(flowState.modules, parentIndex);
136
- const lastResult = parentIndex == 0
137
- ? flowInput
138
- : results.length > 0
139
- ? results[results.length - 1]
140
- : NEVER_TESTED_THIS_FAR;
141
- if (isInsideLoop) {
142
- let forLoopFlowInput = {
143
- ...flowInput,
144
- iter: {
145
- value: "Iteration's value",
146
- index: "Iteration's index"
147
- }
148
- };
149
- if (flowState.modules[parentIndex]?.previewArgs) {
150
- forLoopFlowInput = flowState.modules[parentIndex]?.previewArgs;
151
- }
152
- const innerResults = getPreviousResults(flowState.modules[parentIndex]?.childFlowModules, childIndex);
153
- const innerLastResult = childIndex == 0
154
- ? forLoopFlowInput
155
- : innerResults.length > 0
156
- ? innerResults[innerResults.length - 1]
157
- : NEVER_TESTED_THIS_FAR;
158
- const extraLib = buildExtraLib(objectToTsType(forLoopFlowInput), objectToTsType(innerLastResult));
159
- return {
160
- extraLib,
161
- pickableProperties: {
162
- flow_input: forLoopFlowInput,
163
- previous_result: innerLastResult,
164
- step: innerResults
165
- }
166
- };
167
- }
168
- else {
169
- const extraLib = buildExtraLib(schemaToTsType(flowInputSchema), objectToTsType(lastResult));
170
- return {
171
- extraLib,
172
- pickableProperties: {
173
- flow_input: flowInput,
174
- previous_result: lastResult,
175
- step: results
176
- }
177
- };
178
- }
179
- }
180
- function getPreviousResults(flowModuleSchemas, target) {
181
- if (!Array.isArray(flowModuleSchemas) || target < 1) {
182
- return [];
183
- }
184
- const results = extractPreviewResults(flowModuleSchemas);
185
- return results.splice(0, target);
186
- }
187
- function extractPreviewResults(flowModuleSchemas) {
188
- return flowModuleSchemas.map((fms) => fms.previewResult);
189
- }
190
- function getResult(job) {
191
- if (job && 'result' in job) {
192
- return job.result;
193
- }
194
- }
195
- export function mapJobResultsToFlowState(jobs, upto) {
196
- const results = jobs.innerJobs.map(({ job, loopJobs }) => {
197
- if (loopJobs && loopJobs.length > 0) {
198
- return [
199
- job?.args,
200
- loopJobs.map(({ job }) => {
201
- return getResult(job);
202
- })
203
- ];
204
- }
205
- else {
206
- return [job?.args, getResult(job)];
207
- }
208
- });
209
- const old = get(flowStateStore);
210
- const modules = old.modules.map((flowModuleState, index) => {
211
- if (results[index] && index <= upto) {
212
- if (results[index][1] != NEVER_TESTED_THIS_FAR ||
213
- flowModuleState.previewResult == undefined) {
214
- flowModuleState.previewArgs = results[index][0];
215
- flowModuleState.previewResult = results[index][1];
216
- flowModuleState.childFlowModules?.map((innerMod, j) => {
217
- const lastLoopJob = jobs.innerJobs[index].loopJobs?.length ?? 0;
218
- innerMod.previewResult = getResult(jobs.innerJobs[index].loopJobs?.[lastLoopJob - 1]?.innerJobs?.[j]?.job);
219
- });
220
- }
221
- }
222
- return flowModuleState;
223
- });
224
- flowStateStore.set({
225
- modules,
226
- failureModule: old.failureModule
151
+ export function deleteFlowStateById(id) {
152
+ flowStateStore.update((fss) => {
153
+ delete fss[id];
154
+ return fss;
227
155
  });
228
156
  }
@@ -1,5 +1,6 @@
1
- import type { Flow } from '../../gen';
1
+ import type { Flow, FlowModule } from '../../gen';
2
2
  export declare type FlowMode = 'push' | 'pull';
3
3
  export declare const flowStore: import("svelte/store").Writable<Flow>;
4
- export declare function initFlow(flow: Flow): void;
4
+ export declare function dfs(modules: FlowModule[]): string[];
5
+ export declare function initFlow(flow: Flow): Promise<void>;
5
6
  export declare function copyFirstStepSchema(): Promise<void>;