@middy/input-output-logger 3.1.0 → 3.2.1
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/index.cjs +9 -7
- package/index.js +2 -2
- package/package.json +6 -5
package/index.cjs
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _util = require("@middy/util");
|
|
7
10
|
var _a, _b;
|
|
8
11
|
const defaults = {
|
|
9
12
|
logger: console.log,
|
|
@@ -20,7 +23,7 @@ const inputOutputLoggerMiddleware = (opts = {})=>{
|
|
|
20
23
|
if (typeof logger !== 'function') {
|
|
21
24
|
throw new Error('[input-output-logger-middleware]: logger must be a function');
|
|
22
25
|
}
|
|
23
|
-
const omitPathTree =
|
|
26
|
+
const omitPathTree = buildPathTree(omitPaths);
|
|
24
27
|
const omitAndLog = (param, request)=>{
|
|
25
28
|
const message = {
|
|
26
29
|
[param]: request[param]
|
|
@@ -28,7 +31,7 @@ const inputOutputLoggerMiddleware = (opts = {})=>{
|
|
|
28
31
|
if (awsContext) {
|
|
29
32
|
message.context = pick(request.context, awsContextKeys);
|
|
30
33
|
}
|
|
31
|
-
const cloneMessage = (0, _util
|
|
34
|
+
const cloneMessage = (0, _util.jsonSafeParse)((0, _util.jsonSafeStringify)(message, replacer));
|
|
32
35
|
omit(cloneMessage, {
|
|
33
36
|
[param]: omitPathTree[param]
|
|
34
37
|
});
|
|
@@ -86,7 +89,7 @@ const pick = (originalObject = {}, keysToPick = [])=>{
|
|
|
86
89
|
}
|
|
87
90
|
return newObject;
|
|
88
91
|
};
|
|
89
|
-
const
|
|
92
|
+
const buildPathTree = (paths)=>{
|
|
90
93
|
const tree = {};
|
|
91
94
|
for (let path of paths.sort().reverse()){
|
|
92
95
|
if (!Array.isArray(path)) path = path.split('.');
|
|
@@ -103,8 +106,7 @@ const buildPathOmitTree = (paths)=>{
|
|
|
103
106
|
return tree;
|
|
104
107
|
};
|
|
105
108
|
const isObject = (value)=>value && typeof value === 'object' && value.constructor === Object;
|
|
106
|
-
|
|
107
|
-
module.exports = _default;
|
|
109
|
+
const _default = inputOutputLoggerMiddleware;
|
|
108
110
|
|
|
109
111
|
|
|
110
112
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const inputOutputLoggerMiddleware = (opts = {})=>{
|
|
|
15
15
|
if (typeof logger !== 'function') {
|
|
16
16
|
throw new Error('[input-output-logger-middleware]: logger must be a function');
|
|
17
17
|
}
|
|
18
|
-
const omitPathTree =
|
|
18
|
+
const omitPathTree = buildPathTree(omitPaths);
|
|
19
19
|
const omitAndLog = (param, request)=>{
|
|
20
20
|
const message = {
|
|
21
21
|
[param]: request[param]
|
|
@@ -81,7 +81,7 @@ const pick = (originalObject = {}, keysToPick = [])=>{
|
|
|
81
81
|
}
|
|
82
82
|
return newObject;
|
|
83
83
|
};
|
|
84
|
-
const
|
|
84
|
+
const buildPathTree = (paths)=>{
|
|
85
85
|
const tree = {};
|
|
86
86
|
for (let path of paths.sort().reverse()){
|
|
87
87
|
if (!Array.isArray(path)) path = path.split('.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/input-output-logger",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Input and output logger middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"main": "./index.cjs",
|
|
14
|
+
"module": "./index.js",
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"import": {
|
|
@@ -61,11 +62,11 @@
|
|
|
61
62
|
},
|
|
62
63
|
"homepage": "https://middy.js.org",
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@middy/util": "3.1
|
|
65
|
+
"@middy/util": "3.2.1"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@middy/core": "3.1
|
|
68
|
-
"@types/node": "^
|
|
68
|
+
"@middy/core": "3.2.1",
|
|
69
|
+
"@types/node": "^18.0.0"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "b4169ec20b798650e934a7c25ee80ae98d11e03a"
|
|
71
72
|
}
|