nestjs-backend-common 0.1.0 → 0.4.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 (211) hide show
  1. package/.github/workflows/docs.yml +61 -0
  2. package/.github/workflows/publish.yml +21 -4
  3. package/.prettierignore +1 -0
  4. package/CONTRIBUTING.md +5 -0
  5. package/README.md +12 -2
  6. package/dist/jest.config.d.ts +1 -0
  7. package/dist/jest.config.d.ts.map +1 -1
  8. package/dist/jest.config.js +1 -0
  9. package/dist/jest.config.js.map +1 -1
  10. package/dist/src/decorators/any-of/any-of.decorator.d.ts +1 -1
  11. package/dist/src/decorators/any-of/any-of.decorator.js +1 -1
  12. package/dist/src/decorators/get-ip/get-ip.decorator.d.ts +4 -0
  13. package/dist/src/decorators/get-ip/get-ip.decorator.d.ts.map +1 -1
  14. package/dist/src/decorators/get-ip/get-ip.decorator.js +4 -0
  15. package/dist/src/decorators/get-ip/get-ip.decorator.js.map +1 -1
  16. package/dist/src/decorators/index.d.ts +3 -2
  17. package/dist/src/decorators/index.d.ts.map +1 -1
  18. package/dist/src/decorators/index.js +7 -16
  19. package/dist/src/decorators/index.js.map +1 -1
  20. package/dist/src/decorators/one-of/one-of.decorator.d.ts +1 -1
  21. package/dist/src/decorators/one-of/one-of.decorator.d.ts.map +1 -1
  22. package/dist/src/decorators/one-of/one-of.decorator.js +3 -5
  23. package/dist/src/decorators/one-of/one-of.decorator.js.map +1 -1
  24. package/dist/src/graphql-types/index.d.ts +2 -0
  25. package/dist/src/graphql-types/index.d.ts.map +1 -0
  26. package/dist/src/graphql-types/index.js +18 -0
  27. package/dist/src/graphql-types/index.js.map +1 -0
  28. package/dist/src/graphql-types/relay-pagination.type.d.ts +24 -0
  29. package/dist/src/graphql-types/relay-pagination.type.d.ts.map +1 -0
  30. package/dist/src/graphql-types/relay-pagination.type.js +97 -0
  31. package/dist/src/graphql-types/relay-pagination.type.js.map +1 -0
  32. package/dist/src/index.d.ts +4 -2
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +4 -2
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/interfaces/index.d.ts +13 -0
  37. package/dist/src/interfaces/index.d.ts.map +1 -0
  38. package/dist/src/{types → interfaces}/index.js.map +1 -1
  39. package/dist/src/modules/correlation-id/correlation-id.constant.d.ts.map +1 -0
  40. package/dist/src/modules/correlation-id/correlation-id.constant.js.map +1 -0
  41. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.interceptor.d.ts +6 -3
  42. package/dist/src/modules/correlation-id/correlation-id.interceptor.d.ts.map +1 -0
  43. package/dist/src/modules/correlation-id/correlation-id.interceptor.js +117 -0
  44. package/dist/src/modules/correlation-id/correlation-id.interceptor.js.map +1 -0
  45. package/dist/src/modules/correlation-id/correlation-id.interface.d.ts +3 -0
  46. package/dist/src/modules/correlation-id/correlation-id.interface.d.ts.map +1 -0
  47. package/dist/src/modules/correlation-id/correlation-id.interface.js +3 -0
  48. package/dist/src/modules/correlation-id/correlation-id.interface.js.map +1 -0
  49. package/dist/src/modules/correlation-id/correlation-id.module.d.ts +17 -0
  50. package/dist/src/modules/correlation-id/correlation-id.module.d.ts.map +1 -0
  51. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.module.js +12 -1
  52. package/dist/src/modules/correlation-id/correlation-id.module.js.map +1 -0
  53. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.d.ts +0 -1
  54. package/dist/src/modules/correlation-id/correlation-id.service.d.ts.map +1 -0
  55. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.js +2 -4
  56. package/dist/src/modules/correlation-id/correlation-id.service.js.map +1 -0
  57. package/dist/src/{correlation-id → modules/correlation-id}/index.d.ts +1 -1
  58. package/dist/src/modules/correlation-id/index.d.ts.map +1 -0
  59. package/dist/src/{correlation-id → modules/correlation-id}/index.js +1 -1
  60. package/dist/src/modules/correlation-id/index.js.map +1 -0
  61. package/dist/src/modules/index.d.ts +3 -0
  62. package/dist/src/modules/index.d.ts.map +1 -0
  63. package/dist/src/modules/index.js +19 -0
  64. package/dist/src/modules/index.js.map +1 -0
  65. package/dist/src/modules/logger/correlation-id.format.d.ts +7 -0
  66. package/dist/src/modules/logger/correlation-id.format.d.ts.map +1 -0
  67. package/dist/src/modules/logger/correlation-id.format.js +42 -0
  68. package/dist/src/modules/logger/correlation-id.format.js.map +1 -0
  69. package/dist/src/modules/logger/custom-logger.service.d.ts +15 -0
  70. package/dist/src/modules/logger/custom-logger.service.d.ts.map +1 -0
  71. package/dist/src/modules/logger/custom-logger.service.js +160 -0
  72. package/dist/src/modules/logger/custom-logger.service.js.map +1 -0
  73. package/dist/src/modules/logger/index.d.ts +5 -0
  74. package/dist/src/modules/logger/index.d.ts.map +1 -0
  75. package/dist/src/modules/logger/index.js +10 -0
  76. package/dist/src/modules/logger/index.js.map +1 -0
  77. package/dist/src/modules/logger/json-format.d.ts +7 -0
  78. package/dist/src/modules/logger/json-format.d.ts.map +1 -0
  79. package/dist/src/modules/logger/json-format.js +10 -0
  80. package/dist/src/modules/logger/json-format.js.map +1 -0
  81. package/dist/src/modules/logger/logger.interface.d.ts +8 -0
  82. package/dist/src/modules/logger/logger.interface.d.ts.map +1 -0
  83. package/dist/src/{correlation-id/correlation-id.type.js → modules/logger/logger.interface.js} +1 -1
  84. package/dist/src/modules/logger/logger.interface.js.map +1 -0
  85. package/dist/src/modules/logger/logger.module-definition.d.ts +12 -0
  86. package/dist/src/modules/logger/logger.module-definition.d.ts.map +1 -0
  87. package/dist/src/modules/logger/logger.module-definition.js +14 -0
  88. package/dist/src/modules/logger/logger.module-definition.js.map +1 -0
  89. package/dist/src/modules/logger/logger.module.d.ts +51 -0
  90. package/dist/src/modules/logger/logger.module.d.ts.map +1 -0
  91. package/dist/src/modules/logger/logger.module.js +165 -0
  92. package/dist/src/modules/logger/logger.module.js.map +1 -0
  93. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts +7 -0
  94. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts.map +1 -0
  95. package/dist/src/modules/logger/nest-like-with-dash.format.js +16 -0
  96. package/dist/src/modules/logger/nest-like-with-dash.format.js.map +1 -0
  97. package/dist/src/utils/index.d.ts +4 -0
  98. package/dist/src/utils/index.d.ts.map +1 -0
  99. package/dist/src/utils/index.js +20 -0
  100. package/dist/src/utils/index.js.map +1 -0
  101. package/dist/src/utils/is-nil.util.d.ts +2 -0
  102. package/dist/src/utils/is-nil.util.d.ts.map +1 -0
  103. package/dist/src/utils/is-nil.util.js +7 -0
  104. package/dist/src/utils/is-nil.util.js.map +1 -0
  105. package/dist/src/utils/url-builder.d.ts +2 -0
  106. package/dist/src/utils/url-builder.d.ts.map +1 -0
  107. package/dist/src/utils/url-builder.js +12 -0
  108. package/dist/src/utils/url-builder.js.map +1 -0
  109. package/dist/src/utils/validate-envs.util.d.ts +3 -0
  110. package/dist/src/utils/validate-envs.util.d.ts.map +1 -0
  111. package/dist/src/utils/validate-envs.util.js +29 -0
  112. package/dist/src/utils/validate-envs.util.js.map +1 -0
  113. package/docs/.nojekyll +1 -0
  114. package/docs/assets/hierarchy.js +1 -0
  115. package/docs/assets/highlight.css +78 -0
  116. package/docs/assets/icons.js +18 -0
  117. package/docs/assets/icons.svg +1 -0
  118. package/docs/assets/main.js +60 -0
  119. package/docs/assets/navigation.js +1 -0
  120. package/docs/assets/search.js +1 -0
  121. package/docs/assets/style.css +1633 -0
  122. package/docs/classes/CorrelationIdModule.html +3 -0
  123. package/docs/classes/CorrelationIdService.html +3 -0
  124. package/docs/classes/CustomLoggerService.html +13 -0
  125. package/docs/classes/LoggerModule.html +8 -0
  126. package/docs/classes/PageInfo.html +6 -0
  127. package/docs/functions/AnyOf.html +2 -0
  128. package/docs/functions/ConnectionType.html +1 -0
  129. package/docs/functions/EdgeType.html +1 -0
  130. package/docs/functions/OneOf.html +2 -0
  131. package/docs/functions/isNil.html +1 -0
  132. package/docs/functions/urlBuilder.html +1 -0
  133. package/docs/functions/validateEnvs.html +1 -0
  134. package/docs/hierarchy.html +1 -0
  135. package/docs/index.html +10 -0
  136. package/docs/interfaces/Class.html +2 -0
  137. package/docs/interfaces/Connection.html +3 -0
  138. package/docs/interfaces/CorrelationIdModuleOptions.html +6 -0
  139. package/docs/interfaces/Edge.html +3 -0
  140. package/docs/interfaces/LogMetadata.html +3 -0
  141. package/docs/modules.html +1 -0
  142. package/docs/types/CommonExecutionContext.html +1 -0
  143. package/docs/types/LogLevel.html +1 -0
  144. package/docs/types/LogMode.html +1 -0
  145. package/docs/types/NodeEnv.html +1 -0
  146. package/docs/types/RecursivePartial.html +1 -0
  147. package/docs/variables/CORRELATION_ID_CLS_KEY.html +1 -0
  148. package/docs/variables/CORRELATION_ID_HEADER_NAME.html +1 -0
  149. package/docs/variables/jsonFormat.html +3 -0
  150. package/eslint.config.mjs +3 -0
  151. package/jest.config.ts +1 -0
  152. package/package.json +21 -7
  153. package/src/decorators/any-of/any-of.decorator.spec.ts +11 -0
  154. package/src/decorators/any-of/any-of.decorator.ts +1 -1
  155. package/src/decorators/get-ip/get-ip.decorator.ts +4 -0
  156. package/src/decorators/index.ts +3 -2
  157. package/src/decorators/one-of/one-of.decorator.ts +3 -5
  158. package/src/graphql-types/index.ts +1 -0
  159. package/src/graphql-types/relay-pagination.type.ts +89 -0
  160. package/src/index.ts +4 -2
  161. package/src/interfaces/index.ts +19 -0
  162. package/src/modules/correlation-id/correlation-id.interceptor.spec.ts +146 -0
  163. package/src/modules/correlation-id/correlation-id.interceptor.ts +162 -0
  164. package/src/modules/correlation-id/correlation-id.interface.ts +3 -0
  165. package/src/{correlation-id → modules/correlation-id}/correlation-id.module.ts +13 -2
  166. package/src/{correlation-id → modules/correlation-id}/correlation-id.service.ts +1 -3
  167. package/src/{correlation-id → modules/correlation-id}/index.ts +1 -1
  168. package/src/modules/index.ts +2 -0
  169. package/src/modules/logger/correlation-id.format.ts +47 -0
  170. package/src/modules/logger/custom-logger.service.spec.ts +155 -0
  171. package/src/modules/logger/custom-logger.service.ts +170 -0
  172. package/src/modules/logger/index.ts +8 -0
  173. package/src/modules/logger/json-format.ts +13 -0
  174. package/src/modules/logger/logger.interface.ts +14 -0
  175. package/src/modules/logger/logger.module-definition.ts +34 -0
  176. package/src/modules/logger/logger.module.ts +157 -0
  177. package/src/modules/logger/nest-like-with-dash.format.ts +16 -0
  178. package/src/utils/index.ts +3 -0
  179. package/src/utils/is-nil.util.spec.ts +25 -0
  180. package/src/utils/is-nil.util.ts +3 -0
  181. package/src/utils/url-builder.spec.ts +48 -0
  182. package/src/utils/url-builder.ts +10 -0
  183. package/src/utils/validate-envs.helper.spec.ts +38 -0
  184. package/src/utils/validate-envs.util.ts +32 -0
  185. package/.github/README.md +0 -19
  186. package/dist/src/correlation-id/correlation-id.constant.d.ts.map +0 -1
  187. package/dist/src/correlation-id/correlation-id.constant.js.map +0 -1
  188. package/dist/src/correlation-id/correlation-id.interceptor.d.ts.map +0 -1
  189. package/dist/src/correlation-id/correlation-id.interceptor.js +0 -68
  190. package/dist/src/correlation-id/correlation-id.interceptor.js.map +0 -1
  191. package/dist/src/correlation-id/correlation-id.module.d.ts +0 -6
  192. package/dist/src/correlation-id/correlation-id.module.d.ts.map +0 -1
  193. package/dist/src/correlation-id/correlation-id.module.js.map +0 -1
  194. package/dist/src/correlation-id/correlation-id.service.d.ts.map +0 -1
  195. package/dist/src/correlation-id/correlation-id.service.js.map +0 -1
  196. package/dist/src/correlation-id/correlation-id.type.d.ts +0 -8
  197. package/dist/src/correlation-id/correlation-id.type.d.ts.map +0 -1
  198. package/dist/src/correlation-id/correlation-id.type.js.map +0 -1
  199. package/dist/src/correlation-id/index.d.ts.map +0 -1
  200. package/dist/src/correlation-id/index.js.map +0 -1
  201. package/dist/src/types/index.d.ts +0 -3
  202. package/dist/src/types/index.d.ts.map +0 -1
  203. package/src/correlation-id/correlation-id.interceptor.spec.ts +0 -45
  204. package/src/correlation-id/correlation-id.interceptor.ts +0 -78
  205. package/src/correlation-id/correlation-id.type.ts +0 -7
  206. package/src/types/index.ts +0 -3
  207. /package/dist/src/{types → interfaces}/index.js +0 -0
  208. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.d.ts +0 -0
  209. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.js +0 -0
  210. /package/src/{correlation-id → modules/correlation-id}/correlation-id.constant.ts +0 -0
  211. /package/src/{correlation-id → modules/correlation-id}/correlation-id.service.spec.ts +0 -0
@@ -0,0 +1,61 @@
1
+ name: Generate Documentation
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Publish The Library"]
6
+ types:
7
+ - completed
8
+ branches:
9
+ - main
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ docs:
16
+ runs-on: ubuntu-24.04
17
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+
22
+ - uses: pnpm/action-setup@v4
23
+ name: Install pnpm
24
+ with:
25
+ version: 10
26
+ run_install: false
27
+
28
+ - name: Install NodeJS
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: 24
32
+ cache: "pnpm"
33
+
34
+ - name: Install Dependencies
35
+ run: pnpm install --frozen-lockfile
36
+
37
+ - name: Generate Documentation
38
+ run: pnpm exec typedoc src/index.ts
39
+
40
+ - name: Commit Documentation
41
+ id: commit_docs
42
+ run: |
43
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
44
+ git config --local user.name "github-actions[bot]"
45
+ git add docs/
46
+
47
+ if [[ -n $(git status --porcelain docs/) ]]; then
48
+ echo "Documentation changes detected, committing..."
49
+ git commit -m "chore: update documentation"
50
+ echo "has_changes=true" >> $GITHUB_OUTPUT
51
+ else
52
+ echo "No documentation changes detected, skipping commit"
53
+ echo "has_changes=false" >> $GITHUB_OUTPUT
54
+ fi
55
+
56
+ - name: Push Changes
57
+ if: steps.commit_docs.outputs.has_changes == 'true'
58
+ uses: ad-m/github-push-action@master
59
+ with:
60
+ github_token: ${{ secrets.GITHUB_TOKEN }}
61
+ branch: ${{ github.ref }}
@@ -17,34 +17,51 @@ jobs:
17
17
  uses: actions/checkout@v4
18
18
 
19
19
  - name: Check the current published version
20
+ id: version_check
20
21
  run: |
21
22
  LAST_PUBLISHED_VERSION=$(npm view nestjs-backend-common version 2> /dev/null || echo "")
22
- PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
23
- [[ $LAST_PUBLISHED_VERSION == $PACKAGE_VERSION ]] && exit 1 || exit 0
23
+ PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d ' ')
24
+
25
+ echo "last_published=$LAST_PUBLISHED_VERSION" >> $GITHUB_OUTPUT
26
+ echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
27
+
28
+ if [[ "$LAST_PUBLISHED_VERSION" == "$PACKAGE_VERSION" ]]; then
29
+ echo "should_publish=false" >> $GITHUB_OUTPUT
30
+ echo "::warning::Skipping publish - version $PACKAGE_VERSION is already published on npm"
31
+ else
32
+ echo "should_publish=true" >> $GITHUB_OUTPUT
33
+ echo "Will publish new version: $PACKAGE_VERSION (current: $LAST_PUBLISHED_VERSION)"
34
+ fi
24
35
 
25
36
  - uses: pnpm/action-setup@v4
37
+ if: steps.version_check.outputs.should_publish == 'true'
26
38
  name: Install pnpm
27
39
  with:
28
40
  version: 10
29
41
  run_install: false
30
42
 
31
43
  - name: Install NodeJS
44
+ if: steps.version_check.outputs.should_publish == 'true'
32
45
  uses: actions/setup-node@v4
33
46
  with:
34
- node-version: 22
47
+ node-version: 24
35
48
  cache: "pnpm"
36
49
  registry-url: "https://registry.npmjs.org/"
37
50
 
38
51
  - name: Install Dependencies
52
+ if: steps.version_check.outputs.should_publish == 'true'
39
53
  run: pnpm install --frozen-lockfile
40
54
 
41
55
  - name: Apply Eslint
56
+ if: steps.version_check.outputs.should_publish == 'true'
42
57
  run: pnpm lint
43
58
 
44
59
  - name: Run Unit Tests
60
+ if: steps.version_check.outputs.should_publish == 'true'
45
61
  run: pnpm test:unit
46
62
 
47
63
  - name: Publish Package on npm 📦
64
+ if: steps.version_check.outputs.should_publish == 'true'
48
65
  run: pnpm publish --provenance --access public --no-git-checks
49
66
  env:
50
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
67
+ NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.prettierignore CHANGED
@@ -6,3 +6,4 @@
6
6
  /.nx/workspace-data
7
7
  /node_modules
8
8
  pnpm-lock.yaml
9
+ /docs
@@ -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,13 @@
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
+ 📚 **[View Full API Documentation](https://kasir-barati.github.io/nestjs-backend-common/)**.
6
+
7
+ 📦 **[View the package on NPM](https://www.npmjs.com/package/nestjs-backend-common)**.
8
+
9
+ ## Why `nestjs-cls` Is Peer Dependency?
10
+
11
+ This is because we wanna share the same storage between our App and this library. Thus we have to define it as peer dependency;
12
+
13
+ > **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"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @description
3
- * Do not annotate the fields with `@IsOptional` since it will not validate them at all.
3
+ * Do not annotate the fields with `@IsOptional` since it will not validate them at all. Learn how to use it by reading the unit tests.
4
4
  */
5
5
  export declare function AnyOf(properties: string[]): (target: any) => void;
6
6
  //# sourceMappingURL=any-of.decorator.d.ts.map
@@ -5,7 +5,7 @@ const common_1 = require("@nestjs/common");
5
5
  const class_validator_1 = require("class-validator");
6
6
  /**
7
7
  * @description
8
- * Do not annotate the fields with `@IsOptional` since it will not validate them at all.
8
+ * Do not annotate the fields with `@IsOptional` since it will not validate them at all. Learn how to use it by reading the unit tests.
9
9
  */
10
10
  function AnyOf(properties) {
11
11
  return function (target) {
@@ -1,4 +1,8 @@
1
1
  import { ExecutionContext } from '@nestjs/common';
2
2
  export declare function getIpFactory(data: unknown, ctx: ExecutionContext): string | undefined;
3
+ /**
4
+ * @description
5
+ * Returns the IP address of the client making the request. Learn how to use it by reading the unit tests.
6
+ */
3
7
  export declare const GetIp: (...dataOrPipes: unknown[]) => ParameterDecorator;
4
8
  //# sourceMappingURL=get-ip.decorator.d.ts.map
@@ -1 +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"}
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;;;GAGG;AACH,eAAO,MAAM,KAAK,mDAAqC,CAAC"}
@@ -13,5 +13,9 @@ function getIpFactory(data, ctx) {
13
13
  return ip;
14
14
  }
15
15
  }
16
+ /**
17
+ * @description
18
+ * Returns the IP address of the client making the request. Learn how to use it by reading the unit tests.
19
+ */
16
20
  exports.GetIp = (0, common_1.createParamDecorator)(getIpFactory);
17
21
  //# sourceMappingURL=get-ip.decorator.js.map
@@ -1 +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"}
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;AAED;;;GAGG;AACU,QAAA,KAAK,GAAG,IAAA,6BAAoB,EAAC,YAAY,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
- export * from './any-of/any-of.decorator';
2
- export * from './one-of/one-of.decorator';
1
+ export { AnyOf } from './any-of/any-of.decorator';
2
+ export { GetIp } from './get-ip/get-ip.decorator';
3
+ export { OneOf } from './one-of/one-of.decorator';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,19 +1,10 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./any-of/any-of.decorator"), exports);
18
- __exportStar(require("./one-of/one-of.decorator"), exports);
3
+ exports.OneOf = exports.GetIp = exports.AnyOf = void 0;
4
+ var any_of_decorator_1 = require("./any-of/any-of.decorator");
5
+ Object.defineProperty(exports, "AnyOf", { enumerable: true, get: function () { return any_of_decorator_1.AnyOf; } });
6
+ var get_ip_decorator_1 = require("./get-ip/get-ip.decorator");
7
+ Object.defineProperty(exports, "GetIp", { enumerable: true, get: function () { return get_ip_decorator_1.GetIp; } });
8
+ var one_of_decorator_1 = require("./one-of/one-of.decorator");
9
+ Object.defineProperty(exports, "OneOf", { enumerable: true, get: function () { return one_of_decorator_1.OneOf; } });
19
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";;;AAAA,8DAAkD;AAAzC,yGAAA,KAAK,OAAA;AACd,8DAAkD;AAAzC,yGAAA,KAAK,OAAA;AACd,8DAAkD;AAAzC,yGAAA,KAAK,OAAA"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @description
3
- * Throws an error if more than one of the properties are present in the request body/querystring.
3
+ * Throws an error if more than one of the properties are present in the request body/querystring. Learn how to use it by reading the unit tests.
4
4
  */
5
5
  export declare function OneOf(properties: string[]): (target: any) => void;
6
6
  //# sourceMappingURL=one-of.decorator.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"one-of.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/one-of/one-of.decorator.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IACvB,QAAQ,GAAG,UAoB7B"}
@@ -9,9 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.OneOf = OneOf;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const class_validator_1 = require("class-validator");
12
+ const utils_1 = require("../../utils");
12
13
  /**
13
14
  * @description
14
- * Throws an error if more than one of the properties are present in the request body/querystring.
15
+ * Throws an error if more than one of the properties are present in the request body/querystring. Learn how to use it by reading the unit tests.
15
16
  */
16
17
  function OneOf(properties) {
17
18
  return function (target) {
@@ -43,7 +44,7 @@ let OneOfCheckerConstraint = class OneOfCheckerConstraint {
43
44
  const data = validationArguments.object;
44
45
  for (const property of properties) {
45
46
  const propertyValue = data[property];
46
- if (!isNil(value) && !isNil(propertyValue)) {
47
+ if (!(0, utils_1.isNil)(value) && !(0, utils_1.isNil)(propertyValue)) {
47
48
  return false;
48
49
  }
49
50
  }
@@ -69,7 +70,4 @@ let OneOfCheckerConstraint = class OneOfCheckerConstraint {
69
70
  OneOfCheckerConstraint = __decorate([
70
71
  (0, class_validator_1.ValidatorConstraint)({ name: 'OneOfChecker' })
71
72
  ], OneOfCheckerConstraint);
72
- function isNil(value) {
73
- return value === null || value === undefined;
74
- }
75
73
  //# sourceMappingURL=one-of.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"one-of.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/one-of/one-of.decorator.ts"],"names":[],"mappings":";;;;;;;;AAaA,sBAqBC;AAlCD,2CAAiD;AACjD,qDAMyB;AAEzB;;;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;YAEF,IAAA,wBAAe,EACb,IAAA,4BAAU,EAAC,CAAC,GAA4B,EAAE,EAAE;gBAC1C,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;gBACF,MAAM,oBAAoB,GAAG,GAAG,CAAC,QAA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,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,mBAAwC;QACrD,MAAM,CAAC,UAAU,CAAC,GAAG,mBAAmB,CAAC,WAExC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;YAC9D,IAAI,KAAK,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpC,WAAW,IAAI,OAAO,GAAG,QAAQ,CAAC;YACpC,CAAC;iBAAM,IAAI,KAAK,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3C,WAAW,IAAI,OAAO,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,WAAW,IAAI,OAAO,GAAG,IAAI,CAAC;YAChC,CAAC;YAED,OAAO,WAAW,CAAC;QACrB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,eAAe,KAAK,oBAAoB,CAAC;IAClD,CAAC;CACF,CAAA;AA1CK,sBAAsB;IAD3B,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;GACxC,sBAAsB,CA0C3B"}
@@ -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,24 @@
1
+ import { Type } from '@nestjs/common';
2
+ type ClassRef<T> = Type<T>;
3
+ export interface Edge<TNode> {
4
+ /** @description An opaque cursor for pagination */
5
+ cursor: string;
6
+ /** @description The item at the end of the edge */
7
+ node: TNode;
8
+ }
9
+ export interface Connection<TEdge> {
10
+ /** @description A list of edges in the connection */
11
+ edges: TEdge[];
12
+ /** @description Information about the current page of results */
13
+ pageInfo: PageInfo;
14
+ }
15
+ export declare class PageInfo {
16
+ endCursor: string | null;
17
+ hasNextPage: boolean;
18
+ hasPreviousPage: boolean;
19
+ startCursor: string | null;
20
+ }
21
+ export declare function EdgeType<TNode>(classRef: ClassRef<TNode>): ClassRef<Edge<TNode>>;
22
+ export declare function ConnectionType<TNode, TEdge extends Edge<TNode>>(classRef: ClassRef<TNode>, edgeRef?: ClassRef<TEdge>): ClassRef<Connection<TEdge>>;
23
+ export {};
24
+ //# 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,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,UAAU,CAAC,KAAK;IAC/B,qDAAqD;IACrD,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,iEAAiE;IACjE,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":";;;;;;;;;;;;AAgDA,4BAiBC;AAED,wCAqBC;AAvFD,6CAAoD;AAmB7C,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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1,4 +1,6 @@
1
- export * from './correlation-id';
2
1
  export * from './decorators';
3
- export * from './types';
2
+ export * from './graphql-types';
3
+ export * from './interfaces';
4
+ export * from './modules';
5
+ export * from './utils';
4
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,cAAc,CAAC;AAC7B,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,7 +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
17
  __exportStar(require("./decorators"), exports);
19
- __exportStar(require("./types"), exports);
18
+ __exportStar(require("./graphql-types"), exports);
19
+ __exportStar(require("./interfaces"), exports);
20
+ __exportStar(require("./modules"), exports);
21
+ __exportStar(require("./utils"), exports);
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,+CAA6B;AAC7B,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,13 @@
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
+ export interface CommonModuleOptions {
11
+ global?: boolean;
12
+ }
13
+ //# 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;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -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"}