1 | import { ICommand } from './ICommand';
|
2 | import { Schema } from '../validate/Schema';
|
3 | import { Parameters } from '../run/Parameters';
|
4 | import { ValidationResult } from '../validate/ValidationResult';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare class Command implements ICommand {
|
36 | private _name;
|
37 | private readonly _schema;
|
38 | private readonly _function;
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | constructor(name: string, schema: Schema, func: any);
|
47 | /**
|
48 | * Gets the command name.
|
49 | * @returns the name of this command.
|
50 | */
|
51 | getName(): string;
|
52 | /**
|
53 | * Executes the command. Before execution it validates [[Parameters args]] using
|
54 | * the defined schema. The command execution intercepts exceptions raised
|
55 | * by the called function and returns them as an error in callback.
|
56 | *
|
57 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
58 | * @param args the parameters (arguments) to pass to this command for execution.
|
59 | * @param callback function to be called when command is complete
|
60 | *
|
61 | * @see [[Parameters]]
|
62 | */
|
63 | execute(correlationId: string, args: Parameters, callback: (err: any, result: any) => void): void;
|
64 | /**
|
65 | * Validates the command [[Parameters args]] before execution using the defined schema.
|
66 | *
|
67 | * @param args the parameters (arguments) to validate using this command's schema.
|
68 | * @returns an array of ValidationResults or an empty array (if no schema is set).
|
69 | *
|
70 | * @see [[Parameters]]
|
71 | * @see [[ValidationResult]]
|
72 | */
|
73 | validate(args: Parameters): ValidationResult[];
|
74 | }
|