@hexadrop/command
Version:
Hexagonal architecture utils library
35 lines (32 loc) • 1.12 kB
TypeScript
import Either from '@hexadrop/either';
import DomainError from '@hexadrop/error';
import CommandBus from './bus.js';
import Command from './command.js';
import CommandHandlers from './command-handlers.js';
import '@hexadrop/types/class';
import '@hexadrop/types/primitives';
/**
* @class SyncCommandBus
* @extends CommandBus
* @description Class representing a synchronous command bus.
*/
declare class SyncCommandBus extends CommandBus {
/**
* @property {CommandHandlers} info - The command handler information.
*/
private readonly info;
/**
* @constructor
* @param {CommandHandlers} info - The command handler information.
*/
constructor(info: CommandHandlers);
/**
* @method dispatch
* @description Method to dispatch a command.
* @param {Command} command - The command to be dispatched.
* @returns {Promise<Either<DomainError, void>>} - The result of the command dispatch.
* @template CommandType - The type of the command.
*/
dispatch(command: Command): Promise<Either<DomainError, void>>;
}
export { SyncCommandBus as default };