itlab-internal-services 1.7.0 → 1.8.1
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/exceptions/bad-body.exception.d.ts +4 -4
- package/dist/exceptions/bad-body.exception.js +6 -5
- package/dist/exceptions/duplicate.exception.d.ts +4 -4
- package/dist/exceptions/duplicate.exception.js +6 -5
- package/dist/exceptions/index.d.ts +4 -0
- package/dist/exceptions/index.js +8 -0
- package/dist/exceptions/not-found.exception.d.ts +4 -4
- package/dist/exceptions/not-found.exception.js +6 -5
- package/dist/interceptors/errors.interceptor.d.ts +2 -1
- package/dist/interceptors/errors.interceptor.js +4 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class BadBodyException extends
|
|
3
|
-
constructor(
|
|
1
|
+
import { ErrorException } from '.';
|
|
2
|
+
export declare class BadBodyException extends ErrorException {
|
|
3
|
+
constructor(description?: string);
|
|
4
4
|
}
|
|
5
|
-
export declare const ApiBadBody: (
|
|
5
|
+
export declare const ApiBadBody: (description?: string) => MethodDecorator & ClassDecorator;
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ApiBadBody = exports.BadBodyException = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const _1 = require(".");
|
|
6
7
|
const status = common_1.HttpStatus.METHOD_NOT_ALLOWED;
|
|
7
|
-
const
|
|
8
|
-
class BadBodyException extends
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
8
|
+
const error = 'Bad Body';
|
|
9
|
+
class BadBodyException extends _1.ErrorException {
|
|
10
|
+
constructor(description) {
|
|
11
|
+
super(error, status, description);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.BadBodyException = BadBodyException;
|
|
14
|
-
const ApiBadBody = (
|
|
15
|
+
const ApiBadBody = (description = error) => (0, swagger_1.ApiResponse)({ status, description });
|
|
15
16
|
exports.ApiBadBody = ApiBadBody;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class DuplicateException extends
|
|
3
|
-
constructor(
|
|
1
|
+
import { ErrorException } from '.';
|
|
2
|
+
export declare class DuplicateException extends ErrorException {
|
|
3
|
+
constructor(description?: string);
|
|
4
4
|
}
|
|
5
|
-
export declare const ApiDuplicate: (
|
|
5
|
+
export declare const ApiDuplicate: (description?: string) => MethodDecorator & ClassDecorator;
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ApiDuplicate = exports.DuplicateException = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const _1 = require(".");
|
|
6
7
|
const status = common_1.HttpStatus.CONFLICT;
|
|
7
|
-
const
|
|
8
|
-
class DuplicateException extends
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
8
|
+
const error = 'Duplicate';
|
|
9
|
+
class DuplicateException extends _1.ErrorException {
|
|
10
|
+
constructor(description) {
|
|
11
|
+
super(error, status, description);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.DuplicateException = DuplicateException;
|
|
14
|
-
const ApiDuplicate = (
|
|
15
|
+
const ApiDuplicate = (description = error) => (0, swagger_1.ApiResponse)({ status, description });
|
|
15
16
|
exports.ApiDuplicate = ApiDuplicate;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { HttpException } from '@nestjs/common';
|
|
2
|
+
export declare class ErrorException extends HttpException {
|
|
3
|
+
constructor(error: string, status: number, description?: string);
|
|
4
|
+
}
|
|
1
5
|
export * from './bad-body.exception';
|
|
2
6
|
export * from './duplicate.exception';
|
|
3
7
|
export * from './not-found.exception';
|
package/dist/exceptions/index.js
CHANGED
|
@@ -14,6 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ErrorException = void 0;
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
class ErrorException extends common_1.HttpException {
|
|
20
|
+
constructor(error, status, description) {
|
|
21
|
+
super({ message: [description || error], status, error }, status);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ErrorException = ErrorException;
|
|
17
25
|
__exportStar(require("./bad-body.exception"), exports);
|
|
18
26
|
__exportStar(require("./duplicate.exception"), exports);
|
|
19
27
|
__exportStar(require("./not-found.exception"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class NotFoundException extends
|
|
3
|
-
constructor(
|
|
1
|
+
import { ErrorException } from '.';
|
|
2
|
+
export declare class NotFoundException extends ErrorException {
|
|
3
|
+
constructor(description?: string);
|
|
4
4
|
}
|
|
5
|
-
export declare const ApiNotFound: (
|
|
5
|
+
export declare const ApiNotFound: (description?: string) => MethodDecorator & ClassDecorator;
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ApiNotFound = exports.NotFoundException = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const _1 = require(".");
|
|
6
7
|
const status = common_1.HttpStatus.NOT_FOUND;
|
|
7
|
-
const
|
|
8
|
-
class NotFoundException extends
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
8
|
+
const error = 'Not Found';
|
|
9
|
+
class NotFoundException extends _1.ErrorException {
|
|
10
|
+
constructor(description) {
|
|
11
|
+
super(error, status, description);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.NotFoundException = NotFoundException;
|
|
14
|
-
const ApiNotFound = (
|
|
15
|
+
const ApiNotFound = (description = error) => (0, swagger_1.ApiResponse)({ status, description });
|
|
15
16
|
exports.ApiNotFound = ApiNotFound;
|
|
@@ -2,8 +2,9 @@ import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
export declare class ErrorsInterceptor implements NestInterceptor {
|
|
4
4
|
private readonly dictionary;
|
|
5
|
-
constructor(dictionary
|
|
5
|
+
constructor(dictionary?: Record<string, string>);
|
|
6
6
|
protected REGEX: RegExp;
|
|
7
7
|
intercept(_context: ExecutionContext, next: CallHandler): Observable<any>;
|
|
8
8
|
protected transform(message: string, parent: string[]): string;
|
|
9
9
|
}
|
|
10
|
+
export declare const UseErrorsInterceptor: (dictionary?: Record<string, string>) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -9,11 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ErrorsInterceptor = void 0;
|
|
12
|
+
exports.UseErrorsInterceptor = exports.ErrorsInterceptor = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const rxjs_1 = require("rxjs");
|
|
15
15
|
let ErrorsInterceptor = class ErrorsInterceptor {
|
|
16
|
-
constructor(dictionary) {
|
|
16
|
+
constructor(dictionary = {}) {
|
|
17
17
|
this.dictionary = dictionary;
|
|
18
18
|
this.REGEX = /^\D+\.\d+\..+$/;
|
|
19
19
|
}
|
|
@@ -56,3 +56,5 @@ ErrorsInterceptor = __decorate([
|
|
|
56
56
|
__metadata("design:paramtypes", [Object])
|
|
57
57
|
], ErrorsInterceptor);
|
|
58
58
|
exports.ErrorsInterceptor = ErrorsInterceptor;
|
|
59
|
+
const UseErrorsInterceptor = (dictionary) => (0, common_1.applyDecorators)((0, common_1.UseInterceptors)(new ErrorsInterceptor(dictionary)));
|
|
60
|
+
exports.UseErrorsInterceptor = UseErrorsInterceptor;
|