IF Commons GitHub

governance/ids

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-estate-governance FR-001

The identities of Estate: an asset, a kind of asset and a system that owns a capability, each a branded text made only by its parser, and the closed lists of the states an asset has and the capabilities a state offers.

import { parseAssetId } from "./ids.ts";
parseAssetId("olympia").kind; // "ok"
parseAssetId("Olympia").kind; // "err"

Source: commons/estate/src/governance/ids.ts

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

AssetIdtypeno test imports it
type AssetId = Brand<string, "estate asset id">;

The identity of an asset: lower case words and digits joined by hyphens or dots, starting with a letter.

AssetKindtypeno test imports it
type AssetKind = Brand<string, "estate asset kind">;

The kind of an asset (server, workstation, network-device, cloud-account, service): lower case words joined by hyphens.

SystemIdtypeno test imports it
type SystemId = Brand<string, "estate system id">;

A system that owns a capability of an asset (archon): lower case words joined by hyphens.

parseAssetIdconst
const parseAssetId: (text: string) => Result<AssetId, string>

An asset id from text: lower case words and digits joined by hyphens or dots, starting with a letter, at most 100 characters.

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

parseAssetKindconst
const parseAssetKind: (text: string) => Result<AssetKind, string>

An asset kind from text: lower case words joined by hyphens, at most 60 characters.

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

parseSystemIdconst
const parseSystemId: (text: string) => Result<SystemId, string>

A system id from text: lower case words joined by hyphens, at most 60 characters.

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

ORIGINSconstno test imports it
const ORIGINS: readonly ["provisioned", "paired", "integration", "self", "scan"]

How an asset first reached the fleet: provisioned (the system installed it), paired (a short code paired it), integration (an integration or a cloud account brought it), self (the controller adopted itself) or scan (it was seen on the network and adopted from the list of what was found).

Origintypeno test imports it
type Origin = (typeof ORIGINS)[number];

Where an asset came from. Only a managed asset can be provisioned; the others reached the fleet as someone else's install.

import type { Origin } from "./ids.ts";
const origin: Origin = "paired";
Installtypeno test imports it
type Install = "provisioned" | "inherited";

Who installed the operating system of an asset: the system (provisioned) or someone else, before the system came (inherited). It is derived from the origin and never stored.

STATESconst
const STATES: readonly ["discovered", "adopted", "managed"]

The states of an asset: seen and not adopted, observed and checked but never changed, and installed and changed to match what is declared.

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

AssetStatetypeno test imports it
type AssetState = (typeof STATES)[number];

The state of an asset: discovered (seen, not adopted), adopted (someone else's install, observed and checked, never changed) or managed (changed to match what is declared: installed by the system, or taken over after being adopted).

import type { AssetState } from "./ids.ts";
const state: AssetState = "adopted";
CAPABILITIESconst
const CAPABILITIES: readonly ["provision", "identity", "plan", "converge", "verify", "observe", "update", "access", "backup", "retire"]

The capabilities an asset may offer.

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

Capabilitytypeno test imports it
type Capability = (typeof CAPABILITIES)[number];

One capability an asset may offer: what can be done with it, from observing it to retiring it.

import type { Capability } from "./ids.ts";
const capability: Capability = "converge";

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