@microsoft/teamsfx 0.6.2 → 0.6.3-alpha.42a29d71b.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.
@@ -3,6 +3,7 @@ import jwt_decode from 'jwt-decode';
3
3
  import * as microsoftTeams from '@microsoft/teams-js';
4
4
  import { PublicClientApplication } from '@azure/msal-browser';
5
5
  import { Client } from '@microsoft/microsoft-graph-client';
6
+ import axios from 'axios';
6
7
 
7
8
  // Copyright (c) Microsoft Corporation.
8
9
  // Licensed under the MIT license.
@@ -64,6 +65,10 @@ var ErrorCode;
64
65
  * Identity type error.
65
66
  */
66
67
  ErrorCode["IdentityTypeNotSupported"] = "IdentityTypeNotSupported";
68
+ /**
69
+ * Authentication info already exists error.
70
+ */
71
+ ErrorCode["AuthorizationInfoAlreadyExists"] = "AuthorizationInfoAlreadyExists";
67
72
  })(ErrorCode || (ErrorCode = {}));
68
73
  /**
69
74
  * @internal
@@ -85,6 +90,14 @@ ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token
85
90
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
86
91
  // IdentityTypeNotSupported Error
87
92
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
93
+ // AuthorizationInfoError
94
+ ErrorMessage.AuthorizationHeaderAlreadyExists = "Authorization header already exists!";
95
+ ErrorMessage.BasicCredentialAlreadyExists = "Basic credential already exists!";
96
+ // InvalidParameter Error
97
+ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
98
+ ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
99
+ ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
100
+ ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
88
101
  /**
89
102
  * Error class with code and message thrown by the SDK.
90
103
  *
@@ -1075,6 +1088,240 @@ class TeamsBotSsoPrompt {
1075
1088
  }
1076
1089
  }
1077
1090
 
1091
+ // Copyright (c) Microsoft Corporation.
1092
+ /**
1093
+ * Initializes new Axios instance with specific auth provider
1094
+ *
1095
+ * @param apiEndpoint - Base url of the API
1096
+ * @param authProvider - Auth provider that injects authentication info to each request
1097
+ * @returns axios instance configured with specfic auth provider
1098
+ *
1099
+ * @example
1100
+ * ```typescript
1101
+ * const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
1102
+ * ```
1103
+ *
1104
+ * @beta
1105
+ */
1106
+ function createApiClient(apiEndpoint, authProvider) {
1107
+ // Add a request interceptor
1108
+ const instance = axios.create({
1109
+ baseURL: apiEndpoint,
1110
+ });
1111
+ instance.interceptors.request.use(function (config) {
1112
+ return __awaiter(this, void 0, void 0, function* () {
1113
+ return yield authProvider.AddAuthenticationInfo(config);
1114
+ });
1115
+ });
1116
+ return instance;
1117
+ }
1118
+
1119
+ // Copyright (c) Microsoft Corporation.
1120
+ /**
1121
+ * Provider that handles Bearer Token authentication
1122
+ *
1123
+ * @beta
1124
+ */
1125
+ class BearerTokenAuthProvider {
1126
+ /**
1127
+ * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
1128
+ *
1129
+ * @beta
1130
+ */
1131
+ constructor(getToken) {
1132
+ this.getToken = getToken;
1133
+ }
1134
+ /**
1135
+ * Adds authentication info to http requests
1136
+ *
1137
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1138
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1139
+ *
1140
+ * @returns Updated axios request config.
1141
+ *
1142
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
1143
+ *
1144
+ * @beta
1145
+ */
1146
+ AddAuthenticationInfo(config) {
1147
+ return __awaiter(this, void 0, void 0, function* () {
1148
+ const token = yield this.getToken();
1149
+ if (!config.headers) {
1150
+ config.headers = {};
1151
+ }
1152
+ if (config.headers["Authorization"]) {
1153
+ throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
1154
+ }
1155
+ config.headers["Authorization"] = `Bearer ${token}`;
1156
+ return config;
1157
+ });
1158
+ }
1159
+ }
1160
+
1161
+ // Copyright (c) Microsoft Corporation.
1162
+ /**
1163
+ * Provider that handles Basic authentication
1164
+ *
1165
+ * @beta
1166
+ */
1167
+ class BasicAuthProvider {
1168
+ /**
1169
+ *
1170
+ * @param { string } userName - Username used in basic auth
1171
+ * @param { string } password - Password used in basic auth
1172
+ *
1173
+ * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
1174
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1175
+ *
1176
+ * @beta
1177
+ */
1178
+ constructor(userName, password) {
1179
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
1180
+ }
1181
+ /**
1182
+ * Adds authentication info to http requests
1183
+ *
1184
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1185
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1186
+ *
1187
+ * @returns Updated axios request config.
1188
+ *
1189
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
1190
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1191
+ *
1192
+ * @beta
1193
+ */
1194
+ AddAuthenticationInfo(config) {
1195
+ return __awaiter(this, void 0, void 0, function* () {
1196
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
1197
+ });
1198
+ }
1199
+ }
1200
+
1201
+ // Copyright (c) Microsoft Corporation.
1202
+ /**
1203
+ * Provider that handles API Key authentication
1204
+ *
1205
+ * @beta
1206
+ */
1207
+ class ApiKeyProvider {
1208
+ /**
1209
+ *
1210
+ * @param { string } keyName - The name of request header or query parameter that specifies API Key
1211
+ * @param { string } keyValue - The value of API Key
1212
+ * @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.
1213
+ *
1214
+ * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
1215
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1216
+ *
1217
+ * @beta
1218
+ */
1219
+ constructor(keyName, keyValue, keyLocation) {
1220
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
1221
+ }
1222
+ /**
1223
+ * Adds authentication info to http requests
1224
+ *
1225
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1226
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1227
+ *
1228
+ * @returns Updated axios request config.
1229
+ *
1230
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
1231
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1232
+ *
1233
+ * @beta
1234
+ */
1235
+ AddAuthenticationInfo(config) {
1236
+ return __awaiter(this, void 0, void 0, function* () {
1237
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
1238
+ });
1239
+ }
1240
+ }
1241
+ /**
1242
+ * Define available location for API Key location
1243
+ *
1244
+ * @beta
1245
+ */
1246
+ var ApiKeyLocation;
1247
+ (function (ApiKeyLocation) {
1248
+ /**
1249
+ * The API Key is placed in request header
1250
+ */
1251
+ ApiKeyLocation[ApiKeyLocation["Header"] = 0] = "Header";
1252
+ /**
1253
+ * The API Key is placed in query parameter
1254
+ */
1255
+ ApiKeyLocation[ApiKeyLocation["QueryParams"] = 1] = "QueryParams";
1256
+ })(ApiKeyLocation || (ApiKeyLocation = {}));
1257
+
1258
+ // Copyright (c) Microsoft Corporation.
1259
+ /**
1260
+ * Provider that handles Certificate authentication
1261
+ *
1262
+ * @beta
1263
+ */
1264
+ class CertificateAuthProvider {
1265
+ /**
1266
+ *
1267
+ * @param { SecureContextOptions } certOption - information about the cert used in http requests
1268
+ *
1269
+ * @beta
1270
+ */
1271
+ constructor(certOption) {
1272
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
1273
+ }
1274
+ /**
1275
+ * Adds authentication info to http requests.
1276
+ *
1277
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1278
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1279
+ *
1280
+ * @returns Updated axios request config.
1281
+ *
1282
+ * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
1283
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1284
+ *
1285
+ * @beta
1286
+ */
1287
+ AddAuthenticationInfo(config) {
1288
+ return __awaiter(this, void 0, void 0, function* () {
1289
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
1290
+ });
1291
+ }
1292
+ }
1293
+ /**
1294
+ * Helper to create SecureContextOptions from PEM format cert
1295
+ *
1296
+ * @param { string | Buffer } cert - The cert chain in PEM format
1297
+ * @param { string | Buffer } key - The private key for the cert chain
1298
+ * @param { {passphrase?: string; ca?: string | Buffer} } options - Optional settings when create the cert options.
1299
+ *
1300
+ * @returns Instance of SecureContextOptions
1301
+ *
1302
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
1303
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1304
+ *
1305
+ */
1306
+ function createPemCertOption(cert, key, options) {
1307
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPemCertOption"), ErrorCode.RuntimeNotSupported);
1308
+ }
1309
+ /**
1310
+ * Helper to create SecureContextOptions from PFX format cert
1311
+ *
1312
+ * @param { string | Buffer } pfx - The content of .pfx file
1313
+ * @param { {passphrase?: string} } options - Optional settings when create the cert options.
1314
+ *
1315
+ * @returns Instance of SecureContextOptions
1316
+ *
1317
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
1318
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1319
+ *
1320
+ */
1321
+ function createPfxCertOption(pfx, options) {
1322
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPfxCertOption"), ErrorCode.RuntimeNotSupported);
1323
+ }
1324
+
1078
1325
  // Copyright (c) Microsoft Corporation.
1079
1326
  // Licensed under the MIT license.
1080
1327
  /**
@@ -1195,5 +1442,415 @@ class TeamsFx {
1195
1442
  }
1196
1443
  }
1197
1444
 
1198
- export { AppCredential, ErrorCode, ErrorWithCode, IdentityType, LogLevel, MsGraphAuthProvider, OnBehalfOfUserCredential, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, setLogFunction, setLogLevel, setLogger };
1445
+ // Copyright (c) Microsoft Corporation.
1446
+ /**
1447
+ * Provide utilities for bot conversation, including:
1448
+ * - handle command and response.
1449
+ * - send notification to varies targets (e.g., member, group, channel).
1450
+ *
1451
+ * @remarks
1452
+ * Only work on server side.
1453
+ *
1454
+ * @beta
1455
+ */
1456
+ class ConversationBot {
1457
+ /**
1458
+ * Creates new instance of the `ConversationBot`.
1459
+ *
1460
+ * @param options - initialize options
1461
+ *
1462
+ * @remarks
1463
+ * Only work on server side.
1464
+ *
1465
+ * @beta
1466
+ */
1467
+ constructor(options) {
1468
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1469
+ }
1470
+ /**
1471
+ * The request handler to integrate with web request.
1472
+ *
1473
+ * @param req - an Express or Restify style request object.
1474
+ * @param res - an Express or Restify style response object.
1475
+ * @param logic - the additional function to handle bot context.
1476
+ *
1477
+ * @remarks
1478
+ * Only work on server side.
1479
+ *
1480
+ * @beta
1481
+ */
1482
+ requestHandler(req, res, logic) {
1483
+ return __awaiter(this, void 0, void 0, function* () {
1484
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1485
+ });
1486
+ }
1487
+ }
1488
+
1489
+ // Copyright (c) Microsoft Corporation.
1490
+ /**
1491
+ * Send a plain text message to a notification target.
1492
+ *
1493
+ * @remarks
1494
+ * Only work on server side.
1495
+ *
1496
+ * @param target - the notification target.
1497
+ * @param text - the plain text message.
1498
+ * @returns A `Promise` representing the asynchronous operation.
1499
+ *
1500
+ * @beta
1501
+ */
1502
+ function sendMessage(target, text) {
1503
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
1504
+ }
1505
+ /**
1506
+ * Send an adaptive card message to a notification target.
1507
+ *
1508
+ * @remarks
1509
+ * Only work on server side.
1510
+ *
1511
+ * @param target - the notification target.
1512
+ * @param card - the adaptive card raw JSON.
1513
+ * @returns A `Promise` representing the asynchronous operation.
1514
+ *
1515
+ * @beta
1516
+ */
1517
+ function sendAdaptiveCard(target, card) {
1518
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
1519
+ }
1520
+ /**
1521
+ * A {@link NotificationTarget} that represents a team channel.
1522
+ *
1523
+ * @remarks
1524
+ * Only work on server side.
1525
+ *
1526
+ * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
1527
+ *
1528
+ * @beta
1529
+ */
1530
+ class Channel {
1531
+ /**
1532
+ * Constuctor.
1533
+ *
1534
+ * @remarks
1535
+ * Only work on server side.
1536
+ *
1537
+ * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.
1538
+ *
1539
+ * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
1540
+ * @param info - Detailed channel information.
1541
+ *
1542
+ * @beta
1543
+ */
1544
+ constructor(parent, info) {
1545
+ /**
1546
+ * Notification target type. For channel it's always "Channel".
1547
+ *
1548
+ * @remarks
1549
+ * Only work on server side.
1550
+ *
1551
+ * @beta
1552
+ */
1553
+ this.type = "Channel";
1554
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1555
+ }
1556
+ /**
1557
+ * Send a plain text message.
1558
+ *
1559
+ * @remarks
1560
+ * Only work on server side.
1561
+ *
1562
+ * @param text - the plain text message.
1563
+ * @returns A `Promise` representing the asynchronous operation.
1564
+ *
1565
+ * @beta
1566
+ */
1567
+ sendMessage(text) {
1568
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1569
+ }
1570
+ /**
1571
+ * Send an adaptive card message.
1572
+ *
1573
+ * @remarks
1574
+ * Only work on server side.
1575
+ *
1576
+ * @param card - the adaptive card raw JSON.
1577
+ * @returns A `Promise` representing the asynchronous operation.
1578
+ *
1579
+ * @beta
1580
+ */
1581
+ sendAdaptiveCard(card) {
1582
+ return __awaiter(this, void 0, void 0, function* () {
1583
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1584
+ });
1585
+ }
1586
+ }
1587
+ /**
1588
+ * A {@link NotificationTarget} that represents a team member.
1589
+ *
1590
+ * @remarks
1591
+ * Only work on server side.
1592
+ *
1593
+ * It's recommended to get members from {@link TeamsBotInstallation.members()}.
1594
+ *
1595
+ * @beta
1596
+ */
1597
+ class Member {
1598
+ /**
1599
+ * Constuctor.
1600
+ *
1601
+ * @remarks
1602
+ * Only work on server side.
1603
+ *
1604
+ * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.
1605
+ *
1606
+ * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
1607
+ * @param account - Detailed member account information.
1608
+ *
1609
+ * @beta
1610
+ */
1611
+ constructor(parent, account) {
1612
+ /**
1613
+ * Notification target type. For member it's always "Person".
1614
+ *
1615
+ * @remarks
1616
+ * Only work on server side.
1617
+ *
1618
+ * @beta
1619
+ */
1620
+ this.type = "Person";
1621
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1622
+ }
1623
+ /**
1624
+ * Send a plain text message.
1625
+ *
1626
+ * @remarks
1627
+ * Only work on server side.
1628
+ *
1629
+ * @param text - the plain text message.
1630
+ * @returns A `Promise` representing the asynchronous operation.
1631
+ *
1632
+ * @beta
1633
+ */
1634
+ sendMessage(text) {
1635
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1636
+ }
1637
+ /**
1638
+ * Send an adaptive card message.
1639
+ *
1640
+ * @remarks
1641
+ * Only work on server side.
1642
+ *
1643
+ * @param card - the adaptive card raw JSON.
1644
+ * @returns A `Promise` representing the asynchronous operation.
1645
+ *
1646
+ * @beta
1647
+ */
1648
+ sendAdaptiveCard(card) {
1649
+ return __awaiter(this, void 0, void 0, function* () {
1650
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1651
+ });
1652
+ }
1653
+ }
1654
+ /**
1655
+ * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into
1656
+ * - Personal chat
1657
+ * - Group chat
1658
+ * - Team (by default the `General` channel)
1659
+ *
1660
+ * @remarks
1661
+ * Only work on server side.
1662
+ *
1663
+ * It's recommended to get bot installations from {@link ConversationBot.installations()}.
1664
+ *
1665
+ * @beta
1666
+ */
1667
+ class TeamsBotInstallation {
1668
+ /**
1669
+ * Constructor
1670
+ *
1671
+ * @remarks
1672
+ * Only work on server side.
1673
+ *
1674
+ * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.
1675
+ *
1676
+ * @param adapter - the bound `BotFrameworkAdapter`.
1677
+ * @param conversationReference - the bound `ConversationReference`.
1678
+ *
1679
+ * @beta
1680
+ */
1681
+ constructor(adapter, conversationReference) {
1682
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1683
+ }
1684
+ /**
1685
+ * Send a plain text message.
1686
+ *
1687
+ * @remarks
1688
+ * Only work on server side.
1689
+ *
1690
+ * @param text - the plain text message.
1691
+ * @returns A `Promise` representing the asynchronous operation.
1692
+ *
1693
+ * @beta
1694
+ */
1695
+ sendMessage(text) {
1696
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1697
+ }
1698
+ /**
1699
+ * Send an adaptive card message.
1700
+ *
1701
+ * @remarks
1702
+ * Only work on server side.
1703
+ *
1704
+ * @param card - the adaptive card raw JSON.
1705
+ * @returns A `Promise` representing the asynchronous operation.
1706
+ *
1707
+ * @beta
1708
+ */
1709
+ sendAdaptiveCard(card) {
1710
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1711
+ }
1712
+ /**
1713
+ * Get channels from this bot installation.
1714
+ *
1715
+ * @remarks
1716
+ * Only work on server side.
1717
+ *
1718
+ * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1719
+ *
1720
+ * @beta
1721
+ */
1722
+ channels() {
1723
+ return __awaiter(this, void 0, void 0, function* () {
1724
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1725
+ });
1726
+ }
1727
+ /**
1728
+ * Get members from this bot installation.
1729
+ *
1730
+ * @remarks
1731
+ * Only work on server side.
1732
+ *
1733
+ * @returns an array of members from where the bot is installed.
1734
+ *
1735
+ * @beta
1736
+ */
1737
+ members() {
1738
+ return __awaiter(this, void 0, void 0, function* () {
1739
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1740
+ });
1741
+ }
1742
+ }
1743
+ /**
1744
+ * Provide static utilities for bot notification.
1745
+ *
1746
+ * @remarks
1747
+ * Only work on server side.
1748
+ *
1749
+ * @example
1750
+ * Here's an example on how to send notification via Teams Bot.
1751
+ * ```typescript
1752
+ * // initialize (it's recommended to be called before handling any bot message)
1753
+ * const notificationBot = new NotificationBot(adapter);
1754
+ *
1755
+ * // get all bot installations and send message
1756
+ * for (const target of await notificationBot.installations()) {
1757
+ * await target.sendMessage("Hello Notification");
1758
+ * }
1759
+ *
1760
+ * // alternative - send message to all members
1761
+ * for (const target of await notificationBot.installations()) {
1762
+ * for (const member of await target.members()) {
1763
+ * await member.sendMessage("Hello Notification");
1764
+ * }
1765
+ * }
1766
+ * ```
1767
+ *
1768
+ * @beta
1769
+ */
1770
+ class NotificationBot {
1771
+ /**
1772
+ * constructor of the notification bot.
1773
+ *
1774
+ * @remarks
1775
+ * Only work on server side.
1776
+ *
1777
+ * To ensure accuracy, it's recommended to initialize before handling any message.
1778
+ *
1779
+ * @param adapter - the bound `BotFrameworkAdapter`
1780
+ * @param options - initialize options
1781
+ *
1782
+ * @beta
1783
+ */
1784
+ constructor(adapter, options) {
1785
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1786
+ }
1787
+ /**
1788
+ * Get all targets where the bot is installed.
1789
+ *
1790
+ * @remarks
1791
+ * Only work on server side.
1792
+ *
1793
+ * The result is retrieving from the persisted storage.
1794
+ *
1795
+ * @returns - an array of {@link TeamsBotInstallation}.
1796
+ *
1797
+ * @beta
1798
+ */
1799
+ static installations() {
1800
+ return __awaiter(this, void 0, void 0, function* () {
1801
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1802
+ });
1803
+ }
1804
+ }
1805
+
1806
+ // Copyright (c) Microsoft Corporation.
1807
+ /**
1808
+ * A command bot for receiving commands and sending responses in Teams.
1809
+ *
1810
+ * @remarks
1811
+ * Only work on server side.
1812
+ *
1813
+ * @beta
1814
+ */
1815
+ class CommandBot {
1816
+ /**
1817
+ * Creates a new instance of the `CommandBot`.
1818
+ *
1819
+ * @param adapter The bound `BotFrameworkAdapter`.
1820
+ * @param commands The commands to registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.
1821
+ *
1822
+ * @beta
1823
+ */
1824
+ constructor(adapter, commands) {
1825
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1826
+ }
1827
+ /**
1828
+ * Registers a command into the command bot.
1829
+ *
1830
+ * @param command The command to registered.
1831
+ *
1832
+ * @remarks
1833
+ * Only work on server side.
1834
+ *
1835
+ * @beta
1836
+ */
1837
+ registerCommand(command) {
1838
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1839
+ }
1840
+ /**
1841
+ * Registers commands into the command bot.
1842
+ *
1843
+ * @param commands The command to registered.
1844
+ *
1845
+ * @remarks
1846
+ * Only work on server side.
1847
+ *
1848
+ * @beta
1849
+ */
1850
+ registerCommands(commands) {
1851
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandnBot"), ErrorCode.RuntimeNotSupported);
1852
+ }
1853
+ }
1854
+
1855
+ export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1199
1856
  //# sourceMappingURL=index.esm5.js.map