@adobe/spacecat-shared-data-access 1.43.4 → 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,10 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
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<
|
|
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
|
});
|