@nest-boot/graphql 5.13.1 → 5.13.2
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.
|
@@ -17,9 +17,6 @@ exports.LoggingPlugin = void 0;
|
|
|
17
17
|
const logger_1 = require("@nest-boot/logger");
|
|
18
18
|
const apollo_1 = require("@nestjs/apollo");
|
|
19
19
|
const common_1 = require("@nestjs/common");
|
|
20
|
-
function durationHrTimeToNanos(hrtime) {
|
|
21
|
-
return hrtime[0] * 1e9 + hrtime[1];
|
|
22
|
-
}
|
|
23
20
|
let LoggingPlugin = class LoggingPlugin {
|
|
24
21
|
constructor(logger) {
|
|
25
22
|
this.logger = logger;
|
|
@@ -27,7 +24,7 @@ let LoggingPlugin = class LoggingPlugin {
|
|
|
27
24
|
async requestDidStart() {
|
|
28
25
|
const logger = this.logger;
|
|
29
26
|
if (typeof logger !== "undefined") {
|
|
30
|
-
const
|
|
27
|
+
const startTime = Date.now();
|
|
31
28
|
return {
|
|
32
29
|
didResolveOperation: async (ctx) => {
|
|
33
30
|
logger.assign({
|
|
@@ -39,18 +36,18 @@ let LoggingPlugin = class LoggingPlugin {
|
|
|
39
36
|
});
|
|
40
37
|
},
|
|
41
38
|
willSendResponse: async ({ response, errors }) => {
|
|
42
|
-
const
|
|
39
|
+
const responseTime = Date.now() - startTime;
|
|
43
40
|
if (response.body.kind === "incremental") {
|
|
44
41
|
return;
|
|
45
42
|
}
|
|
46
43
|
if (typeof errors !== "undefined" && errors.length > 0) {
|
|
47
44
|
logger.error("graphql request errored", {
|
|
48
|
-
|
|
45
|
+
responseTime,
|
|
49
46
|
});
|
|
50
47
|
}
|
|
51
48
|
else {
|
|
52
49
|
logger.log("graphql request completed", {
|
|
53
|
-
|
|
50
|
+
responseTime,
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
53
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.plugin.js","sourceRoot":"","sources":["../../src/plugins/logging.plugin.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;AAOrD,8CAA2C;AAC3C,2CAAwC;AACxC,2CAA0C;
|
|
1
|
+
{"version":3,"file":"logging.plugin.js","sourceRoot":"","sources":["../../src/plugins/logging.plugin.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;AAOrD,8CAA2C;AAC3C,2CAAwC;AACxC,2CAA0C;AAGnC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAC/B,CAAC;IAEJ,KAAK,CAAC,eAAe;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAE7B,OAAO;gBACL,mBAAmB,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;oBACjC,MAAM,CAAC,MAAM,CAAC;wBACZ,SAAS,EAAE;4BACT,EAAE,EAAE,GAAG,CAAC,SAAS;4BACjB,IAAI,EAAE,GAAG,CAAC,aAAa;4BACvB,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE;yBAC9C;qBACF,CAAC,CAAC;gBACL,CAAC;gBACD,gBAAgB,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;oBAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;oBAE5C,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE;wBACxC,OAAO;qBACR;oBAED,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;wBACtD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE;4BACtC,YAAY;yBACb,CAAC,CAAC;qBACJ;yBAAM;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