IF Commons GitHub

supply-chain/downloads

Written to: 1 requirement: 0 proved, 0 partly, 0 failing, 1 with no test recorded. 0001-ontologies FR-001

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.

Source: commons/ontology/src/supply-chain/downloads.ts

0 of 12 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

PinIdtypeno test imports it
type PinId = Brand<string, "PinId">;

The name of a pinned program (bun, mise): one the ontology states.

PlatformNametypeno test imports it
type PlatformName = Brand<string, "PlatformName">;

The name of a platform (linux-x64, macos-arm64): one the ontology states.

Sha256Hextypeno test imports it
type Sha256Hex = Brand<string, "Sha256Hex">;

64 lower-case hexadecimal digits.

ArchiveFormattypeno test imports it
type 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 it
type 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 it
type 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 it
function parsePinId(text: string): Result<PinId, DownloadError>

The pin the ontology states under this name, or why there is none.

parsePlatformNamefunctionno test imports it
function parsePlatformName(text: string): Result<PlatformName, DownloadError>

The platform the ontology states under this name, or why there is none.

pinIdsfunctionno test imports it
function pinIds(): readonly PinId[]

Every pin the ontology states, by name.

platformNamesfunctionno test imports it
function platformNames(): readonly PlatformName[]

Every platform the ontology states, by name.

downloadOffunctionno test imports it
function 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 it
function describeDownloadError(e: DownloadError): string

The sentence a reason is told in.

Titles, headings, exports, tables, columns and requirements. Esc closes.