@adobe/spacecat-shared-data-access 1.25.1 → 1.26.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/index.d.ts +10 -0
- package/src/index.js +7 -0
- package/src/models/importer/import-job.js +3 -3
- package/src/models/importer/import-url.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.26.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.25.1...@adobe/spacecat-shared-data-access-v1.26.0) (2024-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add PENDING status for import URL entities ([#259](https://github.com/adobe/spacecat-shared/issues/259)) ([031194c](https://github.com/adobe/spacecat-shared/commit/031194cb91434ae66bc3870e63e29167ea94de8f)), closes [#258](https://github.com/adobe/spacecat-shared/issues/258)
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v1.25.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.25.0...@adobe/spacecat-shared-data-access-v1.25.1) (2024-06-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -677,3 +677,13 @@ export function createDataAccess(
|
|
|
677
677
|
config: DataAccessConfig,
|
|
678
678
|
logger: object,
|
|
679
679
|
): DataAccess;
|
|
680
|
+
|
|
681
|
+
export interface ImportJobStatus {
|
|
682
|
+
RUNNING: string,
|
|
683
|
+
COMPLETE: string,
|
|
684
|
+
FAILED: string,
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export interface ImportUrlStatus extends ImportJobStatus {
|
|
688
|
+
PENDING: string,
|
|
689
|
+
}
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { createDataAccess } from './service/index.js';
|
|
14
|
+
import { ImportJobStatus } from './models/importer/import-job.js';
|
|
15
|
+
import { ImportUrlStatus } from './models/importer/import-url.js';
|
|
14
16
|
|
|
15
17
|
const TABLE_NAME_AUDITS = 'spacecat-services-audits-dev';
|
|
16
18
|
const TABLE_NAME_KEY_EVENTS = 'spacecat-services-key-events';
|
|
@@ -95,3 +97,8 @@ export default function dataAccessWrapper(fn) {
|
|
|
95
97
|
return fn(request, context);
|
|
96
98
|
};
|
|
97
99
|
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
ImportJobStatus,
|
|
103
|
+
ImportUrlStatus,
|
|
104
|
+
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@adobe/spacecat-shared-utils';
|
|
16
16
|
import { Base } from '../base.js';
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const ImportJobStatus = {
|
|
19
19
|
RUNNING: 'RUNNING',
|
|
20
20
|
COMPLETE: 'COMPLETE',
|
|
21
21
|
FAILED: 'FAILED',
|
|
@@ -79,7 +79,7 @@ const ImportJob = (data) => {
|
|
|
79
79
|
* @returns {ImportJob} The updated ImportJob object.
|
|
80
80
|
*/
|
|
81
81
|
self.updateStatus = (status) => {
|
|
82
|
-
if (!Object.values(
|
|
82
|
+
if (!Object.values(ImportJobStatus).includes(status)) {
|
|
83
83
|
throw new Error(`Invalid Import Job status during update: ${status}`);
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -163,7 +163,7 @@ export const createImportJob = (data) => {
|
|
|
163
163
|
newState.startTime = new Date().toISOString();
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
if (!Object.values(
|
|
166
|
+
if (!Object.values(ImportJobStatus).includes(newState.status)) {
|
|
167
167
|
throw new Error(`Invalid Import Job status ${newState.status}`);
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import { isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
import { Base } from '../base.js';
|
|
15
|
-
import {
|
|
15
|
+
import { ImportJobStatus } from './import-job.js';
|
|
16
|
+
|
|
17
|
+
export const ImportUrlStatus = {
|
|
18
|
+
PENDING: 'PENDING',
|
|
19
|
+
...ImportJobStatus,
|
|
20
|
+
};
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Creates a new ImportUrl object
|
|
@@ -31,7 +36,7 @@ const ImportUrl = (data) => {
|
|
|
31
36
|
* Updates the status of the ImportUrl
|
|
32
37
|
*/
|
|
33
38
|
self.updateStatus = (status) => {
|
|
34
|
-
if (!Object.values(
|
|
39
|
+
if (!Object.values(ImportUrlStatus).includes(status)) {
|
|
35
40
|
throw new Error(`Invalid Import URL status during update: ${status}`);
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -53,7 +58,7 @@ export const createImportUrl = (data) => {
|
|
|
53
58
|
throw new Error(`Invalid Url: ${newState.url}`);
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
if (!Object.values(
|
|
61
|
+
if (!Object.values(ImportUrlStatus).includes(newState.status)) {
|
|
57
62
|
throw new Error(`Invalid Import URL status: ${newState.status}`);
|
|
58
63
|
}
|
|
59
64
|
|