@pnp/cli-microsoft365 10.10.0 → 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 (115) 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/outlook/commands/message/message-move.js +1 -1
  27. package/dist/m365/pp/commands/managementapp/managementapp-add.js +7 -21
  28. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +96 -0
  29. package/dist/m365/spe/commands.js +1 -0
  30. package/dist/m365/spfx/commands/project/base-project-command.js +1 -0
  31. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.0.js +2 -0
  32. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.1.js +2 -0
  33. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.22.0-beta.1.js +21 -0
  34. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002022_DEVDEP_typescript.js +10 -0
  35. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  36. package/dist/m365/spfx/commands/project/project-model/SassJson.js +2 -0
  37. package/dist/m365/spfx/commands/project/project-model/index.js +1 -0
  38. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002001_DEVDEP_microsoft_sp_build_web.js +2 -2
  39. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002004_DEVDEP_gulp.js +2 -2
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002007_DEVDEP_ajv.js +2 -2
  41. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002029_DEVDEP_microsoft_rush_stack_compiler_5_3.js +2 -2
  42. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002030_DEVDEP_microsoft_spfx_web_build_rig.js +10 -0
  43. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002031_DEVDEP_rushstack_heft.js +10 -0
  44. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002032_DEVDEP_typescript_eslint_parser.js +10 -0
  45. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002033_DEVDEP_jest_junit.js +10 -0
  46. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010011_YORC_useGulp.js +40 -0
  47. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015010_FILE_gulpfile_js.js +10 -0
  48. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015011_FILE_tsconfig_json.js +10 -0
  49. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015012_FILE_config_heft_json.js +10 -0
  50. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015013_FILE_config_jest_config_json.js +10 -0
  51. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015014_FILE_config_rig_json.js +10 -0
  52. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015015_FILE_config_typescript_json.js +10 -0
  53. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021004_PKG_scripts_build.js +45 -0
  54. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021005_PKG_scripts_test.js +45 -0
  55. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021006_PKG_scripts_clean.js +45 -0
  56. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021007_PKG_scripts_deploy.js +45 -0
  57. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021008_PKG_scripts_start.js +45 -0
  58. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_scripts_build_watch.js +45 -0
  59. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021010_PKG_scripts_package_solution.js +45 -0
  60. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021011_PKG_scripts_deploy_azure_storage.js +45 -0
  61. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021012_PKG_scripts_eject_webpack.js +45 -0
  62. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021013_PKG_overrides_rushstack_heft.js +45 -0
  63. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023003_GITIGNORE_libdts.js +36 -0
  64. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023004_GITIGNORE_libcommonjs.js +36 -0
  65. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023005_GITIGNORE_libesm.js +36 -0
  66. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023006_GITIGNORE_jestoutput.js +36 -0
  67. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026001_CFG_SASS_schema.js +40 -0
  68. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026002_CFG_SASS_extends.js +40 -0
  69. package/dist/m365/spfx/commands/project/project-upgrade/rules/FileAddRemoveRule.js +7 -0
  70. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0-beta.1.js +241 -0
  71. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  72. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  73. package/dist/m365/spo/commands/file/file-version-get.js +1 -0
  74. package/dist/m365/spo/commands/file/file-version-list.js +2 -2
  75. package/dist/m365/spo/commands/page/Page.js +10 -3
  76. package/dist/m365/spo/commands/page/page-section-list.js +5 -1
  77. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +13 -7
  78. package/dist/m365/spo/commands/site/site-appcatalog-list.js +38 -2
  79. package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +1 -1
  80. package/dist/m365/teams/commands/callrecord/callrecord-list.js +100 -0
  81. package/dist/m365/teams/commands/chat/chat-message-send.js +2 -2
  82. package/dist/m365/teams/commands/message/message-remove.js +2 -2
  83. package/dist/m365/teams/commands/message/message-restore.js +2 -2
  84. package/dist/m365/teams/commands.js +1 -0
  85. package/dist/m365/todo/commands/list/list-add.js +2 -2
  86. package/dist/m365/todo/commands/list/list-get.js +2 -2
  87. package/dist/m365/todo/commands/list/list-list.js +2 -2
  88. package/dist/m365/todo/commands/list/list-remove.js +2 -2
  89. package/dist/m365/todo/commands/list/list-set.js +2 -2
  90. package/dist/m365/todo/commands/task/task-add.js +2 -2
  91. package/dist/m365/todo/commands/task/task-get.js +2 -2
  92. package/dist/m365/todo/commands/task/task-list.js +2 -2
  93. package/dist/m365/todo/commands/task/task-remove.js +2 -2
  94. package/dist/m365/todo/commands/task/task-set.js +2 -2
  95. package/dist/m365/viva/commands/engage/EngageRole.js +2 -0
  96. package/dist/m365/viva/commands/engage/engage-role-list.js +28 -0
  97. package/dist/m365/viva/commands/engage/engage-role-member-list.js +57 -0
  98. package/dist/m365/viva/commands.js +2 -0
  99. package/dist/utils/accessToken.js +9 -5
  100. package/dist/utils/entraApp.js +15 -0
  101. package/dist/utils/entraGroup.js +43 -0
  102. package/dist/utils/vivaEngage.js +19 -0
  103. package/docs/docs/cmd/cli/app/app-add.mdx +50 -0
  104. package/docs/docs/cmd/entra/group/group-member-add.mdx +26 -5
  105. package/docs/docs/cmd/entra/group/group-member-set.mdx +7 -4
  106. package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +53 -0
  107. package/docs/docs/cmd/spo/file/file-version-get.mdx +5 -2
  108. package/docs/docs/cmd/spo/file/file-version-list.mdx +7 -5
  109. package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +11 -0
  110. package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +1 -1
  111. package/docs/docs/cmd/teams/callrecord/callrecord-list.mdx +173 -0
  112. package/docs/docs/cmd/viva/engage/engage-role-list.mdx +102 -0
  113. package/docs/docs/cmd/viva/engage/engage-role-member-list.mdx +118 -0
  114. package/npm-shrinkwrap.json +293 -765
  115. package/package.json +19 -18
@@ -18,7 +18,7 @@ class SpoFileVersionListCommand extends SpoCommand {
18
18
  return 'Retrieves all versions of a file';
19
19
  }
20
20
  defaultProperties() {
21
- return ['Created', 'ID', 'IsCurrentVersion', 'VersionLabel'];
21
+ return ['Created', 'ID', 'IsCurrentVersion', 'VersionLabel', 'ExpirationDate'];
22
22
  }
23
23
  constructor() {
24
24
  super();
@@ -42,7 +42,7 @@ class SpoFileVersionListCommand extends SpoCommand {
42
42
  else {
43
43
  requestUrl += `/GetFileById('${args.options.fileId}')`;
44
44
  }
45
- requestUrl += `/versions`;
45
+ requestUrl += `/versions?$select=*,ExpirationDate`;
46
46
  const response = await odata.getAllItems(requestUrl);
47
47
  await logger.log(response);
48
48
  }
@@ -72,10 +72,14 @@ export class Page {
72
72
  return output;
73
73
  }
74
74
  static getSectionInformation(section, isJSONOutput) {
75
- return {
76
- order: section.order,
77
- columns: section.columns.map(column => this.getColumnsInformation(column, isJSONOutput))
75
+ const sectionOutput = {
76
+ order: section.order
78
77
  };
78
+ if (this.isVerticalSection(section)) {
79
+ sectionOutput.isVertical = true;
80
+ }
81
+ sectionOutput.columns = section.columns.map(column => this.getColumnsInformation(column, isJSONOutput));
82
+ return sectionOutput;
79
83
  }
80
84
  /**
81
85
  * Publish a modern page in SharePoint Online
@@ -99,5 +103,8 @@ export class Page {
99
103
  }
100
104
  return pageName;
101
105
  }
106
+ static isVerticalSection(section) {
107
+ return section.layoutIndex === 2 && section?.controlData?.position?.sectionFactor === 12;
108
+ }
102
109
  }
103
110
  //# sourceMappingURL=Page.js.map
@@ -34,10 +34,14 @@ class SpoPageSectionListCommand extends SpoCommand {
34
34
  }
35
35
  else {
36
36
  await logger.log(output.map(s => {
37
- return {
37
+ const sectionOutput = {
38
38
  order: s.order,
39
39
  columns: s.columns.length
40
40
  };
41
+ if (s.isVertical) {
42
+ sectionOutput.isVertical = s.isVertical;
43
+ }
44
+ return sectionOutput;
41
45
  }));
42
46
  }
43
47
  }
@@ -45,9 +45,6 @@ class SpoServicePrincipalPermissionRequestListCommand extends SpoCommand {
45
45
  }
46
46
  }
47
47
  }
48
- if (spoWebAppServicePrincipalPermissionRequestResult.length === 0) {
49
- spoWebAppServicePrincipalPermissionRequestResult = result;
50
- }
51
48
  await logger.log(spoWebAppServicePrincipalPermissionRequestResult.map(r => {
52
49
  return {
53
50
  Id: r.Id.replace('/Guid(', '').replace(')/', ''),
@@ -71,14 +68,23 @@ class SpoServicePrincipalPermissionRequestListCommand extends SpoCommand {
71
68
  responseType: 'json'
72
69
  };
73
70
  const response = await request.get(requestOptions);
74
- if (response.value && response.value.length > 0) {
75
- return response.value[0].scope.split(' ');
71
+ if (!response.value || response.value.length === 0) {
72
+ return null;
76
73
  }
77
- return null;
74
+ const scopes = [];
75
+ response.value.forEach(grant => {
76
+ if (grant.scope) {
77
+ grant.scope.split(' ')
78
+ .map(permission => permission.trim())
79
+ .filter(Boolean)
80
+ .forEach(permission => scopes.push(permission));
81
+ }
82
+ });
83
+ return scopes;
78
84
  }
79
85
  async getSPOClientExtensibilityWebApplicationPrincipalId() {
80
86
  const requestOptions = {
81
- url: `https://graph.microsoft.com/v1.0/servicePrincipals/?$filter=displayName eq 'SharePoint Online Client Extensibility Web Application Principal'`,
87
+ url: `https://graph.microsoft.com/v1.0/servicePrincipals/?$filter=displayName eq 'SharePoint Online Web Client Extensibility'`,
82
88
  headers: {
83
89
  accept: 'application/json;odata.metadata=none'
84
90
  },
@@ -1,7 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import { zod } from '../../../../utils/zod.js';
1
4
  import { odata } from '../../../../utils/odata.js';
2
5
  import { spo } from '../../../../utils/spo.js';
3
6
  import SpoCommand from '../../../base/SpoCommand.js';
4
7
  import commands from '../../commands.js';
8
+ const options = globalOptionsZod
9
+ .extend({
10
+ excludeDeletedSites: zod.alias('excludeDeletedSites', z.boolean().optional())
11
+ })
12
+ .strict();
5
13
  class SpoSiteAppCatalogListCommand extends SpoCommand {
6
14
  get name() {
7
15
  return commands.SITE_APPCATALOG_LIST;
@@ -9,16 +17,44 @@ class SpoSiteAppCatalogListCommand extends SpoCommand {
9
17
  get description() {
10
18
  return 'List all site collection app catalogs within the tenant';
11
19
  }
20
+ get schema() {
21
+ return options;
22
+ }
12
23
  defaultProperties() {
13
24
  return ['AbsoluteUrl', 'SiteID'];
14
25
  }
15
- async commandAction(logger) {
26
+ async commandAction(logger, args) {
16
27
  try {
17
28
  if (this.verbose) {
18
29
  await logger.logToStderr('Retrieving site collection app catalogs...');
19
30
  }
20
31
  const spoUrl = await spo.getSpoUrl(logger, this.debug);
21
- const appCatalogs = await odata.getAllItems(`${spoUrl}/_api/Web/TenantAppCatalog/SiteCollectionAppCatalogsSites`);
32
+ let appCatalogs = await odata.getAllItems(`${spoUrl}/_api/Web/TenantAppCatalog/SiteCollectionAppCatalogsSites`);
33
+ if (args.options.excludeDeletedSites) {
34
+ if (this.verbose) {
35
+ await logger.logToStderr('Excluding inaccessible sites from the results...');
36
+ }
37
+ const activeAppCatalogs = [];
38
+ for (const appCatalog of appCatalogs) {
39
+ try {
40
+ await spo.getWeb(appCatalog.AbsoluteUrl, logger, this.verbose);
41
+ activeAppCatalogs.push(appCatalog);
42
+ }
43
+ catch (error) {
44
+ if (this.debug) {
45
+ await logger.logToStderr(error);
46
+ }
47
+ if (error.status === 404 || error.status === 403) {
48
+ if (this.verbose) {
49
+ await logger.logToStderr(`Site at '${appCatalog.AbsoluteUrl}' is inaccessible. Excluding from results...`);
50
+ }
51
+ continue;
52
+ }
53
+ throw error;
54
+ }
55
+ }
56
+ appCatalogs = activeAppCatalogs;
57
+ }
22
58
  await logger.log(appCatalogs);
23
59
  }
24
60
  catch (err) {
@@ -31,7 +31,7 @@ class SpoTenantSiteUnarchiveCommand extends SpoCommand {
31
31
  await this.unarchiveSite(logger, args.options.url);
32
32
  }
33
33
  else {
34
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'? This may cause additional billing costs.` });
34
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'? You won't be able to rearchive this site for 120 days.` });
35
35
  if (result) {
36
36
  await this.unarchiveSite(logger, args.options.url);
37
37
  }
@@ -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