@powerhousedao/workflow 6.2.3-dev.43 → 6.2.3-dev.45

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 (233) hide show
  1. package/dist/browser/{BlockSelector-C-C56Wcf.js → BlockSelector-B41mSc0W.js} +431 -411
  2. package/dist/browser/BlockSelector-B41mSc0W.js.map +1 -0
  3. package/dist/browser/assets/{entry-KqlcH_wb.js → entry-CtB3hwiW.js} +99 -3
  4. package/dist/browser/assets/{projection-entry-DD5A5lZY.js → projection-entry-Cd33KgnS.js} +2 -3
  5. package/dist/browser/{connection-BUum0hJI.js → connection-BP17lpt3.js} +2 -2
  6. package/dist/browser/{connection-BUum0hJI.js.map → connection-BP17lpt3.js.map} +1 -1
  7. package/dist/browser/{connection-form-C9iDnI6H.js → connection-form-CkRzKggD.js} +524 -13
  8. package/dist/browser/connection-form-CkRzKggD.js.map +1 -0
  9. package/dist/browser/{data-tree-B4W7ZUmG.js → data-tree-BugZMgLk.js} +2 -2
  10. package/dist/browser/{data-tree-B4W7ZUmG.js.map → data-tree-BugZMgLk.js.map} +1 -1
  11. package/dist/browser/document-models/connection/index.js +3 -3
  12. package/dist/browser/document-models/index.js +3 -3
  13. package/dist/browser/document-models/workflow/index.js +2 -2
  14. package/dist/browser/{document-models-C1ZgIZyV.js → document-models-B7IwLbfO.js} +3 -3
  15. package/dist/browser/{document-models-C1ZgIZyV.js.map → document-models-B7IwLbfO.js.map} +1 -1
  16. package/dist/browser/{editor-cEmJfc9W.js → editor-9eSmoDTm.js} +331 -39
  17. package/dist/browser/editor-9eSmoDTm.js.map +1 -0
  18. package/dist/browser/{editor-4BJf6hN7.js → editor-DvK4LPwF.js} +7 -10
  19. package/dist/browser/editor-DvK4LPwF.js.map +1 -0
  20. package/dist/browser/{editor-Crt3ZeGd.js → editor-ldDYxtLV.js} +166 -43
  21. package/dist/browser/editor-ldDYxtLV.js.map +1 -0
  22. package/dist/browser/editors/connection-editor/module.js +1 -1
  23. package/dist/browser/editors/workflow-editor/module.js +1 -1
  24. package/dist/browser/editors/workflow-studio/module.js +1 -1
  25. package/dist/browser/graphql-Cr1ia6fo.js +2474 -0
  26. package/dist/browser/graphql-Cr1ia6fo.js.map +1 -0
  27. package/dist/browser/index.js +9 -5
  28. package/dist/browser/index.js.map +1 -1
  29. package/dist/browser/{module-jDZ4pq3W.js → module-B2BMwu5E.js} +129 -17
  30. package/dist/browser/module-B2BMwu5E.js.map +1 -0
  31. package/dist/browser/{module-DU2vb3FH.js → module-D4UiG9ii.js} +13 -5
  32. package/dist/browser/module-D4UiG9ii.js.map +1 -0
  33. package/dist/browser/reactor/index.js +2 -2
  34. package/dist/browser/{runtime-queries-Ds2kk-Ow.js → runtime-queries-IZG_nonR.js} +85 -11
  35. package/dist/browser/runtime-queries-IZG_nonR.js.map +1 -0
  36. package/dist/browser/{trigger-text-5CT870cu.js → trigger-text-C37YRggR.js} +142 -20
  37. package/dist/browser/trigger-text-C37YRggR.js.map +1 -0
  38. package/dist/browser/upgrade-manifests-C_9cyumV.js +8 -0
  39. package/dist/browser/{upgrade-manifests-BpakVE9l.js.map → upgrade-manifests-C_9cyumV.js.map} +1 -1
  40. package/dist/browser/{workflow-BxShRhVy.js → workflow-DFLQ2cFr.js} +2 -2
  41. package/dist/browser/{workflow-BxShRhVy.js.map → workflow-DFLQ2cFr.js.map} +1 -1
  42. package/dist/node/{BlockSelector-C9_1wbx4.mjs → BlockSelector-BMnBzXcA.mjs} +431 -411
  43. package/dist/node/BlockSelector-BMnBzXcA.mjs.map +1 -0
  44. package/dist/node/{connection-D544oqVW.mjs → connection-BxJoL8js.mjs} +2 -2
  45. package/dist/node/{connection-D544oqVW.mjs.map → connection-BxJoL8js.mjs.map} +1 -1
  46. package/dist/node/{connection-form-DUOXUqBz.mjs → connection-form-DZFudcoD.mjs} +524 -13
  47. package/dist/node/connection-form-DZFudcoD.mjs.map +1 -0
  48. package/dist/node/{data-tree-CoV-swZZ.mjs → data-tree-CR8IOshA.mjs} +2 -2
  49. package/dist/node/{data-tree-CoV-swZZ.mjs.map → data-tree-CR8IOshA.mjs.map} +1 -1
  50. package/dist/node/document-models/connection/index.mjs +3 -3
  51. package/dist/node/document-models/index.mjs +3 -3
  52. package/dist/node/document-models/workflow/index.mjs +2 -2
  53. package/dist/node/{editor-BFDE4Q3v.mjs → editor-BV5CYmUI.mjs} +7 -10
  54. package/dist/node/editor-BV5CYmUI.mjs.map +1 -0
  55. package/dist/node/{editor-D2jRtRNl.mjs → editor-D_P9-st9.mjs} +166 -43
  56. package/dist/node/editor-D_P9-st9.mjs.map +1 -0
  57. package/dist/node/{editor-BwOQIwVw.mjs → editor-NUaiiO4B.mjs} +331 -39
  58. package/dist/node/editor-NUaiiO4B.mjs.map +1 -0
  59. package/dist/node/editors/connection-editor/module.mjs +1 -1
  60. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  61. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  62. package/dist/node/graphql-BGVLRhC1.mjs +14554 -0
  63. package/dist/node/graphql-BGVLRhC1.mjs.map +1 -0
  64. package/dist/node/index.mjs +9 -6
  65. package/dist/node/index.mjs.map +1 -1
  66. package/dist/node/{module-BMwJQh65.mjs → module-BlT-atBQ.mjs} +129 -17
  67. package/dist/node/module-BlT-atBQ.mjs.map +1 -0
  68. package/dist/node/{module-Dhe5E-VA.mjs → module-BsqRZox1.mjs} +13 -5
  69. package/dist/node/module-BsqRZox1.mjs.map +1 -0
  70. package/dist/node/pieces/reactor/descriptor.json +34 -17
  71. package/dist/node/pieces/reactor/index.mjs +67 -67
  72. package/dist/node/pieces/reactor/package.json +1 -1
  73. package/dist/node/{runtime-queries-D5EGaCrH.mjs → runtime-queries-BM6I7dDA.mjs} +85 -11
  74. package/dist/node/runtime-queries-BM6I7dDA.mjs.map +1 -0
  75. package/dist/node/{trigger-text-CXnnanWC.mjs → trigger-text-78ZhfT-b.mjs} +142 -20
  76. package/dist/node/trigger-text-78ZhfT-b.mjs.map +1 -0
  77. package/dist/node/upgrade-manifests-CYZfts3a.mjs +8 -0
  78. package/dist/node/{upgrade-manifests-CmNd742Y.mjs.map → upgrade-manifests-CYZfts3a.mjs.map} +1 -1
  79. package/dist/node/{workflow-CGzYGZnr.mjs → workflow-BpfdBHyS.mjs} +2 -2
  80. package/dist/node/{workflow-CGzYGZnr.mjs.map → workflow-BpfdBHyS.mjs.map} +1 -1
  81. package/dist/powerhouse.manifest.json +1 -1
  82. package/dist/style.css +44 -0
  83. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  84. package/dist/types/document-models/connection/v1/gen/config/error.d.ts +15 -1
  85. package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
  86. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +13 -1
  87. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -1
  88. package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
  89. package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
  90. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +11 -2
  91. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
  92. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +3 -1
  93. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
  94. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts +17 -0
  95. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts.map +1 -0
  96. package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
  97. package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -1
  98. package/dist/types/document-models/connection/v1/src/utils.d.ts +1 -1
  99. package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -1
  100. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts +2 -0
  101. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts.map +1 -0
  102. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +7 -0
  103. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  104. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  105. package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
  106. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  107. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts +2 -0
  108. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts.map +1 -0
  109. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +1 -1
  110. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  111. package/dist/types/editors/connection-editor/ReactorBindings.d.ts +6 -0
  112. package/dist/types/editors/connection-editor/ReactorBindings.d.ts.map +1 -0
  113. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts +7 -0
  114. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -0
  115. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  116. package/dist/types/editors/connection-editor/connection-form.d.ts +4 -1
  117. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  118. package/dist/types/editors/connection-editor/connection-usage.d.ts +13 -3
  119. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
  120. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  121. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  122. package/dist/types/editors/shared/data-viewer.d.ts.map +1 -1
  123. package/dist/types/editors/shared/document-ref.d.ts +5 -0
  124. package/dist/types/editors/shared/document-ref.d.ts.map +1 -0
  125. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  126. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  127. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts +25 -0
  128. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts.map +1 -0
  129. package/dist/types/editors/workflow-editor/runtime-client.d.ts +16 -1
  130. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
  131. package/dist/types/editors/workflow-editor/runtime-persist.d.ts +1 -1
  132. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  133. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +3 -0
  134. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  135. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +13 -0
  136. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
  137. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts +9 -0
  138. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -0
  139. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts +6 -0
  140. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts.map +1 -0
  141. package/dist/types/editors/workflow-editor/ui/StepError.d.ts +4 -0
  142. package/dist/types/editors/workflow-editor/ui/StepError.d.ts.map +1 -0
  143. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
  144. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  145. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts +2 -0
  146. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts.map +1 -0
  147. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  148. package/dist/types/editors/workflow-editor/ui/design-time.d.ts +1 -0
  149. package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -1
  150. package/dist/types/editors/workflow-editor/ui/document-options.d.ts +24 -0
  151. package/dist/types/editors/workflow-editor/ui/document-options.d.ts.map +1 -0
  152. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts +2 -0
  153. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts.map +1 -0
  154. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts +8 -0
  155. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts.map +1 -0
  156. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts +2 -0
  157. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts.map +1 -0
  158. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +2 -0
  159. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
  160. package/dist/types/editors/workflow-editor/ui/forms.d.ts +5 -1
  161. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  162. package/dist/types/editors/workflow-editor/ui/model.d.ts +14 -0
  163. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  164. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +6 -3
  165. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
  166. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts +43 -0
  167. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts.map +1 -0
  168. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts +2 -0
  169. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts.map +1 -0
  170. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts +2 -0
  171. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts.map +1 -0
  172. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts +2 -0
  173. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts.map +1 -0
  174. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts +25 -0
  175. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts.map +1 -0
  176. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts +2 -0
  177. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts.map +1 -0
  178. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +1 -0
  179. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
  180. package/dist/types/editors/workflow-editor/ui/validation.d.ts +3 -1
  181. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  182. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  183. package/dist/types/pieces/reactor/index.d.ts.map +1 -1
  184. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +4 -3
  185. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  186. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +2 -2
  187. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  188. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +3 -2
  189. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
  190. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +2 -2
  191. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  192. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +2 -2
  193. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  194. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +1 -1
  195. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
  196. package/dist/types/pieces/reactor/lib/documents.d.ts +32 -0
  197. package/dist/types/pieces/reactor/lib/documents.d.ts.map +1 -0
  198. package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
  199. package/dist/types/pieces/reactor/lib/reactor.d.ts +15 -4
  200. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  201. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +6 -6
  202. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -1
  203. package/dist/types/pieces/reactor/reactor.test.d.ts +2 -0
  204. package/dist/types/pieces/reactor/reactor.test.d.ts.map +1 -0
  205. package/dist/types/pieces/reactor/test-signer.d.ts +3 -0
  206. package/dist/types/pieces/reactor/test-signer.d.ts.map +1 -0
  207. package/dist/types/scripts/ui-stack.d.ts +4 -1
  208. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  209. package/dist/types/test/ui/reactor-connection.spec.d.ts +2 -0
  210. package/dist/types/test/ui/reactor-connection.spec.d.ts.map +1 -0
  211. package/package.json +8 -8
  212. package/dist/browser/BlockSelector-C-C56Wcf.js.map +0 -1
  213. package/dist/browser/connection-form-C9iDnI6H.js.map +0 -1
  214. package/dist/browser/editor-4BJf6hN7.js.map +0 -1
  215. package/dist/browser/editor-Crt3ZeGd.js.map +0 -1
  216. package/dist/browser/editor-cEmJfc9W.js.map +0 -1
  217. package/dist/browser/module-DU2vb3FH.js.map +0 -1
  218. package/dist/browser/module-jDZ4pq3W.js.map +0 -1
  219. package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +0 -1
  220. package/dist/browser/trigger-text-5CT870cu.js.map +0 -1
  221. package/dist/browser/upgrade-manifests-BpakVE9l.js +0 -8
  222. package/dist/node/BlockSelector-C9_1wbx4.mjs.map +0 -1
  223. package/dist/node/connection-form-DUOXUqBz.mjs.map +0 -1
  224. package/dist/node/editor-BFDE4Q3v.mjs.map +0 -1
  225. package/dist/node/editor-BwOQIwVw.mjs.map +0 -1
  226. package/dist/node/editor-D2jRtRNl.mjs.map +0 -1
  227. package/dist/node/module-BMwJQh65.mjs.map +0 -1
  228. package/dist/node/module-Dhe5E-VA.mjs.map +0 -1
  229. package/dist/node/runtime-queries-D5EGaCrH.mjs.map +0 -1
  230. package/dist/node/trigger-text-CXnnanWC.mjs.map +0 -1
  231. package/dist/node/upgrade-manifests-CmNd742Y.mjs +0 -8
  232. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts +0 -2
  233. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-D4UiG9ii.js","names":["z","workflowWorkflowActions","workflowTriggerActions","workflowStepsActions","workflowEdgesActions","workflowVariablesActions","workflowPolicyActions","workflowRuntimeActions","workflowPublishingActions","utils","genUtils","customUtils"],"sources":["../../../pieces-framework/dist/block-type.js","../../document-models/workflow/v1/gen/schema/zod.ts","../../document-models/workflow/v1/gen/edges/creators.ts","../../document-models/workflow/v1/gen/policy/creators.ts","../../document-models/workflow/v1/gen/publishing/creators.ts","../../document-models/workflow/v1/gen/runtime/creators.ts","../../document-models/workflow/v1/gen/steps/creators.ts","../../document-models/workflow/v1/gen/trigger/creators.ts","../../document-models/workflow/v1/gen/variables/creators.ts","../../document-models/workflow/v1/gen/workflow/creators.ts","../../document-models/workflow/v1/actions.ts","../../document-models/workflow/v1/gen/document-model.ts","../../document-models/workflow/v1/gen/edges/error.ts","../../document-models/workflow/v1/src/reducers/edges.ts","../../document-models/workflow/v1/src/reducers/policy.ts","../../document-models/workflow/v1/gen/publishing/error.ts","../../document-models/workflow/v1/src/helpers.ts","../../document-models/workflow/v1/src/reducers/publishing.ts","../../document-models/workflow/v1/gen/runtime/error.ts","../../document-models/workflow/v1/src/reducers/runtime.ts","../../document-models/workflow/v1/gen/steps/error.ts","../../document-models/workflow/v1/src/reducers/steps.ts","../../document-models/workflow/v1/gen/trigger/error.ts","../../document-models/workflow/v1/src/reducers/trigger.ts","../../document-models/workflow/v1/gen/variables/error.ts","../../document-models/workflow/v1/src/reducers/variables.ts","../../document-models/workflow/v1/gen/workflow/error.ts","../../document-models/workflow/v1/src/reducers/workflow.ts","../../document-models/workflow/v1/gen/reducer.ts","../../document-models/workflow/upgrades/versions.ts","../../document-models/workflow/upgrades/upgrade-manifest.ts","../../document-models/workflow/v1/gen/document-type.ts","../../document-models/workflow/v1/gen/document-schema.ts","../../document-models/workflow/v1/gen/utils.ts","../../document-models/workflow/v1/src/utils.ts","../../document-models/workflow/v1/utils.ts","../../document-models/workflow/v1/module.ts"],"sourcesContent":["//#region src/block-type.ts\nconst SEMVER = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\nfunction isExactVersion(version) {\n\treturn SEMVER.test(version);\n}\nfunction blockKey(block) {\n\treturn `${block.pieceName} ${block.kind} ${block.name}`;\n}\nfunction parseSemver(version) {\n\tconst match = SEMVER.exec(version);\n\tif (!match) throw new Error(`\"${version}\" is not an exact semver version`);\n\treturn {\n\t\tmajor: Number(match[1]),\n\t\tminor: Number(match[2]),\n\t\tpatch: Number(match[3]),\n\t\tprerelease: match[4] ? match[4].split(\".\") : []\n\t};\n}\nconst NUMERIC = /^\\d+$/;\nfunction compareIdentifiers(a, b) {\n\tconst aNumeric = NUMERIC.test(a);\n\tconst bNumeric = NUMERIC.test(b);\n\tif (aNumeric && bNumeric) return Math.sign(Number(a) - Number(b));\n\tif (aNumeric) return -1;\n\tif (bNumeric) return 1;\n\treturn a < b ? -1 : a > b ? 1 : 0;\n}\nfunction compareVersions(a, b) {\n\tconst x = parseSemver(a);\n\tconst y = parseSemver(b);\n\tconst core = Math.sign(x.major - y.major) || Math.sign(x.minor - y.minor) || Math.sign(x.patch - y.patch);\n\tif (core !== 0) return core;\n\tif (x.prerelease.length === 0 || y.prerelease.length === 0) return Math.sign(y.prerelease.length - x.prerelease.length);\n\tconst shared = Math.min(x.prerelease.length, y.prerelease.length);\n\tfor (let i = 0; i < shared; i++) {\n\t\tconst order = compareIdentifiers(x.prerelease[i], y.prerelease[i]);\n\t\tif (order !== 0) return order;\n\t}\n\treturn Math.sign(x.prerelease.length - y.prerelease.length);\n}\nfunction line(version) {\n\tconst { major, minor } = parseSemver(version);\n\treturn major === 0 ? `0.${minor}` : `${major}`;\n}\nfunction rankClosestVersions(requested, available) {\n\tconst descending = [...new Set(available.filter(isExactVersion))].sort((a, b) => compareVersions(b, a));\n\tif (!isExactVersion(requested)) return descending.map((version) => ({\n\t\tversion,\n\t\tmatch: \"fallback\"\n\t}));\n\tconst wanted = line(requested);\n\tconst rank = (version) => {\n\t\tif (version === requested) return [0, \"exact\"];\n\t\tif (line(version) !== wanted) return [3, \"fallback\"];\n\t\treturn compareVersions(version, requested) >= 0 ? [1, \"compatible\"] : [2, \"fallback\"];\n\t};\n\treturn descending.map((version) => ({\n\t\tversion,\n\t\trank: rank(version)\n\t})).sort((a, b) => a.rank[0] - b.rank[0]).map(({ version, rank: [, match] }) => ({\n\t\tversion,\n\t\tmatch\n\t}));\n}\nfunction pickClosestVersion(requested, available) {\n\treturn rankClosestVersions(requested, available)[0];\n}\n\n//#endregion\nexport { blockKey, compareVersions, isExactVersion, pickClosestVersion, rankClosestVersions };\n//# sourceMappingURL=block-type.js.map","/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddEdgeInput,\n AddStepInput,\n AddStepPositionInput,\n AddStepPropertySettingInput,\n AddStepRetryPolicyInput,\n BackoffKind,\n ClearTriggerInput,\n ConcurrencyMode,\n FailureMode,\n Point,\n PropertyMode,\n PropertySetting,\n PublishWorkflowInput,\n PublishedWorkflow,\n RemoveEdgeInput,\n RemoveStepInput,\n RemoveVariableInput,\n RetryPolicy,\n RevertToPublishedInput,\n RunStatus,\n SetLastRunInput,\n SetLastTestInput,\n SetPolicyInput,\n SetPolicyRetryPolicyInput,\n SetStepConfigInput,\n SetStepConfigPropertySettingInput,\n SetTriggerInput,\n SetTriggerPropertySettingInput,\n SetVariableInput,\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n StepTestRecord,\n TriggerBinding,\n UpdateStepInput,\n UpdateStepPositionInput,\n UpdateStepRetryPolicyInput,\n VariableType,\n WorkflowEdge,\n WorkflowPolicy,\n WorkflowState,\n WorkflowStatus,\n WorkflowStep,\n WorkflowVariable,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const BackoffKindSchema = z.enum([\"EXPONENTIAL\", \"FIXED\"]);\n\nexport const ConcurrencyModeSchema = z.enum([\"PARALLEL\", \"QUEUE\", \"SINGLETON\"]);\n\nexport const FailureModeSchema = z.enum([\"IGNORE\", \"NOTIFY\", \"PARK\"]);\n\nexport const PropertyModeSchema = z.enum([\"EXPRESSION\", \"MANUAL\"]);\n\nexport const RunStatusSchema = z.enum([\n \"CANCELLED\",\n \"FAILED\",\n \"PARKED\",\n \"PENDING\",\n \"RUNNING\",\n \"SUCCEEDED\",\n \"WAITING\",\n]);\n\nexport const VariableTypeSchema = z.enum([\n \"BOOLEAN\",\n \"JSON\",\n \"NUMBER\",\n \"SECRET\",\n \"TEXT\",\n]);\n\nexport const WorkflowStatusSchema = z.enum([\n \"ARCHIVED\",\n \"DISABLED\",\n \"DRAFT\",\n \"ENABLED\",\n]);\n\nexport function AddEdgeInputSchema(): z.ZodObject<Properties<AddEdgeInput>> {\n return z.object({\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function AddStepInputSchema(): z.ZodObject<Properties<AddStepInput>> {\n return z.object({\n actionName: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n name: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n position: z.lazy(() => AddStepPositionInputSchema().nullish()),\n propertySettings: z\n .array(z.lazy(() => AddStepPropertySettingInputSchema()))\n .nullish(),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => AddStepRetryPolicyInputSchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function AddStepPositionInputSchema(): z.ZodObject<\n Properties<AddStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function AddStepPropertySettingInputSchema(): z.ZodObject<\n Properties<AddStepPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function AddStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<AddStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function ClearTriggerInputSchema(): z.ZodObject<\n Properties<ClearTriggerInput>\n> {\n return z.object({\n _: z.boolean().nullish(),\n });\n}\n\nexport function PointSchema(): z.ZodObject<Properties<Point>> {\n return z.object({\n __typename: z.literal(\"Point\").optional(),\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function PropertySettingSchema(): z.ZodObject<\n Properties<PropertySetting>\n> {\n return z.object({\n __typename: z.literal(\"PropertySetting\").optional(),\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function PublishWorkflowInputSchema(): z.ZodObject<\n Properties<PublishWorkflowInput>\n> {\n return z.object({\n publishedAt: z.iso.datetime(),\n });\n}\n\nexport function PublishedWorkflowSchema(): z.ZodObject<\n Properties<PublishedWorkflow>\n> {\n return z.object({\n __typename: z.literal(\"PublishedWorkflow\").optional(),\n edges: z.array(z.lazy(() => WorkflowEdgeSchema())),\n policy: z.lazy(() => WorkflowPolicySchema()),\n publishedAt: z.iso.datetime(),\n steps: z.array(z.lazy(() => WorkflowStepSchema())),\n trigger: z.lazy(() => TriggerBindingSchema().nullish()),\n variables: z.array(z.lazy(() => WorkflowVariableSchema())),\n version: z.number(),\n });\n}\n\nexport function RemoveEdgeInputSchema(): z.ZodObject<\n Properties<RemoveEdgeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveStepInputSchema(): z.ZodObject<\n Properties<RemoveStepInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveVariableInputSchema(): z.ZodObject<\n Properties<RemoveVariableInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RetryPolicySchema(): z.ZodObject<Properties<RetryPolicy>> {\n return z.object({\n __typename: z.literal(\"RetryPolicy\").optional(),\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function RevertToPublishedInputSchema(): z.ZodObject<\n Properties<RevertToPublishedInput>\n> {\n return z.object({\n _: z.boolean().nullish(),\n });\n}\n\nexport function SetLastRunInputSchema(): z.ZodObject<\n Properties<SetLastRunInput>\n> {\n return z.object({\n lastRunAt: z.iso.datetime(),\n lastRunStatus: RunStatusSchema,\n });\n}\n\nexport function SetLastTestInputSchema(): z.ZodObject<\n Properties<SetLastTestInput>\n> {\n return z.object({\n id: z.string(),\n runId: z.string(),\n testedAt: z.iso.datetime(),\n });\n}\n\nexport function SetPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyInput>\n> {\n return z.object({\n concurrency: ConcurrencyModeSchema.nullish(),\n defaultRetry: z.lazy(() => SetPolicyRetryPolicyInputSchema().nullish()),\n journalAsDocument: z.boolean().nullish(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number().nullish(),\n onFailure: FailureModeSchema.nullish(),\n retainRunsDays: z.number().nullish(),\n runTimeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function SetPolicyRetryPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function SetStepConfigInputSchema(): z.ZodObject<\n Properties<SetStepConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n id: z.string(),\n propertySettings: z\n .array(z.lazy(() => SetStepConfigPropertySettingInputSchema()))\n .nullish(),\n });\n}\n\nexport function SetStepConfigPropertySettingInputSchema(): z.ZodObject<\n Properties<SetStepConfigPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function SetTriggerInputSchema(): z.ZodObject<\n Properties<SetTriggerInput>\n> {\n return z.object({\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n propertySettings: z\n .array(z.lazy(() => SetTriggerPropertySettingInputSchema()))\n .nullish(),\n reactorConnectionId: z.string().nullish(),\n triggerName: z.string(),\n });\n}\n\nexport function SetTriggerPropertySettingInputSchema(): z.ZodObject<\n Properties<SetTriggerPropertySettingInput>\n> {\n return z.object({\n mode: PropertyModeSchema,\n prop: z.string(),\n schema: z.unknown().nullish(),\n });\n}\n\nexport function SetVariableInputSchema(): z.ZodObject<\n Properties<SetVariableInput>\n> {\n return z.object({\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n type: VariableTypeSchema.nullish(),\n value: z.unknown().nullish(),\n });\n}\n\nexport function SetWorkflowDescriptionInputSchema(): z.ZodObject<\n Properties<SetWorkflowDescriptionInput>\n> {\n return z.object({\n description: z.string().nullish(),\n });\n}\n\nexport function SetWorkflowNameInputSchema(): z.ZodObject<\n Properties<SetWorkflowNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetWorkflowStatusInputSchema(): z.ZodObject<\n Properties<SetWorkflowStatusInput>\n> {\n return z.object({\n status: WorkflowStatusSchema,\n });\n}\n\nexport function StepTestRecordSchema(): z.ZodObject<\n Properties<StepTestRecord>\n> {\n return z.object({\n __typename: z.literal(\"StepTestRecord\").optional(),\n runId: z.string(),\n testedAt: z.iso.datetime(),\n });\n}\n\nexport function TriggerBindingSchema(): z.ZodObject<\n Properties<TriggerBinding>\n> {\n return z.object({\n __typename: z.literal(\"TriggerBinding\").optional(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n lastTest: z.lazy(() => StepTestRecordSchema().nullish()),\n pieceName: z.string(),\n pieceVersion: z.string(),\n propertySettings: z.array(z.lazy(() => PropertySettingSchema())).nullish(),\n reactorConnectionId: z.string().nullish(),\n triggerName: z.string(),\n updatedAt: z.iso.datetime().nullish(),\n });\n}\n\nexport function UpdateStepInputSchema(): z.ZodObject<\n Properties<UpdateStepInput>\n> {\n return z.object({\n actionName: z.string().nullish(),\n config: z.unknown().nullish(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string().nullish(),\n name: z.string().nullish(),\n pieceName: z.string().nullish(),\n pieceVersion: z.string().nullish(),\n position: z.lazy(() => UpdateStepPositionInputSchema().nullish()),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => UpdateStepRetryPolicyInputSchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function UpdateStepPositionInputSchema(): z.ZodObject<\n Properties<UpdateStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function UpdateStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<UpdateStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function WorkflowEdgeSchema(): z.ZodObject<Properties<WorkflowEdge>> {\n return z.object({\n __typename: z.literal(\"WorkflowEdge\").optional(),\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function WorkflowPolicySchema(): z.ZodObject<\n Properties<WorkflowPolicy>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowPolicy\").optional(),\n concurrency: ConcurrencyModeSchema,\n defaultRetry: z.lazy(() => RetryPolicySchema()),\n journalAsDocument: z.boolean(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number(),\n onFailure: FailureModeSchema,\n retainRunsDays: z.number(),\n runTimeoutSeconds: z.number(),\n });\n}\n\nexport function WorkflowStateSchema(): z.ZodObject<Properties<WorkflowState>> {\n return z.object({\n __typename: z.literal(\"WorkflowState\").optional(),\n description: z.string().nullish(),\n edges: z.array(z.lazy(() => WorkflowEdgeSchema())),\n lastRunAt: z.iso.datetime().nullish(),\n lastRunStatus: RunStatusSchema.nullish(),\n name: z.string(),\n policy: z.lazy(() => WorkflowPolicySchema()),\n published: z.lazy(() => PublishedWorkflowSchema().nullish()),\n status: WorkflowStatusSchema,\n steps: z.array(z.lazy(() => WorkflowStepSchema())),\n trigger: z.lazy(() => TriggerBindingSchema().nullish()),\n variables: z.array(z.lazy(() => WorkflowVariableSchema())),\n version: z.number(),\n });\n}\n\nexport function WorkflowStepSchema(): z.ZodObject<Properties<WorkflowStep>> {\n return z.object({\n __typename: z.literal(\"WorkflowStep\").optional(),\n actionName: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n lastTest: z.lazy(() => StepTestRecordSchema().nullish()),\n name: z.string(),\n pieceName: z.string(),\n pieceVersion: z.string(),\n position: z.lazy(() => PointSchema().nullish()),\n propertySettings: z.array(z.lazy(() => PropertySettingSchema())).nullish(),\n reactorConnectionId: z.string().nullish(),\n retry: z.lazy(() => RetryPolicySchema().nullish()),\n skip: z.boolean().nullish(),\n timeoutSeconds: z.number().nullish(),\n updatedAt: z.iso.datetime().nullish(),\n });\n}\n\nexport function WorkflowVariableSchema(): z.ZodObject<\n Properties<WorkflowVariable>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowVariable\").optional(),\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n type: VariableTypeSchema.nullish(),\n value: z.unknown().nullish(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { AddEdgeInputSchema, RemoveEdgeInputSchema } from \"../schema/zod.js\";\nimport type { AddEdgeInput, RemoveEdgeInput } from \"../types.js\";\nimport type { AddEdgeAction, RemoveEdgeAction } from \"./actions.js\";\n\nexport const addEdge = (input: AddEdgeInput) =>\n createAction<AddEdgeAction>(\n \"ADD_EDGE\",\n { ...input },\n undefined,\n AddEdgeInputSchema,\n \"global\",\n );\n\nexport const removeEdge = (input: RemoveEdgeInput) =>\n createAction<RemoveEdgeAction>(\n \"REMOVE_EDGE\",\n { ...input },\n undefined,\n RemoveEdgeInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetPolicyInputSchema } from \"../schema/zod.js\";\nimport type { SetPolicyInput } from \"../types.js\";\nimport type { SetPolicyAction } from \"./actions.js\";\n\nexport const setPolicy = (input: SetPolicyInput) =>\n createAction<SetPolicyAction>(\n \"SET_POLICY\",\n { ...input },\n undefined,\n SetPolicyInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n PublishWorkflowInputSchema,\n RevertToPublishedInputSchema,\n} from \"../schema/zod.js\";\nimport type { PublishWorkflowInput, RevertToPublishedInput } from \"../types.js\";\nimport type {\n PublishWorkflowAction,\n RevertToPublishedAction,\n} from \"./actions.js\";\n\nexport const publishWorkflow = (input: PublishWorkflowInput) =>\n createAction<PublishWorkflowAction>(\n \"PUBLISH_WORKFLOW\",\n { ...input },\n undefined,\n PublishWorkflowInputSchema,\n \"global\",\n );\n\nexport const revertToPublished = (input: RevertToPublishedInput) =>\n createAction<RevertToPublishedAction>(\n \"REVERT_TO_PUBLISHED\",\n { ...input },\n undefined,\n RevertToPublishedInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetLastRunInputSchema,\n SetLastTestInputSchema,\n} from \"../schema/zod.js\";\nimport type { SetLastRunInput, SetLastTestInput } from \"../types.js\";\nimport type { SetLastRunAction, SetLastTestAction } from \"./actions.js\";\n\nexport const setLastRun = (input: SetLastRunInput) =>\n createAction<SetLastRunAction>(\n \"SET_LAST_RUN\",\n { ...input },\n undefined,\n SetLastRunInputSchema,\n \"global\",\n );\n\nexport const setLastTest = (input: SetLastTestInput) =>\n createAction<SetLastTestAction>(\n \"SET_LAST_TEST\",\n { ...input },\n undefined,\n SetLastTestInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddStepInputSchema,\n RemoveStepInputSchema,\n SetStepConfigInputSchema,\n UpdateStepInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddStepInput,\n RemoveStepInput,\n SetStepConfigInput,\n UpdateStepInput,\n} from \"../types.js\";\nimport type {\n AddStepAction,\n RemoveStepAction,\n SetStepConfigAction,\n UpdateStepAction,\n} from \"./actions.js\";\n\nexport const addStep = (input: AddStepInput) =>\n createAction<AddStepAction>(\n \"ADD_STEP\",\n { ...input },\n undefined,\n AddStepInputSchema,\n \"global\",\n );\n\nexport const updateStep = (input: UpdateStepInput) =>\n createAction<UpdateStepAction>(\n \"UPDATE_STEP\",\n { ...input },\n undefined,\n UpdateStepInputSchema,\n \"global\",\n );\n\nexport const removeStep = (input: RemoveStepInput) =>\n createAction<RemoveStepAction>(\n \"REMOVE_STEP\",\n { ...input },\n undefined,\n RemoveStepInputSchema,\n \"global\",\n );\n\nexport const setStepConfig = (input: SetStepConfigInput) =>\n createAction<SetStepConfigAction>(\n \"SET_STEP_CONFIG\",\n { ...input },\n undefined,\n SetStepConfigInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n ClearTriggerInputSchema,\n SetTriggerInputSchema,\n} from \"../schema/zod.js\";\nimport type { ClearTriggerInput, SetTriggerInput } from \"../types.js\";\nimport type { ClearTriggerAction, SetTriggerAction } from \"./actions.js\";\n\nexport const setTrigger = (input: SetTriggerInput) =>\n createAction<SetTriggerAction>(\n \"SET_TRIGGER\",\n { ...input },\n undefined,\n SetTriggerInputSchema,\n \"global\",\n );\n\nexport const clearTrigger = (input: ClearTriggerInput) =>\n createAction<ClearTriggerAction>(\n \"CLEAR_TRIGGER\",\n { ...input },\n undefined,\n ClearTriggerInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n RemoveVariableInputSchema,\n SetVariableInputSchema,\n} from \"../schema/zod.js\";\nimport type { RemoveVariableInput, SetVariableInput } from \"../types.js\";\nimport type { RemoveVariableAction, SetVariableAction } from \"./actions.js\";\n\nexport const setVariable = (input: SetVariableInput) =>\n createAction<SetVariableAction>(\n \"SET_VARIABLE\",\n { ...input },\n undefined,\n SetVariableInputSchema,\n \"global\",\n );\n\nexport const removeVariable = (input: RemoveVariableInput) =>\n createAction<RemoveVariableAction>(\n \"REMOVE_VARIABLE\",\n { ...input },\n undefined,\n RemoveVariableInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n} from \"../types.js\";\nimport type {\n SetWorkflowDescriptionAction,\n SetWorkflowNameAction,\n SetWorkflowStatusAction,\n} from \"./actions.js\";\n\nexport const setWorkflowName = (input: SetWorkflowNameInput) =>\n createAction<SetWorkflowNameAction>(\n \"SET_WORKFLOW_NAME\",\n { ...input },\n undefined,\n SetWorkflowNameInputSchema,\n \"global\",\n );\n\nexport const setWorkflowDescription = (input: SetWorkflowDescriptionInput) =>\n createAction<SetWorkflowDescriptionAction>(\n \"SET_WORKFLOW_DESCRIPTION\",\n { ...input },\n undefined,\n SetWorkflowDescriptionInputSchema,\n \"global\",\n );\n\nexport const setWorkflowStatus = (input: SetWorkflowStatusInput) =>\n createAction<SetWorkflowStatusAction>(\n \"SET_WORKFLOW_STATUS\",\n { ...input },\n undefined,\n SetWorkflowStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n workflowEdgesActions,\n workflowPolicyActions,\n workflowPublishingActions,\n workflowRuntimeActions,\n workflowStepsActions,\n workflowTriggerActions,\n workflowVariablesActions,\n workflowWorkflowActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Workflow document model */\n\nexport const actions = {\n ...baseActions,\n ...workflowWorkflowActions,\n ...workflowTriggerActions,\n ...workflowStepsActions,\n ...workflowEdgesActions,\n ...workflowVariablesActions,\n ...workflowPolicyActions,\n ...workflowRuntimeActions,\n ...workflowPublishingActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/workflow\",\n name: \"Workflow\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".flow\",\n description:\n \"Workflow definition: trigger, steps, edges, variables and execution policy for the Powerhouse workflow automation runtime.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum WorkflowStatus {\\n DRAFT\\n ENABLED\\n DISABLED\\n ARCHIVED\\n}\\n\\nenum RunStatus {\\n PENDING\\n RUNNING\\n WAITING\\n SUCCEEDED\\n FAILED\\n CANCELLED\\n PARKED\\n}\\n\\nenum ConcurrencyMode {\\n SINGLETON\\n QUEUE\\n PARALLEL\\n}\\n\\nenum FailureMode {\\n PARK\\n NOTIFY\\n IGNORE\\n}\\n\\nenum BackoffKind {\\n FIXED\\n EXPONENTIAL\\n}\\n\\ntype RetryPolicy {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n \"Error classes that are retryable. Everything else fails terminally on attempt 1.\"\\n retryOn: [String!]!\\n}\\n\\nenum PropertyMode {\\n \"The field\\'s own control.\"\\n MANUAL\\n \"The author switched the field to a free {{\\u2026}} expression.\"\\n EXPRESSION\\n}\\n\\ntype PropertySetting {\\n prop: String!\\n mode: PropertyMode!\\n \"Resolved DynamicProperties children, options stripped.\"\\n schema: Unknown\\n}\\n\\n\"Reference to the latest test run in the run store.\"\\ntype StepTestRecord {\\n runId: String!\\n testedAt: DateTime!\\n}\\n\\n\"Layout only. The runtime ignores it.\"\\ntype Point {\\n x: Float!\\n y: Float!\\n}\\n\\ntype TriggerBinding {\\n id: OID!\\n \"Package name of the trigger\\'s piece, e.g. \\'@powerhousedao/piece-core\\' or \\'@acme/piece-imap\\'.\"\\n pieceName: String!\\n \"Exact semver of the piece, e.g. \\'1.2.0\\'.\"\\n pieceVersion: String!\\n \"Trigger name within the piece, e.g. \\'schedule\\' or \\'new_message\\'.\"\\n triggerName: String!\\n \"Connection document id, when the trigger\\'s connector requires one.\"\\n connectionId: PHID\\n \"Reactor connection document id, when the trigger declares requireReactor.\"\\n reactorConnectionId: PHID\\n \"Validated against the trigger\\'s configSchema.\"\\n config: Unknown!\\n propertySettings: [PropertySetting!]\\n lastTest: StepTestRecord\\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\\n updatedAt: DateTime\\n}\\n\\ntype WorkflowStep {\\n id: OID!\\n \"Author-visible label; unique within the workflow; used in expressions.\"\\n key: String!\\n name: String!\\n \"Package name of the step\\'s piece, e.g. \\'@powerhousedao/piece-core\\' or \\'@activepieces/piece-http\\'.\"\\n pieceName: String!\\n \"Exact semver of the piece, e.g. \\'0.11.19\\'.\"\\n pieceVersion: String!\\n \"Action name within the piece, e.g. \\'branch\\' or \\'send_request\\'.\"\\n actionName: String!\\n connectionId: PHID\\n \"Reactor connection document id, when the action declares requireReactor.\"\\n reactorConnectionId: PHID\\n config: Unknown!\\n \"Per-step override of the workflow default retry policy.\"\\n retry: RetryPolicy\\n timeoutSeconds: Int\\n \"Expression yielding a stable key; two executions with the same key are one side effect.\"\\n idempotencyKeyExpression: String\\n position: Point\\n propertySettings: [PropertySetting!]\\n lastTest: StepTestRecord\\n \"Skipped steps are passed over at run time.\"\\n skip: Boolean\\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\\n updatedAt: DateTime\\n}\\n\\ntype WorkflowEdge {\\n id: OID!\\n \"Source step id, or the trigger id for the entry edge.\"\\n from: OID!\\n to: OID!\\n \"Output port of the source, one it declares: \\'next\\' and \\'error\\' for a piece action, \\'next\\' for the trigger, \\'true\\', \\'false\\' and \\'error\\' for a branch.\"\\n port: String!\\n \"Optional guard expression; the edge is taken only when it evaluates truthy.\"\\n condition: String\\n}\\n\\nenum VariableType {\\n TEXT\\n NUMBER\\n BOOLEAN\\n JSON\\n \"value is a secret-provider handle (the format of a connection SecretRef.ref), never the plaintext.\"\\n SECRET\\n}\\n\\ntype WorkflowVariable {\\n id: OID!\\n \"Name used in expressions.\"\\n key: String!\\n \"The value a run reads as variables.<key>.\"\\n value: Unknown\\n description: String\\n \"Null means untyped; consumers infer the kind of value it holds.\"\\n type: VariableType\\n}\\n\\ntype WorkflowPolicy {\\n \"SINGLETON drops a firing while a run is active; QUEUE serialises; PARALLEL runs concurrently.\"\\n concurrency: ConcurrencyMode!\\n maxParallelRuns: Int\\n runTimeoutSeconds: Int!\\n \"Bounds how long a run may stay suspended on a waitpoint.\"\\n maxSuspensionDays: Int!\\n defaultRetry: RetryPolicy!\\n \"What happens to a run whose steps have all failed terminally.\"\\n onFailure: FailureMode!\\n retainRunsDays: Int!\\n journalAsDocument: Boolean!\\n}\\n\\n\"Snapshot of the draft taken by PUBLISH_WORKFLOW.\"\\ntype PublishedWorkflow {\\n \"Draft version the snapshot was taken at.\"\\n version: Int!\\n publishedAt: DateTime!\\n trigger: TriggerBinding\\n steps: [WorkflowStep!]!\\n edges: [WorkflowEdge!]!\\n variables: [WorkflowVariable!]!\\n policy: WorkflowPolicy!\\n}\\n\\ntype WorkflowState {\\n name: String!\\n description: String\\n \"Only ENABLED workflows get trigger instances.\"\\n status: WorkflowStatus!\\n \"Bumped on every draft edit; REVERT_TO_PUBLISHED resets it to published.version. A run records the version it executed.\"\\n version: Int!\\n trigger: TriggerBinding\\n steps: [WorkflowStep!]!\\n edges: [WorkflowEdge!]!\\n variables: [WorkflowVariable!]!\\n policy: WorkflowPolicy!\\n \"Last published snapshot; version !== published.version means unpublished changes.\"\\n published: PublishedWorkflow\\n \"Denormalised for inspectors; written by the runtime.\"\\n lastRunAt: DateTime\\n lastRunStatus: RunStatus\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"description\": null,\\n \"status\": \"DRAFT\",\\n \"version\": 0,\\n \"trigger\": null,\\n \"steps\": [],\\n \"edges\": [],\\n \"variables\": [],\\n \"policy\": {\\n \"concurrency\": \"QUEUE\",\\n \"maxParallelRuns\": null,\\n \"runTimeoutSeconds\": 3600,\\n \"maxSuspensionDays\": 30,\\n \"defaultRetry\": {\\n \"maxAttempts\": 1,\\n \"backoff\": \"FIXED\",\\n \"initialDelaySeconds\": 5,\\n \"maxDelaySeconds\": 300,\\n \"retryOn\": []\\n },\\n \"onFailure\": \"PARK\",\\n \"retainRunsDays\": 30,\\n \"journalAsDocument\": false\\n },\\n \"published\": null,\\n \"lastRunAt\": null,\\n \"lastRunStatus\": null\\n}',\n },\n },\n modules: [\n {\n id: \"2bcbeac5-6a42-4dd7-ad9a-a11401acfa67\",\n name: \"workflow\",\n description: \"Workflow identity and lifecycle status.\",\n operations: [\n {\n id: \"63c4df18-df11-4f17-8afa-69da90129dd9\",\n name: \"SET_WORKFLOW_NAME\",\n description: \"Sets the workflow name.\",\n schema: \"input SetWorkflowNameInput {\\n name: String!\\n}\",\n template: \"Sets the workflow name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"2875c3ae-6fc6-4ebb-9274-6f8318227945\",\n name: \"SET_WORKFLOW_DESCRIPTION\",\n description: \"Sets or clears the workflow description.\",\n schema:\n \"input SetWorkflowDescriptionInput {\\n description: String\\n}\",\n template: \"Sets or clears the workflow description.\",\n reducer: \"state.description = action.input.description || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"6b4f8fb2-db70-4707-985d-47cff171dbec\",\n name: \"SET_WORKFLOW_STATUS\",\n description:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n schema:\n \"input SetWorkflowStatusInput {\\n status: WorkflowStatus!\\n}\",\n template:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n reducer: \"state.status = action.input.status;\",\n errors: [\n {\n id: \"ceb06c52-61b3-4c92-826f-9d2f87fb64d6\",\n name: \"WorkflowNotPublishedError\",\n code: \"WORKFLOW_NOT_PUBLISHED\",\n description:\n \"ENABLED needs a published snapshot; publish the workflow first.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e1dc35a8-a050-4773-a6a2-6b41f0a6210c\",\n name: \"trigger\",\n description: \"Binding of the workflow's single trigger.\",\n operations: [\n {\n id: \"f1f2ac35-7d6f-4b2c-b1a4-f220f290fdad\",\n name: \"SET_TRIGGER\",\n description:\n \"Sets or replaces the trigger binding. Omitted propertySettings and lastTest carry over when the id, piece, version and trigger name are unchanged.\",\n schema:\n \"input SetTriggerPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput SetTriggerInput {\\n id: OID!\\n pieceName: String!\\n pieceVersion: String!\\n triggerName: String!\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown!\\n propertySettings: [SetTriggerPropertySettingInput!]\\n}\",\n template:\n \"Sets or replaces the trigger binding. Omitted propertySettings and lastTest carry over when the id, piece, version and trigger name are unchanged.\",\n reducer:\n \"state.trigger = {\\n id: action.input.id,\\n pieceName: action.input.pieceName,\\n pieceVersion: action.input.pieceVersion,\\n triggerName: action.input.triggerName,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n filter: action.input.filter ?? null,\\n};\\nstate.version += 1;\",\n errors: [\n {\n id: \"2191e673-e5b7-4e27-921d-3534f95fc095\",\n name: \"InvalidTriggerBlockError\",\n code: \"INVALID_TRIGGER_BLOCK\",\n description:\n \"The trigger names no piece or trigger, or its piece version is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"cf3fced2-61c0-41a1-a0de-664ee00b2e25\",\n name: \"TriggerConfigNotObjectError\",\n code: \"TRIGGER_CONFIG_NOT_OBJECT\",\n description: \"The trigger's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"351e16a9-78c3-4466-a25f-e8b09eb0b956\",\n name: \"CLEAR_TRIGGER\",\n description: \"Removes the trigger binding.\",\n schema: \"input ClearTriggerInput {\\n _: Boolean\\n}\",\n template: \"Removes the trigger binding.\",\n reducer:\n 'if (!state.trigger) {\\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\\n}\\nstate.trigger = null;\\nstate.version += 1;',\n errors: [\n {\n id: \"fe485734-5e01-4af9-aaa9-adcc45e3160a\",\n name: \"TriggerNotSetError\",\n code: \"TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger binding to clear.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e3c8b542-657d-44b9-ad8c-472f8e01dbbf\",\n name: \"steps\",\n description: \"Step instances of blocks in the workflow graph.\",\n operations: [\n {\n id: \"d71c412f-9c48-4c1d-9d5b-f7c3cd18cecc\",\n name: \"ADD_STEP\",\n description: \"Adds a step to the workflow graph.\",\n schema:\n \"input AddStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput AddStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput AddStepPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput AddStepInput {\\n id: OID!\\n key: String!\\n name: String!\\n pieceName: String!\\n pieceVersion: String!\\n actionName: String!\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown!\\n retry: AddStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: AddStepPositionInput\\n skip: Boolean\\n propertySettings: [AddStepPropertySettingInput!]\\n}\",\n template: \"Adds a step to the workflow graph.\",\n reducer:\n 'if (state.steps.some((step) => step.id === action.input.id)) {\\n throw new DuplicateStepIdError(\"A step with this id already exists\");\\n}\\nif (state.steps.some((step) => step.key === action.input.key)) {\\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\\n}\\nstate.steps.push({\\n id: action.input.id,\\n key: action.input.key,\\n name: action.input.name,\\n pieceName: action.input.pieceName,\\n pieceVersion: action.input.pieceVersion,\\n actionName: action.input.actionName,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n retry: action.input.retry ?? null,\\n timeoutSeconds: action.input.timeoutSeconds ?? null,\\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\\n position: action.input.position ?? null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"9f42bbac-54a9-42bc-b6e6-86f158d1a474\",\n name: \"DuplicateStepIdError\",\n code: \"DUPLICATE_STEP_ID\",\n description: \"A step with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"e9ef62ad-2b63-43f7-ac25-b0ab81f833c5\",\n name: \"DuplicateStepKeyError\",\n code: \"DUPLICATE_STEP_KEY\",\n description: \"A step with the given key already exists.\",\n template: \"\",\n },\n {\n id: \"62bbe509-cb42-47b4-92a9-9f407cee5128\",\n name: \"InvalidStepBlockError\",\n code: \"INVALID_STEP_BLOCK\",\n description:\n \"The step names no piece or action, or its piece version is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"a802cfa8-43e7-4d4d-a1eb-13f6406dde63\",\n name: \"StepConfigNotObjectError\",\n code: \"STEP_CONFIG_NOT_OBJECT\",\n description: \"The new step's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"12b4dad9-4a89-4a94-b2ff-fadbf492f555\",\n name: \"UPDATE_STEP\",\n description: \"Updates the provided fields of an existing step.\",\n schema:\n \"input UpdateStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput UpdateStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput UpdateStepInput {\\n id: OID!\\n key: String\\n name: String\\n pieceName: String\\n pieceVersion: String\\n actionName: String\\n connectionId: PHID\\n reactorConnectionId: PHID\\n config: Unknown\\n retry: UpdateStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: UpdateStepPositionInput\\n skip: Boolean\\n}\",\n template: \"Updates the provided fields of an existing step.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new StepNotFoundError(\"Step not found\");\\n}\\nif (action.input.key) {\\n const conflict = state.steps.some(\\n (other) => other.key === action.input.key && other.id !== action.input.id,\\n );\\n if (conflict) {\\n throw new StepKeyConflictError(\"Another step already uses this key\");\\n }\\n step.key = action.input.key;\\n}\\nif (action.input.name) step.name = action.input.name;\\nif (action.input.pieceName) step.pieceName = action.input.pieceName;\\nif (action.input.pieceVersion) step.pieceVersion = action.input.pieceVersion;\\nif (action.input.actionName) step.actionName = action.input.actionName;\\nif (action.input.connectionId) step.connectionId = action.input.connectionId;\\nif (action.input.config !== undefined && action.input.config !== null) {\\n step.config = action.input.config;\\n}\\n// For the optional runtime fields null clears; undefined leaves as is.\\nif (action.input.retry !== undefined) {\\n step.retry = action.input.retry ?? null;\\n}\\nif (action.input.timeoutSeconds !== undefined) {\\n step.timeoutSeconds = action.input.timeoutSeconds ?? null;\\n}\\nif (action.input.idempotencyKeyExpression !== undefined) {\\n step.idempotencyKeyExpression = action.input.idempotencyKeyExpression || null;\\n}\\nif (action.input.position) step.position = action.input.position;\\nstate.version += 1;',\n errors: [\n {\n id: \"2f3f0a0b-555a-4350-86b4-5e7e86de8b8a\",\n name: \"StepNotFoundError\",\n code: \"STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n {\n id: \"74f45aaf-68ae-49a9-bd3c-d1e5a50b0ea3\",\n name: \"StepKeyConflictError\",\n code: \"STEP_KEY_CONFLICT\",\n description: \"Another step already uses the given key.\",\n template: \"\",\n },\n {\n id: \"3db35060-c54a-445d-9202-3613bf90c8f4\",\n name: \"InvalidUpdateBlockError\",\n code: \"INVALID_UPDATE_BLOCK\",\n description:\n \"The update leaves the step with no piece or action, or with a piece version that is not an exact semver.\",\n template: \"\",\n },\n {\n id: \"3841fa5a-d989-43d0-90fa-dfb224f3c463\",\n name: \"UpdateConfigNotObjectError\",\n code: \"UPDATE_CONFIG_NOT_OBJECT\",\n description: \"The step's new config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d01c89ca-3934-43b5-9540-9e45b415c772\",\n name: \"REMOVE_STEP\",\n description: \"Removes a step and every edge attached to it.\",\n schema: \"input RemoveStepInput {\\n id: OID!\\n}\",\n template: \"Removes a step and every edge attached to it.\",\n reducer:\n 'const index = state.steps.findIndex((step) => step.id === action.input.id);\\nif (index === -1) {\\n throw new RemoveStepNotFoundError(\"Step not found\");\\n}\\nstate.steps.splice(index, 1);\\nstate.edges = state.edges.filter(\\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\\n);\\nstate.version += 1;',\n errors: [\n {\n id: \"2bc5f26f-975b-46a0-9df9-1dbac5bbd6eb\",\n name: \"RemoveStepNotFoundError\",\n code: \"REMOVE_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"c83eb80e-8086-40e5-b8ed-fe3f72b664a6\",\n name: \"SET_STEP_CONFIG\",\n description:\n \"Replaces a step's block configuration, and optionally its property settings.\",\n schema:\n \"input SetStepConfigPropertySettingInput {\\n prop: String!\\n mode: PropertyMode!\\n schema: Unknown\\n}\\n\\ninput SetStepConfigInput {\\n id: OID!\\n config: Unknown!\\n propertySettings: [SetStepConfigPropertySettingInput!]\\n}\",\n template:\n \"Replaces a step's block configuration, and optionally its property settings.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new ConfigStepNotFoundError(\"Step not found\");\\n}\\nstep.config = action.input.config;\\nstate.version += 1;',\n errors: [\n {\n id: \"8ba30ce9-510e-4765-9955-23b4d76595ab\",\n name: \"ConfigStepNotFoundError\",\n code: \"CONFIG_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n {\n id: \"f6d05410-a1a8-4cab-8d7c-ea14506aa479\",\n name: \"SetConfigNotObjectError\",\n code: \"SET_CONFIG_NOT_OBJECT\",\n description: \"The step's config is not a JSON object.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"5f6223ad-23d1-4e2c-9680-8fd91234d785\",\n name: \"edges\",\n description: \"Directed edges between steps (and from the trigger).\",\n operations: [\n {\n id: \"293bcd32-7c85-42c9-846a-8c4ecde33154\",\n name: \"ADD_EDGE\",\n description:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n schema:\n \"input AddEdgeInput {\\n id: OID!\\n from: OID!\\n to: OID!\\n port: String!\\n condition: String\\n}\",\n template:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n reducer:\n 'if (state.edges.some((edge) => edge.id === action.input.id)) {\\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\\n}\\nconst fromExists =\\n state.steps.some((step) => step.id === action.input.from) ||\\n state.trigger?.id === action.input.from;\\nif (!fromExists) {\\n throw new EdgeSourceNotFoundError(\"Edge source step or trigger not found\");\\n}\\nif (!state.steps.some((step) => step.id === action.input.to)) {\\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\\n}\\nif (wouldCycle(state.edges, action.input.from, action.input.to)) {\\n throw new EdgeCycleError(\"Edge would create a cycle in the workflow graph\");\\n}\\nstate.edges.push({\\n id: action.input.id,\\n from: action.input.from,\\n to: action.input.to,\\n port: action.input.port,\\n condition: action.input.condition || null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"aa22b9b5-bbd7-4d80-b6b6-573c5f761ed7\",\n name: \"DuplicateEdgeIdError\",\n code: \"DUPLICATE_EDGE_ID\",\n description: \"An edge with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"5207d810-062d-4b83-82e3-e3f89d905a83\",\n name: \"EdgeSourceNotFoundError\",\n code: \"EDGE_SOURCE_NOT_FOUND\",\n description:\n \"The edge source references no existing step or trigger.\",\n template: \"\",\n },\n {\n id: \"39149b92-84b9-4429-a631-4d7e1981270c\",\n name: \"EdgeTargetNotFoundError\",\n code: \"EDGE_TARGET_NOT_FOUND\",\n description: \"The edge target references no existing step.\",\n template: \"\",\n },\n {\n id: \"6e4a5f2b-3c7d-4e19-9a2b-8d0c1f5e7a6b\",\n name: \"EdgeCycleError\",\n code: \"EDGE_CYCLE\",\n description:\n \"The edge would create a cycle in the workflow graph.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"ba545d3b-796d-4af3-b4c6-016401a691ff\",\n name: \"REMOVE_EDGE\",\n description: \"Removes an edge.\",\n schema: \"input RemoveEdgeInput {\\n id: OID!\\n}\",\n template: \"Removes an edge.\",\n reducer:\n 'const index = state.edges.findIndex((edge) => edge.id === action.input.id);\\nif (index === -1) {\\n throw new EdgeNotFoundError(\"Edge not found\");\\n}\\nstate.edges.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"b7e2ffa4-7775-460d-aae8-0d82dce5ffcf\",\n name: \"EdgeNotFoundError\",\n code: \"EDGE_NOT_FOUND\",\n description: \"No edge exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"c003c578-94fd-40d1-8964-ea151ee56486\",\n name: \"variables\",\n description: \"Workflow-level inputs and defaults.\",\n operations: [\n {\n id: \"50745ece-569a-4d49-b649-8ec2de3dd2d9\",\n name: \"SET_VARIABLE\",\n description:\n \"Creates the variable with this id, or updates it (its key included). Keys are unique.\",\n schema:\n 'input SetVariableInput {\\n id: OID!\\n key: String!\\n value: Unknown\\n description: String\\n \"Undefined leaves an existing variable\\'s type unchanged; null clears it.\"\\n type: VariableType\\n}',\n template: \"Creates or updates a variable, keyed by its key.\",\n reducer:\n \"const existing = state.variables.find(\\n (variable) => variable.key === action.input.key,\\n);\\nif (existing) {\\n existing.value = action.input.value ?? null;\\n if (action.input.description) existing.description = action.input.description;\\n} else {\\n state.variables.push({\\n id: action.input.id,\\n key: action.input.key,\\n value: action.input.value ?? null,\\n description: action.input.description || null,\\n });\\n}\\nstate.version += 1;\",\n errors: [\n {\n id: \"50fa86ce-2616-47d3-9e9a-225c63efc08c\",\n name: \"SecretVariableValueError\",\n code: \"SECRET_VARIABLE_VALUE\",\n description:\n \"A SECRET variable's value must be a secret reference string or null.\",\n template: \"\",\n },\n {\n id: \"868842e4-3df4-4e62-9b98-adf70cd1acbb\",\n name: \"DuplicateVariableKeyError\",\n code: \"DUPLICATE_VARIABLE_KEY\",\n description: \"Another variable already uses the given key.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d85b2b0a-085b-482e-a4be-401fa7e5faa2\",\n name: \"REMOVE_VARIABLE\",\n description: \"Removes a variable.\",\n schema: \"input RemoveVariableInput {\\n id: OID!\\n}\",\n template: \"Removes a variable.\",\n reducer:\n 'const index = state.variables.findIndex(\\n (variable) => variable.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new VariableNotFoundError(\"Variable not found\");\\n}\\nstate.variables.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"2b1913d2-6490-48f5-8bdb-5ec8e062c855\",\n name: \"VariableNotFoundError\",\n code: \"VARIABLE_NOT_FOUND\",\n description: \"No variable exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"956e2432-13b1-417a-b932-4286082ef7d4\",\n name: \"policy\",\n description: \"Execution policy for runs of this workflow.\",\n operations: [\n {\n id: \"e0a331e7-a4b0-4b93-8af7-d25e602932b8\",\n name: \"SET_POLICY\",\n description:\n \"Updates the provided fields of the execution policy.\",\n schema:\n \"input SetPolicyRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput SetPolicyInput {\\n concurrency: ConcurrencyMode\\n maxParallelRuns: Int\\n runTimeoutSeconds: Int\\n maxSuspensionDays: Int\\n defaultRetry: SetPolicyRetryPolicyInput\\n onFailure: FailureMode\\n retainRunsDays: Int\\n journalAsDocument: Boolean\\n}\",\n template: \"Updates the provided fields of the execution policy.\",\n reducer:\n \"if (action.input.concurrency) state.policy.concurrency = action.input.concurrency;\\nif (action.input.maxParallelRuns !== undefined && action.input.maxParallelRuns !== null) {\\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\\n}\\nif (action.input.runTimeoutSeconds !== undefined && action.input.runTimeoutSeconds !== null) {\\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\\n}\\nif (action.input.maxSuspensionDays !== undefined && action.input.maxSuspensionDays !== null) {\\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\\n}\\nif (action.input.defaultRetry) state.policy.defaultRetry = action.input.defaultRetry;\\nif (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\\nif (action.input.retainRunsDays !== undefined && action.input.retainRunsDays !== null) {\\n state.policy.retainRunsDays = action.input.retainRunsDays;\\n}\\nif (action.input.journalAsDocument !== undefined && action.input.journalAsDocument !== null) {\\n state.policy.journalAsDocument = action.input.journalAsDocument;\\n}\\nstate.version += 1;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"4c4656ac-62bb-498a-9a64-567a8e09ac09\",\n name: \"runtime\",\n description: \"Denormalised run info written by the workflow runtime.\",\n operations: [\n {\n id: \"cdaf7978-b846-4c3e-ae30-c5d87eac66a4\",\n name: \"SET_LAST_RUN\",\n description: \"Records the outcome of the most recent run.\",\n schema:\n \"input SetLastRunInput {\\n lastRunAt: DateTime!\\n lastRunStatus: RunStatus!\\n}\",\n template: \"Records the outcome of the most recent run.\",\n reducer:\n \"state.lastRunAt = action.input.lastRunAt;\\nstate.lastRunStatus = action.input.lastRunStatus;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"a370b78b-53b6-4344-9a92-a600d8eda77e\",\n name: \"SET_LAST_TEST\",\n description:\n \"Records the latest test run of a step or the trigger. Does not bump version.\",\n schema:\n 'input SetLastTestInput {\\n \"Step id or trigger id.\"\\n id: OID!\\n runId: String!\\n testedAt: DateTime!\\n}',\n template:\n \"Records the latest test run of a step or the trigger. Does not bump version.\",\n reducer: \"\",\n errors: [\n {\n id: \"53f18e15-1623-4cd0-8be4-44d4286d5eab\",\n name: \"LastTestTargetNotFoundError\",\n code: \"LAST_TEST_TARGET_NOT_FOUND\",\n description: \"No step or trigger exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"d08ad3f2-8985-4b36-baae-4b870407bba8\",\n name: \"publishing\",\n description: \"Draft versus published snapshot of the workflow.\",\n operations: [\n {\n id: \"a0cc29cc-259a-4bc8-814d-0847883700eb\",\n name: \"PUBLISH_WORKFLOW\",\n description:\n \"Snapshots the draft trigger, steps, edges, variables and policy into published at the current version.\",\n schema:\n \"input PublishWorkflowInput {\\n publishedAt: DateTime!\\n}\",\n template:\n \"Snapshots the draft trigger, steps, edges, variables and policy into published at the current version.\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"b4642462-2652-4a6e-a6ba-8e299d830d92\",\n name: \"REVERT_TO_PUBLISHED\",\n description:\n \"Replaces the draft with the published snapshot and resets version to published.version.\",\n schema: \"input RevertToPublishedInput {\\n _: Boolean\\n}\",\n template:\n \"Replaces the draft with the published snapshot and resets version to published.version.\",\n reducer: \"\",\n errors: [\n {\n id: \"f0056b3a-549d-4063-b8e5-2978279168e7\",\n name: \"NothingPublishedError\",\n code: \"NOTHING_PUBLISHED\",\n description: \"The workflow has never been published.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"DuplicateEdgeIdError\"\n | \"EdgeSourceNotFoundError\"\n | \"EdgeTargetNotFoundError\"\n | \"EdgeCycleError\"\n | \"EdgeNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateEdgeIdError extends Error implements ReducerError {\n errorCode = \"DuplicateEdgeIdError\" as ErrorCode;\n constructor(message = \"DuplicateEdgeIdError\") {\n super(message);\n }\n}\n\nexport class EdgeSourceNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeSourceNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeSourceNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeTargetNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeTargetNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeTargetNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeCycleError extends Error implements ReducerError {\n errorCode = \"EdgeCycleError\" as ErrorCode;\n constructor(message = \"EdgeCycleError\") {\n super(message);\n }\n}\n\nexport class EdgeNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddEdge: {\n DuplicateEdgeIdError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n EdgeCycleError,\n },\n\n RemoveEdge: { EdgeNotFoundError },\n};\n","import type {\n WorkflowEdge,\n WorkflowEdgesOperations,\n} from \"document-models/workflow/v1\";\nimport {\n DuplicateEdgeIdError,\n EdgeCycleError,\n EdgeNotFoundError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n} from \"../../gen/edges/error.js\";\n\n// True when `to` already reaches `from` via existing edges, i.e. the new\n// from->to edge would close a cycle (mirrors the editor's acyclicTargets).\nfunction wouldCycle(edges: WorkflowEdge[], from: string, to: string): boolean {\n const seen = new Set<string>([to]);\n const queue = [to];\n while (queue.length > 0) {\n const current = queue.pop()!;\n if (current === from) return true;\n for (const edge of edges) {\n if (edge.from === current && !seen.has(edge.to)) {\n seen.add(edge.to);\n queue.push(edge.to);\n }\n }\n }\n return false;\n}\n\nexport const workflowEdgesOperations: WorkflowEdgesOperations = {\n addEdgeOperation(state, action) {\n // Ports go unchecked: they are declared in descriptors, and a reducer has none.\n if (state.edges.some((edge) => edge.id === action.input.id)) {\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\n }\n const fromExists =\n state.steps.some((step) => step.id === action.input.from) ||\n state.trigger?.id === action.input.from;\n if (!fromExists) {\n throw new EdgeSourceNotFoundError(\n \"Edge source step or trigger not found\",\n );\n }\n if (!state.steps.some((step) => step.id === action.input.to)) {\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\n }\n if (wouldCycle(state.edges, action.input.from, action.input.to)) {\n throw new EdgeCycleError(\n \"Edge would create a cycle in the workflow graph\",\n );\n }\n state.edges.push({\n id: action.input.id,\n from: action.input.from,\n to: action.input.to,\n port: action.input.port,\n condition: action.input.condition || null,\n });\n state.version += 1;\n },\n removeEdgeOperation(state, action) {\n const index = state.edges.findIndex((edge) => edge.id === action.input.id);\n if (index === -1) {\n throw new EdgeNotFoundError(\"Edge not found\");\n }\n state.edges.splice(index, 1);\n state.version += 1;\n },\n};\n","import type { WorkflowPolicyOperations } from \"document-models/workflow/v1\";\n\nexport const workflowPolicyOperations: WorkflowPolicyOperations = {\n setPolicyOperation(state, action) {\n if (action.input.concurrency)\n state.policy.concurrency = action.input.concurrency;\n if (\n action.input.maxParallelRuns !== undefined &&\n action.input.maxParallelRuns !== null\n ) {\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\n }\n if (\n action.input.runTimeoutSeconds !== undefined &&\n action.input.runTimeoutSeconds !== null\n ) {\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\n }\n if (\n action.input.maxSuspensionDays !== undefined &&\n action.input.maxSuspensionDays !== null\n ) {\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\n }\n if (action.input.defaultRetry)\n state.policy.defaultRetry = action.input.defaultRetry;\n if (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\n if (\n action.input.retainRunsDays !== undefined &&\n action.input.retainRunsDays !== null\n ) {\n state.policy.retainRunsDays = action.input.retainRunsDays;\n }\n if (\n action.input.journalAsDocument !== undefined &&\n action.input.journalAsDocument !== null\n ) {\n state.policy.journalAsDocument = action.input.journalAsDocument;\n }\n state.version += 1;\n },\n};\n","export type ErrorCode = \"NothingPublishedError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class NothingPublishedError extends Error implements ReducerError {\n errorCode = \"NothingPublishedError\" as ErrorCode;\n constructor(message = \"NothingPublishedError\") {\n super(message);\n }\n}\n\nexport const errors = {\n RevertToPublished: { NothingPublishedError },\n};\n","import { isExactVersion } from \"@powerhousedao/pieces-framework/block-type\";\nimport type {\n PropertyMode,\n PropertySetting,\n TriggerBinding,\n WorkflowGlobalState,\n WorkflowStep,\n} from \"../gen/types.js\";\n\n// Why a block reference can't be stored, or undefined when it can: every\n// block names its piece and itself, and pins an exact piece version.\nexport function invalidBlock(\n kind: \"action\" | \"trigger\",\n block: {\n pieceName?: string | null;\n pieceVersion?: string | null;\n name?: string | null;\n },\n): string | undefined {\n if (!block.pieceName) return `The ${kind} names no piece`;\n if (!block.name) return `The ${kind} names no ${kind} of ${block.pieceName}`;\n if (!block.pieceVersion || !isExactVersion(block.pieceVersion)) {\n return `\"${block.pieceVersion ?? \"\"}\" is not an exact semver version of ${block.pieceName}`;\n }\n return undefined;\n}\n\nexport function findStepOrTrigger(\n state: WorkflowGlobalState,\n id: string,\n): WorkflowStep | TriggerBinding | undefined {\n if (state.trigger?.id === id) return state.trigger;\n return state.steps.find((step) => step.id === id);\n}\n\nexport function toPropertySettings(\n input: readonly { prop: string; mode: PropertyMode; schema?: unknown }[],\n): PropertySetting[] {\n return input.map((setting) => ({\n prop: setting.prop,\n mode: setting.mode,\n schema: setting.schema ?? null,\n }));\n}\n\n// Plain copy that is safe to take from an immer draft.\nexport function cloneJson<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\n// Block config is always a JSON object: a string or array is a writer's bug.\nexport function isConfigObject(config: unknown): boolean {\n return (\n config !== null && typeof config === \"object\" && !Array.isArray(config)\n );\n}\n","import type { WorkflowPublishingOperations } from \"document-models/workflow/v1\";\nimport { NothingPublishedError } from \"../../gen/publishing/error.js\";\nimport { cloneJson } from \"../helpers.js\";\n\nexport const workflowPublishingOperations: WorkflowPublishingOperations = {\n publishWorkflowOperation(state, action) {\n state.published = cloneJson({\n version: state.version,\n publishedAt: action.input.publishedAt,\n trigger: state.trigger,\n steps: state.steps,\n edges: state.edges,\n variables: state.variables,\n policy: state.policy,\n });\n },\n revertToPublishedOperation(state, _action) {\n if (!state.published) {\n throw new NothingPublishedError(\"Workflow has never been published\");\n }\n const snapshot = cloneJson(state.published);\n state.trigger = snapshot.trigger;\n state.steps = snapshot.steps;\n state.edges = snapshot.edges;\n state.variables = snapshot.variables;\n state.policy = snapshot.policy;\n state.version = snapshot.version;\n },\n};\n","export type ErrorCode = \"LastTestTargetNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class LastTestTargetNotFoundError extends Error implements ReducerError {\n errorCode = \"LastTestTargetNotFoundError\" as ErrorCode;\n constructor(message = \"LastTestTargetNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetLastTest: { LastTestTargetNotFoundError },\n};\n","import type { WorkflowRuntimeOperations } from \"document-models/workflow/v1\";\nimport { LastTestTargetNotFoundError } from \"../../gen/runtime/error.js\";\nimport { findStepOrTrigger } from \"../helpers.js\";\n\nexport const workflowRuntimeOperations: WorkflowRuntimeOperations = {\n setLastRunOperation(state, action) {\n state.lastRunAt = action.input.lastRunAt;\n state.lastRunStatus = action.input.lastRunStatus;\n },\n setLastTestOperation(state, action) {\n const target = findStepOrTrigger(state, action.input.id);\n if (!target) {\n throw new LastTestTargetNotFoundError(\"Step or trigger not found\");\n }\n target.lastTest = {\n runId: action.input.runId,\n testedAt: action.input.testedAt,\n };\n },\n};\n","export type ErrorCode =\n | \"DuplicateStepIdError\"\n | \"DuplicateStepKeyError\"\n | \"InvalidStepBlockError\"\n | \"StepConfigNotObjectError\"\n | \"StepNotFoundError\"\n | \"StepKeyConflictError\"\n | \"InvalidUpdateBlockError\"\n | \"UpdateConfigNotObjectError\"\n | \"RemoveStepNotFoundError\"\n | \"ConfigStepNotFoundError\"\n | \"SetConfigNotObjectError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateStepIdError extends Error implements ReducerError {\n errorCode = \"DuplicateStepIdError\" as ErrorCode;\n constructor(message = \"DuplicateStepIdError\") {\n super(message);\n }\n}\n\nexport class DuplicateStepKeyError extends Error implements ReducerError {\n errorCode = \"DuplicateStepKeyError\" as ErrorCode;\n constructor(message = \"DuplicateStepKeyError\") {\n super(message);\n }\n}\n\nexport class InvalidStepBlockError extends Error implements ReducerError {\n errorCode = \"InvalidStepBlockError\" as ErrorCode;\n constructor(message = \"InvalidStepBlockError\") {\n super(message);\n }\n}\n\nexport class StepConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"StepConfigNotObjectError\" as ErrorCode;\n constructor(message = \"StepConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class StepNotFoundError extends Error implements ReducerError {\n errorCode = \"StepNotFoundError\" as ErrorCode;\n constructor(message = \"StepNotFoundError\") {\n super(message);\n }\n}\n\nexport class StepKeyConflictError extends Error implements ReducerError {\n errorCode = \"StepKeyConflictError\" as ErrorCode;\n constructor(message = \"StepKeyConflictError\") {\n super(message);\n }\n}\n\nexport class InvalidUpdateBlockError extends Error implements ReducerError {\n errorCode = \"InvalidUpdateBlockError\" as ErrorCode;\n constructor(message = \"InvalidUpdateBlockError\") {\n super(message);\n }\n}\n\nexport class UpdateConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"UpdateConfigNotObjectError\" as ErrorCode;\n constructor(message = \"UpdateConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class RemoveStepNotFoundError extends Error implements ReducerError {\n errorCode = \"RemoveStepNotFoundError\" as ErrorCode;\n constructor(message = \"RemoveStepNotFoundError\") {\n super(message);\n }\n}\n\nexport class ConfigStepNotFoundError extends Error implements ReducerError {\n errorCode = \"ConfigStepNotFoundError\" as ErrorCode;\n constructor(message = \"ConfigStepNotFoundError\") {\n super(message);\n }\n}\n\nexport class SetConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"SetConfigNotObjectError\" as ErrorCode;\n constructor(message = \"SetConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddStep: {\n DuplicateStepIdError,\n DuplicateStepKeyError,\n InvalidStepBlockError,\n StepConfigNotObjectError,\n },\n\n UpdateStep: {\n StepNotFoundError,\n StepKeyConflictError,\n InvalidUpdateBlockError,\n UpdateConfigNotObjectError,\n },\n\n RemoveStep: { RemoveStepNotFoundError },\n\n SetStepConfig: { ConfigStepNotFoundError, SetConfigNotObjectError },\n};\n","import type { WorkflowStepsOperations } from \"document-models/workflow/v1\";\nimport {\n ConfigStepNotFoundError,\n DuplicateStepIdError,\n DuplicateStepKeyError,\n InvalidStepBlockError,\n InvalidUpdateBlockError,\n RemoveStepNotFoundError,\n SetConfigNotObjectError,\n StepConfigNotObjectError,\n StepKeyConflictError,\n StepNotFoundError,\n UpdateConfigNotObjectError,\n} from \"../../gen/steps/error.js\";\nimport {\n invalidBlock,\n isConfigObject,\n toPropertySettings,\n} from \"../helpers.js\";\n\nexport const workflowStepsOperations: WorkflowStepsOperations = {\n addStepOperation(state, action) {\n if (state.steps.some((step) => step.id === action.input.id)) {\n throw new DuplicateStepIdError(\"A step with this id already exists\");\n }\n if (state.steps.some((step) => step.key === action.input.key)) {\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\n }\n const invalid = invalidBlock(\"action\", {\n pieceName: action.input.pieceName,\n pieceVersion: action.input.pieceVersion,\n name: action.input.actionName,\n });\n if (invalid) throw new InvalidStepBlockError(invalid);\n if (!isConfigObject(action.input.config)) {\n throw new StepConfigNotObjectError(\"A step config must be an object\");\n }\n state.steps.push({\n id: action.input.id,\n key: action.input.key,\n name: action.input.name,\n pieceName: action.input.pieceName,\n pieceVersion: action.input.pieceVersion,\n actionName: action.input.actionName,\n connectionId: action.input.connectionId || null,\n reactorConnectionId: action.input.reactorConnectionId || null,\n config: action.input.config,\n retry: action.input.retry ?? null,\n timeoutSeconds: action.input.timeoutSeconds ?? null,\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\n position: action.input.position ?? null,\n propertySettings: action.input.propertySettings\n ? toPropertySettings(action.input.propertySettings)\n : null,\n lastTest: null,\n skip: action.input.skip ?? null,\n updatedAt: action.timestampUtcMs,\n });\n state.version += 1;\n },\n updateStepOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new StepNotFoundError(\"Step not found\");\n }\n // Null or undefined leaves a field as it is; the result must still be valid.\n const pieceName = action.input.pieceName ?? step.pieceName;\n const pieceVersion = action.input.pieceVersion ?? step.pieceVersion;\n const actionName = action.input.actionName ?? step.actionName;\n const invalid = invalidBlock(\"action\", {\n pieceName,\n pieceVersion,\n name: actionName,\n });\n if (invalid) throw new InvalidUpdateBlockError(invalid);\n const { config } = action.input;\n if (config !== undefined && config !== null && !isConfigObject(config)) {\n throw new UpdateConfigNotObjectError(\"A step config must be an object\");\n }\n if (action.input.key) {\n const conflict = state.steps.some(\n (other) =>\n other.key === action.input.key && other.id !== action.input.id,\n );\n if (conflict) {\n throw new StepKeyConflictError(\"Another step already uses this key\");\n }\n step.key = action.input.key;\n }\n if (action.input.name) step.name = action.input.name;\n step.pieceName = pieceName;\n step.pieceVersion = pieceVersion;\n step.actionName = actionName;\n // null clears a connection; undefined leaves it unchanged.\n if (action.input.connectionId !== undefined)\n step.connectionId = action.input.connectionId || null;\n if (action.input.reactorConnectionId !== undefined)\n step.reactorConnectionId = action.input.reactorConnectionId || null;\n if (action.input.config !== undefined && action.input.config !== null) {\n step.config = action.input.config;\n }\n // For the optional runtime fields null clears; undefined leaves as is.\n if (action.input.retry !== undefined) {\n step.retry = action.input.retry ?? null;\n }\n if (action.input.timeoutSeconds !== undefined) {\n step.timeoutSeconds = action.input.timeoutSeconds ?? null;\n }\n if (action.input.idempotencyKeyExpression !== undefined) {\n step.idempotencyKeyExpression =\n action.input.idempotencyKeyExpression || null;\n }\n if (action.input.position !== undefined) {\n step.position = action.input.position ?? null;\n }\n if (action.input.skip !== undefined) {\n step.skip = action.input.skip ?? null;\n }\n step.updatedAt = action.timestampUtcMs;\n state.version += 1;\n },\n removeStepOperation(state, action) {\n const index = state.steps.findIndex((step) => step.id === action.input.id);\n if (index === -1) {\n throw new RemoveStepNotFoundError(\"Step not found\");\n }\n state.steps.splice(index, 1);\n state.edges = state.edges.filter(\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\n );\n state.version += 1;\n },\n setStepConfigOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new ConfigStepNotFoundError(\"Step not found\");\n }\n if (!isConfigObject(action.input.config)) {\n throw new SetConfigNotObjectError(\"A step config must be an object\");\n }\n if (JSON.stringify(step.config) !== JSON.stringify(action.input.config)) {\n step.updatedAt = action.timestampUtcMs;\n }\n step.config = action.input.config;\n // Undefined leaves the settings unchanged; null clears them.\n if (action.input.propertySettings !== undefined) {\n step.propertySettings = action.input.propertySettings\n ? toPropertySettings(action.input.propertySettings)\n : null;\n }\n state.version += 1;\n },\n};\n","export type ErrorCode =\n | \"InvalidTriggerBlockError\"\n | \"TriggerConfigNotObjectError\"\n | \"TriggerNotSetError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidTriggerBlockError extends Error implements ReducerError {\n errorCode = \"InvalidTriggerBlockError\" as ErrorCode;\n constructor(message = \"InvalidTriggerBlockError\") {\n super(message);\n }\n}\n\nexport class TriggerConfigNotObjectError extends Error implements ReducerError {\n errorCode = \"TriggerConfigNotObjectError\" as ErrorCode;\n constructor(message = \"TriggerConfigNotObjectError\") {\n super(message);\n }\n}\n\nexport class TriggerNotSetError extends Error implements ReducerError {\n errorCode = \"TriggerNotSetError\" as ErrorCode;\n constructor(message = \"TriggerNotSetError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetTrigger: { InvalidTriggerBlockError, TriggerConfigNotObjectError },\n\n ClearTrigger: { TriggerNotSetError },\n};\n","import type { WorkflowTriggerOperations } from \"document-models/workflow/v1\";\nimport {\n InvalidTriggerBlockError,\n TriggerConfigNotObjectError,\n TriggerNotSetError,\n} from \"../../gen/trigger/error.js\";\nimport {\n invalidBlock,\n isConfigObject,\n toPropertySettings,\n} from \"../helpers.js\";\n\nexport const workflowTriggerOperations: WorkflowTriggerOperations = {\n setTriggerOperation(state, action) {\n const { input } = action;\n const invalid = invalidBlock(\"trigger\", {\n pieceName: input.pieceName,\n pieceVersion: input.pieceVersion,\n name: input.triggerName,\n });\n if (invalid) throw new InvalidTriggerBlockError(invalid);\n if (!isConfigObject(input.config)) {\n throw new TriggerConfigNotObjectError(\n \"The trigger config must be an object\",\n );\n }\n // Same binding: omitted settings and last test carry over.\n const current = state.trigger;\n const previous =\n current &&\n current.id === input.id &&\n current.pieceName === input.pieceName &&\n current.pieceVersion === input.pieceVersion &&\n current.triggerName === input.triggerName\n ? current\n : null;\n state.trigger = {\n id: input.id,\n pieceName: input.pieceName,\n pieceVersion: input.pieceVersion,\n triggerName: input.triggerName,\n connectionId: input.connectionId || null,\n reactorConnectionId: input.reactorConnectionId || null,\n config: input.config,\n propertySettings:\n input.propertySettings === undefined\n ? (previous?.propertySettings ?? null)\n : input.propertySettings\n ? toPropertySettings(input.propertySettings)\n : null,\n lastTest: previous?.lastTest ?? null,\n updatedAt: action.timestampUtcMs,\n };\n state.version += 1;\n },\n clearTriggerOperation(state, _action) {\n if (!state.trigger) {\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\n }\n const triggerId = state.trigger.id;\n state.trigger = null;\n state.edges = state.edges.filter((edge) => edge.from !== triggerId);\n state.version += 1;\n },\n};\n","export type ErrorCode =\n | \"SecretVariableValueError\"\n | \"DuplicateVariableKeyError\"\n | \"VariableNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class SecretVariableValueError extends Error implements ReducerError {\n errorCode = \"SecretVariableValueError\" as ErrorCode;\n constructor(message = \"SecretVariableValueError\") {\n super(message);\n }\n}\n\nexport class DuplicateVariableKeyError extends Error implements ReducerError {\n errorCode = \"DuplicateVariableKeyError\" as ErrorCode;\n constructor(message = \"DuplicateVariableKeyError\") {\n super(message);\n }\n}\n\nexport class VariableNotFoundError extends Error implements ReducerError {\n errorCode = \"VariableNotFoundError\" as ErrorCode;\n constructor(message = \"VariableNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetVariable: { SecretVariableValueError, DuplicateVariableKeyError },\n\n RemoveVariable: { VariableNotFoundError },\n};\n","import type { WorkflowVariablesOperations } from \"document-models/workflow/v1\";\nimport {\n DuplicateVariableKeyError,\n SecretVariableValueError,\n VariableNotFoundError,\n} from \"../../gen/variables/error.js\";\n\nexport const workflowVariablesOperations: WorkflowVariablesOperations = {\n setVariableOperation(state, action) {\n // Upserted by id; the key may change, but no two variables share one.\n const existing = state.variables.find(\n (variable) => variable.id === action.input.id,\n );\n const taken = state.variables.some(\n (variable) =>\n variable.key === action.input.key && variable.id !== action.input.id,\n );\n if (taken) {\n throw new DuplicateVariableKeyError(\n `Another variable already uses the key \"${action.input.key}\"`,\n );\n }\n const value = action.input.value ?? null;\n const type =\n action.input.type === undefined\n ? (existing?.type ?? null)\n : action.input.type;\n if (type === \"SECRET\" && value !== null && typeof value !== \"string\") {\n throw new SecretVariableValueError(\n \"A SECRET variable's value must be a secret reference string\",\n );\n }\n if (existing) {\n existing.key = action.input.key;\n existing.value = value;\n existing.type = type;\n // Undefined leaves it unchanged; an explicit null or \"\" clears it.\n if (action.input.description !== undefined) {\n existing.description = action.input.description || null;\n }\n } else {\n state.variables.push({\n id: action.input.id,\n key: action.input.key,\n value,\n description: action.input.description || null,\n type,\n });\n }\n state.version += 1;\n },\n removeVariableOperation(state, action) {\n const index = state.variables.findIndex(\n (variable) => variable.id === action.input.id,\n );\n if (index === -1) {\n throw new VariableNotFoundError(\"Variable not found\");\n }\n state.variables.splice(index, 1);\n state.version += 1;\n },\n};\n","export type ErrorCode = \"WorkflowNotPublishedError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class WorkflowNotPublishedError extends Error implements ReducerError {\n errorCode = \"WorkflowNotPublishedError\" as ErrorCode;\n constructor(message = \"WorkflowNotPublishedError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetWorkflowStatus: { WorkflowNotPublishedError },\n};\n","import type { WorkflowWorkflowOperations } from \"document-models/workflow/v1\";\nimport { WorkflowNotPublishedError } from \"../../gen/workflow/error.js\";\n\nexport const workflowWorkflowOperations: WorkflowWorkflowOperations = {\n setWorkflowNameOperation(state, action) {\n state.name = action.input.name;\n },\n setWorkflowDescriptionOperation(state, action) {\n state.description = action.input.description || null;\n },\n setWorkflowStatusOperation(state, action) {\n // Runs execute the published snapshot, so there must be one to run.\n if (action.input.status === \"ENABLED\" && !state.published) {\n throw new WorkflowNotPublishedError(\n \"Publish the workflow before enabling it\",\n );\n }\n state.status = action.input.status;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { WorkflowPHState } from \"document-models/workflow/v1\";\n\nimport { workflowEdgesOperations } from \"../src/reducers/edges.js\";\nimport { workflowPolicyOperations } from \"../src/reducers/policy.js\";\nimport { workflowPublishingOperations } from \"../src/reducers/publishing.js\";\nimport { workflowRuntimeOperations } from \"../src/reducers/runtime.js\";\nimport { workflowStepsOperations } from \"../src/reducers/steps.js\";\nimport { workflowTriggerOperations } from \"../src/reducers/trigger.js\";\nimport { workflowVariablesOperations } from \"../src/reducers/variables.js\";\nimport { workflowWorkflowOperations } from \"../src/reducers/workflow.js\";\n\nimport {\n AddEdgeInputSchema,\n AddStepInputSchema,\n ClearTriggerInputSchema,\n PublishWorkflowInputSchema,\n RemoveEdgeInputSchema,\n RemoveStepInputSchema,\n RemoveVariableInputSchema,\n RevertToPublishedInputSchema,\n SetLastRunInputSchema,\n SetLastTestInputSchema,\n SetPolicyInputSchema,\n SetStepConfigInputSchema,\n SetTriggerInputSchema,\n SetVariableInputSchema,\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n UpdateStepInputSchema,\n} from \"./schema/zod.js\";\n\nconst schemaMemo = new Map<() => unknown, unknown>();\n\nfunction memoizedSchema<T>(makeSchema: () => T): T {\n let schema = schemaMemo.get(makeSchema) as T | undefined;\n if (schema === undefined) {\n schema = makeSchema();\n schemaMemo.set(makeSchema, schema);\n }\n return schema;\n}\n\nconst stateReducer: StateReducer<WorkflowPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_WORKFLOW_NAME\": {\n memoizedSchema(SetWorkflowNameInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_DESCRIPTION\": {\n memoizedSchema(SetWorkflowDescriptionInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowDescriptionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_STATUS\": {\n memoizedSchema(SetWorkflowStatusInputSchema).parse(action.input);\n\n workflowWorkflowOperations.setWorkflowStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER\": {\n memoizedSchema(SetTriggerInputSchema).parse(action.input);\n\n workflowTriggerOperations.setTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"CLEAR_TRIGGER\": {\n memoizedSchema(ClearTriggerInputSchema).parse(action.input);\n\n workflowTriggerOperations.clearTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_STEP\": {\n memoizedSchema(AddStepInputSchema).parse(action.input);\n\n workflowStepsOperations.addStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"UPDATE_STEP\": {\n memoizedSchema(UpdateStepInputSchema).parse(action.input);\n\n workflowStepsOperations.updateStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_STEP\": {\n memoizedSchema(RemoveStepInputSchema).parse(action.input);\n\n workflowStepsOperations.removeStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_STEP_CONFIG\": {\n memoizedSchema(SetStepConfigInputSchema).parse(action.input);\n\n workflowStepsOperations.setStepConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_EDGE\": {\n memoizedSchema(AddEdgeInputSchema).parse(action.input);\n\n workflowEdgesOperations.addEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_EDGE\": {\n memoizedSchema(RemoveEdgeInputSchema).parse(action.input);\n\n workflowEdgesOperations.removeEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_VARIABLE\": {\n memoizedSchema(SetVariableInputSchema).parse(action.input);\n\n workflowVariablesOperations.setVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_VARIABLE\": {\n memoizedSchema(RemoveVariableInputSchema).parse(action.input);\n\n workflowVariablesOperations.removeVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_POLICY\": {\n memoizedSchema(SetPolicyInputSchema).parse(action.input);\n\n workflowPolicyOperations.setPolicyOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_LAST_RUN\": {\n memoizedSchema(SetLastRunInputSchema).parse(action.input);\n\n workflowRuntimeOperations.setLastRunOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_LAST_TEST\": {\n memoizedSchema(SetLastTestInputSchema).parse(action.input);\n\n workflowRuntimeOperations.setLastTestOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"PUBLISH_WORKFLOW\": {\n memoizedSchema(PublishWorkflowInputSchema).parse(action.input);\n\n workflowPublishingOperations.publishWorkflowOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REVERT_TO_PUBLISHED\": {\n memoizedSchema(RevertToPublishedInputSchema).parse(action.input);\n\n workflowPublishingOperations.revertToPublishedOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<WorkflowPHState> = createReducer(stateReducer);\n","export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from \"document-model\";\nimport { latestVersion, supportedVersions } from \"./versions.js\";\n\nexport const workflowUpgradeManifest: UpgradeManifest<\n typeof supportedVersions\n> = {\n documentType: \"powerhouse/workflow\",\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const workflowDocumentType = \"powerhouse/workflow\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { WorkflowStateSchema } from \"./schema/zod.js\";\nimport type { WorkflowDocument, WorkflowPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a Workflow document */\nexport const WorkflowDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(workflowDocumentType),\n});\n\n/** Schema for validating the state object of a Workflow document */\nexport const WorkflowPHStateSchema = BaseDocumentStateSchema.extend({\n global: WorkflowStateSchema(),\n});\n\nexport const WorkflowDocumentSchema = z.object({\n header: WorkflowDocumentHeaderSchema,\n state: WorkflowPHStateSchema,\n initialState: WorkflowPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a Workflow document state object */\nexport function isWorkflowState(state: unknown): state is WorkflowPHState {\n return WorkflowPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a Workflow document state object */\nexport function assertIsWorkflowState(\n state: unknown,\n): asserts state is WorkflowPHState {\n WorkflowPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a Workflow document */\nexport function isWorkflowDocument(\n document: unknown,\n): document is WorkflowDocument {\n return WorkflowDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a Workflow document */\nexport function assertIsWorkflowDocument(\n document: unknown,\n): asserts document is WorkflowDocument {\n WorkflowDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInputVersioned,\n baseSaveToFileHandle,\n createBaseState,\n} from \"document-model\";\nimport { workflowUpgradeManifest } from \"../../upgrades/upgrade-manifest.js\";\nimport {\n assertIsWorkflowDocument,\n assertIsWorkflowState,\n isWorkflowDocument,\n isWorkflowState,\n} from \"./document-schema.js\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n WorkflowGlobalState,\n WorkflowLocalState,\n WorkflowPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: WorkflowGlobalState = {\n name: \"\",\n description: null,\n status: \"DRAFT\",\n version: 0,\n trigger: null,\n steps: [],\n edges: [],\n variables: [],\n policy: {\n concurrency: \"QUEUE\",\n maxParallelRuns: null,\n runTimeoutSeconds: 3600,\n maxSuspensionDays: 30,\n defaultRetry: {\n maxAttempts: 1,\n backoff: \"FIXED\",\n initialDelaySeconds: 5,\n maxDelaySeconds: 300,\n retryOn: [],\n },\n onFailure: \"PARK\",\n retainRunsDays: 30,\n journalAsDocument: false,\n },\n published: null,\n lastRunAt: null,\n lastRunStatus: null,\n};\nexport const initialLocalState: WorkflowLocalState = {};\n\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n fileExtension: \".flow\",\n createState(state) {\n return {\n ...createBaseState(state?.auth, { version: 1, ...state?.document }),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, workflowDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: workflowUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isWorkflowState(state);\n },\n assertIsStateOfType(state) {\n return assertIsWorkflowState(state);\n },\n isDocumentOfType(document) {\n return isWorkflowDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsWorkflowDocument(document);\n },\n};\n","export {};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the Workflow document model */\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the Workflow document type */\nexport const Workflow = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<WorkflowPHState>;\n"],"mappings":";;;;;AACA,MAAM,SAAS;AACf,SAAS,eAAe,SAAS;CAChC,OAAO,OAAO,KAAK,OAAO;AAC3B;AACA,SAAS,SA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IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aACE;MACF,UAAU;KACZ,GACA;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ;OACN;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aACE;QACF,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;MACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ;OACN;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aACE;QACF,UAAU;OACZ;OACA;QACE,IAAI;QACJ,MAAM;QACN,MAAM;QACN,aAAa;QACb,UAAU;OACZ;MACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SACE;KACF,QAAQ;MACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;KACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aACE;MACF,UAAU;KACZ,GACA;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SAAS;KACT,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UACE;KACF,SAAS;KACT,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,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iB;EACnB,CAAC;CACH;CACA,cAAc,OAAO;EACnB,OAAO,gBAAgB,KAAK;CAC9B;CACA,oBAAoB,OAAO;EACzB,OAAO,sBAAsB,KAAK;CACpC;CACA,iBAAiB,UAAU;EACzB,OAAO,mBAAmB,QAAQ;CACpC;CACA,uBAAuB,UAAU;EAC/B,OAAO,yBAAyB,QAAQ;CAC1C;AACF;;;;;;;AEhFA,MAAa,QAA6C;CACxD,GAAGC;CACH,GAAGC;AACL;;;;ACAA,MAAa,WAAW;CACtB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
@@ -1,5 +1,5 @@
1
- import { n as powerhouse_manifest_default, t as documentModels } from "../document-models-C1ZgIZyV.js";
2
- import { t as upgradeManifests } from "../upgrade-manifests-BpakVE9l.js";
1
+ import { n as powerhouse_manifest_default, t as documentModels } from "../document-models-B7IwLbfO.js";
2
+ import { t as upgradeManifests } from "../upgrade-manifests-C_9cyumV.js";
3
3
  //#region reactor/index.ts
4
4
  const manifest = powerhouse_manifest_default;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Rt as blockKey } from "./module-DU2vb3FH.js";
1
+ import { Rt as blockKey } from "./module-D4UiG9ii.js";
2
2
  import { ambientRenownTokenProvider } from "@powerhousedao/reactor-browser/graphql-client";
3
3
  //#region editors/workflow-editor/ui/forms.ts
4
4
  const POLL_INTERVAL_PROP = {
@@ -106,6 +106,55 @@ function knownPorts(block) {
106
106
  if (block.kind === "trigger") return TRIGGER_PORTS;
107
107
  return block.pieceName === "@powerhousedao/piece-core" && block.name === "branch" ? BRANCH_PORTS : PIECE_ACTION_PORTS;
108
108
  }
109
+ const DOCUMENT_REF_KEY = "$documentRef";
110
+ const MAX_DEPTH = 64;
111
+ function isPlainObject$1(value) {
112
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
113
+ const proto = Object.getPrototypeOf(value);
114
+ return proto === Object.prototype || proto === null;
115
+ }
116
+ function isRevision(value) {
117
+ return isPlainObject$1(value) && Object.values(value).every((entry) => typeof entry === "number" && Number.isFinite(entry));
118
+ }
119
+ function isDocumentReference(value) {
120
+ return isPlainObject$1(value) && typeof value.documentId === "string" && typeof value.documentType === "string" && typeof value.branch === "string" && isRevision(value.revision);
121
+ }
122
+ function isDocumentRefMarker(value) {
123
+ return isPlainObject$1(value) && isDocumentReference(value["$documentRef"]);
124
+ }
125
+ function walk(value, visit, depth, seen) {
126
+ if (depth > MAX_DEPTH || typeof value !== "object" || value === null) return value;
127
+ if (seen.has(value)) return value;
128
+ if (Array.isArray(value)) {
129
+ seen.add(value);
130
+ const mapped = value.map((item) => walk(item, visit, depth + 1, seen));
131
+ seen.delete(value);
132
+ return mapped;
133
+ }
134
+ if (!isPlainObject$1(value)) return value;
135
+ seen.add(value);
136
+ const replaced = visit(value);
137
+ const result = Object.fromEntries(Object.entries(replaced ?? value).map(([key, entry]) => [key, replaced && !(key in value) ? entry : walk(entry, visit, depth + 1, seen)]));
138
+ seen.delete(value);
139
+ return result;
140
+ }
141
+ function documentRefsIn(value) {
142
+ const found = [];
143
+ walk(value, (node) => {
144
+ if (isDocumentRefMarker(node)) found.push(node[DOCUMENT_REF_KEY]);
145
+ }, 0, /* @__PURE__ */ new WeakSet());
146
+ return found;
147
+ }
148
+ function expandDocumentRefs(value, expand) {
149
+ return walk(value, (node) => {
150
+ if (!isDocumentRefMarker(node)) return void 0;
151
+ const { [DOCUMENT_REF_KEY]: reference, ...rest } = node;
152
+ return {
153
+ ...rest,
154
+ ...expand(reference)
155
+ };
156
+ }, 0, /* @__PURE__ */ new WeakSet());
157
+ }
109
158
  //#endregion
110
159
  //#region editors/workflow-editor/ui/blocks.ts
111
160
  const CORE_PIECE = CORE_PIECE_NAME;
@@ -356,6 +405,7 @@ function getBlockForm(t, block) {
356
405
  return {
357
406
  title: isCoreBlock(block) ? entry.displayName : `${descriptor.displayName} · ${entry.displayName}`,
358
407
  requireAuth: entry.requireAuth,
408
+ ...entry.requireReactor === "read" || entry.requireReactor === "write" ? { requireReactor: entry.requireReactor } : {},
359
409
  auth: !descriptor.auth ? "none" : entry.requireAuth ? "required" : "optional",
360
410
  props: polled ? [...props, POLL_INTERVAL_PROP] : props,
361
411
  ...entry.ports ? { ports: entry.ports } : {},
@@ -437,6 +487,16 @@ function checkConnection(t, connectionId) {
437
487
  }
438
488
  }`, { connectionId }).then((data) => data.workflowRuntime.checkConnection);
439
489
  }
490
+ function fetchReactorAccess(t) {
491
+ return t.gql(`query ReactorAccess {
492
+ workflowRuntime { authEnforcement reactorIdentity { address key } authConditions }
493
+ }`, {}).then((data) => data.workflowRuntime);
494
+ }
495
+ function fetchReactorAccessDenial(t, workflowId) {
496
+ return t.gql(`query ReactorAccessDenial($workflowId: String!) {
497
+ workflowRuntime { reactorAccessDenial(workflowId: $workflowId) }
498
+ }`, { workflowId }).then((data) => data.workflowRuntime.reactorAccessDenial);
499
+ }
440
500
  async function fetchOAuthRedirectUri(t) {
441
501
  const uri = (await t.gql(`query OAuthRedirectUri { workflowRuntime { oauthRedirectUri } }`, {})).workflowRuntime.oauthRedirectUri;
442
502
  return uri === null ? null : new URL(uri, t.url).href;
@@ -522,7 +582,7 @@ async function testStep(t, workflowId, stepId, driveId) {
522
582
  return (await t.gql(`mutation TestStep($workflowId: String!, $stepId: String!, $driveId: String) {
523
583
  workflowRuntime {
524
584
  testStep(workflowId: $workflowId, stepId: $stepId, driveId: $driveId) {
525
- runId status output error durationMs
585
+ runId status output error errorName durationMs
526
586
  }
527
587
  }
528
588
  }`, {
@@ -541,8 +601,8 @@ async function blockResolutions(t, workflowId) {
541
601
  }`, { workflowId })).workflowRuntime.blockResolutions;
542
602
  }
543
603
  const RUN_ROW_FIELDS = `id workflowId workflowName workflowVersion triggerKind
544
- triggerPayload status error startedAt endedAt rerunOf warningNotes`;
545
- const STEP_ROW_FIELDS = "stepId stepKey pieceName blockName status port error startedAt endedAt";
604
+ triggerPayload status error errorName startedAt endedAt rerunOf warningNotes`;
605
+ const STEP_ROW_FIELDS = "stepId stepKey pieceName blockName status port error errorName startedAt endedAt";
546
606
  const RUN_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} input output }`;
547
607
  const RUN_LIST_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} }`;
548
608
  function scopeVariables(scope, limit) {
@@ -590,15 +650,16 @@ async function rerunRun(t, runId) {
590
650
  workflowRuntime { rerun(runId: $runId) { runId status error } }
591
651
  }`, { runId })).workflowRuntime.rerun;
592
652
  }
593
- async function loadBlockOptions(t, block, propName, input, connectionId, searchValue) {
594
- return (await t.gql(`query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String) {
595
- workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue) }
653
+ async function loadBlockOptions(t, block, propName, input, connectionId, searchValue, reactorConnectionId) {
654
+ return (await t.gql(`query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String, $reactorConnectionId: String) {
655
+ workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue, reactorConnectionId: $reactorConnectionId) }
596
656
  }`, {
597
657
  block: blockInput(block),
598
658
  propName,
599
659
  input,
600
660
  connectionId: connectionId ?? null,
601
- searchValue: searchValue ?? null
661
+ searchValue: searchValue ?? null,
662
+ reactorConnectionId: reactorConnectionId ?? null
602
663
  })).workflowRuntime.blockOptions;
603
664
  }
604
665
  const operations = {
@@ -611,6 +672,8 @@ const operations = {
611
672
  fetchStepOutputTree,
612
673
  fetchConnections,
613
674
  checkConnection,
675
+ fetchReactorAccess,
676
+ fetchReactorAccessDenial,
614
677
  fetchOAuthRedirectUri,
615
678
  startOAuth,
616
679
  fetchOAuthAttempt,
@@ -2344,7 +2407,8 @@ function resolverKey(scope, kind, input) {
2344
2407
  input.propName,
2345
2408
  input.refreshers,
2346
2409
  input.connectionId ?? null,
2347
- input.searchValue ?? null
2410
+ input.searchValue ?? null,
2411
+ input.reactorConnectionId ?? null
2348
2412
  ];
2349
2413
  }
2350
2414
  const runtimeKeys = {
@@ -2428,6 +2492,16 @@ const runtimeKeys = {
2428
2492
  "run",
2429
2493
  runId
2430
2494
  ],
2495
+ reactorAccess: (scope, viewer) => [
2496
+ scope,
2497
+ "reactorAccess",
2498
+ viewer
2499
+ ],
2500
+ reactorDenial: (scope, workflowId) => [
2501
+ scope,
2502
+ "reactorDenial",
2503
+ workflowId
2504
+ ],
2431
2505
  secret: (scope, ref) => [
2432
2506
  scope,
2433
2507
  "secret",
@@ -2530,6 +2604,6 @@ const secretStatQuery = (client, ref) => queryOptions({
2530
2604
  staleTime: 0
2531
2605
  });
2532
2606
  //#endregion
2533
- export { pinBlock as $, keepPreviousData as A, Subscribable as B, infiniteQueryBehavior as C, focusManager as D, pendingThenable as E, resolveStaleTime as F, BRANCH_BLOCK as G, createRuntimeClient as H, shallowEqualObjects as I, SCHEDULE_TRIGGER as J, CORE_PIECE as K, shouldThrowError as L, replaceData as M, replaceEqualDeep as N, isServer as O, resolveEnabled as P, isCoreBlock as Q, timeUntilStale as R, hasPreviousPage as S, notifyManager as T, isSyncingError as U, DEFAULT_RUNTIME_URL as V, ASSERT_BLOCK as W, TRIGGER_PRESETS as X, STEP_PRESETS as Y, WEBHOOK_TRIGGER as Z, runtimeKeys as _, pieceActionsQuery as a, CORE_PIECE_NAME as at, QueryClient as b, runQuery as c, flowPorts as ct, secretStatQuery as d, scheduleConfigIssue as dt, sameBlock as et, stepOutputTreeQuery as f, queryKind as g, blockRefKey as h, outputTreeQuery as i, triggerFields as it, noop as j, isValidTimeout as k, runsOfPages as l, knownPorts as lt, SHARED_STALE_MS as m, catalogQuery as n, stepFields as nt, pieceTriggersQuery as o, NEXT_PORT as ot, RESOLVER_STALE_MS as p, MANUAL_TRIGGER as q, createRuntimeQueryClient as r, triggerBlock as rt, runPagesQuery as s, checkTriggerStrategy as st, blockFormQuery as t, stepBlock as tt, runsQuery as u, parseScheduleConfig as ut, TEST_TRIGGER_KIND as v, fetchState as w, hasNextPage as x, realRuns as y, timeoutManager as z };
2607
+ export { isCoreBlock as $, keepPreviousData as A, Subscribable as B, infiniteQueryBehavior as C, focusManager as D, pendingThenable as E, resolveStaleTime as F, BRANCH_BLOCK as G, createRuntimeClient as H, shallowEqualObjects as I, REACTOR_PIECE as J, CORE_PIECE as K, shouldThrowError as L, replaceData as M, replaceEqualDeep as N, isServer as O, resolveEnabled as P, WEBHOOK_TRIGGER as Q, timeUntilStale as R, hasPreviousPage as S, notifyManager as T, isSyncingError as U, DEFAULT_RUNTIME_URL as V, ASSERT_BLOCK as W, STEP_PRESETS as X, SCHEDULE_TRIGGER as Y, TRIGGER_PRESETS as Z, runtimeKeys as _, pieceActionsQuery as a, triggerFields as at, QueryClient as b, runQuery as c, NEXT_PORT as ct, secretStatQuery as d, expandDocumentRefs as dt, pinBlock as et, stepOutputTreeQuery as f, flowPorts as ft, queryKind as g, scheduleConfigIssue as gt, blockRefKey as h, parseScheduleConfig as ht, outputTreeQuery as i, triggerBlock as it, noop as j, isValidTimeout as k, runsOfPages as l, checkTriggerStrategy as lt, SHARED_STALE_MS as m, knownPorts as mt, catalogQuery as n, stepBlock as nt, pieceTriggersQuery as o, CORE_PIECE_NAME as ot, RESOLVER_STALE_MS as p, isDocumentRefMarker as pt, MANUAL_TRIGGER as q, createRuntimeQueryClient as r, stepFields as rt, runPagesQuery as s, DOCUMENT_REF_KEY as st, blockFormQuery as t, sameBlock as tt, runsQuery as u, documentRefsIn as ut, TEST_TRIGGER_KIND as v, fetchState as w, hasNextPage as x, realRuns as y, timeoutManager as z };
2534
2608
 
2535
- //# sourceMappingURL=runtime-queries-Ds2kk-Ow.js.map
2609
+ //# sourceMappingURL=runtime-queries-IZG_nonR.js.map