@adobe/spacecat-shared-data-access 1.12.0 → 1.13.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,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.13.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.13.0...@adobe/spacecat-shared-data-access-v1.13.1) (2024-01-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * allow update config for site ([ad9e677](https://github.com/adobe/spacecat-shared/commit/ad9e677c7c721aa70e37b97373a4b9545f2f21fd))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.13.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.12.0...@adobe/spacecat-shared-data-access-v1.13.0) (2024-01-30)
9
+
10
+
11
+ ### Features
12
+
13
+ * introduce default config for organic-keywords report (SITES-19317) ([#118](https://github.com/adobe/spacecat-shared/issues/118)) ([4301556](https://github.com/adobe/spacecat-shared/commit/430155645e1452760bf2818d70a0faae2fb8db12))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.12.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.11.0...@adobe/spacecat-shared-data-access-v1.12.0) (2024-01-29)
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.12.0",
3
+ "version": "1.13.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -15,6 +15,7 @@ import { Base } from './base.js';
15
15
 
16
16
  export const AUDIT_TYPE_404 = '404';
17
17
  export const AUDIT_TYPE_BROKEN_BACKLINKS = 'broken-backlinks';
18
+ export const AUDIT_TYPE_ORGANIC_KEYWORDS = 'organic-keywords';
18
19
  export const AUDIT_TYPE_CWV = 'cwv';
19
20
  export const AUDIT_TYPE_LHS_DESKTOP = 'lhs-desktop';
20
21
  export const AUDIT_TYPE_LHS_MOBILE = 'lhs-mobile';
@@ -24,6 +25,7 @@ const EXPIRES_IN_DAYS = 30;
24
25
  const AUDIT_TYPE_PROPERTIES = {
25
26
  [AUDIT_TYPE_404]: [],
26
27
  [AUDIT_TYPE_BROKEN_BACKLINKS]: [],
28
+ [AUDIT_TYPE_ORGANIC_KEYWORDS]: [],
27
29
  [AUDIT_TYPE_CWV]: [],
28
30
  [AUDIT_TYPE_LHS_DESKTOP]: ['performance', 'seo', 'accessibility', 'best-practices'],
29
31
  [AUDIT_TYPE_LHS_MOBILE]: ['performance', 'seo', 'accessibility', 'best-practices'],
@@ -11,16 +11,21 @@
11
11
  */
12
12
 
13
13
  import AuditConfigType from './audit-config-type.js';
14
- import { AUDIT_TYPE_BROKEN_BACKLINKS } from '../audit.js';
14
+ import {
15
+ AUDIT_TYPE_BROKEN_BACKLINKS,
16
+ AUDIT_TYPE_ORGANIC_KEYWORDS,
17
+ } from '../audit.js';
15
18
 
16
19
  const AUDIT_TYPE_DISABLED_DEFAULTS = {
17
20
  [AUDIT_TYPE_BROKEN_BACKLINKS]: true,
21
+ [AUDIT_TYPE_ORGANIC_KEYWORDS]: true,
18
22
  };
19
23
 
20
24
  function getAuditTypeConfigs(auditTypeConfigs, auditsDisabled) {
21
25
  if (!auditTypeConfigs || Object.keys(auditTypeConfigs).length === 0) {
22
26
  return {
23
27
  [AUDIT_TYPE_BROKEN_BACKLINKS]: AuditConfigType({ disabled: true }),
28
+ [AUDIT_TYPE_ORGANIC_KEYWORDS]: AuditConfigType({ disabled: true }),
24
29
  };
25
30
  }
26
31
  return Object.entries(auditTypeConfigs || {}).reduce((acc, [key, value]) => {
@@ -93,6 +93,22 @@ const Site = (data = {}) => {
93
93
  return self;
94
94
  };
95
95
 
96
+ /**
97
+ * Updates the site config.
98
+ * @param {string} config - The Site config.
99
+ * @return {Base} The updated site.
100
+ */
101
+ self.updateConfig = (config) => {
102
+ if (!isObject(config)) {
103
+ throw new Error('Config must be provided');
104
+ }
105
+
106
+ self.state.config = Config.toDynamoItem(config);
107
+ self.touch();
108
+
109
+ return self;
110
+ };
111
+
96
112
  self.updateDeliveryType = (deliveryType) => {
97
113
  if (!Object.values(DELIVERY_TYPES).includes(deliveryType)) {
98
114
  throw new Error(`Invalid delivery type: ${deliveryType}`);