nestjs-backend-common 0.1.0 → 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 (151) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/CONTRIBUTING.md +5 -0
  3. package/README.md +20 -2
  4. package/dist/jest.config.d.ts +1 -0
  5. package/dist/jest.config.d.ts.map +1 -1
  6. package/dist/jest.config.js +1 -0
  7. package/dist/jest.config.js.map +1 -1
  8. package/dist/src/graphql-types/index.d.ts +2 -0
  9. package/dist/src/graphql-types/index.d.ts.map +1 -0
  10. package/dist/src/graphql-types/index.js +18 -0
  11. package/dist/src/graphql-types/index.js.map +1 -0
  12. package/dist/src/graphql-types/relay-pagination.type.d.ts +20 -0
  13. package/dist/src/graphql-types/relay-pagination.type.d.ts.map +1 -0
  14. package/dist/src/graphql-types/relay-pagination.type.js +97 -0
  15. package/dist/src/graphql-types/relay-pagination.type.js.map +1 -0
  16. package/dist/src/index.d.ts +4 -2
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/index.js +4 -2
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/interfaces/index.d.ts +10 -0
  21. package/dist/src/interfaces/index.d.ts.map +1 -0
  22. package/dist/src/{types → interfaces}/index.js.map +1 -1
  23. package/dist/src/modules/correlation-id/correlation-id.constant.d.ts.map +1 -0
  24. package/dist/src/modules/correlation-id/correlation-id.constant.js.map +1 -0
  25. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.interceptor.d.ts +6 -3
  26. package/dist/src/modules/correlation-id/correlation-id.interceptor.d.ts.map +1 -0
  27. package/dist/src/modules/correlation-id/correlation-id.interceptor.js +117 -0
  28. package/dist/src/modules/correlation-id/correlation-id.interceptor.js.map +1 -0
  29. package/dist/src/{correlation-id/correlation-id.type.d.ts → modules/correlation-id/correlation-id.interface.d.ts} +1 -1
  30. package/dist/src/modules/correlation-id/correlation-id.interface.d.ts.map +1 -0
  31. package/dist/src/modules/correlation-id/correlation-id.interface.js +3 -0
  32. package/dist/src/modules/correlation-id/correlation-id.interface.js.map +1 -0
  33. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.module.d.ts +1 -1
  34. package/dist/src/modules/correlation-id/correlation-id.module.d.ts.map +1 -0
  35. package/dist/src/modules/correlation-id/correlation-id.module.js.map +1 -0
  36. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.d.ts +0 -1
  37. package/dist/src/modules/correlation-id/correlation-id.service.d.ts.map +1 -0
  38. package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.service.js +2 -4
  39. package/dist/src/modules/correlation-id/correlation-id.service.js.map +1 -0
  40. package/dist/src/{correlation-id → modules/correlation-id}/index.d.ts +1 -1
  41. package/dist/src/modules/correlation-id/index.d.ts.map +1 -0
  42. package/dist/src/{correlation-id → modules/correlation-id}/index.js +1 -1
  43. package/dist/src/modules/correlation-id/index.js.map +1 -0
  44. package/dist/src/modules/index.d.ts +3 -0
  45. package/dist/src/modules/index.d.ts.map +1 -0
  46. package/dist/src/modules/index.js +19 -0
  47. package/dist/src/modules/index.js.map +1 -0
  48. package/dist/src/modules/logger/correlation-id.format.d.ts +7 -0
  49. package/dist/src/modules/logger/correlation-id.format.d.ts.map +1 -0
  50. package/dist/src/modules/logger/correlation-id.format.js +42 -0
  51. package/dist/src/modules/logger/correlation-id.format.js.map +1 -0
  52. package/dist/src/modules/logger/custom-logger.service.d.ts +15 -0
  53. package/dist/src/modules/logger/custom-logger.service.d.ts.map +1 -0
  54. package/dist/src/modules/logger/custom-logger.service.js +160 -0
  55. package/dist/src/modules/logger/custom-logger.service.js.map +1 -0
  56. package/dist/src/modules/logger/index.d.ts +5 -0
  57. package/dist/src/modules/logger/index.d.ts.map +1 -0
  58. package/dist/src/modules/logger/index.js +10 -0
  59. package/dist/src/modules/logger/index.js.map +1 -0
  60. package/dist/src/modules/logger/json-format.d.ts +7 -0
  61. package/dist/src/modules/logger/json-format.d.ts.map +1 -0
  62. package/dist/src/modules/logger/json-format.js +10 -0
  63. package/dist/src/modules/logger/json-format.js.map +1 -0
  64. package/dist/src/modules/logger/logger.interface.d.ts +8 -0
  65. package/dist/src/modules/logger/logger.interface.d.ts.map +1 -0
  66. package/dist/src/{correlation-id/correlation-id.type.js → modules/logger/logger.interface.js} +1 -1
  67. package/dist/src/modules/logger/logger.interface.js.map +1 -0
  68. package/dist/src/modules/logger/logger.module-definition.d.ts +13 -0
  69. package/dist/src/modules/logger/logger.module-definition.d.ts.map +1 -0
  70. package/dist/src/modules/logger/logger.module-definition.js +14 -0
  71. package/dist/src/modules/logger/logger.module-definition.js.map +1 -0
  72. package/dist/src/modules/logger/logger.module.d.ts +51 -0
  73. package/dist/src/modules/logger/logger.module.d.ts.map +1 -0
  74. package/dist/src/modules/logger/logger.module.js +165 -0
  75. package/dist/src/modules/logger/logger.module.js.map +1 -0
  76. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts +7 -0
  77. package/dist/src/modules/logger/nest-like-with-dash.format.d.ts.map +1 -0
  78. package/dist/src/modules/logger/nest-like-with-dash.format.js +16 -0
  79. package/dist/src/modules/logger/nest-like-with-dash.format.js.map +1 -0
  80. package/dist/src/utils/index.d.ts +4 -0
  81. package/dist/src/utils/index.d.ts.map +1 -0
  82. package/dist/src/utils/index.js +20 -0
  83. package/dist/src/utils/index.js.map +1 -0
  84. package/dist/src/utils/is-nil.util.d.ts +2 -0
  85. package/dist/src/utils/is-nil.util.d.ts.map +1 -0
  86. package/dist/src/utils/is-nil.util.js +7 -0
  87. package/dist/src/utils/is-nil.util.js.map +1 -0
  88. package/dist/src/utils/url-builder.d.ts +2 -0
  89. package/dist/src/utils/url-builder.d.ts.map +1 -0
  90. package/dist/src/utils/url-builder.js +12 -0
  91. package/dist/src/utils/url-builder.js.map +1 -0
  92. package/dist/src/utils/validate-envs.util.d.ts +3 -0
  93. package/dist/src/utils/validate-envs.util.d.ts.map +1 -0
  94. package/dist/src/utils/validate-envs.util.js +29 -0
  95. package/dist/src/utils/validate-envs.util.js.map +1 -0
  96. package/eslint.config.mjs +3 -0
  97. package/jest.config.ts +1 -0
  98. package/package.json +12 -3
  99. package/src/decorators/any-of/any-of.decorator.spec.ts +11 -0
  100. package/src/graphql-types/index.ts +1 -0
  101. package/src/graphql-types/relay-pagination.type.ts +85 -0
  102. package/src/index.ts +4 -2
  103. package/src/interfaces/index.ts +16 -0
  104. package/src/modules/correlation-id/correlation-id.interceptor.spec.ts +146 -0
  105. package/src/modules/correlation-id/correlation-id.interceptor.ts +162 -0
  106. package/src/{correlation-id → modules/correlation-id}/correlation-id.module.ts +1 -1
  107. package/src/{correlation-id → modules/correlation-id}/correlation-id.service.ts +1 -3
  108. package/src/{correlation-id → modules/correlation-id}/index.ts +1 -1
  109. package/src/modules/index.ts +2 -0
  110. package/src/modules/logger/correlation-id.format.ts +47 -0
  111. package/src/modules/logger/custom-logger.service.spec.ts +155 -0
  112. package/src/modules/logger/custom-logger.service.ts +170 -0
  113. package/src/modules/logger/index.ts +8 -0
  114. package/src/modules/logger/json-format.ts +13 -0
  115. package/src/modules/logger/logger.interface.ts +14 -0
  116. package/src/modules/logger/logger.module-definition.ts +35 -0
  117. package/src/modules/logger/logger.module.ts +157 -0
  118. package/src/modules/logger/nest-like-with-dash.format.ts +16 -0
  119. package/src/utils/index.ts +3 -0
  120. package/src/utils/is-nil.util.spec.ts +25 -0
  121. package/src/utils/is-nil.util.ts +3 -0
  122. package/src/utils/url-builder.spec.ts +48 -0
  123. package/src/utils/url-builder.ts +10 -0
  124. package/src/utils/validate-envs.helper.spec.ts +38 -0
  125. package/src/utils/validate-envs.util.ts +32 -0
  126. package/.github/README.md +0 -19
  127. package/dist/src/correlation-id/correlation-id.constant.d.ts.map +0 -1
  128. package/dist/src/correlation-id/correlation-id.constant.js.map +0 -1
  129. package/dist/src/correlation-id/correlation-id.interceptor.d.ts.map +0 -1
  130. package/dist/src/correlation-id/correlation-id.interceptor.js +0 -68
  131. package/dist/src/correlation-id/correlation-id.interceptor.js.map +0 -1
  132. package/dist/src/correlation-id/correlation-id.module.d.ts.map +0 -1
  133. package/dist/src/correlation-id/correlation-id.module.js.map +0 -1
  134. package/dist/src/correlation-id/correlation-id.service.d.ts.map +0 -1
  135. package/dist/src/correlation-id/correlation-id.service.js.map +0 -1
  136. package/dist/src/correlation-id/correlation-id.type.d.ts.map +0 -1
  137. package/dist/src/correlation-id/correlation-id.type.js.map +0 -1
  138. package/dist/src/correlation-id/index.d.ts.map +0 -1
  139. package/dist/src/correlation-id/index.js.map +0 -1
  140. package/dist/src/types/index.d.ts +0 -3
  141. package/dist/src/types/index.d.ts.map +0 -1
  142. package/src/correlation-id/correlation-id.interceptor.spec.ts +0 -45
  143. package/src/correlation-id/correlation-id.interceptor.ts +0 -78
  144. package/src/types/index.ts +0 -3
  145. /package/dist/src/{types → interfaces}/index.js +0 -0
  146. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.d.ts +0 -0
  147. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.constant.js +0 -0
  148. /package/dist/src/{correlation-id → modules/correlation-id}/correlation-id.module.js +0 -0
  149. /package/src/{correlation-id → modules/correlation-id}/correlation-id.constant.ts +0 -0
  150. /package/src/{correlation-id/correlation-id.type.ts → modules/correlation-id/correlation-id.interface.ts} +0 -0
  151. /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
+ # [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,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,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,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"}
@@ -0,0 +1,117 @@
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.CorrelationIdInterceptor = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const graphql_1 = require("@nestjs/graphql");
15
+ const crypto_1 = require("crypto");
16
+ const nestjs_cls_1 = require("nestjs-cls");
17
+ const rxjs_1 = require("rxjs");
18
+ const correlation_id_constant_1 = require("./correlation-id.constant");
19
+ let CorrelationIdInterceptor = class CorrelationIdInterceptor {
20
+ clsService;
21
+ constructor(clsService) {
22
+ this.clsService = clsService;
23
+ }
24
+ intercept(executionContext, next) {
25
+ let correlationId;
26
+ switch (executionContext.getType()) {
27
+ case 'http': {
28
+ const req = executionContext
29
+ .switchToHttp()
30
+ .getRequest();
31
+ correlationId = req.headers[correlation_id_constant_1.CORRELATION_ID_HEADER_NAME];
32
+ break;
33
+ }
34
+ case 'graphql': {
35
+ const ctx = graphql_1.GqlExecutionContext.create(executionContext);
36
+ const context = ctx.getContext();
37
+ if (ctx.getInfo().operation.operation === 'subscription') {
38
+ return next.handle();
39
+ }
40
+ correlationId = this.getGraphqlCorrelationIdHeader(context);
41
+ break;
42
+ }
43
+ case 'rpc': {
44
+ const req = executionContext.switchToRpc();
45
+ correlationId = req
46
+ .getContext()
47
+ .get(correlation_id_constant_1.CORRELATION_ID_HEADER_NAME)[0];
48
+ break;
49
+ }
50
+ }
51
+ correlationId = correlationId ?? (0, crypto_1.randomUUID)();
52
+ if (!this.clsService.isActive()) {
53
+ this.clsService.run(() => {
54
+ this.clsService.set(correlation_id_constant_1.CORRELATION_ID_CLS_KEY, correlationId);
55
+ });
56
+ }
57
+ else {
58
+ this.clsService.set(correlation_id_constant_1.CORRELATION_ID_CLS_KEY, correlationId);
59
+ }
60
+ return next.handle().pipe((0, rxjs_1.tap)(() => {
61
+ switch (executionContext.getType()) {
62
+ case 'http': {
63
+ const res = executionContext
64
+ .switchToHttp()
65
+ .getResponse();
66
+ res.headers.append(correlation_id_constant_1.CORRELATION_ID_HEADER_NAME, correlationId);
67
+ break;
68
+ }
69
+ case 'graphql': {
70
+ const ctx = graphql_1.GqlExecutionContext.create(executionContext);
71
+ const context = ctx.getContext();
72
+ this.setGraphqlCorrelationIdHeader(context, correlationId);
73
+ break;
74
+ }
75
+ case 'rpc': {
76
+ const metadata = executionContext
77
+ .switchToRpc()
78
+ .getContext();
79
+ metadata.set(correlation_id_constant_1.CORRELATION_ID_HEADER_NAME, correlationId);
80
+ break;
81
+ }
82
+ }
83
+ }));
84
+ }
85
+ isHttp(context) {
86
+ return !!context?.req?.res;
87
+ }
88
+ isWebSocket(context) {
89
+ return !!(context?.req?.extra?.request ||
90
+ context?.connection ||
91
+ (context?.req && !context?.res));
92
+ }
93
+ getGraphqlCorrelationIdHeader(context) {
94
+ if (this.isHttp(context)) {
95
+ return context.req.headers[correlation_id_constant_1.CORRELATION_ID_HEADER_NAME];
96
+ }
97
+ if (this.isWebSocket(context)) {
98
+ return context.req.extra.request.headers[correlation_id_constant_1.CORRELATION_ID_HEADER_NAME];
99
+ }
100
+ }
101
+ setGraphqlCorrelationIdHeader(context, correlationId) {
102
+ if (context.res) {
103
+ context.res.setHeader(correlation_id_constant_1.CORRELATION_ID_HEADER_NAME, correlationId);
104
+ return;
105
+ }
106
+ if (context.req && context.req.res) {
107
+ context.req.res.setHeader(correlation_id_constant_1.CORRELATION_ID_HEADER_NAME, correlationId);
108
+ return;
109
+ }
110
+ }
111
+ };
112
+ exports.CorrelationIdInterceptor = CorrelationIdInterceptor;
113
+ exports.CorrelationIdInterceptor = CorrelationIdInterceptor = __decorate([
114
+ (0, common_1.Injectable)(),
115
+ __metadata("design:paramtypes", [nestjs_cls_1.ClsService])
116
+ ], CorrelationIdInterceptor);
117
+ //# sourceMappingURL=correlation-id.interceptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.interceptor.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.interceptor.ts"],"names":[],"mappings":"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"}
@@ -5,4 +5,4 @@ export interface CorrelationIdModuleOptions {
5
5
  */
6
6
  isGlobal?: boolean;
7
7
  }
8
- //# sourceMappingURL=correlation-id.type.d.ts.map
8
+ //# sourceMappingURL=correlation-id.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.interface.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=correlation-id.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.interface.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.interface.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
- import { CorrelationIdModuleOptions } from './correlation-id.type';
2
+ import { CorrelationIdModuleOptions } from './correlation-id.interface';
3
3
  export declare class CorrelationIdModule {
4
4
  static forRoot(options?: CorrelationIdModuleOptions): DynamicModule;
5
5
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.module.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAKvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE,qBACa,mBAAmB;IAC9B,MAAM,CAAC,OAAO,CACZ,OAAO,CAAC,EAAE,0BAA0B,GACnC,aAAa;CAejB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.module.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uCAA+C;AAC/C,2CAAuC;AAEvC,6EAAwE;AAExE,qEAAgE;AAGzD,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAC9B,MAAM,CAAC,OAAO,CACZ,OAAoC;QAEpC,OAAO;YACL,MAAM,EAAE,OAAO,EAAE,QAAQ,IAAI,KAAK;YAClC,MAAM,EAAE,qBAAmB;YAC3B,OAAO,EAAE,CAAC,sBAAS,CAAC;YACpB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,sBAAe;oBACxB,QAAQ,EAAE,qDAAwB;iBACnC;gBACD,6CAAoB;aACrB;YACD,OAAO,EAAE,CAAC,6CAAoB,CAAC;SAChC,CAAC;IACJ,CAAC;CACF,CAAA;AAlBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,mBAAmB,CAkB/B"}
@@ -1,7 +1,6 @@
1
1
  import { ClsService } from 'nestjs-cls';
2
2
  export declare class CorrelationIdService {
3
3
  private readonly clsService;
4
- private readonly logger;
5
4
  constructor(clsService: ClsService);
6
5
  get correlationId(): string;
7
6
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC,qBACa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD,IAAI,aAAa,IAAI,MAAM,CAI1B;CACF"}
@@ -8,16 +8,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var CorrelationIdService_1;
12
11
  Object.defineProperty(exports, "__esModule", { value: true });
13
12
  exports.CorrelationIdService = void 0;
14
13
  const common_1 = require("@nestjs/common");
15
14
  const crypto_1 = require("crypto");
16
15
  const nestjs_cls_1 = require("nestjs-cls");
17
16
  const correlation_id_constant_1 = require("./correlation-id.constant");
18
- let CorrelationIdService = CorrelationIdService_1 = class CorrelationIdService {
17
+ let CorrelationIdService = class CorrelationIdService {
19
18
  clsService;
20
- logger = new common_1.Logger(CorrelationIdService_1.name);
21
19
  constructor(clsService) {
22
20
  this.clsService = clsService;
23
21
  }
@@ -26,7 +24,7 @@ let CorrelationIdService = CorrelationIdService_1 = class CorrelationIdService {
26
24
  }
27
25
  };
28
26
  exports.CorrelationIdService = CorrelationIdService;
29
- exports.CorrelationIdService = CorrelationIdService = CorrelationIdService_1 = __decorate([
27
+ exports.CorrelationIdService = CorrelationIdService = __decorate([
30
28
  (0, common_1.Injectable)(),
31
29
  __metadata("design:paramtypes", [nestjs_cls_1.ClsService])
32
30
  ], CorrelationIdService);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.service.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/correlation-id.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mCAAoC;AACpC,2CAAwC;AAExC,uEAAmE;AAG5D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACF;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD,IAAI,aAAa;QACf,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,gDAAsB,CAAC,IAAI,IAAA,mBAAU,GAAE,CAC5D,CAAC;IACJ,CAAC;CACF,CAAA;AARY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE8B,uBAAU;GADxC,oBAAoB,CAQhC"}
@@ -1,5 +1,5 @@
1
1
  export * from './correlation-id.constant';
2
+ export * from './correlation-id.interface';
2
3
  export * from './correlation-id.module';
3
4
  export * from './correlation-id.service';
4
- export * from './correlation-id.type';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/correlation-id/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC"}
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./correlation-id.constant"), exports);
18
+ __exportStar(require("./correlation-id.interface"), exports);
18
19
  __exportStar(require("./correlation-id.module"), exports);
19
20
  __exportStar(require("./correlation-id.service"), exports);
20
- __exportStar(require("./correlation-id.type"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/correlation-id/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C;AAC3C,0DAAwC;AACxC,2DAAyC"}
@@ -0,0 +1,3 @@
1
+ export * from './correlation-id';
2
+ export * from './logger';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,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("./correlation-id"), exports);
18
+ __exportStar(require("./logger"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,2CAAyB"}
@@ -0,0 +1,7 @@
1
+ import type { Format } from 'logform';
2
+ /**
3
+ * Custom Winston format that extracts correlationId and extra metadata from metadata
4
+ * and formats them for PLAIN_TEXT mode output.
5
+ */
6
+ export declare const correlationIdFormat: Format;
7
+ //# sourceMappingURL=correlation-id.format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-id.format.d.ts","sourceRoot":"","sources":["../../../../src/modules/logger/correlation-id.format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAsC9B,CAAC"}