@microsoft/teamsfx 2.2.3-alpha.dea6b9e8a.0 → 2.2.3-alpha.e58796e43.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.
@@ -10,7 +10,6 @@ import axios from 'axios';
10
10
  import { Agent } from 'https';
11
11
  import * as path from 'path';
12
12
  import * as fs from 'fs';
13
- import { __rest } from 'tslib';
14
13
  import { AdaptiveCards } from '@microsoft/adaptivecards-tools';
15
14
 
16
15
  // Copyright (c) Microsoft Corporation.
@@ -740,8 +739,10 @@ class TeamsUserCredential {
740
739
 
741
740
  // Copyright (c) Microsoft Corporation.
742
741
  const defaultScope = "https://graph.microsoft.com/.default";
742
+ // eslint-disable-next-line no-secrets/no-secrets
743
743
  /**
744
744
  * Microsoft Graph auth provider for Teams Framework
745
+ * @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.
745
746
  */
746
747
  class MsGraphAuthProvider {
747
748
  constructor(credentialOrTeamsFx, scopes) {
@@ -796,6 +797,14 @@ class MsGraphAuthProvider {
796
797
  // Copyright (c) Microsoft Corporation.
797
798
  /**
798
799
  * Get Microsoft graph client.
800
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
801
+ * ```typescript
802
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
803
+ * const graph = Client.initWithMiddleware({
804
+ * authProvider: authProvider,
805
+ * });
806
+ * ```
807
+ *
799
808
  * @example
800
809
  * Get Microsoft graph client by TokenCredential
801
810
  * ```typescript
@@ -853,6 +862,14 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
853
862
  // eslint-disable-next-line no-secrets/no-secrets
854
863
  /**
855
864
  * Get Microsoft graph client.
865
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
866
+ * ```typescript
867
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
868
+ * const graph = Client.initWithMiddleware({
869
+ * authProvider: authProvider,
870
+ * });
871
+ * ```
872
+ *
856
873
  * @example
857
874
  * Get Microsoft graph client by TokenCredential
858
875
  * ```typescript
@@ -1736,6 +1753,8 @@ const ReservedKey = new Set([
1736
1753
  ]);
1737
1754
  /**
1738
1755
  * A class providing credential and configuration.
1756
+ * @deprecated Please use {@link TeamsUserCredential}
1757
+ * in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.
1739
1758
  */
1740
1759
  class TeamsFx {
1741
1760
  /**
@@ -1965,6 +1984,7 @@ var InvokeResponseErrorCode;
1965
1984
  InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
1966
1985
  })(InvokeResponseErrorCode || (InvokeResponseErrorCode = {}));
1967
1986
 
1987
+ // Copyright (c) Microsoft Corporation.
1968
1988
  /**
1969
1989
  * Available response type for an adaptive card invoke response.
1970
1990
  * @internal
@@ -1979,7 +1999,7 @@ var InvokeResponseType;
1979
1999
  * Provides methods for formatting various invoke responses a bot can send to respond to an invoke request.
1980
2000
  *
1981
2001
  * @remarks
1982
- * All of these functions return an {@link InvokeResponse} object, which can be
2002
+ * All of these functions return an `InvokeResponse` object, which can be
1983
2003
  * passed as input to generate a new `invokeResponse` activity.
1984
2004
  *
1985
2005
  * This example sends an invoke response that contains an adaptive card.
@@ -2404,6 +2424,7 @@ function cloneConversation(conversation) {
2404
2424
  */
2405
2425
  function getKey(reference) {
2406
2426
  var _a, _b;
2427
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
2407
2428
  return `_${(_a = reference.conversation) === null || _a === void 0 ? void 0 : _a.tenantId}_${(_b = reference.conversation) === null || _b === void 0 ? void 0 : _b.id}`;
2408
2429
  }
2409
2430
  /**
@@ -3202,6 +3223,38 @@ var SearchScope$1;
3202
3223
  SearchScope[SearchScope["All"] = 7] = "All";
3203
3224
  })(SearchScope$1 || (SearchScope$1 = {}));
3204
3225
 
3226
+ /******************************************************************************
3227
+ Copyright (c) Microsoft Corporation.
3228
+
3229
+ Permission to use, copy, modify, and/or distribute this software for any
3230
+ purpose with or without fee is hereby granted.
3231
+
3232
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3233
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3234
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3235
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3236
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3237
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3238
+ PERFORMANCE OF THIS SOFTWARE.
3239
+ ***************************************************************************** */
3240
+
3241
+ function __rest(s, e) {
3242
+ var t = {};
3243
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3244
+ t[p] = s[p];
3245
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
3246
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3247
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3248
+ t[p[i]] = s[p[i]];
3249
+ }
3250
+ return t;
3251
+ }
3252
+
3253
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3254
+ var e = new Error(message);
3255
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3256
+ };
3257
+
3205
3258
  // Copyright (c) Microsoft Corporation.
3206
3259
  let DIALOG_NAME = "BotSsoExecutionDialog";
3207
3260
  let TEAMS_SSO_PROMPT_ID = "TeamsFxSsoPrompt";
@@ -3483,8 +3536,7 @@ class DefaultBotSsoExecutionActivityHandler extends TeamsActivityHandler {
3483
3536
  timeout: (_h = (_g = ssoConfig.dialog) === null || _g === void 0 ? void 0 : _g.ssoPromptConfig) === null || _h === void 0 ? void 0 : _h.timeout,
3484
3537
  endOnInvalidMessage: (_k = (_j = ssoConfig.dialog) === null || _j === void 0 ? void 0 : _j.ssoPromptConfig) === null || _k === void 0 ? void 0 : _k.endOnInvalidMessage,
3485
3538
  };
3486
- const teamsfx = new TeamsFx(IdentityType.User, Object.assign({}, customConfig));
3487
- this.ssoExecutionDialog = new BotSsoExecutionDialog(dedupStorage, settings, teamsfx);
3539
+ this.ssoExecutionDialog = new BotSsoExecutionDialog(dedupStorage, settings, customConfig, customConfig.initiateLoginEndpoint);
3488
3540
  this.conversationState = conversationState;
3489
3541
  this.dialogState = conversationState.createProperty("DialogState");
3490
3542
  this.userState = userState;
@@ -3535,7 +3587,7 @@ class DefaultBotSsoExecutionActivityHandler extends TeamsActivityHandler {
3535
3587
  * @param query Signin state (part of signin action auth flow) verification invoke query
3536
3588
  * @returns A promise that represents the work queued.
3537
3589
  *
3538
- * @remark
3590
+ * @remarks
3539
3591
  * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
3540
3592
  */
3541
3593
  async handleTeamsSigninTokenExchange(context, query) {
@@ -3645,9 +3697,12 @@ class ConversationBot$1 {
3645
3697
  // the default error handler
3646
3698
  adapter.onTurnError = async (context, error) => {
3647
3699
  // This check writes out errors to console.
3700
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
3648
3701
  console.error(`[onTurnError] unhandled error: ${error}`);
3649
3702
  // Send a trace activity, which will be displayed in Bot Framework Emulator
3650
- await context.sendTraceActivity("OnTurnError Trace", `${error}`, "https://www.botframework.com/schemas/error", "TurnError");
3703
+ await context.sendTraceActivity("OnTurnError Trace",
3704
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
3705
+ `${error}`, "https://www.botframework.com/schemas/error", "TurnError");
3651
3706
  // Send a message to the user
3652
3707
  await context.sendActivity(`The bot encountered unhandled error: ${error.message}`);
3653
3708
  await context.sendActivity("To continue to run this bot, please fix the bot source code.");
@@ -3926,6 +3981,7 @@ async function executionWithTokenAndConfig(context, authConfig, initiateLoginEnd
3926
3981
  }
3927
3982
  /**
3928
3983
  * execution in message extension with SSO token.
3984
+ * @deprecated Use {@link executionWithTokenAndConfig} instead.
3929
3985
  *
3930
3986
  * @param {TurnContext} context - The context object for the current turn.
3931
3987
  * @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.
@@ -3974,7 +4030,7 @@ async function executionWithToken(context, config, scopes, logic) {
3974
4030
  // eslint-disable-next-line no-secrets/no-secrets
3975
4031
  /**
3976
4032
  * Users execute query in message extension with SSO or access token.
3977
- *
4033
+ * @deprecated Use {@link handleMessageExtensionQueryWithSSO} instead.
3978
4034
  *
3979
4035
  * @param {TurnContext} context - The context object for the current turn.
3980
4036
  * @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.