nestjs-event-sourcing-lib
Version:
A comprehensive Event Sourcing and CQRS library for NestJS applications
39 lines • 995 B
TypeScript
/**
* Base class for all events in Event Sourcing system
*/
export declare abstract class Event {
/**
* Unique event identifier
*/
readonly id: string;
/**
* Aggregate identifier this event belongs to
*/
readonly aggregateId: string;
/**
* Event type (class name)
*/
readonly eventType: string;
/**
* Event creation timestamp
*/
readonly timestamp: Date;
/**
* Event version for backward compatibility
*/
readonly version: number;
constructor(aggregateId: string, payload?: any, version?: number);
/**
* Serializes event to JSON
*/
toJSON(): Record<string, any>;
/**
* Gets event payload (all properties except metadata)
*/
protected getPayload(): Record<string, any>;
/**
* Creates event instance from JSON
*/
static fromJSON<T extends Event>(this: new (...args: any[]) => T, json: Record<string, any>): T;
}
//# sourceMappingURL=event.d.ts.map