@microsoft/teamsfx 1.0.0-rc.0 → 1.0.1-alpha.215b91d59.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.node.cjs.js
CHANGED
|
@@ -46,7 +46,6 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
46
46
|
// Licensed under the MIT license.
|
|
47
47
|
/**
|
|
48
48
|
* Error code to trace the error types.
|
|
49
|
-
* @beta
|
|
50
49
|
*/
|
|
51
50
|
exports.ErrorCode = void 0;
|
|
52
51
|
(function (ErrorCode) {
|
|
@@ -137,8 +136,6 @@ ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in r
|
|
|
137
136
|
ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
|
|
138
137
|
/**
|
|
139
138
|
* Error class with code and message thrown by the SDK.
|
|
140
|
-
*
|
|
141
|
-
* @beta
|
|
142
139
|
*/
|
|
143
140
|
class ErrorWithCode extends Error {
|
|
144
141
|
/**
|
|
@@ -146,8 +143,6 @@ class ErrorWithCode extends Error {
|
|
|
146
143
|
*
|
|
147
144
|
* @param {string} message - error message.
|
|
148
145
|
* @param {ErrorCode} code - error code.
|
|
149
|
-
*
|
|
150
|
-
* @beta
|
|
151
146
|
*/
|
|
152
147
|
constructor(message, code) {
|
|
153
148
|
if (!code) {
|
|
@@ -165,8 +160,6 @@ class ErrorWithCode extends Error {
|
|
|
165
160
|
// Licensed under the MIT license.
|
|
166
161
|
/**
|
|
167
162
|
* Log level.
|
|
168
|
-
*
|
|
169
|
-
* @beta
|
|
170
163
|
*/
|
|
171
164
|
exports.LogLevel = void 0;
|
|
172
165
|
(function (LogLevel) {
|
|
@@ -191,8 +184,6 @@ exports.LogLevel = void 0;
|
|
|
191
184
|
* Update log level helper.
|
|
192
185
|
*
|
|
193
186
|
* @param { LogLevel } level - log level in configuration
|
|
194
|
-
*
|
|
195
|
-
* @beta
|
|
196
187
|
*/
|
|
197
188
|
function setLogLevel(level) {
|
|
198
189
|
internalLogger.level = level;
|
|
@@ -201,8 +192,6 @@ function setLogLevel(level) {
|
|
|
201
192
|
* Get log level.
|
|
202
193
|
*
|
|
203
194
|
* @returns Log level
|
|
204
|
-
*
|
|
205
|
-
* @beta
|
|
206
195
|
*/
|
|
207
196
|
function getLogLevel() {
|
|
208
197
|
return internalLogger.level;
|
|
@@ -277,8 +266,6 @@ const internalLogger = new InternalLogger();
|
|
|
277
266
|
* error: console.error,
|
|
278
267
|
* });
|
|
279
268
|
* ```
|
|
280
|
-
*
|
|
281
|
-
* @beta
|
|
282
269
|
*/
|
|
283
270
|
function setLogger(logger) {
|
|
284
271
|
internalLogger.customLogger = logger;
|
|
@@ -296,8 +283,6 @@ function setLogger(logger) {
|
|
|
296
283
|
* }
|
|
297
284
|
* });
|
|
298
285
|
* ```
|
|
299
|
-
*
|
|
300
|
-
* @beta
|
|
301
286
|
*/
|
|
302
287
|
function setLogFunction(logFunction) {
|
|
303
288
|
internalLogger.customLogFunction = logFunction;
|
|
@@ -461,8 +446,6 @@ function parseCertificate(certificateContent) {
|
|
|
461
446
|
*
|
|
462
447
|
* @remarks
|
|
463
448
|
* Only works in in server side.
|
|
464
|
-
*
|
|
465
|
-
* @beta
|
|
466
449
|
*/
|
|
467
450
|
class AppCredential {
|
|
468
451
|
/**
|
|
@@ -475,8 +458,6 @@ class AppCredential {
|
|
|
475
458
|
*
|
|
476
459
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret or tenant id is not found in config.
|
|
477
460
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
478
|
-
*
|
|
479
|
-
* @beta
|
|
480
461
|
*/
|
|
481
462
|
constructor(authConfig) {
|
|
482
463
|
internalLogger.info("Create M365 tenant credential");
|
|
@@ -506,8 +487,6 @@ class AppCredential {
|
|
|
506
487
|
*
|
|
507
488
|
* @returns Access token with expected scopes.
|
|
508
489
|
* Throw error if get access token failed.
|
|
509
|
-
*
|
|
510
|
-
* @beta
|
|
511
490
|
*/
|
|
512
491
|
getToken(scopes, options) {
|
|
513
492
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -579,8 +558,6 @@ class AppCredential {
|
|
|
579
558
|
*
|
|
580
559
|
* @remarks
|
|
581
560
|
* Can only be used in server side.
|
|
582
|
-
*
|
|
583
|
-
* @beta
|
|
584
561
|
*/
|
|
585
562
|
class OnBehalfOfUserCredential {
|
|
586
563
|
/**
|
|
@@ -595,8 +572,6 @@ class OnBehalfOfUserCredential {
|
|
|
595
572
|
* @throws {@link ErrorCode|InvalidConfiguration} when client id, client secret, certificate content, authority host or tenant id is not found in config.
|
|
596
573
|
* @throws {@link ErrorCode|InternalError} when SSO token is not valid.
|
|
597
574
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
598
|
-
*
|
|
599
|
-
* @beta
|
|
600
575
|
*/
|
|
601
576
|
constructor(ssoToken, config) {
|
|
602
577
|
internalLogger.info("Get on behalf of user credential");
|
|
@@ -657,8 +632,6 @@ class OnBehalfOfUserCredential {
|
|
|
657
632
|
* @remarks
|
|
658
633
|
* If scopes is empty string or array, it returns SSO token.
|
|
659
634
|
* If scopes is non-empty, it returns access token for target scope.
|
|
660
|
-
*
|
|
661
|
-
* @beta
|
|
662
635
|
*/
|
|
663
636
|
getToken(scopes, options) {
|
|
664
637
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -711,8 +684,6 @@ class OnBehalfOfUserCredential {
|
|
|
711
684
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
712
685
|
*
|
|
713
686
|
* @returns Basic user info with user displayName, objectId and preferredUserName.
|
|
714
|
-
*
|
|
715
|
-
* @beta
|
|
716
687
|
*/
|
|
717
688
|
getUserInfo() {
|
|
718
689
|
internalLogger.info("Get basic user info from SSO token");
|
|
@@ -744,15 +715,12 @@ class OnBehalfOfUserCredential {
|
|
|
744
715
|
*
|
|
745
716
|
* @remarks
|
|
746
717
|
* Can only be used within Teams.
|
|
747
|
-
*
|
|
748
|
-
* @beta
|
|
749
718
|
*/
|
|
750
719
|
class TeamsUserCredential {
|
|
751
720
|
/**
|
|
752
721
|
* Constructor of TeamsUserCredential.
|
|
753
722
|
* @remarks
|
|
754
723
|
* Can only be used within Teams.
|
|
755
|
-
* @beta
|
|
756
724
|
*/
|
|
757
725
|
constructor(authConfig) {
|
|
758
726
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), exports.ErrorCode.RuntimeNotSupported);
|
|
@@ -761,7 +729,6 @@ class TeamsUserCredential {
|
|
|
761
729
|
* Popup login page to get user's access token with specific scopes.
|
|
762
730
|
* @remarks
|
|
763
731
|
* Can only be used within Teams.
|
|
764
|
-
* @beta
|
|
765
732
|
*/
|
|
766
733
|
login(scopes) {
|
|
767
734
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -772,7 +739,6 @@ class TeamsUserCredential {
|
|
|
772
739
|
* Get access token from credential.
|
|
773
740
|
* @remarks
|
|
774
741
|
* Can only be used within Teams.
|
|
775
|
-
* @beta
|
|
776
742
|
*/
|
|
777
743
|
getToken(scopes, options) {
|
|
778
744
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -783,7 +749,6 @@ class TeamsUserCredential {
|
|
|
783
749
|
* Get basic user info from SSO token
|
|
784
750
|
* @remarks
|
|
785
751
|
* Can only be used within Teams.
|
|
786
|
-
* @beta
|
|
787
752
|
*/
|
|
788
753
|
getUserInfo() {
|
|
789
754
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "TeamsUserCredential"), exports.ErrorCode.RuntimeNotSupported);
|
|
@@ -794,8 +759,6 @@ class TeamsUserCredential {
|
|
|
794
759
|
const defaultScope = "https://graph.microsoft.com/.default";
|
|
795
760
|
/**
|
|
796
761
|
* Microsoft Graph auth provider for Teams Framework
|
|
797
|
-
*
|
|
798
|
-
* @beta
|
|
799
762
|
*/
|
|
800
763
|
class MsGraphAuthProvider {
|
|
801
764
|
/**
|
|
@@ -807,8 +770,6 @@ class MsGraphAuthProvider {
|
|
|
807
770
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
808
771
|
*
|
|
809
772
|
* @returns An instance of MsGraphAuthProvider.
|
|
810
|
-
*
|
|
811
|
-
* @beta
|
|
812
773
|
*/
|
|
813
774
|
constructor(teamsfx, scopes) {
|
|
814
775
|
this.teamsfx = teamsfx;
|
|
@@ -902,8 +863,6 @@ class MsGraphAuthProvider {
|
|
|
902
863
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
903
864
|
*
|
|
904
865
|
* @returns Graph client with specified scopes.
|
|
905
|
-
*
|
|
906
|
-
* @beta
|
|
907
866
|
*/
|
|
908
867
|
function createMicrosoftGraphClient(teamsfx, scopes) {
|
|
909
868
|
internalLogger.info("Create Microsoft Graph Client");
|
|
@@ -931,8 +890,6 @@ const defaultSQLScope = "https://database.windows.net/";
|
|
|
931
890
|
* @throws {@link ErrorCode|InvalidConfiguration} when SQL config resource configuration is invalid.
|
|
932
891
|
* @throws {@link ErrorCode|InternalError} when get user MSI token failed or MSI token is invalid.
|
|
933
892
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
934
|
-
*
|
|
935
|
-
* @beta
|
|
936
893
|
*/
|
|
937
894
|
function getTediousConnectionConfig(teamsfx, databaseName) {
|
|
938
895
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1091,8 +1048,6 @@ var TediousAuthenticationType;
|
|
|
1091
1048
|
// Licensed under the MIT license.
|
|
1092
1049
|
/**
|
|
1093
1050
|
* Identity type to use in authentication.
|
|
1094
|
-
*
|
|
1095
|
-
* @beta
|
|
1096
1051
|
*/
|
|
1097
1052
|
exports.IdentityType = void 0;
|
|
1098
1053
|
(function (IdentityType) {
|
|
@@ -1110,8 +1065,6 @@ exports.IdentityType = void 0;
|
|
|
1110
1065
|
const invokeResponseType = "invokeResponse";
|
|
1111
1066
|
/**
|
|
1112
1067
|
* Response body returned for a token exchange invoke activity.
|
|
1113
|
-
*
|
|
1114
|
-
* @beta
|
|
1115
1068
|
*/
|
|
1116
1069
|
class TokenExchangeInvokeResponse {
|
|
1117
1070
|
constructor(id, failureDetail) {
|
|
@@ -1166,8 +1119,6 @@ class TokenExchangeInvokeResponse {
|
|
|
1166
1119
|
* }
|
|
1167
1120
|
* ]));
|
|
1168
1121
|
* ```
|
|
1169
|
-
*
|
|
1170
|
-
* @beta
|
|
1171
1122
|
*/
|
|
1172
1123
|
class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
1173
1124
|
/**
|
|
@@ -1179,8 +1130,6 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
|
1179
1130
|
*
|
|
1180
1131
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1181
1132
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1182
|
-
*
|
|
1183
|
-
* @beta
|
|
1184
1133
|
*/
|
|
1185
1134
|
constructor(teamsfx, dialogId, settings) {
|
|
1186
1135
|
super(dialogId);
|
|
@@ -1203,8 +1152,6 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
|
1203
1152
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1204
1153
|
*
|
|
1205
1154
|
* @returns A `Promise` representing the asynchronous operation.
|
|
1206
|
-
*
|
|
1207
|
-
* @beta
|
|
1208
1155
|
*/
|
|
1209
1156
|
beginDialog(dc) {
|
|
1210
1157
|
var _a;
|
|
@@ -1254,8 +1201,6 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
|
1254
1201
|
*
|
|
1255
1202
|
* @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
|
|
1256
1203
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1257
|
-
*
|
|
1258
|
-
* @beta
|
|
1259
1204
|
*/
|
|
1260
1205
|
continueDialog(dc) {
|
|
1261
1206
|
var _a;
|
|
@@ -1466,8 +1411,6 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
|
1466
1411
|
* ```typescript
|
|
1467
1412
|
* const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
|
|
1468
1413
|
* ```
|
|
1469
|
-
*
|
|
1470
|
-
* @beta
|
|
1471
1414
|
*/
|
|
1472
1415
|
function createApiClient(apiEndpoint, authProvider) {
|
|
1473
1416
|
// Add a request interceptor
|
|
@@ -1485,14 +1428,10 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1485
1428
|
// Copyright (c) Microsoft Corporation.
|
|
1486
1429
|
/**
|
|
1487
1430
|
* Provider that handles Bearer Token authentication
|
|
1488
|
-
*
|
|
1489
|
-
* @beta
|
|
1490
1431
|
*/
|
|
1491
1432
|
class BearerTokenAuthProvider {
|
|
1492
1433
|
/**
|
|
1493
1434
|
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
1494
|
-
*
|
|
1495
|
-
* @beta
|
|
1496
1435
|
*/
|
|
1497
1436
|
constructor(getToken) {
|
|
1498
1437
|
this.getToken = getToken;
|
|
@@ -1506,8 +1445,6 @@ class BearerTokenAuthProvider {
|
|
|
1506
1445
|
* @returns Updated axios request config.
|
|
1507
1446
|
*
|
|
1508
1447
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1509
|
-
*
|
|
1510
|
-
* @beta
|
|
1511
1448
|
*/
|
|
1512
1449
|
AddAuthenticationInfo(config) {
|
|
1513
1450
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1527,8 +1464,6 @@ class BearerTokenAuthProvider {
|
|
|
1527
1464
|
// Copyright (c) Microsoft Corporation.
|
|
1528
1465
|
/**
|
|
1529
1466
|
* Provider that handles Basic authentication
|
|
1530
|
-
*
|
|
1531
|
-
* @beta
|
|
1532
1467
|
*/
|
|
1533
1468
|
class BasicAuthProvider {
|
|
1534
1469
|
/**
|
|
@@ -1538,8 +1473,6 @@ class BasicAuthProvider {
|
|
|
1538
1473
|
*
|
|
1539
1474
|
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
1540
1475
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1541
|
-
*
|
|
1542
|
-
* @beta
|
|
1543
1476
|
*/
|
|
1544
1477
|
constructor(userName, password) {
|
|
1545
1478
|
if (!userName) {
|
|
@@ -1561,8 +1494,6 @@ class BasicAuthProvider {
|
|
|
1561
1494
|
*
|
|
1562
1495
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1563
1496
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1564
|
-
*
|
|
1565
|
-
* @beta
|
|
1566
1497
|
*/
|
|
1567
1498
|
AddAuthenticationInfo(config) {
|
|
1568
1499
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1584,8 +1515,6 @@ class BasicAuthProvider {
|
|
|
1584
1515
|
// Copyright (c) Microsoft Corporation.
|
|
1585
1516
|
/**
|
|
1586
1517
|
* Provider that handles API Key authentication
|
|
1587
|
-
*
|
|
1588
|
-
* @beta
|
|
1589
1518
|
*/
|
|
1590
1519
|
class ApiKeyProvider {
|
|
1591
1520
|
/**
|
|
@@ -1596,8 +1525,6 @@ class ApiKeyProvider {
|
|
|
1596
1525
|
*
|
|
1597
1526
|
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
1598
1527
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1599
|
-
*
|
|
1600
|
-
* @beta
|
|
1601
1528
|
*/
|
|
1602
1529
|
constructor(keyName, keyValue, keyLocation) {
|
|
1603
1530
|
if (!keyName) {
|
|
@@ -1620,8 +1547,6 @@ class ApiKeyProvider {
|
|
|
1620
1547
|
*
|
|
1621
1548
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
1622
1549
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1623
|
-
*
|
|
1624
|
-
* @beta
|
|
1625
1550
|
*/
|
|
1626
1551
|
AddAuthenticationInfo(config) {
|
|
1627
1552
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1639,8 +1564,12 @@ class ApiKeyProvider {
|
|
|
1639
1564
|
if (!config.params) {
|
|
1640
1565
|
config.params = {};
|
|
1641
1566
|
}
|
|
1642
|
-
|
|
1643
|
-
if (config.
|
|
1567
|
+
let urlHasDefinedApiKey = false;
|
|
1568
|
+
if (config.url) {
|
|
1569
|
+
const url = new URL(config.url, config.baseURL);
|
|
1570
|
+
urlHasDefinedApiKey = url.searchParams.has(this.keyName);
|
|
1571
|
+
}
|
|
1572
|
+
if (config.params[this.keyName] || urlHasDefinedApiKey) {
|
|
1644
1573
|
throw new ErrorWithCode(formatString(ErrorMessage.DuplicateApiKeyInQueryParam, this.keyName), exports.ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1645
1574
|
}
|
|
1646
1575
|
config.params[this.keyName] = this.keyValue;
|
|
@@ -1652,8 +1581,6 @@ class ApiKeyProvider {
|
|
|
1652
1581
|
}
|
|
1653
1582
|
/**
|
|
1654
1583
|
* Define available location for API Key location
|
|
1655
|
-
*
|
|
1656
|
-
* @beta
|
|
1657
1584
|
*/
|
|
1658
1585
|
exports.ApiKeyLocation = void 0;
|
|
1659
1586
|
(function (ApiKeyLocation) {
|
|
@@ -1670,8 +1597,6 @@ exports.ApiKeyLocation = void 0;
|
|
|
1670
1597
|
// Copyright (c) Microsoft Corporation.
|
|
1671
1598
|
/**
|
|
1672
1599
|
* Provider that handles Certificate authentication
|
|
1673
|
-
*
|
|
1674
|
-
* @beta
|
|
1675
1600
|
*/
|
|
1676
1601
|
class CertificateAuthProvider {
|
|
1677
1602
|
/**
|
|
@@ -1679,8 +1604,6 @@ class CertificateAuthProvider {
|
|
|
1679
1604
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1680
1605
|
*
|
|
1681
1606
|
* @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
|
|
1682
|
-
*
|
|
1683
|
-
* @beta
|
|
1684
1607
|
*/
|
|
1685
1608
|
constructor(certOption) {
|
|
1686
1609
|
if (certOption && Object.keys(certOption).length !== 0) {
|
|
@@ -1699,8 +1622,6 @@ class CertificateAuthProvider {
|
|
|
1699
1622
|
* @returns Updated axios request config.
|
|
1700
1623
|
*
|
|
1701
1624
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1702
|
-
*
|
|
1703
|
-
* @beta
|
|
1704
1625
|
*/
|
|
1705
1626
|
AddAuthenticationInfo(config) {
|
|
1706
1627
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1786,7 +1707,6 @@ const ReservedKey = new Set([
|
|
|
1786
1707
|
]);
|
|
1787
1708
|
/**
|
|
1788
1709
|
* A class providing credential and configuration.
|
|
1789
|
-
* @beta
|
|
1790
1710
|
*/
|
|
1791
1711
|
class TeamsFx {
|
|
1792
1712
|
/**
|
|
@@ -1796,8 +1716,6 @@ class TeamsFx {
|
|
|
1796
1716
|
* @param customConfig - key/value pairs of customized configuration that overrides default ones.
|
|
1797
1717
|
*
|
|
1798
1718
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1799
|
-
*
|
|
1800
|
-
* @beta
|
|
1801
1719
|
*/
|
|
1802
1720
|
constructor(identityType, customConfig) {
|
|
1803
1721
|
this.identityType = identityType !== null && identityType !== void 0 ? identityType : exports.IdentityType.User;
|
|
@@ -1816,7 +1734,6 @@ class TeamsFx {
|
|
|
1816
1734
|
* Identity type set by user.
|
|
1817
1735
|
*
|
|
1818
1736
|
* @returns identity type.
|
|
1819
|
-
* @beta
|
|
1820
1737
|
*/
|
|
1821
1738
|
getIdentityType() {
|
|
1822
1739
|
return this.identityType;
|
|
@@ -1829,7 +1746,6 @@ class TeamsFx {
|
|
|
1829
1746
|
* identity is chose, will return {@link AppCredential}.
|
|
1830
1747
|
*
|
|
1831
1748
|
* @returns instance implements TokenCredential interface.
|
|
1832
|
-
* @beta
|
|
1833
1749
|
*/
|
|
1834
1750
|
getCredential() {
|
|
1835
1751
|
if (this.identityType === exports.IdentityType.User) {
|
|
@@ -1850,7 +1766,6 @@ class TeamsFx {
|
|
|
1850
1766
|
/**
|
|
1851
1767
|
* Get user information.
|
|
1852
1768
|
* @returns UserInfo object.
|
|
1853
|
-
* @beta
|
|
1854
1769
|
*/
|
|
1855
1770
|
getUserInfo() {
|
|
1856
1771
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1881,8 +1796,6 @@ class TeamsFx {
|
|
|
1881
1796
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1882
1797
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1883
1798
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1884
|
-
*
|
|
1885
|
-
* @beta
|
|
1886
1799
|
*/
|
|
1887
1800
|
login(scopes) {
|
|
1888
1801
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1893,7 +1806,6 @@ class TeamsFx {
|
|
|
1893
1806
|
* Set SSO token when using user identity in NodeJS.
|
|
1894
1807
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1895
1808
|
* @returns self instance.
|
|
1896
|
-
* @beta
|
|
1897
1809
|
*/
|
|
1898
1810
|
setSsoToken(ssoToken) {
|
|
1899
1811
|
if (this.identityType !== exports.IdentityType.User) {
|
|
@@ -1906,7 +1818,6 @@ class TeamsFx {
|
|
|
1906
1818
|
* Usually used by service plugins to retrieve specific config
|
|
1907
1819
|
* @param {string} key - configuration key.
|
|
1908
1820
|
* @returns value in configuration.
|
|
1909
|
-
* @beta
|
|
1910
1821
|
*/
|
|
1911
1822
|
getConfig(key) {
|
|
1912
1823
|
const value = this.configuration.get(key);
|
|
@@ -1921,7 +1832,6 @@ class TeamsFx {
|
|
|
1921
1832
|
* Check the value of specific key.
|
|
1922
1833
|
* @param {string} key - configuration key.
|
|
1923
1834
|
* @returns true if corresponding value is not empty string.
|
|
1924
|
-
* @beta
|
|
1925
1835
|
*/
|
|
1926
1836
|
hasConfig(key) {
|
|
1927
1837
|
const value = this.configuration.get(key);
|
|
@@ -1930,7 +1840,6 @@ class TeamsFx {
|
|
|
1930
1840
|
/**
|
|
1931
1841
|
* Get all configurations.
|
|
1932
1842
|
* @returns key value mappings.
|
|
1933
|
-
* @beta
|
|
1934
1843
|
*/
|
|
1935
1844
|
getConfigs() {
|
|
1936
1845
|
const config = {};
|
|
@@ -2175,8 +2084,6 @@ class CommandResponseMiddleware {
|
|
|
2175
2084
|
*
|
|
2176
2085
|
* @remarks
|
|
2177
2086
|
* 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.
|
|
2178
|
-
*
|
|
2179
|
-
* @beta
|
|
2180
2087
|
*/
|
|
2181
2088
|
class CommandBot {
|
|
2182
2089
|
/**
|
|
@@ -2184,8 +2091,6 @@ class CommandBot {
|
|
|
2184
2091
|
*
|
|
2185
2092
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
2186
2093
|
* @param options - initialize options
|
|
2187
|
-
*
|
|
2188
|
-
* @beta
|
|
2189
2094
|
*/
|
|
2190
2095
|
constructor(adapter, options) {
|
|
2191
2096
|
this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands);
|
|
@@ -2195,8 +2100,6 @@ class CommandBot {
|
|
|
2195
2100
|
* Registers a command into the command bot.
|
|
2196
2101
|
*
|
|
2197
2102
|
* @param command The command to registered.
|
|
2198
|
-
*
|
|
2199
|
-
* @beta
|
|
2200
2103
|
*/
|
|
2201
2104
|
registerCommand(command) {
|
|
2202
2105
|
if (command) {
|
|
@@ -2207,8 +2110,6 @@ class CommandBot {
|
|
|
2207
2110
|
* Registers commands into the command bot.
|
|
2208
2111
|
*
|
|
2209
2112
|
* @param commands The command to registered.
|
|
2210
|
-
*
|
|
2211
|
-
* @beta
|
|
2212
2113
|
*/
|
|
2213
2114
|
registerCommands(commands) {
|
|
2214
2115
|
if (commands) {
|
|
@@ -2355,8 +2256,6 @@ class ConversationReferenceStore {
|
|
|
2355
2256
|
* @param target - the notification target.
|
|
2356
2257
|
* @param text - the plain text message.
|
|
2357
2258
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2358
|
-
*
|
|
2359
|
-
* @beta
|
|
2360
2259
|
*/
|
|
2361
2260
|
function sendMessage(target, text) {
|
|
2362
2261
|
return target.sendMessage(text);
|
|
@@ -2367,8 +2266,6 @@ function sendMessage(target, text) {
|
|
|
2367
2266
|
* @param target - the notification target.
|
|
2368
2267
|
* @param card - the adaptive card raw JSON.
|
|
2369
2268
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2370
|
-
*
|
|
2371
|
-
* @beta
|
|
2372
2269
|
*/
|
|
2373
2270
|
function sendAdaptiveCard(target, card) {
|
|
2374
2271
|
return target.sendAdaptiveCard(card);
|
|
@@ -2378,8 +2275,6 @@ function sendAdaptiveCard(target, card) {
|
|
|
2378
2275
|
*
|
|
2379
2276
|
* @remarks
|
|
2380
2277
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
2381
|
-
*
|
|
2382
|
-
* @beta
|
|
2383
2278
|
*/
|
|
2384
2279
|
class Channel {
|
|
2385
2280
|
/**
|
|
@@ -2390,14 +2285,10 @@ class Channel {
|
|
|
2390
2285
|
*
|
|
2391
2286
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
2392
2287
|
* @param info - Detailed channel information.
|
|
2393
|
-
*
|
|
2394
|
-
* @beta
|
|
2395
2288
|
*/
|
|
2396
2289
|
constructor(parent, info) {
|
|
2397
2290
|
/**
|
|
2398
2291
|
* Notification target type. For channel it's always "Channel".
|
|
2399
|
-
*
|
|
2400
|
-
* @beta
|
|
2401
2292
|
*/
|
|
2402
2293
|
this.type = "Channel";
|
|
2403
2294
|
this.parent = parent;
|
|
@@ -2408,8 +2299,6 @@ class Channel {
|
|
|
2408
2299
|
*
|
|
2409
2300
|
* @param text - the plain text message.
|
|
2410
2301
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2411
|
-
*
|
|
2412
|
-
* @beta
|
|
2413
2302
|
*/
|
|
2414
2303
|
sendMessage(text) {
|
|
2415
2304
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2424,8 +2313,6 @@ class Channel {
|
|
|
2424
2313
|
*
|
|
2425
2314
|
* @param card - the adaptive card raw JSON.
|
|
2426
2315
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2427
|
-
*
|
|
2428
|
-
* @beta
|
|
2429
2316
|
*/
|
|
2430
2317
|
sendAdaptiveCard(card) {
|
|
2431
2318
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2456,8 +2343,6 @@ class Channel {
|
|
|
2456
2343
|
*
|
|
2457
2344
|
* @remarks
|
|
2458
2345
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
2459
|
-
*
|
|
2460
|
-
* @beta
|
|
2461
2346
|
*/
|
|
2462
2347
|
class Member {
|
|
2463
2348
|
/**
|
|
@@ -2468,14 +2353,10 @@ class Member {
|
|
|
2468
2353
|
*
|
|
2469
2354
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
2470
2355
|
* @param account - Detailed member account information.
|
|
2471
|
-
*
|
|
2472
|
-
* @beta
|
|
2473
2356
|
*/
|
|
2474
2357
|
constructor(parent, account) {
|
|
2475
2358
|
/**
|
|
2476
2359
|
* Notification target type. For member it's always "Person".
|
|
2477
|
-
*
|
|
2478
|
-
* @beta
|
|
2479
2360
|
*/
|
|
2480
2361
|
this.type = "Person";
|
|
2481
2362
|
this.parent = parent;
|
|
@@ -2486,8 +2367,6 @@ class Member {
|
|
|
2486
2367
|
*
|
|
2487
2368
|
* @param text - the plain text message.
|
|
2488
2369
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2489
|
-
*
|
|
2490
|
-
* @beta
|
|
2491
2370
|
*/
|
|
2492
2371
|
sendMessage(text) {
|
|
2493
2372
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2502,8 +2381,6 @@ class Member {
|
|
|
2502
2381
|
*
|
|
2503
2382
|
* @param card - the adaptive card raw JSON.
|
|
2504
2383
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2505
|
-
*
|
|
2506
|
-
* @beta
|
|
2507
2384
|
*/
|
|
2508
2385
|
sendAdaptiveCard(card) {
|
|
2509
2386
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2545,8 +2422,6 @@ class Member {
|
|
|
2545
2422
|
*
|
|
2546
2423
|
* @remarks
|
|
2547
2424
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
2548
|
-
*
|
|
2549
|
-
* @beta
|
|
2550
2425
|
*/
|
|
2551
2426
|
class TeamsBotInstallation {
|
|
2552
2427
|
/**
|
|
@@ -2557,8 +2432,6 @@ class TeamsBotInstallation {
|
|
|
2557
2432
|
*
|
|
2558
2433
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
2559
2434
|
* @param conversationReference - the bound `ConversationReference`.
|
|
2560
|
-
*
|
|
2561
|
-
* @beta
|
|
2562
2435
|
*/
|
|
2563
2436
|
constructor(adapter, conversationReference) {
|
|
2564
2437
|
this.adapter = adapter;
|
|
@@ -2570,8 +2443,6 @@ class TeamsBotInstallation {
|
|
|
2570
2443
|
*
|
|
2571
2444
|
* @param text - the plain text message.
|
|
2572
2445
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2573
|
-
*
|
|
2574
|
-
* @beta
|
|
2575
2446
|
*/
|
|
2576
2447
|
sendMessage(text) {
|
|
2577
2448
|
return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2583,8 +2454,6 @@ class TeamsBotInstallation {
|
|
|
2583
2454
|
*
|
|
2584
2455
|
* @param card - the adaptive card raw JSON.
|
|
2585
2456
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2586
|
-
*
|
|
2587
|
-
* @beta
|
|
2588
2457
|
*/
|
|
2589
2458
|
sendAdaptiveCard(card) {
|
|
2590
2459
|
return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2597,8 +2466,6 @@ class TeamsBotInstallation {
|
|
|
2597
2466
|
* Get channels from this bot installation.
|
|
2598
2467
|
*
|
|
2599
2468
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
2600
|
-
*
|
|
2601
|
-
* @beta
|
|
2602
2469
|
*/
|
|
2603
2470
|
channels() {
|
|
2604
2471
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2620,8 +2487,6 @@ class TeamsBotInstallation {
|
|
|
2620
2487
|
* Get members from this bot installation.
|
|
2621
2488
|
*
|
|
2622
2489
|
* @returns an array of members from where the bot is installed.
|
|
2623
|
-
*
|
|
2624
|
-
* @beta
|
|
2625
2490
|
*/
|
|
2626
2491
|
members() {
|
|
2627
2492
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2642,8 +2507,6 @@ class TeamsBotInstallation {
|
|
|
2642
2507
|
}
|
|
2643
2508
|
/**
|
|
2644
2509
|
* Provide utilities to send notification to varies targets (e.g., member, group, channel).
|
|
2645
|
-
*
|
|
2646
|
-
* @beta
|
|
2647
2510
|
*/
|
|
2648
2511
|
class NotificationBot {
|
|
2649
2512
|
/**
|
|
@@ -2654,8 +2517,6 @@ class NotificationBot {
|
|
|
2654
2517
|
*
|
|
2655
2518
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
2656
2519
|
* @param options - initialize options
|
|
2657
|
-
*
|
|
2658
|
-
* @beta
|
|
2659
2520
|
*/
|
|
2660
2521
|
constructor(adapter, options) {
|
|
2661
2522
|
var _a, _b;
|
|
@@ -2672,8 +2533,6 @@ class NotificationBot {
|
|
|
2672
2533
|
* The result is retrieving from the persisted storage.
|
|
2673
2534
|
*
|
|
2674
2535
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
2675
|
-
*
|
|
2676
|
-
* @beta
|
|
2677
2536
|
*/
|
|
2678
2537
|
installations() {
|
|
2679
2538
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2759,8 +2618,6 @@ class NotificationBot {
|
|
|
2759
2618
|
* 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.
|
|
2760
2619
|
*
|
|
2761
2620
|
* For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
|
|
2762
|
-
*
|
|
2763
|
-
* @beta
|
|
2764
2621
|
*/
|
|
2765
2622
|
class ConversationBot {
|
|
2766
2623
|
/**
|
|
@@ -2770,8 +2627,6 @@ class ConversationBot {
|
|
|
2770
2627
|
* It's recommended to create your own adapter and storage for production environment instead of the default one.
|
|
2771
2628
|
*
|
|
2772
2629
|
* @param options - initialize options
|
|
2773
|
-
*
|
|
2774
|
-
* @beta
|
|
2775
2630
|
*/
|
|
2776
2631
|
constructor(options) {
|
|
2777
2632
|
var _a, _b;
|
|
@@ -2827,8 +2682,6 @@ class ConversationBot {
|
|
|
2827
2682
|
* });
|
|
2828
2683
|
* });
|
|
2829
2684
|
* ```
|
|
2830
|
-
*
|
|
2831
|
-
* @beta
|
|
2832
2685
|
*/
|
|
2833
2686
|
requestHandler(req, res, logic) {
|
|
2834
2687
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2881,8 +2734,6 @@ class MessageBuilder {
|
|
|
2881
2734
|
* description: "sample card description"
|
|
2882
2735
|
* });
|
|
2883
2736
|
* ```
|
|
2884
|
-
*
|
|
2885
|
-
* @beta
|
|
2886
2737
|
*/
|
|
2887
2738
|
static attachAdaptiveCard(cardTemplate, data) {
|
|
2888
2739
|
return {
|
|
@@ -2894,8 +2745,6 @@ class MessageBuilder {
|
|
|
2894
2745
|
*
|
|
2895
2746
|
* @param card The adaptive card content.
|
|
2896
2747
|
* @returns A bot message activity attached with an adaptive card.
|
|
2897
|
-
*
|
|
2898
|
-
* @beta
|
|
2899
2748
|
*/
|
|
2900
2749
|
static attachAdaptiveCardWithoutData(card) {
|
|
2901
2750
|
return {
|
|
@@ -2921,8 +2770,6 @@ class MessageBuilder {
|
|
|
2921
2770
|
* ['action']
|
|
2922
2771
|
* );
|
|
2923
2772
|
* ```
|
|
2924
|
-
*
|
|
2925
|
-
* @beta
|
|
2926
2773
|
*/
|
|
2927
2774
|
static attachHeroCard(title, images, buttons, other) {
|
|
2928
2775
|
return MessageBuilder.attachContent(botbuilder.CardFactory.heroCard(title, images, buttons, other));
|
|
@@ -2938,8 +2785,6 @@ class MessageBuilder {
|
|
|
2938
2785
|
*
|
|
2939
2786
|
* @remarks
|
|
2940
2787
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
2941
|
-
*
|
|
2942
|
-
* @beta
|
|
2943
2788
|
*/
|
|
2944
2789
|
static attachSigninCard(title, url, text) {
|
|
2945
2790
|
return MessageBuilder.attachContent(botbuilder.CardFactory.signinCard(title, url, text));
|
|
@@ -2949,8 +2794,6 @@ class MessageBuilder {
|
|
|
2949
2794
|
*
|
|
2950
2795
|
* @param card A description of the Office 365 connector card.
|
|
2951
2796
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
2952
|
-
*
|
|
2953
|
-
* @beta
|
|
2954
2797
|
*/
|
|
2955
2798
|
static attachO365ConnectorCard(card) {
|
|
2956
2799
|
return MessageBuilder.attachContent(botbuilder.CardFactory.o365ConnectorCard(card));
|
|
@@ -2959,8 +2802,6 @@ class MessageBuilder {
|
|
|
2959
2802
|
* Build a message activity attached with a receipt card.
|
|
2960
2803
|
* @param card A description of the receipt card.
|
|
2961
2804
|
* @returns A message activity attached with a receipt card.
|
|
2962
|
-
*
|
|
2963
|
-
* @beta
|
|
2964
2805
|
*/
|
|
2965
2806
|
static AttachReceiptCard(card) {
|
|
2966
2807
|
return MessageBuilder.attachContent(botbuilder.CardFactory.receiptCard(card));
|
|
@@ -2973,8 +2814,6 @@ class MessageBuilder {
|
|
|
2973
2814
|
* is converted to an `imBack` button with a title and value set to the value of the string.
|
|
2974
2815
|
* @param other Optional. Any additional properties to include on the card.
|
|
2975
2816
|
* @returns A message activity attached with a thumbnail card
|
|
2976
|
-
*
|
|
2977
|
-
* @beta
|
|
2978
2817
|
*/
|
|
2979
2818
|
static attachThumbnailCard(title, images, buttons, other) {
|
|
2980
2819
|
return MessageBuilder.attachContent(botbuilder.CardFactory.thumbnailCard(title, images, buttons, other));
|
|
@@ -2983,8 +2822,6 @@ class MessageBuilder {
|
|
|
2983
2822
|
* Add an attachement to a bot activity.
|
|
2984
2823
|
* @param attachement The attachment object to attach.
|
|
2985
2824
|
* @returns A message activity with an attachment.
|
|
2986
|
-
*
|
|
2987
|
-
* @beta
|
|
2988
2825
|
*/
|
|
2989
2826
|
static attachContent(attachement) {
|
|
2990
2827
|
return {
|