@middy/input-output-logger 7.2.2 → 7.3.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.
- package/index.d.ts +4 -0
- package/index.js +24 -3
- package/package.json +4 -7
package/index.d.ts
CHANGED
|
@@ -14,4 +14,8 @@ declare function inputOutputLogger(
|
|
|
14
14
|
options?: Options,
|
|
15
15
|
): middy.MiddlewareObj<unknown, unknown, Error>;
|
|
16
16
|
|
|
17
|
+
export declare function inputOutputLoggerValidateOptions(
|
|
18
|
+
options?: Record<string, unknown>,
|
|
19
|
+
): void;
|
|
20
|
+
|
|
17
21
|
export default inputOutputLogger;
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
executionContextKeys,
|
|
8
8
|
isExecutionModeDurable,
|
|
9
9
|
lambdaContextKeys,
|
|
10
|
+
validateOptions,
|
|
10
11
|
} from "@middy/util";
|
|
11
12
|
|
|
12
13
|
const defaults = {
|
|
@@ -19,6 +20,17 @@ const defaults = {
|
|
|
19
20
|
mask: undefined,
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
const optionSchema = {
|
|
24
|
+
logger: "function?",
|
|
25
|
+
executionContext: "boolean?",
|
|
26
|
+
lambdaContext: "boolean?",
|
|
27
|
+
omitPaths: "array?",
|
|
28
|
+
mask: "string?",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const inputOutputLoggerValidateOptions = (options) =>
|
|
32
|
+
validateOptions("@middy/input-output-logger", optionSchema, options);
|
|
33
|
+
|
|
22
34
|
const inputOutputLoggerMiddleware = (opts = {}) => {
|
|
23
35
|
const { logger, executionContext, lambdaContext, omitPaths, mask } = {
|
|
24
36
|
...defaults,
|
|
@@ -145,7 +157,12 @@ const buildPathTree = (paths) => {
|
|
|
145
157
|
for (let path of paths.sort().reverse()) {
|
|
146
158
|
// reverse to ensure conflicting paths don't cause issues
|
|
147
159
|
if (!Array.isArray(path)) path = path.split(".");
|
|
148
|
-
if (
|
|
160
|
+
if (
|
|
161
|
+
path.includes("__proto__") ||
|
|
162
|
+
path.includes("constructor") ||
|
|
163
|
+
path.includes("prototype")
|
|
164
|
+
)
|
|
165
|
+
continue;
|
|
149
166
|
path.reduce((a, b, idx) => {
|
|
150
167
|
if (idx < path.length - 1) {
|
|
151
168
|
a[b] ??= {};
|
|
@@ -179,9 +196,13 @@ const passThrough = (request, omitAndLog) => {
|
|
|
179
196
|
},
|
|
180
197
|
});
|
|
181
198
|
if (hasBody) {
|
|
182
|
-
request.response.body = request.response.body
|
|
199
|
+
request.response.body = request.response.body
|
|
200
|
+
.on("error", (e) => listen.destroy(e))
|
|
201
|
+
.pipe(listen);
|
|
183
202
|
} else {
|
|
184
|
-
request.response = request.response
|
|
203
|
+
request.response = request.response
|
|
204
|
+
.on("error", (e) => listen.destroy(e))
|
|
205
|
+
.pipe(listen);
|
|
185
206
|
}
|
|
186
207
|
};
|
|
187
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/input-output-logger",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Input and output logger middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"import": {
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"default": "./index.js"
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -65,11 +62,11 @@
|
|
|
65
62
|
"url": "https://github.com/sponsors/willfarrell"
|
|
66
63
|
},
|
|
67
64
|
"dependencies": {
|
|
68
|
-
"@middy/util": "7.
|
|
65
|
+
"@middy/util": "7.3.0"
|
|
69
66
|
},
|
|
70
67
|
"devDependencies": {
|
|
71
|
-
"@datastream/core": "0.
|
|
72
|
-
"@middy/core": "7.
|
|
68
|
+
"@datastream/core": "0.3.2",
|
|
69
|
+
"@middy/core": "7.3.0",
|
|
73
70
|
"@types/aws-lambda": "^8.0.0",
|
|
74
71
|
"@types/node": "^22.0.0"
|
|
75
72
|
}
|