@evanion/nestjs-correlation-id 1.0.3 → 1.0.4

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.
package/README.md CHANGED
@@ -84,10 +84,10 @@ In order to add the correlation ID to your logs, you can use the `CorrelationSer
84
84
  In the following example, we are using the [@ntegral/nestjs-sentry](https://github.com/ntegral/nestjs-sentry) package, but you can use any package or provider you like.
85
85
 
86
86
  ```ts
87
- import { Injectable, NestMiddleware } from '@nestjs/common';
88
- import { Request, Response } from 'express';
89
87
  import { CorrelationService } from '@evanion/nestjs-correlation-id';
88
+ import { Injectable, NestMiddleware } from '@nestjs/common';
90
89
  import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry';
90
+ import { NextFunction, Request, Response } from 'express';
91
91
 
92
92
  @Injectable()
93
93
  export class SentryMiddleware implements NestMiddleware {
@@ -96,9 +96,9 @@ export class SentryMiddleware implements NestMiddleware {
96
96
  @InjectSentry() private readonly sentryService: SentryService,
97
97
  ) {}
98
98
 
99
- async use(req: Request, res: Response, next) {
99
+ async use(_req: Request, _res: Response, next: NextFunction) {
100
100
  const correlationId = await this.correlationService.getCorrelationId();
101
- this.sentryService.configureScope((scope) => {
101
+ this.sentryService.instance().configureScope((scope) => {
102
102
  scope.setTag('correlationId', correlationId);
103
103
  });
104
104
  next();
@@ -110,15 +110,9 @@ Then add it to your `AppModule`
110
110
 
111
111
  ```ts
112
112
  import { Module } from '@nestjs-common';
113
- import {
114
- SentryModule,
115
- ConfigModule,
116
- ConfigService,
117
- } from '@ntegral/nestjs-sentry';
118
- import {
119
- CorrelationModule,
120
- CorrelationService,
121
- } from '@evanion/nestjs-correlation-id';
113
+ import { SentryModule } from '@ntegral/nestjs-sentry';
114
+ import { CorrelationModule } from '@evanion/nestjs-correlation-id';
115
+ import { SentryMiddleware } from './middleware/sentry.middleware';
122
116
 
123
117
  @Module({
124
118
  imports: [
@@ -134,8 +128,6 @@ export class AppModule implements NestModule {
134
128
  consumer.apply(SentryMiddleware).forRoutes('*');
135
129
  }
136
130
  }
137
- {
138
- }
139
131
  ```
140
132
 
141
133
  If you need to manually set the correlationId anywhere in your application. You can use the `CorrelationService` service to set the correlationId.
@@ -6,6 +6,25 @@ export declare const withCorrelation: (config?: HttpModuleOptions) => {
6
6
  useFactory: (correlationService: CorrelationService) => Promise<{
7
7
  headers: {
8
8
  "X-Correlation-Id": string;
9
+ } | {
10
+ "X-Correlation-Id": string;
11
+ Accept?: import("axios").AxiosHeaderValue;
12
+ "Content-Length"?: import("axios").AxiosHeaderValue;
13
+ "User-Agent"?: import("axios").AxiosHeaderValue;
14
+ "Content-Encoding"?: import("axios").AxiosHeaderValue;
15
+ Authorization?: import("axios").AxiosHeaderValue;
16
+ 'Content-Type'?: import("axios").AxiosHeaderValue;
17
+ link?: import("axios").AxiosHeaders;
18
+ head?: import("axios").AxiosHeaders;
19
+ options?: import("axios").AxiosHeaders;
20
+ get?: import("axios").AxiosHeaders;
21
+ post?: import("axios").AxiosHeaders;
22
+ put?: import("axios").AxiosHeaders;
23
+ delete?: import("axios").AxiosHeaders;
24
+ patch?: import("axios").AxiosHeaders;
25
+ purge?: import("axios").AxiosHeaders;
26
+ unlink?: import("axios").AxiosHeaders;
27
+ common?: import("axios").AxiosHeaders;
9
28
  };
10
29
  url?: string;
11
30
  method?: string;
@@ -13,38 +32,43 @@ export declare const withCorrelation: (config?: HttpModuleOptions) => {
13
32
  transformRequest?: import("axios").AxiosRequestTransformer | import("axios").AxiosRequestTransformer[];
14
33
  transformResponse?: import("axios").AxiosResponseTransformer | import("axios").AxiosResponseTransformer[];
15
34
  params?: any;
16
- paramsSerializer?: (params: any) => string;
35
+ paramsSerializer?: import("axios").CustomParamsSerializer | import("axios").ParamsSerializerOptions;
17
36
  data?: any;
18
37
  timeout?: number;
19
38
  timeoutErrorMessage?: string;
20
39
  withCredentials?: boolean;
21
- adapter?: import("axios").AxiosAdapter;
40
+ adapter?: (string | import("axios").AxiosAdapter) | (string | import("axios").AxiosAdapter)[];
22
41
  auth?: import("axios").AxiosBasicCredentials;
23
42
  responseType?: import("axios").ResponseType;
24
43
  responseEncoding?: string;
25
44
  xsrfCookieName?: string;
26
45
  xsrfHeaderName?: string;
27
- onUploadProgress?: (progressEvent: any) => void;
28
- onDownloadProgress?: (progressEvent: any) => void;
46
+ onUploadProgress?: (progressEvent: import("axios").AxiosProgressEvent) => void;
47
+ onDownloadProgress?: (progressEvent: import("axios").AxiosProgressEvent) => void;
29
48
  maxContentLength?: number;
30
49
  validateStatus?: (status: number) => boolean;
31
50
  maxBodyLength?: number;
32
51
  maxRedirects?: number;
52
+ maxRate?: number | [number, number];
33
53
  beforeRedirect?: (options: Record<string, any>, responseDetails: {
34
54
  headers: Record<string, string>;
35
55
  }) => void;
36
56
  socketPath?: string;
57
+ transport?: any;
37
58
  httpAgent?: any;
38
59
  httpsAgent?: any;
39
60
  proxy?: false | import("axios").AxiosProxyConfig;
40
61
  cancelToken?: import("axios").CancelToken;
41
62
  decompress?: boolean;
42
63
  transitional?: import("axios").TransitionalOptions;
43
- signal?: AbortSignal;
64
+ signal?: import("axios").GenericAbortSignal;
44
65
  insecureHTTPParser?: boolean;
45
66
  env?: {
46
67
  FormData?: new (...args: any[]) => object;
47
68
  };
69
+ formSerializer?: import("axios").FormSerializerOptions;
70
+ family?: 4 | 6;
71
+ lookup?: ((hostname: string, options: object, cb: (err: Error, address: string, family: number) => void) => void) | ((hostname: string, options: object) => Promise<string | [address: string, family: number]>);
48
72
  }>;
49
73
  inject: (typeof CorrelationService)[];
50
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanion/nestjs-correlation-id",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Transparently forward or add correlation id to all requests",
5
5
  "author": "Mikael Pettersson <evanion@icloud.com>",
6
6
  "license": "MIT",
@@ -41,34 +41,38 @@
41
41
  },
42
42
  "bugs": "https://github.com/evanion/nestjs-correlation-id/issues",
43
43
  "peerDependencies": {
44
- "@nestjs/axios": "^0.1.0",
45
- "@nestjs/common": "^6.0.0"
44
+ "@nestjs/axios": "^0.1.0 || ^1.0.0 || ^2.0.0",
45
+ "@nestjs/common": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0"
46
+ },
47
+ "dependencies": {
48
+ "uuid": "^9.0.0"
46
49
  },
47
50
  "devDependencies": {
48
- "@nestjs/axios": "^0.1.0",
49
- "@nestjs/common": "^9.0.1",
50
- "@nestjs/core": "^9.0.1",
51
- "@nestjs/platform-express": "^9.0.1",
52
- "@nestjs/testing": "9.0.1",
53
- "@types/express": "4.17.13",
54
- "@types/jest": "28.1.4",
55
- "@types/node": "18.0.3",
51
+ "@nestjs/axios": "^2.0.0",
52
+ "@nestjs/common": "^9.4.1",
53
+ "@nestjs/core": "^9.4.1",
54
+ "@nestjs/platform-express": "^9.4.1",
55
+ "@nestjs/testing": "9.4.1",
56
+ "@types/express": "4.17.17",
57
+ "@types/jest": "29.5.1",
56
58
  "@types/supertest": "2.0.12",
57
- "@typescript-eslint/eslint-plugin": "^5.30.5",
58
- "@typescript-eslint/parser": "^5.30.5",
59
- "eslint": "^8.19.0",
60
- "eslint-config-prettier": "^8.5.0",
59
+ "@typescript-eslint/eslint-plugin": "^5.59.6",
60
+ "@typescript-eslint/parser": "^5.59.6",
61
+ "axios": "^1.4.0",
62
+ "eslint": "^8.41.0",
63
+ "eslint-config-prettier": "^8.8.0",
61
64
  "eslint-plugin-prettier": "^4.2.1",
62
- "jest": "28.1.2",
63
- "prettier": "^2.7.1",
65
+ "jest": "29.5.0",
66
+ "prettier": "^2.8.8",
64
67
  "reflect-metadata": "^0.1.13",
65
- "release-it": "^15.1.1",
66
- "rxjs": "^7.5.5",
67
- "supertest": "6.2.4",
68
- "ts-jest": "28.0.5",
69
- "ts-node": "10.8.2",
70
- "tsc-watch": "5.0.3",
71
- "tsconfig-paths": "4.0.0",
72
- "typescript": "4.7.4"
68
+ "release-it": "^15.10.3",
69
+ "rxjs": "^7.8.1",
70
+ "supertest": "6.3.3",
71
+ "ts-jest": "29.1.0",
72
+ "ts-node": "10.9.1",
73
+ "tsc-watch": "6.0.4",
74
+ "tsconfig-paths": "4.2.0",
75
+ "typescript": "5.0.4",
76
+ "uuid": "^9.0.0"
73
77
  }
74
78
  }