@autofleet/node-common 1.3.1 → 1.3.3

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/logger/index.js CHANGED
@@ -1,7 +1,4 @@
1
1
  const winston = require('winston');
2
- const { LoggingWinston } = require('@google-cloud/logging-winston');
3
-
4
- const loggingWinston = new LoggingWinston();
5
2
 
6
3
  const { createLogger } = winston;
7
4
  require('dotenv').config();
@@ -57,10 +54,6 @@ const getFormat = () => {
57
54
  const createLoggerInstance = (level, exceptionHandlers) => {
58
55
  const transports = [new winston.transports.Console()];
59
56
 
60
- if (process.env.AF_SERVICE_NAME) {
61
- transports.push(loggingWinston);
62
- }
63
-
64
57
  const logger = createLogger({
65
58
  level,
66
59
  format: getFormat(),
@@ -84,7 +77,6 @@ const createLoggerInstance = (level, exceptionHandlers) => {
84
77
  },
85
78
  });
86
79
  };
87
-
88
80
  if (env.NODE_ENV !== 'production') {
89
81
  logger.httpMorganInfo = undefined;
90
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/node-common",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "coverage": "jest --coverage --forceExit --runInBand",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "homepage": "https://github.com/Autofleet/node-common",
25
25
  "dependencies": {
26
- "@google-cloud/logging-winston": "^2.0.1",
26
+ "@google-cloud/logging-winston": "^0.10.2",
27
27
  "@google-cloud/pubsub": "^0.20.1",
28
28
  "axios": "^0.18.0",
29
29
  "axios-retry": "^3.1.0",
@@ -38,7 +38,7 @@
38
38
  "qs": "^6.5.2",
39
39
  "timekeeper": "^2.1.2",
40
40
  "weak": "^1.0.1",
41
- "winston": "^3.2.1",
41
+ "winston": "^3.0.0",
42
42
  "ws": "^5.2.1"
43
43
  },
44
44
  "devDependencies": {
package/router/index.js CHANGED
@@ -17,17 +17,11 @@ const AfEntryPoint = func => async (req, res, next) => {
17
17
  try {
18
18
  await func(req, res, next);
19
19
  } catch (e) {
20
- if(e.array) {
21
- logger.error('Validation error', e.array())
22
- res.status(422);
23
- res.json({
24
- validationErrors: e.array(),
25
- })
26
- next();
27
- } else {
28
- logger.error(e)
29
- next(e);
20
+ logger.error(e.message);
21
+ if (e.statusCode && e.statusCode < 500) {
22
+ return res.status(400).json({ error: e.message, status: 'ERROR' });
30
23
  }
24
+ next(e);
31
25
  }
32
26
  };
33
27
 
package/settings/map.js CHANGED
@@ -86,6 +86,13 @@ module.exports = {
86
86
  defaultValue: 15000,
87
87
  context: 'matching',
88
88
  },
89
+ VAAS_PLACEMENT_STRATEGY_NAME: {
90
+ name: 'VaaS Placement Strategy',
91
+ description: 'VaaS Placement Strategy Name',
92
+ type: 'string',
93
+ string: 'min-fleet-cost',
94
+ context: 'placement',
95
+ },
89
96
  MATCHING_MINIMUM_PAID_RATIO: {
90
97
  name: 'Matching min paid/unpaid air distance',
91
98
  description: 'The ratio between paid to unpaid air distance - pre filter',
@@ -395,4 +402,11 @@ module.exports = {
395
402
  defaultValue: 'GBP',
396
403
  context: 'ride',
397
404
  },
405
+ BUFFER: {
406
+ name: 'Buffer around a polygon of a route',
407
+ description: 'The buffer around a polygon of a route to calculate tiled from',
408
+ type: 'number',
409
+ defaultValue: 1,
410
+ context: 'matching',
411
+ },
398
412
  };