@adobe/helix-config 2.13.1 → 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,10 @@
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
+
1
8
  ## [2.13.1](https://github.com/adobe/helix-config/compare/v2.13.0...v2.13.1) (2024-05-07)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "2.13.1",
3
+ "version": "2.14.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -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);