@adobe/spacecat-shared-data-access 1.21.0 → 1.21.1

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.21.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.21.0...@adobe/spacecat-shared-data-access-v1.21.1) (2024-04-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * validate scores only needed ([#203](https://github.com/adobe/spacecat-shared/issues/203)) ([e2e4d14](https://github.com/adobe/spacecat-shared/commit/e2e4d14fa7d28bf2606b933c6c8f6f329c1ff33a))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.21.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.20.5...@adobe/spacecat-shared-data-access-v1.21.0) (2024-03-25)
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.21.0",
3
+ "version": "1.21.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -13,6 +13,7 @@
13
13
  import { hasText, isIsoDate, isObject } from '@adobe/spacecat-shared-utils';
14
14
  import { Base } from './base.js';
15
15
 
16
+ // some of these unused exports are being imported from other projects. Handle with care.
16
17
  export const AUDIT_TYPE_404 = '404';
17
18
  export const AUDIT_TYPE_BROKEN_BACKLINKS = 'broken-backlinks';
18
19
  export const AUDIT_TYPE_EXPERIMENTATION = 'experimentation';
@@ -25,12 +26,6 @@ export const AUDIT_TYPE_LHS_MOBILE = 'lhs-mobile';
25
26
  const EXPIRES_IN_DAYS = 30;
26
27
 
27
28
  const AUDIT_TYPE_PROPERTIES = {
28
- [AUDIT_TYPE_404]: [],
29
- [AUDIT_TYPE_BROKEN_BACKLINKS]: [],
30
- [AUDIT_TYPE_EXPERIMENTATION]: [],
31
- [AUDIT_TYPE_ORGANIC_KEYWORDS]: [],
32
- [AUDIT_TYPE_ORGANIC_TRAFFIC]: [],
33
- [AUDIT_TYPE_CWV]: [],
34
29
  [AUDIT_TYPE_LHS_DESKTOP]: ['performance', 'seo', 'accessibility', 'best-practices'],
35
30
  [AUDIT_TYPE_LHS_MOBILE]: ['performance', 'seo', 'accessibility', 'best-practices'],
36
31
  };
@@ -52,13 +47,12 @@ const validateScores = (auditResult, auditType) => {
52
47
  }
53
48
 
54
49
  const expectedProperties = AUDIT_TYPE_PROPERTIES[auditType];
55
- if (!expectedProperties) {
56
- throw new Error(`Unknown audit type: ${auditType}`);
57
- }
58
50
 
59
- for (const prop of expectedProperties) {
60
- if (!(prop in auditResult.scores)) {
61
- throw new Error(`Missing expected property '${prop}' for audit type '${auditType}'`);
51
+ if (expectedProperties) {
52
+ for (const prop of expectedProperties) {
53
+ if (!(prop in auditResult.scores)) {
54
+ throw new Error(`Missing expected property '${prop}' for audit type '${auditType}'`);
55
+ }
62
56
  }
63
57
  }
64
58