import type { PatchOperationInternal, PokeInternal } from '../../../replicache/src/impl.ts'; import type { ClientID } from '../../../replicache/src/sync/ids.ts'; import type { PokeEndBody, PokePartBody, PokeStartBody } from '../../../zero-protocol/src/poke.ts'; import type { Schema } from '../../../zero-schema/src/builder/schema-builder.ts'; import { type NameMapper } from '../../../zero-schema/src/name-mapper.ts'; import type { ZeroLogContext } from './zero-log-context.ts'; import type { MutationPatch } from '../../../zero-protocol/src/mutations-patch.ts'; import type { MutationTracker } from './mutation-tracker.ts'; type PokeAccumulator = { readonly pokeStart: PokeStartBody; readonly parts: PokePartBody[]; readonly pokeEnd: PokeEndBody; }; /** * Handles the multi-part format of zero pokes. * As an optimization it also debounces pokes, only poking Replicache with a * merged poke at most once per frame (as determined by requestAnimationFrame). * The client cannot control how fast the server sends pokes, and it can only * update the UI once per frame. This debouncing avoids wastefully * computing separate diffs and IVM updates for intermediate states that will * never been displayed to the UI. */ export declare class PokeHandler { #private; constructor(replicachePoke: (poke: PokeInternal) => Promise, onPokeError: () => void, clientID: ClientID, schema: Schema, lc: ZeroLogContext, mutationTracker: MutationTracker); handlePokeStart(pokeStart: PokeStartBody): void; handlePokePart(pokePart: PokePartBody): number | undefined; handlePokeEnd(pokeEnd: PokeEndBody): void; handleDisconnect(): void; } export declare function mergePokes(pokeBuffer: PokeAccumulator[], schema: Schema, serverToClient: NameMapper): (PokeInternal & { mutationResults?: MutationPatch[] | undefined; }) | undefined; export declare function mutationPatchOpToReplicachePatchOp(op: MutationPatch): PatchOperationInternal; export {}; //# sourceMappingURL=zero-poke-handler.d.ts.map