This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
IChainedHandlerArgumentMapping.ts
78 lines (73 loc) · 2.99 KB
/
IChainedHandlerArgumentMapping.ts
1
2
3
4
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
/**
* Interface describing constructing command line arguments for
* chained handlers.
*/
export interface IChainedHandlerArgumentMapping {
/**
* Dot notation property e.g. files[0].filename to copy from the
* command response's data field (set via response.data.setObj) of this chained handler to a future chained handler.
* If mapFromArguments is specified, the mapping will be from the overall command's arguments
* (the command comprised of these chained handlers and mappings).
*
* Mutually exclusive with 'value'.
* The dot notation field is retrieved with the dataobject-parser package.
* @type {string}
* @memberOf IChainedHandlerArgumentMapping
*/
from?: string;
/**
* If you specify this, values will be copied from the overall command's arguments
* instead of the command response of the current handler.
* Has no meaning if paired with 'value'
* @type {boolean}
* @memberOf IChainedHandlerArgumentMapping
*/
mapFromArguments?: boolean;
/**
* Is this mapping optional?
* Unless this is true, an error will be thrown if "from" is specified and the specified
* field is not found on the command response.
* @type {boolean}
* @memberOf IChainedHandlerArgumentMapping
*/
optional?: boolean;
/**
* The name of an argument e.g. "filename" that will be inserted into the "arguments"
* field of the handler parameters for the future chained handler.
* Required.
* @type {string}
* @memberOf IChainedHandlerArgumentMapping
*/
to: string;
/**
* Hard-code a value to pass to the "to" argument field.
* Mutually exclusive with "from".
* Note: the value should be serializable, since command definitions should be
* able to be fully represented in JSON. Values that are not preserved when
* doing JSON.parse(JSON.stringify(value)) will cause an error.
* @type {any}
* @memberOf IChainedHandlerArgumentMapping
*/
value?: any;
/**
* Which future handlers does this apply to? Optional.
* Specify any number of positive integers. The number represents an index ahead of the current handler.
* For example, 1 is the next handler and 2 is the handler after next.
* You can specify [0] to apply to the current handler, however in that case you must specify "value",
* and not "from", since the arguments will be applied before the response object from the handler is available.
* If omitted, the mapping applies to the next handler (equivalent to a value of [1] for this field)
* @type {number[]}
* @memberOf IChainedHandlerArgumentMapping
*/
applyToHandlers?: number[];
}