/** * Unified account deletion cascade with a `pending_deletions` safety fence. * * Flow: * 1. Upsert a row in `pending_deletions` (idempotent — preserves partial progress). * 2. For each sub-step: skip if already done, run if not, then flag done. * 3. When all sub-steps succeed, set completed_at. * * All sub-steps are idempotent: DELETE WHERE on absent rows is a no-op. * If a step throws, the row stays partially done and resumePendingDeletions() * will retry it after 10 minutes. * * Auth user row is deleted last: once gone, the identity cannot be recovered, * so all Postgres data must be cleaned first. */ import type { TokenStore } from "./tokenStore.js"; export interface DeleteAccountOpts { tokenStore: TokenStore; supabaseUrl: string; serviceRoleKey: string; /** Storage bucket name. Defaults to SUPABASE_STORAGE_BUCKET env or "brains-wiki". */ bucket?: string; /** Root prefix inside the bucket. Defaults to SUPABASE_STORAGE_PREFIX env or "". */ storagePrefix?: string; } export interface DeleteAccountResult { userId: string; stepsCompleted: string[]; stepsFailed: string[]; completed: boolean; } export declare function deleteAccount(userId: string, opts: DeleteAccountOpts): Promise; export declare function resumePendingDeletions(opts: DeleteAccountOpts): Promise; //# sourceMappingURL=deleteAccount.d.ts.map