@pnp/cli-microsoft365 12.0.0-beta.0be7d8d → 12.0.0-beta.792164a

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 (128) hide show
  1. package/.devproxy/generate-openapi-spec.json +1 -1
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +2 -6
  5. package/dist/auth/FileTokenStorage.js +0 -3
  6. package/dist/auth/msalCachePlugin.js +201 -12
  7. package/dist/googleAnalytics.js +96 -0
  8. package/dist/m365/commands/logout.js +2 -4
  9. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  10. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  11. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  12. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  13. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  14. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  15. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  16. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  17. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  18. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  19. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  20. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  21. package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
  22. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  23. package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
  24. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  25. package/dist/m365/spo/commands/site/site-list.js +60 -49
  26. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  27. package/dist/m365/spo/commands/spo-get.js +5 -0
  28. package/dist/m365/spo/commands/spo-set.js +10 -21
  29. package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
  30. package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
  31. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
  32. package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
  33. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  34. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  35. package/dist/m365/spo/commands/user/user-get.js +25 -65
  36. package/dist/m365/spo/commands/user/user-list.js +10 -18
  37. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  38. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  39. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  40. package/dist/m365/spo/commands/web/web-add.js +20 -55
  41. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  42. package/dist/m365/spo/commands/web/web-get.js +12 -30
  43. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  44. package/dist/m365/spo/commands/web/web-list.js +10 -18
  45. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  46. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  47. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  48. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  49. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  50. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  51. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  52. package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
  53. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  54. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  55. package/dist/m365/spo/commands/web/web-set.js +26 -96
  56. package/dist/m365/spo/commands.js +1 -2
  57. package/dist/m365/teams/commands/channel/channel-add.js +46 -57
  58. package/dist/m365/teams/commands/channel/channel-get.js +41 -48
  59. package/dist/m365/teams/commands/channel/channel-list.js +30 -48
  60. package/dist/m365/teams/commands/channel/channel-member-add.js +55 -60
  61. package/dist/m365/teams/commands/channel/channel-member-list.js +49 -61
  62. package/dist/m365/teams/commands/channel/channel-member-remove.js +64 -68
  63. package/dist/m365/teams/commands/channel/channel-member-set.js +63 -71
  64. package/dist/m365/teams/commands/channel/channel-remove.js +49 -57
  65. package/dist/m365/teams/commands/channel/channel-set.js +49 -62
  66. package/dist/m365/teams/commands/tab/tab-get.js +2 -6
  67. package/dist/m365/teams/commands/team/team-archive.js +2 -6
  68. package/dist/m365/teams/commands/team/team-remove.js +2 -6
  69. package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
  70. package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
  71. package/dist/telemetry.js +7 -11
  72. package/dist/utils/spo.js +1 -3
  73. package/dist/utils/urlUtil.js +2 -2
  74. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  75. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  76. package/docs/docs/cmd/spo/file/file-archive.mdx +8 -0
  77. package/docs/docs/cmd/spo/file/file-remove.mdx +4 -4
  78. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +21 -0
  79. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +23 -0
  80. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +21 -0
  81. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +21 -0
  82. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +23 -0
  83. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +21 -0
  84. package/docs/docs/cmd/spo/file/file-unarchive.mdx +8 -0
  85. package/docs/docs/cmd/spo/folder/folder-archive.mdx +6 -0
  86. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  87. package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +21 -0
  88. package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
  89. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
  90. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +21 -0
  91. package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +23 -0
  92. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
  93. package/docs/docs/cmd/spo/list/list-remove.mdx +4 -4
  94. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  95. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
  96. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  97. package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
  98. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  99. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  100. package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
  101. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  102. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
  103. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
  104. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
  105. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
  106. package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
  107. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  108. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  109. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  110. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  111. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  112. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  113. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  114. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  115. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
  116. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
  117. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
  118. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
  119. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
  120. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
  121. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
  122. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
  123. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
  124. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
  125. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
  126. package/npm-shrinkwrap.json +1120 -3216
  127. package/package.json +23 -33
  128. package/dist/appInsights.js +0 -43
@@ -1,15 +1,37 @@
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 _TeamsChannelSetCommand_instances, _TeamsChannelSetCommand_initTelemetry, _TeamsChannelSetCommand_initOptions, _TeamsChannelSetCommand_initValidators, _TeamsChannelSetCommand_initOptionSets;
7
1
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
2
  import { formatting } from '../../../../utils/formatting.js';
3
+ import { teams } from '../../../../utils/teams.js';
10
4
  import { validation } from '../../../../utils/validation.js';
11
5
  import GraphCommand from '../../../base/GraphCommand.js';
12
6
  import commands from '../../commands.js';
7
+ import { globalOptionsZod } from '../../../../Command.js';
8
+ import { z } from 'zod';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ id: z.string()
12
+ .refine(val => validation.isValidTeamsChannelId(val), {
13
+ message: 'The value is not a valid Teams channel id.'
14
+ })
15
+ .optional()
16
+ .alias('i'),
17
+ name: z.string()
18
+ .refine(val => val.toLowerCase() !== 'general', {
19
+ message: 'General channel cannot be updated.'
20
+ })
21
+ .optional()
22
+ .alias('n'),
23
+ description: z.string()
24
+ .optional(),
25
+ newName: z.string()
26
+ .optional(),
27
+ teamId: z.string()
28
+ .refine(val => validation.isValidGuid(val), {
29
+ message: 'The value must be a valid GUID.'
30
+ })
31
+ .optional(),
32
+ teamName: z.string()
33
+ .optional()
34
+ });
13
35
  class TeamsChannelSetCommand extends GraphCommand {
14
36
  get name() {
15
37
  return commands.CHANNEL_SET;
@@ -17,13 +39,25 @@ class TeamsChannelSetCommand extends GraphCommand {
17
39
  get description() {
18
40
  return 'Updates properties of the specified channel in the given Microsoft Teams team';
19
41
  }
20
- constructor() {
21
- super();
22
- _TeamsChannelSetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initOptionSets).call(this);
42
+ get schema() {
43
+ return options;
44
+ }
45
+ getRefinedSchema(schema) {
46
+ return schema
47
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
48
+ message: 'Specify either id or name, but not both.',
49
+ params: {
50
+ customCode: 'optionSet',
51
+ options: ['id', 'name']
52
+ }
53
+ })
54
+ .refine(opts => [opts.teamId, opts.teamName].filter(x => x !== undefined).length === 1, {
55
+ message: 'Specify either teamId or teamName, but not both.',
56
+ params: {
57
+ customCode: 'optionSet',
58
+ options: ['teamId', 'teamName']
59
+ }
60
+ });
27
61
  }
28
62
  async commandAction(logger, args) {
29
63
  try {
@@ -58,13 +92,7 @@ class TeamsChannelSetCommand extends GraphCommand {
58
92
  if (args.options.teamId) {
59
93
  return args.options.teamId;
60
94
  }
61
- const group = await entraGroup.getGroupByDisplayName(args.options.teamName);
62
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
63
- throw 'The specified team does not exist';
64
- }
65
- else {
66
- return group.id;
67
- }
95
+ return teams.getTeamIdByDisplayName(args.options.teamName);
68
96
  }
69
97
  async getChannelId(teamId, args) {
70
98
  if (args.options.id) {
@@ -85,46 +113,5 @@ class TeamsChannelSetCommand extends GraphCommand {
85
113
  return channelItem.id;
86
114
  }
87
115
  }
88
- _TeamsChannelSetCommand_instances = new WeakSet(), _TeamsChannelSetCommand_initTelemetry = function _TeamsChannelSetCommand_initTelemetry() {
89
- this.telemetry.push((args) => {
90
- Object.assign(this.telemetryProperties, {
91
- id: typeof args.options.id !== 'undefined',
92
- name: typeof args.options.name !== 'undefined',
93
- teamId: typeof args.options.teamId !== 'undefined',
94
- teamName: typeof args.options.teamName !== 'undefined',
95
- newName: typeof args.options.newName !== 'undefined',
96
- description: typeof args.options.description !== 'undefined'
97
- });
98
- });
99
- }, _TeamsChannelSetCommand_initOptions = function _TeamsChannelSetCommand_initOptions() {
100
- this.options.unshift({
101
- option: '--teamId [teamId]'
102
- }, {
103
- option: '--teamName [teamName]'
104
- }, {
105
- option: '-i, --id [id]'
106
- }, {
107
- option: '-n, --name [name]'
108
- }, {
109
- option: '--newName [newName]'
110
- }, {
111
- option: '--description [description]'
112
- });
113
- }, _TeamsChannelSetCommand_initValidators = function _TeamsChannelSetCommand_initValidators() {
114
- this.validators.push(async (args) => {
115
- if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
116
- return `${args.options.teamId} is not a valid GUID`;
117
- }
118
- if (args.options.id && !validation.isValidTeamsChannelId(args.options.id)) {
119
- return `${args.options.id} is not a valid Teams channel id`;
120
- }
121
- if (args.options.name && args.options.name.toLowerCase() === "general") {
122
- return 'General channel cannot be updated';
123
- }
124
- return true;
125
- });
126
- }, _TeamsChannelSetCommand_initOptionSets = function _TeamsChannelSetCommand_initOptionSets() {
127
- this.optionSets.push({ options: ['id', 'name'] }, { options: ['teamId', 'teamName'] });
128
- };
129
116
  export default new TeamsChannelSetCommand();
130
117
  //# sourceMappingURL=channel-set.js.map
@@ -5,8 +5,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _TeamsTabGetCommand_instances, _TeamsTabGetCommand_initTelemetry, _TeamsTabGetCommand_initOptions, _TeamsTabGetCommand_initValidators, _TeamsTabGetCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
8
  import { formatting } from '../../../../utils/formatting.js';
9
+ import { teams } from '../../../../utils/teams.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import GraphCommand from '../../../base/GraphCommand.js';
12
12
  import commands from '../../commands.js';
@@ -31,11 +31,7 @@ class TeamsTabGetCommand extends GraphCommand {
31
31
  if (args.options.teamId) {
32
32
  return args.options.teamId;
33
33
  }
34
- const group = await entraGroup.getGroupByDisplayName(args.options.teamName);
35
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
36
- throw 'The specified team does not exist in the Microsoft Teams';
37
- }
38
- return group.id;
34
+ return teams.getTeamIdByDisplayName(args.options.teamName);
39
35
  }
40
36
  async getChannelId(args) {
41
37
  if (args.options.channelId) {
@@ -5,8 +5,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _TeamsTeamArchiveCommand_instances, _TeamsTeamArchiveCommand_initTelemetry, _TeamsTeamArchiveCommand_initOptions, _TeamsTeamArchiveCommand_initValidators, _TeamsTeamArchiveCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
8
  import { formatting } from '../../../../utils/formatting.js';
9
+ import { teams } from '../../../../utils/teams.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import GraphCommand from '../../../base/GraphCommand.js';
12
12
  import commands from '../../commands.js';
@@ -29,11 +29,7 @@ class TeamsTeamArchiveCommand extends GraphCommand {
29
29
  if (args.options.id) {
30
30
  return args.options.id;
31
31
  }
32
- const group = await entraGroup.getGroupByDisplayName(args.options.name);
33
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
34
- throw 'The specified team does not exist in the Microsoft Teams';
35
- }
36
- return group.id;
32
+ return teams.getTeamIdByDisplayName(args.options.name);
37
33
  }
38
34
  async commandAction(logger, args) {
39
35
  const siteReadOnlyForMembers = args.options.shouldSetSpoSiteReadOnlyForMembers === true;
@@ -6,8 +6,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _TeamsTeamRemoveCommand_instances, _TeamsTeamRemoveCommand_initTelemetry, _TeamsTeamRemoveCommand_initOptions, _TeamsTeamRemoveCommand_initValidators, _TeamsTeamRemoveCommand_initOptionSets;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
- import { entraGroup } from '../../../../utils/entraGroup.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
10
+ import { teams } from '../../../../utils/teams.js';
11
11
  import { validation } from '../../../../utils/validation.js';
12
12
  import GraphCommand from '../../../base/GraphCommand.js';
13
13
  import commands from '../../commands.js';
@@ -30,11 +30,7 @@ class TeamsTeamRemoveCommand extends GraphCommand {
30
30
  if (args.options.id) {
31
31
  return args.options.id;
32
32
  }
33
- const group = await entraGroup.getGroupByDisplayName(args.options.name);
34
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
35
- throw `The specified team does not exist in the Microsoft Teams`;
36
- }
37
- return group.id;
33
+ return teams.getTeamIdByDisplayName(args.options.name);
38
34
  }
39
35
  async commandAction(logger, args) {
40
36
  const removeTeam = async () => {
@@ -5,8 +5,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _TeamsTeamUnarchiveCommand_instances, _TeamsTeamUnarchiveCommand_initOptions, _TeamsTeamUnarchiveCommand_initValidators, _TeamsTeamUnarchiveCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
8
  import { formatting } from '../../../../utils/formatting.js';
9
+ import { teams } from '../../../../utils/teams.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import GraphCommand from '../../../base/GraphCommand.js';
12
12
  import commands from '../../commands.js';
@@ -28,11 +28,7 @@ class TeamsTeamUnarchiveCommand extends GraphCommand {
28
28
  if (args.options.id) {
29
29
  return args.options.id;
30
30
  }
31
- const group = await entraGroup.getGroupByDisplayName(args.options.name);
32
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
33
- throw 'The specified team does not exist in the Microsoft Teams';
34
- }
35
- return group.id;
31
+ return teams.getTeamIdByDisplayName(args.options.name);
36
32
  }
37
33
  async commandAction(logger, args) {
38
34
  const endpoint = `${this.resource}/v1.0`;
@@ -1,13 +1,14 @@
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 _UtilAccessTokenGetCommand_instances, _UtilAccessTokenGetCommand_initTelemetry, _UtilAccessTokenGetCommand_initOptions;
1
+ import { z } from 'zod';
7
2
  import auth, { Auth } from '../../../../Auth.js';
8
- import Command from '../../../../Command.js';
3
+ import Command, { globalOptionsZod } from '../../../../Command.js';
9
4
  import commands from '../../commands.js';
10
5
  import { accessToken } from '../../../../utils/accessToken.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ resource: z.string().alias('r'),
9
+ new: z.boolean().optional(),
10
+ decoded: z.boolean().optional()
11
+ });
11
12
  class UtilAccessTokenGetCommand extends Command {
12
13
  get name() {
13
14
  return commands.ACCESSTOKEN_GET;
@@ -15,11 +16,8 @@ class UtilAccessTokenGetCommand extends Command {
15
16
  get description() {
16
17
  return 'Gets access token for the specified resource';
17
18
  }
18
- constructor() {
19
- super();
20
- _UtilAccessTokenGetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _UtilAccessTokenGetCommand_instances, "m", _UtilAccessTokenGetCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _UtilAccessTokenGetCommand_instances, "m", _UtilAccessTokenGetCommand_initOptions).call(this);
19
+ get schema() {
20
+ return options;
23
21
  }
24
22
  async commandAction(logger, args) {
25
23
  let resource = args.options.resource;
@@ -49,21 +47,5 @@ class UtilAccessTokenGetCommand extends Command {
49
47
  }
50
48
  }
51
49
  }
52
- _UtilAccessTokenGetCommand_instances = new WeakSet(), _UtilAccessTokenGetCommand_initTelemetry = function _UtilAccessTokenGetCommand_initTelemetry() {
53
- this.telemetry.push((args) => {
54
- Object.assign(this.telemetryProperties, {
55
- new: args.options.new,
56
- decoded: args.options.decoded
57
- });
58
- });
59
- }, _UtilAccessTokenGetCommand_initOptions = function _UtilAccessTokenGetCommand_initOptions() {
60
- this.options.unshift({
61
- option: '-r, --resource <resource>'
62
- }, {
63
- option: '--new'
64
- }, {
65
- option: '--decoded'
66
- });
67
- };
68
50
  export default new UtilAccessTokenGetCommand();
69
51
  //# sourceMappingURL=accesstoken-get.js.map
package/dist/telemetry.js CHANGED
@@ -1,25 +1,21 @@
1
- import appInsights from './appInsights.js';
2
1
  import { cli } from './cli/cli.js';
2
+ import { googleAnalytics } from './googleAnalytics.js';
3
3
  import { settingsNames } from './settingsNames.js';
4
4
  import { pid } from './utils/pid.js';
5
5
  import { session } from './utils/session.js';
6
6
  async function trackTelemetry(object) {
7
7
  try {
8
8
  const { commandName, properties, exception } = object;
9
- appInsights.commonProperties.shell = pid.getProcessName(process.ppid) || '';
10
- appInsights.context.tags[appInsights.context.keys.sessionId] = session.getId(process.ppid);
9
+ const context = {
10
+ shell: pid.getProcessName(process.ppid) || '',
11
+ sessionId: session.getId(process.ppid)
12
+ };
11
13
  if (exception) {
12
- appInsights.trackException({
13
- exception
14
- });
14
+ await googleAnalytics.trackException(exception, context);
15
15
  }
16
16
  else {
17
- appInsights.trackEvent({
18
- name: commandName,
19
- properties
20
- });
17
+ await googleAnalytics.trackEvent(commandName, properties, context);
21
18
  }
22
- await appInsights.flush();
23
19
  }
24
20
  catch {
25
21
  // Do nothing
package/dist/utils/spo.js CHANGED
@@ -1250,9 +1250,7 @@ export const spo = {
1250
1250
  // Neither properties nor contentTypeName provided, no need to proceed
1251
1251
  throw 'Either properties or contentTypeName must be provided for systemUpdateListItem.';
1252
1252
  }
1253
- const parsedUrl = new URL(absoluteListUrl);
1254
- const serverRelativeSiteMatch = absoluteListUrl.match(new RegExp('/sites/[^/]+'));
1255
- const webUrl = `${parsedUrl.protocol}//${parsedUrl.host}${serverRelativeSiteMatch ?? ''}`;
1253
+ const webUrl = absoluteListUrl.substring(0, absoluteListUrl.indexOf('/_api/'));
1256
1254
  if (verbose && logger) {
1257
1255
  await logger.logToStderr(`Getting list id...`);
1258
1256
  }
@@ -165,8 +165,8 @@ export const urlUtil = {
165
165
  */
166
166
  getTargetSiteAbsoluteUrl(webUrl, url) {
167
167
  const fullUrl = url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
168
- // Pattern to match SharePoint URLs
169
- const urlPattern = /https:\/\/[\w-]+\.sharepoint\.com\/(teams|sites|personal)\/([\w-]+)/;
168
+ // Pattern to match SharePoint site collection URLs on any of the supported managed paths
169
+ const urlPattern = /^https:\/\/[\w-]+\.sharepoint\.com\/(teams|sites|personal)\/[^/?#]+/i;
170
170
  const match = fullUrl.match(urlPattern);
171
171
  if (match) {
172
172
  // If a match is found, return the matched URL
@@ -24,8 +24,8 @@ m365 entra m365group remove [options]
24
24
  `-f, --force`
25
25
  : Don't prompt for confirming removing the group
26
26
 
27
- `--skipRecycleBin`
28
- : Set to directly remove the group without moving it to the Recycle Bin
27
+ `--permanent`
28
+ : Permanently remove the group without leaving it in the recycle bin.
29
29
  ```
30
30
 
31
31
  <Global />
@@ -53,7 +53,7 @@ m365 entra m365group remove [options]
53
53
 
54
54
  If the specified _id_ doesn't refer to an existing group, you will get a `Resource does not exist` error. Additionally, if you do not have access to the group or the associated group-connected site, you will get an `Access denied` error.
55
55
 
56
- When you use `--skipRecycleBin` flag to remove a Microsoft 365 group permanently, the process involves deleting the associated group-connected site and the group, and then checking if the group has been moved to the deleted groups list. In some cases, it may take a few seconds for the group to appear in the deleted groups list.
56
+ When you use the `--permanent` flag to remove a Microsoft 365 group permanently, the process involves deleting the associated group-connected site and the group, and then checking if the group has been moved to the deleted groups list. In some cases, it may take a few seconds for the group to appear in the deleted groups list.
57
57
 
58
58
  To ensure a smooth deletion process, the command employs a retry mechanism with the following parameters:
59
59
 
@@ -80,7 +80,7 @@ m365 entra m365group remove --displayName Finance --force
80
80
  Remove group with id _28beab62-7540-4db1-a23f-29a6018a3848_ without prompting for confirmation and without moving it to the Recycle Bin
81
81
 
82
82
  ```sh
83
- m365 entra m365group remove --id 28beab62-7540-4db1-a23f-29a6018a3848 --force --skipRecycleBin
83
+ m365 entra m365group remove --id 28beab62-7540-4db1-a23f-29a6018a3848 --force --permanent
84
84
  ```
85
85
 
86
86
  ## Response
@@ -27,8 +27,8 @@ m365 spe container remove [options]
27
27
  `--containerTypeName [containerTypeName]`
28
28
  : The name of the container type. Specify either `containerTypeId` or `containerTypeName` when using `name` but not both.
29
29
 
30
- `--recycle`
31
- : Recycle the container instance instead of permanently deleting it.
30
+ `--permanent`
31
+ : Permanently delete the container instance instead of moving it to the recycle bin.
32
32
 
33
33
  `-f, --force`
34
34
  : Do not prompt for confirmation.
@@ -67,16 +67,16 @@ The command is based on an API that is currently in preview and is subject to ch
67
67
 
68
68
  ## Examples
69
69
 
70
- Remove a container by ID.
70
+ Move a container specified by ID to the recycle bin.
71
71
 
72
72
  ```sh
73
73
  m365 spe container remove --id "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"
74
74
  ```
75
75
 
76
- Move a container specified by ID to the recycle bin.
76
+ Permanently remove a container by ID.
77
77
 
78
78
  ```sh
79
- m365 spe container remove --id "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --recycle
79
+ m365 spe container remove --id "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" --permanent
80
80
  ```
81
81
 
82
82
  Remove a container by name specifying the container type id.
@@ -30,6 +30,14 @@ m365 spo file archive [options]
30
30
 
31
31
  <Global />
32
32
 
33
+ ## Remarks
34
+
35
+ :::warning
36
+
37
+ You will be able to reactivate an archived file instantly for the first 7 days. After that, it will take up to 24 hours to reactivate.
38
+
39
+ :::
40
+
33
41
  ## Permissions
34
42
 
35
43
  <Tabs>
@@ -30,8 +30,8 @@ m365 spo page template remove
30
30
  `--url [url]`
31
31
  : The server- or site-relative decoded URL of the file to remove. Specify either `id` or `url` but not both.
32
32
 
33
- `--recycle`
34
- : Recycle the file instead of actually deleting it.
33
+ `--permanent`
34
+ : Permanently delete the file instead of moving it to the recycle bin.
35
35
 
36
36
  `--bypassSharedLock`
37
37
  : Remove the file even if it is locked for shared use.
@@ -75,10 +75,10 @@ Remove a file by site-relative URL.
75
75
  m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/Shared Documents/Test.docx"
76
76
  ```
77
77
 
78
- Remove a file by server-relative URL to the recycle bin.
78
+ Permanently remove a file by server-relative URL.
79
79
 
80
80
  ```sh
81
- m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/sites/project-x/Shared Documents/Test.docx" --recycle
81
+ m365 spo file remove --webUrl https://contoso.sharepoint.com/sites/project-x --url "/sites/project-x/Shared Documents/Test.docx" --permanent
82
82
  ```
83
83
 
84
84
  Remove a file that is locked
@@ -36,6 +36,27 @@ m365 spo file sharinglink add [options]
36
36
 
37
37
  <Global />
38
38
 
39
+ ## Permissions
40
+
41
+ <Tabs>
42
+ <TabItem value="Delegated">
43
+
44
+ | Resource | Permissions |
45
+ |-----------------|-----------------|
46
+ | Microsoft Graph | Files.ReadWrite |
47
+ | SharePoint | AllSites.Read |
48
+
49
+ </TabItem>
50
+ <TabItem value="Application">
51
+
52
+ | Resource | Permissions |
53
+ |-----------------|---------------------|
54
+ | Microsoft Graph | Files.ReadWrite.All |
55
+ | SharePoint | Sites.Read.All |
56
+
57
+ </TabItem>
58
+ </Tabs>
59
+
39
60
  ## Examples
40
61
 
41
62
  Creates a sharing link of a specific type for a file by id.
@@ -1,4 +1,6 @@
1
1
  import Global from '../../_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
2
4
 
3
5
  # spo file sharinglink clear
4
6
 
@@ -31,6 +33,27 @@ m365 spo file sharinglink clear [options]
31
33
 
32
34
  <Global />
33
35
 
36
+ ## Permissions
37
+
38
+ <Tabs>
39
+ <TabItem value="Delegated">
40
+
41
+ | Resource | Permissions |
42
+ |-----------------|-----------------|
43
+ | Microsoft Graph | Files.ReadWrite |
44
+ | SharePoint | AllSites.Read |
45
+
46
+ </TabItem>
47
+ <TabItem value="Application">
48
+
49
+ | Resource | Permissions |
50
+ |-----------------|---------------------|
51
+ | Microsoft Graph | Files.ReadWrite.All |
52
+ | SharePoint | Sites.Read.All |
53
+
54
+ </TabItem>
55
+ </Tabs>
56
+
34
57
  ## Examples
35
58
 
36
59
  Removes all sharing links from a file specified by id without prompting for confirmation.
@@ -30,6 +30,27 @@ m365 spo file sharinglink get [options]
30
30
 
31
31
  <Global />
32
32
 
33
+ ## Permissions
34
+
35
+ <Tabs>
36
+ <TabItem value="Delegated">
37
+
38
+ | Resource | Permissions |
39
+ |-----------------|---------------|
40
+ | Microsoft Graph | Files.Read |
41
+ | SharePoint | AllSites.Read |
42
+
43
+ </TabItem>
44
+ <TabItem value="Application">
45
+
46
+ | Resource | Permissions |
47
+ |-----------------|----------------|
48
+ | Microsoft Graph | Files.Read.All |
49
+ | SharePoint | Sites.Read.All |
50
+
51
+ </TabItem>
52
+ </Tabs>
53
+
33
54
  ## Examples
34
55
 
35
56
  Gets a specific sharing link of a file by id.
@@ -30,6 +30,27 @@ m365 spo file sharinglink list [options]
30
30
 
31
31
  <Global />
32
32
 
33
+ ## Permissions
34
+
35
+ <Tabs>
36
+ <TabItem value="Delegated">
37
+
38
+ | Resource | Permissions |
39
+ |-----------------|---------------|
40
+ | Microsoft Graph | Files.Read |
41
+ | SharePoint | AllSites.Read |
42
+
43
+ </TabItem>
44
+ <TabItem value="Application">
45
+
46
+ | Resource | Permissions |
47
+ |-----------------|----------------|
48
+ | Microsoft Graph | Files.Read.All |
49
+ | SharePoint | Sites.Read.All |
50
+
51
+ </TabItem>
52
+ </Tabs>
53
+
33
54
  ## Examples
34
55
 
35
56
  List sharing links of a file by id.
@@ -1,4 +1,6 @@
1
1
  import Global from '../../_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
2
4
 
3
5
  # spo file sharinglink remove
4
6
 
@@ -31,6 +33,27 @@ m365 spo file sharinglink remove [options]
31
33
 
32
34
  <Global />
33
35
 
36
+ ## Permissions
37
+
38
+ <Tabs>
39
+ <TabItem value="Delegated">
40
+
41
+ | Resource | Permissions |
42
+ |-----------------|-----------------|
43
+ | Microsoft Graph | Files.ReadWrite |
44
+ | SharePoint | AllSites.Read |
45
+
46
+ </TabItem>
47
+ <TabItem value="Application">
48
+
49
+ | Resource | Permissions |
50
+ |-----------------|---------------------|
51
+ | Microsoft Graph | Files.ReadWrite.All |
52
+ | SharePoint | Sites.Read.All |
53
+
54
+ </TabItem>
55
+ </Tabs>
56
+
34
57
  ## Examples
35
58
 
36
59
  Removes a specific sharing link from a file by id without prompting for confirmation.
@@ -33,6 +33,27 @@ m365 spo file sharinglink set [options]
33
33
 
34
34
  <Global />
35
35
 
36
+ ## Permissions
37
+
38
+ <Tabs>
39
+ <TabItem value="Delegated">
40
+
41
+ | Resource | Permissions |
42
+ |-----------------|-----------------|
43
+ | Microsoft Graph | Files.ReadWrite |
44
+ | SharePoint | AllSites.Read |
45
+
46
+ </TabItem>
47
+ <TabItem value="Application">
48
+
49
+ | Resource | Permissions |
50
+ |-----------------|---------------------|
51
+ | Microsoft Graph | Files.ReadWrite.All |
52
+ | SharePoint | Sites.Read.All |
53
+
54
+ </TabItem>
55
+ </Tabs>
56
+
36
57
  ## Examples
37
58
 
38
59
  Updates an anonymous sharing link from a file by a specified site-relative URL with the expirationDateTime parameter.
@@ -30,6 +30,14 @@ m365 spo file unarchive [options]
30
30
 
31
31
  <Global />
32
32
 
33
+ ## Remarks
34
+
35
+ :::warning
36
+
37
+ Reactivation could take up to 24 hours. Files that are reactivated cannot be archived again for **120 days**.
38
+
39
+ :::
40
+
33
41
  ## Permissions
34
42
 
35
43
  <Tabs>