@middy/input-output-logger 7.3.0 → 7.3.2
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.js +21 -16
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -21,11 +21,15 @@ const defaults = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const optionSchema = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
logger: { oneOf: [{ instanceof: "Function" }, { const: false }] },
|
|
27
|
+
executionContext: { type: "boolean" },
|
|
28
|
+
lambdaContext: { type: "boolean" },
|
|
29
|
+
omitPaths: { type: "array", items: { type: "string" } },
|
|
30
|
+
mask: { type: "string" },
|
|
31
|
+
},
|
|
32
|
+
additionalProperties: false,
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
export const inputOutputLoggerValidateOptions = (options) =>
|
|
@@ -37,14 +41,6 @@ const inputOutputLoggerMiddleware = (opts = {}) => {
|
|
|
37
41
|
...opts,
|
|
38
42
|
};
|
|
39
43
|
|
|
40
|
-
if (typeof logger !== "function") {
|
|
41
|
-
throw new Error("logger must be a function", {
|
|
42
|
-
cause: {
|
|
43
|
-
package: "@middy/input-output-logger",
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
const omitPathTree = buildPathTree(omitPaths);
|
|
49
45
|
// needs `omitPathTree`, `logger`
|
|
50
46
|
const omitAndLog = (param, request) => {
|
|
@@ -131,9 +127,18 @@ const inputOutputLoggerMiddleware = (opts = {}) => {
|
|
|
131
127
|
};
|
|
132
128
|
|
|
133
129
|
return {
|
|
134
|
-
before:
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
before:
|
|
131
|
+
typeof logger === "function"
|
|
132
|
+
? inputOutputLoggerMiddlewareBefore
|
|
133
|
+
: undefined,
|
|
134
|
+
after:
|
|
135
|
+
typeof logger === "function"
|
|
136
|
+
? inputOutputLoggerMiddlewareAfter
|
|
137
|
+
: undefined,
|
|
138
|
+
onError:
|
|
139
|
+
typeof logger === "function"
|
|
140
|
+
? inputOutputLoggerMiddlewareOnError
|
|
141
|
+
: undefined,
|
|
137
142
|
};
|
|
138
143
|
};
|
|
139
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/input-output-logger",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "Input and output logger middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"url": "https://github.com/sponsors/willfarrell"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@middy/util": "7.3.
|
|
65
|
+
"@middy/util": "7.3.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@datastream/core": "0.
|
|
69
|
-
"@middy/core": "7.3.
|
|
68
|
+
"@datastream/core": "0.4.0",
|
|
69
|
+
"@middy/core": "7.3.2",
|
|
70
70
|
"@types/aws-lambda": "^8.0.0",
|
|
71
71
|
"@types/node": "^22.0.0"
|
|
72
72
|
}
|