@adobe/spacecat-shared-data-access 1.6.4 → 1.7.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.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)
2
+
3
+
4
+ ### Features
5
+
6
+ * set isLiveToggledAt ([#85](https://github.com/adobe/spacecat-shared/issues/85)) ([cefc093](https://github.com/adobe/spacecat-shared/commit/cefc0938385b9fa079d24c24f03b21651a0999cc))
7
+
1
8
  # [@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
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
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.
@@ -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