Socket
Socket
Sign inDemoInstall

@nestjs/cqrs

Package Overview
Dependencies
3
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.1 to 5.1.0

.github/ISSUE_TEMPLATE.md

2

dist/aggregate-root.js

@@ -28,3 +28,3 @@ "use strict";

const handler = this.getEventHandler(event);
handler && handler(event);
handler && handler.call(this, event);
}

@@ -31,0 +31,0 @@ getEventHandler(event) {

@@ -18,5 +18,5 @@ "use strict";

providers: [command_bus_1.CommandBus, event_bus_1.EventBus, event_publisher_1.EventPublisher],
exports: [command_bus_1.CommandBus, event_bus_1.EventBus, event_publisher_1.EventPublisher]
exports: [command_bus_1.CommandBus, event_bus_1.EventBus, event_publisher_1.EventPublisher],
})
], CQRSModule);
exports.CQRSModule = CQRSModule;

@@ -1,3 +0,1 @@

import { IEventBus, IEvent, IEventHandler } from './interfaces/index';
import { ObservableBus } from './utils/observable-bus';
import { Type } from '@nestjs/common';

@@ -7,2 +5,5 @@ import { Observable } from 'rxjs';

import { Saga } from './index';
import { IEventPublisher } from './interfaces/events/event-publisher.interface';
import { IEvent, IEventBus, IEventHandler } from './interfaces/index';
import { ObservableBus } from './utils/observable-bus';
export declare type EventHandlerMetatype = Type<IEventHandler<IEvent>>;

@@ -12,3 +13,5 @@ export declare class EventBus extends ObservableBus<IEvent> implements IEventBus {

private moduleRef;
private _publisher;
constructor(commandBus: CommandBus);
private useDefaultPublisher();
setModuleRef(moduleRef: any): void;

@@ -27,2 +30,3 @@ publish<T extends IEvent>(event: T): void;

private reflectEventsNames(handler);
publisher: IEventPublisher;
}

@@ -12,10 +12,11 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const observable_bus_1 = require("./utils/observable-bus");
const common_1 = require("@nestjs/common");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const command_bus_1 = require("./command-bus");
const invalid_saga_exception_1 = require("./exceptions/invalid-saga.exception");
const index_1 = require("./index");
const constants_1 = require("./utils/constants");
const index_1 = require("./index");
const operators_1 = require("rxjs/operators");
const default_pubsub_1 = require("./utils/default-pubsub");
const observable_bus_1 = require("./utils/observable-bus");
let EventBus = class EventBus extends observable_bus_1.ObservableBus {

@@ -26,3 +27,9 @@ constructor(commandBus) {

this.moduleRef = null;
this.useDefaultPublisher();
}
useDefaultPublisher() {
const pubSub = new default_pubsub_1.DefaultPubSub();
pubSub.bridgeEventsTo(this.subject$);
this._publisher = pubSub;
}
setModuleRef(moduleRef) {

@@ -32,3 +39,3 @@ this.moduleRef = moduleRef;

publish(event) {
this.subject$.next(event);
this._publisher.publish(event);
}

@@ -77,2 +84,8 @@ ofType(event) {

}
get publisher() {
return this._publisher;
}
set publisher(_publisher) {
this._publisher = _publisher;
}
};

@@ -79,0 +92,0 @@ EventBus = __decorate([

{
"name": "@nestjs/cqrs",
"version": "5.0.1",
"version": "5.1.0",
"description": "A lightweight CQRS module for Nest framework (node.js)",

@@ -18,2 +18,3 @@ "license": "MIT",

"prettier": "^1.11.1",
"rxjs-compat": "^6.2.1",
"typescript": "^2.8.0"

@@ -26,2 +27,7 @@ },

},
"optionalDependencies": {
"@nestjs/common": "^5.0.0",
"reflect-metadata": "0.1.12",
"rxjs": "^6.0.0"
},
"lint-staged": {

@@ -28,0 +34,0 @@ "*.ts": [

@@ -22,3 +22,2 @@ <p align="center">

<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
<img src="https://img.shields.io/badge/👌-Production Ready-78c7ff.svg"/>
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>

@@ -25,0 +24,0 @@ </p>

@@ -33,6 +33,6 @@ import { IEvent } from './interfaces/index';

const handler = this.getEventHandler(event);
handler && handler(event);
handler && handler.call(this, event);
}
private getEventHandler(event: IEvent) {
private getEventHandler(event: IEvent): Function | undefined {
const handler = `on${this.getEventName(event)}`;

@@ -39,0 +39,0 @@ return this[handler];

@@ -1,10 +0,10 @@

import { Module } from "@nestjs/common";
import { CommandBus } from "./command-bus";
import { EventPublisher } from "./event-publisher";
import { EventBus } from "./event-bus";
import { Module } from '@nestjs/common';
import { CommandBus } from './command-bus';
import { EventPublisher } from './event-publisher';
import { EventBus } from './event-bus';
@Module({
providers: [CommandBus, EventBus, EventPublisher],
exports: [CommandBus, EventBus, EventPublisher]
exports: [CommandBus, EventBus, EventPublisher],
})
export class CQRSModule {}

@@ -1,11 +0,12 @@

import { IEventBus, IEvent, IEventHandler, ICommand } from './interfaces/index';
import { ObservableBus } from './utils/observable-bus';
import { Injectable, Type } from '@nestjs/common';
import { EventObservable } from './interfaces/event-observable.interface';
import { Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
import { CommandBus } from './command-bus';
import { InvalidSagaException } from './exceptions/invalid-saga.exception';
import { InvalidModuleRefException, Saga } from './index';
import { IEventPublisher } from './interfaces/events/event-publisher.interface';
import { IEvent, IEventBus, IEventHandler } from './interfaces/index';
import { EVENTS_HANDLER_METADATA } from './utils/constants';
import { InvalidModuleRefException, Saga } from './index';
import { filter } from 'rxjs/operators';
import { DefaultPubSub } from './utils/default-pubsub';
import { ObservableBus } from './utils/observable-bus';

@@ -17,7 +18,15 @@ export type EventHandlerMetatype = Type<IEventHandler<IEvent>>;

private moduleRef = null;
private _publisher: IEventPublisher;
constructor(private readonly commandBus: CommandBus) {
super();
this.useDefaultPublisher();
}
private useDefaultPublisher() {
const pubSub = new DefaultPubSub();
pubSub.bridgeEventsTo(this.subject$);
this._publisher = pubSub;
}
setModuleRef(moduleRef) {

@@ -28,3 +37,3 @@ this.moduleRef = moduleRef;

publish<T extends IEvent>(event: T) {
this.subject$.next(event);
this._publisher.publish(event);
}

@@ -89,2 +98,10 @@

}
get publisher(): IEventPublisher {
return this._publisher;
}
set publisher(_publisher: IEventPublisher) {
this._publisher = _publisher;
}
}

@@ -19,8 +19,5 @@ import { Subject, Observable } from 'rxjs';

return this.pipe(
filter(
event =>
!isEmpty(types.filter(type => event instanceof type)),
),
filter(event => !isEmpty(types.filter(type => event instanceof type))),
);
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc