/** * In-memory state container for the fake YNAB API. * One instance per test — provides full isolation. */ export interface CurrencyFormatData { iso_code: string; example_format: string; decimal_digits: number; decimal_separator: string; symbol_first: boolean; group_separator: string; currency_symbol: string; display_symbol: boolean; } export interface DateFormatData { format: string; } export interface PlanSettingsData { date_format: DateFormatData; currency_format: CurrencyFormatData; } export interface PlanData { id: string; name: string; last_modified_on: string | null; first_month: string | null; last_month: string | null; date_format: DateFormatData | null; currency_format: CurrencyFormatData | null; settings: PlanSettingsData; } export interface AccountData { id: string; name: string; type: string; on_budget: boolean; closed: boolean; note: string | null; balance: number; cleared_balance: number; uncleared_balance: number; transfer_payee_id: string; direct_import_linked: boolean | null; direct_import_in_error: boolean | null; last_reconciled_at: string | null; debt_original_balance: number | null; debt_interest_rates: Record | null; debt_minimum_payments: Record | null; debt_escrow_amounts: Record | null; deleted: boolean; } export interface CategoryData { id: string; category_group_id: string; category_group_name: string | null; name: string; hidden: boolean; original_category_group_id: string | null; note: string | null; budgeted: number; activity: number; balance: number; goal_type: string | null; goal_needs_whole_amount: boolean | null; goal_day: number | null; goal_cadence: number | null; goal_cadence_frequency: number | null; goal_creation_month: string | null; goal_target: number | null; goal_target_month: string | null; goal_target_date: string | null; goal_percentage_complete: number | null; goal_months_to_budget: number | null; goal_under_funded: number | null; goal_overall_funded: number | null; goal_overall_left: number | null; goal_snoozed_at: string | null; deleted: boolean; } export interface CategoryGroupData { id: string; name: string; hidden: boolean; deleted: boolean; categories: CategoryData[]; } export interface PayeeData { id: string; name: string; transfer_account_id: string | null; deleted: boolean; } export interface SubTransactionData { id: string; transaction_id: string; amount: number; memo: string | null; payee_id: string | null; payee_name: string | null; category_id: string | null; category_name: string | null; transfer_account_id: string | null; transfer_transaction_id: string | null; deleted: boolean; } export interface TransactionData { id: string; date: string; amount: number; memo: string | null; cleared: "cleared" | "uncleared" | "reconciled"; approved: boolean; flag_color: string | null; flag_name: string | null; account_id: string; payee_id: string | null; category_id: string | null; transfer_account_id: string | null; transfer_transaction_id: string | null; matched_transaction_id: string | null; import_id: string | null; import_payee_name: string | null; import_payee_name_original: string | null; debt_transaction_type: string | null; deleted: boolean; account_name: string; payee_name: string | null; category_name: string | null; subtransactions: SubTransactionData[]; } export interface ScheduledSubTransactionData { id: string; scheduled_transaction_id: string; amount: number; memo: string | null; payee_id: string | null; payee_name: string | null; category_id: string | null; category_name: string | null; transfer_account_id: string | null; deleted: boolean; } export interface ScheduledTransactionData { id: string; date_first: string; date_next: string; frequency: string; amount: number; memo: string | null; flag_color: string | null; flag_name: string | null; account_id: string; payee_id: string | null; category_id: string | null; transfer_account_id: string | null; deleted: boolean; account_name: string; payee_name: string | null; category_name: string | null; subtransactions: ScheduledSubTransactionData[]; } export interface MonthDetailData { month: string; note: string | null; income: number; budgeted: number; activity: number; to_be_budgeted: number; age_of_money: number | null; deleted: boolean; categories: CategoryData[]; } export interface ChangeLogEntry { sk: number; planId: string; collection: string; entityId: string; } export interface RouteResult { status: number; body: unknown; } export type RouteParams = Record; export type QueryParams = Record; export declare class FakeYnabState { serverKnowledge: number; readonly plans: Map; /** planId → accountId → AccountData */ readonly accounts: Map>; /** planId → CategoryGroupData[] */ readonly categoryGroups: Map; /** planId → txId → TransactionData */ readonly transactions: Map>; /** planId → stxId → ScheduledTransactionData */ readonly scheduledTransactions: Map>; /** planId → payeeId → PayeeData */ readonly payees: Map>; /** planId → month → MonthDetailData */ readonly monthDetails: Map>; /** planId → "month::catId" → CategoryData */ readonly monthCategories: Map>; readonly changeLog: ChangeLogEntry[]; /** Record a mutation — increments serverKnowledge and appends to changeLog. */ recordChange(planId: string, collection: string, entityId: string): void; /** Get entity IDs changed since a given server_knowledge value. */ getChangedEntityIds(planId: string, collection: string, sinceKnowledge: number): Set; /** Resolve an account name by ID, returns empty string if not found. */ resolveAccountName(planId: string, accountId: string): string; /** Resolve a payee name by ID, returns null if not found. */ resolvePayeeName(planId: string, payeeId: string | null): string | null; /** Resolve a category name by ID, returns null if not found. */ resolveCategoryName(planId: string, categoryId: string | null): string | null; /** Find a category across all groups for a plan. */ findCategoryById(planId: string, categoryId: string): CategoryData | null; /** Ensure per-plan maps exist for a given planId. */ ensurePlanMaps(planId: string): void; }