@adobe/helix-html-pipeline 6.14.5 → 6.14.6

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,10 @@
1
+ ## [6.14.6](https://github.com/adobe/helix-html-pipeline/compare/v6.14.5...v6.14.6) (2024-09-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * set code and content surrogate keys for json 404 ([#692](https://github.com/adobe/helix-html-pipeline/issues/692)) ([6a947a3](https://github.com/adobe/helix-html-pipeline/commit/6a947a3484aba60bb511f04bd611c949036889d9)), closes [#688](https://github.com/adobe/helix-html-pipeline/issues/688)
7
+
1
8
  ## [6.14.5](https://github.com/adobe/helix-html-pipeline/compare/v6.14.4...v6.14.5) (2024-09-17)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.14.5",
3
+ "version": "6.14.6",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/json-pipe.js CHANGED
@@ -85,7 +85,8 @@ async function fetchJsonContent(state, req, res) {
85
85
 
86
86
  updateLastModified(state, res, extractLastModified(ret.headers));
87
87
  } else {
88
- state.content.sourceBus = 'content';
88
+ // also add code surrogate key in case json is later added to code bus (#688)
89
+ state.content.sourceBus = 'code|content';
89
90
  res.status = ret.status === 404 ? 404 : 502;
90
91
  res.error = `failed to load ${state.info.resourcePath}: ${ret.status}`;
91
92
  }
@@ -93,19 +94,18 @@ async function fetchJsonContent(state, req, res) {
93
94
 
94
95
  async function computeSurrogateKeys(state) {
95
96
  const keys = [];
96
- const pathKey = state.content?.sourceBus === 'code'
97
- ? `${state.ref}--${state.repo}--${state.owner}${state.info.path}`
98
- : `${state.contentBusId}${state.info.path}`;
99
-
100
97
  if (state.info.path === '/config.json') {
101
98
  keys.push(await computeSurrogateKey(`${state.site}--${state.org}_config.json`));
102
99
  }
103
- keys.push(await computeSurrogateKey(pathKey));
104
- if (state.content?.sourceBus === 'content') {
105
- keys.push(state.contentBusId);
106
- } else {
100
+ if (state.content.sourceBus.includes('code')) {
101
+ keys.push(await computeSurrogateKey(`${state.ref}--${state.repo}--${state.owner}${state.info.path}`));
107
102
  keys.push(`${state.ref}--${state.repo}--${state.owner}_code`);
108
103
  }
104
+ if (state.content.sourceBus.includes('content')) {
105
+ keys.push(await computeSurrogateKey(`${state.contentBusId}${state.info.path}`));
106
+ keys.push(state.contentBusId);
107
+ }
108
+
109
109
  return keys;
110
110
  }
111
111