import type { AccountItem, IMessageFlagPushRepository } from "@remit/data-ports"; import type { Logger } from "@remit/logger"; import { type SyncedMessage } from "@remit/mailbox-service"; import type { ProcessContext } from "../context.js"; import { type EmitEvent } from "../emit.js"; import type { SyncMessagesEvent } from "../events.js"; /** Slice synced messages into body-sync batches, each one ranged FETCH. */ export declare const batchSyncedMessages: (syncedMessages: SyncedMessage[], batchSize: number) => SyncedMessage[][]; export declare const syncMessages: (event: SyncMessagesEvent, ctx: ProcessContext) => Promise; /** * Periodic per-mailbox drain point for pending flag-push markers (issue * #1273, epic #1281). The SQS enqueue in `FlagPushService.flip` is only a * wake-up hint and may fail freely — a marker left `state: "pending"` means * that hint never landed (queue down, or a crash between the local write and * the enqueue). This periodic tick — which already runs per mailbox on a * schedule regardless of user activity — re-arms every such marker with a * fresh `FLAG_PUSH` event, closing the gap without the caller ever having to * retry. * * Markers already `queued`/`processing` are left alone: a live SQS message * (or the single-marker handler currently running) already owns driving them * forward, and re-arming them too would just duplicate work. * * A re-arm failure (the SQS send itself) is caught per-marker and logged * loudly — it must never fail the surrounding SYNC_MESSAGES batch, which is * unrelated message-header sync work. The marker stays durable regardless; * the next periodic tick tries again. */ export declare const drainPendingFlagPushes: (flagPushMarkerService: IMessageFlagPushRepository, account: AccountItem, mailboxId: string, log: Logger, emit: EmitEvent) => Promise;