@adobe/helix-config-storage 1.9.9 → 1.10.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,10 @@
1
+ # [1.10.0](https://github.com/adobe/helix-config-storage/compare/v1.9.9...v1.10.0) (2024-12-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * byo-git support ([#69](https://github.com/adobe/helix-config-storage/issues/69)) ([d9b5c98](https://github.com/adobe/helix-config-storage/commit/d9b5c98721b441c695a7780cec12cd879f6ab65a))
7
+
1
8
  ## [1.9.9](https://github.com/adobe/helix-config-storage/compare/v1.9.8...v1.9.9) (2024-12-07)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config-storage",
3
- "version": "1.9.9",
3
+ "version": "1.10.0",
4
4
  "description": "Helix Config Storage",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -378,11 +378,7 @@ export class ConfigStore {
378
378
  throw new StatusCodeError(404, 'config not found.');
379
379
  }
380
380
  }
381
- if (relPath === 'code') {
382
- updateCodeSource(ctx, data);
383
- } else if (relPath === 'content') {
384
- updateContentSource(ctx, data);
385
- } else if (frag.type === 'token') {
381
+ if (frag.type === 'token') {
386
382
  // don't allow to update individual token
387
383
  throw new StatusCodeError(400, 'invalid object path.');
388
384
  } else if (frag.type === 'tokens') {
@@ -442,7 +438,9 @@ export class ConfigStore {
442
438
  }
443
439
  }
444
440
  config = deepPut(old, relPath, data);
445
- } else if (this.type !== 'org') {
441
+ }
442
+
443
+ if (this.type !== 'org') {
446
444
  updateContentSource(ctx, config.content);
447
445
  updateCodeSource(ctx, config.code);
448
446
  }
@@ -11,11 +11,11 @@
11
11
  "owner": {
12
12
  "$comment": "Note, that owner/repo are no longer part of the hostname and can therefor have more allowed characters than in helix4",
13
13
  "type": "string",
14
- "pattern": "[a-zA-Z0-9_-]+"
14
+ "pattern": "^[a-zA-Z0-9_-]+$"
15
15
  },
16
16
  "repo": {
17
17
  "type": "string",
18
- "pattern": "[a-zA-Z0-9_-]+"
18
+ "pattern": "^[a-zA-Z0-9_-]+$"
19
19
  },
20
20
  "source": {
21
21
  "type": "object",
@@ -26,6 +26,14 @@
26
26
  "url": {
27
27
  "type": "string",
28
28
  "format": "uri"
29
+ },
30
+ "raw_url": {
31
+ "type": "string",
32
+ "format": "uri"
33
+ },
34
+ "secretId": {
35
+ "type": "string",
36
+ "pattern": "^[a-zA-Z0-9-_=]+$"
29
37
  }
30
38
  },
31
39
  "required": [
package/src/utils.js CHANGED
@@ -74,8 +74,16 @@ 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
- const owner = url.owner.toLowerCase();
77
+ let owner = url.owner.toLowerCase();
78
78
  const repo = url.repo.toLowerCase();
79
+ if (url.hostname !== 'github.com' && url.hostname !== 'www.github.com') {
80
+ const hash = crypto
81
+ .createHash('sha256')
82
+ .update(url.hostname)
83
+ .digest('base64url');
84
+ owner = `${hash}-${owner}`;
85
+ }
86
+
79
87
  if (owner !== code.owner) {
80
88
  code.owner = owner;
81
89
  modified = true;