@hz-9/a5-log-pino 0.2.0-alpha.6 → 0.2.0-alpha.60
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.
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.A5PinoLoggerMiddleware = void 0;
|
|
19
|
-
const
|
|
19
|
+
const a5_core_1 = require("@hz-9/a5-core");
|
|
20
20
|
const common_1 = require("@nestjs/common");
|
|
21
21
|
const pino_1 = require("pino");
|
|
22
22
|
const pino_http_1 = __importDefault(require("pino-http"));
|
|
@@ -45,9 +45,11 @@ let A5PinoLoggerMiddleware = class A5PinoLoggerMiddleware {
|
|
|
45
45
|
// Define a custom request id function
|
|
46
46
|
genReqId: (req, res) => {
|
|
47
47
|
const existingID = req.id ?? req.headers['x-request-id'];
|
|
48
|
-
if (existingID)
|
|
48
|
+
if (existingID) {
|
|
49
|
+
res.setHeader('X-Request-Id', existingID);
|
|
49
50
|
return existingID;
|
|
50
|
-
|
|
51
|
+
}
|
|
52
|
+
const id = a5_core_1.A5RandomUtil.nanoid();
|
|
51
53
|
res.setHeader('X-Request-Id', id);
|
|
52
54
|
return id;
|
|
53
55
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hz-9/a5-log-pino",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.60",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nest",
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
"require": "./dist/index.js",
|
|
26
26
|
"types": "./dist/index.d.ts"
|
|
27
27
|
},
|
|
28
|
-
"./*":
|
|
28
|
+
"./*": {
|
|
29
|
+
"require": "./dist/*.js",
|
|
30
|
+
"types": "./dist/*.d.ts"
|
|
31
|
+
}
|
|
29
32
|
},
|
|
30
33
|
"main": "./dist/index.js",
|
|
31
34
|
"types": "./dist/index.d.ts",
|
|
@@ -56,14 +59,14 @@
|
|
|
56
59
|
"@types/supertest": "~6.0.2",
|
|
57
60
|
"supertest": "~7.0.0",
|
|
58
61
|
"@hz-9/heft-nest-rig": "0.1.2",
|
|
59
|
-
"@hz-9/a5-core": "0.2.0-alpha.
|
|
62
|
+
"@hz-9/a5-core": "0.2.0-alpha.60"
|
|
60
63
|
},
|
|
61
64
|
"peerDependencies": {
|
|
62
65
|
"@nestjs/common": "^10.0.0",
|
|
63
66
|
"@nestjs/core": "^10.0.0",
|
|
64
67
|
"reflect-metadata": "^0.1.13",
|
|
65
68
|
"rxjs": "^7.8.1",
|
|
66
|
-
"@hz-9/a5-core": "0.2.0-alpha.
|
|
69
|
+
"@hz-9/a5-core": "0.2.0-alpha.60"
|
|
67
70
|
},
|
|
68
71
|
"publishConfig": {
|
|
69
72
|
"access": "public"
|