@microsoft/teamsfx 1.1.2-rc-hotfix.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +293 -20
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +1099 -124
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +309 -20
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1142 -123
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +7 -5
- package/types/teamsfx.d.ts +578 -23
package/types/teamsfx.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import { AccessToken } from '@azure/identity';
|
|
4
|
-
import { Activity } from 'botbuilder
|
|
5
|
-
import { Activity as Activity_2 } from 'botbuilder';
|
|
4
|
+
import { Activity } from 'botbuilder';
|
|
6
5
|
import { Attachment } from 'botbuilder';
|
|
7
6
|
import { AuthenticationProvider } from '@microsoft/microsoft-graph-client';
|
|
8
7
|
import { AxiosInstance } from 'axios';
|
|
@@ -12,25 +11,52 @@ import { CardAction } from 'botbuilder';
|
|
|
12
11
|
import { CardImage } from 'botbuilder';
|
|
13
12
|
import { ChannelInfo } from 'botbuilder';
|
|
14
13
|
import { Client } from '@microsoft/microsoft-graph-client';
|
|
14
|
+
import { ComponentDialog } from 'botbuilder-dialogs';
|
|
15
15
|
import { ConnectionConfig } from 'tedious';
|
|
16
16
|
import { ConversationReference } from 'botbuilder';
|
|
17
|
+
import { ConversationState } from 'botbuilder';
|
|
17
18
|
import { Dialog } from 'botbuilder-dialogs';
|
|
18
19
|
import { DialogContext } from 'botbuilder-dialogs';
|
|
19
20
|
import { DialogTurnResult } from 'botbuilder-dialogs';
|
|
20
21
|
import { GetTokenOptions } from '@azure/identity';
|
|
21
22
|
import { HeroCard } from 'botbuilder';
|
|
23
|
+
import { InvokeResponse } from 'botbuilder';
|
|
24
|
+
import { MessagingExtensionResponse } from 'botbuilder';
|
|
22
25
|
import { O365ConnectorCard } from 'botbuilder';
|
|
23
26
|
import { ReceiptCard } from 'botbuilder';
|
|
24
27
|
import { SecureContextOptions } from 'tls';
|
|
28
|
+
import { SigninStateVerificationQuery } from 'botbuilder';
|
|
29
|
+
import { StatePropertyAccessor } from 'botbuilder';
|
|
30
|
+
import { StatusCodes } from 'botbuilder';
|
|
31
|
+
import { Storage as Storage_2 } from 'botbuilder';
|
|
32
|
+
import { TeamDetails } from 'botbuilder';
|
|
25
33
|
import { TeamsChannelAccount } from 'botbuilder';
|
|
26
34
|
import { ThumbnailCard } from 'botbuilder';
|
|
27
35
|
import { TokenCredential } from '@azure/identity';
|
|
28
36
|
import { TokenResponse } from 'botframework-schema';
|
|
29
|
-
import { TurnContext } from 'botbuilder
|
|
30
|
-
import {
|
|
37
|
+
import { TurnContext } from 'botbuilder';
|
|
38
|
+
import { UserState } from 'botbuilder';
|
|
31
39
|
import { WebRequest } from 'botbuilder';
|
|
32
40
|
import { WebResponse } from 'botbuilder';
|
|
33
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Options used to control how the response card will be sent to users.
|
|
44
|
+
*/
|
|
45
|
+
export declare enum AdaptiveCardResponse {
|
|
46
|
+
/**
|
|
47
|
+
* The response card will be replaced the current one for the interactor who trigger the action.
|
|
48
|
+
*/
|
|
49
|
+
ReplaceForInteractor = 0,
|
|
50
|
+
/**
|
|
51
|
+
* The response card will be replaced the current one for all users in the chat.
|
|
52
|
+
*/
|
|
53
|
+
ReplaceForAll = 1,
|
|
54
|
+
/**
|
|
55
|
+
* The response card will be sent as a new message for all users in the chat.
|
|
56
|
+
*/
|
|
57
|
+
NewForAll = 2
|
|
58
|
+
}
|
|
59
|
+
|
|
34
60
|
/**
|
|
35
61
|
* Define available location for API Key location
|
|
36
62
|
*/
|
|
@@ -249,6 +275,211 @@ export declare class BearerTokenAuthProvider implements AuthProvider {
|
|
|
249
275
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
250
276
|
}
|
|
251
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Interface for SSO configuration for Bot SSO
|
|
280
|
+
*/
|
|
281
|
+
export declare interface BotSsoConfig {
|
|
282
|
+
/**
|
|
283
|
+
* aad related configurations
|
|
284
|
+
*/
|
|
285
|
+
aad: {
|
|
286
|
+
/**
|
|
287
|
+
* The list of scopes for which the token will have access
|
|
288
|
+
*/
|
|
289
|
+
scopes: string[];
|
|
290
|
+
} & AuthenticationConfiguration;
|
|
291
|
+
dialog?: {
|
|
292
|
+
/**
|
|
293
|
+
* Custom sso execution activity handler class which should implement the interface {@link BotSsoExecutionActivityHandler}. If not provided, it will use {@link DefaultBotSsoExecutionActivityHandler} by default
|
|
294
|
+
*/
|
|
295
|
+
CustomBotSsoExecutionActivityHandler?: new (ssoConfig: BotSsoConfig) => BotSsoExecutionActivityHandler;
|
|
296
|
+
/**
|
|
297
|
+
* Conversation state for sso command bot, if not provided, it will use internal memory storage to create a new one.
|
|
298
|
+
*/
|
|
299
|
+
conversationState?: ConversationState;
|
|
300
|
+
/**
|
|
301
|
+
* User state for sso command bot, if not provided, it will use internal memory storage to create a new one.
|
|
302
|
+
*/
|
|
303
|
+
userState?: UserState;
|
|
304
|
+
/**
|
|
305
|
+
* Used by {@link BotSsoExecutionDialog} to remove duplicated messages, if not provided, it will use internal memory storage
|
|
306
|
+
*/
|
|
307
|
+
dedupStorage?: Storage_2;
|
|
308
|
+
/**
|
|
309
|
+
* Settings used to configure an teams sso prompt dialog.
|
|
310
|
+
*/
|
|
311
|
+
ssoPromptConfig?: {
|
|
312
|
+
/**
|
|
313
|
+
* Number of milliseconds the prompt will wait for the user to authenticate.
|
|
314
|
+
* Defaults to a value `900,000` (15 minutes.)
|
|
315
|
+
*/
|
|
316
|
+
timeout?: number;
|
|
317
|
+
/**
|
|
318
|
+
* Value indicating whether the TeamsBotSsoPrompt should end upon receiving an
|
|
319
|
+
* invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user
|
|
320
|
+
* message not related to the auth flow. Setting the flag to false ignores the user's message instead.
|
|
321
|
+
* Defaults to value `true`
|
|
322
|
+
*/
|
|
323
|
+
endOnInvalidMessage?: boolean;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Interface for user to customize SSO execution activity handler
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* Bot SSO execution activity handler is to handle SSO login process and trigger SSO command using {@link BotSsoExecutionDialog}.
|
|
333
|
+
* You can use this interface to implement your own SSO execution dialog, and pass it to ConversationBot options:
|
|
334
|
+
*
|
|
335
|
+
* ```typescript
|
|
336
|
+
* export const commandBot = new ConversationBot({
|
|
337
|
+
* ...
|
|
338
|
+
* ssoConfig: {
|
|
339
|
+
* ...
|
|
340
|
+
* dialog: {
|
|
341
|
+
* CustomBotSsoExecutionActivityHandler: YourCustomBotSsoExecutionActivityHandler,
|
|
342
|
+
* }
|
|
343
|
+
* },
|
|
344
|
+
* ...
|
|
345
|
+
* });
|
|
346
|
+
* ```
|
|
347
|
+
* For details information about how to implement a BotSsoExecutionActivityHandler, please refer DefaultBotSsoExecutionActivityHandler class source code: https://aka.ms/teamsfx-default-sso-execution-activity-handler
|
|
348
|
+
*/
|
|
349
|
+
export declare interface BotSsoExecutionActivityHandler {
|
|
350
|
+
/**
|
|
351
|
+
* Add {@link TeamsFxBotSsoCommandHandler} instance to {@link BotSsoExecutionDialog}
|
|
352
|
+
* @param handler {@link BotSsoExecutionDialogHandler} callback function
|
|
353
|
+
* @param triggerPatterns The trigger pattern
|
|
354
|
+
*
|
|
355
|
+
* @remarks
|
|
356
|
+
* This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.
|
|
357
|
+
*/
|
|
358
|
+
addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
|
|
359
|
+
/**
|
|
360
|
+
* Called to initiate the event emission process.
|
|
361
|
+
* @param context The context object for the current turn.
|
|
362
|
+
*/
|
|
363
|
+
run(context: TurnContext): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* Receives invoke activities with Activity name of 'signin/verifyState'.
|
|
366
|
+
* @param context A context object for this turn.
|
|
367
|
+
* @param query Signin state (part of signin action auth flow) verification invoke query.
|
|
368
|
+
* @returns A promise that represents the work queued.
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
|
372
|
+
*/
|
|
373
|
+
handleTeamsSigninVerifyState(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
|
|
374
|
+
/**
|
|
375
|
+
* Receives invoke activities with Activity name of 'signin/tokenExchange'
|
|
376
|
+
* @param context A context object for this turn.
|
|
377
|
+
* @param query Signin state (part of signin action auth flow) verification invoke query
|
|
378
|
+
* @returns A promise that represents the work queued.
|
|
379
|
+
*
|
|
380
|
+
* @remark
|
|
381
|
+
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
|
382
|
+
*/
|
|
383
|
+
handleTeamsSigninTokenExchange(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Sso execution dialog, use to handle sso command
|
|
388
|
+
*/
|
|
389
|
+
export declare class BotSsoExecutionDialog extends ComponentDialog {
|
|
390
|
+
private dedupStorage;
|
|
391
|
+
private dedupStorageKeys;
|
|
392
|
+
private commandMapping;
|
|
393
|
+
/**
|
|
394
|
+
* Creates a new instance of the BotSsoExecutionDialog.
|
|
395
|
+
* @param dedupStorage Helper storage to remove duplicated messages
|
|
396
|
+
* @param settings The list of scopes for which the token will have access
|
|
397
|
+
* @param teamsfx {@link TeamsFx} instance for authentication
|
|
398
|
+
*/
|
|
399
|
+
constructor(dedupStorage: Storage_2, ssoPromptSettings: TeamsBotSsoPromptSettings, teamsfx: TeamsFx, dialogName?: string);
|
|
400
|
+
/**
|
|
401
|
+
* Add TeamsFxBotSsoCommandHandler instance
|
|
402
|
+
* @param handler {@link BotSsoExecutionDialogHandler} callback function
|
|
403
|
+
* @param triggerPatterns The trigger pattern
|
|
404
|
+
*/
|
|
405
|
+
addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
|
|
406
|
+
private getCommandHash;
|
|
407
|
+
/**
|
|
408
|
+
* The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
|
|
409
|
+
*
|
|
410
|
+
* @param context The context object for the current turn.
|
|
411
|
+
* @param accessor The instance of StatePropertyAccessor for dialog system.
|
|
412
|
+
*/
|
|
413
|
+
run(context: TurnContext, accessor: StatePropertyAccessor): Promise<void>;
|
|
414
|
+
private getActivityText;
|
|
415
|
+
private commandRouteStep;
|
|
416
|
+
private ssoStep;
|
|
417
|
+
private dedupStep;
|
|
418
|
+
/**
|
|
419
|
+
* Called when the component is ending.
|
|
420
|
+
*
|
|
421
|
+
* @param context Context for the current turn of conversation.
|
|
422
|
+
*/
|
|
423
|
+
protected onEndDialog(context: TurnContext): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* If a user is signed into multiple Teams clients, the Bot might receive a "signin/tokenExchange" from each client.
|
|
426
|
+
* Each token exchange request for a specific user login will have an identical activity.value.Id.
|
|
427
|
+
* Only one of these token exchange requests should be processed by the bot. For a distributed bot in production,
|
|
428
|
+
* this requires a distributed storage to ensure only one token exchange is processed.
|
|
429
|
+
* @param context Context for the current turn of conversation.
|
|
430
|
+
* @returns boolean value indicate whether the message should be removed
|
|
431
|
+
*/
|
|
432
|
+
private shouldDedup;
|
|
433
|
+
private getStorageKey;
|
|
434
|
+
private matchPattern;
|
|
435
|
+
private isPatternMatched;
|
|
436
|
+
private getMatchesCommandId;
|
|
437
|
+
/**
|
|
438
|
+
* Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.
|
|
439
|
+
* @param dc dialog context
|
|
440
|
+
* @throws {@link ErrorCode|ChannelNotSupported} if bot channel is not MS Teams
|
|
441
|
+
* @internal
|
|
442
|
+
*/
|
|
443
|
+
private ensureMsTeamsChannel;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare type BotSsoExecutionDialogHandler = (context: TurnContext, tokenResponse: TeamsBotSsoPromptTokenResponse, message: CommandMessage) => Promise<void>;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* A card action bot to respond to adaptive card universal actions.
|
|
450
|
+
*/
|
|
451
|
+
export declare class CardActionBot {
|
|
452
|
+
private readonly adapter;
|
|
453
|
+
private middleware;
|
|
454
|
+
/**
|
|
455
|
+
* Creates a new instance of the `CardActionBot`.
|
|
456
|
+
*
|
|
457
|
+
* @param adapter The bound `BotFrameworkAdapter`.
|
|
458
|
+
* @param options - initialize options
|
|
459
|
+
*/
|
|
460
|
+
constructor(adapter: BotFrameworkAdapter, options?: CardActionOptions);
|
|
461
|
+
/**
|
|
462
|
+
* Registers a card action handler to the bot.
|
|
463
|
+
* @param actionHandler A card action handler to be registered.
|
|
464
|
+
*/
|
|
465
|
+
registerHandler(actionHandler: TeamsFxAdaptiveCardActionHandler): void;
|
|
466
|
+
/**
|
|
467
|
+
* Registers card action handlers to the bot.
|
|
468
|
+
* @param actionHandlers A set of card action handlers to be registered.
|
|
469
|
+
*/
|
|
470
|
+
registerHandlers(actionHandlers: TeamsFxAdaptiveCardActionHandler[]): void;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Options to initialize {@link CardActionBot}.
|
|
475
|
+
*/
|
|
476
|
+
export declare interface CardActionOptions {
|
|
477
|
+
/**
|
|
478
|
+
* The action handlers to registered with the action bot. Each command should implement the interface {@link TeamsFxAdaptiveCardActionHandler} so that it can be correctly handled by this bot.
|
|
479
|
+
*/
|
|
480
|
+
actions?: TeamsFxAdaptiveCardActionHandler[];
|
|
481
|
+
}
|
|
482
|
+
|
|
252
483
|
/**
|
|
253
484
|
* Provider that handles Certificate authentication
|
|
254
485
|
*/
|
|
@@ -332,25 +563,39 @@ export declare class Channel implements NotificationTarget {
|
|
|
332
563
|
export declare class CommandBot {
|
|
333
564
|
private readonly adapter;
|
|
334
565
|
private readonly middleware;
|
|
566
|
+
private readonly ssoConfig;
|
|
335
567
|
/**
|
|
336
568
|
* Creates a new instance of the `CommandBot`.
|
|
337
569
|
*
|
|
338
570
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
339
571
|
* @param options - initialize options
|
|
340
572
|
*/
|
|
341
|
-
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions);
|
|
573
|
+
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions, ssoCommandActivityHandler?: BotSsoExecutionActivityHandler, ssoConfig?: BotSsoConfig);
|
|
342
574
|
/**
|
|
343
575
|
* Registers a command into the command bot.
|
|
344
576
|
*
|
|
345
|
-
* @param command The command to
|
|
577
|
+
* @param command The command to register.
|
|
346
578
|
*/
|
|
347
579
|
registerCommand(command: TeamsFxBotCommandHandler): void;
|
|
348
580
|
/**
|
|
349
581
|
* Registers commands into the command bot.
|
|
350
582
|
*
|
|
351
|
-
* @param commands The
|
|
583
|
+
* @param commands The commands to register.
|
|
352
584
|
*/
|
|
353
585
|
registerCommands(commands: TeamsFxBotCommandHandler[]): void;
|
|
586
|
+
/**
|
|
587
|
+
* Registers a sso command into the command bot.
|
|
588
|
+
*
|
|
589
|
+
* @param command The command to register.
|
|
590
|
+
*/
|
|
591
|
+
registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void;
|
|
592
|
+
/**
|
|
593
|
+
* Registers commands into the command bot.
|
|
594
|
+
*
|
|
595
|
+
* @param commands The commands to register.
|
|
596
|
+
*/
|
|
597
|
+
registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void;
|
|
598
|
+
private validateSsoActivityHandler;
|
|
354
599
|
}
|
|
355
600
|
|
|
356
601
|
/**
|
|
@@ -375,6 +620,10 @@ export declare interface CommandOptions {
|
|
|
375
620
|
* The commands to registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.
|
|
376
621
|
*/
|
|
377
622
|
commands?: TeamsFxBotCommandHandler[];
|
|
623
|
+
/**
|
|
624
|
+
* The commands to registered with the sso command bot. Each sso command should implement the interface {@link TeamsFxBotSsoCommandHandler} so that it can be correctly handled by this command bot.
|
|
625
|
+
*/
|
|
626
|
+
ssoCommands?: TeamsFxBotSsoCommandHandler[];
|
|
378
627
|
}
|
|
379
628
|
|
|
380
629
|
/**
|
|
@@ -441,6 +690,10 @@ export declare class ConversationBot {
|
|
|
441
690
|
* The entrypoint of notification.
|
|
442
691
|
*/
|
|
443
692
|
readonly notification?: NotificationBot;
|
|
693
|
+
/**
|
|
694
|
+
* The action handler used for adaptive card universal actions.
|
|
695
|
+
*/
|
|
696
|
+
readonly cardAction?: CardActionBot;
|
|
444
697
|
/**
|
|
445
698
|
* Creates new instance of the `ConversationBot`.
|
|
446
699
|
*
|
|
@@ -472,7 +725,7 @@ export declare class ConversationBot {
|
|
|
472
725
|
* });
|
|
473
726
|
* ```
|
|
474
727
|
*/
|
|
475
|
-
requestHandler(req: WebRequest, res: WebResponse, logic?: (context:
|
|
728
|
+
requestHandler(req: WebRequest, res: WebResponse, logic?: (context: TurnContext) => Promise<any>): Promise<void>;
|
|
476
729
|
}
|
|
477
730
|
|
|
478
731
|
/**
|
|
@@ -497,6 +750,10 @@ export declare interface ConversationOptions {
|
|
|
497
750
|
adapterConfig?: {
|
|
498
751
|
[key: string]: unknown;
|
|
499
752
|
};
|
|
753
|
+
/**
|
|
754
|
+
* Configurations for sso command bot
|
|
755
|
+
*/
|
|
756
|
+
ssoConfig?: BotSsoConfig;
|
|
500
757
|
/**
|
|
501
758
|
* The command part.
|
|
502
759
|
*/
|
|
@@ -515,6 +772,15 @@ export declare interface ConversationOptions {
|
|
|
515
772
|
*/
|
|
516
773
|
enabled?: boolean;
|
|
517
774
|
};
|
|
775
|
+
/**
|
|
776
|
+
* The adaptive card action handler part.
|
|
777
|
+
*/
|
|
778
|
+
cardAction?: CardActionOptions & {
|
|
779
|
+
/**
|
|
780
|
+
* Whether to enable adaptive card actions or not.
|
|
781
|
+
*/
|
|
782
|
+
enabled?: boolean;
|
|
783
|
+
};
|
|
518
784
|
}
|
|
519
785
|
|
|
520
786
|
/**
|
|
@@ -638,6 +904,30 @@ export declare enum ErrorCode {
|
|
|
638
904
|
* Channel is not supported error.
|
|
639
905
|
*/
|
|
640
906
|
ChannelNotSupported = "ChannelNotSupported",
|
|
907
|
+
/**
|
|
908
|
+
* Failed to retrieve sso token
|
|
909
|
+
*/
|
|
910
|
+
FailedToRetrieveSsoToken = "FailedToRetrieveSsoToken",
|
|
911
|
+
/**
|
|
912
|
+
* Failed to process sso handler
|
|
913
|
+
*/
|
|
914
|
+
FailedToProcessSsoHandler = "FailedToProcessSsoHandler",
|
|
915
|
+
/**
|
|
916
|
+
* Cannot find command
|
|
917
|
+
*/
|
|
918
|
+
CannotFindCommand = "CannotFindCommand",
|
|
919
|
+
/**
|
|
920
|
+
* Failed to run sso step
|
|
921
|
+
*/
|
|
922
|
+
FailedToRunSsoStep = "FailedToRunSsoStep",
|
|
923
|
+
/**
|
|
924
|
+
* Failed to run dedup step
|
|
925
|
+
*/
|
|
926
|
+
FailedToRunDedupStep = "FailedToRunDedupStep",
|
|
927
|
+
/**
|
|
928
|
+
* Sso activity handler is undefined
|
|
929
|
+
*/
|
|
930
|
+
SsoActivityHandlerIsUndefined = "SsoActivityHandlerIsUndefined",
|
|
641
931
|
/**
|
|
642
932
|
* Runtime is not supported error.
|
|
643
933
|
*/
|
|
@@ -702,6 +992,10 @@ export declare class ErrorWithCode extends Error {
|
|
|
702
992
|
*/
|
|
703
993
|
export declare function getLogLevel(): LogLevel | undefined;
|
|
704
994
|
|
|
995
|
+
export declare interface GetTeamsUserTokenOptions extends GetTokenOptions {
|
|
996
|
+
resources?: string[];
|
|
997
|
+
}
|
|
998
|
+
|
|
705
999
|
/**
|
|
706
1000
|
* Generate connection configuration consumed by tedious.
|
|
707
1001
|
*
|
|
@@ -716,6 +1010,25 @@ export declare function getLogLevel(): LogLevel | undefined;
|
|
|
716
1010
|
*/
|
|
717
1011
|
export declare function getTediousConnectionConfig(teamsfx: TeamsFx, databaseName?: string): Promise<ConnectionConfig>;
|
|
718
1012
|
|
|
1013
|
+
/**
|
|
1014
|
+
* Users execute query in message extension with SSO or access token.
|
|
1015
|
+
*
|
|
1016
|
+
* @param {TurnContext} context - The context object for the current turn.
|
|
1017
|
+
* @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.
|
|
1018
|
+
* @param {string| string[]} scopes - The list of scopes for which the token will have access.
|
|
1019
|
+
* @param {function} logic - Business logic when executing the query in message extension with SSO or access token.
|
|
1020
|
+
*
|
|
1021
|
+
* @throws {@link ErrorCode|InternalError} when User invoke not response to message extension query.
|
|
1022
|
+
* @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.
|
|
1023
|
+
* @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.
|
|
1024
|
+
* @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.
|
|
1025
|
+
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1026
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1027
|
+
*
|
|
1028
|
+
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
|
1029
|
+
*/
|
|
1030
|
+
export declare function handleMessageExtensionQueryWithToken(context: TurnContext, config: AuthenticationConfiguration | null, scopes: string | string[], logic: (token: MessageExtensionTokenResponse) => Promise<any>): Promise<MessagingExtensionResponse | void>;
|
|
1031
|
+
|
|
719
1032
|
/**
|
|
720
1033
|
* Identity type to use in authentication.
|
|
721
1034
|
*/
|
|
@@ -730,6 +1043,96 @@ export declare enum IdentityType {
|
|
|
730
1043
|
App = "Application"
|
|
731
1044
|
}
|
|
732
1045
|
|
|
1046
|
+
/**
|
|
1047
|
+
* Status code for an `application/vnd.microsoft.error` invoke response.
|
|
1048
|
+
*/
|
|
1049
|
+
export declare enum InvokeResponseErrorCode {
|
|
1050
|
+
/**
|
|
1051
|
+
* Invalid request.
|
|
1052
|
+
*/
|
|
1053
|
+
BadRequest = 400,
|
|
1054
|
+
/**
|
|
1055
|
+
* Internal server error.
|
|
1056
|
+
*/
|
|
1057
|
+
InternalServerError = 500
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* Provides methods for formatting various invoke responses a bot can send to respond to an invoke request.
|
|
1062
|
+
*
|
|
1063
|
+
* @remarks
|
|
1064
|
+
* All of these functions return an {@link InvokeResponse} object, which can be
|
|
1065
|
+
* passed as input to generate a new `invokeResponse` activity.
|
|
1066
|
+
*
|
|
1067
|
+
* This example sends an invoke response that contains an adaptive card.
|
|
1068
|
+
*
|
|
1069
|
+
* ```typescript
|
|
1070
|
+
*
|
|
1071
|
+
* const myCard = {
|
|
1072
|
+
* type: "AdaptiveCard",
|
|
1073
|
+
* body: [
|
|
1074
|
+
* {
|
|
1075
|
+
* "type": "TextBlock",
|
|
1076
|
+
* "text": "This is a sample card"
|
|
1077
|
+
* }],
|
|
1078
|
+
* $schema: "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
1079
|
+
* version: "1.4"
|
|
1080
|
+
* };
|
|
1081
|
+
*
|
|
1082
|
+
* const invokeResponse = InvokeResponseFactory.adaptiveCard(myCard);
|
|
1083
|
+
* await context.sendActivity({
|
|
1084
|
+
* type: ActivityTypes.InvokeResponse,
|
|
1085
|
+
* value: invokeResponse,
|
|
1086
|
+
* });
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
export declare class InvokeResponseFactory {
|
|
1090
|
+
/**
|
|
1091
|
+
* Create an invoke response from a text message.
|
|
1092
|
+
* The type of the invoke response is `application/vnd.microsoft.activity.message`
|
|
1093
|
+
* indicates the request was successfully processed.
|
|
1094
|
+
*
|
|
1095
|
+
* @param message A text message included in a invoke response.
|
|
1096
|
+
*
|
|
1097
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1098
|
+
*/
|
|
1099
|
+
static textMessage(message: string): InvokeResponse;
|
|
1100
|
+
/**
|
|
1101
|
+
* Create an invoke response from an adaptive card.
|
|
1102
|
+
*
|
|
1103
|
+
* The type of the invoke response is `application/vnd.microsoft.card.adaptive` indicates
|
|
1104
|
+
* the request was successfully processed, and the response includes an adaptive card
|
|
1105
|
+
* that the client should display in place of the current one.
|
|
1106
|
+
*
|
|
1107
|
+
* @param card The adaptive card JSON payload.
|
|
1108
|
+
*
|
|
1109
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1110
|
+
*/
|
|
1111
|
+
static adaptiveCard(card: unknown): InvokeResponse;
|
|
1112
|
+
/**
|
|
1113
|
+
* Create an invoke response with error code and message.
|
|
1114
|
+
*
|
|
1115
|
+
* The type of the invoke response is `application/vnd.microsoft.error` indicates
|
|
1116
|
+
* the request was failed to processed.
|
|
1117
|
+
*
|
|
1118
|
+
* @param errorCode The status code indicates error, available values:
|
|
1119
|
+
* - 400 (BadRequest): indicate the incoming request was invalid.
|
|
1120
|
+
* - 500 (InternalServerError): indicate an unexpected error occurred.
|
|
1121
|
+
* @param errorMessage The error message.
|
|
1122
|
+
*
|
|
1123
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1124
|
+
*/
|
|
1125
|
+
static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string): InvokeResponse;
|
|
1126
|
+
/**
|
|
1127
|
+
* Create an invoke response with status code and response value.
|
|
1128
|
+
* @param statusCode The status code.
|
|
1129
|
+
* @param body The value of the response body.
|
|
1130
|
+
*
|
|
1131
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1132
|
+
*/
|
|
1133
|
+
static createInvokeResponse(statusCode: StatusCodes, body?: unknown): InvokeResponse;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
733
1136
|
/**
|
|
734
1137
|
* Log function for customized logging.
|
|
735
1138
|
*/
|
|
@@ -868,14 +1271,14 @@ export declare class MessageBuilder {
|
|
|
868
1271
|
* });
|
|
869
1272
|
* ```
|
|
870
1273
|
*/
|
|
871
|
-
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<
|
|
1274
|
+
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<Activity>;
|
|
872
1275
|
/**
|
|
873
1276
|
* Build a bot message activity attached with an adaptive card.
|
|
874
1277
|
*
|
|
875
1278
|
* @param card The adaptive card content.
|
|
876
1279
|
* @returns A bot message activity attached with an adaptive card.
|
|
877
1280
|
*/
|
|
878
|
-
static attachAdaptiveCardWithoutData(card: unknown): Partial<
|
|
1281
|
+
static attachAdaptiveCardWithoutData(card: unknown): Partial<Activity>;
|
|
879
1282
|
/**
|
|
880
1283
|
* Build a bot message activity attached with an hero card.
|
|
881
1284
|
*
|
|
@@ -896,7 +1299,7 @@ export declare class MessageBuilder {
|
|
|
896
1299
|
* );
|
|
897
1300
|
* ```
|
|
898
1301
|
*/
|
|
899
|
-
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<
|
|
1302
|
+
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<Activity>;
|
|
900
1303
|
/**
|
|
901
1304
|
* Returns an attachment for a sign-in card.
|
|
902
1305
|
*
|
|
@@ -909,20 +1312,20 @@ export declare class MessageBuilder {
|
|
|
909
1312
|
* @remarks
|
|
910
1313
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
911
1314
|
*/
|
|
912
|
-
static attachSigninCard(title: string, url: string, text?: string): Partial<
|
|
1315
|
+
static attachSigninCard(title: string, url: string, text?: string): Partial<Activity>;
|
|
913
1316
|
/**
|
|
914
1317
|
* Build a bot message activity attached with an Office 365 connector card.
|
|
915
1318
|
*
|
|
916
1319
|
* @param card A description of the Office 365 connector card.
|
|
917
1320
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
918
1321
|
*/
|
|
919
|
-
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<
|
|
1322
|
+
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<Activity>;
|
|
920
1323
|
/**
|
|
921
1324
|
* Build a message activity attached with a receipt card.
|
|
922
1325
|
* @param card A description of the receipt card.
|
|
923
1326
|
* @returns A message activity attached with a receipt card.
|
|
924
1327
|
*/
|
|
925
|
-
static AttachReceiptCard(card: ReceiptCard): Partial<
|
|
1328
|
+
static AttachReceiptCard(card: ReceiptCard): Partial<Activity>;
|
|
926
1329
|
/**
|
|
927
1330
|
*
|
|
928
1331
|
* @param title The card title.
|
|
@@ -932,13 +1335,27 @@ export declare class MessageBuilder {
|
|
|
932
1335
|
* @param other Optional. Any additional properties to include on the card.
|
|
933
1336
|
* @returns A message activity attached with a thumbnail card
|
|
934
1337
|
*/
|
|
935
|
-
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<
|
|
1338
|
+
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<Activity>;
|
|
936
1339
|
/**
|
|
937
1340
|
* Add an attachement to a bot activity.
|
|
938
1341
|
* @param attachement The attachment object to attach.
|
|
939
1342
|
* @returns A message activity with an attachment.
|
|
940
1343
|
*/
|
|
941
|
-
static attachContent(attachement: Attachment): Partial<
|
|
1344
|
+
static attachContent(attachement: Attachment): Partial<Activity>;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Token response provided by Teams Bot SSO prompt
|
|
1349
|
+
*/
|
|
1350
|
+
export declare interface MessageExtensionTokenResponse extends TokenResponse {
|
|
1351
|
+
/**
|
|
1352
|
+
* SSO token for user
|
|
1353
|
+
*/
|
|
1354
|
+
ssoToken: string;
|
|
1355
|
+
/**
|
|
1356
|
+
* Expire time of SSO token
|
|
1357
|
+
*/
|
|
1358
|
+
ssoTokenExpiration: string;
|
|
942
1359
|
}
|
|
943
1360
|
|
|
944
1361
|
/**
|
|
@@ -1008,6 +1425,43 @@ export declare class NotificationBot {
|
|
|
1008
1425
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
1009
1426
|
*/
|
|
1010
1427
|
installations(): Promise<TeamsBotInstallation[]>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1430
|
+
*
|
|
1431
|
+
* @param predicate find calls predicate once for each member of the installation,
|
|
1432
|
+
* until it finds one where predicate returns true. If such a member is found, find
|
|
1433
|
+
* immediately returns that member. Otherwise, find returns undefined.
|
|
1434
|
+
* @param scope the scope to find members from the installations
|
|
1435
|
+
* (personal chat, group chat, Teams channel).
|
|
1436
|
+
* @returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1437
|
+
*/
|
|
1438
|
+
findMember(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<Member | undefined>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1441
|
+
*
|
|
1442
|
+
* @param predicate find calls predicate once for each channel of the installation,
|
|
1443
|
+
* until it finds one where predicate returns true. If such a channel is found, find
|
|
1444
|
+
* immediately returns that channel. Otherwise, find returns undefined.
|
|
1445
|
+
* @returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1446
|
+
*/
|
|
1447
|
+
findChannel(predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>): Promise<Channel | undefined>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Returns all {@link Member} where predicate is true, and empty array otherwise.
|
|
1450
|
+
*
|
|
1451
|
+
* @param predicate find calls predicate for each member of the installation.
|
|
1452
|
+
* @param scope the scope to find members from the installations
|
|
1453
|
+
* (personal chat, group chat, Teams channel).
|
|
1454
|
+
* @returns an array of {@link Member} where predicate is true, and empty array otherwise.
|
|
1455
|
+
*/
|
|
1456
|
+
findAllMembers(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<Member[]>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Returns all {@link Channel} where predicate is true, and empty array otherwise.
|
|
1459
|
+
*
|
|
1460
|
+
* @param predicate find calls predicate for each channel of the installation.
|
|
1461
|
+
* @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
|
|
1462
|
+
*/
|
|
1463
|
+
findAllChannels(predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>): Promise<Channel[]>;
|
|
1464
|
+
private matchSearchScope;
|
|
1011
1465
|
}
|
|
1012
1466
|
|
|
1013
1467
|
/**
|
|
@@ -1197,6 +1651,30 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
|
|
|
1197
1651
|
private generateAuthServerError;
|
|
1198
1652
|
}
|
|
1199
1653
|
|
|
1654
|
+
/**
|
|
1655
|
+
* The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
|
|
1656
|
+
* The search scope is a flagged enum and it can be combined with `|`.
|
|
1657
|
+
* For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
|
|
1658
|
+
*/
|
|
1659
|
+
export declare enum SearchScope {
|
|
1660
|
+
/**
|
|
1661
|
+
* Search members from the installations in personal chat only.
|
|
1662
|
+
*/
|
|
1663
|
+
Person = 1,
|
|
1664
|
+
/**
|
|
1665
|
+
* Search members from the installations in group chat only.
|
|
1666
|
+
*/
|
|
1667
|
+
Group = 2,
|
|
1668
|
+
/**
|
|
1669
|
+
* Search members from the installations in Teams channel only.
|
|
1670
|
+
*/
|
|
1671
|
+
Channel = 4,
|
|
1672
|
+
/**
|
|
1673
|
+
* Search members from all installations including personal chat, group chat and Teams channel.
|
|
1674
|
+
*/
|
|
1675
|
+
All = 7
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1200
1678
|
/**
|
|
1201
1679
|
* Send an adaptive card message to a notification target.
|
|
1202
1680
|
*
|
|
@@ -1318,6 +1796,12 @@ export declare class TeamsBotInstallation implements NotificationTarget {
|
|
|
1318
1796
|
* @returns an array of members from where the bot is installed.
|
|
1319
1797
|
*/
|
|
1320
1798
|
members(): Promise<Member[]>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Get team details from this bot installation
|
|
1801
|
+
*
|
|
1802
|
+
* @returns the team details if bot is installed into a team, otherwise returns undefined.
|
|
1803
|
+
*/
|
|
1804
|
+
getTeamDetails(): Promise<TeamDetails | undefined>;
|
|
1321
1805
|
}
|
|
1322
1806
|
|
|
1323
1807
|
/**
|
|
@@ -1511,7 +1995,7 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1511
1995
|
*
|
|
1512
1996
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1513
1997
|
*/
|
|
1514
|
-
constructor(identityType?: IdentityType, customConfig?: Record<string, string>);
|
|
1998
|
+
constructor(identityType?: IdentityType, customConfig?: Record<string, string> | AuthenticationConfiguration);
|
|
1515
1999
|
/**
|
|
1516
2000
|
* Identity type set by user.
|
|
1517
2001
|
*
|
|
@@ -1530,9 +2014,10 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1530
2014
|
getCredential(): TokenCredential;
|
|
1531
2015
|
/**
|
|
1532
2016
|
* Get user information.
|
|
2017
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1533
2018
|
* @returns UserInfo object.
|
|
1534
2019
|
*/
|
|
1535
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2020
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1536
2021
|
/**
|
|
1537
2022
|
* Popup login page to get user's access token with specific scopes.
|
|
1538
2023
|
*
|
|
@@ -1547,13 +2032,14 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1547
2032
|
* await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
|
|
1548
2033
|
* ```
|
|
1549
2034
|
* @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
|
|
2035
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1550
2036
|
*
|
|
1551
2037
|
* @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
|
|
1552
2038
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1553
2039
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1554
2040
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1555
2041
|
*/
|
|
1556
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2042
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1557
2043
|
/**
|
|
1558
2044
|
* Set SSO token when using user identity in NodeJS.
|
|
1559
2045
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
@@ -1583,6 +2069,47 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1583
2069
|
private loadFromEnv;
|
|
1584
2070
|
}
|
|
1585
2071
|
|
|
2072
|
+
/**
|
|
2073
|
+
* Interface for adaptive card action handler that can process card action invoke and return a response.
|
|
2074
|
+
*/
|
|
2075
|
+
export declare interface TeamsFxAdaptiveCardActionHandler {
|
|
2076
|
+
/**
|
|
2077
|
+
* The verb defined in adaptive card action that can trigger this handler.
|
|
2078
|
+
* The verb string here is case-insensitive.
|
|
2079
|
+
*/
|
|
2080
|
+
triggerVerb: string;
|
|
2081
|
+
/**
|
|
2082
|
+
* Specify the behavior for how the card response will be sent in Teams conversation.
|
|
2083
|
+
* The default value is `AdaptiveCardResponse.ReplaceForInteractor`, which means the card
|
|
2084
|
+
* response will replace the current one only for the interactor.
|
|
2085
|
+
*/
|
|
2086
|
+
adaptiveCardResponse?: AdaptiveCardResponse;
|
|
2087
|
+
/**
|
|
2088
|
+
* The handler function that will be invoked when the action is fired.
|
|
2089
|
+
* @param context The turn context.
|
|
2090
|
+
* @param actionData The contextual data that associated with the action.
|
|
2091
|
+
*
|
|
2092
|
+
* @returns A `Promise` representing a invoke response for the adaptive card invoke action.
|
|
2093
|
+
* You can use the `InvokeResponseFactory` utility class to create an invoke response from
|
|
2094
|
+
* - A text message:
|
|
2095
|
+
* ```typescript
|
|
2096
|
+
* return InvokeResponseFactory.textMessage("Action is processed successfully!");
|
|
2097
|
+
* ```
|
|
2098
|
+
* - An adaptive card:
|
|
2099
|
+
* ```typescript
|
|
2100
|
+
* const responseCard = AdaptiveCards.declare(helloWorldCard).render(actionData);
|
|
2101
|
+
return InvokeResponseFactory.adaptiveCard(responseCard);
|
|
2102
|
+
* ```
|
|
2103
|
+
* - An error response:
|
|
2104
|
+
* ```typescript
|
|
2105
|
+
* return InvokeResponseFactory.errorResponse(InvokeResponseErrorCode.BadRequest, "Invalid request");
|
|
2106
|
+
* ```
|
|
2107
|
+
*
|
|
2108
|
+
* @remark For more details about the invoke response format, refer to https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/universal-action-model#response-format.
|
|
2109
|
+
*/
|
|
2110
|
+
handleActionInvoked(context: TurnContext, actionData: any): Promise<InvokeResponse>;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
1586
2113
|
/**
|
|
1587
2114
|
* Interface for a command handler that can process command to a TeamsFx bot and return a response.
|
|
1588
2115
|
*/
|
|
@@ -1602,6 +2129,26 @@ export declare interface TeamsFxBotCommandHandler {
|
|
|
1602
2129
|
handleCommandReceived(context: TurnContext, message: CommandMessage): Promise<string | Partial<Activity> | void>;
|
|
1603
2130
|
}
|
|
1604
2131
|
|
|
2132
|
+
/**
|
|
2133
|
+
* Interface for a command handler that can process sso command to a TeamsFx bot and return a response.
|
|
2134
|
+
*/
|
|
2135
|
+
export declare interface TeamsFxBotSsoCommandHandler {
|
|
2136
|
+
/**
|
|
2137
|
+
* The string or regular expression patterns that can trigger this handler.
|
|
2138
|
+
*/
|
|
2139
|
+
triggerPatterns: TriggerPatterns;
|
|
2140
|
+
/**
|
|
2141
|
+
* Handles a bot command received activity.
|
|
2142
|
+
*
|
|
2143
|
+
* @param context The bot context.
|
|
2144
|
+
* @param message The command message the user types from Teams.
|
|
2145
|
+
* @param tokenResponse The tokenResponse which contains sso token that can be used to exchange access token for the bot.
|
|
2146
|
+
* @returns A `Promise` representing an activity or text to send as the command response.
|
|
2147
|
+
* Or no return value if developers want to send the response activity by themselves in this method.
|
|
2148
|
+
*/
|
|
2149
|
+
handleCommandReceived(context: TurnContext, message: CommandMessage, tokenResponse: TeamsBotSsoPromptTokenResponse): Promise<string | Partial<Activity> | void>;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
1605
2152
|
/**
|
|
1606
2153
|
* TeamsFx interface that provides credential and configuration.
|
|
1607
2154
|
*/
|
|
@@ -1624,9 +2171,10 @@ declare interface TeamsFxConfiguration {
|
|
|
1624
2171
|
getCredential(): TokenCredential;
|
|
1625
2172
|
/**
|
|
1626
2173
|
* Get user information.
|
|
2174
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1627
2175
|
* @returns UserInfo object.
|
|
1628
2176
|
*/
|
|
1629
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2177
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1630
2178
|
/**
|
|
1631
2179
|
* Popup login page to get user's access token with specific scopes.
|
|
1632
2180
|
*
|
|
@@ -1641,13 +2189,14 @@ declare interface TeamsFxConfiguration {
|
|
|
1641
2189
|
* await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
|
|
1642
2190
|
* ```
|
|
1643
2191
|
* @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
|
|
2192
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1644
2193
|
*
|
|
1645
2194
|
* @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
|
|
1646
2195
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1647
2196
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1648
2197
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1649
2198
|
*/
|
|
1650
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2199
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1651
2200
|
/**
|
|
1652
2201
|
* Set SSO token when using user identity in NodeJS.
|
|
1653
2202
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
@@ -1688,10 +2237,13 @@ export declare class TeamsUserCredential implements TokenCredential {
|
|
|
1688
2237
|
constructor(authConfig: AuthenticationConfiguration);
|
|
1689
2238
|
/**
|
|
1690
2239
|
* Popup login page to get user's access token with specific scopes.
|
|
2240
|
+
*
|
|
2241
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
2242
|
+
*
|
|
1691
2243
|
* @remarks
|
|
1692
2244
|
* Can only be used within Teams.
|
|
1693
2245
|
*/
|
|
1694
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2246
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1695
2247
|
/**
|
|
1696
2248
|
* Get access token from credential.
|
|
1697
2249
|
* @remarks
|
|
@@ -1700,10 +2252,13 @@ export declare class TeamsUserCredential implements TokenCredential {
|
|
|
1700
2252
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
1701
2253
|
/**
|
|
1702
2254
|
* Get basic user info from SSO token
|
|
2255
|
+
*
|
|
2256
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
2257
|
+
*
|
|
1703
2258
|
* @remarks
|
|
1704
2259
|
* Can only be used within Teams.
|
|
1705
2260
|
*/
|
|
1706
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2261
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1707
2262
|
}
|
|
1708
2263
|
|
|
1709
2264
|
/**
|