PinIdtypeno test imports ittype PinId = Brand<string, "PinId">;The name of a pinned program (bun, mise): one the ontology states.
What a download of a pinned program needs, read from the pins as typed values (commons 0002-packaging FR-017, FR-020): for a pin and a platform, the version, the address of the publisher's artifact, its SHA-256, its format and the folder of its programs, or the reason the platform has no address. A reader that holds no version or hash of its own (commons/toolchain) asks this module and nothing else.
A pin and a platform are named by branded values made only by parsePinId and parsePlatformName, which accept the names the ontology states and no others. The address of a pin is stated once, with {version} where the pin's version stands; expandAddress of the vocabulary is the one place that puts it in.
PinIdtypeno test imports ittype PinId = Brand<string, "PinId">;The name of a pinned program (bun, mise): one the ontology states.
PlatformNametypeno test imports ittype PlatformName = Brand<string, "PlatformName">;The name of a platform (linux-x64, macos-arm64): one the ontology states.
Sha256Hextypeno test imports ittype Sha256Hex = Brand<string, "Sha256Hex">;64 lower-case hexadecimal digits.
ArchiveFormattypeno test imports ittype ArchiveFormat = (typeof ARCHIVE_FORMATS)[number];The format of what an address gives: a zip archive, a tar archive (plain or compressed) or the file itself.
Downloadtypeno test imports ittype Download = {
readonly version: string;
/** The https address of the publisher's artifact, the version already in it. */
readonly downloadUrl: string;
readonly sha256: Sha256Hex;
readonly archiveFormat: ArchiveFormat;
/** The folder of the programs inside the unpacked artifact, relative to its root; empty for the root. */
readonly binPath: string;
};What one pin needs on one platform to be downloaded.
DownloadErrortypeno test imports ittype DownloadError =
| { readonly kind: "unknown-pin"; readonly pin: string }
| { readonly kind: "unknown-platform";… (441 characters)type DownloadError =
| { readonly kind: "unknown-pin"; readonly pin: string }
| { readonly kind: "unknown-platform"; readonly platform: string }
| { readonly kind: "not-pinned"; readonly pin: PinId; readonly platform: PlatformName }
| { readonly kind: "unpinned"; readonly pin: PinId; readonly platform: PlatformName; readonly reason: string }
| { readonly kind: "malformed"; readonly pin: PinId; readonly platform: PlatformName };Why a download is not given.
parsePinIdfunctionno test imports itfunction parsePinId(text: string): Result<PinId, DownloadError>The pin the ontology states under this name, or why there is none.
parsePlatformNamefunctionno test imports itfunction parsePlatformName(text: string): Result<PlatformName, DownloadError>The platform the ontology states under this name, or why there is none.
pinIdsfunctionno test imports itfunction pinIds(): readonly PinId[]Every pin the ontology states, by name.
platformNamesfunctionno test imports itfunction platformNames(): readonly PlatformName[]Every platform the ontology states, by name.
downloadOffunctionno test imports itfunction downloadOf(pin: PinId, platform: PlatformName): Result<Download, DownloadError>The download of a pin on a platform: its version, address, SHA-256, format and folder, or why the platform has none.
describeDownloadErrorfunctionno test imports itfunction describeDownloadError(e: DownloadError): stringThe sentence a reason is told in.