Setu-TS
    Preparing search index...

    Class DomainEvent<T>Abstract

    Abstract base class for domain events.

    Implements IDomainEvent<T>. Auto-generates id and occurredOn from IRuntimeServices (never Date.now()). Optional aggregateId/version are omitted from the object when not supplied (honors exactOptionalPropertyTypes).

    // Raw construction when runtime is in scope
    class UserCreated extends DomainEvent<{ userId: string }> {
    readonly type = 'UserCreated';
    }
    const event = new UserCreated(runtime, { userId: '123' });

    0.1.0

    Type Parameters

    • T = unknown

      The event payload type

    Hierarchy (View Summary)

    Implements

    Index
    data: T

    The event payload.

    id: string

    Unique event ID.

    occurredOn: Date

    When the event occurred.

    type: string

    Event type name (e.g. "UserCreated").