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

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,10 @@
1
+ # [@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)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * get audit no query ([#34](https://github.com/adobe-rnd/spacecat-shared/issues/34)) ([8fadd0a](https://github.com/adobe-rnd/spacecat-shared/commit/8fadd0a21a1e0cc232a06ccf805d1ac5c946b8be))
7
+
1
8
  # [@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
9
 
3
10
 
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.5",
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
  /**
@@ -158,7 +153,7 @@ export const getLatestAuditForSite = async (
158
153
  ) => {
159
154
  const latestAudit = await dynamoClient.query({
160
155
  TableName: config.tableNameLatestAudits,
161
- KeyConditionExpression: 'siteId = :siteId AND begins_with(auditType, :auditType)',
156
+ KeyConditionExpression: 'siteId = :siteId AND auditType = :auditType',
162
157
  ExpressionAttributeValues: {
163
158
  ':siteId': siteId,
164
159
  ':auditType': `${auditType}`,