@middy/input-output-logger 2.5.3 → 3.0.0-alpha.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2021 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
3
+ Copyright (c) 2017-2022 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -98,7 +98,7 @@ Everyone is very welcome to contribute to this repository. Feel free to [raise i
98
98
 
99
99
  ## License
100
100
 
101
- Licensed under [MIT License](LICENSE). Copyright (c) 2017-2021 Luciano Mammino, will Farrell, and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
101
+ Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
102
102
 
103
103
  <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
104
104
  <img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
package/index.js CHANGED
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  const defaults = {
4
2
  logger: data => console.log(JSON.stringify(data, null, 2)),
5
3
  awsContext: false,
@@ -25,8 +23,7 @@ const inputOutputLoggerMiddleware = (opts = {}) => {
25
23
  message.context = pick(request.context, awsContextKeys);
26
24
  }
27
25
 
28
- const redactedMessage = omit(JSON.parse(JSON.stringify(message)), omitPaths); // Full clone to prevent nested mutations
29
-
26
+ const redactedMessage = omit(JSON.parse(JSON.stringify(message)), omitPaths);
30
27
  logger(redactedMessage);
31
28
  };
32
29
 
@@ -40,16 +37,14 @@ const inputOutputLoggerMiddleware = (opts = {}) => {
40
37
  after: logger ? inputOutputLoggerMiddlewareAfter : undefined,
41
38
  onError: logger ? inputOutputLoggerMiddlewareOnError : undefined
42
39
  };
43
- }; // https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
44
-
40
+ };
45
41
 
46
- const awsContextKeys = ['functionName', 'functionVersion', 'invokedFunctionArn', 'memoryLimitInMB', 'awsRequestId', 'logGroupName', 'logStreamName', 'identity', 'clientContext', 'callbackWaitsForEmptyEventLoop']; // move to util, if ever used elsewhere
42
+ const awsContextKeys = ['functionName', 'functionVersion', 'invokedFunctionArn', 'memoryLimitInMB', 'awsRequestId', 'logGroupName', 'logStreamName', 'identity', 'clientContext', 'callbackWaitsForEmptyEventLoop'];
47
43
 
48
44
  const pick = (originalObject = {}, keysToPick = []) => {
49
45
  const newObject = {};
50
46
 
51
47
  for (const path of keysToPick) {
52
- // only supports first level
53
48
  if (originalObject[path] !== undefined) {
54
49
  newObject[path] = originalObject[path];
55
50
  }
@@ -82,4 +77,4 @@ const deleteKey = (obj, key) => {
82
77
  return obj;
83
78
  };
84
79
 
85
- module.exports = inputOutputLoggerMiddleware;
80
+ export default inputOutputLoggerMiddleware;
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@middy/input-output-logger",
3
- "version": "2.5.3",
3
+ "version": "3.0.0-alpha.2",
4
4
  "description": "Input and output logger middleware for the middy framework",
5
- "type": "commonjs",
5
+ "type": "module",
6
6
  "engines": {
7
- "node": ">=12"
7
+ "node": ">=14"
8
8
  },
9
9
  "engineStrict": true,
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "main": "index.js",
13
+ "exports": "./index.js",
14
14
  "types": "index.d.ts",
15
15
  "files": [
16
+ "index.js",
16
17
  "index.d.ts"
17
18
  ],
18
19
  "scripts": {
@@ -46,8 +47,8 @@
46
47
  },
47
48
  "homepage": "https://github.com/middyjs/middy#readme",
48
49
  "devDependencies": {
49
- "@middy/core": "^2.5.3",
50
- "@types/node": "^16.0.0"
50
+ "@middy/core": "^3.0.0-alpha.2",
51
+ "@types/node": "^17.0.0"
51
52
  },
52
- "gitHead": "690884d43b9cd632aeca9a5eba1612160b987cd4"
53
+ "gitHead": "de30419273ecbff08f367f47c7e320ec981cf145"
53
54
  }