@microsoft/teamsfx 0.6.3-alpha.768a76f6e.0 → 0.6.3-alpha.81c48cbfc.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/dist/index.esm2017.js +67 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +102 -1
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +69 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +106 -0
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +1272 -1212
package/dist/index.esm2017.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { ActivityTypes, Channels, TeamsInfo, CardFactory, ActionTypes, MessageFa
|
|
|
7
7
|
import { Dialog } from 'botbuilder-dialogs';
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
9
|
import axios from 'axios';
|
|
10
|
+
import { Agent } from 'https';
|
|
10
11
|
import * as path from 'path';
|
|
11
12
|
import * as fs from 'fs';
|
|
12
13
|
|
|
@@ -91,6 +92,9 @@ ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token
|
|
|
91
92
|
ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
|
|
92
93
|
// IdentityTypeNotSupported Error
|
|
93
94
|
ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
|
|
95
|
+
// InvalidParameter Error
|
|
96
|
+
ErrorMessage.EmptyParameter = "Parameter {0} is empty";
|
|
97
|
+
ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
|
|
94
98
|
/**
|
|
95
99
|
* Error class with code and message thrown by the SDK.
|
|
96
100
|
*
|
|
@@ -1451,6 +1455,103 @@ class BearerTokenAuthProvider {
|
|
|
1451
1455
|
}
|
|
1452
1456
|
}
|
|
1453
1457
|
|
|
1458
|
+
// Copyright (c) Microsoft Corporation.
|
|
1459
|
+
/**
|
|
1460
|
+
* Provider that handles Certificate authentication
|
|
1461
|
+
*
|
|
1462
|
+
* @beta
|
|
1463
|
+
*/
|
|
1464
|
+
class CertificateAuthProvider {
|
|
1465
|
+
/**
|
|
1466
|
+
*
|
|
1467
|
+
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1468
|
+
*
|
|
1469
|
+
* @beta
|
|
1470
|
+
*/
|
|
1471
|
+
constructor(certOption) {
|
|
1472
|
+
if (certOption && Object.keys(certOption).length !== 0) {
|
|
1473
|
+
this.certOption = certOption;
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "certOption"), ErrorCode.InvalidParameter);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Adds authentication info to http requests.
|
|
1481
|
+
*
|
|
1482
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1483
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1484
|
+
*
|
|
1485
|
+
* @returns Updated axios request config.
|
|
1486
|
+
*
|
|
1487
|
+
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1488
|
+
*
|
|
1489
|
+
* @beta
|
|
1490
|
+
*/
|
|
1491
|
+
async AddAuthenticationInfo(config) {
|
|
1492
|
+
if (!config.httpsAgent) {
|
|
1493
|
+
config.httpsAgent = new Agent(this.certOption);
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
const existingProperties = new Set(Object.keys(config.httpsAgent.options));
|
|
1497
|
+
for (const property of Object.keys(this.certOption)) {
|
|
1498
|
+
if (existingProperties.has(property)) {
|
|
1499
|
+
throw new ErrorWithCode(formatString(ErrorMessage.DuplicateHttpsOptionProperty, property), ErrorCode.InvalidParameter);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
Object.assign(config.httpsAgent.options, this.certOption);
|
|
1503
|
+
}
|
|
1504
|
+
return config;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Helper to create SecureContextOptions from PEM format cert
|
|
1509
|
+
*
|
|
1510
|
+
* @param { string | Buffer } cert - The cert chain in PEM format
|
|
1511
|
+
* @param { string | Buffer } key - The private key for the cert chain
|
|
1512
|
+
* @param { string? } passphrase - The passphrase for private key
|
|
1513
|
+
* @param { string? | Buffer? } ca - Overrides the trusted CA certificates
|
|
1514
|
+
*
|
|
1515
|
+
* @returns Instance of SecureContextOptions
|
|
1516
|
+
*
|
|
1517
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1518
|
+
*
|
|
1519
|
+
*/
|
|
1520
|
+
function createPemCertOption(cert, key, passphrase, ca) {
|
|
1521
|
+
if (cert.length === 0) {
|
|
1522
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "cert"), ErrorCode.InvalidParameter);
|
|
1523
|
+
}
|
|
1524
|
+
if (key.length === 0) {
|
|
1525
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "key"), ErrorCode.InvalidParameter);
|
|
1526
|
+
}
|
|
1527
|
+
return {
|
|
1528
|
+
cert,
|
|
1529
|
+
key,
|
|
1530
|
+
passphrase,
|
|
1531
|
+
ca,
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Helper to create SecureContextOptions from PFX format cert
|
|
1536
|
+
*
|
|
1537
|
+
* @param { string | Buffer } pfx - The content of .pfx file
|
|
1538
|
+
* @param { string? } passphrase - Optional. The passphrase of .pfx file
|
|
1539
|
+
*
|
|
1540
|
+
* @returns Instance of SecureContextOptions
|
|
1541
|
+
*
|
|
1542
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1543
|
+
*
|
|
1544
|
+
*/
|
|
1545
|
+
function createPfxCertOption(pfx, passphrase) {
|
|
1546
|
+
if (pfx.length === 0) {
|
|
1547
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "pfx"), ErrorCode.InvalidParameter);
|
|
1548
|
+
}
|
|
1549
|
+
return {
|
|
1550
|
+
pfx,
|
|
1551
|
+
passphrase,
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1454
1555
|
// Copyright (c) Microsoft Corporation.
|
|
1455
1556
|
/**
|
|
1456
1557
|
* A class providing credential and configuration.
|
|
@@ -2610,5 +2711,5 @@ class MessageBuilder {
|
|
|
2610
2711
|
}
|
|
2611
2712
|
}
|
|
2612
2713
|
|
|
2613
|
-
export { AppCredential, BearerTokenAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
2714
|
+
export { AppCredential, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
2614
2715
|
//# sourceMappingURL=index.esm2017.mjs.map
|