nestjs-event-sourcing-lib
Version:
A comprehensive Event Sourcing and CQRS library for NestJS applications
33 lines • 842 B
TypeScript
/**
* Base class for all commands in CQRS system
*/
export declare abstract class Command {
/**
* Unique command identifier
*/
readonly commandId: string;
/**
* Aggregate identifier this command targets
*/
readonly aggregateId: string;
/**
* Command creation timestamp
*/
readonly timestamp: Date;
/**
* Command metadata (user, session, etc.)
*/
readonly metadata?: Record<string, any>;
constructor(aggregateId: string, metadata?: Record<string, any>);
validate(): Promise<void>;
getCommandName(): string;
/**
* Serializes command to JSON
*/
toJSON(): Record<string, any>;
/**
* Gets command payload (all properties except metadata)
*/
protected getPayload(): Record<string, any>;
}
//# sourceMappingURL=command.d.ts.map