@adobe/spacecat-shared-data-access 1.29.2 → 1.31.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,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.31.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.30.0...@adobe/spacecat-shared-data-access-v1.31.0) (2024-06-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * overwrite broken-backlinks ([#270](https://github.com/adobe/spacecat-shared/issues/270)) ([62256f2](https://github.com/adobe/spacecat-shared/commit/62256f2f750a97ada3d6b624b0ec50865589f39f))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.30.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.29.2...@adobe/spacecat-shared-data-access-v1.30.0) (2024-06-19)
9
+
10
+
11
+ ### Features
12
+
13
+ * introduce organic keywords for ahrefs client and top keyword in top pages ([#257](https://github.com/adobe/spacecat-shared/issues/257)) ([371f1c4](https://github.com/adobe/spacecat-shared/commit/371f1c475870fd2aac833f925236237a8b25c026))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.29.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.29.1...@adobe/spacecat-shared-data-access-v1.29.2) (2024-06-18)
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.29.2",
3
+ "version": "1.31.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -26,6 +26,7 @@ export const SiteTopPageDto = {
26
26
  siteId: siteTopPage.getSiteId(),
27
27
  url: siteTopPage.getURL(),
28
28
  traffic: siteTopPage.getTraffic(),
29
+ topKeyword: siteTopPage.getTopKeyword(),
29
30
  source: siteTopPage.getSource(),
30
31
  geo: siteTopPage.getGeo(),
31
32
  importedAt: siteTopPage.getImportedAt(),
@@ -34,13 +35,16 @@ export const SiteTopPageDto = {
34
35
 
35
36
  /**
36
37
  * Converts a DynamoDB item into a SiteTopPage object.
37
- * @param {{siteId, url, traffic, source, geo, importedAt, SK: string}} item - DynamoDB item.
38
+ * @param {
39
+ * {siteId, url, traffic, topKeyword, source, geo, importedAt, SK: string}
40
+ * } item - DynamoDB item.
38
41
  * @returns {SiteTopPage}
39
42
  */
40
43
  fromDynamoItem: (item) => createSiteTopPage({
41
44
  siteId: item.siteId,
42
45
  url: item.url,
43
46
  traffic: item.traffic,
47
+ topKeyword: item.topKeyword,
44
48
  source: item.source,
45
49
  geo: item.geo,
46
50
  importedAt: item.importedAt,
package/src/index.d.ts CHANGED
@@ -347,6 +347,12 @@ export interface SiteTopPage {
347
347
  */
348
348
  getTraffic: () => number;
349
349
 
350
+ /**
351
+ * Retrieves the keyword that brings the most organic traffic to the page.
352
+ * @returns {string} The keyword.
353
+ */
354
+ getTopKeyword: () => string;
355
+
350
356
  /**
351
357
  * Retrieves the source of the site top page.
352
358
  * @returns {string} The source.
@@ -14,6 +14,7 @@ const AuditConfigType = (data = {}) => {
14
14
  const state = {
15
15
  disabled: data.disabled || false,
16
16
  excludedURLs: data.excludedURLs || [],
17
+ manualOverwrites: data.manualOverwrites || [],
17
18
  };
18
19
 
19
20
  const self = {
@@ -22,6 +23,10 @@ const AuditConfigType = (data = {}) => {
22
23
  updateExcludedURLs: (excludeURLs) => {
23
24
  state.excludedURLs = excludeURLs;
24
25
  },
26
+ getManualOverwrites: () => state.manualOverwrites,
27
+ updateManualOverwrites: (manualOverwrites) => {
28
+ state.manualOverwrites = manualOverwrites;
29
+ },
25
30
  updateDisabled: (newValue) => {
26
31
  state.disabled = newValue;
27
32
  },
@@ -34,6 +39,7 @@ AuditConfigType.fromDynamoItem = (dynamoItem) => {
34
39
  const auditConfigTypeData = {
35
40
  disabled: dynamoItem.disabled,
36
41
  excludedURLs: dynamoItem.excludedURLs,
42
+ manualOverwrites: dynamoItem.manualOverwrites,
37
43
  };
38
44
  return AuditConfigType(auditConfigTypeData);
39
45
  };
@@ -41,6 +47,7 @@ AuditConfigType.fromDynamoItem = (dynamoItem) => {
41
47
  AuditConfigType.toDynamoItem = (auditConfigType) => ({
42
48
  disabled: auditConfigType.disabled(),
43
49
  excludedURLs: auditConfigType.getExcludedURLs(),
50
+ manualOverwrites: auditConfigType.getManualOverwrites(),
44
51
  });
45
52
 
46
53
  export default AuditConfigType;
@@ -31,6 +31,10 @@ export const configSchema = Joi.object({
31
31
  Joi.object({
32
32
  disabled: Joi.boolean().optional(),
33
33
  excludedURLs: Joi.array().items(Joi.string()).optional(),
34
+ manualOverwrites: Joi.array().items(Joi.object({
35
+ brokenTargetURL: Joi.string().optional(),
36
+ targetURL: Joi.string().optional(),
37
+ })).optional(),
34
38
  }).unknown(true),
35
39
  ).unknown(true),
36
40
  }).unknown(true),
@@ -23,6 +23,7 @@ const SiteTopPage = (data = {}) => {
23
23
  self.getSiteId = () => self.state.siteId;
24
24
  self.getURL = () => self.state.url;
25
25
  self.getTraffic = () => self.state.traffic;
26
+ self.getTopKeyword = () => self.state.topKeyword;
26
27
  self.getSource = () => self.state.source.toLowerCase();
27
28
  self.getGeo = () => self.state.geo;
28
29
  self.getImportedAt = () => self.state.importedAt;