@adobe/spacecat-shared-data-access 1.29.1 → 1.30.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 +14 -0
- package/package.json +1 -1
- package/src/dto/import-url.js +6 -0
- package/src/dto/site-top-page.js +5 -1
- package/src/index.d.ts +6 -0
- package/src/models/importer/import-url.js +51 -4
- package/src/models/site-top-page.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
8
|
+
# [@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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [#268](https://github.com/adobe/spacecat-shared/issues/268) Import URL entities need a REDIRECT status, and additional properties for reporting ([#269](https://github.com/adobe/spacecat-shared/issues/269)) ([88bb491](https://github.com/adobe/spacecat-shared/commit/88bb49105a9b0a9cd297fe9667aff1df24bcee03))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.29.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.29.0...@adobe/spacecat-shared-data-access-v1.29.1) (2024-06-15)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/dto/import-url.js
CHANGED
|
@@ -26,6 +26,9 @@ export const ImportUrlDto = {
|
|
|
26
26
|
jobId: importUrl.getJobId(),
|
|
27
27
|
url: importUrl.getUrl(),
|
|
28
28
|
status: importUrl.getStatus(),
|
|
29
|
+
reason: importUrl.getReason(),
|
|
30
|
+
path: importUrl.getPath(),
|
|
31
|
+
file: importUrl.getFile(),
|
|
29
32
|
}),
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -37,6 +40,9 @@ export const ImportUrlDto = {
|
|
|
37
40
|
jobId: dynamoItem.jobId,
|
|
38
41
|
url: dynamoItem.url,
|
|
39
42
|
status: dynamoItem.status,
|
|
43
|
+
reason: dynamoItem.reason,
|
|
44
|
+
path: dynamoItem.path,
|
|
45
|
+
file: dynamoItem.file,
|
|
40
46
|
};
|
|
41
47
|
return createImportUrl(importUrlData);
|
|
42
48
|
},
|
package/src/dto/site-top-page.js
CHANGED
|
@@ -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 {
|
|
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.
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
13
|
+
import { hasText, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
import { Base } from '../base.js';
|
|
15
15
|
import { ImportJobStatus } from './import-job.js';
|
|
16
16
|
|
|
17
17
|
export const ImportUrlStatus = {
|
|
18
18
|
PENDING: 'PENDING',
|
|
19
|
+
REDIRECT: 'REDIRECT',
|
|
19
20
|
...ImportJobStatus,
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -31,11 +32,16 @@ const ImportUrl = (data) => {
|
|
|
31
32
|
self.getJobId = () => self.state.jobId;
|
|
32
33
|
self.getUrl = () => self.state.url;
|
|
33
34
|
self.getStatus = () => self.state.status;
|
|
35
|
+
self.getReason = () => self.state.reason;
|
|
36
|
+
// Absolute path to the resource that is being imported for the given URL
|
|
37
|
+
self.getPath = () => self.state.path;
|
|
38
|
+
// Resulting path and filename of the imported .docx file
|
|
39
|
+
self.getFile = () => self.state.file;
|
|
34
40
|
|
|
35
41
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
self.
|
|
42
|
+
* Updates the status of the ImportUrl
|
|
43
|
+
*/
|
|
44
|
+
self.setStatus = (status) => {
|
|
39
45
|
if (!Object.values(ImportUrlStatus).includes(status)) {
|
|
40
46
|
throw new Error(`Invalid Import URL status during update: ${status}`);
|
|
41
47
|
}
|
|
@@ -45,6 +51,47 @@ const ImportUrl = (data) => {
|
|
|
45
51
|
|
|
46
52
|
return self;
|
|
47
53
|
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Updates the reason that the import of this URL was not successful
|
|
57
|
+
*/
|
|
58
|
+
self.setReason = (reason) => {
|
|
59
|
+
if (!hasText(reason)) {
|
|
60
|
+
return self; // no-op
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
self.state.reason = reason;
|
|
64
|
+
self.touch();
|
|
65
|
+
return self;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Updates the path of the ImportUrl
|
|
70
|
+
*/
|
|
71
|
+
self.setPath = (path) => {
|
|
72
|
+
if (!hasText(path)) {
|
|
73
|
+
return self; // no-op
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
self.state.path = path;
|
|
77
|
+
self.touch();
|
|
78
|
+
return self;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Updates the file of the ImportUrl. This is the path and file name of the file which
|
|
83
|
+
* was imported.
|
|
84
|
+
*/
|
|
85
|
+
self.setFile = (file) => {
|
|
86
|
+
if (!hasText(file)) {
|
|
87
|
+
return self; // no-op
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
self.state.file = file;
|
|
91
|
+
self.touch();
|
|
92
|
+
return self;
|
|
93
|
+
};
|
|
94
|
+
|
|
48
95
|
return Object.freeze(self);
|
|
49
96
|
};
|
|
50
97
|
|
|
@@ -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;
|