@adobe/spacecat-shared-data-access 1.1.1 → 1.1.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,10 @@
1
+ # [@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)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * wrap scores ([#28](https://github.com/adobe-rnd/spacecat-shared/issues/28)) ([4733a93](https://github.com/adobe-rnd/spacecat-shared/commit/4733a93d2db087dd57f94955a2101e5a4bb74ce2))
7
+
1
8
  # [@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
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.1",
3
+ "version": "1.1.2",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -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 validateAuditResult = (auditResult, auditType) => {
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
- validateAuditResult(data.auditResult, data.auditType);
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');