@orbytautomation/engine 0.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/README.md +0 -0
- package/dist/adapters/AdapterRegistry.d.ts +129 -0
- package/dist/adapters/AdapterRegistry.d.ts.map +1 -0
- package/dist/adapters/AdapterRegistry.js +236 -0
- package/dist/adapters/AdapterRegistry.js.map +1 -0
- package/dist/adapters/StepAdapter.d.ts +2 -0
- package/dist/adapters/StepAdapter.d.ts.map +1 -0
- package/dist/adapters/StepAdapter.js +2 -0
- package/dist/adapters/StepAdapter.js.map +1 -0
- package/dist/adapters/WorkflowAdapter.d.ts +2 -0
- package/dist/adapters/WorkflowAdapter.d.ts.map +1 -0
- package/dist/adapters/WorkflowAdapter.js +2 -0
- package/dist/adapters/WorkflowAdapter.js.map +1 -0
- package/dist/adapters/builtins/CLIAdapter.d.ts +38 -0
- package/dist/adapters/builtins/CLIAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/CLIAdapter.js +173 -0
- package/dist/adapters/builtins/CLIAdapter.js.map +1 -0
- package/dist/adapters/builtins/CLICommandResolver.d.ts +49 -0
- package/dist/adapters/builtins/CLICommandResolver.d.ts.map +1 -0
- package/dist/adapters/builtins/CLICommandResolver.js +63 -0
- package/dist/adapters/builtins/CLICommandResolver.js.map +1 -0
- package/dist/adapters/builtins/CLIResultParser.d.ts +61 -0
- package/dist/adapters/builtins/CLIResultParser.d.ts.map +1 -0
- package/dist/adapters/builtins/CLIResultParser.js +113 -0
- package/dist/adapters/builtins/CLIResultParser.js.map +1 -0
- package/dist/adapters/builtins/ConnectionManager.d.ts +106 -0
- package/dist/adapters/builtins/ConnectionManager.d.ts.map +1 -0
- package/dist/adapters/builtins/ConnectionManager.js +162 -0
- package/dist/adapters/builtins/ConnectionManager.js.map +1 -0
- package/dist/adapters/builtins/Consumer.d.ts +110 -0
- package/dist/adapters/builtins/Consumer.d.ts.map +1 -0
- package/dist/adapters/builtins/Consumer.js +113 -0
- package/dist/adapters/builtins/Consumer.js.map +1 -0
- package/dist/adapters/builtins/DBAdapter.d.ts +79 -0
- package/dist/adapters/builtins/DBAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/DBAdapter.js +259 -0
- package/dist/adapters/builtins/DBAdapter.js.map +1 -0
- package/dist/adapters/builtins/EnvResolver.d.ts +66 -0
- package/dist/adapters/builtins/EnvResolver.d.ts.map +1 -0
- package/dist/adapters/builtins/EnvResolver.js +121 -0
- package/dist/adapters/builtins/EnvResolver.js.map +1 -0
- package/dist/adapters/builtins/FSAdapter.d.ts +50 -0
- package/dist/adapters/builtins/FSAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/FSAdapter.js +282 -0
- package/dist/adapters/builtins/FSAdapter.js.map +1 -0
- package/dist/adapters/builtins/FileResolver.d.ts +50 -0
- package/dist/adapters/builtins/FileResolver.d.ts.map +1 -0
- package/dist/adapters/builtins/FileResolver.js +77 -0
- package/dist/adapters/builtins/FileResolver.js.map +1 -0
- package/dist/adapters/builtins/HTTPAdapter.d.ts +58 -0
- package/dist/adapters/builtins/HTTPAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/HTTPAdapter.js +213 -0
- package/dist/adapters/builtins/HTTPAdapter.js.map +1 -0
- package/dist/adapters/builtins/HTTPRequestBuilder.d.ts +95 -0
- package/dist/adapters/builtins/HTTPRequestBuilder.d.ts.map +1 -0
- package/dist/adapters/builtins/HTTPRequestBuilder.js +159 -0
- package/dist/adapters/builtins/HTTPRequestBuilder.js.map +1 -0
- package/dist/adapters/builtins/HTTPResponseParser.d.ts +74 -0
- package/dist/adapters/builtins/HTTPResponseParser.d.ts.map +1 -0
- package/dist/adapters/builtins/HTTPResponseParser.js +144 -0
- package/dist/adapters/builtins/HTTPResponseParser.js.map +1 -0
- package/dist/adapters/builtins/PathSecurityPolicy.d.ts +38 -0
- package/dist/adapters/builtins/PathSecurityPolicy.d.ts.map +1 -0
- package/dist/adapters/builtins/PathSecurityPolicy.js +125 -0
- package/dist/adapters/builtins/PathSecurityPolicy.js.map +1 -0
- package/dist/adapters/builtins/Producer.d.ts +99 -0
- package/dist/adapters/builtins/Producer.d.ts.map +1 -0
- package/dist/adapters/builtins/Producer.js +59 -0
- package/dist/adapters/builtins/Producer.js.map +1 -0
- package/dist/adapters/builtins/QueryExecutor.d.ts +102 -0
- package/dist/adapters/builtins/QueryExecutor.d.ts.map +1 -0
- package/dist/adapters/builtins/QueryExecutor.js +90 -0
- package/dist/adapters/builtins/QueryExecutor.js.map +1 -0
- package/dist/adapters/builtins/QueueAdapter.d.ts +72 -0
- package/dist/adapters/builtins/QueueAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/QueueAdapter.js +209 -0
- package/dist/adapters/builtins/QueueAdapter.js.map +1 -0
- package/dist/adapters/builtins/SecretProvider.d.ts +69 -0
- package/dist/adapters/builtins/SecretProvider.d.ts.map +1 -0
- package/dist/adapters/builtins/SecretProvider.js +71 -0
- package/dist/adapters/builtins/SecretProvider.js.map +1 -0
- package/dist/adapters/builtins/SecretsAdapter.d.ts +48 -0
- package/dist/adapters/builtins/SecretsAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/SecretsAdapter.js +154 -0
- package/dist/adapters/builtins/SecretsAdapter.js.map +1 -0
- package/dist/adapters/builtins/ShellAdapter.d.ts +46 -0
- package/dist/adapters/builtins/ShellAdapter.d.ts.map +1 -0
- package/dist/adapters/builtins/ShellAdapter.js +200 -0
- package/dist/adapters/builtins/ShellAdapter.js.map +1 -0
- package/dist/adapters/builtins/ShellExecutor.d.ts +72 -0
- package/dist/adapters/builtins/ShellExecutor.d.ts.map +1 -0
- package/dist/adapters/builtins/ShellExecutor.js +94 -0
- package/dist/adapters/builtins/ShellExecutor.js.map +1 -0
- package/dist/adapters/builtins/ShellSecurityPolicy.d.ts +58 -0
- package/dist/adapters/builtins/ShellSecurityPolicy.d.ts.map +1 -0
- package/dist/adapters/builtins/ShellSecurityPolicy.js +135 -0
- package/dist/adapters/builtins/ShellSecurityPolicy.js.map +1 -0
- package/dist/adapters/builtins/index.d.ts +27 -0
- package/dist/adapters/builtins/index.d.ts.map +1 -0
- package/dist/adapters/builtins/index.js +35 -0
- package/dist/adapters/builtins/index.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +6 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/automation/BackoffStrategy.d.ts +106 -0
- package/dist/automation/BackoffStrategy.d.ts.map +1 -0
- package/dist/automation/BackoffStrategy.js +168 -0
- package/dist/automation/BackoffStrategy.js.map +1 -0
- package/dist/automation/FailureStrategy.d.ts +141 -0
- package/dist/automation/FailureStrategy.d.ts.map +1 -0
- package/dist/automation/FailureStrategy.js +246 -0
- package/dist/automation/FailureStrategy.js.map +1 -0
- package/dist/automation/RetryPolicy.d.ts +132 -0
- package/dist/automation/RetryPolicy.d.ts.map +1 -0
- package/dist/automation/RetryPolicy.js +241 -0
- package/dist/automation/RetryPolicy.js.map +1 -0
- package/dist/automation/TimeoutManager.d.ts +145 -0
- package/dist/automation/TimeoutManager.d.ts.map +1 -0
- package/dist/automation/TimeoutManager.js +241 -0
- package/dist/automation/TimeoutManager.js.map +1 -0
- package/dist/automation/index.d.ts +16 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +16 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/runtime/BackoffTimer.d.ts +74 -0
- package/dist/automation/runtime/BackoffTimer.d.ts.map +1 -0
- package/dist/automation/runtime/BackoffTimer.js +139 -0
- package/dist/automation/runtime/BackoffTimer.js.map +1 -0
- package/dist/automation/runtime/FailureHandler.d.ts +138 -0
- package/dist/automation/runtime/FailureHandler.d.ts.map +1 -0
- package/dist/automation/runtime/FailureHandler.js +197 -0
- package/dist/automation/runtime/FailureHandler.js.map +1 -0
- package/dist/automation/runtime/RetryExecutor.d.ts +104 -0
- package/dist/automation/runtime/RetryExecutor.d.ts.map +1 -0
- package/dist/automation/runtime/RetryExecutor.js +173 -0
- package/dist/automation/runtime/RetryExecutor.js.map +1 -0
- package/dist/automation/runtime/index.d.ts +13 -0
- package/dist/automation/runtime/index.d.ts.map +1 -0
- package/dist/automation/runtime/index.js +13 -0
- package/dist/automation/runtime/index.js.map +1 -0
- package/dist/context/ContextStore.d.ts +185 -0
- package/dist/context/ContextStore.d.ts.map +1 -0
- package/dist/context/ContextStore.js +228 -0
- package/dist/context/ContextStore.js.map +1 -0
- package/dist/context/VariableResolver.d.ts +184 -0
- package/dist/context/VariableResolver.d.ts.map +1 -0
- package/dist/context/VariableResolver.js +368 -0
- package/dist/context/VariableResolver.js.map +1 -0
- package/dist/context/index.d.ts +17 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +17 -0
- package/dist/context/index.js.map +1 -0
- package/dist/core/EngineConfig.d.ts +156 -0
- package/dist/core/EngineConfig.d.ts.map +1 -0
- package/dist/core/EngineConfig.js +61 -0
- package/dist/core/EngineConfig.js.map +1 -0
- package/dist/core/EngineContext.d.ts +94 -0
- package/dist/core/EngineContext.d.ts.map +1 -0
- package/dist/core/EngineContext.js +29 -0
- package/dist/core/EngineContext.js.map +1 -0
- package/dist/core/OrbytEngine.d.ts +234 -0
- package/dist/core/OrbytEngine.d.ts.map +1 -0
- package/dist/core/OrbytEngine.js +421 -0
- package/dist/core/OrbytEngine.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/errors/ErrorCodes.d.ts +71 -0
- package/dist/errors/ErrorCodes.d.ts.map +1 -0
- package/dist/errors/ErrorCodes.js +95 -0
- package/dist/errors/ErrorCodes.js.map +1 -0
- package/dist/errors/ErrorFormatter.d.ts +34 -0
- package/dist/errors/ErrorFormatter.d.ts.map +1 -0
- package/dist/errors/ErrorFormatter.js +140 -0
- package/dist/errors/ErrorFormatter.js.map +1 -0
- package/dist/errors/FieldRegistry.d.ts +83 -0
- package/dist/errors/FieldRegistry.d.ts.map +1 -0
- package/dist/errors/FieldRegistry.js +217 -0
- package/dist/errors/FieldRegistry.js.map +1 -0
- package/dist/errors/OrbytError.d.ts +59 -0
- package/dist/errors/OrbytError.d.ts.map +1 -0
- package/dist/errors/OrbytError.js +78 -0
- package/dist/errors/OrbytError.js.map +1 -0
- package/dist/errors/SchedulerError.d.ts +2 -0
- package/dist/errors/SchedulerError.d.ts.map +1 -0
- package/dist/errors/SchedulerError.js +2 -0
- package/dist/errors/SchedulerError.js.map +1 -0
- package/dist/errors/StepError.d.ts +2 -0
- package/dist/errors/StepError.d.ts.map +1 -0
- package/dist/errors/StepError.js +2 -0
- package/dist/errors/StepError.js.map +1 -0
- package/dist/errors/TypoDetector.d.ts +36 -0
- package/dist/errors/TypoDetector.d.ts.map +1 -0
- package/dist/errors/TypoDetector.js +109 -0
- package/dist/errors/TypoDetector.js.map +1 -0
- package/dist/errors/WorkflowError.d.ts +54 -0
- package/dist/errors/WorkflowError.d.ts.map +1 -0
- package/dist/errors/WorkflowError.js +129 -0
- package/dist/errors/WorkflowError.js.map +1 -0
- package/dist/errors/index.d.ts +14 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +17 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/events/EngineEvents.d.ts +143 -0
- package/dist/events/EngineEvents.d.ts.map +1 -0
- package/dist/events/EngineEvents.js +60 -0
- package/dist/events/EngineEvents.js.map +1 -0
- package/dist/events/EventBus.d.ts +112 -0
- package/dist/events/EventBus.d.ts.map +1 -0
- package/dist/events/EventBus.js +177 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -0
- package/dist/execution/ExecutionEngine.d.ts +220 -0
- package/dist/execution/ExecutionEngine.d.ts.map +1 -0
- package/dist/execution/ExecutionEngine.js +442 -0
- package/dist/execution/ExecutionEngine.js.map +1 -0
- package/dist/execution/ExecutionNode.d.ts +114 -0
- package/dist/execution/ExecutionNode.d.ts.map +1 -0
- package/dist/execution/ExecutionNode.js +99 -0
- package/dist/execution/ExecutionNode.js.map +1 -0
- package/dist/execution/ExecutionPlan.d.ts +133 -0
- package/dist/execution/ExecutionPlan.d.ts.map +1 -0
- package/dist/execution/ExecutionPlan.js +207 -0
- package/dist/execution/ExecutionPlan.js.map +1 -0
- package/dist/execution/StepExecutor.d.ts +204 -0
- package/dist/execution/StepExecutor.d.ts.map +1 -0
- package/dist/execution/StepExecutor.js +604 -0
- package/dist/execution/StepExecutor.js.map +1 -0
- package/dist/execution/WorkflowExecutor.d.ts +129 -0
- package/dist/execution/WorkflowExecutor.d.ts.map +1 -0
- package/dist/execution/WorkflowExecutor.js +347 -0
- package/dist/execution/WorkflowExecutor.js.map +1 -0
- package/dist/execution/drivers/AdapterDriver.d.ts +34 -0
- package/dist/execution/drivers/AdapterDriver.d.ts.map +1 -0
- package/dist/execution/drivers/AdapterDriver.js +63 -0
- package/dist/execution/drivers/AdapterDriver.js.map +1 -0
- package/dist/execution/drivers/DriverResolver.d.ts +91 -0
- package/dist/execution/drivers/DriverResolver.d.ts.map +1 -0
- package/dist/execution/drivers/DriverResolver.js +172 -0
- package/dist/execution/drivers/DriverResolver.js.map +1 -0
- package/dist/execution/drivers/ExecutionDriver.d.ts +127 -0
- package/dist/execution/drivers/ExecutionDriver.d.ts.map +1 -0
- package/dist/execution/drivers/ExecutionDriver.js +50 -0
- package/dist/execution/drivers/ExecutionDriver.js.map +1 -0
- package/dist/execution/drivers/index.d.ts +11 -0
- package/dist/execution/drivers/index.d.ts.map +1 -0
- package/dist/execution/drivers/index.js +11 -0
- package/dist/execution/drivers/index.js.map +1 -0
- package/dist/execution/index.d.ts +18 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +19 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/graph/CycleDetector.d.ts +90 -0
- package/dist/graph/CycleDetector.d.ts.map +1 -0
- package/dist/graph/CycleDetector.js +210 -0
- package/dist/graph/CycleDetector.js.map +1 -0
- package/dist/graph/DependencyGraph.d.ts +16 -0
- package/dist/graph/DependencyGraph.d.ts.map +1 -0
- package/dist/graph/DependencyGraph.js +16 -0
- package/dist/graph/DependencyGraph.js.map +1 -0
- package/dist/graph/DependencyResolver.d.ts +90 -0
- package/dist/graph/DependencyResolver.d.ts.map +1 -0
- package/dist/graph/DependencyResolver.js +159 -0
- package/dist/graph/DependencyResolver.js.map +1 -0
- package/dist/graph/TopologicalSorter.d.ts +104 -0
- package/dist/graph/TopologicalSorter.d.ts.map +1 -0
- package/dist/graph/TopologicalSorter.js +213 -0
- package/dist/graph/TopologicalSorter.js.map +1 -0
- package/dist/graph/index.d.ts +15 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +15 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/guards/ResourceGuard.d.ts +90 -0
- package/dist/guards/ResourceGuard.d.ts.map +1 -0
- package/dist/guards/ResourceGuard.js +177 -0
- package/dist/guards/ResourceGuard.js.map +1 -0
- package/dist/guards/StepGuard.d.ts +96 -0
- package/dist/guards/StepGuard.d.ts.map +1 -0
- package/dist/guards/StepGuard.js +184 -0
- package/dist/guards/StepGuard.js.map +1 -0
- package/dist/guards/WorkflowGuard.d.ts +71 -0
- package/dist/guards/WorkflowGuard.d.ts.map +1 -0
- package/dist/guards/WorkflowGuard.js +187 -0
- package/dist/guards/WorkflowGuard.js.map +1 -0
- package/dist/guards/index.d.ts +9 -0
- package/dist/guards/index.d.ts.map +1 -0
- package/dist/guards/index.js +9 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/hooks/HookManager.d.ts +114 -0
- package/dist/hooks/HookManager.d.ts.map +1 -0
- package/dist/hooks/HookManager.js +187 -0
- package/dist/hooks/HookManager.js.map +1 -0
- package/dist/hooks/LifecycleHooks.d.ts +126 -0
- package/dist/hooks/LifecycleHooks.d.ts.map +1 -0
- package/dist/hooks/LifecycleHooks.js +23 -0
- package/dist/hooks/LifecycleHooks.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/EngineLifecycle.d.ts +121 -0
- package/dist/lifecycle/EngineLifecycle.d.ts.map +1 -0
- package/dist/lifecycle/EngineLifecycle.js +209 -0
- package/dist/lifecycle/EngineLifecycle.js.map +1 -0
- package/dist/lifecycle/ShutdownManager.d.ts +44 -0
- package/dist/lifecycle/ShutdownManager.d.ts.map +1 -0
- package/dist/lifecycle/ShutdownManager.js +105 -0
- package/dist/lifecycle/ShutdownManager.js.map +1 -0
- package/dist/lifecycle/StartupManager.d.ts +45 -0
- package/dist/lifecycle/StartupManager.d.ts.map +1 -0
- package/dist/lifecycle/StartupManager.js +97 -0
- package/dist/lifecycle/StartupManager.js.map +1 -0
- package/dist/lifecycle/index.d.ts +9 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +9 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/logging/LogLevel.d.ts +2 -0
- package/dist/logging/LogLevel.d.ts.map +1 -0
- package/dist/logging/LogLevel.js +2 -0
- package/dist/logging/LogLevel.js.map +1 -0
- package/dist/logging/Logger.d.ts +2 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +2 -0
- package/dist/logging/Logger.js.map +1 -0
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +4 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/marketplace/PluginInstaller.d.ts +81 -0
- package/dist/marketplace/PluginInstaller.d.ts.map +1 -0
- package/dist/marketplace/PluginInstaller.js +89 -0
- package/dist/marketplace/PluginInstaller.js.map +1 -0
- package/dist/marketplace/PluginManifest.d.ts +74 -0
- package/dist/marketplace/PluginManifest.d.ts.map +1 -0
- package/dist/marketplace/PluginManifest.js +67 -0
- package/dist/marketplace/PluginManifest.js.map +1 -0
- package/dist/marketplace/PluginVerifier.d.ts +58 -0
- package/dist/marketplace/PluginVerifier.d.ts.map +1 -0
- package/dist/marketplace/PluginVerifier.js +93 -0
- package/dist/marketplace/PluginVerifier.js.map +1 -0
- package/dist/marketplace/index.d.ts +11 -0
- package/dist/marketplace/index.d.ts.map +1 -0
- package/dist/marketplace/index.js +11 -0
- package/dist/marketplace/index.js.map +1 -0
- package/dist/metrics/MetricsCollector.d.ts +2 -0
- package/dist/metrics/MetricsCollector.d.ts.map +1 -0
- package/dist/metrics/MetricsCollector.js +2 -0
- package/dist/metrics/MetricsCollector.js.map +1 -0
- package/dist/metrics/PerformanceTracker.d.ts +2 -0
- package/dist/metrics/PerformanceTracker.d.ts.map +1 -0
- package/dist/metrics/PerformanceTracker.js +2 -0
- package/dist/metrics/PerformanceTracker.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +4 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/parser/SchemaValidator.d.ts +63 -0
- package/dist/parser/SchemaValidator.d.ts.map +1 -0
- package/dist/parser/SchemaValidator.js +212 -0
- package/dist/parser/SchemaValidator.js.map +1 -0
- package/dist/parser/StepParser.d.ts +124 -0
- package/dist/parser/StepParser.d.ts.map +1 -0
- package/dist/parser/StepParser.js +330 -0
- package/dist/parser/StepParser.js.map +1 -0
- package/dist/parser/WorkflowParser.d.ts +124 -0
- package/dist/parser/WorkflowParser.d.ts.map +1 -0
- package/dist/parser/WorkflowParser.js +141 -0
- package/dist/parser/WorkflowParser.js.map +1 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +4 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/queue/InMemoryQueue.d.ts +97 -0
- package/dist/queue/InMemoryQueue.d.ts.map +1 -0
- package/dist/queue/InMemoryQueue.js +268 -0
- package/dist/queue/InMemoryQueue.js.map +1 -0
- package/dist/queue/JobQueue.d.ts +214 -0
- package/dist/queue/JobQueue.d.ts.map +1 -0
- package/dist/queue/JobQueue.js +46 -0
- package/dist/queue/JobQueue.js.map +1 -0
- package/dist/queue/index.d.ts +10 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +10 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/resolution/ActionRegistry.d.ts +2 -0
- package/dist/resolution/ActionRegistry.d.ts.map +1 -0
- package/dist/resolution/ActionRegistry.js +2 -0
- package/dist/resolution/ActionRegistry.js.map +1 -0
- package/dist/resolution/AdapterResolver.d.ts +2 -0
- package/dist/resolution/AdapterResolver.d.ts.map +1 -0
- package/dist/resolution/AdapterResolver.js +2 -0
- package/dist/resolution/AdapterResolver.js.map +1 -0
- package/dist/resolution/StepResolver.d.ts +2 -0
- package/dist/resolution/StepResolver.d.ts.map +1 -0
- package/dist/resolution/StepResolver.js +2 -0
- package/dist/resolution/StepResolver.js.map +1 -0
- package/dist/resolution/index.d.ts +2 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +2 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/scheduling/CronScheduler.d.ts +143 -0
- package/dist/scheduling/CronScheduler.d.ts.map +1 -0
- package/dist/scheduling/CronScheduler.js +370 -0
- package/dist/scheduling/CronScheduler.js.map +1 -0
- package/dist/scheduling/JobScheduler.d.ts +82 -0
- package/dist/scheduling/JobScheduler.d.ts.map +1 -0
- package/dist/scheduling/JobScheduler.js +231 -0
- package/dist/scheduling/JobScheduler.js.map +1 -0
- package/dist/scheduling/ScheduleParser.d.ts +117 -0
- package/dist/scheduling/ScheduleParser.d.ts.map +1 -0
- package/dist/scheduling/ScheduleParser.js +257 -0
- package/dist/scheduling/ScheduleParser.js.map +1 -0
- package/dist/scheduling/ScheduleTypes.d.ts +153 -0
- package/dist/scheduling/ScheduleTypes.d.ts.map +1 -0
- package/dist/scheduling/ScheduleTypes.js +81 -0
- package/dist/scheduling/ScheduleTypes.js.map +1 -0
- package/dist/scheduling/Scheduler.d.ts +154 -0
- package/dist/scheduling/Scheduler.d.ts.map +1 -0
- package/dist/scheduling/Scheduler.js +304 -0
- package/dist/scheduling/Scheduler.js.map +1 -0
- package/dist/scheduling/index.d.ts +6 -0
- package/dist/scheduling/index.d.ts.map +1 -0
- package/dist/scheduling/index.js +6 -0
- package/dist/scheduling/index.js.map +1 -0
- package/dist/security/PermissionPolicy.d.ts +72 -0
- package/dist/security/PermissionPolicy.d.ts.map +1 -0
- package/dist/security/PermissionPolicy.js +87 -0
- package/dist/security/PermissionPolicy.js.map +1 -0
- package/dist/security/SandboxManager.d.ts +72 -0
- package/dist/security/SandboxManager.d.ts.map +1 -0
- package/dist/security/SandboxManager.js +78 -0
- package/dist/security/SandboxManager.js.map +1 -0
- package/dist/security/index.d.ts +10 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +10 -0
- package/dist/security/index.js.map +1 -0
- package/dist/state/ExecutionState.d.ts +211 -0
- package/dist/state/ExecutionState.d.ts.map +1 -0
- package/dist/state/ExecutionState.js +256 -0
- package/dist/state/ExecutionState.js.map +1 -0
- package/dist/state/StateMachine.d.ts +120 -0
- package/dist/state/StateMachine.d.ts.map +1 -0
- package/dist/state/StateMachine.js +230 -0
- package/dist/state/StateMachine.js.map +1 -0
- package/dist/state/index.d.ts +16 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +16 -0
- package/dist/state/index.js.map +1 -0
- package/dist/storage/ExecutionStore.d.ts +2 -0
- package/dist/storage/ExecutionStore.d.ts.map +1 -0
- package/dist/storage/ExecutionStore.js +2 -0
- package/dist/storage/ExecutionStore.js.map +1 -0
- package/dist/storage/ScheduleStore.d.ts +2 -0
- package/dist/storage/ScheduleStore.d.ts.map +1 -0
- package/dist/storage/ScheduleStore.js +2 -0
- package/dist/storage/ScheduleStore.js.map +1 -0
- package/dist/storage/WorkflowStore.d.ts +2 -0
- package/dist/storage/WorkflowStore.d.ts.map +1 -0
- package/dist/storage/WorkflowStore.js +2 -0
- package/dist/storage/WorkflowStore.js.map +1 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +5 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/testing/EngineTestHarness.d.ts +117 -0
- package/dist/testing/EngineTestHarness.d.ts.map +1 -0
- package/dist/testing/EngineTestHarness.js +132 -0
- package/dist/testing/EngineTestHarness.js.map +1 -0
- package/dist/testing/MockAdapter.d.ts +93 -0
- package/dist/testing/MockAdapter.d.ts.map +1 -0
- package/dist/testing/MockAdapter.js +124 -0
- package/dist/testing/MockAdapter.js.map +1 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +10 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/triggers/CronTrigger.d.ts +2 -0
- package/dist/triggers/CronTrigger.d.ts.map +1 -0
- package/dist/triggers/CronTrigger.js +2 -0
- package/dist/triggers/CronTrigger.js.map +1 -0
- package/dist/triggers/EventTrigger.d.ts +2 -0
- package/dist/triggers/EventTrigger.d.ts.map +1 -0
- package/dist/triggers/EventTrigger.js +2 -0
- package/dist/triggers/EventTrigger.js.map +1 -0
- package/dist/triggers/ManualTrigger.d.ts +2 -0
- package/dist/triggers/ManualTrigger.d.ts.map +1 -0
- package/dist/triggers/ManualTrigger.js +2 -0
- package/dist/triggers/ManualTrigger.js.map +1 -0
- package/dist/triggers/Trigger.d.ts +2 -0
- package/dist/triggers/Trigger.d.ts.map +1 -0
- package/dist/triggers/Trigger.js +2 -0
- package/dist/triggers/Trigger.js.map +1 -0
- package/dist/triggers/index.d.ts +2 -0
- package/dist/triggers/index.d.ts.map +1 -0
- package/dist/triggers/index.js +6 -0
- package/dist/triggers/index.js.map +1 -0
- package/dist/triggers/sources/FileWatcherTrigger.d.ts +2 -0
- package/dist/triggers/sources/FileWatcherTrigger.d.ts.map +1 -0
- package/dist/triggers/sources/FileWatcherTrigger.js +2 -0
- package/dist/triggers/sources/FileWatcherTrigger.js.map +1 -0
- package/dist/triggers/sources/MessageTrigger.d.ts +2 -0
- package/dist/triggers/sources/MessageTrigger.d.ts.map +1 -0
- package/dist/triggers/sources/MessageTrigger.js +2 -0
- package/dist/triggers/sources/MessageTrigger.js.map +1 -0
- package/dist/triggers/sources/WebhookListener.d.ts +2 -0
- package/dist/triggers/sources/WebhookListener.d.ts.map +1 -0
- package/dist/triggers/sources/WebhookListener.js +2 -0
- package/dist/triggers/sources/WebhookListener.js.map +1 -0
- package/dist/triggers/sources/index.d.ts +2 -0
- package/dist/triggers/sources/index.d.ts.map +1 -0
- package/dist/triggers/sources/index.js +2 -0
- package/dist/triggers/sources/index.js.map +1 -0
- package/dist/utils/deepMerge.d.ts +2 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/dist/utils/deepMerge.js +2 -0
- package/dist/utils/deepMerge.js.map +1 -0
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +2 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/safeExec.d.ts +2 -0
- package/dist/utils/safeExec.d.ts.map +1 -0
- package/dist/utils/safeExec.js +2 -0
- package/dist/utils/safeExec.js.map +1 -0
- package/dist/utils/time.d.ts +2 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +2 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/visualization/ExecutionGraphBuilder.d.ts +2 -0
- package/dist/visualization/ExecutionGraphBuilder.d.ts.map +1 -0
- package/dist/visualization/ExecutionGraphBuilder.js +2 -0
- package/dist/visualization/ExecutionGraphBuilder.js.map +1 -0
- package/dist/visualization/ExecutionTraceFormatter.d.ts +2 -0
- package/dist/visualization/ExecutionTraceFormatter.d.ts.map +1 -0
- package/dist/visualization/ExecutionTraceFormatter.js +2 -0
- package/dist/visualization/ExecutionTraceFormatter.js.map +1 -0
- package/dist/visualization/index.d.ts +2 -0
- package/dist/visualization/index.d.ts.map +1 -0
- package/dist/visualization/index.js +2 -0
- package/dist/visualization/index.js.map +1 -0
- package/dist/workflow/Step.d.ts +2 -0
- package/dist/workflow/Step.d.ts.map +1 -0
- package/dist/workflow/Step.js +2 -0
- package/dist/workflow/Step.js.map +1 -0
- package/dist/workflow/StepContext.d.ts +2 -0
- package/dist/workflow/StepContext.d.ts.map +1 -0
- package/dist/workflow/StepContext.js +2 -0
- package/dist/workflow/StepContext.js.map +1 -0
- package/dist/workflow/StepResult.d.ts +2 -0
- package/dist/workflow/StepResult.d.ts.map +1 -0
- package/dist/workflow/StepResult.js +2 -0
- package/dist/workflow/StepResult.js.map +1 -0
- package/dist/workflow/Workflow.d.ts +2 -0
- package/dist/workflow/Workflow.d.ts.map +1 -0
- package/dist/workflow/Workflow.js +2 -0
- package/dist/workflow/Workflow.js.map +1 -0
- package/dist/workflow/WorkflowRegistry.d.ts +2 -0
- package/dist/workflow/WorkflowRegistry.d.ts.map +1 -0
- package/dist/workflow/WorkflowRegistry.js +2 -0
- package/dist/workflow/WorkflowRegistry.js.map +1 -0
- package/dist/workflow/WorkflowState.d.ts +2 -0
- package/dist/workflow/WorkflowState.d.ts.map +1 -0
- package/dist/workflow/WorkflowState.js +2 -0
- package/dist/workflow/WorkflowState.js.map +1 -0
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +8 -0
- package/dist/workflow/index.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates workflow YAML/JSON against Zod schema from @dev-ecosystem/core.
|
|
5
|
+
* Provides enhanced error diagnostics with typo detection and helpful suggestions.
|
|
6
|
+
*
|
|
7
|
+
* @module parser
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { OrbytWorkflowSchema } from '@dev-ecosystem/core';
|
|
11
|
+
import { SchemaError, findMatches, isLikelyTypo, getValidFields, isValidField, OrbytError, ErrorSeverity, } from '../errors/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Enhanced schema validator with diagnostic capabilities
|
|
14
|
+
*/
|
|
15
|
+
export class SchemaValidator {
|
|
16
|
+
/**
|
|
17
|
+
* Validate raw workflow data against Zod schema
|
|
18
|
+
*
|
|
19
|
+
* @param rawWorkflow - Raw workflow object from YAML/JSON
|
|
20
|
+
* @returns Validated and typed workflow definition
|
|
21
|
+
* @throws {OrbytError} If validation fails with detailed diagnostics
|
|
22
|
+
*/
|
|
23
|
+
static validate(rawWorkflow) {
|
|
24
|
+
try {
|
|
25
|
+
// First, check for unknown fields at root level
|
|
26
|
+
this.validateUnknownFields(rawWorkflow, 'root');
|
|
27
|
+
// Use Zod schema from ecosystem-core for structural validation
|
|
28
|
+
const validated = OrbytWorkflowSchema.parse(rawWorkflow);
|
|
29
|
+
// Additional semantic validations
|
|
30
|
+
this.validateWorkflowBody(validated);
|
|
31
|
+
return validated;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// If it's already an OrbytError, rethrow it
|
|
35
|
+
if (error instanceof OrbytError) {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
// Transform Zod errors into diagnostic-rich OrbytErrors
|
|
39
|
+
if (error instanceof z.ZodError) {
|
|
40
|
+
throw this.transformZodError(error);
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check for unknown fields and suggest corrections
|
|
47
|
+
* Enhanced with multiple suggestions and better context
|
|
48
|
+
*
|
|
49
|
+
* @param obj - Object to check
|
|
50
|
+
* @param path - Current path context
|
|
51
|
+
*/
|
|
52
|
+
static validateUnknownFields(obj, path) {
|
|
53
|
+
if (!obj || typeof obj !== 'object') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const validFields = getValidFields(path);
|
|
57
|
+
const actualFields = Object.keys(obj);
|
|
58
|
+
for (const field of actualFields) {
|
|
59
|
+
if (!isValidField(field, path)) {
|
|
60
|
+
// Find multiple suggestions (up to 3)
|
|
61
|
+
const suggestions = findMatches(field, Array.from(validFields), 3, 0.5);
|
|
62
|
+
const bestMatch = suggestions[0];
|
|
63
|
+
// Build hint with multiple suggestions or best match
|
|
64
|
+
let hint;
|
|
65
|
+
if (suggestions.length > 1) {
|
|
66
|
+
hint = `Did you mean one of: ${suggestions.map(s => `"${s}"`).join(', ')}?`;
|
|
67
|
+
}
|
|
68
|
+
else if (bestMatch) {
|
|
69
|
+
hint = `Did you mean "${bestMatch}"?`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
hint = `Valid fields at ${path}: ${Array.from(validFields).join(', ')}`;
|
|
73
|
+
}
|
|
74
|
+
// Check if this looks like a very close typo (>0.8 similarity)
|
|
75
|
+
if (bestMatch && isLikelyTypo(field, bestMatch)) {
|
|
76
|
+
hint = `This looks like a typo of "${bestMatch}"!`;
|
|
77
|
+
}
|
|
78
|
+
// Throw error with enhanced suggestion
|
|
79
|
+
throw new SchemaError({
|
|
80
|
+
code: 'ORB-S-001',
|
|
81
|
+
message: `Unknown field "${field}"`,
|
|
82
|
+
path: path === 'root' ? field : `${path}.${field}`,
|
|
83
|
+
hint,
|
|
84
|
+
severity: ErrorSeverity.ERROR,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// Recursively validate nested objects
|
|
88
|
+
const value = obj[field];
|
|
89
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
90
|
+
const nestedPath = path === 'root' ? field : `${path}.${field}`;
|
|
91
|
+
this.validateUnknownFields(value, nestedPath);
|
|
92
|
+
}
|
|
93
|
+
// Validate array items (steps, triggers, etc.)
|
|
94
|
+
if (Array.isArray(value)) {
|
|
95
|
+
if (field === 'steps') {
|
|
96
|
+
value.forEach((item, index) => {
|
|
97
|
+
if (item && typeof item === 'object') {
|
|
98
|
+
this.validateUnknownFields(item, `workflow.steps[${index}]`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else if (field === 'triggers') {
|
|
103
|
+
value.forEach((item, index) => {
|
|
104
|
+
if (item && typeof item === 'object') {
|
|
105
|
+
this.validateUnknownFields(item, `triggers[${index}]`);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validate workflow body structure and semantics
|
|
114
|
+
*
|
|
115
|
+
* @param workflow - Validated workflow definition
|
|
116
|
+
*/
|
|
117
|
+
static validateWorkflowBody(workflow) {
|
|
118
|
+
// Check if workflow body exists
|
|
119
|
+
if (!workflow.workflow || !workflow.workflow.steps) {
|
|
120
|
+
throw SchemaError.missingField('workflow.steps', 'workflow');
|
|
121
|
+
}
|
|
122
|
+
// Validate steps array is not empty
|
|
123
|
+
if (workflow.workflow.steps.length === 0) {
|
|
124
|
+
throw new SchemaError({
|
|
125
|
+
code: 'ORB-S-003',
|
|
126
|
+
message: 'Workflow must contain at least one step',
|
|
127
|
+
path: 'workflow.steps',
|
|
128
|
+
hint: 'Add at least one step to the workflow.',
|
|
129
|
+
severity: 'error',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Transform Zod validation error into OrbytError with better diagnostics
|
|
135
|
+
*
|
|
136
|
+
* @param error - Zod validation error
|
|
137
|
+
* @returns Enhanced OrbytError
|
|
138
|
+
*/
|
|
139
|
+
static transformZodError(error) {
|
|
140
|
+
// Get the first error (we'll enhance to handle multiple later)
|
|
141
|
+
const firstIssue = error.issues[0];
|
|
142
|
+
const path = firstIssue.path.join('.');
|
|
143
|
+
// Determine error type and create appropriate error
|
|
144
|
+
switch (firstIssue.code) {
|
|
145
|
+
case 'invalid_type':
|
|
146
|
+
// Access properties without casting to specific type
|
|
147
|
+
const expectedType = firstIssue.expected || 'unknown';
|
|
148
|
+
const receivedType = firstIssue.received || 'unknown';
|
|
149
|
+
return SchemaError.invalidType(path.split('.').pop() || 'unknown', expectedType, String(receivedType), path);
|
|
150
|
+
case 'invalid_union':
|
|
151
|
+
// Handle union/enum-like errors
|
|
152
|
+
return new SchemaError({
|
|
153
|
+
code: 'ORB-S-004',
|
|
154
|
+
message: firstIssue.message,
|
|
155
|
+
path,
|
|
156
|
+
hint: 'Check the allowed values in the workflow schema documentation.',
|
|
157
|
+
severity: ErrorSeverity.ERROR,
|
|
158
|
+
});
|
|
159
|
+
default:
|
|
160
|
+
// Generic schema error
|
|
161
|
+
return new SchemaError({
|
|
162
|
+
code: 'ORB-S-002',
|
|
163
|
+
message: firstIssue.message,
|
|
164
|
+
path,
|
|
165
|
+
hint: 'Check the workflow schema documentation.',
|
|
166
|
+
severity: ErrorSeverity.ERROR,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Check if workflow data is valid without throwing
|
|
172
|
+
*
|
|
173
|
+
* @param rawWorkflow - Raw workflow object to validate
|
|
174
|
+
* @returns True if valid, false otherwise
|
|
175
|
+
*/
|
|
176
|
+
static isValid(rawWorkflow) {
|
|
177
|
+
try {
|
|
178
|
+
this.validate(rawWorkflow);
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Safely validate and return result with success/error
|
|
187
|
+
*
|
|
188
|
+
* @param rawWorkflow - Raw workflow object to validate
|
|
189
|
+
* @returns Object with success flag and either data or error
|
|
190
|
+
*/
|
|
191
|
+
static safeParse(rawWorkflow) {
|
|
192
|
+
try {
|
|
193
|
+
const data = this.validate(rawWorkflow);
|
|
194
|
+
return { success: true, data };
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
if (error instanceof OrbytError) {
|
|
198
|
+
return { success: false, error };
|
|
199
|
+
}
|
|
200
|
+
// Wrap unexpected errors
|
|
201
|
+
return {
|
|
202
|
+
success: false,
|
|
203
|
+
error: new SchemaError({
|
|
204
|
+
code: 'ORB-S-005',
|
|
205
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
206
|
+
severity: 'error',
|
|
207
|
+
}),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=SchemaValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaValidator.js","sourceRoot":"","sources":["../../src/parser/SchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAA8B,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAoB;QAClC,IAAI,CAAC;YACH,gDAAgD;YAChD,IAAI,CAAC,qBAAqB,CAAC,WAAkC,EAAE,MAAM,CAAC,CAAC;YAEvE,+DAA+D;YAC/D,MAAM,SAAS,GAAG,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAEzD,kCAAkC;YAClC,IAAI,CAAC,oBAAoB,CAAC,S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WAAW,CAAC,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YACnC,CAAC;YACD,yBAAyB;YACzB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,IAAI,WAAW,CAAC;oBACrB,IAAI,EAAE,WAAkB;oBACxB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;oBACjE,QAAQ,EAAE,OAAc;iBACzB,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Step Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses individual workflow steps and resolves adapter types.
|
|
5
|
+
* Converts validated step definitions into internal Step objects with semantic validation.
|
|
6
|
+
*
|
|
7
|
+
* @module parser
|
|
8
|
+
*/
|
|
9
|
+
import type { StepDefinition as ZodStepDefinition } from '@dev-ecosystem/core';
|
|
10
|
+
/**
|
|
11
|
+
* Parsed internal step representation
|
|
12
|
+
*/
|
|
13
|
+
export interface ParsedStep {
|
|
14
|
+
/** Unique step identifier */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Adapter type (http, shell, cli, plugin, etc.) */
|
|
17
|
+
adapter: string;
|
|
18
|
+
/** Full action name (e.g., 'http.request.get') */
|
|
19
|
+
action: string;
|
|
20
|
+
/** Input parameters for the step */
|
|
21
|
+
input: Record<string, any>;
|
|
22
|
+
/** Step dependencies (other step IDs) */
|
|
23
|
+
needs: string[];
|
|
24
|
+
/** Optional name */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Conditional execution expression */
|
|
27
|
+
when?: string;
|
|
28
|
+
/** Continue workflow on failure */
|
|
29
|
+
continueOnError: boolean;
|
|
30
|
+
/** Retry policy */
|
|
31
|
+
retry?: {
|
|
32
|
+
max: number;
|
|
33
|
+
backoff?: 'linear' | 'exponential';
|
|
34
|
+
delay?: number;
|
|
35
|
+
};
|
|
36
|
+
/** Timeout string (e.g., '30s', '5m') */
|
|
37
|
+
timeout?: string;
|
|
38
|
+
/** Environment variables for this step */
|
|
39
|
+
env?: Record<string, string>;
|
|
40
|
+
/** Output mappings */
|
|
41
|
+
outputs?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parses individual workflow steps with enhanced validation
|
|
45
|
+
*/
|
|
46
|
+
export declare class StepParser {
|
|
47
|
+
/**
|
|
48
|
+
* Parse a step definition into internal representation
|
|
49
|
+
* Enhanced with better validation
|
|
50
|
+
*
|
|
51
|
+
* @param stepDef - Validated step definition from schema
|
|
52
|
+
* @param stepIndex - Index of the step in the workflow (for error messages)
|
|
53
|
+
* @returns Parsed step object ready for execution
|
|
54
|
+
*/
|
|
55
|
+
static parse(stepDef: ZodStepDefinition, stepIndex?: number): ParsedStep;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve adapter type from 'uses' field
|
|
58
|
+
* Enhanced with format validation
|
|
59
|
+
*
|
|
60
|
+
* Examples:
|
|
61
|
+
* 'http.request.get' -> 'http'
|
|
62
|
+
* 'shell.exec' -> 'shell'
|
|
63
|
+
* 'cli.run' -> 'cli'
|
|
64
|
+
* 'mediaproc.image.resize' -> 'plugin'
|
|
65
|
+
*
|
|
66
|
+
* @param uses - The 'uses' field from step definition
|
|
67
|
+
* @param stepPath - Path for error messages
|
|
68
|
+
* @returns Adapter type string
|
|
69
|
+
*/
|
|
70
|
+
static resolveAdapter(uses: string, stepPath?: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Validate conditional expression syntax (basic check)
|
|
73
|
+
* Provides hints for common variable references
|
|
74
|
+
*
|
|
75
|
+
* @param condition - Conditional expression string
|
|
76
|
+
* @param path - Path for error messages
|
|
77
|
+
*/
|
|
78
|
+
private static validateConditionalExpression;
|
|
79
|
+
/**
|
|
80
|
+
* Parse multiple steps
|
|
81
|
+
*
|
|
82
|
+
* @param stepDefs - Array of step definitions
|
|
83
|
+
* @returns Array of parsed steps
|
|
84
|
+
*/
|
|
85
|
+
static parseAll(stepDefs: ZodStepDefinition[]): ParsedStep[];
|
|
86
|
+
/**
|
|
87
|
+
* Validate step IDs are unique
|
|
88
|
+
*
|
|
89
|
+
* @param steps - Array of parsed steps
|
|
90
|
+
* @throws {ValidationError} If duplicate step IDs found
|
|
91
|
+
*/
|
|
92
|
+
static validateUniqueIds(steps: ParsedStep[]): void;
|
|
93
|
+
/**
|
|
94
|
+
* Validate step dependencies (needs) refer to valid steps
|
|
95
|
+
* Enhanced with better error messages and suggestions
|
|
96
|
+
*
|
|
97
|
+
* @param steps - Array of parsed steps
|
|
98
|
+
* @throws {ValidationError} If step references non-existent dependency
|
|
99
|
+
*/
|
|
100
|
+
static validateDependencies(steps: ParsedStep[]): void;
|
|
101
|
+
/**
|
|
102
|
+
* Detect circular dependencies in step graph
|
|
103
|
+
*
|
|
104
|
+
* @param steps - Array of parsed steps
|
|
105
|
+
* @throws {ValidationError} If circular dependency detected
|
|
106
|
+
*/
|
|
107
|
+
static detectCircularDependencies(steps: ParsedStep[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Run all validation checks on parsed steps
|
|
110
|
+
* Enhanced with comprehensive validation
|
|
111
|
+
*
|
|
112
|
+
* @param steps - Array of parsed steps
|
|
113
|
+
* @throws {ValidationError} If any validation fails
|
|
114
|
+
*/
|
|
115
|
+
static validateAll(steps: ParsedStep[]): void;
|
|
116
|
+
/**
|
|
117
|
+
* Validate output references in step output mappings
|
|
118
|
+
* Ensures steps don't reference outputs from steps that haven't executed yet
|
|
119
|
+
*
|
|
120
|
+
* @param steps - Array of parsed steps
|
|
121
|
+
*/
|
|
122
|
+
private static validateOutputReferences;
|
|
123
|
+
}
|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;;OAaG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAsC9D;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAqC5C;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE;IAI5D;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI;IAkBnD;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI;IAyBtD;;;;;OAKG;IACH,MAAM,CAAC,0BAA0B,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI;IA0C5D;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI;IAU7C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;CA6DxC"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Step Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses individual workflow steps and resolves adapter types.
|
|
5
|
+
* Converts validated step definitions into internal Step objects with semantic validation.
|
|
6
|
+
*
|
|
7
|
+
* @module parser
|
|
8
|
+
*/
|
|
9
|
+
import { ValidationError, SchemaError, findClosestMatch, isLikelyTypo } from '../errors/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Parses individual workflow steps with enhanced validation
|
|
12
|
+
*/
|
|
13
|
+
export class StepParser {
|
|
14
|
+
/**
|
|
15
|
+
* Parse a step definition into internal representation
|
|
16
|
+
* Enhanced with better validation
|
|
17
|
+
*
|
|
18
|
+
* @param stepDef - Validated step definition from schema
|
|
19
|
+
* @param stepIndex - Index of the step in the workflow (for error messages)
|
|
20
|
+
* @returns Parsed step object ready for execution
|
|
21
|
+
*/
|
|
22
|
+
static parse(stepDef, stepIndex) {
|
|
23
|
+
const stepPath = stepIndex !== undefined ? `workflow.steps[${stepIndex}]` : 'workflow.steps';
|
|
24
|
+
// Validate required fields
|
|
25
|
+
if (!stepDef.id) {
|
|
26
|
+
throw SchemaError.missingField('id', stepPath);
|
|
27
|
+
}
|
|
28
|
+
// Validate ID format (alphanumeric, hyphens, underscores)
|
|
29
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(stepDef.id)) {
|
|
30
|
+
throw new SchemaError({
|
|
31
|
+
code: 'ORB-S-006',
|
|
32
|
+
message: `Invalid step ID format: "${stepDef.id}"`,
|
|
33
|
+
path: `${stepPath}.id`,
|
|
34
|
+
hint: 'Step IDs must start with a letter and contain only letters, numbers, hyphens, and underscores.',
|
|
35
|
+
severity: 'error',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!stepDef.uses) {
|
|
39
|
+
throw SchemaError.missingField('uses', `${stepPath}.${stepDef.id}`);
|
|
40
|
+
}
|
|
41
|
+
// Resolve adapter type from the 'uses' field (with validation)
|
|
42
|
+
const adapter = this.resolveAdapter(stepDef.uses, `${stepPath}.${stepDef.id}`);
|
|
43
|
+
// Validate conditional expression if present
|
|
44
|
+
if (stepDef.when) {
|
|
45
|
+
this.validateConditionalExpression(stepDef.when, `${stepPath}.${stepDef.id}.when`);
|
|
46
|
+
}
|
|
47
|
+
// Build parsed step
|
|
48
|
+
const parsedStep = {
|
|
49
|
+
id: stepDef.id,
|
|
50
|
+
adapter,
|
|
51
|
+
action: stepDef.uses,
|
|
52
|
+
input: stepDef.with || {},
|
|
53
|
+
needs: stepDef.needs || [],
|
|
54
|
+
name: stepDef.name,
|
|
55
|
+
when: stepDef.when,
|
|
56
|
+
continueOnError: stepDef.continueOnError || false,
|
|
57
|
+
timeout: stepDef.timeout,
|
|
58
|
+
env: stepDef.env,
|
|
59
|
+
outputs: stepDef.outputs,
|
|
60
|
+
};
|
|
61
|
+
// Copy retry policy if present
|
|
62
|
+
if (stepDef.retry) {
|
|
63
|
+
parsedStep.retry = {
|
|
64
|
+
max: stepDef.retry.max,
|
|
65
|
+
backoff: stepDef.retry.backoff,
|
|
66
|
+
delay: stepDef.retry.delay,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return parsedStep;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve adapter type from 'uses' field
|
|
73
|
+
* Enhanced with format validation
|
|
74
|
+
*
|
|
75
|
+
* Examples:
|
|
76
|
+
* 'http.request.get' -> 'http'
|
|
77
|
+
* 'shell.exec' -> 'shell'
|
|
78
|
+
* 'cli.run' -> 'cli'
|
|
79
|
+
* 'mediaproc.image.resize' -> 'plugin'
|
|
80
|
+
*
|
|
81
|
+
* @param uses - The 'uses' field from step definition
|
|
82
|
+
* @param stepPath - Path for error messages
|
|
83
|
+
* @returns Adapter type string
|
|
84
|
+
*/
|
|
85
|
+
static resolveAdapter(uses, stepPath) {
|
|
86
|
+
// Validate format: must contain at least one dot
|
|
87
|
+
if (!uses.includes('.')) {
|
|
88
|
+
throw new SchemaError({
|
|
89
|
+
code: 'ORB-S-006',
|
|
90
|
+
message: `Invalid action format: "${uses}"`,
|
|
91
|
+
path: stepPath ? `${stepPath}.uses` : 'step.uses',
|
|
92
|
+
hint: 'Action format must be: namespace.action (e.g., "http.request" or "shell.exec")',
|
|
93
|
+
severity: 'error',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Extract prefix before first dot
|
|
97
|
+
const prefix = uses.split('.')[0];
|
|
98
|
+
// Built-in adapter types
|
|
99
|
+
const builtInAdapters = ['http', 'shell', 'cli', 'fs', 'webhook'];
|
|
100
|
+
if (builtInAdapters.includes(prefix)) {
|
|
101
|
+
return prefix;
|
|
102
|
+
}
|
|
103
|
+
// Check for common typos in built-in adapters
|
|
104
|
+
const closestAdapter = findClosestMatch(prefix, builtInAdapters, 0.7);
|
|
105
|
+
if (closestAdapter && isLikelyTypo(prefix, closestAdapter)) {
|
|
106
|
+
throw new SchemaError({
|
|
107
|
+
code: 'ORB-V-008',
|
|
108
|
+
message: `Unknown adapter: "${prefix}"`,
|
|
109
|
+
path: stepPath ? `${stepPath}.uses` : 'step.uses',
|
|
110
|
+
hint: `Did you mean "${closestAdapter}"? (Built-in adapters: ${builtInAdapters.join(', ')})`,
|
|
111
|
+
severity: 'error',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Everything else is a plugin adapter
|
|
115
|
+
return 'plugin';
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Validate conditional expression syntax (basic check)
|
|
119
|
+
* Provides hints for common variable references
|
|
120
|
+
*
|
|
121
|
+
* @param condition - Conditional expression string
|
|
122
|
+
* @param path - Path for error messages
|
|
123
|
+
*/
|
|
124
|
+
static validateConditionalExpression(condition, path) {
|
|
125
|
+
// Check for empty condition
|
|
126
|
+
if (!condition || condition.trim().length === 0) {
|
|
127
|
+
throw new SchemaError({
|
|
128
|
+
code: 'ORB-S-006',
|
|
129
|
+
message: 'Conditional expression cannot be empty',
|
|
130
|
+
path,
|
|
131
|
+
hint: 'Provide a valid expression or remove the "when" field.',
|
|
132
|
+
severity: 'error',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// Check for common variable reference patterns and provide hints
|
|
136
|
+
const validPrefixes = ['inputs.', 'secrets.', 'steps.', 'context.'];
|
|
137
|
+
const hasVariable = /\$\{([^}]+)\}/.test(condition);
|
|
138
|
+
if (hasVariable) {
|
|
139
|
+
// Extract variables
|
|
140
|
+
const variables = condition.match(/\$\{([^}]+)\}/g) || [];
|
|
141
|
+
for (const variable of variables) {
|
|
142
|
+
const varName = variable.slice(2, -1); // Remove ${ and }
|
|
143
|
+
const hasValidPrefix = validPrefixes.some(prefix => varName.startsWith(prefix));
|
|
144
|
+
if (!hasValidPrefix && !varName.startsWith('env.')) {
|
|
145
|
+
throw new SchemaError({
|
|
146
|
+
code: 'ORB-V-006',
|
|
147
|
+
message: `Invalid variable reference: "${variable}"`,
|
|
148
|
+
path,
|
|
149
|
+
hint: `Variables must start with one of: ${validPrefixes.join(', ')}`,
|
|
150
|
+
severity: 'error',
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Parse multiple steps
|
|
158
|
+
*
|
|
159
|
+
* @param stepDefs - Array of step definitions
|
|
160
|
+
* @returns Array of parsed steps
|
|
161
|
+
*/
|
|
162
|
+
static parseAll(stepDefs) {
|
|
163
|
+
return stepDefs.map((step, index) => this.parse(step, index));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Validate step IDs are unique
|
|
167
|
+
*
|
|
168
|
+
* @param steps - Array of parsed steps
|
|
169
|
+
* @throws {ValidationError} If duplicate step IDs found
|
|
170
|
+
*/
|
|
171
|
+
static validateUniqueIds(steps) {
|
|
172
|
+
const idMap = new Map();
|
|
173
|
+
steps.forEach((step, index) => {
|
|
174
|
+
if (idMap.has(step.id)) {
|
|
175
|
+
const firstIndex = idMap.get(step.id);
|
|
176
|
+
throw new ValidationError({
|
|
177
|
+
code: 'ORB-V-001',
|
|
178
|
+
message: `Duplicate step ID "${step.id}"`,
|
|
179
|
+
path: `workflow.steps[${index}]`,
|
|
180
|
+
hint: `Step ID "${step.id}" was already defined at workflow.steps[${firstIndex}]. Step IDs must be unique.`,
|
|
181
|
+
severity: 'error',
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
idMap.set(step.id, index);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Validate step dependencies (needs) refer to valid steps
|
|
189
|
+
* Enhanced with better error messages and suggestions
|
|
190
|
+
*
|
|
191
|
+
* @param steps - Array of parsed steps
|
|
192
|
+
* @throws {ValidationError} If step references non-existent dependency
|
|
193
|
+
*/
|
|
194
|
+
static validateDependencies(steps) {
|
|
195
|
+
const stepIds = new Set(steps.map(s => s.id));
|
|
196
|
+
const allStepIds = Array.from(stepIds);
|
|
197
|
+
steps.forEach((step, index) => {
|
|
198
|
+
for (const dependency of step.needs) {
|
|
199
|
+
if (!stepIds.has(dependency)) {
|
|
200
|
+
// Try to find similar step IDs
|
|
201
|
+
const suggestion = findClosestMatch(dependency, allStepIds, 0.6);
|
|
202
|
+
const hint = suggestion
|
|
203
|
+
? `Did you mean "${suggestion}"? Available steps: ${allStepIds.join(', ')}`
|
|
204
|
+
: `Available steps: ${allStepIds.join(', ')}`;
|
|
205
|
+
throw new ValidationError({
|
|
206
|
+
code: 'ORB-V-002',
|
|
207
|
+
message: `Unknown step "${dependency}"`,
|
|
208
|
+
path: `workflow.steps[${index}].needs`,
|
|
209
|
+
hint,
|
|
210
|
+
severity: 'error',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Detect circular dependencies in step graph
|
|
218
|
+
*
|
|
219
|
+
* @param steps - Array of parsed steps
|
|
220
|
+
* @throws {ValidationError} If circular dependency detected
|
|
221
|
+
*/
|
|
222
|
+
static detectCircularDependencies(steps) {
|
|
223
|
+
const stepMap = new Map(steps.map((s, i) => [s.id, { step: s, index: i }]));
|
|
224
|
+
const visited = new Set();
|
|
225
|
+
const recursionStack = new Set();
|
|
226
|
+
function visit(stepId, path) {
|
|
227
|
+
if (recursionStack.has(stepId)) {
|
|
228
|
+
// Found cycle
|
|
229
|
+
const cycleStart = path.indexOf(stepId);
|
|
230
|
+
const cycle = path.slice(cycleStart).concat(stepId);
|
|
231
|
+
throw ValidationError.circularDependency(cycle, 'workflow.steps');
|
|
232
|
+
}
|
|
233
|
+
if (visited.has(stepId)) {
|
|
234
|
+
return; // Already processed
|
|
235
|
+
}
|
|
236
|
+
visited.add(stepId);
|
|
237
|
+
recursionStack.add(stepId);
|
|
238
|
+
// Visit dependencies
|
|
239
|
+
const stepData = stepMap.get(stepId);
|
|
240
|
+
if (stepData) {
|
|
241
|
+
for (const dep of stepData.step.needs) {
|
|
242
|
+
visit(dep, [...path, stepId]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
recursionStack.delete(stepId);
|
|
246
|
+
}
|
|
247
|
+
// Visit all steps
|
|
248
|
+
for (const step of steps) {
|
|
249
|
+
if (!visited.has(step.id)) {
|
|
250
|
+
visit(step.id, []);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Run all validation checks on parsed steps
|
|
256
|
+
* Enhanced with comprehensive validation
|
|
257
|
+
*
|
|
258
|
+
* @param steps - Array of parsed steps
|
|
259
|
+
* @throws {ValidationError} If any validation fails
|
|
260
|
+
*/
|
|
261
|
+
static validateAll(steps) {
|
|
262
|
+
// Order matters: check basic constraints first
|
|
263
|
+
this.validateUniqueIds(steps);
|
|
264
|
+
this.validateDependencies(steps);
|
|
265
|
+
this.detectCircularDependencies(steps);
|
|
266
|
+
// Additional semantic validations
|
|
267
|
+
this.validateOutputReferences(steps);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Validate output references in step output mappings
|
|
271
|
+
* Ensures steps don't reference outputs from steps that haven't executed yet
|
|
272
|
+
*
|
|
273
|
+
* @param steps - Array of parsed steps
|
|
274
|
+
*/
|
|
275
|
+
static validateOutputReferences(steps) {
|
|
276
|
+
// Build execution order considering dependencies
|
|
277
|
+
const stepMap = new Map(steps.map(s => [s.id, s]));
|
|
278
|
+
const executed = new Set();
|
|
279
|
+
// Simple topological order (dependencies-first)
|
|
280
|
+
const getExecutionOrder = () => {
|
|
281
|
+
const order = [];
|
|
282
|
+
const visited = new Set();
|
|
283
|
+
function visit(stepId) {
|
|
284
|
+
if (visited.has(stepId))
|
|
285
|
+
return;
|
|
286
|
+
visited.add(stepId);
|
|
287
|
+
const step = stepMap.get(stepId);
|
|
288
|
+
if (step) {
|
|
289
|
+
// Visit dependencies first
|
|
290
|
+
for (const dep of step.needs) {
|
|
291
|
+
visit(dep);
|
|
292
|
+
}
|
|
293
|
+
order.push(stepId);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
for (const step of steps) {
|
|
297
|
+
visit(step.id);
|
|
298
|
+
}
|
|
299
|
+
return order;
|
|
300
|
+
};
|
|
301
|
+
const executionOrder = getExecutionOrder();
|
|
302
|
+
// Validate each step's outputs don't reference future steps
|
|
303
|
+
executionOrder.forEach((stepId) => {
|
|
304
|
+
const step = stepMap.get(stepId);
|
|
305
|
+
if (!step || !step.outputs)
|
|
306
|
+
return;
|
|
307
|
+
// Check if output values reference other steps
|
|
308
|
+
for (const [outputKey, outputValue] of Object.entries(step.outputs)) {
|
|
309
|
+
// Look for ${steps.X.outputs.Y} patterns
|
|
310
|
+
const stepRefs = outputValue.match(/\$\{steps\.([^.]+)\./g);
|
|
311
|
+
if (stepRefs) {
|
|
312
|
+
for (const ref of stepRefs) {
|
|
313
|
+
const referencedStepId = ref.match(/steps\.([^.]+)/)?.[1];
|
|
314
|
+
if (referencedStepId && !executed.has(referencedStepId)) {
|
|
315
|
+
throw new ValidationError({
|
|
316
|
+
code: 'ORB-V-005',
|
|
317
|
+
message: `Step "${stepId}" references output from "${referencedStepId}" which hasn't executed yet`,
|
|
318
|
+
path: `workflow.steps[${steps.findIndex(s => s.id === stepId)}].outputs.${outputKey}`,
|
|
319
|
+
hint: `Add "${referencedStepId}" to the "needs" array of step "${stepId}".`,
|
|
320
|
+
severity: 'error',
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
executed.add(stepId);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=StepParser.js.map
|