@pnp/cli-microsoft365 7.9.0-beta.bd3bb30 → 7.9.0-beta.c7bc5b8

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 (40) hide show
  1. package/.eslintrc.cjs +2 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/m365/base/DelegatedGraphCommand.js +17 -0
  5. package/dist/m365/base/PowerAppsCommand.js +2 -0
  6. package/dist/m365/base/PowerAutomateCommand.js +2 -0
  7. package/dist/m365/base/PowerBICommand.js +10 -0
  8. package/dist/m365/base/PowerPlatformCommand.js +2 -0
  9. package/dist/m365/base/VivaEngageCommand.js +10 -0
  10. package/dist/m365/commands/commands.js +1 -0
  11. package/dist/m365/commands/search.js +176 -0
  12. package/dist/m365/entra/commands/group/group-user-set.js +206 -0
  13. package/dist/m365/entra/commands/user/user-groupmembership-list.js +92 -0
  14. package/dist/m365/entra/commands/user/user-list.js +47 -44
  15. package/dist/m365/entra/commands.js +2 -0
  16. package/dist/m365/outlook/commands/message/message-move.js +2 -2
  17. package/dist/m365/spfx/commands/spfx-doctor.js +2 -2
  18. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +44 -23
  19. package/dist/m365/teams/commands/chat/chat-message-send.js +2 -2
  20. package/dist/m365/todo/commands/list/list-add.js +2 -2
  21. package/dist/m365/todo/commands/list/list-get.js +2 -2
  22. package/dist/m365/todo/commands/list/list-list.js +2 -2
  23. package/dist/m365/todo/commands/list/list-remove.js +2 -2
  24. package/dist/m365/todo/commands/list/list-set.js +2 -2
  25. package/dist/m365/todo/commands/task/task-add.js +2 -2
  26. package/dist/m365/todo/commands/task/task-get.js +2 -2
  27. package/dist/m365/todo/commands/task/task-list.js +2 -2
  28. package/dist/m365/todo/commands/task/task-remove.js +2 -2
  29. package/dist/m365/todo/commands/task/task-set.js +2 -2
  30. package/dist/m365/viva/commands/engage/engage-community-get.js +49 -0
  31. package/dist/m365/viva/commands.js +1 -0
  32. package/dist/utils/accessToken.js +16 -0
  33. package/dist/utils/validation.js +3 -3
  34. package/docs/docs/cmd/entra/group/group-user-set.mdx +62 -0
  35. package/docs/docs/cmd/entra/user/user-groupmembership-list.mdx +121 -0
  36. package/docs/docs/cmd/entra/user/user-list.mdx +24 -9
  37. package/docs/docs/cmd/search.mdx +260 -0
  38. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +3 -11
  39. package/docs/docs/cmd/viva/engage/engage-community-get.mdx +94 -0
  40. package/package.json +1 -1
@@ -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 _EntraUserListCommand_instances, _EntraUserListCommand_initTelemetry, _EntraUserListCommand_initOptions;
6
+ var _EntraUserListCommand_instances, _a, _EntraUserListCommand_initTelemetry, _EntraUserListCommand_initOptions, _EntraUserListCommand_initValidators, _EntraUserListCommand_initTypes;
7
7
  import { formatting } from '../../../../utils/formatting.js';
8
8
  import { odata } from '../../../../utils/odata.js';
9
9
  import GraphCommand from '../../../base/GraphCommand.js';
@@ -22,31 +22,36 @@ class EntraUserListCommand extends GraphCommand {
22
22
  allowUnknownOptions() {
23
23
  return true;
24
24
  }
25
+ defaultProperties() {
26
+ return ['id', 'displayName', 'mail', 'userPrincipalName'];
27
+ }
25
28
  constructor() {
26
29
  super();
27
30
  _EntraUserListCommand_instances.add(this);
28
31
  __classPrivateFieldGet(this, _EntraUserListCommand_instances, "m", _EntraUserListCommand_initTelemetry).call(this);
29
32
  __classPrivateFieldGet(this, _EntraUserListCommand_instances, "m", _EntraUserListCommand_initOptions).call(this);
33
+ __classPrivateFieldGet(this, _EntraUserListCommand_instances, "m", _EntraUserListCommand_initValidators).call(this);
34
+ __classPrivateFieldGet(this, _EntraUserListCommand_instances, "m", _EntraUserListCommand_initTypes).call(this);
30
35
  }
31
36
  async commandAction(logger, args) {
32
37
  await this.showDeprecationWarning(logger, aadCommands.USER_LIST, commands.USER_LIST);
33
38
  try {
34
- const selectProperties = args.options.properties ? args.options.properties : 'id,displayName,mail,userPrincipalName';
35
- const allSelectProperties = selectProperties.split(',');
36
- const propertiesWithSlash = allSelectProperties.filter(item => item.includes('/'));
37
- const fieldExpand = propertiesWithSlash
38
- .map(p => `${p.split('/')[0]}($select=${p.split('/')[1]})`)
39
- .join(',');
40
- const expandParam = fieldExpand.length > 0 ? `&$expand=${fieldExpand}` : '';
41
- const selectParam = allSelectProperties.filter(item => !item.includes('/'));
42
- let filter = '';
43
- try {
44
- filter = this.getFilter(args.options);
39
+ let url = `${this.resource}/v1.0/users`;
40
+ if (args.options.properties) {
41
+ const selectProperties = args.options.properties;
42
+ const allSelectProperties = selectProperties.split(',');
43
+ const propertiesWithSlash = allSelectProperties.filter(item => item.includes('/'));
44
+ const fieldExpand = propertiesWithSlash
45
+ .map(p => `${p.split('/')[0]}($select=${p.split('/')[1]})`)
46
+ .join(',');
47
+ const expandParam = fieldExpand.length > 0 ? `&$expand=${fieldExpand}` : '';
48
+ const selectParam = allSelectProperties.filter(item => !item.includes('/'));
49
+ url += `?$select=${selectParam}${expandParam}`;
45
50
  }
46
- catch (ex) {
47
- throw ex;
51
+ const filter = this.getFilter(args.options);
52
+ if (filter) {
53
+ url += `${args.options.properties ? '&' : '?'}${filter}`;
48
54
  }
49
- const url = `${this.resource}/v1.0/users?$select=${selectParam}${expandParam}${(filter.length > 0 ? '&' + filter : '')}&$top=100`;
50
55
  const users = await odata.getAllItems(url);
51
56
  await logger.log(users);
52
57
  }
@@ -55,38 +60,24 @@ class EntraUserListCommand extends GraphCommand {
55
60
  }
56
61
  }
57
62
  getFilter(options) {
58
- const filters = {};
59
- const excludeOptions = [
60
- 'type',
61
- 'properties',
62
- 'p',
63
- 'd',
64
- 'debug',
65
- 'verbose',
66
- 'output',
67
- 'o',
68
- 'query',
69
- '_'
70
- ];
71
- Object.keys(options).forEach(key => {
72
- if (excludeOptions.indexOf(key) === -1) {
73
- if (typeof options[key] === 'boolean') {
74
- throw `Specify value for the ${key} property`;
75
- }
76
- filters[key] = formatting.encodeQueryParameter(options[key].toString());
63
+ const filters = [];
64
+ const unknownOptions = this.getUnknownOptions(options);
65
+ Object.keys(unknownOptions).forEach(key => {
66
+ if (typeof options[key] === 'boolean') {
67
+ throw `Specify value for the ${key} property`;
77
68
  }
69
+ filters.push(`startsWith(${key}, '${formatting.encodeQueryParameter(options[key].toString())}')`);
78
70
  });
79
- let filter = Object.keys(filters).map(key => `startsWith(${key}, '${filters[key]}')`).join(' and ');
80
- if (filter.length > 0) {
81
- filter = `$filter=${filter}`;
82
- }
83
71
  if (options.type) {
84
- filter += filter.length > 0 ? ` and userType eq '${options.type}'` : `$filter=userType eq '${options.type}'`;
72
+ filters.push(`userType eq '${options.type}'`);
85
73
  }
86
- return filter;
74
+ if (filters.length > 0) {
75
+ return `$filter=${filters.join(' and ')}`;
76
+ }
77
+ return null;
87
78
  }
88
79
  }
89
- _EntraUserListCommand_instances = new WeakSet(), _EntraUserListCommand_initTelemetry = function _EntraUserListCommand_initTelemetry() {
80
+ _a = EntraUserListCommand, _EntraUserListCommand_instances = new WeakSet(), _EntraUserListCommand_initTelemetry = function _EntraUserListCommand_initTelemetry() {
90
81
  this.telemetry.push((args) => {
91
82
  Object.assign(this.telemetryProperties, {
92
83
  type: typeof args.options.type !== 'undefined',
@@ -95,9 +86,21 @@ _EntraUserListCommand_instances = new WeakSet(), _EntraUserListCommand_initTelem
95
86
  });
96
87
  }, _EntraUserListCommand_initOptions = function _EntraUserListCommand_initOptions() {
97
88
  this.options.unshift({
98
- option: "--type [type]",
99
- autocomplete: ["Member", "Guest"]
100
- }, { option: '-p, --properties [properties]' });
89
+ option: '--type [type]',
90
+ autocomplete: _a.allowedTypes
91
+ }, {
92
+ option: '-p, --properties [properties]'
93
+ });
94
+ }, _EntraUserListCommand_initValidators = function _EntraUserListCommand_initValidators() {
95
+ this.validators.push(async (args) => {
96
+ if (args.options.type && !_a.allowedTypes.some(t => t.toLowerCase() === args.options.type.toLowerCase())) {
97
+ return `'${args.options.type}' is not a valid value for option 'type'. Allowed values are: ${_a.allowedTypes.join(', ')}.`;
98
+ }
99
+ return true;
100
+ });
101
+ }, _EntraUserListCommand_initTypes = function _EntraUserListCommand_initTypes() {
102
+ this.types.string.push('type', 'properties');
101
103
  };
104
+ EntraUserListCommand.allowedTypes = ['Member', 'Guest'];
102
105
  export default new EntraUserListCommand();
103
106
  //# sourceMappingURL=user-list.js.map
@@ -40,6 +40,7 @@ export default {
40
40
  GROUP_REMOVE: `${prefix} group remove`,
41
41
  GROUP_USER_ADD: `${prefix} group user add`,
42
42
  GROUP_USER_LIST: `${prefix} group user list`,
43
+ GROUP_USER_SET: `${prefix} group user set`,
43
44
  GROUPSETTING_ADD: `${prefix} groupsetting add`,
44
45
  GROUPSETTING_GET: `${prefix} groupsetting get`,
45
46
  GROUPSETTING_LIST: `${prefix} groupsetting list`,
@@ -87,6 +88,7 @@ export default {
87
88
  USER_ADD: `${prefix} user add`,
88
89
  USER_GET: `${prefix} user get`,
89
90
  USER_GUEST_ADD: `${prefix} user guest add`,
91
+ USER_GROUPMEMBERSHIP_LIST: `${prefix} user groupmembership list`,
90
92
  USER_HIBP: `${prefix} user hibp`,
91
93
  USER_LICENSE_ADD: `${prefix} user license add`,
92
94
  USER_LICENSE_LIST: `${prefix} user license list`,
@@ -6,11 +6,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _OutlookMessageMoveCommand_instances, _OutlookMessageMoveCommand_initTelemetry, _OutlookMessageMoveCommand_initOptions, _OutlookMessageMoveCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
- import GraphCommand from '../../../base/GraphCommand.js';
10
9
  import commands from '../../commands.js';
11
10
  import { Outlook } from '../../Outlook.js';
12
11
  import { cli } from '../../../../cli/cli.js';
13
- class OutlookMessageMoveCommand extends GraphCommand {
12
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
13
+ class OutlookMessageMoveCommand extends DelegatedGraphCommand {
14
14
  get name() {
15
15
  return commands.MESSAGE_MOVE;
16
16
  }
@@ -563,8 +563,8 @@ class SpfxDoctorCommand extends BaseProjectCommand {
563
563
  },
564
564
  '1.19.0': {
565
565
  gulpCli: {
566
- range: '^1 || ^2',
567
- fix: 'npm i -g gulp-cli@2'
566
+ range: '^1 || ^2 || ^3',
567
+ fix: 'npm i -g gulp-cli@3'
568
568
  },
569
569
  node: {
570
570
  range: '>=18.17.1 <19.0.0',
@@ -3,13 +3,15 @@ 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 _SpoTenantRecycleBinItemRestoreCommand_instances, _SpoTenantRecycleBinItemRestoreCommand_initTelemetry, _SpoTenantRecycleBinItemRestoreCommand_initOptions, _SpoTenantRecycleBinItemRestoreCommand_initValidators;
6
+ var _SpoTenantRecycleBinItemRestoreCommand_instances, _SpoTenantRecycleBinItemRestoreCommand_initTelemetry, _SpoTenantRecycleBinItemRestoreCommand_initOptions, _SpoTenantRecycleBinItemRestoreCommand_initValidators, _SpoTenantRecycleBinItemRestoreCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
+ import { formatting } from '../../../../utils/formatting.js';
9
+ import { odata } from '../../../../utils/odata.js';
8
10
  import { spo } from '../../../../utils/spo.js';
11
+ import { urlUtil } from '../../../../utils/urlUtil.js';
9
12
  import { validation } from '../../../../utils/validation.js';
10
13
  import SpoCommand from '../../../base/SpoCommand.js';
11
14
  import commands from '../../commands.js';
12
- import { setTimeout } from 'timers/promises';
13
15
  class SpoTenantRecycleBinItemRestoreCommand extends SpoCommand {
14
16
  get name() {
15
17
  return commands.TENANT_RECYCLEBINITEM_RESTORE;
@@ -23,48 +25,64 @@ class SpoTenantRecycleBinItemRestoreCommand extends SpoCommand {
23
25
  __classPrivateFieldGet(this, _SpoTenantRecycleBinItemRestoreCommand_instances, "m", _SpoTenantRecycleBinItemRestoreCommand_initTelemetry).call(this);
24
26
  __classPrivateFieldGet(this, _SpoTenantRecycleBinItemRestoreCommand_instances, "m", _SpoTenantRecycleBinItemRestoreCommand_initOptions).call(this);
25
27
  __classPrivateFieldGet(this, _SpoTenantRecycleBinItemRestoreCommand_instances, "m", _SpoTenantRecycleBinItemRestoreCommand_initValidators).call(this);
28
+ __classPrivateFieldGet(this, _SpoTenantRecycleBinItemRestoreCommand_instances, "m", _SpoTenantRecycleBinItemRestoreCommand_initTypes).call(this);
26
29
  }
27
30
  async commandAction(logger, args) {
31
+ if (args.options.wait) {
32
+ await this.warn(logger, `Option 'wait' is deprecated and will be removed in the next major release.`);
33
+ }
28
34
  try {
35
+ if (this.verbose) {
36
+ await logger.logToStderr(`Restoring site collection '${args.options.siteUrl}' from recycle bin.`);
37
+ }
38
+ const siteUrl = urlUtil.removeTrailingSlashes(args.options.siteUrl);
29
39
  const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
30
40
  const requestOptions = {
31
- url: `${adminUrl}/_api/SPOInternalUseOnly.Tenant/RestoreDeletedSite`,
41
+ url: `${adminUrl}/_api/SPO.Tenant/RestoreDeletedSite`,
32
42
  headers: {
33
43
  accept: 'application/json;odata=nometadata',
34
44
  'content-type': 'application/json;charset=utf-8'
35
45
  },
36
- data: {
37
- siteUrl: args.options.siteUrl
38
- }
46
+ data: { siteUrl },
47
+ responseType: 'json'
39
48
  };
40
- const response = await request.post(requestOptions);
41
- let responseContent = JSON.parse(response);
42
- if (args.options.wait && !responseContent.IsComplete) {
43
- responseContent = await this.waitUntilTenantRestoreFinished(responseContent.PollingInterval, requestOptions, logger);
49
+ await request.post(requestOptions);
50
+ const groupId = await this.getSiteGroupId(adminUrl, siteUrl);
51
+ if (groupId && groupId !== '00000000-0000-0000-0000-000000000000') {
52
+ if (this.verbose) {
53
+ await logger.logToStderr(`Restoring Microsoft 365 group with ID '${groupId}' from recycle bin.`);
54
+ }
55
+ const restoreOptions = {
56
+ url: `https://graph.microsoft.com/v1.0/directory/deletedItems/${groupId}/restore`,
57
+ headers: {
58
+ accept: 'application/json;odata.metadata=none',
59
+ 'content-type': 'application/json'
60
+ },
61
+ responseType: 'json'
62
+ };
63
+ await request.post(restoreOptions);
44
64
  }
45
- await logger.log(responseContent);
65
+ // Here, we return a fixed response because this new API endpoint doesn't return a response while the previous API did.
66
+ // This has to be removed in the next major release.
67
+ await logger.log({
68
+ HasTimedout: false,
69
+ IsComplete: !!args.options.wait,
70
+ PollingInterval: 15000
71
+ });
46
72
  }
47
73
  catch (err) {
48
74
  this.handleRejectedODataJsonPromise(err);
49
75
  }
50
76
  }
51
- async waitUntilTenantRestoreFinished(pollingInterval, requestOptions, logger) {
52
- if (this.verbose) {
53
- await logger.logToStderr(`Site collection still restoring. Retrying in ${pollingInterval / 1000} seconds...`);
54
- }
55
- await setTimeout(pollingInterval);
56
- const response = await request.post(requestOptions);
57
- const responseContent = JSON.parse(response);
58
- if (responseContent.IsComplete) {
59
- return responseContent;
60
- }
61
- return await this.waitUntilTenantRestoreFinished(responseContent.PollingInterval, requestOptions, logger);
77
+ async getSiteGroupId(adminUrl, url) {
78
+ const sites = await odata.getAllItems(`${adminUrl}/_api/web/lists/GetByTitle('DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS')/items?$filter=SiteUrl eq '${formatting.encodeQueryParameter(url)}'&$select=GroupId`);
79
+ return sites[0].GroupId;
62
80
  }
63
81
  }
64
82
  _SpoTenantRecycleBinItemRestoreCommand_instances = new WeakSet(), _SpoTenantRecycleBinItemRestoreCommand_initTelemetry = function _SpoTenantRecycleBinItemRestoreCommand_initTelemetry() {
65
83
  this.telemetry.push((args) => {
66
84
  Object.assign(this.telemetryProperties, {
67
- wait: args.options.wait
85
+ wait: !!args.options.wait
68
86
  });
69
87
  });
70
88
  }, _SpoTenantRecycleBinItemRestoreCommand_initOptions = function _SpoTenantRecycleBinItemRestoreCommand_initOptions() {
@@ -75,6 +93,9 @@ _SpoTenantRecycleBinItemRestoreCommand_instances = new WeakSet(), _SpoTenantRecy
75
93
  });
76
94
  }, _SpoTenantRecycleBinItemRestoreCommand_initValidators = function _SpoTenantRecycleBinItemRestoreCommand_initValidators() {
77
95
  this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.siteUrl));
96
+ }, _SpoTenantRecycleBinItemRestoreCommand_initTypes = function _SpoTenantRecycleBinItemRestoreCommand_initTypes() {
97
+ this.types.string.push('siteUrl');
98
+ this.types.boolean.push('wait');
78
99
  };
79
100
  export default new SpoTenantRecycleBinItemRestoreCommand();
80
101
  //# sourceMappingURL=tenant-recyclebinitem-restore.js.map
@@ -8,12 +8,12 @@ import auth from '../../../../Auth.js';
8
8
  import request from '../../../../request.js';
9
9
  import { accessToken } from '../../../../utils/accessToken.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
- import GraphCommand from '../../../base/GraphCommand.js';
12
11
  import commands from '../../commands.js';
13
12
  import { chatUtil } from './chatUtil.js';
14
13
  import { cli } from '../../../../cli/cli.js';
15
14
  import { formatting } from '../../../../utils/formatting.js';
16
- class TeamsChatMessageSendCommand extends GraphCommand {
15
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
16
+ class TeamsChatMessageSendCommand extends DelegatedGraphCommand {
17
17
  get name() {
18
18
  return commands.CHAT_MESSAGE_SEND;
19
19
  }
@@ -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 GraphCommand from '../../../base/GraphCommand.js';
8
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
9
9
  import commands from '../../commands.js';
10
- class TodoListAddCommand extends GraphCommand {
10
+ class TodoListAddCommand extends DelegatedGraphCommand {
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 GraphCommand from '../../../base/GraphCommand.js';
9
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoListGetCommand extends GraphCommand {
11
+ class TodoListGetCommand extends DelegatedGraphCommand {
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 GraphCommand from '../../../base/GraphCommand.js';
2
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
3
3
  import commands from '../../commands.js';
4
- class TodoListListCommand extends GraphCommand {
4
+ class TodoListListCommand extends DelegatedGraphCommand {
5
5
  get name() {
6
6
  return commands.LIST_LIST;
7
7
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoListRemoveCommand_instances, _TodoListRemoveCommand_initTelemetry, _TodoListRemoveCommand_initOptions, _TodoListRemoveCommand_initOptionSets;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
- import GraphCommand from '../../../base/GraphCommand.js';
9
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoListRemoveCommand extends GraphCommand {
11
+ class TodoListRemoveCommand extends DelegatedGraphCommand {
12
12
  get name() {
13
13
  return commands.LIST_REMOVE;
14
14
  }
@@ -5,9 +5,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _TodoListSetCommand_instances, _TodoListSetCommand_initTelemetry, _TodoListSetCommand_initOptions, _TodoListSetCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
- import GraphCommand from '../../../base/GraphCommand.js';
8
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
9
9
  import commands from '../../commands.js';
10
- class TodoListSetCommand extends GraphCommand {
10
+ class TodoListSetCommand extends DelegatedGraphCommand {
11
11
  get name() {
12
12
  return commands.LIST_SET;
13
13
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoTaskAddCommand_instances, _a, _TodoTaskAddCommand_initTelemetry, _TodoTaskAddCommand_initOptions, _TodoTaskAddCommand_initValidators, _TodoTaskAddCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
8
  import { validation } from '../../../../utils/validation.js';
9
- import GraphCommand from '../../../base/GraphCommand.js';
9
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoTaskAddCommand extends GraphCommand {
11
+ class TodoTaskAddCommand extends DelegatedGraphCommand {
12
12
  get name() {
13
13
  return commands.TASK_ADD;
14
14
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoTaskGetCommand_instances, _TodoTaskGetCommand_initTelemetry, _TodoTaskGetCommand_initOptions, _TodoTaskGetCommand_initOptionSets;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
- import GraphCommand from '../../../base/GraphCommand.js';
9
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoTaskGetCommand extends GraphCommand {
11
+ class TodoTaskGetCommand extends DelegatedGraphCommand {
12
12
  get name() {
13
13
  return commands.TASK_GET;
14
14
  }
@@ -7,9 +7,9 @@ var _TodoTaskListCommand_instances, _TodoTaskListCommand_initTelemetry, _TodoTas
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { odata } from '../../../../utils/odata.js';
10
- import GraphCommand from '../../../base/GraphCommand.js';
10
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskListCommand extends GraphCommand {
12
+ class TodoTaskListCommand extends DelegatedGraphCommand {
13
13
  get name() {
14
14
  return commands.TASK_LIST;
15
15
  }
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TodoTaskRemoveCommand_instances, _TodoTaskRemoveCommand_initTelemetry, _TodoTaskRemoveCommand_initOptions, _TodoTaskRemoveCommand_initOptionSets;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
- import GraphCommand from '../../../base/GraphCommand.js';
9
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
10
10
  import commands from '../../commands.js';
11
- class TodoTaskRemoveCommand extends GraphCommand {
11
+ class TodoTaskRemoveCommand extends DelegatedGraphCommand {
12
12
  get name() {
13
13
  return commands.TASK_REMOVE;
14
14
  }
@@ -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 GraphCommand from '../../../base/GraphCommand.js';
10
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TodoTaskSetCommand extends GraphCommand {
12
+ class TodoTaskSetCommand extends DelegatedGraphCommand {
13
13
  get name() {
14
14
  return commands.TASK_SET;
15
15
  }
@@ -0,0 +1,49 @@
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 _VivaEngageCommunityGetCommand_instances, _VivaEngageCommunityGetCommand_initOptions, _VivaEngageCommunityGetCommand_initTypes;
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ import request from '../../../../request.js';
10
+ class VivaEngageCommunityGetCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.ENGAGE_COMMUNITY_GET;
13
+ }
14
+ get description() {
15
+ return 'Gets information of a Viva Engage community';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _VivaEngageCommunityGetCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _VivaEngageCommunityGetCommand_instances, "m", _VivaEngageCommunityGetCommand_initOptions).call(this);
21
+ __classPrivateFieldGet(this, _VivaEngageCommunityGetCommand_instances, "m", _VivaEngageCommunityGetCommand_initTypes).call(this);
22
+ }
23
+ async commandAction(logger, args) {
24
+ if (this.verbose) {
25
+ logger.logToStderr(`Getting the information of Viva Engage community with id '${args.options.id}'...`);
26
+ }
27
+ const requestOptions = {
28
+ url: `${this.resource}/beta/employeeExperience/communities/${args.options.id}`,
29
+ headers: {
30
+ accept: 'application/json;odata.metadata=none'
31
+ },
32
+ responseType: 'json'
33
+ };
34
+ try {
35
+ const res = await request.get(requestOptions);
36
+ await logger.log(res);
37
+ }
38
+ catch (err) {
39
+ this.handleRejectedODataJsonPromise(err);
40
+ }
41
+ }
42
+ }
43
+ _VivaEngageCommunityGetCommand_instances = new WeakSet(), _VivaEngageCommunityGetCommand_initOptions = function _VivaEngageCommunityGetCommand_initOptions() {
44
+ this.options.unshift({ option: '-i, --id <id>' });
45
+ }, _VivaEngageCommunityGetCommand_initTypes = function _VivaEngageCommunityGetCommand_initTypes() {
46
+ this.types.string.push('id');
47
+ };
48
+ export default new VivaEngageCommunityGetCommand();
49
+ //# sourceMappingURL=engage-community-get.js.map
@@ -1,6 +1,7 @@
1
1
  const prefix = 'viva';
2
2
  export default {
3
3
  CONNECTIONS_APP_CREATE: `${prefix} connections app create`,
4
+ ENGAGE_COMMUNITY_GET: `${prefix} engage community get`,
4
5
  ENGAGE_GROUP_LIST: `${prefix} engage group list`,
5
6
  ENGAGE_GROUP_USER_ADD: `${prefix} engage group user add`,
6
7
  ENGAGE_GROUP_USER_REMOVE: `${prefix} engage group user remove`,
@@ -1,3 +1,5 @@
1
+ import auth from "../Auth.js";
2
+ import { CommandError } from "../Command.js";
1
3
  export const accessToken = {
2
4
  isAppOnlyAccessToken(accessToken) {
3
5
  let isAppOnlyAccessToken;
@@ -72,6 +74,20 @@ export const accessToken = {
72
74
  catch {
73
75
  }
74
76
  return userId;
77
+ },
78
+ /**
79
+ * Asserts the presence of a delegated access token.
80
+ * @throws {CommandError} Will throw an error if the access token is not available.
81
+ * @throws {CommandError} Will throw an error if the access token is an application-only access token.
82
+ */
83
+ assertDelegatedAccessToken() {
84
+ const accessToken = auth?.connection?.accessTokens?.[auth.defaultResource]?.accessToken;
85
+ if (!accessToken) {
86
+ throw new CommandError('No access token found.');
87
+ }
88
+ if (this.isAppOnlyAccessToken(accessToken)) {
89
+ throw new CommandError('This command does not support application-only permissions.');
90
+ }
75
91
  }
76
92
  };
77
93
  //# sourceMappingURL=accessToken.js.map
@@ -305,11 +305,11 @@ export const validation = {
305
305
  return true;
306
306
  },
307
307
  isValidSharePointUrl(url) {
308
- if (!url) {
309
- return false;
308
+ if (typeof url !== 'string') {
309
+ return 'SharePoint Online site URL must be a string.';
310
310
  }
311
311
  if (url.indexOf('https://') !== 0) {
312
- return `${url} is not a valid SharePoint Online site URL`;
312
+ return `'${url}' is not a valid SharePoint Online site URL.`;
313
313
  }
314
314
  else {
315
315
  return true;
@@ -0,0 +1,62 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+
3
+ # entra group user set
4
+
5
+ Updates role of users in a Microsoft Entra ID group
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ m365 entra group user set [options]
11
+ ```
12
+
13
+ ## Options
14
+
15
+ ```md definition-list
16
+ `-i, --groupId [groupId]`
17
+ : The ID of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both.
18
+
19
+ `-n, --groupDisplayName [groupDisplayName]`
20
+ : The display name of the Entra ID group. Specify `groupId` or `groupDisplayName` but not both.
21
+
22
+ `--ids [ids]`
23
+ : Comma-separated list of user IDs. Specify either `ids` or `userNames` but not both.
24
+
25
+ `--userNames [userNames]`
26
+ : The user principal names of users. You can also pass a comma-separated list of UPNs. Specify either `ids` or `userNames` but not both.
27
+
28
+ `-r, --role <role>`
29
+ : The new role to be assigned to the users. Valid values: `Owner`, `Member`.
30
+ ```
31
+
32
+ <Global />
33
+
34
+ ## Examples
35
+
36
+ Update a single user specified by ID to a member of a group specified by display name
37
+
38
+ ```sh
39
+ m365 entra group user set --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
40
+ ```
41
+
42
+ Update multiple users specified by ID to members of a group specified by ID
43
+
44
+ ```sh
45
+ m365 entra group user set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --ids "098b9f52-f48c-4401-819f-29c33794c3f5,f1e06e31-3abf-4746-83c2-1513d71f38b8" --role Member
46
+ ```
47
+
48
+ Update a single user specified by UPN to an owner of a group specified by display name
49
+
50
+ ```sh
51
+ m365 entra group user set --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner
52
+ ```
53
+
54
+ Update multiple users specified by UPN to owners of a group specified by ID
55
+
56
+ ```sh
57
+ m365 entra group user set --groupId a03c0c35-ef9a-419b-8cab-f89e0a8d2d2a --userNames "john.doe@contoso.com,adele.vance@contoso.com" --role Owner
58
+ ```
59
+
60
+ ## Response
61
+
62
+ The command won't return a response on success.