@adobe/spacecat-shared-data-access 1.18.1 → 1.19.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 +1 -1
- package/src/models/organization.js +14 -1
- package/src/models/site/config.js +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.19.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.19.0...@adobe/spacecat-shared-data-access-v1.19.1) (2024-02-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update config packaging ([#171](https://github.com/adobe/spacecat-shared/issues/171)) ([0e07ce6](https://github.com/adobe/spacecat-shared/commit/0e07ce6aa3f1a585bcaadb9f4ca3f69293834bf0))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.19.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.18.1...@adobe/spacecat-shared-data-access-v1.19.0) (2024-02-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* audit-config support for organizations ([#169](https://github.com/adobe/spacecat-shared/issues/169)) ([ed867a5](https://github.com/adobe/spacecat-shared/commit/ed867a56917f349f82f6e8fa64c23bbf71376859))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.18.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.18.0...@adobe/spacecat-shared-data-access-v1.18.1) (2024-02-24)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -26,11 +26,24 @@ export const DEFAULT_ORGANIZATION_ID = 'default';
|
|
|
26
26
|
const Organization = (data = {}) => {
|
|
27
27
|
const self = Base(data);
|
|
28
28
|
|
|
29
|
+
self.getAuditConfig = () => self.state.config.audits;
|
|
29
30
|
self.getConfig = () => self.state.config;
|
|
30
31
|
self.getName = () => self.state.name;
|
|
31
32
|
self.getImsOrgId = () => self.state.imsOrgId;
|
|
32
33
|
self.getFulfillableItems = () => self.state.fulfillableItems;
|
|
33
34
|
|
|
35
|
+
self.setAllAuditsDisabled = (disabled) => {
|
|
36
|
+
self.state.config.audits.updateAuditsDisabled(disabled);
|
|
37
|
+
self.touch();
|
|
38
|
+
return self;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
self.updateAuditTypeConfig = (type, config) => {
|
|
42
|
+
self.state.config.audits.updateAuditTypeConfig(type, config);
|
|
43
|
+
self.touch();
|
|
44
|
+
return self;
|
|
45
|
+
};
|
|
46
|
+
|
|
34
47
|
/**
|
|
35
48
|
* Updates the IMS Org ID belonging to the organization.
|
|
36
49
|
* @param {string} imsOrgId - The IMS Org ID.
|
|
@@ -73,7 +86,7 @@ const Organization = (data = {}) => {
|
|
|
73
86
|
throw new Error('Config must be provided');
|
|
74
87
|
}
|
|
75
88
|
|
|
76
|
-
self.state.config = Config
|
|
89
|
+
self.state.config = Config(config);
|
|
77
90
|
self.touch();
|
|
78
91
|
|
|
79
92
|
return self;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import Joi from 'joi';
|
|
14
|
+
import AuditConfig from './audit-config.js';
|
|
14
15
|
|
|
15
16
|
export const configSchema = Joi.object({
|
|
16
17
|
slack: Joi.object({
|
|
@@ -22,12 +23,21 @@ export const configSchema = Joi.object({
|
|
|
22
23
|
byOrg: Joi.boolean(),
|
|
23
24
|
mentions: Joi.array().items(Joi.object({ slack: Joi.array().items(Joi.string()) })),
|
|
24
25
|
}).unknown(true)),
|
|
26
|
+
audits: Joi.object({
|
|
27
|
+
auditsDisabled: Joi.boolean().optional(),
|
|
28
|
+
auditTypeConfigs: Joi.object().pattern(
|
|
29
|
+
Joi.string(),
|
|
30
|
+
Joi.object({
|
|
31
|
+
disabled: Joi.boolean().optional(),
|
|
32
|
+
}).unknown(true),
|
|
33
|
+
).unknown(true),
|
|
34
|
+
}).unknown(true),
|
|
25
35
|
}).unknown(true);
|
|
26
36
|
|
|
27
37
|
export const DEFAULT_CONFIG = {
|
|
28
|
-
slack: {
|
|
29
|
-
},
|
|
38
|
+
slack: {},
|
|
30
39
|
alerts: [],
|
|
40
|
+
audits: {},
|
|
31
41
|
};
|
|
32
42
|
|
|
33
43
|
// Function to validate incoming configuration
|
|
@@ -43,6 +53,8 @@ function validateConfiguration(config) {
|
|
|
43
53
|
|
|
44
54
|
export const Config = (data = {}) => {
|
|
45
55
|
const validConfig = validateConfiguration(data);
|
|
56
|
+
validConfig.audits = AuditConfig(validConfig.audits);
|
|
57
|
+
|
|
46
58
|
const state = { ...validConfig };
|
|
47
59
|
|
|
48
60
|
const self = { ...state };
|
|
@@ -52,4 +64,7 @@ export const Config = (data = {}) => {
|
|
|
52
64
|
|
|
53
65
|
Config.fromDynamoItem = (dynamoItem) => Config(dynamoItem);
|
|
54
66
|
|
|
55
|
-
Config.toDynamoItem = (config) =>
|
|
67
|
+
Config.toDynamoItem = (config) => ({
|
|
68
|
+
...config,
|
|
69
|
+
audits: AuditConfig.toDynamoItem(config.audits),
|
|
70
|
+
});
|