@adobe/helix-config 2.12.1 → 2.13.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 +3 -3
- package/src/config-view.js +11 -2
- package/src/schemas/org.schema.cjs +12 -0
- package/src/schemas/org.schema.json +33 -0
- package/src/schemas/profile.schema.json +0 -3
- package/src/schemas/site.schema.json +0 -3
- package/src/storage/config-store.js +18 -11
- package/src/storage/config-validator.js +3 -0
- package/types/org-config.d.ts +37 -0
- package/types/profile-config.d.ts +0 -13
- package/types/site-config.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.13.0](https://github.com/adobe/helix-config/compare/v2.12.2...v2.13.0) (2024-05-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* store tokens in org config ([#72](https://github.com/adobe/helix-config/issues/72)) ([03a3a81](https://github.com/adobe/helix-config/commit/03a3a812ef1ab3147ea73447dced740dfa48555a)), closes [#69](https://github.com/adobe/helix-config/issues/69)
|
|
7
|
+
|
|
8
|
+
## [2.12.2](https://github.com/adobe/helix-config/compare/v2.12.1...v2.12.2) (2024-05-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update adobe fixes ([e62fa79](https://github.com/adobe/helix-config/commit/e62fa79415c617ac250456ac03551fbae1f90766))
|
|
14
|
+
|
|
1
15
|
## [2.12.1](https://github.com/adobe/helix-config/compare/v2.12.0...v2.12.1) (2024-05-04)
|
|
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.13.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@adobe/fetch": "4.1.2",
|
|
62
|
-
"@adobe/helix-shared-config": "10.4.
|
|
63
|
-
"@adobe/helix-shared-git": "3.0.
|
|
62
|
+
"@adobe/helix-shared-config": "10.4.4",
|
|
63
|
+
"@adobe/helix-shared-git": "3.0.9",
|
|
64
64
|
"@adobe/helix-shared-storage": "1.0.0",
|
|
65
65
|
"@adobe/helix-shared-utils": "3.0.2",
|
|
66
66
|
"ajv": "8.13.0",
|
package/src/config-view.js
CHANGED
|
@@ -167,8 +167,8 @@ function retainProperty(obj, prop) {
|
|
|
167
167
|
*/
|
|
168
168
|
async function resolveConfig(ctx, rso, scope) {
|
|
169
169
|
// try to load site config from config-bus
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
let key = `orgs/${rso.org}/sites/${rso.site}.json`;
|
|
171
|
+
let res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
|
|
172
172
|
if (!res.body) {
|
|
173
173
|
if (scope !== SCOPE_ADMIN) {
|
|
174
174
|
return resolveLegacyConfig(ctx, rso, scope);
|
|
@@ -193,6 +193,15 @@ async function resolveConfig(ctx, rso, scope) {
|
|
|
193
193
|
config.head = await loadHeadHtml(ctx, config, rso.ref);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
// check for org config
|
|
197
|
+
key = `orgs/${rso.org}/config.json`;
|
|
198
|
+
res = await ctx.loader.getObject(HELIX_CONFIG_BUS, key);
|
|
199
|
+
if (res.body) {
|
|
200
|
+
const orgConfig = res.json();
|
|
201
|
+
if (orgConfig.tokens) {
|
|
202
|
+
config.tokens = orgConfig.tokens;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
196
205
|
return config;
|
|
197
206
|
}
|
|
198
207
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./org.schema.json');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta:license": [
|
|
3
|
+
"Copyright 2024 Adobe. All rights reserved.",
|
|
4
|
+
"This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
|
|
5
|
+
"you may not use this file except in compliance with the License. You may obtain a copy",
|
|
6
|
+
"of the License at http://www.apache.org/licenses/LICENSE-2.0",
|
|
7
|
+
"",
|
|
8
|
+
"Unless required by applicable law or agreed to in writing, software distributed under",
|
|
9
|
+
"the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
|
|
10
|
+
"OF ANY KIND, either express or implied. See the License for the specific language",
|
|
11
|
+
"governing permissions and limitations under the License."
|
|
12
|
+
],
|
|
13
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
14
|
+
"$id": "https://ns.adobe.com/helix/config/org",
|
|
15
|
+
"title": "Helix Org Config",
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"version": {
|
|
19
|
+
"type": "integer",
|
|
20
|
+
"enum": [1],
|
|
21
|
+
"default": 1
|
|
22
|
+
},
|
|
23
|
+
"title": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/title" },
|
|
24
|
+
"description": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/description" },
|
|
25
|
+
"tokens": {
|
|
26
|
+
"$ref": "https://ns.adobe.com/helix/config/tokens"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": [
|
|
30
|
+
"version"
|
|
31
|
+
],
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|
|
@@ -44,18 +44,20 @@ const FRAGMENTS_COMMON = {
|
|
|
44
44
|
},
|
|
45
45
|
public: 'object',
|
|
46
46
|
robots: 'object',
|
|
47
|
-
tokens: {
|
|
48
|
-
'.': 'tokens',
|
|
49
|
-
'.param': {
|
|
50
|
-
name: 'id',
|
|
51
|
-
'.': 'token',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
47
|
};
|
|
55
48
|
|
|
56
49
|
const FRAGMENTS = {
|
|
57
50
|
sites: FRAGMENTS_COMMON,
|
|
58
51
|
profiles: FRAGMENTS_COMMON,
|
|
52
|
+
org: {
|
|
53
|
+
tokens: {
|
|
54
|
+
'.': 'tokens',
|
|
55
|
+
'.param': {
|
|
56
|
+
name: 'id',
|
|
57
|
+
'.': 'token',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
export function getFragmentInfo(type, relPath) {
|
|
@@ -147,7 +149,7 @@ export class ConfigStore {
|
|
|
147
149
|
this.org = org;
|
|
148
150
|
this.type = type;
|
|
149
151
|
this.name = name;
|
|
150
|
-
this.key = type === org
|
|
152
|
+
this.key = type === 'org'
|
|
151
153
|
? `/orgs/${this.org}/config.json`
|
|
152
154
|
: `/orgs/${this.org}/${this.type}/${this.name}.json`;
|
|
153
155
|
}
|
|
@@ -160,8 +162,13 @@ export class ConfigStore {
|
|
|
160
162
|
if (await storage.head(this.key)) {
|
|
161
163
|
throw new StatusCodeError(409, 'config already exists.');
|
|
162
164
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
if (this.type === 'org' && data.tokens) {
|
|
166
|
+
throw new StatusCodeError(400, 'creating org config with tokens not supported yet.');
|
|
167
|
+
}
|
|
168
|
+
if (this.type !== 'org') {
|
|
169
|
+
updateContentSource(ctx, data.content);
|
|
170
|
+
updateCodeSource(ctx, data.code);
|
|
171
|
+
}
|
|
165
172
|
await validate(data, this.type);
|
|
166
173
|
await storage.put(this.key, JSON.stringify(data), 'application/json');
|
|
167
174
|
await this.purge(ctx, null, data);
|
|
@@ -229,7 +236,7 @@ export class ConfigStore {
|
|
|
229
236
|
delete ret.hash;
|
|
230
237
|
}
|
|
231
238
|
config = jsonPut(old, relPath, data);
|
|
232
|
-
} else {
|
|
239
|
+
} else if (this.type !== 'org') {
|
|
233
240
|
updateContentSource(ctx, config.content);
|
|
234
241
|
updateCodeSource(ctx, config.code);
|
|
235
242
|
}
|
|
@@ -24,6 +24,7 @@ import foldersSchema from '../schemas/folders.schema.cjs';
|
|
|
24
24
|
import googleSchema from '../schemas/content-source-google.schema.cjs';
|
|
25
25
|
import markupSchema from '../schemas/content-source-markup.schema.cjs';
|
|
26
26
|
import metadataSchema from '../schemas/metadata-source.schema.cjs';
|
|
27
|
+
import orgSchema from '../schemas/org.schema.cjs';
|
|
27
28
|
import onedriveSchema from '../schemas/content-source-onedrive.schema.cjs';
|
|
28
29
|
import profileSchema from '../schemas/profile.schema.cjs';
|
|
29
30
|
import robotsSchema from '../schemas/robots.schema.cjs';
|
|
@@ -43,6 +44,7 @@ const SCHEMAS = [
|
|
|
43
44
|
googleSchema,
|
|
44
45
|
markupSchema,
|
|
45
46
|
metadataSchema,
|
|
47
|
+
orgSchema,
|
|
46
48
|
onedriveSchema,
|
|
47
49
|
profileSchema,
|
|
48
50
|
robotsSchema,
|
|
@@ -54,6 +56,7 @@ const SCHEMAS = [
|
|
|
54
56
|
const SCHEMA_TYPES = {
|
|
55
57
|
profiles: profileSchema,
|
|
56
58
|
sites: siteSchema,
|
|
59
|
+
org: orgSchema,
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
/**
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// NOTE: this file is autogenerated via 'npm run docs:types'
|
|
14
|
+
|
|
15
|
+
export interface HelixOrgConfig {
|
|
16
|
+
version: 1;
|
|
17
|
+
/**
|
|
18
|
+
* human readable title. has no influence on the configuration.
|
|
19
|
+
*/
|
|
20
|
+
title?: string;
|
|
21
|
+
/**
|
|
22
|
+
* description for clarity. has no influence on the configuration.
|
|
23
|
+
*/
|
|
24
|
+
description?: string;
|
|
25
|
+
tokens?: Tokens;
|
|
26
|
+
}
|
|
27
|
+
export interface Tokens {
|
|
28
|
+
/**
|
|
29
|
+
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
30
|
+
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
31
|
+
*/
|
|
32
|
+
[k: string]: {
|
|
33
|
+
id?: string;
|
|
34
|
+
hash?: string;
|
|
35
|
+
created?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
// NOTE: this file is autogenerated via 'npm run docs:types'
|
|
14
|
-
import {MountConfig} from '@adobe/helix-shared-config';
|
|
15
14
|
|
|
16
15
|
export interface HelixProfileConfig {
|
|
17
16
|
version: 1;
|
|
@@ -32,7 +31,6 @@ export interface HelixProfileConfig {
|
|
|
32
31
|
sidekick?: SidekickConfig;
|
|
33
32
|
metadata?: Metadata;
|
|
34
33
|
robots?: Robots;
|
|
35
|
-
tokens?: Tokens;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
38
36
|
* Defines the content bus location and source.
|
|
@@ -248,14 +246,3 @@ export interface Metadata {
|
|
|
248
246
|
export interface Robots {
|
|
249
247
|
txt?: string;
|
|
250
248
|
}
|
|
251
|
-
export interface Tokens {
|
|
252
|
-
/**
|
|
253
|
-
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
254
|
-
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
255
|
-
*/
|
|
256
|
-
[k: string]: {
|
|
257
|
-
id?: string;
|
|
258
|
-
hash?: string;
|
|
259
|
-
created?: string;
|
|
260
|
-
};
|
|
261
|
-
}
|
package/types/site-config.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export interface HelixSiteConfig {
|
|
|
35
35
|
sidekick?: SidekickConfig;
|
|
36
36
|
metadata?: Metadata;
|
|
37
37
|
robots?: Robots;
|
|
38
|
-
tokens?: Tokens;
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* Defines the content bus location and source.
|
|
@@ -251,14 +250,3 @@ export interface Metadata {
|
|
|
251
250
|
export interface Robots {
|
|
252
251
|
txt?: string;
|
|
253
252
|
}
|
|
254
|
-
export interface Tokens {
|
|
255
|
-
/**
|
|
256
|
-
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
257
|
-
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
258
|
-
*/
|
|
259
|
-
[k: string]: {
|
|
260
|
-
id?: string;
|
|
261
|
-
hash?: string;
|
|
262
|
-
created?: string;
|
|
263
|
-
};
|
|
264
|
-
}
|