@jss-rule-engine/workflow
Version:
24 lines • 998 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowActionFactory = void 0;
var helper_1 = require("./lib/helper");
var WorkflowActionFactory = /** @class */ (function () {
function WorkflowActionFactory() {
this.registeredActions = new Map();
}
WorkflowActionFactory.prototype.registerAction = function (templateId, action) {
var id = (0, helper_1.cleanId)(templateId);
this.registeredActions.set(id, action);
};
WorkflowActionFactory.prototype.getAction = function (templateId) {
var id = (0, helper_1.cleanId)(templateId);
var ActionClass = this.registeredActions.get(id);
if (ActionClass) {
return new ActionClass();
}
throw new Error("No action found for templateId: ".concat(templateId));
};
return WorkflowActionFactory;
}());
exports.WorkflowActionFactory = WorkflowActionFactory;
//# sourceMappingURL=actionFactory.js.map