@adobe/helix-config 1.2.0 → 1.3.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 +3 -2
- package/src/config-view.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.3.0](https://github.com/adobe/helix-config/compare/v1.2.0...v1.3.0) (2024-03-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add surrogate keys ([#25](https://github.com/adobe/helix-config/issues/25)) ([314c627](https://github.com/adobe/helix-config/commit/314c62736bd0cf63616da9b46cbf9544b9210ae1))
|
|
7
|
+
|
|
1
8
|
# [1.2.0](https://github.com/adobe/helix-config/compare/v1.1.0...v1.2.0) (2024-03-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"*.cjs": "eslint"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@adobe/helix-shared-config": "10.3.12"
|
|
51
|
+
"@adobe/helix-shared-config": "10.3.12",
|
|
52
|
+
"@adobe/helix-shared-utils": "3.0.1"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/src/config-view.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { ModifiersConfig } from '@adobe/helix-shared-config';
|
|
13
|
+
import { computeSurrogateKey } from '@adobe/helix-shared-utils';
|
|
13
14
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
14
15
|
import { SCOPE_ADMIN, SCOPE_PIPELINE, SCOPE_DELIVERY } from './ConfigContext.js';
|
|
15
16
|
import { resolveLegacyConfig } from './config-legacy.js';
|
|
@@ -164,6 +165,13 @@ async function resolveConfig(ctx, rso, scope) {
|
|
|
164
165
|
return config;
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
async function getSurrogateKey(opts) {
|
|
169
|
+
const { site, org } = opts;
|
|
170
|
+
const orgKey = await computeSurrogateKey(`${org}_config.json`);
|
|
171
|
+
const siteKey = await computeSurrogateKey(`${site}--${org}_config.json`);
|
|
172
|
+
return `${orgKey} ${siteKey}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
167
175
|
export async function getConfigResponse(ctx, opts) {
|
|
168
176
|
const {
|
|
169
177
|
ref, site, org, scope,
|
|
@@ -194,11 +202,13 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
194
202
|
|
|
195
203
|
const headers = {
|
|
196
204
|
'content-type': 'application/json',
|
|
205
|
+
'x-surrogate-key': await getSurrogateKey(opts),
|
|
197
206
|
};
|
|
198
207
|
|
|
199
208
|
if (opts.scope === SCOPE_DELIVERY) {
|
|
200
209
|
return new PipelineResponse('', {
|
|
201
210
|
headers: {
|
|
211
|
+
'x-surrogate-key': await getSurrogateKey(opts),
|
|
202
212
|
'x-hlx-contentbus-id': config.content.contentBusId,
|
|
203
213
|
'x-hlx-owner': config.code.owner,
|
|
204
214
|
'x-hlx-repo': config.code.repo,
|