@microsoft/teamsfx 0.6.2-alpha.83ce60286.0 → 0.6.2-alpha.b7cedce9e.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 CHANGED
@@ -243,14 +243,7 @@ connection.on("connect", (error) => {
243
243
  ### Use certificate-based authentication in Azure Function
244
244
 
245
245
  ```ts
246
- const authConfig = {
247
- clientId: process.env.M365_CLIENT_ID,
248
- certificateContent: "The content of a PEM-encoded public/private key certificate",
249
- authorityHost: process.env.M365_AUTHORITY_HOST,
250
- tenantId: process.env.M365_TENANT_ID,
251
- };
252
- const teamsfx = new TeamsFx(IdentityType.App);
253
- teamsfx.setCustomeConfig({
246
+ const teamsfx = new TeamsFx(IdentityType.App, {
254
247
  certificateContent: "The content of a PEM-encoded public/private key certificate"
255
248
  });
256
249
  const token = teamsfx.getCredential().getToken();
@@ -1170,5 +1170,361 @@ class TeamsFx {
1170
1170
  }
1171
1171
  }
1172
1172
 
1173
- export { AppCredential, ErrorCode, ErrorWithCode, IdentityType, LogLevel, MsGraphAuthProvider, OnBehalfOfUserCredential, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, setLogFunction, setLogLevel, setLogger };
1173
+ // Copyright (c) Microsoft Corporation.
1174
+ /**
1175
+ * Send a plain text message to a notification target.
1176
+ *
1177
+ * @remarks
1178
+ * Only work on server side.
1179
+ *
1180
+ * @param target - the notification target.
1181
+ * @param text - the plain text message.
1182
+ * @returns A `Promise` representing the asynchronous operation.
1183
+ *
1184
+ * @beta
1185
+ */
1186
+ function sendMessage(target, text) {
1187
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
1188
+ }
1189
+ /**
1190
+ * Send an adaptive card message to a notification target.
1191
+ *
1192
+ * @remarks
1193
+ * Only work on server side.
1194
+ *
1195
+ * @param target - the notification target.
1196
+ * @param card - the adaptive card raw JSON.
1197
+ * @returns A `Promise` representing the asynchronous operation.
1198
+ *
1199
+ * @beta
1200
+ */
1201
+ function sendAdaptiveCard(target, card) {
1202
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
1203
+ }
1204
+ /**
1205
+ * A {@link NotificationTarget} that represents a team channel.
1206
+ *
1207
+ * @remarks
1208
+ * Only work on server side.
1209
+ *
1210
+ * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
1211
+ *
1212
+ * @beta
1213
+ */
1214
+ class Channel {
1215
+ /**
1216
+ * Constuctor.
1217
+ *
1218
+ * @remarks
1219
+ * Only work on server side.
1220
+ *
1221
+ * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.
1222
+ *
1223
+ * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
1224
+ * @param info - Detailed channel information.
1225
+ *
1226
+ * @beta
1227
+ */
1228
+ constructor(parent, info) {
1229
+ /**
1230
+ * Notification target type. For channel it's always "Channel".
1231
+ *
1232
+ * @remarks
1233
+ * Only work on server side.
1234
+ *
1235
+ * @beta
1236
+ */
1237
+ this.type = "Channel";
1238
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1239
+ }
1240
+ /**
1241
+ * Send a plain text message.
1242
+ *
1243
+ * @remarks
1244
+ * Only work on server side.
1245
+ *
1246
+ * @param text - the plain text message.
1247
+ * @returns A `Promise` representing the asynchronous operation.
1248
+ *
1249
+ * @beta
1250
+ */
1251
+ sendMessage(text) {
1252
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1253
+ }
1254
+ /**
1255
+ * Send an adaptive card message.
1256
+ *
1257
+ * @remarks
1258
+ * Only work on server side.
1259
+ *
1260
+ * @param card - the adaptive card raw JSON.
1261
+ * @returns A `Promise` representing the asynchronous operation.
1262
+ *
1263
+ * @beta
1264
+ */
1265
+ async sendAdaptiveCard(card) {
1266
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1267
+ }
1268
+ }
1269
+ /**
1270
+ * A {@link NotificationTarget} that represents a team member.
1271
+ *
1272
+ * @remarks
1273
+ * Only work on server side.
1274
+ *
1275
+ * It's recommended to get members from {@link TeamsBotInstallation.members()}.
1276
+ *
1277
+ * @beta
1278
+ */
1279
+ class Member {
1280
+ /**
1281
+ * Constuctor.
1282
+ *
1283
+ * @remarks
1284
+ * Only work on server side.
1285
+ *
1286
+ * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.
1287
+ *
1288
+ * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
1289
+ * @param account - Detailed member account information.
1290
+ *
1291
+ * @beta
1292
+ */
1293
+ constructor(parent, account) {
1294
+ /**
1295
+ * Notification target type. For member it's always "Person".
1296
+ *
1297
+ * @remarks
1298
+ * Only work on server side.
1299
+ *
1300
+ * @beta
1301
+ */
1302
+ this.type = "Person";
1303
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1304
+ }
1305
+ /**
1306
+ * Send a plain text message.
1307
+ *
1308
+ * @remarks
1309
+ * Only work on server side.
1310
+ *
1311
+ * @param text - the plain text message.
1312
+ * @returns A `Promise` representing the asynchronous operation.
1313
+ *
1314
+ * @beta
1315
+ */
1316
+ sendMessage(text) {
1317
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1318
+ }
1319
+ /**
1320
+ * Send an adaptive card message.
1321
+ *
1322
+ * @remarks
1323
+ * Only work on server side.
1324
+ *
1325
+ * @param card - the adaptive card raw JSON.
1326
+ * @returns A `Promise` representing the asynchronous operation.
1327
+ *
1328
+ * @beta
1329
+ */
1330
+ async sendAdaptiveCard(card) {
1331
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1332
+ }
1333
+ }
1334
+ /**
1335
+ * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into
1336
+ * - Personal chat
1337
+ * - Group chat
1338
+ * - Team (by default the `General` channel)
1339
+ *
1340
+ * @remarks
1341
+ * Only work on server side.
1342
+ *
1343
+ * It's recommended to get bot installations from {@link ConversationBot.installations()}.
1344
+ *
1345
+ * @beta
1346
+ */
1347
+ class TeamsBotInstallation {
1348
+ /**
1349
+ * Constructor
1350
+ *
1351
+ * @remarks
1352
+ * Only work on server side.
1353
+ *
1354
+ * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.
1355
+ *
1356
+ * @param adapter - the bound `BotFrameworkAdapter`.
1357
+ * @param conversationReference - the bound `ConversationReference`.
1358
+ *
1359
+ * @beta
1360
+ */
1361
+ constructor(adapter, conversationReference) {
1362
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1363
+ }
1364
+ /**
1365
+ * Send a plain text message.
1366
+ *
1367
+ * @remarks
1368
+ * Only work on server side.
1369
+ *
1370
+ * @param text - the plain text message.
1371
+ * @returns A `Promise` representing the asynchronous operation.
1372
+ *
1373
+ * @beta
1374
+ */
1375
+ sendMessage(text) {
1376
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1377
+ }
1378
+ /**
1379
+ * Send an adaptive card message.
1380
+ *
1381
+ * @remarks
1382
+ * Only work on server side.
1383
+ *
1384
+ * @param card - the adaptive card raw JSON.
1385
+ * @returns A `Promise` representing the asynchronous operation.
1386
+ *
1387
+ * @beta
1388
+ */
1389
+ sendAdaptiveCard(card) {
1390
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1391
+ }
1392
+ /**
1393
+ * Get channels from this bot installation.
1394
+ *
1395
+ * @remarks
1396
+ * Only work on server side.
1397
+ *
1398
+ * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1399
+ *
1400
+ * @beta
1401
+ */
1402
+ async channels() {
1403
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1404
+ }
1405
+ /**
1406
+ * Get members from this bot installation.
1407
+ *
1408
+ * @remarks
1409
+ * Only work on server side.
1410
+ *
1411
+ * @returns an array of members from where the bot is installed.
1412
+ *
1413
+ * @beta
1414
+ */
1415
+ async members() {
1416
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1417
+ }
1418
+ }
1419
+ /**
1420
+ * Provide static utilities for bot notification.
1421
+ *
1422
+ * @remarks
1423
+ * Only work on server side.
1424
+ *
1425
+ * @example
1426
+ * Here's an example on how to send notification via Teams Bot.
1427
+ * ```typescript
1428
+ * // initialize (it's recommended to be called before handling any bot message)
1429
+ * const notificationBot = new NotificationBot(adapter);
1430
+ *
1431
+ * // get all bot installations and send message
1432
+ * for (const target of await notificationBot.installations()) {
1433
+ * await target.sendMessage("Hello Notification");
1434
+ * }
1435
+ *
1436
+ * // alternative - send message to all members
1437
+ * for (const target of await notificationBot.installations()) {
1438
+ * for (const member of await target.members()) {
1439
+ * await member.sendMessage("Hello Notification");
1440
+ * }
1441
+ * }
1442
+ * ```
1443
+ *
1444
+ * @beta
1445
+ */
1446
+ class NotificationBot {
1447
+ /**
1448
+ * constructor of the notification bot.
1449
+ *
1450
+ * @remarks
1451
+ * Only work on server side.
1452
+ *
1453
+ * To ensure accuracy, it's recommended to initialize before handling any message.
1454
+ *
1455
+ * @param adapter - the bound `BotFrameworkAdapter`
1456
+ * @param options - initialize options
1457
+ *
1458
+ * @beta
1459
+ */
1460
+ constructor(adapter, options) {
1461
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1462
+ }
1463
+ /**
1464
+ * Get all targets where the bot is installed.
1465
+ *
1466
+ * @remarks
1467
+ * Only work on server side.
1468
+ *
1469
+ * The result is retrieving from the persisted storage.
1470
+ *
1471
+ * @returns - an array of {@link TeamsBotInstallation}.
1472
+ *
1473
+ * @beta
1474
+ */
1475
+ static async installations() {
1476
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1477
+ }
1478
+ }
1479
+
1480
+ // Copyright (c) Microsoft Corporation.
1481
+ /**
1482
+ * A command bot for receiving commands and sending responses in Teams.
1483
+ *
1484
+ * @remarks
1485
+ * Only work on server side.
1486
+ *
1487
+ * @beta
1488
+ */
1489
+ class CommandBot {
1490
+ /**
1491
+ * Creates a new instance of the `CommandBot`.
1492
+ *
1493
+ * @param adapter The bound `BotFrameworkAdapter`.
1494
+ * @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.
1495
+ *
1496
+ * @beta
1497
+ */
1498
+ constructor(adapter, commands) {
1499
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1500
+ }
1501
+ /**
1502
+ * Registers a command into the command bot.
1503
+ *
1504
+ * @param command The command to registered.
1505
+ *
1506
+ * @remarks
1507
+ * Only work on server side.
1508
+ *
1509
+ * @beta
1510
+ */
1511
+ registerCommand(command) {
1512
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1513
+ }
1514
+ /**
1515
+ * Registers commands into the command bot.
1516
+ *
1517
+ * @param commands The command to registered.
1518
+ *
1519
+ * @remarks
1520
+ * Only work on server side.
1521
+ *
1522
+ * @beta
1523
+ */
1524
+ registerCommands(commands) {
1525
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandnBot"), ErrorCode.RuntimeNotSupported);
1526
+ }
1527
+ }
1528
+
1529
+ export { AppCredential, Channel, CommandBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1174
1530
  //# sourceMappingURL=index.esm2017.js.map