AssetIdtypeno test imports ittype 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.
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"AssetIdtypeno test imports ittype 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 ittype 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 ittype SystemId = Brand<string, "estate system id">;A system that owns a capability of an asset (archon): lower case words joined by hyphens.
parseAssetIdconstconst 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.
parseAssetKindconstconst parseAssetKind: (text: string) => Result<AssetKind, string>An asset kind from text: lower case words joined by hyphens, at most 60 characters.
parseSystemIdconstconst parseSystemId: (text: string) => Result<SystemId, string>A system id from text: lower case words joined by hyphens, at most 60 characters.
ORIGINSconstno test imports itconst 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 ittype 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 ittype 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.
STATESconstconst 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.
AssetStatetypeno test imports ittype 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";CAPABILITIESconstconst CAPABILITIES: readonly ["provision", "identity", "plan", "converge", "verify", "observe", "update", "access", "backup", "retire"]The capabilities an asset may offer.
Capabilitytypeno test imports ittype 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";