@microsoft/teamsfx 0.6.3-alpha.8d048e1f1.0 → 0.6.3-alpha.f018de6e6.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 +146 -4
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +236 -27
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +152 -3
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +245 -25
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +1370 -1236
package/dist/index.esm5.js
CHANGED
|
@@ -65,6 +65,10 @@ var ErrorCode;
|
|
|
65
65
|
* Identity type error.
|
|
66
66
|
*/
|
|
67
67
|
ErrorCode["IdentityTypeNotSupported"] = "IdentityTypeNotSupported";
|
|
68
|
+
/**
|
|
69
|
+
* Authentication info already exists error.
|
|
70
|
+
*/
|
|
71
|
+
ErrorCode["AuthorizationInfoAlreadyExists"] = "AuthorizationInfoAlreadyExists";
|
|
68
72
|
})(ErrorCode || (ErrorCode = {}));
|
|
69
73
|
/**
|
|
70
74
|
* @internal
|
|
@@ -86,6 +90,12 @@ ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token
|
|
|
86
90
|
ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
|
|
87
91
|
// IdentityTypeNotSupported Error
|
|
88
92
|
ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
|
|
93
|
+
// AuthorizationInfoError
|
|
94
|
+
ErrorMessage.AuthorizationHeaderAlreadyExists = "Authorization header already exists!";
|
|
95
|
+
ErrorMessage.BasicCredentialAlreadyExists = "Basic credential already exists!";
|
|
96
|
+
// InvalidParameter Error
|
|
97
|
+
ErrorMessage.EmptyParameter = "Parameter {0} is empty";
|
|
98
|
+
ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
|
|
89
99
|
/**
|
|
90
100
|
* Error class with code and message thrown by the SDK.
|
|
91
101
|
*
|
|
@@ -1125,6 +1135,10 @@ class BearerTokenAuthProvider {
|
|
|
1125
1135
|
* @param config - Contains all the request information and can be updated to include extra authentication info.
|
|
1126
1136
|
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1127
1137
|
*
|
|
1138
|
+
* @returns Updated axios request config.
|
|
1139
|
+
*
|
|
1140
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1141
|
+
*
|
|
1128
1142
|
* @beta
|
|
1129
1143
|
*/
|
|
1130
1144
|
AddAuthenticationInfo(config) {
|
|
@@ -1134,7 +1148,7 @@ class BearerTokenAuthProvider {
|
|
|
1134
1148
|
config.headers = {};
|
|
1135
1149
|
}
|
|
1136
1150
|
if (config.headers["Authorization"]) {
|
|
1137
|
-
throw new
|
|
1151
|
+
throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1138
1152
|
}
|
|
1139
1153
|
config.headers["Authorization"] = `Bearer ${token}`;
|
|
1140
1154
|
return config;
|
|
@@ -1142,6 +1156,124 @@ class BearerTokenAuthProvider {
|
|
|
1142
1156
|
}
|
|
1143
1157
|
}
|
|
1144
1158
|
|
|
1159
|
+
// Copyright (c) Microsoft Corporation.
|
|
1160
|
+
/**
|
|
1161
|
+
* Provider that handles Basic authentication
|
|
1162
|
+
*
|
|
1163
|
+
* @beta
|
|
1164
|
+
*/
|
|
1165
|
+
class BasicAuthProvider {
|
|
1166
|
+
/**
|
|
1167
|
+
*
|
|
1168
|
+
* @param userName - Username used in basic auth
|
|
1169
|
+
* @param password - Password used in basic auth
|
|
1170
|
+
*
|
|
1171
|
+
* @beta
|
|
1172
|
+
*/
|
|
1173
|
+
constructor(userName, password) {
|
|
1174
|
+
if (!userName) {
|
|
1175
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "username"), ErrorCode.InvalidParameter);
|
|
1176
|
+
}
|
|
1177
|
+
if (!password) {
|
|
1178
|
+
throw new ErrorWithCode(formatString(ErrorMessage.EmptyParameter, "password"), ErrorCode.InvalidParameter);
|
|
1179
|
+
}
|
|
1180
|
+
this.userName = userName;
|
|
1181
|
+
this.password = password;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Adds authentication info to http requests
|
|
1185
|
+
*
|
|
1186
|
+
* @param config - Contains all the request information and can be updated to include extra authentication info.
|
|
1187
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1188
|
+
*
|
|
1189
|
+
* @returns Updated axios request config.
|
|
1190
|
+
*
|
|
1191
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1192
|
+
*
|
|
1193
|
+
* @beta
|
|
1194
|
+
*/
|
|
1195
|
+
AddAuthenticationInfo(config) {
|
|
1196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1197
|
+
if (config.headers && config.headers["Authorization"]) {
|
|
1198
|
+
throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1199
|
+
}
|
|
1200
|
+
if (config.auth) {
|
|
1201
|
+
throw new ErrorWithCode(ErrorMessage.BasicCredentialAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1202
|
+
}
|
|
1203
|
+
config.auth = {
|
|
1204
|
+
username: this.userName,
|
|
1205
|
+
password: this.password,
|
|
1206
|
+
};
|
|
1207
|
+
return config;
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// Copyright (c) Microsoft Corporation.
|
|
1213
|
+
/**
|
|
1214
|
+
* Provider that handles Certificate authentication
|
|
1215
|
+
*
|
|
1216
|
+
* @beta
|
|
1217
|
+
*/
|
|
1218
|
+
class CertificateAuthProvider {
|
|
1219
|
+
/**
|
|
1220
|
+
*
|
|
1221
|
+
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1222
|
+
*
|
|
1223
|
+
* @beta
|
|
1224
|
+
*/
|
|
1225
|
+
constructor(certOption) {
|
|
1226
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Adds authentication info to http requests.
|
|
1230
|
+
*
|
|
1231
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1232
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1233
|
+
*
|
|
1234
|
+
* @returns Updated axios request config.
|
|
1235
|
+
*
|
|
1236
|
+
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1237
|
+
*
|
|
1238
|
+
* @beta
|
|
1239
|
+
*/
|
|
1240
|
+
AddAuthenticationInfo(config) {
|
|
1241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1242
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Helper to create SecureContextOptions from PEM format cert
|
|
1248
|
+
*
|
|
1249
|
+
* @param { string | Buffer } cert - The cert chain in PEM format
|
|
1250
|
+
* @param { string | Buffer } key - The private key for the cert chain
|
|
1251
|
+
* @param { string? } passphrase - The passphrase for private key
|
|
1252
|
+
* @param { string? | Buffer? } ca - Overrides the trusted CA certificates
|
|
1253
|
+
*
|
|
1254
|
+
* @returns Instance of SecureContextOptions
|
|
1255
|
+
*
|
|
1256
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1257
|
+
*
|
|
1258
|
+
*/
|
|
1259
|
+
function createPemCertOption(cert, key, passphrase, ca) {
|
|
1260
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPemCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Helper to create SecureContextOptions from PFX format cert
|
|
1264
|
+
*
|
|
1265
|
+
* @param { string | Buffer } pfx - The content of .pfx file
|
|
1266
|
+
* @param { string? } passphrase - Optional. The passphrase of .pfx file
|
|
1267
|
+
*
|
|
1268
|
+
* @returns Instance of SecureContextOptions
|
|
1269
|
+
*
|
|
1270
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1271
|
+
*
|
|
1272
|
+
*/
|
|
1273
|
+
function createPfxCertOption(pfx, passphrase) {
|
|
1274
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPfxCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1145
1277
|
// Copyright (c) Microsoft Corporation.
|
|
1146
1278
|
// Licensed under the MIT license.
|
|
1147
1279
|
/**
|
|
@@ -1266,7 +1398,7 @@ class TeamsFx {
|
|
|
1266
1398
|
/**
|
|
1267
1399
|
* Provide utilities for bot conversation, including:
|
|
1268
1400
|
* - handle command and response.
|
|
1269
|
-
* - send notification to varies targets (e.g., member,
|
|
1401
|
+
* - send notification to varies targets (e.g., member, group, channel).
|
|
1270
1402
|
*
|
|
1271
1403
|
* @remarks
|
|
1272
1404
|
* Only work on server side.
|
|
@@ -1287,6 +1419,23 @@ class ConversationBot {
|
|
|
1287
1419
|
constructor(options) {
|
|
1288
1420
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1289
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* The request handler to integrate with web request.
|
|
1424
|
+
*
|
|
1425
|
+
* @param req - an Express or Restify style request object.
|
|
1426
|
+
* @param res - an Express or Restify style response object.
|
|
1427
|
+
* @param logic - the additional function to handle bot context.
|
|
1428
|
+
*
|
|
1429
|
+
* @remarks
|
|
1430
|
+
* Only work on server side.
|
|
1431
|
+
*
|
|
1432
|
+
* @beta
|
|
1433
|
+
*/
|
|
1434
|
+
requestHandler(req, res, logic) {
|
|
1435
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1436
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1290
1439
|
}
|
|
1291
1440
|
|
|
1292
1441
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -1655,5 +1804,5 @@ class CommandBot {
|
|
|
1655
1804
|
}
|
|
1656
1805
|
}
|
|
1657
1806
|
|
|
1658
|
-
export { AppCredential, BearerTokenAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
1807
|
+
export { AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
1659
1808
|
//# sourceMappingURL=index.esm5.js.map
|