@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.
@@ -18,28 +18,8 @@ var adaptivecardsTools = require('@microsoft/adaptivecards-tools');
18
18
 
19
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
20
 
21
- function _interopNamespace(e) {
22
- if (e && e.__esModule) return e;
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- if (k !== 'default') {
27
- var d = Object.getOwnPropertyDescriptor(e, k);
28
- Object.defineProperty(n, k, d.get ? d : {
29
- enumerable: true,
30
- get: function () { return e[k]; }
31
- });
32
- }
33
- });
34
- }
35
- n["default"] = e;
36
- return Object.freeze(n);
37
- }
38
-
39
21
  var jwt_decode__default = /*#__PURE__*/_interopDefaultLegacy(jwt_decode);
40
22
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
41
- var path__namespace = /*#__PURE__*/_interopNamespace(path);
42
- var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
43
23
 
44
24
  // Copyright (c) Microsoft Corporation.
45
25
  // Licensed under the MIT license.
@@ -190,7 +170,7 @@ class ErrorWithCode extends Error {
190
170
  }
191
171
  }
192
172
 
193
- /******************************************************************************
173
+ /*! *****************************************************************************
194
174
  Copyright (c) Microsoft Corporation.
195
175
 
196
176
  Permission to use, copy, modify, and/or distribute this software for any
@@ -225,12 +205,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
225
205
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
226
206
  step((generator = generator.apply(thisArg, _arguments || [])).next());
227
207
  });
228
- }
229
-
230
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
231
- var e = new Error(message);
232
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
233
- };
208
+ }
234
209
 
235
210
  // Copyright (c) Microsoft Corporation.
236
211
  // Licensed under the MIT license.
@@ -376,7 +351,7 @@ function setLogFunction(logFunction) {
376
351
  */
377
352
  function parseJwt(token) {
378
353
  try {
379
- const tokenObj = jwt_decode__default["default"](token);
354
+ const tokenObj = jwt_decode__default['default'](token);
380
355
  if (!tokenObj || !tokenObj.exp) {
381
356
  throw new ErrorWithCode("Decoded token is null or exp claim does not exists.", exports.ErrorCode.InternalError);
382
357
  }
@@ -1560,12 +1535,12 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
1560
1535
  */
1561
1536
  function createApiClient(apiEndpoint, authProvider) {
1562
1537
  // Add a request interceptor
1563
- const instance = axios__default["default"].create({
1538
+ const instance = axios__default['default'].create({
1564
1539
  baseURL: apiEndpoint,
1565
1540
  });
1566
1541
  instance.interceptors.request.use(function (config) {
1567
1542
  return __awaiter(this, void 0, void 0, function* () {
1568
- return yield authProvider.AddAuthenticationInfo(config);
1543
+ return (yield authProvider.AddAuthenticationInfo(config));
1569
1544
  });
1570
1545
  });
1571
1546
  return instance;
@@ -2642,7 +2617,7 @@ class NotificationMiddleware {
2642
2617
  return ActivityType.Unknown;
2643
2618
  }
2644
2619
  tryAddMessagedReference(context) {
2645
- var _a, _b, _c, _d;
2620
+ var _a, _b, _c, _d, _e, _f;
2646
2621
  return __awaiter(this, void 0, void 0, function* () {
2647
2622
  const reference = botbuilder.TurnContext.getConversationReference(context.activity);
2648
2623
  const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
@@ -2651,7 +2626,9 @@ class NotificationMiddleware {
2651
2626
  }
2652
2627
  else if (conversationType === "channel") {
2653
2628
  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;
2654
- if (teamId !== undefined) {
2629
+ const channelId = (_f = (_e = context.activity.channelData) === null || _e === void 0 ? void 0 : _e.channel) === null || _f === void 0 ? void 0 : _f.id;
2630
+ // `teamId === channelId` means General channel. Ignore messaging in non-General channel.
2631
+ if (teamId !== undefined && (channelId === undefined || teamId === channelId)) {
2655
2632
  const teamReference = cloneConversation(reference);
2656
2633
  teamReference.conversation.id = teamId;
2657
2634
  yield this.conversationReferenceStore.add(getKey(teamReference), teamReference, {
@@ -2669,8 +2646,9 @@ class NotificationMiddleware {
2669
2646
  */
2670
2647
  class LocalFileStorage {
2671
2648
  constructor(fileDir) {
2672
- this.localFileName = ".notification.localstore.json";
2673
- this.filePath = path__namespace.resolve(fileDir, this.localFileName);
2649
+ var _a;
2650
+ this.localFileName = (_a = process.env.TEAMSFX_NOTIFICATION_STORE_FILENAME) !== null && _a !== void 0 ? _a : ".notification.localstore.json";
2651
+ this.filePath = path.resolve(fileDir, this.localFileName);
2674
2652
  }
2675
2653
  read(key) {
2676
2654
  return __awaiter(this, void 0, void 0, function* () {
@@ -2714,7 +2692,7 @@ class LocalFileStorage {
2714
2692
  storeFileExists() {
2715
2693
  return new Promise((resolve) => {
2716
2694
  try {
2717
- fs__namespace.access(this.filePath, (err) => {
2695
+ fs.access(this.filePath, (err) => {
2718
2696
  if (err) {
2719
2697
  resolve(false);
2720
2698
  }
@@ -2731,7 +2709,7 @@ class LocalFileStorage {
2731
2709
  readFromFile() {
2732
2710
  return new Promise((resolve, reject) => {
2733
2711
  try {
2734
- fs__namespace.readFile(this.filePath, { encoding: "utf-8" }, (err, rawData) => {
2712
+ fs.readFile(this.filePath, { encoding: "utf-8" }, (err, rawData) => {
2735
2713
  if (err) {
2736
2714
  reject(err);
2737
2715
  }
@@ -2750,7 +2728,7 @@ class LocalFileStorage {
2750
2728
  return new Promise((resolve, reject) => {
2751
2729
  try {
2752
2730
  const rawData = JSON.stringify(data, undefined, 2);
2753
- fs__namespace.writeFile(this.filePath, rawData, { encoding: "utf-8" }, (err) => {
2731
+ fs.writeFile(this.filePath, rawData, { encoding: "utf-8" }, (err) => {
2754
2732
  if (err) {
2755
2733
  reject(err);
2756
2734
  }
@@ -3208,7 +3186,7 @@ class NotificationBot$1 {
3208
3186
  */
3209
3187
  constructor(adapter, options) {
3210
3188
  var _a, _b;
3211
- const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(path__namespace.resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
3189
+ 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 : "./" : "./"));
3212
3190
  this.conversationReferenceStore = new DefaultConversationReferenceStore(storage);
3213
3191
  this.adapter = adapter.use(new NotificationMiddleware({
3214
3192
  conversationReferenceStore: this.conversationReferenceStore,
@@ -4839,7 +4817,7 @@ class NotificationBot {
4839
4817
  this.conversationReferenceStore = options.store;
4840
4818
  }
4841
4819
  else {
4842
- const storage = (_a = options === null || options === void 0 ? void 0 : options.storage) !== null && _a !== void 0 ? _a : new LocalFileStorage(path__namespace.resolve(process.env.RUNNING_ON_AZURE === "1" ? (_b = process.env.TEMP) !== null && _b !== void 0 ? _b : "./" : "./"));
4820
+ 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 : "./" : "./"));
4843
4821
  this.conversationReferenceStore = new DefaultConversationReferenceStore(storage);
4844
4822
  }
4845
4823
  this.adapter = adapter.use(new NotificationMiddleware({