@adobe/spacecat-shared-data-access 1.6.1 → 1.6.3
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 +14 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -1
- package/src/service/sites/accessPatterns.js +9 -1
- package/src/service/sites/index.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.6.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.6.2...@adobe/spacecat-shared-data-access-v1.6.3) (2024-01-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* get latest audits with delivery type ([#80](https://github.com/adobe/spacecat-shared/issues/80)) ([d823773](https://github.com/adobe/spacecat-shared/commit/d823773d738ebddf2790356750827ae74e66b052))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.6.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.6.1...@adobe/spacecat-shared-data-access-v1.6.2) (2024-01-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* getSitesByDeliveryType signature ([#78](https://github.com/adobe/spacecat-shared/issues/78)) ([2b6c0fd](https://github.com/adobe/spacecat-shared/commit/2b6c0fd3e603eb3c688a45ae9ab78baf88a508ef))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.6.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.6.0...@adobe/spacecat-shared-data-access-v1.6.1) (2024-01-12)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -242,11 +242,14 @@ export interface DataAccess {
|
|
|
242
242
|
siteId: string,
|
|
243
243
|
) => Promise<void>;
|
|
244
244
|
getSites: () => Promise<Site[]>;
|
|
245
|
-
getSitesByDeliveryType: (
|
|
245
|
+
getSitesByDeliveryType: (
|
|
246
|
+
deliveryType: string,
|
|
247
|
+
) => Promise<Site[]>;
|
|
246
248
|
getSitesToAudit: () => Promise<string[]>;
|
|
247
249
|
getSitesWithLatestAudit: (
|
|
248
250
|
auditType: string,
|
|
249
251
|
sortAuditsAscending?: boolean,
|
|
252
|
+
deliveryType?: string,
|
|
250
253
|
) => Promise<Site[]>;
|
|
251
254
|
getSiteByBaseURL: (
|
|
252
255
|
baseUrl: string,
|
|
@@ -50,6 +50,10 @@ export const getSites = async (dynamoClient, config) => {
|
|
|
50
50
|
* specified delivery type.
|
|
51
51
|
*/
|
|
52
52
|
export const getSitesByDeliveryType = async (dynamoClient, config, deliveryType) => {
|
|
53
|
+
if (deliveryType === 'all') {
|
|
54
|
+
return getSites(dynamoClient, config);
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
const dynamoItems = await dynamoClient.query({
|
|
54
58
|
TableName: config.tableNameSites,
|
|
55
59
|
IndexName: config.indexNameAllSitesByDeliveryType,
|
|
@@ -87,6 +91,9 @@ export const getSitesToAudit = async (dynamoClient, config) => {
|
|
|
87
91
|
* @param {Logger} log - The logger.
|
|
88
92
|
* @param {string} auditType - The type of audits to retrieve for the sites.
|
|
89
93
|
* @param {boolean} [sortAuditsAscending=true] - Determines if the audits should be sorted in
|
|
94
|
+
* ascending order.
|
|
95
|
+
* @param {string} [deliveryType=DEFAULT_DELIVERY_TYPE] - The delivery type of the sites
|
|
96
|
+
* to retrieve.
|
|
90
97
|
* @return {Promise<Readonly<Site>[]>} A promise that resolves to an array of sites with their
|
|
91
98
|
* latest audit.
|
|
92
99
|
*/
|
|
@@ -96,9 +103,10 @@ export const getSitesWithLatestAudit = async (
|
|
|
96
103
|
log,
|
|
97
104
|
auditType,
|
|
98
105
|
sortAuditsAscending = true,
|
|
106
|
+
deliveryType = 'all',
|
|
99
107
|
) => {
|
|
100
108
|
const [sites, latestAudits] = await Promise.all([
|
|
101
|
-
|
|
109
|
+
getSitesByDeliveryType(dynamoClient, config, deliveryType),
|
|
102
110
|
getLatestAudits(dynamoClient, config, log, auditType, sortAuditsAscending),
|
|
103
111
|
]);
|
|
104
112
|
|
|
@@ -37,12 +37,17 @@ export const siteFunctions = (dynamoClient, config, log) => ({
|
|
|
37
37
|
dynamoClient,
|
|
38
38
|
config,
|
|
39
39
|
),
|
|
40
|
-
getSitesWithLatestAudit: (
|
|
40
|
+
getSitesWithLatestAudit: (
|
|
41
|
+
auditType,
|
|
42
|
+
sortAuditsAscending,
|
|
43
|
+
deliveryType,
|
|
44
|
+
) => getSitesWithLatestAudit(
|
|
41
45
|
dynamoClient,
|
|
42
46
|
config,
|
|
43
47
|
log,
|
|
44
48
|
auditType,
|
|
45
49
|
sortAuditsAscending,
|
|
50
|
+
deliveryType,
|
|
46
51
|
),
|
|
47
52
|
getSiteByBaseURL: (baseUrl) => getSiteByBaseURL(
|
|
48
53
|
dynamoClient,
|