@adobe/helix-config 2.3.3 → 2.4.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/ConfigContext.js +6 -1
- package/src/config-legacy.js +25 -9
- package/src/config-view.js +19 -4
- package/src/storage/config-store.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.4.0](https://github.com/adobe/helix-config/compare/v2.3.4...v2.4.0) (2024-04-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add support for raw config ([#45](https://github.com/adobe/helix-config/issues/45)) ([7e3eab3](https://github.com/adobe/helix-config/commit/7e3eab3930ba33b9e04d502e2391e26580badbe6))
|
|
7
|
+
|
|
8
|
+
## [2.3.4](https://github.com/adobe/helix-config/compare/v2.3.3...v2.3.4) (2024-04-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @aws-sdk/client-s3 to v3.554.0 ([#44](https://github.com/adobe/helix-config/issues/44)) ([da0f561](https://github.com/adobe/helix-config/commit/da0f56137c15bd551c9c18df47854884aada9e1c))
|
|
14
|
+
|
|
1
15
|
## [2.3.3](https://github.com/adobe/helix-config/compare/v2.3.2...v2.3.3) (2024-04-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@adobe/helix-shared-config": "10.4.1",
|
|
60
60
|
"@adobe/helix-shared-process-queue": "3.0.3",
|
|
61
61
|
"@adobe/helix-shared-utils": "3.0.1",
|
|
62
|
-
"@aws-sdk/client-s3": "3.
|
|
62
|
+
"@aws-sdk/client-s3": "3.554.0",
|
|
63
63
|
"@aws-sdk/node-http-handler": "3.374.0",
|
|
64
64
|
"mime": "4.0.1"
|
|
65
65
|
}
|
package/src/ConfigContext.js
CHANGED
|
@@ -27,9 +27,14 @@ export const SCOPE_PIPELINE = 'pipeline';
|
|
|
27
27
|
* Admin Service in JSON includes everything.
|
|
28
28
|
* @type {string}
|
|
29
29
|
*/
|
|
30
|
-
// eslint-disable-next-line no-unused-vars
|
|
31
30
|
export const SCOPE_ADMIN = 'admin';
|
|
32
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Raw config service view, also for legacy sites.
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
export const SCOPE_RAW = 'raw';
|
|
37
|
+
|
|
33
38
|
/**
|
|
34
39
|
* Public / Custom Configs: Sidekick, Production Host, Custom Preview Page / Live Host, Custom JSON.
|
|
35
40
|
* @type {string}
|
package/src/config-legacy.js
CHANGED
|
@@ -80,41 +80,57 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
|
|
|
80
80
|
if (!helixConfig) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
|
-
const { contentBusId
|
|
83
|
+
const { contentBusId } = helixConfig.content.data['/'];
|
|
84
|
+
let source = helixConfig.fstab?.data.mountpoints['/'];
|
|
85
|
+
if (typeof source === 'string') {
|
|
86
|
+
source = {
|
|
87
|
+
type: source.startsWith('https://drive.google.com/')
|
|
88
|
+
? 'google'
|
|
89
|
+
: 'onedrive',
|
|
90
|
+
url: source,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
84
93
|
const config = {
|
|
85
94
|
version: 1,
|
|
86
95
|
code: {
|
|
87
96
|
owner: rso.org,
|
|
88
97
|
repo: rso.site,
|
|
98
|
+
source: {
|
|
99
|
+
type: 'github',
|
|
100
|
+
url: `https://github.com/${rso.org}/${rso.site}`,
|
|
101
|
+
},
|
|
89
102
|
},
|
|
90
103
|
content: {
|
|
91
104
|
contentBusId,
|
|
92
105
|
source,
|
|
93
106
|
},
|
|
107
|
+
folders: helixConfig.fstab?.data.folders ?? {},
|
|
94
108
|
};
|
|
95
109
|
const configAllPreview = await fetchConfigAll(ctx, config.content.contentBusId, 'preview');
|
|
110
|
+
const configAllLive = await fetchConfigAll(ctx, config.content.contentBusId, 'live');
|
|
96
111
|
const { access } = configAllPreview?.config?.data || {};
|
|
97
112
|
if (access) {
|
|
98
113
|
config.access = access;
|
|
99
114
|
}
|
|
115
|
+
if (configAllPreview) {
|
|
116
|
+
config.cdn = configAllPreview.config?.data.cdn ?? {};
|
|
117
|
+
if (!config.cdn.prod?.host && configAllPreview.config?.data.host) {
|
|
118
|
+
config.cdn.prod = {
|
|
119
|
+
host: configAllPreview.config.data.host,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
100
124
|
if (scope === SCOPE_PIPELINE) {
|
|
101
125
|
config.metadata = {};
|
|
102
126
|
if (configAllPreview) {
|
|
103
127
|
config.headers = configAllPreview.headers?.data ?? {};
|
|
104
128
|
config.metadata.preview = configAllPreview.metadata ?? {};
|
|
105
|
-
config.cdn = configAllPreview.config?.data.cdn ?? {};
|
|
106
|
-
if (!config.cdn.prod?.host && configAllPreview.config?.data.host) {
|
|
107
|
-
config.cdn.prod = {
|
|
108
|
-
host: configAllPreview.config.data.host,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
129
|
}
|
|
112
|
-
const configAllLive = await fetchConfigAll(ctx, config.content.contentBusId, 'live');
|
|
113
130
|
if (configAllLive?.metadata) {
|
|
114
131
|
config.metadata.live = configAllLive.metadata;
|
|
115
132
|
}
|
|
116
133
|
|
|
117
|
-
config.folders = helixConfig.fstab.data.folders ?? {};
|
|
118
134
|
if (helixConfig?.head?.data?.html) {
|
|
119
135
|
config.head = {
|
|
120
136
|
html: helixConfig.head.data.html,
|
package/src/config-view.js
CHANGED
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
import { ModifiersConfig } from '@adobe/helix-shared-config/modifiers';
|
|
13
13
|
import { computeSurrogateKey } from '@adobe/helix-shared-utils';
|
|
14
14
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
SCOPE_ADMIN,
|
|
17
|
+
SCOPE_PIPELINE,
|
|
18
|
+
SCOPE_DELIVERY,
|
|
19
|
+
SCOPE_RAW,
|
|
20
|
+
} from './ConfigContext.js';
|
|
16
21
|
import { resolveLegacyConfig } from './config-legacy.js';
|
|
17
22
|
|
|
18
23
|
/**
|
|
@@ -202,7 +207,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
202
207
|
live: getAccessConfig(config.access, 'live'),
|
|
203
208
|
// access.require.repository ?
|
|
204
209
|
};
|
|
205
|
-
if (opts.scope === SCOPE_ADMIN) {
|
|
210
|
+
if (opts.scope === SCOPE_ADMIN || opts.scope === SCOPE_RAW) {
|
|
206
211
|
config.access.admin = admin;
|
|
207
212
|
}
|
|
208
213
|
}
|
|
@@ -235,6 +240,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
235
240
|
...config.content.source,
|
|
236
241
|
},
|
|
237
242
|
};
|
|
243
|
+
delete adminConfig.public;
|
|
238
244
|
return new PipelineResponse(JSON.stringify(adminConfig, null, 2), {
|
|
239
245
|
headers: {
|
|
240
246
|
'content-type': 'application/json',
|
|
@@ -243,13 +249,22 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
243
249
|
});
|
|
244
250
|
}
|
|
245
251
|
|
|
252
|
+
if (opts.scope === SCOPE_RAW) {
|
|
253
|
+
return new PipelineResponse(JSON.stringify(config, null, 2), {
|
|
254
|
+
headers: {
|
|
255
|
+
'content-type': 'application/json',
|
|
256
|
+
...surrogateHeaders,
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
246
261
|
if (opts.scope === SCOPE_PIPELINE) {
|
|
247
262
|
// validate that ref exists in code-bus
|
|
248
263
|
if (!config.head?.html) {
|
|
249
264
|
return new PipelineResponse('', {
|
|
250
265
|
status: 404,
|
|
251
266
|
headers: {
|
|
252
|
-
'x-error': 'ref does not
|
|
267
|
+
'x-error': 'ref does not exist (no head.html)',
|
|
253
268
|
...surrogateHeaders,
|
|
254
269
|
},
|
|
255
270
|
});
|
|
@@ -282,7 +297,7 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
282
297
|
const publicConfig = {
|
|
283
298
|
version: 1,
|
|
284
299
|
...rso,
|
|
285
|
-
public: {},
|
|
300
|
+
public: config.public || {},
|
|
286
301
|
};
|
|
287
302
|
return new PipelineResponse(JSON.stringify(publicConfig, null, 2), {
|
|
288
303
|
headers: {
|