@nestjs/cqrs 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/event-bus.d.ts
CHANGED
|
@@ -31,12 +31,12 @@ export declare class EventBus<EventBase extends IEvent = IEvent> extends Observa
|
|
|
31
31
|
* Publishes an event.
|
|
32
32
|
* @param event The event to publish.
|
|
33
33
|
*/
|
|
34
|
-
publish<
|
|
34
|
+
publish<TEvent extends EventBase, TContext = unknown>(event: TEvent, context: TContext): any;
|
|
35
35
|
/**
|
|
36
36
|
* Publishes multiple events.
|
|
37
37
|
* @param events The events to publish.
|
|
38
38
|
*/
|
|
39
|
-
publishAll<
|
|
39
|
+
publishAll<TEvent extends EventBase, TContext = unknown>(events: TEvent[], context: TContext): any;
|
|
40
40
|
bind(handler: IEventHandler<EventBase>, id: string): void;
|
|
41
41
|
registerSagas(types?: Type<unknown>[]): void;
|
|
42
42
|
register(handlers?: EventHandlerType<EventBase>[]): void;
|
package/dist/event-bus.js
CHANGED
|
@@ -55,18 +55,18 @@ let EventBus = EventBus_1 = class EventBus extends utils_1.ObservableBus {
|
|
|
55
55
|
* Publishes an event.
|
|
56
56
|
* @param event The event to publish.
|
|
57
57
|
*/
|
|
58
|
-
publish(event) {
|
|
59
|
-
return this._publisher.publish(event);
|
|
58
|
+
publish(event, context) {
|
|
59
|
+
return this._publisher.publish(event, context);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Publishes multiple events.
|
|
63
63
|
* @param events The events to publish.
|
|
64
64
|
*/
|
|
65
|
-
publishAll(events) {
|
|
65
|
+
publishAll(events, context) {
|
|
66
66
|
if (this._publisher.publishAll) {
|
|
67
67
|
return this._publisher.publishAll(events);
|
|
68
68
|
}
|
|
69
|
-
return (events || []).map((event) => this._publisher.publish(event));
|
|
69
|
+
return (events || []).map((event) => this._publisher.publish(event, context));
|
|
70
70
|
}
|
|
71
71
|
bind(handler, id) {
|
|
72
72
|
const stream$ = id ? this.ofEventId(id) : this.subject$;
|
package/dist/event-publisher.js
CHANGED
|
@@ -25,10 +25,10 @@ let EventPublisher = class EventPublisher {
|
|
|
25
25
|
const eventBus = this.eventBus;
|
|
26
26
|
return class extends metatype {
|
|
27
27
|
publish(event) {
|
|
28
|
-
eventBus.publish(event);
|
|
28
|
+
eventBus.publish(event, this);
|
|
29
29
|
}
|
|
30
30
|
publishAll(events) {
|
|
31
|
-
eventBus.publishAll(events);
|
|
31
|
+
eventBus.publishAll(events, this);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -40,10 +40,10 @@ let EventPublisher = class EventPublisher {
|
|
|
40
40
|
mergeObjectContext(object) {
|
|
41
41
|
const eventBus = this.eventBus;
|
|
42
42
|
object.publish = (event) => {
|
|
43
|
-
eventBus.publish(event);
|
|
43
|
+
eventBus.publish(event, object);
|
|
44
44
|
};
|
|
45
45
|
object.publishAll = (events) => {
|
|
46
|
-
eventBus.publishAll(events);
|
|
46
|
+
eventBus.publishAll(events, object);
|
|
47
47
|
};
|
|
48
48
|
return object;
|
|
49
49
|
}
|
|
@@ -6,11 +6,13 @@ export interface IEventBus<EventBase extends IEvent = IEvent> {
|
|
|
6
6
|
/**
|
|
7
7
|
* Publishes an event.
|
|
8
8
|
* @param event The event to publish.
|
|
9
|
+
* @param context The context.
|
|
9
10
|
*/
|
|
10
|
-
publish<
|
|
11
|
+
publish<TEvent extends EventBase, TContext = unknown>(event: TEvent, context?: TContext): any;
|
|
11
12
|
/**
|
|
12
13
|
* Publishes multiple events.
|
|
13
14
|
* @param events The events to publish.
|
|
15
|
+
* @param context The context.
|
|
14
16
|
*/
|
|
15
|
-
publishAll(events:
|
|
17
|
+
publishAll<TEvent extends EventBase, TContext = unknown>(events: TEvent[], context?: TContext): any;
|
|
16
18
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { IEvent } from './event.interface';
|
|
2
2
|
export interface IEventPublisher<EventBase extends IEvent = IEvent> {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Publishes an event.
|
|
5
|
+
* @param event The event to publish.
|
|
6
|
+
* @param context The context.
|
|
7
|
+
*/
|
|
8
|
+
publish<TEvent extends EventBase, TContext = unknown>(event: TEvent, context?: TContext): any;
|
|
9
|
+
/**
|
|
10
|
+
* Publishes multiple events.
|
|
11
|
+
* @param events The events to publish.
|
|
12
|
+
* @param context The context.
|
|
13
|
+
*/
|
|
14
|
+
publishAll?<TEvent extends EventBase, TContext = unknown>(events: TEvent[], context?: TContext): any;
|
|
5
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cqrs",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "A lightweight CQRS module for Nest framework (node.js)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"url": "https://github.com/nestjs/cqrs#readme",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@commitlint/config-angular": "17.6.7",
|
|
26
26
|
"@nestjs/common": "10.1.3",
|
|
27
27
|
"@nestjs/core": "10.1.3",
|
|
28
|
-
"@types/node": "18.17.
|
|
28
|
+
"@types/node": "18.17.3",
|
|
29
29
|
"@types/jest": "29.5.3",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
31
|
-
"@typescript-eslint/parser": "6.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "6.3.0",
|
|
31
|
+
"@typescript-eslint/parser": "6.3.0",
|
|
32
32
|
"eslint": "8.46.0",
|
|
33
|
-
"eslint-config-prettier": "
|
|
33
|
+
"eslint-config-prettier": "9.0.0",
|
|
34
34
|
"eslint-plugin-import": "2.28.0",
|
|
35
35
|
"husky": "8.0.3",
|
|
36
36
|
"jest": "29.6.2",
|
|
37
37
|
"lint-staged": "13.2.3",
|
|
38
|
-
"prettier": "3.0.
|
|
38
|
+
"prettier": "3.0.1",
|
|
39
39
|
"reflect-metadata": "0.1.13",
|
|
40
40
|
"release-it": "16.1.3",
|
|
41
41
|
"rxjs": "7.8.1",
|