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