@adobe/helix-html-pipeline 3.7.10 → 3.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 +14 -0
- package/package.json +2 -2
- package/src/json-pipe.js +6 -3
- package/src/steps/set-x-surrogate-key-header.js +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.8.0](https://github.com/adobe/helix-html-pipeline/compare/v3.7.11...v3.8.0) (2023-01-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add contentbusId/path as surrogate key ([085e029](https://github.com/adobe/helix-html-pipeline/commit/085e029c5486e03871890ffc9fe52d9804f759d1))
|
|
7
|
+
|
|
8
|
+
## [3.7.11](https://github.com/adobe/helix-html-pipeline/compare/v3.7.10...v3.7.11) (2023-01-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* use node 18 ([#231](https://github.com/adobe/helix-html-pipeline/issues/231)) ([e3f8540](https://github.com/adobe/helix-html-pipeline/commit/e3f85406fcf2fa82ce0c8d9b6a07335d7582b468))
|
|
14
|
+
|
|
1
15
|
## [3.7.10](https://github.com/adobe/helix-html-pipeline/compare/v3.7.9...v3.7.10) (2023-01-07)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"esmock": "2.1.0",
|
|
91
91
|
"husky": "8.0.3",
|
|
92
92
|
"js-yaml": "4.1.0",
|
|
93
|
-
"jsdom": "
|
|
93
|
+
"jsdom": "21.0.0",
|
|
94
94
|
"junit-report-builder": "3.0.1",
|
|
95
95
|
"lint-staged": "13.1.0",
|
|
96
96
|
"mocha": "10.2.0",
|
package/src/json-pipe.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
|
|
12
|
+
import { cleanupHeaderValue, computeSurrogateKey } from '@adobe/helix-shared-utils';
|
|
13
13
|
import fetchConfigAll from './steps/fetch-config-all.js';
|
|
14
14
|
import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
|
|
15
15
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
@@ -112,8 +112,11 @@ export async function jsonPipe(state, req) {
|
|
|
112
112
|
// set last-modified
|
|
113
113
|
updateLastModified(state, response, extractLastModified(dataResponse.headers));
|
|
114
114
|
|
|
115
|
-
// set surrogate
|
|
116
|
-
|
|
115
|
+
// set surrogate keys
|
|
116
|
+
const keys = [];
|
|
117
|
+
keys.push(`${contentBusId}${path}`.replace(/\//g, '_')); // TODO: remove
|
|
118
|
+
keys.push(await computeSurrogateKey(`${contentBusId}${path}`));
|
|
119
|
+
response.headers.set('x-surrogate-key', keys.join(' '));
|
|
117
120
|
|
|
118
121
|
// Load config-all and set response headers
|
|
119
122
|
await fetchConfigAll(state, req, response);
|
|
@@ -20,13 +20,25 @@ import { computeSurrogateKey } from '@adobe/helix-shared-utils';
|
|
|
20
20
|
*/
|
|
21
21
|
export default async function setXSurrogateKeyHeader(state, req, res) {
|
|
22
22
|
const {
|
|
23
|
-
content, contentBusId, owner, repo, ref,
|
|
23
|
+
content, contentBusId, owner, repo, ref, info,
|
|
24
24
|
} = state;
|
|
25
25
|
|
|
26
|
+
let { path } = info;
|
|
27
|
+
|
|
26
28
|
const keys = [];
|
|
27
29
|
if (content.sourceLocation) {
|
|
28
30
|
keys.push(await computeSurrogateKey(content.sourceLocation));
|
|
29
31
|
}
|
|
32
|
+
|
|
33
|
+
// surrogate key for path
|
|
34
|
+
// strip [index].plain.html
|
|
35
|
+
if (path.endsWith('index.plain.html')) {
|
|
36
|
+
path = path.substring(0, path.length - 'index.plain.html'.length);
|
|
37
|
+
} else if (path.endsWith('.plain.html')) {
|
|
38
|
+
path = path.substring(0, path.length - '.plain.html'.length);
|
|
39
|
+
}
|
|
40
|
+
keys.push(await computeSurrogateKey(`${contentBusId}${path}`));
|
|
41
|
+
|
|
30
42
|
keys.push(`${contentBusId}_metadata`);
|
|
31
43
|
keys.push(`${ref}--${repo}--${owner}_head`);
|
|
32
44
|
|