1 | /** @module commands */
|
2 | import { IExecutable } from '../run/IExecutable';
|
3 | import { Parameters } from '../run/Parameters';
|
4 | import { ValidationResult } from '../validate/ValidationResult';
|
5 | /**
|
6 | * An interface for Commands, which are part of the Command design pattern.
|
7 | * Each command wraps a method or function and allows to call them in uniform and safe manner.
|
8 | *
|
9 | * @see [[Command]]
|
10 | * @see [[IExecutable]]
|
11 | * @see [[ICommandInterceptor]]
|
12 | * @see [[InterceptedCommand]]
|
13 | */
|
14 | export interface ICommand extends IExecutable {
|
15 | /**
|
16 | * Gets the command name.
|
17 | *
|
18 | * @returns the command name.
|
19 | */
|
20 | getName(): string;
|
21 | /**
|
22 | * Validates command arguments before execution using defined schema.
|
23 | *
|
24 | * @param args the parameters (arguments) to validate.
|
25 | * @returns an array of ValidationResults.
|
26 | *
|
27 | * @see [[Parameters]]
|
28 | * @see [[ValidationResult]]
|
29 | */
|
30 | validate(args: Parameters): ValidationResult[];
|
31 | }
|