Rindle

API index and search · Build metadata

Supporting declarations

packages/remote/src/mutation-queue.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

PushOutcome

/** One envelope's outcome from the API server's mutate endpoint. */
export interface PushOutcome {
    accepted: boolean;
    reason?: string;
}

QueuedMutationSenderOptions

export interface QueuedMutationSenderOptions {
    /** Deliver one in-order batch; resolve once the daemon durably processed it (i.e. the
     *  API server awaited its daemon call before responding). Throw to have the SAME batch
     *  retried. Return per-envelope outcomes, or void when everything was accepted. */
    send: (envelopes: MutationEnvelope[]) => Promise<PushOutcome[] | void>;
    /** A policy rejection for one envelope (never retried; the prediction snaps back via the
     *  lmid release — this callback is where the reason reaches the app). */
    onRejected?: (envelope: MutationEnvelope, reason: string) => void;
    /** A failed flush attempt, before its retry. The ONLY surface for a transport/authority
     *  failure: `send` throwing is otherwise absorbed by the retry loop, so a queue built without
     *  this hook fails perfectly silently while head-of-line blocking every later mutation. */
    onError?: (err: unknown, attempt: number) => void;
    /** Backoff before retry `attempt` (1-based). Default: 200ms · 2^(attempt-1), capped at 5s. */
    retryDelayMs?: (attempt: number) => number;
    /** Max envelopes per flush. Default 32. */
    maxBatch?: number;
}

createQueuedMutationSender

/** A `MutationEnvelopeSender` (the `pushMutation` option of `RemoteOptimisticSource`) that
 *  queues envelopes and delivers them as confirmed, in-order batches. */
export declare function createQueuedMutationSender(opts: QueuedMutationSenderOptions): MutationEnvelopeSender;