@adobe/spacecat-shared-data-access 1.34.2 → 1.35.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.35.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.35.0...@adobe/spacecat-shared-data-access-v1.35.1) (2024-07-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fix the getFailedCount function in importJob interface ([#290](https://github.com/adobe/spacecat-shared/issues/290)) ([db4d0cc](https://github.com/adobe/spacecat-shared/commit/db4d0cc754d77d6a32780c48ca45e4b86712bb01)), closes [/github.com/adobe/spacecat-shared/blob/main/packages/spacecat-shared-data-access/src/dto/import-job.js#L39](https://github.com//github.com/adobe/spacecat-shared/blob/main/packages/spacecat-shared-data-access/src/dto/import-job.js/issues/L39)
7
+
8
+ # [@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)
9
+
10
+
11
+ ### Features
12
+
13
+ * 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))
14
+
1
15
  # [@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
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.34.2",
3
+ "version": "1.35.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -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
@@ -478,6 +478,11 @@ export interface ImportJob {
478
478
  */
479
479
  getDuration: () => number;
480
480
 
481
+ /**
482
+ * Retrieves the url count of the import job.
483
+ */
484
+ getUrlCount: () => number;
485
+
481
486
  /**
482
487
  * Retrieves the success count of the import job.
483
488
  */
@@ -486,7 +491,7 @@ export interface ImportJob {
486
491
  /**
487
492
  * Retrieves the failure count of the import job.
488
493
  */
489
- getFailureCount: () => number;
494
+ getFailedCount: () => number;
490
495
 
491
496
  /**
492
497
  * Retrieves the importQueueId of the import job.
@@ -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 (!isNumber(successCount)) {
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 (!isNumber(failedCount)) {
131
+ if (!isInteger(failedCount)) {
115
132
  throw new Error(`Invalid failed count during update: ${failedCount}`);
116
133
  }
117
134