@adobe/spacecat-shared-data-access 1.1.4 → 1.1.6

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-v1.1.6](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.5...@adobe/spacecat-shared-data-access-v1.1.6) (2023-12-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * use getItem for latest audit ([#35](https://github.com/adobe-rnd/spacecat-shared/issues/35)) ([6e4a87e](https://github.com/adobe-rnd/spacecat-shared/commit/6e4a87ea2d515f632b34278a8cc1ffd51d692a16))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.1.5](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.4...@adobe/spacecat-shared-data-access-v1.1.5) (2023-12-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * get audit no query ([#34](https://github.com/adobe-rnd/spacecat-shared/issues/34)) ([8fadd0a](https://github.com/adobe-rnd/spacecat-shared/commit/8fadd0a21a1e0cc232a06ccf805d1ac5c946b8be))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.1.4](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.3...@adobe/spacecat-shared-data-access-v1.1.4) (2023-12-05)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -65,17 +65,12 @@ export const getAuditForSite = async (
65
65
  auditType,
66
66
  auditedAt,
67
67
  ) => {
68
- const audit = await dynamoClient.query({
69
- TableName: config.tableNameAudits,
70
- KeyConditionExpression: 'siteId = :siteId AND SK = :sk',
71
- ExpressionAttributeValues: {
72
- ':siteId': siteId,
73
- ':sk': `${auditType}#${auditedAt}`,
74
- },
75
- Limit: 1,
68
+ const audit = await dynamoClient.getItem(config.tableNameAudits, {
69
+ siteId,
70
+ SK: `${auditType}#${auditedAt}`,
76
71
  });
77
72
 
78
- return audit.length > 0 ? AuditDto.fromDynamoItem(audit[0]) : null;
73
+ return audit ? AuditDto.fromDynamoItem(audit) : null;
79
74
  };
80
75
 
81
76
  /**
@@ -156,17 +151,12 @@ export const getLatestAuditForSite = async (
156
151
  siteId,
157
152
  auditType,
158
153
  ) => {
159
- const latestAudit = await dynamoClient.query({
160
- TableName: config.tableNameLatestAudits,
161
- KeyConditionExpression: 'siteId = :siteId AND begins_with(auditType, :auditType)',
162
- ExpressionAttributeValues: {
163
- ':siteId': siteId,
164
- ':auditType': `${auditType}`,
165
- },
166
- Limit: 1,
154
+ const latestAudit = await dynamoClient.getItem(config.tableNameLatestAudits, {
155
+ siteId,
156
+ auditType,
167
157
  });
168
158
 
169
- return latestAudit.length > 0 ? AuditDto.fromDynamoItem(latestAudit[0]) : null;
159
+ return latestAudit ? AuditDto.fromDynamoItem(latestAudit) : null;
170
160
  };
171
161
 
172
162
  /**