import { Context, UseCase } from "almin"; import { DuplicateChecker } from "./DuplicateChecker"; export declare type Construct = { new (...args: any[]): T; }; export declare type Factory = (command: Command) => T; export interface UseCaseBinderArgs { context: Context; CommandConstructors: T[]; useCaseFactories: P[]; duplicateChecker: DuplicateChecker; } export declare class UseCaseBinder> { private context; private CommandConstructors; private useCaseFactories; private duplicateChecker; private hasDelegateNewBiding; constructor(args: UseCaseBinderArgs, P>); /** * Bind the `CommandConstructor` to `useCase` instance. */ bind, V extends UseCase>(CommandConstructor: K, useCase: V): UseCaseBinder | P>; /** * Bind the `CommandConstructor` to `useCaseFactory`. * `useCaseFactory` is factory function to create a UseCase instance. */ bindFactory, V extends Factory>(CommandConstructor: K, useCaseFactory: V): UseCaseBinder; send(command: Command): Promise; private releaseBinding; } /** * A mediator for UseCase and Command. * A UseCase is almin's UseCase implementation. * A Command is UseCase#execute * * @example * * ``` * const container = UseCaseCommandBus * .create(context) * .bind(CommandA, new UseCaseA()) * .bind(CommandB, new UseCaseB()); * container.send(new TestCommandA()) * .then(() => {}) * .catch(error => {}); * ``` * * */ export declare class UseCaseCommandBus { static create(context: Context): UseCaseBinder<{}, never>; }