Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+207
View File
@@ -0,0 +1,207 @@
import { Result } from "neverthrow";
import { FxError } from "./error";
export type OptionValue = string | boolean | string[] | undefined;
export type CLIOptionType = "boolean" | "string" | "array";
export interface CLICommand {
/**
* @description command name, only meaningful to its parent command, like "sample"
*/
name: string;
/**
* @description command aliases
*/
aliases?: string[];
/**
* @description command full name, like "teamsfx new sample", only available after command finding
*/
fullName?: string;
/**
* @description CLI version, only necessary for the root command
*/
version?: string;
/**
* @description command description
*/
description: string;
/**
* @description command argument, for example, "teamsfx new sample <sample-name>": sample-name is an argument, which is positional
*/
arguments?: CLICommandArgument[];
/**
* @description command options, followed by "--" or "-" char, for example, "teamsfx new sample --option1 value1 --option2 value2"
*/
options?: CLICommandOption[];
/**
* @description whether to sort options in "--help"
*/
sortOptions?: boolean;
/**
* @description sub commands, CLI commands are organized in a tree structure, commands can have sub commands
*/
commands?: CLICommand[];
/**
* @description whether to sort sub commands in "--help"
*/
sortCommands?: boolean;
/**
* @description examples of how to use this command
*/
examples?: CLIExample[];
/**
* @description command handler
*/
handler?: (ctx: CLIContext) => Promise<Result<undefined, FxError>> | Result<undefined, FxError>;
/**
* @description telemetry will be sent when available
*/
telemetry?: {
event: string;
};
/**
* @description header message will be printed on the top in "--help"
*/
header?: string;
/**
* @description footer message will be printed on the bottom in "--help"
*/
footer?: string;
/**
* @description whether to hide this command in "--help"
*/
hidden?: boolean;
/**
* @description default value of global option "--interactive", default value is true
*/
defaultInteractiveOption?: boolean;
/**
* @description reserve option values in interactive mode
*/
reservedOptionNamesInInteractiveMode?: string[];
}
export interface CLIFoundCommand extends CLICommand {
fullName: string;
}
export interface CLIContext {
/**
* @description the command matched
*/
command: CLIFoundCommand;
/**
* @description parsed option values
*/
optionValues: Record<string, OptionValue>;
/**
* @description parsed global option values, global options are options defined by the root command in the command tree.
*/
globalOptionValues: Record<string, OptionValue>;
/**
* @description parsed argument values
*/
argumentValues: OptionValue[];
/**
* @description telemetry properties, which cen be accessed in the process of command execution lifecycle
*/
telemetryProperties: Record<string, string>;
}
interface CLICommandOptionBase {
/**
* @description option/argument name
* */
name: string;
/**
* @description when converting option key-value into @Inputs for FxCore,
* the key will be used as the property name if defined, otherwise the name will be used
*/
questionName?: string;
/**
* @description option/argument description
*/
description: string;
/**
* @description option/argument abbreviation
*/
shortName?: string;
/**
* @description option/argument value type: boolean, text, array
*/
type: CLIOptionType;
/**
* @description whether this option/argument is required
*/
required?: boolean;
/**
* @description whether this option/argument is hidden in "--help"
*/
hidden?: boolean;
}
export interface CLIBooleanOption extends CLICommandOptionBase {
type: "boolean";
/**
* @description default value
*/
default?: boolean;
/**
* @description parsed input value
*/
value?: boolean;
}
export interface CLIStringOption extends CLICommandOptionBase {
type: "string";
/**
* @description default value
*/
default?: string;
/**
* @description parsed input value
*/
value?: string;
/**
* allowed values
*/
choices?: string[];
/**
* @description whether to skip validation against allowed values defined in choices
*/
skipValidation?: boolean;
/**
* @description command to get choice list
*/
choiceListCommand?: string;
}
export interface CLIArrayOption extends CLICommandOptionBase {
type: "array";
/**
* @description default value
*/
default?: string[];
/**
* @description parsed input value
*/
value?: string[];
/**
* allowed values
*/
choices?: string[];
/**
* @description whether to skip validation against allowed values defined in choices
*/
skipValidation?: boolean;
/**
* @description command to get choice list
*/
choiceListCommand?: string;
}
export type CLICommandOption = CLIBooleanOption | CLIStringOption | CLIArrayOption;
export type CLICommandArgument = CLICommandOption;
export interface CLIExample {
/**
* @description example command
*/
command: string;
/**
* @description description of the sample command
*/
description: string;
}
export {};
//# sourceMappingURL=cli.d.ts.map
+1
View File
@@ -0,0 +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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,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;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"}
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=cli.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
+89
View File
@@ -0,0 +1,89 @@
export declare const ConfigFolderName = "fx";
export declare const AppPackageFolderName = "appPackage";
export declare const BuildFolderName = "build";
export declare const ResponseTemplatesFolderName = "responseTemplates";
export declare const TemplateFolderName = "templates";
export declare const ProductName = "teamsfx";
export declare const AutoGeneratedReadme = "README-auto-generated.md";
export declare const DefaultReadme = "README.md";
export declare const SettingsFolderName = "teamsfx";
export declare const ManifestTemplateFileName = "manifest.json";
export declare const DefaultApiSpecFolderName = "apiSpecificationFile";
export declare const DefaultApiSpecYamlFileName = "openapi.yaml";
export declare const DefaultApiSpecJsonFileName = "openapi.json";
export declare const DefaultPluginManifestFileName = "ai-plugin.json";
/**
* questions for VS and CLI_HELP platforms are static question which don't depend on project context
* questions for VSCode and CLI platforms are dynamic question which depend on project context
*/
export declare enum Platform {
VSCode = "vsc",
CLI = "cli",
VS = "vs",
CLI_HELP = "cli_help"
}
export declare const StaticPlatforms: Platform[];
export declare const DynamicPlatforms: Platform[];
export declare const CLIPlatforms: Platform[];
export declare enum VsCodeEnv {
local = "local",
codespaceBrowser = "codespaceBrowser",
codespaceVsCode = "codespaceVsCode",
remote = "remote"
}
export declare enum Stage {
create = "create",
build = "build",
debug = "debug",
provision = "provision",
deploy = "deploy",
package = "package",
publish = "publish",
createEnv = "createEnv",
listEnv = "listEnv",
removeEnv = "removeEnv",
switchEnv = "switchEnv",
userTask = "userTask",
update = "update",
grantPermission = "grantPermission",
checkPermission = "checkPermission",
listCollaborator = "listCollaborator",
getQuestions = "getQuestions",
getProjectConfig = "getProjectConfig",
addFeature = "addFeature",
addWebpart = "addWebpart",
addResource = "addResource",
addCapability = "addCapability",
addCiCdFlow = "addCiCdFlow",
deployAad = "deployAad",
buildAad = "buildAad",
deployTeams = "deployTeams",
initDebug = "initDebug",
initInfra = "initInfra",
publishInDeveloperPortal = "publishInDeveloperPortal",
validateApplication = "validateApplication",
createAppPackage = "createAppPackage",
previewWithManifest = "previewWithManifest",
copilotPluginAddAPI = "copilotPluginAddAPI",
syncManifest = "syncManifest",
addPlugin = "addPlugin"
}
export declare enum TelemetryEvent {
askQuestion = "askQuestion"
}
export declare enum TelemetryProperty {
answerType = "answerType",
question = "question",
answer = "answer",
platform = "platform",
stage = "stage"
}
/**
* You can register your callback function when you want to be notified
* at some predefined events.
*/
export declare enum CoreCallbackEvent {
lock = "lock",
unlock = "unlock"
}
//# sourceMappingURL=constants.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,oBA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,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,wBAAwB,6BAA6B;IACrD,mBAAmB,wBAAwB;IAC3C,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,SAAS,cAAc;CACxB;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"}
+100
View File
@@ -0,0 +1,100 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreCallbackEvent = exports.TelemetryProperty = exports.TelemetryEvent = exports.Stage = exports.VsCodeEnv = exports.CLIPlatforms = exports.DynamicPlatforms = exports.StaticPlatforms = exports.Platform = exports.DefaultPluginManifestFileName = exports.DefaultApiSpecJsonFileName = exports.DefaultApiSpecYamlFileName = exports.DefaultApiSpecFolderName = exports.ManifestTemplateFileName = exports.SettingsFolderName = exports.DefaultReadme = exports.AutoGeneratedReadme = exports.ProductName = exports.TemplateFolderName = exports.ResponseTemplatesFolderName = exports.BuildFolderName = exports.AppPackageFolderName = exports.ConfigFolderName = void 0;
exports.ConfigFolderName = "fx";
exports.AppPackageFolderName = "appPackage";
exports.BuildFolderName = "build";
exports.ResponseTemplatesFolderName = "responseTemplates";
exports.TemplateFolderName = "templates";
exports.ProductName = "teamsfx";
exports.AutoGeneratedReadme = "README-auto-generated.md";
exports.DefaultReadme = "README.md";
exports.SettingsFolderName = "teamsfx";
exports.ManifestTemplateFileName = "manifest.json";
exports.DefaultApiSpecFolderName = "apiSpecificationFile";
exports.DefaultApiSpecYamlFileName = "openapi.yaml";
exports.DefaultApiSpecJsonFileName = "openapi.json";
exports.DefaultPluginManifestFileName = "ai-plugin.json";
/**
* questions for VS and CLI_HELP platforms are static question which don't depend on project context
* questions for VSCode and CLI platforms are dynamic question which depend on project context
*/
var Platform;
(function (Platform) {
Platform["VSCode"] = "vsc";
Platform["CLI"] = "cli";
Platform["VS"] = "vs";
Platform["CLI_HELP"] = "cli_help";
})(Platform = exports.Platform || (exports.Platform = {}));
exports.StaticPlatforms = [Platform.CLI_HELP];
exports.DynamicPlatforms = [Platform.VSCode, Platform.CLI, Platform.VS];
exports.CLIPlatforms = [Platform.CLI, Platform.CLI_HELP];
var VsCodeEnv;
(function (VsCodeEnv) {
VsCodeEnv["local"] = "local";
VsCodeEnv["codespaceBrowser"] = "codespaceBrowser";
VsCodeEnv["codespaceVsCode"] = "codespaceVsCode";
VsCodeEnv["remote"] = "remote";
})(VsCodeEnv = exports.VsCodeEnv || (exports.VsCodeEnv = {}));
var Stage;
(function (Stage) {
Stage["create"] = "create";
Stage["build"] = "build";
Stage["debug"] = "debug";
Stage["provision"] = "provision";
Stage["deploy"] = "deploy";
Stage["package"] = "package";
Stage["publish"] = "publish";
Stage["createEnv"] = "createEnv";
Stage["listEnv"] = "listEnv";
Stage["removeEnv"] = "removeEnv";
Stage["switchEnv"] = "switchEnv";
Stage["userTask"] = "userTask";
Stage["update"] = "update";
Stage["grantPermission"] = "grantPermission";
Stage["checkPermission"] = "checkPermission";
Stage["listCollaborator"] = "listCollaborator";
Stage["getQuestions"] = "getQuestions";
Stage["getProjectConfig"] = "getProjectConfig";
Stage["addFeature"] = "addFeature";
Stage["addWebpart"] = "addWebpart";
Stage["addResource"] = "addResource";
Stage["addCapability"] = "addCapability";
Stage["addCiCdFlow"] = "addCiCdFlow";
Stage["deployAad"] = "deployAad";
Stage["buildAad"] = "buildAad";
Stage["deployTeams"] = "deployTeams";
Stage["initDebug"] = "initDebug";
Stage["initInfra"] = "initInfra";
Stage["publishInDeveloperPortal"] = "publishInDeveloperPortal";
Stage["validateApplication"] = "validateApplication";
Stage["createAppPackage"] = "createAppPackage";
Stage["previewWithManifest"] = "previewWithManifest";
Stage["copilotPluginAddAPI"] = "copilotPluginAddAPI";
Stage["syncManifest"] = "syncManifest";
Stage["addPlugin"] = "addPlugin";
})(Stage = exports.Stage || (exports.Stage = {}));
var TelemetryEvent;
(function (TelemetryEvent) {
TelemetryEvent["askQuestion"] = "askQuestion";
})(TelemetryEvent = exports.TelemetryEvent || (exports.TelemetryEvent = {}));
var TelemetryProperty;
(function (TelemetryProperty) {
TelemetryProperty["answerType"] = "answerType";
TelemetryProperty["question"] = "question";
TelemetryProperty["answer"] = "answer";
TelemetryProperty["platform"] = "platform";
TelemetryProperty["stage"] = "stage";
})(TelemetryProperty = exports.TelemetryProperty || (exports.TelemetryProperty = {}));
/**
* You can register your callback function when you want to be notified
* at some predefined events.
*/
var CoreCallbackEvent;
(function (CoreCallbackEvent) {
CoreCallbackEvent["lock"] = "lock";
CoreCallbackEvent["unlock"] = "unlock";
})(CoreCallbackEvent = exports.CoreCallbackEvent || (exports.CoreCallbackEvent = {}));
//# sourceMappingURL=constants.js.map
+1
View File
@@ -0,0 +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,W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IACrC,sCAA6B,CAAA;IAC7B,8CAAqC,CAAA;IACrC,kCAAyB,CAAA;IACzB,kCAAyB,CAAA;IACzB,oCAA2B,CAAA;IAC3B,wCAA+B,CAAA;IAC/B,oCAA2B,CAAA;IAC3B,gCAAuB,CAAA;IACvB,8BAAqB,CAAA;IACrB,oCAA2B,CAAA;IAC3B,gCAAuB,CAAA;IACvB,gCAAuB,CAAA;IACvB,8DAAqD,CAAA;IACrD,oDAA2C,CAAA;IAC3C,8CAAqC,CAAA;IACrC,oDAA2C,CAAA;IAC3C,oDAA2C,CAAA;IAC3C,sCAA6B,CAAA;IAC7B,gCAAuB,CAAA;AACzB,CAAC,EApCW,KAAK,GAAL,aAAK,KAAL,aAAK,QAoChB;AAED,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,6CAA2B,CAAA;AAC7B,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB;AAED,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,8CAAyB,CAAA;IACzB,0CAAqB,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"}
+15
View File
@@ -0,0 +1,15 @@
import { UserInteraction } from "./qm";
import { LogProvider, TelemetryReporter, TokenProvider } from "./utils";
import { ExpServiceProvider } from "./utils/exp";
export interface Context {
userInteraction: UserInteraction;
logProvider: LogProvider;
telemetryReporter: TelemetryReporter;
expServiceProvider?: ExpServiceProvider;
tokenProvider?: TokenProvider;
projectPath?: string;
templateVariables?: {
[key: string]: string;
};
}
//# sourceMappingURL=context.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,OAAO;IACtB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC/C"}
+5
View File
@@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=context.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC"}
+131
View File
@@ -0,0 +1,131 @@
export interface FxError extends Error {
/**
* Custom error details.
*/
innerError?: any;
/**
* Source name of error. (plugin name, eg: tab-scaffhold-plugin)
*/
source: string;
/**
* Time of error.
*/
timestamp: Date;
userData?: any;
categories?: string[];
telemetryProperties?: Record<string, string>;
/**
* recommended operation for user to fix the error
* e.g. "debug-in-test-tool"
*/
recommendedOperation?: string;
/**
* whether to skip process (such as mask secret tokens) in telemetry collection
*/
skipProcessInTelemetry?: boolean;
}
export interface ErrorOptionBase {
source?: string;
name?: string;
message?: string;
error?: Error;
userData?: any;
displayMessage?: string;
categories?: string[];
telemetryProperties?: Record<string, string>;
/**
* whether to skip process (such as mask secret tokens) in telemetry collection
*/
skipProcessInTelemetry?: boolean;
}
export interface UserErrorOptions extends ErrorOptionBase {
helpLink?: string;
}
export interface SystemErrorOptions extends ErrorOptionBase {
issueLink?: string;
}
/**
* Users can recover by themselves, e.g., users input invalid app names.
*/
export declare class UserError extends Error implements FxError {
/**
* Custom error details .
*/
innerError?: any;
/**
* Source name of error. (plugin name, eg: tab-scaffold-plugin)
*/
source: string;
/**
* Time of error.
*/
timestamp: Date;
/**
* A wiki website that shows mapping relationship between error names, descriptions, and fix solutions.
*/
helpLink?: string;
/**
* data that only be reported to github issue manually by user and will not be reported as telemetry data
*/
userData?: string;
/**
* message show in the UI
*/
displayMessage?: string;
categories?: string[];
telemetryProperties?: Record<string, string>;
/**
* whether to skip process (such as mask secret tokens) in telemetry collection
*/
skipProcessInTelemetry?: boolean;
/**
* recommended operation for user to fix the error
* e.g. "debug-in-test-tool"
*/
recommendedOperation?: string;
constructor(opt: UserErrorOptions);
constructor(source: string, name: string, message: string, displayMessage?: string);
}
/**
* Users cannot handle it by themselves.
*/
export declare class SystemError extends Error implements FxError {
/**
* Custom error details.
*/
innerError?: any;
/**
* Source name of error. (plugin name, eg: tab-scaffold-plugin)
*/
source: string;
/**
* Time of error.
*/
timestamp: Date;
/**
* A github issue page where users can submit a new issue.
*/
issueLink?: string;
/**
* data that only be reported to github issue manually by user and will not be reported as telemetry data
*/
userData?: string;
/**
* message show in the UI
*/
displayMessage?: string;
categories?: string[];
telemetryProperties?: Record<string, string>;
/**
* whether to skip process (such as mask secret tokens) in telemetry collection
*/
skipProcessInTelemetry?: boolean;
/**
* recommended operation for user to fix the error
* e.g. "debug-in-test-tool"
*/
recommendedOperation?: string;
constructor(opt: SystemErrorOptions);
constructor(source: string, name: string, message: string, displayMessage?: string);
}
//# sourceMappingURL=error.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OA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,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;gBAElB,GAAG,EAAE,gBAAgB;gBACrB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CA+CnF;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAM,YAAW,OAAO;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;gBAElB,GAAG,EAAE,kBAAkB;gBACvB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CA+CnF"}
+90
View File
@@ -0,0 +1,90 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemError = exports.UserError = void 0;
/**
* Users can recover by themselves, e.g., users input invalid app names.
*/
class UserError extends Error {
constructor(param1, param2, param3, param4) {
var _a;
let option;
if (typeof param1 === "string") {
option = {
source: param1,
name: param2,
message: param3,
displayMessage: param4,
};
}
else {
option = param1;
}
// message
const message = option.message || ((_a = option.error) === null || _a === void 0 ? void 0 : _a.message);
super(message);
//name
this.name = option.name || new.target.name;
//source
this.source = option.source || "unknown";
//stack
Error.captureStackTrace(this, new.target);
//prototype
Object.setPrototypeOf(this, new.target.prototype);
//innerError
this.innerError = option.error;
//other fields
this.helpLink = option.helpLink;
this.userData = option.userData;
this.displayMessage = option.displayMessage;
this.timestamp = new Date();
this.categories = option.categories;
this.skipProcessInTelemetry = option.skipProcessInTelemetry;
this.telemetryProperties = option.telemetryProperties;
}
}
exports.UserError = UserError;
/**
* Users cannot handle it by themselves.
*/
class SystemError extends Error {
constructor(param1, param2, param3, param4) {
var _a;
let option;
if (typeof param1 === "string") {
option = {
source: param1,
name: param2,
message: param3,
displayMessage: param4,
};
}
else {
option = param1;
}
// message
const message = option.message || ((_a = option.error) === null || _a === void 0 ? void 0 : _a.message);
super(message);
//name
this.name = option.name || new.target.name;
//source
this.source = option.source || "unknown";
//stack
Error.captureStackTrace(this, new.target);
//prototype
Object.setPrototypeOf(this, new.target.prototype);
//innerError
this.innerError = option.error;
//other fields
this.issueLink = option.issueLink;
this.userData = option.userData;
this.displayMessage = option.displayMessage;
this.timestamp = new Date();
this.categories = option.categories;
this.skipProcessInTelemetry = option.skipProcessInTelemetry;
this.telemetryProperties = option.telemetryProperties;
}
}
exports.SystemError = SystemError;
//# sourceMappingURL=error.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAsDlC;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IA2ClC,YACE,MAAiC,EACjC,MAAe,EACf,MAAe,EAC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CAAC;QACpC,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,sBAAsB,CAAC;QAC5D,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;IACxD,CAAC;CACF;AA1FD,kCA0FC"}
+12
View File
@@ -0,0 +1,12 @@
import { Result } from "neverthrow";
import { Context } from "./context";
import { FxError } from "./error";
import { Inputs, Warning } from "./types";
export interface IGenerator {
componentName: string;
run(context: Context, inputs: Inputs, destinationPath: string): Promise<Result<GeneratorResult, FxError>>;
}
export interface GeneratorResult {
warnings?: Warning[];
}
//# sourceMappingURL=generator.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CACD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB"}
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=generator.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
+11
View File
@@ -0,0 +1,11 @@
export * from "./qm";
export * from "./utils";
export * from "./constants";
export * from "./context";
export * from "./error";
export * from "./types";
export * from "neverthrow";
export * from "@microsoft/teams-manifest";
export * from "./cli";
export * from "./generator";
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
+16
View File
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./qm"), exports);
tslib_1.__exportStar(require("./utils"), exports);
tslib_1.__exportStar(require("./constants"), exports);
tslib_1.__exportStar(require("./context"), exports);
tslib_1.__exportStar(require("./error"), exports);
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("neverthrow"), exports);
tslib_1.__exportStar(require("@microsoft/teams-manifest"), exports);
tslib_1.__exportStar(require("./cli"), exports);
tslib_1.__exportStar(require("./generator"), exports);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AACb,+CAAqB;AACrB,kDAAwB;AACxB,sDAA4B;AAC5B,oDAA0B;AAC1B,kDAAwB;AACxB,kDAAwB;AACxB,qDAA2B;AAC3B,oEAA0C;AAC1C,gDAAsB;AACtB,sDAA4B"}
+4
View File
@@ -0,0 +1,4 @@
export * from "./question";
export * from "./ui";
export * from "./validation";
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/qm/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC"}
+9
View File
@@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./question"), exports);
tslib_1.__exportStar(require("./ui"), exports);
tslib_1.__exportStar(require("./validation"), exports);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/qm/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAEb,qDAA2B;AAC3B,+CAAqB;AACrB,uDAA6B"}
+435
View File
@@ -0,0 +1,435 @@
import { Inputs, OptionItem } from "../types";
import { ConditionFunc, FuncValidation, StringArrayValidation, StringValidation, ValidationSchema } from "./validation";
export interface FunctionRouter {
namespace: string;
method: string;
}
export interface Func extends FunctionRouter {
params?: any;
}
/**
* definition of a function that return some dynamic value
*/
export type LocalFunc<T> = (inputs: Inputs) => T | Promise<T>;
export type OnSelectionChangeFunc = (currentSelectedIds: Set<string>, previousSelectedIds: Set<string>) => Promise<Set<string>>;
/**
* static option is `string` array or `OptionItem` array.
* 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.
* For example, option=['id1','id2'] => [{'id':'id1', label:'id1'},{'id':'id2', label:'id2'}].
*/
export type StaticOptions = string[] | OptionItem[];
/**
* dynamic option is defined by a function
*/
export type DynamicOptions = LocalFunc<StaticOptions>;
/**
* Basic question data
*/
export interface BaseQuestion {
/**
* name is the identifier of the question
*/
name: string;
/**
* human readable meaningful display name of the question
*/
title?: string | LocalFunc<string | undefined>;
/**
* the answer of the question
*/
value?: unknown;
valueType?: "skip" | "success";
/**
* default input value
*/
default?: unknown;
/**
* `step` and `totalSteps` are used to describe the progress in question flow
* `step` is the sequence number of current question
*/
step?: number;
/**
* `totalStep` is the number of questions totally
*/
totalSteps?: number;
/**
* `innerStep` and `innerTotalStep` are used to describe the inner step of a group of questions
* `innerStep` is the sequence number of the current question in the group.
* VSC will display the innerStep and innerTotalStep in the question title.
*/
innerStep?: number;
/**
* `innerTotalStep` is the number of questions in the group in total
*/
innerTotalStep?: number;
/**
* if true, the toolkit will not remember the value as default value
*/
forgetLastValue?: boolean;
/**
* Actions that can be made within the question.
* @param An array of actions
* @param `icon` is the icon id of the action item
* @param `tooltip` is the hint of the action item
* @param `command` is the command name that will be executed when current action triggered
*/
buttons?: {
icon: string;
tooltip: string;
command: string;
}[];
}
/**
* Definition of question that needs human input
*/
export interface UserInputQuestion extends BaseQuestion {
/**
* question type
*/
type: "singleSelect" | "multiSelect" | "singleFile" | "multiFile" | "folder" | "text" | "singleFileOrText" | "innerText" | "confirm";
/**
* title is required for human input question
*/
title: string | LocalFunc<string | undefined>;
/**
* placeholder in the input text box
* placeholder can have dynamic value defined by a function with type `LocalFunc<string | undefined>`
*/
placeholder?: string | LocalFunc<string | undefined>;
/**
* prompt text providing some ask or explanation to the user
* prompt can have dynamic value defined by a function with type `LocalFunc<string | undefined>`
*/
prompt?: string | LocalFunc<string | undefined>;
/**
* default value of the question
*/
default?: string | string[] | boolean | LocalFunc<string | string[] | boolean | undefined>;
/**
* validation schema for the answer value, which can be static validation schema or dynamic customized validation function
*/
validation?: ValidationSchema;
/**
* An optional validation message indicating or explaining the problem with the current input value.
*/
validationHelp?: string;
/**
* A flag to indicate whether the question is required for CLI non-interactive mode.
* Default value is false.
* If not explicitly defined, the framework will try to fillin this field.
*/
required?: boolean;
/**
* alternative names of the question that use to map the input properties into final Input object
*/
alternativeNames?: string[];
/**
* CLI option/argument name, if not specified, the question name will be used as the CLI option/argument name
*/
cliName?: string;
/**
* the question is only for CLI option abbrevation
*/
cliShortName?: string;
/**
* whether the value is a boolean string value, if true, it will support '--option', which is equivalant to '--option true'
*/
isBoolean?: boolean;
/**
* whether the question is mapped to CLI option or argument, default is option
*/
cliType?: "option" | "argument";
cliDescription?: string;
/**
* @description the question will converted to a hidden option in CLI
*/
cliHidden?: boolean;
}
/**
* Definition of single selection question
*/
export interface SingleSelectQuestion extends UserInputQuestion {
type: "singleSelect";
/**
* static options array
* CLI's help command focus only on this static option
*/
staticOptions: StaticOptions;
/**
* dynamic option, which has higher priority than static options
*/
dynamicOptions?: DynamicOptions;
/**
* answer value, which is the `id` string or `OptionItem` object
*/
value?: string | OptionItem;
/**
* The default selected `id` value of the option item
*/
default?: string | LocalFunc<string | undefined>;
/**
* 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`.
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string.
*/
returnObject?: boolean;
/**
* whether to skip the single option select question
* if true: single select question will be automatically answered with the single option;
* if false: use still need to do the selection manually even there is no other choice.
*/
skipSingleOption?: boolean | LocalFunc<boolean>;
/**
* the command is only for CLI option description
*/
cliChoiceListCommand?: string;
/**
* whether to skip validation against allowed list in non-interactive mode, default false
*/
skipValidation?: boolean;
}
/**
* Definition of single selection question
*/
export interface ConfirmQuestion extends UserInputQuestion {
type: "confirm";
/**
* display text for option true or false
*/
transformer?: (value: boolean) => string;
/**
* answer value: true or false
*/
value?: boolean;
/**
* The default selected `id` value of the option item
*/
default?: boolean | LocalFunc<boolean>;
}
/**
* Definition of multiple selection question
*/
export interface MultiSelectQuestion extends UserInputQuestion {
type: "multiSelect";
/**
* static options array
* CLI's help command focus only on this static option
*/
staticOptions: StaticOptions;
/**
* dynamic option, which has higher priority than static options
*/
dynamicOptions?: DynamicOptions;
/**
* answer value, which is `id` string array or `OptionItem` object array
*/
value?: string[] | OptionItem[];
/**
* The default selected `id` array of the option item
*/
default?: string[] | LocalFunc<string[] | undefined> | "none" | "all";
/**
* 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.
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string array.
*/
returnObject?: boolean;
/**
* whether to skip the single option select question
* if true: single select question will be automatically answered with the single option;
* if false: use still need to do the selection manually even there is no second choice
*/
skipSingleOption?: boolean;
/**
* a callback function which is triggered when the selected values change, which can change the final selected values.
* @param currentSelectedIds current selected option ids
* @param previousSelectedIds previous selected option ids
* @returns the final selected option ids
*/
onDidChangeSelection?: OnSelectionChangeFunc;
/**
* validation schema for the answer values
*/
validation?: StringArrayValidation | FuncValidation<string[]>;
/**
* the command is only for CLI option description
*/
cliChoiceListCommand?: string;
/**
* whether to skip validation against allowed list in non-interactive mode, default false
*/
skipValidation?: boolean;
}
/**
* Definition of text input question
*/
export interface TextInputQuestion extends UserInputQuestion {
type: "text";
/**
* If the input value should be hidden. Defaults to false.
*/
password?: boolean;
/**
* input value.
*/
value?: string;
/**
* default value
*
*/
default?: string | LocalFunc<string | undefined>;
/**
* validation schema, which can be a dynamic function closure
*/
validation?: StringValidation | FuncValidation<string>;
/**
* validation when user confirms the input.
*/
additionalValidationOnAccept?: StringValidation | FuncValidation<string>;
}
/**
* Definition of text input question of a sub-question of SingleFileOrInputQuestion
*/
export interface InnerTextInputQuestion extends UserInputQuestion {
type: "innerText";
/**
* If the input value should be hidden. Defaults to false.
*/
password?: boolean;
/**
* input value.
*/
value?: string;
/**
* default value
*
*/
default?: string | LocalFunc<string | undefined>;
/**
* validation schema, which can be a dynamic function closure
*/
validation?: StringValidation | FuncValidation<string>;
}
/**
* Definition of single file selection
*/
export interface SingleFileQuestion extends UserInputQuestion {
type: "singleFile";
/**
* the answer value is a file path string
*/
value?: string;
/**
* default selected file path
*/
default?: string | LocalFunc<string | undefined>;
/**
* validation function
*/
validation?: FuncValidation<string>;
/**
* This will only take effect in VSC.
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: {
[name: string]: string[];
};
/**
* Default Uri when open file selector window.
*/
defaultFolder?: string | LocalFunc<string | undefined>;
}
export interface MultiFileQuestion extends UserInputQuestion {
type: "multiFile";
/**
* the answer value is an array of file paths
*/
value?: string[];
/**
* default selected file path
*/
default?: string | LocalFunc<string | undefined>;
/**
* validation function
*/
validation?: FuncValidation<string[]>;
}
export interface FolderQuestion extends UserInputQuestion {
type: "folder";
/**
* the answer value is a folder path string
*/
value?: string;
/**
* default selected folder path
*/
default?: string | LocalFunc<string | undefined>;
/**
* validation function
*/
validation?: FuncValidation<string>;
}
export interface SingleFileOrInputQuestion extends UserInputQuestion {
type: "singleFileOrText";
/**
* An item shown in the list in VSC that user can click to input text.
*/
inputOptionItem: OptionItem;
/**
* Config for the input box.
*/
inputBoxConfig: InnerTextInputQuestion;
/**
* This will only take effect in VSC.
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: {
[name: string]: string[];
};
}
/**
* `Group` is a virtual node in the question tree that wraps a group of questions, which share the same activation condition in this group.
*/
export interface Group {
type: "group";
name?: string;
}
export type Question = SingleSelectQuestion | MultiSelectQuestion | TextInputQuestion | SingleFileQuestion | MultiFileQuestion | FolderQuestion | SingleFileQuestion | SingleFileOrInputQuestion | ConfirmQuestion;
/**
* IQTreeNode is the tree node data structure, which have three main properties:
* - data: data is either a group or question. Questions can be organized into a group, which has the same trigger condition.
* - condition: trigger condition for this node to be activated;
* - children: child questions that will be activated according their trigger condition.
*/
export interface IQTreeNode {
data: Question | Group;
condition?: StringValidation | StringArrayValidation | ConditionFunc;
children?: IQTreeNode[];
/**
* @description the question node will be ignored as CLI option in non-interactive mode
* "self" - only ignore the question itself
* "children" - ignore all nodes in sub-tree
* "all" - ignore self and all nodes in sub-tree
*/
cliOptionDisabled?: "self" | "children" | "all";
/**
* @description the question node will be ignored as an Inputs property
* "self" - only ignore the question itself
* "children" - ignore all nodes in sub-tree
* "all" - ignore self and all nodes in sub-tree
*/
inputsDisabled?: "self" | "children" | "all";
}
//# sourceMappingURL=question.d.ts.map
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=question.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/qm/question.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
+465
View File
@@ -0,0 +1,465 @@
import { Result } from "neverthrow";
import { FxError } from "../error";
import { Inputs, OptionItem } from "../types";
import { Colors } from "./../utils/log";
import { LocalFunc, OnSelectionChangeFunc, StaticOptions } from "./question";
/**
* A base structure of user interaction (UI) configuration
*/
export interface UIConfig<T> {
/**
* name is the identifier of the UI
*/
name: string;
/**
* human readable meaningful display name of the UI
*/
title: string;
/**
* placeholder in the UI
*/
placeholder?: string;
/**
* prompt text providing some ask or explanation to the user
*/
prompt?: string;
/**
* `step` and `totalSteps` are used to describe the progress in question flow
* `step` is the sequence number of current question
*/
step?: number;
/**
* `totalStep` is the number of questions totally
*/
totalSteps?: number;
/**
* default input value
*/
default?: T | (() => Promise<T>) | string;
/**
* A function that will be called to validate input and to give a hint to the user.
*
* @param input The current value of the input to be validated.
* @return A human-readable string which is presented as diagnostic message.
* Return `undefined` when 'value' is valid.
*/
validation?: (input: T) => string | undefined | Promise<string | undefined>;
/**
* Actions that can be made within the question.
* @param An array of actions
* @param `icon` is the icon id of the action item
* @param `tooltip` is the hint of the action item
* @param `command` is the command name that will be executed when current action triggered
*/
buttons?: {
icon: string;
tooltip: string;
command: string;
}[];
/**
* `innerStep` and `innerTotalStep` are used to describe the inner step of a group of questions
* `innerStep` is the sequence number of the current question in the group.
* VSC will display the innerStep and innerTotalStep in the question title.
*/
innerStep?: number;
/**
* `innerTotalStep` is the number of questions in the group in total
*/
innerTotalStep?: number;
}
export interface ConfirmConfig extends UIConfig<boolean> {
/**
* display text for option true or false
*/
transformer?: (value: boolean) => string;
}
/**
* single selection UI config
*/
export interface SingleSelectConfig extends UIConfig<string> {
/**
* option array or a callback function which returns option array
*/
options: StaticOptions | (() => Promise<StaticOptions>);
default?: string | (() => Promise<string>);
/**
* 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`.
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string.
*/
returnObject?: boolean;
/**
* whether skip selection if there is only one option, default is false
*/
skipSingleOption?: boolean;
}
/**
* multiple selection UI config
*/
export interface MultiSelectConfig extends UIConfig<string[]> {
/**
* option array or a callback function which returns option array
*/
options: StaticOptions | (() => Promise<StaticOptions>);
default?: string[] | (() => Promise<string[]>) | "none" | "all";
/**
* 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.
* In case of option items with `string[]` type, whether `returnObject` is true or false, the returned answer value is always a string array.
*/
returnObject?: boolean;
/**
* a callback function which is triggered when the selected values change, which can change the final selected values.
* @param currentSelectedIds current selected option ids
* @param previousSelectedIds previous selected option ids
* @returns the final selected option ids
*/
onDidChangeSelection?: OnSelectionChangeFunc;
/**
* whether skip selection if there is only one option, default is false
*/
skipSingleOption?: boolean;
}
/**
* text input UI config
*/
export interface InputTextConfig extends UIConfig<string> {
/**
* If the input value should be hidden. Defaults to false.
*/
password?: boolean;
default?: string | (() => Promise<string>);
/**
* A function that will be called to validate the input that user accepted.
*
* @param input The current value of the input to be validated.
* @return A human-readable string which is presented as diagnostic message.
* Return `undefined` when 'value' is valid.
*/
additionalValidationOnAccept?: (input: string) => string | undefined | Promise<string | undefined>;
}
/**
* single file selector config
*/
export type SelectFileConfig = UIConfig<string> & {
/**
* This will only take effect in VSC.
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: {
[name: string]: string[];
};
default?: string | (() => Promise<string>);
/**
* Possible files that will be listed for users to select.
* The id cannot be "default" or "browse" as they are reserved for default and browse options.
*/
possibleFiles?: {
id: string;
label: string;
description?: string;
}[];
/**
* Default Uri when open file selector window.
*/
defaultFolder?: string | (() => Promise<string>);
};
/**
* multiple files selector config
*/
export type SelectFilesConfig = UIConfig<string[]> & {
/**
* This will only take effect in VSC.
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: {
[name: string]: string[];
};
default?: string[] | (() => Promise<string[]>);
};
/**
* folder selector config
*/
export type SelectFolderConfig = UIConfig<string> & {
default?: string | (() => Promise<string>);
};
/**
* func execution config
*/
export interface ExecuteFuncConfig extends UIConfig<string> {
func: LocalFunc<any>;
inputs: Inputs;
}
export interface SingleFileOrInputConfig extends UIConfig<string> {
/**
* An item shown in the list in VSC that user can click to input text.
*/
inputOptionItem: OptionItem;
/**
* Config for the input box.
*/
inputBoxConfig: UIConfig<string>;
/**
* This will only take effect in VSC.
* A set of file filters that are used by the dialog. Each entry is a human-readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: {
[name: string]: string[];
};
}
/**
* a wrapper of user input result
*/
export interface InputResult<T> {
/**
* `success`: the returned answer value is successfully collected when user click predefined confirm button/key, user will continue to answer the next question if available
* `skip`: the answer value is automatically selected when `skipSingleOption` is true for single/multiple selection list, user will continue to answer the next question if available
* `back`: the returned answer is undefined because user click the go-back button/key and will go back to re-answer the previous question in the question flow
*/
type: "success" | "skip" | "back";
/**
* answer value
*/
result?: T;
}
export type ConfirmResult = InputResult<boolean>;
export type SingleSelectResult = InputResult<string | OptionItem>;
export type MultiSelectResult = InputResult<StaticOptions>;
export type InputTextResult = InputResult<string>;
export type SelectFileResult = InputResult<string>;
export type SelectFilesResult = InputResult<string[]>;
export type SelectFolderResult = InputResult<string>;
/**
* Definition of user interaction, which is platform independent
*/
export interface UserInteraction {
/**
* Shows confirm dialog
* @param config confirm config
* @returns A promise that resolves to the confirm result wrapper or FxError
* @throws FxError
*/
confirm?: (config: ConfirmConfig) => Promise<Result<ConfirmResult, FxError>>;
/**
* Shows a single selection list
* @param config single selection config
* @returns A promise that resolves to the single select result wrapper or FxError
* @throws FxError
*/
selectOption: (config: SingleSelectConfig) => Promise<Result<SingleSelectResult, FxError>>;
/**
* Shows a multiple selection list
* @param config multiple selection config
* @returns A promise that resolves to the multiple select result wrapper or FxError
* @throws FxError
*/
selectOptions: (config: MultiSelectConfig) => Promise<Result<MultiSelectResult, FxError>>;
/**
* Opens an input box to ask the user for input.
* @param config text input config
* @returns A promise that resolves to the text input result wrapper or FxError
* @throws FxError
*/
inputText: (config: InputTextConfig) => Promise<Result<InputTextResult, FxError>>;
/**
* Shows a file open dialog to the user which allows to select a single file
* @param config file selector config
* @returns A promise that resolves to the file selector result wrapper or FxError
* @throws FxError
*/
selectFile: (config: SelectFileConfig) => Promise<Result<SelectFileResult, FxError>>;
/**
* Shows a file open dialog to the user which allows to select multiple files
* @param config multiple files selector config
* @returns A promise that resolves to the multiple files selector result wrapper or FxError
* @throws FxError
*/
selectFiles: (config: SelectFilesConfig) => Promise<Result<SelectFilesResult, FxError>>;
/**
* Shows a file open dialog to the user which allows to select a folder
* @param config folder selector config
* @returns A promise that resolves to the folder selector result wrapper or FxError
* @throws FxError
*/
selectFolder: (config: SelectFolderConfig) => Promise<Result<SelectFolderResult, FxError>>;
/**
* Opens a link externally in the browser.
* @param link The uri that should be opened.
* @returns A promise indicating if open was successful.
*/
openUrl(link: string): Promise<Result<boolean, FxError>>;
/**
* Show an information/warning/error message to users. Optionally provide an array of items which will be presented as clickable buttons.
* @param level message level
* @param message The message to show.
* @param items A set of items that will be rendered as actions in the message.
* @returns A promise that resolves to the selected item or `undefined` when being dismissed.
*/
showMessage(level: "info" | "warn" | "error", message: string, modal: boolean, ...items: string[]): Promise<Result<string | undefined, FxError>>;
/**
* Show an information/warning/error message with different colors to users, which only works for CLI.
* @param level message level
* @param message The message with color to show. The color only works for CLI.
* @param items A set of items that will be rendered as actions in the message.
* @returns A promise that resolves to the selected item or `undefined` when being dismissed.
*/
showMessage(level: "info" | "warn" | "error", message: Array<{
content: string;
color: Colors;
}>, modal: boolean, ...items: string[]): Promise<Result<string | undefined, FxError>>;
/**
* Create a new progress bar with the specified title and the number of steps. It will
* return a progress handler and you can use this handler to control the detail message
* of it.
* ${currentStep} will increase from 0 to ${totalSteps}.
* @param title the title of this progress bar.
* @param totalSteps the number of steps.
* @returns the handler of a progress bar
*/
createProgressBar: (title: string, totalSteps: number) => IProgressHandler;
/**
* Reload window to update user interface. (Only works for VS Code)
* @returns A promise indicating if reload is successful.
*/
reload?(): Promise<Result<boolean, FxError>>;
/**
* Execute a function. User interface can decide what the UX is.
* @param config execute function configurations
*/
executeFunction?(config: ExecuteFuncConfig): any | Promise<any>;
/**
* Opens a file.
* @param filePath The path of the file that should be opened.
* @returns A promise indicating if open was successful.
*/
openFile?(filePath: string): Promise<Result<boolean, FxError>>;
/**
* run a user defined command in terminals of UI
* @param args
*/
runCommand?(args: {
cmd: string;
workingDirectory?: string;
shell?: string;
timeout?: number;
env?: {
[k: string]: string;
};
shellName?: string;
iconPath?: string;
}): Promise<Result<string, FxError>>;
/**
* 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.
* If CLI, it will directly asks user to enter a value.
* @param config config to select local file or enter a value
* @returns A promise that resolves to the local file path or the value entered by user or FxError
* @throws FxError
*/
selectFileOrInput?(config: SingleFileOrInputConfig): Promise<Result<InputResult<string>, FxError>>;
/**
* Supports in VSC only for now. Show diagnostic message in editor.
*/
showDiagnosticInfo?(diagnostics: IDiagnosticInfo[]): void;
}
export interface IProgressHandler {
/**
* Start this progress bar. After calling it, the progress bar will be seen to users with
* ${currentStep} = 0 and ${detail} = detail.
* @param detail the detail message of the next work.
*/
start: (detail?: string) => Promise<void>;
/**
* Update the progress bar's message. After calling it, the progress bar will be seen to
* users with ${currentStep}++ and ${detail} = detail.
* This func must be called after calling start().
* @param detail the detail message of the next work.
*/
next: (detail?: string) => Promise<void>;
/**
* End the progress bar and tell if success. After calling it, the progress bar will disappear. This handler
* can be reused after calling end().
*/
end: (success: boolean, hideAfterFinish?: boolean) => Promise<void>;
}
export declare enum DiagnosticSeverity {
/**
* Something not allowed by the rules of a language or other means.
*/
Error = 0,
/**
* Something suspicious but allowed.
*/
Warning = 1,
/**
* Something to inform about but not a problem.
*/
Information = 2,
/**
* Something to hint to a better way of doing it, like proposing
* a refactoring.
*/
Hint = 3
}
export interface IDiagnosticInfo {
/**
* Path of file where diagnostic shows.
*/
filePath: string;
/**
* Line number where diagnostic info starts.
*/
startLine: number;
/**
* Index of the beginning character where diagnostic info shows
*/
startIndex: number;
/**
* Line number where diagnostic info ends.
*/
endLine: number;
/**
* Index of the end character where diagnostic info ends.
*/
endIndex: number;
/**
* Message.
*/
message: string;
/**
* Severity.
*/
severity: DiagnosticSeverity;
/**
* A code or identifier for this diagnostic.
*/
code?: {
/**
* Value.
*/
value: string;
/**
* Link to open with more information about the diagnostic error.
*/
link: string;
};
}
//# sourceMappingURL=ui.d.ts.map
File diff suppressed because one or more lines are too long
+26
View File
@@ -0,0 +1,26 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiagnosticSeverity = void 0;
var DiagnosticSeverity;
(function (DiagnosticSeverity) {
/**
* Something not allowed by the rules of a language or other means.
*/
DiagnosticSeverity[DiagnosticSeverity["Error"] = 0] = "Error";
/**
* Something suspicious but allowed.
*/
DiagnosticSeverity[DiagnosticSeverity["Warning"] = 1] = "Warning";
/**
* Something to inform about but not a problem.
*/
DiagnosticSeverity[DiagnosticSeverity["Information"] = 2] = "Information";
/**
* Something to hint to a better way of doing it, like proposing
* a refactoring.
*/
DiagnosticSeverity[DiagnosticSeverity["Hint"] = 3] = "Hint";
})(DiagnosticSeverity = exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {}));
//# sourceMappingURL=ui.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/qm/ui.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAoclC,IAAY,kBAqBX;AArBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,6DAAS,CAAA;IAET;;OAEG;IACH,iEAAW,CAAA;IAEX;;OAEG;IACH,yEAAe,CAAA;IAEf;;;OAGG;IACH,2DAAQ,CAAA;AACV,CAAC,EArBW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAqB7B"}
+123
View File
@@ -0,0 +1,123 @@
import { Inputs, OptionItem } from "../types";
export type ValidateFunc<T> = (input: T, inputs?: Inputs) => string | undefined | Promise<string | undefined>;
/**
* Validation for Any Instance Type
* JSON Schema Validation reference: http://json-schema.org/draft/2019-09/json-schema-validation.html
*/
export interface StaticValidation {
/**
* whether the value is required or not, default value is true if it is undefined
*/
required?: boolean;
/**
* An instance validates successfully against this keyword if its value is equal to the value of the keyword.
*/
equals?: unknown;
}
/**
* Validation for Strings
*/
export interface StringValidation extends StaticValidation {
/**
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
*/
maxLength?: number;
/**
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
*/
minLength?: number;
/**
* A string instance is considered valid if the regular expression matches the instance successfully.
*/
pattern?: string;
/**
* A string instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*/
enum?: string[];
/**
* A string instance is valid against this keyword if the string starts with the value of this keyword.
*/
startsWith?: string;
/**
* A string instance is valid against this keyword if the string ends with the value of this keyword.
*/
endsWith?: string;
/**
* A string instance is valid against this keyword if the string contains the value of this keyword.
*/
includes?: string;
/**
* An instance validates successfully against this keyword if its value is equal to the value of the keyword.
*/
equals?: string;
/**
* An instance validates successfully against this keyword if its value is not equal to the value of the keyword.
*/
notEquals?: string;
/**
* 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.
*/
excludesEnum?: string[];
}
/**
* Validation for String Arrays
*/
export interface StringArrayValidation extends StaticValidation {
/**
* The value of this keyword MUST be a non-negative integer.
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
*/
maxItems?: number;
/**
* The value of this keyword MUST be a non-negative integer.
* An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
*/
minItems?: number;
/**
* If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
*/
uniqueItems?: boolean;
/**
* An instance validates successfully against this string array if they have the exactly the same elements.
*/
equals?: string[];
/**
* An array instance is valid against "enum" array if all of the elements of the array is contained in the `enum` array.
*/
enum?: string[];
/**
* An array instance is valid against "excludes" if it doesn't contains the value of `excludes`
*/
excludes?: string;
/**
* An array instance is valid against "contains" if it contains the value of `contains`
*/
contains?: string;
/**
* An array instance is valid against "containsAll" array if it contains all of the elements of `containsAll` array.
*/
containsAll?: string[];
/**
* An array instance is valid against "containsAny" array if it contains any one of the elements of `containsAny` array.
*/
containsAny?: string[];
}
/**
* The validation is checked by a validFunc provided by user
*/
export interface FuncValidation<T extends string | string[] | OptionItem | OptionItem[] | undefined> {
/**
* A function that will be called to validate input and to give a hint to the user.
*
* @param input The current value of the input to be validated.
* @return A human-readable string which is presented as diagnostic message.
* Return `undefined` when 'value' is valid.
*/
validFunc: ValidateFunc<T>;
}
export type ConditionFunc = (inputs: Inputs) => boolean | Promise<boolean>;
/**
* Definition of validation schema, which is a union of `StringValidation`, `StringArrayValidation` and `FuncValidation<any>`
*/
export type ValidationSchema = StringValidation | StringArrayValidation | FuncValidation<any>;
//# sourceMappingURL=validation.d.ts.map
+1
View File
@@ -0,0 +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,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAC7B,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,UAAU,EAAE,GAAG,SAAS;IAEnE;;;;;;OAMG;IACH,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC"}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=validation.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/qm/validation.ts"],"names":[],"mappings":""}
+128
View File
@@ -0,0 +1,128 @@
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* The schema of TeamsFx configuration.
*/
export interface EnvConfig {
$schema?: string;
description?: string;
/**
* Existing AAD app configuration.
*/
auth?: {
/**
* The client id of existing AAD app for Teams app.
*/
clientId?: string;
/**
* The client secret of existing AAD app for Teams app.
*/
clientSecret?: string;
/**
* The object id of existing AAD app for Teams app.
*/
objectId?: string;
/**
* The access_as_user scope id of existing AAD app for Teams app.
*/
accessAsUserScopeId?: string;
/**
* The frontend domain for redirect URLs of existing AAD app for Teams app.
*/
frontendDomain?: string;
/**
* The bot id for identifier URIs of existing AAD app for Teams app.
*/
botId?: string;
/**
* The bot endpoint for redirect URLs of existing AAD app for Teams app.
*/
botEndpoint?: string;
[k: string]: unknown;
};
/**
* The Azure resource related configuration.
*/
azure?: {
/**
* The default subscription to provision Azure resources.
*/
subscriptionId?: string;
/**
* The default resource group of Azure resources.
*/
resourceGroupName?: string;
[k: string]: unknown;
};
/**
* Existing bot AAD app configuration.
*/
bot?: {
/**
* The id of existing bot AAD app.
*/
appId?: string;
/**
* The password of existing bot AAD app.
*/
appPassword?: string;
[k: string]: unknown;
};
/**
* The Teams App manifest related configuration.
*/
manifest: {
/**
* Teams app name.
*/
appName: {
/**
* A short display name for teams app.
*/
short: string;
/**
* The full name for teams app.
*/
full?: string;
[k: string]: unknown;
};
/**
* Description for Teams app.
*/
description?: {
/**
* A short description of the app used when space is limited. Maximum length is 80 characters.
*/
short?: string;
/**
* The full description of the app. Maximum length is 4000 characters.
*/
full?: string;
[k: string]: unknown;
};
/**
* Icons for Teams App.
*/
icons?: {
/**
* A relative file path to a full color PNG icon. Size 192x192.
*/
color?: string;
/**
* A relative file path to a transparent PNG outline icon. The border color needs to be white. Size 32x32.
*/
outline?: string;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Skip to add user during SQL provision.
*/
skipAddingSqlUser?: boolean;
[k: string]: unknown;
}
//# sourceMappingURL=envConfig.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"envConfig.d.ts","sourceRoot":"","sources":["../../src/schemas/envConfig.ts"],"names":[],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,CAAC;YACf;;eAEG;YACH,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;SACtB,CAAC;QACF;;WAEG;QACH,KAAK,CAAC,EAAE;YACN;;eAEG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;SACtB,CAAC;QACF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;IACF;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
+9
View File
@@ -0,0 +1,9 @@
"use strict";
/* tslint:disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=envConfig.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"envConfig.js","sourceRoot":"","sources":["../../src/schemas/envConfig.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB;;;;GAIG"}
+162
View File
@@ -0,0 +1,162 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"description": "The schema of TeamsFx configuration.",
"properties": {
"$schema": {
"type": "string"
},
"description": {
"type": "string"
},
"auth": {
"type": "object",
"description": "Existing AAD app configuration.",
"properties": {
"clientId": {
"type": "string",
"description": "The client id of existing AAD app for Teams app.",
"minLength": 1
},
"clientSecret": {
"type": "string",
"description": "The client secret of existing AAD app for Teams app.",
"minLength": 1
},
"objectId": {
"type": "string",
"description": "The object id of existing AAD app for Teams app.",
"minLength": 1
},
"accessAsUserScopeId": {
"type": "string",
"description": "The access_as_user scope id of existing AAD app for Teams app.",
"minLength": 1
},
"frontendDomain": {
"type": "string",
"description": "The frontend domain for redirect URLs of existing AAD app for Teams app.",
"minLength": 1
},
"botId": {
"type": "string",
"description": "The bot id for identifier URIs of existing AAD app for Teams app.",
"minLength": 1
},
"botEndpoint": {
"type": "string",
"description": "The bot endpoint for redirect URLs of existing AAD app for Teams app.",
"minLength": 1
}
},
"dependencies": {
"clientId": ["clientSecret", "objectId"],
"clientSecret": ["clientId", "objectId"],
"objectId": ["clientId", "clientSecret"],
"accessAsUserScopeId": ["clientId", "clientSecret", "objectId"],
"botId": ["botEndpoint"],
"botEndpoint": ["botId"]
}
},
"azure": {
"type": "object",
"description": "The Azure resource related configuration.",
"properties": {
"subscriptionId": {
"type": "string",
"description": "The default subscription to provision Azure resources.",
"minLength": 1,
"pattern": "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"
},
"resourceGroupName": {
"type": "string",
"description": "The default resource group of Azure resources.",
"minLength": 1,
"pattern": "^[-\\w\\._\\(\\)]+$"
}
}
},
"bot": {
"type": "object",
"description": "Existing bot AAD app configuration.",
"properties": {
"appId": {
"type": "string",
"description": "The id of existing bot AAD app.",
"minLength": 1
},
"appPassword": {
"type": "string",
"description": "The password of existing bot AAD app.",
"minLength": 1
}
},
"dependencies": {
"appId": ["appPassword"],
"appPassword": ["appId"]
}
},
"manifest": {
"type": "object",
"description": "The Teams App manifest related configuration.",
"properties": {
"appName": {
"type": "object",
"description": "Teams app name.",
"properties": {
"short": {
"type": "string",
"description": "A short display name for teams app.",
"maxLength": 30,
"minLength": 1
},
"full": {
"type": "string",
"description": "The full name for teams app.",
"maxLength": 100
}
},
"required": ["short"]
},
"description": {
"type": "object",
"description": "Description for Teams app.",
"properties": {
"short": {
"type": "string",
"description": "A short description of the app used when space is limited. Maximum length is 80 characters.",
"maxLength": 80
},
"full": {
"type": "string",
"description": "The full description of the app. Maximum length is 4000 characters.",
"maxLength": 4000
}
}
},
"icons": {
"type": "object",
"description": "Icons for Teams App.",
"properties": {
"color": {
"type": "string",
"description": "A relative file path to a full color PNG icon. Size 192x192.",
"minLength": 1
},
"outline": {
"type": "string",
"description": "A relative file path to a transparent PNG outline icon. The border color needs to be white. Size 32x32.",
"minLength": 1
}
}
}
},
"required": ["appName"]
},
"skipAddingSqlUser": {
"type": "boolean",
"description": "Skip to add user during SQL provision."
}
},
"required": ["manifest"]
}
+4
View File
@@ -0,0 +1,4 @@
export * from "./envConfig";
import * as EnvConfigSchema from "./envConfig.json";
export { EnvConfigSchema };
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,eAAe,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,CAAC"}
+10
View File
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvConfigSchema = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./envConfig"), exports);
const EnvConfigSchema = tslib_1.__importStar(require("./envConfig.json"));
exports.EnvConfigSchema = EnvConfigSchema;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAEb,sDAA4B;AAC5B,0EAAoD;AAC3C,0CAAe"}
@@ -0,0 +1,162 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"description": "The schema of TeamsFx configuration.",
"properties": {
"$schema": {
"type": "string"
},
"description": {
"type": "string"
},
"auth": {
"type": "object",
"description": "Existing AAD app configuration.",
"properties": {
"clientId": {
"type": "string",
"description": "The client id of existing AAD app for Teams app.",
"minLength": 1
},
"clientSecret": {
"type": "string",
"description": "The client secret of existing AAD app for Teams app.",
"minLength": 1
},
"objectId": {
"type": "string",
"description": "The object id of existing AAD app for Teams app.",
"minLength": 1
},
"accessAsUserScopeId": {
"type": "string",
"description": "The access_as_user scope id of existing AAD app for Teams app.",
"minLength": 1
},
"frontendDomain": {
"type": "string",
"description": "The frontend domain for redirect URLs of existing AAD app for Teams app.",
"minLength": 1
},
"botId": {
"type": "string",
"description": "The bot id for identifier URIs of existing AAD app for Teams app.",
"minLength": 1
},
"botEndpoint": {
"type": "string",
"description": "The bot endpoint for redirect URLs of existing AAD app for Teams app.",
"minLength": 1
}
},
"dependencies": {
"clientId": ["clientSecret", "objectId"],
"clientSecret": ["clientId", "objectId"],
"objectId": ["clientId", "clientSecret"],
"accessAsUserScopeId": ["clientId", "clientSecret", "objectId"],
"botId": ["botEndpoint"],
"botEndpoint": ["botId"]
}
},
"azure": {
"type": "object",
"description": "The Azure resource related configuration.",
"properties": {
"subscriptionId": {
"type": "string",
"description": "The default subscription to provision Azure resources.",
"minLength": 1,
"pattern": "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"
},
"resourceGroupName": {
"type": "string",
"description": "The default resource group of Azure resources.",
"minLength": 1,
"pattern": "^[-\\w\\._\\(\\)]+$"
}
}
},
"bot": {
"type": "object",
"description": "Existing bot AAD app configuration.",
"properties": {
"appId": {
"type": "string",
"description": "The id of existing bot AAD app.",
"minLength": 1
},
"appPassword": {
"type": "string",
"description": "The password of existing bot AAD app.",
"minLength": 1
}
},
"dependencies": {
"appId": ["appPassword"],
"appPassword": ["appId"]
}
},
"manifest": {
"type": "object",
"description": "The Teams App manifest related configuration.",
"properties": {
"appName": {
"type": "object",
"description": "Teams app name.",
"properties": {
"short": {
"type": "string",
"description": "A short display name for teams app.",
"maxLength": 30,
"minLength": 1
},
"full": {
"type": "string",
"description": "The full name for teams app.",
"maxLength": 100
}
},
"required": ["short"]
},
"description": {
"type": "object",
"description": "Description for Teams app.",
"properties": {
"short": {
"type": "string",
"description": "A short description of the app used when space is limited. Maximum length is 80 characters.",
"maxLength": 80
},
"full": {
"type": "string",
"description": "The full description of the app. Maximum length is 4000 characters.",
"maxLength": 4000
}
}
},
"icons": {
"type": "object",
"description": "Icons for Teams App.",
"properties": {
"color": {
"type": "string",
"description": "A relative file path to a full color PNG icon. Size 192x192.",
"minLength": 1
},
"outline": {
"type": "string",
"description": "A relative file path to a transparent PNG outline icon. The border color needs to be white. Size 32x32.",
"minLength": 1
}
}
}
},
"required": ["appName"]
},
"skipAddingSqlUser": {
"type": "boolean",
"description": "Skip to add user during SQL provision."
}
},
"required": ["manifest"]
}
File diff suppressed because one or more lines are too long
+144
View File
@@ -0,0 +1,144 @@
import { IBot, IComposeExtension, IConfigurableTab, IStaticTab, IWebApplicationInfo } from "@microsoft/teams-manifest";
import { Platform } from "./constants";
/**
* Definition of option item in single selection or multiple selection
*/
export interface OptionItem {
/**
* unique identifier of the option item in the option list
*/
id: string;
/**
* display name
*/
label: string;
/**
* short description
*/
description?: string;
/**
* detailed description
*/
detail?: string;
/**
* customized user data, which is not displayed
*/
data?: unknown;
/**
* @deprecated CLI display name. CLI will use `cliName` as display name, and use `id` instead if `cliName` is undefined.
*/
cliName?: string;
/**
* group name. If it's set, separator will be rendered on UI between groups.
*/
groupName?: string;
/**
* Actions that can be made within the item.
* @param An array of actions
* @param `icon` is the icon id of the action item
* @param `tooltip` is the hint of the action item
* @param `command` is the command name that will be executed when current action triggered
*/
buttons?: {
iconPath: string;
tooltip: string;
command: string;
}[];
}
export type Void = {};
export declare const Void: {};
/**
* environment meta data
*/
export interface EnvMeta {
name: string;
local: boolean;
sideloading: boolean;
}
export interface Inputs extends Record<string, any> {
platform: Platform;
projectPath?: string;
projectId?: string;
nonInteractive?: boolean;
correlationId?: string;
/**
* whether the caller is triggered by @teams or @office agent
*/
agent?: "teams" | "office";
/**
* Auth info about user selected APIs.
*/
apiAuthData?: AuthInfo;
}
export type InputsWithProjectPath = Inputs & {
projectPath: string;
};
export type CreateProjectInputs = Inputs & {
"app-name": string;
folder: string;
};
export type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
};
export type MaybePromise<T> = T | Promise<T>;
/**
* simplified tooling settings for v3
*/
export interface Settings {
version: string;
trackingId: string;
}
export type ManifestCapability = {
name: "staticTab";
snippet?: IStaticTab;
existingApp?: boolean;
} | {
name: "configurableTab";
snippet?: IConfigurableTab;
existingApp?: boolean;
} | {
name: "Bot";
snippet?: IBot;
existingApp?: boolean;
} | {
name: "MessageExtension";
snippet?: IComposeExtension;
existingApp?: boolean;
} | {
name: "WebApplicationInfo";
snippet?: IWebApplicationInfo;
existingApp?: boolean;
};
export interface AuthInfo {
serverUrl: string;
authName?: string;
authType?: "apiKey" | "oauth2";
}
export interface ApiOperation {
id: string;
label: string;
groupName: string;
data: AuthInfo;
detail?: string;
}
export interface Warning {
type: string;
content: string;
data?: any;
}
export interface CreateProjectResult {
projectPath: string;
warnings?: Warning[];
shouldInvokeTeamsAgent?: boolean;
projectId?: string;
lastCommand?: string;
}
export interface TeamsAppInputs extends InputsWithProjectPath {
"manifest-file"?: string;
"package-file"?: string;
"output-package-file"?: string;
"output-folder"?: string;
env?: string;
"env-file"?: string;
}
//# sourceMappingURL=types.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;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AC;CACZ;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
+7
View File
@@ -0,0 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Void = void 0;
exports.Void = {};
//# sourceMappingURL=types.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAwDA,QAAA,IAAI,GAAG,EAAE,CAAC"}
+18
View File
@@ -0,0 +1,18 @@
import { Result } from "neverthrow";
import { FxError } from "../error";
/**
* Encrypt/decrypt secrets
*/
export interface CryptoProvider {
/**
* Encrypt string
* @param plaintext - original string
*/
encrypt(plaintext: string): Result<string, FxError>;
/**
* Decrypt cipher string
* @param ciphertext - encrypted string
*/
decrypt(ciphertext: string): Result<string, FxError>;
}
//# sourceMappingURL=crypto.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/utils/crypto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEpD;;;OAGG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtD"}
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=crypto.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/utils/crypto.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
+4
View File
@@ -0,0 +1,4 @@
export interface ExpServiceProvider {
getTreatmentVariableAsync<T extends boolean | number | string>(configId: string, name: string, checkCache?: boolean): Promise<T | undefined>;
}
//# sourceMappingURL=exp.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"exp.d.ts","sourceRoot":"","sources":["../../src/utils/exp.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,yBAAyB,CAAC,CAAC,SAAS,OAAO,GAAG,MAAM,GAAG,MAAM,EAC3D,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CAC3B"}
+5
View File
@@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=exp.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"exp.js","sourceRoot":"","sources":["../../src/utils/exp.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC"}
+23
View File
@@ -0,0 +1,23 @@
import { UserInteraction } from "../qm/ui";
import { CryptoProvider } from "./crypto";
import { ExpServiceProvider } from "./exp";
import { LogProvider } from "./log";
import { TokenProvider } from "./login";
import { TelemetryReporter } from "./telemetry";
import { TreeProvider } from "./tree";
export * from "./login";
export * from "./log";
export * from "./telemetry";
export * from "./tree";
export * from "./crypto";
export * from "./exp";
export interface Tools {
logProvider: LogProvider;
tokenProvider: TokenProvider;
telemetryReporter?: TelemetryReporter;
treeProvider?: TreeProvider;
ui: UserInteraction;
cryptoProvider?: CryptoProvider;
expServiceProvider?: ExpServiceProvider;
}
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AAEtB,MAAM,WAAW,KAAK;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,EAAE,EAAE,eAAe,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC"}
+12
View File
@@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./login"), exports);
tslib_1.__exportStar(require("./log"), exports);
tslib_1.__exportStar(require("./telemetry"), exports);
tslib_1.__exportStar(require("./tree"), exports);
tslib_1.__exportStar(require("./crypto"), exports);
tslib_1.__exportStar(require("./exp"), exports);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAUb,kDAAwB;AACxB,gDAAsB;AACtB,sDAA4B;AAC5B,iDAAuB;AACvB,mDAAyB;AACzB,gDAAsB"}
+97
View File
@@ -0,0 +1,97 @@
export declare enum LogLevel {
/**
* For debugging and development.
*/
Debug = 1,
/**
* Contain the most detailed messages.
*/
Verbose = 2,
/**
* Tracks the general flow of the app. May have long-term value.
*/
Info = 3,
/**
* For abnormal or unexpected events. Typically includes errors or conditions that don't cause the app to fail.
*/
Warning = 4,
/**
* For errors and exceptions that cannot be handled. These messages indicate a failure in the current operation or request, not an app-wide failure.
*/
Error = 5
}
export interface LogProvider {
/**
* log by level
*/
log(logLevel: LogLevel, message: string): void;
/**
* diagnostic information used by user
*/
verbose(message: string): void;
/**
* debug information used internally
*/
debug(message: string): void;
/**
* normal output information
*/
info(message: string): void;
/**
* normal output information, colored version
*/
info(message: Array<{
content: string;
color: Colors;
}>): void;
/**
* warning information
*/
warning(message: string): void;
/**
* error information
*/
error(message: string): void;
/**
* log content into file
*/
logInFile(logLevel: LogLevel, message: string): Promise<void>;
/**
* Get log file path
*/
getLogFilePath(): string;
}
/**
* Colors for CLI output message
*/
export declare enum Colors {
/**
* Primary text color
*/
BRIGHT_WHITE = 0,
/**
* Secondary text color
*/
WHITE = 1,
/**
* Important text color
*/
BRIGHT_MAGENTA = 2,
/**
* Success message indicator
*/
BRIGHT_GREEN = 3,
/**
* Warning message indicator
*/
BRIGHT_YELLOW = 4,
/**
* Error message indicator
*/
BRIGHT_RED = 5,
/**
* Hyperlink
*/
BRIGHT_CYAN = 6
}
//# sourceMappingURL=log.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAIA,oBAAY,QAAQ;IAClB;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,IAAI,IAAI;IACR;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,KAAK,IAAI;CACV;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/C;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAE/D;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D;;OAEG;IACH,cAAc,IAAI,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,oBAAY,MAAM;IAChB;;OAEG;IACH,YAAY,IAAI;IAChB;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,cAAc,IAAI;IAClB;;OAEG;IACH,YAAY,IAAI;IAChB;;OAEG;IACH,aAAa,IAAI;IACjB;;OAEG;IACH,UAAU,IAAI;IACd;;OAEG;IACH,WAAW,IAAI;CAChB"}
+63
View File
@@ -0,0 +1,63 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Colors = exports.LogLevel = void 0;
var LogLevel;
(function (LogLevel) {
/**
* For debugging and development.
*/
LogLevel[LogLevel["Debug"] = 1] = "Debug";
/**
* Contain the most detailed messages.
*/
LogLevel[LogLevel["Verbose"] = 2] = "Verbose";
/**
* Tracks the general flow of the app. May have long-term value.
*/
LogLevel[LogLevel["Info"] = 3] = "Info";
/**
* For abnormal or unexpected events. Typically includes errors or conditions that don't cause the app to fail.
*/
LogLevel[LogLevel["Warning"] = 4] = "Warning";
/**
* For errors and exceptions that cannot be handled. These messages indicate a failure in the current operation or request, not an app-wide failure.
*/
LogLevel[LogLevel["Error"] = 5] = "Error";
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
/**
* Colors for CLI output message
*/
var Colors;
(function (Colors) {
/**
* Primary text color
*/
Colors[Colors["BRIGHT_WHITE"] = 0] = "BRIGHT_WHITE";
/**
* Secondary text color
*/
Colors[Colors["WHITE"] = 1] = "WHITE";
/**
* Important text color
*/
Colors[Colors["BRIGHT_MAGENTA"] = 2] = "BRIGHT_MAGENTA";
/**
* Success message indicator
*/
Colors[Colors["BRIGHT_GREEN"] = 3] = "BRIGHT_GREEN";
/**
* Warning message indicator
*/
Colors[Colors["BRIGHT_YELLOW"] = 4] = "BRIGHT_YELLOW";
/**
* Error message indicator
*/
Colors[Colors["BRIGHT_RED"] = 5] = "BRIGHT_RED";
/**
* Hyperlink
*/
Colors[Colors["BRIGHT_CYAN"] = 6] = "BRIGHT_CYAN";
})(Colors = exports.Colors || (exports.Colors = {}));
//# sourceMappingURL=log.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAEb,IAAY,QAqBX;AArBD,WAAY,QAAQ;IAClB;;OAEG;IACH,yCAAS,CAAA;IACT;;OAEG;IACH,6CAAW,CAAA;IACX;;OAEG;IACH,uCAAQ,CAAA;IACR;;OAEG;IACH,6CAAW,CAAA;IACX;;OAEG;IACH,yCAAS,CAAA;AACX,CAAC,EArBW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAqBnB;AAgDD;;GAEG;AACH,IAAY,MA6BX;AA7BD,WAAY,MAAM;IAChB;;OAEG;IACH,mDAAgB,CAAA;IAChB;;OAEG;IACH,qCAAS,CAAA;IACT;;OAEG;IACH,uDAAkB,CAAA;IAClB;;OAEG;IACH,mDAAgB,CAAA;IAChB;;OAEG;IACH,qDAAiB,CAAA;IACjB;;OAEG;IACH,+CAAc,CAAA;IACd;;OAEG;IACH,iDAAe,CAAA;AACjB,CAAC,EA7BW,MAAM,GAAN,cAAM,KAAN,cAAM,QA6BjB"}
+184
View File
@@ -0,0 +1,184 @@
import { TokenCredential } from "@azure/core-auth";
import { Result } from "neverthrow";
import { FxError } from "../error";
export type AzureCredential = {
type: "AuthorizationCode";
/**
* The user account's e-mail address (user name).
*/
username: string;
/**
* The Microsoft Entra tenant (directory) ID.
* This parameter is used for multi-tenant account scenario
*/
tenantId?: string;
/**
* whether pop up sign in flow if the account is not signed in, default is true
*/
popUpSignIn?: boolean;
} | {
type: "ClientSecretCredential";
/**
* The Microsoft Entra tenant (directory) ID.
*/
tenantId: string;
/**
* The client (application) ID of an App Registration in the tenant.
*/
clientId: string;
/**
* A client secret that was generated for the App Registration.
*/
clientSecret: string;
} | {
type: "ClientCertificateCredential";
/**
* The Microsoft Entra tenant (directory) ID.
*/
tenantId: string;
/**
* The client (application) ID of an App Registration in the tenant.
*/
clientId: string;
/**
* The path to a PEM-encoded public/private key certificate on the filesystem.
*/
certificatePath: string;
};
/**
* Difference between getAccountCredential and getIdentityCredential [Node Azure Authenticate](https://docs.microsoft.com/en-us/azure/developer/javascript/core/node-sdk-azure-authenticate)
* You can search at [Azure JS SDK](https://docs.microsoft.com/en-us/javascript/api/overview/azure/?view=azure-node-latest) to see which credential you need.
*/
export interface AzureAccountProvider {
/**
* Async get identity [crendential](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/core/core-auth/src/tokenCredential.ts)
* @param showDialog Control whether the UI layer displays pop-up windows.
*/
getIdentityCredentialAsync(showDialog?: boolean): Promise<TokenCredential | undefined>;
/**
* To support credential per action feature, caller can specify credential info for on demand
* This method will be optional until V3 first release, after that it will be changed to required
* @param credential
*/
getIdentityCredential?(credential: AzureCredential): Promise<TokenCredential | undefined>;
/**
* Azure sign out
*/
signout(): Promise<boolean>;
/**
* Switch to specified tenant for current user account
* @param tenantId id of tenant that user wants to switch to
*/
switchTenant(tenantId: string): Promise<Result<TokenCredential, FxError>>;
/**
* Add update account info callback
* @param name callback name
* @param statusChange callback method
* @param immediateCall whether callback when register, the default value is true
*/
setStatusChangeMap(name: string, statusChange: (status: string, token?: string, accountInfo?: Record<string, unknown>) => Promise<void>, immediateCall?: boolean): Promise<boolean>;
/**
* Remove update account info callback
* @param name callback name
*/
removeStatusChangeMap(name: string): Promise<boolean>;
/**
* Get Azure token JSON object
* - tid : tenantId
* - unique_name : user name
* - ...
* @param showDialog Control whether the UI layer displays pop-up windows
*/
getJsonObject(showDialog?: boolean): Promise<Record<string, unknown> | undefined>;
/**
* List subscription detail
*/
listSubscriptions(): Promise<SubscriptionInfo[]>;
/**
* Set subscription id to memory
* @param subscriptionId user used subscription id (subscriptionId==="" will clear sub information in Azure account provider
* cache)
*/
setSubscription(subscriptionId: string): Promise<void>;
/**
* Get account information
*/
getAccountInfo(): Record<string, string> | undefined;
/**
* Get user select subscription, tenant information
* @param triggerUI whether means trigger login or select subscription workflow when user has not logged in or selected subscription
* @returns SubscriptionInfo.subscriptionId === "", means user does not select subscription
*/
getSelectedSubscription(triggerUI?: boolean): Promise<SubscriptionInfo | undefined>;
}
export type SubscriptionInfo = {
subscriptionName: string;
subscriptionId: string;
tenantId: string;
};
export declare type TokenRequest = {
scopes: Array<string>;
showDialog?: boolean;
};
export type LoginStatus = {
status: string;
token?: string;
accountInfo?: Record<string, unknown>;
};
/**
* Provide M365 accessToken and JSON object
*
*/
export interface M365TokenProvider {
/**
* Get M365 access token
* @param tokenRequest permission scopes or show user interactive UX
*/
getAccessToken(tokenRequest: TokenRequest): Promise<Result<string, FxError>>;
/**
* Get M365 token Json object
* - tid : tenantId
* - unique_name : user name
* - ...
* @param tokenRequest permission scopes or show user interactive UX
*/
getJsonObject(tokenRequest: TokenRequest): Promise<Result<Record<string, unknown>, FxError>>;
/**
* Get user login status
* @param tokenRequest permission scopes or show user interactive UX
*/
getStatus(tokenRequest: TokenRequest): Promise<Result<LoginStatus, FxError>>;
/**
* Switch to specified tenant for current user account
* @param tenantId id of tenant that user wants to switch to
*/
switchTenant(tenantId: string): Promise<Result<string, FxError>>;
/**
* Add update account info callback
* @param name callback name
* @param tokenRequest permission scopes
* @param statusChange callback method
* @param immediateCall whether callback when register, the default value is true
*/
setStatusChangeMap(name: string, tokenRequest: TokenRequest, statusChange: (status: string, token?: string, accountInfo?: Record<string, unknown>) => Promise<void>, immediateCall?: boolean): Promise<Result<boolean, FxError>>;
/**
* Remove update account info callback
* @param name callback name
*/
removeStatusChangeMap(name: string): Promise<Result<boolean, FxError>>;
}
export type TokenProvider = {
azureAccountProvider: AzureAccountProvider;
m365TokenProvider: M365TokenProvider;
};
/**
* Provide basic login framework
*/
export declare abstract class BasicLogin {
statusChangeMap: Map<any, any>;
setStatusChangeMap(name: string, tokenRequest: TokenRequest, statusChange: (status: string, token?: string, accountInfo?: Record<string, unknown>) => Promise<void>, immediateCall?: boolean): Promise<Result<boolean, FxError>>;
removeStatusChangeMap(name: string): Promise<Result<boolean, FxError>>;
abstract getStatus(tokenRequest: TokenRequest): Promise<Result<LoginStatus, FxError>>;
notifyStatus(tokenRequest: TokenRequest): Promise<void>;
}
//# sourceMappingURL=login.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/utils/login.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAM,MAAM,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GACD;IACE,IAAI,EAAE,wBAAwB,CAAC;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,6BAA6B,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,0BAA0B,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAEvF;;;;OAIG;IACH,qBAAqB,CAAC,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CA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OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;CACxE;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,8BAAsB,UAAU;IAC9B,eAAe,gBAAa;IAEtB,kBAAkB,CACtB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,CACZ,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAClC,OAAO,CAAC,IAAI,CAAC,EAClB,aAAa,UAAO,GACnB,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAepC,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAKtE,QAAQ,CAAC,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAE/E,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CAY9D"}
+38
View File
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicLogin = void 0;
const neverthrow_1 = require("neverthrow");
/**
* Provide basic login framework
*/
class BasicLogin {
constructor() {
this.statusChangeMap = new Map();
}
async setStatusChangeMap(name, tokenRequest, statusChange, immediateCall = true) {
this.statusChangeMap.set(name, statusChange);
if (immediateCall) {
const loginStatusRes = await this.getStatus(tokenRequest);
if (loginStatusRes.isOk()) {
await statusChange(loginStatusRes.value.status, loginStatusRes.value.token, loginStatusRes.value.accountInfo);
}
}
return (0, neverthrow_1.ok)(true);
}
removeStatusChangeMap(name) {
this.statusChangeMap.delete(name);
return Promise.resolve((0, neverthrow_1.ok)(true));
}
async notifyStatus(tokenRequest) {
const loginStatusRes = await this.getStatus(tokenRequest);
if (loginStatusRes.isOk()) {
for (const entry of this.statusChangeMap.entries()) {
entry[1](loginStatusRes.value.status, loginStatusRes.value.token, loginStatusRes.value.accountInfo);
}
}
}
}
exports.BasicLogin = BasicLogin;
//# sourceMappingURL=login.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/utils/login.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAGb,2CAAwC;AA+MxC;;GAEG;AACH,MAAsB,UAAU;IAAhC;QACE,oBAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IA6C9B,CAAC;IA3CC,KAAK,CAAC,kBAAkB,CACtB,IAAY,EACZ,YAA0B,EAC1B,YAIkB,EAClB,aAAa,GAAG,IAAI;QAEpB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC7C,IAAI,aAAa,EAAE;YACjB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC1D,IAAI,cAAc,CAAC,IAAI,EAAE,EAAE;gBACzB,MAAM,YAAY,CAChB,cAAc,CAAC,KAAK,CAAC,MAAM,EAC3B,cAAc,CAAC,KAAK,CAAC,KAAK,EAC1B,cAAc,CAAC,KAAK,CAAC,WAAW,CACjC,CAAC;aACH;SACF;QACD,OAAO,IAAA,eAAE,EAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,qBAAqB,CAAC,IAAY;QAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,eAAE,EAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC;IAID,KAAK,CAAC,YAAY,CAAC,YAA0B;QAC3C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC1D,IAAI,cAAc,CAAC,IAAI,EAAE,EAAE;YACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;gBAClD,KAAK,CAAC,CAAC,CAAC,CACN,cAAc,CAAC,KAAK,CAAC,MAAM,EAC3B,cAAc,CAAC,KAAK,CAAC,KAAK,EAC1B,cAAc,CAAC,KAAK,CAAC,WAAW,CACjC,CAAC;aACH;SACF;IACH,CAAC;CACF;AA9CD,gCA8CC"}
+42
View File
@@ -0,0 +1,42 @@
/**
* Reporter of telemetry to send event and exception to app insights.
* Event and exception follow the [Application Insights telemetry data model](https://docs.microsoft.com/en-us/azure/azure-monitor/app/data-model)
*/
export interface TelemetryReporter {
/**
* Send general events to App Insights
* @param eventName Event name. Max length: 512 characters. To allow proper grouping and useful metrics, restrict your application so that it generates a small number of separate event names.
* @param properties Name-value collection of custom properties. Max key length: 150, Max value length: 8192. this collection is used to extend standard telemetry with the custom dimensions.
* @param measurements Collection of custom measurements. Use this collection to report named measurement associated with the telemetry item.
*
*/
sendTelemetryEvent(eventName: string, properties?: {
[key: string]: string;
}, measurements?: {
[key: string]: number;
}): void;
/**
* Send error telemetry as traditional events to App Insights.
* @param eventName Event name. Max length: 512 characters.
* @param properties Name-value collection of custom properties. Max key length: 150, Max value length: 8192.
* @param measurements Collection of custom measurements.
* @param errorProps Str collection of valuable error messages.
*/
sendTelemetryErrorEvent(eventName: string, properties?: {
[key: string]: string;
}, measurements?: {
[key: string]: number;
}, errorProps?: string[]): void;
/**
* Send error for diagnostics in App Insights.
* @param error Error to troubleshooting.
* @param properties Name-value collection of custom properties. Max key length: 150, Max value length: 8192.
* @param measurements Collection of custom measurements.
*/
sendTelemetryException(error: Error, properties?: {
[key: string]: string;
}, measurements?: {
[key: string]: number;
}): void;
}
//# sourceMappingURL=telemetry.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,kBAAkB,CAChB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EACtC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GACvC,IAAI,CAAC;IAER;;;;;;OAMG;IACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EACtC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EACxC,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,IAAI,CAAC;IAER;;;;;OAKG;IACH,sBAAsB,CACpB,KAAK,EAAE,KAAK,EACZ,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EACtC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GACvC,IAAI,CAAC;CACT"}
+5
View File
@@ -0,0 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=telemetry.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/utils/telemetry.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC"}
+32
View File
@@ -0,0 +1,32 @@
import { Result } from "neverthrow";
import { FxError } from "../error";
export interface TreeItem {
commandId: string;
label: string;
callback?: (args: any) => Promise<Result<null, FxError>>;
parent?: TreeCategory | string;
contextValue?: string;
icon?: string;
subTreeItems?: TreeItem[];
tooltip?: {
value: string;
isMarkdown: boolean;
};
description?: string;
isCustom?: boolean;
expanded?: boolean;
}
export interface TreeProvider {
refresh: (tree: TreeItem[]) => Promise<Result<null, FxError>>;
add: (tree: TreeItem[]) => Promise<Result<null, FxError>>;
remove: (tree: TreeItem[]) => Promise<Result<null, FxError>>;
}
export declare enum TreeCategory {
GettingStarted = 0,
Account = 1,
Feedback = 2,
Project = 3,
Provision = 4,
Environment = 5
}
//# sourceMappingURL=tree.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/utils/tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9D,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;CAC9D;AAED,oBAAY,YAAY;IACtB,cAAc,IAAA;IACd,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,SAAS,IAAA;IACT,WAAW,IAAA;CACZ"}
+13
View File
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeCategory = void 0;
var TreeCategory;
(function (TreeCategory) {
TreeCategory[TreeCategory["GettingStarted"] = 0] = "GettingStarted";
TreeCategory[TreeCategory["Account"] = 1] = "Account";
TreeCategory[TreeCategory["Feedback"] = 2] = "Feedback";
TreeCategory[TreeCategory["Project"] = 3] = "Project";
TreeCategory[TreeCategory["Provision"] = 4] = "Provision";
TreeCategory[TreeCategory["Environment"] = 5] = "Environment";
})(TreeCategory = exports.TreeCategory || (exports.TreeCategory = {}));
//# sourceMappingURL=tree.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/utils/tree.ts"],"names":[],"mappings":";;;AA4BA,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,mEAAc,CAAA;IACd,qDAAO,CAAA;IACP,uDAAQ,CAAA;IACR,qDAAO,CAAA;IACP,yDAAS,CAAA;IACT,6DAAW,CAAA;AACb,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB"}