@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.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* () {
|
|
@@ -1656,8 +1581,6 @@ class ApiKeyProvider {
|
|
|
1656
1581
|
}
|
|
1657
1582
|
/**
|
|
1658
1583
|
* Define available location for API Key location
|
|
1659
|
-
*
|
|
1660
|
-
* @beta
|
|
1661
1584
|
*/
|
|
1662
1585
|
exports.ApiKeyLocation = void 0;
|
|
1663
1586
|
(function (ApiKeyLocation) {
|
|
@@ -1674,8 +1597,6 @@ exports.ApiKeyLocation = void 0;
|
|
|
1674
1597
|
// Copyright (c) Microsoft Corporation.
|
|
1675
1598
|
/**
|
|
1676
1599
|
* Provider that handles Certificate authentication
|
|
1677
|
-
*
|
|
1678
|
-
* @beta
|
|
1679
1600
|
*/
|
|
1680
1601
|
class CertificateAuthProvider {
|
|
1681
1602
|
/**
|
|
@@ -1683,8 +1604,6 @@ class CertificateAuthProvider {
|
|
|
1683
1604
|
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1684
1605
|
*
|
|
1685
1606
|
* @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
|
|
1686
|
-
*
|
|
1687
|
-
* @beta
|
|
1688
1607
|
*/
|
|
1689
1608
|
constructor(certOption) {
|
|
1690
1609
|
if (certOption && Object.keys(certOption).length !== 0) {
|
|
@@ -1703,8 +1622,6 @@ class CertificateAuthProvider {
|
|
|
1703
1622
|
* @returns Updated axios request config.
|
|
1704
1623
|
*
|
|
1705
1624
|
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1706
|
-
*
|
|
1707
|
-
* @beta
|
|
1708
1625
|
*/
|
|
1709
1626
|
AddAuthenticationInfo(config) {
|
|
1710
1627
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1790,7 +1707,6 @@ const ReservedKey = new Set([
|
|
|
1790
1707
|
]);
|
|
1791
1708
|
/**
|
|
1792
1709
|
* A class providing credential and configuration.
|
|
1793
|
-
* @beta
|
|
1794
1710
|
*/
|
|
1795
1711
|
class TeamsFx {
|
|
1796
1712
|
/**
|
|
@@ -1800,8 +1716,6 @@ class TeamsFx {
|
|
|
1800
1716
|
* @param customConfig - key/value pairs of customized configuration that overrides default ones.
|
|
1801
1717
|
*
|
|
1802
1718
|
* @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
|
|
1803
|
-
*
|
|
1804
|
-
* @beta
|
|
1805
1719
|
*/
|
|
1806
1720
|
constructor(identityType, customConfig) {
|
|
1807
1721
|
this.identityType = identityType !== null && identityType !== void 0 ? identityType : exports.IdentityType.User;
|
|
@@ -1820,7 +1734,6 @@ class TeamsFx {
|
|
|
1820
1734
|
* Identity type set by user.
|
|
1821
1735
|
*
|
|
1822
1736
|
* @returns identity type.
|
|
1823
|
-
* @beta
|
|
1824
1737
|
*/
|
|
1825
1738
|
getIdentityType() {
|
|
1826
1739
|
return this.identityType;
|
|
@@ -1833,7 +1746,6 @@ class TeamsFx {
|
|
|
1833
1746
|
* identity is chose, will return {@link AppCredential}.
|
|
1834
1747
|
*
|
|
1835
1748
|
* @returns instance implements TokenCredential interface.
|
|
1836
|
-
* @beta
|
|
1837
1749
|
*/
|
|
1838
1750
|
getCredential() {
|
|
1839
1751
|
if (this.identityType === exports.IdentityType.User) {
|
|
@@ -1854,7 +1766,6 @@ class TeamsFx {
|
|
|
1854
1766
|
/**
|
|
1855
1767
|
* Get user information.
|
|
1856
1768
|
* @returns UserInfo object.
|
|
1857
|
-
* @beta
|
|
1858
1769
|
*/
|
|
1859
1770
|
getUserInfo() {
|
|
1860
1771
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1885,8 +1796,6 @@ class TeamsFx {
|
|
|
1885
1796
|
* @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
|
|
1886
1797
|
* @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
|
|
1887
1798
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
|
1888
|
-
*
|
|
1889
|
-
* @beta
|
|
1890
1799
|
*/
|
|
1891
1800
|
login(scopes) {
|
|
1892
1801
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1897,7 +1806,6 @@ class TeamsFx {
|
|
|
1897
1806
|
* Set SSO token when using user identity in NodeJS.
|
|
1898
1807
|
* @param {string} ssoToken - used for on behalf of user flow.
|
|
1899
1808
|
* @returns self instance.
|
|
1900
|
-
* @beta
|
|
1901
1809
|
*/
|
|
1902
1810
|
setSsoToken(ssoToken) {
|
|
1903
1811
|
if (this.identityType !== exports.IdentityType.User) {
|
|
@@ -1910,7 +1818,6 @@ class TeamsFx {
|
|
|
1910
1818
|
* Usually used by service plugins to retrieve specific config
|
|
1911
1819
|
* @param {string} key - configuration key.
|
|
1912
1820
|
* @returns value in configuration.
|
|
1913
|
-
* @beta
|
|
1914
1821
|
*/
|
|
1915
1822
|
getConfig(key) {
|
|
1916
1823
|
const value = this.configuration.get(key);
|
|
@@ -1925,7 +1832,6 @@ class TeamsFx {
|
|
|
1925
1832
|
* Check the value of specific key.
|
|
1926
1833
|
* @param {string} key - configuration key.
|
|
1927
1834
|
* @returns true if corresponding value is not empty string.
|
|
1928
|
-
* @beta
|
|
1929
1835
|
*/
|
|
1930
1836
|
hasConfig(key) {
|
|
1931
1837
|
const value = this.configuration.get(key);
|
|
@@ -1934,7 +1840,6 @@ class TeamsFx {
|
|
|
1934
1840
|
/**
|
|
1935
1841
|
* Get all configurations.
|
|
1936
1842
|
* @returns key value mappings.
|
|
1937
|
-
* @beta
|
|
1938
1843
|
*/
|
|
1939
1844
|
getConfigs() {
|
|
1940
1845
|
const config = {};
|
|
@@ -2179,8 +2084,6 @@ class CommandResponseMiddleware {
|
|
|
2179
2084
|
*
|
|
2180
2085
|
* @remarks
|
|
2181
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.
|
|
2182
|
-
*
|
|
2183
|
-
* @beta
|
|
2184
2087
|
*/
|
|
2185
2088
|
class CommandBot {
|
|
2186
2089
|
/**
|
|
@@ -2188,8 +2091,6 @@ class CommandBot {
|
|
|
2188
2091
|
*
|
|
2189
2092
|
* @param adapter The bound `BotFrameworkAdapter`.
|
|
2190
2093
|
* @param options - initialize options
|
|
2191
|
-
*
|
|
2192
|
-
* @beta
|
|
2193
2094
|
*/
|
|
2194
2095
|
constructor(adapter, options) {
|
|
2195
2096
|
this.middleware = new CommandResponseMiddleware(options === null || options === void 0 ? void 0 : options.commands);
|
|
@@ -2199,8 +2100,6 @@ class CommandBot {
|
|
|
2199
2100
|
* Registers a command into the command bot.
|
|
2200
2101
|
*
|
|
2201
2102
|
* @param command The command to registered.
|
|
2202
|
-
*
|
|
2203
|
-
* @beta
|
|
2204
2103
|
*/
|
|
2205
2104
|
registerCommand(command) {
|
|
2206
2105
|
if (command) {
|
|
@@ -2211,8 +2110,6 @@ class CommandBot {
|
|
|
2211
2110
|
* Registers commands into the command bot.
|
|
2212
2111
|
*
|
|
2213
2112
|
* @param commands The command to registered.
|
|
2214
|
-
*
|
|
2215
|
-
* @beta
|
|
2216
2113
|
*/
|
|
2217
2114
|
registerCommands(commands) {
|
|
2218
2115
|
if (commands) {
|
|
@@ -2359,8 +2256,6 @@ class ConversationReferenceStore {
|
|
|
2359
2256
|
* @param target - the notification target.
|
|
2360
2257
|
* @param text - the plain text message.
|
|
2361
2258
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2362
|
-
*
|
|
2363
|
-
* @beta
|
|
2364
2259
|
*/
|
|
2365
2260
|
function sendMessage(target, text) {
|
|
2366
2261
|
return target.sendMessage(text);
|
|
@@ -2371,8 +2266,6 @@ function sendMessage(target, text) {
|
|
|
2371
2266
|
* @param target - the notification target.
|
|
2372
2267
|
* @param card - the adaptive card raw JSON.
|
|
2373
2268
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2374
|
-
*
|
|
2375
|
-
* @beta
|
|
2376
2269
|
*/
|
|
2377
2270
|
function sendAdaptiveCard(target, card) {
|
|
2378
2271
|
return target.sendAdaptiveCard(card);
|
|
@@ -2382,8 +2275,6 @@ function sendAdaptiveCard(target, card) {
|
|
|
2382
2275
|
*
|
|
2383
2276
|
* @remarks
|
|
2384
2277
|
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
2385
|
-
*
|
|
2386
|
-
* @beta
|
|
2387
2278
|
*/
|
|
2388
2279
|
class Channel {
|
|
2389
2280
|
/**
|
|
@@ -2394,14 +2285,10 @@ class Channel {
|
|
|
2394
2285
|
*
|
|
2395
2286
|
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
2396
2287
|
* @param info - Detailed channel information.
|
|
2397
|
-
*
|
|
2398
|
-
* @beta
|
|
2399
2288
|
*/
|
|
2400
2289
|
constructor(parent, info) {
|
|
2401
2290
|
/**
|
|
2402
2291
|
* Notification target type. For channel it's always "Channel".
|
|
2403
|
-
*
|
|
2404
|
-
* @beta
|
|
2405
2292
|
*/
|
|
2406
2293
|
this.type = "Channel";
|
|
2407
2294
|
this.parent = parent;
|
|
@@ -2412,8 +2299,6 @@ class Channel {
|
|
|
2412
2299
|
*
|
|
2413
2300
|
* @param text - the plain text message.
|
|
2414
2301
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2415
|
-
*
|
|
2416
|
-
* @beta
|
|
2417
2302
|
*/
|
|
2418
2303
|
sendMessage(text) {
|
|
2419
2304
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2428,8 +2313,6 @@ class Channel {
|
|
|
2428
2313
|
*
|
|
2429
2314
|
* @param card - the adaptive card raw JSON.
|
|
2430
2315
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2431
|
-
*
|
|
2432
|
-
* @beta
|
|
2433
2316
|
*/
|
|
2434
2317
|
sendAdaptiveCard(card) {
|
|
2435
2318
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2460,8 +2343,6 @@ class Channel {
|
|
|
2460
2343
|
*
|
|
2461
2344
|
* @remarks
|
|
2462
2345
|
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
2463
|
-
*
|
|
2464
|
-
* @beta
|
|
2465
2346
|
*/
|
|
2466
2347
|
class Member {
|
|
2467
2348
|
/**
|
|
@@ -2472,14 +2353,10 @@ class Member {
|
|
|
2472
2353
|
*
|
|
2473
2354
|
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
2474
2355
|
* @param account - Detailed member account information.
|
|
2475
|
-
*
|
|
2476
|
-
* @beta
|
|
2477
2356
|
*/
|
|
2478
2357
|
constructor(parent, account) {
|
|
2479
2358
|
/**
|
|
2480
2359
|
* Notification target type. For member it's always "Person".
|
|
2481
|
-
*
|
|
2482
|
-
* @beta
|
|
2483
2360
|
*/
|
|
2484
2361
|
this.type = "Person";
|
|
2485
2362
|
this.parent = parent;
|
|
@@ -2490,8 +2367,6 @@ class Member {
|
|
|
2490
2367
|
*
|
|
2491
2368
|
* @param text - the plain text message.
|
|
2492
2369
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2493
|
-
*
|
|
2494
|
-
* @beta
|
|
2495
2370
|
*/
|
|
2496
2371
|
sendMessage(text) {
|
|
2497
2372
|
return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2506,8 +2381,6 @@ class Member {
|
|
|
2506
2381
|
*
|
|
2507
2382
|
* @param card - the adaptive card raw JSON.
|
|
2508
2383
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2509
|
-
*
|
|
2510
|
-
* @beta
|
|
2511
2384
|
*/
|
|
2512
2385
|
sendAdaptiveCard(card) {
|
|
2513
2386
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2549,8 +2422,6 @@ class Member {
|
|
|
2549
2422
|
*
|
|
2550
2423
|
* @remarks
|
|
2551
2424
|
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
2552
|
-
*
|
|
2553
|
-
* @beta
|
|
2554
2425
|
*/
|
|
2555
2426
|
class TeamsBotInstallation {
|
|
2556
2427
|
/**
|
|
@@ -2561,8 +2432,6 @@ class TeamsBotInstallation {
|
|
|
2561
2432
|
*
|
|
2562
2433
|
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
2563
2434
|
* @param conversationReference - the bound `ConversationReference`.
|
|
2564
|
-
*
|
|
2565
|
-
* @beta
|
|
2566
2435
|
*/
|
|
2567
2436
|
constructor(adapter, conversationReference) {
|
|
2568
2437
|
this.adapter = adapter;
|
|
@@ -2574,8 +2443,6 @@ class TeamsBotInstallation {
|
|
|
2574
2443
|
*
|
|
2575
2444
|
* @param text - the plain text message.
|
|
2576
2445
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2577
|
-
*
|
|
2578
|
-
* @beta
|
|
2579
2446
|
*/
|
|
2580
2447
|
sendMessage(text) {
|
|
2581
2448
|
return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2587,8 +2454,6 @@ class TeamsBotInstallation {
|
|
|
2587
2454
|
*
|
|
2588
2455
|
* @param card - the adaptive card raw JSON.
|
|
2589
2456
|
* @returns A `Promise` representing the asynchronous operation.
|
|
2590
|
-
*
|
|
2591
|
-
* @beta
|
|
2592
2457
|
*/
|
|
2593
2458
|
sendAdaptiveCard(card) {
|
|
2594
2459
|
return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2601,8 +2466,6 @@ class TeamsBotInstallation {
|
|
|
2601
2466
|
* Get channels from this bot installation.
|
|
2602
2467
|
*
|
|
2603
2468
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
2604
|
-
*
|
|
2605
|
-
* @beta
|
|
2606
2469
|
*/
|
|
2607
2470
|
channels() {
|
|
2608
2471
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2624,8 +2487,6 @@ class TeamsBotInstallation {
|
|
|
2624
2487
|
* Get members from this bot installation.
|
|
2625
2488
|
*
|
|
2626
2489
|
* @returns an array of members from where the bot is installed.
|
|
2627
|
-
*
|
|
2628
|
-
* @beta
|
|
2629
2490
|
*/
|
|
2630
2491
|
members() {
|
|
2631
2492
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2646,8 +2507,6 @@ class TeamsBotInstallation {
|
|
|
2646
2507
|
}
|
|
2647
2508
|
/**
|
|
2648
2509
|
* Provide utilities to send notification to varies targets (e.g., member, group, channel).
|
|
2649
|
-
*
|
|
2650
|
-
* @beta
|
|
2651
2510
|
*/
|
|
2652
2511
|
class NotificationBot {
|
|
2653
2512
|
/**
|
|
@@ -2658,8 +2517,6 @@ class NotificationBot {
|
|
|
2658
2517
|
*
|
|
2659
2518
|
* @param adapter - the bound `BotFrameworkAdapter`
|
|
2660
2519
|
* @param options - initialize options
|
|
2661
|
-
*
|
|
2662
|
-
* @beta
|
|
2663
2520
|
*/
|
|
2664
2521
|
constructor(adapter, options) {
|
|
2665
2522
|
var _a, _b;
|
|
@@ -2676,8 +2533,6 @@ class NotificationBot {
|
|
|
2676
2533
|
* The result is retrieving from the persisted storage.
|
|
2677
2534
|
*
|
|
2678
2535
|
* @returns - an array of {@link TeamsBotInstallation}.
|
|
2679
|
-
*
|
|
2680
|
-
* @beta
|
|
2681
2536
|
*/
|
|
2682
2537
|
installations() {
|
|
2683
2538
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2763,8 +2618,6 @@ class NotificationBot {
|
|
|
2763
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.
|
|
2764
2619
|
*
|
|
2765
2620
|
* For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
|
|
2766
|
-
*
|
|
2767
|
-
* @beta
|
|
2768
2621
|
*/
|
|
2769
2622
|
class ConversationBot {
|
|
2770
2623
|
/**
|
|
@@ -2774,8 +2627,6 @@ class ConversationBot {
|
|
|
2774
2627
|
* It's recommended to create your own adapter and storage for production environment instead of the default one.
|
|
2775
2628
|
*
|
|
2776
2629
|
* @param options - initialize options
|
|
2777
|
-
*
|
|
2778
|
-
* @beta
|
|
2779
2630
|
*/
|
|
2780
2631
|
constructor(options) {
|
|
2781
2632
|
var _a, _b;
|
|
@@ -2831,8 +2682,6 @@ class ConversationBot {
|
|
|
2831
2682
|
* });
|
|
2832
2683
|
* });
|
|
2833
2684
|
* ```
|
|
2834
|
-
*
|
|
2835
|
-
* @beta
|
|
2836
2685
|
*/
|
|
2837
2686
|
requestHandler(req, res, logic) {
|
|
2838
2687
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2885,8 +2734,6 @@ class MessageBuilder {
|
|
|
2885
2734
|
* description: "sample card description"
|
|
2886
2735
|
* });
|
|
2887
2736
|
* ```
|
|
2888
|
-
*
|
|
2889
|
-
* @beta
|
|
2890
2737
|
*/
|
|
2891
2738
|
static attachAdaptiveCard(cardTemplate, data) {
|
|
2892
2739
|
return {
|
|
@@ -2898,8 +2745,6 @@ class MessageBuilder {
|
|
|
2898
2745
|
*
|
|
2899
2746
|
* @param card The adaptive card content.
|
|
2900
2747
|
* @returns A bot message activity attached with an adaptive card.
|
|
2901
|
-
*
|
|
2902
|
-
* @beta
|
|
2903
2748
|
*/
|
|
2904
2749
|
static attachAdaptiveCardWithoutData(card) {
|
|
2905
2750
|
return {
|
|
@@ -2925,8 +2770,6 @@ class MessageBuilder {
|
|
|
2925
2770
|
* ['action']
|
|
2926
2771
|
* );
|
|
2927
2772
|
* ```
|
|
2928
|
-
*
|
|
2929
|
-
* @beta
|
|
2930
2773
|
*/
|
|
2931
2774
|
static attachHeroCard(title, images, buttons, other) {
|
|
2932
2775
|
return MessageBuilder.attachContent(botbuilder.CardFactory.heroCard(title, images, buttons, other));
|
|
@@ -2942,8 +2785,6 @@ class MessageBuilder {
|
|
|
2942
2785
|
*
|
|
2943
2786
|
* @remarks
|
|
2944
2787
|
* For channels that don't natively support sign-in cards, an alternative message is rendered.
|
|
2945
|
-
*
|
|
2946
|
-
* @beta
|
|
2947
2788
|
*/
|
|
2948
2789
|
static attachSigninCard(title, url, text) {
|
|
2949
2790
|
return MessageBuilder.attachContent(botbuilder.CardFactory.signinCard(title, url, text));
|
|
@@ -2953,8 +2794,6 @@ class MessageBuilder {
|
|
|
2953
2794
|
*
|
|
2954
2795
|
* @param card A description of the Office 365 connector card.
|
|
2955
2796
|
* @returns A bot message activity attached with an Office 365 connector card.
|
|
2956
|
-
*
|
|
2957
|
-
* @beta
|
|
2958
2797
|
*/
|
|
2959
2798
|
static attachO365ConnectorCard(card) {
|
|
2960
2799
|
return MessageBuilder.attachContent(botbuilder.CardFactory.o365ConnectorCard(card));
|
|
@@ -2963,8 +2802,6 @@ class MessageBuilder {
|
|
|
2963
2802
|
* Build a message activity attached with a receipt card.
|
|
2964
2803
|
* @param card A description of the receipt card.
|
|
2965
2804
|
* @returns A message activity attached with a receipt card.
|
|
2966
|
-
*
|
|
2967
|
-
* @beta
|
|
2968
2805
|
*/
|
|
2969
2806
|
static AttachReceiptCard(card) {
|
|
2970
2807
|
return MessageBuilder.attachContent(botbuilder.CardFactory.receiptCard(card));
|
|
@@ -2977,8 +2814,6 @@ class MessageBuilder {
|
|
|
2977
2814
|
* is converted to an `imBack` button with a title and value set to the value of the string.
|
|
2978
2815
|
* @param other Optional. Any additional properties to include on the card.
|
|
2979
2816
|
* @returns A message activity attached with a thumbnail card
|
|
2980
|
-
*
|
|
2981
|
-
* @beta
|
|
2982
2817
|
*/
|
|
2983
2818
|
static attachThumbnailCard(title, images, buttons, other) {
|
|
2984
2819
|
return MessageBuilder.attachContent(botbuilder.CardFactory.thumbnailCard(title, images, buttons, other));
|
|
@@ -2987,8 +2822,6 @@ class MessageBuilder {
|
|
|
2987
2822
|
* Add an attachement to a bot activity.
|
|
2988
2823
|
* @param attachement The attachment object to attach.
|
|
2989
2824
|
* @returns A message activity with an attachment.
|
|
2990
|
-
*
|
|
2991
|
-
* @beta
|
|
2992
2825
|
*/
|
|
2993
2826
|
static attachContent(attachement) {
|
|
2994
2827
|
return {
|