@adobe/spacecat-shared-data-access 1.6.4 → 1.8.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 +14 -0
- package/package.json +1 -1
- package/src/dto/site.js +2 -0
- package/src/index.d.ts +6 -0
- package/src/models/audit.js +3 -1
- package/src/models/site.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.8.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.7.0...@adobe/spacecat-shared-data-access-v1.8.0) (2024-01-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add broken-backlinks audit type (SITES-18417) ([#86](https://github.com/adobe/spacecat-shared/issues/86)) ([b16c366](https://github.com/adobe/spacecat-shared/commit/b16c3667808221958ff4a526512cb89c3cd0bbcb))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.7.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.6.4...@adobe/spacecat-shared-data-access-v1.7.0) (2024-01-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* set isLiveToggledAt ([#85](https://github.com/adobe/spacecat-shared/issues/85)) ([cefc093](https://github.com/adobe/spacecat-shared/commit/cefc0938385b9fa079d24c24f03b21651a0999cc))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.6.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.6.3...@adobe/spacecat-shared-data-access-v1.6.4) (2024-01-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/dto/site.js
CHANGED
|
@@ -29,6 +29,7 @@ export const SiteDto = {
|
|
|
29
29
|
gitHubURL: site.getGitHubURL() || '',
|
|
30
30
|
imsOrgId: site.getImsOrgId() || '',
|
|
31
31
|
isLive: site.isLive(),
|
|
32
|
+
isLiveToggledAt: site.getIsLiveToggledAt(),
|
|
32
33
|
createdAt: site.getCreatedAt(),
|
|
33
34
|
updatedAt: site.getUpdatedAt(),
|
|
34
35
|
GSI1PK: 'ALL_SITES',
|
|
@@ -48,6 +49,7 @@ export const SiteDto = {
|
|
|
48
49
|
gitHubURL: dynamoItem.gitHubURL,
|
|
49
50
|
imsOrgId: dynamoItem.imsOrgId,
|
|
50
51
|
isLive: dynamoItem.isLive,
|
|
52
|
+
isLiveToggledAt: dynamoItem.isLiveToggledAt,
|
|
51
53
|
createdAt: dynamoItem.createdAt,
|
|
52
54
|
updatedAt: dynamoItem.updatedAt,
|
|
53
55
|
auditConfig: dynamoItem.auditConfig,
|
package/src/index.d.ts
CHANGED
|
@@ -185,6 +185,12 @@ export interface Site {
|
|
|
185
185
|
*/
|
|
186
186
|
isLive: () => boolean;
|
|
187
187
|
|
|
188
|
+
/**
|
|
189
|
+
* The timestamp when the site was last toggled to live or non-live.
|
|
190
|
+
* @returns {string} The timestamp when the site was last toggled to live or non-live.
|
|
191
|
+
*/
|
|
192
|
+
getIsLiveToggledAt: () => string;
|
|
193
|
+
|
|
188
194
|
/**
|
|
189
195
|
* Updates the list of audits for the site.
|
|
190
196
|
* @param {Audit[]} audits The new list of audits.
|
package/src/models/audit.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { hasText, isIsoDate, isObject } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
import { Base } from './base.js';
|
|
15
15
|
|
|
16
|
+
export const AUDIT_TYPE_BROKEN_BACKLINKS = 'broken-backlinks';
|
|
16
17
|
export const AUDIT_TYPE_CWV = 'cwv';
|
|
17
18
|
export const AUDIT_TYPE_LHS_DESKTOP = 'lhs-desktop';
|
|
18
19
|
export const AUDIT_TYPE_LHS_MOBILE = 'lhs-mobile';
|
|
@@ -20,6 +21,7 @@ export const AUDIT_TYPE_LHS_MOBILE = 'lhs-mobile';
|
|
|
20
21
|
const EXPIRES_IN_DAYS = 30;
|
|
21
22
|
|
|
22
23
|
const AUDIT_TYPE_PROPERTIES = {
|
|
24
|
+
[AUDIT_TYPE_BROKEN_BACKLINKS]: [],
|
|
23
25
|
[AUDIT_TYPE_CWV]: [],
|
|
24
26
|
[AUDIT_TYPE_LHS_DESKTOP]: ['performance', 'seo', 'accessibility', 'best-practices'],
|
|
25
27
|
[AUDIT_TYPE_LHS_MOBILE]: ['performance', 'seo', 'accessibility', 'best-practices'],
|
|
@@ -36,7 +38,7 @@ const validateScores = (auditResult, auditType) => {
|
|
|
36
38
|
return true;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
if (!isObject(auditResult.scores)) {
|
|
41
|
+
if (auditType !== AUDIT_TYPE_BROKEN_BACKLINKS && !isObject(auditResult.scores)) {
|
|
40
42
|
throw new Error(`Missing scores property for audit type '${auditType}'`);
|
|
41
43
|
}
|
|
42
44
|
|
package/src/models/site.js
CHANGED
|
@@ -39,6 +39,7 @@ const Site = (data = {}) => {
|
|
|
39
39
|
self.getGitHubURL = () => self.state.gitHubURL;
|
|
40
40
|
self.getImsOrgId = () => self.state.imsOrgId;
|
|
41
41
|
self.isLive = () => self.state.isLive;
|
|
42
|
+
self.getIsLiveToggledAt = () => self.state.isLiveToggledAt;
|
|
42
43
|
|
|
43
44
|
// TODO: updating the baseURL is not supported yet, it will require a transact write
|
|
44
45
|
// on dynamodb (put then delete) since baseURL is part of the primary key, something like:
|
|
@@ -143,6 +144,7 @@ const Site = (data = {}) => {
|
|
|
143
144
|
*/
|
|
144
145
|
self.toggleLive = () => {
|
|
145
146
|
self.state.isLive = !self.state.isLive;
|
|
147
|
+
self.state.isLiveToggledAt = new Date().toISOString();
|
|
146
148
|
return self;
|
|
147
149
|
};
|
|
148
150
|
|