@nimee/initialize-ms 0.0.7 → 0.0.9
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/dist/src/fastify.js +3 -2
- package/dist/src/fastify.js.map +1 -1
- package/package.json +2 -2
- package/src/fastify.ts +3 -2
package/dist/src/fastify.js
CHANGED
|
@@ -15,7 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const fastify_1 = __importDefault(require("fastify"));
|
|
16
16
|
const logger_1 = __importDefault(require("@nimee/logger"));
|
|
17
17
|
const request_context_1 = __importDefault(require("@fastify/request-context"));
|
|
18
|
-
const
|
|
18
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
19
|
+
const uuid = crypto_1.default.randomUUID();
|
|
19
20
|
class ServerInitializerFastify {
|
|
20
21
|
initialize(serviceName) {
|
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -25,7 +26,7 @@ class ServerInitializerFastify {
|
|
|
25
26
|
requestIdLogLabel: "reqId",
|
|
26
27
|
genReqId(req) {
|
|
27
28
|
// you get access to the req here if you need it - must be a synchronous function
|
|
28
|
-
return
|
|
29
|
+
return uuid;
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
32
|
this.server.register(require("@fastify/cors"), {
|
package/dist/src/fastify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../../src/fastify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAAkD;AAClD,2DAAmC;AACnC,+EAAmE;AACnE
|
|
1
|
+
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../../src/fastify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAAkD;AAClD,2DAAmC;AACnC,+EAAmE;AACnE,oDAA4B;AAC5B,MAAM,IAAI,GAAG,gBAAM,CAAC,UAAU,EAAE,CAAC;AAQjC,MAAM,wBAAwB;IAEtB,U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wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimee/initialize-ms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "init behavior for each ms",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"author": "dan goldberg",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@fastify/request-context": "^4.2.0",
|
|
31
31
|
"@fastify/swagger": "^8.1.0",
|
|
32
32
|
"@nimee/error-handler": "0.0.4",
|
|
33
|
+
"@nimee/health": "2.1.1",
|
|
33
34
|
"@nimee/logger": "1.0.21",
|
|
34
35
|
"@nimee/metrics": "2.0.12",
|
|
35
|
-
"@nimee/health": "2.1.1",
|
|
36
36
|
"fastify": "^4.6.0",
|
|
37
37
|
"mongoose": "6.2.10"
|
|
38
38
|
}
|
package/src/fastify.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Fastify, { FastifyRequest } from "fastify";
|
|
2
2
|
import logger from "@nimee/logger";
|
|
3
3
|
import fastifyRequestContextPlugin from "@fastify/request-context";
|
|
4
|
-
import
|
|
4
|
+
import crypto from "crypto";
|
|
5
|
+
const uuid = crypto.randomUUID();
|
|
5
6
|
|
|
6
7
|
declare module "@fastify/request-context" {
|
|
7
8
|
interface RequestContextData {
|
|
@@ -18,7 +19,7 @@ class ServerInitializerFastify {
|
|
|
18
19
|
requestIdLogLabel: "reqId",
|
|
19
20
|
genReqId(req: FastifyRequest) {
|
|
20
21
|
// you get access to the req here if you need it - must be a synchronous function
|
|
21
|
-
return uuid
|
|
22
|
+
return uuid;
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
|