CommandRepository
Defined in: packages/core/persistence/command-repository.abstract.ts:36
Base class for write-side (command) repositories.
Persists an entity or aggregate state via the abstract save method and receives an
ICache instance. Subclasses annotate save() with the @Cache decorator
to perform automatic write-through caching or cache eviction upon mutation.
Example
Section titled “Example”Creating a command repository with the Cache decorator
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”TEntity
Section titled “TEntity”TEntity = unknown
The aggregate entity type accepted by save.
TResult
Section titled “TResult”TResult = unknown | null
The persisted result type returned by save.
TCache
Section titled “TCache”TCache = unknown
Implements
Section titled “Implements”ICommandRepository<TEntity,TResult>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CommandRepository<
TEntity,TResult,TCache>(cache):CommandRepository<TEntity,TResult,TCache>
Defined in: packages/core/persistence/command-repository.abstract.ts:42
Parameters
Section titled “Parameters”ICache<TCache>
Returns
Section titled “Returns”CommandRepository<TEntity, TResult, TCache>
Properties
Section titled “Properties”
protectedreadonlycache:ICache<TCache>
Defined in: packages/core/persistence/command-repository.abstract.ts:42
Methods
Section titled “Methods”save()
Section titled “save()”
abstractsave(entity):Promise<TResult|null>
Defined in: packages/core/persistence/command-repository.abstract.ts:44
Persists the aggregate/payload.
Returning null is the conventional deletion result used by the DDD cache
decorator to trigger eviction/barrier behavior.
Parameters
Section titled “Parameters”entity
Section titled “entity”TEntity
Returns
Section titled “Returns”Promise<TResult | null>