@adobe/spacecat-shared-data-access 2.80.0 → 2.80.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v2.80.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.80.1...@adobe/spacecat-shared-data-access-v2.80.2) (2025-11-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **dynamo-db:** prevent connection storms in Lambda by caching client instances ([#1110](https://github.com/adobe/spacecat-shared/issues/1110)) ([f854100](https://github.com/adobe/spacecat-shared/commit/f85410088a2290dbab8d8956c16137e99e47147b))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v2.80.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.80.0...@adobe/spacecat-shared-data-access-v2.80.1) (2025-11-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#1107](https://github.com/adobe/spacecat-shared/issues/1107)) ([f4cdb50](https://github.com/adobe/spacecat-shared/commit/f4cdb50f96d18dd92de81055f2b58310a68c0cac))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v2.80.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.79.0...@adobe/spacecat-shared-data-access-v2.80.0) (2025-11-07)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "2.80.0",
3
+ "version": "2.80.2",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@adobe/spacecat-shared-utils": "1.66.0",
42
- "@aws-sdk/client-dynamodb": "3.922.0",
43
- "@aws-sdk/lib-dynamodb": "3.922.0",
42
+ "@aws-sdk/client-dynamodb": "3.927.0",
43
+ "@aws-sdk/lib-dynamodb": "3.927.0",
44
44
  "@types/joi": "17.2.3",
45
45
  "aws-xray-sdk": "3.11.0",
46
46
  "electrodb": "3.5.0",
@@ -22,14 +22,29 @@ export * from '../errors/index.js';
22
22
  export * from '../models/index.js';
23
23
  export * from '../util/index.js';
24
24
 
25
+ let defaultDynamoDBClient;
26
+ const documentClientCache = new WeakMap();
27
+
25
28
  const createRawClient = (client = undefined) => {
26
- const dbClient = instrumentAWSClient(client || new DynamoDB());
27
- return DynamoDBDocument.from(dbClient, {
28
- marshallOptions: {
29
- convertEmptyValues: true,
30
- removeUndefinedValues: true,
31
- },
32
- });
29
+ const rawClient = client || (() => {
30
+ if (!defaultDynamoDBClient) {
31
+ defaultDynamoDBClient = new DynamoDB();
32
+ }
33
+ return defaultDynamoDBClient;
34
+ })();
35
+
36
+ let documentClient = documentClientCache.get(rawClient);
37
+ if (!documentClient) {
38
+ documentClient = DynamoDBDocument.from(instrumentAWSClient(rawClient), {
39
+ marshallOptions: {
40
+ convertEmptyValues: true,
41
+ removeUndefinedValues: true,
42
+ },
43
+ });
44
+ documentClientCache.set(rawClient, documentClient);
45
+ }
46
+
47
+ return documentClient;
33
48
  };
34
49
 
35
50
  const createElectroService = (client, config, log) => {