nestjs-backend-common 0.0.7 → 0.3.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.
Files changed (177) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/.husky/pre-commit +5 -0
  3. package/.husky/pre-push +4 -0
  4. package/.husky/pre-version +4 -0
  5. package/.vscode/settings.json +7 -0
  6. package/CONTRIBUTING.md +5 -0
  7. package/README.md +20 -2
  8. package/dist/jest.config.d.ts +1 -0
  9. package/dist/jest.config.d.ts.map +1 -1
  10. package/dist/jest.config.js +1 -0
  11. package/dist/jest.config.js.map +1 -1
  12. package/dist/src/decorators/any-of/any-of.decorator.d.ts +6 -0
  13. package/dist/src/decorators/any-of/any-of.decorator.d.ts.map +1 -0
  14. package/dist/src/decorators/any-of/any-of.decorator.js +34 -0
  15. package/dist/src/decorators/any-of/any-of.decorator.js.map +1 -0
  16. package/dist/src/decorators/get-ip/get-ip.decorator.d.ts +4 -0
  17. package/dist/src/decorators/get-ip/get-ip.decorator.d.ts.map +1 -0
  18. package/dist/src/decorators/get-ip/get-ip.decorator.js +17 -0
  19. package/dist/src/decorators/get-ip/get-ip.decorator.js.map +1 -0
  20. package/dist/src/decorators/index.d.ts +3 -0
  21. package/dist/src/decorators/index.d.ts.map +1 -0
  22. package/dist/src/decorators/index.js +19 -0
  23. package/dist/src/decorators/index.js.map +1 -0
  24. package/dist/src/decorators/one-of/one-of.decorator.d.ts +6 -0
  25. package/dist/src/decorators/one-of/one-of.decorator.d.ts.map +1 -0
  26. package/dist/src/decorators/one-of/one-of.decorator.js +75 -0
  27. package/dist/src/decorators/one-of/one-of.decorator.js.map +1 -0
  28. package/dist/src/graphql-types/index.d.ts +2 -0
  29. package/dist/src/graphql-types/index.d.ts.map +1 -0
  30. package/dist/src/graphql-types/index.js +18 -0
  31. package/dist/src/graphql-types/index.js.map +1 -0
  32. package/dist/src/graphql-types/relay-pagination.type.d.ts +20 -0
  33. package/dist/src/graphql-types/relay-pagination.type.d.ts.map +1 -0
  34. package/dist/src/graphql-types/relay-pagination.type.js +97 -0
  35. package/dist/src/graphql-types/relay-pagination.type.js.map +1 -0
  36. package/dist/src/index.d.ts +5 -2
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +5 -2
  39. package/dist/src/index.js.map +1 -1
  40. package/dist/src/interfaces/index.d.ts +10 -0
  41. package/dist/src/interfaces/index.d.ts.map +1 -0
  42. package/dist/src/{types → interfaces}/index.js.map +1 -1
  43. package/dist/src/modules/correlation-id/correlation-id.constant.d.ts.map +1 -0
  44. package/dist/src/modules/correlation-id/correlation-id.constant.js.map +1 -0
  45. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.interceptor.d.ts +6 -3
  46. package/dist/src/modules/correlation-id/correlation-id.interceptor.d.ts.map +1 -0
  47. package/dist/src/modules/correlation-id/correlation-id.interceptor.js +117 -0
  48. package/dist/src/modules/correlation-id/correlation-id.interceptor.js.map +1 -0
  49. package/dist/src/{correlation-id/correlation-id.type.d.ts → modules/correlation-id/correlation-id.interface.d.ts} +1 -1
  50. package/dist/src/modules/correlation-id/correlation-id.interface.d.ts.map +1 -0
  51. package/dist/src/modules/correlation-id/correlation-id.interface.js +3 -0
  52. package/dist/src/modules/correlation-id/correlation-id.interface.js.map +1 -0
  53. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.module.d.ts +1 -1
  54. package/dist/src/modules/correlation-id/correlation-id.module.d.ts.map +1 -0
  55. package/dist/src/modules/correlation-id/correlation-id.module.js.map +1 -0
  56. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.d.ts +0 -1
  57. package/dist/src/modules/correlation-id/correlation-id.service.d.ts.map +1 -0
  58. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.js +2 -4
  59. package/dist/src/modules/correlation-id/correlation-id.service.js.map +1 -0
  60. package/dist/src/{correlation-id → modules/correlation-id}/index.d.ts +1 -1
  61. package/dist/src/modules/correlation-id/index.d.ts.map +1 -0
  62. package/dist/src/{correlation-id → modules/correlation-id}/index.js +1 -1
  63. package/dist/src/modules/correlation-id/index.js.map +1 -0
  64. package/dist/src/modules/index.d.ts +3 -0
  65. package/dist/src/modules/index.d.ts.map +1 -0
  66. package/dist/src/modules/index.js +19 -0
  67. package/dist/src/modules/index.js.map +1 -0
  68. package/dist/src/modules/logger/correlation-id.format.d.ts +7 -0
  69. package/dist/src/modules/logger/correlation-id.format.d.ts.map +1 -0
  70. package/dist/src/modules/logger/correlation-id.format.js +42 -0
  71. package/dist/src/modules/logger/correlation-id.format.js.map +1 -0
  72. package/dist/src/modules/logger/custom-logger.service.d.ts +15 -0
  73. package/dist/src/modules/logger/custom-logger.service.d.ts.map +1 -0
  74. package/dist/src/modules/logger/custom-logger.service.js +160 -0
  75. package/dist/src/modules/logger/custom-logger.service.js.map +1 -0
  76. package/dist/src/modules/logger/index.d.ts +5 -0
  77. package/dist/src/modules/logger/index.d.ts.map +1 -0
  78. package/dist/src/modules/logger/index.js +10 -0
  79. package/dist/src/modules/logger/index.js.map +1 -0
  80. package/dist/src/modules/logger/json-format.d.ts +7 -0
  81. package/dist/src/modules/logger/json-format.d.ts.map +1 -0
  82. package/dist/src/modules/logger/json-format.js +10 -0
  83. package/dist/src/modules/logger/json-format.js.map +1 -0
  84. package/dist/src/modules/logger/logger.interface.d.ts +8 -0
  85. package/dist/src/modules/logger/logger.interface.d.ts.map +1 -0
  86. package/dist/src/{correlation-id/correlation-id.type.js → modules/logger/logger.interface.js} +1 -1
  87. package/dist/src/modules/logger/logger.interface.js.map +1 -0
  88. package/dist/src/modules/logger/logger.module-definition.d.ts +13 -0
  89. package/dist/src/modules/logger/logger.module-definition.d.ts.map +1 -0
  90. package/dist/src/modules/logger/logger.module-definition.js +14 -0
  91. package/dist/src/modules/logger/logger.module-definition.js.map +1 -0
  92. package/dist/src/modules/logger/logger.module.d.ts +51 -0
  93. package/dist/src/modules/logger/logger.module.d.ts.map +1 -0
  94. package/dist/src/modules/logger/logger.module.js +165 -0
  95. package/dist/src/modules/logger/logger.module.js.map +1 -0
  96. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts +7 -0
  97. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts.map +1 -0
  98. package/dist/src/modules/logger/nest-like-with-dash.format.js +16 -0
  99. package/dist/src/modules/logger/nest-like-with-dash.format.js.map +1 -0
  100. package/dist/src/utils/index.d.ts +4 -0
  101. package/dist/src/utils/index.d.ts.map +1 -0
  102. package/dist/src/utils/index.js +20 -0
  103. package/dist/src/utils/index.js.map +1 -0
  104. package/dist/src/utils/is-nil.util.d.ts +2 -0
  105. package/dist/src/utils/is-nil.util.d.ts.map +1 -0
  106. package/dist/src/utils/is-nil.util.js +7 -0
  107. package/dist/src/utils/is-nil.util.js.map +1 -0
  108. package/dist/src/utils/url-builder.d.ts +2 -0
  109. package/dist/src/utils/url-builder.d.ts.map +1 -0
  110. package/dist/src/utils/url-builder.js +12 -0
  111. package/dist/src/utils/url-builder.js.map +1 -0
  112. package/dist/src/utils/validate-envs.util.d.ts +3 -0
  113. package/dist/src/utils/validate-envs.util.d.ts.map +1 -0
  114. package/dist/src/utils/validate-envs.util.js +29 -0
  115. package/dist/src/utils/validate-envs.util.js.map +1 -0
  116. package/eslint.config.mjs +3 -0
  117. package/jest.config.ts +1 -0
  118. package/package.json +17 -4
  119. package/src/decorators/any-of/any-of.decorator.spec.ts +155 -0
  120. package/src/decorators/any-of/any-of.decorator.ts +45 -0
  121. package/src/decorators/get-ip/get-ip.decorator.spec.ts +79 -0
  122. package/src/decorators/get-ip/get-ip.decorator.ts +22 -0
  123. package/src/decorators/index.ts +2 -0
  124. package/src/decorators/one-of/one-of.decorator.spec.ts +87 -0
  125. package/src/decorators/one-of/one-of.decorator.ts +99 -0
  126. package/src/graphql-types/index.ts +1 -0
  127. package/src/graphql-types/relay-pagination.type.ts +85 -0
  128. package/src/index.ts +5 -2
  129. package/src/interfaces/index.ts +16 -0
  130. package/src/modules/correlation-id/correlation-id.interceptor.spec.ts +146 -0
  131. package/src/modules/correlation-id/correlation-id.interceptor.ts +162 -0
  132. package/src/{correlation-id → modules/correlation-id}/correlation-id.module.ts +1 -1
  133. package/src/{correlation-id → modules/correlation-id}/correlation-id.service.ts +1 -3
  134. package/src/{correlation-id → modules/correlation-id}/index.ts +1 -1
  135. package/src/modules/index.ts +2 -0
  136. package/src/modules/logger/correlation-id.format.ts +47 -0
  137. package/src/modules/logger/custom-logger.service.spec.ts +155 -0
  138. package/src/modules/logger/custom-logger.service.ts +170 -0
  139. package/src/modules/logger/index.ts +8 -0
  140. package/src/modules/logger/json-format.ts +13 -0
  141. package/src/modules/logger/logger.interface.ts +14 -0
  142. package/src/modules/logger/logger.module-definition.ts +35 -0
  143. package/src/modules/logger/logger.module.ts +157 -0
  144. package/src/modules/logger/nest-like-with-dash.format.ts +16 -0
  145. package/src/utils/index.ts +3 -0
  146. package/src/utils/is-nil.util.spec.ts +25 -0
  147. package/src/utils/is-nil.util.ts +3 -0
  148. package/src/utils/url-builder.spec.ts +48 -0
  149. package/src/utils/url-builder.ts +10 -0
  150. package/src/utils/validate-envs.helper.spec.ts +38 -0
  151. package/src/utils/validate-envs.util.ts +32 -0
  152. package/.github/README.md +0 -13
  153. package/dist/src/correlation-id/correlation-id.constant.d.ts.map +0 -1
  154. package/dist/src/correlation-id/correlation-id.constant.js.map +0 -1
  155. package/dist/src/correlation-id/correlation-id.interceptor.d.ts.map +0 -1
  156. package/dist/src/correlation-id/correlation-id.interceptor.js +0 -68
  157. package/dist/src/correlation-id/correlation-id.interceptor.js.map +0 -1
  158. package/dist/src/correlation-id/correlation-id.module.d.ts.map +0 -1
  159. package/dist/src/correlation-id/correlation-id.module.js.map +0 -1
  160. package/dist/src/correlation-id/correlation-id.service.d.ts.map +0 -1
  161. package/dist/src/correlation-id/correlation-id.service.js.map +0 -1
  162. package/dist/src/correlation-id/correlation-id.type.d.ts.map +0 -1
  163. package/dist/src/correlation-id/correlation-id.type.js.map +0 -1
  164. package/dist/src/correlation-id/index.d.ts.map +0 -1
  165. package/dist/src/correlation-id/index.js.map +0 -1
  166. package/dist/src/types/index.d.ts +0 -3
  167. package/dist/src/types/index.d.ts.map +0 -1
  168. package/src/correlation-id/correlation-id.interceptor.spec.ts +0 -45
  169. package/src/correlation-id/correlation-id.interceptor.ts +0 -78
  170. package/src/types/index.ts +0 -3
  171. /package/dist/src/{types → interfaces}/index.js +0 -0
  172. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.d.ts +0 -0
  173. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.js +0 -0
  174. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.module.js +0 -0
  175. /package/src/{correlation-id → modules/correlation-id}/correlation-id.constant.ts +0 -0
  176. /package/src/{correlation-id/correlation-id.type.ts → modules/correlation-id/correlation-id.interface.ts} +0 -0
  177. /package/src/{correlation-id → modules/correlation-id}/correlation-id.service.spec.ts +0 -0
@@ -47,4 +47,4 @@ jobs:
47
47
  - name: Publish Package on npm 📦
48
48
  run: pnpm publish --provenance --access public --no-git-checks
49
49
  env:
50
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50
+ NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run format
5
+ npm run lint:fix
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run build
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run build
@@ -0,0 +1,7 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll": "always"
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ # [Increase Version](https://docs.npmjs.com/cli/v8/commands/npm-version)
2
+
3
+ ```bash
4
+ npm version patch --no-git-tag-version
5
+ ```
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # `nestjs-backend-common`
1
+ # NestJS Backend Common
2
2
 
3
- You can read the docs in GitHub.
3
+ All the utility functions and common modules I usually use in my NestJS applications will be published and maintained here.
4
+
5
+ | Module | description |
6
+ | --------------------- | ---------------------------------------------------------------- |
7
+ | `CorrelationIdModule` | Adds a correlation ID to each request (`RPC`, `GraphQL`, `HTTP`) |
8
+
9
+ ---
10
+
11
+ | Decorator | Description |
12
+ | --------- | ----------------------------------------------------------------------------------------------- |
13
+ | `AnyOf` | Client has to at least send of the two fields, they can of course provide both. |
14
+ | `GetIp` | Returns the IP. |
15
+ | `OneOf` | Throws an error if more than one of the properties are present in the request body/querystring. |
16
+
17
+ ## Why `nestjs-cls` Is Peer Dependency?
18
+
19
+ This is because we wanna share the same storage between our App and this library. Thus we have to define it as peer dependency;
20
+
21
+ > **Peer Dependencies**: These are dependencies that your project hooks into or modifies in the parent project, usually a plugin for some other library or tool. Peer dependencies are not automatically installed by npm. Instead, they are only checked for, ensuring that the parent project (the project that will depend on your project) has a dependency on the project you hook into. For example, if you create a plugin for a library like Chai, you would specify Chai as a peer dependency. This ensures that the user of your plugin has the correct version of Chai installed.
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  '^.+.tsx?$': [string, {}];
5
5
  };
6
6
  setupFilesAfterEnv: string[];
7
+ testMatch: string[];
7
8
  };
8
9
  export default _default;
9
10
  //# sourceMappingURL=jest.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMmB"}
1
+ {"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;;;;;;;AAEA,wBAOmB"}
@@ -6,5 +6,6 @@ exports.default = {
6
6
  '^.+.tsx?$': ['ts-jest', {}],
7
7
  },
8
8
  setupFilesAfterEnv: ['./jest-setup-after-env.ts'],
9
+ testMatch: ['**/*.spec.ts'],
9
10
  };
10
11
  //# sourceMappingURL=jest.config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;AAEA,kBAAe;IACb,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC;KAC7B;IACD,kBAAkB,EAAE,CAAC,2BAA2B,CAAC;CACjC,CAAC"}
1
+ {"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;AAEA,kBAAe;IACb,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC;KAC7B;IACD,kBAAkB,EAAE,CAAC,2BAA2B,CAAC;IACjD,SAAS,EAAE,CAAC,cAAc,CAAC;CACX,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @description
3
+ * Do not annotate the fields with `@IsOptional` since it will not validate them at all.
4
+ */
5
+ export declare function AnyOf(properties: string[]): (target: any) => void;
6
+ //# sourceMappingURL=any-of.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any-of.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/any-of/any-of.decorator.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IACvB,QAAQ,GAAG,UAoC7B"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnyOf = AnyOf;
4
+ const common_1 = require("@nestjs/common");
5
+ const class_validator_1 = require("class-validator");
6
+ /**
7
+ * @description
8
+ * Do not annotate the fields with `@IsOptional` since it will not validate them at all.
9
+ */
10
+ function AnyOf(properties) {
11
+ return function (target) {
12
+ for (const property of properties) {
13
+ const otherProps = properties.filter((prop) => prop !== property);
14
+ const decorators = [
15
+ (0, class_validator_1.ValidateIf)((obj) => {
16
+ const isCurrentPropDefined = obj[property] !== undefined;
17
+ const areOtherPropsUndefined = otherProps.reduce((acc, prop) => acc && obj[prop] === undefined, true);
18
+ return isCurrentPropDefined || areOtherPropsUndefined;
19
+ }),
20
+ ];
21
+ // For properties that have validators that don't fail on undefined (like @ValidateNested), we need to add IsDefined when all properties are undefined.
22
+ const areAllPropsUndefinedValidator = (0, class_validator_1.ValidateIf)((obj) => {
23
+ const areAllPropsUndefined = properties.every((prop) => obj[prop] === undefined);
24
+ return areAllPropsUndefined;
25
+ });
26
+ decorators.push(areAllPropsUndefinedValidator);
27
+ decorators.push((0, class_validator_1.IsDefined)());
28
+ for (const decorator of decorators) {
29
+ (0, common_1.applyDecorators)(decorator)(target.prototype, property);
30
+ }
31
+ }
32
+ };
33
+ }
34
+ //# sourceMappingURL=any-of.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any-of.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/any-of/any-of.decorator.ts"],"names":[],"mappings":";;AAOA,sBAqCC;AA5CD,2CAAiD;AACjD,qDAAwD;AAExD;;;GAGG;AACH,SAAgB,KAAK,CAAC,UAAoB;IACxC,OAAO,UAAU,MAAW;QAC1B,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAClC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAC5B,CAAC;YACF,MAAM,UAAU,GAAG;gBACjB,IAAA,4BAAU,EAAC,CAAC,GAA4B,EAAE,EAAE;oBAC1C,MAAM,oBAAoB,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;oBACzD,MAAM,sBAAsB,GAAG,UAAU,CAAC,MAAM,CAC9C,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,EAC7C,IAAI,CACL,CAAC;oBAEF,OAAO,oBAAoB,IAAI,sBAAsB,CAAC;gBACxD,CAAC,CAAC;aACH,CAAC;YAEF,uJAAuJ;YACvJ,MAAM,6BAA6B,GAAG,IAAA,4BAAU,EAC9C,CAAC,GAA4B,EAAE,EAAE;gBAC/B,MAAM,oBAAoB,GAAG,UAAU,CAAC,KAAK,CAC3C,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,CAClC,CAAC;gBAEF,OAAO,oBAAoB,CAAC;YAC9B,CAAC,CACF,CAAC;YAEF,UAAU,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YAC/C,UAAU,CAAC,IAAI,CAAC,IAAA,2BAAS,GAAE,CAAC,CAAC;YAE7B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACnC,IAAA,wBAAe,EAAC,SAAS,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ExecutionContext } from '@nestjs/common';
2
+ export declare function getIpFactory(data: unknown, ctx: ExecutionContext): string | undefined;
3
+ export declare const GetIp: (...dataOrPipes: unknown[]) => ParameterDecorator;
4
+ //# sourceMappingURL=get-ip.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-ip.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/get-ip/get-ip.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAGxB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,gBAAgB,GACpB,MAAM,GAAG,SAAS,CAUpB;AAED,eAAO,MAAM,KAAK,mDAAqC,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetIp = void 0;
4
+ exports.getIpFactory = getIpFactory;
5
+ const common_1 = require("@nestjs/common");
6
+ const class_validator_1 = require("class-validator");
7
+ function getIpFactory(data, ctx) {
8
+ const request = ctx.switchToHttp().getRequest();
9
+ const ip = request.ip ??
10
+ request.headers['x-forwarded-for'] ??
11
+ request.headers['X-Real-IP'];
12
+ if ((0, class_validator_1.isIP)(ip)) {
13
+ return ip;
14
+ }
15
+ }
16
+ exports.GetIp = (0, common_1.createParamDecorator)(getIpFactory);
17
+ //# sourceMappingURL=get-ip.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-ip.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/get-ip/get-ip.decorator.ts"],"names":[],"mappings":";;;AAMA,oCAaC;AAnBD,2CAGwB;AACxB,qDAAuC;AAEvC,SAAgB,YAAY,CAC1B,IAAa,EACb,GAAqB;IAErB,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,MAAM,EAAE,GACN,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;QAClC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/B,IAAI,IAAA,sBAAI,EAAC,EAAE,CAAC,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAEY,QAAA,KAAK,GAAG,IAAA,6BAAoB,EAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './any-of/any-of.decorator';
2
+ export * from './one-of/one-of.decorator';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,19 @@
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("./any-of/any-of.decorator"), exports);
18
+ __exportStar(require("./one-of/one-of.decorator"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,4DAA0C"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @description
3
+ * Throws an error if more than one of the properties are present in the request body/querystring.
4
+ */
5
+ export declare function OneOf(properties: string[]): (target: any) => void;
6
+ //# sourceMappingURL=one-of.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-of.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/one-of/one-of.decorator.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IACvB,QAAQ,GAAG,UAoB7B"}
@@ -0,0 +1,75 @@
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.OneOf = OneOf;
10
+ const common_1 = require("@nestjs/common");
11
+ const class_validator_1 = require("class-validator");
12
+ /**
13
+ * @description
14
+ * Throws an error if more than one of the properties are present in the request body/querystring.
15
+ */
16
+ function OneOf(properties) {
17
+ return function (target) {
18
+ for (const property of properties) {
19
+ const otherProps = properties.filter((prop) => prop !== property);
20
+ (0, common_1.applyDecorators)((0, class_validator_1.ValidateIf)((obj) => {
21
+ const areOtherPropsUndefined = otherProps.reduce((acc, prop) => acc && obj[prop] === undefined, true);
22
+ const isCurrentPropDefined = obj[property] !== undefined;
23
+ return isCurrentPropDefined || areOtherPropsUndefined;
24
+ }), OneOfChecker(properties))(target.prototype, property);
25
+ }
26
+ };
27
+ }
28
+ function OneOfChecker(properties) {
29
+ return function (object, propertyName) {
30
+ (0, class_validator_1.registerDecorator)({
31
+ name: 'OneOfChecker',
32
+ constraints: [properties],
33
+ target: object.constructor,
34
+ propertyName: String(propertyName),
35
+ validator: OneOfCheckerConstraint,
36
+ });
37
+ };
38
+ }
39
+ let OneOfCheckerConstraint = class OneOfCheckerConstraint {
40
+ validate(value, validationArguments) {
41
+ let [properties] = validationArguments.constraints;
42
+ properties = properties.filter((property) => property !== validationArguments.property);
43
+ const data = validationArguments.object;
44
+ for (const property of properties) {
45
+ const propertyValue = data[property];
46
+ if (!isNil(value) && !isNil(propertyValue)) {
47
+ return false;
48
+ }
49
+ }
50
+ return true;
51
+ }
52
+ defaultMessage(validationArguments) {
53
+ const [properties] = validationArguments.constraints;
54
+ const props = properties.reduce((accumulator, current, index) => {
55
+ if (index === properties.length - 2) {
56
+ accumulator += current + ', and ';
57
+ }
58
+ else if (index === properties.length - 1) {
59
+ accumulator += current;
60
+ }
61
+ else {
62
+ accumulator += current + ', ';
63
+ }
64
+ return accumulator;
65
+ }, '');
66
+ return `Do not send ${props} at the same time!`;
67
+ }
68
+ };
69
+ OneOfCheckerConstraint = __decorate([
70
+ (0, class_validator_1.ValidatorConstraint)({ name: 'OneOfChecker' })
71
+ ], OneOfCheckerConstraint);
72
+ function isNil(value) {
73
+ return value === null || value === undefined;
74
+ }
75
+ //# sourceMappingURL=one-of.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-of.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/one-of/one-of.decorator.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export * from './relay-pagination.type';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphql-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -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("./relay-pagination.type"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graphql-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
@@ -0,0 +1,20 @@
1
+ import { Type } from '@nestjs/common';
2
+ type ClassRef<T> = Type<T>;
3
+ export interface Edge<TNode> {
4
+ cursor: string;
5
+ node: TNode;
6
+ }
7
+ export interface Connection<TEdge> {
8
+ edges: TEdge[];
9
+ pageInfo: PageInfo;
10
+ }
11
+ export declare class PageInfo {
12
+ endCursor: string | null;
13
+ hasNextPage: boolean;
14
+ hasPreviousPage: boolean;
15
+ startCursor: string | null;
16
+ }
17
+ export declare function EdgeType<TNode>(classRef: ClassRef<TNode>): ClassRef<Edge<TNode>>;
18
+ export declare function ConnectionType<TNode, TEdge extends Edge<TNode>>(classRef: ClassRef<TNode>, edgeRef?: ClassRef<TEdge>): ClassRef<Connection<TEdge>>;
19
+ export {};
20
+ //# sourceMappingURL=relay-pagination.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-pagination.type.d.ts","sourceRoot":"","sources":["../../../src/graphql-types/relay-pagination.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,KAAK,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AAE3B,MAAM,WAAW,IAAI,CAAC,KAAK;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,UAAU,CAAC,KAAK;IAC/B,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,qBACa,QAAQ;IAMnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAMzB,WAAW,EAAE,OAAO,CAAC;IAMrB,eAAe,EAAE,OAAO,CAAC;IAOzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAC5B,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,GACxB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAevB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,EAC7D,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EACzB,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,GACxB,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAkB7B"}
@@ -0,0 +1,97 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PageInfo = void 0;
13
+ exports.EdgeType = EdgeType;
14
+ exports.ConnectionType = ConnectionType;
15
+ const graphql_1 = require("@nestjs/graphql");
16
+ let PageInfo = class PageInfo {
17
+ endCursor;
18
+ hasNextPage;
19
+ hasPreviousPage;
20
+ startCursor;
21
+ };
22
+ exports.PageInfo = PageInfo;
23
+ __decorate([
24
+ (0, graphql_1.Field)(() => String, {
25
+ nullable: true,
26
+ description: 'The opaque cursor representing the end of the current page',
27
+ }),
28
+ __metadata("design:type", Object)
29
+ ], PageInfo.prototype, "endCursor", void 0);
30
+ __decorate([
31
+ (0, graphql_1.Field)({
32
+ description: 'Indicates if there are more items after the current page',
33
+ }),
34
+ __metadata("design:type", Boolean)
35
+ ], PageInfo.prototype, "hasNextPage", void 0);
36
+ __decorate([
37
+ (0, graphql_1.Field)({
38
+ description: 'Indicates if there are more items before the current page',
39
+ }),
40
+ __metadata("design:type", Boolean)
41
+ ], PageInfo.prototype, "hasPreviousPage", void 0);
42
+ __decorate([
43
+ (0, graphql_1.Field)(() => String, {
44
+ nullable: true,
45
+ description: 'The opaque cursor representing the start of the current page',
46
+ }),
47
+ __metadata("design:type", Object)
48
+ ], PageInfo.prototype, "startCursor", void 0);
49
+ exports.PageInfo = PageInfo = __decorate([
50
+ (0, graphql_1.ObjectType)()
51
+ ], PageInfo);
52
+ function EdgeType(classRef) {
53
+ let EdgeTypeClass = class EdgeTypeClass {
54
+ cursor;
55
+ node;
56
+ };
57
+ __decorate([
58
+ (0, graphql_1.Field)(() => String, {
59
+ description: 'An opaque cursor for pagination',
60
+ }),
61
+ __metadata("design:type", String)
62
+ ], EdgeTypeClass.prototype, "cursor", void 0);
63
+ __decorate([
64
+ (0, graphql_1.Field)(() => classRef, {
65
+ description: 'The item at the end of the edge',
66
+ }),
67
+ __metadata("design:type", Object)
68
+ ], EdgeTypeClass.prototype, "node", void 0);
69
+ EdgeTypeClass = __decorate([
70
+ (0, graphql_1.ObjectType)({ isAbstract: true })
71
+ ], EdgeTypeClass);
72
+ return EdgeTypeClass;
73
+ }
74
+ function ConnectionType(classRef, edgeRef) {
75
+ const resolvedEdgeRef = edgeRef ?? EdgeType(classRef);
76
+ let ConnectionTypeClass = class ConnectionTypeClass {
77
+ edges;
78
+ pageInfo;
79
+ };
80
+ __decorate([
81
+ (0, graphql_1.Field)(() => [resolvedEdgeRef], {
82
+ description: 'A list of edges in the connection',
83
+ }),
84
+ __metadata("design:type", Array)
85
+ ], ConnectionTypeClass.prototype, "edges", void 0);
86
+ __decorate([
87
+ (0, graphql_1.Field)(() => PageInfo, {
88
+ description: 'Information about the current page of results',
89
+ }),
90
+ __metadata("design:type", PageInfo)
91
+ ], ConnectionTypeClass.prototype, "pageInfo", void 0);
92
+ ConnectionTypeClass = __decorate([
93
+ (0, graphql_1.ObjectType)({ isAbstract: true })
94
+ ], ConnectionTypeClass);
95
+ return ConnectionTypeClass;
96
+ }
97
+ //# sourceMappingURL=relay-pagination.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-pagination.type.js","sourceRoot":"","sources":["../../../src/graphql-types/relay-pagination.type.ts"],"names":[],"mappings":";;;;;;;;;;;;AA4CA,4BAiBC;AAED,wCAqBC;AAnFD,6CAAoD;AAe7C,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAMnB,SAAS,CAAgB;IAMzB,WAAW,CAAU;IAMrB,eAAe,CAAU;IAOzB,WAAW,CAAgB;CAC5B,CAAA;AA1BY,4BAAQ;AAMnB;IALC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QACnB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,4DAA4D;KAC/D,CAAC;;2CACuB;AAMzB;IAJC,IAAA,eAAK,EAAC;QACL,WAAW,EACT,0DAA0D;KAC7D,CAAC;;6CACmB;AAMrB;IAJC,IAAA,eAAK,EAAC;QACL,WAAW,EACT,2DAA2D;KAC9D,CAAC;;iDACuB;AAOzB;IALC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QACnB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,8DAA8D;KACjE,CAAC;;6CACyB;mBAzBhB,QAAQ;IADpB,IAAA,oBAAU,GAAE;GACA,QAAQ,CA0BpB;AAED,SAAgB,QAAQ,CACtB,QAAyB;IAGzB,IAAM,aAAa,GAAnB,MAAM,aAAa;QAIjB,MAAM,CAAS;QAKf,IAAI,CAAQ;KACb,CAAA;IANC;QAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;YACnB,WAAW,EAAE,iCAAiC;SAC/C,CAAC;;iDACa;IAKf;QAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;YACrB,WAAW,EAAE,iCAAiC;SAC/C,CAAC;;+CACU;IATR,aAAa;QADlB,IAAA,oBAAU,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;OAC3B,aAAa,CAUlB;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAgB,cAAc,CAC5B,QAAyB,EACzB,OAAyB;IAEzB,MAAM,eAAe,GACnB,OAAO,IAAK,QAAQ,CAAC,QAAQ,CAAqB,CAAC;IAGrD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;QAIvB,KAAK,CAAU;QAKf,QAAQ,CAAW;KACpB,CAAA;IANC;QAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE;YAC9B,WAAW,EAAE,mCAAmC;SACjD,CAAC;;sDACa;IAKf;QAHC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;YACrB,WAAW,EAAE,+CAA+C;SAC7D,CAAC;kCACQ,QAAQ;yDAAC;IATf,mBAAmB;QADxB,IAAA,oBAAU,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;OAC3B,mBAAmB,CAUxB;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
@@ -1,3 +1,6 @@
1
- export * from './correlation-id';
2
- export * from './types';
1
+ export * from './decorators';
2
+ export * from './graphql-types';
3
+ export * from './interfaces';
4
+ export * from './modules';
5
+ export * from './utils';
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/dist/src/index.js CHANGED
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./correlation-id"), exports);
18
- __exportStar(require("./types"), exports);
17
+ __exportStar(require("./decorators"), exports);
18
+ __exportStar(require("./graphql-types"), exports);
19
+ __exportStar(require("./interfaces"), exports);
20
+ __exportStar(require("./modules"), exports);
21
+ __exportStar(require("./utils"), exports);
19
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,+CAA6B;AAC7B,4CAA0B;AAC1B,0CAAwB"}
@@ -0,0 +1,10 @@
1
+ import { ContextType } from '@nestjs/common';
2
+ export type CommonExecutionContext = 'graphql' | ContextType;
3
+ export type NodeEnv = 'development' | 'production' | 'test';
4
+ export interface Class<T> {
5
+ new (...args: any[]): T;
6
+ }
7
+ export type RecursivePartial<T> = Partial<{
8
+ [key in keyof T]: T[key] extends (...a: Array<infer U>) => unknown ? (...a: Array<U>) => RecursivePartial<ReturnType<T[key]>> | ReturnType<T[key]> : T[key] extends Array<unknown> ? Array<RecursivePartial<T[key][number]>> : RecursivePartial<T[key]> | T[key];
9
+ }>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,WAAW,CAAC;AAC7D,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;AAC5D,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;CACzB;AACD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,OAAO,CAAC;KACvC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,OAAO,GAC9D,CACE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KACX,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAC9D,CAAC,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,OAAO,CAAC,GAC3B,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACvC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.constant.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,sBAAsB,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.constant.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,gBAAgB,CAAC;AAC9C,QAAA,sBAAsB,GAAG,wBAAwB,CAAC"}
@@ -1,10 +1,13 @@
1
- import type { Observable } from 'rxjs';
2
1
  import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
3
2
  import { ClsService } from 'nestjs-cls';
3
+ import { type Observable } from 'rxjs';
4
4
  export declare class CorrelationIdInterceptor implements NestInterceptor {
5
5
  private readonly clsService;
6
- private logger;
7
6
  constructor(clsService: ClsService);
8
- intercept(executionContext: ExecutionContext, next: CallHandler): Observable<unknown>;
7
+ intercept(executionContext: ExecutionContext, next: CallHandler): Observable<any>;
8
+ private isHttp;
9
+ private isWebSocket;
10
+ private getGraphqlCorrelationIdHeader;
11
+ private setGraphqlCorrelationIdHeader;
9
12
  }
10
13
  //# sourceMappingURL=correlation-id.interceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.interceptor.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.interceptor.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EACX,gBAAgB,EAEhB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAO,MAAM,MAAM,CAAC;AAQ5C,qBACa,wBAAyB,YAAW,eAAe;IAClD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD,SAAS,CACP,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,GAChB,UAAU,CAAC,GAAG,CAAC;IAwFlB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,6BAA6B;CAoBtC"}