@adobe/helix-config 2.10.0 → 2.10.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,10 @@
1
+ ## [2.10.1](https://github.com/adobe/helix-config/compare/v2.10.0...v2.10.1) (2024-04-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * consistent return from update ([bce73a1](https://github.com/adobe/helix-config/commit/bce73a1b423397afa751c15bd67ecad164bc05e1))
7
+
1
8
  # [2.10.0](https://github.com/adobe/helix-config/compare/v2.9.0...v2.10.0) (2024-04-26)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  /* eslint-disable no-param-reassign */
13
+ import { isDeepStrictEqual } from 'util';
13
14
  import { HelixStorage } from './storage.js';
14
15
  import { StatusCodeError } from './status-code-error.js';
15
16
  import {
@@ -186,7 +187,15 @@ export class ConfigStore {
186
187
  const old = buf ? JSON.parse(buf) : null;
187
188
  const frag = getFragmentInfo(this.type, relPath);
188
189
  let config = data;
190
+ // set config to null if empty object
191
+ if (isDeepStrictEqual(config, {})) {
192
+ config = null;
193
+ }
194
+
189
195
  let ret = null;
196
+ if (!config && frag?.type !== 'tokens') {
197
+ throw new StatusCodeError(400, 'no config in body.');
198
+ }
190
199
  if (frag) {
191
200
  if (!old) {
192
201
  throw new StatusCodeError(404, 'config not found.');