import type { BackupCodeRepository, FederatedAccount, FederatedAccountRepository, FullAuthUser, Invitation, InvitationRepository, NotificationPreference, NotificationPreferenceRepository, NotificationRecord, NotificationRepository, Passkey, PasskeyRepository, PushSubscriptionData, PushSubscriptionRepository, RefreshTokenRecord, RefreshTokenRepository, Repositories, UserRepository } from './types.js'; interface StoredInvitation extends Invitation { invitedById: string; /** Projected away by the contract-facing reads — the hash never leaves here. */ tokenHash: string; } interface StoredPushSubscription extends PushSubscriptionData { userId: string; } interface StoredPreference extends NotificationPreference { userId: string; } interface StoredBackupCode { userId: string; codeHash: string; usedAt: Date | null; } /** Every table of the adapter, one row map (plus its unique indexes) each. */ interface Tables { users: Map>; usersByEmail: Map; invitations: Map; invitationsByEmail: Map; invitationsByTokenHash: Map; notifications: Map; pushSubscriptions: Map; notificationPreferences: Map; passkeys: Map; refreshTokens: Map; refreshTokensByHash: Map; backupCodes: StoredBackupCode[]; federatedAccounts: Map; } declare const TABLES: unique symbol; /** * The database behind the in-memory adapter — one handle, every table. * * Every `createInMemory*Repository(store)` factory is a view on the store it * is given: repositories built on the same store share rows, and * `user.delete` erases a user's dependents from every table of that store. * Rows on a different store are as far away as another database. The handle * exposes no state of its own; `createInMemoryStore()` is the only way to get * one. */ export interface InMemoryStore { readonly [TABLES]: Tables; } export declare function createInMemoryStore(): InMemoryStore; /** * In-memory implementation of the full {@link Repositories} contract: a fresh * {@link createInMemoryStore} with every repository built on it. * * **Dev / test only.** State lives in plain `Map`s on the heap — it is wiped on * restart and not shared across processes or instances. Use it for the * five-minute quickstart, local development, and as the fixture every adapter * conformance run executes against. **Never** ship it to production; pass a * persistent adapter (`createPrismaRepos`, or your own) instead. * * ### Why this is a faithful reference (not just a stub) * * The atomicity the interface demands of a real database — single-use token * claims, compare-and-set rotation/counter bumps, lossless increments — is * reproduced here the only way single-threaded JavaScript can: every claim * method performs its **read and conditional write with no `await` in * between**, so two concurrent calls can never interleave through the decision. * That is exactly the property the exported conformance suite asserts, which is * why this adapter passes it. An implementation that `await`ed mid-claim would * fail the same suite — see `conformance.ts`. */ export declare function createInMemoryRepos(): Repositories; export declare function createInMemoryUserRepository(store: InMemoryStore): UserRepository; export declare function createInMemoryInvitationRepository(store: InMemoryStore): InvitationRepository; export declare function createInMemoryNotificationRepository(store: InMemoryStore): NotificationRepository; export declare function createInMemoryPushSubscriptionRepository(store: InMemoryStore): PushSubscriptionRepository; export declare function createInMemoryNotificationPreferenceRepository(store: InMemoryStore): NotificationPreferenceRepository; export declare function createInMemoryPasskeyRepository(store: InMemoryStore): PasskeyRepository; /** * In-memory `RefreshTokenRepository`. Suitable only for single-process * deployments and tests — production consumers should pass a persistent * implementation (Prisma, Redis, etc.) via `repos.refreshToken`. */ export declare function createInMemoryRefreshTokenRepository(store: InMemoryStore): RefreshTokenRepository; export declare function createInMemoryBackupCodeRepository(store: InMemoryStore): BackupCodeRepository; export declare function createInMemoryFederatedAccountRepository(store: InMemoryStore): FederatedAccountRepository; export {};