@seidor-cloud-produtos/orbit-backend-lib 0.0.72 → 0.0.73
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/frameworks/nest/authorizations/not-allowed-nest.d.ts +3 -2
- package/dist/frameworks/nest/authorizations/not-allowed-nest.js +5 -2
- package/dist/frameworks/nest/errors/orbit-error.d.ts +2 -0
- package/dist/frameworks/nest/errors/orbit-error.js +6 -0
- package/dist/frameworks/nest/exception-filters/orbit-exception-filter.d.ts +5 -0
- package/dist/frameworks/nest/exception-filters/orbit-exception-filter.js +19 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { HttpException } from '@nestjs/common';
|
|
2
1
|
import { UnauthorizedResponse } from '../../../infra/http/errors/unauthorized-response';
|
|
3
|
-
|
|
2
|
+
import { OrbitError } from '../errors/orbit-error';
|
|
3
|
+
export declare class NestNotAllowedError extends OrbitError {
|
|
4
4
|
private input;
|
|
5
5
|
constructor(input: UnauthorizedResponse);
|
|
6
6
|
getResponse(): object;
|
|
7
|
+
getStatus(): number;
|
|
7
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.NestNotAllowedError = void 0;
|
|
4
|
-
const
|
|
5
|
-
class NestNotAllowedError extends
|
|
4
|
+
const orbit_error_1 = require('../errors/orbit-error');
|
|
5
|
+
class NestNotAllowedError extends orbit_error_1.OrbitError {
|
|
6
6
|
constructor(input) {
|
|
7
7
|
super(input.body.message, input.status);
|
|
8
8
|
this.input = input;
|
|
@@ -10,5 +10,8 @@ class NestNotAllowedError extends common_1.HttpException {
|
|
|
10
10
|
getResponse() {
|
|
11
11
|
return this.input.body;
|
|
12
12
|
}
|
|
13
|
+
getStatus() {
|
|
14
|
+
return 403;
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
exports.NestNotAllowedError = NestNotAllowedError;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.OrbitExceptionFilter = void 0;
|
|
4
|
+
const tslib_1 = require('tslib');
|
|
5
|
+
const common_1 = require('@nestjs/common');
|
|
6
|
+
const orbit_error_1 = require('../errors/orbit-error');
|
|
7
|
+
let OrbitExceptionFilter = class OrbitExceptionFilter {
|
|
8
|
+
catch(exception, host) {
|
|
9
|
+
const ctx = host.switchToHttp();
|
|
10
|
+
const response = ctx.getResponse();
|
|
11
|
+
const exceptionResponse = exception.getResponse();
|
|
12
|
+
response.status(exception.getStatus()).json(exceptionResponse);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.OrbitExceptionFilter = OrbitExceptionFilter;
|
|
16
|
+
exports.OrbitExceptionFilter = OrbitExceptionFilter = tslib_1.__decorate(
|
|
17
|
+
[(0, common_1.Catch)(orbit_error_1.OrbitError)],
|
|
18
|
+
OrbitExceptionFilter,
|
|
19
|
+
);
|