PrismaUserStoreOptions
Type Parameters
Section titled “Type Parameters”U extends AuthUser
Properties
Section titled “Properties”createData?
Section titled “createData?”
readonlyoptionalcreateData?: (input) =>Record<string,unknown>
Extra values for required columns of a new user (a tenant, a display name).
Parameters
Section titled “Parameters”NormalizedEmail
Returns
Section titled “Returns”Record<string, unknown>
delegate
Section titled “delegate”
readonlydelegate:PrismaUserDelegate
prisma.user, or whichever model holds your accounts.
fields?
Section titled “fields?”
readonlyoptionalfields?:UserFields
logger?
Section titled “logger?”
readonlyoptionallogger?:Pick<Logger,"warn">
Told once, as a warning, when Prisma refuses the skipped insert and the
store switches to create for good (SQLite, a nested createData). Pass
the logger you give createAuth. Default: silent.
select?
Section titled “select?”
readonlyoptionalselect?:Readonly<Record<string,true>>
Extra columns to read for your user type.
toUser?
Section titled “toUser?”
readonlyoptionaltoUser?: (row) =>U
Maps a row (mapped fields plus select) to your user type. Default: the four auth fields.
Parameters
Section titled “Parameters”Record<string, unknown>
Returns
Section titled “Returns”U
writeWhere?
Section titled “writeWhere?”
readonlyoptionalwriteWhere?:Readonly<Record<string,unknown>>
A Prisma where that a row must also match to take a credential write:
a new password hash (setPasswordHash), a verified address
(markEmailVerified) and an email change (changeEmail). For an app that
closes accounts on a column of its own, such as { closedAt: null }: the
condition is part of the same UPDATE, so an account closed after your
beforePasswordReset hook ran still refuses the new password, and the
flow answers it as a refused write (invalid_token from a reset).
Reads are left alone: lookups and login still find the row, so refuse a
closed account at sign-in in your own hooks. An email revert (the
changeEmail that also clears the password) is not guarded: it only takes
access away, so a closed account can still be reverted by its owner. A
rehash after login is guarded like any password write, so a closed
account keeps its old hash. Combined with the store’s own conditions
through AND, so it can narrow the write but never widen it.
Checked, copied and frozen when the store is built (see write-guard.ts
for what is refused: an empty object or an undefined anywhere inside, an
empty AND or NOT list), and copied again for each write. A column
name Prisma does not know is not caught there: the first guarded write
throws, with Prisma’s message (which prints the new hash) left out.
Default none.