@powerhousedao/workflow 6.2.3 → 6.3.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{node/BlockSelector-C3XYZfPY.mjs → browser/BlockSelector-CEdYUqjx.js} +2006 -1692
- package/dist/browser/BlockSelector-CEdYUqjx.js.map +1 -0
- package/dist/browser/PieceMarkdown-DSdZd-Jc.js +92 -0
- package/dist/browser/PieceMarkdown-DSdZd-Jc.js.map +1 -0
- package/dist/browser/connection-form-Biksq2jW.js +1524 -0
- package/dist/browser/connection-form-Biksq2jW.js.map +1 -0
- package/dist/browser/{connection-BUum0hJI.js → connection-ilYFCRUK.js} +2 -2
- package/dist/browser/{connection-BUum0hJI.js.map → connection-ilYFCRUK.js.map} +1 -1
- package/dist/browser/data-tree-Cq-s6bJp.js +76 -0
- package/dist/browser/data-tree-Cq-s6bJp.js.map +1 -0
- package/dist/browser/document-models/connection/index.js +3 -3
- package/dist/browser/document-models/index.js +3 -3
- package/dist/browser/document-models/workflow/index.js +3 -3
- package/dist/browser/document-models-C2SAP1SX.js +164 -0
- package/dist/browser/{document-models-C1ZgIZyV.js.map → document-models-C2SAP1SX.js.map} +1 -1
- package/dist/browser/editor-CIqKi7XK.js +3219 -0
- package/dist/browser/editor-CIqKi7XK.js.map +1 -0
- package/dist/browser/editor-DYjoPfta.js +4669 -0
- package/dist/browser/editor-DYjoPfta.js.map +1 -0
- package/dist/browser/{editor-BCH8vdej.js → editor-GeRXGdie.js} +174 -48
- package/dist/browser/editor-GeRXGdie.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/connection-editor/module.js.map +1 -1
- package/dist/browser/editors/runtime/index.js +2 -0
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js.map +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +164 -88
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{module-jDZ4pq3W.js → module-DJz6oTX0.js} +237 -30
- package/dist/browser/module-DJz6oTX0.js.map +1 -0
- package/dist/browser/{module-DU2vb3FH.js → module-mFCt9WHJ.js} +267 -89
- package/dist/browser/module-mFCt9WHJ.js.map +1 -0
- package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
- package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/browser/runtime-queries-FmEzElOY.js +993 -0
- package/dist/browser/runtime-queries-FmEzElOY.js.map +1 -0
- package/dist/browser/trigger-text-DH6HIeoa.js +3210 -0
- package/dist/browser/trigger-text-DH6HIeoa.js.map +1 -0
- package/dist/browser/upgrade-manifests-C2Qa6myy.js +8 -0
- package/dist/browser/{upgrade-manifests-BpakVE9l.js.map → upgrade-manifests-C2Qa6myy.js.map} +1 -1
- package/dist/{node/workflow-CGzYGZnr.mjs → browser/workflow-2gR2JXUS.js} +4 -3
- package/dist/browser/workflow-2gR2JXUS.js.map +1 -0
- package/dist/node/document-models/connection/index.mjs +67 -3
- package/dist/node/document-models/connection/index.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +3 -3
- package/dist/node/document-models/workflow/index.mjs +86 -3
- package/dist/node/document-models/workflow/index.mjs.map +1 -0
- package/dist/node/editors/index.mjs +6 -4
- package/dist/node/editors/index.mjs.map +1 -0
- package/dist/node/index.mjs +69 -381
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-Dhe5E-VA.mjs → module-BXKUB58R.mjs} +273 -90
- package/dist/node/module-BXKUB58R.mjs.map +1 -0
- package/dist/node/{module-BMwJQh65.mjs → module-CaBtkQmd.mjs} +226 -19
- package/dist/node/module-CaBtkQmd.mjs.map +1 -0
- package/dist/node/pieces/ai/descriptor.json +857 -0
- package/dist/node/pieces/ai/index.mjs +624 -0
- package/dist/node/pieces/ai/package.json +9 -0
- package/dist/node/pieces/index.mjs +3 -0
- package/dist/node/pieces/index.mjs.map +1 -1
- package/dist/node/pieces/reactor/descriptor.json +104 -18
- package/dist/node/pieces/reactor/index.mjs +48 -17670
- package/dist/node/pieces/reactor/package.json +2 -2
- package/dist/node/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/node/upgrade-manifests-BCCpSD1J.mjs +8 -0
- package/dist/node/{upgrade-manifests-CmNd742Y.mjs.map → upgrade-manifests-BCCpSD1J.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +72 -6
- package/dist/style.css +3 -2520
- package/dist/types/ai/runtime.d.ts +13 -0
- package/dist/types/ai/runtime.d.ts.map +1 -0
- package/dist/types/ai/tools.d.ts +10 -6
- package/dist/types/ai/tools.d.ts.map +1 -1
- package/dist/types/ai/workflow-tools.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/actions.d.ts +3 -0
- package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/config/actions.d.ts +10 -2
- package/dist/types/document-models/connection/v1/gen/config/actions.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/config/creators.d.ts +4 -2
- package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts +29 -1
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/config/operations.d.ts +3 -1
- package/dist/types/document-models/connection/v1/gen/config/operations.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +13 -1
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +18 -2
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +5 -1
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/module.d.ts +3 -0
- package/dist/types/document-models/connection/v1/module.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts +17 -0
- package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/utils.d.ts +1 -1
- package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts +2 -0
- package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts +2 -0
- package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts.map +1 -0
- package/dist/types/document-models/document-models.d.ts +8 -0
- package/dist/types/document-models/document-models.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/actions.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +52 -6
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +7 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts +14 -2
- package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts +5 -2
- package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +32 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts +4 -1
- package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/module.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +1 -1
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/ReactorBindings.d.ts +6 -0
- package/dist/types/editors/connection-editor/ReactorBindings.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts +7 -0
- package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts +4 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-usage.d.ts +13 -3
- package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/editor.d.ts +3 -1
- package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/module.d.ts +2 -1
- package/dist/types/editors/connection-editor/module.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
- package/dist/types/editors/runtime/index.d.ts +21 -0
- package/dist/types/editors/runtime/index.d.ts.map +1 -0
- package/dist/types/editors/runtime/runtime-export.test.d.ts +2 -0
- package/dist/types/editors/runtime/runtime-export.test.d.ts.map +1 -0
- package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
- package/dist/types/editors/shared/controls.d.ts +1 -0
- package/dist/types/editors/shared/controls.d.ts.map +1 -1
- package/dist/types/editors/shared/data-tree.d.ts.map +1 -1
- package/dist/types/editors/shared/data-viewer.d.ts.map +1 -1
- package/dist/types/editors/shared/document-ref.d.ts +5 -0
- package/dist/types/editors/shared/document-ref.d.ts.map +1 -0
- package/dist/types/editors/shared/editor-chrome.d.ts +6 -1
- package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
- package/dist/types/editors/shared/editor-chrome.test.d.ts +2 -0
- package/dist/types/editors/shared/editor-chrome.test.d.ts.map +1 -0
- package/dist/types/editors/shared/icons.d.ts +5 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -1
- package/dist/types/editors/shared/pending-echo.d.ts +9 -0
- package/dist/types/editors/shared/pending-echo.d.ts.map +1 -0
- package/dist/types/editors/shared/undo-plan.d.ts +12 -5
- package/dist/types/editors/shared/undo-plan.d.ts.map +1 -1
- package/dist/types/editors/shared/url-param.d.ts +14 -0
- package/dist/types/editors/shared/url-param.d.ts.map +1 -0
- package/dist/types/editors/shared/url-param.test.d.ts +2 -0
- package/dist/types/editors/shared/url-param.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts +3 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/module.d.ts +2 -1
- package/dist/types/editors/workflow-editor/module.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/reactor-hooks.d.ts +25 -0
- package/dist/types/editors/workflow-editor/reactor-hooks.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-api.d.ts +13 -11
- package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +96 -9
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +12 -3
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-persist.d.ts +1 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts +21 -1
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +15 -2
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts +2 -1
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +17 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts +6 -0
- package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/StepError.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/StepError.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +3 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/document-options.d.ts +24 -0
- package/dist/types/editors/workflow-editor/ui/document-options.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +11 -2
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts +31 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts +19 -0
- package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +23 -3
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +16 -4
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts +43 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts +25 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts +7 -2
- package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts +13 -0
- package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/RunDialog.d.ts +7 -0
- package/dist/types/editors/workflow-studio/components/RunDialog.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +11 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts +3 -1
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts +7 -0
- package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +4 -0
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +57 -0
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +4 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts +41 -0
- package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/chain.d.ts +6 -0
- package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +30 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/run-format.d.ts +6 -1
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/tips.d.ts +23 -0
- package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts +5 -0
- package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts +10 -0
- package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/workflow-order.d.ts +19 -0
- package/dist/types/editors/workflow-studio/components/workflow-order.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/index.d.ts +7 -0
- package/dist/types/pieces/ai/index.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
- package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
- package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/models.d.ts +19 -0
- package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/props.d.ts +16 -0
- package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
- package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
- package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
- package/dist/types/pieces/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +5 -2
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -1
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +14 -0
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/documents.d.ts +33 -0
- package/dist/types/pieces/reactor/lib/documents.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/documents.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/documents.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts +27 -4
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +6 -6
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
- package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
- package/dist/types/pieces/reactor/reactor.test.d.ts +2 -0
- package/dist/types/pieces/reactor/reactor.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/test-signer.d.ts +3 -0
- package/dist/types/pieces/reactor/test-signer.d.ts.map +1 -0
- package/dist/types/scripts/ui-stack.d.ts +21 -6
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/dist/types/test/graphql-server.d.ts +9 -0
- package/dist/types/test/graphql-server.d.ts.map +1 -0
- package/dist/types/test/runtime-schema.d.ts +17 -0
- package/dist/types/test/runtime-schema.d.ts.map +1 -0
- package/dist/types/test/switchboards.d.ts +20 -0
- package/dist/types/test/switchboards.d.ts.map +1 -0
- package/dist/types/test/ui/flow-control.spec.d.ts +2 -0
- package/dist/types/test/ui/flow-control.spec.d.ts.map +1 -0
- package/dist/types/test/ui/harness/property-form-echo.d.ts +12 -0
- package/dist/types/test/ui/harness/property-form-echo.d.ts.map +1 -0
- package/dist/types/test/ui/harness/schedule-builder.d.ts +8 -0
- package/dist/types/test/ui/harness/schedule-builder.d.ts.map +1 -0
- package/dist/types/test/ui/manual-inputs.spec.d.ts +2 -0
- package/dist/types/test/ui/manual-inputs.spec.d.ts.map +1 -0
- package/dist/types/test/ui/property-form-echo.spec.d.ts +2 -0
- package/dist/types/test/ui/property-form-echo.spec.d.ts.map +1 -0
- package/dist/types/test/ui/reactor-connection.spec.d.ts +2 -0
- package/dist/types/test/ui/reactor-connection.spec.d.ts.map +1 -0
- package/dist/types/test/ui/schedule-builder.spec.d.ts +2 -0
- package/dist/types/test/ui/schedule-builder.spec.d.ts.map +1 -0
- package/dist/types/test/waitpoint-record.d.ts +3 -0
- package/dist/types/test/waitpoint-record.d.ts.map +1 -0
- package/dist/workflow.css +68 -0
- package/package.json +40 -11
- package/dist/browser/BlockSelector-BQDqIbRZ.js +0 -3053
- package/dist/browser/BlockSelector-BQDqIbRZ.js.map +0 -1
- package/dist/browser/PieceMarkdown-B8EEaQgT.js +0 -21435
- package/dist/browser/PieceMarkdown-B8EEaQgT.js.map +0 -1
- package/dist/browser/assets/entry-D62sYiFV.js +0 -318
- package/dist/browser/assets/projection-entry-BGcu_9-p.js +0 -446
- package/dist/browser/connection-form-BCxGD8Zk.js +0 -831
- package/dist/browser/connection-form-BCxGD8Zk.js.map +0 -1
- package/dist/browser/data-tree-CZZkfzSH.js +0 -1896
- package/dist/browser/data-tree-CZZkfzSH.js.map +0 -1
- package/dist/browser/document-models-C1ZgIZyV.js +0 -103
- package/dist/browser/editor-BCH8vdej.js.map +0 -1
- package/dist/browser/editor-Bd2Cu8Mx.js +0 -1793
- package/dist/browser/editor-Bd2Cu8Mx.js.map +0 -1
- package/dist/browser/editor-Bl1Xp7N8.js +0 -17234
- package/dist/browser/editor-Bl1Xp7N8.js.map +0 -1
- package/dist/browser/module-DU2vb3FH.js.map +0 -1
- package/dist/browser/module-jDZ4pq3W.js.map +0 -1
- package/dist/browser/piece-auth-BS5CtQOG.js +0 -146
- package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
- package/dist/browser/rolldown-runtime-DC62tzP2.js +0 -33
- package/dist/browser/runtime-queries-Ds2kk-Ow.js +0 -2535
- package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +0 -1
- package/dist/browser/trigger-text-Ld2uv0Cf.js +0 -5569
- package/dist/browser/trigger-text-Ld2uv0Cf.js.map +0 -1
- package/dist/browser/upgrade-manifests-BpakVE9l.js +0 -8
- package/dist/browser/workflow-BxShRhVy.js +0 -108
- package/dist/browser/workflow-BxShRhVy.js.map +0 -1
- package/dist/node/BlockSelector-C3XYZfPY.mjs.map +0 -1
- package/dist/node/PieceMarkdown-BMhBGa4t.mjs +0 -23281
- package/dist/node/PieceMarkdown-BMhBGa4t.mjs.map +0 -1
- package/dist/node/connection-D544oqVW.mjs +0 -90
- package/dist/node/connection-D544oqVW.mjs.map +0 -1
- package/dist/node/connection-form-CjUay_qz.mjs +0 -831
- package/dist/node/connection-form-CjUay_qz.mjs.map +0 -1
- package/dist/node/data-tree-CGfeCLr7.mjs +0 -1903
- package/dist/node/data-tree-CGfeCLr7.mjs.map +0 -1
- package/dist/node/editor-BXtXOryt.mjs +0 -247
- package/dist/node/editor-BXtXOryt.mjs.map +0 -1
- package/dist/node/editor-CXGHkwd9.mjs +0 -1793
- package/dist/node/editor-CXGHkwd9.mjs.map +0 -1
- package/dist/node/editor-D0FCvyPb.mjs +0 -17365
- package/dist/node/editor-D0FCvyPb.mjs.map +0 -1
- package/dist/node/editors/connection-editor/module.mjs +0 -15
- package/dist/node/editors/connection-editor/module.mjs.map +0 -1
- package/dist/node/editors/workflow-editor/module.mjs +0 -15
- package/dist/node/editors/workflow-editor/module.mjs.map +0 -1
- package/dist/node/editors/workflow-studio/module.mjs +0 -15
- package/dist/node/editors/workflow-studio/module.mjs.map +0 -1
- package/dist/node/module-BMwJQh65.mjs.map +0 -1
- package/dist/node/module-Dhe5E-VA.mjs.map +0 -1
- package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
- package/dist/node/pieces/reactor/index.mjs.map +0 -1
- package/dist/node/rolldown-runtime-BMI-E3GI.mjs +0 -44
- package/dist/node/runtime-queries-D5EGaCrH.mjs +0 -2544
- package/dist/node/runtime-queries-D5EGaCrH.mjs.map +0 -1
- package/dist/node/style.css +0 -667
- package/dist/node/trigger-text-CMWxL7t_.mjs +0 -6765
- package/dist/node/trigger-text-CMWxL7t_.mjs.map +0 -1
- package/dist/node/upgrade-manifests-CmNd742Y.mjs +0 -8
- package/dist/node/workflow-CGzYGZnr.mjs.map +0 -1
- package/dist/types/ai/runtime-url.d.ts +0 -2
- package/dist/types/ai/runtime-url.d.ts.map +0 -1
- package/dist/types/ai/runtime-url.test.d.ts +0 -2
- package/dist/types/ai/runtime-url.test.d.ts.map +0 -1
- package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -2
- package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +0 -1
- package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts +0 -5
- package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts.map +0 -1
- package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts +0 -2
- package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts.map +0 -1
|
@@ -1,1793 +0,0 @@
|
|
|
1
|
-
import { K as CORE_PIECE, et as sameBlock, l as runsOfPages, q as MANUAL_TRIGGER, rt as triggerBlock, tt as stepBlock } from "./runtime-queries-Ds2kk-Ow.js";
|
|
2
|
-
import { y as actions } from "./module-DU2vb3FH.js";
|
|
3
|
-
import { $ as formatDuration, B as blockMeta, Et as Select, G as CONNECTION_TONE, It as DocumentErrorBoundary, J as STEP_TONE, K as RUN_STATUSES, Lt as DocumentLoadError, Nt as textInputClass, Pt as Icon, Q as formatAbsolute, Rt as errorMessage, W as usePieceLogos, X as TONE_TEXT, Y as TONE_DOT, Z as durationMs, at as runTimeline, bt as Button, ct as toneOf, et as formatMs, ht as useRunQuery, it as runStatusLabel, lt as workflowHealth, mt as useRunPagesQuery, nt as formatWhen, ot as runTone, q as RUN_TONE, rt as runStats, st as statusLabel, t as BlockLogo, tt as formatTrigger, ut as WorkflowRuntimeProvider, vt as useRuntimeActions } from "./BlockSelector-BQDqIbRZ.js";
|
|
4
|
-
import { r as useWorkflowDocumentsInSelectedDrive } from "./workflow-BxShRhVy.js";
|
|
5
|
-
import { a as Modal, c as PublishState, i as DataViewer, l as StatusToggle, r as describeTrigger } from "./trigger-text-Ld2uv0Cf.js";
|
|
6
|
-
import { Fragment, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { addDocument, deleteNode, setSelectedNode, showDeleteNodeModal, useDispatch, useDocumentSafe, useFileNodesInSelectedDrive, usePHToast, useSelectedDrive, useSelectedDriveId, useSelectedNode, useSetPHAppConfig } from "@powerhousedao/reactor-browser";
|
|
9
|
-
//#region editors/workflow-studio/components/chain.tsx
|
|
10
|
-
const RING$1 = {
|
|
11
|
-
ok: "ring-wf-ok",
|
|
12
|
-
fail: "ring-wf-fail",
|
|
13
|
-
warn: "ring-wf-warn",
|
|
14
|
-
run: "ring-wf-run",
|
|
15
|
-
idle: "ring-foreground/15"
|
|
16
|
-
};
|
|
17
|
-
const RAIL$1 = {
|
|
18
|
-
ok: "bg-wf-ok",
|
|
19
|
-
fail: "bg-wf-fail",
|
|
20
|
-
warn: "bg-wf-warn",
|
|
21
|
-
run: "bg-wf-run",
|
|
22
|
-
idle: "bg-foreground/15"
|
|
23
|
-
};
|
|
24
|
-
const MAX_STOPS = 6;
|
|
25
|
-
function MiniChain(props) {
|
|
26
|
-
const md = props.size === "md";
|
|
27
|
-
const overflow = props.links.length > MAX_STOPS;
|
|
28
|
-
const shown = overflow ? props.links.slice(0, 5) : props.links;
|
|
29
|
-
const hidden = props.links.length - shown.length;
|
|
30
|
-
const tones = shown.map((link) => link.status ? toneOf(STEP_TONE, link.status) : "idle");
|
|
31
|
-
return /* @__PURE__ */ jsxs("ol", {
|
|
32
|
-
className: "flex items-center",
|
|
33
|
-
"aria-label": props.links.map((link) => `${link.label}${link.status ? `: ${link.status.toLowerCase()}` : ""}`).join(", "),
|
|
34
|
-
children: [shown.map((link, index) => /* @__PURE__ */ jsxs("li", {
|
|
35
|
-
className: "flex items-center",
|
|
36
|
-
children: [index > 0 ? /* @__PURE__ */ jsx("span", {
|
|
37
|
-
"aria-hidden": true,
|
|
38
|
-
className: `h-0.5 ${md ? "w-5" : "w-3"} ${RAIL$1[tones[index]]}`
|
|
39
|
-
}) : null, /* @__PURE__ */ jsx("span", {
|
|
40
|
-
title: link.status ? `${link.label}: ${link.status.toLowerCase()}` : link.label,
|
|
41
|
-
className: `flex shrink-0 items-center justify-center rounded-full bg-card ring-[1.5px] dark:bg-white ${md ? "h-8 w-8" : "h-6 w-6"} ${RING$1[tones[index]]} ${link.status === "SKIPPED" ? "opacity-50" : ""}`,
|
|
42
|
-
children: /* @__PURE__ */ jsx(BlockLogo, {
|
|
43
|
-
bare: true,
|
|
44
|
-
block: link.block,
|
|
45
|
-
size: md ? 16 : 14
|
|
46
|
-
})
|
|
47
|
-
})]
|
|
48
|
-
}, link.id)), overflow ? /* @__PURE__ */ jsxs("li", {
|
|
49
|
-
"aria-hidden": true,
|
|
50
|
-
className: "flex items-center",
|
|
51
|
-
children: [/* @__PURE__ */ jsx("span", { className: `h-0.5 ${md ? "w-5" : "w-3"} bg-foreground/15` }), /* @__PURE__ */ jsxs("span", {
|
|
52
|
-
title: props.links.slice(shown.length).map((link) => link.label).join(", "),
|
|
53
|
-
className: `flex shrink-0 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] font-medium tabular-nums text-muted-foreground ${md ? "h-8" : "h-6"}`,
|
|
54
|
-
children: ["+", hidden]
|
|
55
|
-
})]
|
|
56
|
-
}) : null]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function triggerOfKind(kind) {
|
|
60
|
-
if (kind.startsWith("piece:")) {
|
|
61
|
-
const rest = kind.slice(6);
|
|
62
|
-
const colon = rest.indexOf(":");
|
|
63
|
-
if (colon > 0) return {
|
|
64
|
-
pieceName: rest.slice(0, colon),
|
|
65
|
-
kind: "trigger",
|
|
66
|
-
name: rest.slice(colon + 1)
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
pieceName: CORE_PIECE,
|
|
71
|
-
kind: "trigger",
|
|
72
|
-
name: kind
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/** A run's own chain: the trigger, then every step it recorded. */
|
|
76
|
-
function runLinks(run, trigger) {
|
|
77
|
-
return [{
|
|
78
|
-
id: "trigger",
|
|
79
|
-
block: trigger ?? triggerOfKind(run.triggerKind),
|
|
80
|
-
label: "Trigger",
|
|
81
|
-
status: "SUCCEEDED"
|
|
82
|
-
}, ...run.steps.map((step) => ({
|
|
83
|
-
id: step.stepId + step.stepKey,
|
|
84
|
-
block: {
|
|
85
|
-
pieceName: step.pieceName,
|
|
86
|
-
kind: "action",
|
|
87
|
-
name: step.blockName
|
|
88
|
-
},
|
|
89
|
-
label: step.stepKey,
|
|
90
|
-
status: step.status
|
|
91
|
-
}))];
|
|
92
|
-
}
|
|
93
|
-
const STRIP_LENGTH = 14;
|
|
94
|
-
const TICK = {
|
|
95
|
-
ok: "bg-wf-ok",
|
|
96
|
-
fail: "bg-wf-fail",
|
|
97
|
-
warn: "bg-wf-warn",
|
|
98
|
-
run: "bg-wf-run animate-pulse",
|
|
99
|
-
idle: "bg-foreground/25"
|
|
100
|
-
};
|
|
101
|
-
/** Recent runs as ticks, oldest to newest, padded so strips line up. */
|
|
102
|
-
function RunStrip(props) {
|
|
103
|
-
const recent = props.runs.slice(0, STRIP_LENGTH).reverse();
|
|
104
|
-
const padding = STRIP_LENGTH - recent.length;
|
|
105
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
106
|
-
className: "flex h-5 items-end gap-[3px]",
|
|
107
|
-
"aria-label": recent.length === 0 ? "No runs yet" : `Last ${recent.length} runs: ${recent.map((run) => run.status.toLowerCase()).join(", ")}`,
|
|
108
|
-
children: [Array.from({ length: padding }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
109
|
-
"aria-hidden": true,
|
|
110
|
-
className: "h-1.5 w-1.5 rounded-full bg-foreground/10"
|
|
111
|
-
}, `pad-${index}`)), recent.map((run) => /* @__PURE__ */ jsx("span", {
|
|
112
|
-
"aria-hidden": true,
|
|
113
|
-
title: `${statusLabel(run.status)}, ${formatAbsolute(run.startedAt)}`,
|
|
114
|
-
className: `h-5 w-1.5 rounded-full ${TICK[toneOf(RUN_TONE, run.status)]}`
|
|
115
|
-
}, run.id))]
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region editors/workflow-studio/components/ui.tsx
|
|
120
|
-
function StatusDot(props) {
|
|
121
|
-
const hollow = props.hollow ?? props.tone === "idle";
|
|
122
|
-
return /* @__PURE__ */ jsx("span", {
|
|
123
|
-
"aria-hidden": true,
|
|
124
|
-
className: `inline-block h-2 w-2 shrink-0 rounded-full ${hollow ? "border border-solid border-muted-foreground/60" : TONE_DOT[props.tone]} ${props.className ?? ""}`
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
function StatusText(props) {
|
|
128
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
129
|
-
className: `inline-flex items-center gap-1.5 font-medium ${TONE_TEXT[props.tone]} ${props.className ?? ""}`,
|
|
130
|
-
children: [/* @__PURE__ */ jsx(StatusDot, { tone: props.tone }), props.label ?? statusLabel(props.status)]
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/** A label/value pair for a header's facts line. */
|
|
134
|
-
function Fact(props) {
|
|
135
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
136
|
-
className: "flex min-w-0 flex-col gap-0.5",
|
|
137
|
-
title: props.title,
|
|
138
|
-
children: [/* @__PURE__ */ jsx("dt", {
|
|
139
|
-
className: "text-xs text-muted-foreground",
|
|
140
|
-
children: props.label
|
|
141
|
-
}), /* @__PURE__ */ jsx("dd", {
|
|
142
|
-
className: "truncate text-[13px] tabular-nums text-foreground",
|
|
143
|
-
children: props.children
|
|
144
|
-
})]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region editors/workflow-studio/components/RunsTable.tsx
|
|
149
|
-
const DETAIL_POLL_MS = 5e3;
|
|
150
|
-
const CONTROL = "h-8 rounded-md border border-solid border-border bg-card px-2.5 text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
151
|
-
function stringify(value) {
|
|
152
|
-
if (value === void 0) return "";
|
|
153
|
-
try {
|
|
154
|
-
return JSON.stringify(value, null, 2);
|
|
155
|
-
} catch {
|
|
156
|
-
return String(value);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function TimelineBar(props) {
|
|
160
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
161
|
-
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
162
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
163
|
-
"aria-hidden": true,
|
|
164
|
-
className: "relative hidden h-1.5 w-40 overflow-hidden rounded-full bg-muted sm:block",
|
|
165
|
-
children: props.span ? /* @__PURE__ */ jsx("span", {
|
|
166
|
-
className: `absolute inset-y-0 rounded-full ${TONE_DOT[props.tone]}`,
|
|
167
|
-
style: {
|
|
168
|
-
left: `${props.span.offset * 100}%`,
|
|
169
|
-
width: `max(${props.span.width * 100}%, 4px)`
|
|
170
|
-
}
|
|
171
|
-
}) : null
|
|
172
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
173
|
-
className: "w-14 text-right text-[11px] tabular-nums text-muted-foreground",
|
|
174
|
-
children: props.span ? formatMs(props.span.ms) : "–"
|
|
175
|
-
})]
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
function StepRow(props) {
|
|
179
|
-
const { step } = props;
|
|
180
|
-
const meta = blockMeta({
|
|
181
|
-
pieceName: step.pieceName,
|
|
182
|
-
kind: "action",
|
|
183
|
-
name: step.blockName
|
|
184
|
-
});
|
|
185
|
-
const [open, setOpen] = useState(false);
|
|
186
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
187
|
-
role: "listitem",
|
|
188
|
-
className: "border-t border-solid border-border",
|
|
189
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
190
|
-
type: "button",
|
|
191
|
-
"aria-expanded": open,
|
|
192
|
-
className: "flex w-full items-center gap-3 px-3 py-2 text-left text-[13px] hover:bg-accent/60 focus-visible:bg-accent/60 focus-visible:outline-none",
|
|
193
|
-
onClick: () => setOpen((value) => !value),
|
|
194
|
-
children: [
|
|
195
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
196
|
-
name: "chevron",
|
|
197
|
-
className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? "rotate-90" : ""}`
|
|
198
|
-
}),
|
|
199
|
-
/* @__PURE__ */ jsx(StatusText, {
|
|
200
|
-
tone: toneOf(STEP_TONE, step.status),
|
|
201
|
-
status: step.status,
|
|
202
|
-
className: "w-24 shrink-0 text-xs"
|
|
203
|
-
}),
|
|
204
|
-
/* @__PURE__ */ jsx("span", {
|
|
205
|
-
className: "shrink-0 font-medium text-foreground",
|
|
206
|
-
title: `Key: ${step.stepKey}`,
|
|
207
|
-
children: props.name ?? step.stepKey
|
|
208
|
-
}),
|
|
209
|
-
/* @__PURE__ */ jsxs("span", {
|
|
210
|
-
className: "flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
211
|
-
children: [meta.logoUrl ? /* @__PURE__ */ jsx("img", {
|
|
212
|
-
src: meta.logoUrl,
|
|
213
|
-
alt: "",
|
|
214
|
-
title: meta.subtitle,
|
|
215
|
-
className: "h-3.5 w-3.5"
|
|
216
|
-
}) : null, /* @__PURE__ */ jsx("span", {
|
|
217
|
-
className: "truncate",
|
|
218
|
-
children: meta.logoUrl ? meta.displayName : `${meta.subtitle}: ${meta.displayName}`
|
|
219
|
-
})]
|
|
220
|
-
}),
|
|
221
|
-
step.port && step.port !== "next" ? /* @__PURE__ */ jsxs("span", {
|
|
222
|
-
className: "shrink-0 rounded bg-muted px-1.5 text-[11px] text-muted-foreground",
|
|
223
|
-
children: ["took ", step.port]
|
|
224
|
-
}) : null,
|
|
225
|
-
/* @__PURE__ */ jsx(TimelineBar, {
|
|
226
|
-
span: props.span,
|
|
227
|
-
tone: toneOf(STEP_TONE, step.status)
|
|
228
|
-
})
|
|
229
|
-
]
|
|
230
|
-
}), open ? /* @__PURE__ */ jsxs("div", {
|
|
231
|
-
className: "space-y-2 pb-3 pl-10 pr-3",
|
|
232
|
-
children: [step.error ? /* @__PURE__ */ jsx("pre", {
|
|
233
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2 text-xs text-wf-fail",
|
|
234
|
-
children: step.error
|
|
235
|
-
}) : null, step.status === "SKIPPED" ? /* @__PURE__ */ jsx("p", {
|
|
236
|
-
className: "text-xs text-muted-foreground",
|
|
237
|
-
children: "The run never reached this step."
|
|
238
|
-
}) : props.dataError ? /* @__PURE__ */ jsxs("p", {
|
|
239
|
-
className: "text-xs text-wf-warn",
|
|
240
|
-
children: ["Couldn't load what this step received and produced.", /* @__PURE__ */ jsx("span", {
|
|
241
|
-
className: "mt-0.5 block opacity-80",
|
|
242
|
-
children: props.dataError
|
|
243
|
-
})]
|
|
244
|
-
}) : props.dataPending ? /* @__PURE__ */ jsx("p", {
|
|
245
|
-
className: "text-xs text-muted-foreground",
|
|
246
|
-
children: "Loading step data…"
|
|
247
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
248
|
-
className: "grid items-start gap-2 md:grid-cols-2",
|
|
249
|
-
children: [/* @__PURE__ */ jsx(DataViewer, {
|
|
250
|
-
label: "Received",
|
|
251
|
-
value: step.input
|
|
252
|
-
}), /* @__PURE__ */ jsx(DataViewer, {
|
|
253
|
-
label: "Produced",
|
|
254
|
-
value: step.output,
|
|
255
|
-
root: `steps.${step.stepKey}.output`,
|
|
256
|
-
emptyText: step.status === "FAILED" ? "Nothing, the step failed" : void 0
|
|
257
|
-
})]
|
|
258
|
-
})]
|
|
259
|
-
}) : null]
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
const TRIGGER_LABEL = {
|
|
263
|
-
manual: "Manual",
|
|
264
|
-
schedule: "Schedule",
|
|
265
|
-
webhook: "Webhook",
|
|
266
|
-
"document-event": "Document change",
|
|
267
|
-
piece: "Piece trigger",
|
|
268
|
-
rerun: "Rerun"
|
|
269
|
-
};
|
|
270
|
-
function triggerLabel(kind) {
|
|
271
|
-
if (kind.startsWith("piece:")) {
|
|
272
|
-
const trigger = triggerOfKind(kind);
|
|
273
|
-
return describeTrigger({
|
|
274
|
-
pieceName: trigger.pieceName,
|
|
275
|
-
triggerName: trigger.name,
|
|
276
|
-
config: null
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
return TRIGGER_LABEL[kind] ?? formatTrigger(kind);
|
|
280
|
-
}
|
|
281
|
-
function describeRunError(error, names) {
|
|
282
|
-
return error.replace(/^Step "([^"]+)" failed: /, (whole, key) => {
|
|
283
|
-
const name = names.get(key);
|
|
284
|
-
return name ? `${name} failed: ` : whole;
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
function TriggerRow(props) {
|
|
288
|
-
const { run } = props;
|
|
289
|
-
const [open, setOpen] = useState(false);
|
|
290
|
-
const payload = stringify(run.triggerPayload);
|
|
291
|
-
const hasPayload = payload !== "" && payload !== "null" && payload !== "{}";
|
|
292
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
293
|
-
role: "listitem",
|
|
294
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
295
|
-
type: "button",
|
|
296
|
-
"aria-expanded": hasPayload ? open : void 0,
|
|
297
|
-
disabled: !hasPayload,
|
|
298
|
-
className: "flex w-full items-center gap-3 px-3 py-2 text-left text-[13px] enabled:hover:bg-accent/60 focus-visible:bg-accent/60 focus-visible:outline-none",
|
|
299
|
-
onClick: () => setOpen((value) => !value),
|
|
300
|
-
children: [
|
|
301
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
302
|
-
name: "chevron",
|
|
303
|
-
className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? "rotate-90" : ""} ${hasPayload ? "" : "invisible"}`
|
|
304
|
-
}),
|
|
305
|
-
/* @__PURE__ */ jsx(StatusText, {
|
|
306
|
-
tone: "ok",
|
|
307
|
-
status: "FIRED",
|
|
308
|
-
className: "w-24 shrink-0 text-xs"
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ jsx("span", {
|
|
311
|
-
className: "shrink-0 font-medium text-foreground",
|
|
312
|
-
children: "Trigger"
|
|
313
|
-
}),
|
|
314
|
-
/* @__PURE__ */ jsx("span", {
|
|
315
|
-
className: "truncate text-xs text-muted-foreground",
|
|
316
|
-
children: triggerLabel(run.triggerKind)
|
|
317
|
-
}),
|
|
318
|
-
!hasPayload ? /* @__PURE__ */ jsx("span", {
|
|
319
|
-
className: "shrink-0 text-[11px] text-muted-foreground",
|
|
320
|
-
children: "No payload"
|
|
321
|
-
}) : null,
|
|
322
|
-
/* @__PURE__ */ jsxs("span", {
|
|
323
|
-
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
324
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
325
|
-
"aria-hidden": true,
|
|
326
|
-
className: "relative hidden h-1.5 w-40 sm:block",
|
|
327
|
-
children: /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-0 w-1 rounded-full bg-wf-ok" })
|
|
328
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
329
|
-
className: "w-14 text-right text-[11px] tabular-nums text-muted-foreground",
|
|
330
|
-
children: new Date(run.startedAt).toLocaleTimeString([], {
|
|
331
|
-
hour: "2-digit",
|
|
332
|
-
minute: "2-digit",
|
|
333
|
-
second: "2-digit",
|
|
334
|
-
hour12: false
|
|
335
|
-
})
|
|
336
|
-
})]
|
|
337
|
-
})
|
|
338
|
-
]
|
|
339
|
-
}), open ? /* @__PURE__ */ jsx("div", {
|
|
340
|
-
className: "pb-3 pl-10 pr-3",
|
|
341
|
-
children: /* @__PURE__ */ jsx(DataViewer, {
|
|
342
|
-
label: "Payload",
|
|
343
|
-
value: run.triggerPayload,
|
|
344
|
-
root: "trigger.payload"
|
|
345
|
-
})
|
|
346
|
-
}) : null]
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
function RunDetail(props) {
|
|
350
|
-
const { names } = props;
|
|
351
|
-
const { rerunRun } = useRuntimeActions();
|
|
352
|
-
const full = useRunQuery(props.run.id, { pollMs: DETAIL_POLL_MS });
|
|
353
|
-
const run = full.data ?? props.run;
|
|
354
|
-
const dataPending = full.data === void 0 && full.status === "pending";
|
|
355
|
-
const dataError = full.status === "error" ? full.error instanceof Error ? full.error.message : String(full.error) : null;
|
|
356
|
-
const timeline = runTimeline(run);
|
|
357
|
-
const [rerunning, setRerunning] = useState(false);
|
|
358
|
-
const [rerunError, setRerunError] = useState(null);
|
|
359
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
360
|
-
className: "space-y-3 bg-muted/40 px-4 py-4",
|
|
361
|
-
children: [
|
|
362
|
-
run.error ? /* @__PURE__ */ jsx("p", {
|
|
363
|
-
className: "rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail",
|
|
364
|
-
children: describeRunError(run.error, names)
|
|
365
|
-
}) : null,
|
|
366
|
-
run.warningNotes.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
367
|
-
"aria-label": "Run warnings",
|
|
368
|
-
className: "space-y-1 rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn",
|
|
369
|
-
children: run.warningNotes.map((note) => /* @__PURE__ */ jsx("li", { children: note }, note))
|
|
370
|
-
}) : null,
|
|
371
|
-
/* @__PURE__ */ jsxs("div", {
|
|
372
|
-
className: "flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground",
|
|
373
|
-
children: [
|
|
374
|
-
/* @__PURE__ */ jsxs("span", { children: ["Run ", /* @__PURE__ */ jsx("span", {
|
|
375
|
-
className: "font-mono",
|
|
376
|
-
children: run.id.slice(0, 8)
|
|
377
|
-
})] }),
|
|
378
|
-
/* @__PURE__ */ jsxs("span", { children: ["Started ", formatAbsolute(run.startedAt)] }),
|
|
379
|
-
run.rerunOf ? /* @__PURE__ */ jsxs("span", { children: ["Resumes ", /* @__PURE__ */ jsx("span", {
|
|
380
|
-
className: "font-mono",
|
|
381
|
-
children: run.rerunOf.slice(0, 8)
|
|
382
|
-
})] }) : null,
|
|
383
|
-
run.status === "FAILED" ? /* @__PURE__ */ jsxs(Button, {
|
|
384
|
-
className: "ml-auto",
|
|
385
|
-
disabled: rerunning,
|
|
386
|
-
onClick: () => {
|
|
387
|
-
setRerunning(true);
|
|
388
|
-
setRerunError(null);
|
|
389
|
-
rerunRun(run.id).then((result) => setRerunError(result.error)).catch((error) => setRerunError(error instanceof Error ? error.message : String(error))).finally(() => {
|
|
390
|
-
setRerunning(false);
|
|
391
|
-
props.onChanged();
|
|
392
|
-
});
|
|
393
|
-
},
|
|
394
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
395
|
-
name: "retry",
|
|
396
|
-
className: "h-3.5 w-3.5"
|
|
397
|
-
}), rerunning ? "Rerunning…" : "Rerun from failed step"]
|
|
398
|
-
}) : null,
|
|
399
|
-
rerunError ? /* @__PURE__ */ jsx("span", {
|
|
400
|
-
className: "text-wf-fail",
|
|
401
|
-
children: rerunError
|
|
402
|
-
}) : null
|
|
403
|
-
]
|
|
404
|
-
}),
|
|
405
|
-
/* @__PURE__ */ jsxs("div", {
|
|
406
|
-
role: "list",
|
|
407
|
-
"aria-label": "Steps of this run",
|
|
408
|
-
className: "overflow-hidden rounded-md border border-solid border-border bg-card",
|
|
409
|
-
children: [
|
|
410
|
-
/* @__PURE__ */ jsx(TriggerRow, { run }),
|
|
411
|
-
run.steps.map((step) => /* @__PURE__ */ jsx(StepRow, {
|
|
412
|
-
step,
|
|
413
|
-
name: names.get(step.stepKey),
|
|
414
|
-
span: timeline.get(step.stepId),
|
|
415
|
-
dataPending,
|
|
416
|
-
dataError
|
|
417
|
-
}, step.stepId + step.stepKey)),
|
|
418
|
-
run.steps.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
419
|
-
className: "border-t border-solid border-border px-3 py-2 pl-10 text-xs text-muted-foreground",
|
|
420
|
-
children: "No steps ran."
|
|
421
|
-
}) : null
|
|
422
|
-
]
|
|
423
|
-
})
|
|
424
|
-
]
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
function SortHeader(props) {
|
|
428
|
-
return /* @__PURE__ */ jsx("th", {
|
|
429
|
-
scope: "col",
|
|
430
|
-
className: props.className,
|
|
431
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
432
|
-
type: "button",
|
|
433
|
-
className: `flex items-center gap-1 hover:text-foreground ${props.active ? "text-foreground" : ""}`,
|
|
434
|
-
onClick: props.onClick,
|
|
435
|
-
children: [props.label, /* @__PURE__ */ jsx("span", {
|
|
436
|
-
"aria-hidden": true,
|
|
437
|
-
className: props.active ? "" : "opacity-0",
|
|
438
|
-
children: props.descending ? "↓" : "↑"
|
|
439
|
-
})]
|
|
440
|
-
})
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
function RunsTable(props) {
|
|
444
|
-
const [query, setQuery] = useState("");
|
|
445
|
-
const [status, setStatus] = useState("ALL");
|
|
446
|
-
const [workflow, setWorkflow] = useState("ALL");
|
|
447
|
-
const [trigger, setTrigger] = useState("ALL");
|
|
448
|
-
const [sort, setSort] = useState("startedAt");
|
|
449
|
-
const [descending, setDescending] = useState(true);
|
|
450
|
-
const [expanded, setExpanded] = useState(null);
|
|
451
|
-
const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
|
|
452
|
-
const triggerBlocks = new Map(documents.map((document) => {
|
|
453
|
-
const trigger = document.state.global.trigger;
|
|
454
|
-
return [document.header.id, trigger ? triggerBlock(trigger) : void 0];
|
|
455
|
-
}));
|
|
456
|
-
const stepNames = new Map(documents.map((document) => [document.header.id, new Map(document.state.global.steps.map((step) => [step.key, step.name || step.key]))]));
|
|
457
|
-
usePieceLogos();
|
|
458
|
-
const workflowOptions = useMemo(() => [...new Map(props.runs.map((run) => [run.workflowId, run.workflowName]))].map(([id, name]) => ({
|
|
459
|
-
id,
|
|
460
|
-
name
|
|
461
|
-
})).sort((a, b) => a.name.localeCompare(b.name)), [props.runs]);
|
|
462
|
-
const triggerOptions = useMemo(() => [...new Set(props.runs.map((run) => run.triggerKind))].sort(), [props.runs]);
|
|
463
|
-
const scoped = useMemo(() => {
|
|
464
|
-
const needle = query.trim().toLowerCase();
|
|
465
|
-
return props.runs.filter((run) => {
|
|
466
|
-
if (workflow !== "ALL" && run.workflowId !== workflow) return false;
|
|
467
|
-
if (trigger !== "ALL" && run.triggerKind !== trigger) return false;
|
|
468
|
-
if (!needle) return true;
|
|
469
|
-
return run.workflowName.toLowerCase().includes(needle) || run.id.toLowerCase().includes(needle) || (run.error?.toLowerCase().includes(needle) ?? false) || run.steps.some((step) => step.stepKey.toLowerCase().includes(needle));
|
|
470
|
-
});
|
|
471
|
-
}, [
|
|
472
|
-
props.runs,
|
|
473
|
-
query,
|
|
474
|
-
workflow,
|
|
475
|
-
trigger
|
|
476
|
-
]);
|
|
477
|
-
const counts = useMemo(() => ({
|
|
478
|
-
ALL: scoped.length,
|
|
479
|
-
RUNNING: scoped.filter((run) => run.status === "RUNNING").length,
|
|
480
|
-
SUCCEEDED: scoped.filter((run) => run.status === "SUCCEEDED").length,
|
|
481
|
-
FAILED: scoped.filter((run) => run.status === "FAILED").length
|
|
482
|
-
}), [scoped]);
|
|
483
|
-
const visible = useMemo(() => {
|
|
484
|
-
const rows = scoped.filter((run) => status === "ALL" || run.status === status);
|
|
485
|
-
const direction = descending ? -1 : 1;
|
|
486
|
-
return [...rows].sort((a, b) => {
|
|
487
|
-
if (sort === "duration") return ((durationMs(a.startedAt, a.endedAt) ?? Infinity) - (durationMs(b.startedAt, b.endedAt) ?? Infinity)) * direction;
|
|
488
|
-
return (new Date(a.startedAt).getTime() - new Date(b.startedAt).getTime()) * direction;
|
|
489
|
-
});
|
|
490
|
-
}, [
|
|
491
|
-
scoped,
|
|
492
|
-
status,
|
|
493
|
-
sort,
|
|
494
|
-
descending
|
|
495
|
-
]);
|
|
496
|
-
const filtered = query.trim() || workflow !== "ALL" || trigger !== "ALL";
|
|
497
|
-
const sortBy = (key) => {
|
|
498
|
-
if (key === sort) {
|
|
499
|
-
setDescending((value) => !value);
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
setSort(key);
|
|
503
|
-
setDescending(true);
|
|
504
|
-
};
|
|
505
|
-
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
506
|
-
className: "mb-3 flex flex-wrap items-center gap-2",
|
|
507
|
-
children: [
|
|
508
|
-
/* @__PURE__ */ jsx("div", {
|
|
509
|
-
className: "flex h-8 items-center gap-0.5 rounded-md bg-muted p-0.5",
|
|
510
|
-
children: ["ALL", ...RUN_STATUSES].map((option) => /* @__PURE__ */ jsxs("button", {
|
|
511
|
-
type: "button",
|
|
512
|
-
"aria-pressed": status === option,
|
|
513
|
-
className: `h-7 rounded px-2.5 text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${status === option ? "bg-card font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
514
|
-
onClick: () => setStatus(option),
|
|
515
|
-
children: [option === "ALL" ? "All" : statusLabel(option), /* @__PURE__ */ jsx("span", {
|
|
516
|
-
className: "ml-1.5 tabular-nums text-muted-foreground",
|
|
517
|
-
children: counts[option]
|
|
518
|
-
})]
|
|
519
|
-
}, option))
|
|
520
|
-
}),
|
|
521
|
-
/* @__PURE__ */ jsx("input", {
|
|
522
|
-
type: "search",
|
|
523
|
-
className: `${CONTROL} w-48`,
|
|
524
|
-
placeholder: "Search runs",
|
|
525
|
-
value: query,
|
|
526
|
-
onChange: (event) => setQuery(event.target.value)
|
|
527
|
-
}),
|
|
528
|
-
props.showWorkflow && workflowOptions.length > 1 ? /* @__PURE__ */ jsx("div", {
|
|
529
|
-
className: "w-44",
|
|
530
|
-
children: /* @__PURE__ */ jsx(Select, {
|
|
531
|
-
value: workflow,
|
|
532
|
-
options: [{
|
|
533
|
-
value: "ALL",
|
|
534
|
-
label: "Every workflow"
|
|
535
|
-
}, ...workflowOptions.map((option) => ({
|
|
536
|
-
value: option.id,
|
|
537
|
-
label: option.name
|
|
538
|
-
}))],
|
|
539
|
-
onChange: setWorkflow
|
|
540
|
-
})
|
|
541
|
-
}) : null,
|
|
542
|
-
triggerOptions.length > 1 ? /* @__PURE__ */ jsx("div", {
|
|
543
|
-
className: "w-40",
|
|
544
|
-
children: /* @__PURE__ */ jsx(Select, {
|
|
545
|
-
value: trigger,
|
|
546
|
-
options: [{
|
|
547
|
-
value: "ALL",
|
|
548
|
-
label: "Every trigger"
|
|
549
|
-
}, ...triggerOptions.map((option) => ({
|
|
550
|
-
value: option,
|
|
551
|
-
label: triggerLabel(option)
|
|
552
|
-
}))],
|
|
553
|
-
onChange: setTrigger
|
|
554
|
-
})
|
|
555
|
-
}) : null,
|
|
556
|
-
filtered ? /* @__PURE__ */ jsx("button", {
|
|
557
|
-
type: "button",
|
|
558
|
-
className: "text-[13px] text-muted-foreground underline underline-offset-2 hover:text-foreground",
|
|
559
|
-
onClick: () => {
|
|
560
|
-
setQuery("");
|
|
561
|
-
setWorkflow("ALL");
|
|
562
|
-
setTrigger("ALL");
|
|
563
|
-
},
|
|
564
|
-
children: "Clear filters"
|
|
565
|
-
}) : null,
|
|
566
|
-
/* @__PURE__ */ jsxs("span", {
|
|
567
|
-
className: "ml-auto text-xs tabular-nums text-muted-foreground",
|
|
568
|
-
children: [
|
|
569
|
-
visible.length,
|
|
570
|
-
" of ",
|
|
571
|
-
props.runs.length,
|
|
572
|
-
" runs"
|
|
573
|
-
]
|
|
574
|
-
})
|
|
575
|
-
]
|
|
576
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
577
|
-
className: "overflow-x-auto rounded-lg border border-solid border-border bg-card",
|
|
578
|
-
children: /* @__PURE__ */ jsxs("table", {
|
|
579
|
-
className: "w-full border-collapse text-left",
|
|
580
|
-
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
|
|
581
|
-
className: "border-b border-solid border-border text-xs font-medium text-muted-foreground",
|
|
582
|
-
children: [
|
|
583
|
-
/* @__PURE__ */ jsx("th", {
|
|
584
|
-
scope: "col",
|
|
585
|
-
className: "px-3 py-2.5 font-medium",
|
|
586
|
-
children: "Status"
|
|
587
|
-
}),
|
|
588
|
-
props.showWorkflow ? /* @__PURE__ */ jsx("th", {
|
|
589
|
-
scope: "col",
|
|
590
|
-
className: "px-3 py-2.5 font-medium",
|
|
591
|
-
children: "Workflow"
|
|
592
|
-
}) : null,
|
|
593
|
-
/* @__PURE__ */ jsx("th", {
|
|
594
|
-
scope: "col",
|
|
595
|
-
className: "px-3 py-2.5 font-medium",
|
|
596
|
-
children: "Trigger"
|
|
597
|
-
}),
|
|
598
|
-
/* @__PURE__ */ jsx(SortHeader, {
|
|
599
|
-
label: "Started",
|
|
600
|
-
className: "px-3 py-2.5 font-medium",
|
|
601
|
-
active: sort === "startedAt",
|
|
602
|
-
descending,
|
|
603
|
-
onClick: () => sortBy("startedAt")
|
|
604
|
-
}),
|
|
605
|
-
/* @__PURE__ */ jsx(SortHeader, {
|
|
606
|
-
label: "Duration",
|
|
607
|
-
className: "px-3 py-2.5 font-medium",
|
|
608
|
-
active: sort === "duration",
|
|
609
|
-
descending,
|
|
610
|
-
onClick: () => sortBy("duration")
|
|
611
|
-
}),
|
|
612
|
-
/* @__PURE__ */ jsx("th", {
|
|
613
|
-
scope: "col",
|
|
614
|
-
className: "px-3 py-2.5 font-medium",
|
|
615
|
-
children: "Steps"
|
|
616
|
-
}),
|
|
617
|
-
/* @__PURE__ */ jsx("th", {
|
|
618
|
-
scope: "col",
|
|
619
|
-
className: "w-8 px-3 py-2",
|
|
620
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
621
|
-
className: "sr-only",
|
|
622
|
-
children: "Details"
|
|
623
|
-
})
|
|
624
|
-
})
|
|
625
|
-
]
|
|
626
|
-
}) }), /* @__PURE__ */ jsx("tbody", { children: visible.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
627
|
-
colSpan: props.showWorkflow ? 7 : 6,
|
|
628
|
-
className: "px-3 py-8 text-center text-[13px] text-muted-foreground",
|
|
629
|
-
children: "No runs match these filters."
|
|
630
|
-
}) }) : visible.map((run) => {
|
|
631
|
-
const open = expanded === run.id;
|
|
632
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
633
|
-
className: `cursor-pointer border-b border-solid border-border text-[13px] last:border-b-0 ${open ? "bg-muted/40" : "hover:bg-accent/60"}`,
|
|
634
|
-
onClick: () => setExpanded(open ? null : run.id),
|
|
635
|
-
children: [
|
|
636
|
-
/* @__PURE__ */ jsx("td", {
|
|
637
|
-
className: "px-3 py-2.5",
|
|
638
|
-
children: /* @__PURE__ */ jsx(StatusText, {
|
|
639
|
-
tone: runTone(run),
|
|
640
|
-
status: run.status,
|
|
641
|
-
label: runStatusLabel(run)
|
|
642
|
-
})
|
|
643
|
-
}),
|
|
644
|
-
props.showWorkflow ? /* @__PURE__ */ jsx("td", {
|
|
645
|
-
className: "max-w-48 truncate px-3 py-2.5 font-medium text-foreground",
|
|
646
|
-
children: run.workflowName
|
|
647
|
-
}) : null,
|
|
648
|
-
/* @__PURE__ */ jsxs("td", {
|
|
649
|
-
className: "px-3 py-2.5 text-muted-foreground",
|
|
650
|
-
children: [triggerLabel(run.triggerKind), /* @__PURE__ */ jsxs("span", {
|
|
651
|
-
className: "ml-1.5 text-xs text-muted-foreground/70",
|
|
652
|
-
children: ["v", run.workflowVersion]
|
|
653
|
-
})]
|
|
654
|
-
}),
|
|
655
|
-
/* @__PURE__ */ jsx("td", {
|
|
656
|
-
className: "whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground",
|
|
657
|
-
title: formatAbsolute(run.startedAt),
|
|
658
|
-
children: formatWhen(run.startedAt)
|
|
659
|
-
}),
|
|
660
|
-
/* @__PURE__ */ jsx("td", {
|
|
661
|
-
className: "whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground",
|
|
662
|
-
children: formatDuration(run.startedAt, run.endedAt)
|
|
663
|
-
}),
|
|
664
|
-
/* @__PURE__ */ jsx("td", {
|
|
665
|
-
className: "px-3 py-2",
|
|
666
|
-
children: /* @__PURE__ */ jsx(MiniChain, { links: runLinks(run, triggerBlocks.get(run.workflowId)) })
|
|
667
|
-
}),
|
|
668
|
-
/* @__PURE__ */ jsx("td", {
|
|
669
|
-
className: "px-3 py-2.5",
|
|
670
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
671
|
-
type: "button",
|
|
672
|
-
"aria-expanded": open,
|
|
673
|
-
"aria-label": `${open ? "Hide" : "Show"} steps of the run started ${formatAbsolute(run.startedAt)}`,
|
|
674
|
-
className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
675
|
-
onClick: (event) => {
|
|
676
|
-
event.stopPropagation();
|
|
677
|
-
setExpanded(open ? null : run.id);
|
|
678
|
-
},
|
|
679
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
680
|
-
name: "chevron",
|
|
681
|
-
className: `h-3.5 w-3.5 transition-transform ${open ? "rotate-90" : ""}`
|
|
682
|
-
})
|
|
683
|
-
})
|
|
684
|
-
})
|
|
685
|
-
]
|
|
686
|
-
}), open ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
687
|
-
colSpan: props.showWorkflow ? 7 : 6,
|
|
688
|
-
className: "border-b border-solid border-border p-0",
|
|
689
|
-
children: /* @__PURE__ */ jsx(RunDetail, {
|
|
690
|
-
run,
|
|
691
|
-
names: stepNames.get(run.workflowId) ?? /* @__PURE__ */ new Map(),
|
|
692
|
-
onChanged: props.onChanged
|
|
693
|
-
})
|
|
694
|
-
}) }) : null] }, run.id);
|
|
695
|
-
}) })]
|
|
696
|
-
})
|
|
697
|
-
})] });
|
|
698
|
-
}
|
|
699
|
-
//#endregion
|
|
700
|
-
//#region editors/workflow-studio/components/RunsView.tsx
|
|
701
|
-
function RunsView(props) {
|
|
702
|
-
const [firing, setFiring] = useState(false);
|
|
703
|
-
const [fireError, setFireError] = useState(null);
|
|
704
|
-
const { runs } = props;
|
|
705
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
706
|
-
className: "w-full",
|
|
707
|
-
children: [
|
|
708
|
-
/* @__PURE__ */ jsxs("div", {
|
|
709
|
-
className: "mb-4 flex items-center gap-3",
|
|
710
|
-
children: [
|
|
711
|
-
/* @__PURE__ */ jsx("h2", {
|
|
712
|
-
className: "text-[15px] font-semibold text-foreground",
|
|
713
|
-
children: props.title
|
|
714
|
-
}),
|
|
715
|
-
/* @__PURE__ */ jsx("span", { className: "grow" }),
|
|
716
|
-
props.onFire ? /* @__PURE__ */ jsxs(Button, {
|
|
717
|
-
variant: "primary",
|
|
718
|
-
disabled: firing,
|
|
719
|
-
onClick: () => {
|
|
720
|
-
setFiring(true);
|
|
721
|
-
setFireError(null);
|
|
722
|
-
props.onFire().then((fireResultError) => setFireError(fireResultError)).catch((fireCallError) => setFireError(fireCallError instanceof Error ? fireCallError.message : String(fireCallError))).finally(() => {
|
|
723
|
-
setFiring(false);
|
|
724
|
-
props.reload();
|
|
725
|
-
});
|
|
726
|
-
},
|
|
727
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
728
|
-
name: "play",
|
|
729
|
-
className: "h-3.5 w-3.5"
|
|
730
|
-
}), firing ? "Running…" : "Run now"]
|
|
731
|
-
}) : null
|
|
732
|
-
]
|
|
733
|
-
}),
|
|
734
|
-
fireError ? /* @__PURE__ */ jsx("p", {
|
|
735
|
-
className: "mb-3 rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail",
|
|
736
|
-
children: fireError
|
|
737
|
-
}) : null,
|
|
738
|
-
props.error ? /* @__PURE__ */ jsxs("p", {
|
|
739
|
-
className: "rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn",
|
|
740
|
-
children: ["Runs can't be listed because the workflow runtime is unreachable.", /* @__PURE__ */ jsx("span", {
|
|
741
|
-
className: "mt-0.5 block text-xs opacity-80",
|
|
742
|
-
children: props.error
|
|
743
|
-
})]
|
|
744
|
-
}) : runs === null ? /* @__PURE__ */ jsx("p", {
|
|
745
|
-
className: "text-[13px] text-muted-foreground",
|
|
746
|
-
children: "Loading runs…"
|
|
747
|
-
}) : runs.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
748
|
-
className: "rounded-lg border border-dashed border-border px-4 py-10 text-center",
|
|
749
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
750
|
-
className: "text-[13px] font-medium text-foreground",
|
|
751
|
-
children: "No runs yet"
|
|
752
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
753
|
-
className: "mt-1 text-xs text-muted-foreground",
|
|
754
|
-
children: props.onFire ? "Use Run now to record the first one." : "Runs appear here once the trigger fires."
|
|
755
|
-
})]
|
|
756
|
-
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RunsTable, {
|
|
757
|
-
runs,
|
|
758
|
-
showWorkflow: props.showWorkflow,
|
|
759
|
-
onChanged: props.reload
|
|
760
|
-
}), props.hasMore && props.onLoadMore ? /* @__PURE__ */ jsx("div", {
|
|
761
|
-
className: "mt-3 flex justify-center",
|
|
762
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
763
|
-
disabled: props.loadingMore,
|
|
764
|
-
onClick: () => props.onLoadMore(),
|
|
765
|
-
children: props.loadingMore ? "Loading…" : "Load older runs"
|
|
766
|
-
})
|
|
767
|
-
}) : null] })
|
|
768
|
-
]
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
//#endregion
|
|
772
|
-
//#region editors/workflow-studio/components/WorkflowMenu.tsx
|
|
773
|
-
function DeleteWorkflowDialog(props) {
|
|
774
|
-
const [typed, setTyped] = useState("");
|
|
775
|
-
const [error, setError] = useState(null);
|
|
776
|
-
const [deleting, setDeleting] = useState(false);
|
|
777
|
-
const inputId = useId();
|
|
778
|
-
const cancelRef = useRef(null);
|
|
779
|
-
const matches = typed === props.name;
|
|
780
|
-
return /* @__PURE__ */ jsx(Modal, {
|
|
781
|
-
open: true,
|
|
782
|
-
title: "Delete workflow",
|
|
783
|
-
onOpenChange: (open) => {
|
|
784
|
-
if (!open) props.onCancel();
|
|
785
|
-
},
|
|
786
|
-
contentProps: {
|
|
787
|
-
className: "w-[28rem] max-w-[92vw] rounded-xl border border-solid border-foreground/10",
|
|
788
|
-
role: "alertdialog",
|
|
789
|
-
"aria-label": "Delete workflow",
|
|
790
|
-
onOpenAutoFocus: (event) => {
|
|
791
|
-
event.preventDefault();
|
|
792
|
-
cancelRef.current?.focus();
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
|
-
children: /* @__PURE__ */ jsxs("form", {
|
|
796
|
-
className: "flex flex-col gap-4 p-6",
|
|
797
|
-
onSubmit: (event) => {
|
|
798
|
-
event.preventDefault();
|
|
799
|
-
if (!matches || deleting) return;
|
|
800
|
-
setDeleting(true);
|
|
801
|
-
props.onConfirm().catch((cause) => {
|
|
802
|
-
setDeleting(false);
|
|
803
|
-
setError(cause instanceof Error ? cause.message : String(cause));
|
|
804
|
-
});
|
|
805
|
-
},
|
|
806
|
-
children: [
|
|
807
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
808
|
-
className: "text-[15px] font-semibold text-foreground",
|
|
809
|
-
children: "Delete workflow"
|
|
810
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
811
|
-
className: "mt-1 text-[13px] text-muted-foreground",
|
|
812
|
-
children: "This removes the workflow from the drive and can't be undone. To archive it instead, use Archive."
|
|
813
|
-
})] }),
|
|
814
|
-
/* @__PURE__ */ jsxs("label", {
|
|
815
|
-
htmlFor: inputId,
|
|
816
|
-
className: "flex flex-col gap-1.5",
|
|
817
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
818
|
-
className: "text-[13px] text-foreground",
|
|
819
|
-
children: [
|
|
820
|
-
"Type ",
|
|
821
|
-
/* @__PURE__ */ jsx("strong", {
|
|
822
|
-
className: "font-semibold",
|
|
823
|
-
children: props.name
|
|
824
|
-
}),
|
|
825
|
-
" to confirm"
|
|
826
|
-
]
|
|
827
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
828
|
-
id: inputId,
|
|
829
|
-
className: textInputClass,
|
|
830
|
-
value: typed,
|
|
831
|
-
spellCheck: false,
|
|
832
|
-
autoComplete: "off",
|
|
833
|
-
onChange: (event) => setTyped(event.target.value)
|
|
834
|
-
})]
|
|
835
|
-
}),
|
|
836
|
-
error ? /* @__PURE__ */ jsx("p", {
|
|
837
|
-
className: "text-xs text-wf-fail",
|
|
838
|
-
children: error
|
|
839
|
-
}) : null,
|
|
840
|
-
/* @__PURE__ */ jsxs("div", {
|
|
841
|
-
className: "flex justify-end gap-2",
|
|
842
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
843
|
-
ref: cancelRef,
|
|
844
|
-
onClick: props.onCancel,
|
|
845
|
-
children: "Cancel"
|
|
846
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
847
|
-
type: "submit",
|
|
848
|
-
variant: "destructive",
|
|
849
|
-
disabled: !matches || deleting,
|
|
850
|
-
children: deleting ? "Deleting…" : "Delete workflow"
|
|
851
|
-
})]
|
|
852
|
-
})
|
|
853
|
-
]
|
|
854
|
-
})
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
function MenuItem(props) {
|
|
858
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
859
|
-
type: "button",
|
|
860
|
-
role: "menuitem",
|
|
861
|
-
className: `flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[13px] hover:bg-accent focus-visible:bg-accent focus-visible:outline-none ${props.danger ? "text-wf-fail" : "text-foreground"}`,
|
|
862
|
-
onClick: props.onSelect,
|
|
863
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
864
|
-
name: props.icon,
|
|
865
|
-
className: "h-3.5 w-3.5"
|
|
866
|
-
}), props.label]
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
function WorkflowMenu(props) {
|
|
870
|
-
const [open, setOpen] = useState(false);
|
|
871
|
-
const [confirming, setConfirming] = useState(false);
|
|
872
|
-
const [, dispatch] = useDispatch(props.document);
|
|
873
|
-
const driveId = useSelectedDriveId();
|
|
874
|
-
const ref = useRef(null);
|
|
875
|
-
const state = props.document.state.global;
|
|
876
|
-
const name = state.name || props.nodeName || "Untitled workflow";
|
|
877
|
-
const archived = state.status === "ARCHIVED";
|
|
878
|
-
useEffect(() => {
|
|
879
|
-
if (!open) return;
|
|
880
|
-
const close = (event) => {
|
|
881
|
-
if (!ref.current?.contains(event.target)) setOpen(false);
|
|
882
|
-
};
|
|
883
|
-
const escape = (event) => {
|
|
884
|
-
if (event.key === "Escape") setOpen(false);
|
|
885
|
-
};
|
|
886
|
-
window.addEventListener("mousedown", close);
|
|
887
|
-
window.addEventListener("keydown", escape);
|
|
888
|
-
return () => {
|
|
889
|
-
window.removeEventListener("mousedown", close);
|
|
890
|
-
window.removeEventListener("keydown", escape);
|
|
891
|
-
};
|
|
892
|
-
}, [open]);
|
|
893
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
894
|
-
ref,
|
|
895
|
-
className: "relative",
|
|
896
|
-
children: [
|
|
897
|
-
/* @__PURE__ */ jsx("button", {
|
|
898
|
-
type: "button",
|
|
899
|
-
"aria-label": `More actions for ${name}`,
|
|
900
|
-
"aria-haspopup": "menu",
|
|
901
|
-
"aria-expanded": open,
|
|
902
|
-
className: `flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${props.subtle && !open ? "opacity-0 group-hover:opacity-100" : ""}`,
|
|
903
|
-
onClick: (event) => {
|
|
904
|
-
event.stopPropagation();
|
|
905
|
-
setOpen((value) => !value);
|
|
906
|
-
},
|
|
907
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
908
|
-
name: "more",
|
|
909
|
-
className: "h-4 w-4"
|
|
910
|
-
})
|
|
911
|
-
}),
|
|
912
|
-
open ? /* @__PURE__ */ jsxs("div", {
|
|
913
|
-
role: "menu",
|
|
914
|
-
className: "absolute right-0 top-full z-50 mt-1 w-44 rounded-md border border-solid border-foreground/10 bg-card p-1 shadow-lg",
|
|
915
|
-
children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
916
|
-
label: archived ? "Restore" : "Archive",
|
|
917
|
-
icon: archived ? "retry" : "archive",
|
|
918
|
-
onSelect: () => {
|
|
919
|
-
setOpen(false);
|
|
920
|
-
const status = archived ? state.published ? "DISABLED" : "DRAFT" : "ARCHIVED";
|
|
921
|
-
dispatch(actions.setWorkflowStatus({ status }));
|
|
922
|
-
}
|
|
923
|
-
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
924
|
-
label: "Delete…",
|
|
925
|
-
icon: "trash",
|
|
926
|
-
danger: true,
|
|
927
|
-
onSelect: () => {
|
|
928
|
-
setOpen(false);
|
|
929
|
-
setConfirming(true);
|
|
930
|
-
}
|
|
931
|
-
})]
|
|
932
|
-
}) : null,
|
|
933
|
-
confirming ? /* @__PURE__ */ jsx(DeleteWorkflowDialog, {
|
|
934
|
-
name,
|
|
935
|
-
onCancel: () => setConfirming(false),
|
|
936
|
-
onConfirm: async () => {
|
|
937
|
-
if (!driveId) throw new Error("No drive is selected");
|
|
938
|
-
await deleteNode(driveId, props.document.header.id);
|
|
939
|
-
setConfirming(false);
|
|
940
|
-
props.onDeleted?.();
|
|
941
|
-
}
|
|
942
|
-
}) : null
|
|
943
|
-
]
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
//#endregion
|
|
947
|
-
//#region editors/workflow-studio/components/Sidebar.tsx
|
|
948
|
-
const WORKFLOW_TYPE$2 = "powerhouse/workflow";
|
|
949
|
-
function documentName(document, fallback) {
|
|
950
|
-
return (document?.state?.global)?.name || fallback || "(unnamed)";
|
|
951
|
-
}
|
|
952
|
-
function documentStatus(document) {
|
|
953
|
-
const state = document?.state?.global;
|
|
954
|
-
return {
|
|
955
|
-
status: state?.status,
|
|
956
|
-
published: Boolean(state?.published)
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
function Row(props) {
|
|
960
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
961
|
-
className: `group mx-2 flex items-center rounded-md ${props.active ? "bg-accent" : "hover:bg-accent/60"}`,
|
|
962
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
963
|
-
type: "button",
|
|
964
|
-
"aria-current": props.active ? "true" : void 0,
|
|
965
|
-
className: `flex min-w-0 grow items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${props.active ? "font-medium text-foreground" : "text-foreground/80"}`,
|
|
966
|
-
onClick: props.onClick,
|
|
967
|
-
children: props.children
|
|
968
|
-
}), props.trailing]
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
const ROW_ACTION = "flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 hover:bg-background hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100";
|
|
972
|
-
const DELETE_ACTION = `${ROW_ACTION} hover:text-wf-fail`;
|
|
973
|
-
function DeleteButton(props) {
|
|
974
|
-
return /* @__PURE__ */ jsx("button", {
|
|
975
|
-
type: "button",
|
|
976
|
-
title: "Delete",
|
|
977
|
-
"aria-label": `Delete ${props.label}`,
|
|
978
|
-
className: DELETE_ACTION,
|
|
979
|
-
onClick: () => showDeleteNodeModal(props.node),
|
|
980
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
981
|
-
name: "trash",
|
|
982
|
-
className: "h-3.5 w-3.5"
|
|
983
|
-
})
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
function NodeRow(props) {
|
|
987
|
-
const { node } = props;
|
|
988
|
-
const { data: document, error } = useDocumentSafe(node.id);
|
|
989
|
-
useEffect(() => {
|
|
990
|
-
if (error !== void 0) console.error(`Failed to load document ${node.id}:`, error);
|
|
991
|
-
}, [error, node.id]);
|
|
992
|
-
if (error !== void 0) return /* @__PURE__ */ jsxs(Row, {
|
|
993
|
-
active: props.active,
|
|
994
|
-
onClick: props.onOpen,
|
|
995
|
-
trailing: /* @__PURE__ */ jsx("span", {
|
|
996
|
-
className: "mr-1.5 flex shrink-0 items-center",
|
|
997
|
-
children: /* @__PURE__ */ jsx(DeleteButton, {
|
|
998
|
-
node,
|
|
999
|
-
label: node.name || node.id
|
|
1000
|
-
})
|
|
1001
|
-
}),
|
|
1002
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1003
|
-
className: "shrink-0 text-xs text-wf-fail",
|
|
1004
|
-
title: `Could not load ${node.id}: ${errorMessage(error)}`,
|
|
1005
|
-
"aria-hidden": true,
|
|
1006
|
-
children: "⚠"
|
|
1007
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1008
|
-
className: "min-w-0 truncate text-wf-fail",
|
|
1009
|
-
children: node.name || "(unnamed)"
|
|
1010
|
-
})]
|
|
1011
|
-
});
|
|
1012
|
-
const { status, published } = documentStatus(document);
|
|
1013
|
-
const isWorkflow = node.documentType === WORKFLOW_TYPE$2;
|
|
1014
|
-
const { tone, label, hollow } = isWorkflow ? workflowHealth(status, props.lastRunStatus, published) : {
|
|
1015
|
-
tone: toneOf(CONNECTION_TONE, status),
|
|
1016
|
-
label: status,
|
|
1017
|
-
hollow: void 0
|
|
1018
|
-
};
|
|
1019
|
-
return /* @__PURE__ */ jsxs(Row, {
|
|
1020
|
-
active: props.active,
|
|
1021
|
-
onClick: props.onOpen,
|
|
1022
|
-
trailing: /* @__PURE__ */ jsxs("span", {
|
|
1023
|
-
className: "mr-1.5 flex shrink-0 items-center",
|
|
1024
|
-
children: [props.onEdit ? /* @__PURE__ */ jsx("button", {
|
|
1025
|
-
type: "button",
|
|
1026
|
-
title: "Open in editor",
|
|
1027
|
-
"aria-label": `Open ${documentName(document, node.name)} in the editor`,
|
|
1028
|
-
className: ROW_ACTION,
|
|
1029
|
-
onClick: props.onEdit,
|
|
1030
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1031
|
-
name: "pencil",
|
|
1032
|
-
className: "h-3.5 w-3.5"
|
|
1033
|
-
})
|
|
1034
|
-
}) : null, isWorkflow && document ? /* @__PURE__ */ jsx(WorkflowMenu, {
|
|
1035
|
-
subtle: true,
|
|
1036
|
-
document,
|
|
1037
|
-
nodeName: node.name
|
|
1038
|
-
}) : /* @__PURE__ */ jsx(DeleteButton, {
|
|
1039
|
-
node,
|
|
1040
|
-
label: documentName(document, node.name)
|
|
1041
|
-
})]
|
|
1042
|
-
}),
|
|
1043
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1044
|
-
title: label,
|
|
1045
|
-
className: "flex",
|
|
1046
|
-
children: /* @__PURE__ */ jsx(StatusDot, {
|
|
1047
|
-
tone,
|
|
1048
|
-
hollow
|
|
1049
|
-
})
|
|
1050
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1051
|
-
className: "min-w-0 truncate",
|
|
1052
|
-
children: documentName(document, node.name)
|
|
1053
|
-
})]
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
function Section(props) {
|
|
1057
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1058
|
-
className: "mt-5",
|
|
1059
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1060
|
-
className: "mb-1 flex items-center justify-between pl-4 pr-3",
|
|
1061
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
1062
|
-
className: "text-xs font-medium text-muted-foreground",
|
|
1063
|
-
children: props.title
|
|
1064
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1065
|
-
type: "button",
|
|
1066
|
-
disabled: props.creating,
|
|
1067
|
-
className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
|
1068
|
-
title: props.addLabel,
|
|
1069
|
-
"aria-label": props.addLabel,
|
|
1070
|
-
onClick: props.onCreate,
|
|
1071
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1072
|
-
name: "plus",
|
|
1073
|
-
className: "h-3.5 w-3.5"
|
|
1074
|
-
})
|
|
1075
|
-
})]
|
|
1076
|
-
}), props.nodes.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
1077
|
-
className: "px-4 py-1 text-xs text-muted-foreground",
|
|
1078
|
-
children: props.empty
|
|
1079
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
1080
|
-
className: "flex flex-col gap-0.5",
|
|
1081
|
-
children: props.nodes.map((node) => /* @__PURE__ */ jsx(NodeRow, {
|
|
1082
|
-
node,
|
|
1083
|
-
lastRunStatus: props.lastRuns?.get(node.id),
|
|
1084
|
-
active: props.activeId === node.id,
|
|
1085
|
-
onOpen: () => props.onOpen(node),
|
|
1086
|
-
onEdit: props.onEdit ? () => props.onEdit(node) : void 0
|
|
1087
|
-
}, node.id))
|
|
1088
|
-
})]
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function Sidebar(props) {
|
|
1092
|
-
return /* @__PURE__ */ jsxs("aside", {
|
|
1093
|
-
className: "w-60 shrink-0 overflow-y-auto border-r border-solid border-border bg-muted/50 py-3",
|
|
1094
|
-
children: [
|
|
1095
|
-
/* @__PURE__ */ jsxs(Row, {
|
|
1096
|
-
active: props.allRunsActive,
|
|
1097
|
-
onClick: props.onShowAllRuns,
|
|
1098
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1099
|
-
name: "list",
|
|
1100
|
-
className: "text-muted-foreground"
|
|
1101
|
-
}), /* @__PURE__ */ jsx("span", { children: "Overview" })]
|
|
1102
|
-
}),
|
|
1103
|
-
/* @__PURE__ */ jsx(Section, {
|
|
1104
|
-
title: "Workflows",
|
|
1105
|
-
addLabel: "New workflow",
|
|
1106
|
-
empty: "No workflows yet.",
|
|
1107
|
-
nodes: props.workflows,
|
|
1108
|
-
lastRuns: props.lastRuns,
|
|
1109
|
-
activeId: props.activeId,
|
|
1110
|
-
onOpen: props.onOpenWorkflow,
|
|
1111
|
-
onEdit: props.onEditWorkflow,
|
|
1112
|
-
onCreate: props.onCreateWorkflow,
|
|
1113
|
-
creating: props.creating
|
|
1114
|
-
}),
|
|
1115
|
-
/* @__PURE__ */ jsx(Section, {
|
|
1116
|
-
title: "Connections",
|
|
1117
|
-
addLabel: "New connection",
|
|
1118
|
-
empty: "No connections yet.",
|
|
1119
|
-
nodes: props.connections,
|
|
1120
|
-
activeId: props.activeId,
|
|
1121
|
-
onOpen: props.onOpenConnection,
|
|
1122
|
-
onCreate: props.onCreateConnection,
|
|
1123
|
-
creating: props.creating
|
|
1124
|
-
})
|
|
1125
|
-
]
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
//#endregion
|
|
1129
|
-
//#region editors/workflow-studio/components/use-hash-selection.ts
|
|
1130
|
-
function readHash() {
|
|
1131
|
-
return window.location.hash.replace(/^#/, "") || void 0;
|
|
1132
|
-
}
|
|
1133
|
-
function useHashSelection() {
|
|
1134
|
-
const [selected, setSelected] = useState(readHash);
|
|
1135
|
-
useEffect(() => {
|
|
1136
|
-
const sync = () => setSelected(readHash());
|
|
1137
|
-
window.addEventListener("hashchange", sync);
|
|
1138
|
-
window.addEventListener("popstate", sync);
|
|
1139
|
-
return () => {
|
|
1140
|
-
window.removeEventListener("hashchange", sync);
|
|
1141
|
-
window.removeEventListener("popstate", sync);
|
|
1142
|
-
};
|
|
1143
|
-
}, []);
|
|
1144
|
-
return [selected, useCallback((id) => {
|
|
1145
|
-
setSelected(id);
|
|
1146
|
-
const url = new URL(window.location.href);
|
|
1147
|
-
url.hash = id ?? "";
|
|
1148
|
-
window.history.replaceState(null, "", url);
|
|
1149
|
-
}, [])];
|
|
1150
|
-
}
|
|
1151
|
-
//#endregion
|
|
1152
|
-
//#region editors/workflow-studio/components/useRuns.ts
|
|
1153
|
-
const POLL_MS = 5e3;
|
|
1154
|
-
function useRuns(scope, active = true) {
|
|
1155
|
-
const { workflowId, driveId, limit } = scope;
|
|
1156
|
-
const query = useRunPagesQuery({
|
|
1157
|
-
workflowId,
|
|
1158
|
-
driveId,
|
|
1159
|
-
limit
|
|
1160
|
-
}, {
|
|
1161
|
-
active,
|
|
1162
|
-
pollMs: POLL_MS
|
|
1163
|
-
});
|
|
1164
|
-
const { refetch, fetchNextPage } = query;
|
|
1165
|
-
return {
|
|
1166
|
-
runs: query.data ? runsOfPages(query.data.pages) : null,
|
|
1167
|
-
error: query.status === "error" ? query.error instanceof Error ? query.error.message : String(query.error) : null,
|
|
1168
|
-
reload: () => void refetch(),
|
|
1169
|
-
hasMore: query.hasNextPage,
|
|
1170
|
-
loadingMore: query.isFetchingNextPage,
|
|
1171
|
-
loadMore: () => void fetchNextPage()
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
|
-
//#endregion
|
|
1175
|
-
//#region editors/workflow-studio/components/step-outline.ts
|
|
1176
|
-
function stepOutline(args) {
|
|
1177
|
-
const inbound = /* @__PURE__ */ new Map();
|
|
1178
|
-
for (const edge of args.edges) {
|
|
1179
|
-
const list = inbound.get(edge.to) ?? [];
|
|
1180
|
-
list.push(edge);
|
|
1181
|
-
inbound.set(edge.to, list);
|
|
1182
|
-
}
|
|
1183
|
-
const decided = args.triggerId ? [args.triggerId] : [];
|
|
1184
|
-
const rows = [];
|
|
1185
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1186
|
-
const firstDecided = (edges) => edges.reduce((first, edge) => decided.indexOf(edge.from) < decided.indexOf(first.from) ? edge : first);
|
|
1187
|
-
let progressed = true;
|
|
1188
|
-
while (progressed) {
|
|
1189
|
-
progressed = false;
|
|
1190
|
-
for (const step of args.steps) {
|
|
1191
|
-
if (seen.has(step.id)) continue;
|
|
1192
|
-
const edges = inbound.get(step.id) ?? [];
|
|
1193
|
-
const entry = !args.triggerId && edges.length === 0;
|
|
1194
|
-
if (!entry) {
|
|
1195
|
-
if (edges.length === 0) continue;
|
|
1196
|
-
if (!edges.every((edge) => decided.includes(edge.from))) continue;
|
|
1197
|
-
}
|
|
1198
|
-
seen.add(step.id);
|
|
1199
|
-
decided.push(step.id);
|
|
1200
|
-
const port = entry ? null : firstDecided(edges).port;
|
|
1201
|
-
rows.push({
|
|
1202
|
-
step,
|
|
1203
|
-
port: port === "next" ? null : port
|
|
1204
|
-
});
|
|
1205
|
-
progressed = true;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
return {
|
|
1209
|
-
rows,
|
|
1210
|
-
orphans: args.steps.filter((step) => !seen.has(step.id))
|
|
1211
|
-
};
|
|
1212
|
-
}
|
|
1213
|
-
//#endregion
|
|
1214
|
-
//#region editors/workflow-studio/components/WorkflowBoard.tsx
|
|
1215
|
-
function RowToggle(props) {
|
|
1216
|
-
const [, dispatch] = useDispatch(props.document);
|
|
1217
|
-
const state = props.document.state.global;
|
|
1218
|
-
return /* @__PURE__ */ jsx(StatusToggle, {
|
|
1219
|
-
tooltipSide: "left",
|
|
1220
|
-
published: Boolean(state.published),
|
|
1221
|
-
status: state.status,
|
|
1222
|
-
onChange: (status) => dispatch(actions.setWorkflowStatus({ status }))
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
function summary(rows) {
|
|
1226
|
-
const count = `${rows.length} ${rows.length === 1 ? "workflow" : "workflows"}`;
|
|
1227
|
-
const failing = rows.filter((row) => row.runs[0]?.status === "FAILED").length;
|
|
1228
|
-
const parts = [count, `${rows.filter((row) => row.status === "ENABLED").length} enabled`];
|
|
1229
|
-
if (failing > 0) parts.push(`${failing} failed on the last run`);
|
|
1230
|
-
return parts.join(", ");
|
|
1231
|
-
}
|
|
1232
|
-
function WorkflowBoard(props) {
|
|
1233
|
-
usePieceLogos();
|
|
1234
|
-
const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
|
|
1235
|
-
const runs = props.runs ?? [];
|
|
1236
|
-
const rows = documents.map((document) => {
|
|
1237
|
-
const state = document.state.global;
|
|
1238
|
-
const workflowRuns = runs.filter((run) => run.workflowId === document.header.id);
|
|
1239
|
-
const latest = workflowRuns.at(0);
|
|
1240
|
-
const statusByKey = new Map((latest?.steps ?? []).map((step) => [step.stepKey, step.status]));
|
|
1241
|
-
const outline = stepOutline({
|
|
1242
|
-
triggerId: state.trigger?.id,
|
|
1243
|
-
steps: state.steps,
|
|
1244
|
-
edges: state.edges
|
|
1245
|
-
});
|
|
1246
|
-
const links = [...state.trigger ? [{
|
|
1247
|
-
id: state.trigger.id,
|
|
1248
|
-
block: triggerBlock(state.trigger),
|
|
1249
|
-
label: "Trigger",
|
|
1250
|
-
status: latest ? "SUCCEEDED" : void 0
|
|
1251
|
-
}] : [], ...outline.rows.map((row) => ({
|
|
1252
|
-
id: row.step.id,
|
|
1253
|
-
block: stepBlock(row.step),
|
|
1254
|
-
label: row.step.name || row.step.key,
|
|
1255
|
-
status: statusByKey.get(row.step.key)
|
|
1256
|
-
}))];
|
|
1257
|
-
return {
|
|
1258
|
-
document,
|
|
1259
|
-
id: document.header.id,
|
|
1260
|
-
name: state.name || document.header.name || "Untitled workflow",
|
|
1261
|
-
status: state.status,
|
|
1262
|
-
trigger: describeTrigger(state.trigger),
|
|
1263
|
-
links,
|
|
1264
|
-
runs: workflowRuns
|
|
1265
|
-
};
|
|
1266
|
-
}).sort((a, b) => {
|
|
1267
|
-
const at = a.runs[0]?.startedAt ?? "";
|
|
1268
|
-
const bt = b.runs[0]?.startedAt ?? "";
|
|
1269
|
-
if (at !== bt) return bt.localeCompare(at);
|
|
1270
|
-
return a.name.localeCompare(b.name);
|
|
1271
|
-
});
|
|
1272
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
1273
|
-
className: "mb-10",
|
|
1274
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1275
|
-
className: "mb-4 flex flex-wrap items-end justify-between gap-3",
|
|
1276
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
|
|
1277
|
-
className: "text-2xl font-semibold tracking-tight text-foreground",
|
|
1278
|
-
children: "Workflows"
|
|
1279
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
1280
|
-
className: "mt-1 text-[13px] text-muted-foreground",
|
|
1281
|
-
children: rows.length === 0 ? "Automations in this drive" : summary(rows)
|
|
1282
|
-
})] }), /* @__PURE__ */ jsxs(Button, {
|
|
1283
|
-
variant: "primary",
|
|
1284
|
-
disabled: props.creating,
|
|
1285
|
-
onClick: props.onCreate,
|
|
1286
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1287
|
-
name: "plus",
|
|
1288
|
-
className: "h-3.5 w-3.5"
|
|
1289
|
-
}), "New workflow"]
|
|
1290
|
-
})]
|
|
1291
|
-
}), rows.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1292
|
-
className: "rounded-xl border border-dashed border-foreground/15 px-6 py-12 text-center",
|
|
1293
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
1294
|
-
className: "text-[15px] font-medium text-foreground",
|
|
1295
|
-
children: "No workflows yet"
|
|
1296
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
1297
|
-
className: "mx-auto mt-1 max-w-sm text-[13px] text-muted-foreground",
|
|
1298
|
-
children: "A workflow starts on a trigger, like a schedule or a webhook, and runs a chain of steps across your services."
|
|
1299
|
-
})]
|
|
1300
|
-
}) : /* @__PURE__ */ jsx("ul", {
|
|
1301
|
-
"aria-label": "Workflows",
|
|
1302
|
-
className: "overflow-hidden rounded-xl border border-solid border-foreground/10 bg-card",
|
|
1303
|
-
children: rows.map((row) => {
|
|
1304
|
-
const latest = row.runs.at(0);
|
|
1305
|
-
const latestTone = toneOf(RUN_TONE, latest?.status);
|
|
1306
|
-
const health = workflowHealth(row.status, latest?.status, Boolean(row.document.state.global.published));
|
|
1307
|
-
return /* @__PURE__ */ jsxs("li", {
|
|
1308
|
-
className: "flex items-center border-b border-solid border-foreground/10 last:border-b-0",
|
|
1309
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
1310
|
-
type: "button",
|
|
1311
|
-
className: "grid min-w-0 flex-1 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-6 gap-y-3 px-5 py-4 text-left transition-colors hover:bg-accent/50 focus-visible:bg-accent/50 focus-visible:outline-none md:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_minmax(0,0.8fr)_auto]",
|
|
1312
|
-
onClick: () => props.onOpen(row.id),
|
|
1313
|
-
children: [
|
|
1314
|
-
/* @__PURE__ */ jsxs("span", {
|
|
1315
|
-
className: "min-w-0",
|
|
1316
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
1317
|
-
className: "flex items-center gap-2",
|
|
1318
|
-
children: [
|
|
1319
|
-
/* @__PURE__ */ jsx("span", {
|
|
1320
|
-
title: health.label,
|
|
1321
|
-
className: "flex",
|
|
1322
|
-
children: /* @__PURE__ */ jsx(StatusDot, {
|
|
1323
|
-
tone: health.tone,
|
|
1324
|
-
hollow: health.hollow
|
|
1325
|
-
})
|
|
1326
|
-
}),
|
|
1327
|
-
/* @__PURE__ */ jsx("span", {
|
|
1328
|
-
className: "truncate text-[15px] font-semibold text-foreground",
|
|
1329
|
-
children: row.name
|
|
1330
|
-
}),
|
|
1331
|
-
row.status !== "ENABLED" ? /* @__PURE__ */ jsx("span", {
|
|
1332
|
-
className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",
|
|
1333
|
-
children: statusLabel(row.status)
|
|
1334
|
-
}) : null
|
|
1335
|
-
]
|
|
1336
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1337
|
-
className: "mt-0.5 block truncate pl-4 text-[13px] text-muted-foreground",
|
|
1338
|
-
children: row.trigger
|
|
1339
|
-
})]
|
|
1340
|
-
}),
|
|
1341
|
-
/* @__PURE__ */ jsx("span", {
|
|
1342
|
-
className: "hidden md:block",
|
|
1343
|
-
children: /* @__PURE__ */ jsx(MiniChain, { links: row.links })
|
|
1344
|
-
}),
|
|
1345
|
-
/* @__PURE__ */ jsx("span", {
|
|
1346
|
-
className: "hidden text-[13px] md:block",
|
|
1347
|
-
title: latest ? formatAbsolute(latest.startedAt) : void 0,
|
|
1348
|
-
children: latest ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
1349
|
-
className: `font-medium ${latestTone === "fail" ? "text-wf-fail" : latestTone === "ok" ? "text-wf-ok" : "text-foreground"}`,
|
|
1350
|
-
children: statusLabel(latest.status)
|
|
1351
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1352
|
-
className: "block text-xs text-muted-foreground",
|
|
1353
|
-
children: formatWhen(latest.startedAt)
|
|
1354
|
-
})] }) : /* @__PURE__ */ jsx("span", {
|
|
1355
|
-
className: "text-muted-foreground",
|
|
1356
|
-
children: "Not run yet"
|
|
1357
|
-
})
|
|
1358
|
-
}),
|
|
1359
|
-
/* @__PURE__ */ jsx(RunStrip, { runs: row.runs })
|
|
1360
|
-
]
|
|
1361
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
1362
|
-
className: "flex shrink-0 items-center gap-1 pr-3",
|
|
1363
|
-
children: [/* @__PURE__ */ jsx(RowToggle, { document: row.document }), /* @__PURE__ */ jsx(WorkflowMenu, { document: row.document })]
|
|
1364
|
-
})]
|
|
1365
|
-
}, row.id);
|
|
1366
|
-
})
|
|
1367
|
-
})]
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
//#endregion
|
|
1371
|
-
//#region editors/workflow-studio/components/WorkflowSteps.tsx
|
|
1372
|
-
const RAIL = {
|
|
1373
|
-
ok: "bg-wf-ok",
|
|
1374
|
-
fail: "bg-wf-fail",
|
|
1375
|
-
warn: "bg-wf-warn",
|
|
1376
|
-
run: "bg-wf-run",
|
|
1377
|
-
idle: "bg-border"
|
|
1378
|
-
};
|
|
1379
|
-
const RING = {
|
|
1380
|
-
ok: "ring-wf-ok",
|
|
1381
|
-
fail: "ring-wf-fail",
|
|
1382
|
-
warn: "ring-wf-warn",
|
|
1383
|
-
run: "ring-wf-run",
|
|
1384
|
-
idle: "ring-border"
|
|
1385
|
-
};
|
|
1386
|
-
function TrackStop(props) {
|
|
1387
|
-
const { stop } = props;
|
|
1388
|
-
const tone = stop.status ? toneOf(STEP_TONE, stop.status) : "idle";
|
|
1389
|
-
return /* @__PURE__ */ jsxs("li", {
|
|
1390
|
-
className: "relative flex w-40 shrink-0 flex-col items-center",
|
|
1391
|
-
children: [
|
|
1392
|
-
/* @__PURE__ */ jsx("span", {
|
|
1393
|
-
"aria-hidden": true,
|
|
1394
|
-
className: `absolute left-0 top-[19px] h-0.5 w-1/2 ${props.first ? "invisible" : RAIL[props.inbound]}`
|
|
1395
|
-
}),
|
|
1396
|
-
/* @__PURE__ */ jsx("span", {
|
|
1397
|
-
"aria-hidden": true,
|
|
1398
|
-
className: `absolute right-0 top-[19px] h-0.5 w-1/2 ${props.last ? "invisible" : RAIL[props.outbound]}`
|
|
1399
|
-
}),
|
|
1400
|
-
stop.port ? /* @__PURE__ */ jsx("span", {
|
|
1401
|
-
className: "absolute -left-4 top-0 rounded bg-background px-1 text-[11px] text-muted-foreground",
|
|
1402
|
-
children: stop.port
|
|
1403
|
-
}) : null,
|
|
1404
|
-
/* @__PURE__ */ jsx("button", {
|
|
1405
|
-
type: "button",
|
|
1406
|
-
title: stop.status ? `${stop.title}: ${stop.status.toLowerCase()}` : stop.title,
|
|
1407
|
-
"aria-label": `${stop.title}: ${stop.status ? stop.status.toLowerCase() : "not run"}`,
|
|
1408
|
-
className: `relative z-10 flex h-10 w-10 items-center justify-center rounded-full bg-card ring-2 transition-shadow dark:bg-white hover:ring-4 focus-visible:outline-none focus-visible:ring-4 ${RING[tone]}`,
|
|
1409
|
-
onClick: props.onClick,
|
|
1410
|
-
children: /* @__PURE__ */ jsx(BlockLogo, {
|
|
1411
|
-
bare: true,
|
|
1412
|
-
block: stop.block,
|
|
1413
|
-
size: 20
|
|
1414
|
-
})
|
|
1415
|
-
}),
|
|
1416
|
-
/* @__PURE__ */ jsx("span", {
|
|
1417
|
-
className: "mt-2 max-w-full truncate px-2 text-[13px] font-medium text-foreground",
|
|
1418
|
-
children: stop.title
|
|
1419
|
-
}),
|
|
1420
|
-
/* @__PURE__ */ jsx("span", {
|
|
1421
|
-
className: "max-w-full truncate px-2 text-xs text-muted-foreground",
|
|
1422
|
-
title: stop.subtitle,
|
|
1423
|
-
children: stop.subtitle
|
|
1424
|
-
})
|
|
1425
|
-
]
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
function Track(props) {
|
|
1429
|
-
const tones = props.stops.map((stop) => stop.status ? toneOf(STEP_TONE, stop.status) : "idle");
|
|
1430
|
-
return /* @__PURE__ */ jsx("ol", {
|
|
1431
|
-
className: "-mx-6 flex overflow-x-auto px-6 py-1.5",
|
|
1432
|
-
children: props.stops.map((stop, index) => /* @__PURE__ */ jsx(TrackStop, {
|
|
1433
|
-
stop,
|
|
1434
|
-
first: index === 0,
|
|
1435
|
-
last: index === props.stops.length - 1,
|
|
1436
|
-
inbound: tones[index],
|
|
1437
|
-
outbound: tones[index + 1] ?? "idle",
|
|
1438
|
-
onClick: props.onOpenEditor
|
|
1439
|
-
}, stop.id))
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
function WorkflowSteps(props) {
|
|
1443
|
-
const { state } = props;
|
|
1444
|
-
usePieceLogos();
|
|
1445
|
-
const outline = stepOutline({
|
|
1446
|
-
triggerId: state.trigger?.id,
|
|
1447
|
-
steps: state.steps,
|
|
1448
|
-
edges: state.edges
|
|
1449
|
-
});
|
|
1450
|
-
const statusByKey = new Map((props.latestRun?.steps ?? []).map((step) => [step.stepKey, step.status]));
|
|
1451
|
-
const stopFor = (step, port) => {
|
|
1452
|
-
const block = stepBlock(step);
|
|
1453
|
-
const meta = blockMeta(block);
|
|
1454
|
-
return {
|
|
1455
|
-
id: step.id,
|
|
1456
|
-
title: step.name || step.key,
|
|
1457
|
-
subtitle: meta.displayName,
|
|
1458
|
-
block,
|
|
1459
|
-
status: statusByKey.get(step.key),
|
|
1460
|
-
port
|
|
1461
|
-
};
|
|
1462
|
-
};
|
|
1463
|
-
if (!state.trigger && state.steps.length === 0) return /* @__PURE__ */ jsx("section", {
|
|
1464
|
-
className: "mt-8 border-t border-solid border-border pt-6",
|
|
1465
|
-
children: /* @__PURE__ */ jsxs("p", {
|
|
1466
|
-
className: "text-[13px] text-muted-foreground",
|
|
1467
|
-
children: [
|
|
1468
|
-
"This workflow has no trigger or steps yet.",
|
|
1469
|
-
" ",
|
|
1470
|
-
/* @__PURE__ */ jsx("button", {
|
|
1471
|
-
type: "button",
|
|
1472
|
-
className: "font-medium text-foreground underline underline-offset-2",
|
|
1473
|
-
onClick: props.onOpenEditor,
|
|
1474
|
-
children: "Open the editor"
|
|
1475
|
-
}),
|
|
1476
|
-
" ",
|
|
1477
|
-
"to build it."
|
|
1478
|
-
]
|
|
1479
|
-
})
|
|
1480
|
-
});
|
|
1481
|
-
const trigger = state.trigger ? triggerBlock(state.trigger) : null;
|
|
1482
|
-
const triggerMeta = trigger ? blockMeta(trigger) : null;
|
|
1483
|
-
const stops = [...state.trigger && trigger && triggerMeta ? [{
|
|
1484
|
-
id: state.trigger.id,
|
|
1485
|
-
title: triggerMeta.displayName,
|
|
1486
|
-
subtitle: "Trigger",
|
|
1487
|
-
block: trigger,
|
|
1488
|
-
status: props.latestRun ? "SUCCEEDED" : void 0
|
|
1489
|
-
}] : [], ...outline.rows.map((row) => stopFor(row.step, row.port))];
|
|
1490
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
1491
|
-
className: "mt-8 border-t border-solid border-border pt-6",
|
|
1492
|
-
children: [
|
|
1493
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1494
|
-
className: "mb-4 flex items-baseline gap-2",
|
|
1495
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
1496
|
-
className: "text-[13px] font-medium text-foreground",
|
|
1497
|
-
children: "Steps"
|
|
1498
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1499
|
-
className: "text-xs text-muted-foreground",
|
|
1500
|
-
children: props.latestRun ? "Coloured by the latest run" : "Not run yet"
|
|
1501
|
-
})]
|
|
1502
|
-
}),
|
|
1503
|
-
!state.trigger ? /* @__PURE__ */ jsx("p", {
|
|
1504
|
-
className: "mb-3 text-xs text-wf-warn",
|
|
1505
|
-
children: "No trigger set, so this workflow never starts on its own."
|
|
1506
|
-
}) : null,
|
|
1507
|
-
/* @__PURE__ */ jsx(Track, {
|
|
1508
|
-
stops,
|
|
1509
|
-
onOpenEditor: props.onOpenEditor
|
|
1510
|
-
}),
|
|
1511
|
-
outline.orphans.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1512
|
-
className: "mt-5",
|
|
1513
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
1514
|
-
className: "mb-3 text-xs text-muted-foreground",
|
|
1515
|
-
children: "Not connected to the trigger, so runs never reach these:"
|
|
1516
|
-
}), /* @__PURE__ */ jsx("ol", {
|
|
1517
|
-
className: "-mx-6 flex overflow-x-auto px-6 py-1.5 opacity-60",
|
|
1518
|
-
children: outline.orphans.map((step) => /* @__PURE__ */ jsx(TrackStop, {
|
|
1519
|
-
stop: stopFor(step, null),
|
|
1520
|
-
first: true,
|
|
1521
|
-
last: true,
|
|
1522
|
-
inbound: "idle",
|
|
1523
|
-
outbound: "idle",
|
|
1524
|
-
onClick: props.onOpenEditor
|
|
1525
|
-
}, step.id))
|
|
1526
|
-
})]
|
|
1527
|
-
}) : null
|
|
1528
|
-
]
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
|
-
//#endregion
|
|
1532
|
-
//#region editors/workflow-studio/components/WorkflowHeader.tsx
|
|
1533
|
-
const WORKFLOW_TYPE$1 = "powerhouse/workflow";
|
|
1534
|
-
function WorkflowHeader(props) {
|
|
1535
|
-
const workflowId = props.node.id;
|
|
1536
|
-
const { data: document, error, reload } = useDocumentSafe(workflowId);
|
|
1537
|
-
const [, dispatch] = useDispatch(document);
|
|
1538
|
-
if (error !== void 0) return /* @__PURE__ */ jsx(DocumentLoadError, {
|
|
1539
|
-
title: "This workflow could not be loaded",
|
|
1540
|
-
documentId: workflowId,
|
|
1541
|
-
error,
|
|
1542
|
-
onRetry: () => {
|
|
1543
|
-
reload();
|
|
1544
|
-
}
|
|
1545
|
-
});
|
|
1546
|
-
if (document?.header.documentType !== WORKFLOW_TYPE$1) return null;
|
|
1547
|
-
const workflow = document;
|
|
1548
|
-
const state = workflow.state.global;
|
|
1549
|
-
const stats = runStats(props.runs ?? []);
|
|
1550
|
-
const lastTone = toneOf(RUN_TONE, stats.lastRun?.status);
|
|
1551
|
-
return /* @__PURE__ */ jsxs("header", {
|
|
1552
|
-
className: "mb-8",
|
|
1553
|
-
children: [
|
|
1554
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1555
|
-
className: "flex flex-wrap items-start gap-3",
|
|
1556
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1557
|
-
className: "min-w-0 grow",
|
|
1558
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1559
|
-
className: "flex items-center gap-2.5",
|
|
1560
|
-
children: [
|
|
1561
|
-
/* @__PURE__ */ jsx("h2", {
|
|
1562
|
-
className: "min-w-0 truncate text-xl font-semibold tracking-tight text-foreground",
|
|
1563
|
-
children: state.name || props.node.name || "Untitled workflow"
|
|
1564
|
-
}),
|
|
1565
|
-
/* @__PURE__ */ jsx(PublishState, { model: state }),
|
|
1566
|
-
state.status === "ARCHIVED" ? /* @__PURE__ */ jsx("span", {
|
|
1567
|
-
className: "rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
1568
|
-
children: "Archived"
|
|
1569
|
-
}) : null
|
|
1570
|
-
]
|
|
1571
|
-
}), state.description ? /* @__PURE__ */ jsx("p", {
|
|
1572
|
-
className: "mt-1 max-w-prose text-[13px] text-muted-foreground",
|
|
1573
|
-
children: state.description
|
|
1574
|
-
}) : null]
|
|
1575
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1576
|
-
className: "flex items-center gap-2",
|
|
1577
|
-
children: [
|
|
1578
|
-
/* @__PURE__ */ jsx(StatusToggle, {
|
|
1579
|
-
published: Boolean(state.published),
|
|
1580
|
-
status: state.status,
|
|
1581
|
-
onChange: (status) => dispatch(actions.setWorkflowStatus({ status }))
|
|
1582
|
-
}),
|
|
1583
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1584
|
-
variant: "primary",
|
|
1585
|
-
onClick: props.onEdit,
|
|
1586
|
-
children: "Edit workflow"
|
|
1587
|
-
}),
|
|
1588
|
-
/* @__PURE__ */ jsx(WorkflowMenu, {
|
|
1589
|
-
document: workflow,
|
|
1590
|
-
nodeName: props.node.name,
|
|
1591
|
-
onDeleted: props.onDeleted
|
|
1592
|
-
})
|
|
1593
|
-
]
|
|
1594
|
-
})]
|
|
1595
|
-
}),
|
|
1596
|
-
/* @__PURE__ */ jsxs("dl", {
|
|
1597
|
-
className: "mt-5 flex flex-wrap gap-x-10 gap-y-3",
|
|
1598
|
-
children: [
|
|
1599
|
-
/* @__PURE__ */ jsx(Fact, {
|
|
1600
|
-
label: "Starts",
|
|
1601
|
-
children: state.trigger ? describeTrigger(state.trigger) : /* @__PURE__ */ jsx("span", {
|
|
1602
|
-
className: "text-wf-warn",
|
|
1603
|
-
children: "Never: no trigger"
|
|
1604
|
-
})
|
|
1605
|
-
}),
|
|
1606
|
-
/* @__PURE__ */ jsx(Fact, {
|
|
1607
|
-
label: "Last run",
|
|
1608
|
-
title: stats.lastRun ? formatAbsolute(stats.lastRun.startedAt) : void 0,
|
|
1609
|
-
children: stats.lastRun ? /* @__PURE__ */ jsxs("span", {
|
|
1610
|
-
className: `inline-flex items-center gap-1.5 ${TONE_TEXT[lastTone]}`,
|
|
1611
|
-
children: [/* @__PURE__ */ jsx(StatusDot, { tone: lastTone }), formatWhen(stats.lastRun.startedAt)]
|
|
1612
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
1613
|
-
className: "text-muted-foreground",
|
|
1614
|
-
children: "Never"
|
|
1615
|
-
})
|
|
1616
|
-
}),
|
|
1617
|
-
/* @__PURE__ */ jsx(Fact, {
|
|
1618
|
-
label: "Recent runs",
|
|
1619
|
-
children: stats.total > 0 ? /* @__PURE__ */ jsx(RunStrip, { runs: props.runs ?? [] }) : /* @__PURE__ */ jsx("span", {
|
|
1620
|
-
className: "text-muted-foreground",
|
|
1621
|
-
children: "None yet"
|
|
1622
|
-
})
|
|
1623
|
-
}),
|
|
1624
|
-
/* @__PURE__ */ jsx(Fact, {
|
|
1625
|
-
label: "Success rate",
|
|
1626
|
-
children: stats.successRate === null ? /* @__PURE__ */ jsx("span", {
|
|
1627
|
-
className: "text-muted-foreground",
|
|
1628
|
-
children: "No finished runs"
|
|
1629
|
-
}) : `${stats.successRate}%`
|
|
1630
|
-
}),
|
|
1631
|
-
/* @__PURE__ */ jsxs(Fact, {
|
|
1632
|
-
label: "Version",
|
|
1633
|
-
children: ["v", state.version]
|
|
1634
|
-
})
|
|
1635
|
-
]
|
|
1636
|
-
}),
|
|
1637
|
-
/* @__PURE__ */ jsx(WorkflowSteps, {
|
|
1638
|
-
state,
|
|
1639
|
-
latestRun: stats.lastRun,
|
|
1640
|
-
onOpenEditor: props.onEdit
|
|
1641
|
-
})
|
|
1642
|
-
]
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
//#endregion
|
|
1646
|
-
//#region editors/workflow-studio/components/WorkflowStudio.tsx
|
|
1647
|
-
const WORKFLOW_TYPE = "powerhouse/workflow";
|
|
1648
|
-
const CONNECTION_TYPE = "powerhouse/connection";
|
|
1649
|
-
function WorkflowStudio(props) {
|
|
1650
|
-
return /* @__PURE__ */ jsx(WorkflowRuntimeProvider, { children: /* @__PURE__ */ jsx(Studio, { children: props.children }) });
|
|
1651
|
-
}
|
|
1652
|
-
function Studio(props) {
|
|
1653
|
-
const { fireWorkflow } = useRuntimeActions();
|
|
1654
|
-
const [drive] = useSelectedDrive();
|
|
1655
|
-
const fileNodes = useFileNodesInSelectedDrive() ?? [];
|
|
1656
|
-
const selectedNode = useSelectedNode();
|
|
1657
|
-
const selectedNodeId = selectedNode?.id;
|
|
1658
|
-
const toast = usePHToast();
|
|
1659
|
-
const [selectedId, select] = useHashSelection();
|
|
1660
|
-
const [creating, setCreating] = useState(false);
|
|
1661
|
-
const driveId = drive.header.id;
|
|
1662
|
-
const workflows = fileNodes.filter((node) => node.documentType === WORKFLOW_TYPE);
|
|
1663
|
-
const connections = fileNodes.filter((node) => node.documentType === CONNECTION_TYPE);
|
|
1664
|
-
const editorOpen = Boolean(props.children && selectedNodeId);
|
|
1665
|
-
const create = (documentType, baseName, count) => {
|
|
1666
|
-
if (creating) return;
|
|
1667
|
-
setCreating(true);
|
|
1668
|
-
addDocument(driveId, `${baseName} ${count + 1}`, documentType).then((node) => {
|
|
1669
|
-
select(node.id);
|
|
1670
|
-
setSelectedNode(node.id);
|
|
1671
|
-
}).catch((error) => {
|
|
1672
|
-
toast?.(error instanceof Error ? error.message : `Failed to create ${baseName}`, { type: "error" });
|
|
1673
|
-
}).finally(() => setCreating(false));
|
|
1674
|
-
};
|
|
1675
|
-
const showRuns = (node) => {
|
|
1676
|
-
setSelectedNode(void 0);
|
|
1677
|
-
select(node?.id);
|
|
1678
|
-
};
|
|
1679
|
-
const liveTarget = workflows.find((node) => node.id === selectedId) ?? null;
|
|
1680
|
-
const connectionSelected = connections.some((node) => node.id === selectedId);
|
|
1681
|
-
const wasEditing = useRef(editorOpen);
|
|
1682
|
-
useEffect(() => {
|
|
1683
|
-
if (wasEditing.current && !editorOpen && connectionSelected) select(void 0);
|
|
1684
|
-
wasEditing.current = editorOpen;
|
|
1685
|
-
}, [
|
|
1686
|
-
editorOpen,
|
|
1687
|
-
connectionSelected,
|
|
1688
|
-
select
|
|
1689
|
-
]);
|
|
1690
|
-
const selectionExists = fileNodes.some((node) => node.id === selectedId);
|
|
1691
|
-
useEffect(() => {
|
|
1692
|
-
if (selectedId && fileNodes.length > 0 && !selectionExists) select(void 0);
|
|
1693
|
-
}, [
|
|
1694
|
-
fileNodes.length,
|
|
1695
|
-
select,
|
|
1696
|
-
selectedId,
|
|
1697
|
-
selectionExists
|
|
1698
|
-
]);
|
|
1699
|
-
const focusedWorkflow = liveTarget;
|
|
1700
|
-
const driveFeed = useRuns({ driveId });
|
|
1701
|
-
const workflowFeed = useRuns({ workflowId: focusedWorkflow?.id }, Boolean(focusedWorkflow));
|
|
1702
|
-
const feed = focusedWorkflow ? workflowFeed : driveFeed;
|
|
1703
|
-
const { runs, error: runsError, reload: reloadRuns } = feed;
|
|
1704
|
-
const lastRuns = /* @__PURE__ */ new Map();
|
|
1705
|
-
for (const run of driveFeed.runs ?? []) if (!lastRuns.has(run.workflowId)) lastRuns.set(run.workflowId, run.status);
|
|
1706
|
-
const { data: targetDocument } = useDocumentSafe(liveTarget?.id ?? null);
|
|
1707
|
-
const targetTrigger = targetDocument?.header.documentType === WORKFLOW_TYPE ? targetDocument.state.global.trigger : null;
|
|
1708
|
-
const manualTrigger = Boolean(targetTrigger && sameBlock(triggerBlock(targetTrigger), MANUAL_TRIGGER));
|
|
1709
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1710
|
-
className: "flex h-full min-h-0",
|
|
1711
|
-
children: [/* @__PURE__ */ jsx(Sidebar, {
|
|
1712
|
-
workflows,
|
|
1713
|
-
connections,
|
|
1714
|
-
lastRuns,
|
|
1715
|
-
activeId: selectedId,
|
|
1716
|
-
allRunsActive: !selectedId,
|
|
1717
|
-
creating,
|
|
1718
|
-
onShowAllRuns: () => showRuns(null),
|
|
1719
|
-
onOpenWorkflow: (node) => showRuns(node),
|
|
1720
|
-
onEditWorkflow: (node) => {
|
|
1721
|
-
select(node.id);
|
|
1722
|
-
setSelectedNode(node.id);
|
|
1723
|
-
},
|
|
1724
|
-
onOpenConnection: (node) => {
|
|
1725
|
-
select(node.id);
|
|
1726
|
-
setSelectedNode(node.id);
|
|
1727
|
-
},
|
|
1728
|
-
onCreateWorkflow: () => create(WORKFLOW_TYPE, "Workflow", workflows.length),
|
|
1729
|
-
onCreateConnection: () => create(CONNECTION_TYPE, "Connection", connections.length)
|
|
1730
|
-
}), /* @__PURE__ */ jsx("main", {
|
|
1731
|
-
className: "min-w-0 flex-1 overflow-y-auto",
|
|
1732
|
-
children: editorOpen ? /* @__PURE__ */ jsx("div", {
|
|
1733
|
-
className: "flex h-full min-h-0 flex-col",
|
|
1734
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
1735
|
-
className: "flex min-h-0 flex-1 flex-col [&>#document-editor-container]:min-h-0",
|
|
1736
|
-
children: /* @__PURE__ */ jsx(DocumentErrorBoundary, {
|
|
1737
|
-
documentId: selectedNodeId,
|
|
1738
|
-
label: selectedNode?.name,
|
|
1739
|
-
onDismiss: () => setSelectedNode(void 0),
|
|
1740
|
-
children: props.children
|
|
1741
|
-
}, selectedNodeId)
|
|
1742
|
-
})
|
|
1743
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
1744
|
-
className: "mx-auto w-full max-w-6xl px-8 py-10",
|
|
1745
|
-
children: [liveTarget ? /* @__PURE__ */ jsx(WorkflowHeader, {
|
|
1746
|
-
node: liveTarget,
|
|
1747
|
-
runs,
|
|
1748
|
-
onEdit: () => setSelectedNode(liveTarget.id),
|
|
1749
|
-
onDeleted: () => select(void 0)
|
|
1750
|
-
}, liveTarget.id) : /* @__PURE__ */ jsx(WorkflowBoard, {
|
|
1751
|
-
runs,
|
|
1752
|
-
creating,
|
|
1753
|
-
onOpen: (workflowId) => select(workflowId),
|
|
1754
|
-
onCreate: () => create(WORKFLOW_TYPE, "Workflow", workflows.length)
|
|
1755
|
-
}), /* @__PURE__ */ jsx(RunsView, {
|
|
1756
|
-
title: liveTarget ? "Runs" : "Recent runs",
|
|
1757
|
-
runs,
|
|
1758
|
-
error: runsError,
|
|
1759
|
-
reload: reloadRuns,
|
|
1760
|
-
showWorkflow: liveTarget === null,
|
|
1761
|
-
hasMore: feed.hasMore,
|
|
1762
|
-
loadingMore: feed.loadingMore,
|
|
1763
|
-
onLoadMore: feed.loadMore,
|
|
1764
|
-
onFire: liveTarget && manualTrigger ? () => fireWorkflow(liveTarget.id).then((result) => result.error) : void 0
|
|
1765
|
-
})]
|
|
1766
|
-
})
|
|
1767
|
-
})]
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
//#endregion
|
|
1771
|
-
//#region editors/workflow-studio/config.ts
|
|
1772
|
-
const editorConfig = {
|
|
1773
|
-
isDragAndDropEnabled: true,
|
|
1774
|
-
allowedDocumentTypes: ["powerhouse/workflow", "powerhouse/connection"]
|
|
1775
|
-
};
|
|
1776
|
-
//#endregion
|
|
1777
|
-
//#region editors/workflow-studio/editor.tsx
|
|
1778
|
-
/**
|
|
1779
|
-
* WARNING: DO NOT EDIT
|
|
1780
|
-
* This file is auto-generated and updated by codegen
|
|
1781
|
-
*/
|
|
1782
|
-
/** Editor component for the app */
|
|
1783
|
-
function Editor(props) {
|
|
1784
|
-
useSetPHAppConfig(editorConfig);
|
|
1785
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1786
|
-
className: "h-full min-h-0 bg-background",
|
|
1787
|
-
children: /* @__PURE__ */ jsx(WorkflowStudio, { children: props.children })
|
|
1788
|
-
});
|
|
1789
|
-
}
|
|
1790
|
-
//#endregion
|
|
1791
|
-
export { Editor as default };
|
|
1792
|
-
|
|
1793
|
-
//# sourceMappingURL=editor-Bd2Cu8Mx.js.map
|