@microsoft/teamsfx 0.6.3-alpha.768a76f6e.0 → 0.6.3-alpha.8178ded9d.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/teamsfx",
3
- "version": "0.6.3-alpha.768a76f6e.0",
3
+ "version": "0.6.3-alpha.8178ded9d.0",
4
4
  "description": "Microsoft Teams Framework for Node.js and browser.",
5
5
  "main": "dist/index.node.cjs.js",
6
6
  "browser": "dist/index.esm2017.js",
@@ -49,7 +49,7 @@
49
49
  "@azure/identity": "^2.0.1",
50
50
  "@azure/msal-browser": "^2.21.0",
51
51
  "@azure/msal-node": "~1.1.0",
52
- "@microsoft/adaptivecards-tools": "0.1.6-alpha.768a76f6e.0",
52
+ "@microsoft/adaptivecards-tools": "0.1.6-alpha.8178ded9d.0",
53
53
  "@microsoft/microsoft-graph-client": "^3.0.1",
54
54
  "axios": "^0.24.0",
55
55
  "botbuilder": ">=4.15.0 <5.0.0",
@@ -128,7 +128,7 @@
128
128
  "webpack": "^5.62.1",
129
129
  "yargs": "^17.2.1"
130
130
  },
131
- "gitHead": "abd4ae57fa15736402b5385eb7d0b6c23e7c3674",
131
+ "gitHead": "e472a322421296591d785d9283ecacc46f58185d",
132
132
  "publishConfig": {
133
133
  "access": "public"
134
134
  },
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+
1
3
  import { AccessToken } from '@azure/identity';
2
4
  import { Activity } from 'botbuilder-core';
3
5
  import { Activity as Activity_2 } from 'botbuilder';
@@ -19,6 +21,7 @@ import { GetTokenOptions } from '@azure/identity';
19
21
  import { HeroCard } from 'botbuilder';
20
22
  import { O365ConnectorCard } from 'botbuilder';
21
23
  import { ReceiptCard } from 'botbuilder';
24
+ import { SecureContextOptions } from 'tls';
22
25
  import { TeamsChannelAccount } from 'botbuilder';
23
26
  import { ThumbnailCard } from 'botbuilder';
24
27
  import { TokenCredential } from '@azure/identity';
@@ -28,6 +31,59 @@ import { TurnContext as TurnContext_2 } from 'botbuilder';
28
31
  import { WebRequest } from 'botbuilder';
29
32
  import { WebResponse } from 'botbuilder';
30
33
 
34
+ /**
35
+ * Define available location for API Key location
36
+ *
37
+ * @beta
38
+ */
39
+ export declare enum ApiKeyLocation {
40
+ /**
41
+ * The API Key is placed in request header
42
+ */
43
+ Header = 0,
44
+ /**
45
+ * The API Key is placed in query parameter
46
+ */
47
+ QueryParams = 1
48
+ }
49
+
50
+ /**
51
+ * Provider that handles API Key authentication
52
+ *
53
+ * @beta
54
+ */
55
+ export declare class ApiKeyProvider implements AuthProvider {
56
+ private keyName;
57
+ private keyValue;
58
+ private keyLocation;
59
+ /**
60
+ *
61
+ * @param { string } keyName - The name of request header or query parameter that specifies API Key
62
+ * @param { string } keyValue - The value of API Key
63
+ * @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.
64
+ *
65
+ * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
66
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
67
+ *
68
+ * @beta
69
+ */
70
+ constructor(keyName: string, keyValue: string, keyLocation: ApiKeyLocation);
71
+ /**
72
+ * Adds authentication info to http requests
73
+ *
74
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
75
+ * Refer https://axios-http.com/docs/req_config for detailed document.
76
+ *
77
+ * @returns Updated axios request config.
78
+ *
79
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
80
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
81
+ *
82
+ * @beta
83
+ */
84
+ AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
85
+ }
86
+
31
87
  /**
32
88
  * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.
33
89
  *
@@ -151,7 +207,7 @@ export declare interface AuthProvider {
151
207
  /**
152
208
  * Adds authentication info to http requests
153
209
  *
154
- * @param config - Contains all the request information and can be updated to include extra authentication info.
210
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
155
211
  * Refer https://axios-http.com/docs/req_config for detailed document.
156
212
  *
157
213
  * @beta
@@ -159,6 +215,43 @@ export declare interface AuthProvider {
159
215
  AddAuthenticationInfo: (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
160
216
  }
161
217
 
218
+ export { AxiosInstance }
219
+
220
+ /**
221
+ * Provider that handles Basic authentication
222
+ *
223
+ * @beta
224
+ */
225
+ export declare class BasicAuthProvider implements AuthProvider {
226
+ private userName;
227
+ private password;
228
+ /**
229
+ *
230
+ * @param { string } userName - Username used in basic auth
231
+ * @param { string } password - Password used in basic auth
232
+ *
233
+ * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
234
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
235
+ *
236
+ * @beta
237
+ */
238
+ constructor(userName: string, password: string);
239
+ /**
240
+ * Adds authentication info to http requests
241
+ *
242
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
243
+ * Refer https://axios-http.com/docs/req_config for detailed document.
244
+ *
245
+ * @returns Updated axios request config.
246
+ *
247
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
248
+ * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
249
+ *
250
+ * @beta
251
+ */
252
+ AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
253
+ }
254
+
162
255
  /**
163
256
  * Provider that handles Bearer Token authentication
164
257
  *
@@ -167,7 +260,7 @@ export declare interface AuthProvider {
167
260
  export declare class BearerTokenAuthProvider implements AuthProvider {
168
261
  private getToken;
169
262
  /**
170
- * @param getToken Function that returns the content of bearer token used in http request
263
+ * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
171
264
  *
172
265
  * @beta
173
266
  */
@@ -175,9 +268,44 @@ export declare class BearerTokenAuthProvider implements AuthProvider {
175
268
  /**
176
269
  * Adds authentication info to http requests
177
270
  *
178
- * @param config - Contains all the request information and can be updated to include extra authentication info.
271
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
272
+ * Refer https://axios-http.com/docs/req_config for detailed document.
273
+ *
274
+ * @returns Updated axios request config.
275
+ *
276
+ * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
277
+ *
278
+ * @beta
279
+ */
280
+ AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
281
+ }
282
+
283
+ /**
284
+ * Provider that handles Certificate authentication
285
+ *
286
+ * @beta
287
+ */
288
+ export declare class CertificateAuthProvider implements AuthProvider {
289
+ private certOption;
290
+ /**
291
+ *
292
+ * @param { SecureContextOptions } certOption - information about the cert used in http requests
293
+ *
294
+ * @throws {@link ErrorCode|InvalidParameter} - when cert option is empty.
295
+ *
296
+ * @beta
297
+ */
298
+ constructor(certOption: SecureContextOptions);
299
+ /**
300
+ * Adds authentication info to http requests.
301
+ *
302
+ * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
179
303
  * Refer https://axios-http.com/docs/req_config for detailed document.
180
304
  *
305
+ * @returns Updated axios request config.
306
+ *
307
+ * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
308
+ *
181
309
  * @beta
182
310
  */
183
311
  AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
@@ -547,6 +675,38 @@ export declare function createApiClient(apiEndpoint: string, authProvider: AuthP
547
675
  */
548
676
  export declare function createMicrosoftGraphClient(teamsfx: TeamsFxConfiguration, scopes?: string | string[]): Client;
549
677
 
678
+ /**
679
+ * Helper to create SecureContextOptions from PEM format cert
680
+ *
681
+ * @param { string | Buffer } cert - The cert chain in PEM format
682
+ * @param { string | Buffer } key - The private key for the cert chain
683
+ * @param { {passphrase?: string; ca?: string | Buffer} } options - Optional settings when create the cert options.
684
+ *
685
+ * @returns Instance of SecureContextOptions
686
+ *
687
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
688
+ *
689
+ */
690
+ export declare function createPemCertOption(cert: string | Buffer, key: string | Buffer, options?: {
691
+ passphrase?: string;
692
+ ca?: string | Buffer;
693
+ }): SecureContextOptions;
694
+
695
+ /**
696
+ * Helper to create SecureContextOptions from PFX format cert
697
+ *
698
+ * @param { string | Buffer } pfx - The content of .pfx file
699
+ * @param { {passphrase?: string} } options - Optional settings when create the cert options.
700
+ *
701
+ * @returns Instance of SecureContextOptions
702
+ *
703
+ * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
704
+ *
705
+ */
706
+ export declare function createPfxCertOption(pfx: string | Buffer, options?: {
707
+ passphrase?: string;
708
+ }): SecureContextOptions;
709
+
550
710
  /**
551
711
  * Error code to trace the error types.
552
712
  * @beta
@@ -603,7 +763,11 @@ export declare enum ErrorCode {
603
763
  /**
604
764
  * Identity type error.
605
765
  */
606
- IdentityTypeNotSupported = "IdentityTypeNotSupported"
766
+ IdentityTypeNotSupported = "IdentityTypeNotSupported",
767
+ /**
768
+ * Authentication info already exists error.
769
+ */
770
+ AuthorizationInfoAlreadyExists = "AuthorizationInfoAlreadyExists"
607
771
  }
608
772
 
609
773
  /**
@@ -794,8 +958,8 @@ export declare class MessageBuilder {
794
958
  /**
795
959
  * Build a bot message activity attached with adaptive card.
796
960
  *
797
- * @param getCardData Function to prepare your card data.
798
961
  * @param cardTemplate The adaptive card template.
962
+ * @param data card data used to render the template.
799
963
  * @returns A bot message activity attached with an adaptive card.
800
964
  *
801
965
  * @example
@@ -820,16 +984,16 @@ export declare class MessageBuilder {
820
984
  * title: string,
821
985
  * description: string
822
986
  * };
823
- * const card = MessageBuilder.attachAdaptiveCard<CardData>(() => {
824
- * return {
825
- * title: "sample card title",
826
- * description: "sample card description"
827
- * }}, cardTemplate);
987
+ * const card = MessageBuilder.attachAdaptiveCard<CardData>(
988
+ * cardTemplate, {
989
+ * title: "sample card title",
990
+ * description: "sample card description"
991
+ * });
828
992
  * ```
829
993
  *
830
994
  * @beta
831
995
  */
832
- static attachAdaptiveCard<TData>(getCardData: () => TData, cardTemplate: any): Partial<Activity_2>;
996
+ static attachAdaptiveCard<TData>(cardTemplate: any, data: TData): Partial<Activity_2>;
833
997
  /**
834
998
  * Build a bot message activity attached with an adaptive card.
835
999
  *