import { UseCaseExecutor } from "../UseCaseExecutor"; import { Dispatcher } from "../Dispatcher"; import { StoreGroupLike } from "../UILayer/StoreGroupLike"; export interface UseCaseUnitOfWorkOptions { autoCommit: boolean; } export interface UseCaseUnitOfWorkArgs { name: string; dispatcher: Dispatcher; storeGroup: StoreGroupLike; options: UseCaseUnitOfWorkOptions; } /** * UseCaseUnitOfWork is a Unit of Work between UseCase and StoreGroup. * It aim to manager updating of StoreGroup via UseCase. */ export declare class UseCaseUnitOfWork { name: string; private unitOfWork; private dispatcher; private storeGroup; private options; private unsubscribeMap; private isTransactionWorking; private doesReflectActionAtLeastOne; constructor(args: UseCaseUnitOfWorkArgs); /** * Unique id */ get id(): string; /** * Is Unit of Work already disposed? */ get isDisposed(): boolean; /** * current queued commitment size */ get size(): number; /** * count of current working useCases */ get workingUseCaseCount(): number; beginTransaction(): void; /** * Begin transaction of the useCaseExecutor/UseCase */ open(useCaseExecutor: UseCaseExecutor): void; /** * Commit current queued payload to Committable StoreGroup. * After commit, prune current queue. * * ## Notes * * Do `commit()` and then this unit of work will be released. */ commit(): void; private createTransactionEndPayload; /** * End transaction of the useCaseExecutor/UseCase */ close(useCaseExecutor: UseCaseExecutor): void; exit(): void; /** * Release this Unit of Work. * After released, can't commit this Unit of Work. * * Please call `exit` or `commit at once before releasing. */ release(): void; }