@adobe/spacecat-shared-data-access 2.69.2 → 2.70.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-v2.70.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.69.2...@adobe/spacecat-shared-data-access-v2.70.0) (2025-10-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add productCodes to configuration model ([#1017](https://github.com/adobe/spacecat-shared/issues/1017)) ([c7614b5](https://github.com/adobe/spacecat-shared/commit/c7614b59de924504440e711eb7d1d88a1608002b))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v2.69.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.69.1...@adobe/spacecat-shared-data-access-v2.69.2) (2025-10-09)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import { isNonEmptyObject, isNonEmptyArray } from '@adobe/spacecat-shared-utils'
|
|
|
15
15
|
import { sanitizeIdAndAuditFields } from '../../util/util.js';
|
|
16
16
|
import BaseModel from '../base/base.model.js';
|
|
17
17
|
import { Audit } from '../audit/index.js';
|
|
18
|
+
import { Entitlement } from '../entitlement/index.js';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Configuration - A class representing an Configuration entity.
|
|
@@ -249,7 +250,12 @@ class Configuration extends BaseModel {
|
|
|
249
250
|
this.updateHandlerOrgs(type, orgId, false);
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
registerAudit(
|
|
253
|
+
registerAudit(
|
|
254
|
+
type,
|
|
255
|
+
enabledByDefault = false,
|
|
256
|
+
interval = Configuration.JOB_INTERVALS.NEVER,
|
|
257
|
+
productCodes = [],
|
|
258
|
+
) {
|
|
253
259
|
// Validate audit type
|
|
254
260
|
if (!Object.values(Audit.AUDIT_TYPES).includes(type)) {
|
|
255
261
|
throw new Error(`Audit type ${type} is not a valid audit type in the data model`);
|
|
@@ -260,6 +266,14 @@ class Configuration extends BaseModel {
|
|
|
260
266
|
throw new Error(`Invalid interval ${interval}`);
|
|
261
267
|
}
|
|
262
268
|
|
|
269
|
+
// Validate product codes
|
|
270
|
+
if (!isNonEmptyArray(productCodes)) {
|
|
271
|
+
throw new Error('No product codes provided');
|
|
272
|
+
}
|
|
273
|
+
if (!productCodes.every((pc) => Object.values(Entitlement.PRODUCT_CODES).includes(pc))) {
|
|
274
|
+
throw new Error('Invalid product codes provided');
|
|
275
|
+
}
|
|
276
|
+
|
|
263
277
|
// Add to handlers if not already registered
|
|
264
278
|
const handlers = this.getHandlers();
|
|
265
279
|
if (!handlers[type]) {
|
|
@@ -274,6 +288,7 @@ class Configuration extends BaseModel {
|
|
|
274
288
|
orgs: [],
|
|
275
289
|
},
|
|
276
290
|
dependencies: [],
|
|
291
|
+
productCodes,
|
|
277
292
|
};
|
|
278
293
|
this.setHandlers(handlers);
|
|
279
294
|
}
|
|
@@ -39,7 +39,7 @@ export interface Configuration extends BaseModel {
|
|
|
39
39
|
setSlackRoles(slackRoles: object): void;
|
|
40
40
|
updateHandlerOrgs(type: string, orgId: string, enabled: boolean): void;
|
|
41
41
|
updateHandlerSites(type: string, siteId: string, enabled: boolean): void;
|
|
42
|
-
registerAudit(type: string, enabledByDefault?: boolean, interval?: string): void;
|
|
42
|
+
registerAudit(type: string, enabledByDefault?: boolean, interval?: string, productCodes?: string[]): void;
|
|
43
43
|
unregisterAudit(type: string): void;
|
|
44
44
|
}
|
|
45
45
|
|