@microsoft/teamsfx 2.2.3-alpha.5925cbfed.0 → 2.2.3-alpha.690002e72.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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var tslib = require('tslib');
6
5
  var jwt_decode = require('jwt-decode');
7
6
  var msalNode = require('@azure/msal-node');
8
7
  var crypto = require('crypto');
@@ -190,6 +189,48 @@ class ErrorWithCode extends Error {
190
189
  }
191
190
  }
192
191
 
192
+ /******************************************************************************
193
+ Copyright (c) Microsoft Corporation.
194
+
195
+ Permission to use, copy, modify, and/or distribute this software for any
196
+ purpose with or without fee is hereby granted.
197
+
198
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
199
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
200
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
201
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
202
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
203
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
204
+ PERFORMANCE OF THIS SOFTWARE.
205
+ ***************************************************************************** */
206
+
207
+ function __rest(s, e) {
208
+ var t = {};
209
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
210
+ t[p] = s[p];
211
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
212
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
213
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
214
+ t[p[i]] = s[p[i]];
215
+ }
216
+ return t;
217
+ }
218
+
219
+ function __awaiter(thisArg, _arguments, P, generator) {
220
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
221
+ return new (P || (P = Promise))(function (resolve, reject) {
222
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
223
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
224
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
225
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
226
+ });
227
+ }
228
+
229
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
230
+ var e = new Error(message);
231
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
232
+ };
233
+
193
234
  // Copyright (c) Microsoft Corporation.
194
235
  // Licensed under the MIT license.
195
236
  /**
@@ -514,7 +555,7 @@ class AppCredential {
514
555
  * Throw error if get access token failed.
515
556
  */
516
557
  getToken(scopes, options) {
517
- return tslib.__awaiter(this, void 0, void 0, function* () {
558
+ return __awaiter(this, void 0, void 0, function* () {
518
559
  let accessToken;
519
560
  validateScopesType(scopes);
520
561
  const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
@@ -652,7 +693,7 @@ class OnBehalfOfUserCredential {
652
693
  * If scopes is non-empty, it returns access token for target scope.
653
694
  */
654
695
  getToken(scopes, options) {
655
- return tslib.__awaiter(this, void 0, void 0, function* () {
696
+ return __awaiter(this, void 0, void 0, function* () {
656
697
  validateScopesType(scopes);
657
698
  const scopesArray = getScopesArray(scopes);
658
699
  let result;
@@ -805,7 +846,7 @@ class MsGraphAuthProvider {
805
846
  *
806
847
  */
807
848
  getAccessToken() {
808
- return tslib.__awaiter(this, void 0, void 0, function* () {
849
+ return __awaiter(this, void 0, void 0, function* () {
809
850
  internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);
810
851
  let accessToken;
811
852
  if (this.credentialOrTeamsFx.getCredential) {
@@ -985,7 +1026,7 @@ const defaultSQLScope = "https://database.windows.net/";
985
1026
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
986
1027
  */
987
1028
  function getTediousConnectionConfig(teamsfx, databaseName) {
988
- return tslib.__awaiter(this, void 0, void 0, function* () {
1029
+ return __awaiter(this, void 0, void 0, function* () {
989
1030
  internalLogger.info("Get SQL configuration");
990
1031
  try {
991
1032
  isSQLConfigurationValid(teamsfx);
@@ -1089,7 +1130,7 @@ function generateDefaultConfig(teamsfx, databaseName) {
1089
1130
  * @internal
1090
1131
  */
1091
1132
  function generateTokenConfig(teamsfx, databaseName) {
1092
- return tslib.__awaiter(this, void 0, void 0, function* () {
1133
+ return __awaiter(this, void 0, void 0, function* () {
1093
1134
  internalLogger.verbose("Generate tedious config with MSI token");
1094
1135
  let token;
1095
1136
  try {
@@ -1246,7 +1287,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
1246
1287
  */
1247
1288
  beginDialog(dc) {
1248
1289
  var _a;
1249
- return tslib.__awaiter(this, void 0, void 0, function* () {
1290
+ return __awaiter(this, void 0, void 0, function* () {
1250
1291
  internalLogger.info("Begin Teams Bot SSO Prompt");
1251
1292
  this.ensureMsTeamsChannel(dc);
1252
1293
  // Initialize prompt state
@@ -1295,7 +1336,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
1295
1336
  */
1296
1337
  continueDialog(dc) {
1297
1338
  var _a;
1298
- return tslib.__awaiter(this, void 0, void 0, function* () {
1339
+ return __awaiter(this, void 0, void 0, function* () {
1299
1340
  internalLogger.info("Continue Teams Bot SSO Prompt");
1300
1341
  this.ensureMsTeamsChannel(dc);
1301
1342
  // Check for timeout
@@ -1388,7 +1429,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
1388
1429
  * @internal
1389
1430
  */
1390
1431
  sendOAuthCardAsync(context) {
1391
- return tslib.__awaiter(this, void 0, void 0, function* () {
1432
+ return __awaiter(this, void 0, void 0, function* () {
1392
1433
  internalLogger.verbose("Send OAuth card to get SSO token");
1393
1434
  const account = yield botbuilder.TeamsInfo.getMember(context, context.activity.from.id);
1394
1435
  internalLogger.verbose("Get Teams member account user principal name: " +
@@ -1425,7 +1466,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
1425
1466
  * @internal
1426
1467
  */
1427
1468
  recognizeToken(dc) {
1428
- return tslib.__awaiter(this, void 0, void 0, function* () {
1469
+ return __awaiter(this, void 0, void 0, function* () {
1429
1470
  const context = dc.context;
1430
1471
  let tokenResponse;
1431
1472
  if (this.isTokenExchangeRequestInvoke(context)) {
@@ -1522,7 +1563,7 @@ function createApiClient(apiEndpoint, authProvider) {
1522
1563
  baseURL: apiEndpoint,
1523
1564
  });
1524
1565
  instance.interceptors.request.use(function (config) {
1525
- return tslib.__awaiter(this, void 0, void 0, function* () {
1566
+ return __awaiter(this, void 0, void 0, function* () {
1526
1567
  return yield authProvider.AddAuthenticationInfo(config);
1527
1568
  });
1528
1569
  });
@@ -1551,7 +1592,7 @@ class BearerTokenAuthProvider {
1551
1592
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
1552
1593
  */
1553
1594
  AddAuthenticationInfo(config) {
1554
- return tslib.__awaiter(this, void 0, void 0, function* () {
1595
+ return __awaiter(this, void 0, void 0, function* () {
1555
1596
  const token = yield this.getToken();
1556
1597
  if (!config.headers) {
1557
1598
  config.headers = {};
@@ -1870,7 +1911,7 @@ class TeamsFx {
1870
1911
  * @returns UserInfo object.
1871
1912
  */
1872
1913
  getUserInfo(resources) {
1873
- return tslib.__awaiter(this, void 0, void 0, function* () {
1914
+ return __awaiter(this, void 0, void 0, function* () {
1874
1915
  if (this.identityType !== exports.IdentityType.User) {
1875
1916
  const errorMsg = formatString(ErrorMessage.IdentityTypeNotSupported, this.identityType.toString(), "TeamsFx");
1876
1917
  internalLogger.error(errorMsg);
@@ -1901,7 +1942,7 @@ class TeamsFx {
1901
1942
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
1902
1943
  */
1903
1944
  login(scopes, resources) {
1904
- return tslib.__awaiter(this, void 0, void 0, function* () {
1945
+ return __awaiter(this, void 0, void 0, function* () {
1905
1946
  throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "login"), exports.ErrorCode.RuntimeNotSupported);
1906
1947
  });
1907
1948
  }
@@ -2040,6 +2081,7 @@ exports.InvokeResponseErrorCode = void 0;
2040
2081
  InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
2041
2082
  })(exports.InvokeResponseErrorCode || (exports.InvokeResponseErrorCode = {}));
2042
2083
 
2084
+ // Copyright (c) Microsoft Corporation.
2043
2085
  /**
2044
2086
  * Available response type for an adaptive card invoke response.
2045
2087
  * @internal
@@ -2054,7 +2096,7 @@ var InvokeResponseType;
2054
2096
  * Provides methods for formatting various invoke responses a bot can send to respond to an invoke request.
2055
2097
  *
2056
2098
  * @remarks
2057
- * All of these functions return an {@link InvokeResponse} object, which can be
2099
+ * All of these functions return an `InvokeResponse` object, which can be
2058
2100
  * passed as input to generate a new `invokeResponse` activity.
2059
2101
  *
2060
2102
  * This example sends an invoke response that contains an adaptive card.
@@ -2180,7 +2222,7 @@ class CardActionMiddleware {
2180
2222
  }
2181
2223
  onTurn(context, next) {
2182
2224
  var _a, _b, _c;
2183
- return tslib.__awaiter(this, void 0, void 0, function* () {
2225
+ return __awaiter(this, void 0, void 0, function* () {
2184
2226
  if (context.activity.name === "adaptiveCard/action") {
2185
2227
  const action = context.activity.value.action;
2186
2228
  const actionVerb = action.verb;
@@ -2237,7 +2279,7 @@ class CardActionMiddleware {
2237
2279
  });
2238
2280
  }
2239
2281
  sendInvokeResponse(context, response) {
2240
- return tslib.__awaiter(this, void 0, void 0, function* () {
2282
+ return __awaiter(this, void 0, void 0, function* () {
2241
2283
  yield context.sendActivity({
2242
2284
  type: botbuilder.ActivityTypes.InvokeResponse,
2243
2285
  value: response,
@@ -2306,7 +2348,7 @@ class CommandResponseMiddleware {
2306
2348
  }
2307
2349
  addSsoCommand(ssoHandler) {
2308
2350
  var _a;
2309
- (_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.addCommand((context, tokenResponse, message) => tslib.__awaiter(this, void 0, void 0, function* () {
2351
+ (_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.addCommand((context, tokenResponse, message) => __awaiter(this, void 0, void 0, function* () {
2310
2352
  const matchResult = this.shouldTrigger(ssoHandler.triggerPatterns, message.text);
2311
2353
  message.matches = Array.isArray(matchResult) ? matchResult : void 0;
2312
2354
  const response = yield ssoHandler.handleCommandReceived(context, message, tokenResponse);
@@ -2317,7 +2359,7 @@ class CommandResponseMiddleware {
2317
2359
  }
2318
2360
  onTurn(context, next) {
2319
2361
  var _a, _b;
2320
- return tslib.__awaiter(this, void 0, void 0, function* () {
2362
+ return __awaiter(this, void 0, void 0, function* () {
2321
2363
  if (context.activity.type === botbuilder.ActivityTypes.Message) {
2322
2364
  // Invoke corresponding command handler for the command response
2323
2365
  const commandText = this.getActivityText(context.activity);
@@ -2356,7 +2398,7 @@ class CommandResponseMiddleware {
2356
2398
  });
2357
2399
  }
2358
2400
  processResponse(context, response) {
2359
- return tslib.__awaiter(this, void 0, void 0, function* () {
2401
+ return __awaiter(this, void 0, void 0, function* () {
2360
2402
  if (typeof response === "string") {
2361
2403
  yield context.sendActivity(response);
2362
2404
  }
@@ -2487,6 +2529,7 @@ function cloneConversation(conversation) {
2487
2529
  */
2488
2530
  function getKey(reference) {
2489
2531
  var _a, _b;
2532
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
2490
2533
  return `_${(_a = reference.conversation) === null || _a === void 0 ? void 0 : _a.tenantId}_${(_b = reference.conversation) === null || _b === void 0 ? void 0 : _b.id}`;
2491
2534
  }
2492
2535
  /**
@@ -2546,7 +2589,7 @@ class NotificationMiddleware {
2546
2589
  this.conversationReferenceStore = options.conversationReferenceStore;
2547
2590
  }
2548
2591
  onTurn(context, next) {
2549
- return tslib.__awaiter(this, void 0, void 0, function* () {
2592
+ return __awaiter(this, void 0, void 0, function* () {
2550
2593
  const type = this.classifyActivity(context.activity);
2551
2594
  switch (type) {
2552
2595
  case ActivityType.CurrentBotInstalled:
@@ -2599,7 +2642,7 @@ class NotificationMiddleware {
2599
2642
  }
2600
2643
  tryAddMessagedReference(context) {
2601
2644
  var _a, _b, _c, _d;
2602
- return tslib.__awaiter(this, void 0, void 0, function* () {
2645
+ return __awaiter(this, void 0, void 0, function* () {
2603
2646
  const reference = botbuilder.TurnContext.getConversationReference(context.activity);
2604
2647
  const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
2605
2648
  if (conversationType === "personal" || conversationType === "groupChat") {
@@ -2629,7 +2672,7 @@ class LocalFileStorage {
2629
2672
  this.filePath = path__namespace.resolve(fileDir, this.localFileName);
2630
2673
  }
2631
2674
  read(key) {
2632
- return tslib.__awaiter(this, void 0, void 0, function* () {
2675
+ return __awaiter(this, void 0, void 0, function* () {
2633
2676
  if (!(yield this.storeFileExists())) {
2634
2677
  return undefined;
2635
2678
  }
@@ -2638,7 +2681,7 @@ class LocalFileStorage {
2638
2681
  });
2639
2682
  }
2640
2683
  list() {
2641
- return tslib.__awaiter(this, void 0, void 0, function* () {
2684
+ return __awaiter(this, void 0, void 0, function* () {
2642
2685
  if (!(yield this.storeFileExists())) {
2643
2686
  return [];
2644
2687
  }
@@ -2647,7 +2690,7 @@ class LocalFileStorage {
2647
2690
  });
2648
2691
  }
2649
2692
  write(key, object) {
2650
- return tslib.__awaiter(this, void 0, void 0, function* () {
2693
+ return __awaiter(this, void 0, void 0, function* () {
2651
2694
  if (!(yield this.storeFileExists())) {
2652
2695
  yield this.writeToFile({ [key]: object });
2653
2696
  return;
@@ -2657,7 +2700,7 @@ class LocalFileStorage {
2657
2700
  });
2658
2701
  }
2659
2702
  delete(key) {
2660
- return tslib.__awaiter(this, void 0, void 0, function* () {
2703
+ return __awaiter(this, void 0, void 0, function* () {
2661
2704
  if (yield this.storeFileExists()) {
2662
2705
  const data = yield this.readFromFile();
2663
2706
  if (data[key] !== undefined) {
@@ -2702,7 +2745,7 @@ class LocalFileStorage {
2702
2745
  });
2703
2746
  }
2704
2747
  writeToFile(data) {
2705
- return tslib.__awaiter(this, void 0, void 0, function* () {
2748
+ return __awaiter(this, void 0, void 0, function* () {
2706
2749
  return new Promise((resolve, reject) => {
2707
2750
  try {
2708
2751
  const rawData = JSON.stringify(data, undefined, 2);
@@ -2730,7 +2773,7 @@ class DefaultConversationReferenceStore {
2730
2773
  this.storage = storage;
2731
2774
  }
2732
2775
  add(key, reference, options) {
2733
- return tslib.__awaiter(this, void 0, void 0, function* () {
2776
+ return __awaiter(this, void 0, void 0, function* () {
2734
2777
  if (options.overwrite) {
2735
2778
  yield this.storage.write(key, reference);
2736
2779
  return true;
@@ -2744,7 +2787,7 @@ class DefaultConversationReferenceStore {
2744
2787
  });
2745
2788
  }
2746
2789
  remove(key, reference) {
2747
- return tslib.__awaiter(this, void 0, void 0, function* () {
2790
+ return __awaiter(this, void 0, void 0, function* () {
2748
2791
  const ref = yield this.storage.read(key);
2749
2792
  if (ref === undefined) {
2750
2793
  return false;
@@ -2754,7 +2797,7 @@ class DefaultConversationReferenceStore {
2754
2797
  });
2755
2798
  }
2756
2799
  list(pageSize, continuationToken) {
2757
- return tslib.__awaiter(this, void 0, void 0, function* () {
2800
+ return __awaiter(this, void 0, void 0, function* () {
2758
2801
  const data = yield this.storage.list();
2759
2802
  return {
2760
2803
  data,
@@ -2822,11 +2865,11 @@ class Channel$1 {
2822
2865
  * @returns the response of sending message.
2823
2866
  */
2824
2867
  sendMessage(text, onError) {
2825
- return tslib.__awaiter(this, void 0, void 0, function* () {
2868
+ return __awaiter(this, void 0, void 0, function* () {
2826
2869
  const response = {};
2827
- yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2870
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
2828
2871
  const conversation = this.newConversation(context);
2829
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2872
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
2830
2873
  try {
2831
2874
  const res = yield ctx.sendActivity(text);
2832
2875
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -2853,11 +2896,11 @@ class Channel$1 {
2853
2896
  * @returns the response of sending adaptive card message.
2854
2897
  */
2855
2898
  sendAdaptiveCard(card, onError) {
2856
- return tslib.__awaiter(this, void 0, void 0, function* () {
2899
+ return __awaiter(this, void 0, void 0, function* () {
2857
2900
  const response = {};
2858
- yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2901
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
2859
2902
  const conversation = this.newConversation(context);
2860
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2903
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
2861
2904
  try {
2862
2905
  const res = yield ctx.sendActivity({
2863
2906
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -2920,11 +2963,11 @@ class Member$1 {
2920
2963
  * @returns the response of sending message.
2921
2964
  */
2922
2965
  sendMessage(text, onError) {
2923
- return tslib.__awaiter(this, void 0, void 0, function* () {
2966
+ return __awaiter(this, void 0, void 0, function* () {
2924
2967
  const response = {};
2925
- yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2968
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
2926
2969
  const conversation = yield this.newConversation(context);
2927
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2970
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
2928
2971
  try {
2929
2972
  const res = yield ctx.sendActivity(text);
2930
2973
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -2951,11 +2994,11 @@ class Member$1 {
2951
2994
  * @returns the response of sending adaptive card message.
2952
2995
  */
2953
2996
  sendAdaptiveCard(card, onError) {
2954
- return tslib.__awaiter(this, void 0, void 0, function* () {
2997
+ return __awaiter(this, void 0, void 0, function* () {
2955
2998
  const response = {};
2956
- yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2999
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
2957
3000
  const conversation = yield this.newConversation(context);
2958
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
3001
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
2959
3002
  try {
2960
3003
  const res = yield ctx.sendActivity({
2961
3004
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -2979,7 +3022,7 @@ class Member$1 {
2979
3022
  * @internal
2980
3023
  */
2981
3024
  newConversation(context) {
2982
- return tslib.__awaiter(this, void 0, void 0, function* () {
3025
+ return __awaiter(this, void 0, void 0, function* () {
2983
3026
  const reference = botbuilder.TurnContext.getConversationReference(context.activity);
2984
3027
  const personalConversation = cloneConversation(reference);
2985
3028
  const connectorClient = context.turnState.get(this.parent.adapter.ConnectorClientKey);
@@ -3031,9 +3074,9 @@ class TeamsBotInstallation$1 {
3031
3074
  * @returns the response of sending message.
3032
3075
  */
3033
3076
  sendMessage(text, onError) {
3034
- return tslib.__awaiter(this, void 0, void 0, function* () {
3077
+ return __awaiter(this, void 0, void 0, function* () {
3035
3078
  const response = {};
3036
- yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3079
+ yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
3037
3080
  try {
3038
3081
  const res = yield context.sendActivity(text);
3039
3082
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -3059,9 +3102,9 @@ class TeamsBotInstallation$1 {
3059
3102
  * @returns the response of sending adaptive card message.
3060
3103
  */
3061
3104
  sendAdaptiveCard(card, onError) {
3062
- return tslib.__awaiter(this, void 0, void 0, function* () {
3105
+ return __awaiter(this, void 0, void 0, function* () {
3063
3106
  const response = {};
3064
- yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3107
+ yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
3065
3108
  try {
3066
3109
  const res = yield context.sendActivity({
3067
3110
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -3086,13 +3129,13 @@ class TeamsBotInstallation$1 {
3086
3129
  * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
3087
3130
  */
3088
3131
  channels() {
3089
- return tslib.__awaiter(this, void 0, void 0, function* () {
3132
+ return __awaiter(this, void 0, void 0, function* () {
3090
3133
  const channels = [];
3091
3134
  if (this.type !== exports.NotificationTargetType.Channel) {
3092
3135
  return channels;
3093
3136
  }
3094
3137
  let teamsChannels = [];
3095
- yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3138
+ yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
3096
3139
  const teamId = getTeamsBotInstallationId(context);
3097
3140
  if (teamId !== undefined) {
3098
3141
  teamsChannels = yield botbuilder.TeamsInfo.getTeamChannels(context, teamId);
@@ -3110,9 +3153,9 @@ class TeamsBotInstallation$1 {
3110
3153
  * @returns an array of members from where the bot is installed.
3111
3154
  */
3112
3155
  members() {
3113
- return tslib.__awaiter(this, void 0, void 0, function* () {
3156
+ return __awaiter(this, void 0, void 0, function* () {
3114
3157
  const members = [];
3115
- yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3158
+ yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
3116
3159
  let continuationToken;
3117
3160
  do {
3118
3161
  const pagedMembers = yield botbuilder.TeamsInfo.getPagedMembers(context, undefined, continuationToken);
@@ -3131,12 +3174,12 @@ class TeamsBotInstallation$1 {
3131
3174
  * @returns the team details if bot is installed into a team, otherwise returns undefined.
3132
3175
  */
3133
3176
  getTeamDetails() {
3134
- return tslib.__awaiter(this, void 0, void 0, function* () {
3177
+ return __awaiter(this, void 0, void 0, function* () {
3135
3178
  if (this.type !== exports.NotificationTargetType.Channel) {
3136
3179
  return undefined;
3137
3180
  }
3138
3181
  let teamDetails;
3139
- yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3182
+ yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
3140
3183
  const teamId = getTeamsBotInstallationId(context);
3141
3184
  if (teamId !== undefined) {
3142
3185
  teamDetails = yield botbuilder.TeamsInfo.getTeamDetails(context, teamId);
@@ -3179,7 +3222,7 @@ class NotificationBot$1 {
3179
3222
  * @returns - an array of {@link TeamsBotInstallation}.
3180
3223
  */
3181
3224
  installations() {
3182
- return tslib.__awaiter(this, void 0, void 0, function* () {
3225
+ return __awaiter(this, void 0, void 0, function* () {
3183
3226
  if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
3184
3227
  throw new Error("NotificationBot has not been initialized.");
3185
3228
  }
@@ -3188,7 +3231,7 @@ class NotificationBot$1 {
3188
3231
  for (const reference of references) {
3189
3232
  // validate connection
3190
3233
  let valid = true;
3191
- yield this.adapter.continueConversation(reference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
3234
+ yield this.adapter.continueConversation(reference, (context) => __awaiter(this, void 0, void 0, function* () {
3192
3235
  try {
3193
3236
  // try get member to see if the installation is still valid
3194
3237
  yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
@@ -3220,7 +3263,7 @@ class NotificationBot$1 {
3220
3263
  * @returns the first {@link Member} where predicate is true, and undefined otherwise.
3221
3264
  */
3222
3265
  findMember(predicate, scope) {
3223
- return tslib.__awaiter(this, void 0, void 0, function* () {
3266
+ return __awaiter(this, void 0, void 0, function* () {
3224
3267
  for (const target of yield this.installations()) {
3225
3268
  if (this.matchSearchScope(target, scope)) {
3226
3269
  for (const member of yield target.members()) {
@@ -3243,7 +3286,7 @@ class NotificationBot$1 {
3243
3286
  * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
3244
3287
  */
3245
3288
  findChannel(predicate) {
3246
- return tslib.__awaiter(this, void 0, void 0, function* () {
3289
+ return __awaiter(this, void 0, void 0, function* () {
3247
3290
  for (const target of yield this.installations()) {
3248
3291
  if (target.type === exports.NotificationTargetType.Channel) {
3249
3292
  const teamDetails = yield target.getTeamDetails();
@@ -3266,7 +3309,7 @@ class NotificationBot$1 {
3266
3309
  * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
3267
3310
  */
3268
3311
  findAllMembers(predicate, scope) {
3269
- return tslib.__awaiter(this, void 0, void 0, function* () {
3312
+ return __awaiter(this, void 0, void 0, function* () {
3270
3313
  const members = [];
3271
3314
  for (const target of yield this.installations()) {
3272
3315
  if (this.matchSearchScope(target, scope)) {
@@ -3288,7 +3331,7 @@ class NotificationBot$1 {
3288
3331
  * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
3289
3332
  */
3290
3333
  findAllChannels(predicate) {
3291
- return tslib.__awaiter(this, void 0, void 0, function* () {
3334
+ return __awaiter(this, void 0, void 0, function* () {
3292
3335
  const channels = [];
3293
3336
  for (const target of yield this.installations()) {
3294
3337
  if (target.type === exports.NotificationTargetType.Channel) {
@@ -3381,7 +3424,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3381
3424
  const dialog = new botbuilderDialogs.WaterfallDialog(commandId, [
3382
3425
  this.ssoStep.bind(this),
3383
3426
  this.dedupStep.bind(this),
3384
- (stepContext) => tslib.__awaiter(this, void 0, void 0, function* () {
3427
+ (stepContext) => __awaiter(this, void 0, void 0, function* () {
3385
3428
  const tokenResponse = stepContext.result.tokenResponse;
3386
3429
  const context = stepContext.context;
3387
3430
  const message = stepContext.result.message;
@@ -3418,7 +3461,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3418
3461
  * @param accessor The instance of StatePropertyAccessor for dialog system.
3419
3462
  */
3420
3463
  run(context, accessor) {
3421
- return tslib.__awaiter(this, void 0, void 0, function* () {
3464
+ return __awaiter(this, void 0, void 0, function* () {
3422
3465
  const dialogSet = new botbuilderDialogs.DialogSet(accessor);
3423
3466
  dialogSet.add(this);
3424
3467
  const dialogContext = yield dialogSet.createContext(context);
@@ -3446,7 +3489,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3446
3489
  return text;
3447
3490
  }
3448
3491
  commandRouteStep(stepContext) {
3449
- return tslib.__awaiter(this, void 0, void 0, function* () {
3492
+ return __awaiter(this, void 0, void 0, function* () {
3450
3493
  const turnContext = stepContext.context;
3451
3494
  const text = this.getActivityText(turnContext.activity);
3452
3495
  const commandId = this.getMatchesCommandId(text);
@@ -3459,7 +3502,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3459
3502
  });
3460
3503
  }
3461
3504
  ssoStep(stepContext) {
3462
- return tslib.__awaiter(this, void 0, void 0, function* () {
3505
+ return __awaiter(this, void 0, void 0, function* () {
3463
3506
  try {
3464
3507
  const turnContext = stepContext.context;
3465
3508
  const text = this.getActivityText(turnContext.activity);
@@ -3477,7 +3520,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3477
3520
  });
3478
3521
  }
3479
3522
  dedupStep(stepContext) {
3480
- return tslib.__awaiter(this, void 0, void 0, function* () {
3523
+ return __awaiter(this, void 0, void 0, function* () {
3481
3524
  const tokenResponse = stepContext.result;
3482
3525
  if (!tokenResponse) {
3483
3526
  internalLogger.error(ErrorMessage.FailedToRetrieveSsoToken);
@@ -3506,7 +3549,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3506
3549
  * @param context Context for the current turn of conversation.
3507
3550
  */
3508
3551
  onEndDialog(context) {
3509
- return tslib.__awaiter(this, void 0, void 0, function* () {
3552
+ return __awaiter(this, void 0, void 0, function* () {
3510
3553
  const conversationId = context.activity.conversation.id;
3511
3554
  const currentDedupKeys = this.dedupStorageKeys.filter((key) => key.indexOf(conversationId) > 0);
3512
3555
  yield this.dedupStorage.delete(currentDedupKeys);
@@ -3522,7 +3565,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3522
3565
  * @returns boolean value indicate whether the message should be removed
3523
3566
  */
3524
3567
  shouldDedup(context) {
3525
- return tslib.__awaiter(this, void 0, void 0, function* () {
3568
+ return __awaiter(this, void 0, void 0, function* () {
3526
3569
  const storeItem = {
3527
3570
  eTag: context.activity.value.id,
3528
3571
  };
@@ -3622,18 +3665,17 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
3622
3665
  const userState = (_b = (_a = ssoConfig.dialog) === null || _a === void 0 ? void 0 : _a.userState) !== null && _b !== void 0 ? _b : new botbuilder.UserState(memoryStorage);
3623
3666
  const conversationState = (_d = (_c = ssoConfig.dialog) === null || _c === void 0 ? void 0 : _c.conversationState) !== null && _d !== void 0 ? _d : new botbuilder.ConversationState(memoryStorage);
3624
3667
  const dedupStorage = (_f = (_e = ssoConfig.dialog) === null || _e === void 0 ? void 0 : _e.dedupStorage) !== null && _f !== void 0 ? _f : memoryStorage;
3625
- const _l = ssoConfig.aad, { scopes } = _l, customConfig = tslib.__rest(_l, ["scopes"]);
3668
+ const _l = ssoConfig.aad, { scopes } = _l, customConfig = __rest(_l, ["scopes"]);
3626
3669
  const settings = {
3627
3670
  scopes: scopes,
3628
3671
  timeout: (_h = (_g = ssoConfig.dialog) === null || _g === void 0 ? void 0 : _g.ssoPromptConfig) === null || _h === void 0 ? void 0 : _h.timeout,
3629
3672
  endOnInvalidMessage: (_k = (_j = ssoConfig.dialog) === null || _j === void 0 ? void 0 : _j.ssoPromptConfig) === null || _k === void 0 ? void 0 : _k.endOnInvalidMessage,
3630
3673
  };
3631
- const teamsfx = new TeamsFx(exports.IdentityType.User, Object.assign({}, customConfig));
3632
- this.ssoExecutionDialog = new BotSsoExecutionDialog(dedupStorage, settings, teamsfx);
3674
+ this.ssoExecutionDialog = new BotSsoExecutionDialog(dedupStorage, settings, customConfig, customConfig.initiateLoginEndpoint);
3633
3675
  this.conversationState = conversationState;
3634
3676
  this.dialogState = conversationState.createProperty("DialogState");
3635
3677
  this.userState = userState;
3636
- this.onMessage((context, next) => tslib.__awaiter(this, void 0, void 0, function* () {
3678
+ this.onMessage((context, next) => __awaiter(this, void 0, void 0, function* () {
3637
3679
  yield this.ssoExecutionDialog.run(context, this.dialogState);
3638
3680
  yield next();
3639
3681
  }));
@@ -3657,7 +3699,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
3657
3699
  const _super = Object.create(null, {
3658
3700
  run: { get: () => super.run }
3659
3701
  });
3660
- return tslib.__awaiter(this, void 0, void 0, function* () {
3702
+ return __awaiter(this, void 0, void 0, function* () {
3661
3703
  try {
3662
3704
  yield _super.run.call(this, context);
3663
3705
  }
@@ -3677,7 +3719,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
3677
3719
  * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
3678
3720
  */
3679
3721
  handleTeamsSigninVerifyState(context, query) {
3680
- return tslib.__awaiter(this, void 0, void 0, function* () {
3722
+ return __awaiter(this, void 0, void 0, function* () {
3681
3723
  yield this.ssoExecutionDialog.run(context, this.dialogState);
3682
3724
  });
3683
3725
  }
@@ -3687,11 +3729,11 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
3687
3729
  * @param query Signin state (part of signin action auth flow) verification invoke query
3688
3730
  * @returns A promise that represents the work queued.
3689
3731
  *
3690
- * @remark
3732
+ * @remarks
3691
3733
  * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
3692
3734
  */
3693
3735
  handleTeamsSigninTokenExchange(context, query) {
3694
- return tslib.__awaiter(this, void 0, void 0, function* () {
3736
+ return __awaiter(this, void 0, void 0, function* () {
3695
3737
  yield this.ssoExecutionDialog.run(context, this.dialogState);
3696
3738
  });
3697
3739
  }
@@ -3797,11 +3839,14 @@ class ConversationBot$1 {
3797
3839
  })
3798
3840
  : new botbuilder.BotFrameworkAdapter(adapterConfig);
3799
3841
  // the default error handler
3800
- adapter.onTurnError = (context, error) => tslib.__awaiter(this, void 0, void 0, function* () {
3842
+ adapter.onTurnError = (context, error) => __awaiter(this, void 0, void 0, function* () {
3801
3843
  // This check writes out errors to console.
3844
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
3802
3845
  console.error(`[onTurnError] unhandled error: ${error}`);
3803
3846
  // Send a trace activity, which will be displayed in Bot Framework Emulator
3804
- yield context.sendTraceActivity("OnTurnError Trace", `${error}`, "https://www.botframework.com/schemas/error", "TurnError");
3847
+ yield context.sendTraceActivity("OnTurnError Trace",
3848
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
3849
+ `${error}`, "https://www.botframework.com/schemas/error", "TurnError");
3805
3850
  // Send a message to the user
3806
3851
  yield context.sendActivity(`The bot encountered unhandled error: ${error.message}`);
3807
3852
  yield context.sendActivity("To continue to run this bot, please fix the bot source code.");
@@ -3830,10 +3875,10 @@ class ConversationBot$1 {
3830
3875
  * ```
3831
3876
  */
3832
3877
  requestHandler(req, res, logic) {
3833
- return tslib.__awaiter(this, void 0, void 0, function* () {
3878
+ return __awaiter(this, void 0, void 0, function* () {
3834
3879
  if (logic === undefined) {
3835
3880
  // create empty logic
3836
- logic = () => tslib.__awaiter(this, void 0, void 0, function* () { });
3881
+ logic = () => __awaiter(this, void 0, void 0, function* () { });
3837
3882
  }
3838
3883
  yield this.adapter.processActivity(req, res, logic);
3839
3884
  });
@@ -4050,7 +4095,7 @@ function getSignInResponseForMessageExtension(teamsfx, scopes) {
4050
4095
  * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
4051
4096
  */
4052
4097
  function executionWithTokenAndConfig(context, authConfig, initiateLoginEndpoint, scopes, logic) {
4053
- return tslib.__awaiter(this, void 0, void 0, function* () {
4098
+ return __awaiter(this, void 0, void 0, function* () {
4054
4099
  const valueObj = context.activity.value;
4055
4100
  if (!valueObj.authentication || !valueObj.authentication.token) {
4056
4101
  internalLogger.verbose("No AccessToken in request, return silentAuth for AccessToken");
@@ -4100,7 +4145,7 @@ function executionWithTokenAndConfig(context, authConfig, initiateLoginEndpoint,
4100
4145
  * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
4101
4146
  */
4102
4147
  function executionWithToken(context, config, scopes, logic) {
4103
- return tslib.__awaiter(this, void 0, void 0, function* () {
4148
+ return __awaiter(this, void 0, void 0, function* () {
4104
4149
  const valueObj = context.activity.value;
4105
4150
  if (!valueObj.authentication || !valueObj.authentication.token) {
4106
4151
  internalLogger.verbose("No AccessToken in request, return silentAuth for AccessToken");
@@ -4152,7 +4197,7 @@ function executionWithToken(context, config, scopes, logic) {
4152
4197
  * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
4153
4198
  */
4154
4199
  function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
4155
- return tslib.__awaiter(this, void 0, void 0, function* () {
4200
+ return __awaiter(this, void 0, void 0, function* () {
4156
4201
  if (context.activity.name != "composeExtension/query") {
4157
4202
  internalLogger.error(ErrorMessage.OnlySupportInQueryActivity);
4158
4203
  throw new ErrorWithCode(formatString(ErrorMessage.OnlySupportInQueryActivity), exports.ErrorCode.FailedOperation);
@@ -4179,7 +4224,7 @@ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
4179
4224
  * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
4180
4225
  */
4181
4226
  function handleMessageExtensionQueryWithSSO(context, config, initiateLoginEndpoint, scopes, logic) {
4182
- return tslib.__awaiter(this, void 0, void 0, function* () {
4227
+ return __awaiter(this, void 0, void 0, function* () {
4183
4228
  if (context.activity.name != "composeExtension/query") {
4184
4229
  internalLogger.error(ErrorMessage.OnlySupportInQueryActivity);
4185
4230
  throw new ErrorWithCode(formatString(ErrorMessage.OnlySupportInQueryActivity), exports.ErrorCode.FailedOperation);
@@ -4357,11 +4402,11 @@ class Channel {
4357
4402
  * @returns The response of sending message.
4358
4403
  */
4359
4404
  sendMessage(text, onError) {
4360
- return tslib.__awaiter(this, void 0, void 0, function* () {
4405
+ return __awaiter(this, void 0, void 0, function* () {
4361
4406
  const response = {};
4362
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4407
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4363
4408
  const conversation = yield this.newConversation(context);
4364
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
4409
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
4365
4410
  try {
4366
4411
  const res = yield ctx.sendActivity(text);
4367
4412
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -4389,11 +4434,11 @@ class Channel {
4389
4434
  * @returns The response of sending adaptive card message.
4390
4435
  */
4391
4436
  sendAdaptiveCard(card, onError) {
4392
- return tslib.__awaiter(this, void 0, void 0, function* () {
4437
+ return __awaiter(this, void 0, void 0, function* () {
4393
4438
  const response = {};
4394
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4439
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4395
4440
  const conversation = yield this.newConversation(context);
4396
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
4441
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
4397
4442
  try {
4398
4443
  const res = yield ctx.sendActivity({
4399
4444
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -4457,11 +4502,11 @@ class Member {
4457
4502
  * @returns The response of sending message.
4458
4503
  */
4459
4504
  sendMessage(text, onError) {
4460
- return tslib.__awaiter(this, void 0, void 0, function* () {
4505
+ return __awaiter(this, void 0, void 0, function* () {
4461
4506
  const response = {};
4462
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4507
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4463
4508
  const conversation = yield this.newConversation(context);
4464
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
4509
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
4465
4510
  try {
4466
4511
  const res = yield ctx.sendActivity(text);
4467
4512
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -4489,11 +4534,11 @@ class Member {
4489
4534
  * @returns The response of sending adaptive card message.
4490
4535
  */
4491
4536
  sendAdaptiveCard(card, onError) {
4492
- return tslib.__awaiter(this, void 0, void 0, function* () {
4537
+ return __awaiter(this, void 0, void 0, function* () {
4493
4538
  const response = {};
4494
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4539
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4495
4540
  const conversation = yield this.newConversation(context);
4496
- yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
4541
+ yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
4497
4542
  try {
4498
4543
  const res = yield ctx.sendActivity({
4499
4544
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -4517,7 +4562,7 @@ class Member {
4517
4562
  * @internal
4518
4563
  */
4519
4564
  newConversation(context) {
4520
- return tslib.__awaiter(this, void 0, void 0, function* () {
4565
+ return __awaiter(this, void 0, void 0, function* () {
4521
4566
  const reference = botbuilder.TurnContext.getConversationReference(context.activity);
4522
4567
  const personalConversation = cloneConversation(reference);
4523
4568
  const connectorClient = context.turnState.get(this.parent.adapter.ConnectorClientKey);
@@ -4569,9 +4614,9 @@ class TeamsBotInstallation {
4569
4614
  * @returns The response of sending message.
4570
4615
  */
4571
4616
  sendMessage(text, onError) {
4572
- return tslib.__awaiter(this, void 0, void 0, function* () {
4617
+ return __awaiter(this, void 0, void 0, function* () {
4573
4618
  const response = {};
4574
- yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4619
+ yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4575
4620
  try {
4576
4621
  const res = yield context.sendActivity(text);
4577
4622
  response.id = res === null || res === void 0 ? void 0 : res.id;
@@ -4598,9 +4643,9 @@ class TeamsBotInstallation {
4598
4643
  * @returns The response of sending adaptive card message.
4599
4644
  */
4600
4645
  sendAdaptiveCard(card, onError) {
4601
- return tslib.__awaiter(this, void 0, void 0, function* () {
4646
+ return __awaiter(this, void 0, void 0, function* () {
4602
4647
  const response = {};
4603
- yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4648
+ yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4604
4649
  try {
4605
4650
  const res = yield context.sendActivity({
4606
4651
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
@@ -4625,13 +4670,13 @@ class TeamsBotInstallation {
4625
4670
  * @returns An array of channels if bot is installed into a team, otherwise returns an empty array.
4626
4671
  */
4627
4672
  channels() {
4628
- return tslib.__awaiter(this, void 0, void 0, function* () {
4673
+ return __awaiter(this, void 0, void 0, function* () {
4629
4674
  const channels = [];
4630
4675
  if (this.type !== exports.NotificationTargetType.Channel) {
4631
4676
  return channels;
4632
4677
  }
4633
4678
  let teamsChannels = [];
4634
- yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4679
+ yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4635
4680
  const teamId = getTeamsBotInstallationId(context);
4636
4681
  if (teamId !== undefined) {
4637
4682
  teamsChannels = yield botbuilder.TeamsInfo.getTeamChannels(context, teamId);
@@ -4651,12 +4696,12 @@ class TeamsBotInstallation {
4651
4696
  * @returns An array of members from where the bot is installed.
4652
4697
  */
4653
4698
  getPagedMembers(pageSize, continuationToken) {
4654
- return tslib.__awaiter(this, void 0, void 0, function* () {
4699
+ return __awaiter(this, void 0, void 0, function* () {
4655
4700
  let result = {
4656
4701
  data: [],
4657
4702
  continuationToken: "",
4658
4703
  };
4659
- yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4704
+ yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4660
4705
  const pagedMembers = yield botbuilder.TeamsInfo.getPagedMembers(context, pageSize, continuationToken);
4661
4706
  result = {
4662
4707
  data: pagedMembers.members.map((m) => new Member(this, m)),
@@ -4674,7 +4719,7 @@ class TeamsBotInstallation {
4674
4719
  * @deprecated Use `getPagedMembers` instead.
4675
4720
  */
4676
4721
  members() {
4677
- return tslib.__awaiter(this, void 0, void 0, function* () {
4722
+ return __awaiter(this, void 0, void 0, function* () {
4678
4723
  const members = [];
4679
4724
  let continuationToken;
4680
4725
  do {
@@ -4691,12 +4736,12 @@ class TeamsBotInstallation {
4691
4736
  * @returns The team details if bot is installed into a team, otherwise returns `undefined`.
4692
4737
  */
4693
4738
  getTeamDetails() {
4694
- return tslib.__awaiter(this, void 0, void 0, function* () {
4739
+ return __awaiter(this, void 0, void 0, function* () {
4695
4740
  if (this.type !== exports.NotificationTargetType.Channel) {
4696
4741
  return undefined;
4697
4742
  }
4698
4743
  let teamDetails;
4699
- yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4744
+ yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4700
4745
  const teamId = getTeamsBotInstallationId(context);
4701
4746
  if (teamId !== undefined) {
4702
4747
  teamDetails = yield botbuilder.TeamsInfo.getTeamDetails(context, teamId);
@@ -4752,9 +4797,9 @@ class NotificationBot {
4752
4797
  * @returns Returns false if recieves `BotNotInConversationRoster` error, otherwise returns true.
4753
4798
  */
4754
4799
  validateInstallation(conversationReference) {
4755
- return tslib.__awaiter(this, void 0, void 0, function* () {
4800
+ return __awaiter(this, void 0, void 0, function* () {
4756
4801
  let isValid = true;
4757
- yield this.adapter.continueConversationAsync(this.botAppId, conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4802
+ yield this.adapter.continueConversationAsync(this.botAppId, conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
4758
4803
  try {
4759
4804
  // try get member to see if the installation is still valid
4760
4805
  yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
@@ -4780,7 +4825,7 @@ class NotificationBot {
4780
4825
  * @returns An array of {@link TeamsBotInstallation} with paged data and continuation token.
4781
4826
  */
4782
4827
  getPagedInstallations(pageSize, continuationToken, validationEnabled = true) {
4783
- return tslib.__awaiter(this, void 0, void 0, function* () {
4828
+ return __awaiter(this, void 0, void 0, function* () {
4784
4829
  if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
4785
4830
  throw new Error("NotificationBot has not been initialized.");
4786
4831
  }
@@ -4817,7 +4862,7 @@ class NotificationBot {
4817
4862
  * @deprecated Use getPagedInstallations instead.
4818
4863
  */
4819
4864
  installations() {
4820
- return tslib.__awaiter(this, void 0, void 0, function* () {
4865
+ return __awaiter(this, void 0, void 0, function* () {
4821
4866
  let continuationToken;
4822
4867
  const targets = [];
4823
4868
  do {
@@ -4840,7 +4885,7 @@ class NotificationBot {
4840
4885
  * @returns The first {@link Member} where predicate is true, and `undefined` otherwise.
4841
4886
  */
4842
4887
  findMember(predicate, scope) {
4843
- return tslib.__awaiter(this, void 0, void 0, function* () {
4888
+ return __awaiter(this, void 0, void 0, function* () {
4844
4889
  for (const target of yield this.installations()) {
4845
4890
  if (this.matchSearchScope(target, scope)) {
4846
4891
  for (const member of yield target.members()) {
@@ -4864,7 +4909,7 @@ class NotificationBot {
4864
4909
  * @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.
4865
4910
  */
4866
4911
  findChannel(predicate) {
4867
- return tslib.__awaiter(this, void 0, void 0, function* () {
4912
+ return __awaiter(this, void 0, void 0, function* () {
4868
4913
  for (const target of yield this.installations()) {
4869
4914
  if (target.type === exports.NotificationTargetType.Channel) {
4870
4915
  const teamDetails = yield target.getTeamDetails();
@@ -4888,7 +4933,7 @@ class NotificationBot {
4888
4933
  * @returns An array of {@link Member} where predicate is true, and empty array otherwise.
4889
4934
  */
4890
4935
  findAllMembers(predicate, scope) {
4891
- return tslib.__awaiter(this, void 0, void 0, function* () {
4936
+ return __awaiter(this, void 0, void 0, function* () {
4892
4937
  const members = [];
4893
4938
  for (const target of yield this.installations()) {
4894
4939
  if (this.matchSearchScope(target, scope)) {
@@ -4911,7 +4956,7 @@ class NotificationBot {
4911
4956
  * @returns An array of {@link Channel} where predicate is true, and empty array otherwise.
4912
4957
  */
4913
4958
  findAllChannels(predicate) {
4914
- return tslib.__awaiter(this, void 0, void 0, function* () {
4959
+ return __awaiter(this, void 0, void 0, function* () {
4915
4960
  const channels = [];
4916
4961
  for (const target of yield this.installations()) {
4917
4962
  if (target.type === exports.NotificationTargetType.Channel) {
@@ -5064,7 +5109,7 @@ class ConversationBot {
5064
5109
  const botFrameworkAuthentication = new botbuilder.ConfigurationBotFrameworkAuthentication({}, credentialsFactory);
5065
5110
  const adapter = new botbuilder.CloudAdapter(botFrameworkAuthentication);
5066
5111
  // the default error handler
5067
- adapter.onTurnError = (context, error) => tslib.__awaiter(this, void 0, void 0, function* () {
5112
+ adapter.onTurnError = (context, error) => __awaiter(this, void 0, void 0, function* () {
5068
5113
  // This check writes out errors to console.
5069
5114
  console.error(`[onTurnError] unhandled error`, error);
5070
5115
  // Send a trace activity, which will be displayed in Bot Framework Emulator
@@ -5099,10 +5144,10 @@ class ConversationBot {
5099
5144
  * ```
5100
5145
  */
5101
5146
  requestHandler(req, res, logic) {
5102
- return tslib.__awaiter(this, void 0, void 0, function* () {
5147
+ return __awaiter(this, void 0, void 0, function* () {
5103
5148
  if (logic === undefined) {
5104
5149
  // create empty logic
5105
- logic = () => tslib.__awaiter(this, void 0, void 0, function* () { });
5150
+ logic = () => __awaiter(this, void 0, void 0, function* () { });
5106
5151
  }
5107
5152
  yield this.adapter.process(req, res, logic);
5108
5153
  });