import type { AccountGroupId, AccountWalletId } from "@metamask/account-api"; import type { UserStorageController } from "@metamask/profile-sync-controller"; import type { BackupAndSyncContext } from "../types.mjs"; /** * Service responsible for managing all backup and sync operations. * * This service handles: * - Full sync operations * - Single item sync operations * - Sync queue management * - Sync state management */ export declare class BackupAndSyncService { #private; constructor(context: BackupAndSyncContext); /** * Checks if syncing is currently in progress. * * @returns True if syncing is in progress. */ get isInProgress(): boolean; /** * Checks if the account tree has been synced at least once. * * @returns True if the account tree has been synced at least once. */ get hasSyncedAtLeastOnce(): boolean; /** * Checks if backup and sync is enabled by checking UserStorageController state. * * @returns True if backup and sync + account syncing is enabled. */ get isBackupAndSyncEnabled(): boolean; /** * Clears the atomic queue and resets ongoing operations. */ clearState(): void; /** * Handles changes to the user storage state. * Used to clear the backup and sync service state. * * @param state - The new user storage state. */ handleUserStorageStateChange(state: UserStorageController.UserStorageControllerState): void; /** * Enqueues a single wallet sync operation (fire-and-forget). * If the first full sync has not yet occurred, it does nothing. * * @param walletId - The wallet ID to sync. */ enqueueSingleWalletSync(walletId: AccountWalletId): void; /** * Enqueues a single group sync operation (fire-and-forget). * If the first full sync has not yet occurred, it does nothing. * * @param groupId - The group ID to sync. */ enqueueSingleGroupSync(groupId: AccountGroupId): void; /** * Performs a full synchronization of the local account tree with user storage, ensuring consistency * between local state and cloud-stored account data. * If a full sync is already in progress, it will return the ongoing promise. * This clears the atomic sync queue before starting the full sync. * * NOTE: in some very edge cases, this can be ran concurrently if triggered quickly after * toggling back and forth the backup and sync feature from the UI. * * @returns A promise that resolves when the sync is complete. */ performFullSync(): Promise; /** * Performs a full synchronization of the local account tree with user storage, ensuring consistency * between local state and cloud-stored account data. * * If the first ever full sync is already in progress, it will return the ongoing promise. * If the first ever full sync has already completed, it will resolve and NOT start a new sync. * * This clears the atomic sync queue before starting the full sync. * * @returns A promise that resolves when the sync is complete. */ performFullSyncAtLeastOnce(): Promise; } //# sourceMappingURL=index.d.mts.map