@microsoft/teamsfx 0.6.3-alpha.8d048e1f1.0 → 0.6.3-alpha.b31d198d3.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.
@@ -12,6 +12,7 @@ var botbuilder = require('botbuilder');
12
12
  var botbuilderDialogs = require('botbuilder-dialogs');
13
13
  var uuid = require('uuid');
14
14
  var axios = require('axios');
15
+ var https = require('https');
15
16
  var path = require('path');
16
17
  var fs = require('fs');
17
18
 
@@ -100,6 +101,10 @@ exports.ErrorCode = void 0;
100
101
  * Identity type error.
101
102
  */
102
103
  ErrorCode["IdentityTypeNotSupported"] = "IdentityTypeNotSupported";
104
+ /**
105
+ * Authentication info already exists error.
106
+ */
107
+ ErrorCode["AuthorizationInfoAlreadyExists"] = "AuthorizationInfoAlreadyExists";
103
108
  })(exports.ErrorCode || (exports.ErrorCode = {}));
104
109
  /**
105
110
  * @internal
@@ -121,6 +126,14 @@ ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token
121
126
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
122
127
  // IdentityTypeNotSupported Error
123
128
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
129
+ // AuthorizationInfoError
130
+ ErrorMessage.AuthorizationHeaderAlreadyExists = "Authorization header already exists!";
131
+ ErrorMessage.BasicCredentialAlreadyExists = "Basic credential already exists!";
132
+ // InvalidParameter Error
133
+ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
134
+ ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
135
+ ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
136
+ ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
124
137
  /**
125
138
  * Error class with code and message thrown by the SDK.
126
139
  *
@@ -1476,7 +1489,7 @@ function createApiClient(apiEndpoint, authProvider) {
1476
1489
  */
1477
1490
  class BearerTokenAuthProvider {
1478
1491
  /**
1479
- * @param getToken Function that returns the content of bearer token used in http request
1492
+ * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
1480
1493
  *
1481
1494
  * @beta
1482
1495
  */
@@ -1486,9 +1499,13 @@ class BearerTokenAuthProvider {
1486
1499
  /**
1487
1500
  * Adds authentication info to http requests
1488
1501
  *
1489
- * @param config - Contains all the request information and can be updated to include extra authentication info.
1502
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1490
1503
  * Refer https://axios-http.com/docs/req_config for detailed document.
1491
1504
  *
1505
+ * @returns Updated axios request config.
1506
+ *
1507
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
1508
+ *
1492
1509
  * @beta
1493
1510
  */
1494
1511
  AddAuthenticationInfo(config) {
@@ -1498,7 +1515,7 @@ class BearerTokenAuthProvider {
1498
1515
  config.headers = {};
1499
1516
  }
1500
1517
  if (config.headers["Authorization"]) {
1501
- throw new Error("Authorization header already exists!");
1518
+ throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, exports.ErrorCode.AuthorizationInfoAlreadyExists);
1502
1519
  }
1503
1520
  config.headers["Authorization"] = `Bearer ${token}`;
1504
1521
  return config;
@@ -1507,6 +1524,266 @@ class BearerTokenAuthProvider {
1507
1524
  }
1508
1525
 
1509
1526
  // Copyright (c) Microsoft Corporation.
1527
+ /**
1528
+ * Provider that handles Basic authentication
1529
+ *
1530
+ * @beta
1531
+ */
1532
+ class BasicAuthProvider {
1533
+ /**
1534
+ *
1535
+ * @param { string } userName - Username used in basic auth
1536
+ * @param { string } password - Password used in basic auth
1537
+ *
1538
+ * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
1539
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1540
+ *
1541
+ * @beta
1542
+ */
1543
+ constructor(userName, password) {
1544
+ if (!userName) {
1545
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "username"), exports.ErrorCode.InvalidParameter);
1546
+ }
1547
+ if (!password) {
1548
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "password"), exports.ErrorCode.InvalidParameter);
1549
+ }
1550
+ this.userName = userName;
1551
+ this.password = password;
1552
+ }
1553
+ /**
1554
+ * Adds authentication info to http requests
1555
+ *
1556
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1557
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1558
+ *
1559
+ * @returns Updated axios request config.
1560
+ *
1561
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
1562
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1563
+ *
1564
+ * @beta
1565
+ */
1566
+ AddAuthenticationInfo(config) {
1567
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1568
+ if (config.headers && config.headers["Authorization"]) {
1569
+ throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, exports.ErrorCode.AuthorizationInfoAlreadyExists);
1570
+ }
1571
+ if (config.auth) {
1572
+ throw new ErrorWithCode(ErrorMessage.BasicCredentialAlreadyExists, exports.ErrorCode.AuthorizationInfoAlreadyExists);
1573
+ }
1574
+ config.auth = {
1575
+ username: this.userName,
1576
+ password: this.password,
1577
+ };
1578
+ return config;
1579
+ });
1580
+ }
1581
+ }
1582
+
1583
+ // Copyright (c) Microsoft Corporation.
1584
+ /**
1585
+ * Provider that handles API Key authentication
1586
+ *
1587
+ * @beta
1588
+ */
1589
+ class ApiKeyProvider {
1590
+ /**
1591
+ *
1592
+ * @param { string } keyName - The name of request header or query parameter that specifies API Key
1593
+ * @param { string } keyValue - The value of API Key
1594
+ * @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.
1595
+ *
1596
+ * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
1597
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1598
+ *
1599
+ * @beta
1600
+ */
1601
+ constructor(keyName, keyValue, keyLocation) {
1602
+ if (!keyName) {
1603
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "keyName"), exports.ErrorCode.InvalidParameter);
1604
+ }
1605
+ if (!keyValue) {
1606
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "keyVaule"), exports.ErrorCode.InvalidParameter);
1607
+ }
1608
+ this.keyName = keyName;
1609
+ this.keyValue = keyValue;
1610
+ this.keyLocation = keyLocation;
1611
+ }
1612
+ /**
1613
+ * Adds authentication info to http requests
1614
+ *
1615
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1616
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1617
+ *
1618
+ * @returns Updated axios request config.
1619
+ *
1620
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
1621
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1622
+ *
1623
+ * @beta
1624
+ */
1625
+ AddAuthenticationInfo(config) {
1626
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1627
+ switch (this.keyLocation) {
1628
+ case exports.ApiKeyLocation.Header:
1629
+ if (!config.headers) {
1630
+ config.headers = {};
1631
+ }
1632
+ if (config.headers[this.keyName]) {
1633
+ throw new ErrorWithCode(formatString(ErrorMessage.DuplicateApiKeyInHeader, this.keyName), exports.ErrorCode.AuthorizationInfoAlreadyExists);
1634
+ }
1635
+ config.headers[this.keyName] = this.keyValue;
1636
+ break;
1637
+ case exports.ApiKeyLocation.QueryParams:
1638
+ if (!config.params) {
1639
+ config.params = {};
1640
+ }
1641
+ const url = new URL(config.url, config.baseURL);
1642
+ if (config.params[this.keyName] || url.searchParams.has(this.keyName)) {
1643
+ throw new ErrorWithCode(formatString(ErrorMessage.DuplicateApiKeyInQueryParam, this.keyName), exports.ErrorCode.AuthorizationInfoAlreadyExists);
1644
+ }
1645
+ config.params[this.keyName] = this.keyValue;
1646
+ break;
1647
+ }
1648
+ return config;
1649
+ });
1650
+ }
1651
+ }
1652
+ /**
1653
+ * Define available location for API Key location
1654
+ *
1655
+ * @beta
1656
+ */
1657
+ exports.ApiKeyLocation = void 0;
1658
+ (function (ApiKeyLocation) {
1659
+ /**
1660
+ * The API Key is placed in request header
1661
+ */
1662
+ ApiKeyLocation[ApiKeyLocation["Header"] = 0] = "Header";
1663
+ /**
1664
+ * The API Key is placed in query parameter
1665
+ */
1666
+ ApiKeyLocation[ApiKeyLocation["QueryParams"] = 1] = "QueryParams";
1667
+ })(exports.ApiKeyLocation || (exports.ApiKeyLocation = {}));
1668
+
1669
+ // Copyright (c) Microsoft Corporation.
1670
+ /**
1671
+ * Provider that handles Certificate authentication
1672
+ *
1673
+ * @beta
1674
+ */
1675
+ class CertificateAuthProvider {
1676
+ /**
1677
+ *
1678
+ * @param { SecureContextOptions } certOption - information about the cert used in http requests
1679
+ *
1680
+ * @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
1681
+ *
1682
+ * @beta
1683
+ */
1684
+ constructor(certOption) {
1685
+ if (certOption && Object.keys(certOption).length !== 0) {
1686
+ this.certOption = certOption;
1687
+ }
1688
+ else {
1689
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "certOption"), exports.ErrorCode.InvalidParameter);
1690
+ }
1691
+ }
1692
+ /**
1693
+ * Adds authentication info to http requests.
1694
+ *
1695
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
1696
+ * Refer https://axios-http.com/docs/req_config for detailed document.
1697
+ *
1698
+ * @returns Updated axios request config.
1699
+ *
1700
+ * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
1701
+ *
1702
+ * @beta
1703
+ */
1704
+ AddAuthenticationInfo(config) {
1705
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1706
+ if (!config.httpsAgent) {
1707
+ config.httpsAgent = new https.Agent(this.certOption);
1708
+ }
1709
+ else {
1710
+ const existingProperties = new Set(Object.keys(config.httpsAgent.options));
1711
+ for (const property of Object.keys(this.certOption)) {
1712
+ if (existingProperties.has(property)) {
1713
+ throw new ErrorWithCode(formatString(ErrorMessage.DuplicateHttpsOptionProperty, property), exports.ErrorCode.InvalidParameter);
1714
+ }
1715
+ }
1716
+ Object.assign(config.httpsAgent.options, this.certOption);
1717
+ }
1718
+ return config;
1719
+ });
1720
+ }
1721
+ }
1722
+ /**
1723
+ * Helper to create SecureContextOptions from PEM format cert
1724
+ *
1725
+ * @param { string | Buffer } cert - The cert chain in PEM format
1726
+ * @param { string | Buffer } key - The private key for the cert chain
1727
+ * @param { string? } passphrase - The passphrase for private key
1728
+ * @param { string? | Buffer? } ca - Overrides the trusted CA certificates
1729
+ *
1730
+ * @returns Instance of SecureContextOptions
1731
+ *
1732
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
1733
+ *
1734
+ */
1735
+ function createPemCertOption(cert, key, passphrase, ca) {
1736
+ if (cert.length === 0) {
1737
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "cert"), exports.ErrorCode.InvalidParameter);
1738
+ }
1739
+ if (key.length === 0) {
1740
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "key"), exports.ErrorCode.InvalidParameter);
1741
+ }
1742
+ return {
1743
+ cert,
1744
+ key,
1745
+ passphrase,
1746
+ ca,
1747
+ };
1748
+ }
1749
+ /**
1750
+ * Helper to create SecureContextOptions from PFX format cert
1751
+ *
1752
+ * @param { string | Buffer } pfx - The content of .pfx file
1753
+ * @param { string? } passphrase - Optional. The passphrase of .pfx file
1754
+ *
1755
+ * @returns Instance of SecureContextOptions
1756
+ *
1757
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
1758
+ *
1759
+ */
1760
+ function createPfxCertOption(pfx, passphrase) {
1761
+ if (pfx.length === 0) {
1762
+ throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "pfx"), exports.ErrorCode.InvalidParameter);
1763
+ }
1764
+ return {
1765
+ pfx,
1766
+ passphrase,
1767
+ };
1768
+ }
1769
+
1770
+ // Copyright (c) Microsoft Corporation.
1771
+ // Following keys are used by SDK internally
1772
+ const ReservedKey = new Set([
1773
+ "authorityHost",
1774
+ "tenantId",
1775
+ "clientId",
1776
+ "clientSecret",
1777
+ "initiateLoginEndpoint",
1778
+ "applicationIdUri",
1779
+ "apiEndpoint",
1780
+ "apiName",
1781
+ "sqlServerEndpoint",
1782
+ "sqlUsername",
1783
+ "sqlPassword",
1784
+ "sqlDatabaseName",
1785
+ "sqlIdentityId",
1786
+ ]);
1510
1787
  /**
1511
1788
  * A class providing credential and configuration.
1512
1789
  * @beta
@@ -1684,10 +1961,10 @@ class TeamsFx {
1684
1961
  this.configuration.set("sqlDatabaseName", env.SQL_DATABASE_NAME);
1685
1962
  this.configuration.set("sqlIdentityId", env.IDENTITY_ID);
1686
1963
  Object.keys(env).forEach((key) => {
1687
- const value = env[key];
1688
- if (key.startsWith("TEAMSFX_") && value) {
1689
- this.configuration.set(key.substring(8), value);
1964
+ if (ReservedKey.has(key)) {
1965
+ internalLogger.warn(`The name of environment variable ${key} is preserved. Will not load it as configuration.`);
1690
1966
  }
1967
+ this.configuration.set(key, env[key]);
1691
1968
  });
1692
1969
  }
1693
1970
  }
@@ -1722,13 +1999,6 @@ class NotificationMiddleware {
1722
1999
  yield this.conversationReferenceStore.set(reference);
1723
2000
  break;
1724
2001
  }
1725
- case ActivityType.CurrentBotMessaged: {
1726
- const reference = botbuilder.TurnContext.getConversationReference(context.activity);
1727
- if (!(yield this.conversationReferenceStore.check(reference))) {
1728
- yield this.conversationReferenceStore.set(reference);
1729
- }
1730
- break;
1731
- }
1732
2002
  case ActivityType.CurrentBotUninstalled:
1733
2003
  case ActivityType.TeamDeleted: {
1734
2004
  const reference = botbuilder.TurnContext.getConversationReference(context.activity);
@@ -1751,9 +2021,6 @@ class NotificationMiddleware {
1751
2021
  return ActivityType.CurrentBotUninstalled;
1752
2022
  }
1753
2023
  }
1754
- else if (activityType === "message") {
1755
- return ActivityType.CurrentBotMessaged;
1756
- }
1757
2024
  else if (activityType === "conversationUpdate") {
1758
2025
  const eventType = (_b = activity.channelData) === null || _b === void 0 ? void 0 : _b.eventType;
1759
2026
  if (eventType === "teamDeleted") {
@@ -2347,7 +2614,7 @@ class TeamsBotInstallation {
2347
2614
  }
2348
2615
  }
2349
2616
  /**
2350
- * Provide utilities to send notification to varies targets (e.g., member, channel, incoming wehbook).
2617
+ * Provide utilities to send notification to varies targets (e.g., member, group, channel).
2351
2618
  *
2352
2619
  * @beta
2353
2620
  */
@@ -2418,7 +2685,7 @@ class NotificationBot {
2418
2685
  /**
2419
2686
  * Provide utilities for bot conversation, including:
2420
2687
  * - handle command and response.
2421
- * - send notification to varies targets (e.g., member, channel, incoming wehbook).
2688
+ * - send notification to varies targets (e.g., member, group, channel).
2422
2689
  *
2423
2690
  * @example
2424
2691
  * For command and response, you can register your commands through the constructor, or use the `registerCommand` and `registerCommands` API to add commands later.
@@ -2428,9 +2695,7 @@ class NotificationBot {
2428
2695
  * const conversationBot = new ConversationBot({
2429
2696
  * command: {
2430
2697
  * enabled: true,
2431
- * options: {
2432
- * commands: [ new HelloWorldCommandHandler() ],
2433
- * },
2698
+ * commands: [ new HelloWorldCommandHandler() ],
2434
2699
  * },
2435
2700
  * });
2436
2701
  *
@@ -2438,7 +2703,7 @@ class NotificationBot {
2438
2703
  * conversationBot.command.registerCommand(new HelpCommandHandler());
2439
2704
  * ```
2440
2705
  *
2441
- * For notification, you can enable notification at initialization, then send notificaations at any time.
2706
+ * For notification, you can enable notification at initialization, then send notifications at any time.
2442
2707
  *
2443
2708
  * ```typescript
2444
2709
  * // enable through constructor
@@ -2466,7 +2731,7 @@ class NotificationBot {
2466
2731
  *
2467
2732
  * For command and response, ensure each command should ONLY be registered with the command once, otherwise it'll cause unexpected behavior if you register the same command more than once.
2468
2733
  *
2469
- * For notification, set `notification.options.storage` in {@link ConversationOptions} to use your own storage implementation.
2734
+ * For notification, set `notification.storage` in {@link ConversationOptions} to use your own storage implementation.
2470
2735
  *
2471
2736
  * @beta
2472
2737
  */
@@ -2474,27 +2739,79 @@ class ConversationBot {
2474
2739
  /**
2475
2740
  * Creates new instance of the `ConversationBot`.
2476
2741
  *
2742
+ * @remarks
2743
+ * It's recommended to create your own adapter and storage for production environment instead of the default one.
2744
+ *
2477
2745
  * @param options - initialize options
2478
2746
  *
2479
2747
  * @beta
2480
2748
  */
2481
2749
  constructor(options) {
2750
+ var _a, _b;
2482
2751
  if (options.adapter) {
2483
2752
  this.adapter = options.adapter;
2484
2753
  }
2485
2754
  else {
2486
- this.adapter = new botbuilder.BotFrameworkAdapter({
2487
- appId: process.env.BOT_ID,
2488
- appPassword: process.env.BOT_PASSWORD,
2489
- });
2755
+ this.adapter = this.createDefaultAdapter(options.adapterConfig);
2490
2756
  }
2491
- if (options.command.enabled) {
2492
- this.command = new CommandBot(this.adapter, options.command.options);
2757
+ if ((_a = options.command) === null || _a === void 0 ? void 0 : _a.enabled) {
2758
+ this.command = new CommandBot(this.adapter, options.command);
2493
2759
  }
2494
- if (options.notification.enabled) {
2495
- this.notification = new NotificationBot(this.adapter, options.notification.options);
2760
+ if ((_b = options.notification) === null || _b === void 0 ? void 0 : _b.enabled) {
2761
+ this.notification = new NotificationBot(this.adapter, options.notification);
2496
2762
  }
2497
2763
  }
2764
+ createDefaultAdapter(adapterConfig) {
2765
+ const adapter = adapterConfig === undefined
2766
+ ? new botbuilder.BotFrameworkAdapter({
2767
+ appId: process.env.BOT_ID,
2768
+ appPassword: process.env.BOT_PASSWORD,
2769
+ })
2770
+ : new botbuilder.BotFrameworkAdapter(adapterConfig);
2771
+ // the default error handler
2772
+ adapter.onTurnError = (context, error) => tslib.__awaiter(this, void 0, void 0, function* () {
2773
+ // This check writes out errors to console.
2774
+ console.error(`[onTurnError] unhandled error: ${error}`);
2775
+ // Send a trace activity, which will be displayed in Bot Framework Emulator
2776
+ yield context.sendTraceActivity("OnTurnError Trace", `${error}`, "https://www.botframework.com/schemas/error", "TurnError");
2777
+ // Send a message to the user
2778
+ yield context.sendActivity(`The bot encountered unhandled error: ${error.message}`);
2779
+ yield context.sendActivity("To continue to run this bot, please fix the bot source code.");
2780
+ });
2781
+ return adapter;
2782
+ }
2783
+ /**
2784
+ * The request handler to integrate with web request.
2785
+ *
2786
+ * @param req - an Express or Restify style request object.
2787
+ * @param res - an Express or Restify style response object.
2788
+ * @param logic - the additional function to handle bot context.
2789
+ *
2790
+ * @example
2791
+ * For example, to use with Restify:
2792
+ * ``` typescript
2793
+ * // The default/empty behavior
2794
+ * server.post("api/messages", conversationBot.requestHandler);
2795
+ *
2796
+ * // Or, add your own logic
2797
+ * server.post("api/messages", async (req, res) => {
2798
+ * await conversationBot.requestHandler(req, res, async (context) => {
2799
+ * // your-own-context-logic
2800
+ * });
2801
+ * });
2802
+ * ```
2803
+ *
2804
+ * @beta
2805
+ */
2806
+ requestHandler(req, res, logic) {
2807
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2808
+ if (logic === undefined) {
2809
+ // create empty logic
2810
+ logic = () => tslib.__awaiter(this, void 0, void 0, function* () { });
2811
+ }
2812
+ yield this.adapter.processActivity(req, res, logic);
2813
+ });
2814
+ }
2498
2815
  }
2499
2816
 
2500
2817
  // Copyright (c) Microsoft Corporation.
@@ -2506,8 +2823,8 @@ class MessageBuilder {
2506
2823
  /**
2507
2824
  * Build a bot message activity attached with adaptive card.
2508
2825
  *
2509
- * @param getCardData Function to prepare your card data.
2510
2826
  * @param cardTemplate The adaptive card template.
2827
+ * @param data card data used to render the template.
2511
2828
  * @returns A bot message activity attached with an adaptive card.
2512
2829
  *
2513
2830
  * @example
@@ -2532,19 +2849,18 @@ class MessageBuilder {
2532
2849
  * title: string,
2533
2850
  * description: string
2534
2851
  * };
2535
- * const card = MessageBuilder.attachAdaptiveCard<CardData>(() => {
2536
- * return {
2537
- * title: "sample card title",
2538
- * description: "sample card description"
2539
- * }}, cardTemplate);
2852
+ * const card = MessageBuilder.attachAdaptiveCard<CardData>(
2853
+ * cardTemplate, {
2854
+ * title: "sample card title",
2855
+ * description: "sample card description"
2856
+ * });
2540
2857
  * ```
2541
2858
  *
2542
2859
  * @beta
2543
2860
  */
2544
- static attachAdaptiveCard(getCardData, cardTemplate) {
2545
- const cardData = getCardData();
2861
+ static attachAdaptiveCard(cardTemplate, data) {
2546
2862
  return {
2547
- attachments: [botbuilder.CardFactory.adaptiveCard(AdaptiveCards.declare(cardTemplate).render(cardData))],
2863
+ attachments: [botbuilder.CardFactory.adaptiveCard(AdaptiveCards.declare(cardTemplate).render(data))],
2548
2864
  };
2549
2865
  }
2550
2866
  /**
@@ -2651,8 +2967,11 @@ class MessageBuilder {
2651
2967
  }
2652
2968
  }
2653
2969
 
2970
+ exports.ApiKeyProvider = ApiKeyProvider;
2654
2971
  exports.AppCredential = AppCredential;
2972
+ exports.BasicAuthProvider = BasicAuthProvider;
2655
2973
  exports.BearerTokenAuthProvider = BearerTokenAuthProvider;
2974
+ exports.CertificateAuthProvider = CertificateAuthProvider;
2656
2975
  exports.Channel = Channel;
2657
2976
  exports.CommandBot = CommandBot;
2658
2977
  exports.ConversationBot = ConversationBot;
@@ -2668,6 +2987,8 @@ exports.TeamsFx = TeamsFx;
2668
2987
  exports.TeamsUserCredential = TeamsUserCredential;
2669
2988
  exports.createApiClient = createApiClient;
2670
2989
  exports.createMicrosoftGraphClient = createMicrosoftGraphClient;
2990
+ exports.createPemCertOption = createPemCertOption;
2991
+ exports.createPfxCertOption = createPfxCertOption;
2671
2992
  exports.getLogLevel = getLogLevel;
2672
2993
  exports.getTediousConnectionConfig = getTediousConnectionConfig;
2673
2994
  exports.sendAdaptiveCard = sendAdaptiveCard;