@adobe/helix-config-storage 1.10.0 → 1.12.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 +14 -0
- package/package.json +1 -1
- package/src/ValidationError.js +1 -1
- package/src/schemas/code.schema.json +8 -0
- package/src/utils.js +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.12.0](https://github.com/adobe/helix-config-storage/compare/v1.11.0...v1.12.0) (2024-12-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
8
|
+
# [1.11.0](https://github.com/adobe/helix-config-storage/compare/v1.10.0...v1.11.0) (2024-12-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* lowercase hased owner ([#70](https://github.com/adobe/helix-config-storage/issues/70)) ([c40f038](https://github.com/adobe/helix-config-storage/commit/c40f03802e185d103a1b7a2771fdda672214de02))
|
|
14
|
+
|
|
1
15
|
# [1.10.0](https://github.com/adobe/helix-config-storage/compare/v1.9.9...v1.10.0) (2024-12-10)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/ValidationError.js
CHANGED
|
@@ -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
|
|
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
|
|
77
|
-
let owner =
|
|
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
|
-
.digest('base64url');
|
|
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) {
|