@adobe/helix-config-storage 1.6.1 → 1.7.1
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 +1 -1
- package/src/config-store.js +10 -0
- package/src/config-validator.js +2 -0
- package/src/schemas/org-access.schema.cjs +12 -0
- package/src/schemas/org-access.schema.json +24 -0
- package/src/schemas/org.schema.json +3 -0
- package/src/utils.js +8 -4
- package/validate-json-schemas.sh +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.7.1](https://github.com/adobe/helix-config-storage/compare/v1.7.0...v1.7.1) (2024-09-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ensure lowercase org/site/owner/repo ([#24](https://github.com/adobe/helix-config-storage/issues/24)) ([55e8269](https://github.com/adobe/helix-config-storage/commit/55e82699818a6abc372c886190cd4dc434ee4b9d)), closes [#23](https://github.com/adobe/helix-config-storage/issues/23)
|
|
7
|
+
|
|
8
|
+
# [1.7.0](https://github.com/adobe/helix-config-storage/compare/v1.6.1...v1.7.0) (2024-09-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add apiKeyId to org config ([#20](https://github.com/adobe/helix-config-storage/issues/20)) ([d6d86fe](https://github.com/adobe/helix-config-storage/commit/d6d86fecfad2f020a46efbe7061660bf312f67b6)), closes [#19](https://github.com/adobe/helix-config-storage/issues/19)
|
|
14
|
+
|
|
1
15
|
## [1.6.1](https://github.com/adobe/helix-config-storage/compare/v1.6.0...v1.6.1) (2024-09-03)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/config-store.js
CHANGED
|
@@ -102,6 +102,10 @@ const FRAGMENTS = {
|
|
|
102
102
|
members: 'object',
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
|
+
access: {
|
|
106
|
+
'.': 'object',
|
|
107
|
+
admin: 'object',
|
|
108
|
+
},
|
|
105
109
|
},
|
|
106
110
|
};
|
|
107
111
|
|
|
@@ -216,6 +220,12 @@ export class ConfigStore {
|
|
|
216
220
|
if (org.includes('/') || type.includes('/') || name.includes('/')) {
|
|
217
221
|
throw new Error('orgId, type and name must not contain slashes');
|
|
218
222
|
}
|
|
223
|
+
if (org.toLowerCase() !== org) {
|
|
224
|
+
throw new Error('orgId must be lowercase');
|
|
225
|
+
}
|
|
226
|
+
if (type === 'sites' && name.toLowerCase() !== name) {
|
|
227
|
+
throw new Error('site must be lowercase');
|
|
228
|
+
}
|
|
219
229
|
this.org = org;
|
|
220
230
|
this.type = type;
|
|
221
231
|
this.name = name;
|
package/src/config-validator.js
CHANGED
|
@@ -31,6 +31,7 @@ import googleSchema from './schemas/content-source-google.schema.cjs';
|
|
|
31
31
|
import headersSchema from './schemas/headers.schema.cjs';
|
|
32
32
|
import markupSchema from './schemas/content-source-markup.schema.cjs';
|
|
33
33
|
import metadataSchema from './schemas/metadata-source.schema.cjs';
|
|
34
|
+
import orgAccessSchema from './schemas/org-access.schema.cjs';
|
|
34
35
|
import orgSchema from './schemas/org.schema.cjs';
|
|
35
36
|
import onedriveSchema from './schemas/content-source-onedrive.schema.cjs';
|
|
36
37
|
import publicSchema from './schemas/public.schema.cjs';
|
|
@@ -59,6 +60,7 @@ export const SCHEMAS = [
|
|
|
59
60
|
markupSchema,
|
|
60
61
|
metadataSchema,
|
|
61
62
|
orgSchema,
|
|
63
|
+
orgAccessSchema,
|
|
62
64
|
onedriveSchema,
|
|
63
65
|
publicSchema,
|
|
64
66
|
profileSchema,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./org-access.schema.json');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
|
|
3
|
+
"$id": "https://ns.adobe.com/helix/config/org/access",
|
|
4
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
|
5
|
+
"title": "Org Access Config",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"admin": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"apiKeyId": {
|
|
12
|
+
"description": "the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.",
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false
|
|
23
|
+
}
|
|
24
|
+
|
package/src/utils.js
CHANGED
|
@@ -74,15 +74,19 @@ export function updateCodeSource(ctx, code) {
|
|
|
74
74
|
// recompute owner, repo and type
|
|
75
75
|
code.source.type = 'github';
|
|
76
76
|
const url = new GitUrl(code.source.url);
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const owner = url.owner.toLowerCase();
|
|
78
|
+
const repo = url.repo.toLowerCase();
|
|
79
|
+
if (owner !== code.owner) {
|
|
80
|
+
code.owner = owner;
|
|
79
81
|
modified = true;
|
|
80
82
|
}
|
|
81
|
-
if (
|
|
82
|
-
code.repo =
|
|
83
|
+
if (repo !== code.repo) {
|
|
84
|
+
code.repo = repo;
|
|
83
85
|
modified ||= true;
|
|
84
86
|
}
|
|
85
87
|
} else if (code?.owner && code?.repo) {
|
|
88
|
+
code.owner = code.owner.toLowerCase();
|
|
89
|
+
code.repo = code.repo.toLowerCase();
|
|
86
90
|
code.source = {
|
|
87
91
|
type: 'github',
|
|
88
92
|
url: `https://github.com/${code.owner}/${code.repo}`,
|
package/validate-json-schemas.sh
CHANGED
|
@@ -22,6 +22,7 @@ npx ajv-cli --spec=draft2019 -c ajv-formats compile \
|
|
|
22
22
|
-s src/schemas/user.schema.json \
|
|
23
23
|
-s src/schemas/users.schema.json \
|
|
24
24
|
-s src/schemas/tokens.schema.json \
|
|
25
|
+
-s src/schemas/org-access.schema.json \
|
|
25
26
|
-s src/schemas/org.schema.json \
|
|
26
27
|
-s src/schemas/sidekick.schema.json \
|
|
27
28
|
-s src/schemas/robots.schema.json \
|