@adobe/spacecat-shared-data-access 3.76.0 → 3.77.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,9 @@
1
+ ## [@adobe/spacecat-shared-data-access-v3.77.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.76.0...@adobe/spacecat-shared-data-access-v3.77.0) (2026-06-17)
2
+
3
+ ### Features
4
+
5
+ * **data-access:** add Configuration.isHandlerDisabledForSite / isHandlerDisabledForOrg. ([#1673](https://github.com/adobe/spacecat-shared/issues/1673)) ([003371c](https://github.com/adobe/spacecat-shared/commit/003371c63316d5f06fb0e17d0a9f60eb8ba3ec2e))
6
+
1
7
  ## [@adobe/spacecat-shared-data-access-v3.76.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.75.4...@adobe/spacecat-shared-data-access-v3.76.0) (2026-06-17)
2
8
 
3
9
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "3.76.0",
3
+ "version": "3.77.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -268,6 +268,71 @@ class Configuration {
268
268
  return false;
269
269
  }
270
270
 
271
+ /**
272
+ * Returns whether a handler is explicitly disabled for a given site.
273
+ *
274
+ * Unlike `!isHandlerEnabledForSite(...)`, this answers a strict question:
275
+ * "is this site (or its org, in the absence of a site-level override) in the
276
+ * handler's deny-list?" It does NOT treat "not-opted-in" as "disabled".
277
+ *
278
+ * Precedence (highest to lowest), aligned with `isHandlerEnabledForSite`:
279
+ * 1. disabled.sites includes siteId → true (site explicitly disabled)
280
+ * 2. enabled.sites includes siteId → false (site-level override beats org disable)
281
+ * 3. disabled.orgs includes orgId → true (org disabled, no site-level override)
282
+ * 4. otherwise → false (not in any deny-list)
283
+ *
284
+ * Notes:
285
+ * - `enabledByDefault` and `enabled.orgs` deliberately do NOT influence this result.
286
+ * They control allow-list defaults, not deny-list membership.
287
+ * - When the handler does not exist at all, this returns false (nothing to deny).
288
+ * Callers that need to forbid execution for unknown handlers should check existence
289
+ * separately.
290
+ * - `disabled.sites` and `enabled.sites` are kept disjoint on writes (see #updatedHandler);
291
+ * if violated, `disabled.sites` wins at site level.
292
+ */
293
+ isHandlerDisabledForSite(type, site) {
294
+ const handler = this.getHandlers()?.[type];
295
+ if (!handler) {
296
+ return false;
297
+ }
298
+
299
+ const siteId = site.getId();
300
+ const orgId = site.getOrganizationId();
301
+
302
+ const disabledSites = handler.disabled?.sites || [];
303
+ const enabledSites = handler.enabled?.sites || [];
304
+ const disabledOrgs = handler.disabled?.orgs || [];
305
+
306
+ if (disabledSites.includes(siteId)) {
307
+ return true;
308
+ }
309
+ if (enabledSites.includes(siteId)) {
310
+ return false;
311
+ }
312
+ return disabledOrgs.includes(orgId);
313
+ }
314
+
315
+ /**
316
+ * Returns whether a handler is explicitly disabled for a given org.
317
+ *
318
+ * Symmetric to `isHandlerEnabledForOrg` — there is no site-level override at org scope.
319
+ *
320
+ * Precedence:
321
+ * 1. disabled.orgs includes orgId → true
322
+ * 2. otherwise → false
323
+ *
324
+ * Note: when the handler does not exist, this returns false (nothing to deny).
325
+ */
326
+ isHandlerDisabledForOrg(type, org) {
327
+ const handler = this.getHandlers()?.[type];
328
+ if (!handler) {
329
+ return false;
330
+ }
331
+
332
+ const orgId = org.getId();
333
+ return (handler.disabled?.orgs || []).includes(orgId);
334
+ }
335
+
271
336
  #updatedHandler(type, entityId, enabled, entityKey) {
272
337
  const handlers = this.getHandlers();
273
338
  const handler = handlers?.[type];
@@ -35,6 +35,8 @@ export interface Configuration {
35
35
  getVersion(): string;
36
36
  isHandlerDependencyMetForOrg(type: string, org: Organization): true | string[];
37
37
  isHandlerDependencyMetForSite(type: string, site: Site): true | string[];
38
+ isHandlerDisabledForOrg(type: string, org: Organization): boolean;
39
+ isHandlerDisabledForSite(type: string, site: Site): boolean;
38
40
  isHandlerEnabledForOrg(type: string, org: Organization): boolean;
39
41
  isHandlerEnabledForSite(type: string, site: Site): boolean;
40
42
  registerAudit(type: string, enabledByDefault?: boolean, interval?: string, productCodes?: string[]): void;