@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/dist/index.esm2017.js +178 -5
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +285 -27
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +184 -4
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +295 -25
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +175 -11
package/dist/index.esm2017.js
CHANGED
|
@@ -64,6 +64,10 @@ var ErrorCode;
|
|
|
64
64
|
* Identity type error.
|
|
65
65
|
*/
|
|
66
66
|
ErrorCode["IdentityTypeNotSupported"] = "IdentityTypeNotSupported";
|
|
67
|
+
/**
|
|
68
|
+
* Authentication info already exists error.
|
|
69
|
+
*/
|
|
70
|
+
ErrorCode["AuthorizationInfoAlreadyExists"] = "AuthorizationInfoAlreadyExists";
|
|
67
71
|
})(ErrorCode || (ErrorCode = {}));
|
|
68
72
|
/**
|
|
69
73
|
* @internal
|
|
@@ -85,6 +89,14 @@ ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token
|
|
|
85
89
|
ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
|
|
86
90
|
// IdentityTypeNotSupported Error
|
|
87
91
|
ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
|
|
92
|
+
// AuthorizationInfoError
|
|
93
|
+
ErrorMessage.AuthorizationHeaderAlreadyExists = "Authorization header already exists!";
|
|
94
|
+
ErrorMessage.BasicCredentialAlreadyExists = "Basic credential already exists!";
|
|
95
|
+
// InvalidParameter Error
|
|
96
|
+
ErrorMessage.EmptyParameter = "Parameter {0} is empty";
|
|
97
|
+
ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
|
|
98
|
+
ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
|
|
99
|
+
ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
|
|
88
100
|
/**
|
|
89
101
|
* Error class with code and message thrown by the SDK.
|
|
90
102
|
*
|
|
@@ -1082,7 +1094,6 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1082
1094
|
}
|
|
1083
1095
|
|
|
1084
1096
|
// Copyright (c) Microsoft Corporation.
|
|
1085
|
-
// Licensed under the MIT license.
|
|
1086
1097
|
/**
|
|
1087
1098
|
* Provider that handles Bearer Token authentication
|
|
1088
1099
|
*
|
|
@@ -1090,7 +1101,7 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
|
1090
1101
|
*/
|
|
1091
1102
|
class BearerTokenAuthProvider {
|
|
1092
1103
|
/**
|
|
1093
|
-
* @param getToken Function that returns the content of bearer token used in http request
|
|
1104
|
+
* @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
|
|
1094
1105
|
*
|
|
1095
1106
|
* @beta
|
|
1096
1107
|
*/
|
|
@@ -1100,9 +1111,13 @@ class BearerTokenAuthProvider {
|
|
|
1100
1111
|
/**
|
|
1101
1112
|
* Adds authentication info to http requests
|
|
1102
1113
|
*
|
|
1103
|
-
* @param config - Contains all the request information and can be updated to include extra authentication info.
|
|
1114
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1104
1115
|
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1105
1116
|
*
|
|
1117
|
+
* @returns Updated axios request config.
|
|
1118
|
+
*
|
|
1119
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
|
1120
|
+
*
|
|
1106
1121
|
* @beta
|
|
1107
1122
|
*/
|
|
1108
1123
|
async AddAuthenticationInfo(config) {
|
|
@@ -1111,13 +1126,171 @@ class BearerTokenAuthProvider {
|
|
|
1111
1126
|
config.headers = {};
|
|
1112
1127
|
}
|
|
1113
1128
|
if (config.headers["Authorization"]) {
|
|
1114
|
-
throw new
|
|
1129
|
+
throw new ErrorWithCode(ErrorMessage.AuthorizationHeaderAlreadyExists, ErrorCode.AuthorizationInfoAlreadyExists);
|
|
1115
1130
|
}
|
|
1116
1131
|
config.headers["Authorization"] = `Bearer ${token}`;
|
|
1117
1132
|
return config;
|
|
1118
1133
|
}
|
|
1119
1134
|
}
|
|
1120
1135
|
|
|
1136
|
+
// Copyright (c) Microsoft Corporation.
|
|
1137
|
+
/**
|
|
1138
|
+
* Provider that handles Basic authentication
|
|
1139
|
+
*
|
|
1140
|
+
* @beta
|
|
1141
|
+
*/
|
|
1142
|
+
class BasicAuthProvider {
|
|
1143
|
+
/**
|
|
1144
|
+
*
|
|
1145
|
+
* @param { string } userName - Username used in basic auth
|
|
1146
|
+
* @param { string } password - Password used in basic auth
|
|
1147
|
+
*
|
|
1148
|
+
* @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
|
|
1149
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1150
|
+
*
|
|
1151
|
+
* @beta
|
|
1152
|
+
*/
|
|
1153
|
+
constructor(userName, password) {
|
|
1154
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Adds authentication info to http requests
|
|
1158
|
+
*
|
|
1159
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1160
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1161
|
+
*
|
|
1162
|
+
* @returns Updated axios request config.
|
|
1163
|
+
*
|
|
1164
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
|
|
1165
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1166
|
+
*
|
|
1167
|
+
* @beta
|
|
1168
|
+
*/
|
|
1169
|
+
async AddAuthenticationInfo(config) {
|
|
1170
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// Copyright (c) Microsoft Corporation.
|
|
1175
|
+
/**
|
|
1176
|
+
* Provider that handles API Key authentication
|
|
1177
|
+
*
|
|
1178
|
+
* @beta
|
|
1179
|
+
*/
|
|
1180
|
+
class ApiKeyProvider {
|
|
1181
|
+
/**
|
|
1182
|
+
*
|
|
1183
|
+
* @param { string } keyName - The name of request header or query parameter that specifies API Key
|
|
1184
|
+
* @param { string } keyValue - The value of API Key
|
|
1185
|
+
* @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.
|
|
1186
|
+
*
|
|
1187
|
+
* @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
|
|
1188
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1189
|
+
*
|
|
1190
|
+
* @beta
|
|
1191
|
+
*/
|
|
1192
|
+
constructor(keyName, keyValue, keyLocation) {
|
|
1193
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Adds authentication info to http requests
|
|
1197
|
+
*
|
|
1198
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1199
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1200
|
+
*
|
|
1201
|
+
* @returns Updated axios request config.
|
|
1202
|
+
*
|
|
1203
|
+
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
|
|
1204
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1205
|
+
*
|
|
1206
|
+
* @beta
|
|
1207
|
+
*/
|
|
1208
|
+
async AddAuthenticationInfo(config) {
|
|
1209
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Define available location for API Key location
|
|
1214
|
+
*
|
|
1215
|
+
* @beta
|
|
1216
|
+
*/
|
|
1217
|
+
var ApiKeyLocation;
|
|
1218
|
+
(function (ApiKeyLocation) {
|
|
1219
|
+
/**
|
|
1220
|
+
* The API Key is placed in request header
|
|
1221
|
+
*/
|
|
1222
|
+
ApiKeyLocation[ApiKeyLocation["Header"] = 0] = "Header";
|
|
1223
|
+
/**
|
|
1224
|
+
* The API Key is placed in query parameter
|
|
1225
|
+
*/
|
|
1226
|
+
ApiKeyLocation[ApiKeyLocation["QueryParams"] = 1] = "QueryParams";
|
|
1227
|
+
})(ApiKeyLocation || (ApiKeyLocation = {}));
|
|
1228
|
+
|
|
1229
|
+
// Copyright (c) Microsoft Corporation.
|
|
1230
|
+
/**
|
|
1231
|
+
* Provider that handles Certificate authentication
|
|
1232
|
+
*
|
|
1233
|
+
* @beta
|
|
1234
|
+
*/
|
|
1235
|
+
class CertificateAuthProvider {
|
|
1236
|
+
/**
|
|
1237
|
+
*
|
|
1238
|
+
* @param { SecureContextOptions } certOption - information about the cert used in http requests
|
|
1239
|
+
*
|
|
1240
|
+
* @beta
|
|
1241
|
+
*/
|
|
1242
|
+
constructor(certOption) {
|
|
1243
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Adds authentication info to http requests.
|
|
1247
|
+
*
|
|
1248
|
+
* @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.
|
|
1249
|
+
* Refer https://axios-http.com/docs/req_config for detailed document.
|
|
1250
|
+
*
|
|
1251
|
+
* @returns Updated axios request config.
|
|
1252
|
+
*
|
|
1253
|
+
* @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
|
|
1254
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1255
|
+
*
|
|
1256
|
+
* @beta
|
|
1257
|
+
*/
|
|
1258
|
+
async AddAuthenticationInfo(config) {
|
|
1259
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Helper to create SecureContextOptions from PEM format cert
|
|
1264
|
+
*
|
|
1265
|
+
* @param { string | Buffer } cert - The cert chain in PEM format
|
|
1266
|
+
* @param { string | Buffer } key - The private key for the cert chain
|
|
1267
|
+
* @param { {passphrase?: string; ca?: string | Buffer} } options - Optional settings when create the cert options.
|
|
1268
|
+
*
|
|
1269
|
+
* @returns Instance of SecureContextOptions
|
|
1270
|
+
*
|
|
1271
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1272
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1273
|
+
*
|
|
1274
|
+
*/
|
|
1275
|
+
function createPemCertOption(cert, key, options) {
|
|
1276
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPemCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Helper to create SecureContextOptions from PFX format cert
|
|
1280
|
+
*
|
|
1281
|
+
* @param { string | Buffer } pfx - The content of .pfx file
|
|
1282
|
+
* @param { {passphrase?: string} } options - Optional settings when create the cert options.
|
|
1283
|
+
*
|
|
1284
|
+
* @returns Instance of SecureContextOptions
|
|
1285
|
+
*
|
|
1286
|
+
* @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty
|
|
1287
|
+
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
|
1288
|
+
*
|
|
1289
|
+
*/
|
|
1290
|
+
function createPfxCertOption(pfx, options) {
|
|
1291
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "createPfxCertOption"), ErrorCode.RuntimeNotSupported);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1121
1294
|
// Copyright (c) Microsoft Corporation.
|
|
1122
1295
|
// Licensed under the MIT license.
|
|
1123
1296
|
/**
|
|
@@ -1632,5 +1805,5 @@ class CommandBot {
|
|
|
1632
1805
|
}
|
|
1633
1806
|
}
|
|
1634
1807
|
|
|
1635
|
-
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 };
|
|
1808
|
+
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 };
|
|
1636
1809
|
//# sourceMappingURL=index.esm2017.js.map
|