@adobe/helix-config 3.2.14 → 3.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 +14 -0
- package/package.json +3 -2
- package/src/config-legacy.js +1 -0
- package/src/config-view.js +5 -3
- package/src/schemas/profiles.schema.cjs +12 -0
- package/src/schemas/profiles.schema.json +38 -0
- package/src/schemas/sites.schema.cjs +12 -0
- package/src/schemas/sites.schema.json +38 -0
- package/src/storage/config-store.js +23 -2
- package/src/storage/config-validator.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.3.0](https://github.com/adobe/helix-config/compare/v3.2.15...v3.3.0) (2024-06-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add site and profile lists ([#110](https://github.com/adobe/helix-config/issues/110)) ([98c6a61](https://github.com/adobe/helix-config/commit/98c6a6102578fb4695704e1be44f6e7321c46d4d)), closes [#84](https://github.com/adobe/helix-config/issues/84) [#85](https://github.com/adobe/helix-config/issues/85)
|
|
7
|
+
|
|
8
|
+
## [3.2.15](https://github.com/adobe/helix-config/compare/v3.2.14...v3.2.15) (2024-06-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* legacy sites with apiKey but no allow must not authenticate ([#109](https://github.com/adobe/helix-config/issues/109)) ([421575e](https://github.com/adobe/helix-config/commit/421575eb9093820a824031695f26bbc568dd4505)), closes [#91](https://github.com/adobe/helix-config/issues/91)
|
|
14
|
+
|
|
1
15
|
## [3.2.14](https://github.com/adobe/helix-config/compare/v3.2.13...v3.2.14) (2024-06-20)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Helix Config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"mocha-multi-reporters": "1.5.1",
|
|
52
52
|
"mocha-suppress-logs": "0.5.1",
|
|
53
53
|
"nock": "13.5.4",
|
|
54
|
-
"semantic-release": "24.0.0"
|
|
54
|
+
"semantic-release": "24.0.0",
|
|
55
|
+
"xml2js": "0.6.2"
|
|
55
56
|
},
|
|
56
57
|
"lint-staged": {
|
|
57
58
|
"*.js": "eslint",
|
package/src/config-legacy.js
CHANGED
package/src/config-view.js
CHANGED
|
@@ -122,8 +122,7 @@ export async function getAccessConfig(ctx, config, partition, rso) {
|
|
|
122
122
|
.filter((hash) => !!hash),
|
|
123
123
|
clientCertDN: toArray(access[partition]?.clientCertDN ?? access.clientCertDN),
|
|
124
124
|
};
|
|
125
|
-
// if an allow is defined but no apiKeyId, create a fake one so that auth is still
|
|
126
|
-
// enforced. later we can remove the allow and the apiKeyId in favor of the tokenHash
|
|
125
|
+
// if an allow is defined but no apiKeyId, create a fake one so that auth is still enforced.
|
|
127
126
|
if (allow.length && !cfg.apiKeyId.length) {
|
|
128
127
|
cfg.apiKeyId.push('dummy');
|
|
129
128
|
}
|
|
@@ -137,7 +136,10 @@ export async function getAccessConfig(ctx, config, partition, rso) {
|
|
|
137
136
|
cfg.tokenHash.push(globalTokenHash);
|
|
138
137
|
} else if (!cfg.tokenHash.length) {
|
|
139
138
|
// add a dummy or global hash if no tokens match the apiKeyIds.
|
|
140
|
-
|
|
139
|
+
if (!config.legacy || allow.length) {
|
|
140
|
+
// but only add for non-legacy sites or legacy with allows
|
|
141
|
+
cfg.tokenHash.push(globalTokenHash || 'n/a');
|
|
142
|
+
}
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -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('./profiles.schema.json');
|
|
@@ -0,0 +1,38 @@
|
|
|
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/profiles",
|
|
15
|
+
"title": "Helix Profiles List",
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"profiles": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"name": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"name"
|
|
29
|
+
],
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"profiles"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false
|
|
38
|
+
}
|
|
@@ -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('./sites.schema.json');
|
|
@@ -0,0 +1,38 @@
|
|
|
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/sites",
|
|
15
|
+
"title": "Helix Sites List",
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"sites": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"name": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"name"
|
|
29
|
+
],
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"sites"
|
|
36
|
+
],
|
|
37
|
+
"additionalProperties": false
|
|
38
|
+
}
|
|
@@ -148,7 +148,7 @@ export class ConfigStore {
|
|
|
148
148
|
* @param {string} type store type (org, sites, profiles, secrets, users)
|
|
149
149
|
* @param {string} name config name
|
|
150
150
|
*/
|
|
151
|
-
constructor(org, type = 'org', name = '
|
|
151
|
+
constructor(org, type = 'org', name = '') {
|
|
152
152
|
if (!org) {
|
|
153
153
|
throw new Error('org required');
|
|
154
154
|
}
|
|
@@ -159,7 +159,7 @@ export class ConfigStore {
|
|
|
159
159
|
this.type = type;
|
|
160
160
|
this.name = name;
|
|
161
161
|
this.key = type === 'org'
|
|
162
|
-
? `/orgs/${this.org}
|
|
162
|
+
? `/orgs/${this.org}/${this.name || 'config'}.json`
|
|
163
163
|
: `/orgs/${this.org}/${this.type}/${this.name}.json`;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -186,7 +186,28 @@ export class ConfigStore {
|
|
|
186
186
|
await this.purge(ctx, null, data);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
async #list(ctx) {
|
|
190
|
+
const storage = HelixStorage.fromContext(ctx).configBus();
|
|
191
|
+
const key = `/orgs/${this.org}/${this.type}`;
|
|
192
|
+
const list = await storage.list(key);
|
|
193
|
+
return {
|
|
194
|
+
[this.type]: list.map((entry) => {
|
|
195
|
+
const siteKey = entry.key;
|
|
196
|
+
if (siteKey.endsWith('.json')) {
|
|
197
|
+
return {
|
|
198
|
+
name: siteKey.substring(0, siteKey.length - 5),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
}).filter((entry) => entry),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
189
206
|
async read(ctx, relPath = '') {
|
|
207
|
+
if (this.name === '' && (this.type === 'sites' || this.type === 'profiles')) {
|
|
208
|
+
return this.#list(ctx);
|
|
209
|
+
}
|
|
210
|
+
|
|
190
211
|
const storage = HelixStorage.fromContext(ctx).configBus();
|
|
191
212
|
const buf = await storage.get(this.key);
|
|
192
213
|
if (!buf) {
|
|
@@ -29,9 +29,11 @@ import orgSchema from '../schemas/org.schema.cjs';
|
|
|
29
29
|
import onedriveSchema from '../schemas/content-source-onedrive.schema.cjs';
|
|
30
30
|
import publicSchema from '../schemas/public.schema.cjs';
|
|
31
31
|
import profileSchema from '../schemas/profile.schema.cjs';
|
|
32
|
+
import profilesSchema from '../schemas/profiles.schema.cjs';
|
|
32
33
|
import robotsSchema from '../schemas/robots.schema.cjs';
|
|
33
34
|
import sidekickSchema from '../schemas/sidekick.schema.cjs';
|
|
34
35
|
import siteSchema from '../schemas/site.schema.cjs';
|
|
36
|
+
import sitesSchema from '../schemas/sites.schema.cjs';
|
|
35
37
|
import tokensSchema from '../schemas/tokens.schema.cjs';
|
|
36
38
|
import userSchema from '../schemas/user.schema.cjs';
|
|
37
39
|
import usersSchema from '../schemas/users.schema.cjs';
|
|
@@ -53,9 +55,11 @@ export const SCHEMAS = [
|
|
|
53
55
|
onedriveSchema,
|
|
54
56
|
publicSchema,
|
|
55
57
|
profileSchema,
|
|
58
|
+
profilesSchema,
|
|
56
59
|
robotsSchema,
|
|
57
60
|
sidekickSchema,
|
|
58
61
|
siteSchema,
|
|
62
|
+
sitesSchema,
|
|
59
63
|
tokensSchema,
|
|
60
64
|
userSchema,
|
|
61
65
|
usersSchema,
|