@pnp/cli-microsoft365 7.0.0-beta.c0afb7b → 7.0.0-beta.c2db9df

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.
Files changed (158) hide show
  1. package/README.md +4 -4
  2. package/dist/cli/Cli.js +3 -3
  3. package/dist/m365/aad/commands/app/app-add.js +8 -8
  4. package/dist/m365/aad/commands/app/app-get.js +4 -1
  5. package/dist/m365/aad/commands/app/app-remove.js +3 -1
  6. package/dist/m365/aad/commands/app/app-role-add.js +9 -6
  7. package/dist/m365/aad/commands/app/app-role-list.js +4 -1
  8. package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
  9. package/dist/m365/aad/commands/app/app-set.js +9 -6
  10. package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +7 -2
  11. package/dist/m365/aad/commands/group/group-get.js +4 -4
  12. package/dist/m365/aad/commands/group/group-list.js +1 -23
  13. package/dist/m365/aad/commands/m365group/m365group-add.js +12 -9
  14. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
  15. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
  16. package/dist/m365/aad/commands/m365group/m365group-teamify.js +4 -1
  17. package/dist/m365/aad/commands/policy/policy-list.js +5 -5
  18. package/dist/m365/aad/commands/sp/sp-add.js +4 -1
  19. package/dist/m365/aad/commands/sp/sp-get.js +4 -1
  20. package/dist/m365/aad/commands/user/user-get.js +7 -2
  21. package/dist/m365/booking/commands/business/business-get.js +4 -1
  22. package/dist/m365/cli/commands/cli-issue.js +5 -5
  23. package/dist/m365/cli/commands/config/config-get.js +5 -5
  24. package/dist/m365/cli/commands/config/config-reset.js +5 -5
  25. package/dist/m365/cli/commands/config/config-set.js +5 -5
  26. package/dist/m365/commands/login.js +5 -5
  27. package/dist/m365/commands/request.js +1 -1
  28. package/dist/m365/flow/commands/owner/owner-ensure.js +5 -5
  29. package/dist/m365/outlook/commands/message/message-list.js +4 -2
  30. package/dist/m365/outlook/commands/message/message-move.js +4 -2
  31. package/dist/m365/pa/commands/app/app-export.js +7 -7
  32. package/dist/m365/pa/commands/app/app-owner-set.js +5 -5
  33. package/dist/m365/pa/commands/app/app-permission-ensure.js +5 -5
  34. package/dist/m365/planner/commands/bucket/bucket-get.js +5 -1
  35. package/dist/m365/planner/commands/bucket/bucket-remove.js +3 -1
  36. package/dist/m365/planner/commands/bucket/bucket-set.js +4 -1
  37. package/dist/m365/planner/commands/task/task-add.js +17 -11
  38. package/dist/m365/planner/commands/task/task-get.js +42 -27
  39. package/dist/m365/planner/commands/task/task-list.js +26 -19
  40. package/dist/m365/planner/commands/task/task-remove.js +45 -37
  41. package/dist/m365/planner/commands/task/task-set.js +35 -23
  42. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
  43. package/dist/m365/pp/commands/card/card-get.js +3 -5
  44. package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
  45. package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
  46. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +14 -14
  47. package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
  48. package/dist/m365/spfx/commands/package/package-generate.js +15 -15
  49. package/dist/m365/spfx/commands/project/DeployWorkflow.js +55 -0
  50. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0-rc.1.js} +2 -2
  51. package/dist/m365/spfx/commands/project/project-doctor.js +9 -9
  52. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +157 -0
  53. package/dist/m365/spfx/commands/project/project-github-workflow-model.js +2 -0
  54. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
  55. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0-rc.1.js} +35 -27
  56. package/dist/m365/spfx/commands/project/project-upgrade.js +14 -14
  57. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  58. package/dist/m365/spfx/commands.js +1 -0
  59. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +5 -5
  60. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
  61. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-list.js +5 -5
  62. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
  63. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
  64. package/dist/m365/spo/commands/commandset/commandset-add.js +11 -11
  65. package/dist/m365/spo/commands/commandset/commandset-get.js +12 -10
  66. package/dist/m365/spo/commands/commandset/commandset-list.js +5 -5
  67. package/dist/m365/spo/commands/commandset/commandset-remove.js +7 -6
  68. package/dist/m365/spo/commands/commandset/commandset-set.js +14 -12
  69. package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
  70. package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
  71. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
  72. package/dist/m365/spo/commands/file/file-get.js +9 -6
  73. package/dist/m365/spo/commands/file/file-sharinglink-add.js +8 -8
  74. package/dist/m365/spo/commands/file/file-sharinglink-list.js +5 -5
  75. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
  76. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
  77. package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
  78. package/dist/m365/spo/commands/list/list-add.js +4 -4
  79. package/dist/m365/spo/commands/list/list-set.js +4 -4
  80. package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
  81. package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
  82. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +8 -8
  83. package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
  84. package/dist/m365/spo/commands/page/page-get.js +1 -0
  85. package/dist/m365/spo/commands/page/page-list.js +4 -3
  86. package/dist/m365/spo/commands/page/page-section-add.js +56 -21
  87. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +30 -32
  88. package/dist/m365/spo/commands/site/site-add.js +114 -161
  89. package/dist/m365/spo/commands/site/site-apppermission-add.js +15 -18
  90. package/dist/m365/spo/commands/site/site-apppermission-remove.js +34 -38
  91. package/dist/m365/spo/commands/site/site-apppermission-set.js +11 -14
  92. package/dist/m365/spo/commands/site/site-ensure.js +13 -66
  93. package/dist/m365/spo/commands/site/site-list.js +5 -7
  94. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +6 -6
  95. package/dist/m365/spo/commands/site/site-remove.js +166 -210
  96. package/dist/m365/spo/commands/site/site-set.js +121 -153
  97. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  98. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
  99. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
  100. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
  101. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
  102. package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +8 -8
  103. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
  104. package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
  105. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
  106. package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +8 -8
  107. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +4 -4
  108. package/dist/m365/spo/commands/term/term-get.js +6 -6
  109. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +3 -3
  110. package/dist/m365/spo/commands/web/web-set.js +5 -5
  111. package/dist/m365/teams/commands/app/app-list.js +5 -5
  112. package/dist/m365/teams/commands/channel/channel-add.js +5 -1
  113. package/dist/m365/teams/commands/channel/channel-member-add.js +4 -2
  114. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
  115. package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
  116. package/dist/m365/teams/commands/chat/chat-get.js +7 -10
  117. package/dist/m365/teams/commands/chat/chat-member-add.js +5 -5
  118. package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
  119. package/dist/m365/teams/commands/funsettings/funsettings-set.js +4 -4
  120. package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +4 -4
  121. package/dist/m365/teams/commands/membersettings/membersettings-set.js +4 -4
  122. package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +5 -5
  123. package/dist/m365/teams/commands/team/team-clone.js +5 -10
  124. package/dist/m365/teams/commands/team/team-list.js +94 -30
  125. package/dist/m365/teams/commands/team/team-set.js +3 -3
  126. package/dist/m365/tenant/commands/info/info-get.js +83 -0
  127. package/dist/m365/tenant/commands.js +1 -0
  128. package/dist/m365/todo/commands/task/task-add.js +6 -6
  129. package/dist/m365/yammer/commands/message/message-list.js +5 -5
  130. package/dist/m365/yammer/commands/yammer-search.js +5 -5
  131. package/dist/utils/aadGroup.js +23 -3
  132. package/dist/utils/formatting.js +7 -0
  133. package/dist/utils/fsUtil.js +5 -0
  134. package/dist/utils/powerPlatform.js +1 -1
  135. package/dist/utils/spo.js +582 -0
  136. package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
  137. package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
  138. package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
  139. package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
  140. package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
  141. package/docs/docs/cmd/planner/task/task-add.mdx +22 -7
  142. package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
  143. package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
  144. package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
  145. package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
  146. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
  147. package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
  148. package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
  149. package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
  150. package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
  151. package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
  152. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
  153. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
  154. package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
  155. package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
  156. package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
  157. package/npm-shrinkwrap.json +196 -193
  158. package/package.json +8 -12
package/README.md CHANGED
@@ -20,9 +20,9 @@
20
20
  alt="Discord" />
21
21
  </a>
22
22
 
23
- <a href="https://twitter.com/climicrosoft365">
24
- <img src="https://img.shields.io/badge/Twitter-%40climicrosoft365-blue?style=flat-square"
25
- alt="Twitter" />
23
+ <a href="https://x.com/climicrosoft365">
24
+ <img src="https://img.shields.io/badge/X-%40climicrosoft365-blue?style=flat-square"
25
+ alt="X" />
26
26
  </a>
27
27
  </p>
28
28
 
@@ -101,7 +101,7 @@
101
101
  - Upgrade your projects
102
102
  - Check your environment compatibility
103
103
 
104
- > Follow our [Twitter](https://twitter.com/climicrosoft365) account to keep yourself updated about new features, improvements, and bug fixes.
104
+ > Follow our [X](https://x.com/climicrosoft365) account to keep yourself updated about new features, improvements, and bug fixes.
105
105
 
106
106
  ## Install
107
107
 
package/dist/cli/Cli.js CHANGED
@@ -814,16 +814,16 @@ export class Cli {
814
814
  }
815
815
  return response;
816
816
  }
817
- static async handleMultipleResultsFound(promptMessage, errorMessage, values) {
817
+ static async handleMultipleResultsFound(message, values) {
818
818
  const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, false);
819
819
  if (!prompt) {
820
- throw errorMessage;
820
+ throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
821
821
  }
822
822
  const response = await Cli.prompt({
823
823
  type: 'list',
824
824
  name: 'select',
825
825
  default: 0,
826
- message: promptMessage,
826
+ message: `${message} Please choose one:`,
827
827
  choices: Object.keys(values)
828
828
  });
829
829
  return values[response.select];
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _AadAppAddCommand_instances, _AadAppAddCommand_initTelemetry, _AadAppAddCommand_initOptions, _AadAppAddCommand_initValidators, _AadAppAddCommand_initOptionSets;
6
+ var _AadAppAddCommand_instances, _a, _AadAppAddCommand_initTelemetry, _AadAppAddCommand_initOptions, _AadAppAddCommand_initValidators, _AadAppAddCommand_initOptionSets;
7
7
  import fs from 'fs';
8
8
  import { v4 } from 'uuid';
9
9
  import auth from '../../../../Auth.js';
@@ -635,7 +635,7 @@ class AadAppAddCommand extends GraphCommand {
635
635
  return platform.charAt(0).toUpperCase() + platform.substring(1);
636
636
  }
637
637
  }
638
- _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
638
+ _a = AadAppAddCommand, _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
639
639
  this.telemetry.push((args) => {
640
640
  Object.assign(this.telemetryProperties, {
641
641
  apis: typeof args.options.apisDelegated !== 'undefined',
@@ -664,7 +664,7 @@ _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = f
664
664
  option: '-r, --redirectUris [redirectUris]'
665
665
  }, {
666
666
  option: '-p, --platform [platform]',
667
- autocomplete: AadAppAddCommand.aadApplicationPlatform
667
+ autocomplete: _a.aadApplicationPlatform
668
668
  }, {
669
669
  option: '--implicitFlow'
670
670
  }, {
@@ -679,7 +679,7 @@ _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = f
679
679
  option: '--scopeName [scopeName]'
680
680
  }, {
681
681
  option: '--scopeConsentBy [scopeConsentBy]',
682
- autocomplete: AadAppAddCommand.aadAppScopeConsentBy
682
+ autocomplete: _a.aadAppScopeConsentBy
683
683
  }, {
684
684
  option: '--scopeAdminConsentDisplayName [scopeAdminConsentDisplayName]'
685
685
  }, {
@@ -700,8 +700,8 @@ _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = f
700
700
  }, _AadAppAddCommand_initValidators = function _AadAppAddCommand_initValidators() {
701
701
  this.validators.push(async (args) => {
702
702
  if (args.options.platform &&
703
- AadAppAddCommand.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
704
- return `${args.options.platform} is not a valid value for platform. Allowed values are ${AadAppAddCommand.aadApplicationPlatform.join(', ')}`;
703
+ _a.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
704
+ return `${args.options.platform} is not a valid value for platform. Allowed values are ${_a.aadApplicationPlatform.join(', ')}`;
705
705
  }
706
706
  if (args.options.redirectUris && !args.options.platform) {
707
707
  return `When you specify redirectUris you also need to specify platform`;
@@ -727,8 +727,8 @@ _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = f
727
727
  }
728
728
  }
729
729
  if (args.options.scopeConsentBy &&
730
- AadAppAddCommand.aadAppScopeConsentBy.indexOf(args.options.scopeConsentBy) < 0) {
731
- return `${args.options.scopeConsentBy} is not a valid value for scopeConsentBy. Allowed values are ${AadAppAddCommand.aadAppScopeConsentBy.join(', ')}`;
730
+ _a.aadAppScopeConsentBy.indexOf(args.options.scopeConsentBy) < 0) {
731
+ return `${args.options.scopeConsentBy} is not a valid value for scopeConsentBy. Allowed values are ${_a.aadAppScopeConsentBy.join(', ')}`;
732
732
  }
733
733
  if (args.options.manifest) {
734
734
  try {
@@ -10,6 +10,7 @@ import { formatting } from '../../../../utils/formatting.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import GraphCommand from '../../../base/GraphCommand.js';
12
12
  import commands from '../../commands.js';
13
+ import { Cli } from '../../../../cli/Cli.js';
13
14
  class AadAppGetCommand extends GraphCommand {
14
15
  get name() {
15
16
  return commands.APP_GET;
@@ -59,7 +60,9 @@ class AadAppGetCommand extends GraphCommand {
59
60
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
60
61
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
61
62
  }
62
- throw `Multiple Azure AD application registration with name ${name} found. Please disambiguate (app object IDs): ${res.value.map(a => a.id).join(', ')}`;
63
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
64
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
65
+ return result.id;
63
66
  }
64
67
  async getAppInfo(appObjectId) {
65
68
  const requestOptions = {
@@ -86,7 +86,9 @@ class AadAppRemoveCommand extends GraphCommand {
86
86
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
87
87
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
88
88
  }
89
- throw `Multiple Azure AD application registration with name ${name} found. Please choose one of the object IDs: ${res.value.map(a => a.id).join(', ')}`;
89
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
90
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
91
+ return result.id;
90
92
  }
91
93
  }
92
94
  _AadAppRemoveCommand_instances = new WeakSet(), _AadAppRemoveCommand_initTelemetry = function _AadAppRemoveCommand_initTelemetry() {
@@ -3,12 +3,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _AadAppRoleAddCommand_instances, _AadAppRoleAddCommand_initTelemetry, _AadAppRoleAddCommand_initOptions, _AadAppRoleAddCommand_initValidators, _AadAppRoleAddCommand_initOptionSets;
6
+ var _AadAppRoleAddCommand_instances, _a, _AadAppRoleAddCommand_initTelemetry, _AadAppRoleAddCommand_initOptions, _AadAppRoleAddCommand_initValidators, _AadAppRoleAddCommand_initOptionSets;
7
7
  import { v4 } from 'uuid';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadAppRoleAddCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.APP_ROLE_ADD;
@@ -104,10 +105,12 @@ class AadAppRoleAddCommand extends GraphCommand {
104
105
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
105
106
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
106
107
  }
107
- throw `Multiple Azure AD application registration with name ${appName} found. Please disambiguate (app object IDs): ${res.value.map(a => a.id).join(', ')}`;
108
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
109
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair);
110
+ return result.id;
108
111
  }
109
112
  }
110
- _AadAppRoleAddCommand_instances = new WeakSet(), _AadAppRoleAddCommand_initTelemetry = function _AadAppRoleAddCommand_initTelemetry() {
113
+ _a = AadAppRoleAddCommand, _AadAppRoleAddCommand_instances = new WeakSet(), _AadAppRoleAddCommand_initTelemetry = function _AadAppRoleAddCommand_initTelemetry() {
111
114
  this.telemetry.push((args) => {
112
115
  Object.assign(this.telemetryProperties, {
113
116
  appId: typeof args.options.appId !== 'undefined',
@@ -117,13 +120,13 @@ _AadAppRoleAddCommand_instances = new WeakSet(), _AadAppRoleAddCommand_initTelem
117
120
  });
118
121
  }, _AadAppRoleAddCommand_initOptions = function _AadAppRoleAddCommand_initOptions() {
119
122
  this.options.unshift({ option: '--appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--appName [appName]' }, { option: '-n, --name <name>' }, { option: '-d, --description <description>' }, {
120
- option: '-m, --allowedMembers <allowedMembers>', autocomplete: AadAppRoleAddCommand.allowedMembers
123
+ option: '-m, --allowedMembers <allowedMembers>', autocomplete: _a.allowedMembers
121
124
  }, { option: '-c, --claim <claim>' });
122
125
  }, _AadAppRoleAddCommand_initValidators = function _AadAppRoleAddCommand_initValidators() {
123
126
  this.validators.push(async (args) => {
124
127
  const { allowedMembers, claim } = args.options;
125
- if (AadAppRoleAddCommand.allowedMembers.indexOf(allowedMembers) < 0) {
126
- return `${allowedMembers} is not a valid value for allowedMembers. Valid values are ${AadAppRoleAddCommand.allowedMembers.join(', ')}`;
128
+ if (_a.allowedMembers.indexOf(allowedMembers) < 0) {
129
+ return `${allowedMembers} is not a valid value for allowedMembers. Valid values are ${_a.allowedMembers.join(', ')}`;
127
130
  }
128
131
  if (claim.length > 120) {
129
132
  return `Claim must not be longer than 120 characters`;
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
9
9
  import { odata } from '../../../../utils/odata.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadAppRoleListCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.APP_ROLE_LIST;
@@ -62,7 +63,9 @@ class AadAppRoleListCommand extends GraphCommand {
62
63
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
63
64
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
64
65
  }
65
- throw `Multiple Azure AD application registration with name ${appName} found. Please disambiguate (app object IDs): ${res.value.map(a => a.id).join(', ')}`;
66
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
67
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair);
68
+ return result.id;
66
69
  }
67
70
  }
68
71
  _AadAppRoleListCommand_instances = new WeakSet(), _AadAppRoleListCommand_initTelemetry = function _AadAppRoleListCommand_initTelemetry() {
@@ -63,7 +63,8 @@ class AadAppRoleRemoveCommand extends GraphCommand {
63
63
  if (args.options.name &&
64
64
  appRoleToDelete !== undefined &&
65
65
  appRoleToDelete.length > 1) {
66
- throw `Multiple roles with the provided 'name' were found. Please disambiguate using the claims : ${appRoleToDelete.map(role => `${role.value}`).join(', ')}`;
66
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', appRoleToDelete);
67
+ appRoleToDelete[0] = await Cli.handleMultipleResultsFound(`Multiple roles with name '${args.options.name}' found.`, resultAsKeyValuePair);
67
68
  }
68
69
  if (appRoleToDelete.length === 0) {
69
70
  throw `No app role with ${appRoleDeleteIdentifierNameValue} found.`;
@@ -151,7 +152,9 @@ class AadAppRoleRemoveCommand extends GraphCommand {
151
152
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
152
153
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
153
154
  }
154
- throw `Multiple Azure AD application registration with name ${appName} found. Please disambiguate using app object IDs: ${res.value.map(a => a.id).join(', ')}`;
155
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
156
+ const result = (await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${appName}' found.`, resultAsKeyValuePair));
157
+ return result.id;
155
158
  }
156
159
  }
157
160
  _AadAppRoleRemoveCommand_instances = new WeakSet(), _AadAppRoleRemoveCommand_initTelemetry = function _AadAppRoleRemoveCommand_initTelemetry() {
@@ -3,12 +3,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _AadAppSetCommand_instances, _AadAppSetCommand_initTelemetry, _AadAppSetCommand_initOptions, _AadAppSetCommand_initValidators, _AadAppSetCommand_initOptionSets;
6
+ var _AadAppSetCommand_instances, _a, _AadAppSetCommand_initTelemetry, _AadAppSetCommand_initOptions, _AadAppSetCommand_initValidators, _AadAppSetCommand_initOptionSets;
7
7
  import fs from 'fs';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadAppSetCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.APP_SET;
@@ -61,7 +62,9 @@ class AadAppSetCommand extends GraphCommand {
61
62
  const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
62
63
  throw `No Azure AD application registration with ${applicationIdentifier} found`;
63
64
  }
64
- throw `Multiple Azure AD application registration with name ${name} found. Please disambiguate (app object IDs): ${res.value.map(a => a.id).join(', ')}`;
65
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
66
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD application registration with name '${name}' found.`, resultAsKeyValuePair);
67
+ return result.id;
65
68
  }
66
69
  async configureUri(args, objectId, logger) {
67
70
  if (!args.options.uri) {
@@ -229,7 +232,7 @@ class AadAppSetCommand extends GraphCommand {
229
232
  return request.patch(requestOptions);
230
233
  }
231
234
  }
232
- _AadAppSetCommand_instances = new WeakSet(), _AadAppSetCommand_initTelemetry = function _AadAppSetCommand_initTelemetry() {
235
+ _a = AadAppSetCommand, _AadAppSetCommand_instances = new WeakSet(), _AadAppSetCommand_initTelemetry = function _AadAppSetCommand_initTelemetry() {
233
236
  this.telemetry.push((args) => {
234
237
  Object.assign(this.telemetryProperties, {
235
238
  appId: typeof args.options.appId !== 'undefined',
@@ -247,7 +250,7 @@ _AadAppSetCommand_instances = new WeakSet(), _AadAppSetCommand_initTelemetry = f
247
250
  }, _AadAppSetCommand_initOptions = function _AadAppSetCommand_initOptions() {
248
251
  this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '-n, --name [name]' }, { option: '-u, --uri [uri]' }, { option: '-r, --redirectUris [redirectUris]' }, { option: '--certificateFile [certificateFile]' }, { option: '--certificateBase64Encoded [certificateBase64Encoded]' }, { option: '--certificateDisplayName [certificateDisplayName]' }, {
249
252
  option: '--platform [platform]',
250
- autocomplete: AadAppSetCommand.aadApplicationPlatform
253
+ autocomplete: _a.aadApplicationPlatform
251
254
  }, { option: '--redirectUrisToRemove [redirectUrisToRemove]' });
252
255
  }, _AadAppSetCommand_initValidators = function _AadAppSetCommand_initValidators() {
253
256
  this.validators.push(async (args) => {
@@ -264,8 +267,8 @@ _AadAppSetCommand_instances = new WeakSet(), _AadAppSetCommand_initTelemetry = f
264
267
  return `When you specify redirectUris you also need to specify platform`;
265
268
  }
266
269
  if (args.options.platform &&
267
- AadAppSetCommand.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
268
- return `${args.options.platform} is not a valid value for platform. Allowed values are ${AadAppSetCommand.aadApplicationPlatform.join(', ')}`;
270
+ _a.aadApplicationPlatform.indexOf(args.options.platform) < 0) {
271
+ return `${args.options.platform} is not a valid value for platform. Allowed values are ${_a.aadApplicationPlatform.join(', ')}`;
269
272
  }
270
273
  return true;
271
274
  });
@@ -10,6 +10,7 @@ import { formatting } from '../../../../utils/formatting.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import GraphCommand from '../../../base/GraphCommand.js';
12
12
  import commands from '../../commands.js';
13
+ import { Cli } from '../../../../cli/Cli.js';
13
14
  class AadAppRoleAssignmentAddCommand extends GraphCommand {
14
15
  get name() {
15
16
  return commands.APPROLEASSIGNMENT_ADD;
@@ -50,9 +51,13 @@ class AadAppRoleAssignmentAddCommand extends GraphCommand {
50
51
  throw `The specified service principal doesn't exist`;
51
52
  }
52
53
  if (servicePrincipalResult.value.length > 1) {
53
- throw 'More than one service principal found. Please use the appId or appObjectId option to make sure the right service principal is specified.';
54
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', servicePrincipalResult.value);
55
+ const result = await Cli.handleMultipleResultsFound(`Multiple service principal found.`, resultAsKeyValuePair);
56
+ objectId = result.id;
57
+ }
58
+ else {
59
+ objectId = servicePrincipalResult.value[0].id;
54
60
  }
55
- objectId = servicePrincipalResult.value[0].id;
56
61
  let resource = formatting.encodeQueryParameter(args.options.resource);
57
62
  // try resolve aliases that the user might enter since these are seen in the Azure portal
58
63
  switch (args.options.resource.toLocaleLowerCase()) {
@@ -30,7 +30,7 @@ class AadGroupGetCommand extends GraphCommand {
30
30
  group = await aadGroup.getGroupById(args.options.id);
31
31
  }
32
32
  else {
33
- group = await aadGroup.getGroupByDisplayName(args.options.title);
33
+ group = await aadGroup.getGroupByDisplayName(args.options.displayName);
34
34
  }
35
35
  await logger.log(group);
36
36
  }
@@ -43,7 +43,7 @@ _AadGroupGetCommand_instances = new WeakSet(), _AadGroupGetCommand_initOptions =
43
43
  this.options.unshift({
44
44
  option: '-i, --id [id]'
45
45
  }, {
46
- option: '-t, --title [title]'
46
+ option: '-n, --displayName [displayName]'
47
47
  });
48
48
  }, _AadGroupGetCommand_initValidators = function _AadGroupGetCommand_initValidators() {
49
49
  this.validators.push(async (args) => {
@@ -53,12 +53,12 @@ _AadGroupGetCommand_instances = new WeakSet(), _AadGroupGetCommand_initOptions =
53
53
  return true;
54
54
  });
55
55
  }, _AadGroupGetCommand_initOptionSets = function _AadGroupGetCommand_initOptionSets() {
56
- this.optionSets.push({ options: ['id', 'title'] });
56
+ this.optionSets.push({ options: ['id', 'displayName'] });
57
57
  }, _AadGroupGetCommand_initTelemetry = function _AadGroupGetCommand_initTelemetry() {
58
58
  this.telemetry.push((args) => {
59
59
  Object.assign(this.telemetryProperties, {
60
60
  id: typeof args.options.id !== 'undefined',
61
- title: typeof args.options.title !== 'undefined'
61
+ displayName: typeof args.options.displayName !== 'undefined'
62
62
  });
63
63
  });
64
64
  };
@@ -1,9 +1,3 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _AadGroupListCommand_instances, _AadGroupListCommand_initTelemetry, _AadGroupListCommand_initOptions;
7
1
  import { Cli } from '../../../../cli/Cli.js';
8
2
  import { odata } from '../../../../utils/odata.js';
9
3
  import GraphCommand from '../../../base/GraphCommand.js';
@@ -15,19 +9,12 @@ class AadGroupListCommand extends GraphCommand {
15
9
  get description() {
16
10
  return 'Lists all groups defined in Azure Active Directory.';
17
11
  }
18
- constructor() {
19
- super();
20
- _AadGroupListCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _AadGroupListCommand_instances, "m", _AadGroupListCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _AadGroupListCommand_instances, "m", _AadGroupListCommand_initOptions).call(this);
23
- }
24
12
  defaultProperties() {
25
13
  return ['id', 'displayName', 'groupType'];
26
14
  }
27
15
  async commandAction(logger, args) {
28
- const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.group' : 'groups';
29
16
  try {
30
- const groups = await odata.getAllItems(`${this.resource}/v1.0/${endpoint}`);
17
+ const groups = await odata.getAllItems(`${this.resource}/v1.0/groups`);
31
18
  if (Cli.shouldTrimOutput(args.options.output)) {
32
19
  groups.forEach((group) => {
33
20
  if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
@@ -51,14 +38,5 @@ class AadGroupListCommand extends GraphCommand {
51
38
  }
52
39
  }
53
40
  }
54
- _AadGroupListCommand_instances = new WeakSet(), _AadGroupListCommand_initTelemetry = function _AadGroupListCommand_initTelemetry() {
55
- this.telemetry.push((args) => {
56
- Object.assign(this.telemetryProperties, {
57
- deleted: args.options.deleted
58
- });
59
- });
60
- }, _AadGroupListCommand_initOptions = function _AadGroupListCommand_initOptions() {
61
- this.options.unshift({ option: '-d, --deleted' });
62
- };
63
41
  export default new AadGroupListCommand();
64
42
  //# sourceMappingURL=group-list.js.map
@@ -33,19 +33,19 @@ class AadM365GroupAddCommand extends GraphCommand {
33
33
  let memberIds = [];
34
34
  const resourceBehaviorOptionsCollection = [];
35
35
  if (this.verbose) {
36
- await logger.logToStderr(`Creating Microsoft 365 Group...`);
36
+ await logger.logToStderr('Creating Microsoft 365 Group...');
37
37
  }
38
38
  if (args.options.allowMembersToPost) {
39
- resourceBehaviorOptionsCollection.push("allowMembersToPost");
39
+ resourceBehaviorOptionsCollection.push('AllowOnlyMembersToPost');
40
40
  }
41
41
  if (args.options.hideGroupInOutlook) {
42
- resourceBehaviorOptionsCollection.push("hideGroupInOutlook");
42
+ resourceBehaviorOptionsCollection.push('HideGroupInOutlook');
43
43
  }
44
44
  if (args.options.subscribeNewGroupMembers) {
45
- resourceBehaviorOptionsCollection.push("subscribeNewGroupMembers");
45
+ resourceBehaviorOptionsCollection.push('SubscribeNewGroupMembers');
46
46
  }
47
47
  if (args.options.welcomeEmailDisabled) {
48
- resourceBehaviorOptionsCollection.push("welcomeEmailDisabled");
48
+ resourceBehaviorOptionsCollection.push('WelcomeEmailDisabled');
49
49
  }
50
50
  const requestOptions = {
51
51
  url: `${this.resource}/v1.0/groups`,
@@ -186,10 +186,10 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
186
186
  members: typeof args.options.members !== 'undefined',
187
187
  logoPath: typeof args.options.logoPath !== 'undefined',
188
188
  isPrivate: typeof args.options.isPrivate !== 'undefined',
189
- allowMembersToPost: args.options.allowMembersToPost,
190
- hideGroupInOutlook: args.options.hideGroupInOutlook,
191
- subscribeNewGroupMembers: args.options.subscribeNewGroupMembers,
192
- welcomeEmailDisabled: args.options.welcomeEmailDisabled
189
+ allowMembersToPost: !!args.options.allowMembersToPost,
190
+ hideGroupInOutlook: !!args.options.hideGroupInOutlook,
191
+ subscribeNewGroupMembers: !!args.options.subscribeNewGroupMembers,
192
+ welcomeEmailDisabled: !!args.options.welcomeEmailDisabled
193
193
  });
194
194
  });
195
195
  }, _AadM365GroupAddCommand_initOptions = function _AadM365GroupAddCommand_initOptions() {
@@ -240,6 +240,9 @@ _AadM365GroupAddCommand_instances = new WeakSet(), _AadM365GroupAddCommand_initT
240
240
  }
241
241
  }
242
242
  }
243
+ if (args.options.mailNickname.indexOf(' ') !== -1) {
244
+ return 'The option mailNickname cannot contain spaces.';
245
+ }
243
246
  if (args.options.logoPath) {
244
247
  const fullPath = path.resolve(args.options.logoPath);
245
248
  if (!fs.existsSync(fullPath)) {
@@ -82,7 +82,9 @@ class AadM365GroupRecycleBinItemRemoveCommand extends GraphCommand {
82
82
  throw Error(`The specified group '${displayName || mailNickname}' does not exist.`);
83
83
  }
84
84
  if (groups.length > 1) {
85
- throw Error(`Multiple groups with name '${displayName || mailNickname}' found: ${groups.map(x => x.id).join(',')}.`);
85
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', groups);
86
+ const result = await Cli.handleMultipleResultsFound(`Multiple groups with name '${displayName || mailNickname}' found.`, resultAsKeyValuePair);
87
+ return result.id;
86
88
  }
87
89
  return groups[0].id;
88
90
  }
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadM365GroupRecycleBinItemRestoreCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.M365GROUP_RECYCLEBINITEM_RESTORE;
@@ -69,7 +70,9 @@ class AadM365GroupRecycleBinItemRestoreCommand extends GraphCommand {
69
70
  throw `The specified group '${displayName || mailNickname}' does not exist.`;
70
71
  }
71
72
  if (groups.length > 1) {
72
- throw `Multiple groups with name '${displayName || mailNickname}' found: ${groups.map(x => x.id).join(',')}.`;
73
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', groups);
74
+ const result = await Cli.handleMultipleResultsFound(`Multiple groups with name '${displayName || mailNickname}' found.`, resultAsKeyValuePair);
75
+ return result.id;
73
76
  }
74
77
  return groups[0].id;
75
78
  }
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _AadM365GroupTeamifyCommand_instances, _AadM365GroupTeamifyCommand_initTelemetry, _AadM365GroupTeamifyCommand_initOptions, _AadM365GroupTeamifyCommand_initValidators, _AadM365GroupTeamifyCommand_initOptionSets;
7
+ import { Cli } from '../../../../cli/Cli.js';
7
8
  import request from '../../../../request.js';
8
9
  import { formatting } from '../../../../utils/formatting.js';
9
10
  import { validation } from '../../../../utils/validation.js';
@@ -41,7 +42,9 @@ class AadM365GroupTeamifyCommand extends GraphCommand {
41
42
  throw `The specified Microsoft 365 Group does not exist`;
42
43
  }
43
44
  if (response.value.length > 1) {
44
- throw `Multiple Microsoft 365 Groups with name ${args.options.mailNickname} found: ${response.value.map(x => x.id)}`;
45
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
46
+ const result = await Cli.handleMultipleResultsFound(`Multiple Microsoft 365 Groups with name '${args.options.mailNickname}' found.`, resultAsKeyValuePair);
47
+ return result.id;
45
48
  }
46
49
  return groupItem.id;
47
50
  }
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _AadPolicyListCommand_instances, _AadPolicyListCommand_initTelemetry, _AadPolicyListCommand_initOptions, _AadPolicyListCommand_initValidators;
6
+ var _AadPolicyListCommand_instances, _a, _AadPolicyListCommand_initTelemetry, _AadPolicyListCommand_initOptions, _AadPolicyListCommand_initValidators;
7
7
  import request from '../../../../request.js';
8
8
  import GraphCommand from '../../../base/GraphCommand.js';
9
9
  import commands from '../../commands.js';
@@ -73,7 +73,7 @@ class AadPolicyListCommand extends GraphCommand {
73
73
  }
74
74
  }
75
75
  }
76
- _AadPolicyListCommand_instances = new WeakSet(), _AadPolicyListCommand_initTelemetry = function _AadPolicyListCommand_initTelemetry() {
76
+ _a = AadPolicyListCommand, _AadPolicyListCommand_instances = new WeakSet(), _AadPolicyListCommand_initTelemetry = function _AadPolicyListCommand_initTelemetry() {
77
77
  this.telemetry.push((args) => {
78
78
  Object.assign(this.telemetryProperties, {
79
79
  policyType: args.options.type || 'all'
@@ -82,14 +82,14 @@ _AadPolicyListCommand_instances = new WeakSet(), _AadPolicyListCommand_initTelem
82
82
  }, _AadPolicyListCommand_initOptions = function _AadPolicyListCommand_initOptions() {
83
83
  this.options.unshift({
84
84
  option: '-t, --type [type]',
85
- autocomplete: AadPolicyListCommand.supportedPolicyTypes
85
+ autocomplete: _a.supportedPolicyTypes
86
86
  });
87
87
  }, _AadPolicyListCommand_initValidators = function _AadPolicyListCommand_initValidators() {
88
88
  this.validators.push(async (args) => {
89
89
  if (args.options.type) {
90
90
  const policyType = args.options.type.toLowerCase();
91
- if (!AadPolicyListCommand.supportedPolicyTypes.find(p => p.toLowerCase() === policyType)) {
92
- return `${args.options.type} is not a valid type. Allowed values are ${AadPolicyListCommand.supportedPolicyTypes.join(', ')}`;
91
+ if (!_a.supportedPolicyTypes.find(p => p.toLowerCase() === policyType)) {
92
+ return `${args.options.type} is not a valid type. Allowed values are ${_a.supportedPolicyTypes.join(', ')}`;
93
93
  }
94
94
  }
95
95
  return true;
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadSpAddCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.SP_ADD;
@@ -48,7 +49,9 @@ class AadSpAddCommand extends GraphCommand {
48
49
  throw `The specified Azure AD app doesn't exist`;
49
50
  }
50
51
  if (response.value.length > 1) {
51
- throw `Multiple Azure AD apps with name ${args.options.appName} found: ${response.value.map(x => x.appId)}`;
52
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', response.value);
53
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD apps with name '${args.options.appName}' found.`, resultAsKeyValuePair);
54
+ return result.appId;
52
55
  }
53
56
  return spItem.appId;
54
57
  }
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _AadSpGetCommand_instances, _AadSpGetCommand_initTelemetry, _AadSpGetCommand_initOptions, _AadSpGetCommand_initValidators, _AadSpGetCommand_initOptionSets;
7
+ import { Cli } from '../../../../cli/Cli.js';
7
8
  import request from '../../../../request.js';
8
9
  import { formatting } from '../../../../utils/formatting.js';
9
10
  import { validation } from '../../../../utils/validation.js';
@@ -48,7 +49,9 @@ class AadSpGetCommand extends GraphCommand {
48
49
  throw `The specified Azure AD app does not exist`;
49
50
  }
50
51
  if (response.value.length > 1) {
51
- throw `Multiple Azure AD apps with name ${args.options.appDisplayName} found: ${response.value.map(x => x.id)}`;
52
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
53
+ const result = await Cli.handleMultipleResultsFound(`Multiple Azure AD apps with name '${args.options.appDisplayName}' found.`, resultAsKeyValuePair);
54
+ return result.id;
52
55
  }
53
56
  return spItem.id;
54
57
  }
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
10
  import GraphCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
12
13
  class AadUserGetCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.USER_GET;
@@ -57,9 +58,13 @@ class AadUserGetCommand extends GraphCommand {
57
58
  throw `The specified user with ${identifier} does not exist`;
58
59
  }
59
60
  if (res.value.length > 1) {
60
- throw `Multiple users with ${identifier} found. Please disambiguate (user names): ${res.value.map(a => a.userPrincipalName).join(', ')} or (ids): ${res.value.map(a => a.id).join(', ')}`;
61
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
62
+ const result = await Cli.handleMultipleResultsFound(`Multiple users with ${identifier} found.`, resultAsKeyValuePair);
63
+ await logger.log(result);
64
+ }
65
+ else {
66
+ await logger.log(res.value[0]);
61
67
  }
62
- await logger.log(res.value[0]);
63
68
  }
64
69
  catch (err) {
65
70
  this.handleRejectedODataJsonPromise(err);
@@ -8,6 +8,7 @@ import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
9
  import GraphCommand from '../../../base/GraphCommand.js';
10
10
  import commands from '../../commands.js';
11
+ import { Cli } from '../../../../cli/Cli.js';
11
12
  class BookingBusinessGetCommand extends GraphCommand {
12
13
  get name() {
13
14
  return commands.BUSINESS_GET;
@@ -60,7 +61,9 @@ class BookingBusinessGetCommand extends GraphCommand {
60
61
  throw `The specified business with name ${options.name} does not exist.`;
61
62
  }
62
63
  if (bookingBusinesses.length > 1) {
63
- throw `Multiple businesses with name ${options.name} found. Please disambiguate: ${bookingBusinesses.map(x => x.id).join(', ')}`;
64
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', bookingBusinesses);
65
+ const result = await Cli.handleMultipleResultsFound(`Multiple businesses with name '${options.name}' found.`, resultAsKeyValuePair);
66
+ return result.id;
64
67
  }
65
68
  return bookingBusinesses[0].id;
66
69
  }