@microsoft/teamsfx-api 0.22.5 → 0.22.6-alpha.0028ae747.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.d.ts +151 -12
- package/build/cli.d.ts.map +1 -1
- package/build/constants.d.ts +1 -2
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +2 -3
- package/build/constants.js.map +1 -1
- package/build/qm/question.d.ts +74 -45
- package/build/qm/question.d.ts.map +1 -1
- package/build/qm/question.js +0 -53
- package/build/qm/question.js.map +1 -1
- package/build/qm/ui.d.ts +28 -13
- package/build/qm/ui.d.ts.map +1 -1
- package/build/qm/validation.d.ts +3 -19
- package/build/qm/validation.d.ts.map +1 -1
- package/build/qm/validation.js +0 -196
- package/build/qm/validation.js.map +1 -1
- package/build/types.d.ts +20 -6
- package/build/types.d.ts.map +1 -1
- package/build/utils/log.d.ts +23 -36
- package/build/utils/log.d.ts.map +1 -1
- package/build/utils/log.js +7 -11
- package/build/utils/log.js.map +1 -1
- package/build/utils/login.d.ts +7 -7
- package/build/utils/login.d.ts.map +1 -1
- package/build/utils/login.js +2 -2
- package/build/utils/login.js.map +1 -1
- package/build/utils/permissionRequest.d.ts +1 -1
- package/package.json +8 -6
package/build/cli.d.ts
CHANGED
|
@@ -1,67 +1,206 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { FxError } from "./error";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type OptionValue = string | boolean | string[] | undefined;
|
|
4
|
+
export type CLIOptionType = "boolean" | "string" | "array";
|
|
5
5
|
export interface CLICommand {
|
|
6
|
+
/**
|
|
7
|
+
* @description command name, only meaningful to its parent command, like "sample"
|
|
8
|
+
*/
|
|
6
9
|
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* @description command aliases
|
|
12
|
+
*/
|
|
13
|
+
aliases?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* @description command full name, like "teamsfx new sample", only available after command finding
|
|
16
|
+
*/
|
|
7
17
|
fullName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description CLI version, only necessary for the root command
|
|
20
|
+
*/
|
|
8
21
|
version?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @description command description
|
|
24
|
+
*/
|
|
9
25
|
description: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description command argument, for example, "teamsfx new sample <sample-name>": sample-name is an argument, which is positional
|
|
28
|
+
*/
|
|
10
29
|
arguments?: CLICommandArgument[];
|
|
30
|
+
/**
|
|
31
|
+
* @description command options, followed by "--" or "-" char, for example, "teamsfx new sample --option1 value1 --option2 value2"
|
|
32
|
+
*/
|
|
33
|
+
options?: CLICommandOption[];
|
|
34
|
+
/**
|
|
35
|
+
* @description whether to sort options in "--help"
|
|
36
|
+
*/
|
|
11
37
|
sortOptions?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @description sub commands, CLI commands are organized in a tree structure, commands can have sub commands
|
|
40
|
+
*/
|
|
41
|
+
commands?: CLICommand[];
|
|
42
|
+
/**
|
|
43
|
+
* @description whether to sort sub commands in "--help"
|
|
44
|
+
*/
|
|
12
45
|
sortCommands?: boolean;
|
|
13
|
-
|
|
46
|
+
/**
|
|
47
|
+
* @description examples of how to use this command
|
|
48
|
+
*/
|
|
14
49
|
examples?: CLIExample[];
|
|
15
|
-
|
|
16
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @description command handler
|
|
52
|
+
*/
|
|
53
|
+
handler?: (ctx: CLIContext) => Promise<Result<undefined, FxError>> | Result<undefined, FxError>;
|
|
54
|
+
/**
|
|
55
|
+
* @description telemetry will be sent when available
|
|
56
|
+
*/
|
|
17
57
|
telemetry?: {
|
|
18
58
|
event: string;
|
|
19
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* @description header message will be printed on the top in "--help"
|
|
62
|
+
*/
|
|
20
63
|
header?: string;
|
|
64
|
+
/**
|
|
65
|
+
* @description footer message will be printed on the bottom in "--help"
|
|
66
|
+
*/
|
|
21
67
|
footer?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description whether to hide this command in "--help"
|
|
70
|
+
*/
|
|
22
71
|
hidden?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @description default value of global option "--interactive", default value is true
|
|
74
|
+
*/
|
|
75
|
+
defaultInteractiveOption?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @description reserve option values in interactive mode
|
|
78
|
+
*/
|
|
79
|
+
reservedOptionNamesInInteractiveMode?: string[];
|
|
80
|
+
}
|
|
81
|
+
export interface CLIFoundCommand extends CLICommand {
|
|
82
|
+
fullName: string;
|
|
23
83
|
}
|
|
24
84
|
export interface CLIContext {
|
|
25
|
-
|
|
85
|
+
/**
|
|
86
|
+
* @description the command matched
|
|
87
|
+
*/
|
|
88
|
+
command: CLIFoundCommand;
|
|
89
|
+
/**
|
|
90
|
+
* @description parsed option values
|
|
91
|
+
*/
|
|
26
92
|
optionValues: Record<string, OptionValue>;
|
|
93
|
+
/**
|
|
94
|
+
* @description parsed global option values, global options are options defined by the root command in the command tree.
|
|
95
|
+
*/
|
|
27
96
|
globalOptionValues: Record<string, OptionValue>;
|
|
28
|
-
|
|
97
|
+
/**
|
|
98
|
+
* @description parsed argument values
|
|
99
|
+
*/
|
|
100
|
+
argumentValues: OptionValue[];
|
|
101
|
+
/**
|
|
102
|
+
* @description telemetry properties, which cen be accessed in the process of command execution lifecycle
|
|
103
|
+
*/
|
|
29
104
|
telemetryProperties: Record<string, string>;
|
|
30
105
|
}
|
|
31
106
|
interface CLICommandOptionBase {
|
|
32
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* @description option/argument name
|
|
109
|
+
* */
|
|
33
110
|
name: string;
|
|
34
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* @description when converting option key-value into @Inputs for FxCore,
|
|
113
|
+
* the key will be used as the property name if defined, otherwise the name will be used
|
|
114
|
+
*/
|
|
35
115
|
questionName?: string;
|
|
116
|
+
/**
|
|
117
|
+
* @description option/argument description
|
|
118
|
+
*/
|
|
36
119
|
description: string;
|
|
120
|
+
/**
|
|
121
|
+
* @description option/argument abbreviation
|
|
122
|
+
*/
|
|
37
123
|
shortName?: string;
|
|
124
|
+
/**
|
|
125
|
+
* @description option/argument value type: boolean, text, array
|
|
126
|
+
*/
|
|
38
127
|
type: CLIOptionType;
|
|
128
|
+
/**
|
|
129
|
+
* @description whether this option/argument is required
|
|
130
|
+
*/
|
|
39
131
|
required?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* @description whether this option/argument is hidden in "--help"
|
|
134
|
+
*/
|
|
40
135
|
hidden?: boolean;
|
|
41
136
|
}
|
|
42
137
|
export interface CLIBooleanOption extends CLICommandOptionBase {
|
|
43
138
|
type: "boolean";
|
|
139
|
+
/**
|
|
140
|
+
* @description default value
|
|
141
|
+
*/
|
|
44
142
|
default?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* @description parsed input value
|
|
145
|
+
*/
|
|
45
146
|
value?: boolean;
|
|
46
147
|
}
|
|
47
148
|
export interface CLIStringOption extends CLICommandOptionBase {
|
|
48
149
|
type: "string";
|
|
150
|
+
/**
|
|
151
|
+
* @description default value
|
|
152
|
+
*/
|
|
49
153
|
default?: string;
|
|
154
|
+
/**
|
|
155
|
+
* @description parsed input value
|
|
156
|
+
*/
|
|
50
157
|
value?: string;
|
|
158
|
+
/**
|
|
159
|
+
* allowed values
|
|
160
|
+
*/
|
|
51
161
|
choices?: string[];
|
|
162
|
+
/**
|
|
163
|
+
* @description whether to skip validation against allowed values defined in choices
|
|
164
|
+
*/
|
|
165
|
+
skipValidation?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* @description command to get choice list
|
|
168
|
+
*/
|
|
52
169
|
choiceListCommand?: string;
|
|
53
170
|
}
|
|
54
171
|
export interface CLIArrayOption extends CLICommandOptionBase {
|
|
55
172
|
type: "array";
|
|
173
|
+
/**
|
|
174
|
+
* @description default value
|
|
175
|
+
*/
|
|
56
176
|
default?: string[];
|
|
177
|
+
/**
|
|
178
|
+
* @description parsed input value
|
|
179
|
+
*/
|
|
180
|
+
value?: string[];
|
|
181
|
+
/**
|
|
182
|
+
* allowed values
|
|
183
|
+
*/
|
|
57
184
|
choices?: string[];
|
|
185
|
+
/**
|
|
186
|
+
* @description whether to skip validation against allowed values defined in choices
|
|
187
|
+
*/
|
|
188
|
+
skipValidation?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @description command to get choice list
|
|
191
|
+
*/
|
|
58
192
|
choiceListCommand?: string;
|
|
59
|
-
value?: string[];
|
|
60
193
|
}
|
|
61
|
-
export
|
|
62
|
-
export
|
|
194
|
+
export type CLICommandOption = CLIBooleanOption | CLIStringOption | CLIArrayOption;
|
|
195
|
+
export type CLICommandArgument = CLICommandOption;
|
|
63
196
|
export interface CLIExample {
|
|
197
|
+
/**
|
|
198
|
+
* @description example command
|
|
199
|
+
*/
|
|
64
200
|
command: string;
|
|
201
|
+
/**
|
|
202
|
+
* @description description of the sample command
|
|
203
|
+
*/
|
|
65
204
|
description: string;
|
|
66
205
|
}
|
|
67
206
|
export {};
|
package/build/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3D,MA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AAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,eAAe,GAAG,cAAc,CAAC;AAEnF,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/build/constants.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export declare const ConfigFolderName = "fx";
|
|
2
2
|
export declare const AppPackageFolderName = "appPackage";
|
|
3
3
|
export declare const BuildFolderName = "build";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const ResponseTemplatesFolderName = "responseTemplates";
|
|
5
5
|
export declare const TemplateFolderName = "templates";
|
|
6
|
-
export declare const LocalEnvironmentName = "local";
|
|
7
6
|
export declare const ProductName = "teamsfx";
|
|
8
7
|
export declare const AutoGeneratedReadme = "README-auto-generated.md";
|
|
9
8
|
export declare const DefaultReadme = "README.md";
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,o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6BAA6B;IACrD,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;CAC5C;AAED,oBAAY,cAAc;IACxB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,iBAAiB;IAC3B,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,IAAI,SAAS;IACb,MAAM,WAAW;CAClB"}
|
package/build/constants.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
"use strict";
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.CoreCallbackEvent = exports.TelemetryProperty = exports.TelemetryEvent = exports.Stage = exports.VsCodeEnv = exports.CLIPlatforms = exports.DynamicPlatforms = exports.StaticPlatforms = exports.Platform = exports.ManifestTemplateFileName = exports.SettingsFolderName = exports.DefaultReadme = exports.AutoGeneratedReadme = exports.ProductName = exports.
|
|
5
|
+
exports.CoreCallbackEvent = exports.TelemetryProperty = exports.TelemetryEvent = exports.Stage = exports.VsCodeEnv = exports.CLIPlatforms = exports.DynamicPlatforms = exports.StaticPlatforms = exports.Platform = exports.ManifestTemplateFileName = exports.SettingsFolderName = exports.DefaultReadme = exports.AutoGeneratedReadme = exports.ProductName = exports.TemplateFolderName = exports.ResponseTemplatesFolderName = exports.BuildFolderName = exports.AppPackageFolderName = exports.ConfigFolderName = void 0;
|
|
6
6
|
exports.ConfigFolderName = "fx";
|
|
7
7
|
exports.AppPackageFolderName = "appPackage";
|
|
8
8
|
exports.BuildFolderName = "build";
|
|
9
|
-
exports.
|
|
9
|
+
exports.ResponseTemplatesFolderName = "responseTemplates";
|
|
10
10
|
exports.TemplateFolderName = "templates";
|
|
11
|
-
exports.LocalEnvironmentName = "local";
|
|
12
11
|
exports.ProductName = "teamsfx";
|
|
13
12
|
exports.AutoGeneratedReadme = "README-auto-generated.md";
|
|
14
13
|
exports.DefaultReadme = "README.md";
|
package/build/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAEA,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,oBAAoB,GAAG,YAAY,CAAC;AACpC,QAAA,eAAe,GAAG,OAAO,CAAC;AAC1B,QAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAEA,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,oBAAoB,GAAG,YAAY,CAAC;AACpC,QAAA,eAAe,GAAG,OAAO,CAAC;AAC1B,QAAA,2BAA2B,GAAG,mBAAmB,CAAC;AAClD,QAAA,kBAAkB,GAAG,WAAW,CAAC;AACjC,QAAA,WAAW,GAAG,SAAS,CAAC;AACxB,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AACjD,QAAA,aAAa,GAAG,WAAW,CAAC;AAC5B,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAExD;;;GAGG;AACH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,0BAAc,CAAA;IACd,uBAAW,CAAA;IACX,qBAAS,CAAA;IACT,iCAAqB,CAAA;AACvB,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB;AAEY,QAAA,eAAe,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACtC,QAAA,gBAAgB,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,EA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qB,CAAA;IACrB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,oCAAe,CAAA;AACjB,CAAC,EANW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAM5B;AAED;;;GAGG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B"}
|
package/build/qm/question.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Inputs, OptionItem } from "../types";
|
|
2
|
-
import { InputTextConfig } from "./ui";
|
|
3
2
|
import { ConditionFunc, FuncValidation, StringArrayValidation, StringValidation, ValidationSchema } from "./validation";
|
|
4
3
|
export interface FunctionRouter {
|
|
5
4
|
namespace: string;
|
|
@@ -11,18 +10,18 @@ export interface Func extends FunctionRouter {
|
|
|
11
10
|
/**
|
|
12
11
|
* definition of a function that return some dynamic value
|
|
13
12
|
*/
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export type LocalFunc<T> = (inputs: Inputs) => T | Promise<T>;
|
|
14
|
+
export type OnSelectionChangeFunc = (currentSelectedIds: Set<string>, previousSelectedIds: Set<string>) => Promise<Set<string>>;
|
|
16
15
|
/**
|
|
17
16
|
* static option is `string` array or `OptionItem` array.
|
|
18
17
|
* If the option is a string array, each element of which will be converted to an `OptionItem` object with `id` and `label` field equal to the string element.
|
|
19
18
|
* For example, option=['id1','id2'] => [{'id':'id1', label:'id1'},{'id':'id2', label:'id2'}].
|
|
20
19
|
*/
|
|
21
|
-
export
|
|
20
|
+
export type StaticOptions = string[] | OptionItem[];
|
|
22
21
|
/**
|
|
23
22
|
* dynamic option is defined by a function
|
|
24
23
|
*/
|
|
25
|
-
export
|
|
24
|
+
export type DynamicOptions = LocalFunc<StaticOptions>;
|
|
26
25
|
/**
|
|
27
26
|
* Basic question data
|
|
28
27
|
*/
|
|
@@ -77,7 +76,7 @@ export interface UserInputQuestion extends BaseQuestion {
|
|
|
77
76
|
/**
|
|
78
77
|
* question type
|
|
79
78
|
*/
|
|
80
|
-
type: "singleSelect" | "multiSelect" | "singleFile" | "multiFile" | "folder" | "text" | "singleFileOrText";
|
|
79
|
+
type: "singleSelect" | "multiSelect" | "singleFile" | "multiFile" | "folder" | "text" | "singleFileOrText" | "innerText" | "confirm";
|
|
81
80
|
/**
|
|
82
81
|
* title is required for human input question
|
|
83
82
|
*/
|
|
@@ -95,7 +94,7 @@ export interface UserInputQuestion extends BaseQuestion {
|
|
|
95
94
|
/**
|
|
96
95
|
* default value of the question
|
|
97
96
|
*/
|
|
98
|
-
default?: string | string[] | LocalFunc<string | string[] | undefined>;
|
|
97
|
+
default?: string | string[] | boolean | LocalFunc<string | string[] | boolean | undefined>;
|
|
99
98
|
/**
|
|
100
99
|
* validation schema for the answer value, which can be static validation schema or dynamic customized validation function
|
|
101
100
|
*/
|
|
@@ -131,6 +130,10 @@ export interface UserInputQuestion extends BaseQuestion {
|
|
|
131
130
|
*/
|
|
132
131
|
cliType?: "option" | "argument";
|
|
133
132
|
cliDescription?: string;
|
|
133
|
+
/**
|
|
134
|
+
* @description the question will converted to a hidden option in CLI
|
|
135
|
+
*/
|
|
136
|
+
cliHidden?: boolean;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
136
139
|
* Definition of single selection question
|
|
@@ -169,6 +172,28 @@ export interface SingleSelectQuestion extends UserInputQuestion {
|
|
|
169
172
|
* the command is only for CLI option description
|
|
170
173
|
*/
|
|
171
174
|
cliChoiceListCommand?: string;
|
|
175
|
+
/**
|
|
176
|
+
* whether to skip validation against allowed list in non-interactive mode, default false
|
|
177
|
+
*/
|
|
178
|
+
skipValidation?: boolean;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Definition of single selection question
|
|
182
|
+
*/
|
|
183
|
+
export interface ConfirmQuestion extends UserInputQuestion {
|
|
184
|
+
type: "confirm";
|
|
185
|
+
/**
|
|
186
|
+
* display text for option true or false
|
|
187
|
+
*/
|
|
188
|
+
transformer?: (value: boolean) => string;
|
|
189
|
+
/**
|
|
190
|
+
* answer value: true or false
|
|
191
|
+
*/
|
|
192
|
+
value?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* The default selected `id` value of the option item
|
|
195
|
+
*/
|
|
196
|
+
default?: boolean | LocalFunc<boolean>;
|
|
172
197
|
}
|
|
173
198
|
/**
|
|
174
199
|
* Definition of multiple selection question
|
|
@@ -218,6 +243,10 @@ export interface MultiSelectQuestion extends UserInputQuestion {
|
|
|
218
243
|
* the command is only for CLI option description
|
|
219
244
|
*/
|
|
220
245
|
cliChoiceListCommand?: string;
|
|
246
|
+
/**
|
|
247
|
+
* whether to skip validation against allowed list in non-interactive mode, default false
|
|
248
|
+
*/
|
|
249
|
+
skipValidation?: boolean;
|
|
221
250
|
}
|
|
222
251
|
/**
|
|
223
252
|
* Definition of text input question
|
|
@@ -246,6 +275,29 @@ export interface TextInputQuestion extends UserInputQuestion {
|
|
|
246
275
|
*/
|
|
247
276
|
additionalValidationOnAccept?: StringValidation | FuncValidation<string>;
|
|
248
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Definition of text input question of a sub-question of SingleFileOrInputQuestion
|
|
280
|
+
*/
|
|
281
|
+
export interface InnerTextInputQuestion extends UserInputQuestion {
|
|
282
|
+
type: "innerText";
|
|
283
|
+
/**
|
|
284
|
+
* If the input value should be hidden. Defaults to false.
|
|
285
|
+
*/
|
|
286
|
+
password?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* input value.
|
|
289
|
+
*/
|
|
290
|
+
value?: string;
|
|
291
|
+
/**
|
|
292
|
+
* default value
|
|
293
|
+
*
|
|
294
|
+
*/
|
|
295
|
+
default?: string | LocalFunc<string | undefined>;
|
|
296
|
+
/**
|
|
297
|
+
* validation schema, which can be a dynamic function closure
|
|
298
|
+
*/
|
|
299
|
+
validation?: StringValidation | FuncValidation<string>;
|
|
300
|
+
}
|
|
249
301
|
/**
|
|
250
302
|
* Definition of single file selection
|
|
251
303
|
*/
|
|
@@ -308,17 +360,6 @@ export interface FolderQuestion extends UserInputQuestion {
|
|
|
308
360
|
*/
|
|
309
361
|
validation?: FuncValidation<string>;
|
|
310
362
|
}
|
|
311
|
-
/**
|
|
312
|
-
* `FuncQuestion` will not show any UI, but load some dynamic data in the question flow;
|
|
313
|
-
* The dynamic data can be referred by the following question.
|
|
314
|
-
*/
|
|
315
|
-
export interface FuncQuestion extends BaseQuestion {
|
|
316
|
-
type: "func";
|
|
317
|
-
/**
|
|
318
|
-
* A function that will be called to when the question is activated.
|
|
319
|
-
*/
|
|
320
|
-
func: LocalFunc<any>;
|
|
321
|
-
}
|
|
322
363
|
export interface SingleFileOrInputQuestion extends UserInputQuestion {
|
|
323
364
|
type: "singleFileOrText";
|
|
324
365
|
/**
|
|
@@ -328,7 +369,7 @@ export interface SingleFileOrInputQuestion extends UserInputQuestion {
|
|
|
328
369
|
/**
|
|
329
370
|
* Config for the input box.
|
|
330
371
|
*/
|
|
331
|
-
inputBoxConfig:
|
|
372
|
+
inputBoxConfig: InnerTextInputQuestion;
|
|
332
373
|
/**
|
|
333
374
|
* This will only take effect in VSC.
|
|
334
375
|
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
@@ -351,42 +392,30 @@ export interface Group {
|
|
|
351
392
|
type: "group";
|
|
352
393
|
name?: string;
|
|
353
394
|
}
|
|
354
|
-
export
|
|
395
|
+
export type Question = SingleSelectQuestion | MultiSelectQuestion | TextInputQuestion | SingleFileQuestion | MultiFileQuestion | FolderQuestion | SingleFileQuestion | SingleFileOrInputQuestion | ConfirmQuestion;
|
|
355
396
|
/**
|
|
356
|
-
*
|
|
397
|
+
* IQTreeNode is the tree node data structure, which have three main properties:
|
|
357
398
|
* - data: data is either a group or question. Questions can be organized into a group, which has the same trigger condition.
|
|
358
399
|
* - condition: trigger condition for this node to be activated;
|
|
359
400
|
* - children: child questions that will be activated according their trigger condition.
|
|
360
401
|
*/
|
|
361
|
-
export declare class QTreeNode implements IQTreeNode {
|
|
362
|
-
data: Question | Group;
|
|
363
|
-
condition?: StringValidation | StringArrayValidation | ConditionFunc;
|
|
364
|
-
children?: QTreeNode[];
|
|
365
|
-
/**
|
|
366
|
-
* @description the question is only for interactive mode, if defined, the question will be skipped in non-interactive mode
|
|
367
|
-
* "self" - only skip the question itself
|
|
368
|
-
* "children" - skip all children
|
|
369
|
-
* "all" - skip self and all children
|
|
370
|
-
*/
|
|
371
|
-
interactiveOnly?: "self" | "children" | "all";
|
|
372
|
-
addChild(node: QTreeNode): QTreeNode;
|
|
373
|
-
validate(): boolean;
|
|
374
|
-
/**
|
|
375
|
-
* trim the tree
|
|
376
|
-
*/
|
|
377
|
-
trim(): QTreeNode | undefined;
|
|
378
|
-
constructor(data: Question | Group);
|
|
379
|
-
}
|
|
380
402
|
export interface IQTreeNode {
|
|
381
403
|
data: Question | Group;
|
|
382
404
|
condition?: StringValidation | StringArrayValidation | ConditionFunc;
|
|
383
405
|
children?: IQTreeNode[];
|
|
384
406
|
/**
|
|
385
|
-
* @description the question
|
|
386
|
-
* "self" - only
|
|
387
|
-
* "children" -
|
|
388
|
-
* "all" -
|
|
407
|
+
* @description the question node will be ignored as CLI option in non-interactive mode
|
|
408
|
+
* "self" - only ignore the question itself
|
|
409
|
+
* "children" - ignore all nodes in sub-tree
|
|
410
|
+
* "all" - ignore self and all nodes in sub-tree
|
|
411
|
+
*/
|
|
412
|
+
cliOptionDisabled?: "self" | "children" | "all";
|
|
413
|
+
/**
|
|
414
|
+
* @description the question node will be ignored as an Inputs property
|
|
415
|
+
* "self" - only ignore the question itself
|
|
416
|
+
* "children" - ignore all nodes in sub-tree
|
|
417
|
+
* "all" - ignore self and all nodes in sub-tree
|
|
389
418
|
*/
|
|
390
|
-
|
|
419
|
+
inputsDisabled?: "self" | "children" | "all";
|
|
391
420
|
}
|
|
392
421
|
//# sourceMappingURL=question.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../src/qm/question.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../src/qm/question.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAK,SAAQ,cAAc;IAC1C,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,qBAAqB,GAAG,CAClC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC/B,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,KAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,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B;;OAEG;IACH,eAAe,EAAE,UAAU,CAAC;IAE5B;;OAEG;IACH,cAAc,EAAE,sBAAsB,CAAC;IAEvC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,QAAQ,GAChB,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,yBAAyB,GACzB,eAAe,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,SAAS,CAAC,EAAE,gBAAgB,GAAG,qBAAqB,GAAG,aAAa,CAAC;IACrE,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IAChD;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;CAC9C"}
|
package/build/qm/question.js
CHANGED
|
@@ -2,57 +2,4 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.QTreeNode = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* QTreeNode is the tree node data structure, which have three main properties:
|
|
8
|
-
* - data: data is either a group or question. Questions can be organized into a group, which has the same trigger condition.
|
|
9
|
-
* - condition: trigger condition for this node to be activated;
|
|
10
|
-
* - children: child questions that will be activated according their trigger condition.
|
|
11
|
-
*/
|
|
12
|
-
class QTreeNode {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
this.data = data;
|
|
15
|
-
}
|
|
16
|
-
addChild(node) {
|
|
17
|
-
if (!this.children) {
|
|
18
|
-
this.children = [];
|
|
19
|
-
}
|
|
20
|
-
this.children.push(node);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
validate() {
|
|
24
|
-
//1. validate the cycle dependency
|
|
25
|
-
//2. validate the name uniqueness
|
|
26
|
-
//3. validate the params of RPC
|
|
27
|
-
// if (this.data.type === NodeType.group && (!this.children || this.children.length === 0)) return false;
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* trim the tree
|
|
32
|
-
*/
|
|
33
|
-
trim() {
|
|
34
|
-
if (this.children) {
|
|
35
|
-
const newChildren = [];
|
|
36
|
-
for (const node of this.children) {
|
|
37
|
-
const trimmed = node.trim();
|
|
38
|
-
if (trimmed)
|
|
39
|
-
newChildren.push(trimmed);
|
|
40
|
-
}
|
|
41
|
-
this.children = newChildren;
|
|
42
|
-
}
|
|
43
|
-
if (this.data.type === "group") {
|
|
44
|
-
if (!this.children || this.children.length === 0)
|
|
45
|
-
return undefined;
|
|
46
|
-
if (this.children.length === 1) {
|
|
47
|
-
const child = this.children[0];
|
|
48
|
-
if (!(this.condition && child.condition)) {
|
|
49
|
-
child.condition || (child.condition = this.condition);
|
|
50
|
-
return child;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.QTreeNode = QTreeNode;
|
|
58
5
|
//# sourceMappingURL=question.js.map
|
package/build/qm/question.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/qm/question.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/qm/question.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|