@adobe/spacecat-shared-data-access 1.1.1 → 1.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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/index.js +5 -5
- package/src/models/audit.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.1.3](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.2...@adobe/spacecat-shared-data-access-v1.1.3) (2023-12-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* switch defaults to dev (force release) ([b85d54c](https://github.com/adobe-rnd/spacecat-shared/commit/b85d54ca7430a4e54b49d112429242c81ff55714))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.1.2](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.1...@adobe/spacecat-shared-data-access-v1.1.2) (2023-12-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* wrap scores ([#28](https://github.com/adobe-rnd/spacecat-shared/issues/28)) ([4733a93](https://github.com/adobe-rnd/spacecat-shared/commit/4733a93d2db087dd57f94955a2101e5a4bb74ce2))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.1.1](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.1.0...@adobe/spacecat-shared-data-access-v1.1.1) (2023-12-02)
|
|
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.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@adobe/spacecat-shared-dynamo": "1.2.
|
|
32
|
+
"@adobe/spacecat-shared-dynamo": "1.2.4",
|
|
33
33
|
"@adobe/spacecat-shared-utils": "1.2.0",
|
|
34
34
|
"@aws-sdk/client-dynamodb": "3.465.0",
|
|
35
35
|
"@aws-sdk/lib-dynamodb": "3.465.0",
|
package/src/index.js
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import { createDataAccess } from './service/index.js';
|
|
14
14
|
|
|
15
|
-
const TABLE_NAME_AUDITS = 'spacecat-services-audits';
|
|
16
|
-
const TABLE_NAME_LATEST_AUDITS = 'spacecat-services-latest-audits';
|
|
17
|
-
const TABLE_NAME_SITES = 'spacecat-services-sites';
|
|
15
|
+
const TABLE_NAME_AUDITS = 'spacecat-services-audits-dev';
|
|
16
|
+
const TABLE_NAME_LATEST_AUDITS = 'spacecat-services-latest-audits-dev';
|
|
17
|
+
const TABLE_NAME_SITES = 'spacecat-services-sites-dev';
|
|
18
18
|
|
|
19
|
-
const INDEX_NAME_ALL_SITES = 'spacecat-services-all-sites';
|
|
20
|
-
const INDEX_NAME_ALL_LATEST_AUDIT_SCORES = 'spacecat-services-all-latest-audit-scores';
|
|
19
|
+
const INDEX_NAME_ALL_SITES = 'spacecat-services-all-sites-dev';
|
|
20
|
+
const INDEX_NAME_ALL_LATEST_AUDIT_SCORES = 'spacecat-services-all-latest-audit-scores-dev';
|
|
21
21
|
|
|
22
22
|
const PK_ALL_SITES = 'ALL_SITES';
|
|
23
23
|
const PK_ALL_LATEST_AUDITS = 'ALL_LATEST_AUDITS';
|
package/src/models/audit.js
CHANGED
|
@@ -31,14 +31,14 @@ const AUDIT_TYPE_PROPERTIES = {
|
|
|
31
31
|
* @param {string} auditType - The type of the audit.
|
|
32
32
|
* @returns {boolean} - True if valid, false otherwise.
|
|
33
33
|
*/
|
|
34
|
-
const
|
|
34
|
+
const validateScores = (auditResult, auditType) => {
|
|
35
35
|
const expectedProperties = AUDIT_TYPE_PROPERTIES[auditType];
|
|
36
36
|
if (!expectedProperties) {
|
|
37
37
|
throw new Error(`Unknown audit type: ${auditType}`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
for (const prop of expectedProperties) {
|
|
41
|
-
if (!(prop in auditResult)) {
|
|
41
|
+
if (!(prop in auditResult.scores)) {
|
|
42
42
|
throw new Error(`Missing expected property '${prop}' for audit type '${auditType}'`);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -61,7 +61,7 @@ const Audit = (data = {}) => {
|
|
|
61
61
|
self.getExpiresAt = () => self.state.expiresAt;
|
|
62
62
|
self.getFullAuditRef = () => self.state.fullAuditRef;
|
|
63
63
|
self.isLive = () => self.state.isLive;
|
|
64
|
-
self.getScores = () => self.getAuditResult();
|
|
64
|
+
self.getScores = () => self.getAuditResult().scores;
|
|
65
65
|
|
|
66
66
|
return Object.freeze(self);
|
|
67
67
|
};
|
|
@@ -91,7 +91,7 @@ export const createAudit = (data) => {
|
|
|
91
91
|
throw new Error('Audit result must be an object');
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
validateScores(data.auditResult, data.auditType);
|
|
95
95
|
|
|
96
96
|
if (!hasText(newState.fullAuditRef)) {
|
|
97
97
|
throw new Error('Full audit ref must be provided');
|