@powerhousedao/workflow 6.2.3-dev.100
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/LICENSE +661 -0
- package/README.md +143 -0
- package/dist/browser/BlockSelector-CEdYUqjx.js +3371 -0
- 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-ilYFCRUK.js +90 -0
- package/dist/browser/connection-ilYFCRUK.js.map +1 -0
- 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 -0
- package/dist/browser/document-models/index.js +4 -0
- package/dist/browser/document-models/workflow/index.js +3 -0
- package/dist/browser/document-models-C2SAP1SX.js +164 -0
- package/dist/browser/document-models-C2SAP1SX.js.map +1 -0
- 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-GeRXGdie.js +373 -0
- package/dist/browser/editor-GeRXGdie.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +15 -0
- package/dist/browser/editors/connection-editor/module.js.map +1 -0
- package/dist/browser/editors/index.js +4 -0
- package/dist/browser/editors/runtime/index.js +2 -0
- package/dist/browser/editors/workflow-editor/module.js +15 -0
- package/dist/browser/editors/workflow-editor/module.js.map +1 -0
- package/dist/browser/editors/workflow-studio/module.js +15 -0
- package/dist/browser/editors/workflow-studio/module.js.map +1 -0
- package/dist/browser/index.js +463 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/module-DJz6oTX0.js +690 -0
- package/dist/browser/module-DJz6oTX0.js.map +1 -0
- package/dist/browser/module-mFCt9WHJ.js +1799 -0
- package/dist/browser/module-mFCt9WHJ.js.map +1 -0
- package/dist/browser/piece-auth-63iuNFTs.js +154 -0
- package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
- package/dist/browser/reactor/index.js +8 -0
- package/dist/browser/reactor/index.js.map +1 -0
- 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/style.css +667 -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-C2Qa6myy.js.map +1 -0
- package/dist/browser/workflow-2gR2JXUS.js +109 -0
- package/dist/browser/workflow-2gR2JXUS.js.map +1 -0
- package/dist/node/document-models/connection/index.mjs +67 -0
- package/dist/node/document-models/connection/index.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +4 -0
- package/dist/node/document-models/workflow/index.mjs +86 -0
- package/dist/node/document-models/workflow/index.mjs.map +1 -0
- package/dist/node/editors/index.mjs +6 -0
- package/dist/node/editors/index.mjs.map +1 -0
- package/dist/node/index.mjs +174 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/module-BXKUB58R.mjs +1804 -0
- package/dist/node/module-BXKUB58R.mjs.map +1 -0
- package/dist/node/module-CaBtkQmd.mjs +690 -0
- 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 +12 -0
- package/dist/node/pieces/index.mjs.map +1 -0
- package/dist/node/pieces/reactor/descriptor.json +648 -0
- package/dist/node/pieces/reactor/index.mjs +59 -0
- package/dist/node/pieces/reactor/package.json +9 -0
- package/dist/node/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/node/upgrade-manifests-BCCpSD1J.mjs +8 -0
- package/dist/node/upgrade-manifests-BCCpSD1J.mjs.map +1 -0
- package/dist/powerhouse.manifest.json +175 -0
- package/dist/style.css +670 -0
- 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 +65 -0
- package/dist/types/ai/tools.d.ts.map +1 -0
- package/dist/types/ai/tools.test.d.ts +2 -0
- package/dist/types/ai/tools.test.d.ts.map +1 -0
- package/dist/types/ai/workflow-tools.d.ts +9 -0
- package/dist/types/ai/workflow-tools.d.ts.map +1 -0
- package/dist/types/ai/workflow-tools.live.test.d.ts +2 -0
- package/dist/types/ai/workflow-tools.live.test.d.ts.map +1 -0
- package/dist/types/ai/workflow-tools.test.d.ts +2 -0
- package/dist/types/ai/workflow-tools.test.d.ts.map +1 -0
- package/dist/types/build.d.ts +2 -0
- package/dist/types/build.d.ts.map +1 -0
- package/dist/types/document-models/connection/index.d.ts +3 -0
- package/dist/types/document-models/connection/index.d.ts.map +1 -0
- package/dist/types/document-models/connection/upgrades/index.d.ts +3 -0
- package/dist/types/document-models/connection/upgrades/index.d.ts.map +1 -0
- package/dist/types/document-models/connection/upgrades/upgrade-manifest.d.ts +8 -0
- package/dist/types/document-models/connection/upgrades/upgrade-manifest.d.ts.map +1 -0
- package/dist/types/document-models/connection/upgrades/versions.d.ts +3 -0
- package/dist/types/document-models/connection/upgrades/versions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/actions.d.ts +19 -0
- package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/actions.d.ts +12 -0
- package/dist/types/document-models/connection/v1/gen/actions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/config/actions.d.ts +28 -0
- package/dist/types/document-models/connection/v1/gen/config/actions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/config/creators.d.ts +8 -0
- package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts +42 -0
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/config/operations.d.ts +15 -0
- package/dist/types/document-models/connection/v1/gen/config/operations.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/connection/actions.d.ts +20 -0
- package/dist/types/document-models/connection/v1/gen/connection/actions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/connection/creators.d.ts +6 -0
- package/dist/types/document-models/connection/v1/gen/connection/creators.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +14 -0
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/connection/operations.d.ts +13 -0
- package/dist/types/document-models/connection/v1/gen/connection/operations.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/controller.d.ts +8 -0
- package/dist/types/document-models/connection/v1/gen/controller.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/creators.d.ts +11 -0
- package/dist/types/document-models/connection/v1/gen/creators.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/document-model.d.ts +3 -0
- package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/document-schema.d.ts +68 -0
- package/dist/types/document-models/connection/v1/gen/document-schema.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/document-type.d.ts +6 -0
- package/dist/types/document-models/connection/v1/gen/document-type.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/health/actions.d.ts +12 -0
- package/dist/types/document-models/connection/v1/gen/health/actions.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/health/creators.d.ts +4 -0
- package/dist/types/document-models/connection/v1/gen/health/creators.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/health/error.d.ts +2 -0
- package/dist/types/document-models/connection/v1/gen/health/error.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/health/operations.d.ts +11 -0
- package/dist/types/document-models/connection/v1/gen/health/operations.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/index.d.ts +19 -0
- package/dist/types/document-models/connection/v1/gen/index.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/ph-factories.d.ts +25 -0
- package/dist/types/document-models/connection/v1/gen/ph-factories.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/reducer.d.ts +4 -0
- package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/schema/index.d.ts +7 -0
- package/dist/types/document-models/connection/v1/gen/schema/index.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +216 -0
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +37 -0
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/types.d.ts +16 -0
- package/dist/types/document-models/connection/v1/gen/types.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/gen/utils.d.ts +10 -0
- package/dist/types/document-models/connection/v1/gen/utils.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/hooks.d.ts +18 -0
- package/dist/types/document-models/connection/v1/hooks.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/index.d.ts +11 -0
- package/dist/types/document-models/connection/v1/index.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/module.d.ts +26 -0
- package/dist/types/document-models/connection/v1/module.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/index.d.ts +6 -0
- package/dist/types/document-models/connection/v1/src/index.d.ts.map +1 -0
- 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 +3 -0
- package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts +3 -0
- package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/reducers/health.d.ts +3 -0
- package/dist/types/document-models/connection/v1/src/reducers/health.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/utils.d.ts +2 -0
- package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -0
- 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/connection-scenarios.test.d.ts +2 -0
- package/dist/types/document-models/connection/v1/tests/connection-scenarios.test.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/tests/document-model.test.d.ts +2 -0
- package/dist/types/document-models/connection/v1/tests/document-model.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/connection/v1/utils.d.ts +9 -0
- package/dist/types/document-models/connection/v1/utils.d.ts.map +1 -0
- package/dist/types/document-models/document-models.d.ts +63 -0
- package/dist/types/document-models/document-models.d.ts.map +1 -0
- package/dist/types/document-models/index.d.ts +4 -0
- package/dist/types/document-models/index.d.ts.map +1 -0
- package/dist/types/document-models/upgrade-manifests.d.ts +7 -0
- package/dist/types/document-models/upgrade-manifests.d.ts.map +1 -0
- package/dist/types/document-models/workflow/index.d.ts +3 -0
- package/dist/types/document-models/workflow/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/upgrades/index.d.ts +3 -0
- package/dist/types/document-models/workflow/upgrades/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/upgrades/upgrade-manifest.d.ts +8 -0
- package/dist/types/document-models/workflow/upgrades/upgrade-manifest.d.ts.map +1 -0
- package/dist/types/document-models/workflow/upgrades/versions.d.ts +3 -0
- package/dist/types/document-models/workflow/upgrades/versions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts +32 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/actions.d.ts +22 -0
- package/dist/types/document-models/workflow/v1/gen/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/controller.d.ts +8 -0
- package/dist/types/document-models/workflow/v1/gen/controller.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/creators.d.ts +21 -0
- package/dist/types/document-models/workflow/v1/gen/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +80 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/document-type.d.ts +6 -0
- package/dist/types/document-models/workflow/v1/gen/document-type.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/edges/actions.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/edges/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/edges/creators.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/gen/edges/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/edges/error.d.ts +36 -0
- package/dist/types/document-models/workflow/v1/gen/edges/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/edges/operations.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/edges/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/index.d.ts +24 -0
- package/dist/types/document-models/workflow/v1/gen/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts +25 -0
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/policy/actions.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/policy/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/policy/creators.d.ts +4 -0
- package/dist/types/document-models/workflow/v1/gen/policy/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/policy/error.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/gen/policy/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/policy/operations.d.ts +11 -0
- package/dist/types/document-models/workflow/v1/gen/policy/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts +4 -0
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/schema/index.d.ts +7 -0
- package/dist/types/document-models/workflow/v1/gen/schema/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +488 -0
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +93 -0
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/steps/actions.d.ts +24 -0
- package/dist/types/document-models/workflow/v1/gen/steps/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/steps/creators.d.ts +7 -0
- package/dist/types/document-models/workflow/v1/gen/steps/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts +70 -0
- package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/steps/operations.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/steps/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts +28 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts +8 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +57 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts +15 -0
- package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/types.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/types.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts +10 -0
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/variables/actions.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/variables/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/variables/creators.d.ts +5 -0
- package/dist/types/document-models/workflow/v1/gen/variables/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts +26 -0
- package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/variables/operations.d.ts +12 -0
- package/dist/types/document-models/workflow/v1/gen/variables/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +24 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +7 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +14 -0
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/hooks.d.ts +18 -0
- package/dist/types/document-models/workflow/v1/hooks.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/index.d.ts +11 -0
- package/dist/types/document-models/workflow/v1/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/module.d.ts +39 -0
- package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/helpers.d.ts +15 -0
- package/dist/types/document-models/workflow/v1/src/helpers.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/index.d.ts +6 -0
- package/dist/types/document-models/workflow/v1/src/index.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/edges.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/edges.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/policy.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/policy.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/runtime.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/runtime.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/variables.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/variables.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/src/utils.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/src/utils.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/document-model.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/document-model.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts.map +1 -0
- 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/document-models/workflow/v1/tests/updated-at.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/tests/workflow-scenarios.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/workflow-scenarios.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/utils.d.ts +9 -0
- package/dist/types/document-models/workflow/v1/utils.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +10 -0
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -0
- 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 +6 -0
- package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-callbacks.d.ts +5 -0
- package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-callbacks.test.d.ts +2 -0
- package/dist/types/editors/connection-editor/connection-callbacks.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-form.d.ts +23 -0
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-usage.d.ts +35 -0
- package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-usage.test.d.ts +2 -0
- package/dist/types/editors/connection-editor/connection-usage.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/editor.d.ts +4 -0
- package/dist/types/editors/connection-editor/editor.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/module.d.ts +9 -0
- package/dist/types/editors/connection-editor/module.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/piece-auth.d.ts +39 -0
- package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/piece-auth.test.d.ts +2 -0
- package/dist/types/editors/connection-editor/piece-auth.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/status.d.ts +6 -0
- package/dist/types/editors/connection-editor/status.d.ts.map +1 -0
- package/dist/types/editors/editors.d.ts +7 -0
- package/dist/types/editors/editors.d.ts.map +1 -0
- package/dist/types/editors/index.d.ts +4 -0
- package/dist/types/editors/index.d.ts.map +1 -0
- 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 +35 -0
- package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -0
- package/dist/types/editors/shared/controls.d.ts +123 -0
- package/dist/types/editors/shared/controls.d.ts.map +1 -0
- package/dist/types/editors/shared/data-tree.d.ts +5 -0
- package/dist/types/editors/shared/data-tree.d.ts.map +1 -0
- package/dist/types/editors/shared/data-viewer.d.ts +7 -0
- package/dist/types/editors/shared/data-viewer.d.ts.map +1 -0
- 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 +14 -0
- package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -0
- 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 +45 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -0
- 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 +27 -0
- package/dist/types/editors/shared/undo-plan.d.ts.map +1 -0
- package/dist/types/editors/shared/undo-plan.test.d.ts +2 -0
- package/dist/types/editors/shared/undo-plan.test.d.ts.map +1 -0
- 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 +6 -0
- package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/editor.d.ts +6 -0
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/module.d.ts +9 -0
- package/dist/types/editors/workflow-editor/module.d.ts.map +1 -0
- 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/run-kinds.d.ts +5 -0
- package/dist/types/editors/workflow-editor/run-kinds.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-api.d.ts +16 -0
- package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +347 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-client.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-client.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +54 -0
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -0
- 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 +23 -0
- package/dist/types/editors/workflow-editor/runtime-persist.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts +148 -0
- package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +40 -0
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts +15 -0
- package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -0
- 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 +7 -0
- package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts +51 -0
- package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +37 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +51 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -0
- 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 +17 -0
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts +11 -0
- package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -0
- 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/VariablesEditor.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/VariablesEditor.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/WorkflowCanvas.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts +31 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts +20 -0
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/ap-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +41 -0
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +31 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.test.d.ts.map +1 -0
- 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/block-selector-chips.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/block-selector-chips.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +65 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts +35 -0
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/canvas-menu.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/canvas-menu.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/connection-create.d.ts +18 -0
- package/dist/types/editors/workflow-editor/ui/connection-create.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/connection-create.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/connection-create.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts +93 -0
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts.map +1 -0
- 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 +39 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-tokens.d.ts +18 -0
- package/dist/types/editors/workflow-editor/ui/expression-tokens.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-tokens.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/expression-tokens.test.d.ts.map +1 -0
- 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 +160 -0
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -0
- 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 +187 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/model.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/model.test.d.ts.map +1 -0
- 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-placeholders.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/piece-placeholders.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +82 -0
- package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +66 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +13 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -0
- 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 +66 -0
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -0
- 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/schedule-draft.d.ts +30 -0
- package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/schedule-draft.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/schedule-draft.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts +18 -0
- package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-drag.d.ts +13 -0
- package/dist/types/editors/workflow-editor/ui/step-drag.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-drag.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/step-drag.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts +16 -0
- package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/test-state.d.ts +7 -0
- package/dist/types/editors/workflow-editor/ui/test-state.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/trigger-strategy.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/trigger-strategy.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.test.d.ts.map +1 -0
- 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 +29 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/validation.d.ts +43 -0
- package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/validation.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/validation.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.d.ts +33 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/undo-policy.d.ts +3 -0
- package/dist/types/editors/workflow-editor/undo-policy.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/undo-policy.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/undo-policy.test.d.ts.map +1 -0
- 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 +19 -0
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/RunsTable.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/RunsTable.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts +15 -0
- package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -0
- 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 +20 -0
- package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -0
- 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 +12 -0
- package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -0
- 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/WorkflowHeader.d.ts +9 -0
- package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +15 -0
- package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts +8 -0
- package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts +5 -0
- package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/chain.d.ts +26 -0
- package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -0
- 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 +60 -0
- package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/run-format.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/run-format.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/run-timeline.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/run-timeline.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/step-outline.d.ts +27 -0
- package/dist/types/editors/workflow-studio/components/step-outline.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/components/step-outline.test.d.ts +2 -0
- package/dist/types/editors/workflow-studio/components/step-outline.test.d.ts.map +1 -0
- 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/ui.d.ts +22 -0
- package/dist/types/editors/workflow-studio/components/ui.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/useRuns.d.ts +11 -0
- package/dist/types/editors/workflow-studio/components/useRuns.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/editors/workflow-studio/config.d.ts +3 -0
- package/dist/types/editors/workflow-studio/config.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/editor.d.ts +4 -0
- package/dist/types/editors/workflow-studio/editor.d.ts.map +1 -0
- package/dist/types/editors/workflow-studio/module.d.ts +8 -0
- package/dist/types/editors/workflow-studio/module.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.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 +4 -0
- package/dist/types/pieces/index.d.ts.map +1 -0
- package/dist/types/pieces/reactor/index.d.ts +3 -0
- package/dist/types/pieces/reactor/index.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +27 -0
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +25 -0
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +13 -0
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +8 -0
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +9 -0
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +4 -0
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-props.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/input-props.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-schema.d.ts +31 -0
- package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-schema.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/input-schema.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/logo.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/logo.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/parse.d.ts +40 -0
- package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/parse.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/parse.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/reactor.d.ts +55 -0
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/schema-text.d.ts +7 -0
- package/dist/types/pieces/reactor/lib/schema-text.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/schema-text.test.d.ts +2 -0
- package/dist/types/pieces/reactor/lib/schema-text.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +45 -0
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -0
- 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/playwright.config.d.ts +3 -0
- package/dist/types/playwright.config.d.ts.map +1 -0
- package/dist/types/reactor/index.d.ts +5 -0
- package/dist/types/reactor/index.d.ts.map +1 -0
- package/dist/types/scripts/ui-shots.d.ts +2 -0
- package/dist/types/scripts/ui-shots.d.ts.map +1 -0
- package/dist/types/scripts/ui-stack.d.ts +217 -0
- package/dist/types/scripts/ui-stack.d.ts.map +1 -0
- 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/block-picker.spec.d.ts +2 -0
- package/dist/types/test/ui/block-picker.spec.d.ts.map +1 -0
- package/dist/types/test/ui/branch.spec.d.ts +2 -0
- package/dist/types/test/ui/branch.spec.d.ts.map +1 -0
- package/dist/types/test/ui/canvas-logos.spec.d.ts +2 -0
- package/dist/types/test/ui/canvas-logos.spec.d.ts.map +1 -0
- package/dist/types/test/ui/connection-editor.spec.d.ts +2 -0
- package/dist/types/test/ui/connection-editor.spec.d.ts.map +1 -0
- package/dist/types/test/ui/data-viewer.spec.d.ts +2 -0
- package/dist/types/test/ui/data-viewer.spec.d.ts.map +1 -0
- package/dist/types/test/ui/fixtures.d.ts +14 -0
- package/dist/types/test/ui/fixtures.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/global-setup.d.ts +2 -0
- package/dist/types/test/ui/global-setup.d.ts.map +1 -0
- package/dist/types/test/ui/harness/prop-controls.d.ts +6 -0
- package/dist/types/test/ui/harness/prop-controls.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/piece-version.spec.d.ts +2 -0
- package/dist/types/test/ui/piece-version.spec.d.ts.map +1 -0
- package/dist/types/test/ui/pieces.spec.d.ts +2 -0
- package/dist/types/test/ui/pieces.spec.d.ts.map +1 -0
- package/dist/types/test/ui/ports.spec.d.ts +2 -0
- package/dist/types/test/ui/ports.spec.d.ts.map +1 -0
- package/dist/types/test/ui/prop-controls.spec.d.ts +2 -0
- package/dist/types/test/ui/prop-controls.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/publish.spec.d.ts +2 -0
- package/dist/types/test/ui/publish.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/reactor-steps.spec.d.ts +2 -0
- package/dist/types/test/ui/reactor-steps.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/ui/step-panel.spec.d.ts +2 -0
- package/dist/types/test/ui/step-panel.spec.d.ts.map +1 -0
- package/dist/types/test/ui/step-test.spec.d.ts +2 -0
- package/dist/types/test/ui/step-test.spec.d.ts.map +1 -0
- package/dist/types/test/ui/studio.spec.d.ts +2 -0
- package/dist/types/test/ui/studio.spec.d.ts.map +1 -0
- package/dist/types/test/ui/variables.spec.d.ts +2 -0
- package/dist/types/test/ui/variables.spec.d.ts.map +1 -0
- package/dist/types/test/ui/webhook.spec.d.ts +2 -0
- package/dist/types/test/ui/webhook.spec.d.ts.map +1 -0
- package/dist/types/test/ui/workflow-menu.spec.d.ts +2 -0
- package/dist/types/test/ui/workflow-menu.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/types/vitest.config.d.ts +3 -0
- package/dist/types/vitest.config.d.ts.map +1 -0
- package/dist/workflow.css +68 -0
- package/package.json +146 -0
|
@@ -0,0 +1,3371 @@
|
|
|
1
|
+
import { A as BRANCH_BLOCK, B as SCHEDULE_TRIGGER, D as workflowRuntimeUrl, E as isSyncingError, F as LOOP_BLOCK, G as WAIT_FOR_WEBHOOK_BLOCK, H as STOP_BLOCK, I as MANUAL_TRIGGER, J as pinBlock, K as WEBHOOK_TRIGGER, M as CALL_FLOW_BLOCK, O as APPROVAL_BLOCK, P as DELAY_BLOCK, R as RETURN_RESPONSE_BLOCK, S as createRuntimeClient, X as stepBlock, _ as queryKind, a as pieceActionsQuery, c as runQuery, d as secretStatQuery, g as blockRefKey, h as SHARED_STALE_MS, j as CALLABLE_FLOW_TRIGGER$1, k as ASSERT_BLOCK, m as RESOLVER_STALE_MS, n as catalogQuery, o as pieceTriggersQuery, p as waitingRunsQuery, q as isCoreBlock, r as createRuntimeQueryClient, s as runPagesQuery, u as runsQuery, v as runtimeKeys, z as ROUTER_BLOCK } from "./runtime-queries-FmEzElOY.js";
|
|
2
|
+
import { resolveSwitchboard, useSearchParams, useSelectedDriveSafe, useSetSearchParams, useSwitchboards } from "@powerhousedao/reactor-browser";
|
|
3
|
+
import { blockKey, compareVersions } from "@powerhousedao/pieces-framework/block-type";
|
|
4
|
+
import { CORE_PIECE_NAME, checkTriggerStrategy, scheduleConfigIssue, stepPorts } from "@powerhousedao/pieces-framework/workflow";
|
|
5
|
+
import { QueryClient, keepPreviousData, useInfiniteQuery, useQueries, useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { Component, Fragment, createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
//#region editors/shared/DocumentErrorBoundary.tsx
|
|
10
|
+
/** Best-effort message for anything thrown, without stringifying an object. */
|
|
11
|
+
function errorMessage(error) {
|
|
12
|
+
if (error instanceof Error) return error.message;
|
|
13
|
+
if (typeof error === "string") return error;
|
|
14
|
+
return "Unknown error";
|
|
15
|
+
}
|
|
16
|
+
/** Inline "could not load" panel, also used for hook-level (non-thrown) failures. */
|
|
17
|
+
function DocumentLoadError(props) {
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "m-3 rounded border border-solid border-wf-fail/40 bg-wf-fail/10 p-3",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx("p", {
|
|
22
|
+
className: "text-sm font-medium text-wf-fail",
|
|
23
|
+
children: props.title ?? "This document could not be loaded"
|
|
24
|
+
}),
|
|
25
|
+
props.label ? /* @__PURE__ */ jsx("p", {
|
|
26
|
+
className: "mt-0.5 text-xs text-wf-fail",
|
|
27
|
+
children: props.label
|
|
28
|
+
}) : null,
|
|
29
|
+
props.documentId ? /* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: "mt-0.5 font-mono text-[11px] text-wf-fail",
|
|
31
|
+
children: props.documentId
|
|
32
|
+
}) : null,
|
|
33
|
+
/* @__PURE__ */ jsx("p", {
|
|
34
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
35
|
+
children: errorMessage(props.error)
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: "mt-2 flex gap-2",
|
|
39
|
+
children: [props.onRetry ? /* @__PURE__ */ jsx("button", {
|
|
40
|
+
type: "button",
|
|
41
|
+
className: "rounded border border-solid border-wf-fail/40 px-2 py-0.5 text-xs font-medium text-wf-fail",
|
|
42
|
+
onClick: props.onRetry,
|
|
43
|
+
children: "Retry"
|
|
44
|
+
}) : null, props.onDismiss ? /* @__PURE__ */ jsx("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
className: "rounded border border-solid border-foreground/15 px-2 py-0.5 text-xs text-muted-foreground",
|
|
47
|
+
onClick: props.onDismiss,
|
|
48
|
+
children: "Dismiss"
|
|
49
|
+
}) : null]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
var DocumentErrorBoundary = class extends Component {
|
|
55
|
+
state = {
|
|
56
|
+
error: void 0,
|
|
57
|
+
attempt: 0
|
|
58
|
+
};
|
|
59
|
+
static getDerivedStateFromError(error) {
|
|
60
|
+
return { error };
|
|
61
|
+
}
|
|
62
|
+
componentDidCatch(error, info) {
|
|
63
|
+
console.error(`Failed to render document ${this.props.documentId ?? "(unknown id)"}:`, error, info.componentStack);
|
|
64
|
+
}
|
|
65
|
+
retry = () => {
|
|
66
|
+
this.setState((state) => ({
|
|
67
|
+
error: void 0,
|
|
68
|
+
attempt: state.attempt + 1
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
dismiss = () => {
|
|
72
|
+
this.setState({ error: void 0 });
|
|
73
|
+
this.props.onDismiss?.();
|
|
74
|
+
};
|
|
75
|
+
render() {
|
|
76
|
+
if (this.state.error !== void 0) return /* @__PURE__ */ jsx(DocumentLoadError, {
|
|
77
|
+
label: this.props.label,
|
|
78
|
+
documentId: this.props.documentId,
|
|
79
|
+
error: this.state.error,
|
|
80
|
+
onRetry: this.retry,
|
|
81
|
+
onDismiss: this.props.onDismiss ? this.dismiss : void 0
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ jsx(Fragment, { children: this.props.children }, this.state.attempt);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region editors/shared/icons.tsx
|
|
88
|
+
const ICON_PATHS = {
|
|
89
|
+
pencil: "M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4",
|
|
90
|
+
trash: "M5 7h14M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3",
|
|
91
|
+
plus: "M12 5v14M5 12h14",
|
|
92
|
+
minus: "M5 12h14",
|
|
93
|
+
list: "M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01",
|
|
94
|
+
play: "M7 5v14l12-7z",
|
|
95
|
+
stop: "M7 7h10v10H7z",
|
|
96
|
+
chevron: "M9 6l6 6-6 6",
|
|
97
|
+
chevronDown: "M6 9l6 6 6-6",
|
|
98
|
+
retry: "M4 12a8 8 0 1 0 2.3-5.7M4 4v4h4",
|
|
99
|
+
back: "M15 6l-6 6 6 6",
|
|
100
|
+
close: "M6 6l12 12M18 6L6 18",
|
|
101
|
+
check: "M5 12l5 5 9-10",
|
|
102
|
+
search: "M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4-4",
|
|
103
|
+
braces: "M8 4c-2 0-3 1-3 3v2c0 1.5-1 3-2 3 1 0 2 1.5 2 3v2c0 2 1 3 3 3M16 4c2 0 3 1 3 3v2c0 1.5 1 3 2 3-1 0-2 1.5-2 3v2c0 2-1 3-3 3",
|
|
104
|
+
link: "M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1",
|
|
105
|
+
arrowRight: "M5 12h14M13 6l6 6-6 6",
|
|
106
|
+
alert: "M12 8v5M12 16.5v.01M10.3 4l-7.6 13.2A2 2 0 0 0 4.4 20h15.2a2 2 0 0 0 1.7-2.8L13.7 4a2 2 0 0 0-3.4 0z",
|
|
107
|
+
copy: "M9 9h10v10H9zM5 15V5h10",
|
|
108
|
+
sliders: "M4 7h10M18 7h2M4 17h4M12 17h8M14 5v4M8 15v4",
|
|
109
|
+
eye: "M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12zM12 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z",
|
|
110
|
+
eyeOff: "M3 3l18 18M10.6 5.6A10 10 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a17 17 0 0 1-3 3.7M6.6 6.6C4 8.3 2.5 12 2.5 12s3.5 6.5 9.5 6.5a9.6 9.6 0 0 0 4.4-1M9.9 9.9a3 3 0 0 0 4.2 4.2",
|
|
111
|
+
undo: "M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3",
|
|
112
|
+
redo: "M15 14l5-5-5-5M20 9H10a6 6 0 0 0 0 12h3",
|
|
113
|
+
clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",
|
|
114
|
+
bolt: "M13 3L5 13h6l-1 8 8-10h-6l1-8z",
|
|
115
|
+
branch: "M6 4v10M6 14a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM18 4a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM18 10c0 4-6 3-11 6",
|
|
116
|
+
route: "M12 21v-7M12 14L5 5M12 14l7-9M12 14V3",
|
|
117
|
+
loop: "M17 2l3 3-3 3M4 11V9a4 4 0 0 1 4-4h12M7 22l-3-3 3-3M20 13v2a4 4 0 0 1-4 4H4",
|
|
118
|
+
lock: "M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3M12 15v2",
|
|
119
|
+
more: "M5 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM12 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM19 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2z",
|
|
120
|
+
archive: "M4 5h16v4H4zM6 9v10h12V9M10 13h4",
|
|
121
|
+
subflow: "M4 4h8v6H4zM12 14h8v6h-8zM8 10v7h4",
|
|
122
|
+
reply: "M10 7l-5 5 5 5M5 12h9a5 5 0 0 1 5 5v2"
|
|
123
|
+
};
|
|
124
|
+
function isIconName(name) {
|
|
125
|
+
return typeof name === "string" && name in ICON_PATHS;
|
|
126
|
+
}
|
|
127
|
+
function Icon(props) {
|
|
128
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
129
|
+
"aria-hidden": true,
|
|
130
|
+
viewBox: "0 0 24 24",
|
|
131
|
+
fill: "none",
|
|
132
|
+
stroke: "currentColor",
|
|
133
|
+
strokeWidth: 1.75,
|
|
134
|
+
strokeLinecap: "round",
|
|
135
|
+
strokeLinejoin: "round",
|
|
136
|
+
width: props.size,
|
|
137
|
+
height: props.size,
|
|
138
|
+
className: `shrink-0 ${props.size ? "" : "h-4 w-4"} ${props.className ?? ""}`,
|
|
139
|
+
children: /* @__PURE__ */ jsx("path", { d: ICON_PATHS[props.name] })
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region editors/shared/controls.tsx
|
|
144
|
+
const FOCUS_RING = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40";
|
|
145
|
+
const BUTTON_SIZE = {
|
|
146
|
+
sm: "h-7 gap-1 rounded-md px-2 text-xs",
|
|
147
|
+
md: "h-8 gap-1.5 rounded-md px-3 text-[13px]"
|
|
148
|
+
};
|
|
149
|
+
const BUTTON_VARIANT = {
|
|
150
|
+
primary: "bg-primary text-primary-foreground hover:opacity-90",
|
|
151
|
+
secondary: "border border-solid border-foreground/15 bg-card text-foreground hover:bg-accent",
|
|
152
|
+
ghost: "text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
153
|
+
danger: "text-wf-fail hover:bg-wf-fail/10",
|
|
154
|
+
destructive: "bg-wf-fail text-background hover:opacity-90"
|
|
155
|
+
};
|
|
156
|
+
function Button(props) {
|
|
157
|
+
const { variant = "secondary", size = "md", className = "", ...rest } = props;
|
|
158
|
+
return /* @__PURE__ */ jsx("button", {
|
|
159
|
+
type: "button",
|
|
160
|
+
className: `inline-flex shrink-0 items-center font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 ${FOCUS_RING} ${BUTTON_SIZE[size]} ${BUTTON_VARIANT[variant]} ${className}`,
|
|
161
|
+
...rest
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function IconButton(props) {
|
|
165
|
+
const { icon, label, active, className = "", ...rest } = props;
|
|
166
|
+
return /* @__PURE__ */ jsx("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
title: label,
|
|
169
|
+
"aria-label": label,
|
|
170
|
+
className: `inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors disabled:pointer-events-none disabled:opacity-50 ${FOCUS_RING} ${active ? "bg-wf-run/10 text-wf-run" : "text-muted-foreground hover:bg-accent hover:text-foreground"} ${className}`,
|
|
171
|
+
...rest,
|
|
172
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
173
|
+
name: icon,
|
|
174
|
+
className: "h-3.5 w-3.5"
|
|
175
|
+
})
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const inputClass = "w-full rounded-md border border-solid border-foreground/15 bg-card px-2.5 text-[13px] text-foreground placeholder:text-muted-foreground/70 transition-colors hover:border-foreground/25 focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/25 disabled:cursor-not-allowed disabled:opacity-60";
|
|
179
|
+
const textInputClass = `${inputClass} h-9`;
|
|
180
|
+
const textAreaClass = `${inputClass} min-h-20 py-2 leading-relaxed`;
|
|
181
|
+
const invalidClass = "border-wf-warn/70 hover:border-wf-warn";
|
|
182
|
+
/** Label row above a control: name, optional marker, and a trailing action. */
|
|
183
|
+
function FieldLabel(props) {
|
|
184
|
+
const LabelTag = props.htmlFor ? "label" : "span";
|
|
185
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
186
|
+
className: "mb-1.5 flex min-h-6 items-center justify-between gap-2",
|
|
187
|
+
children: [/* @__PURE__ */ jsxs(LabelTag, {
|
|
188
|
+
htmlFor: props.htmlFor,
|
|
189
|
+
className: "flex min-w-0 items-baseline gap-1.5 text-[13px] font-medium text-foreground",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsx("span", {
|
|
192
|
+
className: "truncate",
|
|
193
|
+
children: props.label
|
|
194
|
+
}),
|
|
195
|
+
props.optional ? /* @__PURE__ */ jsx("span", {
|
|
196
|
+
className: "shrink-0 text-xs font-normal text-muted-foreground",
|
|
197
|
+
children: "Optional"
|
|
198
|
+
}) : null,
|
|
199
|
+
props.needsValue ? /* @__PURE__ */ jsx("span", {
|
|
200
|
+
className: "shrink-0 text-xs font-normal text-wf-warn",
|
|
201
|
+
children: "Needs a value"
|
|
202
|
+
}) : null
|
|
203
|
+
]
|
|
204
|
+
}), props.action ? /* @__PURE__ */ jsx("span", {
|
|
205
|
+
className: "flex shrink-0 items-center gap-0.5",
|
|
206
|
+
children: props.action
|
|
207
|
+
}) : null]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const LONG_HINT = 140;
|
|
211
|
+
/** Help text under a control; long piece descriptions fold to two lines. */
|
|
212
|
+
function Hint(props) {
|
|
213
|
+
const [open, setOpen] = useState(false);
|
|
214
|
+
const text = props.text;
|
|
215
|
+
if (text !== void 0) {
|
|
216
|
+
if (!text.trim()) return null;
|
|
217
|
+
const long = text.length > LONG_HINT;
|
|
218
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
219
|
+
className: "mt-1.5 text-xs leading-relaxed text-muted-foreground",
|
|
220
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: long && !open ? "line-clamp-2" : void 0,
|
|
222
|
+
children: text
|
|
223
|
+
}), long ? /* @__PURE__ */ jsx("button", {
|
|
224
|
+
type: "button",
|
|
225
|
+
className: "mt-0.5 block font-medium text-foreground/70 hover:text-foreground",
|
|
226
|
+
onClick: () => setOpen((value) => !value),
|
|
227
|
+
children: open ? "Show less" : "Show more"
|
|
228
|
+
}) : null]
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return /* @__PURE__ */ jsx("p", {
|
|
232
|
+
className: "mt-1.5 text-xs leading-relaxed text-muted-foreground",
|
|
233
|
+
children: props.children
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function FieldError(props) {
|
|
237
|
+
if (!props.children) return null;
|
|
238
|
+
return /* @__PURE__ */ jsx("p", {
|
|
239
|
+
className: "mt-1.5 text-xs text-wf-fail",
|
|
240
|
+
children: props.children
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function Switch(props) {
|
|
244
|
+
const id = useId();
|
|
245
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
className: "flex items-start justify-between gap-4",
|
|
247
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
248
|
+
htmlFor: id,
|
|
249
|
+
className: "min-w-0",
|
|
250
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
251
|
+
className: "block text-[13px] font-medium text-foreground",
|
|
252
|
+
children: props.label
|
|
253
|
+
}), props.description ? /* @__PURE__ */ jsx(Hint, { text: props.description }) : null]
|
|
254
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
255
|
+
id,
|
|
256
|
+
type: "button",
|
|
257
|
+
role: "switch",
|
|
258
|
+
"aria-checked": props.checked,
|
|
259
|
+
disabled: props.disabled,
|
|
260
|
+
className: `relative mt-0.5 inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors disabled:opacity-50 ${FOCUS_RING} ${props.checked ? "bg-primary" : "bg-foreground/20"}`,
|
|
261
|
+
onClick: () => props.onChange(!props.checked),
|
|
262
|
+
children: /* @__PURE__ */ jsx("span", { className: `inline-block h-4 w-4 rounded-full bg-card shadow-sm transition-transform ${props.checked ? "translate-x-[18px]" : "translate-x-0.5"}` })
|
|
263
|
+
})]
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function Toggle(props) {
|
|
267
|
+
return /* @__PURE__ */ jsx("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
role: "switch",
|
|
270
|
+
"aria-checked": props.checked,
|
|
271
|
+
"aria-label": props.label,
|
|
272
|
+
disabled: props.disabled,
|
|
273
|
+
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${FOCUS_RING} ${props.checked ? "bg-wf-ok" : "bg-foreground/20"}`,
|
|
274
|
+
onClick: (event) => {
|
|
275
|
+
event.stopPropagation();
|
|
276
|
+
props.onChange(!props.checked);
|
|
277
|
+
},
|
|
278
|
+
children: /* @__PURE__ */ jsx("span", { className: `inline-block h-4 w-4 rounded-full bg-card shadow-sm transition-transform ${props.checked ? "translate-x-[18px]" : "translate-x-0.5"}` })
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
function Tooltip(props) {
|
|
282
|
+
if (props.enabled === false) return /* @__PURE__ */ jsx(Fragment$1, { children: props.children });
|
|
283
|
+
const place = props.side === "left" ? "right-full top-1/2 -translate-y-1/2 pr-1.5" : `top-full pt-1.5 ${props.align === "start" ? "left-0" : "right-0"}`;
|
|
284
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
285
|
+
className: "group/tip relative inline-flex",
|
|
286
|
+
children: [props.children, /* @__PURE__ */ jsx("span", {
|
|
287
|
+
className: `invisible absolute z-50 opacity-0 transition-opacity group-focus-within/tip:visible group-focus-within/tip:opacity-100 group-hover/tip:visible group-hover/tip:opacity-100 ${place}`,
|
|
288
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
289
|
+
role: "tooltip",
|
|
290
|
+
className: "block w-max max-w-64 rounded-md border border-solid border-foreground/10 bg-card px-2.5 py-1.5 text-xs text-foreground shadow-lg",
|
|
291
|
+
children: props.content
|
|
292
|
+
})
|
|
293
|
+
})]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function Tabs$1(props) {
|
|
297
|
+
return /* @__PURE__ */ jsx("div", {
|
|
298
|
+
role: "tablist",
|
|
299
|
+
className: "flex gap-4",
|
|
300
|
+
children: props.tabs.map((tab) => {
|
|
301
|
+
const selected = tab.value === props.value;
|
|
302
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
303
|
+
type: "button",
|
|
304
|
+
role: "tab",
|
|
305
|
+
"aria-selected": selected,
|
|
306
|
+
className: `-mb-px flex items-center gap-1.5 border-b-2 border-solid pb-2 text-[13px] font-medium transition-colors ${FOCUS_RING} ${selected ? "border-foreground text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`,
|
|
307
|
+
onClick: () => props.onChange(tab.value),
|
|
308
|
+
children: [tab.label, tab.badge]
|
|
309
|
+
}, tab.value);
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/** Two or three short, mutually exclusive choices shown side by side. */
|
|
314
|
+
function Segmented(props) {
|
|
315
|
+
return /* @__PURE__ */ jsx("div", {
|
|
316
|
+
role: "radiogroup",
|
|
317
|
+
className: `flex h-9 w-full items-center gap-0.5 rounded-md bg-muted p-0.5 ${props.invalid ? "ring-1 ring-wf-warn/60" : ""}`,
|
|
318
|
+
children: props.options.map((option) => {
|
|
319
|
+
const selected = option.value === props.value;
|
|
320
|
+
return /* @__PURE__ */ jsx("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
role: "radio",
|
|
323
|
+
"aria-checked": selected,
|
|
324
|
+
className: `h-8 min-w-0 flex-1 truncate rounded px-2 text-[13px] transition-colors ${FOCUS_RING} ${selected ? "bg-card font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
325
|
+
onClick: () => props.onChange(option.value),
|
|
326
|
+
children: option.label
|
|
327
|
+
}, option.value);
|
|
328
|
+
})
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const SEARCH_THRESHOLD = 7;
|
|
332
|
+
function Select(props) {
|
|
333
|
+
const [open, setOpen] = useState(false);
|
|
334
|
+
const [query, setQuery] = useState("");
|
|
335
|
+
const [active, setActive] = useState(0);
|
|
336
|
+
const triggerRef = useRef(null);
|
|
337
|
+
const popoverRef = useRef(null);
|
|
338
|
+
const searchRef = useRef(null);
|
|
339
|
+
const listId = useId();
|
|
340
|
+
const [position, setPosition] = useState(null);
|
|
341
|
+
const selected = props.multiple ? props.value : props.value ? [props.value] : [];
|
|
342
|
+
const selectedSet = new Set(selected);
|
|
343
|
+
const searchable = props.searchable || Boolean(props.onQueryChange) || props.options.length > SEARCH_THRESHOLD;
|
|
344
|
+
const needle = query.trim().toLowerCase();
|
|
345
|
+
const serverSide = Boolean(props.onQueryChange);
|
|
346
|
+
const visible = useMemo(() => needle && !serverSide ? props.options.filter((option) => `${option.label} ${option.description ?? ""}`.toLowerCase().includes(needle)) : props.options, [
|
|
347
|
+
needle,
|
|
348
|
+
props.options,
|
|
349
|
+
serverSide
|
|
350
|
+
]);
|
|
351
|
+
const onQueryChange = props.onQueryChange;
|
|
352
|
+
const dismiss = () => {
|
|
353
|
+
setOpen(false);
|
|
354
|
+
setQuery("");
|
|
355
|
+
onQueryChange?.("");
|
|
356
|
+
};
|
|
357
|
+
const close = () => {
|
|
358
|
+
dismiss();
|
|
359
|
+
triggerRef.current?.focus();
|
|
360
|
+
};
|
|
361
|
+
const place = () => {
|
|
362
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
363
|
+
if (!rect) return;
|
|
364
|
+
const below = window.innerHeight - rect.bottom - 8;
|
|
365
|
+
const above = rect.top - 8;
|
|
366
|
+
const flip = below < 240 && above > below;
|
|
367
|
+
setPosition({
|
|
368
|
+
left: rect.left,
|
|
369
|
+
width: rect.width,
|
|
370
|
+
top: flip ? void 0 : rect.bottom + 4,
|
|
371
|
+
bottom: flip ? window.innerHeight - rect.top + 4 : void 0,
|
|
372
|
+
maxHeight: Math.min(320, flip ? above : below),
|
|
373
|
+
container: triggerRef.current?.closest("[role=\"dialog\"]") ?? document.body
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
const openList = () => {
|
|
377
|
+
const index = props.options.findIndex((option) => selectedSet.has(option.value));
|
|
378
|
+
setActive(Math.max(0, index));
|
|
379
|
+
setOpen(true);
|
|
380
|
+
};
|
|
381
|
+
useLayoutEffect(() => {
|
|
382
|
+
if (!open) return;
|
|
383
|
+
place();
|
|
384
|
+
}, [open]);
|
|
385
|
+
const placed = position !== null;
|
|
386
|
+
useEffect(() => {
|
|
387
|
+
if (open && placed && searchable) searchRef.current?.focus();
|
|
388
|
+
}, [
|
|
389
|
+
open,
|
|
390
|
+
placed,
|
|
391
|
+
searchable
|
|
392
|
+
]);
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
if (!open) return;
|
|
395
|
+
const onPointer = (event) => {
|
|
396
|
+
const target = event.target;
|
|
397
|
+
if (!popoverRef.current?.contains(target) && !triggerRef.current?.contains(target)) {
|
|
398
|
+
setOpen(false);
|
|
399
|
+
setQuery("");
|
|
400
|
+
onQueryChange?.("");
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
window.addEventListener("mousedown", onPointer);
|
|
404
|
+
window.addEventListener("resize", place);
|
|
405
|
+
window.addEventListener("scroll", place, true);
|
|
406
|
+
return () => {
|
|
407
|
+
window.removeEventListener("mousedown", onPointer);
|
|
408
|
+
window.removeEventListener("resize", place);
|
|
409
|
+
window.removeEventListener("scroll", place, true);
|
|
410
|
+
};
|
|
411
|
+
}, [
|
|
412
|
+
open,
|
|
413
|
+
searchable,
|
|
414
|
+
onQueryChange
|
|
415
|
+
]);
|
|
416
|
+
useEffect(() => {
|
|
417
|
+
popoverRef.current?.querySelector(`[data-index="${active}"]`)?.scrollIntoView({ block: "nearest" });
|
|
418
|
+
}, [active]);
|
|
419
|
+
const choose = (option) => {
|
|
420
|
+
if (option.disabled) return;
|
|
421
|
+
if (props.multiple) {
|
|
422
|
+
props.onChange(selectedSet.has(option.value) ? props.value.filter((value) => value !== option.value) : [...props.value, option.value]);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
props.onChange(option.value);
|
|
426
|
+
close();
|
|
427
|
+
};
|
|
428
|
+
const onListKey = (event) => {
|
|
429
|
+
if (event.key === "ArrowDown") {
|
|
430
|
+
event.preventDefault();
|
|
431
|
+
setActive((index) => Math.min(visible.length - 1, index + 1));
|
|
432
|
+
} else if (event.key === "ArrowUp") {
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
setActive((index) => Math.max(0, index - 1));
|
|
435
|
+
} else if (event.key === "Enter") {
|
|
436
|
+
event.preventDefault();
|
|
437
|
+
const option = visible[active];
|
|
438
|
+
if (option) choose(option);
|
|
439
|
+
} else if (event.key === "Escape") {
|
|
440
|
+
event.preventDefault();
|
|
441
|
+
close();
|
|
442
|
+
} else if (event.key === "Tab") dismiss();
|
|
443
|
+
};
|
|
444
|
+
const labels = props.options.filter((option) => selectedSet.has(option.value)).map((option) => option.label);
|
|
445
|
+
const unknown = selected.filter((value) => !props.options.some((option) => option.value === value));
|
|
446
|
+
const shown = [...labels, ...unknown];
|
|
447
|
+
const selectedIcon = props.multiple ? void 0 : props.options.find((option) => option.value === props.value)?.icon;
|
|
448
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
449
|
+
ref: triggerRef,
|
|
450
|
+
id: props.id,
|
|
451
|
+
"aria-label": props.ariaLabel,
|
|
452
|
+
type: "button",
|
|
453
|
+
role: "combobox",
|
|
454
|
+
"aria-expanded": open,
|
|
455
|
+
"aria-controls": open ? listId : void 0,
|
|
456
|
+
"aria-activedescendant": open && visible.length > 0 ? `${listId}-${active}` : void 0,
|
|
457
|
+
"aria-haspopup": "listbox",
|
|
458
|
+
disabled: props.disabled,
|
|
459
|
+
className: `${textInputClass} flex items-center gap-2 text-left ${props.invalid ? invalidClass : ""} ${open ? "border-ring ring-2 ring-ring/25" : ""}`,
|
|
460
|
+
onClick: () => open ? close() : openList(),
|
|
461
|
+
onKeyDown: (event) => {
|
|
462
|
+
if (open) {
|
|
463
|
+
onListKey(event);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
openList();
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
children: [
|
|
472
|
+
selectedIcon,
|
|
473
|
+
/* @__PURE__ */ jsx("span", {
|
|
474
|
+
className: `min-w-0 flex-1 truncate ${shown.length ? "" : "text-muted-foreground/70"}`,
|
|
475
|
+
children: labels.length === 0 && unknown.length > 0 && props.valueLabel !== void 0 ? props.valueLabel : shown.length > 0 ? shown.join(", ") : props.loading ? "Loading…" : props.placeholder ?? "Choose…"
|
|
476
|
+
}),
|
|
477
|
+
props.multiple && shown.length > 1 ? /* @__PURE__ */ jsx("span", {
|
|
478
|
+
className: "shrink-0 rounded bg-muted px-1.5 text-[11px] tabular-nums text-muted-foreground",
|
|
479
|
+
children: shown.length
|
|
480
|
+
}) : null,
|
|
481
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
482
|
+
name: "chevronDown",
|
|
483
|
+
className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}`
|
|
484
|
+
})
|
|
485
|
+
]
|
|
486
|
+
}), open && position ? createPortal(/* @__PURE__ */ jsxs("div", {
|
|
487
|
+
ref: popoverRef,
|
|
488
|
+
tabIndex: -1,
|
|
489
|
+
className: "workflow-select-popover fixed flex flex-col overflow-hidden rounded-lg border border-solid border-foreground/10 bg-popover text-popover-foreground shadow-lg outline-none",
|
|
490
|
+
style: {
|
|
491
|
+
left: position.left,
|
|
492
|
+
width: Math.max(position.width, 220),
|
|
493
|
+
top: position.top,
|
|
494
|
+
bottom: position.bottom,
|
|
495
|
+
maxHeight: position.maxHeight
|
|
496
|
+
},
|
|
497
|
+
onKeyDown: onListKey,
|
|
498
|
+
children: [
|
|
499
|
+
searchable || props.onRefresh ? /* @__PURE__ */ jsxs("div", {
|
|
500
|
+
className: "flex items-center gap-1 border-b border-solid border-foreground/10 px-2",
|
|
501
|
+
children: [searchable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
502
|
+
name: "search",
|
|
503
|
+
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
504
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
505
|
+
ref: searchRef,
|
|
506
|
+
className: "h-9 min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground/70 focus:outline-none",
|
|
507
|
+
placeholder: "Search",
|
|
508
|
+
value: query,
|
|
509
|
+
onChange: (event) => {
|
|
510
|
+
setQuery(event.target.value);
|
|
511
|
+
setActive(0);
|
|
512
|
+
props.onQueryChange?.(event.target.value);
|
|
513
|
+
}
|
|
514
|
+
})] }) : /* @__PURE__ */ jsx("span", { className: "h-9 flex-1" }), props.onRefresh ? /* @__PURE__ */ jsx(IconButton, {
|
|
515
|
+
icon: "retry",
|
|
516
|
+
label: "Reload options",
|
|
517
|
+
disabled: props.loading,
|
|
518
|
+
onClick: props.onRefresh
|
|
519
|
+
}) : null]
|
|
520
|
+
}) : null,
|
|
521
|
+
/* @__PURE__ */ jsx("div", {
|
|
522
|
+
id: listId,
|
|
523
|
+
role: "listbox",
|
|
524
|
+
"aria-multiselectable": props.multiple || void 0,
|
|
525
|
+
className: "min-h-0 flex-1 overflow-y-auto p-1",
|
|
526
|
+
children: props.loading && props.options.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
527
|
+
className: "px-2 py-2 text-[13px] text-muted-foreground",
|
|
528
|
+
children: "Loading options…"
|
|
529
|
+
}) : visible.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
530
|
+
className: "px-2 py-2 text-[13px] text-muted-foreground",
|
|
531
|
+
children: needle ? "Nothing matches." : props.emptyText ?? "No options."
|
|
532
|
+
}) : visible.map((option, index) => {
|
|
533
|
+
const isSelected = selectedSet.has(option.value);
|
|
534
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
535
|
+
id: `${listId}-${index}`,
|
|
536
|
+
role: "option",
|
|
537
|
+
"aria-selected": isSelected,
|
|
538
|
+
"aria-disabled": option.disabled || void 0,
|
|
539
|
+
"data-index": index,
|
|
540
|
+
className: `flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-[13px] ${index === active ? "bg-accent" : ""} ${option.disabled ? "cursor-not-allowed opacity-50" : ""}`,
|
|
541
|
+
onMouseEnter: () => setActive(index),
|
|
542
|
+
onMouseDown: (event) => {
|
|
543
|
+
event.preventDefault();
|
|
544
|
+
choose(option);
|
|
545
|
+
},
|
|
546
|
+
children: [
|
|
547
|
+
props.multiple ? /* @__PURE__ */ jsx("span", {
|
|
548
|
+
className: `flex h-4 w-4 shrink-0 items-center justify-center rounded border border-solid ${isSelected ? "border-primary bg-primary text-primary-foreground" : "border-foreground/25"}`,
|
|
549
|
+
children: isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
550
|
+
name: "check",
|
|
551
|
+
className: "h-3 w-3"
|
|
552
|
+
}) : null
|
|
553
|
+
}) : null,
|
|
554
|
+
option.icon,
|
|
555
|
+
/* @__PURE__ */ jsxs("span", {
|
|
556
|
+
className: "min-w-0 flex-1",
|
|
557
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
558
|
+
className: "block truncate",
|
|
559
|
+
children: option.label
|
|
560
|
+
}), option.description ? /* @__PURE__ */ jsx("span", {
|
|
561
|
+
className: "block truncate text-xs text-muted-foreground",
|
|
562
|
+
children: option.description
|
|
563
|
+
}) : null]
|
|
564
|
+
}),
|
|
565
|
+
!props.multiple && isSelected ? /* @__PURE__ */ jsx(Icon, {
|
|
566
|
+
name: "check",
|
|
567
|
+
className: "h-3.5 w-3.5 text-foreground"
|
|
568
|
+
}) : null
|
|
569
|
+
]
|
|
570
|
+
}, option.value);
|
|
571
|
+
})
|
|
572
|
+
}),
|
|
573
|
+
props.actions?.length ? /* @__PURE__ */ jsx("div", {
|
|
574
|
+
className: "border-t border-solid border-foreground/10 p-1",
|
|
575
|
+
children: props.actions.map((action) => /* @__PURE__ */ jsxs("button", {
|
|
576
|
+
type: "button",
|
|
577
|
+
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
578
|
+
onMouseDown: (event) => {
|
|
579
|
+
event.preventDefault();
|
|
580
|
+
dismiss();
|
|
581
|
+
action.onSelect();
|
|
582
|
+
},
|
|
583
|
+
children: [action.icon ? /* @__PURE__ */ jsx(Icon, {
|
|
584
|
+
name: action.icon,
|
|
585
|
+
className: "h-3.5 w-3.5"
|
|
586
|
+
}) : null, action.label]
|
|
587
|
+
}, action.label))
|
|
588
|
+
}) : null,
|
|
589
|
+
!props.multiple && props.clearable && props.value ? /* @__PURE__ */ jsx("div", {
|
|
590
|
+
className: "border-t border-solid border-foreground/10 p-1",
|
|
591
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
592
|
+
type: "button",
|
|
593
|
+
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
594
|
+
onMouseDown: (event) => {
|
|
595
|
+
event.preventDefault();
|
|
596
|
+
props.onChange("");
|
|
597
|
+
close();
|
|
598
|
+
},
|
|
599
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
600
|
+
name: "close",
|
|
601
|
+
className: "h-3.5 w-3.5"
|
|
602
|
+
}), "Clear selection"]
|
|
603
|
+
})
|
|
604
|
+
}) : null
|
|
605
|
+
]
|
|
606
|
+
}), position.container) : null] });
|
|
607
|
+
}
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region editors/shared/url-param.ts
|
|
610
|
+
/** The studio's sidebar selection. */
|
|
611
|
+
const ITEM_PARAM = "item";
|
|
612
|
+
/** A query param read as one of `allowed`, else `fallback`; the fallback is
|
|
613
|
+
* kept out of the URL. `also` updates other params in the same entry. */
|
|
614
|
+
function useSearchParam(key, fallback, allowed) {
|
|
615
|
+
const params = useSearchParams();
|
|
616
|
+
const setParams = useSetSearchParams();
|
|
617
|
+
const raw = params[key];
|
|
618
|
+
const value = raw !== void 0 && (!allowed || allowed.includes(raw)) ? raw : fallback;
|
|
619
|
+
return [value, useCallback((next, options) => {
|
|
620
|
+
if (next === value && !options?.also) return;
|
|
621
|
+
setParams({
|
|
622
|
+
...options?.also,
|
|
623
|
+
[key]: next === fallback ? void 0 : next
|
|
624
|
+
}, { replace: options?.replace });
|
|
625
|
+
}, [
|
|
626
|
+
key,
|
|
627
|
+
fallback,
|
|
628
|
+
value,
|
|
629
|
+
setParams
|
|
630
|
+
])];
|
|
631
|
+
}
|
|
632
|
+
/** A text param with a local draft, so typing never waits on a navigation;
|
|
633
|
+
* the draft follows other URL changes, e.g. back and forward. */
|
|
634
|
+
function useSearchParamDraft(key) {
|
|
635
|
+
const [param, setParam] = useSearchParam(key, "");
|
|
636
|
+
const [draft, setDraft] = useState(param);
|
|
637
|
+
const written = useRef([]);
|
|
638
|
+
useEffect(() => {
|
|
639
|
+
const index = written.current.indexOf(param);
|
|
640
|
+
written.current = index === -1 ? [] : written.current.slice(index + 1);
|
|
641
|
+
if (index === -1) setDraft(param);
|
|
642
|
+
}, [param]);
|
|
643
|
+
return [draft, useCallback((value) => {
|
|
644
|
+
setDraft(value);
|
|
645
|
+
if (value === param) return;
|
|
646
|
+
written.current.push(value);
|
|
647
|
+
setParam(value, { replace: true });
|
|
648
|
+
}, [param, setParam])];
|
|
649
|
+
}
|
|
650
|
+
function shouldPersistQuery(queryKey) {
|
|
651
|
+
if (typeof queryKey[0] !== "string") return false;
|
|
652
|
+
const kind = queryKind(queryKey);
|
|
653
|
+
if (kind === "catalog") return queryKey.length === 2;
|
|
654
|
+
if (kind === "form") {
|
|
655
|
+
const block = queryKey[2];
|
|
656
|
+
return Array.isArray(block) && block[0] !== CORE_PIECE_NAME;
|
|
657
|
+
}
|
|
658
|
+
return false;
|
|
659
|
+
}
|
|
660
|
+
function persistRuntimeQueries(queryClient, url, store, now = Date.now) {
|
|
661
|
+
if (!store) return {
|
|
662
|
+
ready: Promise.resolve(),
|
|
663
|
+
dispose: () => void 0
|
|
664
|
+
};
|
|
665
|
+
return {
|
|
666
|
+
ready: hydrate(queryClient, url, store, now()),
|
|
667
|
+
dispose: queryClient.getQueryCache().subscribe((event) => {
|
|
668
|
+
if (event.type !== "updated" || event.action.type !== "success") return;
|
|
669
|
+
if (event.action.manual) return;
|
|
670
|
+
const { queryKey, state } = event.query;
|
|
671
|
+
if (!shouldPersistQuery(queryKey) || state.data === void 0) return;
|
|
672
|
+
store.save({
|
|
673
|
+
id: JSON.stringify(queryKey),
|
|
674
|
+
url: queryKey[0],
|
|
675
|
+
queryKey,
|
|
676
|
+
data: state.data,
|
|
677
|
+
updatedAt: state.dataUpdatedAt,
|
|
678
|
+
version: 2
|
|
679
|
+
}).catch(() => void 0);
|
|
680
|
+
})
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
async function hydrate(queryClient, url, store, at) {
|
|
684
|
+
let entries;
|
|
685
|
+
try {
|
|
686
|
+
entries = await store.load(url);
|
|
687
|
+
} catch {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
for (const entry of entries) {
|
|
691
|
+
if (entry.version !== 2 || at - entry.updatedAt > 6048e5 || !shouldPersistQuery(entry.queryKey)) {
|
|
692
|
+
store.remove(entry.id).catch(() => void 0);
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
const current = queryClient.getQueryState(entry.queryKey);
|
|
696
|
+
if (current && current.dataUpdatedAt >= entry.updatedAt) continue;
|
|
697
|
+
queryClient.setQueryData(entry.queryKey, entry.data, { updatedAt: entry.updatedAt });
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const DB_NAME = "ph-workflow-runtime-cache";
|
|
701
|
+
const STORE = "queries";
|
|
702
|
+
function request(req) {
|
|
703
|
+
return new Promise((resolve, reject) => {
|
|
704
|
+
req.onsuccess = () => resolve(req.result);
|
|
705
|
+
req.onerror = () => reject(req.error ?? /* @__PURE__ */ new Error("IndexedDB request failed"));
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function openIdbCacheStore() {
|
|
709
|
+
const idb = globalThis.indexedDB;
|
|
710
|
+
if (!idb) return null;
|
|
711
|
+
let db;
|
|
712
|
+
const open = () => {
|
|
713
|
+
db ??= new Promise((resolve, reject) => {
|
|
714
|
+
const req = idb.open(DB_NAME, 1);
|
|
715
|
+
req.onupgradeneeded = () => {
|
|
716
|
+
req.result.createObjectStore(STORE, { keyPath: "id" }).createIndex("url", "url");
|
|
717
|
+
};
|
|
718
|
+
req.onsuccess = () => resolve(req.result);
|
|
719
|
+
req.onerror = () => reject(req.error ?? /* @__PURE__ */ new Error("IndexedDB unavailable"));
|
|
720
|
+
req.onblocked = () => reject(/* @__PURE__ */ new Error("IndexedDB blocked"));
|
|
721
|
+
});
|
|
722
|
+
db.catch(() => db = void 0);
|
|
723
|
+
return db;
|
|
724
|
+
};
|
|
725
|
+
const withStore = async (mode, run) => {
|
|
726
|
+
return request(run((await open()).transaction(STORE, mode).objectStore(STORE)));
|
|
727
|
+
};
|
|
728
|
+
return {
|
|
729
|
+
load: (url) => withStore("readonly", (store) => store.index("url").getAll(url)),
|
|
730
|
+
save: (entry) => withStore("readwrite", (store) => store.put(entry)).then(() => void 0),
|
|
731
|
+
remove: (id) => withStore("readwrite", (store) => store.delete(id)).then(() => void 0)
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region editors/workflow-editor/ui/piece-source.ts
|
|
736
|
+
function blockUnavailable(entry) {
|
|
737
|
+
if (entry.unsupported) return entry.unsupported;
|
|
738
|
+
if (entry.kind !== "trigger") return void 0;
|
|
739
|
+
const strategy = checkTriggerStrategy(entry.strategy);
|
|
740
|
+
return "issue" in strategy ? strategy.issue : void 0;
|
|
741
|
+
}
|
|
742
|
+
const PieceSourceContext = createContext(void 0);
|
|
743
|
+
const PieceSourceProvider = PieceSourceContext.Provider;
|
|
744
|
+
function usePieceSource() {
|
|
745
|
+
return useContext(PieceSourceContext);
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region editors/workflow-editor/use-workflow-runtime.ts
|
|
749
|
+
function useWorkflowRuntime() {
|
|
750
|
+
const switchboards = useSwitchboards();
|
|
751
|
+
const [drive] = useSelectedDriveSafe();
|
|
752
|
+
const driveId = drive?.header.id;
|
|
753
|
+
const [state, setState] = useState({ status: "resolving" });
|
|
754
|
+
useEffect(() => {
|
|
755
|
+
const controller = new AbortController();
|
|
756
|
+
resolveSwitchboard(switchboards, {
|
|
757
|
+
documentId: driveId,
|
|
758
|
+
need: "workflows",
|
|
759
|
+
signal: controller.signal
|
|
760
|
+
}).then((switchboard) => {
|
|
761
|
+
if (controller.signal.aborted) return;
|
|
762
|
+
setState({
|
|
763
|
+
status: "ready",
|
|
764
|
+
url: workflowRuntimeUrl(switchboard),
|
|
765
|
+
switchboard
|
|
766
|
+
});
|
|
767
|
+
}, (error) => {
|
|
768
|
+
if (controller.signal.aborted) return;
|
|
769
|
+
setState({
|
|
770
|
+
status: "unavailable",
|
|
771
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
return () => controller.abort();
|
|
775
|
+
}, [switchboards, driveId]);
|
|
776
|
+
return state;
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region editors/workflow-editor/runtime-context.tsx
|
|
780
|
+
const RuntimeContext = createContext(null);
|
|
781
|
+
const SEARCH_STALE_MS = 3e5;
|
|
782
|
+
function runtimePieceSource(client, queryClient) {
|
|
783
|
+
return {
|
|
784
|
+
loadCatalog: () => queryClient.fetchQuery(catalogQuery(client)),
|
|
785
|
+
reloadCatalog: () => queryClient.fetchQuery({
|
|
786
|
+
...catalogQuery(client),
|
|
787
|
+
staleTime: 0
|
|
788
|
+
}),
|
|
789
|
+
loadActions: (packageName) => queryClient.fetchQuery(pieceActionsQuery(client, packageName)),
|
|
790
|
+
loadTriggers: (packageName) => queryClient.fetchQuery(pieceTriggersQuery(client, packageName)),
|
|
791
|
+
searchPieces: async (query, filter) => {
|
|
792
|
+
const key = runtimeKeys.searchPieces(client.url, query, filter);
|
|
793
|
+
const result = await queryClient.fetchQuery({
|
|
794
|
+
queryKey: key,
|
|
795
|
+
queryFn: () => client.searchPieces(query, filter),
|
|
796
|
+
staleTime: SEARCH_STALE_MS
|
|
797
|
+
});
|
|
798
|
+
if (result.status !== "ready") queryClient.removeQueries({ queryKey: key });
|
|
799
|
+
return result;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
function RuntimeProvider(props) {
|
|
804
|
+
const { url } = props;
|
|
805
|
+
const [queryClient] = useState(createRuntimeQueryClient);
|
|
806
|
+
const [store] = useState(() => props.store === void 0 ? openIdbCacheStore() : props.store);
|
|
807
|
+
const client = useMemo(() => createRuntimeClient(url), [url]);
|
|
808
|
+
useEffect(() => persistRuntimeQueries(queryClient, url, store).dispose, [
|
|
809
|
+
queryClient,
|
|
810
|
+
url,
|
|
811
|
+
store
|
|
812
|
+
]);
|
|
813
|
+
const value = useMemo(() => ({
|
|
814
|
+
client,
|
|
815
|
+
queryClient
|
|
816
|
+
}), [client, queryClient]);
|
|
817
|
+
const pieceSource = useMemo(() => runtimePieceSource(client, queryClient), [client, queryClient]);
|
|
818
|
+
return /* @__PURE__ */ jsx(RuntimeContext.Provider, {
|
|
819
|
+
value,
|
|
820
|
+
children: /* @__PURE__ */ jsx(PieceSourceProvider, {
|
|
821
|
+
value: pieceSource,
|
|
822
|
+
children: props.children
|
|
823
|
+
})
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
function WorkflowRuntimeProvider(props) {
|
|
827
|
+
const runtime = useWorkflowRuntime();
|
|
828
|
+
if (runtime.status === "resolving") return null;
|
|
829
|
+
if (runtime.status === "unavailable") return /* @__PURE__ */ jsxs("p", {
|
|
830
|
+
role: "alert",
|
|
831
|
+
className: "p-4 text-sm text-wf-fail",
|
|
832
|
+
children: ["The workflow runtime is unavailable: ", runtime.error.message]
|
|
833
|
+
});
|
|
834
|
+
return /* @__PURE__ */ jsx(RuntimeProvider, {
|
|
835
|
+
url: runtime.url,
|
|
836
|
+
children: props.children
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
function useRuntime() {
|
|
840
|
+
const context = useContext(RuntimeContext);
|
|
841
|
+
if (!context) throw new Error("useRuntime needs a RuntimeProvider");
|
|
842
|
+
return context;
|
|
843
|
+
}
|
|
844
|
+
function usePieceCatalog() {
|
|
845
|
+
const { client, queryClient } = useRuntime();
|
|
846
|
+
return useQuery(catalogQuery(client), queryClient);
|
|
847
|
+
}
|
|
848
|
+
function useRunsQuery(scope, options = {}) {
|
|
849
|
+
const { client, queryClient } = useRuntime();
|
|
850
|
+
return useQuery({
|
|
851
|
+
...runsQuery(client, scope),
|
|
852
|
+
enabled: options.active ?? true,
|
|
853
|
+
refetchInterval: options.pollMs ?? false
|
|
854
|
+
}, queryClient);
|
|
855
|
+
}
|
|
856
|
+
function useRunPagesQuery(scope, options = {}) {
|
|
857
|
+
const { client, queryClient } = useRuntime();
|
|
858
|
+
return useInfiniteQuery({
|
|
859
|
+
...runPagesQuery(client, scope),
|
|
860
|
+
enabled: options.active ?? true,
|
|
861
|
+
refetchInterval: options.pollMs ?? false
|
|
862
|
+
}, queryClient);
|
|
863
|
+
}
|
|
864
|
+
const WAITING_RUN_POLL_MS = 3e4;
|
|
865
|
+
function useRunQuery(runId, options = {}) {
|
|
866
|
+
const { client, queryClient } = useRuntime();
|
|
867
|
+
return useQuery({
|
|
868
|
+
...runQuery(client, runId),
|
|
869
|
+
refetchInterval: (query) => {
|
|
870
|
+
const data = query.state.data;
|
|
871
|
+
if (!options.pollMs || data?.endedAt != null) return false;
|
|
872
|
+
return data?.status === "WAITING" ? Math.max(options.pollMs, WAITING_RUN_POLL_MS) : options.pollMs;
|
|
873
|
+
}
|
|
874
|
+
}, queryClient);
|
|
875
|
+
}
|
|
876
|
+
function useWaitingRunsQuery(scope, options = {}) {
|
|
877
|
+
const { client, queryClient } = useRuntime();
|
|
878
|
+
return useQuery({
|
|
879
|
+
...waitingRunsQuery(client, scope),
|
|
880
|
+
enabled: options.active ?? true,
|
|
881
|
+
refetchInterval: options.pollMs ?? false
|
|
882
|
+
}, queryClient);
|
|
883
|
+
}
|
|
884
|
+
function useSecretStat(ref, enabled) {
|
|
885
|
+
const { client, queryClient } = useRuntime();
|
|
886
|
+
const query = useQuery({
|
|
887
|
+
...secretStatQuery(client, ref),
|
|
888
|
+
enabled,
|
|
889
|
+
gcTime: 0
|
|
890
|
+
}, queryClient);
|
|
891
|
+
if (!enabled) return null;
|
|
892
|
+
if (query.status === "pending") return void 0;
|
|
893
|
+
return query.status === "error" ? null : query.data;
|
|
894
|
+
}
|
|
895
|
+
function useOAuthRedirectUri() {
|
|
896
|
+
const { client, queryClient } = useRuntime();
|
|
897
|
+
return useQuery({
|
|
898
|
+
queryKey: [client.url, "oauthRedirectUri"],
|
|
899
|
+
queryFn: () => client.fetchOAuthRedirectUri(),
|
|
900
|
+
staleTime: Infinity
|
|
901
|
+
}, queryClient);
|
|
902
|
+
}
|
|
903
|
+
function useOAuthAttempt(state) {
|
|
904
|
+
const { client, queryClient } = useRuntime();
|
|
905
|
+
const query = useQuery({
|
|
906
|
+
queryKey: [
|
|
907
|
+
client.url,
|
|
908
|
+
"oauthAttempt",
|
|
909
|
+
state
|
|
910
|
+
],
|
|
911
|
+
queryFn: () => client.fetchOAuthAttempt(state),
|
|
912
|
+
enabled: state !== null,
|
|
913
|
+
gcTime: 0,
|
|
914
|
+
refetchInterval: (current) => {
|
|
915
|
+
if (current.state.status === "error") return false;
|
|
916
|
+
const data = current.state.data;
|
|
917
|
+
if (data === null) return false;
|
|
918
|
+
return data?.status === "OK" || data?.status === "ERROR" ? false : 1e3;
|
|
919
|
+
}
|
|
920
|
+
}, queryClient);
|
|
921
|
+
if (state === null || query.isError) return null;
|
|
922
|
+
return query.data;
|
|
923
|
+
}
|
|
924
|
+
function useRuntimeActions() {
|
|
925
|
+
const { client, queryClient } = useRuntime();
|
|
926
|
+
return useMemo(() => {
|
|
927
|
+
const invalidate = (queryKey) => void queryClient.invalidateQueries({ queryKey });
|
|
928
|
+
const runsChanged = () => {
|
|
929
|
+
invalidate(runtimeKeys.allRuns(client.url));
|
|
930
|
+
invalidate([client.url, "latestRun"]);
|
|
931
|
+
};
|
|
932
|
+
const secretSaved = (stat) => {
|
|
933
|
+
queryClient.setQueryData(runtimeKeys.secret(client.url, stat.ref), stat);
|
|
934
|
+
return stat;
|
|
935
|
+
};
|
|
936
|
+
return {
|
|
937
|
+
fireWorkflow: (workflowId, payload) => client.fireWorkflow(workflowId, payload).finally(runsChanged),
|
|
938
|
+
rerunRun: (runId) => client.rerunRun(runId).finally(runsChanged),
|
|
939
|
+
resolveWaitpoint: (waitpoint, approved, reason) => client.resolveWaitpoint(waitpoint.id, approved, reason).finally(() => {
|
|
940
|
+
runsChanged();
|
|
941
|
+
invalidate(runtimeKeys.run(client.url, waitpoint.runId));
|
|
942
|
+
}),
|
|
943
|
+
cancelRun: (runId) => client.cancelRun(runId).finally(() => {
|
|
944
|
+
runsChanged();
|
|
945
|
+
invalidate(runtimeKeys.run(client.url, runId));
|
|
946
|
+
}),
|
|
947
|
+
createSecret: (documentId, value, label) => client.createSecret(documentId, value, label).then(secretSaved),
|
|
948
|
+
rotateSecret: (ref, value) => client.rotateSecret(ref, value).then(secretSaved),
|
|
949
|
+
checkConnection: (connectionId) => client.checkConnection(connectionId).finally(() => invalidate(runtimeKeys.connections(client.url))),
|
|
950
|
+
connectionsChanged: () => invalidate(runtimeKeys.connections(client.url)),
|
|
951
|
+
startOAuth: (connectionId, options) => client.startOAuth(connectionId, options)
|
|
952
|
+
};
|
|
953
|
+
}, [client, queryClient]);
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region editors/workflow-editor/ui/validation.ts
|
|
957
|
+
function isEmptyValue(value) {
|
|
958
|
+
if (value === void 0 || value === null) return true;
|
|
959
|
+
if (typeof value === "string") return value.trim() === "";
|
|
960
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
function isPropVisible(prop, config) {
|
|
964
|
+
const rule = prop.showWhen;
|
|
965
|
+
if (!rule) return true;
|
|
966
|
+
return rule.oneOf.includes(config[rule.prop] ?? void 0);
|
|
967
|
+
}
|
|
968
|
+
function asRecord(config) {
|
|
969
|
+
return config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
|
|
970
|
+
}
|
|
971
|
+
function missingRequired(props, config) {
|
|
972
|
+
const record = asRecord(config);
|
|
973
|
+
return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name])).map((prop) => prop.displayName);
|
|
974
|
+
}
|
|
975
|
+
function resolverInputFor(block, prop, config, connectionId, reactorConnectionId) {
|
|
976
|
+
const refreshers = (prop.refreshers ?? []).filter((name) => name !== "auth");
|
|
977
|
+
return {
|
|
978
|
+
block,
|
|
979
|
+
propName: prop.name,
|
|
980
|
+
refreshers: refreshers.map((name) => config[name] ?? null),
|
|
981
|
+
connectionId: connectionId ?? null,
|
|
982
|
+
...reactorConnectionId ? { reactorConnectionId } : {}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function settingFor(settings, prop) {
|
|
986
|
+
return settings?.find((setting) => setting.prop === prop);
|
|
987
|
+
}
|
|
988
|
+
function parsePropList(result) {
|
|
989
|
+
if (!Array.isArray(result)) throw new Error("Unexpected properties result");
|
|
990
|
+
return result.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
|
|
991
|
+
}
|
|
992
|
+
function storedSchema(settings, prop) {
|
|
993
|
+
const schema = settingFor(settings, prop)?.schema;
|
|
994
|
+
if (!Array.isArray(schema)) return void 0;
|
|
995
|
+
return schema.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
|
|
996
|
+
}
|
|
997
|
+
function stripOptions(props) {
|
|
998
|
+
return props.map((prop) => {
|
|
999
|
+
const { staticOptions: _options, properties, ...rest } = prop;
|
|
1000
|
+
return properties ? {
|
|
1001
|
+
...rest,
|
|
1002
|
+
properties: stripOptions(properties)
|
|
1003
|
+
} : rest;
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
function withSetting(settings, prop, patch) {
|
|
1007
|
+
const list = [...settings ?? []];
|
|
1008
|
+
const index = list.findIndex((setting) => setting.prop === prop);
|
|
1009
|
+
const current = index >= 0 ? list[index] : {
|
|
1010
|
+
prop,
|
|
1011
|
+
mode: "MANUAL"
|
|
1012
|
+
};
|
|
1013
|
+
const next = {
|
|
1014
|
+
prop,
|
|
1015
|
+
mode: patch.mode ?? current.mode,
|
|
1016
|
+
schema: "schema" in patch ? patch.schema ?? null : current.schema ?? null
|
|
1017
|
+
};
|
|
1018
|
+
if (index >= 0) list[index] = next;
|
|
1019
|
+
else list.push(next);
|
|
1020
|
+
return list;
|
|
1021
|
+
}
|
|
1022
|
+
const REACTOR_CONNECTION_LABEL = "Reactor connection";
|
|
1023
|
+
function blockMissing(input) {
|
|
1024
|
+
if (input.skip) return [];
|
|
1025
|
+
const { form } = input;
|
|
1026
|
+
if (!form || form === "loading") return null;
|
|
1027
|
+
const record = asRecord(input.config);
|
|
1028
|
+
const missing = [];
|
|
1029
|
+
let unknown = false;
|
|
1030
|
+
if (form.auth === "required" && !input.connectionId) missing.push("Connection");
|
|
1031
|
+
if (form.requireReactor && !input.reactorConnectionId) missing.push(REACTOR_CONNECTION_LABEL);
|
|
1032
|
+
for (const prop of form.props) {
|
|
1033
|
+
if (prop.type === "MARKDOWN" || !isPropVisible(prop, record)) continue;
|
|
1034
|
+
const value = record[prop.name];
|
|
1035
|
+
const bound = settingFor(input.propertySettings, prop.name)?.mode === "EXPRESSION";
|
|
1036
|
+
if (prop.type !== "DYNAMIC" || bound) {
|
|
1037
|
+
if (prop.required && isEmptyValue(value)) missing.push(prop.displayName);
|
|
1038
|
+
continue;
|
|
1039
|
+
}
|
|
1040
|
+
const children = input.resolveDynamic?.(resolverInputFor(input.block, prop, record, input.connectionId, input.reactorConnectionId)) ?? storedSchema(input.propertySettings, prop.name);
|
|
1041
|
+
if (children === void 0) {
|
|
1042
|
+
unknown = true;
|
|
1043
|
+
continue;
|
|
1044
|
+
}
|
|
1045
|
+
missing.push(...missingRequired(children, value));
|
|
1046
|
+
}
|
|
1047
|
+
if (missing.length > 0) return missing;
|
|
1048
|
+
if (form.display === "schedule") {
|
|
1049
|
+
const issue = scheduleConfigIssue(input.config);
|
|
1050
|
+
if (issue) return [issue.replace(/^Schedule: /, "")];
|
|
1051
|
+
}
|
|
1052
|
+
return unknown ? null : [];
|
|
1053
|
+
}
|
|
1054
|
+
function undeclaredPortIssues(form, outgoingPorts, step) {
|
|
1055
|
+
const formPorts = form && form !== "loading" ? form.ports : void 0;
|
|
1056
|
+
const ports = step ? stepPorts(step.block, step.config, () => formPorts, outgoingPorts) : formPorts;
|
|
1057
|
+
if (!ports || !outgoingPorts) return [];
|
|
1058
|
+
return [...new Set(outgoingPorts)].filter((port) => !ports.includes(port)).map((port) => `An edge leaves on "${port}", which this block never takes`);
|
|
1059
|
+
}
|
|
1060
|
+
function workflowReadiness(blocks, hasTrigger) {
|
|
1061
|
+
const firstIncomplete = blocks.find((block) => block.missing && block.missing.length > 0)?.id ?? null;
|
|
1062
|
+
const checking = blocks.some((block) => block.missing === null);
|
|
1063
|
+
return {
|
|
1064
|
+
ready: hasTrigger && !checking && firstIncomplete === null,
|
|
1065
|
+
hasTrigger,
|
|
1066
|
+
firstIncomplete,
|
|
1067
|
+
checking
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region editors/workflow-editor/ui/design-time.tsx
|
|
1072
|
+
const DesignTimeContext = createContext(null);
|
|
1073
|
+
function DesignTimeProvider(props) {
|
|
1074
|
+
const { service, queryClient, scope } = props;
|
|
1075
|
+
const value = useMemo(() => ({
|
|
1076
|
+
service,
|
|
1077
|
+
queryClient,
|
|
1078
|
+
scope
|
|
1079
|
+
}), [
|
|
1080
|
+
service,
|
|
1081
|
+
queryClient,
|
|
1082
|
+
scope
|
|
1083
|
+
]);
|
|
1084
|
+
return /* @__PURE__ */ jsx(DesignTimeContext.Provider, {
|
|
1085
|
+
value,
|
|
1086
|
+
children: props.children
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
function useDesignTime() {
|
|
1090
|
+
return useContext(DesignTimeContext)?.service;
|
|
1091
|
+
}
|
|
1092
|
+
function useDesignTimeScope() {
|
|
1093
|
+
const context = useContext(DesignTimeContext);
|
|
1094
|
+
const [detached] = useState(() => context ? null : {
|
|
1095
|
+
queryClient: new QueryClient(),
|
|
1096
|
+
scope: ""
|
|
1097
|
+
});
|
|
1098
|
+
return context ?? detached;
|
|
1099
|
+
}
|
|
1100
|
+
function messageOf(error) {
|
|
1101
|
+
return error instanceof Error ? error.message : String(error);
|
|
1102
|
+
}
|
|
1103
|
+
function useBlockForm(block) {
|
|
1104
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1105
|
+
const query = useQuery({
|
|
1106
|
+
queryKey: runtimeKeys.form(scope, block),
|
|
1107
|
+
queryFn: () => service.getBlockForm(block),
|
|
1108
|
+
enabled: Boolean(service),
|
|
1109
|
+
staleTime: SHARED_STALE_MS
|
|
1110
|
+
}, queryClient);
|
|
1111
|
+
if (!service) return { form: null };
|
|
1112
|
+
if (query.data !== void 0) return { form: query.data };
|
|
1113
|
+
if (query.status === "error") return {
|
|
1114
|
+
form: null,
|
|
1115
|
+
error: messageOf(query.error)
|
|
1116
|
+
};
|
|
1117
|
+
return { form: "loading" };
|
|
1118
|
+
}
|
|
1119
|
+
function formQuery(service, scope, block) {
|
|
1120
|
+
return {
|
|
1121
|
+
queryKey: runtimeKeys.form(scope, block),
|
|
1122
|
+
queryFn: () => service.getBlockForm(block),
|
|
1123
|
+
staleTime: SHARED_STALE_MS
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function useBlockFormLoader() {
|
|
1127
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1128
|
+
return useMemo(() => async (block) => {
|
|
1129
|
+
if (!service) return null;
|
|
1130
|
+
try {
|
|
1131
|
+
return await queryClient.fetchQuery(formQuery(service, scope, block));
|
|
1132
|
+
} catch {
|
|
1133
|
+
return null;
|
|
1134
|
+
}
|
|
1135
|
+
}, [
|
|
1136
|
+
service,
|
|
1137
|
+
queryClient,
|
|
1138
|
+
scope
|
|
1139
|
+
]);
|
|
1140
|
+
}
|
|
1141
|
+
function useCachedBlockForm() {
|
|
1142
|
+
const { queryClient, scope } = useDesignTimeScope();
|
|
1143
|
+
return useMemo(() => (block) => queryClient.getQueryData(runtimeKeys.form(scope, block)), [queryClient, scope]);
|
|
1144
|
+
}
|
|
1145
|
+
function useBlockFormPrefetch() {
|
|
1146
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1147
|
+
return useMemo(() => (block) => {
|
|
1148
|
+
if (!service) return;
|
|
1149
|
+
queryClient.prefetchQuery(formQuery(service, scope, block));
|
|
1150
|
+
}, [
|
|
1151
|
+
service,
|
|
1152
|
+
queryClient,
|
|
1153
|
+
scope
|
|
1154
|
+
]);
|
|
1155
|
+
}
|
|
1156
|
+
function useBlockForms(blocks) {
|
|
1157
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1158
|
+
const unique = [...new Map(blocks.map((block) => [blockRefKey(block), block])).values()];
|
|
1159
|
+
const results = useQueries({ queries: unique.map((block) => ({
|
|
1160
|
+
queryKey: runtimeKeys.form(scope, block),
|
|
1161
|
+
queryFn: () => service.getBlockForm(block),
|
|
1162
|
+
enabled: Boolean(service),
|
|
1163
|
+
staleTime: SHARED_STALE_MS
|
|
1164
|
+
})) }, queryClient);
|
|
1165
|
+
const forms = /* @__PURE__ */ new Map();
|
|
1166
|
+
unique.forEach((block, index) => {
|
|
1167
|
+
const query = results[index];
|
|
1168
|
+
forms.set(blockRefKey(block), !service ? null : query.data !== void 0 ? query.data : query.status === "error" ? null : "loading");
|
|
1169
|
+
});
|
|
1170
|
+
return forms;
|
|
1171
|
+
}
|
|
1172
|
+
function useBlockPorts(blocks) {
|
|
1173
|
+
const forms = useBlockForms(blocks);
|
|
1174
|
+
return (block) => {
|
|
1175
|
+
const form = forms.get(blockRefKey(block));
|
|
1176
|
+
return form && form !== "loading" ? form.ports : void 0;
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
function keyHash(value) {
|
|
1180
|
+
try {
|
|
1181
|
+
return JSON.stringify(value);
|
|
1182
|
+
} catch {
|
|
1183
|
+
return String(value);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
const SYNC_REFUSAL = /forbidden|document\b.*not found|was not found/i;
|
|
1187
|
+
const SYNC_RETRIES_MAX = 4;
|
|
1188
|
+
function retryWhileSyncing(input) {
|
|
1189
|
+
if (!input.reactorConnectionId) return {};
|
|
1190
|
+
return {
|
|
1191
|
+
retry: (failures, error) => failures < SYNC_RETRIES_MAX && SYNC_REFUSAL.test(messageOf(error)),
|
|
1192
|
+
retryDelay: 1e3
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
function useSettled(value, ms) {
|
|
1196
|
+
const hash = keyHash(value);
|
|
1197
|
+
const latest = useRef(value);
|
|
1198
|
+
useEffect(() => {
|
|
1199
|
+
latest.current = value;
|
|
1200
|
+
});
|
|
1201
|
+
const [settled, setSettled] = useState({
|
|
1202
|
+
hash,
|
|
1203
|
+
value
|
|
1204
|
+
});
|
|
1205
|
+
useEffect(() => {
|
|
1206
|
+
if (hash === settled.hash) return;
|
|
1207
|
+
const timer = setTimeout(() => setSettled({
|
|
1208
|
+
hash,
|
|
1209
|
+
value: latest.current
|
|
1210
|
+
}), ms);
|
|
1211
|
+
return () => clearTimeout(timer);
|
|
1212
|
+
}, [
|
|
1213
|
+
hash,
|
|
1214
|
+
settled.hash,
|
|
1215
|
+
ms
|
|
1216
|
+
]);
|
|
1217
|
+
return settled.value;
|
|
1218
|
+
}
|
|
1219
|
+
function useResolvedProp(options) {
|
|
1220
|
+
const { queryClient, scope } = useDesignTimeScope();
|
|
1221
|
+
const input = useSettled(options.input, options.debounceMs);
|
|
1222
|
+
const loadRef = useRef(options);
|
|
1223
|
+
useEffect(() => {
|
|
1224
|
+
loadRef.current = options;
|
|
1225
|
+
});
|
|
1226
|
+
const enabled = Boolean(options.load);
|
|
1227
|
+
const query = useQuery({
|
|
1228
|
+
queryKey: runtimeKeys[options.kind](scope, input),
|
|
1229
|
+
queryFn: async () => {
|
|
1230
|
+
const current = loadRef.current;
|
|
1231
|
+
if (!current.load) throw new Error("No resolver");
|
|
1232
|
+
return current.parse(await current.load());
|
|
1233
|
+
},
|
|
1234
|
+
enabled,
|
|
1235
|
+
staleTime: RESOLVER_STALE_MS,
|
|
1236
|
+
...retryWhileSyncing(input)
|
|
1237
|
+
}, queryClient);
|
|
1238
|
+
const reload = () => void query.refetch();
|
|
1239
|
+
const syncing = query.isFetching && query.failureCount > 0;
|
|
1240
|
+
if (!enabled) return {
|
|
1241
|
+
state: { kind: "idle" },
|
|
1242
|
+
reload,
|
|
1243
|
+
syncing: false
|
|
1244
|
+
};
|
|
1245
|
+
if (query.isFetching) return {
|
|
1246
|
+
state: { kind: "loading" },
|
|
1247
|
+
reload,
|
|
1248
|
+
syncing
|
|
1249
|
+
};
|
|
1250
|
+
if (query.status === "error") return {
|
|
1251
|
+
state: {
|
|
1252
|
+
kind: "error",
|
|
1253
|
+
message: messageOf(query.error)
|
|
1254
|
+
},
|
|
1255
|
+
reload,
|
|
1256
|
+
syncing
|
|
1257
|
+
};
|
|
1258
|
+
if (query.status === "success") return {
|
|
1259
|
+
state: {
|
|
1260
|
+
kind: "ready",
|
|
1261
|
+
result: query.data
|
|
1262
|
+
},
|
|
1263
|
+
reload,
|
|
1264
|
+
syncing
|
|
1265
|
+
};
|
|
1266
|
+
return {
|
|
1267
|
+
state: { kind: "loading" },
|
|
1268
|
+
reload,
|
|
1269
|
+
syncing
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
function useOptionSearch(options) {
|
|
1273
|
+
const { queryClient, scope } = useDesignTimeScope();
|
|
1274
|
+
const typed = options.query.trim() === "" ? "" : options.query;
|
|
1275
|
+
const settled = useSettled(typed, options.debounceMs);
|
|
1276
|
+
const loadRef = useRef(options);
|
|
1277
|
+
useEffect(() => {
|
|
1278
|
+
loadRef.current = options;
|
|
1279
|
+
});
|
|
1280
|
+
const query = useQuery({
|
|
1281
|
+
queryKey: runtimeKeys.options(scope, {
|
|
1282
|
+
...options.input,
|
|
1283
|
+
searchValue: settled
|
|
1284
|
+
}),
|
|
1285
|
+
queryFn: async () => {
|
|
1286
|
+
const current = loadRef.current;
|
|
1287
|
+
if (!current.load) throw new Error("No resolver");
|
|
1288
|
+
return current.parse(await current.load(settled));
|
|
1289
|
+
},
|
|
1290
|
+
enabled: Boolean(options.load) && settled !== "" && typed !== "",
|
|
1291
|
+
staleTime: RESOLVER_STALE_MS,
|
|
1292
|
+
...retryWhileSyncing(options.input),
|
|
1293
|
+
placeholderData: keepPreviousData
|
|
1294
|
+
}, queryClient);
|
|
1295
|
+
return typed === "" ? null : query.data ?? null;
|
|
1296
|
+
}
|
|
1297
|
+
function getResolvedDynamicProps(queryClient, scope, input) {
|
|
1298
|
+
return queryClient.getQueryData(runtimeKeys.dynamic(scope, input));
|
|
1299
|
+
}
|
|
1300
|
+
function useDynamicPrefetch() {
|
|
1301
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1302
|
+
return useMemo(() => (input, config) => {
|
|
1303
|
+
if (!service) return;
|
|
1304
|
+
queryClient.prefetchQuery({
|
|
1305
|
+
queryKey: runtimeKeys.dynamic(scope, input),
|
|
1306
|
+
queryFn: () => service.loadOptions(input.block, input.propName, config, input.connectionId ?? void 0, void 0, input.reactorConnectionId ?? void 0).then(parsePropList),
|
|
1307
|
+
staleTime: RESOLVER_STALE_MS,
|
|
1308
|
+
...retryWhileSyncing(input)
|
|
1309
|
+
});
|
|
1310
|
+
}, [
|
|
1311
|
+
service,
|
|
1312
|
+
queryClient,
|
|
1313
|
+
scope
|
|
1314
|
+
]);
|
|
1315
|
+
}
|
|
1316
|
+
function useDynamicCache() {
|
|
1317
|
+
const { queryClient, scope } = useDesignTimeScope();
|
|
1318
|
+
return useMemo(() => (input) => getResolvedDynamicProps(queryClient, scope, input), [queryClient, scope]);
|
|
1319
|
+
}
|
|
1320
|
+
function useDynamicLookup() {
|
|
1321
|
+
const { queryClient, scope } = useDesignTimeScope();
|
|
1322
|
+
const [version, setVersion] = useState(0);
|
|
1323
|
+
useEffect(() => queryClient.getQueryCache().subscribe((event) => {
|
|
1324
|
+
if (event.type !== "updated") return;
|
|
1325
|
+
const key = event.query.queryKey;
|
|
1326
|
+
if (key[0] === scope && key[1] === "dynamic") setVersion((v) => v + 1);
|
|
1327
|
+
}), [queryClient, scope]);
|
|
1328
|
+
return useMemo(() => (input) => version >= 0 ? getResolvedDynamicProps(queryClient, scope, input) : void 0, [
|
|
1329
|
+
queryClient,
|
|
1330
|
+
scope,
|
|
1331
|
+
version
|
|
1332
|
+
]);
|
|
1333
|
+
}
|
|
1334
|
+
function useRunById(runId) {
|
|
1335
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1336
|
+
const fetchRun = service?.fetchRun;
|
|
1337
|
+
const query = useQuery({
|
|
1338
|
+
queryKey: runtimeKeys.run(scope, runId ?? ""),
|
|
1339
|
+
queryFn: () => fetchRun(runId),
|
|
1340
|
+
enabled: Boolean(fetchRun && runId),
|
|
1341
|
+
staleTime: Infinity
|
|
1342
|
+
}, queryClient);
|
|
1343
|
+
if (!runId) return null;
|
|
1344
|
+
return query.data;
|
|
1345
|
+
}
|
|
1346
|
+
function useLatestRun(enabled = true) {
|
|
1347
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1348
|
+
const active = enabled && Boolean(service?.latestRun);
|
|
1349
|
+
const query = useQuery({
|
|
1350
|
+
queryKey: runtimeKeys.latestRun(scope, service?.workflowId ?? ""),
|
|
1351
|
+
queryFn: () => service.latestRun(),
|
|
1352
|
+
enabled: active,
|
|
1353
|
+
staleTime: 0
|
|
1354
|
+
}, queryClient);
|
|
1355
|
+
if (!active) return null;
|
|
1356
|
+
if (query.status === "pending") return { kind: "loading" };
|
|
1357
|
+
return {
|
|
1358
|
+
kind: "ready",
|
|
1359
|
+
run: query.data ?? null
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
const SYNC_RETRIES = 5;
|
|
1363
|
+
const SYNC_RETRY_MS = 2e3;
|
|
1364
|
+
function useWebhookEndpoint(enabled) {
|
|
1365
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1366
|
+
const active = enabled && Boolean(service?.webhookEndpoint);
|
|
1367
|
+
const query = useQuery({
|
|
1368
|
+
queryKey: runtimeKeys.webhook(scope, service?.workflowId ?? ""),
|
|
1369
|
+
queryFn: () => service.webhookEndpoint(),
|
|
1370
|
+
enabled: active,
|
|
1371
|
+
staleTime: 0,
|
|
1372
|
+
gcTime: 0,
|
|
1373
|
+
retry: (failures, error) => isSyncingError(error) && failures < SYNC_RETRIES,
|
|
1374
|
+
retryDelay: SYNC_RETRY_MS
|
|
1375
|
+
}, queryClient);
|
|
1376
|
+
if (query.status === "pending" && isSyncingError(query.failureReason)) return { kind: "syncing" };
|
|
1377
|
+
if (query.status === "error") return {
|
|
1378
|
+
kind: "error",
|
|
1379
|
+
message: messageOf(query.error)
|
|
1380
|
+
};
|
|
1381
|
+
if (query.status === "pending") return { kind: "loading" };
|
|
1382
|
+
return query.data ? {
|
|
1383
|
+
kind: "ready",
|
|
1384
|
+
endpoint: query.data
|
|
1385
|
+
} : { kind: "empty" };
|
|
1386
|
+
}
|
|
1387
|
+
function useConnectionList() {
|
|
1388
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1389
|
+
const list = service?.listConnections;
|
|
1390
|
+
const options = {
|
|
1391
|
+
queryKey: runtimeKeys.connections(scope, service?.connectionScope ?? null),
|
|
1392
|
+
queryFn: () => list(),
|
|
1393
|
+
staleTime: 0,
|
|
1394
|
+
gcTime: 0
|
|
1395
|
+
};
|
|
1396
|
+
const query = useQuery({
|
|
1397
|
+
...options,
|
|
1398
|
+
enabled: Boolean(list)
|
|
1399
|
+
}, queryClient);
|
|
1400
|
+
return {
|
|
1401
|
+
connections: query.data ?? [],
|
|
1402
|
+
refetch: () => {
|
|
1403
|
+
if (list) query.refetch();
|
|
1404
|
+
},
|
|
1405
|
+
invalidate: () => void queryClient.invalidateQueries({ queryKey: runtimeKeys.connections(scope) }),
|
|
1406
|
+
fetchNow: () => list ? queryClient.fetchQuery({
|
|
1407
|
+
...options,
|
|
1408
|
+
staleTime: 0
|
|
1409
|
+
}) : Promise.resolve([])
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
function useTestStepRunner() {
|
|
1413
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1414
|
+
const test = service?.testStep;
|
|
1415
|
+
if (!test) return void 0;
|
|
1416
|
+
return (stepId) => test(stepId).finally(() => {
|
|
1417
|
+
for (const queryKey of [
|
|
1418
|
+
runtimeKeys.allRuns(scope),
|
|
1419
|
+
[scope, "latestRun"],
|
|
1420
|
+
runtimeKeys.outputTrees(scope)
|
|
1421
|
+
]) queryClient.invalidateQueries({ queryKey });
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
function useTestTrigger() {
|
|
1425
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1426
|
+
const test = service?.testTrigger;
|
|
1427
|
+
if (!test) return void 0;
|
|
1428
|
+
return () => test().finally(() => void queryClient.invalidateQueries({ queryKey: runtimeKeys.outputTrees(scope) }));
|
|
1429
|
+
}
|
|
1430
|
+
var DraftNotSynced = class extends Error {};
|
|
1431
|
+
const DRAFT_SYNC_RETRIES = 10;
|
|
1432
|
+
/**
|
|
1433
|
+
* The piece version each draft block runs, trigger first; `blocks` is the
|
|
1434
|
+
* draft in that order. Empty outside a runtime, or until the runtime answers.
|
|
1435
|
+
*/
|
|
1436
|
+
function useBlockResolutions(workflowId, blocks) {
|
|
1437
|
+
const { service, queryClient, scope } = useDesignTimeScope();
|
|
1438
|
+
const fetchResolutions = service?.blockResolutions;
|
|
1439
|
+
const expected = blocks.map((entry) => `${entry.id}=${blockRefKey(entry.block)}`);
|
|
1440
|
+
return useQuery({
|
|
1441
|
+
queryKey: runtimeKeys.blockResolutions(scope, workflowId, blocks.map((entry) => entry.block)),
|
|
1442
|
+
queryFn: async () => {
|
|
1443
|
+
const resolutions = await fetchResolutions();
|
|
1444
|
+
if (keyHash(resolutions.map((resolution) => `${resolution.stepId}=${blockRefKey(resolution)}`)) !== keyHash(expected)) throw new DraftNotSynced();
|
|
1445
|
+
return resolutions;
|
|
1446
|
+
},
|
|
1447
|
+
enabled: Boolean(fetchResolutions && workflowId),
|
|
1448
|
+
retry: (count, error) => error instanceof DraftNotSynced && count < DRAFT_SYNC_RETRIES,
|
|
1449
|
+
retryDelay: 300,
|
|
1450
|
+
placeholderData: keepPreviousData,
|
|
1451
|
+
staleTime: 0
|
|
1452
|
+
}, queryClient).data ?? EMPTY_RESOLUTIONS;
|
|
1453
|
+
}
|
|
1454
|
+
const EMPTY_RESOLUTIONS = [];
|
|
1455
|
+
//#endregion
|
|
1456
|
+
//#region editors/workflow-studio/components/run-format.ts
|
|
1457
|
+
const RUN_STATUSES = [
|
|
1458
|
+
"RUNNING",
|
|
1459
|
+
"WAITING",
|
|
1460
|
+
"SUCCEEDED",
|
|
1461
|
+
"FAILED"
|
|
1462
|
+
];
|
|
1463
|
+
const TONE_TEXT = {
|
|
1464
|
+
ok: "text-wf-ok",
|
|
1465
|
+
fail: "text-wf-fail",
|
|
1466
|
+
warn: "text-wf-warn",
|
|
1467
|
+
run: "text-wf-run",
|
|
1468
|
+
idle: "text-muted-foreground"
|
|
1469
|
+
};
|
|
1470
|
+
const TONE_DOT = {
|
|
1471
|
+
ok: "bg-wf-ok",
|
|
1472
|
+
fail: "bg-wf-fail",
|
|
1473
|
+
warn: "bg-wf-warn",
|
|
1474
|
+
run: "bg-wf-run",
|
|
1475
|
+
idle: "bg-muted-foreground/40"
|
|
1476
|
+
};
|
|
1477
|
+
const RUN_TONE = {
|
|
1478
|
+
SUCCEEDED: "ok",
|
|
1479
|
+
FAILED: "fail",
|
|
1480
|
+
RUNNING: "run",
|
|
1481
|
+
WAITING: "warn",
|
|
1482
|
+
PENDING: "idle",
|
|
1483
|
+
PARKED: "warn",
|
|
1484
|
+
CANCELLED: "idle"
|
|
1485
|
+
};
|
|
1486
|
+
const STEP_TONE = {
|
|
1487
|
+
...RUN_TONE,
|
|
1488
|
+
SKIPPED: "idle",
|
|
1489
|
+
REPLAYED: "run",
|
|
1490
|
+
INDETERMINATE: "warn"
|
|
1491
|
+
};
|
|
1492
|
+
function runTone(run) {
|
|
1493
|
+
if (run.status === "SUCCEEDED" && (run.warningNotes?.length ?? 0) > 0) return "warn";
|
|
1494
|
+
return toneOf(RUN_TONE, run.status);
|
|
1495
|
+
}
|
|
1496
|
+
function runStatusLabel(run) {
|
|
1497
|
+
const count = run.warningNotes?.length ?? 0;
|
|
1498
|
+
const label = statusLabel(run.status);
|
|
1499
|
+
if (run.status !== "SUCCEEDED" || count === 0) return label;
|
|
1500
|
+
return `${label}, ${count} ${count === 1 ? "warning" : "warnings"}`;
|
|
1501
|
+
}
|
|
1502
|
+
function workflowHealth(status, lastRunStatus, published) {
|
|
1503
|
+
if (!published) return {
|
|
1504
|
+
tone: "idle",
|
|
1505
|
+
hollow: true,
|
|
1506
|
+
label: "Not published yet"
|
|
1507
|
+
};
|
|
1508
|
+
const label = (status === "ENABLED" ? "" : `${statusLabel(status ?? "DISABLED")}, `) + (lastRunStatus ? `last run ${statusLabel(lastRunStatus).toLowerCase()}` : "not run yet");
|
|
1509
|
+
return {
|
|
1510
|
+
tone: toneOf(RUN_TONE, lastRunStatus),
|
|
1511
|
+
hollow: false,
|
|
1512
|
+
label: label.charAt(0).toUpperCase() + label.slice(1)
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
const CONNECTION_TONE = {
|
|
1516
|
+
OK: "ok",
|
|
1517
|
+
ERROR: "fail",
|
|
1518
|
+
REVOKED: "fail",
|
|
1519
|
+
UNCONFIGURED: "warn"
|
|
1520
|
+
};
|
|
1521
|
+
function toneOf(map, status) {
|
|
1522
|
+
return (status ? map[status] : void 0) ?? "idle";
|
|
1523
|
+
}
|
|
1524
|
+
function statusLabel(status) {
|
|
1525
|
+
return status.charAt(0) + status.slice(1).toLowerCase();
|
|
1526
|
+
}
|
|
1527
|
+
function formatDuration(startedAt, endedAt) {
|
|
1528
|
+
if (!endedAt) return "…";
|
|
1529
|
+
return formatMs(new Date(endedAt).getTime() - new Date(startedAt).getTime());
|
|
1530
|
+
}
|
|
1531
|
+
function runTimeline(run) {
|
|
1532
|
+
const start = new Date(run.startedAt).getTime();
|
|
1533
|
+
const ends = run.steps.map((step) => step.endedAt ? new Date(step.endedAt).getTime() : 0).concat(run.endedAt ? new Date(run.endedAt).getTime() : 0);
|
|
1534
|
+
const total = Math.max(...ends) - start;
|
|
1535
|
+
const spans = /* @__PURE__ */ new Map();
|
|
1536
|
+
if (total <= 0) return spans;
|
|
1537
|
+
for (const step of run.steps) {
|
|
1538
|
+
if (!step.startedAt || !step.endedAt) continue;
|
|
1539
|
+
const from = new Date(step.startedAt).getTime() - start;
|
|
1540
|
+
const ms = new Date(step.endedAt).getTime() - new Date(step.startedAt).getTime();
|
|
1541
|
+
spans.set(step.stepId, {
|
|
1542
|
+
offset: Math.min(Math.max(from / total, 0), 1),
|
|
1543
|
+
width: Math.min(Math.max(ms / total, 0), 1),
|
|
1544
|
+
ms
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
return spans;
|
|
1548
|
+
}
|
|
1549
|
+
function formatMs(ms) {
|
|
1550
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
1551
|
+
const tenths = Math.round(ms / 100);
|
|
1552
|
+
if (tenths < 600) return `${(tenths / 10).toFixed(1)}s`;
|
|
1553
|
+
const seconds = Math.round(ms / 1e3);
|
|
1554
|
+
return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
1555
|
+
}
|
|
1556
|
+
function durationMs(startedAt, endedAt) {
|
|
1557
|
+
if (!endedAt) return null;
|
|
1558
|
+
return new Date(endedAt).getTime() - new Date(startedAt).getTime();
|
|
1559
|
+
}
|
|
1560
|
+
function formatWhen(startedAt) {
|
|
1561
|
+
const diff = Date.now() - new Date(startedAt).getTime();
|
|
1562
|
+
if (diff < 6e4) return "just now";
|
|
1563
|
+
if (diff < 36e5) return `${Math.floor(diff / 6e4)}m ago`;
|
|
1564
|
+
if (diff < 864e5) return `${Math.floor(diff / 36e5)}h ago`;
|
|
1565
|
+
return new Date(startedAt).toLocaleDateString();
|
|
1566
|
+
}
|
|
1567
|
+
function formatUntil(iso) {
|
|
1568
|
+
const diff = new Date(iso).getTime() - Date.now();
|
|
1569
|
+
if (diff <= 0) return null;
|
|
1570
|
+
if (diff < 6e4) return "in under a minute";
|
|
1571
|
+
if (diff < 36e5) return `in ${Math.floor(diff / 6e4)}m`;
|
|
1572
|
+
if (diff < 864e5) return `in ${Math.floor(diff / 36e5)}h`;
|
|
1573
|
+
if (diff < 6048e5) return `in ${Math.floor(diff / 864e5)}d`;
|
|
1574
|
+
return `on ${new Date(iso).toLocaleDateString()}`;
|
|
1575
|
+
}
|
|
1576
|
+
function formatAbsolute(iso) {
|
|
1577
|
+
return new Date(iso).toLocaleString();
|
|
1578
|
+
}
|
|
1579
|
+
function formatTrigger(kind) {
|
|
1580
|
+
return kind.replace(/[-_]/g, " ").toLowerCase();
|
|
1581
|
+
}
|
|
1582
|
+
function runStats(runs) {
|
|
1583
|
+
const succeeded = runs.filter((run) => run.status === "SUCCEEDED").length;
|
|
1584
|
+
const failed = runs.filter((run) => run.status === "FAILED").length;
|
|
1585
|
+
const finished = succeeded + failed;
|
|
1586
|
+
return {
|
|
1587
|
+
total: runs.length,
|
|
1588
|
+
succeeded,
|
|
1589
|
+
failed,
|
|
1590
|
+
running: runs.filter((run) => run.status === "RUNNING").length,
|
|
1591
|
+
lastRun: runs[0],
|
|
1592
|
+
successRate: finished === 0 ? null : Math.round(succeeded / finished * 100)
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
const RUN_DEADLINE_ERROR_NAME = "RunDeadlineExceeded";
|
|
1596
|
+
function canRerun(run) {
|
|
1597
|
+
return run.status === "FAILED" || run.status === "CANCELLED" && run.errorName === RUN_DEADLINE_ERROR_NAME;
|
|
1598
|
+
}
|
|
1599
|
+
//#endregion
|
|
1600
|
+
//#region editors/workflow-editor/ui/block-meta.ts
|
|
1601
|
+
const CORE_META = {
|
|
1602
|
+
[blockKey(MANUAL_TRIGGER)]: {
|
|
1603
|
+
displayName: "Manual",
|
|
1604
|
+
subtitle: "Trigger",
|
|
1605
|
+
glyph: "▶"
|
|
1606
|
+
},
|
|
1607
|
+
[blockKey(SCHEDULE_TRIGGER)]: {
|
|
1608
|
+
displayName: "Schedule",
|
|
1609
|
+
subtitle: "Trigger",
|
|
1610
|
+
glyph: "◷"
|
|
1611
|
+
},
|
|
1612
|
+
[blockKey(WEBHOOK_TRIGGER)]: {
|
|
1613
|
+
displayName: "Webhook",
|
|
1614
|
+
subtitle: "Trigger",
|
|
1615
|
+
glyph: "⇲"
|
|
1616
|
+
},
|
|
1617
|
+
[blockKey(BRANCH_BLOCK)]: {
|
|
1618
|
+
displayName: "Branch",
|
|
1619
|
+
subtitle: "Core",
|
|
1620
|
+
glyph: "⑂"
|
|
1621
|
+
},
|
|
1622
|
+
[blockKey(ROUTER_BLOCK)]: {
|
|
1623
|
+
displayName: "Router",
|
|
1624
|
+
subtitle: "Core",
|
|
1625
|
+
glyph: "⑃"
|
|
1626
|
+
},
|
|
1627
|
+
[blockKey(LOOP_BLOCK)]: {
|
|
1628
|
+
displayName: "Loop on items",
|
|
1629
|
+
subtitle: "Core",
|
|
1630
|
+
glyph: "↻"
|
|
1631
|
+
},
|
|
1632
|
+
[blockKey(ASSERT_BLOCK)]: {
|
|
1633
|
+
displayName: "Assert",
|
|
1634
|
+
subtitle: "Core",
|
|
1635
|
+
glyph: "!"
|
|
1636
|
+
},
|
|
1637
|
+
[blockKey(DELAY_BLOCK)]: {
|
|
1638
|
+
displayName: "Delay",
|
|
1639
|
+
subtitle: "Core",
|
|
1640
|
+
glyph: "⧗"
|
|
1641
|
+
},
|
|
1642
|
+
[blockKey(APPROVAL_BLOCK)]: {
|
|
1643
|
+
displayName: "Request approval",
|
|
1644
|
+
subtitle: "Core",
|
|
1645
|
+
glyph: "✓"
|
|
1646
|
+
},
|
|
1647
|
+
[blockKey(STOP_BLOCK)]: {
|
|
1648
|
+
displayName: "Stop run",
|
|
1649
|
+
subtitle: "Core",
|
|
1650
|
+
glyph: "■"
|
|
1651
|
+
},
|
|
1652
|
+
[blockKey(WAIT_FOR_WEBHOOK_BLOCK)]: {
|
|
1653
|
+
displayName: "Respond and wait for webhook",
|
|
1654
|
+
subtitle: "Core",
|
|
1655
|
+
glyph: "⇄"
|
|
1656
|
+
},
|
|
1657
|
+
[blockKey(CALLABLE_FLOW_TRIGGER$1)]: {
|
|
1658
|
+
displayName: "Callable workflow",
|
|
1659
|
+
subtitle: "Trigger",
|
|
1660
|
+
glyph: "↳"
|
|
1661
|
+
},
|
|
1662
|
+
[blockKey(CALL_FLOW_BLOCK)]: {
|
|
1663
|
+
displayName: "Call workflow",
|
|
1664
|
+
subtitle: "Core",
|
|
1665
|
+
glyph: "↳"
|
|
1666
|
+
},
|
|
1667
|
+
[blockKey(RETURN_RESPONSE_BLOCK)]: {
|
|
1668
|
+
displayName: "Return response",
|
|
1669
|
+
subtitle: "Core",
|
|
1670
|
+
glyph: "↩"
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
function shortPieceName(packageName) {
|
|
1674
|
+
return packageName.split("/").pop()?.replace(/^piece-/, "") ?? "";
|
|
1675
|
+
}
|
|
1676
|
+
const pieceLogos = /* @__PURE__ */ new Map();
|
|
1677
|
+
const pieceNames = /* @__PURE__ */ new Map();
|
|
1678
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1679
|
+
let logoRevision = 0;
|
|
1680
|
+
function registerPieceLogos(entries) {
|
|
1681
|
+
let changed = false;
|
|
1682
|
+
for (const entry of entries) {
|
|
1683
|
+
if (!entry.name) continue;
|
|
1684
|
+
if (entry.displayName && pieceNames.get(entry.name) !== entry.displayName) {
|
|
1685
|
+
pieceNames.set(entry.name, entry.displayName);
|
|
1686
|
+
changed = true;
|
|
1687
|
+
}
|
|
1688
|
+
if (!entry.logoUrl || pieceLogos.get(entry.name) === entry.logoUrl) continue;
|
|
1689
|
+
pieceLogos.set(entry.name, entry.logoUrl);
|
|
1690
|
+
changed = true;
|
|
1691
|
+
}
|
|
1692
|
+
if (!changed) return;
|
|
1693
|
+
logoRevision += 1;
|
|
1694
|
+
for (const listener of listeners) listener();
|
|
1695
|
+
}
|
|
1696
|
+
function pieceLogo(packageName) {
|
|
1697
|
+
return pieceLogos.get(packageName);
|
|
1698
|
+
}
|
|
1699
|
+
function pieceDisplayName(packageName) {
|
|
1700
|
+
return pieceNames.get(packageName);
|
|
1701
|
+
}
|
|
1702
|
+
const blockNames = /* @__PURE__ */ new Map();
|
|
1703
|
+
const namesRequested = /* @__PURE__ */ new Set();
|
|
1704
|
+
const namesPending = /* @__PURE__ */ new Set();
|
|
1705
|
+
function registerBlockNames(entries) {
|
|
1706
|
+
let changed = false;
|
|
1707
|
+
for (const entry of entries) {
|
|
1708
|
+
const key = blockKey(entry);
|
|
1709
|
+
if (!entry.displayName || blockNames.get(key) === entry.displayName) continue;
|
|
1710
|
+
blockNames.set(key, entry.displayName);
|
|
1711
|
+
changed = true;
|
|
1712
|
+
}
|
|
1713
|
+
if (!changed) return;
|
|
1714
|
+
logoRevision += 1;
|
|
1715
|
+
for (const listener of listeners) listener();
|
|
1716
|
+
}
|
|
1717
|
+
function requestBlockNames(packageName) {
|
|
1718
|
+
if (!namesRequested.has(packageName)) namesPending.add(packageName);
|
|
1719
|
+
}
|
|
1720
|
+
function loadPendingBlockNames(source) {
|
|
1721
|
+
for (const packageName of namesPending) loadBlockNames(source, packageName);
|
|
1722
|
+
namesPending.clear();
|
|
1723
|
+
}
|
|
1724
|
+
function loadBlockNames(source, packageName) {
|
|
1725
|
+
if (namesRequested.has(packageName)) return;
|
|
1726
|
+
namesRequested.add(packageName);
|
|
1727
|
+
Promise.all([source.loadActions(packageName), source.loadTriggers(packageName)]).then(([actions, triggers]) => registerBlockNames([...actions.map((entry) => ({
|
|
1728
|
+
...entry,
|
|
1729
|
+
kind: "action"
|
|
1730
|
+
})), ...triggers.map((entry) => ({
|
|
1731
|
+
...entry,
|
|
1732
|
+
kind: "trigger"
|
|
1733
|
+
}))])).catch(() => namesRequested.delete(packageName));
|
|
1734
|
+
}
|
|
1735
|
+
function subscribePieceLogos(listener) {
|
|
1736
|
+
listeners.add(listener);
|
|
1737
|
+
return () => listeners.delete(listener);
|
|
1738
|
+
}
|
|
1739
|
+
function pieceLogoRevision() {
|
|
1740
|
+
return logoRevision;
|
|
1741
|
+
}
|
|
1742
|
+
const logoMisses = /* @__PURE__ */ new Set();
|
|
1743
|
+
let catalogLoads = /* @__PURE__ */ new WeakMap();
|
|
1744
|
+
const retryTimers = /* @__PURE__ */ new Set();
|
|
1745
|
+
const CATALOG_RETRY_MS = 2e3;
|
|
1746
|
+
function notify() {
|
|
1747
|
+
logoRevision += 1;
|
|
1748
|
+
for (const listener of listeners) listener();
|
|
1749
|
+
}
|
|
1750
|
+
function scheduleRetry(state) {
|
|
1751
|
+
if (state.attempts >= 5) return;
|
|
1752
|
+
const timer = setTimeout(() => {
|
|
1753
|
+
retryTimers.delete(timer);
|
|
1754
|
+
state.load = void 0;
|
|
1755
|
+
notify();
|
|
1756
|
+
}, CATALOG_RETRY_MS * 2 ** (state.attempts - 1));
|
|
1757
|
+
retryTimers.add(timer);
|
|
1758
|
+
}
|
|
1759
|
+
function ensurePieceLogos(source) {
|
|
1760
|
+
if (!source) return Promise.resolve();
|
|
1761
|
+
let state = catalogLoads.get(source);
|
|
1762
|
+
if (!state) {
|
|
1763
|
+
state = { attempts: 0 };
|
|
1764
|
+
catalogLoads.set(source, state);
|
|
1765
|
+
}
|
|
1766
|
+
if (state.load) return state.load;
|
|
1767
|
+
const current = state;
|
|
1768
|
+
const request = current.attempts > 0 && source.reloadCatalog ? source.reloadCatalog() : source.loadCatalog();
|
|
1769
|
+
current.attempts += 1;
|
|
1770
|
+
current.load = request.then((pieces) => {
|
|
1771
|
+
registerPieceLogos(pieces);
|
|
1772
|
+
const listed = new Set(pieces.map((piece) => piece.name));
|
|
1773
|
+
if ([...logoMisses].some((name) => !listed.has(name) && !pieceLogos.has(name))) scheduleRetry(current);
|
|
1774
|
+
}, () => scheduleRetry(current));
|
|
1775
|
+
return current.load;
|
|
1776
|
+
}
|
|
1777
|
+
function namedByCoreTab(block) {
|
|
1778
|
+
return !isCoreBlock(block) && blockKey(block) in CORE_META;
|
|
1779
|
+
}
|
|
1780
|
+
function blockMeta(block) {
|
|
1781
|
+
const key = blockKey(block);
|
|
1782
|
+
const core = CORE_META[key];
|
|
1783
|
+
if (core) return core;
|
|
1784
|
+
if (isCoreBlock(block)) return {
|
|
1785
|
+
displayName: titleCase(block.name),
|
|
1786
|
+
subtitle: "Core",
|
|
1787
|
+
glyph: "?"
|
|
1788
|
+
};
|
|
1789
|
+
const packageName = block.pieceName;
|
|
1790
|
+
const short = shortPieceName(packageName);
|
|
1791
|
+
const pieceLabel = pieceNames.get(packageName) ?? titleCase(short);
|
|
1792
|
+
const known = blockNames.get(key);
|
|
1793
|
+
if (!known) requestBlockNames(packageName);
|
|
1794
|
+
const logoUrl = pieceLogo(packageName);
|
|
1795
|
+
if (!logoUrl) logoMisses.add(packageName);
|
|
1796
|
+
return {
|
|
1797
|
+
displayName: known ?? titleCase(block.name),
|
|
1798
|
+
subtitle: block.kind === "trigger" ? `${pieceLabel} · Trigger` : pieceLabel,
|
|
1799
|
+
logoUrl,
|
|
1800
|
+
glyph: short.slice(0, 1).toUpperCase() || "?"
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
function stepSubtitle(meta, maxChars = 26) {
|
|
1804
|
+
if (meta.subtitle === "Core") return meta.displayName;
|
|
1805
|
+
const both = `${meta.subtitle} · ${meta.displayName}`;
|
|
1806
|
+
return both.length <= maxChars ? both : meta.displayName;
|
|
1807
|
+
}
|
|
1808
|
+
function titleCase(value) {
|
|
1809
|
+
return value.replaceAll(/[-_]/g, " ").replace(/^\w/, (char) => char.toUpperCase());
|
|
1810
|
+
}
|
|
1811
|
+
function usePieceLogos() {
|
|
1812
|
+
const source = usePieceSource();
|
|
1813
|
+
const revision = useSyncExternalStore(subscribePieceLogos, pieceLogoRevision, pieceLogoRevision);
|
|
1814
|
+
useEffect(() => {
|
|
1815
|
+
ensurePieceLogos(source);
|
|
1816
|
+
if (source && namesPending.size > 0) loadPendingBlockNames(source);
|
|
1817
|
+
});
|
|
1818
|
+
return revision;
|
|
1819
|
+
}
|
|
1820
|
+
function useBlockMeta(block) {
|
|
1821
|
+
usePieceLogos();
|
|
1822
|
+
return blockMeta(block);
|
|
1823
|
+
}
|
|
1824
|
+
//#endregion
|
|
1825
|
+
//#region editors/workflow-editor/ui/version-badge.tsx
|
|
1826
|
+
function resolutionText(resolution) {
|
|
1827
|
+
if (resolution.note) return resolution.note;
|
|
1828
|
+
if (!resolution.resolvedVersion) return `Nothing resolves ${resolution.pieceName} ${resolution.kind} "${resolution.name}"`;
|
|
1829
|
+
const from = resolution.source ? ` from ${resolution.source}` : "";
|
|
1830
|
+
return `Configured with v${resolution.pieceVersion}, runs v${resolution.resolvedVersion}${from}`;
|
|
1831
|
+
}
|
|
1832
|
+
function runsDifferentVersion(resolution) {
|
|
1833
|
+
switch (resolution.match) {
|
|
1834
|
+
case "exact": return false;
|
|
1835
|
+
case "installed": return resolution.resolvedVersion !== resolution.pieceVersion;
|
|
1836
|
+
default: return true;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function versionBadge(resolution) {
|
|
1840
|
+
if (!resolution || !runsDifferentVersion(resolution)) return null;
|
|
1841
|
+
const title = resolutionText(resolution);
|
|
1842
|
+
if (resolution.match === "missing") return {
|
|
1843
|
+
tone: "fail",
|
|
1844
|
+
label: "Missing",
|
|
1845
|
+
title
|
|
1846
|
+
};
|
|
1847
|
+
return {
|
|
1848
|
+
tone: resolution.match === "fallback" ? "warn" : "neutral",
|
|
1849
|
+
label: `v${resolution.resolvedVersion}`,
|
|
1850
|
+
title
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
/** The newer version to offer, when a source has one above the pin. */
|
|
1854
|
+
function updateVersion(resolution) {
|
|
1855
|
+
const { pieceVersion, latestVersion } = resolution ?? {};
|
|
1856
|
+
if (!pieceVersion || !latestVersion) return null;
|
|
1857
|
+
try {
|
|
1858
|
+
return compareVersions(latestVersion, pieceVersion) > 0 ? latestVersion : null;
|
|
1859
|
+
} catch {
|
|
1860
|
+
return null;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
const ResolutionsContext = createContext([]);
|
|
1864
|
+
const DraftBlocksContext = createContext([]);
|
|
1865
|
+
function BlockResolutionsProvider(props) {
|
|
1866
|
+
return /* @__PURE__ */ jsx(DraftBlocksContext.Provider, {
|
|
1867
|
+
value: props.blocks,
|
|
1868
|
+
children: /* @__PURE__ */ jsx(ResolutionsContext.Provider, {
|
|
1869
|
+
value: props.resolutions,
|
|
1870
|
+
children: props.children
|
|
1871
|
+
})
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
function useDraftBlocks() {
|
|
1875
|
+
return useContext(DraftBlocksContext);
|
|
1876
|
+
}
|
|
1877
|
+
function useResolution(id, block) {
|
|
1878
|
+
return useContext(ResolutionsContext).find((entry) => entry.stepId === id && entry.pieceName === block.pieceName && entry.pieceVersion === block.pieceVersion && entry.kind === block.kind && entry.name === block.name);
|
|
1879
|
+
}
|
|
1880
|
+
const SUMMARY_TONE = {
|
|
1881
|
+
neutral: "text-muted-foreground hover:text-foreground",
|
|
1882
|
+
warn: "text-wf-warn"
|
|
1883
|
+
};
|
|
1884
|
+
function versionSummary(resolutions) {
|
|
1885
|
+
const differing = resolutions.filter(runsDifferentVersion);
|
|
1886
|
+
if (differing.length === 0) return null;
|
|
1887
|
+
const missing = differing.filter((entry) => entry.match === "missing");
|
|
1888
|
+
const count = missing.length > 0 ? missing.length : differing.length;
|
|
1889
|
+
const noun = count === 1 ? "step" : "steps";
|
|
1890
|
+
return {
|
|
1891
|
+
text: missing.length > 0 ? `${count} ${noun} can't find ${count === 1 ? "its" : "their"} piece` : `${count} ${noun} ${count === 1 ? "runs" : "run"} a different piece version`,
|
|
1892
|
+
tone: differing.some((entry) => entry.match === "fallback" || entry.match === "missing") ? "warn" : "neutral",
|
|
1893
|
+
title: differing.map(resolutionText).join("\n"),
|
|
1894
|
+
firstStepId: (missing.length > 0 ? missing : differing)[0].stepId
|
|
1895
|
+
};
|
|
1896
|
+
}
|
|
1897
|
+
function VersionSummary(props) {
|
|
1898
|
+
const summary = versionSummary(props.resolutions);
|
|
1899
|
+
if (!summary) return null;
|
|
1900
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1901
|
+
type: "button",
|
|
1902
|
+
"data-tone": summary.tone,
|
|
1903
|
+
className: `truncate text-xs underline-offset-2 hover:underline ${SUMMARY_TONE[summary.tone]}`,
|
|
1904
|
+
title: summary.title,
|
|
1905
|
+
onClick: () => props.onSelect(summary.firstStepId),
|
|
1906
|
+
children: summary.text
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
//#endregion
|
|
1910
|
+
//#region editors/workflow-editor/ui/picker-placement.ts
|
|
1911
|
+
const MARGIN = 8;
|
|
1912
|
+
const GAP = 6;
|
|
1913
|
+
const MIN_HEIGHT = 240;
|
|
1914
|
+
function pickerPlacement(anchor, size, viewport) {
|
|
1915
|
+
const width = Math.min(size.width, viewport.width - 16);
|
|
1916
|
+
const below = viewport.height - anchor.bottom - GAP - MARGIN;
|
|
1917
|
+
const above = anchor.top - GAP - MARGIN;
|
|
1918
|
+
const downward = below >= Math.min(size.height, MIN_HEIGHT) || below >= above;
|
|
1919
|
+
const height = Math.max(Math.min(size.height, downward ? below : above), Math.min(size.height, MIN_HEIGHT));
|
|
1920
|
+
const centre = (anchor.left + anchor.right) / 2;
|
|
1921
|
+
const left = Math.min(Math.max(centre - width / 2, MARGIN), viewport.width - width - MARGIN);
|
|
1922
|
+
const top = downward ? Math.min(anchor.bottom + GAP, viewport.height - height - MARGIN) : Math.max(anchor.top - GAP - height, MARGIN);
|
|
1923
|
+
return {
|
|
1924
|
+
left,
|
|
1925
|
+
top: Math.max(top, MARGIN),
|
|
1926
|
+
width,
|
|
1927
|
+
height,
|
|
1928
|
+
above: !downward
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
//#endregion
|
|
1932
|
+
//#region editors/workflow-editor/ui/PickerPopover.tsx
|
|
1933
|
+
const PICKER_SIZE = {
|
|
1934
|
+
width: 640,
|
|
1935
|
+
height: 480
|
|
1936
|
+
};
|
|
1937
|
+
function PickerPopover(props) {
|
|
1938
|
+
const [placement, setPlacement] = useState(null);
|
|
1939
|
+
const { anchor, onClose } = props;
|
|
1940
|
+
useLayoutEffect(() => {
|
|
1941
|
+
const place = () => {
|
|
1942
|
+
const rect = anchor.current?.getBoundingClientRect();
|
|
1943
|
+
if (!rect) return;
|
|
1944
|
+
setPlacement(pickerPlacement(rect, PICKER_SIZE, {
|
|
1945
|
+
width: window.innerWidth,
|
|
1946
|
+
height: window.innerHeight
|
|
1947
|
+
}));
|
|
1948
|
+
};
|
|
1949
|
+
place();
|
|
1950
|
+
const onWheel = (event) => {
|
|
1951
|
+
const target = event.target;
|
|
1952
|
+
if (!(target instanceof Element && target.closest("[data-selector-open]"))) onClose();
|
|
1953
|
+
};
|
|
1954
|
+
window.addEventListener("resize", onClose);
|
|
1955
|
+
window.addEventListener("wheel", onWheel, {
|
|
1956
|
+
capture: true,
|
|
1957
|
+
passive: true
|
|
1958
|
+
});
|
|
1959
|
+
return () => {
|
|
1960
|
+
window.removeEventListener("resize", onClose);
|
|
1961
|
+
window.removeEventListener("wheel", onWheel, { capture: true });
|
|
1962
|
+
};
|
|
1963
|
+
}, [anchor, onClose]);
|
|
1964
|
+
const host = anchor.current?.closest(".react-flow")?.parentElement ?? document.body;
|
|
1965
|
+
if (!placement) return null;
|
|
1966
|
+
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
1967
|
+
"data-selector-open": "true",
|
|
1968
|
+
className: "nodrag nopan nowheel fixed z-50 motion-safe:animate-[wf-picker-in_120ms_ease-out]",
|
|
1969
|
+
style: placement.above ? {
|
|
1970
|
+
left: placement.left,
|
|
1971
|
+
bottom: window.innerHeight - placement.top - placement.height,
|
|
1972
|
+
transformOrigin: "bottom center"
|
|
1973
|
+
} : {
|
|
1974
|
+
left: placement.left,
|
|
1975
|
+
top: placement.top,
|
|
1976
|
+
transformOrigin: "top center"
|
|
1977
|
+
},
|
|
1978
|
+
children: props.children(placement)
|
|
1979
|
+
}), host);
|
|
1980
|
+
}
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region editors/workflow-editor/ui/picker-recent.ts
|
|
1983
|
+
const STORAGE_KEY = "ph-workflow-picker-recent:v1";
|
|
1984
|
+
const MAX_RECENT = 6;
|
|
1985
|
+
function isStoredPick(value) {
|
|
1986
|
+
const entry = value;
|
|
1987
|
+
const block = entry?.block;
|
|
1988
|
+
return typeof entry?.label === "string" && typeof block?.pieceName === "string" && typeof block.name === "string" && (block.kind === "action" || block.kind === "trigger");
|
|
1989
|
+
}
|
|
1990
|
+
function readAll() {
|
|
1991
|
+
try {
|
|
1992
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
1993
|
+
const parsed = raw ? JSON.parse(raw) : [];
|
|
1994
|
+
return Array.isArray(parsed) ? parsed.filter(isStoredPick) : [];
|
|
1995
|
+
} catch {
|
|
1996
|
+
return [];
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
function recentPicks(kind) {
|
|
2000
|
+
return readAll().filter((entry) => entry.block.kind === kind).map((entry) => ({
|
|
2001
|
+
label: entry.label,
|
|
2002
|
+
description: entry.description ?? "",
|
|
2003
|
+
block: entry.block,
|
|
2004
|
+
defaultConfig: {}
|
|
2005
|
+
}));
|
|
2006
|
+
}
|
|
2007
|
+
function rememberPick(preset) {
|
|
2008
|
+
const { pieceName, kind, name } = preset.block;
|
|
2009
|
+
const entry = {
|
|
2010
|
+
label: preset.label,
|
|
2011
|
+
description: preset.description,
|
|
2012
|
+
block: {
|
|
2013
|
+
pieceName,
|
|
2014
|
+
kind,
|
|
2015
|
+
name
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
const same = (other) => other.block.pieceName === pieceName && other.block.kind === kind && other.block.name === name;
|
|
2019
|
+
const all = readAll();
|
|
2020
|
+
const ofKind = all.filter((other) => other.block.kind === kind);
|
|
2021
|
+
const others = all.filter((other) => other.block.kind !== kind);
|
|
2022
|
+
const next = [entry, ...ofKind.filter((other) => !same(other))].slice(0, MAX_RECENT);
|
|
2023
|
+
try {
|
|
2024
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify([...next, ...others]));
|
|
2025
|
+
} catch {}
|
|
2026
|
+
}
|
|
2027
|
+
//#endregion
|
|
2028
|
+
//#region editors/workflow-editor/ui/VirtualList.tsx
|
|
2029
|
+
const OVERSCAN = 6;
|
|
2030
|
+
function rowOffsets(heights) {
|
|
2031
|
+
const offsets = [0];
|
|
2032
|
+
for (const height of heights) offsets.push(offsets.at(-1) + height);
|
|
2033
|
+
return offsets;
|
|
2034
|
+
}
|
|
2035
|
+
function visibleRange(offsets, scrollTop, height, overscan = OVERSCAN) {
|
|
2036
|
+
const count = offsets.length - 1;
|
|
2037
|
+
let start = 0;
|
|
2038
|
+
while (start < count && offsets[start + 1] <= scrollTop) start++;
|
|
2039
|
+
let end = start;
|
|
2040
|
+
while (end < count && offsets[end] < scrollTop + height) end++;
|
|
2041
|
+
return [Math.max(0, start - overscan), Math.min(count, end + overscan)];
|
|
2042
|
+
}
|
|
2043
|
+
function VirtualList(props) {
|
|
2044
|
+
const ref = useRef(null);
|
|
2045
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
2046
|
+
const [height, setHeight] = useState(400);
|
|
2047
|
+
const offsets = useMemo(() => rowOffsets(props.items.map(props.heightOf)), [props.items, props.heightOf]);
|
|
2048
|
+
useLayoutEffect(() => {
|
|
2049
|
+
const element = ref.current;
|
|
2050
|
+
if (!element) return;
|
|
2051
|
+
const observer = new ResizeObserver(() => setHeight(element.clientHeight));
|
|
2052
|
+
observer.observe(element);
|
|
2053
|
+
setHeight(element.clientHeight);
|
|
2054
|
+
return () => observer.disconnect();
|
|
2055
|
+
}, []);
|
|
2056
|
+
useEffect(() => {
|
|
2057
|
+
if (ref.current) ref.current.scrollTop = 0;
|
|
2058
|
+
}, [props.resetKey]);
|
|
2059
|
+
useEffect(() => {
|
|
2060
|
+
const element = ref.current;
|
|
2061
|
+
const index = props.activeIndex;
|
|
2062
|
+
if (!element || index === void 0 || index < 0) return;
|
|
2063
|
+
const top = offsets.at(index);
|
|
2064
|
+
const bottom = offsets.at(index + 1);
|
|
2065
|
+
if (top === void 0 || bottom === void 0) return;
|
|
2066
|
+
if (top < element.scrollTop) element.scrollTop = top;
|
|
2067
|
+
else if (bottom > element.scrollTop + element.clientHeight) element.scrollTop = bottom - element.clientHeight;
|
|
2068
|
+
}, [props.activeIndex, offsets]);
|
|
2069
|
+
const [start, end] = visibleRange(offsets, scrollTop, height);
|
|
2070
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2071
|
+
ref,
|
|
2072
|
+
id: props.id,
|
|
2073
|
+
role: "listbox",
|
|
2074
|
+
"aria-label": props.label,
|
|
2075
|
+
className: `min-h-0 overflow-y-auto ${props.className ?? ""}`,
|
|
2076
|
+
onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
|
|
2077
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2078
|
+
role: "presentation",
|
|
2079
|
+
style: {
|
|
2080
|
+
height: offsets.at(-1),
|
|
2081
|
+
position: "relative"
|
|
2082
|
+
},
|
|
2083
|
+
children: props.items.slice(start, end).map((item, i) => {
|
|
2084
|
+
const index = start + i;
|
|
2085
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2086
|
+
role: "presentation",
|
|
2087
|
+
style: {
|
|
2088
|
+
position: "absolute",
|
|
2089
|
+
top: offsets[index],
|
|
2090
|
+
left: 0,
|
|
2091
|
+
right: 0,
|
|
2092
|
+
height: offsets[index + 1] - offsets[index]
|
|
2093
|
+
},
|
|
2094
|
+
children: props.render(item, index)
|
|
2095
|
+
}, props.keyOf(item, index));
|
|
2096
|
+
})
|
|
2097
|
+
})
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
//#endregion
|
|
2101
|
+
//#region editors/workflow-editor/ui/BlockSelector.tsx
|
|
2102
|
+
const ROW_LOGO = 24;
|
|
2103
|
+
const CORE_TILE = {
|
|
2104
|
+
[blockKey(MANUAL_TRIGGER)]: {
|
|
2105
|
+
icon: "play",
|
|
2106
|
+
color: "#2563eb"
|
|
2107
|
+
},
|
|
2108
|
+
[blockKey(SCHEDULE_TRIGGER)]: {
|
|
2109
|
+
icon: "clock",
|
|
2110
|
+
color: "#7c3aed"
|
|
2111
|
+
},
|
|
2112
|
+
[blockKey(WEBHOOK_TRIGGER)]: {
|
|
2113
|
+
icon: "bolt",
|
|
2114
|
+
color: "#0891b2"
|
|
2115
|
+
},
|
|
2116
|
+
[blockKey(BRANCH_BLOCK)]: {
|
|
2117
|
+
icon: "branch",
|
|
2118
|
+
color: "#d97706"
|
|
2119
|
+
},
|
|
2120
|
+
[blockKey(ROUTER_BLOCK)]: {
|
|
2121
|
+
icon: "route",
|
|
2122
|
+
color: "#ea580c"
|
|
2123
|
+
},
|
|
2124
|
+
[blockKey(LOOP_BLOCK)]: {
|
|
2125
|
+
icon: "loop",
|
|
2126
|
+
color: "#7c3aed"
|
|
2127
|
+
},
|
|
2128
|
+
[blockKey(ASSERT_BLOCK)]: {
|
|
2129
|
+
icon: "alert",
|
|
2130
|
+
color: "#dc2626"
|
|
2131
|
+
},
|
|
2132
|
+
[blockKey(DELAY_BLOCK)]: {
|
|
2133
|
+
icon: "clock",
|
|
2134
|
+
color: "#0d9488"
|
|
2135
|
+
},
|
|
2136
|
+
[blockKey(APPROVAL_BLOCK)]: {
|
|
2137
|
+
icon: "check",
|
|
2138
|
+
color: "#16a34a"
|
|
2139
|
+
},
|
|
2140
|
+
[blockKey(STOP_BLOCK)]: {
|
|
2141
|
+
icon: "stop",
|
|
2142
|
+
color: "#475569"
|
|
2143
|
+
},
|
|
2144
|
+
[blockKey(WAIT_FOR_WEBHOOK_BLOCK)]: {
|
|
2145
|
+
icon: "link",
|
|
2146
|
+
color: "#0891b2"
|
|
2147
|
+
},
|
|
2148
|
+
[blockKey(CALLABLE_FLOW_TRIGGER$1)]: {
|
|
2149
|
+
icon: "subflow",
|
|
2150
|
+
color: "#4f46e5"
|
|
2151
|
+
},
|
|
2152
|
+
[blockKey(CALL_FLOW_BLOCK)]: {
|
|
2153
|
+
icon: "subflow",
|
|
2154
|
+
color: "#4f46e5"
|
|
2155
|
+
},
|
|
2156
|
+
[blockKey(RETURN_RESPONSE_BLOCK)]: {
|
|
2157
|
+
icon: "reply",
|
|
2158
|
+
color: "#4f46e5"
|
|
2159
|
+
}
|
|
2160
|
+
};
|
|
2161
|
+
function CoreTile(props) {
|
|
2162
|
+
const tile = props.tile;
|
|
2163
|
+
const glyph = Math.round(props.size * (props.bare ? .9 : .55));
|
|
2164
|
+
if (props.bare) return /* @__PURE__ */ jsx("span", {
|
|
2165
|
+
className: "flex shrink-0 items-center justify-center",
|
|
2166
|
+
style: {
|
|
2167
|
+
width: props.size,
|
|
2168
|
+
height: props.size,
|
|
2169
|
+
color: tile.color
|
|
2170
|
+
},
|
|
2171
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
2172
|
+
name: tile.icon,
|
|
2173
|
+
size: glyph
|
|
2174
|
+
})
|
|
2175
|
+
});
|
|
2176
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2177
|
+
className: "flex shrink-0 items-center justify-center rounded-[22%] text-white",
|
|
2178
|
+
style: {
|
|
2179
|
+
width: props.size,
|
|
2180
|
+
height: props.size,
|
|
2181
|
+
backgroundColor: tile.color
|
|
2182
|
+
},
|
|
2183
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
2184
|
+
name: tile.icon,
|
|
2185
|
+
size: glyph
|
|
2186
|
+
})
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
function BlockLogo(props) {
|
|
2190
|
+
const meta = useBlockMeta(props.block);
|
|
2191
|
+
const tile = CORE_TILE[blockKey(props.block)];
|
|
2192
|
+
if (tile) return /* @__PURE__ */ jsx(CoreTile, {
|
|
2193
|
+
tile,
|
|
2194
|
+
size: props.size ?? 36,
|
|
2195
|
+
bare: props.bare
|
|
2196
|
+
});
|
|
2197
|
+
return /* @__PURE__ */ jsx(LogoFrame, {
|
|
2198
|
+
src: meta.logoUrl,
|
|
2199
|
+
alt: meta.displayName,
|
|
2200
|
+
size: props.size ?? 36,
|
|
2201
|
+
glyph: meta.glyph,
|
|
2202
|
+
bare: props.bare
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
function GlyphBadge(props) {
|
|
2206
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2207
|
+
className: "flex shrink-0 items-center justify-center rounded-sm border border-solid border-foreground/10 bg-muted/50 text-muted-foreground",
|
|
2208
|
+
style: {
|
|
2209
|
+
width: props.size,
|
|
2210
|
+
height: props.size,
|
|
2211
|
+
fontSize: props.size / 2
|
|
2212
|
+
},
|
|
2213
|
+
children: props.glyph ?? "?"
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
function LogoFrame(props) {
|
|
2217
|
+
const [broken, setBroken] = useState(false);
|
|
2218
|
+
useEffect(() => {
|
|
2219
|
+
setBroken(false);
|
|
2220
|
+
}, [props.src]);
|
|
2221
|
+
if (!props.src || broken) return /* @__PURE__ */ jsx(GlyphBadge, {
|
|
2222
|
+
glyph: props.glyph,
|
|
2223
|
+
size: props.size
|
|
2224
|
+
});
|
|
2225
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2226
|
+
className: `flex shrink-0 items-center justify-center ${props.bare ? "" : "dark:rounded-[22%] dark:bg-white dark:p-[var(--logo-pad)]"}`,
|
|
2227
|
+
style: {
|
|
2228
|
+
width: props.size,
|
|
2229
|
+
height: props.size,
|
|
2230
|
+
"--logo-pad": `${Math.round(props.size * .12)}px`
|
|
2231
|
+
},
|
|
2232
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
2233
|
+
src: props.src,
|
|
2234
|
+
alt: props.alt,
|
|
2235
|
+
className: "h-full w-full object-contain drop-shadow-sm",
|
|
2236
|
+
onError: () => setBroken(true)
|
|
2237
|
+
})
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
function Row(props) {
|
|
2241
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2242
|
+
...optionAttributes(props.option),
|
|
2243
|
+
role: "option",
|
|
2244
|
+
"aria-selected": (props.active ?? false) || (props.selected ?? false),
|
|
2245
|
+
"aria-disabled": props.disabled,
|
|
2246
|
+
className: `group mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(props.active, props.selected)} ${props.disabled ? "cursor-not-allowed opacity-50" : ""}`,
|
|
2247
|
+
title: props.title,
|
|
2248
|
+
onClick: props.disabled ? void 0 : props.onClick,
|
|
2249
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2250
|
+
onMouseEnter: props.onHover,
|
|
2251
|
+
children: [
|
|
2252
|
+
/* @__PURE__ */ jsx("span", {
|
|
2253
|
+
"aria-hidden": "true",
|
|
2254
|
+
className: "contents",
|
|
2255
|
+
children: props.logo
|
|
2256
|
+
}),
|
|
2257
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2258
|
+
className: "min-w-0",
|
|
2259
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2260
|
+
className: "block truncate text-[13px] font-medium leading-[18px] text-foreground",
|
|
2261
|
+
children: props.label
|
|
2262
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2263
|
+
className: `text-xs leading-4 text-muted-foreground ${props.tall ? "line-clamp-2" : "block truncate"}`,
|
|
2264
|
+
children: props.description
|
|
2265
|
+
})]
|
|
2266
|
+
}),
|
|
2267
|
+
props.version ? /* @__PURE__ */ jsxs("span", {
|
|
2268
|
+
className: `ml-auto shrink-0 pl-2 text-[11px] tabular-nums text-muted-foreground ${props.versionNote ? "" : props.active ? "" : "hidden group-hover:inline"}`,
|
|
2269
|
+
title: props.versionNote ?? `Pinned to version ${props.version}`,
|
|
2270
|
+
children: ["v", props.version]
|
|
2271
|
+
}) : null
|
|
2272
|
+
]
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2275
|
+
function rowTone(active, selected) {
|
|
2276
|
+
if (active) return "bg-wf-run/10 ring-1 ring-inset ring-wf-run/25";
|
|
2277
|
+
if (selected) return "bg-card shadow-sm ring-1 ring-foreground/10";
|
|
2278
|
+
return "hover:bg-foreground/[0.05]";
|
|
2279
|
+
}
|
|
2280
|
+
function optionId(list, index) {
|
|
2281
|
+
return `${list}-${index}`;
|
|
2282
|
+
}
|
|
2283
|
+
function optionAttributes(place) {
|
|
2284
|
+
return place ? {
|
|
2285
|
+
id: optionId(place.list, place.index),
|
|
2286
|
+
"aria-posinset": place.index + 1,
|
|
2287
|
+
"aria-setsize": place.size
|
|
2288
|
+
} : {};
|
|
2289
|
+
}
|
|
2290
|
+
function shownVersion(pieceName, version) {
|
|
2291
|
+
return isCoreBlock({ pieceName }) ? void 0 : version;
|
|
2292
|
+
}
|
|
2293
|
+
function useVersionNote(catalog) {
|
|
2294
|
+
const draft = useDraftBlocks();
|
|
2295
|
+
return (piece, version) => {
|
|
2296
|
+
if (!piece || !version) return void 0;
|
|
2297
|
+
const others = [...new Set(draft.filter((block) => block.pieceName === piece && block.pieceVersion !== version).map((block) => `v${block.pieceVersion}`))];
|
|
2298
|
+
if (others.length > 0) return `Other steps of this workflow use ${others.join(", ")}`;
|
|
2299
|
+
if (piece === "@powerhousedao/piece-reactor") return void 0;
|
|
2300
|
+
const published = catalog?.find((entry) => entry.name === piece)?.publishedVersion;
|
|
2301
|
+
return published && published !== version ? `A local build; v${published} is published` : void 0;
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
const CATEGORY_LABELS = {
|
|
2305
|
+
ARTIFICIAL_INTELLIGENCE: "AI",
|
|
2306
|
+
UNIVERSAL_AI: "AI",
|
|
2307
|
+
PRODUCTIVITY: "Productivity",
|
|
2308
|
+
MARKETING: "Marketing",
|
|
2309
|
+
COMMUNICATION: "Communication",
|
|
2310
|
+
SALES_AND_CRM: "Sales & CRM",
|
|
2311
|
+
DEVELOPER_TOOLS: "Developer tools",
|
|
2312
|
+
CONTENT_AND_FILES: "Content & files",
|
|
2313
|
+
BUSINESS_INTELLIGENCE: "Business intelligence",
|
|
2314
|
+
CORE: "Utilities",
|
|
2315
|
+
FLOW_CONTROL: "Utilities",
|
|
2316
|
+
COMMERCE: "Commerce",
|
|
2317
|
+
FORMS_AND_SURVEYS: "Forms & surveys",
|
|
2318
|
+
ACCOUNTING: "Accounting",
|
|
2319
|
+
CUSTOMER_SUPPORT: "Customer support",
|
|
2320
|
+
PAYMENT_PROCESSING: "Payments",
|
|
2321
|
+
HUMAN_RESOURCES: "HR"
|
|
2322
|
+
};
|
|
2323
|
+
const AI_CHIP = "AI";
|
|
2324
|
+
function categoryLabel(id) {
|
|
2325
|
+
return CATEGORY_LABELS[id] ?? id.toLowerCase().replaceAll("_", " ").replace(/^\w/, (char) => char.toUpperCase());
|
|
2326
|
+
}
|
|
2327
|
+
function chipsOf(piece) {
|
|
2328
|
+
return new Set(piece.categories.map(categoryLabel));
|
|
2329
|
+
}
|
|
2330
|
+
function categoriesOfChip(chip, pieces) {
|
|
2331
|
+
return [...new Set(pieces.flatMap((piece) => piece.categories))].filter((id) => categoryLabel(id) === chip);
|
|
2332
|
+
}
|
|
2333
|
+
function orderChips(pieces) {
|
|
2334
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2335
|
+
for (const piece of pieces) for (const chip of chipsOf(piece)) counts.set(chip, (counts.get(chip) ?? 0) + 1);
|
|
2336
|
+
const rest = [...counts.entries()].filter(([chip]) => chip !== AI_CHIP).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([chip]) => chip);
|
|
2337
|
+
return [...counts.has(AI_CHIP) ? [AI_CHIP] : [], ...rest];
|
|
2338
|
+
}
|
|
2339
|
+
const TAB_LABELS = {
|
|
2340
|
+
all: "All",
|
|
2341
|
+
core: "Core",
|
|
2342
|
+
powerhouse: "Powerhouse",
|
|
2343
|
+
activepieces: "Integrations"
|
|
2344
|
+
};
|
|
2345
|
+
const TAB_SOURCES = {
|
|
2346
|
+
all: void 0,
|
|
2347
|
+
core: [],
|
|
2348
|
+
powerhouse: ["local", "registry"],
|
|
2349
|
+
activepieces: ["activepieces"]
|
|
2350
|
+
};
|
|
2351
|
+
function inTab(tab, piece) {
|
|
2352
|
+
const sources = TAB_SOURCES[tab];
|
|
2353
|
+
return sources === void 0 || sources.includes(piece.source ?? "activepieces");
|
|
2354
|
+
}
|
|
2355
|
+
function folded(text) {
|
|
2356
|
+
return text.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase();
|
|
2357
|
+
}
|
|
2358
|
+
function queryTokens(query) {
|
|
2359
|
+
return folded(query).split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
2360
|
+
}
|
|
2361
|
+
function matchesQuery(text, tokens) {
|
|
2362
|
+
const lowered = folded(text);
|
|
2363
|
+
return tokens.every((token) => lowered.includes(token));
|
|
2364
|
+
}
|
|
2365
|
+
function escapeRegExp(text) {
|
|
2366
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2367
|
+
}
|
|
2368
|
+
function Highlight(props) {
|
|
2369
|
+
if (props.tokens.length === 0) return /* @__PURE__ */ jsx(Fragment$1, { children: props.text });
|
|
2370
|
+
const pattern = new RegExp(`(?<![\\p{L}\\p{N}])(${props.tokens.map(escapeRegExp).join("|")})`, "giu");
|
|
2371
|
+
const parts = props.text.split(pattern);
|
|
2372
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: parts.map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("mark", {
|
|
2373
|
+
className: "bg-transparent font-semibold text-inherit",
|
|
2374
|
+
children: part
|
|
2375
|
+
}, i) : part) });
|
|
2376
|
+
}
|
|
2377
|
+
const SEARCH_MIN_CHARS = 2;
|
|
2378
|
+
const SEARCH_DEBOUNCE_MS = 250;
|
|
2379
|
+
const INDEXING_RETRY_MS = 2e3;
|
|
2380
|
+
function usePieceSearch(query, filter) {
|
|
2381
|
+
const [state, setState] = useState({ kind: "idle" });
|
|
2382
|
+
const [attempt, setAttempt] = useState(0);
|
|
2383
|
+
const trimmed = query.trim();
|
|
2384
|
+
const search = usePieceSource()?.searchPieces;
|
|
2385
|
+
const active = filter !== null && search !== void 0 && trimmed.length >= SEARCH_MIN_CHARS;
|
|
2386
|
+
const filterKey = JSON.stringify(filter);
|
|
2387
|
+
const key = `${trimmed}\n${filterKey}`;
|
|
2388
|
+
useEffect(() => {
|
|
2389
|
+
if (!active) {
|
|
2390
|
+
setState({ kind: "idle" });
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
let alive = true;
|
|
2394
|
+
let retry;
|
|
2395
|
+
const timer = setTimeout(() => {
|
|
2396
|
+
search(trimmed, JSON.parse(filterKey)).then((result) => {
|
|
2397
|
+
if (!alive) return;
|
|
2398
|
+
setState({
|
|
2399
|
+
kind: "done",
|
|
2400
|
+
key,
|
|
2401
|
+
result
|
|
2402
|
+
});
|
|
2403
|
+
if (result.status === "indexing") retry = setTimeout(() => setAttempt((value) => value + 1), INDEXING_RETRY_MS);
|
|
2404
|
+
}, (error) => {
|
|
2405
|
+
if (alive) setState({
|
|
2406
|
+
kind: "error",
|
|
2407
|
+
key,
|
|
2408
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2409
|
+
});
|
|
2410
|
+
});
|
|
2411
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
2412
|
+
return () => {
|
|
2413
|
+
alive = false;
|
|
2414
|
+
clearTimeout(timer);
|
|
2415
|
+
if (retry) clearTimeout(retry);
|
|
2416
|
+
};
|
|
2417
|
+
}, [
|
|
2418
|
+
active,
|
|
2419
|
+
trimmed,
|
|
2420
|
+
filterKey,
|
|
2421
|
+
key,
|
|
2422
|
+
attempt,
|
|
2423
|
+
search
|
|
2424
|
+
]);
|
|
2425
|
+
if (!active) return { kind: "idle" };
|
|
2426
|
+
if (state.kind === "idle") return { kind: "loading" };
|
|
2427
|
+
if (state.kind === "error") return state.key === key ? {
|
|
2428
|
+
kind: "error",
|
|
2429
|
+
message: state.message
|
|
2430
|
+
} : { kind: "loading" };
|
|
2431
|
+
return {
|
|
2432
|
+
kind: "done",
|
|
2433
|
+
result: state.result,
|
|
2434
|
+
stale: state.key !== key
|
|
2435
|
+
};
|
|
2436
|
+
}
|
|
2437
|
+
function rovingFocus(event) {
|
|
2438
|
+
const delta = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
|
|
2439
|
+
if (delta === 0) return;
|
|
2440
|
+
event.preventDefault();
|
|
2441
|
+
const buttons = [...event.currentTarget.querySelectorAll("button")];
|
|
2442
|
+
const at = buttons.indexOf(document.activeElement);
|
|
2443
|
+
buttons.at((at + delta) % buttons.length)?.focus();
|
|
2444
|
+
}
|
|
2445
|
+
function Chip(props) {
|
|
2446
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2447
|
+
type: "button",
|
|
2448
|
+
"aria-pressed": props.active,
|
|
2449
|
+
tabIndex: props.tabStop ? 0 : -1,
|
|
2450
|
+
className: `shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active ? "border-wf-run/40 bg-wf-run/10 text-wf-run" : "border-foreground/10 text-muted-foreground hover:border-foreground/25 hover:text-foreground"}`,
|
|
2451
|
+
onClick: (event) => props.onClick(event.detail === 0),
|
|
2452
|
+
children: props.label
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
function ChipBar(props) {
|
|
2456
|
+
const ref = useRef(null);
|
|
2457
|
+
const [more, setMore] = useState({
|
|
2458
|
+
left: false,
|
|
2459
|
+
right: false
|
|
2460
|
+
});
|
|
2461
|
+
const measure = () => {
|
|
2462
|
+
const element = ref.current;
|
|
2463
|
+
if (!element) return;
|
|
2464
|
+
const left = element.scrollLeft > 1;
|
|
2465
|
+
const right = element.scrollLeft + element.clientWidth < element.scrollWidth - 1;
|
|
2466
|
+
setMore((previous) => previous.left === left && previous.right === right ? previous : {
|
|
2467
|
+
left,
|
|
2468
|
+
right
|
|
2469
|
+
});
|
|
2470
|
+
};
|
|
2471
|
+
useLayoutEffect(() => {
|
|
2472
|
+
const element = ref.current;
|
|
2473
|
+
if (!element) return;
|
|
2474
|
+
const observer = new ResizeObserver(measure);
|
|
2475
|
+
observer.observe(element);
|
|
2476
|
+
return () => observer.disconnect();
|
|
2477
|
+
}, []);
|
|
2478
|
+
const fade = (side) => /* @__PURE__ */ jsx("span", {
|
|
2479
|
+
"aria-hidden": "true",
|
|
2480
|
+
className: "pointer-events-none absolute inset-y-0 w-14",
|
|
2481
|
+
style: {
|
|
2482
|
+
[side]: 0,
|
|
2483
|
+
background: `linear-gradient(to ${side === "left" ? "right" : "left"}, var(--card), transparent)`
|
|
2484
|
+
}
|
|
2485
|
+
});
|
|
2486
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2487
|
+
className: "relative shrink-0 border-b border-foreground/10",
|
|
2488
|
+
children: [
|
|
2489
|
+
/* @__PURE__ */ jsx("div", {
|
|
2490
|
+
ref,
|
|
2491
|
+
role: "toolbar",
|
|
2492
|
+
"aria-label": "Categories",
|
|
2493
|
+
className: "flex gap-1.5 overflow-x-auto whitespace-nowrap px-3 py-2 [scrollbar-width:none]",
|
|
2494
|
+
onKeyDown: rovingFocus,
|
|
2495
|
+
onScroll: measure,
|
|
2496
|
+
children: props.children
|
|
2497
|
+
}),
|
|
2498
|
+
more.left ? fade("left") : null,
|
|
2499
|
+
more.right ? fade("right") : null
|
|
2500
|
+
]
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
function Tabs(props) {
|
|
2504
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2505
|
+
role: "tablist",
|
|
2506
|
+
"aria-label": "Piece sources",
|
|
2507
|
+
className: "inline-flex gap-0.5 rounded-md bg-foreground/[0.05] p-0.5",
|
|
2508
|
+
onKeyDown: (event) => {
|
|
2509
|
+
rovingFocus(event);
|
|
2510
|
+
const tab = document.activeElement?.dataset.tab;
|
|
2511
|
+
if (tab && tab !== props.active) props.onSelect(tab, true);
|
|
2512
|
+
},
|
|
2513
|
+
children: props.tabs.map((tab) => /* @__PURE__ */ jsx("button", {
|
|
2514
|
+
type: "button",
|
|
2515
|
+
role: "tab",
|
|
2516
|
+
"data-tab": tab,
|
|
2517
|
+
"aria-selected": props.active === tab,
|
|
2518
|
+
tabIndex: props.active === tab ? 0 : -1,
|
|
2519
|
+
className: `rounded px-2.5 py-1 text-xs font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active === tab ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
2520
|
+
onClick: (event) => props.onSelect(tab, event.detail === 0),
|
|
2521
|
+
children: TAB_LABELS[tab]
|
|
2522
|
+
}, tab))
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
function Status(props) {
|
|
2526
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2527
|
+
role: "status",
|
|
2528
|
+
className: `px-4 py-2.5 text-xs ${props.error ? "text-wf-fail" : "text-muted-foreground"}`,
|
|
2529
|
+
children: props.children
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
const ROW_HEIGHT = 46;
|
|
2533
|
+
const BLOCK_HEIGHT = 60;
|
|
2534
|
+
const HEADER_LOGO = 36;
|
|
2535
|
+
const HEADER_HEIGHT = 38;
|
|
2536
|
+
const MORE_HEIGHT = 28;
|
|
2537
|
+
const GROUP_BLOCKS = 4;
|
|
2538
|
+
const HOVER_PREVIEW_MS = 120;
|
|
2539
|
+
const searchRowHeight = (row) => row.type === "entry" ? BLOCK_HEIGHT : row.type === "more" ? MORE_HEIGHT : HEADER_HEIGHT;
|
|
2540
|
+
const sourceHeight = () => ROW_HEIGHT;
|
|
2541
|
+
const entryHeight = () => BLOCK_HEIGHT;
|
|
2542
|
+
function listTile(icon, color) {
|
|
2543
|
+
return (size) => /* @__PURE__ */ jsx(CoreTile, {
|
|
2544
|
+
tile: {
|
|
2545
|
+
icon,
|
|
2546
|
+
color
|
|
2547
|
+
},
|
|
2548
|
+
size
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
function EntryRow(props) {
|
|
2552
|
+
const { entry } = props;
|
|
2553
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
2554
|
+
logo: props.indent ? /* @__PURE__ */ jsx("span", {
|
|
2555
|
+
className: "shrink-0",
|
|
2556
|
+
style: { width: ROW_LOGO }
|
|
2557
|
+
}) : entry.logo,
|
|
2558
|
+
label: /* @__PURE__ */ jsx(Highlight, {
|
|
2559
|
+
text: entry.label,
|
|
2560
|
+
tokens: props.tokens
|
|
2561
|
+
}),
|
|
2562
|
+
title: entry.description || entry.label,
|
|
2563
|
+
description: entry.unavailable ?? /* @__PURE__ */ jsx(Highlight, {
|
|
2564
|
+
text: entry.description,
|
|
2565
|
+
tokens: props.tokens
|
|
2566
|
+
}),
|
|
2567
|
+
disabled: entry.unavailable !== void 0,
|
|
2568
|
+
active: props.active,
|
|
2569
|
+
tall: true,
|
|
2570
|
+
option: props.option,
|
|
2571
|
+
version: entry.version,
|
|
2572
|
+
versionNote: entry.versionNote,
|
|
2573
|
+
onHover: () => {
|
|
2574
|
+
props.onActivate();
|
|
2575
|
+
if (entry.unavailable === void 0) entry.warm?.();
|
|
2576
|
+
},
|
|
2577
|
+
onClick: entry.pick
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
function SourceRow(props) {
|
|
2581
|
+
const { source } = props;
|
|
2582
|
+
if (source.kind === "list") return /* @__PURE__ */ jsx(Row, {
|
|
2583
|
+
logo: source.logo(ROW_LOGO),
|
|
2584
|
+
label: source.title,
|
|
2585
|
+
description: source.subtitle,
|
|
2586
|
+
active: props.active,
|
|
2587
|
+
selected: props.selected,
|
|
2588
|
+
option: props.option,
|
|
2589
|
+
onHover: props.onActivate,
|
|
2590
|
+
onClick: props.onOpen
|
|
2591
|
+
});
|
|
2592
|
+
const { piece } = source;
|
|
2593
|
+
const count = props.mode === "triggers" ? piece.triggerCount : piece.actionCount;
|
|
2594
|
+
const noun = props.mode === "triggers" ? "trigger" : "action";
|
|
2595
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
2596
|
+
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
2597
|
+
src: piece.logoUrl,
|
|
2598
|
+
alt: piece.displayName,
|
|
2599
|
+
size: ROW_LOGO
|
|
2600
|
+
}),
|
|
2601
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Highlight, {
|
|
2602
|
+
text: piece.displayName,
|
|
2603
|
+
tokens: props.tokens
|
|
2604
|
+
}), piece.deprecated ? " (deprecated)" : ""] }),
|
|
2605
|
+
title: piece.description || piece.displayName,
|
|
2606
|
+
description: piece.unsupported ?? `${count} ${noun}${count === 1 ? "" : "s"}`,
|
|
2607
|
+
active: props.active,
|
|
2608
|
+
selected: props.selected,
|
|
2609
|
+
option: props.option,
|
|
2610
|
+
onHover: props.onActivate,
|
|
2611
|
+
onClick: props.onOpen
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
function usePieceEntries(piece, mode) {
|
|
2615
|
+
const pieceSource = usePieceSource();
|
|
2616
|
+
const [state, setState] = useState(null);
|
|
2617
|
+
const name = piece?.name;
|
|
2618
|
+
useEffect(() => {
|
|
2619
|
+
if (!name || !pieceSource) return;
|
|
2620
|
+
let cancelled = false;
|
|
2621
|
+
(mode === "triggers" ? pieceSource.loadTriggers(name) : pieceSource.loadActions(name)).then((entries) => {
|
|
2622
|
+
if (!cancelled) setState({
|
|
2623
|
+
name,
|
|
2624
|
+
entries,
|
|
2625
|
+
error: null
|
|
2626
|
+
});
|
|
2627
|
+
}, (error) => {
|
|
2628
|
+
if (!cancelled) setState({
|
|
2629
|
+
name,
|
|
2630
|
+
entries: null,
|
|
2631
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2632
|
+
});
|
|
2633
|
+
});
|
|
2634
|
+
return () => {
|
|
2635
|
+
cancelled = true;
|
|
2636
|
+
};
|
|
2637
|
+
}, [
|
|
2638
|
+
name,
|
|
2639
|
+
mode,
|
|
2640
|
+
pieceSource
|
|
2641
|
+
]);
|
|
2642
|
+
return state && state.name === name ? {
|
|
2643
|
+
entries: state.entries,
|
|
2644
|
+
error: state.error
|
|
2645
|
+
} : {
|
|
2646
|
+
entries: null,
|
|
2647
|
+
error: null
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
function EntriesPane(props) {
|
|
2651
|
+
const { source } = props;
|
|
2652
|
+
const entries = source?.kind === "list" ? source.entries : props.pieceEntries;
|
|
2653
|
+
const kind = props.mode === "triggers" ? "trigger" : "action";
|
|
2654
|
+
const title = source?.kind === "list" ? source.title : source?.piece.displayName;
|
|
2655
|
+
const about = source?.kind === "list" ? source.subtitle : source?.piece.description;
|
|
2656
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2657
|
+
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
2658
|
+
children: [source && props.showHeader ? /* @__PURE__ */ jsxs("div", {
|
|
2659
|
+
className: "flex shrink-0 items-start gap-3 border-b border-foreground/10 px-4 py-3",
|
|
2660
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2661
|
+
"aria-hidden": "true",
|
|
2662
|
+
className: "contents",
|
|
2663
|
+
children: source.kind === "list" ? source.logo(HEADER_LOGO) : /* @__PURE__ */ jsx(LogoFrame, {
|
|
2664
|
+
src: source.piece.logoUrl,
|
|
2665
|
+
alt: "",
|
|
2666
|
+
size: HEADER_LOGO
|
|
2667
|
+
})
|
|
2668
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2669
|
+
className: "min-w-0",
|
|
2670
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2671
|
+
className: "truncate text-sm font-semibold leading-5 text-foreground",
|
|
2672
|
+
children: title
|
|
2673
|
+
}), about ? /* @__PURE__ */ jsx("div", {
|
|
2674
|
+
className: "line-clamp-2 text-xs leading-4 text-muted-foreground",
|
|
2675
|
+
title: about,
|
|
2676
|
+
children: about
|
|
2677
|
+
}) : null]
|
|
2678
|
+
})]
|
|
2679
|
+
}) : null, !source ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
2680
|
+
"Pick a piece to see its ",
|
|
2681
|
+
kind,
|
|
2682
|
+
"s"
|
|
2683
|
+
] }) : props.pieceError ? /* @__PURE__ */ jsx(Status, {
|
|
2684
|
+
error: true,
|
|
2685
|
+
children: props.pieceError
|
|
2686
|
+
}) : entries === null ? /* @__PURE__ */ jsx(Status, { children: "Loading…" }) : entries.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
2687
|
+
"No ",
|
|
2688
|
+
kind,
|
|
2689
|
+
"s"
|
|
2690
|
+
] }) : /* @__PURE__ */ jsx(VirtualList, {
|
|
2691
|
+
id: props.listId,
|
|
2692
|
+
resetKey: source.id,
|
|
2693
|
+
label: `${title ?? ""} ${kind}s`,
|
|
2694
|
+
className: "flex-1 py-1",
|
|
2695
|
+
items: entries,
|
|
2696
|
+
heightOf: entryHeight,
|
|
2697
|
+
keyOf: (entry) => entry.key,
|
|
2698
|
+
activeIndex: props.activeIndex,
|
|
2699
|
+
render: (entry, index) => /* @__PURE__ */ jsx(EntryRow, {
|
|
2700
|
+
entry,
|
|
2701
|
+
tokens: props.tokens,
|
|
2702
|
+
active: index === props.activeIndex,
|
|
2703
|
+
option: {
|
|
2704
|
+
list: props.listId,
|
|
2705
|
+
index,
|
|
2706
|
+
size: entries.length
|
|
2707
|
+
},
|
|
2708
|
+
onActivate: () => props.onActivate(index)
|
|
2709
|
+
})
|
|
2710
|
+
})]
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
function SearchList(props) {
|
|
2714
|
+
const size = props.rows.length;
|
|
2715
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2716
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
2717
|
+
children: [props.status, /* @__PURE__ */ jsx(VirtualList, {
|
|
2718
|
+
id: props.listId,
|
|
2719
|
+
label: "Search results",
|
|
2720
|
+
resetKey: props.resetKey,
|
|
2721
|
+
className: `flex-1 py-1 ${props.stale ? "opacity-60" : ""}`,
|
|
2722
|
+
items: props.rows,
|
|
2723
|
+
heightOf: searchRowHeight,
|
|
2724
|
+
keyOf: (row, index) => row.type === "entry" ? `e:${row.entry.key}` : row.type === "piece" ? `p:${row.match.pieceName}` : row.type === "list" ? `l:${row.source.id}` : `m:${row.pieceName}:${index}`,
|
|
2725
|
+
activeIndex: props.activeIndex,
|
|
2726
|
+
render: (row, index) => {
|
|
2727
|
+
const active = index === props.activeIndex;
|
|
2728
|
+
const activate = () => props.onActivate(index);
|
|
2729
|
+
const option = {
|
|
2730
|
+
list: props.listId,
|
|
2731
|
+
index,
|
|
2732
|
+
size
|
|
2733
|
+
};
|
|
2734
|
+
if (row.type === "entry") return /* @__PURE__ */ jsx(EntryRow, {
|
|
2735
|
+
entry: row.entry,
|
|
2736
|
+
tokens: props.tokens,
|
|
2737
|
+
active,
|
|
2738
|
+
option,
|
|
2739
|
+
indent: true,
|
|
2740
|
+
onActivate: activate
|
|
2741
|
+
});
|
|
2742
|
+
if (row.type === "more") return /* @__PURE__ */ jsxs("div", {
|
|
2743
|
+
...optionAttributes(option),
|
|
2744
|
+
role: "option",
|
|
2745
|
+
"aria-selected": active,
|
|
2746
|
+
className: `mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center rounded-md pl-[42px] text-xs text-muted-foreground hover:text-foreground ${rowTone(active)}`,
|
|
2747
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2748
|
+
onMouseEnter: activate,
|
|
2749
|
+
onClick: () => props.onExpand(row.pieceName),
|
|
2750
|
+
children: [row.hidden, " more…"]
|
|
2751
|
+
});
|
|
2752
|
+
const header = row.type === "piece" ? {
|
|
2753
|
+
logo: /* @__PURE__ */ jsx(LogoFrame, {
|
|
2754
|
+
src: row.match.logoUrl,
|
|
2755
|
+
alt: row.match.displayName,
|
|
2756
|
+
size: 20
|
|
2757
|
+
}),
|
|
2758
|
+
label: row.match.displayName,
|
|
2759
|
+
note: row.match.deprecated ? "Deprecated" : row.match.unsupported ?? void 0,
|
|
2760
|
+
kind: props.kind,
|
|
2761
|
+
open: () => props.onOpenPiece(row.match.pieceName)
|
|
2762
|
+
} : {
|
|
2763
|
+
logo: row.source.logo(20),
|
|
2764
|
+
label: row.source.title,
|
|
2765
|
+
note: void 0,
|
|
2766
|
+
kind: props.kind,
|
|
2767
|
+
open: () => props.onOpenList(row.source.id)
|
|
2768
|
+
};
|
|
2769
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2770
|
+
...optionAttributes(option),
|
|
2771
|
+
role: "option",
|
|
2772
|
+
"aria-selected": active,
|
|
2773
|
+
title: `Open ${header.label}`,
|
|
2774
|
+
className: `group mx-1.5 mt-1 flex h-[calc(100%-4px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(active)}`,
|
|
2775
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2776
|
+
onMouseEnter: activate,
|
|
2777
|
+
onClick: header.open,
|
|
2778
|
+
children: [
|
|
2779
|
+
/* @__PURE__ */ jsx("span", {
|
|
2780
|
+
"aria-hidden": "true",
|
|
2781
|
+
className: "contents",
|
|
2782
|
+
children: header.logo
|
|
2783
|
+
}),
|
|
2784
|
+
/* @__PURE__ */ jsx("span", {
|
|
2785
|
+
className: "truncate text-[13px] font-semibold text-foreground",
|
|
2786
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
2787
|
+
text: header.label,
|
|
2788
|
+
tokens: props.tokens
|
|
2789
|
+
})
|
|
2790
|
+
}),
|
|
2791
|
+
header.note ? /* @__PURE__ */ jsx("span", {
|
|
2792
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
2793
|
+
children: header.note
|
|
2794
|
+
}) : null,
|
|
2795
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2796
|
+
className: `ml-auto flex shrink-0 items-center gap-0.5 text-[11px] text-muted-foreground ${active ? "" : "opacity-0 group-hover:opacity-100"}`,
|
|
2797
|
+
children: [
|
|
2798
|
+
"All ",
|
|
2799
|
+
header.kind,
|
|
2800
|
+
"s",
|
|
2801
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
2802
|
+
name: "chevron",
|
|
2803
|
+
size: 12
|
|
2804
|
+
})
|
|
2805
|
+
]
|
|
2806
|
+
})
|
|
2807
|
+
]
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
})]
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
function BlockSelector(props) {
|
|
2814
|
+
const [query, setQuery] = useState("");
|
|
2815
|
+
const [tab, setTab] = useState("all");
|
|
2816
|
+
const [chip, setChip] = useState(null);
|
|
2817
|
+
const [catalog, setCatalog] = useState(null);
|
|
2818
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
2819
|
+
const [paneState, setPane] = useState("sources");
|
|
2820
|
+
const [entryIndex, setEntryIndex] = useState(-1);
|
|
2821
|
+
const [rowIndex, setRowIndex] = useState(-1);
|
|
2822
|
+
const [expanded, setExpanded] = useState(/* @__PURE__ */ new Set());
|
|
2823
|
+
const containerRef = useRef(null);
|
|
2824
|
+
const inputRef = useRef(null);
|
|
2825
|
+
const baseId = useId();
|
|
2826
|
+
const listIds = {
|
|
2827
|
+
sources: `${baseId}-sources`,
|
|
2828
|
+
entries: `${baseId}-entries`,
|
|
2829
|
+
results: `${baseId}-results`
|
|
2830
|
+
};
|
|
2831
|
+
const pointerMoved = useRef(false);
|
|
2832
|
+
const hoverTimer = useRef(void 0);
|
|
2833
|
+
const { anchor, onClose } = props;
|
|
2834
|
+
useEffect(() => {
|
|
2835
|
+
const handler = (event) => {
|
|
2836
|
+
const target = event.target;
|
|
2837
|
+
if (containerRef.current?.contains(target)) return;
|
|
2838
|
+
if (anchor?.current?.contains(target)) return;
|
|
2839
|
+
onClose();
|
|
2840
|
+
};
|
|
2841
|
+
window.addEventListener("pointerdown", handler, true);
|
|
2842
|
+
return () => window.removeEventListener("pointerdown", handler, true);
|
|
2843
|
+
}, [anchor, onClose]);
|
|
2844
|
+
useEffect(() => () => clearTimeout(hoverTimer.current), []);
|
|
2845
|
+
const anySource = usePieceSource();
|
|
2846
|
+
const pieceSource = props.showPieces ? anySource : void 0;
|
|
2847
|
+
const [catalogRound, setCatalogRound] = useState(0);
|
|
2848
|
+
useEffect(() => {
|
|
2849
|
+
if (!anySource) return;
|
|
2850
|
+
let cancelled = false;
|
|
2851
|
+
let timer;
|
|
2852
|
+
const load = (attempt) => {
|
|
2853
|
+
(attempt > 0 && anySource.reloadCatalog ? anySource.reloadCatalog() : anySource.loadCatalog()).then((pieces) => {
|
|
2854
|
+
registerPieceLogos(pieces);
|
|
2855
|
+
if (!cancelled) setCatalog({ pieces });
|
|
2856
|
+
}).catch((error) => {
|
|
2857
|
+
if (cancelled) return;
|
|
2858
|
+
if (attempt + 1 < 5) {
|
|
2859
|
+
timer = setTimeout(() => load(attempt + 1), CATALOG_RETRY_MS * 2 ** attempt);
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
setCatalog({
|
|
2863
|
+
pieces: [],
|
|
2864
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2865
|
+
});
|
|
2866
|
+
});
|
|
2867
|
+
};
|
|
2868
|
+
load(catalogRound > 0 ? 1 : 0);
|
|
2869
|
+
return () => {
|
|
2870
|
+
cancelled = true;
|
|
2871
|
+
clearTimeout(timer);
|
|
2872
|
+
};
|
|
2873
|
+
}, [anySource, catalogRound]);
|
|
2874
|
+
const installed = (name) => catalog?.pieces.find((entry) => entry.name === name)?.version;
|
|
2875
|
+
const versionNote = useVersionNote(catalog?.pieces);
|
|
2876
|
+
const pinned = (preset) => pinBlock(preset.block, installed);
|
|
2877
|
+
const pick = (preset) => {
|
|
2878
|
+
const block = pinned(preset);
|
|
2879
|
+
if (!block) return;
|
|
2880
|
+
rememberPick(preset);
|
|
2881
|
+
props.onPick({
|
|
2882
|
+
...preset,
|
|
2883
|
+
block
|
|
2884
|
+
});
|
|
2885
|
+
};
|
|
2886
|
+
const prefetch = useBlockFormPrefetch();
|
|
2887
|
+
const mode = props.pieceMode ?? "actions";
|
|
2888
|
+
const kind = mode === "triggers" ? "trigger" : "action";
|
|
2889
|
+
const tokens = queryTokens(query);
|
|
2890
|
+
const searching = query.trim().length >= SEARCH_MIN_CHARS;
|
|
2891
|
+
const showCatalog = pieceSource !== void 0 && tab !== "core";
|
|
2892
|
+
const tabs = pieceSource ? [
|
|
2893
|
+
"all",
|
|
2894
|
+
"core",
|
|
2895
|
+
"powerhouse",
|
|
2896
|
+
"activepieces"
|
|
2897
|
+
] : [
|
|
2898
|
+
"all",
|
|
2899
|
+
"core",
|
|
2900
|
+
"powerhouse"
|
|
2901
|
+
];
|
|
2902
|
+
const modePieces = useMemo(() => {
|
|
2903
|
+
const presetCounts = /* @__PURE__ */ new Map();
|
|
2904
|
+
for (const preset of props.presets) {
|
|
2905
|
+
const name = preset.block.pieceName;
|
|
2906
|
+
presetCounts.set(name, (presetCounts.get(name) ?? 0) + 1);
|
|
2907
|
+
}
|
|
2908
|
+
return (catalog?.pieces ?? []).filter((entry) => {
|
|
2909
|
+
return (mode === "triggers" ? entry.triggerCount : entry.actionCount) > (presetCounts.get(entry.name) ?? 0);
|
|
2910
|
+
});
|
|
2911
|
+
}, [
|
|
2912
|
+
catalog,
|
|
2913
|
+
mode,
|
|
2914
|
+
props.presets
|
|
2915
|
+
]);
|
|
2916
|
+
const tabPieces = useMemo(() => modePieces.filter((entry) => inTab(tab, entry)), [modePieces, tab]);
|
|
2917
|
+
const chips = useMemo(() => orderChips(tabPieces), [tabPieces]);
|
|
2918
|
+
const showChips = showCatalog && (tab === "activepieces" || tab === "powerhouse") && chips.length > 1;
|
|
2919
|
+
const activeChip = showChips && chip !== null && chips.includes(chip) ? chip : null;
|
|
2920
|
+
const searchFilter = useMemo(() => showCatalog ? {
|
|
2921
|
+
kind,
|
|
2922
|
+
...TAB_SOURCES[tab] ? { sources: TAB_SOURCES[tab] } : {},
|
|
2923
|
+
...activeChip ? { categories: categoriesOfChip(activeChip, tabPieces) } : {}
|
|
2924
|
+
} : null, [
|
|
2925
|
+
showCatalog,
|
|
2926
|
+
kind,
|
|
2927
|
+
tab,
|
|
2928
|
+
activeChip,
|
|
2929
|
+
tabPieces
|
|
2930
|
+
]);
|
|
2931
|
+
const search = usePieceSearch(query, searchFilter);
|
|
2932
|
+
const presetEntry = (preset) => {
|
|
2933
|
+
const block = pinned(preset);
|
|
2934
|
+
return {
|
|
2935
|
+
key: `${blockKey(preset.block)} ${preset.label}`,
|
|
2936
|
+
logo: /* @__PURE__ */ jsx(BlockLogo, {
|
|
2937
|
+
block: preset.block,
|
|
2938
|
+
size: ROW_LOGO
|
|
2939
|
+
}),
|
|
2940
|
+
label: preset.label,
|
|
2941
|
+
description: preset.description,
|
|
2942
|
+
unavailable: block ? void 0 : catalog === null ? "Loading…" : "Not installed on this runtime",
|
|
2943
|
+
version: shownVersion(preset.block.pieceName, block?.pieceVersion),
|
|
2944
|
+
versionNote: versionNote(preset.block.pieceName, block?.pieceVersion),
|
|
2945
|
+
pick: () => pick(preset),
|
|
2946
|
+
warm: block ? () => prefetch(block) : void 0
|
|
2947
|
+
};
|
|
2948
|
+
};
|
|
2949
|
+
const blockEntry = (entry, logo) => {
|
|
2950
|
+
const block = {
|
|
2951
|
+
pieceName: entry.pieceName,
|
|
2952
|
+
pieceVersion: entry.pieceVersion,
|
|
2953
|
+
kind,
|
|
2954
|
+
name: entry.name
|
|
2955
|
+
};
|
|
2956
|
+
return {
|
|
2957
|
+
key: blockKey(block),
|
|
2958
|
+
logo,
|
|
2959
|
+
label: entry.displayName,
|
|
2960
|
+
description: entry.description,
|
|
2961
|
+
unavailable: blockUnavailable({
|
|
2962
|
+
...entry,
|
|
2963
|
+
kind
|
|
2964
|
+
}),
|
|
2965
|
+
version: shownVersion(entry.pieceName, entry.pieceVersion),
|
|
2966
|
+
versionNote: versionNote(entry.pieceName, entry.pieceVersion),
|
|
2967
|
+
pick: () => pick({
|
|
2968
|
+
label: entry.displayName,
|
|
2969
|
+
block,
|
|
2970
|
+
description: entry.description,
|
|
2971
|
+
defaultConfig: {}
|
|
2972
|
+
}),
|
|
2973
|
+
warm: () => prefetch(block)
|
|
2974
|
+
};
|
|
2975
|
+
};
|
|
2976
|
+
const lists = (() => {
|
|
2977
|
+
if (activeChip !== null) return [];
|
|
2978
|
+
const result = [];
|
|
2979
|
+
const add = (id, title, subtitle, logo, entries) => {
|
|
2980
|
+
if (entries.length > 0) result.push({
|
|
2981
|
+
kind: "list",
|
|
2982
|
+
id,
|
|
2983
|
+
title,
|
|
2984
|
+
subtitle,
|
|
2985
|
+
logo,
|
|
2986
|
+
entries
|
|
2987
|
+
});
|
|
2988
|
+
};
|
|
2989
|
+
if (tab === "all") {
|
|
2990
|
+
if (props.onAttach) add("attach", "Detached steps", "Re-attach a step at this point", listTile("branch", "#64748b"), (props.attachSteps ?? []).map((step) => ({
|
|
2991
|
+
key: `attach ${step.id}`,
|
|
2992
|
+
logo: /* @__PURE__ */ jsx(BlockLogo, {
|
|
2993
|
+
block: stepBlock(step),
|
|
2994
|
+
size: ROW_LOGO
|
|
2995
|
+
}),
|
|
2996
|
+
label: step.name,
|
|
2997
|
+
description: `{{steps.${step.key}}} · detached`,
|
|
2998
|
+
pick: () => props.onAttach?.(step.id)
|
|
2999
|
+
})));
|
|
3000
|
+
}
|
|
3001
|
+
if (tab === "all" || tab === "core") add("core", "Core", "Built into the workflow engine", listTile("bolt", "#2563eb"), props.presets.filter((preset) => preset.group !== "powerhouse").map(presetEntry));
|
|
3002
|
+
if (tab === "all" || tab === "powerhouse") {
|
|
3003
|
+
const reactorPreset = props.presets.find((preset) => preset.group === "powerhouse");
|
|
3004
|
+
add("powerhouse", "Documents", "Read and change documents on this reactor", (size) => reactorPreset ? /* @__PURE__ */ jsx(BlockLogo, {
|
|
3005
|
+
block: reactorPreset.block,
|
|
3006
|
+
size
|
|
3007
|
+
}) : null, props.presets.filter((preset) => preset.group === "powerhouse").map(presetEntry));
|
|
3008
|
+
}
|
|
3009
|
+
if (tab === "all") {
|
|
3010
|
+
const recent = recentPicks(kind).filter((preset) => isCoreBlock(preset.block) || installed(preset.block.pieceName));
|
|
3011
|
+
add("recent", "Recently used", `Your last ${kind}s`, listTile("clock", "#64748b"), recent.map((preset) => {
|
|
3012
|
+
const entry = presetEntry(preset);
|
|
3013
|
+
const reason = catalog?.pieces.find((piece) => piece.name === preset.block.pieceName)?.unsupported;
|
|
3014
|
+
return reason ? {
|
|
3015
|
+
...entry,
|
|
3016
|
+
unavailable: reason
|
|
3017
|
+
} : entry;
|
|
3018
|
+
}));
|
|
3019
|
+
}
|
|
3020
|
+
return result;
|
|
3021
|
+
})();
|
|
3022
|
+
const sources = (() => {
|
|
3023
|
+
const listSources = lists.map((list) => ({
|
|
3024
|
+
...list,
|
|
3025
|
+
entries: list.entries.filter((entry) => matchesQuery(`${entry.label} ${entry.description}`, tokens))
|
|
3026
|
+
})).filter((list) => list.entries.length > 0);
|
|
3027
|
+
const pieceSources = showCatalog ? tabPieces.filter((entry) => (activeChip === null || chipsOf(entry).has(activeChip)) && matchesQuery(`${entry.displayName} ${entry.name} ${entry.description}`, tokens)).map((piece) => ({
|
|
3028
|
+
kind: "piece",
|
|
3029
|
+
id: piece.name,
|
|
3030
|
+
piece
|
|
3031
|
+
})) : [];
|
|
3032
|
+
return [...listSources, ...pieceSources];
|
|
3033
|
+
})();
|
|
3034
|
+
const selected = sources.find((source) => source.id === selectedId) ?? sources.at(0);
|
|
3035
|
+
const sourceIndex = selected ? sources.indexOf(selected) : -1;
|
|
3036
|
+
const selectedPiece = selected?.kind === "piece" ? selected.piece : void 0;
|
|
3037
|
+
const loaded = usePieceEntries(selectedPiece, mode);
|
|
3038
|
+
const pieceEntries = selectedPiece && loaded.entries ? loaded.entries.map((entry) => blockEntry(entry, /* @__PURE__ */ jsx(LogoFrame, {
|
|
3039
|
+
src: selectedPiece.logoUrl,
|
|
3040
|
+
alt: selectedPiece.displayName,
|
|
3041
|
+
size: ROW_LOGO
|
|
3042
|
+
}))) : null;
|
|
3043
|
+
const entries = selected?.kind === "list" ? selected.entries : pieceEntries ?? [];
|
|
3044
|
+
const entryAt = entries.length === 0 ? -1 : Math.min(entryIndex, entries.length - 1);
|
|
3045
|
+
const presetKeys = new Set(props.presets.map((preset) => `${preset.block.pieceName} ${preset.block.name}`));
|
|
3046
|
+
const rows = [];
|
|
3047
|
+
if (searching) {
|
|
3048
|
+
for (const source of sources) {
|
|
3049
|
+
if (source.kind !== "list" || source.id === "recent") continue;
|
|
3050
|
+
rows.push({
|
|
3051
|
+
type: "list",
|
|
3052
|
+
source
|
|
3053
|
+
});
|
|
3054
|
+
for (const entry of source.entries) rows.push({
|
|
3055
|
+
type: "entry",
|
|
3056
|
+
entry
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
const groups = search.kind === "done" ? search.result.pieces.map((match) => ({
|
|
3060
|
+
...match,
|
|
3061
|
+
blocks: match.blocks.filter((hit) => !presetKeys.has(`${hit.pieceName} ${hit.name}`))
|
|
3062
|
+
})).filter((match) => match.blocks.length > 0) : [];
|
|
3063
|
+
for (const match of groups) {
|
|
3064
|
+
rows.push({
|
|
3065
|
+
type: "piece",
|
|
3066
|
+
match
|
|
3067
|
+
});
|
|
3068
|
+
const shown = groups.length <= 2 || expanded.has(match.pieceName) ? match.blocks : match.blocks.slice(0, GROUP_BLOCKS);
|
|
3069
|
+
const logo = /* @__PURE__ */ jsx(LogoFrame, {
|
|
3070
|
+
src: match.logoUrl,
|
|
3071
|
+
alt: match.displayName,
|
|
3072
|
+
size: ROW_LOGO
|
|
3073
|
+
});
|
|
3074
|
+
for (const hit of shown) rows.push({
|
|
3075
|
+
type: "entry",
|
|
3076
|
+
entry: blockEntry(hit, logo)
|
|
3077
|
+
});
|
|
3078
|
+
if (shown.length < match.blocks.length) rows.push({
|
|
3079
|
+
type: "more",
|
|
3080
|
+
pieceName: match.pieceName,
|
|
3081
|
+
hidden: match.blocks.length - shown.length
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
const partial = !pieceSource?.searchPieces || search.kind === "done" && search.result.status !== "ready";
|
|
3085
|
+
if (showCatalog && partial) {
|
|
3086
|
+
const grouped = new Set(groups.map((match) => match.pieceName));
|
|
3087
|
+
const named = (source) => source.kind === "piece" && matchesQuery(source.piece.displayName, tokens) ? 0 : 1;
|
|
3088
|
+
for (const source of [...sources].sort((a, b) => named(a) - named(b))) {
|
|
3089
|
+
if (source.kind !== "piece" || grouped.has(source.id)) continue;
|
|
3090
|
+
rows.push({
|
|
3091
|
+
type: "piece",
|
|
3092
|
+
match: {
|
|
3093
|
+
pieceName: source.piece.name,
|
|
3094
|
+
pieceVersion: source.piece.version ?? "",
|
|
3095
|
+
displayName: source.piece.displayName,
|
|
3096
|
+
description: source.piece.description,
|
|
3097
|
+
logoUrl: source.piece.logoUrl,
|
|
3098
|
+
categories: source.piece.categories,
|
|
3099
|
+
source: source.piece.source ?? "activepieces",
|
|
3100
|
+
namedPiece: true,
|
|
3101
|
+
blocks: []
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
const activeRow = rowIndex < 0 ? rows.findIndex((row) => row.type === "entry") : Math.min(rowIndex, rows.length - 1);
|
|
3108
|
+
const twoPane = showCatalog || sources.length > 1;
|
|
3109
|
+
const pane = twoPane ? paneState : "entries";
|
|
3110
|
+
const selectSource = (id) => {
|
|
3111
|
+
setSelectedId(id);
|
|
3112
|
+
setPane("sources");
|
|
3113
|
+
setEntryIndex(-1);
|
|
3114
|
+
};
|
|
3115
|
+
const openSource = (id) => {
|
|
3116
|
+
setSelectedId(id);
|
|
3117
|
+
setPane("entries");
|
|
3118
|
+
setEntryIndex(0);
|
|
3119
|
+
};
|
|
3120
|
+
const openPiece = (pieceName) => {
|
|
3121
|
+
if (!modePieces.some((piece) => piece.name === pieceName)) {
|
|
3122
|
+
setExpanded(/* @__PURE__ */ new Set([...expanded, pieceName]));
|
|
3123
|
+
return;
|
|
3124
|
+
}
|
|
3125
|
+
setQuery("");
|
|
3126
|
+
setChip(null);
|
|
3127
|
+
if (tab !== "all") setTab("all");
|
|
3128
|
+
openSource(pieceName);
|
|
3129
|
+
inputRef.current?.focus();
|
|
3130
|
+
};
|
|
3131
|
+
const hoverSource = (id) => {
|
|
3132
|
+
if (!pointerMoved.current) return;
|
|
3133
|
+
clearTimeout(hoverTimer.current);
|
|
3134
|
+
hoverTimer.current = setTimeout(() => selectSource(id), HOVER_PREVIEW_MS);
|
|
3135
|
+
};
|
|
3136
|
+
const step = (index, delta, count) => count === 0 ? index : Math.min(Math.max(index + delta, 0), count - 1);
|
|
3137
|
+
const onKeyDown = (event) => {
|
|
3138
|
+
const key = event.key;
|
|
3139
|
+
if (key !== "Escape" && event.target !== inputRef.current) return;
|
|
3140
|
+
if (key === "Escape") {
|
|
3141
|
+
event.stopPropagation();
|
|
3142
|
+
if (query !== "") setQuery("");
|
|
3143
|
+
else if (twoPane && pane === "entries" && !searching) setPane("sources");
|
|
3144
|
+
else onClose();
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
const delta = key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
|
|
3148
|
+
if (searching) {
|
|
3149
|
+
if (delta !== 0) {
|
|
3150
|
+
event.preventDefault();
|
|
3151
|
+
setRowIndex(Math.max(step(activeRow, delta, rows.length), 0));
|
|
3152
|
+
return;
|
|
3153
|
+
}
|
|
3154
|
+
if (key === "Enter") {
|
|
3155
|
+
event.preventDefault();
|
|
3156
|
+
if (search.kind === "done" && search.stale) return;
|
|
3157
|
+
const row = rows.at(activeRow);
|
|
3158
|
+
if (!row) return;
|
|
3159
|
+
if (row.type === "entry") {
|
|
3160
|
+
if (row.entry.unavailable === void 0) row.entry.pick();
|
|
3161
|
+
} else if (row.type === "piece") openPiece(row.match.pieceName);
|
|
3162
|
+
else if (row.type === "list") openSource(row.source.id);
|
|
3163
|
+
else setExpanded(/* @__PURE__ */ new Set([...expanded, row.pieceName]));
|
|
3164
|
+
}
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
const sideways = query === "";
|
|
3168
|
+
if (pane === "sources") {
|
|
3169
|
+
if (delta !== 0) {
|
|
3170
|
+
event.preventDefault();
|
|
3171
|
+
const next = sources.at(step(sourceIndex, delta, sources.length));
|
|
3172
|
+
if (next) selectSource(next.id);
|
|
3173
|
+
} else if (key === "Enter" || sideways && key === "ArrowRight") {
|
|
3174
|
+
event.preventDefault();
|
|
3175
|
+
if (selected) openSource(selected.id);
|
|
3176
|
+
}
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
if (delta !== 0) {
|
|
3180
|
+
event.preventDefault();
|
|
3181
|
+
setEntryIndex(step(entryIndex, delta, entries.length));
|
|
3182
|
+
} else if (sideways && key === "ArrowLeft") {
|
|
3183
|
+
event.preventDefault();
|
|
3184
|
+
setPane("sources");
|
|
3185
|
+
} else if (key === "Enter") {
|
|
3186
|
+
event.preventDefault();
|
|
3187
|
+
const entry = entryAt < 0 ? void 0 : entries.at(entryAt);
|
|
3188
|
+
if (entry && entry.unavailable === void 0) entry.pick();
|
|
3189
|
+
}
|
|
3190
|
+
};
|
|
3191
|
+
const width = props.width ?? (pieceSource ? PICKER_SIZE.width : 360);
|
|
3192
|
+
const activeList = searching ? listIds.results : pane === "entries" ? listIds.entries : listIds.sources;
|
|
3193
|
+
const activeIndex = searching ? activeRow : pane === "entries" ? entryAt : sourceIndex;
|
|
3194
|
+
const activeOption = activeIndex >= 0 ? optionId(activeList, activeIndex) : void 0;
|
|
3195
|
+
const searchStatus = search.kind === "loading" || search.kind === "done" && search.stale ? /* @__PURE__ */ jsx(Status, { children: "Searching…" }) : search.kind === "error" ? /* @__PURE__ */ jsx(Status, {
|
|
3196
|
+
error: true,
|
|
3197
|
+
children: search.message
|
|
3198
|
+
}) : search.kind === "done" && search.result.status === "indexing" ? /* @__PURE__ */ jsx(Status, { children: "Still indexing the catalog: pieces are matched by name until it is ready." }) : search.kind === "done" && search.result.status === "error" ? /* @__PURE__ */ jsxs(Status, {
|
|
3199
|
+
error: true,
|
|
3200
|
+
children: [search.result.error ?? "Search failed", "; pieces are matched by name."]
|
|
3201
|
+
}) : rows.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
|
|
3202
|
+
"No matching ",
|
|
3203
|
+
kind,
|
|
3204
|
+
"s"
|
|
3205
|
+
] }) : null;
|
|
3206
|
+
const compact = !twoPane && !searching;
|
|
3207
|
+
const height = props.height ?? PICKER_SIZE.height;
|
|
3208
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3209
|
+
ref: containerRef,
|
|
3210
|
+
className: "nodrag nopan nowheel flex flex-col overflow-hidden rounded-lg border border-solid border-foreground/10 bg-card shadow-xl",
|
|
3211
|
+
style: compact ? {
|
|
3212
|
+
width,
|
|
3213
|
+
maxHeight: height
|
|
3214
|
+
} : {
|
|
3215
|
+
width,
|
|
3216
|
+
height
|
|
3217
|
+
},
|
|
3218
|
+
onClick: (event) => event.stopPropagation(),
|
|
3219
|
+
onKeyDown,
|
|
3220
|
+
onMouseMove: () => {
|
|
3221
|
+
pointerMoved.current = true;
|
|
3222
|
+
},
|
|
3223
|
+
children: [
|
|
3224
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3225
|
+
className: "shrink-0 border-b border-foreground/10",
|
|
3226
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
3227
|
+
className: "flex items-center gap-2 px-3.5 pt-3 text-muted-foreground",
|
|
3228
|
+
children: [
|
|
3229
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
3230
|
+
name: "search",
|
|
3231
|
+
size: 15
|
|
3232
|
+
}),
|
|
3233
|
+
/* @__PURE__ */ jsx("input", {
|
|
3234
|
+
ref: inputRef,
|
|
3235
|
+
autoFocus: true,
|
|
3236
|
+
role: "combobox",
|
|
3237
|
+
"aria-expanded": true,
|
|
3238
|
+
"aria-autocomplete": "list",
|
|
3239
|
+
"aria-label": `Search ${props.title.toLowerCase()}`,
|
|
3240
|
+
"aria-controls": activeList,
|
|
3241
|
+
"aria-activedescendant": activeOption,
|
|
3242
|
+
className: "min-w-0 flex-1 bg-transparent py-1 text-sm text-foreground outline-none placeholder:text-muted-foreground",
|
|
3243
|
+
placeholder: pieceSource ? `Search pieces and ${kind}s…` : "Search…",
|
|
3244
|
+
value: query,
|
|
3245
|
+
onChange: (event) => {
|
|
3246
|
+
setQuery(event.target.value);
|
|
3247
|
+
setRowIndex(-1);
|
|
3248
|
+
setExpanded(/* @__PURE__ */ new Set());
|
|
3249
|
+
}
|
|
3250
|
+
}),
|
|
3251
|
+
/* @__PURE__ */ jsx("span", {
|
|
3252
|
+
className: "shrink-0 truncate text-xs",
|
|
3253
|
+
children: props.title
|
|
3254
|
+
})
|
|
3255
|
+
]
|
|
3256
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3257
|
+
className: "px-3 pb-2.5 pt-2",
|
|
3258
|
+
children: /* @__PURE__ */ jsx(Tabs, {
|
|
3259
|
+
tabs,
|
|
3260
|
+
active: tab,
|
|
3261
|
+
onSelect: (next, fromKeyboard) => {
|
|
3262
|
+
setTab(next);
|
|
3263
|
+
setChip(null);
|
|
3264
|
+
setSelectedId(null);
|
|
3265
|
+
setPane("sources");
|
|
3266
|
+
if (!fromKeyboard) inputRef.current?.focus();
|
|
3267
|
+
}
|
|
3268
|
+
})
|
|
3269
|
+
})]
|
|
3270
|
+
}),
|
|
3271
|
+
showChips && catalog && !catalog.error ? /* @__PURE__ */ jsx(ChipBar, { children: chips.map((label, index) => /* @__PURE__ */ jsx(Chip, {
|
|
3272
|
+
label,
|
|
3273
|
+
active: activeChip === label,
|
|
3274
|
+
tabStop: activeChip === null ? index === 0 : activeChip === label,
|
|
3275
|
+
onClick: (fromKeyboard) => {
|
|
3276
|
+
setChip(activeChip === label ? null : label);
|
|
3277
|
+
setSelectedId(null);
|
|
3278
|
+
if (!fromKeyboard) inputRef.current?.focus();
|
|
3279
|
+
}
|
|
3280
|
+
}, label)) }) : null,
|
|
3281
|
+
searching ? /* @__PURE__ */ jsx(SearchList, {
|
|
3282
|
+
rows,
|
|
3283
|
+
tokens,
|
|
3284
|
+
activeIndex: activeRow,
|
|
3285
|
+
onActivate: (index) => {
|
|
3286
|
+
if (pointerMoved.current) setRowIndex(index);
|
|
3287
|
+
},
|
|
3288
|
+
onOpenPiece: openPiece,
|
|
3289
|
+
onOpenList: (id) => {
|
|
3290
|
+
setQuery("");
|
|
3291
|
+
openSource(id);
|
|
3292
|
+
},
|
|
3293
|
+
onExpand: (name) => setExpanded(/* @__PURE__ */ new Set([...expanded, name])),
|
|
3294
|
+
status: searchStatus,
|
|
3295
|
+
kind,
|
|
3296
|
+
listId: listIds.results,
|
|
3297
|
+
resetKey: `${query} ${JSON.stringify(searchFilter)}`,
|
|
3298
|
+
stale: search.kind === "done" && search.stale
|
|
3299
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
3300
|
+
className: "flex min-h-0 flex-1",
|
|
3301
|
+
children: [twoPane ? /* @__PURE__ */ jsxs("div", {
|
|
3302
|
+
className: "flex w-56 shrink-0 flex-col border-r border-foreground/10 bg-foreground/[0.025]",
|
|
3303
|
+
children: [
|
|
3304
|
+
catalog?.error ? /* @__PURE__ */ jsxs("div", {
|
|
3305
|
+
className: "flex items-center gap-2 px-3 py-2 text-xs text-wf-fail",
|
|
3306
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3307
|
+
className: "min-w-0 flex-1",
|
|
3308
|
+
children: catalog.error
|
|
3309
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3310
|
+
type: "button",
|
|
3311
|
+
className: "shrink-0 cursor-pointer rounded border border-solid border-foreground/15 bg-card px-1.5 py-0.5 text-foreground hover:border-foreground/25",
|
|
3312
|
+
onClick: () => {
|
|
3313
|
+
setCatalog(null);
|
|
3314
|
+
setCatalogRound((round) => round + 1);
|
|
3315
|
+
},
|
|
3316
|
+
children: "Retry"
|
|
3317
|
+
})]
|
|
3318
|
+
}) : null,
|
|
3319
|
+
/* @__PURE__ */ jsx(VirtualList, {
|
|
3320
|
+
id: listIds.sources,
|
|
3321
|
+
label: "Pieces",
|
|
3322
|
+
resetKey: `${tab} ${activeChip ?? ""} ${query}`,
|
|
3323
|
+
className: "flex-1 py-1",
|
|
3324
|
+
items: sources,
|
|
3325
|
+
heightOf: sourceHeight,
|
|
3326
|
+
keyOf: (source) => `${source.kind}:${source.id}`,
|
|
3327
|
+
activeIndex: sourceIndex,
|
|
3328
|
+
render: (source, index) => /* @__PURE__ */ jsx(SourceRow, {
|
|
3329
|
+
source,
|
|
3330
|
+
tokens,
|
|
3331
|
+
mode,
|
|
3332
|
+
active: pane === "sources" && index === sourceIndex,
|
|
3333
|
+
selected: index === sourceIndex,
|
|
3334
|
+
option: {
|
|
3335
|
+
list: listIds.sources,
|
|
3336
|
+
index,
|
|
3337
|
+
size: sources.length
|
|
3338
|
+
},
|
|
3339
|
+
onActivate: () => hoverSource(source.id),
|
|
3340
|
+
onOpen: () => {
|
|
3341
|
+
clearTimeout(hoverTimer.current);
|
|
3342
|
+
openSource(source.id);
|
|
3343
|
+
inputRef.current?.focus();
|
|
3344
|
+
}
|
|
3345
|
+
})
|
|
3346
|
+
}),
|
|
3347
|
+
showCatalog && catalog === null ? /* @__PURE__ */ jsx(Status, { children: "Loading catalog…" }) : sources.length === 0 ? /* @__PURE__ */ jsx(Status, { children: tab === "powerhouse" && tokens.length === 0 ? "No registry pieces on this runtime" : "No matching pieces" }) : null
|
|
3348
|
+
]
|
|
3349
|
+
}) : null, /* @__PURE__ */ jsx(EntriesPane, {
|
|
3350
|
+
source: selected,
|
|
3351
|
+
mode,
|
|
3352
|
+
pieceEntries,
|
|
3353
|
+
pieceError: selected?.kind === "piece" ? loaded.error : null,
|
|
3354
|
+
tokens,
|
|
3355
|
+
activeIndex: pane === "entries" ? entryAt : -1,
|
|
3356
|
+
listId: listIds.entries,
|
|
3357
|
+
showHeader: twoPane,
|
|
3358
|
+
onActivate: (index) => {
|
|
3359
|
+
if (!pointerMoved.current) return;
|
|
3360
|
+
setPane("entries");
|
|
3361
|
+
setEntryIndex(index);
|
|
3362
|
+
}
|
|
3363
|
+
})]
|
|
3364
|
+
})
|
|
3365
|
+
]
|
|
3366
|
+
});
|
|
3367
|
+
}
|
|
3368
|
+
//#endregion
|
|
3369
|
+
export { useOptionSearch as $, formatTrigger as A, Button as At, DesignTimeProvider as B, Tooltip as Bt, TONE_DOT as C, useRuntime as Ct, formatAbsolute as D, ITEM_PARAM as Dt, durationMs as E, useWaitingRunsQuery as Et, runTimeline as F, Segmented as Ft, useBlockResolutions as G, isIconName as Gt, useBlockFormLoader as H, textAreaClass as Ht, runTone as I, Select as It, useDesignTime as J, errorMessage as Jt, useCachedBlockForm as K, DocumentErrorBoundary as Kt, statusLabel as L, Switch as Lt, formatWhen as M, FieldLabel as Mt, runStats as N, Hint as Nt, formatDuration as O, useSearchParam as Ot, runStatusLabel as P, IconButton as Pt, useLatestRun as Q, toneOf as R, Tabs$1 as Rt, STEP_TONE as S, useRunsQuery as St, canRerun as T, useSecretStat as Tt, useBlockForms as U, textInputClass as Ut, useBlockForm as V, invalidClass as Vt, useBlockPorts as W, Icon as Wt, useDynamicLookup as X, useDynamicCache as Y, useDynamicPrefetch as Z, useBlockMeta as _, useOAuthAttempt as _t, BlockResolutionsProvider as a, blockMissing as at, RUN_STATUSES as b, useRunPagesQuery as bt, runsDifferentVersion as c, parsePropList as ct, versionBadge as d, storedSchema as dt, useResolvedProp as et, blockMeta as f, stripOptions as ft, stepSubtitle as g, WorkflowRuntimeProvider as gt, pieceLogo as h, workflowReadiness as ht, PickerPopover as i, useWebhookEndpoint as it, formatUntil as j, FieldError as jt, formatMs as k, useSearchParamDraft as kt, updateVersion as l, resolverInputFor as lt, pieceDisplayName as m, withSetting as mt, BlockSelector as n, useTestStepRunner as nt, VersionSummary as o, isEmptyValue as ot, namedByCoreTab as p, undeclaredPortIssues as pt, useConnectionList as q, DocumentLoadError as qt, PICKER_SIZE as r, useTestTrigger as rt, resolutionText as s, isPropVisible as st, BlockLogo as t, useRunById as tt, useResolution as u, settingFor as ut, usePieceLogos as v, useOAuthRedirectUri as vt, TONE_TEXT as w, useRuntimeActions as wt, RUN_TONE as x, useRunQuery as xt, CONNECTION_TONE as y, usePieceCatalog as yt, workflowHealth as z, Toggle as zt };
|
|
3370
|
+
|
|
3371
|
+
//# sourceMappingURL=BlockSelector-CEdYUqjx.js.map
|