@dugongjs/core
Version:
30 lines (29 loc) • 1.6 kB
TypeScript
import type { EventSourcedAggregateRoot } from "../../domain/abstract-event-sourced-aggregate-root/event-sourced-aggregate-root.js";
import type { ITransactionManager } from "../../ports/index.js";
import { AbstractTransactionCoordinator } from "../abstract-transaction-coordinator/abstract-transaction-coordinator.js";
import type { ILogger } from "../logger/i-logger.js";
export type AbstractAggregateHandlerOptions<TAggregateRootClass extends EventSourcedAggregateRoot> = {
aggregateClass: TAggregateRootClass;
transactionManager: ITransactionManager;
currentOrigin: string;
tenantId?: string | null;
logger?: ILogger;
};
/**
* Abstract class for interacting with aggregates in the application layer.
* Provides common functionality for aggregate handlers, such as logging and transaction management.
*/
export declare abstract class AbstractAggregateHandler<TAggregateRootClass extends EventSourcedAggregateRoot> extends AbstractTransactionCoordinator {
protected readonly aggregateClass: TAggregateRootClass;
protected readonly logger: ILogger;
protected readonly logContext: any;
protected readonly currentOrigin: string;
protected readonly tenantId?: string | null;
protected readonly isInternalAggregate: boolean;
protected readonly aggregateOrigin: string;
protected readonly aggregateType: string;
protected readonly isSnapshotable: boolean;
protected readonly snapshotInterval: number;
constructor(options: AbstractAggregateHandlerOptions<TAggregateRootClass>);
protected getLogContext(aggregateId: string): any;
}