@adobe/helix-shared-config 2.0.7 → 2.1.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
@@ -3,6 +3,17 @@
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.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)
7
+
8
+
9
+ ### Features
10
+
11
+ * add index configuration ([#684](https://github.com/adobe/helix-shared/issues/684)) ([2cdec6f](https://github.com/adobe/helix-shared/commit/2cdec6f0c27b114d239ac524e3776e2d7e65fb18))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [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)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-shared-config",
3
- "version": "2.0.7",
3
+ "version": "2.1.0",
4
4
  "description": "Shared modules of the Helix Project - config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -49,5 +49,5 @@
49
49
  "mocha": "10.0.0",
50
50
  "nock": "13.2.4"
51
51
  },
52
- "gitHead": "8329b6609872ddb48dfd247f9953f43379907b81"
52
+ "gitHead": "e77cc809f42f4b6b13e4274ddf106a6c84f8abfa"
53
53
  }
@@ -35,6 +35,35 @@ 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
+ name,
57
+ include,
58
+ exclude,
59
+ target,
60
+ properties,
61
+ };
62
+
63
+ // let BaseConfig.toYAML() use the JSON output
64
+ this._document = null;
65
+ }
66
+
38
67
  /**
39
68
  * Evaluates a variable expression
40
69
  * @param {string} expression the expression to encode