@microsoft/teamsfx 2.3.1-alpha.c54ce47b1.0 → 2.3.1-alpha.c901e3860.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.
@@ -8,8 +8,8 @@ import { Dialog, ComponentDialog, WaterfallDialog, DialogSet, DialogTurnStatus }
8
8
  import { v4 } from 'uuid';
9
9
  import axios from 'axios';
10
10
  import { Agent } from 'https';
11
- import * as path from 'path';
12
- import * as fs from 'fs';
11
+ import { resolve } from 'path';
12
+ import { access, readFile, writeFile } from 'fs';
13
13
  import { AdaptiveCards } from '@microsoft/adaptivecards-tools';
14
14
 
15
15
  // Copyright (c) Microsoft Corporation.
@@ -1475,7 +1475,7 @@ function createApiClient(apiEndpoint, authProvider) {
1475
1475
  baseURL: apiEndpoint,
1476
1476
  });
1477
1477
  instance.interceptors.request.use(async function (config) {
1478
- return await authProvider.AddAuthenticationInfo(config);
1478
+ return (await authProvider.AddAuthenticationInfo(config));
1479
1479
  });
1480
1480
  return instance;
1481
1481
  }
@@ -2535,7 +2535,7 @@ class NotificationMiddleware {
2535
2535
  return ActivityType.Unknown;
2536
2536
  }
2537
2537
  async tryAddMessagedReference(context) {
2538
- var _a, _b, _c, _d;
2538
+ var _a, _b, _c, _d, _e, _f;
2539
2539
  const reference = TurnContext.getConversationReference(context.activity);
2540
2540
  const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
2541
2541
  if (conversationType === "personal" || conversationType === "groupChat") {
@@ -2543,7 +2543,9 @@ class NotificationMiddleware {
2543
2543
  }
2544
2544
  else if (conversationType === "channel") {
2545
2545
  const teamId = (_d = (_c = (_b = context.activity) === null || _b === void 0 ? void 0 : _b.channelData) === null || _c === void 0 ? void 0 : _c.team) === null || _d === void 0 ? void 0 : _d.id;
2546
- if (teamId !== undefined) {
2546
+ const channelId = (_f = (_e = context.activity.channelData) === null || _e === void 0 ? void 0 : _e.channel) === null || _f === void 0 ? void 0 : _f.id;
2547
+ // `teamId === channelId` means General channel. Ignore messaging in non-General channel.
2548
+ if (teamId !== undefined && (channelId === undefined || teamId === channelId)) {
2547
2549
  const teamReference = cloneConversation(reference);
2548
2550
  teamReference.conversation.id = teamId;
2549
2551
  await this.conversationReferenceStore.add(getKey(teamReference), teamReference, {
@@ -2560,8 +2562,9 @@ class NotificationMiddleware {
2560
2562
  */
2561
2563
  class LocalFileStorage {
2562
2564
  constructor(fileDir) {
2563
- this.localFileName = ".notification.localstore.json";
2564
- this.filePath = path.resolve(fileDir, this.localFileName);
2565
+ var _a;
2566
+ this.localFileName = (_a = process.env.TEAMSFX_NOTIFICATION_STORE_FILENAME) !== null && _a !== void 0 ? _a : ".notification.localstore.json";
2567
+ this.filePath = resolve(fileDir, this.localFileName);
2565
2568
  }
2566
2569
  async read(key) {
2567
2570
  if (!(await this.storeFileExists())) {
@@ -2597,7 +2600,7 @@ class LocalFileStorage {
2597
2600
  storeFileExists() {
2598
2601
  return new Promise((resolve) => {
2599
2602
  try {
2600
- fs.access(this.filePath, (err) => {
2603
+ access(this.filePath, (err) => {
2601
2604
  if (err) {
2602
2605
  resolve(false);
2603
2606
  }
@@ -2614,7 +2617,7 @@ class LocalFileStorage {
2614
2617
  readFromFile() {
2615
2618
  return new Promise((resolve, reject) => {
2616
2619
  try {
2617
- fs.readFile(this.filePath, { encoding: "utf-8" }, (err, rawData) => {
2620
+ readFile(this.filePath, { encoding: "utf-8" }, (err, rawData) => {
2618
2621
  if (err) {
2619
2622
  reject(err);
2620
2623
  }
@@ -2632,7 +2635,7 @@ class LocalFileStorage {
2632
2635
  return new Promise((resolve, reject) => {
2633
2636
  try {
2634
2637
  const rawData = JSON.stringify(data, undefined, 2);
2635
- fs.writeFile(this.filePath, rawData, { encoding: "utf-8" }, (err) => {
2638
+ writeFile(this.filePath, rawData, { encoding: "utf-8" }, (err) => {
2636
2639
  if (err) {
2637
2640
  reject(err);
2638
2641
  }
@@ -3063,7 +3066,7 @@ class NotificationBot$1 {
3063
3066
  */
3064
3067
  constructor(adapter, options) {
3065
3068
  var _a, _b;
3066
- const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(path.resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
3069
+ const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
3067
3070
  this.conversationReferenceStore = new DefaultConversationReferenceStore(storage);
3068
3071
  this.adapter = adapter.use(new NotificationMiddleware({
3069
3072
  conversationReferenceStore: this.conversationReferenceStore,
@@ -3224,7 +3227,7 @@ var SearchScope$1;
3224
3227
  SearchScope[SearchScope["All"] = 7] = "All";
3225
3228
  })(SearchScope$1 || (SearchScope$1 = {}));
3226
3229
 
3227
- /******************************************************************************
3230
+ /*! *****************************************************************************
3228
3231
  Copyright (c) Microsoft Corporation.
3229
3232
 
3230
3233
  Permission to use, copy, modify, and/or distribute this software for any
@@ -3249,12 +3252,7 @@ function __rest(s, e) {
3249
3252
  t[p[i]] = s[p[i]];
3250
3253
  }
3251
3254
  return t;
3252
- }
3253
-
3254
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3255
- var e = new Error(message);
3256
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3257
- };
3255
+ }
3258
3256
 
3259
3257
  // Copyright (c) Microsoft Corporation.
3260
3258
  let DIALOG_NAME = "BotSsoExecutionDialog";
@@ -4661,7 +4659,7 @@ class NotificationBot {
4661
4659
  this.conversationReferenceStore = options.store;
4662
4660
  }
4663
4661
  else {
4664
- const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(path.resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
4662
+ const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
4665
4663
  this.conversationReferenceStore = new DefaultConversationReferenceStore(storage);
4666
4664
  }
4667
4665
  this.adapter = adapter.use(new NotificationMiddleware({