@microsoft/teamsfx 0.6.2-alpha.3bbacb98c.0 → 0.6.2-alpha.6de687a73.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,315 @@ 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
+ // Copyright (c) Microsoft Corporation.
1421
+ /**
1422
+ * Provide static utilities for bot notification.
1423
+ *
1424
+ * @remarks
1425
+ * Only work on server side.
1426
+ *
1427
+ * @example
1428
+ * Here's an example on how to send notification via Teams Bot.
1429
+ * ```typescript
1430
+ * // initialize (it's recommended to be called before handling any bot message)
1431
+ * ConversationBot.initialize(adapter);
1432
+ *
1433
+ * // get all bot installations and send message
1434
+ * for (const target of await ConversationBot.installations()) {
1435
+ * await target.sendMessage("Hello Notification");
1436
+ * }
1437
+ *
1438
+ * // alternative - send message to all members
1439
+ * for (const target of await ConversationBot.installations()) {
1440
+ * for (const member of await target.members()) {
1441
+ * await member.sendMessage("Hello Notification");
1442
+ * }
1443
+ * }
1444
+ * ```
1445
+ *
1446
+ * @beta
1447
+ */
1448
+ class ConversationBot {
1449
+ /**
1450
+ * Initialize bot notification.
1451
+ *
1452
+ * @remarks
1453
+ * Only work on server side.
1454
+ *
1455
+ * To ensure accuracy, it's recommended to initialize before handling any message.
1456
+ *
1457
+ * @param adapter - the bound `BotFrameworkAdapter`
1458
+ * @param options - initialize options
1459
+ *
1460
+ * @beta
1461
+ */
1462
+ static initialize(adapter, options) {
1463
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1464
+ }
1465
+ /**
1466
+ * Get all targets where the bot is installed.
1467
+ *
1468
+ * @remarks
1469
+ * Only work on server side.
1470
+ *
1471
+ * The result is retrieving from the persisted storage.
1472
+ *
1473
+ * @returns - an array of {@link TeamsBotInstallation}.
1474
+ *
1475
+ * @beta
1476
+ */
1477
+ static async installations() {
1478
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1479
+ }
1480
+ }
1481
+ ConversationBot.conversationReferenceStoreKey = "teamfx-notification-targets";
1482
+
1483
+ export { AppCredential, Channel, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createMicrosoftGraphClient, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1174
1484
  //# sourceMappingURL=index.esm2017.js.map