Rindle

API index and search · Build metadata

Supporting declarations

packages/optimistic/src/system-streams.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

SCOPE_SESSIONS_TABLE

/** §4.1 occupancy: `(scope, client_id, expires_at)`, PK `(scope, client_id)`. The row delta IS
 *  the upgrade doorbell (Slice I-iv reacts; I-iii only folds the map). */
export declare const SCOPE_SESSIONS_TABLE = "_rindle_scope_sessions";

ROOM_WATERMARK_TABLE

/** §4.2 downgrade fence: `(doc, flush_seq)`, PK `doc` — monotone, co-committed per room flush. */
export declare const ROOM_WATERMARK_TABLE = "_rindle_room_watermark";

ROOM_CLIENT_MUTATIONS_TABLE

/** §7.1 domain-scoped room ledger: `(doc, client_id, last_mutation_id)`, PK `(doc, client_id)` —
 *  the FIRST daemon-carried room-lmid path (the named invariant's enforcement point). */
export declare const ROOM_CLIENT_MUTATIONS_TABLE = "_rindle_room_client_mutations";

ROOM_MUTATION_OUTCOMES_TABLE

/** §3.3 durable outcome rows: `(doc, client_id, mid, kind, reason, name, args)`, PK
 *  `(doc, client_id, mid)` — the H-iv-b `mutationOutcome` frame's durable twin (Slice I-ii
 *  co-commits one per NON-applied mid; an absent row under a covering lmid means `applied`). */
export declare const ROOM_MUTATION_OUTCOMES_TABLE = "_rindle_room_mutation_outcomes";

SCOPE_SESSIONS_SCHEMA

/** The four wire schemas, mirroring the daemon DDL column-for-column (order and PK by name are
 *  what `validateAgainstClientSchema` checks at each system hello — CRIT#4). Appended to the
 *  backend's expected-schema base unconditionally: extra CLIENT-side entries are inert (validation
 *  only checks tables a server actually advertises), so a client that never receives a lifecycle
 *  block behaves byte-identically. */
export declare const SCOPE_SESSIONS_SCHEMA: NormalizedTableSchema;

ROOM_WATERMARK_SCHEMA

export declare const ROOM_WATERMARK_SCHEMA: NormalizedTableSchema;

ROOM_CLIENT_MUTATIONS_SCHEMA

export declare const ROOM_CLIENT_MUTATIONS_SCHEMA: NormalizedTableSchema;

ROOM_MUTATION_OUTCOMES_SCHEMA

export declare const ROOM_MUTATION_OUTCOMES_SCHEMA: NormalizedTableSchema;

LIFECYCLE_TABLE_SCHEMAS

export declare const LIFECYCLE_TABLE_SCHEMAS: readonly NormalizedTableSchema[];

SystemStreamTable

/** The tables a system retain may serve — the fold category discriminant. */
export type SystemStreamTable = typeof SCOPE_SESSIONS_TABLE | typeof ROOM_WATERMARK_TABLE | typeof ROOM_CLIENT_MUTATIONS_TABLE | typeof ROOM_MUTATION_OUTCOMES_TABLE;

SystemStreamSpec

/** What a system retain declares about itself (`OptimisticBackend.retainSystemQuery`): which
 *  system table its frames carry, and the scope/doc its minted predicate was scoped to. The fold
 *  filters rows against this spec (AND against the client's own `clientID`) as DEFENSE IN DEPTH —
 *  the server predicate is the tight path, but a server that couldn't scope (no `clientId` on the
 *  lease request) legitimately delivers other clients' rows, and a confused server must never
 *  invent verdicts for us. */
export interface SystemStreamSpec {
    table: SystemStreamTable;
    /** The §4.1 occupancy scope the doorbell was minted for (`_rindle_scope_sessions` only). */
    scope?: string;
    /** The room doc the fence entry was minted for (the three room tables). */
    doc?: string;
}

LIFECYCLE_QUERY_NAME

/** The reserved name system retains subscribe under (never an app query — see the module doc).
 *  Its `args` carry the {@link SystemStreamSpec} identity fields PLUS the parent labeled query's
 *  `(name, args)`, so a RE-resolution (reconnect / gate overflow) can re-lease the parent and pick
 *  the matching lifecycle entry — renewal-as-reauthorization, the room-token precedent. */
export declare const LIFECYCLE_QUERY_NAME = "_rindle/lifecycle";

roomDomainKey

/** The domain/gate key a room doc's daemon-carried confirms fold into — the SAME key the lease
 *  wire mints for the room source (`api-server: sourceKey = "room:" + doc`), so a daemon-carried
 *  lmid and a live room socket's lmid stream land on ONE watermark entry. */
export declare function roomDomainKey(doc: string): string;

OutcomeRow

/** One outcome row, decoded (positional per {@link ROOM_MUTATION_OUTCOMES_SCHEMA}). */
export interface OutcomeRow {
    doc: string;
    clientId: string;
    mid: number;
    kind: "deopt" | "rejected";
    reason?: string;
    name?: string;
    args?: unknown;
}

decodeOutcomeRow

/** Decode one `_rindle_room_mutation_outcomes` wire row; `undefined` for a malformed one (fail
 *  CLOSED into "not a verdict" — a garbled row must not invent a deopt/rejection; the absent-row
 *  default of the covering lmid then treats the mid as applied, which is I-ii's sound default). */
export declare function decodeOutcomeRow(row: readonly WireValue[]): OutcomeRow | undefined;