Class: InMemoryAIProfileRepository
Defined in: adapters/in-memory/InMemoryAIProfileRepository.ts:26
InMemoryAIProfileRepository -- the profile repository in a Map, for tests and the sandbox
About
Behaves like a database without one: copies in and out.
Implements IAIProfileRepository so the AIProfileStore runs with no infrastructure. One entry per tenant + profile id;
the constructor seeds the profiles a setup wants present from the start.
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 InMemoryAIProfileRepository(
__namedParameters?):InMemoryAIProfileRepository
Defined in: adapters/in-memory/InMemoryAIProfileRepository.ts:29
Parameters
__namedParameters?
profiles?
IAIProfile[] = []
Profiles present from the start, as if saved before (each under its own tenantId); a dev or test setup seeds them here.
Returns
InMemoryAIProfileRepository
Methods
loadByTenant()
loadByTenant(
__namedParameters):Promise<IAIProfile[]>
Defined in: adapters/in-memory/InMemoryAIProfileRepository.ts:51
loadByTenant -- every profile of a tenant
About
The whole set, for the store's cache.
Returns every profile stored under the tenant, in any order; empty for a tenant without one.
Who needs it
AIProfileStore.getProfiles, when the tenant's profiles are not in its cache yet.
Parameters
__namedParameters
tenantId
string
Returns
Promise<IAIProfile[]>
Implementation of
IAIProfileRepository.loadByTenant
remove()
remove(
__namedParameters):Promise<void>
Defined in: adapters/in-memory/InMemoryAIProfileRepository.ts:102
remove -- deletes one profile
About
Permanent; nothing when it does not exist.
Removes the profile of the tenant with this id; a missing one is not an error.
Who needs it
AIProfileStore.removeProfile.
Parameters
__namedParameters
profileId
string
tenantId
string
Returns
Promise<void>
Implementation of
save()
save(
__namedParameters):Promise<void>
Defined in: adapters/in-memory/InMemoryAIProfileRepository.ts:71
save -- inserts or replaces one profile
About
Upsert by
tenantId+profile.id.
The profile is stored whole under the tenant; a profile with the same id is replaced.
Who needs it
AIProfileStore.upsertProfile.
Parameters
__namedParameters
profile
tenantId
string
Returns
Promise<void>