Approvaltypeno test imports ittype Approval = { readonly by: string; readonly planHash: string };The approval to take an adopted asset over: the person, and the hash of the plan they approved.
The life of an asset: a move between states (a discovered asset is adopted, an adopted asset is released back or taken over with an approval; a managed asset is never moved, it is retired), and the move of one capability from one system to another, which is made only when the acceptance test of that capability on that asset has passed. A move down a state gives up the capabilities the lower state does not offer; a move up needs an owner for each new one.
import { moveState } from "./lifecycle.ts";
// moveState(asset, "managed", { converge: "archon", ... }) is a Result of the asset in its new stateApprovaltypeno test imports ittype Approval = { readonly by: string; readonly planHash: string };The approval to take an adopted asset over: the person, and the hash of the plan they approved.
moveStatefunctionfunction moveState(asset: Asset, to: "adopted" | "discovered" | "managed", owners?: Readonly<Partial<Record<"access" | "backup" | "converge" | "identity" | "observe" | "plan" | "provision" | "retire" | "update" | "verify", string>>>, approval?: Approval | undefined): Result<Asset, readonly string[]>The asset in another state: the owners it had are kept for what the new state still offers (what it does not offer is given up), and owners names the owners of what is new; refused where the move is not allowed or an owner is missing.
AcceptanceRecordtypetype AcceptanceRecord = { readonly asset: string; readonly capability: Capability; readonly system: string; readonly test: string; readonly passedAt: string };A test of a capability of an asset that passed, by the system that is to own it.
moveCapabilityfunctionfunction moveCapability(asset: Asset, capability: "access" | "backup" | "converge" | "identity" | "observe" | "plan" | "provision" | "retire" | "update" | "verify", to: string, acceptance: AcceptanceRecord | undefined): Result<Asset, readonly string[]>The asset with one capability owned by another system, or why not: it is made only with a passed acceptance test for this asset, this capability and the system that takes it.