@pnp/cli-microsoft365 8.1.0-beta.3dec9fa → 8.1.0-beta.bf59841

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 (61) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +9 -9
  4. package/dist/Command.js +49 -2
  5. package/dist/cli/cli.js +60 -38
  6. package/dist/m365/commands/login.js +44 -96
  7. package/dist/m365/connection/commands/connection-remove.js +6 -2
  8. package/dist/m365/connection/commands/connection-set.js +4 -1
  9. package/dist/m365/connection/commands/connection-use.js +25 -4
  10. package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
  11. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
  12. package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
  13. package/dist/m365/entra/commands.js +3 -0
  14. package/dist/m365/spe/ContainerTypeProperties.js +2 -0
  15. package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
  16. package/dist/m365/spe/commands.js +2 -1
  17. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -21
  18. package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
  19. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  20. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  21. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  22. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  23. package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
  24. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
  25. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
  26. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
  27. package/dist/utils/formatting.js +16 -0
  28. package/dist/utils/spo.js +37 -6
  29. package/dist/utils/zod.js +124 -0
  30. package/docs/docs/cmd/connection/connection-use.mdx +8 -2
  31. package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
  32. package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
  33. package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
  34. package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
  35. package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
  36. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +87 -38
  37. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
  38. package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
  39. package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
  40. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  41. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
  42. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  43. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  44. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  45. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
  46. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
  47. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
  48. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
  49. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
  50. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
  51. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
  52. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
  53. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
  54. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
  55. package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
  56. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
  57. package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
  58. package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
  59. package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
  60. package/npm-shrinkwrap.json +604 -843
  61. package/package.json +6 -2
@@ -0,0 +1,65 @@
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 _EntraMultitenantAddCommand_instances, _EntraMultitenantAddCommand_initTelemetry, _EntraMultitenantAddCommand_initOptions, _EntraMultitenantAddCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ class EntraMultitenantAddCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.MULTITENANT_ADD;
13
+ }
14
+ get description() {
15
+ return 'Creates a new multitenant organization';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _EntraMultitenantAddCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initOptions).call(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTypes).call(this);
23
+ }
24
+ async commandAction(logger, args) {
25
+ if (this.verbose) {
26
+ await logger.logToStderr('Creating multitenant organization...');
27
+ }
28
+ const requestOptions = {
29
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization`,
30
+ headers: {
31
+ accept: 'application/json;odata.metadata=none'
32
+ },
33
+ responseType: 'json',
34
+ data: {
35
+ description: args.options.description,
36
+ displayName: args.options.displayName
37
+ }
38
+ };
39
+ try {
40
+ const multitenantOrg = await request.put(requestOptions);
41
+ await logger.log(multitenantOrg);
42
+ }
43
+ catch (err) {
44
+ this.handleRejectedODataJsonPromise(err);
45
+ }
46
+ }
47
+ }
48
+ _EntraMultitenantAddCommand_instances = new WeakSet(), _EntraMultitenantAddCommand_initTelemetry = function _EntraMultitenantAddCommand_initTelemetry() {
49
+ this.telemetry.push((args) => {
50
+ Object.assign(this.telemetryProperties, {
51
+ displayName: typeof args.options.displayName !== 'undefined',
52
+ description: typeof args.options.description !== 'undefined'
53
+ });
54
+ });
55
+ }, _EntraMultitenantAddCommand_initOptions = function _EntraMultitenantAddCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-n, --displayName <displayName>'
58
+ }, {
59
+ option: '-d, --description [description]'
60
+ });
61
+ }, _EntraMultitenantAddCommand_initTypes = function _EntraMultitenantAddCommand_initTypes() {
62
+ this.types.string.push('displayName', 'description');
63
+ };
64
+ export default new EntraMultitenantAddCommand();
65
+ //# sourceMappingURL=multitenant-add.js.map
@@ -0,0 +1,118 @@
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 _EntraMultitenantRemoveCommand_instances, _EntraMultitenantRemoveCommand_initTelemetry, _EntraMultitenantRemoveCommand_initOptions;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ import { odata } from '../../../../utils/odata.js';
11
+ import { cli } from '../../../../cli/cli.js';
12
+ class EntraMultitenantRemoveCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.MULTITENANT_REMOVE;
15
+ }
16
+ get description() {
17
+ return 'Removes a multitenant organization';
18
+ }
19
+ constructor() {
20
+ super();
21
+ _EntraMultitenantRemoveCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initOptions).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ const removeMultitenantOrg = async () => {
27
+ try {
28
+ const tenantId = await this.getCurrentTenantId();
29
+ let tenantsId = await this.getAllTenantsIds();
30
+ const tenantsCount = tenantsId.length;
31
+ if (tenantsCount > 0) {
32
+ const tasks = tenantsId
33
+ .filter(x => x !== tenantId)
34
+ .map(t => this.removeTenant(logger, t));
35
+ await Promise.all(tasks);
36
+ do {
37
+ if (this.verbose) {
38
+ await logger.logToStderr(`Waiting 30 seconds...`);
39
+ }
40
+ await new Promise(resolve => setTimeout(resolve, 30000));
41
+ // from current behavior, removing tenant can take a few seconds
42
+ // current tenant must be removed once all previous ones were removed
43
+ if (this.verbose) {
44
+ await logger.logToStderr(`Checking all tenants were removed...`);
45
+ }
46
+ tenantsId = await this.getAllTenantsIds();
47
+ if (this.verbose) {
48
+ await logger.logToStderr(`Number of removed tenants: ${tenantsCount - tenantsId.length}`);
49
+ }
50
+ } while (tenantsId.length !== 1);
51
+ // current tenant must be removed as the last one
52
+ await this.removeTenant(logger, tenantId);
53
+ await logger.logToStderr('Your Multi-Tenant organization is being removed. This can take up to 2 hours.');
54
+ }
55
+ }
56
+ catch (err) {
57
+ this.handleRejectedODataJsonPromise(err);
58
+ }
59
+ };
60
+ if (args.options.force) {
61
+ await removeMultitenantOrg();
62
+ }
63
+ else {
64
+ const result = await cli.promptForConfirmation({ message: 'Are you sure you want to remove multitenant organization?' });
65
+ if (result) {
66
+ await removeMultitenantOrg();
67
+ }
68
+ }
69
+ }
70
+ async getAllTenantsIds() {
71
+ const requestOptions = {
72
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants?$select=tenantId`,
73
+ headers: {
74
+ accept: 'application/json;odata.metadata=none'
75
+ },
76
+ responseType: 'json'
77
+ };
78
+ const tenants = await odata.getAllItems(requestOptions);
79
+ return tenants.map(x => x.tenantId);
80
+ }
81
+ async getCurrentTenantId() {
82
+ const requestOptions = {
83
+ url: `${this.resource}/v1.0/organization?$select=id`,
84
+ headers: {
85
+ accept: 'application/json;odata.metadata=none'
86
+ },
87
+ responseType: 'json'
88
+ };
89
+ const organizations = await odata.getAllItems(requestOptions);
90
+ return organizations[0].id;
91
+ }
92
+ async removeTenant(logger, tenantId) {
93
+ if (this.verbose) {
94
+ await logger.logToStderr(`Removing tenant: ${tenantId}`);
95
+ }
96
+ const requestOptions = {
97
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants/${tenantId}`,
98
+ headers: {
99
+ accept: 'application/json;odata.metadata=none'
100
+ },
101
+ responseType: 'json'
102
+ };
103
+ await request.delete(requestOptions);
104
+ }
105
+ }
106
+ _EntraMultitenantRemoveCommand_instances = new WeakSet(), _EntraMultitenantRemoveCommand_initTelemetry = function _EntraMultitenantRemoveCommand_initTelemetry() {
107
+ this.telemetry.push((args) => {
108
+ Object.assign(this.telemetryProperties, {
109
+ force: !!args.options.force
110
+ });
111
+ });
112
+ }, _EntraMultitenantRemoveCommand_initOptions = function _EntraMultitenantRemoveCommand_initOptions() {
113
+ this.options.unshift({
114
+ option: '-f, --force'
115
+ });
116
+ };
117
+ export default new EntraMultitenantRemoveCommand();
118
+ //# sourceMappingURL=multitenant-remove.js.map
@@ -0,0 +1,72 @@
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 _EntraMultitenantSetCommand_instances, _EntraMultitenantSetCommand_initTelemetry, _EntraMultitenantSetCommand_initOptions, _EntraMultitenantSetCommand_initValidators, _EntraMultitenantSetCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ class EntraMultitenantSetCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.MULTITENANT_SET;
13
+ }
14
+ get description() {
15
+ return 'Updates the properties of a multitenant organization';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _EntraMultitenantSetCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initOptions).call(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initValidators).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTypes).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ if (this.verbose) {
27
+ await logger.logToStderr('Updating multitenant organization...');
28
+ }
29
+ const requestOptions = {
30
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization`,
31
+ headers: {
32
+ accept: 'application/json;odata.metadata=none'
33
+ },
34
+ responseType: 'json',
35
+ data: {
36
+ description: args.options.description,
37
+ displayName: args.options.displayName
38
+ }
39
+ };
40
+ try {
41
+ await request.patch(requestOptions);
42
+ }
43
+ catch (err) {
44
+ this.handleRejectedODataJsonPromise(err);
45
+ }
46
+ }
47
+ }
48
+ _EntraMultitenantSetCommand_instances = new WeakSet(), _EntraMultitenantSetCommand_initTelemetry = function _EntraMultitenantSetCommand_initTelemetry() {
49
+ this.telemetry.push((args) => {
50
+ Object.assign(this.telemetryProperties, {
51
+ displayName: typeof args.options.displayName !== 'undefined',
52
+ description: typeof args.options.description !== 'undefined'
53
+ });
54
+ });
55
+ }, _EntraMultitenantSetCommand_initOptions = function _EntraMultitenantSetCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-n, --displayName [displayName]'
58
+ }, {
59
+ option: '-d, --description [description]'
60
+ });
61
+ }, _EntraMultitenantSetCommand_initValidators = function _EntraMultitenantSetCommand_initValidators() {
62
+ this.validators.push(async (args) => {
63
+ if (!args.options.displayName && !args.options.description) {
64
+ return 'Specify either displayName or description or both.';
65
+ }
66
+ return true;
67
+ });
68
+ }, _EntraMultitenantSetCommand_initTypes = function _EntraMultitenantSetCommand_initTypes() {
69
+ this.types.string.push('displayName', 'description');
70
+ };
71
+ export default new EntraMultitenantSetCommand();
72
+ //# sourceMappingURL=multitenant-set.js.map
@@ -72,7 +72,10 @@ export default {
72
72
  M365GROUP_USER_LIST: `${prefix} m365group user list`,
73
73
  M365GROUP_USER_REMOVE: `${prefix} m365group user remove`,
74
74
  M365GROUP_USER_SET: `${prefix} m365group user set`,
75
+ MULTITENANT_ADD: `${prefix} multitenant add`,
75
76
  MULTITENANT_GET: `${prefix} multitenant get`,
77
+ MULTITENANT_REMOVE: `${prefix} multitenant remove`,
78
+ MULTITENANT_SET: `${prefix} multitenant set`,
76
79
  OAUTH2GRANT_ADD: `${prefix} oauth2grant add`,
77
80
  OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
78
81
  OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ContainerTypeProperties.js.map
@@ -0,0 +1,49 @@
1
+ import config from '../../../../config.js';
2
+ import request from '../../../../request.js';
3
+ import { spo } from '../../../../utils/spo.js';
4
+ import SpoCommand from '../../../base/SpoCommand.js';
5
+ import commands from '../../commands.js';
6
+ class SpeContainertypeListCommand extends SpoCommand {
7
+ get name() {
8
+ return commands.CONTAINERTYPE_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all Container Types';
12
+ }
13
+ defaultProperties() {
14
+ return ['ContainerTypeId', 'DisplayName', 'OwningAppId'];
15
+ }
16
+ async commandAction(logger) {
17
+ try {
18
+ const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
19
+ if (this.verbose) {
20
+ await logger.logToStderr(`Retrieving list of Container types...`);
21
+ }
22
+ const allContainerTypes = await this.getAllContainerTypes(spoAdminUrl, logger);
23
+ await logger.log(allContainerTypes);
24
+ }
25
+ catch (err) {
26
+ this.handleRejectedPromise(err);
27
+ }
28
+ }
29
+ async getAllContainerTypes(spoAdminUrl, logger) {
30
+ const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
31
+ const requestOptions = {
32
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
33
+ headers: {
34
+ 'X-RequestDigest': formDigestInfo.FormDigestValue
35
+ },
36
+ 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>`
37
+ };
38
+ const res = await request.post(requestOptions);
39
+ const json = JSON.parse(res);
40
+ const response = json[0];
41
+ if (response.ErrorInfo) {
42
+ throw response.ErrorInfo.ErrorMessage;
43
+ }
44
+ const containerTypes = json[json.length - 1];
45
+ return containerTypes;
46
+ }
47
+ }
48
+ export default new SpeContainertypeListCommand();
49
+ //# sourceMappingURL=containertype-list.js.map
@@ -1,5 +1,6 @@
1
1
  const prefix = 'spe';
2
2
  export default {
3
- CONTAINERTYPE_ADD: `${prefix} containertype add`
3
+ CONTAINERTYPE_ADD: `${prefix} containertype add`,
4
+ CONTAINERTYPE_LIST: `${prefix} containertype list`
4
5
  };
5
6
  //# sourceMappingURL=commands.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 _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets;
6
+ var _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets, _SpoApplicationCustomizerGetCommand_initTypes;
7
7
  import { formatting } from '../../../../utils/formatting.js';
8
8
  import { spo } from '../../../../utils/spo.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -25,33 +25,22 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
25
25
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initValidators).call(this);
27
27
  __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initTypes).call(this);
28
29
  }
29
30
  async commandAction(logger, args) {
30
31
  try {
31
32
  const customAction = await this.getCustomAction(args.options);
32
- if (customAction) {
33
+ if (!args.options.clientSideComponentProperties) {
33
34
  await logger.log({
34
- ClientSideComponentId: customAction.ClientSideComponentId,
35
- ClientSideComponentProperties: customAction.ClientSideComponentProperties,
36
- CommandUIExtension: customAction.CommandUIExtension,
37
- Description: customAction.Description,
38
- Group: customAction.Group,
39
- Id: customAction.Id,
40
- ImageUrl: customAction.ImageUrl,
41
- Location: customAction.Location,
42
- Name: customAction.Name,
43
- RegistrationId: customAction.RegistrationId,
44
- RegistrationType: customAction.RegistrationType,
35
+ ...customAction,
45
36
  Rights: JSON.stringify(customAction.Rights),
46
- Scope: this.humanizeScope(customAction.Scope),
47
- ScriptBlock: customAction.ScriptBlock,
48
- ScriptSrc: customAction.ScriptSrc,
49
- Sequence: customAction.Sequence,
50
- Title: customAction.Title,
51
- Url: customAction.Url,
52
- VersionOfUserCustomAction: customAction.VersionOfUserCustomAction
37
+ Scope: this.humanizeScope(customAction.Scope)
53
38
  });
54
39
  }
40
+ else {
41
+ const properties = formatting.tryParseJson(customAction.ClientSideComponentProperties);
42
+ await logger.log(properties);
43
+ }
55
44
  }
56
45
  catch (err) {
57
46
  this.handleRejectedPromise(err);
@@ -95,7 +84,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
95
84
  title: typeof args.options.title !== 'undefined',
96
85
  id: typeof args.options.id !== 'undefined',
97
86
  clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
98
- scope: typeof args.options.scope !== 'undefined'
87
+ scope: typeof args.options.scope !== 'undefined',
88
+ clientSideComponentProperties: !!args.options.clientSideComponentProperties
99
89
  });
100
90
  });
101
91
  }, _SpoApplicationCustomizerGetCommand_initOptions = function _SpoApplicationCustomizerGetCommand_initOptions() {
@@ -110,6 +100,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
110
100
  }, {
111
101
  option: '-s, --scope [scope]',
112
102
  autocomplete: this.allowedScopes
103
+ }, {
104
+ option: '-p, --clientSideComponentProperties'
113
105
  });
114
106
  }, _SpoApplicationCustomizerGetCommand_initValidators = function _SpoApplicationCustomizerGetCommand_initValidators() {
115
107
  this.validators.push(async (args) => {
@@ -126,6 +118,9 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
126
118
  });
127
119
  }, _SpoApplicationCustomizerGetCommand_initOptionSets = function _SpoApplicationCustomizerGetCommand_initOptionSets() {
128
120
  this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
121
+ }, _SpoApplicationCustomizerGetCommand_initTypes = function _SpoApplicationCustomizerGetCommand_initTypes() {
122
+ this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
123
+ this.types.boolean.push('clientSideComponentProperties');
129
124
  };
130
125
  export default new SpoApplicationCustomizerGetCommand();
131
126
  //# sourceMappingURL=applicationcustomizer-get.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 _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets;
6
+ var _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets, _SpoCommandSetGetCommand_initTypes;
7
7
  import { formatting } from '../../../../utils/formatting.js';
8
8
  import { spo } from '../../../../utils/spo.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -24,45 +24,53 @@ class SpoCommandSetGetCommand extends SpoCommand {
24
24
  __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptions).call(this);
25
25
  __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initValidators).call(this);
26
26
  __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptionSets).call(this);
27
+ __classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initTypes).call(this);
27
28
  }
28
29
  async commandAction(logger, args) {
29
30
  try {
30
31
  if (this.verbose) {
31
- await logger.logToStderr(`Attempt to get a specific commandset by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
32
+ await logger.logToStderr(`Attempt to get a specific Command Set by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
32
33
  }
34
+ let commandSet;
33
35
  if (args.options.id) {
34
- const commandSet = await spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
35
- if (commandSet === undefined) {
36
+ const customAction = await spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
37
+ if (customAction === undefined) {
36
38
  throw `Command set with id ${args.options.id} can't be found.`;
37
39
  }
38
- else if (!_a.allowedCommandSetLocations.some(allowedLocation => allowedLocation === commandSet.Location)) {
40
+ else if (!_a.allowedCommandSetLocations.some(allowedLocation => allowedLocation === customAction.Location)) {
39
41
  throw `Custom action with id ${args.options.id} is not a command set.`;
40
42
  }
41
- await logger.log(commandSet);
43
+ commandSet = customAction;
42
44
  }
43
45
  else if (args.options.clientSideComponentId) {
44
46
  const filter = `${this.getBaseFilter()} ClientSideComponentId eq guid'${args.options.clientSideComponentId}'`;
45
- const commandSets = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
46
- if (commandSets.length === 0) {
47
+ const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
48
+ if (customActions.length === 0) {
47
49
  throw `No command set with clientSideComponentId '${args.options.clientSideComponentId}' found.`;
48
50
  }
49
- await logger.log(commandSets[0]);
51
+ commandSet = customActions[0];
50
52
  }
51
53
  else if (args.options.title) {
52
54
  const filter = `${this.getBaseFilter()} Title eq '${formatting.encodeQueryParameter(args.options.title)}'`;
53
- const commandSets = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
54
- if (commandSets.length === 1) {
55
- await logger.log(commandSets[0]);
55
+ const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
56
+ if (customActions.length === 1) {
57
+ commandSet = customActions[0];
56
58
  }
57
- else if (commandSets.length === 0) {
59
+ else if (customActions.length === 0) {
58
60
  throw `No command set with title '${args.options.title}' found.`;
59
61
  }
60
62
  else {
61
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
62
- const commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
63
- await logger.log(commandSet);
63
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
64
+ commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
64
65
  }
65
66
  }
67
+ if (!args.options.clientSideComponentProperties) {
68
+ await logger.log(commandSet);
69
+ }
70
+ else {
71
+ const properties = formatting.tryParseJson(commandSet.ClientSideComponentProperties);
72
+ await logger.log(properties);
73
+ }
66
74
  }
67
75
  catch (err) {
68
76
  this.handleRejectedODataJsonPromise(err);
@@ -78,7 +86,8 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
78
86
  title: typeof args.options.title !== 'undefined',
79
87
  id: typeof args.options.id !== 'undefined',
80
88
  clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
81
- scope: typeof args.options.scope !== 'undefined'
89
+ scope: typeof args.options.scope !== 'undefined',
90
+ clientSideComponentProperties: !!args.options.clientSideComponentProperties
82
91
  });
83
92
  });
84
93
  }, _SpoCommandSetGetCommand_initOptions = function _SpoCommandSetGetCommand_initOptions() {
@@ -93,6 +102,8 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
93
102
  }, {
94
103
  option: '-s, --scope [scope]',
95
104
  autocomplete: _a.scopes
105
+ }, {
106
+ option: '-p, --clientSideComponentProperties'
96
107
  });
97
108
  }, _SpoCommandSetGetCommand_initValidators = function _SpoCommandSetGetCommand_initValidators() {
98
109
  this.validators.push(async (args) => {
@@ -109,6 +120,9 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
109
120
  });
110
121
  }, _SpoCommandSetGetCommand_initOptionSets = function _SpoCommandSetGetCommand_initOptionSets() {
111
122
  this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
123
+ }, _SpoCommandSetGetCommand_initTypes = function _SpoCommandSetGetCommand_initTypes() {
124
+ this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
125
+ this.types.boolean.push('clientSideComponentProperties');
112
126
  };
113
127
  SpoCommandSetGetCommand.scopes = ['All', 'Site', 'Web'];
114
128
  SpoCommandSetGetCommand.baseLocation = 'ClientSideExtension.ListViewCommandSet';
@@ -140,7 +140,7 @@ _SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignme
140
140
  }, {
141
141
  option: '--fileUrl [fileUrl]'
142
142
  }, {
143
- option: 'i, --fileId [fileId]'
143
+ option: '-i, --fileId [fileId]'
144
144
  }, {
145
145
  option: '--principalId [principalId]'
146
146
  }, {
@@ -90,7 +90,7 @@ _SpoFileRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoFileRoleInher
90
90
  }, {
91
91
  option: '--fileUrl [fileUrl]'
92
92
  }, {
93
- option: 'i, --fileId [fileId]'
93
+ option: '-i, --fileId [fileId]'
94
94
  }, {
95
95
  option: '-c, --clearExistingPermissions'
96
96
  }, {
@@ -88,7 +88,7 @@ _SpoFileRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFileRoleInher
88
88
  }, {
89
89
  option: '--fileUrl [fileUrl]'
90
90
  }, {
91
- option: 'i, --fileId [fileId]'
91
+ option: '-i, --fileId [fileId]'
92
92
  }, {
93
93
  option: '-f, --force'
94
94
  });
@@ -83,7 +83,7 @@ _SpoFolderRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFolderReten
83
83
  }, {
84
84
  option: '--folderUrl [folderUrl]'
85
85
  }, {
86
- option: 'i, --folderId [folderId]'
86
+ option: '-i, --folderId [folderId]'
87
87
  });
88
88
  }, _SpoFolderRetentionLabelEnsureCommand_initValidators = function _SpoFolderRetentionLabelEnsureCommand_initValidators() {
89
89
  this.validators.push(async (args) => {