s-private API Documentation - v3.8.1
    Preparing search index...

    Abstract base class for all domain events.

    Provides common functionality for domain events including automatic timestamp generation. Extend this class to create specific event types.

    type ArticleCreatedPayload = { title: string; url: string };

    class ArticleCreatedEvent extends BaseDomainEvent<ArticleCreatedPayload> {
    constructor(data: { title: string; url: string; userId: string; caller: string }) {
    super(
    "article.created",
    { title: data.title, url: data.url },
    { caller: data.caller, userId: data.userId }
    );
    }
    }

    DomainEvent for the interface

    Type Parameters

    • TPayload extends Record<string, unknown>

      The type of the event payload

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Constructors

    Properties

    eventType: string

    The type of event (e.g., "article.created")

    metadata: { caller: string; timestamp: Date; userId: string }

    Contextual information about the event

    payload: TPayload

    Event-specific data