@adobe/spacecat-shared-data-access 1.45.0 → 1.45.2
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-job.js +4 -0
- package/src/index.d.ts +10 -0
- package/src/models/importer/import-job.js +34 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.45.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.45.1...@adobe/spacecat-shared-data-access-v1.45.2) (2024-09-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Add a unit test for imports.write_all_domains scope ([#384](https://github.com/adobe/spacecat-shared/issues/384)) ([800ec89](https://github.com/adobe/spacecat-shared/commit/800ec89532cc83f32290ced2b91f1af4fcccb44a))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.45.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.45.0...@adobe/spacecat-shared-data-access-v1.45.1) (2024-09-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* SITES-25634 [Importer] Expose hasCustomImportJs and hasCustomHeaders as two new fields on a import job ([#381](https://github.com/adobe/spacecat-shared/issues/381)) ([b90a7c5](https://github.com/adobe/spacecat-shared/commit/b90a7c5623af90924a2122dbc10077f989a8550b))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.45.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.44.5...@adobe/spacecat-shared-data-access-v1.45.0) (2024-09-24)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/dto/import-job.js
CHANGED
|
@@ -40,6 +40,8 @@ export const ImportJobDto = {
|
|
|
40
40
|
redirectCount: importJob.getRedirectCount(),
|
|
41
41
|
importQueueId: importJob.getImportQueueId(),
|
|
42
42
|
initiatedBy: importJob.getInitiatedBy(),
|
|
43
|
+
hasCustomHeaders: importJob.hasCustomHeaders(),
|
|
44
|
+
hasCustomImportJs: importJob.hasCustomImportJs(),
|
|
43
45
|
GSI1PK: 'ALL_IMPORT_JOBS',
|
|
44
46
|
}),
|
|
45
47
|
|
|
@@ -64,6 +66,8 @@ export const ImportJobDto = {
|
|
|
64
66
|
redirectCount: dynamoItem.redirectCount,
|
|
65
67
|
importQueueId: dynamoItem.importQueueId,
|
|
66
68
|
initiatedBy: dynamoItem.initiatedBy,
|
|
69
|
+
hasCustomHeaders: dynamoItem.hasCustomHeaders,
|
|
70
|
+
hasCustomImportJs: dynamoItem.hasCustomImportJs,
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
return createImportJob(importJobData);
|
package/src/index.d.ts
CHANGED
|
@@ -535,6 +535,16 @@ export interface ImportJob {
|
|
|
535
535
|
* Retrieves the initiatedBy metadata (name, imsOrgId, imsUserId, userAgent) of the import job.
|
|
536
536
|
*/
|
|
537
537
|
getInitiatedBy: () => object;
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Indicates if the import job has custom headers.
|
|
541
|
+
*/
|
|
542
|
+
hasCustomHeaders: () => boolean;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Indicates if the import job has custom import js.
|
|
546
|
+
*/
|
|
547
|
+
hasCustomImportJs: () => boolean;
|
|
538
548
|
}
|
|
539
549
|
|
|
540
550
|
export interface ImportUrl {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
-
hasText, isIsoDate, isValidUrl, isObject, isString, isNumber, isInteger,
|
|
14
|
+
hasText, isIsoDate, isValidUrl, isObject, isString, isNumber, isInteger, isBoolean,
|
|
15
15
|
} from '@adobe/spacecat-shared-utils';
|
|
16
16
|
import { Base } from '../base.js';
|
|
17
17
|
import { ImportJobStatus, ImportOptions } from './import-constants.js';
|
|
@@ -39,6 +39,8 @@ const ImportJob = (data) => {
|
|
|
39
39
|
self.getRedirectCount = () => self.state.redirectCount;
|
|
40
40
|
self.getImportQueueId = () => self.state.importQueueId;
|
|
41
41
|
self.getInitiatedBy = () => self.state.initiatedBy;
|
|
42
|
+
self.hasCustomHeaders = () => self.state.hasCustomHeaders || false;
|
|
43
|
+
self.hasCustomImportJs = () => self.state.hasCustomImportJs || false;
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* Updates the state of the ImportJob.
|
|
@@ -147,6 +149,29 @@ const ImportJob = (data) => {
|
|
|
147
149
|
},
|
|
148
150
|
);
|
|
149
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Update the hasCustomHeaders value to true if the ImportJob has custom headers, false otherwise.
|
|
154
|
+
* @param {boolean} hasCustomHeaders - The new value for hasCustomHeaders.
|
|
155
|
+
* @return {ImportJob} The updated ImportJob object.
|
|
156
|
+
*/
|
|
157
|
+
self.updateHasCustomHeaders = (hasCustomHeaders) => updateState('hasCustomHeaders', hasCustomHeaders, (value) => {
|
|
158
|
+
if (!isBoolean(value)) {
|
|
159
|
+
throw new Error(`Invalid hasCustomHeaders value: ${value}`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Update the hasCustomImportJs value to true if the ImportJob has custom import js, false
|
|
165
|
+
* otherwise.
|
|
166
|
+
* @param {boolean} hasCustomImportJs - The new value for hasCustomImportJs.
|
|
167
|
+
* @return {ImportJob} The updated ImportJob object.
|
|
168
|
+
*/
|
|
169
|
+
self.updateHasCustomImportJs = (hasCustomImportJs) => updateState('hasCustomImportJs', hasCustomImportJs, (value) => {
|
|
170
|
+
if (!isBoolean(value)) {
|
|
171
|
+
throw new Error(`Invalid hasCustomImportJs value: ${value}`);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
150
175
|
return Object.freeze(self);
|
|
151
176
|
};
|
|
152
177
|
|
|
@@ -215,5 +240,13 @@ export const createImportJob = (data) => {
|
|
|
215
240
|
});
|
|
216
241
|
}
|
|
217
242
|
|
|
243
|
+
if (newState.hasCustomImportJs && !isBoolean(newState.hasCustomImportJs)) {
|
|
244
|
+
throw new Error(`Invalid hasCustomImportJs value: ${newState.hasCustomImportJs}`);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (newState.hasCustomHeaders && !isBoolean(newState.hasCustomHeaders)) {
|
|
248
|
+
throw new Error(`Invalid hasCustomHeaders value: ${newState.hasCustomHeaders}`);
|
|
249
|
+
}
|
|
250
|
+
|
|
218
251
|
return ImportJob(newState);
|
|
219
252
|
};
|