@adobe/spacecat-shared-data-access 1.13.0 → 1.13.2

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,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.13.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.13.1...@adobe/spacecat-shared-data-access-v1.13.2) (2024-01-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * config validation ([edc1276](https://github.com/adobe/spacecat-shared/commit/edc127681e26c3283e5ecc94cde7c5fec78529dd))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.13.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.13.0...@adobe/spacecat-shared-data-access-v1.13.1) (2024-01-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * allow update config for site ([ad9e677](https://github.com/adobe/spacecat-shared/commit/ad9e677c7c721aa70e37b97373a4b9545f2f21fd))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.13.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.12.0...@adobe/spacecat-shared-data-access-v1.13.0) (2024-01-30)
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.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -18,11 +18,11 @@ export const configSchema = Joi.object({
18
18
  channel: Joi.string(),
19
19
  }),
20
20
  alerts: Joi.array().items(Joi.object({
21
- type: Joi.string(),
21
+ type: Joi.string().required(),
22
22
  byOrg: Joi.boolean(),
23
23
  mentions: Joi.array().items(Joi.object({ slack: Joi.array().items(Joi.string()) })),
24
- })),
25
- });
24
+ }).unknown(true)),
25
+ }).unknown(true);
26
26
 
27
27
  export const DEFAULT_CONFIG = {
28
28
  slack: {
@@ -93,6 +93,22 @@ const Site = (data = {}) => {
93
93
  return self;
94
94
  };
95
95
 
96
+ /**
97
+ * Updates the site config.
98
+ * @param {string} config - The Site config.
99
+ * @return {Base} The updated site.
100
+ */
101
+ self.updateConfig = (config) => {
102
+ if (!isObject(config)) {
103
+ throw new Error('Config must be provided');
104
+ }
105
+
106
+ self.state.config = Config.toDynamoItem(config);
107
+ self.touch();
108
+
109
+ return self;
110
+ };
111
+
96
112
  self.updateDeliveryType = (deliveryType) => {
97
113
  if (!Object.values(DELIVERY_TYPES).includes(deliveryType)) {
98
114
  throw new Error(`Invalid delivery type: ${deliveryType}`);