@microsoft/teamsfx 1.0.0 → 1.0.1-alpha.96c4705a0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +0 -136
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +6 -169
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +0 -136
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +6 -169
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +0 -253
package/dist/index.esm2017.mjs
CHANGED
|
@@ -16,7 +16,6 @@ import { AdaptiveCards } from '@microsoft/adaptivecards-tools';
|
|
|
16
16
|
// Licensed under the MIT license.
|
|
17
17
|
/**
|
|
18
18
|
* Error code to trace the error types.
|
|
19
|
-
* @beta
|
|
20
19
|
*/
|
|
21
20
|
var ErrorCode;
|
|
22
21
|
(function (ErrorCode) {
|
|
@@ -107,8 +106,6 @@ ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in r
|
|
|
107
106
|
ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
|
|
108
107
|
/**
|
|
109
108
|
* Error class with code and message thrown by the SDK.
|
|
110
|
-
*
|
|
111
|
-
* @beta
|
|
112
109
|
*/
|
|
113
110
|
class ErrorWithCode extends Error {
|
|
114
111
|
/**
|
|
@@ -116,8 +113,6 @@ class ErrorWithCode extends Error {
|
|
|
116
113
|
*
|
|
117
114
|
* @param {string} message - error message.
|
|
118
115
|
* @param {ErrorCode} code - error code.
|
|
119
|
-
*
|
|
120
|
-
* @beta
|
|
121
116
|
*/
|
|
122
117
|
constructor(message, code) {
|
|
123
118
|
if (!code) {
|
|
@@ -135,8 +130,6 @@ class ErrorWithCode extends Error {
|
|
|
135
130
|
// Licensed under the MIT license.
|
|
136
131
|
/**
|
|
137
132
|
* Log level.
|
|
138
|
-
*
|
|
139
|
-
* @beta
|
|
140
133
|
*/
|
|
141
134
|
var LogLevel;
|
|
142
135
|
(function (LogLevel) {
|
|
@@ -161,8 +154,6 @@ var LogLevel;
|
|
|
161
154
|
* Update log level helper.
|
|
162
155
|
*
|
|
163
156
|
* @param { LogLevel } level - log level in configuration
|
|
164
|
-
*
|
|
165
|
-
* @beta
|
|
166
157
|
*/
|
|
167
158
|
function setLogLevel(level) {
|
|
168
159
|
internalLogger.level = level;
|
|
@@ -171,8 +162,6 @@ function setLogLevel(level) {
|
|
|
171
162
|
* Get log level.
|
|
172
163
|
*
|
|
173
164
|
* @returns Log level
|
|
174
|
-
*
|
|
175
|
-
* @beta
|
|
176
165
|
*/
|
|
177
166
|
function getLogLevel() {
|
|
178
167
|
return internalLogger.level;
|
|
@@ -247,8 +236,6 @@ const internalLogger = new InternalLogger();
|
|
|
247
236
|
* error: console.error,
|
|
248
237
|
* });
|
|
249
238
|
* ```
|
|
250
|
-
*
|
|
251
|
-
* @beta
|
|
252
239
|
*/
|
|
253
240
|
function setLogger(logger) {
|
|
254
241
|
internalLogger.customLogger = logger;
|
|
@@ -266,8 +253,6 @@ function setLogger(logger) {
|
|
|
266
253
|
* }
|
|
267
254
|
* });
|
|
268
255
|
* ```
|
|
269
|
-
*
|
|
270
|
-
* @beta
|
|
271
256
|
*/
|
|
272
257
|
function setLogFunction(logFunction) {
|
|
273
258
|
internalLogger.customLogFunction = logFunction;
|
|
@@ -431,8 +416,6 @@ function parseCertificate(certificateContent) {
|
|
|
431
416
|
*
|
|
432
417
|
* @remarks
|
|
433
418
|
* Only works in in server side.
|
|
434
|
-
*
|
|
435
|
-
* @beta
|
|
436
419
|
*/
|
|
437
420
|
class AppCredential {
|
|
438
421
|
/**
|
|
@@ -445,8 +428,6 @@ class AppCredential {
|
|
|
445
428
|
*
|
|
446
429
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.
|
|
447
430
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
448
|
-
*
|
|
449
|
-
* @beta
|
|
450
431
|
*/
|
|
451
432
|
constructor(authConfig) {
|
|
452
433
|
internalLogger.info("Create M365 tenant credential");
|
|
@@ -476,8 +457,6 @@ class AppCredential {
|
|
|
476
457
|
*
|
|
477
458
|
* @returns Access token with expected scopes.
|
|
478
459
|
* Throw error if get access token failed.
|
|
479
|
-
*
|
|
480
|
-
* @beta
|
|
481
460
|
*/
|
|
482
461
|
async getToken(scopes, options) {
|
|
483
462
|
let accessToken;
|
|
@@ -547,8 +526,6 @@ class AppCredential {
|
|
|
547
526
|
*
|
|
548
527
|
* @remarks
|
|
549
528
|
* Can only be used in server side.
|
|
550
|
-
*
|
|
551
|
-
* @beta
|
|
552
529
|
*/
|
|
553
530
|
class OnBehalfOfUserCredential {
|
|
554
531
|
/**
|
|
@@ -563,8 +540,6 @@ class OnBehalfOfUserCredential {
|
|
|
563
540
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, certificate content, authority host or tenant id is not found in config.
|
|
564
541
|
* @throws {@link ErrorCode|InternalError} when SSO token is not valid.
|
|
565
542
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
566
|
-
*
|
|
567
|
-
* @beta
|
|
568
543
|
*/
|
|
569
544
|
constructor(ssoToken, config) {
|
|
570
545
|
internalLogger.info("Get on behalf of user credential");
|
|
@@ -625,8 +600,6 @@ class OnBehalfOfUserCredential {
|
|
|
625
600
|
* @remarks
|
|
626
601
|
* If scopes is empty string or array, it returns SSO token.
|
|
627
602
|
* If scopes is non-empty, it returns access token for target scope.
|
|
628
|
-
*
|
|
629
|
-
* @beta
|
|
630
603
|
*/
|
|
631
604
|
async getToken(scopes, options) {
|
|
632
605
|
validateScopesType(scopes);
|
|
@@ -677,8 +650,6 @@ class OnBehalfOfUserCredential {
|
|
|
677
650
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
678
651
|
*
|
|
679
652
|
* @returns Basic user info with user displayName, objectId and preferredUserName.
|
|
680
|
-
*
|
|
681
|
-
* @beta
|
|
682
653
|
*/
|
|
683
654
|
getUserInfo() {
|
|
684
655
|
internalLogger.info("Get basic user info from SSO token");
|
|
@@ -710,15 +681,12 @@ class OnBehalfOfUserCredential {
|
|
|
710
681
|
*
|
|
711
682
|
* @remarks
|
|
712
683
|
* Can only be used within Teams.
|
|
713
|
-
*
|
|
714
|
-
* @beta
|
|
715
684
|
*/
|
|
716
685
|
class TeamsUserCredential {
|
|
717
686
|
/**
|
|
718
687
|
* Constructor of TeamsUserCredential.
|
|
719
688
|
* @remarks
|
|
720
689
|
* Can only be used within Teams.
|
|
721
|
-
* @beta
|
|
722
690
|
*/
|
|
723
691
|
constructor(authConfig) {
|
|
724
692
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
@@ -727,7 +695,6 @@ class TeamsUserCredential {
|
|
|
727
695
|
* Popup login page to get user's access token with specific scopes.
|
|
728
696
|
* @remarks
|
|
729
697
|
* Can only be used within Teams.
|
|
730
|
-
* @beta
|
|
731
698
|
*/
|
|
732
699
|
async login(scopes) {
|
|
733
700
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
@@ -736,7 +703,6 @@ class TeamsUserCredential {
|
|
|
736
703
|
* Get access token from credential.
|
|
737
704
|
* @remarks
|
|
738
705
|
* Can only be used within Teams.
|
|
739
|
-
* @beta
|
|
740
706
|
*/
|
|
741
707
|
async getToken(scopes, options) {
|
|
742
708
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
@@ -745,7 +711,6 @@ class TeamsUserCredential {
|
|
|
745
711
|
* Get basic user info from SSO token
|
|
746
712
|
* @remarks
|
|
747
713
|
* Can only be used within Teams.
|
|
748
|
-
* @beta
|
|
749
714
|
*/
|
|
750
715
|
getUserInfo() {
|
|
751
716
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), ErrorCode.RuntimeNotSupported);
|
|
@@ -756,8 +721,6 @@ class TeamsUserCredential {
|
|
|
756
721
|
const defaultScope = "https://graph.microsoft.com/.default";
|
|
757
722
|
/**
|
|
758
723
|
* Microsoft Graph auth provider for Teams Framework
|
|
759
|
-
*
|
|
760
|
-
* @beta
|
|
761
724
|
*/
|
|
762
725
|
class MsGraphAuthProvider {
|
|
763
726
|
/**
|
|
@@ -769,8 +732,6 @@ class MsGraphAuthProvider {
|
|
|
769
732
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
770
733
|
*
|
|
771
734
|
* @returns An instance of MsGraphAuthProvider.
|
|
772
|
-
*
|
|
773
|
-
* @beta
|
|
774
735
|
*/
|
|
775
736
|
constructor(teamsfx, scopes) {
|
|
776
737
|
this.teamsfx = teamsfx;
|
|
@@ -862,8 +823,6 @@ class MsGraphAuthProvider {
|
|
|
862
823
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
863
824
|
*
|
|
864
825
|
* @returns Graph client with specified scopes.
|
|
865
|
-
*
|
|
866
|
-
* @beta
|
|
867
826
|
*/
|
|
868
827
|
function createMicrosoftGraphClient(teamsfx, scopes) {
|
|
869
828
|
internalLogger.info("Create Microsoft Graph Client");
|
|
@@ -891,8 +850,6 @@ const defaultSQLScope = "https://database.windows.net/";
|
|
|
891
850
|
* @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.
|
|
892
851
|
* @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.
|
|
893
852
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
894
|
-
*
|
|
895
|
-
* @beta
|
|
896
853
|
*/
|
|
897
854
|
async function getTediousConnectionConfig(teamsfx, databaseName) {
|
|
898
855
|
internalLogger.info("Get SQL configuration");
|
|
@@ -1047,8 +1004,6 @@ var TediousAuthenticationType;
|
|
|
1047
1004
|
// Licensed under the MIT license.
|
|
1048
1005
|
/**
|
|
1049
1006
|
* Identity type to use in authentication.
|
|
1050
|
-
*
|
|
1051
|
-
* @beta
|
|
1052
1007
|
*/
|
|
1053
1008
|
var IdentityType;
|
|
1054
1009
|
(function (IdentityType) {
|
|
@@ -1066,8 +1021,6 @@ var IdentityType;
|
|
|
1066
1021
|
const invokeResponseType = "invokeResponse";
|
|
1067
1022
|
/**
|
|
1068
1023
|
* Response body returned for a token exchange invoke activity.
|
|
1069
|
-
*
|
|
1070
|
-
* @beta
|
|
1071
1024
|
*/
|
|
1072
1025
|
class TokenExchangeInvokeResponse {
|
|
1073
1026
|
constructor(id, failureDetail) {
|
|
@@ -1122,8 +1075,6 @@ class TokenExchangeInvokeResponse {
|
|
|
1122
1075
|
* }
|
|
1123
1076
|
* ]));
|
|
1124
1077
|
* ```
|
|
1125
|
-
*
|
|
1126
|
-
* @beta
|
|
1127
1078
|
*/
|
|
1128
1079
|
class TeamsBotSsoPrompt extends Dialog {
|
|
1129
1080
|
/**
|
|
@@ -1135,8 +1086,6 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1135
1086
|
*
|
|
1136
1087
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1137
1088
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1138
|
-
*
|
|
1139
|
-
* @beta
|
|
1140
1089
|
*/
|
|
1141
1090
|
constructor(teamsfx, dialogId, settings) {
|
|
1142
1091
|
super(dialogId);
|
|
@@ -1159,8 +1108,6 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1159
1108
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1160
1109
|
*
|
|
1161
1110
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1162
|
-
*
|
|
1163
|
-
* @beta
|
|
1164
1111
|
*/
|
|
1165
1112
|
async beginDialog(dc) {
|
|
1166
1113
|
var _a;
|
|
@@ -1208,8 +1155,6 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1208
1155
|
*
|
|
1209
1156
|
* @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
|
|
1210
1157
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1211
|
-
*
|
|
1212
|
-
* @beta
|
|
1213
1158
|
*/
|
|
1214
1159
|
async continueDialog(dc) {
|
|
1215
1160
|
var _a;
|
|
@@ -1414,8 +1359,6 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1414
1359
|
* ```typescript
|
|
1415
1360
|
* const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
|
|
1416
1361
|
* ```
|
|
1417
|
-
*
|
|
1418
|
-
* @beta
|
|
1419
1362
|
*/
|
|
1420
1363
|
function createApiClient(apiEndpoint, authProvider) {
|
|
1421
1364
|
// Add a request interceptor
|
|
@@ -1431,14 +1374,10 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1431
1374
|
// Copyright (c) Microsoft Corporation.
|
|
1432
1375
|
/**
|
|
1433
1376
|
* Provider that handles Bearer Token authentication
|
|
1434
|
-
*
|
|
1435
|
-
* @beta
|
|
1436
1377
|
*/
|
|
1437
1378
|
class BearerTokenAuthProvider {
|
|
1438
1379
|
/**
|
|
1439
1380
|
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
1440
|
-
*
|
|
1441
|
-
* @beta
|
|
1442
1381
|
*/
|
|
1443
1382
|
constructor(getToken) {
|
|
1444
1383
|
this.getToken = getToken;
|
|
@@ -1452,8 +1391,6 @@ class BearerTokenAuthProvider {
|
|
|
1452
1391
|
* @returns Updated axios request config.
|
|
1453
1392
|
*
|
|
1454
1393
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1455
|
-
*
|
|
1456
|
-
* @beta
|
|
1457
1394
|
*/
|
|
1458
1395
|
async AddAuthenticationInfo(config) {
|
|
1459
1396
|
const token = await this.getToken();
|
|
@@ -1471,8 +1408,6 @@ class BearerTokenAuthProvider {
|
|
|
1471
1408
|
// Copyright (c) Microsoft Corporation.
|
|
1472
1409
|
/**
|
|
1473
1410
|
* Provider that handles Basic authentication
|
|
1474
|
-
*
|
|
1475
|
-
* @beta
|
|
1476
1411
|
*/
|
|
1477
1412
|
class BasicAuthProvider {
|
|
1478
1413
|
/**
|
|
@@ -1482,8 +1417,6 @@ class BasicAuthProvider {
|
|
|
1482
1417
|
*
|
|
1483
1418
|
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
1484
1419
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1485
|
-
*
|
|
1486
|
-
* @beta
|
|
1487
1420
|
*/
|
|
1488
1421
|
constructor(userName, password) {
|
|
1489
1422
|
if (!userName) {
|
|
@@ -1505,8 +1438,6 @@ class BasicAuthProvider {
|
|
|
1505
1438
|
*
|
|
1506
1439
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1507
1440
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1508
|
-
*
|
|
1509
|
-
* @beta
|
|
1510
1441
|
*/
|
|
1511
1442
|
async AddAuthenticationInfo(config) {
|
|
1512
1443
|
if (config.headers && config.headers["Authorization"]) {
|
|
@@ -1526,8 +1457,6 @@ class BasicAuthProvider {
|
|
|
1526
1457
|
// Copyright (c) Microsoft Corporation.
|
|
1527
1458
|
/**
|
|
1528
1459
|
* Provider that handles API Key authentication
|
|
1529
|
-
*
|
|
1530
|
-
* @beta
|
|
1531
1460
|
*/
|
|
1532
1461
|
class ApiKeyProvider {
|
|
1533
1462
|
/**
|
|
@@ -1538,8 +1467,6 @@ class ApiKeyProvider {
|
|
|
1538
1467
|
*
|
|
1539
1468
|
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
1540
1469
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1541
|
-
*
|
|
1542
|
-
* @beta
|
|
1543
1470
|
*/
|
|
1544
1471
|
constructor(keyName, keyValue, keyLocation) {
|
|
1545
1472
|
if (!keyName) {
|
|
@@ -1562,8 +1489,6 @@ class ApiKeyProvider {
|
|
|
1562
1489
|
*
|
|
1563
1490
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
1564
1491
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1565
|
-
*
|
|
1566
|
-
* @beta
|
|
1567
1492
|
*/
|
|
1568
1493
|
async AddAuthenticationInfo(config) {
|
|
1569
1494
|
switch (this.keyLocation) {
|
|
@@ -1580,8 +1505,12 @@ class ApiKeyProvider {
|
|
|
1580
1505
|
if (!config.params) {
|
|
1581
1506
|
config.params = {};
|
|
1582
1507
|
}
|
|
1583
|
-
|
|
1584
|
-
if (config.
|
|
1508
|
+
let urlHasDefinedApiKey = false;
|
|
1509
|
+
if (config.url) {
|
|
1510
|
+
const url = new URL(config.url, config.baseURL);
|
|
1511
|
+
urlHasDefinedApiKey = url.searchParams.has(this.keyName);
|
|
1512
|
+
}
|
|
1513
|
+
if (config.params[this.keyName] || urlHasDefinedApiKey) {
|
|
1585
1514
|
throw new ErrorWithCode(formatString(ErrorMessage.DuplicateApiKeyInQueryParam, this.keyName), ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1586
1515
|
}
|
|
1587
1516
|
config.params[this.keyName] = this.keyValue;
|
|
@@ -1592,8 +1521,6 @@ class ApiKeyProvider {
|
|
|
1592
1521
|
}
|
|
1593
1522
|
/**
|
|
1594
1523
|
* Define available location for API Key location
|
|
1595
|
-
*
|
|
1596
|
-
* @beta
|
|
1597
1524
|
*/
|
|
1598
1525
|
var ApiKeyLocation;
|
|
1599
1526
|
(function (ApiKeyLocation) {
|
|
@@ -1610,8 +1537,6 @@ var ApiKeyLocation;
|
|
|
1610
1537
|
// Copyright (c) Microsoft Corporation.
|
|
1611
1538
|
/**
|
|
1612
1539
|
* Provider that handles Certificate authentication
|
|
1613
|
-
*
|
|
1614
|
-
* @beta
|
|
1615
1540
|
*/
|
|
1616
1541
|
class CertificateAuthProvider {
|
|
1617
1542
|
/**
|
|
@@ -1619,8 +1544,6 @@ class CertificateAuthProvider {
|
|
|
1619
1544
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1620
1545
|
*
|
|
1621
1546
|
* @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
|
|
1622
|
-
*
|
|
1623
|
-
* @beta
|
|
1624
1547
|
*/
|
|
1625
1548
|
constructor(certOption) {
|
|
1626
1549
|
if (certOption && Object.keys(certOption).length !== 0) {
|
|
@@ -1639,8 +1562,6 @@ class CertificateAuthProvider {
|
|
|
1639
1562
|
* @returns Updated axios request config.
|
|
1640
1563
|
*
|
|
1641
1564
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1642
|
-
*
|
|
1643
|
-
* @beta
|
|
1644
1565
|
*/
|
|
1645
1566
|
async AddAuthenticationInfo(config) {
|
|
1646
1567
|
if (!config.httpsAgent) {
|
|
@@ -1724,7 +1645,6 @@ const ReservedKey = new Set([
|
|
|
1724
1645
|
]);
|
|
1725
1646
|
/**
|
|
1726
1647
|
* A class providing credential and configuration.
|
|
1727
|
-
* @beta
|
|
1728
1648
|
*/
|
|
1729
1649
|
class TeamsFx {
|
|
1730
1650
|
/**
|
|
@@ -1734,8 +1654,6 @@ class TeamsFx {
|
|
|
1734
1654
|
* @param customConfig - key/value pairs of customized configuration that overrides default ones.
|
|
1735
1655
|
*
|
|
1736
1656
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1737
|
-
*
|
|
1738
|
-
* @beta
|
|
1739
1657
|
*/
|
|
1740
1658
|
constructor(identityType, customConfig) {
|
|
1741
1659
|
this.identityType = identityType !== null && identityType !== void 0 ? identityType : IdentityType.User;
|
|
@@ -1754,7 +1672,6 @@ class TeamsFx {
|
|
|
1754
1672
|
* Identity type set by user.
|
|
1755
1673
|
*
|
|
1756
1674
|
* @returns identity type.
|
|
1757
|
-
* @beta
|
|
1758
1675
|
*/
|
|
1759
1676
|
getIdentityType() {
|
|
1760
1677
|
return this.identityType;
|
|
@@ -1767,7 +1684,6 @@ class TeamsFx {
|
|
|
1767
1684
|
* identity is chose, will return {@link AppCredential}.
|
|
1768
1685
|
*
|
|
1769
1686
|
* @returns instance implements TokenCredential interface.
|
|
1770
|
-
* @beta
|
|
1771
1687
|
*/
|
|
1772
1688
|
getCredential() {
|
|
1773
1689
|
if (this.identityType === IdentityType.User) {
|
|
@@ -1788,7 +1704,6 @@ class TeamsFx {
|
|
|
1788
1704
|
/**
|
|
1789
1705
|
* Get user information.
|
|
1790
1706
|
* @returns UserInfo object.
|
|
1791
|
-
* @beta
|
|
1792
1707
|
*/
|
|
1793
1708
|
async getUserInfo() {
|
|
1794
1709
|
if (this.identityType !== IdentityType.User) {
|
|
@@ -1817,8 +1732,6 @@ class TeamsFx {
|
|
|
1817
1732
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1818
1733
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1819
1734
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1820
|
-
*
|
|
1821
|
-
* @beta
|
|
1822
1735
|
*/
|
|
1823
1736
|
async login(scopes) {
|
|
1824
1737
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "login"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1827,7 +1740,6 @@ class TeamsFx {
|
|
|
1827
1740
|
* Set SSO token when using user identity in NodeJS.
|
|
1828
1741
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1829
1742
|
* @returns self instance.
|
|
1830
|
-
* @beta
|
|
1831
1743
|
*/
|
|
1832
1744
|
setSsoToken(ssoToken) {
|
|
1833
1745
|
if (this.identityType !== IdentityType.User) {
|
|
@@ -1840,7 +1752,6 @@ class TeamsFx {
|
|
|
1840
1752
|
* Usually used by service plugins to retrieve specific config
|
|
1841
1753
|
* @param {string} key - configuration key.
|
|
1842
1754
|
* @returns value in configuration.
|
|
1843
|
-
* @beta
|
|
1844
1755
|
*/
|
|
1845
1756
|
getConfig(key) {
|
|
1846
1757
|
const value = this.configuration.get(key);
|
|
@@ -1855,7 +1766,6 @@ class TeamsFx {
|
|
|
1855
1766
|
* Check the value of specific key.
|
|
1856
1767
|
* @param {string} key - configuration key.
|
|
1857
1768
|
* @returns true if corresponding value is not empty string.
|
|
1858
|
-
* @beta
|
|
1859
1769
|
*/
|
|
1860
1770
|
hasConfig(key) {
|
|
1861
1771
|
const value = this.configuration.get(key);
|
|
@@ -1864,7 +1774,6 @@ class TeamsFx {
|
|
|
1864
1774
|
/**
|
|
1865
1775
|
* Get all configurations.
|
|
1866
1776
|
* @returns key value mappings.
|
|
1867
|
-
* @beta
|
|
1868
1777
|
*/
|
|
1869
1778
|
getConfigs() {
|
|
1870
1779
|
const config = {};
|
|
@@ -2103,8 +2012,6 @@ class CommandResponseMiddleware {
|
|
|
2103
2012
|
*
|
|
2104
2013
|
* @remarks
|
|
2105
2014
|
* 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.
|
|
2106
|
-
*
|
|
2107
|
-
* @beta
|
|
2108
2015
|
*/
|
|
2109
2016
|
class CommandBot {
|
|
2110
2017
|
/**
|
|
@@ -2112,8 +2019,6 @@ class CommandBot {
|
|
|
2112
2019
|
*
|
|
2113
2020
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
2114
2021
|
* @param options - initialize options
|
|
2115
|
-
*
|
|
2116
|
-
* @beta
|
|
2117
2022
|
*/
|
|
2118
2023
|
constructor(adapter, options) {
|
|
2119
2024
|
this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands);
|
|
@@ -2123,8 +2028,6 @@ class CommandBot {
|
|
|
2123
2028
|
* Registers a command into the command bot.
|
|
2124
2029
|
*
|
|
2125
2030
|
* @param command The command to registered.
|
|
2126
|
-
*
|
|
2127
|
-
* @beta
|
|
2128
2031
|
*/
|
|
2129
2032
|
registerCommand(command) {
|
|
2130
2033
|
if (command) {
|
|
@@ -2135,8 +2038,6 @@ class CommandBot {
|
|
|
2135
2038
|
* Registers commands into the command bot.
|
|
2136
2039
|
*
|
|
2137
2040
|
* @param commands The command to registered.
|
|
2138
|
-
*
|
|
2139
|
-
* @beta
|
|
2140
2041
|
*/
|
|
2141
2042
|
registerCommands(commands) {
|
|
2142
2043
|
if (commands) {
|
|
@@ -2271,8 +2172,6 @@ class ConversationReferenceStore {
|
|
|
2271
2172
|
* @param target - the notification target.
|
|
2272
2173
|
* @param text - the plain text message.
|
|
2273
2174
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2274
|
-
*
|
|
2275
|
-
* @beta
|
|
2276
2175
|
*/
|
|
2277
2176
|
function sendMessage(target, text) {
|
|
2278
2177
|
return target.sendMessage(text);
|
|
@@ -2283,8 +2182,6 @@ function sendMessage(target, text) {
|
|
|
2283
2182
|
* @param target - the notification target.
|
|
2284
2183
|
* @param card - the adaptive card raw JSON.
|
|
2285
2184
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2286
|
-
*
|
|
2287
|
-
* @beta
|
|
2288
2185
|
*/
|
|
2289
2186
|
function sendAdaptiveCard(target, card) {
|
|
2290
2187
|
return target.sendAdaptiveCard(card);
|
|
@@ -2294,8 +2191,6 @@ function sendAdaptiveCard(target, card) {
|
|
|
2294
2191
|
*
|
|
2295
2192
|
* @remarks
|
|
2296
2193
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
2297
|
-
*
|
|
2298
|
-
* @beta
|
|
2299
2194
|
*/
|
|
2300
2195
|
class Channel {
|
|
2301
2196
|
/**
|
|
@@ -2306,14 +2201,10 @@ class Channel {
|
|
|
2306
2201
|
*
|
|
2307
2202
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
2308
2203
|
* @param info - Detailed channel information.
|
|
2309
|
-
*
|
|
2310
|
-
* @beta
|
|
2311
2204
|
*/
|
|
2312
2205
|
constructor(parent, info) {
|
|
2313
2206
|
/**
|
|
2314
2207
|
* Notification target type. For channel it's always "Channel".
|
|
2315
|
-
*
|
|
2316
|
-
* @beta
|
|
2317
2208
|
*/
|
|
2318
2209
|
this.type = "Channel";
|
|
2319
2210
|
this.parent = parent;
|
|
@@ -2324,8 +2215,6 @@ class Channel {
|
|
|
2324
2215
|
*
|
|
2325
2216
|
* @param text - the plain text message.
|
|
2326
2217
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2327
|
-
*
|
|
2328
|
-
* @beta
|
|
2329
2218
|
*/
|
|
2330
2219
|
sendMessage(text) {
|
|
2331
2220
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2340,8 +2229,6 @@ class Channel {
|
|
|
2340
2229
|
*
|
|
2341
2230
|
* @param card - the adaptive card raw JSON.
|
|
2342
2231
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2343
|
-
*
|
|
2344
|
-
* @beta
|
|
2345
2232
|
*/
|
|
2346
2233
|
async sendAdaptiveCard(card) {
|
|
2347
2234
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2368,8 +2255,6 @@ class Channel {
|
|
|
2368
2255
|
*
|
|
2369
2256
|
* @remarks
|
|
2370
2257
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
2371
|
-
*
|
|
2372
|
-
* @beta
|
|
2373
2258
|
*/
|
|
2374
2259
|
class Member {
|
|
2375
2260
|
/**
|
|
@@ -2380,14 +2265,10 @@ class Member {
|
|
|
2380
2265
|
*
|
|
2381
2266
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
2382
2267
|
* @param account - Detailed member account information.
|
|
2383
|
-
*
|
|
2384
|
-
* @beta
|
|
2385
2268
|
*/
|
|
2386
2269
|
constructor(parent, account) {
|
|
2387
2270
|
/**
|
|
2388
2271
|
* Notification target type. For member it's always "Person".
|
|
2389
|
-
*
|
|
2390
|
-
* @beta
|
|
2391
2272
|
*/
|
|
2392
2273
|
this.type = "Person";
|
|
2393
2274
|
this.parent = parent;
|
|
@@ -2398,8 +2279,6 @@ class Member {
|
|
|
2398
2279
|
*
|
|
2399
2280
|
* @param text - the plain text message.
|
|
2400
2281
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2401
|
-
*
|
|
2402
|
-
* @beta
|
|
2403
2282
|
*/
|
|
2404
2283
|
sendMessage(text) {
|
|
2405
2284
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2414,8 +2293,6 @@ class Member {
|
|
|
2414
2293
|
*
|
|
2415
2294
|
* @param card - the adaptive card raw JSON.
|
|
2416
2295
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2417
|
-
*
|
|
2418
|
-
* @beta
|
|
2419
2296
|
*/
|
|
2420
2297
|
async sendAdaptiveCard(card) {
|
|
2421
2298
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2453,8 +2330,6 @@ class Member {
|
|
|
2453
2330
|
*
|
|
2454
2331
|
* @remarks
|
|
2455
2332
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
2456
|
-
*
|
|
2457
|
-
* @beta
|
|
2458
2333
|
*/
|
|
2459
2334
|
class TeamsBotInstallation {
|
|
2460
2335
|
/**
|
|
@@ -2465,8 +2340,6 @@ class TeamsBotInstallation {
|
|
|
2465
2340
|
*
|
|
2466
2341
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
2467
2342
|
* @param conversationReference - the bound `ConversationReference`.
|
|
2468
|
-
*
|
|
2469
|
-
* @beta
|
|
2470
2343
|
*/
|
|
2471
2344
|
constructor(adapter, conversationReference) {
|
|
2472
2345
|
this.adapter = adapter;
|
|
@@ -2478,8 +2351,6 @@ class TeamsBotInstallation {
|
|
|
2478
2351
|
*
|
|
2479
2352
|
* @param text - the plain text message.
|
|
2480
2353
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2481
|
-
*
|
|
2482
|
-
* @beta
|
|
2483
2354
|
*/
|
|
2484
2355
|
sendMessage(text) {
|
|
2485
2356
|
return this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
@@ -2491,8 +2362,6 @@ class TeamsBotInstallation {
|
|
|
2491
2362
|
*
|
|
2492
2363
|
* @param card - the adaptive card raw JSON.
|
|
2493
2364
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2494
|
-
*
|
|
2495
|
-
* @beta
|
|
2496
2365
|
*/
|
|
2497
2366
|
sendAdaptiveCard(card) {
|
|
2498
2367
|
return this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
@@ -2505,8 +2374,6 @@ class TeamsBotInstallation {
|
|
|
2505
2374
|
* Get channels from this bot installation.
|
|
2506
2375
|
*
|
|
2507
2376
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
2508
|
-
*
|
|
2509
|
-
* @beta
|
|
2510
2377
|
*/
|
|
2511
2378
|
async channels() {
|
|
2512
2379
|
let teamsChannels = [];
|
|
@@ -2526,8 +2393,6 @@ class TeamsBotInstallation {
|
|
|
2526
2393
|
* Get members from this bot installation.
|
|
2527
2394
|
*
|
|
2528
2395
|
* @returns an array of members from where the bot is installed.
|
|
2529
|
-
*
|
|
2530
|
-
* @beta
|
|
2531
2396
|
*/
|
|
2532
2397
|
async members() {
|
|
2533
2398
|
const members = [];
|
|
@@ -2546,8 +2411,6 @@ class TeamsBotInstallation {
|
|
|
2546
2411
|
}
|
|
2547
2412
|
/**
|
|
2548
2413
|
* Provide utilities to send notification to varies targets (e.g., member, group, channel).
|
|
2549
|
-
*
|
|
2550
|
-
* @beta
|
|
2551
2414
|
*/
|
|
2552
2415
|
class NotificationBot {
|
|
2553
2416
|
/**
|
|
@@ -2558,8 +2421,6 @@ class NotificationBot {
|
|
|
2558
2421
|
*
|
|
2559
2422
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
2560
2423
|
* @param options - initialize options
|
|
2561
|
-
*
|
|
2562
|
-
* @beta
|
|
2563
2424
|
*/
|
|
2564
2425
|
constructor(adapter, options) {
|
|
2565
2426
|
var _a, _b;
|
|
@@ -2576,8 +2437,6 @@ class NotificationBot {
|
|
|
2576
2437
|
* The result is retrieving from the persisted storage.
|
|
2577
2438
|
*
|
|
2578
2439
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
2579
|
-
*
|
|
2580
|
-
* @beta
|
|
2581
2440
|
*/
|
|
2582
2441
|
async installations() {
|
|
2583
2442
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
|
@@ -2661,8 +2520,6 @@ class NotificationBot {
|
|
|
2661
2520
|
* 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.
|
|
2662
2521
|
*
|
|
2663
2522
|
* For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
|
|
2664
|
-
*
|
|
2665
|
-
* @beta
|
|
2666
2523
|
*/
|
|
2667
2524
|
class ConversationBot {
|
|
2668
2525
|
/**
|
|
@@ -2672,8 +2529,6 @@ class ConversationBot {
|
|
|
2672
2529
|
* It's recommended to create your own adapter and storage for production environment instead of the default one.
|
|
2673
2530
|
*
|
|
2674
2531
|
* @param options - initialize options
|
|
2675
|
-
*
|
|
2676
|
-
* @beta
|
|
2677
2532
|
*/
|
|
2678
2533
|
constructor(options) {
|
|
2679
2534
|
var _a, _b;
|
|
@@ -2729,8 +2584,6 @@ class ConversationBot {
|
|
|
2729
2584
|
* });
|
|
2730
2585
|
* });
|
|
2731
2586
|
* ```
|
|
2732
|
-
*
|
|
2733
|
-
* @beta
|
|
2734
2587
|
*/
|
|
2735
2588
|
async requestHandler(req, res, logic) {
|
|
2736
2589
|
if (logic === undefined) {
|
|
@@ -2781,8 +2634,6 @@ class MessageBuilder {
|
|
|
2781
2634
|
* description: "sample card description"
|
|
2782
2635
|
* });
|
|
2783
2636
|
* ```
|
|
2784
|
-
*
|
|
2785
|
-
* @beta
|
|
2786
2637
|
*/
|
|
2787
2638
|
static attachAdaptiveCard(cardTemplate, data) {
|
|
2788
2639
|
return {
|
|
@@ -2794,8 +2645,6 @@ class MessageBuilder {
|
|
|
2794
2645
|
*
|
|
2795
2646
|
* @param card The adaptive card content.
|
|
2796
2647
|
* @returns A bot message activity attached with an adaptive card.
|
|
2797
|
-
*
|
|
2798
|
-
* @beta
|
|
2799
2648
|
*/
|
|
2800
2649
|
static attachAdaptiveCardWithoutData(card) {
|
|
2801
2650
|
return {
|
|
@@ -2821,8 +2670,6 @@ class MessageBuilder {
|
|
|
2821
2670
|
* ['action']
|
|
2822
2671
|
* );
|
|
2823
2672
|
* ```
|
|
2824
|
-
*
|
|
2825
|
-
* @beta
|
|
2826
2673
|
*/
|
|
2827
2674
|
static attachHeroCard(title, images, buttons, other) {
|
|
2828
2675
|
return MessageBuilder.attachContent(CardFactory.heroCard(title, images, buttons, other));
|
|
@@ -2838,8 +2685,6 @@ class MessageBuilder {
|
|
|
2838
2685
|
*
|
|
2839
2686
|
* @remarks
|
|
2840
2687
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
2841
|
-
*
|
|
2842
|
-
* @beta
|
|
2843
2688
|
*/
|
|
2844
2689
|
static attachSigninCard(title, url, text) {
|
|
2845
2690
|
return MessageBuilder.attachContent(CardFactory.signinCard(title, url, text));
|
|
@@ -2849,8 +2694,6 @@ class MessageBuilder {
|
|
|
2849
2694
|
*
|
|
2850
2695
|
* @param card A description of the Office 365 connector card.
|
|
2851
2696
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
2852
|
-
*
|
|
2853
|
-
* @beta
|
|
2854
2697
|
*/
|
|
2855
2698
|
static attachO365ConnectorCard(card) {
|
|
2856
2699
|
return MessageBuilder.attachContent(CardFactory.o365ConnectorCard(card));
|
|
@@ -2859,8 +2702,6 @@ class MessageBuilder {
|
|
|
2859
2702
|
* Build a message activity attached with a receipt card.
|
|
2860
2703
|
* @param card A description of the receipt card.
|
|
2861
2704
|
* @returns A message activity attached with a receipt card.
|
|
2862
|
-
*
|
|
2863
|
-
* @beta
|
|
2864
2705
|
*/
|
|
2865
2706
|
static AttachReceiptCard(card) {
|
|
2866
2707
|
return MessageBuilder.attachContent(CardFactory.receiptCard(card));
|
|
@@ -2873,8 +2714,6 @@ class MessageBuilder {
|
|
|
2873
2714
|
* is converted to an `imBack` button with a title and value set to the value of the string.
|
|
2874
2715
|
* @param other Optional. Any additional properties to include on the card.
|
|
2875
2716
|
* @returns A message activity attached with a thumbnail card
|
|
2876
|
-
*
|
|
2877
|
-
* @beta
|
|
2878
2717
|
*/
|
|
2879
2718
|
static attachThumbnailCard(title, images, buttons, other) {
|
|
2880
2719
|
return MessageBuilder.attachContent(CardFactory.thumbnailCard(title, images, buttons, other));
|
|
@@ -2883,8 +2722,6 @@ class MessageBuilder {
|
|
|
2883
2722
|
* Add an attachement to a bot activity.
|
|
2884
2723
|
* @param attachement The attachment object to attach.
|
|
2885
2724
|
* @returns A message activity with an attachment.
|
|
2886
|
-
*
|
|
2887
|
-
* @beta
|
|
2888
2725
|
*/
|
|
2889
2726
|
static attachContent(attachement) {
|
|
2890
2727
|
return {
|