IF Commons GitHub

logical/resolve

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-toolchain-logical FR-003, 0003-toolchain-logical FR-004, 0003-toolchain-logical FR-007

The resolution of tools: each tool wanted, and each tool those need, to the first dialect of the fleet's preference that can carry it out here: it has a binding for the tool on the platform (the download a pin of the ontology gives, or the packages of the dialect's manager), reaches the platform and the scope, pins at least as exactly as the tool and the fleet's control ask for, meets the control, and does not build from source unless the fleet has approved source builds. A tool that no dialect can carry out is refused with every dialect and the reason it was not chosen. The version and the checksums of a pin are never in the catalog: a PinSource gives them, and the adapter over the packaging ontology is one.

import { resolveTools } from "./resolve.ts";
// resolveTools(catalog, [name], dialects, pins, { platform: "linux-x64", preference, integrity: "rolling", systemCopy: "minimum" })

Source: commons/toolchain/src/logical/resolve.ts

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

Contexttype
type Context = { readonly platform: Platform; /** The dialects of the fleet, most preferred first. */ readonly pre… (661 characters)
type Context = {
  readonly platform: Platform;
  /** The dialects of the fleet, most preferred first. */
  readonly preference: readonly DialectId[];
  /** The control of the assurance: how strictly tools are pinned. */
  readonly integrity: Controls["toolIntegrity"];
  /** Whether a copy found on the path may be taken at the least version a tool states. */
  readonly systemCopy: "minimum" | "never";
  /** Whether the fleet has approved a dialect that can build from source (in Git, as a person approves anything); `refuse` where not stated, so that what is installed is only what a publisher released. */
  readonly sourceBuild?: "refuse" | "approved";
};

What a resolution is made for.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

PinSourcetype
type PinSource = { readonly lookup: (pin: PinId, platform: Platform) => Result<Download, string> };

Where the downloads of pins come from: the version, the address, the SHA-256, the format and the folder of a pin on a platform, or the reason it has none.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Sourcetypeno test imports it
type Source =
  | { readonly kind: "download"; readonly pin: PinId; readonly download: Download }
  | { readonly kind: "package"; readonly manager: ManagerId; readonly packages: readonly string[] };

Where a tool comes from, by the dialect chosen.

ResolvedTooltypeno test imports it
type ResolvedTool = { readonly tool: Tool; readonly dialect: DialectId; readonly version: string | undefined; readonly source: Source };

A tool and the dialect chosen for it, with the version it is carried out at (none where it is a package of no named version).

Resolutiontypeno test imports it
type Resolution = { readonly platform: Platform; readonly entries: readonly ResolvedTool[] };

The tools resolved for a platform, in the order of needs.

NotChosentypeno test imports it
type NotChosen = { readonly dialect: DialectId; readonly reason: string };

Why a tool was not carried out by a dialect.

ResolveProblemtypeno test imports it
type ResolveProblem =
  | { readonly kind: "unknown-tool"; readonly tool: string }
  | { readonly kind: "unexpressed"; readonly tool: ToolName; readonly reasons: readonly NotChosen[] };

Why a resolution could not be made.

resolveToolsfunction
function resolveTools(catalog: Catalog, wanted: readonly string[], dialects: readonly ToolDialect[], pins: PinSource, ctx: Context): Result<Resolution, readonly ResolveProblem[]>

The tools wanted and the tools they need, each with the dialect and source chosen for it, or every tool that cannot be resolved and why.

Imported by 13 tests of the run (13 passed, 0 failed): the library's results

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