@adobe/spacecat-shared-data-access 1.29.0 → 1.29.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.29.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.29.1...@adobe/spacecat-shared-data-access-v1.29.2) (2024-06-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [#268](https://github.com/adobe/spacecat-shared/issues/268) Import URL entities need a REDIRECT status, and additional properties for reporting ([#269](https://github.com/adobe/spacecat-shared/issues/269)) ([88bb491](https://github.com/adobe/spacecat-shared/commit/88bb49105a9b0a9cd297fe9667aff1df24bcee03))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.29.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.29.0...@adobe/spacecat-shared-data-access-v1.29.1) (2024-06-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#266](https://github.com/adobe/spacecat-shared/issues/266)) ([a89ab83](https://github.com/adobe/spacecat-shared/commit/a89ab83e1c108c10044f6d098526bafed67b88b2))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.29.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.28.0...@adobe/spacecat-shared-data-access-v1.29.0) (2024-06-13)
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.29.0",
3
+ "version": "1.29.2",
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.592.0",
35
- "@aws-sdk/lib-dynamodb": "3.592.0",
34
+ "@aws-sdk/client-dynamodb": "3.598.0",
35
+ "@aws-sdk/lib-dynamodb": "3.598.0",
36
36
  "@types/joi": "17.2.3",
37
37
  "joi": "17.13.1",
38
38
  "uuid": "10.0.0"
@@ -26,6 +26,9 @@ export const ImportUrlDto = {
26
26
  jobId: importUrl.getJobId(),
27
27
  url: importUrl.getUrl(),
28
28
  status: importUrl.getStatus(),
29
+ reason: importUrl.getReason(),
30
+ path: importUrl.getPath(),
31
+ file: importUrl.getFile(),
29
32
  }),
30
33
 
31
34
  /**
@@ -37,6 +40,9 @@ export const ImportUrlDto = {
37
40
  jobId: dynamoItem.jobId,
38
41
  url: dynamoItem.url,
39
42
  status: dynamoItem.status,
43
+ reason: dynamoItem.reason,
44
+ path: dynamoItem.path,
45
+ file: dynamoItem.file,
40
46
  };
41
47
  return createImportUrl(importUrlData);
42
48
  },
@@ -10,12 +10,13 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { isValidUrl } from '@adobe/spacecat-shared-utils';
13
+ import { hasText, isValidUrl } from '@adobe/spacecat-shared-utils';
14
14
  import { Base } from '../base.js';
15
15
  import { ImportJobStatus } from './import-job.js';
16
16
 
17
17
  export const ImportUrlStatus = {
18
18
  PENDING: 'PENDING',
19
+ REDIRECT: 'REDIRECT',
19
20
  ...ImportJobStatus,
20
21
  };
21
22
 
@@ -31,11 +32,16 @@ const ImportUrl = (data) => {
31
32
  self.getJobId = () => self.state.jobId;
32
33
  self.getUrl = () => self.state.url;
33
34
  self.getStatus = () => self.state.status;
35
+ self.getReason = () => self.state.reason;
36
+ // Absolute path to the resource that is being imported for the given URL
37
+ self.getPath = () => self.state.path;
38
+ // Resulting path and filename of the imported .docx file
39
+ self.getFile = () => self.state.file;
34
40
 
35
41
  /**
36
- * Updates the status of the ImportUrl
37
- */
38
- self.updateStatus = (status) => {
42
+ * Updates the status of the ImportUrl
43
+ */
44
+ self.setStatus = (status) => {
39
45
  if (!Object.values(ImportUrlStatus).includes(status)) {
40
46
  throw new Error(`Invalid Import URL status during update: ${status}`);
41
47
  }
@@ -45,6 +51,47 @@ const ImportUrl = (data) => {
45
51
 
46
52
  return self;
47
53
  };
54
+
55
+ /**
56
+ * Updates the reason that the import of this URL was not successful
57
+ */
58
+ self.setReason = (reason) => {
59
+ if (!hasText(reason)) {
60
+ return self; // no-op
61
+ }
62
+
63
+ self.state.reason = reason;
64
+ self.touch();
65
+ return self;
66
+ };
67
+
68
+ /**
69
+ * Updates the path of the ImportUrl
70
+ */
71
+ self.setPath = (path) => {
72
+ if (!hasText(path)) {
73
+ return self; // no-op
74
+ }
75
+
76
+ self.state.path = path;
77
+ self.touch();
78
+ return self;
79
+ };
80
+
81
+ /**
82
+ * Updates the file of the ImportUrl. This is the path and file name of the file which
83
+ * was imported.
84
+ */
85
+ self.setFile = (file) => {
86
+ if (!hasText(file)) {
87
+ return self; // no-op
88
+ }
89
+
90
+ self.state.file = file;
91
+ self.touch();
92
+ return self;
93
+ };
94
+
48
95
  return Object.freeze(self);
49
96
  };
50
97