@adobe/helix-config 3.7.1 → 3.8.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 +7 -0
- package/package.json +1 -1
- package/src/storage/config-store.js +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.8.0](https://github.com/adobe/helix-config/compare/v3.7.1...v3.8.0) (2024-07-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* make ConfigStore.validate() overridable ([#139](https://github.com/adobe/helix-config/issues/139)) ([6a85c7f](https://github.com/adobe/helix-config/commit/6a85c7fbefb3687c8c4f8ae2117886507192aaac))
|
|
7
|
+
|
|
1
8
|
## [3.7.1](https://github.com/adobe/helix-config/compare/v3.7.0...v3.7.1) (2024-07-17)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -177,6 +177,15 @@ export class ConfigStore {
|
|
|
177
177
|
: `/orgs/${this.org}/${this.type}/${this.name}.json`;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Validates the config and throws an error if not valid.
|
|
182
|
+
* @param {object} data the data of the config to be updated
|
|
183
|
+
* @returns {Promise<boolean|undefined>}
|
|
184
|
+
*/
|
|
185
|
+
async validate(data) {
|
|
186
|
+
return validate(data, this.type);
|
|
187
|
+
}
|
|
188
|
+
|
|
180
189
|
async create(ctx, data, relPath = '') {
|
|
181
190
|
if (relPath) {
|
|
182
191
|
throw new StatusCodeError(409, 'create not supported on substructures.');
|
|
@@ -195,7 +204,7 @@ export class ConfigStore {
|
|
|
195
204
|
updateContentSource(ctx, data.content);
|
|
196
205
|
updateCodeSource(ctx, data.code);
|
|
197
206
|
}
|
|
198
|
-
await validate(data, this.type);
|
|
207
|
+
await this.validate(data, this.type);
|
|
199
208
|
await storage.put(this.key, JSON.stringify(data), 'application/json');
|
|
200
209
|
await this.purge(ctx, null, data);
|
|
201
210
|
}
|
|
@@ -315,7 +324,7 @@ export class ConfigStore {
|
|
|
315
324
|
updateContentSource(ctx, config.content);
|
|
316
325
|
updateCodeSource(ctx, config.code);
|
|
317
326
|
}
|
|
318
|
-
await validate(config, this.type);
|
|
327
|
+
await this.validate(config, this.type);
|
|
319
328
|
await storage.put(this.key, JSON.stringify(config), 'application/json');
|
|
320
329
|
await this.purge(ctx, buf ? JSON.parse(buf) : null, config);
|
|
321
330
|
return ret ?? redact(data, frag);
|
|
@@ -330,7 +339,7 @@ export class ConfigStore {
|
|
|
330
339
|
const frag = getFragmentInfo(this.type, relPath);
|
|
331
340
|
if (frag) {
|
|
332
341
|
const data = deepPut(JSON.parse(buf), relPath, null);
|
|
333
|
-
await validate(data, this.type);
|
|
342
|
+
await this.validate(data, this.type);
|
|
334
343
|
await storage.put(this.key, JSON.stringify(data), 'application/json');
|
|
335
344
|
await this.purge(ctx, JSON.parse(buf), data);
|
|
336
345
|
return;
|