domain-toolkit
    Preparing search index...

    Class DomainEventAbstract

    Something that has already happened in the domain, expressed in the ubiquitous language.

    Three rules follow from that one sentence:

    1. Past tense, always. CopyCheckedOut, never CheckOutCopy. A command can be refused; an event cannot — it is a historical fact.
    2. Immutable. You cannot change the past.
    3. Carries ids and values, never aggregate instances. An event may be handled long after it was raised, possibly in another process. Shipping a live BookStock object inside it would smuggle a mutable, already-stale reference across a consistency boundary.
    Index
    eventName: string

    Stable name used for subscription and dispatch. Namespaced by bounded context — "library.CopyCheckedOut", not "CopyCheckedOut".

    Static, because it identifies the kind of event, and both sides of the system need it without holding an instance: @Handle(CopyCheckedOut) registers under it at class-definition time, and dispatch looks up under the name of an event it has in hand. Those two must be the same string.

    declare means the base class emits no JavaScript for it — subclasses provide the value. TypeScript has no abstract static, so a subclass that forgets it cannot be caught at compile time; the getter below and Handle both fail loudly instead.

    occurredAt: Date
    sequence: number

    Global ordering stamp — see the note on sequenceCounter above.