import type { LogContext } from '@rocicorp/logger';
import type { ReplicacheImpl } from '../../../replicache/src/impl.ts';
import type { EphemeralID, MutationTrackingData } from '../../../replicache/src/replicache-options.ts';
import { type MutationID, type PushResponseBody } from '../../../zero-protocol/src/push.ts';
import type { MutatorResultSuccessDetails } from './custom.ts';
import { type ZeroError } from './error.ts';
type MutationSuccessType = MutatorResultSuccessDetails;
/**
 * Tracks what pushes are in-flight and resolves promises when they're acked.
 */
export declare class MutationTracker {
    #private;
    constructor(lc: LogContext, ackMutations: (upTo: MutationID) => void, onFatalError: (error: ZeroError) => void);
    setClientIDAndWatch(clientID: string, experimentalWatch: ReplicacheImpl['experimentalWatch']): void;
    trackMutation(): MutationTrackingData<MutationSuccessType>;
    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;
    /**
     * Reject all outstanding mutations. Called when the client is in a state
     * that prevents mutations from being applied, such as offline or closed.
     */
    rejectAllOutstandingMutations(error: ZeroError): void;
    processPushResponse(response: PushResponseBody): 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;
}
export {};
//# sourceMappingURL=mutation-tracker.d.ts.map