import { getDatabase } from '@happyvertical/sql'; type DatabaseInterface = Awaited>; export declare const USER_EMAIL_KEY_BACKFILL_NAME = "@happyvertical/smrt-users:user-email-keys:v1"; export interface DuplicateUserEmailKey { emailKey: string; userCount: number; } export interface BackfillUserEmailKeysResult { updated: number; } export type UserEmailKeyBackfillErrorCode = 'duplicate_email' | 'transaction_required'; /** * Raised before any rows are changed when legacy User emails are ambiguous. */ export declare class UserEmailKeyBackfillError extends Error { readonly code: UserEmailKeyBackfillErrorCode; readonly duplicates: DuplicateUserEmailKey[]; constructor(code: UserEmailKeyBackfillErrorCode, message: string, duplicates?: DuplicateUserEmailKey[]); } /** * Populate the durable normalized-email key for Users created before the * `emailKey` field existed. * * Apply the schema migration first, stop or upgrade legacy writers, then call * this once from a single deploy process. The operation is idempotent. It * fails before changing any rows when two non-blank emails normalize to the * same key, so operators can reconcile those Users explicitly. */ export declare function backfillUserEmailKeys(db: DatabaseInterface): Promise; export {}; //# sourceMappingURL=backfillUserEmailKeys.d.ts.map