Creates an empty CommandSet object.
Adds all of the commands and events from specified command set into this one.
the CommandSet to add.
Adds a command interceptor to this command set.
the interceptor to add.
Adds a listener to receive notifications on fired events.
the listener to add.
Executes a command specificed by its name.
(optional) transaction id to trace execution through call chain.
the name of that command that is to be executed.
the parameters (arguments) to pass to the command for execution.
the function that is to be called once execution is complete. If an exception is raised, then it will be called with the error (for example: a ValidationException can be thrown).
Searches for a command by its name.
the name of the command to search for.
the command, whose name matches the provided name.
Searches for an event by its name in this command set.
the name of the event to search for.
the event, whose name matches the provided name.
Gets all commands registered in this command set.
a list of commands.
Gets all events registred in this command set.
a list of events.
Fires event specified by its name and notifies all registered listeners
(optional) transaction id to trace execution through call chain.
the name of the event that is to be fired.
the event arguments (parameters).
Removes previosly added listener.
the listener to remove.
Validates args for command specified by its name using defined schema. If validation schema is not defined than the methods returns no errors. It returns validation error if the command is not found.
the name of the command for which the 'args' must be validated.
the parameters (arguments) to validate.
an array of ValidationResults. If no command is found by the given name, then the returned array of ValidationResults will contain a single entry, whose type will be ValidationResultType.Error.
Generated using TypeDoc
Contains a set of commands and events supported by a commandable object. The CommandSet supports command interceptors to extend and the command call chain.
CommandSets can be used as alternative commandable interface to a business object. It can be used to auto generate multiple external services for the business object without writing much code.
Command
Event
ICommandable
Example
export class MyDataCommandSet extends CommandSet { private _controller: IMyDataController; constructor(controller: IMyDataController) { // Any data controller interface super(); this._controller = controller; this.addCommand(this.makeGetMyDataCommand()); } private makeGetMyDataCommand(): ICommand { return new Command( 'get_mydata', null, (correlationId: string, args: Parameters, callback: (err: any, result: any) => void) => { let param = args.getAsString('param'); this._controller.getMyData(correlationId, param, callback); } ); } }