@middy/dynamodb 7.1.2 → 7.1.4

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/README.md CHANGED
@@ -30,10 +30,23 @@
30
30
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/dynamodb">https://middy.js.org/docs/middlewares/dynamodb</a></p>
31
31
  </div>
32
32
 
33
- ## License
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install --save @middy/dynamodb @aws-sdk/client-dynamodb @aws-sdk/util-dynamodb
37
+ ```
38
+
39
+
40
+ ## Documentation and examples
41
+
42
+ For documentation and examples, refer to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org/docs/middlewares/dynamodb).
34
43
 
35
- Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
36
44
 
37
- <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
38
- <img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
39
- </a>
45
+ ## Contributing
46
+
47
+ Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
48
+
49
+
50
+ ## License
51
+
52
+ Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
package/index.d.ts CHANGED
@@ -57,7 +57,7 @@ declare function dynamodbMiddleware<
57
57
  options?: TOptions,
58
58
  ): middy.MiddlewareObj<
59
59
  unknown,
60
- any,
60
+ unknown,
61
61
  Error,
62
62
  Context<TOptions>,
63
63
  Internal<TOptions>
package/index.js CHANGED
@@ -32,8 +32,9 @@ const dynamodbMiddleware = (opts = {}) => {
32
32
  fetchData: structuredClone({ ...defaults.fetchData, ...opts.fetchData }),
33
33
  };
34
34
 
35
+ const fetchDataKeys = Object.keys(options.fetchData);
35
36
  // force marshall of Key during cold start
36
- for (const internalKey in options.fetchData) {
37
+ for (const internalKey of fetchDataKeys) {
37
38
  options.fetchData[internalKey].Key = marshall(
38
39
  options.fetchData[internalKey].Key,
39
40
  );
@@ -41,7 +42,7 @@ const dynamodbMiddleware = (opts = {}) => {
41
42
 
42
43
  const fetchRequest = (request, cachedValues = {}) => {
43
44
  const values = {};
44
- for (const internalKey in options.fetchData) {
45
+ for (const internalKey of fetchDataKeys) {
45
46
  if (cachedValues[internalKey]) continue;
46
47
  const inputParameters = options.fetchData[internalKey];
47
48
  const command = new GetItemCommand(inputParameters);
@@ -71,7 +72,7 @@ const dynamodbMiddleware = (opts = {}) => {
71
72
  const { value } = processCache(options, fetchRequest, request);
72
73
  Object.assign(request.internal, value);
73
74
  if (options.setToContext) {
74
- const data = await getInternal(Object.keys(options.fetchData), request);
75
+ const data = await getInternal(fetchDataKeys, request);
75
76
  Object.assign(request.context, data);
76
77
  }
77
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/dynamodb",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "description": "DynamoDB middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -74,15 +74,15 @@
74
74
  "optional": true
75
75
  }
76
76
  },
77
+ "dependencies": {
78
+ "@middy/util": "7.1.4"
79
+ },
77
80
  "devDependencies": {
78
81
  "@aws-sdk/client-dynamodb": "^3.0.0",
79
82
  "@aws-sdk/util-dynamodb": "^3.0.0",
80
- "@middy/core": "7.1.2",
83
+ "@middy/core": "7.1.4",
81
84
  "@types/aws-lambda": "^8.0.0",
85
+ "@types/node": "^22.0.0",
82
86
  "aws-xray-sdk": "^3.3.3"
83
- },
84
- "dependencies": {
85
- "@middy/util": "7.1.2"
86
- },
87
- "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
87
+ }
88
88
  }