@middy/input-output-logger 5.0.2 → 5.1.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.
Files changed (2) hide show
  1. package/index.js +2 -8
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -27,8 +27,7 @@ const inputOutputLoggerMiddleware = (opts = {})=>{
27
27
  }
28
28
  let cloneMessage = message;
29
29
  if (omitPaths.length) {
30
- cloneMessage = structuredClone(message, replacer) // Full clone to prevent nested mutations
31
- ;
30
+ cloneMessage = structuredClone(message, replacer);
32
31
  omit(cloneMessage, {
33
32
  [param]: omitPathTree[param]
34
33
  });
@@ -66,7 +65,6 @@ const inputOutputLoggerMiddleware = (opts = {})=>{
66
65
  onError: inputOutputLoggerMiddlewareOnError
67
66
  };
68
67
  };
69
- // https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
70
68
  const awsContextKeys = [
71
69
  'functionName',
72
70
  'functionVersion',
@@ -79,11 +77,9 @@ const awsContextKeys = [
79
77
  'clientContext',
80
78
  'callbackWaitsForEmptyEventLoop'
81
79
  ];
82
- // move to util, if ever used elsewhere
83
80
  const pick = (originalObject = {}, keysToPick = [])=>{
84
81
  const newObject = {};
85
82
  for (const path of keysToPick){
86
- // only supports first level
87
83
  if (originalObject[path] !== undefined) {
88
84
  newObject[path] = originalObject[path];
89
85
  }
@@ -93,11 +89,9 @@ const pick = (originalObject = {}, keysToPick = [])=>{
93
89
  const buildPathTree = (paths)=>{
94
90
  const tree = {};
95
91
  for (let path of paths.sort().reverse()){
96
- // reverse to ensure conflicting paths don't cause issues
97
92
  if (!Array.isArray(path)) path = path.split('.');
98
93
  if (path.includes('__proto__')) continue;
99
- path.slice(0) // clone
100
- .reduce((a, b, idx)=>{
94
+ path.slice(0).reduce((a, b, idx)=>{
101
95
  if (idx < path.length - 1) {
102
96
  a[b] ??= {};
103
97
  return a[b];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/input-output-logger",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "Input and output logger middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,8 +60,8 @@
60
60
  "url": "https://github.com/sponsors/willfarrell"
61
61
  },
62
62
  "devDependencies": {
63
- "@middy/core": "5.0.2",
63
+ "@middy/core": "5.1.0",
64
64
  "@types/node": "^20.0.0"
65
65
  },
66
- "gitHead": "6d17e155237022f2a0abd095ac7cd99ebfc7fc71"
66
+ "gitHead": "bbdaf5843914921804ba085dd58117273febe6b5"
67
67
  }