@microsoft/teamsfx 0.6.2-alpha.2351323e8.0 → 0.6.2-alpha.6399c5efb.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/README.md +1 -8
- package/dist/index.esm2017.js +311 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +824 -2
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +321 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +879 -0
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -2
- package/types/teamsfx.d.ts +578 -0
package/dist/index.esm5.js
CHANGED
|
@@ -1195,5 +1195,325 @@ class TeamsFx {
|
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
|
-
|
|
1198
|
+
// Copyright (c) Microsoft Corporation.
|
|
1199
|
+
/**
|
|
1200
|
+
* Send a plain text message to a notification target.
|
|
1201
|
+
*
|
|
1202
|
+
* @remarks
|
|
1203
|
+
* Only work on server side.
|
|
1204
|
+
*
|
|
1205
|
+
* @param target - the notification target.
|
|
1206
|
+
* @param text - the plain text message.
|
|
1207
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1208
|
+
*
|
|
1209
|
+
* @beta
|
|
1210
|
+
*/
|
|
1211
|
+
function sendMessage(target, text) {
|
|
1212
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Send an adaptive card message to a notification target.
|
|
1216
|
+
*
|
|
1217
|
+
* @remarks
|
|
1218
|
+
* Only work on server side.
|
|
1219
|
+
*
|
|
1220
|
+
* @param target - the notification target.
|
|
1221
|
+
* @param card - the adaptive card raw JSON.
|
|
1222
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1223
|
+
*
|
|
1224
|
+
* @beta
|
|
1225
|
+
*/
|
|
1226
|
+
function sendAdaptiveCard(target, card) {
|
|
1227
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* A {@link NotificationTarget} that represents a team channel.
|
|
1231
|
+
*
|
|
1232
|
+
* @remarks
|
|
1233
|
+
* Only work on server side.
|
|
1234
|
+
*
|
|
1235
|
+
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
|
|
1236
|
+
*
|
|
1237
|
+
* @beta
|
|
1238
|
+
*/
|
|
1239
|
+
class Channel {
|
|
1240
|
+
/**
|
|
1241
|
+
* Constuctor.
|
|
1242
|
+
*
|
|
1243
|
+
* @remarks
|
|
1244
|
+
* Only work on server side.
|
|
1245
|
+
*
|
|
1246
|
+
* It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.
|
|
1247
|
+
*
|
|
1248
|
+
* @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
|
|
1249
|
+
* @param info - Detailed channel information.
|
|
1250
|
+
*
|
|
1251
|
+
* @beta
|
|
1252
|
+
*/
|
|
1253
|
+
constructor(parent, info) {
|
|
1254
|
+
/**
|
|
1255
|
+
* Notification target type. For channel it's always "Channel".
|
|
1256
|
+
*
|
|
1257
|
+
* @remarks
|
|
1258
|
+
* Only work on server side.
|
|
1259
|
+
*
|
|
1260
|
+
* @beta
|
|
1261
|
+
*/
|
|
1262
|
+
this.type = "Channel";
|
|
1263
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Send a plain text message.
|
|
1267
|
+
*
|
|
1268
|
+
* @remarks
|
|
1269
|
+
* Only work on server side.
|
|
1270
|
+
*
|
|
1271
|
+
* @param text - the plain text message.
|
|
1272
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1273
|
+
*
|
|
1274
|
+
* @beta
|
|
1275
|
+
*/
|
|
1276
|
+
sendMessage(text) {
|
|
1277
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Send an adaptive card message.
|
|
1281
|
+
*
|
|
1282
|
+
* @remarks
|
|
1283
|
+
* Only work on server side.
|
|
1284
|
+
*
|
|
1285
|
+
* @param card - the adaptive card raw JSON.
|
|
1286
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1287
|
+
*
|
|
1288
|
+
* @beta
|
|
1289
|
+
*/
|
|
1290
|
+
sendAdaptiveCard(card) {
|
|
1291
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1292
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* A {@link NotificationTarget} that represents a team member.
|
|
1298
|
+
*
|
|
1299
|
+
* @remarks
|
|
1300
|
+
* Only work on server side.
|
|
1301
|
+
*
|
|
1302
|
+
* It's recommended to get members from {@link TeamsBotInstallation.members()}.
|
|
1303
|
+
*
|
|
1304
|
+
* @beta
|
|
1305
|
+
*/
|
|
1306
|
+
class Member {
|
|
1307
|
+
/**
|
|
1308
|
+
* Constuctor.
|
|
1309
|
+
*
|
|
1310
|
+
* @remarks
|
|
1311
|
+
* Only work on server side.
|
|
1312
|
+
*
|
|
1313
|
+
* It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.
|
|
1314
|
+
*
|
|
1315
|
+
* @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
|
|
1316
|
+
* @param account - Detailed member account information.
|
|
1317
|
+
*
|
|
1318
|
+
* @beta
|
|
1319
|
+
*/
|
|
1320
|
+
constructor(parent, account) {
|
|
1321
|
+
/**
|
|
1322
|
+
* Notification target type. For member it's always "Person".
|
|
1323
|
+
*
|
|
1324
|
+
* @remarks
|
|
1325
|
+
* Only work on server side.
|
|
1326
|
+
*
|
|
1327
|
+
* @beta
|
|
1328
|
+
*/
|
|
1329
|
+
this.type = "Person";
|
|
1330
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Send a plain text message.
|
|
1334
|
+
*
|
|
1335
|
+
* @remarks
|
|
1336
|
+
* Only work on server side.
|
|
1337
|
+
*
|
|
1338
|
+
* @param text - the plain text message.
|
|
1339
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1340
|
+
*
|
|
1341
|
+
* @beta
|
|
1342
|
+
*/
|
|
1343
|
+
sendMessage(text) {
|
|
1344
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Send an adaptive card message.
|
|
1348
|
+
*
|
|
1349
|
+
* @remarks
|
|
1350
|
+
* Only work on server side.
|
|
1351
|
+
*
|
|
1352
|
+
* @param card - the adaptive card raw JSON.
|
|
1353
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1354
|
+
*
|
|
1355
|
+
* @beta
|
|
1356
|
+
*/
|
|
1357
|
+
sendAdaptiveCard(card) {
|
|
1358
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1359
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into
|
|
1365
|
+
* - Personal chat
|
|
1366
|
+
* - Group chat
|
|
1367
|
+
* - Team (by default the `General` channel)
|
|
1368
|
+
*
|
|
1369
|
+
* @remarks
|
|
1370
|
+
* Only work on server side.
|
|
1371
|
+
*
|
|
1372
|
+
* It's recommended to get bot installations from {@link ConversationBot.installations()}.
|
|
1373
|
+
*
|
|
1374
|
+
* @beta
|
|
1375
|
+
*/
|
|
1376
|
+
class TeamsBotInstallation {
|
|
1377
|
+
/**
|
|
1378
|
+
* Constructor
|
|
1379
|
+
*
|
|
1380
|
+
* @remarks
|
|
1381
|
+
* Only work on server side.
|
|
1382
|
+
*
|
|
1383
|
+
* It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.
|
|
1384
|
+
*
|
|
1385
|
+
* @param adapter - the bound `BotFrameworkAdapter`.
|
|
1386
|
+
* @param conversationReference - the bound `ConversationReference`.
|
|
1387
|
+
*
|
|
1388
|
+
* @beta
|
|
1389
|
+
*/
|
|
1390
|
+
constructor(adapter, conversationReference) {
|
|
1391
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Send a plain text message.
|
|
1395
|
+
*
|
|
1396
|
+
* @remarks
|
|
1397
|
+
* Only work on server side.
|
|
1398
|
+
*
|
|
1399
|
+
* @param text - the plain text message.
|
|
1400
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1401
|
+
*
|
|
1402
|
+
* @beta
|
|
1403
|
+
*/
|
|
1404
|
+
sendMessage(text) {
|
|
1405
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Send an adaptive card message.
|
|
1409
|
+
*
|
|
1410
|
+
* @remarks
|
|
1411
|
+
* Only work on server side.
|
|
1412
|
+
*
|
|
1413
|
+
* @param card - the adaptive card raw JSON.
|
|
1414
|
+
* @returns A `Promise` representing the asynchronous operation.
|
|
1415
|
+
*
|
|
1416
|
+
* @beta
|
|
1417
|
+
*/
|
|
1418
|
+
sendAdaptiveCard(card) {
|
|
1419
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Get channels from this bot installation.
|
|
1423
|
+
*
|
|
1424
|
+
* @remarks
|
|
1425
|
+
* Only work on server side.
|
|
1426
|
+
*
|
|
1427
|
+
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
|
1428
|
+
*
|
|
1429
|
+
* @beta
|
|
1430
|
+
*/
|
|
1431
|
+
channels() {
|
|
1432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1433
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Get members from this bot installation.
|
|
1438
|
+
*
|
|
1439
|
+
* @remarks
|
|
1440
|
+
* Only work on server side.
|
|
1441
|
+
*
|
|
1442
|
+
* @returns an array of members from where the bot is installed.
|
|
1443
|
+
*
|
|
1444
|
+
* @beta
|
|
1445
|
+
*/
|
|
1446
|
+
members() {
|
|
1447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1448
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
// Copyright (c) Microsoft Corporation.
|
|
1454
|
+
/**
|
|
1455
|
+
* Provide static utilities for bot notification.
|
|
1456
|
+
*
|
|
1457
|
+
* @remarks
|
|
1458
|
+
* Only work on server side.
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* Here's an example on how to send notification via Teams Bot.
|
|
1462
|
+
* ```typescript
|
|
1463
|
+
* // initialize (it's recommended to be called before handling any bot message)
|
|
1464
|
+
* ConversationBot.initialize(adapter);
|
|
1465
|
+
*
|
|
1466
|
+
* // get all bot installations and send message
|
|
1467
|
+
* for (const target of await ConversationBot.installations()) {
|
|
1468
|
+
* await target.sendMessage("Hello Notification");
|
|
1469
|
+
* }
|
|
1470
|
+
*
|
|
1471
|
+
* // alternative - send message to all members
|
|
1472
|
+
* for (const target of await ConversationBot.installations()) {
|
|
1473
|
+
* for (const member of await target.members()) {
|
|
1474
|
+
* await member.sendMessage("Hello Notification");
|
|
1475
|
+
* }
|
|
1476
|
+
* }
|
|
1477
|
+
* ```
|
|
1478
|
+
*
|
|
1479
|
+
* @beta
|
|
1480
|
+
*/
|
|
1481
|
+
class ConversationBot {
|
|
1482
|
+
/**
|
|
1483
|
+
* Initialize bot notification.
|
|
1484
|
+
*
|
|
1485
|
+
* @remarks
|
|
1486
|
+
* Only work on server side.
|
|
1487
|
+
*
|
|
1488
|
+
* To ensure accuracy, it's recommended to initialize before handling any message.
|
|
1489
|
+
*
|
|
1490
|
+
* @param adapter - the bound `BotFrameworkAdapter`
|
|
1491
|
+
* @param options - initialize options
|
|
1492
|
+
*
|
|
1493
|
+
* @beta
|
|
1494
|
+
*/
|
|
1495
|
+
static initialize(adapter, options) {
|
|
1496
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Get all targets where the bot is installed.
|
|
1500
|
+
*
|
|
1501
|
+
* @remarks
|
|
1502
|
+
* Only work on server side.
|
|
1503
|
+
*
|
|
1504
|
+
* The result is retrieving from the persisted storage.
|
|
1505
|
+
*
|
|
1506
|
+
* @returns - an array of {@link TeamsBotInstallation}.
|
|
1507
|
+
*
|
|
1508
|
+
* @beta
|
|
1509
|
+
*/
|
|
1510
|
+
static installations() {
|
|
1511
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1512
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
ConversationBot.conversationReferenceStoreKey = "teamfx-notification-targets";
|
|
1517
|
+
|
|
1518
|
+
export { AppCredential, Channel, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
1199
1519
|
//# sourceMappingURL=index.esm5.js.map
|