Skip to content

Codec

Defined in: src/persistence/migration/Codec.ts:37

A bidirectional value-transform with validation on both sides. encode is called when the actor is about to persist; decode is called after a successful journal read but before the domain handler sees the payload. Errors thrown from either surface as PersistError / MigrationError at the actor layer.

T

readonly optional name?: string

Defined in: src/persistence/migration/Codec.ts:47

Diagnostic name shown in error messages.

decode(wire): T

Defined in: src/persistence/migration/Codec.ts:45

Inverse of encode.

unknown

T


encode(value): unknown

Defined in: src/persistence/migration/Codec.ts:43

Validate / serialise a domain value for the wire. Returning the input unchanged is fine — the codec’s job is to throw on invalid input, not necessarily to reshape the payload.

T

unknown