@furkanogutcu/nest-common 1.0.2 → 1.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.
- package/dist/exceptions/app.exception.d.ts +1 -2
- package/dist/exceptions/app.exception.js.map +1 -1
- package/dist/exceptions/bad-request.exception.d.ts +3 -4
- package/dist/exceptions/bad-request.exception.js +3 -2
- package/dist/exceptions/bad-request.exception.js.map +1 -1
- package/dist/exceptions/conflict.exception.d.ts +3 -1
- package/dist/exceptions/conflict.exception.js +3 -3
- package/dist/exceptions/conflict.exception.js.map +1 -1
- package/dist/exceptions/forbidden.exception.d.ts +1 -2
- package/dist/exceptions/forbidden.exception.js +2 -2
- package/dist/exceptions/forbidden.exception.js.map +1 -1
- package/dist/exceptions/interfaces/error-response.interface.d.ts +1 -2
- package/dist/exceptions/internal.exception.d.ts +1 -2
- package/dist/exceptions/internal.exception.js.map +1 -1
- package/dist/exceptions/not-found.exception.d.ts +2 -1
- package/dist/exceptions/not-found.exception.js +2 -2
- package/dist/exceptions/not-found.exception.js.map +1 -1
- package/dist/exceptions/reference/exception-code.reference.d.ts +2 -16
- package/dist/exceptions/reference/exception-code.reference.js +1 -15
- package/dist/exceptions/reference/exception-code.reference.js.map +1 -1
- package/dist/exceptions/too-many-request.exception.d.ts +1 -2
- package/dist/exceptions/too-many-request.exception.js.map +1 -1
- package/dist/exceptions/transformers/nestjs.exception-transformer.js +1 -1
- package/dist/exceptions/transformers/nestjs.exception-transformer.js.map +1 -1
- package/dist/exceptions/unauthorized.exception.d.ts +1 -2
- package/dist/exceptions/unauthorized.exception.js.map +1 -1
- package/dist/exceptions/unprocessable-entity.exception.d.ts +3 -4
- package/dist/exceptions/unprocessable-entity.exception.js +1 -1
- package/dist/exceptions/unprocessable-entity.exception.js.map +1 -1
- package/package.json +28 -28
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { HttpStatus } from '@nestjs/common';
|
|
2
2
|
import { IErrorResponse } from './interfaces/error-response.interface';
|
|
3
3
|
import { IValidationErrorDetails } from './interfaces/validation-error-detail.interface';
|
|
4
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
5
4
|
export declare class AppException extends Error {
|
|
6
|
-
readonly code:
|
|
5
|
+
readonly code: string;
|
|
7
6
|
readonly httpCode: HttpStatus;
|
|
8
7
|
readonly details?: IValidationErrorDetails[];
|
|
9
8
|
constructor({ message, httpCode, code, details }: IErrorResponse['error'] & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.exception.js","sourceRoot":"","sources":["../../src/exceptions/app.exception.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"app.exception.js","sourceRoot":"","sources":["../../src/exceptions/app.exception.ts"],"names":[],"mappings":";;;AAKA,MAAa,YAAa,SAAQ,KAAK;IAKrC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAsD;QAClG,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAC;IACJ,CAAC;CACF;AAtBD,oCAsBC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppBadRequestException extends AppException {
|
|
4
|
-
constructor({ message, code }
|
|
5
|
-
message
|
|
6
|
-
code
|
|
3
|
+
constructor({ message, code }?: {
|
|
4
|
+
message?: string;
|
|
5
|
+
code?: string;
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppBadRequestException = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const app_exception_1 = require("./app.exception");
|
|
6
|
+
const exception_code_reference_1 = require("./reference/exception-code.reference");
|
|
6
7
|
class AppBadRequestException extends app_exception_1.AppException {
|
|
7
|
-
constructor({ message, code }) {
|
|
8
|
+
constructor({ message = 'Bad request.', code } = {}) {
|
|
8
9
|
super({
|
|
9
10
|
message,
|
|
10
|
-
code,
|
|
11
|
+
code: code || exception_code_reference_1.ExceptionCode.BadRequest,
|
|
11
12
|
httpCode: common_1.HttpStatus.BAD_REQUEST,
|
|
12
13
|
});
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bad-request.exception.js","sourceRoot":"","sources":["../../src/exceptions/bad-request.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;
|
|
1
|
+
{"version":3,"file":"bad-request.exception.js","sourceRoot":"","sources":["../../src/exceptions/bad-request.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,sBAAuB,SAAQ,4BAAY;IACtD,YAAY,EAAE,OAAO,GAAG,cAAc,EAAE,IAAI,KAA0C,EAAE;QACtF,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,UAAU;YACtC,QAAQ,EAAE,mBAAU,CAAC,WAAW;SACjC,CAAC,CAAC;IACL,CAAC;CACF;AARD,wDAQC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
2
|
export declare class AppConflictException extends AppException {
|
|
3
3
|
readonly conflictedFields: string[];
|
|
4
|
-
constructor({ conflictedFields }: {
|
|
4
|
+
constructor({ conflictedFields, message, code, }: {
|
|
5
5
|
conflictedFields: string[];
|
|
6
|
+
message?: string;
|
|
7
|
+
code?: string;
|
|
6
8
|
});
|
|
7
9
|
private static buildDetails;
|
|
8
10
|
}
|
|
@@ -6,10 +6,10 @@ const app_exception_1 = require("./app.exception");
|
|
|
6
6
|
const exception_code_reference_1 = require("./reference/exception-code.reference");
|
|
7
7
|
const validation_error_type_reference_1 = require("./reference/validation-error-type.reference");
|
|
8
8
|
class AppConflictException extends app_exception_1.AppException {
|
|
9
|
-
constructor({ conflictedFields }) {
|
|
9
|
+
constructor({ conflictedFields, message = 'Some fields already exists.', code, }) {
|
|
10
10
|
super({
|
|
11
|
-
message
|
|
12
|
-
code: exception_code_reference_1.ExceptionCode.SomeFieldsAlreadyExists,
|
|
11
|
+
message,
|
|
12
|
+
code: code || exception_code_reference_1.ExceptionCode.SomeFieldsAlreadyExists,
|
|
13
13
|
httpCode: common_1.HttpStatus.CONFLICT,
|
|
14
14
|
details: AppConflictException.buildDetails(conflictedFields),
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict.exception.js","sourceRoot":"","sources":["../../src/exceptions/conflict.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAE/C,mFAAqE;AACrE,iGAAkF;AAElF,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,
|
|
1
|
+
{"version":3,"file":"conflict.exception.js","sourceRoot":"","sources":["../../src/exceptions/conflict.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAE/C,mFAAqE;AACrE,iGAAkF;AAElF,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,EACV,gBAAgB,EAChB,OAAO,GAAG,6BAA6B,EACvC,IAAI,GAKL;QACC,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,uBAAuB;YACnD,QAAQ,EAAE,mBAAU,CAAC,QAAQ;YAC7B,OAAO,EAAE,oBAAoB,CAAC,YAAY,CAAC,gBAAgB,CAAC;SAC7D,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,gBAA0B;QACpD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAA2B,EAAE;YAC7D,OAAO;gBACL,IAAI,EAAE,qDAAmB,CAAC,aAAa;gBACvC,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,GAAG,KAAK,iBAAiB;aACnC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/BD,oDA+BC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppForbiddenException extends AppException {
|
|
4
3
|
constructor({ message, code, }?: {
|
|
5
4
|
message?: string;
|
|
6
|
-
code?:
|
|
5
|
+
code?: string;
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -5,10 +5,10 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const app_exception_1 = require("./app.exception");
|
|
6
6
|
const exception_code_reference_1 = require("./reference/exception-code.reference");
|
|
7
7
|
class AppForbiddenException extends app_exception_1.AppException {
|
|
8
|
-
constructor({ message = 'You do not have permission to access this resource.', code
|
|
8
|
+
constructor({ message = 'You do not have permission to access this resource.', code, } = {}) {
|
|
9
9
|
super({
|
|
10
10
|
message,
|
|
11
|
-
code,
|
|
11
|
+
code: code || exception_code_reference_1.ExceptionCode.InsufficientPermissions,
|
|
12
12
|
httpCode: common_1.HttpStatus.FORBIDDEN,
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.exception.js","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,EACV,OAAO,GAAG,qDAAqD,EAC/D,IAAI,
|
|
1
|
+
{"version":3,"file":"forbidden.exception.js","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,EACV,OAAO,GAAG,qDAAqD,EAC/D,IAAI,MACmC,EAAE;QACzC,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,uBAAuB;YACnD,QAAQ,EAAE,mBAAU,CAAC,SAAS;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAXD,sDAWC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ExceptionCode } from '../reference/exception-code.reference';
|
|
2
1
|
import { IValidationErrorDetails } from './validation-error-detail.interface';
|
|
3
2
|
export interface IErrorResponse {
|
|
4
3
|
error: {
|
|
5
|
-
code:
|
|
4
|
+
code: string;
|
|
6
5
|
message: string;
|
|
7
6
|
details?: IValidationErrorDetails[];
|
|
8
7
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppInternalException extends AppException {
|
|
4
3
|
readonly originalError?: Error;
|
|
5
4
|
constructor({ message, code, error, }?: {
|
|
6
5
|
message?: string;
|
|
7
|
-
code?:
|
|
6
|
+
code?: string;
|
|
8
7
|
error?: Error;
|
|
9
8
|
});
|
|
10
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.exception.js","sourceRoot":"","sources":["../../src/exceptions/internal.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,EACV,OAAO,GAAG,+BAA+B,EACzC,IAAI,EACJ,KAAK,
|
|
1
|
+
{"version":3,"file":"internal.exception.js","sourceRoot":"","sources":["../../src/exceptions/internal.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,EACV,OAAO,GAAG,+BAA+B,EACzC,IAAI,EACJ,KAAK,MACiD,EAAE;QACxD,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,eAAe;YAC3C,QAAQ,EAAE,mBAAU,CAAC,qBAAqB;SAC3C,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;CACF;AAhBD,oDAgBC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
2
|
export declare class AppNotFoundException extends AppException {
|
|
3
3
|
readonly resourceName: string;
|
|
4
|
-
constructor({ resourceName, message }?: {
|
|
4
|
+
constructor({ resourceName, message, code, }?: {
|
|
5
5
|
resourceName?: string;
|
|
6
6
|
message?: string;
|
|
7
|
+
code?: string;
|
|
7
8
|
});
|
|
8
9
|
}
|
|
@@ -5,10 +5,10 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const app_exception_1 = require("./app.exception");
|
|
6
6
|
const exception_code_reference_1 = require("./reference/exception-code.reference");
|
|
7
7
|
class AppNotFoundException extends app_exception_1.AppException {
|
|
8
|
-
constructor({ resourceName = 'Resource', message } = {}) {
|
|
8
|
+
constructor({ resourceName = 'Resource', message, code, } = {}) {
|
|
9
9
|
super({
|
|
10
10
|
message: message || `${resourceName} not found.`,
|
|
11
|
-
code: exception_code_reference_1.ExceptionCode.ResourceNotFound,
|
|
11
|
+
code: code || exception_code_reference_1.ExceptionCode.ResourceNotFound,
|
|
12
12
|
httpCode: common_1.HttpStatus.NOT_FOUND,
|
|
13
13
|
});
|
|
14
14
|
this.resourceName = resourceName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-found.exception.js","sourceRoot":"","sources":["../../src/exceptions/not-found.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,
|
|
1
|
+
{"version":3,"file":"not-found.exception.js","sourceRoot":"","sources":["../../src/exceptions/not-found.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,oBAAqB,SAAQ,4BAAY;IAGpD,YAAY,EACV,YAAY,GAAG,UAAU,EACzB,OAAO,EACP,IAAI,MAC0D,EAAE;QAChE,KAAK,CAAC;YACJ,OAAO,EAAE,OAAO,IAAI,GAAG,YAAY,aAAa;YAChD,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,gBAAgB;YAC5C,QAAQ,EAAE,mBAAU,CAAC,SAAS;SAC/B,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAhBD,oDAgBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare enum ExceptionCode {
|
|
2
|
-
|
|
2
|
+
BadRequest = "bad_request",
|
|
3
3
|
SomeFieldsAlreadyExists = "some_fields_already_exists",
|
|
4
4
|
InsufficientPermissions = "insufficient_permissions",
|
|
5
5
|
UnexpectedError = "unexpected_error",
|
|
@@ -7,19 +7,5 @@ export declare enum ExceptionCode {
|
|
|
7
7
|
RateLimit = "rate_limit",
|
|
8
8
|
Unauthorized = "unauthorized",
|
|
9
9
|
UnprocessableEntity = "unprocessable_entity",
|
|
10
|
-
ValidationFailed = "validation_failed"
|
|
11
|
-
IncorrectCredentials = "incorrect_credentials",
|
|
12
|
-
InactiveUser = "inactive_user",
|
|
13
|
-
InvalidToken = "invalid_token",
|
|
14
|
-
TokenInvalidOrActivityResolved = "token_invalid_or_activity_resolved",
|
|
15
|
-
ResolveTokenRequired = "resolve_token_required",
|
|
16
|
-
TokenExpired = "token_expired",
|
|
17
|
-
WrongMFACode = "wrong_mfa_code",
|
|
18
|
-
MFARequired = "mfa_required",
|
|
19
|
-
MFAAlreadyCompleted = "mfa_already_completed",
|
|
20
|
-
SuspiciousSession = "suspicious_session",
|
|
21
|
-
GoogleAuthFailed = "google_auth_failed",
|
|
22
|
-
GoogleAuthInvalidTokenPayload = "google_auth_invalid_token_payload",
|
|
23
|
-
GoogleAuthRequiresVerifiedEmail = "google_auth_requires_verified_email",
|
|
24
|
-
GoogleAuthMismatch = "google_auth_mismatch"
|
|
10
|
+
ValidationFailed = "validation_failed"
|
|
25
11
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExceptionCode = void 0;
|
|
4
4
|
var ExceptionCode;
|
|
5
5
|
(function (ExceptionCode) {
|
|
6
|
-
ExceptionCode["
|
|
6
|
+
ExceptionCode["BadRequest"] = "bad_request";
|
|
7
7
|
ExceptionCode["SomeFieldsAlreadyExists"] = "some_fields_already_exists";
|
|
8
8
|
ExceptionCode["InsufficientPermissions"] = "insufficient_permissions";
|
|
9
9
|
ExceptionCode["UnexpectedError"] = "unexpected_error";
|
|
@@ -12,19 +12,5 @@ var ExceptionCode;
|
|
|
12
12
|
ExceptionCode["Unauthorized"] = "unauthorized";
|
|
13
13
|
ExceptionCode["UnprocessableEntity"] = "unprocessable_entity";
|
|
14
14
|
ExceptionCode["ValidationFailed"] = "validation_failed";
|
|
15
|
-
ExceptionCode["IncorrectCredentials"] = "incorrect_credentials";
|
|
16
|
-
ExceptionCode["InactiveUser"] = "inactive_user";
|
|
17
|
-
ExceptionCode["InvalidToken"] = "invalid_token";
|
|
18
|
-
ExceptionCode["TokenInvalidOrActivityResolved"] = "token_invalid_or_activity_resolved";
|
|
19
|
-
ExceptionCode["ResolveTokenRequired"] = "resolve_token_required";
|
|
20
|
-
ExceptionCode["TokenExpired"] = "token_expired";
|
|
21
|
-
ExceptionCode["WrongMFACode"] = "wrong_mfa_code";
|
|
22
|
-
ExceptionCode["MFARequired"] = "mfa_required";
|
|
23
|
-
ExceptionCode["MFAAlreadyCompleted"] = "mfa_already_completed";
|
|
24
|
-
ExceptionCode["SuspiciousSession"] = "suspicious_session";
|
|
25
|
-
ExceptionCode["GoogleAuthFailed"] = "google_auth_failed";
|
|
26
|
-
ExceptionCode["GoogleAuthInvalidTokenPayload"] = "google_auth_invalid_token_payload";
|
|
27
|
-
ExceptionCode["GoogleAuthRequiresVerifiedEmail"] = "google_auth_requires_verified_email";
|
|
28
|
-
ExceptionCode["GoogleAuthMismatch"] = "google_auth_mismatch";
|
|
29
15
|
})(ExceptionCode || (exports.ExceptionCode = ExceptionCode = {}));
|
|
30
16
|
//# sourceMappingURL=exception-code.reference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception-code.reference.js","sourceRoot":"","sources":["../../../src/exceptions/reference/exception-code.reference.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"exception-code.reference.js","sourceRoot":"","sources":["../../../src/exceptions/reference/exception-code.reference.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB,2CAA0B,CAAA;IAC1B,uEAAsD,CAAA;IACtD,qEAAoD,CAAA;IACpD,qDAAoC,CAAA;IACpC,wDAAuC,CAAA;IACvC,yCAAwB,CAAA;IACxB,8CAA6B,CAAA;IAC7B,6DAA4C,CAAA;IAC5C,uDAAsC,CAAA;AACxC,CAAC,EAVW,aAAa,6BAAb,aAAa,QAUxB"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppTooManyRequestException extends AppException {
|
|
4
3
|
constructor({ message, code, }?: {
|
|
5
4
|
message?: string;
|
|
6
|
-
code?:
|
|
5
|
+
code?: string;
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"too-many-request.exception.js","sourceRoot":"","sources":["../../src/exceptions/too-many-request.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,0BAA2B,SAAQ,4BAAY;IAC1D,YAAY,EACV,OAAO,GAAG,2EAA2E,EACrF,IAAI,
|
|
1
|
+
{"version":3,"file":"too-many-request.exception.js","sourceRoot":"","sources":["../../src/exceptions/too-many-request.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,0BAA2B,SAAQ,4BAAY;IAC1D,YAAY,EACV,OAAO,GAAG,2EAA2E,EACrF,IAAI,MACmC,EAAE;QACzC,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,SAAS;YACrC,QAAQ,EAAE,mBAAU,CAAC,iBAAiB;SACvC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,gEAWC"}
|
|
@@ -11,7 +11,7 @@ const unprocessable_entity_exception_1 = require("../unprocessable-entity.except
|
|
|
11
11
|
class NestJSExceptionTransformer {
|
|
12
12
|
static transform(exception) {
|
|
13
13
|
if (exception instanceof common_1.BadRequestException) {
|
|
14
|
-
return new bad_request_exception_1.AppBadRequestException({ message: exception.message, code: exception_code_reference_1.ExceptionCode.
|
|
14
|
+
return new bad_request_exception_1.AppBadRequestException({ message: exception.message, code: exception_code_reference_1.ExceptionCode.BadRequest });
|
|
15
15
|
}
|
|
16
16
|
if (exception instanceof common_1.ForbiddenException) {
|
|
17
17
|
return new forbidden_exception_1.AppForbiddenException({ message: exception.message });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs.exception-transformer.js","sourceRoot":"","sources":["../../../src/exceptions/transformers/nestjs.exception-transformer.ts"],"names":[],"mappings":";;;AAAA,2CAOwB;AAGxB,oEAAkE;AAClE,gEAA+D;AAC/D,gEAA8D;AAC9D,oFAAsE;AACtE,sEAAqE;AACrE,sFAAoF;AAEpF,MAAa,0BAA0B;IACrC,MAAM,CAAC,SAAS,CAAC,SAAwB;QACvC,IAAI,SAAS,YAAY,4BAAmB,EAAE,CAAC;YAC7C,OAAO,IAAI,8CAAsB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,wCAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"nestjs.exception-transformer.js","sourceRoot":"","sources":["../../../src/exceptions/transformers/nestjs.exception-transformer.ts"],"names":[],"mappings":";;;AAAA,2CAOwB;AAGxB,oEAAkE;AAClE,gEAA+D;AAC/D,gEAA8D;AAC9D,oFAAsE;AACtE,sEAAqE;AACrE,sFAAoF;AAEpF,MAAa,0BAA0B;IACrC,MAAM,CAAC,SAAS,CAAC,SAAwB;QACvC,IAAI,SAAS,YAAY,4BAAmB,EAAE,CAAC;YAC7C,OAAO,IAAI,8CAAsB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,wCAAa,CAAC,UAAU,EAAE,CAAC,CAAC;QACpG,CAAC;QAED,IAAI,SAAS,YAAY,2BAAkB,EAAE,CAAC;YAC5C,OAAO,IAAI,2CAAqB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,IAAI,SAAS,YAAY,0BAAiB,EAAE,CAAC;YAC3C,OAAO,IAAI,0CAAoB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,SAAS,YAAY,8BAAqB,EAAE,CAAC;YAC/C,OAAO,IAAI,iDAAwB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,SAAS,YAAY,qCAA4B,EAAE,CAAC;YACtD,OAAO,IAAI,gEAA+B,CAAC;gBACzC,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAxBD,gEAwBC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppUnauthorizedException extends AppException {
|
|
4
3
|
constructor({ message, code }?: {
|
|
5
4
|
message?: string;
|
|
6
|
-
code?:
|
|
5
|
+
code?: string;
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized.exception.js","sourceRoot":"","sources":["../../src/exceptions/unauthorized.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,wBAAyB,SAAQ,4BAAY;IACxD,YAAY,EAAE,OAAO,GAAG,gBAAgB,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"unauthorized.exception.js","sourceRoot":"","sources":["../../src/exceptions/unauthorized.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,wBAAyB,SAAQ,4BAAY;IACxD,YAAY,EAAE,OAAO,GAAG,gBAAgB,EAAE,IAAI,KAA0C,EAAE;QACxF,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,YAAY;YACxC,QAAQ,EAAE,mBAAU,CAAC,YAAY;SAClC,CAAC,CAAC;IACL,CAAC;CACF;AARD,4DAQC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AppException } from './app.exception';
|
|
2
|
-
import { ExceptionCode } from './reference/exception-code.reference';
|
|
3
2
|
export declare class AppUnprocessableEntityException extends AppException {
|
|
4
|
-
constructor({ message, code }
|
|
5
|
-
message
|
|
6
|
-
code?:
|
|
3
|
+
constructor({ message, code }?: {
|
|
4
|
+
message?: string;
|
|
5
|
+
code?: string;
|
|
7
6
|
});
|
|
8
7
|
}
|
|
@@ -5,7 +5,7 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const app_exception_1 = require("./app.exception");
|
|
6
6
|
const exception_code_reference_1 = require("./reference/exception-code.reference");
|
|
7
7
|
class AppUnprocessableEntityException extends app_exception_1.AppException {
|
|
8
|
-
constructor({ message, code }) {
|
|
8
|
+
constructor({ message = 'Unprocessable entity.', code } = {}) {
|
|
9
9
|
super({
|
|
10
10
|
message,
|
|
11
11
|
code: code || exception_code_reference_1.ExceptionCode.UnprocessableEntity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unprocessable-entity.exception.js","sourceRoot":"","sources":["../../src/exceptions/unprocessable-entity.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,+BAAgC,SAAQ,4BAAY;IAC/D,YAAY,EAAE,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"unprocessable-entity.exception.js","sourceRoot":"","sources":["../../src/exceptions/unprocessable-entity.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,mDAA+C;AAC/C,mFAAqE;AAErE,MAAa,+BAAgC,SAAQ,4BAAY;IAC/D,YAAY,EAAE,OAAO,GAAG,uBAAuB,EAAE,IAAI,KAA0C,EAAE;QAC/F,KAAK,CAAC;YACJ,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,wCAAa,CAAC,mBAAmB;YAC/C,QAAQ,EAAE,mBAAU,CAAC,oBAAoB;SAC1C,CAAC,CAAC;IACL,CAAC;CACF;AARD,0EAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furkanogutcu/nest-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Package of common structures for NestJS.",
|
|
5
5
|
"author": "Furkan Ogutcu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,45 +45,45 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/furkanogutcu/nest-common#readme",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@nestjs/common": "^11.1.
|
|
49
|
-
"@nestjs/core": "^11.1.
|
|
48
|
+
"@nestjs/common": "^11.1.5",
|
|
49
|
+
"@nestjs/core": "^11.1.5",
|
|
50
50
|
"@nestjs/typeorm": "^11.0.0",
|
|
51
|
-
"@nestjs/testing": "11.1.
|
|
52
|
-
"@nestjs/platform-express": "^11.1.
|
|
53
|
-
"zod": "^3.
|
|
54
|
-
"typeorm": "^0.3.
|
|
51
|
+
"@nestjs/testing": "11.1.5",
|
|
52
|
+
"@nestjs/platform-express": "^11.1.5",
|
|
53
|
+
"zod": "^3.25.76",
|
|
54
|
+
"typeorm": "^0.3.25",
|
|
55
55
|
"@anatine/zod-nestjs": "^2.0.12"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@nestjs/common": "^11.1.
|
|
60
|
-
"@nestjs/core": "^11.1.
|
|
59
|
+
"@nestjs/common": "^11.1.5",
|
|
60
|
+
"@nestjs/core": "^11.1.5",
|
|
61
61
|
"@nestjs/typeorm": "^11.0.0",
|
|
62
|
-
"@nestjs/testing": "11.1.
|
|
63
|
-
"@nestjs/platform-express": "^11.1.
|
|
64
|
-
"zod": "^3.
|
|
65
|
-
"typeorm": "^0.3.
|
|
66
|
-
"@types/express": "5.0.
|
|
67
|
-
"@types/jest": "
|
|
68
|
-
"@types/node": "
|
|
62
|
+
"@nestjs/testing": "11.1.5",
|
|
63
|
+
"@nestjs/platform-express": "^11.1.5",
|
|
64
|
+
"zod": "^3.25.76",
|
|
65
|
+
"typeorm": "^0.3.25",
|
|
66
|
+
"@types/express": "5.0.3",
|
|
67
|
+
"@types/jest": "30.0.0",
|
|
68
|
+
"@types/node": "24.1.0",
|
|
69
69
|
"@types/supertest": "6.0.3",
|
|
70
|
-
"jest": "
|
|
71
|
-
"prettier": "3.
|
|
72
|
-
"supertest": "7.1.
|
|
73
|
-
"ts-jest": "29.
|
|
70
|
+
"jest": "30.0.5",
|
|
71
|
+
"prettier": "3.6.2",
|
|
72
|
+
"supertest": "7.1.4",
|
|
73
|
+
"ts-jest": "29.4.0",
|
|
74
74
|
"ts-node": "10.9.2",
|
|
75
|
-
"tsc-watch": "
|
|
75
|
+
"tsc-watch": "7.1.1",
|
|
76
76
|
"tsconfig-paths": "4.2.0",
|
|
77
77
|
"typescript": "5.8.3",
|
|
78
78
|
"@eslint/eslintrc": "^3.3.1",
|
|
79
|
-
"@eslint/js": "^9.
|
|
80
|
-
"@swc/cli": "^0.7.
|
|
81
|
-
"@swc/core": "^1.
|
|
82
|
-
"eslint": "^9.
|
|
83
|
-
"eslint-config-prettier": "^10.1.
|
|
84
|
-
"eslint-plugin-prettier": "^5.
|
|
79
|
+
"@eslint/js": "^9.31.0",
|
|
80
|
+
"@swc/cli": "^0.7.8",
|
|
81
|
+
"@swc/core": "^1.13.2",
|
|
82
|
+
"eslint": "^9.31.0",
|
|
83
|
+
"eslint-config-prettier": "^10.1.8",
|
|
84
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
85
85
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
86
|
-
"typescript-eslint": "^8.
|
|
86
|
+
"typescript-eslint": "^8.38.0"
|
|
87
87
|
},
|
|
88
88
|
"jest": {
|
|
89
89
|
"moduleFileExtensions": [
|