@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.
@@ -32,6 +32,30 @@ var ErrorCode;
32
32
  * Channel is not supported error.
33
33
  */
34
34
  ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
35
+ /**
36
+ * Failed to retrieve sso token
37
+ */
38
+ ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
39
+ /**
40
+ * Failed to process sso handler
41
+ */
42
+ ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
43
+ /**
44
+ * Cannot find command
45
+ */
46
+ ErrorCode["CannotFindCommand"] = "CannotFindCommand";
47
+ /**
48
+ * Failed to run sso step
49
+ */
50
+ ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
51
+ /**
52
+ * Failed to run dedup step
53
+ */
54
+ ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
55
+ /**
56
+ * Sso activity handler is undefined
57
+ */
58
+ ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
35
59
  /**
36
60
  * Runtime is not supported error.
37
61
  */
@@ -87,6 +111,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
87
111
  ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
88
112
  // ChannelNotSupported Error
89
113
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
114
+ ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
115
+ // FailedToRetrieveSsoToken Error
116
+ ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
117
+ // CannotFindCommand Error
118
+ ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
119
+ ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
120
+ ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
121
+ // SsoActivityHandlerIsUndefined Error
122
+ ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
90
123
  // IdentityTypeNotSupported Error
91
124
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
92
125
  // AuthorizationInfoError
@@ -97,6 +130,7 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
97
130
  ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
98
131
  ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
99
132
  ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
133
+ ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
100
134
  /**
101
135
  * Error class with code and message thrown by the SDK.
102
136
  */
@@ -1475,6 +1509,117 @@ class ConversationBot {
1475
1509
  }
1476
1510
  }
1477
1511
 
1512
+ // Copyright (c) Microsoft Corporation.
1513
+ /*
1514
+ * Sso execution dialog, use to handle sso command
1515
+ */
1516
+ class BotSsoExecutionDialog {
1517
+ /**
1518
+ * Creates a new instance of the BotSsoExecutionDialog.
1519
+ * @param dedupStorage Helper storage to remove duplicated messages
1520
+ * @param requiredScopes The list of scopes for which the token will have access
1521
+ * @param teamsfx {@link TeamsFx} instance for authentication
1522
+ */
1523
+ constructor(dedupStorage, requiredScopes, teamsfx) {
1524
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1525
+ }
1526
+ /**
1527
+ * Add TeamsFxBotSsoCommandHandler instance
1528
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1529
+ * @param triggerPatterns The trigger pattern
1530
+ */
1531
+ addCommand(handler, triggerPatterns) {
1532
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1533
+ }
1534
+ /**
1535
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
1536
+ *
1537
+ * @param context The context object for the current turn.
1538
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
1539
+ */
1540
+ run(context, accessor) {
1541
+ return __awaiter(this, void 0, void 0, function* () {
1542
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1543
+ });
1544
+ }
1545
+ /**
1546
+ * Called when the component is ending.
1547
+ *
1548
+ * @param context Context for the current turn of conversation.
1549
+ */
1550
+ onEndDialog(context) {
1551
+ return __awaiter(this, void 0, void 0, function* () {
1552
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1553
+ });
1554
+ }
1555
+ }
1556
+
1557
+ // Copyright (c) Microsoft Corporation.
1558
+ /**
1559
+ * Default sso execution activity handler
1560
+ */
1561
+ class DefaultBotSsoExecutionActivityHandler {
1562
+ /**
1563
+ * Creates a new instance of the DefaultBotSsoExecutionActivityHandler.
1564
+ * @param ssoConfig configuration for sso command bot
1565
+ */
1566
+ constructor(ssoConfig) {
1567
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1568
+ }
1569
+ /**
1570
+ * Add TeamsFxBotSsoCommandHandler instance to sso execution dialog
1571
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1572
+ * @param triggerPatterns The trigger pattern
1573
+ */
1574
+ addCommand(handler, triggerPatterns) {
1575
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1576
+ }
1577
+ /**
1578
+ * Called to initiate the event emission process.
1579
+ * @param context The context object for the current turn.
1580
+ */
1581
+ run(context) {
1582
+ return __awaiter(this, void 0, void 0, function* () {
1583
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1584
+ });
1585
+ }
1586
+ /**
1587
+ * Receives invoke activities with Activity name of 'signin/verifyState'.
1588
+ * @param context A context object for this turn.
1589
+ * @param query Signin state (part of signin action auth flow) verification invoke query.
1590
+ * @returns A promise that represents the work queued.
1591
+ */
1592
+ handleTeamsSigninVerifyState(context, query) {
1593
+ return __awaiter(this, void 0, void 0, function* () {
1594
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1595
+ });
1596
+ }
1597
+ /**
1598
+ * Receives invoke activities with Activity name of 'signin/tokenExchange'
1599
+ * @param context A context object for this turn.
1600
+ * @param query Signin state (part of signin action auth flow) verification invoke query
1601
+ * @returns A promise that represents the work queued.
1602
+ */
1603
+ handleTeamsSigninTokenExchange(context, query) {
1604
+ return __awaiter(this, void 0, void 0, function* () {
1605
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1606
+ });
1607
+ }
1608
+ /**
1609
+ * Handle signin invoke activity type.
1610
+ *
1611
+ * @param context The context object for the current turn.
1612
+ *
1613
+ * @remarks
1614
+ * Override this method to support channel-specific behavior across multiple channels.
1615
+ */
1616
+ onSignInInvoke(context) {
1617
+ return __awaiter(this, void 0, void 0, function* () {
1618
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultBotSsoExecutionActivityHandler"), ErrorCode.RuntimeNotSupported);
1619
+ });
1620
+ }
1621
+ }
1622
+
1478
1623
  // Copyright (c) Microsoft Corporation.
1479
1624
  /**
1480
1625
  * Send a plain text message to a notification target.
@@ -1692,6 +1837,16 @@ class TeamsBotInstallation {
1692
1837
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1693
1838
  });
1694
1839
  }
1840
+ /**
1841
+ * Get team details from this bot installation
1842
+ *
1843
+ * @returns the team details if bot is installed into a team, otherwise returns undefined.
1844
+ */
1845
+ getTeamDetails() {
1846
+ return __awaiter(this, void 0, void 0, function* () {
1847
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1848
+ });
1849
+ }
1695
1850
  }
1696
1851
  /**
1697
1852
  * Provide static utilities for bot notification.
@@ -1748,7 +1903,95 @@ class NotificationBot {
1748
1903
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1749
1904
  });
1750
1905
  }
1751
- }
1906
+ /**
1907
+ * Returns the first {@link Member} where predicate is true, and undefined otherwise.
1908
+ *
1909
+ * @remarks
1910
+ * Only work on server side.
1911
+ *
1912
+ * @param predicate find calls predicate once for each member of the installation,
1913
+ * until it finds one where predicate returns true. If such a member is found, find
1914
+ * immediately returns that member. Otherwise, find returns undefined.
1915
+ * @param scope the scope to find members from the installations
1916
+ * (personal chat, group chat, Teams channel).
1917
+ * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1918
+ */
1919
+ findMember(predicate, scope) {
1920
+ return __awaiter(this, void 0, void 0, function* () {
1921
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1922
+ });
1923
+ }
1924
+ /**
1925
+ * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
1926
+ *
1927
+ * @remarks
1928
+ * Only work on server side.
1929
+ *
1930
+ * @param predicate find calls predicate once for each channel of the installation,
1931
+ * until it finds one where predicate returns true. If such a channel is found, find
1932
+ * immediately returns that channel. Otherwise, find returns undefined.
1933
+ * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1934
+ */
1935
+ findChannel(predicate) {
1936
+ return __awaiter(this, void 0, void 0, function* () {
1937
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1938
+ });
1939
+ }
1940
+ /**
1941
+ * Returns all {@link Member} where predicate is true, and empty array otherwise.
1942
+ *
1943
+ * @remarks
1944
+ * Only work on server side.
1945
+ *
1946
+ * @param predicate find calls predicate for each member of the installation.
1947
+ * @param scope the scope to find members from the installations
1948
+ * (personal chat, group chat, Teams channel).
1949
+ * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1950
+ */
1951
+ findAllMembers(predicate, scope) {
1952
+ return __awaiter(this, void 0, void 0, function* () {
1953
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1954
+ });
1955
+ }
1956
+ /**
1957
+ * Returns all {@link Channel} where predicate is true, and empty array otherwise.
1958
+ *
1959
+ * @remarks
1960
+ * Only work on server side.
1961
+ *
1962
+ * @param predicate find calls predicate for each channel of the installation.
1963
+ * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1964
+ */
1965
+ findAllChannels(predicate) {
1966
+ return __awaiter(this, void 0, void 0, function* () {
1967
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1968
+ });
1969
+ }
1970
+ }
1971
+ /**
1972
+ * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
1973
+ * The search scope is a flagged enum and it can be combined with `|`.
1974
+ * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
1975
+ */
1976
+ var SearchScope;
1977
+ (function (SearchScope) {
1978
+ /**
1979
+ * Search members from the installations in personal chat only.
1980
+ */
1981
+ SearchScope[SearchScope["Person"] = 1] = "Person";
1982
+ /**
1983
+ * Search members from the installations in group chat only.
1984
+ */
1985
+ SearchScope[SearchScope["Group"] = 2] = "Group";
1986
+ /**
1987
+ * Search members from the installations in Teams channel only.
1988
+ */
1989
+ SearchScope[SearchScope["Channel"] = 4] = "Channel";
1990
+ /**
1991
+ * Search members from all installations including personal chat, group chat and Teams channel.
1992
+ */
1993
+ SearchScope[SearchScope["All"] = 7] = "All";
1994
+ })(SearchScope || (SearchScope = {}));
1752
1995
 
1753
1996
  // Copyright (c) Microsoft Corporation.
1754
1997
  /**
@@ -1789,6 +2032,22 @@ class CommandBot {
1789
2032
  registerCommands(commands) {
1790
2033
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1791
2034
  }
2035
+ /**
2036
+ * Registers a sso command into the command bot.
2037
+ *
2038
+ * @param command The command to register.
2039
+ */
2040
+ registerSsoCommand(ssoCommand) {
2041
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
2042
+ }
2043
+ /**
2044
+ * Registers commands into the command bot.
2045
+ *
2046
+ * @param commands The commands to register.
2047
+ */
2048
+ registerSsoCommands(ssoCommands) {
2049
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
2050
+ }
1792
2051
  }
1793
2052
 
1794
2053
  /**
@@ -1829,5 +2088,16 @@ class CardActionBot {
1829
2088
  }
1830
2089
  }
1831
2090
 
1832
- 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 };
2091
+ /**
2092
+ * Users execute query with SSO or Access Token.
2093
+ * @remarks
2094
+ * Only works in in server side.
2095
+ */
2096
+ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2097
+ return __awaiter(this, void 0, void 0, function* () {
2098
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2099
+ });
2100
+ }
2101
+
2102
+ 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 };
1833
2103
  //# sourceMappingURL=index.esm5.js.map