@rudderstack/workflow-engine
Version:
A generic workflow execution engine
38 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultWorkflowEngine = void 0;
const errors_1 = require("../errors");
class DefaultWorkflowEngine {
constructor(name, executor, bindings, stepExecutors) {
this.bindings = bindings;
this.name = name;
this.stepExecutors = stepExecutors;
this.executor = executor;
}
getName() {
return this.name;
}
getBindings() {
return this.bindings;
}
getStepExecutors() {
return this.stepExecutors;
}
getStepExecutor(stepName) {
const stepExecutor = this.stepExecutors.find((executor) => executor.getStepName() === stepName);
if (!stepExecutor) {
throw new Error(`${stepName} was not found`);
}
return stepExecutor;
}
async execute(input, executionBindings) {
try {
return await this.executor.execute(this, input, executionBindings);
}
catch (error) {
throw errors_1.ErrorUtils.createWorkflowExecutionError(error, this.name);
}
}
}
exports.DefaultWorkflowEngine = DefaultWorkflowEngine;
//# sourceMappingURL=engine.js.map