nestjs-base 1.0.3 → 1.0.6

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/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "nestjs-base",
3
- "version": "1.0.3",
4
- "description": "Nest Toolkit",
3
+ "version": "1.0.6",
4
+ "description": "nestjs base toolkit",
5
5
  "author": "zhaojintian",
6
6
  "license": "UNLICENSED",
7
7
  "main": "dist/index.js",
8
8
  "typings": "dist/index.d.ts",
9
- "files": ["dist"],
9
+ "files": [
10
+ "dist"
11
+ ],
10
12
  "scripts": {
11
13
  "build": "nest build",
12
14
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
@@ -1,4 +0,0 @@
1
- import { ArgumentsHost, ExceptionFilter, HttpException } from "@nestjs/common";
2
- export declare class HttpExceptionsFilter implements ExceptionFilter {
3
- catch(exception: HttpException, host: ArgumentsHost): void;
4
- }
@@ -1,33 +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.HttpExceptionsFilter = void 0;
10
- const common_1 = require("@nestjs/common");
11
- let HttpExceptionsFilter = class HttpExceptionsFilter {
12
- catch(exception, host) {
13
- const ctx = host.switchToHttp();
14
- const response = ctx.getResponse();
15
- const request = ctx.getRequest();
16
- let status = common_1.HttpStatus.INTERNAL_SERVER_ERROR;
17
- let message = "Internal server error";
18
- if (exception instanceof common_1.HttpException) {
19
- status = exception.getStatus();
20
- message = exception.message;
21
- }
22
- response.status(status).json({
23
- error: { message },
24
- timestamp: new Date().toISOString(),
25
- path: request.url,
26
- });
27
- }
28
- };
29
- exports.HttpExceptionsFilter = HttpExceptionsFilter;
30
- exports.HttpExceptionsFilter = HttpExceptionsFilter = __decorate([
31
- (0, common_1.Catch)()
32
- ], HttpExceptionsFilter);
33
- //# sourceMappingURL=http-exceptions.filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-exceptions.filter.js","sourceRoot":"","sources":["../../src/filters/http-exceptions.filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAMwB;AAIjB,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,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,IAAI,MAAM,GAAG,mBAAU,CAAC,qBAAqB,CAAC;QAC9C,IAAI,OAAO,GAAG,uBAAuB,CAAC;QAEtC,IAAI,SAAS,YAAY,sBAAa,EAAE,CAAC;YACvC,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAC9B,CAAC;QAED,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC3B,KAAK,EAAE,EAAE,OAAO,EAAE;YAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,IAAI,EAAE,OAAO,CAAC,GAAG;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,cAAK,GAAE;GACK,oBAAoB,CAoBhC"}