@adobe/helix-config 2.0.0 → 2.1.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 +7 -0
- package/package.json +2 -2
- package/src/config-view.js +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.1.0](https://github.com/adobe/helix-config/compare/v2.0.0...v2.1.0) (2024-03-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* return 404 for missing branch ([#33](https://github.com/adobe/helix-config/issues/33)) ([b3ea0f4](https://github.com/adobe/helix-config/commit/b3ea0f419f34ee0a94b02b9a67c06c64eec06d2d))
|
|
7
|
+
|
|
1
8
|
# [2.0.0](https://github.com/adobe/helix-config/compare/v1.3.3...v2.0.0) (2024-03-14)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@adobe/eslint-config-helix": "2.0.6",
|
|
37
37
|
"@semantic-release/changelog": "6.0.3",
|
|
38
38
|
"@semantic-release/git": "10.0.1",
|
|
39
|
-
"@semantic-release/npm": "
|
|
39
|
+
"@semantic-release/npm": "12.0.0",
|
|
40
40
|
"c8": "9.1.0",
|
|
41
41
|
"eslint": "8.57.0",
|
|
42
42
|
"husky": "9.0.11",
|
package/src/config-view.js
CHANGED
|
@@ -181,10 +181,14 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
181
181
|
} = opts;
|
|
182
182
|
const rso = { ref, site, org };
|
|
183
183
|
const config = await resolveConfig(ctx, rso, scope);
|
|
184
|
+
const surrogateHeaders = {
|
|
185
|
+
'x-surrogate-key': await getSurrogateKey(opts),
|
|
186
|
+
};
|
|
184
187
|
if (!config) {
|
|
185
188
|
return new PipelineResponse('', {
|
|
186
189
|
status: 404,
|
|
187
190
|
headers: {
|
|
191
|
+
...surrogateHeaders,
|
|
188
192
|
'x-error': 'config not found.',
|
|
189
193
|
},
|
|
190
194
|
});
|
|
@@ -203,15 +207,10 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
const headers = {
|
|
207
|
-
'content-type': 'application/json',
|
|
208
|
-
'x-surrogate-key': await getSurrogateKey(opts),
|
|
209
|
-
};
|
|
210
|
-
|
|
211
210
|
if (opts.scope === SCOPE_DELIVERY) {
|
|
212
211
|
return new PipelineResponse('', {
|
|
213
212
|
headers: {
|
|
214
|
-
|
|
213
|
+
...surrogateHeaders,
|
|
215
214
|
'x-hlx-contentbus-id': config.content.contentBusId,
|
|
216
215
|
'x-hlx-owner': config.code.owner,
|
|
217
216
|
'x-hlx-repo': config.code.repo,
|
|
@@ -237,11 +236,25 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
237
236
|
},
|
|
238
237
|
};
|
|
239
238
|
return new PipelineResponse(JSON.stringify(adminConfig, null, 2), {
|
|
240
|
-
headers
|
|
239
|
+
headers: {
|
|
240
|
+
'content-type': 'application/json',
|
|
241
|
+
...surrogateHeaders,
|
|
242
|
+
},
|
|
241
243
|
});
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
if (opts.scope === SCOPE_PIPELINE) {
|
|
247
|
+
// validate that ref exists in code-bus
|
|
248
|
+
if (!config.head?.html) {
|
|
249
|
+
return new PipelineResponse('', {
|
|
250
|
+
status: 404,
|
|
251
|
+
headers: {
|
|
252
|
+
'x-error': 'ref does not exit (no head.html)',
|
|
253
|
+
...surrogateHeaders,
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
245
258
|
// remove all properties except `host`. pipeline doesn't need the others.
|
|
246
259
|
retainProperty(config.cdn, 'host');
|
|
247
260
|
const pipelineConfig = {
|
|
@@ -258,7 +271,10 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
258
271
|
folders: config.folders,
|
|
259
272
|
};
|
|
260
273
|
return new PipelineResponse(JSON.stringify(pipelineConfig, null, 2), {
|
|
261
|
-
headers
|
|
274
|
+
headers: {
|
|
275
|
+
'content-type': 'application/json',
|
|
276
|
+
...surrogateHeaders,
|
|
277
|
+
},
|
|
262
278
|
});
|
|
263
279
|
}
|
|
264
280
|
|
|
@@ -269,6 +285,9 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
269
285
|
public: {},
|
|
270
286
|
};
|
|
271
287
|
return new PipelineResponse(JSON.stringify(publicConfig, null, 2), {
|
|
272
|
-
headers
|
|
288
|
+
headers: {
|
|
289
|
+
'content-type': 'application/json',
|
|
290
|
+
...surrogateHeaders,
|
|
291
|
+
},
|
|
273
292
|
});
|
|
274
293
|
}
|