@microsoft/teamsfx 2.0.0-experimental.0 → 2.0.1-alpha.ba6cc7dba.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/LICENSE +21 -21
- package/dist/index.esm2017.js +351 -181
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +1301 -367
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +367 -181
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1351 -365
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +11 -10
- package/types/teamsfx.d.ts +649 -293
- package/CHANGELOG.md +0 -28
- package/NOTICE.txt +0 -9242
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,29 +11,54 @@ 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
|
-
*
|
|
37
|
-
* @beta
|
|
38
62
|
*/
|
|
39
63
|
export declare enum ApiKeyLocation {
|
|
40
64
|
/**
|
|
@@ -49,8 +73,6 @@ export declare enum ApiKeyLocation {
|
|
|
49
73
|
|
|
50
74
|
/**
|
|
51
75
|
* Provider that handles API Key authentication
|
|
52
|
-
*
|
|
53
|
-
* @beta
|
|
54
76
|
*/
|
|
55
77
|
export declare class ApiKeyProvider implements AuthProvider {
|
|
56
78
|
private keyName;
|
|
@@ -64,8 +86,6 @@ export declare class ApiKeyProvider implements AuthProvider {
|
|
|
64
86
|
*
|
|
65
87
|
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
66
88
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
67
|
-
*
|
|
68
|
-
* @beta
|
|
69
89
|
*/
|
|
70
90
|
constructor(keyName: string, keyValue: string, keyLocation: ApiKeyLocation);
|
|
71
91
|
/**
|
|
@@ -78,8 +98,6 @@ export declare class ApiKeyProvider implements AuthProvider {
|
|
|
78
98
|
*
|
|
79
99
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
80
100
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
81
|
-
*
|
|
82
|
-
* @beta
|
|
83
101
|
*/
|
|
84
102
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
85
103
|
}
|
|
@@ -95,8 +113,6 @@ export declare class ApiKeyProvider implements AuthProvider {
|
|
|
95
113
|
*
|
|
96
114
|
* @remarks
|
|
97
115
|
* Only works in in server side.
|
|
98
|
-
*
|
|
99
|
-
* @beta
|
|
100
116
|
*/
|
|
101
117
|
export declare class AppCredential implements TokenCredential {
|
|
102
118
|
private readonly msalClient;
|
|
@@ -110,8 +126,6 @@ export declare class AppCredential implements TokenCredential {
|
|
|
110
126
|
*
|
|
111
127
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.
|
|
112
128
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
113
|
-
*
|
|
114
|
-
* @beta
|
|
115
129
|
*/
|
|
116
130
|
constructor(authConfig: AuthenticationConfiguration);
|
|
117
131
|
/**
|
|
@@ -137,8 +151,6 @@ export declare class AppCredential implements TokenCredential {
|
|
|
137
151
|
*
|
|
138
152
|
* @returns Access token with expected scopes.
|
|
139
153
|
* Throw error if get access token failed.
|
|
140
|
-
*
|
|
141
|
-
* @beta
|
|
142
154
|
*/
|
|
143
155
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
144
156
|
/**
|
|
@@ -153,7 +165,6 @@ export declare class AppCredential implements TokenCredential {
|
|
|
153
165
|
|
|
154
166
|
/**
|
|
155
167
|
* Authentication related configuration.
|
|
156
|
-
* @beta
|
|
157
168
|
*/
|
|
158
169
|
export declare interface AuthenticationConfiguration {
|
|
159
170
|
/**
|
|
@@ -200,8 +211,6 @@ export declare interface AuthenticationConfiguration {
|
|
|
200
211
|
|
|
201
212
|
/**
|
|
202
213
|
* Defines method that injects authentication info to http requests
|
|
203
|
-
*
|
|
204
|
-
* @beta
|
|
205
214
|
*/
|
|
206
215
|
export declare interface AuthProvider {
|
|
207
216
|
/**
|
|
@@ -209,8 +218,6 @@ export declare interface AuthProvider {
|
|
|
209
218
|
*
|
|
210
219
|
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
211
220
|
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
212
|
-
*
|
|
213
|
-
* @beta
|
|
214
221
|
*/
|
|
215
222
|
AddAuthenticationInfo: (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
|
216
223
|
}
|
|
@@ -219,8 +226,6 @@ export { AxiosInstance }
|
|
|
219
226
|
|
|
220
227
|
/**
|
|
221
228
|
* Provider that handles Basic authentication
|
|
222
|
-
*
|
|
223
|
-
* @beta
|
|
224
229
|
*/
|
|
225
230
|
export declare class BasicAuthProvider implements AuthProvider {
|
|
226
231
|
private userName;
|
|
@@ -232,8 +237,6 @@ export declare class BasicAuthProvider implements AuthProvider {
|
|
|
232
237
|
*
|
|
233
238
|
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
234
239
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
235
|
-
*
|
|
236
|
-
* @beta
|
|
237
240
|
*/
|
|
238
241
|
constructor(userName: string, password: string);
|
|
239
242
|
/**
|
|
@@ -246,23 +249,17 @@ export declare class BasicAuthProvider implements AuthProvider {
|
|
|
246
249
|
*
|
|
247
250
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
248
251
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
249
|
-
*
|
|
250
|
-
* @beta
|
|
251
252
|
*/
|
|
252
253
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
/**
|
|
256
257
|
* Provider that handles Bearer Token authentication
|
|
257
|
-
*
|
|
258
|
-
* @beta
|
|
259
258
|
*/
|
|
260
259
|
export declare class BearerTokenAuthProvider implements AuthProvider {
|
|
261
260
|
private getToken;
|
|
262
261
|
/**
|
|
263
262
|
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
264
|
-
*
|
|
265
|
-
* @beta
|
|
266
263
|
*/
|
|
267
264
|
constructor(getToken: () => Promise<string>);
|
|
268
265
|
/**
|
|
@@ -274,16 +271,217 @@ export declare class BearerTokenAuthProvider implements AuthProvider {
|
|
|
274
271
|
* @returns Updated axios request config.
|
|
275
272
|
*
|
|
276
273
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
277
|
-
*
|
|
278
|
-
* @beta
|
|
279
274
|
*/
|
|
280
275
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
281
276
|
}
|
|
282
277
|
|
|
283
278
|
/**
|
|
284
|
-
*
|
|
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:
|
|
285
334
|
*
|
|
286
|
-
*
|
|
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
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Provider that handles Certificate authentication
|
|
287
485
|
*/
|
|
288
486
|
export declare class CertificateAuthProvider implements AuthProvider {
|
|
289
487
|
private certOption;
|
|
@@ -292,8 +490,6 @@ export declare class CertificateAuthProvider implements AuthProvider {
|
|
|
292
490
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
293
491
|
*
|
|
294
492
|
* @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
|
|
295
|
-
*
|
|
296
|
-
* @beta
|
|
297
493
|
*/
|
|
298
494
|
constructor(certOption: SecureContextOptions);
|
|
299
495
|
/**
|
|
@@ -305,8 +501,6 @@ export declare class CertificateAuthProvider implements AuthProvider {
|
|
|
305
501
|
* @returns Updated axios request config.
|
|
306
502
|
*
|
|
307
503
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
308
|
-
*
|
|
309
|
-
* @beta
|
|
310
504
|
*/
|
|
311
505
|
AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
|
|
312
506
|
}
|
|
@@ -316,26 +510,18 @@ export declare class CertificateAuthProvider implements AuthProvider {
|
|
|
316
510
|
*
|
|
317
511
|
* @remarks
|
|
318
512
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
319
|
-
*
|
|
320
|
-
* @beta
|
|
321
513
|
*/
|
|
322
514
|
export declare class Channel implements NotificationTarget {
|
|
323
515
|
/**
|
|
324
516
|
* The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
325
|
-
*
|
|
326
|
-
* @beta
|
|
327
517
|
*/
|
|
328
518
|
readonly parent: TeamsBotInstallation;
|
|
329
519
|
/**
|
|
330
520
|
* Detailed channel information.
|
|
331
|
-
*
|
|
332
|
-
* @beta
|
|
333
521
|
*/
|
|
334
522
|
readonly info: ChannelInfo;
|
|
335
523
|
/**
|
|
336
524
|
* Notification target type. For channel it's always "Channel".
|
|
337
|
-
*
|
|
338
|
-
* @beta
|
|
339
525
|
*/
|
|
340
526
|
readonly type: NotificationTargetType;
|
|
341
527
|
/**
|
|
@@ -346,28 +532,26 @@ export declare class Channel implements NotificationTarget {
|
|
|
346
532
|
*
|
|
347
533
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
348
534
|
* @param info - Detailed channel information.
|
|
349
|
-
*
|
|
350
|
-
* @beta
|
|
351
535
|
*/
|
|
352
536
|
constructor(parent: TeamsBotInstallation, info: ChannelInfo);
|
|
353
537
|
/**
|
|
354
538
|
* Send a plain text message.
|
|
355
539
|
*
|
|
356
540
|
* @param text - the plain text message.
|
|
357
|
-
* @
|
|
358
|
-
*
|
|
359
|
-
* @
|
|
541
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
542
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
543
|
+
* @returns the response of sending message.
|
|
360
544
|
*/
|
|
361
|
-
sendMessage(text: string): Promise<
|
|
545
|
+
sendMessage(text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
362
546
|
/**
|
|
363
547
|
* Send an adaptive card message.
|
|
364
548
|
*
|
|
365
549
|
* @param card - the adaptive card raw JSON.
|
|
366
|
-
* @
|
|
367
|
-
*
|
|
368
|
-
* @
|
|
550
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
551
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
552
|
+
* @returns the response of sending adaptive card message.
|
|
369
553
|
*/
|
|
370
|
-
sendAdaptiveCard(card: unknown): Promise<
|
|
554
|
+
sendAdaptiveCard(card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
371
555
|
/**
|
|
372
556
|
* @internal
|
|
373
557
|
*/
|
|
@@ -379,37 +563,43 @@ export declare class Channel implements NotificationTarget {
|
|
|
379
563
|
*
|
|
380
564
|
* @remarks
|
|
381
565
|
* Ensure each command should ONLY be registered with the command once, otherwise it'll cause unexpected behavior if you register the same command more than once.
|
|
382
|
-
*
|
|
383
|
-
* @beta
|
|
384
566
|
*/
|
|
385
567
|
export declare class CommandBot {
|
|
386
568
|
private readonly adapter;
|
|
387
569
|
private readonly middleware;
|
|
570
|
+
private readonly ssoConfig;
|
|
388
571
|
/**
|
|
389
572
|
* Creates a new instance of the `CommandBot`.
|
|
390
573
|
*
|
|
391
574
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
392
575
|
* @param options - initialize options
|
|
393
|
-
*
|
|
394
|
-
* @beta
|
|
395
576
|
*/
|
|
396
|
-
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions);
|
|
577
|
+
constructor(adapter: BotFrameworkAdapter, options?: CommandOptions, ssoCommandActivityHandler?: BotSsoExecutionActivityHandler, ssoConfig?: BotSsoConfig);
|
|
397
578
|
/**
|
|
398
579
|
* Registers a command into the command bot.
|
|
399
580
|
*
|
|
400
|
-
* @param command The command to
|
|
401
|
-
*
|
|
402
|
-
* @beta
|
|
581
|
+
* @param command The command to register.
|
|
403
582
|
*/
|
|
404
583
|
registerCommand(command: TeamsFxBotCommandHandler): void;
|
|
405
584
|
/**
|
|
406
585
|
* Registers commands into the command bot.
|
|
407
586
|
*
|
|
408
|
-
* @param commands The
|
|
409
|
-
*
|
|
410
|
-
* @beta
|
|
587
|
+
* @param commands The commands to register.
|
|
411
588
|
*/
|
|
412
589
|
registerCommands(commands: TeamsFxBotCommandHandler[]): void;
|
|
590
|
+
/**
|
|
591
|
+
* Registers a sso command into the command bot.
|
|
592
|
+
*
|
|
593
|
+
* @param command The command to register.
|
|
594
|
+
*/
|
|
595
|
+
registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void;
|
|
596
|
+
/**
|
|
597
|
+
* Registers commands into the command bot.
|
|
598
|
+
*
|
|
599
|
+
* @param commands The commands to register.
|
|
600
|
+
*/
|
|
601
|
+
registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void;
|
|
602
|
+
private validateSsoActivityHandler;
|
|
413
603
|
}
|
|
414
604
|
|
|
415
605
|
/**
|
|
@@ -428,16 +618,16 @@ export declare interface CommandMessage {
|
|
|
428
618
|
|
|
429
619
|
/**
|
|
430
620
|
* Options to initialize {@link CommandBot}.
|
|
431
|
-
*
|
|
432
|
-
* @beta
|
|
433
621
|
*/
|
|
434
622
|
export declare interface CommandOptions {
|
|
435
623
|
/**
|
|
436
624
|
* 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.
|
|
437
|
-
*
|
|
438
|
-
* @beta
|
|
439
625
|
*/
|
|
440
626
|
commands?: TeamsFxBotCommandHandler[];
|
|
627
|
+
/**
|
|
628
|
+
* 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.
|
|
629
|
+
*/
|
|
630
|
+
ssoCommands?: TeamsFxBotSsoCommandHandler[];
|
|
441
631
|
}
|
|
442
632
|
|
|
443
633
|
/**
|
|
@@ -490,28 +680,24 @@ export declare interface CommandOptions {
|
|
|
490
680
|
* For command and response, ensure each command should ONLY be registered with the command once, otherwise it'll cause unexpected behavior if you register the same command more than once.
|
|
491
681
|
*
|
|
492
682
|
* For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
|
|
493
|
-
*
|
|
494
|
-
* @beta
|
|
495
683
|
*/
|
|
496
684
|
export declare class ConversationBot {
|
|
497
685
|
/**
|
|
498
686
|
* The bot adapter.
|
|
499
|
-
*
|
|
500
|
-
* @beta
|
|
501
687
|
*/
|
|
502
688
|
readonly adapter: BotFrameworkAdapter;
|
|
503
689
|
/**
|
|
504
690
|
* The entrypoint of command and response.
|
|
505
|
-
*
|
|
506
|
-
* @beta
|
|
507
691
|
*/
|
|
508
692
|
readonly command?: CommandBot;
|
|
509
693
|
/**
|
|
510
694
|
* The entrypoint of notification.
|
|
511
|
-
*
|
|
512
|
-
* @beta
|
|
513
695
|
*/
|
|
514
696
|
readonly notification?: NotificationBot;
|
|
697
|
+
/**
|
|
698
|
+
* The action handler used for adaptive card universal actions.
|
|
699
|
+
*/
|
|
700
|
+
readonly cardAction?: CardActionBot;
|
|
515
701
|
/**
|
|
516
702
|
* Creates new instance of the `ConversationBot`.
|
|
517
703
|
*
|
|
@@ -519,8 +705,6 @@ export declare class ConversationBot {
|
|
|
519
705
|
* It's recommended to create your own adapter and storage for production environment instead of the default one.
|
|
520
706
|
*
|
|
521
707
|
* @param options - initialize options
|
|
522
|
-
*
|
|
523
|
-
* @beta
|
|
524
708
|
*/
|
|
525
709
|
constructor(options: ConversationOptions);
|
|
526
710
|
private createDefaultAdapter;
|
|
@@ -544,16 +728,12 @@ export declare class ConversationBot {
|
|
|
544
728
|
* });
|
|
545
729
|
* });
|
|
546
730
|
* ```
|
|
547
|
-
*
|
|
548
|
-
* @beta
|
|
549
731
|
*/
|
|
550
|
-
requestHandler(req: WebRequest, res: WebResponse, logic?: (context:
|
|
732
|
+
requestHandler(req: WebRequest, res: WebResponse, logic?: (context: TurnContext) => Promise<any>): Promise<void>;
|
|
551
733
|
}
|
|
552
734
|
|
|
553
735
|
/**
|
|
554
736
|
* Options to initialize {@link ConversationBot}
|
|
555
|
-
*
|
|
556
|
-
* @beta
|
|
557
737
|
*/
|
|
558
738
|
export declare interface ConversationOptions {
|
|
559
739
|
/**
|
|
@@ -563,8 +743,6 @@ export declare interface ConversationOptions {
|
|
|
563
743
|
*
|
|
564
744
|
* @remarks
|
|
565
745
|
* If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.
|
|
566
|
-
*
|
|
567
|
-
* @beta
|
|
568
746
|
*/
|
|
569
747
|
adapter?: BotFrameworkAdapter;
|
|
570
748
|
/**
|
|
@@ -572,35 +750,38 @@ export declare interface ConversationOptions {
|
|
|
572
750
|
*
|
|
573
751
|
* @remarks
|
|
574
752
|
* If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.
|
|
575
|
-
*
|
|
576
|
-
* @beta
|
|
577
753
|
*/
|
|
578
754
|
adapterConfig?: {
|
|
579
755
|
[key: string]: unknown;
|
|
580
756
|
};
|
|
757
|
+
/**
|
|
758
|
+
* Configurations for sso command bot
|
|
759
|
+
*/
|
|
760
|
+
ssoConfig?: BotSsoConfig;
|
|
581
761
|
/**
|
|
582
762
|
* The command part.
|
|
583
|
-
*
|
|
584
|
-
* @beta
|
|
585
763
|
*/
|
|
586
764
|
command?: CommandOptions & {
|
|
587
765
|
/**
|
|
588
766
|
* Whether to enable command or not.
|
|
589
|
-
*
|
|
590
|
-
* @beta
|
|
591
767
|
*/
|
|
592
768
|
enabled?: boolean;
|
|
593
769
|
};
|
|
594
770
|
/**
|
|
595
771
|
* The notification part.
|
|
596
|
-
*
|
|
597
|
-
* @beta
|
|
598
772
|
*/
|
|
599
773
|
notification?: NotificationOptions_2 & {
|
|
600
774
|
/**
|
|
601
775
|
* Whether to enable notification or not.
|
|
602
|
-
|
|
603
|
-
|
|
776
|
+
*/
|
|
777
|
+
enabled?: boolean;
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* The adaptive card action handler part.
|
|
781
|
+
*/
|
|
782
|
+
cardAction?: CardActionOptions & {
|
|
783
|
+
/**
|
|
784
|
+
* Whether to enable adaptive card actions or not.
|
|
604
785
|
*/
|
|
605
786
|
enabled?: boolean;
|
|
606
787
|
};
|
|
@@ -617,8 +798,6 @@ export declare interface ConversationOptions {
|
|
|
617
798
|
* ```typescript
|
|
618
799
|
* const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
|
|
619
800
|
* ```
|
|
620
|
-
*
|
|
621
|
-
* @beta
|
|
622
801
|
*/
|
|
623
802
|
export declare function createApiClient(apiEndpoint: string, authProvider: AuthProvider): AxiosInstance;
|
|
624
803
|
|
|
@@ -670,8 +849,6 @@ export declare function createApiClient(apiEndpoint: string, authProvider: AuthP
|
|
|
670
849
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
671
850
|
*
|
|
672
851
|
* @returns Graph client with specified scopes.
|
|
673
|
-
*
|
|
674
|
-
* @beta
|
|
675
852
|
*/
|
|
676
853
|
export declare function createMicrosoftGraphClient(teamsfx: TeamsFxConfiguration, scopes?: string | string[]): Client;
|
|
677
854
|
|
|
@@ -709,7 +886,6 @@ export declare function createPfxCertOption(pfx: string | Buffer, options?: {
|
|
|
709
886
|
|
|
710
887
|
/**
|
|
711
888
|
* Error code to trace the error types.
|
|
712
|
-
* @beta
|
|
713
889
|
*/
|
|
714
890
|
export declare enum ErrorCode {
|
|
715
891
|
/**
|
|
@@ -732,6 +908,30 @@ export declare enum ErrorCode {
|
|
|
732
908
|
* Channel is not supported error.
|
|
733
909
|
*/
|
|
734
910
|
ChannelNotSupported = "ChannelNotSupported",
|
|
911
|
+
/**
|
|
912
|
+
* Failed to retrieve sso token
|
|
913
|
+
*/
|
|
914
|
+
FailedToRetrieveSsoToken = "FailedToRetrieveSsoToken",
|
|
915
|
+
/**
|
|
916
|
+
* Failed to process sso handler
|
|
917
|
+
*/
|
|
918
|
+
FailedToProcessSsoHandler = "FailedToProcessSsoHandler",
|
|
919
|
+
/**
|
|
920
|
+
* Cannot find command
|
|
921
|
+
*/
|
|
922
|
+
CannotFindCommand = "CannotFindCommand",
|
|
923
|
+
/**
|
|
924
|
+
* Failed to run sso step
|
|
925
|
+
*/
|
|
926
|
+
FailedToRunSsoStep = "FailedToRunSsoStep",
|
|
927
|
+
/**
|
|
928
|
+
* Failed to run dedup step
|
|
929
|
+
*/
|
|
930
|
+
FailedToRunDedupStep = "FailedToRunDedupStep",
|
|
931
|
+
/**
|
|
932
|
+
* Sso activity handler is undefined
|
|
933
|
+
*/
|
|
934
|
+
SsoActivityHandlerIsUndefined = "SsoActivityHandlerIsUndefined",
|
|
735
935
|
/**
|
|
736
936
|
* Runtime is not supported error.
|
|
737
937
|
*/
|
|
@@ -772,8 +972,6 @@ export declare enum ErrorCode {
|
|
|
772
972
|
|
|
773
973
|
/**
|
|
774
974
|
* Error class with code and message thrown by the SDK.
|
|
775
|
-
*
|
|
776
|
-
* @beta
|
|
777
975
|
*/
|
|
778
976
|
export declare class ErrorWithCode extends Error {
|
|
779
977
|
/**
|
|
@@ -787,8 +985,6 @@ export declare class ErrorWithCode extends Error {
|
|
|
787
985
|
*
|
|
788
986
|
* @param {string} message - error message.
|
|
789
987
|
* @param {ErrorCode} code - error code.
|
|
790
|
-
*
|
|
791
|
-
* @beta
|
|
792
988
|
*/
|
|
793
989
|
constructor(message?: string, code?: ErrorCode);
|
|
794
990
|
}
|
|
@@ -797,11 +993,13 @@ export declare class ErrorWithCode extends Error {
|
|
|
797
993
|
* Get log level.
|
|
798
994
|
*
|
|
799
995
|
* @returns Log level
|
|
800
|
-
*
|
|
801
|
-
* @beta
|
|
802
996
|
*/
|
|
803
997
|
export declare function getLogLevel(): LogLevel | undefined;
|
|
804
998
|
|
|
999
|
+
export declare interface GetTeamsUserTokenOptions extends GetTokenOptions {
|
|
1000
|
+
resources?: string[];
|
|
1001
|
+
}
|
|
1002
|
+
|
|
805
1003
|
/**
|
|
806
1004
|
* Generate connection configuration consumed by tedious.
|
|
807
1005
|
*
|
|
@@ -813,15 +1011,30 @@ export declare function getLogLevel(): LogLevel | undefined;
|
|
|
813
1011
|
* @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.
|
|
814
1012
|
* @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.
|
|
815
1013
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
816
|
-
*
|
|
817
|
-
* @beta
|
|
818
1014
|
*/
|
|
819
1015
|
export declare function getTediousConnectionConfig(teamsfx: TeamsFx, databaseName?: string): Promise<ConnectionConfig>;
|
|
820
1016
|
|
|
821
1017
|
/**
|
|
822
|
-
*
|
|
1018
|
+
* Users execute query in message extension with SSO or access token.
|
|
823
1019
|
*
|
|
824
|
-
* @
|
|
1020
|
+
* @param {TurnContext} context - The context object for the current turn.
|
|
1021
|
+
* @param {AuthenticationConfiguration} config - User custom the message extension authentication configuration.
|
|
1022
|
+
* @param {string| string[]} scopes - The list of scopes for which the token will have access.
|
|
1023
|
+
* @param {function} logic - Business logic when executing the query in message extension with SSO or access token.
|
|
1024
|
+
*
|
|
1025
|
+
* @throws {@link ErrorCode|InternalError} when User invoke not response to message extension query.
|
|
1026
|
+
* @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.
|
|
1027
|
+
* @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.
|
|
1028
|
+
* @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth server.
|
|
1029
|
+
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1030
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1031
|
+
*
|
|
1032
|
+
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
|
1033
|
+
*/
|
|
1034
|
+
export declare function handleMessageExtensionQueryWithToken(context: TurnContext, config: AuthenticationConfiguration | null, scopes: string | string[], logic: (token: MessageExtensionTokenResponse) => Promise<any>): Promise<MessagingExtensionResponse | void>;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Identity type to use in authentication.
|
|
825
1038
|
*/
|
|
826
1039
|
export declare enum IdentityType {
|
|
827
1040
|
/**
|
|
@@ -835,15 +1048,102 @@ export declare enum IdentityType {
|
|
|
835
1048
|
}
|
|
836
1049
|
|
|
837
1050
|
/**
|
|
838
|
-
*
|
|
1051
|
+
* Status code for an `application/vnd.microsoft.error` invoke response.
|
|
1052
|
+
*/
|
|
1053
|
+
export declare enum InvokeResponseErrorCode {
|
|
1054
|
+
/**
|
|
1055
|
+
* Invalid request.
|
|
1056
|
+
*/
|
|
1057
|
+
BadRequest = 400,
|
|
1058
|
+
/**
|
|
1059
|
+
* Internal server error.
|
|
1060
|
+
*/
|
|
1061
|
+
InternalServerError = 500
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Provides methods for formatting various invoke responses a bot can send to respond to an invoke request.
|
|
1066
|
+
*
|
|
1067
|
+
* @remarks
|
|
1068
|
+
* All of these functions return an {@link InvokeResponse} object, which can be
|
|
1069
|
+
* passed as input to generate a new `invokeResponse` activity.
|
|
1070
|
+
*
|
|
1071
|
+
* This example sends an invoke response that contains an adaptive card.
|
|
1072
|
+
*
|
|
1073
|
+
* ```typescript
|
|
839
1074
|
*
|
|
840
|
-
*
|
|
1075
|
+
* const myCard = {
|
|
1076
|
+
* type: "AdaptiveCard",
|
|
1077
|
+
* body: [
|
|
1078
|
+
* {
|
|
1079
|
+
* "type": "TextBlock",
|
|
1080
|
+
* "text": "This is a sample card"
|
|
1081
|
+
* }],
|
|
1082
|
+
* $schema: "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
1083
|
+
* version: "1.4"
|
|
1084
|
+
* };
|
|
1085
|
+
*
|
|
1086
|
+
* const invokeResponse = InvokeResponseFactory.adaptiveCard(myCard);
|
|
1087
|
+
* await context.sendActivity({
|
|
1088
|
+
* type: ActivityTypes.InvokeResponse,
|
|
1089
|
+
* value: invokeResponse,
|
|
1090
|
+
* });
|
|
1091
|
+
* ```
|
|
1092
|
+
*/
|
|
1093
|
+
export declare class InvokeResponseFactory {
|
|
1094
|
+
/**
|
|
1095
|
+
* Create an invoke response from a text message.
|
|
1096
|
+
* The type of the invoke response is `application/vnd.microsoft.activity.message`
|
|
1097
|
+
* indicates the request was successfully processed.
|
|
1098
|
+
*
|
|
1099
|
+
* @param message A text message included in a invoke response.
|
|
1100
|
+
*
|
|
1101
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1102
|
+
*/
|
|
1103
|
+
static textMessage(message: string): InvokeResponse;
|
|
1104
|
+
/**
|
|
1105
|
+
* Create an invoke response from an adaptive card.
|
|
1106
|
+
*
|
|
1107
|
+
* The type of the invoke response is `application/vnd.microsoft.card.adaptive` indicates
|
|
1108
|
+
* the request was successfully processed, and the response includes an adaptive card
|
|
1109
|
+
* that the client should display in place of the current one.
|
|
1110
|
+
*
|
|
1111
|
+
* @param card The adaptive card JSON payload.
|
|
1112
|
+
*
|
|
1113
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1114
|
+
*/
|
|
1115
|
+
static adaptiveCard(card: unknown): InvokeResponse;
|
|
1116
|
+
/**
|
|
1117
|
+
* Create an invoke response with error code and message.
|
|
1118
|
+
*
|
|
1119
|
+
* The type of the invoke response is `application/vnd.microsoft.error` indicates
|
|
1120
|
+
* the request was failed to processed.
|
|
1121
|
+
*
|
|
1122
|
+
* @param errorCode The status code indicates error, available values:
|
|
1123
|
+
* - 400 (BadRequest): indicate the incoming request was invalid.
|
|
1124
|
+
* - 500 (InternalServerError): indicate an unexpected error occurred.
|
|
1125
|
+
* @param errorMessage The error message.
|
|
1126
|
+
*
|
|
1127
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1128
|
+
*/
|
|
1129
|
+
static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string): InvokeResponse;
|
|
1130
|
+
/**
|
|
1131
|
+
* Create an invoke response with status code and response value.
|
|
1132
|
+
* @param statusCode The status code.
|
|
1133
|
+
* @param body The value of the response body.
|
|
1134
|
+
*
|
|
1135
|
+
* @returns {InvokeResponse} An InvokeResponse object.
|
|
1136
|
+
*/
|
|
1137
|
+
static createInvokeResponse(statusCode: StatusCodes, body?: unknown): InvokeResponse;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Log function for customized logging.
|
|
841
1142
|
*/
|
|
842
1143
|
export declare type LogFunction = (level: LogLevel, message: string) => void;
|
|
843
1144
|
|
|
844
1145
|
/**
|
|
845
1146
|
* Interface for customized logger.
|
|
846
|
-
* @beta
|
|
847
1147
|
*/
|
|
848
1148
|
export declare interface Logger {
|
|
849
1149
|
/**
|
|
@@ -866,8 +1166,6 @@ export declare interface Logger {
|
|
|
866
1166
|
|
|
867
1167
|
/**
|
|
868
1168
|
* Log level.
|
|
869
|
-
*
|
|
870
|
-
* @beta
|
|
871
1169
|
*/
|
|
872
1170
|
export declare enum LogLevel {
|
|
873
1171
|
/**
|
|
@@ -893,26 +1191,18 @@ export declare enum LogLevel {
|
|
|
893
1191
|
*
|
|
894
1192
|
* @remarks
|
|
895
1193
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
896
|
-
*
|
|
897
|
-
* @beta
|
|
898
1194
|
*/
|
|
899
1195
|
export declare class Member implements NotificationTarget {
|
|
900
1196
|
/**
|
|
901
1197
|
* The parent {@link TeamsBotInstallation} where this member is created from.
|
|
902
|
-
*
|
|
903
|
-
* @beta
|
|
904
1198
|
*/
|
|
905
1199
|
readonly parent: TeamsBotInstallation;
|
|
906
1200
|
/**
|
|
907
1201
|
* Detailed member account information.
|
|
908
|
-
*
|
|
909
|
-
* @beta
|
|
910
1202
|
*/
|
|
911
1203
|
readonly account: TeamsChannelAccount;
|
|
912
1204
|
/**
|
|
913
1205
|
* Notification target type. For member it's always "Person".
|
|
914
|
-
*
|
|
915
|
-
* @beta
|
|
916
1206
|
*/
|
|
917
1207
|
readonly type: NotificationTargetType;
|
|
918
1208
|
/**
|
|
@@ -923,28 +1213,26 @@ export declare class Member implements NotificationTarget {
|
|
|
923
1213
|
*
|
|
924
1214
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
925
1215
|
* @param account - Detailed member account information.
|
|
926
|
-
*
|
|
927
|
-
* @beta
|
|
928
1216
|
*/
|
|
929
1217
|
constructor(parent: TeamsBotInstallation, account: TeamsChannelAccount);
|
|
930
1218
|
/**
|
|
931
1219
|
* Send a plain text message.
|
|
932
1220
|
*
|
|
933
1221
|
* @param text - the plain text message.
|
|
934
|
-
* @
|
|
935
|
-
*
|
|
936
|
-
* @
|
|
1222
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1223
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1224
|
+
* @returns the response of sending message.
|
|
937
1225
|
*/
|
|
938
|
-
sendMessage(text: string): Promise<
|
|
1226
|
+
sendMessage(text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
939
1227
|
/**
|
|
940
1228
|
* Send an adaptive card message.
|
|
941
1229
|
*
|
|
942
1230
|
* @param card - the adaptive card raw JSON.
|
|
943
|
-
* @
|
|
944
|
-
*
|
|
945
|
-
* @
|
|
1231
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1232
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1233
|
+
* @returns the response of sending adaptive card message.
|
|
946
1234
|
*/
|
|
947
|
-
sendAdaptiveCard(card: unknown): Promise<
|
|
1235
|
+
sendAdaptiveCard(card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
948
1236
|
/**
|
|
949
1237
|
* @internal
|
|
950
1238
|
*/
|
|
@@ -990,19 +1278,15 @@ export declare class MessageBuilder {
|
|
|
990
1278
|
* description: "sample card description"
|
|
991
1279
|
* });
|
|
992
1280
|
* ```
|
|
993
|
-
*
|
|
994
|
-
* @beta
|
|
995
1281
|
*/
|
|
996
|
-
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<
|
|
1282
|
+
static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<Activity>;
|
|
997
1283
|
/**
|
|
998
1284
|
* Build a bot message activity attached with an adaptive card.
|
|
999
1285
|
*
|
|
1000
1286
|
* @param card The adaptive card content.
|
|
1001
1287
|
* @returns A bot message activity attached with an adaptive card.
|
|
1002
|
-
*
|
|
1003
|
-
* @beta
|
|
1004
1288
|
*/
|
|
1005
|
-
static attachAdaptiveCardWithoutData(card: unknown): Partial<
|
|
1289
|
+
static attachAdaptiveCardWithoutData(card: unknown): Partial<Activity>;
|
|
1006
1290
|
/**
|
|
1007
1291
|
* Build a bot message activity attached with an hero card.
|
|
1008
1292
|
*
|
|
@@ -1022,10 +1306,8 @@ export declare class MessageBuilder {
|
|
|
1022
1306
|
* ['action']
|
|
1023
1307
|
* );
|
|
1024
1308
|
* ```
|
|
1025
|
-
*
|
|
1026
|
-
* @beta
|
|
1027
1309
|
*/
|
|
1028
|
-
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<
|
|
1310
|
+
static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<Activity>;
|
|
1029
1311
|
/**
|
|
1030
1312
|
* Returns an attachment for a sign-in card.
|
|
1031
1313
|
*
|
|
@@ -1037,27 +1319,21 @@ export declare class MessageBuilder {
|
|
|
1037
1319
|
*
|
|
1038
1320
|
* @remarks
|
|
1039
1321
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
1040
|
-
*
|
|
1041
|
-
* @beta
|
|
1042
1322
|
*/
|
|
1043
|
-
static attachSigninCard(title: string, url: string, text?: string): Partial<
|
|
1323
|
+
static attachSigninCard(title: string, url: string, text?: string): Partial<Activity>;
|
|
1044
1324
|
/**
|
|
1045
1325
|
* Build a bot message activity attached with an Office 365 connector card.
|
|
1046
1326
|
*
|
|
1047
1327
|
* @param card A description of the Office 365 connector card.
|
|
1048
1328
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
1049
|
-
*
|
|
1050
|
-
* @beta
|
|
1051
1329
|
*/
|
|
1052
|
-
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<
|
|
1330
|
+
static attachO365ConnectorCard(card: O365ConnectorCard): Partial<Activity>;
|
|
1053
1331
|
/**
|
|
1054
1332
|
* Build a message activity attached with a receipt card.
|
|
1055
1333
|
* @param card A description of the receipt card.
|
|
1056
1334
|
* @returns A message activity attached with a receipt card.
|
|
1057
|
-
*
|
|
1058
|
-
* @beta
|
|
1059
1335
|
*/
|
|
1060
|
-
static AttachReceiptCard(card: ReceiptCard): Partial<
|
|
1336
|
+
static AttachReceiptCard(card: ReceiptCard): Partial<Activity>;
|
|
1061
1337
|
/**
|
|
1062
1338
|
*
|
|
1063
1339
|
* @param title The card title.
|
|
@@ -1066,24 +1342,42 @@ export declare class MessageBuilder {
|
|
|
1066
1342
|
* is converted to an `imBack` button with a title and value set to the value of the string.
|
|
1067
1343
|
* @param other Optional. Any additional properties to include on the card.
|
|
1068
1344
|
* @returns A message activity attached with a thumbnail card
|
|
1069
|
-
*
|
|
1070
|
-
* @beta
|
|
1071
1345
|
*/
|
|
1072
|
-
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<
|
|
1346
|
+
static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<Activity>;
|
|
1073
1347
|
/**
|
|
1074
1348
|
* Add an attachement to a bot activity.
|
|
1075
1349
|
* @param attachement The attachment object to attach.
|
|
1076
1350
|
* @returns A message activity with an attachment.
|
|
1077
|
-
*
|
|
1078
|
-
* @beta
|
|
1079
1351
|
*/
|
|
1080
|
-
static attachContent(attachement: Attachment): Partial<
|
|
1352
|
+
static attachContent(attachement: Attachment): Partial<Activity>;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Token response provided by Teams Bot SSO prompt
|
|
1357
|
+
*/
|
|
1358
|
+
export declare interface MessageExtensionTokenResponse extends TokenResponse {
|
|
1359
|
+
/**
|
|
1360
|
+
* SSO token for user
|
|
1361
|
+
*/
|
|
1362
|
+
ssoToken: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* Expire time of SSO token
|
|
1365
|
+
*/
|
|
1366
|
+
ssoTokenExpiration: string;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* The response of a message action, e.g., `sendMessage`, `sendAdaptiveCard`.
|
|
1371
|
+
*/
|
|
1372
|
+
declare interface MessageResponse {
|
|
1373
|
+
/**
|
|
1374
|
+
* Id of the message.
|
|
1375
|
+
*/
|
|
1376
|
+
id?: string;
|
|
1081
1377
|
}
|
|
1082
1378
|
|
|
1083
1379
|
/**
|
|
1084
1380
|
* Microsoft Graph auth provider for Teams Framework
|
|
1085
|
-
*
|
|
1086
|
-
* @beta
|
|
1087
1381
|
*/
|
|
1088
1382
|
export declare class MsGraphAuthProvider implements AuthenticationProvider {
|
|
1089
1383
|
private teamsfx;
|
|
@@ -1097,8 +1391,6 @@ export declare class MsGraphAuthProvider implements AuthenticationProvider {
|
|
|
1097
1391
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1098
1392
|
*
|
|
1099
1393
|
* @returns An instance of MsGraphAuthProvider.
|
|
1100
|
-
*
|
|
1101
|
-
* @beta
|
|
1102
1394
|
*/
|
|
1103
1395
|
constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]);
|
|
1104
1396
|
/**
|
|
@@ -1118,8 +1410,6 @@ export declare class MsGraphAuthProvider implements AuthenticationProvider {
|
|
|
1118
1410
|
|
|
1119
1411
|
/**
|
|
1120
1412
|
* Provide utilities to send notification to varies targets (e.g., member, group, channel).
|
|
1121
|
-
*
|
|
1122
|
-
* @beta
|
|
1123
1413
|
*/
|
|
1124
1414
|
export declare class NotificationBot {
|
|
1125
1415
|
private readonly conversationReferenceStore;
|
|
@@ -1132,8 +1422,6 @@ export declare class NotificationBot {
|
|
|
1132
1422
|
*
|
|
1133
1423
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
1134
1424
|
* @param options - initialize options
|
|
1135
|
-
*
|
|
1136
|
-
* @beta
|
|
1137
1425
|
*/
|
|
1138
1426
|
constructor(adapter: BotFrameworkAdapter, options?: NotificationOptions_2);
|
|
1139
1427
|
/**
|
|
@@ -1143,16 +1431,49 @@ export declare class NotificationBot {
|
|
|
1143
1431
|
* The result is retrieving from the persisted storage.
|
|
1144
1432
|
*
|
|
1145
1433
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
1146
|
-
*
|
|
1147
|
-
* @beta
|
|
1148
1434
|
*/
|
|
1149
1435
|
installations(): Promise<TeamsBotInstallation[]>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1438
|
+
*
|
|
1439
|
+
* @param predicate find calls predicate once for each member of the installation,
|
|
1440
|
+
* until it finds one where predicate returns true. If such a member is found, find
|
|
1441
|
+
* immediately returns that member. Otherwise, find returns undefined.
|
|
1442
|
+
* @param scope the scope to find members from the installations
|
|
1443
|
+
* (personal chat, group chat, Teams channel).
|
|
1444
|
+
* @returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1445
|
+
*/
|
|
1446
|
+
findMember(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<Member | undefined>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1449
|
+
*
|
|
1450
|
+
* @param predicate find calls predicate once for each channel of the installation,
|
|
1451
|
+
* until it finds one where predicate returns true. If such a channel is found, find
|
|
1452
|
+
* immediately returns that channel. Otherwise, find returns undefined.
|
|
1453
|
+
* @returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1454
|
+
*/
|
|
1455
|
+
findChannel(predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>): Promise<Channel | undefined>;
|
|
1456
|
+
/**
|
|
1457
|
+
* Returns all {@link Member} where predicate is true, and empty array otherwise.
|
|
1458
|
+
*
|
|
1459
|
+
* @param predicate find calls predicate for each member of the installation.
|
|
1460
|
+
* @param scope the scope to find members from the installations
|
|
1461
|
+
* (personal chat, group chat, Teams channel).
|
|
1462
|
+
* @returns an array of {@link Member} where predicate is true, and empty array otherwise.
|
|
1463
|
+
*/
|
|
1464
|
+
findAllMembers(predicate: (member: Member) => Promise<boolean>, scope?: SearchScope): Promise<Member[]>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Returns all {@link Channel} where predicate is true, and empty array otherwise.
|
|
1467
|
+
*
|
|
1468
|
+
* @param predicate find calls predicate for each channel of the installation.
|
|
1469
|
+
* @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
|
|
1470
|
+
*/
|
|
1471
|
+
findAllChannels(predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>): Promise<Channel[]>;
|
|
1472
|
+
private matchSearchScope;
|
|
1150
1473
|
}
|
|
1151
1474
|
|
|
1152
1475
|
/**
|
|
1153
1476
|
* Options to initialize {@link NotificationBot}.
|
|
1154
|
-
*
|
|
1155
|
-
* @beta
|
|
1156
1477
|
*/
|
|
1157
1478
|
declare interface NotificationOptions_2 {
|
|
1158
1479
|
/**
|
|
@@ -1165,8 +1486,6 @@ declare interface NotificationOptions_2 {
|
|
|
1165
1486
|
* - "${process.env.TEMP}/.notification.localstore.json" if `process.env.RUNNING_ON_AZURE` is set to "1"
|
|
1166
1487
|
*
|
|
1167
1488
|
* It's recommended to use your own shared storage for production environment.
|
|
1168
|
-
*
|
|
1169
|
-
* @beta
|
|
1170
1489
|
*/
|
|
1171
1490
|
storage?: NotificationTargetStorage;
|
|
1172
1491
|
}
|
|
@@ -1174,38 +1493,36 @@ export { NotificationOptions_2 as NotificationOptions }
|
|
|
1174
1493
|
|
|
1175
1494
|
/**
|
|
1176
1495
|
* Represent a notification target.
|
|
1177
|
-
*
|
|
1178
|
-
* @beta
|
|
1179
1496
|
*/
|
|
1180
1497
|
export declare interface NotificationTarget {
|
|
1181
1498
|
/**
|
|
1182
1499
|
* The type of target, could be "Channel" or "Group" or "Person".
|
|
1183
|
-
*
|
|
1184
|
-
* @beta
|
|
1185
1500
|
*/
|
|
1186
1501
|
readonly type?: NotificationTargetType;
|
|
1187
1502
|
/**
|
|
1188
1503
|
* Send a plain text message.
|
|
1189
1504
|
*
|
|
1190
1505
|
* @param text - the plain text message.
|
|
1506
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1507
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1191
1508
|
*
|
|
1192
|
-
* @
|
|
1509
|
+
* @returns the response of sending message.
|
|
1193
1510
|
*/
|
|
1194
|
-
sendMessage(text: string): Promise<
|
|
1511
|
+
sendMessage(text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1195
1512
|
/**
|
|
1196
1513
|
* Send an adaptive card message.
|
|
1197
1514
|
*
|
|
1198
1515
|
* @param card - the adaptive card raw JSON.
|
|
1516
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1517
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1199
1518
|
*
|
|
1200
|
-
* @
|
|
1519
|
+
* @returns the response of sending adaptive card message.
|
|
1201
1520
|
*/
|
|
1202
|
-
sendAdaptiveCard(card: unknown): Promise<
|
|
1521
|
+
sendAdaptiveCard(card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1203
1522
|
}
|
|
1204
1523
|
|
|
1205
1524
|
/**
|
|
1206
1525
|
* Interface for a storage provider that stores and retrieves notification target references.
|
|
1207
|
-
*
|
|
1208
|
-
* @beta
|
|
1209
1526
|
*/
|
|
1210
1527
|
export declare interface NotificationTargetStorage {
|
|
1211
1528
|
/**
|
|
@@ -1214,8 +1531,6 @@ export declare interface NotificationTargetStorage {
|
|
|
1214
1531
|
* @param key - the key of a notification target.
|
|
1215
1532
|
*
|
|
1216
1533
|
* @returns - the notification target. Or undefined if not found.
|
|
1217
|
-
*
|
|
1218
|
-
* @beta
|
|
1219
1534
|
*/
|
|
1220
1535
|
read(key: string): Promise<{
|
|
1221
1536
|
[key: string]: unknown;
|
|
@@ -1224,8 +1539,6 @@ export declare interface NotificationTargetStorage {
|
|
|
1224
1539
|
* List all stored notification targets.
|
|
1225
1540
|
*
|
|
1226
1541
|
* @returns - an array of notification target. Or an empty array if nothing is stored.
|
|
1227
|
-
*
|
|
1228
|
-
* @beta
|
|
1229
1542
|
*/
|
|
1230
1543
|
list(): Promise<{
|
|
1231
1544
|
[key: string]: unknown;
|
|
@@ -1235,8 +1548,6 @@ export declare interface NotificationTargetStorage {
|
|
|
1235
1548
|
*
|
|
1236
1549
|
* @param key - the key of a notification target.
|
|
1237
1550
|
* @param object - the notification target.
|
|
1238
|
-
*
|
|
1239
|
-
* @beta
|
|
1240
1551
|
*/
|
|
1241
1552
|
write(key: string, object: {
|
|
1242
1553
|
[key: string]: unknown;
|
|
@@ -1245,8 +1556,6 @@ export declare interface NotificationTargetStorage {
|
|
|
1245
1556
|
* Delete one notification target by its key.
|
|
1246
1557
|
*
|
|
1247
1558
|
* @param key - the key of a notification target.
|
|
1248
|
-
*
|
|
1249
|
-
* @beta
|
|
1250
1559
|
*/
|
|
1251
1560
|
delete(key: string): Promise<void>;
|
|
1252
1561
|
}
|
|
@@ -1258,10 +1567,22 @@ export declare interface NotificationTargetStorage {
|
|
|
1258
1567
|
* - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
|
|
1259
1568
|
* - "Group" means to a group chat.
|
|
1260
1569
|
* - "Person" means to a personal chat.
|
|
1261
|
-
*
|
|
1262
|
-
* @beta
|
|
1263
1570
|
*/
|
|
1264
|
-
export declare
|
|
1571
|
+
export declare enum NotificationTargetType {
|
|
1572
|
+
/**
|
|
1573
|
+
* The notification will be sent to a team channel.
|
|
1574
|
+
* (By default, notification to a team will be sent to its "General" channel.)
|
|
1575
|
+
*/
|
|
1576
|
+
Channel = "Channel",
|
|
1577
|
+
/**
|
|
1578
|
+
* The notification will be sent to a group chat.
|
|
1579
|
+
*/
|
|
1580
|
+
Group = "Group",
|
|
1581
|
+
/**
|
|
1582
|
+
* The notification will be sent to a personal chat.
|
|
1583
|
+
*/
|
|
1584
|
+
Person = "Person"
|
|
1585
|
+
}
|
|
1265
1586
|
|
|
1266
1587
|
/**
|
|
1267
1588
|
* Represent on-behalf-of flow to get user identity, and it is designed to be used in server side.
|
|
@@ -1273,8 +1594,6 @@ export declare type NotificationTargetType = "Channel" | "Group" | "Person";
|
|
|
1273
1594
|
*
|
|
1274
1595
|
* @remarks
|
|
1275
1596
|
* Can only be used in server side.
|
|
1276
|
-
*
|
|
1277
|
-
* @beta
|
|
1278
1597
|
*/
|
|
1279
1598
|
export declare class OnBehalfOfUserCredential implements TokenCredential {
|
|
1280
1599
|
private msalClient;
|
|
@@ -1291,8 +1610,6 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
|
|
|
1291
1610
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, certificate content, authority host or tenant id is not found in config.
|
|
1292
1611
|
* @throws {@link ErrorCode|InternalError} when SSO token is not valid.
|
|
1293
1612
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1294
|
-
*
|
|
1295
|
-
* @beta
|
|
1296
1613
|
*/
|
|
1297
1614
|
constructor(ssoToken: string, config: AuthenticationConfiguration);
|
|
1298
1615
|
/**
|
|
@@ -1327,8 +1644,6 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
|
|
|
1327
1644
|
* @remarks
|
|
1328
1645
|
* If scopes is empty string or array, it returns SSO token.
|
|
1329
1646
|
* If scopes is non-empty, it returns access token for target scope.
|
|
1330
|
-
*
|
|
1331
|
-
* @beta
|
|
1332
1647
|
*/
|
|
1333
1648
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
1334
1649
|
/**
|
|
@@ -1343,34 +1658,56 @@ export declare class OnBehalfOfUserCredential implements TokenCredential {
|
|
|
1343
1658
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1344
1659
|
*
|
|
1345
1660
|
* @returns Basic user info with user displayName, objectId and preferredUserName.
|
|
1346
|
-
*
|
|
1347
|
-
* @beta
|
|
1348
1661
|
*/
|
|
1349
1662
|
getUserInfo(): UserInfo;
|
|
1350
1663
|
private generateAuthServerError;
|
|
1351
1664
|
}
|
|
1352
1665
|
|
|
1666
|
+
/**
|
|
1667
|
+
* The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
|
|
1668
|
+
* The search scope is a flagged enum and it can be combined with `|`.
|
|
1669
|
+
* For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
|
|
1670
|
+
*/
|
|
1671
|
+
export declare enum SearchScope {
|
|
1672
|
+
/**
|
|
1673
|
+
* Search members from the installations in personal chat only.
|
|
1674
|
+
*/
|
|
1675
|
+
Person = 1,
|
|
1676
|
+
/**
|
|
1677
|
+
* Search members from the installations in group chat only.
|
|
1678
|
+
*/
|
|
1679
|
+
Group = 2,
|
|
1680
|
+
/**
|
|
1681
|
+
* Search members from the installations in Teams channel only.
|
|
1682
|
+
*/
|
|
1683
|
+
Channel = 4,
|
|
1684
|
+
/**
|
|
1685
|
+
* Search members from all installations including personal chat, group chat and Teams channel.
|
|
1686
|
+
*/
|
|
1687
|
+
All = 7
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1353
1690
|
/**
|
|
1354
1691
|
* Send an adaptive card message to a notification target.
|
|
1355
1692
|
*
|
|
1356
1693
|
* @param target - the notification target.
|
|
1357
1694
|
* @param card - the adaptive card raw JSON.
|
|
1358
|
-
* @
|
|
1359
|
-
*
|
|
1360
|
-
* @
|
|
1695
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1696
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1697
|
+
* @returns the response of sending adaptive card message.
|
|
1361
1698
|
*/
|
|
1362
|
-
export declare function sendAdaptiveCard(target: NotificationTarget, card: unknown): Promise<
|
|
1699
|
+
export declare function sendAdaptiveCard(target: NotificationTarget, card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1363
1700
|
|
|
1364
1701
|
/**
|
|
1365
1702
|
* Send a plain text message to a notification target.
|
|
1366
1703
|
*
|
|
1367
1704
|
* @param target - the notification target.
|
|
1368
1705
|
* @param text - the plain text message.
|
|
1369
|
-
* @
|
|
1370
|
-
*
|
|
1371
|
-
* @
|
|
1706
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1707
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1708
|
+
* @returns the response of sending message.
|
|
1372
1709
|
*/
|
|
1373
|
-
export declare function sendMessage(target: NotificationTarget, text: string): Promise<
|
|
1710
|
+
export declare function sendMessage(target: NotificationTarget, text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1374
1711
|
|
|
1375
1712
|
/**
|
|
1376
1713
|
* Set custom log function. Use the function if it's set. Priority is lower than setLogger.
|
|
@@ -1385,8 +1722,6 @@ export declare function sendMessage(target: NotificationTarget, text: string): P
|
|
|
1385
1722
|
* }
|
|
1386
1723
|
* });
|
|
1387
1724
|
* ```
|
|
1388
|
-
*
|
|
1389
|
-
* @beta
|
|
1390
1725
|
*/
|
|
1391
1726
|
export declare function setLogFunction(logFunction?: LogFunction): void;
|
|
1392
1727
|
|
|
@@ -1404,8 +1739,6 @@ export declare function setLogFunction(logFunction?: LogFunction): void;
|
|
|
1404
1739
|
* error: console.error,
|
|
1405
1740
|
* });
|
|
1406
1741
|
* ```
|
|
1407
|
-
*
|
|
1408
|
-
* @beta
|
|
1409
1742
|
*/
|
|
1410
1743
|
export declare function setLogger(logger?: Logger): void;
|
|
1411
1744
|
|
|
@@ -1413,8 +1746,6 @@ export declare function setLogger(logger?: Logger): void;
|
|
|
1413
1746
|
* Update log level helper.
|
|
1414
1747
|
*
|
|
1415
1748
|
* @param { LogLevel } level - log level in configuration
|
|
1416
|
-
*
|
|
1417
|
-
* @beta
|
|
1418
1749
|
*/
|
|
1419
1750
|
export declare function setLogLevel(level: LogLevel): void;
|
|
1420
1751
|
|
|
@@ -1426,20 +1757,14 @@ export declare function setLogLevel(level: LogLevel): void;
|
|
|
1426
1757
|
*
|
|
1427
1758
|
* @remarks
|
|
1428
1759
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
1429
|
-
*
|
|
1430
|
-
* @beta
|
|
1431
1760
|
*/
|
|
1432
1761
|
export declare class TeamsBotInstallation implements NotificationTarget {
|
|
1433
1762
|
/**
|
|
1434
1763
|
* The bound `BotFrameworkAdapter`.
|
|
1435
|
-
*
|
|
1436
|
-
* @beta
|
|
1437
1764
|
*/
|
|
1438
1765
|
readonly adapter: BotFrameworkAdapter;
|
|
1439
1766
|
/**
|
|
1440
1767
|
* The bound `ConversationReference`.
|
|
1441
|
-
*
|
|
1442
|
-
* @beta
|
|
1443
1768
|
*/
|
|
1444
1769
|
readonly conversationReference: Partial<ConversationReference>;
|
|
1445
1770
|
/**
|
|
@@ -1449,8 +1774,6 @@ export declare class TeamsBotInstallation implements NotificationTarget {
|
|
|
1449
1774
|
* - "Channel" means bot is installed into a team and notification will be sent to its "General" channel.
|
|
1450
1775
|
* - "Group" means bot is installed into a group chat.
|
|
1451
1776
|
* - "Person" means bot is installed into a personal scope and notification will be sent to personal chat.
|
|
1452
|
-
*
|
|
1453
|
-
* @beta
|
|
1454
1777
|
*/
|
|
1455
1778
|
readonly type?: NotificationTargetType;
|
|
1456
1779
|
/**
|
|
@@ -1461,44 +1784,44 @@ export declare class TeamsBotInstallation implements NotificationTarget {
|
|
|
1461
1784
|
*
|
|
1462
1785
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
1463
1786
|
* @param conversationReference - the bound `ConversationReference`.
|
|
1464
|
-
*
|
|
1465
|
-
* @beta
|
|
1466
1787
|
*/
|
|
1467
1788
|
constructor(adapter: BotFrameworkAdapter, conversationReference: Partial<ConversationReference>);
|
|
1468
1789
|
/**
|
|
1469
1790
|
* Send a plain text message.
|
|
1470
1791
|
*
|
|
1471
1792
|
* @param text - the plain text message.
|
|
1472
|
-
* @
|
|
1473
|
-
*
|
|
1474
|
-
* @
|
|
1793
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1794
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1795
|
+
* @returns the response of sending message.
|
|
1475
1796
|
*/
|
|
1476
|
-
sendMessage(text: string): Promise<
|
|
1797
|
+
sendMessage(text: string, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1477
1798
|
/**
|
|
1478
1799
|
* Send an adaptive card message.
|
|
1479
1800
|
*
|
|
1480
1801
|
* @param card - the adaptive card raw JSON.
|
|
1481
|
-
* @
|
|
1482
|
-
*
|
|
1483
|
-
* @
|
|
1802
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1803
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
1804
|
+
* @returns the response of sending adaptive card message.
|
|
1484
1805
|
*/
|
|
1485
|
-
sendAdaptiveCard(card: unknown): Promise<
|
|
1806
|
+
sendAdaptiveCard(card: unknown, onError?: (context: TurnContext, error: Error) => Promise<void>): Promise<MessageResponse>;
|
|
1486
1807
|
/**
|
|
1487
1808
|
* Get channels from this bot installation.
|
|
1488
1809
|
*
|
|
1489
1810
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
1490
|
-
*
|
|
1491
|
-
* @beta
|
|
1492
1811
|
*/
|
|
1493
1812
|
channels(): Promise<Channel[]>;
|
|
1494
1813
|
/**
|
|
1495
1814
|
* Get members from this bot installation.
|
|
1496
1815
|
*
|
|
1497
1816
|
* @returns an array of members from where the bot is installed.
|
|
1498
|
-
*
|
|
1499
|
-
* @beta
|
|
1500
1817
|
*/
|
|
1501
1818
|
members(): Promise<Member[]>;
|
|
1819
|
+
/**
|
|
1820
|
+
* Get team details from this bot installation
|
|
1821
|
+
*
|
|
1822
|
+
* @returns the team details if bot is installed into a team, otherwise returns undefined.
|
|
1823
|
+
*/
|
|
1824
|
+
getTeamDetails(): Promise<TeamDetails | undefined>;
|
|
1502
1825
|
}
|
|
1503
1826
|
|
|
1504
1827
|
/**
|
|
@@ -1548,8 +1871,6 @@ export declare class TeamsBotInstallation implements NotificationTarget {
|
|
|
1548
1871
|
* }
|
|
1549
1872
|
* ]));
|
|
1550
1873
|
* ```
|
|
1551
|
-
*
|
|
1552
|
-
* @beta
|
|
1553
1874
|
*/
|
|
1554
1875
|
export declare class TeamsBotSsoPrompt extends Dialog {
|
|
1555
1876
|
private teamsfx;
|
|
@@ -1563,8 +1884,6 @@ export declare class TeamsBotSsoPrompt extends Dialog {
|
|
|
1563
1884
|
*
|
|
1564
1885
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1565
1886
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1566
|
-
*
|
|
1567
|
-
* @beta
|
|
1568
1887
|
*/
|
|
1569
1888
|
constructor(teamsfx: TeamsFx, dialogId: string, settings: TeamsBotSsoPromptSettings);
|
|
1570
1889
|
/**
|
|
@@ -1580,8 +1899,6 @@ export declare class TeamsBotSsoPrompt extends Dialog {
|
|
|
1580
1899
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1581
1900
|
*
|
|
1582
1901
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1583
|
-
*
|
|
1584
|
-
* @beta
|
|
1585
1902
|
*/
|
|
1586
1903
|
beginDialog(dc: DialogContext): Promise<DialogTurnResult>;
|
|
1587
1904
|
/**
|
|
@@ -1599,8 +1916,6 @@ export declare class TeamsBotSsoPrompt extends Dialog {
|
|
|
1599
1916
|
*
|
|
1600
1917
|
* @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
|
|
1601
1918
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1602
|
-
*
|
|
1603
|
-
* @beta
|
|
1604
1919
|
*/
|
|
1605
1920
|
continueDialog(dc: DialogContext): Promise<DialogTurnResult>;
|
|
1606
1921
|
private loadAndValidateConfig;
|
|
@@ -1650,8 +1965,6 @@ export declare class TeamsBotSsoPrompt extends Dialog {
|
|
|
1650
1965
|
|
|
1651
1966
|
/**
|
|
1652
1967
|
* Settings used to configure an TeamsBotSsoPrompt instance.
|
|
1653
|
-
*
|
|
1654
|
-
* @beta
|
|
1655
1968
|
*/
|
|
1656
1969
|
export declare interface TeamsBotSsoPromptSettings {
|
|
1657
1970
|
/**
|
|
@@ -1674,8 +1987,6 @@ export declare interface TeamsBotSsoPromptSettings {
|
|
|
1674
1987
|
|
|
1675
1988
|
/**
|
|
1676
1989
|
* Token response provided by Teams Bot SSO prompt
|
|
1677
|
-
*
|
|
1678
|
-
* @beta
|
|
1679
1990
|
*/
|
|
1680
1991
|
export declare interface TeamsBotSsoPromptTokenResponse extends TokenResponse {
|
|
1681
1992
|
/**
|
|
@@ -1690,7 +2001,6 @@ export declare interface TeamsBotSsoPromptTokenResponse extends TokenResponse {
|
|
|
1690
2001
|
|
|
1691
2002
|
/**
|
|
1692
2003
|
* A class providing credential and configuration.
|
|
1693
|
-
* @beta
|
|
1694
2004
|
*/
|
|
1695
2005
|
export declare class TeamsFx implements TeamsFxConfiguration {
|
|
1696
2006
|
private configuration;
|
|
@@ -1704,15 +2014,12 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1704
2014
|
* @param customConfig - key/value pairs of customized configuration that overrides default ones.
|
|
1705
2015
|
*
|
|
1706
2016
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1707
|
-
*
|
|
1708
|
-
* @beta
|
|
1709
2017
|
*/
|
|
1710
|
-
constructor(identityType?: IdentityType, customConfig?: Record<string, string>);
|
|
2018
|
+
constructor(identityType?: IdentityType, customConfig?: Record<string, string> | AuthenticationConfiguration);
|
|
1711
2019
|
/**
|
|
1712
2020
|
* Identity type set by user.
|
|
1713
2021
|
*
|
|
1714
2022
|
* @returns identity type.
|
|
1715
|
-
* @beta
|
|
1716
2023
|
*/
|
|
1717
2024
|
getIdentityType(): IdentityType;
|
|
1718
2025
|
/**
|
|
@@ -1723,15 +2030,14 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1723
2030
|
* identity is chose, will return {@link AppCredential}.
|
|
1724
2031
|
*
|
|
1725
2032
|
* @returns instance implements TokenCredential interface.
|
|
1726
|
-
* @beta
|
|
1727
2033
|
*/
|
|
1728
2034
|
getCredential(): TokenCredential;
|
|
1729
2035
|
/**
|
|
1730
2036
|
* Get user information.
|
|
2037
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1731
2038
|
* @returns UserInfo object.
|
|
1732
|
-
* @beta
|
|
1733
2039
|
*/
|
|
1734
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2040
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1735
2041
|
/**
|
|
1736
2042
|
* Popup login page to get user's access token with specific scopes.
|
|
1737
2043
|
*
|
|
@@ -1746,40 +2052,35 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1746
2052
|
* await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
|
|
1747
2053
|
* ```
|
|
1748
2054
|
* @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
|
|
2055
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1749
2056
|
*
|
|
1750
2057
|
* @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
|
|
1751
2058
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1752
2059
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1753
2060
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1754
|
-
*
|
|
1755
|
-
* @beta
|
|
1756
2061
|
*/
|
|
1757
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2062
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1758
2063
|
/**
|
|
1759
2064
|
* Set SSO token when using user identity in NodeJS.
|
|
1760
2065
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1761
2066
|
* @returns self instance.
|
|
1762
|
-
* @beta
|
|
1763
2067
|
*/
|
|
1764
2068
|
setSsoToken(ssoToken: string): TeamsFx;
|
|
1765
2069
|
/**
|
|
1766
2070
|
* Usually used by service plugins to retrieve specific config
|
|
1767
2071
|
* @param {string} key - configuration key.
|
|
1768
2072
|
* @returns value in configuration.
|
|
1769
|
-
* @beta
|
|
1770
2073
|
*/
|
|
1771
2074
|
getConfig(key: string): string;
|
|
1772
2075
|
/**
|
|
1773
2076
|
* Check the value of specific key.
|
|
1774
2077
|
* @param {string} key - configuration key.
|
|
1775
2078
|
* @returns true if corresponding value is not empty string.
|
|
1776
|
-
* @beta
|
|
1777
2079
|
*/
|
|
1778
2080
|
hasConfig(key: string): boolean;
|
|
1779
2081
|
/**
|
|
1780
2082
|
* Get all configurations.
|
|
1781
2083
|
* @returns key value mappings.
|
|
1782
|
-
* @beta
|
|
1783
2084
|
*/
|
|
1784
2085
|
getConfigs(): Record<string, string>;
|
|
1785
2086
|
/**
|
|
@@ -1788,10 +2089,49 @@ export declare class TeamsFx implements TeamsFxConfiguration {
|
|
|
1788
2089
|
private loadFromEnv;
|
|
1789
2090
|
}
|
|
1790
2091
|
|
|
2092
|
+
/**
|
|
2093
|
+
* Interface for adaptive card action handler that can process card action invoke and return a response.
|
|
2094
|
+
*/
|
|
2095
|
+
export declare interface TeamsFxAdaptiveCardActionHandler {
|
|
2096
|
+
/**
|
|
2097
|
+
* The verb defined in adaptive card action that can trigger this handler.
|
|
2098
|
+
* The verb string here is case-insensitive.
|
|
2099
|
+
*/
|
|
2100
|
+
triggerVerb: string;
|
|
2101
|
+
/**
|
|
2102
|
+
* Specify the behavior for how the card response will be sent in Teams conversation.
|
|
2103
|
+
* The default value is `AdaptiveCardResponse.ReplaceForInteractor`, which means the card
|
|
2104
|
+
* response will replace the current one only for the interactor.
|
|
2105
|
+
*/
|
|
2106
|
+
adaptiveCardResponse?: AdaptiveCardResponse;
|
|
2107
|
+
/**
|
|
2108
|
+
* The handler function that will be invoked when the action is fired.
|
|
2109
|
+
* @param context The turn context.
|
|
2110
|
+
* @param actionData The contextual data that associated with the action.
|
|
2111
|
+
*
|
|
2112
|
+
* @returns A `Promise` representing a invoke response for the adaptive card invoke action.
|
|
2113
|
+
* You can use the `InvokeResponseFactory` utility class to create an invoke response from
|
|
2114
|
+
* - A text message:
|
|
2115
|
+
* ```typescript
|
|
2116
|
+
* return InvokeResponseFactory.textMessage("Action is processed successfully!");
|
|
2117
|
+
* ```
|
|
2118
|
+
* - An adaptive card:
|
|
2119
|
+
* ```typescript
|
|
2120
|
+
* const responseCard = AdaptiveCards.declare(helloWorldCard).render(actionData);
|
|
2121
|
+
return InvokeResponseFactory.adaptiveCard(responseCard);
|
|
2122
|
+
* ```
|
|
2123
|
+
* - An error response:
|
|
2124
|
+
* ```typescript
|
|
2125
|
+
* return InvokeResponseFactory.errorResponse(InvokeResponseErrorCode.BadRequest, "Invalid request");
|
|
2126
|
+
* ```
|
|
2127
|
+
*
|
|
2128
|
+
* @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.
|
|
2129
|
+
*/
|
|
2130
|
+
handleActionInvoked(context: TurnContext, actionData: any): Promise<InvokeResponse>;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
1791
2133
|
/**
|
|
1792
2134
|
* Interface for a command handler that can process command to a TeamsFx bot and return a response.
|
|
1793
|
-
*
|
|
1794
|
-
* @beta
|
|
1795
2135
|
*/
|
|
1796
2136
|
export declare interface TeamsFxBotCommandHandler {
|
|
1797
2137
|
/**
|
|
@@ -1809,16 +2149,34 @@ export declare interface TeamsFxBotCommandHandler {
|
|
|
1809
2149
|
handleCommandReceived(context: TurnContext, message: CommandMessage): Promise<string | Partial<Activity> | void>;
|
|
1810
2150
|
}
|
|
1811
2151
|
|
|
2152
|
+
/**
|
|
2153
|
+
* Interface for a command handler that can process sso command to a TeamsFx bot and return a response.
|
|
2154
|
+
*/
|
|
2155
|
+
export declare interface TeamsFxBotSsoCommandHandler {
|
|
2156
|
+
/**
|
|
2157
|
+
* The string or regular expression patterns that can trigger this handler.
|
|
2158
|
+
*/
|
|
2159
|
+
triggerPatterns: TriggerPatterns;
|
|
2160
|
+
/**
|
|
2161
|
+
* Handles a bot command received activity.
|
|
2162
|
+
*
|
|
2163
|
+
* @param context The bot context.
|
|
2164
|
+
* @param message The command message the user types from Teams.
|
|
2165
|
+
* @param tokenResponse The tokenResponse which contains sso token that can be used to exchange access token for the bot.
|
|
2166
|
+
* @returns A `Promise` representing an activity or text to send as the command response.
|
|
2167
|
+
* Or no return value if developers want to send the response activity by themselves in this method.
|
|
2168
|
+
*/
|
|
2169
|
+
handleCommandReceived(context: TurnContext, message: CommandMessage, tokenResponse: TeamsBotSsoPromptTokenResponse): Promise<string | Partial<Activity> | void>;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
1812
2172
|
/**
|
|
1813
2173
|
* TeamsFx interface that provides credential and configuration.
|
|
1814
|
-
* @beta
|
|
1815
2174
|
*/
|
|
1816
2175
|
declare interface TeamsFxConfiguration {
|
|
1817
2176
|
/**
|
|
1818
2177
|
* Identity type set by user.
|
|
1819
2178
|
*
|
|
1820
2179
|
* @returns identity type.
|
|
1821
|
-
* @beta
|
|
1822
2180
|
*/
|
|
1823
2181
|
getIdentityType(): IdentityType;
|
|
1824
2182
|
/**
|
|
@@ -1829,15 +2187,14 @@ declare interface TeamsFxConfiguration {
|
|
|
1829
2187
|
* identity is chose, will return {@link AppCredential}.
|
|
1830
2188
|
*
|
|
1831
2189
|
* @returns instance implements TokenCredential interface.
|
|
1832
|
-
* @beta
|
|
1833
2190
|
*/
|
|
1834
2191
|
getCredential(): TokenCredential;
|
|
1835
2192
|
/**
|
|
1836
2193
|
* Get user information.
|
|
2194
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1837
2195
|
* @returns UserInfo object.
|
|
1838
|
-
* @beta
|
|
1839
2196
|
*/
|
|
1840
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2197
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1841
2198
|
/**
|
|
1842
2199
|
* Popup login page to get user's access token with specific scopes.
|
|
1843
2200
|
*
|
|
@@ -1852,40 +2209,35 @@ declare interface TeamsFxConfiguration {
|
|
|
1852
2209
|
* await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
|
|
1853
2210
|
* ```
|
|
1854
2211
|
* @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
|
|
2212
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
1855
2213
|
*
|
|
1856
2214
|
* @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
|
|
1857
2215
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1858
2216
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1859
2217
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1860
|
-
*
|
|
1861
|
-
* @beta
|
|
1862
2218
|
*/
|
|
1863
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2219
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1864
2220
|
/**
|
|
1865
2221
|
* Set SSO token when using user identity in NodeJS.
|
|
1866
2222
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1867
2223
|
* @returns self instance.
|
|
1868
|
-
* @beta
|
|
1869
2224
|
*/
|
|
1870
2225
|
setSsoToken(ssoToken: string): TeamsFxConfiguration;
|
|
1871
2226
|
/**
|
|
1872
2227
|
* Usually used by service plugins to retrieve specific config
|
|
1873
2228
|
* @param {string} key - configuration key.
|
|
1874
2229
|
* @returns value in configuration.
|
|
1875
|
-
* @beta
|
|
1876
2230
|
*/
|
|
1877
2231
|
getConfig(key: string): string;
|
|
1878
2232
|
/**
|
|
1879
2233
|
* Check the value of specific key.
|
|
1880
2234
|
* @param {string} key - configuration key.
|
|
1881
2235
|
* @returns true if corresponding value is not empty string.
|
|
1882
|
-
* @beta
|
|
1883
2236
|
*/
|
|
1884
2237
|
hasConfig(key: string): boolean;
|
|
1885
2238
|
/**
|
|
1886
2239
|
* Get all configurations.
|
|
1887
2240
|
* @returns key value mappings.
|
|
1888
|
-
* @beta
|
|
1889
2241
|
*/
|
|
1890
2242
|
getConfigs(): Record<string, string>;
|
|
1891
2243
|
}
|
|
@@ -1895,38 +2247,38 @@ declare interface TeamsFxConfiguration {
|
|
|
1895
2247
|
*
|
|
1896
2248
|
* @remarks
|
|
1897
2249
|
* Can only be used within Teams.
|
|
1898
|
-
*
|
|
1899
|
-
* @beta
|
|
1900
2250
|
*/
|
|
1901
2251
|
export declare class TeamsUserCredential implements TokenCredential {
|
|
1902
2252
|
/**
|
|
1903
2253
|
* Constructor of TeamsUserCredential.
|
|
1904
2254
|
* @remarks
|
|
1905
2255
|
* Can only be used within Teams.
|
|
1906
|
-
* @beta
|
|
1907
2256
|
*/
|
|
1908
2257
|
constructor(authConfig: AuthenticationConfiguration);
|
|
1909
2258
|
/**
|
|
1910
2259
|
* Popup login page to get user's access token with specific scopes.
|
|
2260
|
+
*
|
|
2261
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
2262
|
+
*
|
|
1911
2263
|
* @remarks
|
|
1912
2264
|
* Can only be used within Teams.
|
|
1913
|
-
* @beta
|
|
1914
2265
|
*/
|
|
1915
|
-
login(scopes: string | string[]): Promise<void>;
|
|
2266
|
+
login(scopes: string | string[], resources?: string[]): Promise<void>;
|
|
1916
2267
|
/**
|
|
1917
2268
|
* Get access token from credential.
|
|
1918
2269
|
* @remarks
|
|
1919
2270
|
* Can only be used within Teams.
|
|
1920
|
-
* @beta
|
|
1921
2271
|
*/
|
|
1922
2272
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
1923
2273
|
/**
|
|
1924
2274
|
* Get basic user info from SSO token
|
|
2275
|
+
*
|
|
2276
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
2277
|
+
*
|
|
1925
2278
|
* @remarks
|
|
1926
2279
|
* Can only be used within Teams.
|
|
1927
|
-
* @beta
|
|
1928
2280
|
*/
|
|
1929
|
-
getUserInfo(): Promise<UserInfo>;
|
|
2281
|
+
getUserInfo(resources?: string[]): Promise<UserInfo>;
|
|
1930
2282
|
}
|
|
1931
2283
|
|
|
1932
2284
|
/**
|
|
@@ -1936,8 +2288,6 @@ export declare type TriggerPatterns = string | RegExp | (string | RegExp)[];
|
|
|
1936
2288
|
|
|
1937
2289
|
/**
|
|
1938
2290
|
* UserInfo with user displayName, objectId and preferredUserName.
|
|
1939
|
-
*
|
|
1940
|
-
* @beta
|
|
1941
2291
|
*/
|
|
1942
2292
|
export declare interface UserInfo {
|
|
1943
2293
|
/**
|
|
@@ -1952,6 +2302,12 @@ export declare interface UserInfo {
|
|
|
1952
2302
|
* @readonly
|
|
1953
2303
|
*/
|
|
1954
2304
|
objectId: string;
|
|
2305
|
+
/**
|
|
2306
|
+
* User tenant ID.
|
|
2307
|
+
*
|
|
2308
|
+
* @readonly
|
|
2309
|
+
*/
|
|
2310
|
+
tenantId: string;
|
|
1955
2311
|
/**
|
|
1956
2312
|
* Usually be the email address.
|
|
1957
2313
|
*
|