import type { DeepPartial } from "@rotorsoft/act-patch"; /** * Base constraint for state objects managed by the broadcast system. * Apps extend this with their own domain state shape. */ export type BroadcastState = Record & { /** Event store stream version — set by the broadcast layer from snap.event.version */ _v: number; }; /** * SSE message: version-keyed domain patches. * Keys are stringified version numbers, values are domain patches (deep partials). * Multi-event commits produce multiple version-keyed entries. * * The optional `_overlay` marker flags a version-neutral update (presence, * computed-field refresh) emitted by {@link BroadcastChannel.overlay} — a * single entry keyed at the *current* version. It tells `applyPatchMessage` * to merge the entry on top of the client's caught-up state instead of * rejecting it as stale (a same-version patch WITHOUT the marker stays * stale). Ordinary version-bumping patches from `publish()` omit it. * * `_resync` carries no versions at all. The server emits it when it cannot * construct a patch — today, when `overlay()` finds the stream's baseline * evicted from the LRU. A client that receives one always reports `behind` * and refetches. Without it the server had nothing to say in that case, so * live subscribers silently stopped receiving presence updates and had no * way to notice (#1423). */ export type PatchMessage = Record> & { readonly _overlay?: true; readonly _resync?: true; }; /** * Subscriber callback — receives version-keyed patch messages. */ export type Subscriber = (msg: PatchMessage) => void; //# sourceMappingURL=types.d.ts.map