@adobe/spacecat-shared-data-access 1.33.1 → 1.34.1
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 +3 -3
- package/src/dto/site-candidate.js +2 -0
- package/src/dto/site.js +2 -0
- package/src/models/site-candidate.js +16 -1
- package/src/models/site.js +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.34.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.34.0...@adobe/spacecat-shared-data-access-v1.34.1) (2024-06-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#279](https://github.com/adobe/spacecat-shared/issues/279)) ([4710607](https://github.com/adobe/spacecat-shared/commit/471060797fac55649ff0c0ea24129bdd421d46b2))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.34.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.33.1...@adobe/spacecat-shared-data-access-v1.34.0) (2024-06-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add helix config to site/candidates ([#277](https://github.com/adobe/spacecat-shared/issues/277)) ([5ed489d](https://github.com/adobe/spacecat-shared/commit/5ed489dc84cb594689092e1f0019dd83d3647039))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.33.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.33.0...@adobe/spacecat-shared-data-access-v1.33.1) (2024-06-27)
|
|
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.
|
|
3
|
+
"version": "1.34.1",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@adobe/spacecat-shared-dynamo": "1.2.5",
|
|
33
33
|
"@adobe/spacecat-shared-utils": "1.2.0",
|
|
34
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
35
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
34
|
+
"@aws-sdk/client-dynamodb": "3.606.0",
|
|
35
|
+
"@aws-sdk/lib-dynamodb": "3.606.0",
|
|
36
36
|
"@types/joi": "17.2.3",
|
|
37
37
|
"joi": "17.13.3",
|
|
38
38
|
"uuid": "10.0.0"
|
|
@@ -23,6 +23,7 @@ export const SiteCandidateDto = {
|
|
|
23
23
|
*/
|
|
24
24
|
toDynamoItem: (siteCandidate) => ({
|
|
25
25
|
baseURL: siteCandidate.getBaseURL(),
|
|
26
|
+
hlxConfig: siteCandidate.getHlxConfig(),
|
|
26
27
|
siteId: siteCandidate.getSiteId(),
|
|
27
28
|
source: siteCandidate.getSource(),
|
|
28
29
|
status: siteCandidate.getStatus(),
|
|
@@ -39,6 +40,7 @@ export const SiteCandidateDto = {
|
|
|
39
40
|
fromDynamoItem: (dynamoItem) => {
|
|
40
41
|
const siteCandidateData = {
|
|
41
42
|
baseURL: dynamoItem.baseURL,
|
|
43
|
+
hlxConfig: dynamoItem.hlxConfig,
|
|
42
44
|
siteId: dynamoItem.siteId,
|
|
43
45
|
source: dynamoItem.source,
|
|
44
46
|
status: dynamoItem.status,
|
package/src/dto/site.js
CHANGED
|
@@ -28,6 +28,7 @@ export const SiteDto = {
|
|
|
28
28
|
baseURL: site.getBaseURL(),
|
|
29
29
|
deliveryType: site.getDeliveryType(),
|
|
30
30
|
gitHubURL: site.getGitHubURL() || '',
|
|
31
|
+
hlxConfig: site.getHlxConfig(),
|
|
31
32
|
organizationId: site.getOrganizationId() || '',
|
|
32
33
|
isLive: site.isLive(),
|
|
33
34
|
isLiveToggledAt: site.getIsLiveToggledAt(),
|
|
@@ -49,6 +50,7 @@ export const SiteDto = {
|
|
|
49
50
|
baseURL: dynamoItem.baseURL,
|
|
50
51
|
deliveryType: dynamoItem.deliveryType,
|
|
51
52
|
gitHubURL: dynamoItem.gitHubURL,
|
|
53
|
+
hlxConfig: dynamoItem.hlxConfig,
|
|
52
54
|
organizationId: dynamoItem.organizationId,
|
|
53
55
|
isLive: dynamoItem.isLive,
|
|
54
56
|
isLiveToggledAt: dynamoItem.isLiveToggledAt,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { hasText, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
13
|
+
import { hasText, isObject, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
|
|
15
15
|
import { Base } from './base.js';
|
|
16
16
|
|
|
@@ -43,6 +43,7 @@ const SiteCandidate = (data = {}) => {
|
|
|
43
43
|
delete self.state.id; // no id property used in SiteCandidate modal
|
|
44
44
|
|
|
45
45
|
self.getBaseURL = () => self.state.baseURL;
|
|
46
|
+
self.getHlxConfig = () => self.state.hlxConfig;
|
|
46
47
|
self.getSiteId = () => self.state.siteId;
|
|
47
48
|
self.getSource = () => self.state.source;
|
|
48
49
|
self.getStatus = () => self.state.status;
|
|
@@ -54,6 +55,12 @@ const SiteCandidate = (data = {}) => {
|
|
|
54
55
|
return self;
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
self.setHlxConfig = (hlxConfig) => {
|
|
59
|
+
self.state.hlxConfig = hlxConfig;
|
|
60
|
+
self.touch();
|
|
61
|
+
return self;
|
|
62
|
+
};
|
|
63
|
+
|
|
57
64
|
self.setSource = (source) => {
|
|
58
65
|
self.state.source = source;
|
|
59
66
|
self.touch();
|
|
@@ -88,6 +95,14 @@ export const createSiteCandidate = (data) => {
|
|
|
88
95
|
throw new Error(`Base URL must be a valid URL: ${newState.baseURL}`);
|
|
89
96
|
}
|
|
90
97
|
|
|
98
|
+
if (newState.hlxConfig && !isObject(newState.hlxConfig)) {
|
|
99
|
+
throw new Error(`HLX Config must be an object: ${newState.hlxConfig}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!newState.hlxConfig) {
|
|
103
|
+
newState.hlxConfig = {};
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
if (!hasText(newState.updatedBy)) {
|
|
92
107
|
newState.updatedBy = DEFAULT_UPDATED_BY;
|
|
93
108
|
}
|
package/src/models/site.js
CHANGED
|
@@ -40,6 +40,7 @@ const Site = (data = {}) => {
|
|
|
40
40
|
self.getConfig = () => self.state.config;
|
|
41
41
|
self.getDeliveryType = () => self.state.deliveryType;
|
|
42
42
|
self.getGitHubURL = () => self.state.gitHubURL;
|
|
43
|
+
self.getHlxConfig = () => self.state.hlxConfig;
|
|
43
44
|
self.getOrganizationId = () => self.state.organizationId;
|
|
44
45
|
self.isLive = () => self.state.isLive;
|
|
45
46
|
self.getIsLiveToggledAt = () => self.state.isLiveToggledAt;
|
|
@@ -136,6 +137,23 @@ const Site = (data = {}) => {
|
|
|
136
137
|
return self;
|
|
137
138
|
};
|
|
138
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Updates the Helix Configuration for this site.
|
|
142
|
+
* @param {object} hlxConfig - The Helix Configuration.
|
|
143
|
+
* @throws {Error} If the provided Helix Configuration is not an object.
|
|
144
|
+
* @return {Base} The updated site.
|
|
145
|
+
*/
|
|
146
|
+
self.updateHlxConfig = (hlxConfig) => {
|
|
147
|
+
if (!isObject(hlxConfig)) {
|
|
148
|
+
throw new Error('HLX Config must be an object');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
self.state.hlxConfig = hlxConfig;
|
|
152
|
+
self.touch();
|
|
153
|
+
|
|
154
|
+
return self;
|
|
155
|
+
};
|
|
156
|
+
|
|
139
157
|
/**
|
|
140
158
|
* Updates the organizationId the site belongs to.
|
|
141
159
|
* @param {string} organizationId - The Org ID.
|
|
@@ -179,6 +197,14 @@ export const createSite = (data) => {
|
|
|
179
197
|
throw new Error(`Base URL must be a valid URL: ${newState.baseURL}`);
|
|
180
198
|
}
|
|
181
199
|
|
|
200
|
+
if (newState.hlxConfig && !isObject(newState.hlxConfig)) {
|
|
201
|
+
throw new Error(`HLX Config must be an object: ${newState.hlxConfig}`);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (!newState.hlxConfig) {
|
|
205
|
+
newState.hlxConfig = {};
|
|
206
|
+
}
|
|
207
|
+
|
|
182
208
|
if (!hasText(newState.organizationId)) {
|
|
183
209
|
newState.organizationId = DEFAULT_ORGANIZATION_ID;
|
|
184
210
|
}
|