@adobe/helix-shared-config 2.0.6 → 2.1.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
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.1](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config@2.1.0...@adobe/helix-shared-config@2.1.1) (2022-05-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * proxy clone to not change original configuration ([#686](https://github.com/adobe/helix-shared/issues/686)) ([96f9ce7](https://github.com/adobe/helix-shared/commit/96f9ce7dc90cd97efc44ecd7a06151451dee9d3e))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.1.0](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config@2.0.7...@adobe/helix-shared-config@2.1.0) (2022-05-20)
18
+
19
+
20
+ ### Features
21
+
22
+ * add index configuration ([#684](https://github.com/adobe/helix-shared/issues/684)) ([2cdec6f](https://github.com/adobe/helix-shared/commit/2cdec6f0c27b114d239ac524e3776e2d7e65fb18))
23
+
24
+
25
+
26
+
27
+
28
+ ## [2.0.7](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config@2.0.6...@adobe/helix-shared-config@2.0.7) (2022-05-14)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **deps:** update external fixes ([#680](https://github.com/adobe/helix-shared/issues/680)) ([75dc78e](https://github.com/adobe/helix-shared/commit/75dc78ef83e862f199c2fd56f298f2f9459dd742))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [2.0.6](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config@2.0.5...@adobe/helix-shared-config@2.0.6) (2022-05-06)
7
40
 
8
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-shared-config",
3
- "version": "2.0.6",
3
+ "version": "2.1.1",
4
4
  "description": "Shared modules of the Helix Project - config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -27,18 +27,18 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@adobe/helix-fetch": "^3.0.3",
30
- "@adobe/helix-shared-git": "^2.0.2",
30
+ "@adobe/helix-shared-git": "^2.0.3",
31
31
  "@adobe/helix-shared-prune": "^1.0.5",
32
- "@adobe/helix-shared-utils": "^2.0.9",
32
+ "@adobe/helix-shared-utils": "^2.0.10",
33
33
  "ajv": "8.11.0",
34
34
  "ajv-formats": "2.1.1",
35
35
  "cookie": "0.5.0",
36
36
  "fs-extra": "10.1.0",
37
37
  "ignore": "5.2.0",
38
- "lru-cache": "7.9.0",
38
+ "lru-cache": "7.10.1",
39
39
  "object-hash": "3.0.0",
40
40
  "uri-js": "4.4.1",
41
- "yaml": "2.0.1"
41
+ "yaml": "2.1.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@adobe/helix-shared-wrap": "^1.0.5",
@@ -49,5 +49,5 @@
49
49
  "mocha": "10.0.0",
50
50
  "nock": "13.2.4"
51
51
  },
52
- "gitHead": "5c10ea764bd4393fae9b091842a230dca3e315eb"
52
+ "gitHead": "84e3915214c73e1078526b45c7d5116836a62a50"
53
53
  }
@@ -35,6 +35,34 @@ class IndexConfig extends SchemaDerivedConfig {
35
35
  });
36
36
  }
37
37
 
38
+ /**
39
+ * Adds an index definition.
40
+ *
41
+ * @param {Object} index index configuration
42
+ * @param {string} index.name index name
43
+ * @param {Array} index.include paths to include
44
+ * @param {Array} index.exclude paths to exclude
45
+ * @param {string} index.target target
46
+ * @param {object} index.properties properties to add to the index
47
+ */
48
+ addIndex({
49
+ name, include, exclude, target, properties,
50
+ }) {
51
+ const { indices } = this._cfg;
52
+ if (indices[name]) {
53
+ throw new Error(`Unable to add index definition with existing name: ${name}`);
54
+ }
55
+ indices[name] = {
56
+ include,
57
+ exclude,
58
+ target,
59
+ properties,
60
+ };
61
+
62
+ // let BaseConfig.toYAML() use the JSON output
63
+ this._document = null;
64
+ }
65
+
38
66
  /**
39
67
  * Evaluates a variable expression
40
68
  * @param {string} expression the expression to encode
@@ -135,10 +135,11 @@ class SchemaDerivedConfig extends BaseConfig {
135
135
  await this.loadConfig();
136
136
  await this.validate();
137
137
 
138
- this._content = new Proxy(this._cfg, this.defaultHandler(''));
138
+ const cfg = JSON.parse(JSON.stringify(this._cfg));
139
+ this._content = new Proxy(cfg, this.defaultHandler(''));
139
140
 
140
141
  // redefine getters
141
- Object.keys(this._cfg).forEach((key) => {
142
+ Object.keys(cfg).forEach((key) => {
142
143
  if (!(key in this)) {
143
144
  this[key] = this._content[key];
144
145
  }