@adobe/helix-html-pipeline 6.15.2 → 6.15.3
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 +7 -0
- package/package.json +3 -3
- package/src/json-pipe.js +6 -16
- package/src/steps/fetch-404.js +5 -15
- package/src/steps/fetch-content.js +3 -8
- package/src/steps/set-x-surrogate-key-header.js +7 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [6.15.3](https://github.com/adobe/helix-html-pipeline/compare/v6.15.2...v6.15.3) (2024-10-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* provide either (prefixed) preview or (unprefixed) live content keys ([5e29919](https://github.com/adobe/helix-html-pipeline/commit/5e29919973bddfef1b9bfd7ebdcb7fde535226ad))
|
|
7
|
+
|
|
1
8
|
## [6.15.2](https://github.com/adobe/helix-html-pipeline/compare/v6.15.1...v6.15.2) (2024-10-12)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "6.15.
|
|
3
|
+
"version": "6.15.3",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
81
81
|
"eslint-plugin-header": "3.1.1",
|
|
82
82
|
"eslint-plugin-import": "2.31.0",
|
|
83
|
-
"esmock": "2.6.
|
|
83
|
+
"esmock": "2.6.9",
|
|
84
84
|
"husky": "9.1.6",
|
|
85
85
|
"js-yaml": "4.1.0",
|
|
86
86
|
"jsdom": "25.0.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"mocha": "10.7.3",
|
|
90
90
|
"mocha-multi-reporters": "1.5.1",
|
|
91
91
|
"mocha-suppress-logs": "0.5.1",
|
|
92
|
-
"semantic-release": "24.1.
|
|
92
|
+
"semantic-release": "24.1.3"
|
|
93
93
|
},
|
|
94
94
|
"lint-staged": {
|
|
95
95
|
"*.js": "eslint",
|
package/src/json-pipe.js
CHANGED
|
@@ -63,15 +63,10 @@ async function fetchJsonContent(state, req, res) {
|
|
|
63
63
|
res.headers.set('location', redirectLocation);
|
|
64
64
|
const keys = [];
|
|
65
65
|
if (state.content.sourceBus === 'content') {
|
|
66
|
-
|
|
67
|
-
keys.push(contentBusId);
|
|
66
|
+
// provide either (prefixed) preview or (unprefixed) live content keys
|
|
68
67
|
const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
72
|
-
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
|
|
73
|
-
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
74
|
-
}
|
|
68
|
+
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
|
|
69
|
+
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
75
70
|
} else {
|
|
76
71
|
keys.push(`${ref}--${repo}--${owner}_code`);
|
|
77
72
|
keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${info.path}`));
|
|
@@ -109,15 +104,10 @@ async function computeSurrogateKeys(state) {
|
|
|
109
104
|
keys.push(`${state.ref}--${state.repo}--${state.owner}_code`);
|
|
110
105
|
}
|
|
111
106
|
if (state.content.sourceBus.includes('content')) {
|
|
112
|
-
|
|
113
|
-
keys.push(state.contentBusId);
|
|
107
|
+
// provide either (prefixed) preview or (unprefixed) live content keys
|
|
114
108
|
const contentKeyPrefix = state.partition === 'preview' ? 'p_' : '';
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
118
|
-
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${state.contentBusId}${state.info.path}`)}`);
|
|
119
|
-
keys.push(`${contentKeyPrefix}${state.contentBusId}`);
|
|
120
|
-
}
|
|
109
|
+
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${state.contentBusId}${state.info.path}`)}`);
|
|
110
|
+
keys.push(`${contentKeyPrefix}${state.contentBusId}`);
|
|
121
111
|
}
|
|
122
112
|
|
|
123
113
|
return keys;
|
package/src/steps/fetch-404.js
CHANGED
|
@@ -40,31 +40,21 @@ export default async function fetch404(state, req, res) {
|
|
|
40
40
|
|
|
41
41
|
// set 404 keys in any case
|
|
42
42
|
const pathKey = await getPathKey(state);
|
|
43
|
+
// provide either (prefixed) preview or (unprefixed) live content keys
|
|
44
|
+
const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
|
|
43
45
|
const keys = [
|
|
44
|
-
pathKey
|
|
45
|
-
contentBusId
|
|
46
|
+
`${contentKeyPrefix}${pathKey}`,
|
|
47
|
+
`${contentKeyPrefix}${contentBusId}`,
|
|
46
48
|
`${ref}--${repo}--${owner}_404`,
|
|
47
49
|
`${ref}--${repo}--${owner}_code`,
|
|
48
50
|
];
|
|
49
|
-
const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
|
|
50
|
-
if (partition === 'preview') {
|
|
51
|
-
// temporarily provide additional preview content keys
|
|
52
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
53
|
-
keys.push(`${contentKeyPrefix}${pathKey}`);
|
|
54
|
-
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
55
|
-
}
|
|
56
51
|
|
|
57
52
|
if (state.info.unmappedPath) {
|
|
58
53
|
const unmappedPathKey = await getPathKey({
|
|
59
54
|
contentBusId,
|
|
60
55
|
info: { path: state.info.unmappedPath },
|
|
61
56
|
});
|
|
62
|
-
keys.push(unmappedPathKey);
|
|
63
|
-
if (partition === 'preview') {
|
|
64
|
-
// temporarily provide additional preview content key
|
|
65
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content key
|
|
66
|
-
keys.push(`${contentKeyPrefix}${unmappedPathKey}`);
|
|
67
|
-
}
|
|
57
|
+
keys.push(`${contentKeyPrefix}${unmappedPathKey}`);
|
|
68
58
|
}
|
|
69
59
|
|
|
70
60
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
@@ -46,15 +46,10 @@ export default async function fetchContent(state, req, res) {
|
|
|
46
46
|
keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${info.path}`));
|
|
47
47
|
keys.push(`${ref}--${repo}--${owner}_code`);
|
|
48
48
|
} else {
|
|
49
|
-
|
|
50
|
-
keys.push(contentBusId);
|
|
49
|
+
// provide either (prefixed) preview or (unprefixed) live content keys
|
|
51
50
|
const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
55
|
-
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
|
|
56
|
-
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
57
|
-
}
|
|
51
|
+
keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
|
|
52
|
+
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
58
53
|
}
|
|
59
54
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
60
55
|
res.error = 'moved';
|
|
@@ -47,6 +47,7 @@ export default async function setXSurrogateKeyHeader(state, req, res) {
|
|
|
47
47
|
|
|
48
48
|
const isCode = state.content.sourceBus === 'code';
|
|
49
49
|
|
|
50
|
+
// provide either (prefixed) preview or (unprefixed) live content keys
|
|
50
51
|
const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
|
|
51
52
|
const keys = [];
|
|
52
53
|
const hash = await getPathKey(state);
|
|
@@ -54,37 +55,19 @@ export default async function setXSurrogateKeyHeader(state, req, res) {
|
|
|
54
55
|
keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${state.info.path}`));
|
|
55
56
|
keys.push(`${ref}--${repo}--${owner}_code`);
|
|
56
57
|
} else {
|
|
57
|
-
keys.push(hash);
|
|
58
|
-
keys.push(`${contentBusId}_metadata`);
|
|
58
|
+
keys.push(`${contentKeyPrefix}${hash}`);
|
|
59
|
+
keys.push(`${contentKeyPrefix}${contentBusId}_metadata`);
|
|
59
60
|
keys.push(`${ref}--${repo}--${owner}_head`);
|
|
60
|
-
keys.push(contentBusId);
|
|
61
|
-
if (partition === 'preview') {
|
|
62
|
-
// temporarily provide additional preview content keys
|
|
63
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
64
|
-
keys.push(`${contentKeyPrefix}${hash}`);
|
|
65
|
-
keys.push(`${contentKeyPrefix}${contentBusId}_metadata`);
|
|
66
|
-
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
67
|
-
}
|
|
61
|
+
keys.push(`${contentKeyPrefix}${contentBusId}`);
|
|
68
62
|
}
|
|
69
63
|
// for folder-mapped resources, we also need to include the surrogate key of the mapped metadata
|
|
70
64
|
if (state.mapped) {
|
|
71
|
-
keys.push(`${hash}_metadata`);
|
|
65
|
+
keys.push(`${contentKeyPrefix}${hash}_metadata`);
|
|
72
66
|
if (state.info.unmappedPath) {
|
|
73
|
-
keys.push(await getPathKey({
|
|
67
|
+
keys.push(`${contentKeyPrefix}${await getPathKey({
|
|
74
68
|
contentBusId,
|
|
75
69
|
info: { path: state.info.unmappedPath },
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
if (partition === 'preview') {
|
|
79
|
-
// temporarily provide additional preview content keys
|
|
80
|
-
// TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
|
|
81
|
-
keys.push(`${contentKeyPrefix}${hash}_metadata`);
|
|
82
|
-
if (state.info.unmappedPath) {
|
|
83
|
-
keys.push(`${contentKeyPrefix}${await getPathKey({
|
|
84
|
-
contentBusId,
|
|
85
|
-
info: { path: state.info.unmappedPath },
|
|
86
|
-
})}`);
|
|
87
|
-
}
|
|
70
|
+
})}`);
|
|
88
71
|
}
|
|
89
72
|
}
|
|
90
73
|
res.headers.set('x-surrogate-key', keys.join(' '));
|