@microsoft/teamsfx 2.0.0-beta.0 → 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/index.esm2017.js +429 -229
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +1644 -549
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +447 -229
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1700 -547
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +9 -8
- package/types/teamsfx.d.ts +2197 -1648
- package/CHANGELOG.md +0 -28
- package/NOTICE.txt +0 -9242
package/dist/index.esm5.js
CHANGED
|
@@ -9,7 +9,6 @@ import axios from 'axios';
|
|
|
9
9
|
// Licensed under the MIT license.
|
|
10
10
|
/**
|
|
11
11
|
* Error code to trace the error types.
|
|
12
|
-
* @beta
|
|
13
12
|
*/
|
|
14
13
|
var ErrorCode;
|
|
15
14
|
(function (ErrorCode) {
|
|
@@ -33,6 +32,30 @@ var ErrorCode;
|
|
|
33
32
|
* Channel is not supported error.
|
|
34
33
|
*/
|
|
35
34
|
ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
|
|
35
|
+
/**
|
|
36
|
+
* Failed to retrieve sso token
|
|
37
|
+
*/
|
|
38
|
+
ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
|
|
39
|
+
/**
|
|
40
|
+
* Failed to process sso handler
|
|
41
|
+
*/
|
|
42
|
+
ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
|
|
43
|
+
/**
|
|
44
|
+
* Cannot find command
|
|
45
|
+
*/
|
|
46
|
+
ErrorCode["CannotFindCommand"] = "CannotFindCommand";
|
|
47
|
+
/**
|
|
48
|
+
* Failed to run sso step
|
|
49
|
+
*/
|
|
50
|
+
ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
|
|
51
|
+
/**
|
|
52
|
+
* Failed to run dedup step
|
|
53
|
+
*/
|
|
54
|
+
ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
|
|
55
|
+
/**
|
|
56
|
+
* Sso activity handler is undefined
|
|
57
|
+
*/
|
|
58
|
+
ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
|
|
36
59
|
/**
|
|
37
60
|
* Runtime is not supported error.
|
|
38
61
|
*/
|
|
@@ -88,6 +111,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
|
|
|
88
111
|
ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
|
|
89
112
|
// ChannelNotSupported Error
|
|
90
113
|
ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
|
|
114
|
+
ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
|
|
115
|
+
// FailedToRetrieveSsoToken Error
|
|
116
|
+
ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
|
|
117
|
+
// CannotFindCommand Error
|
|
118
|
+
ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
|
|
119
|
+
ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
|
|
120
|
+
ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
|
|
121
|
+
// SsoActivityHandlerIsUndefined Error
|
|
122
|
+
ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
|
|
91
123
|
// IdentityTypeNotSupported Error
|
|
92
124
|
ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
|
|
93
125
|
// AuthorizationInfoError
|
|
@@ -98,10 +130,9 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
|
|
|
98
130
|
ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
|
|
99
131
|
ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
|
|
100
132
|
ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
|
|
133
|
+
ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
|
|
101
134
|
/**
|
|
102
135
|
* Error class with code and message thrown by the SDK.
|
|
103
|
-
*
|
|
104
|
-
* @beta
|
|
105
136
|
*/
|
|
106
137
|
class ErrorWithCode extends Error {
|
|
107
138
|
/**
|
|
@@ -109,8 +140,6 @@ class ErrorWithCode extends Error {
|
|
|
109
140
|
*
|
|
110
141
|
* @param {string} message - error message.
|
|
111
142
|
* @param {ErrorCode} code - error code.
|
|
112
|
-
*
|
|
113
|
-
* @beta
|
|
114
143
|
*/
|
|
115
144
|
constructor(message, code) {
|
|
116
145
|
if (!code) {
|
|
@@ -128,8 +157,6 @@ class ErrorWithCode extends Error {
|
|
|
128
157
|
// Licensed under the MIT license.
|
|
129
158
|
/**
|
|
130
159
|
* Log level.
|
|
131
|
-
*
|
|
132
|
-
* @beta
|
|
133
160
|
*/
|
|
134
161
|
var LogLevel;
|
|
135
162
|
(function (LogLevel) {
|
|
@@ -154,8 +181,6 @@ var LogLevel;
|
|
|
154
181
|
* Update log level helper.
|
|
155
182
|
*
|
|
156
183
|
* @param { LogLevel } level - log level in configuration
|
|
157
|
-
*
|
|
158
|
-
* @beta
|
|
159
184
|
*/
|
|
160
185
|
function setLogLevel(level) {
|
|
161
186
|
internalLogger.level = level;
|
|
@@ -164,8 +189,6 @@ function setLogLevel(level) {
|
|
|
164
189
|
* Get log level.
|
|
165
190
|
*
|
|
166
191
|
* @returns Log level
|
|
167
|
-
*
|
|
168
|
-
* @beta
|
|
169
192
|
*/
|
|
170
193
|
function getLogLevel() {
|
|
171
194
|
return internalLogger.level;
|
|
@@ -240,8 +263,6 @@ const internalLogger = new InternalLogger();
|
|
|
240
263
|
* error: console.error,
|
|
241
264
|
* });
|
|
242
265
|
* ```
|
|
243
|
-
*
|
|
244
|
-
* @beta
|
|
245
266
|
*/
|
|
246
267
|
function setLogger(logger) {
|
|
247
268
|
internalLogger.customLogger = logger;
|
|
@@ -259,8 +280,6 @@ function setLogger(logger) {
|
|
|
259
280
|
* }
|
|
260
281
|
* });
|
|
261
282
|
* ```
|
|
262
|
-
*
|
|
263
|
-
* @beta
|
|
264
283
|
*/
|
|
265
284
|
function setLogFunction(logFunction) {
|
|
266
285
|
internalLogger.customLogFunction = logFunction;
|
|
@@ -303,6 +322,7 @@ function getUserInfoFromSsoToken(ssoToken) {
|
|
|
303
322
|
const userInfo = {
|
|
304
323
|
displayName: tokenObject.name,
|
|
305
324
|
objectId: tokenObject.oid,
|
|
325
|
+
tenantId: tokenObject.tid,
|
|
306
326
|
preferredUserName: "",
|
|
307
327
|
};
|
|
308
328
|
if (tokenObject.ver === "2.0") {
|
|
@@ -411,17 +431,8 @@ function validateScopesType(value) {
|
|
|
411
431
|
*
|
|
412
432
|
* @remarks
|
|
413
433
|
* Only works in in server side.
|
|
414
|
-
*
|
|
415
|
-
* @beta
|
|
416
434
|
*/
|
|
417
435
|
class AppCredential {
|
|
418
|
-
/**
|
|
419
|
-
* Constructor of AppCredential.
|
|
420
|
-
*
|
|
421
|
-
* @remarks
|
|
422
|
-
* Only works in in server side.
|
|
423
|
-
* @beta
|
|
424
|
-
*/
|
|
425
436
|
constructor(authConfig) {
|
|
426
437
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
|
|
427
438
|
}
|
|
@@ -430,7 +441,6 @@ class AppCredential {
|
|
|
430
441
|
*
|
|
431
442
|
* @remarks
|
|
432
443
|
* Only works in in server side.
|
|
433
|
-
* @beta
|
|
434
444
|
*/
|
|
435
445
|
getToken(scopes, options) {
|
|
436
446
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -445,17 +455,8 @@ class AppCredential {
|
|
|
445
455
|
*
|
|
446
456
|
* @remarks
|
|
447
457
|
* Can only be used in server side.
|
|
448
|
-
*
|
|
449
|
-
* @beta
|
|
450
458
|
*/
|
|
451
459
|
class OnBehalfOfUserCredential {
|
|
452
|
-
/**
|
|
453
|
-
* Constructor of OnBehalfOfUserCredential
|
|
454
|
-
*
|
|
455
|
-
* @remarks
|
|
456
|
-
* Can Only works in in server side.
|
|
457
|
-
* @beta
|
|
458
|
-
*/
|
|
459
460
|
constructor(ssoToken, config) {
|
|
460
461
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
461
462
|
}
|
|
@@ -463,7 +464,6 @@ class OnBehalfOfUserCredential {
|
|
|
463
464
|
* Get access token from credential.
|
|
464
465
|
* @remarks
|
|
465
466
|
* Can only be used in server side.
|
|
466
|
-
* @beta
|
|
467
467
|
*/
|
|
468
468
|
getToken(scopes, options) {
|
|
469
469
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -474,7 +474,6 @@ class OnBehalfOfUserCredential {
|
|
|
474
474
|
* Get basic user info from SSO token.
|
|
475
475
|
* @remarks
|
|
476
476
|
* Can only be used in server side.
|
|
477
|
-
* @beta
|
|
478
477
|
*/
|
|
479
478
|
getUserInfo() {
|
|
480
479
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
@@ -490,34 +489,8 @@ const loginPageHeight = 535;
|
|
|
490
489
|
*
|
|
491
490
|
* @remarks
|
|
492
491
|
* Can only be used within Teams.
|
|
493
|
-
*
|
|
494
|
-
* @beta
|
|
495
492
|
*/
|
|
496
493
|
class TeamsUserCredential {
|
|
497
|
-
/**
|
|
498
|
-
* Constructor of TeamsUserCredential.
|
|
499
|
-
*
|
|
500
|
-
* @example
|
|
501
|
-
* ```typescript
|
|
502
|
-
* const config = {
|
|
503
|
-
* authentication: {
|
|
504
|
-
* initiateLoginEndpoint: "https://localhost:3000/auth-start.html",
|
|
505
|
-
* clientId: "xxx"
|
|
506
|
-
* }
|
|
507
|
-
* }
|
|
508
|
-
* // Use default configuration provided by Teams Toolkit
|
|
509
|
-
* const credential = new TeamsUserCredential();
|
|
510
|
-
* // Use a customized configuration
|
|
511
|
-
* const anotherCredential = new TeamsUserCredential(config);
|
|
512
|
-
* ```
|
|
513
|
-
*
|
|
514
|
-
* @param {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.
|
|
515
|
-
*
|
|
516
|
-
* @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.
|
|
517
|
-
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
518
|
-
*
|
|
519
|
-
* @beta
|
|
520
|
-
*/
|
|
521
494
|
constructor(authConfig) {
|
|
522
495
|
internalLogger.info("Create teams user credential");
|
|
523
496
|
this.config = this.loadAndValidateConfig(authConfig);
|
|
@@ -538,21 +511,20 @@ class TeamsUserCredential {
|
|
|
538
511
|
* await credential.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
|
|
539
512
|
* ```
|
|
540
513
|
* @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
|
|
514
|
+
* @param { string[] } resources - The optional list of resources for full trust Teams apps.
|
|
541
515
|
*
|
|
542
516
|
* @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
|
|
543
517
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
544
518
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
545
519
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
546
|
-
*
|
|
547
|
-
* @beta
|
|
548
520
|
*/
|
|
549
|
-
login(scopes) {
|
|
521
|
+
login(scopes, resources) {
|
|
550
522
|
return __awaiter(this, void 0, void 0, function* () {
|
|
551
523
|
validateScopesType(scopes);
|
|
552
524
|
const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
|
|
553
525
|
internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);
|
|
554
526
|
if (!this.initialized) {
|
|
555
|
-
yield this.init();
|
|
527
|
+
yield this.init(resources);
|
|
556
528
|
}
|
|
557
529
|
yield app.initialize();
|
|
558
530
|
let result;
|
|
@@ -602,6 +574,9 @@ class TeamsUserCredential {
|
|
|
602
574
|
* Get access token from credential.
|
|
603
575
|
*
|
|
604
576
|
* Important: Access tokens are stored in sessionStorage, read more here: https://aka.ms/teamsfx-session-storage-notice
|
|
577
|
+
* Important: Full trust applications do not read the resource information from the webApplicationInfo section of the app
|
|
578
|
+
* manifest. Instead, this resource (along with any additional resources from which to request tokens) must be provided
|
|
579
|
+
* as a list of resources to the getToken() method through a GetTeamsUserTokenOptions object.
|
|
605
580
|
*
|
|
606
581
|
* @example
|
|
607
582
|
* ```typescript
|
|
@@ -615,6 +590,9 @@ class TeamsUserCredential {
|
|
|
615
590
|
* await credential.getToken("User.Read Application.Read.All") // Get Graph access token for multiple scopes using space-separated string
|
|
616
591
|
* await credential.getToken("https://graph.microsoft.com/User.Read") // Get Graph access token with full resource URI
|
|
617
592
|
* await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
|
|
593
|
+
*
|
|
594
|
+
* const options: GetTeamsUserTokenOptions = { resources: ["https://domain.example.com"] }; // set up resources for full trust apps.
|
|
595
|
+
* await credential.getToken([], options) // Get sso token from teams client - only use this approach for full trust apps.
|
|
618
596
|
* ```
|
|
619
597
|
*
|
|
620
598
|
* @param {string | string[]} scopes - The list of scopes for which the token will have access.
|
|
@@ -629,13 +607,13 @@ class TeamsUserCredential {
|
|
|
629
607
|
* If scopes is empty string or array, it returns SSO token.
|
|
630
608
|
* If scopes is non-empty, it returns access token for target scope.
|
|
631
609
|
* Throw error if get access token failed.
|
|
632
|
-
*
|
|
633
|
-
* @beta
|
|
634
610
|
*/
|
|
635
611
|
getToken(scopes, options) {
|
|
612
|
+
var _a;
|
|
636
613
|
return __awaiter(this, void 0, void 0, function* () {
|
|
637
614
|
validateScopesType(scopes);
|
|
638
|
-
const
|
|
615
|
+
const resources = (_a = options) === null || _a === void 0 ? void 0 : _a.resources;
|
|
616
|
+
const ssoToken = yield this.getSSOToken(resources);
|
|
639
617
|
const scopeStr = typeof scopes === "string" ? scopes : scopes.join(" ");
|
|
640
618
|
if (scopeStr === "") {
|
|
641
619
|
internalLogger.info("Get SSO token");
|
|
@@ -644,7 +622,7 @@ class TeamsUserCredential {
|
|
|
644
622
|
else {
|
|
645
623
|
internalLogger.info("Get access token with scopes: " + scopeStr);
|
|
646
624
|
if (!this.initialized) {
|
|
647
|
-
yield this.init();
|
|
625
|
+
yield this.init(resources);
|
|
648
626
|
}
|
|
649
627
|
let tokenResponse;
|
|
650
628
|
const scopesArray = typeof scopes === "string" ? scopes.split(" ") : scopes;
|
|
@@ -691,6 +669,8 @@ class TeamsUserCredential {
|
|
|
691
669
|
/**
|
|
692
670
|
* Get basic user info from SSO token
|
|
693
671
|
*
|
|
672
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
673
|
+
*
|
|
694
674
|
* @example
|
|
695
675
|
* ```typescript
|
|
696
676
|
* const currentUser = await credential.getUserInfo();
|
|
@@ -701,19 +681,17 @@ class TeamsUserCredential {
|
|
|
701
681
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
702
682
|
*
|
|
703
683
|
* @returns Basic user info with user displayName, objectId and preferredUserName.
|
|
704
|
-
*
|
|
705
|
-
* @beta
|
|
706
684
|
*/
|
|
707
|
-
getUserInfo() {
|
|
685
|
+
getUserInfo(resources) {
|
|
708
686
|
return __awaiter(this, void 0, void 0, function* () {
|
|
709
687
|
internalLogger.info("Get basic user info from SSO token");
|
|
710
|
-
const ssoToken = yield this.getSSOToken();
|
|
688
|
+
const ssoToken = yield this.getSSOToken(resources);
|
|
711
689
|
return getUserInfoFromSsoToken(ssoToken.token);
|
|
712
690
|
});
|
|
713
691
|
}
|
|
714
|
-
init() {
|
|
692
|
+
init(resources) {
|
|
715
693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
716
|
-
const ssoToken = yield this.getSSOToken();
|
|
694
|
+
const ssoToken = yield this.getSSOToken(resources);
|
|
717
695
|
const info = getTenantIdAndLoginHintFromSsoToken(ssoToken.token);
|
|
718
696
|
this.loginHint = info.loginHint;
|
|
719
697
|
this.tid = info.tid;
|
|
@@ -733,9 +711,12 @@ class TeamsUserCredential {
|
|
|
733
711
|
/**
|
|
734
712
|
* Get SSO token using teams SDK
|
|
735
713
|
* It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token
|
|
714
|
+
*
|
|
715
|
+
* @param {string[]} resources - The optional list of resources for full trust Teams apps.
|
|
716
|
+
*
|
|
736
717
|
* @returns SSO token
|
|
737
718
|
*/
|
|
738
|
-
getSSOToken() {
|
|
719
|
+
getSSOToken(resources) {
|
|
739
720
|
return __awaiter(this, void 0, void 0, function* () {
|
|
740
721
|
if (this.ssoToken) {
|
|
741
722
|
if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {
|
|
@@ -743,10 +724,17 @@ class TeamsUserCredential {
|
|
|
743
724
|
return this.ssoToken;
|
|
744
725
|
}
|
|
745
726
|
}
|
|
746
|
-
const params = {};
|
|
727
|
+
const params = { resources: resources !== null && resources !== void 0 ? resources : [] };
|
|
747
728
|
let token;
|
|
748
729
|
try {
|
|
749
730
|
yield app.initialize();
|
|
731
|
+
}
|
|
732
|
+
catch (err) {
|
|
733
|
+
const errorMsg = "Initialize teams sdk failed due to not running inside Teams environment";
|
|
734
|
+
internalLogger.error(errorMsg);
|
|
735
|
+
throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);
|
|
736
|
+
}
|
|
737
|
+
try {
|
|
750
738
|
token = yield authentication.getAuthToken(params);
|
|
751
739
|
}
|
|
752
740
|
catch (err) {
|
|
@@ -811,40 +799,16 @@ class TeamsUserCredential {
|
|
|
811
799
|
throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);
|
|
812
800
|
}
|
|
813
801
|
}
|
|
814
|
-
// Come from here: https://github.com/wictorwilen/msteams-react-base-component/blob/master/src/useTeams.ts
|
|
815
|
-
checkInTeams() {
|
|
816
|
-
if ((window.parent === window.self && window.nativeInterface) ||
|
|
817
|
-
window.navigator.userAgent.includes("Teams/") ||
|
|
818
|
-
window.name === "embedded-page-container" ||
|
|
819
|
-
window.name === "extension-tab-frame") {
|
|
820
|
-
return true;
|
|
821
|
-
}
|
|
822
|
-
return false;
|
|
823
|
-
}
|
|
824
802
|
}
|
|
825
803
|
|
|
826
804
|
// Copyright (c) Microsoft Corporation.
|
|
827
805
|
const defaultScope = "https://graph.microsoft.com/.default";
|
|
828
806
|
/**
|
|
829
807
|
* Microsoft Graph auth provider for Teams Framework
|
|
830
|
-
*
|
|
831
|
-
* @beta
|
|
832
808
|
*/
|
|
833
809
|
class MsGraphAuthProvider {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
*
|
|
837
|
-
* @param {TeamsFx} teamsfx - Used to provide configuration and auth.
|
|
838
|
-
* @param {string | string[]} scopes - The list of scopes for which the token will have access.
|
|
839
|
-
*
|
|
840
|
-
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
841
|
-
*
|
|
842
|
-
* @returns An instance of MsGraphAuthProvider.
|
|
843
|
-
*
|
|
844
|
-
* @beta
|
|
845
|
-
*/
|
|
846
|
-
constructor(teamsfx, scopes) {
|
|
847
|
-
this.teamsfx = teamsfx;
|
|
810
|
+
constructor(credentialOrTeamsFx, scopes) {
|
|
811
|
+
this.credentialOrTeamsFx = credentialOrTeamsFx;
|
|
848
812
|
let scopesStr = defaultScope;
|
|
849
813
|
if (scopes) {
|
|
850
814
|
validateScopesType(scopes);
|
|
@@ -871,7 +835,15 @@ class MsGraphAuthProvider {
|
|
|
871
835
|
getAccessToken() {
|
|
872
836
|
return __awaiter(this, void 0, void 0, function* () {
|
|
873
837
|
internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);
|
|
874
|
-
|
|
838
|
+
let accessToken;
|
|
839
|
+
if (this.credentialOrTeamsFx.getCredential) {
|
|
840
|
+
accessToken = yield this.credentialOrTeamsFx
|
|
841
|
+
.getCredential()
|
|
842
|
+
.getToken(this.scopes);
|
|
843
|
+
}
|
|
844
|
+
else {
|
|
845
|
+
accessToken = yield this.credentialOrTeamsFx.getToken(this.scopes);
|
|
846
|
+
}
|
|
875
847
|
return new Promise((resolve, reject) => {
|
|
876
848
|
if (accessToken) {
|
|
877
849
|
resolve(accessToken.token);
|
|
@@ -889,7 +861,6 @@ class MsGraphAuthProvider {
|
|
|
889
861
|
// Copyright (c) Microsoft Corporation.
|
|
890
862
|
/**
|
|
891
863
|
* Get Microsoft graph client.
|
|
892
|
-
*
|
|
893
864
|
* @example
|
|
894
865
|
* Get Microsoft graph client by TokenCredential
|
|
895
866
|
* ```typescript
|
|
@@ -935,8 +906,6 @@ class MsGraphAuthProvider {
|
|
|
935
906
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
936
907
|
*
|
|
937
908
|
* @returns Graph client with specified scopes.
|
|
938
|
-
*
|
|
939
|
-
* @beta
|
|
940
909
|
*/
|
|
941
910
|
function createMicrosoftGraphClient(teamsfx, scopes) {
|
|
942
911
|
internalLogger.info("Create Microsoft Graph Client");
|
|
@@ -945,14 +914,76 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
|
|
|
945
914
|
authProvider,
|
|
946
915
|
});
|
|
947
916
|
return graphClient;
|
|
917
|
+
}
|
|
918
|
+
// eslint-disable-next-line no-secrets/no-secrets
|
|
919
|
+
/**
|
|
920
|
+
* Get Microsoft graph client.
|
|
921
|
+
* @example
|
|
922
|
+
* Get Microsoft graph client by TokenCredential
|
|
923
|
+
* ```typescript
|
|
924
|
+
* // In browser: TeamsUserCredential
|
|
925
|
+
* const authConfig: TeamsUserCredentialAuthConfig = {
|
|
926
|
+
* clientId: "xxx",
|
|
927
|
+
initiateLoginEndpoint: "https://xxx/auth-start.html",
|
|
928
|
+
* };
|
|
929
|
+
|
|
930
|
+
* const credential = new TeamsUserCredential(authConfig);
|
|
931
|
+
|
|
932
|
+
* const scope = "User.Read";
|
|
933
|
+
* await credential.login(scope);
|
|
934
|
+
|
|
935
|
+
* const client = createMicrosoftGraphClientWithCredential(credential, scope);
|
|
936
|
+
|
|
937
|
+
* // In node: OnBehalfOfUserCredential
|
|
938
|
+
* const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {
|
|
939
|
+
* authorityHost: "xxx",
|
|
940
|
+
* clientId: "xxx",
|
|
941
|
+
* tenantId: "xxx",
|
|
942
|
+
* clientSecret: "xxx",
|
|
943
|
+
* };
|
|
944
|
+
|
|
945
|
+
* const oboCredential = new OnBehalfOfUserCredential(ssoToken, oboAuthConfig);
|
|
946
|
+
* const scope = "User.Read";
|
|
947
|
+
* const client = createMicrosoftGraphClientWithCredential(oboCredential, scope);
|
|
948
|
+
|
|
949
|
+
* // In node: AppCredential
|
|
950
|
+
* const appAuthConfig: AppCredentialAuthConfig = {
|
|
951
|
+
* authorityHost: "xxx",
|
|
952
|
+
* clientId: "xxx",
|
|
953
|
+
* tenantId: "xxx",
|
|
954
|
+
* clientSecret: "xxx",
|
|
955
|
+
* };
|
|
956
|
+
* const appCredential = new AppCredential(appAuthConfig);
|
|
957
|
+
* const scope = "User.Read";
|
|
958
|
+
* const client = createMicrosoftGraphClientWithCredential(appCredential, scope);
|
|
959
|
+
*
|
|
960
|
+
* const profile = await client.api("/me").get();
|
|
961
|
+
* ```
|
|
962
|
+
*
|
|
963
|
+
* @param {TokenCredential} credential - Used to provide configuration and auth.
|
|
964
|
+
* @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.
|
|
965
|
+
*
|
|
966
|
+
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
967
|
+
*
|
|
968
|
+
* @returns Graph client with specified scopes.
|
|
969
|
+
*/
|
|
970
|
+
function createMicrosoftGraphClientWithCredential(credential, scopes) {
|
|
971
|
+
internalLogger.info("Create Microsoft Graph Client");
|
|
972
|
+
const authProvider = new MsGraphAuthProvider(credential, scopes);
|
|
973
|
+
const graphClient = Client.initWithMiddleware({
|
|
974
|
+
authProvider,
|
|
975
|
+
});
|
|
976
|
+
return graphClient;
|
|
948
977
|
}
|
|
949
978
|
|
|
950
979
|
// Copyright (c) Microsoft Corporation.
|
|
951
980
|
/**
|
|
952
981
|
* Generate connection configuration consumed by tedious.
|
|
982
|
+
*
|
|
983
|
+
* @deprecated we recommend you compose your own Tedious configuration for better flexibility.
|
|
984
|
+
*
|
|
953
985
|
* @remarks
|
|
954
986
|
* Only works in in server side.
|
|
955
|
-
* @beta
|
|
956
987
|
*/
|
|
957
988
|
function getTediousConnectionConfig(teamsfx, databaseName) {
|
|
958
989
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1008,8 +1039,6 @@ function getTediousConnectionConfig(teamsfx, databaseName) {
|
|
|
1008
1039
|
* }
|
|
1009
1040
|
* ]));
|
|
1010
1041
|
* ```
|
|
1011
|
-
*
|
|
1012
|
-
* @beta
|
|
1013
1042
|
*/
|
|
1014
1043
|
class TeamsBotSsoPrompt {
|
|
1015
1044
|
/**
|
|
@@ -1020,8 +1049,6 @@ class TeamsBotSsoPrompt {
|
|
|
1020
1049
|
*
|
|
1021
1050
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1022
1051
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1023
|
-
*
|
|
1024
|
-
* @beta
|
|
1025
1052
|
*/
|
|
1026
1053
|
constructor(teamsfx, dialogId, settings) {
|
|
1027
1054
|
this.teamsfx = teamsfx;
|
|
@@ -1041,8 +1068,6 @@ class TeamsBotSsoPrompt {
|
|
|
1041
1068
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1042
1069
|
*
|
|
1043
1070
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1044
|
-
*
|
|
1045
|
-
* @beta
|
|
1046
1071
|
*/
|
|
1047
1072
|
beginDialog(dc) {
|
|
1048
1073
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1064,8 +1089,6 @@ class TeamsBotSsoPrompt {
|
|
|
1064
1089
|
*
|
|
1065
1090
|
* @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
|
|
1066
1091
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1067
|
-
*
|
|
1068
|
-
* @beta
|
|
1069
1092
|
*/
|
|
1070
1093
|
continueDialog(dc) {
|
|
1071
1094
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1086,8 +1109,6 @@ class TeamsBotSsoPrompt {
|
|
|
1086
1109
|
* ```typescript
|
|
1087
1110
|
* const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
|
|
1088
1111
|
* ```
|
|
1089
|
-
*
|
|
1090
|
-
* @beta
|
|
1091
1112
|
*/
|
|
1092
1113
|
function createApiClient(apiEndpoint, authProvider) {
|
|
1093
1114
|
// Add a request interceptor
|
|
@@ -1105,14 +1126,10 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1105
1126
|
// Copyright (c) Microsoft Corporation.
|
|
1106
1127
|
/**
|
|
1107
1128
|
* Provider that handles Bearer Token authentication
|
|
1108
|
-
*
|
|
1109
|
-
* @beta
|
|
1110
1129
|
*/
|
|
1111
1130
|
class BearerTokenAuthProvider {
|
|
1112
1131
|
/**
|
|
1113
1132
|
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
1114
|
-
*
|
|
1115
|
-
* @beta
|
|
1116
1133
|
*/
|
|
1117
1134
|
constructor(getToken) {
|
|
1118
1135
|
this.getToken = getToken;
|
|
@@ -1126,8 +1143,6 @@ class BearerTokenAuthProvider {
|
|
|
1126
1143
|
* @returns Updated axios request config.
|
|
1127
1144
|
*
|
|
1128
1145
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1129
|
-
*
|
|
1130
|
-
* @beta
|
|
1131
1146
|
*/
|
|
1132
1147
|
AddAuthenticationInfo(config) {
|
|
1133
1148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1147,8 +1162,6 @@ class BearerTokenAuthProvider {
|
|
|
1147
1162
|
// Copyright (c) Microsoft Corporation.
|
|
1148
1163
|
/**
|
|
1149
1164
|
* Provider that handles Basic authentication
|
|
1150
|
-
*
|
|
1151
|
-
* @beta
|
|
1152
1165
|
*/
|
|
1153
1166
|
class BasicAuthProvider {
|
|
1154
1167
|
/**
|
|
@@ -1158,8 +1171,6 @@ class BasicAuthProvider {
|
|
|
1158
1171
|
*
|
|
1159
1172
|
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
1160
1173
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1161
|
-
*
|
|
1162
|
-
* @beta
|
|
1163
1174
|
*/
|
|
1164
1175
|
constructor(userName, password) {
|
|
1165
1176
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1174,8 +1185,6 @@ class BasicAuthProvider {
|
|
|
1174
1185
|
*
|
|
1175
1186
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1176
1187
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1177
|
-
*
|
|
1178
|
-
* @beta
|
|
1179
1188
|
*/
|
|
1180
1189
|
AddAuthenticationInfo(config) {
|
|
1181
1190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1187,8 +1196,6 @@ class BasicAuthProvider {
|
|
|
1187
1196
|
// Copyright (c) Microsoft Corporation.
|
|
1188
1197
|
/**
|
|
1189
1198
|
* Provider that handles API Key authentication
|
|
1190
|
-
*
|
|
1191
|
-
* @beta
|
|
1192
1199
|
*/
|
|
1193
1200
|
class ApiKeyProvider {
|
|
1194
1201
|
/**
|
|
@@ -1199,8 +1206,6 @@ class ApiKeyProvider {
|
|
|
1199
1206
|
*
|
|
1200
1207
|
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
1201
1208
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1202
|
-
*
|
|
1203
|
-
* @beta
|
|
1204
1209
|
*/
|
|
1205
1210
|
constructor(keyName, keyValue, keyLocation) {
|
|
1206
1211
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1215,8 +1220,6 @@ class ApiKeyProvider {
|
|
|
1215
1220
|
*
|
|
1216
1221
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
1217
1222
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1218
|
-
*
|
|
1219
|
-
* @beta
|
|
1220
1223
|
*/
|
|
1221
1224
|
AddAuthenticationInfo(config) {
|
|
1222
1225
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1226,8 +1229,6 @@ class ApiKeyProvider {
|
|
|
1226
1229
|
}
|
|
1227
1230
|
/**
|
|
1228
1231
|
* Define available location for API Key location
|
|
1229
|
-
*
|
|
1230
|
-
* @beta
|
|
1231
1232
|
*/
|
|
1232
1233
|
var ApiKeyLocation;
|
|
1233
1234
|
(function (ApiKeyLocation) {
|
|
@@ -1244,15 +1245,11 @@ var ApiKeyLocation;
|
|
|
1244
1245
|
// Copyright (c) Microsoft Corporation.
|
|
1245
1246
|
/**
|
|
1246
1247
|
* Provider that handles Certificate authentication
|
|
1247
|
-
*
|
|
1248
|
-
* @beta
|
|
1249
1248
|
*/
|
|
1250
1249
|
class CertificateAuthProvider {
|
|
1251
1250
|
/**
|
|
1252
1251
|
*
|
|
1253
1252
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1254
|
-
*
|
|
1255
|
-
* @beta
|
|
1256
1253
|
*/
|
|
1257
1254
|
constructor(certOption) {
|
|
1258
1255
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1267,8 +1264,6 @@ class CertificateAuthProvider {
|
|
|
1267
1264
|
*
|
|
1268
1265
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1269
1266
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1270
|
-
*
|
|
1271
|
-
* @beta
|
|
1272
1267
|
*/
|
|
1273
1268
|
AddAuthenticationInfo(config) {
|
|
1274
1269
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1312,8 +1307,6 @@ function createPfxCertOption(pfx, options) {
|
|
|
1312
1307
|
// Licensed under the MIT license.
|
|
1313
1308
|
/**
|
|
1314
1309
|
* Identity type to use in authentication.
|
|
1315
|
-
*
|
|
1316
|
-
* @beta
|
|
1317
1310
|
*/
|
|
1318
1311
|
var IdentityType;
|
|
1319
1312
|
(function (IdentityType) {
|
|
@@ -1330,7 +1323,6 @@ var IdentityType;
|
|
|
1330
1323
|
// Copyright (c) Microsoft Corporation.
|
|
1331
1324
|
/**
|
|
1332
1325
|
* A class providing credential and configuration.
|
|
1333
|
-
* @beta
|
|
1334
1326
|
*/
|
|
1335
1327
|
class TeamsFx {
|
|
1336
1328
|
constructor(identityType, customConfig) {
|
|
@@ -1343,8 +1335,9 @@ class TeamsFx {
|
|
|
1343
1335
|
this.configuration = new Map();
|
|
1344
1336
|
this.loadFromEnv();
|
|
1345
1337
|
if (customConfig) {
|
|
1346
|
-
|
|
1347
|
-
|
|
1338
|
+
const myConfig = Object.assign({}, customConfig);
|
|
1339
|
+
for (const key of Object.keys(myConfig)) {
|
|
1340
|
+
const value = myConfig[key];
|
|
1348
1341
|
if (value) {
|
|
1349
1342
|
this.configuration.set(key, value);
|
|
1350
1343
|
}
|
|
@@ -1392,14 +1385,14 @@ class TeamsFx {
|
|
|
1392
1385
|
}
|
|
1393
1386
|
return this.teamsUserCredential;
|
|
1394
1387
|
}
|
|
1395
|
-
getUserInfo() {
|
|
1388
|
+
getUserInfo(resources) {
|
|
1396
1389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1397
|
-
return yield this.getCredential().getUserInfo();
|
|
1390
|
+
return yield this.getCredential().getUserInfo(resources);
|
|
1398
1391
|
});
|
|
1399
1392
|
}
|
|
1400
|
-
login(scopes) {
|
|
1393
|
+
login(scopes, resources) {
|
|
1401
1394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1402
|
-
yield this.getCredential().login(scopes);
|
|
1395
|
+
yield this.getCredential().login(scopes, resources);
|
|
1403
1396
|
});
|
|
1404
1397
|
}
|
|
1405
1398
|
setSsoToken(ssoToken) {
|
|
@@ -1428,6 +1421,65 @@ class TeamsFx {
|
|
|
1428
1421
|
}
|
|
1429
1422
|
}
|
|
1430
1423
|
|
|
1424
|
+
// Copyright (c) Microsoft Corporation.
|
|
1425
|
+
// Licensed under the MIT license.
|
|
1426
|
+
/**
|
|
1427
|
+
* The target type where the notification will be sent to.
|
|
1428
|
+
*
|
|
1429
|
+
* @remarks
|
|
1430
|
+
* - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
|
|
1431
|
+
* - "Group" means to a group chat.
|
|
1432
|
+
* - "Person" means to a personal chat.
|
|
1433
|
+
*/
|
|
1434
|
+
var NotificationTargetType;
|
|
1435
|
+
(function (NotificationTargetType) {
|
|
1436
|
+
/**
|
|
1437
|
+
* The notification will be sent to a team channel.
|
|
1438
|
+
* (By default, notification to a team will be sent to its "General" channel.)
|
|
1439
|
+
*/
|
|
1440
|
+
NotificationTargetType["Channel"] = "Channel";
|
|
1441
|
+
/**
|
|
1442
|
+
* The notification will be sent to a group chat.
|
|
1443
|
+
*/
|
|
1444
|
+
NotificationTargetType["Group"] = "Group";
|
|
1445
|
+
/**
|
|
1446
|
+
* The notification will be sent to a personal chat.
|
|
1447
|
+
*/
|
|
1448
|
+
NotificationTargetType["Person"] = "Person";
|
|
1449
|
+
})(NotificationTargetType || (NotificationTargetType = {}));
|
|
1450
|
+
/**
|
|
1451
|
+
* Options used to control how the response card will be sent to users.
|
|
1452
|
+
*/
|
|
1453
|
+
var AdaptiveCardResponse;
|
|
1454
|
+
(function (AdaptiveCardResponse) {
|
|
1455
|
+
/**
|
|
1456
|
+
* The response card will be replaced the current one for the interactor who trigger the action.
|
|
1457
|
+
*/
|
|
1458
|
+
AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForInteractor"] = 0] = "ReplaceForInteractor";
|
|
1459
|
+
/**
|
|
1460
|
+
* The response card will be replaced the current one for all users in the chat.
|
|
1461
|
+
*/
|
|
1462
|
+
AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForAll"] = 1] = "ReplaceForAll";
|
|
1463
|
+
/**
|
|
1464
|
+
* The response card will be sent as a new message for all users in the chat.
|
|
1465
|
+
*/
|
|
1466
|
+
AdaptiveCardResponse[AdaptiveCardResponse["NewForAll"] = 2] = "NewForAll";
|
|
1467
|
+
})(AdaptiveCardResponse || (AdaptiveCardResponse = {}));
|
|
1468
|
+
/**
|
|
1469
|
+
* Status code for an `application/vnd.microsoft.error` invoke response.
|
|
1470
|
+
*/
|
|
1471
|
+
var InvokeResponseErrorCode;
|
|
1472
|
+
(function (InvokeResponseErrorCode) {
|
|
1473
|
+
/**
|
|
1474
|
+
* Invalid request.
|
|
1475
|
+
*/
|
|
1476
|
+
InvokeResponseErrorCode[InvokeResponseErrorCode["BadRequest"] = 400] = "BadRequest";
|
|
1477
|
+
/**
|
|
1478
|
+
* Internal server error.
|
|
1479
|
+
*/
|
|
1480
|
+
InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
|
|
1481
|
+
})(InvokeResponseErrorCode || (InvokeResponseErrorCode = {}));
|
|
1482
|
+
|
|
1431
1483
|
// Copyright (c) Microsoft Corporation.
|
|
1432
1484
|
/**
|
|
1433
1485
|
* Provide utilities for bot conversation, including:
|
|
@@ -1436,8 +1488,6 @@ class TeamsFx {
|
|
|
1436
1488
|
*
|
|
1437
1489
|
* @remarks
|
|
1438
1490
|
* Only work on server side.
|
|
1439
|
-
*
|
|
1440
|
-
* @beta
|
|
1441
1491
|
*/
|
|
1442
1492
|
class ConversationBot {
|
|
1443
1493
|
/**
|
|
@@ -1447,8 +1497,6 @@ class ConversationBot {
|
|
|
1447
1497
|
*
|
|
1448
1498
|
* @remarks
|
|
1449
1499
|
* Only work on server side.
|
|
1450
|
-
*
|
|
1451
|
-
* @beta
|
|
1452
1500
|
*/
|
|
1453
1501
|
constructor(options) {
|
|
1454
1502
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1462,8 +1510,6 @@ class ConversationBot {
|
|
|
1462
1510
|
*
|
|
1463
1511
|
* @remarks
|
|
1464
1512
|
* Only work on server side.
|
|
1465
|
-
*
|
|
1466
|
-
* @beta
|
|
1467
1513
|
*/
|
|
1468
1514
|
requestHandler(req, res, logic) {
|
|
1469
1515
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1472,6 +1518,45 @@ class ConversationBot {
|
|
|
1472
1518
|
}
|
|
1473
1519
|
}
|
|
1474
1520
|
|
|
1521
|
+
// Copyright (c) Microsoft Corporation.
|
|
1522
|
+
/*
|
|
1523
|
+
* Sso execution dialog, use to handle sso command
|
|
1524
|
+
*/
|
|
1525
|
+
class BotSsoExecutionDialog {
|
|
1526
|
+
constructor(dedupStorage, ssoPromptSettings, authConfig, ...args) {
|
|
1527
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Add TeamsFxBotSsoCommandHandler instance
|
|
1531
|
+
* @param handler {@link BotSsoExecutionDialogHandler} callback function
|
|
1532
|
+
* @param triggerPatterns The trigger pattern
|
|
1533
|
+
*/
|
|
1534
|
+
addCommand(handler, triggerPatterns) {
|
|
1535
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
|
|
1539
|
+
*
|
|
1540
|
+
* @param context The context object for the current turn.
|
|
1541
|
+
* @param accessor The instance of StatePropertyAccessor for dialog system.
|
|
1542
|
+
*/
|
|
1543
|
+
run(context, accessor) {
|
|
1544
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1545
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Called when the component is ending.
|
|
1550
|
+
*
|
|
1551
|
+
* @param context Context for the current turn of conversation.
|
|
1552
|
+
*/
|
|
1553
|
+
onEndDialog(context) {
|
|
1554
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1555
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1475
1560
|
// Copyright (c) Microsoft Corporation.
|
|
1476
1561
|
/**
|
|
1477
1562
|
* Send a plain text message to a notification target.
|
|
@@ -1481,11 +1566,10 @@ class ConversationBot {
|
|
|
1481
1566
|
*
|
|
1482
1567
|
* @param target - the notification target.
|
|
1483
1568
|
* @param text - the plain text message.
|
|
1569
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1484
1570
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1485
|
-
*
|
|
1486
|
-
* @beta
|
|
1487
1571
|
*/
|
|
1488
|
-
function sendMessage(target, text) {
|
|
1572
|
+
function sendMessage(target, text, onError) {
|
|
1489
1573
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
|
|
1490
1574
|
}
|
|
1491
1575
|
/**
|
|
@@ -1496,11 +1580,10 @@ function sendMessage(target, text) {
|
|
|
1496
1580
|
*
|
|
1497
1581
|
* @param target - the notification target.
|
|
1498
1582
|
* @param card - the adaptive card raw JSON.
|
|
1583
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1499
1584
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1500
|
-
*
|
|
1501
|
-
* @beta
|
|
1502
1585
|
*/
|
|
1503
|
-
function sendAdaptiveCard(target, card) {
|
|
1586
|
+
function sendAdaptiveCard(target, card, onError) {
|
|
1504
1587
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
|
|
1505
1588
|
}
|
|
1506
1589
|
/**
|
|
@@ -1510,8 +1593,6 @@ function sendAdaptiveCard(target, card) {
|
|
|
1510
1593
|
* Only work on server side.
|
|
1511
1594
|
*
|
|
1512
1595
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
1513
|
-
*
|
|
1514
|
-
* @beta
|
|
1515
1596
|
*/
|
|
1516
1597
|
class Channel {
|
|
1517
1598
|
/**
|
|
@@ -1524,8 +1605,6 @@ class Channel {
|
|
|
1524
1605
|
*
|
|
1525
1606
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
1526
1607
|
* @param info - Detailed channel information.
|
|
1527
|
-
*
|
|
1528
|
-
* @beta
|
|
1529
1608
|
*/
|
|
1530
1609
|
constructor(parent, info) {
|
|
1531
1610
|
/**
|
|
@@ -1533,10 +1612,8 @@ class Channel {
|
|
|
1533
1612
|
*
|
|
1534
1613
|
* @remarks
|
|
1535
1614
|
* Only work on server side.
|
|
1536
|
-
*
|
|
1537
|
-
* @beta
|
|
1538
1615
|
*/
|
|
1539
|
-
this.type =
|
|
1616
|
+
this.type = NotificationTargetType.Channel;
|
|
1540
1617
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1541
1618
|
}
|
|
1542
1619
|
/**
|
|
@@ -1546,11 +1623,10 @@ class Channel {
|
|
|
1546
1623
|
* Only work on server side.
|
|
1547
1624
|
*
|
|
1548
1625
|
* @param text - the plain text message.
|
|
1549
|
-
* @
|
|
1550
|
-
*
|
|
1551
|
-
* @beta
|
|
1626
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1627
|
+
* @returns the response of sending message.
|
|
1552
1628
|
*/
|
|
1553
|
-
sendMessage(text) {
|
|
1629
|
+
sendMessage(text, onError) {
|
|
1554
1630
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1555
1631
|
}
|
|
1556
1632
|
/**
|
|
@@ -1560,11 +1636,10 @@ class Channel {
|
|
|
1560
1636
|
* Only work on server side.
|
|
1561
1637
|
*
|
|
1562
1638
|
* @param card - the adaptive card raw JSON.
|
|
1563
|
-
* @
|
|
1564
|
-
*
|
|
1565
|
-
* @beta
|
|
1639
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1640
|
+
* @returns the response of sending adaptive card message.
|
|
1566
1641
|
*/
|
|
1567
|
-
sendAdaptiveCard(card) {
|
|
1642
|
+
sendAdaptiveCard(card, onError) {
|
|
1568
1643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1569
1644
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1570
1645
|
});
|
|
@@ -1577,8 +1652,6 @@ class Channel {
|
|
|
1577
1652
|
* Only work on server side.
|
|
1578
1653
|
*
|
|
1579
1654
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
1580
|
-
*
|
|
1581
|
-
* @beta
|
|
1582
1655
|
*/
|
|
1583
1656
|
class Member {
|
|
1584
1657
|
/**
|
|
@@ -1591,8 +1664,6 @@ class Member {
|
|
|
1591
1664
|
*
|
|
1592
1665
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
1593
1666
|
* @param account - Detailed member account information.
|
|
1594
|
-
*
|
|
1595
|
-
* @beta
|
|
1596
1667
|
*/
|
|
1597
1668
|
constructor(parent, account) {
|
|
1598
1669
|
/**
|
|
@@ -1600,10 +1671,8 @@ class Member {
|
|
|
1600
1671
|
*
|
|
1601
1672
|
* @remarks
|
|
1602
1673
|
* Only work on server side.
|
|
1603
|
-
*
|
|
1604
|
-
* @beta
|
|
1605
1674
|
*/
|
|
1606
|
-
this.type =
|
|
1675
|
+
this.type = NotificationTargetType.Person;
|
|
1607
1676
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1608
1677
|
}
|
|
1609
1678
|
/**
|
|
@@ -1613,11 +1682,10 @@ class Member {
|
|
|
1613
1682
|
* Only work on server side.
|
|
1614
1683
|
*
|
|
1615
1684
|
* @param text - the plain text message.
|
|
1616
|
-
* @
|
|
1617
|
-
*
|
|
1618
|
-
* @beta
|
|
1685
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1686
|
+
* @returns the response of sending message.
|
|
1619
1687
|
*/
|
|
1620
|
-
sendMessage(text) {
|
|
1688
|
+
sendMessage(text, onError) {
|
|
1621
1689
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1622
1690
|
}
|
|
1623
1691
|
/**
|
|
@@ -1627,11 +1695,10 @@ class Member {
|
|
|
1627
1695
|
* Only work on server side.
|
|
1628
1696
|
*
|
|
1629
1697
|
* @param card - the adaptive card raw JSON.
|
|
1630
|
-
* @
|
|
1631
|
-
*
|
|
1632
|
-
* @beta
|
|
1698
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1699
|
+
* @returns the response of sending adaptive card message.
|
|
1633
1700
|
*/
|
|
1634
|
-
sendAdaptiveCard(card) {
|
|
1701
|
+
sendAdaptiveCard(card, onError) {
|
|
1635
1702
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1636
1703
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1637
1704
|
});
|
|
@@ -1647,8 +1714,6 @@ class Member {
|
|
|
1647
1714
|
* Only work on server side.
|
|
1648
1715
|
*
|
|
1649
1716
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
1650
|
-
*
|
|
1651
|
-
* @beta
|
|
1652
1717
|
*/
|
|
1653
1718
|
class TeamsBotInstallation {
|
|
1654
1719
|
/**
|
|
@@ -1661,8 +1726,6 @@ class TeamsBotInstallation {
|
|
|
1661
1726
|
*
|
|
1662
1727
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
1663
1728
|
* @param conversationReference - the bound `ConversationReference`.
|
|
1664
|
-
*
|
|
1665
|
-
* @beta
|
|
1666
1729
|
*/
|
|
1667
1730
|
constructor(adapter, conversationReference) {
|
|
1668
1731
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1674,11 +1737,10 @@ class TeamsBotInstallation {
|
|
|
1674
1737
|
* Only work on server side.
|
|
1675
1738
|
*
|
|
1676
1739
|
* @param text - the plain text message.
|
|
1677
|
-
* @
|
|
1678
|
-
*
|
|
1679
|
-
* @beta
|
|
1740
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
1741
|
+
* @returns the response of sending message.
|
|
1680
1742
|
*/
|
|
1681
|
-
sendMessage(text) {
|
|
1743
|
+
sendMessage(text, onError) {
|
|
1682
1744
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1683
1745
|
}
|
|
1684
1746
|
/**
|
|
@@ -1688,11 +1750,10 @@ class TeamsBotInstallation {
|
|
|
1688
1750
|
* Only work on server side.
|
|
1689
1751
|
*
|
|
1690
1752
|
* @param card - the adaptive card raw JSON.
|
|
1691
|
-
* @
|
|
1692
|
-
*
|
|
1693
|
-
* @beta
|
|
1753
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
1754
|
+
* @returns the response of sending adaptive card message.
|
|
1694
1755
|
*/
|
|
1695
|
-
sendAdaptiveCard(card) {
|
|
1756
|
+
sendAdaptiveCard(card, onError) {
|
|
1696
1757
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1697
1758
|
}
|
|
1698
1759
|
/**
|
|
@@ -1702,8 +1763,6 @@ class TeamsBotInstallation {
|
|
|
1702
1763
|
* Only work on server side.
|
|
1703
1764
|
*
|
|
1704
1765
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
1705
|
-
*
|
|
1706
|
-
* @beta
|
|
1707
1766
|
*/
|
|
1708
1767
|
channels() {
|
|
1709
1768
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1717,14 +1776,22 @@ class TeamsBotInstallation {
|
|
|
1717
1776
|
* Only work on server side.
|
|
1718
1777
|
*
|
|
1719
1778
|
* @returns an array of members from where the bot is installed.
|
|
1720
|
-
*
|
|
1721
|
-
* @beta
|
|
1722
1779
|
*/
|
|
1723
1780
|
members() {
|
|
1724
1781
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1725
1782
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1726
1783
|
});
|
|
1727
1784
|
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Get team details from this bot installation
|
|
1787
|
+
*
|
|
1788
|
+
* @returns the team details if bot is installed into a team, otherwise returns undefined.
|
|
1789
|
+
*/
|
|
1790
|
+
getTeamDetails() {
|
|
1791
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1792
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1728
1795
|
}
|
|
1729
1796
|
/**
|
|
1730
1797
|
* Provide static utilities for bot notification.
|
|
@@ -1750,8 +1817,6 @@ class TeamsBotInstallation {
|
|
|
1750
1817
|
* }
|
|
1751
1818
|
* }
|
|
1752
1819
|
* ```
|
|
1753
|
-
*
|
|
1754
|
-
* @beta
|
|
1755
1820
|
*/
|
|
1756
1821
|
class NotificationBot {
|
|
1757
1822
|
/**
|
|
@@ -1764,8 +1829,6 @@ class NotificationBot {
|
|
|
1764
1829
|
*
|
|
1765
1830
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
1766
1831
|
* @param options - initialize options
|
|
1767
|
-
*
|
|
1768
|
-
* @beta
|
|
1769
1832
|
*/
|
|
1770
1833
|
constructor(adapter, options) {
|
|
1771
1834
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1779,15 +1842,103 @@ class NotificationBot {
|
|
|
1779
1842
|
* The result is retrieving from the persisted storage.
|
|
1780
1843
|
*
|
|
1781
1844
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
1782
|
-
*
|
|
1783
|
-
* @beta
|
|
1784
1845
|
*/
|
|
1785
1846
|
static installations() {
|
|
1786
1847
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1787
1848
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1788
1849
|
});
|
|
1789
1850
|
}
|
|
1790
|
-
|
|
1851
|
+
/**
|
|
1852
|
+
* Returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1853
|
+
*
|
|
1854
|
+
* @remarks
|
|
1855
|
+
* Only work on server side.
|
|
1856
|
+
*
|
|
1857
|
+
* @param predicate find calls predicate once for each member of the installation,
|
|
1858
|
+
* until it finds one where predicate returns true. If such a member is found, find
|
|
1859
|
+
* immediately returns that member. Otherwise, find returns undefined.
|
|
1860
|
+
* @param scope the scope to find members from the installations
|
|
1861
|
+
* (personal chat, group chat, Teams channel).
|
|
1862
|
+
* @returns the first {@link Member} where predicate is true, and undefined otherwise.
|
|
1863
|
+
*/
|
|
1864
|
+
findMember(predicate, scope) {
|
|
1865
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1866
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1871
|
+
* (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)
|
|
1872
|
+
*
|
|
1873
|
+
* @remarks
|
|
1874
|
+
* Only work on server side.
|
|
1875
|
+
*
|
|
1876
|
+
* @param predicate find calls predicate once for each channel of the installation,
|
|
1877
|
+
* until it finds one where predicate returns true. If such a channel is found, find
|
|
1878
|
+
* immediately returns that channel. Otherwise, find returns undefined.
|
|
1879
|
+
* @returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
|
1880
|
+
*/
|
|
1881
|
+
findChannel(predicate) {
|
|
1882
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1883
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Returns all {@link Member} where predicate is true, and empty array otherwise.
|
|
1888
|
+
*
|
|
1889
|
+
* @remarks
|
|
1890
|
+
* Only work on server side.
|
|
1891
|
+
*
|
|
1892
|
+
* @param predicate find calls predicate for each member of the installation.
|
|
1893
|
+
* @param scope the scope to find members from the installations
|
|
1894
|
+
* (personal chat, group chat, Teams channel).
|
|
1895
|
+
* @returns an array of {@link Member} where predicate is true, and empty array otherwise.
|
|
1896
|
+
*/
|
|
1897
|
+
findAllMembers(predicate, scope) {
|
|
1898
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1899
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Returns all {@link Channel} where predicate is true, and empty array otherwise.
|
|
1904
|
+
* (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)
|
|
1905
|
+
*
|
|
1906
|
+
* @remarks
|
|
1907
|
+
* Only work on server side.
|
|
1908
|
+
*
|
|
1909
|
+
* @param predicate find calls predicate for each channel of the installation.
|
|
1910
|
+
* @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
|
|
1911
|
+
*/
|
|
1912
|
+
findAllChannels(predicate) {
|
|
1913
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1914
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
|
|
1920
|
+
* The search scope is a flagged enum and it can be combined with `|`.
|
|
1921
|
+
* For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
|
|
1922
|
+
*/
|
|
1923
|
+
var SearchScope;
|
|
1924
|
+
(function (SearchScope) {
|
|
1925
|
+
/**
|
|
1926
|
+
* Search members from the installations in personal chat only.
|
|
1927
|
+
*/
|
|
1928
|
+
SearchScope[SearchScope["Person"] = 1] = "Person";
|
|
1929
|
+
/**
|
|
1930
|
+
* Search members from the installations in group chat only.
|
|
1931
|
+
*/
|
|
1932
|
+
SearchScope[SearchScope["Group"] = 2] = "Group";
|
|
1933
|
+
/**
|
|
1934
|
+
* Search members from the installations in Teams channel only.
|
|
1935
|
+
*/
|
|
1936
|
+
SearchScope[SearchScope["Channel"] = 4] = "Channel";
|
|
1937
|
+
/**
|
|
1938
|
+
* Search members from all installations including personal chat, group chat and Teams channel.
|
|
1939
|
+
*/
|
|
1940
|
+
SearchScope[SearchScope["All"] = 7] = "All";
|
|
1941
|
+
})(SearchScope || (SearchScope = {}));
|
|
1791
1942
|
|
|
1792
1943
|
// Copyright (c) Microsoft Corporation.
|
|
1793
1944
|
/**
|
|
@@ -1795,8 +1946,6 @@ class NotificationBot {
|
|
|
1795
1946
|
*
|
|
1796
1947
|
* @remarks
|
|
1797
1948
|
* Only work on server side.
|
|
1798
|
-
*
|
|
1799
|
-
* @beta
|
|
1800
1949
|
*/
|
|
1801
1950
|
class CommandBot {
|
|
1802
1951
|
/**
|
|
@@ -1804,8 +1953,6 @@ class CommandBot {
|
|
|
1804
1953
|
*
|
|
1805
1954
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
1806
1955
|
* @param commands 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.
|
|
1807
|
-
*
|
|
1808
|
-
* @beta
|
|
1809
1956
|
*/
|
|
1810
1957
|
constructor(adapter, commands) {
|
|
1811
1958
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1817,8 +1964,6 @@ class CommandBot {
|
|
|
1817
1964
|
*
|
|
1818
1965
|
* @remarks
|
|
1819
1966
|
* Only work on server side.
|
|
1820
|
-
*
|
|
1821
|
-
* @beta
|
|
1822
1967
|
*/
|
|
1823
1968
|
registerCommand(command) {
|
|
1824
1969
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1830,13 +1975,86 @@ class CommandBot {
|
|
|
1830
1975
|
*
|
|
1831
1976
|
* @remarks
|
|
1832
1977
|
* Only work on server side.
|
|
1833
|
-
*
|
|
1834
|
-
* @beta
|
|
1835
1978
|
*/
|
|
1836
1979
|
registerCommands(commands) {
|
|
1837
|
-
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "
|
|
1980
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Registers a sso command into the command bot.
|
|
1984
|
+
*
|
|
1985
|
+
* @param command The command to register.
|
|
1986
|
+
*/
|
|
1987
|
+
registerSsoCommand(ssoCommand) {
|
|
1988
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Registers commands into the command bot.
|
|
1992
|
+
*
|
|
1993
|
+
* @param commands The commands to register.
|
|
1994
|
+
*/
|
|
1995
|
+
registerSsoCommands(ssoCommands) {
|
|
1996
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
1838
1997
|
}
|
|
1839
1998
|
}
|
|
1840
1999
|
|
|
1841
|
-
|
|
2000
|
+
/**
|
|
2001
|
+
* A card action bot to respond to adaptive card universal actions.
|
|
2002
|
+
*
|
|
2003
|
+
* @remarks
|
|
2004
|
+
* Only work on server side.
|
|
2005
|
+
*/
|
|
2006
|
+
class CardActionBot {
|
|
2007
|
+
/**
|
|
2008
|
+
* Creates a new instance of the `CardActionBot`.
|
|
2009
|
+
*
|
|
2010
|
+
* @param adapter The bound `BotFrameworkAdapter`.
|
|
2011
|
+
* @param options - initialize options
|
|
2012
|
+
*/
|
|
2013
|
+
constructor(adapter, options) {
|
|
2014
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Registers a card action handler to the bot.
|
|
2018
|
+
* @param actionHandler A card action handler to be registered.
|
|
2019
|
+
*
|
|
2020
|
+
* @remarks
|
|
2021
|
+
* Only work on server side.
|
|
2022
|
+
*/
|
|
2023
|
+
registerHandler(actionHandler) {
|
|
2024
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Registers card action handlers to the bot.
|
|
2028
|
+
* @param actionHandlers A set of card action handlers to be registered.
|
|
2029
|
+
*
|
|
2030
|
+
* @remarks
|
|
2031
|
+
* Only work on server side.
|
|
2032
|
+
*/
|
|
2033
|
+
registerHandlers(actionHandlers) {
|
|
2034
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* Users execute query with SSO or Access Token.
|
|
2040
|
+
* @remarks
|
|
2041
|
+
* Only works in in server side.
|
|
2042
|
+
*/
|
|
2043
|
+
function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
|
|
2044
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2045
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Users execute query with SSO or Access Token.
|
|
2050
|
+
* @remarks
|
|
2051
|
+
* Only works in in server side.
|
|
2052
|
+
*/
|
|
2053
|
+
function handleMessageExtensionQueryWithSSO(context, config, initiateLoginEndpoint, scopes, logic) {
|
|
2054
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2055
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
export { AdaptiveCardResponse, ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, BotSsoExecutionDialog, CardActionBot, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, InvokeResponseErrorCode, LogLevel, Member, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createMicrosoftGraphClientWithCredential, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, handleMessageExtensionQueryWithSSO, handleMessageExtensionQueryWithToken, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
1842
2060
|
//# sourceMappingURL=index.esm5.js.map
|