@adobe/spacecat-shared-data-access 1.25.0 → 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 CHANGED
@@ -1,3 +1,17 @@
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
+
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)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#256](https://github.com/adobe/spacecat-shared/issues/256)) ([f28b6b6](https://github.com/adobe/spacecat-shared/commit/f28b6b6f520a8dfb8e82a7302da1b8c5e6bc4390))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.25.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.24.0...@adobe/spacecat-shared-data-access-v1.25.0) (2024-06-07)
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.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "@adobe/spacecat-shared-dynamo": "1.2.5",
33
33
  "@adobe/spacecat-shared-utils": "1.2.0",
34
- "@aws-sdk/client-dynamodb": "3.588.0",
35
- "@aws-sdk/lib-dynamodb": "3.588.0",
34
+ "@aws-sdk/client-dynamodb": "3.592.0",
35
+ "@aws-sdk/lib-dynamodb": "3.592.0",
36
36
  "@types/joi": "17.2.3",
37
37
  "joi": "17.13.1",
38
38
  "uuid": "9.0.1"
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 IMPORT_JOB_STATUS = {
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(IMPORT_JOB_STATUS).includes(status)) {
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(IMPORT_JOB_STATUS).includes(newState.status)) {
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 { IMPORT_JOB_STATUS } from './import-job.js';
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(IMPORT_JOB_STATUS).includes(status)) {
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(IMPORT_JOB_STATUS).includes(newState.status)) {
61
+ if (!Object.values(ImportUrlStatus).includes(newState.status)) {
57
62
  throw new Error(`Invalid Import URL status: ${newState.status}`);
58
63
  }
59
64