@adobe/helix-config 3.9.3 → 3.10.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 +1 -1
- package/src/config-view.js +17 -12
- package/src/schemas/headers.schema.json +3 -3
- package/src/schemas/org.schema.json +0 -3
- package/src/schemas/profile.schema.json +6 -0
- package/src/schemas/site.schema.json +3 -0
- package/src/schemas/user.schema.json +1 -0
- package/src/storage/config-store.js +17 -17
- package/types/org-config.d.ts +2 -14
- package/types/profile-config.d.ts +30 -1
- package/types/site-config.d.ts +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.10.0](https://github.com/adobe/helix-config/compare/v3.9.4...v3.10.0) (2024-07-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* move tokens from org to sites/profiles ([#151](https://github.com/adobe/helix-config/issues/151)) ([4eb3073](https://github.com/adobe/helix-config/commit/4eb3073386b951c88d5318d7511a41e0fb8a0eb5))
|
|
7
|
+
|
|
8
|
+
## [3.9.4](https://github.com/adobe/helix-config/compare/v3.9.3...v3.9.4) (2024-07-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix schema ([#148](https://github.com/adobe/helix-config/issues/148)) ([43e13d2](https://github.com/adobe/helix-config/commit/43e13d26c1045001248fb3f002b53fcb71b820d0))
|
|
14
|
+
|
|
1
15
|
## [3.9.3](https://github.com/adobe/helix-config/compare/v3.9.2...v3.9.3) (2024-07-22)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/config-view.js
CHANGED
|
@@ -210,6 +210,15 @@ function retainProperty(obj, prop) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
async function loadProfile(ctx, rso, name) {
|
|
214
|
+
const profileKey = `orgs/${rso.org}/profiles/${name}.json`;
|
|
215
|
+
const res = await ctx.loader.getObject(HELIX_CONFIG_BUS, profileKey);
|
|
216
|
+
if (res.body) {
|
|
217
|
+
return res.json();
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
213
222
|
/**
|
|
214
223
|
* Returns the config for the given RSO
|
|
215
224
|
* @param ctx
|
|
@@ -220,16 +229,20 @@ function retainProperty(obj, prop) {
|
|
|
220
229
|
async function resolveConfig(ctx, rso, scope) {
|
|
221
230
|
// try to load site config from config-bus
|
|
222
231
|
const key = `orgs/${rso.org}/sites/${rso.site}.json`;
|
|
223
|
-
|
|
232
|
+
const res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
|
|
224
233
|
if (!res.body) {
|
|
225
234
|
if (scope !== SCOPE_ADMIN) {
|
|
226
|
-
|
|
235
|
+
const config = await resolveLegacyConfig(ctx, rso, scope);
|
|
236
|
+
if (config) {
|
|
237
|
+
const profile = await loadProfile(ctx, rso, 'default');
|
|
238
|
+
config.tokens = profile?.tokens || {};
|
|
239
|
+
}
|
|
240
|
+
return config;
|
|
227
241
|
} else {
|
|
228
242
|
return null;
|
|
229
243
|
}
|
|
230
244
|
}
|
|
231
245
|
const site = res.json();
|
|
232
|
-
let profile;
|
|
233
246
|
|
|
234
247
|
// always load default profile if available
|
|
235
248
|
if (!site.extends?.profile) {
|
|
@@ -237,11 +250,7 @@ async function resolveConfig(ctx, rso, scope) {
|
|
|
237
250
|
profile: 'default',
|
|
238
251
|
};
|
|
239
252
|
}
|
|
240
|
-
const
|
|
241
|
-
res = await ctx.loader.getObject(HELIX_CONFIG_BUS, profileKey);
|
|
242
|
-
if (res.body) {
|
|
243
|
-
profile = res.json();
|
|
244
|
-
}
|
|
253
|
+
const profile = await loadProfile(ctx, rso, site.extends.profile);
|
|
245
254
|
const config = getMergedConfig(site, profile);
|
|
246
255
|
if (scope === SCOPE_PIPELINE) {
|
|
247
256
|
config.metadata = {
|
|
@@ -383,10 +392,6 @@ export async function getConfigResponse(ctx, opts) {
|
|
|
383
392
|
}
|
|
384
393
|
|
|
385
394
|
const orgConfig = await loadOrgConfig(ctx, org);
|
|
386
|
-
if (orgConfig?.tokens) {
|
|
387
|
-
config.tokens = orgConfig.tokens;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
395
|
if (config.access) {
|
|
391
396
|
// normalize access config
|
|
392
397
|
const { admin = {} } = config.access;
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"patternProperties": {
|
|
18
18
|
"^/[a-zA-Z0-9-/.]*\\*{0,2}$": {
|
|
19
19
|
"type": "array",
|
|
20
|
-
"items":
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
"items": {
|
|
21
|
+
"$ref": "https://ns.adobe.com/helix/config/common#/definitions/keyValuePair"
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"additionalProperties": false
|
|
@@ -22,9 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"title": { "$ref": "https://ns.adobe.com/helix/config/common#/definitions/title" },
|
|
24
24
|
"description": { "$ref": "https://ns.adobe.com/helix/config/common#/definitions/description" },
|
|
25
|
-
"tokens": {
|
|
26
|
-
"$ref": "https://ns.adobe.com/helix/config/tokens"
|
|
27
|
-
},
|
|
28
25
|
"users": {
|
|
29
26
|
"$ref": "https://ns.adobe.com/helix/config/users"
|
|
30
27
|
},
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"access": {
|
|
42
42
|
"$ref": "https://ns.adobe.com/helix/config/access"
|
|
43
43
|
},
|
|
44
|
+
"tokens": {
|
|
45
|
+
"$ref": "https://ns.adobe.com/helix/config/tokens"
|
|
46
|
+
},
|
|
47
|
+
"groups": {
|
|
48
|
+
"$ref": "https://ns.adobe.com/helix/config/groups"
|
|
49
|
+
},
|
|
44
50
|
"sidekick": {
|
|
45
51
|
"$ref": "https://ns.adobe.com/helix/config/sidekick"
|
|
46
52
|
},
|
|
@@ -41,6 +41,20 @@ const FRAGMENTS_COMMON = {
|
|
|
41
41
|
preview: 'object',
|
|
42
42
|
live: 'object',
|
|
43
43
|
},
|
|
44
|
+
tokens: {
|
|
45
|
+
'.': 'tokens',
|
|
46
|
+
'.param': {
|
|
47
|
+
name: 'id',
|
|
48
|
+
'.': 'token',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
groups: {
|
|
52
|
+
'.': 'object',
|
|
53
|
+
'.param': {
|
|
54
|
+
'.': 'object',
|
|
55
|
+
members: 'object',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
44
58
|
public: 'object',
|
|
45
59
|
robots: 'object',
|
|
46
60
|
};
|
|
@@ -49,23 +63,9 @@ const FRAGMENTS = {
|
|
|
49
63
|
sites: {
|
|
50
64
|
...FRAGMENTS_COMMON,
|
|
51
65
|
extends: 'object',
|
|
52
|
-
groups: {
|
|
53
|
-
'.': 'object',
|
|
54
|
-
'.param': {
|
|
55
|
-
'.': 'object',
|
|
56
|
-
members: 'object',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
66
|
},
|
|
60
67
|
profiles: FRAGMENTS_COMMON,
|
|
61
68
|
org: {
|
|
62
|
-
tokens: {
|
|
63
|
-
'.': 'tokens',
|
|
64
|
-
'.param': {
|
|
65
|
-
name: 'id',
|
|
66
|
-
'.': 'token',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
69
|
users: {
|
|
70
70
|
'.': 'users',
|
|
71
71
|
'.param': {
|
|
@@ -195,8 +195,8 @@ export class ConfigStore {
|
|
|
195
195
|
if (await storage.head(this.key)) {
|
|
196
196
|
throw new StatusCodeError(409, 'config already exists.');
|
|
197
197
|
}
|
|
198
|
-
if (
|
|
199
|
-
throw new StatusCodeError(400, 'creating
|
|
198
|
+
if (data.tokens) {
|
|
199
|
+
throw new StatusCodeError(400, 'creating config with tokens not supported yet.');
|
|
200
200
|
}
|
|
201
201
|
if (this.type === 'org' && data.users) {
|
|
202
202
|
throw new StatusCodeError(400, 'creating org config with users is not supported yet.');
|
|
@@ -264,7 +264,7 @@ export class ConfigStore {
|
|
|
264
264
|
}
|
|
265
265
|
if (frag) {
|
|
266
266
|
if (!old) {
|
|
267
|
-
if (this.type === '
|
|
267
|
+
if (this.type === 'profiles' && frag.type === 'tokens') {
|
|
268
268
|
old = {};
|
|
269
269
|
} else {
|
|
270
270
|
throw new StatusCodeError(404, 'config not found.');
|
package/types/org-config.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
// NOTE: this file is autogenerated via 'npm run docs:types'
|
|
14
14
|
|
|
15
|
-
export type Users =
|
|
15
|
+
export type Users = User[];
|
|
16
16
|
|
|
17
17
|
export interface HelixOrgConfig {
|
|
18
18
|
version: 1;
|
|
@@ -24,22 +24,10 @@ export interface HelixOrgConfig {
|
|
|
24
24
|
* description for clarity. has no influence on the configuration.
|
|
25
25
|
*/
|
|
26
26
|
description?: string;
|
|
27
|
-
tokens?: Tokens;
|
|
28
27
|
users?: Users;
|
|
29
28
|
groups?: Groups;
|
|
30
29
|
}
|
|
31
|
-
export interface
|
|
32
|
-
/**
|
|
33
|
-
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
34
|
-
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
35
|
-
*/
|
|
36
|
-
[k: string]: {
|
|
37
|
-
id?: string;
|
|
38
|
-
hash?: string;
|
|
39
|
-
created?: string;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export interface HttpsNsAdobeComHelixConfigUser {
|
|
30
|
+
export interface User {
|
|
43
31
|
id: string;
|
|
44
32
|
email: string;
|
|
45
33
|
name?: string;
|
|
@@ -28,6 +28,8 @@ export interface HelixProfileConfig {
|
|
|
28
28
|
headers?: HelixHeadersConfig;
|
|
29
29
|
cdn?: CDNConfig;
|
|
30
30
|
access?: Access;
|
|
31
|
+
tokens?: Tokens;
|
|
32
|
+
groups?: Groups;
|
|
31
33
|
sidekick?: SidekickConfig;
|
|
32
34
|
metadata?: Metadata;
|
|
33
35
|
robots?: Robots;
|
|
@@ -102,7 +104,7 @@ export interface HelixHeadersConfig {
|
|
|
102
104
|
* This interface was referenced by `HelixHeadersConfig`'s JSON-Schema definition
|
|
103
105
|
* via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
|
|
104
106
|
*/
|
|
105
|
-
[k: string]: []
|
|
107
|
+
[k: string]: KeyValuePair[];
|
|
106
108
|
}
|
|
107
109
|
export interface KeyValuePair {
|
|
108
110
|
key: string;
|
|
@@ -254,6 +256,33 @@ export interface SiteAccessConfig {
|
|
|
254
256
|
*/
|
|
255
257
|
clientCertDN?: string[];
|
|
256
258
|
}
|
|
259
|
+
export interface Tokens {
|
|
260
|
+
/**
|
|
261
|
+
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
262
|
+
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
263
|
+
*/
|
|
264
|
+
[k: string]: {
|
|
265
|
+
id?: string;
|
|
266
|
+
hash?: string;
|
|
267
|
+
created?: string;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export interface Groups {
|
|
271
|
+
[k: string]: Group;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* A group of members. Can be referenced in access.admin.role.
|
|
275
|
+
*
|
|
276
|
+
* This interface was referenced by `Groups`'s JSON-Schema definition
|
|
277
|
+
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
278
|
+
*/
|
|
279
|
+
export interface Group {
|
|
280
|
+
members: {
|
|
281
|
+
email: string;
|
|
282
|
+
name?: string;
|
|
283
|
+
[k: string]: unknown;
|
|
284
|
+
}[];
|
|
285
|
+
}
|
|
257
286
|
export interface SidekickConfig {
|
|
258
287
|
plugins?: SidekickPlugin[];
|
|
259
288
|
[k: string]: unknown;
|
package/types/site-config.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface HelixSiteConfig {
|
|
|
32
32
|
headers?: HelixHeadersConfig;
|
|
33
33
|
cdn?: CDNConfig;
|
|
34
34
|
access?: Access;
|
|
35
|
+
tokens?: Tokens;
|
|
35
36
|
groups?: Groups;
|
|
36
37
|
sidekick?: SidekickConfig;
|
|
37
38
|
metadata?: Metadata;
|
|
@@ -110,7 +111,7 @@ export interface HelixHeadersConfig {
|
|
|
110
111
|
* This interface was referenced by `HelixHeadersConfig`'s JSON-Schema definition
|
|
111
112
|
* via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
|
|
112
113
|
*/
|
|
113
|
-
[k: string]: []
|
|
114
|
+
[k: string]: KeyValuePair[];
|
|
114
115
|
}
|
|
115
116
|
export interface KeyValuePair {
|
|
116
117
|
key: string;
|
|
@@ -262,6 +263,17 @@ export interface SiteAccessConfig {
|
|
|
262
263
|
*/
|
|
263
264
|
clientCertDN?: string[];
|
|
264
265
|
}
|
|
266
|
+
export interface Tokens {
|
|
267
|
+
/**
|
|
268
|
+
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
269
|
+
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
270
|
+
*/
|
|
271
|
+
[k: string]: {
|
|
272
|
+
id?: string;
|
|
273
|
+
hash?: string;
|
|
274
|
+
created?: string;
|
|
275
|
+
};
|
|
276
|
+
}
|
|
265
277
|
export interface Groups {
|
|
266
278
|
[k: string]: Group;
|
|
267
279
|
}
|