import {EntityId} from "./EntityId"; export abstract class DomainEvent { static EVENT_NAME: string; readonly props: H; readonly eventId: EntityId; readonly occurredOn: Date; readonly eventName: string; constructor(props: H, eventId?: EntityId, occurredOn?: Date) { this.props = props; const event = this.constructor; this.eventName = event.EVENT_NAME ?? this.constructor.name; this.eventId = eventId || new EntityId(); this.occurredOn = occurredOn || new Date(); } toPrimitives(): H { return this.props; }; } // eslint-disable-next-line @typescript-eslint/no-explicit-any export type AnyDomainEvent = DomainEvent; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type DomainEventClass = typeof DomainEvent;