@adobe/helix-config-storage 2.2.13 → 2.4.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 +14 -0
- package/package.json +8 -7
- package/src/config-store.js +56 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.4.0](https://github.com/adobe/helix-config-storage/compare/v2.3.0...v2.4.0) (2025-07-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* improve user creation during org creation ([11559e3](https://github.com/adobe/helix-config-storage/commit/11559e3cda9b186a0b810efb3c1b91bf1d5596e1))
|
|
7
|
+
|
|
8
|
+
# [2.3.0](https://github.com/adobe/helix-config-storage/compare/v2.2.13...v2.3.0) (2025-06-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* include site details in list ([#146](https://github.com/adobe/helix-config-storage/issues/146)) ([00656ee](https://github.com/adobe/helix-config-storage/commit/00656ee93da9ac41410aeb79b4c2fdad35359fe7))
|
|
14
|
+
|
|
1
15
|
## [2.2.13](https://github.com/adobe/helix-config-storage/compare/v2.2.12...v2.2.13) (2025-06-18)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-config-storage",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Helix Config Storage",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"reporter-options": "configFile=.mocha-multi.json"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@adobe/eslint-config-helix": "3.0.
|
|
40
|
-
"@eslint/config-helpers": "0.
|
|
39
|
+
"@adobe/eslint-config-helix": "3.0.6",
|
|
40
|
+
"@eslint/config-helpers": "0.3.0",
|
|
41
41
|
"@semantic-release/changelog": "6.0.3",
|
|
42
42
|
"@semantic-release/git": "10.0.1",
|
|
43
|
-
"@semantic-release/npm": "12.0.
|
|
43
|
+
"@semantic-release/npm": "12.0.2",
|
|
44
44
|
"ajv-cli": "5.0.0",
|
|
45
45
|
"c8": "10.1.3",
|
|
46
46
|
"eslint": "9.4.0",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"json-schema-to-typescript": "15.0.4",
|
|
49
49
|
"junit-report-builder": "5.1.1",
|
|
50
50
|
"lint-staged": "16.1.2",
|
|
51
|
-
"mocha": "11.
|
|
51
|
+
"mocha": "11.7.1",
|
|
52
52
|
"mocha-multi-reporters": "1.5.1",
|
|
53
|
-
"mocha-suppress-logs": "0.
|
|
53
|
+
"mocha-suppress-logs": "0.6.0",
|
|
54
54
|
"nock": "13.5.6",
|
|
55
|
-
"semantic-release": "24.2.
|
|
55
|
+
"semantic-release": "24.2.6",
|
|
56
56
|
"xml2js": "0.6.2"
|
|
57
57
|
},
|
|
58
58
|
"lint-staged": {
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@adobe/fetch": "^4.2.0",
|
|
64
64
|
"@adobe/helix-shared-config": "^11.1.4",
|
|
65
65
|
"@adobe/helix-shared-git": "^3.0.18",
|
|
66
|
+
"@adobe/helix-shared-process-queue": "3.1.3",
|
|
66
67
|
"@adobe/helix-shared-storage": "^1.3.0",
|
|
67
68
|
"@adobe/helix-shared-string": "^2.1.0",
|
|
68
69
|
"@adobe/helix-shared-utils": "^3.0.2",
|
package/src/config-store.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import crypto from 'crypto';
|
|
14
14
|
import { decodeJwt } from 'jose';
|
|
15
15
|
import { HelixStorage } from '@adobe/helix-shared-storage';
|
|
16
|
+
import processQueue from '@adobe/helix-shared-process-queue';
|
|
16
17
|
import { StatusCodeError } from './status-code-error.js';
|
|
17
18
|
import {
|
|
18
19
|
createToken, createUser,
|
|
@@ -350,6 +351,7 @@ export class ConfigStore {
|
|
|
350
351
|
this.now = new Date();
|
|
351
352
|
this.isAdmin = false;
|
|
352
353
|
this.isOps = false;
|
|
354
|
+
this.listDetails = false;
|
|
353
355
|
}
|
|
354
356
|
|
|
355
357
|
/**
|
|
@@ -372,6 +374,16 @@ export class ConfigStore {
|
|
|
372
374
|
return this;
|
|
373
375
|
}
|
|
374
376
|
|
|
377
|
+
/**
|
|
378
|
+
* shows the details of the config list, like the source and code urls.
|
|
379
|
+
* @param v
|
|
380
|
+
* @returns {ConfigStore}
|
|
381
|
+
*/
|
|
382
|
+
withListDetails(v) {
|
|
383
|
+
this.listDetails = v;
|
|
384
|
+
return this;
|
|
385
|
+
}
|
|
386
|
+
|
|
375
387
|
/**
|
|
376
388
|
* updates the created and lastModified time stamp on the data object to the current time.
|
|
377
389
|
* the created property is only set if it doesn't exist yet.
|
|
@@ -388,18 +400,28 @@ export class ConfigStore {
|
|
|
388
400
|
const storage = HelixStorage.fromContext(ctx).configBus();
|
|
389
401
|
const key = `orgs/${this.org}/${this.type}/`;
|
|
390
402
|
const list = await storage.list(key);
|
|
403
|
+
let entries = list.map((entry) => {
|
|
404
|
+
const siteKey = entry.key;
|
|
405
|
+
if (siteKey.endsWith('.json')) {
|
|
406
|
+
const name = siteKey.split('/').pop();
|
|
407
|
+
return {
|
|
408
|
+
path: `/config/${this.org}/${this.type}/${name}`,
|
|
409
|
+
name: name.substring(0, name.length - 5),
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return null;
|
|
413
|
+
}).filter((entry) => !!entry);
|
|
414
|
+
|
|
415
|
+
if (this.listDetails) {
|
|
416
|
+
entries = await processQueue(entries, async (entry) => {
|
|
417
|
+
const json = JSON.parse(await storage.get(`/orgs/${this.org}/${this.type}/${entry.name}.json`));
|
|
418
|
+
entry.content = json.content;
|
|
419
|
+
entry.code = json.code;
|
|
420
|
+
return entry;
|
|
421
|
+
});
|
|
422
|
+
}
|
|
391
423
|
return {
|
|
392
|
-
[this.type]:
|
|
393
|
-
const siteKey = entry.key;
|
|
394
|
-
if (siteKey.endsWith('.json')) {
|
|
395
|
-
const name = siteKey.split('/').pop();
|
|
396
|
-
return {
|
|
397
|
-
path: `/config/${this.org}/${this.type}/${name}`,
|
|
398
|
-
name: name.substring(0, name.length - 5),
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
return null;
|
|
402
|
-
}).filter((entry) => !!entry),
|
|
424
|
+
[this.type]: entries,
|
|
403
425
|
};
|
|
404
426
|
}
|
|
405
427
|
|
|
@@ -511,8 +533,18 @@ export class ConfigStore {
|
|
|
511
533
|
throw new StatusCodeError(400, 'creating config with secrets not supported yet.');
|
|
512
534
|
}
|
|
513
535
|
if (this.type === 'org' && data.users) {
|
|
514
|
-
|
|
536
|
+
const users = [];
|
|
537
|
+
for (const userData of data.users) {
|
|
538
|
+
validateUniqueEmail(userData.email, users);
|
|
539
|
+
users.push(Object.assign(
|
|
540
|
+
Object.create(null),
|
|
541
|
+
createUser(),
|
|
542
|
+
userData,
|
|
543
|
+
));
|
|
544
|
+
}
|
|
545
|
+
data.users = users;
|
|
515
546
|
}
|
|
547
|
+
|
|
516
548
|
if (this.type !== 'org') {
|
|
517
549
|
updateContentSource(ctx, data.content);
|
|
518
550
|
updateCodeSource(ctx, data.code);
|
|
@@ -676,21 +708,22 @@ export class ConfigStore {
|
|
|
676
708
|
const users = [...old.users];
|
|
677
709
|
for (const userData of data) {
|
|
678
710
|
validateUniqueEmail(userData.email, users);
|
|
679
|
-
users.push(
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
711
|
+
users.push(Object.assign(
|
|
712
|
+
Object.create(null),
|
|
713
|
+
createUser(),
|
|
714
|
+
userData,
|
|
715
|
+
));
|
|
683
716
|
}
|
|
684
717
|
data = users;
|
|
685
718
|
} else {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
719
|
+
data = Object.assign(
|
|
720
|
+
Object.create(null),
|
|
721
|
+
createUser(),
|
|
722
|
+
data,
|
|
723
|
+
);
|
|
691
724
|
validateUniqueEmail(data.email, old.users);
|
|
692
|
-
frag.name =
|
|
693
|
-
frag.relPath.push(
|
|
725
|
+
frag.name = data.id;
|
|
726
|
+
frag.relPath.push(data.id);
|
|
694
727
|
frag.type = 'user';
|
|
695
728
|
}
|
|
696
729
|
} else if (frag.type === 'user') {
|