@frockbot/kernel-composition 0.3.8 → 0.3.10
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/package.json +2 -2
- package/src/generation.ts +14 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frockbot/kernel-composition",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"cordis": "4.0.0-rc.8",
|
|
22
22
|
"semver": "7.8.5",
|
|
23
|
-
"@frockbot/kernel-contracts": "0.3.
|
|
23
|
+
"@frockbot/kernel-contracts": "0.3.10"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "1.4.0",
|
package/src/generation.ts
CHANGED
|
@@ -13,7 +13,11 @@ export type PackageProvenanceV1 =
|
|
|
13
13
|
version: string;
|
|
14
14
|
catalogId: string;
|
|
15
15
|
catalogGeneration: string;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Absent for a first-party Catalog entry: it names reviewed compiled-in
|
|
18
|
+
* code, publishes no bundle, and so has no artifact hash to pin.
|
|
19
|
+
*/
|
|
20
|
+
contentHash?: string;
|
|
17
21
|
}
|
|
18
22
|
| {
|
|
19
23
|
kind: "user";
|
|
@@ -297,14 +301,16 @@ function decodePackageProvenanceV1(
|
|
|
297
301
|
} else if (kind === "catalog") {
|
|
298
302
|
exactKeys(
|
|
299
303
|
value,
|
|
300
|
-
[...common, "catalogId", "catalogGeneration"
|
|
301
|
-
[],
|
|
304
|
+
[...common, "catalogId", "catalogGeneration"],
|
|
305
|
+
["contentHash"],
|
|
302
306
|
label,
|
|
303
307
|
);
|
|
304
308
|
identity();
|
|
305
309
|
boundedString(value.catalogId, `${label}.catalogId`, 64);
|
|
306
310
|
boundedString(value.catalogGeneration, `${label}.catalogGeneration`, 64);
|
|
307
|
-
|
|
311
|
+
if (value.contentHash !== undefined) {
|
|
312
|
+
hashString(value.contentHash, `${label}.contentHash`);
|
|
313
|
+
}
|
|
308
314
|
} else if (kind === "user") {
|
|
309
315
|
exactKeys(value, [...common, "userId", "authoredAt"], [], label);
|
|
310
316
|
identity();
|
|
@@ -368,9 +374,12 @@ function decodeCompositionMemberV1(
|
|
|
368
374
|
value.artifact === undefined
|
|
369
375
|
? undefined
|
|
370
376
|
: decodeArtifactRefV1(value.artifact, `${label}.artifact`);
|
|
377
|
+
// A bundle-backed Catalog member must name exactly the artifact it pins; a
|
|
378
|
+
// first-party entry pins no bundle and mounts in the kernel isolate, so it
|
|
379
|
+
// carries neither hash nor artifact — the two must still agree.
|
|
371
380
|
if (
|
|
372
381
|
provenance.kind === "catalog" &&
|
|
373
|
-
|
|
382
|
+
artifact?.contentHash !== provenance.contentHash
|
|
374
383
|
) {
|
|
375
384
|
throw new Error(
|
|
376
385
|
`${label}.catalog provenance must match its Bot-isolate artifact`,
|