@nestjs/cqrs 10.0.1 → 10.0.3

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.
@@ -46,5 +46,4 @@ export declare class EventBus<EventBase extends IEvent = IEvent> extends Observa
46
46
  private reflectEvents;
47
47
  private useDefaultPublisher;
48
48
  private mapToUnhandledErrorInfo;
49
- private isUnhandledErrorInfo;
50
49
  }
package/dist/event-bus.js CHANGED
@@ -71,16 +71,13 @@ let EventBus = EventBus_1 = class EventBus extends utils_1.ObservableBus {
71
71
  bind(handler, id) {
72
72
  const stream$ = id ? this.ofEventId(id) : this.subject$;
73
73
  const subscription = stream$
74
- .pipe((0, operators_1.mergeMap)((event) => (0, rxjs_1.defer)(() => Promise.resolve(handler.handle(event))).pipe((0, operators_1.catchError)((error) => (0, rxjs_1.throwError)(() => this.mapToUnhandledErrorInfo(event, error))))))
75
- .subscribe({
76
- error: (error) => {
77
- if (this.isUnhandledErrorInfo(error)) {
78
- this.unhandledExceptionBus.publish(error);
79
- error = error.exception;
80
- }
81
- this._logger.error(`"${handler.constructor.name}" has thrown an unhandled exception.`, error);
82
- },
83
- });
74
+ .pipe((0, operators_1.mergeMap)((event) => (0, rxjs_1.defer)(() => Promise.resolve(handler.handle(event))).pipe((0, operators_1.catchError)((error) => {
75
+ const unhandledError = this.mapToUnhandledErrorInfo(event, error);
76
+ this.unhandledExceptionBus.publish(unhandledError);
77
+ this._logger.error(`"${handler.constructor.name}" has thrown an unhandled exception.`, error);
78
+ return (0, rxjs_1.of)();
79
+ }))))
80
+ .subscribe();
84
81
  this.subscriptions.push(subscription);
85
82
  }
86
83
  registerSagas(types = []) {
@@ -119,16 +116,13 @@ let EventBus = EventBus_1 = class EventBus extends utils_1.ObservableBus {
119
116
  throw new exceptions_1.InvalidSagaException();
120
117
  }
121
118
  const subscription = stream$
122
- .pipe((0, operators_1.filter)((e) => !!e), (0, operators_1.mergeMap)((command) => (0, rxjs_1.defer)(() => this.commandBus.execute(command)).pipe((0, operators_1.catchError)((error) => (0, rxjs_1.throwError)(() => this.mapToUnhandledErrorInfo(command, error))))))
123
- .subscribe({
124
- error: (error) => {
125
- if (this.isUnhandledErrorInfo(error)) {
126
- this.unhandledExceptionBus.publish(error);
127
- error = error.exception;
128
- }
129
- this._logger.error(`Command handler which execution was triggered by Saga has thrown an unhandled exception.`, error);
130
- },
131
- });
119
+ .pipe((0, operators_1.filter)((e) => !!e), (0, operators_1.mergeMap)((command) => (0, rxjs_1.defer)(() => this.commandBus.execute(command)).pipe((0, operators_1.catchError)((error) => {
120
+ const unhandledError = this.mapToUnhandledErrorInfo(command, error);
121
+ this.unhandledExceptionBus.publish(unhandledError);
122
+ this._logger.error(`Command handler which execution was triggered by Saga has thrown an unhandled exception.`, error);
123
+ return (0, rxjs_1.of)();
124
+ }))))
125
+ .subscribe();
132
126
  this.subscriptions.push(subscription);
133
127
  }
134
128
  reflectEvents(handler) {
@@ -143,12 +137,6 @@ let EventBus = EventBus_1 = class EventBus extends utils_1.ObservableBus {
143
137
  exception,
144
138
  };
145
139
  }
146
- isUnhandledErrorInfo(error) {
147
- return (typeof error === 'object' &&
148
- error !== null &&
149
- 'cause' in error &&
150
- 'exception' in error);
151
- }
152
140
  };
153
141
  EventBus = EventBus_1 = __decorate([
154
142
  (0, common_1.Injectable)(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cqrs",
3
- "version": "10.0.1",
3
+ "version": "10.0.3",
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",
@@ -21,26 +21,26 @@
21
21
  "uuid": "9.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@commitlint/cli": "17.6.5",
25
- "@commitlint/config-angular": "17.6.5",
26
- "@nestjs/common": "10.0.3",
27
- "@nestjs/core": "10.0.3",
28
- "@types/node": "18.16.18",
29
- "@types/jest": "29.5.2",
30
- "@typescript-eslint/eslint-plugin": "5.60.0",
31
- "@typescript-eslint/parser": "5.60.0",
32
- "eslint": "8.43.0",
24
+ "@commitlint/cli": "17.6.7",
25
+ "@commitlint/config-angular": "17.6.7",
26
+ "@nestjs/common": "10.1.1",
27
+ "@nestjs/core": "10.1.1",
28
+ "@types/node": "18.17.0",
29
+ "@types/jest": "29.5.3",
30
+ "@typescript-eslint/eslint-plugin": "6.2.0",
31
+ "@typescript-eslint/parser": "6.2.0",
32
+ "eslint": "8.45.0",
33
33
  "eslint-config-prettier": "8.8.0",
34
34
  "eslint-plugin-import": "2.27.5",
35
35
  "husky": "8.0.3",
36
- "jest": "29.5.0",
37
- "lint-staged": "13.2.2",
38
- "prettier": "2.8.8",
36
+ "jest": "29.6.1",
37
+ "lint-staged": "13.2.3",
38
+ "prettier": "3.0.0",
39
39
  "reflect-metadata": "0.1.13",
40
- "release-it": "15.11.0",
40
+ "release-it": "16.1.3",
41
41
  "rxjs": "7.8.1",
42
- "ts-jest": "29.1.0",
43
- "typescript": "5.1.3"
42
+ "ts-jest": "29.1.1",
43
+ "typescript": "5.1.6"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@nestjs/common": "^9.0.0 || ^10.0.0",