basalt / auth-prisma/src / PrismaUserSource
Class: PrismaUserSource
Defined in: auth-prisma/src/index.ts:299
Implements
Constructors
Constructor
> new PrismaUserSource(client, options?): PrismaUserSource
Defined in: auth-prisma/src/index.ts:303
Parameters
client
options?
Returns
PrismaUserSource
Methods
create()
> create(data): Promise<AuthUser>
Defined in: auth-prisma/src/index.ts:387
Refuses an email that already exists in any letter case (EmailTakenError): the @unique index on PostgreSQL is case-sensitive, so a legacy Bob@x.test would not stop a new bob@x.test. A concurrent insert of the same canonical email loses on the index (P2002) and gets the same error.
Parameters
data
email
string
passwordHash
string
Returns
Promise<AuthUser>
Implementation of
findByEmail()
> findByEmail(email): Promise<AuthUser | null>
Defined in: auth-prisma/src/index.ts:324
Emails are case-insensitive identities: new rows are stored canonical (trimmed, lowercased). Rows written before that may be mixed-case, so on PostgreSQL the lookup is case-insensitive and refuses ambiguity: when two rows differ only in letter case it throws AccountEmailAmbiguousError instead of picking one (run normalizeAuthUserEmails to find and fix them). On MySQL the column collation is already case-insensitive and the unique index rules out case-variant duplicates, so the exact lookup is authoritative.
Parameters
email
string
Returns
Promise<AuthUser | null>
Implementation of
findById()
> findById(id): Promise<AuthUser | null>
Defined in: auth-prisma/src/index.ts:352
Parameters
id
string
Returns
Promise<AuthUser | null>
Implementation of
findByIds()
> findByIds(ids): Promise<PublicUser[]>
Defined in: auth-prisma/src/index.ts:363
One WHERE id IN (…) per chunk instead of one query per id. select lists only the non-credential columns, so the password hash is never even read; ids with no row are simply absent from the result, which stays in the order the caller asked for.
Parameters
ids
readonly string[]
Returns
Promise<PublicUser[]>
Implementation of
update()
> update(id, patch): Promise<AuthUser | null>
Defined in: auth-prisma/src/index.ts:401
Required for email verification and password reset. Returns the updated user.
Parameters
id
string
patch
Returns
Promise<AuthUser | null>