@microsoft/teamsfx 1.1.2-alpha.7eddd6cf4.0 → 1.1.2-alpha.8d60b4f8e.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.
@@ -31,6 +31,30 @@ var ErrorCode;
31
31
  * Channel is not supported error.
32
32
  */
33
33
  ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
34
+ /**
35
+ * Failed to retrieve sso token
36
+ */
37
+ ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
38
+ /**
39
+ * Failed to process sso handler
40
+ */
41
+ ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
42
+ /**
43
+ * Cannot find command
44
+ */
45
+ ErrorCode["CannotFindCommand"] = "CannotFindCommand";
46
+ /**
47
+ * Failed to run sso step
48
+ */
49
+ ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
50
+ /**
51
+ * Failed to run dedup step
52
+ */
53
+ ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
54
+ /**
55
+ * Sso activity handler is undefined
56
+ */
57
+ ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
34
58
  /**
35
59
  * Runtime is not supported error.
36
60
  */
@@ -86,6 +110,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
86
110
  ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
87
111
  // ChannelNotSupported Error
88
112
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
113
+ ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
114
+ // FailedToRetrieveSsoToken Error
115
+ ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
116
+ // CannotFindCommand Error
117
+ ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
118
+ ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
119
+ ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
120
+ // SsoActivityHandlerIsUndefined Error
121
+ ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
89
122
  // IdentityTypeNotSupported Error
90
123
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
91
124
  // AuthorizationInfoError
@@ -96,6 +129,7 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
96
129
  ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
97
130
  ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
98
131
  ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
132
+ ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
99
133
  /**
100
134
  * Error class with code and message thrown by the SDK.
101
135
  */
@@ -1438,6 +1472,105 @@ class ConversationBot {
1438
1472
  }
1439
1473
  }
1440
1474
 
1475
+ // Copyright (c) Microsoft Corporation.
1476
+ /*
1477
+ * Sso execution dialog, use to handle sso command
1478
+ */
1479
+ class BotSsoExecutionDialog {
1480
+ /**
1481
+ * Creates a new instance of the BotSsoExecutionDialog.
1482
+ * @param dedupStorage Helper storage to remove duplicated messages
1483
+ * @param requiredScopes The list of scopes for which the token will have access
1484
+ * @param teamsfx {@link TeamsFx} instance for authentication
1485
+ */
1486
+ constructor(dedupStorage, requiredScopes, teamsfx) {
1487
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1488
+ }
1489
+ /**
1490
+ * Add TeamsFxBotSsoCommandHandler instance
1491
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1492
+ * @param triggerPatterns The trigger pattern
1493
+ */
1494
+ addCommand(handler, triggerPatterns) {
1495
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1496
+ }
1497
+ /**
1498
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
1499
+ *
1500
+ * @param context The context object for the current turn.
1501
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
1502
+ */
1503
+ async run(context, accessor) {
1504
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1505
+ }
1506
+ /**
1507
+ * Called when the component is ending.
1508
+ *
1509
+ * @param context Context for the current turn of conversation.
1510
+ */
1511
+ async onEndDialog(context) {
1512
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1513
+ }
1514
+ }
1515
+
1516
+ // Copyright (c) Microsoft Corporation.
1517
+ /**
1518
+ * Default sso execution activity handler
1519
+ */
1520
+ class DefaultBotSsoExecutionActivityHandler {
1521
+ /**
1522
+ * Creates a new instance of the DefaultBotSsoExecutionActivityHandler.
1523
+ * @param ssoConfig configuration for sso command bot
1524
+ */
1525
+ constructor(ssoConfig) {
1526
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1527
+ }
1528
+ /**
1529
+ * Add TeamsFxBotSsoCommandHandler instance to sso execution dialog
1530
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1531
+ * @param triggerPatterns The trigger pattern
1532
+ */
1533
+ addCommand(handler, triggerPatterns) {
1534
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1535
+ }
1536
+ /**
1537
+ * Called to initiate the event emission process.
1538
+ * @param context The context object for the current turn.
1539
+ */
1540
+ async run(context) {
1541
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1542
+ }
1543
+ /**
1544
+ * Receives invoke activities with Activity name of 'signin/verifyState'.
1545
+ * @param context A context object for this turn.
1546
+ * @param query Signin state (part of signin action auth flow) verification invoke query.
1547
+ * @returns A promise that represents the work queued.
1548
+ */
1549
+ async handleTeamsSigninVerifyState(context, query) {
1550
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1551
+ }
1552
+ /**
1553
+ * Receives invoke activities with Activity name of 'signin/tokenExchange'
1554
+ * @param context A context object for this turn.
1555
+ * @param query Signin state (part of signin action auth flow) verification invoke query
1556
+ * @returns A promise that represents the work queued.
1557
+ */
1558
+ async handleTeamsSigninTokenExchange(context, query) {
1559
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1560
+ }
1561
+ /**
1562
+ * Handle signin invoke activity type.
1563
+ *
1564
+ * @param context The context object for the current turn.
1565
+ *
1566
+ * @remarks
1567
+ * Override this method to support channel-specific behavior across multiple channels.
1568
+ */
1569
+ async onSignInInvoke(context) {
1570
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1571
+ }
1572
+ }
1573
+
1441
1574
  // Copyright (c) Microsoft Corporation.
1442
1575
  /**
1443
1576
  * Send a plain text message to a notification target.
@@ -1647,6 +1780,14 @@ class TeamsBotInstallation {
1647
1780
  async members() {
1648
1781
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1649
1782
  }
1783
+ /**
1784
+ * Get team details from this bot installation
1785
+ *
1786
+ * @returns the team details if bot is installed into a team, otherwise returns undefined.
1787
+ */
1788
+ async getTeamDetails() {
1789
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1790
+ }
1650
1791
  }
1651
1792
  /**
1652
1793
  * Provide static utilities for bot notification.
@@ -1701,7 +1842,87 @@ class NotificationBot {
1701
1842
  static async installations() {
1702
1843
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1703
1844
  }
1704
- }
1845
+ /**
1846
+ * Returns the first {@link Member} where predicate is true, and undefined otherwise.
1847
+ *
1848
+ * @remarks
1849
+ * Only work on server side.
1850
+ *
1851
+ * @param predicate find calls predicate once for each member of the installation,
1852
+ * until it finds one where predicate returns true. If such a member is found, find
1853
+ * immediately returns that member. Otherwise, find returns undefined.
1854
+ * @param scope the scope to find members from the installations
1855
+ * (personal chat, group chat, Teams channel).
1856
+ * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1857
+ */
1858
+ async findMember(predicate, scope) {
1859
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1860
+ }
1861
+ /**
1862
+ * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
1863
+ *
1864
+ * @remarks
1865
+ * Only work on server side.
1866
+ *
1867
+ * @param predicate find calls predicate once for each channel of the installation,
1868
+ * until it finds one where predicate returns true. If such a channel is found, find
1869
+ * immediately returns that channel. Otherwise, find returns undefined.
1870
+ * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1871
+ */
1872
+ async findChannel(predicate) {
1873
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1874
+ }
1875
+ /**
1876
+ * Returns all {@link Member} where predicate is true, and empty array otherwise.
1877
+ *
1878
+ * @remarks
1879
+ * Only work on server side.
1880
+ *
1881
+ * @param predicate find calls predicate for each member of the installation.
1882
+ * @param scope the scope to find members from the installations
1883
+ * (personal chat, group chat, Teams channel).
1884
+ * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1885
+ */
1886
+ async findAllMembers(predicate, scope) {
1887
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1888
+ }
1889
+ /**
1890
+ * Returns all {@link Channel} where predicate is true, and empty array otherwise.
1891
+ *
1892
+ * @remarks
1893
+ * Only work on server side.
1894
+ *
1895
+ * @param predicate find calls predicate for each channel of the installation.
1896
+ * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1897
+ */
1898
+ async findAllChannels(predicate) {
1899
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1900
+ }
1901
+ }
1902
+ /**
1903
+ * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
1904
+ * The search scope is a flagged enum and it can be combined with `|`.
1905
+ * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
1906
+ */
1907
+ var SearchScope;
1908
+ (function (SearchScope) {
1909
+ /**
1910
+ * Search members from the installations in personal chat only.
1911
+ */
1912
+ SearchScope[SearchScope["Person"] = 1] = "Person";
1913
+ /**
1914
+ * Search members from the installations in group chat only.
1915
+ */
1916
+ SearchScope[SearchScope["Group"] = 2] = "Group";
1917
+ /**
1918
+ * Search members from the installations in Teams channel only.
1919
+ */
1920
+ SearchScope[SearchScope["Channel"] = 4] = "Channel";
1921
+ /**
1922
+ * Search members from all installations including personal chat, group chat and Teams channel.
1923
+ */
1924
+ SearchScope[SearchScope["All"] = 7] = "All";
1925
+ })(SearchScope || (SearchScope = {}));
1705
1926
 
1706
1927
  // Copyright (c) Microsoft Corporation.
1707
1928
  /**
@@ -1742,6 +1963,22 @@ class CommandBot {
1742
1963
  registerCommands(commands) {
1743
1964
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1744
1965
  }
1966
+ /**
1967
+ * Registers a sso command into the command bot.
1968
+ *
1969
+ * @param command The command to register.
1970
+ */
1971
+ registerSsoCommand(ssoCommand) {
1972
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1973
+ }
1974
+ /**
1975
+ * Registers commands into the command bot.
1976
+ *
1977
+ * @param commands The commands to register.
1978
+ */
1979
+ registerSsoCommands(ssoCommands) {
1980
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1981
+ }
1745
1982
  }
1746
1983
 
1747
1984
  /**
@@ -1782,5 +2019,14 @@ class CardActionBot {
1782
2019
  }
1783
2020
  }
1784
2021
 
1785
- export { AdaptiveCardResponse, ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CardActionBot, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, InvokeResponseErrorCode, LogLevel, Member, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
2022
+ /**
2023
+ * Users execute query with SSO or Access Token.
2024
+ * @remarks
2025
+ * Only works in in server side.
2026
+ */
2027
+ async function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2028
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2029
+ }
2030
+
2031
+ export { AdaptiveCardResponse, ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, BotSsoExecutionDialog, CardActionBot, CertificateAuthProvider, Channel, CommandBot, ConversationBot, DefaultBotSsoExecutionActivityHandler, ErrorCode, ErrorWithCode, IdentityType, InvokeResponseErrorCode, LogLevel, Member, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, handleMessageExtensionQueryWithToken, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1786
2032
  //# sourceMappingURL=index.esm2017.js.map