@commercetools-backend/loggers 22.7.0 → 22.8.0
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.
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
8
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
5
9
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
10
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
11
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,8 +14,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
14
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
15
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
16
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
-
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
15
17
|
var expressWinston = require('express-winston');
|
|
16
18
|
var winston = require('winston');
|
|
17
19
|
var cloneDeep = require('lodash/cloneDeep');
|
|
@@ -40,6 +42,8 @@ function _interopNamespace(e) {
|
|
|
40
42
|
return Object.freeze(n);
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
46
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
43
47
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
44
48
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
45
49
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -48,7 +52,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
48
52
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
49
53
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
50
54
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
51
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
52
55
|
var expressWinston__default = /*#__PURE__*/_interopDefault(expressWinston);
|
|
53
56
|
var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
|
|
54
57
|
var cloneDeep__default = /*#__PURE__*/_interopDefault(cloneDeep);
|
|
@@ -56,8 +59,16 @@ var getIn__default = /*#__PURE__*/_interopDefault(getIn);
|
|
|
56
59
|
var setIn__default = /*#__PURE__*/_interopDefault(setIn);
|
|
57
60
|
var unsetIn__default = /*#__PURE__*/_interopDefault(unsetIn);
|
|
58
61
|
|
|
59
|
-
function ownKeys(
|
|
60
|
-
function _objectSpread(
|
|
62
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
63
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
64
|
+
const parseIps = request => {
|
|
65
|
+
const forwardedFor = request.headers['x-forwarded-for'];
|
|
66
|
+
if (!forwardedFor) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const remoteAddresses = _Array$isArray__default["default"](forwardedFor) ? forwardedFor : forwardedFor.split(',');
|
|
70
|
+
return remoteAddresses;
|
|
71
|
+
};
|
|
61
72
|
const createAccessLoggerMiddleware = function () {
|
|
62
73
|
var _options$ignoreUrls, _options$formatters, _options$level;
|
|
63
74
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -72,13 +83,20 @@ const createAccessLoggerMiddleware = function () {
|
|
|
72
83
|
// Use default morgan access log formatting
|
|
73
84
|
colorize: !options.json,
|
|
74
85
|
skip: req => Boolean(options.silent) || _includesInstanceProperty__default["default"](ignoreUrls).call(ignoreUrls, req.originalUrl),
|
|
75
|
-
dynamicMeta: req =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
dynamicMeta: req => {
|
|
87
|
+
var _req$socket;
|
|
88
|
+
const remoteAddress = (_req$socket = req.socket) === null || _req$socket === void 0 ? void 0 : _req$socket.remoteAddress;
|
|
89
|
+
const proxyIps = parseIps(req);
|
|
90
|
+
const _proxyIps = _slicedToArray(proxyIps, 1),
|
|
91
|
+
clientIp = _proxyIps[0];
|
|
92
|
+
return _objectSpread({
|
|
93
|
+
clientIp: clientIp !== null && clientIp !== void 0 ? clientIp : remoteAddress,
|
|
94
|
+
proxyIps,
|
|
95
|
+
hostname: req.hostname
|
|
96
|
+
}, remoteAddress ? {
|
|
97
|
+
remoteAddress
|
|
98
|
+
} : {});
|
|
99
|
+
}
|
|
82
100
|
});
|
|
83
101
|
};
|
|
84
102
|
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
8
|
+
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
5
9
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
10
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
11
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,8 +14,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
14
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
15
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
16
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
-
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
15
17
|
var expressWinston = require('express-winston');
|
|
16
18
|
var winston = require('winston');
|
|
17
19
|
var cloneDeep = require('lodash/cloneDeep');
|
|
@@ -40,6 +42,8 @@ function _interopNamespace(e) {
|
|
|
40
42
|
return Object.freeze(n);
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
46
|
+
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
43
47
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
44
48
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
45
49
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -48,7 +52,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
48
52
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
49
53
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
50
54
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
51
|
-
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
52
55
|
var expressWinston__default = /*#__PURE__*/_interopDefault(expressWinston);
|
|
53
56
|
var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
|
|
54
57
|
var cloneDeep__default = /*#__PURE__*/_interopDefault(cloneDeep);
|
|
@@ -56,8 +59,16 @@ var getIn__default = /*#__PURE__*/_interopDefault(getIn);
|
|
|
56
59
|
var setIn__default = /*#__PURE__*/_interopDefault(setIn);
|
|
57
60
|
var unsetIn__default = /*#__PURE__*/_interopDefault(unsetIn);
|
|
58
61
|
|
|
59
|
-
function ownKeys(
|
|
60
|
-
function _objectSpread(
|
|
62
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
63
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
64
|
+
const parseIps = request => {
|
|
65
|
+
const forwardedFor = request.headers['x-forwarded-for'];
|
|
66
|
+
if (!forwardedFor) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const remoteAddresses = _Array$isArray__default["default"](forwardedFor) ? forwardedFor : forwardedFor.split(',');
|
|
70
|
+
return remoteAddresses;
|
|
71
|
+
};
|
|
61
72
|
const createAccessLoggerMiddleware = function () {
|
|
62
73
|
var _options$ignoreUrls, _options$formatters, _options$level;
|
|
63
74
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -72,13 +83,20 @@ const createAccessLoggerMiddleware = function () {
|
|
|
72
83
|
// Use default morgan access log formatting
|
|
73
84
|
colorize: !options.json,
|
|
74
85
|
skip: req => Boolean(options.silent) || _includesInstanceProperty__default["default"](ignoreUrls).call(ignoreUrls, req.originalUrl),
|
|
75
|
-
dynamicMeta: req =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
dynamicMeta: req => {
|
|
87
|
+
var _req$socket;
|
|
88
|
+
const remoteAddress = (_req$socket = req.socket) === null || _req$socket === void 0 ? void 0 : _req$socket.remoteAddress;
|
|
89
|
+
const proxyIps = parseIps(req);
|
|
90
|
+
const _proxyIps = _slicedToArray(proxyIps, 1),
|
|
91
|
+
clientIp = _proxyIps[0];
|
|
92
|
+
return _objectSpread({
|
|
93
|
+
clientIp: clientIp !== null && clientIp !== void 0 ? clientIp : remoteAddress,
|
|
94
|
+
proxyIps,
|
|
95
|
+
hostname: req.hostname
|
|
96
|
+
}, remoteAddress ? {
|
|
97
|
+
remoteAddress
|
|
98
|
+
} : {});
|
|
99
|
+
}
|
|
82
100
|
});
|
|
83
101
|
};
|
|
84
102
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
3
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
4
|
+
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
1
5
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
6
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
7
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -6,8 +10,6 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
6
10
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
11
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
12
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
-
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
11
13
|
import expressWinston from 'express-winston';
|
|
12
14
|
import * as winston from 'winston';
|
|
13
15
|
import winston__default from 'winston';
|
|
@@ -17,8 +19,16 @@ import setIn from 'lodash/set';
|
|
|
17
19
|
import unsetIn from 'lodash/unset';
|
|
18
20
|
import { format } from 'logform';
|
|
19
21
|
|
|
20
|
-
function ownKeys(
|
|
21
|
-
function _objectSpread(
|
|
22
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
const parseIps = request => {
|
|
25
|
+
const forwardedFor = request.headers['x-forwarded-for'];
|
|
26
|
+
if (!forwardedFor) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const remoteAddresses = _Array$isArray(forwardedFor) ? forwardedFor : forwardedFor.split(',');
|
|
30
|
+
return remoteAddresses;
|
|
31
|
+
};
|
|
22
32
|
const createAccessLoggerMiddleware = function () {
|
|
23
33
|
var _options$ignoreUrls, _options$formatters, _options$level;
|
|
24
34
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -33,13 +43,20 @@ const createAccessLoggerMiddleware = function () {
|
|
|
33
43
|
// Use default morgan access log formatting
|
|
34
44
|
colorize: !options.json,
|
|
35
45
|
skip: req => Boolean(options.silent) || _includesInstanceProperty(ignoreUrls).call(ignoreUrls, req.originalUrl),
|
|
36
|
-
dynamicMeta: req =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
dynamicMeta: req => {
|
|
47
|
+
var _req$socket;
|
|
48
|
+
const remoteAddress = (_req$socket = req.socket) === null || _req$socket === void 0 ? void 0 : _req$socket.remoteAddress;
|
|
49
|
+
const proxyIps = parseIps(req);
|
|
50
|
+
const _proxyIps = _slicedToArray(proxyIps, 1),
|
|
51
|
+
clientIp = _proxyIps[0];
|
|
52
|
+
return _objectSpread({
|
|
53
|
+
clientIp: clientIp !== null && clientIp !== void 0 ? clientIp : remoteAddress,
|
|
54
|
+
proxyIps,
|
|
55
|
+
hostname: req.hostname
|
|
56
|
+
}, remoteAddress ? {
|
|
57
|
+
remoteAddress
|
|
58
|
+
} : {});
|
|
59
|
+
}
|
|
43
60
|
});
|
|
44
61
|
};
|
|
45
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-backend/loggers",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.8.0",
|
|
4
4
|
"description": "Opinionated JSON loggers for HTTP server applications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"README.md"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/runtime": "^7.
|
|
34
|
-
"@babel/runtime-corejs3": "^7.
|
|
33
|
+
"@babel/runtime": "^7.22.15",
|
|
34
|
+
"@babel/runtime-corejs3": "^7.22.15",
|
|
35
35
|
"@sentry/node": "7.64.0",
|
|
36
|
-
"@types/lodash": "^4.14.
|
|
36
|
+
"@types/lodash": "^4.14.198",
|
|
37
37
|
"@types/triple-beam": "1.3.2",
|
|
38
38
|
"express-winston": "4.2.0",
|
|
39
39
|
"fast-safe-stringify": "2.1.1",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"winston": "3.8.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tsconfig/node16": "^16.
|
|
46
|
+
"@tsconfig/node16": "^16.1.1",
|
|
47
|
+
"@types/express": "^4.17.17",
|
|
47
48
|
"express": "4.18.2"
|
|
48
49
|
}
|
|
49
50
|
}
|