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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TaskType, WorkflowDefinition } from "../model/Workflow.js";
|
|
2
|
+
export interface ValidationError {
|
|
3
|
+
path: string;
|
|
4
|
+
message: string;
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ValidationWarning {
|
|
8
|
+
path: string;
|
|
9
|
+
message: string;
|
|
10
|
+
code: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ValidationResult {
|
|
13
|
+
valid: boolean;
|
|
14
|
+
errors: ValidationError[];
|
|
15
|
+
warnings: ValidationWarning[];
|
|
16
|
+
}
|
|
17
|
+
export declare class SchemaValidator {
|
|
18
|
+
private registeredNodeTypes;
|
|
19
|
+
constructor(registeredNodeTypes?: TaskType[]);
|
|
20
|
+
registerNodeType(nodeType: TaskType): void;
|
|
21
|
+
validate(definition: WorkflowDefinition): ValidationResult;
|
|
22
|
+
private validateNodeConfigs;
|
|
23
|
+
private validateSchema;
|
|
24
|
+
private validateNodeTypes;
|
|
25
|
+
private validateNodeIdUniqueness;
|
|
26
|
+
private validateNodeReferences;
|
|
27
|
+
private validateExpressions;
|
|
28
|
+
private detectCircularDependencies;
|
|
29
|
+
private detectUnreachableNodes;
|
|
30
|
+
}
|
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
import { validateExpression } from "./ExpressionEvaluator.js";
|
|
2
|
+
export class SchemaValidator {
|
|
3
|
+
registeredNodeTypes;
|
|
4
|
+
constructor(registeredNodeTypes) {
|
|
5
|
+
this.registeredNodeTypes = new Set(registeredNodeTypes || [
|
|
6
|
+
"action",
|
|
7
|
+
"wait",
|
|
8
|
+
"event",
|
|
9
|
+
"rollback",
|
|
10
|
+
"subworkflow",
|
|
11
|
+
"http",
|
|
12
|
+
"sql",
|
|
13
|
+
"queue",
|
|
14
|
+
"condition",
|
|
15
|
+
"router",
|
|
16
|
+
"loop",
|
|
17
|
+
"approval",
|
|
18
|
+
"notification",
|
|
19
|
+
"join",
|
|
20
|
+
"transform",
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
registerNodeType(nodeType) {
|
|
24
|
+
this.registeredNodeTypes.add(nodeType);
|
|
25
|
+
}
|
|
26
|
+
validate(definition) {
|
|
27
|
+
const errors = [];
|
|
28
|
+
const warnings = [];
|
|
29
|
+
errors.push(...this.validateSchema(definition));
|
|
30
|
+
errors.push(...this.validateNodeTypes(definition));
|
|
31
|
+
errors.push(...this.validateNodeIdUniqueness(definition));
|
|
32
|
+
errors.push(...this.validateNodeReferences(definition));
|
|
33
|
+
errors.push(...this.validateExpressions(definition));
|
|
34
|
+
errors.push(...this.detectCircularDependencies(definition));
|
|
35
|
+
warnings.push(...this.detectUnreachableNodes(definition));
|
|
36
|
+
errors.push(...this.validateNodeConfigs(definition));
|
|
37
|
+
return {
|
|
38
|
+
valid: errors.length === 0,
|
|
39
|
+
errors,
|
|
40
|
+
warnings,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
validateNodeConfigs(definition) {
|
|
44
|
+
const errors = [];
|
|
45
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
46
|
+
return errors;
|
|
47
|
+
}
|
|
48
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
49
|
+
const config = node.config;
|
|
50
|
+
const pathPrefix = `nodes.${nodeId}`;
|
|
51
|
+
switch (node.type) {
|
|
52
|
+
case "wait":
|
|
53
|
+
if (node.timeout === undefined &&
|
|
54
|
+
config?.durationMs === undefined &&
|
|
55
|
+
!config?.until) {
|
|
56
|
+
errors.push({
|
|
57
|
+
path: `${pathPrefix}.timeout`,
|
|
58
|
+
message: "Wait node requires a timeout, config.durationMs, or config.until",
|
|
59
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "event":
|
|
64
|
+
if (!node.onEvent) {
|
|
65
|
+
errors.push({
|
|
66
|
+
path: `${pathPrefix}.onEvent`,
|
|
67
|
+
message: "Event node requires an onEvent",
|
|
68
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case "http":
|
|
73
|
+
if (config) {
|
|
74
|
+
if (!config.url) {
|
|
75
|
+
errors.push({
|
|
76
|
+
path: `${pathPrefix}.config.url`,
|
|
77
|
+
message: "HTTP node requires a url",
|
|
78
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (!config.method) {
|
|
82
|
+
errors.push({
|
|
83
|
+
path: `${pathPrefix}.config.method`,
|
|
84
|
+
message: "HTTP node requires a method",
|
|
85
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
case "sql":
|
|
91
|
+
if (config && !config.query) {
|
|
92
|
+
errors.push({
|
|
93
|
+
path: `${pathPrefix}.config.query`,
|
|
94
|
+
message: "SQL node requires a query",
|
|
95
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "notification":
|
|
100
|
+
if (!config) {
|
|
101
|
+
errors.push({
|
|
102
|
+
path: `${pathPrefix}.config`,
|
|
103
|
+
message: "Notification node requires config",
|
|
104
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
105
|
+
});
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (!config.channel) {
|
|
109
|
+
errors.push({
|
|
110
|
+
path: `${pathPrefix}.config.channel`,
|
|
111
|
+
message: "Notification node requires a channel",
|
|
112
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (!config.target) {
|
|
116
|
+
errors.push({
|
|
117
|
+
path: `${pathPrefix}.config.target`,
|
|
118
|
+
message: "Notification node requires a target",
|
|
119
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (!config.template) {
|
|
123
|
+
errors.push({
|
|
124
|
+
path: `${pathPrefix}.config.template`,
|
|
125
|
+
message: "Notification node requires a template",
|
|
126
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case "loop":
|
|
131
|
+
if (config) {
|
|
132
|
+
if (!config.collection) {
|
|
133
|
+
errors.push({
|
|
134
|
+
path: `${pathPrefix}.config.collection`,
|
|
135
|
+
message: "Loop node requires a collection expression",
|
|
136
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (!config.itemVariable) {
|
|
140
|
+
errors.push({
|
|
141
|
+
path: `${pathPrefix}.config.itemVariable`,
|
|
142
|
+
message: "Loop node requires an itemVariable",
|
|
143
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (!config.body) {
|
|
147
|
+
errors.push({
|
|
148
|
+
path: `${pathPrefix}.config.body`,
|
|
149
|
+
message: "Loop node requires a body node ID",
|
|
150
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case "subworkflow":
|
|
156
|
+
if (!node.subworkflowId) {
|
|
157
|
+
errors.push({
|
|
158
|
+
path: `${pathPrefix}.subworkflowId`,
|
|
159
|
+
message: "Subworkflow node requires a subworkflowId",
|
|
160
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case "join":
|
|
165
|
+
if (!config) {
|
|
166
|
+
errors.push({
|
|
167
|
+
path: `${pathPrefix}.config`,
|
|
168
|
+
message: "Join node requires config",
|
|
169
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
170
|
+
});
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
if (!Array.isArray(config.waitFor) ||
|
|
174
|
+
config.waitFor.length === 0) {
|
|
175
|
+
errors.push({
|
|
176
|
+
path: `${pathPrefix}.config.waitFor`,
|
|
177
|
+
message: "Join node requires a non-empty config.waitFor array",
|
|
178
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case "transform":
|
|
183
|
+
if (!config) {
|
|
184
|
+
errors.push({
|
|
185
|
+
path: `${pathPrefix}.config`,
|
|
186
|
+
message: "Transform node requires config",
|
|
187
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
188
|
+
});
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (!config.output ||
|
|
192
|
+
typeof config.output !== "object" ||
|
|
193
|
+
Array.isArray(config.output)) {
|
|
194
|
+
errors.push({
|
|
195
|
+
path: `${pathPrefix}.config.output`,
|
|
196
|
+
message: "Transform node requires config.output to be an object",
|
|
197
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return errors;
|
|
204
|
+
}
|
|
205
|
+
validateSchema(definition) {
|
|
206
|
+
const errors = [];
|
|
207
|
+
if (!definition.id || typeof definition.id !== "string") {
|
|
208
|
+
errors.push({
|
|
209
|
+
path: "id",
|
|
210
|
+
message: "Workflow ID is required and must be a string",
|
|
211
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (!definition.name || typeof definition.name !== "string") {
|
|
215
|
+
errors.push({
|
|
216
|
+
path: "name",
|
|
217
|
+
message: "Workflow name is required and must be a string",
|
|
218
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
222
|
+
errors.push({
|
|
223
|
+
path: "nodes",
|
|
224
|
+
message: "Workflow nodes are required and must be an object",
|
|
225
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
226
|
+
});
|
|
227
|
+
return errors;
|
|
228
|
+
}
|
|
229
|
+
if (!definition.startNode || typeof definition.startNode !== "string") {
|
|
230
|
+
errors.push({
|
|
231
|
+
path: "startNode",
|
|
232
|
+
message: "Start node is required and must be a string",
|
|
233
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (definition.version !== undefined &&
|
|
237
|
+
typeof definition.version !== "string") {
|
|
238
|
+
errors.push({
|
|
239
|
+
path: "version",
|
|
240
|
+
message: "Version must be a string",
|
|
241
|
+
code: "INVALID_TYPE",
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (definition.description !== undefined &&
|
|
245
|
+
typeof definition.description !== "string") {
|
|
246
|
+
errors.push({
|
|
247
|
+
path: "description",
|
|
248
|
+
message: "Description must be a string",
|
|
249
|
+
code: "INVALID_TYPE",
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (definition.cron !== undefined && typeof definition.cron !== "string") {
|
|
253
|
+
errors.push({
|
|
254
|
+
path: "cron",
|
|
255
|
+
message: "Cron expression must be a string",
|
|
256
|
+
code: "INVALID_TYPE",
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (definition.triggerEvents !== undefined) {
|
|
260
|
+
if (!Array.isArray(definition.triggerEvents)) {
|
|
261
|
+
errors.push({
|
|
262
|
+
path: "triggerEvents",
|
|
263
|
+
message: "Trigger events must be an array",
|
|
264
|
+
code: "INVALID_TYPE",
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
definition.triggerEvents.forEach((event, index) => {
|
|
269
|
+
if (typeof event !== "string") {
|
|
270
|
+
errors.push({
|
|
271
|
+
path: `triggerEvents[${index}]`,
|
|
272
|
+
message: "Trigger event must be a string",
|
|
273
|
+
code: "INVALID_TYPE",
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
280
|
+
if (!node.id || typeof node.id !== "string") {
|
|
281
|
+
errors.push({
|
|
282
|
+
path: `nodes.${nodeId}.id`,
|
|
283
|
+
message: "Node ID is required and must be a string",
|
|
284
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (!node.type || typeof node.type !== "string") {
|
|
288
|
+
errors.push({
|
|
289
|
+
path: `nodes.${nodeId}.type`,
|
|
290
|
+
message: "Node type is required and must be a string",
|
|
291
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if (node.next !== undefined && !Array.isArray(node.next)) {
|
|
295
|
+
errors.push({
|
|
296
|
+
path: `nodes.${nodeId}.next`,
|
|
297
|
+
message: "Node next must be an array",
|
|
298
|
+
code: "INVALID_TYPE",
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (node.failureNext !== undefined && !Array.isArray(node.failureNext)) {
|
|
302
|
+
errors.push({
|
|
303
|
+
path: `nodes.${nodeId}.failureNext`,
|
|
304
|
+
message: "Node failureNext must be an array",
|
|
305
|
+
code: "INVALID_TYPE",
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (node.conditionalNext !== undefined) {
|
|
309
|
+
if (!Array.isArray(node.conditionalNext)) {
|
|
310
|
+
errors.push({
|
|
311
|
+
path: `nodes.${nodeId}.conditionalNext`,
|
|
312
|
+
message: "Node conditionalNext must be an array",
|
|
313
|
+
code: "INVALID_TYPE",
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
node.conditionalNext.forEach((branch, index) => {
|
|
318
|
+
if (!branch.condition || typeof branch.condition !== "string") {
|
|
319
|
+
errors.push({
|
|
320
|
+
path: `nodes.${nodeId}.conditionalNext[${index}].condition`,
|
|
321
|
+
message: "Conditional branch condition is required and must be a string",
|
|
322
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
if (!branch.target || typeof branch.target !== "string") {
|
|
326
|
+
errors.push({
|
|
327
|
+
path: `nodes.${nodeId}.conditionalNext[${index}].target`,
|
|
328
|
+
message: "Conditional branch target is required and must be a string",
|
|
329
|
+
code: "MISSING_REQUIRED_FIELD",
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return errors;
|
|
337
|
+
}
|
|
338
|
+
validateNodeTypes(definition) {
|
|
339
|
+
const errors = [];
|
|
340
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
341
|
+
return errors;
|
|
342
|
+
}
|
|
343
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
344
|
+
if (node.type && !this.registeredNodeTypes.has(node.type)) {
|
|
345
|
+
errors.push({
|
|
346
|
+
path: `nodes.${nodeId}.type`,
|
|
347
|
+
message: `Unknown node type: ${node.type}. Registered types: ${Array.from(this.registeredNodeTypes).join(", ")}`,
|
|
348
|
+
code: "UNKNOWN_NODE_TYPE",
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
return errors;
|
|
353
|
+
}
|
|
354
|
+
validateNodeIdUniqueness(definition) {
|
|
355
|
+
const errors = [];
|
|
356
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
357
|
+
return errors;
|
|
358
|
+
}
|
|
359
|
+
const nodeIds = new Set();
|
|
360
|
+
const duplicates = new Set();
|
|
361
|
+
Object.entries(definition.nodes).forEach(([_nodeId, node]) => {
|
|
362
|
+
if (nodeIds.has(node.id)) {
|
|
363
|
+
duplicates.add(node.id);
|
|
364
|
+
}
|
|
365
|
+
nodeIds.add(node.id);
|
|
366
|
+
});
|
|
367
|
+
duplicates.forEach((nodeId) => {
|
|
368
|
+
errors.push({
|
|
369
|
+
path: `nodes.${nodeId}`,
|
|
370
|
+
message: `Duplicate node ID: ${nodeId}`,
|
|
371
|
+
code: "DUPLICATE_NODE_ID",
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
return errors;
|
|
375
|
+
}
|
|
376
|
+
validateNodeReferences(definition) {
|
|
377
|
+
const errors = [];
|
|
378
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
379
|
+
return errors;
|
|
380
|
+
}
|
|
381
|
+
const nodeIds = new Set(Object.keys(definition.nodes));
|
|
382
|
+
if (definition.startNode && !nodeIds.has(definition.startNode)) {
|
|
383
|
+
errors.push({
|
|
384
|
+
path: "startNode",
|
|
385
|
+
message: `Start node references non-existent node: ${definition.startNode}`,
|
|
386
|
+
code: "INVALID_NODE_REFERENCE",
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
390
|
+
if (node.next) {
|
|
391
|
+
node.next.forEach((nextId, index) => {
|
|
392
|
+
if (!nodeIds.has(nextId)) {
|
|
393
|
+
errors.push({
|
|
394
|
+
path: `nodes.${nodeId}.next[${index}]`,
|
|
395
|
+
message: `Node references non-existent node: ${nextId}`,
|
|
396
|
+
code: "INVALID_NODE_REFERENCE",
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (node.failureNext) {
|
|
402
|
+
node.failureNext.forEach((nextId, index) => {
|
|
403
|
+
if (!nodeIds.has(nextId)) {
|
|
404
|
+
errors.push({
|
|
405
|
+
path: `nodes.${nodeId}.failureNext[${index}]`,
|
|
406
|
+
message: `Node references non-existent node: ${nextId}`,
|
|
407
|
+
code: "INVALID_NODE_REFERENCE",
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (node.conditionalNext) {
|
|
413
|
+
node.conditionalNext.forEach((branch, index) => {
|
|
414
|
+
if (branch.target && !nodeIds.has(branch.target)) {
|
|
415
|
+
errors.push({
|
|
416
|
+
path: `nodes.${nodeId}.conditionalNext[${index}].target`,
|
|
417
|
+
message: `Conditional branch references non-existent node: ${branch.target}`,
|
|
418
|
+
code: "INVALID_NODE_REFERENCE",
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
if (node.defaultNext && !nodeIds.has(node.defaultNext)) {
|
|
424
|
+
errors.push({
|
|
425
|
+
path: `nodes.${nodeId}.defaultNext`,
|
|
426
|
+
message: `Default branch references non-existent node: ${node.defaultNext}`,
|
|
427
|
+
code: "INVALID_NODE_REFERENCE",
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (node.rollbackTo && !nodeIds.has(node.rollbackTo)) {
|
|
431
|
+
errors.push({
|
|
432
|
+
path: `nodes.${nodeId}.rollbackTo`,
|
|
433
|
+
message: `Rollback references non-existent node: ${node.rollbackTo}`,
|
|
434
|
+
code: "INVALID_NODE_REFERENCE",
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
const approvalConfig = node.config;
|
|
438
|
+
if (node.type === "approval" &&
|
|
439
|
+
approvalConfig?.approvedTarget &&
|
|
440
|
+
!nodeIds.has(approvalConfig.approvedTarget)) {
|
|
441
|
+
errors.push({
|
|
442
|
+
path: `nodes.${nodeId}.config.approvedTarget`,
|
|
443
|
+
message: `Approval approvedTarget references non-existent node: ${approvalConfig.approvedTarget}`,
|
|
444
|
+
code: "INVALID_NODE_REFERENCE",
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
if (node.type === "approval" &&
|
|
448
|
+
approvalConfig?.rejectedTarget &&
|
|
449
|
+
!nodeIds.has(approvalConfig.rejectedTarget)) {
|
|
450
|
+
errors.push({
|
|
451
|
+
path: `nodes.${nodeId}.config.rejectedTarget`,
|
|
452
|
+
message: `Approval rejectedTarget references non-existent node: ${approvalConfig.rejectedTarget}`,
|
|
453
|
+
code: "INVALID_NODE_REFERENCE",
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
if (node.type === "join") {
|
|
457
|
+
const joinConfig = node.config;
|
|
458
|
+
if (Array.isArray(joinConfig?.waitFor)) {
|
|
459
|
+
joinConfig.waitFor.forEach((waitForId, index) => {
|
|
460
|
+
if (typeof waitForId === "string" && !nodeIds.has(waitForId)) {
|
|
461
|
+
errors.push({
|
|
462
|
+
path: `nodes.${nodeId}.config.waitFor[${index}]`,
|
|
463
|
+
message: `Join waitFor references non-existent node: ${waitForId}`,
|
|
464
|
+
code: "INVALID_NODE_REFERENCE",
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return errors;
|
|
472
|
+
}
|
|
473
|
+
validateExpressions(definition) {
|
|
474
|
+
const errors = [];
|
|
475
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
476
|
+
return errors;
|
|
477
|
+
}
|
|
478
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
479
|
+
if (node.conditionalNext) {
|
|
480
|
+
node.conditionalNext.forEach((branch, index) => {
|
|
481
|
+
if (branch.condition) {
|
|
482
|
+
const result = validateExpression(branch.condition);
|
|
483
|
+
if (!result.valid) {
|
|
484
|
+
errors.push({
|
|
485
|
+
path: `nodes.${nodeId}.conditionalNext[${index}].condition`,
|
|
486
|
+
message: `Invalid expression syntax: ${result.error}`,
|
|
487
|
+
code: "INVALID_EXPRESSION",
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
if (node.type === "transform") {
|
|
494
|
+
const transformConfig = node.config;
|
|
495
|
+
if (transformConfig?.output &&
|
|
496
|
+
typeof transformConfig.output === "object") {
|
|
497
|
+
Object.entries(transformConfig.output).forEach(([field, expr]) => {
|
|
498
|
+
if (typeof expr !== "string")
|
|
499
|
+
return;
|
|
500
|
+
const unwrapped = expr.trim().startsWith("${") && expr.trim().endsWith("}")
|
|
501
|
+
? expr.trim().slice(2, -1)
|
|
502
|
+
: expr.trim();
|
|
503
|
+
const result = validateExpression(unwrapped);
|
|
504
|
+
if (!result.valid) {
|
|
505
|
+
errors.push({
|
|
506
|
+
path: `nodes.${nodeId}.config.output.${field}`,
|
|
507
|
+
message: `Invalid expression syntax: ${result.error}`,
|
|
508
|
+
code: "INVALID_EXPRESSION",
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
return errors;
|
|
516
|
+
}
|
|
517
|
+
detectCircularDependencies(definition) {
|
|
518
|
+
const errors = [];
|
|
519
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
520
|
+
return errors;
|
|
521
|
+
}
|
|
522
|
+
const nodeIds = Object.keys(definition.nodes);
|
|
523
|
+
const inDegree = new Map();
|
|
524
|
+
const adjacencyList = new Map();
|
|
525
|
+
nodeIds.forEach((nodeId) => {
|
|
526
|
+
inDegree.set(nodeId, 0);
|
|
527
|
+
adjacencyList.set(nodeId, []);
|
|
528
|
+
});
|
|
529
|
+
Object.entries(definition.nodes).forEach(([nodeId, node]) => {
|
|
530
|
+
const edges = [];
|
|
531
|
+
if (node.next) {
|
|
532
|
+
edges.push(...node.next);
|
|
533
|
+
}
|
|
534
|
+
if (node.failureNext) {
|
|
535
|
+
edges.push(...node.failureNext);
|
|
536
|
+
}
|
|
537
|
+
if (node.conditionalNext) {
|
|
538
|
+
edges.push(...node.conditionalNext.map((b) => b.target));
|
|
539
|
+
}
|
|
540
|
+
if (node.defaultNext) {
|
|
541
|
+
edges.push(node.defaultNext);
|
|
542
|
+
}
|
|
543
|
+
if (node.type === "approval") {
|
|
544
|
+
const approvalConfig = node.config;
|
|
545
|
+
if (approvalConfig?.approvedTarget) {
|
|
546
|
+
edges.push(approvalConfig.approvedTarget);
|
|
547
|
+
}
|
|
548
|
+
if (approvalConfig?.rejectedTarget) {
|
|
549
|
+
edges.push(approvalConfig.rejectedTarget);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
edges.forEach((targetId) => {
|
|
553
|
+
if (inDegree.has(targetId)) {
|
|
554
|
+
adjacencyList.get(nodeId)?.push(targetId);
|
|
555
|
+
inDegree.set(targetId, (inDegree.get(targetId) || 0) + 1);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
const queue = [];
|
|
560
|
+
const visited = new Set();
|
|
561
|
+
inDegree.forEach((degree, nodeId) => {
|
|
562
|
+
if (degree === 0) {
|
|
563
|
+
queue.push(nodeId);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
while (queue.length > 0) {
|
|
567
|
+
const current = queue.shift();
|
|
568
|
+
visited.add(current);
|
|
569
|
+
const neighbors = adjacencyList.get(current) || [];
|
|
570
|
+
neighbors.forEach((neighbor) => {
|
|
571
|
+
const newDegree = (inDegree.get(neighbor) || 0) - 1;
|
|
572
|
+
inDegree.set(neighbor, newDegree);
|
|
573
|
+
if (newDegree === 0) {
|
|
574
|
+
queue.push(neighbor);
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
if (visited.size < nodeIds.length) {
|
|
579
|
+
const unvisited = nodeIds.filter((id) => !visited.has(id));
|
|
580
|
+
errors.push({
|
|
581
|
+
path: "nodes",
|
|
582
|
+
message: `Circular dependency detected involving nodes: ${unvisited.join(", ")}`,
|
|
583
|
+
code: "CIRCULAR_DEPENDENCY",
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
return errors;
|
|
587
|
+
}
|
|
588
|
+
detectUnreachableNodes(definition) {
|
|
589
|
+
const warnings = [];
|
|
590
|
+
if (!definition.nodes || typeof definition.nodes !== "object") {
|
|
591
|
+
return warnings;
|
|
592
|
+
}
|
|
593
|
+
const reachable = new Set();
|
|
594
|
+
const queue = [definition.startNode];
|
|
595
|
+
while (queue.length > 0) {
|
|
596
|
+
const current = queue.shift();
|
|
597
|
+
if (reachable.has(current)) {
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
reachable.add(current);
|
|
601
|
+
const node = definition.nodes[current];
|
|
602
|
+
if (!node) {
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
if (node.next) {
|
|
606
|
+
queue.push(...node.next);
|
|
607
|
+
}
|
|
608
|
+
if (node.failureNext) {
|
|
609
|
+
queue.push(...node.failureNext);
|
|
610
|
+
}
|
|
611
|
+
if (node.conditionalNext) {
|
|
612
|
+
queue.push(...node.conditionalNext.map((b) => b.target));
|
|
613
|
+
}
|
|
614
|
+
if (node.defaultNext) {
|
|
615
|
+
queue.push(node.defaultNext);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
const allNodeIds = Object.keys(definition.nodes);
|
|
619
|
+
const unreachable = allNodeIds.filter((id) => !reachable.has(id));
|
|
620
|
+
unreachable.forEach((nodeId) => {
|
|
621
|
+
warnings.push({
|
|
622
|
+
path: `nodes.${nodeId}`,
|
|
623
|
+
message: `Node is unreachable from start node: ${nodeId}`,
|
|
624
|
+
code: "UNREACHABLE_NODE",
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
return warnings;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
//# sourceMappingURL=SchemaValidator.js.map
|