Prometheus Entity Management API
    Preparing search index...

    The full per-entity transport contract.

    One transport per entity type, registered at app boot. The hooks (useEntities, useEntityQuery) look it up via getEntityTransport(type).

    Required: identify, authoritative, list. Optional: get (for single-row fetches), subscribe (for realtime), staleTime (hint for SWR).

    interface EntityTransport<T extends object> {
        authoritative: boolean;
        get?: (id: string, signal?: AbortSignal) => Promise<T | null>;
        identify: (row: T) => string;
        list: (q: ListQuery) => Promise<ListResult<T>>;
        staleTime?: number;
        subscribe?: (onChange: (ev: ChangeEvent<T>) => void) => () => void;
    }

    Type Parameters

    • T extends object
    Index
    authoritative: boolean

    true when the local copy is considered authoritative (e.g. PGlite

    • Electric Tier-A sync) — consumers can render from cache without a remote round-trip on every mount.

    false when the remote is authoritative (Tier-B REST hybrid) — the cache is a hint, not the truth.

    get?: (id: string, signal?: AbortSignal) => Promise<T | null>

    Fetch a single row by id. Optional.

    identify: (row: T) => string

    Derive the stable string id of a row. Used by the engine to write into the entity graph under the right id key.

    list: (q: ListQuery) => Promise<ListResult<T>>

    Fetch a list. The signal in q.signal MUST be honoured.

    staleTime?: number

    Stale-time hint in ms. The engine SWR logic refetches when Date.now() - lastFetched > staleTime. Omit to inherit the engine default (30s).

    subscribe?: (onChange: (ev: ChangeEvent<T>) => void) => () => void

    Subscribe to realtime change events for this entity type. Optional.

    Called by useEntities / useEntityQuery exactly once per subscriber-bearing key. The returned function MUST tear down all underlying resources (sockets, channels, intervals).