mm-share-lib 0.0.4 → 0.0.5

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.
Files changed (113) hide show
  1. package/.eslintrc.js +25 -25
  2. package/.prettierrc +3 -3
  3. package/README.md +73 -73
  4. package/dist/src/exception/bad-request-error.exception.d.ts +4 -0
  5. package/dist/src/exception/bad-request-error.exception.js +12 -0
  6. package/dist/src/exception/bad-request-error.exception.js.map +1 -0
  7. package/dist/src/exception/base.exception.d.ts +21 -0
  8. package/dist/src/exception/base.exception.js +16 -0
  9. package/dist/src/exception/base.exception.js.map +1 -0
  10. package/dist/src/exception/conflict-error.exception.d.ts +4 -0
  11. package/dist/src/exception/conflict-error.exception.js +12 -0
  12. package/dist/src/exception/conflict-error.exception.js.map +1 -0
  13. package/dist/src/exception/forbidden-error.exception.d.ts +4 -0
  14. package/dist/src/exception/forbidden-error.exception.js +12 -0
  15. package/dist/src/exception/forbidden-error.exception.js.map +1 -0
  16. package/dist/src/exception/index.d.ts +7 -0
  17. package/dist/src/exception/index.js +23 -0
  18. package/dist/src/exception/index.js.map +1 -1
  19. package/dist/src/exception/internal-server-error.exception.d.ts +4 -0
  20. package/dist/src/exception/internal-server-error.exception.js +12 -0
  21. package/dist/src/exception/internal-server-error.exception.js.map +1 -0
  22. package/dist/src/exception/not-found-error.exception.d.ts +4 -0
  23. package/dist/src/exception/not-found-error.exception.js +12 -0
  24. package/dist/src/exception/not-found-error.exception.js.map +1 -0
  25. package/dist/src/exception/unauthorized-error.exception.d.ts +4 -0
  26. package/dist/src/exception/unauthorized-error.exception.js +12 -0
  27. package/dist/src/exception/unauthorized-error.exception.js.map +1 -0
  28. package/dist/src/filter/http-exception.filter.d.ts +4 -0
  29. package/dist/src/filter/http-exception.filter.js +27 -0
  30. package/dist/src/filter/http-exception.filter.js.map +1 -0
  31. package/dist/src/filter/index.d.ts +1 -0
  32. package/dist/src/filter/index.js +18 -0
  33. package/dist/src/filter/index.js.map +1 -0
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/index.js +2 -0
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/setup/index.d.ts +1 -0
  38. package/dist/src/setup/index.js +18 -0
  39. package/dist/src/setup/index.js.map +1 -0
  40. package/dist/src/setup/microservice.setup.d.ts +2 -0
  41. package/dist/src/setup/microservice.setup.js +25 -0
  42. package/dist/src/setup/microservice.setup.js.map +1 -0
  43. package/dist/src/setup/swagger.setup.d.ts +0 -0
  44. package/dist/src/setup/swagger.setup.js +1 -0
  45. package/dist/src/setup/swagger.setup.js.map +1 -0
  46. package/dist/src/util/app.utils.d.ts +4 -0
  47. package/dist/src/util/app.utils.js +21 -0
  48. package/dist/src/util/app.utils.js.map +1 -0
  49. package/dist/src/util/index.d.ts +1 -0
  50. package/dist/src/util/index.js +1 -0
  51. package/dist/src/util/index.js.map +1 -1
  52. package/dist/tsconfig.build.tsbuildinfo +1 -1
  53. package/index.ts +1 -1
  54. package/nest-cli.json +8 -8
  55. package/package.json +82 -81
  56. package/src/constant/entity-state.constant.ts +4 -4
  57. package/src/constant/index.ts +1 -1
  58. package/src/dto/base-filter.dto.ts +4 -4
  59. package/src/dto/index.ts +2 -2
  60. package/src/dto/pagination.dto.ts +4 -4
  61. package/src/exception/bad-request-error.exception.spec.ts +24 -0
  62. package/src/exception/bad-request-error.exception.ts +8 -0
  63. package/src/exception/base.exception.ts +36 -0
  64. package/src/exception/conflict-error.exception.spec.ts +23 -0
  65. package/src/exception/conflict-error.exception.ts +8 -0
  66. package/src/exception/forbidden-error.exception.spec.ts +23 -0
  67. package/src/exception/forbidden-error.exception.ts +8 -0
  68. package/src/exception/index.ts +7 -0
  69. package/src/exception/internal-server-error.exception.spec.ts +23 -0
  70. package/src/exception/internal-server-error.exception.ts +12 -0
  71. package/src/exception/not-found-error.exception.spec.ts +23 -0
  72. package/src/exception/not-found-error.exception.ts +8 -0
  73. package/src/exception/unauthorized-error.exception.spec.ts +23 -0
  74. package/src/exception/unauthorized-error.exception.ts +12 -0
  75. package/src/filter/http-exception.filter.ts +23 -0
  76. package/src/filter/index.ts +1 -0
  77. package/src/generic/entity/entity.generic.ts +34 -34
  78. package/src/generic/entity/index.ts +1 -1
  79. package/src/generic/index.ts +2 -2
  80. package/src/generic/service/index.ts +1 -1
  81. package/src/generic/service/service.generic.ts +112 -112
  82. package/src/index.ts +2 -0
  83. package/src/lib/index.ts +1 -1
  84. package/src/lib/search-engine/document/base.document.ts +2 -2
  85. package/src/lib/search-engine/index.ts +1 -1
  86. package/src/lib/search-engine/interface/index.ts +1 -1
  87. package/src/lib/search-engine/interface/search-document.interface.ts +5 -5
  88. package/src/lib/search-engine/interface/transform-service.interface.ts +10 -10
  89. package/src/lib/search-engine/typesense/index.ts +3 -3
  90. package/src/lib/search-engine/typesense/metadata/index.ts +1 -1
  91. package/src/lib/search-engine/typesense/metadata/schema.metadata.ts +13 -13
  92. package/src/lib/search-engine/typesense/metadata/typesense.metadata-registry.ts +28 -28
  93. package/src/lib/search-engine/typesense/service/client.service.ts +258 -258
  94. package/src/lib/search-engine/typesense/typesense-module.interface.ts +36 -36
  95. package/src/lib/search-engine/typesense/typesense.constants.ts +1 -1
  96. package/src/lib/search-engine/typesense/typesense.module.test.ts +94 -94
  97. package/src/lib/search-engine/typesense/typesense.module.ts +76 -76
  98. package/src/lib/search-engine/typesense/typesense.providers.ts +42 -42
  99. package/src/response/index.ts +1 -1
  100. package/src/response/pagination.response.ts +37 -37
  101. package/src/setup/index.ts +1 -0
  102. package/src/setup/microservice.setup.ts +29 -0
  103. package/src/setup/swagger.setup.ts +0 -0
  104. package/src/util/app.utils.ts +18 -0
  105. package/src/util/date.util.spec.ts +49 -49
  106. package/src/util/date.util.ts +10 -10
  107. package/src/util/generator.util.spec.ts +79 -79
  108. package/src/util/generator.util.ts +34 -34
  109. package/src/util/index.ts +3 -2
  110. package/test/app.e2e-spec.ts +24 -24
  111. package/test/jest-e2e.json +9 -9
  112. package/tsconfig.build.json +4 -4
  113. package/tsconfig.json +21 -21
package/.eslintrc.js CHANGED
@@ -1,25 +1,25 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- tsconfigRootDir: __dirname,
6
- sourceType: 'module',
7
- },
8
- plugins: ['@typescript-eslint/eslint-plugin'],
9
- extends: [
10
- 'plugin:@typescript-eslint/recommended',
11
- 'plugin:prettier/recommended',
12
- ],
13
- root: true,
14
- env: {
15
- node: true,
16
- jest: true,
17
- },
18
- ignorePatterns: ['.eslintrc.js'],
19
- rules: {
20
- '@typescript-eslint/interface-name-prefix': 'off',
21
- '@typescript-eslint/explicit-function-return-type': 'off',
22
- '@typescript-eslint/explicit-module-boundary-types': 'off',
23
- '@typescript-eslint/no-explicit-any': 'off',
24
- },
25
- };
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ project: 'tsconfig.json',
5
+ tsconfigRootDir: __dirname,
6
+ sourceType: 'module',
7
+ },
8
+ plugins: ['@typescript-eslint/eslint-plugin'],
9
+ extends: [
10
+ 'plugin:@typescript-eslint/recommended',
11
+ 'plugin:prettier/recommended',
12
+ ],
13
+ root: true,
14
+ env: {
15
+ node: true,
16
+ jest: true,
17
+ },
18
+ ignorePatterns: ['.eslintrc.js'],
19
+ rules: {
20
+ '@typescript-eslint/interface-name-prefix': 'off',
21
+ '@typescript-eslint/explicit-function-return-type': 'off',
22
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
23
+ '@typescript-eslint/no-explicit-any': 'off',
24
+ },
25
+ };
package/.prettierrc CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all"
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
4
  }
package/README.md CHANGED
@@ -1,73 +1,73 @@
1
- <p align="center">
2
- <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" 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
- ## Description
26
-
27
- [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28
-
29
- ## Installation
30
-
31
- ```bash
32
- $ npm install
33
- ```
34
-
35
- ## Running the app
36
-
37
- ```bash
38
- # development
39
- $ npm run start
40
-
41
- # watch mode
42
- $ npm run start:dev
43
-
44
- # production mode
45
- $ npm run start:prod
46
- ```
47
-
48
- ## Test
49
-
50
- ```bash
51
- # unit tests
52
- $ npm run test
53
-
54
- # e2e tests
55
- $ npm run test:e2e
56
-
57
- # test coverage
58
- $ npm run test:cov
59
- ```
60
-
61
- ## Support
62
-
63
- Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
64
-
65
- ## Stay in touch
66
-
67
- - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68
- - Website - [https://nestjs.com](https://nestjs.com/)
69
- - Twitter - [@nestframework](https://twitter.com/nestframework)
70
-
71
- ## License
72
-
73
- Nest is [MIT licensed](LICENSE).
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" 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
+ ## Description
26
+
27
+ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ $ npm install
33
+ ```
34
+
35
+ ## Running the app
36
+
37
+ ```bash
38
+ # development
39
+ $ npm run start
40
+
41
+ # watch mode
42
+ $ npm run start:dev
43
+
44
+ # production mode
45
+ $ npm run start:prod
46
+ ```
47
+
48
+ ## Test
49
+
50
+ ```bash
51
+ # unit tests
52
+ $ npm run test
53
+
54
+ # e2e tests
55
+ $ npm run test:e2e
56
+
57
+ # test coverage
58
+ $ npm run test:cov
59
+ ```
60
+
61
+ ## Support
62
+
63
+ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
64
+
65
+ ## Stay in touch
66
+
67
+ - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68
+ - Website - [https://nestjs.com](https://nestjs.com/)
69
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
70
+
71
+ ## License
72
+
73
+ Nest is [MIT licensed](LICENSE).
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class BadRequestException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class BadRequestException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'BadRequestException', common_1.HttpStatus.BAD_REQUEST, parameters);
9
+ }
10
+ }
11
+ exports.BadRequestException = BadRequestException;
12
+ //# sourceMappingURL=bad-request-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request-error.exception.js","sourceRoot":"","sources":["../../../src/exception/bad-request-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,mBAAoB,SAAQ,8BAAa;IACpD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,qBAAqB,EAAE,mBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC9E,CAAC;CACF;AAJD,kDAIC"}
@@ -0,0 +1,21 @@
1
+ import { HttpException, HttpStatus } from '@nestjs/common';
2
+ export type ErrorModel = {
3
+ error: {
4
+ code: string | number;
5
+ traceid: string;
6
+ message: string;
7
+ timestamp: string;
8
+ path: string;
9
+ };
10
+ };
11
+ export type ParametersType = {
12
+ [key: string]: unknown;
13
+ };
14
+ export declare class BaseException extends HttpException {
15
+ traceid: string;
16
+ readonly context: string;
17
+ readonly statusCode: number;
18
+ readonly code?: string;
19
+ readonly parameters: ParametersType;
20
+ constructor(message: string, status: HttpStatus, parameters?: ParametersType);
21
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ class BaseException extends common_1.HttpException {
6
+ constructor(message, status, parameters) {
7
+ super(message, status);
8
+ if (parameters) {
9
+ this.parameters = parameters;
10
+ }
11
+ this.statusCode = super.getStatus();
12
+ Error.captureStackTrace(this);
13
+ }
14
+ }
15
+ exports.BaseException = BaseException;
16
+ //# sourceMappingURL=base.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.exception.js","sourceRoot":"","sources":["../../../src/exception/base.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAc3D,MAAa,aAAc,SAAQ,sBAAa;IAO9C,YACE,OAAe,EACf,MAAkB,EAClB,UAA2B;QAE3B,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEvB,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QACpC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF;AArBD,sCAqBC"}
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class ConflictException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConflictException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class ConflictException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'ConflictException', common_1.HttpStatus.CONFLICT, parameters);
9
+ }
10
+ }
11
+ exports.ConflictException = ConflictException;
12
+ //# sourceMappingURL=conflict-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conflict-error.exception.js","sourceRoot":"","sources":["../../../src/exception/conflict-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,8BAAa;IAClD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,mBAAmB,EAAE,mBAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;CACF;AAJD,8CAIC"}
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class ForbiddenException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class ForbiddenException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'BadRequestException', common_1.HttpStatus.FORBIDDEN, parameters);
9
+ }
10
+ }
11
+ exports.ForbiddenException = ForbiddenException;
12
+ //# sourceMappingURL=forbidden-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden-error.exception.js","sourceRoot":"","sources":["../../../src/exception/forbidden-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,kBAAmB,SAAQ,8BAAa;IACnD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,qBAAqB,EAAE,mBAAU,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC;CACF;AAJD,gDAIC"}
@@ -0,0 +1,7 @@
1
+ export * from './base.exception';
2
+ export * from './conflict-error.exception';
3
+ export * from './not-found-error.exception';
4
+ export * from './forbidden-error.exception';
5
+ export * from './bad-request-error.exception';
6
+ export * from './unauthorized-error.exception';
7
+ export * from './internal-server-error.exception';
@@ -1 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./base.exception"), exports);
18
+ __exportStar(require("./conflict-error.exception"), exports);
19
+ __exportStar(require("./not-found-error.exception"), exports);
20
+ __exportStar(require("./forbidden-error.exception"), exports);
21
+ __exportStar(require("./bad-request-error.exception"), exports);
22
+ __exportStar(require("./unauthorized-error.exception"), exports);
23
+ __exportStar(require("./internal-server-error.exception"), exports);
1
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exception/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exception/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,6DAA2C;AAC3C,8DAA4C;AAC5C,8DAA4C;AAC5C,gEAA8C;AAC9C,iEAA+C;AAC/C,oEAAkD"}
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class InternalServerException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalServerException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class InternalServerException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'InternalServerException', common_1.HttpStatus.INTERNAL_SERVER_ERROR, parameters);
9
+ }
10
+ }
11
+ exports.InternalServerException = InternalServerException;
12
+ //# sourceMappingURL=internal-server-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-server-error.exception.js","sourceRoot":"","sources":["../../../src/exception/internal-server-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,uBAAwB,SAAQ,8BAAa;IACxD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CACH,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,yBAAyB,EACpC,mBAAU,CAAC,qBAAqB,EAChC,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AARD,0DAQC"}
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class NotFoundException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class NotFoundException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'NotFoundException', common_1.HttpStatus.NOT_FOUND, parameters);
9
+ }
10
+ }
11
+ exports.NotFoundException = NotFoundException;
12
+ //# sourceMappingURL=not-found-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found-error.exception.js","sourceRoot":"","sources":["../../../src/exception/not-found-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,8BAAa;IAClD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,mBAAmB,EAAE,mBAAU,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;CACF;AAJD,8CAIC"}
@@ -0,0 +1,4 @@
1
+ import { BaseException, ParametersType } from './base.exception';
2
+ export declare class UnauthorizedException extends BaseException {
3
+ constructor(message?: string, parameters?: ParametersType);
4
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnauthorizedException = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const base_exception_1 = require("./base.exception");
6
+ class UnauthorizedException extends base_exception_1.BaseException {
7
+ constructor(message, parameters) {
8
+ super(message !== null && message !== void 0 ? message : 'UnauthorizedException', common_1.HttpStatus.UNAUTHORIZED, parameters);
9
+ }
10
+ }
11
+ exports.UnauthorizedException = UnauthorizedException;
12
+ //# sourceMappingURL=unauthorized-error.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthorized-error.exception.js","sourceRoot":"","sources":["../../../src/exception/unauthorized-error.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,8BAAa;IACtD,YAAY,OAAgB,EAAE,UAA2B;QACvD,KAAK,CACH,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,uBAAuB,EAClC,mBAAU,CAAC,YAAY,EACvB,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AARD,sDAQC"}
@@ -0,0 +1,4 @@
1
+ import { ExceptionFilter, ArgumentsHost, HttpException } from '@nestjs/common';
2
+ export declare class HttpExceptionFilter implements ExceptionFilter {
3
+ catch(exception: HttpException, host: ArgumentsHost): void;
4
+ }
@@ -0,0 +1,27 @@
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
+ let HttpExceptionFilter = exports.HttpExceptionFilter = class HttpExceptionFilter {
12
+ catch(exception, host) {
13
+ const ctx = host.switchToHttp();
14
+ const response = ctx.getResponse();
15
+ const request = ctx.getRequest();
16
+ const status = exception.getStatus();
17
+ response.status(status).json({
18
+ statusCode: status,
19
+ timestamp: new Date().toISOString(),
20
+ path: request.url,
21
+ });
22
+ }
23
+ };
24
+ exports.HttpExceptionFilter = HttpExceptionFilter = __decorate([
25
+ (0, common_1.Catch)(common_1.HttpException)
26
+ ], HttpExceptionFilter);
27
+ //# sourceMappingURL=http-exception.filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["../../../src/filter/http-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AAIjB,IAAM,mBAAmB,iCAAzB,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,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;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;8BAbY,mBAAmB;IAD/B,IAAA,cAAK,EAAC,sBAAa,CAAC;GACR,mBAAmB,CAa/B"}
@@ -0,0 +1 @@
1
+ export * from './http-exception.filter';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./http-exception.filter"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
@@ -4,3 +4,5 @@ export * from './dto';
4
4
  export * from './lib';
5
5
  export * from './response';
6
6
  export * from './util';
7
+ export * from './filter';
8
+ export * from './exception';
package/dist/src/index.js CHANGED
@@ -20,4 +20,6 @@ __exportStar(require("./dto"), exports);
20
20
  __exportStar(require("./lib"), exports);
21
21
  __exportStar(require("./response"), exports);
22
22
  __exportStar(require("./util"), exports);
23
+ __exportStar(require("./filter"), exports);
24
+ __exportStar(require("./exception"), exports);
23
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,wCAAsB;AACtB,6CAA2B;AAC3B,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,wCAAsB;AACtB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,8CAA4B"}
@@ -0,0 +1 @@
1
+ export * from './microservice.setup';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./microservice.setup"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/setup/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
@@ -0,0 +1,2 @@
1
+ import type { INestApplication } from '@nestjs/common';
2
+ export declare function microserviceSetup(app: INestApplication, serviceName: string): Promise<void>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.microserviceSetup = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const microservices_1 = require("@nestjs/microservices");
6
+ const util_1 = require("../util");
7
+ async function microserviceSetup(app, serviceName) {
8
+ util_1.AppUtils.killAppWithGrace(app);
9
+ const protoBasePath = process.cwd() + '/libs/proto-schema/src/proto';
10
+ const host = process.env['GRPC_HOST'];
11
+ const port = process.env['GRPC_PORT'];
12
+ const options = {
13
+ transport: microservices_1.Transport.GRPC,
14
+ options: {
15
+ url: `${host}:${port}`,
16
+ protoPath: `${protoBasePath}/${serviceName}.proto`,
17
+ package: `${serviceName}`,
18
+ },
19
+ };
20
+ app.connectMicroservice(options);
21
+ await app.startAllMicroservices();
22
+ common_1.Logger.log(`GRPC ${serviceName} running on ${options.options.url}`, 'Bootstrap');
23
+ }
24
+ exports.microserviceSetup = microserviceSetup;
25
+ //# sourceMappingURL=microservice.setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microservice.setup.js","sourceRoot":"","sources":["../../../src/setup/microservice.setup.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,yDAAkD;AAElD,kCAAmC;AAE5B,KAAK,UAAU,iBAAiB,CACrC,GAAqB,EACrB,WAAmB;IAEnB,eAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,8BAA8B,CAAC;IACrE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG;QACd,SAAS,EAAE,yBAAS,CAAC,IAAI;QACzB,OAAO,EAAE;YACP,GAAG,EAAE,GAAG,IAAI,IAAI,IAAI,EAAE;YACtB,SAAS,EAAE,GAAG,aAAa,IAAI,WAAW,QAAQ;YAClD,OAAO,EAAE,GAAG,WAAW,EAAE;SAC1B;KACF,CAAC;IACF,GAAG,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAClC,eAAM,CAAC,GAAG,CACR,QAAQ,WAAW,eAAe,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EACvD,WAAW,CACZ,CAAC;AACJ,CAAC;AAtBD,8CAsBC"}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=swagger.setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.setup.js","sourceRoot":"","sources":["../../../src/setup/swagger.setup.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { INestApplication } from '@nestjs/common';
2
+ export declare class AppUtils {
3
+ static killAppWithGrace: (app: INestApplication) => void;
4
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AppUtils = void 0;
5
+ class AppUtils {
6
+ }
7
+ exports.AppUtils = AppUtils;
8
+ _a = AppUtils;
9
+ AppUtils.killAppWithGrace = (app) => {
10
+ process.on('SIGINT', async () => {
11
+ setTimeout(() => process.exit(1), 5000);
12
+ await app.close();
13
+ process.exit(0);
14
+ });
15
+ process.on('SIGTERM', async () => {
16
+ setTimeout(() => process.exit(1), 5000);
17
+ await app.close();
18
+ process.exit(0);
19
+ });
20
+ };
21
+ //# sourceMappingURL=app.utils.js.map