@middy/dynamodb 7.1.2 → 7.1.3
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 +17 -0
- package/index.d.ts +1 -1
- package/index.js +4 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -30,6 +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
|
+
## 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).
|
|
43
|
+
|
|
44
|
+
|
|
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
|
+
|
|
33
50
|
## License
|
|
34
51
|
|
|
35
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
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
|
|
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
|
|
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(
|
|
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.
|
|
3
|
+
"version": "7.1.3",
|
|
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.3"
|
|
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.
|
|
83
|
+
"@middy/core": "7.1.3",
|
|
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
|
}
|