Skip to content

basalt / auth/src / MemoryUserSource

Class: MemoryUserSource ​

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

Implements ​

Constructors ​

Constructor ​

> new MemoryUserSource(): MemoryUserSource

Returns ​

MemoryUserSource

Methods ​

create() ​

> create(data): Promise<AuthUser>

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

Parameters ​

data ​
email ​

string

passwordHash ​

string

Returns ​

Promise<AuthUser>

Implementation of ​

UserSource.create


findByEmail() ​

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

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

Parameters ​

email ​

string

Returns ​

Promise<AuthUser | null>

Implementation of ​

UserSource.findByEmail


findById() ​

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

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

Parameters ​

id ​

string

Returns ​

Promise<AuthUser | null>

Implementation of ​

UserSource.findById


findByIds() ​

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

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

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[]>

Implementation of ​

UserSource.findByIds


update() ​

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

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

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

Parameters ​

id ​

string

patch ​

UserPatch

Returns ​

Promise<AuthUser | null>

Implementation of ​

UserSource.update

Released under the MIT License.