@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8

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 (323) hide show
  1. package/README.md +564 -2
  2. package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
  3. package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
  4. package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
  5. package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
  6. package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
  7. package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
  8. package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
  9. package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
  10. package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
  11. package/dist/DateTimeField-B1qR4ruo.js +51 -0
  12. package/dist/Disclosure-BNKij7-v.js +45 -0
  13. package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
  14. package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
  15. package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
  16. package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
  17. package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
  18. package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
  19. package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
  20. package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
  21. package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
  22. package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
  23. package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
  24. package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
  25. package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
  26. package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
  27. package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
  28. package/dist/FluidGridsMark-CE2blT7K.js +74 -0
  29. package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
  30. package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
  31. package/dist/HistoryPage-BSBISXoj.js +2835 -0
  32. package/dist/Icon-BtQ0HXLh.js +160 -0
  33. package/dist/InsightsPage-D7ybj8N9.js +11245 -0
  34. package/dist/IsolationSetting-vy911E8b.js +1153 -0
  35. package/dist/LibraryParts-DOeNgR8A.js +413 -0
  36. package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
  37. package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
  38. package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
  39. package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
  40. package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
  41. package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
  42. package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
  43. package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
  44. package/dist/NodesPage-O7KeeKtd.js +653 -0
  45. package/dist/OfflineIcon-TwMKYWjA.js +207 -0
  46. package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
  47. package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
  48. package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
  49. package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
  50. package/dist/RunActionsMenu-DodOgIQm.js +59 -0
  51. package/dist/RunnerStatusPill-C1v967iq.js +24 -0
  52. package/dist/RunnersPage-dB0RSdY_.js +1929 -0
  53. package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
  54. package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
  55. package/dist/SearchBox-BGtYjvfs.js +49 -0
  56. package/dist/SequenceEditor-CFiHeHkR.js +497 -0
  57. package/dist/SettingsPage-0CQBNPZV.js +8695 -0
  58. package/dist/StewardPages-DAJhepen.js +47 -0
  59. package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
  60. package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
  61. package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
  62. package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
  63. package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
  64. package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
  65. package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
  66. package/dist/TemplatePreview-cx7-NOeG.js +868 -0
  67. package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
  68. package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
  69. package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
  70. package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
  71. package/dist/TranslationBridge-Da-TPgQm.js +68 -0
  72. package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
  73. package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
  74. package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
  75. package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
  76. package/dist/VariablesPage-ChfGuW22.js +2243 -0
  77. package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
  78. package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
  79. package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
  80. package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
  81. package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
  82. package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
  83. package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
  84. package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
  85. package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
  86. package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
  87. package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
  88. package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
  89. package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
  90. package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
  91. package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
  92. package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
  93. package/dist/WorkflowsList--hR2_8gf.js +4593 -0
  94. package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
  95. package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
  96. package/dist/addonCatalog-CbZS4deh.js +58 -0
  97. package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
  98. package/dist/addons.d.ts +3 -0
  99. package/dist/addons.js +4 -0
  100. package/dist/agent-form-Bfvm32j1.js +83 -0
  101. package/dist/agent-tools.d.ts +3 -0
  102. package/dist/agent-tools.js +5 -0
  103. package/dist/agentTools-CyL7DLOF.js +320 -0
  104. package/dist/ai-usage-BrxDgvdR.js +240 -0
  105. package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
  106. package/dist/api-BKq-nIOZ.js +2286 -0
  107. package/dist/api-Ol7I8NxE.js +8289 -0
  108. package/dist/apollo-type-policies.d.ts +11 -0
  109. package/dist/apollo-type-policies.js +64 -0
  110. package/dist/askAboutBridge-ByYsQams.js +106 -0
  111. package/dist/askQuestions-Cmx7VnMm.js +742 -0
  112. package/dist/assert-rules-lfYEMc99.js +318 -0
  113. package/dist/assistant.d.ts +94 -0
  114. package/dist/assistant.js +99 -0
  115. package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
  116. package/dist/badge-CXfPhoMH.js +26 -0
  117. package/dist/basil.generated-BK-EHbwN.js +10 -0
  118. package/dist/browser-steps-DMpS5TyB.js +533 -0
  119. package/dist/builderTimings-pvGnK1m-.js +510 -0
  120. package/dist/button-DG7y_FVJ.js +48 -0
  121. package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
  122. package/dist/card-Bomy_1UG.js +44 -0
  123. package/dist/catalogGrid-BOrfMgi-.js +41 -0
  124. package/dist/channel-CPyQ1NR1.js +212 -0
  125. package/dist/chips-CvNrYJZa.js +27 -0
  126. package/dist/client-holder-C0M5Cfwl.js +68 -0
  127. package/dist/cn-QqidFIgr.js +10 -0
  128. package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
  129. package/dist/code-editor-field-x_JrY8KR.js +113 -0
  130. package/dist/codec-client-DPuD6mw7.js +515 -0
  131. package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
  132. package/dist/config-DO68jw5k.js +322 -0
  133. package/dist/constants-DgbVc24O.d.ts +296 -0
  134. package/dist/constants-DlRnHBfQ.js +217 -0
  135. package/dist/convert-browser-action-pfecelF7.js +347 -0
  136. package/dist/convert-dialog-B_o22NiJ.js +382 -0
  137. package/dist/create-workflow-first-Azg3JUdX.js +120 -0
  138. package/dist/definition-canvas-Bsda-rDT.js +31 -0
  139. package/dist/dialog-BVd152GS.js +94 -0
  140. package/dist/durable-nodes-BXyYCLxT.js +91 -0
  141. package/dist/duration-CDb7-mT_.js +33 -0
  142. package/dist/edge-mapper-wEAdGVU2.js +4477 -0
  143. package/dist/element-library-DkSlg_VE.js +727 -0
  144. package/dist/entities-I_0kio3q.js +38 -0
  145. package/dist/error-advice-QLr5NCm7.js +65 -0
  146. package/dist/errors-ClKb5sEt.js +188 -0
  147. package/dist/executions.d.ts +3 -0
  148. package/dist/executions.js +5 -0
  149. package/dist/feature-flags-B2qetXKd.js +385 -0
  150. package/dist/field-label-DPZRmE_B.js +153 -0
  151. package/dist/firstWorkflow-C_h0KMB2.js +133 -0
  152. package/dist/flags.d.ts +3 -0
  153. package/dist/flags.js +4 -0
  154. package/dist/flow-builder-DIvLOhz0.js +28038 -0
  155. package/dist/flow-store-holder-CUN7Terz.js +52 -0
  156. package/dist/fluent.generated-CA_e6-4l.js +14 -0
  157. package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
  158. package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
  159. package/dist/global-client-BQPuFrFa.js +433 -0
  160. package/dist/global-operations-BG6YgxrM.js +136 -0
  161. package/dist/graphql-types-UTYtujY9.js +21358 -0
  162. package/dist/history.d.ts +3 -0
  163. package/dist/history.js +4 -0
  164. package/dist/index-AoJAa5vU.d.ts +164958 -0
  165. package/dist/index-DEMT3iAM.d.ts +120 -0
  166. package/dist/index-ROZzNGyY.d.ts +76 -0
  167. package/dist/index.d.ts +20 -0
  168. package/dist/index.js +8123 -0
  169. package/dist/ion.generated-mbajjcAg.js +10 -0
  170. package/dist/label-Lzb8ZXf_.js +29 -0
  171. package/dist/labels-rXd9gYQz.js +1236 -0
  172. package/dist/liveCanvas-D5ytXDp8.js +103 -0
  173. package/dist/logos.generated-X6_0kjVR.js +21 -0
  174. package/dist/logs-panel-Cw0DkG0l.js +468 -0
  175. package/dist/lucide.generated-B6NVd3GT.js +29 -0
  176. package/dist/marksStore-a9oIMMot.js +175 -0
  177. package/dist/mcp-trigger-D0nRdvq5.js +307 -0
  178. package/dist/mdi.generated-D1BV74d6.js +292 -0
  179. package/dist/menus-CU3hDGYl.js +160 -0
  180. package/dist/mynaui.generated-DMWr5cXz.js +66 -0
  181. package/dist/navigation-v2.d.ts +3 -0
  182. package/dist/navigation-v2.js +5 -0
  183. package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
  184. package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
  185. package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
  186. package/dist/node-registry-refresh-s3okf83X.js +27 -0
  187. package/dist/node-role-TMbnkmeP.js +132 -0
  188. package/dist/node-type-icon-BZa8n4iG.js +33 -0
  189. package/dist/nodes.d.ts +3 -0
  190. package/dist/nodes.js +4 -0
  191. package/dist/notesKey-5EaREBGA.js +12 -0
  192. package/dist/observability.d.ts +3 -0
  193. package/dist/observability.js +5 -0
  194. package/dist/offset-pages-zghoClB3.js +55 -0
  195. package/dist/operations-BBmT9ToP.js +663 -0
  196. package/dist/operations-WxRJWeqO.js +3133 -0
  197. package/dist/output-files-Ba8bu5lv.js +196 -0
  198. package/dist/page-operation-DrWuhd6Y.js +129 -0
  199. package/dist/page-twins.d.ts +13 -0
  200. package/dist/page-twins.js +186 -0
  201. package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
  202. package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
  203. package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
  204. package/dist/panels-PfBBAToE.js +346 -0
  205. package/dist/parts-B7fBcw-B.js +346 -0
  206. package/dist/popover-Dms9Vz3j.js +3389 -0
  207. package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
  208. package/dist/proactive.d.ts +66 -0
  209. package/dist/proactive.js +237 -0
  210. package/dist/quick-config-panel-DFd77xho.js +451 -0
  211. package/dist/quota-DeA_CJ2e.js +175 -0
  212. package/dist/quota.d.ts +3 -0
  213. package/dist/quota.js +4 -0
  214. package/dist/read-only-context-Dt9N9SIG.js +18 -0
  215. package/dist/relative-time-Dxt8ZIIu.js +55 -0
  216. package/dist/results-CwK_yDxK.js +325 -0
  217. package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
  218. package/dist/route-data.d.ts +12 -0
  219. package/dist/route-data.js +69 -0
  220. package/dist/route-match-C-0_EnAt.d.ts +5 -0
  221. package/dist/route-match-DMkUICYV.js +41 -0
  222. package/dist/route-preload-C4DlGoCd.js +120 -0
  223. package/dist/run-display-UjLAoYqQ.js +81 -0
  224. package/dist/run-history-arGiHzGU.js +285 -0
  225. package/dist/run-list-links-DJn4Mf1T.js +98 -0
  226. package/dist/run-mode-USmM0-Uo.js +82 -0
  227. package/dist/run-parity-CWXqEJqM.js +144 -0
  228. package/dist/runsQuota-B6SyTbne.js +100 -0
  229. package/dist/runsQuota-DsniKiSg.d.ts +20 -0
  230. package/dist/safe-expression-Cw7-SCsm.js +1251 -0
  231. package/dist/save-status-store-C7nEYpfb.js +631 -0
  232. package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
  233. package/dist/schedule-rules-ggVKRkBH.js +358 -0
  234. package/dist/secrets-Re_wSiE3.js +153 -0
  235. package/dist/settings.d.ts +4 -0
  236. package/dist/settings.js +6 -0
  237. package/dist/shared-DAWGGMSM.js +177 -0
  238. package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
  239. package/dist/solar.generated-CGYuUQAC.js +10 -0
  240. package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
  241. package/dist/start-url-CT6Yz96K.js +24 -0
  242. package/dist/status-CessxGpm.js +55 -0
  243. package/dist/store-icon-OctYp5zP.js +155 -0
  244. package/dist/styles-WGmTnZ2n.js +26 -0
  245. package/dist/styles.css +139 -0
  246. package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
  247. package/dist/template-code-CzN6JWNV.js +191 -0
  248. package/dist/template-graph-DLF9dygU.js +20 -0
  249. package/dist/template-preview-DcIIKOOL.js +32 -0
  250. package/dist/template-price-CdUHZRMF.js +40 -0
  251. package/dist/templates.d.ts +3 -0
  252. package/dist/templates.js +5 -0
  253. package/dist/theme-provider-CntfC4_i.js +23 -0
  254. package/dist/transient-DgZfhDfN.js +57 -0
  255. package/dist/typed-calls-C5tO03wq.js +26 -0
  256. package/dist/ui-script-By74Guk3.js +1094 -0
  257. package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
  258. package/dist/ui-step-fix-8uM2_Hft.js +67 -0
  259. package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
  260. package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
  261. package/dist/ui-target-editor-D2JhB_lD.js +673 -0
  262. package/dist/uiMarkTools-CSznnO1i.js +1054 -0
  263. package/dist/upgradePrompt-BAFBKKW5.js +72 -0
  264. package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
  265. package/dist/use-browser-available-hj8wc3Kb.js +241 -0
  266. package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
  267. package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
  268. package/dist/use-mobile-BTqCUjzS.js +27 -0
  269. package/dist/use-sdk-query-C697xZVv.js +116 -0
  270. package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
  271. package/dist/useActionParam-B2tU2BlY.js +85 -0
  272. package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
  273. package/dist/useBrowserClients-3v95-gSh.js +103 -0
  274. package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
  275. package/dist/useConnections-DsgEJs05.js +439 -0
  276. package/dist/useDebouncedValue-BFekcv6n.js +18 -0
  277. package/dist/useDurableParity-8fnMZmBc.js +1787 -0
  278. package/dist/useEntityTags-D0spL6Ut.js +460 -0
  279. package/dist/useExecutions-2u5nGJJk.js +681 -0
  280. package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
  281. package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
  282. package/dist/useHumanRequests-zlYDp3l1.js +221 -0
  283. package/dist/useNavigationV2-C2WeqN7d.js +29 -0
  284. package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
  285. package/dist/useObservability-BRlQ0tOA.js +285 -0
  286. package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
  287. package/dist/useRunHistory-CXCMUPyf.js +2759 -0
  288. package/dist/useRunLive-D0JvVZT2.js +1060 -0
  289. package/dist/useRunnerList-Dbi59i1K.js +446 -0
  290. package/dist/useRunners-URUc5quU.js +173 -0
  291. package/dist/useRunsPage-DG656UCK.js +2709 -0
  292. package/dist/useVariables-BIelxcWr.js +463 -0
  293. package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
  294. package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
  295. package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
  296. package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
  297. package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
  298. package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
  299. package/dist/utils-fvBb5qOD.js +89 -0
  300. package/dist/webhook-deliveries-AvQujaZy.js +99 -0
  301. package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
  302. package/dist/workflow-builder.d.ts +3 -0
  303. package/dist/workflow-builder.js +8 -0
  304. package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
  305. package/dist/workflow-embed.d.ts +3 -0
  306. package/dist/workflow-embed.js +4 -0
  307. package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
  308. package/dist/workflow-host.d.ts +6 -0
  309. package/dist/workflow-host.js +11 -0
  310. package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
  311. package/dist/workflow-pages.d.ts +3 -0
  312. package/dist/workflow-pages.js +115 -0
  313. package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
  314. package/dist/workflow-preview.d.ts +65 -0
  315. package/dist/workflow-preview.js +4 -0
  316. package/dist/workflow-route.d.ts +33 -0
  317. package/dist/workflow-route.js +4 -0
  318. package/dist/workflow-save-state-D0l-DkLf.js +767 -0
  319. package/dist/workflow-transfer-CQnQC-ke.js +104 -0
  320. package/dist/workflowRouteData-BkfVOc-O.js +169 -0
  321. package/dist/workflows-list.d.ts +10 -0
  322. package/dist/workflows-list.js +5 -0
  323. package/package.json +320 -4
@@ -0,0 +1,1606 @@
1
+ "use client";
2
+ import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
3
+ import { r as getFluidGridsConfig } from "./config-DO68jw5k.js";
4
+ import { a as DashboardSummaryDocument, c as ImportWorkflowDocument, d as DeactivateWorkflowDefinitionDocument, f as ActivateWorkflowDefinitionDocument, i as WorkflowDefinitionsDocument, l as DuplicateWorkflowDocument, n as WorkflowRunsDocument, o as UpdateWorkflowDefinitionDocument, r as WorkflowRunDocument, s as RestoreWorkflowVersionDocument, t as WorkflowVersionsDocument, u as DeleteWorkflowDefinitionDocument } from "./WorkflowVersionsDocument-DRVOp8Uj.js";
5
+ import { t as WorkflowDefinitionDocument } from "./WorkflowDefinitionDocument-DZLbTPUZ.js";
6
+ import { n as CreateWorkflowVersionDocument, r as CreateWorkflowDefinitionDocument, t as TriggerWorkflowDocument } from "./TriggerWorkflowDocument-D9Km2Vv2.js";
7
+ import { s as throwIfResultError } from "./errors-ClKb5sEt.js";
8
+ import { a as readCachedPageOperation, s as takeFreshPreload } from "./page-operation-DrWuhd6Y.js";
9
+ import { t as readPagesUpTo } from "./offset-pages-zghoClB3.js";
10
+ import { d as emitOperationErrorEvent, u as emitFluidGridsEvent } from "./global-client-BQPuFrFa.js";
11
+ import { t as openRunQuotaUpgradePrompt } from "./upgradePrompt-BAFBKKW5.js";
12
+ import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
13
+ import { t as useFluidGridsAnalytics } from "./useFluidGridsAnalytics-VM8lAi2x.js";
14
+ import { a as emitRunStarted, c as emitWorkflowCreated, p as runTriggerFromMode, u as emitWorkflowPublished } from "./fluidgridsEvents-bbEQbwU6.js";
15
+ import { s as takePrefetchedWorkflowForBuilder } from "./workflowRouteData-BkfVOc-O.js";
16
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
17
+
18
+ // src/generated/documents/wspace/PreviewN8nImportDocument.ts
19
+ const PreviewN8nImportDocument = {
20
+ "kind": "Document",
21
+ "definitions": [{
22
+ "kind": "OperationDefinition",
23
+ "operation": "query",
24
+ "name": {
25
+ "kind": "Name",
26
+ "value": "PreviewN8nImport"
27
+ },
28
+ "variableDefinitions": [{
29
+ "kind": "VariableDefinition",
30
+ "variable": {
31
+ "kind": "Variable",
32
+ "name": {
33
+ "kind": "Name",
34
+ "value": "workflowJson"
35
+ }
36
+ },
37
+ "type": {
38
+ "kind": "NonNullType",
39
+ "type": {
40
+ "kind": "NamedType",
41
+ "name": {
42
+ "kind": "Name",
43
+ "value": "JSON"
44
+ }
45
+ }
46
+ },
47
+ "directives": []
48
+ }],
49
+ "directives": [],
50
+ "selectionSet": {
51
+ "kind": "SelectionSet",
52
+ "selections": [{
53
+ "kind": "Field",
54
+ "name": {
55
+ "kind": "Name",
56
+ "value": "previewN8nImport"
57
+ },
58
+ "arguments": [{
59
+ "kind": "Argument",
60
+ "name": {
61
+ "kind": "Name",
62
+ "value": "workflowJson"
63
+ },
64
+ "value": {
65
+ "kind": "Variable",
66
+ "name": {
67
+ "kind": "Name",
68
+ "value": "workflowJson"
69
+ }
70
+ }
71
+ }],
72
+ "directives": [],
73
+ "selectionSet": {
74
+ "kind": "SelectionSet",
75
+ "selections": [{
76
+ "kind": "Field",
77
+ "name": {
78
+ "kind": "Name",
79
+ "value": "name"
80
+ },
81
+ "arguments": [],
82
+ "directives": []
83
+ }, {
84
+ "kind": "Field",
85
+ "name": {
86
+ "kind": "Name",
87
+ "value": "report"
88
+ },
89
+ "arguments": [],
90
+ "directives": [],
91
+ "selectionSet": {
92
+ "kind": "SelectionSet",
93
+ "selections": [{
94
+ "kind": "FragmentSpread",
95
+ "name": {
96
+ "kind": "Name",
97
+ "value": "WorkflowN8nImportReportFields"
98
+ },
99
+ "directives": []
100
+ }]
101
+ }
102
+ }]
103
+ }
104
+ }]
105
+ }
106
+ }, {
107
+ "kind": "FragmentDefinition",
108
+ "name": {
109
+ "kind": "Name",
110
+ "value": "WorkflowN8nImportReportFields"
111
+ },
112
+ "variableDefinitions": [],
113
+ "typeCondition": {
114
+ "kind": "NamedType",
115
+ "name": {
116
+ "kind": "Name",
117
+ "value": "WorkflowN8nImportReport"
118
+ }
119
+ },
120
+ "directives": [],
121
+ "selectionSet": {
122
+ "kind": "SelectionSet",
123
+ "selections": [
124
+ {
125
+ "kind": "Field",
126
+ "name": {
127
+ "kind": "Name",
128
+ "value": "nodeCount"
129
+ },
130
+ "arguments": [],
131
+ "directives": []
132
+ },
133
+ {
134
+ "kind": "Field",
135
+ "name": {
136
+ "kind": "Name",
137
+ "value": "mappedNodes"
138
+ },
139
+ "arguments": [],
140
+ "directives": [],
141
+ "selectionSet": {
142
+ "kind": "SelectionSet",
143
+ "selections": [
144
+ {
145
+ "kind": "Field",
146
+ "name": {
147
+ "kind": "Name",
148
+ "value": "name"
149
+ },
150
+ "arguments": [],
151
+ "directives": []
152
+ },
153
+ {
154
+ "kind": "Field",
155
+ "name": {
156
+ "kind": "Name",
157
+ "value": "n8nType"
158
+ },
159
+ "arguments": [],
160
+ "directives": []
161
+ },
162
+ {
163
+ "kind": "Field",
164
+ "name": {
165
+ "kind": "Name",
166
+ "value": "nodeId"
167
+ },
168
+ "arguments": [],
169
+ "directives": []
170
+ },
171
+ {
172
+ "kind": "Field",
173
+ "name": {
174
+ "kind": "Name",
175
+ "value": "nodeType"
176
+ },
177
+ "arguments": [],
178
+ "directives": []
179
+ }
180
+ ]
181
+ }
182
+ },
183
+ {
184
+ "kind": "Field",
185
+ "name": {
186
+ "kind": "Name",
187
+ "value": "placeholders"
188
+ },
189
+ "arguments": [],
190
+ "directives": [],
191
+ "selectionSet": {
192
+ "kind": "SelectionSet",
193
+ "selections": [
194
+ {
195
+ "kind": "Field",
196
+ "name": {
197
+ "kind": "Name",
198
+ "value": "name"
199
+ },
200
+ "arguments": [],
201
+ "directives": []
202
+ },
203
+ {
204
+ "kind": "Field",
205
+ "name": {
206
+ "kind": "Name",
207
+ "value": "n8nType"
208
+ },
209
+ "arguments": [],
210
+ "directives": []
211
+ },
212
+ {
213
+ "kind": "Field",
214
+ "name": {
215
+ "kind": "Name",
216
+ "value": "nodeId"
217
+ },
218
+ "arguments": [],
219
+ "directives": []
220
+ },
221
+ {
222
+ "kind": "Field",
223
+ "name": {
224
+ "kind": "Name",
225
+ "value": "reason"
226
+ },
227
+ "arguments": [],
228
+ "directives": []
229
+ }
230
+ ]
231
+ }
232
+ },
233
+ {
234
+ "kind": "Field",
235
+ "name": {
236
+ "kind": "Name",
237
+ "value": "expressionIssues"
238
+ },
239
+ "arguments": [],
240
+ "directives": [],
241
+ "selectionSet": {
242
+ "kind": "SelectionSet",
243
+ "selections": [
244
+ {
245
+ "kind": "Field",
246
+ "name": {
247
+ "kind": "Name",
248
+ "value": "nodeName"
249
+ },
250
+ "arguments": [],
251
+ "directives": []
252
+ },
253
+ {
254
+ "kind": "Field",
255
+ "name": {
256
+ "kind": "Name",
257
+ "value": "expression"
258
+ },
259
+ "arguments": [],
260
+ "directives": []
261
+ },
262
+ {
263
+ "kind": "Field",
264
+ "name": {
265
+ "kind": "Name",
266
+ "value": "reason"
267
+ },
268
+ "arguments": [],
269
+ "directives": []
270
+ }
271
+ ]
272
+ }
273
+ },
274
+ {
275
+ "kind": "Field",
276
+ "name": {
277
+ "kind": "Name",
278
+ "value": "connectionsNeeded"
279
+ },
280
+ "arguments": [],
281
+ "directives": [],
282
+ "selectionSet": {
283
+ "kind": "SelectionSet",
284
+ "selections": [
285
+ {
286
+ "kind": "Field",
287
+ "name": {
288
+ "kind": "Name",
289
+ "value": "nodeName"
290
+ },
291
+ "arguments": [],
292
+ "directives": []
293
+ },
294
+ {
295
+ "kind": "Field",
296
+ "name": {
297
+ "kind": "Name",
298
+ "value": "nodeId"
299
+ },
300
+ "arguments": [],
301
+ "directives": []
302
+ },
303
+ {
304
+ "kind": "Field",
305
+ "name": {
306
+ "kind": "Name",
307
+ "value": "nodeType"
308
+ },
309
+ "arguments": [],
310
+ "directives": []
311
+ },
312
+ {
313
+ "kind": "Field",
314
+ "name": {
315
+ "kind": "Name",
316
+ "value": "provider"
317
+ },
318
+ "arguments": [],
319
+ "directives": []
320
+ },
321
+ {
322
+ "kind": "Field",
323
+ "name": {
324
+ "kind": "Name",
325
+ "value": "n8nCredentialType"
326
+ },
327
+ "arguments": [],
328
+ "directives": []
329
+ },
330
+ {
331
+ "kind": "Field",
332
+ "name": {
333
+ "kind": "Name",
334
+ "value": "n8nCredentialName"
335
+ },
336
+ "arguments": [],
337
+ "directives": []
338
+ }
339
+ ]
340
+ }
341
+ },
342
+ {
343
+ "kind": "Field",
344
+ "name": {
345
+ "kind": "Name",
346
+ "value": "warnings"
347
+ },
348
+ "arguments": [],
349
+ "directives": [],
350
+ "selectionSet": {
351
+ "kind": "SelectionSet",
352
+ "selections": [{
353
+ "kind": "Field",
354
+ "name": {
355
+ "kind": "Name",
356
+ "value": "nodeName"
357
+ },
358
+ "arguments": [],
359
+ "directives": []
360
+ }, {
361
+ "kind": "Field",
362
+ "name": {
363
+ "kind": "Name",
364
+ "value": "message"
365
+ },
366
+ "arguments": [],
367
+ "directives": []
368
+ }]
369
+ }
370
+ }
371
+ ]
372
+ }
373
+ }]
374
+ };
375
+
376
+ // src/generated/documents/wspace/WorkflowDefinitionForBuilderDocument.ts
377
+ const WorkflowDefinitionForBuilderDocument = {
378
+ "kind": "Document",
379
+ "definitions": [{
380
+ "kind": "OperationDefinition",
381
+ "operation": "query",
382
+ "name": {
383
+ "kind": "Name",
384
+ "value": "WorkflowDefinitionForBuilder"
385
+ },
386
+ "variableDefinitions": [
387
+ {
388
+ "kind": "VariableDefinition",
389
+ "variable": {
390
+ "kind": "Variable",
391
+ "name": {
392
+ "kind": "Name",
393
+ "value": "workflowKey"
394
+ }
395
+ },
396
+ "type": {
397
+ "kind": "NamedType",
398
+ "name": {
399
+ "kind": "Name",
400
+ "value": "String"
401
+ }
402
+ },
403
+ "directives": []
404
+ },
405
+ {
406
+ "kind": "VariableDefinition",
407
+ "variable": {
408
+ "kind": "Variable",
409
+ "name": {
410
+ "kind": "Name",
411
+ "value": "id"
412
+ }
413
+ },
414
+ "type": {
415
+ "kind": "NamedType",
416
+ "name": {
417
+ "kind": "Name",
418
+ "value": "ID"
419
+ }
420
+ },
421
+ "directives": []
422
+ },
423
+ {
424
+ "kind": "VariableDefinition",
425
+ "variable": {
426
+ "kind": "Variable",
427
+ "name": {
428
+ "kind": "Name",
429
+ "value": "version"
430
+ }
431
+ },
432
+ "type": {
433
+ "kind": "NamedType",
434
+ "name": {
435
+ "kind": "Name",
436
+ "value": "String"
437
+ }
438
+ },
439
+ "directives": []
440
+ }
441
+ ],
442
+ "directives": [],
443
+ "selectionSet": {
444
+ "kind": "SelectionSet",
445
+ "selections": [{
446
+ "kind": "Field",
447
+ "name": {
448
+ "kind": "Name",
449
+ "value": "workflowDefinition"
450
+ },
451
+ "arguments": [
452
+ {
453
+ "kind": "Argument",
454
+ "name": {
455
+ "kind": "Name",
456
+ "value": "workflowKey"
457
+ },
458
+ "value": {
459
+ "kind": "Variable",
460
+ "name": {
461
+ "kind": "Name",
462
+ "value": "workflowKey"
463
+ }
464
+ }
465
+ },
466
+ {
467
+ "kind": "Argument",
468
+ "name": {
469
+ "kind": "Name",
470
+ "value": "id"
471
+ },
472
+ "value": {
473
+ "kind": "Variable",
474
+ "name": {
475
+ "kind": "Name",
476
+ "value": "id"
477
+ }
478
+ }
479
+ },
480
+ {
481
+ "kind": "Argument",
482
+ "name": {
483
+ "kind": "Name",
484
+ "value": "version"
485
+ },
486
+ "value": {
487
+ "kind": "Variable",
488
+ "name": {
489
+ "kind": "Name",
490
+ "value": "version"
491
+ }
492
+ }
493
+ }
494
+ ],
495
+ "directives": [],
496
+ "selectionSet": {
497
+ "kind": "SelectionSet",
498
+ "selections": [
499
+ {
500
+ "kind": "Field",
501
+ "name": {
502
+ "kind": "Name",
503
+ "value": "id"
504
+ },
505
+ "arguments": [],
506
+ "directives": []
507
+ },
508
+ {
509
+ "kind": "Field",
510
+ "name": {
511
+ "kind": "Name",
512
+ "value": "workflowKey"
513
+ },
514
+ "arguments": [],
515
+ "directives": []
516
+ },
517
+ {
518
+ "kind": "Field",
519
+ "name": {
520
+ "kind": "Name",
521
+ "value": "version"
522
+ },
523
+ "arguments": [],
524
+ "directives": []
525
+ },
526
+ {
527
+ "kind": "Field",
528
+ "name": {
529
+ "kind": "Name",
530
+ "value": "name"
531
+ },
532
+ "arguments": [],
533
+ "directives": []
534
+ },
535
+ {
536
+ "kind": "Field",
537
+ "name": {
538
+ "kind": "Name",
539
+ "value": "description"
540
+ },
541
+ "arguments": [],
542
+ "directives": []
543
+ },
544
+ {
545
+ "kind": "Field",
546
+ "name": {
547
+ "kind": "Name",
548
+ "value": "status"
549
+ },
550
+ "arguments": [],
551
+ "directives": []
552
+ },
553
+ {
554
+ "kind": "Field",
555
+ "name": {
556
+ "kind": "Name",
557
+ "value": "definitionJson"
558
+ },
559
+ "arguments": [],
560
+ "directives": []
561
+ },
562
+ {
563
+ "kind": "Field",
564
+ "name": {
565
+ "kind": "Name",
566
+ "value": "pinnedNodeData"
567
+ },
568
+ "arguments": [],
569
+ "directives": []
570
+ },
571
+ {
572
+ "kind": "Field",
573
+ "name": {
574
+ "kind": "Name",
575
+ "value": "alias"
576
+ },
577
+ "arguments": [],
578
+ "directives": []
579
+ },
580
+ {
581
+ "kind": "Field",
582
+ "name": {
583
+ "kind": "Name",
584
+ "value": "icon"
585
+ },
586
+ "arguments": [],
587
+ "directives": []
588
+ },
589
+ {
590
+ "kind": "Field",
591
+ "name": {
592
+ "kind": "Name",
593
+ "value": "category"
594
+ },
595
+ "arguments": [],
596
+ "directives": []
597
+ },
598
+ {
599
+ "kind": "Field",
600
+ "name": {
601
+ "kind": "Name",
602
+ "value": "tags"
603
+ },
604
+ "arguments": [],
605
+ "directives": []
606
+ },
607
+ {
608
+ "kind": "Field",
609
+ "name": {
610
+ "kind": "Name",
611
+ "value": "context"
612
+ },
613
+ "arguments": [],
614
+ "directives": []
615
+ },
616
+ {
617
+ "kind": "Field",
618
+ "name": {
619
+ "kind": "Name",
620
+ "value": "projectId"
621
+ },
622
+ "arguments": [],
623
+ "directives": []
624
+ },
625
+ {
626
+ "kind": "Field",
627
+ "name": {
628
+ "kind": "Name",
629
+ "value": "tenantId"
630
+ },
631
+ "arguments": [],
632
+ "directives": []
633
+ },
634
+ {
635
+ "kind": "Field",
636
+ "name": {
637
+ "kind": "Name",
638
+ "value": "workspaceId"
639
+ },
640
+ "arguments": [],
641
+ "directives": []
642
+ },
643
+ {
644
+ "kind": "Field",
645
+ "name": {
646
+ "kind": "Name",
647
+ "value": "createdAt"
648
+ },
649
+ "arguments": [],
650
+ "directives": []
651
+ },
652
+ {
653
+ "kind": "Field",
654
+ "name": {
655
+ "kind": "Name",
656
+ "value": "updatedAt"
657
+ },
658
+ "arguments": [],
659
+ "directives": []
660
+ },
661
+ {
662
+ "kind": "Field",
663
+ "name": {
664
+ "kind": "Name",
665
+ "value": "createdById"
666
+ },
667
+ "arguments": [],
668
+ "directives": []
669
+ },
670
+ {
671
+ "kind": "Field",
672
+ "name": {
673
+ "kind": "Name",
674
+ "value": "revision"
675
+ },
676
+ "arguments": [],
677
+ "directives": []
678
+ },
679
+ {
680
+ "kind": "Field",
681
+ "name": {
682
+ "kind": "Name",
683
+ "value": "updatedById"
684
+ },
685
+ "arguments": [],
686
+ "directives": []
687
+ },
688
+ {
689
+ "kind": "Field",
690
+ "name": {
691
+ "kind": "Name",
692
+ "value": "nodeManifests"
693
+ },
694
+ "arguments": [],
695
+ "directives": []
696
+ }
697
+ ]
698
+ }
699
+ }]
700
+ }
701
+ }]
702
+ };
703
+
704
+ // src/hooks/useWorkflows.ts
705
+ const WORKFLOW_DEFINITIONS = WorkflowDefinitionsDocument;
706
+ const WORKFLOW_DEFINITION = WorkflowDefinitionDocument;
707
+ const WORKFLOW_VERSIONS = WorkflowVersionsDocument;
708
+ const CREATE_WORKFLOW_DEFINITION = CreateWorkflowDefinitionDocument;
709
+ const UPDATE_WORKFLOW_DEFINITION = UpdateWorkflowDefinitionDocument;
710
+ const CREATE_WORKFLOW_VERSION = CreateWorkflowVersionDocument;
711
+ const DELETE_WORKFLOW_DEFINITION = DeleteWorkflowDefinitionDocument;
712
+ const DUPLICATE_WORKFLOW = DuplicateWorkflowDocument;
713
+ const TRIGGER_WORKFLOW = TriggerWorkflowDocument;
714
+ const WORKFLOW_RUNS = WorkflowRunsDocument;
715
+ const WORKFLOW_RUN = WorkflowRunDocument;
716
+ const DASHBOARD_SUMMARY = DashboardSummaryDocument;
717
+ const RESTORE_WORKFLOW_VERSION = RestoreWorkflowVersionDocument;
718
+ const IMPORT_WORKFLOW = ImportWorkflowDocument;
719
+ /**
720
+ * Check if an error is Apollo's "Store reset while query was in flight" error (error 89)
721
+ * This happens when the shell's MultiGatewayProvider cleans up during re-renders
722
+ */
723
+ function isStoreResetError(err) {
724
+ if (err instanceof Error) return err.message.includes("message%22%3A89") || err.message.includes("Store reset while query was in flight");
725
+ return false;
726
+ }
727
+ /**
728
+ * The list input as the hook sends it: the caller's input with the host
729
+ * product's filter added. The route preload builds the same variables, so its
730
+ * answer is the one the page finds in the cache.
731
+ */
732
+ function withProductFilter(input, productId) {
733
+ return {
734
+ ...input,
735
+ customFilters: {
736
+ ...input.customFilters || {},
737
+ ...productId ? { productId } : {}
738
+ }
739
+ };
740
+ }
741
+ /** Appends `next` to `current`, skipping ids already listed (a row can shift pages). */
742
+ function appendWorkflowPage(current, next) {
743
+ const seen = new Set(current.map((w) => w.id));
744
+ return [...current, ...next.filter((w) => !seen.has(w.id))];
745
+ }
746
+ /**
747
+ * Hook to fetch list of workflow definitions
748
+ * Uses Apollo Client with the WORKFLOW_DEFINITIONS query
749
+ * Automatically filters by productId if configured
750
+ */
751
+ function useWorkflowDefinitions(input = {}, options = {}) {
752
+ const paginate = options.paginate === true;
753
+ const documentsRef = useRef(options.documents);
754
+ useEffect(() => {
755
+ documentsRef.current = options.documents;
756
+ });
757
+ const pageSentRef = useRef(false);
758
+ const listDocument = options.documents?.rows ?? WORKFLOW_DEFINITIONS;
759
+ const [workflows, setWorkflows] = useState([]);
760
+ const [total, setTotal] = useState(0);
761
+ const [hasMore, setHasMore] = useState(false);
762
+ const [loading, setLoading] = useState(true);
763
+ const [loadingMore, setLoadingMore] = useState(false);
764
+ const [error, setError] = useState(null);
765
+ const [loadMoreError, setLoadMoreError] = useState(null);
766
+ const [retryCount, setRetryCount] = useState(0);
767
+ const requestRef = useRef(0);
768
+ const pageInFlightRef = useRef(false);
769
+ const revalidatingRef = useRef(false);
770
+ const loadedRef = useRef({
771
+ inputKey: "",
772
+ count: 0
773
+ });
774
+ const inputWithProductFilter = withProductFilter(input, getFluidGridsConfig().productId);
775
+ const inputKey = JSON.stringify(inputWithProductFilter);
776
+ const fetchData = useCallback(async (isRetry = false) => {
777
+ const request = ++requestRef.current;
778
+ setLoading(true);
779
+ setError(null);
780
+ setLoadMoreError(null);
781
+ const variables = JSON.parse(inputKey);
782
+ if (paginate && loadedRef.current.inputKey !== inputKey) loadedRef.current = {
783
+ inputKey,
784
+ count: 0
785
+ };
786
+ try {
787
+ const client = getFluidGridsClient();
788
+ const toList = (data) => ({
789
+ items: data?.workflowDefinitions?.items ?? [],
790
+ total: data?.workflowDefinitions?.total ?? 0,
791
+ hasMore: data?.workflowDefinitions?.hasMore ?? false
792
+ });
793
+ const readList = async (input) => {
794
+ const result = await client.query({
795
+ query: listDocument,
796
+ variables: { input },
797
+ fetchPolicy: "network-only"
798
+ });
799
+ if (!result.data?.workflowDefinitions) throwIfResultError(result);
800
+ return toList(result.data);
801
+ };
802
+ const documents = documentsRef.current;
803
+ const readFirst = documents && !pageSentRef.current ? async (input) => {
804
+ pageSentRef.current = true;
805
+ const pageVariables = { input };
806
+ const cached = readCachedPageOperation(client, documents.page, pageVariables);
807
+ if (cached?.workflowDefinitions && request === requestRef.current) {
808
+ const list = toList(cached);
809
+ documentsRef.current?.onPageSettled?.(cached);
810
+ if (takeFreshPreload(documents.page, pageVariables)) return list;
811
+ setWorkflows(list.items);
812
+ setTotal(list.total);
813
+ setHasMore(list.hasMore);
814
+ setLoading(false);
815
+ revalidatingRef.current = true;
816
+ }
817
+ let page = null;
818
+ try {
819
+ const result = await client.query({
820
+ query: documents.page,
821
+ variables: pageVariables,
822
+ fetchPolicy: "network-only"
823
+ });
824
+ page = result.data?.workflowDefinitions ? result.data : null;
825
+ } catch (pageError) {
826
+ console.warn("[useWorkflowDefinitions] Page operation failed; reading the list alone:", pageError);
827
+ } finally {
828
+ revalidatingRef.current = false;
829
+ documentsRef.current?.onPageSettled?.(page ?? cached);
830
+ }
831
+ return page ? toList(page) : readList(input);
832
+ } : readList;
833
+ const pageSize = variables.limit ?? 100;
834
+ const list = paginate && loadedRef.current.count > pageSize ? await readPagesUpTo((offset, limit) => readList({
835
+ ...variables,
836
+ offset,
837
+ limit
838
+ }), {
839
+ offset: variables.offset ?? 0,
840
+ pageSize,
841
+ count: loadedRef.current.count,
842
+ keyOf: (workflow) => workflow.id
843
+ }) : await readFirst(variables);
844
+ if (request !== requestRef.current) return;
845
+ setWorkflows(list.items);
846
+ loadedRef.current = {
847
+ inputKey,
848
+ count: list.items.length
849
+ };
850
+ setTotal(list.total);
851
+ setHasMore(list.hasMore);
852
+ if (isRetry) setRetryCount(0);
853
+ } catch (err) {
854
+ if (request !== requestRef.current) return;
855
+ if (isStoreResetError(err)) {
856
+ console.warn("[useWorkflowDefinitions] Store reset error - will retry");
857
+ if (retryCount < 3) {
858
+ setRetryCount((prev) => prev + 1);
859
+ return;
860
+ }
861
+ console.warn("[useWorkflowDefinitions] Max retries reached");
862
+ }
863
+ console.error("[useWorkflowDefinitions] Error:", err);
864
+ setError(err);
865
+ } finally {
866
+ if (request === requestRef.current) setLoading(false);
867
+ }
868
+ }, [
869
+ inputKey,
870
+ retryCount,
871
+ paginate,
872
+ listDocument
873
+ ]);
874
+ const loadMore = useCallback(async () => {
875
+ if (!paginate || loading || loadingMore || !hasMore) return;
876
+ if (pageInFlightRef.current || revalidatingRef.current) return;
877
+ pageInFlightRef.current = true;
878
+ const listRequest = requestRef.current;
879
+ const isCurrent = () => listRequest === requestRef.current;
880
+ const variables = JSON.parse(inputKey);
881
+ variables.offset = (variables.offset ?? 0) + workflows.length;
882
+ setLoadingMore(true);
883
+ setLoadMoreError(null);
884
+ try {
885
+ const result = await getFluidGridsClient().query({
886
+ query: listDocument,
887
+ variables: { input: variables },
888
+ fetchPolicy: "network-only"
889
+ });
890
+ if (!result.data?.workflowDefinitions) throwIfResultError(result);
891
+ if (!isCurrent()) return;
892
+ const next = appendWorkflowPage(workflows, result.data?.workflowDefinitions?.items ?? []);
893
+ setWorkflows(next);
894
+ loadedRef.current = {
895
+ inputKey,
896
+ count: next.length
897
+ };
898
+ setTotal(result.data?.workflowDefinitions?.total ?? 0);
899
+ setHasMore(result.data?.workflowDefinitions?.hasMore ?? false);
900
+ } catch (err) {
901
+ if (!isCurrent()) return;
902
+ setLoadMoreError(err instanceof Error ? err : new Error(String(err)));
903
+ } finally {
904
+ pageInFlightRef.current = false;
905
+ setLoadingMore(false);
906
+ }
907
+ }, [
908
+ paginate,
909
+ loading,
910
+ loadingMore,
911
+ hasMore,
912
+ inputKey,
913
+ workflows,
914
+ listDocument
915
+ ]);
916
+ useEffect(() => {
917
+ fetchData(retryCount > 0);
918
+ }, [fetchData, retryCount]);
919
+ useEffect(() => {
920
+ if (retryCount > 0 && retryCount <= 3) {
921
+ const timer = setTimeout(() => {
922
+ fetchData(true);
923
+ }, 500 * retryCount);
924
+ return () => clearTimeout(timer);
925
+ }
926
+ }, [retryCount, fetchData]);
927
+ return {
928
+ workflows,
929
+ total,
930
+ hasMore,
931
+ loading,
932
+ loadingMore,
933
+ error,
934
+ loadMoreError,
935
+ tagsByKey: useMemo(() => {
936
+ const map = {};
937
+ for (const workflow of workflows) {
938
+ const assignments = workflow.tagAssignments;
939
+ if (assignments && assignments.length > 0 && !map[workflow.workflowKey]) map[workflow.workflowKey] = assignments;
940
+ }
941
+ return map;
942
+ }, [workflows]),
943
+ loadMore,
944
+ refetch: () => fetchData(false)
945
+ };
946
+ }
947
+ /**
948
+ * Hook to fetch a single workflow definition
949
+ */
950
+ function useWorkflowDefinition(workflowKey, id) {
951
+ const [workflow, setWorkflow] = useState(null);
952
+ const [loading, setLoading] = useState(true);
953
+ const [error, setError] = useState(null);
954
+ const fetchData = useCallback(async () => {
955
+ if (!workflowKey && !id) {
956
+ setLoading(false);
957
+ return;
958
+ }
959
+ setLoading(true);
960
+ setError(null);
961
+ try {
962
+ const result = await getFluidGridsClient().query({
963
+ query: WORKFLOW_DEFINITION,
964
+ variables: {
965
+ workflowKey,
966
+ id
967
+ },
968
+ fetchPolicy: "cache-first"
969
+ });
970
+ setWorkflow(result.data?.workflowDefinition ?? null);
971
+ } catch (err) {
972
+ setError(err);
973
+ } finally {
974
+ setLoading(false);
975
+ }
976
+ }, [workflowKey, id]);
977
+ useEffect(() => {
978
+ fetchData();
979
+ }, [fetchData]);
980
+ return {
981
+ workflow,
982
+ loading,
983
+ error,
984
+ refetch: fetchData
985
+ };
986
+ }
987
+ /**
988
+ * Sends an operation on its own request, at once, in a host whose client
989
+ * batches requests (fe-libs' `SEND_UNBATCHED_CONTEXT_KEY`). Clients that do
990
+ * not batch ignore it.
991
+ */
992
+ const SEND_UNBATCHED = { sendUnbatched: true };
993
+ function useLazyWorkflowDefinition(options = {}) {
994
+ const { withNodeManifests = false, routeCritical = false } = options;
995
+ const [workflow, setWorkflow] = useState(null);
996
+ const [loading, setLoading] = useState(false);
997
+ const [error, setError] = useState(null);
998
+ return {
999
+ getWorkflow: useCallback(async (workflowKey, id, version, { reusePrefetched = false } = {}) => {
1000
+ setLoading(true);
1001
+ setError(null);
1002
+ try {
1003
+ const started = routeCritical && withNodeManifests && reusePrefetched && workflowKey && version && !id ? takePrefetchedWorkflowForBuilder({
1004
+ workspaceId: getFluidGridsConfig().workspaceId,
1005
+ workflowKey,
1006
+ version
1007
+ }) : null;
1008
+ const prefetched = started ? await started : null;
1009
+ if (prefetched) {
1010
+ const data = prefetched;
1011
+ setWorkflow(data);
1012
+ return data;
1013
+ }
1014
+ const data = (await getFluidGridsClient().query({
1015
+ query: withNodeManifests ? WorkflowDefinitionForBuilderDocument : WORKFLOW_DEFINITION,
1016
+ variables: {
1017
+ workflowKey,
1018
+ id,
1019
+ ...version ? { version } : {}
1020
+ },
1021
+ fetchPolicy: "network-only",
1022
+ ...routeCritical ? { context: SEND_UNBATCHED } : {}
1023
+ })).data?.workflowDefinition ?? null;
1024
+ setWorkflow(data);
1025
+ return data;
1026
+ } catch (err) {
1027
+ setError(err);
1028
+ return null;
1029
+ } finally {
1030
+ setLoading(false);
1031
+ }
1032
+ }, [withNodeManifests, routeCritical]),
1033
+ workflow,
1034
+ loading,
1035
+ error
1036
+ };
1037
+ }
1038
+ /**
1039
+ * Hook to fetch workflow versions
1040
+ */
1041
+ function useWorkflowVersions(workflowKey) {
1042
+ const [versions, setVersions] = useState([]);
1043
+ const [loading, setLoading] = useState(true);
1044
+ const [error, setError] = useState(null);
1045
+ const fetchData = useCallback(async () => {
1046
+ if (!workflowKey) {
1047
+ setLoading(false);
1048
+ return [];
1049
+ }
1050
+ setLoading(true);
1051
+ setError(null);
1052
+ try {
1053
+ const fetched = (await getFluidGridsClient().query({
1054
+ query: WORKFLOW_VERSIONS,
1055
+ variables: { workflowKey },
1056
+ fetchPolicy: "network-only"
1057
+ })).data?.workflowVersions ?? [];
1058
+ setVersions(fetched);
1059
+ return fetched;
1060
+ } catch (err) {
1061
+ setError(err);
1062
+ return [];
1063
+ } finally {
1064
+ setLoading(false);
1065
+ }
1066
+ }, [workflowKey]);
1067
+ useEffect(() => {
1068
+ fetchData();
1069
+ }, [fetchData]);
1070
+ return {
1071
+ versions,
1072
+ loading,
1073
+ error,
1074
+ refetch: fetchData
1075
+ };
1076
+ }
1077
+ /**
1078
+ * Hook to create a new workflow definition
1079
+ * Automatically adds productId and productName to context if configured
1080
+ */
1081
+ function useCreateWorkflow() {
1082
+ const { bus, workspaceId } = useFluidGridsAnalytics();
1083
+ const [workflow, setWorkflow] = useState(null);
1084
+ const [loading, setLoading] = useState(false);
1085
+ const [error, setError] = useState(null);
1086
+ return {
1087
+ createWorkflow: useCallback(async (input, options) => {
1088
+ setLoading(true);
1089
+ setError(null);
1090
+ try {
1091
+ const config = getFluidGridsConfig();
1092
+ const inputWithProductContext = {
1093
+ ...input,
1094
+ context: {
1095
+ ...input.context || {},
1096
+ ...config.productId ? { productId: config.productId } : {},
1097
+ ...config.productName ? { productName: config.productName } : {}
1098
+ }
1099
+ };
1100
+ const client = getFluidGridsClient();
1101
+ const data = throwIfResultError(await client.mutate({
1102
+ mutation: CREATE_WORKFLOW_DEFINITION,
1103
+ variables: { input: inputWithProductContext },
1104
+ refetchQueries: ["WorkflowDefinitions"]
1105
+ })).data?.createWorkflowDefinition ?? null;
1106
+ setWorkflow(data);
1107
+ if (data) emitWorkflowCreated(bus, {
1108
+ workspaceId,
1109
+ workflowId: data.id,
1110
+ source: options?.source ?? "blank",
1111
+ definition: input.definitionJson
1112
+ });
1113
+ return data;
1114
+ } catch (err) {
1115
+ setError(err);
1116
+ options?.onError?.(err);
1117
+ return null;
1118
+ } finally {
1119
+ setLoading(false);
1120
+ }
1121
+ }, [bus, workspaceId]),
1122
+ workflow,
1123
+ loading,
1124
+ error
1125
+ };
1126
+ }
1127
+ /**
1128
+ * Import a portable workflow definition through the backend validation path.
1129
+ *
1130
+ * Unlike createWorkflow, this mutation validates node availability and returns
1131
+ * structured validation errors before creating a draft. A refused or failed
1132
+ * request throws the original error (also kept in `error`).
1133
+ */
1134
+ function useImportWorkflow() {
1135
+ const { bus, workspaceId } = useFluidGridsAnalytics();
1136
+ const [result, setResult] = useState(null);
1137
+ const [loading, setLoading] = useState(false);
1138
+ const [error, setError] = useState(null);
1139
+ return {
1140
+ importWorkflow: useCallback(async (input) => {
1141
+ setLoading(true);
1142
+ setError(null);
1143
+ try {
1144
+ const config = getFluidGridsConfig();
1145
+ const inputWithProductContext = {
1146
+ ...input,
1147
+ context: {
1148
+ ...input.context || {},
1149
+ ...config.productId ? { productId: config.productId } : {},
1150
+ ...config.productName ? { productName: config.productName } : {}
1151
+ }
1152
+ };
1153
+ const client = getFluidGridsClient();
1154
+ const data = throwIfResultError(await client.mutate({
1155
+ mutation: IMPORT_WORKFLOW,
1156
+ variables: { input: inputWithProductContext },
1157
+ refetchQueries: ["WorkflowDefinitions"]
1158
+ })).data?.importWorkflow ?? null;
1159
+ setResult(data);
1160
+ if (data?.success && data.workflow) emitWorkflowCreated(bus, {
1161
+ workspaceId,
1162
+ workflowId: data.workflow.id,
1163
+ source: "import",
1164
+ definition: input.definitionJson ?? data.workflow.definitionJson
1165
+ });
1166
+ return data;
1167
+ } catch (err) {
1168
+ setError(err);
1169
+ throw err;
1170
+ } finally {
1171
+ setLoading(false);
1172
+ }
1173
+ }, [bus, workspaceId]),
1174
+ result,
1175
+ loading,
1176
+ error
1177
+ };
1178
+ }
1179
+ /**
1180
+ * Converts an n8n workflow export for preview without saving it: the
1181
+ * service reports which nodes map, which become placeholders, and what the
1182
+ * user still has to set up (BOFF-9730).
1183
+ */
1184
+ function usePreviewN8nImport() {
1185
+ return { previewN8nImport: useCallback(async (workflowJson) => {
1186
+ const client = getFluidGridsClient();
1187
+ const preview = throwIfResultError(await client.query({
1188
+ query: PreviewN8nImportDocument,
1189
+ variables: { workflowJson },
1190
+ fetchPolicy: "no-cache"
1191
+ })).data?.previewN8nImport;
1192
+ if (!preview) throw new Error("The n8n workflow could not be previewed");
1193
+ return preview;
1194
+ }, []) };
1195
+ }
1196
+ /**
1197
+ * Hook to update a workflow definition
1198
+ */
1199
+ function useUpdateWorkflow() {
1200
+ const [workflow, setWorkflow] = useState(null);
1201
+ const [loading, setLoading] = useState(false);
1202
+ const [error, setError] = useState(null);
1203
+ return {
1204
+ updateWorkflow: useCallback(async (id, input) => {
1205
+ setLoading(true);
1206
+ setError(null);
1207
+ try {
1208
+ const client = getFluidGridsClient();
1209
+ const data = throwIfResultError(await client.mutate({
1210
+ mutation: UPDATE_WORKFLOW_DEFINITION,
1211
+ variables: {
1212
+ id,
1213
+ input
1214
+ }
1215
+ })).data?.updateWorkflowDefinition ?? null;
1216
+ setWorkflow(data);
1217
+ return data;
1218
+ } catch (err) {
1219
+ setError(err);
1220
+ return null;
1221
+ } finally {
1222
+ setLoading(false);
1223
+ }
1224
+ }, []),
1225
+ workflow,
1226
+ loading,
1227
+ error
1228
+ };
1229
+ }
1230
+ /**
1231
+ * Hook to create a new workflow version
1232
+ */
1233
+ function useCreateWorkflowVersion() {
1234
+ const [result, setResult] = useState(null);
1235
+ const [loading, setLoading] = useState(false);
1236
+ const [error, setError] = useState(null);
1237
+ return {
1238
+ createVersion: useCallback(async (workflowKey, input) => {
1239
+ setLoading(true);
1240
+ setError(null);
1241
+ try {
1242
+ const client = getFluidGridsClient();
1243
+ const data = throwIfResultError(await client.mutate({
1244
+ mutation: CREATE_WORKFLOW_VERSION,
1245
+ variables: {
1246
+ workflowKey,
1247
+ input
1248
+ }
1249
+ })).data?.createWorkflowVersion ?? null;
1250
+ setResult(data);
1251
+ return data;
1252
+ } catch (err) {
1253
+ setError(err);
1254
+ return null;
1255
+ } finally {
1256
+ setLoading(false);
1257
+ }
1258
+ }, []),
1259
+ result,
1260
+ loading,
1261
+ error
1262
+ };
1263
+ }
1264
+ /**
1265
+ * Hook to delete a workflow definition.
1266
+ * - If version is provided: deletes that specific version only.
1267
+ * - If version is omitted: deletes ALL versions for the workflowKey (removes the entire workflow).
1268
+ */
1269
+ function useDeleteWorkflow() {
1270
+ const [loading, setLoading] = useState(false);
1271
+ const [error, setError] = useState(null);
1272
+ return {
1273
+ deleteWorkflow: useCallback(async (workflowKey, version) => {
1274
+ setLoading(true);
1275
+ setError(null);
1276
+ try {
1277
+ const client = getFluidGridsClient();
1278
+ return throwIfResultError(await client.mutate({
1279
+ mutation: DELETE_WORKFLOW_DEFINITION,
1280
+ variables: {
1281
+ workflowKey,
1282
+ ...version ? { version } : {}
1283
+ },
1284
+ refetchQueries: ["WorkflowDefinitions"]
1285
+ })).data?.deleteWorkflowDefinition ?? false;
1286
+ } catch (err) {
1287
+ setError(err);
1288
+ return false;
1289
+ } finally {
1290
+ setLoading(false);
1291
+ }
1292
+ }, []),
1293
+ loading,
1294
+ error
1295
+ };
1296
+ }
1297
+ /**
1298
+ * Hook to duplicate a workflow
1299
+ */
1300
+ function useDuplicateWorkflow() {
1301
+ const { bus, workspaceId } = useFluidGridsAnalytics();
1302
+ const [result, setResult] = useState(null);
1303
+ const [loading, setLoading] = useState(false);
1304
+ const [error, setError] = useState(null);
1305
+ return {
1306
+ duplicateWorkflow: useCallback(async (workflowKey, version, input, options) => {
1307
+ setLoading(true);
1308
+ setError(null);
1309
+ try {
1310
+ const client = getFluidGridsClient();
1311
+ const data = throwIfResultError(await client.mutate({
1312
+ mutation: DUPLICATE_WORKFLOW,
1313
+ variables: {
1314
+ workflowKey,
1315
+ version,
1316
+ input
1317
+ },
1318
+ refetchQueries: ["WorkflowDefinitions"]
1319
+ })).data?.duplicateWorkflow ?? null;
1320
+ setResult(data);
1321
+ if (data?.success && data.workflow) emitWorkflowCreated(bus, {
1322
+ workspaceId,
1323
+ workflowId: data.workflow.id,
1324
+ source: options?.source ?? "duplicate",
1325
+ definition: data.workflow.definitionJson
1326
+ });
1327
+ return data;
1328
+ } catch (err) {
1329
+ setError(err);
1330
+ throw err;
1331
+ } finally {
1332
+ setLoading(false);
1333
+ }
1334
+ }, [bus, workspaceId]),
1335
+ result,
1336
+ loading,
1337
+ error
1338
+ };
1339
+ }
1340
+ /**
1341
+ * Hook to restore a previous workflow version (creates a new DRAFT from the old version's definitionJson)
1342
+ */
1343
+ function useRestoreWorkflowVersion() {
1344
+ const [result, setResult] = useState(null);
1345
+ const [loading, setLoading] = useState(false);
1346
+ const [error, setError] = useState(null);
1347
+ return {
1348
+ restoreVersion: useCallback(async (workflowKey, version) => {
1349
+ setLoading(true);
1350
+ setError(null);
1351
+ try {
1352
+ const client = getFluidGridsClient();
1353
+ const data = throwIfResultError(await client.mutate({
1354
+ mutation: RESTORE_WORKFLOW_VERSION,
1355
+ variables: {
1356
+ workflowKey,
1357
+ version
1358
+ },
1359
+ refetchQueries: ["WorkflowDefinitions"]
1360
+ })).data?.restoreWorkflowVersion ?? null;
1361
+ setResult(data);
1362
+ return data;
1363
+ } catch (err) {
1364
+ setError(err);
1365
+ return null;
1366
+ } finally {
1367
+ setLoading(false);
1368
+ }
1369
+ }, []),
1370
+ result,
1371
+ loading,
1372
+ error
1373
+ };
1374
+ }
1375
+ /**
1376
+ * Hook to trigger a workflow execution
1377
+ */
1378
+ function useTriggerWorkflow() {
1379
+ const tr = useTr();
1380
+ const { bus, workspaceId } = useFluidGridsAnalytics();
1381
+ const [result, setResult] = useState(null);
1382
+ const [loading, setLoading] = useState(false);
1383
+ const [error, setError] = useState(null);
1384
+ return {
1385
+ triggerWorkflow: useCallback(async (input) => {
1386
+ setLoading(true);
1387
+ setError(null);
1388
+ try {
1389
+ const client = getFluidGridsClient();
1390
+ const data = throwIfResultError(await client.mutate({
1391
+ mutation: TRIGGER_WORKFLOW,
1392
+ variables: { input }
1393
+ })).data?.triggerWorkflow ?? null;
1394
+ setResult(data);
1395
+ if (data) {
1396
+ emitRunStarted(bus, {
1397
+ workspaceId,
1398
+ executionId: data.runId,
1399
+ trigger: runTriggerFromMode(input.mode)
1400
+ });
1401
+ emitFluidGridsEvent("run:started", {
1402
+ runId: data.runId,
1403
+ workflowKey: data.workflowKey,
1404
+ mode: input.mode ?? void 0
1405
+ });
1406
+ }
1407
+ return data;
1408
+ } catch (err) {
1409
+ setError(err);
1410
+ emitOperationErrorEvent("run:start", err);
1411
+ openRunQuotaUpgradePrompt(err, tr, {
1412
+ bus,
1413
+ workspaceId,
1414
+ surface: "runs"
1415
+ });
1416
+ return null;
1417
+ } finally {
1418
+ setLoading(false);
1419
+ }
1420
+ }, [
1421
+ tr,
1422
+ bus,
1423
+ workspaceId
1424
+ ]),
1425
+ result,
1426
+ loading,
1427
+ error
1428
+ };
1429
+ }
1430
+ /**
1431
+ * Hook to fetch workflow runs
1432
+ */
1433
+ function useWorkflowRuns(input = {}) {
1434
+ const [runs, setRuns] = useState([]);
1435
+ const [total, setTotal] = useState(0);
1436
+ const [hasMore, setHasMore] = useState(false);
1437
+ const [loading, setLoading] = useState(true);
1438
+ const [error, setError] = useState(null);
1439
+ const fetchData = useCallback(async () => {
1440
+ setLoading(true);
1441
+ setError(null);
1442
+ try {
1443
+ const result = await getFluidGridsClient().query({
1444
+ query: WORKFLOW_RUNS,
1445
+ variables: { input },
1446
+ fetchPolicy: "cache-first"
1447
+ });
1448
+ setRuns(result.data?.workflowRuns?.items ?? []);
1449
+ setTotal(result.data?.workflowRuns?.total ?? 0);
1450
+ setHasMore(result.data?.workflowRuns?.hasMore ?? false);
1451
+ } catch (err) {
1452
+ setError(err);
1453
+ } finally {
1454
+ setLoading(false);
1455
+ }
1456
+ }, [input]);
1457
+ useEffect(() => {
1458
+ fetchData();
1459
+ }, [fetchData]);
1460
+ return {
1461
+ runs,
1462
+ total,
1463
+ hasMore,
1464
+ loading,
1465
+ error,
1466
+ refetch: fetchData
1467
+ };
1468
+ }
1469
+ /**
1470
+ * Hook to fetch a single workflow run with node states
1471
+ */
1472
+ function useWorkflowRun(id) {
1473
+ const [run, setRun] = useState(null);
1474
+ const [loading, setLoading] = useState(true);
1475
+ const [error, setError] = useState(null);
1476
+ const fetchData = useCallback(async () => {
1477
+ if (!id) {
1478
+ setLoading(false);
1479
+ return;
1480
+ }
1481
+ setLoading(true);
1482
+ setError(null);
1483
+ try {
1484
+ const result = await getFluidGridsClient().query({
1485
+ query: WORKFLOW_RUN,
1486
+ variables: { id },
1487
+ fetchPolicy: "cache-first"
1488
+ });
1489
+ setRun(result.data?.workflowRun ?? null);
1490
+ } catch (err) {
1491
+ setError(err);
1492
+ } finally {
1493
+ setLoading(false);
1494
+ }
1495
+ }, [id]);
1496
+ useEffect(() => {
1497
+ fetchData();
1498
+ }, [fetchData]);
1499
+ return {
1500
+ run,
1501
+ loading,
1502
+ error,
1503
+ refetch: fetchData
1504
+ };
1505
+ }
1506
+ /**
1507
+ * Hook to fetch dashboard summary
1508
+ */
1509
+ function useDashboardSummary(options = {}) {
1510
+ const [summary, setSummary] = useState(null);
1511
+ const [loading, setLoading] = useState(true);
1512
+ const [error, setError] = useState(null);
1513
+ const fetchData = useCallback(async () => {
1514
+ setLoading(true);
1515
+ setError(null);
1516
+ try {
1517
+ const result = await getFluidGridsClient().query({
1518
+ query: DASHBOARD_SUMMARY,
1519
+ variables: options,
1520
+ fetchPolicy: "cache-first"
1521
+ });
1522
+ setSummary(result.data?.dashboardSummary ?? null);
1523
+ } catch (err) {
1524
+ setError(err);
1525
+ } finally {
1526
+ setLoading(false);
1527
+ }
1528
+ }, [options]);
1529
+ useEffect(() => {
1530
+ fetchData();
1531
+ }, [fetchData]);
1532
+ return {
1533
+ summary,
1534
+ loading,
1535
+ error,
1536
+ refetch: fetchData
1537
+ };
1538
+ }
1539
+ const ACTIVATE_WORKFLOW_DEFINITION = ActivateWorkflowDefinitionDocument;
1540
+ const DEACTIVATE_WORKFLOW_DEFINITION = DeactivateWorkflowDefinitionDocument;
1541
+ /**
1542
+ * Hook to activate a workflow definition (set status to ACTIVE)
1543
+ */
1544
+ function useActivateWorkflow() {
1545
+ const { bus, workspaceId } = useFluidGridsAnalytics();
1546
+ const [loading, setLoading] = useState(false);
1547
+ return {
1548
+ activateWorkflow: useCallback(async (id, options) => {
1549
+ setLoading(true);
1550
+ try {
1551
+ const client = getFluidGridsClient();
1552
+ const activated = throwIfResultError(await client.mutate({
1553
+ mutation: ACTIVATE_WORKFLOW_DEFINITION,
1554
+ variables: { id },
1555
+ refetchQueries: ["WorkflowVersions", "WorkflowDefinitions"]
1556
+ })).data?.activateWorkflowDefinition ?? null;
1557
+ if (activated) {
1558
+ emitWorkflowPublished(bus, {
1559
+ workspaceId,
1560
+ workflowId: activated.id,
1561
+ definition: options?.definition
1562
+ });
1563
+ emitFluidGridsEvent("workflow:activated", {
1564
+ workflowKey: activated.workflowKey,
1565
+ version: activated.version ?? void 0
1566
+ });
1567
+ }
1568
+ return activated;
1569
+ } catch (err) {
1570
+ console.error("Error activating workflow:", err);
1571
+ emitOperationErrorEvent("workflow:activate", err);
1572
+ throw err;
1573
+ } finally {
1574
+ setLoading(false);
1575
+ }
1576
+ }, [bus, workspaceId]),
1577
+ loading
1578
+ };
1579
+ }
1580
+ /**
1581
+ * Hook to deactivate a workflow definition (set status back to DRAFT)
1582
+ */
1583
+ function useDeactivateWorkflow() {
1584
+ const [loading, setLoading] = useState(false);
1585
+ return {
1586
+ deactivateWorkflow: useCallback(async (id) => {
1587
+ setLoading(true);
1588
+ try {
1589
+ const client = getFluidGridsClient();
1590
+ return throwIfResultError(await client.mutate({
1591
+ mutation: DEACTIVATE_WORKFLOW_DEFINITION,
1592
+ variables: { id },
1593
+ refetchQueries: ["WorkflowVersions", "WorkflowDefinitions"]
1594
+ })).data?.deactivateWorkflowDefinition ?? null;
1595
+ } catch (err) {
1596
+ console.error("Error deactivating workflow:", err);
1597
+ throw err;
1598
+ } finally {
1599
+ setLoading(false);
1600
+ }
1601
+ }, []),
1602
+ loading
1603
+ };
1604
+ }
1605
+
1606
+ export { PreviewN8nImportDocument as S, useWorkflowRun as _, useDashboardSummary as a, withProductFilter as b, useDuplicateWorkflow as c, usePreviewN8nImport as d, useRestoreWorkflowVersion as f, useWorkflowDefinitions as g, useWorkflowDefinition as h, useCreateWorkflowVersion as i, useImportWorkflow as l, useUpdateWorkflow as m, useActivateWorkflow as n, useDeactivateWorkflow as o, useTriggerWorkflow as p, useCreateWorkflow as r, useDeleteWorkflow as s, appendWorkflowPage as t, useLazyWorkflowDefinition as u, useWorkflowRuns as v, WorkflowDefinitionForBuilderDocument as x, useWorkflowVersions as y };