import { b as AbstractBaseAdapter, c as AuthAdapter, U as UserRole, d as AuthUser, S as Session, a as AuditLogFilter, A as AuditLog } from '../base-BAApLdlP.js'; import { C as CollectionConfig, G as GlobalConfig, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, e as FindOneArgs } from '../types-M2BhNVof.js'; import { PostgresJsDatabase } from 'drizzle-orm/postgres-js'; import { F as Field } from '../types-C3QFX0l6.js'; declare function fieldToDrizzleType(field: Field, dialect?: 'postgres' | 'sqlite'): string; declare function collectionToDrizzleSchema(collection: CollectionConfig, dialect?: 'postgres' | 'sqlite'): string; declare class DrizzleAdapter extends AbstractBaseAdapter { client: any; private schema; private _schemaEnsured; dialect: 'postgres' | 'sqlite'; private connectionString?; private versionsTableReady; rawClient: any; constructor(options: { type?: 'postgres' | 'sqlite'; schema?: Record; client?: any; connectionString?: string; }); protected prepareData(data: Record, config: CollectionConfig): Record; connect(): Promise; init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise; private createTableFromConfig; private ensureCollectionTables; private getColumnSqlDefinition; private columnSqlType; private getExpectedColumnDefs; private syncTableColumns; private generateCreateColumns; disconnect(): Promise; find(args: FindArgs): Promise>; findByID(args: FindByIDArgs): Promise; create(args: CreateArgs): Promise; update(args: UpdateArgs): Promise; delete(args: DeleteArgs): Promise; count(args: { collection: string; where?: Record; tenantId?: string; }): Promise; findOne(args: FindOneArgs): Promise; findVersions(args: any): Promise>; findVersionByID(args: { collection: string; versionId: string; tenantId?: string; }): Promise; createVersion(args: any): Promise; updateLatestVersion(args: any): Promise; deleteVersions(args: { collection: string; documentId: string; keepLatest?: number; tenantId?: string; }): Promise; private getTable; private buildWhereClause; private processResult; private ensureVersionsTable; execute(query: any): Promise; private executeRaw; } declare function createDrizzleAdapter(options: { type?: 'postgres' | 'sqlite'; client?: any; schema?: any; connectionString?: string; }): DrizzleAdapter; interface PostgresAuthAdapterOptions { db: PostgresJsDatabase; prefix?: string; sessionTTL?: number; refreshTokenTTL?: number; } declare class PostgresAuthAdapter implements AuthAdapter { private db; private prefix; private sessionTTL; private refreshTokenTTL; constructor(options: PostgresAuthAdapterOptions); connect(): Promise; disconnect(): Promise; createUser(data: { email: string; password: string; name?: string; role?: UserRole; avatar?: string; tenantId?: string; emailVerified?: boolean; }): Promise; findUserByEmail(email: string): Promise; findUserById(id: string): Promise; updateUser(id: string, data: Partial): Promise; deleteUser(id: string): Promise; findUsers(options?: { page?: number; limit?: number; search?: string; }): Promise<{ users: AuthUser[]; total: number; }>; verifyPassword(email: string, password: string): Promise; hashPassword(password: string): Promise; createSession(userId: string, data?: { ipAddress?: string; userAgent?: string; }): Promise; findSessionByToken(token: string): Promise; findSessionByRefreshToken(refreshToken: string): Promise; deleteSession(sessionId: string): Promise; deleteUserSessions(userId: string): Promise; addPasswordToHistory(userId: string, passwordHash: string): Promise; getPasswordHistory(userId: string, count?: number): Promise; isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise; isLocked(userId: string): Promise; getLockout(userId: string): Promise<{ lockedUntil: Date; } | null>; recordFailedAttempt(userId: string, ipAddress?: string): Promise<{ attempts: number; locked: boolean; }>; resetAttempts(userId: string): Promise; findAuditLogs(filter: AuditLogFilter): Promise<{ logs: AuditLog[]; total: number; }>; createAuditLog(data: Omit): Promise; private userToAuthUser; private sessionToSession; createEmailVerificationToken(userId: string): Promise<{ token: string; expiresAt: Date; }>; verifyEmailToken(token: string): Promise<{ success: boolean; userId?: string; error?: string; }>; createPasswordResetToken(email: string): Promise<{ token: string; expiresAt: Date; error?: string; }>; resetPasswordWithToken(token: string, newPassword: string): Promise<{ success: boolean; error?: string; }>; } type Dialect = "sqlite" | "postgres"; interface DatabaseResult { db: any; dialect: Dialect; genId: () => string; } declare function createDatabase(): Promise; declare function runMigrations(_db: any, _dialect?: Dialect): Promise; declare function seedDefaultRoles(db: any): Promise; export { type Dialect, DrizzleAdapter, PostgresAuthAdapter, collectionToDrizzleSchema, createDatabase, createDrizzleAdapter, fieldToDrizzleType, runMigrations, seedDefaultRoles };