@microsoft/teamsfx 1.0.1-alpha.4edf8c10a.0 → 1.0.1-alpha.dbef2ba70.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 +0 -167
- 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 +0 -167
- 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) {
|
|
@@ -1596,8 +1521,6 @@ class ApiKeyProvider {
|
|
|
1596
1521
|
}
|
|
1597
1522
|
/**
|
|
1598
1523
|
* Define available location for API Key location
|
|
1599
|
-
*
|
|
1600
|
-
* @beta
|
|
1601
1524
|
*/
|
|
1602
1525
|
var ApiKeyLocation;
|
|
1603
1526
|
(function (ApiKeyLocation) {
|
|
@@ -1614,8 +1537,6 @@ var ApiKeyLocation;
|
|
|
1614
1537
|
// Copyright (c) Microsoft Corporation.
|
|
1615
1538
|
/**
|
|
1616
1539
|
* Provider that handles Certificate authentication
|
|
1617
|
-
*
|
|
1618
|
-
* @beta
|
|
1619
1540
|
*/
|
|
1620
1541
|
class CertificateAuthProvider {
|
|
1621
1542
|
/**
|
|
@@ -1623,8 +1544,6 @@ class CertificateAuthProvider {
|
|
|
1623
1544
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1624
1545
|
*
|
|
1625
1546
|
* @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
|
|
1626
|
-
*
|
|
1627
|
-
* @beta
|
|
1628
1547
|
*/
|
|
1629
1548
|
constructor(certOption) {
|
|
1630
1549
|
if (certOption && Object.keys(certOption).length !== 0) {
|
|
@@ -1643,8 +1562,6 @@ class CertificateAuthProvider {
|
|
|
1643
1562
|
* @returns Updated axios request config.
|
|
1644
1563
|
*
|
|
1645
1564
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1646
|
-
*
|
|
1647
|
-
* @beta
|
|
1648
1565
|
*/
|
|
1649
1566
|
async AddAuthenticationInfo(config) {
|
|
1650
1567
|
if (!config.httpsAgent) {
|
|
@@ -1728,7 +1645,6 @@ const ReservedKey = new Set([
|
|
|
1728
1645
|
]);
|
|
1729
1646
|
/**
|
|
1730
1647
|
* A class providing credential and configuration.
|
|
1731
|
-
* @beta
|
|
1732
1648
|
*/
|
|
1733
1649
|
class TeamsFx {
|
|
1734
1650
|
/**
|
|
@@ -1738,8 +1654,6 @@ class TeamsFx {
|
|
|
1738
1654
|
* @param customConfig - key/value pairs of customized configuration that overrides default ones.
|
|
1739
1655
|
*
|
|
1740
1656
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1741
|
-
*
|
|
1742
|
-
* @beta
|
|
1743
1657
|
*/
|
|
1744
1658
|
constructor(identityType, customConfig) {
|
|
1745
1659
|
this.identityType = identityType !== null && identityType !== void 0 ? identityType : IdentityType.User;
|
|
@@ -1758,7 +1672,6 @@ class TeamsFx {
|
|
|
1758
1672
|
* Identity type set by user.
|
|
1759
1673
|
*
|
|
1760
1674
|
* @returns identity type.
|
|
1761
|
-
* @beta
|
|
1762
1675
|
*/
|
|
1763
1676
|
getIdentityType() {
|
|
1764
1677
|
return this.identityType;
|
|
@@ -1771,7 +1684,6 @@ class TeamsFx {
|
|
|
1771
1684
|
* identity is chose, will return {@link AppCredential}.
|
|
1772
1685
|
*
|
|
1773
1686
|
* @returns instance implements TokenCredential interface.
|
|
1774
|
-
* @beta
|
|
1775
1687
|
*/
|
|
1776
1688
|
getCredential() {
|
|
1777
1689
|
if (this.identityType === IdentityType.User) {
|
|
@@ -1792,7 +1704,6 @@ class TeamsFx {
|
|
|
1792
1704
|
/**
|
|
1793
1705
|
* Get user information.
|
|
1794
1706
|
* @returns UserInfo object.
|
|
1795
|
-
* @beta
|
|
1796
1707
|
*/
|
|
1797
1708
|
async getUserInfo() {
|
|
1798
1709
|
if (this.identityType !== IdentityType.User) {
|
|
@@ -1821,8 +1732,6 @@ class TeamsFx {
|
|
|
1821
1732
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1822
1733
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1823
1734
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1824
|
-
*
|
|
1825
|
-
* @beta
|
|
1826
1735
|
*/
|
|
1827
1736
|
async login(scopes) {
|
|
1828
1737
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "login"), ErrorCode.RuntimeNotSupported);
|
|
@@ -1831,7 +1740,6 @@ class TeamsFx {
|
|
|
1831
1740
|
* Set SSO token when using user identity in NodeJS.
|
|
1832
1741
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1833
1742
|
* @returns self instance.
|
|
1834
|
-
* @beta
|
|
1835
1743
|
*/
|
|
1836
1744
|
setSsoToken(ssoToken) {
|
|
1837
1745
|
if (this.identityType !== IdentityType.User) {
|
|
@@ -1844,7 +1752,6 @@ class TeamsFx {
|
|
|
1844
1752
|
* Usually used by service plugins to retrieve specific config
|
|
1845
1753
|
* @param {string} key - configuration key.
|
|
1846
1754
|
* @returns value in configuration.
|
|
1847
|
-
* @beta
|
|
1848
1755
|
*/
|
|
1849
1756
|
getConfig(key) {
|
|
1850
1757
|
const value = this.configuration.get(key);
|
|
@@ -1859,7 +1766,6 @@ class TeamsFx {
|
|
|
1859
1766
|
* Check the value of specific key.
|
|
1860
1767
|
* @param {string} key - configuration key.
|
|
1861
1768
|
* @returns true if corresponding value is not empty string.
|
|
1862
|
-
* @beta
|
|
1863
1769
|
*/
|
|
1864
1770
|
hasConfig(key) {
|
|
1865
1771
|
const value = this.configuration.get(key);
|
|
@@ -1868,7 +1774,6 @@ class TeamsFx {
|
|
|
1868
1774
|
/**
|
|
1869
1775
|
* Get all configurations.
|
|
1870
1776
|
* @returns key value mappings.
|
|
1871
|
-
* @beta
|
|
1872
1777
|
*/
|
|
1873
1778
|
getConfigs() {
|
|
1874
1779
|
const config = {};
|
|
@@ -2107,8 +2012,6 @@ class CommandResponseMiddleware {
|
|
|
2107
2012
|
*
|
|
2108
2013
|
* @remarks
|
|
2109
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.
|
|
2110
|
-
*
|
|
2111
|
-
* @beta
|
|
2112
2015
|
*/
|
|
2113
2016
|
class CommandBot {
|
|
2114
2017
|
/**
|
|
@@ -2116,8 +2019,6 @@ class CommandBot {
|
|
|
2116
2019
|
*
|
|
2117
2020
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
2118
2021
|
* @param options - initialize options
|
|
2119
|
-
*
|
|
2120
|
-
* @beta
|
|
2121
2022
|
*/
|
|
2122
2023
|
constructor(adapter, options) {
|
|
2123
2024
|
this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands);
|
|
@@ -2127,8 +2028,6 @@ class CommandBot {
|
|
|
2127
2028
|
* Registers a command into the command bot.
|
|
2128
2029
|
*
|
|
2129
2030
|
* @param command The command to registered.
|
|
2130
|
-
*
|
|
2131
|
-
* @beta
|
|
2132
2031
|
*/
|
|
2133
2032
|
registerCommand(command) {
|
|
2134
2033
|
if (command) {
|
|
@@ -2139,8 +2038,6 @@ class CommandBot {
|
|
|
2139
2038
|
* Registers commands into the command bot.
|
|
2140
2039
|
*
|
|
2141
2040
|
* @param commands The command to registered.
|
|
2142
|
-
*
|
|
2143
|
-
* @beta
|
|
2144
2041
|
*/
|
|
2145
2042
|
registerCommands(commands) {
|
|
2146
2043
|
if (commands) {
|
|
@@ -2275,8 +2172,6 @@ class ConversationReferenceStore {
|
|
|
2275
2172
|
* @param target - the notification target.
|
|
2276
2173
|
* @param text - the plain text message.
|
|
2277
2174
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2278
|
-
*
|
|
2279
|
-
* @beta
|
|
2280
2175
|
*/
|
|
2281
2176
|
function sendMessage(target, text) {
|
|
2282
2177
|
return target.sendMessage(text);
|
|
@@ -2287,8 +2182,6 @@ function sendMessage(target, text) {
|
|
|
2287
2182
|
* @param target - the notification target.
|
|
2288
2183
|
* @param card - the adaptive card raw JSON.
|
|
2289
2184
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2290
|
-
*
|
|
2291
|
-
* @beta
|
|
2292
2185
|
*/
|
|
2293
2186
|
function sendAdaptiveCard(target, card) {
|
|
2294
2187
|
return target.sendAdaptiveCard(card);
|
|
@@ -2298,8 +2191,6 @@ function sendAdaptiveCard(target, card) {
|
|
|
2298
2191
|
*
|
|
2299
2192
|
* @remarks
|
|
2300
2193
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
2301
|
-
*
|
|
2302
|
-
* @beta
|
|
2303
2194
|
*/
|
|
2304
2195
|
class Channel {
|
|
2305
2196
|
/**
|
|
@@ -2310,14 +2201,10 @@ class Channel {
|
|
|
2310
2201
|
*
|
|
2311
2202
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
2312
2203
|
* @param info - Detailed channel information.
|
|
2313
|
-
*
|
|
2314
|
-
* @beta
|
|
2315
2204
|
*/
|
|
2316
2205
|
constructor(parent, info) {
|
|
2317
2206
|
/**
|
|
2318
2207
|
* Notification target type. For channel it's always "Channel".
|
|
2319
|
-
*
|
|
2320
|
-
* @beta
|
|
2321
2208
|
*/
|
|
2322
2209
|
this.type = "Channel";
|
|
2323
2210
|
this.parent = parent;
|
|
@@ -2328,8 +2215,6 @@ class Channel {
|
|
|
2328
2215
|
*
|
|
2329
2216
|
* @param text - the plain text message.
|
|
2330
2217
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2331
|
-
*
|
|
2332
|
-
* @beta
|
|
2333
2218
|
*/
|
|
2334
2219
|
sendMessage(text) {
|
|
2335
2220
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2344,8 +2229,6 @@ class Channel {
|
|
|
2344
2229
|
*
|
|
2345
2230
|
* @param card - the adaptive card raw JSON.
|
|
2346
2231
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2347
|
-
*
|
|
2348
|
-
* @beta
|
|
2349
2232
|
*/
|
|
2350
2233
|
async sendAdaptiveCard(card) {
|
|
2351
2234
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2372,8 +2255,6 @@ class Channel {
|
|
|
2372
2255
|
*
|
|
2373
2256
|
* @remarks
|
|
2374
2257
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
2375
|
-
*
|
|
2376
|
-
* @beta
|
|
2377
2258
|
*/
|
|
2378
2259
|
class Member {
|
|
2379
2260
|
/**
|
|
@@ -2384,14 +2265,10 @@ class Member {
|
|
|
2384
2265
|
*
|
|
2385
2266
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
2386
2267
|
* @param account - Detailed member account information.
|
|
2387
|
-
*
|
|
2388
|
-
* @beta
|
|
2389
2268
|
*/
|
|
2390
2269
|
constructor(parent, account) {
|
|
2391
2270
|
/**
|
|
2392
2271
|
* Notification target type. For member it's always "Person".
|
|
2393
|
-
*
|
|
2394
|
-
* @beta
|
|
2395
2272
|
*/
|
|
2396
2273
|
this.type = "Person";
|
|
2397
2274
|
this.parent = parent;
|
|
@@ -2402,8 +2279,6 @@ class Member {
|
|
|
2402
2279
|
*
|
|
2403
2280
|
* @param text - the plain text message.
|
|
2404
2281
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2405
|
-
*
|
|
2406
|
-
* @beta
|
|
2407
2282
|
*/
|
|
2408
2283
|
sendMessage(text) {
|
|
2409
2284
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2418,8 +2293,6 @@ class Member {
|
|
|
2418
2293
|
*
|
|
2419
2294
|
* @param card - the adaptive card raw JSON.
|
|
2420
2295
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2421
|
-
*
|
|
2422
|
-
* @beta
|
|
2423
2296
|
*/
|
|
2424
2297
|
async sendAdaptiveCard(card) {
|
|
2425
2298
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
@@ -2457,8 +2330,6 @@ class Member {
|
|
|
2457
2330
|
*
|
|
2458
2331
|
* @remarks
|
|
2459
2332
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
2460
|
-
*
|
|
2461
|
-
* @beta
|
|
2462
2333
|
*/
|
|
2463
2334
|
class TeamsBotInstallation {
|
|
2464
2335
|
/**
|
|
@@ -2469,8 +2340,6 @@ class TeamsBotInstallation {
|
|
|
2469
2340
|
*
|
|
2470
2341
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
2471
2342
|
* @param conversationReference - the bound `ConversationReference`.
|
|
2472
|
-
*
|
|
2473
|
-
* @beta
|
|
2474
2343
|
*/
|
|
2475
2344
|
constructor(adapter, conversationReference) {
|
|
2476
2345
|
this.adapter = adapter;
|
|
@@ -2482,8 +2351,6 @@ class TeamsBotInstallation {
|
|
|
2482
2351
|
*
|
|
2483
2352
|
* @param text - the plain text message.
|
|
2484
2353
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2485
|
-
*
|
|
2486
|
-
* @beta
|
|
2487
2354
|
*/
|
|
2488
2355
|
sendMessage(text) {
|
|
2489
2356
|
return this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
@@ -2495,8 +2362,6 @@ class TeamsBotInstallation {
|
|
|
2495
2362
|
*
|
|
2496
2363
|
* @param card - the adaptive card raw JSON.
|
|
2497
2364
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2498
|
-
*
|
|
2499
|
-
* @beta
|
|
2500
2365
|
*/
|
|
2501
2366
|
sendAdaptiveCard(card) {
|
|
2502
2367
|
return this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
@@ -2509,8 +2374,6 @@ class TeamsBotInstallation {
|
|
|
2509
2374
|
* Get channels from this bot installation.
|
|
2510
2375
|
*
|
|
2511
2376
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
2512
|
-
*
|
|
2513
|
-
* @beta
|
|
2514
2377
|
*/
|
|
2515
2378
|
async channels() {
|
|
2516
2379
|
let teamsChannels = [];
|
|
@@ -2530,8 +2393,6 @@ class TeamsBotInstallation {
|
|
|
2530
2393
|
* Get members from this bot installation.
|
|
2531
2394
|
*
|
|
2532
2395
|
* @returns an array of members from where the bot is installed.
|
|
2533
|
-
*
|
|
2534
|
-
* @beta
|
|
2535
2396
|
*/
|
|
2536
2397
|
async members() {
|
|
2537
2398
|
const members = [];
|
|
@@ -2550,8 +2411,6 @@ class TeamsBotInstallation {
|
|
|
2550
2411
|
}
|
|
2551
2412
|
/**
|
|
2552
2413
|
* Provide utilities to send notification to varies targets (e.g., member, group, channel).
|
|
2553
|
-
*
|
|
2554
|
-
* @beta
|
|
2555
2414
|
*/
|
|
2556
2415
|
class NotificationBot {
|
|
2557
2416
|
/**
|
|
@@ -2562,8 +2421,6 @@ class NotificationBot {
|
|
|
2562
2421
|
*
|
|
2563
2422
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
2564
2423
|
* @param options - initialize options
|
|
2565
|
-
*
|
|
2566
|
-
* @beta
|
|
2567
2424
|
*/
|
|
2568
2425
|
constructor(adapter, options) {
|
|
2569
2426
|
var _a, _b;
|
|
@@ -2580,8 +2437,6 @@ class NotificationBot {
|
|
|
2580
2437
|
* The result is retrieving from the persisted storage.
|
|
2581
2438
|
*
|
|
2582
2439
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
2583
|
-
*
|
|
2584
|
-
* @beta
|
|
2585
2440
|
*/
|
|
2586
2441
|
async installations() {
|
|
2587
2442
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
|
@@ -2665,8 +2520,6 @@ class NotificationBot {
|
|
|
2665
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.
|
|
2666
2521
|
*
|
|
2667
2522
|
* For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
|
|
2668
|
-
*
|
|
2669
|
-
* @beta
|
|
2670
2523
|
*/
|
|
2671
2524
|
class ConversationBot {
|
|
2672
2525
|
/**
|
|
@@ -2676,8 +2529,6 @@ class ConversationBot {
|
|
|
2676
2529
|
* It's recommended to create your own adapter and storage for production environment instead of the default one.
|
|
2677
2530
|
*
|
|
2678
2531
|
* @param options - initialize options
|
|
2679
|
-
*
|
|
2680
|
-
* @beta
|
|
2681
2532
|
*/
|
|
2682
2533
|
constructor(options) {
|
|
2683
2534
|
var _a, _b;
|
|
@@ -2733,8 +2584,6 @@ class ConversationBot {
|
|
|
2733
2584
|
* });
|
|
2734
2585
|
* });
|
|
2735
2586
|
* ```
|
|
2736
|
-
*
|
|
2737
|
-
* @beta
|
|
2738
2587
|
*/
|
|
2739
2588
|
async requestHandler(req, res, logic) {
|
|
2740
2589
|
if (logic === undefined) {
|
|
@@ -2785,8 +2634,6 @@ class MessageBuilder {
|
|
|
2785
2634
|
* description: "sample card description"
|
|
2786
2635
|
* });
|
|
2787
2636
|
* ```
|
|
2788
|
-
*
|
|
2789
|
-
* @beta
|
|
2790
2637
|
*/
|
|
2791
2638
|
static attachAdaptiveCard(cardTemplate, data) {
|
|
2792
2639
|
return {
|
|
@@ -2798,8 +2645,6 @@ class MessageBuilder {
|
|
|
2798
2645
|
*
|
|
2799
2646
|
* @param card The adaptive card content.
|
|
2800
2647
|
* @returns A bot message activity attached with an adaptive card.
|
|
2801
|
-
*
|
|
2802
|
-
* @beta
|
|
2803
2648
|
*/
|
|
2804
2649
|
static attachAdaptiveCardWithoutData(card) {
|
|
2805
2650
|
return {
|
|
@@ -2825,8 +2670,6 @@ class MessageBuilder {
|
|
|
2825
2670
|
* ['action']
|
|
2826
2671
|
* );
|
|
2827
2672
|
* ```
|
|
2828
|
-
*
|
|
2829
|
-
* @beta
|
|
2830
2673
|
*/
|
|
2831
2674
|
static attachHeroCard(title, images, buttons, other) {
|
|
2832
2675
|
return MessageBuilder.attachContent(CardFactory.heroCard(title, images, buttons, other));
|
|
@@ -2842,8 +2685,6 @@ class MessageBuilder {
|
|
|
2842
2685
|
*
|
|
2843
2686
|
* @remarks
|
|
2844
2687
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
2845
|
-
*
|
|
2846
|
-
* @beta
|
|
2847
2688
|
*/
|
|
2848
2689
|
static attachSigninCard(title, url, text) {
|
|
2849
2690
|
return MessageBuilder.attachContent(CardFactory.signinCard(title, url, text));
|
|
@@ -2853,8 +2694,6 @@ class MessageBuilder {
|
|
|
2853
2694
|
*
|
|
2854
2695
|
* @param card A description of the Office 365 connector card.
|
|
2855
2696
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
2856
|
-
*
|
|
2857
|
-
* @beta
|
|
2858
2697
|
*/
|
|
2859
2698
|
static attachO365ConnectorCard(card) {
|
|
2860
2699
|
return MessageBuilder.attachContent(CardFactory.o365ConnectorCard(card));
|
|
@@ -2863,8 +2702,6 @@ class MessageBuilder {
|
|
|
2863
2702
|
* Build a message activity attached with a receipt card.
|
|
2864
2703
|
* @param card A description of the receipt card.
|
|
2865
2704
|
* @returns A message activity attached with a receipt card.
|
|
2866
|
-
*
|
|
2867
|
-
* @beta
|
|
2868
2705
|
*/
|
|
2869
2706
|
static AttachReceiptCard(card) {
|
|
2870
2707
|
return MessageBuilder.attachContent(CardFactory.receiptCard(card));
|
|
@@ -2877,8 +2714,6 @@ class MessageBuilder {
|
|
|
2877
2714
|
* is converted to an `imBack` button with a title and value set to the value of the string.
|
|
2878
2715
|
* @param other Optional. Any additional properties to include on the card.
|
|
2879
2716
|
* @returns A message activity attached with a thumbnail card
|
|
2880
|
-
*
|
|
2881
|
-
* @beta
|
|
2882
2717
|
*/
|
|
2883
2718
|
static attachThumbnailCard(title, images, buttons, other) {
|
|
2884
2719
|
return MessageBuilder.attachContent(CardFactory.thumbnailCard(title, images, buttons, other));
|
|
@@ -2887,8 +2722,6 @@ class MessageBuilder {
|
|
|
2887
2722
|
* Add an attachement to a bot activity.
|
|
2888
2723
|
* @param attachement The attachment object to attach.
|
|
2889
2724
|
* @returns A message activity with an attachment.
|
|
2890
|
-
*
|
|
2891
|
-
* @beta
|
|
2892
2725
|
*/
|
|
2893
2726
|
static attachContent(attachement) {
|
|
2894
2727
|
return {
|