@microsoft/teamsfx 2.2.3-alpha.0c7c513de.0 → 2.2.3-alpha.25b558a2a.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.
@@ -854,7 +854,7 @@ class MsGraphAuthProvider {
854
854
  * };
855
855
  * const prompt = new TeamsBotSsoPrompt(dialogId, {
856
856
  * config: config
857
- * scopes: '["User.Read"],
857
+ * scopes: ["User.Read"],
858
858
  * });
859
859
  * this.addDialog(prompt);
860
860
  *
@@ -4736,6 +4736,29 @@ class NotificationBot {
4736
4736
  }
4737
4737
  return new TeamsBotInstallation(this.adapter, conversationReference, this.botAppId);
4738
4738
  }
4739
+ /**
4740
+ * Validate the installation by getting paged memebers.
4741
+ *
4742
+ * @param conversationReference The bound `ConversationReference`.
4743
+ * @returns Returns false if recieves `BotNotInConversationRoster` error, otherwise returns true.
4744
+ */
4745
+ validateInstallation(conversationReference) {
4746
+ return tslib.__awaiter(this, void 0, void 0, function* () {
4747
+ let isValid = true;
4748
+ yield this.adapter.continueConversationAsync(this.botAppId, conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4749
+ try {
4750
+ // try get member to see if the installation is still valid
4751
+ yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
4752
+ }
4753
+ catch (error) {
4754
+ if (error.code === "BotNotInConversationRoster") {
4755
+ isValid = false;
4756
+ }
4757
+ }
4758
+ }));
4759
+ return isValid;
4760
+ });
4761
+ }
4739
4762
  /**
4740
4763
  * Gets a pagined list of targets where the bot is installed.
4741
4764
  *
@@ -4747,7 +4770,7 @@ class NotificationBot {
4747
4770
  *
4748
4771
  * @returns An array of {@link TeamsBotInstallation} with paged data and continuation token.
4749
4772
  */
4750
- getPagedInstallations(pageSize, continuationToken) {
4773
+ getPagedInstallations(pageSize, continuationToken, validationEnabled = true) {
4751
4774
  return tslib.__awaiter(this, void 0, void 0, function* () {
4752
4775
  if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
4753
4776
  throw new Error("NotificationBot has not been initialized.");
@@ -4756,19 +4779,12 @@ class NotificationBot {
4756
4779
  const targets = [];
4757
4780
  for (const reference of references.data) {
4758
4781
  // validate connection
4759
- let valid = true;
4760
- yield this.adapter.continueConversationAsync(this.botAppId, reference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
4761
- try {
4762
- // try get member to see if the installation is still valid
4763
- yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
4764
- }
4765
- catch (error) {
4766
- if (error.code === "BotNotInConversationRoster") {
4767
- valid = false;
4768
- }
4769
- }
4770
- }));
4771
- if (valid) {
4782
+ let valid;
4783
+ if (validationEnabled) {
4784
+ // try get member to see if the installation is still valid
4785
+ valid = yield this.validateInstallation(reference);
4786
+ }
4787
+ if (!validationEnabled || (validationEnabled && valid)) {
4772
4788
  targets.push(new TeamsBotInstallation(this.adapter, reference, this.botAppId));
4773
4789
  }
4774
4790
  else {