import type { EphemeralID, MutationTrackingData } from '../../../replicache/src/replicache-options.ts'; import { type MutationID, type PushResponse } from '../../../zero-protocol/src/push.ts'; import type { ZeroLogContext } from './zero-log-context.ts'; import type { ReplicacheImpl } from '../../../replicache/src/impl.ts'; /** * Tracks what pushes are in-flight and resolves promises when they're acked. */ export declare class MutationTracker { #private; constructor(lc: ZeroLogContext, ackMutations: (upTo: MutationID) => void); setClientIDAndWatch(clientID: string, experimentalWatch: ReplicacheImpl['experimentalWatch']): void; trackMutation(): MutationTrackingData; mutationIDAssigned(id: EphemeralID, mutationID: number): void; /** * Reject the mutation due to an unhandled exception on the client. * The mutation must not have been persisted to the client store. */ rejectMutation(id: EphemeralID, e: unknown): void; processPushResponse(response: PushResponse): void; /** * DEPRECATED: to be removed when we switch to fully driving * mutation resolution via poke. * * When we reconnect to zero-cache, we resolve all outstanding mutations * whose ID is less than or equal to the lastMutationID. * * The reason is that any responses the API server sent * to those mutations have been lost. * * An example case: the API server responds while the connection * is down. Those responses are lost. * * Mutations whose LMID is > the lastMutationID are not resolved * since they will be retried by the client, giving us another chance * at getting a response. * * The only way to ensure that all API server responses are * received would be to have the API server write them * to the DB while writing the LMID. */ onConnected(lastMutationID: number): void; /** * lmid advance will: * 1. notify "allMutationsApplied" listeners if the lastMutationID * is greater than or equal to the largest outstanding mutation ID. * 2. resolve all mutations whose mutation ID is less than or equal to * the lastMutationID. */ lmidAdvanced(lastMutationID: number): void; get size(): number; /** * Be notified when all mutations have been included in the server snapshot. * * The query manager will not de-register queries from the server until there * are no pending mutations. * * The reason is that a mutation may need to be rebased. We do not want * data that was available the first time it was run to not be available * on a rebase. */ onAllMutationsApplied(listener: () => void): void; } //# sourceMappingURL=mutation-tracker.d.ts.map