@adobe/helix-config 3.13.1 → 4.0.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +5 -15
  3. package/src/utils.js +0 -36
  4. package/src/schemas/access-admin.schema.cjs +0 -12
  5. package/src/schemas/access-admin.schema.json +0 -57
  6. package/src/schemas/access-site.schema.cjs +0 -12
  7. package/src/schemas/access-site.schema.json +0 -24
  8. package/src/schemas/access.schema.cjs +0 -12
  9. package/src/schemas/access.schema.json +0 -22
  10. package/src/schemas/cdn-prod-akamai.schema.cjs +0 -12
  11. package/src/schemas/cdn-prod-akamai.schema.json +0 -45
  12. package/src/schemas/cdn-prod-cloudflare.schema.cjs +0 -12
  13. package/src/schemas/cdn-prod-cloudflare.schema.json +0 -41
  14. package/src/schemas/cdn-prod-cloudfront.schema.cjs +0 -12
  15. package/src/schemas/cdn-prod-cloudfront.schema.json +0 -41
  16. package/src/schemas/cdn-prod-fastly.schema.cjs +0 -12
  17. package/src/schemas/cdn-prod-fastly.schema.json +0 -40
  18. package/src/schemas/cdn-prod-managed.schema.cjs +0 -12
  19. package/src/schemas/cdn-prod-managed.schema.json +0 -29
  20. package/src/schemas/cdn.schema.cjs +0 -12
  21. package/src/schemas/cdn.schema.json +0 -75
  22. package/src/schemas/code.schema.cjs +0 -12
  23. package/src/schemas/code.schema.json +0 -43
  24. package/src/schemas/common.schema.cjs +0 -12
  25. package/src/schemas/common.schema.json +0 -27
  26. package/src/schemas/content-source-google.schema.cjs +0 -12
  27. package/src/schemas/content-source-google.schema.json +0 -26
  28. package/src/schemas/content-source-markup.schema.cjs +0 -12
  29. package/src/schemas/content-source-markup.schema.json +0 -24
  30. package/src/schemas/content-source-onedrive.schema.cjs +0 -12
  31. package/src/schemas/content-source-onedrive.schema.json +0 -28
  32. package/src/schemas/content.schema.cjs +0 -12
  33. package/src/schemas/content.schema.json +0 -30
  34. package/src/schemas/folders.schema.cjs +0 -12
  35. package/src/schemas/folders.schema.json +0 -13
  36. package/src/schemas/groups.schema.cjs +0 -12
  37. package/src/schemas/groups.schema.json +0 -39
  38. package/src/schemas/headers.schema.cjs +0 -12
  39. package/src/schemas/headers.schema.json +0 -16
  40. package/src/schemas/metadata-source.schema.cjs +0 -12
  41. package/src/schemas/metadata-source.schema.json +0 -16
  42. package/src/schemas/org.schema.cjs +0 -12
  43. package/src/schemas/org.schema.json +0 -26
  44. package/src/schemas/profile.schema.cjs +0 -12
  45. package/src/schemas/profile.schema.json +0 -57
  46. package/src/schemas/profiles.schema.cjs +0 -12
  47. package/src/schemas/profiles.schema.json +0 -28
  48. package/src/schemas/public.schema.cjs +0 -12
  49. package/src/schemas/public.schema.json +0 -8
  50. package/src/schemas/robots.schema.cjs +0 -12
  51. package/src/schemas/robots.schema.json +0 -13
  52. package/src/schemas/sidekick.schema.cjs +0 -12
  53. package/src/schemas/sidekick.schema.json +0 -112
  54. package/src/schemas/site.schema.cjs +0 -12
  55. package/src/schemas/site.schema.json +0 -74
  56. package/src/schemas/sites.schema.cjs +0 -12
  57. package/src/schemas/sites.schema.json +0 -28
  58. package/src/schemas/tokens.schema.cjs +0 -12
  59. package/src/schemas/tokens.schema.json +0 -28
  60. package/src/schemas/user.schema.cjs +0 -12
  61. package/src/schemas/user.schema.json +0 -42
  62. package/src/schemas/users.schema.cjs +0 -12
  63. package/src/schemas/users.schema.json +0 -10
  64. package/src/storage/ValidationError.js +0 -95
  65. package/src/storage/config-store.js +0 -359
  66. package/src/storage/config-validator.js +0 -112
  67. package/src/storage/index.js +0 -14
  68. package/src/storage/status-code-error.js +0 -22
  69. package/src/storage/utils.js +0 -157
  70. package/types/org-config.d.ts +0 -51
  71. package/types/profile-config.d.ts +0 -368
  72. package/types/site-config.d.ts +0 -375
@@ -1,112 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$id": "https://ns.adobe.com/helix/config/sidekick",
4
- "$schema": "https://json-schema.org/draft/2019-09/schema",
5
- "definitions": {
6
- "sidekickPlugin": {
7
- "type": "object",
8
- "properties": {
9
- "id": {
10
- "type": "string",
11
- "description": "The unique plugin ID"
12
- },
13
- "title": {
14
- "type": "string",
15
- "description": "The button text"
16
- },
17
- "url": {
18
- "type": "string",
19
- "description": "The URL to open when the button is clicked"
20
- },
21
- "containerId": {
22
- "type": "string",
23
- "description": "The ID of the container to add this plugin to"
24
- },
25
- "environments": {
26
- "type": "array",
27
- "items": {
28
- "type": "string",
29
- "enum": ["any", "dev", "admin", "edit", "preview", "live", "prod"]
30
- },
31
- "description": "The environments to display this plugin in",
32
- "default": "any"
33
- },
34
- "event": {
35
- "type": "string",
36
- "description": "The name of a custom event to fire when the button is clicked (defaults to id)"
37
- },
38
- "excludePaths": {
39
- "type": "array",
40
- "items": {
41
- "type": "string"
42
- },
43
- "description": "Exclude the plugin from these paths",
44
- "examples": [
45
- "/foo/**",
46
- "**/:x:**"
47
- ]
48
- },
49
- "includePaths": {
50
- "type": "array",
51
- "items": {
52
- "type": "string"
53
- },
54
- "description": "Include the plugin on these paths (overrides excludePaths)",
55
- "examples": [
56
- "/foo/bar/**",
57
- "**.docx**"
58
- ]
59
- },
60
- "isContainer": {
61
- "type": "boolean",
62
- "description": "Turns the plugin into a container for other plugins"
63
- },
64
- "isPalette": {
65
- "type": "boolean",
66
- "description": "Opens the URL in a palette instead of a new tab"
67
- },
68
- "paletteRect": {
69
- "type": "string",
70
- "description": "he dimensions and position of a palette box"
71
- },
72
- "titleI18n": {
73
- "type": "object",
74
- "description": "The button text in other supported languages",
75
- "patternProperties": {
76
- "^[a-z]{2}(-[A-Z]{2})?$": {
77
- "type": "string",
78
- "description": "ISO language code (`en` or `en-US`) with translated button text"
79
- }
80
- },
81
- "minProperties": 1,
82
- "additionalProperties": false
83
- },
84
- "passConfig": {
85
- "type": "boolean",
86
- "description": "Append ref, repo, owner, host, and project as query params on new URL button click"
87
- },
88
- "passReferrer": {
89
- "type": "boolean",
90
- "description": "Append the referrer URL as a query param on new URL button click"
91
- }
92
- },
93
- "required": [
94
- "id"
95
- ],
96
- "dependentRequired": {
97
- "isPalette": ["url"],
98
- "paletteRect": ["isPalette"]
99
- }
100
- }
101
- },
102
- "title": "Sidekick Config",
103
- "type": "object",
104
- "properties": {
105
- "plugins": {
106
- "type": "array",
107
- "items": {
108
- "$ref": "#/definitions/sidekickPlugin"
109
- }
110
- }
111
- }
112
- }
@@ -1,12 +0,0 @@
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('./site.schema.json');
@@ -1,74 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$schema": "https://json-schema.org/draft/2019-09/schema",
4
- "$id": "https://ns.adobe.com/helix/config/site",
5
- "title": "Helix Site Config",
6
- "type": "object",
7
- "properties": {
8
- "version": {
9
- "type": "integer",
10
- "enum": [1],
11
- "default": 1
12
- },
13
- "name": {
14
- "type": "string",
15
- "description": "Site name; part of the hostname",
16
- "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
17
- },
18
- "title": { "$ref": "https://ns.adobe.com/helix/config/common#/definitions/title" },
19
- "description": { "$ref": "https://ns.adobe.com/helix/config/common#/definitions/description" },
20
-
21
- "content": {
22
- "$ref": "https://ns.adobe.com/helix/config/content"
23
- },
24
- "code": {
25
- "$ref": "https://ns.adobe.com/helix/config/code"
26
- },
27
- "folders": {
28
- "$ref": "https://ns.adobe.com/helix/config/folders"
29
- },
30
- "headers": {
31
- "$ref": "https://ns.adobe.com/helix/config/headers"
32
- },
33
- "cdn": {
34
- "$ref": "https://ns.adobe.com/helix/config/cdn"
35
- },
36
- "access": {
37
- "$ref": "https://ns.adobe.com/helix/config/access"
38
- },
39
- "tokens": {
40
- "$ref": "https://ns.adobe.com/helix/config/tokens"
41
- },
42
- "groups": {
43
- "$ref": "https://ns.adobe.com/helix/config/groups"
44
- },
45
- "sidekick": {
46
- "$ref": "https://ns.adobe.com/helix/config/sidekick"
47
- },
48
- "metadata": {
49
- "$ref": "https://ns.adobe.com/helix/config/metadata-source"
50
- },
51
- "robots": {
52
- "$ref": "https://ns.adobe.com/helix/config/robots"
53
- },
54
- "public": {
55
- "$ref": "https://ns.adobe.com/helix/config/public"
56
- },
57
- "extends": {
58
- "type": "object",
59
- "properties": {
60
- "profile": {
61
- "type": "string",
62
- "pattern": "^[0-9a-zA-Z-_]+$"
63
- }
64
- },
65
- "additionalProperties": false
66
- }
67
- },
68
- "required": [
69
- "version",
70
- "content",
71
- "code"
72
- ],
73
- "additionalProperties": false
74
- }
@@ -1,12 +0,0 @@
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('./sites.schema.json');
@@ -1,28 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$schema": "https://json-schema.org/draft/2019-09/schema",
4
- "$id": "https://ns.adobe.com/helix/config/sites",
5
- "title": "Helix Sites List",
6
- "type": "object",
7
- "properties": {
8
- "sites": {
9
- "type": "array",
10
- "items": {
11
- "type": "object",
12
- "properties": {
13
- "name": {
14
- "type": "string"
15
- }
16
- },
17
- "required": [
18
- "name"
19
- ],
20
- "additionalProperties": false
21
- }
22
- }
23
- },
24
- "required": [
25
- "sites"
26
- ],
27
- "additionalProperties": false
28
- }
@@ -1,12 +0,0 @@
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('./tokens.schema.json');
@@ -1,28 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$schema": "https://json-schema.org/draft/2019-09/schema",
4
- "$id": "https://ns.adobe.com/helix/config/tokens",
5
- "title": "tokens",
6
- "type": "object",
7
- "patternProperties": {
8
- "^[a-zA-Z0-9-_=]+$": {
9
- "type": "object",
10
- "properties": {
11
- "id": {
12
- "type": "string",
13
- "pattern": "^[a-zA-Z0-9-_=]+$"
14
- },
15
- "hash": {
16
- "type": "string",
17
- "pattern": "^[a-zA-Z0-9-_=]+$"
18
- },
19
- "created": {
20
- "type": "string",
21
- "format": "date-time"
22
- }
23
- },
24
- "additionalProperties": false
25
- }
26
- },
27
- "additionalProperties": false
28
- }
@@ -1,12 +0,0 @@
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('./user.schema.json');
@@ -1,42 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$schema": "https://json-schema.org/draft/2019-09/schema",
4
- "$id": "https://ns.adobe.com/helix/config/user",
5
- "title": "user",
6
- "type": "object",
7
- "properties": {
8
- "id": {
9
- "type": "string",
10
- "pattern": "^[a-zA-Z0-9-_=]+$"
11
- },
12
- "email": {
13
- "type": "string",
14
- "format": "email"
15
- },
16
- "name": {
17
- "type": "string"
18
- },
19
- "roles": {
20
- "type": "array",
21
- "items": {
22
- "type": "string",
23
- "enum": [
24
- "admin",
25
- "author",
26
- "publish",
27
- "develop",
28
- "basic_author",
29
- "basic_publish",
30
- "config",
31
- "config_admin"
32
- ]
33
- }
34
- }
35
- },
36
- "required": [
37
- "id",
38
- "email",
39
- "roles"
40
- ],
41
- "additionalProperties": false
42
- }
@@ -1,12 +0,0 @@
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('./users.schema.json');
@@ -1,10 +0,0 @@
1
- {
2
- "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
- "$schema": "https://json-schema.org/draft/2019-09/schema",
4
- "$id": "https://ns.adobe.com/helix/config/users",
5
- "title": "users",
6
- "type": "array",
7
- "items": {
8
- "$ref": "https://ns.adobe.com/helix/config/user"
9
- }
10
- }
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright 2018 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
-
13
- /* eslint-disable no-continue,no-param-reassign */
14
-
15
- function removeByPrefix(byPath, prefix) {
16
- Object.keys(byPath).forEach((path) => {
17
- if (path.startsWith(prefix)) {
18
- delete byPath[path];
19
- }
20
- });
21
- }
22
-
23
- function handleContentSource(byPath, msg) {
24
- if (byPath['/content/source']) {
25
- const type = byPath['/content/source']?.[0]?.data?.type;
26
- if (!['onedrive', 'google', 'markup'].includes(type)) {
27
- msg.push('/content/source/type must be one of [onedrive, google, markup]');
28
- removeByPrefix(byPath, '/content/source');
29
- return;
30
- }
31
-
32
- // remove other content source errors
33
- delete byPath['/content/source'];
34
- delete byPath['/content/source/type'];
35
- }
36
- }
37
-
38
- function handleCDNProd(byPath, msg) {
39
- const cdnErrors = byPath['/cdn/prod'];
40
- if (cdnErrors) {
41
- const type = byPath['/cdn/prod']?.[0]?.data?.type;
42
- if (type && !['fastly', 'cloudflare', 'akamai', 'managed', 'cloudfront'].includes(type)) {
43
- msg.push('/cdn/prod/type must be one of [fastly, cloudflare, akamai, managed, cloudfront]');
44
- removeByPrefix(byPath, '/cdn/prod');
45
- return;
46
- }
47
- delete byPath['/cdn/prod/type'];
48
- // if the type is specified, filter errors from other schemas
49
- if (type) {
50
- byPath[`/cdn/prod['${type}']`] = cdnErrors.filter(({ parentSchema }) => parentSchema?.$id?.endsWith(type));
51
- delete byPath['/cdn/prod'];
52
- }
53
- }
54
- }
55
-
56
- export class ValidationError extends Error {
57
- constructor(msg, errors = []) {
58
- super(ValidationError.generateErrorDetail(errors));
59
- this._errors = errors;
60
- }
61
-
62
- static generateErrorDetail(ajvErrors) {
63
- const msg = [];
64
- // group errors by instance
65
- const byPath = {};
66
- for (const error of ajvErrors) {
67
- const id = error.instancePath || 'data';
68
- if (!byPath[id]) {
69
- byPath[id] = [];
70
- }
71
- byPath[id].push(error);
72
- }
73
-
74
- // handle special locations
75
- handleContentSource(byPath, msg);
76
- handleCDNProd(byPath, msg);
77
-
78
- for (const [id, errors] of Object.entries(byPath)) {
79
- // create required properties message
80
- const reqErrors = errors.filter((e) => e.keyword === 'required');
81
- if (reqErrors.length) {
82
- msg.push(`${id} must have required properties: [${reqErrors.map((e) => e.params.missingProperty).join(', ')}]`);
83
- }
84
-
85
- // create other errors
86
- const otherErrors = errors.filter((e) => e.keyword !== 'required');
87
- // make unique messages
88
- const uniqueErrors = new Set(otherErrors.map((e) => e.message));
89
- if (uniqueErrors.size) {
90
- msg.push(`${id} ${Array.from(uniqueErrors).join(', ')}`);
91
- }
92
- }
93
- return msg.join('; ');
94
- }
95
- }