Skip to content
From 0.5.0 the packages continue as @cqrs-ddd, documented at aristoteliss.github.io/ddd-cqrs; NestJS applications add @cqrs-ddd/nestjs. This site documents the 0.4.x line.

Mutable

Mutable<TValue>(options?): PropertyDecorator

Defined in: packages/ddd-core/domain/decorators/mutable.decorator.ts:56

Declares an aggregate property as mutable through domain methods.

RootEntity.applyPatch() writes only to fields registered here, so the set of properties a mutation may touch is declared once on the field itself instead of being restated in every method that changes it.

TValue = unknown

MutableOptions<TValue> = {}

Patch key override and the field’s normalizer.

PropertyDecorator

A property decorator registering the field on the owning class.

export class User extends RootEntity<UserSnapshot> {
@Mutable<string>({ normalize: (value) => User.normalizeUsername(value) })
private _username: string;
}