IF Commons GitHub

logical/data

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-estate-query-relations FR-002, 0002-estate-query-relations FR-003, 0002-estate-query-relations FR-004

What an estate holds, in the shapes of the estate library, and the relations built from it. A relation is built only when a query names it. What the estate library gives (a snapshot of a fleet store, or what a tenant's files declare) is given here as it is: nothing is read, written or run.

import { tablesOf } from "./data.ts";
tablesOf({ assets: [], now: "2026-12-01T00:00:00Z" })["asset"]?.().rows; // []

Source: commons/estate-query/src/logical/data.ts

3 of 12 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.fromSnapshotfunctionno test imports it
function fromSnapshot(snapshot: SnapshotLike, now: string, assessment?: AssessmentLike | undefined): EstateData

The estate of a snapshot of a fleet store, at an instant, with what was assessed of it where that was done.

logical.tablesOffunctionno test imports it
function tablesOf(data: EstateData): Readonly<Record<string, () => Table>>

The relations of the data, built as a query names them.

logical.AssessmentLiketypeno test imports it
type AssessmentLike = { readonly truths: readonly Truth[]; readonly violations: readonly Violation[] };

What assessSnapshot of the estate library gives, as far as the relations use it.

logical.EstateDatatypeno test imports it
type EstateData = { readonly assets: readonly Asset[]; /** What is declared of each asset, by its identity. */ rea… (1708 characters)
type EstateData = {
  readonly assets: readonly Asset[];
  /** What is declared of each asset, by its identity. */
  readonly declared?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
  /** The latest observation of each asset (the one the relations show). */
  readonly observations?: readonly { readonly asset: string; readonly observation: Observation }[];
  /** The results of the policies in the latest observation of each asset. */
  readonly results?: readonly (PolicyOutcome & { readonly asset: string })[];
  /** The risks accepted of each asset, by its identity. */
  readonly acceptances?: Readonly<Record<string, readonly AcceptedRisk[]>>;
  /** The operational truth of each asset, where it was worked out. */
  readonly truths?: readonly Truth[];
  /** The invariants broken, where they were checked. */
  readonly violations?: readonly Violation[];
  /** The changes of the repository, newest first. */
  readonly changes?: readonly { readonly commit: string; readonly at: string; readonly author: string; readonly subject: string; readonly refs: string; readonly signed: boolean }[];
  /** The approvals kept. */
  readonly approvals?: readonly { readonly asset: string; readonly kind: string; readonly by: string; readonly planHash: string; readonly at: string }[];
  /** The links between assets, by identity, with their kinds. */
  readonly links?: readonly { readonly from: string; readonly to: string; readonly kind: string }[];
  /** The fleet that declares each asset, by its identity, where the data says. */
  readonly fleets?: Readonly<Record<string, string>>;
  /** The instant now, for the policies' acceptances (an ISO 8601 instant). */
  readonly now: string;
};

What an estate holds: the assets, and, where there are any, what is declared, observed, judged and accepted of them.

logical.SnapshotLiketypeno test imports it
type SnapshotLike = {
  readonly assets: readonly Asset[];
  readonly declared: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
  readonly observations: readonly { readonly asset: string; readonly observation: Observation }[];
  readonly results: readonly (PolicyOutcome & { readonly asset: string })[];
  readonly acceptances: Readonly<Record<string, readonly AcceptedRisk[]>>;
};

What of a snapshot of a fleet store is read (FleetSnapshot of the estate library's physical layer satisfies it by shape; it is described here so that nothing of AnyFS is imported).

logical.Tablestypeno test imports it
type Tables = Readonly<Record<string, () => Table>>;

The relations of an estate, each built when it is asked for.

fromSnapshotfunction
function fromSnapshot(snapshot: SnapshotLike, now: string, assessment?: AssessmentLike | undefined): EstateData

The estate of a snapshot of a fleet store, at an instant, with what was assessed of it where that was done.

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

tablesOffunction
function tablesOf(data: EstateData): Readonly<Record<string, () => Table>>

The relations of the data, built as a query names them.

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

AssessmentLiketypeno test imports it
type AssessmentLike = { readonly truths: readonly Truth[]; readonly violations: readonly Violation[] };

What assessSnapshot of the estate library gives, as far as the relations use it.

EstateDatatype
type EstateData = { readonly assets: readonly Asset[]; /** What is declared of each asset, by its identity. */ rea… (1708 characters)
type EstateData = {
  readonly assets: readonly Asset[];
  /** What is declared of each asset, by its identity. */
  readonly declared?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
  /** The latest observation of each asset (the one the relations show). */
  readonly observations?: readonly { readonly asset: string; readonly observation: Observation }[];
  /** The results of the policies in the latest observation of each asset. */
  readonly results?: readonly (PolicyOutcome & { readonly asset: string })[];
  /** The risks accepted of each asset, by its identity. */
  readonly acceptances?: Readonly<Record<string, readonly AcceptedRisk[]>>;
  /** The operational truth of each asset, where it was worked out. */
  readonly truths?: readonly Truth[];
  /** The invariants broken, where they were checked. */
  readonly violations?: readonly Violation[];
  /** The changes of the repository, newest first. */
  readonly changes?: readonly { readonly commit: string; readonly at: string; readonly author: string; readonly subject: string; readonly refs: string; readonly signed: boolean }[];
  /** The approvals kept. */
  readonly approvals?: readonly { readonly asset: string; readonly kind: string; readonly by: string; readonly planHash: string; readonly at: string }[];
  /** The links between assets, by identity, with their kinds. */
  readonly links?: readonly { readonly from: string; readonly to: string; readonly kind: string }[];
  /** The fleet that declares each asset, by its identity, where the data says. */
  readonly fleets?: Readonly<Record<string, string>>;
  /** The instant now, for the policies' acceptances (an ISO 8601 instant). */
  readonly now: string;
};

What an estate holds: the assets, and, where there are any, what is declared, observed, judged and accepted of them.

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

SnapshotLiketypeno test imports it
type SnapshotLike = {
  readonly assets: readonly Asset[];
  readonly declared: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
  readonly observations: readonly { readonly asset: string; readonly observation: Observation }[];
  readonly results: readonly (PolicyOutcome & { readonly asset: string })[];
  readonly acceptances: Readonly<Record<string, readonly AcceptedRisk[]>>;
};

What of a snapshot of a fleet store is read (FleetSnapshot of the estate library's physical layer satisfies it by shape; it is described here so that nothing of AnyFS is imported).

Tablestypeno test imports it
type Tables = Readonly<Record<string, () => Table>>;

The relations of an estate, each built when it is asked for.

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