UNPKG

@goparrot/pubsub-event-bus

Version:
41 lines 1.39 kB
import { __decorate, __metadata } from "tslib"; import { Injectable } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { EventBus as NestEventBus, UnhandledExceptionBus } from '@nestjs/cqrs'; import { CommandBus } from './CommandBus'; import { Producer } from './Producer'; import { Publisher } from './Publisher'; let EventBus = class EventBus extends NestEventBus { 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(this.subject$, this.producer); super.publisher = pubSubPublisher; this._pubSubPublisher = pubSubPublisher; } }; EventBus = __decorate([ Injectable(), __metadata("design:paramtypes", [CommandBus, ModuleRef, UnhandledExceptionBus, Producer]) ], EventBus); export { EventBus }; //# sourceMappingURL=EventBus.js.map