@pnp/cli-microsoft365 10.1.0-beta.6c6be23 → 10.1.0-beta.deac605

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 (55) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/AuthServer.js +1 -1
  4. package/dist/Command.js +1 -1
  5. package/dist/cli/cli.js +2 -2
  6. package/dist/m365/entra/commands/m365group/m365group-add.js +1 -1
  7. package/dist/m365/entra/commands/m365group/m365group-list.js +1 -1
  8. package/dist/m365/entra/commands/m365group/m365group-set.js +1 -1
  9. package/dist/m365/file/commands/convert/convert-pdf.js +3 -4
  10. package/dist/m365/file/commands/file-add.js +5 -6
  11. package/dist/m365/pp/commands/{chatbot/chatbot-get.js → copilot/copilot-get.js} +24 -20
  12. package/dist/m365/pp/commands/{chatbot/chatbot-list.js → copilot/copilot-list.js} +16 -12
  13. package/dist/m365/pp/commands/{chatbot/chatbot-remove.js → copilot/copilot-remove.js} +28 -24
  14. package/dist/m365/pp/commands.js +3 -0
  15. package/dist/m365/spfx/commands/package/package-generate.js +1 -1
  16. package/dist/m365/spfx/commands/project/JsonRule.js +2 -2
  17. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN016004_TS_property_pane_property_import.js +2 -2
  18. package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
  19. package/dist/m365/spo/commands/file/file-add.js +1 -1
  20. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -2
  21. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -2
  22. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -2
  23. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -2
  24. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +10 -8
  25. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +1 -1
  26. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +1 -2
  27. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +1 -2
  28. package/dist/m365/spo/commands/page/page-add.js +1 -1
  29. package/dist/m365/spo/commands/site/site-admin-add.js +4 -12
  30. package/dist/m365/spo/commands/site/site-admin-list.js +3 -11
  31. package/dist/m365/spo/commands/site/site-admin-remove.js +4 -12
  32. package/dist/m365/spo/commands/site/site-set.js +1 -1
  33. package/dist/m365/spp/commands/model/model-remove.js +105 -0
  34. package/dist/m365/spp/commands.js +2 -1
  35. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  36. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -8
  37. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -8
  38. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -8
  39. package/dist/m365/todo/commands/list/list-remove.js +2 -1
  40. package/dist/m365/todo/commands/list/list-set.js +2 -1
  41. package/dist/m365/todo/commands/task/task-add.js +2 -1
  42. package/dist/m365/todo/commands/task/task-get.js +2 -1
  43. package/dist/m365/todo/commands/task/task-list.js +2 -1
  44. package/dist/m365/todo/commands/task/task-remove.js +2 -1
  45. package/dist/m365/todo/commands/task/task-set.js +1 -1
  46. package/dist/utils/formatting.js +8 -20
  47. package/dist/utils/spo.js +5 -4
  48. package/dist/utils/spp.js +3 -3
  49. package/dist/utils/urlUtil.js +11 -14
  50. package/docs/docs/cmd/pp/{chatbot/chatbot-get.mdx → copilot/copilot-get.mdx} +24 -18
  51. package/docs/docs/cmd/pp/{chatbot/chatbot-list.mdx → copilot/copilot-list.mdx} +20 -14
  52. package/docs/docs/cmd/pp/{chatbot/chatbot-remove.mdx → copilot/copilot-remove.mdx} +16 -10
  53. package/docs/docs/cmd/spp/model/model-remove.mdx +57 -0
  54. package/npm-shrinkwrap.json +6 -0
  55. package/package.json +3 -1
@@ -17,7 +17,7 @@ export class AuthServer {
17
17
  this.httpServer = http.createServer(this.httpRequest).listen(0, this.httpListener);
18
18
  };
19
19
  this.httpListener = async () => {
20
- const requestState = Math.random().toString(16).substr(2, 20);
20
+ const requestState = Math.random().toString(16).substring(2, 22);
21
21
  const address = this.httpServer.address();
22
22
  this.generatedServerUrl = `http://localhost:${address.port}`;
23
23
  const url = `${Auth.getEndpointForResource('https://login.microsoftonline.com', this.connection.cloudType)}/${this.connection.tenant}/oauth2/authorize?response_type=code&client_id=${this.connection.appId}&redirect_uri=${this.generatedServerUrl}&state=${requestState}&resource=${this.resource}&prompt=select_account`;
package/dist/Command.js CHANGED
@@ -234,7 +234,7 @@ class Command {
234
234
  if (pos1 > -1) {
235
235
  pos = pos1;
236
236
  }
237
- commandName = commandName.substr(0, pos).trim();
237
+ commandName = commandName.substring(0, pos).trim();
238
238
  }
239
239
  return commandName;
240
240
  }
package/dist/cli/cli.js CHANGED
@@ -702,7 +702,7 @@ function printAvailableCommands() {
702
702
  commandsToPrint[commandName] = command;
703
703
  }
704
704
  else {
705
- const subCommandsGroup = commandName.substr(0, pos);
705
+ const subCommandsGroup = commandName.substring(0, pos);
706
706
  if (!commandGroupsToPrint[subCommandsGroup]) {
707
707
  commandGroupsToPrint[subCommandsGroup] = 0;
708
708
  }
@@ -867,7 +867,7 @@ function loadOptionValuesFromFiles(args) {
867
867
  !value.startsWith('@')) {
868
868
  return;
869
869
  }
870
- const filePath = value.substr(1);
870
+ const filePath = value.substring(1);
871
871
  // if the file doesn't exist, leave as-is, if it exists replace with
872
872
  // contents from the file
873
873
  if (fs.existsSync(filePath)) {
@@ -171,7 +171,7 @@ class EntraM365GroupAddCommand extends GraphCommand {
171
171
  }
172
172
  }
173
173
  getImageContentType(imagePath) {
174
- const extension = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
174
+ const extension = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();
175
175
  switch (extension) {
176
176
  case '.png':
177
177
  return 'image/png';
@@ -72,7 +72,7 @@ class EntraM365GroupListCommand extends GraphCommand {
72
72
  const res = await request.get(requestOptions);
73
73
  return {
74
74
  id: groupId,
75
- url: res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : ''
75
+ url: res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : ''
76
76
  };
77
77
  }
78
78
  }
@@ -128,7 +128,7 @@ class EntraM365GroupSetCommand extends GraphCommand {
128
128
  }
129
129
  }
130
130
  getImageContentType(imagePath) {
131
- const extension = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
131
+ const extension = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();
132
132
  switch (extension) {
133
133
  case '.png':
134
134
  return 'image/png';
@@ -7,7 +7,6 @@ var _FileConvertPdfCommand_instances, _FileConvertPdfCommand_initOptions, _FileC
7
7
  import fs from 'fs';
8
8
  import os from 'os';
9
9
  import path from 'path';
10
- import url from 'url';
11
10
  import { v4 } from 'uuid';
12
11
  import auth from '../../../../Auth.js';
13
12
  import { CommandError } from '../../../../Command.js';
@@ -179,12 +178,12 @@ class FileConvertPdfCommand extends GraphCommand {
179
178
  }
180
179
  return fileGraphUrl;
181
180
  }
182
- const _url = url.parse(fileWebUrl);
181
+ const _url = new URL(fileWebUrl);
183
182
  let siteId = '';
184
183
  let driveRelativeFileUrl = '';
185
- const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.host, _url.path);
184
+ const siteInfo = await this.getGraphSiteInfoFromFullUrl(_url.hostname, _url.pathname);
186
185
  siteId = siteInfo.id;
187
- let siteRelativeFileUrl = _url.path.replace(siteInfo.serverRelativeUrl, '');
186
+ let siteRelativeFileUrl = _url.pathname.replace(siteInfo.serverRelativeUrl, '');
188
187
  // normalize site-relative URLs for root site collections and root sites
189
188
  if (!siteRelativeFileUrl.startsWith('/')) {
190
189
  siteRelativeFileUrl = '/' + siteRelativeFileUrl;
@@ -6,7 +6,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _FileAddCommand_instances, _FileAddCommand_initTelemetry, _FileAddCommand_initOptions, _FileAddCommand_initValidators;
7
7
  import fs from 'fs';
8
8
  import path from 'path';
9
- import url from 'url';
10
9
  import request from '../../../request.js';
11
10
  import { validation } from '../../../utils/validation.js';
12
11
  import GraphCommand from '../../base/GraphCommand.js';
@@ -28,7 +27,7 @@ class FileAddCommand extends GraphCommand {
28
27
  async commandAction(logger, args) {
29
28
  let folderUrlWithoutTrailingSlash = args.options.folderUrl;
30
29
  if (folderUrlWithoutTrailingSlash.endsWith('/')) {
31
- folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substr(0, folderUrlWithoutTrailingSlash.length - 1);
30
+ folderUrlWithoutTrailingSlash = folderUrlWithoutTrailingSlash.substring(0, folderUrlWithoutTrailingSlash.length - 1);
32
31
  }
33
32
  try {
34
33
  const graphFileUrl = await this.getGraphFileUrl(logger, `${folderUrlWithoutTrailingSlash}/${path.basename(args.options.filePath)}`, args.options.siteUrl);
@@ -97,14 +96,14 @@ class FileAddCommand extends GraphCommand {
97
96
  if (this.debug) {
98
97
  await logger.logToStderr(`Resolving Graph drive item URL for ${fileWebUrl}`);
99
98
  }
100
- const _fileWebUrl = url.parse(fileWebUrl);
101
- const _siteUrl = url.parse(siteUrl || fileWebUrl);
99
+ const _fileWebUrl = new URL(fileWebUrl);
100
+ const _siteUrl = new URL(siteUrl || fileWebUrl);
102
101
  const isSiteUrl = typeof siteUrl !== 'undefined';
103
102
  let siteId = '';
104
103
  let driveRelativeFileUrl = '';
105
- const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host, _siteUrl.path, isSiteUrl);
104
+ const siteInfo = await this.getGraphSiteInfoFromFullUrl(_siteUrl.host, _siteUrl.pathname, isSiteUrl);
106
105
  siteId = siteInfo.id;
107
- let siteRelativeFileUrl = _fileWebUrl.path.replace(siteInfo.serverRelativeUrl, '');
106
+ let siteRelativeFileUrl = _fileWebUrl.pathname.replace(siteInfo.serverRelativeUrl, '');
108
107
  // normalize site-relative URLs for root site collections and root sites
109
108
  if (!siteRelativeFileUrl.startsWith('/')) {
110
109
  siteRelativeFileUrl = '/' + siteRelativeFileUrl;
@@ -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 _PpChatbotGetCommand_instances, _PpChatbotGetCommand_initTelemetry, _PpChatbotGetCommand_initOptions, _PpChatbotGetCommand_initOptionSets, _PpChatbotGetCommand_initValidators;
6
+ var _PpCopilotGetCommand_instances, _PpCopilotGetCommand_initTelemetry, _PpCopilotGetCommand_initOptions, _PpCopilotGetCommand_initOptionSets, _PpCopilotGetCommand_initValidators;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
9
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
@@ -11,38 +11,42 @@ import { validation } from '../../../../utils/validation.js';
11
11
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
12
12
  import commands from '../../commands.js';
13
13
  import { cli } from '../../../../cli/cli.js';
14
- class PpChatbotGetCommand extends PowerPlatformCommand {
14
+ class PpCopilotGetCommand extends PowerPlatformCommand {
15
15
  get name() {
16
- return commands.CHATBOT_GET;
16
+ return commands.COPILOT_GET;
17
17
  }
18
18
  get description() {
19
- return 'Get information about the specified chatbot';
19
+ return 'Get information about the specified copilot';
20
+ }
21
+ alias() {
22
+ return [commands.CHATBOT_GET];
20
23
  }
21
24
  defaultProperties() {
22
25
  return ['name', 'botid', 'publishedon', 'createdon', 'modifiedon'];
23
26
  }
24
27
  constructor() {
25
28
  super();
26
- _PpChatbotGetCommand_instances.add(this);
27
- __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initValidators).call(this);
30
- __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initOptionSets).call(this);
29
+ _PpCopilotGetCommand_instances.add(this);
30
+ __classPrivateFieldGet(this, _PpCopilotGetCommand_instances, "m", _PpCopilotGetCommand_initTelemetry).call(this);
31
+ __classPrivateFieldGet(this, _PpCopilotGetCommand_instances, "m", _PpCopilotGetCommand_initOptions).call(this);
32
+ __classPrivateFieldGet(this, _PpCopilotGetCommand_instances, "m", _PpCopilotGetCommand_initValidators).call(this);
33
+ __classPrivateFieldGet(this, _PpCopilotGetCommand_instances, "m", _PpCopilotGetCommand_initOptionSets).call(this);
31
34
  }
32
35
  async commandAction(logger, args) {
36
+ await this.showDeprecationWarning(logger, commands.CHATBOT_GET, commands.COPILOT_GET);
33
37
  if (this.verbose) {
34
- await logger.logToStderr(`Retrieving chatbot '${args.options.id || args.options.name}'...`);
38
+ await logger.logToStderr(`Retrieving copilot '${args.options.id || args.options.name}'...`);
35
39
  }
36
40
  try {
37
41
  const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
38
- const res = await this.getChatbot(dynamicsApiUrl, args.options);
42
+ const res = await this.getCopilot(dynamicsApiUrl, args.options);
39
43
  await logger.log(res);
40
44
  }
41
45
  catch (err) {
42
46
  this.handleRejectedODataJsonPromise(err);
43
47
  }
44
48
  }
45
- async getChatbot(dynamicsApiUrl, options) {
49
+ async getCopilot(dynamicsApiUrl, options) {
46
50
  const requestOptions = {
47
51
  headers: {
48
52
  accept: 'application/json;odata.metadata=none'
@@ -58,15 +62,15 @@ class PpChatbotGetCommand extends PowerPlatformCommand {
58
62
  const result = await request.get(requestOptions);
59
63
  if (result.value.length > 1) {
60
64
  const resultAsKeyValuePair = formatting.convertArrayToHashTable('botid', result.value);
61
- return await cli.handleMultipleResultsFound(`Multiple chatbots with name '${options.name}' found.`, resultAsKeyValuePair);
65
+ return await cli.handleMultipleResultsFound(`Multiple copilots with name '${options.name}' found.`, resultAsKeyValuePair);
62
66
  }
63
67
  if (result.value.length === 0) {
64
- throw `The specified chatbot '${options.name}' does not exist.`;
68
+ throw `The specified copilot '${options.name}' does not exist.`;
65
69
  }
66
70
  return result.value[0];
67
71
  }
68
72
  }
69
- _PpChatbotGetCommand_instances = new WeakSet(), _PpChatbotGetCommand_initTelemetry = function _PpChatbotGetCommand_initTelemetry() {
73
+ _PpCopilotGetCommand_instances = new WeakSet(), _PpCopilotGetCommand_initTelemetry = function _PpCopilotGetCommand_initTelemetry() {
70
74
  this.telemetry.push((args) => {
71
75
  Object.assign(this.telemetryProperties, {
72
76
  id: typeof args.options.id !== 'undefined',
@@ -74,7 +78,7 @@ _PpChatbotGetCommand_instances = new WeakSet(), _PpChatbotGetCommand_initTelemet
74
78
  asAdmin: !!args.options.asAdmin
75
79
  });
76
80
  });
77
- }, _PpChatbotGetCommand_initOptions = function _PpChatbotGetCommand_initOptions() {
81
+ }, _PpCopilotGetCommand_initOptions = function _PpCopilotGetCommand_initOptions() {
78
82
  this.options.unshift({
79
83
  option: '-e, --environmentName <environmentName>'
80
84
  }, {
@@ -84,9 +88,9 @@ _PpChatbotGetCommand_instances = new WeakSet(), _PpChatbotGetCommand_initTelemet
84
88
  }, {
85
89
  option: '--asAdmin'
86
90
  });
87
- }, _PpChatbotGetCommand_initOptionSets = function _PpChatbotGetCommand_initOptionSets() {
91
+ }, _PpCopilotGetCommand_initOptionSets = function _PpCopilotGetCommand_initOptionSets() {
88
92
  this.optionSets.push({ options: ['id', 'name'] });
89
- }, _PpChatbotGetCommand_initValidators = function _PpChatbotGetCommand_initValidators() {
93
+ }, _PpCopilotGetCommand_initValidators = function _PpCopilotGetCommand_initValidators() {
90
94
  this.validators.push(async (args) => {
91
95
  if (args.options.id && !validation.isValidGuid(args.options.id)) {
92
96
  return `${args.options.id} is not a valid GUID`;
@@ -94,5 +98,5 @@ _PpChatbotGetCommand_instances = new WeakSet(), _PpChatbotGetCommand_initTelemet
94
98
  return true;
95
99
  });
96
100
  };
97
- export default new PpChatbotGetCommand();
98
- //# sourceMappingURL=chatbot-get.js.map
101
+ export default new PpCopilotGetCommand();
102
+ //# sourceMappingURL=copilot-get.js.map
@@ -3,30 +3,34 @@ 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 _PpChatbotListCommand_instances, _PpChatbotListCommand_initTelemetry, _PpChatbotListCommand_initOptions;
6
+ var _PpCopilotListCommand_instances, _PpCopilotListCommand_initTelemetry, _PpCopilotListCommand_initOptions;
7
7
  import { odata } from '../../../../utils/odata.js';
8
8
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
9
9
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
10
10
  import commands from '../../commands.js';
11
- class PpChatbotListCommand extends PowerPlatformCommand {
11
+ class PpCopilotListCommand extends PowerPlatformCommand {
12
12
  get name() {
13
- return commands.CHATBOT_LIST;
13
+ return commands.COPILOT_LIST;
14
14
  }
15
15
  get description() {
16
- return 'Lists Microsoft Power Platform chatbots in the specified Power Platform environment';
16
+ return 'Lists Microsoft Power Platform copilots in the specified Power Platform environment';
17
+ }
18
+ alias() {
19
+ return [commands.CHATBOT_LIST];
17
20
  }
18
21
  defaultProperties() {
19
22
  return ['name', 'botid', 'publishedOn', 'createdOn', 'botModifiedOn'];
20
23
  }
21
24
  constructor() {
22
25
  super();
23
- _PpChatbotListCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _PpChatbotListCommand_instances, "m", _PpChatbotListCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _PpChatbotListCommand_instances, "m", _PpChatbotListCommand_initOptions).call(this);
26
+ _PpCopilotListCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpCopilotListCommand_instances, "m", _PpCopilotListCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpCopilotListCommand_instances, "m", _PpCopilotListCommand_initOptions).call(this);
26
29
  }
27
30
  async commandAction(logger, args) {
31
+ await this.showDeprecationWarning(logger, commands.CHATBOT_LIST, commands.COPILOT_LIST);
28
32
  if (this.verbose) {
29
- await logger.logToStderr(`Retrieving list of chatbots for environment '${args.options.environmentName}'.`);
33
+ await logger.logToStderr(`Retrieving list of copilots for environment '${args.options.environmentName}'.`);
30
34
  }
31
35
  const fetchXml = `
32
36
  <fetch mapping='logical' version='1.0' >
@@ -78,18 +82,18 @@ class PpChatbotListCommand extends PowerPlatformCommand {
78
82
  }
79
83
  }
80
84
  }
81
- _PpChatbotListCommand_instances = new WeakSet(), _PpChatbotListCommand_initTelemetry = function _PpChatbotListCommand_initTelemetry() {
85
+ _PpCopilotListCommand_instances = new WeakSet(), _PpCopilotListCommand_initTelemetry = function _PpCopilotListCommand_initTelemetry() {
82
86
  this.telemetry.push((args) => {
83
87
  Object.assign(this.telemetryProperties, {
84
88
  asAdmin: !!args.options.asAdmin
85
89
  });
86
90
  });
87
- }, _PpChatbotListCommand_initOptions = function _PpChatbotListCommand_initOptions() {
91
+ }, _PpCopilotListCommand_initOptions = function _PpCopilotListCommand_initOptions() {
88
92
  this.options.unshift({
89
93
  option: '-e, --environmentName <environmentName>'
90
94
  }, {
91
95
  option: '--asAdmin'
92
96
  });
93
97
  };
94
- export default new PpChatbotListCommand();
95
- //# sourceMappingURL=chatbot-list.js.map
98
+ export default new PpCopilotListCommand();
99
+ //# sourceMappingURL=copilot-list.js.map
@@ -3,44 +3,48 @@ 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 _PpChatbotRemoveCommand_instances, _PpChatbotRemoveCommand_initTelemetry, _PpChatbotRemoveCommand_initOptions, _PpChatbotRemoveCommand_initOptionSets, _PpChatbotRemoveCommand_initValidators;
6
+ var _PpCopilotRemoveCommand_instances, _PpCopilotRemoveCommand_initTelemetry, _PpCopilotRemoveCommand_initOptions, _PpCopilotRemoveCommand_initOptionSets, _PpCopilotRemoveCommand_initValidators;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
12
12
  import commands from '../../commands.js';
13
- import ppChatbotGetCommand from './chatbot-get.js';
14
- class PpChatbotRemoveCommand extends PowerPlatformCommand {
13
+ import ppCopilotGetCommand from './copilot-get.js';
14
+ class PpCopilotRemoveCommand extends PowerPlatformCommand {
15
15
  get name() {
16
- return commands.CHATBOT_REMOVE;
16
+ return commands.COPILOT_REMOVE;
17
17
  }
18
18
  get description() {
19
- return 'Removes the specified chatbot';
19
+ return 'Removes the specified copilot';
20
+ }
21
+ alias() {
22
+ return [commands.CHATBOT_REMOVE];
20
23
  }
21
24
  constructor() {
22
25
  super();
23
- _PpChatbotRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initOptionSets).call(this);
26
+ _PpCopilotRemoveCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpCopilotRemoveCommand_instances, "m", _PpCopilotRemoveCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpCopilotRemoveCommand_instances, "m", _PpCopilotRemoveCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _PpCopilotRemoveCommand_instances, "m", _PpCopilotRemoveCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _PpCopilotRemoveCommand_instances, "m", _PpCopilotRemoveCommand_initOptionSets).call(this);
28
31
  }
29
32
  async commandAction(logger, args) {
33
+ await this.showDeprecationWarning(logger, commands.CHATBOT_REMOVE, commands.COPILOT_REMOVE);
30
34
  if (this.verbose) {
31
- await logger.logToStderr(`Removing chatbot '${args.options.id || args.options.name}'...`);
35
+ await logger.logToStderr(`Removing copilot '${args.options.id || args.options.name}'...`);
32
36
  }
33
37
  if (args.options.force) {
34
- await this.deleteChatbot(args);
38
+ await this.deleteCopilot(args);
35
39
  }
36
40
  else {
37
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove chatbot '${args.options.id || args.options.name}'?` });
41
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove copilot '${args.options.id || args.options.name}'?` });
38
42
  if (result) {
39
- await this.deleteChatbot(args);
43
+ await this.deleteCopilot(args);
40
44
  }
41
45
  }
42
46
  }
43
- async getChatbotId(args) {
47
+ async getCopilotId(args) {
44
48
  if (args.options.id) {
45
49
  return args.options.id;
46
50
  }
@@ -51,14 +55,14 @@ class PpChatbotRemoveCommand extends PowerPlatformCommand {
51
55
  debug: this.debug,
52
56
  verbose: this.verbose
53
57
  };
54
- const output = await cli.executeCommandWithOutput(ppChatbotGetCommand, { options: { ...options, _: [] } });
58
+ const output = await cli.executeCommandWithOutput(ppCopilotGetCommand, { options: { ...options, _: [] } });
55
59
  const getBotOutput = JSON.parse(output.stdout);
56
60
  return getBotOutput.botid;
57
61
  }
58
- async deleteChatbot(args) {
62
+ async deleteCopilot(args) {
59
63
  try {
60
64
  const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
61
- const botId = await this.getChatbotId(args);
65
+ const botId = await this.getCopilotId(args);
62
66
  const requestOptions = {
63
67
  url: `${dynamicsApiUrl}/api/data/v9.1/bots(${botId})/Microsoft.Dynamics.CRM.PvaDeleteBot?tag=deprovisionbotondelete`,
64
68
  headers: {
@@ -74,7 +78,7 @@ class PpChatbotRemoveCommand extends PowerPlatformCommand {
74
78
  }
75
79
  }
76
80
  }
77
- _PpChatbotRemoveCommand_instances = new WeakSet(), _PpChatbotRemoveCommand_initTelemetry = function _PpChatbotRemoveCommand_initTelemetry() {
81
+ _PpCopilotRemoveCommand_instances = new WeakSet(), _PpCopilotRemoveCommand_initTelemetry = function _PpCopilotRemoveCommand_initTelemetry() {
78
82
  this.telemetry.push((args) => {
79
83
  Object.assign(this.telemetryProperties, {
80
84
  id: typeof args.options.id !== 'undefined',
@@ -83,7 +87,7 @@ _PpChatbotRemoveCommand_instances = new WeakSet(), _PpChatbotRemoveCommand_initT
83
87
  force: !!args.options.force
84
88
  });
85
89
  });
86
- }, _PpChatbotRemoveCommand_initOptions = function _PpChatbotRemoveCommand_initOptions() {
90
+ }, _PpCopilotRemoveCommand_initOptions = function _PpCopilotRemoveCommand_initOptions() {
87
91
  this.options.unshift({
88
92
  option: '-e, --environmentName <environmentName>'
89
93
  }, {
@@ -95,9 +99,9 @@ _PpChatbotRemoveCommand_instances = new WeakSet(), _PpChatbotRemoveCommand_initT
95
99
  }, {
96
100
  option: '-f, --force'
97
101
  });
98
- }, _PpChatbotRemoveCommand_initOptionSets = function _PpChatbotRemoveCommand_initOptionSets() {
102
+ }, _PpCopilotRemoveCommand_initOptionSets = function _PpCopilotRemoveCommand_initOptionSets() {
99
103
  this.optionSets.push({ options: ['id', 'name'] });
100
- }, _PpChatbotRemoveCommand_initValidators = function _PpChatbotRemoveCommand_initValidators() {
104
+ }, _PpCopilotRemoveCommand_initValidators = function _PpCopilotRemoveCommand_initValidators() {
101
105
  this.validators.push(async (args) => {
102
106
  if (args.options.id && !validation.isValidGuid(args.options.id)) {
103
107
  return `${args.options.id} is not a valid GUID`;
@@ -105,5 +109,5 @@ _PpChatbotRemoveCommand_instances = new WeakSet(), _PpChatbotRemoveCommand_initT
105
109
  return true;
106
110
  });
107
111
  };
108
- export default new PpChatbotRemoveCommand();
109
- //# sourceMappingURL=chatbot-remove.js.map
112
+ export default new PpCopilotRemoveCommand();
113
+ //# sourceMappingURL=copilot-remove.js.map
@@ -10,6 +10,9 @@ export default {
10
10
  CHATBOT_GET: `${prefix} chatbot get`,
11
11
  CHATBOT_LIST: `${prefix} chatbot list`,
12
12
  CHATBOT_REMOVE: `${prefix} chatbot remove`,
13
+ COPILOT_GET: `${prefix} copilot get`,
14
+ COPILOT_LIST: `${prefix} copilot list`,
15
+ COPILOT_REMOVE: `${prefix} copilot remove`,
13
16
  DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
14
17
  DATAVERSE_TABLE_GET: `${prefix} dataverse table get`,
15
18
  DATAVERSE_TABLE_REMOVE: `${prefix} dataverse table remove`,
@@ -167,7 +167,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
167
167
  return webPartName.replace(/ /g, '-');
168
168
  }
169
169
  static getWebPartAlias(webPartName) {
170
- return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substr(0, 40);
170
+ return 'AutoWP' + webPartName.replace(/[^a-zA-Z0-9]/g, '').substring(0, 40);
171
171
  }
172
172
  }
173
173
  _a = SpfxPackageGenerateCommand, _SpfxPackageGenerateCommand_instances = new WeakSet(), _SpfxPackageGenerateCommand_initTelemetry = function _SpfxPackageGenerateCommand_initTelemetry() {
@@ -51,9 +51,9 @@ export class JsonRule extends Rule {
51
51
  isArray = true;
52
52
  const pos = currentProperty.indexOf('[') + 1;
53
53
  // get array element from the property name
54
- arrayElement = currentProperty.substr(pos, currentProperty.length - pos - 1);
54
+ arrayElement = currentProperty.substring(pos, currentProperty.length - 1);
55
55
  // remove array element from the property name
56
- currentProperty = currentProperty.substr(0, pos - 1);
56
+ currentProperty = currentProperty.substring(0, pos - 1);
57
57
  }
58
58
  for (let i = 0; i < node.children.length; i++) {
59
59
  let currentNode = node.children[i];
@@ -40,8 +40,8 @@ export class FN016004_TS_property_pane_property_import extends TsRule {
40
40
  .filter(n => n.getText().indexOf('@microsoft/sp-webpart-base') > 0);
41
41
  obj.forEach(n => {
42
42
  const resource = n.getText();
43
- const importsText = resource.replace(/\s/g, '').substr(resource.indexOf('{'));
44
- const imports = importsText.substr(0, importsText.indexOf('}')).split(',');
43
+ const importsText = resource.replace(/\s/g, '').substring(resource.indexOf('{'));
44
+ const imports = importsText.substring(0, importsText.indexOf('}')).split(',');
45
45
  const importsToStay = [];
46
46
  const importsToBeMoved = [];
47
47
  imports.forEach(importName => {
@@ -929,7 +929,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
929
929
  });
930
930
  }
931
931
  getNodeVersion() {
932
- return process.version.substr(1);
932
+ return process.version.substring(1);
933
933
  }
934
934
  async checkStatus(what, versionFound, versionCheck) {
935
935
  if (versionFound) {
@@ -283,7 +283,7 @@ class SpoFileAddCommand extends SpoCommand {
283
283
  const isLastChunk = info.Position >= info.Size;
284
284
  if (isLastChunk) {
285
285
  // trim buffer for last chunk
286
- fileBuffer = fileBuffer.slice(0, readCount);
286
+ fileBuffer = fileBuffer.subarray(0, readCount);
287
287
  }
288
288
  const requestOptions = {
289
289
  url: `${info.WebUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
@@ -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 _SpoFileRetentionLabelEnsureCommand_instances, _SpoFileRetentionLabelEnsureCommand_initTelemetry, _SpoFileRetentionLabelEnsureCommand_initOptions, _SpoFileRetentionLabelEnsureCommand_initValidators, _SpoFileRetentionLabelEnsureCommand_initOptionSets, _SpoFileRetentionLabelEnsureCommand_initTypes;
7
- import * as url from 'url';
8
7
  import request from '../../../../request.js';
9
8
  import { validation } from '../../../../utils/validation.js';
10
9
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -31,7 +30,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
31
30
  async commandAction(logger, args) {
32
31
  try {
33
32
  const fileProperties = await this.getFileProperties(logger, args);
34
- const parsedUrl = url.parse(args.options.webUrl);
33
+ const parsedUrl = new URL(args.options.webUrl);
35
34
  const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
36
35
  const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);
37
36
  if (args.options.assetId) {
@@ -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 _SpoFileRetentionLabelRemoveCommand_instances, _SpoFileRetentionLabelRemoveCommand_initTelemetry, _SpoFileRetentionLabelRemoveCommand_initOptions, _SpoFileRetentionLabelRemoveCommand_initValidators, _SpoFileRetentionLabelRemoveCommand_initOptionSets, _SpoFileRetentionLabelRemoveCommand_initTypes;
7
- import * as url from 'url';
8
7
  import { cli } from '../../../../cli/cli.js';
9
8
  import request from '../../../../request.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -43,7 +42,7 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
43
42
  async removeFileRetentionLabel(logger, args) {
44
43
  try {
45
44
  const fileProperties = await this.getFileProperties(logger, args);
46
- const parsedUrl = url.parse(args.options.webUrl);
45
+ const parsedUrl = new URL(args.options.webUrl);
47
46
  const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
48
47
  const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, fileProperties.listServerRelativeUrl);
49
48
  await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(fileProperties.listItemId)], logger, args.options.verbose);
@@ -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 _SpoFolderRetentionLabelEnsureCommand_instances, _SpoFolderRetentionLabelEnsureCommand_initTelemetry, _SpoFolderRetentionLabelEnsureCommand_initOptions, _SpoFolderRetentionLabelEnsureCommand_initValidators, _SpoFolderRetentionLabelEnsureCommand_initOptionSets, _SpoFolderRetentionLabelEnsureCommand_initTypes;
7
- import * as url from 'url';
8
7
  import request from '../../../../request.js';
9
8
  import { formatting } from '../../../../utils/formatting.js';
10
9
  import { spo } from '../../../../utils/spo.js';
@@ -32,7 +31,7 @@ class SpoFolderRetentionLabelEnsureCommand extends SpoCommand {
32
31
  try {
33
32
  const folderProperties = await this.getFolderProperties(logger, args);
34
33
  if (folderProperties.ListItemAllFields) {
35
- const parsedUrl = url.parse(args.options.webUrl);
34
+ const parsedUrl = new URL(args.options.webUrl);
36
35
  const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
37
36
  const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);
38
37
  await spo.applyRetentionLabelToListItems(args.options.webUrl, args.options.name, listAbsoluteUrl, [parseInt(folderProperties.ListItemAllFields.Id)], logger, args.options.verbose);
@@ -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 _SpoFolderRetentionLabelRemoveCommand_instances, _SpoFolderRetentionLabelRemoveCommand_initTelemetry, _SpoFolderRetentionLabelRemoveCommand_initOptions, _SpoFolderRetentionLabelRemoveCommand_initValidators, _SpoFolderRetentionLabelRemoveCommand_initOptionSets, _SpoFolderRetentionLabelRemoveCommand_initTypes;
7
- import * as url from 'url';
8
7
  import { cli } from '../../../../cli/cli.js';
9
8
  import request from '../../../../request.js';
10
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -44,7 +43,7 @@ class SpoFolderRetentionLabelRemoveCommand extends SpoCommand {
44
43
  try {
45
44
  const folderProperties = await this.getFolderProperties(logger, args);
46
45
  if (folderProperties.ListItemAllFields) {
47
- const parsedUrl = url.parse(args.options.webUrl);
46
+ const parsedUrl = new URL(args.options.webUrl);
48
47
  const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
49
48
  const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, folderProperties.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl);
50
49
  await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(folderProperties.ListItemAllFields.Id)], logger, args.options.verbose);
@@ -40,7 +40,8 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
40
40
  if (args.options.filePath) {
41
41
  const csvContent = fs.readFileSync(args.options.filePath, 'utf-8');
42
42
  const jsonContent = formatting.parseCsvToJson(csvContent);
43
- idsToRemove = jsonContent.map((item) => item['ID']);
43
+ const idKey = Object.keys(jsonContent[0]).find(key => key.toLowerCase() === 'id');
44
+ idsToRemove = jsonContent.map((item) => item[idKey]);
44
45
  }
45
46
  else {
46
47
  idsToRemove = formatting.splitAndTrim(args.options.ids);
@@ -193,18 +194,19 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
193
194
  }
194
195
  const fileContent = fs.readFileSync(args.options.filePath, 'utf-8');
195
196
  const jsonContent = formatting.parseCsvToJson(fileContent);
196
- if (!jsonContent[0].hasOwnProperty('ID')) {
197
+ const idKey = Object.keys(jsonContent[0]).find(key => key.toLowerCase() === 'id');
198
+ if (!idKey) {
197
199
  return `The file does not contain the required header row with the column name 'ID'.`;
198
200
  }
199
- const nonNumbers = jsonContent.filter(element => isNaN(Number(element['ID'].toString().trim()))).map(element => element['ID']);
200
- if (nonNumbers.length > 0) {
201
- return `The specified ids '${nonNumbers.join(', ')}' are invalid numbers.`;
201
+ const invalidIDs = validation.isValidPositiveIntegerArray(jsonContent.map(element => element[idKey].toString().trim()).join(','));
202
+ if (invalidIDs !== true) {
203
+ return `The file contains one or more invalid IDs: '${invalidIDs}'.`;
202
204
  }
203
205
  }
204
206
  if (args.options.ids) {
205
- const nonNumbers = formatting.splitAndTrim(args.options.ids).filter(element => isNaN(Number(element)));
206
- if (nonNumbers.length > 0) {
207
- return `The specified ids '${nonNumbers.join(', ')}' are invalid numbers.`;
207
+ const isValidIntegerArray = validation.isValidPositiveIntegerArray(args.options.ids);
208
+ if (isValidIntegerArray !== true) {
209
+ return `Option 'ids' contains one or more invalid IDs: '${isValidIntegerArray}'.`;
208
210
  }
209
211
  }
210
212
  return true;
@@ -117,7 +117,7 @@ class SpoListItemBatchSetCommand extends SpoCommand {
117
117
  actionString += `<Method Name="SetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="Array">${lookupMultiString.join('')}</Parameter></Parameters></Method>`;
118
118
  break;
119
119
  default:
120
- actionString += `<Method Name="ParseAndSetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="String">${row[field.InternalName].toString()}</Parameter></Parameters></Method>`;
120
+ actionString += `<Method Name="ParseAndSetFieldValue" Id="${index += 1}" ObjectPathId="${objectPathId}"><Parameters><Parameter Type="String">${field.InternalName}</Parameter><Parameter Type="String">${formatting.escapeXml(row[field.InternalName].toString())}</Parameter></Parameters></Method>`;
121
121
  break;
122
122
  }
123
123
  }