@adobe/helix-config 2.13.0 → 2.14.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [2.14.0](https://github.com/adobe/helix-config/compare/v2.13.1...v2.14.0) (2024-05-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * simplify token cretion on empty org ([#74](https://github.com/adobe/helix-config/issues/74)) ([327747a](https://github.com/adobe/helix-config/commit/327747a4a34e4b3ae37f732e1631a40184190b8b))
7
+
8
+ ## [2.13.1](https://github.com/adobe/helix-config/compare/v2.13.0...v2.13.1) (2024-05-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * support old configs without data ([#73](https://github.com/adobe/helix-config/issues/73)) ([bfe92bf](https://github.com/adobe/helix-config/commit/bfe92bf567af97317f69be0b43ed39cb4f1f33eb))
14
+
1
15
  # [2.13.0](https://github.com/adobe/helix-config/compare/v2.12.2...v2.13.0) (2024-05-07)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -117,7 +117,8 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
117
117
  return null;
118
118
  }
119
119
  const { contentBusId } = helixConfig.content.data['/'];
120
- let source = helixConfig.fstab?.data.mountpoints['/'];
120
+ const fstab = helixConfig.fstab.data || helixConfig.fstab;
121
+ let source = fstab.mountpoints['/'];
121
122
  if (typeof source === 'string') {
122
123
  source = {
123
124
  type: source.startsWith('https://drive.google.com/')
@@ -142,9 +143,9 @@ export async function resolveLegacyConfig(ctx, rso, scope) {
142
143
  contentBusId,
143
144
  source,
144
145
  },
145
- folders: helixConfig.fstab?.data.folders ?? {},
146
+ folders: fstab.folders ?? {},
146
147
  /* c8 ignore next */
147
- head: helixConfig?.head?.data ?? {},
148
+ head: helixConfig?.head?.data ?? helixConfig?.head ?? {},
148
149
  };
149
150
  const configAllPreview = await fetchConfigAll(ctx, config.content.contentBusId, 'preview');
150
151
  const configAllLive = await fetchConfigAll(ctx, config.content.contentBusId, 'live');
@@ -191,7 +191,7 @@ export class ConfigStore {
191
191
  async update(ctx, data, relPath = '') {
192
192
  const storage = HelixStorage.fromContext(ctx).configBus();
193
193
  const buf = await storage.get(this.key);
194
- const old = buf ? JSON.parse(buf) : null;
194
+ let old = buf ? JSON.parse(buf) : null;
195
195
  const frag = getFragmentInfo(this.type, relPath);
196
196
  let config = data;
197
197
  // set config to null if empty object
@@ -205,7 +205,11 @@ export class ConfigStore {
205
205
  }
206
206
  if (frag) {
207
207
  if (!old) {
208
- throw new StatusCodeError(404, 'config not found.');
208
+ if (this.type === 'org' && frag.type === 'tokens') {
209
+ old = {};
210
+ } else {
211
+ throw new StatusCodeError(404, 'config not found.');
212
+ }
209
213
  }
210
214
  if (relPath === 'code') {
211
215
  updateCodeSource(ctx, data);