Skip to content

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;
}