@microsoft/teamsfx 0.6.2-alpha.26caa3d10.0 → 0.6.2-alpha.5ae1b0229.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 +357 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +872 -2
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +367 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +928 -0
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +4 -3
- package/types/teamsfx.d.ts +611 -0
package/dist/index.esm5.js
CHANGED
|
@@ -1195,5 +1195,371 @@ 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
|
+
* Provide static utilities for bot notification.
|
|
1454
|
+
*
|
|
1455
|
+
* @remarks
|
|
1456
|
+
* Only work on server side.
|
|
1457
|
+
*
|
|
1458
|
+
* @example
|
|
1459
|
+
* Here's an example on how to send notification via Teams Bot.
|
|
1460
|
+
* ```typescript
|
|
1461
|
+
* // initialize (it's recommended to be called before handling any bot message)
|
|
1462
|
+
* const notificationBot = new NotificationBot(adapter);
|
|
1463
|
+
*
|
|
1464
|
+
* // get all bot installations and send message
|
|
1465
|
+
* for (const target of await notificationBot.installations()) {
|
|
1466
|
+
* await target.sendMessage("Hello Notification");
|
|
1467
|
+
* }
|
|
1468
|
+
*
|
|
1469
|
+
* // alternative - send message to all members
|
|
1470
|
+
* for (const target of await notificationBot.installations()) {
|
|
1471
|
+
* for (const member of await target.members()) {
|
|
1472
|
+
* await member.sendMessage("Hello Notification");
|
|
1473
|
+
* }
|
|
1474
|
+
* }
|
|
1475
|
+
* ```
|
|
1476
|
+
*
|
|
1477
|
+
* @beta
|
|
1478
|
+
*/
|
|
1479
|
+
class NotificationBot {
|
|
1480
|
+
/**
|
|
1481
|
+
* constructor of the notification bot.
|
|
1482
|
+
*
|
|
1483
|
+
* @remarks
|
|
1484
|
+
* Only work on server side.
|
|
1485
|
+
*
|
|
1486
|
+
* To ensure accuracy, it's recommended to initialize before handling any message.
|
|
1487
|
+
*
|
|
1488
|
+
* @param adapter - the bound `BotFrameworkAdapter`
|
|
1489
|
+
* @param options - initialize options
|
|
1490
|
+
*
|
|
1491
|
+
* @beta
|
|
1492
|
+
*/
|
|
1493
|
+
constructor(adapter, options) {
|
|
1494
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Get all targets where the bot is installed.
|
|
1498
|
+
*
|
|
1499
|
+
* @remarks
|
|
1500
|
+
* Only work on server side.
|
|
1501
|
+
*
|
|
1502
|
+
* The result is retrieving from the persisted storage.
|
|
1503
|
+
*
|
|
1504
|
+
* @returns - an array of {@link TeamsBotInstallation}.
|
|
1505
|
+
*
|
|
1506
|
+
* @beta
|
|
1507
|
+
*/
|
|
1508
|
+
static installations() {
|
|
1509
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1510
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// Copyright (c) Microsoft Corporation.
|
|
1516
|
+
/**
|
|
1517
|
+
* A command bot for receiving commands and sending responses in Teams.
|
|
1518
|
+
*
|
|
1519
|
+
* @remarks
|
|
1520
|
+
* Only work on server side.
|
|
1521
|
+
*
|
|
1522
|
+
* @beta
|
|
1523
|
+
*/
|
|
1524
|
+
class CommandBot {
|
|
1525
|
+
/**
|
|
1526
|
+
* Creates a new instance of the `CommandBot`.
|
|
1527
|
+
*
|
|
1528
|
+
* @param adapter The bound `BotFrameworkAdapter`.
|
|
1529
|
+
* @param commands The commands to registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.
|
|
1530
|
+
*
|
|
1531
|
+
* @beta
|
|
1532
|
+
*/
|
|
1533
|
+
constructor(adapter, commands) {
|
|
1534
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Registers a command into the command bot.
|
|
1538
|
+
*
|
|
1539
|
+
* @param command The command to registered.
|
|
1540
|
+
*
|
|
1541
|
+
* @remarks
|
|
1542
|
+
* Only work on server side.
|
|
1543
|
+
*
|
|
1544
|
+
* @beta
|
|
1545
|
+
*/
|
|
1546
|
+
registerCommand(command) {
|
|
1547
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Registers commands into the command bot.
|
|
1551
|
+
*
|
|
1552
|
+
* @param commands The command to registered.
|
|
1553
|
+
*
|
|
1554
|
+
* @remarks
|
|
1555
|
+
* Only work on server side.
|
|
1556
|
+
*
|
|
1557
|
+
* @beta
|
|
1558
|
+
*/
|
|
1559
|
+
registerCommands(commands) {
|
|
1560
|
+
throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandnBot"), ErrorCode.RuntimeNotSupported);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
export { AppCredential, Channel, CommandBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
1199
1565
|
//# sourceMappingURL=index.esm5.js.map
|