@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.
- package/dist/index.esm2017.js +195 -6
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +349 -42
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +203 -5
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +361 -40
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +1432 -1239
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,14 @@ 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}";
|
|
99
|
+
ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
|
|
100
|
+
ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
|
|
89
101
|
/**
|
|
90
102
|
* Error class with code and message thrown by the SDK.
|
|
91
103
|
*
|
|
@@ -1112,7 +1124,7 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1112
1124
|
*/
|
|
1113
1125
|
class BearerTokenAuthProvider {
|
|
1114
1126
|
/**
|
|
1115
|
-
* @param getToken Function that returns the content of bearer token used in http request
|
|
1127
|
+
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
1116
1128
|
*
|
|
1117
1129
|
* @beta
|
|
1118
1130
|
*/
|
|
@@ -1122,9 +1134,13 @@ class BearerTokenAuthProvider {
|
|
|
1122
1134
|
/**
|
|
1123
1135
|
* Adds authentication info to http requests
|
|
1124
1136
|
*
|
|
1125
|
-
* @param config - Contains all the request information and can be updated to include extra authentication info.
|
|
1137
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1126
1138
|
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1127
1139
|
*
|
|
1140
|
+
* @returns Updated axios request config.
|
|
1141
|
+
*
|
|
1142
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1143
|
+
*
|
|
1128
1144
|
* @beta
|
|
1129
1145
|
*/
|
|
1130
1146
|
AddAuthenticationInfo(config) {
|
|
@@ -1134,7 +1150,7 @@ class BearerTokenAuthProvider {
|
|
|
1134
1150
|
config.headers = {};
|
|
1135
1151
|
}
|
|
1136
1152
|
if (config.headers["Authorization"]) {
|
|
1137
|
-
throw new
|
|
1153
|
+
throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1138
1154
|
}
|
|
1139
1155
|
config.headers["Authorization"] = `Bearer ${token}`;
|
|
1140
1156
|
return config;
|
|
@@ -1142,6 +1158,171 @@ class BearerTokenAuthProvider {
|
|
|
1142
1158
|
}
|
|
1143
1159
|
}
|
|
1144
1160
|
|
|
1161
|
+
// Copyright (c) Microsoft Corporation.
|
|
1162
|
+
/**
|
|
1163
|
+
* Provider that handles Basic authentication
|
|
1164
|
+
*
|
|
1165
|
+
* @beta
|
|
1166
|
+
*/
|
|
1167
|
+
class BasicAuthProvider {
|
|
1168
|
+
/**
|
|
1169
|
+
*
|
|
1170
|
+
* @param { string } userName - Username used in basic auth
|
|
1171
|
+
* @param { string } password - Password used in basic auth
|
|
1172
|
+
*
|
|
1173
|
+
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
1174
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1175
|
+
*
|
|
1176
|
+
* @beta
|
|
1177
|
+
*/
|
|
1178
|
+
constructor(userName, password) {
|
|
1179
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Adds authentication info to http requests
|
|
1183
|
+
*
|
|
1184
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1185
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1186
|
+
*
|
|
1187
|
+
* @returns Updated axios request config.
|
|
1188
|
+
*
|
|
1189
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1190
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1191
|
+
*
|
|
1192
|
+
* @beta
|
|
1193
|
+
*/
|
|
1194
|
+
AddAuthenticationInfo(config) {
|
|
1195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1196
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
// Copyright (c) Microsoft Corporation.
|
|
1202
|
+
/**
|
|
1203
|
+
* Provider that handles API Key authentication
|
|
1204
|
+
*
|
|
1205
|
+
* @beta
|
|
1206
|
+
*/
|
|
1207
|
+
class ApiKeyProvider {
|
|
1208
|
+
/**
|
|
1209
|
+
*
|
|
1210
|
+
* @param { string } keyName - The name of request header or query parameter that specifies API Key
|
|
1211
|
+
* @param { string } keyValue - The value of API Key
|
|
1212
|
+
* @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.
|
|
1213
|
+
*
|
|
1214
|
+
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
1215
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1216
|
+
*
|
|
1217
|
+
* @beta
|
|
1218
|
+
*/
|
|
1219
|
+
constructor(keyName, keyValue, keyLocation) {
|
|
1220
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Adds authentication info to http requests
|
|
1224
|
+
*
|
|
1225
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1226
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1227
|
+
*
|
|
1228
|
+
* @returns Updated axios request config.
|
|
1229
|
+
*
|
|
1230
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
1231
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1232
|
+
*
|
|
1233
|
+
* @beta
|
|
1234
|
+
*/
|
|
1235
|
+
AddAuthenticationInfo(config) {
|
|
1236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1237
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Define available location for API Key location
|
|
1243
|
+
*
|
|
1244
|
+
* @beta
|
|
1245
|
+
*/
|
|
1246
|
+
var ApiKeyLocation;
|
|
1247
|
+
(function (ApiKeyLocation) {
|
|
1248
|
+
/**
|
|
1249
|
+
* The API Key is placed in request header
|
|
1250
|
+
*/
|
|
1251
|
+
ApiKeyLocation[ApiKeyLocation["Header"] = 0] = "Header";
|
|
1252
|
+
/**
|
|
1253
|
+
* The API Key is placed in query parameter
|
|
1254
|
+
*/
|
|
1255
|
+
ApiKeyLocation[ApiKeyLocation["QueryParams"] = 1] = "QueryParams";
|
|
1256
|
+
})(ApiKeyLocation || (ApiKeyLocation = {}));
|
|
1257
|
+
|
|
1258
|
+
// Copyright (c) Microsoft Corporation.
|
|
1259
|
+
/**
|
|
1260
|
+
* Provider that handles Certificate authentication
|
|
1261
|
+
*
|
|
1262
|
+
* @beta
|
|
1263
|
+
*/
|
|
1264
|
+
class CertificateAuthProvider {
|
|
1265
|
+
/**
|
|
1266
|
+
*
|
|
1267
|
+
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1268
|
+
*
|
|
1269
|
+
* @beta
|
|
1270
|
+
*/
|
|
1271
|
+
constructor(certOption) {
|
|
1272
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Adds authentication info to http requests.
|
|
1276
|
+
*
|
|
1277
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1278
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1279
|
+
*
|
|
1280
|
+
* @returns Updated axios request config.
|
|
1281
|
+
*
|
|
1282
|
+
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1283
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1284
|
+
*
|
|
1285
|
+
* @beta
|
|
1286
|
+
*/
|
|
1287
|
+
AddAuthenticationInfo(config) {
|
|
1288
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1289
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Helper to create SecureContextOptions from PEM format cert
|
|
1295
|
+
*
|
|
1296
|
+
* @param { string | Buffer } cert - The cert chain in PEM format
|
|
1297
|
+
* @param { string | Buffer } key - The private key for the cert chain
|
|
1298
|
+
* @param { string? } passphrase - The passphrase for private key
|
|
1299
|
+
* @param { string? | Buffer? } ca - Overrides the trusted CA certificates
|
|
1300
|
+
*
|
|
1301
|
+
* @returns Instance of SecureContextOptions
|
|
1302
|
+
*
|
|
1303
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1304
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1305
|
+
*
|
|
1306
|
+
*/
|
|
1307
|
+
function createPemCertOption(cert, key, passphrase, ca) {
|
|
1308
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPemCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Helper to create SecureContextOptions from PFX format cert
|
|
1312
|
+
*
|
|
1313
|
+
* @param { string | Buffer } pfx - The content of .pfx file
|
|
1314
|
+
* @param { string? } passphrase - Optional. The passphrase of .pfx file
|
|
1315
|
+
*
|
|
1316
|
+
* @returns Instance of SecureContextOptions
|
|
1317
|
+
*
|
|
1318
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1319
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1320
|
+
*
|
|
1321
|
+
*/
|
|
1322
|
+
function createPfxCertOption(pfx, passphrase) {
|
|
1323
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPfxCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1145
1326
|
// Copyright (c) Microsoft Corporation.
|
|
1146
1327
|
// Licensed under the MIT license.
|
|
1147
1328
|
/**
|
|
@@ -1266,7 +1447,7 @@ class TeamsFx {
|
|
|
1266
1447
|
/**
|
|
1267
1448
|
* Provide utilities for bot conversation, including:
|
|
1268
1449
|
* - handle command and response.
|
|
1269
|
-
* - send notification to varies targets (e.g., member,
|
|
1450
|
+
* - send notification to varies targets (e.g., member, group, channel).
|
|
1270
1451
|
*
|
|
1271
1452
|
* @remarks
|
|
1272
1453
|
* Only work on server side.
|
|
@@ -1287,6 +1468,23 @@ class ConversationBot {
|
|
|
1287
1468
|
constructor(options) {
|
|
1288
1469
|
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1289
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* The request handler to integrate with web request.
|
|
1473
|
+
*
|
|
1474
|
+
* @param req - an Express or Restify style request object.
|
|
1475
|
+
* @param res - an Express or Restify style response object.
|
|
1476
|
+
* @param logic - the additional function to handle bot context.
|
|
1477
|
+
*
|
|
1478
|
+
* @remarks
|
|
1479
|
+
* Only work on server side.
|
|
1480
|
+
*
|
|
1481
|
+
* @beta
|
|
1482
|
+
*/
|
|
1483
|
+
requestHandler(req, res, logic) {
|
|
1484
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1485
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1290
1488
|
}
|
|
1291
1489
|
|
|
1292
1490
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -1655,5 +1853,5 @@ class CommandBot {
|
|
|
1655
1853
|
}
|
|
1656
1854
|
}
|
|
1657
1855
|
|
|
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 };
|
|
1856
|
+
export { ApiKeyLocation, ApiKeyProvider, 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
1857
|
//# sourceMappingURL=index.esm5.js.map
|