@hodfords/nestjs-response 10.1.3 → 10.2.0

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResponseModel = void 0;
3
+ exports.ResponseModel = ResponseModel;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const swagger_1 = require("@nestjs/swagger");
6
6
  const metadata_constant_1 = require("../constants/metadata.constant");
@@ -11,5 +11,4 @@ function ResponseModel(responseClass, isArray = false, isAllowEmpty = false) {
11
11
  isAllowEmpty
12
12
  }));
13
13
  }
14
- exports.ResponseModel = ResponseModel;
15
14
  //# sourceMappingURL=response-model.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-model.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/response-model.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAC9D,6CAA8C;AAE9C,sEAAuE;AAEvE,SAAgB,aAAa,CACzB,aAAuC,EACvC,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,KAAK;IAEpB,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,EAC7C,IAAA,oBAAW,EAAC,yCAAqB,EAAE;QAC/B,aAAa;QACb,OAAO;QACP,YAAY;KACf,CAAC,CACL,CAAC;AACN,CAAC;AAbD,sCAaC"}
1
+ {"version":3,"file":"response-model.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/response-model.decorator.ts"],"names":[],"mappings":";;AAKA,sCAaC;AAlBD,2CAA8D;AAC9D,6CAA8C;AAE9C,sEAAuE;AAEvE,SAAgB,aAAa,CACzB,aAAuC,EACvC,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,KAAK;IAEpB,OAAO,IAAA,wBAAe,EAClB,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,EAC7C,IAAA,oBAAW,EAAC,yCAAqB,EAAE;QAC/B,aAAa;QACb,OAAO;QACP,YAAY;KACf,CAAC,CACL,CAAC;AACN,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResponseModels = void 0;
3
+ exports.ResponseModels = ResponseModels;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const swagger_1 = require("@nestjs/swagger");
6
6
  const metadata_constant_1 = require("../constants/metadata.constant");
@@ -16,5 +16,4 @@ function ResponseModels(...responseClasses) {
16
16
  schema: { anyOf: (0, swagger_1.refs)(...models) }
17
17
  }), (0, common_1.SetMetadata)(metadata_constant_1.RESPONSE_METADATA_KEYS, metadatas));
18
18
  }
19
- exports.ResponseModels = ResponseModels;
20
19
  //# sourceMappingURL=response-models.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response-models.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/response-models.decorator.ts"],"names":[],"mappings":";;;AACA,2CAA8D;AAC9D,6CAAsE;AACtE,sEAAwE;AAExE,SAAgB,cAAc,CAAC,GAAG,eAAgC;IAC9D,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACvD,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,C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AAa,EAAC;QACV,MAAM,EAAE,EAAE,KAAK,EAAE,IAAA,cAAI,EAAC,GAAG,MAAM,CAAC,EAAE;KACrC,CAAC,EACF,IAAA,oBAAW,EAAC,0CAAsB,EAAE,SAAS,CAAC,CACjD,CAAC;AACN,CAAC"}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UseResponseInterceptor = void 0;
3
+ exports.UseResponseInterceptor = UseResponseInterceptor;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const response_interceptor_1 = require("../interceptors/response.interceptor");
6
6
  function UseResponseInterceptor() {
7
7
  return (0, common_1.UseInterceptors)(response_interceptor_1.ResponseInterceptor);
8
8
  }
9
- exports.UseResponseInterceptor = UseResponseInterceptor;
10
9
  //# sourceMappingURL=use-response-interceptor.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-response-interceptor.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/use-response-interceptor.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AACjD,+EAA2E;AAE3E,SAAgB,sBAAsB;IAClC,OAAO,IAAA,wBAAe,EAAC,0CAAmB,CAAC,CAAC;AAChD,CAAC;AAFD,wDAEC"}
1
+ {"version":3,"file":"use-response-interceptor.decorator.js","sourceRoot":"","sources":["../../../libs/decorators/use-response-interceptor.decorator.ts"],"names":[],"mappings":";;AAGA,wDAEC;AALD,2CAAiD;AACjD,+EAA2E;AAE3E,SAAgB,sBAAsB;IAClC,OAAO,IAAA,wBAAe,EAAC,0CAAmB,CAAC,CAAC;AAChD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hodfords/nestjs-response",
3
- "version": "10.1.3",
4
- "description": "",
3
+ "version": "10.2.0",
4
+ "description": "Standardizes and validates API responses in NestJS for consistent and reliable communication",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
7
7
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "prebuild": "rimraf dist",
13
13
  "build": "nest build",
14
- "postbuild": "cp package.json dist/libs/package.json",
14
+ "postbuild": "cp package.json dist/libs",
15
15
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"libs/**/*.ts\"",
16
16
  "start": "nest start",
17
17
  "start:dev": "npm run prebuild && nest start --watch",
@@ -24,7 +24,7 @@
24
24
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
25
25
  "test:e2e": "jest --config ./test/jest-e2e.json",
26
26
  "wz-command": "wz-command",
27
- "prepare": "is-ci || husky install",
27
+ "prepare": "is-ci || husky",
28
28
  "version": "auto-changelog && git add CHANGELOG.md",
29
29
  "release:patch": "git add CHANGELOG.md && npm version patch --tag-version-prefix='' -f -m 'chore: release to %s'",
30
30
  "release:push": "git push --no-verify && git push --tags --no-verify",
@@ -32,41 +32,41 @@
32
32
  "cspell": "cspell"
33
33
  },
34
34
  "devDependencies": {
35
- "@nestjs/cli": "10.3.0",
36
- "@nestjs/common": "10.3.1",
37
- "@nestjs/core": "10.3.1",
38
- "@nestjs/platform-express": "10.3.1",
39
- "@nestjs/schematics": "10.1.0",
40
- "@nestjs/swagger": "7.2.0",
41
- "@nestjs/testing": "10.3.1",
35
+ "@nestjs/cli": "10.4.4",
36
+ "@nestjs/common": "10.4.1",
37
+ "@nestjs/core": "10.4.1",
38
+ "@nestjs/platform-express": "10.4.1",
39
+ "@nestjs/schematics": "10.1.4",
40
+ "@nestjs/swagger": "7.4.0",
41
+ "@nestjs/testing": "10.4.1",
42
42
  "@types/express": "4.17.21",
43
- "@types/jest": "29.5.11",
44
- "@types/node": "20.11.10",
45
- "@types/supertest": "2.0.16",
46
- "@typescript-eslint/eslint-plugin": "6.20.0",
47
- "@typescript-eslint/parser": "6.20.0",
43
+ "@types/jest": "29.5.12",
44
+ "@types/node": "22.5.0",
45
+ "@types/supertest": "6.0.2",
46
+ "@typescript-eslint/eslint-plugin": "8.3.0",
47
+ "@typescript-eslint/parser": "8.3.0",
48
48
  "auto-changelog": "2.4.0",
49
49
  "class-transformer": "0.5.1",
50
- "class-validator": "0.14.0",
51
- "cspell": "8.3.2",
52
- "eslint": "8.56.0",
50
+ "class-validator": "0.14.1",
51
+ "cspell": "8.14.2",
52
+ "eslint": "8.57.0",
53
53
  "eslint-config-prettier": "9.1.0",
54
- "eslint-plugin-prettier": "5.1.3",
55
- "husky": "8.0.3",
54
+ "eslint-plugin-prettier": "5.2.1",
55
+ "husky": "9.1.5",
56
56
  "is-ci": "3.0.1",
57
57
  "jest": "29.7.0",
58
- "lint-staged": "15.2.0",
59
- "prettier": "3.2.4",
60
- "reflect-metadata": "0.1.13",
61
- "rimraf": "5.0.5",
58
+ "lint-staged": "15.2.9",
59
+ "prettier": "3.3.3",
60
+ "reflect-metadata": "0.2.2",
61
+ "rimraf": "6.0.1",
62
62
  "rxjs": "7.8.1",
63
63
  "source-map-support": "0.5.21",
64
- "supertest": "6.3.4",
65
- "ts-jest": "29.1.2",
64
+ "supertest": "7.0.0",
65
+ "ts-jest": "29.2.5",
66
66
  "ts-loader": "9.5.1",
67
67
  "ts-node": "10.9.2",
68
68
  "tsconfig-paths": "4.2.0",
69
- "typescript": "5.3.3"
69
+ "typescript": "5.5.4"
70
70
  },
71
71
  "jest": {
72
72
  "moduleFileExtensions": [
package/README.md DELETED
@@ -1,80 +0,0 @@
1
- <p align="center">
2
- <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
3
- </p>
4
-
5
- [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
- [circleci-url]: https://circleci.com/gh/nestjs/nest
7
-
8
- <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9
- <p align="center">
10
- <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11
- <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
- <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
- <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
- <a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15
- <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16
- <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17
- <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18
- <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19
- <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20
- <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21
- </p>
22
- <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23
- [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24
-
25
- # nestjs-response
26
- For response, use sync, not async.
27
-
28
- ## Installation 🤖
29
-
30
- ```
31
- npm install @hodfords/nestjs-response --save
32
-
33
- ```
34
-
35
- ```typescript
36
- class UserResponse {
37
- @ApiProperty()
38
- @IsNotEmpty()
39
- @IsString()
40
- name: string
41
- }
42
-
43
- class UserController{
44
- @Get()
45
- @ResponseModel(UserResponse, true)
46
- getAllUser() {
47
- return [{name: "hello"}]
48
- }
49
-
50
- @Get()
51
- @ResponseModel(UserResponse, true, true)
52
- getUser() {
53
- return undefined
54
- }
55
- }
56
-
57
- ```
58
-
59
- - `Interceptor global`
60
- ```javascript
61
- {
62
- providers: [
63
- {
64
- provide: APP_INTERCEPTOR,
65
- useClass: LoggingInterceptor
66
- }
67
- ]
68
- }
69
- ```
70
-
71
- - `Interceptor decorator`
72
-
73
- This option is not recommended. Just use for microservice, let use global interceptor
74
- ```javascript
75
- @Controller('test')
76
- @UseResponseInterceptor()
77
- export class TestController {
78
-
79
- }
80
- ```