Setu-TS
    Preparing search index...

    Interface ICommandBus

    Registers and executes commands.

    0.1.0

    interface ICommandBus {
        execute<TResult = unknown>(command: CqrsCommand): Promise<TResult>;
        register<TCommand extends CqrsCommand<unknown>, TResult>(
            type: string,
            handler: ICommandHandler<TCommand, TResult>,
        ): void;
    }

    Implemented by

    Index
    • Executes a command.

      Type Parameters

      • TResult = unknown

        The expected result type

      Parameters

      Returns Promise<TResult>

      The handler's result

      (from the plugin) — as a REJECTION — if no handler is registered for command.type

      — as a REJECTION — if command.type is not a string