@adobe/helix-html-pipeline 6.7.9 → 6.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 +3 -3
- package/src/json-pipe.js +28 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [6.8.0](https://github.com/adobe/helix-html-pipeline/compare/v6.7.10...v6.8.0) (2024-04-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* serve /config.json ([#589](https://github.com/adobe/helix-html-pipeline/issues/589)) ([f01f9ce](https://github.com/adobe/helix-html-pipeline/commit/f01f9ced59e21aa406c24babe4200e8267dd72e8))
|
|
7
|
+
|
|
8
|
+
## [6.7.10](https://github.com/adobe/helix-html-pipeline/compare/v6.7.9...v6.7.10) (2024-04-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-shared-utils to v3.0.2 ([0d2e360](https://github.com/adobe/helix-html-pipeline/commit/0d2e3603ff179694300e2dd5a34e92570b406fba))
|
|
14
|
+
|
|
1
15
|
## [6.7.9](https://github.com/adobe/helix-html-pipeline/compare/v6.7.8...v6.7.9) (2024-04-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@adobe/helix-markdown-support": "7.1.2",
|
|
47
|
-
"@adobe/helix-shared-utils": "3.0.
|
|
47
|
+
"@adobe/helix-shared-utils": "3.0.2",
|
|
48
48
|
"@adobe/mdast-util-gridtables": "4.0.4",
|
|
49
49
|
"@adobe/remark-gridtables": "3.0.4",
|
|
50
50
|
"cookie": "0.6.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"mocha": "10.4.0",
|
|
92
92
|
"mocha-multi-reporters": "1.5.1",
|
|
93
93
|
"mocha-suppress-logs": "0.5.1",
|
|
94
|
-
"semantic-release": "
|
|
94
|
+
"semantic-release": "23.0.8"
|
|
95
95
|
},
|
|
96
96
|
"lint-staged": {
|
|
97
97
|
"*.js": "eslint",
|
package/src/json-pipe.js
CHANGED
|
@@ -46,10 +46,12 @@ async function fetchJsonContent(state, req, res) {
|
|
|
46
46
|
owner, repo, ref, contentBusId, partition, s3Loader, log, info,
|
|
47
47
|
} = state;
|
|
48
48
|
const { path } = state.info;
|
|
49
|
+
state.content.sourceBus = 'content';
|
|
49
50
|
let ret = await s3Loader.getObject('helix-content-bus', `${contentBusId}/${partition}${path}`);
|
|
50
51
|
|
|
51
52
|
// if not found, fall back to code bus
|
|
52
53
|
if (ret.status === 404) {
|
|
54
|
+
state.content.sourceBus = 'code';
|
|
53
55
|
ret = await s3Loader.getObject('helix-code-bus', `${owner}/${repo}/${ref}${path}`);
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -76,15 +78,23 @@ async function fetchJsonContent(state, req, res) {
|
|
|
76
78
|
|
|
77
79
|
updateLastModified(state, res, extractLastModified(ret.headers));
|
|
78
80
|
} else {
|
|
81
|
+
state.content.sourceBus = 'content';
|
|
79
82
|
res.status = ret.status === 404 ? 404 : 502;
|
|
80
83
|
res.error = `failed to load ${state.info.resourcePath}: ${ret.status}`;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
async function computeSurrogateKeys(
|
|
87
|
+
async function computeSurrogateKeys(state) {
|
|
85
88
|
const keys = [];
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
const pathKey = state.content?.sourceBus === 'code'
|
|
90
|
+
? `${state.ref}--${state.repo}--${state.owner}${state.info.path}`
|
|
91
|
+
: `${state.contentBusId}${state.info.path}`;
|
|
92
|
+
|
|
93
|
+
if (state.info.path === '/config.json') {
|
|
94
|
+
keys.push(await computeSurrogateKey(`${state.site}--${state.org}_config.json`));
|
|
95
|
+
}
|
|
96
|
+
keys.push(pathKey.replace(/\//g, '_')); // TODO: remove
|
|
97
|
+
keys.push(await computeSurrogateKey(pathKey));
|
|
88
98
|
return keys;
|
|
89
99
|
}
|
|
90
100
|
|
|
@@ -142,23 +152,27 @@ export async function jsonPipe(state, req) {
|
|
|
142
152
|
|
|
143
153
|
await authenticate(state, req, res);
|
|
144
154
|
|
|
145
|
-
if (res.
|
|
155
|
+
if (res.status === 404 && state.info.path === '/config.json' && state.config.public) {
|
|
156
|
+
// special handling for public config
|
|
157
|
+
res.status = 200;
|
|
158
|
+
res.body = JSON.stringify(state.config.public, null, 2);
|
|
159
|
+
} else if (res.error) {
|
|
146
160
|
if (res.status < 400) {
|
|
147
161
|
return res;
|
|
148
162
|
}
|
|
149
163
|
throw new PipelineStatusError(res.status, res.error);
|
|
164
|
+
} else {
|
|
165
|
+
// filter data
|
|
166
|
+
jsonFilter(state, res, {
|
|
167
|
+
limit: limit ? Number.parseInt(limit, 10) : undefined,
|
|
168
|
+
offset: offset ? Number.parseInt(offset, 10) : undefined,
|
|
169
|
+
sheet,
|
|
170
|
+
raw: limit === undefined && offset === undefined && sheet === undefined,
|
|
171
|
+
});
|
|
150
172
|
}
|
|
151
173
|
|
|
152
|
-
// filter data
|
|
153
|
-
jsonFilter(state, res, {
|
|
154
|
-
limit: limit ? Number.parseInt(limit, 10) : undefined,
|
|
155
|
-
offset: offset ? Number.parseInt(offset, 10) : undefined,
|
|
156
|
-
sheet,
|
|
157
|
-
raw: limit === undefined && offset === undefined && sheet === undefined,
|
|
158
|
-
});
|
|
159
|
-
|
|
160
174
|
// set surrogate keys
|
|
161
|
-
const keys = await computeSurrogateKeys(state
|
|
175
|
+
const keys = await computeSurrogateKeys(state);
|
|
162
176
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
163
177
|
|
|
164
178
|
await setCustomResponseHeaders(state, req, res);
|
|
@@ -175,7 +189,7 @@ export async function jsonPipe(state, req) {
|
|
|
175
189
|
await setCustomResponseHeaders(state, req, res);
|
|
176
190
|
}
|
|
177
191
|
if (res.status === 404) {
|
|
178
|
-
const keys = await computeSurrogateKeys(state
|
|
192
|
+
const keys = await computeSurrogateKeys(state);
|
|
179
193
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
180
194
|
}
|
|
181
195
|
return res;
|