@adobe/helix-config 3.2.15 → 3.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.3.1](https://github.com/adobe/helix-config/compare/v3.3.0...v3.3.1) (2024-06-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * export config merge ([#111](https://github.com/adobe/helix-config/issues/111)) ([25f9680](https://github.com/adobe/helix-config/commit/25f9680f74e9dc90a5593d042b75aa0102ebf74d))
7
+
8
+ # [3.3.0](https://github.com/adobe/helix-config/compare/v3.2.15...v3.3.0) (2024-06-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * 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)
14
+
1
15
  ## [3.2.15](https://github.com/adobe/helix-config/compare/v3.2.14...v3.2.15) (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.2.15",
3
+ "version": "3.3.1",
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/index.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ export * from './config-merge.js';
13
14
  export * from './config-view.js';
14
15
  export * from './domain-view.js';
15
16
  export * from './ConfigContext.js';
@@ -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 = 'config') {
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}/config.json`
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,