@builder6/server 0.11.10 → 0.11.11
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/bootstrap.js +2 -2
- package/dist/filters/all-exceptions.filter.d.ts +5 -0
- package/dist/filters/all-exceptions.filter.js +53 -0
- package/dist/filters/all-exceptions.filter.js.map +1 -0
- package/package.json +14 -14
- package/dist/filters/http-exception.filter.d.ts +0 -5
- package/dist/filters/http-exception.filter.js +0 -34
- package/dist/filters/http-exception.filter.js.map +0 -1
package/dist/bootstrap.js
CHANGED
|
@@ -11,10 +11,10 @@ const express_1 = require("express");
|
|
|
11
11
|
const platform_ws_1 = require("@nestjs/platform-ws");
|
|
12
12
|
const session = require("express-session");
|
|
13
13
|
const project = require("../package.json");
|
|
14
|
-
const
|
|
14
|
+
const all_exceptions_filter_1 = require("./filters/all-exceptions.filter");
|
|
15
15
|
async function bootstrap() {
|
|
16
16
|
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
|
17
|
-
app.useGlobalFilters(new
|
|
17
|
+
app.useGlobalFilters(new all_exceptions_filter_1.AllExceptionsFilter());
|
|
18
18
|
app.useWebSocketAdapter(new platform_ws_1.WsAdapter(app));
|
|
19
19
|
app.enableCors({
|
|
20
20
|
origin: function (origin, callback) {
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
var AllExceptionsFilter_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AllExceptionsFilter = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
let AllExceptionsFilter = AllExceptionsFilter_1 = class AllExceptionsFilter {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(AllExceptionsFilter_1.name);
|
|
15
|
+
}
|
|
16
|
+
catch(exception, host) {
|
|
17
|
+
try {
|
|
18
|
+
const ctx = host.switchToHttp();
|
|
19
|
+
const response = ctx.getResponse();
|
|
20
|
+
const request = ctx.getRequest();
|
|
21
|
+
this.logger.error({
|
|
22
|
+
method: request.method,
|
|
23
|
+
url: request.url,
|
|
24
|
+
headers: request.headers,
|
|
25
|
+
exception,
|
|
26
|
+
}, exception.stack);
|
|
27
|
+
let errorResponse;
|
|
28
|
+
const message = exception?.response?.message || exception.message;
|
|
29
|
+
const code = exception?.code;
|
|
30
|
+
if (exception instanceof common_1.HttpException) {
|
|
31
|
+
errorResponse = { status: exception.getStatus(), message };
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
errorResponse = { message, status: common_1.HttpStatus.INTERNAL_SERVER_ERROR };
|
|
35
|
+
}
|
|
36
|
+
response.status(errorResponse.status).json({
|
|
37
|
+
statusCode: errorResponse.status,
|
|
38
|
+
timestamp: new Date().toISOString(),
|
|
39
|
+
path: request.url,
|
|
40
|
+
message: errorResponse.message,
|
|
41
|
+
code: code,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.logger.error('Error while processing uncaught exception', error.stack);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.AllExceptionsFilter = AllExceptionsFilter;
|
|
50
|
+
exports.AllExceptionsFilter = AllExceptionsFilter = AllExceptionsFilter_1 = __decorate([
|
|
51
|
+
(0, common_1.Catch)()
|
|
52
|
+
], AllExceptionsFilter);
|
|
53
|
+
//# sourceMappingURL=all-exceptions.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-exceptions.filter.js","sourceRoot":"","sources":["../../src/filters/all-exceptions.filter.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAOwB;AAQjB,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAAzB;QACG,WAAM,GAAW,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAyChE,CAAC;IAxCC,KAAK,CAAC,SAAc,EAAE,IAAmB;QACvC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACnC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAEjC,IAAI,CAAC,MAAM,CAAC,KAAK,CACf;gBACE,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,SAAS;aACV,EACD,SAAS,CAAC,KAAK,CAChB,CAAC;YAEF,IAAI,aAA4B,CAAC;YACjC,MAAM,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,IAAI,SAAS,CAAC,OAAO,CAAC;YAClE,MAAM,IAAI,GAAG,SAAS,EAAE,IAAI,CAAC;YAE7B,IAAI,SAAS,YAAY,sBAAa,EAAE,CAAC;gBACvC,aAAa,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAU,CAAC,qBAAqB,EAAE,CAAC;YACxE,CAAC;YAED,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;gBACzC,UAAU,EAAE,aAAa,CAAC,MAAM;gBAChC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACnC,IAAI,EAAE,OAAO,CAAC,GAAG;gBACjB,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,2CAA2C,EAC3C,KAAK,CAAC,KAAK,CACZ,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AA1CY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,cAAK,GAAE;GACK,mBAAmB,CA0C/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder6/server",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@builder6/cli": "^0.11.
|
|
30
|
-
"@builder6/core": "^0.11.
|
|
31
|
-
"@builder6/email": "^0.11.
|
|
32
|
-
"@builder6/files": "^0.11.
|
|
33
|
-
"@builder6/moleculer": "^0.11.
|
|
34
|
-
"@builder6/pages": "^0.11.
|
|
35
|
-
"@builder6/query-mongodb": "^0.11.
|
|
36
|
-
"@builder6/rooms": "^0.11.
|
|
37
|
-
"@builder6/services": "^0.11.
|
|
38
|
-
"@builder6/sharepoint": "^0.11.
|
|
39
|
-
"@builder6/steedos": "^0.11.
|
|
40
|
-
"@builder6/tables": "^0.11.
|
|
29
|
+
"@builder6/cli": "^0.11.11",
|
|
30
|
+
"@builder6/core": "^0.11.11",
|
|
31
|
+
"@builder6/email": "^0.11.11",
|
|
32
|
+
"@builder6/files": "^0.11.11",
|
|
33
|
+
"@builder6/moleculer": "^0.11.11",
|
|
34
|
+
"@builder6/pages": "^0.11.11",
|
|
35
|
+
"@builder6/query-mongodb": "^0.11.11",
|
|
36
|
+
"@builder6/rooms": "^0.11.11",
|
|
37
|
+
"@builder6/services": "^0.11.11",
|
|
38
|
+
"@builder6/sharepoint": "^0.11.11",
|
|
39
|
+
"@builder6/steedos": "^0.11.11",
|
|
40
|
+
"@builder6/tables": "^0.11.11",
|
|
41
41
|
"@nestjs/common": "^10.0.0",
|
|
42
42
|
"@nestjs/config": "^3.3.0",
|
|
43
43
|
"@nestjs/core": "^9.0.0",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "43ade804943969b9b131ac2437ba4a3d760e9132"
|
|
125
125
|
}
|
|
@@ -1,34 +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
|
-
var HttpExceptionFilter_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.HttpExceptionFilter = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
let HttpExceptionFilter = HttpExceptionFilter_1 = class HttpExceptionFilter {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.logger = new common_1.Logger(HttpExceptionFilter_1.name);
|
|
15
|
-
}
|
|
16
|
-
catch(exception, host) {
|
|
17
|
-
const ctx = host.switchToHttp();
|
|
18
|
-
const response = ctx.getResponse();
|
|
19
|
-
const request = ctx.getRequest();
|
|
20
|
-
const status = exception.getStatus();
|
|
21
|
-
this.logger.error(`Http Status: ${status} Error: ${exception.message}`);
|
|
22
|
-
response.status(status).json({
|
|
23
|
-
statusCode: status,
|
|
24
|
-
timestamp: new Date().toISOString(),
|
|
25
|
-
path: request.url,
|
|
26
|
-
error: exception.message,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
31
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = HttpExceptionFilter_1 = __decorate([
|
|
32
|
-
(0, common_1.Catch)(common_1.HttpException)
|
|
33
|
-
], HttpExceptionFilter);
|
|
34
|
-
//# sourceMappingURL=http-exception.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["../../src/filters/http-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAMwB;AAIjB,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAAzB;QACG,WAAM,GAAW,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAgBhE,CAAC;IAfC,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,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,WAAW,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QAExE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC3B,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,IAAI,EAAE,OAAO,CAAC,GAAG;YACjB,KAAK,EAAE,SAAS,CAAC,OAAO;SACzB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,cAAK,EAAC,sBAAa,CAAC;GACR,mBAAmB,CAiB/B"}
|