IF Commons GitHub

logical/visibility

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0010-audience-tiers FR-003, 0010-audience-tiers FR-004, 0010-audience-tiers FR-005

What a caller of a tier may see of a program (commons headless 0010-audience-tiers): the tree with the verbs of a higher tier left out, so that every surface draws from the same visible tree (the help, the completion script, the man page, the list of tools of a tool server, the routes of a REST interface), and the typed refusal of a verb that is there but not for this caller. Pure: it asks tierGate of governance and nothing else.

A branch with no visible verb below it is itself left out, so that a word that would lead to nothing is not offered. A hidden verb is absent from what is drawn and refused with a typed reason where it is invoked (hiddenVerb); a word that is no verb of the program at all is not that refusal, it is unknown.

import { programOf, visibleProgram } from "./mod.ts";
import { OPERATOR } from "@intellectual-frontiers/headless/governance";
visibleProgram(programOf({ name: "tool", summary: "T.", version: "1", children: [] }), OPERATOR).children; // []

Source: commons/headless/src/logical/visibility.ts

2 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.

logical.visibleNodesfunctionno test imports it
function visibleNodes(program: Pick<Program, "tiers">, nodes: readonly Node[], held: TierName): readonly Node[]

The nodes a caller who holds held may see: a command whose tier the gate lets through, and a branch that keeps at least one such command below it.

logical.visibleProgramfunctionno test imports it
function visibleProgram(program: Program, held: TierName): Program

The program as a caller who holds held sees it: the same program with only the visible tree, so that one help, one completion and one man page are drawn from it.

logical.HiddenVerbtypeno test imports it
type HiddenVerb = { readonly id: string; readonly decision: Extract<TierDecision, { kind: "hidden" }> };

The refusal of a verb that exists and is not for the caller: the words, and the decision of the gate.

logical.hiddenVerbfunctionno test imports it
function hiddenVerb(program: Program, words: readonly string[], held: TierName): HiddenVerb | undefined

The command at the words, if there is one that is hidden from a caller who holds held; undefined where there is none (the words are unknown, or the command is visible).

visibleNodesfunctionno test imports it
function visibleNodes(program: Pick<Program, "tiers">, nodes: readonly Node[], held: TierName): readonly Node[]

The nodes a caller who holds held may see: a command whose tier the gate lets through, and a branch that keeps at least one such command below it.

visibleProgramfunction
function visibleProgram(program: Program, held: TierName): Program

The program as a caller who holds held sees it: the same program with only the visible tree, so that one help, one completion and one man page are drawn from it.

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

HiddenVerbtypeno test imports it
type HiddenVerb = { readonly id: string; readonly decision: Extract<TierDecision, { kind: "hidden" }> };

The refusal of a verb that exists and is not for the caller: the words, and the decision of the gate.

hiddenVerbfunction
function hiddenVerb(program: Program, words: readonly string[], held: TierName): HiddenVerb | undefined

The command at the words, if there is one that is hidden from a caller who holds held; undefined where there is none (the words are unknown, or the command is visible).

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

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