@adobe/helix-config 5.4.3 → 5.4.5

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
+ ## [5.4.5](https://github.com/adobe/helix-config/compare/v5.4.4...v5.4.5) (2025-06-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @adobe/helix-shared-config to v11.1.7 ([#284](https://github.com/adobe/helix-config/issues/284)) ([faa93bc](https://github.com/adobe/helix-config/commit/faa93bc9365fb55c42cab3dcddee2423f29b59f2))
7
+
8
+ ## [5.4.4](https://github.com/adobe/helix-config/compare/v5.4.3...v5.4.4) (2025-05-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * properly merge org config access ([#281](https://github.com/adobe/helix-config/issues/281)) ([2c6f49a](https://github.com/adobe/helix-config/commit/2c6f49a27e837c407686a35f5b701fdfdc86d4f8))
14
+
1
15
  ## [5.4.3](https://github.com/adobe/helix-config/compare/v5.4.2...v5.4.3) (2025-05-23)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.4.3",
3
+ "version": "5.4.5",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -43,12 +43,12 @@
43
43
  "eslint": "8.57.1",
44
44
  "husky": "9.1.7",
45
45
  "junit-report-builder": "5.1.1",
46
- "lint-staged": "16.0.0",
47
- "mocha": "11.4.0",
46
+ "lint-staged": "16.1.0",
47
+ "mocha": "11.5.0",
48
48
  "mocha-multi-reporters": "1.5.1",
49
49
  "mocha-suppress-logs": "0.5.1",
50
50
  "nock": "13.5.6",
51
- "semantic-release": "24.2.4"
51
+ "semantic-release": "24.2.5"
52
52
  },
53
53
  "lint-staged": {
54
54
  "*.js": "eslint",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@adobe/fetch": "4.2.2",
59
- "@adobe/helix-shared-config": "11.1.6",
59
+ "@adobe/helix-shared-config": "11.1.7",
60
60
  "@adobe/helix-shared-utils": "3.0.2"
61
61
  }
62
62
  }
@@ -20,7 +20,7 @@ import {
20
20
  SCOPE_RAW, SCOPE_PUBLIC,
21
21
  } from './ConfigContext.js';
22
22
  import { resolveLegacyConfig, fetchRobotsTxt, toArray } from './config-legacy.js';
23
- import { deepGetOrCreate } from './utils.js';
23
+ import { deepGetOrCreate, prune } from './utils.js';
24
24
  import { ConfigObject } from './config-object.js';
25
25
 
26
26
  /**
@@ -160,7 +160,7 @@ function resolveSecret(object, idProp, dstProp, siteConfig, orgConfig) {
160
160
  * Returns the normalized access configuration for the give partition.
161
161
  */
162
162
  export async function getAccessConfig(ctx, config, orgConfig, partition, rso) {
163
- const { access } = config;
163
+ const { access = {} } = config;
164
164
  const pAccess = access[partition] ?? {};
165
165
  const secretId = toArray(
166
166
  pAccess.apiKeyId ?? pAccess.secretId ?? access.site?.apiKeyId ?? access.site?.secretId,
@@ -497,9 +497,9 @@ export async function getConfigResponse(ctx, opts) {
497
497
  }
498
498
 
499
499
  const orgConfig = await loadOrgConfig(ctx, org);
500
- if (config.access) {
500
+ if (config.access || orgConfig?.access) {
501
501
  // normalize access config
502
- const { admin = {} } = config.access;
502
+ const { admin = {} } = config.access ?? {};
503
503
  config.access = {
504
504
  preview: await getAccessConfig(ctx, config, orgConfig, 'preview', rso),
505
505
  live: await getAccessConfig(ctx, config, orgConfig, 'live', rso),
@@ -509,6 +509,10 @@ export async function getConfigResponse(ctx, opts) {
509
509
  // eslint-disable-next-line max-len
510
510
  config.access.admin = computeSiteAdminRoles(admin, orgConfig, config.groups);
511
511
  }
512
+ prune(config.access);
513
+ if (!Object.keys(config.access).length) {
514
+ delete config.access;
515
+ }
512
516
  }
513
517
  if (opts.scope === SCOPE_ADMIN || opts.scope === SCOPE_RAW) {
514
518
  const merged = { ...config.apiKeys, ...orgConfig?.apiKeys };
package/src/utils.js CHANGED
@@ -39,3 +39,24 @@ export function deepGetOrCreate(obj, path, create = false) {
39
39
  }
40
40
  return o;
41
41
  }
42
+
43
+ export function prune(obj, path = '') {
44
+ for (const key of Object.keys(obj)) {
45
+ const itemPath = `${path}.${key}`;
46
+ const prop = obj[key];
47
+ if (Array.isArray(prop)) {
48
+ // only prune empty arrays; not recursive
49
+ if (prop.length === 0) {
50
+ // eslint-disable-next-line no-param-reassign
51
+ delete obj[key];
52
+ }
53
+ } else if (typeof prop === 'object') {
54
+ prune(prop, itemPath);
55
+ if (Object.keys(prop).length === 0) {
56
+ // eslint-disable-next-line no-param-reassign
57
+ delete obj[key];
58
+ }
59
+ }
60
+ }
61
+ return obj;
62
+ }