@adobe/helix-config 1.0.3 → 1.2.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.2.0](https://github.com/adobe/helix-config/compare/v1.1.0...v1.2.0) (2024-03-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * add json schemas and restructure content and code config ([#26](https://github.com/adobe/helix-config/issues/26)) ([b38af40](https://github.com/adobe/helix-config/commit/b38af40c8ee0812d946032ac6958c9debc30600b))
7
+
8
+ # [1.1.0](https://github.com/adobe/helix-config/compare/v1.0.3...v1.1.0) (2024-03-04)
9
+
10
+
11
+ ### Features
12
+
13
+ * add client certification DN to access config ([#24](https://github.com/adobe/helix-config/issues/24)) ([ec517e3](https://github.com/adobe/helix-config/commit/ec517e39814f0006ba993dbcbeb06043743f8609)), closes [#21](https://github.com/adobe/helix-config/issues/21)
14
+
1
15
  ## [1.0.3](https://github.com/adobe/helix-config/compare/v1.0.2...v1.0.3) (2024-03-02)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@adobe/helix-config",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "description": "Helix Config",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "test": "c8 mocha",
9
9
  "lint": "eslint .",
10
+ "docs:types": "node ./test/dev/generate-types.js",
10
11
  "semantic-release": "semantic-release",
11
12
  "semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
12
13
  "prepare": "husky install"
@@ -35,6 +36,7 @@
35
36
  "c8": "9.1.0",
36
37
  "eslint": "8.57.0",
37
38
  "husky": "9.0.11",
39
+ "json-schema-to-typescript": "13.1.2",
38
40
  "junit-report-builder": "3.2.1",
39
41
  "lint-staged": "15.2.2",
40
42
  "mocha": "10.3.0",
@@ -75,18 +75,22 @@ async function fetchConfigAll(ctx, contentBusId, partition) {
75
75
  */
76
76
  export async function resolveLegacyConfig(ctx, rso, scope) {
77
77
  // set owner==org and repo==site and fetch from helix-config for now
78
- const config = {
79
- version: 1,
80
- ...rso,
81
- owner: rso.org,
82
- repo: rso.site,
83
- };
84
78
  const helixConfig = await fetchHelixConfig(ctx, rso);
85
79
  if (!helixConfig) {
86
80
  return null;
87
81
  }
88
- config.contentBusId = helixConfig.content.data['/'].contentBusId;
89
-
82
+ const { contentBusId, ...source } = helixConfig.content.data['/'];
83
+ const config = {
84
+ version: 1,
85
+ code: {
86
+ owner: rso.org,
87
+ repo: rso.site,
88
+ },
89
+ content: {
90
+ contentBusId,
91
+ source,
92
+ },
93
+ };
90
94
  const configAllPreview = await fetchConfigAll(ctx, config.contentBusId, 'preview');
91
95
  const { access } = configAllPreview?.config?.data || {};
92
96
  if (access) {
@@ -64,18 +64,24 @@ export function getAccessConfig(access, partition) {
64
64
  return {
65
65
  allow: toArray(access[partition]?.allow ?? access.allow),
66
66
  apiKeyId: toArray(access[partition]?.apiKeyId ?? access.apiKeyId),
67
+ clientCertDN: toArray(access[partition]?.clientCertDN ?? access.clientCertDN),
67
68
  };
68
69
  }
69
70
 
70
71
  /**
71
- * Loads the metadata from the config-bus
72
+ * Load metadata from the given path
73
+ * @param ctx the context
74
+ * @param config the config
75
+ * @param partition the partition
76
+ * @returns {Promise<{data: ModifierMap}|{}>} the metadata
72
77
  */
73
78
  async function loadMetadata(ctx, config, partition) {
74
79
  const contentBus = ctx.storage.contentBus();
75
- const paths = config.metadata ?? [];
80
+ const paths = config.metadata?.source ?? [];
76
81
  if (!paths.length) {
77
82
  paths.push(METADATA_JSON);
78
83
  }
84
+
79
85
  // generate the metadata-all.json first
80
86
  const metadata = [];
81
87
  for (const path of paths) {
@@ -101,9 +107,9 @@ async function loadMetadata(ctx, config, partition) {
101
107
  };
102
108
  }
103
109
 
104
- async function loadHeadHtml(ctx, config) {
110
+ async function loadHeadHtml(ctx, config, ref) {
105
111
  const codeBus = ctx.storage.codeBus();
106
- const key = `${config.owner}/${config.repo}/${config.ref}/head.html`;
112
+ const key = `${config.owner}/${config.repo}/${ref}/head.html`;
107
113
  const buf = await codeBus.get(key);
108
114
  if (buf) {
109
115
  return {
@@ -113,13 +119,13 @@ async function loadHeadHtml(ctx, config) {
113
119
  return {};
114
120
  }
115
121
 
116
- function clean(obj, prop) {
122
+ function retainProperty(obj, prop) {
117
123
  if (!obj) {
118
124
  return;
119
125
  }
120
126
  for (const key of Object.keys(obj)) {
121
127
  if (typeof obj[key] === 'object') {
122
- clean(obj[key], prop);
128
+ retainProperty(obj[key], prop);
123
129
  } else if (key !== prop) {
124
130
  // eslint-disable-next-line no-param-reassign
125
131
  delete obj[key];
@@ -147,14 +153,12 @@ async function resolveConfig(ctx, rso, scope) {
147
153
  }
148
154
  }
149
155
  const config = JSON.parse(buf.toString('utf-8'));
150
- config.ref = rso.ref;
151
-
152
156
  if (scope === SCOPE_PIPELINE) {
153
157
  config.metadata = {
154
158
  preview: await loadMetadata(ctx, config, 'preview'),
155
159
  live: await loadMetadata(ctx, config, 'live'),
156
160
  };
157
- config.head = await loadHeadHtml(ctx, config);
161
+ config.head = await loadHeadHtml(ctx, config, rso.ref);
158
162
  }
159
163
 
160
164
  return config;
@@ -170,7 +174,6 @@ export async function getConfigResponse(ctx, opts) {
170
174
  return new PipelineResponse('', {
171
175
  status: 404,
172
176
  headers: {
173
- 'cache-control': 'private, no-cache, must-revalidate',
174
177
  'x-error': 'config not found.',
175
178
  },
176
179
  });
@@ -191,29 +194,68 @@ export async function getConfigResponse(ctx, opts) {
191
194
 
192
195
  const headers = {
193
196
  'content-type': 'application/json',
194
- 'cache-control': 'private, no-cache, must-revalidate',
195
197
  };
196
198
 
197
199
  if (opts.scope === SCOPE_DELIVERY) {
198
- headers['x-hlx-contentbus-id'] = config.contentBusId;
199
- headers['x-hlx-owner'] = config.owner;
200
- headers['x-hlx-repo'] = config.repo;
201
- headers['x-hlx-auth-allow-preview'] = canonicalArrayString(config.access, 'preview', 'allow');
202
- headers['x-hlx-auth-apikey-preview'] = canonicalArrayString(config.access, 'preview', 'apiKeyId');
203
- headers['x-hlx-auth-allow-live'] = canonicalArrayString(config.access, 'live', 'allow');
204
- headers['x-hlx-auth-apikey-live'] = canonicalArrayString(config.access, 'live', 'apiKeyId');
205
- // remove unused properties
206
- delete config.access;
207
- delete config.cdn;
208
- delete config.headers;
200
+ return new PipelineResponse('', {
201
+ headers: {
202
+ 'x-hlx-contentbus-id': config.content.contentBusId,
203
+ 'x-hlx-owner': config.code.owner,
204
+ 'x-hlx-repo': config.code.repo,
205
+ 'x-hlx-auth-allow-preview': canonicalArrayString(config.access, 'preview', 'allow'),
206
+ 'x-hlx-auth-apikey-preview': canonicalArrayString(config.access, 'preview', 'apiKeyId'),
207
+ 'x-hlx-auth-clientdn-preview': canonicalArrayString(config.access, 'preview', 'clientCertDN'),
208
+ 'x-hlx-auth-allow-live': canonicalArrayString(config.access, 'live', 'allow'),
209
+ 'x-hlx-auth-apikey-live': canonicalArrayString(config.access, 'live', 'apiKeyId'),
210
+ 'x-hlx-auth-clientdn-live': canonicalArrayString(config.access, 'live', 'clientCertDN'),
211
+ },
212
+ });
209
213
  }
210
- if (opts.scope !== SCOPE_ADMIN) {
211
- delete config.content;
212
- delete config.code;
213
- clean(config.cdn, 'host');
214
+
215
+ if (opts.scope === SCOPE_ADMIN) {
216
+ const adminConfig = {
217
+ ...rso,
218
+ ...config,
219
+ // todo: delete after admin uses new structure
220
+ contentBusId: config.content.contentBusId,
221
+ content: {
222
+ ...config.content,
223
+ ...config.content.source,
224
+ },
225
+ };
226
+ return new PipelineResponse(JSON.stringify(adminConfig, null, 2), {
227
+ headers,
228
+ });
214
229
  }
215
230
 
216
- return new PipelineResponse(JSON.stringify(config, null, 2), {
231
+ if (opts.scope === SCOPE_PIPELINE) {
232
+ // remove all properties except `host`. pipeline doesn't need the others.
233
+ retainProperty(config.cdn, 'host');
234
+ const pipelineConfig = {
235
+ version: 1,
236
+ owner: config.code.owner,
237
+ repo: config.code.repo,
238
+ ...rso,
239
+ contentBusId: config.content.contentBusId,
240
+ access: config.access,
241
+ headers: config.headers,
242
+ head: config.head,
243
+ metadata: config.metadata,
244
+ cdn: config.cdn,
245
+ folders: config.folders,
246
+ };
247
+ return new PipelineResponse(JSON.stringify(pipelineConfig, null, 2), {
248
+ headers,
249
+ });
250
+ }
251
+
252
+ // else opts.scope === SCOPE_PUBLIC
253
+ const publicConfig = {
254
+ version: 1,
255
+ ...rso,
256
+ public: {},
257
+ };
258
+ return new PipelineResponse(JSON.stringify(publicConfig, null, 2), {
217
259
  headers,
218
260
  });
219
261
  }
@@ -19,7 +19,6 @@ export async function getDomainResponse(ctx, domain) {
19
19
  return new PipelineResponse('', {
20
20
  status: 404,
21
21
  headers: {
22
- 'cache-control': 'private, no-cache, must-revalidate',
23
22
  'x-error': 'domain not found.',
24
23
  },
25
24
  });
package/src/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { PipelineResponse } from './PipelineResponse';
13
13
  import { ConfigContext, ConfigScope } from "./ConfigContext";
14
14
 
15
15
  export declare class ConfigRequestOptions {
16
- scope: ConfigScope,
16
+ scope: ConfigScope;
17
17
  org: string;
18
18
  site: string;
19
19
  ref: string;
@@ -0,0 +1,41 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$id": "https://ns.adobe.com/helix/config/access/site",
14
+ "$schema": "http://json-schema.org/draft-07/schema#",
15
+ "title": "Site Access Config",
16
+ "type": "object",
17
+ "properties": {
18
+ "allow": {
19
+ "description": "The email glob of the users that are allowed.",
20
+ "type": "array",
21
+ "items": {
22
+ "type": "string"
23
+ }
24
+ },
25
+ "apiKeyId": {
26
+ "description": "IDs of the api keys that are allowed.",
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string"
30
+ }
31
+ },
32
+ "clientCertDN": {
33
+ "description": "the DNs of the client certificates that are allowed.",
34
+ "type": "array",
35
+ "items": {
36
+ "type": "string"
37
+ }
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$id": "https://ns.adobe.com/helix/config/access/admin",
14
+ "$schema": "http://json-schema.org/draft-07/schema#",
15
+ "title": "Admin Access Config",
16
+ "type": "object",
17
+ "properties": {
18
+ "role": {
19
+ "title": "Role",
20
+ "type": "object",
21
+ "patternProperties": {
22
+ "^(?:author|publish|admin)$": {
23
+ "description": "The email glob of the users with respective role.",
24
+ "type": "array",
25
+ "items": {"type": "string"}
26
+ }
27
+ },
28
+ "required": ["role"],
29
+ "additionalProperties": false
30
+ },
31
+ "requireAuth": {
32
+ "description": "Enforce authentication if set to true. If set to 'auto' it will enforce authentication if a role mapping is defined. defaults to 'auto'.",
33
+ "default": "auto",
34
+ "oneOf": [
35
+ {
36
+ "type": "boolean"
37
+ },
38
+ {
39
+ "type": "string",
40
+ "enum": ["auto"]
41
+ }
42
+ ]
43
+ },
44
+ "defaultRole": {
45
+ "description": "the default roles assigned to the users. defaults to `basic_publish` for unauthenticated setups.",
46
+ "type": "array",
47
+ "items": {"type": "string"}
48
+ },
49
+ "apiKeyId": {
50
+ "description": "the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.",
51
+ "type": "array",
52
+ "items": {"type": "string"}
53
+ }
54
+ },
55
+ "additionalProperties": false
56
+ }
@@ -0,0 +1,154 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2023 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$id": "https://ns.adobe.com/helix/config/cdn",
14
+ "$schema": "http://json-schema.org/draft-07/schema#",
15
+ "$defs": {
16
+ "stringOrArray": {
17
+ "oneOf": [
18
+ {
19
+ "type": "string"
20
+ },
21
+ {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string"
25
+ }
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "title": "CDN Config",
31
+ "type": "object",
32
+ "properties": {
33
+ "prod": {
34
+ "oneOf": [{
35
+ "type": "object",
36
+ "title": "FastlyConfig",
37
+ "description": "Production CDN configuration for Fastly",
38
+ "properties": {
39
+ "type": {
40
+ "type": "string",
41
+ "const": "fastly"
42
+ },
43
+ "host": {
44
+ "description": "production host",
45
+ "type": "string"
46
+ },
47
+ "serviceId": {
48
+ "description": "The Fastly Service ID",
49
+ "type": "string"
50
+ },
51
+ "authToken": {
52
+ "description": "A Fastly token for purging",
53
+ "type": "string"
54
+ }
55
+ },
56
+ "required": ["type", "host", "route", "serviceId", "authToken"],
57
+ "additionalProperties": false
58
+ }, {
59
+ "type": "object",
60
+ "title": "AkamaiConfig",
61
+ "properties": {
62
+ "type": {
63
+ "type": "string",
64
+ "const": "akamai"
65
+ },
66
+ "host": {
67
+ "description": "production host",
68
+ "type": "string"
69
+ },
70
+ "endpoint": {
71
+ "type": "string"
72
+ },
73
+ "clientSecret": {
74
+ "type": "string"
75
+ },
76
+ "clientToken": {
77
+ "type": "string"
78
+ },
79
+ "accessToken": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "required": ["type", "host", "route", "endpoint", "clientSecret", "clientToken", "accessToken"],
84
+ "additionalProperties": false
85
+ }, {
86
+ "type": "object",
87
+ "title": "CloudflareConfig",
88
+ "properties": {
89
+ "type": {
90
+ "type": "string",
91
+ "const": "cloudflare"
92
+ },
93
+ "host": {
94
+ "description": "production host",
95
+ "type": "string"
96
+ },
97
+ "origin": {
98
+ "type": "string"
99
+ },
100
+ "plan": {
101
+ "type": "string"
102
+ },
103
+ "zoneId": {
104
+ "type": "string"
105
+ },
106
+ "apiToken": {
107
+ "type": "string"
108
+ }
109
+ },
110
+ "required": ["type", "host", "route", "origin", "plan", "zoneId", "apiToken"],
111
+ "additionalProperties": false
112
+ }, {
113
+ "type": "object",
114
+ "title": "ManagedConfig",
115
+ "properties": {
116
+ "type": {
117
+ "type": "string",
118
+ "const": "managed"
119
+ },
120
+ "host": {
121
+ "description": "production host",
122
+ "type": "string"
123
+ }
124
+ },
125
+ "required": [ "type", "host", "route"],
126
+ "additionalProperties": false
127
+ }]
128
+ },
129
+ "live": {
130
+ "properties": {
131
+ "host": {
132
+ "description": "Sidekick config to override the default preview host. it supports parameters $owner and $repo",
133
+ "examples": ["main--$repo--page.example.com"],
134
+ "type": "string"
135
+ }
136
+ },
137
+ "required": ["host"],
138
+ "additionalProperties": false
139
+ },
140
+ "preview": {
141
+ "properties": {
142
+ "host": {
143
+ "description": "Sidekick config to override the default live host. it supports parameters $owner and $repo",
144
+ "examples": ["main--$repo--live.example.com\""],
145
+ "type": "string"
146
+ }
147
+ },
148
+ "required": ["host"],
149
+ "additionalProperties": false
150
+ }
151
+ },
152
+ "required": ["prod"],
153
+ "additionalProperties": false
154
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "$id": "https://ns.adobe.com/helix/config/common",
15
+ "$defs": {
16
+ "title": {
17
+ "type": "string",
18
+ "description": "human readable title. has no influence on the configuration."
19
+ },
20
+ "description": {
21
+ "type": "string",
22
+ "description": "description for clarity. has no influence on the configuration."
23
+ },
24
+ "keyValuePair": {
25
+ "type": "object",
26
+ "properties": {
27
+ "key": {"type": "string"},
28
+ "value": {"type": "string"}
29
+ },
30
+ "required": [
31
+ "key",
32
+ "value"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "modifier-map": {
37
+ "type": "object",
38
+ "patternProperties": {
39
+ "^/[a-zA-Z0-9-/.]+[*]{0,2}$": {
40
+ "type": "array",
41
+ "items": [
42
+ { "$ref": "#/$defs/keyValuePair" }
43
+ ]
44
+ }
45
+ },
46
+ "additionalProperties": false
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "$id": "https://ns.adobe.com/helix/config/content-source/google",
15
+ "title": "Google Content Source",
16
+ "type": "object",
17
+ "properties": {
18
+ "type": {
19
+ "const": "google"
20
+ },
21
+ "url": {
22
+ "type": "string",
23
+ "format": "uri"
24
+ },
25
+ "id": {
26
+ "description": "Google drive ID of the root folder; updated automatically when updating the url.",
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "type",
32
+ "url",
33
+ "id"
34
+ ],
35
+ "additionalProperties": false
36
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "$id": "https://ns.adobe.com/helix/config/content-source/markup",
15
+ "title": "Markup Content Source",
16
+ "type": "object",
17
+ "properties": {
18
+ "type": {
19
+ "const": "markup"
20
+ },
21
+ "url": {
22
+ "type": "string",
23
+ "format": "uri"
24
+ },
25
+ "suffix": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": [
30
+ "type",
31
+ "url"
32
+ ],
33
+ "additionalProperties": false
34
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "$id": "https://ns.adobe.com/helix/config/content-source/onedrive",
15
+ "title": "Onedrive Content Source",
16
+ "type": "object",
17
+ "properties": {
18
+ "type": {
19
+ "const": "onedrive"
20
+ },
21
+ "url": {
22
+ "type": "string",
23
+ "format": "uri"
24
+ },
25
+ "tenantId": {
26
+ "type": "string"
27
+ },
28
+ "itemId": {
29
+ "description": "onedrive item ID of the root folder; currently not required as we don't know how setup will work.",
30
+ "type": "string"
31
+ }
32
+ },
33
+ "required": [
34
+ "type",
35
+ "url"
36
+ ],
37
+ "additionalProperties": false
38
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$id": "https://ns.adobe.com/helix/config/sidekick",
14
+ "$schema": "http://json-schema.org/draft-07/schema#",
15
+ "$defs": {
16
+ "sidekickPlugin": {
17
+ "type": "object",
18
+ "properties": {
19
+ "id": {
20
+ "type": "string"
21
+ },
22
+ "title": {
23
+ "type": "string"
24
+ },
25
+ "url": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": [
30
+ "id",
31
+ "title",
32
+ "url"
33
+ ]
34
+ }
35
+ },
36
+ "title": "Sidekick Config",
37
+ "type": "object",
38
+ "properties": {
39
+ "plugins": {
40
+ "type": "array",
41
+ "items": [{"$ref": "#/$defs/sidekickPlugin"}]
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "meta:license": [
3
+ "Copyright 2024 Adobe. All rights reserved.",
4
+ "This file is licensed to you under the Apache License, Version 2.0 (the \"License\");",
5
+ "you may not use this file except in compliance with the License. You may obtain a copy",
6
+ "of the License at http://www.apache.org/licenses/LICENSE-2.0",
7
+ "",
8
+ "Unless required by applicable law or agreed to in writing, software distributed under",
9
+ "the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS",
10
+ "OF ANY KIND, either express or implied. See the License for the specific language",
11
+ "governing permissions and limitations under the License."
12
+ ],
13
+ "$schema": "http://json-schema.org/draft-07/schema#",
14
+ "$id": "https://ns.adobe.com/helix/config/site",
15
+ "title": "Helix Site Config",
16
+ "type": "object",
17
+ "properties": {
18
+ "version": {
19
+ "type": "integer",
20
+ "enum": [1]
21
+ },
22
+ "name": {
23
+ "type": "string",
24
+ "description": "Site name; part of the hostname",
25
+ "format": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
26
+ },
27
+ "title": { "$ref": "common.schema.json#/$defs/title" },
28
+ "description": { "$ref": "common.schema.json#/$defs/description" },
29
+
30
+ "content": {
31
+ "type": "object",
32
+ "title": "Content Bus",
33
+ "description": "Defines the content bus location and source.",
34
+ "properties": {
35
+ "title": { "$ref": "common.schema.json#/$defs/title" },
36
+ "description": { "$ref": "common.schema.json#/$defs/description" },
37
+ "contentBusId": {"type": "string" },
38
+ "source": {
39
+ "oneOf": [
40
+ { "$ref": "content-google.schema.json" },
41
+ { "$ref": "content-onedrive.schema.json" },
42
+ { "$ref": "content-markup.schema.json" }
43
+ ]
44
+ }
45
+ },
46
+ "required": [
47
+ "contentBusId",
48
+ "source"
49
+ ],
50
+ "additionalProperties": false
51
+ },
52
+ "code": {
53
+ "type": "object",
54
+ "title": "Code Bus",
55
+ "description": "Defines the code bus location and source.",
56
+ "properties": {
57
+ "title": { "$ref": "common.schema.json#/$defs/title" },
58
+ "description": { "$ref": "common.schema.json#/$defs/description" },
59
+ "owner": {
60
+ "$comment": "Note, that owner/repo are no longer part of the hostname and can therefor have more allowed characters than in helix4",
61
+ "type": "string",
62
+ "format": "[a-zA-Z0-9_-]+"
63
+ },
64
+ "repo": {
65
+ "type": "string",
66
+ "format": "[a-zA-Z0-9_-]+"
67
+ },
68
+ "source": {
69
+ "type": "object",
70
+ "properties": {
71
+ "type": {
72
+ "const": "github"
73
+ },
74
+ "url": {
75
+ "type": "string",
76
+ "format": "uri"
77
+ }
78
+ },
79
+ "required": [
80
+ "type",
81
+ "url"
82
+ ],
83
+ "additionalProperties": false
84
+ }
85
+ },
86
+ "required": [
87
+ "owner",
88
+ "repo",
89
+ "source"
90
+ ]
91
+ },
92
+ "folders": {
93
+ "type": "object",
94
+ "patternProperties": {
95
+ "^/[a-zA-Z0-9-/.]+$": {
96
+ "type": "array",
97
+ "items": [
98
+ { "type": "string" }
99
+ ]
100
+ }
101
+ }
102
+ },
103
+ "headers": {
104
+ "$ref": "common.schema.json#/$defs/modifier-map"
105
+ },
106
+ "cdn": {
107
+ "$ref": "cdn-config.schema.json"
108
+ },
109
+ "access": {
110
+ "type": "object",
111
+ "properties": {
112
+ "admin": {
113
+ "$ref": "admin-access-config.schema.json"
114
+ },
115
+ "preview": {
116
+ "$ref": "access-config.schema.json"
117
+ },
118
+ "live": {
119
+ "$ref": "access-config.schema.json"
120
+ }
121
+ },
122
+ "additionalProperties": false
123
+ },
124
+ "sidekick": {
125
+ "$ref": "sidekick-config.schema.json"
126
+ },
127
+ "metadata": {
128
+ "type": "object",
129
+ "properties": {
130
+ "source": {
131
+ "type": "array",
132
+ "items": [
133
+ { "type": "string" }
134
+ ]
135
+ }
136
+ },
137
+ "additionalProperties": false
138
+ }
139
+ },
140
+ "required": [
141
+ "version",
142
+ "content",
143
+ "code"
144
+ ],
145
+ "additionalProperties": false
146
+ }
@@ -0,0 +1,227 @@
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
+
13
+ // NOTE: this file is autogenerated via 'npm run docs:types'
14
+
15
+ export interface HelixSiteConfig {
16
+ version: 1;
17
+ /**
18
+ * Site name; part of the hostname
19
+ */
20
+ name?: string;
21
+ /**
22
+ * human readable title. has no influence on the configuration.
23
+ */
24
+ title?: string;
25
+ /**
26
+ * description for clarity. has no influence on the configuration.
27
+ */
28
+ description?: string;
29
+ content: ContentBus;
30
+ code: CodeBus;
31
+ folders?: {
32
+ /**
33
+ * This interface was referenced by `undefined`'s JSON-Schema definition
34
+ * via the `patternProperty` "^/[a-zA-Z0-9-/.]+$".
35
+ */
36
+ [k: string]: [] | [string];
37
+ };
38
+ headers?: ModifierMap;
39
+ cdn?: CDNConfig;
40
+ access?: {
41
+ admin?: AdminAccessConfig;
42
+ preview?: SiteAccessConfig;
43
+ live?: SiteAccessConfig;
44
+ };
45
+ sidekick?: SidekickConfig;
46
+ metadata?: {
47
+ source?: [] | [string];
48
+ };
49
+ }
50
+ /**
51
+ * Defines the content bus location and source.
52
+ */
53
+ export interface ContentBus {
54
+ /**
55
+ * human readable title. has no influence on the configuration.
56
+ */
57
+ title?: string;
58
+ /**
59
+ * description for clarity. has no influence on the configuration.
60
+ */
61
+ description?: string;
62
+ contentBusId: string;
63
+ source: GoogleContentSource | OnedriveContentSource | MarkupContentSource;
64
+ }
65
+ export interface GoogleContentSource {
66
+ type: 'google';
67
+ url: string;
68
+ /**
69
+ * Google drive ID of the root folder; updated automatically when updating the url.
70
+ */
71
+ id: string;
72
+ }
73
+ export interface OnedriveContentSource {
74
+ type: 'onedrive';
75
+ url: string;
76
+ tenantId?: string;
77
+ /**
78
+ * onedrive item ID of the root folder; currently not required as we don't know how setup will work.
79
+ */
80
+ itemId?: string;
81
+ }
82
+ export interface MarkupContentSource {
83
+ type: 'markup';
84
+ url: string;
85
+ suffix?: string;
86
+ }
87
+ /**
88
+ * Defines the code bus location and source.
89
+ */
90
+ export interface CodeBus {
91
+ /**
92
+ * human readable title. has no influence on the configuration.
93
+ */
94
+ title?: string;
95
+ /**
96
+ * description for clarity. has no influence on the configuration.
97
+ */
98
+ description?: string;
99
+ owner: string;
100
+ repo: string;
101
+ source: {
102
+ type: 'github';
103
+ url: string;
104
+ };
105
+ [k: string]: unknown;
106
+ }
107
+ export interface ModifierMap {
108
+ /**
109
+ * This interface was referenced by `ModifierMap`'s JSON-Schema definition
110
+ * via the `patternProperty` "^/[a-zA-Z0-9-/.]+[*]{0,2}$".
111
+ */
112
+ [k: string]: [] | [KeyValuePair];
113
+ }
114
+ export interface KeyValuePair {
115
+ key: string;
116
+ value: string;
117
+ }
118
+ export interface CDNConfig {
119
+ prod: FastlyConfig | AkamaiConfig | CloudflareConfig | ManagedConfig;
120
+ live?: {
121
+ /**
122
+ * Sidekick config to override the default preview host. it supports parameters $owner and $repo
123
+ */
124
+ host: string;
125
+ };
126
+ preview?: {
127
+ /**
128
+ * Sidekick config to override the default live host. it supports parameters $owner and $repo
129
+ */
130
+ host: string;
131
+ };
132
+ }
133
+ /**
134
+ * Production CDN configuration for Fastly
135
+ */
136
+ export interface FastlyConfig {
137
+ type: 'fastly';
138
+ /**
139
+ * production host
140
+ */
141
+ host: string;
142
+ /**
143
+ * The Fastly Service ID
144
+ */
145
+ serviceId: string;
146
+ /**
147
+ * A Fastly token for purging
148
+ */
149
+ authToken: string;
150
+ }
151
+ export interface AkamaiConfig {
152
+ type: 'akamai';
153
+ /**
154
+ * production host
155
+ */
156
+ host: string;
157
+ endpoint: string;
158
+ clientSecret: string;
159
+ clientToken: string;
160
+ accessToken: string;
161
+ }
162
+ export interface CloudflareConfig {
163
+ type: 'cloudflare';
164
+ /**
165
+ * production host
166
+ */
167
+ host: string;
168
+ origin: string;
169
+ plan: string;
170
+ zoneId: string;
171
+ apiToken: string;
172
+ }
173
+ export interface ManagedConfig {
174
+ type: 'managed';
175
+ /**
176
+ * production host
177
+ */
178
+ host: string;
179
+ }
180
+ export interface AdminAccessConfig {
181
+ role?: Role;
182
+ /**
183
+ * Enforce authentication if set to true. If set to 'auto' it will enforce authentication if a role mapping is defined. defaults to 'auto'.
184
+ */
185
+ requireAuth?: boolean | 'auto';
186
+ /**
187
+ * the default roles assigned to the users. defaults to `basic_publish` for unauthenticated setups.
188
+ */
189
+ defaultRole?: string[];
190
+ /**
191
+ * the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.
192
+ */
193
+ apiKeyId?: string[];
194
+ }
195
+ export interface Role {
196
+ /**
197
+ * The email glob of the users with respective role.
198
+ *
199
+ * This interface was referenced by `Role`'s JSON-Schema definition
200
+ * via the `patternProperty` "^(?:author|publish|admin)$".
201
+ */
202
+ [k: string]: string[];
203
+ }
204
+ export interface SiteAccessConfig {
205
+ /**
206
+ * The email glob of the users that are allowed.
207
+ */
208
+ allow?: string[];
209
+ /**
210
+ * IDs of the api keys that are allowed.
211
+ */
212
+ apiKeyId?: string[];
213
+ /**
214
+ * the DNs of the client certificates that are allowed.
215
+ */
216
+ clientCertDN?: string[];
217
+ }
218
+ export interface SidekickConfig {
219
+ plugins?: [] | [SidekickPlugin];
220
+ [k: string]: unknown;
221
+ }
222
+ export interface SidekickPlugin {
223
+ id: string;
224
+ title: string;
225
+ url: string;
226
+ [k: string]: unknown;
227
+ }