@adea-ai/app-framework-release-tools 0.11.2 → 0.11.4
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/dist/app/value-guards.js +22 -0
- package/dist/cli.js +49 -48
- package/dist/desktop/string-policy.js +9 -0
- package/dist/index.js +40 -39
- package/dist/installer/hosted-runner.js +27 -0
- package/dist/installer/installer-ci-preflight.js +52 -0
- package/dist/installer/installer-ci-worker.js +90 -0
- package/dist/installer/installer-fetch-guard.js +53 -0
- package/dist/installer/installer-renderer-evidence.js +124 -0
- package/dist/installer/installer-worker-guard.js +73 -0
- package/dist/native/app-bundle.js +51 -0
- package/dist/release/release-qualification.js +103 -0
- package/dist/release-tools-source.json +1 -1
- package/dist/shared/bounded-body.js +96 -0
- package/dist/shared/discard-stream.js +7 -0
- package/dist/updates/feed/arch-package-policy.js +137 -0
- package/dist/updates/feed/release-config-contract.js +164 -0
- package/dist/updates/feed/release-feed.js +74 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isGitSha, isRecord, isSha256Hex } from "../../app/value-guards";
|
|
2
|
+
export const MAX_LEDGER_RELEASES = 500;
|
|
3
|
+
const MAX_RELEASE_ASSETS = 256, exactKeys = (value, keys) => Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key)), segment = /^[a-z0-9][a-z0-9-]{0,62}$/, tagPattern = /^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-dev\.[1-9]\d*)?$/, timestamp = (value) => typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/.test(value) && Number.isFinite(Date.parse(value)) && new Date(value).toISOString().replace(".000Z", "Z") === value.replace(".000Z", "Z");
|
|
4
|
+
export const isFeedTag = (value) => typeof value === "string" && value.length <= 65 && tagPattern.test(value), isFeedAssetName = (value) => typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/.test(value);
|
|
5
|
+
export function parseReleaseFeed(value) {
|
|
6
|
+
if (!isRecord(value) || !exactKeys(value, ["base", "app"]) || typeof value.base !== "string")
|
|
7
|
+
throw Error("Invalid release feed");
|
|
8
|
+
let url;
|
|
9
|
+
try {
|
|
10
|
+
url = new URL(value.base);
|
|
11
|
+
} catch {
|
|
12
|
+
throw Error("Invalid release feed");
|
|
13
|
+
}
|
|
14
|
+
const parts = url.pathname.split("/").slice(1, -1);
|
|
15
|
+
if (value.base.length > 200 || url.href !== value.base || url.protocol !== "https:" || url.username || url.password || url.port || url.search || url.hash || !url.pathname.endsWith("/") || !parts.every((part) => segment.test(part)) || typeof value.app !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(value.app))
|
|
16
|
+
throw Error("Invalid release feed");
|
|
17
|
+
return { base: value.base, app: value.app };
|
|
18
|
+
}
|
|
19
|
+
export const feedUrl = (feed) => `${feed.base}${feed.app}/`;
|
|
20
|
+
export function feedAssetKey(feed, tag, name) {
|
|
21
|
+
if (!isFeedTag(tag) || !isFeedAssetName(name))
|
|
22
|
+
throw Error("Invalid release asset");
|
|
23
|
+
return `${feed.app}/${tag}/${name}`;
|
|
24
|
+
}
|
|
25
|
+
export const feedReleaseKey = (feed, tag) => feedAssetKey(feed, tag, "release.json"), feedIndexKey = (feed) => `${feed.app}/index.json`, feedChannelKey = (feed, channel) => `${feed.app}/channels/${channel}.json`;
|
|
26
|
+
const channelOf = (tag) => tag.includes("-dev.") ? "dev" : "daily";
|
|
27
|
+
export function parseFeedRelease(value) {
|
|
28
|
+
if (!isRecord(value) || !exactKeys(value, Object.hasOwn(value, "missingPlatforms") ? ["tag", "channel", "publishedAt", "assets", "missingPlatforms"] : ["tag", "channel", "publishedAt", "assets"]) || !isFeedTag(value.tag) || value.channel !== "daily" && value.channel !== "stable" || channelOf(value.tag) === "dev" || !timestamp(value.publishedAt) || !Array.isArray(value.assets) || value.assets.length < 1 || value.assets.length > MAX_RELEASE_ASSETS)
|
|
29
|
+
throw Error("Invalid feed release");
|
|
30
|
+
const names = new Set, assets = value.assets.map((asset) => {
|
|
31
|
+
if (!isRecord(asset) || !exactKeys(asset, ["name", "size", "sha256"]) || !isFeedAssetName(asset.name) || asset.name === "release.json" || names.has(asset.name) || !Number.isSafeInteger(asset.size) || Number(asset.size) < 1 || typeof asset.sha256 !== "string" || !isSha256Hex(asset.sha256))
|
|
32
|
+
throw Error("Invalid feed release asset");
|
|
33
|
+
names.add(asset.name);
|
|
34
|
+
return { name: asset.name, size: Number(asset.size), sha256: asset.sha256 };
|
|
35
|
+
}), allowed = value.missingPlatforms;
|
|
36
|
+
if (allowed !== void 0 && (value.channel !== "stable" || !Array.isArray(allowed) || allowed.length < 1 || allowed.length > 8 || new Set(allowed).size !== allowed.length || !allowed.every((name) => typeof name === "string" && segment.test(name))))
|
|
37
|
+
throw Error("Invalid feed release");
|
|
38
|
+
return {
|
|
39
|
+
tag: value.tag,
|
|
40
|
+
channel: value.channel,
|
|
41
|
+
publishedAt: value.publishedAt,
|
|
42
|
+
assets,
|
|
43
|
+
...allowed ? { missingPlatforms: allowed } : {}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function parseReleaseLedger(value, app) {
|
|
47
|
+
if (!isRecord(value) || !exactKeys(value, ["schema", "app", "releases"]) || value.schema !== 1 || value.app !== app || !Array.isArray(value.releases) || value.releases.length > MAX_LEDGER_RELEASES)
|
|
48
|
+
throw Error("Invalid release ledger");
|
|
49
|
+
const tags = new Set;
|
|
50
|
+
let previous = 1 / 0;
|
|
51
|
+
const releases = value.releases.map((entry) => {
|
|
52
|
+
const stable = isRecord(entry) && entry.kind === "stable";
|
|
53
|
+
if (!isRecord(entry) || !exactKeys(entry, [
|
|
54
|
+
"tag",
|
|
55
|
+
"kind",
|
|
56
|
+
"version",
|
|
57
|
+
"sourceSha",
|
|
58
|
+
"publishedAt",
|
|
59
|
+
...stable ? ["promotedAt"] : []
|
|
60
|
+
]) || !isFeedTag(entry.tag) || tags.has(entry.tag) || entry.version !== entry.tag.slice(1) || !(stable ? channelOf(entry.tag) === "daily" : entry.kind === channelOf(entry.tag)) || typeof entry.sourceSha !== "string" || !isGitSha(entry.sourceSha) || !timestamp(entry.publishedAt) || Date.parse(entry.publishedAt) > previous || stable && (!timestamp(entry.promotedAt) || Date.parse(entry.promotedAt) < Date.parse(entry.publishedAt)))
|
|
61
|
+
throw Error("Invalid release ledger entry");
|
|
62
|
+
tags.add(entry.tag);
|
|
63
|
+
previous = Date.parse(entry.publishedAt);
|
|
64
|
+
return {
|
|
65
|
+
tag: entry.tag,
|
|
66
|
+
kind: entry.kind,
|
|
67
|
+
version: entry.version,
|
|
68
|
+
sourceSha: entry.sourceSha,
|
|
69
|
+
publishedAt: entry.publishedAt,
|
|
70
|
+
...stable ? { promotedAt: entry.promotedAt } : {}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return { schema: 1, app, releases };
|
|
74
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/app-framework-release-tools",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "Host-side release tooling for @adea-ai/app-framework apps, on Effect: the release CLIs and the framework package publish. Installing it never adds Effect to the framework itself.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "bun scripts/build.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aws-sdk/client-s3": "3.
|
|
31
|
+
"@aws-sdk/client-s3": "3.1178.0",
|
|
32
32
|
"effect": "4.1.5",
|
|
33
33
|
"tar": "^7.5.22"
|
|
34
34
|
}
|