NestJS common module
Common and utility functions used across our NestJS projects.
Stay in touch
License
This module is MIT licensed.
NestJS module with some shared utilities
Common and utility functions used across our NestJS projects.
This module is MIT licensed.
_requestUniqueId
Breaking Changes:
BugsnagIgnoreExceptionsInterceptor
BugsnagIgnoreExceptions
is now again taking care of all exceptionsTo silence exceptions within functions body use:
@BugsnagIgnoreExceptions([NotFoundException])
To silence exceptions within authorization guard use:
@Auth(AuthorizationType.seller, {silent: true})
To silence UnauthorizedException
outside of authorization guard use also BugsnagIgnoreExceptions
:
@Auth(AuthorizationType.seller, {silent: true})
@BugsnagIgnoreExceptions([UnauthorizedException])
public getUserCreditsAsSeller (@Headers(TOKEN_USER_ID_HEADER) userId?: string): Promise<Credit> {
if (!userId) {
throw new UnauthorizedException('Unauthorized');
}
In this case Auth
decorator takes exceptions silent within authorization guard and BugsnagIgnoreExceptions
within the function's body.
Breaking Changes:
interceptAxiosRequestWithRequestId()
method and replaced by RequestUniqueIdInterceptor
Usage:
HttpModule.register
, you need to provide this interceptor again due to this axios issueAdditional changes:
COMMON_HEADERS
, USER_AGENT
, etc... repeated in most of the serviceonApplicationInit()
method to remove the same app boilerplate, should be called in main.ts
BasicAppService
and BaseAppService
which is can be extended in case you need to extend closeDatabaseConnection()
uuidv4()
to ${Environments.getApplicationName()}_${Environments.getVersion()}_${uuidv4()}
Added validation pipes:
AuthorizationGuard
to return UnauthorizedException
of()
method