Skip to content

ICommandRepository

Defined in: packages/ddd-core/application/ports/command-repository.port.ts:21

Contract for write-side command repositories.

Persists an entity or aggregate state into persistence storage.

constructor(
@Inject(COMMAND_REPOSITORY.createUser)
private readonly users: ICommandRepository<User, UserSnapshot>,
) {}
await this.users.save(user);

TEntity = unknown

The aggregate entity or payload being persisted.

TResult = unknown

The result type returned after persistence (or null on deletion).

save(entity): Promise<TResult | null>

Defined in: packages/ddd-core/application/ports/command-repository.port.ts:28

Persists the aggregate/payload.

Returning null is the conventional deletion result used by the DDD cache decorator to trigger eviction/barrier behavior.

TEntity

Promise<TResult | null>