@microsoft/teamsfx 1.1.2-alpha.fe09f4739.0 → 1.2.0-rc.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.
@@ -69,6 +69,30 @@ exports.ErrorCode = void 0;
69
69
  * Channel is not supported error.
70
70
  */
71
71
  ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
72
+ /**
73
+ * Failed to retrieve sso token
74
+ */
75
+ ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
76
+ /**
77
+ * Failed to process sso handler
78
+ */
79
+ ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
80
+ /**
81
+ * Cannot find command
82
+ */
83
+ ErrorCode["CannotFindCommand"] = "CannotFindCommand";
84
+ /**
85
+ * Failed to run sso step
86
+ */
87
+ ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
88
+ /**
89
+ * Failed to run dedup step
90
+ */
91
+ ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
92
+ /**
93
+ * Sso activity handler is undefined
94
+ */
95
+ ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
72
96
  /**
73
97
  * Runtime is not supported error.
74
98
  */
@@ -124,6 +148,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
124
148
  ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
125
149
  // ChannelNotSupported Error
126
150
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
151
+ ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
152
+ // FailedToRetrieveSsoToken Error
153
+ ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
154
+ // CannotFindCommand Error
155
+ ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
156
+ ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
157
+ ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
158
+ // SsoActivityHandlerIsUndefined Error
159
+ ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
127
160
  // IdentityTypeNotSupported Error
128
161
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
129
162
  // AuthorizationInfoError
@@ -134,6 +167,7 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
134
167
  ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
135
168
  ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
136
169
  ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
170
+ ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
137
171
  /**
138
172
  * Error class with code and message thrown by the SDK.
139
173
  */
@@ -728,10 +762,13 @@ class TeamsUserCredential {
728
762
  }
729
763
  /**
730
764
  * Popup login page to get user's access token with specific scopes.
765
+ *
766
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
767
+ *
731
768
  * @remarks
732
769
  * Can only be used within Teams.
733
770
  */
734
- login(scopes) {
771
+ login(scopes, resources) {
735
772
  return tslib.__awaiter(this, void 0, void 0, function* () {
736
773
  throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), exports.ErrorCode.RuntimeNotSupported);
737
774
  });
@@ -748,10 +785,13 @@ class TeamsUserCredential {
748
785
  }
749
786
  /**
750
787
  * Get basic user info from SSO token
788
+ *
789
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
790
+ *
751
791
  * @remarks
752
792
  * Can only be used within Teams.
753
793
  */
754
- getUserInfo() {
794
+ getUserInfo(resources) {
755
795
  throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), exports.ErrorCode.RuntimeNotSupported);
756
796
  }
757
797
  }
@@ -1767,9 +1807,10 @@ class TeamsFx {
1767
1807
  }
1768
1808
  /**
1769
1809
  * Get user information.
1810
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1770
1811
  * @returns UserInfo object.
1771
1812
  */
1772
- getUserInfo() {
1813
+ getUserInfo(resources) {
1773
1814
  return tslib.__awaiter(this, void 0, void 0, function* () {
1774
1815
  if (this.identityType !== exports.IdentityType.User) {
1775
1816
  const errorMsg = formatString(ErrorMessage.IdentityTypeNotSupported, this.identityType.toString(), "TeamsFx");
@@ -1793,13 +1834,14 @@ class TeamsFx {
1793
1834
  * await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
1794
1835
  * ```
1795
1836
  * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
1837
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1796
1838
  *
1797
1839
  * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
1798
1840
  * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
1799
1841
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
1800
1842
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
1801
1843
  */
1802
- login(scopes) {
1844
+ login(scopes, resources) {
1803
1845
  return tslib.__awaiter(this, void 0, void 0, function* () {
1804
1846
  throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "login"), exports.ErrorCode.RuntimeNotSupported);
1805
1847
  });
@@ -2184,43 +2226,86 @@ class CardActionBot {
2184
2226
  * @internal
2185
2227
  */
2186
2228
  class CommandResponseMiddleware {
2187
- constructor(handlers) {
2229
+ constructor(handlers, ssoHandlers, activityHandler) {
2188
2230
  this.commandHandlers = [];
2189
- if (handlers && handlers.length > 0) {
2190
- this.commandHandlers.push(...handlers);
2231
+ this.ssoCommandHandlers = [];
2232
+ handlers = handlers !== null && handlers !== void 0 ? handlers : [];
2233
+ ssoHandlers = ssoHandlers !== null && ssoHandlers !== void 0 ? ssoHandlers : [];
2234
+ this.hasSsoCommand = ssoHandlers.length > 0;
2235
+ this.ssoActivityHandler = activityHandler;
2236
+ if (this.hasSsoCommand && !this.ssoActivityHandler) {
2237
+ internalLogger.error(ErrorMessage.SsoActivityHandlerIsNull);
2238
+ throw new ErrorWithCode(ErrorMessage.SsoActivityHandlerIsNull, exports.ErrorCode.SsoActivityHandlerIsUndefined);
2239
+ }
2240
+ this.commandHandlers.push(...handlers);
2241
+ for (const ssoHandler of ssoHandlers) {
2242
+ this.addSsoCommand(ssoHandler);
2191
2243
  }
2192
2244
  }
2245
+ addSsoCommand(ssoHandler) {
2246
+ var _a;
2247
+ (_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.addCommand((context, tokenResponse, message) => tslib.__awaiter(this, void 0, void 0, function* () {
2248
+ const matchResult = this.shouldTrigger(ssoHandler.triggerPatterns, message.text);
2249
+ message.matches = Array.isArray(matchResult) ? matchResult : void 0;
2250
+ const response = yield ssoHandler.handleCommandReceived(context, message, tokenResponse);
2251
+ yield this.processResponse(context, response);
2252
+ }), ssoHandler.triggerPatterns);
2253
+ this.ssoCommandHandlers.push(ssoHandler);
2254
+ this.hasSsoCommand = true;
2255
+ }
2193
2256
  onTurn(context, next) {
2257
+ var _a, _b;
2194
2258
  return tslib.__awaiter(this, void 0, void 0, function* () {
2195
2259
  if (context.activity.type === botbuilder.ActivityTypes.Message) {
2196
2260
  // Invoke corresponding command handler for the command response
2197
2261
  const commandText = this.getActivityText(context.activity);
2198
- const message = {
2199
- text: commandText,
2200
- };
2262
+ let alreadyProcessed = false;
2201
2263
  for (const handler of this.commandHandlers) {
2202
2264
  const matchResult = this.shouldTrigger(handler.triggerPatterns, commandText);
2203
2265
  // It is important to note that the command bot will stop processing handlers
2204
2266
  // when the first command handler is matched.
2205
2267
  if (!!matchResult) {
2268
+ const message = {
2269
+ text: commandText,
2270
+ };
2206
2271
  message.matches = Array.isArray(matchResult) ? matchResult : void 0;
2207
2272
  const response = yield handler.handleCommandReceived(context, message);
2208
- if (typeof response === "string") {
2209
- yield context.sendActivity(response);
2210
- }
2211
- else {
2212
- const replyActivity = response;
2213
- if (replyActivity) {
2214
- yield context.sendActivity(replyActivity);
2215
- }
2216
- }
2273
+ yield this.processResponse(context, response);
2274
+ alreadyProcessed = true;
2217
2275
  break;
2218
2276
  }
2219
2277
  }
2278
+ if (!alreadyProcessed) {
2279
+ for (const handler of this.ssoCommandHandlers) {
2280
+ const matchResult = this.shouldTrigger(handler.triggerPatterns, commandText);
2281
+ if (!!matchResult) {
2282
+ yield ((_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.run(context));
2283
+ break;
2284
+ }
2285
+ }
2286
+ }
2287
+ }
2288
+ else {
2289
+ if (this.hasSsoCommand) {
2290
+ yield ((_b = this.ssoActivityHandler) === null || _b === void 0 ? void 0 : _b.run(context));
2291
+ }
2220
2292
  }
2221
2293
  yield next();
2222
2294
  });
2223
2295
  }
2296
+ processResponse(context, response) {
2297
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2298
+ if (typeof response === "string") {
2299
+ yield context.sendActivity(response);
2300
+ }
2301
+ else {
2302
+ const replyActivity = response;
2303
+ if (replyActivity) {
2304
+ yield context.sendActivity(replyActivity);
2305
+ }
2306
+ }
2307
+ });
2308
+ }
2224
2309
  matchPattern(pattern, text) {
2225
2310
  if (text) {
2226
2311
  if (typeof pattern === "string") {
@@ -2270,14 +2355,15 @@ class CommandBot {
2270
2355
  * @param adapter The bound `BotFrameworkAdapter`.
2271
2356
  * @param options - initialize options
2272
2357
  */
2273
- constructor(adapter, options) {
2274
- this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands);
2358
+ constructor(adapter, options, ssoCommandActivityHandler, ssoConfig) {
2359
+ this.ssoConfig = ssoConfig;
2360
+ this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands, options === null || options === void 0 ? void 0 : options.ssoCommands, ssoCommandActivityHandler);
2275
2361
  this.adapter = adapter.use(this.middleware);
2276
2362
  }
2277
2363
  /**
2278
2364
  * Registers a command into the command bot.
2279
2365
  *
2280
- * @param command The command to registered.
2366
+ * @param command The command to register.
2281
2367
  */
2282
2368
  registerCommand(command) {
2283
2369
  if (command) {
@@ -2287,13 +2373,41 @@ class CommandBot {
2287
2373
  /**
2288
2374
  * Registers commands into the command bot.
2289
2375
  *
2290
- * @param commands The command to registered.
2376
+ * @param commands The commands to register.
2291
2377
  */
2292
2378
  registerCommands(commands) {
2293
2379
  if (commands) {
2294
2380
  this.middleware.commandHandlers.push(...commands);
2295
2381
  }
2296
2382
  }
2383
+ /**
2384
+ * Registers a sso command into the command bot.
2385
+ *
2386
+ * @param command The command to register.
2387
+ */
2388
+ registerSsoCommand(ssoCommand) {
2389
+ this.validateSsoActivityHandler();
2390
+ this.middleware.addSsoCommand(ssoCommand);
2391
+ }
2392
+ /**
2393
+ * Registers commands into the command bot.
2394
+ *
2395
+ * @param commands The commands to register.
2396
+ */
2397
+ registerSsoCommands(ssoCommands) {
2398
+ if (ssoCommands.length > 0) {
2399
+ this.validateSsoActivityHandler();
2400
+ for (const ssoCommand of ssoCommands) {
2401
+ this.middleware.addSsoCommand(ssoCommand);
2402
+ }
2403
+ }
2404
+ }
2405
+ validateSsoActivityHandler() {
2406
+ if (!this.middleware.ssoActivityHandler) {
2407
+ internalLogger.error(ErrorMessage.SsoActivityHandlerIsNull);
2408
+ throw new ErrorWithCode(ErrorMessage.SsoActivityHandlerIsNull, exports.ErrorCode.SsoActivityHandlerIsUndefined);
2409
+ }
2410
+ }
2297
2411
  }
2298
2412
 
2299
2413
  // Copyright (c) Microsoft Corporation.
@@ -2801,6 +2915,10 @@ class TeamsBotInstallation {
2801
2915
  */
2802
2916
  channels() {
2803
2917
  return tslib.__awaiter(this, void 0, void 0, function* () {
2918
+ const channels = [];
2919
+ if (this.type !== exports.NotificationTargetType.Channel) {
2920
+ return channels;
2921
+ }
2804
2922
  let teamsChannels = [];
2805
2923
  yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2806
2924
  const teamId = getTeamsBotInstallationId(context);
@@ -2808,7 +2926,6 @@ class TeamsBotInstallation {
2808
2926
  teamsChannels = yield botbuilder.TeamsInfo.getTeamChannels(context, teamId);
2809
2927
  }
2810
2928
  }));
2811
- const channels = [];
2812
2929
  for (const channel of teamsChannels) {
2813
2930
  channels.push(new Channel(this, channel));
2814
2931
  }
@@ -2836,6 +2953,26 @@ class TeamsBotInstallation {
2836
2953
  return members;
2837
2954
  });
2838
2955
  }
2956
+ /**
2957
+ * Get team details from this bot installation
2958
+ *
2959
+ * @returns the team details if bot is installed into a team, otherwise returns undefined.
2960
+ */
2961
+ getTeamDetails() {
2962
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2963
+ if (this.type !== exports.NotificationTargetType.Channel) {
2964
+ return undefined;
2965
+ }
2966
+ let teamDetails;
2967
+ yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2968
+ const teamId = getTeamsBotInstallationId(context);
2969
+ if (teamId !== undefined) {
2970
+ teamDetails = yield botbuilder.TeamsInfo.getTeamDetails(context, teamId);
2971
+ }
2972
+ }));
2973
+ return teamDetails;
2974
+ });
2975
+ }
2839
2976
  }
2840
2977
  /**
2841
2978
  * Provide utilities to send notification to varies targets (e.g., member, group, channel).
@@ -2897,6 +3034,488 @@ class NotificationBot {
2897
3034
  return targets;
2898
3035
  });
2899
3036
  }
3037
+ /**
3038
+ * Returns the first {@link Member} where predicate is true, and undefined otherwise.
3039
+ *
3040
+ * @param predicate find calls predicate once for each member of the installation,
3041
+ * until it finds one where predicate returns true. If such a member is found, find
3042
+ * immediately returns that member. Otherwise, find returns undefined.
3043
+ * @param scope the scope to find members from the installations
3044
+ * (personal chat, group chat, Teams channel).
3045
+ * @returns the first {@link Member} where predicate is true, and undefined otherwise.
3046
+ */
3047
+ findMember(predicate, scope) {
3048
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3049
+ for (const target of yield this.installations()) {
3050
+ if (this.matchSearchScope(target, scope)) {
3051
+ for (const member of yield target.members()) {
3052
+ if (yield predicate(member)) {
3053
+ return member;
3054
+ }
3055
+ }
3056
+ }
3057
+ }
3058
+ return;
3059
+ });
3060
+ }
3061
+ /**
3062
+ * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
3063
+ *
3064
+ * @param predicate find calls predicate once for each channel of the installation,
3065
+ * until it finds one where predicate returns true. If such a channel is found, find
3066
+ * immediately returns that channel. Otherwise, find returns undefined.
3067
+ * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
3068
+ */
3069
+ findChannel(predicate) {
3070
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3071
+ for (const target of yield this.installations()) {
3072
+ if (target.type === exports.NotificationTargetType.Channel) {
3073
+ const teamDetails = yield target.getTeamDetails();
3074
+ for (const channel of yield target.channels()) {
3075
+ if (yield predicate(channel, teamDetails)) {
3076
+ return channel;
3077
+ }
3078
+ }
3079
+ }
3080
+ }
3081
+ return;
3082
+ });
3083
+ }
3084
+ /**
3085
+ * Returns all {@link Member} where predicate is true, and empty array otherwise.
3086
+ *
3087
+ * @param predicate find calls predicate for each member of the installation.
3088
+ * @param scope the scope to find members from the installations
3089
+ * (personal chat, group chat, Teams channel).
3090
+ * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
3091
+ */
3092
+ findAllMembers(predicate, scope) {
3093
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3094
+ const members = [];
3095
+ for (const target of yield this.installations()) {
3096
+ if (this.matchSearchScope(target, scope)) {
3097
+ for (const member of yield target.members()) {
3098
+ if (yield predicate(member)) {
3099
+ members.push(member);
3100
+ }
3101
+ }
3102
+ }
3103
+ }
3104
+ return members;
3105
+ });
3106
+ }
3107
+ /**
3108
+ * Returns all {@link Channel} where predicate is true, and empty array otherwise.
3109
+ *
3110
+ * @param predicate find calls predicate for each channel of the installation.
3111
+ * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
3112
+ */
3113
+ findAllChannels(predicate) {
3114
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3115
+ const channels = [];
3116
+ for (const target of yield this.installations()) {
3117
+ if (target.type === exports.NotificationTargetType.Channel) {
3118
+ const teamDetails = yield target.getTeamDetails();
3119
+ for (const channel of yield target.channels()) {
3120
+ if (yield predicate(channel, teamDetails)) {
3121
+ channels.push(channel);
3122
+ }
3123
+ }
3124
+ }
3125
+ }
3126
+ return channels;
3127
+ });
3128
+ }
3129
+ matchSearchScope(target, scope) {
3130
+ scope = scope !== null && scope !== void 0 ? scope : exports.SearchScope.All;
3131
+ return ((target.type === exports.NotificationTargetType.Channel && (scope & exports.SearchScope.Channel) !== 0) ||
3132
+ (target.type === exports.NotificationTargetType.Group && (scope & exports.SearchScope.Group) !== 0) ||
3133
+ (target.type === exports.NotificationTargetType.Person && (scope & exports.SearchScope.Person) !== 0));
3134
+ }
3135
+ }
3136
+ /**
3137
+ * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
3138
+ * The search scope is a flagged enum and it can be combined with `|`.
3139
+ * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
3140
+ */
3141
+ exports.SearchScope = void 0;
3142
+ (function (SearchScope) {
3143
+ /**
3144
+ * Search members from the installations in personal chat only.
3145
+ */
3146
+ SearchScope[SearchScope["Person"] = 1] = "Person";
3147
+ /**
3148
+ * Search members from the installations in group chat only.
3149
+ */
3150
+ SearchScope[SearchScope["Group"] = 2] = "Group";
3151
+ /**
3152
+ * Search members from the installations in Teams channel only.
3153
+ */
3154
+ SearchScope[SearchScope["Channel"] = 4] = "Channel";
3155
+ /**
3156
+ * Search members from all installations including personal chat, group chat and Teams channel.
3157
+ */
3158
+ SearchScope[SearchScope["All"] = 7] = "All";
3159
+ })(exports.SearchScope || (exports.SearchScope = {}));
3160
+
3161
+ // Copyright (c) Microsoft Corporation.
3162
+ let DIALOG_NAME = "BotSsoExecutionDialog";
3163
+ let TEAMS_SSO_PROMPT_ID = "TeamsFxSsoPrompt";
3164
+ let COMMAND_ROUTE_DIALOG = "CommandRouteDialog";
3165
+ /**
3166
+ * Sso execution dialog, use to handle sso command
3167
+ */
3168
+ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
3169
+ /**
3170
+ * Creates a new instance of the BotSsoExecutionDialog.
3171
+ * @param dedupStorage Helper storage to remove duplicated messages
3172
+ * @param settings The list of scopes for which the token will have access
3173
+ * @param teamsfx {@link TeamsFx} instance for authentication
3174
+ */
3175
+ constructor(dedupStorage, ssoPromptSettings, teamsfx, dialogName) {
3176
+ super(dialogName !== null && dialogName !== void 0 ? dialogName : DIALOG_NAME);
3177
+ this.dedupStorageKeys = [];
3178
+ // Map to store the commandId and triggerPatterns, key: commandId, value: triggerPatterns
3179
+ this.commandMapping = new Map();
3180
+ if (dialogName) {
3181
+ DIALOG_NAME = dialogName;
3182
+ TEAMS_SSO_PROMPT_ID = dialogName + TEAMS_SSO_PROMPT_ID;
3183
+ COMMAND_ROUTE_DIALOG = dialogName + COMMAND_ROUTE_DIALOG;
3184
+ }
3185
+ this.initialDialogId = COMMAND_ROUTE_DIALOG;
3186
+ this.dedupStorage = dedupStorage;
3187
+ this.dedupStorageKeys = [];
3188
+ const ssoDialog = new TeamsBotSsoPrompt(teamsfx, TEAMS_SSO_PROMPT_ID, ssoPromptSettings);
3189
+ this.addDialog(ssoDialog);
3190
+ const commandRouteDialog = new botbuilderDialogs.WaterfallDialog(COMMAND_ROUTE_DIALOG, [
3191
+ this.commandRouteStep.bind(this),
3192
+ ]);
3193
+ this.addDialog(commandRouteDialog);
3194
+ }
3195
+ /**
3196
+ * Add TeamsFxBotSsoCommandHandler instance
3197
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
3198
+ * @param triggerPatterns The trigger pattern
3199
+ */
3200
+ addCommand(handler, triggerPatterns) {
3201
+ const commandId = this.getCommandHash(triggerPatterns);
3202
+ const dialog = new botbuilderDialogs.WaterfallDialog(commandId, [
3203
+ this.ssoStep.bind(this),
3204
+ this.dedupStep.bind(this),
3205
+ (stepContext) => tslib.__awaiter(this, void 0, void 0, function* () {
3206
+ const tokenResponse = stepContext.result.tokenResponse;
3207
+ const context = stepContext.context;
3208
+ const message = stepContext.result.message;
3209
+ try {
3210
+ if (tokenResponse) {
3211
+ yield handler(context, tokenResponse, message);
3212
+ }
3213
+ else {
3214
+ throw new Error(ErrorMessage.FailedToRetrieveSsoToken);
3215
+ }
3216
+ return yield stepContext.endDialog();
3217
+ }
3218
+ catch (error) {
3219
+ const errorMsg = formatString(ErrorMessage.FailedToProcessSsoHandler, error.message);
3220
+ internalLogger.error(errorMsg);
3221
+ return yield stepContext.endDialog(new ErrorWithCode(errorMsg, exports.ErrorCode.FailedToProcessSsoHandler));
3222
+ }
3223
+ }),
3224
+ ]);
3225
+ this.commandMapping.set(commandId, triggerPatterns);
3226
+ this.addDialog(dialog);
3227
+ }
3228
+ getCommandHash(patterns) {
3229
+ const expressions = Array.isArray(patterns) ? patterns : [patterns];
3230
+ const patternStr = expressions.join();
3231
+ const patternStrWithoutSpecialChar = patternStr.replace(/[^a-zA-Z0-9]/g, "");
3232
+ const hash = crypto.createHash("sha256").update(patternStr).digest("hex").toLowerCase();
3233
+ return patternStrWithoutSpecialChar + hash;
3234
+ }
3235
+ /**
3236
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
3237
+ *
3238
+ * @param context The context object for the current turn.
3239
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
3240
+ */
3241
+ run(context, accessor) {
3242
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3243
+ const dialogSet = new botbuilderDialogs.DialogSet(accessor);
3244
+ dialogSet.add(this);
3245
+ const dialogContext = yield dialogSet.createContext(context);
3246
+ this.ensureMsTeamsChannel(dialogContext);
3247
+ const results = yield dialogContext.continueDialog();
3248
+ if (results && results.status === botbuilderDialogs.DialogTurnStatus.empty) {
3249
+ yield dialogContext.beginDialog(this.id);
3250
+ }
3251
+ else if (results &&
3252
+ results.status === botbuilderDialogs.DialogTurnStatus.complete &&
3253
+ results.result instanceof Error) {
3254
+ throw results.result;
3255
+ }
3256
+ });
3257
+ }
3258
+ getActivityText(activity) {
3259
+ let text = activity.text;
3260
+ const removedMentionText = botbuilder.TurnContext.removeRecipientMention(activity);
3261
+ if (removedMentionText) {
3262
+ text = removedMentionText
3263
+ .toLowerCase()
3264
+ .replace(/\n|\r\n/g, "")
3265
+ .trim();
3266
+ }
3267
+ return text;
3268
+ }
3269
+ commandRouteStep(stepContext) {
3270
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3271
+ const turnContext = stepContext.context;
3272
+ const text = this.getActivityText(turnContext.activity);
3273
+ const commandId = this.getMatchesCommandId(text);
3274
+ if (commandId) {
3275
+ return yield stepContext.beginDialog(commandId);
3276
+ }
3277
+ const errorMsg = formatString(ErrorMessage.CannotFindCommand, turnContext.activity.text);
3278
+ internalLogger.error(errorMsg);
3279
+ throw new ErrorWithCode(errorMsg, exports.ErrorCode.CannotFindCommand);
3280
+ });
3281
+ }
3282
+ ssoStep(stepContext) {
3283
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3284
+ try {
3285
+ const turnContext = stepContext.context;
3286
+ const text = this.getActivityText(turnContext.activity);
3287
+ const message = {
3288
+ text,
3289
+ };
3290
+ stepContext.options.commandMessage = message;
3291
+ return yield stepContext.beginDialog(TEAMS_SSO_PROMPT_ID);
3292
+ }
3293
+ catch (error) {
3294
+ const errorMsg = formatString(ErrorMessage.FailedToRunSsoStep, error.message);
3295
+ internalLogger.error(errorMsg);
3296
+ return yield stepContext.endDialog(new ErrorWithCode(errorMsg, exports.ErrorCode.FailedToRunSsoStep));
3297
+ }
3298
+ });
3299
+ }
3300
+ dedupStep(stepContext) {
3301
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3302
+ const tokenResponse = stepContext.result;
3303
+ if (!tokenResponse) {
3304
+ internalLogger.error(ErrorMessage.FailedToRetrieveSsoToken);
3305
+ return yield stepContext.endDialog(new ErrorWithCode(ErrorMessage.FailedToRetrieveSsoToken, exports.ErrorCode.FailedToRunSsoStep));
3306
+ }
3307
+ try {
3308
+ // Only dedup after ssoStep to make sure that all Teams client would receive the login request
3309
+ if (tokenResponse && (yield this.shouldDedup(stepContext.context))) {
3310
+ return botbuilderDialogs.Dialog.EndOfTurn;
3311
+ }
3312
+ return yield stepContext.next({
3313
+ tokenResponse,
3314
+ message: stepContext.options.commandMessage,
3315
+ });
3316
+ }
3317
+ catch (error) {
3318
+ const errorMsg = formatString(ErrorMessage.FailedToRunDedupStep, error.message);
3319
+ internalLogger.error(errorMsg);
3320
+ return yield stepContext.endDialog(new ErrorWithCode(errorMsg, exports.ErrorCode.FailedToRunDedupStep));
3321
+ }
3322
+ });
3323
+ }
3324
+ /**
3325
+ * Called when the component is ending.
3326
+ *
3327
+ * @param context Context for the current turn of conversation.
3328
+ */
3329
+ onEndDialog(context) {
3330
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3331
+ const conversationId = context.activity.conversation.id;
3332
+ const currentDedupKeys = this.dedupStorageKeys.filter((key) => key.indexOf(conversationId) > 0);
3333
+ yield this.dedupStorage.delete(currentDedupKeys);
3334
+ this.dedupStorageKeys = this.dedupStorageKeys.filter((key) => key.indexOf(conversationId) < 0);
3335
+ });
3336
+ }
3337
+ /**
3338
+ * If a user is signed into multiple Teams clients, the Bot might receive a "signin/tokenExchange" from each client.
3339
+ * Each token exchange request for a specific user login will have an identical activity.value.Id.
3340
+ * Only one of these token exchange requests should be processed by the bot. For a distributed bot in production,
3341
+ * this requires a distributed storage to ensure only one token exchange is processed.
3342
+ * @param context Context for the current turn of conversation.
3343
+ * @returns boolean value indicate whether the message should be removed
3344
+ */
3345
+ shouldDedup(context) {
3346
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3347
+ const storeItem = {
3348
+ eTag: context.activity.value.id,
3349
+ };
3350
+ const key = this.getStorageKey(context);
3351
+ const storeItems = { [key]: storeItem };
3352
+ try {
3353
+ yield this.dedupStorage.write(storeItems);
3354
+ this.dedupStorageKeys.push(key);
3355
+ }
3356
+ catch (err) {
3357
+ if (err instanceof Error && err.message.indexOf("eTag conflict")) {
3358
+ return true;
3359
+ }
3360
+ throw err;
3361
+ }
3362
+ return false;
3363
+ });
3364
+ }
3365
+ getStorageKey(context) {
3366
+ if (!context || !context.activity || !context.activity.conversation) {
3367
+ throw new Error("Invalid context, can not get storage key!");
3368
+ }
3369
+ const activity = context.activity;
3370
+ const channelId = activity.channelId;
3371
+ const conversationId = activity.conversation.id;
3372
+ if (activity.type !== botbuilder.ActivityTypes.Invoke || activity.name !== botbuilder.tokenExchangeOperationName) {
3373
+ throw new Error("TokenExchangeState can only be used with Invokes of signin/tokenExchange.");
3374
+ }
3375
+ const value = activity.value;
3376
+ if (!value || !value.id) {
3377
+ throw new Error("Invalid signin/tokenExchange. Missing activity.value.id.");
3378
+ }
3379
+ return `${channelId}/${conversationId}/${value.id}`;
3380
+ }
3381
+ matchPattern(pattern, text) {
3382
+ if (text) {
3383
+ if (typeof pattern === "string") {
3384
+ const regExp = new RegExp(pattern, "i");
3385
+ return regExp.test(text);
3386
+ }
3387
+ if (pattern instanceof RegExp) {
3388
+ const matches = text.match(pattern);
3389
+ return matches !== null && matches !== void 0 ? matches : false;
3390
+ }
3391
+ }
3392
+ return false;
3393
+ }
3394
+ isPatternMatched(patterns, text) {
3395
+ const expressions = Array.isArray(patterns) ? patterns : [patterns];
3396
+ for (const ex of expressions) {
3397
+ const matches = this.matchPattern(ex, text);
3398
+ return !!matches;
3399
+ }
3400
+ return false;
3401
+ }
3402
+ getMatchesCommandId(text) {
3403
+ for (const command of this.commandMapping) {
3404
+ const pattern = command[1];
3405
+ if (this.isPatternMatched(pattern, text)) {
3406
+ return command[0];
3407
+ }
3408
+ }
3409
+ return undefined;
3410
+ }
3411
+ /**
3412
+ * Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.
3413
+ * @param dc dialog context
3414
+ * @throws {@link ErrorCode|ChannelNotSupported} if bot channel is not MS Teams
3415
+ * @internal
3416
+ */
3417
+ ensureMsTeamsChannel(dc) {
3418
+ if (dc.context.activity.channelId != botbuilder.Channels.Msteams) {
3419
+ const errorMsg = formatString(ErrorMessage.OnlyMSTeamsChannelSupported, "SSO execution dialog");
3420
+ internalLogger.error(errorMsg);
3421
+ throw new ErrorWithCode(errorMsg, exports.ErrorCode.ChannelNotSupported);
3422
+ }
3423
+ }
3424
+ }
3425
+
3426
+ // Copyright (c) Microsoft Corporation.
3427
+ /**
3428
+ * Default SSO execution activity handler
3429
+ */
3430
+ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHandler {
3431
+ /**
3432
+ * Creates a new instance of the DefaultBotSsoExecutionActivityHandler.
3433
+ * @param ssoConfig configuration for SSO command bot
3434
+ *
3435
+ * @remarks
3436
+ * In the constructor, it uses BotSsoConfig parameter which from {@link ConversationBot} options to initialize {@link BotSsoExecutionDialog}.
3437
+ * It also need to register an event handler for the message event which trigger {@link BotSsoExecutionDialog} instance.
3438
+ */
3439
+ constructor(ssoConfig) {
3440
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3441
+ super();
3442
+ const memoryStorage = new botbuilder.MemoryStorage();
3443
+ const userState = (_b = (_a = ssoConfig.dialog) === null || _a === void 0 ? void 0 : _a.userState) !== null && _b !== void 0 ? _b : new botbuilder.UserState(memoryStorage);
3444
+ const conversationState = (_d = (_c = ssoConfig.dialog) === null || _c === void 0 ? void 0 : _c.conversationState) !== null && _d !== void 0 ? _d : new botbuilder.ConversationState(memoryStorage);
3445
+ const dedupStorage = (_f = (_e = ssoConfig.dialog) === null || _e === void 0 ? void 0 : _e.dedupStorage) !== null && _f !== void 0 ? _f : memoryStorage;
3446
+ const _l = ssoConfig.aad, { scopes } = _l, customConfig = tslib.__rest(_l, ["scopes"]);
3447
+ const settings = {
3448
+ scopes: scopes,
3449
+ timeout: (_h = (_g = ssoConfig.dialog) === null || _g === void 0 ? void 0 : _g.ssoPromptConfig) === null || _h === void 0 ? void 0 : _h.timeout,
3450
+ endOnInvalidMessage: (_k = (_j = ssoConfig.dialog) === null || _j === void 0 ? void 0 : _j.ssoPromptConfig) === null || _k === void 0 ? void 0 : _k.endOnInvalidMessage,
3451
+ };
3452
+ const teamsfx = new TeamsFx(exports.IdentityType.User, Object.assign({}, customConfig));
3453
+ this.ssoExecutionDialog = new BotSsoExecutionDialog(dedupStorage, settings, teamsfx);
3454
+ this.conversationState = conversationState;
3455
+ this.dialogState = conversationState.createProperty("DialogState");
3456
+ this.userState = userState;
3457
+ this.onMessage((context, next) => tslib.__awaiter(this, void 0, void 0, function* () {
3458
+ yield this.ssoExecutionDialog.run(context, this.dialogState);
3459
+ yield next();
3460
+ }));
3461
+ }
3462
+ /**
3463
+ * Add TeamsFxBotSsoCommandHandler instance to SSO execution dialog
3464
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
3465
+ * @param triggerPatterns The trigger pattern
3466
+ *
3467
+ * @remarks
3468
+ * This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.
3469
+ */
3470
+ addCommand(handler, triggerPatterns) {
3471
+ this.ssoExecutionDialog.addCommand(handler, triggerPatterns);
3472
+ }
3473
+ /**
3474
+ * Called to initiate the event emission process.
3475
+ * @param context The context object for the current turn.
3476
+ */
3477
+ run(context) {
3478
+ const _super = Object.create(null, {
3479
+ run: { get: () => super.run }
3480
+ });
3481
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3482
+ try {
3483
+ yield _super.run.call(this, context);
3484
+ }
3485
+ finally {
3486
+ yield this.conversationState.saveChanges(context, false);
3487
+ yield this.userState.saveChanges(context, false);
3488
+ }
3489
+ });
3490
+ }
3491
+ /**
3492
+ * Receives invoke activities with Activity name of 'signin/verifyState'.
3493
+ * @param context A context object for this turn.
3494
+ * @param query Signin state (part of signin action auth flow) verification invoke query.
3495
+ * @returns A promise that represents the work queued.
3496
+ *
3497
+ * @remarks
3498
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
3499
+ */
3500
+ handleTeamsSigninVerifyState(context, query) {
3501
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3502
+ yield this.ssoExecutionDialog.run(context, this.dialogState);
3503
+ });
3504
+ }
3505
+ /**
3506
+ * Receives invoke activities with Activity name of 'signin/tokenExchange'
3507
+ * @param context A context object for this turn.
3508
+ * @param query Signin state (part of signin action auth flow) verification invoke query
3509
+ * @returns A promise that represents the work queued.
3510
+ *
3511
+ * @remark
3512
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
3513
+ */
3514
+ handleTeamsSigninTokenExchange(context, query) {
3515
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3516
+ yield this.ssoExecutionDialog.run(context, this.dialogState);
3517
+ });
3518
+ }
2900
3519
  }
2901
3520
 
2902
3521
  // Copyright (c) Microsoft Corporation.
@@ -2961,20 +3580,30 @@ class ConversationBot {
2961
3580
  * @param options - initialize options
2962
3581
  */
2963
3582
  constructor(options) {
2964
- var _a, _b, _c;
3583
+ var _a, _b, _c, _d;
2965
3584
  if (options.adapter) {
2966
3585
  this.adapter = options.adapter;
2967
3586
  }
2968
3587
  else {
2969
3588
  this.adapter = this.createDefaultAdapter(options.adapterConfig);
2970
3589
  }
2971
- if ((_a = options.command) === null || _a === void 0 ? void 0 : _a.enabled) {
2972
- this.command = new CommandBot(this.adapter, options.command);
3590
+ let ssoCommandActivityHandler;
3591
+ if (options === null || options === void 0 ? void 0 : options.ssoConfig) {
3592
+ if ((_a = options.ssoConfig.dialog) === null || _a === void 0 ? void 0 : _a.CustomBotSsoExecutionActivityHandler) {
3593
+ ssoCommandActivityHandler =
3594
+ new options.ssoConfig.dialog.CustomBotSsoExecutionActivityHandler(options.ssoConfig);
3595
+ }
3596
+ else {
3597
+ ssoCommandActivityHandler = new DefaultBotSsoExecutionActivityHandler(options.ssoConfig);
3598
+ }
2973
3599
  }
2974
- if ((_b = options.notification) === null || _b === void 0 ? void 0 : _b.enabled) {
3600
+ if ((_b = options.command) === null || _b === void 0 ? void 0 : _b.enabled) {
3601
+ this.command = new CommandBot(this.adapter, options.command, ssoCommandActivityHandler, options.ssoConfig);
3602
+ }
3603
+ if ((_c = options.notification) === null || _c === void 0 ? void 0 : _c.enabled) {
2975
3604
  this.notification = new NotificationBot(this.adapter, options.notification);
2976
3605
  }
2977
- if ((_c = options.cardAction) === null || _c === void 0 ? void 0 : _c.enabled) {
3606
+ if ((_d = options.cardAction) === null || _d === void 0 ? void 0 : _d.enabled) {
2978
3607
  this.cardAction = new CardActionBot(this.adapter, options.cardAction);
2979
3608
  }
2980
3609
  }
@@ -3165,10 +3794,115 @@ class MessageBuilder {
3165
3794
  }
3166
3795
  }
3167
3796
 
3797
+ // Copyright (c) Microsoft Corporation.
3798
+ /**
3799
+ * Retrieve the OAuth Sign in Link to use in the MessagingExtensionResult Suggested Actions.
3800
+ * This method only work on MessageExtension with Query now.
3801
+ *
3802
+ * @param {TeamsFx} teamsfx - Used to provide configuration and auth.
3803
+ * @param {string | string[]} scopes - The list of scopes for which the token will have access.
3804
+ *
3805
+ * @returns SignIn link CardAction with 200 status code.
3806
+ */
3807
+ function getSignInResponseForMessageExtension(teamsfx, scopes) {
3808
+ const scopesArray = getScopesArray(scopes);
3809
+ const signInLink = `${teamsfx.getConfig("initiateLoginEndpoint")}?scope=${encodeURI(scopesArray.join(" "))}&clientId=${teamsfx.getConfig("clientId")}&tenantId=${teamsfx.getConfig("tenantId")}`;
3810
+ return {
3811
+ composeExtension: {
3812
+ type: "silentAuth",
3813
+ suggestedActions: {
3814
+ actions: [
3815
+ {
3816
+ type: "openUrl",
3817
+ value: signInLink,
3818
+ title: "Message Extension OAuth",
3819
+ },
3820
+ ],
3821
+ },
3822
+ },
3823
+ };
3824
+ }
3825
+ /**
3826
+ * execution in message extension with SSO token.
3827
+ *
3828
+ * @param {TurnContext} context - The context object for the current turn.
3829
+ * @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.
3830
+ * @param {string[]} scopes - The list of scopes for which the token will have access.
3831
+ * @param {function} logic - Business logic when executing the query in message extension with SSO or access token.
3832
+ *
3833
+ * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.
3834
+ * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.
3835
+ * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.
3836
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
3837
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
3838
+ *
3839
+ * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
3840
+ */
3841
+ function executionWithToken(context, config, scopes, logic) {
3842
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3843
+ const valueObj = context.activity.value;
3844
+ if (!valueObj.authentication || !valueObj.authentication.token) {
3845
+ internalLogger.verbose("No AccessToken in request, return silentAuth for AccessToken");
3846
+ return getSignInResponseForMessageExtension(new TeamsFx(exports.IdentityType.User, config), scopes);
3847
+ }
3848
+ try {
3849
+ const teamsfx = new TeamsFx(exports.IdentityType.User, config).setSsoToken(valueObj.authentication.token);
3850
+ const token = yield teamsfx.getCredential().getToken(scopes);
3851
+ const ssoTokenExpiration = parseJwt(valueObj.authentication.token).exp;
3852
+ const tokenRes = {
3853
+ ssoToken: valueObj.authentication.token,
3854
+ ssoTokenExpiration: new Date(ssoTokenExpiration * 1000).toISOString(),
3855
+ token: token.token,
3856
+ expiration: token.expiresOnTimestamp.toString(),
3857
+ connectionName: "",
3858
+ };
3859
+ if (logic) {
3860
+ return yield logic(tokenRes);
3861
+ }
3862
+ }
3863
+ catch (err) {
3864
+ if (err instanceof ErrorWithCode && err.code === exports.ErrorCode.UiRequiredError) {
3865
+ internalLogger.verbose("User not consent yet, return 412 to user consent first.");
3866
+ const response = { status: 412 };
3867
+ yield context.sendActivity({ value: response, type: botbuilder.ActivityTypes.InvokeResponse });
3868
+ return;
3869
+ }
3870
+ throw err;
3871
+ }
3872
+ });
3873
+ }
3874
+ /**
3875
+ * Users execute query in message extension with SSO or access token.
3876
+ *
3877
+ * @param {TurnContext} context - The context object for the current turn.
3878
+ * @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.
3879
+ * @param {string| string[]} scopes - The list of scopes for which the token will have access.
3880
+ * @param {function} logic - Business logic when executing the query in message extension with SSO or access token.
3881
+ *
3882
+ * @throws {@link ErrorCode|InternalError} when User invoke not response to message extension query.
3883
+ * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.
3884
+ * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.
3885
+ * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.
3886
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
3887
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
3888
+ *
3889
+ * @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
3890
+ */
3891
+ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
3892
+ return tslib.__awaiter(this, void 0, void 0, function* () {
3893
+ if (context.activity.name != "composeExtension/query") {
3894
+ internalLogger.error(ErrorMessage.OnlySupportInQueryActivity);
3895
+ throw new ErrorWithCode(formatString(ErrorMessage.OnlySupportInQueryActivity), exports.ErrorCode.FailedOperation);
3896
+ }
3897
+ return yield executionWithToken(context, config !== null && config !== void 0 ? config : {}, scopes, logic);
3898
+ });
3899
+ }
3900
+
3168
3901
  exports.ApiKeyProvider = ApiKeyProvider;
3169
3902
  exports.AppCredential = AppCredential;
3170
3903
  exports.BasicAuthProvider = BasicAuthProvider;
3171
3904
  exports.BearerTokenAuthProvider = BearerTokenAuthProvider;
3905
+ exports.BotSsoExecutionDialog = BotSsoExecutionDialog;
3172
3906
  exports.CardActionBot = CardActionBot;
3173
3907
  exports.CertificateAuthProvider = CertificateAuthProvider;
3174
3908
  exports.Channel = Channel;
@@ -3191,6 +3925,7 @@ exports.createPemCertOption = createPemCertOption;
3191
3925
  exports.createPfxCertOption = createPfxCertOption;
3192
3926
  exports.getLogLevel = getLogLevel;
3193
3927
  exports.getTediousConnectionConfig = getTediousConnectionConfig;
3928
+ exports.handleMessageExtensionQueryWithToken = handleMessageExtensionQueryWithToken;
3194
3929
  exports.sendAdaptiveCard = sendAdaptiveCard;
3195
3930
  exports.sendMessage = sendMessage;
3196
3931
  exports.setLogFunction = setLogFunction;