@microsoft/teamsfx-api 0.22.4-alpha.b3cdd7bd5.0 → 0.22.4-alpha.b52d172b5.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 +203 -0
- package/build/cli.d.ts.map +1 -0
- package/build/{v3/core.js → cli.js} +1 -1
- package/build/cli.js.map +1 -0
- package/build/constants.d.ts +4 -9
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +4 -9
- package/build/constants.js.map +1 -1
- package/build/context.d.ts +9 -28
- package/build/context.d.ts.map +1 -1
- package/build/error.d.ts +4 -0
- package/build/error.d.ts.map +1 -1
- package/build/error.js +6 -4
- package/build/error.js.map +1 -1
- package/build/index.d.ts +5 -14
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -15
- package/build/index.js.map +1 -1
- package/build/qm/question.d.ts +134 -26
- 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 +72 -15
- package/build/qm/ui.d.ts.map +1 -1
- package/build/qm/validation.d.ts +7 -18
- package/build/qm/validation.d.ts.map +1 -1
- package/build/qm/validation.js +0 -159
- package/build/qm/validation.js.map +1 -1
- package/build/types.d.ts +73 -148
- package/build/types.d.ts.map +1 -1
- package/build/types.js +8 -87
- package/build/types.js.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 +4 -4
- package/build/utils/login.d.ts.map +1 -1
- package/build/utils/login.js +4 -4
- package/build/utils/login.js.map +1 -1
- package/build/utils/telemetry.d.ts.map +1 -1
- package/package.json +8 -6
- package/build/action.d.ts +0 -109
- package/build/action.d.ts.map +0 -1
- package/build/action.js +0 -5
- package/build/action.js.map +0 -1
- package/build/bicep.d.ts +0 -19
- package/build/bicep.d.ts.map +0 -1
- package/build/bicep.js +0 -5
- package/build/bicep.js.map +0 -1
- package/build/component.d.ts +0 -31
- package/build/component.d.ts.map +0 -1
- package/build/component.js +0 -3
- package/build/component.js.map +0 -1
- package/build/core.d.ts +0 -50
- package/build/core.d.ts.map +0 -1
- package/build/core.js +0 -5
- package/build/core.js.map +0 -1
- package/build/v2/index.d.ts +0 -2
- package/build/v2/index.d.ts.map +0 -1
- package/build/v2/index.js +0 -7
- package/build/v2/index.js.map +0 -1
- package/build/v2/types.d.ts +0 -32
- package/build/v2/types.d.ts.map +0 -1
- package/build/v2/types.js +0 -5
- package/build/v2/types.js.map +0 -1
- package/build/v3/AzureResourceStates.d.ts +0 -58
- package/build/v3/AzureResourceStates.d.ts.map +0 -1
- package/build/v3/AzureResourceStates.js +0 -3
- package/build/v3/AzureResourceStates.js.map +0 -1
- package/build/v3/core.d.ts +0 -15
- package/build/v3/core.d.ts.map +0 -1
- package/build/v3/core.js.map +0 -1
- package/build/v3/index.d.ts +0 -7
- package/build/v3/index.d.ts.map +0 -1
- package/build/v3/index.js +0 -12
- package/build/v3/index.js.map +0 -1
- package/build/v3/plugins.d.ts +0 -12
- package/build/v3/plugins.d.ts.map +0 -1
- package/build/v3/plugins.js +0 -5
- package/build/v3/plugins.js.map +0 -1
- package/build/v3/resourceStates.d.ts +0 -66
- package/build/v3/resourceStates.d.ts.map +0 -1
- package/build/v3/resourceStates.js +0 -5
- package/build/v3/resourceStates.js.map +0 -1
- package/build/v3/solution.d.ts +0 -40
- package/build/v3/solution.d.ts.map +0 -1
- package/build/v3/solution.js +0 -5
- package/build/v3/solution.js.map +0 -1
- package/build/v3/types.d.ts +0 -28
- package/build/v3/types.d.ts.map +0 -1
- package/build/v3/types.js +0 -5
- package/build/v3/types.js.map +0 -1
- package/build/vscode.d.ts +0 -22
- package/build/vscode.d.ts.map +0 -1
- package/build/vscode.js +0 -5
- package/build/vscode.js.map +0 -1
package/build/qm/question.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Inputs, OptionItem } from "../types";
|
|
2
|
-
import { FuncValidation, StringArrayValidation, StringValidation, ValidationSchema } from "./validation";
|
|
2
|
+
import { ConditionFunc, FuncValidation, StringArrayValidation, StringValidation, ValidationSchema } from "./validation";
|
|
3
3
|
export interface FunctionRouter {
|
|
4
4
|
namespace: string;
|
|
5
5
|
method: string;
|
|
@@ -10,18 +10,18 @@ export interface Func extends FunctionRouter {
|
|
|
10
10
|
/**
|
|
11
11
|
* definition of a function that return some dynamic value
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type LocalFunc<T> = (inputs: Inputs) => T | Promise<T>;
|
|
14
|
+
export type OnSelectionChangeFunc = (currentSelectedIds: Set<string>, previousSelectedIds: Set<string>) => Promise<Set<string>>;
|
|
15
15
|
/**
|
|
16
16
|
* static option is `string` array or `OptionItem` array.
|
|
17
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.
|
|
18
18
|
* For example, option=['id1','id2'] => [{'id':'id1', label:'id1'},{'id':'id2', label:'id2'}].
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type StaticOptions = string[] | OptionItem[];
|
|
21
21
|
/**
|
|
22
22
|
* dynamic option is defined by a function
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type DynamicOptions = LocalFunc<StaticOptions>;
|
|
25
25
|
/**
|
|
26
26
|
* Basic question data
|
|
27
27
|
*/
|
|
@@ -38,6 +38,7 @@ export interface BaseQuestion {
|
|
|
38
38
|
* the answer of the question
|
|
39
39
|
*/
|
|
40
40
|
value?: unknown;
|
|
41
|
+
valueType?: "skip" | "success";
|
|
41
42
|
/**
|
|
42
43
|
* default input value
|
|
43
44
|
*/
|
|
@@ -75,7 +76,7 @@ export interface UserInputQuestion extends BaseQuestion {
|
|
|
75
76
|
/**
|
|
76
77
|
* question type
|
|
77
78
|
*/
|
|
78
|
-
type: "singleSelect" | "multiSelect" | "singleFile" | "multiFile" | "folder" | "text";
|
|
79
|
+
type: "singleSelect" | "multiSelect" | "singleFile" | "multiFile" | "folder" | "text" | "singleFileOrText" | "innerText";
|
|
79
80
|
/**
|
|
80
81
|
* title is required for human input question
|
|
81
82
|
*/
|
|
@@ -102,6 +103,37 @@ export interface UserInputQuestion extends BaseQuestion {
|
|
|
102
103
|
* An optional validation message indicating or explaining the problem with the current input value.
|
|
103
104
|
*/
|
|
104
105
|
validationHelp?: string;
|
|
106
|
+
/**
|
|
107
|
+
* A flag to indicate whether the question is required for CLI non-interactive mode.
|
|
108
|
+
* Default value is false.
|
|
109
|
+
* If not explicitly defined, the framework will try to fillin this field.
|
|
110
|
+
*/
|
|
111
|
+
required?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* alternative names of the question that use to map the input properties into final Input object
|
|
114
|
+
*/
|
|
115
|
+
alternativeNames?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* CLI option/argument name, if not specified, the question name will be used as the CLI option/argument name
|
|
118
|
+
*/
|
|
119
|
+
cliName?: string;
|
|
120
|
+
/**
|
|
121
|
+
* the question is only for CLI option abbrevation
|
|
122
|
+
*/
|
|
123
|
+
cliShortName?: string;
|
|
124
|
+
/**
|
|
125
|
+
* whether the value is a boolean string value, if true, it will support '--option', which is equivalant to '--option true'
|
|
126
|
+
*/
|
|
127
|
+
isBoolean?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* whether the question is mapped to CLI option or argument, default is option
|
|
130
|
+
*/
|
|
131
|
+
cliType?: "option" | "argument";
|
|
132
|
+
cliDescription?: string;
|
|
133
|
+
/**
|
|
134
|
+
* @description the question will converted to a hidden option in CLI
|
|
135
|
+
*/
|
|
136
|
+
cliHidden?: boolean;
|
|
105
137
|
}
|
|
106
138
|
/**
|
|
107
139
|
* Definition of single selection question
|
|
@@ -136,6 +168,14 @@ export interface SingleSelectQuestion extends UserInputQuestion {
|
|
|
136
168
|
* if false: use still need to do the selection manually even there is no other choice.
|
|
137
169
|
*/
|
|
138
170
|
skipSingleOption?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* the command is only for CLI option description
|
|
173
|
+
*/
|
|
174
|
+
cliChoiceListCommand?: string;
|
|
175
|
+
/**
|
|
176
|
+
* whether to skip validation against allowed list in non-interactive mode, default false
|
|
177
|
+
*/
|
|
178
|
+
skipValidation?: boolean;
|
|
139
179
|
}
|
|
140
180
|
/**
|
|
141
181
|
* Definition of multiple selection question
|
|
@@ -181,6 +221,14 @@ export interface MultiSelectQuestion extends UserInputQuestion {
|
|
|
181
221
|
* validation schema for the answer values
|
|
182
222
|
*/
|
|
183
223
|
validation?: StringArrayValidation | FuncValidation<string[]>;
|
|
224
|
+
/**
|
|
225
|
+
* the command is only for CLI option description
|
|
226
|
+
*/
|
|
227
|
+
cliChoiceListCommand?: string;
|
|
228
|
+
/**
|
|
229
|
+
* whether to skip validation against allowed list in non-interactive mode, default false
|
|
230
|
+
*/
|
|
231
|
+
skipValidation?: boolean;
|
|
184
232
|
}
|
|
185
233
|
/**
|
|
186
234
|
* Definition of text input question
|
|
@@ -204,6 +252,33 @@ export interface TextInputQuestion extends UserInputQuestion {
|
|
|
204
252
|
* validation schema, which can be a dynamic function closure
|
|
205
253
|
*/
|
|
206
254
|
validation?: StringValidation | FuncValidation<string>;
|
|
255
|
+
/**
|
|
256
|
+
* validation when user confirms the input.
|
|
257
|
+
*/
|
|
258
|
+
additionalValidationOnAccept?: StringValidation | FuncValidation<string>;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Definition of text input question of a sub-question of SingleFileOrInputQuestion
|
|
262
|
+
*/
|
|
263
|
+
export interface InnerTextInputQuestion extends UserInputQuestion {
|
|
264
|
+
type: "innerText";
|
|
265
|
+
/**
|
|
266
|
+
* If the input value should be hidden. Defaults to false.
|
|
267
|
+
*/
|
|
268
|
+
password?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* input value.
|
|
271
|
+
*/
|
|
272
|
+
value?: string;
|
|
273
|
+
/**
|
|
274
|
+
* default value
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
default?: string | LocalFunc<string | undefined>;
|
|
278
|
+
/**
|
|
279
|
+
* validation schema, which can be a dynamic function closure
|
|
280
|
+
*/
|
|
281
|
+
validation?: StringValidation | FuncValidation<string>;
|
|
207
282
|
}
|
|
208
283
|
/**
|
|
209
284
|
* Definition of single file selection
|
|
@@ -222,6 +297,20 @@ export interface SingleFileQuestion extends UserInputQuestion {
|
|
|
222
297
|
* validation function
|
|
223
298
|
*/
|
|
224
299
|
validation?: FuncValidation<string>;
|
|
300
|
+
/**
|
|
301
|
+
* This will only take effect in VSC.
|
|
302
|
+
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
303
|
+
* like "TypeScript", and an array of extensions, e.g.
|
|
304
|
+
* ```ts
|
|
305
|
+
* {
|
|
306
|
+
* 'Images': ['png', 'jpg']
|
|
307
|
+
* 'TypeScript': ['ts', 'tsx']
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
filters?: {
|
|
312
|
+
[name: string]: string[];
|
|
313
|
+
};
|
|
225
314
|
}
|
|
226
315
|
export interface MultiFileQuestion extends UserInputQuestion {
|
|
227
316
|
type: "multiFile";
|
|
@@ -253,16 +342,30 @@ export interface FolderQuestion extends UserInputQuestion {
|
|
|
253
342
|
*/
|
|
254
343
|
validation?: FuncValidation<string>;
|
|
255
344
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
345
|
+
export interface SingleFileOrInputQuestion extends UserInputQuestion {
|
|
346
|
+
type: "singleFileOrText";
|
|
347
|
+
/**
|
|
348
|
+
* An item shown in the list in VSC that user can click to input text.
|
|
349
|
+
*/
|
|
350
|
+
inputOptionItem: OptionItem;
|
|
351
|
+
/**
|
|
352
|
+
* Config for the input box.
|
|
353
|
+
*/
|
|
354
|
+
inputBoxConfig: InnerTextInputQuestion;
|
|
262
355
|
/**
|
|
263
|
-
*
|
|
356
|
+
* This will only take effect in VSC.
|
|
357
|
+
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
358
|
+
* like "TypeScript", and an array of extensions, e.g.
|
|
359
|
+
* ```ts
|
|
360
|
+
* {
|
|
361
|
+
* 'Images': ['png', 'jpg']
|
|
362
|
+
* 'TypeScript': ['ts', 'tsx']
|
|
363
|
+
* }
|
|
364
|
+
* ```
|
|
264
365
|
*/
|
|
265
|
-
|
|
366
|
+
filters?: {
|
|
367
|
+
[name: string]: string[];
|
|
368
|
+
};
|
|
266
369
|
}
|
|
267
370
|
/**
|
|
268
371
|
* `Group` is a virtual node in the question tree that wraps a group of questions, which share the same activation condition in this group.
|
|
@@ -271,25 +374,30 @@ export interface Group {
|
|
|
271
374
|
type: "group";
|
|
272
375
|
name?: string;
|
|
273
376
|
}
|
|
274
|
-
export
|
|
377
|
+
export type Question = SingleSelectQuestion | MultiSelectQuestion | TextInputQuestion | SingleFileQuestion | MultiFileQuestion | FolderQuestion | SingleFileQuestion | SingleFileOrInputQuestion;
|
|
275
378
|
/**
|
|
276
|
-
*
|
|
379
|
+
* IQTreeNode is the tree node data structure, which have three main properties:
|
|
277
380
|
* - data: data is either a group or question. Questions can be organized into a group, which has the same trigger condition.
|
|
278
381
|
* - condition: trigger condition for this node to be activated;
|
|
279
382
|
* - children: child questions that will be activated according their trigger condition.
|
|
280
383
|
*/
|
|
281
|
-
export
|
|
384
|
+
export interface IQTreeNode {
|
|
282
385
|
data: Question | Group;
|
|
283
|
-
condition?:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
386
|
+
condition?: StringValidation | StringArrayValidation | ConditionFunc;
|
|
387
|
+
children?: IQTreeNode[];
|
|
388
|
+
/**
|
|
389
|
+
* @description the question node will be ignored as CLI option in non-interactive mode
|
|
390
|
+
* "self" - only ignore the question itself
|
|
391
|
+
* "children" - ignore all nodes in sub-tree
|
|
392
|
+
* "all" - ignore self and all nodes in sub-tree
|
|
393
|
+
*/
|
|
394
|
+
cliOptionDisabled?: "self" | "children" | "all";
|
|
289
395
|
/**
|
|
290
|
-
*
|
|
396
|
+
* @description the question node will be ignored as an Inputs property
|
|
397
|
+
* "self" - only ignore the question itself
|
|
398
|
+
* "children" - ignore all nodes in sub-tree
|
|
399
|
+
* "all" - ignore self and all nodes in sub-tree
|
|
291
400
|
*/
|
|
292
|
-
|
|
293
|
-
constructor(data: Question | Group);
|
|
401
|
+
inputsDisabled?: "self" | "children" | "all";
|
|
294
402
|
}
|
|
295
403
|
//# 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;
|
|
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;AAE9C,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,CAA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,SAAQ,iBAAiB;IAClE,IAAI,EAAE,kBAAkB,CAAC;IACzB;;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,CAAC;AAE9B;;;;;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"}
|
package/build/qm/ui.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface UIConfig<T> {
|
|
|
36
36
|
/**
|
|
37
37
|
* default input value
|
|
38
38
|
*/
|
|
39
|
-
default?: T;
|
|
39
|
+
default?: T | (() => Promise<T>);
|
|
40
40
|
/**
|
|
41
41
|
* A function that will be called to validate input and to give a hint to the user.
|
|
42
42
|
*
|
|
@@ -63,23 +63,29 @@ export interface UIConfig<T> {
|
|
|
63
63
|
*/
|
|
64
64
|
export interface SingleSelectConfig extends UIConfig<string> {
|
|
65
65
|
/**
|
|
66
|
-
* option array
|
|
66
|
+
* option array or a callback function which returns option array
|
|
67
67
|
*/
|
|
68
|
-
options: StaticOptions;
|
|
68
|
+
options: StaticOptions | (() => Promise<StaticOptions>);
|
|
69
|
+
default?: string | (() => Promise<string>);
|
|
69
70
|
/**
|
|
70
71
|
* This config only works for option items with `OptionItem[]` type. If `returnObject` is true, the answer value is an `OptionItem` object; otherwise, the answer value is the `id` string of the `OptionItem`.
|
|
71
72
|
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string.
|
|
72
73
|
*/
|
|
73
74
|
returnObject?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* whether skip selection if there is only one option, default is false
|
|
77
|
+
*/
|
|
78
|
+
skipSingleOption?: boolean;
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
76
81
|
* multiple selection UI config
|
|
77
82
|
*/
|
|
78
83
|
export interface MultiSelectConfig extends UIConfig<string[]> {
|
|
79
84
|
/**
|
|
80
|
-
* option array
|
|
85
|
+
* option array or a callback function which returns option array
|
|
81
86
|
*/
|
|
82
|
-
options: StaticOptions;
|
|
87
|
+
options: StaticOptions | (() => Promise<StaticOptions>);
|
|
88
|
+
default?: string[] | (() => Promise<string[]>);
|
|
83
89
|
/**
|
|
84
90
|
* This config only works for option items with `OptionItem[]` type. If `returnObject` is true, the answer value is an array of `OptionItem` objects; otherwise, the answer value is an array of `id` strings.
|
|
85
91
|
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string array.
|
|
@@ -92,6 +98,10 @@ export interface MultiSelectConfig extends UIConfig<string[]> {
|
|
|
92
98
|
* @returns the final selected option ids
|
|
93
99
|
*/
|
|
94
100
|
onDidChangeSelection?: OnSelectionChangeFunc;
|
|
101
|
+
/**
|
|
102
|
+
* whether skip selection if there is only one option, default is false
|
|
103
|
+
*/
|
|
104
|
+
skipSingleOption?: boolean;
|
|
95
105
|
}
|
|
96
106
|
/**
|
|
97
107
|
* text input UI config
|
|
@@ -101,12 +111,22 @@ export interface InputTextConfig extends UIConfig<string> {
|
|
|
101
111
|
* If the input value should be hidden. Defaults to false.
|
|
102
112
|
*/
|
|
103
113
|
password?: boolean;
|
|
114
|
+
default?: string | (() => Promise<string>);
|
|
115
|
+
/**
|
|
116
|
+
* A function that will be called to validate the input that user accepted.
|
|
117
|
+
*
|
|
118
|
+
* @param input The current value of the input to be validated.
|
|
119
|
+
* @return A human-readable string which is presented as diagnostic message.
|
|
120
|
+
* Return `undefined` when 'value' is valid.
|
|
121
|
+
*/
|
|
122
|
+
additionalValidationOnAccept?: (input: string) => string | undefined | Promise<string | undefined>;
|
|
104
123
|
}
|
|
105
124
|
/**
|
|
106
125
|
* single file selector config
|
|
107
126
|
*/
|
|
108
|
-
export
|
|
127
|
+
export type SelectFileConfig = UIConfig<string> & {
|
|
109
128
|
/**
|
|
129
|
+
* This will only take effect in VSC.
|
|
110
130
|
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
111
131
|
* like "TypeScript", and an array of extensions, e.g.
|
|
112
132
|
* ```ts
|
|
@@ -119,6 +139,7 @@ export declare type SelectFileConfig = UIConfig<string> & {
|
|
|
119
139
|
filters?: {
|
|
120
140
|
[name: string]: string[];
|
|
121
141
|
};
|
|
142
|
+
default?: string | (() => Promise<string>);
|
|
122
143
|
/**
|
|
123
144
|
* Possible files that will be listed for users to select.
|
|
124
145
|
* The id cannot be "default" or "browse" as they are reserved for default and browse options.
|
|
@@ -132,8 +153,9 @@ export declare type SelectFileConfig = UIConfig<string> & {
|
|
|
132
153
|
/**
|
|
133
154
|
* multiple files selector config
|
|
134
155
|
*/
|
|
135
|
-
export
|
|
156
|
+
export type SelectFilesConfig = UIConfig<string[]> & {
|
|
136
157
|
/**
|
|
158
|
+
* This will only take effect in VSC.
|
|
137
159
|
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
138
160
|
* like "TypeScript", and an array of extensions, e.g.
|
|
139
161
|
* ```ts
|
|
@@ -146,11 +168,14 @@ export declare type SelectFilesConfig = UIConfig<string[]> & {
|
|
|
146
168
|
filters?: {
|
|
147
169
|
[name: string]: string[];
|
|
148
170
|
};
|
|
171
|
+
default?: string[] | (() => Promise<string[]>);
|
|
149
172
|
};
|
|
150
173
|
/**
|
|
151
174
|
* folder selector config
|
|
152
175
|
*/
|
|
153
|
-
export
|
|
176
|
+
export type SelectFolderConfig = UIConfig<string> & {
|
|
177
|
+
default?: string | (() => Promise<string>);
|
|
178
|
+
};
|
|
154
179
|
/**
|
|
155
180
|
* func execution config
|
|
156
181
|
*/
|
|
@@ -158,6 +183,30 @@ export interface ExecuteFuncConfig extends UIConfig<string> {
|
|
|
158
183
|
func: LocalFunc<any>;
|
|
159
184
|
inputs: Inputs;
|
|
160
185
|
}
|
|
186
|
+
export interface SingleFileOrInputConfig extends UIConfig<string> {
|
|
187
|
+
/**
|
|
188
|
+
* An item shown in the list in VSC that user can click to input text.
|
|
189
|
+
*/
|
|
190
|
+
inputOptionItem: OptionItem;
|
|
191
|
+
/**
|
|
192
|
+
* Config for the input box.
|
|
193
|
+
*/
|
|
194
|
+
inputBoxConfig: UIConfig<string>;
|
|
195
|
+
/**
|
|
196
|
+
* This will only take effect in VSC.
|
|
197
|
+
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
|
|
198
|
+
* like "TypeScript", and an array of extensions, e.g.
|
|
199
|
+
* ```ts
|
|
200
|
+
* {
|
|
201
|
+
* 'Images': ['png', 'jpg']
|
|
202
|
+
* 'TypeScript': ['ts', 'tsx']
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
filters?: {
|
|
207
|
+
[name: string]: string[];
|
|
208
|
+
};
|
|
209
|
+
}
|
|
161
210
|
/**
|
|
162
211
|
* a wrapper of user input result
|
|
163
212
|
*/
|
|
@@ -173,12 +222,12 @@ export interface InputResult<T> {
|
|
|
173
222
|
*/
|
|
174
223
|
result?: T;
|
|
175
224
|
}
|
|
176
|
-
export
|
|
177
|
-
export
|
|
178
|
-
export
|
|
179
|
-
export
|
|
180
|
-
export
|
|
181
|
-
export
|
|
225
|
+
export type SingleSelectResult = InputResult<string | OptionItem>;
|
|
226
|
+
export type MultiSelectResult = InputResult<StaticOptions>;
|
|
227
|
+
export type InputTextResult = InputResult<string>;
|
|
228
|
+
export type SelectFileResult = InputResult<string>;
|
|
229
|
+
export type SelectFilesResult = InputResult<string[]>;
|
|
230
|
+
export type SelectFolderResult = InputResult<string>;
|
|
182
231
|
/**
|
|
183
232
|
* Definition of user interaction, which is platform independent
|
|
184
233
|
*/
|
|
@@ -289,6 +338,14 @@ export interface UserInteraction {
|
|
|
289
338
|
[k: string]: string;
|
|
290
339
|
};
|
|
291
340
|
}): Promise<Result<string, FxError>>;
|
|
341
|
+
/**
|
|
342
|
+
* In VSC, it shows two options to user, one will open a dialog to the user which allows to select a single file, another one will show an input box asking to enter a value.
|
|
343
|
+
* If CLI, it will directly asks user to enter a value.
|
|
344
|
+
* @param config config to select local file or enter a value
|
|
345
|
+
* @returns A promise that resolves to the local file path or the value entered by user or FxError
|
|
346
|
+
* @throws FxError
|
|
347
|
+
*/
|
|
348
|
+
selectFileOrInput?(config: SingleFileOrInputConfig): Promise<Result<InputResult<string>, FxError>>;
|
|
292
349
|
}
|
|
293
350
|
export interface IProgressHandler {
|
|
294
351
|
/**
|
|
@@ -308,6 +365,6 @@ export interface IProgressHandler {
|
|
|
308
365
|
* End the progress bar and tell if success. After calling it, the progress bar will disappear. This handler
|
|
309
366
|
* can be reused after calling end().
|
|
310
367
|
*/
|
|
311
|
-
end: (success: boolean) => Promise<void>;
|
|
368
|
+
end: (success: boolean, hideAfterFinish?: boolean) => Promise<void>;
|
|
312
369
|
}
|
|
313
370
|
//# sourceMappingURL=ui.d.ts.map
|
package/build/qm/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/qm/ui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/qm/ui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAgB,MAAM,GAAG,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAA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C;CACrE"}
|
package/build/qm/validation.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Inputs, OptionItem } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type ValidateFunc<T> = (input: T, inputs?: Inputs) => string | undefined | Promise<string | undefined>;
|
|
3
3
|
/**
|
|
4
4
|
* Validation for Any Instance Type
|
|
5
5
|
* JSON Schema Validation reference: http://json-schema.org/draft/2019-09/json-schema-validation.html
|
|
@@ -54,6 +54,10 @@ export interface StringValidation extends StaticValidation {
|
|
|
54
54
|
* An instance validates successfully against this keyword if its value is not equal to the value of the keyword.
|
|
55
55
|
*/
|
|
56
56
|
notEquals?: string;
|
|
57
|
+
/**
|
|
58
|
+
* A string instance validates successfully against this keyword if its value does not equal to any of the elements in this keyword's array value.
|
|
59
|
+
*/
|
|
60
|
+
excludesEnum?: string[];
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
59
63
|
* Validation for String Arrays
|
|
@@ -111,24 +115,9 @@ export interface FuncValidation<T extends string | string[] | OptionItem | Optio
|
|
|
111
115
|
*/
|
|
112
116
|
validFunc: ValidateFunc<T>;
|
|
113
117
|
}
|
|
118
|
+
export type ConditionFunc = (inputs: Inputs) => boolean | Promise<boolean>;
|
|
114
119
|
/**
|
|
115
120
|
* Definition of validation schema, which is a union of `StringValidation`, `StringArrayValidation` and `FuncValidation<any>`
|
|
116
121
|
*/
|
|
117
|
-
export
|
|
118
|
-
/**
|
|
119
|
-
* A function to return a validation function according the validation schema
|
|
120
|
-
* @param validation validation schema
|
|
121
|
-
* @param inputs object to carry all user inputs
|
|
122
|
-
* @returns a validation function
|
|
123
|
-
*/
|
|
124
|
-
export declare function getValidationFunction<T extends string | string[] | undefined>(validation: ValidationSchema, inputs: Inputs): (input: T) => string | undefined | Promise<string | undefined>;
|
|
125
|
-
/**
|
|
126
|
-
* Implementation of validation function
|
|
127
|
-
* @param validSchema validation schema
|
|
128
|
-
* @param value value to validate
|
|
129
|
-
* @param inputs user inputs object, which works as the context of the validation
|
|
130
|
-
* @returns A human-readable string which is presented as diagnostic message.
|
|
131
|
-
* Return `undefined` when 'value' is valid.
|
|
132
|
-
*/
|
|
133
|
-
export declare function validate<T extends string | string[] | OptionItem | OptionItem[] | undefined>(validSchema: ValidationSchema, value: T, inputs?: Inputs): Promise<string | undefined>;
|
|
122
|
+
export type ValidationSchema = StringValidation | StringArrayValidation | FuncValidation<any>;
|
|
134
123
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/qm/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/qm/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAC5B,KAAK,EAAE,CAAC,EACR,MAAM,CAAC,EAAE,MAAM,KACZ,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAA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