import type * as ynab from "ynab"; /** Default TTL: 1 hour. External changes are picked up after this period. */ export declare const CACHE_TTL_MS: number; export interface SyncDeltas { added: number; updated: number; deleted: number; } export interface CollectionCache { byId: Map; serverKnowledge?: number; stale: boolean; lastRefreshedAt: number; lastDeltas?: SyncDeltas; } export interface TransactionCache { byId: Map; coveredSinceDate: string; serverKnowledge?: number; stale: boolean; lastRefreshedAt: number; lastDeltas?: SyncDeltas; } export interface SimpleCache { data: T; lastRefreshedAt: number; } export type StaleableCollectionKey = "accounts" | "categories" | "payees" | "scheduledTransactions" | "transactions"; export interface BudgetCache { accounts: CollectionCache; categories: CollectionCache; payees: CollectionCache; scheduledTransactions: CollectionCache; transactions: TransactionCache; categoryGroups: Map; settings?: SimpleCache; monthSummaries: Map>; monthCategories: Map>; } /** * Manages all per-budget caches (collection caches with delta sync, simple * TTL caches, optimistic updates) plus the top-level plans cache. * * This is an internal implementation detail of {@link YnabClient}; the public * API surface of the client is unchanged. */ export declare class CacheManager { private readonly budgetCaches; plansCache: SimpleCache | undefined; getBudgetCache(budgetId: string): BudgetCache; markCollectionsStale(budgetId: string, keys: StaleableCollectionKey[]): void; invalidateMonthCaches(budgetId: string): void; isSimpleCacheValid(cache: SimpleCache | undefined): cache is SimpleCache; needsRefresh(cache: { stale: boolean; lastRefreshedAt: number; serverKnowledge?: number; }): boolean; optimisticUpdateTransactions(budgetId: string, transactions: ynab.TransactionDetail[]): void; optimisticRemoveTransaction(budgetId: string, transactionId: string): void; optimisticUpdateScheduledTransaction(budgetId: string, transaction: ynab.ScheduledTransactionDetail): void; optimisticRemoveScheduledTransaction(budgetId: string, scheduledTransactionId: string): void; applyAccountDeltas(budgetId: string, accounts: ynab.Account[], serverKnowledge: number): ynab.Account[]; applyCategoryDeltas(budgetId: string, categoryGroups: ynab.CategoryGroupWithCategories[], serverKnowledge: number): ynab.CategoryGroupWithCategories[]; applyPayeeDeltas(budgetId: string, payees: ynab.Payee[], serverKnowledge: number): ynab.Payee[]; applyScheduledTransactionDeltas(budgetId: string, transactions: ynab.ScheduledTransactionDetail[], serverKnowledge: number): ynab.ScheduledTransactionDetail[]; applyFullTransactionFetch(budgetId: string, transactions: ynab.TransactionDetail[], sinceDate: string, serverKnowledge: number): void; applyTransactionDeltas(budgetId: string, transactions: ynab.TransactionDetail[], serverKnowledge: number): void; }