@adobe/helix-config-storage 2.1.5 → 2.1.7
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/.nycrc.json +4 -2
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/config-store.js +18 -0
package/.nycrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.1.7](https://github.com/adobe/helix-config-storage/compare/v2.1.6...v2.1.7) (2025-04-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* reject duplicate users ([#114](https://github.com/adobe/helix-config-storage/issues/114)) ([5e064a0](https://github.com/adobe/helix-config-storage/commit/5e064a05fb213ebc1d86b77eea9c4680a7fb0096))
|
|
7
|
+
|
|
8
|
+
## [2.1.6](https://github.com/adobe/helix-config-storage/compare/v2.1.5...v2.1.6) (2025-04-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-shared-config to v11.1.3 ([#112](https://github.com/adobe/helix-config-storage/issues/112)) ([41f88f9](https://github.com/adobe/helix-config-storage/commit/41f88f9fa3f62a58a540d883ba3f36888ee12a5a))
|
|
14
|
+
|
|
1
15
|
## [2.1.5](https://github.com/adobe/helix-config-storage/compare/v2.1.4...v2.1.5) (2025-03-31)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config-storage",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Helix Config Storage",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"husky": "9.1.7",
|
|
47
47
|
"json-schema-to-typescript": "15.0.4",
|
|
48
48
|
"junit-report-builder": "5.1.1",
|
|
49
|
-
"lint-staged": "15.5.
|
|
49
|
+
"lint-staged": "15.5.1",
|
|
50
50
|
"mocha": "11.1.0",
|
|
51
51
|
"mocha-multi-reporters": "1.5.1",
|
|
52
52
|
"mocha-suppress-logs": "0.5.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@adobe/fetch": "4.2.0",
|
|
63
|
-
"@adobe/helix-shared-config": "11.1.
|
|
63
|
+
"@adobe/helix-shared-config": "11.1.3",
|
|
64
64
|
"@adobe/helix-shared-git": "3.0.18",
|
|
65
65
|
"@adobe/helix-shared-storage": "1.3.0",
|
|
66
66
|
"@adobe/helix-shared-string": "2.1.0",
|
package/src/config-store.js
CHANGED
|
@@ -246,6 +246,22 @@ function updateSecret(type, id, oldData, data) {
|
|
|
246
246
|
return prune(oldData);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Ensures that the given email is not used by another user.
|
|
251
|
+
* @param {string} email
|
|
252
|
+
* @param {User[]} users
|
|
253
|
+
* @throws {StatusCodeError} a 400 status code error if the email is already used
|
|
254
|
+
*/
|
|
255
|
+
function validateUniqueEmail(email, users) {
|
|
256
|
+
if (!email) {
|
|
257
|
+
throw new StatusCodeError(400, 'missing email');
|
|
258
|
+
}
|
|
259
|
+
const existing = users.find((user) => user.email === email);
|
|
260
|
+
if (existing) {
|
|
261
|
+
throw new StatusCodeError(400, `email already in use by '${existing.id}'`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
249
265
|
/**
|
|
250
266
|
* General purpose config store.
|
|
251
267
|
*/
|
|
@@ -593,6 +609,7 @@ export class ConfigStore {
|
|
|
593
609
|
if (Array.isArray(data)) {
|
|
594
610
|
const users = [...old.users];
|
|
595
611
|
for (const userData of data) {
|
|
612
|
+
validateUniqueEmail(userData.email, users);
|
|
596
613
|
users.push({
|
|
597
614
|
...createUser(),
|
|
598
615
|
...userData,
|
|
@@ -605,6 +622,7 @@ export class ConfigStore {
|
|
|
605
622
|
...data,
|
|
606
623
|
...user,
|
|
607
624
|
};
|
|
625
|
+
validateUniqueEmail(data.email, old.users);
|
|
608
626
|
frag.name = user.id;
|
|
609
627
|
frag.relPath.push(user.id);
|
|
610
628
|
frag.type = 'user';
|