@microsoft/teamsfx 2.2.3-alpha.9b38c38b5.0 → 2.2.3-alpha.a0d5ed36e.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,4 +1,3 @@
1
- import { __awaiter } from 'tslib';
2
1
  import jwt_decode from 'jwt-decode';
3
2
  import { app, authentication } from '@microsoft/teams-js';
4
3
  import { PublicClientApplication } from '@azure/msal-browser';
@@ -443,9 +442,7 @@ class AppCredential {
443
442
  * Only works in in server side.
444
443
  */
445
444
  getToken(scopes, options) {
446
- return __awaiter(this, void 0, void 0, function* () {
447
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
448
- });
445
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported));
449
446
  }
450
447
  }
451
448
 
@@ -466,9 +463,7 @@ class OnBehalfOfUserCredential {
466
463
  * Can only be used in server side.
467
464
  */
468
465
  getToken(scopes, options) {
469
- return __awaiter(this, void 0, void 0, function* () {
470
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
471
- });
466
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported));
472
467
  }
473
468
  /**
474
469
  * Get basic user info from SSO token.
@@ -476,10 +471,40 @@ class OnBehalfOfUserCredential {
476
471
  * Can only be used in server side.
477
472
  */
478
473
  getUserInfo() {
479
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
474
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported));
480
475
  }
481
476
  }
482
477
 
478
+ /******************************************************************************
479
+ Copyright (c) Microsoft Corporation.
480
+
481
+ Permission to use, copy, modify, and/or distribute this software for any
482
+ purpose with or without fee is hereby granted.
483
+
484
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
485
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
486
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
487
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
488
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
489
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
490
+ PERFORMANCE OF THIS SOFTWARE.
491
+ ***************************************************************************** */
492
+
493
+ function __awaiter(thisArg, _arguments, P, generator) {
494
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
495
+ return new (P || (P = Promise))(function (resolve, reject) {
496
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
497
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
498
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
499
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
500
+ });
501
+ }
502
+
503
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
504
+ var e = new Error(message);
505
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
506
+ };
507
+
483
508
  // Copyright (c) Microsoft Corporation.
484
509
  const tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;
485
510
  const loginPageWidth = 600;
@@ -530,7 +555,7 @@ class TeamsUserCredential {
530
555
  let result;
531
556
  try {
532
557
  const params = {
533
- url: `${this.config.initiateLoginEndpoint}?clientId=${this.config.clientId}&scope=${encodeURI(scopesStr)}&loginHint=${this.loginHint}`,
558
+ url: `${this.config.initiateLoginEndpoint ? this.config.initiateLoginEndpoint : ""}?clientId=${this.config.clientId ? this.config.clientId : ""}&scope=${encodeURI(scopesStr)}&loginHint=${this.loginHint ? this.loginHint : ""}`,
534
559
  width: loginPageWidth,
535
560
  height: loginPageHeight,
536
561
  };
@@ -803,8 +828,10 @@ class TeamsUserCredential {
803
828
 
804
829
  // Copyright (c) Microsoft Corporation.
805
830
  const defaultScope = "https://graph.microsoft.com/.default";
831
+ // eslint-disable-next-line no-secrets/no-secrets
806
832
  /**
807
833
  * Microsoft Graph auth provider for Teams Framework
834
+ * @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.
808
835
  */
809
836
  class MsGraphAuthProvider {
810
837
  constructor(credentialOrTeamsFx, scopes) {
@@ -834,7 +861,7 @@ class MsGraphAuthProvider {
834
861
  */
835
862
  getAccessToken() {
836
863
  return __awaiter(this, void 0, void 0, function* () {
837
- internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);
864
+ internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);
838
865
  let accessToken;
839
866
  if (this.credentialOrTeamsFx.getCredential) {
840
867
  accessToken = yield this.credentialOrTeamsFx
@@ -861,6 +888,14 @@ class MsGraphAuthProvider {
861
888
  // Copyright (c) Microsoft Corporation.
862
889
  /**
863
890
  * Get Microsoft graph client.
891
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
892
+ * ```typescript
893
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
894
+ * const graph = Client.initWithMiddleware({
895
+ * authProvider: authProvider,
896
+ * });
897
+ * ```
898
+ *
864
899
  * @example
865
900
  * Get Microsoft graph client by TokenCredential
866
901
  * ```typescript
@@ -918,6 +953,14 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
918
953
  // eslint-disable-next-line no-secrets/no-secrets
919
954
  /**
920
955
  * Get Microsoft graph client.
956
+ * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.
957
+ * ```typescript
958
+ * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
959
+ * const graph = Client.initWithMiddleware({
960
+ * authProvider: authProvider,
961
+ * });
962
+ * ```
963
+ *
921
964
  * @example
922
965
  * Get Microsoft graph client by TokenCredential
923
966
  * ```typescript
@@ -986,9 +1029,7 @@ function createMicrosoftGraphClientWithCredential(credential, scopes) {
986
1029
  * Only works in in server side.
987
1030
  */
988
1031
  function getTediousConnectionConfig(teamsfx, databaseName) {
989
- return __awaiter(this, void 0, void 0, function* () {
990
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultTediousConnectionConfiguration"), ErrorCode.RuntimeNotSupported);
991
- });
1032
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultTediousConnectionConfiguration"), ErrorCode.RuntimeNotSupported));
992
1033
  }
993
1034
 
994
1035
  // Copyright (c) Microsoft Corporation.
@@ -1070,9 +1111,7 @@ class TeamsBotSsoPrompt {
1070
1111
  * @returns A `Promise` representing the asynchronous operation.
1071
1112
  */
1072
1113
  beginDialog(dc) {
1073
- return __awaiter(this, void 0, void 0, function* () {
1074
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
1075
- });
1114
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported));
1076
1115
  }
1077
1116
  /**
1078
1117
  * Called when a prompt dialog is the active dialog and the user replied with a new activity.
@@ -1091,9 +1130,7 @@ class TeamsBotSsoPrompt {
1091
1130
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1092
1131
  */
1093
1132
  continueDialog(dc) {
1094
- return __awaiter(this, void 0, void 0, function* () {
1095
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
1096
- });
1133
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported));
1097
1134
  }
1098
1135
  }
1099
1136
 
@@ -1187,9 +1224,7 @@ class BasicAuthProvider {
1187
1224
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1188
1225
  */
1189
1226
  AddAuthenticationInfo(config) {
1190
- return __awaiter(this, void 0, void 0, function* () {
1191
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
1192
- });
1227
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported));
1193
1228
  }
1194
1229
  }
1195
1230
 
@@ -1222,9 +1257,7 @@ class ApiKeyProvider {
1222
1257
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1223
1258
  */
1224
1259
  AddAuthenticationInfo(config) {
1225
- return __awaiter(this, void 0, void 0, function* () {
1226
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
1227
- });
1260
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported));
1228
1261
  }
1229
1262
  }
1230
1263
  /**
@@ -1266,9 +1299,7 @@ class CertificateAuthProvider {
1266
1299
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1267
1300
  */
1268
1301
  AddAuthenticationInfo(config) {
1269
- return __awaiter(this, void 0, void 0, function* () {
1270
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
1271
- });
1302
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported));
1272
1303
  }
1273
1304
  }
1274
1305
  /**
@@ -1323,6 +1354,8 @@ var IdentityType;
1323
1354
  // Copyright (c) Microsoft Corporation.
1324
1355
  /**
1325
1356
  * A class providing credential and configuration.
1357
+ * @deprecated Please use {@link TeamsUserCredential}
1358
+ * in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.
1326
1359
  */
1327
1360
  class TeamsFx {
1328
1361
  constructor(identityType, customConfig) {
@@ -1515,9 +1548,7 @@ class ConversationBot$1 {
1515
1548
  * Only work on server side.
1516
1549
  */
1517
1550
  requestHandler(req, res, logic) {
1518
- return __awaiter(this, void 0, void 0, function* () {
1519
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1520
- });
1551
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1521
1552
  }
1522
1553
  }
1523
1554
 
@@ -1643,9 +1674,7 @@ class Channel$1 {
1643
1674
  * @returns the response of sending adaptive card message.
1644
1675
  */
1645
1676
  sendAdaptiveCard(card, onError) {
1646
- return __awaiter(this, void 0, void 0, function* () {
1647
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1648
- });
1677
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1649
1678
  }
1650
1679
  }
1651
1680
  /**
@@ -1702,9 +1731,7 @@ class Member$1 {
1702
1731
  * @returns the response of sending adaptive card message.
1703
1732
  */
1704
1733
  sendAdaptiveCard(card, onError) {
1705
- return __awaiter(this, void 0, void 0, function* () {
1706
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1707
- });
1734
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1708
1735
  }
1709
1736
  }
1710
1737
  /**
@@ -1771,9 +1798,7 @@ class TeamsBotInstallation$1 {
1771
1798
  * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1772
1799
  */
1773
1800
  channels() {
1774
- return __awaiter(this, void 0, void 0, function* () {
1775
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1776
- });
1801
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1777
1802
  }
1778
1803
  /**
1779
1804
  * Get members from this bot installation.
@@ -1784,9 +1809,7 @@ class TeamsBotInstallation$1 {
1784
1809
  * @returns an array of members from where the bot is installed.
1785
1810
  */
1786
1811
  members() {
1787
- return __awaiter(this, void 0, void 0, function* () {
1788
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1789
- });
1812
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1790
1813
  }
1791
1814
  /**
1792
1815
  * Get team details from this bot installation
@@ -1794,9 +1817,7 @@ class TeamsBotInstallation$1 {
1794
1817
  * @returns the team details if bot is installed into a team, otherwise returns undefined.
1795
1818
  */
1796
1819
  getTeamDetails() {
1797
- return __awaiter(this, void 0, void 0, function* () {
1798
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1799
- });
1820
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1800
1821
  }
1801
1822
  }
1802
1823
  /**
@@ -1853,9 +1874,7 @@ class NotificationBot$1 {
1853
1874
  * @returns - an array of {@link TeamsBotInstallation}.
1854
1875
  */
1855
1876
  static installations() {
1856
- return __awaiter(this, void 0, void 0, function* () {
1857
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1858
- });
1877
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1859
1878
  }
1860
1879
  /**
1861
1880
  * Returns the first {@link Member} where predicate is true, and undefined otherwise.
@@ -1871,9 +1890,7 @@ class NotificationBot$1 {
1871
1890
  * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1872
1891
  */
1873
1892
  findMember(predicate, scope) {
1874
- return __awaiter(this, void 0, void 0, function* () {
1875
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1876
- });
1893
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1877
1894
  }
1878
1895
  /**
1879
1896
  * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
@@ -1888,9 +1905,7 @@ class NotificationBot$1 {
1888
1905
  * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1889
1906
  */
1890
1907
  findChannel(predicate) {
1891
- return __awaiter(this, void 0, void 0, function* () {
1892
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1893
- });
1908
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1894
1909
  }
1895
1910
  /**
1896
1911
  * Returns all {@link Member} where predicate is true, and empty array otherwise.
@@ -1904,9 +1919,7 @@ class NotificationBot$1 {
1904
1919
  * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1905
1920
  */
1906
1921
  findAllMembers(predicate, scope) {
1907
- return __awaiter(this, void 0, void 0, function* () {
1908
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1909
- });
1922
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1910
1923
  }
1911
1924
  /**
1912
1925
  * Returns all {@link Channel} where predicate is true, and empty array otherwise.
@@ -1919,9 +1932,7 @@ class NotificationBot$1 {
1919
1932
  * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1920
1933
  */
1921
1934
  findAllChannels(predicate) {
1922
- return __awaiter(this, void 0, void 0, function* () {
1923
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1924
- });
1935
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1925
1936
  }
1926
1937
  }
1927
1938
  /**
@@ -2050,15 +2061,15 @@ class CardActionBot$1 {
2050
2061
  }
2051
2062
  }
2052
2063
 
2064
+ // eslint-disable-next-line no-secrets/no-secrets
2053
2065
  /**
2054
2066
  * Users execute query with SSO or Access Token.
2067
+ * @deprecated
2055
2068
  * @remarks
2056
2069
  * Only works in in server side.
2057
2070
  */
2058
2071
  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
- });
2072
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2062
2073
  }
2063
2074
  /**
2064
2075
  * Users execute query with SSO or Access Token.
@@ -2066,9 +2077,7 @@ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2066
2077
  * Only works in in server side.
2067
2078
  */
2068
2079
  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
- });
2080
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2072
2081
  }
2073
2082
 
2074
2083
  // Copyright (c) Microsoft Corporation.
@@ -2103,9 +2112,7 @@ class ConversationBot {
2103
2112
  * Only work on server side.
2104
2113
  */
2105
2114
  requestHandler(req, res, logic) {
2106
- return __awaiter(this, void 0, void 0, function* () {
2107
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
2108
- });
2115
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported));
2109
2116
  }
2110
2117
  }
2111
2118
 
@@ -2123,7 +2130,7 @@ class ConversationBot {
2123
2130
  * @returns A `Promise` representing the asynchronous operation.
2124
2131
  */
2125
2132
  function sendMessage(target, text, onError) {
2126
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
2133
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported));
2127
2134
  }
2128
2135
  /**
2129
2136
  * Send an adaptive card message to a notification target.
@@ -2138,7 +2145,7 @@ function sendMessage(target, text, onError) {
2138
2145
  * @returns A `Promise` representing the asynchronous operation.
2139
2146
  */
2140
2147
  function sendAdaptiveCard(target, card, onError) {
2141
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
2148
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported));
2142
2149
  }
2143
2150
  /**
2144
2151
  * A {@link NotificationTarget} that represents a team channel.
@@ -2182,7 +2189,7 @@ class Channel {
2182
2189
  * @returns The response of sending message.
2183
2190
  */
2184
2191
  sendMessage(text, onError) {
2185
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
2192
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported));
2186
2193
  }
2187
2194
  /**
2188
2195
  * Send an adaptive card message.
@@ -2196,9 +2203,7 @@ class Channel {
2196
2203
  * @returns The response of sending adaptive card message.
2197
2204
  */
2198
2205
  sendAdaptiveCard(card, onError) {
2199
- return __awaiter(this, void 0, void 0, function* () {
2200
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
2201
- });
2206
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported));
2202
2207
  }
2203
2208
  }
2204
2209
  /**
@@ -2243,7 +2248,7 @@ class Member {
2243
2248
  * @returns The response of sending message.
2244
2249
  */
2245
2250
  sendMessage(text, onError) {
2246
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
2251
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported));
2247
2252
  }
2248
2253
  /**
2249
2254
  * Send an adaptive card message.
@@ -2257,9 +2262,7 @@ class Member {
2257
2262
  * @returns The response of sending adaptive card message.
2258
2263
  */
2259
2264
  sendAdaptiveCard(card, onError) {
2260
- return __awaiter(this, void 0, void 0, function* () {
2261
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
2262
- });
2265
+ return Promise.reject(Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported)));
2263
2266
  }
2264
2267
  }
2265
2268
  /**
@@ -2300,7 +2303,7 @@ class TeamsBotInstallation {
2300
2303
  * @returns The response of sending message.
2301
2304
  */
2302
2305
  sendMessage(text, onError) {
2303
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2306
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2304
2307
  }
2305
2308
  /**
2306
2309
  * Send an adaptive card message.
@@ -2314,7 +2317,7 @@ class TeamsBotInstallation {
2314
2317
  * @returns The response of sending adaptive card message.
2315
2318
  */
2316
2319
  sendAdaptiveCard(card, onError) {
2317
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2320
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2318
2321
  }
2319
2322
  /**
2320
2323
  * Get channels from this bot installation.
@@ -2325,9 +2328,7 @@ class TeamsBotInstallation {
2325
2328
  * @returns An array of channels if bot is installed into a team, otherwise returns an empty array.
2326
2329
  */
2327
2330
  channels() {
2328
- return __awaiter(this, void 0, void 0, function* () {
2329
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2330
- });
2331
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2331
2332
  }
2332
2333
  /**
2333
2334
  * Get members from this bot installation.
@@ -2338,9 +2339,7 @@ class TeamsBotInstallation {
2338
2339
  * @returns An array of members from where the bot is installed.
2339
2340
  */
2340
2341
  members() {
2341
- return __awaiter(this, void 0, void 0, function* () {
2342
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2343
- });
2342
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2344
2343
  }
2345
2344
  /**
2346
2345
  * Get team details from this bot installation
@@ -2348,9 +2347,7 @@ class TeamsBotInstallation {
2348
2347
  * @returns The team details if bot is installed into a team, otherwise returns undefined.
2349
2348
  */
2350
2349
  getTeamDetails() {
2351
- return __awaiter(this, void 0, void 0, function* () {
2352
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
2353
- });
2350
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported));
2354
2351
  }
2355
2352
  }
2356
2353
  /**
@@ -2404,9 +2401,7 @@ class NotificationBot {
2404
2401
  * @returns An array of {@link TeamsBotInstallation}.
2405
2402
  */
2406
2403
  static installations() {
2407
- return __awaiter(this, void 0, void 0, function* () {
2408
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2409
- });
2404
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2410
2405
  }
2411
2406
  /**
2412
2407
  * Return the first {@link Member} where predicate is true, and undefined otherwise.
@@ -2422,9 +2417,7 @@ class NotificationBot {
2422
2417
  * @returns The first {@link Member} where predicate is true, and undefined otherwise.
2423
2418
  */
2424
2419
  findMember(predicate, scope) {
2425
- return __awaiter(this, void 0, void 0, function* () {
2426
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2427
- });
2420
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2428
2421
  }
2429
2422
  /**
2430
2423
  * Return the first {@link Channel} where predicate is true, and undefined otherwise.
@@ -2440,9 +2433,7 @@ class NotificationBot {
2440
2433
  * @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.
2441
2434
  */
2442
2435
  findChannel(predicate) {
2443
- return __awaiter(this, void 0, void 0, function* () {
2444
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2445
- });
2436
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2446
2437
  }
2447
2438
  /**
2448
2439
  * Return all {@link Member} where predicate is true, and empty array otherwise.
@@ -2457,9 +2448,7 @@ class NotificationBot {
2457
2448
  * @returns An array of {@link Member} where predicate is true, and empty array otherwise.
2458
2449
  */
2459
2450
  findAllMembers(predicate, scope) {
2460
- return __awaiter(this, void 0, void 0, function* () {
2461
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2462
- });
2451
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2463
2452
  }
2464
2453
  /**
2465
2454
  * Return all {@link Channel} where predicate is true, and empty array otherwise.
@@ -2473,9 +2462,7 @@ class NotificationBot {
2473
2462
  * @returns An array of {@link Channel} where predicate is true, and empty array otherwise.
2474
2463
  */
2475
2464
  findAllChannels(predicate) {
2476
- return __awaiter(this, void 0, void 0, function* () {
2477
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
2478
- });
2465
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported));
2479
2466
  }
2480
2467
  }
2481
2468
  /**
@@ -2585,7 +2572,7 @@ class CardActionBot {
2585
2572
  * Only work on server side.
2586
2573
  */
2587
2574
  registerHandler(actionHandler) {
2588
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2575
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported));
2589
2576
  }
2590
2577
  /**
2591
2578
  * Register card action handlers to the bot.
@@ -2596,7 +2583,7 @@ class CardActionBot {
2596
2583
  * Only work on server side.
2597
2584
  */
2598
2585
  registerHandlers(actionHandlers) {
2599
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2586
+ return Promise.reject(new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported));
2600
2587
  }
2601
2588
  }
2602
2589