@adobe/spacecat-shared-data-access 1.43.3 → 1.44.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.44.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.43.4...@adobe/spacecat-shared-data-access-v1.44.0) (2024-09-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add a query to get all import urls by jobId ([#365](https://github.com/adobe/spacecat-shared/issues/365)) ([17b216d](https://github.com/adobe/spacecat-shared/commit/17b216d75f3573480e257c36101b0388dc1772be)), closes [/github.com/adobe/spacecat-content-processor/pull/143#discussion_r1754542157](https://github.com//github.com/adobe/spacecat-content-processor/pull/143/issues/discussion_r1754542157)
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.43.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.43.3...@adobe/spacecat-shared-data-access-v1.43.4) (2024-09-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#360](https://github.com/adobe/spacecat-shared/issues/360)) ([315f6e4](https://github.com/adobe/spacecat-shared/commit/315f6e42798d78d33f435e67f70e9a35d05ecf2b))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.43.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.43.2...@adobe/spacecat-shared-data-access-v1.43.3) (2024-08-24)
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.43.3",
3
+ "version": "1.44.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,8 +35,8 @@
35
35
  "dependencies": {
36
36
  "@adobe/spacecat-shared-dynamo": "1.2.5",
37
37
  "@adobe/spacecat-shared-utils": "1.2.0",
38
- "@aws-sdk/client-dynamodb": "3.637.0",
39
- "@aws-sdk/lib-dynamodb": "3.637.0",
38
+ "@aws-sdk/client-dynamodb": "3.645.0",
39
+ "@aws-sdk/lib-dynamodb": "3.645.0",
40
40
  "@types/joi": "17.2.3",
41
41
  "joi": "17.13.3",
42
42
  "uuid": "10.0.0"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "chai": "5.1.1",
46
46
  "chai-as-promised": "8.0.0",
47
- "dynamo-db-local": "9.2.0",
47
+ "dynamo-db-local": "9.2.1",
48
48
  "sinon": "18.0.0",
49
49
  "sinon-chai": "4.0.0"
50
50
  }
package/src/index.d.ts CHANGED
@@ -779,6 +779,9 @@ export interface DataAccess {
779
779
  jobId: string,
780
780
  status: string,
781
781
  ) => Promise<ImportUrl[]>;
782
+ getImportUrlsByJobId: (
783
+ jobId: string,
784
+ ) => Promise<ImportUrl[]>;
782
785
  getApiKeyByHashedApiKey: (
783
786
  hashedApiKey: string,
784
787
  ) => Promise<ApiKey | null>;
@@ -79,7 +79,7 @@ export const updateImportUrl = async (dynamoClient, config, log, importUrl) => {
79
79
  * @param {Logger} log
80
80
  * @param {string} jobId
81
81
  * @param {string} status
82
- * @returns {Promise<ImportUrlDto[]>}
82
+ * @returns {Promise<ImportUrl[]>}
83
83
  */
84
84
  export const getImportUrlsByJobIdAndStatus = async (dynamoClient, config, log, jobId, status) => {
85
85
  const items = await dynamoClient.query({
@@ -96,3 +96,23 @@ export const getImportUrlsByJobIdAndStatus = async (dynamoClient, config, log, j
96
96
  });
97
97
  return items.map((item) => ImportUrlDto.fromDynamoItem(item));
98
98
  };
99
+
100
+ /**
101
+ * Get Import Urls by Job ID
102
+ * @param {DynamoClient} dynamoClient
103
+ * @param {Object} config
104
+ * @param {Logger} log
105
+ * @param {string} jobId
106
+ * @returns {Promise<ImportUrl[]>}
107
+ */
108
+ export const getImportUrlsByJobId = async (dynamoClient, config, log, jobId) => {
109
+ const items = await dynamoClient.query({
110
+ TableName: config.tableNameImportUrls,
111
+ IndexName: config.indexNameImportUrlsByJobIdAndStatus,
112
+ KeyConditionExpression: 'jobId = :jobId',
113
+ ExpressionAttributeValues: {
114
+ ':jobId': jobId,
115
+ },
116
+ });
117
+ return items.map((item) => ImportUrlDto.fromDynamoItem(item));
118
+ };
@@ -15,6 +15,7 @@ import {
15
15
  createNewImportUrl,
16
16
  updateImportUrl,
17
17
  getImportUrlsByJobIdAndStatus,
18
+ getImportUrlsByJobId,
18
19
  } from './accessPatterns.js';
19
20
 
20
21
  export const importUrlFunctions = (dynamoClient, config, log) => ({
@@ -43,4 +44,10 @@ export const importUrlFunctions = (dynamoClient, config, log) => ({
43
44
  jobId,
44
45
  status,
45
46
  ),
47
+ getImportUrlsByJobId: (jobId) => getImportUrlsByJobId(
48
+ dynamoClient,
49
+ config,
50
+ log,
51
+ jobId,
52
+ ),
46
53
  });