@adobe/helix-config 1.2.0 → 1.3.1
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 -2
- package/src/config-legacy.js +2 -2
- package/src/config-view.js +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.3.1](https://github.com/adobe/helix-config/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* config locations ([#27](https://github.com/adobe/helix-config/issues/27)) ([675fde2](https://github.com/adobe/helix-config/commit/675fde2f2beb8baa694b21bbc99e8d9bb128e5c4))
|
|
7
|
+
|
|
8
|
+
# [1.3.0](https://github.com/adobe/helix-config/compare/v1.2.0...v1.3.0) (2024-03-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add surrogate keys ([#25](https://github.com/adobe/helix-config/issues/25)) ([314c627](https://github.com/adobe/helix-config/commit/314c62736bd0cf63616da9b46cbf9544b9210ae1))
|
|
14
|
+
|
|
1
15
|
# [1.2.0](https://github.com/adobe/helix-config/compare/v1.1.0...v1.2.0) (2024-03-08)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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-legacy.js
CHANGED
|
@@ -91,7 +91,7 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
|
|
|
91
91
|
source,
|
|
92
92
|
},
|
|
93
93
|
};
|
|
94
|
-
const configAllPreview = await fetchConfigAll(ctx, config.contentBusId, 'preview');
|
|
94
|
+
const configAllPreview = await fetchConfigAll(ctx, config.content.contentBusId, 'preview');
|
|
95
95
|
const { access } = configAllPreview?.config?.data || {};
|
|
96
96
|
if (access) {
|
|
97
97
|
config.access = access;
|
|
@@ -108,7 +108,7 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
const configAllLive = await fetchConfigAll(ctx, config.contentBusId, 'live');
|
|
111
|
+
const configAllLive = await fetchConfigAll(ctx, config.content.contentBusId, 'live');
|
|
112
112
|
if (configAllLive?.metadata) {
|
|
113
113
|
config.metadata.live = configAllLive.metadata;
|
|
114
114
|
}
|
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';
|
|
@@ -85,7 +86,7 @@ async function loadMetadata(ctx, config, partition) {
|
|
|
85
86
|
// generate the metadata-all.json first
|
|
86
87
|
const metadata = [];
|
|
87
88
|
for (const path of paths) {
|
|
88
|
-
const key = `/${config.contentBusId}/${partition}${path}`;
|
|
89
|
+
const key = `/${config.content.contentBusId}/${partition}${path}`;
|
|
89
90
|
// eslint-disable-next-line no-await-in-loop
|
|
90
91
|
const buf = await contentBus.get(key);
|
|
91
92
|
if (buf) {
|
|
@@ -109,7 +110,7 @@ async function loadMetadata(ctx, config, partition) {
|
|
|
109
110
|
|
|
110
111
|
async function loadHeadHtml(ctx, config, ref) {
|
|
111
112
|
const codeBus = ctx.storage.codeBus();
|
|
112
|
-
const key = `${config.owner}/${config.repo}/${ref}/head.html`;
|
|
113
|
+
const key = `${config.code.owner}/${config.code.repo}/${ref}/head.html`;
|
|
113
114
|
const buf = await codeBus.get(key);
|
|
114
115
|
if (buf) {
|
|
115
116
|
return {
|
|
@@ -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,
|