@pnp/cli-microsoft365 6.0.0-beta.6a854fc → 6.0.0-beta.9d619b2

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 (44) hide show
  1. package/dist/m365/planner/commands/bucket/bucket-add.js +4 -12
  2. package/dist/m365/planner/commands/bucket/bucket-get.js +4 -12
  3. package/dist/m365/planner/commands/bucket/bucket-list.js +4 -12
  4. package/dist/m365/planner/commands/bucket/bucket-remove.js +4 -12
  5. package/dist/m365/planner/commands/bucket/bucket-set.js +4 -12
  6. package/dist/m365/planner/commands/plan/plan-get.js +0 -4
  7. package/dist/m365/planner/commands/task/task-add.js +4 -10
  8. package/dist/m365/planner/commands/task/task-get.js +4 -19
  9. package/dist/m365/planner/commands/task/task-list.js +4 -12
  10. package/dist/m365/planner/commands/task/task-set.js +4 -10
  11. package/dist/m365/planner/commands.js +0 -2
  12. package/dist/m365/spo/commands/customaction/customaction-get.js +32 -4
  13. package/dist/m365/spo/commands/customaction/customaction-remove.js +43 -8
  14. package/dist/m365/spo/commands/list/list-list.js +1 -10
  15. package/dist/m365/spo/commands/site/site-list.js +6 -17
  16. package/dist/m365/spo/commands/site/site-set.js +322 -162
  17. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +9 -6
  18. package/dist/m365/spo/commands.js +0 -3
  19. package/dist/m365/teams/commands/team/team-clone.js +33 -7
  20. package/dist/m365/teams/commands/team/team-set.js +25 -5
  21. package/docs/docs/cmd/planner/bucket/bucket-add.md +0 -3
  22. package/docs/docs/cmd/planner/bucket/bucket-get.md +0 -3
  23. package/docs/docs/cmd/planner/bucket/bucket-list.md +0 -3
  24. package/docs/docs/cmd/planner/bucket/bucket-remove.md +0 -3
  25. package/docs/docs/cmd/planner/bucket/bucket-set.md +0 -3
  26. package/docs/docs/cmd/planner/plan/plan-get.md +0 -6
  27. package/docs/docs/cmd/planner/task/task-add.md +0 -3
  28. package/docs/docs/cmd/planner/task/task-get.md +0 -3
  29. package/docs/docs/cmd/planner/task/task-list.md +0 -3
  30. package/docs/docs/cmd/planner/task/task-set.md +0 -3
  31. package/docs/docs/cmd/spo/customaction/customaction-get.md +15 -2
  32. package/docs/docs/cmd/spo/customaction/customaction-remove.md +33 -2
  33. package/docs/docs/cmd/spo/list/list-list.md +0 -3
  34. package/docs/docs/cmd/spo/site/site-list.md +6 -6
  35. package/docs/docs/cmd/spo/site/site-set.md +50 -6
  36. package/docs/docs/cmd/teams/team/team-clone.md +11 -5
  37. package/docs/docs/cmd/teams/team/team-set.md +10 -4
  38. package/package.json +1 -1
  39. package/dist/m365/spo/commands/site/site-classic-add.js +0 -333
  40. package/dist/m365/spo/commands/site/site-classic-list.js +0 -99
  41. package/dist/m365/spo/commands/site/site-classic-set.js +0 -358
  42. package/docs/docs/cmd/spo/site/site-classic-add.md +0 -93
  43. package/docs/docs/cmd/spo/site/site-classic-list.md +0 -68
  44. package/docs/docs/cmd/spo/site/site-classic-set.md +0 -99
@@ -12,6 +12,11 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
12
12
  get description() {
13
13
  return 'Removes the specified custom action';
14
14
  }
15
+ optionSets() {
16
+ return [
17
+ ['id', 'title']
18
+ ];
19
+ }
15
20
  getTelemetryProperties(args) {
16
21
  const telemetryProps = super.getTelemetryProperties(args);
17
22
  telemetryProps.scope = args.options.scope || 'All';
@@ -54,16 +59,43 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
54
59
  });
55
60
  }
56
61
  }
57
- removeScopedCustomAction(options) {
58
- const requestOptions = {
59
- url: `${options.url}/_api/${options.scope}/UserCustomActions('${encodeURIComponent(options.id)}')`,
62
+ getCustomActionId(options) {
63
+ if (options.id) {
64
+ return Promise.resolve(options.id);
65
+ }
66
+ const customActionRequestOptions = {
67
+ url: `${options.url}/_api/${options.scope}/UserCustomActions?$filter=Title eq '${encodeURIComponent(options.title)}'`,
60
68
  headers: {
61
- accept: 'application/json;odata=nometadata',
62
- 'X-HTTP-Method': 'DELETE'
69
+ accept: 'application/json;odata=nometadata'
63
70
  },
64
71
  responseType: 'json'
65
72
  };
66
- return request_1.default.post(requestOptions);
73
+ return request_1.default
74
+ .get(customActionRequestOptions)
75
+ .then((res) => {
76
+ if (res.value.length === 1) {
77
+ return Promise.resolve(res.value[0].Id);
78
+ }
79
+ if (res.value.length === 0) {
80
+ return Promise.reject(`No user custom action with title '${options.title}' found`);
81
+ }
82
+ return Promise.reject(`Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${res.value.map(a => a.Id).join(', ')}`);
83
+ });
84
+ }
85
+ removeScopedCustomAction(options) {
86
+ return this
87
+ .getCustomActionId(options)
88
+ .then((customActionId) => {
89
+ const requestOptions = {
90
+ url: `${options.url}/_api/${options.scope}/UserCustomActions('${encodeURIComponent(customActionId)}')')`,
91
+ headers: {
92
+ accept: 'application/json;odata=nometadata',
93
+ 'X-HTTP-Method': 'DELETE'
94
+ },
95
+ responseType: 'json'
96
+ };
97
+ return request_1.default.post(requestOptions);
98
+ });
67
99
  }
68
100
  /**
69
101
  * Remove request with `web` scope is send first.
@@ -95,7 +127,10 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
95
127
  options() {
96
128
  const options = [
97
129
  {
98
- option: '-i, --id <id>'
130
+ option: '-i, --id [id]'
131
+ },
132
+ {
133
+ option: '-t, --title [title]'
99
134
  },
100
135
  {
101
136
  option: '-u, --url <url>'
@@ -112,7 +147,7 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
112
147
  return options.concat(parentOptions);
113
148
  }
114
149
  validate(args) {
115
- if (utils_1.validation.isValidGuid(args.options.id) === false) {
150
+ if (args.options.id && utils_1.validation.isValidGuid(args.options.id) === false) {
116
151
  return `${args.options.id} is not valid. Custom action Id (GUID) expected.`;
117
152
  }
118
153
  if (utils_1.validation.isValidSharePointUrl(args.options.url) !== true) {
@@ -14,18 +14,12 @@ class SpoListListCommand extends SpoCommand_1.default {
14
14
  defaultProperties() {
15
15
  return ['Title', 'Url', 'Id'];
16
16
  }
17
- getTelemetryProperties(args) {
18
- const telemetryProps = super.getTelemetryProperties(args);
19
- telemetryProps.executeWithLimitedPermissions = !!args.options.executeWithLimitedPermissions;
20
- return telemetryProps;
21
- }
22
17
  commandAction(logger, args, cb) {
23
18
  if (this.verbose) {
24
19
  logger.logToStderr(`Retrieving all lists in site at ${args.options.webUrl}...`);
25
20
  }
26
- const suffix = args.options.executeWithLimitedPermissions ? '&$select=RootFolder/ServerRelativeUrl,*' : '';
27
21
  const requestOptions = {
28
- url: `${args.options.webUrl}/_api/web/lists?$expand=RootFolder${suffix}`,
22
+ url: `${args.options.webUrl}/_api/web/lists?$expand=RootFolder&$select=RootFolder/ServerRelativeUrl,*`,
29
23
  method: 'GET',
30
24
  headers: {
31
25
  'accept': 'application/json;odata=nometadata'
@@ -46,9 +40,6 @@ class SpoListListCommand extends SpoCommand_1.default {
46
40
  const options = [
47
41
  {
48
42
  option: '-u, --webUrl <webUrl>'
49
- },
50
- {
51
- option: '--executeWithLimitedPermissions'
52
43
  }
53
44
  ];
54
45
  const parentOptions = super.options();
@@ -18,7 +18,7 @@ class SpoSiteListCommand extends SpoCommand_1.default {
18
18
  telemetryProps.filter = (!(!args.options.filter)).toString();
19
19
  telemetryProps.includeOneDriveSites = typeof args.options.includeOneDriveSites !== 'undefined';
20
20
  telemetryProps.deleted = typeof args.options.deleted !== 'undefined';
21
- telemetryProps.siteType = args.options.type || 'TeamSite';
21
+ telemetryProps.siteType = args.options.type;
22
22
  return telemetryProps;
23
23
  }
24
24
  defaultProperties() {
@@ -84,11 +84,6 @@ class SpoSiteListCommand extends SpoCommand_1.default {
84
84
  }, err => reject(err));
85
85
  });
86
86
  }
87
- /*
88
- The type property currently defaults to Teamsite.
89
- It makes more sense to default to All. Certainly after adding the 'includeOneDriveSites' option.
90
- Changing this will be a breaking change. We'll remove the default the next major version.
91
- */
92
87
  getWebTemplateId(options) {
93
88
  if (options.webTemplate) {
94
89
  return options.webTemplate;
@@ -96,11 +91,7 @@ class SpoSiteListCommand extends SpoCommand_1.default {
96
91
  if (options.includeOneDriveSites) {
97
92
  return '';
98
93
  }
99
- let siteType = options.type;
100
- if (!siteType) {
101
- siteType = 'TeamSite';
102
- }
103
- switch (siteType) {
94
+ switch (options.type) {
104
95
  case "TeamSite":
105
96
  return 'GROUP#0';
106
97
  case "CommunicationSite":
@@ -113,9 +104,7 @@ class SpoSiteListCommand extends SpoCommand_1.default {
113
104
  const options = [
114
105
  {
115
106
  option: '-t, --type [type]',
116
- // To not introduce a breaking change, 'All' has been added.
117
- // You should use all when using '--includeOneDriveSites'
118
- autocomplete: ['TeamSite', 'CommunicationSite', 'All']
107
+ autocomplete: ['TeamSite', 'CommunicationSite']
119
108
  },
120
109
  {
121
110
  option: '--webTemplate [webTemplate]'
@@ -137,14 +126,14 @@ class SpoSiteListCommand extends SpoCommand_1.default {
137
126
  if (args.options.type && args.options.webTemplate) {
138
127
  return 'Specify either type or webTemplate, but not both';
139
128
  }
140
- const typeValues = ['TeamSite', 'CommunicationSite', 'All'];
129
+ const typeValues = ['TeamSite', 'CommunicationSite'];
141
130
  if (args.options.type &&
142
131
  typeValues.indexOf(args.options.type) < 0) {
143
132
  return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
144
133
  }
145
134
  if (args.options.includeOneDriveSites
146
- && (!args.options.type || args.options.type !== 'All')) {
147
- return 'When using includeOneDriveSites, specify All as value for type';
135
+ && (args.options.type || args.options.webTemplate)) {
136
+ return 'When using includeOneDriveSites, don\'t specify the type or webTemplate options';
148
137
  }
149
138
  return true;
150
139
  }