@adobe/helix-config 5.6.11 → 5.8.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.8.0](https://github.com/adobe/helix-config/compare/v5.7.0...v5.8.0) (2025-12-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * include code bus sidekick in admin config ([#345](https://github.com/adobe/helix-config/issues/345)) ([6837ece](https://github.com/adobe/helix-config/commit/6837ece3169bc0d4863dd796e49b493fa1933859))
7
+
8
+ # [5.7.0](https://github.com/adobe/helix-config/compare/v5.6.11...v5.7.0) (2025-11-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * include org and site apiKeys into admin scope ([#337](https://github.com/adobe/helix-config/issues/337)) ([ceed54e](https://github.com/adobe/helix-config/commit/ceed54ed5533da5cf9cd4702946af2165290722e))
14
+
1
15
  ## [5.6.11](https://github.com/adobe/helix-config/compare/v5.6.10...v5.6.11) (2025-11-05)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.6.11",
3
+ "version": "5.8.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -35,20 +35,20 @@
35
35
  "reporter-options": "configFile=.mocha-multi.json"
36
36
  },
37
37
  "devDependencies": {
38
- "@adobe/eslint-config-helix": "3.0.13",
39
- "@eslint/config-helpers": "0.4.1",
38
+ "@adobe/eslint-config-helix": "3.0.15",
39
+ "@eslint/config-helpers": "0.5.0",
40
40
  "@semantic-release/changelog": "6.0.3",
41
41
  "@semantic-release/git": "10.0.1",
42
- "@semantic-release/npm": "13.1.1",
42
+ "@semantic-release/npm": "13.1.2",
43
43
  "c8": "10.1.3",
44
44
  "eslint": "9.4.0",
45
45
  "husky": "9.1.7",
46
46
  "junit-report-builder": "5.1.1",
47
- "lint-staged": "16.2.5",
48
- "mocha": "11.7.4",
47
+ "lint-staged": "16.2.7",
48
+ "mocha": "11.7.5",
49
49
  "mocha-multi-reporters": "1.5.1",
50
50
  "mocha-suppress-logs": "0.6.0",
51
- "semantic-release": "25.0.1"
51
+ "semantic-release": "25.0.2"
52
52
  },
53
53
  "lint-staged": {
54
54
  "*.js": "eslint",
@@ -243,6 +243,20 @@ async function loadHeadHtml(ctx, config, ref) {
243
243
  return {};
244
244
  }
245
245
 
246
+ async function loadSidekickConfig(ctx, config) {
247
+ const key = `${config.code.owner}/${config.code.repo}/main/tools/sidekick/config.json`;
248
+ const res = await ctx.loader.getObject(HELIX_CODE_BUS, key);
249
+ if (res.body) {
250
+ const sidekick = new ConfigObject();
251
+ sidekick.data = JSON.parse(res.body);
252
+ sidekick.updateLastModified(res.headers);
253
+ // remove deprecated properties
254
+ delete sidekick.data.extends;
255
+ return sidekick;
256
+ }
257
+ return {};
258
+ }
259
+
246
260
  function retainProperty(obj, prop) {
247
261
  if (!obj || Array.isArray(obj)) {
248
262
  return;
@@ -338,10 +352,15 @@ async function resolveConfig(ctx, rso, scope) {
338
352
  }
339
353
  }
340
354
  if (scope === SCOPE_PIPELINE || scope === SCOPE_RAW || scope === SCOPE_DELIVERY) {
341
- // although not used in delivery, load in order to set correct last-modified
355
+ // although not used in raw, or delivery, load in order to set correct last-modified
342
356
  ctx.timer?.update('head.html');
343
357
  config.head = await loadHeadHtml(ctx, config, rso.ref);
344
358
  }
359
+ if (scope === SCOPE_ADMIN || scope === SCOPE_RAW) {
360
+ // although not used in raw, in order to set correct last-modified
361
+ ctx.timer?.update('sidekick.json');
362
+ site.sidekick = await loadSidekickConfig(ctx, config);
363
+ }
345
364
 
346
365
  return site;
347
366
  }
@@ -392,6 +411,25 @@ function computeOrgAdminRoles(adminConfig, orgConfig) {
392
411
  }
393
412
  }
394
413
 
414
+ /**
415
+ * Apply org config apiKeys.
416
+ * @param adminConfig
417
+ * @param orgConfig
418
+ */
419
+ function applyOrgAPIKeys(adminConfig, orgConfig) {
420
+ const orgKeys = Object.keys(orgConfig.apiKeys ?? {});
421
+ if (orgKeys.length) {
422
+ const admin = deepGetOrCreate(adminConfig, ['access', 'admin'], true);
423
+ const apiKeyId = new Set([
424
+ ...admin.apiKeyId ?? [],
425
+ ...orgKeys,
426
+ ]);
427
+ if (apiKeyId.size) {
428
+ admin.apiKeyId = Array.from(apiKeyId).sort();
429
+ }
430
+ }
431
+ }
432
+
395
433
  /**
396
434
  * Extract the email addresses of the users for the given group.
397
435
  * @param groups
@@ -500,9 +538,14 @@ async function computeSiteAdminRoles(ctx, siteConfig, admin, orgConfig, configGr
500
538
  role: roles,
501
539
  };
502
540
 
503
- const apiKeyId = new Set([...admin.apiKeyId ?? [], ...orgConfig?.access?.admin?.apiKeyId ?? []]);
541
+ const apiKeyId = new Set([
542
+ ...admin.apiKeyId ?? [],
543
+ ...orgConfig?.access?.admin?.apiKeyId ?? [],
544
+ ...Object.keys(orgConfig?.apiKeys || {}),
545
+ ...Object.keys(siteConfig?.apiKeys || {}),
546
+ ]);
504
547
  if (apiKeyId.size) {
505
- ret.apiKeyId = Array.from(apiKeyId);
548
+ ret.apiKeyId = Array.from(apiKeyId).sort();
506
549
  }
507
550
  // if there are only roles from the org, ensure that they don't enforce auth
508
551
  if (hasOrgUsers && !hasRoles && (!admin.requireAuth || admin.requireAuth === 'auto')) {
@@ -585,6 +628,7 @@ export async function getConfigResponse(ctx, opts) {
585
628
 
586
629
  // todo: improve
587
630
  siteConfig.updateLastModified(config.head);
631
+ siteConfig.updateLastModified(siteConfig.sidekick);
588
632
  siteConfig.updateLastModified(config.robots);
589
633
  siteConfig.updateLastModified(config.metadata?.preview);
590
634
  siteConfig.updateLastModified(config.metadata?.live);
@@ -626,6 +670,7 @@ export async function getConfigResponse(ctx, opts) {
626
670
  if (opts.scope === SCOPE_ADMIN) {
627
671
  const adminConfig = {
628
672
  ...rso,
673
+ sidekick: siteConfig.sidekick?.data,
629
674
  ...config,
630
675
  content: {
631
676
  ...config.content,
@@ -732,6 +777,7 @@ export async function getOrgConfigResponse(ctx, opts) {
732
777
  };
733
778
 
734
779
  computeOrgAdminRoles(adminConfig, orgConfig);
780
+ applyOrgAPIKeys(adminConfig, orgConfig);
735
781
  delete adminConfig.tokens;
736
782
  delete adminConfig.users;
737
783
  delete adminConfig.groups;