import { Command } from '../../classes'; import { AsyncContext } from '../../scopes/async.context'; import { ICommand } from './command.interface'; /** * Represents a command bus. * * @publicApi */ export interface ICommandBus { /** * Executes a command. * @param command The command to execute. * @returns A promise that, when resolved, will contain the result returned by the command's handler. */ execute(command: Command): Promise; /** * Executes a command. * @param command The command to execute. * @param context The context to use. Optional. * @returns A promise that, when resolved, will contain the result returned by the command's handler. */ execute(command: Command, context?: AsyncContext): Promise; /** * Executes a command. * @param command The command to execute. * @param context The context to use. Optional. * @returns A promise that, when resolved, will contain the result returned by the command's handler. */ execute(command: T, context?: AsyncContext): Promise; }