ts-workflow-engine-lite 2.1.0
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 +21 -0
- package/README.md +352 -0
- package/dist/src/api/ConsoleWebSocketManager.d.ts +57 -0
- package/dist/src/api/ConsoleWebSocketManager.js +206 -0
- package/dist/src/api/ConsoleWebSocketManager.js.map +1 -0
- package/dist/src/api/ErrorHandler.d.ts +52 -0
- package/dist/src/api/ErrorHandler.js +115 -0
- package/dist/src/api/ErrorHandler.js.map +1 -0
- package/dist/src/api/EventHistory.d.ts +73 -0
- package/dist/src/api/EventHistory.js +309 -0
- package/dist/src/api/EventHistory.js.map +1 -0
- package/dist/src/api/WebhookManager.d.ts +67 -0
- package/dist/src/api/WebhookManager.js +568 -0
- package/dist/src/api/WebhookManager.js.map +1 -0
- package/dist/src/api/docsPage.d.ts +1 -0
- package/dist/src/api/docsPage.js +321 -0
- package/dist/src/api/docsPage.js.map +1 -0
- package/dist/src/api/index.d.ts +8 -0
- package/dist/src/api/index.js +8 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/api/middleware/auth.d.ts +19 -0
- package/dist/src/api/middleware/auth.js +122 -0
- package/dist/src/api/middleware/auth.js.map +1 -0
- package/dist/src/api/middleware/index.d.ts +3 -0
- package/dist/src/api/middleware/index.js +3 -0
- package/dist/src/api/middleware/index.js.map +1 -0
- package/dist/src/api/middleware/rateLimit.d.ts +6 -0
- package/dist/src/api/middleware/rateLimit.js +69 -0
- package/dist/src/api/middleware/rateLimit.js.map +1 -0
- package/dist/src/api/middleware/rateLimitStore.d.ts +14 -0
- package/dist/src/api/middleware/rateLimitStore.js +44 -0
- package/dist/src/api/middleware/rateLimitStore.js.map +1 -0
- package/dist/src/api/middleware/rbac.d.ts +12 -0
- package/dist/src/api/middleware/rbac.js +120 -0
- package/dist/src/api/middleware/rbac.js.map +1 -0
- package/dist/src/api/openapi.d.ts +1917 -0
- package/dist/src/api/openapi.js +1758 -0
- package/dist/src/api/openapi.js.map +1 -0
- package/dist/src/api/playgroundPage.d.ts +1 -0
- package/dist/src/api/playgroundPage.js +765 -0
- package/dist/src/api/playgroundPage.js.map +1 -0
- package/dist/src/api/response.d.ts +22 -0
- package/dist/src/api/response.js +119 -0
- package/dist/src/api/response.js.map +1 -0
- package/dist/src/api/router.d.ts +17 -0
- package/dist/src/api/router.js +94 -0
- package/dist/src/api/router.js.map +1 -0
- package/dist/src/api/routes/analytics.d.ts +10 -0
- package/dist/src/api/routes/analytics.js +144 -0
- package/dist/src/api/routes/analytics.js.map +1 -0
- package/dist/src/api/routes/dlq.d.ts +3 -0
- package/dist/src/api/routes/dlq.js +248 -0
- package/dist/src/api/routes/dlq.js.map +1 -0
- package/dist/src/api/routes/eventHistory.d.ts +3 -0
- package/dist/src/api/routes/eventHistory.js +48 -0
- package/dist/src/api/routes/eventHistory.js.map +1 -0
- package/dist/src/api/routes/events.d.ts +3 -0
- package/dist/src/api/routes/events.js +205 -0
- package/dist/src/api/routes/events.js.map +1 -0
- package/dist/src/api/routes/functions.d.ts +3 -0
- package/dist/src/api/routes/functions.js +85 -0
- package/dist/src/api/routes/functions.js.map +1 -0
- package/dist/src/api/routes/instances.d.ts +3 -0
- package/dist/src/api/routes/instances.js +790 -0
- package/dist/src/api/routes/instances.js.map +1 -0
- package/dist/src/api/routes/templates.d.ts +3 -0
- package/dist/src/api/routes/templates.js +195 -0
- package/dist/src/api/routes/templates.js.map +1 -0
- package/dist/src/api/routes/webhooks.d.ts +3 -0
- package/dist/src/api/routes/webhooks.js +263 -0
- package/dist/src/api/routes/webhooks.js.map +1 -0
- package/dist/src/api/routes/workflows/analysis.d.ts +2 -0
- package/dist/src/api/routes/workflows/analysis.js +112 -0
- package/dist/src/api/routes/workflows/analysis.js.map +1 -0
- package/dist/src/api/routes/workflows/crud.d.ts +2 -0
- package/dist/src/api/routes/workflows/crud.js +140 -0
- package/dist/src/api/routes/workflows/crud.js.map +1 -0
- package/dist/src/api/routes/workflows/execution.d.ts +2 -0
- package/dist/src/api/routes/workflows/execution.js +204 -0
- package/dist/src/api/routes/workflows/execution.js.map +1 -0
- package/dist/src/api/routes/workflows/graph.d.ts +2 -0
- package/dist/src/api/routes/workflows/graph.js +51 -0
- package/dist/src/api/routes/workflows/graph.js.map +1 -0
- package/dist/src/api/routes/workflows/import.d.ts +2 -0
- package/dist/src/api/routes/workflows/import.js +238 -0
- package/dist/src/api/routes/workflows/import.js.map +1 -0
- package/dist/src/api/routes/workflows/index.d.ts +3 -0
- package/dist/src/api/routes/workflows/index.js +18 -0
- package/dist/src/api/routes/workflows/index.js.map +1 -0
- package/dist/src/api/routes/workflows/shared.d.ts +64 -0
- package/dist/src/api/routes/workflows/shared.js +304 -0
- package/dist/src/api/routes/workflows/shared.js.map +1 -0
- package/dist/src/api/routes/workflows/variables.d.ts +2 -0
- package/dist/src/api/routes/workflows/variables.js +34 -0
- package/dist/src/api/routes/workflows/variables.js.map +1 -0
- package/dist/src/api/routes/workflows/versioning.d.ts +2 -0
- package/dist/src/api/routes/workflows/versioning.js +235 -0
- package/dist/src/api/routes/workflows/versioning.js.map +1 -0
- package/dist/src/api/server.d.ts +13 -0
- package/dist/src/api/server.js +311 -0
- package/dist/src/api/server.js.map +1 -0
- package/dist/src/api/services/InstanceApplicationService.d.ts +74 -0
- package/dist/src/api/services/InstanceApplicationService.js +215 -0
- package/dist/src/api/services/InstanceApplicationService.js.map +1 -0
- package/dist/src/api/services/WorkflowApplicationService.d.ts +92 -0
- package/dist/src/api/services/WorkflowApplicationService.js +282 -0
- package/dist/src/api/services/WorkflowApplicationService.js.map +1 -0
- package/dist/src/api/services/index.d.ts +4 -0
- package/dist/src/api/services/index.js +3 -0
- package/dist/src/api/services/index.js.map +1 -0
- package/dist/src/api/types.d.ts +118 -0
- package/dist/src/api/types.js +2 -0
- package/dist/src/api/types.js.map +1 -0
- package/dist/src/api/utils/IdempotencyStore.d.ts +36 -0
- package/dist/src/api/utils/IdempotencyStore.js +121 -0
- package/dist/src/api/utils/IdempotencyStore.js.map +1 -0
- package/dist/src/api/utils/authConfig.d.ts +2 -0
- package/dist/src/api/utils/authConfig.js +25 -0
- package/dist/src/api/utils/authConfig.js.map +1 -0
- package/dist/src/api/utils/requestContext.d.ts +14 -0
- package/dist/src/api/utils/requestContext.js +31 -0
- package/dist/src/api/utils/requestContext.js.map +1 -0
- package/dist/src/api/utils/routeHelper.d.ts +25 -0
- package/dist/src/api/utils/routeHelper.js +30 -0
- package/dist/src/api/utils/routeHelper.js.map +1 -0
- package/dist/src/api/welcomePage.d.ts +1 -0
- package/dist/src/api/welcomePage.js +259 -0
- package/dist/src/api/welcomePage.js.map +1 -0
- package/dist/src/bootstrap.d.ts +20 -0
- package/dist/src/bootstrap.js +128 -0
- package/dist/src/bootstrap.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +32 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config/AppConfig.d.ts +102 -0
- package/dist/src/config/AppConfig.js +452 -0
- package/dist/src/config/AppConfig.js.map +1 -0
- package/dist/src/config/redis.config.d.ts +6 -0
- package/dist/src/config/redis.config.js +9 -0
- package/dist/src/config/redis.config.js.map +1 -0
- package/dist/src/container.d.ts +29 -0
- package/dist/src/container.js +62 -0
- package/dist/src/container.js.map +1 -0
- package/dist/src/debug/BreakpointManager.d.ts +17 -0
- package/dist/src/debug/BreakpointManager.js +59 -0
- package/dist/src/debug/BreakpointManager.js.map +1 -0
- package/dist/src/debug/WorkflowDebugger.d.ts +34 -0
- package/dist/src/debug/WorkflowDebugger.js +117 -0
- package/dist/src/debug/WorkflowDebugger.js.map +1 -0
- package/dist/src/debug/index.d.ts +2 -0
- package/dist/src/debug/index.js +3 -0
- package/dist/src/debug/index.js.map +1 -0
- package/dist/src/demo/demoWorkflow.d.ts +3 -0
- package/dist/src/demo/demoWorkflow.js +82 -0
- package/dist/src/demo/demoWorkflow.js.map +1 -0
- package/dist/src/demo/exampleWorkflow.d.ts +36 -0
- package/dist/src/demo/exampleWorkflow.js +184 -0
- package/dist/src/demo/exampleWorkflow.js.map +1 -0
- package/dist/src/demo/index.d.ts +2 -0
- package/dist/src/demo/index.js +3 -0
- package/dist/src/demo/index.js.map +1 -0
- package/dist/src/dlq/DeadLetterQueue.d.ts +62 -0
- package/dist/src/dlq/DeadLetterQueue.js +342 -0
- package/dist/src/dlq/DeadLetterQueue.js.map +1 -0
- package/dist/src/dlq/index.d.ts +2 -0
- package/dist/src/dlq/index.js +2 -0
- package/dist/src/dlq/index.js.map +1 -0
- package/dist/src/dsl/DSLParser.d.ts +7 -0
- package/dist/src/dsl/DSLParser.js +252 -0
- package/dist/src/dsl/DSLParser.js.map +1 -0
- package/dist/src/dsl/WorkflowDSL.d.ts +40 -0
- package/dist/src/dsl/WorkflowDSL.js +2 -0
- package/dist/src/dsl/WorkflowDSL.js.map +1 -0
- package/dist/src/engine/CanaryReleaseManager.d.ts +39 -0
- package/dist/src/engine/CanaryReleaseManager.js +192 -0
- package/dist/src/engine/CanaryReleaseManager.js.map +1 -0
- package/dist/src/engine/ConcurrencyControl.d.ts +38 -0
- package/dist/src/engine/ConcurrencyControl.js +181 -0
- package/dist/src/engine/ConcurrencyControl.js.map +1 -0
- package/dist/src/engine/ContinueAsNewManager.d.ts +18 -0
- package/dist/src/engine/ContinueAsNewManager.js +29 -0
- package/dist/src/engine/ContinueAsNewManager.js.map +1 -0
- package/dist/src/engine/DataValidator.d.ts +15 -0
- package/dist/src/engine/DataValidator.js +121 -0
- package/dist/src/engine/DataValidator.js.map +1 -0
- package/dist/src/engine/DryRunExecutor.d.ts +48 -0
- package/dist/src/engine/DryRunExecutor.js +256 -0
- package/dist/src/engine/DryRunExecutor.js.map +1 -0
- package/dist/src/engine/ExecutionOrchestrator.d.ts +19 -0
- package/dist/src/engine/ExecutionOrchestrator.js +579 -0
- package/dist/src/engine/ExecutionOrchestrator.js.map +1 -0
- package/dist/src/engine/ExpressionEvaluator.d.ts +44 -0
- package/dist/src/engine/ExpressionEvaluator.js +1046 -0
- package/dist/src/engine/ExpressionEvaluator.js.map +1 -0
- package/dist/src/engine/HeartbeatManager.d.ts +42 -0
- package/dist/src/engine/HeartbeatManager.js +209 -0
- package/dist/src/engine/HeartbeatManager.js.map +1 -0
- package/dist/src/engine/InstanceManager.d.ts +21 -0
- package/dist/src/engine/InstanceManager.js +165 -0
- package/dist/src/engine/InstanceManager.js.map +1 -0
- package/dist/src/engine/InstanceSearch.d.ts +30 -0
- package/dist/src/engine/InstanceSearch.js +119 -0
- package/dist/src/engine/InstanceSearch.js.map +1 -0
- package/dist/src/engine/LifecycleManager.d.ts +18 -0
- package/dist/src/engine/LifecycleManager.js +82 -0
- package/dist/src/engine/LifecycleManager.js.map +1 -0
- package/dist/src/engine/ParallelExecutor.d.ts +26 -0
- package/dist/src/engine/ParallelExecutor.js +138 -0
- package/dist/src/engine/ParallelExecutor.js.map +1 -0
- package/dist/src/engine/SandboxEvaluator.d.ts +18 -0
- package/dist/src/engine/SandboxEvaluator.js +200 -0
- package/dist/src/engine/SandboxEvaluator.js.map +1 -0
- package/dist/src/engine/SchemaValidator.d.ts +30 -0
- package/dist/src/engine/SchemaValidator.js +630 -0
- package/dist/src/engine/SchemaValidator.js.map +1 -0
- package/dist/src/engine/SearchAttributeManager.d.ts +48 -0
- package/dist/src/engine/SearchAttributeManager.js +119 -0
- package/dist/src/engine/SearchAttributeManager.js.map +1 -0
- package/dist/src/engine/StateMachine.d.ts +13 -0
- package/dist/src/engine/StateMachine.js +66 -0
- package/dist/src/engine/StateMachine.js.map +1 -0
- package/dist/src/engine/StickyExecutionManager.d.ts +34 -0
- package/dist/src/engine/StickyExecutionManager.js +163 -0
- package/dist/src/engine/StickyExecutionManager.js.map +1 -0
- package/dist/src/engine/SubworkflowExecutor.d.ts +17 -0
- package/dist/src/engine/SubworkflowExecutor.js +157 -0
- package/dist/src/engine/SubworkflowExecutor.js.map +1 -0
- package/dist/src/engine/TaskExecutor.d.ts +12 -0
- package/dist/src/engine/TaskExecutor.js +124 -0
- package/dist/src/engine/TaskExecutor.js.map +1 -0
- package/dist/src/engine/TaskQueueManager.d.ts +42 -0
- package/dist/src/engine/TaskQueueManager.js +175 -0
- package/dist/src/engine/TaskQueueManager.js.map +1 -0
- package/dist/src/engine/WorkflowEngine.d.ts +117 -0
- package/dist/src/engine/WorkflowEngine.js +443 -0
- package/dist/src/engine/WorkflowEngine.js.map +1 -0
- package/dist/src/engine/WorkflowInstanceControl.d.ts +21 -0
- package/dist/src/engine/WorkflowInstanceControl.js +306 -0
- package/dist/src/engine/WorkflowInstanceControl.js.map +1 -0
- package/dist/src/engine/WorkflowPersistenceCoordinator.d.ts +12 -0
- package/dist/src/engine/WorkflowPersistenceCoordinator.js +93 -0
- package/dist/src/engine/WorkflowPersistenceCoordinator.js.map +1 -0
- package/dist/src/engine/WorkflowRegistry.d.ts +38 -0
- package/dist/src/engine/WorkflowRegistry.js +130 -0
- package/dist/src/engine/WorkflowRegistry.js.map +1 -0
- package/dist/src/engine/WorkflowVersionManager.d.ts +24 -0
- package/dist/src/engine/WorkflowVersionManager.js +121 -0
- package/dist/src/engine/WorkflowVersionManager.js.map +1 -0
- package/dist/src/engine/createEngine.d.ts +8 -0
- package/dist/src/engine/createEngine.js +21 -0
- package/dist/src/engine/createEngine.js.map +1 -0
- package/dist/src/engine/errors.d.ts +18 -0
- package/dist/src/engine/errors.js +37 -0
- package/dist/src/engine/errors.js.map +1 -0
- package/dist/src/engine/executors/ApprovalNodeExecutor.d.ts +12 -0
- package/dist/src/engine/executors/ApprovalNodeExecutor.js +68 -0
- package/dist/src/engine/executors/ApprovalNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/ConditionNodeExecutor.d.ts +16 -0
- package/dist/src/engine/executors/ConditionNodeExecutor.js +63 -0
- package/dist/src/engine/executors/ConditionNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/HttpNodeExecutor.d.ts +27 -0
- package/dist/src/engine/executors/HttpNodeExecutor.js +179 -0
- package/dist/src/engine/executors/HttpNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/JoinNodeExecutor.d.ts +13 -0
- package/dist/src/engine/executors/JoinNodeExecutor.js +37 -0
- package/dist/src/engine/executors/JoinNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/LoopNodeExecutor.d.ts +20 -0
- package/dist/src/engine/executors/LoopNodeExecutor.js +165 -0
- package/dist/src/engine/executors/LoopNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/NotificationNodeExecutor.d.ts +8 -0
- package/dist/src/engine/executors/NotificationNodeExecutor.js +33 -0
- package/dist/src/engine/executors/NotificationNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/QueueNodeExecutor.d.ts +23 -0
- package/dist/src/engine/executors/QueueNodeExecutor.js +87 -0
- package/dist/src/engine/executors/QueueNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/RouterNodeExecutor.d.ts +20 -0
- package/dist/src/engine/executors/RouterNodeExecutor.js +82 -0
- package/dist/src/engine/executors/RouterNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/SqlNodeExecutor.d.ts +27 -0
- package/dist/src/engine/executors/SqlNodeExecutor.js +74 -0
- package/dist/src/engine/executors/SqlNodeExecutor.js.map +1 -0
- package/dist/src/engine/executors/TransformNodeExecutor.d.ts +9 -0
- package/dist/src/engine/executors/TransformNodeExecutor.js +44 -0
- package/dist/src/engine/executors/TransformNodeExecutor.js.map +1 -0
- package/dist/src/engine/functions/collectionFunctions.d.ts +2 -0
- package/dist/src/engine/functions/collectionFunctions.js +129 -0
- package/dist/src/engine/functions/collectionFunctions.js.map +1 -0
- package/dist/src/engine/functions/customFunctions.d.ts +11 -0
- package/dist/src/engine/functions/customFunctions.js +42 -0
- package/dist/src/engine/functions/customFunctions.js.map +1 -0
- package/dist/src/engine/functions/dateFunctions.d.ts +2 -0
- package/dist/src/engine/functions/dateFunctions.js +71 -0
- package/dist/src/engine/functions/dateFunctions.js.map +1 -0
- package/dist/src/engine/functions/index.d.ts +14 -0
- package/dist/src/engine/functions/index.js +35 -0
- package/dist/src/engine/functions/index.js.map +1 -0
- package/dist/src/engine/functions/stringFunctions.d.ts +2 -0
- package/dist/src/engine/functions/stringFunctions.js +66 -0
- package/dist/src/engine/functions/stringFunctions.js.map +1 -0
- package/dist/src/engine/functions/typeFunctions.d.ts +2 -0
- package/dist/src/engine/functions/typeFunctions.js +70 -0
- package/dist/src/engine/functions/typeFunctions.js.map +1 -0
- package/dist/src/engine/functions/types.d.ts +6 -0
- package/dist/src/engine/functions/types.js +2 -0
- package/dist/src/engine/functions/types.js.map +1 -0
- package/dist/src/engine/index.d.ts +21 -0
- package/dist/src/engine/index.js +18 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/nodeDispatch/controlNodes.d.ts +2 -0
- package/dist/src/engine/nodeDispatch/controlNodes.js +208 -0
- package/dist/src/engine/nodeDispatch/controlNodes.js.map +1 -0
- package/dist/src/engine/nodeDispatch/helpers.d.ts +27 -0
- package/dist/src/engine/nodeDispatch/helpers.js +185 -0
- package/dist/src/engine/nodeDispatch/helpers.js.map +1 -0
- package/dist/src/engine/nodeDispatch/ioNodes.d.ts +2 -0
- package/dist/src/engine/nodeDispatch/ioNodes.js +89 -0
- package/dist/src/engine/nodeDispatch/ioNodes.js.map +1 -0
- package/dist/src/engine/nodeDispatch/types.d.ts +13 -0
- package/dist/src/engine/nodeDispatch/types.js +2 -0
- package/dist/src/engine/nodeDispatch/types.js.map +1 -0
- package/dist/src/engine/nodeDispatch/workflowNodes.d.ts +2 -0
- package/dist/src/engine/nodeDispatch/workflowNodes.js +33 -0
- package/dist/src/engine/nodeDispatch/workflowNodes.js.map +1 -0
- package/dist/src/engine/worker/ActionSandboxMessage.d.ts +29 -0
- package/dist/src/engine/worker/ActionSandboxMessage.js +7 -0
- package/dist/src/engine/worker/ActionSandboxMessage.js.map +1 -0
- package/dist/src/engine/worker/ActionSandboxPool.d.ts +34 -0
- package/dist/src/engine/worker/ActionSandboxPool.js +204 -0
- package/dist/src/engine/worker/ActionSandboxPool.js.map +1 -0
- package/dist/src/engine/worker/ActionSandboxWorker.d.ts +1 -0
- package/dist/src/engine/worker/ActionSandboxWorker.js +25 -0
- package/dist/src/engine/worker/ActionSandboxWorker.js.map +1 -0
- package/dist/src/engine/worker/WorkerMessage.d.ts +35 -0
- package/dist/src/engine/worker/WorkerMessage.js +7 -0
- package/dist/src/engine/worker/WorkerMessage.js.map +1 -0
- package/dist/src/engine/worker/WorkerPool.d.ts +42 -0
- package/dist/src/engine/worker/WorkerPool.js +273 -0
- package/dist/src/engine/worker/WorkerPool.js.map +1 -0
- package/dist/src/engine/worker/WorkerProcess.d.ts +1 -0
- package/dist/src/engine/worker/WorkerProcess.js +76 -0
- package/dist/src/engine/worker/WorkerProcess.js.map +1 -0
- package/dist/src/event/EventBus.d.ts +11 -0
- package/dist/src/event/EventBus.js +44 -0
- package/dist/src/event/EventBus.js.map +1 -0
- package/dist/src/event/EventCoordinator.d.ts +26 -0
- package/dist/src/event/EventCoordinator.js +205 -0
- package/dist/src/event/EventCoordinator.js.map +1 -0
- package/dist/src/event/EventDeduplicator.d.ts +31 -0
- package/dist/src/event/EventDeduplicator.js +100 -0
- package/dist/src/event/EventDeduplicator.js.map +1 -0
- package/dist/src/event/HookManager.d.ts +31 -0
- package/dist/src/event/HookManager.js +88 -0
- package/dist/src/event/HookManager.js.map +1 -0
- package/dist/src/event/MessageBus.d.ts +39 -0
- package/dist/src/event/MessageBus.js +131 -0
- package/dist/src/event/MessageBus.js.map +1 -0
- package/dist/src/event/index.d.ts +3 -0
- package/dist/src/event/index.js +4 -0
- package/dist/src/event/index.js.map +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.js +33 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lifecycle.d.ts +17 -0
- package/dist/src/lifecycle.js +84 -0
- package/dist/src/lifecycle.js.map +1 -0
- package/dist/src/metrics/AnalyticsCollector.d.ts +57 -0
- package/dist/src/metrics/AnalyticsCollector.js +140 -0
- package/dist/src/metrics/AnalyticsCollector.js.map +1 -0
- package/dist/src/metrics/AnomalyDetector.d.ts +21 -0
- package/dist/src/metrics/AnomalyDetector.js +120 -0
- package/dist/src/metrics/AnomalyDetector.js.map +1 -0
- package/dist/src/metrics/MetricsAggregator.d.ts +43 -0
- package/dist/src/metrics/MetricsAggregator.js +243 -0
- package/dist/src/metrics/MetricsAggregator.js.map +1 -0
- package/dist/src/metrics/SlaMonitor.d.ts +48 -0
- package/dist/src/metrics/SlaMonitor.js +130 -0
- package/dist/src/metrics/SlaMonitor.js.map +1 -0
- package/dist/src/metrics/index.d.ts +75 -0
- package/dist/src/metrics/index.js +293 -0
- package/dist/src/metrics/index.js.map +1 -0
- package/dist/src/model/Instance.d.ts +38 -0
- package/dist/src/model/Instance.js +12 -0
- package/dist/src/model/Instance.js.map +1 -0
- package/dist/src/model/RetryPolicy.d.ts +11 -0
- package/dist/src/model/RetryPolicy.js +30 -0
- package/dist/src/model/RetryPolicy.js.map +1 -0
- package/dist/src/model/Schedule.d.ts +34 -0
- package/dist/src/model/Schedule.js +50 -0
- package/dist/src/model/Schedule.js.map +1 -0
- package/dist/src/model/Workflow.d.ts +73 -0
- package/dist/src/model/Workflow.js +2 -0
- package/dist/src/model/Workflow.js.map +1 -0
- package/dist/src/model/WorkflowGraph.d.ts +32 -0
- package/dist/src/model/WorkflowGraph.js +267 -0
- package/dist/src/model/WorkflowGraph.js.map +1 -0
- package/dist/src/model/WorkflowSchema.d.ts +154 -0
- package/dist/src/model/WorkflowSchema.js +233 -0
- package/dist/src/model/WorkflowSchema.js.map +1 -0
- package/dist/src/model/WorkflowVariables.d.ts +15 -0
- package/dist/src/model/WorkflowVariables.js +77 -0
- package/dist/src/model/WorkflowVariables.js.map +1 -0
- package/dist/src/notification/NotificationChannel.d.ts +19 -0
- package/dist/src/notification/NotificationChannel.js +2 -0
- package/dist/src/notification/NotificationChannel.js.map +1 -0
- package/dist/src/notification/NotificationManager.d.ts +20 -0
- package/dist/src/notification/NotificationManager.js +59 -0
- package/dist/src/notification/NotificationManager.js.map +1 -0
- package/dist/src/notification/channels/DingtalkChannel.d.ts +7 -0
- package/dist/src/notification/channels/DingtalkChannel.js +18 -0
- package/dist/src/notification/channels/DingtalkChannel.js.map +1 -0
- package/dist/src/notification/channels/EmailChannel.d.ts +21 -0
- package/dist/src/notification/channels/EmailChannel.js +32 -0
- package/dist/src/notification/channels/EmailChannel.js.map +1 -0
- package/dist/src/notification/channels/FeishuChannel.d.ts +7 -0
- package/dist/src/notification/channels/FeishuChannel.js +18 -0
- package/dist/src/notification/channels/FeishuChannel.js.map +1 -0
- package/dist/src/notification/channels/SlackChannel.d.ts +7 -0
- package/dist/src/notification/channels/SlackChannel.js +18 -0
- package/dist/src/notification/channels/SlackChannel.js.map +1 -0
- package/dist/src/notification/channels/SmsChannel.d.ts +24 -0
- package/dist/src/notification/channels/SmsChannel.js +37 -0
- package/dist/src/notification/channels/SmsChannel.js.map +1 -0
- package/dist/src/notification/channels/WebhookChannel.d.ts +17 -0
- package/dist/src/notification/channels/WebhookChannel.js +61 -0
- package/dist/src/notification/channels/WebhookChannel.js.map +1 -0
- package/dist/src/notification/index.d.ts +24 -0
- package/dist/src/notification/index.js +61 -0
- package/dist/src/notification/index.js.map +1 -0
- package/dist/src/scheduler/CronScheduler.d.ts +20 -0
- package/dist/src/scheduler/CronScheduler.js +82 -0
- package/dist/src/scheduler/CronScheduler.js.map +1 -0
- package/dist/src/scheduler/EnhancedCronScheduler.d.ts +27 -0
- package/dist/src/scheduler/EnhancedCronScheduler.js +177 -0
- package/dist/src/scheduler/EnhancedCronScheduler.js.map +1 -0
- package/dist/src/storage/ArchiveManager.d.ts +21 -0
- package/dist/src/storage/ArchiveManager.js +140 -0
- package/dist/src/storage/ArchiveManager.js.map +1 -0
- package/dist/src/storage/LocalFileStorage.d.ts +64 -0
- package/dist/src/storage/LocalFileStorage.js +470 -0
- package/dist/src/storage/LocalFileStorage.js.map +1 -0
- package/dist/src/storage/MemoryStorage.d.ts +65 -0
- package/dist/src/storage/MemoryStorage.js +422 -0
- package/dist/src/storage/MemoryStorage.js.map +1 -0
- package/dist/src/storage/StorageProvider.d.ts +223 -0
- package/dist/src/storage/StorageProvider.js +2 -0
- package/dist/src/storage/StorageProvider.js.map +1 -0
- package/dist/src/storage/builtin-adapters.d.ts +1 -0
- package/dist/src/storage/builtin-adapters.js +20 -0
- package/dist/src/storage/builtin-adapters.js.map +1 -0
- package/dist/src/storage/index.d.ts +17 -0
- package/dist/src/storage/index.js +52 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/registry.d.ts +6 -0
- package/dist/src/storage/registry.js +23 -0
- package/dist/src/storage/registry.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +53 -0
- package/dist/src/telemetry/index.js +73 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/spanRegistry.d.ts +9 -0
- package/dist/src/telemetry/spanRegistry.js +14 -0
- package/dist/src/telemetry/spanRegistry.js.map +1 -0
- package/dist/src/templates/AutoExtract.d.ts +2 -0
- package/dist/src/templates/AutoExtract.js +124 -0
- package/dist/src/templates/AutoExtract.js.map +1 -0
- package/dist/src/templates/TemplateGallery.d.ts +54 -0
- package/dist/src/templates/TemplateGallery.js +139 -0
- package/dist/src/templates/TemplateGallery.js.map +1 -0
- package/dist/src/templates/TemplateRegistry.d.ts +16 -0
- package/dist/src/templates/TemplateRegistry.js +92 -0
- package/dist/src/templates/TemplateRegistry.js.map +1 -0
- package/dist/src/templates/WorkflowTemplate.d.ts +24 -0
- package/dist/src/templates/WorkflowTemplate.js +2 -0
- package/dist/src/templates/WorkflowTemplate.js.map +1 -0
- package/dist/src/templates/builtin/HttpCallbackTemplate.d.ts +2 -0
- package/dist/src/templates/builtin/HttpCallbackTemplate.js +47 -0
- package/dist/src/templates/builtin/HttpCallbackTemplate.js.map +1 -0
- package/dist/src/templates/builtin/index.d.ts +3 -0
- package/dist/src/templates/builtin/index.js +11 -0
- package/dist/src/templates/builtin/index.js.map +1 -0
- package/dist/src/templates/index.d.ts +3 -0
- package/dist/src/templates/index.js +3 -0
- package/dist/src/templates/index.js.map +1 -0
- package/dist/src/testing/MutationTester.d.ts +27 -0
- package/dist/src/testing/MutationTester.js +157 -0
- package/dist/src/testing/MutationTester.js.map +1 -0
- package/dist/src/testing/TestGenerator.d.ts +31 -0
- package/dist/src/testing/TestGenerator.js +345 -0
- package/dist/src/testing/TestGenerator.js.map +1 -0
- package/dist/src/testing/index.d.ts +2 -0
- package/dist/src/testing/index.js +3 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/testWorkflow.d.ts +51 -0
- package/dist/src/testing/testWorkflow.js +167 -0
- package/dist/src/testing/testWorkflow.js.map +1 -0
- package/dist/src/utils/AuditLogger.d.ts +36 -0
- package/dist/src/utils/AuditLogger.js +148 -0
- package/dist/src/utils/AuditLogger.js.map +1 -0
- package/dist/src/utils/BoundedMap.d.ts +34 -0
- package/dist/src/utils/BoundedMap.js +125 -0
- package/dist/src/utils/BoundedMap.js.map +1 -0
- package/dist/src/utils/LeaseStore.d.ts +7 -0
- package/dist/src/utils/LeaseStore.js +102 -0
- package/dist/src/utils/LeaseStore.js.map +1 -0
- package/dist/src/utils/Logger.d.ts +26 -0
- package/dist/src/utils/Logger.js +279 -0
- package/dist/src/utils/Logger.js.map +1 -0
- package/dist/src/utils/SecretManager.d.ts +41 -0
- package/dist/src/utils/SecretManager.js +139 -0
- package/dist/src/utils/SecretManager.js.map +1 -0
- package/dist/src/utils/StructuredLogger.d.ts +45 -0
- package/dist/src/utils/StructuredLogger.js +118 -0
- package/dist/src/utils/StructuredLogger.js.map +1 -0
- package/dist/src/utils/concurrency.d.ts +3 -0
- package/dist/src/utils/concurrency.js +22 -0
- package/dist/src/utils/concurrency.js.map +1 -0
- package/dist/src/utils/env.d.ts +5 -0
- package/dist/src/utils/env.js +15 -0
- package/dist/src/utils/env.js.map +1 -0
- package/dist/src/utils/index.d.ts +5 -0
- package/dist/src/utils/index.js +4 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/secrets.d.ts +5 -0
- package/dist/src/utils/secrets.js +27 -0
- package/dist/src/utils/secrets.js.map +1 -0
- package/package.json +159 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sario
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# ts-workflow-engine-lite
|
|
2
|
+
|
|
3
|
+
A lightweight TypeScript workflow engine for embedded, single-process
|
|
4
|
+
applications. It includes workflow execution, a REST API, events, Cron
|
|
5
|
+
scheduling, retries, and local file persistence. Redis and databases are not
|
|
6
|
+
required for local use.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Add the library to an existing TypeScript project:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add ts-workflow-engine-lite
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Node.js 18 or newer is required.
|
|
17
|
+
|
|
18
|
+
The package is published as an ES module. Use ESM imports from JavaScript or
|
|
19
|
+
TypeScript:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { bootstrap, destroyContainer } from "ts-workflow-engine-lite";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
TypeScript consumers can use either `moduleResolution: "NodeNext"` or
|
|
26
|
+
`"Bundler"`. This repository keeps extensionless relative imports in its
|
|
27
|
+
TypeScript source; the build step adds the required `.js` extensions only to
|
|
28
|
+
the generated `dist` files.
|
|
29
|
+
|
|
30
|
+
When working from this repository instead, install the development dependencies
|
|
31
|
+
and run the checked-in quick start:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm install
|
|
35
|
+
pnpm example:quickstart
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 5-minute TypeScript quick start
|
|
39
|
+
|
|
40
|
+
The package entry point is side-effect free. Importing it does not start a
|
|
41
|
+
server, register process handlers, or run a demo.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import {
|
|
45
|
+
bootstrap,
|
|
46
|
+
destroyContainer,
|
|
47
|
+
type WorkflowDefinition,
|
|
48
|
+
} from "ts-workflow-engine-lite";
|
|
49
|
+
|
|
50
|
+
const workflow: WorkflowDefinition = {
|
|
51
|
+
id: "hello",
|
|
52
|
+
name: "Hello workflow",
|
|
53
|
+
startNode: "greet",
|
|
54
|
+
nodes: {
|
|
55
|
+
greet: {
|
|
56
|
+
id: "greet",
|
|
57
|
+
type: "action",
|
|
58
|
+
action: async (instance) => ({
|
|
59
|
+
message: `Hello, ${instance?.context?.name ?? "world"}!`,
|
|
60
|
+
}),
|
|
61
|
+
next: [],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const { engine, container } = await bootstrap({
|
|
67
|
+
skipGracefulShutdown: true,
|
|
68
|
+
logLevel: "WARN",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await engine.register(workflow);
|
|
73
|
+
const instanceId = await engine.start("hello", { name: "Ada" });
|
|
74
|
+
const instance = await engine.waitForCompletion(instanceId);
|
|
75
|
+
|
|
76
|
+
console.log(instance.status); // completed
|
|
77
|
+
console.log(instance.state?.nodes?.greet?.output);
|
|
78
|
+
} finally {
|
|
79
|
+
engine.destroy();
|
|
80
|
+
await destroyContainer(container);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`waitForCompletion()` returns when an instance is `completed`, `failed`, or
|
|
85
|
+
`cancelled`. It accepts `timeoutMs`, `pollIntervalMs`, and an `AbortSignal`.
|
|
86
|
+
|
|
87
|
+
### Which initialization API should I use?
|
|
88
|
+
|
|
89
|
+
The package exposes two ways to get a running `WorkflowEngineV2`:
|
|
90
|
+
|
|
91
|
+
| API | Use when |
|
|
92
|
+
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
+
| `bootstrap(options)` | **Default choice.** One call wires storage, secret manager, optional worker pool and archiving, and graceful shutdown, then returns `{ engine, container }`. Matches what the CLI and the quick start above use. |
|
|
94
|
+
| `createContainer(options)` + `setContainer(container)` + `createEngine(options)` | You need finer control over initialization order (e.g. registering workflows or a custom `SecretManager` between container and engine creation), or you're composing multiple engines against containers you manage yourself. `createEngine()` reads its container from the process-wide singleton set by `setContainer()` — call `createContainer` and `setContainer` first, or it throws `"Container not initialized"`. |
|
|
95
|
+
|
|
96
|
+
`bootstrap()` also calls `setContainer(container)` internally, so its
|
|
97
|
+
returned `container` is the same process-wide singleton `createEngine()`
|
|
98
|
+
reads from — you can still call `createEngine()` again afterwards (e.g. to
|
|
99
|
+
create a second engine sharing that container) without calling
|
|
100
|
+
`setContainer` yourself.
|
|
101
|
+
|
|
102
|
+
## Run the examples
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm example:quickstart # minimal embedded workflow
|
|
106
|
+
pnpm example:order # condition branch and multi-step order workflow
|
|
107
|
+
pnpm example:embedded-express # mounting createWorkflowRouter into a host Express app
|
|
108
|
+
pnpm example:error-handling # catching WorkflowNotFoundError / InstanceNotFoundError
|
|
109
|
+
pnpm dev # event-driven built-in demo
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Run the REST API
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pnpm dev:api
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The API starts on `http://localhost:3345` with local file storage:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
curl http://localhost:3345/workflow-api/v1/workflows
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Interactive OpenAPI documentation is available at:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
http://localhost:3345/api-docs
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The CLI entry point creates `.env` from `.env.example` when needed. The
|
|
131
|
+
embedded `bootstrap()` API reads the current environment but does not create or
|
|
132
|
+
load an `.env` file automatically.
|
|
133
|
+
|
|
134
|
+
### Mounting into an existing Express app
|
|
135
|
+
|
|
136
|
+
`startApiServer()` above creates and starts its own standalone `express()`
|
|
137
|
+
app — use it when this package should run as its own HTTP service. To
|
|
138
|
+
instead mount the workflow API as a router inside a host application's
|
|
139
|
+
existing Express app (sharing its port, body parser, and auth middleware),
|
|
140
|
+
use `createWorkflowRouter()`:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import express from "express";
|
|
144
|
+
import { bootstrap, createWorkflowRouter } from "ts-workflow-engine-lite";
|
|
145
|
+
|
|
146
|
+
const { engine, container } = await bootstrap({ skipGracefulShutdown: true });
|
|
147
|
+
|
|
148
|
+
const app = express();
|
|
149
|
+
app.use(express.json());
|
|
150
|
+
// Apply your own auth/rate-limit middleware here if needed.
|
|
151
|
+
app.use(
|
|
152
|
+
"/workflow-api/v1",
|
|
153
|
+
await createWorkflowRouter(engine, container.storage),
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
app.listen(3000);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The router exposes `/workflows`, `/instances`, `/events`, `/webhooks`,
|
|
160
|
+
`/dlq`, `/templates`, `/analytics`, `/functions`, `/health`, and (unless
|
|
161
|
+
`{ enableMetrics: false }` is passed) `/metrics`. It expects
|
|
162
|
+
`express.json()` to already have run, and does **not** include
|
|
163
|
+
`startApiServer`'s standalone-service concerns — helmet/CORS, rate
|
|
164
|
+
limiting, JWT auth, the welcome/docs pages, or the WebSocket console
|
|
165
|
+
stream. Add whatever of those the host app needs on its own app instance
|
|
166
|
+
before mounting this router.
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
Set `WORKFLOW_ENGINE_LOG_LEVEL` to `DEBUG`, `INFO`, `WARN`, or `ERROR`.
|
|
171
|
+
Embedded applications can override it with `bootstrap({ logLevel: "WARN" })`
|
|
172
|
+
or change it later with `Logger.setLevel()`.
|
|
173
|
+
|
|
174
|
+
### Storage modes
|
|
175
|
+
|
|
176
|
+
| Mode | Intended use | Restart recovery |
|
|
177
|
+
| -------- | ------------------------------------- | ---------------- |
|
|
178
|
+
| `file` | Default single-process runtime | Yes |
|
|
179
|
+
| `memory` | Tests and intentionally ephemeral use | No |
|
|
180
|
+
|
|
181
|
+
Local file persistence is enabled by default outside tests. Runtime state is
|
|
182
|
+
stored below `.ts-workflow-engine-data/` using one JSON file per record and atomic temp
|
|
183
|
+
file replacement:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
STORAGE_TYPE=file
|
|
187
|
+
STORAGE_DIR=.ts-workflow-engine-data
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The storage directory is organized by record type:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
.ts-workflow-engine-data/
|
|
194
|
+
├── instances/
|
|
195
|
+
├── workflows/
|
|
196
|
+
├── workflow-metadata/
|
|
197
|
+
├── workflow-versions/
|
|
198
|
+
├── waiting/
|
|
199
|
+
├── metrics/
|
|
200
|
+
├── events/
|
|
201
|
+
├── heartbeats/
|
|
202
|
+
└── dlq/
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Each collection also has a `corrupt/` directory. A record that cannot be parsed
|
|
206
|
+
during startup is moved there so one damaged file does not prevent the engine
|
|
207
|
+
from starting. Inspect and recover quarantined files manually; they are not
|
|
208
|
+
loaded automatically.
|
|
209
|
+
|
|
210
|
+
### Restart recovery
|
|
211
|
+
|
|
212
|
+
JSON/config-based workflow definitions are restored automatically. Workflow
|
|
213
|
+
definitions containing JavaScript functions or closures cannot be serialized,
|
|
214
|
+
so application code must register those definitions again before resuming
|
|
215
|
+
unfinished instances:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
const { engine } = await bootstrap({
|
|
219
|
+
storageType: "file",
|
|
220
|
+
resumeRunningInstances: false,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
await engine.register(workflowWithFunctions);
|
|
224
|
+
await engine.resumeRunningInstancesFromStorage();
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`RESUME_ON_STARTUP=true` applies to API mode. Leave it disabled, or set
|
|
228
|
+
`resumeRunningInstances: false` in embedded use, when closure-based workflows
|
|
229
|
+
must be registered first. Embedded applications otherwise opt into recovery
|
|
230
|
+
with `resumeRunningInstances: true`.
|
|
231
|
+
|
|
232
|
+
### Archive management
|
|
233
|
+
|
|
234
|
+
Terminal-instance archiving is disabled by default so completed instances stay
|
|
235
|
+
available to queries until normal TTL cleanup. To archive terminal instances
|
|
236
|
+
as date-partitioned local JSON and evict them from hot storage, opt in:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
ARCHIVE_ENABLED=true
|
|
240
|
+
ARCHIVE_DIR=./archive
|
|
241
|
+
ARCHIVE_RETENTION_DAYS=90
|
|
242
|
+
ARCHIVE_CLEANUP_INTERVAL_MS=21600000
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Archive files use `archive/YYYY-MM-DD/<instanceId>.json`. An instance is removed
|
|
246
|
+
from hot storage only after its archive file has been written successfully.
|
|
247
|
+
Expired date partitions are deleted according to `ARCHIVE_RETENTION_DAYS` on
|
|
248
|
+
startup and at the configured cleanup interval. Archived instances are cold
|
|
249
|
+
files: they are not automatically returned by normal instance queries or
|
|
250
|
+
restored into hot storage.
|
|
251
|
+
|
|
252
|
+
The equivalent embedded options are `storageType`, `storageDirectory`,
|
|
253
|
+
`enableArchiving`, `archiveDirectory`, and `archiveRetentionDays`.
|
|
254
|
+
|
|
255
|
+
### Backup and restore
|
|
256
|
+
|
|
257
|
+
Back up `STORAGE_DIR` for active state and `ARCHIVE_DIR` separately when
|
|
258
|
+
archiving is enabled. For a consistent backup across collections, stop the
|
|
259
|
+
engine cleanly before copying the directories. Restore by copying them back to
|
|
260
|
+
the configured paths before startup. Do not edit active JSON files while the
|
|
261
|
+
engine is running.
|
|
262
|
+
|
|
263
|
+
## Error handling
|
|
264
|
+
|
|
265
|
+
The engine throws named error classes (exported from the package root) for
|
|
266
|
+
the highest-frequency lookup/concurrency failure modes, so callers can
|
|
267
|
+
`instanceof`-check them instead of matching `Error.message` strings:
|
|
268
|
+
|
|
269
|
+
| Class | Thrown when |
|
|
270
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
271
|
+
| `WorkflowNotFoundError` | `engine.start()` / `engine.dryRun()` / internal execution reference a `workflowId` (optionally a specific `version`) that isn't registered. Has `.workflowId` and `.version`. |
|
|
272
|
+
| `InstanceNotFoundError` | `engine.signal()` / `engine.query()` / `engine.update()` / `waitForCompletion()` reference an `instanceId` that doesn't resolve to a stored instance. Has `.instanceId`. |
|
|
273
|
+
| `ConcurrencyConflictError` | Optimistic concurrency control (CAS) exhausts its retry budget persisting an instance update — another writer kept winning the race on `instance.version`. Has `.instanceId` and `.attempts`. |
|
|
274
|
+
| `LockAcquisitionError` | `ConcurrencyControl.withLock()` fails to acquire a lock within its retry budget. Has `.resourceId`. |
|
|
275
|
+
|
|
276
|
+
Other failures (timeouts, invalid state transitions, the max-instances
|
|
277
|
+
limit, schema validation via `DataValidationError`) still throw plain
|
|
278
|
+
`Error` or their own existing error class — see
|
|
279
|
+
[`examples/error-handling.ts`](./examples/error-handling.ts) for a runnable
|
|
280
|
+
demonstration.
|
|
281
|
+
|
|
282
|
+
## Supported workflow features
|
|
283
|
+
|
|
284
|
+
- Node types: `action`, `wait`, `event`, `rollback`, `subworkflow`, `condition`,
|
|
285
|
+
`router`, `loop`, `http`, `sql`, `queue`, `notification`, and `approval`
|
|
286
|
+
- Event bus, hooks, deduplication, Cron scheduling, retries, heartbeats, and
|
|
287
|
+
dead-letter queue handling
|
|
288
|
+
- REST API for workflows, instances, signals, queries, updates, templates,
|
|
289
|
+
webhooks, events, analytics, and the dead-letter queue
|
|
290
|
+
- Expression evaluation with built-in and custom functions
|
|
291
|
+
|
|
292
|
+
## Scope and limitations
|
|
293
|
+
|
|
294
|
+
This project is intentionally single-process. Local file storage protects state
|
|
295
|
+
across ordinary process restarts, but it is not a transactional database and
|
|
296
|
+
the same `STORAGE_DIR` must never be shared by multiple engine processes.
|
|
297
|
+
Process-local leases, rate limits, idempotency keys, the event bus, and Cron
|
|
298
|
+
scheduling do not provide distributed coordination. The project also does not
|
|
299
|
+
provide clustering, multi-tenancy isolation, GraphQL, or a visual editor.
|
|
300
|
+
|
|
301
|
+
## Development scripts
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
pnpm build # clean and compile TypeScript to dist/
|
|
305
|
+
pnpm test # run Vitest
|
|
306
|
+
pnpm typecheck # type-check source, tests, and examples
|
|
307
|
+
pnpm lint # run oxlint checks
|
|
308
|
+
pnpm format:check # verify formatting
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Optional API layer
|
|
312
|
+
|
|
313
|
+
The REST API is optional. Core engine imports never pull in `express`, `cors`,
|
|
314
|
+
`helmet`, or any HTTP framework. If you only need the workflow engine, skip
|
|
315
|
+
those dependencies entirely:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
# Core only (no REST API)
|
|
319
|
+
pnpm add ts-workflow-engine-lite
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
If you need the REST API, install the peer dependencies:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Full install with REST API
|
|
326
|
+
pnpm add ts-workflow-engine-lite express cors helmet morgan ws swagger-ui-dist
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
API-related exports (`startApiServer`, `createWorkflowRouter`) use dynamic
|
|
330
|
+
`import()` internally and will throw a clear error if the HTTP packages
|
|
331
|
+
are not installed.
|
|
332
|
+
|
|
333
|
+
## Examples
|
|
334
|
+
|
|
335
|
+
| Example | Script | Description |
|
|
336
|
+
| --------------------------------------------------------------- | ------------------------------- | ------------------------------------------------ |
|
|
337
|
+
| [quickstart.ts](./examples/quickstart.ts) | `pnpm example:quickstart` | Minimal workflow with condition routing |
|
|
338
|
+
| [order-processing.ts](./examples/order-processing.ts) | `pnpm example:order` | Multi-step order processing pipeline |
|
|
339
|
+
| [embedded-express-app.ts](./examples/embedded-express-app.ts) | `pnpm example:embedded-express` | Embed API in a host Express app |
|
|
340
|
+
| [error-handling.ts](./examples/error-handling.ts) | `pnpm example:error-handling` | Named error classes and retry handling |
|
|
341
|
+
| [multi-tenant-workflow.ts](./examples/multi-tenant-workflow.ts) | `pnpm example:multi-tenant` | Tenant-isolated workflows with condition routing |
|
|
342
|
+
| [approval-pipeline.ts](./examples/approval-pipeline.ts) | `pnpm example:approval` | Long-running approval with timeout |
|
|
343
|
+
| [http-orchestration.ts](./examples/http-orchestration.ts) | `pnpm example:http` | HTTP integration with conditional routing |
|
|
344
|
+
| [parallel-fan-out.ts](./examples/parallel-fan-out.ts) | `pnpm example:parallel` | Parallel processing with merge |
|
|
345
|
+
| [graceful-degradation.ts](./examples/graceful-degradation.ts) | `pnpm example:degradation` | Fallback paths and dead letter queues |
|
|
346
|
+
| [headless-engine.ts](./examples/headless-engine.ts) | `pnpm example:headless` | Pure programmatic usage, no API server |
|
|
347
|
+
| [worker-pool.ts](./examples/worker-pool.ts) | `pnpm example:worker-pool` | CPU-intensive tasks with worker threads |
|
|
348
|
+
| [cron-data-sync.ts](./examples/cron-data-sync.ts) | `pnpm example:cron-sync` | Scheduled data synchronization |
|
|
349
|
+
|
|
350
|
+
## License
|
|
351
|
+
|
|
352
|
+
MIT
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { IncomingMessage } from "http";
|
|
2
|
+
import type { WebSocket } from "ws";
|
|
3
|
+
import type { HookEventName, HookPayload } from "../event/HookManager.js";
|
|
4
|
+
import type { WorkflowInstance } from "../model/Instance.js";
|
|
5
|
+
import type { StorageProvider } from "../storage/StorageProvider.js";
|
|
6
|
+
export interface InstanceUpdate {
|
|
7
|
+
instanceId: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
type: "status" | "node" | "error" | "completed";
|
|
10
|
+
data: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface ConsoleConnectedMessage {
|
|
13
|
+
type: "connected";
|
|
14
|
+
mode: "global" | "instance";
|
|
15
|
+
timestamp: number;
|
|
16
|
+
instanceId?: string;
|
|
17
|
+
instance?: WorkflowInstance | null;
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ConsolePongMessage {
|
|
21
|
+
type: "pong";
|
|
22
|
+
timestamp: number;
|
|
23
|
+
}
|
|
24
|
+
export type ConsoleHookData = HookPayload | (HookPayload & {
|
|
25
|
+
childInstanceId: string;
|
|
26
|
+
parentInstanceId: string;
|
|
27
|
+
});
|
|
28
|
+
export interface ConsoleHookMessage {
|
|
29
|
+
type: "hook";
|
|
30
|
+
event: HookEventName;
|
|
31
|
+
instanceId?: string;
|
|
32
|
+
workflowId?: string;
|
|
33
|
+
nodeId?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
timestamp: string;
|
|
36
|
+
data: ConsoleHookData;
|
|
37
|
+
}
|
|
38
|
+
export type ConsoleWebSocketMessage = ConsoleConnectedMessage | ConsolePongMessage | ConsoleHookMessage;
|
|
39
|
+
export declare class ConsoleWebSocketManager {
|
|
40
|
+
private globalConnections;
|
|
41
|
+
private instanceConnections;
|
|
42
|
+
private storage?;
|
|
43
|
+
constructor(storage?: StorageProvider);
|
|
44
|
+
handleGlobalConnection(ws: WebSocket, _req: IncomingMessage): void;
|
|
45
|
+
handleConnection(ws: WebSocket, instanceId: string, _req: IncomingMessage): void;
|
|
46
|
+
broadcastHook(payload: HookPayload): void;
|
|
47
|
+
broadcastUpdate(instanceId: string, update: InstanceUpdate): void;
|
|
48
|
+
private sendInitialState;
|
|
49
|
+
private sendMessage;
|
|
50
|
+
private removeInstanceConnection;
|
|
51
|
+
getStats(): {
|
|
52
|
+
globalConnections: number;
|
|
53
|
+
instanceConnections: number;
|
|
54
|
+
instanceCount: number;
|
|
55
|
+
};
|
|
56
|
+
shutdown(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { errorMessage, Logger } from "../utils/Logger.js";
|
|
2
|
+
const INSTANCE_UPDATE_EVENT_MAP = {
|
|
3
|
+
status: "workflow.started",
|
|
4
|
+
node: "node.started",
|
|
5
|
+
error: "workflow.failed",
|
|
6
|
+
completed: "workflow.completed",
|
|
7
|
+
};
|
|
8
|
+
export class ConsoleWebSocketManager {
|
|
9
|
+
globalConnections = new Set();
|
|
10
|
+
instanceConnections = new Map();
|
|
11
|
+
storage;
|
|
12
|
+
constructor(storage) {
|
|
13
|
+
this.storage = storage;
|
|
14
|
+
}
|
|
15
|
+
handleGlobalConnection(ws, _req) {
|
|
16
|
+
Logger.info("api", "console-ws", "New global WebSocket connection");
|
|
17
|
+
this.globalConnections.add(ws);
|
|
18
|
+
this.sendMessage(ws, {
|
|
19
|
+
type: "connected",
|
|
20
|
+
mode: "global",
|
|
21
|
+
timestamp: Date.now(),
|
|
22
|
+
});
|
|
23
|
+
ws.on("message", (message) => {
|
|
24
|
+
try {
|
|
25
|
+
const data = JSON.parse(message.toString());
|
|
26
|
+
if (data.type === "ping") {
|
|
27
|
+
this.sendMessage(ws, { type: "pong", timestamp: Date.now() });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
ws.on("close", () => {
|
|
34
|
+
this.globalConnections.delete(ws);
|
|
35
|
+
Logger.info("api", "console-ws", "Global WebSocket connection closed");
|
|
36
|
+
});
|
|
37
|
+
ws.on("error", (error) => {
|
|
38
|
+
Logger.error("api", "console-ws", `Global WebSocket error: ${error.message}`);
|
|
39
|
+
this.globalConnections.delete(ws);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
handleConnection(ws, instanceId, _req) {
|
|
43
|
+
Logger.info("api", "console-ws", `New instance WebSocket connection for ${instanceId}`);
|
|
44
|
+
if (!this.instanceConnections.has(instanceId)) {
|
|
45
|
+
this.instanceConnections.set(instanceId, new Set());
|
|
46
|
+
}
|
|
47
|
+
this.instanceConnections.get(instanceId).add(ws);
|
|
48
|
+
this.sendInitialState(ws, instanceId).catch((error) => {
|
|
49
|
+
Logger.error("api", "console-ws", `Failed to send initial state: ${errorMessage(error)}`);
|
|
50
|
+
});
|
|
51
|
+
ws.on("message", (message) => {
|
|
52
|
+
try {
|
|
53
|
+
const data = JSON.parse(message.toString());
|
|
54
|
+
if (data.type === "ping") {
|
|
55
|
+
this.sendMessage(ws, { type: "pong", timestamp: Date.now() });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
ws.on("close", () => {
|
|
62
|
+
this.removeInstanceConnection(instanceId, ws);
|
|
63
|
+
});
|
|
64
|
+
ws.on("error", (error) => {
|
|
65
|
+
Logger.error("api", "console-ws", `Instance WebSocket error for ${instanceId}: ${error.message}`);
|
|
66
|
+
this.removeInstanceConnection(instanceId, ws);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
broadcastHook(payload) {
|
|
70
|
+
const message = {
|
|
71
|
+
type: "hook",
|
|
72
|
+
event: payload.event,
|
|
73
|
+
instanceId: payload.instanceId,
|
|
74
|
+
workflowId: payload.workflowId,
|
|
75
|
+
nodeId: payload.nodeId,
|
|
76
|
+
status: payload.status,
|
|
77
|
+
timestamp: payload.timestamp ?? new Date().toISOString(),
|
|
78
|
+
data: payload,
|
|
79
|
+
};
|
|
80
|
+
for (const ws of this.globalConnections) {
|
|
81
|
+
this.sendMessage(ws, message);
|
|
82
|
+
}
|
|
83
|
+
if (payload.instanceId) {
|
|
84
|
+
const conns = this.instanceConnections.get(payload.instanceId);
|
|
85
|
+
if (conns) {
|
|
86
|
+
for (const ws of conns) {
|
|
87
|
+
this.sendMessage(ws, message);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if ((payload.event === "workflow.completed" ||
|
|
91
|
+
payload.event === "workflow.failed") &&
|
|
92
|
+
this.storage) {
|
|
93
|
+
void this.storage
|
|
94
|
+
.loadInstance(payload.instanceId)
|
|
95
|
+
.then((instance) => {
|
|
96
|
+
const parentId = instance?.parentInstanceId;
|
|
97
|
+
if (!parentId)
|
|
98
|
+
return;
|
|
99
|
+
const parentConns = this.instanceConnections.get(parentId);
|
|
100
|
+
if (!parentConns)
|
|
101
|
+
return;
|
|
102
|
+
const parentMessage = {
|
|
103
|
+
...message,
|
|
104
|
+
type: "hook",
|
|
105
|
+
event: `subworkflow.${payload.event === "workflow.completed" ? "completed" : "failed"}`,
|
|
106
|
+
data: {
|
|
107
|
+
...payload,
|
|
108
|
+
childInstanceId: payload.instanceId,
|
|
109
|
+
parentInstanceId: parentId,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
for (const ws of parentConns) {
|
|
113
|
+
this.sendMessage(ws, parentMessage);
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
.catch(() => {
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
broadcastUpdate(instanceId, update) {
|
|
122
|
+
this.broadcastHook({
|
|
123
|
+
event: INSTANCE_UPDATE_EVENT_MAP[update.type],
|
|
124
|
+
instanceId,
|
|
125
|
+
workflowId: "",
|
|
126
|
+
timestamp: String(update.timestamp),
|
|
127
|
+
...update.data,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async sendInitialState(ws, instanceId) {
|
|
131
|
+
if (!this.storage) {
|
|
132
|
+
this.sendMessage(ws, {
|
|
133
|
+
type: "connected",
|
|
134
|
+
mode: "instance",
|
|
135
|
+
instanceId,
|
|
136
|
+
message: "Storage not available – hook events only",
|
|
137
|
+
timestamp: Date.now(),
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
const instance = await this.storage.loadInstance(instanceId);
|
|
143
|
+
this.sendMessage(ws, {
|
|
144
|
+
type: "connected",
|
|
145
|
+
mode: "instance",
|
|
146
|
+
instanceId,
|
|
147
|
+
instance: instance ?? null,
|
|
148
|
+
timestamp: Date.now(),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
Logger.error("api", "console-ws", `Failed to load instance ${instanceId}: ${errorMessage(error)}`);
|
|
153
|
+
this.sendMessage(ws, {
|
|
154
|
+
type: "connected",
|
|
155
|
+
mode: "instance",
|
|
156
|
+
instanceId,
|
|
157
|
+
instance: null,
|
|
158
|
+
timestamp: Date.now(),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
sendMessage(ws, message) {
|
|
163
|
+
if (ws.readyState === 1) {
|
|
164
|
+
try {
|
|
165
|
+
ws.send(JSON.stringify(message));
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
Logger.error("api", "console-ws", `Failed to send message: ${errorMessage(error)}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
removeInstanceConnection(instanceId, ws) {
|
|
173
|
+
const connections = this.instanceConnections.get(instanceId);
|
|
174
|
+
if (connections) {
|
|
175
|
+
connections.delete(ws);
|
|
176
|
+
if (connections.size === 0) {
|
|
177
|
+
this.instanceConnections.delete(instanceId);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
getStats() {
|
|
182
|
+
let instanceConnections = 0;
|
|
183
|
+
for (const conns of this.instanceConnections.values()) {
|
|
184
|
+
instanceConnections += conns.size;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
globalConnections: this.globalConnections.size,
|
|
188
|
+
instanceConnections,
|
|
189
|
+
instanceCount: this.instanceConnections.size,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
shutdown() {
|
|
193
|
+
for (const ws of this.globalConnections) {
|
|
194
|
+
ws.close();
|
|
195
|
+
}
|
|
196
|
+
this.globalConnections.clear();
|
|
197
|
+
for (const conns of this.instanceConnections.values()) {
|
|
198
|
+
for (const ws of conns) {
|
|
199
|
+
ws.close();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
this.instanceConnections.clear();
|
|
203
|
+
Logger.info("api", "console-ws", "WebSocket manager shut down");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=ConsoleWebSocketManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleWebSocketManager.js","sourceRoot":"","sources":["../../../src/api/ConsoleWebSocketManager.ts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