@adobe/helix-config-storage 2.0.3 → 2.0.4

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.0.4](https://github.com/adobe/helix-config-storage/compare/v2.0.3...v2.0.4) (2025-03-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * relax features schema ([#100](https://github.com/adobe/helix-config-storage/issues/100)) ([558a046](https://github.com/adobe/helix-config-storage/commit/558a046a36363bc9c80cc1879209f4bf4a709dad))
7
+
1
8
  ## [2.0.3](https://github.com/adobe/helix-config-storage/compare/v2.0.2...v2.0.3) (2025-03-04)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config-storage",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Helix Config Storage",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -11,7 +11,6 @@
11
11
  */
12
12
  /* eslint-disable no-param-reassign */
13
13
  import crypto from 'crypto';
14
- import { isDeepStrictEqual } from 'util';
15
14
  import { HelixStorage } from '@adobe/helix-shared-storage';
16
15
  import { StatusCodeError } from './status-code-error.js';
17
16
  import {
@@ -19,7 +18,7 @@ import {
19
18
  migrateToken,
20
19
  updateCodeSource,
21
20
  updateContentSource,
22
- deepGetOrCreate, deepPut, prune, createSecret, migrateSecret,
21
+ deepGetOrCreate, deepPut, prune, createSecret, migrateSecret, isDeepEqual,
23
22
  } from './utils.js';
24
23
  import { validate as validateSchema } from './config-validator.js';
25
24
  import { getMergedConfig } from './config-merge.js';
@@ -438,12 +437,12 @@ export class ConfigStore {
438
437
  if (this.type !== 'org') {
439
438
  const oldFeatures = oldConfig?.features ?? {};
440
439
  const newFeatures = newConfig?.features ?? {};
441
- if (!isDeepStrictEqual(oldFeatures, newFeatures)) {
440
+ if (!isDeepEqual(oldFeatures, newFeatures)) {
442
441
  throw new StatusCodeError(403, 'not allowed to modify features');
443
442
  }
444
443
  const oldLimits = oldConfig?.limits ?? {};
445
444
  const newLimits = newConfig?.limits ?? {};
446
- if (!isDeepStrictEqual(oldLimits, newLimits)) {
445
+ if (!isDeepEqual(oldLimits, newLimits)) {
447
446
  throw new StatusCodeError(403, 'not allowed to modify limits');
448
447
  }
449
448
  }
@@ -505,7 +504,7 @@ export class ConfigStore {
505
504
  const frag = getFragmentInfo(this.type, relPath);
506
505
  let config = data;
507
506
  // set config to null if empty object
508
- if (isDeepStrictEqual(config, {})) {
507
+ if (isDeepEqual(config, {})) {
509
508
  config = null;
510
509
  }
511
510
 
@@ -8,14 +8,6 @@
8
8
  "patternProperties": {
9
9
  "^[a-zA-Z0-9-_=]+$": {
10
10
  "type": "object",
11
- "properties": {
12
- "enabled": {
13
- "type": "boolean"
14
- },
15
- "description": {
16
- "type": "string"
17
- }
18
- },
19
11
  "required": [
20
12
  "enabled"
21
13
  ],
package/src/utils.js CHANGED
@@ -305,3 +305,14 @@ export function deepPut(obj, path, value) {
305
305
  }
306
306
  return obj;
307
307
  }
308
+
309
+ /**
310
+ * Lazy implementation of deep equals. Note that isDeepStrictEquals() is not suited for our case,
311
+ * as object with null prototypes are not equal to objects with default prototype.
312
+ * @param {object} o0
313
+ * @param {object} o1
314
+ * @returns {boolean}
315
+ */
316
+ export function isDeepEqual(o0, o1) {
317
+ return JSON.stringify(o0) === JSON.stringify(o1);
318
+ }