@microsoft/teamsfx 2.2.3-alpha.9b38c38b5.0 → 2.2.3-beta.2023080907.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.
@@ -1,5 +1,5 @@
1
- import { __awaiter } from 'tslib';
2
1
  import jwt_decode from 'jwt-decode';
2
+ import { __awaiter } from 'tslib';
3
3
  import { app, authentication } from '@microsoft/teams-js';
4
4
  import { PublicClientApplication } from '@azure/msal-browser';
5
5
  import { Client } from '@microsoft/microsoft-graph-client';
@@ -443,9 +443,7 @@ class AppCredential {
443
443
  * Only works in in server side.
444
444
  */
445
445
  getToken(scopes, options) {
446
- return __awaiter(this, void 0, void 0, function* () {
447
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
448
- });
446
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported));
449
447
  }
450
448
  }
451
449
 
@@ -466,9 +464,7 @@ class OnBehalfOfUserCredential {
466
464
  * Can only be used in server side.
467
465
  */
468
466
  getToken(scopes, options) {
469
- return __awaiter(this, void 0, void 0, function* () {
470
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
471
- });
467
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported));
472
468
  }
473
469
  /**
474
470
  * Get basic user info from SSO token.
@@ -476,7 +472,7 @@ class OnBehalfOfUserCredential {
476
472
  * Can only be used in server side.
477
473
  */
478
474
  getUserInfo() {
479
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
475
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported));
480
476
  }
481
477
  }
482
478
 
@@ -530,7 +526,7 @@ class TeamsUserCredential {
530
526
  let result;
531
527
  try {
532
528
  const params = {
533
- url: `${this.config.initiateLoginEndpoint}?clientId=${this.config.clientId}&scope=${encodeURI(scopesStr)}&loginHint=${this.loginHint}`,
529
+ url: `${this.config.initiateLoginEndpoint ? this.config.initiateLoginEndpoint : ""}?clientId=${this.config.clientId ? this.config.clientId : ""}&scope=${encodeURI(scopesStr)}&loginHint=${this.loginHint ? this.loginHint : ""}`,
534
530
  width: loginPageWidth,
535
531
  height: loginPageHeight,
536
532
  };
@@ -803,8 +799,10 @@ class TeamsUserCredential {
803
799
 
804
800
  // Copyright (c) Microsoft Corporation.
805
801
  const defaultScope = "https://graph.microsoft.com/.default";
802
+ // eslint-disable-next-line no-secrets/no-secrets
806
803
  /**
807
804
  * Microsoft Graph auth provider for Teams Framework
805
+ * @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.
808
806
  */
809
807
  class MsGraphAuthProvider {
810
808
  constructor(credentialOrTeamsFx, scopes) {
@@ -834,7 +832,7 @@ class MsGraphAuthProvider {
834
832
  */
835
833
  getAccessToken() {
836
834
  return __awaiter(this, void 0, void 0, function* () {
837
- internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);
835
+ internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);
838
836
  let accessToken;
839
837
  if (this.credentialOrTeamsFx.getCredential) {
840
838
  accessToken = yield this.credentialOrTeamsFx
@@ -861,6 +859,14 @@ class MsGraphAuthProvider {
861
859
  // Copyright (c) Microsoft Corporation.
862
860
  /**
863
861
  * Get Microsoft graph client.
862
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
863
+ * ```typescript
864
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
865
+ * const graph = Client.initWithMiddleware({
866
+ * authProvider: authProvider,
867
+ * });
868
+ * ```
869
+ *
864
870
  * @example
865
871
  * Get Microsoft graph client by TokenCredential
866
872
  * ```typescript
@@ -918,6 +924,14 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
918
924
  // eslint-disable-next-line no-secrets/no-secrets
919
925
  /**
920
926
  * Get Microsoft graph client.
927
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
928
+ * ```typescript
929
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
930
+ * const graph = Client.initWithMiddleware({
931
+ * authProvider: authProvider,
932
+ * });
933
+ * ```
934
+ *
921
935
  * @example
922
936
  * Get Microsoft graph client by TokenCredential
923
937
  * ```typescript
@@ -986,9 +1000,7 @@ function createMicrosoftGraphClientWithCredential(credential, scopes) {
986
1000
  * Only works in in server side.
987
1001
  */
988
1002
  function getTediousConnectionConfig(teamsfx, databaseName) {
989
- return __awaiter(this, void 0, void 0, function* () {
990
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultTediousConnectionConfiguration"), ErrorCode.RuntimeNotSupported);
991
- });
1003
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultTediousConnectionConfiguration"), ErrorCode.RuntimeNotSupported));
992
1004
  }
993
1005
 
994
1006
  // Copyright (c) Microsoft Corporation.
@@ -1070,9 +1082,7 @@ class TeamsBotSsoPrompt {
1070
1082
  * @returns A `Promise` representing the asynchronous operation.
1071
1083
  */
1072
1084
  beginDialog(dc) {
1073
- return __awaiter(this, void 0, void 0, function* () {
1074
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
1075
- });
1085
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported));
1076
1086
  }
1077
1087
  /**
1078
1088
  * Called when a prompt dialog is the active dialog and the user replied with a new activity.
@@ -1091,9 +1101,7 @@ class TeamsBotSsoPrompt {
1091
1101
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1092
1102
  */
1093
1103
  continueDialog(dc) {
1094
- return __awaiter(this, void 0, void 0, function* () {
1095
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
1096
- });
1104
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported));
1097
1105
  }
1098
1106
  }
1099
1107
 
@@ -1187,9 +1195,7 @@ class BasicAuthProvider {
1187
1195
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1188
1196
  */
1189
1197
  AddAuthenticationInfo(config) {
1190
- return __awaiter(this, void 0, void 0, function* () {
1191
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
1192
- });
1198
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported));
1193
1199
  }
1194
1200
  }
1195
1201
 
@@ -1222,9 +1228,7 @@ class ApiKeyProvider {
1222
1228
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1223
1229
  */
1224
1230
  AddAuthenticationInfo(config) {
1225
- return __awaiter(this, void 0, void 0, function* () {
1226
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
1227
- });
1231
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported));
1228
1232
  }
1229
1233
  }
1230
1234
  /**
@@ -1266,9 +1270,7 @@ class CertificateAuthProvider {
1266
1270
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1267
1271
  */
1268
1272
  AddAuthenticationInfo(config) {
1269
- return __awaiter(this, void 0, void 0, function* () {
1270
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
1271
- });
1273
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported));
1272
1274
  }
1273
1275
  }
1274
1276
  /**
@@ -1323,6 +1325,8 @@ var IdentityType;
1323
1325
  // Copyright (c) Microsoft Corporation.
1324
1326
  /**
1325
1327
  * A class providing credential and configuration.
1328
+ * @deprecated Please use {@link TeamsUserCredential}
1329
+ * in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.
1326
1330
  */
1327
1331
  class TeamsFx {
1328
1332
  constructor(identityType, customConfig) {
@@ -1515,9 +1519,7 @@ class ConversationBot$1 {
1515
1519
  * Only work on server side.
1516
1520
  */
1517
1521
  requestHandler(req, res, logic) {
1518
- return __awaiter(this, void 0, void 0, function* () {
1519
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1520
- });
1522
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1521
1523
  }
1522
1524
  }
1523
1525
 
@@ -1643,9 +1645,7 @@ class Channel$1 {
1643
1645
  * @returns the response of sending adaptive card message.
1644
1646
  */
1645
1647
  sendAdaptiveCard(card, onError) {
1646
- return __awaiter(this, void 0, void 0, function* () {
1647
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1648
- });
1648
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1649
1649
  }
1650
1650
  }
1651
1651
  /**
@@ -1702,9 +1702,7 @@ class Member$1 {
1702
1702
  * @returns the response of sending adaptive card message.
1703
1703
  */
1704
1704
  sendAdaptiveCard(card, onError) {
1705
- return __awaiter(this, void 0, void 0, function* () {
1706
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1707
- });
1705
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1708
1706
  }
1709
1707
  }
1710
1708
  /**
@@ -1771,9 +1769,7 @@ class TeamsBotInstallation$1 {
1771
1769
  * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1772
1770
  */
1773
1771
  channels() {
1774
- return __awaiter(this, void 0, void 0, function* () {
1775
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1776
- });
1772
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1777
1773
  }
1778
1774
  /**
1779
1775
  * Get members from this bot installation.
@@ -1784,9 +1780,7 @@ class TeamsBotInstallation$1 {
1784
1780
  * @returns an array of members from where the bot is installed.
1785
1781
  */
1786
1782
  members() {
1787
- return __awaiter(this, void 0, void 0, function* () {
1788
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1789
- });
1783
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1790
1784
  }
1791
1785
  /**
1792
1786
  * Get team details from this bot installation
@@ -1794,9 +1788,7 @@ class TeamsBotInstallation$1 {
1794
1788
  * @returns the team details if bot is installed into a team, otherwise returns undefined.
1795
1789
  */
1796
1790
  getTeamDetails() {
1797
- return __awaiter(this, void 0, void 0, function* () {
1798
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1799
- });
1791
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1800
1792
  }
1801
1793
  }
1802
1794
  /**
@@ -1853,9 +1845,7 @@ class NotificationBot$1 {
1853
1845
  * @returns - an array of {@link TeamsBotInstallation}.
1854
1846
  */
1855
1847
  static installations() {
1856
- return __awaiter(this, void 0, void 0, function* () {
1857
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1858
- });
1848
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1859
1849
  }
1860
1850
  /**
1861
1851
  * Returns the first {@link Member} where predicate is true, and undefined otherwise.
@@ -1871,9 +1861,7 @@ class NotificationBot$1 {
1871
1861
  * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1872
1862
  */
1873
1863
  findMember(predicate, scope) {
1874
- return __awaiter(this, void 0, void 0, function* () {
1875
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1876
- });
1864
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1877
1865
  }
1878
1866
  /**
1879
1867
  * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
@@ -1888,9 +1876,7 @@ class NotificationBot$1 {
1888
1876
  * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1889
1877
  */
1890
1878
  findChannel(predicate) {
1891
- return __awaiter(this, void 0, void 0, function* () {
1892
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1893
- });
1879
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1894
1880
  }
1895
1881
  /**
1896
1882
  * Returns all {@link Member} where predicate is true, and empty array otherwise.
@@ -1904,9 +1890,7 @@ class NotificationBot$1 {
1904
1890
  * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1905
1891
  */
1906
1892
  findAllMembers(predicate, scope) {
1907
- return __awaiter(this, void 0, void 0, function* () {
1908
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1909
- });
1893
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1910
1894
  }
1911
1895
  /**
1912
1896
  * Returns all {@link Channel} where predicate is true, and empty array otherwise.
@@ -1919,9 +1903,7 @@ class NotificationBot$1 {
1919
1903
  * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1920
1904
  */
1921
1905
  findAllChannels(predicate) {
1922
- return __awaiter(this, void 0, void 0, function* () {
1923
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1924
- });
1906
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1925
1907
  }
1926
1908
  }
1927
1909
  /**
@@ -2050,15 +2032,15 @@ class CardActionBot$1 {
2050
2032
  }
2051
2033
  }
2052
2034
 
2035
+ // eslint-disable-next-line no-secrets/no-secrets
2053
2036
  /**
2054
2037
  * Users execute query with SSO or Access Token.
2038
+ * @deprecated
2055
2039
  * @remarks
2056
2040
  * Only works in in server side.
2057
2041
  */
2058
2042
  function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2059
- return __awaiter(this, void 0, void 0, function* () {
2060
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2061
- });
2043
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2062
2044
  }
2063
2045
  /**
2064
2046
  * Users execute query with SSO or Access Token.
@@ -2066,9 +2048,7 @@ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2066
2048
  * Only works in in server side.
2067
2049
  */
2068
2050
  function handleMessageExtensionQueryWithSSO(context, config, initiateLoginEndpoint, scopes, logic) {
2069
- return __awaiter(this, void 0, void 0, function* () {
2070
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2071
- });
2051
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2072
2052
  }
2073
2053
 
2074
2054
  // Copyright (c) Microsoft Corporation.
@@ -2103,9 +2083,7 @@ class ConversationBot {
2103
2083
  * Only work on server side.
2104
2084
  */
2105
2085
  requestHandler(req, res, logic) {
2106
- return __awaiter(this, void 0, void 0, function* () {
2107
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
2108
- });
2086
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported));
2109
2087
  }
2110
2088
  }
2111
2089
 
@@ -2123,7 +2101,7 @@ class ConversationBot {
2123
2101
  * @returns A `Promise` representing the asynchronous operation.
2124
2102
  */
2125
2103
  function sendMessage(target, text, onError) {
2126
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
2104
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported));
2127
2105
  }
2128
2106
  /**
2129
2107
  * Send an adaptive card message to a notification target.
@@ -2138,7 +2116,7 @@ function sendMessage(target, text, onError) {
2138
2116
  * @returns A `Promise` representing the asynchronous operation.
2139
2117
  */
2140
2118
  function sendAdaptiveCard(target, card, onError) {
2141
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
2119
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported));
2142
2120
  }
2143
2121
  /**
2144
2122
  * A {@link NotificationTarget} that represents a team channel.
@@ -2182,7 +2160,7 @@ class Channel {
2182
2160
  * @returns The response of sending message.
2183
2161
  */
2184
2162
  sendMessage(text, onError) {
2185
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
2163
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported));
2186
2164
  }
2187
2165
  /**
2188
2166
  * Send an adaptive card message.
@@ -2196,9 +2174,7 @@ class Channel {
2196
2174
  * @returns The response of sending adaptive card message.
2197
2175
  */
2198
2176
  sendAdaptiveCard(card, onError) {
2199
- return __awaiter(this, void 0, void 0, function* () {
2200
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
2201
- });
2177
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported));
2202
2178
  }
2203
2179
  }
2204
2180
  /**
@@ -2243,7 +2219,7 @@ class Member {
2243
2219
  * @returns The response of sending message.
2244
2220
  */
2245
2221
  sendMessage(text, onError) {
2246
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
2222
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported));
2247
2223
  }
2248
2224
  /**
2249
2225
  * Send an adaptive card message.
@@ -2257,9 +2233,7 @@ class Member {
2257
2233
  * @returns The response of sending adaptive card message.
2258
2234
  */
2259
2235
  sendAdaptiveCard(card, onError) {
2260
- return __awaiter(this, void 0, void 0, function* () {
2261
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
2262
- });
2236
+ return Promise.reject(Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported)));
2263
2237
  }
2264
2238
  }
2265
2239
  /**
@@ -2300,7 +2274,7 @@ class TeamsBotInstallation {
2300
2274
  * @returns The response of sending message.
2301
2275
  */
2302
2276
  sendMessage(text, onError) {
2303
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2277
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2304
2278
  }
2305
2279
  /**
2306
2280
  * Send an adaptive card message.
@@ -2314,7 +2288,7 @@ class TeamsBotInstallation {
2314
2288
  * @returns The response of sending adaptive card message.
2315
2289
  */
2316
2290
  sendAdaptiveCard(card, onError) {
2317
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2291
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2318
2292
  }
2319
2293
  /**
2320
2294
  * Get channels from this bot installation.
@@ -2325,9 +2299,7 @@ class TeamsBotInstallation {
2325
2299
  * @returns An array of channels if bot is installed into a team, otherwise returns an empty array.
2326
2300
  */
2327
2301
  channels() {
2328
- return __awaiter(this, void 0, void 0, function* () {
2329
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2330
- });
2302
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2331
2303
  }
2332
2304
  /**
2333
2305
  * Get members from this bot installation.
@@ -2338,9 +2310,7 @@ class TeamsBotInstallation {
2338
2310
  * @returns An array of members from where the bot is installed.
2339
2311
  */
2340
2312
  members() {
2341
- return __awaiter(this, void 0, void 0, function* () {
2342
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2343
- });
2313
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2344
2314
  }
2345
2315
  /**
2346
2316
  * Get team details from this bot installation
@@ -2348,9 +2318,7 @@ class TeamsBotInstallation {
2348
2318
  * @returns The team details if bot is installed into a team, otherwise returns undefined.
2349
2319
  */
2350
2320
  getTeamDetails() {
2351
- return __awaiter(this, void 0, void 0, function* () {
2352
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2353
- });
2321
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2354
2322
  }
2355
2323
  }
2356
2324
  /**
@@ -2404,9 +2372,7 @@ class NotificationBot {
2404
2372
  * @returns An array of {@link TeamsBotInstallation}.
2405
2373
  */
2406
2374
  static installations() {
2407
- return __awaiter(this, void 0, void 0, function* () {
2408
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2409
- });
2375
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2410
2376
  }
2411
2377
  /**
2412
2378
  * Return the first {@link Member} where predicate is true, and undefined otherwise.
@@ -2422,9 +2388,7 @@ class NotificationBot {
2422
2388
  * @returns The first {@link Member} where predicate is true, and undefined otherwise.
2423
2389
  */
2424
2390
  findMember(predicate, scope) {
2425
- return __awaiter(this, void 0, void 0, function* () {
2426
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2427
- });
2391
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2428
2392
  }
2429
2393
  /**
2430
2394
  * Return the first {@link Channel} where predicate is true, and undefined otherwise.
@@ -2440,9 +2404,7 @@ class NotificationBot {
2440
2404
  * @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.
2441
2405
  */
2442
2406
  findChannel(predicate) {
2443
- return __awaiter(this, void 0, void 0, function* () {
2444
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2445
- });
2407
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2446
2408
  }
2447
2409
  /**
2448
2410
  * Return all {@link Member} where predicate is true, and empty array otherwise.
@@ -2457,9 +2419,7 @@ class NotificationBot {
2457
2419
  * @returns An array of {@link Member} where predicate is true, and empty array otherwise.
2458
2420
  */
2459
2421
  findAllMembers(predicate, scope) {
2460
- return __awaiter(this, void 0, void 0, function* () {
2461
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2462
- });
2422
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2463
2423
  }
2464
2424
  /**
2465
2425
  * Return all {@link Channel} where predicate is true, and empty array otherwise.
@@ -2473,9 +2433,7 @@ class NotificationBot {
2473
2433
  * @returns An array of {@link Channel} where predicate is true, and empty array otherwise.
2474
2434
  */
2475
2435
  findAllChannels(predicate) {
2476
- return __awaiter(this, void 0, void 0, function* () {
2477
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2478
- });
2436
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2479
2437
  }
2480
2438
  }
2481
2439
  /**
@@ -2585,7 +2543,7 @@ class CardActionBot {
2585
2543
  * Only work on server side.
2586
2544
  */
2587
2545
  registerHandler(actionHandler) {
2588
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2546
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported));
2589
2547
  }
2590
2548
  /**
2591
2549
  * Register card action handlers to the bot.
@@ -2596,7 +2554,7 @@ class CardActionBot {
2596
2554
  * Only work on server side.
2597
2555
  */
2598
2556
  registerHandlers(actionHandlers) {
2599
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2557
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported));
2600
2558
  }
2601
2559
  }
2602
2560