IF Commons GitHub

modules/registry

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

Finding a module (commons 0001-ergonex FR-003, FR-004, FR-011): the typed built-in modules first, then the modules the workspace registers in <home>/.ergonex/modules.auto.json, then the executables named ergonex-* on the PATH, as Git finds git-foo for git foo. The first found runs; a module of a later source that it hides is an informational finding.

Pure: the three lists are read by the host layer and handed over; this module orders them, picks the first of each name and names what is hidden. A registered module may carry the SHA-256 of its program, which ergonex checks before running it (the check is programMatches, the read of the program is the host's).

Source: commons/ergonex/src/modules/registry.ts

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

Candidatestype
type Candidates = {
  readonly [S in ModuleSource as Uncapitalize<S>]: readonly Found[];
};

The modules each source holds.

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

decodeRegisteredfunction
function decodeRegistered(text: string): Result<readonly RegisteredModule[], string>

The modules a modules.auto.json registers, or why it cannot be read (a name that is not a module name, a hash that is not a SHA-256, the same name twice).

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

findModulefunction
function findModule(c: Candidates, name: string): Found | undefined

The module a name finds, or undefined.

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

Foundtype
type Found = {
  readonly name: string;
  readonly source: ModuleSource;
  readonly summary: string;
  readonly where: string;
  readonly sha256?: Sha256;
};

A module found: its name, where it was found, what it says it does and where its program is (built-in for a typed module).

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

hiddenFindingsfunction
function hiddenFindings(r: Resolved, today: string): readonly Finding[]

What a hidden module is told as: an informational finding naming both (0001-ergonex FR-004).

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

resolveAllfunction
function resolveAll(c: Candidates): Resolved

The first module of each name in the order of the sources, in the order of the names, and every later one it hides.

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

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