@decaf-ts/for-nest 0.1.7 → 0.1.9
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/README.md +1 -1
- package/dist/for-nest.cjs +1 -1
- package/dist/for-nest.cjs.map +1 -1
- package/dist/for-nest.js +1 -1
- package/dist/for-nest.js.map +1 -1
- package/lib/decaf-model/DecafModelModule.cjs +9 -4
- package/lib/decaf-model/DecafModelModule.d.ts +3 -3
- package/lib/decaf-model/DecafModelModule.js.map +1 -1
- package/lib/decaf-model/FromModelController.cjs +355 -53
- package/lib/decaf-model/FromModelController.d.ts +6 -2
- package/lib/decaf-model/FromModelController.js.map +1 -1
- package/lib/decaf-model/decorators/ApiOperationFromModel.cjs +22 -0
- package/lib/decaf-model/decorators/ApiOperationFromModel.d.ts +9 -0
- package/lib/decaf-model/decorators/ApiOperationFromModel.js.map +1 -1
- package/lib/decaf-model/decorators/ApiParamsFromModel.d.ts +2 -2
- package/lib/decaf-model/decorators/ApiParamsFromModel.js.map +1 -1
- package/lib/decaf-model/decorators/DecafParams.cjs +9 -1
- package/lib/decaf-model/decorators/DecafParams.d.ts +2 -2
- package/lib/decaf-model/decorators/DecafParams.js.map +1 -1
- package/lib/decaf-model/decorators/index.cjs +1 -0
- package/lib/decaf-model/decorators/index.d.ts +1 -0
- package/lib/decaf-model/decorators/index.js.map +1 -1
- package/lib/decaf-model/decorators/types.d.ts +5 -5
- package/lib/decaf-model/types.cjs +15 -0
- package/lib/decaf-model/types.d.ts +18 -0
- package/lib/decaf-model/types.js.map +1 -0
- package/lib/decaf-model/utils.cjs +67 -0
- package/lib/decaf-model/utils.d.ts +7 -0
- package/lib/decaf-model/utils.js.map +1 -0
- package/lib/esm/decaf-model/DecafModelModule.d.ts +3 -3
- package/lib/esm/decaf-model/DecafModelModule.js +9 -4
- package/lib/esm/decaf-model/DecafModelModule.js.map +1 -1
- package/lib/esm/decaf-model/FromModelController.d.ts +6 -2
- package/lib/esm/decaf-model/FromModelController.js +359 -57
- package/lib/esm/decaf-model/FromModelController.js.map +1 -1
- package/lib/esm/decaf-model/decorators/ApiOperationFromModel.d.ts +9 -0
- package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js +22 -1
- package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js.map +1 -1
- package/lib/esm/decaf-model/decorators/ApiParamsFromModel.d.ts +2 -2
- package/lib/esm/decaf-model/decorators/ApiParamsFromModel.js.map +1 -1
- package/lib/esm/decaf-model/decorators/DecafParams.d.ts +2 -2
- package/lib/esm/decaf-model/decorators/DecafParams.js +9 -1
- package/lib/esm/decaf-model/decorators/DecafParams.js.map +1 -1
- package/lib/esm/decaf-model/decorators/index.d.ts +1 -0
- package/lib/esm/decaf-model/decorators/index.js +1 -0
- package/lib/esm/decaf-model/decorators/index.js.map +1 -1
- package/lib/esm/decaf-model/decorators/types.d.ts +5 -5
- package/lib/esm/decaf-model/types.d.ts +18 -0
- package/lib/esm/decaf-model/types.js +11 -0
- package/lib/esm/decaf-model/types.js.map +1 -0
- package/lib/esm/decaf-model/utils.d.ts +7 -0
- package/lib/esm/decaf-model/utils.js +61 -0
- package/lib/esm/decaf-model/utils.js.map +1 -0
- package/lib/esm/factory/NestBootstraper.js +2 -10
- package/lib/esm/factory/NestBootstraper.js.map +1 -1
- package/lib/esm/factory/context.d.ts +0 -0
- package/lib/esm/factory/context.js +2 -0
- package/lib/esm/factory/context.js.map +1 -0
- package/lib/esm/factory/exceptions/DecafErrorFilter.d.ts +4 -0
- package/lib/esm/factory/exceptions/DecafErrorFilter.js +32 -0
- package/lib/esm/factory/exceptions/DecafErrorFilter.js.map +1 -0
- package/lib/esm/factory/exceptions/decorators.d.ts +1 -0
- package/lib/esm/factory/exceptions/decorators.js +6 -0
- package/lib/esm/factory/exceptions/decorators.js.map +1 -0
- package/lib/esm/factory/exceptions/index.d.ts +2 -7
- package/lib/esm/factory/exceptions/index.js +2 -7
- package/lib/esm/factory/exceptions/index.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/interceptors/index.d.ts +1 -0
- package/lib/esm/interceptors/index.js +1 -0
- package/lib/esm/interceptors/index.js.map +1 -1
- package/lib/esm/module.js +5 -2
- package/lib/esm/module.js.map +1 -1
- package/lib/esm/types.d.ts +1 -0
- package/lib/factory/NestBootstraper.cjs +1 -9
- package/lib/factory/NestBootstraper.js.map +1 -1
- package/lib/factory/context.cjs +2 -0
- package/lib/factory/context.d.ts +0 -0
- package/lib/factory/context.js.map +1 -0
- package/lib/factory/exceptions/DecafErrorFilter.cjs +35 -0
- package/lib/factory/exceptions/DecafErrorFilter.d.ts +4 -0
- package/lib/factory/exceptions/DecafErrorFilter.js.map +1 -0
- package/lib/factory/exceptions/decorators.cjs +9 -0
- package/lib/factory/exceptions/decorators.d.ts +1 -0
- package/lib/factory/exceptions/decorators.js.map +1 -0
- package/lib/factory/exceptions/index.cjs +2 -7
- package/lib/factory/exceptions/index.d.ts +2 -7
- package/lib/factory/exceptions/index.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/interceptors/index.cjs +1 -0
- package/lib/interceptors/index.d.ts +1 -0
- package/lib/interceptors/index.js.map +1 -1
- package/lib/module.cjs +5 -2
- package/lib/module.js.map +1 -1
- package/lib/types.d.ts +1 -0
- package/package.json +3 -3
- package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.d.ts +0 -9
- package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.js +0 -35
- package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.js.map +0 -1
- package/lib/esm/factory/exceptions/ConflictExceptionFilter.d.ts +0 -9
- package/lib/esm/factory/exceptions/ConflictExceptionFilter.js +0 -35
- package/lib/esm/factory/exceptions/ConflictExceptionFilter.js.map +0 -1
- package/lib/esm/factory/exceptions/GlobalExceptionFilter.d.ts +0 -4
- package/lib/esm/factory/exceptions/GlobalExceptionFilter.js +0 -39
- package/lib/esm/factory/exceptions/GlobalExceptionFilter.js.map +0 -1
- package/lib/esm/factory/exceptions/HttpExceptionFilter.d.ts +0 -4
- package/lib/esm/factory/exceptions/HttpExceptionFilter.js +0 -27
- package/lib/esm/factory/exceptions/HttpExceptionFilter.js.map +0 -1
- package/lib/esm/factory/exceptions/HttpResponseError.d.ts +0 -13
- package/lib/esm/factory/exceptions/HttpResponseError.js +0 -21
- package/lib/esm/factory/exceptions/HttpResponseError.js.map +0 -1
- package/lib/esm/factory/exceptions/NotFoundExceptionFilter.d.ts +0 -9
- package/lib/esm/factory/exceptions/NotFoundExceptionFilter.js +0 -35
- package/lib/esm/factory/exceptions/NotFoundExceptionFilter.js.map +0 -1
- package/lib/esm/factory/exceptions/ValidationExceptionFilter.d.ts +0 -9
- package/lib/esm/factory/exceptions/ValidationExceptionFilter.js +0 -35
- package/lib/esm/factory/exceptions/ValidationExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/AuthorizationExceptionFilter.cjs +0 -39
- package/lib/factory/exceptions/AuthorizationExceptionFilter.d.ts +0 -9
- package/lib/factory/exceptions/AuthorizationExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/ConflictExceptionFilter.cjs +0 -39
- package/lib/factory/exceptions/ConflictExceptionFilter.d.ts +0 -9
- package/lib/factory/exceptions/ConflictExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/GlobalExceptionFilter.cjs +0 -42
- package/lib/factory/exceptions/GlobalExceptionFilter.d.ts +0 -4
- package/lib/factory/exceptions/GlobalExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/HttpExceptionFilter.cjs +0 -30
- package/lib/factory/exceptions/HttpExceptionFilter.d.ts +0 -4
- package/lib/factory/exceptions/HttpExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/HttpResponseError.cjs +0 -25
- package/lib/factory/exceptions/HttpResponseError.d.ts +0 -13
- package/lib/factory/exceptions/HttpResponseError.js.map +0 -1
- package/lib/factory/exceptions/NotFoundExceptionFilter.cjs +0 -39
- package/lib/factory/exceptions/NotFoundExceptionFilter.d.ts +0 -9
- package/lib/factory/exceptions/NotFoundExceptionFilter.js.map +0 -1
- package/lib/factory/exceptions/ValidationExceptionFilter.cjs +0 -39
- package/lib/factory/exceptions/ValidationExceptionFilter.d.ts +0 -9
- package/lib/factory/exceptions/ValidationExceptionFilter.js.map +0 -1
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./DecafRequestHandlerInterceptor.cjs"), exports);
|
|
18
|
+
__exportStar(require("./AuthInterceptor.cjs"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interceptors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interceptors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAiD;AACjD,wDAAkC"}
|
package/lib/module.cjs
CHANGED
|
@@ -16,12 +16,15 @@ const decaf_model_1 = require("./decaf-model/index.cjs");
|
|
|
16
16
|
*/
|
|
17
17
|
let DecafModule = DecafModule_1 = class DecafModule {
|
|
18
18
|
static async forRootAsync(options) {
|
|
19
|
-
const { autoControllers } = options;
|
|
19
|
+
const { autoControllers, autoServices, handlers } = options;
|
|
20
20
|
const adapter = await core_module_1.DecafCoreModule.createAdapter(options);
|
|
21
21
|
const flavour = adapter.flavour;
|
|
22
22
|
const imports = [core_module_1.DecafCoreModule.forRoot(options)];
|
|
23
23
|
if (autoControllers) {
|
|
24
|
-
imports.push(decaf_model_1.DecafModelModule.forRoot(flavour,
|
|
24
|
+
imports.push(decaf_model_1.DecafModelModule.forRoot(flavour, {
|
|
25
|
+
autoServices,
|
|
26
|
+
handlers,
|
|
27
|
+
}));
|
|
25
28
|
}
|
|
26
29
|
return {
|
|
27
30
|
module: DecafModule_1,
|
package/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+E;AAE/E,mDAAgD;AAChD,yDAAiD;AAEjD;;GAEG;AAEI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAA2B;QAE3B,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+E;AAE/E,mDAAgD;AAChD,yDAAiD;AAEjD;;GAEG;AAEI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAA2B;QAE3B,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE5D,MAAM,OAAO,GAAG,MAAM,6BAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAEhC,MAAM,OAAO,GAOG,CAAC,6BAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,8BAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;gBAChC,YAAY;gBACZ,QAAQ;aACT,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO;YACL,MAAM,EAAE,aAAW;YACnB,OAAO,EAAE,OAAO;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AAhCY,kCAAW;sBAAX,WAAW;IADvB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,WAAW,CAgCvB"}
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/for-nest",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "NestJS decaf integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
},
|
|
76
76
|
"homepage": "https://github.com/decaf-ts/for-nest#readme",
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@decaf-ts/for-fabric": "
|
|
78
|
+
"@decaf-ts/for-fabric": "latest",
|
|
79
|
+
"@decaf-ts/for-http": "latest",
|
|
79
80
|
"@decaf-ts/utils": "latest",
|
|
80
81
|
"@eslint/js": "^9.25.1",
|
|
81
82
|
"@nestjs/cli": "^11.0.0",
|
|
@@ -93,7 +94,6 @@
|
|
|
93
94
|
"@decaf-ts/decorator-validation": "latest",
|
|
94
95
|
"@decaf-ts/injectable-decorators": "latest",
|
|
95
96
|
"@decaf-ts/logging": "latest",
|
|
96
|
-
"@decaf-ts/reflection": "latest",
|
|
97
97
|
"@decaf-ts/transactional-decorators": "latest",
|
|
98
98
|
"@nestjs/common": "^11.0.1"
|
|
99
99
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class AuthorizationError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class AuthorizationExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: AuthorizationError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpStatus, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
export class AuthorizationError extends Error {
|
|
10
|
-
constructor(message = "Unauthorized") {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "AuthorizationError";
|
|
13
|
-
this.status = 401;
|
|
14
|
-
this.code = "UNAUTHORIZED";
|
|
15
|
-
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let AuthorizationExceptionFilter = class AuthorizationExceptionFilter {
|
|
19
|
-
catch(exception, host) {
|
|
20
|
-
const ctx = host.switchToHttp();
|
|
21
|
-
const request = ctx.getRequest();
|
|
22
|
-
const response = ctx.getResponse();
|
|
23
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
24
|
-
error: "UNAUTHORIZED",
|
|
25
|
-
status: HttpStatus.UNAUTHORIZED,
|
|
26
|
-
message: exception.message,
|
|
27
|
-
});
|
|
28
|
-
response.status(HttpStatus.UNAUTHORIZED).json(httpResponseError);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
AuthorizationExceptionFilter = __decorate([
|
|
32
|
-
Catch(AuthorizationError)
|
|
33
|
-
], AuthorizationExceptionFilter);
|
|
34
|
-
export { AuthorizationExceptionFilter };
|
|
35
|
-
//# sourceMappingURL=AuthorizationExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/AuthorizationExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAI3C,YAAY,OAAO,GAAG,cAAc;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF;AAGM,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,KAAK,CAAC,SAA6B,EAAE,IAAmB;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAE7C,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,UAAU,CAAC,YAAY;YAC/B,OAAO,EAAE,SAAS,CAAC,OAAO;SAC3B,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5E,CAAC;CACF,CAAA;AAdY,4BAA4B;IADxC,KAAK,CAAC,kBAAkB,CAAC;GACb,4BAA4B,CAcxC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class ConflictError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class ConflictExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: ConflictError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpStatus, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
export class ConflictError extends Error {
|
|
10
|
-
constructor(message = "Conflict") {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "ConflictError";
|
|
13
|
-
this.status = 409;
|
|
14
|
-
this.code = "CONFLICT";
|
|
15
|
-
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let ConflictExceptionFilter = class ConflictExceptionFilter {
|
|
19
|
-
catch(exception, host) {
|
|
20
|
-
const ctx = host.switchToHttp();
|
|
21
|
-
const response = ctx.getResponse();
|
|
22
|
-
const request = ctx.getRequest();
|
|
23
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
24
|
-
status: HttpStatus.CONFLICT,
|
|
25
|
-
message: exception.message,
|
|
26
|
-
error: "CONFLICT",
|
|
27
|
-
});
|
|
28
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
ConflictExceptionFilter = __decorate([
|
|
32
|
-
Catch(ConflictError)
|
|
33
|
-
], ConflictExceptionFilter);
|
|
34
|
-
export { ConflictExceptionFilter };
|
|
35
|
-
//# sourceMappingURL=ConflictExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConflictExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/ConflictExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,MAAM,OAAO,aAAc,SAAQ,KAAK;IAItC,YAAY,OAAO,GAAG,UAAU;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QAEvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAE1C,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,MAAM,EAAE,UAAU,CAAC,QAAQ;YAC3B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAdY,uBAAuB;IADnC,KAAK,CAAC,aAAa,CAAC;GACR,uBAAuB,CAcnC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpException, HttpStatus, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
let GlobalExceptionFilter = class GlobalExceptionFilter {
|
|
10
|
-
catch(exception, host) {
|
|
11
|
-
const ctx = host.switchToHttp();
|
|
12
|
-
const request = ctx.getRequest();
|
|
13
|
-
const response = ctx.getResponse();
|
|
14
|
-
let status = HttpStatus.INTERNAL_SERVER_ERROR;
|
|
15
|
-
let message = "Internal Server Error";
|
|
16
|
-
let error;
|
|
17
|
-
if (exception instanceof HttpException) {
|
|
18
|
-
const res = exception.getResponse();
|
|
19
|
-
status = exception.getStatus();
|
|
20
|
-
message = (res?.message || exception.message) ?? message;
|
|
21
|
-
error = res?.error ?? exception.name;
|
|
22
|
-
}
|
|
23
|
-
else if (exception instanceof Error) {
|
|
24
|
-
message = exception.message;
|
|
25
|
-
error = exception.name;
|
|
26
|
-
}
|
|
27
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
28
|
-
status,
|
|
29
|
-
message,
|
|
30
|
-
error,
|
|
31
|
-
});
|
|
32
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
GlobalExceptionFilter = __decorate([
|
|
36
|
-
Catch()
|
|
37
|
-
], GlobalExceptionFilter);
|
|
38
|
-
export { GlobalExceptionFilter };
|
|
39
|
-
//# sourceMappingURL=GlobalExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/GlobalExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,aAAa,EACb,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAGjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,KAAK,CAAC,SAAkB,EAAE,IAAmB;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAE7C,IAAI,MAAM,GAAG,UAAU,CAAC,qBAAqB,CAAC;QAC9C,IAAI,OAAO,GAAG,uBAAuB,CAAC;QACtC,IAAI,KAAyB,CAAC;QAE9B,IAAI,SAAS,YAAY,aAAa,EAAE,CAAC;YACvC,MAAM,GAAG,GAAQ,SAAS,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;YACzD,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;QACvC,CAAC;aAAM,IAAI,SAAS,YAAY,KAAK,EAAE,CAAC;YACtC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;YAC5B,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC;QACzB,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,MAAM;YACN,OAAO;YACP,KAAK;SACN,CAAC,CAAC;QACF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AA3BY,qBAAqB;IADjC,KAAK,EAAE;GACK,qBAAqB,CA2BjC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpException, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
let HttpExceptionFilter = class HttpExceptionFilter {
|
|
10
|
-
catch(exception, host) {
|
|
11
|
-
const ctx = host.switchToHttp();
|
|
12
|
-
const response = ctx.getResponse();
|
|
13
|
-
const request = ctx.getRequest();
|
|
14
|
-
const status = exception.getStatus();
|
|
15
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
16
|
-
status,
|
|
17
|
-
message: exception.message,
|
|
18
|
-
error: exception.name,
|
|
19
|
-
});
|
|
20
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
HttpExceptionFilter = __decorate([
|
|
24
|
-
Catch(HttpException)
|
|
25
|
-
], HttpExceptionFilter);
|
|
26
|
-
export { HttpExceptionFilter };
|
|
27
|
-
//# sourceMappingURL=HttpExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/HttpExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAGjD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;QAErC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,MAAM;YACN,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,SAAS,CAAC,IAAI;SACtB,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAfY,mBAAmB;IAD/B,KAAK,CAAC,aAAa,CAAC;GACR,mBAAmB,CAe/B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class HttpResponseError {
|
|
2
|
-
status: number;
|
|
3
|
-
error: string;
|
|
4
|
-
message: string;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
path: string;
|
|
7
|
-
method: string;
|
|
8
|
-
constructor(request: Request, responseError?: {
|
|
9
|
-
status?: number;
|
|
10
|
-
message?: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { HttpStatus } from "@nestjs/common";
|
|
2
|
-
export class HttpResponseError {
|
|
3
|
-
constructor(request, responseError) {
|
|
4
|
-
const status = responseError?.status ?? HttpStatus.INTERNAL_SERVER_ERROR;
|
|
5
|
-
const message = responseError?.message ?? "Internal Server Error";
|
|
6
|
-
const error = (responseError?.error ??
|
|
7
|
-
HttpStatus[status] ??
|
|
8
|
-
"HTTP_EXCEPTION")
|
|
9
|
-
.toString()
|
|
10
|
-
.toUpperCase();
|
|
11
|
-
Object.assign(this, {
|
|
12
|
-
status,
|
|
13
|
-
message,
|
|
14
|
-
error,
|
|
15
|
-
timestamp: new Date().toISOString(),
|
|
16
|
-
path: request.url,
|
|
17
|
-
method: request.method,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=HttpResponseError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpResponseError.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/HttpResponseError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,OAAO,iBAAiB;IAQ5B,YACE,OAAgB,EAChB,aAAqE;QAErE,MAAM,MAAM,GAAG,aAAa,EAAE,MAAM,IAAI,UAAU,CAAC,qBAAqB,CAAC;QACzE,MAAM,OAAO,GAAG,aAAa,EAAE,OAAO,IAAI,uBAAuB,CAAC;QAClE,MAAM,KAAK,GAAG,CACZ,aAAa,EAAE,KAAK;YACpB,UAAU,CAAC,MAAM,CAAC;YAClB,gBAAgB,CACjB;aACE,QAAQ,EAAE;aACV,WAAW,EAAE,CAAC;QAEjB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YAClB,MAAM;YACN,OAAO;YACP,KAAK;YACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,IAAI,EAAE,OAAO,CAAC,GAAG;YACjB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class NotFoundError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class NotFoundExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: NotFoundError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpStatus, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
export class NotFoundError extends Error {
|
|
10
|
-
constructor(message = "Resource not found") {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "NotFoundError";
|
|
13
|
-
this.status = 404;
|
|
14
|
-
this.code = "NOT_FOUND";
|
|
15
|
-
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let NotFoundExceptionFilter = class NotFoundExceptionFilter {
|
|
19
|
-
catch(exception, host) {
|
|
20
|
-
const ctx = host.switchToHttp();
|
|
21
|
-
const response = ctx.getResponse();
|
|
22
|
-
const request = ctx.getRequest();
|
|
23
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
24
|
-
status: HttpStatus.NOT_FOUND,
|
|
25
|
-
message: exception.message,
|
|
26
|
-
error: "NOT_FOUND",
|
|
27
|
-
});
|
|
28
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
NotFoundExceptionFilter = __decorate([
|
|
32
|
-
Catch(NotFoundError)
|
|
33
|
-
], NotFoundExceptionFilter);
|
|
34
|
-
export { NotFoundExceptionFilter };
|
|
35
|
-
//# sourceMappingURL=NotFoundExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotFoundExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/NotFoundExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,MAAM,OAAO,aAAc,SAAQ,KAAK;IAItC,YAAY,OAAO,GAAG,oBAAoB;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAE1C,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,MAAM,EAAE,UAAU,CAAC,SAAS;YAC5B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,WAAW;SACnB,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAdY,uBAAuB;IADnC,KAAK,CAAC,aAAa,CAAC;GACR,uBAAuB,CAcnC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class ValidationError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class ValidationExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: ValidationError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Catch, HttpStatus, } from "@nestjs/common";
|
|
8
|
-
import { HttpResponseError } from "./HttpResponseError.js";
|
|
9
|
-
export class ValidationError extends Error {
|
|
10
|
-
constructor(message = "Validation failed") {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "ValidationError";
|
|
13
|
-
this.status = 422;
|
|
14
|
-
this.code = "VALIDATION_ERROR";
|
|
15
|
-
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
let ValidationExceptionFilter = class ValidationExceptionFilter {
|
|
19
|
-
catch(exception, host) {
|
|
20
|
-
const ctx = host.switchToHttp();
|
|
21
|
-
const response = ctx.getResponse();
|
|
22
|
-
const request = ctx.getRequest();
|
|
23
|
-
const httpResponseError = new HttpResponseError(request, {
|
|
24
|
-
status: HttpStatus.UNPROCESSABLE_ENTITY,
|
|
25
|
-
message: exception.message,
|
|
26
|
-
error: "VALIDATION_ERROR",
|
|
27
|
-
});
|
|
28
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
ValidationExceptionFilter = __decorate([
|
|
32
|
-
Catch(ValidationError)
|
|
33
|
-
], ValidationExceptionFilter);
|
|
34
|
-
export { ValidationExceptionFilter };
|
|
35
|
-
//# sourceMappingURL=ValidationExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationExceptionFilter.js","sourceRoot":"","sources":["../../../../src/factory/exceptions/ValidationExceptionFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEL,KAAK,EAEL,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AAExD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAIxC,YAAY,OAAO,GAAG,mBAAmB;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAE/B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAGM,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,KAAK,CAAC,SAA0B,EAAE,IAAmB;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAE1C,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YACvD,MAAM,EAAE,UAAU,CAAC,oBAAoB;YACvC,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,kBAAkB;SAC1B,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAdY,yBAAyB;IADrC,KAAK,CAAC,eAAe,CAAC;GACV,yBAAyB,CAcrC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AuthorizationExceptionFilter = exports.AuthorizationError = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const HttpResponseError_1 = require("./HttpResponseError.cjs");
|
|
12
|
-
class AuthorizationError extends Error {
|
|
13
|
-
constructor(message = "Unauthorized") {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "AuthorizationError";
|
|
16
|
-
this.status = 401;
|
|
17
|
-
this.code = "UNAUTHORIZED";
|
|
18
|
-
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.AuthorizationError = AuthorizationError;
|
|
22
|
-
let AuthorizationExceptionFilter = class AuthorizationExceptionFilter {
|
|
23
|
-
catch(exception, host) {
|
|
24
|
-
const ctx = host.switchToHttp();
|
|
25
|
-
const request = ctx.getRequest();
|
|
26
|
-
const response = ctx.getResponse();
|
|
27
|
-
const httpResponseError = new HttpResponseError_1.HttpResponseError(request, {
|
|
28
|
-
error: "UNAUTHORIZED",
|
|
29
|
-
status: common_1.HttpStatus.UNAUTHORIZED,
|
|
30
|
-
message: exception.message,
|
|
31
|
-
});
|
|
32
|
-
response.status(common_1.HttpStatus.UNAUTHORIZED).json(httpResponseError);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.AuthorizationExceptionFilter = AuthorizationExceptionFilter;
|
|
36
|
-
exports.AuthorizationExceptionFilter = AuthorizationExceptionFilter = __decorate([
|
|
37
|
-
(0, common_1.Catch)(AuthorizationError)
|
|
38
|
-
], AuthorizationExceptionFilter);
|
|
39
|
-
//# sourceMappingURL=AuthorizationExceptionFilter.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class AuthorizationError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class AuthorizationExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: AuthorizationError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationExceptionFilter.js","sourceRoot":"","sources":["../../../src/factory/exceptions/AuthorizationExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AACxB,+DAAwD;AAExD,MAAa,kBAAmB,SAAQ,KAAK;IAI3C,YAAY,OAAO,GAAG,cAAc;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF;AAXD,gDAWC;AAGM,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,KAAK,CAAC,SAA6B,EAAE,IAAmB;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAE7C,MAAM,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,OAAO,EAAE;YACvD,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,mBAAU,CAAC,YAAY;YAC/B,OAAO,EAAE,SAAS,CAAC,OAAO;SAC3B,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,mBAAU,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5E,CAAC;CACF,CAAA;AAdY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,cAAK,EAAC,kBAAkB,CAAC;GACb,4BAA4B,CAcxC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ConflictExceptionFilter = exports.ConflictError = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const HttpResponseError_1 = require("./HttpResponseError.cjs");
|
|
12
|
-
class ConflictError extends Error {
|
|
13
|
-
constructor(message = "Conflict") {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "ConflictError";
|
|
16
|
-
this.status = 409;
|
|
17
|
-
this.code = "CONFLICT";
|
|
18
|
-
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.ConflictError = ConflictError;
|
|
22
|
-
let ConflictExceptionFilter = class ConflictExceptionFilter {
|
|
23
|
-
catch(exception, host) {
|
|
24
|
-
const ctx = host.switchToHttp();
|
|
25
|
-
const response = ctx.getResponse();
|
|
26
|
-
const request = ctx.getRequest();
|
|
27
|
-
const httpResponseError = new HttpResponseError_1.HttpResponseError(request, {
|
|
28
|
-
status: common_1.HttpStatus.CONFLICT,
|
|
29
|
-
message: exception.message,
|
|
30
|
-
error: "CONFLICT",
|
|
31
|
-
});
|
|
32
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.ConflictExceptionFilter = ConflictExceptionFilter;
|
|
36
|
-
exports.ConflictExceptionFilter = ConflictExceptionFilter = __decorate([
|
|
37
|
-
(0, common_1.Catch)(ConflictError)
|
|
38
|
-
], ConflictExceptionFilter);
|
|
39
|
-
//# sourceMappingURL=ConflictExceptionFilter.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
|
|
2
|
-
export declare class ConflictError extends Error {
|
|
3
|
-
readonly status: number;
|
|
4
|
-
readonly code: string;
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class ConflictExceptionFilter implements ExceptionFilter {
|
|
8
|
-
catch(exception: ConflictError, host: ArgumentsHost): void;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConflictExceptionFilter.js","sourceRoot":"","sources":["../../../src/factory/exceptions/ConflictExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AACxB,+DAAwD;AAExD,MAAa,aAAc,SAAQ,KAAK;IAItC,YAAY,OAAO,GAAG,UAAU;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QAEvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAZD,sCAYC;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAE1C,MAAM,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,OAAO,EAAE;YACvD,MAAM,EAAE,mBAAU,CAAC,QAAQ;YAC3B,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAdY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,cAAK,EAAC,aAAa,CAAC;GACR,uBAAuB,CAcnC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.GlobalExceptionFilter = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const HttpResponseError_1 = require("./HttpResponseError.cjs");
|
|
12
|
-
let GlobalExceptionFilter = class GlobalExceptionFilter {
|
|
13
|
-
catch(exception, host) {
|
|
14
|
-
const ctx = host.switchToHttp();
|
|
15
|
-
const request = ctx.getRequest();
|
|
16
|
-
const response = ctx.getResponse();
|
|
17
|
-
let status = common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
18
|
-
let message = "Internal Server Error";
|
|
19
|
-
let error;
|
|
20
|
-
if (exception instanceof common_1.HttpException) {
|
|
21
|
-
const res = exception.getResponse();
|
|
22
|
-
status = exception.getStatus();
|
|
23
|
-
message = (res?.message || exception.message) ?? message;
|
|
24
|
-
error = res?.error ?? exception.name;
|
|
25
|
-
}
|
|
26
|
-
else if (exception instanceof Error) {
|
|
27
|
-
message = exception.message;
|
|
28
|
-
error = exception.name;
|
|
29
|
-
}
|
|
30
|
-
const httpResponseError = new HttpResponseError_1.HttpResponseError(request, {
|
|
31
|
-
status,
|
|
32
|
-
message,
|
|
33
|
-
error,
|
|
34
|
-
});
|
|
35
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.GlobalExceptionFilter = GlobalExceptionFilter;
|
|
39
|
-
exports.GlobalExceptionFilter = GlobalExceptionFilter = __decorate([
|
|
40
|
-
(0, common_1.Catch)()
|
|
41
|
-
], GlobalExceptionFilter);
|
|
42
|
-
//# sourceMappingURL=GlobalExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalExceptionFilter.js","sourceRoot":"","sources":["../../../src/factory/exceptions/GlobalExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAMwB;AACxB,+DAAwD;AAGjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,KAAK,CAAC,SAAkB,EAAE,IAAmB;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAE7C,IAAI,MAAM,GAAG,mBAAU,CAAC,qBAAqB,CAAC;QAC9C,IAAI,OAAO,GAAG,uBAAuB,CAAC;QACtC,IAAI,KAAyB,CAAC;QAE9B,IAAI,SAAS,YAAY,sBAAa,EAAE,CAAC;YACvC,MAAM,GAAG,GAAQ,SAAS,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;YACzD,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;QACvC,CAAC;aAAM,IAAI,SAAS,YAAY,KAAK,EAAE,CAAC;YACtC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;YAC5B,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC;QACzB,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,OAAO,EAAE;YACvD,MAAM;YACN,OAAO;YACP,KAAK;SACN,CAAC,CAAC;QACF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AA3BY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,cAAK,GAAE;GACK,qBAAqB,CA2BjC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.HttpExceptionFilter = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const HttpResponseError_1 = require("./HttpResponseError.cjs");
|
|
12
|
-
let HttpExceptionFilter = class HttpExceptionFilter {
|
|
13
|
-
catch(exception, host) {
|
|
14
|
-
const ctx = host.switchToHttp();
|
|
15
|
-
const response = ctx.getResponse();
|
|
16
|
-
const request = ctx.getRequest();
|
|
17
|
-
const status = exception.getStatus();
|
|
18
|
-
const httpResponseError = new HttpResponseError_1.HttpResponseError(request, {
|
|
19
|
-
status,
|
|
20
|
-
message: exception.message,
|
|
21
|
-
error: exception.name,
|
|
22
|
-
});
|
|
23
|
-
response.status(httpResponseError.status).json(httpResponseError);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
27
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = __decorate([
|
|
28
|
-
(0, common_1.Catch)(common_1.HttpException)
|
|
29
|
-
], HttpExceptionFilter);
|
|
30
|
-
//# sourceMappingURL=HttpExceptionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpExceptionFilter.js","sourceRoot":"","sources":["../../../src/factory/exceptions/HttpExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AACxB,+DAAwD;AAGjD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,KAAK,CAAC,SAAwB,EAAE,IAAmB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;QAErC,MAAM,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,OAAO,EAAE;YACvD,MAAM;YACN,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,KAAK,EAAE,SAAS,CAAC,IAAI;SACtB,CAAC,CAAC;QAEF,QAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;CACF,CAAA;AAfY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,cAAK,EAAC,sBAAa,CAAC;GACR,mBAAmB,CAe/B"}
|