@adobe/helix-config 5.9.4 → 5.10.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.10.1](https://github.com/adobe/helix-config/compare/v5.10.0...v5.10.1) (2026-03-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * catch JSON parsing error in sidekick/config.json ([#366](https://github.com/adobe/helix-config/issues/366)) ([e30bb4f](https://github.com/adobe/helix-config/commit/e30bb4fd781157830b1edac391392cee2c4557c2))
7
+
8
+ # [5.10.0](https://github.com/adobe/helix-config/compare/v5.9.4...v5.10.0) (2026-03-10)
9
+
10
+
11
+ ### Features
12
+
13
+ * 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)
14
+
1
15
  ## [5.9.4](https://github.com/adobe/helix-config/compare/v5.9.3...v5.9.4) (2026-03-05)
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.4",
3
+ "version": "5.10.1",
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",
@@ -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,
@@ -243,12 +254,19 @@ async function loadHeadHtml(ctx, config, ref) {
243
254
  return {};
244
255
  }
245
256
 
246
- async function loadSidekickConfig(ctx, config) {
257
+ async function loadSidekickConfig(ctx, rso, config) {
247
258
  const key = `${config.code.owner}/${config.code.repo}/main/tools/sidekick/config.json`;
248
259
  const res = await ctx.loader.getObject(HELIX_CODE_BUS, key);
249
260
  if (res.body) {
250
261
  const sidekick = new ConfigObject();
251
- sidekick.data = JSON.parse(res.body);
262
+ try {
263
+ sidekick.data = JSON.parse(res.body);
264
+ } catch (e) {
265
+ ctx.log.warn(`[${rso.org}/${rso.site}] JSON error in ${key}: ${e.message}`);
266
+ sidekick.data = {
267
+ error: e.message,
268
+ };
269
+ }
252
270
  sidekick.updateLastModified(res.headers);
253
271
  // remove deprecated properties
254
272
  delete sidekick.data.extends;
@@ -359,7 +377,7 @@ async function resolveConfig(ctx, rso, scope) {
359
377
  if (scope === SCOPE_ADMIN || scope === SCOPE_RAW) {
360
378
  // although not used in raw, in order to set correct last-modified
361
379
  ctx.timer?.update('sidekick.json');
362
- site.sidekick = await loadSidekickConfig(ctx, config);
380
+ site.sidekick = await loadSidekickConfig(ctx, rso, config);
363
381
  }
364
382
 
365
383
  return site;