@powerhousedao/workflow 6.2.3 → 6.3.0-dev.1

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 (536) hide show
  1. package/README.md +3 -1
  2. package/dist/{node/BlockSelector-C3XYZfPY.mjs → browser/BlockSelector-CEdYUqjx.js} +2006 -1692
  3. package/dist/browser/BlockSelector-CEdYUqjx.js.map +1 -0
  4. package/dist/browser/PieceMarkdown-DSdZd-Jc.js +92 -0
  5. package/dist/browser/PieceMarkdown-DSdZd-Jc.js.map +1 -0
  6. package/dist/browser/connection-form-Biksq2jW.js +1524 -0
  7. package/dist/browser/connection-form-Biksq2jW.js.map +1 -0
  8. package/dist/browser/{connection-BUum0hJI.js → connection-ilYFCRUK.js} +2 -2
  9. package/dist/browser/{connection-BUum0hJI.js.map → connection-ilYFCRUK.js.map} +1 -1
  10. package/dist/browser/data-tree-Cq-s6bJp.js +76 -0
  11. package/dist/browser/data-tree-Cq-s6bJp.js.map +1 -0
  12. package/dist/browser/document-models/connection/index.js +3 -3
  13. package/dist/browser/document-models/index.js +3 -3
  14. package/dist/browser/document-models/workflow/index.js +3 -3
  15. package/dist/browser/document-models-C2SAP1SX.js +164 -0
  16. package/dist/browser/{document-models-C1ZgIZyV.js.map → document-models-C2SAP1SX.js.map} +1 -1
  17. package/dist/browser/editor-CIqKi7XK.js +3219 -0
  18. package/dist/browser/editor-CIqKi7XK.js.map +1 -0
  19. package/dist/browser/editor-DYjoPfta.js +4669 -0
  20. package/dist/browser/editor-DYjoPfta.js.map +1 -0
  21. package/dist/browser/{editor-BCH8vdej.js → editor-GeRXGdie.js} +174 -48
  22. package/dist/browser/editor-GeRXGdie.js.map +1 -0
  23. package/dist/browser/editors/connection-editor/module.js +1 -1
  24. package/dist/browser/editors/connection-editor/module.js.map +1 -1
  25. package/dist/browser/editors/runtime/index.js +2 -0
  26. package/dist/browser/editors/workflow-editor/module.js +1 -1
  27. package/dist/browser/editors/workflow-editor/module.js.map +1 -1
  28. package/dist/browser/editors/workflow-studio/module.js +1 -1
  29. package/dist/browser/index.js +164 -88
  30. package/dist/browser/index.js.map +1 -1
  31. package/dist/browser/{module-jDZ4pq3W.js → module-DJz6oTX0.js} +237 -30
  32. package/dist/browser/module-DJz6oTX0.js.map +1 -0
  33. package/dist/browser/{module-DU2vb3FH.js → module-mFCt9WHJ.js} +267 -89
  34. package/dist/browser/module-mFCt9WHJ.js.map +1 -0
  35. package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
  36. package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
  37. package/dist/browser/reactor/index.js +2 -2
  38. package/dist/browser/rolldown-runtime-D7D4PA-g.js +13 -0
  39. package/dist/browser/runtime-queries-FmEzElOY.js +993 -0
  40. package/dist/browser/runtime-queries-FmEzElOY.js.map +1 -0
  41. package/dist/browser/trigger-text-DH6HIeoa.js +3210 -0
  42. package/dist/browser/trigger-text-DH6HIeoa.js.map +1 -0
  43. package/dist/browser/upgrade-manifests-C2Qa6myy.js +8 -0
  44. package/dist/browser/{upgrade-manifests-BpakVE9l.js.map → upgrade-manifests-C2Qa6myy.js.map} +1 -1
  45. package/dist/{node/workflow-CGzYGZnr.mjs → browser/workflow-2gR2JXUS.js} +4 -3
  46. package/dist/browser/workflow-2gR2JXUS.js.map +1 -0
  47. package/dist/node/document-models/connection/index.mjs +67 -3
  48. package/dist/node/document-models/connection/index.mjs.map +1 -0
  49. package/dist/node/document-models/index.mjs +3 -3
  50. package/dist/node/document-models/workflow/index.mjs +86 -3
  51. package/dist/node/document-models/workflow/index.mjs.map +1 -0
  52. package/dist/node/editors/index.mjs +6 -4
  53. package/dist/node/editors/index.mjs.map +1 -0
  54. package/dist/node/index.mjs +69 -381
  55. package/dist/node/index.mjs.map +1 -1
  56. package/dist/node/{module-Dhe5E-VA.mjs → module-BXKUB58R.mjs} +273 -90
  57. package/dist/node/module-BXKUB58R.mjs.map +1 -0
  58. package/dist/node/{module-BMwJQh65.mjs → module-CaBtkQmd.mjs} +226 -19
  59. package/dist/node/module-CaBtkQmd.mjs.map +1 -0
  60. package/dist/node/pieces/ai/descriptor.json +857 -0
  61. package/dist/node/pieces/ai/index.mjs +624 -0
  62. package/dist/node/pieces/ai/package.json +9 -0
  63. package/dist/node/pieces/index.mjs +3 -0
  64. package/dist/node/pieces/index.mjs.map +1 -1
  65. package/dist/node/pieces/reactor/descriptor.json +104 -18
  66. package/dist/node/pieces/reactor/index.mjs +48 -17670
  67. package/dist/node/pieces/reactor/package.json +2 -2
  68. package/dist/node/rolldown-runtime-D7D4PA-g.mjs +13 -0
  69. package/dist/node/upgrade-manifests-BCCpSD1J.mjs +8 -0
  70. package/dist/node/{upgrade-manifests-CmNd742Y.mjs.map → upgrade-manifests-BCCpSD1J.mjs.map} +1 -1
  71. package/dist/powerhouse.manifest.json +72 -6
  72. package/dist/style.css +3 -2520
  73. package/dist/types/ai/runtime.d.ts +13 -0
  74. package/dist/types/ai/runtime.d.ts.map +1 -0
  75. package/dist/types/ai/tools.d.ts +10 -6
  76. package/dist/types/ai/tools.d.ts.map +1 -1
  77. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  78. package/dist/types/document-models/connection/v1/actions.d.ts +3 -0
  79. package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -1
  80. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts +10 -2
  81. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts.map +1 -1
  82. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts +4 -2
  83. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -1
  84. package/dist/types/document-models/connection/v1/gen/config/error.d.ts +29 -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/config/operations.d.ts +3 -1
  87. package/dist/types/document-models/connection/v1/gen/config/operations.d.ts.map +1 -1
  88. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +13 -1
  89. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -1
  90. package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
  91. package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
  92. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +18 -2
  93. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
  94. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +5 -1
  95. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
  96. package/dist/types/document-models/connection/v1/module.d.ts +3 -0
  97. package/dist/types/document-models/connection/v1/module.d.ts.map +1 -1
  98. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts +17 -0
  99. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts.map +1 -0
  100. package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
  101. package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -1
  102. package/dist/types/document-models/connection/v1/src/utils.d.ts +1 -1
  103. package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -1
  104. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts +2 -0
  105. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts.map +1 -0
  106. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts +2 -0
  107. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts.map +1 -0
  108. package/dist/types/document-models/document-models.d.ts +8 -0
  109. package/dist/types/document-models/document-models.d.ts.map +1 -1
  110. package/dist/types/document-models/workflow/v1/actions.d.ts +5 -0
  111. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  112. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  113. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
  114. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
  116. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  117. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +52 -6
  118. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  119. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +7 -1
  120. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  121. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts +14 -2
  122. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts.map +1 -1
  123. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts +5 -2
  124. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -1
  125. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +32 -1
  126. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
  127. package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts +4 -1
  128. package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts.map +1 -1
  129. package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
  130. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
  131. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
  132. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
  133. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
  134. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
  135. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
  136. package/dist/types/document-models/workflow/v1/module.d.ts +5 -0
  137. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  138. package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
  139. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  140. package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
  141. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
  142. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
  143. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts +2 -0
  144. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts.map +1 -0
  145. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts +2 -0
  146. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts.map +1 -0
  147. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +1 -1
  148. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  149. package/dist/types/editors/connection-editor/ReactorBindings.d.ts +6 -0
  150. package/dist/types/editors/connection-editor/ReactorBindings.d.ts.map +1 -0
  151. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts +7 -0
  152. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -0
  153. package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
  154. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  155. package/dist/types/editors/connection-editor/connection-form.d.ts +4 -1
  156. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  157. package/dist/types/editors/connection-editor/connection-usage.d.ts +13 -3
  158. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
  159. package/dist/types/editors/connection-editor/editor.d.ts +3 -1
  160. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  161. package/dist/types/editors/connection-editor/module.d.ts +2 -1
  162. package/dist/types/editors/connection-editor/module.d.ts.map +1 -1
  163. package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
  164. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  165. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  166. package/dist/types/editors/runtime/index.d.ts +21 -0
  167. package/dist/types/editors/runtime/index.d.ts.map +1 -0
  168. package/dist/types/editors/runtime/runtime-export.test.d.ts +2 -0
  169. package/dist/types/editors/runtime/runtime-export.test.d.ts.map +1 -0
  170. package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
  171. package/dist/types/editors/shared/controls.d.ts +1 -0
  172. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  173. package/dist/types/editors/shared/data-tree.d.ts.map +1 -1
  174. package/dist/types/editors/shared/data-viewer.d.ts.map +1 -1
  175. package/dist/types/editors/shared/document-ref.d.ts +5 -0
  176. package/dist/types/editors/shared/document-ref.d.ts.map +1 -0
  177. package/dist/types/editors/shared/editor-chrome.d.ts +6 -1
  178. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
  179. package/dist/types/editors/shared/editor-chrome.test.d.ts +2 -0
  180. package/dist/types/editors/shared/editor-chrome.test.d.ts.map +1 -0
  181. package/dist/types/editors/shared/icons.d.ts +5 -0
  182. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  183. package/dist/types/editors/shared/pending-echo.d.ts +9 -0
  184. package/dist/types/editors/shared/pending-echo.d.ts.map +1 -0
  185. package/dist/types/editors/shared/undo-plan.d.ts +12 -5
  186. package/dist/types/editors/shared/undo-plan.d.ts.map +1 -1
  187. package/dist/types/editors/shared/url-param.d.ts +14 -0
  188. package/dist/types/editors/shared/url-param.d.ts.map +1 -0
  189. package/dist/types/editors/shared/url-param.test.d.ts +2 -0
  190. package/dist/types/editors/shared/url-param.test.d.ts.map +1 -0
  191. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  192. package/dist/types/editors/workflow-editor/editor.d.ts +3 -1
  193. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  194. package/dist/types/editors/workflow-editor/module.d.ts +2 -1
  195. package/dist/types/editors/workflow-editor/module.d.ts.map +1 -1
  196. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts +25 -0
  197. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts.map +1 -0
  198. package/dist/types/editors/workflow-editor/runtime-api.d.ts +13 -11
  199. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  200. package/dist/types/editors/workflow-editor/runtime-client.d.ts +96 -9
  201. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
  202. package/dist/types/editors/workflow-editor/runtime-context.d.ts +12 -3
  203. package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
  204. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts +2 -0
  205. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts.map +1 -0
  206. package/dist/types/editors/workflow-editor/runtime-persist.d.ts +1 -1
  207. package/dist/types/editors/workflow-editor/runtime-queries.d.ts +21 -1
  208. package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -1
  209. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +15 -2
  210. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  211. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
  212. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  213. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts +8 -0
  214. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts.map +1 -0
  215. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  216. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
  217. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
  218. package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts +12 -0
  219. package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts.map +1 -0
  220. package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts +2 -1
  221. package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
  222. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +9 -0
  223. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  224. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +17 -0
  225. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
  226. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts +9 -0
  227. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -0
  228. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
  229. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts +6 -0
  230. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts.map +1 -0
  231. package/dist/types/editors/workflow-editor/ui/StepError.d.ts +4 -0
  232. package/dist/types/editors/workflow-editor/ui/StepError.d.ts.map +1 -0
  233. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
  234. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  235. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -1
  236. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts +2 -0
  237. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts.map +1 -0
  238. package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts +14 -0
  239. package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts.map +1 -0
  240. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  241. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +1 -0
  242. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  243. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  244. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +4 -0
  245. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  246. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +3 -0
  247. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  248. package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts +2 -0
  249. package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts.map +1 -0
  250. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +12 -0
  251. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  252. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
  253. package/dist/types/editors/workflow-editor/ui/design-time.d.ts +1 -0
  254. package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -1
  255. package/dist/types/editors/workflow-editor/ui/document-options.d.ts +24 -0
  256. package/dist/types/editors/workflow-editor/ui/document-options.d.ts.map +1 -0
  257. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts +2 -0
  258. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts.map +1 -0
  259. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts +8 -0
  260. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts.map +1 -0
  261. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts +2 -0
  262. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts.map +1 -0
  263. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +2 -0
  264. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
  265. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts +2 -0
  266. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts.map +1 -0
  267. package/dist/types/editors/workflow-editor/ui/forms.d.ts +11 -2
  268. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  269. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
  270. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
  271. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts +7 -0
  272. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts.map +1 -0
  273. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts +2 -0
  274. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts.map +1 -0
  275. package/dist/types/editors/workflow-editor/ui/model.d.ts +31 -0
  276. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  277. package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts +19 -0
  278. package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts.map +1 -0
  279. package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts +4 -0
  280. package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts.map +1 -0
  281. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +23 -3
  282. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  283. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +1 -0
  284. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -1
  285. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts +2 -0
  286. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts.map +1 -0
  287. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +16 -4
  288. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
  289. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts +43 -0
  290. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts.map +1 -0
  291. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts +2 -0
  292. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts.map +1 -0
  293. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts +2 -0
  294. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts.map +1 -0
  295. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts +2 -0
  296. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts.map +1 -0
  297. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts +25 -0
  298. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts.map +1 -0
  299. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts +2 -0
  300. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts.map +1 -0
  301. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
  302. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
  303. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
  304. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
  305. package/dist/types/editors/workflow-editor/ui/step-test.d.ts +2 -0
  306. package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -1
  307. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -0
  308. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
  309. package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts +4 -0
  310. package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts.map +1 -0
  311. package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts +2 -0
  312. package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts.map +1 -0
  313. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +1 -0
  314. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
  315. package/dist/types/editors/workflow-editor/ui/validation.d.ts +7 -2
  316. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  317. package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts +13 -0
  318. package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts.map +1 -0
  319. package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts +2 -0
  320. package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts.map +1 -0
  321. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts +7 -0
  322. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts.map +1 -0
  323. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +11 -1
  324. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  325. package/dist/types/editors/workflow-studio/components/RunsView.d.ts +3 -1
  326. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  327. package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts +7 -0
  328. package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts.map +1 -0
  329. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +4 -0
  330. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  331. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +57 -0
  332. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -0
  333. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +4 -0
  334. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  335. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts +41 -0
  336. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -0
  337. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +2 -0
  338. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -1
  339. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  340. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  341. package/dist/types/editors/workflow-studio/components/chain.d.ts +6 -0
  342. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  343. package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts +2 -0
  344. package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts.map +1 -0
  345. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +30 -0
  346. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -0
  347. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts +2 -0
  348. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts.map +1 -0
  349. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts +2 -0
  350. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts.map +1 -0
  351. package/dist/types/editors/workflow-studio/components/run-format.d.ts +6 -1
  352. package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
  353. package/dist/types/editors/workflow-studio/components/tips.d.ts +23 -0
  354. package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -0
  355. package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts +5 -0
  356. package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts.map +1 -0
  357. package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts +10 -0
  358. package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts.map +1 -0
  359. package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts +2 -0
  360. package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts.map +1 -0
  361. package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts +2 -0
  362. package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts.map +1 -0
  363. package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts +2 -0
  364. package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts.map +1 -0
  365. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts +19 -0
  366. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts.map +1 -0
  367. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts +2 -0
  368. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts.map +1 -0
  369. package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
  370. package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
  371. package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
  372. package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
  373. package/dist/types/pieces/ai/ai.test.d.ts +2 -0
  374. package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
  375. package/dist/types/pieces/ai/index.d.ts +7 -0
  376. package/dist/types/pieces/ai/index.d.ts.map +1 -0
  377. package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
  378. package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
  379. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
  380. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
  381. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
  382. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
  383. package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
  384. package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
  385. package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
  386. package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
  387. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
  388. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
  389. package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
  390. package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
  391. package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
  392. package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
  393. package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
  394. package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
  395. package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
  396. package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
  397. package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
  398. package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
  399. package/dist/types/pieces/ai/lib/models.d.ts +19 -0
  400. package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
  401. package/dist/types/pieces/ai/lib/props.d.ts +16 -0
  402. package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
  403. package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
  404. package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
  405. package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
  406. package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
  407. package/dist/types/pieces/index.d.ts.map +1 -1
  408. package/dist/types/pieces/reactor/index.d.ts.map +1 -1
  409. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +5 -2
  410. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  411. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +3 -1
  412. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  413. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -1
  414. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
  415. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +3 -1
  416. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  417. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +3 -1
  418. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  419. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
  420. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
  421. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +14 -0
  422. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
  423. package/dist/types/pieces/reactor/lib/documents.d.ts +33 -0
  424. package/dist/types/pieces/reactor/lib/documents.d.ts.map +1 -0
  425. package/dist/types/pieces/reactor/lib/documents.test.d.ts +2 -0
  426. package/dist/types/pieces/reactor/lib/documents.test.d.ts.map +1 -0
  427. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
  428. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  429. package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
  430. package/dist/types/pieces/reactor/lib/reactor.d.ts +27 -4
  431. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  432. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +6 -6
  433. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -1
  434. package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
  435. package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
  436. package/dist/types/pieces/reactor/reactor.test.d.ts +2 -0
  437. package/dist/types/pieces/reactor/reactor.test.d.ts.map +1 -0
  438. package/dist/types/pieces/reactor/test-signer.d.ts +3 -0
  439. package/dist/types/pieces/reactor/test-signer.d.ts.map +1 -0
  440. package/dist/types/scripts/ui-stack.d.ts +21 -6
  441. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  442. package/dist/types/test/graphql-server.d.ts +9 -0
  443. package/dist/types/test/graphql-server.d.ts.map +1 -0
  444. package/dist/types/test/runtime-schema.d.ts +17 -0
  445. package/dist/types/test/runtime-schema.d.ts.map +1 -0
  446. package/dist/types/test/switchboards.d.ts +20 -0
  447. package/dist/types/test/switchboards.d.ts.map +1 -0
  448. package/dist/types/test/ui/flow-control.spec.d.ts +2 -0
  449. package/dist/types/test/ui/flow-control.spec.d.ts.map +1 -0
  450. package/dist/types/test/ui/harness/property-form-echo.d.ts +12 -0
  451. package/dist/types/test/ui/harness/property-form-echo.d.ts.map +1 -0
  452. package/dist/types/test/ui/harness/schedule-builder.d.ts +8 -0
  453. package/dist/types/test/ui/harness/schedule-builder.d.ts.map +1 -0
  454. package/dist/types/test/ui/manual-inputs.spec.d.ts +2 -0
  455. package/dist/types/test/ui/manual-inputs.spec.d.ts.map +1 -0
  456. package/dist/types/test/ui/property-form-echo.spec.d.ts +2 -0
  457. package/dist/types/test/ui/property-form-echo.spec.d.ts.map +1 -0
  458. package/dist/types/test/ui/reactor-connection.spec.d.ts +2 -0
  459. package/dist/types/test/ui/reactor-connection.spec.d.ts.map +1 -0
  460. package/dist/types/test/ui/schedule-builder.spec.d.ts +2 -0
  461. package/dist/types/test/ui/schedule-builder.spec.d.ts.map +1 -0
  462. package/dist/types/test/waitpoint-record.d.ts +3 -0
  463. package/dist/types/test/waitpoint-record.d.ts.map +1 -0
  464. package/dist/workflow.css +68 -0
  465. package/package.json +40 -11
  466. package/dist/browser/BlockSelector-BQDqIbRZ.js +0 -3053
  467. package/dist/browser/BlockSelector-BQDqIbRZ.js.map +0 -1
  468. package/dist/browser/PieceMarkdown-B8EEaQgT.js +0 -21435
  469. package/dist/browser/PieceMarkdown-B8EEaQgT.js.map +0 -1
  470. package/dist/browser/assets/entry-D62sYiFV.js +0 -318
  471. package/dist/browser/assets/projection-entry-BGcu_9-p.js +0 -446
  472. package/dist/browser/connection-form-BCxGD8Zk.js +0 -831
  473. package/dist/browser/connection-form-BCxGD8Zk.js.map +0 -1
  474. package/dist/browser/data-tree-CZZkfzSH.js +0 -1896
  475. package/dist/browser/data-tree-CZZkfzSH.js.map +0 -1
  476. package/dist/browser/document-models-C1ZgIZyV.js +0 -103
  477. package/dist/browser/editor-BCH8vdej.js.map +0 -1
  478. package/dist/browser/editor-Bd2Cu8Mx.js +0 -1793
  479. package/dist/browser/editor-Bd2Cu8Mx.js.map +0 -1
  480. package/dist/browser/editor-Bl1Xp7N8.js +0 -17234
  481. package/dist/browser/editor-Bl1Xp7N8.js.map +0 -1
  482. package/dist/browser/module-DU2vb3FH.js.map +0 -1
  483. package/dist/browser/module-jDZ4pq3W.js.map +0 -1
  484. package/dist/browser/piece-auth-BS5CtQOG.js +0 -146
  485. package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
  486. package/dist/browser/rolldown-runtime-DC62tzP2.js +0 -33
  487. package/dist/browser/runtime-queries-Ds2kk-Ow.js +0 -2535
  488. package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +0 -1
  489. package/dist/browser/trigger-text-Ld2uv0Cf.js +0 -5569
  490. package/dist/browser/trigger-text-Ld2uv0Cf.js.map +0 -1
  491. package/dist/browser/upgrade-manifests-BpakVE9l.js +0 -8
  492. package/dist/browser/workflow-BxShRhVy.js +0 -108
  493. package/dist/browser/workflow-BxShRhVy.js.map +0 -1
  494. package/dist/node/BlockSelector-C3XYZfPY.mjs.map +0 -1
  495. package/dist/node/PieceMarkdown-BMhBGa4t.mjs +0 -23281
  496. package/dist/node/PieceMarkdown-BMhBGa4t.mjs.map +0 -1
  497. package/dist/node/connection-D544oqVW.mjs +0 -90
  498. package/dist/node/connection-D544oqVW.mjs.map +0 -1
  499. package/dist/node/connection-form-CjUay_qz.mjs +0 -831
  500. package/dist/node/connection-form-CjUay_qz.mjs.map +0 -1
  501. package/dist/node/data-tree-CGfeCLr7.mjs +0 -1903
  502. package/dist/node/data-tree-CGfeCLr7.mjs.map +0 -1
  503. package/dist/node/editor-BXtXOryt.mjs +0 -247
  504. package/dist/node/editor-BXtXOryt.mjs.map +0 -1
  505. package/dist/node/editor-CXGHkwd9.mjs +0 -1793
  506. package/dist/node/editor-CXGHkwd9.mjs.map +0 -1
  507. package/dist/node/editor-D0FCvyPb.mjs +0 -17365
  508. package/dist/node/editor-D0FCvyPb.mjs.map +0 -1
  509. package/dist/node/editors/connection-editor/module.mjs +0 -15
  510. package/dist/node/editors/connection-editor/module.mjs.map +0 -1
  511. package/dist/node/editors/workflow-editor/module.mjs +0 -15
  512. package/dist/node/editors/workflow-editor/module.mjs.map +0 -1
  513. package/dist/node/editors/workflow-studio/module.mjs +0 -15
  514. package/dist/node/editors/workflow-studio/module.mjs.map +0 -1
  515. package/dist/node/module-BMwJQh65.mjs.map +0 -1
  516. package/dist/node/module-Dhe5E-VA.mjs.map +0 -1
  517. package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
  518. package/dist/node/pieces/reactor/index.mjs.map +0 -1
  519. package/dist/node/rolldown-runtime-BMI-E3GI.mjs +0 -44
  520. package/dist/node/runtime-queries-D5EGaCrH.mjs +0 -2544
  521. package/dist/node/runtime-queries-D5EGaCrH.mjs.map +0 -1
  522. package/dist/node/style.css +0 -667
  523. package/dist/node/trigger-text-CMWxL7t_.mjs +0 -6765
  524. package/dist/node/trigger-text-CMWxL7t_.mjs.map +0 -1
  525. package/dist/node/upgrade-manifests-CmNd742Y.mjs +0 -8
  526. package/dist/node/workflow-CGzYGZnr.mjs.map +0 -1
  527. package/dist/types/ai/runtime-url.d.ts +0 -2
  528. package/dist/types/ai/runtime-url.d.ts.map +0 -1
  529. package/dist/types/ai/runtime-url.test.d.ts +0 -2
  530. package/dist/types/ai/runtime-url.test.d.ts.map +0 -1
  531. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -2
  532. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +0 -1
  533. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts +0 -5
  534. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts.map +0 -1
  535. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts +0 -2
  536. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts.map +0 -1
@@ -0,0 +1,993 @@
1
+ import { ambientRenownTokenProvider } from "@powerhousedao/reactor-browser/graphql-client";
2
+ import { blockKey } from "@powerhousedao/pieces-framework/block-type";
3
+ import { CALLABLE_FLOW_TRIGGER, CALL_FLOW_ACTION, CORE_PIECE_NAME, SUBFLOWS_PIECE, checkTriggerStrategy } from "@powerhousedao/pieces-framework/workflow";
4
+ import { QueryClient, infiniteQueryOptions, queryOptions } from "@tanstack/react-query";
5
+ //#region editors/workflow-editor/ui/forms.ts
6
+ const POLL_INTERVAL_PROP = {
7
+ name: "pollEverySeconds",
8
+ displayName: "Poll every (seconds)",
9
+ type: "NUMBER",
10
+ required: false,
11
+ description: "How often the reactor checks this trigger; 60 at the least. Omit to follow the piece's own cadence."
12
+ };
13
+ //#endregion
14
+ //#region editors/workflow-editor/ui/blocks.ts
15
+ const CORE_PIECE = CORE_PIECE_NAME;
16
+ const REACTOR_PIECE = "@powerhousedao/piece-reactor";
17
+ const core = (kind, name) => ({
18
+ pieceName: CORE_PIECE,
19
+ kind,
20
+ name
21
+ });
22
+ const MANUAL_TRIGGER = core("trigger", "manual");
23
+ const SCHEDULE_TRIGGER = core("trigger", "schedule");
24
+ const WEBHOOK_TRIGGER = core("trigger", "webhook");
25
+ const BRANCH_BLOCK = core("action", "branch");
26
+ const ROUTER_BLOCK = core("action", "router");
27
+ const LOOP_BLOCK = core("action", "loop");
28
+ const ASSERT_BLOCK = core("action", "assert");
29
+ const DELAY_BLOCK = core("action", "delay");
30
+ const APPROVAL_BLOCK = core("action", "approval");
31
+ const STOP_BLOCK = core("action", "stop");
32
+ const WAIT_FOR_WEBHOOK_BLOCK = core("action", "waitForWebhook");
33
+ const SUBFLOWS_VERSION = "0.7.0";
34
+ const subflows = (kind, name) => ({
35
+ pieceName: SUBFLOWS_PIECE,
36
+ pieceVersion: SUBFLOWS_VERSION,
37
+ kind,
38
+ name
39
+ });
40
+ const CALLABLE_FLOW_TRIGGER$1 = subflows("trigger", CALLABLE_FLOW_TRIGGER);
41
+ const CALL_FLOW_BLOCK = subflows("action", CALL_FLOW_ACTION);
42
+ const RETURN_RESPONSE_BLOCK = subflows("action", "returnResponse");
43
+ function sameBlock(a, b) {
44
+ return Boolean(a && b && blockKey(a) === blockKey(b));
45
+ }
46
+ function isCoreBlock(block) {
47
+ return block.pieceName === CORE_PIECE;
48
+ }
49
+ function isReactorPieceBlock(block) {
50
+ return block.pieceName === REACTOR_PIECE;
51
+ }
52
+ function stepBlock(step) {
53
+ return {
54
+ pieceName: step.pieceName,
55
+ pieceVersion: step.pieceVersion,
56
+ kind: "action",
57
+ name: step.actionName
58
+ };
59
+ }
60
+ function triggerBlock(trigger) {
61
+ return {
62
+ pieceName: trigger.pieceName,
63
+ pieceVersion: trigger.pieceVersion,
64
+ kind: "trigger",
65
+ name: trigger.triggerName
66
+ };
67
+ }
68
+ function stepFields(block) {
69
+ return {
70
+ pieceName: block.pieceName,
71
+ pieceVersion: block.pieceVersion,
72
+ actionName: block.name
73
+ };
74
+ }
75
+ function triggerFields(block) {
76
+ return {
77
+ pieceName: block.pieceName,
78
+ pieceVersion: block.pieceVersion,
79
+ triggerName: block.name
80
+ };
81
+ }
82
+ function pinBlock(pick, installedVersion) {
83
+ const pieceVersion = pick.pieceVersion ?? installedVersion(pick.pieceName);
84
+ if (!pieceVersion) return void 0;
85
+ return {
86
+ pieceName: pick.pieceName,
87
+ pieceVersion,
88
+ kind: pick.kind,
89
+ name: pick.name
90
+ };
91
+ }
92
+ const reactor = (kind, name) => ({
93
+ pieceName: REACTOR_PIECE,
94
+ kind,
95
+ name
96
+ });
97
+ const TRIGGER_PRESETS = [
98
+ {
99
+ label: "Manual",
100
+ block: MANUAL_TRIGGER,
101
+ group: "core",
102
+ description: "Fired on demand with a payload.",
103
+ defaultConfig: {}
104
+ },
105
+ {
106
+ label: "Schedule",
107
+ block: SCHEDULE_TRIGGER,
108
+ group: "core",
109
+ description: "Fires on a cron expression or fixed interval.",
110
+ defaultConfig: {
111
+ mode: "cron",
112
+ cron: "0 9 * * 1-5",
113
+ timezone: "UTC"
114
+ }
115
+ },
116
+ {
117
+ label: "Webhook",
118
+ block: WEBHOOK_TRIGGER,
119
+ group: "core",
120
+ description: "Fires when a provider POSTs to this workflow's URL.",
121
+ defaultConfig: {
122
+ methods: "POST",
123
+ scheme: "none",
124
+ responseMode: "async"
125
+ }
126
+ },
127
+ {
128
+ label: "Callable workflow",
129
+ block: CALLABLE_FLOW_TRIGGER$1,
130
+ group: "core",
131
+ description: "Fires when another workflow in this drive calls it.",
132
+ defaultConfig: {
133
+ mode: "simple",
134
+ exampleData: { sampleData: {} }
135
+ }
136
+ },
137
+ {
138
+ label: "Document event",
139
+ block: reactor("trigger", "document-event"),
140
+ group: "powerhouse",
141
+ description: "Fires when a matching document operation lands.",
142
+ defaultConfig: {}
143
+ },
144
+ {
145
+ label: "Document created",
146
+ block: reactor("trigger", "document-created"),
147
+ group: "powerhouse",
148
+ description: "Fires when a document is added to a drive.",
149
+ defaultConfig: {}
150
+ },
151
+ {
152
+ label: "Document deleted",
153
+ block: reactor("trigger", "document-deleted"),
154
+ group: "powerhouse",
155
+ description: "Fires when a document is removed from a drive.",
156
+ defaultConfig: {}
157
+ }
158
+ ];
159
+ const STEP_PRESETS = [
160
+ {
161
+ label: "Branch",
162
+ block: BRANCH_BLOCK,
163
+ group: "core",
164
+ description: "Routes true/false on a condition.",
165
+ defaultConfig: {}
166
+ },
167
+ {
168
+ label: "Router",
169
+ block: ROUTER_BLOCK,
170
+ group: "core",
171
+ description: "Takes the first of several branches whose condition holds.",
172
+ defaultConfig: { branches: [{ operator: "TEXT_EXACTLY_MATCHES" }] }
173
+ },
174
+ {
175
+ label: "Loop on items",
176
+ block: LOOP_BLOCK,
177
+ group: "core",
178
+ description: "Runs the steps inside it once for each item of a list.",
179
+ defaultConfig: { items: "" }
180
+ },
181
+ {
182
+ label: "Assert",
183
+ block: ASSERT_BLOCK,
184
+ group: "core",
185
+ description: "Fails the run when a value is blank, rejected or not allowed.",
186
+ defaultConfig: {
187
+ value: "",
188
+ allowValues: []
189
+ }
190
+ },
191
+ {
192
+ label: "Delay",
193
+ block: DELAY_BLOCK,
194
+ group: "core",
195
+ description: "Waits for a while, or until a date, then carries on.",
196
+ defaultConfig: {
197
+ mode: "for",
198
+ amount: 5,
199
+ unit: "minutes"
200
+ }
201
+ },
202
+ {
203
+ label: "Request approval",
204
+ block: APPROVAL_BLOCK,
205
+ group: "core",
206
+ description: "Waits until someone approves or rejects the run.",
207
+ defaultConfig: {
208
+ title: "",
209
+ approveLabel: "Approve",
210
+ rejectLabel: "Reject",
211
+ reasonRequiredOn: "none"
212
+ }
213
+ },
214
+ {
215
+ label: "Respond and wait for webhook",
216
+ block: WAIT_FOR_WEBHOOK_BLOCK,
217
+ group: "core",
218
+ description: "Answers the caller with a resume URL, then waits until it is called.",
219
+ defaultConfig: {
220
+ responseType: "json",
221
+ includeResumeUrl: true
222
+ }
223
+ },
224
+ {
225
+ label: "Stop run",
226
+ block: STOP_BLOCK,
227
+ group: "core",
228
+ description: "Ends the run successfully, optionally answering the caller.",
229
+ defaultConfig: { responseType: "json" }
230
+ },
231
+ {
232
+ label: "Call workflow",
233
+ block: CALL_FLOW_BLOCK,
234
+ group: "core",
235
+ description: "Runs a callable workflow in this drive, optionally waiting for its response.",
236
+ defaultConfig: {
237
+ mode: "simple",
238
+ waitForResponse: false
239
+ }
240
+ },
241
+ {
242
+ label: "Return response",
243
+ block: RETURN_RESPONSE_BLOCK,
244
+ group: "core",
245
+ description: "Answers the workflow that called this one.",
246
+ defaultConfig: {
247
+ mode: "simple",
248
+ response: { response: {} }
249
+ }
250
+ },
251
+ {
252
+ label: "Create document",
253
+ block: reactor("action", "document-create"),
254
+ group: "powerhouse",
255
+ description: "Creates a Powerhouse document.",
256
+ defaultConfig: {
257
+ documentType: "",
258
+ name: ""
259
+ }
260
+ },
261
+ {
262
+ label: "Dispatch actions",
263
+ block: reactor("action", "document-dispatch"),
264
+ group: "powerhouse",
265
+ description: "Sends actions to a document.",
266
+ defaultConfig: { documentId: "" }
267
+ },
268
+ {
269
+ label: "Get document",
270
+ block: reactor("action", "document-get"),
271
+ group: "powerhouse",
272
+ description: "Reads a document's current state.",
273
+ defaultConfig: { documentId: "" }
274
+ },
275
+ {
276
+ label: "Find documents",
277
+ block: reactor("action", "document-find"),
278
+ group: "powerhouse",
279
+ description: "Lists documents by type and name.",
280
+ defaultConfig: { documentType: "" }
281
+ },
282
+ {
283
+ label: "List document types",
284
+ block: reactor("action", "document-types"),
285
+ group: "powerhouse",
286
+ description: "Document models installed on this reactor.",
287
+ defaultConfig: {}
288
+ },
289
+ {
290
+ label: "Get document schema",
291
+ block: reactor("action", "document-schema"),
292
+ group: "powerhouse",
293
+ description: "Action and state schemas of a document type.",
294
+ defaultConfig: { documentType: "" }
295
+ }
296
+ ];
297
+ //#endregion
298
+ //#region editors/workflow-editor/runtime-client.ts
299
+ /** A switchboard's workflow-runtime subgraph, beside its GraphQL gateway. */
300
+ function workflowRuntimeUrl(switchboard) {
301
+ return `${switchboard.graphqlUrl.replace(/\/+$/, "")}/workflow-runtime`;
302
+ }
303
+ function createTransport(url, options) {
304
+ const doFetch = options.fetch ?? ((input, init) => fetch(input, init));
305
+ const tokenOf = options.token ?? ambientRenownTokenProvider;
306
+ return {
307
+ url,
308
+ gql: (query, variables) => gql(url, doFetch, tokenOf, query, variables, options.signal)
309
+ };
310
+ }
311
+ var RuntimeRequestError = class extends Error {
312
+ code;
313
+ constructor(message, code, options) {
314
+ super(message, options);
315
+ this.code = code;
316
+ this.name = "RuntimeRequestError";
317
+ }
318
+ };
319
+ function isSyncingError(error) {
320
+ return error instanceof RuntimeRequestError && error.code === "WORKFLOW_SYNCING";
321
+ }
322
+ async function gql(url, doFetch, tokenOf, query, variables, signal) {
323
+ const token = await tokenOf();
324
+ let response;
325
+ try {
326
+ response = await doFetch(url, {
327
+ method: "POST",
328
+ headers: {
329
+ "content-type": "application/json",
330
+ ...token ? { authorization: `Bearer ${token}` } : {}
331
+ },
332
+ body: JSON.stringify({
333
+ query,
334
+ variables
335
+ }),
336
+ signal
337
+ });
338
+ } catch (error) {
339
+ if (signal?.aborted) throw error;
340
+ throw new RuntimeRequestError(`The workflow runtime at ${url} could not be reached: ${error instanceof Error ? error.message : String(error)}`, "RUNTIME_UNREACHABLE", { cause: error });
341
+ }
342
+ if (response.status === 401 || response.status === 403) throw new RuntimeRequestError(`The workflow runtime at ${url} refused the request (HTTP ${response.status}). Sign in and try again.`, "RUNTIME_REFUSED");
343
+ if (response.status === 404) throw new RuntimeRequestError(`No workflow runtime answers at ${url} (HTTP 404): its switchboard runs no workflows.`, "NO_WORKFLOW_RUNTIME");
344
+ let body;
345
+ try {
346
+ body = await response.json();
347
+ } catch (error) {
348
+ throw new RuntimeRequestError(`The workflow runtime at ${url} answered HTTP ${response.status} without a GraphQL response.`, "RUNTIME_HTTP_ERROR", { cause: error });
349
+ }
350
+ const first = body?.errors?.[0];
351
+ if (first) {
352
+ const code = first.extensions?.code;
353
+ throw new RuntimeRequestError(first.message, typeof code === "string" ? code : void 0);
354
+ }
355
+ if (!response.ok) throw new RuntimeRequestError(`The workflow runtime at ${url} answered HTTP ${response.status}.`, "RUNTIME_HTTP_ERROR");
356
+ if (!body?.data) throw new Error("Empty GraphQL response");
357
+ return body.data;
358
+ }
359
+ function blockInput(block) {
360
+ return {
361
+ pieceName: block.pieceName,
362
+ pieceVersion: block.pieceVersion,
363
+ name: block.name,
364
+ kind: block.kind
365
+ };
366
+ }
367
+ function actionDefaultsOf(entry) {
368
+ const timeoutSeconds = entry.defaultTimeoutSeconds;
369
+ const retryAttempts = entry.defaultRetry?.maxAttempts;
370
+ if (timeoutSeconds === void 0 && retryAttempts === void 0) return {};
371
+ return { actionDefaults: {
372
+ ...timeoutSeconds !== void 0 ? { timeoutSeconds } : {},
373
+ ...retryAttempts !== void 0 ? { retryAttempts } : {}
374
+ } };
375
+ }
376
+ function getBlockForm(t, block) {
377
+ return t.gql(`query Descriptor($block: BlockInput!) {
378
+ workflowRuntime { blockDescriptor(block: $block) }
379
+ }`, { block: blockInput(block) }).then((data) => {
380
+ const descriptor = data.workflowRuntime.blockDescriptor;
381
+ const entry = descriptor?.action ?? descriptor?.trigger;
382
+ if (!descriptor || !entry) return null;
383
+ const strategy = !descriptor.action && Boolean(descriptor.trigger) ? checkTriggerStrategy(entry.strategy) : void 0;
384
+ if (strategy && "issue" in strategy) throw new Error(strategy.issue);
385
+ const delivery = strategy?.delivery;
386
+ const polled = delivery === "poll" && !isCoreBlock(block) && !isReactorPieceBlock(block);
387
+ const props = entry.props;
388
+ return {
389
+ title: isCoreBlock(block) ? entry.displayName : `${descriptor.displayName} · ${entry.displayName}`,
390
+ requireAuth: entry.requireAuth,
391
+ ...entry.requireReactor === "read" || entry.requireReactor === "write" ? { requireReactor: entry.requireReactor } : {},
392
+ auth: !descriptor.auth ? "none" : entry.requireAuth ? "required" : "optional",
393
+ props: polled ? [...props, POLL_INTERVAL_PROP] : props,
394
+ ...entry.ports ? { ports: entry.ports } : {},
395
+ ...delivery ? { triggerDelivery: delivery } : {},
396
+ ...entry.display ? { display: entry.display } : {},
397
+ ...entry.description ? { description: entry.description } : {},
398
+ ...entry.propertyGroups ? { propertyGroups: entry.propertyGroups } : {},
399
+ ...entry.classification ? { classification: entry.classification } : {},
400
+ ...entry.errorHandlingOptions ? { errorHandling: entry.errorHandlingOptions } : {},
401
+ ...actionDefaultsOf(entry)
402
+ };
403
+ });
404
+ }
405
+ function atVersion(listing) {
406
+ return listing.entries.map((entry) => ({
407
+ ...entry,
408
+ pieceName: listing.name,
409
+ pieceVersion: listing.version
410
+ }));
411
+ }
412
+ function fetchPieceCatalog(t) {
413
+ return t.gql(`query Catalog { workflowRuntime { pieceCatalog } }`, {}).then((data) => data.workflowRuntime.pieceCatalog);
414
+ }
415
+ async function fetchPieceActions(t, packageName) {
416
+ const listing = (await t.gql(`query Actions($packageName: String!) {
417
+ workflowRuntime { pieceActions(packageName: $packageName) }
418
+ }`, { packageName })).workflowRuntime.pieceActions;
419
+ return atVersion({
420
+ ...listing,
421
+ entries: listing.actions
422
+ });
423
+ }
424
+ async function fetchPieceTriggers(t, packageName) {
425
+ const listing = (await t.gql(`query Triggers($packageName: String!) {
426
+ workflowRuntime { pieceTriggers(packageName: $packageName) }
427
+ }`, { packageName })).workflowRuntime.pieceTriggers;
428
+ return atVersion({
429
+ ...listing,
430
+ entries: listing.triggers
431
+ });
432
+ }
433
+ async function searchPieces(t, query, filter) {
434
+ return (await t.gql(`query SearchPieces($query: String!, $kind: String!, $sources: [String!], $categories: [String!], $limit: Int) {
435
+ workflowRuntime { searchPieces(query: $query, kind: $kind, sources: $sources, categories: $categories, limit: $limit) {
436
+ status indexedPieces error
437
+ pieces {
438
+ pieceName pieceVersion displayName description logoUrl categories source deprecated unsupported namedPiece
439
+ blocks { pieceName pieceVersion name pieceDisplayName logoUrl displayName description kind strategy unsupported }
440
+ }
441
+ } }
442
+ }`, {
443
+ query,
444
+ kind: filter.kind,
445
+ sources: filter.sources ?? null,
446
+ categories: filter.categories ?? null,
447
+ limit: filter.limit ?? null
448
+ })).workflowRuntime.searchPieces;
449
+ }
450
+ function fetchBlockOutputTree(t, block, config) {
451
+ return t.gql(`query OutputTree($block: BlockInput!, $config: Unknown) {
452
+ workflowRuntime { blockOutputTree(block: $block, config: $config) }
453
+ }`, {
454
+ block: blockInput(block),
455
+ config: config ?? {}
456
+ }).then((data) => data.workflowRuntime.blockOutputTree);
457
+ }
458
+ function fetchStepOutputTree(t, workflowId, stepId) {
459
+ return t.gql(`query StepOutputTree($workflowId: String!, $stepId: String!) {
460
+ workflowRuntime { stepOutputTree(workflowId: $workflowId, stepId: $stepId) }
461
+ }`, {
462
+ workflowId,
463
+ stepId
464
+ }).then((data) => data.workflowRuntime.stepOutputTree);
465
+ }
466
+ function fetchConnections(t) {
467
+ return t.gql(`query Connections { workflowRuntime { connections { id name connectorId authType status accountLabel } } }`, {}).then((data) => data.workflowRuntime.connections);
468
+ }
469
+ function checkConnection(t, connectionId) {
470
+ return t.gql(`mutation CheckConnection($connectionId: String!) {
471
+ workflowRuntime {
472
+ checkConnection(connectionId: $connectionId) {
473
+ ok
474
+ detail
475
+ accountLabel
476
+ }
477
+ }
478
+ }`, { connectionId }).then((data) => data.workflowRuntime.checkConnection);
479
+ }
480
+ function fetchReactorAccess(t) {
481
+ return t.gql(`query ReactorAccess {
482
+ workflowRuntime { authEnforcement reactorIdentity { address key } authConditions }
483
+ }`, {}).then((data) => data.workflowRuntime);
484
+ }
485
+ function fetchReactorAccessDenial(t, workflowId) {
486
+ return t.gql(`query ReactorAccessDenial($workflowId: String!) {
487
+ workflowRuntime { reactorAccessDenial(workflowId: $workflowId) }
488
+ }`, { workflowId }).then((data) => data.workflowRuntime.reactorAccessDenial);
489
+ }
490
+ async function fetchOAuthRedirectUri(t) {
491
+ const uri = (await t.gql(`query OAuthRedirectUri { workflowRuntime { oauthRedirectUri } }`, {})).workflowRuntime.oauthRedirectUri;
492
+ return uri === null ? null : new URL(uri, t.url).href;
493
+ }
494
+ async function startOAuth(t, connectionId, options = {}) {
495
+ return (await t.gql(`mutation StartOAuth($connectionId: String!, $redirectUri: String, $returnUrl: String) {
496
+ workflowRuntime {
497
+ startOAuth(connectionId: $connectionId, redirectUri: $redirectUri, returnUrl: $returnUrl) {
498
+ state authorizationUrl redirectUri expiresAt
499
+ }
500
+ }
501
+ }`, {
502
+ connectionId,
503
+ redirectUri: options.redirectUri ?? null,
504
+ returnUrl: options.returnUrl ?? null
505
+ })).workflowRuntime.startOAuth;
506
+ }
507
+ async function fetchOAuthAttempt(t, state) {
508
+ return (await t.gql(`query OAuthAttempt($state: String!) {
509
+ workflowRuntime { oauthAttempt(state: $state) { connectionId status error } }
510
+ }`, { state })).workflowRuntime.oauthAttempt;
511
+ }
512
+ const SECRET_FIELDS = "ref label ownerId manageable version status createdAt updatedAt";
513
+ async function createSecret(t, documentId, value, label) {
514
+ return (await t.gql(`mutation CreateSecret($value: String!, $label: String, $documentId: String!) {
515
+ workflowRuntime { createSecret(value: $value, label: $label, documentId: $documentId) { ${SECRET_FIELDS} } }
516
+ }`, {
517
+ value,
518
+ label: label ?? null,
519
+ documentId
520
+ })).workflowRuntime.createSecret;
521
+ }
522
+ async function rotateSecret(t, ref, value) {
523
+ return (await t.gql(`mutation RotateSecret($ref: String!, $value: String!) {
524
+ workflowRuntime { rotateSecret(ref: $ref, value: $value) { ${SECRET_FIELDS} } }
525
+ }`, {
526
+ ref,
527
+ value
528
+ })).workflowRuntime.rotateSecret;
529
+ }
530
+ async function fetchSecretStat(t, ref) {
531
+ return (await t.gql(`query Secret($ref: String!) {
532
+ workflowRuntime { secret(ref: $ref) { ${SECRET_FIELDS} } }
533
+ }`, { ref })).workflowRuntime.secret;
534
+ }
535
+ async function fetchWebhookEndpoint(t, workflowId, driveId) {
536
+ return (await t.gql(`query WebhookEndpoint($workflowId: String!, $driveId: String) {
537
+ workflowRuntime {
538
+ webhookEndpoint(workflowId: $workflowId, driveId: $driveId) {
539
+ workflowId url absoluteUrl armed createdAt
540
+ }
541
+ }
542
+ }`, {
543
+ workflowId,
544
+ driveId: driveId ?? null
545
+ })).workflowRuntime.webhookEndpoint;
546
+ }
547
+ async function testTrigger(t, workflowId, driveId) {
548
+ return (await t.gql(`mutation TestTrigger($workflowId: String!, $driveId: String) {
549
+ workflowRuntime { testTrigger(workflowId: $workflowId, driveId: $driveId) }
550
+ }`, {
551
+ workflowId,
552
+ driveId: driveId ?? null
553
+ })).workflowRuntime.testTrigger;
554
+ }
555
+ async function testCoreTrigger(t, workflowId, options = {}) {
556
+ return (await t.gql(`mutation TestCoreTrigger($workflowId: String!, $payload: Unknown, $timeoutSeconds: Int, $driveId: String) {
557
+ workflowRuntime {
558
+ testTrigger(workflowId: $workflowId, payload: $payload, timeoutSeconds: $timeoutSeconds, driveId: $driveId)
559
+ }
560
+ }`, {
561
+ workflowId,
562
+ payload: options.payload ?? null,
563
+ timeoutSeconds: options.timeoutSeconds ?? null,
564
+ driveId: options.driveId ?? null
565
+ })).workflowRuntime.testTrigger;
566
+ }
567
+ async function cancelTriggerTest(t, workflowId) {
568
+ return (await t.gql(`mutation CancelTriggerTest($workflowId: String!) {
569
+ workflowRuntime { cancelTriggerTest(workflowId: $workflowId) }
570
+ }`, { workflowId })).workflowRuntime.cancelTriggerTest;
571
+ }
572
+ async function testStep(t, workflowId, stepId, driveId) {
573
+ return (await t.gql(`mutation TestStep($workflowId: String!, $stepId: String!, $driveId: String) {
574
+ workflowRuntime {
575
+ testStep(workflowId: $workflowId, stepId: $stepId, driveId: $driveId) {
576
+ runId status output error errorName durationMs
577
+ }
578
+ }
579
+ }`, {
580
+ workflowId,
581
+ stepId,
582
+ driveId: driveId ?? null
583
+ })).workflowRuntime.testStep;
584
+ }
585
+ async function blockResolutions(t, workflowId) {
586
+ return (await t.gql(`query BlockResolutions($workflowId: String!) {
587
+ workflowRuntime {
588
+ blockResolutions(workflowId: $workflowId) {
589
+ stepId pieceName pieceVersion name kind resolvedVersion source match note latestVersion
590
+ }
591
+ }
592
+ }`, { workflowId })).workflowRuntime.blockResolutions;
593
+ }
594
+ const WAITPOINT_FIELDS = `id runId workflowId stepId stepKey stepPath pieceName
595
+ blockName type kind status createdAt resumeAt expiresAt resolvedAt decidedBy
596
+ approval { title body approveLabel rejectLabel reasonRequiredOn approvers }`;
597
+ const RUN_ROW_FIELDS = `id workflowId workflowName workflowVersion triggerKind
598
+ triggerPayload status error errorName startedAt endedAt rerunOf warningNotes`;
599
+ const STEP_ROW_FIELDS = "stepId stepKey path pieceName blockName status port error errorName startedAt endedAt";
600
+ function withIterations(run) {
601
+ const iterations = run.steps.filter((step) => step.path);
602
+ if (iterations.length === 0) return run;
603
+ return {
604
+ ...run,
605
+ steps: run.steps.filter((step) => !step.path),
606
+ iterations
607
+ };
608
+ }
609
+ const RUN_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} input output }`;
610
+ const RUN_LIST_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} }`;
611
+ const RUN_DETAIL_FIELDS = `${RUN_FIELDS} iterationsTotal waitpoints { ${WAITPOINT_FIELDS} }`;
612
+ function scopeVariables(scope, limit) {
613
+ return {
614
+ workflowId: scope.workflowId ?? null,
615
+ driveId: scope.driveId ?? null,
616
+ excludeTriggerKinds: scope.excludeTriggerKinds ?? null,
617
+ limit: scope.limit ?? limit
618
+ };
619
+ }
620
+ async function fetchRuns(t, scope = {}) {
621
+ return (await t.gql(`query Runs($workflowId: String, $driveId: String, $limit: Int, $excludeTriggerKinds: [String!]) {
622
+ workflowRuntime { runs(workflowId: $workflowId, driveId: $driveId, limit: $limit, excludeTriggerKinds: $excludeTriggerKinds) { ${RUN_FIELDS} } }
623
+ }`, scopeVariables(scope, 30))).workflowRuntime.runs.map(withIterations);
624
+ }
625
+ async function fetchRunsPage(t, scope = {}, cursor = null) {
626
+ const { limit, ...rest } = scopeVariables(scope, 30);
627
+ const page = (await t.gql(`query RunsPage($workflowId: String, $driveId: String, $excludeTriggerKinds: [String!], $paging: WorkflowRunsPagingInput) {
628
+ workflowRuntime {
629
+ runsPage(workflowId: $workflowId, driveId: $driveId, excludeTriggerKinds: $excludeTriggerKinds, paging: $paging) {
630
+ items { ${RUN_LIST_FIELDS} } hasNextPage cursor
631
+ }
632
+ }
633
+ }`, {
634
+ ...rest,
635
+ paging: {
636
+ limit,
637
+ cursor
638
+ }
639
+ })).workflowRuntime.runsPage;
640
+ return {
641
+ ...page,
642
+ items: page.items.map(withIterations)
643
+ };
644
+ }
645
+ async function fetchRun(t, runId) {
646
+ const run = (await t.gql(`query Run($id: String!) { workflowRuntime { run(id: $id) { ${RUN_DETAIL_FIELDS} } } }`, { id: runId })).workflowRuntime.run;
647
+ return run ? withIterations(run) : null;
648
+ }
649
+ async function fetchWaitingRuns(t, scope = {}) {
650
+ return (await t.gql(`query WaitingRuns($driveId: String, $workflowId: String, $first: Int) {
651
+ workflowRuntime {
652
+ waitingRuns(driveId: $driveId, workflowId: $workflowId, first: $first) {
653
+ ${RUN_LIST_FIELDS} waitpoints { ${WAITPOINT_FIELDS} }
654
+ }
655
+ }
656
+ }`, {
657
+ driveId: scope.driveId ?? null,
658
+ workflowId: scope.workflowId ?? null,
659
+ first: scope.first ?? null
660
+ })).workflowRuntime.waitingRuns.map(withIterations);
661
+ }
662
+ async function resolveWaitpoint(t, waitpointId, approved, reason) {
663
+ return (await t.gql(`mutation ResolveWaitpoint($waitpointId: String!, $approved: Boolean!, $reason: String) {
664
+ workflowRuntime {
665
+ resolveWaitpoint(waitpointId: $waitpointId, approved: $approved, reason: $reason) {
666
+ ${WAITPOINT_FIELDS}
667
+ }
668
+ }
669
+ }`, {
670
+ waitpointId,
671
+ approved,
672
+ reason: reason ?? null
673
+ })).workflowRuntime.resolveWaitpoint;
674
+ }
675
+ async function fireWorkflow(t, workflowId, payload) {
676
+ return (await t.gql(`mutation Fire($workflowId: String!, $payload: Unknown) {
677
+ workflowRuntime { fire(workflowId: $workflowId, payload: $payload) { runId status error } }
678
+ }`, {
679
+ workflowId,
680
+ payload: payload ?? {}
681
+ })).workflowRuntime.fire;
682
+ }
683
+ async function rerunRun(t, runId) {
684
+ return (await t.gql(`mutation Rerun($runId: String!) {
685
+ workflowRuntime { rerun(runId: $runId) { runId status error } }
686
+ }`, { runId })).workflowRuntime.rerun;
687
+ }
688
+ async function cancelRun(t, runId) {
689
+ return (await t.gql(`mutation CancelRun($runId: String!) {
690
+ workflowRuntime { cancelRun(runId: $runId) { runId status error } }
691
+ }`, { runId })).workflowRuntime.cancelRun;
692
+ }
693
+ async function loadBlockOptions(t, block, propName, input, connectionId, searchValue, reactorConnectionId, workflowId) {
694
+ return (await t.gql(`query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String, $reactorConnectionId: String, $workflowId: String) {
695
+ workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue, reactorConnectionId: $reactorConnectionId, workflowId: $workflowId) }
696
+ }`, {
697
+ block: blockInput(block),
698
+ propName,
699
+ input,
700
+ connectionId: connectionId ?? null,
701
+ searchValue: searchValue ?? null,
702
+ reactorConnectionId: reactorConnectionId ?? null,
703
+ workflowId: workflowId ?? null
704
+ })).workflowRuntime.blockOptions;
705
+ }
706
+ const operations = {
707
+ getBlockForm,
708
+ fetchPieceCatalog,
709
+ fetchPieceActions,
710
+ fetchPieceTriggers,
711
+ searchPieces,
712
+ fetchBlockOutputTree,
713
+ fetchStepOutputTree,
714
+ fetchConnections,
715
+ checkConnection,
716
+ fetchReactorAccess,
717
+ fetchReactorAccessDenial,
718
+ fetchOAuthRedirectUri,
719
+ startOAuth,
720
+ fetchOAuthAttempt,
721
+ createSecret,
722
+ rotateSecret,
723
+ fetchSecretStat,
724
+ fetchWebhookEndpoint,
725
+ testTrigger,
726
+ testCoreTrigger,
727
+ cancelTriggerTest,
728
+ testStep,
729
+ blockResolutions,
730
+ fetchRuns,
731
+ fetchRunsPage,
732
+ fetchRun,
733
+ fetchWaitingRuns,
734
+ fireWorkflow,
735
+ rerunRun,
736
+ resolveWaitpoint,
737
+ cancelRun,
738
+ loadBlockOptions
739
+ };
740
+ function createRuntimeClient(url, options = {}) {
741
+ const transport = createTransport(url, options);
742
+ const bound = Object.fromEntries(Object.entries(operations).map(([name, operation]) => [name, (...args) => operation(transport, ...args)]));
743
+ return {
744
+ ...transport,
745
+ ...bound
746
+ };
747
+ }
748
+ //#endregion
749
+ //#region editors/workflow-editor/run-kinds.ts
750
+ const TEST_TRIGGER_KIND = "test";
751
+ function realRuns(runs) {
752
+ return runs.filter((run) => run.triggerKind !== TEST_TRIGGER_KIND);
753
+ }
754
+ //#endregion
755
+ //#region editors/workflow-editor/ui/query-keys.ts
756
+ function blockPart(block) {
757
+ return [
758
+ block.pieceName,
759
+ block.pieceVersion,
760
+ block.kind,
761
+ block.name
762
+ ];
763
+ }
764
+ function blockRefKey(block) {
765
+ return blockPart(block).join(" ");
766
+ }
767
+ function resolverKey(scope, kind, input) {
768
+ return [
769
+ scope,
770
+ kind,
771
+ blockPart(input.block),
772
+ input.propName,
773
+ input.refreshers,
774
+ input.connectionId ?? null,
775
+ input.searchValue ?? null,
776
+ input.reactorConnectionId ?? null
777
+ ];
778
+ }
779
+ const runtimeKeys = {
780
+ all: (scope) => [scope],
781
+ catalog: (scope) => [scope, "catalog"],
782
+ form: (scope, block) => [
783
+ scope,
784
+ "form",
785
+ blockPart(block)
786
+ ],
787
+ pieceActions: (scope, packageName) => [
788
+ scope,
789
+ "pieceActions",
790
+ packageName
791
+ ],
792
+ pieceTriggers: (scope, packageName) => [
793
+ scope,
794
+ "pieceTriggers",
795
+ packageName
796
+ ],
797
+ searchPieces: (scope, query, filter) => [
798
+ scope,
799
+ "searchPieces",
800
+ query,
801
+ filter
802
+ ],
803
+ outputTrees: (scope) => [scope, "outputTree"],
804
+ outputTree: (scope, block, config) => [
805
+ scope,
806
+ "outputTree",
807
+ blockPart(block),
808
+ config ?? {}
809
+ ],
810
+ stepOutputTree: (scope, workflowId, stepId, testedAt) => [
811
+ scope,
812
+ "outputTree",
813
+ "step",
814
+ workflowId,
815
+ stepId,
816
+ testedAt
817
+ ],
818
+ options: (scope, input) => resolverKey(scope, "options", input),
819
+ dynamic: (scope, input) => resolverKey(scope, "dynamic", input),
820
+ connections: (scope, filter) => filter === void 0 ? [scope, "connections"] : [
821
+ scope,
822
+ "connections",
823
+ filter
824
+ ],
825
+ webhook: (scope, workflowId) => [
826
+ scope,
827
+ "webhook",
828
+ workflowId
829
+ ],
830
+ latestRun: (scope, workflowId) => [
831
+ scope,
832
+ "latestRun",
833
+ workflowId
834
+ ],
835
+ allRuns: (scope) => [scope, "runs"],
836
+ runs: (scope, runsScope) => [
837
+ scope,
838
+ "runs",
839
+ {
840
+ workflowId: runsScope.workflowId ?? null,
841
+ driveId: runsScope.driveId ?? null,
842
+ limit: runsScope.limit ?? null
843
+ }
844
+ ],
845
+ runPages: (scope, runsScope) => [
846
+ scope,
847
+ "runs",
848
+ "pages",
849
+ {
850
+ workflowId: runsScope.workflowId ?? null,
851
+ driveId: runsScope.driveId ?? null,
852
+ limit: runsScope.limit ?? null
853
+ }
854
+ ],
855
+ waitingRuns: (scope, waiting) => [
856
+ scope,
857
+ "runs",
858
+ "waiting",
859
+ {
860
+ driveId: waiting.driveId ?? null,
861
+ workflowId: waiting.workflowId ?? null,
862
+ first: waiting.first ?? null
863
+ }
864
+ ],
865
+ run: (scope, runId) => [
866
+ scope,
867
+ "run",
868
+ runId
869
+ ],
870
+ reactorAccess: (scope, viewer) => [
871
+ scope,
872
+ "reactorAccess",
873
+ viewer
874
+ ],
875
+ reactorDenial: (scope, workflowId) => [
876
+ scope,
877
+ "reactorDenial",
878
+ workflowId
879
+ ],
880
+ secret: (scope, ref) => [
881
+ scope,
882
+ "secret",
883
+ ref
884
+ ],
885
+ allBlockResolutions: (scope, workflowId) => [
886
+ scope,
887
+ "blockResolutions",
888
+ workflowId
889
+ ],
890
+ blockResolutions: (scope, workflowId, blocks) => [
891
+ scope,
892
+ "blockResolutions",
893
+ workflowId,
894
+ blocks.map(blockPart)
895
+ ]
896
+ };
897
+ function queryKind(key) {
898
+ return typeof key[1] === "string" ? key[1] : void 0;
899
+ }
900
+ const SHARED_STALE_MS = 18e5;
901
+ const RESOLVER_STALE_MS = 3e5;
902
+ //#endregion
903
+ //#region editors/workflow-editor/runtime-queries.ts
904
+ function createRuntimeQueryClient() {
905
+ return new QueryClient({ defaultOptions: {
906
+ queries: {
907
+ retry: false,
908
+ refetchOnWindowFocus: false
909
+ },
910
+ mutations: { retry: false }
911
+ } });
912
+ }
913
+ const catalogQuery = (client) => queryOptions({
914
+ queryKey: runtimeKeys.catalog(client.url),
915
+ queryFn: () => client.fetchPieceCatalog(),
916
+ staleTime: SHARED_STALE_MS
917
+ });
918
+ const blockFormQuery = (client, block) => queryOptions({
919
+ queryKey: runtimeKeys.form(client.url, block),
920
+ queryFn: () => client.getBlockForm(block),
921
+ staleTime: SHARED_STALE_MS
922
+ });
923
+ const pieceActionsQuery = (client, packageName) => queryOptions({
924
+ queryKey: runtimeKeys.pieceActions(client.url, packageName),
925
+ queryFn: () => client.fetchPieceActions(packageName),
926
+ staleTime: SHARED_STALE_MS
927
+ });
928
+ const pieceTriggersQuery = (client, packageName) => queryOptions({
929
+ queryKey: runtimeKeys.pieceTriggers(client.url, packageName),
930
+ queryFn: () => client.fetchPieceTriggers(packageName),
931
+ staleTime: SHARED_STALE_MS
932
+ });
933
+ const outputTreeQuery = (client, block, config) => queryOptions({
934
+ queryKey: runtimeKeys.outputTree(client.url, block, config),
935
+ queryFn: () => client.fetchBlockOutputTree(block, config),
936
+ staleTime: Infinity
937
+ });
938
+ const stepOutputTreeQuery = (client, workflowId, stepId, testedAt) => queryOptions({
939
+ queryKey: runtimeKeys.stepOutputTree(client.url, workflowId, stepId, testedAt),
940
+ queryFn: () => client.fetchStepOutputTree(workflowId, stepId),
941
+ staleTime: Infinity
942
+ });
943
+ const REAL_RUNS = [TEST_TRIGGER_KIND];
944
+ const runsQuery = (client, scope) => queryOptions({
945
+ queryKey: runtimeKeys.runs(client.url, scope),
946
+ queryFn: () => client.fetchRuns({
947
+ ...scope,
948
+ excludeTriggerKinds: REAL_RUNS
949
+ }).then(realRuns),
950
+ staleTime: 0
951
+ });
952
+ const runPagesQuery = (client, scope) => infiniteQueryOptions({
953
+ queryKey: runtimeKeys.runPages(client.url, scope),
954
+ queryFn: ({ pageParam }) => client.fetchRunsPage({
955
+ ...scope,
956
+ excludeTriggerKinds: REAL_RUNS
957
+ }, pageParam),
958
+ initialPageParam: null,
959
+ getNextPageParam: (page) => page.hasNextPage && page.cursor ? page.cursor : void 0,
960
+ staleTime: 0
961
+ });
962
+ function runsOfPages(pages) {
963
+ const seen = /* @__PURE__ */ new Set();
964
+ return realRuns(pages.flatMap((page) => page.items)).filter((run) => {
965
+ if (seen.has(run.id)) return false;
966
+ seen.add(run.id);
967
+ return true;
968
+ });
969
+ }
970
+ const waitingRunsQuery = (client, scope) => queryOptions({
971
+ queryKey: runtimeKeys.waitingRuns(client.url, scope),
972
+ queryFn: () => client.fetchWaitingRuns(scope),
973
+ staleTime: 0
974
+ });
975
+ const FINISHED = /* @__PURE__ */ new Set([
976
+ "SUCCEEDED",
977
+ "FAILED",
978
+ "CANCELLED"
979
+ ]);
980
+ const runQuery = (client, runId) => queryOptions({
981
+ queryKey: runtimeKeys.run(client.url, runId),
982
+ queryFn: () => client.fetchRun(runId),
983
+ staleTime: (query) => query.state.data && FINISHED.has(query.state.data.status) ? Infinity : 0
984
+ });
985
+ const secretStatQuery = (client, ref) => queryOptions({
986
+ queryKey: runtimeKeys.secret(client.url, ref),
987
+ queryFn: () => client.fetchSecretStat(ref),
988
+ staleTime: 0
989
+ });
990
+ //#endregion
991
+ export { triggerFields as $, BRANCH_BLOCK as A, SCHEDULE_TRIGGER as B, fetchRun as C, workflowRuntimeUrl as D, isSyncingError as E, LOOP_BLOCK as F, WAIT_FOR_WEBHOOK_BLOCK as G, STOP_BLOCK as H, MANUAL_TRIGGER as I, pinBlock as J, WEBHOOK_TRIGGER as K, REACTOR_PIECE as L, CALL_FLOW_BLOCK as M, CORE_PIECE as N, APPROVAL_BLOCK as O, DELAY_BLOCK as P, triggerBlock as Q, RETURN_RESPONSE_BLOCK as R, createRuntimeClient as S, fetchRunsPage as T, SUBFLOWS_PIECE as U, STEP_PRESETS as V, TRIGGER_PRESETS as W, stepBlock as X, sameBlock as Y, stepFields as Z, queryKind as _, pieceActionsQuery as a, realRuns as b, runQuery as c, secretStatQuery as d, stepOutputTreeQuery as f, blockRefKey as g, SHARED_STALE_MS as h, outputTreeQuery as i, CALLABLE_FLOW_TRIGGER$1 as j, ASSERT_BLOCK as k, runsOfPages as l, RESOLVER_STALE_MS as m, catalogQuery as n, pieceTriggersQuery as o, waitingRunsQuery as p, isCoreBlock as q, createRuntimeQueryClient as r, runPagesQuery as s, blockFormQuery as t, runsQuery as u, runtimeKeys as v, fetchRuns as w, RuntimeRequestError as x, TEST_TRIGGER_KIND as y, ROUTER_BLOCK as z };
992
+
993
+ //# sourceMappingURL=runtime-queries-FmEzElOY.js.map