UNPKG

@goparrot/pubsub-event-bus

Version:
44 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventBus = void 0; const tslib_1 = require("tslib"); const common_1 = require("@nestjs/common"); const core_1 = require("@nestjs/core"); const cqrs_1 = require("@nestjs/cqrs"); const CommandBus_1 = require("./CommandBus"); const Producer_1 = require("./Producer"); const Publisher_1 = require("./Publisher"); let EventBus = class EventBus extends cqrs_1.EventBus { get publisher() { return this._pubSubPublisher; } set publisher(pubSubPublisher) { super.publisher = pubSubPublisher; this._pubSubPublisher = pubSubPublisher; } constructor(commandBus, moduleRefs, unhandledExceptionBus, producer) { super(commandBus, moduleRefs, unhandledExceptionBus); this.producer = producer; this.usePubSubPublisher(); } async publish(event) { return super.publish(event); } async publishAll(events) { return super.publishAll(events); } usePubSubPublisher() { const pubSubPublisher = new Publisher_1.Publisher(this.subject$, this.producer); super.publisher = pubSubPublisher; this._pubSubPublisher = pubSubPublisher; } }; exports.EventBus = EventBus; exports.EventBus = EventBus = tslib_1.__decorate([ (0, common_1.Injectable)(), tslib_1.__metadata("design:paramtypes", [CommandBus_1.CommandBus, core_1.ModuleRef, cqrs_1.UnhandledExceptionBus, Producer_1.Producer]) ], EventBus); //# sourceMappingURL=EventBus.js.map