@pnp/cli-microsoft365 10.10.0-beta.eb74779 → 10.11.0-beta.24af61c

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 (125) hide show
  1. package/.eslintrc.cjs +2 -0
  2. package/Dockerfile +2 -2
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/config.js +1 -0
  6. package/dist/m365/base/GraphApplicationCommand.js +17 -0
  7. package/dist/m365/base/{DelegatedGraphCommand.js → GraphDelegatedCommand.js} +4 -4
  8. package/dist/m365/base/PowerAppsCommand.js +1 -1
  9. package/dist/m365/base/PowerAutomateCommand.js +1 -1
  10. package/dist/m365/base/PowerBICommand.js +1 -1
  11. package/dist/m365/base/PowerPlatformCommand.js +1 -1
  12. package/dist/m365/base/VivaEngageCommand.js +1 -1
  13. package/dist/m365/cli/commands/app/app-add.js +95 -0
  14. package/dist/m365/cli/commands.js +1 -0
  15. package/dist/m365/entra/commands/app/app-get.js +11 -52
  16. package/dist/m365/entra/commands/app/app-permission-add.js +19 -30
  17. package/dist/m365/entra/commands/app/app-permission-list.js +2 -19
  18. package/dist/m365/entra/commands/app/app-permission-remove.js +22 -31
  19. package/dist/m365/entra/commands/app/app-remove.js +2 -18
  20. package/dist/m365/entra/commands/app/app-role-add.js +10 -43
  21. package/dist/m365/entra/commands/app/app-role-list.js +2 -20
  22. package/dist/m365/entra/commands/app/app-role-remove.js +9 -40
  23. package/dist/m365/entra/commands/app/app-set.js +2 -19
  24. package/dist/m365/entra/commands/group/group-member-add.js +55 -10
  25. package/dist/m365/entra/commands/group/group-member-set.js +18 -3
  26. package/dist/m365/entra/commands/organization/organization-set.js +104 -0
  27. package/dist/m365/entra/commands.js +1 -0
  28. package/dist/m365/outlook/commands/message/message-move.js +1 -1
  29. package/dist/m365/pp/commands/managementapp/managementapp-add.js +7 -21
  30. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +96 -0
  31. package/dist/m365/spe/commands.js +1 -0
  32. package/dist/m365/spfx/commands/project/base-project-command.js +1 -0
  33. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.0.js +2 -0
  34. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.1.js +2 -0
  35. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.22.0-beta.1.js +21 -0
  36. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002022_DEVDEP_typescript.js +10 -0
  37. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  38. package/dist/m365/spfx/commands/project/project-model/SassJson.js +2 -0
  39. package/dist/m365/spfx/commands/project/project-model/index.js +1 -0
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002001_DEVDEP_microsoft_sp_build_web.js +2 -2
  41. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002004_DEVDEP_gulp.js +2 -2
  42. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002007_DEVDEP_ajv.js +2 -2
  43. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002029_DEVDEP_microsoft_rush_stack_compiler_5_3.js +2 -2
  44. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002030_DEVDEP_microsoft_spfx_web_build_rig.js +10 -0
  45. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002031_DEVDEP_rushstack_heft.js +10 -0
  46. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002032_DEVDEP_typescript_eslint_parser.js +10 -0
  47. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002033_DEVDEP_jest_junit.js +10 -0
  48. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010011_YORC_useGulp.js +40 -0
  49. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015010_FILE_gulpfile_js.js +10 -0
  50. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015011_FILE_tsconfig_json.js +10 -0
  51. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015012_FILE_config_heft_json.js +10 -0
  52. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015013_FILE_config_jest_config_json.js +10 -0
  53. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015014_FILE_config_rig_json.js +10 -0
  54. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015015_FILE_config_typescript_json.js +10 -0
  55. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021004_PKG_scripts_build.js +45 -0
  56. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021005_PKG_scripts_test.js +45 -0
  57. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021006_PKG_scripts_clean.js +45 -0
  58. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021007_PKG_scripts_deploy.js +45 -0
  59. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021008_PKG_scripts_start.js +45 -0
  60. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_scripts_build_watch.js +45 -0
  61. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021010_PKG_scripts_package_solution.js +45 -0
  62. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021011_PKG_scripts_deploy_azure_storage.js +45 -0
  63. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021012_PKG_scripts_eject_webpack.js +45 -0
  64. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021013_PKG_overrides_rushstack_heft.js +45 -0
  65. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023003_GITIGNORE_libdts.js +36 -0
  66. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023004_GITIGNORE_libcommonjs.js +36 -0
  67. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023005_GITIGNORE_libesm.js +36 -0
  68. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023006_GITIGNORE_jestoutput.js +36 -0
  69. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026001_CFG_SASS_schema.js +40 -0
  70. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026002_CFG_SASS_extends.js +40 -0
  71. package/dist/m365/spfx/commands/project/project-upgrade/rules/FileAddRemoveRule.js +7 -0
  72. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0-beta.1.js +241 -0
  73. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  74. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  75. package/dist/m365/spo/commands/file/file-version-get.js +1 -0
  76. package/dist/m365/spo/commands/file/file-version-list.js +2 -2
  77. package/dist/m365/spo/commands/homesite/homesite-remove.js +57 -37
  78. package/dist/m365/spo/commands/list/list-view-add.js +140 -87
  79. package/dist/m365/spo/commands/page/Page.js +10 -3
  80. package/dist/m365/spo/commands/page/clientsidepages.js +4 -0
  81. package/dist/m365/spo/commands/page/page-section-add.js +73 -13
  82. package/dist/m365/spo/commands/page/page-section-list.js +5 -1
  83. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +13 -7
  84. package/dist/m365/spo/commands/site/site-appcatalog-list.js +38 -2
  85. package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +1 -1
  86. package/dist/m365/teams/commands/callrecord/callrecord-list.js +100 -0
  87. package/dist/m365/teams/commands/chat/chat-message-send.js +2 -2
  88. package/dist/m365/teams/commands/message/message-remove.js +2 -2
  89. package/dist/m365/teams/commands/message/message-restore.js +2 -2
  90. package/dist/m365/teams/commands.js +1 -0
  91. package/dist/m365/todo/commands/list/list-add.js +2 -2
  92. package/dist/m365/todo/commands/list/list-get.js +2 -2
  93. package/dist/m365/todo/commands/list/list-list.js +2 -2
  94. package/dist/m365/todo/commands/list/list-remove.js +2 -2
  95. package/dist/m365/todo/commands/list/list-set.js +2 -2
  96. package/dist/m365/todo/commands/task/task-add.js +2 -2
  97. package/dist/m365/todo/commands/task/task-get.js +2 -2
  98. package/dist/m365/todo/commands/task/task-list.js +2 -2
  99. package/dist/m365/todo/commands/task/task-remove.js +2 -2
  100. package/dist/m365/todo/commands/task/task-set.js +2 -2
  101. package/dist/m365/viva/commands/engage/EngageRole.js +2 -0
  102. package/dist/m365/viva/commands/engage/engage-role-list.js +28 -0
  103. package/dist/m365/viva/commands/engage/engage-role-member-list.js +57 -0
  104. package/dist/m365/viva/commands.js +2 -0
  105. package/dist/utils/accessToken.js +9 -5
  106. package/dist/utils/entraApp.js +15 -0
  107. package/dist/utils/entraGroup.js +43 -0
  108. package/dist/utils/vivaEngage.js +19 -0
  109. package/docs/docs/cmd/cli/app/app-add.mdx +50 -0
  110. package/docs/docs/cmd/entra/group/group-member-add.mdx +26 -5
  111. package/docs/docs/cmd/entra/group/group-member-set.mdx +7 -4
  112. package/docs/docs/cmd/entra/organization/organization-set.mdx +84 -0
  113. package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +53 -0
  114. package/docs/docs/cmd/spo/file/file-version-get.mdx +5 -2
  115. package/docs/docs/cmd/spo/file/file-version-list.mdx +7 -5
  116. package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +6 -3
  117. package/docs/docs/cmd/spo/list/list-view-add.mdx +53 -10
  118. package/docs/docs/cmd/spo/page/page-section-add.mdx +22 -2
  119. package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +11 -0
  120. package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +1 -1
  121. package/docs/docs/cmd/teams/callrecord/callrecord-list.mdx +173 -0
  122. package/docs/docs/cmd/viva/engage/engage-role-list.mdx +102 -0
  123. package/docs/docs/cmd/viva/engage/engage-role-member-list.mdx +118 -0
  124. package/npm-shrinkwrap.json +293 -765
  125. package/package.json +18 -17
@@ -0,0 +1,100 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
2
+ import { z } from 'zod';
3
+ import commands from '../../commands.js';
4
+ import GraphApplicationCommand from '../../../base/GraphApplicationCommand.js';
5
+ import { validation } from '../../../../utils/validation.js';
6
+ import { entraUser } from '../../../../utils/entraUser.js';
7
+ import { odata } from '../../../../utils/odata.js';
8
+ const options = globalOptionsZod
9
+ .extend({
10
+ userId: z.string()
11
+ .refine((val) => validation.isValidGuid(val), {
12
+ message: 'Invalid GUID.'
13
+ }).optional(),
14
+ userName: z.string()
15
+ .refine((val) => validation.isValidUserPrincipalName(val), {
16
+ message: 'Invalid user principal name.'
17
+ }).optional(),
18
+ startDateTime: z.string()
19
+ .refine((val) => {
20
+ if (!validation.isValidISODateTime(val)) {
21
+ return false;
22
+ }
23
+ const date = new Date(val);
24
+ const maxDate = new Date();
25
+ const minDate = new Date();
26
+ minDate.setDate(maxDate.getDate() - 30);
27
+ return date >= minDate && date <= maxDate;
28
+ }, {
29
+ message: 'Date must be a valid ISO date within the last 30 days and not in the future.'
30
+ }).optional(),
31
+ endDateTime: z.string()
32
+ .refine((val) => {
33
+ if (!validation.isValidISODateTime(val)) {
34
+ return false;
35
+ }
36
+ const date = new Date(val);
37
+ const maxDate = new Date();
38
+ const minDate = new Date();
39
+ minDate.setDate(maxDate.getDate() - 30);
40
+ return date >= minDate && date <= maxDate;
41
+ }, {
42
+ message: 'Date must be a valid ISO date within the last 30 days and not in the future.'
43
+ }).optional()
44
+ })
45
+ .strict();
46
+ class TeamsCallRecordListCommand extends GraphApplicationCommand {
47
+ get name() {
48
+ return commands.CALLRECORD_LIST;
49
+ }
50
+ get description() {
51
+ return 'Lists all Teams calls within the tenant';
52
+ }
53
+ defaultProperties() {
54
+ return ['id', 'type', 'startDateTime', 'endDateTime'];
55
+ }
56
+ get schema() {
57
+ return options;
58
+ }
59
+ getRefinedSchema(schema) {
60
+ return schema
61
+ .refine((options) => [options.userId, options.userName].filter(o => o !== undefined).length <= 1, {
62
+ message: 'Use one of the following options: userId or userName but not both.'
63
+ })
64
+ .refine((options) => [options.startDateTime, options.endDateTime].filter(o => o !== undefined).length <= 1 || new Date(options.startDateTime) < new Date(options.endDateTime), {
65
+ message: 'Value of startDateTime, must be before endDateTime.'
66
+ });
67
+ }
68
+ async commandAction(logger, args) {
69
+ try {
70
+ if (this.verbose) {
71
+ await logger.logToStderr(`Retrieving call records...`);
72
+ }
73
+ let apiUrl = `${this.resource}/v1.0/communications/callRecords`;
74
+ const filters = [];
75
+ if (args.options.userId || args.options.userName) {
76
+ let userId = args.options.userId;
77
+ if (args.options.userName) {
78
+ userId = await entraUser.getUserIdByUpn(args.options.userName);
79
+ }
80
+ filters.push(`participants_v2/any(p:p/id eq '${userId}')`);
81
+ }
82
+ if (args.options.startDateTime) {
83
+ filters.push(`startDateTime ge ${new Date(args.options.startDateTime).toISOString()}`);
84
+ }
85
+ if (args.options.endDateTime) {
86
+ filters.push(`startDateTime lt ${new Date(args.options.endDateTime).toISOString()}`);
87
+ }
88
+ if (filters.length > 0) {
89
+ apiUrl += `?$filter=${filters.join(' and ')}`;
90
+ }
91
+ const callRecords = await odata.getAllItems(apiUrl);
92
+ await logger.log(callRecords);
93
+ }
94
+ catch (err) {
95
+ this.handleRejectedODataJsonPromise(err);
96
+ }
97
+ }
98
+ }
99
+ export default new TeamsCallRecordListCommand();
100
+ //# sourceMappingURL=callrecord-list.js.map
@@ -12,8 +12,8 @@ import commands from '../../commands.js';
12
12
  import { chatUtil } from './chatUtil.js';
13
13
  import { cli } from '../../../../cli/cli.js';
14
14
  import { formatting } from '../../../../utils/formatting.js';
15
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
16
- class TeamsChatMessageSendCommand extends DelegatedGraphCommand {
15
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
16
+ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
17
17
  get name() {
18
18
  return commands.CHAT_MESSAGE_SEND;
19
19
  }
@@ -9,9 +9,9 @@ import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import { teams } from '../../../../utils/teams.js';
11
11
  import { validation } from '../../../../utils/validation.js';
12
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
12
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
13
13
  import commands from '../../commands.js';
14
- class TeamsMessageRemoveCommand extends DelegatedGraphCommand {
14
+ class TeamsMessageRemoveCommand extends GraphDelegatedCommand {
15
15
  get name() {
16
16
  return commands.MESSAGE_REMOVE;
17
17
  }
@@ -7,9 +7,9 @@ var _TeamsMessageRestoreCommand_instances, _TeamsMessageRestoreCommand_initTelem
7
7
  import request from '../../../../request.js';
8
8
  import { validation } from '../../../../utils/validation.js';
9
9
  import commands from '../../commands.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import { teams } from '../../../../utils/teams.js';
12
- class TeamsMessageRestoreCommand extends DelegatedGraphCommand {
12
+ class TeamsMessageRestoreCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.MESSAGE_RESTORE;
15
15
  }
@@ -7,6 +7,7 @@ export default {
7
7
  APP_UNINSTALL: `${prefix} app uninstall`,
8
8
  APP_UPDATE: `${prefix} app update`,
9
9
  CACHE_REMOVE: `${prefix} cache remove`,
10
+ CALLRECORD_LIST: `${prefix} callrecord list`,
10
11
  CHANNEL_ADD: `${prefix} channel add`,
11
12
  CHANNEL_GET: `${prefix} channel get`,
12
13
  CHANNEL_LIST: `${prefix} channel list`,
@@ -5,9 +5,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _TodoListAddCommand_instances, _TodoListAddCommand_initOptions;
7
7
  import request from '../../../../request.js';
8
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
8
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
9
9
  import commands from '../../commands.js';
10
- class TodoListAddCommand extends DelegatedGraphCommand {
10
+ class TodoListAddCommand extends GraphDelegatedCommand {
11
11
  get name() {
12
12
  return commands.LIST_ADD;
13
13
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoListGetCommand_instances, _TodoListGetCommand_initTelemetry, _TodoListGetCommand_initOptions, _TodoListGetCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
9
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoListGetCommand extends DelegatedGraphCommand {
11
+ class TodoListGetCommand extends GraphDelegatedCommand {
12
12
  get name() {
13
13
  return commands.LIST_GET;
14
14
  }
@@ -1,7 +1,7 @@
1
1
  import { odata } from '../../../../utils/odata.js';
2
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
2
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
3
3
  import commands from '../../commands.js';
4
- class TodoListListCommand extends DelegatedGraphCommand {
4
+ class TodoListListCommand extends GraphDelegatedCommand {
5
5
  get name() {
6
6
  return commands.LIST_LIST;
7
7
  }
@@ -7,9 +7,9 @@ var _TodoListRemoveCommand_instances, _TodoListRemoveCommand_initTelemetry, _Tod
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoListRemoveCommand extends DelegatedGraphCommand {
12
+ class TodoListRemoveCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.LIST_REMOVE;
15
15
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoListSetCommand_instances, _TodoListSetCommand_initTelemetry, _TodoListSetCommand_initOptions, _TodoListSetCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
9
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoListSetCommand extends DelegatedGraphCommand {
11
+ class TodoListSetCommand extends GraphDelegatedCommand {
12
12
  get name() {
13
13
  return commands.LIST_SET;
14
14
  }
@@ -7,9 +7,9 @@ var _TodoTaskAddCommand_instances, _a, _TodoTaskAddCommand_initTelemetry, _TodoT
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskAddCommand extends DelegatedGraphCommand {
12
+ class TodoTaskAddCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.TASK_ADD;
15
15
  }
@@ -7,9 +7,9 @@ var _TodoTaskGetCommand_instances, _TodoTaskGetCommand_initTelemetry, _TodoTaskG
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskGetCommand extends DelegatedGraphCommand {
12
+ class TodoTaskGetCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.TASK_GET;
15
15
  }
@@ -8,9 +8,9 @@ import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import { odata } from '../../../../utils/odata.js';
11
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
11
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
12
12
  import commands from '../../commands.js';
13
- class TodoTaskListCommand extends DelegatedGraphCommand {
13
+ class TodoTaskListCommand extends GraphDelegatedCommand {
14
14
  get name() {
15
15
  return commands.TASK_LIST;
16
16
  }
@@ -7,9 +7,9 @@ var _TodoTaskRemoveCommand_instances, _TodoTaskRemoveCommand_initTelemetry, _Tod
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskRemoveCommand extends DelegatedGraphCommand {
12
+ class TodoTaskRemoveCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.TASK_REMOVE;
15
15
  }
@@ -7,9 +7,9 @@ var _TodoTaskSetCommand_instances, _TodoTaskSetCommand_initTelemetry, _TodoTaskS
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
- import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskSetCommand extends DelegatedGraphCommand {
12
+ class TodoTaskSetCommand extends GraphDelegatedCommand {
13
13
  get name() {
14
14
  return commands.TASK_SET;
15
15
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EngageRole.js.map
@@ -0,0 +1,28 @@
1
+ import { odata } from '../../../../utils/odata.js';
2
+ import GraphCommand from '../../../base/GraphCommand.js';
3
+ import commands from '../../commands.js';
4
+ class VivaEngageRoleListCommand extends GraphCommand {
5
+ get name() {
6
+ return commands.ENGAGE_ROLE_LIST;
7
+ }
8
+ get description() {
9
+ return 'Lists all Viva Engage roles';
10
+ }
11
+ defaultProperties() {
12
+ return ['id', 'displayName'];
13
+ }
14
+ async commandAction(logger) {
15
+ if (this.verbose) {
16
+ await logger.logToStderr('Getting all Viva Engage roles...');
17
+ }
18
+ try {
19
+ const results = await odata.getAllItems(`${this.resource}/beta/employeeExperience/roles`);
20
+ await logger.log(results);
21
+ }
22
+ catch (err) {
23
+ this.handleRejectedODataJsonPromise(err);
24
+ }
25
+ }
26
+ }
27
+ export default new VivaEngageRoleListCommand();
28
+ //# sourceMappingURL=engage-role-list.js.map
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import { zod } from '../../../../utils/zod.js';
4
+ import { odata } from '../../../../utils/odata.js';
5
+ import GraphCommand from '../../../base/GraphCommand.js';
6
+ import commands from '../../commands.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ import { vivaEngage } from '../../../../utils/vivaEngage.js';
9
+ const options = globalOptionsZod
10
+ .extend({
11
+ roleId: zod.alias('i', z.string().refine(name => validation.isValidGuid(name), name => ({
12
+ message: `'${name}' is not a valid GUID.`
13
+ })).optional()),
14
+ roleName: zod.alias('n', z.string().optional())
15
+ })
16
+ .strict();
17
+ class VivaEngageRoleMemberListCommand extends GraphCommand {
18
+ get name() {
19
+ return commands.ENGAGE_ROLE_MEMBER_LIST;
20
+ }
21
+ get description() {
22
+ return 'Lists all users assigned to a Viva Engage role';
23
+ }
24
+ get schema() {
25
+ return options;
26
+ }
27
+ getRefinedSchema(schema) {
28
+ return schema
29
+ .refine(options => [options.roleId, options.roleName].filter(x => x !== undefined).length === 1, {
30
+ message: 'Specify either roleId, or roleName, but not both.'
31
+ });
32
+ }
33
+ defaultProperties() {
34
+ return ['id', 'userId'];
35
+ }
36
+ async commandAction(logger, args) {
37
+ let roleId = args.options.roleId;
38
+ try {
39
+ if (args.options.roleName) {
40
+ if (this.verbose) {
41
+ await logger.logToStderr(`Retrieving Viva Engage role ID for role name '${args.options.roleName}'...`);
42
+ }
43
+ roleId = await vivaEngage.getRoleIdByName(args.options.roleName);
44
+ }
45
+ if (this.verbose) {
46
+ await logger.logToStderr(`Getting all users assigned to a Viva Engage role ${roleId}...`);
47
+ }
48
+ const results = await odata.getAllItems(`${this.resource}/beta/employeeExperience/roles/${roleId}/members`);
49
+ await logger.log(results);
50
+ }
51
+ catch (err) {
52
+ this.handleRejectedODataJsonPromise(err);
53
+ }
54
+ }
55
+ }
56
+ export default new VivaEngageRoleMemberListCommand();
57
+ //# sourceMappingURL=engage-role-member-list.js.map
@@ -27,6 +27,8 @@ export default {
27
27
  ENGAGE_REPORT_GROUPSACTIVITYCOUNTS: `${prefix} engage report groupsactivitycounts`,
28
28
  ENGAGE_REPORT_GROUPSACTIVITYDETAIL: `${prefix} engage report groupsactivitydetail`,
29
29
  ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS: `${prefix} engage report groupsactivitygroupcounts`,
30
+ ENGAGE_ROLE_LIST: `${prefix} engage role list`,
31
+ ENGAGE_ROLE_MEMBER_LIST: `${prefix} engage role member list`,
30
32
  ENGAGE_SEARCH: `${prefix} engage search`,
31
33
  ENGAGE_USER_GET: `${prefix} engage user get`,
32
34
  ENGAGE_USER_LIST: `${prefix} engage user list`
@@ -84,17 +84,21 @@ export const accessToken = {
84
84
  return { header, payload };
85
85
  },
86
86
  /**
87
- * Asserts the presence of a delegated access token.
87
+ * Asserts the presence of a delegated or application-only access token.
88
88
  * @throws {CommandError} Will throw an error if the access token is not available.
89
- * @throws {CommandError} Will throw an error if the access token is an application-only access token.
89
+ * @throws {CommandError} Will throw an error if the access token type is not correct.
90
90
  */
91
- assertDelegatedAccessToken() {
91
+ assertAccessTokenType(type) {
92
92
  const accessToken = auth?.connection?.accessTokens?.[auth.defaultResource]?.accessToken;
93
93
  if (!accessToken) {
94
94
  throw new CommandError('No access token found.');
95
95
  }
96
- if (this.isAppOnlyAccessToken(accessToken)) {
97
- throw new CommandError('This command does not support application-only permissions.');
96
+ const isAppAccessToken = this.isAppOnlyAccessToken(accessToken);
97
+ if (type === 'delegated' && isAppAccessToken) {
98
+ throw new CommandError('This command requires delegated permissions.');
99
+ }
100
+ if (type === 'application' && !isAppAccessToken) {
101
+ throw new CommandError('This command requires application-only permissions.');
98
102
  }
99
103
  }
100
104
  };
@@ -308,6 +308,21 @@ export const entraApp = {
308
308
  return await cli.handleMultipleResultsFound(`Multiple apps with name '${appName}' found in Microsoft Entra ID.`, resultAsKeyValuePair);
309
309
  }
310
310
  return apps[0];
311
+ },
312
+ async getAppRegistrationByObjectId(objectId, properties) {
313
+ let url = `https://graph.microsoft.com/v1.0/applications/${objectId}`;
314
+ if (properties) {
315
+ url += `?$select=${properties.join(',')}`;
316
+ }
317
+ const requestOptions = {
318
+ url: url,
319
+ headers: {
320
+ accept: 'application/json;odata.metadata=none'
321
+ },
322
+ responseType: 'json'
323
+ };
324
+ const app = await request.get(requestOptions);
325
+ return app;
311
326
  }
312
327
  };
313
328
  //# sourceMappingURL=entraApp.js.map
@@ -142,6 +142,49 @@ export const entraGroup = {
142
142
  };
143
143
  const group = await request.get(requestOptions);
144
144
  return group.groupTypes.some(type => type === 'Unified');
145
+ },
146
+ /**
147
+ * Retrieve the IDs of groups by their display names. There is no guarantee that the order of the returned IDs will match the order of the specified names.
148
+ * @param names Array of group names.
149
+ * @returns Array of group IDs.
150
+ */
151
+ async getGroupIdsByDisplayNames(names) {
152
+ const groupIds = [];
153
+ for (let i = 0; i < names.length; i += 20) {
154
+ const namesChunk = names.slice(i, i + 20);
155
+ const requestOptions = {
156
+ url: `${graphResource}/v1.0/$batch`,
157
+ headers: {
158
+ accept: 'application/json;odata.metadata=none'
159
+ },
160
+ responseType: 'json',
161
+ data: {
162
+ requests: namesChunk.map((name, index) => ({
163
+ id: index + 1,
164
+ method: 'GET',
165
+ url: `/groups?$filter=displayName eq '${formatting.encodeQueryParameter(name)}'&$select=id`,
166
+ headers: {
167
+ accept: 'application/json;odata.metadata=none'
168
+ }
169
+ }))
170
+ }
171
+ };
172
+ const res = await request.post(requestOptions);
173
+ for (const response of res.responses) {
174
+ if (response.body.value.length === 1) {
175
+ groupIds.push(response.body.value[0].id);
176
+ }
177
+ else if (response.body.value.length > 1) {
178
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.body.value);
179
+ const result = await cli.handleMultipleResultsFound(`Multiple groups with the name '${namesChunk[response.id - 1]}' found.`, resultAsKeyValuePair);
180
+ groupIds.push(result.id);
181
+ }
182
+ else {
183
+ throw Error(`The specified group with name '${namesChunk[response.id - 1]}' does not exist.`);
184
+ }
185
+ }
186
+ }
187
+ return groupIds;
145
188
  }
146
189
  };
147
190
  //# sourceMappingURL=entraGroup.js.map
@@ -56,6 +56,25 @@ export const vivaEngage = {
56
56
  throw `The Microsoft Entra group with id '${entraGroupId}' is not associated with any Viva Engage community.`;
57
57
  }
58
58
  return filteredCommunity;
59
+ },
60
+ /**
61
+ * Get the ID of a Viva Engage role by its display name.
62
+ * @param roleName The display name of the role.
63
+ * @returns The ID of the role.
64
+ */
65
+ async getRoleIdByName(roleName) {
66
+ // This endpoint doesn't support filtering by displayName
67
+ const response = await odata.getAllItems('https://graph.microsoft.com/beta/employeeExperience/roles');
68
+ const roles = response.filter(role => role.displayName.toLowerCase() === roleName.toLowerCase());
69
+ if (roles.length === 0) {
70
+ throw new Error(`The specified Viva Engage role '${roleName}' does not exist.`);
71
+ }
72
+ if (roles.length > 1) {
73
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', roles);
74
+ const selectedRole = await cli.handleMultipleResultsFound(`Multiple Viva Engage roles with name '${roleName}' found.`, resultAsKeyValuePair);
75
+ return selectedRole.id;
76
+ }
77
+ return roles[0].id;
59
78
  }
60
79
  };
61
80
  //# sourceMappingURL=vivaEngage.js.map
@@ -0,0 +1,50 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+
3
+ # cli app add
4
+
5
+ Create a new app registration to use for the CLI for Microsoft 365
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ m365 cli app add [options]
11
+ ```
12
+
13
+ ## Options
14
+
15
+ ```md definition-list
16
+ `-n, --name [name]`
17
+ : Name of the app registration. Defaults to CLI for M365
18
+
19
+ `-s, --scopes [scopes]`
20
+ : Which scopes should be added? Valid values are: `minimal`, `all`, or a list of scopes. Defaults to `minimal`.
21
+
22
+ `--saveToConfig`
23
+ : Save the app registration info to the CLI config. This way the new app registration will be used as the default app registration to sign in.
24
+ ```
25
+
26
+ <Global />
27
+
28
+ ## Examples
29
+
30
+ Create a new app registration to use for CLI for Microsoft 365
31
+
32
+ ```sh
33
+ m365 cli app add
34
+ ```
35
+
36
+ Create a new app registration with all permission scopes and a custom name
37
+
38
+ ```sh
39
+ m365 cli app add --name "Contoso CLI app" --scopes all
40
+ ```
41
+
42
+ Create a new app registration with self-defined scopes
43
+
44
+ ```sh
45
+ m365 cli app add --scopes "https://graph.microsoft.com/User.Read,https://graph.microsoft.com/Group.Read.All"
46
+ ```
47
+
48
+ ## Response
49
+
50
+ The command won't return a response on success
@@ -23,10 +23,19 @@ m365 entra group member add [options]
23
23
  : The display name of the Microsoft Entra group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
24
24
 
25
25
  `--ids [ids]`
26
- : Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both.
26
+ : (deprecated. Use option `userIds` instead) Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids`, `userIds`,`userNames`, `subgroupIds`, or `subgroupNames` but not multiple.
27
+
28
+ `--userIds [userIds]`
29
+ : Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids`, `userIds`,`userNames`, `subgroupIds`, or `subgroupNames` but not multiple.
27
30
 
28
31
  `--userNames [userNames]`
29
- : The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both.
32
+ : The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids`, `userIds`,`userNames`, `subgroupIds`, or `subgroupNames` but not multiple.
33
+
34
+ `--subgroupIds [subgroupIds]`
35
+ : Comma-separated list of Microsoft Entra group IDs to add. Specify either `ids`, `userIds`,`userNames`, `subgroupIds`, or `subgroupNames` but not multiple.
36
+
37
+ `--subgroupNames [subgroupNames]`
38
+ : Comma-separated list of Microsoft Entra group titles to add. Specify either `ids`, `userIds`,`userNames`, `subgroupIds`, or `subgroupNames` but not multiple.
30
39
 
31
40
  `-r, --role <role>`
32
41
  : The role to be assigned to the new users. Valid values: `Owner`, `Member`.
@@ -39,19 +48,19 @@ m365 entra group member add [options]
39
48
  Add a single member specified by ID as a member to a group specified by display name.
40
49
 
41
50
  ```sh
42
- m365 entra group member add --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
51
+ m365 entra group member add --groupDisplayName Developers --userIds 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
43
52
  ```
44
53
 
45
54
  Add a single member specified by ID as a member to a group specified by group name.
46
55
 
47
56
  ```sh
48
- m365 entra group member add --groupName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
57
+ m365 entra group member add --groupName Developers --userIds 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
49
58
  ```
50
59
 
51
60
  Add multiple members specified by ID as members to a group specified by ID.
52
61
 
53
62
  ```sh
54
- m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member
63
+ m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userIds "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member
55
64
  ```
56
65
 
57
66
  Add a single member specified by UPN as an owner to a group specified by display name.
@@ -72,6 +81,18 @@ Adds multiple members specified by UPN as owners to a group specified by ID.
72
81
  m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner
73
82
  ```
74
83
 
84
+ Add multiple members (subgroups) specified by ID as members to a group specified by ID.
85
+
86
+ ```sh
87
+ m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --subgroupIds "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member
88
+ ```
89
+
90
+ Adds multiple members (subgroups) specified by name as members to a group specified by ID.
91
+
92
+ ```sh
93
+ m365 entra group member add --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --subgroupNames "Developers,Human Resources" --role Member
94
+ ```
95
+
75
96
  ## Response
76
97
 
77
98
  The command won't return a response on success.