@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,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeout Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages execution timeouts for operations and steps.
|
|
5
|
+
* Provides timeout enforcement, parsing, and cleanup handling.
|
|
6
|
+
*
|
|
7
|
+
* @module automation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Timeout error
|
|
11
|
+
*/
|
|
12
|
+
export declare class TimeoutError extends Error {
|
|
13
|
+
readonly timeoutMs: number;
|
|
14
|
+
readonly operation?: string | undefined;
|
|
15
|
+
constructor(message: string, timeoutMs: number, operation?: string | undefined);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Timeout configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface TimeoutConfig {
|
|
21
|
+
/** Timeout duration in milliseconds */
|
|
22
|
+
timeoutMs: number;
|
|
23
|
+
/** Operation name for error messages */
|
|
24
|
+
operation?: string;
|
|
25
|
+
/** Cleanup function to run on timeout */
|
|
26
|
+
onTimeout?: () => Promise<void> | void;
|
|
27
|
+
/** Whether to run cleanup before throwing (default: true) */
|
|
28
|
+
cleanupBeforeThrow?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Timeout result
|
|
32
|
+
*/
|
|
33
|
+
export interface TimeoutResult<T> {
|
|
34
|
+
/** Operation result (undefined if timed out) */
|
|
35
|
+
result?: T;
|
|
36
|
+
/** Whether operation timed out */
|
|
37
|
+
timedOut: boolean;
|
|
38
|
+
/** Actual duration in milliseconds */
|
|
39
|
+
durationMs: number;
|
|
40
|
+
/** Timeout error if timed out */
|
|
41
|
+
error?: TimeoutError;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Timeout manager for execution control
|
|
45
|
+
*/
|
|
46
|
+
export declare class TimeoutManager {
|
|
47
|
+
/**
|
|
48
|
+
* Execute operation with timeout
|
|
49
|
+
*
|
|
50
|
+
* @param operation - Async operation to execute
|
|
51
|
+
* @param config - Timeout configuration
|
|
52
|
+
* @returns Operation result
|
|
53
|
+
* @throws TimeoutError if operation times out
|
|
54
|
+
*/
|
|
55
|
+
static execute<T>(operation: () => Promise<T>, config: TimeoutConfig): Promise<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Execute operation with timeout (non-throwing version)
|
|
58
|
+
* Returns result object indicating success or timeout
|
|
59
|
+
*
|
|
60
|
+
* @param operation - Async operation to execute
|
|
61
|
+
* @param config - Timeout configuration
|
|
62
|
+
* @returns Timeout result
|
|
63
|
+
*/
|
|
64
|
+
static executeWithResult<T>(operation: () => Promise<T>, config: TimeoutConfig): Promise<TimeoutResult<T>>;
|
|
65
|
+
/**
|
|
66
|
+
* Parse timeout string to milliseconds
|
|
67
|
+
*
|
|
68
|
+
* Supported formats:
|
|
69
|
+
* - "30s" -> 30000ms
|
|
70
|
+
* - "5m" -> 300000ms
|
|
71
|
+
* - "2h" -> 7200000ms
|
|
72
|
+
* - "1000" -> 1000ms (raw number)
|
|
73
|
+
*
|
|
74
|
+
* @param timeoutStr - Timeout string
|
|
75
|
+
* @returns Timeout in milliseconds
|
|
76
|
+
* @throws Error if format is invalid
|
|
77
|
+
*/
|
|
78
|
+
static parseTimeout(timeoutStr: string): number;
|
|
79
|
+
/**
|
|
80
|
+
* Format milliseconds to human-readable string
|
|
81
|
+
*
|
|
82
|
+
* @param ms - Milliseconds
|
|
83
|
+
* @returns Formatted string (e.g., "30s", "5m")
|
|
84
|
+
*/
|
|
85
|
+
static formatTimeout(ms: number): string;
|
|
86
|
+
/**
|
|
87
|
+
* Create timeout config from timeout string
|
|
88
|
+
*
|
|
89
|
+
* @param timeoutStr - Timeout string (e.g., "30s")
|
|
90
|
+
* @param operation - Operation name
|
|
91
|
+
* @param onTimeout - Cleanup function
|
|
92
|
+
* @returns Timeout configuration
|
|
93
|
+
*/
|
|
94
|
+
static createConfig(timeoutStr: string, operation?: string, onTimeout?: () => Promise<void> | void): TimeoutConfig;
|
|
95
|
+
/**
|
|
96
|
+
* Create abort controller with timeout
|
|
97
|
+
* Useful for cancellable operations
|
|
98
|
+
*
|
|
99
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
100
|
+
* @returns Abort controller that aborts after timeout
|
|
101
|
+
*/
|
|
102
|
+
static createAbortController(timeoutMs: number): AbortController;
|
|
103
|
+
/**
|
|
104
|
+
* Check if error is a timeout error
|
|
105
|
+
*
|
|
106
|
+
* @param error - Error to check
|
|
107
|
+
* @returns True if timeout error
|
|
108
|
+
*/
|
|
109
|
+
static isTimeoutError(error: unknown): error is TimeoutError;
|
|
110
|
+
/**
|
|
111
|
+
* Validate timeout value
|
|
112
|
+
*
|
|
113
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
114
|
+
* @param min - Minimum allowed timeout
|
|
115
|
+
* @param max - Maximum allowed timeout
|
|
116
|
+
* @throws Error if timeout is invalid
|
|
117
|
+
*/
|
|
118
|
+
static validateTimeout(timeoutMs: number, min?: number, max?: number): void;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Predefined timeout configurations
|
|
122
|
+
*/
|
|
123
|
+
export declare const TimeoutConfigs: {
|
|
124
|
+
/** 10 second timeout */
|
|
125
|
+
readonly short: {
|
|
126
|
+
readonly timeoutMs: 10000;
|
|
127
|
+
};
|
|
128
|
+
/** 30 second timeout */
|
|
129
|
+
readonly standard: {
|
|
130
|
+
readonly timeoutMs: 30000;
|
|
131
|
+
};
|
|
132
|
+
/** 5 minute timeout */
|
|
133
|
+
readonly long: {
|
|
134
|
+
readonly timeoutMs: 300000;
|
|
135
|
+
};
|
|
136
|
+
/** 30 minute timeout */
|
|
137
|
+
readonly veryLong: {
|
|
138
|
+
readonly timeoutMs: 1800000;
|
|
139
|
+
};
|
|
140
|
+
/** No timeout (24 hours) */
|
|
141
|
+
readonly none: {
|
|
142
|
+
readonly timeoutMs: 86400000;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=TimeoutManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeoutManager.d.ts","sourceRo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KG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAaxC;;;;;;;OAOG;IACH,MAAM,CAAC,YAAY,CACjB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACrC,aAAa;IAQhB;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe;IAehE;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY;IAI5D;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAI,EAAE,GAAG,SAAW,GAAG,IAAI;CAQzE;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB,wBAAwB;;;;IAGxB,wBAAwB;;;;IAGxB,uBAAuB;;;;IAGvB,wBAAwB;;;;IAGxB,4BAA4B;;;;CAEpB,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeout Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages execution timeouts for operations and steps.
|
|
5
|
+
* Provides timeout enforcement, parsing, and cleanup handling.
|
|
6
|
+
*
|
|
7
|
+
* @module automation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Timeout error
|
|
11
|
+
*/
|
|
12
|
+
export class TimeoutError extends Error {
|
|
13
|
+
timeoutMs;
|
|
14
|
+
operation;
|
|
15
|
+
constructor(message, timeoutMs, operation) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.timeoutMs = timeoutMs;
|
|
18
|
+
this.operation = operation;
|
|
19
|
+
this.name = 'TimeoutError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Timeout manager for execution control
|
|
24
|
+
*/
|
|
25
|
+
export class TimeoutManager {
|
|
26
|
+
/**
|
|
27
|
+
* Execute operation with timeout
|
|
28
|
+
*
|
|
29
|
+
* @param operation - Async operation to execute
|
|
30
|
+
* @param config - Timeout configuration
|
|
31
|
+
* @returns Operation result
|
|
32
|
+
* @throws TimeoutError if operation times out
|
|
33
|
+
*/
|
|
34
|
+
static async execute(operation, config) {
|
|
35
|
+
const startTime = Date.now();
|
|
36
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
37
|
+
const timeout = setTimeout(async () => {
|
|
38
|
+
const elapsedMs = Date.now() - startTime;
|
|
39
|
+
const error = new TimeoutError(config.operation
|
|
40
|
+
? `Operation "${config.operation}" timed out after ${config.timeoutMs}ms (elapsed: ${elapsedMs}ms)`
|
|
41
|
+
: `Operation timed out after ${config.timeoutMs}ms (elapsed: ${elapsedMs}ms)`, config.timeoutMs, config.operation);
|
|
42
|
+
// Add timing metadata to error
|
|
43
|
+
error.timing = {
|
|
44
|
+
timeoutMs: config.timeoutMs,
|
|
45
|
+
elapsedMs,
|
|
46
|
+
startTime,
|
|
47
|
+
};
|
|
48
|
+
// Run cleanup if configured
|
|
49
|
+
if (config.onTimeout && (config.cleanupBeforeThrow ?? true)) {
|
|
50
|
+
try {
|
|
51
|
+
await config.onTimeout();
|
|
52
|
+
}
|
|
53
|
+
catch (cleanupError) {
|
|
54
|
+
console.error('Timeout cleanup failed:', cleanupError);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
reject(error);
|
|
58
|
+
}, config.timeoutMs);
|
|
59
|
+
// Ensure timeout is cleared if operation completes
|
|
60
|
+
timeout.unref?.();
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
const result = await Promise.race([operation(), timeoutPromise]);
|
|
64
|
+
// Add successful execution time for monitoring
|
|
65
|
+
const executionTime = Date.now() - startTime;
|
|
66
|
+
if (result && typeof result === 'object' && result !== null) {
|
|
67
|
+
result.__executionTime = executionTime;
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
// If it's our timeout error, re-throw
|
|
73
|
+
if (error instanceof TimeoutError) {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
// Otherwise, it's an error from the operation
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Execute operation with timeout (non-throwing version)
|
|
82
|
+
* Returns result object indicating success or timeout
|
|
83
|
+
*
|
|
84
|
+
* @param operation - Async operation to execute
|
|
85
|
+
* @param config - Timeout configuration
|
|
86
|
+
* @returns Timeout result
|
|
87
|
+
*/
|
|
88
|
+
static async executeWithResult(operation, config) {
|
|
89
|
+
const startTime = Date.now();
|
|
90
|
+
try {
|
|
91
|
+
const result = await this.execute(operation, config);
|
|
92
|
+
return {
|
|
93
|
+
result,
|
|
94
|
+
timedOut: false,
|
|
95
|
+
durationMs: Date.now() - startTime,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof TimeoutError) {
|
|
100
|
+
return {
|
|
101
|
+
timedOut: true,
|
|
102
|
+
durationMs: Date.now() - startTime,
|
|
103
|
+
error,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// Re-throw non-timeout errors
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse timeout string to milliseconds
|
|
112
|
+
*
|
|
113
|
+
* Supported formats:
|
|
114
|
+
* - "30s" -> 30000ms
|
|
115
|
+
* - "5m" -> 300000ms
|
|
116
|
+
* - "2h" -> 7200000ms
|
|
117
|
+
* - "1000" -> 1000ms (raw number)
|
|
118
|
+
*
|
|
119
|
+
* @param timeoutStr - Timeout string
|
|
120
|
+
* @returns Timeout in milliseconds
|
|
121
|
+
* @throws Error if format is invalid
|
|
122
|
+
*/
|
|
123
|
+
static parseTimeout(timeoutStr) {
|
|
124
|
+
const trimmed = timeoutStr.trim();
|
|
125
|
+
// Raw number (milliseconds)
|
|
126
|
+
if (/^\d+$/.test(trimmed)) {
|
|
127
|
+
return parseInt(trimmed, 10);
|
|
128
|
+
}
|
|
129
|
+
// Parse with unit
|
|
130
|
+
const match = /^(\d+(?:\.\d+)?)(ms|s|m|h)$/.exec(trimmed);
|
|
131
|
+
if (!match) {
|
|
132
|
+
throw new Error(`Invalid timeout format: "${timeoutStr}". Expected: "30s", "5m", "2h", or raw ms`);
|
|
133
|
+
}
|
|
134
|
+
const value = parseFloat(match[1]);
|
|
135
|
+
const unit = match[2];
|
|
136
|
+
switch (unit) {
|
|
137
|
+
case 'ms':
|
|
138
|
+
return value;
|
|
139
|
+
case 's':
|
|
140
|
+
return value * 1000;
|
|
141
|
+
case 'm':
|
|
142
|
+
return value * 60 * 1000;
|
|
143
|
+
case 'h':
|
|
144
|
+
return value * 60 * 60 * 1000;
|
|
145
|
+
default:
|
|
146
|
+
throw new Error(`Unknown time unit: ${unit}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Format milliseconds to human-readable string
|
|
151
|
+
*
|
|
152
|
+
* @param ms - Milliseconds
|
|
153
|
+
* @returns Formatted string (e.g., "30s", "5m")
|
|
154
|
+
*/
|
|
155
|
+
static formatTimeout(ms) {
|
|
156
|
+
if (ms < 1000) {
|
|
157
|
+
return `${ms}ms`;
|
|
158
|
+
}
|
|
159
|
+
if (ms < 60000) {
|
|
160
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
161
|
+
}
|
|
162
|
+
if (ms < 3600000) {
|
|
163
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
164
|
+
}
|
|
165
|
+
return `${(ms / 3600000).toFixed(1)}h`;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create timeout config from timeout string
|
|
169
|
+
*
|
|
170
|
+
* @param timeoutStr - Timeout string (e.g., "30s")
|
|
171
|
+
* @param operation - Operation name
|
|
172
|
+
* @param onTimeout - Cleanup function
|
|
173
|
+
* @returns Timeout configuration
|
|
174
|
+
*/
|
|
175
|
+
static createConfig(timeoutStr, operation, onTimeout) {
|
|
176
|
+
return {
|
|
177
|
+
timeoutMs: this.parseTimeout(timeoutStr),
|
|
178
|
+
operation,
|
|
179
|
+
onTimeout,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Create abort controller with timeout
|
|
184
|
+
* Useful for cancellable operations
|
|
185
|
+
*
|
|
186
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
187
|
+
* @returns Abort controller that aborts after timeout
|
|
188
|
+
*/
|
|
189
|
+
static createAbortController(timeoutMs) {
|
|
190
|
+
const controller = new AbortController();
|
|
191
|
+
const timeout = setTimeout(() => {
|
|
192
|
+
controller.abort();
|
|
193
|
+
}, timeoutMs);
|
|
194
|
+
// Clean up timeout if signal is aborted manually
|
|
195
|
+
controller.signal.addEventListener('abort', () => {
|
|
196
|
+
clearTimeout(timeout);
|
|
197
|
+
}, { once: true });
|
|
198
|
+
return controller;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Check if error is a timeout error
|
|
202
|
+
*
|
|
203
|
+
* @param error - Error to check
|
|
204
|
+
* @returns True if timeout error
|
|
205
|
+
*/
|
|
206
|
+
static isTimeoutError(error) {
|
|
207
|
+
return error instanceof TimeoutError;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Validate timeout value
|
|
211
|
+
*
|
|
212
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
213
|
+
* @param min - Minimum allowed timeout
|
|
214
|
+
* @param max - Maximum allowed timeout
|
|
215
|
+
* @throws Error if timeout is invalid
|
|
216
|
+
*/
|
|
217
|
+
static validateTimeout(timeoutMs, min = 0, max = Infinity) {
|
|
218
|
+
if (timeoutMs < min) {
|
|
219
|
+
throw new Error(`Timeout must be >= ${min}ms, got: ${timeoutMs}ms`);
|
|
220
|
+
}
|
|
221
|
+
if (timeoutMs > max) {
|
|
222
|
+
throw new Error(`Timeout must be <= ${max}ms, got: ${timeoutMs}ms`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Predefined timeout configurations
|
|
228
|
+
*/
|
|
229
|
+
export const TimeoutConfigs = {
|
|
230
|
+
/** 10 second timeout */
|
|
231
|
+
short: { timeoutMs: 10000 },
|
|
232
|
+
/** 30 second timeout */
|
|
233
|
+
standard: { timeoutMs: 30000 },
|
|
234
|
+
/** 5 minute timeout */
|
|
235
|
+
long: { timeoutMs: 300000 },
|
|
236
|
+
/** 30 minute timeout */
|
|
237
|
+
veryLong: { timeoutMs: 1800000 },
|
|
238
|
+
/** No timeout (24 hours) */
|
|
239
|
+
none: { timeoutMs: 86400000 },
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=TimeoutManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeoutManager.js","sourceRoot":"","sources":["../../src/automation/TimeoutManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAGnB;IACA;IAHlB,YACE,OAAe,EACC,SAAiB,EACjB,SAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAAS;QAGlC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAoCD;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,SAA2B,EAC3B,MAAqB;QAErB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,cAAc,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YACtD,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,IA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EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;IAE3B,wBAAwB;IACxB,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;IAEhC,4BAA4B;IAC5B,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;CACrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automation Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides retry policies, backoff strategies, failure handling,
|
|
5
|
+
* and timeout management for reliable workflow execution.
|
|
6
|
+
*
|
|
7
|
+
* This is PHASE 2 of the Orbyt execution roadmap.
|
|
8
|
+
*
|
|
9
|
+
* @module automation
|
|
10
|
+
*/
|
|
11
|
+
export * from './BackoffStrategy.js';
|
|
12
|
+
export * from './FailureStrategy.js';
|
|
13
|
+
export * from './RetryPolicy.js';
|
|
14
|
+
export * from './TimeoutManager.js';
|
|
15
|
+
export * from './runtime/index.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/automation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automation Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides retry policies, backoff strategies, failure handling,
|
|
5
|
+
* and timeout management for reliable workflow execution.
|
|
6
|
+
*
|
|
7
|
+
* This is PHASE 2 of the Orbyt execution roadmap.
|
|
8
|
+
*
|
|
9
|
+
* @module automation
|
|
10
|
+
*/
|
|
11
|
+
export * from './BackoffStrategy.js';
|
|
12
|
+
export * from './FailureStrategy.js';
|
|
13
|
+
export * from './RetryPolicy.js';
|
|
14
|
+
export * from './TimeoutManager.js';
|
|
15
|
+
export * from './runtime/index.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backoff Timer
|
|
3
|
+
*
|
|
4
|
+
* Runtime utility for implementing delays between retry attempts.
|
|
5
|
+
* Works with BackoffStrategy to execute actual wait operations.
|
|
6
|
+
*
|
|
7
|
+
* @module automation/runtime
|
|
8
|
+
*/
|
|
9
|
+
import { BackoffStrategy } from '../BackoffStrategy.js';
|
|
10
|
+
/**
|
|
11
|
+
* Backoff timer for retry delays
|
|
12
|
+
*/
|
|
13
|
+
export declare class BackoffTimer {
|
|
14
|
+
/**
|
|
15
|
+
* Wait for delay calculated by backoff strategy
|
|
16
|
+
*
|
|
17
|
+
* @param strategy - Backoff strategy
|
|
18
|
+
* @param attempt - Current attempt number (1-indexed)
|
|
19
|
+
* @returns Promise that resolves after delay
|
|
20
|
+
*/
|
|
21
|
+
static wait(strategy: BackoffStrategy, attempt: number): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Sleep for specified milliseconds
|
|
24
|
+
*
|
|
25
|
+
* @param ms - Milliseconds to sleep
|
|
26
|
+
* @returns Promise that resolves after delay
|
|
27
|
+
*/
|
|
28
|
+
static sleep(ms: number): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Wait with cancellation support
|
|
31
|
+
*
|
|
32
|
+
* @param strategy - Backoff strategy
|
|
33
|
+
* @param attempt - Current attempt number
|
|
34
|
+
* @param signal - Abort signal for cancellation
|
|
35
|
+
* @returns Promise that resolves after delay or rejects if cancelled
|
|
36
|
+
*/
|
|
37
|
+
static waitCancellable(strategy: BackoffStrategy, attempt: number, signal?: AbortSignal): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate total wait time for multiple attempts
|
|
40
|
+
*
|
|
41
|
+
* @param strategy - Backoff strategy
|
|
42
|
+
* @param attempts - Number of attempts
|
|
43
|
+
* @returns Total wait time in milliseconds
|
|
44
|
+
*/
|
|
45
|
+
static calculateTotalWaitTime(strategy: BackoffStrategy, attempts: number): number;
|
|
46
|
+
/**
|
|
47
|
+
* Format delay for logging
|
|
48
|
+
*
|
|
49
|
+
* @param delayMs - Delay in milliseconds
|
|
50
|
+
* @returns Formatted string
|
|
51
|
+
*/
|
|
52
|
+
static formatDelay(delayMs: number): string;
|
|
53
|
+
/**
|
|
54
|
+
* Wait with progress callback
|
|
55
|
+
* Useful for UI updates or logging
|
|
56
|
+
*
|
|
57
|
+
* @param strategy - Backoff strategy
|
|
58
|
+
* @param attempt - Current attempt number
|
|
59
|
+
* @param onProgress - Progress callback (current ms, total ms)
|
|
60
|
+
* @param progressIntervalMs - Interval for progress updates (default: 1000ms)
|
|
61
|
+
* @returns Promise that resolves after delay
|
|
62
|
+
*/
|
|
63
|
+
static waitWithProgress(strategy: BackoffStrategy, attempt: number, onProgress: (elapsedMs: number, totalMs: number) => void, progressIntervalMs?: number): Promise<number>;
|
|
64
|
+
/**
|
|
65
|
+
* Execute function after backoff delay
|
|
66
|
+
*
|
|
67
|
+
* @param strategy - Backoff strategy
|
|
68
|
+
* @param attempt - Current attempt number
|
|
69
|
+
* @param fn - Function to execute after delay
|
|
70
|
+
* @returns Result of function execution
|
|
71
|
+
*/
|
|
72
|
+
static waitAndExecute<T>(strategy: BackoffStrategy, attempt: number, fn: () => T | Promise<T>): Promise<T>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=BackoffTimer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackoffTimer.d.ts","sourceRoot":"","sources":["../../../src/automation/runtime/BackoffTimer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;;;OAMG;WACU,IAAI,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9E;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;;;;;;OAOG;WACU,eAAe,CAC1B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC;IAgClB;;;;;;OAMG;IACH,MAAM,CAAC,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIlF;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAU3C;;;;;;;;;OASG;WACU,gBAAgB,CAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,EACxD,kBAAkB,SAAO,GACxB,OAAO,CAAC,MAAM,CAAC;IA2BlB;;;;;;;OAOG;WACU,cAAc,CAAC,CAAC,EAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC;CAId"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backoff Timer
|
|
3
|
+
*
|
|
4
|
+
* Runtime utility for implementing delays between retry attempts.
|
|
5
|
+
* Works with BackoffStrategy to execute actual wait operations.
|
|
6
|
+
*
|
|
7
|
+
* @module automation/runtime
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Backoff timer for retry delays
|
|
11
|
+
*/
|
|
12
|
+
export class BackoffTimer {
|
|
13
|
+
/**
|
|
14
|
+
* Wait for delay calculated by backoff strategy
|
|
15
|
+
*
|
|
16
|
+
* @param strategy - Backoff strategy
|
|
17
|
+
* @param attempt - Current attempt number (1-indexed)
|
|
18
|
+
* @returns Promise that resolves after delay
|
|
19
|
+
*/
|
|
20
|
+
static async wait(strategy, attempt) {
|
|
21
|
+
const delayMs = strategy.calculateDelay(attempt);
|
|
22
|
+
if (delayMs === 0) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
await this.sleep(delayMs);
|
|
26
|
+
return delayMs;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Sleep for specified milliseconds
|
|
30
|
+
*
|
|
31
|
+
* @param ms - Milliseconds to sleep
|
|
32
|
+
* @returns Promise that resolves after delay
|
|
33
|
+
*/
|
|
34
|
+
static sleep(ms) {
|
|
35
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Wait with cancellation support
|
|
39
|
+
*
|
|
40
|
+
* @param strategy - Backoff strategy
|
|
41
|
+
* @param attempt - Current attempt number
|
|
42
|
+
* @param signal - Abort signal for cancellation
|
|
43
|
+
* @returns Promise that resolves after delay or rejects if cancelled
|
|
44
|
+
*/
|
|
45
|
+
static async waitCancellable(strategy, attempt, signal) {
|
|
46
|
+
const delayMs = strategy.calculateDelay(attempt);
|
|
47
|
+
if (delayMs === 0) {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
// Check if already aborted
|
|
51
|
+
if (signal?.aborted) {
|
|
52
|
+
throw new Error('Backoff cancelled');
|
|
53
|
+
}
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const timeout = setTimeout(() => {
|
|
56
|
+
cleanup();
|
|
57
|
+
resolve(delayMs);
|
|
58
|
+
}, delayMs);
|
|
59
|
+
const onAbort = () => {
|
|
60
|
+
cleanup();
|
|
61
|
+
reject(new Error('Backoff cancelled'));
|
|
62
|
+
};
|
|
63
|
+
const cleanup = () => {
|
|
64
|
+
clearTimeout(timeout);
|
|
65
|
+
signal?.removeEventListener('abort', onAbort);
|
|
66
|
+
};
|
|
67
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Calculate total wait time for multiple attempts
|
|
72
|
+
*
|
|
73
|
+
* @param strategy - Backoff strategy
|
|
74
|
+
* @param attempts - Number of attempts
|
|
75
|
+
* @returns Total wait time in milliseconds
|
|
76
|
+
*/
|
|
77
|
+
static calculateTotalWaitTime(strategy, attempts) {
|
|
78
|
+
return strategy.getTotalDelay(attempts);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format delay for logging
|
|
82
|
+
*
|
|
83
|
+
* @param delayMs - Delay in milliseconds
|
|
84
|
+
* @returns Formatted string
|
|
85
|
+
*/
|
|
86
|
+
static formatDelay(delayMs) {
|
|
87
|
+
if (delayMs < 1000) {
|
|
88
|
+
return `${delayMs}ms`;
|
|
89
|
+
}
|
|
90
|
+
if (delayMs < 60000) {
|
|
91
|
+
return `${(delayMs / 1000).toFixed(1)}s`;
|
|
92
|
+
}
|
|
93
|
+
return `${(delayMs / 60000).toFixed(1)}m`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Wait with progress callback
|
|
97
|
+
* Useful for UI updates or logging
|
|
98
|
+
*
|
|
99
|
+
* @param strategy - Backoff strategy
|
|
100
|
+
* @param attempt - Current attempt number
|
|
101
|
+
* @param onProgress - Progress callback (current ms, total ms)
|
|
102
|
+
* @param progressIntervalMs - Interval for progress updates (default: 1000ms)
|
|
103
|
+
* @returns Promise that resolves after delay
|
|
104
|
+
*/
|
|
105
|
+
static async waitWithProgress(strategy, attempt, onProgress, progressIntervalMs = 1000) {
|
|
106
|
+
const totalMs = strategy.calculateDelay(attempt);
|
|
107
|
+
if (totalMs === 0) {
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
const startTime = Date.now();
|
|
111
|
+
return new Promise(resolve => {
|
|
112
|
+
const progressInterval = setInterval(() => {
|
|
113
|
+
const elapsed = Date.now() - startTime;
|
|
114
|
+
onProgress(Math.min(elapsed, totalMs), totalMs);
|
|
115
|
+
if (elapsed >= totalMs) {
|
|
116
|
+
clearInterval(progressInterval);
|
|
117
|
+
}
|
|
118
|
+
}, progressIntervalMs);
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
clearInterval(progressInterval);
|
|
121
|
+
onProgress(totalMs, totalMs);
|
|
122
|
+
resolve(totalMs);
|
|
123
|
+
}, totalMs);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Execute function after backoff delay
|
|
128
|
+
*
|
|
129
|
+
* @param strategy - Backoff strategy
|
|
130
|
+
* @param attempt - Current attempt number
|
|
131
|
+
* @param fn - Function to execute after delay
|
|
132
|
+
* @returns Result of function execution
|
|
133
|
+
*/
|
|
134
|
+
static async waitAndExecute(strategy, attempt, fn) {
|
|
135
|
+
await this.wait(strategy, attempt);
|
|
136
|
+
return fn();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=BackoffTimer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackoffTimer.js","sourceRoot":"","sources":["../../../src/automation/runtime/BackoffTimer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAyB,EAAE,OAAe;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO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