A unique name for the command, used for identification and debugging purposes. This is not necessarily the same as the keyword used to invoke the command in rules, but it should be descriptive of the command's purpose.
Indicates whether the command should be executed immediately when invoked. Immediate commands are executed synchronously and cannot have an asynchronous executeAsync function.
The keyword used to invoke the command in rules. This must be unique across all registered commands, and should ideally be expressive but short. No spaces or special characters are allowed in the keyword - only letters, numbers, and underscores.
A record of argument names and their expected types for this command. This is used for validating command invocations and providing better error messages when arguments are missing or of the wrong type. The types should be defined using the AtomicType interface from the rules engine's type system.
OptionalexecuteThe function to execute when the command is invoked. This function is called with the arguments specified in the command's arguments property.
The arguments passed to the command when it is invoked.
The result of the command execution.
OptionalexecuteThe asynchronous function to execute when the command is invoked. This function is called with the arguments specified in the command's arguments property.
The arguments passed to the command when it is invoked.
A promise that resolves with the result of the command execution.
Interface representing a command that can be registered in the CommandRegistry and executed within the rules engine. Commands are reusable actions that can be invoked from rules using the "RUN" syntax. Implement this interface to provide custom code to extend the capabilities of the rules engine beyond what is possible with built-in syntax and functions. Immediate commands must only implement the execute method, and cannot have an executeAsync function. Deferred commands can implement either execute or executeAsync, but not both.