@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.
@@ -1815,6 +1815,32 @@ class TeamsFx {
1815
1815
 
1816
1816
  // Copyright (c) Microsoft Corporation.
1817
1817
  // Licensed under the MIT license.
1818
+ /**
1819
+ * The target type where the notification will be sent to.
1820
+ *
1821
+ * @remarks
1822
+ * - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
1823
+ * - "Group" means to a group chat.
1824
+ * - "Person" means to a personal chat.
1825
+ */
1826
+ var NotificationTargetType;
1827
+ (function (NotificationTargetType) {
1828
+ /**
1829
+ * The notification will be sent to a team channel.
1830
+ * (By default, notification to a team will be sent to its "General" channel.)
1831
+ */
1832
+ NotificationTargetType["Channel"] = "Channel";
1833
+ /**
1834
+ * The notification will be sent to a group chat.
1835
+ */
1836
+ NotificationTargetType["Group"] = "Group";
1837
+ /**
1838
+ * The notification will be sent to a personal chat.
1839
+ */
1840
+ NotificationTargetType["Person"] = "Person";
1841
+ })(NotificationTargetType || (NotificationTargetType = {}));
1842
+
1843
+ // Copyright (c) Microsoft Corporation.
1818
1844
  /**
1819
1845
  * @internal
1820
1846
  */
@@ -1828,13 +1854,13 @@ function getTargetType(conversationReference) {
1828
1854
  var _a;
1829
1855
  const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
1830
1856
  if (conversationType === "personal") {
1831
- return "Person";
1857
+ return NotificationTargetType.Person;
1832
1858
  }
1833
1859
  else if (conversationType === "groupChat") {
1834
- return "Group";
1860
+ return NotificationTargetType.Group;
1835
1861
  }
1836
1862
  else if (conversationType === "channel") {
1837
- return "Channel";
1863
+ return NotificationTargetType.Channel;
1838
1864
  }
1839
1865
  else {
1840
1866
  return undefined;
@@ -2172,7 +2198,7 @@ class ConversationReferenceStore {
2172
2198
  *
2173
2199
  * @param target - the notification target.
2174
2200
  * @param text - the plain text message.
2175
- * @returns A `Promise` representing the asynchronous operation.
2201
+ * @returns the response of sending message.
2176
2202
  */
2177
2203
  function sendMessage(target, text) {
2178
2204
  return target.sendMessage(text);
@@ -2182,7 +2208,7 @@ function sendMessage(target, text) {
2182
2208
  *
2183
2209
  * @param target - the notification target.
2184
2210
  * @param card - the adaptive card raw JSON.
2185
- * @returns A `Promise` representing the asynchronous operation.
2211
+ * @returns the response of sending adaptive card message.
2186
2212
  */
2187
2213
  function sendAdaptiveCard(target, card) {
2188
2214
  return target.sendAdaptiveCard(card);
@@ -2207,7 +2233,7 @@ class Channel {
2207
2233
  /**
2208
2234
  * Notification target type. For channel it's always "Channel".
2209
2235
  */
2210
- this.type = "Channel";
2236
+ this.type = NotificationTargetType.Channel;
2211
2237
  this.parent = parent;
2212
2238
  this.info = info;
2213
2239
  }
@@ -2215,31 +2241,37 @@ class Channel {
2215
2241
  * Send a plain text message.
2216
2242
  *
2217
2243
  * @param text - the plain text message.
2218
- * @returns A `Promise` representing the asynchronous operation.
2244
+ * @returns the response of sending message.
2219
2245
  */
2220
- sendMessage(text) {
2221
- return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2246
+ async sendMessage(text) {
2247
+ const response = {};
2248
+ await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2222
2249
  const conversation = await this.newConversation(context);
2223
2250
  await this.parent.adapter.continueConversation(conversation, async (ctx) => {
2224
- await ctx.sendActivity(text);
2251
+ const res = await ctx.sendActivity(text);
2252
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2225
2253
  });
2226
2254
  });
2255
+ return response;
2227
2256
  }
2228
2257
  /**
2229
2258
  * Send an adaptive card message.
2230
2259
  *
2231
2260
  * @param card - the adaptive card raw JSON.
2232
- * @returns A `Promise` representing the asynchronous operation.
2261
+ * @returns the response of sending adaptive card message.
2233
2262
  */
2234
2263
  async sendAdaptiveCard(card) {
2235
- return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2264
+ const response = {};
2265
+ await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2236
2266
  const conversation = await this.newConversation(context);
2237
2267
  await this.parent.adapter.continueConversation(conversation, async (ctx) => {
2238
- await ctx.sendActivity({
2268
+ const res = await ctx.sendActivity({
2239
2269
  attachments: [CardFactory.adaptiveCard(card)],
2240
2270
  });
2271
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2241
2272
  });
2242
2273
  });
2274
+ return response;
2243
2275
  }
2244
2276
  /**
2245
2277
  * @internal
@@ -2271,7 +2303,7 @@ class Member {
2271
2303
  /**
2272
2304
  * Notification target type. For member it's always "Person".
2273
2305
  */
2274
- this.type = "Person";
2306
+ this.type = NotificationTargetType.Person;
2275
2307
  this.parent = parent;
2276
2308
  this.account = account;
2277
2309
  }
@@ -2279,31 +2311,37 @@ class Member {
2279
2311
  * Send a plain text message.
2280
2312
  *
2281
2313
  * @param text - the plain text message.
2282
- * @returns A `Promise` representing the asynchronous operation.
2314
+ * @returns the response of sending message.
2283
2315
  */
2284
- sendMessage(text) {
2285
- return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2316
+ async sendMessage(text) {
2317
+ const response = {};
2318
+ await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2286
2319
  const conversation = await this.newConversation(context);
2287
2320
  await this.parent.adapter.continueConversation(conversation, async (ctx) => {
2288
- await ctx.sendActivity(text);
2321
+ const res = await ctx.sendActivity(text);
2322
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2289
2323
  });
2290
2324
  });
2325
+ return response;
2291
2326
  }
2292
2327
  /**
2293
2328
  * Send an adaptive card message.
2294
2329
  *
2295
2330
  * @param card - the adaptive card raw JSON.
2296
- * @returns A `Promise` representing the asynchronous operation.
2331
+ * @returns the response of sending adaptive card message.
2297
2332
  */
2298
2333
  async sendAdaptiveCard(card) {
2299
- return this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2334
+ const response = {};
2335
+ await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
2300
2336
  const conversation = await this.newConversation(context);
2301
2337
  await this.parent.adapter.continueConversation(conversation, async (ctx) => {
2302
- await ctx.sendActivity({
2338
+ const res = await ctx.sendActivity({
2303
2339
  attachments: [CardFactory.adaptiveCard(card)],
2304
2340
  });
2341
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2305
2342
  });
2306
2343
  });
2344
+ return response;
2307
2345
  }
2308
2346
  /**
2309
2347
  * @internal
@@ -2351,25 +2389,31 @@ class TeamsBotInstallation {
2351
2389
  * Send a plain text message.
2352
2390
  *
2353
2391
  * @param text - the plain text message.
2354
- * @returns A `Promise` representing the asynchronous operation.
2392
+ * @returns the response of sending message.
2355
2393
  */
2356
- sendMessage(text) {
2357
- return this.adapter.continueConversation(this.conversationReference, async (context) => {
2358
- await context.sendActivity(text);
2394
+ async sendMessage(text) {
2395
+ const response = {};
2396
+ await this.adapter.continueConversation(this.conversationReference, async (context) => {
2397
+ const res = await context.sendActivity(text);
2398
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2359
2399
  });
2400
+ return response;
2360
2401
  }
2361
2402
  /**
2362
2403
  * Send an adaptive card message.
2363
2404
  *
2364
2405
  * @param card - the adaptive card raw JSON.
2365
- * @returns A `Promise` representing the asynchronous operation.
2406
+ * @returns the response of sending adaptive card message.
2366
2407
  */
2367
- sendAdaptiveCard(card) {
2368
- return this.adapter.continueConversation(this.conversationReference, async (context) => {
2369
- await context.sendActivity({
2408
+ async sendAdaptiveCard(card) {
2409
+ const response = {};
2410
+ await this.adapter.continueConversation(this.conversationReference, async (context) => {
2411
+ const res = await context.sendActivity({
2370
2412
  attachments: [CardFactory.adaptiveCard(card)],
2371
2413
  });
2414
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2372
2415
  });
2416
+ return response;
2373
2417
  }
2374
2418
  /**
2375
2419
  * Get channels from this bot installation.
@@ -2731,5 +2775,5 @@ class MessageBuilder {
2731
2775
  }
2732
2776
  }
2733
2777
 
2734
- export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
2778
+ export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
2735
2779
  //# sourceMappingURL=index.esm2017.mjs.map