@adobe/helix-config 2.5.5 → 2.6.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 (39) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +5 -2
  3. package/src/schemas/access-admin.schema.cjs +12 -0
  4. package/src/schemas/access-site.schema.cjs +12 -0
  5. package/src/schemas/access.schema.cjs +12 -0
  6. package/src/schemas/access.schema.json +29 -0
  7. package/src/schemas/cdn.schema.cjs +12 -0
  8. package/src/schemas/cdn.schema.json +233 -0
  9. package/src/schemas/code.schema.cjs +12 -0
  10. package/src/schemas/code.schema.json +53 -0
  11. package/src/schemas/common.schema.cjs +12 -0
  12. package/src/schemas/content-source-google.schema.cjs +12 -0
  13. package/src/schemas/content-source-markup.schema.cjs +12 -0
  14. package/src/schemas/content-source-onedrive.schema.cjs +12 -0
  15. package/src/schemas/content.schema.cjs +12 -0
  16. package/src/schemas/content.schema.json +35 -0
  17. package/src/schemas/folders.schema.cjs +12 -0
  18. package/src/schemas/folders.schema.json +25 -0
  19. package/src/schemas/metadata-source.schema.cjs +12 -0
  20. package/src/schemas/metadata-source.schema.json +26 -0
  21. package/src/schemas/profile.schema.cjs +12 -0
  22. package/src/schemas/profile.schema.json +55 -0
  23. package/src/schemas/sidekick.schema.cjs +12 -0
  24. package/src/schemas/site.schema.cjs +12 -0
  25. package/src/schemas/site.schema.json +62 -0
  26. package/src/storage/ValidationError.js +46 -0
  27. package/src/storage/config-store.js +20 -3
  28. package/src/storage/config-validator.js +77 -0
  29. package/src/storage/utils.js +65 -11
  30. package/types/profile-config.d.ts +249 -0
  31. package/types/site-config.d.ts +25 -16
  32. package/src/schemas/cdn-config.schema.json +0 -182
  33. package/src/schemas/site-config.schema.json +0 -146
  34. /package/src/schemas/{admin-access-config.schema.json → access-admin.schema.json} +0 -0
  35. /package/src/schemas/{access-config.schema.json → access-site.schema.json} +0 -0
  36. /package/src/schemas/{content-google.schema.json → content-source-google.schema.json} +0 -0
  37. /package/src/schemas/{content-markup.schema.json → content-source-markup.schema.json} +0 -0
  38. /package/src/schemas/{content-onedrive.schema.json → content-source-onedrive.schema.json} +0 -0
  39. /package/src/schemas/{sidekick-config.schema.json → sidekick.schema.json} +0 -0
@@ -0,0 +1,55 @@
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/profile",
15
+ "title": "Helix Profile Config",
16
+ "type": "object",
17
+ "properties": {
18
+ "version": {
19
+ "type": "integer",
20
+ "enum": [1],
21
+ "default": 1
22
+ },
23
+ "title": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/title" },
24
+ "description": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/description" },
25
+
26
+ "content": {
27
+ "$ref": "https://ns.adobe.com/helix/config/content"
28
+ },
29
+ "code": {
30
+ "$ref": "https://ns.adobe.com/helix/config/code"
31
+ },
32
+ "folders": {
33
+ "$ref": "https://ns.adobe.com/helix/config/folders"
34
+ },
35
+ "headers": {
36
+ "$ref": "https://ns.adobe.com/helix/config/common#/$defs/modifier-map"
37
+ },
38
+ "cdn": {
39
+ "$ref": "https://ns.adobe.com/helix/config/cdn"
40
+ },
41
+ "access": {
42
+ "$ref": "https://ns.adobe.com/helix/config/access"
43
+ },
44
+ "sidekick": {
45
+ "$ref": "https://ns.adobe.com/helix/config/sidekick"
46
+ },
47
+ "metadata": {
48
+ "$ref": "https://ns.adobe.com/helix/config/metadata-source"
49
+ }
50
+ },
51
+ "required": [
52
+ "version"
53
+ ],
54
+ "additionalProperties": false
55
+ }
@@ -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('./sidekick.schema.json');
@@ -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('./site.schema.json');
@@ -0,0 +1,62 @@
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
+ "default": 1
22
+ },
23
+ "name": {
24
+ "type": "string",
25
+ "description": "Site name; part of the hostname",
26
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
27
+ },
28
+ "title": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/title" },
29
+ "description": { "$ref": "https://ns.adobe.com/helix/config/common#/$defs/description" },
30
+
31
+ "content": {
32
+ "$ref": "https://ns.adobe.com/helix/config/content"
33
+ },
34
+ "code": {
35
+ "$ref": "https://ns.adobe.com/helix/config/code"
36
+ },
37
+ "folders": {
38
+ "$ref": "https://ns.adobe.com/helix/config/folders"
39
+ },
40
+ "headers": {
41
+ "$ref": "https://ns.adobe.com/helix/config/common#/$defs/modifier-map"
42
+ },
43
+ "cdn": {
44
+ "$ref": "https://ns.adobe.com/helix/config/cdn"
45
+ },
46
+ "access": {
47
+ "$ref": "https://ns.adobe.com/helix/config/access"
48
+ },
49
+ "sidekick": {
50
+ "$ref": "https://ns.adobe.com/helix/config/sidekick"
51
+ },
52
+ "metadata": {
53
+ "$ref": "https://ns.adobe.com/helix/config/metadata-source"
54
+ }
55
+ },
56
+ "required": [
57
+ "version",
58
+ "content",
59
+ "code"
60
+ ],
61
+ "additionalProperties": false
62
+ }
@@ -0,0 +1,46 @@
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
+ /* eslint-disable max-classes-per-file */
13
+
14
+ export class ValidationError extends Error {
15
+ constructor(
16
+ msg,
17
+ errors = [],
18
+ mapError = ValidationError.mapError,
19
+ prettyname = ValidationError.prettyname,
20
+ ) {
21
+ const detail = errors.map((e) => mapError(e, prettyname)).join('\n');
22
+ super(`Invalid configuration:
23
+ ${detail}
24
+
25
+ ${msg}`);
26
+ this._errors = errors;
27
+ }
28
+
29
+ static prettyname(path, schema) {
30
+ /* c8 ignore next */
31
+ return path ? `${schema.title || schema.$id} ${path}` : `${schema.title || schema.$id}`;
32
+ }
33
+
34
+ static mapError({
35
+ keyword, dataPath, message, data, params, parentSchema,
36
+ }, prettyname) {
37
+ /* c8 ignore next 7 */
38
+ if (keyword === 'additionalProperties') {
39
+ return `${prettyname(dataPath, parentSchema)} has unknown property '${params.additionalProperty}'`;
40
+ }
41
+ if (keyword === 'required') {
42
+ return `${prettyname(dataPath, parentSchema)} ${message}`;
43
+ }
44
+ return `${prettyname(dataPath, parentSchema)} ${message}: ${keyword}(${JSON.stringify(data)}, ${JSON.stringify(params)})`;
45
+ }
46
+ }
@@ -11,7 +11,13 @@
11
11
  */
12
12
  import { HelixStorage } from './storage.js';
13
13
  import { StatusCodeError } from './status-code-error.js';
14
- import { jsonGet, jsonPut, updateContentBusId } from './utils.js';
14
+ import {
15
+ jsonGet,
16
+ jsonPut,
17
+ updateCodeSource,
18
+ updateContentSource,
19
+ } from './utils.js';
20
+ import { validate } from './config-validator.js';
15
21
 
16
22
  const FRAGMENTS = {
17
23
  sites: {
@@ -65,7 +71,9 @@ export class ConfigStore {
65
71
  if (await storage.head(this.key)) {
66
72
  throw new StatusCodeError(409, 'config already exists.');
67
73
  }
68
- updateContentBusId(ctx, data);
74
+ updateContentSource(ctx, data.content);
75
+ updateCodeSource(ctx, data.code);
76
+ await validate(data, this.type);
69
77
  await storage.put(this.key, JSON.stringify(data), 'application/json');
70
78
  await this.purge(ctx, null, data);
71
79
  }
@@ -99,10 +107,18 @@ export class ConfigStore {
99
107
  if (!fragment) {
100
108
  throw new StatusCodeError(400, 'invalid object path.');
101
109
  }
110
+ if (relPath === 'code') {
111
+ updateCodeSource(ctx, data);
112
+ } else if (relPath === 'content') {
113
+ updateContentSource(ctx, data);
114
+ }
102
115
  // eslint-disable-next-line no-param-reassign
103
116
  data = jsonPut(JSON.parse(buf), relPath, data);
117
+ } else {
118
+ updateContentSource(ctx, data.content);
119
+ updateCodeSource(ctx, data.code);
104
120
  }
105
- updateContentBusId(ctx, data);
121
+ await validate(data, this.type);
106
122
  await storage.put(this.key, JSON.stringify(data), 'application/json');
107
123
  await this.purge(ctx, old, data);
108
124
  }
@@ -119,6 +135,7 @@ export class ConfigStore {
119
135
  throw new StatusCodeError(400, 'invalid object path.');
120
136
  }
121
137
  const data = jsonPut(JSON.parse(buf), relPath, null);
138
+ await validate(data, this.type);
122
139
  await storage.put(this.key, JSON.stringify(data), 'application/json');
123
140
  await this.purge(ctx, JSON.parse(buf), data);
124
141
  return;
@@ -0,0 +1,77 @@
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
+ import Ajv from 'ajv';
13
+ import ajvFormats from 'ajv-formats';
14
+ import { ValidationError } from './ValidationError.js';
15
+
16
+ import accessAdminSchema from '../schemas/access-admin.schema.cjs';
17
+ import accessSchema from '../schemas/access.schema.cjs';
18
+ import accessSiteSchema from '../schemas/access-site.schema.cjs';
19
+ import cdnSchema from '../schemas/cdn.schema.cjs';
20
+ import commonSchema from '../schemas/common.schema.cjs';
21
+ import codeSchema from '../schemas/code.schema.cjs';
22
+ import contentSchema from '../schemas/content.schema.cjs';
23
+ import foldersSchema from '../schemas/folders.schema.cjs';
24
+ import googleSchema from '../schemas/content-source-google.schema.cjs';
25
+ import markupSchema from '../schemas/content-source-markup.schema.cjs';
26
+ import metadataSchema from '../schemas/metadata-source.schema.cjs';
27
+ import onedriveSchema from '../schemas/content-source-onedrive.schema.cjs';
28
+ import profileSchema from '../schemas/profile.schema.cjs';
29
+ import sidekickSchema from '../schemas/sidekick.schema.cjs';
30
+ import siteSchema from '../schemas/site.schema.cjs';
31
+
32
+ const SCHEMAS = [
33
+ accessSchema,
34
+ accessAdminSchema,
35
+ accessSiteSchema,
36
+ cdnSchema,
37
+ commonSchema,
38
+ contentSchema,
39
+ codeSchema,
40
+ foldersSchema,
41
+ googleSchema,
42
+ markupSchema,
43
+ metadataSchema,
44
+ onedriveSchema,
45
+ profileSchema,
46
+ sidekickSchema,
47
+ siteSchema,
48
+ ];
49
+
50
+ const SCHEMA_TYPES = {
51
+ profiles: profileSchema,
52
+ sites: siteSchema,
53
+ };
54
+
55
+ /**
56
+ * Validates the loaded configuration and coerces types and sets defaults
57
+ * @param {object} config The configuration to validate
58
+ * @param {string} type the config type
59
+ * @returns {object} The validated configuration
60
+ */
61
+ export async function validate(config, type) {
62
+ const ajv = new Ajv({
63
+ allErrors: true,
64
+ verbose: true,
65
+ useDefaults: true,
66
+ coerceTypes: 'array',
67
+ strict: false,
68
+ });
69
+ ajvFormats(ajv);
70
+
71
+ ajv.addSchema(SCHEMAS);
72
+ const res = ajv.validate(SCHEMA_TYPES[type], config);
73
+ if (res) {
74
+ return res;
75
+ }
76
+ throw new ValidationError(ajv.errorsText(), ajv.errors);
77
+ }
@@ -9,7 +9,9 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+ /* eslint-disable no-param-reassign */
12
13
  import crypto from 'crypto';
14
+ import { GitUrl } from '@adobe/helix-shared-git';
13
15
 
14
16
  export function jsonGet(obj, path) {
15
17
  return path.split('/').reduce((o, p) => o[p], obj);
@@ -36,24 +38,76 @@ export function jsonPut(obj, path, value) {
36
38
  /**
37
39
  * Update the contentBusId field of the content object based on the source URL.
38
40
  * @param ctx
39
- * @param data
41
+ * @param content
40
42
  * @returns {boolean}
41
43
  */
42
- export function updateContentBusId(ctx, data) {
43
- if (!data.content?.source?.url) {
44
+ export function updateContentSource(ctx, content) {
45
+ if (!content?.source?.url) {
44
46
  return false;
45
47
  }
48
+ const url = new URL(content.source.url);
49
+ let modified = false;
46
50
  const sha256 = crypto
47
51
  .createHash('sha256')
48
- .update(data.content.source.url)
52
+ .update(url.toString())
49
53
  .digest('hex');
50
54
  const contentBusId = `${sha256.substring(0, 59)}`;
51
- if (contentBusId === data.content.contentBusId) {
52
- ctx.log.info(`contentBusId is already correct for ${data.content.source.url}: ${contentBusId}`);
53
- return false;
55
+ if (contentBusId === content.contentBusId) {
56
+ ctx.log.info(`contentBusId is already correct for ${url}: ${contentBusId}`);
57
+ } else {
58
+ ctx.log.info(`Updating contentBusId for ${url}: ${contentBusId}`);
59
+ content.contentBusId = contentBusId;
60
+ modified = true;
61
+ }
62
+
63
+ // calculate type based on source URL
64
+ if (!content.source.type) {
65
+ if (url.hostname === 'drive.google.com') {
66
+ content.source.type = 'google';
67
+ content.source.id = url.pathname.split('/').pop();
68
+ modified = true;
69
+ } else if (url.protocol === 'gdrive:') {
70
+ content.source.type = 'google';
71
+ content.source.id = url.pathname;
72
+ modified = true;
73
+ } else if (url.hostname.endsWith('.sharepoint.com') || url.hostname === '1drv.ms') {
74
+ content.source.type = 'onedrive';
75
+ modified = true;
76
+ } else if (url.protocol === 'onedrive:') {
77
+ content.source.type = 'onedrive';
78
+ content.source.itemId = url.pathname;
79
+ modified = true;
80
+ }
81
+ }
82
+ return modified;
83
+ }
84
+
85
+ /**
86
+ * updates the code source information
87
+ * @param ctx
88
+ * @param code
89
+ * @return {boolean} true if the code source was updated
90
+ */
91
+ export function updateCodeSource(ctx, code) {
92
+ let modified = false;
93
+ if (code?.source?.url) {
94
+ // recompute owner, repo and type
95
+ code.source.type = 'github';
96
+ const url = new GitUrl(code.source.url);
97
+ if (url.owner !== code.owner) {
98
+ code.owner = url.owner;
99
+ modified = true;
100
+ }
101
+ if (url.repo !== code.repo) {
102
+ code.repo = url.repo;
103
+ modified ||= true;
104
+ }
105
+ } else if (code?.owner && code?.repo) {
106
+ code.source = {
107
+ type: 'github',
108
+ url: `https://github.com/${code.owner}/${code.repo}`,
109
+ };
110
+ modified = true;
54
111
  }
55
- ctx.log.info(`Updating contentBusId for ${data.content.source.url}: ${contentBusId}`);
56
- // eslint-disable-next-line no-param-reassign
57
- data.content.contentBusId = contentBusId;
58
- return true;
112
+ return modified;
59
113
  }
@@ -0,0 +1,249 @@
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
+ import {MountConfig} from '@adobe/helix-shared-config';
15
+
16
+ export interface HelixProfileConfig {
17
+ version: 1;
18
+ /**
19
+ * human readable title. has no influence on the configuration.
20
+ */
21
+ title?: string;
22
+ /**
23
+ * description for clarity. has no influence on the configuration.
24
+ */
25
+ description?: string;
26
+ content?: ContentBus;
27
+ code?: CodeBus;
28
+ folders?: Folders;
29
+ headers?: ModifierMap;
30
+ cdn?: CDNConfig;
31
+ access?: Access;
32
+ sidekick?: SidekickConfig;
33
+ metadata?: Metadata;
34
+ }
35
+ /**
36
+ * Defines the content bus location and source.
37
+ */
38
+ export interface ContentBus {
39
+ /**
40
+ * human readable title. has no influence on the configuration.
41
+ */
42
+ title?: string;
43
+ /**
44
+ * description for clarity. has no influence on the configuration.
45
+ */
46
+ description?: string;
47
+ contentBusId: string;
48
+ source: GoogleContentSource | OnedriveContentSource | MarkupContentSource;
49
+ }
50
+ export interface GoogleContentSource {
51
+ type: 'google';
52
+ url: string;
53
+ /**
54
+ * Google drive ID of the root folder; updated automatically when updating the url.
55
+ */
56
+ id: string;
57
+ }
58
+ export interface OnedriveContentSource {
59
+ type: 'onedrive';
60
+ url: string;
61
+ tenantId?: string;
62
+ /**
63
+ * onedrive item ID of the root folder; currently not required as we don't know how setup will work.
64
+ */
65
+ itemId?: string;
66
+ }
67
+ export interface MarkupContentSource {
68
+ type: 'markup';
69
+ url: string;
70
+ suffix?: string;
71
+ }
72
+ /**
73
+ * Defines the code bus location and source.
74
+ */
75
+ export interface CodeBus {
76
+ /**
77
+ * human readable title. has no influence on the configuration.
78
+ */
79
+ title?: string;
80
+ /**
81
+ * description for clarity. has no influence on the configuration.
82
+ */
83
+ description?: string;
84
+ owner: string;
85
+ repo: string;
86
+ source: {
87
+ type: 'github';
88
+ url: string;
89
+ };
90
+ [k: string]: unknown;
91
+ }
92
+ export interface Folders {
93
+ /**
94
+ * This interface was referenced by `Folders`'s JSON-Schema definition
95
+ * via the `patternProperty` "^/[a-zA-Z0-9-/.]+$".
96
+ */
97
+ [k: string]: [] | [string];
98
+ }
99
+ export interface ModifierMap {
100
+ /**
101
+ * This interface was referenced by `ModifierMap`'s JSON-Schema definition
102
+ * via the `patternProperty` "^/[a-zA-Z0-9-/.]+[*]{0,2}$".
103
+ */
104
+ [k: string]: [] | [KeyValuePair];
105
+ }
106
+ export interface KeyValuePair {
107
+ key: string;
108
+ value: string;
109
+ }
110
+ export interface CDNConfig {
111
+ prod: FastlyConfig | AkamaiConfig | CloudflareConfig | ManagedConfig | EmptyConfig;
112
+ live?: {
113
+ /**
114
+ * Sidekick config to override the default preview host. it supports parameters $owner and $repo
115
+ */
116
+ host: string;
117
+ };
118
+ preview?: {
119
+ /**
120
+ * Sidekick config to override the default live host. it supports parameters $owner and $repo
121
+ */
122
+ host: string;
123
+ };
124
+ }
125
+ /**
126
+ * Production CDN configuration for Fastly
127
+ */
128
+ export interface FastlyConfig {
129
+ type: 'fastly';
130
+ /**
131
+ * production host
132
+ */
133
+ host: string;
134
+ /**
135
+ * Routes on the CDN that are rendered with Franklin
136
+ */
137
+ route?: string[];
138
+ /**
139
+ * The Fastly Service ID
140
+ */
141
+ serviceId: string;
142
+ /**
143
+ * A Fastly token for purging
144
+ */
145
+ authToken: string;
146
+ }
147
+ export interface AkamaiConfig {
148
+ type: 'akamai';
149
+ /**
150
+ * production host
151
+ */
152
+ host: string;
153
+ /**
154
+ * Routes on the CDN that are rendered with Franklin
155
+ */
156
+ route?: 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
+ /**
169
+ * Routes on the CDN that are rendered with Franklin
170
+ */
171
+ route?: string[];
172
+ origin: string;
173
+ plan: string;
174
+ zoneId: string;
175
+ apiToken: string;
176
+ }
177
+ export interface ManagedConfig {
178
+ type: 'managed';
179
+ /**
180
+ * production host
181
+ */
182
+ host: string;
183
+ /**
184
+ * Routes on the CDN that are rendered with Franklin
185
+ */
186
+ route?: string[];
187
+ }
188
+ export interface EmptyConfig {
189
+ /**
190
+ * production host
191
+ */
192
+ host: string;
193
+ }
194
+ export interface Access {
195
+ admin?: AdminAccessConfig;
196
+ preview?: SiteAccessConfig;
197
+ live?: SiteAccessConfig;
198
+ }
199
+ export interface AdminAccessConfig {
200
+ role?: Role;
201
+ /**
202
+ * Enforce authentication if set to true. If set to 'auto' it will enforce authentication if a role mapping is defined. defaults to 'auto'.
203
+ */
204
+ requireAuth?: boolean | 'auto';
205
+ /**
206
+ * the default roles assigned to the users. defaults to `basic_publish` for unauthenticated setups.
207
+ */
208
+ defaultRole?: string[];
209
+ /**
210
+ * the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.
211
+ */
212
+ apiKeyId?: string[];
213
+ }
214
+ export interface Role {
215
+ /**
216
+ * The email glob of the users with respective role.
217
+ *
218
+ * This interface was referenced by `Role`'s JSON-Schema definition
219
+ * via the `patternProperty` "^(?:author|publish|admin)$".
220
+ */
221
+ [k: string]: string[];
222
+ }
223
+ export interface SiteAccessConfig {
224
+ /**
225
+ * The email glob of the users that are allowed.
226
+ */
227
+ allow?: string[];
228
+ /**
229
+ * IDs of the api keys that are allowed.
230
+ */
231
+ apiKeyId?: string[];
232
+ /**
233
+ * the DNs of the client certificates that are allowed.
234
+ */
235
+ clientCertDN?: string[];
236
+ }
237
+ export interface SidekickConfig {
238
+ plugins?: [] | [SidekickPlugin];
239
+ [k: string]: unknown;
240
+ }
241
+ export interface SidekickPlugin {
242
+ id: string;
243
+ title: string;
244
+ url: string;
245
+ [k: string]: unknown;
246
+ }
247
+ export interface Metadata {
248
+ source?: [] | [string];
249
+ }