@adobe/helix-config 5.4.10 → 5.6.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.6.0](https://github.com/adobe/helix-config/compare/v5.5.0...v5.6.0) (2025-08-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * include x-hlx-version header ([8b95c95](https://github.com/adobe/helix-config/commit/8b95c9517d543a76188ff449523ae0965a79a540))
7
+
8
+ # [5.5.0](https://github.com/adobe/helix-config/compare/v5.4.10...v5.5.0) (2025-07-29)
9
+
10
+
11
+ ### Features
12
+
13
+ * add timing information ([#304](https://github.com/adobe/helix-config/issues/304)) ([7b2e50e](https://github.com/adobe/helix-config/commit/7b2e50e92bb1d1c186622169136b20a0fb64308e))
14
+
1
15
  ## [5.4.10](https://github.com/adobe/helix-config/compare/v5.4.9...v5.4.10) (2025-07-11)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "5.4.10",
3
+ "version": "5.6.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -44,11 +44,11 @@
44
44
  "eslint": "9.4.0",
45
45
  "husky": "9.1.7",
46
46
  "junit-report-builder": "5.1.1",
47
- "lint-staged": "16.1.2",
47
+ "lint-staged": "16.1.4",
48
48
  "mocha": "11.7.1",
49
49
  "mocha-multi-reporters": "1.5.1",
50
50
  "mocha-suppress-logs": "0.6.0",
51
- "semantic-release": "24.2.6"
51
+ "semantic-release": "24.2.7"
52
52
  },
53
53
  "lint-staged": {
54
54
  "*.js": "eslint",
@@ -56,6 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@adobe/helix-shared-config": "11.1.8",
59
+ "@adobe/helix-shared-server-timing": "1.0.0",
59
60
  "@adobe/helix-shared-utils": "3.0.2"
60
61
  }
61
62
  }
@@ -10,6 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  import {S3Loader} from "./S3Loader";
13
+ import {RequestTimer} from "@adobe/helix-shared-server-timing";
13
14
 
14
15
  export declare enum ConfigScope {
15
16
  delivery = 'delivery',
@@ -22,5 +23,6 @@ export declare class ConfigContext {
22
23
  withLog(log: Console): ConfigContext;
23
24
  withEnv(env: object): ConfigContext;
24
25
  withS3Loader(loader: S3Loader): ConfigContext;
26
+ withTimer(timer: RequestTimer);
25
27
  }
26
28
 
@@ -53,6 +53,8 @@ export class ConfigContext {
53
53
 
54
54
  fetch = null;
55
55
 
56
+ timer = null;
57
+
56
58
  withLog(log) {
57
59
  this.log = log;
58
60
  return this;
@@ -67,4 +69,9 @@ export class ConfigContext {
67
69
  this.loader = loader;
68
70
  return this;
69
71
  }
72
+
73
+ withTimer(timer) {
74
+ this.timer = timer;
75
+ return this;
76
+ }
70
77
  }
@@ -122,6 +122,8 @@ async function resolveAdminAccess(ctx, admin) {
122
122
  * @returns {Promise<ConfigObject|null>} the config object or {@code null} if not found.
123
123
  */
124
124
  export async function resolveLegacyConfig(ctx, rso, scope) {
125
+ ctx.timer?.update('legacy-helix-config');
126
+
125
127
  // set owner==org and repo==site and fetch from helix-config for now
126
128
  const cfg = await fetchHelixConfig(ctx, rso);
127
129
  if (!cfg) {
@@ -167,6 +169,7 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
167
169
  head: helixConfig.head?.data ?? helixConfig.head ?? {},
168
170
  };
169
171
  cfg.data = config;
172
+ ctx.timer?.update('legacy-config-all');
170
173
  const configAllPreview = await fetchConfigAll(ctx, config.content.contentBusId, 'preview');
171
174
  const configAllLive = await fetchConfigAll(ctx, config.content.contentBusId, 'live');
172
175
  const { access, admin } = configAllPreview?.config?.data || {};
@@ -206,6 +209,7 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
206
209
  if (configAllLive?.metadata) {
207
210
  config.metadata.live = configAllLive.metadata;
208
211
  }
212
+ ctx.timer?.update('robots-txt');
209
213
  config.robots = await fetchRobotsTxt(ctx, rso.org, rso.site);
210
214
  if (!config.robots.txt) {
211
215
  delete config.robots;
@@ -285,10 +285,12 @@ async function loadProfile(ctx, rso, name) {
285
285
  async function resolveConfig(ctx, rso, scope) {
286
286
  // try to load site config from config-bus
287
287
  const key = `orgs/${rso.org}/sites/${rso.site}.json`;
288
+ ctx.timer?.update('load-config');
288
289
  const res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
289
290
  if (!res.body) {
290
291
  const config = await resolveLegacyConfig(ctx, rso, scope);
291
292
  if (config) {
293
+ ctx.timer?.update('profile');
292
294
  const profile = await loadProfile(ctx, rso, 'default');
293
295
  config.data.tokens = profile?.data.tokens || {};
294
296
  config.data.secrets = profile?.data.secrets || {};
@@ -306,6 +308,7 @@ async function resolveConfig(ctx, rso, scope) {
306
308
  profile: 'default',
307
309
  };
308
310
  }
311
+ ctx.timer?.update('profile');
309
312
  const profile = await loadProfile(ctx, rso, site.data.extends.profile);
310
313
  site.merge(profile);
311
314
 
@@ -321,11 +324,13 @@ async function resolveConfig(ctx, rso, scope) {
321
324
 
322
325
  const config = site.data;
323
326
  if (scope === SCOPE_PIPELINE) {
327
+ ctx.timer?.update('metadata');
324
328
  config.metadata = {
325
329
  preview: await loadMetadata(ctx, config, 'preview'),
326
330
  live: await loadMetadata(ctx, config, 'live'),
327
331
  };
328
332
  if (!config.robots) {
333
+ ctx.timer?.update('robots-txt');
329
334
  const robots = await fetchRobotsTxt(ctx, config.code.owner, config.code.repo);
330
335
  if (robots.txt) {
331
336
  config.robots = robots;
@@ -333,6 +338,7 @@ async function resolveConfig(ctx, rso, scope) {
333
338
  }
334
339
  }
335
340
  if (scope === SCOPE_PIPELINE || scope === SCOPE_DELIVERY) {
341
+ ctx.timer?.update('head.html');
336
342
  config.head = await loadHeadHtml(ctx, config, rso.ref);
337
343
  }
338
344
  return site;
@@ -530,12 +536,14 @@ export async function getConfigResponse(ctx, opts) {
530
536
  },
531
537
  });
532
538
  }
539
+ headers['x-hlx-version'] = siteConfig.data.legacy ? 4 : 5;
533
540
 
534
541
  const config = siteConfig.data;
535
542
  if (scope === SCOPE_PIPELINE || config.extends?.profile === 'default') {
536
543
  delete config.extends;
537
544
  }
538
545
 
546
+ ctx.timer?.update('org-config');
539
547
  const orgConfig = await loadOrgConfig(ctx, org);
540
548
 
541
549
  // normalize access config
@@ -691,7 +699,7 @@ export async function getOrgConfigResponse(ctx, opts) {
691
699
  const surrogateHeaders = {
692
700
  'x-surrogate-key': await getSurrogateKey(opts),
693
701
  };
694
-
702
+ ctx.timer?.update('org-config');
695
703
  const orgConfig = await loadOrgConfig(ctx, org);
696
704
  if (!orgConfig) {
697
705
  return new PipelineResponse('', {