Skip to content

basalt / auth/src / UserSource

Interface: UserSource ​

Defined in: auth/src/stores.ts:25

Methods ​

create() ​

> create(data): Promise<AuthUser>

Defined in: auth/src/stores.ts:28

Parameters ​

data ​
email ​

string

passwordHash ​

string

Returns ​

Promise<AuthUser>


findByEmail() ​

> findByEmail(email): Promise<AuthUser | null>

Defined in: auth/src/stores.ts:26

Parameters ​

email ​

string

Returns ​

Promise<AuthUser | null>


findById() ​

> findById(id): Promise<AuthUser | null>

Defined in: auth/src/stores.ts:27

Parameters ​

id ​

string

Returns ​

Promise<AuthUser | null>


findByIds()? ​

> optional findByIds(ids): Promise<PublicUser[]>

Defined in: auth/src/stores.ts:50

Bulk counterpart of UserSource.findById, for resolving the contact details of accounts the caller already knows — e.g. "email every admin of this tenant" (@basaltkit/teams' roleRecipients). Without it a caller either makes one round trip per id or reads the auth tables directly; the point of this method is that it has to do neither.

Contract:

  • resolves PublicUser, never AuthUser — a directory lookup has no business carrying a password hash, and a driver should not even SELECT the credential columns;
  • one entry per found id, in the order of ids; ids with no account are omitted, so the result may be shorter than the input;
  • duplicate ids yield a single entry, and an empty list resolves to [] without touching the database.

Optional: stores written before it keep compiling, and callers fall back to one findById per id.

Parameters ​

ids ​

readonly string[]

Returns ​

Promise<PublicUser[]>


update()? ​

> optional update(id, patch): Promise<AuthUser | null>

Defined in: auth/src/stores.ts:30

Required for email verification and password reset. Returns the updated user.

Parameters ​

id ​

string

patch ​

UserPatch

Returns ​

Promise<AuthUser | null>

Released under the MIT License.