@microsoft/teamsfx 1.1.2-alpha.7eddd6cf4.0 → 1.1.2-alpha.9bd0cb559.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 +149 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +477 -26
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +161 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +498 -23
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +315 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/teamsfx",
|
|
3
|
-
"version": "1.1.2-alpha.
|
|
3
|
+
"version": "1.1.2-alpha.9bd0cb559.0",
|
|
4
4
|
"description": "Microsoft Teams Framework for Node.js and browser.",
|
|
5
5
|
"main": "dist/index.node.cjs.js",
|
|
6
6
|
"browser": "dist/index.esm2017.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@azure/identity": "^2.0.1",
|
|
50
50
|
"@azure/msal-browser": "^2.21.0",
|
|
51
51
|
"@azure/msal-node": "~1.1.0",
|
|
52
|
-
"@microsoft/adaptivecards-tools": "1.0.2-alpha.
|
|
52
|
+
"@microsoft/adaptivecards-tools": "1.0.2-alpha.9bd0cb559.0",
|
|
53
53
|
"@microsoft/microsoft-graph-client": "^3.0.1",
|
|
54
54
|
"adaptivecards": "^2.10.0",
|
|
55
55
|
"axios": "^0.27.2",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"webpack": "^5.62.1",
|
|
130
130
|
"yargs": "^17.2.1"
|
|
131
131
|
},
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "3af4b6e0aa2b7bcfbf2dbbf1fccbe4a03ea8a71b",
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
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,26 +11,31 @@ 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';
|
|
22
23
|
import { IAdaptiveCard } from 'adaptivecards';
|
|
23
|
-
import { InvokeResponse } from 'botbuilder
|
|
24
|
-
import { InvokeResponse as InvokeResponse_2 } from 'botbuilder';
|
|
24
|
+
import { InvokeResponse } from 'botbuilder';
|
|
25
25
|
import { O365ConnectorCard } from 'botbuilder';
|
|
26
26
|
import { ReceiptCard } from 'botbuilder';
|
|
27
27
|
import { SecureContextOptions } from 'tls';
|
|
28
|
+
import { SigninStateVerificationQuery } from 'botbuilder';
|
|
29
|
+
import { StatePropertyAccessor } from 'botbuilder';
|
|
28
30
|
import { StatusCodes } from 'botbuilder';
|
|
31
|
+
import { Storage as Storage_2 } from 'botbuilder';
|
|
32
|
+
import { TeamsActivityHandler } from 'botbuilder';
|
|
29
33
|
import { TeamsChannelAccount } from 'botbuilder';
|
|
30
34
|
import { ThumbnailCard } from 'botbuilder';
|
|
31
35
|
import { TokenCredential } from '@azure/identity';
|
|
32
36
|
import { TokenResponse } from 'botframework-schema';
|
|
33
|
-
import { TurnContext } from 'botbuilder
|
|
34
|
-
import {
|
|
37
|
+
import { TurnContext } from 'botbuilder';
|
|
38
|
+
import { UserState } from 'botbuilder';
|
|
35
39
|
import { WebRequest } from 'botbuilder';
|
|
36
40
|
import { WebResponse } from 'botbuilder';
|
|
37
41
|
|
|
@@ -271,6 +275,176 @@ export declare class BearerTokenAuthProvider implements AuthProvider {
|
|
|
271
275
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
272
276
|
}
|
|
273
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 {@link DefaultBotSsoExecutionActivityHandler} class source code.
|
|
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
|
+
|
|
274
448
|
/**
|
|
275
449
|
* A card action bot to respond to adaptive card universal actions.
|
|
276
450
|
*/
|
|
@@ -389,25 +563,39 @@ export declare class Channel implements NotificationTarget {
|
|
|
389
563
|
export declare class CommandBot {
|
|
390
564
|
private readonly adapter;
|
|
391
565
|
private readonly middleware;
|
|
566
|
+
private readonly ssoConfig;
|
|
392
567
|
/**
|
|
393
568
|
* Creates a new instance of the `CommandBot`.
|
|
394
569
|
*
|
|
395
570
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
396
571
|
* @param options - initialize options
|
|
397
572
|
*/
|
|
398
|
-
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions);
|
|
573
|
+
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions, ssoCommandActivityHandler?: BotSsoExecutionActivityHandler, ssoConfig?: BotSsoConfig);
|
|
399
574
|
/**
|
|
400
575
|
* Registers a command into the command bot.
|
|
401
576
|
*
|
|
402
|
-
* @param command The command to
|
|
577
|
+
* @param command The command to register.
|
|
403
578
|
*/
|
|
404
579
|
registerCommand(command: TeamsFxBotCommandHandler): void;
|
|
405
580
|
/**
|
|
406
581
|
* Registers commands into the command bot.
|
|
407
582
|
*
|
|
408
|
-
* @param commands The
|
|
583
|
+
* @param commands The commands to register.
|
|
409
584
|
*/
|
|
410
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;
|
|
411
599
|
}
|
|
412
600
|
|
|
413
601
|
/**
|
|
@@ -432,6 +620,10 @@ export declare interface CommandOptions {
|
|
|
432
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.
|
|
433
621
|
*/
|
|
434
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[];
|
|
435
627
|
}
|
|
436
628
|
|
|
437
629
|
/**
|
|
@@ -533,7 +725,7 @@ export declare class ConversationBot {
|
|
|
533
725
|
* });
|
|
534
726
|
* ```
|
|
535
727
|
*/
|
|
536
|
-
requestHandler(req: WebRequest, res: WebResponse, logic?: (context:
|
|
728
|
+
requestHandler(req: WebRequest, res: WebResponse, logic?: (context: TurnContext) => Promise<any>): Promise<void>;
|
|
537
729
|
}
|
|
538
730
|
|
|
539
731
|
/**
|
|
@@ -558,6 +750,10 @@ export declare interface ConversationOptions {
|
|
|
558
750
|
adapterConfig?: {
|
|
559
751
|
[key: string]: unknown;
|
|
560
752
|
};
|
|
753
|
+
/**
|
|
754
|
+
* Configurations for sso command bot
|
|
755
|
+
*/
|
|
756
|
+
ssoConfig?: BotSsoConfig;
|
|
561
757
|
/**
|
|
562
758
|
* The command part.
|
|
563
759
|
*/
|
|
@@ -684,6 +880,59 @@ export declare function createPfxCertOption(pfx: string | Buffer, options?: {
|
|
|
684
880
|
passphrase?: string;
|
|
685
881
|
}): SecureContextOptions;
|
|
686
882
|
|
|
883
|
+
/**
|
|
884
|
+
* Default SSO execution activity handler
|
|
885
|
+
*/
|
|
886
|
+
export declare class DefaultBotSsoExecutionActivityHandler extends TeamsActivityHandler implements BotSsoExecutionActivityHandler {
|
|
887
|
+
private ssoExecutionDialog;
|
|
888
|
+
private userState;
|
|
889
|
+
private conversationState;
|
|
890
|
+
private dialogState;
|
|
891
|
+
/**
|
|
892
|
+
* Creates a new instance of the DefaultBotSsoExecutionActivityHandler.
|
|
893
|
+
* @param ssoConfig configuration for SSO command bot
|
|
894
|
+
*
|
|
895
|
+
* @remarks
|
|
896
|
+
* In the constructor, it uses BotSsoConfig parameter which from {@link ConversationBot} options to initialize {@link BotSsoExecutionDialog}.
|
|
897
|
+
* It also need to register an event handler for the message event which trigger {@link BotSsoExecutionDialog} instance.
|
|
898
|
+
*/
|
|
899
|
+
constructor(ssoConfig: BotSsoConfig);
|
|
900
|
+
/**
|
|
901
|
+
* Add TeamsFxBotSsoCommandHandler instance to SSO execution dialog
|
|
902
|
+
* @param handler {@link BotSsoExecutionDialogHandler} callback function
|
|
903
|
+
* @param triggerPatterns The trigger pattern
|
|
904
|
+
*
|
|
905
|
+
* @remarks
|
|
906
|
+
* This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.
|
|
907
|
+
*/
|
|
908
|
+
addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
|
|
909
|
+
/**
|
|
910
|
+
* Called to initiate the event emission process.
|
|
911
|
+
* @param context The context object for the current turn.
|
|
912
|
+
*/
|
|
913
|
+
run(context: TurnContext): Promise<void>;
|
|
914
|
+
/**
|
|
915
|
+
* Receives invoke activities with Activity name of 'signin/verifyState'.
|
|
916
|
+
* @param context A context object for this turn.
|
|
917
|
+
* @param query Signin state (part of signin action auth flow) verification invoke query.
|
|
918
|
+
* @returns A promise that represents the work queued.
|
|
919
|
+
*
|
|
920
|
+
* @remarks
|
|
921
|
+
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
|
922
|
+
*/
|
|
923
|
+
handleTeamsSigninVerifyState(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
|
|
924
|
+
/**
|
|
925
|
+
* Receives invoke activities with Activity name of 'signin/tokenExchange'
|
|
926
|
+
* @param context A context object for this turn.
|
|
927
|
+
* @param query Signin state (part of signin action auth flow) verification invoke query
|
|
928
|
+
* @returns A promise that represents the work queued.
|
|
929
|
+
*
|
|
930
|
+
* @remark
|
|
931
|
+
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
|
932
|
+
*/
|
|
933
|
+
handleTeamsSigninTokenExchange(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
|
|
934
|
+
}
|
|
935
|
+
|
|
687
936
|
/**
|
|
688
937
|
* Error code to trace the error types.
|
|
689
938
|
*/
|
|
@@ -708,6 +957,30 @@ export declare enum ErrorCode {
|
|
|
708
957
|
* Channel is not supported error.
|
|
709
958
|
*/
|
|
710
959
|
ChannelNotSupported = "ChannelNotSupported",
|
|
960
|
+
/**
|
|
961
|
+
* Failed to retrieve sso token
|
|
962
|
+
*/
|
|
963
|
+
FailedToRetrieveSsoToken = "FailedToRetrieveSsoToken",
|
|
964
|
+
/**
|
|
965
|
+
* Failed to process sso handler
|
|
966
|
+
*/
|
|
967
|
+
FailedToProcessSsoHandler = "FailedToProcessSsoHandler",
|
|
968
|
+
/**
|
|
969
|
+
* Cannot find command
|
|
970
|
+
*/
|
|
971
|
+
CannotFindCommand = "CannotFindCommand",
|
|
972
|
+
/**
|
|
973
|
+
* Failed to run sso step
|
|
974
|
+
*/
|
|
975
|
+
FailedToRunSsoStep = "FailedToRunSsoStep",
|
|
976
|
+
/**
|
|
977
|
+
* Failed to run dedup step
|
|
978
|
+
*/
|
|
979
|
+
FailedToRunDedupStep = "FailedToRunDedupStep",
|
|
980
|
+
/**
|
|
981
|
+
* Sso activity handler is undefined
|
|
982
|
+
*/
|
|
983
|
+
SsoActivityHandlerIsUndefined = "SsoActivityHandlerIsUndefined",
|
|
711
984
|
/**
|
|
712
985
|
* Runtime is not supported error.
|
|
713
986
|
*/
|
|
@@ -857,7 +1130,7 @@ export declare class InvokeResponseFactory {
|
|
|
857
1130
|
*
|
|
858
1131
|
* @returns {InvokeResponse} An InvokeResponse object.
|
|
859
1132
|
*/
|
|
860
|
-
static textMessage(message: string):
|
|
1133
|
+
static textMessage(message: string): InvokeResponse;
|
|
861
1134
|
/**
|
|
862
1135
|
* Create an invoke response from an adaptive card.
|
|
863
1136
|
*
|
|
@@ -869,7 +1142,7 @@ export declare class InvokeResponseFactory {
|
|
|
869
1142
|
*
|
|
870
1143
|
* @returns {InvokeResponse} An InvokeResponse object.
|
|
871
1144
|
*/
|
|
872
|
-
static adaptiveCard(card: IAdaptiveCard):
|
|
1145
|
+
static adaptiveCard(card: IAdaptiveCard): InvokeResponse;
|
|
873
1146
|
/**
|
|
874
1147
|
* Create an invoke response with error code and message.
|
|
875
1148
|
*
|
|
@@ -883,7 +1156,7 @@ export declare class InvokeResponseFactory {
|
|
|
883
1156
|
*
|
|
884
1157
|
* @returns {InvokeResponse} An InvokeResponse object.
|
|
885
1158
|
*/
|
|
886
|
-
static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string):
|
|
1159
|
+
static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string): InvokeResponse;
|
|
887
1160
|
/**
|
|
888
1161
|
* Create an invoke response with status code and response value.
|
|
889
1162
|
* @param statusCode The status code.
|
|
@@ -891,7 +1164,7 @@ export declare class InvokeResponseFactory {
|
|
|
891
1164
|
*
|
|
892
1165
|
* @returns {InvokeResponse} An InvokeResponse object.
|
|
893
1166
|
*/
|
|
894
|
-
static createInvokeResponse(statusCode: StatusCodes, body?: unknown):
|
|
1167
|
+
static createInvokeResponse(statusCode: StatusCodes, body?: unknown): InvokeResponse;
|
|
895
1168
|
}
|
|
896
1169
|
|
|
897
1170
|
/**
|
|
@@ -1032,14 +1305,14 @@ export declare class MessageBuilder {
|
|
|
1032
1305
|
* });
|
|
1033
1306
|
* ```
|
|
1034
1307
|
*/
|
|
1035
|
-
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<
|
|
1308
|
+
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<Activity>;
|
|
1036
1309
|
/**
|
|
1037
1310
|
* Build a bot message activity attached with an adaptive card.
|
|
1038
1311
|
*
|
|
1039
1312
|
* @param card The adaptive card content.
|
|
1040
1313
|
* @returns A bot message activity attached with an adaptive card.
|
|
1041
1314
|
*/
|
|
1042
|
-
static attachAdaptiveCardWithoutData(card: unknown): Partial<
|
|
1315
|
+
static attachAdaptiveCardWithoutData(card: unknown): Partial<Activity>;
|
|
1043
1316
|
/**
|
|
1044
1317
|
* Build a bot message activity attached with an hero card.
|
|
1045
1318
|
*
|
|
@@ -1060,7 +1333,7 @@ export declare class MessageBuilder {
|
|
|
1060
1333
|
* );
|
|
1061
1334
|
* ```
|
|
1062
1335
|
*/
|
|
1063
|
-
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<
|
|
1336
|
+
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<Activity>;
|
|
1064
1337
|
/**
|
|
1065
1338
|
* Returns an attachment for a sign-in card.
|
|
1066
1339
|
*
|
|
@@ -1073,20 +1346,20 @@ export declare class MessageBuilder {
|
|
|
1073
1346
|
* @remarks
|
|
1074
1347
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
1075
1348
|
*/
|
|
1076
|
-
static attachSigninCard(title: string, url: string, text?: string): Partial<
|
|
1349
|
+
static attachSigninCard(title: string, url: string, text?: string): Partial<Activity>;
|
|
1077
1350
|
/**
|
|
1078
1351
|
* Build a bot message activity attached with an Office 365 connector card.
|
|
1079
1352
|
*
|
|
1080
1353
|
* @param card A description of the Office 365 connector card.
|
|
1081
1354
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
1082
1355
|
*/
|
|
1083
|
-
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<
|
|
1356
|
+
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<Activity>;
|
|
1084
1357
|
/**
|
|
1085
1358
|
* Build a message activity attached with a receipt card.
|
|
1086
1359
|
* @param card A description of the receipt card.
|
|
1087
1360
|
* @returns A message activity attached with a receipt card.
|
|
1088
1361
|
*/
|
|
1089
|
-
static AttachReceiptCard(card: ReceiptCard): Partial<
|
|
1362
|
+
static AttachReceiptCard(card: ReceiptCard): Partial<Activity>;
|
|
1090
1363
|
/**
|
|
1091
1364
|
*
|
|
1092
1365
|
* @param title The card title.
|
|
@@ -1096,13 +1369,13 @@ export declare class MessageBuilder {
|
|
|
1096
1369
|
* @param other Optional. Any additional properties to include on the card.
|
|
1097
1370
|
* @returns A message activity attached with a thumbnail card
|
|
1098
1371
|
*/
|
|
1099
|
-
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<
|
|
1372
|
+
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<Activity>;
|
|
1100
1373
|
/**
|
|
1101
1374
|
* Add an attachement to a bot activity.
|
|
1102
1375
|
* @param attachement The attachment object to attach.
|
|
1103
1376
|
* @returns A message activity with an attachment.
|
|
1104
1377
|
*/
|
|
1105
|
-
static attachContent(attachement: Attachment): Partial<
|
|
1378
|
+
static attachContent(attachement: Attachment): Partial<Activity>;
|
|
1106
1379
|
}
|
|
1107
1380
|
|
|
1108
1381
|
/**
|
|
@@ -1809,6 +2082,26 @@ export declare interface TeamsFxBotCommandHandler {
|
|
|
1809
2082
|
handleCommandReceived(context: TurnContext, message: CommandMessage): Promise<string | Partial<Activity> | void>;
|
|
1810
2083
|
}
|
|
1811
2084
|
|
|
2085
|
+
/**
|
|
2086
|
+
* Interface for a command handler that can process sso command to a TeamsFx bot and return a response.
|
|
2087
|
+
*/
|
|
2088
|
+
export declare interface TeamsFxBotSsoCommandHandler {
|
|
2089
|
+
/**
|
|
2090
|
+
* The string or regular expression patterns that can trigger this handler.
|
|
2091
|
+
*/
|
|
2092
|
+
triggerPatterns: TriggerPatterns;
|
|
2093
|
+
/**
|
|
2094
|
+
* Handles a bot command received activity.
|
|
2095
|
+
*
|
|
2096
|
+
* @param context The bot context.
|
|
2097
|
+
* @param message The command message the user types from Teams.
|
|
2098
|
+
* @param ssoToken The sso token which can be used to exchange access token for the bot.
|
|
2099
|
+
* @returns A `Promise` representing an activity or text to send as the command response.
|
|
2100
|
+
* Or no return value if developers want to send the response activity by themselves in this method.
|
|
2101
|
+
*/
|
|
2102
|
+
handleCommandReceived(context: TurnContext, message: CommandMessage, ssoToken: TeamsBotSsoPromptTokenResponse): Promise<string | Partial<Activity> | void>;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
1812
2105
|
/**
|
|
1813
2106
|
* TeamsFx interface that provides credential and configuration.
|
|
1814
2107
|
*/
|