@adobe/helix-config 5.9.3 → 5.10.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,17 @@
1
+ # [5.10.0](https://github.com/adobe/helix-config/compare/v5.9.4...v5.10.0) (2026-03-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * access.site secretIds with access.preview and access.live ([#364](https://github.com/adobe/helix-config/issues/364)) ([953f595](https://github.com/adobe/helix-config/commit/953f5958d9d05e5e69a06afd299ef87fe6d8ad4b)), closes [#363](https://github.com/adobe/helix-config/issues/363)
7
+
8
+ ## [5.9.4](https://github.com/adobe/helix-config/compare/v5.9.3...v5.9.4) (2026-03-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * read head from branch code ([#361](https://github.com/adobe/helix-config/issues/361)) ([64a357d](https://github.com/adobe/helix-config/commit/64a357d41226a646c75af0d75aff464f58f4737b))
14
+
1
15
  ## [5.9.3](https://github.com/adobe/helix-config/compare/v5.9.2...v5.9.3) (2026-03-04)
2
16
 
3
17
 
package/README.md CHANGED
@@ -19,6 +19,12 @@ $ npm install @adobe/helix-config
19
19
 
20
20
  See the [API documentation](docs/API.md).
21
21
 
22
+ ## Configuration
23
+
24
+ ### Access and secretIds
25
+
26
+ `secretId` (and legacy `apiKeyId`) can be set on `access.preview`, `access.live`, and `access.site`. The normalized config only has `access.preview` and `access.live`; `access.site` is used only during resolution. For each partition, the effective secretIds (and `allow`) are the **merge** of the partition’s list and `access.site`’s list—site values are merged in, not used as fallback only when the partition is empty.
27
+
22
28
  ## Development
23
29
 
24
30
  ### Build
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.9.3",
3
+ "version": "5.10.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "@semantic-release/changelog": "6.0.3",
41
41
  "@semantic-release/git": "10.0.1",
42
42
  "@semantic-release/npm": "13.1.4",
43
- "c8": "10.1.3",
43
+ "c8": "11.0.0",
44
44
  "eslint": "9.4.0",
45
45
  "husky": "9.1.7",
46
46
  "junit-report-builder": "5.1.1",
@@ -18,6 +18,24 @@ import { prune, toArray } from './utils.js';
18
18
 
19
19
  const HELIX_CODE_BUS = 'helix-code-bus';
20
20
 
21
+ /**
22
+ * Retrieves the head.html from the code bus
23
+ * @param ctx
24
+ * @param rso
25
+ * @returns {Promise<ConfigObject|{}>}
26
+ */
27
+ async function fetchHeadHtml(ctx, rso) {
28
+ const key = `${rso.org}/${rso.site}/${rso.ref}/head.html`;
29
+ const res = await ctx.loader.getObject(HELIX_CODE_BUS, key);
30
+ if (res.body) {
31
+ const head = new ConfigObject();
32
+ head.html = res.body;
33
+ head.updateLastModified(res.headers);
34
+ return head;
35
+ }
36
+ return {};
37
+ }
38
+
21
39
  /**
22
40
  * Retrieves the helix-config.json which is an aggregate from fstab.yaml and head.html.
23
41
  *
@@ -128,6 +146,8 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
128
146
  } else {
129
147
  delete source.contentBusId;
130
148
  }
149
+
150
+ const head = await fetchHeadHtml(ctx, rso);
131
151
  const config = {
132
152
  version: 1,
133
153
  legacy: true,
@@ -144,8 +164,7 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
144
164
  source,
145
165
  },
146
166
  folders: fstab.folders ?? {},
147
- /* c8 ignore next */
148
- head: helixConfig.head?.data ?? helixConfig.head ?? {},
167
+ head,
149
168
  };
150
169
  cfg.data = config;
151
170
  ctx.timer?.update('legacy-config-all');
@@ -144,22 +144,33 @@ function resolveSecret(object, idProp, dstProp, siteConfig, orgConfig) {
144
144
  }
145
145
 
146
146
  /**
147
- * Returns the normalized access configuration for the give partition.
147
+ * Returns the normalized access configuration for the given partition.
148
+ *
149
+ * SecretIds (and legacy apiKeyIds) can be set on access.preview, access.live, and access.site.
150
+ * The normalized config only has access.preview and access.live; access.site is not present in
151
+ * the final object and is only used during resolution. For each partition (preview or live),
152
+ * the effective secretId and allow lists are the merge of the partition's values and
153
+ * access.site's values (union, deduplicated).
154
+ *
155
+ * @param {object} ctx - The context
156
+ * @param {object} config - The config (with access.preview, access.live, access.site)
157
+ * @param {object} orgConfig - The org config
158
+ * @param {'preview'|'live'} partition - The partition name
159
+ * @param {object} rso - RSO (ref, site, org)
160
+ * @returns {Promise<{secretId: string[], allow: string[], tokenHash: string[]}>}
161
+ * Normalized access config for the partition
148
162
  */
149
163
  export async function getAccessConfig(ctx, config, orgConfig, partition, rso) {
150
164
  const { access = {} } = config;
151
- // get the (legacy) apiKeyIds or secretIds from the partition specific config
152
165
  const pAccess = access[partition] ?? {};
153
- let secretId = uniqueArray(pAccess.apiKeyId, pAccess.secretId);
154
- if (secretId.length === 0) {
155
- // if empty, also check the access.site configs
156
- secretId = uniqueArray(access.site?.apiKeyId, access.site?.secretId);
157
- }
158
- // same for 'allow'
159
- let allow = uniqueArray(pAccess.allow);
160
- if (allow.length === 0) {
161
- allow = uniqueArray(access.site?.allow);
162
- }
166
+ // merge partition and site secretIds (and legacy apiKeyIds), then allow
167
+ const secretId = uniqueArray(
168
+ pAccess.apiKeyId,
169
+ pAccess.secretId,
170
+ access.site?.apiKeyId,
171
+ access.site?.secretId,
172
+ );
173
+ const allow = uniqueArray(pAccess.allow, access.site?.allow);
163
174
  const cfg = {
164
175
  secretId,
165
176
  allow,