@adobe/spacecat-shared-data-access 1.34.2 → 1.35.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 +7 -0
- package/package.json +1 -1
- package/src/dto/import-job.js +2 -0
- package/src/index.d.ts +5 -0
- package/src/models/importer/import-job.js +20 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.35.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.34.2...@adobe/spacecat-shared-data-access-v1.35.0) (2024-07-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add urlCount attribute to import-jobs data model ([#287](https://github.com/adobe/spacecat-shared/issues/287)) ([4fecc4c](https://github.com/adobe/spacecat-shared/commit/4fecc4cb5f31fa0a62cf22ff0ae9e98d4c12b399))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v1.34.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.34.1...@adobe/spacecat-shared-data-access-v1.34.2) (2024-07-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/dto/import-job.js
CHANGED
|
@@ -34,6 +34,7 @@ export const ImportJobDto = {
|
|
|
34
34
|
endTime: importJob.getEndTime(),
|
|
35
35
|
duration: importJob.getDuration(),
|
|
36
36
|
status: importJob.getStatus(),
|
|
37
|
+
urlCount: importJob.getUrlCount(),
|
|
37
38
|
successCount: importJob.getSuccessCount(),
|
|
38
39
|
failedCount: importJob.getFailedCount(),
|
|
39
40
|
importQueueId: importJob.getImportQueueId(),
|
|
@@ -53,6 +54,7 @@ export const ImportJobDto = {
|
|
|
53
54
|
endTime: dynamoItem.endTime,
|
|
54
55
|
duration: dynamoItem.duration,
|
|
55
56
|
status: dynamoItem.status,
|
|
57
|
+
urlCount: dynamoItem.urlCount,
|
|
56
58
|
successCount: dynamoItem.successCount,
|
|
57
59
|
failedCount: dynamoItem.failedCount,
|
|
58
60
|
importQueueId: dynamoItem.importQueueId,
|
package/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
-
hasText, isIsoDate, isValidUrl, isObject, isString, isNumber,
|
|
14
|
+
hasText, isIsoDate, isValidUrl, isObject, isString, isNumber, isInteger,
|
|
15
15
|
} from '@adobe/spacecat-shared-utils';
|
|
16
16
|
import { Base } from '../base.js';
|
|
17
17
|
|
|
@@ -37,6 +37,7 @@ const ImportJob = (data) => {
|
|
|
37
37
|
self.getEndTime = () => self.state.endTime;
|
|
38
38
|
self.getDuration = () => self.state.duration;
|
|
39
39
|
self.getStatus = () => self.state.status;
|
|
40
|
+
self.getUrlCount = () => self.state.urlCount;
|
|
40
41
|
self.getSuccessCount = () => self.state.successCount;
|
|
41
42
|
self.getFailedCount = () => self.state.failedCount;
|
|
42
43
|
self.getImportQueueId = () => self.state.importQueueId;
|
|
@@ -89,13 +90,29 @@ const ImportJob = (data) => {
|
|
|
89
90
|
return self;
|
|
90
91
|
};
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Updates the Url count of the ImportJob
|
|
95
|
+
* @param {number} urlCount - The new url count.
|
|
96
|
+
* @returns {ImportJob} The updated ImportJob object.
|
|
97
|
+
*/
|
|
98
|
+
self.updateUrlCount = (urlCount) => {
|
|
99
|
+
if (!isInteger(urlCount)) {
|
|
100
|
+
throw new Error(`Invalid url count during update: ${urlCount}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
self.state.urlCount = urlCount;
|
|
104
|
+
self.touch();
|
|
105
|
+
|
|
106
|
+
return self;
|
|
107
|
+
};
|
|
108
|
+
|
|
92
109
|
/**
|
|
93
110
|
* Updates the success count of the ImportJob.
|
|
94
111
|
* @param {number} successCount - The new success count.
|
|
95
112
|
* @returns {ImportJob} The updated ImportJob object.
|
|
96
113
|
*/
|
|
97
114
|
self.updateSuccessCount = (successCount) => {
|
|
98
|
-
if (!
|
|
115
|
+
if (!isInteger(successCount)) {
|
|
99
116
|
throw new Error(`Invalid success count during update: ${successCount}`);
|
|
100
117
|
}
|
|
101
118
|
|
|
@@ -111,7 +128,7 @@ const ImportJob = (data) => {
|
|
|
111
128
|
* @returns {ImportJob} The updated ImportJob object.
|
|
112
129
|
*/
|
|
113
130
|
self.updateFailedCount = (failedCount) => {
|
|
114
|
-
if (!
|
|
131
|
+
if (!isInteger(failedCount)) {
|
|
115
132
|
throw new Error(`Invalid failed count during update: ${failedCount}`);
|
|
116
133
|
}
|
|
117
134
|
|