interface Command

A Command.

It is generally preferred dispatchDirectCommand where the command definition is implicit, and more fully type checked.

This, along with dispatchCommand is available if you wish to separate your code more fully, or introduce a remote capable message based command bus.

Properties

execute

The command handler function. The data will be received from the CommandIntent

This may be called concurrently.

This should attempt to modify the system and then emit events to represent the change.

Signature
execute: (data: I) => Promise<CommandReturn<O>>;

streamToEmit

The event stream that any events in the CommandReturn should be emitted on

Signature
streamToEmit: string;

type

The name of the Command. This is used to look it up when the user calls dispatchCommand

Signature
type: string;