@pnp/cli-microsoft365 9.0.0-beta.2f8dd1e → 9.0.0-beta.59b026e

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 (149) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +10 -18
  5. package/dist/Command.js +49 -2
  6. package/dist/chili/chili.js +0 -23
  7. package/dist/cli/cli.js +61 -101
  8. package/dist/config.js +1 -1
  9. package/dist/m365/app/commands/permission/permission-add.js +9 -9
  10. package/dist/m365/commands/login.js +44 -96
  11. package/dist/m365/commands/setup.js +0 -4
  12. package/dist/m365/commands/status.js +2 -2
  13. package/dist/m365/connection/commands/connection-remove.js +6 -2
  14. package/dist/m365/connection/commands/connection-set.js +4 -1
  15. package/dist/m365/connection/commands/connection-use.js +25 -4
  16. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +13 -13
  17. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +18 -18
  18. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +1 -1
  19. package/dist/m365/entra/commands/group/group-user-list.js +4 -4
  20. package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +4 -4
  21. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +3 -3
  22. package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
  23. package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
  24. package/dist/m365/entra/commands/m365group/m365group-user-list.js +6 -9
  25. package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
  26. package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
  27. package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
  28. package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
  29. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
  30. package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
  31. package/dist/m365/entra/commands.js +4 -0
  32. package/dist/m365/external/commands/connection/connection-doctor.js +10 -24
  33. package/dist/m365/flow/commands/flow-get.js +1 -1
  34. package/dist/m365/flow/commands/flow-list.js +23 -24
  35. package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
  36. package/dist/m365/outlook/commands/message/message-get.js +11 -11
  37. package/dist/m365/spe/ContainerTypeProperties.js +2 -0
  38. package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
  39. package/dist/m365/spe/commands.js +2 -1
  40. package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
  41. package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
  42. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -10
  43. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -21
  44. package/dist/m365/spo/commands/cdn/cdn-get.js +12 -15
  45. package/dist/m365/spo/commands/cdn/cdn-set.js +6 -4
  46. package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
  47. package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
  48. package/dist/m365/spo/commands/field/field-list.js +1 -1
  49. package/dist/m365/spo/commands/file/file-copy.js +55 -34
  50. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  51. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  52. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  53. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  54. package/dist/m365/spo/commands/folder/folder-set.js +0 -4
  55. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
  56. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
  57. package/dist/m365/spo/commands/group/group-member-add.js +103 -99
  58. package/dist/m365/spo/commands/list/ListInstance.js +6 -1
  59. package/dist/m365/spo/commands/list/list-get.js +9 -3
  60. package/dist/m365/spo/commands/list/list-list.js +1 -4
  61. package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
  62. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
  63. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
  64. package/dist/m365/spo/commands/page/page-text-add.js +2 -3
  65. package/dist/m365/spo/commands/site/site-appcatalog-remove.js +48 -24
  66. package/dist/m365/spo/commands/site/site-remove.js +1 -7
  67. package/dist/m365/spo/commands/spo-search.js +3 -4
  68. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
  69. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
  70. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +2 -22
  71. package/dist/m365/spo/commands.js +3 -1
  72. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
  73. package/dist/m365/teams/commands/message/message-remove.js +112 -0
  74. package/dist/m365/teams/commands.js +2 -0
  75. package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
  76. package/dist/m365/viva/commands.js +1 -0
  77. package/dist/utils/drive.js +61 -0
  78. package/dist/utils/formatting.js +30 -1
  79. package/dist/utils/spo.js +143 -6
  80. package/dist/utils/teams.js +49 -0
  81. package/dist/utils/validation.js +19 -0
  82. package/dist/utils/zod.js +124 -0
  83. package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
  84. package/docs/docs/cmd/connection/connection-use.mdx +8 -2
  85. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +12 -12
  86. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +14 -14
  87. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +5 -5
  88. package/docs/docs/cmd/entra/group/group-user-list.mdx +7 -7
  89. package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +5 -5
  90. package/docs/docs/cmd/entra/m365group/m365group-recyclebinitem-list.mdx +3 -3
  91. package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
  92. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
  93. package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +1 -1
  94. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
  95. package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
  96. package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
  97. package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
  98. package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
  99. package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
  100. package/docs/docs/cmd/flow/flow-get.mdx +149 -283
  101. package/docs/docs/cmd/flow/flow-list.mdx +114 -56
  102. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
  103. package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
  104. package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
  105. package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
  106. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +11 -12
  107. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +87 -38
  108. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
  109. package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
  110. package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
  111. package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
  112. package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
  113. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
  114. package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
  115. package/docs/docs/cmd/spo/file/file-copy.mdx +119 -12
  116. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  117. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
  118. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  119. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  120. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  121. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
  122. package/docs/docs/cmd/spo/folder/folder-set.mdx +0 -6
  123. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
  124. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
  125. package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
  126. package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
  127. package/docs/docs/cmd/spo/list/list-list.mdx +5 -7
  128. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
  129. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
  130. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
  131. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
  132. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
  133. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
  134. package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +11 -2
  135. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
  136. package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
  137. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
  138. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
  139. package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
  140. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
  141. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +2 -49
  142. package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
  143. package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
  144. package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
  145. package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
  146. package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
  147. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
  148. package/npm-shrinkwrap.json +588 -1022
  149. package/package.json +7 -3
@@ -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 _SpoCdnGetCommand_instances, _SpoCdnGetCommand_initTelemetry, _SpoCdnGetCommand_initOptions, _SpoCdnGetCommand_initValidators;
6
+ var _SpoCdnGetCommand_instances, _SpoCdnGetCommand_initTelemetry, _SpoCdnGetCommand_initOptions, _SpoCdnGetCommand_initValidators, _SpoCdnGetCommand_initTypes;
7
7
  import config from '../../../../config.js';
8
8
  import request from '../../../../request.js';
9
9
  import { spo } from '../../../../utils/spo.js';
@@ -19,9 +19,11 @@ class SpoCdnGetCommand extends SpoCommand {
19
19
  constructor() {
20
20
  super();
21
21
  _SpoCdnGetCommand_instances.add(this);
22
+ this.validTypes = ['Public', 'Private'];
22
23
  __classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initTelemetry).call(this);
23
24
  __classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initOptions).call(this);
24
25
  __classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initValidators).call(this);
26
+ __classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initTypes).call(this);
25
27
  }
26
28
  async commandAction(logger, args) {
27
29
  const cdnTypeString = args.options.type || 'Public';
@@ -48,15 +50,11 @@ class SpoCdnGetCommand extends SpoCommand {
48
50
  if (response.ErrorInfo) {
49
51
  throw response.ErrorInfo.ErrorMessage;
50
52
  }
51
- else {
52
- const result = json[json.length - 1];
53
- if (this.verbose) {
54
- await logger.logToStderr(`${(cdnType === 0 ? 'Public' : 'Private')} CDN at ${spoAdminUrl} is ${(result === true ? 'enabled' : 'disabled')}`);
55
- }
56
- else {
57
- await logger.logToStderr(result);
58
- }
53
+ const result = json[json.length - 1];
54
+ if (this.verbose) {
55
+ await logger.logToStderr(`${cdnType === 0 ? 'Public' : 'Private'} CDN at ${spoAdminUrl} is ${result === true ? 'enabled' : 'disabled'}`);
59
56
  }
57
+ await logger.log(result);
60
58
  }
61
59
  catch (err) {
62
60
  this.handleRejectedPromise(err);
@@ -72,18 +70,17 @@ _SpoCdnGetCommand_instances = new WeakSet(), _SpoCdnGetCommand_initTelemetry = f
72
70
  }, _SpoCdnGetCommand_initOptions = function _SpoCdnGetCommand_initOptions() {
73
71
  this.options.unshift({
74
72
  option: '-t, --type [type]',
75
- autocomplete: ['Public', 'Private']
73
+ autocomplete: this.validTypes
76
74
  });
77
75
  }, _SpoCdnGetCommand_initValidators = function _SpoCdnGetCommand_initValidators() {
78
76
  this.validators.push(async (args) => {
79
- if (args.options.type) {
80
- if (args.options.type !== 'Public' &&
81
- args.options.type !== 'Private') {
82
- return `${args.options.type} is not a valid CDN type. Allowed values are Public|Private`;
83
- }
77
+ if (args.options.type && !this.validTypes.includes(args.options.type)) {
78
+ return `'${args.options.type}' is not a valid CDN type. Allowed values are: ${this.validTypes.join(', ')}.`;
84
79
  }
85
80
  return true;
86
81
  });
82
+ }, _SpoCdnGetCommand_initTypes = function _SpoCdnGetCommand_initTypes() {
83
+ this.types.string.push('type');
87
84
  };
88
85
  export default new SpoCdnGetCommand();
89
86
  //# sourceMappingURL=cdn-get.js.map
@@ -19,6 +19,7 @@ class SpoCdnSetCommand extends SpoCommand {
19
19
  constructor() {
20
20
  super();
21
21
  _SpoCdnSetCommand_instances.add(this);
22
+ this.validTypes = ['Public', 'Private', 'Both'];
22
23
  __classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initTelemetry).call(this);
23
24
  __classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initOptions).call(this);
24
25
  __classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initTypes).call(this);
@@ -104,7 +105,7 @@ _SpoCdnSetCommand_instances = new WeakSet(), _SpoCdnSetCommand_initTelemetry = f
104
105
  Object.assign(this.telemetryProperties, {
105
106
  cdnType: args.options.type || 'Public',
106
107
  enabled: args.options.enabled,
107
- noDefaultOrigins: (!(!args.options.noDefaultOrigins)).toString()
108
+ noDefaultOrigins: !!args.options.noDefaultOrigins
108
109
  });
109
110
  });
110
111
  }, _SpoCdnSetCommand_initOptions = function _SpoCdnSetCommand_initOptions() {
@@ -113,18 +114,19 @@ _SpoCdnSetCommand_instances = new WeakSet(), _SpoCdnSetCommand_initTelemetry = f
113
114
  autocomplete: ['true', 'false']
114
115
  }, {
115
116
  option: '-t, --type [type]',
116
- autocomplete: ['Public', 'Private', 'Both']
117
+ autocomplete: this.validTypes
117
118
  }, {
118
119
  option: '--noDefaultOrigins'
119
120
  });
120
121
  }, _SpoCdnSetCommand_initTypes = function _SpoCdnSetCommand_initTypes() {
121
- this.types.boolean.push('enabled');
122
+ this.types.boolean.push('enabled', 'noDefaultOrigins');
123
+ this.types.string.push('type');
122
124
  }, _SpoCdnSetCommand_initValidators = function _SpoCdnSetCommand_initValidators() {
123
125
  this.validators.push(async (args) => {
124
126
  if (args.options.type) {
125
127
  if (args.options.type !== 'Public' && args.options.type !== 'Both' &&
126
128
  args.options.type !== 'Private') {
127
- return `${args.options.type} is not a valid CDN type. Allowed values are Public|Private|Both`;
129
+ return `${args.options.type} is not a valid CDN type. Allowed values are ${this.validTypes.join(', ')}.`;
128
130
  }
129
131
  }
130
132
  return true;
@@ -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';
@@ -0,0 +1,124 @@
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 _SpoContentTypeFieldListCommand_instances, _SpoContentTypeFieldListCommand_initTelemetry, _SpoContentTypeFieldListCommand_initOptions, _SpoContentTypeFieldListCommand_initValidators, _SpoContentTypeFieldListCommand_initTypes, _SpoContentTypeFieldListCommand_initOptionSets;
7
+ import { formatting } from '../../../../utils/formatting.js';
8
+ import { odata } from '../../../../utils/odata.js';
9
+ import { urlUtil } from '../../../../utils/urlUtil.js';
10
+ import { validation } from '../../../../utils/validation.js';
11
+ import SpoCommand from '../../../base/SpoCommand.js';
12
+ import commands from '../../commands.js';
13
+ class SpoContentTypeFieldListCommand extends SpoCommand {
14
+ get name() {
15
+ return commands.CONTENTTYPE_FIELD_LIST;
16
+ }
17
+ get description() {
18
+ return 'Lists fields for a given site or list content type';
19
+ }
20
+ defaultProperties() {
21
+ return ['Id', 'Title', 'InternalName', 'Hidden'];
22
+ }
23
+ constructor() {
24
+ super();
25
+ _SpoContentTypeFieldListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTypes).call(this);
30
+ __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptionSets).call(this);
31
+ }
32
+ async commandAction(logger, args) {
33
+ try {
34
+ if (this.verbose) {
35
+ await logger.logToStderr(`Retrieving fields for content type '${args.options.contentTypeId || args.options.contentTypeName}' in site ${args.options.webUrl}...`);
36
+ }
37
+ let requestUrl = `${args.options.webUrl}/_api/web`;
38
+ if (args.options.listId) {
39
+ requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
40
+ }
41
+ else if (args.options.listTitle) {
42
+ requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
43
+ }
44
+ else if (args.options.listUrl) {
45
+ const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
46
+ requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
47
+ }
48
+ requestUrl += '/contentTypes';
49
+ const contentTypeId = await this.getContentTypeId(requestUrl, logger, args.options.contentTypeId, args.options.contentTypeName);
50
+ requestUrl += `('${formatting.encodeQueryParameter(contentTypeId)}')/fields`;
51
+ if (args.options.properties) {
52
+ requestUrl += `?$select=${args.options.properties}`;
53
+ }
54
+ const res = await odata.getAllItems(requestUrl);
55
+ await logger.log(res);
56
+ }
57
+ catch (err) {
58
+ this.handleRejectedODataJsonPromise(err);
59
+ }
60
+ }
61
+ async getContentTypeId(requestUrl, logger, contentTypeId, contentTypeName) {
62
+ if (contentTypeId) {
63
+ return contentTypeId;
64
+ }
65
+ if (this.verbose) {
66
+ await logger.logToStderr(`Retrieving content type id for content type '${contentTypeName}'.`);
67
+ }
68
+ const res = await odata.getAllItems(`${requestUrl}?$filter=Name eq '${formatting.encodeQueryParameter(contentTypeName)}'&$select=StringId`);
69
+ if (res.length === 0) {
70
+ throw `Content type with name ${contentTypeName} not found.`;
71
+ }
72
+ return res[0].StringId;
73
+ }
74
+ }
75
+ _SpoContentTypeFieldListCommand_instances = new WeakSet(), _SpoContentTypeFieldListCommand_initTelemetry = function _SpoContentTypeFieldListCommand_initTelemetry() {
76
+ this.telemetry.push((args) => {
77
+ Object.assign(this.telemetryProperties, {
78
+ contentTypeId: typeof args.options.contentTypeId !== 'undefined',
79
+ contentTypeName: typeof args.options.contentTypeName !== 'undefined',
80
+ listId: typeof args.options.listId !== 'undefined',
81
+ listTitle: typeof args.options.listTitle !== 'undefined',
82
+ listUrl: typeof args.options.listUrl !== 'undefined',
83
+ properties: typeof args.options.properties !== 'undefined'
84
+ });
85
+ });
86
+ }, _SpoContentTypeFieldListCommand_initOptions = function _SpoContentTypeFieldListCommand_initOptions() {
87
+ this.options.unshift({
88
+ option: '-u, --webUrl <webUrl>'
89
+ }, {
90
+ option: '-i, --contentTypeId [contentTypeId]'
91
+ }, {
92
+ option: '-n, --contentTypeName [contentTypeName]'
93
+ }, {
94
+ option: '-l, --listTitle [listTitle]'
95
+ }, {
96
+ option: '--listId [listId]'
97
+ }, {
98
+ option: '--listUrl [listUrl]'
99
+ }, {
100
+ option: '-p, --properties [properties]'
101
+ });
102
+ }, _SpoContentTypeFieldListCommand_initValidators = function _SpoContentTypeFieldListCommand_initValidators() {
103
+ this.validators.push(async (args) => {
104
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
105
+ if (isValidSharePointUrl !== true) {
106
+ return isValidSharePointUrl;
107
+ }
108
+ if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
109
+ return `${args.options.listId} is not a valid GUID for option 'listId'.`;
110
+ }
111
+ return true;
112
+ });
113
+ }, _SpoContentTypeFieldListCommand_initTypes = function _SpoContentTypeFieldListCommand_initTypes() {
114
+ this.types.string.push('webUrl', 'contentTypeId', 'contentTypeName', 'listTitle', 'listId', 'listUrl', 'properties');
115
+ }, _SpoContentTypeFieldListCommand_initOptionSets = function _SpoContentTypeFieldListCommand_initOptionSets() {
116
+ this.optionSets.push({
117
+ options: ['contentTypeId', 'contentTypeName']
118
+ }, {
119
+ options: ['listId', 'listTitle', 'listUrl'],
120
+ runsWhen: (args) => args.options.listId || args.options.listTitle || args.options.listUrl
121
+ });
122
+ };
123
+ export default new SpoContentTypeFieldListCommand();
124
+ //# sourceMappingURL=contenttype-field-list.js.map
@@ -18,7 +18,7 @@ class SpoFieldListCommand extends SpoCommand {
18
18
  return 'Retrieves columns for the specified list or site';
19
19
  }
20
20
  defaultProperties() {
21
- return ['Id', 'Title', 'Group', 'Hidden'];
21
+ return ['Id', 'Title', 'InternalName', 'Hidden'];
22
22
  }
23
23
  constructor() {
24
24
  super();
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators, _SpoFileCopyCommand_initOptionSets, _SpoFileCopyCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
+ import { CreateCopyJobsNameConflictBehavior, spo } from '../../../../utils/spo.js';
8
9
  import { urlUtil } from '../../../../utils/urlUtil.js';
9
10
  import { validation } from '../../../../utils/validation.js';
10
11
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -30,39 +31,43 @@ class SpoFileCopyCommand extends SpoCommand {
30
31
  try {
31
32
  const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
32
33
  const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
33
- let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
34
- if (args.options.newName) {
35
- destinationPath += args.options.newName;
34
+ const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
35
+ if (this.verbose) {
36
+ await logger.logToStderr(`Copying file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
37
+ }
38
+ let newName = args.options.newName;
39
+ // Add original file extension if not provided
40
+ if (newName && !newName.includes('.')) {
41
+ newName += sourceServerRelativePath.substring(sourceServerRelativePath.lastIndexOf('.'));
36
42
  }
37
- else {
38
- // Keep the original file name
39
- destinationPath += sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
43
+ const copyJobResponse = await spo.createCopyJob(args.options.webUrl, sourcePath, destinationPath, {
44
+ nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
45
+ bypassSharedLock: !!args.options.bypassSharedLock,
46
+ ignoreVersionHistory: !!args.options.ignoreVersionHistory,
47
+ newName: newName
48
+ });
49
+ if (args.options.skipWait) {
50
+ return;
40
51
  }
41
52
  if (this.verbose) {
42
- await logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
53
+ await logger.logToStderr('Waiting for the copy job to complete...');
43
54
  }
55
+ const copyJobResult = await spo.getCopyJobResult(args.options.webUrl, copyJobResponse);
56
+ if (this.verbose) {
57
+ await logger.logToStderr('Getting information about the destination file...');
58
+ }
59
+ // Get destination file data
60
+ const siteRelativeDestinationFolder = '/' + copyJobResult.TargetObjectSiteRelativeUrl.substring(0, copyJobResult.TargetObjectSiteRelativeUrl.lastIndexOf('/'));
61
+ const absoluteWebUrl = destinationPath.substring(0, destinationPath.toLowerCase().lastIndexOf(siteRelativeDestinationFolder.toLowerCase()));
44
62
  const requestOptions = {
45
- url: `${args.options.webUrl}/_api/SP.MoveCopyUtil.CopyFileByPath`,
63
+ url: `${absoluteWebUrl}/_api/Web/GetFileById('${copyJobResult.TargetObjectUniqueId}')`,
46
64
  headers: {
47
65
  accept: 'application/json;odata=nometadata'
48
66
  },
49
- responseType: 'json',
50
- data: {
51
- srcPath: {
52
- DecodedUrl: sourcePath
53
- },
54
- destPath: {
55
- DecodedUrl: destinationPath
56
- },
57
- overwrite: args.options.nameConflictBehavior === 'replace',
58
- options: {
59
- KeepBoth: args.options.nameConflictBehavior === 'rename',
60
- ResetAuthorAndCreatedOnCopy: !!args.options.resetAuthorAndCreated,
61
- ShouldBypassSharedLocks: !!args.options.bypassSharedLock
62
- }
63
- }
67
+ responseType: 'json'
64
68
  };
65
- await request.post(requestOptions);
69
+ const destinationFile = await request.get(requestOptions);
70
+ await logger.log(destinationFile);
66
71
  }
67
72
  catch (err) {
68
73
  this.handleRejectedODataJsonPromise(err);
@@ -76,17 +81,30 @@ class SpoFileCopyCommand extends SpoCommand {
76
81
  await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
77
82
  }
78
83
  const requestOptions = {
79
- url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')?$select=ServerRelativePath`,
84
+ url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')/ServerRelativePath`,
80
85
  headers: {
81
86
  accept: 'application/json;odata=nometadata'
82
87
  },
83
88
  responseType: 'json'
84
89
  };
85
90
  const file = await request.get(requestOptions);
86
- return file.ServerRelativePath.DecodedUrl;
91
+ return file.DecodedUrl;
92
+ }
93
+ getNameConflictBehaviorValue(nameConflictBehavior) {
94
+ switch (nameConflictBehavior?.toLowerCase()) {
95
+ case 'fail':
96
+ return CreateCopyJobsNameConflictBehavior.Fail;
97
+ case 'replace':
98
+ return CreateCopyJobsNameConflictBehavior.Replace;
99
+ case 'rename':
100
+ return CreateCopyJobsNameConflictBehavior.Rename;
101
+ default:
102
+ return CreateCopyJobsNameConflictBehavior.Fail;
103
+ }
87
104
  }
88
105
  getAbsoluteUrl(webUrl, url) {
89
- return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
106
+ const result = url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
107
+ return urlUtil.removeTrailingSlashes(result);
90
108
  }
91
109
  }
92
110
  _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
@@ -95,9 +113,10 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
95
113
  sourceUrl: typeof args.options.sourceUrl !== 'undefined',
96
114
  sourceId: typeof args.options.sourceId !== 'undefined',
97
115
  newName: typeof args.options.newName !== 'undefined',
98
- nameConflictBehavior: args.options.nameConflictBehavior || false,
99
- resetAuthorAndCreated: !!args.options.resetAuthorAndCreated,
100
- bypassSharedLock: !!args.options.bypassSharedLock
116
+ nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
117
+ ignoreVersionHistory: !!args.options.ignoreVersionHistory,
118
+ bypassSharedLock: !!args.options.bypassSharedLock,
119
+ skipWait: !!args.options.skipWait
101
120
  });
102
121
  });
103
122
  }, _SpoFileCopyCommand_initOptions = function _SpoFileCopyCommand_initOptions() {
@@ -114,10 +133,12 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
114
133
  }, {
115
134
  option: '--nameConflictBehavior [nameConflictBehavior]',
116
135
  autocomplete: this.nameConflictBehaviorOptions
117
- }, {
118
- option: '--resetAuthorAndCreated'
119
136
  }, {
120
137
  option: '--bypassSharedLock'
138
+ }, {
139
+ option: '--ignoreVersionHistory'
140
+ }, {
141
+ option: '--skipWait'
121
142
  });
122
143
  }, _SpoFileCopyCommand_initValidators = function _SpoFileCopyCommand_initValidators() {
123
144
  this.validators.push(async (args) => {
@@ -128,7 +149,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
128
149
  if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
129
150
  return `${args.options.sourceId} is not a valid GUID for sourceId.`;
130
151
  }
131
- if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
152
+ if (args.options.nameConflictBehavior && !this.nameConflictBehaviorOptions.includes(args.options.nameConflictBehavior.toLowerCase())) {
132
153
  return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
133
154
  }
134
155
  return true;
@@ -137,7 +158,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
137
158
  this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
138
159
  }, _SpoFileCopyCommand_initTypes = function _SpoFileCopyCommand_initTypes() {
139
160
  this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
140
- this.types.boolean.push('resetAuthorAndCreated', 'bypassSharedLock');
161
+ this.types.boolean.push('bypassSharedLock', 'ignoreVersionHistory', 'skipWait');
141
162
  };
142
163
  export default new SpoFileCopyCommand();
143
164
  //# sourceMappingURL=file-copy.js.map
@@ -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) => {
@@ -18,9 +18,6 @@ class SpoFolderSetCommand extends SpoCommand {
18
18
  get description() {
19
19
  return 'Updates a folder';
20
20
  }
21
- alias() {
22
- return [commands.FOLDER_RENAME];
23
- }
24
21
  constructor() {
25
22
  super();
26
23
  _SpoFolderSetCommand_instances.add(this);
@@ -34,7 +31,6 @@ class SpoFolderSetCommand extends SpoCommand {
34
31
  }
35
32
  async commandAction(logger, args) {
36
33
  try {
37
- await this.showDeprecationWarning(logger, this.alias()[0], this.name);
38
34
  if (this.verbose) {
39
35
  await logger.logToStderr(`Updating folder '${args.options.name}'...`);
40
36
  }