@adobe/spacecat-shared-data-access 1.9.6 → 1.10.0

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.10.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.9.6...@adobe/spacecat-shared-data-access-v1.10.0) (2024-01-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * add 404 as valid audit type ([62e0dec](https://github.com/adobe/spacecat-shared/commit/62e0dec832cdccfc9c3d8fbda61a81d756a5a08a))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.9.6](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.9.5...@adobe/spacecat-shared-data-access-v1.9.6) (2024-01-23)
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.9.6",
3
+ "version": "1.10.0",
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
+ export const AUDIT_TYPE_404 = '404';
16
17
  export const AUDIT_TYPE_BROKEN_BACKLINKS = 'broken-backlinks';
17
18
  export const AUDIT_TYPE_CWV = 'cwv';
18
19
  export const AUDIT_TYPE_LHS_DESKTOP = 'lhs-desktop';
@@ -21,6 +22,7 @@ export const AUDIT_TYPE_LHS_MOBILE = 'lhs-mobile';
21
22
  const EXPIRES_IN_DAYS = 30;
22
23
 
23
24
  const AUDIT_TYPE_PROPERTIES = {
25
+ [AUDIT_TYPE_404]: [],
24
26
  [AUDIT_TYPE_BROKEN_BACKLINKS]: [],
25
27
  [AUDIT_TYPE_CWV]: [],
26
28
  [AUDIT_TYPE_LHS_DESKTOP]: ['performance', 'seo', 'accessibility', 'best-practices'],
@@ -38,7 +40,10 @@ const validateScores = (auditResult, auditType) => {
38
40
  return true;
39
41
  }
40
42
 
41
- if (auditType !== AUDIT_TYPE_BROKEN_BACKLINKS && !isObject(auditResult.scores)) {
43
+ if ((auditType === AUDIT_TYPE_LHS_DESKTOP
44
+ || auditType === AUDIT_TYPE_LHS_MOBILE
45
+ || auditType === AUDIT_TYPE_CWV)
46
+ && !isObject(auditResult.scores)) {
42
47
  throw new Error(`Missing scores property for audit type '${auditType}'`);
43
48
  }
44
49