@pnp/cli-microsoft365 10.1.0-beta.282b66f → 10.1.0-beta.deac605

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 (84) hide show
  1. package/README.md +2 -2
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/AuthServer.js +1 -1
  5. package/dist/Command.js +2 -2
  6. package/dist/cli/cli.js +2 -2
  7. package/dist/m365/entra/commands/m365group/m365group-add.js +1 -1
  8. package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +21 -6
  9. package/dist/m365/entra/commands/m365group/m365group-get.js +29 -7
  10. package/dist/m365/entra/commands/m365group/m365group-list.js +1 -1
  11. package/dist/m365/entra/commands/m365group/m365group-remove.js +21 -9
  12. package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -7
  13. package/dist/m365/entra/commands/m365group/m365group-set.js +1 -1
  14. package/dist/m365/entra/commands/m365group/m365group-teamify.js +12 -21
  15. package/dist/m365/file/commands/convert/convert-pdf.js +3 -4
  16. package/dist/m365/file/commands/file-add.js +5 -6
  17. package/dist/m365/graph/commands/subscription/subscription-add.js +46 -5
  18. package/dist/m365/pp/commands/{chatbot/chatbot-get.js → copilot/copilot-get.js} +24 -20
  19. package/dist/m365/pp/commands/{chatbot/chatbot-list.js → copilot/copilot-list.js} +16 -12
  20. package/dist/m365/pp/commands/{chatbot/chatbot-remove.js → copilot/copilot-remove.js} +28 -24
  21. package/dist/m365/pp/commands.js +3 -0
  22. package/dist/m365/spfx/commands/package/package-generate.js +1 -1
  23. package/dist/m365/spfx/commands/project/JsonRule.js +2 -2
  24. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN016004_TS_property_pane_property_import.js +2 -2
  25. package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
  26. package/dist/m365/spo/commands/contenttype/contenttype-get.js +2 -2
  27. package/dist/m365/spo/commands/contenttype/contenttype-list.js +6 -3
  28. package/dist/m365/spo/commands/file/file-add.js +1 -1
  29. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -2
  30. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -2
  31. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -2
  32. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -2
  33. package/dist/m365/spo/commands/list/list-contenttype-list.js +5 -2
  34. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +10 -8
  35. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +1 -1
  36. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +1 -2
  37. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +1 -2
  38. package/dist/m365/spo/commands/page/page-add.js +1 -1
  39. package/dist/m365/spo/commands/site/site-admin-add.js +4 -12
  40. package/dist/m365/spo/commands/site/site-admin-list.js +3 -11
  41. package/dist/m365/spo/commands/site/site-admin-remove.js +4 -12
  42. package/dist/m365/spo/commands/site/site-set.js +1 -1
  43. package/dist/m365/spp/commands/model/model-remove.js +105 -0
  44. package/dist/m365/spp/commands.js +2 -1
  45. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  46. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -8
  47. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -8
  48. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -8
  49. package/dist/m365/todo/commands/list/list-remove.js +2 -1
  50. package/dist/m365/todo/commands/list/list-set.js +2 -1
  51. package/dist/m365/todo/commands/task/task-add.js +2 -1
  52. package/dist/m365/todo/commands/task/task-get.js +2 -1
  53. package/dist/m365/todo/commands/task/task-list.js +2 -1
  54. package/dist/m365/todo/commands/task/task-remove.js +2 -1
  55. package/dist/m365/todo/commands/task/task-set.js +1 -1
  56. package/dist/m365/viva/commands/engage/engage-community-set.js +111 -0
  57. package/dist/m365/viva/commands.js +1 -0
  58. package/dist/utils/entraGroup.js +18 -0
  59. package/dist/utils/formatting.js +8 -20
  60. package/dist/utils/spo.js +5 -4
  61. package/dist/utils/spp.js +3 -3
  62. package/dist/utils/urlUtil.js +11 -14
  63. package/docs/docs/cmd/entra/m365group/m365group-conversation-list.mdx +12 -3
  64. package/docs/docs/cmd/entra/m365group/m365group-get.mdx +29 -5
  65. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +7 -4
  66. package/docs/docs/cmd/entra/m365group/m365group-renew.mdx +11 -2
  67. package/docs/docs/cmd/entra/m365group/m365group-teamify.mdx +12 -3
  68. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +2 -2
  69. package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +6 -0
  70. package/docs/docs/cmd/entra/m365group/m365group-user-remove.mdx +1 -1
  71. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +3 -3
  72. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +30 -5
  73. package/docs/docs/cmd/login.mdx +45 -44
  74. package/docs/docs/cmd/pp/{chatbot/chatbot-get.mdx → copilot/copilot-get.mdx} +24 -18
  75. package/docs/docs/cmd/pp/{chatbot/chatbot-list.mdx → copilot/copilot-list.mdx} +20 -14
  76. package/docs/docs/cmd/pp/{chatbot/chatbot-remove.mdx → copilot/copilot-remove.mdx} +16 -10
  77. package/docs/docs/cmd/pp/managementapp/managementapp-add.mdx +1 -1
  78. package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +7 -1
  79. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +7 -1
  80. package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +7 -1
  81. package/docs/docs/cmd/spp/model/model-remove.mdx +57 -0
  82. package/docs/docs/cmd/viva/engage/engage-community-set.mdx +61 -0
  83. package/npm-shrinkwrap.json +6 -0
  84. package/package.json +4 -2
@@ -17,7 +17,7 @@ export class AuthServer {
17
17
  this.httpServer = http.createServer(this.httpRequest).listen(0, this.httpListener);
18
18
  };
19
19
  this.httpListener = async () => {
20
- const requestState = Math.random().toString(16).substr(2, 20);
20
+ const requestState = Math.random().toString(16).substring(2, 22);
21
21
  const address = this.httpServer.address();
22
22
  this.generatedServerUrl = `http://localhost:${address.port}`;
23
23
  const url = `${Auth.getEndpointForResource('https://login.microsoftonline.com', this.connection.cloudType)}/${this.connection.tenant}/oauth2/authorize?response_type=code&client_id=${this.connection.appId}&redirect_uri=${this.generatedServerUrl}&state=${requestState}&resource=${this.resource}&prompt=select_account`;
package/dist/Command.js CHANGED
@@ -234,7 +234,7 @@ class Command {
234
234
  if (pos1 > -1) {
235
235
  pos = pos1;
236
236
  }
237
- commandName = commandName.substr(0, pos).trim();
237
+ commandName = commandName.substring(0, pos).trim();
238
238
  }
239
239
  return commandName;
240
240
  }
@@ -572,7 +572,7 @@ class Command {
572
572
  logItem.name ?? logItem.Name;
573
573
  }
574
574
  getLogItemId(logItem) {
575
- return logItem.id ?? logItem.Id ?? logItem.ID ??
575
+ return logItem.id ?? logItem.Id?.StringValue ?? logItem.Id ?? logItem.ID ??
576
576
  logItem.uniqueId ?? logItem.UniqueId ??
577
577
  logItem.objectId ?? logItem.ObjectId ??
578
578
  logItem.url ?? logItem.Url ?? logItem.URL;
package/dist/cli/cli.js CHANGED
@@ -702,7 +702,7 @@ function printAvailableCommands() {
702
702
  commandsToPrint[commandName] = command;
703
703
  }
704
704
  else {
705
- const subCommandsGroup = commandName.substr(0, pos);
705
+ const subCommandsGroup = commandName.substring(0, pos);
706
706
  if (!commandGroupsToPrint[subCommandsGroup]) {
707
707
  commandGroupsToPrint[subCommandsGroup] = 0;
708
708
  }
@@ -867,7 +867,7 @@ function loadOptionValuesFromFiles(args) {
867
867
  !value.startsWith('@')) {
868
868
  return;
869
869
  }
870
- const filePath = value.substr(1);
870
+ const filePath = value.substring(1);
871
871
  // if the file doesn't exist, leave as-is, if it exists replace with
872
872
  // contents from the file
873
873
  if (fs.existsSync(filePath)) {
@@ -171,7 +171,7 @@ class EntraM365GroupAddCommand extends GraphCommand {
171
171
  }
172
172
  }
173
173
  getImageContentType(imagePath) {
174
- const extension = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
174
+ const extension = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();
175
175
  switch (extension) {
176
176
  case '.png':
177
177
  return 'image/png';
@@ -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 _EntraM365GroupConversationListCommand_instances, _EntraM365GroupConversationListCommand_initOptions, _EntraM365GroupConversationListCommand_initValidators;
6
+ var _EntraM365GroupConversationListCommand_instances, _EntraM365GroupConversationListCommand_initOptions, _EntraM365GroupConversationListCommand_initValidators, _EntraM365GroupConversationListCommand_initOptionSets, _EntraM365GroupConversationListCommand_initTypes;
7
7
  import { odata } from '../../../../utils/odata.js';
8
8
  import { validation } from '../../../../utils/validation.js';
9
9
  import GraphCommand from '../../../base/GraphCommand.js';
@@ -24,14 +24,23 @@ class EntraM365GroupConversationListCommand extends GraphCommand {
24
24
  _EntraM365GroupConversationListCommand_instances.add(this);
25
25
  __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initTypes).call(this);
27
29
  }
28
30
  async commandAction(logger, args) {
31
+ if (this.verbose) {
32
+ await logger.logToStderr(`Retrieving conversations for Microsoft 365 Group: ${args.options.groupId || args.options.groupName}...`);
33
+ }
29
34
  try {
30
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.groupId);
35
+ let groupId = args.options.groupId;
36
+ if (args.options.groupName) {
37
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.groupName);
38
+ }
39
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
31
40
  if (!isUnifiedGroup) {
32
- throw Error(`Specified group with id '${args.options.groupId}' is not a Microsoft 365 group.`);
41
+ throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
33
42
  }
34
- const conversations = await odata.getAllItems(`${this.resource}/v1.0/groups/${args.options.groupId}/conversations`);
43
+ const conversations = await odata.getAllItems(`${this.resource}/v1.0/groups/${groupId}/conversations`);
35
44
  await logger.log(conversations);
36
45
  }
37
46
  catch (err) {
@@ -41,15 +50,21 @@ class EntraM365GroupConversationListCommand extends GraphCommand {
41
50
  }
42
51
  _EntraM365GroupConversationListCommand_instances = new WeakSet(), _EntraM365GroupConversationListCommand_initOptions = function _EntraM365GroupConversationListCommand_initOptions() {
43
52
  this.options.unshift({
44
- option: '-i, --groupId <groupId>'
53
+ option: '-i, --groupId [groupId]'
54
+ }, {
55
+ option: '-n, --groupName [groupName]'
45
56
  });
46
57
  }, _EntraM365GroupConversationListCommand_initValidators = function _EntraM365GroupConversationListCommand_initValidators() {
47
58
  this.validators.push(async (args) => {
48
- if (!validation.isValidGuid(args.options.groupId)) {
59
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
49
60
  return `${args.options.groupId} is not a valid GUID`;
50
61
  }
51
62
  return true;
52
63
  });
64
+ }, _EntraM365GroupConversationListCommand_initOptionSets = function _EntraM365GroupConversationListCommand_initOptionSets() {
65
+ this.optionSets.push({ options: ['groupId', 'groupName'] });
66
+ }, _EntraM365GroupConversationListCommand_initTypes = function _EntraM365GroupConversationListCommand_initTypes() {
67
+ this.types.string.push('groupId', 'groupName');
53
68
  };
54
69
  export default new EntraM365GroupConversationListCommand();
55
70
  //# sourceMappingURL=m365group-conversation-list.js.map
@@ -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 _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators;
6
+ var _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators, _EntraM365GroupGetCommand_initOptionSets, _EntraM365GroupGetCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -21,15 +21,31 @@ class EntraM365GroupGetCommand extends GraphCommand {
21
21
  _EntraM365GroupGetCommand_instances.add(this);
22
22
  __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptions).call(this);
23
23
  __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initValidators).call(this);
24
+ __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptionSets).call(this);
25
+ __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initTypes).call(this);
24
26
  }
25
27
  async commandAction(logger, args) {
26
28
  let group;
27
29
  try {
28
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
30
+ if (args.options.id) {
31
+ group = await entraGroup.getGroupById(args.options.id);
32
+ }
33
+ else {
34
+ group = await entraGroup.getGroupByDisplayName(args.options.displayName);
35
+ }
36
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(group.id);
29
37
  if (!isUnifiedGroup) {
30
- throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
38
+ throw Error(`Specified group with id '${group.id}' is not a Microsoft 365 group.`);
31
39
  }
32
- group = await entraGroup.getGroupById(args.options.id);
40
+ const requestExtendedOptions = {
41
+ url: `${this.resource}/v1.0/groups/${group.id}?$select=allowExternalSenders,autoSubscribeNewMembers,hideFromAddressLists,hideFromOutlookClients,isSubscribedByMail`,
42
+ headers: {
43
+ accept: 'application/json;odata.metadata=none'
44
+ },
45
+ responseType: 'json'
46
+ };
47
+ const groupExtended = await request.get(requestExtendedOptions);
48
+ group = { ...group, ...groupExtended };
33
49
  if (args.options.includeSiteUrl) {
34
50
  const requestOptions = {
35
51
  url: `${this.resource}/v1.0/groups/${group.id}/drive?$select=webUrl`,
@@ -39,7 +55,7 @@ class EntraM365GroupGetCommand extends GraphCommand {
39
55
  responseType: 'json'
40
56
  };
41
57
  const res = await request.get(requestOptions);
42
- group.siteUrl = res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : '';
58
+ group.siteUrl = res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : '';
43
59
  }
44
60
  await logger.log(group);
45
61
  }
@@ -50,17 +66,23 @@ class EntraM365GroupGetCommand extends GraphCommand {
50
66
  }
51
67
  _EntraM365GroupGetCommand_instances = new WeakSet(), _EntraM365GroupGetCommand_initOptions = function _EntraM365GroupGetCommand_initOptions() {
52
68
  this.options.unshift({
53
- option: '-i, --id <id>'
69
+ option: '-i, --id [id]'
70
+ }, {
71
+ option: '-n, --displayName [displayName]'
54
72
  }, {
55
73
  option: '--includeSiteUrl'
56
74
  });
57
75
  }, _EntraM365GroupGetCommand_initValidators = function _EntraM365GroupGetCommand_initValidators() {
58
76
  this.validators.push(async (args) => {
59
- if (!validation.isValidGuid(args.options.id)) {
77
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
60
78
  return `${args.options.id} is not a valid GUID`;
61
79
  }
62
80
  return true;
63
81
  });
82
+ }, _EntraM365GroupGetCommand_initOptionSets = function _EntraM365GroupGetCommand_initOptionSets() {
83
+ this.optionSets.push({ options: ['id', 'displayName'] });
84
+ }, _EntraM365GroupGetCommand_initTypes = function _EntraM365GroupGetCommand_initTypes() {
85
+ this.types.string.push('id', 'displayName');
64
86
  };
65
87
  export default new EntraM365GroupGetCommand();
66
88
  //# sourceMappingURL=m365group-get.js.map
@@ -72,7 +72,7 @@ class EntraM365GroupListCommand extends GraphCommand {
72
72
  const res = await request.get(requestOptions);
73
73
  return {
74
74
  id: groupId,
75
- url: res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : ''
75
+ url: res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : ''
76
76
  };
77
77
  }
78
78
  }
@@ -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 _EntraM365GroupRemoveCommand_instances, _EntraM365GroupRemoveCommand_initTelemetry, _EntraM365GroupRemoveCommand_initOptions, _EntraM365GroupRemoveCommand_initValidators;
6
+ var _EntraM365GroupRemoveCommand_instances, _EntraM365GroupRemoveCommand_initTelemetry, _EntraM365GroupRemoveCommand_initOptions, _EntraM365GroupRemoveCommand_initValidators, _EntraM365GroupRemoveCommand_initOptionSets, _EntraM365GroupRemoveCommand_initTypes;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { entraGroup } from '../../../../utils/entraGroup.js';
@@ -28,23 +28,29 @@ class EntraM365GroupRemoveCommand extends GraphCommand {
28
28
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initTelemetry).call(this);
29
29
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initOptions).call(this);
30
30
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initValidators).call(this);
31
+ __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initOptionSets).call(this);
32
+ __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initTypes).call(this);
31
33
  }
32
34
  async commandAction(logger, args) {
33
35
  const removeGroup = async () => {
34
36
  if (this.verbose) {
35
- await logger.logToStderr(`Removing Microsoft 365 Group: ${args.options.id}...`);
37
+ await logger.logToStderr(`Removing Microsoft 365 Group: ${args.options.id || args.options.displayName}...`);
36
38
  }
37
39
  try {
38
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
40
+ let groupId = args.options.id;
41
+ if (args.options.displayName) {
42
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.displayName);
43
+ }
44
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
39
45
  if (!isUnifiedGroup) {
40
- throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
46
+ throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
41
47
  }
42
- const siteUrl = await this.getM365GroupSiteUrl(logger, args.options.id);
48
+ const siteUrl = await this.getM365GroupSiteUrl(logger, groupId);
43
49
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
44
50
  // Delete the Microsoft 365 group site. This operation will also delete the group.
45
51
  await this.deleteM365GroupSite(logger, siteUrl, spoAdminUrl);
46
52
  if (args.options.skipRecycleBin) {
47
- await this.deleteM365GroupFromRecycleBin(logger, args.options.id);
53
+ await this.deleteM365GroupFromRecycleBin(logger, groupId);
48
54
  await this.deleteSiteFromRecycleBin(logger, siteUrl, spoAdminUrl);
49
55
  }
50
56
  }
@@ -56,7 +62,7 @@ class EntraM365GroupRemoveCommand extends GraphCommand {
56
62
  await removeGroup();
57
63
  }
58
64
  else {
59
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the group ${args.options.id}?` });
65
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the group ${args.options.id || args.options.displayName}?` });
60
66
  if (result) {
61
67
  await removeGroup();
62
68
  }
@@ -168,7 +174,9 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
168
174
  });
169
175
  }, _EntraM365GroupRemoveCommand_initOptions = function _EntraM365GroupRemoveCommand_initOptions() {
170
176
  this.options.unshift({
171
- option: '-i, --id <id>'
177
+ option: '-i, --id [id]'
178
+ }, {
179
+ option: '-n, --displayName [displayName]'
172
180
  }, {
173
181
  option: '-f, --force'
174
182
  }, {
@@ -176,11 +184,15 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
176
184
  });
177
185
  }, _EntraM365GroupRemoveCommand_initValidators = function _EntraM365GroupRemoveCommand_initValidators() {
178
186
  this.validators.push(async (args) => {
179
- if (!validation.isValidGuid(args.options.id)) {
187
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
180
188
  return `${args.options.id} is not a valid GUID`;
181
189
  }
182
190
  return true;
183
191
  });
192
+ }, _EntraM365GroupRemoveCommand_initOptionSets = function _EntraM365GroupRemoveCommand_initOptionSets() {
193
+ this.optionSets.push({ options: ['id', 'displayName'] });
194
+ }, _EntraM365GroupRemoveCommand_initTypes = function _EntraM365GroupRemoveCommand_initTypes() {
195
+ this.types.string.push('id', 'displayName');
184
196
  };
185
197
  EntraM365GroupRemoveCommand.maxRetries = 10;
186
198
  export default new EntraM365GroupRemoveCommand();
@@ -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 _EntraM365GroupRenewCommand_instances, _EntraM365GroupRenewCommand_initOptions, _EntraM365GroupRenewCommand_initValidators;
6
+ var _EntraM365GroupRenewCommand_instances, _EntraM365GroupRenewCommand_initOptions, _EntraM365GroupRenewCommand_initValidators, _EntraM365GroupRenewCommand_initOptionSets, _EntraM365GroupRenewCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -21,18 +21,24 @@ class EntraM365GroupRenewCommand extends GraphCommand {
21
21
  _EntraM365GroupRenewCommand_instances.add(this);
22
22
  __classPrivateFieldGet(this, _EntraM365GroupRenewCommand_instances, "m", _EntraM365GroupRenewCommand_initOptions).call(this);
23
23
  __classPrivateFieldGet(this, _EntraM365GroupRenewCommand_instances, "m", _EntraM365GroupRenewCommand_initValidators).call(this);
24
+ __classPrivateFieldGet(this, _EntraM365GroupRenewCommand_instances, "m", _EntraM365GroupRenewCommand_initOptionSets).call(this);
25
+ __classPrivateFieldGet(this, _EntraM365GroupRenewCommand_instances, "m", _EntraM365GroupRenewCommand_initTypes).call(this);
24
26
  }
25
27
  async commandAction(logger, args) {
26
28
  if (this.verbose) {
27
- await logger.logToStderr(`Renewing Microsoft 365 group's expiration: ${args.options.id}...`);
29
+ await logger.logToStderr(`Renewing Microsoft 365 group's expiration: ${args.options.id || args.options.displayName}...`);
28
30
  }
29
31
  try {
30
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
32
+ let groupId = args.options.id;
33
+ if (args.options.displayName) {
34
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.displayName);
35
+ }
36
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
31
37
  if (!isUnifiedGroup) {
32
- throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
38
+ throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
33
39
  }
34
40
  const requestOptions = {
35
- url: `${this.resource}/v1.0/groups/${args.options.id}/renew/`,
41
+ url: `${this.resource}/v1.0/groups/${groupId}/renew/`,
36
42
  headers: {
37
43
  'accept': 'application/json;odata.metadata=none'
38
44
  }
@@ -46,15 +52,21 @@ class EntraM365GroupRenewCommand extends GraphCommand {
46
52
  }
47
53
  _EntraM365GroupRenewCommand_instances = new WeakSet(), _EntraM365GroupRenewCommand_initOptions = function _EntraM365GroupRenewCommand_initOptions() {
48
54
  this.options.unshift({
49
- option: '-i, --id <id>'
55
+ option: '-i, --id [id]'
56
+ }, {
57
+ option: '-n, --displayName [displayName]'
50
58
  });
51
59
  }, _EntraM365GroupRenewCommand_initValidators = function _EntraM365GroupRenewCommand_initValidators() {
52
60
  this.validators.push(async (args) => {
53
- if (!validation.isValidGuid(args.options.id)) {
61
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
54
62
  return `${args.options.id} is not a valid GUID`;
55
63
  }
56
64
  return true;
57
65
  });
66
+ }, _EntraM365GroupRenewCommand_initOptionSets = function _EntraM365GroupRenewCommand_initOptionSets() {
67
+ this.optionSets.push({ options: ['id', 'displayName'] });
68
+ }, _EntraM365GroupRenewCommand_initTypes = function _EntraM365GroupRenewCommand_initTypes() {
69
+ this.types.string.push('id', 'displayName');
58
70
  };
59
71
  export default new EntraM365GroupRenewCommand();
60
72
  //# sourceMappingURL=m365group-renew.js.map
@@ -128,7 +128,7 @@ class EntraM365GroupSetCommand extends GraphCommand {
128
128
  }
129
129
  }
130
130
  getImageContentType(imagePath) {
131
- const extension = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
131
+ const extension = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();
132
132
  switch (extension) {
133
133
  case '.png':
134
134
  return 'image/png';
@@ -3,8 +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 _EntraM365GroupTeamifyCommand_instances, _EntraM365GroupTeamifyCommand_initTelemetry, _EntraM365GroupTeamifyCommand_initOptions, _EntraM365GroupTeamifyCommand_initValidators, _EntraM365GroupTeamifyCommand_initOptionSets;
7
- import { cli } from '../../../../cli/cli.js';
6
+ var _EntraM365GroupTeamifyCommand_instances, _EntraM365GroupTeamifyCommand_initTelemetry, _EntraM365GroupTeamifyCommand_initOptions, _EntraM365GroupTeamifyCommand_initValidators, _EntraM365GroupTeamifyCommand_initOptionSets, _EntraM365GroupTeamifyCommand_initTypes;
8
7
  import request from '../../../../request.js';
9
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -25,29 +24,16 @@ class EntraM365GroupTeamifyCommand extends GraphCommand {
25
24
  __classPrivateFieldGet(this, _EntraM365GroupTeamifyCommand_instances, "m", _EntraM365GroupTeamifyCommand_initOptions).call(this);
26
25
  __classPrivateFieldGet(this, _EntraM365GroupTeamifyCommand_instances, "m", _EntraM365GroupTeamifyCommand_initValidators).call(this);
27
26
  __classPrivateFieldGet(this, _EntraM365GroupTeamifyCommand_instances, "m", _EntraM365GroupTeamifyCommand_initOptionSets).call(this);
27
+ __classPrivateFieldGet(this, _EntraM365GroupTeamifyCommand_instances, "m", _EntraM365GroupTeamifyCommand_initTypes).call(this);
28
28
  }
29
29
  async getGroupId(options) {
30
30
  if (options.id) {
31
31
  return options.id;
32
32
  }
33
- const requestOptions = {
34
- url: `${this.resource}/v1.0/groups?$filter=mailNickname eq '${formatting.encodeQueryParameter(options.mailNickname)}'`,
35
- headers: {
36
- accept: 'application/json;odata.metadata=none'
37
- },
38
- responseType: 'json'
39
- };
40
- const response = await request.get(requestOptions);
41
- const groupItem = response.value[0];
42
- if (!groupItem) {
43
- throw `The specified Microsoft 365 Group does not exist`;
33
+ if (options.displayName) {
34
+ return await entraGroup.getGroupIdByDisplayName(options.displayName);
44
35
  }
45
- if (response.value.length > 1) {
46
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
47
- const result = await cli.handleMultipleResultsFound(`Multiple Microsoft 365 Groups with name '${options.mailNickname}' found.`, resultAsKeyValuePair);
48
- return result.id;
49
- }
50
- return groupItem.id;
36
+ return await entraGroup.getGroupIdByMailNickname(options.mailNickname);
51
37
  }
52
38
  async commandAction(logger, args) {
53
39
  try {
@@ -89,12 +75,15 @@ _EntraM365GroupTeamifyCommand_instances = new WeakSet(), _EntraM365GroupTeamifyC
89
75
  this.telemetry.push((args) => {
90
76
  Object.assign(this.telemetryProperties, {
91
77
  id: typeof args.options.id !== 'undefined',
92
- mailNickname: typeof args.options.mailNickname !== 'undefined'
78
+ mailNickname: typeof args.options.mailNickname !== 'undefined',
79
+ displayName: typeof args.options.displayName !== 'undefined'
93
80
  });
94
81
  });
95
82
  }, _EntraM365GroupTeamifyCommand_initOptions = function _EntraM365GroupTeamifyCommand_initOptions() {
96
83
  this.options.unshift({
97
84
  option: '-i, --id [id]'
85
+ }, {
86
+ option: '-n, --displayName [displayName]'
98
87
  }, {
99
88
  option: '--mailNickname [mailNickname]'
100
89
  });
@@ -106,7 +95,9 @@ _EntraM365GroupTeamifyCommand_instances = new WeakSet(), _EntraM365GroupTeamifyC
106
95
  return true;
107
96
  });
108
97
  }, _EntraM365GroupTeamifyCommand_initOptionSets = function _EntraM365GroupTeamifyCommand_initOptionSets() {
109
- this.optionSets.push({ options: ['id', 'mailNickname'] });
98
+ this.optionSets.push({ options: ['id', 'displayName', 'mailNickname'] });
99
+ }, _EntraM365GroupTeamifyCommand_initTypes = function _EntraM365GroupTeamifyCommand_initTypes() {
100
+ this.types.string.push('id', 'displayName', 'mailNickname');
110
101
  };
111
102
  export default new EntraM365GroupTeamifyCommand();
112
103
  //# sourceMappingURL=m365group-teamify.js.map
@@ -7,7 +7,6 @@ var _FileConvertPdfCommand_instances, _FileConvertPdfCommand_initOptions, _FileC
7
7
  import fs from 'fs';
8
8
  import os from 'os';
9
9
  import path from 'path';
10
- import url from 'url';
11
10
  import { v4 } from 'uuid';
12
11
  import auth from '../../../../Auth.js';
13
12
  import { CommandError } from '../../../../Command.js';
@@ -179,12 +178,12 @@ class FileConvertPdfCommand extends GraphCommand {
179
178
  }
180
179
  return fileGraphUrl;
181
180
  }
182
- const _url = url.parse(fileWebUrl);
181
+ const _url = new URL(fileWebUrl);
183
182
  let siteId = '';
184
183
  let driveRelativeFileUrl = '';
185
- const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.host, _url.path);
184
+ const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.hostname, _url.pathname);
186
185
  siteId = siteInfo.id;
187
- let siteRelativeFileUrl = _url.path.replace(siteInfo.serverRelativeUrl, '');
186
+ let siteRelativeFileUrl = _url.pathname.replace(siteInfo.serverRelativeUrl, '');
188
187
  // normalize site-relative URLs for root site collections and root sites
189
188
  if (!siteRelativeFileUrl.startsWith('/')) {
190
189
  siteRelativeFileUrl = '/' + siteRelativeFileUrl;
@@ -6,7 +6,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _FileAddCommand_instances, _FileAddCommand_initTelemetry, _FileAddCommand_initOptions, _FileAddCommand_initValidators;
7
7
  import fs from 'fs';
8
8
  import path from 'path';
9
- import url from 'url';
10
9
  import request from '../../../request.js';
11
10
  import { validation } from '../../../utils/validation.js';
12
11
  import GraphCommand from '../../base/GraphCommand.js';
@@ -28,7 +27,7 @@ class FileAddCommand extends GraphCommand {
28
27
  async commandAction(logger, args) {
29
28
  let folderUrlWithoutTrailingSlash = args.options.folderUrl;
30
29
  if (folderUrlWithoutTrailingSlash.endsWith('/')) {
31
- folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substr(0, folderUrlWithoutTrailingSlash.length - 1);
30
+ folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substring(0, folderUrlWithoutTrailingSlash.length - 1);
32
31
  }
33
32
  try {
34
33
  const graphFileUrl = await this.getGraphFileUrl(logger, `${folderUrlWithoutTrailingSlash}/${path.basename(args.options.filePath)}`, args.options.siteUrl);
@@ -97,14 +96,14 @@ class FileAddCommand extends GraphCommand {
97
96
  if (this.debug) {
98
97
  await logger.logToStderr(`Resolving Graph drive item URL for ${fileWebUrl}`);
99
98
  }
100
- const _fileWebUrl = url.parse(fileWebUrl);
101
- const _siteUrl = url.parse(siteUrl || fileWebUrl);
99
+ const _fileWebUrl = new URL(fileWebUrl);
100
+ const _siteUrl = new URL(siteUrl || fileWebUrl);
102
101
  const isSiteUrl = typeof siteUrl !== 'undefined';
103
102
  let siteId = '';
104
103
  let driveRelativeFileUrl = '';
105
- const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host, _siteUrl.path, isSiteUrl);
104
+ const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host, _siteUrl.pathname, isSiteUrl);
106
105
  siteId = siteInfo.id;
107
- let siteRelativeFileUrl = _fileWebUrl.path.replace(siteInfo.serverRelativeUrl, '');
106
+ let siteRelativeFileUrl = _fileWebUrl.pathname.replace(siteInfo.serverRelativeUrl, '');
108
107
  // normalize site-relative URLs for root site collections and root sites
109
108
  if (!siteRelativeFileUrl.startsWith('/')) {
110
109
  siteRelativeFileUrl = '/' + siteRelativeFileUrl;
@@ -37,6 +37,7 @@ class GraphSubscriptionAddCommand extends GraphCommand {
37
37
  constructor() {
38
38
  super();
39
39
  _GraphSubscriptionAddCommand_instances.add(this);
40
+ this.allowedTlsVersions = ['v1_0', 'v1_1', 'v1_2', 'v1_3'];
40
41
  __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initTelemetry).call(this);
41
42
  __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initOptions).call(this);
42
43
  __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initValidators).call(this);
@@ -46,11 +47,15 @@ class GraphSubscriptionAddCommand extends GraphCommand {
46
47
  changeType: args.options.changeTypes,
47
48
  resource: args.options.resource,
48
49
  notificationUrl: args.options.notificationUrl,
49
- expirationDateTime: await this.getExpirationDateTimeOrDefault(logger, args)
50
+ expirationDateTime: await this.getExpirationDateTimeOrDefault(logger, args),
51
+ clientState: args.options.clientState,
52
+ includeResourceData: args.options.includeResourceData,
53
+ encryptionCertificate: args.options.encryptionCertificate,
54
+ encryptionCertificateId: args.options.encryptionCertificateId,
55
+ lifecycleNotificationUrl: args.options.lifecycleNotificationUrl,
56
+ notificationUrlAppId: args.options.notificationUrlAppId,
57
+ latestSupportedTlsVersion: args.options.latestTLSVersion
50
58
  };
51
- if (args.options.clientState) {
52
- data["clientState"] = args.options.clientState;
53
- }
54
59
  const requestOptions = {
55
60
  url: `${this.resource}/v1.0/subscriptions`,
56
61
  headers: {
@@ -123,7 +128,13 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
123
128
  Object.assign(this.telemetryProperties, {
124
129
  changeTypes: args.options.changeTypes,
125
130
  expirationDateTime: typeof args.options.expirationDateTime !== 'undefined',
126
- clientState: typeof args.options.clientState !== 'undefined'
131
+ clientState: typeof args.options.clientState !== 'undefined',
132
+ lifecycleNotificationUrl: typeof args.options.lifecycleNotificationUrl !== 'undefined',
133
+ notificationUrlAppId: typeof args.options.notificationUrlAppId !== 'undefined',
134
+ latestTLSVersion: typeof args.options.latestTLSVersion !== 'undefined',
135
+ includeResourceData: !!args.options.includeResourceData,
136
+ encryptionCertificate: typeof args.options.encryptionCertificate !== 'undefined',
137
+ encryptionCertificateId: typeof args.options.encryptionCertificateId !== 'undefined'
127
138
  });
128
139
  });
129
140
  }, _GraphSubscriptionAddCommand_initOptions = function _GraphSubscriptionAddCommand_initOptions() {
@@ -138,6 +149,19 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
138
149
  option: '-e, --expirationDateTime [expirationDateTime]'
139
150
  }, {
140
151
  option: '-s, --clientState [clientState]'
152
+ }, {
153
+ option: '--lifecycleNotificationUrl [lifecycleNotificationUrl]'
154
+ }, {
155
+ option: '--notificationUrlAppId [notificationUrlAppId]'
156
+ }, {
157
+ option: '--latestTLSVersion [latestTLSVersion]',
158
+ autocomplete: this.allowedTlsVersions
159
+ }, {
160
+ option: '--includeResourceData [includeResourceData]'
161
+ }, {
162
+ option: '--encryptionCertificate [encryptionCertificate]'
163
+ }, {
164
+ option: '--encryptionCertificateId [encryptionCertificateId]'
141
165
  });
142
166
  }, _GraphSubscriptionAddCommand_initValidators = function _GraphSubscriptionAddCommand_initValidators() {
143
167
  this.validators.push(async (args) => {
@@ -155,6 +179,23 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
155
179
  if (args.options.clientState && args.options.clientState.length > 128) {
156
180
  return 'The clientState value exceeds the maximum length of 128 characters';
157
181
  }
182
+ if (args.options.lifecycleNotificationUrl && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('https://')
183
+ && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('eventhub:https://')
184
+ && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('eventgrid:?azuresubscriptionid=')) {
185
+ return `The lifecycle notification URL '${args.options.lifecycleNotificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`;
186
+ }
187
+ if (args.options.latestTLSVersion && this.allowedTlsVersions.map(x => x.toLowerCase()).indexOf(args.options.latestTLSVersion.toLowerCase()) === -1) {
188
+ return `${args.options.latestTLSVersion} is not a valid TLS version. Allowed values are ${this.allowedTlsVersions.join(', ')}`;
189
+ }
190
+ if (args.options.includeResourceData && !args.options.encryptionCertificate) {
191
+ return `The 'encryptionCertificate' options is required to include the changed resource data`;
192
+ }
193
+ if (args.options.includeResourceData && !args.options.encryptionCertificateId) {
194
+ return `The 'encryptionCertificateId' options is required to include the changed resource data`;
195
+ }
196
+ if (args.options.notificationUrlAppId && !validation.isValidGuid(args.options.notificationUrlAppId)) {
197
+ return `${args.options.notificationUrlAppId} is not a valid GUID for the 'notificationUrlAppId'`;
198
+ }
158
199
  return true;
159
200
  });
160
201
  };