Class: InMemoryUserMemoryRepository
Defined in: adapters/in-memory/InMemoryUserMemoryRepository.ts:26
InMemoryUserMemoryRepository -- the user-memory repository in a Map, for tests and the sandbox
About
Behaves like a database without one: copies in and out.
Implements IUserMemoryRepository so the UserMemoryStore runs with no infrastructure. One record per tenant + user,
the facts as one list.
Who needs it
The gateway tests (gatewayConfigBase), the dev sandbox and the cookbook's first run; a host app uses its own adapter.
Pitfalls
Production: nothing survives the process, nothing is shared between processes.
Implements
Constructors
Constructor
new InMemoryUserMemoryRepository():
InMemoryUserMemoryRepository
Returns
InMemoryUserMemoryRepository
Methods
deleteByUser()
deleteByUser(
__namedParameters):Promise<number>
Defined in: adapters/in-memory/InMemoryUserMemoryRepository.ts:94
deleteByUser -- removes the record of a user
About
GDPR erasure: nothing is left, not even an empty record.
Returns the number of facts removed.
Who needs it
UserMemoryStore.deleteByUser, for the gateway's deleteUserData.
Parameters
__namedParameters
tenantId
string
userId
string
Returns
Promise<number>
Implementation of
IUserMemoryRepository.deleteByUser
load()
load(
__namedParameters):Promise<IUserMemoryFact[]>
Defined in: adapters/in-memory/InMemoryUserMemoryRepository.ts:42
load -- the facts of one user
About
As last saved;
[]for a user without a record.
The user's facts whole, in the order they were saved.
Who needs it
UserMemoryStore.getFacts.
Parameters
__namedParameters
tenantId
string
userId
string
Returns
Promise<IUserMemoryFact[]>
Implementation of
saveAll()
saveAll(
__namedParameters):Promise<void>
Defined in: adapters/in-memory/InMemoryUserMemoryRepository.ts:67
saveAll -- replaces the user's facts
About
The whole list at once; an empty list keeps the record.
clear saves an empty list; deleteByUser removes the record itself.
Who needs it
UserMemoryStore.save, after an extraction or an edit.
Parameters
__namedParameters
facts
tenantId
string
userId
string
Returns
Promise<void>