playov2-js-utilities 0.3.21 → 0.3.22

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/lib/middleware.js CHANGED
@@ -2,21 +2,33 @@
2
2
  const { v4: uuidv4, v4 } = require('uuid');
3
3
  const Logger = require('./logger')
4
4
 
5
- const playoServiceRequestInterceptor = (req, res, next, service = 'microservice-name') => {
5
+ const playoServiceRequestInterceptor = (req, res, next, service = 'microservice-name') => {
6
6
  const id = req.headers["x-request-id"] || uuidv4();
7
7
  const start = Date.now();
8
8
 
9
- Logger.prepareInfoLog(id, { body: req.body, path: req.params, query: req.query, url: req.originalUrl, service }, "Incoming request");
9
+ const requestDetails = {
10
+ method: req.method,
11
+ params: req.params,
12
+ query: req.query,
13
+ url: req.url,
14
+ originalUrl: req.originalUrl,
15
+ service
16
+ };
17
+ if (req.body.length < 1000) {
18
+ requestDetails['body'] = req.body || {};
19
+ }
10
20
 
11
- res.on('finish', function() {
21
+ Logger.prepareInfoLog(id, requestDetails, "Incoming request");
22
+
23
+ res.on('finish', function () {
12
24
  const duration = Date.now() - start;
13
- const status = res.status;
14
- Logger.prepareInfoLog(id, { res, status, duration, service }, "Outgoing request - finish event");
25
+ const status = res.statusCode;
26
+ Logger.prepareInfoLog(id, { res, status, duration, service }, "Outgoing request - finish event");
15
27
  });
16
28
 
17
- res.on('close', function() {
29
+ res.on('close', function () {
18
30
  const duration = Date.now() - start;
19
- const status = res.status;
31
+ const status = res.statusCode;
20
32
  Logger.prepareInfoLog(id, { res, status, duration, service }, "Outgoing request - close event");
21
33
  });
22
34
  next();
@@ -100,7 +100,7 @@ const config = {
100
100
  target: "group",
101
101
  path: "manage",
102
102
  title: "Group Invitation",
103
- type: ["push"],
103
+ type: ["push", "drawer"],
104
104
  buttons: [],
105
105
  android_channel_id: notificationChannels.groups_manage_requests
106
106
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playov2-js-utilities",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Private package for JS utility functions",
5
5
  "main": "index.js",
6
6
  "scripts": {