governance.Entrytypeno test imports ittype Entry = { readonly id: string };What every entry of a registry has.
The registry of typed ports (0001-grc-layers FR-009): the one shape every extension point of GRC takes. An entry has a stable id (lower-case words joined by - or .), a second entry of one id is refused as an error value, and a registry says nothing of what its entries are: the port that owns it does.
import { createRegistry } from "./registry.ts";
const r = createRegistry<{ readonly id: string }>("runner");
r.register({ id: "sql" }); // { kind: "ok", ... }
r.register({ id: "sql" }); // { kind: "err", error: { kind: "duplicate", ... } }governance.Entrytypeno test imports ittype Entry = { readonly id: string };What every entry of a registry has.
governance.RegistryProblemtypeno test imports ittype RegistryProblem =
| { readonly kind: "unstable-id"; readonly registry: string; readonly id: string }
| { readonly kind: "duplicate"; readonly registry: string; readonly id: string };Why an entry was refused.
governance.STABLE_IDconstno test imports itconst STABLE_ID: RegExpA stable id: lower-case words (letters and digits, beginning with a letter) joined by - or ..
governance.Registrytypeno test imports ittype Registry<T extends Entry> = {
readonly label: string;
register(entry: T): Result<T, RegistryProblem>;
get(id: string): T | undefined;
has(id: string): boolean;
/** The entries in the order of their ids. */
list(): readonly T[];
};A registry of the entries of one port.
governance.createRegistryfunctionno test imports itfunction createRegistry<T extends Entry>(label: string): Registry<T>A registry of its own, empty; label names the port in a problem.
governance.describeRegistryProblemfunctionno test imports itfunction describeRegistryProblem(p: RegistryProblem): stringOne sentence for a problem.
Entrytypeno test imports ittype Entry = { readonly id: string };What every entry of a registry has.
RegistryProblemtypeno test imports ittype RegistryProblem =
| { readonly kind: "unstable-id"; readonly registry: string; readonly id: string }
| { readonly kind: "duplicate"; readonly registry: string; readonly id: string };Why an entry was refused.
STABLE_IDconstno test imports itconst STABLE_ID: RegExpA stable id: lower-case words (letters and digits, beginning with a letter) joined by - or ..
Registrytypeno test imports ittype Registry<T extends Entry> = {
readonly label: string;
register(entry: T): Result<T, RegistryProblem>;
get(id: string): T | undefined;
has(id: string): boolean;
/** The entries in the order of their ids. */
list(): readonly T[];
};A registry of the entries of one port.
createRegistryfunctionfunction createRegistry<T extends Entry>(label: string): Registry<T>A registry of its own, empty; label names the port in a problem.
describeRegistryProblemfunctionno test imports itfunction describeRegistryProblem(p: RegistryProblem): stringOne sentence for a problem.