IF Commons GitHub

family

The families of the libraries of commons and the names held for them (commons 0027-commons-libraries FR-023, FR-024; commons 0033-kanon FR-021, FR-024): what the family field of a manifest says, the reservations (names no library may take unless it is of the family they are held for), and the findings of the two sides of a family held together, the host's table and each member's manifest.

Pure: it takes the libraries as data and returns one sentence for each finding. A library names its host and its role (host, dialect or plugin); the host's kanon table says what its dialects and plugins are and how their packages are named (@intellectual-frontiers/kanon: family, instances, plugins), so the name of a member is checked against the host's rule and never against a rule written here. A reservation is data: an exact name or a prefix, and the host that may hold it. It reserves a name without a folder, so that no empty library is created to hold one.

Spec: 0001-libraries FR-016

Source: commons/libraries/src/family.ts

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

ROLESconstno test imports it
const ROLES: readonly ["host", "dialect", "plugin"]

The roles a library has in a family: a closed union.

Roletypeno test imports it
type Role = (typeof ROLES)[number];

The role of a library in a family.

LibraryFamilytypeno test imports it
type LibraryFamily = { readonly host: string; readonly role: Role };

What a manifest says of its family: the host's library name and its own role.

Matchtypeno test imports it
type Match = { readonly kind: "exact"; readonly name: string } | { readonly kind: "prefix"; readonly prefix: string };

How a reservation holds names: one exact name, or every name that begins with a prefix.

Reservationtypeno test imports it
type Reservation = { readonly match: Match; readonly host: string; readonly reason: string };

A held name: what it matches, the host whose family may use it and why it is held.

RESERVEDconst
const RESERVED: readonly Reservation[]

The names held, as data: the check reads them and no folder holds them.

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

decodeFamilyfunction
function decodeFamily(input: { readonly host: string; readonly role: "dialect" | "host" | "plugin"; }): Result<LibraryFamily, string>

The family field of a manifest, from what it says: the host's name and the role, or why it is not one.

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

Entrytype
type Entry = { readonly name: string; readonly family?: LibraryFamily; readonly kanon?: Table };

What the check reads of a library: its name, its family and its table.

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

reservationFindingsfunction
function reservationFindings(libraries: readonly Entry[], reserved?: readonly Reservation[]): readonly string[]

The findings of the names held: a library whose name a reservation holds and that is not of the family the name is held for.

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

familyFindingsfunction
function familyFindings(libraries: readonly Entry[]): readonly string[]

The findings of a family held together: each member's name against the host's rule, each declared member registered, and each registered member declared (0033-kanon FR-021).

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

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