@pnp/cli-microsoft365 11.0.0-beta.677f8d3 → 11.0.0-beta.d3d8993

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 (86) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Command.js +4 -0
  4. package/dist/config.js +1 -0
  5. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
  6. package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
  7. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
  8. package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
  10. package/dist/m365/entra/commands/group/group-member-add.js +6 -27
  11. package/dist/m365/entra/commands/group/group-member-set.js +5 -26
  12. package/dist/m365/entra/commands/m365group/m365group-get.js +1 -7
  13. package/dist/m365/entra/commands/m365group/m365group-list.js +1 -7
  14. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +1 -7
  15. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +1 -7
  16. package/dist/m365/entra/commands/pim/pim-role-request-list.js +1 -7
  17. package/dist/m365/flow/commands/flow-list.js +7 -14
  18. package/dist/m365/flow/commands/run/run-get.js +1 -7
  19. package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
  20. package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
  21. package/dist/m365/graph/commands/subscription/subscription-add.js +3 -10
  22. package/dist/m365/pp/commands/solution/solution-publisher-list.js +1 -8
  23. package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +1 -7
  24. package/dist/m365/spe/commands/container/container-add.js +1 -3
  25. package/dist/m365/spe/commands/container/container-list.js +1 -3
  26. package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +1 -3
  27. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +1 -3
  28. package/dist/m365/spe/commands/container/container-remove.js +1 -3
  29. package/dist/m365/spe/commands/containertype/containertype-add.js +67 -90
  30. package/dist/m365/spe/commands/containertype/containertype-get.js +53 -81
  31. package/dist/m365/spe/commands/containertype/containertype-list.js +8 -19
  32. package/dist/m365/spe/commands/containertype/containertype-remove.js +27 -5
  33. package/dist/m365/spo/commands/file/file-move.js +2 -8
  34. package/dist/m365/spo/commands/homesite/homesite-add.js +26 -2
  35. package/dist/m365/spo/commands/hubsite/hubsite-get.js +4 -13
  36. package/dist/m365/spo/commands/hubsite/hubsite-list.js +1 -8
  37. package/dist/m365/spo/commands/{tenant/tenant-site-archive.js → site/site-archive.js} +14 -14
  38. package/dist/m365/spo/commands/{tenant/tenant-site-list.js → site/site-list.js} +16 -27
  39. package/dist/m365/spo/commands/{tenant/tenant-site-membership-list.js → site/site-membership-list.js} +15 -15
  40. package/dist/m365/spo/commands/{tenant/tenant-site-rename.js → site/site-rename.js} +14 -14
  41. package/dist/m365/spo/commands/{tenant/tenant-site-unarchive.js → site/site-unarchive.js} +14 -14
  42. package/dist/m365/spo/commands/term/term-list.js +1 -7
  43. package/dist/m365/spo/commands.js +4 -5
  44. package/dist/m365/teams/commands/chat/chat-member-add.js +3 -9
  45. package/dist/m365/viva/commands/engage/engage-network-list.js +1 -7
  46. package/dist/utils/spe.js +5 -39
  47. package/docs/docs/cmd/entra/group/group-member-add.mdx +7 -26
  48. package/docs/docs/cmd/entra/group/group-member-set.mdx +5 -23
  49. package/docs/docs/cmd/entra/m365group/m365group-get.mdx +0 -3
  50. package/docs/docs/cmd/entra/m365group/m365group-list.mdx +0 -3
  51. package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +0 -3
  52. package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +0 -3
  53. package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +0 -3
  54. package/docs/docs/cmd/flow/flow-list.mdx +0 -3
  55. package/docs/docs/cmd/flow/run/run-get.mdx +0 -3
  56. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +0 -3
  57. package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +0 -3
  58. package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +0 -3
  59. package/docs/docs/cmd/spe/container/container-activate.mdx +21 -0
  60. package/docs/docs/cmd/spe/container/container-add.mdx +29 -0
  61. package/docs/docs/cmd/spe/container/container-get.mdx +20 -1
  62. package/docs/docs/cmd/spe/container/container-list.mdx +29 -0
  63. package/docs/docs/cmd/spe/container/container-permission-list.mdx +19 -0
  64. package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +29 -0
  65. package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +31 -0
  66. package/docs/docs/cmd/spe/container/container-remove.mdx +31 -0
  67. package/docs/docs/cmd/spe/containertype/containertype-add.mdx +111 -55
  68. package/docs/docs/cmd/spe/containertype/containertype-get.mdx +69 -38
  69. package/docs/docs/cmd/spe/containertype/containertype-list.mdx +59 -31
  70. package/docs/docs/cmd/spe/containertype/containertype-remove.mdx +31 -4
  71. package/docs/docs/cmd/spo/file/file-move.mdx +0 -3
  72. package/docs/docs/cmd/spo/homesite/homesite-add.mdx +13 -4
  73. package/docs/docs/cmd/spo/homesite/homesite-set.mdx +1 -1
  74. package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +0 -3
  75. package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +0 -3
  76. package/docs/docs/cmd/spo/{tenant/tenant-site-archive.mdx → site/site-archive.mdx} +4 -4
  77. package/docs/docs/cmd/spo/{tenant/tenant-site-list.mdx → site/site-list.mdx} +7 -16
  78. package/docs/docs/cmd/spo/{tenant/tenant-site-membership-list.mdx → site/site-membership-list.mdx} +5 -5
  79. package/docs/docs/cmd/spo/{tenant/tenant-site-rename.mdx → site/site-rename.mdx} +7 -7
  80. package/docs/docs/cmd/spo/{tenant/tenant-site-unarchive.mdx → site/site-unarchive.mdx} +4 -4
  81. package/docs/docs/cmd/spo/term/term-list.mdx +0 -3
  82. package/docs/docs/cmd/teams/chat/chat-member-add.mdx +2 -5
  83. package/docs/docs/cmd/viva/engage/engage-network-list.mdx +0 -3
  84. package/package.json +1 -1
  85. package/dist/m365/spo/commands/tenant/SPOTenantSitePropertiesEnumerable.js +0 -2
  86. package/dist/m365/spo/commands/tenant/TenantSiteProperties.js +0 -2
@@ -1,99 +1,71 @@
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 _SpeContainerTypeGetCommand_instances, _SpeContainerTypeGetCommand_initTelemetry, _SpeContainerTypeGetCommand_initOptions, _SpeContainerTypeGetCommand_initOptionSets, _SpeContainerTypeGetCommand_initValidators, _SpeContainerTypeGetCommand_initTypes;
7
- import config from '../../../../config.js';
8
- import request from '../../../../request.js';
9
- import { spe } from '../../../../utils/spe.js';
10
- import { spo } from '../../../../utils/spo.js';
11
1
  import { validation } from '../../../../utils/validation.js';
12
- import SpoCommand from '../../../base/SpoCommand.js';
13
2
  import commands from '../../commands.js';
14
- class SpeContainerTypeGetCommand extends SpoCommand {
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import { z } from 'zod';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
7
+ import { formatting } from '../../../../utils/formatting.js';
8
+ import request from '../../../../request.js';
9
+ import { odata } from '../../../../utils/odata.js';
10
+ import { cli } from '../../../../cli/cli.js';
11
+ const options = globalOptionsZod
12
+ .extend({
13
+ id: zod.alias('i', z.string()
14
+ .refine(id => validation.isValidGuid(id), id => ({
15
+ message: `'${id}' is not a valid GUID.`
16
+ }))
17
+ .optional()),
18
+ name: zod.alias('n', z.string().optional())
19
+ })
20
+ .strict();
21
+ class SpeContainerTypeGetCommand extends GraphDelegatedCommand {
15
22
  get name() {
16
23
  return commands.CONTAINERTYPE_GET;
17
24
  }
18
25
  get description() {
19
- return 'Get a Container Type';
26
+ return 'Gets a container type';
27
+ }
28
+ get schema() {
29
+ return options;
20
30
  }
21
- constructor() {
22
- super();
23
- _SpeContainerTypeGetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initOptionSets).call(this);
28
- __classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initTypes).call(this);
31
+ getRefinedSchema(schema) {
32
+ return schema
33
+ .refine(options => [options.id, options.name].filter(o => o !== undefined).length === 1, {
34
+ message: 'Use one of the following options: id or name.'
35
+ });
29
36
  }
30
37
  async commandAction(logger, args) {
31
38
  try {
32
- const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
33
- const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
34
- const containerType = await this.getContainerTypeById(containerTypeId, spoAdminUrl, logger);
35
- await logger.log(containerType);
39
+ let result;
40
+ if (args.options.name) {
41
+ const containerTypes = await odata.getAllItems(`${this.resource}/beta/storage/fileStorage/containerTypes?$filter=name eq '${formatting.encodeQueryParameter(args.options.name)}'`);
42
+ if (containerTypes.length === 0) {
43
+ throw `The specified container type '${args.options.name}' does not exist.`;
44
+ }
45
+ if (containerTypes.length > 1) {
46
+ const containerKeyValuePair = formatting.convertArrayToHashTable('id', containerTypes);
47
+ result = await cli.handleMultipleResultsFound(`Multiple container types with name '${args.options.name}' found.`, containerKeyValuePair);
48
+ }
49
+ else {
50
+ result = containerTypes[0];
51
+ }
52
+ }
53
+ else {
54
+ const requestOptions = {
55
+ url: `${this.resource}/beta/storage/fileStorage/containerTypes/${args.options.id}`,
56
+ headers: {
57
+ accept: 'application/json;odata.metadata=none'
58
+ },
59
+ responseType: 'json'
60
+ };
61
+ result = await request.get(requestOptions);
62
+ }
63
+ await logger.log(result);
36
64
  }
37
65
  catch (err) {
38
66
  this.handleRejectedODataJsonPromise(err);
39
67
  }
40
68
  }
41
- async getContainerTypeById(containerTypeId, spoAdminUrl, logger) {
42
- if (this.verbose) {
43
- await logger.logToStderr(`Getting the Container type...`);
44
- }
45
- const requestOptions = {
46
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
47
- headers: {
48
- accept: 'application/json;odata=nometadata'
49
- },
50
- responseType: 'json',
51
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="49" ObjectPathId="48" /><Method Name="GetSPOContainerTypeById" Id="50" ObjectPathId="48"><Parameters><Parameter Type="Guid">{${containerTypeId}}</Parameter><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="48" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
52
- };
53
- const res = await request.post(requestOptions);
54
- const response = res[0];
55
- if (response.ErrorInfo) {
56
- throw response.ErrorInfo.ErrorMessage;
57
- }
58
- const containerTypes = res[res.length - 1];
59
- return containerTypes;
60
- }
61
- async getContainerTypeId(options, spoAdminUrl, logger) {
62
- if (options.id) {
63
- return options.id;
64
- }
65
- if (this.verbose) {
66
- await logger.logToStderr(`Retrieving container type id for container type '${options.containerTypeName}'...`);
67
- }
68
- return spe.getContainerTypeIdByName(spoAdminUrl, options.name);
69
- }
70
69
  }
71
- _SpeContainerTypeGetCommand_instances = new WeakSet(), _SpeContainerTypeGetCommand_initTelemetry = function _SpeContainerTypeGetCommand_initTelemetry() {
72
- this.telemetry.push((args) => {
73
- Object.assign(this.telemetryProperties, {
74
- id: typeof args.options.id !== 'undefined',
75
- name: typeof args.options.name !== 'undefined'
76
- });
77
- });
78
- }, _SpeContainerTypeGetCommand_initOptions = function _SpeContainerTypeGetCommand_initOptions() {
79
- this.options.unshift({
80
- option: '-i, --id [id]'
81
- }, {
82
- option: '-n, --name [name]'
83
- });
84
- }, _SpeContainerTypeGetCommand_initOptionSets = function _SpeContainerTypeGetCommand_initOptionSets() {
85
- this.optionSets.push({
86
- options: ['id', 'name']
87
- });
88
- }, _SpeContainerTypeGetCommand_initValidators = function _SpeContainerTypeGetCommand_initValidators() {
89
- this.validators.push(async (args) => {
90
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
91
- return `${args.options.id} is not a valid GUID`;
92
- }
93
- return true;
94
- });
95
- }, _SpeContainerTypeGetCommand_initTypes = function _SpeContainerTypeGetCommand_initTypes() {
96
- this.types.string.push('id', 'name');
97
- };
98
70
  export default new SpeContainerTypeGetCommand();
99
71
  //# sourceMappingURL=containertype-get.js.map
@@ -1,37 +1,26 @@
1
- import SpoCommand from '../../../base/SpoCommand.js';
2
1
  import commands from '../../commands.js';
3
- import { spe } from '../../../../utils/spe.js';
4
- import { spo } from '../../../../utils/spo.js';
5
- class SpeContainerTypeListCommand extends SpoCommand {
2
+ import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
3
+ import { odata } from '../../../../utils/odata.js';
4
+ class SpeContainerTypeListCommand extends GraphDelegatedCommand {
6
5
  get name() {
7
6
  return commands.CONTAINERTYPE_LIST;
8
7
  }
9
8
  get description() {
10
- return 'Lists all Container Types';
9
+ return 'Lists all container types';
11
10
  }
12
11
  defaultProperties() {
13
- return ['ContainerTypeId', 'DisplayName', 'OwningAppId'];
12
+ return ['id', 'name', 'owningAppId'];
14
13
  }
15
14
  async commandAction(logger) {
16
15
  try {
17
- const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
18
16
  if (this.verbose) {
19
17
  await logger.logToStderr(`Retrieving list of Container types...`);
20
18
  }
21
- const allContainerTypes = await spe.getAllContainerTypes(spoAdminUrl);
22
- // The following conversion is done in order not to make breaking changes
23
- const result = allContainerTypes.map(ct => ({
24
- _ObjectType_: 'Microsoft.Online.SharePoint.TenantAdministration.SPContainerTypeProperties',
25
- ...ct,
26
- AzureSubscriptionId: `/Guid(${ct.AzureSubscriptionId})/`,
27
- ContainerTypeId: `/Guid(${ct.ContainerTypeId})/`,
28
- OwningAppId: `/Guid(${ct.OwningAppId})/`,
29
- OwningTenantId: `/Guid(${ct.OwningTenantId})/`
30
- }));
31
- await logger.log(result);
19
+ const containerTypes = await odata.getAllItems(`${this.resource}/beta/storage/fileStorage/containerTypes`);
20
+ await logger.log(containerTypes);
32
21
  }
33
22
  catch (err) {
34
- this.handleRejectedPromise(err);
23
+ this.handleRejectedODataJsonPromise(err);
35
24
  }
36
25
  }
37
26
  }
@@ -4,11 +4,11 @@ import { zod } from '../../../../utils/zod.js';
4
4
  import SpoCommand from '../../../base/SpoCommand.js';
5
5
  import commands from '../../commands.js';
6
6
  import { spo } from '../../../../utils/spo.js';
7
- import { spe } from '../../../../utils/spe.js';
8
7
  import { cli } from '../../../../cli/cli.js';
9
8
  import { validation } from '../../../../utils/validation.js';
10
9
  import request from '../../../../request.js';
11
10
  import config from '../../../../config.js';
11
+ import { formatting } from '../../../../utils/formatting.js';
12
12
  const options = globalOptionsZod
13
13
  .extend({
14
14
  id: zod.alias('i', z.string()
@@ -46,14 +46,13 @@ class SpeContainerTypeRemoveCommand extends SpoCommand {
46
46
  try {
47
47
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
48
48
  const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
49
- const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
50
49
  if (this.verbose) {
51
- await logger.logToStderr(`Removing container type ${args.options.id || args.options.name}...`);
50
+ await logger.logToStderr(`Removing container type '${args.options.id || args.options.name}'...`);
52
51
  }
53
52
  const requestOptions = {
54
53
  url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
55
54
  headers: {
56
- 'X-RequestDigest': formDigestInfo.FormDigestValue
55
+ accept: 'application/json;odata=nometadata'
57
56
  },
58
57
  responseType: 'json',
59
58
  data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="7" ObjectPathId="6" /><Method Name="RemoveSPOContainerType" Id="8" ObjectPathId="6"><Parameters><Parameter TypeId="{b66ab1ca-fd51-44f9-8cfc-01f5c2a21f99}"><Property Name="ContainerTypeId" Type="Guid">{${containerTypeId}}</Property></Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="6" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
@@ -74,7 +73,30 @@ class SpeContainerTypeRemoveCommand extends SpoCommand {
74
73
  if (this.verbose) {
75
74
  await logger.logToStderr(`Retrieving container type id for container type '${options.name}'...`);
76
75
  }
77
- return spe.getContainerTypeIdByName(spoAdminUrl, options.name);
76
+ const requestOptions = {
77
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
78
+ headers: {
79
+ accept: 'application/json;odata=nometadata'
80
+ },
81
+ responseType: 'json',
82
+ data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
83
+ };
84
+ const json = await request.post(requestOptions);
85
+ const response = json[0];
86
+ if (response.ErrorInfo) {
87
+ throw new Error(response.ErrorInfo.ErrorMessage);
88
+ }
89
+ const allContainerTypes = json[json.length - 1];
90
+ const containerTypes = allContainerTypes.filter(ct => ct.DisplayName.toLowerCase() === options.name.toLowerCase());
91
+ if (containerTypes.length === 0) {
92
+ throw new Error(`The specified container type '${options.name}' does not exist.`);
93
+ }
94
+ if (containerTypes.length > 1) {
95
+ const containerTypeKeyValuePair = formatting.convertArrayToHashTable('ContainerTypeId', containerTypes);
96
+ const containerType = await cli.handleMultipleResultsFound(`Multiple container types with name '${options.name}' found.`, containerTypeKeyValuePair);
97
+ return formatting.extractCsomGuid(containerType.ContainerTypeId);
98
+ }
99
+ return formatting.extractCsomGuid(containerTypes[0].ContainerTypeId);
78
100
  }
79
101
  }
80
102
  export default new SpeContainerTypeRemoveCommand();
@@ -35,9 +35,6 @@ class SpoFileMoveCommand extends SpoCommand {
35
35
  const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
36
36
  const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
37
37
  const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
38
- if (args.options.includeItemPermissions) {
39
- await this.warn(logger, `Parameter 'includeItemPermissions' is deprecated. Please use 'withItemPermissions' instead`);
40
- }
41
38
  if (this.verbose) {
42
39
  await logger.logToStderr(`Moving file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
43
40
  }
@@ -49,7 +46,7 @@ class SpoFileMoveCommand extends SpoCommand {
49
46
  const copyJobResponse = await spo.createFileCopyJob(args.options.webUrl, sourcePath, destinationPath, {
50
47
  nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
51
48
  bypassSharedLock: !!args.options.bypassSharedLock,
52
- includeItemPermissions: !!args.options.includeItemPermissions || !!args.options.withItemPermissions,
49
+ includeItemPermissions: !!args.options.withItemPermissions,
53
50
  newName: newName,
54
51
  operation: 'move'
55
52
  });
@@ -121,7 +118,6 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
121
118
  sourceId: typeof args.options.sourceId !== 'undefined',
122
119
  newName: typeof args.options.newName !== 'undefined',
123
120
  nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
124
- includeItemPermissions: !!args.options.includeItemPermissions,
125
121
  withItemPermissions: !!args.options.withItemPermissions,
126
122
  bypassSharedLock: !!args.options.bypassSharedLock,
127
123
  skipWait: !!args.options.skipWait
@@ -141,8 +137,6 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
141
137
  }, {
142
138
  option: '--nameConflictBehavior [nameConflictBehavior]',
143
139
  autocomplete: this.nameConflictBehaviorOptions
144
- }, {
145
- option: '--includeItemPermissions'
146
140
  }, {
147
141
  option: '--withItemPermissions'
148
142
  }, {
@@ -168,7 +162,7 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
168
162
  this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
169
163
  }, _SpoFileMoveCommand_initTypes = function _SpoFileMoveCommand_initTypes() {
170
164
  this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
171
- this.types.boolean.push('includeItemPermissions', 'withItemPermissions', 'bypassSharedLock', 'skipWait');
165
+ this.types.boolean.push('withItemPermissions', 'bypassSharedLock', 'skipWait');
172
166
  };
173
167
  export default new SpoFileMoveCommand();
174
168
  //# sourceMappingURL=file-move.js.map
@@ -6,16 +6,18 @@ import { validation } from '../../../../utils/validation.js';
6
6
  import SpoCommand from '../../../base/SpoCommand.js';
7
7
  import commands from '../../commands.js';
8
8
  import request from '../../../../request.js';
9
+ import { entraGroup } from '../../../../utils/entraGroup.js';
9
10
  const options = globalOptionsZod
10
11
  .extend({
11
12
  url: zod.alias('u', z.string()
12
13
  .refine((url) => validation.isValidSharePointUrl(url) === true, url => ({
13
14
  message: `'${url}' is not a valid SharePoint Online site URL.`
14
15
  }))),
15
- audiences: z.string()
16
+ audienceIds: z.string()
16
17
  .refine(audiences => validation.isValidGuidArray(audiences) === true, audiences => ({
17
18
  message: `The following GUIDs are invalid: ${validation.isValidGuidArray(audiences)}.`
18
19
  })).optional(),
20
+ audienceNames: z.string().optional(),
19
21
  vivaConnectionsDefaultStart: z.boolean().optional(),
20
22
  isInDraftMode: z.boolean().optional(),
21
23
  order: z.number()
@@ -34,7 +36,20 @@ class SpoHomeSiteAddCommand extends SpoCommand {
34
36
  get schema() {
35
37
  return options;
36
38
  }
39
+ getRefinedSchema(schema) {
40
+ return schema
41
+ .refine((options) => [options.audienceIds, options.audienceNames].filter(o => o !== undefined).length <= 1, {
42
+ message: 'You must specify either audienceIds or audienceNames but not both.'
43
+ });
44
+ }
37
45
  async commandAction(logger, args) {
46
+ let audiences = [];
47
+ if (args.options.audienceIds) {
48
+ audiences = args.options.audienceIds.split(',').map(id => id.trim());
49
+ }
50
+ else if (args.options.audienceNames) {
51
+ audiences = await this.transformAudienceNamesToIds(args.options.audienceNames);
52
+ }
38
53
  try {
39
54
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
40
55
  const requestOptions = {
@@ -45,7 +60,7 @@ class SpoHomeSiteAddCommand extends SpoCommand {
45
60
  responseType: 'json',
46
61
  data: {
47
62
  siteUrl: args.options.url,
48
- audiences: args.options.audiences?.split(','),
63
+ audiences: audiences,
49
64
  vivaConnectionsDefaultStart: args.options.vivaConnectionsDefaultStart ?? true,
50
65
  isInDraftMode: args.options.isInDraftMode ?? false,
51
66
  order: args.options.order
@@ -61,6 +76,15 @@ class SpoHomeSiteAddCommand extends SpoCommand {
61
76
  this.handleRejectedODataJsonPromise(err);
62
77
  }
63
78
  }
79
+ async transformAudienceNamesToIds(audienceNames) {
80
+ const names = audienceNames.split(',');
81
+ const ids = [];
82
+ for (const name of names) {
83
+ const id = await entraGroup.getGroupIdByDisplayName(name.trim());
84
+ ids.push(id);
85
+ }
86
+ return ids;
87
+ }
64
88
  }
65
89
  export default new SpoHomeSiteAddCommand();
66
90
  //# sourceMappingURL=homesite-add.js.map
@@ -29,20 +29,12 @@ class SpoHubSiteGetCommand extends SpoCommand {
29
29
  }
30
30
  async commandAction(logger, args) {
31
31
  try {
32
- if (args.options.includeAssociatedSites) {
33
- await this.warn(logger, `Parameter 'includeAssociatedSites' is deprecated. Please use 'withAssociatedSites' instead`);
34
- }
35
32
  const spoUrl = await spo.getSpoUrl(logger, this.debug);
36
33
  const hubSite = args.options.id ? await this.getHubSiteById(spoUrl, args.options) : await this.getHubSite(spoUrl, args.options);
37
- if ((args.options.includeAssociatedSites || args.options.withAssociatedSites) && (args.options.output && args.options.output !== 'json')) {
38
- if (args.options.includeAssociatedSites) {
39
- throw 'includeAssociatedSites option is only allowed with json output mode';
40
- }
41
- else {
42
- throw 'withAssociatedSites option is only allowed with json output mode';
43
- }
34
+ if (args.options.withAssociatedSites && (args.options.output && args.options.output !== 'json')) {
35
+ throw 'withAssociatedSites option is only allowed with json output mode';
44
36
  }
45
- if ((args.options.includeAssociatedSites === true || args.options.withAssociatedSites === true) && args.options.output && !cli.shouldTrimOutput(args.options.output)) {
37
+ if (args.options.withAssociatedSites === true && args.options.output && !cli.shouldTrimOutput(args.options.output)) {
46
38
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
47
39
  const associatedSitesCommandOutput = await this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
48
40
  const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
@@ -108,12 +100,11 @@ _SpoHubSiteGetCommand_instances = new WeakSet(), _SpoHubSiteGetCommand_initTelem
108
100
  id: typeof args.options.id !== 'undefined',
109
101
  title: typeof args.options.title !== 'undefined',
110
102
  url: typeof args.options.url !== 'undefined',
111
- includeAssociatedSites: args.options.includeAssociatedSites === true,
112
103
  withAssociatedSites: args.options.withAssociatedSites === true
113
104
  });
114
105
  });
115
106
  }, _SpoHubSiteGetCommand_initOptions = function _SpoHubSiteGetCommand_initOptions() {
116
- this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--includeAssociatedSites' }, { option: '--withAssociatedSites' });
107
+ this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--withAssociatedSites' });
117
108
  }, _SpoHubSiteGetCommand_initValidators = function _SpoHubSiteGetCommand_initValidators() {
118
109
  this.validators.push(async (args) => {
119
110
  if (args.options.id && !validation.isValidGuid(args.options.id)) {
@@ -29,14 +29,10 @@ class SpoHubSiteListCommand extends SpoCommand {
29
29
  }
30
30
  async commandAction(logger, args) {
31
31
  try {
32
- if (args.options.includeAssociatedSites) {
33
- await this.warn(logger, `Parameter 'includeAssociatedSites' is deprecated. Please use 'withAssociatedSites' instead`);
34
- }
35
32
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
36
33
  const hubSitesResult = await odata.getAllItems(`${spoAdminUrl}/_api/hubsites`);
37
34
  const hubSites = hubSitesResult;
38
- const shouldIncludeAssociatedSites = args.options.includeAssociatedSites || args.options.withAssociatedSites;
39
- if (!(shouldIncludeAssociatedSites !== true || args.options.output && args.options.output !== 'json')) {
35
+ if (!(args.options.withAssociatedSites !== true || args.options.output && args.options.output !== 'json')) {
40
36
  if (this.debug) {
41
37
  await logger.logToStderr('Retrieving associated sites...');
42
38
  await logger.logToStderr('');
@@ -108,14 +104,11 @@ class SpoHubSiteListCommand extends SpoCommand {
108
104
  _SpoHubSiteListCommand_instances = new WeakSet(), _SpoHubSiteListCommand_initTelemetry = function _SpoHubSiteListCommand_initTelemetry() {
109
105
  this.telemetry.push((args) => {
110
106
  Object.assign(this.telemetryProperties, {
111
- includeAssociatedSites: args.options.includeAssociatedSites === true,
112
107
  withAssociatedSites: args.options.withAssociatedSites === true
113
108
  });
114
109
  });
115
110
  }, _SpoHubSiteListCommand_initOptions = function _SpoHubSiteListCommand_initOptions() {
116
111
  this.options.unshift({
117
- option: '-i, --includeAssociatedSites'
118
- }, {
119
112
  option: '--withAssociatedSites'
120
113
  });
121
114
  };
@@ -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 _SpoTenantSiteArchiveCommand_instances, _SpoTenantSiteArchiveCommand_initTelemetry, _SpoTenantSiteArchiveCommand_initOptions, _SpoTenantSiteArchiveCommand_initValidators, _SpoTenantSiteArchiveCommand_initTypes;
6
+ var _SpoSiteArchiveCommand_instances, _SpoSiteArchiveCommand_initTelemetry, _SpoSiteArchiveCommand_initOptions, _SpoSiteArchiveCommand_initValidators, _SpoSiteArchiveCommand_initTypes;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import config from '../../../../config.js';
9
9
  import request from '../../../../request.js';
@@ -11,20 +11,20 @@ import { validation } from '../../../../utils/validation.js';
11
11
  import { spo } from '../../../../utils/spo.js';
12
12
  import SpoCommand from '../../../base/SpoCommand.js';
13
13
  import commands from '../../commands.js';
14
- class SpoTenantSiteArchiveCommand extends SpoCommand {
14
+ class SpoSiteArchiveCommand extends SpoCommand {
15
15
  get name() {
16
- return commands.TENANT_SITE_ARCHIVE;
16
+ return commands.SITE_ARCHIVE;
17
17
  }
18
18
  get description() {
19
19
  return 'Archives a site collection';
20
20
  }
21
21
  constructor() {
22
22
  super();
23
- _SpoTenantSiteArchiveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTypes).call(this);
23
+ _SpoSiteArchiveCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initTypes).call(this);
28
28
  }
29
29
  async commandAction(logger, args) {
30
30
  const archiveSite = async () => {
@@ -81,19 +81,19 @@ class SpoTenantSiteArchiveCommand extends SpoCommand {
81
81
  }
82
82
  }
83
83
  }
84
- _SpoTenantSiteArchiveCommand_instances = new WeakSet(), _SpoTenantSiteArchiveCommand_initTelemetry = function _SpoTenantSiteArchiveCommand_initTelemetry() {
84
+ _SpoSiteArchiveCommand_instances = new WeakSet(), _SpoSiteArchiveCommand_initTelemetry = function _SpoSiteArchiveCommand_initTelemetry() {
85
85
  this.telemetry.push((args) => {
86
86
  Object.assign(this.telemetryProperties, {
87
87
  force: !!args.options.force
88
88
  });
89
89
  });
90
- }, _SpoTenantSiteArchiveCommand_initOptions = function _SpoTenantSiteArchiveCommand_initOptions() {
90
+ }, _SpoSiteArchiveCommand_initOptions = function _SpoSiteArchiveCommand_initOptions() {
91
91
  this.options.unshift({ option: '-u, --url <url>' }, { option: '-f, --force' });
92
- }, _SpoTenantSiteArchiveCommand_initValidators = function _SpoTenantSiteArchiveCommand_initValidators() {
92
+ }, _SpoSiteArchiveCommand_initValidators = function _SpoSiteArchiveCommand_initValidators() {
93
93
  this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
94
- }, _SpoTenantSiteArchiveCommand_initTypes = function _SpoTenantSiteArchiveCommand_initTypes() {
94
+ }, _SpoSiteArchiveCommand_initTypes = function _SpoSiteArchiveCommand_initTypes() {
95
95
  this.types.string.push('url');
96
96
  this.types.boolean.push('force');
97
97
  };
98
- export default new SpoTenantSiteArchiveCommand();
99
- //# sourceMappingURL=tenant-site-archive.js.map
98
+ export default new SpoSiteArchiveCommand();
99
+ //# sourceMappingURL=site-archive.js.map
@@ -3,16 +3,16 @@ 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 _SpoTenantSiteListCommand_instances, _SpoTenantSiteListCommand_initTelemetry, _SpoTenantSiteListCommand_initOptions, _SpoTenantSiteListCommand_initValidators;
6
+ var _SpoSiteListCommand_instances, _SpoSiteListCommand_initTelemetry, _SpoSiteListCommand_initOptions, _SpoSiteListCommand_initValidators;
7
7
  import config from '../../../../config.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import { spo } from '../../../../utils/spo.js';
11
11
  import SpoCommand from '../../../base/SpoCommand.js';
12
12
  import commands from '../../commands.js';
13
- class SpoTenantSiteListCommand extends SpoCommand {
13
+ class SpoSiteListCommand extends SpoCommand {
14
14
  get name() {
15
- return commands.TENANT_SITE_LIST;
15
+ return commands.SITE_LIST;
16
16
  }
17
17
  get description() {
18
18
  return 'Lists sites of the given type';
@@ -22,20 +22,17 @@ class SpoTenantSiteListCommand extends SpoCommand {
22
22
  }
23
23
  constructor() {
24
24
  super();
25
- _SpoTenantSiteListCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initValidators).call(this);
25
+ _SpoSiteListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initValidators).call(this);
29
29
  }
30
30
  alias() {
31
31
  return [commands.SITE_LIST];
32
32
  }
33
33
  async commandAction(logger, args) {
34
- if (args.options.includeOneDriveSites) {
35
- await this.warn(logger, `Parameter 'includeOneDriveSites' is deprecated. Please use 'withOneDriveSites' instead`);
36
- }
37
34
  const webTemplate = this.getWebTemplateId(args.options);
38
- const includeOneDriveSites = (args.options.includeOneDriveSites || args.options.withOneDriveSites) || false;
35
+ const includeOneDriveSites = args.options.withOneDriveSites || false;
39
36
  const personalSite = includeOneDriveSites === false ? '0' : '1';
40
37
  try {
41
38
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
@@ -79,7 +76,7 @@ class SpoTenantSiteListCommand extends SpoCommand {
79
76
  if (options.webTemplate) {
80
77
  return options.webTemplate;
81
78
  }
82
- if (options.includeOneDriveSites || options.withOneDriveSites) {
79
+ if (options.withOneDriveSites) {
83
80
  return '';
84
81
  }
85
82
  switch (options.type) {
@@ -92,17 +89,16 @@ class SpoTenantSiteListCommand extends SpoCommand {
92
89
  }
93
90
  }
94
91
  }
95
- _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_initTelemetry = function _SpoTenantSiteListCommand_initTelemetry() {
92
+ _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry = function _SpoSiteListCommand_initTelemetry() {
96
93
  this.telemetry.push((args) => {
97
94
  Object.assign(this.telemetryProperties, {
98
95
  webTemplate: args.options.webTemplate,
99
96
  type: args.options.type,
100
97
  filter: (!(!args.options.filter)).toString(),
101
- includeOneDriveSites: typeof args.options.includeOneDriveSites !== 'undefined',
102
98
  withOneDriveSites: typeof args.options.withOneDriveSites !== 'undefined'
103
99
  });
104
100
  });
105
- }, _SpoTenantSiteListCommand_initOptions = function _SpoTenantSiteListCommand_initOptions() {
101
+ }, _SpoSiteListCommand_initOptions = function _SpoSiteListCommand_initOptions() {
106
102
  this.options.unshift({
107
103
  option: '-t, --type [type]',
108
104
  autocomplete: ['TeamSite', 'CommunicationSite']
@@ -110,12 +106,10 @@ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_i
110
106
  option: '--webTemplate [webTemplate]'
111
107
  }, {
112
108
  option: '--filter [filter]'
113
- }, {
114
- option: '--includeOneDriveSites'
115
109
  }, {
116
110
  option: '--withOneDriveSites'
117
111
  });
118
- }, _SpoTenantSiteListCommand_initValidators = function _SpoTenantSiteListCommand_initValidators() {
112
+ }, _SpoSiteListCommand_initValidators = function _SpoSiteListCommand_initValidators() {
119
113
  this.validators.push(async (args) => {
120
114
  if (args.options.type && args.options.webTemplate) {
121
115
  return 'Specify either type or webTemplate, but not both';
@@ -125,17 +119,12 @@ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_i
125
119
  typeValues.indexOf(args.options.type) < 0) {
126
120
  return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
127
121
  }
128
- if (args.options.includeOneDriveSites || args.options.withOneDriveSites
122
+ if (args.options.withOneDriveSites
129
123
  && (args.options.type || args.options.webTemplate)) {
130
- if (args.options.includeOneDriveSites) {
131
- return 'When using includeOneDriveSites, don\'t specify the type or webTemplate options';
132
- }
133
- else {
134
- return 'When using withOneDriveSites, don\'t specify the type or webTemplate options';
135
- }
124
+ return 'When using withOneDriveSites, don\'t specify the type or webTemplate options';
136
125
  }
137
126
  return true;
138
127
  });
139
128
  };
140
- export default new SpoTenantSiteListCommand();
141
- //# sourceMappingURL=tenant-site-list.js.map
129
+ export default new SpoSiteListCommand();
130
+ //# sourceMappingURL=site-list.js.map