@microsoft/teamsfx 1.0.3-alpha.d3b2c316c.0 → 1.0.3-alpha.dad1471c2.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.
@@ -1881,6 +1881,32 @@ class TeamsFx {
1881
1881
 
1882
1882
  // Copyright (c) Microsoft Corporation.
1883
1883
  // Licensed under the MIT license.
1884
+ /**
1885
+ * The target type where the notification will be sent to.
1886
+ *
1887
+ * @remarks
1888
+ * - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
1889
+ * - "Group" means to a group chat.
1890
+ * - "Person" means to a personal chat.
1891
+ */
1892
+ exports.NotificationTargetType = void 0;
1893
+ (function (NotificationTargetType) {
1894
+ /**
1895
+ * The notification will be sent to a team channel.
1896
+ * (By default, notification to a team will be sent to its "General" channel.)
1897
+ */
1898
+ NotificationTargetType["Channel"] = "Channel";
1899
+ /**
1900
+ * The notification will be sent to a group chat.
1901
+ */
1902
+ NotificationTargetType["Group"] = "Group";
1903
+ /**
1904
+ * The notification will be sent to a personal chat.
1905
+ */
1906
+ NotificationTargetType["Person"] = "Person";
1907
+ })(exports.NotificationTargetType || (exports.NotificationTargetType = {}));
1908
+
1909
+ // Copyright (c) Microsoft Corporation.
1884
1910
  /**
1885
1911
  * @internal
1886
1912
  */
@@ -1894,13 +1920,13 @@ function getTargetType(conversationReference) {
1894
1920
  var _a;
1895
1921
  const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
1896
1922
  if (conversationType === "personal") {
1897
- return "Person";
1923
+ return exports.NotificationTargetType.Person;
1898
1924
  }
1899
1925
  else if (conversationType === "groupChat") {
1900
- return "Group";
1926
+ return exports.NotificationTargetType.Group;
1901
1927
  }
1902
1928
  else if (conversationType === "channel") {
1903
- return "Channel";
1929
+ return exports.NotificationTargetType.Channel;
1904
1930
  }
1905
1931
  else {
1906
1932
  return undefined;
@@ -2256,7 +2282,7 @@ class ConversationReferenceStore {
2256
2282
  *
2257
2283
  * @param target - the notification target.
2258
2284
  * @param text - the plain text message.
2259
- * @returns A `Promise` representing the asynchronous operation.
2285
+ * @returns the response of sending message.
2260
2286
  */
2261
2287
  function sendMessage(target, text) {
2262
2288
  return target.sendMessage(text);
@@ -2266,7 +2292,7 @@ function sendMessage(target, text) {
2266
2292
  *
2267
2293
  * @param target - the notification target.
2268
2294
  * @param card - the adaptive card raw JSON.
2269
- * @returns A `Promise` representing the asynchronous operation.
2295
+ * @returns the response of sending adaptive card message.
2270
2296
  */
2271
2297
  function sendAdaptiveCard(target, card) {
2272
2298
  return target.sendAdaptiveCard(card);
@@ -2291,7 +2317,7 @@ class Channel {
2291
2317
  /**
2292
2318
  * Notification target type. For channel it's always "Channel".
2293
2319
  */
2294
- this.type = "Channel";
2320
+ this.type = exports.NotificationTargetType.Channel;
2295
2321
  this.parent = parent;
2296
2322
  this.info = info;
2297
2323
  }
@@ -2299,32 +2325,40 @@ class Channel {
2299
2325
  * Send a plain text message.
2300
2326
  *
2301
2327
  * @param text - the plain text message.
2302
- * @returns A `Promise` representing the asynchronous operation.
2328
+ * @returns the response of sending message.
2303
2329
  */
2304
2330
  sendMessage(text) {
2305
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2306
- const conversation = yield this.newConversation(context);
2307
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2308
- yield ctx.sendActivity(text);
2331
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2332
+ const response = {};
2333
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2334
+ const conversation = yield this.newConversation(context);
2335
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2336
+ const res = yield ctx.sendActivity(text);
2337
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2338
+ }));
2309
2339
  }));
2310
- }));
2340
+ return response;
2341
+ });
2311
2342
  }
2312
2343
  /**
2313
2344
  * Send an adaptive card message.
2314
2345
  *
2315
2346
  * @param card - the adaptive card raw JSON.
2316
- * @returns A `Promise` representing the asynchronous operation.
2347
+ * @returns the response of sending adaptive card message.
2317
2348
  */
2318
2349
  sendAdaptiveCard(card) {
2319
2350
  return tslib.__awaiter(this, void 0, void 0, function* () {
2320
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2351
+ const response = {};
2352
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2321
2353
  const conversation = yield this.newConversation(context);
2322
2354
  yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2323
- yield ctx.sendActivity({
2355
+ const res = yield ctx.sendActivity({
2324
2356
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2325
2357
  });
2358
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2326
2359
  }));
2327
2360
  }));
2361
+ return response;
2328
2362
  });
2329
2363
  }
2330
2364
  /**
@@ -2359,7 +2393,7 @@ class Member {
2359
2393
  /**
2360
2394
  * Notification target type. For member it's always "Person".
2361
2395
  */
2362
- this.type = "Person";
2396
+ this.type = exports.NotificationTargetType.Person;
2363
2397
  this.parent = parent;
2364
2398
  this.account = account;
2365
2399
  }
@@ -2367,32 +2401,40 @@ class Member {
2367
2401
  * Send a plain text message.
2368
2402
  *
2369
2403
  * @param text - the plain text message.
2370
- * @returns A `Promise` representing the asynchronous operation.
2404
+ * @returns the response of sending message.
2371
2405
  */
2372
2406
  sendMessage(text) {
2373
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2374
- const conversation = yield this.newConversation(context);
2375
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2376
- yield ctx.sendActivity(text);
2407
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2408
+ const response = {};
2409
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2410
+ const conversation = yield this.newConversation(context);
2411
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2412
+ const res = yield ctx.sendActivity(text);
2413
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2414
+ }));
2377
2415
  }));
2378
- }));
2416
+ return response;
2417
+ });
2379
2418
  }
2380
2419
  /**
2381
2420
  * Send an adaptive card message.
2382
2421
  *
2383
2422
  * @param card - the adaptive card raw JSON.
2384
- * @returns A `Promise` representing the asynchronous operation.
2423
+ * @returns the response of sending adaptive card message.
2385
2424
  */
2386
2425
  sendAdaptiveCard(card) {
2387
2426
  return tslib.__awaiter(this, void 0, void 0, function* () {
2388
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2427
+ const response = {};
2428
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2389
2429
  const conversation = yield this.newConversation(context);
2390
2430
  yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2391
- yield ctx.sendActivity({
2431
+ const res = yield ctx.sendActivity({
2392
2432
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2393
2433
  });
2434
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2394
2435
  }));
2395
2436
  }));
2437
+ return response;
2396
2438
  });
2397
2439
  }
2398
2440
  /**
@@ -2443,25 +2485,35 @@ class TeamsBotInstallation {
2443
2485
  * Send a plain text message.
2444
2486
  *
2445
2487
  * @param text - the plain text message.
2446
- * @returns A `Promise` representing the asynchronous operation.
2488
+ * @returns the response of sending message.
2447
2489
  */
2448
2490
  sendMessage(text) {
2449
- return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2450
- yield context.sendActivity(text);
2451
- }));
2491
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2492
+ const response = {};
2493
+ yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2494
+ const res = yield context.sendActivity(text);
2495
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2496
+ }));
2497
+ return response;
2498
+ });
2452
2499
  }
2453
2500
  /**
2454
2501
  * Send an adaptive card message.
2455
2502
  *
2456
2503
  * @param card - the adaptive card raw JSON.
2457
- * @returns A `Promise` representing the asynchronous operation.
2504
+ * @returns the response of sending adaptive card message.
2458
2505
  */
2459
2506
  sendAdaptiveCard(card) {
2460
- return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2461
- yield context.sendActivity({
2462
- attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2463
- });
2464
- }));
2507
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2508
+ const response = {};
2509
+ yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2510
+ const res = yield context.sendActivity({
2511
+ attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2512
+ });
2513
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2514
+ }));
2515
+ return response;
2516
+ });
2465
2517
  }
2466
2518
  /**
2467
2519
  * Get channels from this bot installation.