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.
Type Parameters
Section titled “Type Parameters”TValue
Section titled “TValue”TValue = unknown
Parameters
Section titled “Parameters”options?
Section titled “options?”MutableOptions<TValue> = {}
Patch key override and the field’s normalizer.
Returns
Section titled “Returns”PropertyDecorator
A property decorator registering the field on the owning class.
Example
Section titled “Example”export class User extends RootEntity<UserSnapshot> { @Mutable<string>({ normalize: (value) => User.normalizeUsername(value) }) private _username: string;}