@microsoft/teamsfx 0.2.6 → 0.2.7-alpha.38498d2f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/dist/index.js.map +1 -1
- package/dist/teamsfx.js.map +1 -1
- package/dist-esm/src/credential/m365TenantCredential.js.map +1 -1
- package/dist-esm/src/credential/teamsUserCredential.browser.js.map +1 -1
- package/dist-esm/src/util/utils.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -112,16 +112,32 @@ TeamsFx SDK provides helper functions to ease the configuration for third-party
|
|
|
112
112
|
|
|
113
113
|
API will throw `ErrorWithCode` if error happens. Each `ErrorWithCode` contains error code and error message.
|
|
114
114
|
|
|
115
|
-
For example, to filter out
|
|
115
|
+
For example, to filter out specific error, you could use the following check:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
try {
|
|
119
|
+
const credential = new TeamsUserCredential();
|
|
120
|
+
await credential.login("User.Read");
|
|
121
|
+
} catch (err: unknown) {
|
|
122
|
+
if (err instanceof ErrorWithCode && err.code !== ErrorCode.ConsentFailed) {
|
|
123
|
+
throw err;
|
|
124
|
+
} else {
|
|
125
|
+
// Silently fail because user cancels the consent dialog
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
And if credential instance is used in other library like Microsoft Graph, it's possible that error is catched and transformed.
|
|
116
132
|
|
|
117
133
|
```ts
|
|
118
134
|
try {
|
|
119
135
|
const credential = new TeamsUserCredential();
|
|
120
136
|
const graphClient = createMicrosoftGraphClient(credential, ["User.Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
|
|
121
137
|
const profile = await graphClient.api("/me").get();
|
|
122
|
-
} catch (err) {
|
|
123
|
-
//
|
|
124
|
-
if (err instanceof
|
|
138
|
+
} catch (err: unknown) {
|
|
139
|
+
// ErrorWithCode is handled by Graph client
|
|
140
|
+
if (err instanceof GraphError && err.code?.includes(ErrorCode.UiRequiredError)) {
|
|
125
141
|
this.setState({
|
|
126
142
|
showLoginBtn: true,
|
|
127
143
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/core/errors.ts","../src/util/logger.ts","../src/util/utils.ts","../src/models/configuration.ts","../src/core/configurationProvider.ts","../src/credential/m365TenantCredential.ts","../src/credential/onBehalfOfUserCredential.ts","../src/credential/teamsUserCredential.ts","../src/core/msGraphAuthProvider.ts","../src/bot/teamsBotSsoPrompt.ts","../src/core/msGraphClientProvider.ts","../src/core/defaultTediousConnectionConfiguration.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n *\n * @beta\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n * @beta\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nclass InternalLogger {\n public level?: LogLevel = undefined;\n\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n const logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n *\n * @beta\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n *\n * @beta\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj = jwt_decode(token) as SSOTokenInfoBase;\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration for current environment.\n * @beta\n */\nexport interface Configuration {\n /**\n * Authentication related configuration.\n *\n * @readonly\n */\n readonly authentication?: AuthenticationConfiguration;\n\n /**\n * Configuration for resources.\n *\n * @readonly\n */\n readonly resources?: ResourceConfiguration[];\n}\n\n/**\n * Authentication related configuration.\n * @beta\n */\nexport interface AuthenticationConfiguration {\n /**\n * Hostname of AAD authority. Default value comes from M365_AUTHORITY_HOST environment variable.\n *\n * @readonly\n */\n readonly authorityHost?: string;\n\n /**\n * AAD tenant id, default value comes from M365_TENANT_ID environment variable.\n *\n * @readonly\n */\n readonly tenantId?: string;\n\n /**\n * The client (application) ID of an App Registration in the tenant, default value comes from M365_CLIENT_ID environment variable\n *\n * @readonly\n */\n readonly clientId?: string;\n\n /**\n * Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal. Default value comes from M365_CLIENT_SECRET environment variable\n *\n * @readonly\n */\n readonly clientSecret?: string;\n\n /**\n * Endpoint of auth service provisioned by Teams Framework. Default value comes from SIMPLE_AUTH_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly simpleAuthEndpoint?: string;\n\n /**\n * Login page for Teams to redirect to. Default value comes from INITIATE_LOGIN_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly initiateLoginEndpoint?: string;\n\n /**\n * Application ID URI. Default value comes from M365_APPLICATION_ID_URI environment variable.\n */\n readonly applicationIdUri?: string;\n}\n\n/**\n * Configuration for resources.\n * @beta\n */\nexport interface ResourceConfiguration {\n /**\n * Resource type.\n *\n * @readonly\n */\n readonly type: ResourceType;\n\n /**\n * Resource name.\n *\n * @readonly\n */\n readonly name: string;\n\n /**\n * Config for the resource.\n *\n * @readonly\n */\n readonly properties: { [index: string]: any };\n}\n\n/**\n * Available resource type.\n * @beta\n */\nexport enum ResourceType {\n /**\n * SQL database.\n *\n */\n SQL,\n\n /**\n * Rest API.\n *\n */\n API,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isNode } from \"@azure/core-http\";\nimport {\n AuthenticationConfiguration,\n Configuration,\n ResourceConfiguration,\n ResourceType,\n} from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"./errors\";\n\n/**\n * Global configuration instance\n *\n */\nexport let config: Configuration;\n\n/**\n * Initialize configuration from environment variables or configuration object and set the global instance\n *\n * @param {Configuration} configuration - Optional configuration that overrides the default configuration values. The override depth is 1.\n *\n * @throws {@link ErrorCode|InvalidParameter} when configuration is not passed in browser environment\n *\n * @beta\n */\nexport function loadConfiguration(configuration?: Configuration): void {\n internalLogger.info(\"load configuration\");\n\n // browser environment\n if (!isNode) {\n if (!configuration) {\n const errorMsg = \"You are running the code in browser. Configuration must be passed in.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n config = configuration;\n return;\n }\n\n // node environment\n let newAuthentication: AuthenticationConfiguration;\n let newResources: ResourceConfiguration[] = [];\n const defaultResourceName = \"default\";\n\n if (configuration?.authentication) {\n newAuthentication = configuration.authentication;\n } else {\n newAuthentication = {\n authorityHost: process.env.M365_AUTHORITY_HOST,\n tenantId: process.env.M365_TENANT_ID,\n clientId: process.env.M365_CLIENT_ID,\n clientSecret: process.env.M365_CLIENT_SECRET,\n simpleAuthEndpoint: process.env.SIMPLE_AUTH_ENDPOINT,\n initiateLoginEndpoint: process.env.INITIATE_LOGIN_ENDPOINT,\n applicationIdUri: process.env.M365_APPLICATION_ID_URI,\n };\n }\n\n if (configuration?.resources) {\n newResources = configuration.resources;\n } else {\n newResources = [\n {\n // SQL resource\n type: ResourceType.SQL,\n name: defaultResourceName,\n properties: {\n sqlServerEndpoint: process.env.SQL_ENDPOINT,\n sqlUsername: process.env.SQL_USER_NAME,\n sqlPassword: process.env.SQL_PASSWORD,\n sqlDatabaseName: process.env.SQL_DATABASE_NAME,\n sqlIdentityId: process.env.IDENTITY_ID,\n },\n },\n {\n // API resource\n type: ResourceType.API,\n name: defaultResourceName,\n properties: {\n endpoint: process.env.API_ENDPOINT,\n },\n },\n ];\n }\n\n config = {\n authentication: newAuthentication,\n resources: newResources,\n };\n}\n\n/**\n * Get configuration for a specific resource.\n * @param {ResourceType} resourceType - The type of resource\n * @param {string} resourceName - The name of resource, default value is \"default\".\n *\n * @returns Resource configuration for target resource from global configuration instance.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when resource configuration with the specific type and name is not found\n *\n * @beta\n */\nexport function getResourceConfiguration(\n resourceType: ResourceType,\n resourceName = \"default\"\n): { [index: string]: any } {\n internalLogger.info(\n `Get resource configuration of ${ResourceType[resourceType]} from ${resourceName}`\n );\n const result: ResourceConfiguration | undefined = config.resources?.find(\n (item) => item.type === resourceType && item.name === resourceName\n );\n if (result) {\n return result.properties;\n }\n\n const errorMsg = formatString(\n ErrorMessage.MissingResourceConfiguration,\n ResourceType[resourceType],\n resourceName\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n}\n\n/**\n * Get configuration for authentication.\n *\n * @returns Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when global configuration does not exist\n *\n * @beta\n */\nexport function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined {\n internalLogger.info(\"Get authentication configuration\");\n if (config) {\n return config.authentication;\n }\n const errorMsg =\n \"Please call loadConfiguration() first before calling getAuthenticationConfiguration().\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.ConfigurationNotExists, errorMsg),\n ErrorCode.InvalidConfiguration\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AccessToken,\n TokenCredential,\n GetTokenOptions,\n ClientSecretCredential,\n TokenCredentialOptions,\n AuthenticationError,\n} from \"@azure/identity\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType, formatString } from \"../util/utils\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.\n *\n * @example\n * ```typescript\n * loadConfiguration(); // load configuration from environment variables\n * const credential = new M365TenantCredential();\n * ```\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport class M365TenantCredential implements TokenCredential {\n private readonly clientSecretCredential: ClientSecretCredential;\n\n /**\n * Constructor of M365TenantCredential.\n *\n * @remarks\n * Only works in in server side.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n constructor() {\n internalLogger.info(\"Create M365 tenant credential\");\n\n const config = this.loadAndValidateConfig();\n\n const tokenCredentialOptions: TokenCredentialOptions = {\n authorityHost: config.authorityHost,\n };\n\n this.clientSecretCredential = new ClientSecretCredential(\n config.tenantId!,\n config.clientId!,\n config.clientSecret!,\n tokenCredentialOptions\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([\"User.Read.All\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read.All\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read.All\", \"Calendars.Read\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read.All Calendars.Read\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read.All\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|ServiceError} when get access token with authentication error.\n * @throws {@link ErrorCode|InternalError} when get access token with unknown error.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Access token with expected scopes.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n let accessToken;\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n internalLogger.info(\"Get access token with scopes: \" + scopesStr);\n\n try {\n accessToken = await this.clientSecretCredential.getToken(scopes);\n } catch (err) {\n if (err instanceof AuthenticationError) {\n const authError = err as AuthenticationError;\n const errorMsg = `Get M365 tenant credential with authentication error: status code ${authError.statusCode}, error messages: ${authError.message}`;\n internalLogger.error(errorMsg);\n\n throw new ErrorWithCode(errorMsg, ErrorCode.ServiceError);\n } else {\n const errorMsg = \"Get M365 tenant credential failed with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n }\n\n if (!accessToken) {\n const errorMsg = \"Get M365 tenant credential access token failed with empty access token\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n return accessToken;\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.clientId && config.clientSecret && config.tenantId) {\n return config;\n }\n\n const missingValues = [];\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n if (!config.clientSecret) {\n missingValues.push(\"clientSecret\");\n }\n\n if (!config.tenantId) {\n missingValues.push(\"tenantId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { AuthenticationResult, ConfidentialClientApplication } from \"@azure/msal-node\";\nimport { config } from \"../core/configurationProvider\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString, getUserInfoFromSsoToken, parseJwt, validateScopesType } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in server side.\n *\n * @example\n * ```typescript\n * loadConfiguration(); // load configuration from environment variables\n * const credential = new OnBehalfOfUserCredential(ssoToken);\n * ```\n *\n * @remarks\n * Can only be used in server side.\n *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n private msalClient: ConfidentialClientApplication;\n private ssoToken: AccessToken;\n\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Only works in in server side.\n *\n * @param {string} ssoToken - User token provided by Teams SSO feature.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, authority host or tenant id is not found in config.\n * @throws {@link ErrorCode|InternalError} when SSO token is not valid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(ssoToken: string) {\n internalLogger.info(\"Get on behalf of user credential\");\n\n const missingConfigurations: string[] = [];\n if (!config?.authentication?.clientId) {\n missingConfigurations.push(\"clientId\");\n }\n\n if (!config?.authentication?.authorityHost) {\n missingConfigurations.push(\"authorityHost\");\n }\n\n if (!config?.authentication?.clientSecret) {\n missingConfigurations.push(\"clientSecret\");\n }\n\n if (!config?.authentication?.tenantId) {\n missingConfigurations.push(\"tenantId\");\n }\n\n if (missingConfigurations.length != 0) {\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingConfigurations.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n const normalizedAuthorityHost = config.authentication!.authorityHost!.replace(/\\/+$/g, \"\");\n const authority: string =\n normalizedAuthorityHost + \"/\" + config.authentication?.tenantId;\n this.msalClient = new ConfidentialClientApplication({\n auth: {\n clientId: config.authentication!.clientId!,\n authority: authority,\n clientSecret: config.authentication!.clientSecret!,\n },\n });\n\n const decodedSsoToken = parseJwt(ssoToken);\n this.ssoToken = {\n token: ssoToken,\n expiresOnTimestamp: decodedSsoToken.exp,\n };\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to acquire access token on behalf of user with unknown error.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns Access token with expected scopes.\n *\n * @remarks\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n\n let scopesArray: string[] = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n scopesArray = scopesArray.filter((x) => x !== null && x !== \"\");\n\n let result: AccessToken | null;\n if (!scopesArray.length) {\n internalLogger.info(\"Get SSO token.\");\n if (Math.floor(Date.now() / 1000) > this.ssoToken.expiresOnTimestamp) {\n const errorMsg = \"Sso token has already expired.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.TokenExpiredError);\n }\n result = this.ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopesArray.join(\" \"));\n\n let authenticationResult: AuthenticationResult | null;\n try {\n authenticationResult = await this.msalClient.acquireTokenOnBehalfOf({\n oboAssertion: this.ssoToken.token,\n scopes: scopesArray,\n });\n } catch (error) {\n throw this.generateAuthServerError(error);\n }\n\n if (!authenticationResult) {\n const errorMsg = \"Access token is null\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.FailToAcquireTokenOnBehalfOfUser, errorMsg),\n ErrorCode.InternalError\n );\n }\n\n result = {\n token: authenticationResult.accessToken,\n expiresOnTimestamp: authenticationResult.expiresOn!.getTime(),\n };\n }\n\n return result;\n }\n\n /**\n * Get basic user info from SSO token.\n *\n * @example\n * ```typescript\n * const currentUser = getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token is not valid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public getUserInfo(): UserInfo {\n internalLogger.info(\"Get basic user info from SSO token\");\n return getUserInfoFromSsoToken(this.ssoToken.token);\n }\n\n private generateAuthServerError(err: any): Error {\n const errorMessage = err.errorMessage;\n if (err.name === \"InteractionRequiredAuthError\") {\n const fullErrorMsg =\n \"Failed to get access token from AAD server, interaction required: \" + errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else if (errorMessage && errorMessage.indexOf(\"AADSTS500133\") >= 0) {\n const fullErrorMsg =\n \"Failed to get access token from AAD server, sso token expired: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.TokenExpiredError);\n } else {\n const fullErrorMsg = formatString(\n ErrorMessage.FailToAcquireTokenOnBehalfOfUser,\n errorMessage\n );\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Represent Teams current user's identity, and it is used within Teams client applications.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n /**\n * Constructor of TeamsUserCredential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n constructor() {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { TokenCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credential: TokenCredential;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - Credential used to invoke Microsoft Graph APIs.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n *\n * @beta\n */\n constructor(credential: TokenCredential, scopes?: string | string[]) {\n this.credential = credential;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);\n const accessToken = await this.credential.getToken(this.scopes);\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/identity\";\nimport {\n Activity,\n ActivityTypes,\n CardFactory,\n Channels,\n MessageFactory,\n TurnContext,\n OAuthCard,\n ActionTypes,\n verifyStateOperationName,\n StatusCodes,\n TokenExchangeInvokeRequest,\n tokenExchangeOperationName,\n TokenExchangeResource,\n TeamsInfo,\n TeamsChannelAccount,\n} from \"botbuilder\";\nimport {\n Dialog,\n DialogContext,\n DialogTurnResult,\n PromptOptions,\n PromptRecognizerResult,\n} from \"botbuilder-dialogs\";\nimport { TeamsBotSsoPromptTokenResponse } from \"./teamsBotSsoPromptTokenResponse\";\nimport { config } from \"../core/configurationProvider\";\nimport { OnBehalfOfUserCredential } from \"../credential/onBehalfOfUserCredential\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType, formatString, parseJwt } from \"../util/utils\";\n\nconst invokeResponseType = \"invokeResponse\";\n/**\n * Response body returned for a token exchange invoke activity.\n *\n * @beta\n */\nclass TokenExchangeInvokeResponse {\n /**\n * Response id\n */\n id: string;\n\n /**\n * Detailed error message\n */\n failureDetail: string;\n\n constructor(id: string, failureDetail: string) {\n this.id = id;\n this.failureDetail = failureDetail;\n }\n}\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @beta\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * loadConfiguration();\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n *\n * @beta\n */\nexport class TeamsBotSsoPrompt extends Dialog {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(dialogId: string, private settings: TeamsBotSsoPromptSettings) {\n super(dialogId);\n validateScopesType(settings.scopes);\n internalLogger.info(\"Create a new Teams Bot SSO Prompt\");\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n internalLogger.info(\"Begin Teams Bot SSO Prompt\");\n this.ensureMsTeamsChannel(dc);\n\n // Initialize prompt state\n const default_timeout = 900000;\n let timeout: number = default_timeout;\n if (this.settings.timeout) {\n if (typeof this.settings.timeout != \"number\") {\n const errorMsg = \"type of timeout property in teamsBotSsoPromptSettings should be number.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n if (this.settings.timeout <= 0) {\n const errorMsg =\n \"value of timeout property in teamsBotSsoPromptSettings should be positive.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n timeout = this.settings.timeout;\n }\n\n if (this.settings.endOnInvalidMessage === undefined) {\n this.settings.endOnInvalidMessage = true;\n }\n const state: teamsBotSsoPromptState = dc.activeDialog?.state as teamsBotSsoPromptState;\n state.state = {};\n state.options = {};\n state.expires = new Date().getTime() + timeout;\n\n // Send OAuth card to get SSO token\n await this.sendOAuthCardAsync(dc.context);\n return Dialog.EndOfTurn;\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n internalLogger.info(\"Continue Teams Bot SSO Prompt\");\n this.ensureMsTeamsChannel(dc);\n\n // Check for timeout\n const state: teamsBotSsoPromptState = dc.activeDialog?.state as teamsBotSsoPromptState;\n const isMessage: boolean = dc.context.activity.type === ActivityTypes.Message;\n const isTimeoutActivityType: boolean =\n isMessage ||\n this.isTeamsVerificationInvoke(dc.context) ||\n this.isTokenExchangeRequestInvoke(dc.context);\n\n // If the incoming Activity is a message, or an Activity Type normally handled by TeamsBotSsoPrompt,\n // check to see if this TeamsBotSsoPrompt Expiration has elapsed, and end the dialog if so.\n const hasTimedOut: boolean = isTimeoutActivityType && new Date().getTime() > state.expires;\n if (hasTimedOut) {\n internalLogger.warn(\"End Teams Bot SSO Prompt due to timeout\");\n return await dc.endDialog(undefined);\n } else {\n if (\n this.isTeamsVerificationInvoke(dc.context) ||\n this.isTokenExchangeRequestInvoke(dc.context)\n ) {\n // Recognize token\n const recognized: PromptRecognizerResult<TeamsBotSsoPromptTokenResponse> =\n await this.recognizeToken(dc);\n\n if (recognized.succeeded) {\n return await dc.endDialog(recognized.value);\n }\n } else if (isMessage && this.settings.endOnInvalidMessage) {\n internalLogger.warn(\"End Teams Bot SSO Prompt due to invalid message\");\n return await dc.endDialog(undefined);\n }\n\n return Dialog.EndOfTurn;\n }\n }\n\n /**\n * Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.\n * @param dc dialog context\n * @throws {@link ErrorCode|ChannelNotSupported} if bot channel is not MS Teams\n * @internal\n */\n private ensureMsTeamsChannel(dc: DialogContext) {\n if (dc.context.activity.channelId != Channels.Msteams) {\n const errorMsg = formatString(\n ErrorMessage.OnlyMSTeamsChannelSupported,\n \"Teams Bot SSO Prompt\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.ChannelNotSupported);\n }\n }\n\n /**\n * Send OAuthCard that tells Teams to obtain an authentication token for the bot application.\n * For details see https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots.\n *\n * @internal\n */\n private async sendOAuthCardAsync(context: TurnContext): Promise<void> {\n internalLogger.verbose(\"Send OAuth card to get SSO token\");\n\n const account: TeamsChannelAccount = await TeamsInfo.getMember(\n context,\n context.activity.from.id\n );\n internalLogger.verbose(\n \"Get Teams member account user principal name: \" + account.userPrincipalName\n );\n\n const loginHint: string = account.userPrincipalName ? account.userPrincipalName : \"\";\n const signInResource = this.getSignInResource(loginHint);\n const card = CardFactory.oauthCard(\n \"\",\n \"Teams SSO Sign In\",\n \"Sign In\",\n signInResource.signInLink,\n signInResource.tokenExchangeResource\n );\n (card.content as OAuthCard).buttons[0].type = ActionTypes.Signin;\n const msg: Partial<Activity> = MessageFactory.attachment(card);\n\n // Send prompt\n await context.sendActivity(msg);\n }\n\n /**\n * Get sign in resource.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} if client id, tenant id or initiate login endpoint is not found in config.\n *\n * @internal\n */\n private getSignInResource(loginHint: string) {\n internalLogger.verbose(\"Get sign in authentication configuration\");\n const missingConfigurations: string[] = [];\n\n if (!config?.authentication?.initiateLoginEndpoint) {\n missingConfigurations.push(\"initiateLoginEndpoint\");\n }\n\n if (!config?.authentication?.clientId) {\n missingConfigurations.push(\"clientId\");\n }\n\n if (!config?.authentication?.tenantId) {\n missingConfigurations.push(\"tenantId\");\n }\n\n if (!config?.authentication?.applicationIdUri) {\n missingConfigurations.push(\"applicationIdUri\");\n }\n\n if (missingConfigurations.length != 0) {\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingConfigurations.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n const signInLink = `${config.authentication!.initiateLoginEndpoint}?scope=${encodeURI(\n this.settings.scopes.join(\" \")\n )}&clientId=${config.authentication!.clientId}&tenantId=${\n config.authentication!.tenantId\n }&loginHint=${loginHint}`;\n\n internalLogger.verbose(\"Sign in link: \" + signInLink);\n\n const tokenExchangeResource: TokenExchangeResource = {\n id: uuidv4(),\n uri: config.authentication?.applicationIdUri!.replace(/\\/$/, \"\") + \"/access_as_user\",\n };\n\n internalLogger.verbose(\"Token exchange resource uri: \" + tokenExchangeResource.uri);\n\n return {\n signInLink: signInLink,\n tokenExchangeResource: tokenExchangeResource,\n };\n }\n\n /**\n * @internal\n */\n private async recognizeToken(\n dc: DialogContext\n ): Promise<PromptRecognizerResult<TeamsBotSsoPromptTokenResponse>> {\n const context = dc.context;\n let tokenResponse: TeamsBotSsoPromptTokenResponse | undefined;\n\n if (this.isTokenExchangeRequestInvoke(context)) {\n internalLogger.verbose(\"Receive token exchange request\");\n // Received activity is not a token exchange request\n if (!(context.activity.value && this.isTokenExchangeRequest(context.activity.value))) {\n const warningMsg =\n \"The bot received an InvokeActivity that is missing a TokenExchangeInvokeRequest value. This is required to be sent with the InvokeActivity.\";\n\n internalLogger.warn(warningMsg);\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(StatusCodes.BAD_REQUEST, warningMsg)\n );\n } else {\n const ssoToken = context.activity.value.token;\n const credential: OnBehalfOfUserCredential = new OnBehalfOfUserCredential(ssoToken);\n let exchangedToken: AccessToken | null;\n try {\n exchangedToken = await credential.getToken(this.settings.scopes);\n\n if (exchangedToken) {\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(StatusCodes.OK, \"\", context.activity.value.id)\n );\n\n const ssoTokenExpiration = parseJwt(ssoToken).exp;\n tokenResponse = {\n ssoToken: ssoToken,\n ssoTokenExpiration: new Date(ssoTokenExpiration * 1000).toISOString(),\n connectionName: \"\",\n token: exchangedToken.token,\n expiration: exchangedToken.expiresOnTimestamp.toString(),\n };\n }\n } catch (error) {\n const warningMsg = \"The bot is unable to exchange token. Ask for user consent.\";\n internalLogger.info(warningMsg);\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(\n StatusCodes.PRECONDITION_FAILED,\n warningMsg,\n context.activity.value.id\n )\n );\n }\n }\n } else if (this.isTeamsVerificationInvoke(context)) {\n internalLogger.verbose(\"Receive Teams state verification request\");\n await this.sendOAuthCardAsync(dc.context);\n await context.sendActivity({ type: invokeResponseType, value: { status: StatusCodes.OK } });\n }\n\n return tokenResponse !== undefined\n ? { succeeded: true, value: tokenResponse }\n : { succeeded: false };\n }\n\n /**\n * @internal\n */\n private getTokenExchangeInvokeResponse(\n status: number,\n failureDetail: string,\n id?: string\n ): Activity {\n const invokeResponse: Partial<Activity> = {\n type: invokeResponseType,\n value: { status, body: new TokenExchangeInvokeResponse(id as string, failureDetail) },\n };\n return invokeResponse as Activity;\n }\n\n /**\n * @internal\n */\n private isTeamsVerificationInvoke(context: TurnContext): boolean {\n const activity: Activity = context.activity;\n\n return activity.type === ActivityTypes.Invoke && activity.name === verifyStateOperationName;\n }\n\n /**\n * @internal\n */\n private isTokenExchangeRequestInvoke(context: TurnContext): boolean {\n const activity: Activity = context.activity;\n\n return activity.type === ActivityTypes.Invoke && activity.name === tokenExchangeOperationName;\n }\n\n /**\n * @internal\n */\n private isTokenExchangeRequest(obj: any): obj is TokenExchangeInvokeRequest {\n return obj.hasOwnProperty(\"token\");\n }\n}\n\n/**\n * @internal\n */\ninterface teamsBotSsoPromptState {\n state: any;\n options: PromptOptions;\n expires: number; // Timestamp of when the prompt will timeout.\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * Get Microsoft graph client.\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: '[\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TokenCredential} credential - token credential instance.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n *\n * @beta\n */\nexport function createMicrosoftGraphClient(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getResourceConfiguration } from \"./configurationProvider\";\nimport { ResourceType } from \"../models/configuration\";\nimport { AccessToken, ManagedIdentityCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { ConnectionConfig } from \"tedious\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * SQL connection configuration instance.\n * @remarks\n * Only works in in server side.\n *\n * @beta\n *\n */\nexport class DefaultTediousConnectionConfiguration {\n /**\n * MSSQL default scope\n * https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi\n */\n private readonly defaultSQLScope: string = \"https://database.windows.net/\";\n\n /**\n * Generate connection configuration consumed by tedious.\n *\n * @returns Connection configuration of tedious for the SQL.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.\n * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async getConfig(): Promise<ConnectionConfig> {\n internalLogger.info(\"Get SQL configuration\");\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n\n if (!configuration) {\n const errMsg = \"SQL resource configuration not exist\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n\n try {\n this.isSQLConfigurationValid(configuration);\n } catch (err) {\n throw err;\n }\n\n if (!this.isMsiAuthentication()) {\n const configWithUPS = this.generateDefaultConfig(configuration);\n internalLogger.verbose(\"SQL configuration with username and password generated\");\n return configWithUPS;\n }\n\n try {\n const configWithToken = await this.generateTokenConfig(configuration);\n internalLogger.verbose(\"SQL configuration with MSI token generated\");\n return configWithToken;\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Check SQL use MSI identity or username and password.\n *\n * @returns false - login with SQL MSI identity, true - login with username and password.\n * @internal\n */\n private isMsiAuthentication(): boolean {\n internalLogger.verbose(\n \"Check connection config using MSI access token or username and password\"\n );\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n if (configuration?.sqlUsername != null && configuration?.sqlPassword != null) {\n internalLogger.verbose(\"Login with username and password\");\n return false;\n }\n internalLogger.verbose(\"Login with MSI identity\");\n return true;\n }\n\n /**\n * check configuration is an available configurations.\n * @param { SqlConfiguration } sqlConfig\n *\n * @returns true - SQL configuration has a valid SQL endpoints, SQL username with password or identity ID.\n * false - configuration is not valid.\n * @internal\n */\n private isSQLConfigurationValid(sqlConfig: SqlConfiguration) {\n internalLogger.verbose(\"Check SQL configuration if valid\");\n if (!sqlConfig.sqlServerEndpoint) {\n internalLogger.error(\"SQL configuration is not valid without SQL server endpoint exist\");\n throw new ErrorWithCode(\n \"SQL configuration error without SQL server endpoint exist\",\n ErrorCode.InvalidConfiguration\n );\n }\n if (!(sqlConfig.sqlUsername && sqlConfig.sqlPassword) && !sqlConfig.sqlIdentityId) {\n const errMsg = `SQL configuration is not valid without ${\n sqlConfig.sqlIdentityId ? \"\" : \"identity id \"\n } ${sqlConfig.sqlUsername ? \"\" : \"SQL username \"} ${\n sqlConfig.sqlPassword ? \"\" : \"SQL password\"\n } exist`;\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n internalLogger.verbose(\"SQL configuration is valid\");\n }\n\n /**\n * Generate tedious connection configuration with default authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with username and password.\n *\n * @returns Tedious connection configuration with username and password.\n * @internal\n */\n private generateDefaultConfig(sqlConfig: SqlConfiguration): ConnectionConfig {\n internalLogger.verbose(\n `SQL server ${sqlConfig.sqlServerEndpoint}, user name ${sqlConfig.sqlUsername}, database name ${sqlConfig.sqlDatabaseName}`\n );\n\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.default,\n options: {\n userName: sqlConfig.sqlUsername,\n password: sqlConfig.sqlPassword,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n return config;\n }\n\n /**\n * Generate tedious connection configuration with azure-active-directory-access-token authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with AAD access token.\n *\n * @returns Tedious connection configuration with access token.\n * @internal\n */\n private async generateTokenConfig(sqlConfig: SqlConfiguration): Promise<ConnectionConfig> {\n internalLogger.verbose(\"Generate tedious config with MSI token\");\n\n let token: AccessToken | null;\n try {\n const credential = new ManagedIdentityCredential(sqlConfig.sqlIdentityId);\n token = await credential.getToken(this.defaultSQLScope);\n } catch (error) {\n const errMsg = \"Get user MSI token failed\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InternalError);\n }\n if (token) {\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.MSI,\n options: {\n token: token.token,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n internalLogger.verbose(\n `Generate token configuration success, server endpoint is ${sqlConfig.sqlServerEndpoint}, database name is ${sqlConfig.sqlDatabaseName}`\n );\n return config;\n }\n internalLogger.error(\n `Generate token configuration, server endpoint is ${sqlConfig.sqlServerEndpoint}, MSI token is not valid`\n );\n throw new ErrorWithCode(\"MSI token is not valid\", ErrorCode.InternalError);\n }\n}\n\n/**\n * tedious connection config authentication type.\n * https://tediousjs.github.io/tedious/api-connection.html\n * @internal\n */\nenum TediousAuthenticationType {\n default = \"default\",\n MSI = \"azure-active-directory-access-token\",\n}\n\n/**\n * Configuration for SQL resource.\n * @internal\n */\ninterface SqlConfiguration {\n /**\n * SQL server endpoint.\n *\n * @readonly\n */\n readonly sqlServerEndpoint: string;\n\n /**\n * SQL server username.\n *\n * @readonly\n */\n readonly sqlUsername: string;\n\n /**\n * SQL server password.\n *\n * @readonly\n */\n readonly sqlPassword: string;\n\n /**\n * SQL server database name.\n *\n * @readonly\n */\n readonly sqlDatabaseName: string;\n\n /**\n * Managed identity id.\n *\n * @readonly\n */\n readonly sqlIdentityId: string;\n}\n"],"names":["ErrorCode","LogLevel","jwt_decode","ResourceType","isNode","ClientSecretCredential","AuthenticationError","ConfidentialClientApplication","Dialog","ActivityTypes","Channels","TeamsInfo","CardFactory","ActionTypes","MessageFactory","uuidv4","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AAM,CAAC,CAAC;gBAC7B,MAAM,IAAI,aAAa,CAAC,MAAM,EAAEpB,iBAAS,CAAC,aAAa,CAAC,CAAC;aAC1D;YACD,IAAI,KAAK,EAAE;gBACT,MAAM,MAAM,GAAG;oBACb,MAAM,EAAE,SAAS,CAAC,iBAAiB;oBACnC,cAAc,EAAE;wBACd,IAAI,EAAE,yBAAyB,CAAC,GAAG;wBACnC,OAAO,EAAE;4BACP,KAAK,EAAE,KAAK,CAAC,KAAK;yBACnB;qBACF;oBACD,OAAO,EAAE;wBACP,QAAQ,EAAE,SAAS,CAAC,eAAe;wBACnC,OAAO,EAAE,IAAI;qBACd;iBACF,CAAC;gBACF,cAAc,CAAC,OAAO,CACpB,4DAA4D,SAAS,CAAC,iBAAiB,sBAAsB,SAAS,CAAC,eAAe,EAAE,CACzI,CAAC;gBACF,OAAO,MAAM,CAAC;aACf;YACD,cAAc,CAAC,KAAK,CAClB,oDAAoD,SAAS,CAAC,iBAAiB,0BAA0B,CAC1G,CAAC;YACF,MAAM,IAAI,aAAa,CAAC,wBAAwB,EAAEA,iBAAS,CAAC,aAAa,CAAC,CAAC;SAC5E;KAAA;CACF;AAED;;;;;AAKA,IAAK,yBAGJ;AAHD,WAAK,yBAAyB;IAC5B,gDAAmB,CAAA;IACnB,wEAA2C,CAAA;AAC7C,CAAC,EAHI,yBAAyB,KAAzB,yBAAyB;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/core/errors.ts","../src/util/logger.ts","../src/util/utils.ts","../src/models/configuration.ts","../src/core/configurationProvider.ts","../src/credential/m365TenantCredential.ts","../src/credential/onBehalfOfUserCredential.ts","../src/credential/teamsUserCredential.ts","../src/core/msGraphAuthProvider.ts","../src/bot/teamsBotSsoPrompt.ts","../src/core/msGraphClientProvider.ts","../src/core/defaultTediousConnectionConfiguration.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n *\n * @beta\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n * @beta\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nclass InternalLogger {\n public level?: LogLevel = undefined;\n\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n const logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n *\n * @beta\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n *\n * @beta\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj = jwt_decode(token) as SSOTokenInfoBase;\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err: any) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration for current environment.\n * @beta\n */\nexport interface Configuration {\n /**\n * Authentication related configuration.\n *\n * @readonly\n */\n readonly authentication?: AuthenticationConfiguration;\n\n /**\n * Configuration for resources.\n *\n * @readonly\n */\n readonly resources?: ResourceConfiguration[];\n}\n\n/**\n * Authentication related configuration.\n * @beta\n */\nexport interface AuthenticationConfiguration {\n /**\n * Hostname of AAD authority. Default value comes from M365_AUTHORITY_HOST environment variable.\n *\n * @readonly\n */\n readonly authorityHost?: string;\n\n /**\n * AAD tenant id, default value comes from M365_TENANT_ID environment variable.\n *\n * @readonly\n */\n readonly tenantId?: string;\n\n /**\n * The client (application) ID of an App Registration in the tenant, default value comes from M365_CLIENT_ID environment variable\n *\n * @readonly\n */\n readonly clientId?: string;\n\n /**\n * Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal. Default value comes from M365_CLIENT_SECRET environment variable\n *\n * @readonly\n */\n readonly clientSecret?: string;\n\n /**\n * Endpoint of auth service provisioned by Teams Framework. Default value comes from SIMPLE_AUTH_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly simpleAuthEndpoint?: string;\n\n /**\n * Login page for Teams to redirect to. Default value comes from INITIATE_LOGIN_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly initiateLoginEndpoint?: string;\n\n /**\n * Application ID URI. Default value comes from M365_APPLICATION_ID_URI environment variable.\n */\n readonly applicationIdUri?: string;\n}\n\n/**\n * Configuration for resources.\n * @beta\n */\nexport interface ResourceConfiguration {\n /**\n * Resource type.\n *\n * @readonly\n */\n readonly type: ResourceType;\n\n /**\n * Resource name.\n *\n * @readonly\n */\n readonly name: string;\n\n /**\n * Config for the resource.\n *\n * @readonly\n */\n readonly properties: { [index: string]: any };\n}\n\n/**\n * Available resource type.\n * @beta\n */\nexport enum ResourceType {\n /**\n * SQL database.\n *\n */\n SQL,\n\n /**\n * Rest API.\n *\n */\n API,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isNode } from \"@azure/core-http\";\nimport {\n AuthenticationConfiguration,\n Configuration,\n ResourceConfiguration,\n ResourceType,\n} from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"./errors\";\n\n/**\n * Global configuration instance\n *\n */\nexport let config: Configuration;\n\n/**\n * Initialize configuration from environment variables or configuration object and set the global instance\n *\n * @param {Configuration} configuration - Optional configuration that overrides the default configuration values. The override depth is 1.\n *\n * @throws {@link ErrorCode|InvalidParameter} when configuration is not passed in browser environment\n *\n * @beta\n */\nexport function loadConfiguration(configuration?: Configuration): void {\n internalLogger.info(\"load configuration\");\n\n // browser environment\n if (!isNode) {\n if (!configuration) {\n const errorMsg = \"You are running the code in browser. Configuration must be passed in.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n config = configuration;\n return;\n }\n\n // node environment\n let newAuthentication: AuthenticationConfiguration;\n let newResources: ResourceConfiguration[] = [];\n const defaultResourceName = \"default\";\n\n if (configuration?.authentication) {\n newAuthentication = configuration.authentication;\n } else {\n newAuthentication = {\n authorityHost: process.env.M365_AUTHORITY_HOST,\n tenantId: process.env.M365_TENANT_ID,\n clientId: process.env.M365_CLIENT_ID,\n clientSecret: process.env.M365_CLIENT_SECRET,\n simpleAuthEndpoint: process.env.SIMPLE_AUTH_ENDPOINT,\n initiateLoginEndpoint: process.env.INITIATE_LOGIN_ENDPOINT,\n applicationIdUri: process.env.M365_APPLICATION_ID_URI,\n };\n }\n\n if (configuration?.resources) {\n newResources = configuration.resources;\n } else {\n newResources = [\n {\n // SQL resource\n type: ResourceType.SQL,\n name: defaultResourceName,\n properties: {\n sqlServerEndpoint: process.env.SQL_ENDPOINT,\n sqlUsername: process.env.SQL_USER_NAME,\n sqlPassword: process.env.SQL_PASSWORD,\n sqlDatabaseName: process.env.SQL_DATABASE_NAME,\n sqlIdentityId: process.env.IDENTITY_ID,\n },\n },\n {\n // API resource\n type: ResourceType.API,\n name: defaultResourceName,\n properties: {\n endpoint: process.env.API_ENDPOINT,\n },\n },\n ];\n }\n\n config = {\n authentication: newAuthentication,\n resources: newResources,\n };\n}\n\n/**\n * Get configuration for a specific resource.\n * @param {ResourceType} resourceType - The type of resource\n * @param {string} resourceName - The name of resource, default value is \"default\".\n *\n * @returns Resource configuration for target resource from global configuration instance.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when resource configuration with the specific type and name is not found\n *\n * @beta\n */\nexport function getResourceConfiguration(\n resourceType: ResourceType,\n resourceName = \"default\"\n): { [index: string]: any } {\n internalLogger.info(\n `Get resource configuration of ${ResourceType[resourceType]} from ${resourceName}`\n );\n const result: ResourceConfiguration | undefined = config.resources?.find(\n (item) => item.type === resourceType && item.name === resourceName\n );\n if (result) {\n return result.properties;\n }\n\n const errorMsg = formatString(\n ErrorMessage.MissingResourceConfiguration,\n ResourceType[resourceType],\n resourceName\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n}\n\n/**\n * Get configuration for authentication.\n *\n * @returns Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when global configuration does not exist\n *\n * @beta\n */\nexport function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined {\n internalLogger.info(\"Get authentication configuration\");\n if (config) {\n return config.authentication;\n }\n const errorMsg =\n \"Please call loadConfiguration() first before calling getAuthenticationConfiguration().\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.ConfigurationNotExists, errorMsg),\n ErrorCode.InvalidConfiguration\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AccessToken,\n TokenCredential,\n GetTokenOptions,\n ClientSecretCredential,\n TokenCredentialOptions,\n AuthenticationError,\n} from \"@azure/identity\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType, formatString } from \"../util/utils\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.\n *\n * @example\n * ```typescript\n * loadConfiguration(); // load configuration from environment variables\n * const credential = new M365TenantCredential();\n * ```\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport class M365TenantCredential implements TokenCredential {\n private readonly clientSecretCredential: ClientSecretCredential;\n\n /**\n * Constructor of M365TenantCredential.\n *\n * @remarks\n * Only works in in server side.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n constructor() {\n internalLogger.info(\"Create M365 tenant credential\");\n\n const config = this.loadAndValidateConfig();\n\n const tokenCredentialOptions: TokenCredentialOptions = {\n authorityHost: config.authorityHost,\n };\n\n this.clientSecretCredential = new ClientSecretCredential(\n config.tenantId!,\n config.clientId!,\n config.clientSecret!,\n tokenCredentialOptions\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([\"User.Read.All\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read.All\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read.All\", \"Calendars.Read\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read.All Calendars.Read\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read.All\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|ServiceError} when get access token with authentication error.\n * @throws {@link ErrorCode|InternalError} when get access token with unknown error.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Access token with expected scopes.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n let accessToken;\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n internalLogger.info(\"Get access token with scopes: \" + scopesStr);\n\n try {\n accessToken = await this.clientSecretCredential.getToken(scopes);\n } catch (err: any) {\n if (err instanceof AuthenticationError) {\n const authError = err as AuthenticationError;\n const errorMsg = `Get M365 tenant credential with authentication error: status code ${authError.statusCode}, error messages: ${authError.message}`;\n internalLogger.error(errorMsg);\n\n throw new ErrorWithCode(errorMsg, ErrorCode.ServiceError);\n } else {\n const errorMsg = \"Get M365 tenant credential failed with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n }\n\n if (!accessToken) {\n const errorMsg = \"Get M365 tenant credential access token failed with empty access token\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n return accessToken;\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.clientId && config.clientSecret && config.tenantId) {\n return config;\n }\n\n const missingValues = [];\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n if (!config.clientSecret) {\n missingValues.push(\"clientSecret\");\n }\n\n if (!config.tenantId) {\n missingValues.push(\"tenantId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { AuthenticationResult, ConfidentialClientApplication } from \"@azure/msal-node\";\nimport { config } from \"../core/configurationProvider\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString, getUserInfoFromSsoToken, parseJwt, validateScopesType } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in server side.\n *\n * @example\n * ```typescript\n * loadConfiguration(); // load configuration from environment variables\n * const credential = new OnBehalfOfUserCredential(ssoToken);\n * ```\n *\n * @remarks\n * Can only be used in server side.\n *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n private msalClient: ConfidentialClientApplication;\n private ssoToken: AccessToken;\n\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Only works in in server side.\n *\n * @param {string} ssoToken - User token provided by Teams SSO feature.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, authority host or tenant id is not found in config.\n * @throws {@link ErrorCode|InternalError} when SSO token is not valid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(ssoToken: string) {\n internalLogger.info(\"Get on behalf of user credential\");\n\n const missingConfigurations: string[] = [];\n if (!config?.authentication?.clientId) {\n missingConfigurations.push(\"clientId\");\n }\n\n if (!config?.authentication?.authorityHost) {\n missingConfigurations.push(\"authorityHost\");\n }\n\n if (!config?.authentication?.clientSecret) {\n missingConfigurations.push(\"clientSecret\");\n }\n\n if (!config?.authentication?.tenantId) {\n missingConfigurations.push(\"tenantId\");\n }\n\n if (missingConfigurations.length != 0) {\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingConfigurations.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n const normalizedAuthorityHost = config.authentication!.authorityHost!.replace(/\\/+$/g, \"\");\n const authority: string =\n normalizedAuthorityHost + \"/\" + config.authentication?.tenantId;\n this.msalClient = new ConfidentialClientApplication({\n auth: {\n clientId: config.authentication!.clientId!,\n authority: authority,\n clientSecret: config.authentication!.clientSecret!,\n },\n });\n\n const decodedSsoToken = parseJwt(ssoToken);\n this.ssoToken = {\n token: ssoToken,\n expiresOnTimestamp: decodedSsoToken.exp,\n };\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to acquire access token on behalf of user with unknown error.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns Access token with expected scopes.\n *\n * @remarks\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n\n let scopesArray: string[] = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n scopesArray = scopesArray.filter((x) => x !== null && x !== \"\");\n\n let result: AccessToken | null;\n if (!scopesArray.length) {\n internalLogger.info(\"Get SSO token.\");\n if (Math.floor(Date.now() / 1000) > this.ssoToken.expiresOnTimestamp) {\n const errorMsg = \"Sso token has already expired.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.TokenExpiredError);\n }\n result = this.ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopesArray.join(\" \"));\n\n let authenticationResult: AuthenticationResult | null;\n try {\n authenticationResult = await this.msalClient.acquireTokenOnBehalfOf({\n oboAssertion: this.ssoToken.token,\n scopes: scopesArray,\n });\n } catch (error) {\n throw this.generateAuthServerError(error);\n }\n\n if (!authenticationResult) {\n const errorMsg = \"Access token is null\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.FailToAcquireTokenOnBehalfOfUser, errorMsg),\n ErrorCode.InternalError\n );\n }\n\n result = {\n token: authenticationResult.accessToken,\n expiresOnTimestamp: authenticationResult.expiresOn!.getTime(),\n };\n }\n\n return result;\n }\n\n /**\n * Get basic user info from SSO token.\n *\n * @example\n * ```typescript\n * const currentUser = getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token is not valid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public getUserInfo(): UserInfo {\n internalLogger.info(\"Get basic user info from SSO token\");\n return getUserInfoFromSsoToken(this.ssoToken.token);\n }\n\n private generateAuthServerError(err: any): Error {\n const errorMessage = err.errorMessage;\n if (err.name === \"InteractionRequiredAuthError\") {\n const fullErrorMsg =\n \"Failed to get access token from AAD server, interaction required: \" + errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else if (errorMessage && errorMessage.indexOf(\"AADSTS500133\") >= 0) {\n const fullErrorMsg =\n \"Failed to get access token from AAD server, sso token expired: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.TokenExpiredError);\n } else {\n const fullErrorMsg = formatString(\n ErrorMessage.FailToAcquireTokenOnBehalfOfUser,\n errorMessage\n );\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Represent Teams current user's identity, and it is used within Teams client applications.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n /**\n * Constructor of TeamsUserCredential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n constructor() {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token\n * @remarks\n * Can only be used within Teams.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.NodejsRuntimeNotSupported, \"TeamsUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { TokenCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credential: TokenCredential;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - Credential used to invoke Microsoft Graph APIs.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n *\n * @beta\n */\n constructor(credential: TokenCredential, scopes?: string | string[]) {\n this.credential = credential;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);\n const accessToken = await this.credential.getToken(this.scopes);\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/identity\";\nimport {\n Activity,\n ActivityTypes,\n CardFactory,\n Channels,\n MessageFactory,\n TurnContext,\n OAuthCard,\n ActionTypes,\n verifyStateOperationName,\n StatusCodes,\n TokenExchangeInvokeRequest,\n tokenExchangeOperationName,\n TokenExchangeResource,\n TeamsInfo,\n TeamsChannelAccount,\n} from \"botbuilder\";\nimport {\n Dialog,\n DialogContext,\n DialogTurnResult,\n PromptOptions,\n PromptRecognizerResult,\n} from \"botbuilder-dialogs\";\nimport { TeamsBotSsoPromptTokenResponse } from \"./teamsBotSsoPromptTokenResponse\";\nimport { config } from \"../core/configurationProvider\";\nimport { OnBehalfOfUserCredential } from \"../credential/onBehalfOfUserCredential\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType, formatString, parseJwt } from \"../util/utils\";\n\nconst invokeResponseType = \"invokeResponse\";\n/**\n * Response body returned for a token exchange invoke activity.\n *\n * @beta\n */\nclass TokenExchangeInvokeResponse {\n /**\n * Response id\n */\n id: string;\n\n /**\n * Detailed error message\n */\n failureDetail: string;\n\n constructor(id: string, failureDetail: string) {\n this.id = id;\n this.failureDetail = failureDetail;\n }\n}\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @beta\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * loadConfiguration();\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n *\n * @beta\n */\nexport class TeamsBotSsoPrompt extends Dialog {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(dialogId: string, private settings: TeamsBotSsoPromptSettings) {\n super(dialogId);\n validateScopesType(settings.scopes);\n internalLogger.info(\"Create a new Teams Bot SSO Prompt\");\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n internalLogger.info(\"Begin Teams Bot SSO Prompt\");\n this.ensureMsTeamsChannel(dc);\n\n // Initialize prompt state\n const default_timeout = 900000;\n let timeout: number = default_timeout;\n if (this.settings.timeout) {\n if (typeof this.settings.timeout != \"number\") {\n const errorMsg = \"type of timeout property in teamsBotSsoPromptSettings should be number.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n if (this.settings.timeout <= 0) {\n const errorMsg =\n \"value of timeout property in teamsBotSsoPromptSettings should be positive.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n timeout = this.settings.timeout;\n }\n\n if (this.settings.endOnInvalidMessage === undefined) {\n this.settings.endOnInvalidMessage = true;\n }\n const state: teamsBotSsoPromptState = dc.activeDialog?.state as teamsBotSsoPromptState;\n state.state = {};\n state.options = {};\n state.expires = new Date().getTime() + timeout;\n\n // Send OAuth card to get SSO token\n await this.sendOAuthCardAsync(dc.context);\n return Dialog.EndOfTurn;\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n internalLogger.info(\"Continue Teams Bot SSO Prompt\");\n this.ensureMsTeamsChannel(dc);\n\n // Check for timeout\n const state: teamsBotSsoPromptState = dc.activeDialog?.state as teamsBotSsoPromptState;\n const isMessage: boolean = dc.context.activity.type === ActivityTypes.Message;\n const isTimeoutActivityType: boolean =\n isMessage ||\n this.isTeamsVerificationInvoke(dc.context) ||\n this.isTokenExchangeRequestInvoke(dc.context);\n\n // If the incoming Activity is a message, or an Activity Type normally handled by TeamsBotSsoPrompt,\n // check to see if this TeamsBotSsoPrompt Expiration has elapsed, and end the dialog if so.\n const hasTimedOut: boolean = isTimeoutActivityType && new Date().getTime() > state.expires;\n if (hasTimedOut) {\n internalLogger.warn(\"End Teams Bot SSO Prompt due to timeout\");\n return await dc.endDialog(undefined);\n } else {\n if (\n this.isTeamsVerificationInvoke(dc.context) ||\n this.isTokenExchangeRequestInvoke(dc.context)\n ) {\n // Recognize token\n const recognized: PromptRecognizerResult<TeamsBotSsoPromptTokenResponse> =\n await this.recognizeToken(dc);\n\n if (recognized.succeeded) {\n return await dc.endDialog(recognized.value);\n }\n } else if (isMessage && this.settings.endOnInvalidMessage) {\n internalLogger.warn(\"End Teams Bot SSO Prompt due to invalid message\");\n return await dc.endDialog(undefined);\n }\n\n return Dialog.EndOfTurn;\n }\n }\n\n /**\n * Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.\n * @param dc dialog context\n * @throws {@link ErrorCode|ChannelNotSupported} if bot channel is not MS Teams\n * @internal\n */\n private ensureMsTeamsChannel(dc: DialogContext) {\n if (dc.context.activity.channelId != Channels.Msteams) {\n const errorMsg = formatString(\n ErrorMessage.OnlyMSTeamsChannelSupported,\n \"Teams Bot SSO Prompt\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.ChannelNotSupported);\n }\n }\n\n /**\n * Send OAuthCard that tells Teams to obtain an authentication token for the bot application.\n * For details see https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots.\n *\n * @internal\n */\n private async sendOAuthCardAsync(context: TurnContext): Promise<void> {\n internalLogger.verbose(\"Send OAuth card to get SSO token\");\n\n const account: TeamsChannelAccount = await TeamsInfo.getMember(\n context,\n context.activity.from.id\n );\n internalLogger.verbose(\n \"Get Teams member account user principal name: \" + account.userPrincipalName\n );\n\n const loginHint: string = account.userPrincipalName ? account.userPrincipalName : \"\";\n const signInResource = this.getSignInResource(loginHint);\n const card = CardFactory.oauthCard(\n \"\",\n \"Teams SSO Sign In\",\n \"Sign In\",\n signInResource.signInLink,\n signInResource.tokenExchangeResource\n );\n (card.content as OAuthCard).buttons[0].type = ActionTypes.Signin;\n const msg: Partial<Activity> = MessageFactory.attachment(card);\n\n // Send prompt\n await context.sendActivity(msg);\n }\n\n /**\n * Get sign in resource.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} if client id, tenant id or initiate login endpoint is not found in config.\n *\n * @internal\n */\n private getSignInResource(loginHint: string) {\n internalLogger.verbose(\"Get sign in authentication configuration\");\n const missingConfigurations: string[] = [];\n\n if (!config?.authentication?.initiateLoginEndpoint) {\n missingConfigurations.push(\"initiateLoginEndpoint\");\n }\n\n if (!config?.authentication?.clientId) {\n missingConfigurations.push(\"clientId\");\n }\n\n if (!config?.authentication?.tenantId) {\n missingConfigurations.push(\"tenantId\");\n }\n\n if (!config?.authentication?.applicationIdUri) {\n missingConfigurations.push(\"applicationIdUri\");\n }\n\n if (missingConfigurations.length != 0) {\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingConfigurations.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n const signInLink = `${config.authentication!.initiateLoginEndpoint}?scope=${encodeURI(\n this.settings.scopes.join(\" \")\n )}&clientId=${config.authentication!.clientId}&tenantId=${\n config.authentication!.tenantId\n }&loginHint=${loginHint}`;\n\n internalLogger.verbose(\"Sign in link: \" + signInLink);\n\n const tokenExchangeResource: TokenExchangeResource = {\n id: uuidv4(),\n uri: config.authentication?.applicationIdUri!.replace(/\\/$/, \"\") + \"/access_as_user\",\n };\n\n internalLogger.verbose(\"Token exchange resource uri: \" + tokenExchangeResource.uri);\n\n return {\n signInLink: signInLink,\n tokenExchangeResource: tokenExchangeResource,\n };\n }\n\n /**\n * @internal\n */\n private async recognizeToken(\n dc: DialogContext\n ): Promise<PromptRecognizerResult<TeamsBotSsoPromptTokenResponse>> {\n const context = dc.context;\n let tokenResponse: TeamsBotSsoPromptTokenResponse | undefined;\n\n if (this.isTokenExchangeRequestInvoke(context)) {\n internalLogger.verbose(\"Receive token exchange request\");\n // Received activity is not a token exchange request\n if (!(context.activity.value && this.isTokenExchangeRequest(context.activity.value))) {\n const warningMsg =\n \"The bot received an InvokeActivity that is missing a TokenExchangeInvokeRequest value. This is required to be sent with the InvokeActivity.\";\n\n internalLogger.warn(warningMsg);\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(StatusCodes.BAD_REQUEST, warningMsg)\n );\n } else {\n const ssoToken = context.activity.value.token;\n const credential: OnBehalfOfUserCredential = new OnBehalfOfUserCredential(ssoToken);\n let exchangedToken: AccessToken | null;\n try {\n exchangedToken = await credential.getToken(this.settings.scopes);\n\n if (exchangedToken) {\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(StatusCodes.OK, \"\", context.activity.value.id)\n );\n\n const ssoTokenExpiration = parseJwt(ssoToken).exp;\n tokenResponse = {\n ssoToken: ssoToken,\n ssoTokenExpiration: new Date(ssoTokenExpiration * 1000).toISOString(),\n connectionName: \"\",\n token: exchangedToken.token,\n expiration: exchangedToken.expiresOnTimestamp.toString(),\n };\n }\n } catch (error) {\n const warningMsg = \"The bot is unable to exchange token. Ask for user consent.\";\n internalLogger.info(warningMsg);\n await context.sendActivity(\n this.getTokenExchangeInvokeResponse(\n StatusCodes.PRECONDITION_FAILED,\n warningMsg,\n context.activity.value.id\n )\n );\n }\n }\n } else if (this.isTeamsVerificationInvoke(context)) {\n internalLogger.verbose(\"Receive Teams state verification request\");\n await this.sendOAuthCardAsync(dc.context);\n await context.sendActivity({ type: invokeResponseType, value: { status: StatusCodes.OK } });\n }\n\n return tokenResponse !== undefined\n ? { succeeded: true, value: tokenResponse }\n : { succeeded: false };\n }\n\n /**\n * @internal\n */\n private getTokenExchangeInvokeResponse(\n status: number,\n failureDetail: string,\n id?: string\n ): Activity {\n const invokeResponse: Partial<Activity> = {\n type: invokeResponseType,\n value: { status, body: new TokenExchangeInvokeResponse(id as string, failureDetail) },\n };\n return invokeResponse as Activity;\n }\n\n /**\n * @internal\n */\n private isTeamsVerificationInvoke(context: TurnContext): boolean {\n const activity: Activity = context.activity;\n\n return activity.type === ActivityTypes.Invoke && activity.name === verifyStateOperationName;\n }\n\n /**\n * @internal\n */\n private isTokenExchangeRequestInvoke(context: TurnContext): boolean {\n const activity: Activity = context.activity;\n\n return activity.type === ActivityTypes.Invoke && activity.name === tokenExchangeOperationName;\n }\n\n /**\n * @internal\n */\n private isTokenExchangeRequest(obj: any): obj is TokenExchangeInvokeRequest {\n return obj.hasOwnProperty(\"token\");\n }\n}\n\n/**\n * @internal\n */\ninterface teamsBotSsoPromptState {\n state: any;\n options: PromptOptions;\n expires: number; // Timestamp of when the prompt will timeout.\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * Get Microsoft graph client.\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: '[\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TokenCredential} credential - token credential instance.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n *\n * @beta\n */\nexport function createMicrosoftGraphClient(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getResourceConfiguration } from \"./configurationProvider\";\nimport { ResourceType } from \"../models/configuration\";\nimport { AccessToken, ManagedIdentityCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { ConnectionConfig } from \"tedious\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * SQL connection configuration instance.\n * @remarks\n * Only works in in server side.\n *\n * @beta\n *\n */\nexport class DefaultTediousConnectionConfiguration {\n /**\n * MSSQL default scope\n * https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi\n */\n private readonly defaultSQLScope: string = \"https://database.windows.net/\";\n\n /**\n * Generate connection configuration consumed by tedious.\n *\n * @returns Connection configuration of tedious for the SQL.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.\n * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async getConfig(): Promise<ConnectionConfig> {\n internalLogger.info(\"Get SQL configuration\");\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n\n if (!configuration) {\n const errMsg = \"SQL resource configuration not exist\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n\n try {\n this.isSQLConfigurationValid(configuration);\n } catch (err) {\n throw err;\n }\n\n if (!this.isMsiAuthentication()) {\n const configWithUPS = this.generateDefaultConfig(configuration);\n internalLogger.verbose(\"SQL configuration with username and password generated\");\n return configWithUPS;\n }\n\n try {\n const configWithToken = await this.generateTokenConfig(configuration);\n internalLogger.verbose(\"SQL configuration with MSI token generated\");\n return configWithToken;\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Check SQL use MSI identity or username and password.\n *\n * @returns false - login with SQL MSI identity, true - login with username and password.\n * @internal\n */\n private isMsiAuthentication(): boolean {\n internalLogger.verbose(\n \"Check connection config using MSI access token or username and password\"\n );\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n if (configuration?.sqlUsername != null && configuration?.sqlPassword != null) {\n internalLogger.verbose(\"Login with username and password\");\n return false;\n }\n internalLogger.verbose(\"Login with MSI identity\");\n return true;\n }\n\n /**\n * check configuration is an available configurations.\n * @param { SqlConfiguration } sqlConfig\n *\n * @returns true - SQL configuration has a valid SQL endpoints, SQL username with password or identity ID.\n * false - configuration is not valid.\n * @internal\n */\n private isSQLConfigurationValid(sqlConfig: SqlConfiguration) {\n internalLogger.verbose(\"Check SQL configuration if valid\");\n if (!sqlConfig.sqlServerEndpoint) {\n internalLogger.error(\"SQL configuration is not valid without SQL server endpoint exist\");\n throw new ErrorWithCode(\n \"SQL configuration error without SQL server endpoint exist\",\n ErrorCode.InvalidConfiguration\n );\n }\n if (!(sqlConfig.sqlUsername && sqlConfig.sqlPassword) && !sqlConfig.sqlIdentityId) {\n const errMsg = `SQL configuration is not valid without ${\n sqlConfig.sqlIdentityId ? \"\" : \"identity id \"\n } ${sqlConfig.sqlUsername ? \"\" : \"SQL username \"} ${\n sqlConfig.sqlPassword ? \"\" : \"SQL password\"\n } exist`;\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n internalLogger.verbose(\"SQL configuration is valid\");\n }\n\n /**\n * Generate tedious connection configuration with default authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with username and password.\n *\n * @returns Tedious connection configuration with username and password.\n * @internal\n */\n private generateDefaultConfig(sqlConfig: SqlConfiguration): ConnectionConfig {\n internalLogger.verbose(\n `SQL server ${sqlConfig.sqlServerEndpoint}, user name ${sqlConfig.sqlUsername}, database name ${sqlConfig.sqlDatabaseName}`\n );\n\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.default,\n options: {\n userName: sqlConfig.sqlUsername,\n password: sqlConfig.sqlPassword,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n return config;\n }\n\n /**\n * Generate tedious connection configuration with azure-active-directory-access-token authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with AAD access token.\n *\n * @returns Tedious connection configuration with access token.\n * @internal\n */\n private async generateTokenConfig(sqlConfig: SqlConfiguration): Promise<ConnectionConfig> {\n internalLogger.verbose(\"Generate tedious config with MSI token\");\n\n let token: AccessToken | null;\n try {\n const credential = new ManagedIdentityCredential(sqlConfig.sqlIdentityId);\n token = await credential.getToken(this.defaultSQLScope);\n } catch (error) {\n const errMsg = \"Get user MSI token failed\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InternalError);\n }\n if (token) {\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.MSI,\n options: {\n token: token.token,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n internalLogger.verbose(\n `Generate token configuration success, server endpoint is ${sqlConfig.sqlServerEndpoint}, database name is ${sqlConfig.sqlDatabaseName}`\n );\n return config;\n }\n internalLogger.error(\n `Generate token configuration, server endpoint is ${sqlConfig.sqlServerEndpoint}, MSI token is not valid`\n );\n throw new ErrorWithCode(\"MSI token is not valid\", ErrorCode.InternalError);\n }\n}\n\n/**\n * tedious connection config authentication type.\n * https://tediousjs.github.io/tedious/api-connection.html\n * @internal\n */\nenum TediousAuthenticationType {\n default = \"default\",\n MSI = \"azure-active-directory-access-token\",\n}\n\n/**\n * Configuration for SQL resource.\n * @internal\n */\ninterface SqlConfiguration {\n /**\n * SQL server endpoint.\n *\n * @readonly\n */\n readonly sqlServerEndpoint: string;\n\n /**\n * SQL server username.\n *\n * @readonly\n */\n readonly sqlUsername: string;\n\n /**\n * SQL server password.\n *\n * @readonly\n */\n readonly sqlPassword: string;\n\n /**\n * SQL server database name.\n *\n * @readonly\n */\n readonly sqlDatabaseName: string;\n\n /**\n * Managed identity id.\n *\n * @readonly\n */\n readonly sqlIdentityId: string;\n}\n"],"names":["ErrorCode","LogLevel","jwt_decode","ResourceType","isNode","ClientSecretCredential","AuthenticationError","ConfidentialClientApplication","Dialog","ActivityTypes","Channels","TeamsInfo","CardFactory","ActionTypes","MessageFactory","uuidv4","StatusCodes","verifyStateOperationName","tokenExchangeOperationName","Client","ManagedIdentityCredential"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;;;;AAIYA;AAAZ,WAAY,SAAS;;;;IAInB,kDAAqC,CAAA;;;;IAKrC,0DAA6C,CAAA;;;;IAK7C,4CAA+B,CAAA;;;;IAK/B,wDAA2C,CAAA;;;;IAK3C,wDAA2C,CAAA;;;;IAK3C,4CAA+B,CAAA;;;;IAK/B,gDAAmC,CAAA;;;;IAKnC,oDAAuC,CAAA;;;;IAKvC,0CAA6B,CAAA;;;;IAK7B,gDAAmC,CAAA;AACrC,CAAC,EAlDWA,iBAAS,KAATA,iBAAS,QAkDpB;AAED;;;MAGa,YAAY;;AACvB;AACgB,iCAAoB,GAAG,uCAAuC,CAAC;A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C,eAAe,EAAE,CACzI,CAAC;gBACF,OAAO,MAAM,CAAC;aACf;YACD,cAAc,CAAC,KAAK,CAClB,oDAAoD,SAAS,CAAC,iBAAiB,0BAA0B,CAC1G,CAAC;YACF,MAAM,IAAI,aAAa,CAAC,wBAAwB,EAAEA,iBAAS,CAAC,aAAa,CAAC,CAAC;SAC5E;KAAA;CACF;AAED;;;;;AAKA,IAAK,yBAGJ;AAHD,WAAK,yBAAyB;IAC5B,gDAAmB,CAAA;IACnB,wEAA2C,CAAA;AAC7C,CAAC,EAHI,yBAAyB,KAAzB,yBAAyB;;;;;;;;;;;;;;;;;;"}
|
package/dist/teamsfx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teamsfx.js","sources":["../src/core/errors.ts","../node_modules/tslib/tslib.es6.js","../node_modules/jwt-decode/lib/atob.js","../src/util/logger.ts","../node_modules/jwt-decode/lib/base64_url_decode.js","../node_modules/jwt-decode/lib/index.js","../src/util/utils.ts","../src/credential/m365TenantCredential.browser.ts","../src/credential/onBehalfOfUserCredential.browser.ts","../src/core/cache.browser.ts","../node_modules/@microsoft/teams-js/dist/MicrosoftTeams.min.js","../node_modules/@azure/core-http/src/util/utils.ts","../node_modules/@azure/logger/src/debug.ts","../node_modules/@azure/logger/src/log.browser.ts","../node_modules/@azure/logger/src/index.ts","../src/models/configuration.ts","../src/core/configurationProvider.ts","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/helpers/normalizeHeaderName.js","../node_modules/axios/lib/core/createError.js","../node_modules/axios/lib/core/enhanceError.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/defaults.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/Cancel.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/axios.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/axios/index.js","../src/models/grantType.ts","../src/credential/teamsUserCredential.browser.ts","../src/core/msGraphAuthProvider.ts","../src/bot/teamsBotSsoPrompt.browser.ts","../node_modules/@microsoft/microsoft-graph-client/node_modules/tslib/tslib.es6.js","../node_modules/@microsoft/microsoft-graph-client/src/RequestMethod.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareControl.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareUtil.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/AuthenticationHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/TelemetryHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/AuthenticationHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/HTTPMessageHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RetryHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/RetryHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RedirectHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/RedirectHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/Constants.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphRequestUtil.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/TelemetryHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/ChaosStrategy.ts","../node_modules/@microsoft/microsoft-graph-client/src/ResponseType.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphResponseHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/CustomAuthenticationProvider.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts","../node_modules/@microsoft/microsoft-graph-client/src/HTTPClient.ts","../node_modules/@microsoft/microsoft-graph-client/src/HTTPClientFactory.ts","../node_modules/@microsoft/microsoft-graph-client/src/Client.ts","../node_modules/@microsoft/microsoft-graph-client/src/ValidatePolyFilling.ts","../src/core/msGraphClientProvider.ts","../node_modules/@azure/identity/src/util/logging.ts","../node_modules/@azure/identity/src/credentials/managedIdentityCredential/index.browser.ts","../src/core/defaultTediousConnectionConfiguration.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n *\n * @beta\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = \"InvalidCharacterError\";\n\nfunction polyfill(input) {\n var str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\n \"'atob' failed: The string to be decoded is not correctly encoded.\"\n );\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\nexport default (typeof window !== \"undefined\" &&\n window.atob &&\n window.atob.bind(window)) ||\npolyfill;","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n * @beta\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nclass InternalLogger {\n public level?: LogLevel = undefined;\n\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n const logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n *\n * @beta\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n *\n * @beta\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","import atob from \"./atob\";\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, function(m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\n\nexport default function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}","\"use strict\";\n\nimport base64_url_decode from \"./base64_url_decode\";\n\nexport function InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\n\nexport default function(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified\");\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split(\".\")[pos]));\n } catch (e) {\n throw new InvalidTokenError(\"Invalid token specified: \" + e.message);\n }\n}","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj = jwt_decode(token) as SSOTokenInfoBase;\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved.\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport class M365TenantCredential implements TokenCredential {\n /**\n * Constructor of M365TenantCredential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n constructor() {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"M365TenantCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"M365TenantCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in Azure Function or Bot scenarios.\n *\n * @remarks\n * Can only be used in server side.\n *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n * @beta\n */\n constructor(ssoToken: string) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration used in initialization.\n * @internal\n */\nclass Cache {\n public static get(key: string): string | null {\n return sessionStorage.getItem(key);\n }\n\n public static set(key: string, value: string): void {\n sessionStorage.setItem(key, value);\n }\n\n public static remove(key: string): void {\n sessionStorage.removeItem(key);\n }\n\n public static clear(): void {\n sessionStorage.clear();\n }\n}\n\nexport { Cache };\n","!function(e,n){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=n():\"function\"==typeof define&&define.amd?define(\"microsoftTeams\",[],n):\"object\"==typeof exports?exports.microsoftTeams=n():e.microsoftTeams=n()}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&\"object\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&n&&\"string\"!=typeof e)for(var i in e)t.d(r,i,function(n){return e[n]}.bind(null,i));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,\"a\",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p=\"\",t(t.s=19)}([function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(4),i=t(6),o=t(3),a=function(){return function(){}}();n.Communication=a;var s=function(){function e(){}return e.parentMessageQueue=[],e.childMessageQueue=[],e.nextMessageId=0,e.callbacks={},e}();function l(e,n,t){var r;n instanceof Function?t=n:n instanceof Array&&(r=n);var o=a.parentWindow,l=b(e,r);if(i.GlobalVars.isFramelessWindow)a.currentWindow&&a.currentWindow.nativeInterface&&a.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(l));else{var u=C(o);o&&u?o.postMessage(l,u):p(o).push(l)}t&&(s.callbacks[l.id]=t)}function u(e){if(e&&e.data&&\"object\"==typeof e.data){var n=e.source||e.originalEvent&&e.originalEvent.source,t=e.origin||e.originalEvent&&e.originalEvent.origin;d(n,t)&&(c(n,t),n===a.parentWindow?f(e):n===a.childWindow&&g(e))}}function d(e,n){return(!a.currentWindow||e!==a.currentWindow)&&(!!(a.currentWindow&&a.currentWindow.location&&n&&n===a.currentWindow.location.origin)||!!(r.validOriginRegExp.test(n.toLowerCase())||i.GlobalVars.additionalValidOriginsRegexp&&i.GlobalVars.additionalValidOriginsRegexp.test(n.toLowerCase())))}function c(e,n){i.GlobalVars.isFramelessWindow||a.parentWindow&&!a.parentWindow.closed&&e!==a.parentWindow?a.childWindow&&!a.childWindow.closed&&e!==a.childWindow||(a.childWindow=e,a.childOrigin=n):(a.parentWindow=e,a.parentOrigin=n),a.parentWindow&&a.parentWindow.closed&&(a.parentWindow=null,a.parentOrigin=null),a.childWindow&&a.childWindow.closed&&(a.childWindow=null,a.childOrigin=null),h(a.parentWindow),h(a.childWindow)}function f(e){if(\"id\"in e.data&&\"number\"==typeof e.data.id){var n=e.data,t=s.callbacks[n.id];t&&(t.apply(null,n.args.concat([n.isPartialResponse])),m(e)||delete s.callbacks[n.id])}else if(\"func\"in e.data&&\"string\"==typeof e.data.func){n=e.data;o.callHandler(n.func,n.args)}}function m(e){return!0===e.data.isPartialResponse}function g(e){if(\"id\"in e.data&&\"func\"in e.data){var n=e.data,t=o.callHandler(n.func,n.args),r=t[0],i=t[1];r&&void 0!==i?v(n.id,Array.isArray(i)?i:[i]):l(n.func,n.args,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(a.childWindow){var r=e.pop();v(n.id,e,r)}})}}function p(e){return e===a.parentWindow?s.parentMessageQueue:e===a.childWindow?s.childMessageQueue:[]}function C(e){return e===a.parentWindow?a.parentOrigin:e===a.childWindow?a.childOrigin:null}function h(e){for(var n=C(e),t=p(e);e&&n&&t.length>0;)e.postMessage(t.shift(),n)}function v(e,n,t){var r=a.childWindow,i=T(e,n,t),o=C(r);r&&o&&r.postMessage(i,o)}function b(e,n){return{id:s.nextMessageId++,func:e,timestamp:Date.now(),args:n||[]}}function T(e,n,t){return{id:e,args:n||[],isPartialResponse:t}}function w(e,n){return{func:e,args:n||[]}}n.initializeCommunication=function(e,n){s.messageListener=function(e){return u(e)},a.currentWindow=a.currentWindow||window,a.parentWindow=a.currentWindow.parent!==a.currentWindow.self?a.currentWindow.parent:a.currentWindow.opener,(a.parentWindow||n)&&a.currentWindow.addEventListener(\"message\",s.messageListener,!1),a.parentWindow||(i.GlobalVars.isFramelessWindow=!0,window.onNativeMessage=f);try{a.parentOrigin=\"*\",l(\"initialize\",[r.version],e)}finally{a.parentOrigin=null}},n.uninitializeCommunication=function(){a.currentWindow.removeEventListener(\"message\",s.messageListener,!1),a.parentWindow=null,a.parentOrigin=null,a.childWindow=null,a.childOrigin=null,s.parentMessageQueue=[],s.childMessageQueue=[],s.nextMessageId=0,s.callbacks={}},n.sendMessageToParent=l,n.waitForMessageQueue=function(e,n){var t=a.currentWindow.setInterval(function(){0===p(e).length&&(clearInterval(t),n())},100)},n.sendMessageEventToChild=function(e,n){var t=a.childWindow,r=w(e,n),i=C(t);t&&i?t.postMessage(r,i):p(t).push(r)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(4),i=t(6),o=t(5);n.ensureInitialized=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i.GlobalVars.initializeCalled)throw new Error(\"The library has not yet been initialized\");if(i.GlobalVars.frameContext&&e&&e.length>0){for(var t=!1,r=0;r<e.length;r++)if(e[r]===i.GlobalVars.frameContext){t=!0;break}if(!t)throw new Error(\"This call is not allowed in the '\"+i.GlobalVars.frameContext+\"' context\")}},n.isAPISupportedByPlatform=function(e){void 0===e&&(e=r.defaultSDKVersionForCompatCheck);var n=o.compareSDKVersions(i.GlobalVars.clientSupportedSDKVersion,e);return!isNaN(n)&&n>=0},n.processAdditionalValidOrigins=function(e){var n=i.GlobalVars.additionalValidOrigins.concat(e.filter(function(e){return\"string\"==typeof e&&r.userOriginUrlValidationRegExp.test(e)})),t={};n=n.filter(function(e){return!t[e]&&(t[e]=!0,!0)}),i.GlobalVars.additionalValidOrigins=n,i.GlobalVars.additionalValidOrigins.length>0?i.GlobalVars.additionalValidOriginsRegexp=o.generateRegExpFromUrls(i.GlobalVars.additionalValidOrigins):i.GlobalVars.additionalValidOriginsRegexp=null}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.desktop=\"desktop\",e.web=\"web\",e.android=\"android\",e.ios=\"ios\",e.rigel=\"rigel\",e.surfaceHub=\"surfaceHub\"}(n.HostClientType||(n.HostClientType={})),function(e){e.settings=\"settings\",e.content=\"content\",e.authentication=\"authentication\",e.remove=\"remove\",e.task=\"task\",e.sidePanel=\"sidePanel\",e.stage=\"stage\",e.meetingStage=\"meetingStage\"}(n.FrameContexts||(n.FrameContexts={})),function(e){e[e.Standard=0]=\"Standard\",e[e.Edu=1]=\"Edu\",e[e.Class=2]=\"Class\",e[e.Plc=3]=\"Plc\",e[e.Staff=4]=\"Staff\"}(n.TeamType||(n.TeamType={})),function(e){e[e.Admin=0]=\"Admin\",e[e.User=1]=\"User\",e[e.Guest=2]=\"Guest\"}(n.UserTeamRole||(n.UserTeamRole={})),function(e){e.Large=\"large\",e.Medium=\"medium\",e.Small=\"small\"}(n.TaskModuleDimension||(n.TaskModuleDimension={})),function(e){e.Regular=\"Regular\",e.Private=\"Private\",e.Shared=\"Shared\"}(n.ChannelType||(n.ChannelType={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(8),i=t(0),o=function(){function e(){}return e.handlers={},e}();function a(e){o.themeChangeHandler&&o.themeChangeHandler(e),i.Communication.childWindow&&i.sendMessageEventToChild(\"themeChange\",[e])}function s(){o.backButtonPressHandler&&o.backButtonPressHandler()||r.navigateBack()}function l(e){o.loadHandler&&o.loadHandler(e),i.Communication.childWindow&&i.sendMessageEventToChild(\"load\",[e])}function u(){var e=function(){i.sendMessageToParent(\"readyToUnload\",[])};o.beforeUnloadHandler&&o.beforeUnloadHandler(e)||e()}n.initializeHandlers=function(){o.handlers.themeChange=a,o.handlers.backButtonPress=s,o.handlers.load=l,o.handlers.beforeUnload=u},n.callHandler=function(e,n){var t=o.handlers[e];return t?[!0,t.apply(this,n)]:[!1,void 0]},n.registerHandler=function(e,n,t,r){void 0===t&&(t=!0),void 0===r&&(r=[]),n?(o.handlers[e]=n,t&&i.sendMessageToParent(\"registerHandler\",[e].concat(r))):delete o.handlers[e]},n.removeHandler=function(e){delete o.handlers[e]},n.registerOnThemeChangeHandler=function(e){o.themeChangeHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"themeChange\"])},n.handleThemeChange=a,n.registerBackButtonHandler=function(e){o.backButtonPressHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"backButton\"])},n.registerOnLoadHandler=function(e){o.loadHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"load\"])},n.registerBeforeUnloadHandler=function(e){o.beforeUnloadHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"beforeUnload\"])}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(5);n.version=\"1.10.0\",n.defaultSDKVersionForCompatCheck=\"1.6.0\",n.getUserJoinedTeamsSupportedAndroidClientVersion=\"2.0.1\",n.locationAPIsRequiredVersion=\"1.9.0\",n.peoplePickerRequiredVersion=\"2.0.0\",n.captureImageMobileSupportVersion=\"1.7.0\",n.mediaAPISupportVersion=\"1.8.0\",n.getMediaCallbackSupportVersion=\"2.0.0\",n.scanBarCodeAPIMobileSupportVersion=\"1.9.0\",n.validOrigins=[\"https://teams.microsoft.com\",\"https://teams.microsoft.us\",\"https://gov.teams.microsoft.us\",\"https://dod.teams.microsoft.us\",\"https://int.teams.microsoft.com\",\"https://teams.live.com\",\"https://devspaces.skype.com\",\"https://ssauth.skype.com\",\"https://local.teams.live.com\",\"https://local.teams.live.com:8080\",\"https://local.teams.office.com\",\"https://local.teams.office.com:8080\",\"https://msft.spoppe.com\",\"https://*.sharepoint.com\",\"https://*.sharepoint-df.com\",\"https://*.sharepointonline.com\",\"https://outlook.office.com\",\"https://outlook-sdf.office.com\",\"https://*.teams.microsoft.com\",\"https://www.office.com\",\"https://word.office.com\",\"https://excel.office.com\",\"https://powerpoint.office.com\",\"https://www.officeppe.com\",\"https://*.www.office.com\"],n.validOriginRegExp=r.generateRegExpFromUrls(n.validOrigins),n.userOriginUrlValidationRegExp=/^https\\:\\/\\//},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(22);function i(e){for(var n=\"^\",t=e.split(\".\"),r=0;r<t.length;r++)n+=(r>0?\"[.]\":\"\")+t[r].replace(\"*\",\"[^/^.]+\");return n+=\"$\"}n.generateRegExpFromUrls=function(e){for(var n=\"\",t=0;t<e.length;t++)n+=(0===t?\"\":\"|\")+i(e[t]);return new RegExp(n)},n.getGenericOnCompleteHandler=function(e){return function(n,t){if(!n)throw new Error(e||t)}},n.compareSDKVersions=function(e,n){if(\"string\"!=typeof e||\"string\"!=typeof n)return NaN;var t=e.split(\".\"),r=n.split(\".\");function i(e){return/^\\d+$/.test(e)}if(!t.every(i)||!r.every(i))return NaN;for(;t.length<r.length;)t.push(\"0\");for(;r.length<t.length;)r.push(\"0\");for(var o=0;o<t.length;++o)if(Number(t[o])!=Number(r[o]))return Number(t[o])>Number(r[o])?1:-1;return 0},n.generateGUID=function(){return r.v4()}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=function(){function e(){}return e.initializeCalled=!1,e.initializeCompleted=!1,e.additionalValidOrigins=[],e.additionalValidOriginsRegexp=null,e.initializeCallbacks=[],e.isFramelessWindow=!1,e.printCapabilityEnabled=!1,e}();n.GlobalVars=r},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.Inline=\"inline\",e.Desktop=\"desktop\",e.Web=\"web\"}(n.FileOpenPreference||(n.FileOpenPreference={})),function(e){e[e.NOT_SUPPORTED_ON_PLATFORM=100]=\"NOT_SUPPORTED_ON_PLATFORM\",e[e.INTERNAL_ERROR=500]=\"INTERNAL_ERROR\",e[e.NOT_SUPPORTED_IN_CURRENT_CONTEXT=501]=\"NOT_SUPPORTED_IN_CURRENT_CONTEXT\",e[e.PERMISSION_DENIED=1e3]=\"PERMISSION_DENIED\",e[e.NETWORK_ERROR=2e3]=\"NETWORK_ERROR\",e[e.NO_HW_SUPPORT=3e3]=\"NO_HW_SUPPORT\",e[e.INVALID_ARGUMENTS=4e3]=\"INVALID_ARGUMENTS\",e[e.UNAUTHORIZED_USER_OPERATION=5e3]=\"UNAUTHORIZED_USER_OPERATION\",e[e.INSUFFICIENT_RESOURCES=6e3]=\"INSUFFICIENT_RESOURCES\",e[e.THROTTLE=7e3]=\"THROTTLE\",e[e.USER_ABORT=8e3]=\"USER_ABORT\",e[e.OPERATION_TIMED_OUT=8001]=\"OPERATION_TIMED_OUT\",e[e.OLD_PLATFORM=9e3]=\"OLD_PLATFORM\",e[e.FILE_NOT_FOUND=404]=\"FILE_NOT_FOUND\",e[e.SIZE_EXCEEDED=1e4]=\"SIZE_EXCEEDED\"}(n.ErrorCode||(n.ErrorCode={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(25);n.appInitialization=r.appInitialization;var i=t(11);n.authentication=i.authentication;var o=t(2);n.FrameContexts=o.FrameContexts,n.HostClientType=o.HostClientType,n.TaskModuleDimension=o.TaskModuleDimension,n.TeamType=o.TeamType,n.UserTeamRole=o.UserTeamRole,n.ChannelType=o.ChannelType;var a=t(7);n.ErrorCode=a.ErrorCode,n.FileOpenPreference=a.FileOpenPreference;var s=t(26);n.enablePrintCapability=s.enablePrintCapability,n.executeDeepLink=s.executeDeepLink,n.getContext=s.getContext,n.getMruTabInstances=s.getMruTabInstances,n.getTabInstances=s.getTabInstances,n.initialize=s.initialize,n.initializeWithFrameContext=s.initializeWithFrameContext,n.print=s.print,n.registerBackButtonHandler=s.registerBackButtonHandler,n.registerBeforeUnloadHandler=s.registerBeforeUnloadHandler,n.registerChangeSettingsHandler=s.registerChangeSettingsHandler,n.registerFullScreenHandler=s.registerFullScreenHandler,n.registerOnLoadHandler=s.registerOnLoadHandler,n.registerOnThemeChangeHandler=s.registerOnThemeChangeHandler,n.registerAppButtonClickHandler=s.registerAppButtonClickHandler,n.registerAppButtonHoverEnterHandler=s.registerAppButtonHoverEnterHandler,n.registerAppButtonHoverLeaveHandler=s.registerAppButtonHoverLeaveHandler,n.setFrameContext=s.setFrameContext,n.shareDeepLink=s.shareDeepLink;var l=t(27);n.returnFocus=l.returnFocus,n.navigateBack=l.navigateBack,n.navigateCrossDomain=l.navigateCrossDomain,n.navigateToTab=l.navigateToTab;var u=t(12);n.settings=u.settings;var d=t(28);n.tasks=d.tasks;var c=t(16);n.ChildAppWindow=c.ChildAppWindow,n.ParentAppWindow=c.ParentAppWindow;var f=t(17);n.media=f.media;var m=t(29);n.location=m.location;var g=t(30);n.meeting=g.meeting;var p=t(31);n.people=p.people},function(e,n){var t=\"undefined\"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||\"undefined\"!=typeof msCrypto&&\"function\"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),i[n]=e>>>((3&n)<<3)&255;return i}}},function(e,n){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,i=t;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join(\"\")}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(6),o=t(2),a=t(0),s=t(3);!function(e){var n,t;function l(){d();try{a.Communication.childWindow&&a.Communication.childWindow.close()}finally{a.Communication.childWindow=null,a.Communication.childOrigin=null}}function u(e){n=e,l();var t=n.width||600,r=n.height||400;t=Math.min(t,a.Communication.currentWindow.outerWidth-400),r=Math.min(r,a.Communication.currentWindow.outerHeight-200);var i=document.createElement(\"a\");i.href=n.url;var o=void 0!==a.Communication.currentWindow.screenLeft?a.Communication.currentWindow.screenLeft:a.Communication.currentWindow.screenX,s=void 0!==a.Communication.currentWindow.screenTop?a.Communication.currentWindow.screenTop:a.Communication.currentWindow.screenY;o+=a.Communication.currentWindow.outerWidth/2-t/2,s+=a.Communication.currentWindow.outerHeight/2-r/2,a.Communication.childWindow=a.Communication.currentWindow.open(i.href,\"_blank\",\"toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=\"+s+\", left=\"+o+\", width=\"+t+\", height=\"+r),a.Communication.childWindow?c():m(\"FailedToOpenWindow\")}function d(){t&&(clearInterval(t),t=0),s.removeHandler(\"initialize\"),s.removeHandler(\"navigateCrossDomain\")}function c(){d(),t=a.Communication.currentWindow.setInterval(function(){if(!a.Communication.childWindow||a.Communication.childWindow.closed)m(\"CancelledByUser\");else{var e=a.Communication.childOrigin;try{a.Communication.childOrigin=\"*\",a.sendMessageEventToChild(\"ping\")}finally{a.Communication.childOrigin=e}}},100),s.registerHandler(\"initialize\",function(){return[o.FrameContexts.authentication,i.GlobalVars.hostClientType]}),s.registerHandler(\"navigateCrossDomain\",function(){return!1})}function f(e){try{n&&n.successCallback&&n.successCallback(e)}finally{n=null,l()}}function m(e){try{n&&n.failureCallback&&n.failureCallback(e)}finally{n=null,l()}}function g(e,n,t){if(e){var r=document.createElement(\"a\");r.href=decodeURIComponent(e),r.host&&r.host!==window.location.host&&\"outlook.office.com\"===r.host&&r.search.indexOf(\"client_type=Win32_Outlook\")>-1&&(n&&\"result\"===n&&(t&&(r.href=p(r.href,\"result\",t)),a.Communication.currentWindow.location.assign(p(r.href,\"authSuccess\",\"\"))),n&&\"reason\"===n&&(t&&(r.href=p(r.href,\"reason\",t)),a.Communication.currentWindow.location.assign(p(r.href,\"authFailure\",\"\"))))}}function p(e,n,t){var r=e.indexOf(\"#\"),i=-1===r?\"#\":e.substr(r);return i=i+\"&\"+n+(\"\"!==t?\"=\"+t:\"\"),(e=-1===r?e:e.substr(0,r))+i}e.initialize=function(){s.registerHandler(\"authentication.authenticate.success\",f,!1),s.registerHandler(\"authentication.authenticate.failure\",m,!1)},e.registerAuthenticationHandlers=function(e){n=e},e.authenticate=function(e){var t=void 0!==e?e:n;if(r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.settings,o.FrameContexts.remove,o.FrameContexts.task,o.FrameContexts.stage,o.FrameContexts.meetingStage),i.GlobalVars.hostClientType===o.HostClientType.desktop||i.GlobalVars.hostClientType===o.HostClientType.android||i.GlobalVars.hostClientType===o.HostClientType.ios||i.GlobalVars.hostClientType===o.HostClientType.rigel){var s=document.createElement(\"a\");s.href=t.url,a.sendMessageToParent(\"authentication.authenticate\",[s.href,t.width,t.height],function(e,n){e?t.successCallback(n):t.failureCallback(n)})}else u(t)},e.getAuthToken=function(e){r.ensureInitialized(),a.sendMessageToParent(\"authentication.getAuthToken\",[e.resources,e.claims,e.silent],function(n,t){n?e.successCallback(t):e.failureCallback(t)})},e.getUser=function(e){r.ensureInitialized(),a.sendMessageToParent(\"authentication.getUser\",function(n,t){n?e.successCallback(t):e.failureCallback(t)})},e.notifySuccess=function(e,n){g(n,\"result\",e),r.ensureInitialized(o.FrameContexts.authentication),a.sendMessageToParent(\"authentication.authenticate.success\",[e]),a.waitForMessageQueue(a.Communication.parentWindow,function(){return setTimeout(function(){return a.Communication.currentWindow.close()},200)})},e.notifyFailure=function(e,n){g(n,\"reason\",e),r.ensureInitialized(o.FrameContexts.authentication),a.sendMessageToParent(\"authentication.authenticate.failure\",[e]),a.waitForMessageQueue(a.Communication.parentWindow,function(){return setTimeout(function(){return a.Communication.currentWindow.close()},200)})}}(n.authentication||(n.authentication={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(3);!function(e){var n,t;function l(e){var t=new u(e);n?n(t):t.notifySuccess()}e.initialize=function(){s.registerHandler(\"settings.save\",l,!1),s.registerHandler(\"settings.remove\",d,!1)},e.setValidityState=function(e){r.ensureInitialized(i.FrameContexts.settings,i.FrameContexts.remove),a.sendMessageToParent(\"settings.setValidityState\",[e])},e.getSettings=function(e){r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.settings,i.FrameContexts.remove,i.FrameContexts.sidePanel),a.sendMessageToParent(\"settings.getSettings\",e)},e.setSettings=function(e,n){r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.settings,i.FrameContexts.sidePanel),a.sendMessageToParent(\"settings.setSettings\",[e],n||o.getGenericOnCompleteHandler())},e.registerOnSaveHandler=function(e){r.ensureInitialized(i.FrameContexts.settings),n=e,e&&a.sendMessageToParent(\"registerHandler\",[\"save\"])},e.registerOnRemoveHandler=function(e){r.ensureInitialized(i.FrameContexts.remove,i.FrameContexts.settings),t=e,e&&a.sendMessageToParent(\"registerHandler\",[\"remove\"])};var u=function(){function e(e){this.notified=!1,this.result=e||{}}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent(\"settings.save.success\"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent(\"settings.save.failure\",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error(\"The SaveEvent may only notify success or failure once.\")},e}();function d(){var e=new c;t?t(e):e.notifySuccess()}var c=function(){function e(){this.notified=!1}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent(\"settings.remove.success\"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent(\"settings.remove.failure\",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error(\"The removeEvent may only notify success or failure once.\")},e}()}(n.settings||(n.settings={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){e.registerGetLogHandler=function(e){r.ensureInitialized(),e?o.registerHandler(\"log.request\",function(){var n=e();i.sendMessageToParent(\"log.receive\",[n])}):o.removeHandler(\"log.request\")}}(n.logs||(n.logs={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(15),l=t(3),u=t(6),d=t(7),c=t(4);n.initializePrivateApis=function(){s.menus.initialize()},n.getUserJoinedTeams=function(e,n){if(r.ensureInitialized(),u.GlobalVars.hostClientType===i.HostClientType.android&&!r.isAPISupportedByPlatform(c.getUserJoinedTeamsSupportedAndroidClientVersion)){var t={errorCode:d.ErrorCode.OLD_PLATFORM};throw new Error(JSON.stringify(t))}a.sendMessageToParent(\"getUserJoinedTeams\",[n],e)},n.enterFullscreen=function(){r.ensureInitialized(i.FrameContexts.content),a.sendMessageToParent(\"enterFullscreen\",[])},n.exitFullscreen=function(){r.ensureInitialized(i.FrameContexts.content),a.sendMessageToParent(\"exitFullscreen\",[])},n.openFilePreview=function(e){r.ensureInitialized(i.FrameContexts.content);var n=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference];a.sendMessageToParent(\"openFilePreview\",n)},n.showNotification=function(e){r.ensureInitialized(i.FrameContexts.content);var n=[e.message,e.notificationType];a.sendMessageToParent(\"showNotification\",n)},n.uploadCustomApp=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"uploadCustomApp\",[e],n||o.getGenericOnCompleteHandler())},n.sendCustomMessage=function(e,n,t){r.ensureInitialized(),a.sendMessageToParent(e,n,t)},n.sendCustomEvent=function(e,n){if(r.ensureInitialized(),!a.Communication.childWindow)throw new Error(\"The child window has not yet been initialized or is not present\");a.sendMessageEventToChild(e,n)},n.registerCustomHandler=function(e,n){var t=this;r.ensureInitialized(),l.registerHandler(e,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.apply(t,e)})},n.getChatMembers=function(e){r.ensureInitialized(),a.sendMessageToParent(\"getChatMembers\",e)},n.getConfigSetting=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"getConfigSetting\",[n],e)},n.registerUserSettingsChangeHandler=function(e,n){r.ensureInitialized(),l.registerHandler(\"userSettingsChange\",n,!0,[e])}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){var n,t,a,s=function(){return function(){this.enabled=!0,this.selected=!1}}();function l(e){a&&a(e)||(r.ensureInitialized(),i.sendMessageToParent(\"viewConfigItemPress\",[e]))}function u(e){n&&n(e)||(r.ensureInitialized(),i.sendMessageToParent(\"handleNavBarMenuItemPress\",[e]))}function d(e){t&&t(e)||(r.ensureInitialized(),i.sendMessageToParent(\"handleActionMenuItemPress\",[e]))}e.MenuItem=s,function(e){e.dropDown=\"dropDown\",e.popOver=\"popOver\"}(e.MenuListType||(e.MenuListType={})),e.initialize=function(){o.registerHandler(\"navBarMenuItemPress\",u,!1),o.registerHandler(\"actionMenuItemPress\",d,!1),o.registerHandler(\"setModuleView\",l,!1)},e.setUpViews=function(e,n){r.ensureInitialized(),a=n,i.sendMessageToParent(\"setUpViews\",[e])},e.setNavBarMenu=function(e,t){r.ensureInitialized(),n=t,i.sendMessageToParent(\"setNavBarMenu\",[e])},e.showActionMenu=function(e,n){r.ensureInitialized(),t=n,i.sendMessageToParent(\"showActionMenu\",[e])}}(n.menus||(n.menus={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(3),l=function(){function e(){}return e.prototype.postMessage=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"messageForChild\",[e],n||o.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,n){\"message\"===e&&s.registerHandler(\"messageForParent\",n)},e}();n.ChildAppWindow=l;var u=function(){function e(){}return Object.defineProperty(e,\"Instance\",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.postMessage=function(e,n){r.ensureInitialized(i.FrameContexts.task),a.sendMessageToParent(\"messageForParent\",[e],n||o.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,n){\"message\"===e&&s.registerHandler(\"messageForChild\",n)},e}();n.ParentAppWindow=u},function(e,n,t){\"use strict\";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])};return function(n,t){function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(n,\"__esModule\",{value:!0});var i=t(6),o=t(7),a=t(1),s=t(2),l=t(5),u=t(18),d=t(0),c=t(3),f=t(4);!function(e){!function(e){e.Base64=\"base64\",e.ID=\"id\"}(e.FileFormat||(e.FileFormat={}));var n=function(){return function(){}}();e.File=n,e.captureImage=function(e){if(!e)throw new Error(\"[captureImage] Callback cannot be null\");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),i.GlobalVars.isFramelessWindow?a.isAPISupportedByPlatform(f.captureImageMobileSupportVersion)?d.sendMessageToParent(\"captureImage\",e):e({errorCode:o.ErrorCode.OLD_PLATFORM},void 0):e({errorCode:o.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},void 0)};var t=function(e){function n(n){void 0===n&&(n=null);var t=e.call(this)||this;return n&&(t.content=n.content,t.format=n.format,t.mimeType=n.mimeType,t.name=n.name,t.preview=n.preview,t.size=n.size),t}return r(n,e),n.prototype.getMedia=function(e){if(!e)throw new Error(\"[get Media] Callback cannot be null\");(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))?u.validateGetMediaInputs(this.mimeType,this.format,this.content)?a.isAPISupportedByPlatform(f.getMediaCallbackSupportVersion)?this.getMediaViaCallback(e):this.getMediaViaHandler(e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},null)},n.prototype.getMediaViaCallback=function(e){var n={mediaMimeType:this.mimeType,assembleAttachment:[]},t=[this.content];d.sendMessageToParent(\"getMedia\",t,function(t){if(e)if(t&&t.error)e(t.error,null);else if(t&&t.mediaChunk)if(t.mediaChunk.chunkSequence<=0){var r=u.createFile(n.assembleAttachment,n.mediaMimeType);e(t.error,r)}else{var i=u.decodeAttachment(t.mediaChunk,n.mediaMimeType);n.assembleAttachment.push(i)}else e({errorCode:o.ErrorCode.INTERNAL_ERROR,message:\"data receieved is null\"},null)})},n.prototype.getMediaViaHandler=function(e){var n=l.generateGUID(),t={mediaMimeType:this.mimeType,assembleAttachment:[]},r=[n,this.content];this.content&&e&&d.sendMessageToParent(\"getMedia\",r),c.registerHandler(\"getMedia\"+n,function(r){if(e){var i=JSON.parse(r);if(i.error)e(i.error,null),c.removeHandler(\"getMedia\"+n);else if(i.mediaChunk)if(i.mediaChunk.chunkSequence<=0){var a=u.createFile(t.assembleAttachment,t.mediaMimeType);e(i.error,a),c.removeHandler(\"getMedia\"+n)}else{var s=u.decodeAttachment(i.mediaChunk,t.mediaMimeType);t.assembleAttachment.push(s)}else e({errorCode:o.ErrorCode.INTERNAL_ERROR,message:\"data receieved is null\"},null),c.removeHandler(\"getMedia\"+n)}})},n}(n);e.Media=t,function(e){e[e.Photo=1]=\"Photo\",e[e.Document=2]=\"Document\",e[e.Whiteboard=3]=\"Whiteboard\",e[e.BusinessCard=4]=\"BusinessCard\"}(e.CameraStartMode||(e.CameraStartMode={})),function(e){e[e.Camera=1]=\"Camera\",e[e.Gallery=2]=\"Gallery\"}(e.Source||(e.Source={})),function(e){e[e.Image=1]=\"Image\",e[e.Audio=4]=\"Audio\"}(e.MediaType||(e.MediaType={})),function(e){e[e.ID=1]=\"ID\",e[e.URL=2]=\"URL\"}(e.ImageUriType||(e.ImageUriType={})),e.selectMedia=function(e,n){if(!n)throw new Error(\"[select Media] Callback cannot be null\");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateSelectMediaInputs(e)){var r=[e];d.sendMessageToParent(\"selectMedia\",r,function(e,r){if(r){for(var i=[],o=0,a=r;o<a.length;o++){var s=a[o];i.push(new t(s))}n(e,i)}else n(e,null)})}else{var i={errorCode:o.ErrorCode.INVALID_ARGUMENTS};n(i,null)}else{var l={errorCode:o.ErrorCode.OLD_PLATFORM};n(l,null)}},e.viewImages=function(e,n){if(!n)throw new Error(\"[view images] Callback cannot be null\");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateViewImagesInput(e)){var t=[e];d.sendMessageToParent(\"viewImages\",t,n)}else n({errorCode:o.ErrorCode.INVALID_ARGUMENTS});else n({errorCode:o.ErrorCode.OLD_PLATFORM})},e.scanBarCode=function(e,n){if(!e)throw new Error(\"[media.scanBarCode] Callback cannot be null\");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),i.GlobalVars.hostClientType!==s.HostClientType.desktop&&i.GlobalVars.hostClientType!==s.HostClientType.web&&i.GlobalVars.hostClientType!==s.HostClientType.rigel?a.isAPISupportedByPlatform(f.scanBarCodeAPIMobileSupportVersion)?u.validateScanBarCodeInput(n)?d.sendMessageToParent(\"media.scanBarCode\",[n],e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},null):e({errorCode:o.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},null)}}(n.media||(n.media={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(17);n.createFile=function(e,n){if(null==e||null==n||e.length<=0)return null;var t,r=1;return e.sort(function(e,n){return e.sequence>n.sequence?1:-1}),e.forEach(function(e){e.sequence==r&&(t=t?new Blob([t,e.file],{type:n}):new Blob([e.file],{type:n}),r++)}),t},n.decodeAttachment=function(e,n){if(null==e||null==n)return null;for(var t=atob(e.chunk),r=new Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var o=new Uint8Array(r),a=new Blob([o],{type:n});return{sequence:e.chunkSequence,file:a}},n.validateSelectMediaInputs=function(e){return!(null==e||e.maxMediaCount>10)},n.validateGetMediaInputs=function(e,n,t){return null!=e&&null!=n&&n==r.media.FileFormat.ID&&null!=t},n.validateViewImagesInput=function(e){return!(null==e||e.length<=0||e.length>10)},n.validateScanBarCodeInput=function(e){return!e||!(null===e.timeOutIntervalInSec||e.timeOutIntervalInSec<=0||e.timeOutIntervalInSec>60)},n.validatePeoplePickerInput=function(e){if(e){if(e.title&&\"string\"!=typeof e.title)return!1;if(e.setSelected&&\"object\"!=typeof e.setSelected)return!1;if(e.openOrgWideSearchInChatOrChannel&&\"boolean\"!=typeof e.openOrgWideSearchInChatOrChannel)return!1;if(e.singleSelect&&\"boolean\"!=typeof e.singleSelect)return!1}return!0}},function(e,n,t){\"use strict\";function r(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}Object.defineProperty(n,\"__esModule\",{value:!0}),r(t(20)),r(t(8))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(21);n.bot=r.bot;var i=t(15);n.menus=i.menus;var o=t(13);n.logs=o.logs;var a=t(32);n.NotificationTypes=a.NotificationTypes,n.ViewerActionTypes=a.ViewerActionTypes,n.UserSettingTypes=a.UserSettingTypes;var s=t(14);n.enterFullscreen=s.enterFullscreen,n.exitFullscreen=s.exitFullscreen,n.getChatMembers=s.getChatMembers,n.getConfigSetting=s.getConfigSetting,n.getUserJoinedTeams=s.getUserJoinedTeams,n.openFilePreview=s.openFilePreview,n.sendCustomMessage=s.sendCustomMessage,n.showNotification=s.showNotification,n.sendCustomEvent=s.sendCustomEvent,n.registerCustomHandler=s.registerCustomHandler,n.uploadCustomApp=s.uploadCustomApp,n.registerUserSettingsChangeHandler=s.registerUserSettingsChangeHandler;var l=t(33);n.conversations=l.conversations;var u=t(34);n.meetingRoom=u.meetingRoom;var d=t(35);n.remoteCamera=d.remoteCamera;var c=t(36);n.files=c.files;var f=t(37);n.appEntity=f.appEntity},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1);!function(e){e.sendQuery=function(e,n,t){i.ensureInitialized(),r.sendMessageToParent(\"bot.executeQuery\",[e],function(e,r){e?n(r):t(r)})},e.getSupportedCommands=function(e,n){i.ensureInitialized(),r.sendMessageToParent(\"bot.getSupportedCommands\",function(t,r){t?e(r):n(r)})},e.authenticate=function(e,n,t){i.ensureInitialized(),r.sendMessageToParent(\"bot.authenticate\",[e],function(e,r){e?n(r):t(r)})},function(e){e.Results=\"Results\",e.Auth=\"Auth\"}(e.ResponseType||(e.ResponseType={}))}(n.bot||(n.bot={}))},function(e,n,t){var r=t(23),i=t(24),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,n,t){var r,i,o=t(9),a=t(10),s=0,l=0;e.exports=function(e,n,t){var u=n&&t||0,d=n||[],c=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:i;if(null==c||null==f){var m=o();null==c&&(c=r=[1|m[0],m[1],m[2],m[3],m[4],m[5]]),null==f&&(f=i=16383&(m[6]<<8|m[7]))}var g=void 0!==e.msecs?e.msecs:(new Date).getTime(),p=void 0!==e.nsecs?e.nsecs:l+1,C=g-s+(p-l)/1e4;if(C<0&&void 0===e.clockseq&&(f=f+1&16383),(C<0||g>s)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");s=g,l=p,i=f;var h=(1e4*(268435455&(g+=122192928e5))+p)%4294967296;d[u++]=h>>>24&255,d[u++]=h>>>16&255,d[u++]=h>>>8&255,d[u++]=255&h;var v=g/4294967296*1e4&268435455;d[u++]=v>>>8&255,d[u++]=255&v,d[u++]=v>>>24&15|16,d[u++]=v>>>16&255,d[u++]=f>>>8|128,d[u++]=255&f;for(var b=0;b<6;++b)d[u+b]=c[b];return n||a(d)}},function(e,n,t){var r=t(9),i=t(10);e.exports=function(e,n,t){var o=n&&t||0;\"string\"==typeof e&&(n=\"binary\"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var s=0;s<16;++s)n[o+s]=a[s];return n||i(a)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(4),o=t(0);!function(e){e.Messages={AppLoaded:\"appInitialization.appLoaded\",Success:\"appInitialization.success\",Failure:\"appInitialization.failure\",ExpectedFailure:\"appInitialization.expectedFailure\"},function(e){e.AuthFailed=\"AuthFailed\",e.Timeout=\"Timeout\",e.Other=\"Other\"}(e.FailedReason||(e.FailedReason={})),function(e){e.PermissionError=\"PermissionError\",e.NotFound=\"NotFound\",e.Throttling=\"Throttling\",e.Offline=\"Offline\",e.Other=\"Other\"}(e.ExpectedFailureReason||(e.ExpectedFailureReason={})),e.notifyAppLoaded=function(){r.ensureInitialized(),o.sendMessageToParent(e.Messages.AppLoaded,[i.version])},e.notifySuccess=function(){r.ensureInitialized(),o.sendMessageToParent(e.Messages.Success,[i.version])},e.notifyFailure=function(n){r.ensureInitialized(),o.sendMessageToParent(e.Messages.Failure,[n.reason,n.message])},e.notifyExpectedFailure=function(n){r.ensureInitialized(),o.sendMessageToParent(e.Messages.ExpectedFailure,[n.reason,n.message])}}(n.appInitialization||(n.appInitialization={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(6),o=t(4),a=t(12),s=t(5),l=t(13),u=t(2),d=t(0),c=t(11),f=t(14),m=t(3);function g(e,n){i.GlobalVars.initializeCalled||(i.GlobalVars.initializeCalled=!0,m.initializeHandlers(),d.initializeCommunication(function(e,n,t){void 0===t&&(t=o.defaultSDKVersionForCompatCheck),i.GlobalVars.frameContext=e,i.GlobalVars.hostClientType=n,i.GlobalVars.clientSupportedSDKVersion=t,i.GlobalVars.initializeCallbacks.forEach(function(e){return e()}),i.GlobalVars.initializeCallbacks=[],i.GlobalVars.initializeCompleted=!0},n),c.authentication.initialize(),a.settings.initialize(),f.initializePrivateApis(),this._uninitialize=function(){i.GlobalVars.frameContext&&(C(null),h(null),v(null),T(null),b(null),l.logs.registerGetLogHandler(null)),i.GlobalVars.frameContext===u.FrameContexts.settings&&a.settings.registerOnSaveHandler(null),i.GlobalVars.frameContext===u.FrameContexts.remove&&a.settings.registerOnRemoveHandler(null),i.GlobalVars.initializeCalled=!1,i.GlobalVars.initializeCompleted=!1,i.GlobalVars.initializeCallbacks=[],i.GlobalVars.additionalValidOrigins=[],i.GlobalVars.frameContext=null,i.GlobalVars.hostClientType=null,i.GlobalVars.isFramelessWindow=!1,d.uninitializeCommunication()}),Array.isArray(n)&&r.processAdditionalValidOrigins(n),e&&(i.GlobalVars.initializeCompleted?e():i.GlobalVars.initializeCallbacks.push(e))}function p(){window.print()}function C(e){r.ensureInitialized(),m.registerOnThemeChangeHandler(e)}function h(e){r.ensureInitialized(),m.registerHandler(\"fullScreenChange\",e)}function v(e){r.ensureInitialized(),m.registerBackButtonHandler(e)}function b(e){r.ensureInitialized(),m.registerOnLoadHandler(e)}function T(e){r.ensureInitialized(),m.registerBeforeUnloadHandler(e)}function w(e){r.ensureInitialized(u.FrameContexts.content),d.sendMessageToParent(\"setFrameContext\",[e])}n.initialize=g,n._initialize=function(e){d.Communication.currentWindow=e},n._uninitialize=function(){},n.enablePrintCapability=function(){i.GlobalVars.printCapabilityEnabled||(i.GlobalVars.printCapabilityEnabled=!0,r.ensureInitialized(),document.addEventListener(\"keydown\",function(e){(e.ctrlKey||e.metaKey)&&80===e.keyCode&&(p(),e.cancelBubble=!0,e.preventDefault(),e.stopImmediatePropagation())}))},n.print=p,n.getContext=function(e){r.ensureInitialized(),d.sendMessageToParent(\"getContext\",function(n){n.frameContext||(n.frameContext=i.GlobalVars.frameContext),e(n)})},n.registerOnThemeChangeHandler=C,n.registerFullScreenHandler=h,n.registerAppButtonClickHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonClick\",e)},n.registerAppButtonHoverEnterHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonHoverEnter\",e)},n.registerAppButtonHoverLeaveHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonHoverLeave\",e)},n.registerBackButtonHandler=v,n.registerOnLoadHandler=b,n.registerBeforeUnloadHandler=T,n.registerChangeSettingsHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"changeSettings\",e)},n.getTabInstances=function(e,n){r.ensureInitialized(),d.sendMessageToParent(\"getTabInstances\",[n],e)},n.getMruTabInstances=function(e,n){r.ensureInitialized(),d.sendMessageToParent(\"getMruTabInstances\",[n],e)},n.shareDeepLink=function(e){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.meetingStage),d.sendMessageToParent(\"shareDeepLink\",[e.subEntityId,e.subEntityLabel,e.subEntityWebUrl])},n.executeDeepLink=function(e,n){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.settings,u.FrameContexts.task,u.FrameContexts.stage,u.FrameContexts.meetingStage),d.sendMessageToParent(\"executeDeepLink\",[e],n||s.getGenericOnCompleteHandler())},n.setFrameContext=w,n.initializeWithFrameContext=function(e,n,t){g(n,t),w(e)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(5),o=t(2),a=t(0);n.returnFocus=function(e){r.ensureInitialized(o.FrameContexts.content),a.sendMessageToParent(\"returnFocus\",[e])},n.navigateToTab=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"navigateToTab\",[e],n||i.getGenericOnCompleteHandler(\"Invalid internalTabInstanceId and/or channelId were/was provided\"))},n.navigateCrossDomain=function(e,n){r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.settings,o.FrameContexts.remove,o.FrameContexts.task,o.FrameContexts.stage,o.FrameContexts.meetingStage),a.sendMessageToParent(\"navigateCrossDomain\",[e],n||i.getGenericOnCompleteHandler(\"Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.\"))},n.navigateBack=function(e){r.ensureInitialized(),a.sendMessageToParent(\"navigateBack\",[],e||i.getGenericOnCompleteHandler(\"Back navigation is not supported in the current client or context.\"))}},function(e,n,t){\"use strict\";var r=this&&this.__rest||function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&(t[r[i]]=e[r[i]])}return t};Object.defineProperty(n,\"__esModule\",{value:!0});var i=t(2),o=t(16),a=t(0),s=t(1);!function(e){e.startTask=function(e,n){return s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.meetingStage),a.sendMessageToParent(\"tasks.startTask\",[e],n),new o.ChildAppWindow},e.updateTask=function(e){s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.task,i.FrameContexts.meetingStage),e.width,e.height;var n=r(e,[\"width\",\"height\"]);if(Object.keys(n).length)throw new Error(\"updateTask requires a taskInfo argument containing only width and height\");a.sendMessageToParent(\"tasks.updateTask\",[e])},e.submitTask=function(e,n){s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.task,i.FrameContexts.meetingStage),a.sendMessageToParent(\"tasks.completeTask\",[e,Array.isArray(n)?n:[n]])}}(n.tasks||(n.tasks={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(7),i=t(1),o=t(2),a=t(0),s=t(4);!function(e){e.getLocation=function(e,n){if(!n)throw new Error(\"[location.getLocation] Callback cannot be null\");i.ensureInitialized(o.FrameContexts.content,o.FrameContexts.task),i.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent(\"location.getLocation\",[e],n):n({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):n({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)},e.showLocation=function(e,n){if(!n)throw new Error(\"[location.showLocation] Callback cannot be null\");i.ensureInitialized(o.FrameContexts.content,o.FrameContexts.task),i.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent(\"location.showLocation\",[e],n):n({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):n({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)}}(n.location||(n.location={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(3),o=t(1),a=t(2);!function(e){!function(e){e.Unknown=\"Unknown\",e.Adhoc=\"Adhoc\",e.Scheduled=\"Scheduled\",e.Recurring=\"Recurring\",e.Broadcast=\"Broadcast\",e.MeetNow=\"MeetNow\"}(e.MeetingType||(e.MeetingType={})),e.getIncomingClientAudioState=function(e){if(!e)throw new Error(\"[get incoming client audio state] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"getIncomingClientAudioState\",e)},e.toggleIncomingClientAudio=function(e){if(!e)throw new Error(\"[toggle incoming client audio] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"toggleIncomingClientAudio\",e)},e.getMeetingDetails=function(e){if(!e)throw new Error(\"[get meeting details] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"meeting.getMeetingDetails\",e)},e.getAuthenticationTokenForAnonymousUser=function(e){if(!e)throw new Error(\"[get Authentication Token For AnonymousUser] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"meeting.getAuthenticationTokenForAnonymousUser\",e)},e.getLiveStreamState=function(e){if(!e)throw new Error(\"[get live stream state] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.getLiveStreamState\",e)},e.requestStartLiveStreaming=function(e,n,t){if(!e)throw new Error(\"[request start live streaming] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.requestStartLiveStreaming\",[n,t],e)},e.requestStopLiveStreaming=function(e){if(!e)throw new Error(\"[request stop live streaming] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.requestStopLiveStreaming\",e)},e.registerLiveStreamChangedHandler=function(e){if(!e)throw new Error(\"[register live stream changed handler] Handler cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),i.registerHandler(\"meeting.liveStreamChanged\",e)}}(n.meeting||(n.meeting={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(7),a=t(18),s=t(0),l=t(4);!function(e){(n.people||(n.people={})).selectPeople=function(e,n){if(!e)throw new Error(\"[people picker] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.task,i.FrameContexts.settings),r.isAPISupportedByPlatform(l.peoplePickerRequiredVersion)?a.validatePeoplePickerInput(n)?s.sendMessageToParent(\"people.selectPeople\",[n],e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},void 0)}}()},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.fileDownloadStart=\"fileDownloadStart\",e.fileDownloadComplete=\"fileDownloadComplete\"}(n.NotificationTypes||(n.NotificationTypes={})),function(e){e.view=\"view\",e.edit=\"edit\",e.editNew=\"editNew\"}(n.ViewerActionTypes||(n.ViewerActionTypes={})),function(e){e.fileOpenPreference=\"fileOpenPreference\",e.theme=\"theme\"}(n.UserSettingTypes||(n.UserSettingTypes={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(0),a=t(3);!function(e){e.openConversation=function(e){r.ensureInitialized(i.FrameContexts.content),o.sendMessageToParent(\"conversations.openConversation\",[{title:e.title,subEntityId:e.subEntityId,conversationId:e.conversationId,channelId:e.channelId,entityId:e.entityId}],function(e,n){if(!e)throw new Error(n)}),e.onStartConversation&&a.registerHandler(\"startConversation\",function(n,t,r,i){return e.onStartConversation({subEntityId:n,conversationId:t,channelId:r,entityId:i})}),e.onCloseConversation&&a.registerHandler(\"closeConversation\",function(n,t,r,i){return e.onCloseConversation({subEntityId:n,conversationId:t,channelId:r,entityId:i})})},e.closeConversation=function(){r.ensureInitialized(i.FrameContexts.content),o.sendMessageToParent(\"conversations.closeConversation\"),a.removeHandler(\"startConversation\"),a.removeHandler(\"closeConversation\")}}(n.conversations||(n.conversations={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){!function(e){e.toggleMute=\"toggleMute\",e.toggleCamera=\"toggleCamera\",e.toggleCaptions=\"toggleCaptions\",e.volume=\"volume\",e.showVideoGallery=\"showVideoGallery\",e.showContent=\"showContent\",e.showVideoGalleryAndContent=\"showVideoGalleryAndContent\",e.showLargeGallery=\"showLargeGallery\",e.showTogether=\"showTogether\",e.leaveMeeting=\"leaveMeeting\"}(e.Capability||(e.Capability={})),e.getPairedMeetingRoomInfo=function(e){r.ensureInitialized(),i.sendMessageToParent(\"meetingRoom.getPairedMeetingRoomInfo\",e)},e.sendCommandToPairedMeetingRoom=function(e,n){if(!e||0==e.length)throw new Error(\"[meetingRoom.sendCommandToPairedMeetingRoom] Command name cannot be null or empty\");if(!n)throw new Error(\"[meetingRoom.sendCommandToPairedMeetingRoom] Callback cannot be null\");r.ensureInitialized(),i.sendMessageToParent(\"meetingRoom.sendCommandToPairedMeetingRoom\",[e],n)},e.registerMeetingRoomCapabilitiesUpdateHandler=function(e){if(!e)throw new Error(\"[meetingRoom.registerMeetingRoomCapabilitiesUpdateHandler] Handler cannot be null\");r.ensureInitialized(),o.registerHandler(\"meetingRoom.meetingRoomCapabilitiesUpdate\",function(n){r.ensureInitialized(),e(n)})},e.registerMeetingRoomStatesUpdateHandler=function(e){if(!e)throw new Error(\"[meetingRoom.registerMeetingRoomStatesUpdateHandler] Handler cannot be null\");r.ensureInitialized(),o.registerHandler(\"meetingRoom.meetingRoomStatesUpdate\",function(n){r.ensureInitialized(),e(n)})}}(n.meetingRoom||(n.meetingRoom={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(0),a=t(3);!function(e){!function(e){e.Reset=\"Reset\",e.ZoomIn=\"ZoomIn\",e.ZoomOut=\"ZoomOut\",e.PanLeft=\"PanLeft\",e.PanRight=\"PanRight\",e.TiltUp=\"TiltUp\",e.TiltDown=\"TiltDown\"}(e.ControlCommand||(e.ControlCommand={})),function(e){e[e.CommandResetError=0]=\"CommandResetError\",e[e.CommandZoomInError=1]=\"CommandZoomInError\",e[e.CommandZoomOutError=2]=\"CommandZoomOutError\",e[e.CommandPanLeftError=3]=\"CommandPanLeftError\",e[e.CommandPanRightError=4]=\"CommandPanRightError\",e[e.CommandTiltUpError=5]=\"CommandTiltUpError\",e[e.CommandTiltDownError=6]=\"CommandTiltDownError\",e[e.SendDataError=7]=\"SendDataError\"}(e.ErrorReason||(e.ErrorReason={})),function(e){e[e.None=0]=\"None\",e[e.ControlDenied=1]=\"ControlDenied\",e[e.ControlNoResponse=2]=\"ControlNoResponse\",e[e.ControlBusy=3]=\"ControlBusy\",e[e.AckTimeout=4]=\"AckTimeout\",e[e.ControlTerminated=5]=\"ControlTerminated\",e[e.ControllerTerminated=6]=\"ControllerTerminated\",e[e.DataChannelError=7]=\"DataChannelError\",e[e.ControllerCancelled=8]=\"ControllerCancelled\",e[e.ControlDisabled=9]=\"ControlDisabled\"}(e.SessionTerminatedReason||(e.SessionTerminatedReason={})),e.getCapableParticipants=function(e){if(!e)throw new Error(\"[remoteCamera.getCapableParticipants] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.getCapableParticipants\",e)},e.requestControl=function(e,n){if(!e)throw new Error(\"[remoteCamera.requestControl] Participant cannot be null\");if(!n)throw new Error(\"[remoteCamera.requestControl] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.requestControl\",[e],n)},e.sendControlCommand=function(e,n){if(!e)throw new Error(\"[remoteCamera.sendControlCommand] ControlCommand cannot be null\");if(!n)throw new Error(\"[remoteCamera.sendControlCommand] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.sendControlCommand\",[e],n)},e.terminateSession=function(e){if(!e)throw new Error(\"[remoteCamera.terminateSession] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.terminateSession\",e)},e.registerOnCapableParticipantsChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnCapableParticipantsChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.capableParticipantsChange\",e)},e.registerOnErrorHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnErrorHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.handlerError\",e)},e.registerOnDeviceStateChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnDeviceStateChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.deviceStateChange\",e)},e.registerOnSessionStatusChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnSessionStatusChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.sessionStatusChange\",e)}}(n.remoteCamera||(n.remoteCamera={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1),o=t(8);!function(e){!function(e){e.Dropbox=\"DROPBOX\",e.Box=\"BOX\",e.Sharefile=\"SHAREFILE\",e.GoogleDrive=\"GOOGLEDRIVE\",e.Egnyte=\"EGNYTE\"}(e.CloudStorageProvider||(e.CloudStorageProvider={})),function(e){e[e.Sharepoint=0]=\"Sharepoint\",e[e.WopiIntegration=1]=\"WopiIntegration\",e[e.Google=2]=\"Google\"}(e.CloudStorageProviderType||(e.CloudStorageProviderType={})),e.getCloudStorageFolders=function(e,n){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[files.getCloudStorageFolders] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.getCloudStorageFolders] Callback cannot be null\");r.sendMessageToParent(\"files.getCloudStorageFolders\",[e],n)},e.addCloudStorageFolder=function(e,n){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[files.addCloudStorageFolder] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.addCloudStorageFolder] Callback cannot be null\");r.sendMessageToParent(\"files.addCloudStorageFolder\",[e],n)},e.deleteCloudStorageFolder=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e)throw new Error(\"[files.deleteCloudStorageFolder] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty\");if(!t)throw new Error(\"[files.deleteCloudStorageFolder] Callback cannot be null\");r.sendMessageToParent(\"files.deleteCloudStorageFolder\",[e,n],t)},e.getCloudStorageFolderContents=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||!n)throw new Error(\"[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty\");if(!t)throw new Error(\"[files.getCloudStorageFolderContents] Callback cannot be null\");if(\"isSubdirectory\"in e&&!e.isSubdirectory)throw new Error(\"[files.getCloudStorageFolderContents] provided folder is not a subDirectory\");r.sendMessageToParent(\"files.getCloudStorageFolderContents\",[e,n],t)},e.openCloudStorageFile=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||!n)throw new Error(\"[files.openCloudStorageFile] file/providerCode cannot be null or empty\");if(e.isSubdirectory)throw new Error(\"[files.openCloudStorageFile] provided file is a subDirectory\");r.sendMessageToParent(\"files.openCloudStorageFile\",[e,n,t])}}(n.files||(n.files={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1),o=t(8);!function(e){(n.appEntity||(n.appEntity={})).selectAppEntity=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[appEntity.selectAppEntity] threadId name cannot be null or empty\");if(!t)throw new Error(\"[appEntity.selectAppEntity] Callback cannot be null\");r.sendMessageToParent(\"appEntity.selectAppEntity\",[e,n],t)}}()}])});","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { v4 as uuidv4 } from \"uuid\";\nimport { HttpOperationResponse } from \"../httpOperationResponse\";\nimport { RestError } from \"../restError\";\nimport { WebResourceLike } from \"../webResource\";\nimport { Constants } from \"./constants\";\nimport { XML_ATTRKEY } from \"./serializer.common\";\n\nconst validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;\n\n/**\n * A constant that indicates whether the environment is node.js or browser based.\n */\nexport const isNode =\n typeof process !== \"undefined\" &&\n !!process.version &&\n !!process.versions &&\n !!process.versions.node;\n\n/**\n * Checks if a parsed URL is HTTPS\n *\n * @param urlToCheck - The url to check\n * @returns True if the URL is HTTPS; false otherwise.\n */\nexport function urlIsHTTPS(urlToCheck: { protocol: string }): boolean {\n return urlToCheck.protocol.toLowerCase() === Constants.HTTPS;\n}\n\n/**\n * Encodes an URI.\n *\n * @param uri - The URI to be encoded.\n * @returns The encoded URI.\n */\nexport function encodeUri(uri: string): string {\n return encodeURIComponent(uri)\n .replace(/!/g, \"%21\")\n .replace(/\"/g, \"%27\")\n .replace(/\\(/g, \"%28\")\n .replace(/\\)/g, \"%29\")\n .replace(/\\*/g, \"%2A\");\n}\n\n/**\n * Returns a stripped version of the Http Response which only contains body,\n * headers and the status.\n *\n * @param response - The Http Response\n * @returns The stripped version of Http Response.\n */\nexport function stripResponse(response: HttpOperationResponse): any {\n const strippedResponse: any = {};\n strippedResponse.body = response.bodyAsText;\n strippedResponse.headers = response.headers;\n strippedResponse.status = response.status;\n return strippedResponse;\n}\n\n/**\n * Returns a stripped version of the Http Request that does not contain the\n * Authorization header.\n *\n * @param request - The Http Request object\n * @returns The stripped version of Http Request.\n */\nexport function stripRequest(request: WebResourceLike): WebResourceLike {\n const strippedRequest = request.clone();\n if (strippedRequest.headers) {\n strippedRequest.headers.remove(\"authorization\");\n }\n return strippedRequest;\n}\n\n/**\n * Validates the given uuid as a string\n *\n * @param uuid - The uuid as a string that needs to be validated\n * @returns True if the uuid is valid; false otherwise.\n */\nexport function isValidUuid(uuid: string): boolean {\n return validUuidRegex.test(uuid);\n}\n\n/**\n * Generated UUID\n *\n * @returns RFC4122 v4 UUID.\n */\nexport function generateUuid(): string {\n return uuidv4();\n}\n\n/**\n * Executes an array of promises sequentially. Inspiration of this method is here:\n * https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html. An awesome blog on promises!\n *\n * @param promiseFactories - An array of promise factories(A function that return a promise)\n * @param kickstart - Input to the first promise that is used to kickstart the promise chain.\n * If not provided then the promise chain starts with undefined.\n * @returns A chain of resolved or rejected promises\n */\nexport function executePromisesSequentially(\n promiseFactories: Array<any>,\n kickstart: unknown\n): Promise<any> {\n let result = Promise.resolve(kickstart);\n promiseFactories.forEach((promiseFactory) => {\n result = result.then(promiseFactory);\n });\n return result;\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @param t - The number of milliseconds to be delayed.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n * @returns Resolved promise\n */\nexport function delay<T>(t: number, value?: T): Promise<T | void> {\n return new Promise((resolve) => setTimeout(() => resolve(value), t));\n}\n\n/**\n * Service callback that is returned for REST requests initiated by the service client.\n */\nexport interface ServiceCallback<TResult> {\n /**\n * A method that will be invoked as a callback to a service function.\n * @param err - The error occurred if any, while executing the request; otherwise null.\n * @param result - The deserialized response body if an error did not occur.\n * @param request - The raw/actual request sent to the server if an error did not occur.\n * @param response - The raw/actual response from the server if an error did not occur.\n */\n (\n err: Error | RestError | null,\n result?: TResult,\n request?: WebResourceLike,\n response?: HttpOperationResponse\n ): void;\n}\n\n/**\n * Converts a Promise to a callback.\n * @param promise - The Promise to be converted to a callback\n * @returns A function that takes the callback `(cb: Function) => void`\n * @deprecated generated code should instead depend on responseToBody\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function promiseToCallback(promise: Promise<any>): (cb: Function) => void {\n if (typeof promise.then !== \"function\") {\n throw new Error(\"The provided input is not a Promise.\");\n }\n // eslint-disable-next-line @typescript-eslint/ban-types\n return (cb: Function): void => {\n promise\n .then((data: any) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n return cb(undefined, data);\n })\n .catch((err: Error) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err);\n });\n };\n}\n\n/**\n * Converts a Promise to a service callback.\n * @param promise - The Promise of HttpOperationResponse to be converted to a service callback\n * @returns A function that takes the service callback (cb: ServiceCallback<T>): void\n */\nexport function promiseToServiceCallback<T>(\n promise: Promise<HttpOperationResponse>\n): (cb: ServiceCallback<T>) => void {\n if (typeof promise.then !== \"function\") {\n throw new Error(\"The provided input is not a Promise.\");\n }\n return (cb: ServiceCallback<T>): void => {\n promise\n .then((data: HttpOperationResponse) => {\n return process.nextTick(cb, undefined, data.parsedBody as T, data.request, data);\n })\n .catch((err: Error) => {\n process.nextTick(cb, err);\n });\n };\n}\n\nexport function prepareXMLRootList(\n obj: unknown,\n elementName: string,\n xmlNamespaceKey?: string,\n xmlNamespace?: string\n): { [s: string]: any } {\n if (!Array.isArray(obj)) {\n obj = [obj];\n }\n\n if (!xmlNamespaceKey || !xmlNamespace) {\n return { [elementName]: obj };\n }\n\n const result = { [elementName]: obj };\n result[XML_ATTRKEY] = { [xmlNamespaceKey]: xmlNamespace };\n return result;\n}\n\n/**\n * Applies the properties on the prototype of sourceCtors to the prototype of targetCtor\n * @param targetCtor - The target object on which the properties need to be applied.\n * @param sourceCtors - An array of source objects from which the properties need to be taken.\n */\nexport function applyMixins(targetCtorParam: unknown, sourceCtors: any[]): void {\n const castTargetCtorParam = targetCtorParam as {\n prototype: Record<string, unknown>;\n };\n sourceCtors.forEach((sourceCtor) => {\n Object.getOwnPropertyNames(sourceCtor.prototype).forEach((name) => {\n castTargetCtorParam.prototype[name] = sourceCtor.prototype[name];\n });\n });\n}\n\nconst validateISODuration = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n/**\n * Indicates whether the given string is in ISO 8601 format.\n * @param value - The value to be validated for ISO 8601 duration format.\n * @returns `true` if valid, `false` otherwise.\n */\nexport function isDuration(value: string): boolean {\n return validateISODuration.test(value);\n}\n\n/**\n * Replace all of the instances of searchValue in value with the provided replaceValue.\n * @param value - The value to search and replace in.\n * @param searchValue - The value to search for in the value argument.\n * @param replaceValue - The value to replace searchValue with in the value argument.\n * @returns The value where each instance of searchValue was replaced with replacedValue.\n */\nexport function replaceAll(\n value: string | undefined,\n searchValue: string,\n replaceValue: string\n): string | undefined {\n return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || \"\");\n}\n\n/**\n * Determines whether the given entity is a basic/primitive type\n * (string, number, boolean, null, undefined).\n * @param value - Any entity\n * @returns true is it is primitive type, false otherwise.\n */\nexport function isPrimitiveType(value: unknown): boolean {\n return (typeof value !== \"object\" && typeof value !== \"function\") || value === null;\n}\n\nexport function getEnvironmentValue(name: string): string | undefined {\n if (process.env[name]) {\n return process.env[name];\n } else if (process.env[name.toLowerCase()]) {\n return process.env[name.toLowerCase()];\n }\n return undefined;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable no-invalid-this */\n\nimport { log } from \"./log\";\n\n/**\n * A simple mechanism for enabling logging.\n * Intended to mimic the publicly available `debug` package.\n */\nexport interface Debug {\n /**\n * Creates a new logger with the given namespace.\n */\n (namespace: string): Debugger;\n /**\n * The default log method (defaults to console)\n */\n log: (...args: any[]) => void;\n /**\n * Enables a particular set of namespaces.\n * To enable multiple separate them with commas, e.g. \"info,debug\".\n * Supports wildcards, e.g. \"azure:*\"\n * Supports skip syntax, e.g. \"azure:*,-azure:storage:*\" will enable\n * everything under azure except for things under azure:storage.\n */\n enable: (namespaces: string) => void;\n /**\n * Checks if a particular namespace is enabled.\n */\n enabled: (namespace: string) => boolean;\n /**\n * Disables all logging, returns what was previously enabled.\n */\n disable: () => string;\n}\n\n/**\n * A log function that can be dynamically enabled and redirected.\n */\nexport interface Debugger {\n /**\n * Logs the given arguments to the `log` method.\n */\n (...args: any[]): void;\n /**\n * True if this logger is active and logging.\n */\n enabled: boolean;\n /**\n * Used to cleanup/remove this logger.\n */\n destroy: () => boolean;\n /**\n * The current log method. Can be overridden to redirect output.\n */\n log: (...args: any[]) => void;\n /**\n * The namespace of this logger.\n */\n namespace: string;\n /**\n * Extends this logger with a child namespace.\n * Namespaces are separated with a ':' character.\n */\n extend: (namespace: string) => Debugger;\n}\n\nconst debugEnvVariable =\n (typeof process !== \"undefined\" && process.env && process.env.DEBUG) || undefined;\n\nlet enabledString: string | undefined;\nlet enabledNamespaces: RegExp[] = [];\nlet skippedNamespaces: RegExp[] = [];\nconst debuggers: Debugger[] = [];\n\nif (debugEnvVariable) {\n enable(debugEnvVariable);\n}\n\nconst debugObj: Debug = Object.assign(\n (namespace: string): Debugger => {\n return createDebugger(namespace);\n },\n {\n enable,\n enabled,\n disable,\n log\n }\n);\n\nfunction enable(namespaces: string): void {\n enabledString = namespaces;\n enabledNamespaces = [];\n skippedNamespaces = [];\n const wildcard = /\\*/g;\n const namespaceList = namespaces.split(\",\").map((ns) => ns.trim().replace(wildcard, \".*?\"));\n for (const ns of namespaceList) {\n if (ns.startsWith(\"-\")) {\n skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));\n } else {\n enabledNamespaces.push(new RegExp(`^${ns}$`));\n }\n }\n for (const instance of debuggers) {\n instance.enabled = enabled(instance.namespace);\n }\n}\n\nfunction enabled(namespace: string): boolean {\n if (namespace.endsWith(\"*\")) {\n return true;\n }\n\n for (const skipped of skippedNamespaces) {\n if (skipped.test(namespace)) {\n return false;\n }\n }\n for (const enabledNamespace of enabledNamespaces) {\n if (enabledNamespace.test(namespace)) {\n return true;\n }\n }\n return false;\n}\n\nfunction disable(): string {\n const result = enabledString || \"\";\n enable(\"\");\n return result;\n}\n\nfunction createDebugger(namespace: string): Debugger {\n const newDebugger: Debugger = Object.assign(debug, {\n enabled: enabled(namespace),\n destroy,\n log: debugObj.log,\n namespace,\n extend\n });\n\n function debug(...args: any[]): void {\n if (!newDebugger.enabled) {\n return;\n }\n if (args.length > 0) {\n args[0] = `${namespace} ${args[0]}`;\n }\n newDebugger.log(...args);\n }\n\n debuggers.push(newDebugger);\n\n return newDebugger;\n}\n\nfunction destroy(this: Debugger): boolean {\n const index = debuggers.indexOf(this);\n if (index >= 0) {\n debuggers.splice(index, 1);\n return true;\n }\n return false;\n}\n\nfunction extend(this: Debugger, namespace: string): Debugger {\n const newDebugger = createDebugger(`${this.namespace}:${namespace}`);\n newDebugger.log = this.log;\n return newDebugger;\n}\n\nexport default debugObj;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport function log(...args: any[]): void {\n if (args.length > 0) {\n const firstArg = String(args[0]);\n if (firstArg.includes(\":error\")) {\n console.error(...args);\n } else if (firstArg.includes(\":warning\")) {\n console.warn(...args);\n } else if (firstArg.includes(\":info\")) {\n console.info(...args);\n } else if (firstArg.includes(\":verbose\")) {\n console.debug(...args);\n } else {\n console.debug(...args);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport debug, { Debugger } from \"./debug\";\nexport { Debugger } from \"./debug\";\n\nconst registeredLoggers = new Set<AzureDebugger>();\nconst logLevelFromEnv =\n (typeof process !== \"undefined\" && process.env && process.env.AZURE_LOG_LEVEL) || undefined;\n\nlet azureLogLevel: AzureLogLevel | undefined;\n\n/**\n * The AzureLogger provides a mechanism for overriding where logs are output to.\n * By default, logs are sent to stderr.\n * Override the `log` method to redirect logs to another location.\n */\nexport const AzureLogger: AzureClientLogger = debug(\"azure\");\nAzureLogger.log = (...args) => {\n debug.log(...args);\n};\n\n/**\n * The log levels supported by the logger.\n * The log levels in order of most verbose to least verbose are:\n * - verbose\n * - info\n * - warning\n * - error\n */\nexport type AzureLogLevel = \"verbose\" | \"info\" | \"warning\" | \"error\";\nconst AZURE_LOG_LEVELS = [\"verbose\", \"info\", \"warning\", \"error\"];\n\ntype AzureDebugger = Debugger & { level: AzureLogLevel };\n\n/**\n * An AzureClientLogger is a function that can log to an appropriate severity level.\n */\nexport type AzureClientLogger = Debugger;\n\nif (logLevelFromEnv) {\n // avoid calling setLogLevel because we don't want a mis-set environment variable to crash\n if (isAzureLogLevel(logLevelFromEnv)) {\n setLogLevel(logLevelFromEnv);\n } else {\n console.error(\n `AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(\n \", \"\n )}.`\n );\n }\n}\n\n/**\n * Immediately enables logging at the specified log level.\n * @param level - The log level to enable for logging.\n * Options from most verbose to least verbose are:\n * - verbose\n * - info\n * - warning\n * - error\n */\nexport function setLogLevel(level?: AzureLogLevel): void {\n if (level && !isAzureLogLevel(level)) {\n throw new Error(\n `Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(\",\")}`\n );\n }\n azureLogLevel = level;\n\n const enabledNamespaces = [];\n for (const logger of registeredLoggers) {\n if (shouldEnable(logger)) {\n enabledNamespaces.push(logger.namespace);\n }\n }\n\n debug.enable(enabledNamespaces.join(\",\"));\n}\n\n/**\n * Retrieves the currently specified log level.\n */\nexport function getLogLevel(): AzureLogLevel | undefined {\n return azureLogLevel;\n}\n\nconst levelMap = {\n verbose: 400,\n info: 300,\n warning: 200,\n error: 100\n};\n\n/**\n * Defines the methods available on the SDK-facing logger.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport interface AzureLogger {\n /**\n * Used for failures the program is unlikely to recover from,\n * such as Out of Memory.\n */\n error: Debugger;\n /**\n * Used when a function fails to perform its intended task.\n * Usually this means the function will throw an exception.\n * Not used for self-healing events (e.g. automatic retry)\n */\n warning: Debugger;\n /**\n * Used when a function operates normally.\n */\n info: Debugger;\n /**\n * Used for detailed trbouleshooting scenarios. This is\n * intended for use by developers / system administrators\n * for diagnosing specific failures.\n */\n verbose: Debugger;\n}\n\n/**\n * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`.\n * @param namespace - The name of the SDK package.\n * @hidden\n */\nexport function createClientLogger(namespace: string): AzureLogger {\n const clientRootLogger: AzureClientLogger = AzureLogger.extend(namespace);\n patchLogMethod(AzureLogger, clientRootLogger);\n return {\n error: createLogger(clientRootLogger, \"error\"),\n warning: createLogger(clientRootLogger, \"warning\"),\n info: createLogger(clientRootLogger, \"info\"),\n verbose: createLogger(clientRootLogger, \"verbose\")\n };\n}\n\nfunction patchLogMethod(parent: AzureClientLogger, child: AzureClientLogger | AzureDebugger): void {\n child.log = (...args) => {\n parent.log(...args);\n };\n}\n\nfunction createLogger(parent: AzureClientLogger, level: AzureLogLevel): AzureDebugger {\n const logger: AzureDebugger = Object.assign(parent.extend(level), {\n level\n });\n\n patchLogMethod(parent, logger);\n\n if (shouldEnable(logger)) {\n const enabledNamespaces = debug.disable();\n debug.enable(enabledNamespaces + \",\" + logger.namespace);\n }\n\n registeredLoggers.add(logger);\n\n return logger;\n}\n\nfunction shouldEnable(logger: AzureDebugger): boolean {\n if (azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]) {\n return true;\n } else {\n return false;\n }\n}\n\nfunction isAzureLogLevel(logLevel: string): logLevel is AzureLogLevel {\n return AZURE_LOG_LEVELS.includes(logLevel as any);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration for current environment.\n * @beta\n */\nexport interface Configuration {\n /**\n * Authentication related configuration.\n *\n * @readonly\n */\n readonly authentication?: AuthenticationConfiguration;\n\n /**\n * Configuration for resources.\n *\n * @readonly\n */\n readonly resources?: ResourceConfiguration[];\n}\n\n/**\n * Authentication related configuration.\n * @beta\n */\nexport interface AuthenticationConfiguration {\n /**\n * Hostname of AAD authority. Default value comes from M365_AUTHORITY_HOST environment variable.\n *\n * @readonly\n */\n readonly authorityHost?: string;\n\n /**\n * AAD tenant id, default value comes from M365_TENANT_ID environment variable.\n *\n * @readonly\n */\n readonly tenantId?: string;\n\n /**\n * The client (application) ID of an App Registration in the tenant, default value comes from M365_CLIENT_ID environment variable\n *\n * @readonly\n */\n readonly clientId?: string;\n\n /**\n * Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal. Default value comes from M365_CLIENT_SECRET environment variable\n *\n * @readonly\n */\n readonly clientSecret?: string;\n\n /**\n * Endpoint of auth service provisioned by Teams Framework. Default value comes from SIMPLE_AUTH_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly simpleAuthEndpoint?: string;\n\n /**\n * Login page for Teams to redirect to. Default value comes from INITIATE_LOGIN_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly initiateLoginEndpoint?: string;\n\n /**\n * Application ID URI. Default value comes from M365_APPLICATION_ID_URI environment variable.\n */\n readonly applicationIdUri?: string;\n}\n\n/**\n * Configuration for resources.\n * @beta\n */\nexport interface ResourceConfiguration {\n /**\n * Resource type.\n *\n * @readonly\n */\n readonly type: ResourceType;\n\n /**\n * Resource name.\n *\n * @readonly\n */\n readonly name: string;\n\n /**\n * Config for the resource.\n *\n * @readonly\n */\n readonly properties: { [index: string]: any };\n}\n\n/**\n * Available resource type.\n * @beta\n */\nexport enum ResourceType {\n /**\n * SQL database.\n *\n */\n SQL,\n\n /**\n * Rest API.\n *\n */\n API,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isNode } from \"@azure/core-http\";\nimport {\n AuthenticationConfiguration,\n Configuration,\n ResourceConfiguration,\n ResourceType,\n} from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"./errors\";\n\n/**\n * Global configuration instance\n *\n */\nexport let config: Configuration;\n\n/**\n * Initialize configuration from environment variables or configuration object and set the global instance\n *\n * @param {Configuration} configuration - Optional configuration that overrides the default configuration values. The override depth is 1.\n *\n * @throws {@link ErrorCode|InvalidParameter} when configuration is not passed in browser environment\n *\n * @beta\n */\nexport function loadConfiguration(configuration?: Configuration): void {\n internalLogger.info(\"load configuration\");\n\n // browser environment\n if (!isNode) {\n if (!configuration) {\n const errorMsg = \"You are running the code in browser. Configuration must be passed in.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n config = configuration;\n return;\n }\n\n // node environment\n let newAuthentication: AuthenticationConfiguration;\n let newResources: ResourceConfiguration[] = [];\n const defaultResourceName = \"default\";\n\n if (configuration?.authentication) {\n newAuthentication = configuration.authentication;\n } else {\n newAuthentication = {\n authorityHost: process.env.M365_AUTHORITY_HOST,\n tenantId: process.env.M365_TENANT_ID,\n clientId: process.env.M365_CLIENT_ID,\n clientSecret: process.env.M365_CLIENT_SECRET,\n simpleAuthEndpoint: process.env.SIMPLE_AUTH_ENDPOINT,\n initiateLoginEndpoint: process.env.INITIATE_LOGIN_ENDPOINT,\n applicationIdUri: process.env.M365_APPLICATION_ID_URI,\n };\n }\n\n if (configuration?.resources) {\n newResources = configuration.resources;\n } else {\n newResources = [\n {\n // SQL resource\n type: ResourceType.SQL,\n name: defaultResourceName,\n properties: {\n sqlServerEndpoint: process.env.SQL_ENDPOINT,\n sqlUsername: process.env.SQL_USER_NAME,\n sqlPassword: process.env.SQL_PASSWORD,\n sqlDatabaseName: process.env.SQL_DATABASE_NAME,\n sqlIdentityId: process.env.IDENTITY_ID,\n },\n },\n {\n // API resource\n type: ResourceType.API,\n name: defaultResourceName,\n properties: {\n endpoint: process.env.API_ENDPOINT,\n },\n },\n ];\n }\n\n config = {\n authentication: newAuthentication,\n resources: newResources,\n };\n}\n\n/**\n * Get configuration for a specific resource.\n * @param {ResourceType} resourceType - The type of resource\n * @param {string} resourceName - The name of resource, default value is \"default\".\n *\n * @returns Resource configuration for target resource from global configuration instance.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when resource configuration with the specific type and name is not found\n *\n * @beta\n */\nexport function getResourceConfiguration(\n resourceType: ResourceType,\n resourceName = \"default\"\n): { [index: string]: any } {\n internalLogger.info(\n `Get resource configuration of ${ResourceType[resourceType]} from ${resourceName}`\n );\n const result: ResourceConfiguration | undefined = config.resources?.find(\n (item) => item.type === resourceType && item.name === resourceName\n );\n if (result) {\n return result.properties;\n }\n\n const errorMsg = formatString(\n ErrorMessage.MissingResourceConfiguration,\n ResourceType[resourceType],\n resourceName\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n}\n\n/**\n * Get configuration for authentication.\n *\n * @returns Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when global configuration does not exist\n *\n * @beta\n */\nexport function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined {\n internalLogger.info(\"Get authentication configuration\");\n if (config) {\n return config.authentication;\n }\n const errorMsg =\n \"Please call loadConfiguration() first before calling getAuthenticationConfiguration().\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.ConfigurationNotExists, errorMsg),\n ErrorCode.InvalidConfiguration\n );\n}\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","module.exports = require('./lib/axios');","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport enum GrantType {\n authCode = \"authorization_code\",\n ssoToken = \"sso_token\",\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { Cache } from \"../core/cache.browser\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { AuthCodeResult } from \"../models/authCodeResult\";\nimport axios, { AxiosInstance } from \"axios\";\nimport { GrantType } from \"../models/grantType\";\nimport { AccessTokenResult } from \"../models/accessTokenResult\";\nimport { validateScopesType, getUserInfoFromSsoToken, parseJwt } from \"../util/utils\";\nimport { formatString } from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\n\nconst accessTokenCacheKeyPrefix = \"accessToken\";\nconst separator = \"-\";\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst initializeTeamsSdkTimeoutInMillisecond = 5000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\nconst maxRetryCount = 3;\nconst retryTimeSpanInMillisecond = 3000;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n\n /**\n * Constructor of TeamsUserCredential.\n * Developer need to call loadConfiguration(config) before using this class.\n * \n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * runtimeConnectorEndpoint: \"https://xxx.xxx.com\",\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * }\n loadConfiguration(config); // No default config from environment variables, developers must provide the config object.\n const credential = new TeamsUserCredential([\"https://graph.microsoft.com/User.Read\"]);\n * ```\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n * \n * @beta\n */\n constructor() {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig();\n this.ssoToken = null;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from Teams\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const authCodeResult: AuthCodeResult = JSON.parse(result);\n try {\n await this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);\n resolve();\n } catch (err) {\n reject(this.generateAuthServerError(err));\n }\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\n });\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n const cachedKey = await this.getAccessTokenCacheKey(scopeStr);\n const cachedToken = this.getTokenCache(cachedKey);\n\n if (cachedToken) {\n if (!this.isAccessTokenNearExpired(cachedToken)) {\n internalLogger.verbose(\"Get access token from cache\");\n return cachedToken;\n } else {\n internalLogger.verbose(\"Cached access token is expired\");\n }\n } else {\n internalLogger.verbose(\"No cached access token\");\n }\n\n const accessToken = await this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async exchangeAccessTokenFromSimpleAuthServer(\n scopesStr: string,\n authCodeResult: AuthCodeResult\n ): Promise<void> {\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n\n let retryCount = 0;\n while (true) {\n try {\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n code: authCodeResult.code,\n code_verifier: authCodeResult.codeVerifier,\n redirect_uri: authCodeResult.redirectUri,\n grant_type: GrantType.authCode,\n });\n\n const tokenResult: AccessTokenResult = response.data;\n const key = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(key, {\n token: tokenResult.access_token,\n expiresOnTimestamp: tokenResult.expires_on,\n });\n return;\n } catch (err) {\n if (err.response?.data?.type && err.response.data.type === \"AadUiRequiredException\") {\n internalLogger.warn(\"Exchange access token failed, retry...\");\n if (retryCount < maxRetryCount) {\n await this.sleep(retryTimeSpanInMillisecond);\n retryCount++;\n continue;\n }\n }\n throw err;\n }\n }\n }\n\n /**\n * Get access token cache from authentication server\n * @returns Access token\n */\n private async getAndCacheAccessTokenFromSimpleAuthServer(\n scopesStr: string\n ): Promise<AccessToken> {\n try {\n internalLogger.verbose(\n \"Get access token from authentication server with scopes: \" + scopesStr\n );\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n grant_type: GrantType.ssoToken,\n });\n\n const accessTokenResult: AccessTokenResult = response.data;\n const accessToken: AccessToken = {\n token: accessTokenResult.access_token,\n expiresOnTimestamp: accessTokenResult.expires_on,\n };\n const cacheKey = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(cacheKey, accessToken);\n return accessToken;\n } catch (err) {\n throw this.generateAuthServerError(err);\n }\n }\n\n /**\n * Get SSO token using teams SDK\n * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token\n * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n let initialized = false;\n microsoftTeams.initialize(() => {\n initialized = true;\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n\n // If the code not running in Teams, the initialize callback function would never trigger\n setTimeout(() => {\n if (!initialized) {\n const errorMsg =\n \"Initialize teams sdk timeout, maybe the code is not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n }, initializeTeamsSdkTimeoutInMillisecond);\n });\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.simpleAuthEndpoint) {\n missingValues.push(\"simpleAuthEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n /**\n * Get axios instance with sso token bearer header\n * @returns AxiosInstance\n */\n private async getAxiosInstance(): Promise<AxiosInstance> {\n const ssoToken = await this.getSSOToken();\n const axiosInstance: AxiosInstance = axios.create({\n baseURL: this.config.simpleAuthEndpoint,\n });\n\n axiosInstance.interceptors.request.use((config) => {\n config.headers.Authorization = \"Bearer \" + ssoToken.token;\n return config;\n });\n\n return axiosInstance;\n }\n\n /**\n * Set access token to cache\n * @param key\n * @param token\n */\n private setTokenCache(key: string, token: AccessToken): void {\n Cache.set(key, JSON.stringify(token));\n }\n\n /**\n * Get access token from cache.\n * If there is no cache or cannot be parsed, then it will return null\n * @param key\n * @returns Access token or null\n */\n private getTokenCache(key: string): AccessToken | null {\n const value = Cache.get(key);\n if (value === null) {\n return null;\n }\n\n const accessToken: AccessToken | null = this.validateAndParseJson(value);\n return accessToken;\n }\n\n /**\n * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.\n * @param jsonValue\n */\n private validateAndParseJson(jsonValue: string): AccessToken | null {\n try {\n const parsedJson = JSON.parse(jsonValue);\n /**\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\n *\n */\n return parsedJson && typeof parsedJson === \"object\" ? parsedJson : null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Generate cache key\n * @param scopesStr\n * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes\n */\n private async getAccessTokenCacheKey(scopesStr: string): Promise<string> {\n const ssoToken = await this.getSSOToken();\n const ssoTokenObj = parseJwt(ssoToken.token);\n\n const clientId = this.config.clientId;\n const userObjectId = ssoTokenObj.oid;\n const tenantId = ssoTokenObj.tid;\n\n const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]\n .join(separator)\n .replace(/\" \"/g, \"_\");\n return key;\n }\n\n /**\n * Check whether the token is about to expire (within 5 minutes)\n * @returns Boolean value indicate whether the token is about to expire\n */\n private isAccessTokenNearExpired(token: AccessToken): boolean {\n const expireDate = new Date(token.expiresOnTimestamp);\n if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n return false;\n }\n return true;\n }\n\n private generateAuthServerError(err: any): Error {\n let errorMessage = err.message;\n if (err.response?.data?.type) {\n errorMessage = err.response.data.detail;\n if (err.response.data.type === \"AadUiRequiredException\") {\n const fullErrorMsg =\n \"Failed to get access token from authentication server, please login first: \" +\n errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else {\n const fullErrorMsg =\n \"Failed to get access token from authentication server: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n\n const fullErrorMsg = \"Failed to get access token with error: \" + errorMessage;\n return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { TokenCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credential: TokenCredential;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - Credential used to invoke Microsoft Graph APIs.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n *\n * @beta\n */\n constructor(credential: TokenCredential, scopes?: string | string[]) {\n this.credential = credential;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);\n const accessToken = await this.credential.getToken(this.scopes);\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DialogContext, DialogTurnResult } from \"botbuilder-dialogs\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * loadConfiguration();\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n *\n * @beta\n */\nexport class TeamsBotSsoPrompt {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(dialogId: string, private settings: TeamsBotSsoPromptSettings) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @enum\r\n * Enum for RequestMethods\r\n * @property {string} GET - The get request type\r\n * @property {string} PATCH - The patch request type\r\n * @property {string} POST - The post request type\r\n * @property {string} PUT - The put request type\r\n * @property {string} DELETE - The delete request type\r\n */\r\nexport enum RequestMethod {\r\n\tGET = \"GET\",\r\n\tPATCH = \"PATCH\",\r\n\tPOST = \"POST\",\r\n\tPUT = \"PUT\",\r\n\tDELETE = \"DELETE\",\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module MiddlewareControl\r\n */\r\n\r\nimport { MiddlewareOptions } from \"./options/IMiddlewareOptions\";\r\n\r\n/**\r\n * @class\r\n * Class representing MiddlewareControl\r\n */\r\nexport class MiddlewareControl {\r\n\t/**\r\n\t * @private\r\n\t * A member holding map of MiddlewareOptions\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tprivate middlewareOptions: Map<Function, MiddlewareOptions>;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of MiddlewareControl\r\n\t * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions\r\n\t * @returns The instance of MiddlewareControl\r\n\t */\r\n\tpublic constructor(middlewareOptions: MiddlewareOptions[] = []) {\r\n\t\t// tslint:disable-next-line:ban-types\r\n\t\tthis.middlewareOptions = new Map<Function, MiddlewareOptions>();\r\n\t\tfor (const option of middlewareOptions) {\r\n\t\t\tconst fn = option.constructor;\r\n\t\t\tthis.middlewareOptions.set(fn, option);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the middleware option using the class of the option\r\n\t * @param {Function} fn - The class of the strongly typed option class\r\n\t * @returns The middleware option\r\n\t * @example\r\n\t * // if you wanted to return the middleware option associated with this class (MiddlewareControl)\r\n\t * // call this function like this:\r\n\t * getMiddlewareOptions(MiddlewareControl)\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tpublic getMiddlewareOptions(fn: Function): MiddlewareOptions {\r\n\t\treturn this.middlewareOptions.get(fn);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the middleware options using the class of the option\r\n\t * @param {Function} fn - The class of the strongly typed option class\r\n\t * @param {MiddlewareOptions} option - The strongly typed middleware option\r\n\t * @returns nothing\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tpublic setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void {\r\n\t\tthis.middlewareOptions.set(fn, option);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module MiddlewareUtil\r\n */\r\n\r\nimport { FetchOptions } from \"../IFetchOptions\";\r\n\r\n/**\r\n * @constant\r\n * To generate the UUID\r\n * @returns The UUID string\r\n */\r\nexport const generateUUID = (): string => {\r\n\tlet uuid: string = \"\";\r\n\tfor (let j = 0; j < 32; j++) {\r\n\t\tif (j === 8 || j === 12 || j === 16 || j === 20) {\r\n\t\t\tuuid += \"-\";\r\n\t\t}\r\n\t\tuuid += Math.floor(Math.random() * 16).toString(16);\r\n\t}\r\n\treturn uuid;\r\n};\r\n\r\n/**\r\n * @constant\r\n * To get the request header from the request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @returns A header value for the given key from the request\r\n */\r\nexport const getRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string): string | null => {\r\n\tlet value: string = null;\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\tvalue = (request as Request).headers.get(key);\r\n\t} else if (typeof options !== \"undefined\" && options.headers !== undefined) {\r\n\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\tvalue = (options.headers as Headers).get(key);\r\n\t\t} else if (options.headers instanceof Array) {\r\n\t\t\tconst headers = options.headers as string[][];\r\n\t\t\tfor (let i = 0, l = headers.length; i < l; i++) {\r\n\t\t\t\tif (headers[i][0] === key) {\r\n\t\t\t\t\tvalue = headers[i][1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (options.headers[key] !== undefined) {\r\n\t\t\tvalue = options.headers[key];\r\n\t\t}\r\n\t}\r\n\treturn value;\r\n};\r\n\r\n/**\r\n * @constant\r\n * To set the header value to the given request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @param {string } value - The header value string\r\n * @returns Nothing\r\n */\r\nexport const setRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\t(request as Request).headers.set(key, value);\r\n\t} else if (typeof options !== \"undefined\") {\r\n\t\tif (options.headers === undefined) {\r\n\t\t\toptions.headers = new Headers({\r\n\t\t\t\t[key]: value,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\t\t(options.headers as Headers).set(key, value);\r\n\t\t\t} else if (options.headers instanceof Array) {\r\n\t\t\t\tlet i = 0;\r\n\t\t\t\tconst l = options.headers.length;\r\n\t\t\t\tfor (; i < l; i++) {\r\n\t\t\t\t\tconst header = options.headers[i];\r\n\t\t\t\t\tif (header[0] === key) {\r\n\t\t\t\t\t\theader[1] = value;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (i === l) {\r\n\t\t\t\t\t(options.headers as string[][]).push([key, value]);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tObject.assign(options.headers, { [key]: value });\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @constant\r\n * To append the header value to the given request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @param {string } value - The header value string\r\n * @returns Nothing\r\n */\r\nexport const appendRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\t(request as Request).headers.append(key, value);\r\n\t} else if (typeof options !== \"undefined\") {\r\n\t\tif (options.headers === undefined) {\r\n\t\t\toptions.headers = new Headers({\r\n\t\t\t\t[key]: value,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\t\t(options.headers as Headers).append(key, value);\r\n\t\t\t} else if (options.headers instanceof Array) {\r\n\t\t\t\t(options.headers as string[][]).push([key, value]);\r\n\t\t\t} else if (options.headers === undefined) {\r\n\t\t\t\toptions.headers = { [key]: value };\r\n\t\t\t} else if (options.headers[key] === undefined) {\r\n\t\t\t\toptions.headers[key] = value;\r\n\t\t\t} else {\r\n\t\t\t\toptions.headers[key] += `, ${value}`;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @constant\r\n * To clone the request with the new url\r\n * @param {string} url - The new url string\r\n * @param {Request} request - The request object\r\n * @returns A promise that resolves to request object\r\n */\r\nexport const cloneRequestWithNewUrl = async (newUrl: string, request: Request): Promise<Request> => {\r\n\tconst body = request.headers.get(\"Content-Type\") ? await request.blob() : await Promise.resolve(undefined);\r\n\tconst { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request;\r\n\treturn new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal });\r\n};\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module AuthenticationHandlerOptions\r\n */\r\n\r\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\r\nimport { AuthenticationProviderOptions } from \"../../IAuthenticationProviderOptions\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class representing AuthenticationHandlerOptions\r\n */\r\nexport class AuthenticationHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @public\r\n\t * A member holding an instance of an authentication provider\r\n\t */\r\n\tpublic authenticationProvider: AuthenticationProvider;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding an instance of authentication provider options\r\n\t */\r\n\tpublic authenticationProviderOptions: AuthenticationProviderOptions;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of AuthenticationHandlerOptions\r\n\t * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance\r\n\t * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance\r\n\t * @returns An instance of AuthenticationHandlerOptions\r\n\t */\r\n\tpublic constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions) {\r\n\t\tthis.authenticationProvider = authenticationProvider;\r\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module TelemetryHandlerOptions\r\n */\r\n\r\nimport { Context } from \"../../IContext\";\r\nimport { MiddlewareControl } from \"../MiddlewareControl\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @enum\r\n * @property {number} NONE - The hexadecimal flag value for nothing enabled\r\n * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled\r\n * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled\r\n * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled\r\n */\r\nexport enum FeatureUsageFlag {\r\n\tNONE = 0x0,\r\n\tREDIRECT_HANDLER_ENABLED = 0x1,\r\n\tRETRY_HANDLER_ENABLED = 0x2,\r\n\tAUTHENTICATION_HANDLER_ENABLED = 0x4,\r\n}\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class for TelemetryHandlerOptions\r\n */\r\n\r\nexport class TelemetryHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * A member to hold the OR of feature usage flags\r\n\t */\r\n\tprivate featureUsage: FeatureUsageFlag = FeatureUsageFlag.NONE;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To update the feature usage in the context object\r\n\t * @param {Context} context - The request context object containing middleware options\r\n\t * @param {FeatureUsageFlag} flag - The flag value\r\n\t * @returns nothing\r\n\t */\r\n\tpublic static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void {\r\n\t\tlet options: TelemetryHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\r\n\t\t} else {\r\n\t\t\tcontext.middlewareControl = new MiddlewareControl();\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = new TelemetryHandlerOptions();\r\n\t\t\tcontext.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options);\r\n\t\t}\r\n\t\toptions.setFeatureUsage(flag);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To set the feature usage flag\r\n\t * @param {FeatureUsageFlag} flag - The flag value\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setFeatureUsage(flag: FeatureUsageFlag): void {\r\n\t\t/* tslint:disable: no-bitwise */\r\n\t\tthis.featureUsage = this.featureUsage | flag;\r\n\t\t/* tslint:enable: no-bitwise */\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the feature usage\r\n\t * @returns A feature usage flag as hexadecimal string\r\n\t */\r\n\tpublic getFeatureUsage(): string {\r\n\t\treturn this.featureUsage.toString(16);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module AuthenticationHandler\r\n */\r\n\r\nimport { AuthenticationProvider } from \"../IAuthenticationProvider\";\r\nimport { AuthenticationProviderOptions } from \"../IAuthenticationProviderOptions\";\r\nimport { Context } from \"../IContext\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { appendRequestHeader } from \"./MiddlewareUtil\";\r\nimport { AuthenticationHandlerOptions } from \"./options/AuthenticationHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class representing AuthenticationHandler\r\n */\r\nexport class AuthenticationHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * A member representing the authorization header name\r\n\t */\r\n\tprivate static AUTHORIZATION_HEADER: string = \"Authorization\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold an AuthenticationProvider instance\r\n\t */\r\n\tprivate authenticationProvider: AuthenticationProvider;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of AuthenticationHandler\r\n\t * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler\r\n\t */\r\n\tpublic constructor(authenticationProvider: AuthenticationProvider) {\r\n\t\tthis.authenticationProvider = authenticationProvider;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tlet options: AuthenticationHandlerOptions;\r\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions) as AuthenticationHandlerOptions;\r\n\t\t\t}\r\n\t\t\tlet authenticationProvider: AuthenticationProvider;\r\n\t\t\tlet authenticationProviderOptions: AuthenticationProviderOptions;\r\n\t\t\tif (typeof options !== \"undefined\") {\r\n\t\t\t\tauthenticationProvider = options.authenticationProvider;\r\n\t\t\t\tauthenticationProviderOptions = options.authenticationProviderOptions;\r\n\t\t\t}\r\n\t\t\tif (typeof authenticationProvider === \"undefined\") {\r\n\t\t\t\tauthenticationProvider = this.authenticationProvider;\r\n\t\t\t}\r\n\t\t\tconst token: string = await authenticationProvider.getAccessToken(authenticationProviderOptions);\r\n\t\t\tconst bearerKey: string = `Bearer ${token}`;\r\n\t\t\tappendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey);\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED);\r\n\t\t\treturn await this.nextMiddleware.execute(context);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPMessageHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for HTTPMessageHandler\r\n */\r\nexport class HTTPMessageHandler implements Middleware {\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The request context object\r\n\t * @returns A promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tcontext.response = await fetch(context.request, context.options);\r\n\t\t\treturn;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RetryHandlerOptions\r\n */\r\n\r\nimport { FetchOptions } from \"../../IFetchOptions\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @type\r\n * A type declaration for shouldRetry callback\r\n */\r\nexport type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean;\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class for RetryHandlerOptions\r\n */\r\n\r\nexport class RetryHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default delay value in seconds\r\n\t */\r\n\tprivate static DEFAULT_DELAY: number = 3;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default maxRetries value\r\n\t */\r\n\tprivate static DEFAULT_MAX_RETRIES: number = 3;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum delay value in seconds\r\n\t */\r\n\tprivate static MAX_DELAY: number = 180;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum maxRetries value\r\n\t */\r\n\tprivate static MAX_MAX_RETRIES: number = 10;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding delay value in seconds\r\n\t */\r\n\tpublic delay: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding maxRetries value\r\n\t */\r\n\tpublic maxRetries: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding shouldRetry callback\r\n\t */\r\n\tpublic shouldRetry: ShouldRetry;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding default shouldRetry callback\r\n\t */\r\n\tprivate static DEFAULT_SHOULD_RETRY: ShouldRetry = () => true;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RetryHandlerOptions\r\n\t * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds\r\n\t * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value\r\n\t * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function\r\n\t * @returns An instance of RetryHandlerOptions\r\n\t */\r\n\tpublic constructor(delay: number = RetryHandlerOptions.DEFAULT_DELAY, maxRetries: number = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry: ShouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY) {\r\n\t\tif (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\r\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay > RetryHandlerOptions.MAX_DELAY) {\r\n\t\t\tconst error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\r\n\t\t\tconst error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay < 0 && maxRetries < 0) {\r\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay < 0) {\r\n\t\t\tconst error = new Error(`Delay should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t} else if (maxRetries < 0) {\r\n\t\t\tconst error = new Error(`MaxRetries should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY);\r\n\t\tthis.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES);\r\n\t\tthis.shouldRetry = shouldRetry;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the maximum delay\r\n\t * @returns A maximum delay\r\n\t */\r\n\tpublic getMaxDelay(): number {\r\n\t\treturn RetryHandlerOptions.MAX_DELAY;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RetryHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\nimport { FetchOptions } from \"../IFetchOptions\";\r\nimport { RequestMethod } from \"../RequestMethod\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { RetryHandlerOptions } from \"./options/RetryHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for RetryHandler\r\n */\r\nexport class RetryHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A list of status codes that needs to be retried\r\n\t */\r\n\tprivate static RETRY_STATUS_CODES: number[] = [\r\n\t\t429, // Too many requests\r\n\t\t503, // Service unavailable\r\n\t\t504, // Gateway timeout\r\n\t];\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of retry attempt header\r\n\t */\r\n\tprivate static RETRY_ATTEMPT_HEADER: string = \"Retry-Attempt\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of retry after header\r\n\t */\r\n\tprivate static RETRY_AFTER_HEADER: string = \"Retry-After\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding the retry handler options\r\n\t */\r\n\tprivate options: RetryHandlerOptions;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RetryHandler\r\n\t * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value\r\n\t * @returns An instance of RetryHandler\r\n\t */\r\n\tpublic constructor(options: RetryHandlerOptions = new RetryHandlerOptions()) {\r\n\t\tthis.options = options;\r\n\t}\r\n\r\n\t/**\r\n\t *\r\n\t * @private\r\n\t * To check whether the response has the retry status code\r\n\t * @param {Response} response - The response object\r\n\t * @returns Whether the response has retry status code or not\r\n\t */\r\n\tprivate isRetry(response: Response): boolean {\r\n\t\treturn RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the payload is buffered or not\r\n\t * @param {RequestInfo} request - The url string or the request object value\r\n\t * @param {FetchOptions} options - The options of a request\r\n\t * @returns Whether the payload is buffered or not\r\n\t */\r\n\tprivate isBuffered(request: RequestInfo, options: FetchOptions | undefined): boolean {\r\n\t\tconst method = typeof request === \"string\" ? options.method : (request as Request).method;\r\n\t\tconst isPutPatchOrPost: boolean = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST;\r\n\t\tif (isPutPatchOrPost) {\r\n\t\t\tconst isStream = getRequestHeader(request, options, \"Content-Type\") === \"application/octet-stream\";\r\n\t\t\tif (isStream) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the delay for a retry\r\n\t * @param {Response} response - The response object\r\n\t * @param {number} retryAttempts - The current attempt count\r\n\t * @param {number} delay - The delay value in seconds\r\n\t * @returns A delay for a retry\r\n\t */\r\n\tprivate getDelay(response: Response, retryAttempts: number, delay: number): number {\r\n\t\tconst getRandomness = () => Number(Math.random().toFixed(3));\r\n\t\tconst retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null;\r\n\t\tlet newDelay: number;\r\n\t\tif (retryAfter !== null) {\r\n\t\t\t// tslint:disable: prefer-conditional-expression\r\n\t\t\tif (Number.isNaN(Number(retryAfter))) {\r\n\t\t\t\tnewDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000);\r\n\t\t\t} else {\r\n\t\t\t\tnewDelay = Number(retryAfter);\r\n\t\t\t}\r\n\t\t\t// tslint:enable: prefer-conditional-expression\r\n\t\t} else {\r\n\t\t\t// Adding randomness to avoid retrying at a same\r\n\t\t\tnewDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness();\r\n\t\t}\r\n\t\treturn Math.min(newDelay, this.options.getMaxDelay() + getRandomness());\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get an exponential back off value\r\n\t * @param {number} attempts - The current attempt count\r\n\t * @returns An exponential back off value\r\n\t */\r\n\tprivate getExponentialBackOffTime(attempts: number): number {\r\n\t\treturn Math.round((1 / 2) * (2 ** attempts - 1));\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To add delay for the execution\r\n\t * @param {number} delaySeconds - The delay value in seconds\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate async sleep(delaySeconds: number): Promise<void> {\r\n\t\tconst delayMilliseconds = delaySeconds * 1000;\r\n\t\treturn new Promise((resolve) => setTimeout(resolve, delayMilliseconds));\r\n\t}\r\n\r\n\tprivate getOptions(context: Context): RetryHandlerOptions {\r\n\t\tlet options: RetryHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(this.options.constructor) as RetryHandlerOptions;\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = Object.assign(new RetryHandlerOptions(), this.options);\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To execute the middleware with retries\r\n\t * @param {Context} context - The context object\r\n\t * @param {number} retryAttempts - The current attempt count\r\n\t * @param {RetryHandlerOptions} options - The retry middleware options instance\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tprivate async executeWithRetry(context: Context, retryAttempts: number, options: RetryHandlerOptions): Promise<void> {\r\n\t\ttry {\r\n\t\t\tawait this.nextMiddleware.execute(context);\r\n\t\t\tif (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) {\r\n\t\t\t\t++retryAttempts;\r\n\t\t\t\tsetRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());\r\n\t\t\t\tconst delay = this.getDelay(context.response, retryAttempts, options.delay);\r\n\t\t\t\tawait this.sleep(delay);\r\n\t\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst retryAttempts: number = 0;\r\n\t\t\tconst options: RetryHandlerOptions = this.getOptions(context);\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED);\r\n\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RedirectHandlerOptions\r\n */\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @type\r\n * A type declaration for shouldRetry callback\r\n */\r\nexport type ShouldRedirect = (response: Response) => boolean;\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * A class representing RedirectHandlerOptions\r\n */\r\nexport class RedirectHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default max redirects value\r\n\t */\r\n\tprivate static DEFAULT_MAX_REDIRECTS: number = 5;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum max redirects value\r\n\t */\r\n\tprivate static MAX_MAX_REDIRECTS: number = 20;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding max redirects value\r\n\t */\r\n\tpublic maxRedirects: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding shouldRedirect callback\r\n\t */\r\n\tpublic shouldRedirect: ShouldRedirect;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding default shouldRedirect callback\r\n\t */\r\n\tprivate static DEFAULT_SHOULD_RETRY: ShouldRedirect = () => true;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RedirectHandlerOptions\r\n\t * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value\r\n\t * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback\r\n\t * @returns An instance of RedirectHandlerOptions\r\n\t */\r\n\tpublic constructor(maxRedirects: number = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect: ShouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY) {\r\n\t\tif (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) {\r\n\t\t\tconst error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tif (maxRedirects < 0) {\r\n\t\t\tconst error = new Error(`MaxRedirects should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.maxRedirects = maxRedirects;\r\n\t\tthis.shouldRedirect = shouldRedirect;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RedirectHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\nimport { RequestMethod } from \"../RequestMethod\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { cloneRequestWithNewUrl, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { RedirectHandlerOptions } from \"./options/RedirectHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * Class\r\n * @implements Middleware\r\n * Class representing RedirectHandler\r\n */\r\nexport class RedirectHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the array of redirect status codes\r\n\t */\r\n\tprivate static REDIRECT_STATUS_CODES: number[] = [\r\n\t\t301, // Moved Permanently\r\n\t\t302, // Found\r\n\t\t303, // See Other\r\n\t\t307, // Temporary Permanently\r\n\t\t308, // Moved Permanently\r\n\t];\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding SeeOther status code\r\n\t */\r\n\tprivate static STATUS_CODE_SEE_OTHER: number = 303;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the location header\r\n\t */\r\n\tprivate static LOCATION_HEADER: string = \"Location\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member representing the authorization header name\r\n\t */\r\n\tprivate static AUTHORIZATION_HEADER: string = \"Authorization\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the manual redirect value\r\n\t */\r\n\tprivate static MANUAL_REDIRECT: RequestRedirect = \"manual\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding options to customize the handler behavior\r\n\t */\r\n\tprivate options: RedirectHandlerOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RedirectHandler\r\n\t * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance\r\n\t * @returns An instance of RedirectHandler\r\n\t */\r\n\r\n\tpublic constructor(options: RedirectHandlerOptions = new RedirectHandlerOptions()) {\r\n\t\tthis.options = options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the response has the redirect status code or not\r\n\t * @param {Response} response - The response object\r\n\t * @returns A boolean representing whether the response contains the redirect status code or not\r\n\t */\r\n\tprivate isRedirect(response: Response): boolean {\r\n\t\treturn RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the response has location header or not\r\n\t * @param {Response} response - The response object\r\n\t * @returns A boolean representing the whether the response has location header or not\r\n\t */\r\n\tprivate hasLocationHeader(response: Response): boolean {\r\n\t\treturn response.headers.has(RedirectHandler.LOCATION_HEADER);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the redirect url from location header in response object\r\n\t * @param {Response} response - The response object\r\n\t * @returns A redirect url from location header\r\n\t */\r\n\tprivate getLocationHeader(response: Response): string {\r\n\t\treturn response.headers.get(RedirectHandler.LOCATION_HEADER);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the given url is a relative url or not\r\n\t * @param {string} url - The url string value\r\n\t * @returns A boolean representing whether the given url is a relative url or not\r\n\t */\r\n\tprivate isRelativeURL(url: string): boolean {\r\n\t\treturn url.indexOf(\"://\") === -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the authorization header in the request should be dropped for consequent redirected requests\r\n\t * @param {string} requestUrl - The request url value\r\n\t * @param {string} redirectUrl - The redirect url value\r\n\t * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests\r\n\t */\r\n\tprivate shouldDropAuthorizationHeader(requestUrl: string, redirectUrl: string): boolean {\r\n\t\tconst schemeHostRegex: RegExp = /^[A-Za-z].+?:\\/\\/.+?(?=\\/|$)/;\r\n\t\tconst requestMatches: string[] = schemeHostRegex.exec(requestUrl);\r\n\t\tlet requestAuthority: string;\r\n\t\tlet redirectAuthority: string;\r\n\t\tif (requestMatches !== null) {\r\n\t\t\trequestAuthority = requestMatches[0];\r\n\t\t}\r\n\t\tconst redirectMatches: string[] = schemeHostRegex.exec(redirectUrl);\r\n\t\tif (redirectMatches !== null) {\r\n\t\t\tredirectAuthority = redirectMatches[0];\r\n\t\t}\r\n\t\treturn typeof requestAuthority !== \"undefined\" && typeof redirectAuthority !== \"undefined\" && requestAuthority !== redirectAuthority;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To update a request url with the redirect url\r\n\t * @param {string} redirectUrl - The redirect url value\r\n\t * @param {Context} context - The context object value\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate async updateRequestUrl(redirectUrl: string, context: Context): Promise<void> {\r\n\t\tcontext.request = typeof context.request === \"string\" ? redirectUrl : await cloneRequestWithNewUrl(redirectUrl, context.request as Request);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the options for execution of the middleware\r\n\t * @param {Context} context - The context object\r\n\t * @returns A options for middleware execution\r\n\t */\r\n\tprivate getOptions(context: Context): RedirectHandlerOptions {\r\n\t\tlet options: RedirectHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions) as RedirectHandlerOptions;\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = Object.assign(new RedirectHandlerOptions(), this.options);\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To execute the next middleware and to handle in case of redirect response returned by the server\r\n\t * @param {Context} context - The context object\r\n\t * @param {number} redirectCount - The redirect count value\r\n\t * @param {RedirectHandlerOptions} options - The redirect handler options instance\r\n\t * @returns A promise that resolves to nothing\r\n\t */\r\n\tprivate async executeWithRedirect(context: Context, redirectCount: number, options: RedirectHandlerOptions): Promise<void> {\r\n\t\ttry {\r\n\t\t\tawait this.nextMiddleware.execute(context);\r\n\t\t\tconst response = context.response;\r\n\t\t\tif (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) {\r\n\t\t\t\t++redirectCount;\r\n\t\t\t\tif (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) {\r\n\t\t\t\t\tcontext.options.method = RequestMethod.GET;\r\n\t\t\t\t\tdelete context.options.body;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst redirectUrl: string = this.getLocationHeader(response);\r\n\t\t\t\t\tif (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) {\r\n\t\t\t\t\t\tdelete context.options.headers[RedirectHandler.AUTHORIZATION_HEADER];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tawait this.updateRequestUrl(redirectUrl, context);\r\n\t\t\t\t}\r\n\t\t\t\tawait this.executeWithRedirect(context, redirectCount, options);\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst redirectCount: number = 0;\r\n\t\t\tconst options = this.getOptions(context);\r\n\t\t\tcontext.options.redirect = RedirectHandler.MANUAL_REDIRECT;\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED);\r\n\t\t\treturn await this.executeWithRedirect(context, redirectCount, options);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module Constants\r\n */\r\n\r\n/**\r\n * @constant\r\n * A Default API endpoint version for a request\r\n */\r\nexport const GRAPH_API_VERSION = \"v1.0\";\r\n\r\n/**\r\n * @constant\r\n * A Default base url for a request\r\n */\r\nexport const GRAPH_BASE_URL = \"https://graph.microsoft.com/\";\r\n\r\n/**\r\n * To hold list of the service root endpoints for Microsoft Graph and Graph Explorer for each national cloud.\r\n * Set(iterable:Object) is not supported in Internet Explorer. The consumer is recommended to use a suitable polyfill.\r\n */\r\nexport const GRAPH_URLS = new Set<string>([\"graph.microsoft.com\", \"graph.microsoft.us\", \"dod-graph.microsoft.us\", \"graph.microsoft.de\", \"microsoftgraph.chinacloudapi.cn\"]);\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphRequestUtil\r\n */\r\nimport { GRAPH_URLS } from \"./Constants\";\r\n/**\r\n * To hold list of OData query params\r\n */\r\nexport const oDataQueryNames = [\"$select\", \"$expand\", \"$orderby\", \"$filter\", \"$top\", \"$skip\", \"$skipToken\", \"$count\"];\r\n\r\n/**\r\n * To construct the URL by appending the segments with \"/\"\r\n * @param {string[]} urlSegments - The array of strings\r\n * @returns The constructed URL string\r\n */\r\nexport const urlJoin = (urlSegments: string[]): string => {\r\n\tconst removePostSlash = (s) => s.replace(/\\/+$/, \"\");\r\n\tconst removePreSlash = (s) => s.replace(/^\\/+/, \"\");\r\n\tconst joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join(\"/\");\r\n\tconst parts = Array.prototype.slice.call(urlSegments);\r\n\treturn parts.reduce(joiner);\r\n};\r\n\r\n/**\r\n * Serializes the content\r\n * @param {any} content - The content value that needs to be serialized\r\n * @returns The serialized content\r\n *\r\n * Note:\r\n * This conversion is required due to the following reasons:\r\n * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string.\r\n * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers.\r\n * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`.\r\n * If the data received is in JSON format, `serializeContent` converts the JSON to string.\r\n */\r\n\r\nexport const serializeContent = (content: any): any => {\r\n\tconst className: string = content && content.constructor && content.constructor.name;\r\n\tif (className === \"Buffer\" || className === \"Blob\" || className === \"File\" || className === \"FormData\" || typeof content === \"string\") {\r\n\t\treturn content;\r\n\t}\r\n\tif (className === \"ArrayBuffer\") {\r\n\t\tcontent = Buffer.from(content);\r\n\t} else if (className === \"Int8Array\" || className === \"Int16Array\" || className === \"Int32Array\" || className === \"Uint8Array\" || className === \"Uint16Array\" || className === \"Uint32Array\" || className === \"Uint8ClampedArray\" || className === \"Float32Array\" || className === \"Float64Array\" || className === \"DataView\") {\r\n\t\tcontent = Buffer.from(content.buffer);\r\n\t} else {\r\n\t\ttry {\r\n\t\t\tcontent = JSON.stringify(content);\r\n\t\t} catch (error) {\r\n\t\t\tthrow new Error(\"Unable to stringify the content\");\r\n\t\t}\r\n\t}\r\n\treturn content;\r\n};\r\n\r\n/**\r\n * Checks if the url is one of the service root endpoints for Microsoft Graph and Graph Explorer.\r\n * @param {string} url - The url to be verified\r\n * @returns {boolean} - Returns true if the url is a Graph URL\r\n */\r\nexport const isGraphURL = (url: string): boolean => {\r\n\t// Valid Graph URL pattern - https://graph.microsoft.com/{version}/{resource}?{query-parameters}\r\n\t// Valid Graph URL example - https://graph.microsoft.com/v1.0/\r\n\turl = url.toLowerCase();\r\n\r\n\tif (url.indexOf(\"https://\") !== -1) {\r\n\t\turl = url.replace(\"https://\", \"\");\r\n\r\n\t\t// Find where the host ends\r\n\t\tconst startofPortNoPos = url.indexOf(\":\");\r\n\t\tconst endOfHostStrPos = url.indexOf(\"/\");\r\n\t\tlet hostName = \"\";\r\n\t\tif (endOfHostStrPos !== -1) {\r\n\t\t\tif (startofPortNoPos !== -1 && startofPortNoPos < endOfHostStrPos) {\r\n\t\t\t\thostName = url.substring(0, startofPortNoPos);\r\n\t\t\t\treturn GRAPH_URLS.has(hostName);\r\n\t\t\t}\r\n\t\t\t// Parse out the host\r\n\t\t\thostName = url.substring(0, endOfHostStrPos);\r\n\t\t\treturn GRAPH_URLS.has(hostName);\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n};\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module TelemetryHandler\r\n */\r\nimport { isGraphURL } from \"../GraphRequestUtil\";\r\nimport { Context } from \"../IContext\";\r\nimport { PACKAGE_VERSION } from \"../Version\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for TelemetryHandler\r\n */\r\nexport class TelemetryHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the client request id header\r\n\t */\r\n\tprivate static CLIENT_REQUEST_ID_HEADER = \"client-request-id\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the sdk version header\r\n\t */\r\n\tprivate static SDK_VERSION_HEADER = \"SdkVersion\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the language prefix for the sdk version header value\r\n\t */\r\n\tprivate static PRODUCT_NAME = \"graph-js\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the key for the feature usage metrics\r\n\t */\r\n\tprivate static FEATURE_USAGE_STRING = \"featureUsage\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\r\n\t\t\tif (isGraphURL(url)) {\r\n\t\t\t\t// Add telemetry only if the request url is a Graph URL.\r\n\t\t\t\t// Errors are reported as in issue #265 if headers are present when redirecting to a non Graph URL\r\n\t\t\t\tlet clientRequestId: string = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER);\r\n\t\t\t\tif (!clientRequestId) {\r\n\t\t\t\t\tclientRequestId = generateUUID();\r\n\t\t\t\t\tsetRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId);\r\n\t\t\t\t}\r\n\t\t\t\tlet sdkVersionValue: string = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`;\r\n\t\t\t\tlet options: TelemetryHandlerOptions;\r\n\t\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\r\n\t\t\t\t}\r\n\t\t\t\tif (options) {\r\n\t\t\t\t\tconst featureUsage: string = options.getFeatureUsage();\r\n\t\t\t\t\tsdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`;\r\n\t\t\t\t}\r\n\t\t\t\tappendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue);\r\n\t\t\t} else {\r\n\t\t\t\t// Remove telemetry headers if present during redirection.\r\n\t\t\t\tdelete context.options.headers[TelemetryHandler.CLIENT_REQUEST_ID_HEADER];\r\n\t\t\t\tdelete context.options.headers[TelemetryHandler.SDK_VERSION_HEADER];\r\n\t\t\t}\r\n\t\t\treturn await this.nextMiddleware.execute(context);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module ChaosStrategy\r\n */\r\n\r\n/**\r\n * Strategy used for Testing Handler\r\n * @enum\r\n */\r\nexport enum ChaosStrategy {\r\n\tMANUAL,\r\n\tRANDOM,\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @enum\r\n * Enum for ResponseType values\r\n * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer}\r\n * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob}\r\n * @property {string} DOCUMENT - This downloads content as a document or stream\r\n * @property {string} JSON - To download response content as a json\r\n * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html}\r\n * @property {string} TEXT - For downloading response as a text\r\n */\r\n\r\nexport enum ResponseType {\r\n\tARRAYBUFFER = \"arraybuffer\",\r\n\tBLOB = \"blob\",\r\n\tDOCUMENT = \"document\",\r\n\tJSON = \"json\",\r\n\tRAW = \"raw\",\r\n\tSTREAM = \"stream\",\r\n\tTEXT = \"text\",\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphResponseHandler\r\n */\r\n\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\nimport { ResponseType } from \"./ResponseType\";\r\n\r\n/**\r\n * @enum\r\n * Enum for document types\r\n * @property {string} TEXT_HTML - The text/html content type\r\n * @property {string} TEXT_XML - The text/xml content type\r\n * @property {string} APPLICATION_XML - The application/xml content type\r\n * @property {string} APPLICATION_XHTML - The application/xhml+xml content type\r\n */\r\nexport enum DocumentType {\r\n\tTEXT_HTML = \"text/html\",\r\n\tTEXT_XML = \"text/xml\",\r\n\tAPPLICATION_XML = \"application/xml\",\r\n\tAPPLICATION_XHTML = \"application/xhtml+xml\",\r\n}\r\n\r\n/**\r\n * @enum\r\n * Enum for Content types\r\n * @property {string} TEXT_PLAIN - The text/plain content type\r\n * @property {string} APPLICATION_JSON - The application/json content type\r\n */\r\n\r\nenum ContentType {\r\n\tTEXT_PLAIN = \"text/plain\",\r\n\tAPPLICATION_JSON = \"application/json\",\r\n}\r\n\r\n/**\r\n * @enum\r\n * Enum for Content type regex\r\n * @property {string} DOCUMENT - The regex to match document content types\r\n * @property {string} IMAGE - The regex to match image content types\r\n */\r\nenum ContentTypeRegexStr {\r\n\tDOCUMENT = \"^(text\\\\/(html|xml))|(application\\\\/(xml|xhtml\\\\+xml))$\",\r\n\tIMAGE = \"^image\\\\/.+\",\r\n}\r\n\r\n/**\r\n * @class\r\n * Class for GraphResponseHandler\r\n */\r\n\r\nexport class GraphResponseHandler {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * To parse Document response\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {DocumentType} type - The type to which the document needs to be parsed\r\n\t * @returns A promise that resolves to a document content\r\n\t */\r\n\tprivate static parseDocumentResponse(rawResponse: Response, type: DocumentType): Promise<any> {\r\n\t\ttry {\r\n\t\t\tif (typeof DOMParser !== \"undefined\") {\r\n\t\t\t\treturn new Promise((resolve, reject) => {\r\n\t\t\t\t\trawResponse.text().then((xmlString) => {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tconst parser = new DOMParser();\r\n\t\t\t\t\t\t\tconst xmlDoc = parser.parseFromString(xmlString, type);\r\n\t\t\t\t\t\t\tresolve(xmlDoc);\r\n\t\t\t\t\t\t} catch (error) {\r\n\t\t\t\t\t\t\treject(error);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\treturn Promise.resolve(rawResponse.body);\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * @async\r\n\t * To convert the native Response to response content\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {ResponseType} [responseType] - The response type value\r\n\t * @returns A promise that resolves to the converted response content\r\n\t */\r\n\tprivate static async convertResponse(rawResponse: Response, responseType?: ResponseType): Promise<any> {\r\n\t\tif (rawResponse.status === 204) {\r\n\t\t\t// NO CONTENT\r\n\t\t\treturn Promise.resolve();\r\n\t\t}\r\n\t\tlet responseValue: any;\r\n\t\ttry {\r\n\t\t\tswitch (responseType) {\r\n\t\t\t\tcase ResponseType.ARRAYBUFFER:\r\n\t\t\t\t\tresponseValue = await rawResponse.arrayBuffer();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.BLOB:\r\n\t\t\t\t\tresponseValue = await rawResponse.blob();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.DOCUMENT:\r\n\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.JSON:\r\n\t\t\t\t\tresponseValue = await rawResponse.json();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.STREAM:\r\n\t\t\t\t\tresponseValue = await Promise.resolve(rawResponse.body);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.TEXT:\r\n\t\t\t\t\tresponseValue = await rawResponse.text();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tconst contentType = rawResponse.headers.get(\"Content-type\");\r\n\t\t\t\t\tif (contentType !== null) {\r\n\t\t\t\t\t\tconst mimeType = contentType.split(\";\")[0];\r\n\t\t\t\t\t\tif (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) {\r\n\t\t\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType as DocumentType);\r\n\t\t\t\t\t\t} else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) {\r\n\t\t\t\t\t\t\tresponseValue = rawResponse.blob();\r\n\t\t\t\t\t\t} else if (mimeType === ContentType.TEXT_PLAIN) {\r\n\t\t\t\t\t\t\tresponseValue = await rawResponse.text();\r\n\t\t\t\t\t\t} else if (mimeType === ContentType.APPLICATION_JSON) {\r\n\t\t\t\t\t\t\tresponseValue = await rawResponse.json();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t/**\r\n\t\t\t\t\t\t * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says:\r\n\t\t\t\t\t\t * A sender that generates a message containing a payload body SHOULD\r\n\t\t\t\t\t\t * generate a Content-Type header field in that message unless the\r\n\t\t\t\t\t\t * intended media type of the enclosed representation is unknown to the\r\n\t\t\t\t\t\t * sender. If a Content-Type header field is not present, the recipient\r\n\t\t\t\t\t\t * MAY either assume a media type of \"application/octet-stream\"\r\n\t\t\t\t\t\t * ([RFC2046], Section 4.5.1) or examine the data to determine its type.\r\n\t\t\t\t\t\t *\r\n\t\t\t\t\t\t * So assuming it as a stream type so returning the body.\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\treturn responseValue;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * @async\r\n\t * To get the parsed response\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {ResponseType} [responseType] - The response type value\r\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\r\n\t * @returns The parsed response\r\n\t */\r\n\tpublic static async getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\tif (responseType === ResponseType.RAW) {\r\n\t\t\t\treturn Promise.resolve(rawResponse);\r\n\t\t\t} else {\r\n\t\t\t\tconst response = await GraphResponseHandler.convertResponse(rawResponse, responseType);\r\n\t\t\t\tif (rawResponse.ok) {\r\n\t\t\t\t\t// Status Code 2XX\r\n\t\t\t\t\tif (typeof callback === \"function\") {\r\n\t\t\t\t\t\tcallback(null, response);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn response;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// NOT OK Response\r\n\t\t\t\t\tthrow response;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module CustomAuthenticationProvider\r\n */\r\n\r\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\r\nimport { AuthProvider } from \"./IAuthProvider\";\r\n\r\n/**\r\n * @class\r\n * Class representing CustomAuthenticationProvider\r\n * @extends AuthenticationProvider\r\n */\r\nexport class CustomAuthenticationProvider implements AuthenticationProvider {\r\n\t/**\r\n\t * @private\r\n\t * A member to hold authProvider callback\r\n\t */\r\n\tprivate provider: AuthProvider;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of CustomAuthenticationProvider\r\n\t * @param {AuthProviderCallback} provider - An authProvider function\r\n\t * @returns An instance of CustomAuthenticationProvider\r\n\t */\r\n\tpublic constructor(provider: AuthProvider) {\r\n\t\tthis.provider = provider;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To get the access token\r\n\t * @returns The promise that resolves to an access token\r\n\t */\r\n\tpublic async getAccessToken(): Promise<any> {\r\n\t\treturn new Promise((resolve: (accessToken: string) => void, reject: (error: any) => void) => {\r\n\t\t\tthis.provider((error: any, accessToken: string | null) => {\r\n\t\t\t\tif (accessToken) {\r\n\t\t\t\t\tresolve(accessToken);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treject(error);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphError\r\n */\r\n\r\n/**\r\n * @class\r\n * Class for GraphError\r\n * @NOTE: This is NOT what is returned from the Graph\r\n * GraphError is created from parsing JSON errors returned from the graph\r\n * Some fields are renamed ie, \"request-id\" => requestId so you can use dot notation\r\n */\r\n\r\nexport class GraphError extends Error {\r\n\t/**\r\n\t * @public\r\n\t * A member holding status code of the error\r\n\t */\r\n\tpublic statusCode: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding code i.e name of the error\r\n\t */\r\n\tpublic code: string | null;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding request-id i.e identifier of the request\r\n\t */\r\n\tpublic requestId: string | null;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding processed date and time of the request\r\n\t */\r\n\tpublic date: Date;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding original error response by the graph service\r\n\t */\r\n\tpublic body: any;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of GraphError\r\n\t * @param {number} [statusCode = -1] - The status code of the error\r\n\t * @returns An instance of GraphError\r\n\t */\r\n\tpublic constructor(statusCode: number = -1, message?: string, baseError?: Error) {\r\n\t\tsuper(message || (baseError && baseError.message));\r\n\t\t// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n\t\tObject.setPrototypeOf(this, GraphError.prototype);\r\n\t\tthis.statusCode = statusCode;\r\n\t\tthis.code = null;\r\n\t\tthis.requestId = null;\r\n\t\tthis.date = new Date();\r\n\t\tthis.body = null;\r\n\t\tthis.stack = baseError ? baseError.stack : this.stack;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphErrorHandler\r\n */\r\n\r\nimport { GraphError } from \"./GraphError\";\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\n\r\n/**\r\n * @class\r\n * Class for GraphErrorHandler\r\n */\r\n\r\nexport class GraphErrorHandler {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * Populates the GraphError instance with Error instance values\r\n\t * @param {Error} error - The error returned by graph service or some native error\r\n\t * @param {number} [statusCode] - The status code of the response\r\n\t * @returns The GraphError instance\r\n\t */\r\n\tprivate static constructError(error: Error, statusCode?: number): GraphError {\r\n\t\tconst gError = new GraphError(statusCode, \"\", error);\r\n\t\tif (error.name !== undefined) {\r\n\t\t\tgError.code = error.name;\r\n\t\t}\r\n\t\tgError.body = error.toString();\r\n\t\tgError.date = new Date();\r\n\t\treturn gError;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * @async\r\n\t * Populates the GraphError instance from the Error returned by graph service\r\n\t * @param {any} error - The error returned by graph service or some native error\r\n\t * @param {number} statusCode - The status code of the response\r\n\t * @returns A promise that resolves to GraphError instance\r\n\t *\r\n\t * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo\r\n\t * {\r\n\t * \"error\": {\r\n\t * \"code\": \"SearchEvents\",\r\n\t * \"message\": \"The parameter $search is not currently supported on the Events resource.\",\r\n\t * \"innerError\": {\r\n\t * \"request-id\": \"b31c83fd-944c-4663-aa50-5d9ceb367e19\",\r\n\t * \"date\": \"2016-11-17T18:37:45\"\r\n\t * }\r\n\t * }\r\n\t * }\r\n\t */\r\n\tprivate static constructErrorFromResponse(error: any, statusCode: number): GraphError {\r\n\t\terror = error.error;\r\n\t\tconst gError = new GraphError(statusCode, error.message);\r\n\t\tgError.code = error.code;\r\n\t\tif (error.innerError !== undefined) {\r\n\t\t\tgError.requestId = error.innerError[\"request-id\"];\r\n\t\t\tgError.date = new Date(error.innerError.date);\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tgError.body = JSON.stringify(error);\r\n\t\t} catch (error) {\r\n\t\t\t// tslint:disable-line: no-empty\r\n\t\t}\r\n\t\treturn gError;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * @async\r\n\t * To get the GraphError object\r\n\t * @param {any} [error = null] - The error returned by graph service or some native error\r\n\t * @param {number} [statusCode = -1] - The status code of the response\r\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\r\n\t * @returns A promise that resolves to GraphError instance\r\n\t */\r\n\tpublic static async getError(error: any = null, statusCode: number = -1, callback?: GraphRequestCallback): Promise<GraphError> {\r\n\t\tlet gError: GraphError;\r\n\t\tif (error && error.error) {\r\n\t\t\tgError = GraphErrorHandler.constructErrorFromResponse(error, statusCode);\r\n\t\t} else if (typeof Error !== \"undefined\" && error instanceof Error) {\r\n\t\t\tgError = GraphErrorHandler.constructError(error, statusCode);\r\n\t\t} else {\r\n\t\t\tgError = new GraphError(statusCode);\r\n\t\t}\r\n\t\tif (typeof callback === \"function\") {\r\n\t\t\tcallback(gError, null);\r\n\t\t} else {\r\n\t\t\treturn gError;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphRequest\r\n */\r\n\r\nimport { GraphError } from \"./GraphError\";\r\nimport { GraphErrorHandler } from \"./GraphErrorHandler\";\r\nimport { oDataQueryNames, serializeContent, urlJoin } from \"./GraphRequestUtil\";\r\nimport { GraphResponseHandler } from \"./GraphResponseHandler\";\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { ClientOptions } from \"./IClientOptions\";\r\nimport { Context } from \"./IContext\";\r\nimport { FetchOptions } from \"./IFetchOptions\";\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\nimport { MiddlewareControl } from \"./middleware/MiddlewareControl\";\r\nimport { MiddlewareOptions } from \"./middleware/options/IMiddlewareOptions\";\r\nimport { RequestMethod } from \"./RequestMethod\";\r\nimport { ResponseType } from \"./ResponseType\";\r\n/**\r\n * @interface\r\n * Signature to representing key value pairs\r\n * @property {[key: string] : string | number} - The Key value pair\r\n */\r\ninterface KeyValuePairObjectStringNumber {\r\n\t[key: string]: string | number;\r\n}\r\n\r\n/**\r\n * @interface\r\n * Signature to define URL components\r\n * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS\r\n *\r\n * @property {string} host - The host to which the request needs to be made\r\n * @property {string} version - Version of the graph endpoint\r\n * @property {string} [path] - The path of the resource request\r\n * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params\r\n * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request\r\n * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'\r\n */\r\nexport interface URLComponents {\r\n\thost: string;\r\n\tversion: string;\r\n\tpath?: string;\r\n\toDataQueryParams: KeyValuePairObjectStringNumber;\r\n\totherURLQueryParams: KeyValuePairObjectStringNumber;\r\n\totherURLQueryOptions?: string[];\r\n}\r\n\r\n/**\r\n * @class\r\n * A Class representing GraphRequest\r\n */\r\nexport class GraphRequest {\r\n\t/**\r\n\t * @private\r\n\t * A member variable to hold HTTPClient instance\r\n\t */\r\n\tprivate httpClient: HTTPClient;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member variable to hold client options\r\n\t */\r\n\tprivate config: ClientOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold URL Components data\r\n\t */\r\n\tprivate urlComponents: URLComponents;\r\n\r\n\t/* tslint:disable: variable-name */\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom header options for a request\r\n\t */\r\n\tprivate _headers: HeadersInit;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom options for a request\r\n\t */\r\n\tprivate _options: FetchOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold the array of middleware options for a request\r\n\t */\r\n\tprivate _middlewareOptions: MiddlewareOptions[];\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom response type for a request\r\n\t */\r\n\tprivate _responseType: ResponseType;\r\n\t/* tslint:enable: variable-name */\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of GraphRequest\r\n\t * @param {HTTPClient} httpClient - The HTTPClient instance\r\n\t * @param {ClientOptions} config - The options for making request\r\n\t * @param {string} path - A path string\r\n\t */\r\n\tpublic constructor(httpClient: HTTPClient, config: ClientOptions, path: string) {\r\n\t\tthis.httpClient = httpClient;\r\n\t\tthis.config = config;\r\n\t\tthis.urlComponents = {\r\n\t\t\thost: this.config.baseUrl,\r\n\t\t\tversion: this.config.defaultVersion,\r\n\t\t\toDataQueryParams: {},\r\n\t\t\totherURLQueryParams: {},\r\n\t\t\totherURLQueryOptions: [],\r\n\t\t};\r\n\t\tthis._headers = {};\r\n\t\tthis._options = {};\r\n\t\tthis._middlewareOptions = [];\r\n\t\tthis.parsePath(path);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the path string and creates URLComponents out of it\r\n\t * @param {string} path - The request path string\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate parsePath = (path: string): void => {\r\n\t\t// Strips out the base of the url if they passed in\r\n\t\tif (path.indexOf(\"https://\") !== -1) {\r\n\t\t\tpath = path.replace(\"https://\", \"\");\r\n\r\n\t\t\t// Find where the host ends\r\n\t\t\tconst endOfHostStrPos = path.indexOf(\"/\");\r\n\t\t\tif (endOfHostStrPos !== -1) {\r\n\t\t\t\t// Parse out the host\r\n\t\t\t\tthis.urlComponents.host = \"https://\" + path.substring(0, endOfHostStrPos);\r\n\t\t\t\t// Strip the host from path\r\n\t\t\t\tpath = path.substring(endOfHostStrPos + 1, path.length);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove the following version\r\n\t\t\tconst endOfVersionStrPos = path.indexOf(\"/\");\r\n\t\t\tif (endOfVersionStrPos !== -1) {\r\n\t\t\t\t// Parse out the version\r\n\t\t\t\tthis.urlComponents.version = path.substring(0, endOfVersionStrPos);\r\n\t\t\t\t// Strip version from path\r\n\t\t\t\tpath = path.substring(endOfVersionStrPos + 1, path.length);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Strip out any leading \"/\"\r\n\t\tif (path.charAt(0) === \"/\") {\r\n\t\t\tpath = path.substr(1);\r\n\t\t}\r\n\r\n\t\tconst queryStrPos = path.indexOf(\"?\");\r\n\t\tif (queryStrPos === -1) {\r\n\t\t\t// No query string\r\n\t\t\tthis.urlComponents.path = path;\r\n\t\t} else {\r\n\t\t\tthis.urlComponents.path = path.substr(0, queryStrPos);\r\n\r\n\t\t\t// Capture query string into oDataQueryParams and otherURLQueryParams\r\n\t\t\tconst queryParams = path.substring(queryStrPos + 1, path.length).split(\"&\");\r\n\t\t\tfor (const queryParam of queryParams) {\r\n\t\t\t\tthis.parseQueryParameter(queryParam);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * @private\r\n\t * Adds the query parameter as comma separated values\r\n\t * @param {string} propertyName - The name of a property\r\n\t * @param {string|string[]} propertyValue - The vale of a property\r\n\t * @param {IArguments} additionalProperties - The additional properties\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate addCsvQueryParameter(propertyName: string, propertyValue: string | string[], additionalProperties: IArguments): void {\r\n\t\t// If there are already $propertyName value there, append a \",\"\r\n\t\tthis.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + \",\" : \"\";\r\n\r\n\t\tlet allValues: string[] = [];\r\n\r\n\t\tif (additionalProperties.length > 1 && typeof propertyValue === \"string\") {\r\n\t\t\tallValues = Array.prototype.slice.call(additionalProperties);\r\n\t\t} else if (typeof propertyValue === \"string\") {\r\n\t\t\tallValues.push(propertyValue);\r\n\t\t} else {\r\n\t\t\tallValues = allValues.concat(propertyValue);\r\n\t\t}\r\n\r\n\t\tthis.urlComponents.oDataQueryParams[propertyName] += allValues.join(\",\");\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Builds the full url from the URLComponents to make a request\r\n\t * @returns The URL string that is qualified to make a request to graph endpoint\r\n\t */\r\n\tprivate buildFullUrl(): string {\r\n\t\tconst url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString();\r\n\r\n\t\tif (this.config.debugLogging) {\r\n\t\t\tconsole.log(url); // tslint:disable-line: no-console\r\n\t\t}\r\n\t\treturn url;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Builds the query string from the URLComponents\r\n\t * @returns The Constructed query string\r\n\t */\r\n\tprivate createQueryString(): string {\r\n\t\t// Combining query params from oDataQueryParams and otherURLQueryParams\r\n\t\tconst urlComponents = this.urlComponents;\r\n\t\tconst query: string[] = [];\r\n\t\tif (Object.keys(urlComponents.oDataQueryParams).length !== 0) {\r\n\t\t\tfor (const property in urlComponents.oDataQueryParams) {\r\n\t\t\t\tif (urlComponents.oDataQueryParams.hasOwnProperty(property)) {\r\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.oDataQueryParams[property]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (Object.keys(urlComponents.otherURLQueryParams).length !== 0) {\r\n\t\t\tfor (const property in urlComponents.otherURLQueryParams) {\r\n\t\t\t\tif (urlComponents.otherURLQueryParams.hasOwnProperty(property)) {\r\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.otherURLQueryParams[property]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (urlComponents.otherURLQueryOptions.length !== 0) {\r\n\t\t\tfor (const str of urlComponents.otherURLQueryOptions) {\r\n\t\t\t\tquery.push(str);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn query.length > 0 ? \"?\" + query.join(\"&\") : \"\";\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the query parameters to set the urlComponents property of the GraphRequest object\r\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tprivate parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\r\n\t\tif (typeof queryDictionaryOrString === \"string\") {\r\n\t\t\tif (queryDictionaryOrString.charAt(0) === \"?\") {\r\n\t\t\t\tqueryDictionaryOrString = queryDictionaryOrString.substring(1);\r\n\t\t\t}\r\n\r\n\t\t\tif (queryDictionaryOrString.indexOf(\"&\") !== -1) {\r\n\t\t\t\tconst queryParams = queryDictionaryOrString.split(\"&\");\r\n\t\t\t\tfor (const str of queryParams) {\r\n\t\t\t\t\tthis.parseQueryParamenterString(str);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.parseQueryParamenterString(queryDictionaryOrString);\r\n\t\t\t}\r\n\t\t} else if (queryDictionaryOrString.constructor === Object) {\r\n\t\t\tfor (const key in queryDictionaryOrString) {\r\n\t\t\t\tif (queryDictionaryOrString.hasOwnProperty(key)) {\r\n\t\t\t\t\tthis.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object\r\n\t * @param {string} queryParameter - the query parameters\r\n\t * returns nothing\r\n\t */\r\n\tprivate parseQueryParamenterString(queryParameter: string): void {\r\n\t\t/* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters.\r\n\t\t\t\t Example-> \"/me?$expand=home($select=city)\" */\r\n\t\tif (this.isValidQueryKeyValuePair(queryParameter)) {\r\n\t\t\tconst indexOfFirstEquals = queryParameter.indexOf(\"=\");\r\n\t\t\tconst paramKey = queryParameter.substring(0, indexOfFirstEquals);\r\n\t\t\tconst paramValue = queryParameter.substring(indexOfFirstEquals + 1);\r\n\t\t\tthis.setURLComponentsQueryParamater(paramKey, paramValue);\r\n\t\t} else {\r\n\t\t\t/* Push values which are not of key-value structure.\r\n\t\t\tExample-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/\r\n\t\t\tthis.urlComponents.otherURLQueryOptions.push(queryParameter);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Sets values into the urlComponents property of GraphRequest object.\r\n\t * @param {string} paramKey - the query parameter key\r\n\t * @param {string} paramValue - the query paramter value\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setURLComponentsQueryParamater(paramKey: string, paramValue: string | number): void {\r\n\t\tif (oDataQueryNames.indexOf(paramKey) !== -1) {\r\n\t\t\tconst currentValue = this.urlComponents.oDataQueryParams[paramKey];\r\n\t\t\tconst isValueAppendable = currentValue && (paramKey === \"$expand\" || paramKey === \"$select\" || paramKey === \"$orderby\");\r\n\t\t\tthis.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + \",\" + paramValue : paramValue;\r\n\t\t} else {\r\n\t\t\tthis.urlComponents.otherURLQueryParams[paramKey] = paramValue;\r\n\t\t}\r\n\t}\r\n\t/**\r\n\t * @private\r\n\t * Check if the query parameter string has a valid key-value structure\r\n\t * @param {string} queryString - the query parameter string. Example -> \"name=value\"\r\n\t * #returns true if the query string has a valid key-value structure else false\r\n\t */\r\n\tprivate isValidQueryKeyValuePair(queryString: string): boolean {\r\n\t\tconst indexofFirstEquals = queryString.indexOf(\"=\");\r\n\t\tif (indexofFirstEquals === -1) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tconst indexofOpeningParanthesis = queryString.indexOf(\"(\");\r\n\t\tif (indexofOpeningParanthesis !== -1 && queryString.indexOf(\"(\") < indexofFirstEquals) {\r\n\t\t\t// Example -> .query($select($expand=true));\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Updates the custom headers and options for a request\r\n\t * @param {FetchOptions} options - The request options object\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate updateRequestOptions(options: FetchOptions): void {\r\n\t\tconst optionsHeaders: HeadersInit = { ...options.headers };\r\n\t\tif (this.config.fetchOptions !== undefined) {\r\n\t\t\tconst fetchOptions: FetchOptions = { ...this.config.fetchOptions };\r\n\t\t\tObject.assign(options, fetchOptions);\r\n\t\t\tif (typeof this.config.fetchOptions.headers !== undefined) {\r\n\t\t\t\toptions.headers = { ...this.config.fetchOptions.headers };\r\n\t\t\t}\r\n\t\t}\r\n\t\tObject.assign(options, this._options);\r\n\t\tif (options.headers !== undefined) {\r\n\t\t\tObject.assign(optionsHeaders, options.headers);\r\n\t\t}\r\n\t\tObject.assign(optionsHeaders, this._headers);\r\n\t\toptions.headers = optionsHeaders;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * Adds the custom headers and options to the request and makes the HTTPClient send request call\r\n\t * @param {RequestInfo} request - The request url string or the Request object value\r\n\t * @param {FetchOptions} options - The options to make a request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the response content\r\n\t */\r\n\tprivate async send(request: RequestInfo, options: FetchOptions, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tlet rawResponse: Response;\r\n\t\tconst middlewareControl = new MiddlewareControl(this._middlewareOptions);\r\n\t\tthis.updateRequestOptions(options);\r\n\t\ttry {\r\n\t\t\tconst context: Context = await this.httpClient.sendRequest({\r\n\t\t\t\trequest,\r\n\t\t\t\toptions,\r\n\t\t\t\tmiddlewareControl,\r\n\t\t\t});\r\n\t\t\trawResponse = context.response;\r\n\t\t\tconst response: any = await GraphResponseHandler.getResponse(rawResponse, this._responseType, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tlet statusCode: number;\r\n\t\t\tif (typeof rawResponse !== \"undefined\") {\r\n\t\t\t\tstatusCode = rawResponse.status;\r\n\t\t\t}\r\n\t\t\tconst gError: GraphError = await GraphErrorHandler.getError(error, statusCode, callback);\r\n\t\t\tthrow gError;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json\r\n\t * @param none\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setHeaderContentType(): void {\r\n\t\tif (!this._headers) {\r\n\t\t\tthis.header(\"Content-Type\", \"application/json\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst headerKeys = Object.keys(this._headers);\r\n\t\tfor (const headerKey of headerKeys) {\r\n\t\t\tif (headerKey.toLowerCase() === \"content-type\") {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Default the content-type to application/json in case the content-type is not present in the header\r\n\t\tthis.header(\"Content-Type\", \"application/json\");\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the custom header for a request\r\n\t * @param {string} headerKey - A header key\r\n\t * @param {string} headerValue - A header value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic header(headerKey: string, headerValue: string): GraphRequest {\r\n\t\tthis._headers[headerKey] = headerValue;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the custom headers for a request\r\n\t * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest {\r\n\t\tfor (const key in headers) {\r\n\t\t\tif (headers.hasOwnProperty(key)) {\r\n\t\t\t\tthis._headers[key] = headers[key] as string;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the option for making a request\r\n\t * @param {string} key - The key value\r\n\t * @param {any} value - The value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic option(key: string, value: any): GraphRequest {\r\n\t\tthis._options[key] = value;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the options for making a request\r\n\t * @param {{ [key: string]: any }} options - The options key value pair\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic options(options: { [key: string]: any }): GraphRequest {\r\n\t\tfor (const key in options) {\r\n\t\t\tif (options.hasOwnProperty(key)) {\r\n\t\t\t\tthis._options[key] = options[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the middleware options for a request\r\n\t * @param {MiddlewareOptions[]} options - The array of middleware options\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic middlewareOptions(options: MiddlewareOptions[]): GraphRequest {\r\n\t\tthis._middlewareOptions = options;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the api endpoint version for a request\r\n\t * @param {string} version - The version value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic version(version: string): GraphRequest {\r\n\t\tthis.urlComponents.version = version;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the api endpoint version for a request\r\n\t * @param {ResponseType} responseType - The response type value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic responseType(responseType: ResponseType): GraphRequest {\r\n\t\tthis._responseType = responseType;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for select OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query\r\n\t */\r\n\t/*\r\n\t * Accepts .select(\"displayName,birthday\")\r\n\t * and .select([\"displayName\", \"birthday\"])\r\n\t * and .select(\"displayName\", \"birthday\")\r\n\t *\r\n\t */\r\n\tpublic select(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$select\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for expand OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query\r\n\t */\r\n\tpublic expand(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$expand\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for orderby OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query\r\n\t */\r\n\tpublic orderby(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$orderby\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string.\r\n\t * @param {string} filterStr - The filter query string\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the $filter query\r\n\t */\r\n\tpublic filter(filterStr: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$filter = filterStr;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string.\r\n\t * @param {string} searchStr - The search criterion string\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria\r\n\t */\r\n\tpublic search(searchStr: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$search = searchStr;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value.\r\n\t * @param {number} n - The number value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for $top query\r\n\t */\r\n\tpublic top(n: number): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$top = n;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value.\r\n\t * @param {number} n - The number value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query\r\n\t */\r\n\tpublic skip(n: number): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$skip = n;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value.\r\n\t * @param {string} token - The token value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option\r\n\t */\r\n\tpublic skipToken(token: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$skipToken = token;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value.\r\n\t * @param {boolean} isCount - The count boolean\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option\r\n\t */\r\n\tpublic count(isCount: boolean = false): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$count = isCount.toString();\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Appends query string to the urlComponent\r\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value\r\n\t * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component\r\n\t */\r\n\t/*\r\n\t * Accepts .query(\"displayName=xyz\")\r\n\t * and .select({ name: \"value\" })\r\n\t */\r\n\tpublic query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\r\n\t\treturn this.parseQueryParameter(queryDictionaryOrString);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the get response\r\n\t */\r\n\tpublic async get(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.GET,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with POST method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the post response\r\n\t */\r\n\tpublic async post(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.POST,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\tconst className: string = content && content.constructor && content.constructor.name;\r\n\t\tif (className === \"FormData\") {\r\n\t\t\t// Content-Type headers should not be specified in case the of FormData type content\r\n\t\t\toptions.headers = {};\r\n\t\t} else {\r\n\t\t\tthis.setHeaderContentType();\r\n\t\t\toptions.headers = this._headers;\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for Post request call\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the post response\r\n\t */\r\n\tpublic async create(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.post(content, callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with PUT method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the put response\r\n\t */\r\n\tpublic async put(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tthis.setHeaderContentType();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.PUT,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with PATCH method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the patch response\r\n\t */\r\n\tpublic async patch(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tthis.setHeaderContentType();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.PATCH,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for PATCH request\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the patch response\r\n\t */\r\n\tpublic async update(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.patch(content, callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with DELETE method\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the delete response\r\n\t */\r\n\tpublic async delete(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.DELETE,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for delete request call\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the delete response\r\n\t */\r\n\tpublic async del(callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.delete(callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method to read response as a stream.\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the getStream response\r\n\t */\r\n\tpublic async getStream(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options = {\r\n\t\t\tmethod: RequestMethod.GET,\r\n\t\t};\r\n\t\tthis.responseType(ResponseType.STREAM);\r\n\t\ttry {\r\n\t\t\tconst stream = await this.send(url, options, callback);\r\n\t\t\treturn stream;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method to read response as a stream.\r\n\t * @param {any} stream - The stream instance\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the putStream response\r\n\t */\r\n\tpublic async putStream(stream: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options = {\r\n\t\t\tmethod: RequestMethod.PUT,\r\n\t\t\theaders: {\r\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\r\n\t\t\t},\r\n\t\t\tbody: stream,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPClient\r\n */\r\n\r\nimport { Context } from \"./IContext\";\r\nimport { Middleware } from \"./middleware/IMiddleware\";\r\n\r\n/**\r\n * @class\r\n * Class representing HTTPClient\r\n */\r\nexport class HTTPClient {\r\n\t/**\r\n\t * @private\r\n\t * A member holding first middleware of the middleware chain\r\n\t */\r\n\tprivate middleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of a HTTPClient\r\n\t * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\r\n\t */\r\n\tpublic constructor(...middleware: Middleware[]) {\r\n\t\tif (!middleware || !middleware.length) {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"InvalidMiddlewareChain\";\r\n\t\t\terror.message = \"Please provide a default middleware chain or custom middleware chain\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.setMiddleware(...middleware);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Processes the middleware parameter passed to set this.middleware property\r\n\t * The calling function should validate if middleware is not undefined or not empty.\r\n\t * @param {...Middleware} middleware - The middleware passed\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate setMiddleware(...middleware: Middleware[]): void {\r\n\t\tif (middleware.length > 1) {\r\n\t\t\tthis.parseMiddleWareArray(middleware);\r\n\t\t} else {\r\n\t\t\tthis.middleware = middleware[0];\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Processes the middleware array to construct the chain\r\n\t * and sets this.middleware property to the first middlware handler of the array\r\n\t * The calling function should validate if middleware is not undefined or not empty\r\n\t * @param {Middleware[]} middlewareArray - The array of middleware handlers\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate parseMiddleWareArray(middlewareArray: Middleware[]) {\r\n\t\tmiddlewareArray.forEach((element, index) => {\r\n\t\t\tif (index < middlewareArray.length - 1) {\r\n\t\t\t\telement.setNext(middlewareArray[index + 1]);\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis.middleware = middlewareArray[0];\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To send the request through the middleware chain\r\n\t * @param {Context} context - The context of a request\r\n\t * @returns A promise that resolves to the Context\r\n\t */\r\n\tpublic async sendRequest(context: Context): Promise<Context> {\r\n\t\ttry {\r\n\t\t\tif (typeof context.request === \"string\" && context.options === undefined) {\r\n\t\t\t\tconst error = new Error();\r\n\t\t\t\terror.name = \"InvalidRequestOptions\";\r\n\t\t\t\terror.message = \"Unable to execute the middleware, Please provide valid options for a request\";\r\n\t\t\t\tthrow error;\r\n\t\t\t}\r\n\t\t\tawait this.middleware.execute(context);\r\n\t\t\treturn context;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPClientFactory\r\n */\r\n\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\r\nimport { AuthenticationHandler } from \"./middleware/AuthenticationHandler\";\r\nimport { HTTPMessageHandler } from \"./middleware/HTTPMessageHandler\";\r\nimport { Middleware } from \"./middleware/IMiddleware\";\r\nimport { RedirectHandlerOptions } from \"./middleware/options/RedirectHandlerOptions\";\r\nimport { RetryHandlerOptions } from \"./middleware/options/RetryHandlerOptions\";\r\nimport { RedirectHandler } from \"./middleware/RedirectHandler\";\r\nimport { RetryHandler } from \"./middleware/RetryHandler\";\r\nimport { TelemetryHandler } from \"./middleware/TelemetryHandler\";\r\n\r\n/**\r\n * @private\r\n * To check whether the environment is node or not\r\n * @returns A boolean representing the environment is node or not\r\n */\r\nconst isNodeEnvironment = (): boolean => {\r\n\treturn typeof process === \"object\" && typeof require === \"function\";\r\n};\r\n\r\n/**\r\n * @class\r\n * Class representing HTTPClientFactory\r\n */\r\nexport class HTTPClientFactory {\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * Creates HTTPClient with default middleware chain\r\n\t * @param {AuthenticationProvider} authProvider - The authentication provider instance\r\n\t * @returns A HTTPClient instance\r\n\t *\r\n\t * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline.\r\n\t * \t\t* HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request\r\n\t * \t\t* TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler \t*\t\t before making the actual network call ensures that the usage of all features are recorded in the flag.\r\n\t * \t\t* The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for\r\n\t * \t\t them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same.\r\n\t */\r\n\tpublic static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient {\r\n\t\tconst authenticationHandler = new AuthenticationHandler(authProvider);\r\n\t\tconst retryHandler = new RetryHandler(new RetryHandlerOptions());\r\n\t\tconst telemetryHandler = new TelemetryHandler();\r\n\t\tconst httpMessageHandler = new HTTPMessageHandler();\r\n\r\n\t\tauthenticationHandler.setNext(retryHandler);\r\n\t\tif (isNodeEnvironment()) {\r\n\t\t\tconst redirectHandler = new RedirectHandler(new RedirectHandlerOptions());\r\n\t\t\tretryHandler.setNext(redirectHandler);\r\n\t\t\tredirectHandler.setNext(telemetryHandler);\r\n\t\t} else {\r\n\t\t\tretryHandler.setNext(telemetryHandler);\r\n\t\t}\r\n\t\ttelemetryHandler.setNext(httpMessageHandler);\r\n\t\treturn HTTPClientFactory.createWithMiddleware(authenticationHandler);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * Creates a middleware chain with the given one\r\n\t * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\r\n\t * @returns A HTTPClient instance\r\n\t */\r\n\tpublic static createWithMiddleware(...middleware: Middleware[]): HTTPClient {\r\n\t\t// Middleware should not empty or undefined. This is check is present in the HTTPClient constructor.\r\n\t\treturn new HTTPClient(...middleware);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module Client\r\n */\r\n\r\nimport { GRAPH_API_VERSION, GRAPH_BASE_URL } from \"./Constants\";\r\nimport { CustomAuthenticationProvider } from \"./CustomAuthenticationProvider\";\r\nimport { GraphRequest } from \"./GraphRequest\";\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { HTTPClientFactory } from \"./HTTPClientFactory\";\r\nimport { ClientOptions } from \"./IClientOptions\";\r\nimport { Options } from \"./IOptions\";\r\nimport { validatePolyFilling } from \"./ValidatePolyFilling\";\r\n\r\nexport class Client {\r\n\t/**\r\n\t * @private\r\n\t * A member which stores the Client instance options\r\n\t */\r\n\tprivate config: ClientOptions = {\r\n\t\tbaseUrl: GRAPH_BASE_URL,\r\n\t\tdebugLogging: false,\r\n\t\tdefaultVersion: GRAPH_API_VERSION,\r\n\t};\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member which holds the HTTPClient instance\r\n\t */\r\n\tprivate httpClient: HTTPClient;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To create a client instance with options and initializes the default middleware chain\r\n\t * @param {Options} options - The options for client instance\r\n\t * @returns The Client instance\r\n\t */\r\n\tpublic static init(options: Options): Client {\r\n\t\tconst clientOptions: ClientOptions = {};\r\n\t\tfor (const i in options) {\r\n\t\t\tif (options.hasOwnProperty(i)) {\r\n\t\t\t\tclientOptions[i] = i === \"authProvider\" ? new CustomAuthenticationProvider(options[i]) : options[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn Client.initWithMiddleware(clientOptions);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To create a client instance with the Client Options\r\n\t * @param {ClientOptions} clientOptions - The options object for initializing the client\r\n\t * @returns The Client instance\r\n\t */\r\n\tpublic static initWithMiddleware(clientOptions: ClientOptions): Client {\r\n\t\ttry {\r\n\t\t\treturn new Client(clientOptions);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @constructor\r\n\t * Creates an instance of Client\r\n\t * @param {ClientOptions} clientOptions - The options to instantiate the client object\r\n\t */\r\n\tprivate constructor(clientOptions: ClientOptions) {\r\n\t\ttry {\r\n\t\t\tvalidatePolyFilling();\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tfor (const key in clientOptions) {\r\n\t\t\tif (clientOptions.hasOwnProperty(key)) {\r\n\t\t\t\tthis.config[key] = clientOptions[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet httpClient: HTTPClient;\r\n\t\tif (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"AmbiguityInInitialization\";\r\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both\";\r\n\t\t\tthrow error;\r\n\t\t} else if (clientOptions.authProvider !== undefined) {\r\n\t\t\thttpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider);\r\n\t\t} else if (clientOptions.middleware !== undefined) {\r\n\t\t\thttpClient = new HTTPClient(...[].concat(clientOptions.middleware));\r\n\t\t} else {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"InvalidMiddlewareChain\";\r\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.httpClient = httpClient;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Entry point to make requests\r\n\t * @param {string} path - The path string value\r\n\t * @returns The graph request instance\r\n\t */\r\n\tpublic api(path: string): GraphRequest {\r\n\t\treturn new GraphRequest(this.httpClient, this.config, path);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @constant\r\n * @function\r\n * Validates availability of Promise and fetch in global context\r\n * @returns The true in case the Promise and fetch available, otherwise throws error\r\n */\r\n\r\nexport const validatePolyFilling = (): boolean => {\r\n\tif (typeof Promise === \"undefined\" && typeof fetch === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without Promise and fetch. So, please provide polyfill for them.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t} else if (typeof Promise === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without Promise. So, please provide polyfill for it.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t} else if (typeof fetch === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without fetch. So, please provide polyfill for it.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t}\r\n\treturn true;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * Get Microsoft graph client.\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: '[\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TokenCredential} credential - token credential instance.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n *\n * @beta\n */\nexport function createMicrosoftGraphClient(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger, AzureLogger } from \"@azure/logger\";\n\n/**\n * The AzureLogger used for all clients within the identity package\n */\nexport const logger = createClientLogger(\"identity\");\n\ninterface EnvironmentAccumulator {\n missing: string[];\n assigned: string[];\n}\n\n/**\n * Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.\n * @param supportedEnvVars - List of environment variable names\n */\nexport function processEnvVars(supportedEnvVars: string[]): EnvironmentAccumulator {\n return supportedEnvVars.reduce(\n (acc: EnvironmentAccumulator, envVariable: string) => {\n if (process.env[envVariable]) {\n acc.assigned.push(envVariable);\n } else {\n acc.missing.push(envVariable);\n }\n return acc;\n },\n { missing: [], assigned: [] }\n );\n}\n\n/**\n * Based on a given list of environment variable names,\n * logs the environment variables currently assigned during the usage of a credential that goes by the given name.\n * @param credentialName - Name of the credential in use\n * @param supportedEnvVars - List of environment variables supported by that credential\n */\nexport function logEnvVars(credentialName: string, supportedEnvVars: string[]): void {\n const { assigned } = processEnvVars(supportedEnvVars);\n logger.info(\n `${credentialName} => Found the following environment variables: ${assigned.join(\", \")}`\n );\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatSuccess(scope: string | string[]): string {\n return `SUCCESS. Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatError(scope: string | string[] | undefined, error: Error | string): string {\n let message = \"ERROR.\";\n if (scope?.length) {\n message += ` Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n }\n return `${message} Error message: ${typeof error === \"string\" ? error : error.message}.`;\n}\n\n/**\n * A CredentialLoggerInstance is a logger properly formatted to work in a credential's constructor, and its methods.\n */\nexport interface CredentialLoggerInstance {\n title: string;\n fullTitle: string;\n info(message: string): void;\n /**\n * The logging functions for warning and error are intentionally left out, since we want the identity logging to be at the info level.\n * Otherwise, they would look like:\n *\n * warning(message: string): void;\n * error(err: Error): void;\n */\n}\n\n/**\n * Generates a CredentialLoggerInstance.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n *\n */\nexport function credentialLoggerInstance(\n title: string,\n parent?: CredentialLoggerInstance,\n log: AzureLogger = logger\n): CredentialLoggerInstance {\n const fullTitle = parent ? `${parent.fullTitle} ${title}` : title;\n\n function info(message: string): void {\n log.info(`${fullTitle} =>`, message);\n }\n\n return {\n title,\n fullTitle,\n info\n };\n}\n\n/**\n * A CredentialLogger is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n */\nexport interface CredentialLogger extends CredentialLoggerInstance {\n getToken: CredentialLoggerInstance;\n}\n\n/**\n * Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n * `[title] => getToken() => [message]`\n *\n */\nexport function credentialLogger(title: string, log: AzureLogger = logger): CredentialLogger {\n const credLogger = credentialLoggerInstance(title, undefined, log);\n return {\n ...credLogger,\n getToken: credentialLoggerInstance(\"=> getToken()\", credLogger, log)\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential } from \"@azure/core-http\";\nimport { TokenCredentialOptions } from \"../../client/identityClient\";\nimport { credentialLogger, formatError } from \"../../util/logging\";\n\nconst BrowserNotSupportedError = new Error(\n \"ManagedIdentityCredential is not supported in the browser.\"\n);\nconst logger = credentialLogger(\"ManagedIdentityCredential\");\n\nexport class ManagedIdentityCredential implements TokenCredential {\n constructor(clientId: string, options?: TokenCredentialOptions);\n constructor(options?: TokenCredentialOptions);\n constructor() {\n logger.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n\n public async getToken(): Promise<AccessToken | null> {\n logger.getToken.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getResourceConfiguration } from \"./configurationProvider\";\nimport { ResourceType } from \"../models/configuration\";\nimport { AccessToken, ManagedIdentityCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { ConnectionConfig } from \"tedious\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * SQL connection configuration instance.\n * @remarks\n * Only works in in server side.\n *\n * @beta\n *\n */\nexport class DefaultTediousConnectionConfiguration {\n /**\n * MSSQL default scope\n * https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi\n */\n private readonly defaultSQLScope: string = \"https://database.windows.net/\";\n\n /**\n * Generate connection configuration consumed by tedious.\n *\n * @returns Connection configuration of tedious for the SQL.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.\n * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async getConfig(): Promise<ConnectionConfig> {\n internalLogger.info(\"Get SQL configuration\");\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n\n if (!configuration) {\n const errMsg = \"SQL resource configuration not exist\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n\n try {\n this.isSQLConfigurationValid(configuration);\n } catch (err) {\n throw err;\n }\n\n if (!this.isMsiAuthentication()) {\n const configWithUPS = this.generateDefaultConfig(configuration);\n internalLogger.verbose(\"SQL configuration with username and password generated\");\n return configWithUPS;\n }\n\n try {\n const configWithToken = await this.generateTokenConfig(configuration);\n internalLogger.verbose(\"SQL configuration with MSI token generated\");\n return configWithToken;\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Check SQL use MSI identity or username and password.\n *\n * @returns false - login with SQL MSI identity, true - login with username and password.\n * @internal\n */\n private isMsiAuthentication(): boolean {\n internalLogger.verbose(\n \"Check connection config using MSI access token or username and password\"\n );\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n if (configuration?.sqlUsername != null && configuration?.sqlPassword != null) {\n internalLogger.verbose(\"Login with username and password\");\n return false;\n }\n internalLogger.verbose(\"Login with MSI identity\");\n return true;\n }\n\n /**\n * check configuration is an available configurations.\n * @param { SqlConfiguration } sqlConfig\n *\n * @returns true - SQL configuration has a valid SQL endpoints, SQL username with password or identity ID.\n * false - configuration is not valid.\n * @internal\n */\n private isSQLConfigurationValid(sqlConfig: SqlConfiguration) {\n internalLogger.verbose(\"Check SQL configuration if valid\");\n if (!sqlConfig.sqlServerEndpoint) {\n internalLogger.error(\"SQL configuration is not valid without SQL server endpoint exist\");\n throw new ErrorWithCode(\n \"SQL configuration error without SQL server endpoint exist\",\n ErrorCode.InvalidConfiguration\n );\n }\n if (!(sqlConfig.sqlUsername && sqlConfig.sqlPassword) && !sqlConfig.sqlIdentityId) {\n const errMsg = `SQL configuration is not valid without ${\n sqlConfig.sqlIdentityId ? \"\" : \"identity id \"\n } ${sqlConfig.sqlUsername ? \"\" : \"SQL username \"} ${\n sqlConfig.sqlPassword ? \"\" : \"SQL password\"\n } exist`;\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n internalLogger.verbose(\"SQL configuration is valid\");\n }\n\n /**\n * Generate tedious connection configuration with default authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with username and password.\n *\n * @returns Tedious connection configuration with username and password.\n * @internal\n */\n private generateDefaultConfig(sqlConfig: SqlConfiguration): ConnectionConfig {\n internalLogger.verbose(\n `SQL server ${sqlConfig.sqlServerEndpoint}, user name ${sqlConfig.sqlUsername}, database name ${sqlConfig.sqlDatabaseName}`\n );\n\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.default,\n options: {\n userName: sqlConfig.sqlUsername,\n password: sqlConfig.sqlPassword,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n return config;\n }\n\n /**\n * Generate tedious connection configuration with azure-active-directory-access-token authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with AAD access token.\n *\n * @returns Tedious connection configuration with access token.\n * @internal\n */\n private async generateTokenConfig(sqlConfig: SqlConfiguration): Promise<ConnectionConfig> {\n internalLogger.verbose(\"Generate tedious config with MSI token\");\n\n let token: AccessToken | null;\n try {\n const credential = new ManagedIdentityCredential(sqlConfig.sqlIdentityId);\n token = await credential.getToken(this.defaultSQLScope);\n } catch (error) {\n const errMsg = \"Get user MSI token failed\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InternalError);\n }\n if (token) {\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.MSI,\n options: {\n token: token.token,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n internalLogger.verbose(\n `Generate token configuration success, server endpoint is ${sqlConfig.sqlServerEndpoint}, database name is ${sqlConfig.sqlDatabaseName}`\n );\n return config;\n }\n internalLogger.error(\n `Generate token configuration, server endpoint is ${sqlConfig.sqlServerEndpoint}, MSI token is not valid`\n );\n throw new ErrorWithCode(\"MSI token is not valid\", ErrorCode.InternalError);\n }\n}\n\n/**\n * tedious connection config authentication type.\n * https://tediousjs.github.io/tedious/api-connection.html\n * @internal\n */\nenum TediousAuthenticationType {\n default = \"default\",\n MSI = \"azure-active-directory-access-token\",\n}\n\n/**\n * Configuration for SQL resource.\n * @internal\n */\ninterface SqlConfiguration {\n /**\n * SQL server endpoint.\n *\n * @readonly\n */\n readonly sqlServerEndpoint: string;\n\n /**\n * SQL server username.\n *\n * @readonly\n */\n readonly sqlUsername: string;\n\n /**\n * SQL server password.\n *\n * @readonly\n */\n readonly sqlPassword: string;\n\n /**\n * SQL server database name.\n *\n * @readonly\n */\n readonly sqlDatabaseName: string;\n\n /**\n * Managed identity id.\n *\n * @readonly\n */\n readonly sqlIdentityId: string;\n}\n"],"names":["ErrorCode","ErrorMessage","ErrorWithCode","Error","[object Object]","message","code","super","Object","setPrototypeOf","this","prototype","name","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__values","o","s","Symbol","iterator","m","i","call","length","TypeError","__read","n","r","ar","push","error","__spread","arguments","concat","InvalidCharacterError","LogLevel","window","atob","bind","input","str","String","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","indexOf","decodeURIComponent","p","charCodeAt","toString","toUpperCase","err","InvalidTokenError","setLogLevel","level","internalLogger","getLogLevel","undefined","verbose","console","debug","info","warn","log","x","Warn","Info","Verbose","logLevel","logFunction","trim","logMessage","Date","toUTCString","customLogger","customLogFunction","defaultLogger","setLogger","logger","setLogFunction","parseJwt","token","tokenObj","options","pos","header","JSON","parse","base64_url_decode","split","jwt_decode","exp","InternalError","errorMsg","formatString","replacements","args","match","number","validateScopesType","Array","isArray","every","item","InvalidParameter","M365TenantCredential","BrowserRuntimeNotSupported","RuntimeNotSupported","scopes","OnBehalfOfUserCredential","ssoToken","Cache","key","sessionStorage","getItem","setItem","removeItem","clear","module","t","exports","l","c","d","defineProperty","enumerable","get","toStringTag","__esModule","create","default","hasOwnProperty","a","Communication","parentMessageQueue","childMessageQueue","nextMessageId","callbacks","Function","parentWindow","id","func","timestamp","now","b","GlobalVars","isFramelessWindow","currentWindow","nativeInterface","framelessPostMessage","stringify","u","C","postMessage","data","source","originalEvent","origin","location","validOriginRegExp","test","toLowerCase","additionalValidOriginsRegexp","closed","childWindow","childOrigin","parentOrigin","h","f","callHandler","v","pop","g","isPartialResponse","shift","T","initializeCommunication","messageListener","parent","self","opener","addEventListener","onNativeMessage","version","uninitializeCommunication","removeEventListener","sendMessageToParent","waitForMessageQueue","setInterval","clearInterval","sendMessageEventToChild","w","ensureInitialized","initializeCalled","frameContext","isAPISupportedByPlatform","defaultSDKVersionForCompatCheck","compareSDKVersions","clientSupportedSDKVersion","isNaN","processAdditionalValidOrigins","additionalValidOrigins","filter","userOriginUrlValidationRegExp","generateRegExpFromUrls","desktop","web","android","ios","rigel","surfaceHub","HostClientType","settings","content","authentication","remove","task","sidePanel","stage","meetingStage","FrameContexts","Standard","Edu","Class","Plc","Staff","TeamType","Admin","User","Guest","UserTeamRole","Large","Medium","Small","TaskModuleDimension","Regular","Private","Shared","ChannelType","handlers","themeChangeHandler","backButtonPressHandler","navigateBack","loadHandler","beforeUnloadHandler","initializeHandlers","themeChange","backButtonPress","load","beforeUnload","registerHandler","removeHandler","registerOnThemeChangeHandler","handleThemeChange","registerBackButtonHandler","registerOnLoadHandler","registerBeforeUnloadHandler","getUserJoinedTeamsSupportedAndroidClientVersion","locationAPIsRequiredVersion","peoplePickerRequiredVersion","captureImageMobileSupportVersion","mediaAPISupportVersion","getMediaCallbackSupportVersion","scanBarCodeAPIMobileSupportVersion","validOrigins","RegExp","getGenericOnCompleteHandler","NaN","Number","generateGUID","v4","initializeCompleted","initializeCallbacks","printCapabilityEnabled","Inline","Desktop","Web","FileOpenPreference","NOT_SUPPORTED_ON_PLATFORM","INTERNAL_ERROR","NOT_SUPPORTED_IN_CURRENT_CONTEXT","PERMISSION_DENIED","NETWORK_ERROR","NO_HW_SUPPORT","INVALID_ARGUMENTS","UNAUTHORIZED_USER_OPERATION","INSUFFICIENT_RESOURCES","THROTTLE","USER_ABORT","OPERATION_TIMED_OUT","OLD_PLATFORM","FILE_NOT_FOUND","SIZE_EXCEEDED","appInitialization","enablePrintCapability","executeDeepLink","getContext","getMruTabInstances","getTabInstances","initialize","initializeWithFrameContext","print","registerChangeSettingsHandler","registerFullScreenHandler","registerAppButtonClickHandler","registerAppButtonHoverEnterHandler","registerAppButtonHoverLeaveHandler","setFrameContext","shareDeepLink","returnFocus","navigateCrossDomain","navigateToTab","tasks","ChildAppWindow","ParentAppWindow","media","meeting","people","crypto","getRandomValues","msCrypto","Uint8Array","Math","random","substr","join","close","hostClientType","successCallback","failureCallback","document","createElement","href","host","search","assign","registerAuthenticationHandlers","authenticate","url","width","height","min","outerWidth","outerHeight","screenLeft","screenX","screenTop","screenY","open","getAuthToken","resources","claims","silent","getUser","notifySuccess","setTimeout","notifyFailure","setValidityState","getSettings","setSettings","registerOnSaveHandler","registerOnRemoveHandler","notified","ensureNotNotified","registerGetLogHandler","logs","initializePrivateApis","menus","getUserJoinedTeams","errorCode","enterFullscreen","exitFullscreen","openFilePreview","entityId","title","description","type","objectUrl","downloadUrl","webPreviewUrl","webEditUrl","baseUrl","editFile","subEntityId","viewerAction","fileOpenPreference","showNotification","notificationType","uploadCustomApp","sendCustomMessage","sendCustomEvent","registerCustomHandler","getChatMembers","getConfigSetting","registerUserSettingsChangeHandler","enabled","selected","MenuItem","dropDown","popOver","MenuListType","setUpViews","setNavBarMenu","showActionMenu","_instance","configurable","__extends","__proto__","constructor","Base64","ID","FileFormat","File","captureImage","format","mimeType","preview","size","getMedia","validateGetMediaInputs","getMediaViaCallback","getMediaViaHandler","mediaMimeType","assembleAttachment","mediaChunk","chunkSequence","createFile","decodeAttachment","Media","Photo","Document","Whiteboard","BusinessCard","CameraStartMode","Camera","Gallery","Source","Image","Audio","MediaType","URL","ImageUriType","selectMedia","validateSelectMediaInputs","viewImages","validateViewImagesInput","scanBarCode","validateScanBarCodeInput","sort","sequence","forEach","Blob","file","chunk","maxMediaCount","timeOutIntervalInSec","validatePeoplePickerInput","setSelected","openOrgWideSearchInChatOrChannel","singleSelect","bot","NotificationTypes","ViewerActionTypes","UserSettingTypes","conversations","meetingRoom","remoteCamera","files","appEntity","sendQuery","getSupportedCommands","Results","Auth","ResponseType","v1","node","clockseq","msecs","getTime","nsecs","rng","Messages","AppLoaded","Success","Failure","ExpectedFailure","AuthFailed","Timeout","Other","FailedReason","PermissionError","NotFound","Throttling","Offline","ExpectedFailureReason","notifyAppLoaded","reason","notifyExpectedFailure","_uninitialize","_initialize","ctrlKey","metaKey","keyCode","cancelBubble","preventDefault","stopImmediatePropagation","subEntityLabel","subEntityWebUrl","__rest","getOwnPropertySymbols","startTask","updateTask","keys","submitTask","getLocation","showLocation","Unknown","Adhoc","Scheduled","Recurring","Broadcast","MeetNow","MeetingType","getIncomingClientAudioState","toggleIncomingClientAudio","getMeetingDetails","getAuthenticationTokenForAnonymousUser","getLiveStreamState","requestStartLiveStreaming","requestStopLiveStreaming","registerLiveStreamChangedHandler","selectPeople","fileDownloadStart","fileDownloadComplete","view","edit","editNew","theme","openConversation","conversationId","channelId","onStartConversation","onCloseConversation","closeConversation","toggleMute","toggleCamera","toggleCaptions","volume","showVideoGallery","showContent","showVideoGalleryAndContent","showLargeGallery","showTogether","leaveMeeting","Capability","getPairedMeetingRoomInfo","sendCommandToPairedMeetingRoom","registerMeetingRoomCapabilitiesUpdateHandler","registerMeetingRoomStatesUpdateHandler","Reset","ZoomIn","ZoomOut","PanLeft","PanRight","TiltUp","TiltDown","ControlCommand","CommandResetError","CommandZoomInError","CommandZoomOutError","CommandPanLeftError","CommandPanRightError","CommandTiltUpError","CommandTiltDownError","SendDataError","ErrorReason","None","ControlDenied","ControlNoResponse","ControlBusy","AckTimeout","ControlTerminated","ControllerTerminated","DataChannelError","ControllerCancelled","ControlDisabled","SessionTerminatedReason","getCapableParticipants","requestControl","sendControlCommand","terminateSession","registerOnCapableParticipantsChangeHandler","registerOnErrorHandler","registerOnDeviceStateChangeHandler","registerOnSessionStatusChangeHandler","Dropbox","Box","Sharefile","GoogleDrive","Egnyte","CloudStorageProvider","Sharepoint","WopiIntegration","Google","CloudStorageProviderType","getCloudStorageFolders","addCloudStorageFolder","deleteCloudStorageFolder","getCloudStorageFolderContents","isSubdirectory","openCloudStorageFile","selectAppEntity","isNode","process","versions","enabledString","debugEnvVariable","env","DEBUG","enabledNamespaces","skippedNamespaces","debuggers","enable","debugObj","namespace","createDebugger","disable","_i","firstArg","includes","namespaces","wildcard","namespaceList","map","ns","namespaceList_1","startsWith","debuggers_1","instance","endsWith","skippedNamespaces_1","enabledNamespaces_1","newDebugger","destroy","extend","index","splice","azureLogLevel","registeredLoggers","Set","logLevelFromEnv","AZURE_LOG_LEVEL","AzureLogger","AZURE_LOG_LEVELS","isAzureLogLevel","registeredLoggers_1","shouldEnable","ResourceType","levelMap","warning","patchLogMethod","child","createLogger","add","config","loadConfiguration","configuration","newAuthentication","newResources","authorityHost","M365_AUTHORITY_HOST","tenantId","M365_TENANT_ID","clientId","M365_CLIENT_ID","clientSecret","M365_CLIENT_SECRET","simpleAuthEndpoint","SIMPLE_AUTH_ENDPOINT","initiateLoginEndpoint","INITIATE_LOGIN_ENDPOINT","applicationIdUri","M365_APPLICATION_ID_URI","SQL","properties","sqlServerEndpoint","SQL_ENDPOINT","sqlUsername","SQL_USER_NAME","sqlPassword","SQL_PASSWORD","sqlDatabaseName","SQL_DATABASE_NAME","sqlIdentityId","IDENTITY_ID","API","endpoint","API_ENDPOINT","getResourceConfiguration","resourceType","resourceName","find","MissingResourceConfiguration","InvalidConfiguration","getAuthenticationConfiguration","ConfigurationNotExists","fn","val","isUndefined","isObject","isPlainObject","getPrototypeOf","isFunction","obj","isArrayBuffer","isBuffer","isFormData","FormData","isArrayBufferView","ArrayBuffer","isView","isString","isNumber","isDate","isFile","isBlob","isStream","pipe","isURLSearchParams","URLSearchParams","isStandardBrowserEnv","navigator","product","merge","assignValue","slice","stripBOM","encode","encodeURIComponent","params","paramsSerializer","serializedParams","utils","parts","toISOString","hashmarkIndex","InterceptorManager","use","eject","headers","fns","__CANCEL__","normalizedName","request","response","isAxiosError","toJSON","fileName","lineNumber","columnNumber","stack","enhanceError","write","expires","path","domain","secure","cookie","toGMTString","read","ignoreDuplicateOf","originURL","msie","userAgent","urlParsingNode","resolveURL","setAttribute","protocol","hash","hostname","port","pathname","requestURL","parsed","requestData","requestHeaders","XMLHttpRequest","auth","username","password","unescape","Authorization","btoa","baseURL","requestedURL","fullPath","relativeURL","combineURLs","method","buildURL","timeout","onreadystatechange","readyState","status","responseURL","responseHeaders","getAllResponseHeaders","line","responseType","responseText","statusText","validateStatus","createError","settle","onabort","onerror","ontimeout","timeoutErrorMessage","xsrfValue","withCredentials","isURLSameOrigin","xsrfCookieName","cookies","xsrfHeaderName","setRequestHeader","onDownloadProgress","onUploadProgress","upload","cancelToken","promise","cancel","abort","send","DEFAULT_CONTENT_TYPE","Content-Type","setContentTypeIfUnset","adapter","defaults","require$$0","transformRequest","normalizeHeaderName","transformResponse","maxContentLength","maxBodyLength","common","Accept","throwIfCancellationRequested","throwIfRequested","transformData","isCancel","config1","config2","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","getMergedValue","target","mergeDeepProperties","prop","axiosKeys","otherKeys","Axios","instanceConfig","interceptors","mergeConfig","chain","dispatchRequest","interceptor","unshift","getUri","Cancel","CancelToken","executor","resolvePromise","createInstance","defaultConfig","context","axios","require$$1","require$$2","all","promises","spread","callback","arr","payload","GrantType","accessTokenCacheKeyPrefix","TeamsUserCredential","loadAndValidateConfig","scopesStr","microsoftTeams.initialize","microsoftTeams.authentication","encodeURI","authCodeResult","exchangeAccessTokenFromSimpleAuthServer","generateAuthServerError","ConsentFailed","getSSOToken","scopeStr","cachedKey","getAccessTokenCacheKey","cachedToken","getTokenCache","isAccessTokenNearExpired","getAndCacheAccessTokenFromSimpleAuthServer","tokenObject","userInfo","displayName","objectId","oid","preferredUserName","ver","preferred_username","upn","getUserInfoFromSsoToken","axiosInstance","getAxiosInstance","retryCount","tokenResult","post","scope","code_verifier","codeVerifier","redirect_uri","redirectUri","grant_type","authCode","setTokenCache","access_token","expiresOnTimestamp","expires_on","sleep","accessTokenResult","accessToken","cacheKey","initialized","errMessage","AuthenticationConfigurationNotExists","missingValues","set","validateAndParseJson","jsonValue","parsedJson","ssoTokenObj","userObjectId","tid","errorMessage","detail","fullErrorMsg","UiRequiredError","ServiceError","ms","MsGraphAuthProvider","credential","getToken","TeamsBotSsoPrompt","dialogId","dc","RequestMethod","MiddlewareControl","middlewareOptions","Map","option","getRequestHeader","Request","Headers","appendRequestHeader","append","AuthenticationHandlerOptions","authenticationProvider","authenticationProviderOptions","FeatureUsageFlag","TelemetryHandlerOptions","NONE","flag","middlewareControl","getMiddlewareOptions","setMiddlewareOptions","setFeatureUsage","featureUsage","AuthenticationHandler","bearerKey","getAccessToken","AUTHORIZATION_HEADER","updateFeatureUsageFlag","AUTHENTICATION_HANDLER_ENABLED","nextMiddleware","execute","HTTPMessageHandler","fetch","RetryHandlerOptions","delay","DEFAULT_DELAY","maxRetries","DEFAULT_MAX_RETRIES","shouldRetry","DEFAULT_SHOULD_RETRY","MAX_DELAY","MAX_MAX_RETRIES","RetryHandler","RETRY_STATUS_CODES","PUT","PATCH","POST","retryAttempts","getRandomness","toFixed","retryAfter","RETRY_AFTER_HEADER","newDelay","round","getExponentialBackOffTime","getMaxDelay","attempts","delaySeconds","delayMilliseconds","isRetry","isBuffered","RETRY_ATTEMPT_HEADER","getDelay","executeWithRetry","getOptions","RETRY_HANDLER_ENABLED","RedirectHandlerOptions","maxRedirects","DEFAULT_MAX_REDIRECTS","shouldRedirect","MAX_MAX_REDIRECTS","RedirectHandler","REDIRECT_STATUS_CODES","has","LOCATION_HEADER","requestUrl","redirectUrl","schemeHostRegex","requestMatches","exec","requestAuthority","redirectAuthority","redirectMatches","newUrl","body","blob","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive","signal","redirectCount","isRedirect","hasLocationHeader","STATUS_CODE_SEE_OTHER","GET","getLocationHeader","isRelativeURL","shouldDropAuthorizationHeader","updateRequestUrl","executeWithRedirect","MANUAL_REDIRECT","REDIRECT_HANDLER_ENABLED","GRAPH_URLS","oDataQueryNames","serializeContent","className","Buffer","from","TelemetryHandler","startofPortNoPos","endOfHostStrPos","hostName","substring","isGraphURL","clientRequestId","CLIENT_REQUEST_ID_HEADER","uuid","j","floor","generateUUID","sdkVersionValue","PRODUCT_NAME","getFeatureUsage","FEATURE_USAGE_STRING","SDK_VERSION_HEADER","ChaosStrategy","DocumentType","ContentType","ContentTypeRegexStr","CustomAuthenticationProvider","provider","GraphError","statusCode","baseError","requestId","date","GraphErrorHandler","gError","innerError","constructErrorFromResponse","constructError","GraphResponseHandler","rawResponse","DOMParser","text","xmlString","xmlDoc","parseFromString","responseValue","ARRAYBUFFER","arrayBuffer","BLOB","DOCUMENT","parseDocumentResponse","TEXT_XML","json","STREAM","TEXT","contentType","IMAGE","TEXT_PLAIN","APPLICATION_JSON","RAW","convertResponse","ok","GraphRequest","httpClient","urlComponents","endOfVersionStrPos","queryStrPos","queryParams","queryParam","parseQueryParameter","defaultVersion","oDataQueryParams","otherURLQueryParams","otherURLQueryOptions","_headers","_options","_middlewareOptions","parsePath","propertyName","propertyValue","additionalProperties","allValues","urlSegments","removePreSlash","reduce","pre","cur","urlJoin","createQueryString","debugLogging","query","property","queryDictionaryOrString","parseQueryParamenterString","setURLComponentsQueryParamater","queryParameter","isValidQueryKeyValuePair","indexOfFirstEquals","paramKey","paramValue","currentValue","isValueAppendable","queryString","indexofFirstEquals","optionsHeaders","fetchOptions","updateRequestOptions","sendRequest","getResponse","_responseType","getError","headerKeys","headerKey","headerValue","addCsvQueryParameter","filterStr","$filter","searchStr","$search","$top","$skip","$skipToken","isCount","$count","buildFullUrl","setHeaderContentType","patch","DELETE","delete","stream","HTTPClient","middleware","setMiddleware","parseMiddleWareArray","middlewareArray","element","setNext","HTTPClientFactory","authProvider","authenticationHandler","retryHandler","telemetryHandler","httpMessageHandler","require","redirectHandler","createWithMiddleware","Client","clientOptions","validatePolyFilling","createWithAuthenticationProvider","initWithMiddleware","createMicrosoftGraphClient","clientRootLogger","formatError","credentialLoggerInstance","fullTitle","BrowserNotSupportedError","credLogger","credentialLogger","ManagedIdentityCredential","DefaultTediousConnectionConfiguration","errMsg","isSQLConfigurationValid","isMsiAuthentication","configWithUPS","generateDefaultConfig","configWithToken","generateTokenConfig","sqlConfig","server","TediousAuthenticationType","userName","database","encrypt","defaultSQLScope","MSI"],"mappings":"IAOYA,GAAZ,SAAYA,GAIVA,sCAKAA,8CAKAA,gCAKAA,4CAKAA,4CAKAA,gCAKAA,oCAKAA,wCAKAA,8BAKAA,oCAjDF,CAAYA,IAAAA,aAuDCC,GAEKA,uBAAuB,wCACvBA,yBAAyB,oCACzBA,iCAAiC,6CACjCA,+BACd,4DACcA,uCACd,+CAGcA,6BAA6B,mCAC7BA,4BAA4B,gCAG5BA,mCACd,wDAGcA,8BAA8B,kDAQnCC,sBAAsBC,MAgBjCC,YAAYC,EAAkBC,GACvBA,GAKLC,MAAMF,GACNG,OAAOC,eAAeC,KAAMR,cAAcS,WAC1CD,KAAKE,KAAO,cAAcA,Q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oC,QAAS,CACPF,MAAOA,EAAMA,QAGjBE,QAAS,CACPooC,SAAUJ,EAAUhiB,gBACpBqiB,SAAS,IAMb,OAHAjqC,EAAeG,QACb,4DAA4DypC,EAAUtiB,uCAAuCsiB,EAAUhiB,mBAElH3B,EAKT,MAHAjmB,EAAe9B,MACb,oDAAoD0rC,EAAUtiB,6CAE1D,IAAIhsB,cAAc,yBAA0BF,EAAUiH,mBAShE,IAAKynC,IAAL,SAAKA,GACHA,oBACAA,4CAFF,CAAKA,KAAAA"}
|
|
1
|
+
{"version":3,"file":"teamsfx.js","sources":["../src/core/errors.ts","../node_modules/tslib/tslib.es6.js","../node_modules/jwt-decode/lib/atob.js","../src/util/logger.ts","../node_modules/jwt-decode/lib/base64_url_decode.js","../node_modules/jwt-decode/lib/index.js","../src/util/utils.ts","../src/credential/m365TenantCredential.browser.ts","../src/credential/onBehalfOfUserCredential.browser.ts","../src/core/cache.browser.ts","../node_modules/@microsoft/teams-js/dist/MicrosoftTeams.min.js","../node_modules/@azure/core-http/src/util/utils.ts","../node_modules/@azure/logger/src/debug.ts","../node_modules/@azure/logger/src/log.browser.ts","../node_modules/@azure/logger/src/index.ts","../src/models/configuration.ts","../src/core/configurationProvider.ts","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/helpers/normalizeHeaderName.js","../node_modules/axios/lib/core/createError.js","../node_modules/axios/lib/core/enhanceError.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/defaults.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/Cancel.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/axios.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/axios/index.js","../src/models/grantType.ts","../src/credential/teamsUserCredential.browser.ts","../src/core/msGraphAuthProvider.ts","../src/bot/teamsBotSsoPrompt.browser.ts","../node_modules/@microsoft/microsoft-graph-client/node_modules/tslib/tslib.es6.js","../node_modules/@microsoft/microsoft-graph-client/src/RequestMethod.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareControl.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareUtil.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/AuthenticationHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/TelemetryHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/AuthenticationHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/HTTPMessageHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RetryHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/RetryHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RedirectHandlerOptions.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/RedirectHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/Constants.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphRequestUtil.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/TelemetryHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/middleware/options/ChaosStrategy.ts","../node_modules/@microsoft/microsoft-graph-client/src/ResponseType.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphResponseHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/CustomAuthenticationProvider.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts","../node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts","../node_modules/@microsoft/microsoft-graph-client/src/HTTPClient.ts","../node_modules/@microsoft/microsoft-graph-client/src/HTTPClientFactory.ts","../node_modules/@microsoft/microsoft-graph-client/src/Client.ts","../node_modules/@microsoft/microsoft-graph-client/src/ValidatePolyFilling.ts","../src/core/msGraphClientProvider.ts","../node_modules/@azure/identity/src/util/logging.ts","../node_modules/@azure/identity/src/credentials/managedIdentityCredential/index.browser.ts","../src/core/defaultTediousConnectionConfiguration.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n *\n * @beta\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = \"InvalidCharacterError\";\n\nfunction polyfill(input) {\n var str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\n \"'atob' failed: The string to be decoded is not correctly encoded.\"\n );\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\nexport default (typeof window !== \"undefined\" &&\n window.atob &&\n window.atob.bind(window)) ||\npolyfill;","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n * @beta\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nclass InternalLogger {\n public level?: LogLevel = undefined;\n\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n const logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n *\n * @beta\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n *\n * @beta\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","import atob from \"./atob\";\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(\n atob(str).replace(/(.)/g, function(m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n })\n );\n}\n\nexport default function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try {\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n}","\"use strict\";\n\nimport base64_url_decode from \"./base64_url_decode\";\n\nexport function InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\n\nexport default function(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified\");\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split(\".\")[pos]));\n } catch (e) {\n throw new InvalidTokenError(\"Invalid token specified: \" + e.message);\n }\n}","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj = jwt_decode(token) as SSOTokenInfoBase;\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err: any) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved.\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport class M365TenantCredential implements TokenCredential {\n /**\n * Constructor of M365TenantCredential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n constructor() {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"M365TenantCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"M365TenantCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in Azure Function or Bot scenarios.\n *\n * @remarks\n * Can only be used in server side.\n *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n * @beta\n */\n constructor(ssoToken: string) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration used in initialization.\n * @internal\n */\nclass Cache {\n public static get(key: string): string | null {\n return sessionStorage.getItem(key);\n }\n\n public static set(key: string, value: string): void {\n sessionStorage.setItem(key, value);\n }\n\n public static remove(key: string): void {\n sessionStorage.removeItem(key);\n }\n\n public static clear(): void {\n sessionStorage.clear();\n }\n}\n\nexport { Cache };\n","!function(e,n){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=n():\"function\"==typeof define&&define.amd?define(\"microsoftTeams\",[],n):\"object\"==typeof exports?exports.microsoftTeams=n():e.microsoftTeams=n()}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&\"object\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&n&&\"string\"!=typeof e)for(var i in e)t.d(r,i,function(n){return e[n]}.bind(null,i));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,\"a\",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p=\"\",t(t.s=19)}([function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(4),i=t(6),o=t(3),a=function(){return function(){}}();n.Communication=a;var s=function(){function e(){}return e.parentMessageQueue=[],e.childMessageQueue=[],e.nextMessageId=0,e.callbacks={},e}();function l(e,n,t){var r;n instanceof Function?t=n:n instanceof Array&&(r=n);var o=a.parentWindow,l=b(e,r);if(i.GlobalVars.isFramelessWindow)a.currentWindow&&a.currentWindow.nativeInterface&&a.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(l));else{var u=C(o);o&&u?o.postMessage(l,u):p(o).push(l)}t&&(s.callbacks[l.id]=t)}function u(e){if(e&&e.data&&\"object\"==typeof e.data){var n=e.source||e.originalEvent&&e.originalEvent.source,t=e.origin||e.originalEvent&&e.originalEvent.origin;d(n,t)&&(c(n,t),n===a.parentWindow?f(e):n===a.childWindow&&g(e))}}function d(e,n){return(!a.currentWindow||e!==a.currentWindow)&&(!!(a.currentWindow&&a.currentWindow.location&&n&&n===a.currentWindow.location.origin)||!!(r.validOriginRegExp.test(n.toLowerCase())||i.GlobalVars.additionalValidOriginsRegexp&&i.GlobalVars.additionalValidOriginsRegexp.test(n.toLowerCase())))}function c(e,n){i.GlobalVars.isFramelessWindow||a.parentWindow&&!a.parentWindow.closed&&e!==a.parentWindow?a.childWindow&&!a.childWindow.closed&&e!==a.childWindow||(a.childWindow=e,a.childOrigin=n):(a.parentWindow=e,a.parentOrigin=n),a.parentWindow&&a.parentWindow.closed&&(a.parentWindow=null,a.parentOrigin=null),a.childWindow&&a.childWindow.closed&&(a.childWindow=null,a.childOrigin=null),h(a.parentWindow),h(a.childWindow)}function f(e){if(\"id\"in e.data&&\"number\"==typeof e.data.id){var n=e.data,t=s.callbacks[n.id];t&&(t.apply(null,n.args.concat([n.isPartialResponse])),m(e)||delete s.callbacks[n.id])}else if(\"func\"in e.data&&\"string\"==typeof e.data.func){n=e.data;o.callHandler(n.func,n.args)}}function m(e){return!0===e.data.isPartialResponse}function g(e){if(\"id\"in e.data&&\"func\"in e.data){var n=e.data,t=o.callHandler(n.func,n.args),r=t[0],i=t[1];r&&void 0!==i?v(n.id,Array.isArray(i)?i:[i]):l(n.func,n.args,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(a.childWindow){var r=e.pop();v(n.id,e,r)}})}}function p(e){return e===a.parentWindow?s.parentMessageQueue:e===a.childWindow?s.childMessageQueue:[]}function C(e){return e===a.parentWindow?a.parentOrigin:e===a.childWindow?a.childOrigin:null}function h(e){for(var n=C(e),t=p(e);e&&n&&t.length>0;)e.postMessage(t.shift(),n)}function v(e,n,t){var r=a.childWindow,i=T(e,n,t),o=C(r);r&&o&&r.postMessage(i,o)}function b(e,n){return{id:s.nextMessageId++,func:e,timestamp:Date.now(),args:n||[]}}function T(e,n,t){return{id:e,args:n||[],isPartialResponse:t}}function w(e,n){return{func:e,args:n||[]}}n.initializeCommunication=function(e,n){s.messageListener=function(e){return u(e)},a.currentWindow=a.currentWindow||window,a.parentWindow=a.currentWindow.parent!==a.currentWindow.self?a.currentWindow.parent:a.currentWindow.opener,(a.parentWindow||n)&&a.currentWindow.addEventListener(\"message\",s.messageListener,!1),a.parentWindow||(i.GlobalVars.isFramelessWindow=!0,window.onNativeMessage=f);try{a.parentOrigin=\"*\",l(\"initialize\",[r.version],e)}finally{a.parentOrigin=null}},n.uninitializeCommunication=function(){a.currentWindow.removeEventListener(\"message\",s.messageListener,!1),a.parentWindow=null,a.parentOrigin=null,a.childWindow=null,a.childOrigin=null,s.parentMessageQueue=[],s.childMessageQueue=[],s.nextMessageId=0,s.callbacks={}},n.sendMessageToParent=l,n.waitForMessageQueue=function(e,n){var t=a.currentWindow.setInterval(function(){0===p(e).length&&(clearInterval(t),n())},100)},n.sendMessageEventToChild=function(e,n){var t=a.childWindow,r=w(e,n),i=C(t);t&&i?t.postMessage(r,i):p(t).push(r)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(4),i=t(6),o=t(5);n.ensureInitialized=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i.GlobalVars.initializeCalled)throw new Error(\"The library has not yet been initialized\");if(i.GlobalVars.frameContext&&e&&e.length>0){for(var t=!1,r=0;r<e.length;r++)if(e[r]===i.GlobalVars.frameContext){t=!0;break}if(!t)throw new Error(\"This call is not allowed in the '\"+i.GlobalVars.frameContext+\"' context\")}},n.isAPISupportedByPlatform=function(e){void 0===e&&(e=r.defaultSDKVersionForCompatCheck);var n=o.compareSDKVersions(i.GlobalVars.clientSupportedSDKVersion,e);return!isNaN(n)&&n>=0},n.processAdditionalValidOrigins=function(e){var n=i.GlobalVars.additionalValidOrigins.concat(e.filter(function(e){return\"string\"==typeof e&&r.userOriginUrlValidationRegExp.test(e)})),t={};n=n.filter(function(e){return!t[e]&&(t[e]=!0,!0)}),i.GlobalVars.additionalValidOrigins=n,i.GlobalVars.additionalValidOrigins.length>0?i.GlobalVars.additionalValidOriginsRegexp=o.generateRegExpFromUrls(i.GlobalVars.additionalValidOrigins):i.GlobalVars.additionalValidOriginsRegexp=null}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.desktop=\"desktop\",e.web=\"web\",e.android=\"android\",e.ios=\"ios\",e.rigel=\"rigel\",e.surfaceHub=\"surfaceHub\"}(n.HostClientType||(n.HostClientType={})),function(e){e.settings=\"settings\",e.content=\"content\",e.authentication=\"authentication\",e.remove=\"remove\",e.task=\"task\",e.sidePanel=\"sidePanel\",e.stage=\"stage\",e.meetingStage=\"meetingStage\"}(n.FrameContexts||(n.FrameContexts={})),function(e){e[e.Standard=0]=\"Standard\",e[e.Edu=1]=\"Edu\",e[e.Class=2]=\"Class\",e[e.Plc=3]=\"Plc\",e[e.Staff=4]=\"Staff\"}(n.TeamType||(n.TeamType={})),function(e){e[e.Admin=0]=\"Admin\",e[e.User=1]=\"User\",e[e.Guest=2]=\"Guest\"}(n.UserTeamRole||(n.UserTeamRole={})),function(e){e.Large=\"large\",e.Medium=\"medium\",e.Small=\"small\"}(n.TaskModuleDimension||(n.TaskModuleDimension={})),function(e){e.Regular=\"Regular\",e.Private=\"Private\",e.Shared=\"Shared\"}(n.ChannelType||(n.ChannelType={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(8),i=t(0),o=function(){function e(){}return e.handlers={},e}();function a(e){o.themeChangeHandler&&o.themeChangeHandler(e),i.Communication.childWindow&&i.sendMessageEventToChild(\"themeChange\",[e])}function s(){o.backButtonPressHandler&&o.backButtonPressHandler()||r.navigateBack()}function l(e){o.loadHandler&&o.loadHandler(e),i.Communication.childWindow&&i.sendMessageEventToChild(\"load\",[e])}function u(){var e=function(){i.sendMessageToParent(\"readyToUnload\",[])};o.beforeUnloadHandler&&o.beforeUnloadHandler(e)||e()}n.initializeHandlers=function(){o.handlers.themeChange=a,o.handlers.backButtonPress=s,o.handlers.load=l,o.handlers.beforeUnload=u},n.callHandler=function(e,n){var t=o.handlers[e];return t?[!0,t.apply(this,n)]:[!1,void 0]},n.registerHandler=function(e,n,t,r){void 0===t&&(t=!0),void 0===r&&(r=[]),n?(o.handlers[e]=n,t&&i.sendMessageToParent(\"registerHandler\",[e].concat(r))):delete o.handlers[e]},n.removeHandler=function(e){delete o.handlers[e]},n.registerOnThemeChangeHandler=function(e){o.themeChangeHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"themeChange\"])},n.handleThemeChange=a,n.registerBackButtonHandler=function(e){o.backButtonPressHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"backButton\"])},n.registerOnLoadHandler=function(e){o.loadHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"load\"])},n.registerBeforeUnloadHandler=function(e){o.beforeUnloadHandler=e,e&&i.sendMessageToParent(\"registerHandler\",[\"beforeUnload\"])}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(5);n.version=\"1.10.0\",n.defaultSDKVersionForCompatCheck=\"1.6.0\",n.getUserJoinedTeamsSupportedAndroidClientVersion=\"2.0.1\",n.locationAPIsRequiredVersion=\"1.9.0\",n.peoplePickerRequiredVersion=\"2.0.0\",n.captureImageMobileSupportVersion=\"1.7.0\",n.mediaAPISupportVersion=\"1.8.0\",n.getMediaCallbackSupportVersion=\"2.0.0\",n.scanBarCodeAPIMobileSupportVersion=\"1.9.0\",n.validOrigins=[\"https://teams.microsoft.com\",\"https://teams.microsoft.us\",\"https://gov.teams.microsoft.us\",\"https://dod.teams.microsoft.us\",\"https://int.teams.microsoft.com\",\"https://teams.live.com\",\"https://devspaces.skype.com\",\"https://ssauth.skype.com\",\"https://local.teams.live.com\",\"https://local.teams.live.com:8080\",\"https://local.teams.office.com\",\"https://local.teams.office.com:8080\",\"https://msft.spoppe.com\",\"https://*.sharepoint.com\",\"https://*.sharepoint-df.com\",\"https://*.sharepointonline.com\",\"https://outlook.office.com\",\"https://outlook-sdf.office.com\",\"https://*.teams.microsoft.com\",\"https://www.office.com\",\"https://word.office.com\",\"https://excel.office.com\",\"https://powerpoint.office.com\",\"https://www.officeppe.com\",\"https://*.www.office.com\"],n.validOriginRegExp=r.generateRegExpFromUrls(n.validOrigins),n.userOriginUrlValidationRegExp=/^https\\:\\/\\//},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(22);function i(e){for(var n=\"^\",t=e.split(\".\"),r=0;r<t.length;r++)n+=(r>0?\"[.]\":\"\")+t[r].replace(\"*\",\"[^/^.]+\");return n+=\"$\"}n.generateRegExpFromUrls=function(e){for(var n=\"\",t=0;t<e.length;t++)n+=(0===t?\"\":\"|\")+i(e[t]);return new RegExp(n)},n.getGenericOnCompleteHandler=function(e){return function(n,t){if(!n)throw new Error(e||t)}},n.compareSDKVersions=function(e,n){if(\"string\"!=typeof e||\"string\"!=typeof n)return NaN;var t=e.split(\".\"),r=n.split(\".\");function i(e){return/^\\d+$/.test(e)}if(!t.every(i)||!r.every(i))return NaN;for(;t.length<r.length;)t.push(\"0\");for(;r.length<t.length;)r.push(\"0\");for(var o=0;o<t.length;++o)if(Number(t[o])!=Number(r[o]))return Number(t[o])>Number(r[o])?1:-1;return 0},n.generateGUID=function(){return r.v4()}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=function(){function e(){}return e.initializeCalled=!1,e.initializeCompleted=!1,e.additionalValidOrigins=[],e.additionalValidOriginsRegexp=null,e.initializeCallbacks=[],e.isFramelessWindow=!1,e.printCapabilityEnabled=!1,e}();n.GlobalVars=r},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.Inline=\"inline\",e.Desktop=\"desktop\",e.Web=\"web\"}(n.FileOpenPreference||(n.FileOpenPreference={})),function(e){e[e.NOT_SUPPORTED_ON_PLATFORM=100]=\"NOT_SUPPORTED_ON_PLATFORM\",e[e.INTERNAL_ERROR=500]=\"INTERNAL_ERROR\",e[e.NOT_SUPPORTED_IN_CURRENT_CONTEXT=501]=\"NOT_SUPPORTED_IN_CURRENT_CONTEXT\",e[e.PERMISSION_DENIED=1e3]=\"PERMISSION_DENIED\",e[e.NETWORK_ERROR=2e3]=\"NETWORK_ERROR\",e[e.NO_HW_SUPPORT=3e3]=\"NO_HW_SUPPORT\",e[e.INVALID_ARGUMENTS=4e3]=\"INVALID_ARGUMENTS\",e[e.UNAUTHORIZED_USER_OPERATION=5e3]=\"UNAUTHORIZED_USER_OPERATION\",e[e.INSUFFICIENT_RESOURCES=6e3]=\"INSUFFICIENT_RESOURCES\",e[e.THROTTLE=7e3]=\"THROTTLE\",e[e.USER_ABORT=8e3]=\"USER_ABORT\",e[e.OPERATION_TIMED_OUT=8001]=\"OPERATION_TIMED_OUT\",e[e.OLD_PLATFORM=9e3]=\"OLD_PLATFORM\",e[e.FILE_NOT_FOUND=404]=\"FILE_NOT_FOUND\",e[e.SIZE_EXCEEDED=1e4]=\"SIZE_EXCEEDED\"}(n.ErrorCode||(n.ErrorCode={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(25);n.appInitialization=r.appInitialization;var i=t(11);n.authentication=i.authentication;var o=t(2);n.FrameContexts=o.FrameContexts,n.HostClientType=o.HostClientType,n.TaskModuleDimension=o.TaskModuleDimension,n.TeamType=o.TeamType,n.UserTeamRole=o.UserTeamRole,n.ChannelType=o.ChannelType;var a=t(7);n.ErrorCode=a.ErrorCode,n.FileOpenPreference=a.FileOpenPreference;var s=t(26);n.enablePrintCapability=s.enablePrintCapability,n.executeDeepLink=s.executeDeepLink,n.getContext=s.getContext,n.getMruTabInstances=s.getMruTabInstances,n.getTabInstances=s.getTabInstances,n.initialize=s.initialize,n.initializeWithFrameContext=s.initializeWithFrameContext,n.print=s.print,n.registerBackButtonHandler=s.registerBackButtonHandler,n.registerBeforeUnloadHandler=s.registerBeforeUnloadHandler,n.registerChangeSettingsHandler=s.registerChangeSettingsHandler,n.registerFullScreenHandler=s.registerFullScreenHandler,n.registerOnLoadHandler=s.registerOnLoadHandler,n.registerOnThemeChangeHandler=s.registerOnThemeChangeHandler,n.registerAppButtonClickHandler=s.registerAppButtonClickHandler,n.registerAppButtonHoverEnterHandler=s.registerAppButtonHoverEnterHandler,n.registerAppButtonHoverLeaveHandler=s.registerAppButtonHoverLeaveHandler,n.setFrameContext=s.setFrameContext,n.shareDeepLink=s.shareDeepLink;var l=t(27);n.returnFocus=l.returnFocus,n.navigateBack=l.navigateBack,n.navigateCrossDomain=l.navigateCrossDomain,n.navigateToTab=l.navigateToTab;var u=t(12);n.settings=u.settings;var d=t(28);n.tasks=d.tasks;var c=t(16);n.ChildAppWindow=c.ChildAppWindow,n.ParentAppWindow=c.ParentAppWindow;var f=t(17);n.media=f.media;var m=t(29);n.location=m.location;var g=t(30);n.meeting=g.meeting;var p=t(31);n.people=p.people},function(e,n){var t=\"undefined\"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||\"undefined\"!=typeof msCrypto&&\"function\"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,n=0;n<16;n++)0==(3&n)&&(e=4294967296*Math.random()),i[n]=e>>>((3&n)<<3)&255;return i}}},function(e,n){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,i=t;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],\"-\",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join(\"\")}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(6),o=t(2),a=t(0),s=t(3);!function(e){var n,t;function l(){d();try{a.Communication.childWindow&&a.Communication.childWindow.close()}finally{a.Communication.childWindow=null,a.Communication.childOrigin=null}}function u(e){n=e,l();var t=n.width||600,r=n.height||400;t=Math.min(t,a.Communication.currentWindow.outerWidth-400),r=Math.min(r,a.Communication.currentWindow.outerHeight-200);var i=document.createElement(\"a\");i.href=n.url;var o=void 0!==a.Communication.currentWindow.screenLeft?a.Communication.currentWindow.screenLeft:a.Communication.currentWindow.screenX,s=void 0!==a.Communication.currentWindow.screenTop?a.Communication.currentWindow.screenTop:a.Communication.currentWindow.screenY;o+=a.Communication.currentWindow.outerWidth/2-t/2,s+=a.Communication.currentWindow.outerHeight/2-r/2,a.Communication.childWindow=a.Communication.currentWindow.open(i.href,\"_blank\",\"toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top=\"+s+\", left=\"+o+\", width=\"+t+\", height=\"+r),a.Communication.childWindow?c():m(\"FailedToOpenWindow\")}function d(){t&&(clearInterval(t),t=0),s.removeHandler(\"initialize\"),s.removeHandler(\"navigateCrossDomain\")}function c(){d(),t=a.Communication.currentWindow.setInterval(function(){if(!a.Communication.childWindow||a.Communication.childWindow.closed)m(\"CancelledByUser\");else{var e=a.Communication.childOrigin;try{a.Communication.childOrigin=\"*\",a.sendMessageEventToChild(\"ping\")}finally{a.Communication.childOrigin=e}}},100),s.registerHandler(\"initialize\",function(){return[o.FrameContexts.authentication,i.GlobalVars.hostClientType]}),s.registerHandler(\"navigateCrossDomain\",function(){return!1})}function f(e){try{n&&n.successCallback&&n.successCallback(e)}finally{n=null,l()}}function m(e){try{n&&n.failureCallback&&n.failureCallback(e)}finally{n=null,l()}}function g(e,n,t){if(e){var r=document.createElement(\"a\");r.href=decodeURIComponent(e),r.host&&r.host!==window.location.host&&\"outlook.office.com\"===r.host&&r.search.indexOf(\"client_type=Win32_Outlook\")>-1&&(n&&\"result\"===n&&(t&&(r.href=p(r.href,\"result\",t)),a.Communication.currentWindow.location.assign(p(r.href,\"authSuccess\",\"\"))),n&&\"reason\"===n&&(t&&(r.href=p(r.href,\"reason\",t)),a.Communication.currentWindow.location.assign(p(r.href,\"authFailure\",\"\"))))}}function p(e,n,t){var r=e.indexOf(\"#\"),i=-1===r?\"#\":e.substr(r);return i=i+\"&\"+n+(\"\"!==t?\"=\"+t:\"\"),(e=-1===r?e:e.substr(0,r))+i}e.initialize=function(){s.registerHandler(\"authentication.authenticate.success\",f,!1),s.registerHandler(\"authentication.authenticate.failure\",m,!1)},e.registerAuthenticationHandlers=function(e){n=e},e.authenticate=function(e){var t=void 0!==e?e:n;if(r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.settings,o.FrameContexts.remove,o.FrameContexts.task,o.FrameContexts.stage,o.FrameContexts.meetingStage),i.GlobalVars.hostClientType===o.HostClientType.desktop||i.GlobalVars.hostClientType===o.HostClientType.android||i.GlobalVars.hostClientType===o.HostClientType.ios||i.GlobalVars.hostClientType===o.HostClientType.rigel){var s=document.createElement(\"a\");s.href=t.url,a.sendMessageToParent(\"authentication.authenticate\",[s.href,t.width,t.height],function(e,n){e?t.successCallback(n):t.failureCallback(n)})}else u(t)},e.getAuthToken=function(e){r.ensureInitialized(),a.sendMessageToParent(\"authentication.getAuthToken\",[e.resources,e.claims,e.silent],function(n,t){n?e.successCallback(t):e.failureCallback(t)})},e.getUser=function(e){r.ensureInitialized(),a.sendMessageToParent(\"authentication.getUser\",function(n,t){n?e.successCallback(t):e.failureCallback(t)})},e.notifySuccess=function(e,n){g(n,\"result\",e),r.ensureInitialized(o.FrameContexts.authentication),a.sendMessageToParent(\"authentication.authenticate.success\",[e]),a.waitForMessageQueue(a.Communication.parentWindow,function(){return setTimeout(function(){return a.Communication.currentWindow.close()},200)})},e.notifyFailure=function(e,n){g(n,\"reason\",e),r.ensureInitialized(o.FrameContexts.authentication),a.sendMessageToParent(\"authentication.authenticate.failure\",[e]),a.waitForMessageQueue(a.Communication.parentWindow,function(){return setTimeout(function(){return a.Communication.currentWindow.close()},200)})}}(n.authentication||(n.authentication={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(3);!function(e){var n,t;function l(e){var t=new u(e);n?n(t):t.notifySuccess()}e.initialize=function(){s.registerHandler(\"settings.save\",l,!1),s.registerHandler(\"settings.remove\",d,!1)},e.setValidityState=function(e){r.ensureInitialized(i.FrameContexts.settings,i.FrameContexts.remove),a.sendMessageToParent(\"settings.setValidityState\",[e])},e.getSettings=function(e){r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.settings,i.FrameContexts.remove,i.FrameContexts.sidePanel),a.sendMessageToParent(\"settings.getSettings\",e)},e.setSettings=function(e,n){r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.settings,i.FrameContexts.sidePanel),a.sendMessageToParent(\"settings.setSettings\",[e],n||o.getGenericOnCompleteHandler())},e.registerOnSaveHandler=function(e){r.ensureInitialized(i.FrameContexts.settings),n=e,e&&a.sendMessageToParent(\"registerHandler\",[\"save\"])},e.registerOnRemoveHandler=function(e){r.ensureInitialized(i.FrameContexts.remove,i.FrameContexts.settings),t=e,e&&a.sendMessageToParent(\"registerHandler\",[\"remove\"])};var u=function(){function e(e){this.notified=!1,this.result=e||{}}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent(\"settings.save.success\"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent(\"settings.save.failure\",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error(\"The SaveEvent may only notify success or failure once.\")},e}();function d(){var e=new c;t?t(e):e.notifySuccess()}var c=function(){function e(){this.notified=!1}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent(\"settings.remove.success\"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent(\"settings.remove.failure\",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error(\"The removeEvent may only notify success or failure once.\")},e}()}(n.settings||(n.settings={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){e.registerGetLogHandler=function(e){r.ensureInitialized(),e?o.registerHandler(\"log.request\",function(){var n=e();i.sendMessageToParent(\"log.receive\",[n])}):o.removeHandler(\"log.request\")}}(n.logs||(n.logs={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(15),l=t(3),u=t(6),d=t(7),c=t(4);n.initializePrivateApis=function(){s.menus.initialize()},n.getUserJoinedTeams=function(e,n){if(r.ensureInitialized(),u.GlobalVars.hostClientType===i.HostClientType.android&&!r.isAPISupportedByPlatform(c.getUserJoinedTeamsSupportedAndroidClientVersion)){var t={errorCode:d.ErrorCode.OLD_PLATFORM};throw new Error(JSON.stringify(t))}a.sendMessageToParent(\"getUserJoinedTeams\",[n],e)},n.enterFullscreen=function(){r.ensureInitialized(i.FrameContexts.content),a.sendMessageToParent(\"enterFullscreen\",[])},n.exitFullscreen=function(){r.ensureInitialized(i.FrameContexts.content),a.sendMessageToParent(\"exitFullscreen\",[])},n.openFilePreview=function(e){r.ensureInitialized(i.FrameContexts.content);var n=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference];a.sendMessageToParent(\"openFilePreview\",n)},n.showNotification=function(e){r.ensureInitialized(i.FrameContexts.content);var n=[e.message,e.notificationType];a.sendMessageToParent(\"showNotification\",n)},n.uploadCustomApp=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"uploadCustomApp\",[e],n||o.getGenericOnCompleteHandler())},n.sendCustomMessage=function(e,n,t){r.ensureInitialized(),a.sendMessageToParent(e,n,t)},n.sendCustomEvent=function(e,n){if(r.ensureInitialized(),!a.Communication.childWindow)throw new Error(\"The child window has not yet been initialized or is not present\");a.sendMessageEventToChild(e,n)},n.registerCustomHandler=function(e,n){var t=this;r.ensureInitialized(),l.registerHandler(e,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.apply(t,e)})},n.getChatMembers=function(e){r.ensureInitialized(),a.sendMessageToParent(\"getChatMembers\",e)},n.getConfigSetting=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"getConfigSetting\",[n],e)},n.registerUserSettingsChangeHandler=function(e,n){r.ensureInitialized(),l.registerHandler(\"userSettingsChange\",n,!0,[e])}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){var n,t,a,s=function(){return function(){this.enabled=!0,this.selected=!1}}();function l(e){a&&a(e)||(r.ensureInitialized(),i.sendMessageToParent(\"viewConfigItemPress\",[e]))}function u(e){n&&n(e)||(r.ensureInitialized(),i.sendMessageToParent(\"handleNavBarMenuItemPress\",[e]))}function d(e){t&&t(e)||(r.ensureInitialized(),i.sendMessageToParent(\"handleActionMenuItemPress\",[e]))}e.MenuItem=s,function(e){e.dropDown=\"dropDown\",e.popOver=\"popOver\"}(e.MenuListType||(e.MenuListType={})),e.initialize=function(){o.registerHandler(\"navBarMenuItemPress\",u,!1),o.registerHandler(\"actionMenuItemPress\",d,!1),o.registerHandler(\"setModuleView\",l,!1)},e.setUpViews=function(e,n){r.ensureInitialized(),a=n,i.sendMessageToParent(\"setUpViews\",[e])},e.setNavBarMenu=function(e,t){r.ensureInitialized(),n=t,i.sendMessageToParent(\"setNavBarMenu\",[e])},e.showActionMenu=function(e,n){r.ensureInitialized(),t=n,i.sendMessageToParent(\"showActionMenu\",[e])}}(n.menus||(n.menus={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(5),a=t(0),s=t(3),l=function(){function e(){}return e.prototype.postMessage=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"messageForChild\",[e],n||o.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,n){\"message\"===e&&s.registerHandler(\"messageForParent\",n)},e}();n.ChildAppWindow=l;var u=function(){function e(){}return Object.defineProperty(e,\"Instance\",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.postMessage=function(e,n){r.ensureInitialized(i.FrameContexts.task),a.sendMessageToParent(\"messageForParent\",[e],n||o.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,n){\"message\"===e&&s.registerHandler(\"messageForChild\",n)},e}();n.ParentAppWindow=u},function(e,n,t){\"use strict\";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])};return function(n,t){function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(n,\"__esModule\",{value:!0});var i=t(6),o=t(7),a=t(1),s=t(2),l=t(5),u=t(18),d=t(0),c=t(3),f=t(4);!function(e){!function(e){e.Base64=\"base64\",e.ID=\"id\"}(e.FileFormat||(e.FileFormat={}));var n=function(){return function(){}}();e.File=n,e.captureImage=function(e){if(!e)throw new Error(\"[captureImage] Callback cannot be null\");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),i.GlobalVars.isFramelessWindow?a.isAPISupportedByPlatform(f.captureImageMobileSupportVersion)?d.sendMessageToParent(\"captureImage\",e):e({errorCode:o.ErrorCode.OLD_PLATFORM},void 0):e({errorCode:o.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},void 0)};var t=function(e){function n(n){void 0===n&&(n=null);var t=e.call(this)||this;return n&&(t.content=n.content,t.format=n.format,t.mimeType=n.mimeType,t.name=n.name,t.preview=n.preview,t.size=n.size),t}return r(n,e),n.prototype.getMedia=function(e){if(!e)throw new Error(\"[get Media] Callback cannot be null\");(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))?u.validateGetMediaInputs(this.mimeType,this.format,this.content)?a.isAPISupportedByPlatform(f.getMediaCallbackSupportVersion)?this.getMediaViaCallback(e):this.getMediaViaHandler(e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},null)},n.prototype.getMediaViaCallback=function(e){var n={mediaMimeType:this.mimeType,assembleAttachment:[]},t=[this.content];d.sendMessageToParent(\"getMedia\",t,function(t){if(e)if(t&&t.error)e(t.error,null);else if(t&&t.mediaChunk)if(t.mediaChunk.chunkSequence<=0){var r=u.createFile(n.assembleAttachment,n.mediaMimeType);e(t.error,r)}else{var i=u.decodeAttachment(t.mediaChunk,n.mediaMimeType);n.assembleAttachment.push(i)}else e({errorCode:o.ErrorCode.INTERNAL_ERROR,message:\"data receieved is null\"},null)})},n.prototype.getMediaViaHandler=function(e){var n=l.generateGUID(),t={mediaMimeType:this.mimeType,assembleAttachment:[]},r=[n,this.content];this.content&&e&&d.sendMessageToParent(\"getMedia\",r),c.registerHandler(\"getMedia\"+n,function(r){if(e){var i=JSON.parse(r);if(i.error)e(i.error,null),c.removeHandler(\"getMedia\"+n);else if(i.mediaChunk)if(i.mediaChunk.chunkSequence<=0){var a=u.createFile(t.assembleAttachment,t.mediaMimeType);e(i.error,a),c.removeHandler(\"getMedia\"+n)}else{var s=u.decodeAttachment(i.mediaChunk,t.mediaMimeType);t.assembleAttachment.push(s)}else e({errorCode:o.ErrorCode.INTERNAL_ERROR,message:\"data receieved is null\"},null),c.removeHandler(\"getMedia\"+n)}})},n}(n);e.Media=t,function(e){e[e.Photo=1]=\"Photo\",e[e.Document=2]=\"Document\",e[e.Whiteboard=3]=\"Whiteboard\",e[e.BusinessCard=4]=\"BusinessCard\"}(e.CameraStartMode||(e.CameraStartMode={})),function(e){e[e.Camera=1]=\"Camera\",e[e.Gallery=2]=\"Gallery\"}(e.Source||(e.Source={})),function(e){e[e.Image=1]=\"Image\",e[e.Audio=4]=\"Audio\"}(e.MediaType||(e.MediaType={})),function(e){e[e.ID=1]=\"ID\",e[e.URL=2]=\"URL\"}(e.ImageUriType||(e.ImageUriType={})),e.selectMedia=function(e,n){if(!n)throw new Error(\"[select Media] Callback cannot be null\");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateSelectMediaInputs(e)){var r=[e];d.sendMessageToParent(\"selectMedia\",r,function(e,r){if(r){for(var i=[],o=0,a=r;o<a.length;o++){var s=a[o];i.push(new t(s))}n(e,i)}else n(e,null)})}else{var i={errorCode:o.ErrorCode.INVALID_ARGUMENTS};n(i,null)}else{var l={errorCode:o.ErrorCode.OLD_PLATFORM};n(l,null)}},e.viewImages=function(e,n){if(!n)throw new Error(\"[view images] Callback cannot be null\");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateViewImagesInput(e)){var t=[e];d.sendMessageToParent(\"viewImages\",t,n)}else n({errorCode:o.ErrorCode.INVALID_ARGUMENTS});else n({errorCode:o.ErrorCode.OLD_PLATFORM})},e.scanBarCode=function(e,n){if(!e)throw new Error(\"[media.scanBarCode] Callback cannot be null\");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),i.GlobalVars.hostClientType!==s.HostClientType.desktop&&i.GlobalVars.hostClientType!==s.HostClientType.web&&i.GlobalVars.hostClientType!==s.HostClientType.rigel?a.isAPISupportedByPlatform(f.scanBarCodeAPIMobileSupportVersion)?u.validateScanBarCodeInput(n)?d.sendMessageToParent(\"media.scanBarCode\",[n],e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},null):e({errorCode:o.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},null)}}(n.media||(n.media={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(17);n.createFile=function(e,n){if(null==e||null==n||e.length<=0)return null;var t,r=1;return e.sort(function(e,n){return e.sequence>n.sequence?1:-1}),e.forEach(function(e){e.sequence==r&&(t=t?new Blob([t,e.file],{type:n}):new Blob([e.file],{type:n}),r++)}),t},n.decodeAttachment=function(e,n){if(null==e||null==n)return null;for(var t=atob(e.chunk),r=new Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);var o=new Uint8Array(r),a=new Blob([o],{type:n});return{sequence:e.chunkSequence,file:a}},n.validateSelectMediaInputs=function(e){return!(null==e||e.maxMediaCount>10)},n.validateGetMediaInputs=function(e,n,t){return null!=e&&null!=n&&n==r.media.FileFormat.ID&&null!=t},n.validateViewImagesInput=function(e){return!(null==e||e.length<=0||e.length>10)},n.validateScanBarCodeInput=function(e){return!e||!(null===e.timeOutIntervalInSec||e.timeOutIntervalInSec<=0||e.timeOutIntervalInSec>60)},n.validatePeoplePickerInput=function(e){if(e){if(e.title&&\"string\"!=typeof e.title)return!1;if(e.setSelected&&\"object\"!=typeof e.setSelected)return!1;if(e.openOrgWideSearchInChatOrChannel&&\"boolean\"!=typeof e.openOrgWideSearchInChatOrChannel)return!1;if(e.singleSelect&&\"boolean\"!=typeof e.singleSelect)return!1}return!0}},function(e,n,t){\"use strict\";function r(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}Object.defineProperty(n,\"__esModule\",{value:!0}),r(t(20)),r(t(8))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(21);n.bot=r.bot;var i=t(15);n.menus=i.menus;var o=t(13);n.logs=o.logs;var a=t(32);n.NotificationTypes=a.NotificationTypes,n.ViewerActionTypes=a.ViewerActionTypes,n.UserSettingTypes=a.UserSettingTypes;var s=t(14);n.enterFullscreen=s.enterFullscreen,n.exitFullscreen=s.exitFullscreen,n.getChatMembers=s.getChatMembers,n.getConfigSetting=s.getConfigSetting,n.getUserJoinedTeams=s.getUserJoinedTeams,n.openFilePreview=s.openFilePreview,n.sendCustomMessage=s.sendCustomMessage,n.showNotification=s.showNotification,n.sendCustomEvent=s.sendCustomEvent,n.registerCustomHandler=s.registerCustomHandler,n.uploadCustomApp=s.uploadCustomApp,n.registerUserSettingsChangeHandler=s.registerUserSettingsChangeHandler;var l=t(33);n.conversations=l.conversations;var u=t(34);n.meetingRoom=u.meetingRoom;var d=t(35);n.remoteCamera=d.remoteCamera;var c=t(36);n.files=c.files;var f=t(37);n.appEntity=f.appEntity},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1);!function(e){e.sendQuery=function(e,n,t){i.ensureInitialized(),r.sendMessageToParent(\"bot.executeQuery\",[e],function(e,r){e?n(r):t(r)})},e.getSupportedCommands=function(e,n){i.ensureInitialized(),r.sendMessageToParent(\"bot.getSupportedCommands\",function(t,r){t?e(r):n(r)})},e.authenticate=function(e,n,t){i.ensureInitialized(),r.sendMessageToParent(\"bot.authenticate\",[e],function(e,r){e?n(r):t(r)})},function(e){e.Results=\"Results\",e.Auth=\"Auth\"}(e.ResponseType||(e.ResponseType={}))}(n.bot||(n.bot={}))},function(e,n,t){var r=t(23),i=t(24),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,n,t){var r,i,o=t(9),a=t(10),s=0,l=0;e.exports=function(e,n,t){var u=n&&t||0,d=n||[],c=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:i;if(null==c||null==f){var m=o();null==c&&(c=r=[1|m[0],m[1],m[2],m[3],m[4],m[5]]),null==f&&(f=i=16383&(m[6]<<8|m[7]))}var g=void 0!==e.msecs?e.msecs:(new Date).getTime(),p=void 0!==e.nsecs?e.nsecs:l+1,C=g-s+(p-l)/1e4;if(C<0&&void 0===e.clockseq&&(f=f+1&16383),(C<0||g>s)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");s=g,l=p,i=f;var h=(1e4*(268435455&(g+=122192928e5))+p)%4294967296;d[u++]=h>>>24&255,d[u++]=h>>>16&255,d[u++]=h>>>8&255,d[u++]=255&h;var v=g/4294967296*1e4&268435455;d[u++]=v>>>8&255,d[u++]=255&v,d[u++]=v>>>24&15|16,d[u++]=v>>>16&255,d[u++]=f>>>8|128,d[u++]=255&f;for(var b=0;b<6;++b)d[u+b]=c[b];return n||a(d)}},function(e,n,t){var r=t(9),i=t(10);e.exports=function(e,n,t){var o=n&&t||0;\"string\"==typeof e&&(n=\"binary\"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,n)for(var s=0;s<16;++s)n[o+s]=a[s];return n||i(a)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(4),o=t(0);!function(e){e.Messages={AppLoaded:\"appInitialization.appLoaded\",Success:\"appInitialization.success\",Failure:\"appInitialization.failure\",ExpectedFailure:\"appInitialization.expectedFailure\"},function(e){e.AuthFailed=\"AuthFailed\",e.Timeout=\"Timeout\",e.Other=\"Other\"}(e.FailedReason||(e.FailedReason={})),function(e){e.PermissionError=\"PermissionError\",e.NotFound=\"NotFound\",e.Throttling=\"Throttling\",e.Offline=\"Offline\",e.Other=\"Other\"}(e.ExpectedFailureReason||(e.ExpectedFailureReason={})),e.notifyAppLoaded=function(){r.ensureInitialized(),o.sendMessageToParent(e.Messages.AppLoaded,[i.version])},e.notifySuccess=function(){r.ensureInitialized(),o.sendMessageToParent(e.Messages.Success,[i.version])},e.notifyFailure=function(n){r.ensureInitialized(),o.sendMessageToParent(e.Messages.Failure,[n.reason,n.message])},e.notifyExpectedFailure=function(n){r.ensureInitialized(),o.sendMessageToParent(e.Messages.ExpectedFailure,[n.reason,n.message])}}(n.appInitialization||(n.appInitialization={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(6),o=t(4),a=t(12),s=t(5),l=t(13),u=t(2),d=t(0),c=t(11),f=t(14),m=t(3);function g(e,n){i.GlobalVars.initializeCalled||(i.GlobalVars.initializeCalled=!0,m.initializeHandlers(),d.initializeCommunication(function(e,n,t){void 0===t&&(t=o.defaultSDKVersionForCompatCheck),i.GlobalVars.frameContext=e,i.GlobalVars.hostClientType=n,i.GlobalVars.clientSupportedSDKVersion=t,i.GlobalVars.initializeCallbacks.forEach(function(e){return e()}),i.GlobalVars.initializeCallbacks=[],i.GlobalVars.initializeCompleted=!0},n),c.authentication.initialize(),a.settings.initialize(),f.initializePrivateApis(),this._uninitialize=function(){i.GlobalVars.frameContext&&(C(null),h(null),v(null),T(null),b(null),l.logs.registerGetLogHandler(null)),i.GlobalVars.frameContext===u.FrameContexts.settings&&a.settings.registerOnSaveHandler(null),i.GlobalVars.frameContext===u.FrameContexts.remove&&a.settings.registerOnRemoveHandler(null),i.GlobalVars.initializeCalled=!1,i.GlobalVars.initializeCompleted=!1,i.GlobalVars.initializeCallbacks=[],i.GlobalVars.additionalValidOrigins=[],i.GlobalVars.frameContext=null,i.GlobalVars.hostClientType=null,i.GlobalVars.isFramelessWindow=!1,d.uninitializeCommunication()}),Array.isArray(n)&&r.processAdditionalValidOrigins(n),e&&(i.GlobalVars.initializeCompleted?e():i.GlobalVars.initializeCallbacks.push(e))}function p(){window.print()}function C(e){r.ensureInitialized(),m.registerOnThemeChangeHandler(e)}function h(e){r.ensureInitialized(),m.registerHandler(\"fullScreenChange\",e)}function v(e){r.ensureInitialized(),m.registerBackButtonHandler(e)}function b(e){r.ensureInitialized(),m.registerOnLoadHandler(e)}function T(e){r.ensureInitialized(),m.registerBeforeUnloadHandler(e)}function w(e){r.ensureInitialized(u.FrameContexts.content),d.sendMessageToParent(\"setFrameContext\",[e])}n.initialize=g,n._initialize=function(e){d.Communication.currentWindow=e},n._uninitialize=function(){},n.enablePrintCapability=function(){i.GlobalVars.printCapabilityEnabled||(i.GlobalVars.printCapabilityEnabled=!0,r.ensureInitialized(),document.addEventListener(\"keydown\",function(e){(e.ctrlKey||e.metaKey)&&80===e.keyCode&&(p(),e.cancelBubble=!0,e.preventDefault(),e.stopImmediatePropagation())}))},n.print=p,n.getContext=function(e){r.ensureInitialized(),d.sendMessageToParent(\"getContext\",function(n){n.frameContext||(n.frameContext=i.GlobalVars.frameContext),e(n)})},n.registerOnThemeChangeHandler=C,n.registerFullScreenHandler=h,n.registerAppButtonClickHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonClick\",e)},n.registerAppButtonHoverEnterHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonHoverEnter\",e)},n.registerAppButtonHoverLeaveHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"appButtonHoverLeave\",e)},n.registerBackButtonHandler=v,n.registerOnLoadHandler=b,n.registerBeforeUnloadHandler=T,n.registerChangeSettingsHandler=function(e){r.ensureInitialized(u.FrameContexts.content),m.registerHandler(\"changeSettings\",e)},n.getTabInstances=function(e,n){r.ensureInitialized(),d.sendMessageToParent(\"getTabInstances\",[n],e)},n.getMruTabInstances=function(e,n){r.ensureInitialized(),d.sendMessageToParent(\"getMruTabInstances\",[n],e)},n.shareDeepLink=function(e){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.meetingStage),d.sendMessageToParent(\"shareDeepLink\",[e.subEntityId,e.subEntityLabel,e.subEntityWebUrl])},n.executeDeepLink=function(e,n){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.settings,u.FrameContexts.task,u.FrameContexts.stage,u.FrameContexts.meetingStage),d.sendMessageToParent(\"executeDeepLink\",[e],n||s.getGenericOnCompleteHandler())},n.setFrameContext=w,n.initializeWithFrameContext=function(e,n,t){g(n,t),w(e)}},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(5),o=t(2),a=t(0);n.returnFocus=function(e){r.ensureInitialized(o.FrameContexts.content),a.sendMessageToParent(\"returnFocus\",[e])},n.navigateToTab=function(e,n){r.ensureInitialized(),a.sendMessageToParent(\"navigateToTab\",[e],n||i.getGenericOnCompleteHandler(\"Invalid internalTabInstanceId and/or channelId were/was provided\"))},n.navigateCrossDomain=function(e,n){r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.settings,o.FrameContexts.remove,o.FrameContexts.task,o.FrameContexts.stage,o.FrameContexts.meetingStage),a.sendMessageToParent(\"navigateCrossDomain\",[e],n||i.getGenericOnCompleteHandler(\"Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest.\"))},n.navigateBack=function(e){r.ensureInitialized(),a.sendMessageToParent(\"navigateBack\",[],e||i.getGenericOnCompleteHandler(\"Back navigation is not supported in the current client or context.\"))}},function(e,n,t){\"use strict\";var r=this&&this.__rest||function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&(t[r[i]]=e[r[i]])}return t};Object.defineProperty(n,\"__esModule\",{value:!0});var i=t(2),o=t(16),a=t(0),s=t(1);!function(e){e.startTask=function(e,n){return s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.meetingStage),a.sendMessageToParent(\"tasks.startTask\",[e],n),new o.ChildAppWindow},e.updateTask=function(e){s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.task,i.FrameContexts.meetingStage),e.width,e.height;var n=r(e,[\"width\",\"height\"]);if(Object.keys(n).length)throw new Error(\"updateTask requires a taskInfo argument containing only width and height\");a.sendMessageToParent(\"tasks.updateTask\",[e])},e.submitTask=function(e,n){s.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.task,i.FrameContexts.meetingStage),a.sendMessageToParent(\"tasks.completeTask\",[e,Array.isArray(n)?n:[n]])}}(n.tasks||(n.tasks={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(7),i=t(1),o=t(2),a=t(0),s=t(4);!function(e){e.getLocation=function(e,n){if(!n)throw new Error(\"[location.getLocation] Callback cannot be null\");i.ensureInitialized(o.FrameContexts.content,o.FrameContexts.task),i.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent(\"location.getLocation\",[e],n):n({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):n({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)},e.showLocation=function(e,n){if(!n)throw new Error(\"[location.showLocation] Callback cannot be null\");i.ensureInitialized(o.FrameContexts.content,o.FrameContexts.task),i.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent(\"location.showLocation\",[e],n):n({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):n({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)}}(n.location||(n.location={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(3),o=t(1),a=t(2);!function(e){!function(e){e.Unknown=\"Unknown\",e.Adhoc=\"Adhoc\",e.Scheduled=\"Scheduled\",e.Recurring=\"Recurring\",e.Broadcast=\"Broadcast\",e.MeetNow=\"MeetNow\"}(e.MeetingType||(e.MeetingType={})),e.getIncomingClientAudioState=function(e){if(!e)throw new Error(\"[get incoming client audio state] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"getIncomingClientAudioState\",e)},e.toggleIncomingClientAudio=function(e){if(!e)throw new Error(\"[toggle incoming client audio] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"toggleIncomingClientAudio\",e)},e.getMeetingDetails=function(e){if(!e)throw new Error(\"[get meeting details] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"meeting.getMeetingDetails\",e)},e.getAuthenticationTokenForAnonymousUser=function(e){if(!e)throw new Error(\"[get Authentication Token For AnonymousUser] Callback cannot be null\");o.ensureInitialized(),r.sendMessageToParent(\"meeting.getAuthenticationTokenForAnonymousUser\",e)},e.getLiveStreamState=function(e){if(!e)throw new Error(\"[get live stream state] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.getLiveStreamState\",e)},e.requestStartLiveStreaming=function(e,n,t){if(!e)throw new Error(\"[request start live streaming] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.requestStartLiveStreaming\",[n,t],e)},e.requestStopLiveStreaming=function(e){if(!e)throw new Error(\"[request stop live streaming] Callback cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent(\"meeting.requestStopLiveStreaming\",e)},e.registerLiveStreamChangedHandler=function(e){if(!e)throw new Error(\"[register live stream changed handler] Handler cannot be null\");o.ensureInitialized(a.FrameContexts.sidePanel),i.registerHandler(\"meeting.liveStreamChanged\",e)}}(n.meeting||(n.meeting={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(7),a=t(18),s=t(0),l=t(4);!function(e){(n.people||(n.people={})).selectPeople=function(e,n){if(!e)throw new Error(\"[people picker] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.task,i.FrameContexts.settings),r.isAPISupportedByPlatform(l.peoplePickerRequiredVersion)?a.validatePeoplePickerInput(n)?s.sendMessageToParent(\"people.selectPeople\",[n],e):e({errorCode:o.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:o.ErrorCode.OLD_PLATFORM},void 0)}}()},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0}),function(e){e.fileDownloadStart=\"fileDownloadStart\",e.fileDownloadComplete=\"fileDownloadComplete\"}(n.NotificationTypes||(n.NotificationTypes={})),function(e){e.view=\"view\",e.edit=\"edit\",e.editNew=\"editNew\"}(n.ViewerActionTypes||(n.ViewerActionTypes={})),function(e){e.fileOpenPreference=\"fileOpenPreference\",e.theme=\"theme\"}(n.UserSettingTypes||(n.UserSettingTypes={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(0),a=t(3);!function(e){e.openConversation=function(e){r.ensureInitialized(i.FrameContexts.content),o.sendMessageToParent(\"conversations.openConversation\",[{title:e.title,subEntityId:e.subEntityId,conversationId:e.conversationId,channelId:e.channelId,entityId:e.entityId}],function(e,n){if(!e)throw new Error(n)}),e.onStartConversation&&a.registerHandler(\"startConversation\",function(n,t,r,i){return e.onStartConversation({subEntityId:n,conversationId:t,channelId:r,entityId:i})}),e.onCloseConversation&&a.registerHandler(\"closeConversation\",function(n,t,r,i){return e.onCloseConversation({subEntityId:n,conversationId:t,channelId:r,entityId:i})})},e.closeConversation=function(){r.ensureInitialized(i.FrameContexts.content),o.sendMessageToParent(\"conversations.closeConversation\"),a.removeHandler(\"startConversation\"),a.removeHandler(\"closeConversation\")}}(n.conversations||(n.conversations={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(0),o=t(3);!function(e){!function(e){e.toggleMute=\"toggleMute\",e.toggleCamera=\"toggleCamera\",e.toggleCaptions=\"toggleCaptions\",e.volume=\"volume\",e.showVideoGallery=\"showVideoGallery\",e.showContent=\"showContent\",e.showVideoGalleryAndContent=\"showVideoGalleryAndContent\",e.showLargeGallery=\"showLargeGallery\",e.showTogether=\"showTogether\",e.leaveMeeting=\"leaveMeeting\"}(e.Capability||(e.Capability={})),e.getPairedMeetingRoomInfo=function(e){r.ensureInitialized(),i.sendMessageToParent(\"meetingRoom.getPairedMeetingRoomInfo\",e)},e.sendCommandToPairedMeetingRoom=function(e,n){if(!e||0==e.length)throw new Error(\"[meetingRoom.sendCommandToPairedMeetingRoom] Command name cannot be null or empty\");if(!n)throw new Error(\"[meetingRoom.sendCommandToPairedMeetingRoom] Callback cannot be null\");r.ensureInitialized(),i.sendMessageToParent(\"meetingRoom.sendCommandToPairedMeetingRoom\",[e],n)},e.registerMeetingRoomCapabilitiesUpdateHandler=function(e){if(!e)throw new Error(\"[meetingRoom.registerMeetingRoomCapabilitiesUpdateHandler] Handler cannot be null\");r.ensureInitialized(),o.registerHandler(\"meetingRoom.meetingRoomCapabilitiesUpdate\",function(n){r.ensureInitialized(),e(n)})},e.registerMeetingRoomStatesUpdateHandler=function(e){if(!e)throw new Error(\"[meetingRoom.registerMeetingRoomStatesUpdateHandler] Handler cannot be null\");r.ensureInitialized(),o.registerHandler(\"meetingRoom.meetingRoomStatesUpdate\",function(n){r.ensureInitialized(),e(n)})}}(n.meetingRoom||(n.meetingRoom={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(1),i=t(2),o=t(0),a=t(3);!function(e){!function(e){e.Reset=\"Reset\",e.ZoomIn=\"ZoomIn\",e.ZoomOut=\"ZoomOut\",e.PanLeft=\"PanLeft\",e.PanRight=\"PanRight\",e.TiltUp=\"TiltUp\",e.TiltDown=\"TiltDown\"}(e.ControlCommand||(e.ControlCommand={})),function(e){e[e.CommandResetError=0]=\"CommandResetError\",e[e.CommandZoomInError=1]=\"CommandZoomInError\",e[e.CommandZoomOutError=2]=\"CommandZoomOutError\",e[e.CommandPanLeftError=3]=\"CommandPanLeftError\",e[e.CommandPanRightError=4]=\"CommandPanRightError\",e[e.CommandTiltUpError=5]=\"CommandTiltUpError\",e[e.CommandTiltDownError=6]=\"CommandTiltDownError\",e[e.SendDataError=7]=\"SendDataError\"}(e.ErrorReason||(e.ErrorReason={})),function(e){e[e.None=0]=\"None\",e[e.ControlDenied=1]=\"ControlDenied\",e[e.ControlNoResponse=2]=\"ControlNoResponse\",e[e.ControlBusy=3]=\"ControlBusy\",e[e.AckTimeout=4]=\"AckTimeout\",e[e.ControlTerminated=5]=\"ControlTerminated\",e[e.ControllerTerminated=6]=\"ControllerTerminated\",e[e.DataChannelError=7]=\"DataChannelError\",e[e.ControllerCancelled=8]=\"ControllerCancelled\",e[e.ControlDisabled=9]=\"ControlDisabled\"}(e.SessionTerminatedReason||(e.SessionTerminatedReason={})),e.getCapableParticipants=function(e){if(!e)throw new Error(\"[remoteCamera.getCapableParticipants] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.getCapableParticipants\",e)},e.requestControl=function(e,n){if(!e)throw new Error(\"[remoteCamera.requestControl] Participant cannot be null\");if(!n)throw new Error(\"[remoteCamera.requestControl] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.requestControl\",[e],n)},e.sendControlCommand=function(e,n){if(!e)throw new Error(\"[remoteCamera.sendControlCommand] ControlCommand cannot be null\");if(!n)throw new Error(\"[remoteCamera.sendControlCommand] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.sendControlCommand\",[e],n)},e.terminateSession=function(e){if(!e)throw new Error(\"[remoteCamera.terminateSession] Callback cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),o.sendMessageToParent(\"remoteCamera.terminateSession\",e)},e.registerOnCapableParticipantsChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnCapableParticipantsChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.capableParticipantsChange\",e)},e.registerOnErrorHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnErrorHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.handlerError\",e)},e.registerOnDeviceStateChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnDeviceStateChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.deviceStateChange\",e)},e.registerOnSessionStatusChangeHandler=function(e){if(!e)throw new Error(\"[remoteCamera.registerOnSessionStatusChangeHandler] Handler cannot be null\");r.ensureInitialized(i.FrameContexts.sidePanel),a.registerHandler(\"remoteCamera.sessionStatusChange\",e)}}(n.remoteCamera||(n.remoteCamera={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1),o=t(8);!function(e){!function(e){e.Dropbox=\"DROPBOX\",e.Box=\"BOX\",e.Sharefile=\"SHAREFILE\",e.GoogleDrive=\"GOOGLEDRIVE\",e.Egnyte=\"EGNYTE\"}(e.CloudStorageProvider||(e.CloudStorageProvider={})),function(e){e[e.Sharepoint=0]=\"Sharepoint\",e[e.WopiIntegration=1]=\"WopiIntegration\",e[e.Google=2]=\"Google\"}(e.CloudStorageProviderType||(e.CloudStorageProviderType={})),e.getCloudStorageFolders=function(e,n){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[files.getCloudStorageFolders] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.getCloudStorageFolders] Callback cannot be null\");r.sendMessageToParent(\"files.getCloudStorageFolders\",[e],n)},e.addCloudStorageFolder=function(e,n){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[files.addCloudStorageFolder] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.addCloudStorageFolder] Callback cannot be null\");r.sendMessageToParent(\"files.addCloudStorageFolder\",[e],n)},e.deleteCloudStorageFolder=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e)throw new Error(\"[files.deleteCloudStorageFolder] channelId name cannot be null or empty\");if(!n)throw new Error(\"[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty\");if(!t)throw new Error(\"[files.deleteCloudStorageFolder] Callback cannot be null\");r.sendMessageToParent(\"files.deleteCloudStorageFolder\",[e,n],t)},e.getCloudStorageFolderContents=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||!n)throw new Error(\"[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty\");if(!t)throw new Error(\"[files.getCloudStorageFolderContents] Callback cannot be null\");if(\"isSubdirectory\"in e&&!e.isSubdirectory)throw new Error(\"[files.getCloudStorageFolderContents] provided folder is not a subDirectory\");r.sendMessageToParent(\"files.getCloudStorageFolderContents\",[e,n],t)},e.openCloudStorageFile=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||!n)throw new Error(\"[files.openCloudStorageFile] file/providerCode cannot be null or empty\");if(e.isSubdirectory)throw new Error(\"[files.openCloudStorageFile] provided file is a subDirectory\");r.sendMessageToParent(\"files.openCloudStorageFile\",[e,n,t])}}(n.files||(n.files={}))},function(e,n,t){\"use strict\";Object.defineProperty(n,\"__esModule\",{value:!0});var r=t(0),i=t(1),o=t(8);!function(e){(n.appEntity||(n.appEntity={})).selectAppEntity=function(e,n,t){if(i.ensureInitialized(o.FrameContexts.content),!e||0==e.length)throw new Error(\"[appEntity.selectAppEntity] threadId name cannot be null or empty\");if(!t)throw new Error(\"[appEntity.selectAppEntity] Callback cannot be null\");r.sendMessageToParent(\"appEntity.selectAppEntity\",[e,n],t)}}()}])});","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { v4 as uuidv4 } from \"uuid\";\nimport { HttpOperationResponse } from \"../httpOperationResponse\";\nimport { RestError } from \"../restError\";\nimport { WebResourceLike } from \"../webResource\";\nimport { Constants } from \"./constants\";\nimport { XML_ATTRKEY } from \"./serializer.common\";\n\nconst validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;\n\n/**\n * A constant that indicates whether the environment is node.js or browser based.\n */\nexport const isNode =\n typeof process !== \"undefined\" &&\n !!process.version &&\n !!process.versions &&\n !!process.versions.node;\n\n/**\n * Checks if a parsed URL is HTTPS\n *\n * @param urlToCheck - The url to check\n * @returns True if the URL is HTTPS; false otherwise.\n */\nexport function urlIsHTTPS(urlToCheck: { protocol: string }): boolean {\n return urlToCheck.protocol.toLowerCase() === Constants.HTTPS;\n}\n\n/**\n * Encodes an URI.\n *\n * @param uri - The URI to be encoded.\n * @returns The encoded URI.\n */\nexport function encodeUri(uri: string): string {\n return encodeURIComponent(uri)\n .replace(/!/g, \"%21\")\n .replace(/\"/g, \"%27\")\n .replace(/\\(/g, \"%28\")\n .replace(/\\)/g, \"%29\")\n .replace(/\\*/g, \"%2A\");\n}\n\n/**\n * Returns a stripped version of the Http Response which only contains body,\n * headers and the status.\n *\n * @param response - The Http Response\n * @returns The stripped version of Http Response.\n */\nexport function stripResponse(response: HttpOperationResponse): any {\n const strippedResponse: any = {};\n strippedResponse.body = response.bodyAsText;\n strippedResponse.headers = response.headers;\n strippedResponse.status = response.status;\n return strippedResponse;\n}\n\n/**\n * Returns a stripped version of the Http Request that does not contain the\n * Authorization header.\n *\n * @param request - The Http Request object\n * @returns The stripped version of Http Request.\n */\nexport function stripRequest(request: WebResourceLike): WebResourceLike {\n const strippedRequest = request.clone();\n if (strippedRequest.headers) {\n strippedRequest.headers.remove(\"authorization\");\n }\n return strippedRequest;\n}\n\n/**\n * Validates the given uuid as a string\n *\n * @param uuid - The uuid as a string that needs to be validated\n * @returns True if the uuid is valid; false otherwise.\n */\nexport function isValidUuid(uuid: string): boolean {\n return validUuidRegex.test(uuid);\n}\n\n/**\n * Generated UUID\n *\n * @returns RFC4122 v4 UUID.\n */\nexport function generateUuid(): string {\n return uuidv4();\n}\n\n/**\n * Executes an array of promises sequentially. Inspiration of this method is here:\n * https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html. An awesome blog on promises!\n *\n * @param promiseFactories - An array of promise factories(A function that return a promise)\n * @param kickstart - Input to the first promise that is used to kickstart the promise chain.\n * If not provided then the promise chain starts with undefined.\n * @returns A chain of resolved or rejected promises\n */\nexport function executePromisesSequentially(\n promiseFactories: Array<any>,\n kickstart: unknown\n): Promise<any> {\n let result = Promise.resolve(kickstart);\n promiseFactories.forEach((promiseFactory) => {\n result = result.then(promiseFactory);\n });\n return result;\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @param t - The number of milliseconds to be delayed.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n * @returns Resolved promise\n */\nexport function delay<T>(t: number, value?: T): Promise<T | void> {\n return new Promise((resolve) => setTimeout(() => resolve(value), t));\n}\n\n/**\n * Service callback that is returned for REST requests initiated by the service client.\n */\nexport interface ServiceCallback<TResult> {\n /**\n * A method that will be invoked as a callback to a service function.\n * @param err - The error occurred if any, while executing the request; otherwise null.\n * @param result - The deserialized response body if an error did not occur.\n * @param request - The raw/actual request sent to the server if an error did not occur.\n * @param response - The raw/actual response from the server if an error did not occur.\n */\n (\n err: Error | RestError | null,\n result?: TResult,\n request?: WebResourceLike,\n response?: HttpOperationResponse\n ): void;\n}\n\n/**\n * Converts a Promise to a callback.\n * @param promise - The Promise to be converted to a callback\n * @returns A function that takes the callback `(cb: Function) => void`\n * @deprecated generated code should instead depend on responseToBody\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function promiseToCallback(promise: Promise<any>): (cb: Function) => void {\n if (typeof promise.then !== \"function\") {\n throw new Error(\"The provided input is not a Promise.\");\n }\n // eslint-disable-next-line @typescript-eslint/ban-types\n return (cb: Function): void => {\n promise\n .then((data: any) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n return cb(undefined, data);\n })\n .catch((err: Error) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err);\n });\n };\n}\n\n/**\n * Converts a Promise to a service callback.\n * @param promise - The Promise of HttpOperationResponse to be converted to a service callback\n * @returns A function that takes the service callback (cb: ServiceCallback<T>): void\n */\nexport function promiseToServiceCallback<T>(\n promise: Promise<HttpOperationResponse>\n): (cb: ServiceCallback<T>) => void {\n if (typeof promise.then !== \"function\") {\n throw new Error(\"The provided input is not a Promise.\");\n }\n return (cb: ServiceCallback<T>): void => {\n promise\n .then((data: HttpOperationResponse) => {\n return process.nextTick(cb, undefined, data.parsedBody as T, data.request, data);\n })\n .catch((err: Error) => {\n process.nextTick(cb, err);\n });\n };\n}\n\nexport function prepareXMLRootList(\n obj: unknown,\n elementName: string,\n xmlNamespaceKey?: string,\n xmlNamespace?: string\n): { [s: string]: any } {\n if (!Array.isArray(obj)) {\n obj = [obj];\n }\n\n if (!xmlNamespaceKey || !xmlNamespace) {\n return { [elementName]: obj };\n }\n\n const result = { [elementName]: obj };\n result[XML_ATTRKEY] = { [xmlNamespaceKey]: xmlNamespace };\n return result;\n}\n\n/**\n * Applies the properties on the prototype of sourceCtors to the prototype of targetCtor\n * @param targetCtor - The target object on which the properties need to be applied.\n * @param sourceCtors - An array of source objects from which the properties need to be taken.\n */\nexport function applyMixins(targetCtorParam: unknown, sourceCtors: any[]): void {\n const castTargetCtorParam = targetCtorParam as {\n prototype: Record<string, unknown>;\n };\n sourceCtors.forEach((sourceCtor) => {\n Object.getOwnPropertyNames(sourceCtor.prototype).forEach((name) => {\n castTargetCtorParam.prototype[name] = sourceCtor.prototype[name];\n });\n });\n}\n\nconst validateISODuration = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n/**\n * Indicates whether the given string is in ISO 8601 format.\n * @param value - The value to be validated for ISO 8601 duration format.\n * @returns `true` if valid, `false` otherwise.\n */\nexport function isDuration(value: string): boolean {\n return validateISODuration.test(value);\n}\n\n/**\n * Replace all of the instances of searchValue in value with the provided replaceValue.\n * @param value - The value to search and replace in.\n * @param searchValue - The value to search for in the value argument.\n * @param replaceValue - The value to replace searchValue with in the value argument.\n * @returns The value where each instance of searchValue was replaced with replacedValue.\n */\nexport function replaceAll(\n value: string | undefined,\n searchValue: string,\n replaceValue: string\n): string | undefined {\n return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || \"\");\n}\n\n/**\n * Determines whether the given entity is a basic/primitive type\n * (string, number, boolean, null, undefined).\n * @param value - Any entity\n * @returns true is it is primitive type, false otherwise.\n */\nexport function isPrimitiveType(value: unknown): boolean {\n return (typeof value !== \"object\" && typeof value !== \"function\") || value === null;\n}\n\nexport function getEnvironmentValue(name: string): string | undefined {\n if (process.env[name]) {\n return process.env[name];\n } else if (process.env[name.toLowerCase()]) {\n return process.env[name.toLowerCase()];\n }\n return undefined;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/* eslint-disable no-invalid-this */\n\nimport { log } from \"./log\";\n\n/**\n * A simple mechanism for enabling logging.\n * Intended to mimic the publicly available `debug` package.\n */\nexport interface Debug {\n /**\n * Creates a new logger with the given namespace.\n */\n (namespace: string): Debugger;\n /**\n * The default log method (defaults to console)\n */\n log: (...args: any[]) => void;\n /**\n * Enables a particular set of namespaces.\n * To enable multiple separate them with commas, e.g. \"info,debug\".\n * Supports wildcards, e.g. \"azure:*\"\n * Supports skip syntax, e.g. \"azure:*,-azure:storage:*\" will enable\n * everything under azure except for things under azure:storage.\n */\n enable: (namespaces: string) => void;\n /**\n * Checks if a particular namespace is enabled.\n */\n enabled: (namespace: string) => boolean;\n /**\n * Disables all logging, returns what was previously enabled.\n */\n disable: () => string;\n}\n\n/**\n * A log function that can be dynamically enabled and redirected.\n */\nexport interface Debugger {\n /**\n * Logs the given arguments to the `log` method.\n */\n (...args: any[]): void;\n /**\n * True if this logger is active and logging.\n */\n enabled: boolean;\n /**\n * Used to cleanup/remove this logger.\n */\n destroy: () => boolean;\n /**\n * The current log method. Can be overridden to redirect output.\n */\n log: (...args: any[]) => void;\n /**\n * The namespace of this logger.\n */\n namespace: string;\n /**\n * Extends this logger with a child namespace.\n * Namespaces are separated with a ':' character.\n */\n extend: (namespace: string) => Debugger;\n}\n\nconst debugEnvVariable =\n (typeof process !== \"undefined\" && process.env && process.env.DEBUG) || undefined;\n\nlet enabledString: string | undefined;\nlet enabledNamespaces: RegExp[] = [];\nlet skippedNamespaces: RegExp[] = [];\nconst debuggers: Debugger[] = [];\n\nif (debugEnvVariable) {\n enable(debugEnvVariable);\n}\n\nconst debugObj: Debug = Object.assign(\n (namespace: string): Debugger => {\n return createDebugger(namespace);\n },\n {\n enable,\n enabled,\n disable,\n log\n }\n);\n\nfunction enable(namespaces: string): void {\n enabledString = namespaces;\n enabledNamespaces = [];\n skippedNamespaces = [];\n const wildcard = /\\*/g;\n const namespaceList = namespaces.split(\",\").map((ns) => ns.trim().replace(wildcard, \".*?\"));\n for (const ns of namespaceList) {\n if (ns.startsWith(\"-\")) {\n skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));\n } else {\n enabledNamespaces.push(new RegExp(`^${ns}$`));\n }\n }\n for (const instance of debuggers) {\n instance.enabled = enabled(instance.namespace);\n }\n}\n\nfunction enabled(namespace: string): boolean {\n if (namespace.endsWith(\"*\")) {\n return true;\n }\n\n for (const skipped of skippedNamespaces) {\n if (skipped.test(namespace)) {\n return false;\n }\n }\n for (const enabledNamespace of enabledNamespaces) {\n if (enabledNamespace.test(namespace)) {\n return true;\n }\n }\n return false;\n}\n\nfunction disable(): string {\n const result = enabledString || \"\";\n enable(\"\");\n return result;\n}\n\nfunction createDebugger(namespace: string): Debugger {\n const newDebugger: Debugger = Object.assign(debug, {\n enabled: enabled(namespace),\n destroy,\n log: debugObj.log,\n namespace,\n extend\n });\n\n function debug(...args: any[]): void {\n if (!newDebugger.enabled) {\n return;\n }\n if (args.length > 0) {\n args[0] = `${namespace} ${args[0]}`;\n }\n newDebugger.log(...args);\n }\n\n debuggers.push(newDebugger);\n\n return newDebugger;\n}\n\nfunction destroy(this: Debugger): boolean {\n const index = debuggers.indexOf(this);\n if (index >= 0) {\n debuggers.splice(index, 1);\n return true;\n }\n return false;\n}\n\nfunction extend(this: Debugger, namespace: string): Debugger {\n const newDebugger = createDebugger(`${this.namespace}:${namespace}`);\n newDebugger.log = this.log;\n return newDebugger;\n}\n\nexport default debugObj;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport function log(...args: any[]): void {\n if (args.length > 0) {\n const firstArg = String(args[0]);\n if (firstArg.includes(\":error\")) {\n console.error(...args);\n } else if (firstArg.includes(\":warning\")) {\n console.warn(...args);\n } else if (firstArg.includes(\":info\")) {\n console.info(...args);\n } else if (firstArg.includes(\":verbose\")) {\n console.debug(...args);\n } else {\n console.debug(...args);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport debug, { Debugger } from \"./debug\";\nexport { Debugger } from \"./debug\";\n\nconst registeredLoggers = new Set<AzureDebugger>();\nconst logLevelFromEnv =\n (typeof process !== \"undefined\" && process.env && process.env.AZURE_LOG_LEVEL) || undefined;\n\nlet azureLogLevel: AzureLogLevel | undefined;\n\n/**\n * The AzureLogger provides a mechanism for overriding where logs are output to.\n * By default, logs are sent to stderr.\n * Override the `log` method to redirect logs to another location.\n */\nexport const AzureLogger: AzureClientLogger = debug(\"azure\");\nAzureLogger.log = (...args) => {\n debug.log(...args);\n};\n\n/**\n * The log levels supported by the logger.\n * The log levels in order of most verbose to least verbose are:\n * - verbose\n * - info\n * - warning\n * - error\n */\nexport type AzureLogLevel = \"verbose\" | \"info\" | \"warning\" | \"error\";\nconst AZURE_LOG_LEVELS = [\"verbose\", \"info\", \"warning\", \"error\"];\n\ntype AzureDebugger = Debugger & { level: AzureLogLevel };\n\n/**\n * An AzureClientLogger is a function that can log to an appropriate severity level.\n */\nexport type AzureClientLogger = Debugger;\n\nif (logLevelFromEnv) {\n // avoid calling setLogLevel because we don't want a mis-set environment variable to crash\n if (isAzureLogLevel(logLevelFromEnv)) {\n setLogLevel(logLevelFromEnv);\n } else {\n console.error(\n `AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(\n \", \"\n )}.`\n );\n }\n}\n\n/**\n * Immediately enables logging at the specified log level.\n * @param level - The log level to enable for logging.\n * Options from most verbose to least verbose are:\n * - verbose\n * - info\n * - warning\n * - error\n */\nexport function setLogLevel(level?: AzureLogLevel): void {\n if (level && !isAzureLogLevel(level)) {\n throw new Error(\n `Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(\",\")}`\n );\n }\n azureLogLevel = level;\n\n const enabledNamespaces = [];\n for (const logger of registeredLoggers) {\n if (shouldEnable(logger)) {\n enabledNamespaces.push(logger.namespace);\n }\n }\n\n debug.enable(enabledNamespaces.join(\",\"));\n}\n\n/**\n * Retrieves the currently specified log level.\n */\nexport function getLogLevel(): AzureLogLevel | undefined {\n return azureLogLevel;\n}\n\nconst levelMap = {\n verbose: 400,\n info: 300,\n warning: 200,\n error: 100\n};\n\n/**\n * Defines the methods available on the SDK-facing logger.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport interface AzureLogger {\n /**\n * Used for failures the program is unlikely to recover from,\n * such as Out of Memory.\n */\n error: Debugger;\n /**\n * Used when a function fails to perform its intended task.\n * Usually this means the function will throw an exception.\n * Not used for self-healing events (e.g. automatic retry)\n */\n warning: Debugger;\n /**\n * Used when a function operates normally.\n */\n info: Debugger;\n /**\n * Used for detailed trbouleshooting scenarios. This is\n * intended for use by developers / system administrators\n * for diagnosing specific failures.\n */\n verbose: Debugger;\n}\n\n/**\n * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`.\n * @param namespace - The name of the SDK package.\n * @hidden\n */\nexport function createClientLogger(namespace: string): AzureLogger {\n const clientRootLogger: AzureClientLogger = AzureLogger.extend(namespace);\n patchLogMethod(AzureLogger, clientRootLogger);\n return {\n error: createLogger(clientRootLogger, \"error\"),\n warning: createLogger(clientRootLogger, \"warning\"),\n info: createLogger(clientRootLogger, \"info\"),\n verbose: createLogger(clientRootLogger, \"verbose\")\n };\n}\n\nfunction patchLogMethod(parent: AzureClientLogger, child: AzureClientLogger | AzureDebugger): void {\n child.log = (...args) => {\n parent.log(...args);\n };\n}\n\nfunction createLogger(parent: AzureClientLogger, level: AzureLogLevel): AzureDebugger {\n const logger: AzureDebugger = Object.assign(parent.extend(level), {\n level\n });\n\n patchLogMethod(parent, logger);\n\n if (shouldEnable(logger)) {\n const enabledNamespaces = debug.disable();\n debug.enable(enabledNamespaces + \",\" + logger.namespace);\n }\n\n registeredLoggers.add(logger);\n\n return logger;\n}\n\nfunction shouldEnable(logger: AzureDebugger): boolean {\n if (azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]) {\n return true;\n } else {\n return false;\n }\n}\n\nfunction isAzureLogLevel(logLevel: string): logLevel is AzureLogLevel {\n return AZURE_LOG_LEVELS.includes(logLevel as any);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Configuration for current environment.\n * @beta\n */\nexport interface Configuration {\n /**\n * Authentication related configuration.\n *\n * @readonly\n */\n readonly authentication?: AuthenticationConfiguration;\n\n /**\n * Configuration for resources.\n *\n * @readonly\n */\n readonly resources?: ResourceConfiguration[];\n}\n\n/**\n * Authentication related configuration.\n * @beta\n */\nexport interface AuthenticationConfiguration {\n /**\n * Hostname of AAD authority. Default value comes from M365_AUTHORITY_HOST environment variable.\n *\n * @readonly\n */\n readonly authorityHost?: string;\n\n /**\n * AAD tenant id, default value comes from M365_TENANT_ID environment variable.\n *\n * @readonly\n */\n readonly tenantId?: string;\n\n /**\n * The client (application) ID of an App Registration in the tenant, default value comes from M365_CLIENT_ID environment variable\n *\n * @readonly\n */\n readonly clientId?: string;\n\n /**\n * Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal. Default value comes from M365_CLIENT_SECRET environment variable\n *\n * @readonly\n */\n readonly clientSecret?: string;\n\n /**\n * Endpoint of auth service provisioned by Teams Framework. Default value comes from SIMPLE_AUTH_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly simpleAuthEndpoint?: string;\n\n /**\n * Login page for Teams to redirect to. Default value comes from INITIATE_LOGIN_ENDPOINT environment variable.\n *\n * @readonly\n */\n readonly initiateLoginEndpoint?: string;\n\n /**\n * Application ID URI. Default value comes from M365_APPLICATION_ID_URI environment variable.\n */\n readonly applicationIdUri?: string;\n}\n\n/**\n * Configuration for resources.\n * @beta\n */\nexport interface ResourceConfiguration {\n /**\n * Resource type.\n *\n * @readonly\n */\n readonly type: ResourceType;\n\n /**\n * Resource name.\n *\n * @readonly\n */\n readonly name: string;\n\n /**\n * Config for the resource.\n *\n * @readonly\n */\n readonly properties: { [index: string]: any };\n}\n\n/**\n * Available resource type.\n * @beta\n */\nexport enum ResourceType {\n /**\n * SQL database.\n *\n */\n SQL,\n\n /**\n * Rest API.\n *\n */\n API,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isNode } from \"@azure/core-http\";\nimport {\n AuthenticationConfiguration,\n Configuration,\n ResourceConfiguration,\n ResourceType,\n} from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"./errors\";\n\n/**\n * Global configuration instance\n *\n */\nexport let config: Configuration;\n\n/**\n * Initialize configuration from environment variables or configuration object and set the global instance\n *\n * @param {Configuration} configuration - Optional configuration that overrides the default configuration values. The override depth is 1.\n *\n * @throws {@link ErrorCode|InvalidParameter} when configuration is not passed in browser environment\n *\n * @beta\n */\nexport function loadConfiguration(configuration?: Configuration): void {\n internalLogger.info(\"load configuration\");\n\n // browser environment\n if (!isNode) {\n if (!configuration) {\n const errorMsg = \"You are running the code in browser. Configuration must be passed in.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n config = configuration;\n return;\n }\n\n // node environment\n let newAuthentication: AuthenticationConfiguration;\n let newResources: ResourceConfiguration[] = [];\n const defaultResourceName = \"default\";\n\n if (configuration?.authentication) {\n newAuthentication = configuration.authentication;\n } else {\n newAuthentication = {\n authorityHost: process.env.M365_AUTHORITY_HOST,\n tenantId: process.env.M365_TENANT_ID,\n clientId: process.env.M365_CLIENT_ID,\n clientSecret: process.env.M365_CLIENT_SECRET,\n simpleAuthEndpoint: process.env.SIMPLE_AUTH_ENDPOINT,\n initiateLoginEndpoint: process.env.INITIATE_LOGIN_ENDPOINT,\n applicationIdUri: process.env.M365_APPLICATION_ID_URI,\n };\n }\n\n if (configuration?.resources) {\n newResources = configuration.resources;\n } else {\n newResources = [\n {\n // SQL resource\n type: ResourceType.SQL,\n name: defaultResourceName,\n properties: {\n sqlServerEndpoint: process.env.SQL_ENDPOINT,\n sqlUsername: process.env.SQL_USER_NAME,\n sqlPassword: process.env.SQL_PASSWORD,\n sqlDatabaseName: process.env.SQL_DATABASE_NAME,\n sqlIdentityId: process.env.IDENTITY_ID,\n },\n },\n {\n // API resource\n type: ResourceType.API,\n name: defaultResourceName,\n properties: {\n endpoint: process.env.API_ENDPOINT,\n },\n },\n ];\n }\n\n config = {\n authentication: newAuthentication,\n resources: newResources,\n };\n}\n\n/**\n * Get configuration for a specific resource.\n * @param {ResourceType} resourceType - The type of resource\n * @param {string} resourceName - The name of resource, default value is \"default\".\n *\n * @returns Resource configuration for target resource from global configuration instance.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when resource configuration with the specific type and name is not found\n *\n * @beta\n */\nexport function getResourceConfiguration(\n resourceType: ResourceType,\n resourceName = \"default\"\n): { [index: string]: any } {\n internalLogger.info(\n `Get resource configuration of ${ResourceType[resourceType]} from ${resourceName}`\n );\n const result: ResourceConfiguration | undefined = config.resources?.find(\n (item) => item.type === resourceType && item.name === resourceName\n );\n if (result) {\n return result.properties;\n }\n\n const errorMsg = formatString(\n ErrorMessage.MissingResourceConfiguration,\n ResourceType[resourceType],\n resourceName\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n}\n\n/**\n * Get configuration for authentication.\n *\n * @returns Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when global configuration does not exist\n *\n * @beta\n */\nexport function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined {\n internalLogger.info(\"Get authentication configuration\");\n if (config) {\n return config.authentication;\n }\n const errorMsg =\n \"Please call loadConfiguration() first before calling getAuthenticationConfiguration().\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(\n formatString(ErrorMessage.ConfigurationNotExists, errorMsg),\n ErrorCode.InvalidConfiguration\n );\n}\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","module.exports = require('./lib/axios');","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport enum GrantType {\n authCode = \"authorization_code\",\n ssoToken = \"sso_token\",\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { Cache } from \"../core/cache.browser\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { AuthCodeResult } from \"../models/authCodeResult\";\nimport axios, { AxiosInstance } from \"axios\";\nimport { GrantType } from \"../models/grantType\";\nimport { AccessTokenResult } from \"../models/accessTokenResult\";\nimport { validateScopesType, getUserInfoFromSsoToken, parseJwt } from \"../util/utils\";\nimport { formatString } from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\n\nconst accessTokenCacheKeyPrefix = \"accessToken\";\nconst separator = \"-\";\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst initializeTeamsSdkTimeoutInMillisecond = 5000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\nconst maxRetryCount = 3;\nconst retryTimeSpanInMillisecond = 3000;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n\n /**\n * Constructor of TeamsUserCredential.\n * Developer need to call loadConfiguration(config) before using this class.\n * \n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * runtimeConnectorEndpoint: \"https://xxx.xxx.com\",\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * }\n loadConfiguration(config); // No default config from environment variables, developers must provide the config object.\n const credential = new TeamsUserCredential([\"https://graph.microsoft.com/User.Read\"]);\n * ```\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n * \n * @beta\n */\n constructor() {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig();\n this.ssoToken = null;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from Teams\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const authCodeResult: AuthCodeResult = JSON.parse(result);\n try {\n await this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);\n resolve();\n } catch (err) {\n reject(this.generateAuthServerError(err));\n }\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\n });\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n const cachedKey = await this.getAccessTokenCacheKey(scopeStr);\n const cachedToken = this.getTokenCache(cachedKey);\n\n if (cachedToken) {\n if (!this.isAccessTokenNearExpired(cachedToken)) {\n internalLogger.verbose(\"Get access token from cache\");\n return cachedToken;\n } else {\n internalLogger.verbose(\"Cached access token is expired\");\n }\n } else {\n internalLogger.verbose(\"No cached access token\");\n }\n\n const accessToken = await this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async exchangeAccessTokenFromSimpleAuthServer(\n scopesStr: string,\n authCodeResult: AuthCodeResult\n ): Promise<void> {\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n\n let retryCount = 0;\n while (true) {\n try {\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n code: authCodeResult.code,\n code_verifier: authCodeResult.codeVerifier,\n redirect_uri: authCodeResult.redirectUri,\n grant_type: GrantType.authCode,\n });\n\n const tokenResult: AccessTokenResult = response.data;\n const key = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(key, {\n token: tokenResult.access_token,\n expiresOnTimestamp: tokenResult.expires_on,\n });\n return;\n } catch (err: any) {\n if (err.response?.data?.type && err.response.data.type === \"AadUiRequiredException\") {\n internalLogger.warn(\"Exchange access token failed, retry...\");\n if (retryCount < maxRetryCount) {\n await this.sleep(retryTimeSpanInMillisecond);\n retryCount++;\n continue;\n }\n }\n throw err;\n }\n }\n }\n\n /**\n * Get access token cache from authentication server\n * @returns Access token\n */\n private async getAndCacheAccessTokenFromSimpleAuthServer(\n scopesStr: string\n ): Promise<AccessToken> {\n try {\n internalLogger.verbose(\n \"Get access token from authentication server with scopes: \" + scopesStr\n );\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n grant_type: GrantType.ssoToken,\n });\n\n const accessTokenResult: AccessTokenResult = response.data;\n const accessToken: AccessToken = {\n token: accessTokenResult.access_token,\n expiresOnTimestamp: accessTokenResult.expires_on,\n };\n const cacheKey = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(cacheKey, accessToken);\n return accessToken;\n } catch (err) {\n throw this.generateAuthServerError(err);\n }\n }\n\n /**\n * Get SSO token using teams SDK\n * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token\n * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n let initialized = false;\n microsoftTeams.initialize(() => {\n initialized = true;\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n\n // If the code not running in Teams, the initialize callback function would never trigger\n setTimeout(() => {\n if (!initialized) {\n const errorMsg =\n \"Initialize teams sdk timeout, maybe the code is not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n }, initializeTeamsSdkTimeoutInMillisecond);\n });\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.simpleAuthEndpoint) {\n missingValues.push(\"simpleAuthEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n /**\n * Get axios instance with sso token bearer header\n * @returns AxiosInstance\n */\n private async getAxiosInstance(): Promise<AxiosInstance> {\n const ssoToken = await this.getSSOToken();\n const axiosInstance: AxiosInstance = axios.create({\n baseURL: this.config.simpleAuthEndpoint,\n });\n\n axiosInstance.interceptors.request.use((config) => {\n config.headers.Authorization = \"Bearer \" + ssoToken.token;\n return config;\n });\n\n return axiosInstance;\n }\n\n /**\n * Set access token to cache\n * @param key\n * @param token\n */\n private setTokenCache(key: string, token: AccessToken): void {\n Cache.set(key, JSON.stringify(token));\n }\n\n /**\n * Get access token from cache.\n * If there is no cache or cannot be parsed, then it will return null\n * @param key\n * @returns Access token or null\n */\n private getTokenCache(key: string): AccessToken | null {\n const value = Cache.get(key);\n if (value === null) {\n return null;\n }\n\n const accessToken: AccessToken | null = this.validateAndParseJson(value);\n return accessToken;\n }\n\n /**\n * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.\n * @param jsonValue\n */\n private validateAndParseJson(jsonValue: string): AccessToken | null {\n try {\n const parsedJson = JSON.parse(jsonValue);\n /**\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\n *\n */\n return parsedJson && typeof parsedJson === \"object\" ? parsedJson : null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Generate cache key\n * @param scopesStr\n * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes\n */\n private async getAccessTokenCacheKey(scopesStr: string): Promise<string> {\n const ssoToken = await this.getSSOToken();\n const ssoTokenObj = parseJwt(ssoToken.token);\n\n const clientId = this.config.clientId;\n const userObjectId = ssoTokenObj.oid;\n const tenantId = ssoTokenObj.tid;\n\n const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]\n .join(separator)\n .replace(/\" \"/g, \"_\");\n return key;\n }\n\n /**\n * Check whether the token is about to expire (within 5 minutes)\n * @returns Boolean value indicate whether the token is about to expire\n */\n private isAccessTokenNearExpired(token: AccessToken): boolean {\n const expireDate = new Date(token.expiresOnTimestamp);\n if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n return false;\n }\n return true;\n }\n\n private generateAuthServerError(err: any): Error {\n let errorMessage = err.message;\n if (err.response?.data?.type) {\n errorMessage = err.response.data.detail;\n if (err.response.data.type === \"AadUiRequiredException\") {\n const fullErrorMsg =\n \"Failed to get access token from authentication server, please login first: \" +\n errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else {\n const fullErrorMsg =\n \"Failed to get access token from authentication server: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n\n const fullErrorMsg = \"Failed to get access token with error: \" + errorMessage;\n return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { TokenCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credential: TokenCredential;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - Credential used to invoke Microsoft Graph APIs.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n *\n * @beta\n */\n constructor(credential: TokenCredential, scopes?: string | string[]) {\n this.credential = credential;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);\n const accessToken = await this.credential.getToken(this.scopes);\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DialogContext, DialogTurnResult } from \"botbuilder-dialogs\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * loadConfiguration();\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n *\n * @beta\n */\nexport class TeamsBotSsoPrompt {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n constructor(dialogId: string, private settings: TeamsBotSsoPromptSettings) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @enum\r\n * Enum for RequestMethods\r\n * @property {string} GET - The get request type\r\n * @property {string} PATCH - The patch request type\r\n * @property {string} POST - The post request type\r\n * @property {string} PUT - The put request type\r\n * @property {string} DELETE - The delete request type\r\n */\r\nexport enum RequestMethod {\r\n\tGET = \"GET\",\r\n\tPATCH = \"PATCH\",\r\n\tPOST = \"POST\",\r\n\tPUT = \"PUT\",\r\n\tDELETE = \"DELETE\",\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module MiddlewareControl\r\n */\r\n\r\nimport { MiddlewareOptions } from \"./options/IMiddlewareOptions\";\r\n\r\n/**\r\n * @class\r\n * Class representing MiddlewareControl\r\n */\r\nexport class MiddlewareControl {\r\n\t/**\r\n\t * @private\r\n\t * A member holding map of MiddlewareOptions\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tprivate middlewareOptions: Map<Function, MiddlewareOptions>;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of MiddlewareControl\r\n\t * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions\r\n\t * @returns The instance of MiddlewareControl\r\n\t */\r\n\tpublic constructor(middlewareOptions: MiddlewareOptions[] = []) {\r\n\t\t// tslint:disable-next-line:ban-types\r\n\t\tthis.middlewareOptions = new Map<Function, MiddlewareOptions>();\r\n\t\tfor (const option of middlewareOptions) {\r\n\t\t\tconst fn = option.constructor;\r\n\t\t\tthis.middlewareOptions.set(fn, option);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the middleware option using the class of the option\r\n\t * @param {Function} fn - The class of the strongly typed option class\r\n\t * @returns The middleware option\r\n\t * @example\r\n\t * // if you wanted to return the middleware option associated with this class (MiddlewareControl)\r\n\t * // call this function like this:\r\n\t * getMiddlewareOptions(MiddlewareControl)\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tpublic getMiddlewareOptions(fn: Function): MiddlewareOptions {\r\n\t\treturn this.middlewareOptions.get(fn);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the middleware options using the class of the option\r\n\t * @param {Function} fn - The class of the strongly typed option class\r\n\t * @param {MiddlewareOptions} option - The strongly typed middleware option\r\n\t * @returns nothing\r\n\t */\r\n\t// tslint:disable-next-line:ban-types\r\n\tpublic setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void {\r\n\t\tthis.middlewareOptions.set(fn, option);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module MiddlewareUtil\r\n */\r\n\r\nimport { FetchOptions } from \"../IFetchOptions\";\r\n\r\n/**\r\n * @constant\r\n * To generate the UUID\r\n * @returns The UUID string\r\n */\r\nexport const generateUUID = (): string => {\r\n\tlet uuid: string = \"\";\r\n\tfor (let j = 0; j < 32; j++) {\r\n\t\tif (j === 8 || j === 12 || j === 16 || j === 20) {\r\n\t\t\tuuid += \"-\";\r\n\t\t}\r\n\t\tuuid += Math.floor(Math.random() * 16).toString(16);\r\n\t}\r\n\treturn uuid;\r\n};\r\n\r\n/**\r\n * @constant\r\n * To get the request header from the request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @returns A header value for the given key from the request\r\n */\r\nexport const getRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string): string | null => {\r\n\tlet value: string = null;\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\tvalue = (request as Request).headers.get(key);\r\n\t} else if (typeof options !== \"undefined\" && options.headers !== undefined) {\r\n\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\tvalue = (options.headers as Headers).get(key);\r\n\t\t} else if (options.headers instanceof Array) {\r\n\t\t\tconst headers = options.headers as string[][];\r\n\t\t\tfor (let i = 0, l = headers.length; i < l; i++) {\r\n\t\t\t\tif (headers[i][0] === key) {\r\n\t\t\t\t\tvalue = headers[i][1];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (options.headers[key] !== undefined) {\r\n\t\t\tvalue = options.headers[key];\r\n\t\t}\r\n\t}\r\n\treturn value;\r\n};\r\n\r\n/**\r\n * @constant\r\n * To set the header value to the given request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @param {string } value - The header value string\r\n * @returns Nothing\r\n */\r\nexport const setRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\t(request as Request).headers.set(key, value);\r\n\t} else if (typeof options !== \"undefined\") {\r\n\t\tif (options.headers === undefined) {\r\n\t\t\toptions.headers = new Headers({\r\n\t\t\t\t[key]: value,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\t\t(options.headers as Headers).set(key, value);\r\n\t\t\t} else if (options.headers instanceof Array) {\r\n\t\t\t\tlet i = 0;\r\n\t\t\t\tconst l = options.headers.length;\r\n\t\t\t\tfor (; i < l; i++) {\r\n\t\t\t\t\tconst header = options.headers[i];\r\n\t\t\t\t\tif (header[0] === key) {\r\n\t\t\t\t\t\theader[1] = value;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (i === l) {\r\n\t\t\t\t\t(options.headers as string[][]).push([key, value]);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tObject.assign(options.headers, { [key]: value });\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @constant\r\n * To append the header value to the given request\r\n * @param {RequestInfo} request - The request object or the url string\r\n * @param {FetchOptions|undefined} options - The request options object\r\n * @param {string} key - The header key string\r\n * @param {string } value - The header value string\r\n * @returns Nothing\r\n */\r\nexport const appendRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\r\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\r\n\t\t(request as Request).headers.append(key, value);\r\n\t} else if (typeof options !== \"undefined\") {\r\n\t\tif (options.headers === undefined) {\r\n\t\t\toptions.headers = new Headers({\r\n\t\t\t\t[key]: value,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\r\n\t\t\t\t(options.headers as Headers).append(key, value);\r\n\t\t\t} else if (options.headers instanceof Array) {\r\n\t\t\t\t(options.headers as string[][]).push([key, value]);\r\n\t\t\t} else if (options.headers === undefined) {\r\n\t\t\t\toptions.headers = { [key]: value };\r\n\t\t\t} else if (options.headers[key] === undefined) {\r\n\t\t\t\toptions.headers[key] = value;\r\n\t\t\t} else {\r\n\t\t\t\toptions.headers[key] += `, ${value}`;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * @constant\r\n * To clone the request with the new url\r\n * @param {string} url - The new url string\r\n * @param {Request} request - The request object\r\n * @returns A promise that resolves to request object\r\n */\r\nexport const cloneRequestWithNewUrl = async (newUrl: string, request: Request): Promise<Request> => {\r\n\tconst body = request.headers.get(\"Content-Type\") ? await request.blob() : await Promise.resolve(undefined);\r\n\tconst { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request;\r\n\treturn new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal });\r\n};\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module AuthenticationHandlerOptions\r\n */\r\n\r\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\r\nimport { AuthenticationProviderOptions } from \"../../IAuthenticationProviderOptions\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class representing AuthenticationHandlerOptions\r\n */\r\nexport class AuthenticationHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @public\r\n\t * A member holding an instance of an authentication provider\r\n\t */\r\n\tpublic authenticationProvider: AuthenticationProvider;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding an instance of authentication provider options\r\n\t */\r\n\tpublic authenticationProviderOptions: AuthenticationProviderOptions;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of AuthenticationHandlerOptions\r\n\t * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance\r\n\t * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance\r\n\t * @returns An instance of AuthenticationHandlerOptions\r\n\t */\r\n\tpublic constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions) {\r\n\t\tthis.authenticationProvider = authenticationProvider;\r\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module TelemetryHandlerOptions\r\n */\r\n\r\nimport { Context } from \"../../IContext\";\r\nimport { MiddlewareControl } from \"../MiddlewareControl\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @enum\r\n * @property {number} NONE - The hexadecimal flag value for nothing enabled\r\n * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled\r\n * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled\r\n * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled\r\n */\r\nexport enum FeatureUsageFlag {\r\n\tNONE = 0x0,\r\n\tREDIRECT_HANDLER_ENABLED = 0x1,\r\n\tRETRY_HANDLER_ENABLED = 0x2,\r\n\tAUTHENTICATION_HANDLER_ENABLED = 0x4,\r\n}\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class for TelemetryHandlerOptions\r\n */\r\n\r\nexport class TelemetryHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * A member to hold the OR of feature usage flags\r\n\t */\r\n\tprivate featureUsage: FeatureUsageFlag = FeatureUsageFlag.NONE;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To update the feature usage in the context object\r\n\t * @param {Context} context - The request context object containing middleware options\r\n\t * @param {FeatureUsageFlag} flag - The flag value\r\n\t * @returns nothing\r\n\t */\r\n\tpublic static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void {\r\n\t\tlet options: TelemetryHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\r\n\t\t} else {\r\n\t\t\tcontext.middlewareControl = new MiddlewareControl();\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = new TelemetryHandlerOptions();\r\n\t\t\tcontext.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options);\r\n\t\t}\r\n\t\toptions.setFeatureUsage(flag);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To set the feature usage flag\r\n\t * @param {FeatureUsageFlag} flag - The flag value\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setFeatureUsage(flag: FeatureUsageFlag): void {\r\n\t\t/* tslint:disable: no-bitwise */\r\n\t\tthis.featureUsage = this.featureUsage | flag;\r\n\t\t/* tslint:enable: no-bitwise */\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the feature usage\r\n\t * @returns A feature usage flag as hexadecimal string\r\n\t */\r\n\tpublic getFeatureUsage(): string {\r\n\t\treturn this.featureUsage.toString(16);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module AuthenticationHandler\r\n */\r\n\r\nimport { AuthenticationProvider } from \"../IAuthenticationProvider\";\r\nimport { AuthenticationProviderOptions } from \"../IAuthenticationProviderOptions\";\r\nimport { Context } from \"../IContext\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { appendRequestHeader } from \"./MiddlewareUtil\";\r\nimport { AuthenticationHandlerOptions } from \"./options/AuthenticationHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class representing AuthenticationHandler\r\n */\r\nexport class AuthenticationHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * A member representing the authorization header name\r\n\t */\r\n\tprivate static AUTHORIZATION_HEADER: string = \"Authorization\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold an AuthenticationProvider instance\r\n\t */\r\n\tprivate authenticationProvider: AuthenticationProvider;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of AuthenticationHandler\r\n\t * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler\r\n\t */\r\n\tpublic constructor(authenticationProvider: AuthenticationProvider) {\r\n\t\tthis.authenticationProvider = authenticationProvider;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tlet options: AuthenticationHandlerOptions;\r\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions) as AuthenticationHandlerOptions;\r\n\t\t\t}\r\n\t\t\tlet authenticationProvider: AuthenticationProvider;\r\n\t\t\tlet authenticationProviderOptions: AuthenticationProviderOptions;\r\n\t\t\tif (typeof options !== \"undefined\") {\r\n\t\t\t\tauthenticationProvider = options.authenticationProvider;\r\n\t\t\t\tauthenticationProviderOptions = options.authenticationProviderOptions;\r\n\t\t\t}\r\n\t\t\tif (typeof authenticationProvider === \"undefined\") {\r\n\t\t\t\tauthenticationProvider = this.authenticationProvider;\r\n\t\t\t}\r\n\t\t\tconst token: string = await authenticationProvider.getAccessToken(authenticationProviderOptions);\r\n\t\t\tconst bearerKey: string = `Bearer ${token}`;\r\n\t\t\tappendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey);\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED);\r\n\t\t\treturn await this.nextMiddleware.execute(context);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPMessageHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for HTTPMessageHandler\r\n */\r\nexport class HTTPMessageHandler implements Middleware {\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The request context object\r\n\t * @returns A promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tcontext.response = await fetch(context.request, context.options);\r\n\t\t\treturn;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RetryHandlerOptions\r\n */\r\n\r\nimport { FetchOptions } from \"../../IFetchOptions\";\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @type\r\n * A type declaration for shouldRetry callback\r\n */\r\nexport type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean;\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * Class for RetryHandlerOptions\r\n */\r\n\r\nexport class RetryHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default delay value in seconds\r\n\t */\r\n\tprivate static DEFAULT_DELAY: number = 3;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default maxRetries value\r\n\t */\r\n\tprivate static DEFAULT_MAX_RETRIES: number = 3;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum delay value in seconds\r\n\t */\r\n\tprivate static MAX_DELAY: number = 180;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum maxRetries value\r\n\t */\r\n\tprivate static MAX_MAX_RETRIES: number = 10;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding delay value in seconds\r\n\t */\r\n\tpublic delay: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding maxRetries value\r\n\t */\r\n\tpublic maxRetries: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding shouldRetry callback\r\n\t */\r\n\tpublic shouldRetry: ShouldRetry;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding default shouldRetry callback\r\n\t */\r\n\tprivate static DEFAULT_SHOULD_RETRY: ShouldRetry = () => true;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RetryHandlerOptions\r\n\t * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds\r\n\t * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value\r\n\t * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function\r\n\t * @returns An instance of RetryHandlerOptions\r\n\t */\r\n\tpublic constructor(delay: number = RetryHandlerOptions.DEFAULT_DELAY, maxRetries: number = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry: ShouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY) {\r\n\t\tif (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\r\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay > RetryHandlerOptions.MAX_DELAY) {\r\n\t\t\tconst error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\r\n\t\t\tconst error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay < 0 && maxRetries < 0) {\r\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t} else if (delay < 0) {\r\n\t\t\tconst error = new Error(`Delay should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t} else if (maxRetries < 0) {\r\n\t\t\tconst error = new Error(`MaxRetries should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY);\r\n\t\tthis.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES);\r\n\t\tthis.shouldRetry = shouldRetry;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To get the maximum delay\r\n\t * @returns A maximum delay\r\n\t */\r\n\tpublic getMaxDelay(): number {\r\n\t\treturn RetryHandlerOptions.MAX_DELAY;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RetryHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\nimport { FetchOptions } from \"../IFetchOptions\";\r\nimport { RequestMethod } from \"../RequestMethod\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { RetryHandlerOptions } from \"./options/RetryHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for RetryHandler\r\n */\r\nexport class RetryHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A list of status codes that needs to be retried\r\n\t */\r\n\tprivate static RETRY_STATUS_CODES: number[] = [\r\n\t\t429, // Too many requests\r\n\t\t503, // Service unavailable\r\n\t\t504, // Gateway timeout\r\n\t];\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of retry attempt header\r\n\t */\r\n\tprivate static RETRY_ATTEMPT_HEADER: string = \"Retry-Attempt\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of retry after header\r\n\t */\r\n\tprivate static RETRY_AFTER_HEADER: string = \"Retry-After\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding the retry handler options\r\n\t */\r\n\tprivate options: RetryHandlerOptions;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RetryHandler\r\n\t * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value\r\n\t * @returns An instance of RetryHandler\r\n\t */\r\n\tpublic constructor(options: RetryHandlerOptions = new RetryHandlerOptions()) {\r\n\t\tthis.options = options;\r\n\t}\r\n\r\n\t/**\r\n\t *\r\n\t * @private\r\n\t * To check whether the response has the retry status code\r\n\t * @param {Response} response - The response object\r\n\t * @returns Whether the response has retry status code or not\r\n\t */\r\n\tprivate isRetry(response: Response): boolean {\r\n\t\treturn RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the payload is buffered or not\r\n\t * @param {RequestInfo} request - The url string or the request object value\r\n\t * @param {FetchOptions} options - The options of a request\r\n\t * @returns Whether the payload is buffered or not\r\n\t */\r\n\tprivate isBuffered(request: RequestInfo, options: FetchOptions | undefined): boolean {\r\n\t\tconst method = typeof request === \"string\" ? options.method : (request as Request).method;\r\n\t\tconst isPutPatchOrPost: boolean = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST;\r\n\t\tif (isPutPatchOrPost) {\r\n\t\t\tconst isStream = getRequestHeader(request, options, \"Content-Type\") === \"application/octet-stream\";\r\n\t\t\tif (isStream) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the delay for a retry\r\n\t * @param {Response} response - The response object\r\n\t * @param {number} retryAttempts - The current attempt count\r\n\t * @param {number} delay - The delay value in seconds\r\n\t * @returns A delay for a retry\r\n\t */\r\n\tprivate getDelay(response: Response, retryAttempts: number, delay: number): number {\r\n\t\tconst getRandomness = () => Number(Math.random().toFixed(3));\r\n\t\tconst retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null;\r\n\t\tlet newDelay: number;\r\n\t\tif (retryAfter !== null) {\r\n\t\t\t// tslint:disable: prefer-conditional-expression\r\n\t\t\tif (Number.isNaN(Number(retryAfter))) {\r\n\t\t\t\tnewDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000);\r\n\t\t\t} else {\r\n\t\t\t\tnewDelay = Number(retryAfter);\r\n\t\t\t}\r\n\t\t\t// tslint:enable: prefer-conditional-expression\r\n\t\t} else {\r\n\t\t\t// Adding randomness to avoid retrying at a same\r\n\t\t\tnewDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness();\r\n\t\t}\r\n\t\treturn Math.min(newDelay, this.options.getMaxDelay() + getRandomness());\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get an exponential back off value\r\n\t * @param {number} attempts - The current attempt count\r\n\t * @returns An exponential back off value\r\n\t */\r\n\tprivate getExponentialBackOffTime(attempts: number): number {\r\n\t\treturn Math.round((1 / 2) * (2 ** attempts - 1));\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To add delay for the execution\r\n\t * @param {number} delaySeconds - The delay value in seconds\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate async sleep(delaySeconds: number): Promise<void> {\r\n\t\tconst delayMilliseconds = delaySeconds * 1000;\r\n\t\treturn new Promise((resolve) => setTimeout(resolve, delayMilliseconds));\r\n\t}\r\n\r\n\tprivate getOptions(context: Context): RetryHandlerOptions {\r\n\t\tlet options: RetryHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(this.options.constructor) as RetryHandlerOptions;\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = Object.assign(new RetryHandlerOptions(), this.options);\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To execute the middleware with retries\r\n\t * @param {Context} context - The context object\r\n\t * @param {number} retryAttempts - The current attempt count\r\n\t * @param {RetryHandlerOptions} options - The retry middleware options instance\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tprivate async executeWithRetry(context: Context, retryAttempts: number, options: RetryHandlerOptions): Promise<void> {\r\n\t\ttry {\r\n\t\t\tawait this.nextMiddleware.execute(context);\r\n\t\t\tif (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) {\r\n\t\t\t\t++retryAttempts;\r\n\t\t\t\tsetRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());\r\n\t\t\t\tconst delay = this.getDelay(context.response, retryAttempts, options.delay);\r\n\t\t\t\tawait this.sleep(delay);\r\n\t\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst retryAttempts: number = 0;\r\n\t\t\tconst options: RetryHandlerOptions = this.getOptions(context);\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED);\r\n\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RedirectHandlerOptions\r\n */\r\n\r\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\r\n\r\n/**\r\n * @type\r\n * A type declaration for shouldRetry callback\r\n */\r\nexport type ShouldRedirect = (response: Response) => boolean;\r\n\r\n/**\r\n * @class\r\n * @implements MiddlewareOptions\r\n * A class representing RedirectHandlerOptions\r\n */\r\nexport class RedirectHandlerOptions implements MiddlewareOptions {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding default max redirects value\r\n\t */\r\n\tprivate static DEFAULT_MAX_REDIRECTS: number = 5;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding maximum max redirects value\r\n\t */\r\n\tprivate static MAX_MAX_REDIRECTS: number = 20;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding max redirects value\r\n\t */\r\n\tpublic maxRedirects: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding shouldRedirect callback\r\n\t */\r\n\tpublic shouldRedirect: ShouldRedirect;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding default shouldRedirect callback\r\n\t */\r\n\tprivate static DEFAULT_SHOULD_RETRY: ShouldRedirect = () => true;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RedirectHandlerOptions\r\n\t * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value\r\n\t * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback\r\n\t * @returns An instance of RedirectHandlerOptions\r\n\t */\r\n\tpublic constructor(maxRedirects: number = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect: ShouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY) {\r\n\t\tif (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) {\r\n\t\t\tconst error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);\r\n\t\t\terror.name = \"MaxLimitExceeded\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tif (maxRedirects < 0) {\r\n\t\t\tconst error = new Error(`MaxRedirects should not be negative`);\r\n\t\t\terror.name = \"MinExpectationNotMet\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.maxRedirects = maxRedirects;\r\n\t\tthis.shouldRedirect = shouldRedirect;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module RedirectHandler\r\n */\r\n\r\nimport { Context } from \"../IContext\";\r\nimport { RequestMethod } from \"../RequestMethod\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { cloneRequestWithNewUrl, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { RedirectHandlerOptions } from \"./options/RedirectHandlerOptions\";\r\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * Class\r\n * @implements Middleware\r\n * Class representing RedirectHandler\r\n */\r\nexport class RedirectHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the array of redirect status codes\r\n\t */\r\n\tprivate static REDIRECT_STATUS_CODES: number[] = [\r\n\t\t301, // Moved Permanently\r\n\t\t302, // Found\r\n\t\t303, // See Other\r\n\t\t307, // Temporary Permanently\r\n\t\t308, // Moved Permanently\r\n\t];\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding SeeOther status code\r\n\t */\r\n\tprivate static STATUS_CODE_SEE_OTHER: number = 303;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the location header\r\n\t */\r\n\tprivate static LOCATION_HEADER: string = \"Location\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member representing the authorization header name\r\n\t */\r\n\tprivate static AUTHORIZATION_HEADER: string = \"Authorization\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the manual redirect value\r\n\t */\r\n\tprivate static MANUAL_REDIRECT: RequestRedirect = \"manual\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member holding options to customize the handler behavior\r\n\t */\r\n\tprivate options: RedirectHandlerOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * To create an instance of RedirectHandler\r\n\t * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance\r\n\t * @returns An instance of RedirectHandler\r\n\t */\r\n\r\n\tpublic constructor(options: RedirectHandlerOptions = new RedirectHandlerOptions()) {\r\n\t\tthis.options = options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the response has the redirect status code or not\r\n\t * @param {Response} response - The response object\r\n\t * @returns A boolean representing whether the response contains the redirect status code or not\r\n\t */\r\n\tprivate isRedirect(response: Response): boolean {\r\n\t\treturn RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the response has location header or not\r\n\t * @param {Response} response - The response object\r\n\t * @returns A boolean representing the whether the response has location header or not\r\n\t */\r\n\tprivate hasLocationHeader(response: Response): boolean {\r\n\t\treturn response.headers.has(RedirectHandler.LOCATION_HEADER);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the redirect url from location header in response object\r\n\t * @param {Response} response - The response object\r\n\t * @returns A redirect url from location header\r\n\t */\r\n\tprivate getLocationHeader(response: Response): string {\r\n\t\treturn response.headers.get(RedirectHandler.LOCATION_HEADER);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the given url is a relative url or not\r\n\t * @param {string} url - The url string value\r\n\t * @returns A boolean representing whether the given url is a relative url or not\r\n\t */\r\n\tprivate isRelativeURL(url: string): boolean {\r\n\t\treturn url.indexOf(\"://\") === -1;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To check whether the authorization header in the request should be dropped for consequent redirected requests\r\n\t * @param {string} requestUrl - The request url value\r\n\t * @param {string} redirectUrl - The redirect url value\r\n\t * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests\r\n\t */\r\n\tprivate shouldDropAuthorizationHeader(requestUrl: string, redirectUrl: string): boolean {\r\n\t\tconst schemeHostRegex: RegExp = /^[A-Za-z].+?:\\/\\/.+?(?=\\/|$)/;\r\n\t\tconst requestMatches: string[] = schemeHostRegex.exec(requestUrl);\r\n\t\tlet requestAuthority: string;\r\n\t\tlet redirectAuthority: string;\r\n\t\tif (requestMatches !== null) {\r\n\t\t\trequestAuthority = requestMatches[0];\r\n\t\t}\r\n\t\tconst redirectMatches: string[] = schemeHostRegex.exec(redirectUrl);\r\n\t\tif (redirectMatches !== null) {\r\n\t\t\tredirectAuthority = redirectMatches[0];\r\n\t\t}\r\n\t\treturn typeof requestAuthority !== \"undefined\" && typeof redirectAuthority !== \"undefined\" && requestAuthority !== redirectAuthority;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To update a request url with the redirect url\r\n\t * @param {string} redirectUrl - The redirect url value\r\n\t * @param {Context} context - The context object value\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate async updateRequestUrl(redirectUrl: string, context: Context): Promise<void> {\r\n\t\tcontext.request = typeof context.request === \"string\" ? redirectUrl : await cloneRequestWithNewUrl(redirectUrl, context.request as Request);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * To get the options for execution of the middleware\r\n\t * @param {Context} context - The context object\r\n\t * @returns A options for middleware execution\r\n\t */\r\n\tprivate getOptions(context: Context): RedirectHandlerOptions {\r\n\t\tlet options: RedirectHandlerOptions;\r\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions) as RedirectHandlerOptions;\r\n\t\t}\r\n\t\tif (typeof options === \"undefined\") {\r\n\t\t\toptions = Object.assign(new RedirectHandlerOptions(), this.options);\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * To execute the next middleware and to handle in case of redirect response returned by the server\r\n\t * @param {Context} context - The context object\r\n\t * @param {number} redirectCount - The redirect count value\r\n\t * @param {RedirectHandlerOptions} options - The redirect handler options instance\r\n\t * @returns A promise that resolves to nothing\r\n\t */\r\n\tprivate async executeWithRedirect(context: Context, redirectCount: number, options: RedirectHandlerOptions): Promise<void> {\r\n\t\ttry {\r\n\t\t\tawait this.nextMiddleware.execute(context);\r\n\t\t\tconst response = context.response;\r\n\t\t\tif (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) {\r\n\t\t\t\t++redirectCount;\r\n\t\t\t\tif (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) {\r\n\t\t\t\t\tcontext.options.method = RequestMethod.GET;\r\n\t\t\t\t\tdelete context.options.body;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconst redirectUrl: string = this.getLocationHeader(response);\r\n\t\t\t\t\tif (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) {\r\n\t\t\t\t\t\tdelete context.options.headers[RedirectHandler.AUTHORIZATION_HEADER];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tawait this.updateRequestUrl(redirectUrl, context);\r\n\t\t\t\t}\r\n\t\t\t\tawait this.executeWithRedirect(context, redirectCount, options);\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst redirectCount: number = 0;\r\n\t\t\tconst options = this.getOptions(context);\r\n\t\t\tcontext.options.redirect = RedirectHandler.MANUAL_REDIRECT;\r\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED);\r\n\t\t\treturn await this.executeWithRedirect(context, redirectCount, options);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module Constants\r\n */\r\n\r\n/**\r\n * @constant\r\n * A Default API endpoint version for a request\r\n */\r\nexport const GRAPH_API_VERSION = \"v1.0\";\r\n\r\n/**\r\n * @constant\r\n * A Default base url for a request\r\n */\r\nexport const GRAPH_BASE_URL = \"https://graph.microsoft.com/\";\r\n\r\n/**\r\n * To hold list of the service root endpoints for Microsoft Graph and Graph Explorer for each national cloud.\r\n * Set(iterable:Object) is not supported in Internet Explorer. The consumer is recommended to use a suitable polyfill.\r\n */\r\nexport const GRAPH_URLS = new Set<string>([\"graph.microsoft.com\", \"graph.microsoft.us\", \"dod-graph.microsoft.us\", \"graph.microsoft.de\", \"microsoftgraph.chinacloudapi.cn\"]);\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphRequestUtil\r\n */\r\nimport { GRAPH_URLS } from \"./Constants\";\r\n/**\r\n * To hold list of OData query params\r\n */\r\nexport const oDataQueryNames = [\"$select\", \"$expand\", \"$orderby\", \"$filter\", \"$top\", \"$skip\", \"$skipToken\", \"$count\"];\r\n\r\n/**\r\n * To construct the URL by appending the segments with \"/\"\r\n * @param {string[]} urlSegments - The array of strings\r\n * @returns The constructed URL string\r\n */\r\nexport const urlJoin = (urlSegments: string[]): string => {\r\n\tconst removePostSlash = (s) => s.replace(/\\/+$/, \"\");\r\n\tconst removePreSlash = (s) => s.replace(/^\\/+/, \"\");\r\n\tconst joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join(\"/\");\r\n\tconst parts = Array.prototype.slice.call(urlSegments);\r\n\treturn parts.reduce(joiner);\r\n};\r\n\r\n/**\r\n * Serializes the content\r\n * @param {any} content - The content value that needs to be serialized\r\n * @returns The serialized content\r\n *\r\n * Note:\r\n * This conversion is required due to the following reasons:\r\n * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string.\r\n * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers.\r\n * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`.\r\n * If the data received is in JSON format, `serializeContent` converts the JSON to string.\r\n */\r\n\r\nexport const serializeContent = (content: any): any => {\r\n\tconst className: string = content && content.constructor && content.constructor.name;\r\n\tif (className === \"Buffer\" || className === \"Blob\" || className === \"File\" || className === \"FormData\" || typeof content === \"string\") {\r\n\t\treturn content;\r\n\t}\r\n\tif (className === \"ArrayBuffer\") {\r\n\t\tcontent = Buffer.from(content);\r\n\t} else if (className === \"Int8Array\" || className === \"Int16Array\" || className === \"Int32Array\" || className === \"Uint8Array\" || className === \"Uint16Array\" || className === \"Uint32Array\" || className === \"Uint8ClampedArray\" || className === \"Float32Array\" || className === \"Float64Array\" || className === \"DataView\") {\r\n\t\tcontent = Buffer.from(content.buffer);\r\n\t} else {\r\n\t\ttry {\r\n\t\t\tcontent = JSON.stringify(content);\r\n\t\t} catch (error) {\r\n\t\t\tthrow new Error(\"Unable to stringify the content\");\r\n\t\t}\r\n\t}\r\n\treturn content;\r\n};\r\n\r\n/**\r\n * Checks if the url is one of the service root endpoints for Microsoft Graph and Graph Explorer.\r\n * @param {string} url - The url to be verified\r\n * @returns {boolean} - Returns true if the url is a Graph URL\r\n */\r\nexport const isGraphURL = (url: string): boolean => {\r\n\t// Valid Graph URL pattern - https://graph.microsoft.com/{version}/{resource}?{query-parameters}\r\n\t// Valid Graph URL example - https://graph.microsoft.com/v1.0/\r\n\turl = url.toLowerCase();\r\n\r\n\tif (url.indexOf(\"https://\") !== -1) {\r\n\t\turl = url.replace(\"https://\", \"\");\r\n\r\n\t\t// Find where the host ends\r\n\t\tconst startofPortNoPos = url.indexOf(\":\");\r\n\t\tconst endOfHostStrPos = url.indexOf(\"/\");\r\n\t\tlet hostName = \"\";\r\n\t\tif (endOfHostStrPos !== -1) {\r\n\t\t\tif (startofPortNoPos !== -1 && startofPortNoPos < endOfHostStrPos) {\r\n\t\t\t\thostName = url.substring(0, startofPortNoPos);\r\n\t\t\t\treturn GRAPH_URLS.has(hostName);\r\n\t\t\t}\r\n\t\t\t// Parse out the host\r\n\t\t\thostName = url.substring(0, endOfHostStrPos);\r\n\t\t\treturn GRAPH_URLS.has(hostName);\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n};\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module TelemetryHandler\r\n */\r\nimport { isGraphURL } from \"../GraphRequestUtil\";\r\nimport { Context } from \"../IContext\";\r\nimport { PACKAGE_VERSION } from \"../Version\";\r\n\r\nimport { Middleware } from \"./IMiddleware\";\r\nimport { MiddlewareControl } from \"./MiddlewareControl\";\r\nimport { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\r\nimport { TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\r\n\r\n/**\r\n * @class\r\n * @implements Middleware\r\n * Class for TelemetryHandler\r\n */\r\nexport class TelemetryHandler implements Middleware {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the client request id header\r\n\t */\r\n\tprivate static CLIENT_REQUEST_ID_HEADER = \"client-request-id\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the name of the sdk version header\r\n\t */\r\n\tprivate static SDK_VERSION_HEADER = \"SdkVersion\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the language prefix for the sdk version header value\r\n\t */\r\n\tprivate static PRODUCT_NAME = \"graph-js\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * A member holding the key for the feature usage metrics\r\n\t */\r\n\tprivate static FEATURE_USAGE_STRING = \"featureUsage\";\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold next middleware in the middleware chain\r\n\t */\r\n\tprivate nextMiddleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To execute the current middleware\r\n\t * @param {Context} context - The context object of the request\r\n\t * @returns A Promise that resolves to nothing\r\n\t */\r\n\tpublic async execute(context: Context): Promise<void> {\r\n\t\ttry {\r\n\t\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\r\n\t\t\tif (isGraphURL(url)) {\r\n\t\t\t\t// Add telemetry only if the request url is a Graph URL.\r\n\t\t\t\t// Errors are reported as in issue #265 if headers are present when redirecting to a non Graph URL\r\n\t\t\t\tlet clientRequestId: string = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER);\r\n\t\t\t\tif (!clientRequestId) {\r\n\t\t\t\t\tclientRequestId = generateUUID();\r\n\t\t\t\t\tsetRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId);\r\n\t\t\t\t}\r\n\t\t\t\tlet sdkVersionValue: string = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`;\r\n\t\t\t\tlet options: TelemetryHandlerOptions;\r\n\t\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\r\n\t\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\r\n\t\t\t\t}\r\n\t\t\t\tif (options) {\r\n\t\t\t\t\tconst featureUsage: string = options.getFeatureUsage();\r\n\t\t\t\t\tsdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`;\r\n\t\t\t\t}\r\n\t\t\t\tappendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue);\r\n\t\t\t} else {\r\n\t\t\t\t// Remove telemetry headers if present during redirection.\r\n\t\t\t\tdelete context.options.headers[TelemetryHandler.CLIENT_REQUEST_ID_HEADER];\r\n\t\t\t\tdelete context.options.headers[TelemetryHandler.SDK_VERSION_HEADER];\r\n\t\t\t}\r\n\t\t\treturn await this.nextMiddleware.execute(context);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To set the next middleware in the chain\r\n\t * @param {Middleware} next - The middleware instance\r\n\t * @returns Nothing\r\n\t */\r\n\tpublic setNext(next: Middleware): void {\r\n\t\tthis.nextMiddleware = next;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module ChaosStrategy\r\n */\r\n\r\n/**\r\n * Strategy used for Testing Handler\r\n * @enum\r\n */\r\nexport enum ChaosStrategy {\r\n\tMANUAL,\r\n\tRANDOM,\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @enum\r\n * Enum for ResponseType values\r\n * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer}\r\n * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob}\r\n * @property {string} DOCUMENT - This downloads content as a document or stream\r\n * @property {string} JSON - To download response content as a json\r\n * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html}\r\n * @property {string} TEXT - For downloading response as a text\r\n */\r\n\r\nexport enum ResponseType {\r\n\tARRAYBUFFER = \"arraybuffer\",\r\n\tBLOB = \"blob\",\r\n\tDOCUMENT = \"document\",\r\n\tJSON = \"json\",\r\n\tRAW = \"raw\",\r\n\tSTREAM = \"stream\",\r\n\tTEXT = \"text\",\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphResponseHandler\r\n */\r\n\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\nimport { ResponseType } from \"./ResponseType\";\r\n\r\n/**\r\n * @enum\r\n * Enum for document types\r\n * @property {string} TEXT_HTML - The text/html content type\r\n * @property {string} TEXT_XML - The text/xml content type\r\n * @property {string} APPLICATION_XML - The application/xml content type\r\n * @property {string} APPLICATION_XHTML - The application/xhml+xml content type\r\n */\r\nexport enum DocumentType {\r\n\tTEXT_HTML = \"text/html\",\r\n\tTEXT_XML = \"text/xml\",\r\n\tAPPLICATION_XML = \"application/xml\",\r\n\tAPPLICATION_XHTML = \"application/xhtml+xml\",\r\n}\r\n\r\n/**\r\n * @enum\r\n * Enum for Content types\r\n * @property {string} TEXT_PLAIN - The text/plain content type\r\n * @property {string} APPLICATION_JSON - The application/json content type\r\n */\r\n\r\nenum ContentType {\r\n\tTEXT_PLAIN = \"text/plain\",\r\n\tAPPLICATION_JSON = \"application/json\",\r\n}\r\n\r\n/**\r\n * @enum\r\n * Enum for Content type regex\r\n * @property {string} DOCUMENT - The regex to match document content types\r\n * @property {string} IMAGE - The regex to match image content types\r\n */\r\nenum ContentTypeRegexStr {\r\n\tDOCUMENT = \"^(text\\\\/(html|xml))|(application\\\\/(xml|xhtml\\\\+xml))$\",\r\n\tIMAGE = \"^image\\\\/.+\",\r\n}\r\n\r\n/**\r\n * @class\r\n * Class for GraphResponseHandler\r\n */\r\n\r\nexport class GraphResponseHandler {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * To parse Document response\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {DocumentType} type - The type to which the document needs to be parsed\r\n\t * @returns A promise that resolves to a document content\r\n\t */\r\n\tprivate static parseDocumentResponse(rawResponse: Response, type: DocumentType): Promise<any> {\r\n\t\ttry {\r\n\t\t\tif (typeof DOMParser !== \"undefined\") {\r\n\t\t\t\treturn new Promise((resolve, reject) => {\r\n\t\t\t\t\trawResponse.text().then((xmlString) => {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tconst parser = new DOMParser();\r\n\t\t\t\t\t\t\tconst xmlDoc = parser.parseFromString(xmlString, type);\r\n\t\t\t\t\t\t\tresolve(xmlDoc);\r\n\t\t\t\t\t\t} catch (error) {\r\n\t\t\t\t\t\t\treject(error);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\treturn Promise.resolve(rawResponse.body);\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * @async\r\n\t * To convert the native Response to response content\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {ResponseType} [responseType] - The response type value\r\n\t * @returns A promise that resolves to the converted response content\r\n\t */\r\n\tprivate static async convertResponse(rawResponse: Response, responseType?: ResponseType): Promise<any> {\r\n\t\tif (rawResponse.status === 204) {\r\n\t\t\t// NO CONTENT\r\n\t\t\treturn Promise.resolve();\r\n\t\t}\r\n\t\tlet responseValue: any;\r\n\t\ttry {\r\n\t\t\tswitch (responseType) {\r\n\t\t\t\tcase ResponseType.ARRAYBUFFER:\r\n\t\t\t\t\tresponseValue = await rawResponse.arrayBuffer();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.BLOB:\r\n\t\t\t\t\tresponseValue = await rawResponse.blob();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.DOCUMENT:\r\n\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.JSON:\r\n\t\t\t\t\tresponseValue = await rawResponse.json();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.STREAM:\r\n\t\t\t\t\tresponseValue = await Promise.resolve(rawResponse.body);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ResponseType.TEXT:\r\n\t\t\t\t\tresponseValue = await rawResponse.text();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tconst contentType = rawResponse.headers.get(\"Content-type\");\r\n\t\t\t\t\tif (contentType !== null) {\r\n\t\t\t\t\t\tconst mimeType = contentType.split(\";\")[0];\r\n\t\t\t\t\t\tif (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) {\r\n\t\t\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType as DocumentType);\r\n\t\t\t\t\t\t} else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) {\r\n\t\t\t\t\t\t\tresponseValue = rawResponse.blob();\r\n\t\t\t\t\t\t} else if (mimeType === ContentType.TEXT_PLAIN) {\r\n\t\t\t\t\t\t\tresponseValue = await rawResponse.text();\r\n\t\t\t\t\t\t} else if (mimeType === ContentType.APPLICATION_JSON) {\r\n\t\t\t\t\t\t\tresponseValue = await rawResponse.json();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t/**\r\n\t\t\t\t\t\t * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says:\r\n\t\t\t\t\t\t * A sender that generates a message containing a payload body SHOULD\r\n\t\t\t\t\t\t * generate a Content-Type header field in that message unless the\r\n\t\t\t\t\t\t * intended media type of the enclosed representation is unknown to the\r\n\t\t\t\t\t\t * sender. If a Content-Type header field is not present, the recipient\r\n\t\t\t\t\t\t * MAY either assume a media type of \"application/octet-stream\"\r\n\t\t\t\t\t\t * ([RFC2046], Section 4.5.1) or examine the data to determine its type.\r\n\t\t\t\t\t\t *\r\n\t\t\t\t\t\t * So assuming it as a stream type so returning the body.\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\treturn responseValue;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * @async\r\n\t * To get the parsed response\r\n\t * @param {Response} rawResponse - The response object\r\n\t * @param {ResponseType} [responseType] - The response type value\r\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\r\n\t * @returns The parsed response\r\n\t */\r\n\tpublic static async getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\tif (responseType === ResponseType.RAW) {\r\n\t\t\t\treturn Promise.resolve(rawResponse);\r\n\t\t\t} else {\r\n\t\t\t\tconst response = await GraphResponseHandler.convertResponse(rawResponse, responseType);\r\n\t\t\t\tif (rawResponse.ok) {\r\n\t\t\t\t\t// Status Code 2XX\r\n\t\t\t\t\tif (typeof callback === \"function\") {\r\n\t\t\t\t\t\tcallback(null, response);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn response;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// NOT OK Response\r\n\t\t\t\t\tthrow response;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module CustomAuthenticationProvider\r\n */\r\n\r\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\r\nimport { AuthProvider } from \"./IAuthProvider\";\r\n\r\n/**\r\n * @class\r\n * Class representing CustomAuthenticationProvider\r\n * @extends AuthenticationProvider\r\n */\r\nexport class CustomAuthenticationProvider implements AuthenticationProvider {\r\n\t/**\r\n\t * @private\r\n\t * A member to hold authProvider callback\r\n\t */\r\n\tprivate provider: AuthProvider;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of CustomAuthenticationProvider\r\n\t * @param {AuthProviderCallback} provider - An authProvider function\r\n\t * @returns An instance of CustomAuthenticationProvider\r\n\t */\r\n\tpublic constructor(provider: AuthProvider) {\r\n\t\tthis.provider = provider;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To get the access token\r\n\t * @returns The promise that resolves to an access token\r\n\t */\r\n\tpublic async getAccessToken(): Promise<any> {\r\n\t\treturn new Promise((resolve: (accessToken: string) => void, reject: (error: any) => void) => {\r\n\t\t\tthis.provider((error: any, accessToken: string | null) => {\r\n\t\t\t\tif (accessToken) {\r\n\t\t\t\t\tresolve(accessToken);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treject(error);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphError\r\n */\r\n\r\n/**\r\n * @class\r\n * Class for GraphError\r\n * @NOTE: This is NOT what is returned from the Graph\r\n * GraphError is created from parsing JSON errors returned from the graph\r\n * Some fields are renamed ie, \"request-id\" => requestId so you can use dot notation\r\n */\r\n\r\nexport class GraphError extends Error {\r\n\t/**\r\n\t * @public\r\n\t * A member holding status code of the error\r\n\t */\r\n\tpublic statusCode: number;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding code i.e name of the error\r\n\t */\r\n\tpublic code: string | null;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding request-id i.e identifier of the request\r\n\t */\r\n\tpublic requestId: string | null;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding processed date and time of the request\r\n\t */\r\n\tpublic date: Date;\r\n\r\n\t/**\r\n\t * @public\r\n\t * A member holding original error response by the graph service\r\n\t */\r\n\tpublic body: any;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of GraphError\r\n\t * @param {number} [statusCode = -1] - The status code of the error\r\n\t * @returns An instance of GraphError\r\n\t */\r\n\tpublic constructor(statusCode: number = -1, message?: string, baseError?: Error) {\r\n\t\tsuper(message || (baseError && baseError.message));\r\n\t\t// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n\t\tObject.setPrototypeOf(this, GraphError.prototype);\r\n\t\tthis.statusCode = statusCode;\r\n\t\tthis.code = null;\r\n\t\tthis.requestId = null;\r\n\t\tthis.date = new Date();\r\n\t\tthis.body = null;\r\n\t\tthis.stack = baseError ? baseError.stack : this.stack;\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphErrorHandler\r\n */\r\n\r\nimport { GraphError } from \"./GraphError\";\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\n\r\n/**\r\n * @class\r\n * Class for GraphErrorHandler\r\n */\r\n\r\nexport class GraphErrorHandler {\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * Populates the GraphError instance with Error instance values\r\n\t * @param {Error} error - The error returned by graph service or some native error\r\n\t * @param {number} [statusCode] - The status code of the response\r\n\t * @returns The GraphError instance\r\n\t */\r\n\tprivate static constructError(error: Error, statusCode?: number): GraphError {\r\n\t\tconst gError = new GraphError(statusCode, \"\", error);\r\n\t\tif (error.name !== undefined) {\r\n\t\t\tgError.code = error.name;\r\n\t\t}\r\n\t\tgError.body = error.toString();\r\n\t\tgError.date = new Date();\r\n\t\treturn gError;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @static\r\n\t * @async\r\n\t * Populates the GraphError instance from the Error returned by graph service\r\n\t * @param {any} error - The error returned by graph service or some native error\r\n\t * @param {number} statusCode - The status code of the response\r\n\t * @returns A promise that resolves to GraphError instance\r\n\t *\r\n\t * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo\r\n\t * {\r\n\t * \"error\": {\r\n\t * \"code\": \"SearchEvents\",\r\n\t * \"message\": \"The parameter $search is not currently supported on the Events resource.\",\r\n\t * \"innerError\": {\r\n\t * \"request-id\": \"b31c83fd-944c-4663-aa50-5d9ceb367e19\",\r\n\t * \"date\": \"2016-11-17T18:37:45\"\r\n\t * }\r\n\t * }\r\n\t * }\r\n\t */\r\n\tprivate static constructErrorFromResponse(error: any, statusCode: number): GraphError {\r\n\t\terror = error.error;\r\n\t\tconst gError = new GraphError(statusCode, error.message);\r\n\t\tgError.code = error.code;\r\n\t\tif (error.innerError !== undefined) {\r\n\t\t\tgError.requestId = error.innerError[\"request-id\"];\r\n\t\t\tgError.date = new Date(error.innerError.date);\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tgError.body = JSON.stringify(error);\r\n\t\t} catch (error) {\r\n\t\t\t// tslint:disable-line: no-empty\r\n\t\t}\r\n\t\treturn gError;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * @async\r\n\t * To get the GraphError object\r\n\t * @param {any} [error = null] - The error returned by graph service or some native error\r\n\t * @param {number} [statusCode = -1] - The status code of the response\r\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\r\n\t * @returns A promise that resolves to GraphError instance\r\n\t */\r\n\tpublic static async getError(error: any = null, statusCode: number = -1, callback?: GraphRequestCallback): Promise<GraphError> {\r\n\t\tlet gError: GraphError;\r\n\t\tif (error && error.error) {\r\n\t\t\tgError = GraphErrorHandler.constructErrorFromResponse(error, statusCode);\r\n\t\t} else if (typeof Error !== \"undefined\" && error instanceof Error) {\r\n\t\t\tgError = GraphErrorHandler.constructError(error, statusCode);\r\n\t\t} else {\r\n\t\t\tgError = new GraphError(statusCode);\r\n\t\t}\r\n\t\tif (typeof callback === \"function\") {\r\n\t\t\tcallback(gError, null);\r\n\t\t} else {\r\n\t\t\treturn gError;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module GraphRequest\r\n */\r\n\r\nimport { GraphError } from \"./GraphError\";\r\nimport { GraphErrorHandler } from \"./GraphErrorHandler\";\r\nimport { oDataQueryNames, serializeContent, urlJoin } from \"./GraphRequestUtil\";\r\nimport { GraphResponseHandler } from \"./GraphResponseHandler\";\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { ClientOptions } from \"./IClientOptions\";\r\nimport { Context } from \"./IContext\";\r\nimport { FetchOptions } from \"./IFetchOptions\";\r\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\r\nimport { MiddlewareControl } from \"./middleware/MiddlewareControl\";\r\nimport { MiddlewareOptions } from \"./middleware/options/IMiddlewareOptions\";\r\nimport { RequestMethod } from \"./RequestMethod\";\r\nimport { ResponseType } from \"./ResponseType\";\r\n/**\r\n * @interface\r\n * Signature to representing key value pairs\r\n * @property {[key: string] : string | number} - The Key value pair\r\n */\r\ninterface KeyValuePairObjectStringNumber {\r\n\t[key: string]: string | number;\r\n}\r\n\r\n/**\r\n * @interface\r\n * Signature to define URL components\r\n * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS\r\n *\r\n * @property {string} host - The host to which the request needs to be made\r\n * @property {string} version - Version of the graph endpoint\r\n * @property {string} [path] - The path of the resource request\r\n * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params\r\n * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request\r\n * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'\r\n */\r\nexport interface URLComponents {\r\n\thost: string;\r\n\tversion: string;\r\n\tpath?: string;\r\n\toDataQueryParams: KeyValuePairObjectStringNumber;\r\n\totherURLQueryParams: KeyValuePairObjectStringNumber;\r\n\totherURLQueryOptions?: string[];\r\n}\r\n\r\n/**\r\n * @class\r\n * A Class representing GraphRequest\r\n */\r\nexport class GraphRequest {\r\n\t/**\r\n\t * @private\r\n\t * A member variable to hold HTTPClient instance\r\n\t */\r\n\tprivate httpClient: HTTPClient;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member variable to hold client options\r\n\t */\r\n\tprivate config: ClientOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold URL Components data\r\n\t */\r\n\tprivate urlComponents: URLComponents;\r\n\r\n\t/* tslint:disable: variable-name */\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom header options for a request\r\n\t */\r\n\tprivate _headers: HeadersInit;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom options for a request\r\n\t */\r\n\tprivate _options: FetchOptions;\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold the array of middleware options for a request\r\n\t */\r\n\tprivate _middlewareOptions: MiddlewareOptions[];\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member to hold custom response type for a request\r\n\t */\r\n\tprivate _responseType: ResponseType;\r\n\t/* tslint:enable: variable-name */\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of GraphRequest\r\n\t * @param {HTTPClient} httpClient - The HTTPClient instance\r\n\t * @param {ClientOptions} config - The options for making request\r\n\t * @param {string} path - A path string\r\n\t */\r\n\tpublic constructor(httpClient: HTTPClient, config: ClientOptions, path: string) {\r\n\t\tthis.httpClient = httpClient;\r\n\t\tthis.config = config;\r\n\t\tthis.urlComponents = {\r\n\t\t\thost: this.config.baseUrl,\r\n\t\t\tversion: this.config.defaultVersion,\r\n\t\t\toDataQueryParams: {},\r\n\t\t\totherURLQueryParams: {},\r\n\t\t\totherURLQueryOptions: [],\r\n\t\t};\r\n\t\tthis._headers = {};\r\n\t\tthis._options = {};\r\n\t\tthis._middlewareOptions = [];\r\n\t\tthis.parsePath(path);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the path string and creates URLComponents out of it\r\n\t * @param {string} path - The request path string\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate parsePath = (path: string): void => {\r\n\t\t// Strips out the base of the url if they passed in\r\n\t\tif (path.indexOf(\"https://\") !== -1) {\r\n\t\t\tpath = path.replace(\"https://\", \"\");\r\n\r\n\t\t\t// Find where the host ends\r\n\t\t\tconst endOfHostStrPos = path.indexOf(\"/\");\r\n\t\t\tif (endOfHostStrPos !== -1) {\r\n\t\t\t\t// Parse out the host\r\n\t\t\t\tthis.urlComponents.host = \"https://\" + path.substring(0, endOfHostStrPos);\r\n\t\t\t\t// Strip the host from path\r\n\t\t\t\tpath = path.substring(endOfHostStrPos + 1, path.length);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove the following version\r\n\t\t\tconst endOfVersionStrPos = path.indexOf(\"/\");\r\n\t\t\tif (endOfVersionStrPos !== -1) {\r\n\t\t\t\t// Parse out the version\r\n\t\t\t\tthis.urlComponents.version = path.substring(0, endOfVersionStrPos);\r\n\t\t\t\t// Strip version from path\r\n\t\t\t\tpath = path.substring(endOfVersionStrPos + 1, path.length);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Strip out any leading \"/\"\r\n\t\tif (path.charAt(0) === \"/\") {\r\n\t\t\tpath = path.substr(1);\r\n\t\t}\r\n\r\n\t\tconst queryStrPos = path.indexOf(\"?\");\r\n\t\tif (queryStrPos === -1) {\r\n\t\t\t// No query string\r\n\t\t\tthis.urlComponents.path = path;\r\n\t\t} else {\r\n\t\t\tthis.urlComponents.path = path.substr(0, queryStrPos);\r\n\r\n\t\t\t// Capture query string into oDataQueryParams and otherURLQueryParams\r\n\t\t\tconst queryParams = path.substring(queryStrPos + 1, path.length).split(\"&\");\r\n\t\t\tfor (const queryParam of queryParams) {\r\n\t\t\t\tthis.parseQueryParameter(queryParam);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * @private\r\n\t * Adds the query parameter as comma separated values\r\n\t * @param {string} propertyName - The name of a property\r\n\t * @param {string|string[]} propertyValue - The vale of a property\r\n\t * @param {IArguments} additionalProperties - The additional properties\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate addCsvQueryParameter(propertyName: string, propertyValue: string | string[], additionalProperties: IArguments): void {\r\n\t\t// If there are already $propertyName value there, append a \",\"\r\n\t\tthis.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + \",\" : \"\";\r\n\r\n\t\tlet allValues: string[] = [];\r\n\r\n\t\tif (additionalProperties.length > 1 && typeof propertyValue === \"string\") {\r\n\t\t\tallValues = Array.prototype.slice.call(additionalProperties);\r\n\t\t} else if (typeof propertyValue === \"string\") {\r\n\t\t\tallValues.push(propertyValue);\r\n\t\t} else {\r\n\t\t\tallValues = allValues.concat(propertyValue);\r\n\t\t}\r\n\r\n\t\tthis.urlComponents.oDataQueryParams[propertyName] += allValues.join(\",\");\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Builds the full url from the URLComponents to make a request\r\n\t * @returns The URL string that is qualified to make a request to graph endpoint\r\n\t */\r\n\tprivate buildFullUrl(): string {\r\n\t\tconst url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString();\r\n\r\n\t\tif (this.config.debugLogging) {\r\n\t\t\tconsole.log(url); // tslint:disable-line: no-console\r\n\t\t}\r\n\t\treturn url;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Builds the query string from the URLComponents\r\n\t * @returns The Constructed query string\r\n\t */\r\n\tprivate createQueryString(): string {\r\n\t\t// Combining query params from oDataQueryParams and otherURLQueryParams\r\n\t\tconst urlComponents = this.urlComponents;\r\n\t\tconst query: string[] = [];\r\n\t\tif (Object.keys(urlComponents.oDataQueryParams).length !== 0) {\r\n\t\t\tfor (const property in urlComponents.oDataQueryParams) {\r\n\t\t\t\tif (urlComponents.oDataQueryParams.hasOwnProperty(property)) {\r\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.oDataQueryParams[property]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (Object.keys(urlComponents.otherURLQueryParams).length !== 0) {\r\n\t\t\tfor (const property in urlComponents.otherURLQueryParams) {\r\n\t\t\t\tif (urlComponents.otherURLQueryParams.hasOwnProperty(property)) {\r\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.otherURLQueryParams[property]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (urlComponents.otherURLQueryOptions.length !== 0) {\r\n\t\t\tfor (const str of urlComponents.otherURLQueryOptions) {\r\n\t\t\t\tquery.push(str);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn query.length > 0 ? \"?\" + query.join(\"&\") : \"\";\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the query parameters to set the urlComponents property of the GraphRequest object\r\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tprivate parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\r\n\t\tif (typeof queryDictionaryOrString === \"string\") {\r\n\t\t\tif (queryDictionaryOrString.charAt(0) === \"?\") {\r\n\t\t\t\tqueryDictionaryOrString = queryDictionaryOrString.substring(1);\r\n\t\t\t}\r\n\r\n\t\t\tif (queryDictionaryOrString.indexOf(\"&\") !== -1) {\r\n\t\t\t\tconst queryParams = queryDictionaryOrString.split(\"&\");\r\n\t\t\t\tfor (const str of queryParams) {\r\n\t\t\t\t\tthis.parseQueryParamenterString(str);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.parseQueryParamenterString(queryDictionaryOrString);\r\n\t\t\t}\r\n\t\t} else if (queryDictionaryOrString.constructor === Object) {\r\n\t\t\tfor (const key in queryDictionaryOrString) {\r\n\t\t\t\tif (queryDictionaryOrString.hasOwnProperty(key)) {\r\n\t\t\t\t\tthis.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object\r\n\t * @param {string} queryParameter - the query parameters\r\n\t * returns nothing\r\n\t */\r\n\tprivate parseQueryParamenterString(queryParameter: string): void {\r\n\t\t/* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters.\r\n\t\t\t\t Example-> \"/me?$expand=home($select=city)\" */\r\n\t\tif (this.isValidQueryKeyValuePair(queryParameter)) {\r\n\t\t\tconst indexOfFirstEquals = queryParameter.indexOf(\"=\");\r\n\t\t\tconst paramKey = queryParameter.substring(0, indexOfFirstEquals);\r\n\t\t\tconst paramValue = queryParameter.substring(indexOfFirstEquals + 1);\r\n\t\t\tthis.setURLComponentsQueryParamater(paramKey, paramValue);\r\n\t\t} else {\r\n\t\t\t/* Push values which are not of key-value structure.\r\n\t\t\tExample-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/\r\n\t\t\tthis.urlComponents.otherURLQueryOptions.push(queryParameter);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Sets values into the urlComponents property of GraphRequest object.\r\n\t * @param {string} paramKey - the query parameter key\r\n\t * @param {string} paramValue - the query paramter value\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setURLComponentsQueryParamater(paramKey: string, paramValue: string | number): void {\r\n\t\tif (oDataQueryNames.indexOf(paramKey) !== -1) {\r\n\t\t\tconst currentValue = this.urlComponents.oDataQueryParams[paramKey];\r\n\t\t\tconst isValueAppendable = currentValue && (paramKey === \"$expand\" || paramKey === \"$select\" || paramKey === \"$orderby\");\r\n\t\t\tthis.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + \",\" + paramValue : paramValue;\r\n\t\t} else {\r\n\t\t\tthis.urlComponents.otherURLQueryParams[paramKey] = paramValue;\r\n\t\t}\r\n\t}\r\n\t/**\r\n\t * @private\r\n\t * Check if the query parameter string has a valid key-value structure\r\n\t * @param {string} queryString - the query parameter string. Example -> \"name=value\"\r\n\t * #returns true if the query string has a valid key-value structure else false\r\n\t */\r\n\tprivate isValidQueryKeyValuePair(queryString: string): boolean {\r\n\t\tconst indexofFirstEquals = queryString.indexOf(\"=\");\r\n\t\tif (indexofFirstEquals === -1) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tconst indexofOpeningParanthesis = queryString.indexOf(\"(\");\r\n\t\tif (indexofOpeningParanthesis !== -1 && queryString.indexOf(\"(\") < indexofFirstEquals) {\r\n\t\t\t// Example -> .query($select($expand=true));\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Updates the custom headers and options for a request\r\n\t * @param {FetchOptions} options - The request options object\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate updateRequestOptions(options: FetchOptions): void {\r\n\t\tconst optionsHeaders: HeadersInit = { ...options.headers };\r\n\t\tif (this.config.fetchOptions !== undefined) {\r\n\t\t\tconst fetchOptions: FetchOptions = { ...this.config.fetchOptions };\r\n\t\t\tObject.assign(options, fetchOptions);\r\n\t\t\tif (typeof this.config.fetchOptions.headers !== undefined) {\r\n\t\t\t\toptions.headers = { ...this.config.fetchOptions.headers };\r\n\t\t\t}\r\n\t\t}\r\n\t\tObject.assign(options, this._options);\r\n\t\tif (options.headers !== undefined) {\r\n\t\t\tObject.assign(optionsHeaders, options.headers);\r\n\t\t}\r\n\t\tObject.assign(optionsHeaders, this._headers);\r\n\t\toptions.headers = optionsHeaders;\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @async\r\n\t * Adds the custom headers and options to the request and makes the HTTPClient send request call\r\n\t * @param {RequestInfo} request - The request url string or the Request object value\r\n\t * @param {FetchOptions} options - The options to make a request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the response content\r\n\t */\r\n\tprivate async send(request: RequestInfo, options: FetchOptions, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tlet rawResponse: Response;\r\n\t\tconst middlewareControl = new MiddlewareControl(this._middlewareOptions);\r\n\t\tthis.updateRequestOptions(options);\r\n\t\ttry {\r\n\t\t\tconst context: Context = await this.httpClient.sendRequest({\r\n\t\t\t\trequest,\r\n\t\t\t\toptions,\r\n\t\t\t\tmiddlewareControl,\r\n\t\t\t});\r\n\t\t\trawResponse = context.response;\r\n\t\t\tconst response: any = await GraphResponseHandler.getResponse(rawResponse, this._responseType, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tlet statusCode: number;\r\n\t\t\tif (typeof rawResponse !== \"undefined\") {\r\n\t\t\t\tstatusCode = rawResponse.status;\r\n\t\t\t}\r\n\t\t\tconst gError: GraphError = await GraphErrorHandler.getError(error, statusCode, callback);\r\n\t\t\tthrow gError;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json\r\n\t * @param none\r\n\t * @returns nothing\r\n\t */\r\n\tprivate setHeaderContentType(): void {\r\n\t\tif (!this._headers) {\r\n\t\t\tthis.header(\"Content-Type\", \"application/json\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst headerKeys = Object.keys(this._headers);\r\n\t\tfor (const headerKey of headerKeys) {\r\n\t\t\tif (headerKey.toLowerCase() === \"content-type\") {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Default the content-type to application/json in case the content-type is not present in the header\r\n\t\tthis.header(\"Content-Type\", \"application/json\");\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the custom header for a request\r\n\t * @param {string} headerKey - A header key\r\n\t * @param {string} headerValue - A header value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic header(headerKey: string, headerValue: string): GraphRequest {\r\n\t\tthis._headers[headerKey] = headerValue;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the custom headers for a request\r\n\t * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest {\r\n\t\tfor (const key in headers) {\r\n\t\t\tif (headers.hasOwnProperty(key)) {\r\n\t\t\t\tthis._headers[key] = headers[key] as string;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the option for making a request\r\n\t * @param {string} key - The key value\r\n\t * @param {any} value - The value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic option(key: string, value: any): GraphRequest {\r\n\t\tthis._options[key] = value;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the options for making a request\r\n\t * @param {{ [key: string]: any }} options - The options key value pair\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic options(options: { [key: string]: any }): GraphRequest {\r\n\t\tfor (const key in options) {\r\n\t\t\tif (options.hasOwnProperty(key)) {\r\n\t\t\t\tthis._options[key] = options[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the middleware options for a request\r\n\t * @param {MiddlewareOptions[]} options - The array of middleware options\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic middlewareOptions(options: MiddlewareOptions[]): GraphRequest {\r\n\t\tthis._middlewareOptions = options;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the api endpoint version for a request\r\n\t * @param {string} version - The version value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic version(version: string): GraphRequest {\r\n\t\tthis.urlComponents.version = version;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Sets the api endpoint version for a request\r\n\t * @param {ResponseType} responseType - The response type value\r\n\t * @returns The same GraphRequest instance that is being called with\r\n\t */\r\n\tpublic responseType(responseType: ResponseType): GraphRequest {\r\n\t\tthis._responseType = responseType;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for select OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query\r\n\t */\r\n\t/*\r\n\t * Accepts .select(\"displayName,birthday\")\r\n\t * and .select([\"displayName\", \"birthday\"])\r\n\t * and .select(\"displayName\", \"birthday\")\r\n\t *\r\n\t */\r\n\tpublic select(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$select\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for expand OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query\r\n\t */\r\n\tpublic expand(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$expand\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add properties for orderby OData Query param\r\n\t * @param {string|string[]} properties - The Properties value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query\r\n\t */\r\n\tpublic orderby(properties: string | string[]): GraphRequest {\r\n\t\tthis.addCsvQueryParameter(\"$orderby\", properties, arguments);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string.\r\n\t * @param {string} filterStr - The filter query string\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the $filter query\r\n\t */\r\n\tpublic filter(filterStr: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$filter = filterStr;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string.\r\n\t * @param {string} searchStr - The search criterion string\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria\r\n\t */\r\n\tpublic search(searchStr: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$search = searchStr;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value.\r\n\t * @param {number} n - The number value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for $top query\r\n\t */\r\n\tpublic top(n: number): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$top = n;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value.\r\n\t * @param {number} n - The number value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query\r\n\t */\r\n\tpublic skip(n: number): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$skip = n;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value.\r\n\t * @param {string} token - The token value\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option\r\n\t */\r\n\tpublic skipToken(token: string): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$skipToken = token;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value.\r\n\t * @param {boolean} isCount - The count boolean\r\n\t * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option\r\n\t */\r\n\tpublic count(isCount: boolean = false): GraphRequest {\r\n\t\tthis.urlComponents.oDataQueryParams.$count = isCount.toString();\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Appends query string to the urlComponent\r\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value\r\n\t * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component\r\n\t */\r\n\t/*\r\n\t * Accepts .query(\"displayName=xyz\")\r\n\t * and .select({ name: \"value\" })\r\n\t */\r\n\tpublic query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\r\n\t\treturn this.parseQueryParameter(queryDictionaryOrString);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the get response\r\n\t */\r\n\tpublic async get(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.GET,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with POST method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the post response\r\n\t */\r\n\tpublic async post(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.POST,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\tconst className: string = content && content.constructor && content.constructor.name;\r\n\t\tif (className === \"FormData\") {\r\n\t\t\t// Content-Type headers should not be specified in case the of FormData type content\r\n\t\t\toptions.headers = {};\r\n\t\t} else {\r\n\t\t\tthis.setHeaderContentType();\r\n\t\t\toptions.headers = this._headers;\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for Post request call\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the post response\r\n\t */\r\n\tpublic async create(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.post(content, callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with PUT method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the put response\r\n\t */\r\n\tpublic async put(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tthis.setHeaderContentType();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.PUT,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with PATCH method\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the patch response\r\n\t */\r\n\tpublic async patch(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tthis.setHeaderContentType();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.PATCH,\r\n\t\t\tbody: serializeContent(content),\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for PATCH request\r\n\t * @param {any} content - The content that needs to be sent with the request\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the patch response\r\n\t */\r\n\tpublic async update(content: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.patch(content, callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes http request with DELETE method\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the delete response\r\n\t */\r\n\tpublic async delete(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options: FetchOptions = {\r\n\t\t\tmethod: RequestMethod.DELETE,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Alias for delete request call\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the delete response\r\n\t */\r\n\tpublic async del(callback?: GraphRequestCallback): Promise<any> {\r\n\t\ttry {\r\n\t\t\treturn await this.delete(callback);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method to read response as a stream.\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the getStream response\r\n\t */\r\n\tpublic async getStream(callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options = {\r\n\t\t\tmethod: RequestMethod.GET,\r\n\t\t};\r\n\t\tthis.responseType(ResponseType.STREAM);\r\n\t\ttry {\r\n\t\t\tconst stream = await this.send(url, options, callback);\r\n\t\t\treturn stream;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * Makes a http request with GET method to read response as a stream.\r\n\t * @param {any} stream - The stream instance\r\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\r\n\t * @returns A promise that resolves to the putStream response\r\n\t */\r\n\tpublic async putStream(stream: any, callback?: GraphRequestCallback): Promise<any> {\r\n\t\tconst url = this.buildFullUrl();\r\n\t\tconst options = {\r\n\t\t\tmethod: RequestMethod.PUT,\r\n\t\t\theaders: {\r\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\r\n\t\t\t},\r\n\t\t\tbody: stream,\r\n\t\t};\r\n\t\ttry {\r\n\t\t\tconst response = await this.send(url, options, callback);\r\n\t\t\treturn response;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPClient\r\n */\r\n\r\nimport { Context } from \"./IContext\";\r\nimport { Middleware } from \"./middleware/IMiddleware\";\r\n\r\n/**\r\n * @class\r\n * Class representing HTTPClient\r\n */\r\nexport class HTTPClient {\r\n\t/**\r\n\t * @private\r\n\t * A member holding first middleware of the middleware chain\r\n\t */\r\n\tprivate middleware: Middleware;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @constructor\r\n\t * Creates an instance of a HTTPClient\r\n\t * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\r\n\t */\r\n\tpublic constructor(...middleware: Middleware[]) {\r\n\t\tif (!middleware || !middleware.length) {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"InvalidMiddlewareChain\";\r\n\t\t\terror.message = \"Please provide a default middleware chain or custom middleware chain\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.setMiddleware(...middleware);\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Processes the middleware parameter passed to set this.middleware property\r\n\t * The calling function should validate if middleware is not undefined or not empty.\r\n\t * @param {...Middleware} middleware - The middleware passed\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate setMiddleware(...middleware: Middleware[]): void {\r\n\t\tif (middleware.length > 1) {\r\n\t\t\tthis.parseMiddleWareArray(middleware);\r\n\t\t} else {\r\n\t\t\tthis.middleware = middleware[0];\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * Processes the middleware array to construct the chain\r\n\t * and sets this.middleware property to the first middlware handler of the array\r\n\t * The calling function should validate if middleware is not undefined or not empty\r\n\t * @param {Middleware[]} middlewareArray - The array of middleware handlers\r\n\t * @returns Nothing\r\n\t */\r\n\tprivate parseMiddleWareArray(middlewareArray: Middleware[]) {\r\n\t\tmiddlewareArray.forEach((element, index) => {\r\n\t\t\tif (index < middlewareArray.length - 1) {\r\n\t\t\t\telement.setNext(middlewareArray[index + 1]);\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis.middleware = middlewareArray[0];\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @async\r\n\t * To send the request through the middleware chain\r\n\t * @param {Context} context - The context of a request\r\n\t * @returns A promise that resolves to the Context\r\n\t */\r\n\tpublic async sendRequest(context: Context): Promise<Context> {\r\n\t\ttry {\r\n\t\t\tif (typeof context.request === \"string\" && context.options === undefined) {\r\n\t\t\t\tconst error = new Error();\r\n\t\t\t\terror.name = \"InvalidRequestOptions\";\r\n\t\t\t\terror.message = \"Unable to execute the middleware, Please provide valid options for a request\";\r\n\t\t\t\tthrow error;\r\n\t\t\t}\r\n\t\t\tawait this.middleware.execute(context);\r\n\t\t\treturn context;\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module HTTPClientFactory\r\n */\r\n\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\r\nimport { AuthenticationHandler } from \"./middleware/AuthenticationHandler\";\r\nimport { HTTPMessageHandler } from \"./middleware/HTTPMessageHandler\";\r\nimport { Middleware } from \"./middleware/IMiddleware\";\r\nimport { RedirectHandlerOptions } from \"./middleware/options/RedirectHandlerOptions\";\r\nimport { RetryHandlerOptions } from \"./middleware/options/RetryHandlerOptions\";\r\nimport { RedirectHandler } from \"./middleware/RedirectHandler\";\r\nimport { RetryHandler } from \"./middleware/RetryHandler\";\r\nimport { TelemetryHandler } from \"./middleware/TelemetryHandler\";\r\n\r\n/**\r\n * @private\r\n * To check whether the environment is node or not\r\n * @returns A boolean representing the environment is node or not\r\n */\r\nconst isNodeEnvironment = (): boolean => {\r\n\treturn typeof process === \"object\" && typeof require === \"function\";\r\n};\r\n\r\n/**\r\n * @class\r\n * Class representing HTTPClientFactory\r\n */\r\nexport class HTTPClientFactory {\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * Creates HTTPClient with default middleware chain\r\n\t * @param {AuthenticationProvider} authProvider - The authentication provider instance\r\n\t * @returns A HTTPClient instance\r\n\t *\r\n\t * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline.\r\n\t * \t\t* HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request\r\n\t * \t\t* TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler \t*\t\t before making the actual network call ensures that the usage of all features are recorded in the flag.\r\n\t * \t\t* The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for\r\n\t * \t\t them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same.\r\n\t */\r\n\tpublic static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient {\r\n\t\tconst authenticationHandler = new AuthenticationHandler(authProvider);\r\n\t\tconst retryHandler = new RetryHandler(new RetryHandlerOptions());\r\n\t\tconst telemetryHandler = new TelemetryHandler();\r\n\t\tconst httpMessageHandler = new HTTPMessageHandler();\r\n\r\n\t\tauthenticationHandler.setNext(retryHandler);\r\n\t\tif (isNodeEnvironment()) {\r\n\t\t\tconst redirectHandler = new RedirectHandler(new RedirectHandlerOptions());\r\n\t\t\tretryHandler.setNext(redirectHandler);\r\n\t\t\tredirectHandler.setNext(telemetryHandler);\r\n\t\t} else {\r\n\t\t\tretryHandler.setNext(telemetryHandler);\r\n\t\t}\r\n\t\ttelemetryHandler.setNext(httpMessageHandler);\r\n\t\treturn HTTPClientFactory.createWithMiddleware(authenticationHandler);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * Creates a middleware chain with the given one\r\n\t * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\r\n\t * @returns A HTTPClient instance\r\n\t */\r\n\tpublic static createWithMiddleware(...middleware: Middleware[]): HTTPClient {\r\n\t\t// Middleware should not empty or undefined. This is check is present in the HTTPClient constructor.\r\n\t\treturn new HTTPClient(...middleware);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @module Client\r\n */\r\n\r\nimport { GRAPH_API_VERSION, GRAPH_BASE_URL } from \"./Constants\";\r\nimport { CustomAuthenticationProvider } from \"./CustomAuthenticationProvider\";\r\nimport { GraphRequest } from \"./GraphRequest\";\r\nimport { HTTPClient } from \"./HTTPClient\";\r\nimport { HTTPClientFactory } from \"./HTTPClientFactory\";\r\nimport { ClientOptions } from \"./IClientOptions\";\r\nimport { Options } from \"./IOptions\";\r\nimport { validatePolyFilling } from \"./ValidatePolyFilling\";\r\n\r\nexport class Client {\r\n\t/**\r\n\t * @private\r\n\t * A member which stores the Client instance options\r\n\t */\r\n\tprivate config: ClientOptions = {\r\n\t\tbaseUrl: GRAPH_BASE_URL,\r\n\t\tdebugLogging: false,\r\n\t\tdefaultVersion: GRAPH_API_VERSION,\r\n\t};\r\n\r\n\t/**\r\n\t * @private\r\n\t * A member which holds the HTTPClient instance\r\n\t */\r\n\tprivate httpClient: HTTPClient;\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To create a client instance with options and initializes the default middleware chain\r\n\t * @param {Options} options - The options for client instance\r\n\t * @returns The Client instance\r\n\t */\r\n\tpublic static init(options: Options): Client {\r\n\t\tconst clientOptions: ClientOptions = {};\r\n\t\tfor (const i in options) {\r\n\t\t\tif (options.hasOwnProperty(i)) {\r\n\t\t\t\tclientOptions[i] = i === \"authProvider\" ? new CustomAuthenticationProvider(options[i]) : options[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn Client.initWithMiddleware(clientOptions);\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * @static\r\n\t * To create a client instance with the Client Options\r\n\t * @param {ClientOptions} clientOptions - The options object for initializing the client\r\n\t * @returns The Client instance\r\n\t */\r\n\tpublic static initWithMiddleware(clientOptions: ClientOptions): Client {\r\n\t\ttry {\r\n\t\t\treturn new Client(clientOptions);\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t * @constructor\r\n\t * Creates an instance of Client\r\n\t * @param {ClientOptions} clientOptions - The options to instantiate the client object\r\n\t */\r\n\tprivate constructor(clientOptions: ClientOptions) {\r\n\t\ttry {\r\n\t\t\tvalidatePolyFilling();\r\n\t\t} catch (error) {\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tfor (const key in clientOptions) {\r\n\t\t\tif (clientOptions.hasOwnProperty(key)) {\r\n\t\t\t\tthis.config[key] = clientOptions[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet httpClient: HTTPClient;\r\n\t\tif (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"AmbiguityInInitialization\";\r\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both\";\r\n\t\t\tthrow error;\r\n\t\t} else if (clientOptions.authProvider !== undefined) {\r\n\t\t\thttpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider);\r\n\t\t} else if (clientOptions.middleware !== undefined) {\r\n\t\t\thttpClient = new HTTPClient(...[].concat(clientOptions.middleware));\r\n\t\t} else {\r\n\t\t\tconst error = new Error();\r\n\t\t\terror.name = \"InvalidMiddlewareChain\";\r\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t\tthis.httpClient = httpClient;\r\n\t}\r\n\r\n\t/**\r\n\t * @public\r\n\t * Entry point to make requests\r\n\t * @param {string} path - The path string value\r\n\t * @returns The graph request instance\r\n\t */\r\n\tpublic api(path: string): GraphRequest {\r\n\t\treturn new GraphRequest(this.httpClient, this.config, path);\r\n\t}\r\n}\r\n","/**\r\n * -------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\r\n * See License in the project root for license information.\r\n * -------------------------------------------------------------------------------------------\r\n */\r\n\r\n/**\r\n * @constant\r\n * @function\r\n * Validates availability of Promise and fetch in global context\r\n * @returns The true in case the Promise and fetch available, otherwise throws error\r\n */\r\n\r\nexport const validatePolyFilling = (): boolean => {\r\n\tif (typeof Promise === \"undefined\" && typeof fetch === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without Promise and fetch. So, please provide polyfill for them.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t} else if (typeof Promise === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without Promise. So, please provide polyfill for it.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t} else if (typeof fetch === \"undefined\") {\r\n\t\tconst error = new Error(\"Library cannot function without fetch. So, please provide polyfill for it.\");\r\n\t\terror.name = \"PolyFillNotAvailable\";\r\n\t\tthrow error;\r\n\t}\r\n\treturn true;\r\n};\r\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * Get Microsoft graph client.\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: '[\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TokenCredential} credential - token credential instance.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n *\n * @beta\n */\nexport function createMicrosoftGraphClient(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger, AzureLogger } from \"@azure/logger\";\n\n/**\n * The AzureLogger used for all clients within the identity package\n */\nexport const logger = createClientLogger(\"identity\");\n\ninterface EnvironmentAccumulator {\n missing: string[];\n assigned: string[];\n}\n\n/**\n * Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.\n * @param supportedEnvVars - List of environment variable names\n */\nexport function processEnvVars(supportedEnvVars: string[]): EnvironmentAccumulator {\n return supportedEnvVars.reduce(\n (acc: EnvironmentAccumulator, envVariable: string) => {\n if (process.env[envVariable]) {\n acc.assigned.push(envVariable);\n } else {\n acc.missing.push(envVariable);\n }\n return acc;\n },\n { missing: [], assigned: [] }\n );\n}\n\n/**\n * Based on a given list of environment variable names,\n * logs the environment variables currently assigned during the usage of a credential that goes by the given name.\n * @param credentialName - Name of the credential in use\n * @param supportedEnvVars - List of environment variables supported by that credential\n */\nexport function logEnvVars(credentialName: string, supportedEnvVars: string[]): void {\n const { assigned } = processEnvVars(supportedEnvVars);\n logger.info(\n `${credentialName} => Found the following environment variables: ${assigned.join(\", \")}`\n );\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatSuccess(scope: string | string[]): string {\n return `SUCCESS. Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n}\n\n/**\n * Formatting the success event on the credentials\n */\nexport function formatError(scope: string | string[] | undefined, error: Error | string): string {\n let message = \"ERROR.\";\n if (scope?.length) {\n message += ` Scopes: ${Array.isArray(scope) ? scope.join(\", \") : scope}.`;\n }\n return `${message} Error message: ${typeof error === \"string\" ? error : error.message}.`;\n}\n\n/**\n * A CredentialLoggerInstance is a logger properly formatted to work in a credential's constructor, and its methods.\n */\nexport interface CredentialLoggerInstance {\n title: string;\n fullTitle: string;\n info(message: string): void;\n /**\n * The logging functions for warning and error are intentionally left out, since we want the identity logging to be at the info level.\n * Otherwise, they would look like:\n *\n * warning(message: string): void;\n * error(err: Error): void;\n */\n}\n\n/**\n * Generates a CredentialLoggerInstance.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n *\n */\nexport function credentialLoggerInstance(\n title: string,\n parent?: CredentialLoggerInstance,\n log: AzureLogger = logger\n): CredentialLoggerInstance {\n const fullTitle = parent ? `${parent.fullTitle} ${title}` : title;\n\n function info(message: string): void {\n log.info(`${fullTitle} =>`, message);\n }\n\n return {\n title,\n fullTitle,\n info\n };\n}\n\n/**\n * A CredentialLogger is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n */\nexport interface CredentialLogger extends CredentialLoggerInstance {\n getToken: CredentialLoggerInstance;\n}\n\n/**\n * Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential.\n * It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.\n *\n * It logs with the format:\n *\n * `[title] => [message]`\n * `[title] => getToken() => [message]`\n *\n */\nexport function credentialLogger(title: string, log: AzureLogger = logger): CredentialLogger {\n const credLogger = credentialLoggerInstance(title, undefined, log);\n return {\n ...credLogger,\n getToken: credentialLoggerInstance(\"=> getToken()\", credLogger, log)\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential } from \"@azure/core-http\";\nimport { TokenCredentialOptions } from \"../../client/identityClient\";\nimport { credentialLogger, formatError } from \"../../util/logging\";\n\nconst BrowserNotSupportedError = new Error(\n \"ManagedIdentityCredential is not supported in the browser.\"\n);\nconst logger = credentialLogger(\"ManagedIdentityCredential\");\n\nexport class ManagedIdentityCredential implements TokenCredential {\n constructor(clientId: string, options?: TokenCredentialOptions);\n constructor(options?: TokenCredentialOptions);\n constructor() {\n logger.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n\n public async getToken(): Promise<AccessToken | null> {\n logger.getToken.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getResourceConfiguration } from \"./configurationProvider\";\nimport { ResourceType } from \"../models/configuration\";\nimport { AccessToken, ManagedIdentityCredential } from \"@azure/identity\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { ConnectionConfig } from \"tedious\";\nimport { internalLogger } from \"../util/logger\";\n\n/**\n * SQL connection configuration instance.\n * @remarks\n * Only works in in server side.\n *\n * @beta\n *\n */\nexport class DefaultTediousConnectionConfiguration {\n /**\n * MSSQL default scope\n * https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-connect-msi\n */\n private readonly defaultSQLScope: string = \"https://database.windows.net/\";\n\n /**\n * Generate connection configuration consumed by tedious.\n *\n * @returns Connection configuration of tedious for the SQL.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.\n * @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @beta\n */\n public async getConfig(): Promise<ConnectionConfig> {\n internalLogger.info(\"Get SQL configuration\");\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n\n if (!configuration) {\n const errMsg = \"SQL resource configuration not exist\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n\n try {\n this.isSQLConfigurationValid(configuration);\n } catch (err) {\n throw err;\n }\n\n if (!this.isMsiAuthentication()) {\n const configWithUPS = this.generateDefaultConfig(configuration);\n internalLogger.verbose(\"SQL configuration with username and password generated\");\n return configWithUPS;\n }\n\n try {\n const configWithToken = await this.generateTokenConfig(configuration);\n internalLogger.verbose(\"SQL configuration with MSI token generated\");\n return configWithToken;\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Check SQL use MSI identity or username and password.\n *\n * @returns false - login with SQL MSI identity, true - login with username and password.\n * @internal\n */\n private isMsiAuthentication(): boolean {\n internalLogger.verbose(\n \"Check connection config using MSI access token or username and password\"\n );\n const configuration = <SqlConfiguration>getResourceConfiguration(ResourceType.SQL);\n if (configuration?.sqlUsername != null && configuration?.sqlPassword != null) {\n internalLogger.verbose(\"Login with username and password\");\n return false;\n }\n internalLogger.verbose(\"Login with MSI identity\");\n return true;\n }\n\n /**\n * check configuration is an available configurations.\n * @param { SqlConfiguration } sqlConfig\n *\n * @returns true - SQL configuration has a valid SQL endpoints, SQL username with password or identity ID.\n * false - configuration is not valid.\n * @internal\n */\n private isSQLConfigurationValid(sqlConfig: SqlConfiguration) {\n internalLogger.verbose(\"Check SQL configuration if valid\");\n if (!sqlConfig.sqlServerEndpoint) {\n internalLogger.error(\"SQL configuration is not valid without SQL server endpoint exist\");\n throw new ErrorWithCode(\n \"SQL configuration error without SQL server endpoint exist\",\n ErrorCode.InvalidConfiguration\n );\n }\n if (!(sqlConfig.sqlUsername && sqlConfig.sqlPassword) && !sqlConfig.sqlIdentityId) {\n const errMsg = `SQL configuration is not valid without ${\n sqlConfig.sqlIdentityId ? \"\" : \"identity id \"\n } ${sqlConfig.sqlUsername ? \"\" : \"SQL username \"} ${\n sqlConfig.sqlPassword ? \"\" : \"SQL password\"\n } exist`;\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InvalidConfiguration);\n }\n internalLogger.verbose(\"SQL configuration is valid\");\n }\n\n /**\n * Generate tedious connection configuration with default authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with username and password.\n *\n * @returns Tedious connection configuration with username and password.\n * @internal\n */\n private generateDefaultConfig(sqlConfig: SqlConfiguration): ConnectionConfig {\n internalLogger.verbose(\n `SQL server ${sqlConfig.sqlServerEndpoint}, user name ${sqlConfig.sqlUsername}, database name ${sqlConfig.sqlDatabaseName}`\n );\n\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.default,\n options: {\n userName: sqlConfig.sqlUsername,\n password: sqlConfig.sqlPassword,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n return config;\n }\n\n /**\n * Generate tedious connection configuration with azure-active-directory-access-token authentication type.\n *\n * @param { SqlConfiguration } SQL configuration with AAD access token.\n *\n * @returns Tedious connection configuration with access token.\n * @internal\n */\n private async generateTokenConfig(sqlConfig: SqlConfiguration): Promise<ConnectionConfig> {\n internalLogger.verbose(\"Generate tedious config with MSI token\");\n\n let token: AccessToken | null;\n try {\n const credential = new ManagedIdentityCredential(sqlConfig.sqlIdentityId);\n token = await credential.getToken(this.defaultSQLScope);\n } catch (error) {\n const errMsg = \"Get user MSI token failed\";\n internalLogger.error(errMsg);\n throw new ErrorWithCode(errMsg, ErrorCode.InternalError);\n }\n if (token) {\n const config = {\n server: sqlConfig.sqlServerEndpoint,\n authentication: {\n type: TediousAuthenticationType.MSI,\n options: {\n token: token.token,\n },\n },\n options: {\n database: sqlConfig.sqlDatabaseName,\n encrypt: true,\n },\n };\n internalLogger.verbose(\n `Generate token configuration success, server endpoint is ${sqlConfig.sqlServerEndpoint}, database name is ${sqlConfig.sqlDatabaseName}`\n );\n return config;\n }\n internalLogger.error(\n `Generate token configuration, server endpoint is ${sqlConfig.sqlServerEndpoint}, MSI token is not valid`\n );\n throw new ErrorWithCode(\"MSI token is not valid\", ErrorCode.InternalError);\n }\n}\n\n/**\n * tedious connection config authentication type.\n * https://tediousjs.github.io/tedious/api-connection.html\n * @internal\n */\nenum TediousAuthenticationType {\n default = \"default\",\n MSI = \"azure-active-directory-access-token\",\n}\n\n/**\n * Configuration for SQL resource.\n * @internal\n */\ninterface SqlConfiguration {\n /**\n * SQL server endpoint.\n *\n * @readonly\n */\n readonly sqlServerEndpoint: string;\n\n /**\n * SQL server username.\n *\n * @readonly\n */\n readonly sqlUsername: string;\n\n /**\n * SQL server password.\n *\n * @readonly\n */\n readonly sqlPassword: string;\n\n /**\n * SQL server database name.\n *\n * @readonly\n */\n readonly sqlDatabaseName: string;\n\n /**\n * Managed identity id.\n *\n * @readonly\n */\n readonly sqlIdentityId: string;\n}\n"],"names":["ErrorCode","ErrorMessage","ErrorWithCode","Error","[object Object]","message","code","super","Object","setPrototypeOf","this","prototype","name","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__values","o","s","Symbol","iterator","m","i","call","length","TypeError","__read","n","r","ar","push","error","__spread","arguments","concat","InvalidCharacterError","LogLevel","window","atob","bind","input","str","String","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","indexOf","decodeURIComponent","p","charCodeAt","toString","toUpperCase","err","InvalidTokenError","setLogLevel","level","internalLogger","getLogLevel","undefined","verbose","console","debug","info","warn","log","x","Warn","Info","Verbose","logLevel","logFunction","trim","logMessage","Date","toUTCString","customLogger","customLogFunction","defaultLogger","setLogger","logger","setLogFunction","parseJwt","token","tokenObj","options","pos","header","JSON","parse","base64_url_decode","split","jwt_decode","exp","InternalError","errorMsg","formatString","replacements","args","match","number","validateScopesType","Array","isArray","every","item","InvalidParameter","M365TenantCredential","BrowserRuntimeNotSupported","RuntimeNotSupported","scopes","OnBehalfOfUserCredential","ssoToken","Cache","key","sessionStorage","getItem","setItem","removeItem","clear","module","t","exports","l","c","d","defineProperty","enumerable","get","toStringTag","__esModule","create","default","hasOwnProperty","a","Communication","parentMessageQueue","childMessageQueue","nextMessageId","callbacks","Function","parentWindow","id","func","timestamp","now","b","GlobalVars","isFramelessWindow","currentWindow","nativeInterface","framelessPostMessage","stringify","u","C","postMessage","data","source","originalEvent","origin","location","validOriginRegExp","test","toLowerCase","additionalValidOriginsRegexp","closed","childWindow","childOrigin","parentOrigin","h","f","callHandler","v","pop","g","isPartialResponse","shift","T","initializeCommunication","messageListener","parent","self","opener","addEventListener","onNativeMessage","version","uninitializeCommunication","removeEventListener","sendMessageToParent","waitForMessageQueue","setInterval","clearInterval","sendMessageEventToChild","w","ensureInitialized","initializeCalled","frameContext","isAPISupportedByPlatform","defaultSDKVersionForCompatCheck","compareSDKVersions","clientSupportedSDKVersion","isNaN","processAdditionalValidOrigins","additionalValidOrigins","filter","userOriginUrlValidationRegExp","generateRegExpFromUrls","desktop","web","android","ios","rigel","surfaceHub","HostClientType","settings","content","authentication","remove","task","sidePanel","stage","meetingStage","FrameContexts","Standard","Edu","Class","Plc","Staff","TeamType","Admin","User","Guest","UserTeamRole","Large","Medium","Small","TaskModuleDimension","Regular","Private","Shared","ChannelType","handlers","themeChangeHandler","backButtonPressHandler","navigateBack","loadHandler","beforeUnloadHandler","initializeHandlers","themeChange","backButtonPress","load","beforeUnload","registerHandler","removeHandler","registerOnThemeChangeHandler","handleThemeChange","registerBackButtonHandler","registerOnLoadHandler","registerBeforeUnloadHandler","getUserJoinedTeamsSupportedAndroidClientVersion","locationAPIsRequiredVersion","peoplePickerRequiredVersion","captureImageMobileSupportVersion","mediaAPISupportVersion","getMediaCallbackSupportVersion","scanBarCodeAPIMobileSupportVersion","validOrigins","RegExp","getGenericOnCompleteHandler","NaN","Number","generateGUID","v4","initializeCompleted","initializeCallbacks","printCapabilityEnabled","Inline","Desktop","Web","FileOpenPreference","NOT_SUPPORTED_ON_PLATFORM","INTERNAL_ERROR","NOT_SUPPORTED_IN_CURRENT_CONTEXT","PERMISSION_DENIED","NETWORK_ERROR","NO_HW_SUPPORT","INVALID_ARGUMENTS","UNAUTHORIZED_USER_OPERATION","INSUFFICIENT_RESOURCES","THROTTLE","USER_ABORT","OPERATION_TIMED_OUT","OLD_PLATFORM","FILE_NOT_FOUND","SIZE_EXCEEDED","appInitialization","enablePrintCapability","executeDeepLink","getContext","getMruTabInstances","getTabInstances","initialize","initializeWithFrameContext","print","registerChangeSettingsHandler","registerFullScreenHandler","registerAppButtonClickHandler","registerAppButtonHoverEnterHandler","registerAppButtonHoverLeaveHandler","setFrameContext","shareDeepLink","returnFocus","navigateCrossDomain","navigateToTab","tasks","ChildAppWindow","ParentAppWindow","media","meeting","people","crypto","getRandomValues","msCrypto","Uint8Array","Math","random","substr","join","close","hostClientType","successCallback","failureCallback","document","createElement","href","host","search","assign","registerAuthenticationHandlers","authenticate","url","width","height","min","outerWidth","outerHeight","screenLeft","screenX","screenTop","screenY","open","getAuthToken","resources","claims","silent","getUser","notifySuccess","setTimeout","notifyFailure","setValidityState","getSettings","setSettings","registerOnSaveHandler","registerOnRemoveHandler","notified","ensureNotNotified","registerGetLogHandler","logs","initializePrivateApis","menus","getUserJoinedTeams","errorCode","enterFullscreen","exitFullscreen","openFilePreview","entityId","title","description","type","objectUrl","downloadUrl","webPreviewUrl","webEditUrl","baseUrl","editFile","subEntityId","viewerAction","fileOpenPreference","showNotification","notificationType","uploadCustomApp","sendCustomMessage","sendCustomEvent","registerCustomHandler","getChatMembers","getConfigSetting","registerUserSettingsChangeHandler","enabled","selected","MenuItem","dropDown","popOver","MenuListType","setUpViews","setNavBarMenu","showActionMenu","_instance","configurable","__extends","__proto__","constructor","Base64","ID","FileFormat","File","captureImage","format","mimeType","preview","size","getMedia","validateGetMediaInputs","getMediaViaCallback","getMediaViaHandler","mediaMimeType","assembleAttachment","mediaChunk","chunkSequence","createFile","decodeAttachment","Media","Photo","Document","Whiteboard","BusinessCard","CameraStartMode","Camera","Gallery","Source","Image","Audio","MediaType","URL","ImageUriType","selectMedia","validateSelectMediaInputs","viewImages","validateViewImagesInput","scanBarCode","validateScanBarCodeInput","sort","sequence","forEach","Blob","file","chunk","maxMediaCount","timeOutIntervalInSec","validatePeoplePickerInput","setSelected","openOrgWideSearchInChatOrChannel","singleSelect","bot","NotificationTypes","ViewerActionTypes","UserSettingTypes","conversations","meetingRoom","remoteCamera","files","appEntity","sendQuery","getSupportedCommands","Results","Auth","ResponseType","v1","node","clockseq","msecs","getTime","nsecs","rng","Messages","AppLoaded","Success","Failure","ExpectedFailure","AuthFailed","Timeout","Other","FailedReason","PermissionError","NotFound","Throttling","Offline","ExpectedFailureReason","notifyAppLoaded","reason","notifyExpectedFailure","_uninitialize","_initialize","ctrlKey","metaKey","keyCode","cancelBubble","preventDefault","stopImmediatePropagation","subEntityLabel","subEntityWebUrl","__rest","getOwnPropertySymbols","startTask","updateTask","keys","submitTask","getLocation","showLocation","Unknown","Adhoc","Scheduled","Recurring","Broadcast","MeetNow","MeetingType","getIncomingClientAudioState","toggleIncomingClientAudio","getMeetingDetails","getAuthenticationTokenForAnonymousUser","getLiveStreamState","requestStartLiveStreaming","requestStopLiveStreaming","registerLiveStreamChangedHandler","selectPeople","fileDownloadStart","fileDownloadComplete","view","edit","editNew","theme","openConversation","conversationId","channelId","onStartConversation","onCloseConversation","closeConversation","toggleMute","toggleCamera","toggleCaptions","volume","showVideoGallery","showContent","showVideoGalleryAndContent","showLargeGallery","showTogether","leaveMeeting","Capability","getPairedMeetingRoomInfo","sendCommandToPairedMeetingRoom","registerMeetingRoomCapabilitiesUpdateHandler","registerMeetingRoomStatesUpdateHandler","Reset","ZoomIn","ZoomOut","PanLeft","PanRight","TiltUp","TiltDown","ControlCommand","CommandResetError","CommandZoomInError","CommandZoomOutError","CommandPanLeftError","CommandPanRightError","CommandTiltUpError","CommandTiltDownError","SendDataError","ErrorReason","None","ControlDenied","ControlNoResponse","ControlBusy","AckTimeout","ControlTerminated","ControllerTerminated","DataChannelError","ControllerCancelled","ControlDisabled","SessionTerminatedReason","getCapableParticipants","requestControl","sendControlCommand","terminateSession","registerOnCapableParticipantsChangeHandler","registerOnErrorHandler","registerOnDeviceStateChangeHandler","registerOnSessionStatusChangeHandler","Dropbox","Box","Sharefile","GoogleDrive","Egnyte","CloudStorageProvider","Sharepoint","WopiIntegration","Google","CloudStorageProviderType","getCloudStorageFolders","addCloudStorageFolder","deleteCloudStorageFolder","getCloudStorageFolderContents","isSubdirectory","openCloudStorageFile","selectAppEntity","isNode","process","versions","enabledString","debugEnvVariable","env","DEBUG","enabledNamespaces","skippedNamespaces","debuggers","enable","debugObj","namespace","createDebugger","disable","_i","firstArg","includes","namespaces","wildcard","namespaceList","map","ns","namespaceList_1","startsWith","debuggers_1","instance","endsWith","skippedNamespaces_1","enabledNamespaces_1","newDebugger","destroy","extend","index","splice","azureLogLevel","registeredLoggers","Set","logLevelFromEnv","AZURE_LOG_LEVEL","AzureLogger","AZURE_LOG_LEVELS","isAzureLogLevel","registeredLoggers_1","shouldEnable","ResourceType","levelMap","warning","patchLogMethod","child","createLogger","add","config","loadConfiguration","configuration","newAuthentication","newResources","authorityHost","M365_AUTHORITY_HOST","tenantId","M365_TENANT_ID","clientId","M365_CLIENT_ID","clientSecret","M365_CLIENT_SECRET","simpleAuthEndpoint","SIMPLE_AUTH_ENDPOINT","initiateLoginEndpoint","INITIATE_LOGIN_ENDPOINT","applicationIdUri","M365_APPLICATION_ID_URI","SQL","properties","sqlServerEndpoint","SQL_ENDPOINT","sqlUsername","SQL_USER_NAME","sqlPassword","SQL_PASSWORD","sqlDatabaseName","SQL_DATABASE_NAME","sqlIdentityId","IDENTITY_ID","API","endpoint","API_ENDPOINT","getResourceConfiguration","resourceType","resourceName","find","MissingResourceConfiguration","InvalidConfiguration","getAuthenticationConfiguration","ConfigurationNotExists","fn","val","isUndefined","isObject","isPlainObject","getPrototypeOf","isFunction","obj","isArrayBuffer","isBuffer","isFormData","FormData","isArrayBufferView","ArrayBuffer","isView","isString","isNumber","isDate","isFile","isBlob","isStream","pipe","isURLSearchParams","URLSearchParams","isStandardBrowserEnv","navigator","product","merge","assignValue","slice","stripBOM","encode","encodeURIComponent","params","paramsSerializer","serializedParams","utils","parts","toISOString","hashmarkIndex","InterceptorManager","use","eject","headers","fns","__CANCEL__","normalizedName","request","response","isAxiosError","toJSON","fileName","lineNumber","columnNumber","stack","enhanceError","write","expires","path","domain","secure","cookie","toGMTString","read","ignoreDuplicateOf","originURL","msie","userAgent","urlParsingNode","resolveURL","setAttribute","protocol","hash","hostname","port","pathname","requestURL","parsed","requestData","requestHeaders","XMLHttpRequest","auth","username","password","unescape","Authorization","btoa","baseURL","requestedURL","fullPath","relativeURL","combineURLs","method","buildURL","timeout","onreadystatechange","readyState","status","responseURL","responseHeaders","getAllResponseHeaders","line","responseType","responseText","statusText","validateStatus","createError","settle","onabort","onerror","ontimeout","timeoutErrorMessage","xsrfValue","withCredentials","isURLSameOrigin","xsrfCookieName","cookies","xsrfHeaderName","setRequestHeader","onDownloadProgress","onUploadProgress","upload","cancelToken","promise","cancel","abort","send","DEFAULT_CONTENT_TYPE","Content-Type","setContentTypeIfUnset","adapter","defaults","require$$0","transformRequest","normalizeHeaderName","transformResponse","maxContentLength","maxBodyLength","common","Accept","throwIfCancellationRequested","throwIfRequested","transformData","isCancel","config1","config2","valueFromConfig2Keys","mergeDeepPropertiesKeys","defaultToConfig2Keys","directMergeKeys","getMergedValue","target","mergeDeepProperties","prop","axiosKeys","otherKeys","Axios","instanceConfig","interceptors","mergeConfig","chain","dispatchRequest","interceptor","unshift","getUri","Cancel","CancelToken","executor","resolvePromise","createInstance","defaultConfig","context","axios","require$$1","require$$2","all","promises","spread","callback","arr","payload","GrantType","accessTokenCacheKeyPrefix","TeamsUserCredential","loadAndValidateConfig","scopesStr","microsoftTeams.initialize","microsoftTeams.authentication","encodeURI","authCodeResult","exchangeAccessTokenFromSimpleAuthServer","generateAuthServerError","ConsentFailed","getSSOToken","scopeStr","cachedKey","getAccessTokenCacheKey","cachedToken","getTokenCache","isAccessTokenNearExpired","getAndCacheAccessTokenFromSimpleAuthServer","tokenObject","userInfo","displayName","objectId","oid","preferredUserName","ver","preferred_username","upn","getUserInfoFromSsoToken","axiosInstance","getAxiosInstance","retryCount","tokenResult","post","scope","code_verifier","codeVerifier","redirect_uri","redirectUri","grant_type","authCode","setTokenCache","access_token","expiresOnTimestamp","expires_on","sleep","accessTokenResult","accessToken","cacheKey","initialized","errMessage","AuthenticationConfigurationNotExists","missingValues","set","validateAndParseJson","jsonValue","parsedJson","ssoTokenObj","userObjectId","tid","errorMessage","detail","fullErrorMsg","UiRequiredError","ServiceError","ms","MsGraphAuthProvider","credential","getToken","TeamsBotSsoPrompt","dialogId","dc","RequestMethod","MiddlewareControl","middlewareOptions","Map","option","getRequestHeader","Request","Headers","appendRequestHeader","append","AuthenticationHandlerOptions","authenticationProvider","authenticationProviderOptions","FeatureUsageFlag","TelemetryHandlerOptions","NONE","flag","middlewareControl","getMiddlewareOptions","setMiddlewareOptions","setFeatureUsage","featureUsage","AuthenticationHandler","bearerKey","getAccessToken","AUTHORIZATION_HEADER","updateFeatureUsageFlag","AUTHENTICATION_HANDLER_ENABLED","nextMiddleware","execute","HTTPMessageHandler","fetch","RetryHandlerOptions","delay","DEFAULT_DELAY","maxRetries","DEFAULT_MAX_RETRIES","shouldRetry","DEFAULT_SHOULD_RETRY","MAX_DELAY","MAX_MAX_RETRIES","RetryHandler","RETRY_STATUS_CODES","PUT","PATCH","POST","retryAttempts","getRandomness","toFixed","retryAfter","RETRY_AFTER_HEADER","newDelay","round","getExponentialBackOffTime","getMaxDelay","attempts","delaySeconds","delayMilliseconds","isRetry","isBuffered","RETRY_ATTEMPT_HEADER","getDelay","executeWithRetry","getOptions","RETRY_HANDLER_ENABLED","RedirectHandlerOptions","maxRedirects","DEFAULT_MAX_REDIRECTS","shouldRedirect","MAX_MAX_REDIRECTS","RedirectHandler","REDIRECT_STATUS_CODES","has","LOCATION_HEADER","requestUrl","redirectUrl","schemeHostRegex","requestMatches","exec","requestAuthority","redirectAuthority","redirectMatches","newUrl","body","blob","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive","signal","redirectCount","isRedirect","hasLocationHeader","STATUS_CODE_SEE_OTHER","GET","getLocationHeader","isRelativeURL","shouldDropAuthorizationHeader","updateRequestUrl","executeWithRedirect","MANUAL_REDIRECT","REDIRECT_HANDLER_ENABLED","GRAPH_URLS","oDataQueryNames","serializeContent","className","Buffer","from","TelemetryHandler","startofPortNoPos","endOfHostStrPos","hostName","substring","isGraphURL","clientRequestId","CLIENT_REQUEST_ID_HEADER","uuid","j","floor","generateUUID","sdkVersionValue","PRODUCT_NAME","getFeatureUsage","FEATURE_USAGE_STRING","SDK_VERSION_HEADER","ChaosStrategy","DocumentType","ContentType","ContentTypeRegexStr","CustomAuthenticationProvider","provider","GraphError","statusCode","baseError","requestId","date","GraphErrorHandler","gError","innerError","constructErrorFromResponse","constructError","GraphResponseHandler","rawResponse","DOMParser","text","xmlString","xmlDoc","parseFromString","responseValue","ARRAYBUFFER","arrayBuffer","BLOB","DOCUMENT","parseDocumentResponse","TEXT_XML","json","STREAM","TEXT","contentType","IMAGE","TEXT_PLAIN","APPLICATION_JSON","RAW","convertResponse","ok","GraphRequest","httpClient","urlComponents","endOfVersionStrPos","queryStrPos","queryParams","queryParam","parseQueryParameter","defaultVersion","oDataQueryParams","otherURLQueryParams","otherURLQueryOptions","_headers","_options","_middlewareOptions","parsePath","propertyName","propertyValue","additionalProperties","allValues","urlSegments","removePreSlash","reduce","pre","cur","urlJoin","createQueryString","debugLogging","query","property","queryDictionaryOrString","parseQueryParamenterString","setURLComponentsQueryParamater","queryParameter","isValidQueryKeyValuePair","indexOfFirstEquals","paramKey","paramValue","currentValue","isValueAppendable","queryString","indexofFirstEquals","optionsHeaders","fetchOptions","updateRequestOptions","sendRequest","getResponse","_responseType","getError","headerKeys","headerKey","headerValue","addCsvQueryParameter","filterStr","$filter","searchStr","$search","$top","$skip","$skipToken","isCount","$count","buildFullUrl","setHeaderContentType","patch","DELETE","delete","stream","HTTPClient","middleware","setMiddleware","parseMiddleWareArray","middlewareArray","element","setNext","HTTPClientFactory","authProvider","authenticationHandler","retryHandler","telemetryHandler","httpMessageHandler","require","redirectHandler","createWithMiddleware","Client","clientOptions","validatePolyFilling","createWithAuthenticationProvider","initWithMiddleware","createMicrosoftGraphClient","clientRootLogger","formatError","credentialLoggerInstance","fullTitle","BrowserNotSupportedError","credLogger","credentialLogger","ManagedIdentityCredential","DefaultTediousConnectionConfiguration","errMsg","isSQLConfigurationValid","isMsiAuthentication","configWithUPS","generateDefaultConfig","configWithToken","generateTokenConfig","sqlConfig","server","TediousAuthenticationType","userName","database","encrypt","defaultSQLScope","MSI"],"mappings":"IAOYA,GAAZ,SAAYA,GAIVA,sCAKAA,8CAKAA,gCAKAA,4CAKAA,4CAKAA,gCAKAA,oCAKAA,wCAKAA,8BAKAA,oCAjDF,CAAYA,IAAAA,aAuDCC,GAEKA,uBAAuB,wCACvBA,yBAAyB,oCACzBA,iCAAiC,6CACjCA,+BACd,4DACcA,uCACd,+CAGcA,6BAA6B,mCAC7BA,4BAA4B,gCAG5BA,mCACd,wDAGcA,8BAA8B,kDAQnCC,sBAAsBC,MAgBjCC,YAAYC,EAAkBC,GACvBA,GAKLC,MAAMF,GACNG,OAAOC,eAAeC,KAAMR,cAAcS,WAC1CD,KAAKE,KAAO,cAAcA,QAAQN,IAClCI,KAAKJ,KAAOA,GAPVC,MAAMF;;;;;;;;;;;;;;gFCtCL,SAASQ,EAAUC,EAASC,EAAYC,EAAGC,GAE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eG,QACb,4DAA4DypC,EAAUtiB,uCAAuCsiB,EAAUhiB,mBAElH3B,EAKT,MAHAjmB,EAAe9B,MACb,oDAAoD0rC,EAAUtiB,6CAE1D,IAAIhsB,cAAc,yBAA0BF,EAAUiH,mBAShE,IAAKynC,IAAL,SAAKA,GACHA,oBACAA,4CAFF,CAAKA,KAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"m365TenantCredential.js","sourceRoot":"","sources":["../../../src/credential/m365TenantCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAIL,sBAAsB,EAEtB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,oBAAoB;IAG/B;;;;;;;;;;OAUG;IACH;QACE,cAAc,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAErD,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE5C,MAAM,sBAAsB,GAA2B;YACrD,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC;QAEF,IAAI,CAAC,sBAAsB,GAAG,IAAI,sBAAsB,CACtD,MAAM,CAAC,QAAS,EAChB,MAAM,CAAC,QAAS,EAChB,MAAM,CAAC,YAAa,EACpB,sBAAsB,CACvB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,QAAQ,CACZ,MAAyB,EACzB,OAAyB;;YAEzB,IAAI,WAAW,CAAC;YAChB,kBAAkB,CAAC,MAAM,CAAC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uC,CAAC,CAAC;QAEhE,MAAM,MAAM,GAAG,8BAA8B,EAAE,CAAC;QAEhD,IAAI,CAAC,MAAM,EAAE;YACX,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,oCAAoC,CAAC,CAAC;YACxE,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,oCAAoC,EACjD,SAAS,CAAC,oBAAoB,CAC/B,CAAC;SACH;QAED,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,QAAQ,EAAE;YAC7D,OAAO,MAAM,CAAC;SACf;QAED,MAAM,aAAa,GAAG,EAAE,CAAC;QAEzB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACpB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;YACxB,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACpC;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACpB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAChC;QAED,MAAM,QAAQ,GAAG,YAAY,CAC3B,YAAY,CAAC,oBAAoB,EACjC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EACxB,WAAW,CACZ,CAAC;QACF,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,IAAI,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC;IACpE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n AccessToken,\n TokenCredential,\n GetTokenOptions,\n ClientSecretCredential,\n TokenCredentialOptions,\n AuthenticationError,\n} from \"@azure/identity\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType, formatString } from \"../util/utils\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.\n *\n * @example\n * ```typescript\n * loadConfiguration(); // load configuration from environment variables\n * const credential = new M365TenantCredential();\n * ```\n *\n * @remarks\n * Only works in in server side.\n *\n * @beta\n */\nexport class M365TenantCredential implements TokenCredential {\n private readonly clientSecretCredential: ClientSecretCredential;\n\n /**\n * Constructor of M365TenantCredential.\n *\n * @remarks\n * Only works in in server side.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n constructor() {\n internalLogger.info(\"Create M365 tenant credential\");\n\n const config = this.loadAndValidateConfig();\n\n const tokenCredentialOptions: TokenCredentialOptions = {\n authorityHost: config.authorityHost,\n };\n\n this.clientSecretCredential = new ClientSecretCredential(\n config.tenantId!,\n config.clientId!,\n config.clientSecret!,\n tokenCredentialOptions\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([\"User.Read.All\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read.All\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read.All\", \"Calendars.Read\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read.All Calendars.Read\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read.All\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|ServiceError} when get access token with authentication error.\n * @throws {@link ErrorCode|InternalError} when get access token with unknown error.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Access token with expected scopes.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n let accessToken;\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n internalLogger.info(\"Get access token with scopes: \" + scopesStr);\n\n try {\n accessToken = await this.clientSecretCredential.getToken(scopes);\n } catch (err: any) {\n if (err instanceof AuthenticationError) {\n const authError = err as AuthenticationError;\n const errorMsg = `Get M365 tenant credential with authentication error: status code ${authError.statusCode}, error messages: ${authError.message}`;\n internalLogger.error(errorMsg);\n\n throw new ErrorWithCode(errorMsg, ErrorCode.ServiceError);\n } else {\n const errorMsg = \"Get M365 tenant credential failed with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n }\n\n if (!accessToken) {\n const errorMsg = \"Get M365 tenant credential access token failed with empty access token\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n return accessToken;\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.clientId && config.clientSecret && config.tenantId) {\n return config;\n }\n\n const missingValues = [];\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n if (!config.clientSecret) {\n missingValues.push(\"clientSecret\");\n }\n\n if (!config.tenantId) {\n missingValues.push(\"tenantId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teamsUserCredential.browser.js","sourceRoot":"","sources":["../../../src/credential/teamsUserCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAChD,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iCAAiC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,sCAAsC,GAAG,IAAI,CAAC;AACpD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAI9B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;QACE,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qB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iCAAiC,EAAE;YACzE,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,uBAAuB,CAAC,GAAQ;;QACtC,IAAI,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAI,MAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,0CAAE,IAAI,EAAE;YAC5B,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;YACxC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,EAAE;gBACvD,MAAM,YAAY,GAChB,6EAA6E;oBAC7E,YAAY,CAAC;gBACf,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAClC,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;aACnE;iBAAM;gBACL,MAAM,YAAY,GAChB,yDAAyD,GAAG,YAAY,CAAC;gBAC3E,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBACnC,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;aAChE;SACF;QAED,MAAM,YAAY,GAAG,yCAAyC,GAAG,YAAY,CAAC;QAC9E,OAAO,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { Cache } from \"../core/cache.browser\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { AuthCodeResult } from \"../models/authCodeResult\";\nimport axios, { AxiosInstance } from \"axios\";\nimport { GrantType } from \"../models/grantType\";\nimport { AccessTokenResult } from \"../models/accessTokenResult\";\nimport { validateScopesType, getUserInfoFromSsoToken, parseJwt } from \"../util/utils\";\nimport { formatString } from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\n\nconst accessTokenCacheKeyPrefix = \"accessToken\";\nconst separator = \"-\";\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst initializeTeamsSdkTimeoutInMillisecond = 5000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\nconst maxRetryCount = 3;\nconst retryTimeSpanInMillisecond = 3000;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n\n /**\n * Constructor of TeamsUserCredential.\n * Developer need to call loadConfiguration(config) before using this class.\n * \n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * runtimeConnectorEndpoint: \"https://xxx.xxx.com\",\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * }\n loadConfiguration(config); // No default config from environment variables, developers must provide the config object.\n const credential = new TeamsUserCredential([\"https://graph.microsoft.com/User.Read\"]);\n * ```\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n * \n * @beta\n */\n constructor() {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig();\n this.ssoToken = null;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from Teams\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const authCodeResult: AuthCodeResult = JSON.parse(result);\n try {\n await this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);\n resolve();\n } catch (err) {\n reject(this.generateAuthServerError(err));\n }\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\n });\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n const cachedKey = await this.getAccessTokenCacheKey(scopeStr);\n const cachedToken = this.getTokenCache(cachedKey);\n\n if (cachedToken) {\n if (!this.isAccessTokenNearExpired(cachedToken)) {\n internalLogger.verbose(\"Get access token from cache\");\n return cachedToken;\n } else {\n internalLogger.verbose(\"Cached access token is expired\");\n }\n } else {\n internalLogger.verbose(\"No cached access token\");\n }\n\n const accessToken = await this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async exchangeAccessTokenFromSimpleAuthServer(\n scopesStr: string,\n authCodeResult: AuthCodeResult\n ): Promise<void> {\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n\n let retryCount = 0;\n while (true) {\n try {\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n code: authCodeResult.code,\n code_verifier: authCodeResult.codeVerifier,\n redirect_uri: authCodeResult.redirectUri,\n grant_type: GrantType.authCode,\n });\n\n const tokenResult: AccessTokenResult = response.data;\n const key = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(key, {\n token: tokenResult.access_token,\n expiresOnTimestamp: tokenResult.expires_on,\n });\n return;\n } catch (err) {\n if (err.response?.data?.type && err.response.data.type === \"AadUiRequiredException\") {\n internalLogger.warn(\"Exchange access token failed, retry...\");\n if (retryCount < maxRetryCount) {\n await this.sleep(retryTimeSpanInMillisecond);\n retryCount++;\n continue;\n }\n }\n throw err;\n }\n }\n }\n\n /**\n * Get access token cache from authentication server\n * @returns Access token\n */\n private async getAndCacheAccessTokenFromSimpleAuthServer(\n scopesStr: string\n ): Promise<AccessToken> {\n try {\n internalLogger.verbose(\n \"Get access token from authentication server with scopes: \" + scopesStr\n );\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n grant_type: GrantType.ssoToken,\n });\n\n const accessTokenResult: AccessTokenResult = response.data;\n const accessToken: AccessToken = {\n token: accessTokenResult.access_token,\n expiresOnTimestamp: accessTokenResult.expires_on,\n };\n const cacheKey = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(cacheKey, accessToken);\n return accessToken;\n } catch (err) {\n throw this.generateAuthServerError(err);\n }\n }\n\n /**\n * Get SSO token using teams SDK\n * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token\n * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n let initialized = false;\n microsoftTeams.initialize(() => {\n initialized = true;\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n\n // If the code not running in Teams, the initialize callback function would never trigger\n setTimeout(() => {\n if (!initialized) {\n const errorMsg =\n \"Initialize teams sdk timeout, maybe the code is not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n }, initializeTeamsSdkTimeoutInMillisecond);\n });\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.simpleAuthEndpoint) {\n missingValues.push(\"simpleAuthEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n /**\n * Get axios instance with sso token bearer header\n * @returns AxiosInstance\n */\n private async getAxiosInstance(): Promise<AxiosInstance> {\n const ssoToken = await this.getSSOToken();\n const axiosInstance: AxiosInstance = axios.create({\n baseURL: this.config.simpleAuthEndpoint,\n });\n\n axiosInstance.interceptors.request.use((config) => {\n config.headers.Authorization = \"Bearer \" + ssoToken.token;\n return config;\n });\n\n return axiosInstance;\n }\n\n /**\n * Set access token to cache\n * @param key\n * @param token\n */\n private setTokenCache(key: string, token: AccessToken): void {\n Cache.set(key, JSON.stringify(token));\n }\n\n /**\n * Get access token from cache.\n * If there is no cache or cannot be parsed, then it will return null\n * @param key\n * @returns Access token or null\n */\n private getTokenCache(key: string): AccessToken | null {\n const value = Cache.get(key);\n if (value === null) {\n return null;\n }\n\n const accessToken: AccessToken | null = this.validateAndParseJson(value);\n return accessToken;\n }\n\n /**\n * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.\n * @param jsonValue\n */\n private validateAndParseJson(jsonValue: string): AccessToken | null {\n try {\n const parsedJson = JSON.parse(jsonValue);\n /**\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\n *\n */\n return parsedJson && typeof parsedJson === \"object\" ? parsedJson : null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Generate cache key\n * @param scopesStr\n * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes\n */\n private async getAccessTokenCacheKey(scopesStr: string): Promise<string> {\n const ssoToken = await this.getSSOToken();\n const ssoTokenObj = parseJwt(ssoToken.token);\n\n const clientId = this.config.clientId;\n const userObjectId = ssoTokenObj.oid;\n const tenantId = ssoTokenObj.tid;\n\n const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]\n .join(separator)\n .replace(/\" \"/g, \"_\");\n return key;\n }\n\n /**\n * Check whether the token is about to expire (within 5 minutes)\n * @returns Boolean value indicate whether the token is about to expire\n */\n private isAccessTokenNearExpired(token: AccessToken): boolean {\n const expireDate = new Date(token.expiresOnTimestamp);\n if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n return false;\n }\n return true;\n }\n\n private generateAuthServerError(err: any): Error {\n let errorMessage = err.message;\n if (err.response?.data?.type) {\n errorMessage = err.response.data.detail;\n if (err.response.data.type === \"AadUiRequiredException\") {\n const fullErrorMsg =\n \"Failed to get access token from authentication server, please login first: \" +\n errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else {\n const fullErrorMsg =\n \"Failed to get access token from authentication server: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n\n const fullErrorMsg = \"Failed to get access token with error: \" + errorMessage;\n return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"teamsUserCredential.browser.js","sourceRoot":"","sources":["../../../src/credential/teamsUserCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAChD,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iCAAiC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,MAAM,sCAAsC,GAAG,IAAI,CAAC;AACpD,MAAM,cAAc,GAAG,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I,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { Cache } from \"../core/cache.browser\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { getAuthenticationConfiguration } from \"../core/configurationProvider\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\nimport { AuthCodeResult } from \"../models/authCodeResult\";\nimport axios, { AxiosInstance } from \"axios\";\nimport { GrantType } from \"../models/grantType\";\nimport { AccessTokenResult } from \"../models/accessTokenResult\";\nimport { validateScopesType, getUserInfoFromSsoToken, parseJwt } from \"../util/utils\";\nimport { formatString } from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\n\nconst accessTokenCacheKeyPrefix = \"accessToken\";\nconst separator = \"-\";\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst initializeTeamsSdkTimeoutInMillisecond = 5000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\nconst maxRetryCount = 3;\nconst retryTimeSpanInMillisecond = 3000;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n *\n * @beta\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n\n /**\n * Constructor of TeamsUserCredential.\n * Developer need to call loadConfiguration(config) before using this class.\n * \n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * runtimeConnectorEndpoint: \"https://xxx.xxx.com\",\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * }\n loadConfiguration(config); // No default config from environment variables, developers must provide the config object.\n const credential = new TeamsUserCredential([\"https://graph.microsoft.com/User.Read\"]);\n * ```\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n * \n * @beta\n */\n constructor() {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig();\n this.ssoToken = null;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ServiceError} when simple auth server failed to exchange access token.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @beta\n */\n public async login(scopes: string | string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from Teams\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const authCodeResult: AuthCodeResult = JSON.parse(result);\n try {\n await this.exchangeAccessTokenFromSimpleAuthServer(scopesStr, authCodeResult);\n resolve();\n } catch (err) {\n reject(this.generateAuthServerError(err));\n }\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\n });\n }\n\n /**\n * Get access token from credential.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n *\n * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n const cachedKey = await this.getAccessTokenCacheKey(scopeStr);\n const cachedToken = this.getTokenCache(cachedKey);\n\n if (cachedToken) {\n if (!this.isAccessTokenNearExpired(cachedToken)) {\n internalLogger.verbose(\"Get access token from cache\");\n return cachedToken;\n } else {\n internalLogger.verbose(\"Cached access token is expired\");\n }\n } else {\n internalLogger.verbose(\"No cached access token\");\n }\n\n const accessToken = await this.getAndCacheAccessTokenFromSimpleAuthServer(scopeStr);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n *\n * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async exchangeAccessTokenFromSimpleAuthServer(\n scopesStr: string,\n authCodeResult: AuthCodeResult\n ): Promise<void> {\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n\n let retryCount = 0;\n while (true) {\n try {\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n code: authCodeResult.code,\n code_verifier: authCodeResult.codeVerifier,\n redirect_uri: authCodeResult.redirectUri,\n grant_type: GrantType.authCode,\n });\n\n const tokenResult: AccessTokenResult = response.data;\n const key = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(key, {\n token: tokenResult.access_token,\n expiresOnTimestamp: tokenResult.expires_on,\n });\n return;\n } catch (err: any) {\n if (err.response?.data?.type && err.response.data.type === \"AadUiRequiredException\") {\n internalLogger.warn(\"Exchange access token failed, retry...\");\n if (retryCount < maxRetryCount) {\n await this.sleep(retryTimeSpanInMillisecond);\n retryCount++;\n continue;\n }\n }\n throw err;\n }\n }\n }\n\n /**\n * Get access token cache from authentication server\n * @returns Access token\n */\n private async getAndCacheAccessTokenFromSimpleAuthServer(\n scopesStr: string\n ): Promise<AccessToken> {\n try {\n internalLogger.verbose(\n \"Get access token from authentication server with scopes: \" + scopesStr\n );\n const axiosInstance: AxiosInstance = await this.getAxiosInstance();\n const response = await axiosInstance.post(\"/auth/token\", {\n scope: scopesStr,\n grant_type: GrantType.ssoToken,\n });\n\n const accessTokenResult: AccessTokenResult = response.data;\n const accessToken: AccessToken = {\n token: accessTokenResult.access_token,\n expiresOnTimestamp: accessTokenResult.expires_on,\n };\n const cacheKey = await this.getAccessTokenCacheKey(scopesStr);\n this.setTokenCache(cacheKey, accessToken);\n return accessToken;\n } catch (err) {\n throw this.generateAuthServerError(err);\n }\n }\n\n /**\n * Get SSO token using teams SDK\n * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token\n * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n let initialized = false;\n microsoftTeams.initialize(() => {\n initialized = true;\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n\n // If the code not running in Teams, the initialize callback function would never trigger\n setTimeout(() => {\n if (!initialized) {\n const errorMsg =\n \"Initialize teams sdk timeout, maybe the code is not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n }, initializeTeamsSdkTimeoutInMillisecond);\n });\n }\n\n /**\n * Load and validate authentication configuration\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n const config = getAuthenticationConfiguration();\n\n if (!config) {\n internalLogger.error(ErrorMessage.AuthenticationConfigurationNotExists);\n\n throw new ErrorWithCode(\n ErrorMessage.AuthenticationConfigurationNotExists,\n ErrorCode.InvalidConfiguration\n );\n }\n\n if (config.initiateLoginEndpoint && config.simpleAuthEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.simpleAuthEndpoint) {\n missingValues.push(\"simpleAuthEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n /**\n * Get axios instance with sso token bearer header\n * @returns AxiosInstance\n */\n private async getAxiosInstance(): Promise<AxiosInstance> {\n const ssoToken = await this.getSSOToken();\n const axiosInstance: AxiosInstance = axios.create({\n baseURL: this.config.simpleAuthEndpoint,\n });\n\n axiosInstance.interceptors.request.use((config) => {\n config.headers.Authorization = \"Bearer \" + ssoToken.token;\n return config;\n });\n\n return axiosInstance;\n }\n\n /**\n * Set access token to cache\n * @param key\n * @param token\n */\n private setTokenCache(key: string, token: AccessToken): void {\n Cache.set(key, JSON.stringify(token));\n }\n\n /**\n * Get access token from cache.\n * If there is no cache or cannot be parsed, then it will return null\n * @param key\n * @returns Access token or null\n */\n private getTokenCache(key: string): AccessToken | null {\n const value = Cache.get(key);\n if (value === null) {\n return null;\n }\n\n const accessToken: AccessToken | null = this.validateAndParseJson(value);\n return accessToken;\n }\n\n /**\n * Parses passed value as JSON access token, if value is not a valid json string JSON.parse() will throw an error.\n * @param jsonValue\n */\n private validateAndParseJson(jsonValue: string): AccessToken | null {\n try {\n const parsedJson = JSON.parse(jsonValue);\n /**\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\n *\n */\n return parsedJson && typeof parsedJson === \"object\" ? parsedJson : null;\n } catch (error) {\n return null;\n }\n }\n\n /**\n * Generate cache key\n * @param scopesStr\n * @returns Access token cache key, a key example: accessToken-userId-clientId-tenantId-scopes\n */\n private async getAccessTokenCacheKey(scopesStr: string): Promise<string> {\n const ssoToken = await this.getSSOToken();\n const ssoTokenObj = parseJwt(ssoToken.token);\n\n const clientId = this.config.clientId;\n const userObjectId = ssoTokenObj.oid;\n const tenantId = ssoTokenObj.tid;\n\n const key = [accessTokenCacheKeyPrefix, userObjectId, clientId, tenantId, scopesStr]\n .join(separator)\n .replace(/\" \"/g, \"_\");\n return key;\n }\n\n /**\n * Check whether the token is about to expire (within 5 minutes)\n * @returns Boolean value indicate whether the token is about to expire\n */\n private isAccessTokenNearExpired(token: AccessToken): boolean {\n const expireDate = new Date(token.expiresOnTimestamp);\n if (expireDate.getTime() - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n return false;\n }\n return true;\n }\n\n private generateAuthServerError(err: any): Error {\n let errorMessage = err.message;\n if (err.response?.data?.type) {\n errorMessage = err.response.data.detail;\n if (err.response.data.type === \"AadUiRequiredException\") {\n const fullErrorMsg =\n \"Failed to get access token from authentication server, please login first: \" +\n errorMessage;\n internalLogger.warn(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.UiRequiredError);\n } else {\n const fullErrorMsg =\n \"Failed to get access token from authentication server: \" + errorMessage;\n internalLogger.error(fullErrorMsg);\n return new ErrorWithCode(fullErrorMsg, ErrorCode.ServiceError);\n }\n }\n\n const fullErrorMsg = \"Failed to get access token with error: \" + errorMessage;\n return new ErrorWithCode(fullErrorMsg, ErrorCode.InternalError);\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/util/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IAAI;QACF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAqB,CAAC;QACvD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YAC9B,MAAM,IAAI,aAAa,CACrB,qDAAqD,EACrD,SAAS,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AAQ,CAAC,CAAC;IAC/B,MAAM,IAAI,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAChE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj = jwt_decode(token) as SSOTokenInfoBase;\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err: any) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + err.message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/teamsfx",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7-alpha.38498d2f.0",
|
|
4
4
|
"description": "Microsoft Teams Framework for Node.js and browser.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist-esm/src/index.js",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"url-join": "^4.0.1",
|
|
145
145
|
"util": "^0.12.1"
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "9fa6ad378a02d618ec6d91354270ff8a362620ee",
|
|
148
148
|
"publishConfig": {
|
|
149
149
|
"access": "public"
|
|
150
150
|
},
|