@adobe/helix-config-storage 1.3.2 → 1.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 +7 -0
- package/package.json +1 -1
- package/src/config-store.js +25 -7
- package/src/schemas/org.schema.json +3 -0
- package/types/org-config.d.ts +12 -0
- package/types/profile-config.d.ts +1 -0
- package/types/site-config.d.ts +1 -0
- package/validate-json-schemas.sh +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.4.0](https://github.com/adobe/helix-config-storage/compare/v1.3.2...v1.4.0) (2024-08-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* allow adding several users ([cc0722d](https://github.com/adobe/helix-config-storage/commit/cc0722d35b7dc75e78926922c9e9b1a55bbc8377))
|
|
7
|
+
|
|
1
8
|
## [1.3.2](https://github.com/adobe/helix-config-storage/compare/v1.3.1...v1.3.2) (2024-08-31)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/config-store.js
CHANGED
|
@@ -68,6 +68,13 @@ const FRAGMENTS = {
|
|
|
68
68
|
},
|
|
69
69
|
profiles: FRAGMENTS_COMMON,
|
|
70
70
|
org: {
|
|
71
|
+
tokens: {
|
|
72
|
+
'.': 'tokens',
|
|
73
|
+
'.param': {
|
|
74
|
+
name: 'id',
|
|
75
|
+
'.': 'token',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
71
78
|
users: {
|
|
72
79
|
'.': 'users',
|
|
73
80
|
'.param': {
|
|
@@ -353,17 +360,28 @@ export class ConfigStore {
|
|
|
353
360
|
// don't expose hash in return value
|
|
354
361
|
delete ret.hash;
|
|
355
362
|
} else if (frag.type === 'users') {
|
|
356
|
-
const user = createUser();
|
|
357
|
-
data = {
|
|
358
|
-
...data,
|
|
359
|
-
...user,
|
|
360
|
-
};
|
|
361
|
-
relPath = ['users', user.id];
|
|
362
|
-
frag.type = 'user';
|
|
363
363
|
// todo: define via "schema"
|
|
364
364
|
if (!old.users) {
|
|
365
365
|
old.users = [];
|
|
366
366
|
}
|
|
367
|
+
if (Array.isArray(data)) {
|
|
368
|
+
const users = [...old.users];
|
|
369
|
+
for (const userData of data) {
|
|
370
|
+
users.push({
|
|
371
|
+
...createUser(),
|
|
372
|
+
...userData,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
data = users;
|
|
376
|
+
} else {
|
|
377
|
+
const user = createUser();
|
|
378
|
+
data = {
|
|
379
|
+
...data,
|
|
380
|
+
...user,
|
|
381
|
+
};
|
|
382
|
+
relPath = ['users', user.id];
|
|
383
|
+
frag.type = 'user';
|
|
384
|
+
}
|
|
367
385
|
} else if (frag.type === 'user') {
|
|
368
386
|
const user = deepGetOrCreate(old, relPath);
|
|
369
387
|
if (!user) {
|
package/types/org-config.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface HelixOrgConfig {
|
|
|
26
26
|
description?: string;
|
|
27
27
|
users?: Users;
|
|
28
28
|
groups?: Groups;
|
|
29
|
+
tokens?: Tokens;
|
|
29
30
|
}
|
|
30
31
|
export interface User {
|
|
31
32
|
id: string;
|
|
@@ -49,3 +50,14 @@ export interface Group {
|
|
|
49
50
|
[k: string]: unknown;
|
|
50
51
|
}[];
|
|
51
52
|
}
|
|
53
|
+
export interface Tokens {
|
|
54
|
+
/**
|
|
55
|
+
* This interface was referenced by `Tokens`'s JSON-Schema definition
|
|
56
|
+
* via the `patternProperty` "^[a-zA-Z0-9-_=]+$".
|
|
57
|
+
*/
|
|
58
|
+
[k: string]: {
|
|
59
|
+
id?: string;
|
|
60
|
+
hash?: string;
|
|
61
|
+
created?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
package/types/site-config.d.ts
CHANGED
package/validate-json-schemas.sh
CHANGED
|
@@ -21,8 +21,8 @@ npx ajv-cli --spec=draft2019 -c ajv-formats compile \
|
|
|
21
21
|
-s src/schemas/metadata-source.schema.json \
|
|
22
22
|
-s src/schemas/user.schema.json \
|
|
23
23
|
-s src/schemas/users.schema.json \
|
|
24
|
-
-s src/schemas/org.schema.json \
|
|
25
24
|
-s src/schemas/tokens.schema.json \
|
|
25
|
+
-s src/schemas/org.schema.json \
|
|
26
26
|
-s src/schemas/sidekick.schema.json \
|
|
27
27
|
-s src/schemas/robots.schema.json \
|
|
28
28
|
-s src/schemas/public.schema.json \
|