/** * Sync manager — extracted from android-bootstrap.ts for use in both * main-thread and Worker contexts. * * Platform-specific dependencies are injected: * - emitEvent: posts events to the UI * - vlog: verbose remote logging * - createTcpTransport: factory for TCP transport (BridgeTcpTransport or WorkerTcpTransport) */ import type { WebMailxDB } from "./db.js"; import type { WebMessageStore } from "./web-message-store.js"; import type { WebSyncManager } from "./web-service.js"; import type { Folder, AccountConfig } from "@bobfrankston/mailx-types"; export interface SyncManagerDeps { emitEvent: (event: any) => void; vlog: (msg: string) => void; createTcpTransport: () => any; } export declare class SyncManager implements WebSyncManager { private db; private bodyStore; private providers; private tokenProviders; private deps; constructor(db: WebMailxDB, bodyStore: WebMessageStore, deps: SyncManagerDeps); on(_event: string, _handler: (...args: any[]) => void): void; emit(event: string, ...args: any[]): void; addAccount(account: AccountConfig): Promise; setTokenProvider(accountId: string, provider: () => Promise): void; private isGmailAccount; private getProvider; syncAll(): Promise; syncAccount(accountId: string): Promise; syncFolders(accountId: string): Promise; syncFolder(accountId: string, folderId: number): Promise; private storeProviderMessages; fetchMessageBody(accountId: string, folderId: number, uid: number): Promise; /** Publish a Store event AND the legacy emitEvent() shape until every * consumer subscribes via storeBus. Same shape as the desktop side — * that's the load-bearing property for cross-platform code sharing. */ private publishStore; updateFlagsLocal(accountId: string, uid: number, folderId: number, flags: string[]): Promise; trashMessage(accountId: string, folderId: number, uid: number): Promise; trashMessages(accountId: string, messages: { uid: number; folderId: number; }[]): Promise; moveMessage(accountId: string, uid: number, folderId: number, targetFolderId: number): Promise; moveMessages(accountId: string, messages: { uid: number; folderId: number; }[], targetFolderId: number): Promise; moveMessageCrossAccount(): Promise; undeleteMessage(accountId: string, uid: number, folderId: number): Promise; /** Q112: drain queued move/flag/trash actions to the provider. Android is * standalone — it pushes state changes to Gmail (or other provider) the * same way desktop does, so local actions propagate without needing a * desktop to relay them. Called from android-bootstrap on startup and * every 2-min sync tick. `send` actions are drained separately by * processSendQueue. */ processSyncActions(accountId: string): Promise; markFolderRead(folderId: number): Promise; emptyFolder(accountId: string, folderId: number): Promise; queueOutgoingLocal(accountId: string, rawMessage: string): void; private sendViaSmtpDirect; saveDraft(_accountId: string, _raw: string, _prevUid?: number, _draftId?: string): Promise; deleteDraft(_accountId: string, _uid: number): Promise; reauthenticate(_accountId: string): Promise; searchOnServer(_accountId: string, _query: string): Promise; syncAllContacts(): Promise; } //# sourceMappingURL=sync-manager.d.ts.map