@nestjs/cqrs
Advanced tools
Comparing version 10.0.1 to 10.0.2
@@ -49,3 +49,2 @@ import { OnModuleDestroy, Type } from '@nestjs/common'; | ||
private mapToUnhandledErrorInfo; | ||
private isUnhandledErrorInfo; | ||
} |
@@ -74,12 +74,9 @@ "use strict"; | ||
const subscription = stream$ | ||
.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)))))) | ||
.subscribe({ | ||
error: (error) => { | ||
if (this.isUnhandledErrorInfo(error)) { | ||
this.unhandledExceptionBus.publish(error); | ||
error = error.exception; | ||
} | ||
this._logger.error(`"${handler.constructor.name}" has thrown an unhandled exception.`, error); | ||
}, | ||
}); | ||
.pipe((0, operators_1.mergeMap)((event) => (0, rxjs_1.defer)(() => Promise.resolve(handler.handle(event))).pipe((0, operators_1.catchError)((error) => { | ||
const unhandledError = this.mapToUnhandledErrorInfo(event, error); | ||
this.unhandledExceptionBus.publish(unhandledError); | ||
this._logger.error(`"${handler.constructor.name}" has thrown an unhandled exception.`, error); | ||
return (0, rxjs_1.of)(); | ||
})))) | ||
.subscribe(); | ||
this.subscriptions.push(subscription); | ||
@@ -123,12 +120,9 @@ } | ||
const subscription = stream$ | ||
.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)))))) | ||
.subscribe({ | ||
error: (error) => { | ||
if (this.isUnhandledErrorInfo(error)) { | ||
this.unhandledExceptionBus.publish(error); | ||
error = error.exception; | ||
} | ||
this._logger.error(`Command handler which execution was triggered by Saga has thrown an unhandled exception.`, error); | ||
}, | ||
}); | ||
.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) => { | ||
const unhandledError = this.mapToUnhandledErrorInfo(event, error); | ||
this.unhandledExceptionBus.publish(unhandledError); | ||
this._logger.error(`Command handler which execution was triggered by Saga has thrown an unhandled exception.`, error); | ||
return (0, rxjs_1.of)(); | ||
})))) | ||
.subscribe(); | ||
this.subscriptions.push(subscription); | ||
@@ -148,8 +142,2 @@ } | ||
} | ||
isUnhandledErrorInfo(error) { | ||
return (typeof error === 'object' && | ||
error !== null && | ||
'cause' in error && | ||
'exception' in error); | ||
} | ||
}; | ||
@@ -156,0 +144,0 @@ EventBus = EventBus_1 = __decorate([ |
{ | ||
"name": "@nestjs/cqrs", | ||
"version": "10.0.1", | ||
"version": "10.0.2", | ||
"description": "A lightweight CQRS module for Nest framework (node.js)", | ||
@@ -24,22 +24,22 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@commitlint/cli": "17.6.5", | ||
"@commitlint/config-angular": "17.6.5", | ||
"@nestjs/common": "10.0.3", | ||
"@nestjs/core": "10.0.3", | ||
"@types/node": "18.16.18", | ||
"@types/jest": "29.5.2", | ||
"@typescript-eslint/eslint-plugin": "5.60.0", | ||
"@typescript-eslint/parser": "5.60.0", | ||
"eslint": "8.43.0", | ||
"@commitlint/cli": "17.6.7", | ||
"@commitlint/config-angular": "17.6.7", | ||
"@nestjs/common": "10.1.0", | ||
"@nestjs/core": "10.1.0", | ||
"@types/node": "18.17.0", | ||
"@types/jest": "29.5.3", | ||
"@typescript-eslint/eslint-plugin": "6.1.0", | ||
"@typescript-eslint/parser": "6.1.0", | ||
"eslint": "8.45.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"husky": "8.0.3", | ||
"jest": "29.5.0", | ||
"lint-staged": "13.2.2", | ||
"prettier": "2.8.8", | ||
"jest": "29.6.1", | ||
"lint-staged": "13.2.3", | ||
"prettier": "3.0.0", | ||
"reflect-metadata": "0.1.13", | ||
"release-it": "15.11.0", | ||
"release-it": "16.1.3", | ||
"rxjs": "7.8.1", | ||
"ts-jest": "29.1.0", | ||
"typescript": "5.1.3" | ||
"ts-jest": "29.1.1", | ||
"typescript": "5.1.6" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99713
1781