@pnp/cli-microsoft365 9.0.0-beta.e69e8d0 → 9.0.0-beta.f2c5f82

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 (41) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/cli/cli.js +11 -6
  4. package/dist/m365/cli/commands/cli-consent.js +3 -7
  5. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +123 -0
  6. package/dist/m365/entra/commands/group/group-set.js +256 -0
  7. package/dist/m365/entra/commands.js +3 -0
  8. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +0 -1
  9. package/dist/m365/teams/commands/message/message-restore.js +106 -0
  10. package/dist/m365/teams/commands.js +1 -0
  11. package/dist/m365/viva/commands/engage/engage-group-list.js +0 -5
  12. package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -5
  13. package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -5
  14. package/dist/m365/viva/commands/engage/engage-message-add.js +0 -5
  15. package/dist/m365/viva/commands/engage/engage-message-get.js +0 -5
  16. package/dist/m365/viva/commands/engage/engage-message-like-set.js +0 -5
  17. package/dist/m365/viva/commands/engage/engage-message-list.js +0 -5
  18. package/dist/m365/viva/commands/engage/engage-message-remove.js +0 -5
  19. package/dist/m365/viva/commands/engage/engage-network-list.js +0 -5
  20. package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +0 -8
  21. package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +0 -8
  22. package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +0 -8
  23. package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +0 -8
  24. package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +0 -8
  25. package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +0 -8
  26. package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +0 -8
  27. package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +0 -8
  28. package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +0 -8
  29. package/dist/m365/viva/commands/engage/engage-search.js +0 -5
  30. package/dist/m365/viva/commands/engage/engage-user-get.js +0 -5
  31. package/dist/m365/viva/commands/engage/engage-user-list.js +0 -5
  32. package/docs/docs/cmd/cli/cli-consent.mdx +1 -1
  33. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-remove.mdx +65 -0
  34. package/docs/docs/cmd/entra/group/group-add.mdx +0 -4
  35. package/docs/docs/cmd/entra/group/group-set.mdx +89 -0
  36. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +6 -5
  37. package/docs/docs/cmd/teams/message/message-remove.mdx +2 -1
  38. package/docs/docs/cmd/teams/message/message-restore.mdx +62 -0
  39. package/npm-shrinkwrap.json +0 -1
  40. package/package.json +1 -2
  41. package/dist/m365/viva/commands/engage/yammerCommands.js +0 -25
package/dist/cli/cli.js CHANGED
@@ -36,6 +36,14 @@ const defaultHelpMode = 'options';
36
36
  const defaultHelpTarget = 'console';
37
37
  const helpModes = ['options', 'examples', 'remarks', 'response', 'full'];
38
38
  const helpTargets = ['console', 'web'];
39
+ const yargsConfiguration = {
40
+ 'parse-numbers': true,
41
+ 'strip-aliased': true,
42
+ 'strip-dashed': true,
43
+ 'dot-notation': false,
44
+ 'boolean-negation': true,
45
+ 'camel-case-expansion': false
46
+ };
39
47
  function getConfig() {
40
48
  if (!_config) {
41
49
  _config = new Configstore(config.configstoreName);
@@ -404,11 +412,7 @@ function getCommandOptions(command) {
404
412
  function getCommandOptionsFromArgs(args, commandInfo) {
405
413
  const yargsOptions = {
406
414
  alias: {},
407
- configuration: {
408
- "parse-numbers": false,
409
- "strip-aliased": true,
410
- "strip-dashed": true
411
- }
415
+ configuration: yargsConfiguration
412
416
  };
413
417
  let argsToParse = args;
414
418
  if (commandInfo) {
@@ -853,6 +857,7 @@ export const cli = {
853
857
  printAvailableCommands,
854
858
  promptForConfirmation,
855
859
  promptForSelection,
856
- shouldTrimOutput
860
+ shouldTrimOutput,
861
+ yargsConfiguration
857
862
  };
858
863
  //# sourceMappingURL=cli.js.map
@@ -23,12 +23,8 @@ class CliConsentCommand extends AnonymousCommand {
23
23
  }
24
24
  async commandAction(logger, args) {
25
25
  let scope = '';
26
- switch (args.options.service) {
27
- case 'yammer':
28
- await this.warn(logger, 'The yammer service is deprecated. Please use the VivaEngage service instead.');
29
- case 'VivaEngage':
30
- scope = 'https://api.yammer.com/user_impersonation';
31
- break;
26
+ if (args.options.service === 'VivaEngage') {
27
+ scope = 'https://api.yammer.com/user_impersonation';
32
28
  }
33
29
  await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${config.tenant}/oauth2/v2.0/authorize?client_id=${config.cliEntraAppId}&response_type=code&scope=${encodeURIComponent(scope)}`);
34
30
  }
@@ -50,7 +46,7 @@ _CliConsentCommand_instances = new WeakSet(), _CliConsentCommand_initTelemetry =
50
46
  });
51
47
  }, _CliConsentCommand_initValidators = function _CliConsentCommand_initValidators() {
52
48
  this.validators.push(async (args) => {
53
- if (args.options.service !== 'VivaEngage' && args.options.service !== 'yammer') {
49
+ if (args.options.service !== 'VivaEngage') {
54
50
  return `${args.options.service} is not a valid value for the service option. Allowed values: VivaEngage`;
55
51
  }
56
52
  return true;
@@ -0,0 +1,123 @@
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 _EntraEnterpriseAppRemoveCommand_instances, _EntraEnterpriseAppRemoveCommand_initTelemetry, _EntraEnterpriseAppRemoveCommand_initOptions, _EntraEnterpriseAppRemoveCommand_initValidators, _EntraEnterpriseAppRemoveCommand_initOptionSets, _EntraEnterpriseAppRemoveCommand_initTypes;
7
+ import { cli } from '../../../../cli/cli.js';
8
+ import request from '../../../../request.js';
9
+ import { odata } from '../../../../utils/odata.js';
10
+ import { formatting } from '../../../../utils/formatting.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import GraphCommand from '../../../base/GraphCommand.js';
13
+ import commands from '../../commands.js';
14
+ class EntraEnterpriseAppRemoveCommand extends GraphCommand {
15
+ get name() {
16
+ return commands.ENTERPRISEAPP_REMOVE;
17
+ }
18
+ get description() {
19
+ return 'Deletes an enterprise application (or service principal)';
20
+ }
21
+ alias() {
22
+ return [commands.SP_REMOVE];
23
+ }
24
+ constructor() {
25
+ super();
26
+ _EntraEnterpriseAppRemoveCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initOptionSets).call(this);
31
+ __classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initTypes).call(this);
32
+ }
33
+ async commandAction(logger, args) {
34
+ const removeEnterpriseApplication = async () => {
35
+ if (this.verbose) {
36
+ await logger.logToStderr(`Removing enterprise application ${args.options.id || args.options.displayName || args.options.objectId}...`);
37
+ }
38
+ try {
39
+ let url = `${this.resource}/v1.0`;
40
+ if (args.options.id) {
41
+ url += `/servicePrincipals(appId='${args.options.id}')`;
42
+ }
43
+ else {
44
+ const id = await this.getSpId(args.options);
45
+ url += `/servicePrincipals/${id}`;
46
+ }
47
+ const requestOptions = {
48
+ url: url,
49
+ headers: {
50
+ accept: 'application/json;odata.metadata=none'
51
+ },
52
+ responseType: 'json'
53
+ };
54
+ await request.delete(requestOptions);
55
+ }
56
+ catch (err) {
57
+ this.handleRejectedODataJsonPromise(err);
58
+ }
59
+ };
60
+ if (args.options.force) {
61
+ await removeEnterpriseApplication();
62
+ }
63
+ else {
64
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove enterprise application '${args.options.id || args.options.displayName || args.options.objectId}'?` });
65
+ if (result) {
66
+ await removeEnterpriseApplication();
67
+ }
68
+ }
69
+ }
70
+ async getSpId(options) {
71
+ if (options.objectId) {
72
+ return options.objectId;
73
+ }
74
+ const spItemsResponse = await odata.getAllItems(`${this.resource}/v1.0/servicePrincipals?$filter=displayName eq '${formatting.encodeQueryParameter(options.displayName)}'&$select=id`);
75
+ if (spItemsResponse.length === 0) {
76
+ throw `The specified enterprise application does not exist.`;
77
+ }
78
+ if (spItemsResponse.length > 1) {
79
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', spItemsResponse);
80
+ const result = await cli.handleMultipleResultsFound(`Multiple enterprise applications with name '${options.displayName}' found.`, resultAsKeyValuePair);
81
+ return result.id;
82
+ }
83
+ const spItem = spItemsResponse[0];
84
+ return spItem.id;
85
+ }
86
+ }
87
+ _EntraEnterpriseAppRemoveCommand_instances = new WeakSet(), _EntraEnterpriseAppRemoveCommand_initTelemetry = function _EntraEnterpriseAppRemoveCommand_initTelemetry() {
88
+ this.telemetry.push((args) => {
89
+ Object.assign(this.telemetryProperties, {
90
+ id: typeof args.options.id !== 'undefined',
91
+ displayName: typeof args.options.displayName !== 'undefined',
92
+ objectId: typeof args.options.objectId !== 'undefined',
93
+ force: !!args.options.force
94
+ });
95
+ });
96
+ }, _EntraEnterpriseAppRemoveCommand_initOptions = function _EntraEnterpriseAppRemoveCommand_initOptions() {
97
+ this.options.unshift({
98
+ option: '-i, --id [id]'
99
+ }, {
100
+ option: '-n, --displayName [displayName]'
101
+ }, {
102
+ option: '--objectId [objectId]'
103
+ }, {
104
+ option: '-f, --force'
105
+ });
106
+ }, _EntraEnterpriseAppRemoveCommand_initValidators = function _EntraEnterpriseAppRemoveCommand_initValidators() {
107
+ this.validators.push(async (args) => {
108
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
109
+ return `The option 'id' with value '${args.options.id}' is not a valid GUID.`;
110
+ }
111
+ if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
112
+ return `The option 'objectId' with value '${args.options.objectId}' is not a valid GUID.`;
113
+ }
114
+ return true;
115
+ });
116
+ }, _EntraEnterpriseAppRemoveCommand_initOptionSets = function _EntraEnterpriseAppRemoveCommand_initOptionSets() {
117
+ this.optionSets.push({ options: ['id', 'displayName', 'objectId'] });
118
+ }, _EntraEnterpriseAppRemoveCommand_initTypes = function _EntraEnterpriseAppRemoveCommand_initTypes() {
119
+ this.types.string.push('id', 'displayName', 'objectId');
120
+ this.types.boolean.push('force');
121
+ };
122
+ export default new EntraEnterpriseAppRemoveCommand();
123
+ //# sourceMappingURL=enterpriseapp-remove.js.map
@@ -0,0 +1,256 @@
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 _EntraGroupSetCommand_instances, _EntraGroupSetCommand_initTelemetry, _EntraGroupSetCommand_initOptions, _EntraGroupSetCommand_initValidators, _EntraGroupSetCommand_initOptionSets, _EntraGroupSetCommand_initTypes;
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import request from '../../../../request.js';
11
+ import { entraUser } from '../../../../utils/entraUser.js';
12
+ import { entraGroup } from '../../../../utils/entraGroup.js';
13
+ import { formatting } from '../../../../utils/formatting.js';
14
+ import { odata } from '../../../../utils/odata.js';
15
+ class EntraGroupSetCommand extends GraphCommand {
16
+ get name() {
17
+ return commands.GROUP_SET;
18
+ }
19
+ get description() {
20
+ return 'Updates a Microsoft Entra group';
21
+ }
22
+ constructor() {
23
+ super();
24
+ _EntraGroupSetCommand_instances.add(this);
25
+ this.allowedVisibility = ['Public', 'Private'];
26
+ __classPrivateFieldGet(this, _EntraGroupSetCommand_instances, "m", _EntraGroupSetCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _EntraGroupSetCommand_instances, "m", _EntraGroupSetCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _EntraGroupSetCommand_instances, "m", _EntraGroupSetCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _EntraGroupSetCommand_instances, "m", _EntraGroupSetCommand_initOptionSets).call(this);
30
+ __classPrivateFieldGet(this, _EntraGroupSetCommand_instances, "m", _EntraGroupSetCommand_initTypes).call(this);
31
+ }
32
+ async commandAction(logger, args) {
33
+ let groupId = args.options.id;
34
+ try {
35
+ if (args.options.displayName) {
36
+ if (this.verbose) {
37
+ await logger.logToStderr(`Retrieving group id...`);
38
+ }
39
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.displayName);
40
+ }
41
+ const requestOptions = {
42
+ url: `${this.resource}/v1.0/groups/${groupId}`,
43
+ headers: {
44
+ accept: 'application/json;odata.metadata=none'
45
+ },
46
+ data: {
47
+ displayName: args.options.newDisplayName,
48
+ description: args.options.description === '' ? null : args.options.description,
49
+ mailNickName: args.options.mailNickname,
50
+ visibility: args.options.visibility
51
+ }
52
+ };
53
+ await request.patch(requestOptions);
54
+ const ownerIds = await this.getUserIds(logger, args.options.ownerIds, args.options.ownerUserNames);
55
+ if (ownerIds.length !== 0) {
56
+ await this.updateUsers(logger, groupId, 'owners', ownerIds);
57
+ }
58
+ else if (this.verbose) {
59
+ await logger.logToStderr(`No owners to update.`);
60
+ }
61
+ const memberIds = await this.getUserIds(logger, args.options.memberIds, args.options.memberUserNames);
62
+ if (memberIds.length !== 0) {
63
+ await this.updateUsers(logger, groupId, 'members', memberIds);
64
+ }
65
+ else if (this.verbose) {
66
+ await logger.logToStderr(`No members to update.`);
67
+ }
68
+ }
69
+ catch (err) {
70
+ this.handleRejectedODataJsonPromise(err);
71
+ }
72
+ }
73
+ ;
74
+ async getUserIds(logger, userIds, userNames) {
75
+ if (userIds) {
76
+ return formatting.splitAndTrim(userIds);
77
+ }
78
+ if (userNames) {
79
+ if (this.verbose) {
80
+ await logger.logToStderr(`Retrieving user IDs...`);
81
+ }
82
+ return entraUser.getUserIdsByUpns(formatting.splitAndTrim(userNames));
83
+ }
84
+ return [];
85
+ }
86
+ async updateUsers(logger, groupId, role, userIds) {
87
+ const groupUsers = await odata.getAllItems(`${this.resource}/v1.0/groups/${groupId}/${role}/microsoft.graph.user?$select=id`);
88
+ const userIdsToAdd = userIds.filter(userId => !groupUsers.some(groupUser => groupUser.id === userId));
89
+ const userIdsToRemove = groupUsers.filter(groupUser => !userIds.some(userId => groupUser.id === userId)).map(user => user.id);
90
+ if (this.verbose) {
91
+ await logger.logToStderr(`Adding ${userIdsToAdd.length} ${role}...`);
92
+ }
93
+ for (let i = 0; i < userIdsToAdd.length; i += 400) {
94
+ const userIdsBatch = userIdsToAdd.slice(i, i + 400);
95
+ const batchRequestOptions = this.getBatchRequestOptions();
96
+ // only 20 requests per one batch are allowed
97
+ for (let j = 0; j < userIdsBatch.length; j += 20) {
98
+ // only 20 users can be added in one request
99
+ const userIdsChunk = userIdsBatch.slice(j, j + 20);
100
+ batchRequestOptions.data.requests.push({
101
+ id: j + 1,
102
+ method: 'PATCH',
103
+ url: `/groups/${groupId}`,
104
+ headers: {
105
+ 'content-type': 'application/json;odata.metadata=none',
106
+ accept: 'application/json;odata.metadata=none'
107
+ },
108
+ body: {
109
+ [`${role}@odata.bind`]: userIdsChunk.map(u => `${this.resource}/v1.0/directoryObjects/${u}`)
110
+ }
111
+ });
112
+ }
113
+ const res = await request.post(batchRequestOptions);
114
+ for (const response of res.responses) {
115
+ if (response.status !== 204) {
116
+ throw response.body;
117
+ }
118
+ }
119
+ }
120
+ if (this.verbose) {
121
+ await logger.logToStderr(`Removing ${userIdsToRemove.length} ${role}...`);
122
+ }
123
+ for (let i = 0; i < userIdsToRemove.length; i += 20) {
124
+ const userIdsBatch = userIdsToRemove.slice(i, i + 20);
125
+ const batchRequestOptions = this.getBatchRequestOptions();
126
+ userIdsBatch.map(userId => {
127
+ batchRequestOptions.data.requests.push({
128
+ id: userId,
129
+ method: 'DELETE',
130
+ url: `/groups/${groupId}/${role}/${userId}/$ref`
131
+ });
132
+ });
133
+ const res = await request.post(batchRequestOptions);
134
+ for (const response of res.responses) {
135
+ if (response.status !== 204) {
136
+ throw response.body;
137
+ }
138
+ }
139
+ }
140
+ }
141
+ getBatchRequestOptions() {
142
+ const requestOptions = {
143
+ url: `${this.resource}/v1.0/$batch`,
144
+ headers: {
145
+ 'content-type': 'application/json;odata.metadata=none',
146
+ accept: 'application/json;odata.metadata=none'
147
+ },
148
+ responseType: 'json',
149
+ data: {
150
+ requests: []
151
+ }
152
+ };
153
+ return requestOptions;
154
+ }
155
+ }
156
+ _EntraGroupSetCommand_instances = new WeakSet(), _EntraGroupSetCommand_initTelemetry = function _EntraGroupSetCommand_initTelemetry() {
157
+ this.telemetry.push((args) => {
158
+ Object.assign(this.telemetryProperties, {
159
+ id: typeof args.options.id !== 'undefined',
160
+ displayName: typeof args.options.displayName !== 'undefined',
161
+ newDisplayName: typeof args.options.newDisplayName !== 'undefined',
162
+ description: typeof args.options.description !== 'undefined',
163
+ mailNickname: typeof args.options.mailNickname !== 'undefined',
164
+ ownerIds: typeof args.options.ownerIds !== 'undefined',
165
+ ownerUserNames: typeof args.options.ownerUserNames !== 'undefined',
166
+ memberIds: typeof args.options.memberIds !== 'undefined',
167
+ memberUserNames: typeof args.options.memberUserNames !== 'undefined',
168
+ visibility: typeof args.options.visibility !== 'undefined'
169
+ });
170
+ });
171
+ }, _EntraGroupSetCommand_initOptions = function _EntraGroupSetCommand_initOptions() {
172
+ this.options.unshift({
173
+ option: '-i, --id [id]'
174
+ }, {
175
+ option: '--mailNickname [mailNickname]'
176
+ }, {
177
+ option: '-n, --displayName [displayName]'
178
+ }, {
179
+ option: '--newDisplayName [newDisplayName]'
180
+ }, {
181
+ option: '--description [description]'
182
+ }, {
183
+ option: '--ownerIds [ownerIds]'
184
+ }, {
185
+ option: '--ownerUserNames [ownerUserNames]'
186
+ }, {
187
+ option: '--memberIds [memberIds]'
188
+ }, {
189
+ option: '--memberUserNames [memberUserNames]'
190
+ }, {
191
+ option: '--visibility [visibility]',
192
+ autocomplete: this.allowedVisibility
193
+ });
194
+ }, _EntraGroupSetCommand_initValidators = function _EntraGroupSetCommand_initValidators() {
195
+ this.validators.push(async (args) => {
196
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
197
+ return `Value '${args.options.id}' is not a valid GUID for option 'id'.`;
198
+ }
199
+ if (args.options.newDisplayName && args.options.newDisplayName.length > 256) {
200
+ return `The maximum amount of characters for 'newDisplayName' is 256.`;
201
+ }
202
+ if (args.options.mailNickname) {
203
+ if (!validation.isValidMailNickname(args.options.mailNickname)) {
204
+ return `Value '${args.options.mailNickname}' for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \ [] " ; : <> , SPACE.`;
205
+ }
206
+ if (args.options.mailNickname.length > 64) {
207
+ return `The maximum amount of characters for 'mailNickname' is 64.`;
208
+ }
209
+ }
210
+ if (args.options.ownerIds) {
211
+ const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.ownerIds);
212
+ if (isValidGUIDArrayResult !== true) {
213
+ return `The following GUIDs are invalid for option 'ownerIds': ${isValidGUIDArrayResult}.`;
214
+ }
215
+ }
216
+ if (args.options.ownerUserNames) {
217
+ const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.ownerUserNames);
218
+ if (isValidUPNArrayResult !== true) {
219
+ return `The following user principal names are invalid for option 'ownerUserNames': ${isValidUPNArrayResult}.`;
220
+ }
221
+ }
222
+ if (args.options.memberIds) {
223
+ const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.memberIds);
224
+ if (isValidGUIDArrayResult !== true) {
225
+ return `The following GUIDs are invalid for option 'memberIds': ${isValidGUIDArrayResult}.`;
226
+ }
227
+ }
228
+ if (args.options.memberUserNames) {
229
+ const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.memberUserNames);
230
+ if (isValidUPNArrayResult !== true) {
231
+ return `The following user principal names are invalid for option 'memberUserNames': ${isValidUPNArrayResult}.`;
232
+ }
233
+ }
234
+ if (args.options.visibility && !this.allowedVisibility.includes(args.options.visibility)) {
235
+ return `Option 'visibility' must be one of the following values: ${this.allowedVisibility.join(', ')}.`;
236
+ }
237
+ if (args.options.newDisplayName === undefined && args.options.description === undefined && args.options.visibility === undefined
238
+ && args.options.ownerIds === undefined && args.options.ownerUserNames === undefined && args.options.memberIds === undefined
239
+ && args.options.memberUserNames === undefined && args.options.mailNickname === undefined) {
240
+ return `Specify at least one of the following options: 'newDisplayName', 'description', 'visibility', 'ownerIds', 'ownerUserNames', 'memberIds', 'memberUserNames', 'mailNickname'.`;
241
+ }
242
+ return true;
243
+ });
244
+ }, _EntraGroupSetCommand_initOptionSets = function _EntraGroupSetCommand_initOptionSets() {
245
+ this.optionSets.push({ options: ['id', 'displayName'] }, {
246
+ options: ['ownerIds', 'ownerUserNames'],
247
+ runsWhen: (args) => args.options.ownerIds || args.options.ownerUserNames
248
+ }, {
249
+ options: ['memberIds', 'memberUserNames'],
250
+ runsWhen: (args) => args.options.memberIds || args.options.memberUserNames
251
+ });
252
+ }, _EntraGroupSetCommand_initTypes = function _EntraGroupSetCommand_initTypes() {
253
+ this.types.string.push('id', 'displayName', 'newDisplayName', 'description', 'mailNickname', 'ownerIds', 'ownerUserNames', 'memberIds', 'memberUserNames', 'visibility');
254
+ };
255
+ export default new EntraGroupSetCommand();
256
+ //# sourceMappingURL=group-set.js.map
@@ -35,10 +35,12 @@ export default {
35
35
  ENTERPRISEAPP_ADD: `${prefix} enterpriseapp add`,
36
36
  ENTERPRISEAPP_GET: `${prefix} enterpriseapp get`,
37
37
  ENTERPRISEAPP_LIST: `${prefix} enterpriseapp list`,
38
+ ENTERPRISEAPP_REMOVE: `${prefix} enterpriseapp remove`,
38
39
  GROUP_ADD: `${prefix} group add`,
39
40
  GROUP_GET: `${prefix} group get`,
40
41
  GROUP_LIST: `${prefix} group list`,
41
42
  GROUP_REMOVE: `${prefix} group remove`,
43
+ GROUP_SET: `${prefix} group set`,
42
44
  GROUP_USER_ADD: `${prefix} group user add`,
43
45
  GROUP_USER_LIST: `${prefix} group user list`,
44
46
  GROUP_USER_SET: `${prefix} group user set`,
@@ -92,6 +94,7 @@ export default {
92
94
  SP_ADD: `${prefix} sp add`,
93
95
  SP_GET: `${prefix} sp get`,
94
96
  SP_LIST: `${prefix} sp list`,
97
+ SP_REMOVE: `${prefix} sp remove`,
95
98
  USER_ADD: `${prefix} user add`,
96
99
  USER_GET: `${prefix} user get`,
97
100
  USER_GUEST_ADD: `${prefix} user guest add`,
@@ -33,7 +33,6 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
33
33
  if (!args.options.clientSideComponentProperties) {
34
34
  await logger.log({
35
35
  ...customAction,
36
- Rights: JSON.stringify(customAction.Rights),
37
36
  Scope: this.humanizeScope(customAction.Scope)
38
37
  });
39
38
  }
@@ -0,0 +1,106 @@
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 _TeamsMessageRestoreCommand_instances, _TeamsMessageRestoreCommand_initTelemetry, _TeamsMessageRestoreCommand_initOptions, _TeamsMessageRestoreCommand_initValidators, _TeamsMessageRestoreCommand_initOptionSets, _TeamsMessageRestoreCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import { validation } from '../../../../utils/validation.js';
9
+ import commands from '../../commands.js';
10
+ import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
11
+ import { teams } from '../../../../utils/teams.js';
12
+ class TeamsMessageRestoreCommand extends DelegatedGraphCommand {
13
+ get name() {
14
+ return commands.MESSAGE_RESTORE;
15
+ }
16
+ get description() {
17
+ return 'Restores a deleted message from a channel in a Microsoft Teams team';
18
+ }
19
+ constructor() {
20
+ super();
21
+ _TeamsMessageRestoreCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _TeamsMessageRestoreCommand_instances, "m", _TeamsMessageRestoreCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _TeamsMessageRestoreCommand_instances, "m", _TeamsMessageRestoreCommand_initOptions).call(this);
24
+ __classPrivateFieldGet(this, _TeamsMessageRestoreCommand_instances, "m", _TeamsMessageRestoreCommand_initValidators).call(this);
25
+ __classPrivateFieldGet(this, _TeamsMessageRestoreCommand_instances, "m", _TeamsMessageRestoreCommand_initOptionSets).call(this);
26
+ __classPrivateFieldGet(this, _TeamsMessageRestoreCommand_instances, "m", _TeamsMessageRestoreCommand_initTypes).call(this);
27
+ }
28
+ async commandAction(logger, args) {
29
+ try {
30
+ if (this.verbose) {
31
+ await logger.logToStderr(`Restoring deleted message '${args.options.id}' from channel '${args.options.channelId || args.options.channelName}' in the Microsoft Teams team '${args.options.teamId || args.options.teamName}'.`);
32
+ }
33
+ const teamId = await this.getTeamId(args.options, logger);
34
+ const channelId = await this.getChannelId(args.options, teamId, logger);
35
+ const requestOptions = {
36
+ url: `${this.resource}/v1.0/teams/${teamId}/channels/${channelId}/messages/${args.options.id}/undoSoftDelete`,
37
+ headers: {
38
+ accept: 'application/json;odata.metadata=none'
39
+ },
40
+ responseType: 'json'
41
+ };
42
+ await request.post(requestOptions);
43
+ }
44
+ catch (err) {
45
+ this.handleRejectedODataJsonPromise(err);
46
+ }
47
+ }
48
+ async getTeamId(options, logger) {
49
+ if (options.teamId) {
50
+ return options.teamId;
51
+ }
52
+ if (this.verbose) {
53
+ await logger.logToStderr(`Getting the Team ID.`);
54
+ }
55
+ const groupId = await teams.getTeamIdByDisplayName(options.teamName);
56
+ return groupId;
57
+ }
58
+ async getChannelId(options, teamId, logger) {
59
+ if (options.channelId) {
60
+ return options.channelId;
61
+ }
62
+ if (this.verbose) {
63
+ await logger.logToStderr(`Getting the channel ID.`);
64
+ }
65
+ const channelId = await teams.getChannelIdByDisplayName(teamId, options.channelName);
66
+ return channelId;
67
+ }
68
+ }
69
+ _TeamsMessageRestoreCommand_instances = new WeakSet(), _TeamsMessageRestoreCommand_initTelemetry = function _TeamsMessageRestoreCommand_initTelemetry() {
70
+ this.telemetry.push((args) => {
71
+ Object.assign(this.telemetryProperties, {
72
+ teamId: typeof args.options.teamId !== 'undefined',
73
+ teamName: typeof args.options.teamName !== 'undefined',
74
+ channelId: typeof args.options.channelId !== 'undefined',
75
+ channelName: typeof args.options.channelName !== 'undefined'
76
+ });
77
+ });
78
+ }, _TeamsMessageRestoreCommand_initOptions = function _TeamsMessageRestoreCommand_initOptions() {
79
+ this.options.unshift({
80
+ option: '--teamId [teamId]'
81
+ }, {
82
+ option: '--teamName [teamName]'
83
+ }, {
84
+ option: '--channelId [channelId]'
85
+ }, {
86
+ option: '--channelName [channelName]'
87
+ }, {
88
+ option: '-i, --id <id>'
89
+ });
90
+ }, _TeamsMessageRestoreCommand_initValidators = function _TeamsMessageRestoreCommand_initValidators() {
91
+ this.validators.push(async (args) => {
92
+ if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
93
+ return `'${args.options.teamId}' is not a valid GUID for 'teamId'.`;
94
+ }
95
+ if (args.options.channelId && !validation.isValidTeamsChannelId(args.options.channelId)) {
96
+ return `'${args.options.channelId}' is not a valid ID for 'channelId'.`;
97
+ }
98
+ return true;
99
+ });
100
+ }, _TeamsMessageRestoreCommand_initOptionSets = function _TeamsMessageRestoreCommand_initOptionSets() {
101
+ this.optionSets.push({ options: ['teamId', 'teamName'] }, { options: ['channelId', 'channelName'] });
102
+ }, _TeamsMessageRestoreCommand_initTypes = function _TeamsMessageRestoreCommand_initTypes() {
103
+ this.types.string.push('teamId', 'teamName', 'channelId', 'channelName', 'id');
104
+ };
105
+ export default new TeamsMessageRestoreCommand();
106
+ //# sourceMappingURL=message-restore.js.map
@@ -39,6 +39,7 @@ export default {
39
39
  MESSAGE_LIST: `${prefix} message list`,
40
40
  MESSAGE_REMOVE: `${prefix} message remove`,
41
41
  MESSAGE_REPLY_LIST: `${prefix} message reply list`,
42
+ MESSAGE_RESTORE: `${prefix} message restore`,
42
43
  MESSAGE_SEND: `${prefix} message send`,
43
44
  MESSAGINGSETTINGS_LIST: `${prefix} messagingsettings list`,
44
45
  MESSAGINGSETTINGS_SET: `${prefix} messagingsettings set`,
@@ -7,7 +7,6 @@ var _VivaEngageGroupListCommand_instances, _VivaEngageGroupListCommand_initTelem
7
7
  import request from '../../../../request.js';
8
8
  import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
9
9
  import commands from '../../commands.js';
10
- import yammerCommands from './yammerCommands.js';
11
10
  class VivaEngageGroupListCommand extends VivaEngageCommand {
12
11
  get name() {
13
12
  return commands.ENGAGE_GROUP_LIST;
@@ -15,9 +14,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand {
15
14
  get description() {
16
15
  return 'Returns the list of groups in a Viva Engage network or the groups for a specific user';
17
16
  }
18
- alias() {
19
- return [yammerCommands.GROUP_LIST];
20
- }
21
17
  constructor() {
22
18
  super();
23
19
  _VivaEngageGroupListCommand_instances.add(this);
@@ -59,7 +55,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand {
59
55
  }
60
56
  }
61
57
  async commandAction(logger, args) {
62
- await this.showDeprecationWarning(logger, this.alias()[0], this.name);
63
58
  this.items = []; // this will reset the items array in interactive mode
64
59
  try {
65
60
  await this.getAllItems(logger, args, 1);
@@ -7,7 +7,6 @@ var _VivaEngageGroupUserAddCommand_instances, _VivaEngageGroupUserAddCommand_ini
7
7
  import request from '../../../../request.js';
8
8
  import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
9
9
  import commands from '../../commands.js';
10
- import yammerCommands from './yammerCommands.js';
11
10
  class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
12
11
  get name() {
13
12
  return commands.ENGAGE_GROUP_USER_ADD;
@@ -15,9 +14,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
15
14
  get description() {
16
15
  return 'Adds a user to a Viva Engage Group';
17
16
  }
18
- alias() {
19
- return [yammerCommands.GROUP_USER_ADD];
20
- }
21
17
  constructor() {
22
18
  super();
23
19
  _VivaEngageGroupUserAddCommand_instances.add(this);
@@ -26,7 +22,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
26
22
  __classPrivateFieldGet(this, _VivaEngageGroupUserAddCommand_instances, "m", _VivaEngageGroupUserAddCommand_initValidators).call(this);
27
23
  }
28
24
  async commandAction(logger, args) {
29
- await this.showDeprecationWarning(logger, this.alias()[0], this.name);
30
25
  const requestOptions = {
31
26
  url: `${this.resource}/v1/group_memberships.json`,
32
27
  headers: {
@@ -8,7 +8,6 @@ import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import VivaEngageCommand from "../../../base/VivaEngageCommand.js";
10
10
  import commands from '../../commands.js';
11
- import yammerCommands from './yammerCommands.js';
12
11
  class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
13
12
  get name() {
14
13
  return commands.ENGAGE_GROUP_USER_REMOVE;
@@ -16,9 +15,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
16
15
  get description() {
17
16
  return 'Removes a user from a Viva Engage group';
18
17
  }
19
- alias() {
20
- return [yammerCommands.GROUP_USER_REMOVE];
21
- }
22
18
  constructor() {
23
19
  super();
24
20
  _VivaEngageGroupUserRemoveCommand_instances.add(this);
@@ -27,7 +23,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
27
23
  __classPrivateFieldGet(this, _VivaEngageGroupUserRemoveCommand_instances, "m", _VivaEngageGroupUserRemoveCommand_initValidators).call(this);
28
24
  }
29
25
  async commandAction(logger, args) {
30
- await this.showDeprecationWarning(logger, this.alias()[0], this.name);
31
26
  if (args.options.force) {
32
27
  await this.executeRemoveAction(args.options);
33
28
  }