@adobe/helix-config 3.8.0 → 3.9.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 +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.9.0](https://github.com/adobe/helix-config/compare/v3.8.0...v3.9.0) (2024-07-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* also include ctx ([#140](https://github.com/adobe/helix-config/issues/140)) ([6c29c54](https://github.com/adobe/helix-config/commit/6c29c541ccacc6740d60f577889f5064ec6c29c4))
|
|
7
|
+
|
|
1
8
|
# [3.8.0](https://github.com/adobe/helix-config/compare/v3.7.1...v3.8.0) (2024-07-18)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
updateCodeSource,
|
|
20
20
|
updateContentSource,
|
|
21
21
|
} from './utils.js';
|
|
22
|
-
import { validate } from './config-validator.js';
|
|
22
|
+
import { validate as validateSchema } from './config-validator.js';
|
|
23
23
|
import { deepGetOrCreate, deepPut } from '../utils.js';
|
|
24
24
|
|
|
25
25
|
const FRAGMENTS_COMMON = {
|
|
@@ -179,11 +179,12 @@ export class ConfigStore {
|
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
181
|
* Validates the config and throws an error if not valid.
|
|
182
|
-
* @param {
|
|
182
|
+
* @param {AdminContext} ctx
|
|
183
|
+
* @param {HelixSiteConfig|HelixProfileConfig} data the data of the config to be updated
|
|
183
184
|
* @returns {Promise<boolean|undefined>}
|
|
184
185
|
*/
|
|
185
|
-
async validate(data) {
|
|
186
|
-
return
|
|
186
|
+
async validate(ctx, data) {
|
|
187
|
+
return validateSchema(data, this.type);
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
async create(ctx, data, relPath = '') {
|
|
@@ -204,7 +205,7 @@ export class ConfigStore {
|
|
|
204
205
|
updateContentSource(ctx, data.content);
|
|
205
206
|
updateCodeSource(ctx, data.code);
|
|
206
207
|
}
|
|
207
|
-
await this.validate(
|
|
208
|
+
await this.validate(ctx, data);
|
|
208
209
|
await storage.put(this.key, JSON.stringify(data), 'application/json');
|
|
209
210
|
await this.purge(ctx, null, data);
|
|
210
211
|
}
|
|
@@ -324,7 +325,7 @@ export class ConfigStore {
|
|
|
324
325
|
updateContentSource(ctx, config.content);
|
|
325
326
|
updateCodeSource(ctx, config.code);
|
|
326
327
|
}
|
|
327
|
-
await this.validate(
|
|
328
|
+
await this.validate(ctx, config);
|
|
328
329
|
await storage.put(this.key, JSON.stringify(config), 'application/json');
|
|
329
330
|
await this.purge(ctx, buf ? JSON.parse(buf) : null, config);
|
|
330
331
|
return ret ?? redact(data, frag);
|
|
@@ -339,7 +340,7 @@ export class ConfigStore {
|
|
|
339
340
|
const frag = getFragmentInfo(this.type, relPath);
|
|
340
341
|
if (frag) {
|
|
341
342
|
const data = deepPut(JSON.parse(buf), relPath, null);
|
|
342
|
-
await this.validate(
|
|
343
|
+
await this.validate(ctx, data);
|
|
343
344
|
await storage.put(this.key, JSON.stringify(data), 'application/json');
|
|
344
345
|
await this.purge(ctx, JSON.parse(buf), data);
|
|
345
346
|
return;
|