@node-ts/bus-workflow
Version:
A workflow engine for orchestrating logic flows in distributed applications.
36 lines • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BusWorkflowModule = void 0;
const inversify_1 = require("inversify");
const bus_workflow_symbols_1 = require("./bus-workflow-symbols");
const persistence_1 = require("./workflow/persistence");
const workflow_registry_1 = require("./workflow/registry/workflow-registry");
const handles_proxy_1 = require("./workflow/registry/handles-proxy");
const started_by_proxy_1 = require("./workflow/registry/started-by-proxy");
const logger_core_1 = require("@node-ts/logger-core");
class BusWorkflowModule extends inversify_1.ContainerModule {
constructor() {
super(bind => {
bind(bus_workflow_symbols_1.BUS_WORKFLOW_SYMBOLS.Persistence).to(persistence_1.InMemoryPersistence).inSingletonScope();
logger_core_1.bindLogger(bind, persistence_1.InMemoryPersistence);
bind(bus_workflow_symbols_1.BUS_WORKFLOW_SYMBOLS.WorkflowRegistry).to(workflow_registry_1.WorkflowRegistry).inSingletonScope();
logger_core_1.bindLogger(bind, workflow_registry_1.WorkflowRegistry);
bind(bus_workflow_symbols_1.BUS_WORKFLOW_INTERNAL_SYMBOLS.StartedByProxy)
.toFactory(context => {
return (workflowDataConstructor, handler) => {
return new started_by_proxy_1.StartedByProxy(workflowDataConstructor, handler, context.container.get(bus_workflow_symbols_1.BUS_WORKFLOW_SYMBOLS.Persistence), context.container.get(logger_core_1.LOGGER_SYMBOLS.LoggerFactory)
.build(started_by_proxy_1.StartedByProxy.name, context.container));
};
});
bind(bus_workflow_symbols_1.BUS_WORKFLOW_INTERNAL_SYMBOLS.HandlesProxy)
.toFactory(context => {
return (handler, workflowDataConstructor, messageMapper) => {
return new handles_proxy_1.HandlesProxy(handler, workflowDataConstructor, messageMapper, context.container.get(bus_workflow_symbols_1.BUS_WORKFLOW_SYMBOLS.Persistence), context.container.get(logger_core_1.LOGGER_SYMBOLS.LoggerFactory)
.build(handles_proxy_1.HandlesProxy.name, context.container));
};
});
});
}
}
exports.BusWorkflowModule = BusWorkflowModule;
//# sourceMappingURL=bus-workflow-module.js.map