@pnp/cli-microsoft365 7.0.0-beta.c0afb7b → 7.0.0-beta.c2db9df

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 (158) hide show
  1. package/README.md +4 -4
  2. package/dist/cli/Cli.js +3 -3
  3. package/dist/m365/aad/commands/app/app-add.js +8 -8
  4. package/dist/m365/aad/commands/app/app-get.js +4 -1
  5. package/dist/m365/aad/commands/app/app-remove.js +3 -1
  6. package/dist/m365/aad/commands/app/app-role-add.js +9 -6
  7. package/dist/m365/aad/commands/app/app-role-list.js +4 -1
  8. package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
  9. package/dist/m365/aad/commands/app/app-set.js +9 -6
  10. package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +7 -2
  11. package/dist/m365/aad/commands/group/group-get.js +4 -4
  12. package/dist/m365/aad/commands/group/group-list.js +1 -23
  13. package/dist/m365/aad/commands/m365group/m365group-add.js +12 -9
  14. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
  15. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
  16. package/dist/m365/aad/commands/m365group/m365group-teamify.js +4 -1
  17. package/dist/m365/aad/commands/policy/policy-list.js +5 -5
  18. package/dist/m365/aad/commands/sp/sp-add.js +4 -1
  19. package/dist/m365/aad/commands/sp/sp-get.js +4 -1
  20. package/dist/m365/aad/commands/user/user-get.js +7 -2
  21. package/dist/m365/booking/commands/business/business-get.js +4 -1
  22. package/dist/m365/cli/commands/cli-issue.js +5 -5
  23. package/dist/m365/cli/commands/config/config-get.js +5 -5
  24. package/dist/m365/cli/commands/config/config-reset.js +5 -5
  25. package/dist/m365/cli/commands/config/config-set.js +5 -5
  26. package/dist/m365/commands/login.js +5 -5
  27. package/dist/m365/commands/request.js +1 -1
  28. package/dist/m365/flow/commands/owner/owner-ensure.js +5 -5
  29. package/dist/m365/outlook/commands/message/message-list.js +4 -2
  30. package/dist/m365/outlook/commands/message/message-move.js +4 -2
  31. package/dist/m365/pa/commands/app/app-export.js +7 -7
  32. package/dist/m365/pa/commands/app/app-owner-set.js +5 -5
  33. package/dist/m365/pa/commands/app/app-permission-ensure.js +5 -5
  34. package/dist/m365/planner/commands/bucket/bucket-get.js +5 -1
  35. package/dist/m365/planner/commands/bucket/bucket-remove.js +3 -1
  36. package/dist/m365/planner/commands/bucket/bucket-set.js +4 -1
  37. package/dist/m365/planner/commands/task/task-add.js +17 -11
  38. package/dist/m365/planner/commands/task/task-get.js +42 -27
  39. package/dist/m365/planner/commands/task/task-list.js +26 -19
  40. package/dist/m365/planner/commands/task/task-remove.js +45 -37
  41. package/dist/m365/planner/commands/task/task-set.js +35 -23
  42. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
  43. package/dist/m365/pp/commands/card/card-get.js +3 -5
  44. package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
  45. package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
  46. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +14 -14
  47. package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
  48. package/dist/m365/spfx/commands/package/package-generate.js +15 -15
  49. package/dist/m365/spfx/commands/project/DeployWorkflow.js +55 -0
  50. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0-rc.1.js} +2 -2
  51. package/dist/m365/spfx/commands/project/project-doctor.js +9 -9
  52. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +157 -0
  53. package/dist/m365/spfx/commands/project/project-github-workflow-model.js +2 -0
  54. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
  55. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0-rc.1.js} +35 -27
  56. package/dist/m365/spfx/commands/project/project-upgrade.js +14 -14
  57. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  58. package/dist/m365/spfx/commands.js +1 -0
  59. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +5 -5
  60. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
  61. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-list.js +5 -5
  62. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
  63. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
  64. package/dist/m365/spo/commands/commandset/commandset-add.js +11 -11
  65. package/dist/m365/spo/commands/commandset/commandset-get.js +12 -10
  66. package/dist/m365/spo/commands/commandset/commandset-list.js +5 -5
  67. package/dist/m365/spo/commands/commandset/commandset-remove.js +7 -6
  68. package/dist/m365/spo/commands/commandset/commandset-set.js +14 -12
  69. package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
  70. package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
  71. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
  72. package/dist/m365/spo/commands/file/file-get.js +9 -6
  73. package/dist/m365/spo/commands/file/file-sharinglink-add.js +8 -8
  74. package/dist/m365/spo/commands/file/file-sharinglink-list.js +5 -5
  75. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
  76. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
  77. package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
  78. package/dist/m365/spo/commands/list/list-add.js +4 -4
  79. package/dist/m365/spo/commands/list/list-set.js +4 -4
  80. package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
  81. package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
  82. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +8 -8
  83. package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
  84. package/dist/m365/spo/commands/page/page-get.js +1 -0
  85. package/dist/m365/spo/commands/page/page-list.js +4 -3
  86. package/dist/m365/spo/commands/page/page-section-add.js +56 -21
  87. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +30 -32
  88. package/dist/m365/spo/commands/site/site-add.js +114 -161
  89. package/dist/m365/spo/commands/site/site-apppermission-add.js +15 -18
  90. package/dist/m365/spo/commands/site/site-apppermission-remove.js +34 -38
  91. package/dist/m365/spo/commands/site/site-apppermission-set.js +11 -14
  92. package/dist/m365/spo/commands/site/site-ensure.js +13 -66
  93. package/dist/m365/spo/commands/site/site-list.js +5 -7
  94. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +6 -6
  95. package/dist/m365/spo/commands/site/site-remove.js +166 -210
  96. package/dist/m365/spo/commands/site/site-set.js +121 -153
  97. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  98. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
  99. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
  100. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
  101. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
  102. package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +8 -8
  103. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
  104. package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
  105. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
  106. package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +8 -8
  107. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +4 -4
  108. package/dist/m365/spo/commands/term/term-get.js +6 -6
  109. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +3 -3
  110. package/dist/m365/spo/commands/web/web-set.js +5 -5
  111. package/dist/m365/teams/commands/app/app-list.js +5 -5
  112. package/dist/m365/teams/commands/channel/channel-add.js +5 -1
  113. package/dist/m365/teams/commands/channel/channel-member-add.js +4 -2
  114. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
  115. package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
  116. package/dist/m365/teams/commands/chat/chat-get.js +7 -10
  117. package/dist/m365/teams/commands/chat/chat-member-add.js +5 -5
  118. package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
  119. package/dist/m365/teams/commands/funsettings/funsettings-set.js +4 -4
  120. package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +4 -4
  121. package/dist/m365/teams/commands/membersettings/membersettings-set.js +4 -4
  122. package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +5 -5
  123. package/dist/m365/teams/commands/team/team-clone.js +5 -10
  124. package/dist/m365/teams/commands/team/team-list.js +94 -30
  125. package/dist/m365/teams/commands/team/team-set.js +3 -3
  126. package/dist/m365/tenant/commands/info/info-get.js +83 -0
  127. package/dist/m365/tenant/commands.js +1 -0
  128. package/dist/m365/todo/commands/task/task-add.js +6 -6
  129. package/dist/m365/yammer/commands/message/message-list.js +5 -5
  130. package/dist/m365/yammer/commands/yammer-search.js +5 -5
  131. package/dist/utils/aadGroup.js +23 -3
  132. package/dist/utils/formatting.js +7 -0
  133. package/dist/utils/fsUtil.js +5 -0
  134. package/dist/utils/powerPlatform.js +1 -1
  135. package/dist/utils/spo.js +582 -0
  136. package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
  137. package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
  138. package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
  139. package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
  140. package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
  141. package/docs/docs/cmd/planner/task/task-add.mdx +22 -7
  142. package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
  143. package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
  144. package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
  145. package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
  146. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
  147. package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
  148. package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
  149. package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
  150. package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
  151. package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
  152. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
  153. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
  154. package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
  155. package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
  156. package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
  157. package/npm-shrinkwrap.json +196 -193
  158. package/package.json +8 -12
@@ -84,89 +84,69 @@ class SpoSiteSetCommand extends SpoCommand {
84
84
  await logger.logToStderr('Site is not group connected');
85
85
  }
86
86
  if (typeof args.options.isPublic !== 'undefined') {
87
- return Promise.reject(`The isPublic option can't be set on a site that is not groupified`);
87
+ throw `The isPublic option can't be set on a site that is not groupified`;
88
88
  }
89
- return this.updateSiteDescription(logger, args)
90
- .then(_ => this.updateSiteOwners(logger, args));
89
+ await this.updateSiteDescription(logger, args);
90
+ await this.updateSiteOwners(logger, args);
91
91
  }
92
- waitForSiteUpdateCompletion(logger, args, res) {
93
- return new Promise((resolve, reject) => {
94
- if (!res) {
95
- resolve();
96
- return;
97
- }
98
- const json = JSON.parse(res);
99
- const response = json[0];
100
- if (response.ErrorInfo) {
101
- reject(response.ErrorInfo.ErrorMessage);
102
- }
103
- else {
104
- const operation = json[json.length - 1];
105
- const isComplete = operation.IsComplete;
106
- if (!args.options.wait || isComplete) {
107
- resolve();
108
- return;
109
- }
110
- setTimeout(() => {
111
- spo.waitUntilFinished({
112
- operationId: JSON.stringify(operation._ObjectIdentity_),
113
- siteUrl: this.spoAdminUrl,
114
- resolve,
115
- reject,
116
- logger,
117
- currentContext: this.context,
118
- debug: this.debug,
119
- verbose: this.verbose
120
- });
121
- }, operation.PollingInterval);
122
- }
92
+ async waitForSiteUpdateCompletion(logger, args, response) {
93
+ if (!response) {
94
+ return;
95
+ }
96
+ const json = JSON.parse(response);
97
+ const responseContent = json[0];
98
+ if (responseContent.ErrorInfo) {
99
+ throw responseContent.ErrorInfo.ErrorMessage;
100
+ }
101
+ const operation = json[json.length - 1];
102
+ const isComplete = operation.IsComplete;
103
+ if (!args.options.wait || isComplete) {
104
+ return;
105
+ }
106
+ await new Promise((resolve, reject) => {
107
+ setTimeout(() => {
108
+ spo.waitUntilFinished({
109
+ operationId: JSON.stringify(operation._ObjectIdentity_),
110
+ siteUrl: this.spoAdminUrl,
111
+ resolve,
112
+ reject,
113
+ logger,
114
+ currentContext: this.context,
115
+ debug: this.debug,
116
+ verbose: this.verbose
117
+ });
118
+ }, operation.PollingInterval);
123
119
  });
124
120
  }
125
121
  async updateSiteOwners(logger, args) {
126
122
  if (!args.options.owners) {
127
- return Promise.resolve();
123
+ return;
128
124
  }
129
- return new Promise(async (resolve, reject) => {
130
- if (this.verbose) {
131
- await logger.logToStderr(`Updating site owners ${args.options.url}...`);
132
- }
133
- Promise.all(args.options.owners.split(',').map(o => {
134
- return this.setAdmin(args.options.url, o.trim());
135
- }))
136
- .then(() => {
137
- resolve();
138
- }, (err) => {
139
- reject(err);
140
- });
141
- });
125
+ if (this.verbose) {
126
+ await logger.logToStderr(`Updating site owners ${args.options.url}...`);
127
+ }
128
+ await Promise.all(args.options.owners.split(',').map(o => {
129
+ return this.setAdmin(args.options.url, o.trim());
130
+ }));
142
131
  }
143
- setAdmin(siteUrl, principal) {
144
- return new Promise((resolve, reject) => {
145
- const requestOptions = {
146
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
147
- headers: {
148
- 'X-RequestDigest': this.context.FormDigestValue
149
- },
150
- 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="48" ObjectPathId="47" /></Actions><ObjectPaths><Method Id="47" ParentId="34" Name="SetSiteAdmin"><Parameters><Parameter Type="String">${formatting.escapeXml(siteUrl)}</Parameter><Parameter Type="String">${formatting.escapeXml(principal)}</Parameter><Parameter Type="Boolean">true</Parameter></Parameters></Method><Constructor Id="34" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
151
- };
152
- return request.post(requestOptions)
153
- .then((res) => {
154
- const json = JSON.parse(res);
155
- const response = json[0];
156
- if (response.ErrorInfo) {
157
- reject(response.ErrorInfo.ErrorMessage);
158
- }
159
- else {
160
- resolve();
161
- }
162
- }, (err) => {
163
- reject(err);
164
- });
165
- });
132
+ async setAdmin(siteUrl, principal) {
133
+ const requestOptions = {
134
+ url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
135
+ headers: {
136
+ 'X-RequestDigest': this.context.FormDigestValue
137
+ },
138
+ 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="48" ObjectPathId="47" /></Actions><ObjectPaths><Method Id="47" ParentId="34" Name="SetSiteAdmin"><Parameters><Parameter Type="String">${formatting.escapeXml(siteUrl)}</Parameter><Parameter Type="String">${formatting.escapeXml(principal)}</Parameter><Parameter Type="Boolean">true</Parameter></Parameters></Method><Constructor Id="34" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
139
+ };
140
+ const response = await request.post(requestOptions);
141
+ const json = JSON.parse(response);
142
+ const responseContent = json[0];
143
+ if (responseContent.ErrorInfo) {
144
+ throw responseContent.ErrorInfo.ErrorMessage;
145
+ }
166
146
  }
167
147
  async updateSiteDescription(logger, args) {
168
148
  if (!args.options.description) {
169
- return Promise.resolve(undefined);
149
+ return;
170
150
  }
171
151
  if (this.verbose) {
172
152
  await logger.logToStderr(`Setting site description ${args.options.url}...`);
@@ -185,11 +165,11 @@ class SpoSiteSetCommand extends SpoCommand {
185
165
  },
186
166
  json: true
187
167
  };
188
- return request.post(requestOptions);
168
+ await request.post(requestOptions);
189
169
  }
190
170
  async updateSiteLockState(logger, args) {
191
171
  if (!args.options.lockState) {
192
- return Promise.resolve(undefined);
172
+ return;
193
173
  }
194
174
  if (this.verbose) {
195
175
  await logger.logToStderr(`Setting site lock state ${args.options.url}...`);
@@ -207,52 +187,44 @@ class SpoSiteSetCommand extends SpoCommand {
207
187
  if (this.debug) {
208
188
  await logger.logToStderr(`Site attached to group ${this.groupId}`);
209
189
  }
210
- return new Promise((resolve, reject) => {
211
- if (typeof args.options.title === 'undefined' &&
212
- typeof args.options.description === 'undefined' &&
213
- typeof args.options.isPublic === 'undefined' &&
214
- typeof args.options.owners === 'undefined') {
215
- return resolve();
216
- }
217
- const promises = [];
218
- if (typeof args.options.title !== 'undefined') {
219
- const requestOptions = {
220
- url: `${this.spoAdminUrl}/_api/SPOGroup/UpdateGroupPropertiesBySiteId`,
221
- headers: {
222
- accept: 'application/json;odata=nometadata',
223
- 'content-type': 'application/json;charset=utf-8',
224
- 'X-RequestDigest': this.context.FormDigestValue
225
- },
226
- data: {
227
- groupId: this.groupId,
228
- siteId: this.siteId,
229
- displayName: args.options.title
230
- },
231
- responseType: 'json'
232
- };
233
- promises.push(request.post(requestOptions));
234
- }
235
- if (typeof args.options.isPublic !== 'undefined') {
236
- const commandOptions = {
237
- id: this.groupId,
238
- isPrivate: (args.options.isPublic === false),
239
- debug: this.debug,
240
- verbose: this.verbose
241
- };
242
- promises.push(Cli.executeCommand(aadM365GroupSetCommand, { options: { ...commandOptions, _: [] } }));
243
- }
244
- if (args.options.description) {
245
- promises.push(this.setGroupifiedSiteDescription(args.options.description));
246
- }
247
- promises.push(this.setGroupifiedSiteOwners(logger, args));
248
- Promise
249
- .all(promises)
250
- .then(() => {
251
- resolve();
252
- }, (error) => {
253
- reject(error);
254
- });
255
- });
190
+ if (typeof args.options.title === 'undefined' &&
191
+ typeof args.options.description === 'undefined' &&
192
+ typeof args.options.isPublic === 'undefined' &&
193
+ typeof args.options.owners === 'undefined') {
194
+ return;
195
+ }
196
+ const promises = [];
197
+ if (typeof args.options.title !== 'undefined') {
198
+ const requestOptions = {
199
+ url: `${this.spoAdminUrl}/_api/SPOGroup/UpdateGroupPropertiesBySiteId`,
200
+ headers: {
201
+ accept: 'application/json;odata=nometadata',
202
+ 'content-type': 'application/json;charset=utf-8',
203
+ 'X-RequestDigest': this.context.FormDigestValue
204
+ },
205
+ data: {
206
+ groupId: this.groupId,
207
+ siteId: this.siteId,
208
+ displayName: args.options.title
209
+ },
210
+ responseType: 'json'
211
+ };
212
+ promises.push(request.post(requestOptions));
213
+ }
214
+ if (typeof args.options.isPublic !== 'undefined') {
215
+ const commandOptions = {
216
+ id: this.groupId,
217
+ isPrivate: (args.options.isPublic === false),
218
+ debug: this.debug,
219
+ verbose: this.verbose
220
+ };
221
+ promises.push(Cli.executeCommand(aadM365GroupSetCommand, { options: { ...commandOptions, _: [] } }));
222
+ }
223
+ if (args.options.description) {
224
+ promises.push(this.setGroupifiedSiteDescription(args.options.description));
225
+ }
226
+ promises.push(this.setGroupifiedSiteOwners(logger, args));
227
+ await Promise.all(promises);
256
228
  }
257
229
  setGroupifiedSiteDescription(description) {
258
230
  const requestOptions = {
@@ -268,7 +240,7 @@ class SpoSiteSetCommand extends SpoCommand {
268
240
  }
269
241
  async setGroupifiedSiteOwners(logger, args) {
270
242
  if (typeof args.options.owners === 'undefined') {
271
- return Promise.resolve();
243
+ return;
272
244
  }
273
245
  const owners = args.options.owners.split(',').map(o => o.trim());
274
246
  if (this.verbose) {
@@ -281,21 +253,19 @@ class SpoSiteSetCommand extends SpoCommand {
281
253
  },
282
254
  responseType: 'json'
283
255
  };
284
- return request.get(requestOptions)
285
- .then((res) => {
286
- if (res.value.length === 0) {
287
- return Promise.resolve();
288
- }
289
- return Promise.all(res.value.map(user => {
290
- const requestOptions = {
291
- url: `${this.spoAdminUrl}/_api/SP.Directory.DirectorySession/Group('${this.groupId}')/Owners/Add(objectId='${user.id}', principalName='')`,
292
- headers: {
293
- 'content-type': 'application/json;odata=verbose'
294
- }
295
- };
296
- return request.post(requestOptions);
297
- }));
298
- });
256
+ const response = await request.get(requestOptions);
257
+ if (response.value.length === 0) {
258
+ return;
259
+ }
260
+ await Promise.all(response.value.map(user => {
261
+ const requestOptions = {
262
+ url: `${this.spoAdminUrl}/_api/SP.Directory.DirectorySession/Group('${this.groupId}')/Owners/Add(objectId='${user.id}', principalName='')`,
263
+ headers: {
264
+ 'content-type': 'application/json;odata=verbose'
265
+ }
266
+ };
267
+ return request.post(requestOptions);
268
+ }));
299
269
  }
300
270
  async updateSiteProperties(logger, args) {
301
271
  const isGroupConnectedSite = this.isGroupConnectedSite();
@@ -313,10 +283,9 @@ class SpoSiteSetCommand extends SpoCommand {
313
283
  }
314
284
  }
315
285
  if (!updatedProperties) {
316
- return Promise.resolve(undefined);
286
+ return;
317
287
  }
318
- const res = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
319
- this.context = res;
288
+ this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
320
289
  if (this.verbose) {
321
290
  await logger.logToStderr(`Updating site ${args.options.url} properties...`);
322
291
  }
@@ -350,6 +319,9 @@ class SpoSiteSetCommand extends SpoCommand {
350
319
  const flowsPolicy = args.options.disableFlows ? FlowsPolicy.Disabled : FlowsPolicy.Enabled;
351
320
  payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="DisableFlows"><Parameter Type="Enum">${flowsPolicy}</Parameter></SetProperty>`);
352
321
  }
322
+ if (typeof args.options.socialBarOnSitePagesDisabled !== 'undefined') {
323
+ payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="SocialBarOnSitePagesDisabled"><Parameter Type="Boolean">${args.options.socialBarOnSitePagesDisabled}</Parameter></SetProperty>`);
324
+ }
353
325
  if (args.options.shareByEmailEnabled !== undefined) {
354
326
  sitePropertiesPayload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="ShareByEmailEnabled"><Parameter Type="Boolean">${args.options.shareByEmailEnabled}</Parameter></SetProperty>`);
355
327
  }
@@ -367,7 +339,7 @@ class SpoSiteSetCommand extends SpoCommand {
367
339
  const requestOptions = {
368
340
  url: `${args.options.url}/_vti_bin/client.svc/ProcessQuery`,
369
341
  headers: {
370
- 'X-RequestDigest': res.FormDigestValue
342
+ 'X-RequestDigest': this.context.FormDigestValue
371
343
  },
372
344
  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>${sitePropertiesPayload.join('')}</Actions><ObjectPaths><StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /><Property Id="5" ParentId="1" Name="Site" /></ObjectPaths></Request>`
373
345
  };
@@ -378,7 +350,7 @@ class SpoSiteSetCommand extends SpoCommand {
378
350
  const requestOptions = {
379
351
  url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
380
352
  headers: {
381
- 'X-RequestDigest': res.FormDigestValue
353
+ 'X-RequestDigest': this.context.FormDigestValue
382
354
  },
383
355
  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>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${this.tenantId.substr(pos, this.tenantId.indexOf('&') - pos)}&#xA;SiteProperties&#xA;${formatting.encodeQueryParameter(args.options.url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
384
356
  };
@@ -386,9 +358,9 @@ class SpoSiteSetCommand extends SpoCommand {
386
358
  }
387
359
  return response || sitePropertiesResponse;
388
360
  }
389
- applySiteDesign(logger, args) {
361
+ async applySiteDesign(logger, args) {
390
362
  if (typeof args.options.siteDesignId === 'undefined') {
391
- return Promise.resolve();
363
+ return;
392
364
  }
393
365
  const options = {
394
366
  webUrl: args.options.url,
@@ -410,16 +382,12 @@ class SpoSiteSetCommand extends SpoCommand {
410
382
  },
411
383
  responseType: 'json'
412
384
  };
413
- return request
414
- .get(requestOptions)
415
- .then(async (siteInfo) => {
416
- this.groupId = siteInfo.GroupId;
417
- this.siteId = siteInfo.Id;
418
- if (this.debug) {
419
- await logger.logToStderr(`Retrieved site IDs. siteId: ${this.siteId}, groupId: ${this.groupId}`);
420
- }
421
- return Promise.resolve();
422
- });
385
+ const siteInfo = await request.get(requestOptions);
386
+ this.groupId = siteInfo.GroupId;
387
+ this.siteId = siteInfo.Id;
388
+ if (this.debug) {
389
+ await logger.logToStderr(`Retrieved site IDs. siteId: ${this.siteId}, groupId: ${this.groupId}`);
390
+ }
423
391
  }
424
392
  isGroupConnectedSite() {
425
393
  return this.groupId !== '00000000-0000-0000-0000-000000000000';
@@ -75,7 +75,7 @@ class SpoTenantAppCatalogAddCommand extends SpoCommand {
75
75
  url: url,
76
76
  skipRecycleBin: true,
77
77
  wait: true,
78
- confirm: true,
78
+ force: true,
79
79
  verbose: this.verbose,
80
80
  debug: this.debug
81
81
  };
@@ -11,6 +11,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
11
11
  import { validation } from '../../../../utils/validation.js';
12
12
  import SpoCommand from '../../../base/SpoCommand.js';
13
13
  import commands from '../../commands.js';
14
+ import { Cli } from '../../../../cli/Cli.js';
14
15
  class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
15
16
  get name() {
16
17
  return commands.TENANT_APPLICATIONCUSTOMIZER_GET;
@@ -48,11 +49,15 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
48
49
  if (listItemInstances.length === 0) {
49
50
  throw 'The specified application customizer was not found';
50
51
  }
52
+ listItemInstances.forEach(v => delete v['ID']);
51
53
  if (listItemInstances.length > 1) {
52
- throw `Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.map(item => item.GUID).join(', ')}`;
54
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances);
55
+ const result = await Cli.handleMultipleResultsFound(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
56
+ await logger.log(result);
57
+ }
58
+ else {
59
+ await logger.log(listItemInstances[0]);
53
60
  }
54
- listItemInstances.forEach(v => delete v['ID']);
55
- await logger.log(listItemInstances[0]);
56
61
  }
57
62
  else {
58
63
  throw 'The specified application customizer was not found';
@@ -22,8 +22,9 @@ class SpoTenantApplicationCustomizerListCommand extends SpoCommand {
22
22
  }
23
23
  const listServerRelativeUrl = urlUtil.getServerRelativePath(appCatalogUrl, '/lists/TenantWideExtensions');
24
24
  try {
25
- const response = await odata.getAllItems(`${appCatalogUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=TenantWideExtensionLocation eq 'ClientSideExtension.ApplicationCustomizer'`);
26
- await logger.log(response);
25
+ const listItems = await odata.getAllItems(`${appCatalogUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=TenantWideExtensionLocation eq 'ClientSideExtension.ApplicationCustomizer'`);
26
+ listItems.forEach(i => delete i.ID);
27
+ await logger.log(listItems);
27
28
  }
28
29
  catch (err) {
29
30
  this.handleRejectedODataJsonPromise(err);
@@ -66,7 +66,8 @@ class SpoTenantApplicationCustomizerRemoveCommand extends SpoCommand {
66
66
  throw 'The specified application customizer was not found';
67
67
  }
68
68
  if (listItemInstances.length > 1) {
69
- throw `Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.map(item => item.Id).join(', ')}`;
69
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances);
70
+ listItemInstances[0] = await Cli.handleMultipleResultsFound(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
70
71
  }
71
72
  return listItemInstances[0].Id;
72
73
  }
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoTenantApplicationCustomizerSetCommand_instances, _SpoTenantApplicationCustomizerSetCommand_initTelemetry, _SpoTenantApplicationCustomizerSetCommand_initOptions, _SpoTenantApplicationCustomizerSetCommand_initValidators, _SpoTenantApplicationCustomizerSetCommand_initOptionSets;
7
- import os from 'os';
8
7
  import { Cli } from '../../../../cli/Cli.js';
9
8
  import request from '../../../../request.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -69,7 +68,9 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
69
68
  throw 'The specified application customizer was not found';
70
69
  }
71
70
  if (listItemInstances.length > 1) {
72
- throw `Multiple application customizers with ${title ? `title '${title}'` : `ClientSideComponentId '${clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${listItemInstances.map(item => `- ${item.Id}`).join(os.EOL)}`;
71
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances);
72
+ const result = await Cli.handleMultipleResultsFound(`Multiple application customizers with ${title ? `title '${title}'` : `ClientSideComponentId '${clientSideComponentId}'`} found.`, resultAsKeyValuePair);
73
+ return result.Id;
73
74
  }
74
75
  return listItemInstances[0].Id;
75
76
  }
@@ -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 _SpoTenantCommandSetAddCommand_instances, _SpoTenantCommandSetAddCommand_initTelemetry, _SpoTenantCommandSetAddCommand_initOptions, _SpoTenantCommandSetAddCommand_initValidators;
6
+ var _SpoTenantCommandSetAddCommand_instances, _a, _SpoTenantCommandSetAddCommand_initTelemetry, _SpoTenantCommandSetAddCommand_initOptions, _SpoTenantCommandSetAddCommand_initValidators;
7
7
  import { Cli } from '../../../../cli/Cli.js';
8
8
  import { urlUtil } from '../../../../utils/urlUtil.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -149,7 +149,7 @@ class SpoTenantCommandSetAddCommand extends SpoCommand {
149
149
  }
150
150
  }
151
151
  }
152
- _SpoTenantCommandSetAddCommand_instances = new WeakSet(), _SpoTenantCommandSetAddCommand_initTelemetry = function _SpoTenantCommandSetAddCommand_initTelemetry() {
152
+ _a = SpoTenantCommandSetAddCommand, _SpoTenantCommandSetAddCommand_instances = new WeakSet(), _SpoTenantCommandSetAddCommand_initTelemetry = function _SpoTenantCommandSetAddCommand_initTelemetry() {
153
153
  this.telemetry.push((args) => {
154
154
  Object.assign(this.telemetryProperties, {
155
155
  listType: args.options.listType,
@@ -163,7 +163,7 @@ _SpoTenantCommandSetAddCommand_instances = new WeakSet(), _SpoTenantCommandSetAd
163
163
  option: '-t, --title <title>'
164
164
  }, {
165
165
  option: '-l, --listType <listType>',
166
- autocomplete: SpoTenantCommandSetAddCommand.listTypes
166
+ autocomplete: _a.listTypes
167
167
  }, {
168
168
  option: '-i, --clientSideComponentId <clientSideComponentId>'
169
169
  }, {
@@ -172,18 +172,18 @@ _SpoTenantCommandSetAddCommand_instances = new WeakSet(), _SpoTenantCommandSetAd
172
172
  option: '-w, --webTemplate [webTemplate]'
173
173
  }, {
174
174
  option: '--location [location]',
175
- autocomplete: SpoTenantCommandSetAddCommand.locations
175
+ autocomplete: _a.locations
176
176
  });
177
177
  }, _SpoTenantCommandSetAddCommand_initValidators = function _SpoTenantCommandSetAddCommand_initValidators() {
178
178
  this.validators.push(async (args) => {
179
179
  if (!validation.isValidGuid(args.options.clientSideComponentId)) {
180
180
  return `${args.options.clientSideComponentId} is not a valid GUID`;
181
181
  }
182
- if (SpoTenantCommandSetAddCommand.listTypes.indexOf(args.options.listType) < 0) {
183
- return `${args.options.listType} is not a valid list type. Allowed values are ${SpoTenantCommandSetAddCommand.listTypes.join(', ')}`;
182
+ if (_a.listTypes.indexOf(args.options.listType) < 0) {
183
+ return `${args.options.listType} is not a valid list type. Allowed values are ${_a.listTypes.join(', ')}`;
184
184
  }
185
- if (args.options.location && SpoTenantCommandSetAddCommand.locations.indexOf(args.options.location) < 0) {
186
- return `${args.options.location} is not a valid location. Allowed values are ${SpoTenantCommandSetAddCommand.locations.join(', ')}`;
185
+ if (args.options.location && _a.locations.indexOf(args.options.location) < 0) {
186
+ return `${args.options.location} is not a valid location. Allowed values are ${_a.locations.join(', ')}`;
187
187
  }
188
188
  return true;
189
189
  });
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoTenantCommandSetGetCommand_instances, _SpoTenantCommandSetGetCommand_initTelemetry, _SpoTenantCommandSetGetCommand_initOptions, _SpoTenantCommandSetGetCommand_initValidators, _SpoTenantCommandSetGetCommand_initOptionSets;
7
+ import { Cli } from '../../../../cli/Cli.js';
7
8
  import { CommandError } from '../../../../Command.js';
8
9
  import request from '../../../../request.js';
9
10
  import { formatting } from '../../../../utils/formatting.js';
@@ -53,11 +54,15 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
53
54
  try {
54
55
  const listItemInstances = await request.get(reqOptions);
55
56
  if (listItemInstances?.value.length > 0) {
57
+ listItemInstances.value.forEach(v => delete v['ID']);
56
58
  if (listItemInstances.value.length > 1) {
57
- throw `Multiple ListView Command Sets with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.value.map(item => item.Id).join(', ')}`;
59
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances.value);
60
+ const result = await Cli.handleMultipleResultsFound(`Multiple ListView Command Sets with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
61
+ await logger.log(result);
62
+ }
63
+ else {
64
+ await logger.log(listItemInstances.value[0]);
58
65
  }
59
- listItemInstances.value.forEach(v => delete v['ID']);
60
- await logger.log(listItemInstances.value[0]);
61
66
  }
62
67
  else {
63
68
  throw 'The specified ListView Command Set was not found';
@@ -25,8 +25,9 @@ class SpoTenantCommandSetListCommand extends SpoCommand {
25
25
  }
26
26
  const listServerRelativeUrl = urlUtil.getServerRelativePath(appCatalogUrl, '/lists/TenantWideExtensions');
27
27
  try {
28
- const response = await odata.getAllItems(`${appCatalogUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=startswith(TenantWideExtensionLocation, 'ClientSideExtension.ListViewCommandSet')`);
29
- await logger.log(response);
28
+ const listItems = await odata.getAllItems(`${appCatalogUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=startswith(TenantWideExtensionLocation, 'ClientSideExtension.ListViewCommandSet')`);
29
+ listItems.forEach(i => delete i.ID);
30
+ await logger.log(listItems);
30
31
  }
31
32
  catch (err) {
32
33
  this.handleRejectedODataJsonPromise(err);
@@ -90,7 +90,9 @@ class SpoTenantCommandSetRemoveCommand extends SpoCommand {
90
90
  throw 'The specified command set was not found';
91
91
  }
92
92
  if (listItemInstances.length > 1) {
93
- throw `Multiple command sets with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.map(item => item.Id).join(', ')}`;
93
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances);
94
+ const result = await Cli.handleMultipleResultsFound(`Multiple command sets with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
95
+ return result.Id;
94
96
  }
95
97
  return listItemInstances[0].Id;
96
98
  }
@@ -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 _SpoTenantCommandSetSetCommand_instances, _SpoTenantCommandSetSetCommand_initTelemetry, _SpoTenantCommandSetSetCommand_initOptions, _SpoTenantCommandSetSetCommand_initValidators;
6
+ var _SpoTenantCommandSetSetCommand_instances, _a, _SpoTenantCommandSetSetCommand_initTelemetry, _SpoTenantCommandSetSetCommand_initOptions, _SpoTenantCommandSetSetCommand_initValidators;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
9
  import { spo } from '../../../../utils/spo.js';
@@ -129,7 +129,7 @@ class SpoTenantCommandSetSetCommand extends SpoCommand {
129
129
  }
130
130
  }
131
131
  }
132
- _SpoTenantCommandSetSetCommand_instances = new WeakSet(), _SpoTenantCommandSetSetCommand_initTelemetry = function _SpoTenantCommandSetSetCommand_initTelemetry() {
132
+ _a = SpoTenantCommandSetSetCommand, _SpoTenantCommandSetSetCommand_instances = new WeakSet(), _SpoTenantCommandSetSetCommand_initTelemetry = function _SpoTenantCommandSetSetCommand_initTelemetry() {
133
133
  this.telemetry.push((args) => {
134
134
  Object.assign(this.telemetryProperties, {
135
135
  newTitle: typeof args.options.newTitle !== 'undefined',
@@ -147,7 +147,7 @@ _SpoTenantCommandSetSetCommand_instances = new WeakSet(), _SpoTenantCommandSetSe
147
147
  option: '-t, --newTitle [newTitle]'
148
148
  }, {
149
149
  option: '-l, --listType [listType]',
150
- autocomplete: SpoTenantCommandSetSetCommand.listTypes
150
+ autocomplete: _a.listTypes
151
151
  }, {
152
152
  option: '-c, --clientSideComponentId [clientSideComponentId]'
153
153
  }, {
@@ -156,7 +156,7 @@ _SpoTenantCommandSetSetCommand_instances = new WeakSet(), _SpoTenantCommandSetSe
156
156
  option: '-w, --webTemplate [webTemplate]'
157
157
  }, {
158
158
  option: '--location [location]',
159
- autocomplete: SpoTenantCommandSetSetCommand.locations
159
+ autocomplete: _a.locations
160
160
  });
161
161
  }, _SpoTenantCommandSetSetCommand_initValidators = function _SpoTenantCommandSetSetCommand_initValidators() {
162
162
  this.validators.push(async (args) => {
@@ -171,11 +171,11 @@ _SpoTenantCommandSetSetCommand_instances = new WeakSet(), _SpoTenantCommandSetSe
171
171
  if (args.options.clientSideComponentId && !validation.isValidGuid(args.options.clientSideComponentId)) {
172
172
  return `${args.options.clientSideComponentId} is not a valid GUID`;
173
173
  }
174
- if (args.options.listType && SpoTenantCommandSetSetCommand.listTypes.indexOf(args.options.listType) < 0) {
175
- return `${args.options.listType} is not a valid list type. Allowed values are ${SpoTenantCommandSetSetCommand.listTypes.join(', ')}`;
174
+ if (args.options.listType && _a.listTypes.indexOf(args.options.listType) < 0) {
175
+ return `${args.options.listType} is not a valid list type. Allowed values are ${_a.listTypes.join(', ')}`;
176
176
  }
177
- if (args.options.location && SpoTenantCommandSetSetCommand.locations.indexOf(args.options.location) < 0) {
178
- return `${args.options.location} is not a valid location. Allowed values are ${SpoTenantCommandSetSetCommand.locations.join(', ')}`;
177
+ if (args.options.location && _a.locations.indexOf(args.options.location) < 0) {
178
+ return `${args.options.location} is not a valid location. Allowed values are ${_a.locations.join(', ')}`;
179
179
  }
180
180
  return true;
181
181
  });