@adobe/helix-config-storage 1.11.0 → 1.13.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.13.0](https://github.com/adobe/helix-config-storage/compare/v1.12.0...v1.13.0) (2024-12-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * remove clientCertDN ([#73](https://github.com/adobe/helix-config-storage/issues/73)) ([20dafca](https://github.com/adobe/helix-config-storage/commit/20dafcaf34cf18d3c1cdc096775b315ee4c76ceb))
7
+
8
+ # [1.12.0](https://github.com/adobe/helix-config-storage/compare/v1.11.0...v1.12.0) (2024-12-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * require owner/repo for byo git ([#71](https://github.com/adobe/helix-config-storage/issues/71)) ([2d67b01](https://github.com/adobe/helix-config-storage/commit/2d67b01af1d1e16dfa569f5fb10b6e466873a47a))
14
+
1
15
  # [1.11.0](https://github.com/adobe/helix-config-storage/compare/v1.10.0...v1.11.0) (2024-12-10)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config-storage",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Helix Config Storage",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -41,12 +41,12 @@
41
41
  "@semantic-release/git": "10.0.1",
42
42
  "@semantic-release/npm": "12.0.1",
43
43
  "ajv-cli": "5.0.0",
44
- "c8": "10.1.2",
44
+ "c8": "10.1.3",
45
45
  "eslint": "8.57.1",
46
46
  "husky": "9.1.7",
47
47
  "json-schema-to-typescript": "15.0.3",
48
48
  "junit-report-builder": "5.1.1",
49
- "lint-staged": "15.2.10",
49
+ "lint-staged": "15.2.11",
50
50
  "mocha": "11.0.1",
51
51
  "mocha-multi-reporters": "1.5.1",
52
52
  "mocha-suppress-logs": "0.5.1",
@@ -55,7 +55,7 @@ function handleCDNProd(byPath, msg) {
55
55
 
56
56
  export class ValidationError extends Error {
57
57
  constructor(msg, errors = []) {
58
- super(ValidationError.generateErrorDetail(errors));
58
+ super(ValidationError.generateErrorDetail(errors) || msg);
59
59
  this._errors = errors;
60
60
  }
61
61
 
@@ -18,13 +18,6 @@
18
18
  "items": {
19
19
  "type": "string"
20
20
  }
21
- },
22
- "clientCertDN": {
23
- "description": "the DNs of the client certificates that are allowed.",
24
- "type": "array",
25
- "items": {
26
- "type": "string"
27
- }
28
21
  }
29
22
  },
30
23
  "additionalProperties": false
@@ -34,6 +34,14 @@
34
34
  "secretId": {
35
35
  "type": "string",
36
36
  "pattern": "^[a-zA-Z0-9-_=]+$"
37
+ },
38
+ "owner": {
39
+ "type": "string",
40
+ "pattern": "^[a-zA-Z0-9_-]+$"
41
+ },
42
+ "repo": {
43
+ "type": "string",
44
+ "pattern": "^[a-zA-Z0-9_-]+$"
37
45
  }
38
46
  },
39
47
  "required": [
package/src/utils.js CHANGED
@@ -14,6 +14,7 @@ import crypto from 'crypto';
14
14
  import { GitUrl } from '@adobe/helix-shared-git';
15
15
  import { decodeJwt } from 'jose';
16
16
  import { StatusCodeError } from './status-code-error.js';
17
+ import { ValidationError } from './ValidationError.js';
17
18
 
18
19
  /**
19
20
  * Update the contentBusId field of the content object based on the source URL.
@@ -73,15 +74,21 @@ export function updateCodeSource(ctx, code) {
73
74
  if (code?.source?.url) {
74
75
  // recompute owner, repo and type
75
76
  code.source.type = 'github';
76
- const url = new GitUrl(code.source.url);
77
- let owner = url.owner.toLowerCase();
78
- const repo = url.repo.toLowerCase();
77
+ const url = new URL(code.source.url);
78
+ let { owner, repo } = code.source;
79
79
  if (url.hostname !== 'github.com' && url.hostname !== 'www.github.com') {
80
+ if (!owner || !repo) {
81
+ throw new ValidationError('code.source.owner and code.source.repo are required for non github sources.');
82
+ }
80
83
  const hash = crypto
81
84
  .createHash('sha256')
82
85
  .update(url.hostname)
83
86
  .digest('base64url').toLowerCase();
84
87
  owner = `${hash}-${owner}`;
88
+ } else {
89
+ const gitUrl = new GitUrl(code.source.url);
90
+ owner = gitUrl.owner.toLowerCase();
91
+ repo = gitUrl.repo.toLowerCase();
85
92
  }
86
93
 
87
94
  if (owner !== code.owner) {
@@ -16,6 +16,14 @@ export type Users = User[];
16
16
 
17
17
  export interface HelixOrgConfig {
18
18
  version: 1;
19
+ /**
20
+ * the date and time this configuration was created.
21
+ */
22
+ created: string;
23
+ /**
24
+ * the date and time this configuration was modified last.
25
+ */
26
+ lastModified: string;
19
27
  /**
20
28
  * human readable title. has no influence on the configuration.
21
29
  */
@@ -27,6 +35,7 @@ export interface HelixOrgConfig {
27
35
  users?: Users;
28
36
  groups?: Groups;
29
37
  tokens?: Tokens;
38
+ access?: OrgAccessConfig;
30
39
  }
31
40
  export interface User {
32
41
  id: string;
@@ -61,3 +70,11 @@ export interface Tokens {
61
70
  created?: string;
62
71
  };
63
72
  }
73
+ export interface OrgAccessConfig {
74
+ admin?: {
75
+ /**
76
+ * the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.
77
+ */
78
+ apiKeyId?: string[];
79
+ };
80
+ }
@@ -22,6 +22,14 @@ export interface HelixProfileConfig {
22
22
  * description for clarity. has no influence on the configuration.
23
23
  */
24
24
  description?: string;
25
+ /**
26
+ * the date and time this configuration was created.
27
+ */
28
+ created: string;
29
+ /**
30
+ * the date and time this configuration was modified last.
31
+ */
32
+ lastModified: string;
25
33
  content?: ContentSource;
26
34
  code?: CodeSource;
27
35
  folders?: Folders;
@@ -34,6 +42,7 @@ export interface HelixProfileConfig {
34
42
  metadata?: Metadata;
35
43
  robots?: Robots;
36
44
  public?: Public;
45
+ events?: EventsConfig;
37
46
  }
38
47
  /**
39
48
  * Defines the content bus location and source.
@@ -49,6 +58,9 @@ export interface ContentSource {
49
58
  description?: string;
50
59
  contentBusId: string;
51
60
  source: GoogleContentSource | OnedriveContentSource | MarkupContentSource;
61
+ /**
62
+ * Overlay from a BYOM source. Previewing resources will try the overlay source first. Please note, that the overlay config is tied to the base content and not to the site config. I.e. it's not possible to have multiple sites with different overlays on the same base content.
63
+ */
52
64
  overlay?: MarkupContentSource;
53
65
  }
54
66
  export interface GoogleContentSource {
@@ -90,6 +102,10 @@ export interface CodeSource {
90
102
  source: {
91
103
  type: 'github';
92
104
  url: string;
105
+ raw_url?: string;
106
+ secretId?: string;
107
+ owner?: string;
108
+ repo?: string;
93
109
  };
94
110
  [k: string]: unknown;
95
111
  }
@@ -103,7 +119,7 @@ export interface Folders {
103
119
  export interface HelixHeadersConfig {
104
120
  /**
105
121
  * This interface was referenced by `HelixHeadersConfig`'s JSON-Schema definition
106
- * via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
122
+ * via the `patternProperty` "^[a-zA-Z0-9-/._*]+$".
107
123
  */
108
124
  [k: string]: KeyValuePair[];
109
125
  }
@@ -249,13 +265,13 @@ export interface Role {
249
265
  }
250
266
  export interface SiteAccessConfig {
251
267
  /**
252
- * IDs of the api keys (tokens) that are allowed.
268
+ * The email glob of the users or a group reference that are allowed access
253
269
  */
254
- apiKeyId?: string[];
270
+ allow?: string[];
255
271
  /**
256
- * the DNs of the client certificates that are allowed.
272
+ * IDs of the api keys (tokens) that are allowed.
257
273
  */
258
- clientCertDN?: string[];
274
+ apiKeyId?: string[];
259
275
  }
260
276
  export interface Tokens {
261
277
  /**
@@ -367,3 +383,8 @@ export interface Robots {
367
383
  export interface Public {
368
384
  [k: string]: unknown;
369
385
  }
386
+ export interface EventsConfig {
387
+ github: {
388
+ target: string;
389
+ };
390
+ }
@@ -26,6 +26,14 @@ export interface HelixSiteConfig {
26
26
  * description for clarity. has no influence on the configuration.
27
27
  */
28
28
  description?: string;
29
+ /**
30
+ * the date and time this configuration was created.
31
+ */
32
+ created: string;
33
+ /**
34
+ * the date and time this configuration was modified last.
35
+ */
36
+ lastModified: string;
29
37
  content: ContentSource;
30
38
  code: CodeSource;
31
39
  folders?: Folders;
@@ -38,6 +46,7 @@ export interface HelixSiteConfig {
38
46
  metadata?: Metadata;
39
47
  robots?: Robots;
40
48
  public?: Public;
49
+ events?: EventsConfig;
41
50
  extends?: {
42
51
  profile?: string;
43
52
  };
@@ -56,6 +65,9 @@ export interface ContentSource {
56
65
  description?: string;
57
66
  contentBusId: string;
58
67
  source: GoogleContentSource | OnedriveContentSource | MarkupContentSource;
68
+ /**
69
+ * Overlay from a BYOM source. Previewing resources will try the overlay source first. Please note, that the overlay config is tied to the base content and not to the site config. I.e. it's not possible to have multiple sites with different overlays on the same base content.
70
+ */
59
71
  overlay?: MarkupContentSource;
60
72
  }
61
73
  export interface GoogleContentSource {
@@ -97,6 +109,10 @@ export interface CodeSource {
97
109
  source: {
98
110
  type: 'github';
99
111
  url: string;
112
+ raw_url?: string;
113
+ secretId?: string;
114
+ owner?: string;
115
+ repo?: string;
100
116
  };
101
117
  [k: string]: unknown;
102
118
  }
@@ -110,7 +126,7 @@ export interface Folders {
110
126
  export interface HelixHeadersConfig {
111
127
  /**
112
128
  * This interface was referenced by `HelixHeadersConfig`'s JSON-Schema definition
113
- * via the `patternProperty` "^/[a-zA-Z0-9-/.]*\*{0,2}$".
129
+ * via the `patternProperty` "^[a-zA-Z0-9-/._*]+$".
114
130
  */
115
131
  [k: string]: KeyValuePair[];
116
132
  }
@@ -256,13 +272,13 @@ export interface Role {
256
272
  }
257
273
  export interface SiteAccessConfig {
258
274
  /**
259
- * IDs of the api keys (tokens) that are allowed.
275
+ * The email glob of the users or a group reference that are allowed access
260
276
  */
261
- apiKeyId?: string[];
277
+ allow?: string[];
262
278
  /**
263
- * the DNs of the client certificates that are allowed.
279
+ * IDs of the api keys (tokens) that are allowed.
264
280
  */
265
- clientCertDN?: string[];
281
+ apiKeyId?: string[];
266
282
  }
267
283
  export interface Tokens {
268
284
  /**
@@ -374,3 +390,8 @@ export interface Robots {
374
390
  export interface Public {
375
391
  [k: string]: unknown;
376
392
  }
393
+ export interface EventsConfig {
394
+ github: {
395
+ target: string;
396
+ };
397
+ }